summaryrefslogtreecommitdiff
path: root/src/inc
diff options
context:
space:
mode:
authorJiyoung Yun <jy910.yun@samsung.com>2016-11-23 19:09:09 +0900
committerJiyoung Yun <jy910.yun@samsung.com>2016-11-23 19:09:09 +0900
commit4b4aad7217d3292650e77eec2cf4c198ea9c3b4b (patch)
tree98110734c91668dfdbb126fcc0e15ddbd93738ca /src/inc
parentfa45f57ed55137c75ac870356a1b8f76c84b229c (diff)
downloadcoreclr-4b4aad7217d3292650e77eec2cf4c198ea9c3b4b.tar.gz
coreclr-4b4aad7217d3292650e77eec2cf4c198ea9c3b4b.tar.bz2
coreclr-4b4aad7217d3292650e77eec2cf4c198ea9c3b4b.zip
Imported Upstream version 1.1.0upstream/1.1.0
Diffstat (limited to 'src/inc')
-rw-r--r--src/inc/.gitmirrorall1
-rw-r--r--src/inc/1031/CORPerfMonSymbols.ini576
-rw-r--r--src/inc/1031/_DataPerfCounters.inibin0 -> 4664 bytes
-rw-r--r--src/inc/1031/_NetworkingPerfCounters.inibin0 -> 5246 bytes
-rw-r--r--src/inc/1031/aspnet_perf.ini415
-rw-r--r--src/inc/1031/aspnet_perf2.ini416
-rw-r--r--src/inc/1041/CORPerfMonSymbols.ini577
-rw-r--r--src/inc/1041/_DataPerfCounters.inibin0 -> 4364 bytes
-rw-r--r--src/inc/1041/_NetworkingPerfCounters.inibin0 -> 4204 bytes
-rw-r--r--src/inc/1041/aspnet_perf.ini414
-rw-r--r--src/inc/1041/aspnet_perf2.ini411
-rw-r--r--src/inc/CMakeLists.txt87
-rw-r--r--src/inc/CrstTypeTool.cs990
-rw-r--r--src/inc/CrstTypes.def781
-rw-r--r--src/inc/MSCOREE.IDL2438
-rw-r--r--src/inc/OpCodeGen.pl501
-rw-r--r--src/inc/UacAsInvoker.manifest11
-rw-r--r--src/inc/allocacheck.h84
-rw-r--r--src/inc/apithreadstress.cpp171
-rw-r--r--src/inc/apithreadstress.h90
-rw-r--r--src/inc/appxutil.h145
-rw-r--r--src/inc/arraylist.h305
-rw-r--r--src/inc/assemblyfilehash.h92
-rw-r--r--src/inc/assemblyusagelog.idl51
-rw-r--r--src/inc/assemblyusagelogmanager.h53
-rw-r--r--src/inc/bbsweep.h425
-rw-r--r--src/inc/binderngen.idl255
-rw-r--r--src/inc/bitmask.h103
-rw-r--r--src/inc/bitmask.inl292
-rw-r--r--src/inc/bitposition.h55
-rw-r--r--src/inc/bitvector.h462
-rw-r--r--src/inc/blobfetcher.h174
-rw-r--r--src/inc/cahlpr.h41
-rw-r--r--src/inc/caparser.h377
-rw-r--r--src/inc/ceefilegenwriter.h245
-rw-r--r--src/inc/ceegen.h440
-rw-r--r--src/inc/ceegentokenmapper.h142
-rw-r--r--src/inc/ceesectionstring.h55
-rw-r--r--src/inc/cfi.h33
-rw-r--r--src/inc/check.h734
-rw-r--r--src/inc/check.inl367
-rw-r--r--src/inc/circularlog.h38
-rw-r--r--src/inc/clr/fs.h16
-rw-r--r--src/inc/clr/fs/dir.h129
-rw-r--r--src/inc/clr/fs/file.h40
-rw-r--r--src/inc/clr/fs/path.h141
-rw-r--r--src/inc/clr/stack.h99
-rw-r--r--src/inc/clr/str.h28
-rw-r--r--src/inc/clr/win32.h38
-rw-r--r--src/inc/clr_std/algorithm119
-rw-r--r--src/inc/clr_std/string414
-rw-r--r--src/inc/clr_std/type_traits549
-rw-r--r--src/inc/clr_std/utility254
-rw-r--r--src/inc/clr_std/vector431
-rw-r--r--src/inc/clrconfig.h259
-rw-r--r--src/inc/clrconfigvalues.h1186
-rw-r--r--src/inc/clrdata.idl313
-rw-r--r--src/inc/clrhost.h625
-rw-r--r--src/inc/clrinternal.idl491
-rw-r--r--src/inc/clrnt.h998
-rw-r--r--src/inc/clrprivappxhosting.idl66
-rw-r--r--src/inc/clrprivbinderutil.h872
-rw-r--r--src/inc/clrprivbinding.idl324
-rw-r--r--src/inc/clrprivhosting.idl92
-rw-r--r--src/inc/clrprivruntimebinders.idl39
-rw-r--r--src/inc/clrtypes.h422
-rw-r--r--src/inc/compatibilityflags.h17
-rw-r--r--src/inc/compatibilityflagsdef.h48
-rw-r--r--src/inc/complex.h80
-rw-r--r--src/inc/configuration.h57
-rw-r--r--src/inc/contract.h2598
-rw-r--r--src/inc/contract.inl748
-rw-r--r--src/inc/contxt.h3472
-rw-r--r--src/inc/cor.h2523
-rw-r--r--src/inc/corbbtprof.h589
-rw-r--r--src/inc/corcompile.h1939
-rw-r--r--src/inc/cordbpriv.h68
-rw-r--r--src/inc/cordebug.idl7292
-rw-r--r--src/inc/cordebug_mktlb.rc11
-rw-r--r--src/inc/cordebuginfo.h323
-rw-r--r--src/inc/coredistools.h142
-rw-r--r--src/inc/coregen.h22
-rw-r--r--src/inc/corerror.xml6993
-rw-r--r--src/inc/corexcep.h42
-rw-r--r--src/inc/corguids.nativeproj438
-rw-r--r--src/inc/corguids.targets53
-rw-r--r--src/inc/corhdr.h1930
-rw-r--r--src/inc/corhlpr.cpp307
-rw-r--r--src/inc/corhlpr.h694
-rw-r--r--src/inc/corhlprpriv.cpp313
-rw-r--r--src/inc/corhlprpriv.h773
-rw-r--r--src/inc/corhost.h1188
-rw-r--r--src/inc/corimage.h67
-rw-r--r--src/inc/corinfo.h3139
-rw-r--r--src/inc/corjit.h575
-rw-r--r--src/inc/corjithost.h48
-rw-r--r--src/inc/corperm.h205
-rw-r--r--src/inc/corperme.h56
-rw-r--r--src/inc/corpermp.h57
-rw-r--r--src/inc/corpolicy.h129
-rw-r--r--src/inc/corpriv.h731
-rw-r--r--src/inc/corprof.idl3857
-rw-r--r--src/inc/corpub.idl265
-rw-r--r--src/inc/corsym.idl1785
-rw-r--r--src/inc/cortpoolhdr.h50
-rw-r--r--src/inc/cortypeinfo.h49
-rw-r--r--src/inc/crosscomp.h363
-rw-r--r--src/inc/crsttypes.h559
-rw-r--r--src/inc/crtwrap.h30
-rw-r--r--src/inc/cvconst.h3728
-rw-r--r--src/inc/cvinfo.h4989
-rw-r--r--src/inc/cycletimer.h56
-rw-r--r--src/inc/daccess.h2463
-rw-r--r--src/inc/dacprivate.h1010
-rw-r--r--src/inc/dacvars.h339
-rw-r--r--src/inc/dbgconfigstrings.h23
-rw-r--r--src/inc/dbgenginemetrics.h30
-rw-r--r--src/inc/dbgmeta.h38
-rw-r--r--src/inc/dbgportable.h141
-rw-r--r--src/inc/debugmacros.h270
-rw-r--r--src/inc/debugmacrosext.h46
-rw-r--r--src/inc/debugreturn.h127
-rw-r--r--src/inc/declsec.h255
-rw-r--r--src/inc/defaultallocator.h49
-rw-r--r--src/inc/delayloadhelpers.h113
-rw-r--r--src/inc/dlwrap.h205
-rw-r--r--src/inc/downlevel.h239
-rw-r--r--src/inc/eetwain.h725
-rw-r--r--src/inc/eexcp.h156
-rw-r--r--src/inc/entrypoints.h60
-rw-r--r--src/inc/eventtrace.h346
-rw-r--r--src/inc/eventtracebase.h1082
-rw-r--r--src/inc/ex.h1519
-rw-r--r--src/inc/expandarray.h210
-rw-r--r--src/inc/factory.h49
-rw-r--r--src/inc/factory.inl32
-rw-r--r--src/inc/fixedsizestring.h188
-rw-r--r--src/inc/fixuppointer.h597
-rw-r--r--src/inc/formattype.cpp1574
-rw-r--r--src/inc/formattype.h181
-rw-r--r--src/inc/fstream.h50
-rw-r--r--src/inc/fstring.h42
-rw-r--r--src/inc/fusion.idl530
-rw-r--r--src/inc/fusionbind.h316
-rw-r--r--src/inc/fusionpriv.idl970
-rw-r--r--src/inc/fusionsetup.h63
-rw-r--r--src/inc/fusionsink.h129
-rw-r--r--src/inc/fxretarget.h340
-rw-r--r--src/inc/gcdecoder.cpp589
-rw-r--r--src/inc/gcdump.h102
-rw-r--r--src/inc/gchost.idl144
-rw-r--r--src/inc/gcinfo.h82
-rw-r--r--src/inc/gcinfoarraylist.h114
-rw-r--r--src/inc/gcinfodecoder.h661
-rw-r--r--src/inc/gcinfodumper.h117
-rw-r--r--src/inc/gcinfoencoder.h552
-rw-r--r--src/inc/gcinfotypes.h832
-rw-r--r--src/inc/gcrefmap.h247
-rw-r--r--src/inc/genericstackprobe.h610
-rw-r--r--src/inc/genericstackprobe.inl15
-rw-r--r--src/inc/genheaders.cs222
-rw-r--r--src/inc/genrops.pl91
-rw-r--r--src/inc/getproductversionnumber.h77
-rw-r--r--src/inc/guidfromname.h19
-rw-r--r--src/inc/holder.h1515
-rw-r--r--src/inc/holderinst.h33
-rw-r--r--src/inc/iallocator.h77
-rw-r--r--src/inc/iappdomainsetup.h612
-rw-r--r--src/inc/iceefilegen.h245
-rw-r--r--src/inc/iilfingerprint.h128
-rw-r--r--src/inc/il_kywd.h303
-rw-r--r--src/inc/ildbsymlib.h21
-rw-r--r--src/inc/ilformatter.h76
-rw-r--r--src/inc/internalunknownimpl.h494
-rw-r--r--src/inc/intrinsic.h25
-rw-r--r--src/inc/ipcfunccall.h117
-rw-r--r--src/inc/ipcmanagerinterface.h204
-rw-r--r--src/inc/isolation.h2577
-rw-r--r--src/inc/isolationpriv.h18263
-rw-r--r--src/inc/iterator.h639
-rw-r--r--src/inc/ivalidator.idl116
-rw-r--r--src/inc/ivehandler.idl72
-rw-r--r--src/inc/jithelpers.h396
-rw-r--r--src/inc/jithost.h28
-rw-r--r--src/inc/jitperf.h97
-rw-r--r--src/inc/lazycow.h99
-rw-r--r--src/inc/legacyactivationshim.h1382
-rw-r--r--src/inc/legacyactivationshimdelayload.h13
-rw-r--r--src/inc/legacyactivationshimutil.h1116
-rw-r--r--src/inc/livedatatarget.h105
-rw-r--r--src/inc/llvm/Dwarf.def393
-rw-r--r--src/inc/llvm/Dwarf.h711
-rw-r--r--src/inc/llvm/ELF.h1273
-rw-r--r--src/inc/loaderheap.h1085
-rw-r--r--src/inc/log.h99
-rw-r--r--src/inc/loglf.h42
-rw-r--r--src/inc/longfilepathwrappers.h271
-rw-r--r--src/inc/marvin32.h85
-rw-r--r--src/inc/md5.h134
-rw-r--r--src/inc/mdcommon.h54
-rw-r--r--src/inc/memorypool.h143
-rw-r--r--src/inc/memoryrange.h98
-rw-r--r--src/inc/metadata.h1557
-rw-r--r--src/inc/metadataexports.h57
-rw-r--r--src/inc/metadatatracker.h367
-rw-r--r--src/inc/metahost.idl1097
-rw-r--r--src/inc/metahost_mktlb.rc11
-rw-r--r--src/inc/metahostpriv.idl212
-rw-r--r--src/inc/metamodelpub.h1672
-rw-r--r--src/inc/mpl/type_list76
-rw-r--r--src/inc/mscorcfg.h34
-rw-r--r--src/inc/mscoree_mktlb.rc12
-rw-r--r--src/inc/mscoree_tlb.idl15
-rw-r--r--src/inc/mscoreepriv.h21
-rw-r--r--src/inc/mscorpesxswrapper.h125
-rw-r--r--src/inc/mscorsvc.idl683
-rw-r--r--src/inc/mscoruef.idl117
-rw-r--r--src/inc/msodw.h585
-rw-r--r--src/inc/msodwwrap.h11
-rw-r--r--src/inc/nativevaraccessors.h48
-rw-r--r--src/inc/new.hpp27
-rw-r--r--src/inc/newapis.h352
-rw-r--r--src/inc/ngen.h153
-rw-r--r--src/inc/ngenparser.inl1087
-rw-r--r--src/inc/nibblemapmacros.h56
-rw-r--r--src/inc/nibblestream.h300
-rw-r--r--src/inc/nsutilpriv.h266
-rw-r--r--src/inc/obj/i386/dummy1
-rw-r--r--src/inc/opcode.def359
-rw-r--r--src/inc/openum.h51
-rw-r--r--src/inc/opinfo.h83
-rw-r--r--src/inc/optdefault.h12
-rw-r--r--src/inc/optsmallperfcritical.h21
-rw-r--r--src/inc/ostype.h176
-rw-r--r--src/inc/outstring.h157
-rw-r--r--src/inc/palclr.h624
-rw-r--r--src/inc/palclr_win.h206
-rw-r--r--src/inc/pedecoder.h478
-rw-r--r--src/inc/pedecoder.inl1429
-rw-r--r--src/inc/peinformation.h75
-rw-r--r--src/inc/perfcounterdefs.h495
-rw-r--r--src/inc/perfcounterdefs.inl89
-rw-r--r--src/inc/perfcounters.h124
-rw-r--r--src/inc/perflog.h142
-rw-r--r--src/inc/pesectionman.h213
-rw-r--r--src/inc/posterror.h50
-rw-r--r--src/inc/predeftlsslot.h84
-rw-r--r--src/inc/prettyprintsig.h91
-rw-r--r--src/inc/profilepriv.h156
-rw-r--r--src/inc/profilepriv.inl826
-rw-r--r--src/inc/quirksapi.h37
-rw-r--r--src/inc/random.h279
-rw-r--r--src/inc/rangetree.h141
-rw-r--r--src/inc/readytorun.h333
-rw-r--r--src/inc/readytorunhelpers.h113
-rw-r--r--src/inc/regdisp.h584
-rw-r--r--src/inc/regex_base.h973
-rw-r--r--src/inc/regex_util.h209
-rw-r--r--src/inc/registrywrapper.h48
-rw-r--r--src/inc/safemath.h872
-rw-r--r--src/inc/safewrap.h171
-rw-r--r--src/inc/sarray.h229
-rw-r--r--src/inc/sarray.inl377
-rw-r--r--src/inc/sbuffer.h575
-rw-r--r--src/inc/sbuffer.inl1711
-rw-r--r--src/inc/securityutil.h53
-rw-r--r--src/inc/securitywrapper.h111
-rw-r--r--src/inc/shash.h1105
-rw-r--r--src/inc/shash.inl935
-rw-r--r--src/inc/shim/locationinfo.h42
-rw-r--r--src/inc/shim/runtimeselector.h55
-rw-r--r--src/inc/shim/runtimeselector.inl105
-rw-r--r--src/inc/shim/shimselector.h55
-rw-r--r--src/inc/shim/shimselector.inl104
-rw-r--r--src/inc/shim/versionandlocationinfo.h36
-rw-r--r--src/inc/shim/versionandlocationinfo.inl35
-rw-r--r--src/inc/shim/versioninfo.h46
-rw-r--r--src/inc/shim/versioninfo.inl170
-rw-r--r--src/inc/shimload.h38
-rw-r--r--src/inc/sigbuilder.h79
-rw-r--r--src/inc/sigparser.h985
-rw-r--r--src/inc/simplerhash.h423
-rw-r--r--src/inc/simplerhash.inl350
-rw-r--r--src/inc/slist.h387
-rw-r--r--src/inc/sortversioning.h207
-rw-r--r--src/inc/sospriv.idl359
-rw-r--r--src/inc/sstring.h1084
-rw-r--r--src/inc/sstring.inl2279
-rw-r--r--src/inc/stack.h87
-rw-r--r--src/inc/stackframe.h130
-rw-r--r--src/inc/stacktrace.h91
-rw-r--r--src/inc/static_assert.h28
-rw-r--r--src/inc/staticcontract.h408
-rw-r--r--src/inc/stdmacros.h356
-rw-r--r--src/inc/stgpool.h1515
-rw-r--r--src/inc/stgpooli.h256
-rw-r--r--src/inc/stresslog.h841
-rw-r--r--src/inc/stringarraylist.h31
-rw-r--r--src/inc/stringarraylist.inl76
-rw-r--r--src/inc/strongname.h9
-rw-r--r--src/inc/switches.h268
-rw-r--r--src/inc/sxshelpers.h141
-rw-r--r--src/inc/sxshelpers.inl76
-rw-r--r--src/inc/testhook.h159
-rw-r--r--src/inc/tlbimpexp.idl72
-rw-r--r--src/inc/tlbutils.h52
-rw-r--r--src/inc/tls.h78
-rw-r--r--src/inc/unsafe.h102
-rw-r--r--src/inc/utilcode.h5753
-rw-r--r--src/inc/utsem.h63
-rw-r--r--src/inc/vererror.h137
-rw-r--r--src/inc/volatile.h514
-rw-r--r--src/inc/vptr_list.h156
-rw-r--r--src/inc/warningcontrol.h86
-rw-r--r--src/inc/win64unwind.h117
-rw-r--r--src/inc/winrt/ntassert.h210
-rw-r--r--src/inc/winrt/paraminstanceapi.h1749
-rw-r--r--src/inc/winrt/windowsruntime.h65
-rw-r--r--src/inc/winrt/windowsstring.h774
-rw-r--r--src/inc/winrtprojectedtypes.h271
-rw-r--r--src/inc/winsqmevents.h84
-rw-r--r--src/inc/winwrap.h1038
-rw-r--r--src/inc/xclrdata.idl2538
-rw-r--r--src/inc/xcordebug.idl85
-rw-r--r--src/inc/xmlparser.h1385
-rw-r--r--src/inc/xmlparser_i.c86
-rw-r--r--src/inc/zapper.h581
327 files changed, 177358 insertions, 0 deletions
diff --git a/src/inc/.gitmirrorall b/src/inc/.gitmirrorall
new file mode 100644
index 0000000000..9ee5c57b99
--- /dev/null
+++ b/src/inc/.gitmirrorall
@@ -0,0 +1 @@
+This folder will be mirrored by the Git-TFS Mirror recursively. \ No newline at end of file
diff --git a/src/inc/1031/CORPerfMonSymbols.ini b/src/inc/1031/CORPerfMonSymbols.ini
new file mode 100644
index 0000000000..3c656ef037
--- /dev/null
+++ b/src/inc/1031/CORPerfMonSymbols.ini
@@ -0,0 +1,576 @@
+; 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.
+
+//------------------------------------------------------------------------
+// WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
+//
+// AUTO GENERATED FILE. DO NOT EDIT. USE $/com99/src/profile/perfmonhelp
+//
+// WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
+//------------------------------------------------------------------------
+
+// CORPerfMonSymbols.ini file
+[info]
+drivername=.NETFramework
+symbolfile=CORPerfMonSymbols.h
+
+[languages]
+009=English
+; 001=Arabic
+; 004=Chinese
+ 007=German
+; 00D=Hebrew
+; 011=Japanese
+; 012=Korean
+; 00A=Spanish
+; 00C=French
+; 010=Italian
+
+[objects]
+DotNetCLR_Memory_OBJECT_009_NAME=.NET CLR Memory
+DotNetCLR_Loading_OBJECT_009_NAME=.NET CLR Loading
+DotNetCLR_Jit_OBJECT_009_NAME=.NET CLR Jit
+DotNetCLR_Interop_OBJECT_009_NAME=.NET CLR Interop
+DotNetCLR_LocksAndThreads_OBJECT_009_NAME=.NET CLR LocksAndThreads
+DotNetCLR_Security_OBJECT_009_NAME=.NET CLR Security
+DotNetCLR_Remoting_OBJECT_009_NAME=.NET CLR Remoting
+DotNetCLR_Excep_OBJECT_009_NAME=.NET CLR Exceptions
+DotNetCLR_Memory_OBJECT_007_NAME=.NET CLR-Speicher
+DotNetCLR_Loading_OBJECT_007_NAME=.NET CLR-Ladevorgang
+DotNetCLR_Jit_OBJECT_007_NAME=.NET CLR-Jit
+DotNetCLR_Interop_OBJECT_007_NAME=.NET CLR-Interop
+DotNetCLR_LocksAndThreads_OBJECT_007_NAME=.NET CLR-Sperren und Threads
+DotNetCLR_Security_OBJECT_007_NAME=.NET CLR-Sicherheit
+DotNetCLR_Remoting_OBJECT_007_NAME=.NET CLR-Remote
+DotNetCLR_Excep_OBJECT_007_NAME=.NET CLR-Ausnahmen
+
+[text]
+DotNetCLR_Memory_OBJECT_009_NAME=.NET CLR Memory
+DotNetCLR_Memory_OBJECT_009_HELP=Counters for CLR Garbage Collected heap.
+
+GEN0_COLLECTIONS_COUNTER_009_NAME=# Gen 0 Collections
+GEN0_COLLECTIONS_COUNTER_009_HELP=This counter displays the number of times the generation 0 objects (youngest; most recently allocated) are garbage collected (Gen 0 GC) since the start of the application. Gen 0 GC occurs when the available memory in generation 0 is not sufficient to satisfy an allocation request. This counter is incremented at the end of a Gen 0 GC. Higher generation GCs include all lower generation GCs. This counter is explicitly incremented when a higher generation (Gen 1 or Gen 2) GC occurs. _Global_ counter value is not accurate and should be ignored. This counter displays the last observed value.
+
+GEN1_COLLECTIONS_COUNTER_009_NAME=# Gen 1 Collections
+GEN1_COLLECTIONS_COUNTER_009_HELP=This counter displays the number of times the generation 1 objects are garbage collected since the start of the application. The counter is incremented at the end of a Gen 1 GC. Higher generation GCs include all lower generation GCs. This counter is explicitly incremented when a higher generation (Gen 2) GC occurs. _Global_ counter value is not accurate and should be ignored. This counter displays the last observed value.
+
+GEN2_COLLECTIONS_COUNTER_009_NAME=# Gen 2 Collections
+GEN2_COLLECTIONS_COUNTER_009_HELP=This counter displays the number of times the generation 2 objects (older) are garbage collected since the start of the application. The counter is incremented at the end of a Gen 2 GC (also called full GC). _Global_ counter value is not accurate and should be ignored. This counter displays the last observed value.
+
+GEN0_BYTES_PROMOTED_COUNTER_009_NAME=Promoted Memory from Gen 0
+GEN0_BYTES_PROMOTED_COUNTER_009_HELP=This counter displays the bytes of memory that survive garbage collection (GC) and are promoted from generation 0 to generation 1; objects that are promoted just because they are waiting to be finalized are not included in this counter. This counter displays the value observed at the end of the last GC; its not a cumulative counter.
+
+GEN1_BYTES_PROMOTED_COUNTER_009_NAME=Promoted Memory from Gen 1
+GEN1_BYTES_PROMOTED_COUNTER_009_HELP=This counter displays the bytes of memory that survive garbage collection (GC) and are promoted from generation 1 to generation 2; objects that are promoted just because they are waiting to be finalized are not included in this counter. This counter displays the value observed at the end of the last GC; its not a cumulative counter. This counter is reset to 0 if the last GC was a Gen 0 GC only.
+
+GEN0_PROMOTION_RATE_009_NAME=Gen 0 Promoted Bytes/Sec
+GEN0_PROMOTION_RATE_009_HELP=This counter displays the bytes per second that are promoted from generation 0 (youngest) to generation 1; objects that are promoted just because they are waiting to be finalized are not included in this counter. Memory is promoted when it survives a garbage collection. This counter was designed as an indicator of relatively long-lived objects being created per sec. This counter displays the difference between the values observed in the last two samples divided by the duration of the sample interval.
+
+GEN1_PROMOTION_RATE_009_NAME=Gen 1 Promoted Bytes/Sec
+GEN1_PROMOTION_RATE_009_HELP=This counter displays the bytes per second that are promoted from generation 1 to generation 2 (oldest); objects that are promoted just because they are waiting to be finalized are not included in this counter. Memory is promoted when it survives a garbage collection. Nothing is promoted from generation 2 since it is the oldest. This counter was designed as an indicator of very long-lived objects being created per sec. This counter displays the difference between the values observed in the last two samples divided by the duration of the sample interval.
+
+GEN0_FINALIZATION_BYTES_PROMOTED_COUNTER_009_NAME=Promoted Finalization-Memory from Gen 0
+GEN0_FINALIZATION_BYTES_PROMOTED_COUNTER_009_HELP=This counter displays the bytes of memory that are promoted from generation 0 to generation 1 just because they are waiting to be finalized. This counter displays the value observed at the end of the last GC; its not a cumulative counter.
+
+GEN1_FINALIZATION_BYTES_PROMOTED_COUNTER_009_NAME=Promoted Finalization-Memory from Gen 1
+GEN1_FINALIZATION_BYTES_PROMOTED_COUNTER_009_HELP=This counter displays the bytes of memory that are promoted from generation 1 to generation 2 just because they are waiting to be finalized. This counter displays the value observed at the end of the last GC; its not a cumulative counter. This counter is reset to 0 if the last GC was a Gen 0 GC only.
+
+GEN0_HEAP_SIZE_COUNTER_009_NAME=Gen 0 heap size
+GEN0_HEAP_SIZE_COUNTER_009_HELP=This counter displays the maximum bytes that can be allocated in generation 0 (Gen 0); its does not indicate the current number of bytes allocated in Gen 0. A Gen 0 GC is triggered when the allocations since the last GC exceed this size. The Gen 0 size is tuned by the Garbage Collector and can change during the execution of the application. At the end of a Gen 0 collection the size of the Gen 0 heap is infact 0 bytes; this counter displays the size (in bytes) of allocations that would trigger the next Gen 0 GC. This counter is updated at the end of a GC; its not updated on every allocation.
+
+GEN1_HEAP_SIZE_COUNTER_009_NAME=Gen 1 heap size
+GEN1_HEAP_SIZE_COUNTER_009_HELP=This counter displays the current number of bytes in generation 1 (Gen 1); this counter does not display the maximum size of Gen 1. Objects are not directly allocated in this generation; they are promoted from previous Gen 0 GCs. This counter is updated at the end of a GC; its not updated on every allocation.
+
+GEN2_HEAP_SIZE_COUNTER_009_NAME=Gen 2 heap size
+GEN2_HEAP_SIZE_COUNTER_009_HELP=This counter displays the current number of bytes in generation 2 (Gen 2). Objects are not directly allocated in this generation; they are promoted from Gen 1 during previous Gen 1 GCs. This counter is updated at the end of a GC; its not updated on every allocation.
+
+LARGE_OBJECT_SIZE_COUNTER_009_NAME=Large Object Heap size
+LARGE_OBJECT_SIZE_COUNTER_009_HELP=This counter displays the current size of the Large Object Heap in bytes. Objects greater than 20 KBytes are treated as large objects by the Garbage Collector and are directly allocated in a special heap; they are not promoted through the generations. This counter is updated at the end of a GC; its not updated on every allocation.
+
+SURVIVE_FINALIZE_COUNTER_009_NAME=Finalization Survivors
+SURVIVE_FINALIZE_COUNTER_009_HELP=This counter displays the number of garbage collected objects that survive a collection because they are waiting to be finalized. If these objects hold references to other objects then those objects also survive but are not counted by this counter; the "Promoted Finalization-Memory from Gen 0" and "Promoted Finalization-Memory from Gen 1" counters represent all the memory that survived due to finalization. This counter is not a cumulative counter; its updated at the end of every GC with count of the survivors during that particular GC only. This counter was designed to indicate the extra overhead that the application might incur because of finalization.
+
+NUM_HANDLES_COUNTER_009_NAME=# GC Handles
+NUM_HANDLES_COUNTER_009_HELP=This counter displays the current number of GC Handles in use. GCHandles are handles to resources external to the CLR and the managed environment. Handles occupy small amounts of memory in the GCHeap but potentially expensive unmanaged resources.
+
+ALLOCATION_RATE_COUNTER_009_NAME=Allocated Bytes/sec
+ALLOCATION_RATE_COUNTER_009_HELP=This counter displays the rate of bytes per second allocated on the GC Heap. This counter is updated at the end of every GC; not at each allocation. This counter is not an average over time; it displays the difference between the values observed in the last two samples divided by the duration of the sample interval.
+
+INDUCED_GC_COUNTER_009_NAME=# Induced GC
+INDUCED_GC_COUNTER_009_HELP=This counter displays the peak number of times a garbage collection was performed because of an explicit call to GC.Collect. Its a good practice to let the GC tune the frequency of its collections.
+
+PER_TIME_IN_GC_COUNTER_009_NAME=% Time in GC
+PER_TIME_IN_GC_COUNTER_009_HELP=% Time in GC is the percentage of elapsed time that was spent in performing a garbage collection (GC) since the last GC cycle. This counter is usually an indicator of the work done by the Garbage Collector on behalf of the application to collect and compact memory. This counter is updated only at the end of every GC and the counter value reflects the last observed value; its not an average.
+
+PER_TIME_IN_GC_COUNTER_BASE_009_NAME=Not Displayed
+PER_TIME_IN_GC_COUNTER_BASE_009_HELP=Not Displayed.
+
+TOTAL_HEAP_SIZE_COUNTER_009_NAME=# Bytes in all Heaps
+TOTAL_HEAP_SIZE_COUNTER_009_HELP=This counter is the sum of four other counters; Gen 0 Heap Size; Gen 1 Heap Size; Gen 2 Heap Size and the Large Object Heap Size. This counter indicates the current memory allocated in bytes on the GC Heaps.
+
+TOTAL_COMMITTED_MEM_COUNTER_009_NAME=# Total committed Bytes
+TOTAL_COMMITTED_MEM_COUNTER_009_HELP=This counter displays the amount of virtual memory (in bytes) currently committed by the Garbage Collector. (Committed memory is the physical memory for which space has been reserved on the disk paging file).
+
+TOTAL_RESERVED_MEM_COUNTER_009_NAME=# Total reserved Bytes
+TOTAL_RESERVED_MEM_COUNTER_009_HELP=This counter displays the amount of virtual memory (in bytes) currently reserved by the Garbage Collector. (Reserved memory is the virtual memory space reserved for the application but no disk or main memory pages have been used.)
+
+GC_PINNED_OBJECTS_009_NAME=# of Pinned Objects
+GC_PINNED_OBJECTS_009_HELP=This counter displays the number of pinned objects encountered in the last GC. This counter tracks the pinned objects only in the heaps that were garbage collected e.g. a Gen 0 GC would cause enumeration of pinned objects in the generation 0 heap only. A pinned object is one that the Garbage Collector cannot move in memory.
+
+GC_SINKBLOCKS_009_NAME=# of Sink Blocks in use
+GC_SINKBLOCKS_009_HELP=This counter displays the current number of sync blocks in use. Sync blocks are per-object data structures allocated for storing synchronization information. Sync blocks hold weak references to managed objects and need to be scanned by the Garbage Collector. Sync blocks are not limited to storing synchronization information and can also store COM interop metadata. This counter was designed to indicate performance problems with heavy use of synchronization primitives.
+
+DotNetCLR_Loading_OBJECT_009_NAME=.NET CLR Loading
+DotNetCLR_Loading_OBJECT_009_HELP=Statistics for CLR Class Loader.
+
+LOADING_CLASSES_TOTAL_009_NAME=Total Classes Loaded
+LOADING_CLASSES_TOTAL_009_HELP=This counter displays the cumulative number of classes loaded in all Assemblies since the start of this application.
+
+LOADING_TIME_009_NAME=% Time Loading
+LOADING_TIME_009_HELP=Reserved for future use.
+
+LOADING_ASMSEARCHLEN_009_NAME=Assembly Search Length
+LOADING_ASMSEARCHLEN_009_HELP=Reserved for future use.
+
+LOADING_LOADFAILURES_TOTAL_009_NAME=Total # of Load Failures
+LOADING_LOADFAILURES_TOTAL_009_HELP=This counter displays the peak number of classes that have failed to load since the start of the application. These load failures could be due to many reasons like inadequate security or illegal format. Full details can be found in the profiling services help.
+
+LOADING_LOADFAILURES_INST_009_NAME=Rate of Load Failures
+LOADING_LOADFAILURES_INST_009_HELP=This counter displays the number of classes that failed to load per second. This counter is not an average over time; it displays the difference between the values observed in the last two samples divided by the duration of the sample interval. These load failures could be due to many reasons like inadequate security or illegal format. Full details can be found in the profiling services help.
+
+LOADING_HEAPSIZE_009_NAME=Bytes in Loader Heap
+LOADING_HEAPSIZE_009_HELP=This counter displays the current size (in bytes) of the memory committed by the class loader across all AppDomains. (Committed memory is the physical memory for which space has been reserved on the disk paging file.)
+
+LOADING_APPDOMAINS_UNLOADED_TOTAL_009_NAME=Total appdomains unloaded
+LOADING_APPDOMAINS_UNLOADED_TOTAL_009_HELP=This counter displays the total number of AppDomains unloaded since the start of the application. If an AppDomain is loaded and unloaded multiple times this counter would count each of those unloads as separate.
+
+LOADING_APPDOMAINS_UNLOADED_INST_009_NAME=Rate of appdomains unloaded
+LOADING_APPDOMAINS_UNLOADED_INST_009_HELP=This counter displays the number of AppDomains unloaded per second. This counter is not an average over time; it displays the difference between the values observed in the last two samples divided by the duration of the sample interval.
+
+LOADING_CLASSES_CUR_009_NAME=Current Classes Loaded
+LOADING_CLASSES_CUR_009_HELP=This counter displays the current number of classes loaded in all Assemblies.
+
+LOADING_CLASSES_INST_009_NAME=Rate of Classes Loaded
+LOADING_CLASSES_INST_009_HELP=This counter displays the number of classes loaded per second in all Assemblies. This counter is not an average over time; it displays the difference between the values observed in the last two samples divided by the duration of the sample interval.
+
+LOADING_APPDOMAINS_CUR_009_NAME=Current appdomains
+LOADING_APPDOMAINS_CUR_009_HELP=This counter displays the current number of AppDomains loaded in this application. AppDomains (application domains) provide a secure and versatile unit of processing that the CLR can use to provide isolation between applications running in the same process.
+
+LOADING_APPDOMAINS_TOTAL_009_NAME=Total Appdomains
+LOADING_APPDOMAINS_TOTAL_009_HELP=This counter displays the peak number of AppDomains loaded since the start of this application. AppDomains (application domains) provide a secure and versatile unit of processing that the CLR can use to provide isolation between applications running in the same process.
+
+LOADING_APPDOMAINS_INST_009_NAME=Rate of appdomains
+LOADING_APPDOMAINS_INST_009_HELP=This counter displays the number of AppDomains loaded per second. AppDomains (application domains) provide a secure and versatile unit of processing that the CLR can use to provide isolation between applications running in the same process. This counter is not an average over time; it displays the difference between the values observed in the last two samples divided by the duration of the sample interval.
+
+LOADING_ASSEMBLIES_CUR_009_NAME=Current Assemblies
+LOADING_ASSEMBLIES_CUR_009_HELP=This counter displays the current number of Assemblies loaded across all AppDomains in this application. If the Assembly is loaded as domain-neutral from multiple AppDomains then this counter is incremented once only. Assemblies can be loaded as domain-neutral when their code can be shared by all AppDomains or they can be loaded as domain-specific when their code is private to the AppDomain.
+
+LOADING_ASSEMBLIES_TOTAL_009_NAME=Total Assemblies
+LOADING_ASSEMBLIES_TOTAL_009_HELP=This counter displays the total number of Assemblies loaded since the start of this application. If the Assembly is loaded as domain-neutral from multiple AppDomains then this counter is incremented once only. Assemblies can be loaded as domain-neutral when their code can be shared by all AppDomains or they can be loaded as domain-specific when their code is private to the AppDomain.
+
+LOADING_ASSEMBLIES_INST_009_NAME=Rate of Assemblies
+LOADING_ASSEMBLIES_INST_009_HELP=This counter displays the number of Assemblies loaded across all AppDomains per second. If the Assembly is loaded as domain-neutral from multiple AppDomains then this counter is incremented once only. Assemblies can be loaded as domain-neutral when their code can be shared by all AppDomains or they can be loaded as domain-specific when their code is private to the AppDomain. This counter is not an average over time; it displays the difference between the values observed in the last two samples divided by the duration of the sample interval.
+
+DotNetCLR_Jit_OBJECT_009_NAME=.NET CLR Jit
+DotNetCLR_Jit_OBJECT_009_HELP=Stats for CLR Jit.
+
+TOTAL_METHODS_JITTED_009_NAME=# of Methods Jitted
+TOTAL_METHODS_JITTED_009_HELP=This counter displays the total number of methods compiled Just-In-Time (JIT) by the CLR JIT compiler since the start of the application. This counter does not include the pre-jitted methods.
+
+JITTED_IL_CUR_009_NAME=# of IL Bytes Jitted
+JITTED_IL_CUR_009_HELP=This counter displays the total IL bytes jitted since the start of the application. This counter is exactly equivalent to the "Total # of IL Bytes Jitted" counter.
+
+JITTED_IL_TOTAL_009_NAME=Total # of IL Bytes Jitted
+JITTED_IL_TOTAL_009_HELP=This counter displays the total IL bytes jitted since the start of the application. This counter is exactly equivalent to the "# of IL Bytes Jitted" counter.
+
+JITTED_IL_INST_009_NAME=IL Bytes Jitted / sec
+JITTED_IL_INST_009_HELP=This counter displays the rate at which IL bytes are jitted per second. This counter is not an average over time; it displays the difference between the values observed in the last two samples divided by the duration of the sample interval.
+
+JIT_FAILURES_009_NAME=Standard Jit Failures
+JIT_FAILURES_009_HELP=This counter displays the peak number of methods the JIT compiler has failed to JIT since the start of the application. This failure can occur if the IL cannot be verified or if there was an internal error in the JIT compiler.
+
+TIME_IN_JIT_009_NAME=% Time in Jit
+TIME_IN_JIT_009_HELP=This counter displays the percentage of elapsed time spent in JIT compilation since the last JIT compilation phase. This counter is updated at the end of every JIT compilation phase. A JIT compilation phase is the phase when a method and its dependencies are being compiled.
+
+TIME_IN_JIT_BASE_009_NAME=Not Displayed
+TIME_IN_JIT_BASE_009_HELP=Not Displayed.
+
+DotNetCLR_Interop_OBJECT_009_NAME=.NET CLR Interop
+DotNetCLR_Interop_OBJECT_009_HELP=Stats for CLR interop.
+
+CURRENT_CCW_009_NAME=# of CCWs
+CURRENT_CCW_009_HELP=This counter displays the current number of Com-Callable-Wrappers (CCWs). A CCW is a proxy for the .NET managed object being referenced from unmanaged COM client(s). This counter was designed to indicate the number of managed objects being referenced by unmanaged COM code.
+
+CURRENT_STUBS_009_NAME=# of Stubs
+CURRENT_STUBS_009_HELP=This counter displays the current number of stubs created by the CLR. Stubs are responsible for marshalling arguments and return values from managed to unmanaged code and vice versa; during a COM Interop call or PInvoke call.
+
+NUM_MARSHALLING_009_NAME=# of marshalling
+NUM_MARSHALLING_009_HELP=This counter displays the total number of times arguments and return values have been marshaled from managed to unmanaged code and vice versa since the start of the application. This counter is not incremented if the stubs are inlined. (Stubs are responsible for marshalling arguments and return values). Stubs usually get inlined if the marshalling overhead is small.
+
+TOTAL_TLB_IMPORTS_009_NAME=# of TLB imports / sec
+TOTAL_TLB_IMPORTS_009_HELP=Reserved for future use.
+
+TOTAL_TLB_EXPORTS_009_NAME=# of TLB exports / sec
+TOTAL_TLB_EXPORTS_009_HELP=Reserved for future use.
+
+DotNetCLR_LocksAndThreads_OBJECT_009_NAME=.NET CLR LocksAndThreads
+DotNetCLR_LocksAndThreads_OBJECT_009_HELP=Stats for CLR Locks and Threads.
+
+CONTENTION_TOTAL_009_NAME=Total # of Contentions
+CONTENTION_TOTAL_009_HELP=This counter displays the total number of times threads in the CLR have attempted to acquire a managed lock unsuccessfully. Managed locks can be acquired in many ways; by the "lock" statement in C# or by calling System.Monitor.Enter or by using MethodImplOptions.Synchronized custom attribute.
+
+CONTENTION_INST_009_NAME=Contention Rate / sec
+CONTENTION_INST_009_HELP=Rate at which threads in the runtime attempt to acquire a managed lock unsuccessfully. Managed locks can be acquired in many ways; by the "lock" statement in C# or by calling System.Monitor.Enter or by using MethodImplOptions.Synchronized custom attribute.
+
+QUEUE_LENGTH_CUR_009_NAME=Current Queue Length
+QUEUE_LENGTH_CUR_009_HELP=This counter displays the total number of threads currently waiting to acquire some managed lock in the application. This counter is not an average over time; it displays the last observed value.
+
+QUEUE_LENGTH_TOTAL_009_NAME=Queue Length Peak
+QUEUE_LENGTH_TOTAL_009_HELP=This counter displays the total number of threads that waited to acquire some managed lock since the start of the application.
+
+QUEUE_LENGTH_INST_009_NAME=Queue Length / sec
+QUEUE_LENGTH_INST_009_HELP=This counter displays the number of threads per second waiting to acquire some lock in the application. This counter is not an average over time; it displays the difference between the values observed in the last two samples divided by the duration of the sample interval.
+
+CURRENT_LOGICAL_THREADS_009_NAME=# of current logical Threads
+CURRENT_LOGICAL_THREADS_009_HELP=This counter displays the number of current .NET thread objects in the application. A .NET thread object is created either by new System.Threading.Thread or when an unmanaged thread enters the managed environment. This counters maintains the count of both running and stopped threads. This counter is not an average over time; it just displays the last observed value.
+
+CURRENT_PHYSICAL_THREADS_009_NAME=# of current physical Threads
+CURRENT_PHYSICAL_THREADS_009_HELP=This counter displays the number of native OS threads created and owned by the CLR to act as underlying threads for .NET thread objects. This counters value does not include the threads used by the CLR in its internal operations; it is a subset of the threads in the OS process.
+
+RECOGNIZED_THREADS_CUR_009_NAME=# of current recognized threads
+RECOGNIZED_THREADS_CUR_009_HELP=This counter displays the number of threads that are currently recognized by the CLR; they have a corresponding .NET thread object associated with them. These threads are not created by the CLR; they are created outside the CLR but have since run inside the CLR at least once. Only unique threads are tracked; threads with same thread ID re-entering the CLR or recreated after thread exit are not counted twice.
+
+RECOGNIZED_THREADS_TOTAL_009_NAME=# of total recognized threads
+RECOGNIZED_THREADS_TOTAL_009_HELP=This counter displays the total number of threads that have been recognized by the CLR since the start of this application; these threads have a corresponding .NET thread object associated with them. These threads are not created by the CLR; they are created outside the CLR but have since run inside the CLR at least once. Only unique threads are tracked; threads with same thread ID re-entering the CLR or recreated after thread exit are not counted twice.
+
+RECOGNIZED_THREADS_INST_009_NAME=rate of recognized threads / sec
+RECOGNIZED_THREADS_INST_009_HELP=This counter displays the number of threads per second that have been recognized by the CLR; these threads have a corresponding .NET thread object associated with them. These threads are not created by the CLR; they are created outside the CLR but have since run inside the CLR at least once. Only unique threads are tracked; threads with same thread ID re-entering the CLR or recreated after thread exit are not counted twice. This counter is not an average over time; it displays the difference between the values observed in the last two samples divided by the duration of the sample interval.
+
+DotNetCLR_Security_OBJECT_009_NAME=.NET CLR Security
+DotNetCLR_Security_OBJECT_009_HELP=Stats for CLR Security.
+
+SECURITY_TOTALRTCHECKS_009_NAME=Total Runtime Checks
+SECURITY_TOTALRTCHECKS_009_HELP=This counter displays the total number of runtime Code Access Security (CAS) checks performed since the start of the application. Runtime CAS checks are performed when a caller makes a call to a callee demanding a particular permission; the runtime check is made on every call by the caller; the check is done by examining the current thread stack of the caller. This counter used together with "Stack Walk Depth" is indicative of performance penalty for security checks.
+
+SECURITY_TIMEAUTHORIZE_009_NAME=% Time Sig. Authenticating
+SECURITY_TIMEAUTHORIZE_009_HELP=Reserved for future use.
+
+SECURITY_LINKCHECKS_009_NAME=# Link Time Checks
+SECURITY_LINKCHECKS_009_HELP=This counter displays the total number of linktime Code Access Security (CAS) checks since the start of the application. Linktime CAS checks are performed when a caller makes a call to a callee demanding a particular permission at JIT compile time; linktime check is performed once per caller. This count is not indicative of serious performance issues; its indicative of the security system activity.
+
+SECURITY_TIMERTCHECKS_009_NAME=% Time in RT checks
+SECURITY_TIMERTCHECKS_009_HELP=This counter displays the percentage of elapsed time spent in performing runtime Code Access Security (CAS) checks since the last such check. CAS allows code to be trusted to varying degrees and enforces these varying levels of trust depending on code identity. This counter is updated at the end of a runtime security check; it represents the last observed value; its not an average.
+
+SECURITY_TIMERTCHECKS_BASE_009_NAME=Not Displayed
+SECURITY_TIMERTCHECKS_BASE_009_HELP=Not Displayed.
+
+SECURITY_DEPTHSECURITY_009_NAME=Stack Walk Depth
+SECURITY_DEPTHSECURITY_009_HELP=This counter displays the depth of the stack during that last runtime Code Access Security check. Runtime Code Access Security check is performed by crawling the stack. This counter is not an average; it just displays the last observed value.
+
+DotNetCLR_Remoting_OBJECT_009_NAME=.NET CLR Remoting
+DotNetCLR_Remoting_OBJECT_009_HELP=Stats for CLR Remoting.
+
+CONTEXT_REMOTECALLS_INST_009_NAME=Remote Calls/sec
+CONTEXT_REMOTECALLS_INST_009_HELP=This counter displays the number of remote procedure calls invoked per second. A remote procedure call is a call on any object outside the caller;s AppDomain. This counter is not an average over time; it displays the difference between the values observed in the last two samples divided by the duration of the sample interval.
+
+CONTEXT_CHANNELS_009_NAME=Channels
+CONTEXT_CHANNELS_009_HELP=This counter displays the total number of remoting channels registered across all AppDomains since the start of the application. Channels are used to transport messages to and from remote objects.
+
+CONTEXT_PROXIES_009_NAME=Context Proxies
+CONTEXT_PROXIES_009_HELP=This counter displays the total number of remoting proxy objects created in this process since the start of the process. Proxy object acts as a representative of the remote objects and ensures that all calls made on the proxy are forwarded to the correct remote object instance.
+
+CONTEXT_CLASSES_009_NAME=Context-Bound Classes Loaded
+CONTEXT_CLASSES_009_HELP=This counter displays the current number of context-bound classes loaded. Classes that can be bound to a context are called context-bound classes; context-bound classes are marked with Context Attributes which provide usage rules for synchronization; thread affinity; transactions etc.
+
+CONTEXT_OBJALLOC_009_NAME=Context-Bound Objects Alloc / sec
+CONTEXT_OBJALLOC_009_HELP=This counter displays the number of context-bound objects allocated per second. Instances of classes that can be bound to a context are called context-bound objects; context-bound classes are marked with Context Attributes which provide usage rules for synchronization; thread affinity; transactions etc. This counter is not an average over time; it displays the difference between the values observed in the last two samples divided by the duration of the sample interval.
+
+CONTEXT_CONTEXTS_009_NAME=Contexts
+CONTEXT_CONTEXTS_009_HELP=This counter displays the current number of remoting contexts in the application. A context is a boundary containing a collection of objects with the same usage rules like synchronization; thread affinity; transactions etc.
+
+CONTEXT_REMOTECALLS_TOTAL_009_NAME=Total Remote Calls
+CONTEXT_REMOTECALLS_TOTAL_009_HELP=This counter displays the total number of remote procedure calls invoked since the start of this application. A remote procedure call is a call on any object outside the caller;s AppDomain.
+
+DotNetCLR_Excep_OBJECT_009_NAME=.NET CLR Exceptions
+DotNetCLR_Excep_OBJECT_009_HELP=Runtime statistics on CLR exception handling.
+
+EXCEP_THROWN_TOTAL_009_NAME=# of Exceps Thrown
+EXCEP_THROWN_TOTAL_009_HELP=This counter displays the total number of exceptions thrown since the start of the application. These include both .NET exceptions and unmanaged exceptions that get converted into .NET exceptions e.g. null pointer reference exception in unmanaged code would get re-thrown in managed code as a .NET System.NullReferenceException; this counter includes both handled and unhandled exceptions. Exceptions that are re-thrown would get counted again. Exceptions should only occur in rare situations and not in the normal control flow of the program.
+
+EXCEP_THROWN_INST_009_NAME=# of Exceps Thrown / sec
+EXCEP_THROWN_INST_009_HELP=This counter displays the number of exceptions thrown per second. These include both .NET exceptions and unmanaged exceptions that get converted into .NET exceptions e.g. null pointer reference exception in unmanaged code would get re-thrown in managed code as a .NET System.NullReferenceException; this counter includes both handled and unhandled exceptions. Exceptions should only occur in rare situations and not in the normal control flow of the program; this counter was designed as an indicator of potential performance problems due to large (>100s) rate of exceptions thrown. This counter is not an average over time; it displays the difference between the values observed in the last two samples divided by the duration of the sample interval.
+
+TOTAL_EXCEP_FILTERS_RUN_009_NAME=# of Filters / sec
+TOTAL_EXCEP_FILTERS_RUN_009_HELP=This counter displays the number of .NET exception filters executed per second. An exception filter evaluates whether an exception should be handled or not. This counter tracks the rate of exception filters evaluated; irrespective of whether the exception was handled or not. This counter is not an average over time; it displays the difference between the values observed in the last two samples divided by the duration of the sample interval.
+
+TOTAL_EXCEP_FINALLYS_RUN_009_NAME=# of Finallys / sec
+TOTAL_EXCEP_FINALLYS_RUN_009_HELP=This counter displays the number of finally blocks executed per second. A finally block is guaranteed to be executed regardless of how the try block was exited. Only the finally blocks that are executed for an exception are counted; finally blocks on normal code paths are not counted by this counter. This counter is not an average over time; it displays the difference between the values observed in the last two samples divided by the duration of the sample interval.
+
+EXCEPT_STACK_DEPTH_009_NAME=Throw To Catch Depth / sec
+EXCEPT_STACK_DEPTH_009_HELP=This counter displays the number of stack frames traversed from the frame that threw the .NET exception to the frame that handled the exception per second. This counter resets to 0 when an exception handler is entered; so nested exceptions would show the handler to handler stack depth. This counter is not an average over time; it displays the difference between the values observed in the last two samples divided by the duration of the sample interval.
+
+DotNetCLR_Memory_OBJECT_007_NAME=.NET CLR-Speicher
+DotNetCLR_Memory_OBJECT_007_HELP=Zähler für CLR Garbage Collection Heap.
+
+GEN0_COLLECTIONS_COUNTER_007_NAME=Auflistungsanzahl der Generation 0
+GEN0_COLLECTIONS_COUNTER_007_HELP=Dieser Zähler zeigt an, wie oft die Objekte der Generation 0 (die zuletzt zugeordneten Objekte) seit dem Anwendungsstart in die Garbage collection (Gen 0 GC) aufgenommen wurden. Gen 0 GC tritt auf, wenn in Generation 0 nicht genügend Speicher verfügbar ist, um eine Zuordnungsanforderung auszuführen. Der Zähler wird am Ende einer Gen 0 GC erhöht. Die höheren GCs enthalten alle niedrigeren GCs. Der Zähler wird explizit erhöht, wenn eine höhere Generation (Gen 1 oder Gen 2) GC auftritt. Der Zählerwert _Global_ ist falsch und sollte ignoriert werden. Der Zähler zeigt den letzten Wert an.
+
+GEN1_COLLECTIONS_COUNTER_007_NAME=Auflistungsanzahl der Generation 1
+GEN1_COLLECTIONS_COUNTER_007_HELP=Dieser Zähler zeigt an, wie oft die Objekte der Generation 1 seit dem Anwendungsstart in die Garbage collection (Gen 0 GC) aufgenommen wurden. Der Zähler wird am Ende einer Gen 1 GC erhöht. Die höheren GCs enthalten alle niedrigeren GCs. Der Zähler wird explizit erhöht, wenn eine höhere Generation (Gen 2) GC auftritt. Der Zählerwert _Global_ ist falsch und sollte ignoriert werden. Der Zähler zeigt den letzten Wert an.
+
+GEN2_COLLECTIONS_COUNTER_007_NAME=Auflistungsanzahl der Generation 2
+GEN2_COLLECTIONS_COUNTER_007_HELP=Dieser Zähler zeigt an, wie oft die Objekte der Generation 2 (älter) seit dem Anwendungsstart in die Garbage collection (Gen 0 GC) aufgenommen wurden. Der Zähler wird am Ende einer Gen 2 GC (Vollständige GC) erhöht. Der Zählerwert _Global_ ist falsch und sollte ignoriert werden. Der Zähler zeigt den letzten Wert an.
+
+GEN0_BYTES_PROMOTED_COUNTER_007_NAME=Von Generation 0 avancierter Speicher
+GEN0_BYTES_PROMOTED_COUNTER_007_HELP=Dieser Zähler zeigt die Größe des Arbeitsspeichers in Bytes an, der nicht in die Garbage collection (GC) aufgenommen und von Generation 0 zu Generation 1 heraufgestuft wurde. Objekte, die nur heraufgestuft werden, da sie auf die Beendigung warten, sind nicht in diesem Zähler enthalten. Der Zähler zeigt den Wert am Ende der letzten GC an. Der Zähler ist nicht kumulativ.
+
+GEN1_BYTES_PROMOTED_COUNTER_007_NAME=Von Generation 1 avancierter Speicher
+GEN1_BYTES_PROMOTED_COUNTER_007_HELP=Dieser Zähler zeigt die Größe des Arbeitsspeichers in Bytes an, der nicht in die Garbage Collection (GC) aufgenommen und von Generation 1 zu Generation 2 heraufgestuft wurde. Objekte, die nur heraufgestuft werden, da sie auf die Beendigung warten, sind nicht in diesem Zähler enthalten. Der Zähler zeigt den Wert am Ende der letzten GC an. Der Zähler ist nicht kumulativ. Der Zähler wird auf 0 zurückgesetzt, wenn die letzte GC nur eine Gen 0 GC war.
+
+GEN0_PROMOTION_RATE_007_NAME=Von Generation 0 avancierte Bytes/Sek.
+GEN0_PROMOTION_RATE_007_HELP=Dieser Zähler zeigt die Bytes pro Sekunde an, die von Generation 0 (neueste) zu Generation 1 heraufgestuft werden. Objekte, die nur heraufgestuft werden, da sie auf die Beendigung warten, sind nicht in diesem Zähler enthalten. Der Speicher wird heraufgestuft, wenn er nicht in eine Garbage Collection aufgenommen wurde. Der Zähler wurde als Indikator von relativ langlebigen Objekten entworfen, die pro Sekunde erstellt werden. Der Zählen zeigt den Unterschied zwischen den Werten in den letzten zwei Beispielen geteilt durch das Beispielintervall an.
+
+GEN1_PROMOTION_RATE_007_NAME=Von Generation 1 avancierte Bytes/Sek.
+GEN1_PROMOTION_RATE_007_HELP=Dieser Zähler zeigt die Bytes pro Sekunde an, die von Generation 1 zu Generation 2 (älteste) heraufgestuft werden. Objekte, die nur heraufgestuft werden, da sie auf die Beendigung warten, sind nicht in diesem Zähler enthalten. Der Speicher wird heraufgestuft, wenn er nicht in eine Garbage Collection aufgenommen wurde. Von Generation 2 werden keine Objekte heraufgestuft, da sie die älteste Generation ist. Der Zähler wurde als Indikator von sehr langlebigen Objekten entworfen, die pro Sekunde erstellt werden. Der Zählen zeigt den Unterschied zwischen den Werten in den letzten zwei Beispielen geteilt durch das Beispielintervall an.
+
+GEN0_FINALIZATION_BYTES_PROMOTED_COUNTER_007_NAME=Von Gen 0 heraufgestufter Finalization-Speicher
+GEN0_FINALIZATION_BYTES_PROMOTED_COUNTER_007_HELP=Dieser Zähler zeigt die Größe des Arbeitsspeichers in Bytes an, von Generation 0 zu Generation 1 heraufgestuft wurde, da er auf die Beendigung wartet. Der Zähler zeigt den Wert am Ende der letzten GC an. Der Zähler ist nicht kumulativ.
+
+GEN1_FINALIZATION_BYTES_PROMOTED_COUNTER_007_NAME=Von Gen 1 heraufgestufter Finalization-Speicher
+GEN1_FINALIZATION_BYTES_PROMOTED_COUNTER_007_HELP=Dieser Zähler zeigt die Größe des Arbeitsspeichers in Bytes an, von Generation 1 zu Generation 2 heraufgestuft wurde, da er auf die Beendigung wartet. Der Zähler zeigt den Wert am Ende der letzten GC an. Der Zähler ist nicht kumulativ. Der Zähler wird auf 0 zurückgesetzt, wenn die letzte GC nur eine Gen 0 GC war.
+
+GEN0_HEAP_SIZE_COUNTER_007_NAME=Heapgröße der Generation 0
+GEN0_HEAP_SIZE_COUNTER_007_HELP=Dieser Zähler zeigt die maximale Anzahl der Bytes an, die in Generation 0 (Gen 0) zugeordnet werden können. Die aktuelle Anzahl der in Gen 0 zugeordneten Bytes wird nicht angezeigt. Eine Gen 0 GC wird ausgelöst, wenn die Zuordnung seit der letzten GC diesen Wert überschreitet size. Die Größe von Gen 0 wird vom Garbage Collector festgelegt und kann sich während dem Ausführen der Anwendung ändern. Am Ende einer Gen 0-Collection beträgt die Größe des Gen 0-Heaps 0 Bytes. Der Zähler zeigt die Größe (in Bytes) von Zuordnungen an, die die nächste Gen 0 GC auslösen. Der Zähler wird am Ende einer GC aktualisiert; nicht bei jeder Zuordnung.
+
+GEN1_HEAP_SIZE_COUNTER_007_NAME=Heapgröße der Generation 1
+GEN1_HEAP_SIZE_COUNTER_007_HELP=Dieser Zähler zeigt die aktuelle Anzahl der Bytes in Generation 1 (Gen 1) an. Die maximale Größe von Gen 1 wird nicht angezeigt. Objekte werden in dieser Generation nicht direkt zugeordnet, sondern von vorherigen Gen 0 GCs heraufgestuft. Der Zähler wird am Ende einer GC aktualisiert; nicht bei jeder Zuordnung.
+
+GEN2_HEAP_SIZE_COUNTER_007_NAME=Heapgröße der Generation 2
+GEN2_HEAP_SIZE_COUNTER_007_HELP=Dieser Zähler zeigt die aktuelle Anzahl der Bytes in Generation 2 (Gen 2) an. Objekte werden in dieser Generation nicht direkt zugeordnet, sondern von Gen 1 während vorherigenen Gen 1 GCs heraufgestuft. Der Zähler wird am Ende einer GC aktualisiert; nicht bei jeder Zuordnung.
+
+LARGE_OBJECT_SIZE_COUNTER_007_NAME=Objektheapgröße
+LARGE_OBJECT_SIZE_COUNTER_007_HELP=Dieser Zähler zeigt die aktuelle Größe des großen Objektheaps in Bytes an. Objekte, die größer als 20 KB sind, werden vom Garbage Collector als große Objekte behandelt und direkt in einem speziellen Heap zugeordnet. Sie werden nicht über Generationen heraufgestuft. Der Zähler wird am Ende einer GC aktualisiert; nicht bei jeder Zuordnung.
+
+SURVIVE_FINALIZE_COUNTER_007_NAME=Finalization Survivors
+SURVIVE_FINALIZE_COUNTER_007_HELP=Dieser Zähler zeigt die Anzahl der Objekt in der Garbage Collection an, die beibehalten werden, da sie auf die Beendigung warten. Wenn die Objekte Verweise auf andere Objekte enthalten, werden diese ebenfalls beibehalten, aber nicht gezählt. Die Zähler "Von Gen 0 heraufgestufter Finalization-Speicher" und "Von Gen 1 heraufgestufter Finalization-Speicher" stellen den gesamten Speicher dar, der beibehalten wurde. Der Zähler ist nicht kumulativ. Er wird am Ende einer GC mit den beibehaltenen Objekten aktualisiert. Der Zähler zeigt die zusätzlichen Objekte an, die die Anwendung aufgrund der Beendigung möglicherweise übernimmt.
+
+NUM_HANDLES_COUNTER_007_NAME=Anzahl der GC-Handle
+NUM_HANDLES_COUNTER_007_HELP=Dieser Zähler zeigt die aktuelle Anzahl der verwendeten G-Handles an. GCHandles sind Handles für externe CLR-Ressourecen und der verwalteten Umgebung. Die Handles belegeben nur wenig Arbeitsspeicher im GCHeap, aber wertvolle nicht verwaltete Ressourcen.
+
+ALLOCATION_RATE_COUNTER_007_NAME=Zugewiesene Bytes/Sek.
+ALLOCATION_RATE_COUNTER_007_HELP=Dieser Zähle zeigt die Rate der Bytes pro Sekunde an, die im GC-Heap zugeordnet werden. Der Zähler wird am Ende der GC aktualisiert, nicht bei jeder Zuordnung. Der Zähler bildet nicht den Mittelwert aus der Zeit, sondern zeigt den Unterschied zwischen den Werten in den letzten zwei Beispielen geteilt durch das Beispielintervall an.
+
+INDUCED_GC_COUNTER_007_NAME=Anzahl der ausgelösten GC
+INDUCED_GC_COUNTER_007_HELP=Dieser Zähler zeigt an, wie oft die Garbage Collection aufgrund eines expliziten Aufrufs an GC.Collect maximal ausgeführt wurde. Die GC sollte die Frequenz ihrer Collections selbst festlegen.
+
+PER_TIME_IN_GC_COUNTER_007_NAME=GC-Zeitdauer in Prozent
+PER_TIME_IN_GC_COUNTER_007_HELP=Die GC-Zeitdauer in Prozent gibt die verstrichene Zeitdauer für eine Garbage Collection (GC) an, die seit dem letzten GC-Zyklus ausgeführt wurde. Der Zähler zeigt gewöhnlich an, wieviel Speicher vom Garbage Collector für die Anwendung gesammelt und komprimiert wurde. Der Zähler wird nur am Ende einer GC aktualisiert. Der Zählerwert reflektiert den letzten Wert; er gibt keinen Durchschnitt an.
+
+PER_TIME_IN_GC_COUNTER_BASE_007_NAME=Nicht angezeigt
+PER_TIME_IN_GC_COUNTER_BASE_007_HELP=Nicht angezeigt.
+
+TOTAL_HEAP_SIZE_COUNTER_007_NAME=Anzahl der Bytes in den Heaps
+TOTAL_HEAP_SIZE_COUNTER_007_HELP=Dieser Zähler stellt die Summe aus den vier anderen Zählern dar: Gen 0-Heapgröße, Gen 1-Heapgröße, Gen 2-Heapgröße und die Large Object-Heapgröße. Dieser Zähler zeigt den in den GC-Heaps zugeordneten Speicher in Bytes an.
+
+TOTAL_COMMITTED_MEM_COUNTER_007_NAME=Festgelegte Bytes insgesamt
+TOTAL_COMMITTED_MEM_COUNTER_007_HELP=Dieser Zähler zeigt den virtuellen Speicher in Bytes an, der vom Garbage Collector reserviert wurde. (Reservierter Arbeitsspeicher ist der physikalische Speicher, der in der Auslagerungsdatei des Datenträgers reserviert wird).
+
+TOTAL_RESERVED_MEM_COUNTER_007_NAME=Gesamtanzahl der reservierten Bytes
+TOTAL_RESERVED_MEM_COUNTER_007_HELP=Dieser Zähler zeigt den virtuellen Speicher in Bytes an, der vom Garbage Collector reserviert wird. (Reservierter Speicher ist der virtuelle Arbeitsspeicher, der für die Anwendung reserviert wird.)
+
+GC_PINNED_OBJECTS_007_NAME=Anzahl der fixierten Objekte
+GC_PINNED_OBJECTS_007_HELP=Dieser Zähler zeigt die Anzahl der fixierten Objekte in der letzten GC an. Der Zähler verfolgt die fixierten Objekte nur in den Heaps in der Garbage Collection. Eine Gen 0 GC verursacht z.B. die Enumeration der fixierten Objekte nur im Generation 0-Heap. Ein fixiertes Objekt kann nicht vom Garbage Collector in den Speicher verschoben werden.
+
+GC_SINKBLOCKS_007_NAME=Anzahl der verwendeten Sinkblöcke
+GC_SINKBLOCKS_007_HELP=Dieser Zähler zeigt die aktuelle Anzahl der verwendeten Synchronisierungsblöcke an. Synchronisierungsblöcke sind die Datenstrukturen pro Objekt, die zum Speichern der Synchronisierungsinformationen zugeordnet werden. Synchronisierungsblöcke enthalten Weak-Verweise auf verwaltete Objekte und müssen vom Garbage Collector überprüft werden. In Synchronisierungsblöcken können auch COM-Interop-Metadaten gespeichert werden. Der Zähler zeigt Leistungsprobleme an, die auftreten, wenn die Synchronisierungsprimitiven zu oft verwendet werden.
+
+DotNetCLR_Loading_OBJECT_007_NAME=.NET CLR-Ladevorgang
+DotNetCLR_Loading_OBJECT_007_HELP=Statistiken für das CLR-Klassenladeprogramm.
+
+LOADING_CLASSES_TOTAL_007_NAME=Gesamtanzahl der geladenen Klassen
+LOADING_CLASSES_TOTAL_007_HELP=Dieser Zähler zeigt die kumulative Anzahl der Klassen an, die in allen Assemblys seit dem Start der Anwendung geladen wurden.
+
+LOADING_TIME_007_NAME=Ladezeit in Prozent
+LOADING_TIME_007_HELP=Für die zukünftige Verwendung reserviert.
+
+LOADING_ASMSEARCHLEN_007_NAME=Assemblysuchlänge
+LOADING_ASMSEARCHLEN_007_HELP=Für die zukünftige Verwendung reserviert.
+
+LOADING_LOADFAILURES_TOTAL_007_NAME=Gesamtanzahl der Ladefehler
+LOADING_LOADFAILURES_TOTAL_007_HELP=Dieser Zähler zeigt die Höchstanzahl der Klassen an, die seit dem Start der Anwendung nicht geladen werden konnten. Möglicherweise ist die Sicherheit unangemessen oder das Format ist ungültig. Weitere Informationen finden Sie in der Hilfe.
+
+LOADING_LOADFAILURES_INST_007_NAME=Rate der Ladefehler
+LOADING_LOADFAILURES_INST_007_HELP=Dieser Zähler zeigt die Anzahl der Klassen pro Sekunde an, die nicht geladen werden konnten. Der Zähler bildet nicht den Mittelwert aus der Zeit, sondern zeigt den Unterschied zwischen den Werten in den letzten zwei Beispielen geteilt durch das Beispielintervall an. Die Ladefehler können mehrere Ursachen haben; z.B. unzureichende Sicherheit oder ein ungültiges Format. Weitere Informationen finden Sie in der Hilfe.
+
+LOADING_HEAPSIZE_007_NAME=Bytes im Lademodulheap
+LOADING_HEAPSIZE_007_HELP=Dieser Zähler zeigt die aktuelle Größe (in Bytes) des Arbeitsspeichers an, der vom Klassenladeprogramm in allen Anwendungsdomänen reserviert wurde. (Reservierter Arbeitsspeicher ist der physikalische Speicher, der in der Auslagerungsdatei des Datenträgers reserviert wird.)
+
+LOADING_APPDOMAINS_UNLOADED_TOTAL_007_NAME=Gesamtanzahl der entladenen Anwendungsdomänen
+LOADING_APPDOMAINS_UNLOADED_TOTAL_007_HELP=Dieser Zähler zeigt die Gesamtanzahl der Anwendungsdomänen an, die seit dem Anwendungsstart entladen wurden. Wenn eine Anwendungsdomäne mehrmals geladen und entladen wird, werden die Entladevorgänge einzeln gezählt.
+
+LOADING_APPDOMAINS_UNLOADED_INST_007_NAME=Rate der entladenen Anwendungsdomänen
+LOADING_APPDOMAINS_UNLOADED_INST_007_HELP=Dieser Zähler zeigt die Anzahl der Anwendungsdomänen an, die pro Sekunde entladen werden. Der Zähler bildet nicht den Mittelwert aus der Zeit, sondern zeigt den Unterschied zwischen den Werten in den letzten zwei Beispielen geteilt durch das Beispielintervall an.
+
+LOADING_CLASSES_CUR_007_NAME=Aktuelle geladene Klassen
+LOADING_CLASSES_CUR_007_HELP=Dieser Zähler zeigt die aktuelle Anzahl der in allen Assemblys geladenen Klassen an.
+
+LOADING_CLASSES_INST_007_NAME=Rate der geladenen Klassen
+LOADING_CLASSES_INST_007_HELP=Dieser Zähler zeigt die Anzahl der pro Sekunden in allen Assemblys geladenen Klassen an. Der Zähler bildet nicht den Mittelwert aus der Zeit, sondern zeigt den Unterschied zwischen den Werten in den letzten zwei Beispielen geteilt durch das Beispielintervall an.
+
+LOADING_APPDOMAINS_CUR_007_NAME=Aktuelle Anwendungsdomänen
+LOADING_APPDOMAINS_CUR_007_HELP=Dieser Zähler zeigt die aktuelle Anzahl der Anwendungsdomänen an, die in der Anwendung geladen sind. Anwendungsdomänen stellen eine sichere und vielseitige Verarbeitungseinheit bereit, mit der die CLR Anwendungen isolieren kann, die im gleichen Prozess ausgeführt werden.
+
+LOADING_APPDOMAINS_TOTAL_007_NAME=Anwendungsdomänen insgesamt
+LOADING_APPDOMAINS_TOTAL_007_HELP=Dieser Zähler zeigt die Höchstanzahl der Anwendungsdomänen an, die seit dem Starten Anwendung geladen wurden. Anwendungsdomänen stellen eine sichere und vielseitige Verarbeitungseinheit bereit, mit der die CLR Anwendungen isolieren kann, die im gleichen Prozess ausgeführt werden.
+
+LOADING_APPDOMAINS_INST_007_NAME=Rate der Anwendungsdomänen
+LOADING_APPDOMAINS_INST_007_HELP=Dieser Zähler zeigt die Anzahl der Anwendungsdomänen an, die pro Sekunde geladen werden. Anwendungsdomänen stellen eine sichere und vielseitige Verarbeitungseinheit bereit, mit der die CLR Anwendungen isolieren kann, die im gleichen Prozess ausgeführt werden. Der Zähler bildet nicht den Mittelwert aus der Zeit, sondern zeigt den Unterschied zwischen den Werten in den letzten zwei Beispielen geteilt durch das Beispielintervall an.
+
+LOADING_ASSEMBLIES_CUR_007_NAME=Aktuelle Assemblys
+LOADING_ASSEMBLIES_CUR_007_HELP=Dieser Zähler zeigt die aktuelle Anzahl der Assemblys an, die in dieser Anwendung in allen Anwendungsdomänen geladen werden. Wenn die Assembly von mehreren Anwendungsdomänen als domänenneutral geladen wird, wird der Zähler nur einmal erhöht. Assemblys können als domänenneutral geladen werden, wenn ihr Code von allen Anwendungsdomänen gemeinsam genutzt werden kann. Assemblys können domänenspezifisch geladen werden, wenn ihr Code in der Anwendungsdomäne privat ist.
+
+LOADING_ASSEMBLIES_TOTAL_007_NAME=Assemblys insgesamt
+LOADING_ASSEMBLIES_TOTAL_007_HELP=Dieser Zähler zeigt die Gesamtanzahl der Assemblys an, die seit dem Start der Anwendung geladen wurden. Wenn die Assembly von mehreren Anwendungsdomänen als domänenneutral geladen wird, wird der Zähler nur einmal erhöht. Assemblys können als domänenneutral geladen werden, wenn ihr Code von allen Anwendungsdomänen gemeinsam genutzt werden kann. Assemblys können domänenspezifisch geladen werden, wenn ihr Code in der Anwendungsdomäne privat ist.
+
+LOADING_ASSEMBLIES_INST_007_NAME=Assemblyrate
+LOADING_ASSEMBLIES_INST_007_HELP=Dieser Zähler zeigt die Anzahl der Assemblys an, die pro Sekunden in allen Anwendungsdomänen geladen werden. Wenn die Assembly von mehreren Anwendungsdomänen als domänenneutral geladen wird, wird der Zähler nur einmal erhöht. Assemblys können als domänenneutral geladen werden, wenn ihr Code von allen Anwendungsdomänen gemeinsam genutzt werden kann. Der Zähler bildet nicht den Mittelwert aus der Zeit, sondern zeigt den Unterschied zwischen den Werten in den letzten zwei Beispielen geteilt durch das Beispielintervall an.
+
+DotNetCLR_Jit_OBJECT_007_NAME=.NET CLR-Jit
+DotNetCLR_Jit_OBJECT_007_HELP=Statistik für CLR-Jit.
+
+TOTAL_METHODS_JITTED_007_NAME=Anzahl der mit JIT kompilierten Methoden
+TOTAL_METHODS_JITTED_007_HELP=Dieser Zähler zeigt die Gesamtanzahl der Methoden an, die vom CLR JIT-Compiler seit dem Start der Anwendung kompiliert wurden. Die nicht JIT-Methoden sind in diesem Zähler nicht enthalten.
+
+JITTED_IL_CUR_007_NAME=Anzahl der mit JIT kompilierten IL-Bytes
+JITTED_IL_CUR_007_HELP=Dieser Zeiger zeigt die Gesamtanzahl der mit JIT kompilierten IL-Bytes seit dem Start der Anwendung an. Dieser Zähler ist mit dem Zähler "Gesamtanzahl der mit JIT kompilierten IL-Bytes" identisch.
+
+JITTED_IL_TOTAL_007_NAME=Gesamtanzahl der mit JIT kompilierten IL-Bytes
+JITTED_IL_TOTAL_007_HELP=Dieser Zeiger zeigt die Gesamtanzahl der mit JIT kompilierten IL-Bytes seit dem Start der Anwendung an. Dieser Zähler ist mit dem Zähler "Anzahl der mit JIT kompilierten IL-Bytes" identisch.
+
+JITTED_IL_INST_007_NAME=Mit JIT kompilierte IL-Bytes/Sek.
+JITTED_IL_INST_007_HELP=Dieser Zähler zeigt die JIT-Rate pro Sekunde für IL-Bytes an. Der Zähler bildet nicht den Mittelwert aus der Zeit, sondern zeigt den Unterschied zwischen den Werten in den letzten zwei Beispielen geteilt durch das Beispielintervall an.
+
+JIT_FAILURES_007_NAME=JIT-Standardfehler
+JIT_FAILURES_007_HELP=Dieser Zähler zeigt die Höchstanzahl der Methoden an, die seit dem Start der Anwendung nicht mit dem JIT-Compiler kompiliert werden konnten. Dieses Problem kann auftreten, wenn die IL nicht überprüft werden kann, oder wenn ein interner Fehler im JIT-Compiler aufgetreten ist.
+
+TIME_IN_JIT_007_NAME=JIT-Zeitdauer in Prozent
+TIME_IN_JIT_007_HELP=Dieser Zähler zeigt die verstrichene Zeit für die JIT-Kompilierung seit der letzten Kompilierungsphase in Prozent an. Der Zähler wird am Ende jeder JIT-Kompilierungsphase aktualisiert. Während einer JIT-Kompilierungsphase werden eine Methode und ihre Abhängigkeiten kompiliert.
+
+TIME_IN_JIT_BASE_007_NAME=Nicht angezeigt
+TIME_IN_JIT_BASE_007_HELP=Nicht angezeigt.
+
+DotNetCLR_Interop_OBJECT_007_NAME=.NET CLR-Interop
+DotNetCLR_Interop_OBJECT_007_HELP=Statistik für CLR-Interop.
+
+CURRENT_CCW_007_NAME=Anzahl der CCWs
+CURRENT_CCW_007_HELP=Dieser Zähler zeigt die aktuelle Anzahl der CCWs (Com-Callable-Wrappers) an. Ein CCW ist ein Proxy für das verwaltete .NET-Objekt, auf das von nicht verwalteten COM-Client verwiesen wird. Der Zähler zeigt die Anzahl der verwalteten Objekte an, auf die von nicht verwaltetem COM-Code verwiesen wird.
+
+CURRENT_STUBS_007_NAME=Anzahl der Stubs
+CURRENT_STUBS_007_HELP=Dieser Zähler zeigt die aktuelle Anzahl der Stubs an, die von der CLR erstellt wurden. Stubs sind für das Marshallen von Argumenten und Rückgabewerten zwischen verwaltetem und nicht verwaltetem Code während einem COM-Interopaufruf oder PInvoke-Aufruf verantwortlich.
+
+NUM_MARSHALLING_007_NAME=Anzahl der Marshallvorgänge
+NUM_MARSHALLING_007_HELP=Dieser Zähler zeigt an, wie oft Argumente und Rückgabewerte zwischen verwaltetem und nicht verwaltetem Code seit dem Start der Anwendung gemarshallt wurden. Der Zähler wird nicht erhöht, wenn die Stubs intern sind. (Stubs sind für das Marshallen von Argumenten und Rückgabewerten verantwortlich).
+
+TOTAL_TLB_IMPORTS_007_NAME=Anzahl der TLB-Importe/Sek.
+TOTAL_TLB_IMPORTS_007_HELP=Für die zukünftige Verwendung reserviert.
+
+TOTAL_TLB_EXPORTS_007_NAME=Anzahl der TLB-Exporte/Sek.
+TOTAL_TLB_EXPORTS_007_HELP=Für die zukünftige Verwendung reserviert.
+
+DotNetCLR_LocksAndThreads_OBJECT_007_NAME=.NET CLR-Sperren und Threads
+DotNetCLR_LocksAndThreads_OBJECT_007_HELP=Statistik für CLR-Sperren und Threads.
+
+CONTENTION_TOTAL_007_NAME=Gesamtanzahl der Konflikte
+CONTENTION_TOTAL_007_HELP=Dieser Zähler zeigt an, wie oft die Threads in der CLR versucht haben, erfolglos eine verwaltete Sperre abzurufen. Verwaltete Sperren können mit mehreren Methoden abgerufen werden. Durch die Anweisung "lock" in C#, durch Aufrufen von System.Monitor.Enter oder mit dem benutzerdefinierten Attribut MethodImplOptions.Synchronized.
+
+CONTENTION_INST_007_NAME=Konfliktrate/Sek.
+CONTENTION_INST_007_HELP=Rate mit der die Threads in der Runtime versuchen, erfolglos eine verwaltete Sperre abzurufen. Verwaltete Sperren können mit mehreren Methoden abgerufen werden. Durch die Anweisung "lock" in C#, durch Aufrufen von System.Monitor.Enter oder mit dem benutzerdefinierten Attribut MethodImplOptions.Synchronized.
+
+QUEUE_LENGTH_CUR_007_NAME=Aktuelle Warteschlangenlänge
+QUEUE_LENGTH_CUR_007_HELP=Dieser Zähler zeigt die Gesamtanzahl der Threads an, die auf eine verwaltete Sperrung in der Anwendung warten. Der Zähler bildet nicht den Mittelwert aus der Zeit, sondern zeigt den letzten Wert an.
+
+QUEUE_LENGTH_TOTAL_007_NAME=Maximale Warteschlangenlänge
+QUEUE_LENGTH_TOTAL_007_HELP=Dieser Zähler zeigt die Gesamtanzahl der Threads an, die seit dem Start der Anwendung auf eine verwaltete Sperrung warten.
+
+QUEUE_LENGTH_INST_007_NAME=Warteschlangenlänge/Sek.
+QUEUE_LENGTH_INST_007_HELP=Dieser Zähler zeigt die Anzahl der Threads pro Sekunde an, die auf eine Sperrung der Anwendung warten. Der Zähler bildet nicht den Mittelwert aus der Zeit, sondern zeigt den Unterschied zwischen den Werten in den letzten zwei Beispielen geteilt durch das Beispielintervall an.
+
+CURRENT_LOGICAL_THREADS_007_NAME=Anzahl der aktuellen logischen Threads
+CURRENT_LOGICAL_THREADS_007_HELP=Dieser Zähler zeigt die Anzahl der aktuellen .NET-Threadobjekte in der Anwendung an. Ein .NET-Threadobjekt wird von System.Threading.Thread erstellt, oder wenn ein nicht verwalteter Thread in die verwaltete Umgebung aufgenommen wird. Der Zähler verwaltet die Anzahl der ausgeführten und beendeten Threads. Der Zähler bildet nicht den Mittelwert aus der Zeit, sondern zeigt den letzten Wert an.
+
+CURRENT_PHYSICAL_THREADS_007_NAME=Anzahl der aktuellen physikalischen Threads
+CURRENT_PHYSICAL_THREADS_007_HELP=Dieser Zähler zeigt die Anzahl der systemeigenen Betriebssystemthreads an, die von der CLR als untergeordnete .NET-Threadobjekte erstellt werden. Dieser Zählerwert enthält die Threads nicht, die von der CLR für interne Vorgänge verwendet werden. Er ist eine Teilmenge der Threads im Betriebssystemprozess.
+
+RECOGNIZED_THREADS_CUR_007_NAME=Anzahl der aktuellen erkannten Threads
+RECOGNIZED_THREADS_CUR_007_HELP=Dieser Zähler zeigt die Anzahl der Threads an, die von der CLR erkannt werden. Diesen Threads ist ein entsprechendes .NET-Threadobjekt zugewiesen. Die Threads werden außerhalb der CLR erstellt, aber wurden mindestens einmal in der CLR ausgeführt. Nur eindeutige Threads werden verfolgt. Threads mit der gleichen Thread-ID, die erneut in die CLR aufgenommen oder nach dem Beenden erstellt werden, werden nicht zweimal gezählt.
+
+RECOGNIZED_THREADS_TOTAL_007_NAME=Gesamtanzahl der erkannten Threads
+RECOGNIZED_THREADS_TOTAL_007_HELP=Dieser Zähler zeigt die Gesamtanzahl der Threads an, die von der CLR seit dem Start der Anwendung erkannt wurden. Diesen Threads ist ein entsprechendes .NET-Threadobjekt zugewiesen. Die Threads werden außerhalb der CLR erstellt, aber wurden mindestens einmal in der CLR ausgeführt. Nur eindeutige Threads werden verfolgt. Threads mit der gleichen Thread-ID, die erneut in die CLR aufgenommen oder nach dem Beenden erstellt werden, werden nicht zweimal gezählt.
+
+RECOGNIZED_THREADS_INST_007_NAME=Erkannte Threadrate/Sek.
+RECOGNIZED_THREADS_INST_007_HELP=Dieser Zähler zeigt die Anzahl der Threads pro Sekunde an, die von der CLR erkannt wurden. Diesen Threads ist ein entsprechendes .NET-Threadobjekt zugeordnet. Die Threads werden nicht von der CLR, sondern außerhalb der CLR erstellt, aber mindestens einmal in der CLR ausgeführt. Nur eindeutige Threads werden nachverfolgt; Threads mit der gleichen Thread-ID, die in der CLR wiederholt oder erneut erstellt werden, werden nicht zweimal gezählt. Der Zähler bildet nicht den Mittelwert aus der Zeit, sondern zeigt den Unterschied zwischen den Werten in den letzten zwei Beispielen geteilt durch das Beispielintervall an.
+
+DotNetCLR_Security_OBJECT_007_NAME=.NET CLR-Sicherheit
+DotNetCLR_Security_OBJECT_007_HELP=Statistik für die CLR-Sicherheit.
+
+SECURITY_TOTALRTCHECKS_007_NAME=Laufzeitüberprüfungen insgesamt
+SECURITY_TOTALRTCHECKS_007_HELP=Dieser Zähler zeigt die Gesamtanzahl der CAS-Laufzeitüberprüfungen (Code Access Security) seit dem Start der Anwendung an. CAS-Laufzeitüberprüfungen werden ausgeführt wenn beim einem Aufruf eine bestimmte Berechtigung angefordert wird. Die Laufzeitüberprüfung wird für jeden Aufruf ausgeführt, indem der aktuelle Threadstapel des Aufrufers überprüft wird. Dieser Zähler gibt zusammen mit "Stapeltiefe" die Leistungseinbußen für Sicherheitsüberprüfungen an.
+
+SECURITY_TIMEAUTHORIZE_007_NAME=Zeit für die Signaturauthentifizierung in Prozent
+SECURITY_TIMEAUTHORIZE_007_HELP=Für die zukünftige Verwendung reserviert.
+
+SECURITY_LINKCHECKS_007_NAME=Anzahl der Verbindungszeitüberprüfungen
+SECURITY_LINKCHECKS_007_HELP=Dieser Zähler zeigt die Gesamtanzahl der CAS-Überprüfungen (Code Access Security) seit dem Anwendungsstart an. CAS-Linktimeüberprüfen werden ausgeführt, wenn eine bestimmte Berechtigung während der JIT-Kompilierung aufgerufen wird. Eine Linktimeüberprüfung wird nur einmal pro Aufrufer ausgeführt. Dieser Wert zeigt keine Leistungsprobleme an, nur die Sicherheitssystemaktivitäten.
+
+SECURITY_TIMERTCHECKS_007_NAME=Zeit für die RT-Überprüfungen in Prozent
+SECURITY_TIMERTCHECKS_007_HELP=Dieser Zähler zeigt den Zeitraum an, der seit der letzten CAS-Überprüfung (Code Access Security) verstrichen ist. CAS ermöglicht unterschiedliche Vertrauensebenen für den Code und erzwingt die Ebenen abhängig von der Codeidentität. Der Zähler wird am Ende einer Sicherheitsüberprüfung aktualisiert. Er zeigt keinen Durchschnittswert, sondern den letzten Wert an.
+
+SECURITY_TIMERTCHECKS_BASE_007_NAME=Nicht angezeigt
+SECURITY_TIMERTCHECKS_BASE_007_HELP=Nicht angezeigt.
+
+SECURITY_DEPTHSECURITY_007_NAME=Stapeltiefe
+SECURITY_DEPTHSECURITY_007_HELP=Dieser Zähler zeigt die Stapeltiefe während der letzten Überprüfung der Codezugriffssicherheit zur Laufzeit an. Beim Überprüfen Codezugriffssicherheit zur Laufzeit wird der Stapel durchsucht. Der Zähler gibt keinen Durchnittswert, sondern nur den letzten Wert an.
+
+DotNetCLR_Remoting_OBJECT_007_NAME=.NET CLR-Remote
+DotNetCLR_Remoting_OBJECT_007_HELP=Statistik für CLR-Remote.
+
+CONTEXT_REMOTECALLS_INST_007_NAME=Remoteaufrufe/Sek.
+CONTEXT_REMOTECALLS_INST_007_HELP=Dieser Zähler zeigt die Anzahl der Remoteprozeduraufrufe pro Sekunde an. Ein Remoteprozeduraufruf ist ein Aufruf eines Objekts außerhalb der Anwendungsdomäne des Aufrufers. Der Zähler bildet nicht den Mittelwert aus der Zeit, sondern zeigt den Unterschied zwischen den Werten in den letzten zwei Beispielen geteilt durch das Beispielintervall an.
+
+CONTEXT_CHANNELS_007_NAME=Channel
+CONTEXT_CHANNELS_007_HELP=Dieser Zähler zeigt die Gesamtanzahl der Remotechannel in den Anwendungsdomänen an, die seit dem Start der Anwendung registriert wurden. Channel werden zum Übertragen von Nachrichten zwischen Remoteobjekten verwendet.
+
+CONTEXT_PROXIES_007_NAME=Kontextproxys
+CONTEXT_PROXIES_007_HELP=Dieser Zähler zeigt die Gesamtanzahl der Remoteproxyobjekte an, die in diesem Prozess seit dem Start der Anwendung erstellt wurden. Proxyobjekte stellen die Remoteobjekte dar und stellen sicher, dass alle Proxyaufrufe an die entsprechende Remoteobjektinstanz weitergeleitet werden.
+
+CONTEXT_CLASSES_007_NAME=Geladene kontextgebundene Klassen
+CONTEXT_CLASSES_007_HELP=Dieser Zähler zeigt die aktuelle Anzahl der kontextgebundenen geladenen Klassen an. Klassen, die an einen Kontext gebunden werden können, sind kontextgebundene Klassen. Kontextgebundene Klassen werden mit Kontextattributen für die Synchronisierung, Threadaffinität, Transaktionen, usw. markiert.
+
+CONTEXT_OBJALLOC_007_NAME=Kontextgebundene Objektzuordnung/Sek.
+CONTEXT_OBJALLOC_007_HELP=Dieser Zähler zeigt die Anzahl der kontextgebundenen Objekte an, die pro Sekunde zugeordnet werden. Instanzen von Klassen, die an einen Kontext gebunden werden können, sind kontextgebundene Objekte. Kontextgebundene Klassen werden mit Kontextattributen für die Synchronisation, Threadaffinität, Transaktionen, usw. markiert. Der Zähler bildet nicht den Mittelwert aus der Zeit, sondern zeigt den Unterschied zwischen den Werten in den letzten zwei Beispielen geteilt durch das Beispielintervall an.
+
+CONTEXT_CONTEXTS_007_NAME=Kontext
+CONTEXT_CONTEXTS_007_HELP=Dieser Zähler zeigt die aktuelle Anzahl der Remotekontexte in der Anwendung an. Ein Kontext enthält eine Auflistung der Objekte mit den gleichen Syntaxregeln; z.B. Synchronisierung, Threadaffinität, Transaktionen, usw.
+
+CONTEXT_REMOTECALLS_TOTAL_007_NAME=Remoteaufrufe insgesamt
+CONTEXT_REMOTECALLS_TOTAL_007_HELP=Dieser Zähle zeigt die Gesamtanzahl der Remoteprozeduraufrufe an, die seit dem Start der Anwendung initialisiert wurden. Ein Remoteprozeduraufruf ist der Aufruf eines Objekts außerhalb der Anwendungsdomäne des Aufrufers.
+
+DotNetCLR_Excep_OBJECT_007_NAME=.NET CLR-Ausnahmen
+DotNetCLR_Excep_OBJECT_007_HELP=Laufzeitstatistik für die CLR-Ausnahmebehandlung.
+
+EXCEP_THROWN_TOTAL_007_NAME=Anzahl der ausgelösten Ausnahmen
+EXCEP_THROWN_TOTAL_007_HELP=Dieser Zähler zeigt die Gesamtanzahl der Ausnahmen an, die seit dem Start der Anwendung ausgelöst wurden. TDiese schließen .NET-Ausnahmen und nicht verwaltete Ausnahmen ein, die in .NET-Ausnahmen konvertiert werden; z.B. wird eine Nullzeigerverweis-Ausnahme in nicht verwaltetem Code in eine .NET System.NullReferenceException in verwaltetem Code konvertiert. Dieser Zähler enthält behandelte und unbehandelte Ausnahmen. Erneut ausgelöste Ausnahmen, werden wieder gezählt. Ausnahmen sollten nur selten und nicht im normalen Programmablauf auftreten.
+
+EXCEP_THROWN_INST_007_NAME=Anzahl der ausgelösten Ausnahmen/Sek.
+EXCEP_THROWN_INST_007_HELP=Dieser Zähler zeigt die Anzahl der Ausnahmen pro Sekunde an. Diese schließen .NET-Ausnahmen und nicht verwaltete Ausnahmen ein, die in .NET-Ausnahmen konvertiert werden; z.B. wird eine Nullzeigerverweis-Ausnahme in nicht verwaltetem Code in eine .NET System.NullReferenceException in verwaltetem Code konvertiert. Dieser Zähler enthält behandelte und unbehandelte Ausnahmen. Ausnahmen sollten nur selten und nicht im normalen Programmablauf auftreten. Der Zähler zeigt potentielle Leistungsprobleme an, die aufgrund einer großen Ausnahmerate auftreten. Der Zähler bildet nicht den Mittelwert aus der Zeit, sondern zeigt den Unterschied zwischen den Werten in den letzten zwei Beispielen geteilt durch das Beispielintervall an.
+
+TOTAL_EXCEP_FILTERS_RUN_007_NAME=Anzahl der Filter/Sek.
+TOTAL_EXCEP_FILTERS_RUN_007_HELP=Dieser Zähler zeigt die Anzahl der .NET-Ausnahmefilter an, die pro Sekunde ausgeführt werden. Ein Ausnahmefilter wertet aus, ob eine Ausnahme behandelt werden soll. Der Zähler verfolgt die Rate der ausgewerteten Ausnahmefilter; ungeachtet davon, ob die Ausnahme behandelt wurde oder nicht. Der Zähler bildet nicht den Mittelwert aus der Zeit, sondern zeigt den Unterschied zwischen den Werten in den letzten zwei Beispielen geteilt durch das Beispielintervall an.
+
+TOTAL_EXCEP_FINALLYS_RUN_007_NAME=Finallyanzahl/Sek.
+TOTAL_EXCEP_FINALLYS_RUN_007_HELP=Dieser Zähler zeigt die Anzahl der finally-Blöcke an, die pro Sekunde ausgeführt werden. Ein finally-Block wird ausgeführt, unabhängig davon, wie der try-Block beendet wurde. Nur die finally-Blöcke, die für eine Ausnahme ausgeführt werden, werden gezählt. finally-Blöcke in normalen Codepfaden werden nicht gezählt. Der Zähler bildet nicht den Mittelwert aus der Zeit, sondern zeigt den Unterschied zwischen den Werten in den letzten zwei Beispielen geteilt durch das Beispielintervall an.
+
+EXCEPT_STACK_DEPTH_007_NAME=Throw To Catch Depth / sec
+EXCEPT_STACK_DEPTH_007_HELP=Dieser Zähler zeigt die Anzahl der Stapelrahmen an, die vom Rahmen durchlaufen werden, der die .NET-Ausnahme ausgelöst hat. Der Zähler wird auf 0 zurückgesetzt, wenn ein Ausnahmehandler eingegeben wird. Der Zähler bildet nicht den Mittelwert aus der Zeit, sondern zeigt den Unterschied zwischen den Werten in den letzten zwei Beispielen geteilt durch das Beispielintervall an.
+
diff --git a/src/inc/1031/_DataPerfCounters.ini b/src/inc/1031/_DataPerfCounters.ini
new file mode 100644
index 0000000000..ecb7a30a69
--- /dev/null
+++ b/src/inc/1031/_DataPerfCounters.ini
Binary files differ
diff --git a/src/inc/1031/_NetworkingPerfCounters.ini b/src/inc/1031/_NetworkingPerfCounters.ini
new file mode 100644
index 0000000000..158678829d
--- /dev/null
+++ b/src/inc/1031/_NetworkingPerfCounters.ini
Binary files differ
diff --git a/src/inc/1031/aspnet_perf.ini b/src/inc/1031/aspnet_perf.ini
new file mode 100644
index 0000000000..a6f386f886
--- /dev/null
+++ b/src/inc/1031/aspnet_perf.ini
@@ -0,0 +1,415 @@
+[info]
+drivername=ASP.NET_1.0.3620.0
+symbolfile=aspnet_perf.h
+
+[languages]
+007=German
+009=English
+
+[objects]
+OBJECT_1_009_NAME=ASP.NET v1.0.3620.0
+OBJECT_2_009_NAME=ASP.NET Apps v1.0.3620.0
+
+[text]
+OBJECT_1_009_NAME=ASP.NET v1.0.3620.0
+OBJECT_1_009_HELP=ASP.NET v1.0.3620.0 global performance counters
+OBJECT_2_009_NAME=ASP.NET Apps v1.0.3620.0
+OBJECT_2_009_HELP=ASP.NET v1.0.3620.0 application performance counters
+
+;;
+;; ASP.NET System Counters
+;;
+
+ASPNET_APPLICATION_RESTARTS_009_NAME=Application Restarts
+ASPNET_APPLICATION_RESTARTS_009_HELP=Number of times the application has been restarted during the web server's lifetime.
+
+ASPNET_APPLICATIONS_RUNNING_009_NAME=Applications Running
+ASPNET_APPLICATIONS_RUNNING_009_HELP=Number of currently running web applications.
+
+ASPNET_REQUESTS_DISCONNECTED_009_NAME=Requests Disconnected
+ASPNET_REQUESTS_DISCONNECTED_009_HELP=The number of requests disconnected due to communication errors or user terminated.
+
+ASPNET_REQUEST_EXECUTION_TIME_009_NAME=Request Execution Time
+ASPNET_REQUEST_EXECUTION_TIME_009_HELP=The number of milliseconds that it took to execute the most recent request.
+
+ASPNET_REQUESTS_REJECTED_009_NAME=Requests Rejected
+ASPNET_REQUESTS_REJECTED_009_HELP=The number of requests rejected because the request queue was full.
+
+ASPNET_REQUESTS_QUEUED_009_NAME=Requests Queued
+ASPNET_REQUESTS_QUEUED_009_HELP=The number of requests waiting to be processed.
+
+ASPNET_WPS_RUNNING_009_NAME=Worker Processes Running
+ASPNET_WPS_RUNNING_009_HELP=Number of worker processes running on the machine.
+
+ASPNET_WPS_RESTARTS_009_NAME=Worker Process Restarts
+ASPNET_WPS_RESTARTS_009_HELP=Number of times a worker process has restarted on the machine.
+
+ASPNET_REQUEST_WAIT_TIME_009_NAME=Request Wait Time
+ASPNET_REQUEST_WAIT_TIME_009_HELP=The number of milliseconds the most recent request was waiting in the queue.
+
+ASPNET_STATE_SERVER_SESSIONS_ACTIVE_009_NAME=State Server Sessions Active
+ASPNET_STATE_SERVER_SESSIONS_ACTIVE_009_HELP=The current number of sessions currently active.
+
+ASPNET_STATE_SERVER_SESSIONS_ABANDONED_009_NAME=State Server Sessions Abandoned
+ASPNET_STATE_SERVER_SESSIONS_ABANDONED_009_HELP=The number of sessions that have been explicitly abandoned.
+
+ASPNET_STATE_SERVER_SESSIONS_TIMED_OUT_009_NAME=State Server Sessions Timed Out
+ASPNET_STATE_SERVER_SESSIONS_TIMED_OUT_009_HELP=The number of sessions timed out.
+
+ASPNET_STATE_SERVER_SESSIONS_TOTAL_009_NAME=State Server Sessions Total
+ASPNET_STATE_SERVER_SESSIONS_TOTAL_009_HELP=The number of sessions total.
+
+;;
+;; ASP.NET Application Counters
+;;
+
+ASPNET_ANONYMOUS_REQUESTS_009_NAME=Anonymous Requests
+ASPNET_ANONYMOUS_REQUESTS_009_HELP=Number of requests utilizing anonymous authentication.
+
+ASPNET_ANONYMOUS_REQUESTS_RATE_009_NAME=Anonymous Requests/Sec
+ASPNET_ANONYMOUS_REQUESTS_RATE_009_HELP=Number of Authentication Anonymous Requests/Sec
+
+ASPNET_TOTAL_CACHE_ENTRIES_009_NAME=Cache Total Entries
+ASPNET_TOTAL_CACHE_ENTRIES_009_HELP=Total number of entries within the cache (both internal and user added)
+
+ASPNET_TOTAL_CACHE_TURNOVER_RATE_009_NAME=Cache Total Turnover Rate
+ASPNET_TOTAL_CACHE_TURNOVER_RATE_009_HELP=Number of additions and removals to the total cache per second.
+
+ASPNET_TOTAL_CACHE_HITS_009_NAME=Cache Total Hits
+ASPNET_TOTAL_CACHE_HITS_009_HELP=Total number of hits from the cache.
+
+ASPNET_TOTAL_CACHE_MISSES_009_NAME=Cache Total Misses
+ASPNET_TOTAL_CACHE_MISSES_009_HELP=Total number of cache misses.
+
+ASPNET_TOTAL_CACHE_RATIO_009_NAME=Cache Total Hit Ratio
+ASPNET_TOTAL_CACHE_RATIO_009_HELP=Ratio of hits from all cache calls.
+
+ASPNET_TOTAL_CACHE_RATIO_BASE_009_NAME=Cache Total Hit Ratio Base
+ASPNET_TOTAL_CACHE_RATIO_BASE_009_HELP=Cache Total Hit Ratio Base
+
+ASPNET_API_CACHE_ENTRIES_009_NAME=Cache API Entries
+ASPNET_API_CACHE_ENTRIES_009_HELP=Total number of entries within the cache added by the user.
+
+ASPNET_API_CACHE_TURNOVER_RATE_009_NAME=Cache API Turnover Rate
+ASPNET_API_CACHE_TURNOVER_RATE_009_HELP=Number of additions and removals to the API cache per second.
+
+ASPNET_API_CACHE_HITS_009_NAME=Cache API Hits
+ASPNET_API_CACHE_HITS_009_HELP=Number of cache hits from user code.
+
+ASPNET_API_CACHE_MISSES_009_NAME=Cache API Misses
+ASPNET_API_CACHE_MISSES_009_HELP=Number of cache misses called from user code.
+
+ASPNET_API_CACHE_RATIO_009_NAME=Cache API Hit Ratio
+ASPNET_API_CACHE_RATIO_009_HELP=Ratio of hits called from user code.
+
+ASPNET_API_CACHE_RATIO_BASE_009_NAME=Cache API Hit Ratio Base
+ASPNET_API_CACHE_RATIO_BASE_009_HELP=Cache API Hit Ratio Base
+
+ASPNET_OUTPUT_CACHE_ENTRIES_009_NAME=Output Cache Entries
+ASPNET_OUTPUT_CACHE_ENTRIES_009_HELP=Current number of entries in the output cache.
+
+ASPNET_OUTPUT_CACHE_TURNOVER_RATE_009_NAME=Output Cache Turnover Rate
+ASPNET_OUTPUT_CACHE_TURNOVER_RATE_009_HELP=Number of additions and removals to the output cache per second.
+
+ASPNET_OUTPUT_CACHE_HITS_009_NAME=Output Cache Hits
+ASPNET_OUTPUT_CACHE_HITS_009_HELP=Total number of ouput cacheable requests served from the output cache.
+
+ASPNET_OUTPUT_CACHE_MISSES_009_NAME=Output Cache Misses
+ASPNET_OUTPUT_CACHE_MISSES_009_HELP=Total number of ouput cacheable requests not served from the output cache.
+
+ASPNET_OUTPUT_CACHE_RATIO_009_NAME=Output Cache Hit Ratio
+ASPNET_OUTPUT_CACHE_RATIO_009_HELP=Ratio of hits to requests for output cacheable requests.
+
+ASPNET_OUTPUT_CACHE_RATIO_BASE_009_NAME=Output Cache Hit Ratio Base
+ASPNET_OUTPUT_CACHE_RATIO_BASE_009_HELP=Output Cache Hit Ratio Base
+
+ASPNET_COMPILATIONS_009_NAME=Compilations Total
+ASPNET_COMPILATIONS_009_HELP=Number of .asax, .ascx, .ashx, .asmx, or .aspx source files dynamically compiled.
+
+ASPNET_DEBUGGING_REQUESTS_009_NAME=Debugging Requests
+ASPNET_DEBUGGING_REQUESTS_009_HELP=Number of debugging requests processed.
+
+ASPNET_ERRORS_PRE_PROCESSING_009_NAME=Errors During Preprocessing
+ASPNET_ERRORS_PRE_PROCESSING_009_HELP=Number of errors that have occurred during parsing and configuration.
+
+ASPNET_ERRORS_COMPILING_009_NAME=Errors During Compilation
+ASPNET_ERRORS_COMPILING_009_HELP=Number of errors that have occurred during compilation.
+
+ASPNET_ERRORS_DURING_REQUEST_009_NAME=Errors During Execution
+ASPNET_ERRORS_DURING_REQUEST_009_HELP=Number of errors that have occurred during the processing of a request.
+
+ASPNET_ERRORS_UNHANDLED_009_NAME=Errors Unhandled During Execution
+ASPNET_ERRORS_UNHANDLED_009_HELP=Number of errors not handled by user code, but by the default error handler.
+
+ASPNET_ERRORS_UNHANDLED_RATE_009_NAME=Errors Unhandled During Execution/Sec
+ASPNET_ERRORS_UNHANDLED_RATE_009_HELP=Rate of unhandled errors.
+
+ASPNET_ERRORS_TOTAL_009_NAME=Errors Total
+ASPNET_ERRORS_TOTAL_009_HELP=Total number of errors occurred.
+
+ASPNET_ERRORS_TOTAL_RATE_009_NAME=Errors Total/Sec
+ASPNET_ERRORS_TOTAL_RATE_009_HELP=Rate of errors occurred.
+
+ASPNET_PIPELINES_009_NAME=Pipeline Instance Count
+ASPNET_PIPELINES_009_HELP=Number of active pipeline instances.
+
+ASPNET_REQUEST_BYTES_IN_009_NAME=Request Bytes In Total
+ASPNET_REQUEST_BYTES_IN_009_HELP=The total size, in bytes, of all requests.
+
+ASPNET_REQUEST_BYTES_OUT_009_NAME=Request Bytes Out Total
+ASPNET_REQUEST_BYTES_OUT_009_HELP=The total size, in bytes, of responses sent to a client. This does not include standard HTTP response headers.
+
+ASPNET_REQUESTS_EXECUTING_009_NAME=Requests Executing
+ASPNET_REQUESTS_EXECUTING_009_HELP=The number of requests currently executing.
+
+ASPNET_REQUESTS_FAILED_009_NAME=Requests Failed
+ASPNET_REQUESTS_FAILED_009_HELP=Total number of failed requests.
+
+ASPNET_REQUESTS_NOT_FOUND_009_NAME=Requests Not Found
+ASPNET_REQUESTS_NOT_FOUND_009_HELP=The number of requests for resources that were not found.
+
+ASPNET_REQUESTS_NOT_AUTHORIZED_009_NAME=Requests Not Authorized
+ASPNET_REQUESTS_NOT_AUTHORIZED_009_HELP=Number of requests failed due to unauthorized access.
+
+ASPNET_REQUESTS_TIMED_OUT_009_NAME=Requests Timed Out
+ASPNET_REQUESTS_TIMED_OUT_009_HELP=The number of requests that timed out.
+
+ASPNET_REQUESTS_SUCCEDED_009_NAME=Requests Succeeded
+ASPNET_REQUESTS_SUCCEDED_009_HELP=The number of requests that executed successfully.
+
+ASPNET_REQUESTS_TOTAL_009_NAME=Requests Total
+ASPNET_REQUESTS_TOTAL_009_HELP=The total number of requests since the application was started.
+
+ASPNET_REQUESTS_TOTAL_RATE_009_NAME=Requests/Sec
+ASPNET_REQUESTS_TOTAL_RATE_009_HELP=The number of requests executed per second.
+
+ASPNET_SESSIONS_ACTIVE_009_NAME=Sessions Active
+ASPNET_SESSIONS_ACTIVE_009_HELP=The current number of sessions currently active.
+
+ASPNET_SESSIONS_ABANDONED_009_NAME=Sessions Abandoned
+ASPNET_SESSIONS_ABANDONED_009_HELP=The number of sessions that have been explicitly abandoned.
+
+ASPNET_SESSIONS_TIMED_OUT_009_NAME=Sessions Timed Out
+ASPNET_SESSIONS_TIMED_OUT_009_HELP=The number of sessions timed out.
+
+ASPNET_SESSIONS_TOTAL_009_NAME=Sessions Total
+ASPNET_SESSIONS_TOTAL_009_HELP=Total number of sessions since the application was started.
+
+ASPNET_TRANSACTIONS_ABORTED_009_NAME=Transactions Aborted
+ASPNET_TRANSACTIONS_ABORTED_009_HELP=The number of transactions aborted.
+
+ASPNET_TRANSACTIONS_COMMITTED_009_NAME=Transactions Committed
+ASPNET_TRANSACTIONS_COMMITTED_009_HELP=The number of transactions committed.
+
+ASPNET_TRANSACTIONS_PENDING_009_NAME=Transactions Pending
+ASPNET_TRANSACTIONS_PENDING_009_HELP=Number of transactions in progress.
+
+ASPNET_TRANSACTIONS_TOTAL_009_NAME=Transactions Total
+ASPNET_TRANSACTIONS_TOTAL_009_HELP=The total number of transactions since the application was started.
+
+ASPNET_TRANSACTIONS_RATE_009_NAME=Transactions/Sec
+ASPNET_TRANSACTIONS_RATE_009_HELP=Transactions started per second.
+
+;;
+;;
+;;
+
+OBJECT_1_007_NAME=ASP.NET v1.0.3620.0
+OBJECT_1_007_HELP=Globale Leistungsindikatoren für ASP.NET v1.0.3620.0
+OBJECT_2_007_NAME=ASP.NET Apps v1.0.3620.0
+OBJECT_2_007_HELP=Programmleistungsindikatoren für ASP.NET v1.0.3620.0
+
+;;
+;; ASP.NET System Counters
+;;
+
+ASPNET_APPLICATION_RESTARTS_007_NAME=Anwendungsneustarts
+ASPNET_APPLICATION_RESTARTS_007_HELP=Gibt an, wie oft die Anwendung während der Gültigkeitsdauer des Webservers neu gestartet wurde.
+
+ASPNET_APPLICATIONS_RUNNING_007_NAME=Ausgeführte Anwendungen
+ASPNET_APPLICATIONS_RUNNING_007_HELP=Die Anzahl der Webanwendungen, die momentan ausgeführt werden.
+
+ASPNET_REQUESTS_DISCONNECTED_007_NAME=Getrennte Anforderungen
+ASPNET_REQUESTS_DISCONNECTED_007_HELP=Die Anzahl der Anforderungen, die aufgrund von Kommunikationsfehlern oder vom Benutzer getrennt wurden.
+
+ASPNET_REQUEST_EXECUTION_TIME_007_NAME=Ausführungszeit der Anforderung
+ASPNET_REQUEST_EXECUTION_TIME_007_HELP=Die Zeitdauer zum Ausführen der letzten Anforderung in Millisekunden.
+
+ASPNET_REQUESTS_REJECTED_007_NAME=Anforderungen wurden abgelehnt
+ASPNET_REQUESTS_REJECTED_007_HELP=Die Anzahl der abgelehnten Anforderungen, da die Anforderungsschlange voll war.
+
+ASPNET_REQUESTS_QUEUED_007_NAME=Anforderungen in Warteschlange
+ASPNET_REQUESTS_QUEUED_007_HELP=Die Anzahl der Anforderungen, die auf die Verarbeitung warten.
+
+ASPNET_WPS_RUNNING_007_NAME=Ausgeführte Workerprozesse
+ASPNET_WPS_RUNNING_007_HELP=Die Anzahl der Workerprozesse, die auf dem Computer ausgeführt werden.
+
+ASPNET_WPS_RESTARTS_007_NAME=Workerprozess-Neustarts
+ASPNET_WPS_RESTARTS_007_HELP=Gibt an, wie oft ein Workerprozess auf dem Computer neu gestartet wurde.
+
+ASPNET_REQUEST_WAIT_TIME_007_NAME=Wartezeit der Anforderung
+ASPNET_REQUEST_WAIT_TIME_007_HELP=Die Anzahl der Millisekunden, die die letzte Anforderung in der Warteschlange wartete.
+
+ASPNET_STATE_SERVER_SESSIONS_ACTIVE_007_NAME=Aktive Statusserversitzungen
+ASPNET_STATE_SERVER_SESSIONS_ACTIVE_007_HELP=Die Anzahl der Sitzungen, die momentan aktive sind.
+
+ASPNET_STATE_SERVER_SESSIONS_ABANDONED_007_NAME=Abgebrochene Statusserversitzungen
+ASPNET_STATE_SERVER_SESSIONS_ABANDONED_007_HELP=Die Anzahl der Sitzungen, die explizit abgebrochen wurden.
+
+ASPNET_STATE_SERVER_SESSIONS_TIMED_OUT_007_NAME=Abgelaufene Statusserversitzungen
+ASPNET_STATE_SERVER_SESSIONS_TIMED_OUT_007_HELP=Anzahl der Sitzungen mit Zeitüberschreitung
+
+ASPNET_STATE_SERVER_SESSIONS_TOTAL_007_NAME=Statusserversitzungen insgesamt
+ASPNET_STATE_SERVER_SESSIONS_TOTAL_007_HELP=Gesamtanzahl der Sitzungen.
+
+;;
+;; ASP.NET Application Counters
+;;
+
+ASPNET_ANONYMOUS_REQUESTS_007_NAME=Anonyme Anforderungen
+ASPNET_ANONYMOUS_REQUESTS_007_HELP=Die Anzahl der Anforderungen, die anonyme Authentifizierung verwenden.
+
+ASPNET_ANONYMOUS_REQUESTS_RATE_007_NAME=Anonyme Anforderungen/Sek.
+ASPNET_ANONYMOUS_REQUESTS_RATE_007_HELP=Die Anzahl der Anforderungen mit anonymer Authentifizierung pro Sekunde.
+
+ASPNET_TOTAL_CACHE_ENTRIES_007_NAME=Cacheeinträge gesamt
+ASPNET_TOTAL_CACHE_ENTRIES_007_HELP=Die Gesamtzahl der Cacheeinträge (intern und von Benutzer hinzugefügt).
+
+ASPNET_TOTAL_CACHE_TURNOVER_RATE_007_NAME=Gesamte Cacheturnoverrate
+ASPNET_TOTAL_CACHE_TURNOVER_RATE_007_HELP=Anzahl der Hinzufüge- und Löschvorgänge im gesamten Cache pro Sekunde.
+
+ASPNET_TOTAL_CACHE_HITS_007_NAME=Cachetreffer gesamt
+ASPNET_TOTAL_CACHE_HITS_007_HELP=Die Gesamtzahl der Cachetreffer.
+
+ASPNET_TOTAL_CACHE_MISSES_007_NAME=Fehlgeschlagene Cachezugriffe gesamt
+ASPNET_TOTAL_CACHE_MISSES_007_HELP=Die Gesamtzahl der fehlgeschlagenen Cachezugriffe.
+
+ASPNET_TOTAL_CACHE_RATIO_007_NAME=Cache-Trefferrate gesamt
+ASPNET_TOTAL_CACHE_RATIO_007_HELP=Die Trefferrate aller Cacheaufrufe.
+
+ASPNET_TOTAL_CACHE_RATIO_BASE_007_NAME=Cache-Trefferrate gesamt (Basis)
+ASPNET_TOTAL_CACHE_RATIO_BASE_007_HELP=Cache-Trefferrate gesamt (Basis)
+
+ASPNET_API_CACHE_ENTRIES_007_NAME=Cache-API-Einträge
+ASPNET_API_CACHE_ENTRIES_007_HELP=Die Gesamtzahl der Cacheeinträge, die vom Benutzer hinzugefügt wurden.
+
+ASPNET_API_CACHE_TURNOVER_RATE_007_NAME=Turnoverrate für Cache-API
+ASPNET_API_CACHE_TURNOVER_RATE_007_HELP=Anzahl der Hinzufüge- und Löschvorgänge im API-Cache pro Sekunde.
+
+ASPNET_API_CACHE_HITS_007_NAME=Cache-API-Treffer
+ASPNET_API_CACHE_HITS_007_HELP=Die Anzahl der Cachetreffer vom Benutzercode aus.
+
+ASPNET_API_CACHE_MISSES_007_NAME=Fehlgeschlagene Cache-API-Zugriffe
+ASPNET_API_CACHE_MISSES_007_HELP=Die Anzahl der fehlgeschlagenen Cachezugriffe, die vom Benutzercode aus aufgerufen wurden.
+
+ASPNET_API_CACHE_RATIO_007_NAME=Cache-API-Trefferrate
+ASPNET_API_CACHE_RATIO_007_HELP=Die Trefferrate der Benutzercodeaufrufe.
+
+ASPNET_API_CACHE_RATIO_BASE_007_NAME=API-Cache-Trefferrate (Basis)
+ASPNET_API_CACHE_RATIO_BASE_007_HELP=API-Cache-Trefferrate (Basis)
+
+ASPNET_OUTPUT_CACHE_ENTRIES_007_NAME=Ausgabecacheeinträge
+ASPNET_OUTPUT_CACHE_ENTRIES_007_HELP=Die aktuelle Anzahl der Einträge im Ausgabecache.
+
+ASPNET_OUTPUT_CACHE_TURNOVER_RATE_007_NAME=Turnoverrate für den Ausgabecache
+ASPNET_OUTPUT_CACHE_TURNOVER_RATE_007_HELP=Anzahl der Hinzufüge- und Löschvorgänge im Ausgabecache pro Sekunde.
+
+ASPNET_OUTPUT_CACHE_HITS_007_NAME=Ausgabecachetreffer
+ASPNET_OUTPUT_CACHE_HITS_007_HELP=Die Gesamtanzahl der zwischenspeicherbaren Anforderungen, die vom Ausgabecache beantwortet werden.
+
+ASPNET_OUTPUT_CACHE_MISSES_007_NAME=Fehlgeschlagene Ausgabecache-Zugriffe
+ASPNET_OUTPUT_CACHE_MISSES_007_HELP=Die Gesamtanzahl der zwischenspeicherbaren Anforderungen, die nicht vom Ausgabecache beantwortet werden.
+
+ASPNET_OUTPUT_CACHE_RATIO_007_NAME=Ausgabecache-Trefferrate
+ASPNET_OUTPUT_CACHE_RATIO_007_HELP=Trefferrate der zwischenspeicherbaren Ausgabeanforderungen.
+
+ASPNET_OUTPUT_CACHE_RATIO_BASE_007_NAME=Ausgabecache-Trefferrate
+ASPNET_OUTPUT_CACHE_RATIO_BASE_007_HELP=Ausgabecache-Trefferrate
+
+ASPNET_COMPILATIONS_007_NAME=Kompilierungen insgesamt
+ASPNET_COMPILATIONS_007_HELP=Die Anzahl der dynamisch kompilierten Quelldateien .asax, .ascx, .ashx, .asmx oder .aspx.
+
+ASPNET_DEBUGGING_REQUESTS_007_NAME=Debug-Anforderungen
+ASPNET_DEBUGGING_REQUESTS_007_HELP=Die Anzahl der Debug-Anforderungen, die verarbeitet wurden.
+
+ASPNET_ERRORS_PRE_PROCESSING_007_NAME=Fehler bei der Vorverarbeitung
+ASPNET_ERRORS_PRE_PROCESSING_007_HELP=Die Anzahl der Fehler, die beim Analysieren und Konfigurieren aufgetreten sind.
+
+ASPNET_ERRORS_COMPILING_007_NAME=Fehler bei der Kompilierung
+ASPNET_ERRORS_COMPILING_007_HELP=Die Anzahl der Fehler, die beim Kompilieren aufgetreten sind.
+
+ASPNET_ERRORS_DURING_REQUEST_007_NAME=Fehler beim Ausführen
+ASPNET_ERRORS_DURING_REQUEST_007_HELP=Die Anzahl der Fehler, die beim Verarbeiten einer Anforderung aufgetreten sind.
+
+ASPNET_ERRORS_UNHANDLED_007_NAME=Unbehandelte Fehler beim Ausführen
+ASPNET_ERRORS_UNHANDLED_007_HELP=Die Anzahl der Fehler, die nicht vom Benutzercode verarbeitet wurden, sondern vom Standardfehlerhandler.
+
+ASPNET_ERRORS_UNHANDLED_RATE_007_NAME=Unbehandelte Fehler während der Ausführung pro Sekunde
+ASPNET_ERRORS_UNHANDLED_RATE_007_HELP=Rate der unbehandelten Fehler.
+
+ASPNET_ERRORS_TOTAL_007_NAME=Fehler gesamt
+ASPNET_ERRORS_TOTAL_007_HELP=Anzahl der aufgetretenen Fehler.
+
+ASPNET_ERRORS_TOTAL_RATE_007_NAME=Fehler gesamt/Sek.
+ASPNET_ERRORS_TOTAL_RATE_007_HELP=Rate der aufgetretenen Fehler.
+
+ASPNET_PIPELINES_007_NAME=Pipeline-Instanzenzahl
+ASPNET_PIPELINES_007_HELP=Die Anzahl der aktiven Pipelineinstanzen.
+
+ASPNET_REQUEST_BYTES_IN_007_NAME=Anforderungsbytes gesamt (einschließl.)
+ASPNET_REQUEST_BYTES_IN_007_HELP=Die Gesamtgröße aller Anforderungen in Bytes.
+
+ASPNET_REQUEST_BYTES_OUT_007_NAME=Anforderungsbytes gesamt (ausschließl.)
+ASPNET_REQUEST_BYTES_OUT_007_HELP=Die Gesamtgröße aller Antworten in Bytes, die an einen Client gesendet wurden, wobei standardmäßige HTTP-Antwortheader ausgeschlossen werden.
+
+ASPNET_REQUESTS_EXECUTING_007_NAME=Ausgeführte Anforderungen
+ASPNET_REQUESTS_EXECUTING_007_HELP=Die Anzahl der Anforderungen, die momentan ausgeführt werden.
+
+ASPNET_REQUESTS_FAILED_007_NAME=Fehlgeschlagene Anforderungen
+ASPNET_REQUESTS_FAILED_007_HELP=Die Gesamtszahl der fehlgeschlagenen Anforderungen.
+
+ASPNET_REQUESTS_NOT_FOUND_007_NAME=Nicht gefundene Anforderungen
+ASPNET_REQUESTS_NOT_FOUND_007_HELP=Die Anzahl der Anforderungen für Ressourcen, die nicht gefunden wurden.
+
+ASPNET_REQUESTS_NOT_AUTHORIZED_007_NAME=Nicht berechtigte Anforderungen
+ASPNET_REQUESTS_NOT_AUTHORIZED_007_HELP=Die Anzahl der Anforderungen, die wegen mangelnder Zugriffsberechtigung fehlgeschlagen sind.
+
+ASPNET_REQUESTS_TIMED_OUT_007_NAME=Anforderungen mit Zeitüberschreitung
+ASPNET_REQUESTS_TIMED_OUT_007_HELP=Die Anzahl der Anforderungen, deren mit Zeitlimit überschritten wurde.
+
+ASPNET_REQUESTS_SUCCEDED_007_NAME=Erfolgreiche Anforderungen
+ASPNET_REQUESTS_SUCCEDED_007_HELP=Die Anzahl der Anforderungen, die erfolgreich ausgeführt wurden.
+
+ASPNET_REQUESTS_TOTAL_007_NAME=Anforderungen gesamt
+ASPNET_REQUESTS_TOTAL_007_HELP=Die Gesamtszahl der Anforderungen seit die Anwendung gestartet wurde.
+
+ASPNET_REQUESTS_TOTAL_RATE_007_NAME=Anforderungen/Sek.
+ASPNET_REQUESTS_TOTAL_RATE_007_HELP=Die Anzahl der Anforderungen, die pro Sekunde ausgeführt werden.
+
+ASPNET_SESSIONS_ACTIVE_007_NAME=Aktive Sitzungen
+ASPNET_SESSIONS_ACTIVE_007_HELP=Die Anzahl der Sitzungen, die momentan aktive sind.
+
+ASPNET_SESSIONS_ABANDONED_007_NAME=Abgebrochene Sitzungen
+ASPNET_SESSIONS_ABANDONED_007_HELP=Die Anzahl der Sitzungen, die explizit abgebrochen wurden.
+
+ASPNET_SESSIONS_TIMED_OUT_007_NAME=Sitzungen mit Zeitüberschreitung
+ASPNET_SESSIONS_TIMED_OUT_007_HELP=Anzahl der Sitzungen mit Zeitüberschreitung
+
+ASPNET_SESSIONS_TOTAL_007_NAME=Sitzungen gesamt
+ASPNET_SESSIONS_TOTAL_007_HELP=Gesamtanzahl der Sitzungen seit die Anwendung gestartet wurde.
+
+ASPNET_TRANSACTIONS_ABORTED_007_NAME=Abgebrochene Transaktionen
+ASPNET_TRANSACTIONS_ABORTED_007_HELP=Die Anzahl der abgebrochenen Transaktionen.
+
+ASPNET_TRANSACTIONS_COMMITTED_007_NAME=Übermittelte Transaktionen
+ASPNET_TRANSACTIONS_COMMITTED_007_HELP=Die Anzahl der Transaktionen, für die ein Commit ausgeführt wurde.
+
+ASPNET_TRANSACTIONS_PENDING_007_NAME=Ausstehende Transaktionen
+ASPNET_TRANSACTIONS_PENDING_007_HELP=Die Anzahl der Transaktionen, die sich Bearbeitung befinden.
+
+ASPNET_TRANSACTIONS_TOTAL_007_NAME=Transaktionen gesamt
+ASPNET_TRANSACTIONS_TOTAL_007_HELP=Die Gesamtanzahl der Transaktionen seit die Anwendung gestartet wurde.
+
+ASPNET_TRANSACTIONS_RATE_007_NAME=Transaktionen/Sek
+ASPNET_TRANSACTIONS_RATE_007_HELP=Die Anzahl der Transaktionen, die pro Sekunde gestartet werden.
+
diff --git a/src/inc/1031/aspnet_perf2.ini b/src/inc/1031/aspnet_perf2.ini
new file mode 100644
index 0000000000..2e82d224bb
--- /dev/null
+++ b/src/inc/1031/aspnet_perf2.ini
@@ -0,0 +1,416 @@
+[info]
+drivername=ASP.NET
+symbolfile=aspnet_perf.h
+
+[languages]
+007=German
+009=English
+
+[objects]
+OBJECT_1_009_NAME=ASP.NET
+OBJECT_2_009_NAME=ASP.NET Applications
+
+[text]
+OBJECT_1_009_NAME=ASP.NET
+OBJECT_1_009_HELP=ASP.NET global performance counters
+OBJECT_2_009_NAME=ASP.NET Applications
+OBJECT_2_009_HELP=ASP.NET Application performance counters
+
+;;
+;; ASP.NET System Counters
+;;
+
+ASPNET_APPLICATION_RESTARTS_009_NAME=Application Restarts
+ASPNET_APPLICATION_RESTARTS_009_HELP=Number of times the application has been restarted during the web server's lifetime.
+
+ASPNET_APPLICATIONS_RUNNING_009_NAME=Applications Running
+ASPNET_APPLICATIONS_RUNNING_009_HELP=Number of currently running web applications.
+
+ASPNET_REQUESTS_DISCONNECTED_009_NAME=Requests Disconnected
+ASPNET_REQUESTS_DISCONNECTED_009_HELP=The number of requests disconnected due to communication errors or user terminated.
+
+ASPNET_REQUEST_EXECUTION_TIME_009_NAME=Request Execution Time
+ASPNET_REQUEST_EXECUTION_TIME_009_HELP=The number of milliseconds that it took to execute the most recent request.
+
+ASPNET_REQUESTS_REJECTED_009_NAME=Requests Rejected
+ASPNET_REQUESTS_REJECTED_009_HELP=The number of requests rejected because the request queue was full.
+
+ASPNET_REQUESTS_QUEUED_009_NAME=Requests Queued
+ASPNET_REQUESTS_QUEUED_009_HELP=The number of requests waiting to be processed.
+
+ASPNET_WPS_RUNNING_009_NAME=Worker Processes Running
+ASPNET_WPS_RUNNING_009_HELP=Number of worker processes running on the machine.
+
+ASPNET_WPS_RESTARTS_009_NAME=Worker Process Restarts
+ASPNET_WPS_RESTARTS_009_HELP=Number of times a worker process has restarted on the machine.
+
+ASPNET_REQUEST_WAIT_TIME_009_NAME=Request Wait Time
+ASPNET_REQUEST_WAIT_TIME_009_HELP=The number of milliseconds the most recent request was waiting in the queue.
+
+ASPNET_STATE_SERVER_SESSIONS_ACTIVE_009_NAME=State Server Sessions Active
+ASPNET_STATE_SERVER_SESSIONS_ACTIVE_009_HELP=The current number of sessions currently active.
+
+ASPNET_STATE_SERVER_SESSIONS_ABANDONED_009_NAME=State Server Sessions Abandoned
+ASPNET_STATE_SERVER_SESSIONS_ABANDONED_009_HELP=The number of sessions that have been explicitly abandoned.
+
+ASPNET_STATE_SERVER_SESSIONS_TIMED_OUT_009_NAME=State Server Sessions Timed Out
+ASPNET_STATE_SERVER_SESSIONS_TIMED_OUT_009_HELP=The number of sessions timed out.
+
+ASPNET_STATE_SERVER_SESSIONS_TOTAL_009_NAME=State Server Sessions Total
+ASPNET_STATE_SERVER_SESSIONS_TOTAL_009_HELP=The number of sessions total.
+
+;;
+;; ASP.NET Application Counters
+;;
+
+ASPNET_ANONYMOUS_REQUESTS_009_NAME=Anonymous Requests
+ASPNET_ANONYMOUS_REQUESTS_009_HELP=Number of requests utilizing anonymous authentication.
+
+ASPNET_ANONYMOUS_REQUESTS_RATE_009_NAME=Anonymous Requests/Sec
+ASPNET_ANONYMOUS_REQUESTS_RATE_009_HELP=Number of Authentication Anonymous Requests/Sec
+
+ASPNET_TOTAL_CACHE_ENTRIES_009_NAME=Cache Total Entries
+ASPNET_TOTAL_CACHE_ENTRIES_009_HELP=Total number of entries within the cache (both internal and user added)
+
+ASPNET_TOTAL_CACHE_TURNOVER_RATE_009_NAME=Cache Total Turnover Rate
+ASPNET_TOTAL_CACHE_TURNOVER_RATE_009_HELP=Number of additions and removals to the total cache per second.
+
+ASPNET_TOTAL_CACHE_HITS_009_NAME=Cache Total Hits
+ASPNET_TOTAL_CACHE_HITS_009_HELP=Total number of hits from the cache.
+
+ASPNET_TOTAL_CACHE_MISSES_009_NAME=Cache Total Misses
+ASPNET_TOTAL_CACHE_MISSES_009_HELP=Total number of cache misses.
+
+ASPNET_TOTAL_CACHE_RATIO_009_NAME=Cache Total Hit Ratio
+ASPNET_TOTAL_CACHE_RATIO_009_HELP=Ratio of hits from all cache calls.
+
+ASPNET_TOTAL_CACHE_RATIO_BASE_009_NAME=Cache Total Hit Ratio Base
+ASPNET_TOTAL_CACHE_RATIO_BASE_009_HELP=Cache Total Hit Ratio Base
+
+ASPNET_API_CACHE_ENTRIES_009_NAME=Cache API Entries
+ASPNET_API_CACHE_ENTRIES_009_HELP=Total number of entries within the cache added by the user.
+
+ASPNET_API_CACHE_TURNOVER_RATE_009_NAME=Cache API Turnover Rate
+ASPNET_API_CACHE_TURNOVER_RATE_009_HELP=Number of additions and removals to the API cache per second.
+
+ASPNET_API_CACHE_HITS_009_NAME=Cache API Hits
+ASPNET_API_CACHE_HITS_009_HELP=Number of cache hits from user code.
+
+ASPNET_API_CACHE_MISSES_009_NAME=Cache API Misses
+ASPNET_API_CACHE_MISSES_009_HELP=Number of cache misses called from user code.
+
+ASPNET_API_CACHE_RATIO_009_NAME=Cache API Hit Ratio
+ASPNET_API_CACHE_RATIO_009_HELP=Ratio of hits called from user code.
+
+ASPNET_API_CACHE_RATIO_BASE_009_NAME=Cache API Hit Ratio Base
+ASPNET_API_CACHE_RATIO_BASE_009_HELP=Cache API Hit Ratio Base
+
+ASPNET_OUTPUT_CACHE_ENTRIES_009_NAME=Output Cache Entries
+ASPNET_OUTPUT_CACHE_ENTRIES_009_HELP=Current number of entries in the output cache.
+
+ASPNET_OUTPUT_CACHE_TURNOVER_RATE_009_NAME=Output Cache Turnover Rate
+ASPNET_OUTPUT_CACHE_TURNOVER_RATE_009_HELP=Number of additions and removals to the output cache per second.
+
+ASPNET_OUTPUT_CACHE_HITS_009_NAME=Output Cache Hits
+ASPNET_OUTPUT_CACHE_HITS_009_HELP=Total number of ouput cacheable requests served from the output cache.
+
+ASPNET_OUTPUT_CACHE_MISSES_009_NAME=Output Cache Misses
+ASPNET_OUTPUT_CACHE_MISSES_009_HELP=Total number of ouput cacheable requests not served from the output cache.
+
+ASPNET_OUTPUT_CACHE_RATIO_009_NAME=Output Cache Hit Ratio
+ASPNET_OUTPUT_CACHE_RATIO_009_HELP=Ratio of hits to requests for output cacheable requests.
+
+ASPNET_OUTPUT_CACHE_RATIO_BASE_009_NAME=Output Cache Hit Ratio Base
+ASPNET_OUTPUT_CACHE_RATIO_BASE_009_HELP=Output Cache Hit Ratio Base
+
+ASPNET_COMPILATIONS_009_NAME=Compilations Total
+ASPNET_COMPILATIONS_009_HELP=Number of .asax, .ascx, .ashx, .asmx, or .aspx source files dynamically compiled.
+
+ASPNET_DEBUGGING_REQUESTS_009_NAME=Debugging Requests
+ASPNET_DEBUGGING_REQUESTS_009_HELP=Number of debugging requests processed.
+
+ASPNET_ERRORS_PRE_PROCESSING_009_NAME=Errors During Preprocessing
+ASPNET_ERRORS_PRE_PROCESSING_009_HELP=Number of errors that have occurred during parsing and configuration.
+
+ASPNET_ERRORS_COMPILING_009_NAME=Errors During Compilation
+ASPNET_ERRORS_COMPILING_009_HELP=Number of errors that have occurred during compilation.
+
+ASPNET_ERRORS_DURING_REQUEST_009_NAME=Errors During Execution
+ASPNET_ERRORS_DURING_REQUEST_009_HELP=Number of errors that have occurred during the processing of a request.
+
+ASPNET_ERRORS_UNHANDLED_009_NAME=Errors Unhandled During Execution
+ASPNET_ERRORS_UNHANDLED_009_HELP=Number of errors not handled by user code, but by the default error handler.
+
+ASPNET_ERRORS_UNHANDLED_RATE_009_NAME=Errors Unhandled During Execution/Sec
+ASPNET_ERRORS_UNHANDLED_RATE_009_HELP=Rate of unhandled errors.
+
+ASPNET_ERRORS_TOTAL_009_NAME=Errors Total
+ASPNET_ERRORS_TOTAL_009_HELP=Total number of errors occurred.
+
+ASPNET_ERRORS_TOTAL_RATE_009_NAME=Errors Total/Sec
+ASPNET_ERRORS_TOTAL_RATE_009_HELP=Rate of errors occurred.
+
+ASPNET_PIPELINES_009_NAME=Pipeline Instance Count
+ASPNET_PIPELINES_009_HELP=Number of active pipeline instances.
+
+ASPNET_REQUEST_BYTES_IN_009_NAME=Request Bytes In Total
+ASPNET_REQUEST_BYTES_IN_009_HELP=The total size, in bytes, of all requests.
+
+ASPNET_REQUEST_BYTES_OUT_009_NAME=Request Bytes Out Total
+ASPNET_REQUEST_BYTES_OUT_009_HELP=The total size, in bytes, of responses sent to a client. This does not include standard HTTP response headers.
+
+ASPNET_REQUESTS_EXECUTING_009_NAME=Requests Executing
+ASPNET_REQUESTS_EXECUTING_009_HELP=The number of requests currently executing.
+
+ASPNET_REQUESTS_FAILED_009_NAME=Requests Failed
+ASPNET_REQUESTS_FAILED_009_HELP=Total number of failed requests.
+
+ASPNET_REQUESTS_NOT_FOUND_009_NAME=Requests Not Found
+ASPNET_REQUESTS_NOT_FOUND_009_HELP=The number of requests for resources that were not found.
+
+ASPNET_REQUESTS_NOT_AUTHORIZED_009_NAME=Requests Not Authorized
+ASPNET_REQUESTS_NOT_AUTHORIZED_009_HELP=Number of requests failed due to unauthorized access.
+
+ASPNET_REQUESTS_TIMED_OUT_009_NAME=Requests Timed Out
+ASPNET_REQUESTS_TIMED_OUT_009_HELP=The number of requests that timed out.
+
+ASPNET_REQUESTS_SUCCEDED_009_NAME=Requests Succeeded
+ASPNET_REQUESTS_SUCCEDED_009_HELP=The number of requests that executed successfully.
+
+ASPNET_REQUESTS_TOTAL_009_NAME=Requests Total
+ASPNET_REQUESTS_TOTAL_009_HELP=The total number of requests since the application was started.
+
+ASPNET_REQUESTS_TOTAL_RATE_009_NAME=Requests/Sec
+ASPNET_REQUESTS_TOTAL_RATE_009_HELP=The number of requests executed per second.
+
+ASPNET_SESSIONS_ACTIVE_009_NAME=Sessions Active
+ASPNET_SESSIONS_ACTIVE_009_HELP=The current number of sessions currently active.
+
+ASPNET_SESSIONS_ABANDONED_009_NAME=Sessions Abandoned
+ASPNET_SESSIONS_ABANDONED_009_HELP=The number of sessions that have been explicitly abandoned.
+
+ASPNET_SESSIONS_TIMED_OUT_009_NAME=Sessions Timed Out
+ASPNET_SESSIONS_TIMED_OUT_009_HELP=The number of sessions timed out.
+
+ASPNET_SESSIONS_TOTAL_009_NAME=Sessions Total
+ASPNET_SESSIONS_TOTAL_009_HELP=Total number of sessions since the application was started.
+
+ASPNET_TRANSACTIONS_ABORTED_009_NAME=Transactions Aborted
+ASPNET_TRANSACTIONS_ABORTED_009_HELP=The number of transactions aborted.
+
+ASPNET_TRANSACTIONS_COMMITTED_009_NAME=Transactions Committed
+ASPNET_TRANSACTIONS_COMMITTED_009_HELP=The number of transactions committed.
+
+ASPNET_TRANSACTIONS_PENDING_009_NAME=Transactions Pending
+ASPNET_TRANSACTIONS_PENDING_009_HELP=Number of transactions in progress.
+
+ASPNET_TRANSACTIONS_TOTAL_009_NAME=Transactions Total
+ASPNET_TRANSACTIONS_TOTAL_009_HELP=The total number of transactions since the application was started.
+
+ASPNET_TRANSACTIONS_RATE_009_NAME=Transactions/Sec
+ASPNET_TRANSACTIONS_RATE_009_HELP=Transactions started per second.
+
+
+;;
+;;
+;;
+
+OBJECT_1_007_NAME=ASP.NET
+OBJECT_1_007_HELP=Globale ASP.NET-Leistungsindikatoren
+OBJECT_2_007_NAME=ASP.NET-Anwendungen
+OBJECT_2_007_HELP=Leistungsindikatoren für ASP.NET-Anwendungen
+
+;;
+;; ASP.NET System Counters
+;;
+
+ASPNET_APPLICATION_RESTARTS_007_NAME=Anwendungsneustarts
+ASPNET_APPLICATION_RESTARTS_007_HELP=Gibt an, wie oft die Anwendung während der Gültigkeitsdauer des Webservers neu gestartet wurde.
+
+ASPNET_APPLICATIONS_RUNNING_007_NAME=Ausgeführte Anwendungen
+ASPNET_APPLICATIONS_RUNNING_007_HELP=Die Anzahl der Webanwendungen, die momentan ausgeführt werden.
+
+ASPNET_REQUESTS_DISCONNECTED_007_NAME=Getrennte Anforderungen
+ASPNET_REQUESTS_DISCONNECTED_007_HELP=Die Anzahl der Anforderungen, die aufgrund von Kommunikationsfehlern oder vom Benutzer getrennt wurden.
+
+ASPNET_REQUEST_EXECUTION_TIME_007_NAME=Ausführungszeit der Anforderung
+ASPNET_REQUEST_EXECUTION_TIME_007_HELP=Die Zeitdauer zum Ausführen der letzten Anforderung in Millisekunden.
+
+ASPNET_REQUESTS_REJECTED_007_NAME=Anforderungen wurden abgelehnt
+ASPNET_REQUESTS_REJECTED_007_HELP=Die Anzahl der abgelehnten Anforderungen, da die Anforderungsschlange voll war.
+
+ASPNET_REQUESTS_QUEUED_007_NAME=Anforderungen in Warteschlange
+ASPNET_REQUESTS_QUEUED_007_HELP=Die Anzahl der Anforderungen, die auf die Verarbeitung warten.
+
+ASPNET_WPS_RUNNING_007_NAME=Ausgeführte Workerprozesse
+ASPNET_WPS_RUNNING_007_HELP=Die Anzahl der Workerprozesse, die auf dem Computer ausgeführt werden.
+
+ASPNET_WPS_RESTARTS_007_NAME=Workerprozess-Neustarts
+ASPNET_WPS_RESTARTS_007_HELP=Gibt an, wie oft ein Workerprozess auf dem Computer neu gestartet wurde.
+
+ASPNET_REQUEST_WAIT_TIME_007_NAME=Wartezeit der Anforderung
+ASPNET_REQUEST_WAIT_TIME_007_HELP=Die Anzahl der Millisekunden, die die letzte Anforderung in der Warteschlange wartete.
+
+ASPNET_STATE_SERVER_SESSIONS_ACTIVE_007_NAME=Aktive Statusserversitzungen
+ASPNET_STATE_SERVER_SESSIONS_ACTIVE_007_HELP=Die Anzahl der Sitzungen, die momentan aktive sind.
+
+ASPNET_STATE_SERVER_SESSIONS_ABANDONED_007_NAME=Abgebrochene Statusserversitzungen
+ASPNET_STATE_SERVER_SESSIONS_ABANDONED_007_HELP=Die Anzahl der Sitzungen, die explizit abgebrochen wurden.
+
+ASPNET_STATE_SERVER_SESSIONS_TIMED_OUT_007_NAME=Abgelaufene Statusserversitzungen
+ASPNET_STATE_SERVER_SESSIONS_TIMED_OUT_007_HELP=Anzahl der Sitzungen mit Zeitüberschreitung
+
+ASPNET_STATE_SERVER_SESSIONS_TOTAL_007_NAME=Statusserversitzungen insgesamt
+ASPNET_STATE_SERVER_SESSIONS_TOTAL_007_HELP=Gesamtanzahl der Sitzungen.
+
+;;
+;; ASP.NET Application Counters
+;;
+
+ASPNET_ANONYMOUS_REQUESTS_007_NAME=Anonyme Anforderungen
+ASPNET_ANONYMOUS_REQUESTS_007_HELP=Die Anzahl der Anforderungen, die anonyme Authentifizierung verwenden.
+
+ASPNET_ANONYMOUS_REQUESTS_RATE_007_NAME=Anonyme Anforderungen/Sek.
+ASPNET_ANONYMOUS_REQUESTS_RATE_007_HELP=Die Anzahl der Anforderungen mit anonymer Authentifizierung pro Sekunde.
+
+ASPNET_TOTAL_CACHE_ENTRIES_007_NAME=Cacheeinträge gesamt
+ASPNET_TOTAL_CACHE_ENTRIES_007_HELP=Die Gesamtzahl der Cacheeinträge (intern und von Benutzer hinzugefügt).
+
+ASPNET_TOTAL_CACHE_TURNOVER_RATE_007_NAME=Gesamte Cacheturnoverrate
+ASPNET_TOTAL_CACHE_TURNOVER_RATE_007_HELP=Anzahl der Hinzufüge- und Löschvorgänge im gesamten Cache pro Sekunde.
+
+ASPNET_TOTAL_CACHE_HITS_007_NAME=Cachetreffer gesamt
+ASPNET_TOTAL_CACHE_HITS_007_HELP=Die Gesamtzahl der Cachetreffer.
+
+ASPNET_TOTAL_CACHE_MISSES_007_NAME=Fehlgeschlagene Cachezugriffe gesamt
+ASPNET_TOTAL_CACHE_MISSES_007_HELP=Die Gesamtzahl der fehlgeschlagenen Cachezugriffe.
+
+ASPNET_TOTAL_CACHE_RATIO_007_NAME=Cache-Trefferrate gesamt
+ASPNET_TOTAL_CACHE_RATIO_007_HELP=Die Trefferrate aller Cacheaufrufe.
+
+ASPNET_TOTAL_CACHE_RATIO_BASE_007_NAME=Cache-Trefferrate gesamt (Basis)
+ASPNET_TOTAL_CACHE_RATIO_BASE_007_HELP=Cache-Trefferrate gesamt (Basis)
+
+ASPNET_API_CACHE_ENTRIES_007_NAME=Cache-API-Einträge
+ASPNET_API_CACHE_ENTRIES_007_HELP=Die Gesamtzahl der Cacheeinträge, die vom Benutzer hinzugefügt wurden.
+
+ASPNET_API_CACHE_TURNOVER_RATE_007_NAME=Turnoverrate für Cache-API
+ASPNET_API_CACHE_TURNOVER_RATE_007_HELP=Anzahl der Hinzufüge- und Löschvorgänge im API-Cache pro Sekunde.
+
+ASPNET_API_CACHE_HITS_007_NAME=Cache-API-Treffer
+ASPNET_API_CACHE_HITS_007_HELP=Die Anzahl der Cachetreffer vom Benutzercode aus.
+
+ASPNET_API_CACHE_MISSES_007_NAME=Fehlgeschlagene Cache-API-Zugriffe
+ASPNET_API_CACHE_MISSES_007_HELP=Die Anzahl der fehlgeschlagenen Cachezugriffe, die vom Benutzercode aus aufgerufen wurden.
+
+ASPNET_API_CACHE_RATIO_007_NAME=Cache-API-Trefferrate
+ASPNET_API_CACHE_RATIO_007_HELP=Die Trefferrate der Benutzercodeaufrufe.
+
+ASPNET_API_CACHE_RATIO_BASE_007_NAME=API-Cache-Trefferrate (Basis)
+ASPNET_API_CACHE_RATIO_BASE_007_HELP=API-Cache-Trefferrate (Basis)
+
+ASPNET_OUTPUT_CACHE_ENTRIES_007_NAME=Ausgabecacheeinträge
+ASPNET_OUTPUT_CACHE_ENTRIES_007_HELP=Die aktuelle Anzahl der Einträge im Ausgabecache.
+
+ASPNET_OUTPUT_CACHE_TURNOVER_RATE_007_NAME=Turnoverrate für den Ausgabecache
+ASPNET_OUTPUT_CACHE_TURNOVER_RATE_007_HELP=Anzahl der Hinzufüge- und Löschvorgänge im Ausgabecache pro Sekunde.
+
+ASPNET_OUTPUT_CACHE_HITS_007_NAME=Ausgabecachetreffer
+ASPNET_OUTPUT_CACHE_HITS_007_HELP=Die Gesamtanzahl der zwischenspeicherbaren Anforderungen, die vom Ausgabecache beantwortet werden.
+
+ASPNET_OUTPUT_CACHE_MISSES_007_NAME=Fehlgeschlagene Ausgabecache-Zugriffe
+ASPNET_OUTPUT_CACHE_MISSES_007_HELP=Die Gesamtanzahl der zwischenspeicherbaren Anforderungen, die nicht vom Ausgabecache beantwortet werden.
+
+ASPNET_OUTPUT_CACHE_RATIO_007_NAME=Ausgabecache-Trefferrate
+ASPNET_OUTPUT_CACHE_RATIO_007_HELP=Trefferrate der zwischenspeicherbaren Ausgabeanforderungen.
+
+ASPNET_OUTPUT_CACHE_RATIO_BASE_007_NAME=Ausgabecache-Trefferrate
+ASPNET_OUTPUT_CACHE_RATIO_BASE_007_HELP=Ausgabecache-Trefferrate
+
+ASPNET_COMPILATIONS_007_NAME=Kompilierungen insgesamt
+ASPNET_COMPILATIONS_007_HELP=Die Anzahl der dynamisch kompilierten Quelldateien .asax, .ascx, .ashx, .asmx oder .aspx.
+
+ASPNET_DEBUGGING_REQUESTS_007_NAME=Debug-Anforderungen
+ASPNET_DEBUGGING_REQUESTS_007_HELP=Die Anzahl der Debug-Anforderungen, die verarbeitet wurden.
+
+ASPNET_ERRORS_PRE_PROCESSING_007_NAME=Fehler bei der Vorverarbeitung
+ASPNET_ERRORS_PRE_PROCESSING_007_HELP=Die Anzahl der Fehler, die beim Analysieren und Konfigurieren aufgetreten sind.
+
+ASPNET_ERRORS_COMPILING_007_NAME=Fehler bei der Kompilierung
+ASPNET_ERRORS_COMPILING_007_HELP=Die Anzahl der Fehler, die beim Kompilieren aufgetreten sind.
+
+ASPNET_ERRORS_DURING_REQUEST_007_NAME=Fehler beim Ausführen
+ASPNET_ERRORS_DURING_REQUEST_007_HELP=Die Anzahl der Fehler, die beim Verarbeiten einer Anforderung aufgetreten sind.
+
+ASPNET_ERRORS_UNHANDLED_007_NAME=Unbehandelte Fehler beim Ausführen
+ASPNET_ERRORS_UNHANDLED_007_HELP=Die Anzahl der Fehler, die nicht vom Benutzercode verarbeitet wurden, sondern vom Standardfehlerhandler.
+
+ASPNET_ERRORS_UNHANDLED_RATE_007_NAME=Unbehandelte Fehler während der Ausführung pro Sekunde
+ASPNET_ERRORS_UNHANDLED_RATE_007_HELP=Rate der unbehandelten Fehler.
+
+ASPNET_ERRORS_TOTAL_007_NAME=Fehler gesamt
+ASPNET_ERRORS_TOTAL_007_HELP=Anzahl der aufgetretenen Fehler.
+
+ASPNET_ERRORS_TOTAL_RATE_007_NAME=Fehler gesamt/Sek.
+ASPNET_ERRORS_TOTAL_RATE_007_HELP=Rate der aufgetretenen Fehler.
+
+ASPNET_PIPELINES_007_NAME=Pipeline-Instanzenzahl
+ASPNET_PIPELINES_007_HELP=Die Anzahl der aktiven Pipelineinstanzen.
+
+ASPNET_REQUEST_BYTES_IN_007_NAME=Anforderungsbytes gesamt (einschließl.)
+ASPNET_REQUEST_BYTES_IN_007_HELP=Die Gesamtgröße aller Anforderungen in Bytes.
+
+ASPNET_REQUEST_BYTES_OUT_007_NAME=Anforderungsbytes gesamt (ausschließl.)
+ASPNET_REQUEST_BYTES_OUT_007_HELP=Die Gesamtgröße aller Antworten in Bytes, die an einen Client gesendet wurden, wobei standardmäßige HTTP-Antwortheader ausgeschlossen werden.
+
+ASPNET_REQUESTS_EXECUTING_007_NAME=Ausgeführte Anforderungen
+ASPNET_REQUESTS_EXECUTING_007_HELP=Die Anzahl der Anforderungen, die momentan ausgeführt werden.
+
+ASPNET_REQUESTS_FAILED_007_NAME=Fehlgeschlagene Anforderungen
+ASPNET_REQUESTS_FAILED_007_HELP=Die Gesamtszahl der fehlgeschlagenen Anforderungen.
+
+ASPNET_REQUESTS_NOT_FOUND_007_NAME=Nicht gefundene Anforderungen
+ASPNET_REQUESTS_NOT_FOUND_007_HELP=Die Anzahl der Anforderungen für Ressourcen, die nicht gefunden wurden.
+
+ASPNET_REQUESTS_NOT_AUTHORIZED_007_NAME=Nicht berechtigte Anforderungen
+ASPNET_REQUESTS_NOT_AUTHORIZED_007_HELP=Die Anzahl der Anforderungen, die wegen mangelnder Zugriffsberechtigung fehlgeschlagen sind.
+
+ASPNET_REQUESTS_TIMED_OUT_007_NAME=Anforderungen mit Zeitüberschreitung
+ASPNET_REQUESTS_TIMED_OUT_007_HELP=Die Anzahl der Anforderungen, deren mit Zeitlimit überschritten wurde.
+
+ASPNET_REQUESTS_SUCCEDED_007_NAME=Erfolgreiche Anforderungen
+ASPNET_REQUESTS_SUCCEDED_007_HELP=Die Anzahl der Anforderungen, die erfolgreich ausgeführt wurden.
+
+ASPNET_REQUESTS_TOTAL_007_NAME=Anforderungen gesamt
+ASPNET_REQUESTS_TOTAL_007_HELP=Die Gesamtszahl der Anforderungen seit die Anwendung gestartet wurde.
+
+ASPNET_REQUESTS_TOTAL_RATE_007_NAME=Anforderungen/Sek.
+ASPNET_REQUESTS_TOTAL_RATE_007_HELP=Die Anzahl der Anforderungen, die pro Sekunde ausgeführt werden.
+
+ASPNET_SESSIONS_ACTIVE_007_NAME=Aktive Sitzungen
+ASPNET_SESSIONS_ACTIVE_007_HELP=Die Anzahl der Sitzungen, die momentan aktive sind.
+
+ASPNET_SESSIONS_ABANDONED_007_NAME=Abgebrochene Sitzungen
+ASPNET_SESSIONS_ABANDONED_007_HELP=Die Anzahl der Sitzungen, die explizit abgebrochen wurden.
+
+ASPNET_SESSIONS_TIMED_OUT_007_NAME=Sitzungen mit Zeitüberschreitung
+ASPNET_SESSIONS_TIMED_OUT_007_HELP=Anzahl der Sitzungen mit Zeitüberschreitung
+
+ASPNET_SESSIONS_TOTAL_007_NAME=Sitzungen gesamt
+ASPNET_SESSIONS_TOTAL_007_HELP=Gesamtanzahl der Sitzungen seit die Anwendung gestartet wurde.
+
+ASPNET_TRANSACTIONS_ABORTED_007_NAME=Abgebrochene Transaktionen
+ASPNET_TRANSACTIONS_ABORTED_007_HELP=Die Anzahl der abgebrochenen Transaktionen.
+
+ASPNET_TRANSACTIONS_COMMITTED_007_NAME=Übermittelte Transaktionen
+ASPNET_TRANSACTIONS_COMMITTED_007_HELP=Die Anzahl der Transaktionen, für die ein Commit ausgeführt wurde.
+
+ASPNET_TRANSACTIONS_PENDING_007_NAME=Ausstehende Transaktionen
+ASPNET_TRANSACTIONS_PENDING_007_HELP=Die Anzahl der Transaktionen, die sich Bearbeitung befinden.
+
+ASPNET_TRANSACTIONS_TOTAL_007_NAME=Transaktionen gesamt
+ASPNET_TRANSACTIONS_TOTAL_007_HELP=Die Gesamtanzahl der Transaktionen seit die Anwendung gestartet wurde.
+
+ASPNET_TRANSACTIONS_RATE_007_NAME=Transaktionen/Sek
+ASPNET_TRANSACTIONS_RATE_007_HELP=Die Anzahl der Transaktionen, die pro Sekunde gestartet werden.
+
diff --git a/src/inc/1041/CORPerfMonSymbols.ini b/src/inc/1041/CORPerfMonSymbols.ini
new file mode 100644
index 0000000000..b982b2db39
--- /dev/null
+++ b/src/inc/1041/CORPerfMonSymbols.ini
@@ -0,0 +1,577 @@
+; 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.
+
+//------------------------------------------------------------------------
+// WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
+//
+// AUTO GENERATED FILE. DO NOT EDIT. USE $/com99/src/profile/perfmonhelp
+//
+// WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING WARNING
+//------------------------------------------------------------------------
+
+// CORPerfMonSymbols.ini file
+[info]
+drivername=.NETFramework
+symbolfile=CORPerfMonSymbols.h
+
+[languages]
+009=English
+011=Japanese
+; 001=Arabic
+; 004=Chinese
+; 007=German
+; 00D=Hebrew
+; 011=Japanese
+; 012=Korean
+; 00A=Spanish
+; 00C=French
+; 010=Italian
+
+[objects]
+DotNetCLR_Memory_OBJECT_009_NAME=.NET CLR Memory
+DotNetCLR_Loading_OBJECT_009_NAME=.NET CLR Loading
+DotNetCLR_Jit_OBJECT_009_NAME=.NET CLR Jit
+DotNetCLR_Interop_OBJECT_009_NAME=.NET CLR Interop
+DotNetCLR_LocksAndThreads_OBJECT_009_NAME=.NET CLR LocksAndThreads
+DotNetCLR_Security_OBJECT_009_NAME=.NET CLR Security
+DotNetCLR_Remoting_OBJECT_009_NAME=.NET CLR Remoting
+DotNetCLR_Excep_OBJECT_009_NAME=.NET CLR Exceptions
+DotNetCLR_Memory_OBJECT_011_NAME=.NET CLR Memory
+DotNetCLR_Loading_OBJECT_011_NAME=.NET CLR Loading
+DotNetCLR_Jit_OBJECT_011_NAME=.NET CLR Jit
+DotNetCLR_Interop_OBJECT_011_NAME=.NET CLR Interop
+DotNetCLR_LocksAndThreads_OBJECT_011_NAME=.NET CLR LocksAndThreads
+DotNetCLR_Security_OBJECT_011_NAME=.NET CLR Security
+DotNetCLR_Remoting_OBJECT_011_NAME=.NET CLR Remoting
+DotNetCLR_Excep_OBJECT_011_NAME=.NET CLR Exceptions
+
+[text]
+DotNetCLR_Memory_OBJECT_009_NAME=.NET CLR Memory
+DotNetCLR_Memory_OBJECT_009_HELP=Counters for CLR Garbage Collected heap.
+
+GEN0_COLLECTIONS_COUNTER_009_NAME=# Gen 0 Collections
+GEN0_COLLECTIONS_COUNTER_009_HELP=This counter displays the number of times the generation 0 objects (youngest; most recently allocated) are garbage collected (Gen 0 GC) since the start of the application. Gen 0 GC occurs when the available memory in generation 0 is not sufficient to satisfy an allocation request. This counter is incremented at the end of a Gen 0 GC. Higher generation GCs include all lower generation GCs. This counter is explicitly incremented when a higher generation (Gen 1 or Gen 2) GC occurs. _Global_ counter value is not accurate and should be ignored. This counter displays the last observed value.
+
+GEN1_COLLECTIONS_COUNTER_009_NAME=# Gen 1 Collections
+GEN1_COLLECTIONS_COUNTER_009_HELP=This counter displays the number of times the generation 1 objects are garbage collected since the start of the application. The counter is incremented at the end of a Gen 1 GC. Higher generation GCs include all lower generation GCs. This counter is explicitly incremented when a higher generation (Gen 2) GC occurs. _Global_ counter value is not accurate and should be ignored. This counter displays the last observed value.
+
+GEN2_COLLECTIONS_COUNTER_009_NAME=# Gen 2 Collections
+GEN2_COLLECTIONS_COUNTER_009_HELP=This counter displays the number of times the generation 2 objects (older) are garbage collected since the start of the application. The counter is incremented at the end of a Gen 2 GC (also called full GC). _Global_ counter value is not accurate and should be ignored. This counter displays the last observed value.
+
+GEN0_BYTES_PROMOTED_COUNTER_009_NAME=Promoted Memory from Gen 0
+GEN0_BYTES_PROMOTED_COUNTER_009_HELP=This counter displays the bytes of memory that survive garbage collection (GC) and are promoted from generation 0 to generation 1; objects that are promoted just because they are waiting to be finalized are not included in this counter. This counter displays the value observed at the end of the last GC; its not a cumulative counter.
+
+GEN1_BYTES_PROMOTED_COUNTER_009_NAME=Promoted Memory from Gen 1
+GEN1_BYTES_PROMOTED_COUNTER_009_HELP=This counter displays the bytes of memory that survive garbage collection (GC) and are promoted from generation 1 to generation 2; objects that are promoted just because they are waiting to be finalized are not included in this counter. This counter displays the value observed at the end of the last GC; its not a cumulative counter. This counter is reset to 0 if the last GC was a Gen 0 GC only.
+
+GEN0_PROMOTION_RATE_009_NAME=Gen 0 Promoted Bytes/Sec
+GEN0_PROMOTION_RATE_009_HELP=This counter displays the bytes per second that are promoted from generation 0 (youngest) to generation 1; objects that are promoted just because they are waiting to be finalized are not included in this counter. Memory is promoted when it survives a garbage collection. This counter was designed as an indicator of relatively long-lived objects being created per sec. This counter displays the difference between the values observed in the last two samples divided by the duration of the sample interval.
+
+GEN1_PROMOTION_RATE_009_NAME=Gen 1 Promoted Bytes/Sec
+GEN1_PROMOTION_RATE_009_HELP=This counter displays the bytes per second that are promoted from generation 1 to generation 2 (oldest); objects that are promoted just because they are waiting to be finalized are not included in this counter. Memory is promoted when it survives a garbage collection. Nothing is promoted from generation 2 since it is the oldest. This counter was designed as an indicator of very long-lived objects being created per sec. This counter displays the difference between the values observed in the last two samples divided by the duration of the sample interval.
+
+GEN0_FINALIZATION_BYTES_PROMOTED_COUNTER_009_NAME=Promoted Finalization-Memory from Gen 0
+GEN0_FINALIZATION_BYTES_PROMOTED_COUNTER_009_HELP=This counter displays the bytes of memory that are promoted from generation 0 to generation 1 just because they are waiting to be finalized. This counter displays the value observed at the end of the last GC; its not a cumulative counter.
+
+GEN1_FINALIZATION_BYTES_PROMOTED_COUNTER_009_NAME=Promoted Finalization-Memory from Gen 1
+GEN1_FINALIZATION_BYTES_PROMOTED_COUNTER_009_HELP=This counter displays the bytes of memory that are promoted from generation 1 to generation 2 just because they are waiting to be finalized. This counter displays the value observed at the end of the last GC; its not a cumulative counter. This counter is reset to 0 if the last GC was a Gen 0 GC only.
+
+GEN0_HEAP_SIZE_COUNTER_009_NAME=Gen 0 heap size
+GEN0_HEAP_SIZE_COUNTER_009_HELP=This counter displays the maximum bytes that can be allocated in generation 0 (Gen 0); its does not indicate the current number of bytes allocated in Gen 0. A Gen 0 GC is triggered when the allocations since the last GC exceed this size. The Gen 0 size is tuned by the Garbage Collector and can change during the execution of the application. At the end of a Gen 0 collection the size of the Gen 0 heap is infact 0 bytes; this counter displays the size (in bytes) of allocations that would trigger the next Gen 0 GC. This counter is updated at the end of a GC; its not updated on every allocation.
+
+GEN1_HEAP_SIZE_COUNTER_009_NAME=Gen 1 heap size
+GEN1_HEAP_SIZE_COUNTER_009_HELP=This counter displays the current number of bytes in generation 1 (Gen 1); this counter does not display the maximum size of Gen 1. Objects are not directly allocated in this generation; they are promoted from previous Gen 0 GCs. This counter is updated at the end of a GC; its not updated on every allocation.
+
+GEN2_HEAP_SIZE_COUNTER_009_NAME=Gen 2 heap size
+GEN2_HEAP_SIZE_COUNTER_009_HELP=This counter displays the current number of bytes in generation 2 (Gen 2). Objects are not directly allocated in this generation; they are promoted from Gen 1 during previous Gen 1 GCs. This counter is updated at the end of a GC; its not updated on every allocation.
+
+LARGE_OBJECT_SIZE_COUNTER_009_NAME=Large Object Heap size
+LARGE_OBJECT_SIZE_COUNTER_009_HELP=This counter displays the current size of the Large Object Heap in bytes. Objects greater than 20 KBytes are treated as large objects by the Garbage Collector and are directly allocated in a special heap; they are not promoted through the generations. This counter is updated at the end of a GC; its not updated on every allocation.
+
+SURVIVE_FINALIZE_COUNTER_009_NAME=Finalization Survivors
+SURVIVE_FINALIZE_COUNTER_009_HELP=This counter displays the number of garbage collected objects that survive a collection because they are waiting to be finalized. If these objects hold references to other objects then those objects also survive but are not counted by this counter; the "Promoted Finalization-Memory from Gen 0" and "Promoted Finalization-Memory from Gen 1" counters represent all the memory that survived due to finalization. This counter is not a cumulative counter; its updated at the end of every GC with count of the survivors during that particular GC only. This counter was designed to indicate the extra overhead that the application might incur because of finalization.
+
+NUM_HANDLES_COUNTER_009_NAME=# GC Handles
+NUM_HANDLES_COUNTER_009_HELP=This counter displays the current number of GC Handles in use. GCHandles are handles to resources external to the CLR and the managed environment. Handles occupy small amounts of memory in the GCHeap but potentially expensive unmanaged resources.
+
+ALLOCATION_RATE_COUNTER_009_NAME=Allocated Bytes/sec
+ALLOCATION_RATE_COUNTER_009_HELP=This counter displays the rate of bytes per second allocated on the GC Heap. This counter is updated at the end of every GC; not at each allocation. This counter is not an average over time; it displays the difference between the values observed in the last two samples divided by the duration of the sample interval.
+
+INDUCED_GC_COUNTER_009_NAME=# Induced GC
+INDUCED_GC_COUNTER_009_HELP=This counter displays the peak number of times a garbage collection was performed because of an explicit call to GC.Collect. Its a good practice to let the GC tune the frequency of its collections.
+
+PER_TIME_IN_GC_COUNTER_009_NAME=% Time in GC
+PER_TIME_IN_GC_COUNTER_009_HELP=% Time in GC is the percentage of elapsed time that was spent in performing a garbage collection (GC) since the last GC cycle. This counter is usually an indicator of the work done by the Garbage Collector on behalf of the application to collect and compact memory. This counter is updated only at the end of every GC and the counter value reflects the last observed value; its not an average.
+
+PER_TIME_IN_GC_COUNTER_BASE_009_NAME=Not Displayed
+PER_TIME_IN_GC_COUNTER_BASE_009_HELP=Not Displayed.
+
+TOTAL_HEAP_SIZE_COUNTER_009_NAME=# Bytes in all Heaps
+TOTAL_HEAP_SIZE_COUNTER_009_HELP=This counter is the sum of four other counters; Gen 0 Heap Size; Gen 1 Heap Size; Gen 2 Heap Size and the Large Object Heap Size. This counter indicates the current memory allocated in bytes on the GC Heaps.
+
+TOTAL_COMMITTED_MEM_COUNTER_009_NAME=# Total committed Bytes
+TOTAL_COMMITTED_MEM_COUNTER_009_HELP=This counter displays the amount of virtual memory (in bytes) currently committed by the Garbage Collector. (Committed memory is the physical memory for which space has been reserved on the disk paging file).
+
+TOTAL_RESERVED_MEM_COUNTER_009_NAME=# Total reserved Bytes
+TOTAL_RESERVED_MEM_COUNTER_009_HELP=This counter displays the amount of virtual memory (in bytes) currently reserved by the Garbage Collector. (Reserved memory is the virtual memory space reserved for the application but no disk or main memory pages have been used.)
+
+GC_PINNED_OBJECTS_009_NAME=# of Pinned Objects
+GC_PINNED_OBJECTS_009_HELP=This counter displays the number of pinned objects encountered in the last GC. This counter tracks the pinned objects only in the heaps that were garbage collected e.g. a Gen 0 GC would cause enumeration of pinned objects in the generation 0 heap only. A pinned object is one that the Garbage Collector cannot move in memory.
+
+GC_SINKBLOCKS_009_NAME=# of Sink Blocks in use
+GC_SINKBLOCKS_009_HELP=This counter displays the current number of sync blocks in use. Sync blocks are per-object data structures allocated for storing synchronization information. Sync blocks hold weak references to managed objects and need to be scanned by the Garbage Collector. Sync blocks are not limited to storing synchronization information and can also store COM interop metadata. This counter was designed to indicate performance problems with heavy use of synchronization primitives.
+
+DotNetCLR_Loading_OBJECT_009_NAME=.NET CLR Loading
+DotNetCLR_Loading_OBJECT_009_HELP=Statistics for CLR Class Loader.
+
+LOADING_CLASSES_TOTAL_009_NAME=Total Classes Loaded
+LOADING_CLASSES_TOTAL_009_HELP=This counter displays the cumulative number of classes loaded in all Assemblies since the start of this application.
+
+LOADING_TIME_009_NAME=% Time Loading
+LOADING_TIME_009_HELP=Reserved for future use.
+
+LOADING_ASMSEARCHLEN_009_NAME=Assembly Search Length
+LOADING_ASMSEARCHLEN_009_HELP=Reserved for future use.
+
+LOADING_LOADFAILURES_TOTAL_009_NAME=Total # of Load Failures
+LOADING_LOADFAILURES_TOTAL_009_HELP=This counter displays the peak number of classes that have failed to load since the start of the application. These load failures could be due to many reasons like inadequate security or illegal format. Full details can be found in the profiling services help.
+
+LOADING_LOADFAILURES_INST_009_NAME=Rate of Load Failures
+LOADING_LOADFAILURES_INST_009_HELP=This counter displays the number of classes that failed to load per second. This counter is not an average over time; it displays the difference between the values observed in the last two samples divided by the duration of the sample interval. These load failures could be due to many reasons like inadequate security or illegal format. Full details can be found in the profiling services help.
+
+LOADING_HEAPSIZE_009_NAME=Bytes in Loader Heap
+LOADING_HEAPSIZE_009_HELP=This counter displays the current size (in bytes) of the memory committed by the class loader across all AppDomains. (Committed memory is the physical memory for which space has been reserved on the disk paging file.)
+
+LOADING_APPDOMAINS_UNLOADED_TOTAL_009_NAME=Total appdomains unloaded
+LOADING_APPDOMAINS_UNLOADED_TOTAL_009_HELP=This counter displays the total number of AppDomains unloaded since the start of the application. If an AppDomain is loaded and unloaded multiple times this counter would count each of those unloads as separate.
+
+LOADING_APPDOMAINS_UNLOADED_INST_009_NAME=Rate of appdomains unloaded
+LOADING_APPDOMAINS_UNLOADED_INST_009_HELP=This counter displays the number of AppDomains unloaded per second. This counter is not an average over time; it displays the difference between the values observed in the last two samples divided by the duration of the sample interval.
+
+LOADING_CLASSES_CUR_009_NAME=Current Classes Loaded
+LOADING_CLASSES_CUR_009_HELP=This counter displays the current number of classes loaded in all Assemblies.
+
+LOADING_CLASSES_INST_009_NAME=Rate of Classes Loaded
+LOADING_CLASSES_INST_009_HELP=This counter displays the number of classes loaded per second in all Assemblies. This counter is not an average over time; it displays the difference between the values observed in the last two samples divided by the duration of the sample interval.
+
+LOADING_APPDOMAINS_CUR_009_NAME=Current appdomains
+LOADING_APPDOMAINS_CUR_009_HELP=This counter displays the current number of AppDomains loaded in this application. AppDomains (application domains) provide a secure and versatile unit of processing that the CLR can use to provide isolation between applications running in the same process.
+
+LOADING_APPDOMAINS_TOTAL_009_NAME=Total Appdomains
+LOADING_APPDOMAINS_TOTAL_009_HELP=This counter displays the peak number of AppDomains loaded since the start of this application. AppDomains (application domains) provide a secure and versatile unit of processing that the CLR can use to provide isolation between applications running in the same process.
+
+LOADING_APPDOMAINS_INST_009_NAME=Rate of appdomains
+LOADING_APPDOMAINS_INST_009_HELP=This counter displays the number of AppDomains loaded per second. AppDomains (application domains) provide a secure and versatile unit of processing that the CLR can use to provide isolation between applications running in the same process. This counter is not an average over time; it displays the difference between the values observed in the last two samples divided by the duration of the sample interval.
+
+LOADING_ASSEMBLIES_CUR_009_NAME=Current Assemblies
+LOADING_ASSEMBLIES_CUR_009_HELP=This counter displays the current number of Assemblies loaded across all AppDomains in this application. If the Assembly is loaded as domain-neutral from multiple AppDomains then this counter is incremented once only. Assemblies can be loaded as domain-neutral when their code can be shared by all AppDomains or they can be loaded as domain-specific when their code is private to the AppDomain.
+
+LOADING_ASSEMBLIES_TOTAL_009_NAME=Total Assemblies
+LOADING_ASSEMBLIES_TOTAL_009_HELP=This counter displays the total number of Assemblies loaded since the start of this application. If the Assembly is loaded as domain-neutral from multiple AppDomains then this counter is incremented once only. Assemblies can be loaded as domain-neutral when their code can be shared by all AppDomains or they can be loaded as domain-specific when their code is private to the AppDomain.
+
+LOADING_ASSEMBLIES_INST_009_NAME=Rate of Assemblies
+LOADING_ASSEMBLIES_INST_009_HELP=This counter displays the number of Assemblies loaded across all AppDomains per second. If the Assembly is loaded as domain-neutral from multiple AppDomains then this counter is incremented once only. Assemblies can be loaded as domain-neutral when their code can be shared by all AppDomains or they can be loaded as domain-specific when their code is private to the AppDomain. This counter is not an average over time; it displays the difference between the values observed in the last two samples divided by the duration of the sample interval.
+
+DotNetCLR_Jit_OBJECT_009_NAME=.NET CLR Jit
+DotNetCLR_Jit_OBJECT_009_HELP=Stats for CLR Jit.
+
+TOTAL_METHODS_JITTED_009_NAME=# of Methods Jitted
+TOTAL_METHODS_JITTED_009_HELP=This counter displays the total number of methods compiled Just-In-Time (JIT) by the CLR JIT compiler since the start of the application. This counter does not include the pre-jitted methods.
+
+JITTED_IL_CUR_009_NAME=# of IL Bytes Jitted
+JITTED_IL_CUR_009_HELP=This counter displays the total IL bytes jitted since the start of the application. This counter is exactly equivalent to the "Total # of IL Bytes Jitted" counter.
+
+JITTED_IL_TOTAL_009_NAME=Total # of IL Bytes Jitted
+JITTED_IL_TOTAL_009_HELP=This counter displays the total IL bytes jitted since the start of the application. This counter is exactly equivalent to the "# of IL Bytes Jitted" counter.
+
+JITTED_IL_INST_009_NAME=IL Bytes Jitted / sec
+JITTED_IL_INST_009_HELP=This counter displays the rate at which IL bytes are jitted per second. This counter is not an average over time; it displays the difference between the values observed in the last two samples divided by the duration of the sample interval.
+
+JIT_FAILURES_009_NAME=Standard Jit Failures
+JIT_FAILURES_009_HELP=This counter displays the peak number of methods the JIT compiler has failed to JIT since the start of the application. This failure can occur if the IL cannot be verified or if there was an internal error in the JIT compiler.
+
+TIME_IN_JIT_009_NAME=% Time in Jit
+TIME_IN_JIT_009_HELP=This counter displays the percentage of elapsed time spent in JIT compilation since the last JIT compilation phase. This counter is updated at the end of every JIT compilation phase. A JIT compilation phase is the phase when a method and its dependencies are being compiled.
+
+TIME_IN_JIT_BASE_009_NAME=Not Displayed
+TIME_IN_JIT_BASE_009_HELP=Not Displayed.
+
+DotNetCLR_Interop_OBJECT_009_NAME=.NET CLR Interop
+DotNetCLR_Interop_OBJECT_009_HELP=Stats for CLR interop.
+
+CURRENT_CCW_009_NAME=# of CCWs
+CURRENT_CCW_009_HELP=This counter displays the current number of Com-Callable-Wrappers (CCWs). A CCW is a proxy for the .NET managed object being referenced from unmanaged COM client(s). This counter was designed to indicate the number of managed objects being referenced by unmanaged COM code.
+
+CURRENT_STUBS_009_NAME=# of Stubs
+CURRENT_STUBS_009_HELP=This counter displays the current number of stubs created by the CLR. Stubs are responsible for marshalling arguments and return values from managed to unmanaged code and vice versa; during a COM Interop call or PInvoke call.
+
+NUM_MARSHALLING_009_NAME=# of marshalling
+NUM_MARSHALLING_009_HELP=This counter displays the total number of times arguments and return values have been marshaled from managed to unmanaged code and vice versa since the start of the application. This counter is not incremented if the stubs are inlined. (Stubs are responsible for marshalling arguments and return values). Stubs usually get inlined if the marshalling overhead is small.
+
+TOTAL_TLB_IMPORTS_009_NAME=# of TLB imports / sec
+TOTAL_TLB_IMPORTS_009_HELP=Reserved for future use.
+
+TOTAL_TLB_EXPORTS_009_NAME=# of TLB exports / sec
+TOTAL_TLB_EXPORTS_009_HELP=Reserved for future use.
+
+DotNetCLR_LocksAndThreads_OBJECT_009_NAME=.NET CLR LocksAndThreads
+DotNetCLR_LocksAndThreads_OBJECT_009_HELP=Stats for CLR Locks and Threads.
+
+CONTENTION_TOTAL_009_NAME=Total # of Contentions
+CONTENTION_TOTAL_009_HELP=This counter displays the total number of times threads in the CLR have attempted to acquire a managed lock unsuccessfully. Managed locks can be acquired in many ways; by the "lock" statement in C# or by calling System.Monitor.Enter or by using MethodImplOptions.Synchronized custom attribute.
+
+CONTENTION_INST_009_NAME=Contention Rate / sec
+CONTENTION_INST_009_HELP=Rate at which threads in the runtime attempt to acquire a managed lock unsuccessfully. Managed locks can be acquired in many ways; by the "lock" statement in C# or by calling System.Monitor.Enter or by using MethodImplOptions.Synchronized custom attribute.
+
+QUEUE_LENGTH_CUR_009_NAME=Current Queue Length
+QUEUE_LENGTH_CUR_009_HELP=This counter displays the total number of threads currently waiting to acquire some managed lock in the application. This counter is not an average over time; it displays the last observed value.
+
+QUEUE_LENGTH_TOTAL_009_NAME=Queue Length Peak
+QUEUE_LENGTH_TOTAL_009_HELP=This counter displays the total number of threads that waited to acquire some managed lock since the start of the application.
+
+QUEUE_LENGTH_INST_009_NAME=Queue Length / sec
+QUEUE_LENGTH_INST_009_HELP=This counter displays the number of threads per second waiting to acquire some lock in the application. This counter is not an average over time; it displays the difference between the values observed in the last two samples divided by the duration of the sample interval.
+
+CURRENT_LOGICAL_THREADS_009_NAME=# of current logical Threads
+CURRENT_LOGICAL_THREADS_009_HELP=This counter displays the number of current .NET thread objects in the application. A .NET thread object is created either by new System.Threading.Thread or when an unmanaged thread enters the managed environment. This counters maintains the count of both running and stopped threads. This counter is not an average over time; it just displays the last observed value.
+
+CURRENT_PHYSICAL_THREADS_009_NAME=# of current physical Threads
+CURRENT_PHYSICAL_THREADS_009_HELP=This counter displays the number of native OS threads created and owned by the CLR to act as underlying threads for .NET thread objects. This counters value does not include the threads used by the CLR in its internal operations; it is a subset of the threads in the OS process.
+
+RECOGNIZED_THREADS_CUR_009_NAME=# of current recognized threads
+RECOGNIZED_THREADS_CUR_009_HELP=This counter displays the number of threads that are currently recognized by the CLR; they have a corresponding .NET thread object associated with them. These threads are not created by the CLR; they are created outside the CLR but have since run inside the CLR at least once. Only unique threads are tracked; threads with same thread ID re-entering the CLR or recreated after thread exit are not counted twice.
+
+RECOGNIZED_THREADS_TOTAL_009_NAME=# of total recognized threads
+RECOGNIZED_THREADS_TOTAL_009_HELP=This counter displays the total number of threads that have been recognized by the CLR since the start of this application; these threads have a corresponding .NET thread object associated with them. These threads are not created by the CLR; they are created outside the CLR but have since run inside the CLR at least once. Only unique threads are tracked; threads with same thread ID re-entering the CLR or recreated after thread exit are not counted twice.
+
+RECOGNIZED_THREADS_INST_009_NAME=rate of recognized threads / sec
+RECOGNIZED_THREADS_INST_009_HELP=This counter displays the number of threads per second that have been recognized by the CLR; these threads have a corresponding .NET thread object associated with them. These threads are not created by the CLR; they are created outside the CLR but have since run inside the CLR at least once. Only unique threads are tracked; threads with same thread ID re-entering the CLR or recreated after thread exit are not counted twice. This counter is not an average over time; it displays the difference between the values observed in the last two samples divided by the duration of the sample interval.
+
+DotNetCLR_Security_OBJECT_009_NAME=.NET CLR Security
+DotNetCLR_Security_OBJECT_009_HELP=Stats for CLR Security.
+
+SECURITY_TOTALRTCHECKS_009_NAME=Total Runtime Checks
+SECURITY_TOTALRTCHECKS_009_HELP=This counter displays the total number of runtime Code Access Security (CAS) checks performed since the start of the application. Runtime CAS checks are performed when a caller makes a call to a callee demanding a particular permission; the runtime check is made on every call by the caller; the check is done by examining the current thread stack of the caller. This counter used together with "Stack Walk Depth" is indicative of performance penalty for security checks.
+
+SECURITY_TIMEAUTHORIZE_009_NAME=% Time Sig. Authenticating
+SECURITY_TIMEAUTHORIZE_009_HELP=Reserved for future use.
+
+SECURITY_LINKCHECKS_009_NAME=# Link Time Checks
+SECURITY_LINKCHECKS_009_HELP=This counter displays the total number of linktime Code Access Security (CAS) checks since the start of the application. Linktime CAS checks are performed when a caller makes a call to a callee demanding a particular permission at JIT compile time; linktime check is performed once per caller. This count is not indicative of serious performance issues; its indicative of the security system activity.
+
+SECURITY_TIMERTCHECKS_009_NAME=% Time in RT checks
+SECURITY_TIMERTCHECKS_009_HELP=This counter displays the percentage of elapsed time spent in performing runtime Code Access Security (CAS) checks since the last such check. CAS allows code to be trusted to varying degrees and enforces these varying levels of trust depending on code identity. This counter is updated at the end of a runtime security check; it represents the last observed value; its not an average.
+
+SECURITY_TIMERTCHECKS_BASE_009_NAME=Not Displayed
+SECURITY_TIMERTCHECKS_BASE_009_HELP=Not Displayed.
+
+SECURITY_DEPTHSECURITY_009_NAME=Stack Walk Depth
+SECURITY_DEPTHSECURITY_009_HELP=This counter displays the depth of the stack during that last runtime Code Access Security check. Runtime Code Access Security check is performed by crawling the stack. This counter is not an average; it just displays the last observed value.
+
+DotNetCLR_Remoting_OBJECT_009_NAME=.NET CLR Remoting
+DotNetCLR_Remoting_OBJECT_009_HELP=Stats for CLR Remoting.
+
+CONTEXT_REMOTECALLS_INST_009_NAME=Remote Calls/sec
+CONTEXT_REMOTECALLS_INST_009_HELP=This counter displays the number of remote procedure calls invoked per second. A remote procedure call is a call on any object outside the caller;s AppDomain. This counter is not an average over time; it displays the difference between the values observed in the last two samples divided by the duration of the sample interval.
+
+CONTEXT_CHANNELS_009_NAME=Channels
+CONTEXT_CHANNELS_009_HELP=This counter displays the total number of remoting channels registered across all AppDomains since the start of the application. Channels are used to transport messages to and from remote objects.
+
+CONTEXT_PROXIES_009_NAME=Context Proxies
+CONTEXT_PROXIES_009_HELP=This counter displays the total number of remoting proxy objects created in this process since the start of the process. Proxy object acts as a representative of the remote objects and ensures that all calls made on the proxy are forwarded to the correct remote object instance.
+
+CONTEXT_CLASSES_009_NAME=Context-Bound Classes Loaded
+CONTEXT_CLASSES_009_HELP=This counter displays the current number of context-bound classes loaded. Classes that can be bound to a context are called context-bound classes; context-bound classes are marked with Context Attributes which provide usage rules for synchronization; thread affinity; transactions etc.
+
+CONTEXT_OBJALLOC_009_NAME=Context-Bound Objects Alloc / sec
+CONTEXT_OBJALLOC_009_HELP=This counter displays the number of context-bound objects allocated per second. Instances of classes that can be bound to a context are called context-bound objects; context-bound classes are marked with Context Attributes which provide usage rules for synchronization; thread affinity; transactions etc. This counter is not an average over time; it displays the difference between the values observed in the last two samples divided by the duration of the sample interval.
+
+CONTEXT_CONTEXTS_009_NAME=Contexts
+CONTEXT_CONTEXTS_009_HELP=This counter displays the current number of remoting contexts in the application. A context is a boundary containing a collection of objects with the same usage rules like synchronization; thread affinity; transactions etc.
+
+CONTEXT_REMOTECALLS_TOTAL_009_NAME=Total Remote Calls
+CONTEXT_REMOTECALLS_TOTAL_009_HELP=This counter displays the total number of remote procedure calls invoked since the start of this application. A remote procedure call is a call on any object outside the caller;s AppDomain.
+
+DotNetCLR_Excep_OBJECT_009_NAME=.NET CLR Exceptions
+DotNetCLR_Excep_OBJECT_009_HELP=Runtime statistics on CLR exception handling.
+
+EXCEP_THROWN_TOTAL_009_NAME=# of Exceps Thrown
+EXCEP_THROWN_TOTAL_009_HELP=This counter displays the total number of exceptions thrown since the start of the application. These include both .NET exceptions and unmanaged exceptions that get converted into .NET exceptions e.g. null pointer reference exception in unmanaged code would get re-thrown in managed code as a .NET System.NullReferenceException; this counter includes both handled and unhandled exceptions. Exceptions that are re-thrown would get counted again. Exceptions should only occur in rare situations and not in the normal control flow of the program.
+
+EXCEP_THROWN_INST_009_NAME=# of Exceps Thrown / sec
+EXCEP_THROWN_INST_009_HELP=This counter displays the number of exceptions thrown per second. These include both .NET exceptions and unmanaged exceptions that get converted into .NET exceptions e.g. null pointer reference exception in unmanaged code would get re-thrown in managed code as a .NET System.NullReferenceException; this counter includes both handled and unhandled exceptions. Exceptions should only occur in rare situations and not in the normal control flow of the program; this counter was designed as an indicator of potential performance problems due to large (>100s) rate of exceptions thrown. This counter is not an average over time; it displays the difference between the values observed in the last two samples divided by the duration of the sample interval.
+
+TOTAL_EXCEP_FILTERS_RUN_009_NAME=# of Filters / sec
+TOTAL_EXCEP_FILTERS_RUN_009_HELP=This counter displays the number of .NET exception filters executed per second. An exception filter evaluates whether an exception should be handled or not. This counter tracks the rate of exception filters evaluated; irrespective of whether the exception was handled or not. This counter is not an average over time; it displays the difference between the values observed in the last two samples divided by the duration of the sample interval.
+
+TOTAL_EXCEP_FINALLYS_RUN_009_NAME=# of Finallys / sec
+TOTAL_EXCEP_FINALLYS_RUN_009_HELP=This counter displays the number of finally blocks executed per second. A finally block is guaranteed to be executed regardless of how the try block was exited. Only the finally blocks that are executed for an exception are counted; finally blocks on normal code paths are not counted by this counter. This counter is not an average over time; it displays the difference between the values observed in the last two samples divided by the duration of the sample interval.
+
+EXCEPT_STACK_DEPTH_009_NAME=Throw To Catch Depth / sec
+EXCEPT_STACK_DEPTH_009_HELP=This counter displays the number of stack frames traversed from the frame that threw the .NET exception to the frame that handled the exception per second. This counter resets to 0 when an exception handler is entered; so nested exceptions would show the handler to handler stack depth. This counter is not an average over time; it displays the difference between the values observed in the last two samples divided by the duration of the sample interval.
+
+DotNetCLR_Memory_OBJECT_011_NAME=.NET CLR Memory
+DotNetCLR_Memory_OBJECT_011_HELP=CLR ƒKƒx[ƒW ƒRƒŒƒNƒVƒ‡ƒ“ ƒq[ƒv‚̃JƒEƒ“ƒ^‚Å‚·B
+
+GEN0_COLLECTIONS_COUNTER_011_NAME=# Gen 0 Collections
+GEN0_COLLECTIONS_COUNTER_011_HELP=‚±‚̃JƒEƒ“ƒ^‚ÍAƒAƒvƒŠƒP[ƒVƒ‡ƒ“‚ªŠJŽn‚³‚ê‚ĈȗˆA¶¬ 0 ƒIƒuƒWƒFƒNƒg (ÅV‚ÌŠ„‚è“–‚Ăňê”ÔV‚µ‚¢) ‚ªAƒKƒx[ƒW ƒRƒŒƒNƒVƒ‡ƒ“ (Gen 0 GC) ‚³‚ꂽ‰ñ”‚ð•\Ž¦‚µ‚Ü‚·BGen 0 GC ‚ÍA¶¬ 0 ‚Ì—˜—p‰Â”\‚ȃƒ‚ƒŠ‚ªAŠ„‚è“–‚Ä—v‹‚ð\•ª–ž‚½‚¹‚È‚¢‚Æ‚«‚É”­¶‚µ‚Ü‚·B‚±‚̃JƒEƒ“ƒ^‚Í Gen 0 GC ‚ÌÅŒã‚ɃCƒ“ƒNƒŠƒƒ“ƒg‚³‚ê‚Ü‚·BV‚µ‚¢¶¬‚Ì GC ‚͌¢¶¬‚Ì GC ‚ð‚·‚×‚ÄŠÜ‚Ý‚Ü‚·B‚±‚̃JƒEƒ“ƒ^‚ÍAV‚µ‚¢¶¬ (Gen 1 ‚Ü‚½‚Í Gen 2) ‚Ì GC ‚ª”­¶‚·‚é‚Æ‚«‚É–¾Ž¦“I‚ɃCƒ“ƒNƒŠƒƒ“ƒg‚³‚ê‚Ü‚·B_Global_ counter ‚Ì’l‚ͳŠm‚Å‚Í‚È‚¢‚Ì‚Å–³Ž‹‚·‚é‚ׂ«‚Å‚·B‚±‚̃JƒEƒ“ƒ^‚ÍÅV‚Ì’l‚ð•\Ž¦‚µ‚Ü‚·B
+
+GEN1_COLLECTIONS_COUNTER_011_NAME=# Gen 1 Collections
+GEN1_COLLECTIONS_COUNTER_011_HELP=‚±‚̃JƒEƒ“ƒ^‚ÍAƒAƒvƒŠƒP[ƒVƒ‡ƒ“‚ªŠJŽn‚³‚ê‚ĈȗˆA¶¬ 1 ƒIƒuƒWƒFƒNƒg‚ªAƒKƒx[ƒW ƒRƒŒƒNƒVƒ‡ƒ“‚³‚ꂽ‰ñ”‚ð•\Ž¦‚µ‚Ü‚·B‚±‚̃JƒEƒ“ƒ^‚Í Gen 1 GC ‚ÌÅŒã‚ɃCƒ“ƒNƒŠƒƒ“ƒg‚³‚ê‚Ü‚·BV‚µ‚¢¶¬‚Ì GC ‚͌¢¶¬‚Ì GC ‚ð‚·‚×‚ÄŠÜ‚Ý‚Ü‚·B‚±‚̃JƒEƒ“ƒ^‚ÍAV‚µ‚¢¶¬ (Gen 2) ‚Ì GC ‚ª”­¶‚·‚é‚Æ‚«‚É–¾Ž¦“I‚ɃCƒ“ƒNƒŠƒƒ“ƒg‚³‚ê‚Ü‚·B_Global_ counter ‚Ì’l‚ͳŠm‚Å‚Í‚È‚¢‚Ì‚Å–³Ž‹‚·‚é‚ׂ«‚Å‚·B‚±‚̃JƒEƒ“ƒ^‚ÍÅV‚Ì’l‚ð•\Ž¦‚µ‚Ü‚·B
+
+GEN2_COLLECTIONS_COUNTER_011_NAME=# Gen 2 Collections
+GEN2_COLLECTIONS_COUNTER_011_HELP=‚±‚̃JƒEƒ“ƒ^‚ÍAƒAƒvƒŠƒP[ƒVƒ‡ƒ“‚ªŠJŽn‚³‚ê‚ĈȗˆA¶¬ 2 ƒIƒuƒWƒFƒNƒg (‚æ‚èŒÃ‚¢) ‚ªAƒKƒx[ƒW ƒRƒŒƒNƒVƒ‡ƒ“‚³‚ꂽ‰ñ”‚ð•\Ž¦‚µ‚Ü‚·B‚±‚̃JƒEƒ“ƒ^‚Í Gen 2 GC ‚ÌÅŒã‚ɃCƒ“ƒNƒŠƒƒ“ƒg‚³‚ê‚Ü‚· (ƒtƒ‹ GC ‚Æ‚àŒÄ‚΂ê‚Ü‚·)B_Global_ counter ‚Ì’l‚ͳŠm‚Å‚Í‚È‚¢‚Ì‚Å–³Ž‹‚·‚é‚ׂ«‚Å‚·B‚±‚̃JƒEƒ“ƒ^‚ÍÅŒã‚ÉŠÏŽ@‚³‚ꂽ’l‚ð•\Ž¦‚µ‚Ü‚·B
+
+GEN0_BYTES_PROMOTED_COUNTER_011_NAME=Promoted Memory from Gen 0
+GEN0_BYTES_PROMOTED_COUNTER_011_HELP=‚±‚̃JƒEƒ“ƒ^‚ÍAƒKƒx[ƒW ƒRƒŒƒNƒVƒ‡ƒ“ (GC) ‚ð‘Ï‚¦”²‚¢‚ÄA¶¬ 0 ‚©‚綬 1 ‚ÉãˆÊ•ÏŠ·‚µ‚½ƒƒ‚ƒŠ‚̃oƒCƒg”‚ð•\Ž¦‚µ‚Ü‚·B‚±‚̃JƒEƒ“ƒ^‚É‚ÍA’P‚ÉŠ®—¹‚·‚é‚Ì‚ð‘҂‚½‚ß‚¾‚¯‚ÉãˆÊ•ÏŠ·‚µ‚½ƒIƒuƒWƒFƒNƒg‚ÍŠÜ‚Ý‚Ü‚¹‚ñB‚±‚̃JƒEƒ“ƒ^‚ÍAÅŒã‚Ì GC ‚ÌÅŒã‚ÉŠÏŽ@‚³‚ꂽ’l‚ð•\Ž¦‚µ‚Ü‚·B‚±‚ê‚Í—ÝσJƒEƒ“ƒ^‚Å‚Í‚ ‚è‚Ü‚¹‚ñB
+
+GEN1_BYTES_PROMOTED_COUNTER_011_NAME=Promoted Memory from Gen 1
+GEN1_BYTES_PROMOTED_COUNTER_011_HELP=‚±‚̃JƒEƒ“ƒ^‚ÍAƒKƒx[ƒW ƒRƒŒƒNƒVƒ‡ƒ“ (GC) ‚ð‘Ï‚¦”²‚¢‚ÄA¶¬ 1 ‚©‚綬 2 ‚ÉãˆÊ•ÏŠ·‚µ‚½ƒƒ‚ƒŠ‚̃oƒCƒg”‚ð•\Ž¦‚µ‚Ü‚·B‚±‚̃JƒEƒ“ƒ^‚ÍA’P‚ÉŠ®—¹‚·‚é‚Ì‚ð‘҂‚½‚ß‚¾‚¯‚ÉãˆÊ•ÏŠ·‚µ‚½ƒIƒuƒWƒFƒNƒg‚ÍŠÜ‚Ý‚Ü‚¹‚ñB‚±‚̃JƒEƒ“ƒ^‚ÍÅŒã‚ÉŠÏŽ@‚³‚ꂽ’l‚ð•\Ž¦‚µ‚Ü‚·B‚±‚ê‚Í—ÝσJƒEƒ“ƒ^‚Å‚Í‚ ‚è‚Ü‚¹‚ñB‚±‚̃JƒEƒ“ƒ^‚ÍAÅŒã‚Ì GC ‚ª Gen 0 GC ‚Ì‚Ý‚ÌꇂÍA0 ‚ɃŠƒZƒbƒg‚³‚ê‚Ü‚·B
+
+GEN0_PROMOTION_RATE_011_NAME=Gen 0 Promoted Bytes/Sec
+GEN0_PROMOTION_RATE_011_HELP=‚±‚̃JƒEƒ“ƒ^‚ÍA¶¬ 0 (ˆê”ÔV‚µ‚¢) ‚©‚綬 1 ‚ÉãˆÊ•ÏŠ·‚µ‚½ƒƒ‚ƒŠ‚Ì–ˆ•b‚̃oƒCƒg”‚ð•\Ž¦‚µ‚Ü‚·B‚±‚̃JƒEƒ“ƒ^‚ÍA’P‚ÉŠ®—¹‚·‚é‚Ì‚ð‘҂‚½‚ß‚¾‚¯‚ÉãˆÊ•ÏŠ·‚µ‚½ƒIƒuƒWƒFƒNƒg‚ÍŠÜ‚Ý‚Ü‚¹‚ñBƒƒ‚ƒŠ‚ÍAƒKƒx[ƒW ƒRƒŒƒNƒVƒ‡ƒ“‚ð‘Ï‚¦”²‚­‚ÆãˆÊ•ÏŠ·‚µ‚Ü‚·B‚±‚̃JƒEƒ“ƒ^‚ÍA–ˆ•b쬂³‚ê‚é”äŠr“I‚É’·‘±‚«‚·‚éƒIƒuƒWƒFƒNƒg‚ÉŠÖ‚·‚éƒCƒ“ƒfƒBƒP[ƒ^‚Æ‚µ‚ăfƒUƒCƒ“‚³‚ê‚Ü‚µ‚½B‚±‚̃JƒEƒ“ƒ^‚ÍAƒTƒ“ƒvƒ‹‚ÌŽžŠÔŠÔŠu‚Å•ª‚¯‚ç‚ꂽAÅŒã‚Ì 2 ‚ ‚̃Tƒ“ƒvƒ‹ŠÔ‚ÅŠÏŽ@‚³‚ꂽ’l‚̈Ⴂ•\Ž¦‚µ‚Ü‚·B
+
+GEN1_PROMOTION_RATE_011_NAME=Gen 1 Promoted Bytes/Sec
+GEN1_PROMOTION_RATE_011_HELP=‚±‚̃JƒEƒ“ƒ^‚ÍA¶¬ 1 ‚©‚綬 2 (ˆê”Ԍ¢) ‚Éi‚ñ‚¾ƒƒ‚ƒŠ‚Ì–ˆ•b‚̃oƒCƒg”‚ð•\Ž¦‚µ‚Ü‚·B‚±‚̃JƒEƒ“ƒ^‚ÍA’P‚ÉŠ®—¹‚·‚é‚Ì‚ð‘҂‚½‚ß‚¾‚¯‚ÉãˆÊ•ÏŠ·‚µ‚½ƒIƒuƒWƒFƒNƒg‚ÍŠÜ‚Ý‚Ü‚¹‚ñBƒƒ‚ƒŠ‚ÍAƒKƒx[ƒW ƒRƒŒƒNƒVƒ‡ƒ“‚ð‘Ï‚¦”²‚­‚ÆãˆÊ•ÏŠ·‚µ‚Ü‚·B¶¬ 2 ‚͈ê”Ԍ¢‚½‚ßA‚±‚ÌŽŸ‚Í‚ ‚è‚Ü‚¹‚ñB‚±‚̃JƒEƒ“ƒ^‚ÍA–ˆ•b쬂³‚ê‚é”ñí‚É’·‘±‚«‚·‚éƒIƒuƒWƒFƒNƒg‚ÉŠÖ‚·‚éƒCƒ“ƒfƒBƒP[ƒ^‚Æ‚µ‚ăfƒUƒCƒ“‚³‚ê‚Ü‚µ‚½B‚±‚̃JƒEƒ“ƒ^‚ÍAƒTƒ“ƒvƒ‹‚ÌŽžŠÔŠÔŠu‚Å•ª‚¯‚ç‚ꂽAÅŒã‚Ì 2 ‚ ‚̃Tƒ“ƒvƒ‹ŠÔ‚ÅŠÏŽ@‚³‚ꂽ’l‚̈Ⴂ•\Ž¦‚µ‚Ü‚·B
+
+GEN0_FINALIZATION_BYTES_PROMOTED_COUNTER_011_NAME=Promoted Finalization-Memory from Gen 0
+GEN0_FINALIZATION_BYTES_PROMOTED_COUNTER_011_HELP=‚±‚̃JƒEƒ“ƒ^‚ÍA’P‚ÉŠ®—¹‚·‚é‚Ì‚ð‘҂‚½‚ß‚¾‚¯‚ɶ¬ 0 ‚©‚綬 1 ‚ÉãˆÊ•ÏŠ·‚µ‚½ƒƒ‚ƒŠ‚Ì–ˆ•b‚̃oƒCƒg”‚ð•\Ž¦‚µ‚Ü‚·B‚±‚̃JƒEƒ“ƒ^‚ÍAÅŒã‚Ì GC ‚ÌÅŒã‚ÉŠÏŽ@‚³‚ꂽ’l‚ð•\Ž¦‚µ‚Ü‚·B‚±‚ê‚Í—ÝσJƒEƒ“ƒ^‚Å‚Í‚ ‚è‚Ü‚¹‚ñB
+
+GEN1_FINALIZATION_BYTES_PROMOTED_COUNTER_011_NAME=Promoted Finalization-Memory from Gen 1
+GEN1_FINALIZATION_BYTES_PROMOTED_COUNTER_011_HELP=‚±‚̃JƒEƒ“ƒ^‚ÍA’P‚ÉŠ®—¹‚·‚é‚Ì‚ð‘҂‚½‚ß‚¾‚¯‚ɶ¬ 1 ‚©‚綬 2 ‚ÉãˆÊ•ÏŠ·‚µ‚½ƒƒ‚ƒŠ‚Ì–ˆ•b‚̃oƒCƒg”‚ð•\Ž¦‚µ‚Ü‚·B‚±‚̃JƒEƒ“ƒ^‚ÍAÅŒã‚Ì GC ‚ÌÅŒã‚ÉŠÏŽ@‚³‚ꂽ’l‚ð•\Ž¦‚µ‚Ü‚·B‚±‚ê‚Í—ÝσJƒEƒ“ƒ^‚Å‚Í‚ ‚è‚Ü‚¹‚ñB‚±‚̃JƒEƒ“ƒ^‚ÍAÅŒã‚Ì GC ‚ª Gen 0 GC ‚Ì‚Ý‚ÌꇂÍA0 ‚ɃŠƒZƒbƒg‚³‚ê‚Ü‚·B
+
+GEN0_HEAP_SIZE_COUNTER_011_NAME=Gen 0 heap size
+GEN0_HEAP_SIZE_COUNTER_011_HELP=‚±‚̃JƒEƒ“ƒ^‚ÍA¶¬ 0 (Gen 0) ‚ÉŠ„‚è“–‚Ä‚ç‚ê‚éÅ‘å‚̃oƒCƒg”‚ð•\Ž¦‚µ‚Ü‚·B¶¬ 0 ‚ÉŠ„‚è“–‚Ä‚ç‚ꂽŒ»Ý‚̃oƒCƒg”‚ÍŽ¦‚µ‚Ü‚¹‚ñBGen 0 GC ‚ÍAÅŒã‚Ì GC ˆÈ—ˆAŠ„‚è“–‚Ä‚ª‚±‚̃TƒCƒY‚ð’´‚¦‚é‚Æ”­¶‚µ‚Ü‚·BGen 0 ƒTƒCƒY‚̓Kƒx[ƒW ƒRƒŒƒNƒ^‚É‚æ‚Á‚Ä’²®‚³‚êAƒAƒvƒŠƒP[ƒVƒ‡ƒ“‚ÌŽÀs’†‚É•ÏX‚µ‚Ü‚·BGen 0 ƒRƒŒƒNƒVƒ‡ƒ“‚ÌÅŒã‚É Gen 0 ƒq[ƒv‚̃TƒCƒY‚ÍŽÀÛ‚É 0 ƒoƒCƒg‚Å‚·B‚±‚̃JƒEƒ“ƒ^‚ÍAŽŸ‚Ì Gen 0 GC ‚ð”­¶‚³‚¹‚銄‚è“–‚ẴTƒCƒY‚ðƒoƒCƒg‚Å•\Ž¦‚µ‚Ü‚·B‚±‚̃JƒEƒ“ƒ^‚Í GC ‚ÌÅŒã‚ÉXV‚³‚ê‚Ü‚·BŠ„‚è“–‚Ä‚²‚Æ‚É‚ÍXV‚³‚ê‚Ü‚¹‚ñB
+
+GEN1_HEAP_SIZE_COUNTER_011_NAME=Gen 1 heap size
+GEN1_HEAP_SIZE_COUNTER_011_HELP=‚±‚̃JƒEƒ“ƒ^‚ÍA¶¬ 1 (Gen 1) ‚ÌŒ»Ý‚̃oƒCƒg”‚ð•\Ž¦‚µ‚Ü‚·B‚±‚̃JƒEƒ“ƒ^‚Å‚Í Gen 1 ‚ÌÅ‘åƒTƒCƒY‚ð•\Ž¦‚µ‚Ü‚¹‚ñBƒIƒuƒWƒFƒNƒg‚Í‚±‚̶¬‚Å‚Í’¼ÚŠ„‚è“–‚Ä‚ç‚ê‚Ü‚¹‚ñBƒIƒuƒWƒFƒNƒg‚Í‘O‚Ì Gen 0 GC ‚©‚çãˆÊ•ÏŠ·‚³‚ê‚Ü‚·B‚±‚̃JƒEƒ“ƒ^‚Í GC ‚ÌÅŒã‚ÉXV‚³‚ê‚Ü‚·BŠ„‚è“–‚Ä‚²‚Æ‚É‚ÍXV‚³‚ê‚Ü‚¹‚ñB
+
+GEN2_HEAP_SIZE_COUNTER_011_NAME=Gen 2 heap size
+GEN2_HEAP_SIZE_COUNTER_011_HELP=‚±‚̃JƒEƒ“ƒ^‚ÍA¶¬ 2 (Gen 2) ‚ÌŒ»Ý‚̃oƒCƒg”‚ð•\Ž¦‚µ‚Ü‚·BƒIƒuƒWƒFƒNƒg‚Í‚±‚̶¬‚Å‚Í’¼ÚŠ„‚è“–‚Ä‚ç‚ê‚Ü‚¹‚ñBƒIƒuƒWƒFƒNƒg‚Í‘O‚Ì Gen 1 GC ’†‚É Gen 1 ‚©‚çãˆÊ•ÏŠ·‚³‚ê‚Ü‚·B‚±‚̃JƒEƒ“ƒ^‚Í GC ‚ÌÅŒã‚ÉXV‚³‚ê‚Ü‚·BŠ„‚è“–‚Ä‚²‚Æ‚É‚ÍXV‚³‚ê‚Ü‚¹‚ñB
+
+LARGE_OBJECT_SIZE_COUNTER_011_NAME=Large Object Heap size
+LARGE_OBJECT_SIZE_COUNTER_011_HELP=‚±‚̃JƒEƒ“ƒ^‚ÍALarge Object Heap ‚ÌŒ»Ý‚̃TƒCƒY‚ðƒoƒCƒg”‚Å•\Ž¦‚µ‚Ü‚·B20 KBytes ‚æ‚è‘å‚«‚¢ƒIƒuƒWƒFƒNƒg‚Í Garbage Collector ‚É‚æ‚Á‚Ä large ƒIƒuƒWƒFƒNƒg‚Æ‚µ‚Ĉµ‚í‚êA“Á•Ê‚ȃq[ƒv“à‚Å’¼ÚŠ„‚è“–‚Ä‚ç‚ê‚Ü‚·B‚±‚ê‚ç‚Ͷ¬‚É‚æ‚Á‚ÄãˆÊ•ÏŠ·‚µ‚Ü‚¹‚ñB‚±‚̃JƒEƒ“ƒ^‚Í GC ‚ÌÅŒã‚ÉXV‚³‚ê‚Ü‚·BŠ„‚è“–‚Ä‚²‚Æ‚É‚ÍXV‚³‚ê‚Ü‚¹‚ñB
+
+SURVIVE_FINALIZE_COUNTER_011_NAME=Finalization Survivors
+SURVIVE_FINALIZE_COUNTER_011_HELP=‚±‚̃JƒEƒ“ƒ^‚ÍAŠ®—¹‚·‚é‚Ì‚ð‘҂‚½‚ß‚ÉAƒKƒx[ƒW ƒRƒŒƒNƒg‚ð‘Ï‚¦”²‚¢‚ăRƒŒƒNƒg‚³‚ꂽƒIƒuƒWƒFƒNƒg‚Ì”‚ð•\Ž¦‚µ‚Ü‚·B‚±‚ê‚ç‚̃IƒuƒWƒFƒNƒg‚ª‘¼‚̃IƒuƒWƒFƒNƒg‚Ö‚ÌŽQÆ‚ðŽ‚Á‚Ä‚¢‚é‚È‚ç‚ÎA‚»‚ê‚ç‚̃IƒuƒWƒFƒNƒg‚à“¯—l‚É‘Ï‚¦”²‚«‚Ü‚·‚ªA‚±‚̃JƒEƒ“ƒ^‚ł̓JƒEƒ“ƒg‚³‚ê‚Ü‚¹‚ñB"Promoted Finalization-Memory from Gen 0" ‚¨‚æ‚Ñ "Promoted Finalization-Memory from Gen 1" ƒJƒEƒ“ƒ^‚ÍAŠ®—¹‚·‚邽‚ß‚É‘Ï‚¦‚Ê‚¢‚½‚·‚ׂăƒ‚ƒŠ‚ð•\‚µ‚Ü‚·B‚±‚̃JƒEƒ“ƒ^‚Í—ÝσJƒEƒ“ƒ^‚Å‚Í‚ ‚è‚Ü‚¹‚ñB‚±‚̃JƒEƒ“ƒ^‚ÍA‚±‚Ì“Á’è‚Ì GC ŠÔ‚ɶ‚«Žc‚Á‚½ƒJƒEƒ“ƒg”‚¾‚¯‚ðŽg‚Á‚Ä GC ‚ÌÅŒã‚ÉXV‚³‚ê‚Ü‚·B‚±‚̃JƒEƒ“ƒ^‚ÍAŠ®—¹‚·‚邽‚߂ɃAƒvƒŠƒP[ƒVƒ‡ƒ“‚ª‚±‚¤‚Þ‚é’ljÁ‚̃I[ƒo[ƒwƒbƒh‚ðŽ¦‚·‚悤ƒfƒUƒCƒ“‚³‚ê‚Ü‚µ‚½B
+
+NUM_HANDLES_COUNTER_011_NAME=# GC Handles
+NUM_HANDLES_COUNTER_011_HELP=‚±‚̃JƒEƒ“ƒ^‚ÍŒ»ÝŽg—p‚³‚ê‚Ä‚¢‚é GC ƒnƒ“ƒhƒ‹‚Ì”Žš‚ð•\Ž¦‚µ‚Ü‚·B GCHandles ‚Í LR ‚ÌŠO•”‚ƃ}ƒl[ƒWŠÂ‹«‚̃Šƒ\[ƒX‚ւ̃nƒ“ƒhƒ‹‚Å‚·Bƒnƒ“ƒhƒ‹‚Í GCHeap ‚É­—ʂ̃ƒ‚ƒŠ‚ð•ÛŽ‚µ‚Ü‚·‚ªA”ï—p‚ÌŠ|‚©‚éƒAƒ“ƒ}ƒl[ƒW ƒŠƒ\[ƒX‚É‚È‚é‰Â”\«‚ª‚ ‚è‚Ü‚·B
+
+ALLOCATION_RATE_COUNTER_011_NAME=Allocated Bytes/sec
+ALLOCATION_RATE_COUNTER_011_HELP=‚±‚̃JƒEƒ“ƒ^‚Í GC ƒq[ƒv‚ÉŠ„‚è“–‚Ä‚ç‚ꂽ–ˆ•b‚̃oƒCƒg—¦‚ð•\Ž¦‚µ‚Ü‚·B‚±‚̃JƒEƒ“ƒ^‚ÍŠ„‚è“–‚Ä‚²‚Æ‚Å‚Í‚È‚­AŠe GC ‚ÌI—¹‚²‚Æ‚ÉXV‚³‚ê‚Ü‚·B‚±‚̃JƒEƒ“ƒ^‚Í‘S‘Ì‚Ì•½‹Ï‚Å‚Í‚È‚­AƒTƒ“ƒvƒ‹ŠÔŠu‚ÌŒp‘±ŽžŠÔ‚ÅŠ„‚Á‚½ÅŒã‚Ì 2 ‚‚̃Tƒ“ƒvƒ‹‚ÌŠÔ‚ÅŠÏŽ@‚³‚ꂽ’l‚̈Ⴂ‚ð•\Ž¦‚µ‚Ü‚·B
+
+INDUCED_GC_COUNTER_011_NAME=# Induced GC
+INDUCED_GC_COUNTER_011_HELP=‚±‚̃JƒEƒ“ƒ^‚Í GC.Collect ‚Ö‚Ì–¾Ž¦“I‚ȌĂÑo‚µ‚Ì‚½‚߂ɃKƒx[ƒW ƒRƒŒƒNƒVƒ‡ƒ“‚ªs‚í‚ꂽőå‚̉ñ”‚ð•\Ž¦‚µ‚Ü‚·BGC ‚ÌŽü”g”‚ðƒKƒx[ƒW ƒRƒŒƒNƒVƒ‡ƒ“‚ɇ‚킹‚Ä‚¨‚­‚Ì‚à‚æ‚¢•û–@‚Å‚·B
+
+PER_TIME_IN_GC_COUNTER_011_NAME=% Time in GC
+PER_TIME_IN_GC_COUNTER_011_HELP=GC ‚Ì % Time ‚ÍAÅŒã‚Ì GC ƒTƒCƒNƒ‹ˆÈ—ˆAƒKƒx[ƒW ƒRƒŒƒNƒVƒ‡ƒ“ (GC) ‚ðs‚¤‚½‚ß‚ÉŒo‰ß‚µ‚½ŽžŠÔ‚̃p[ƒZƒ“ƒe[ƒW‚ð•\Ž¦‚µ‚Ü‚·B‚±‚̃JƒEƒ“ƒ^‚ÍA’ÊíAƒKƒx[ƒW ƒRƒŒƒNƒVƒ‡ƒ“‚ªAƒAƒvƒŠƒP[ƒVƒ‡ƒ“‚Ì‘ã‚í‚è‚Ƀƒ‚ƒŠ‚ðŽûW‚µ‚ăRƒ“ƒpƒNƒg‰»‚ðs‚Á‚½‚Æ‚¢‚¤ƒCƒ“ƒWƒP[ƒ^‚Å‚·B‚±‚̃JƒEƒ“ƒ^‚Í–ˆ‰ñ‚Ì GC ‚ÌÅŒã‚É‚Ì‚ÝXV‚³‚ê‚Ü‚·BƒJƒEƒ“ƒ^‚Ì’l‚Í•½‹Ï’l‚Å‚Í‚È‚­AÅŒã‚ÉŠÏŽ@‚µ‚½’l‚𔽉f‚µ‚Ü‚·B
+
+PER_TIME_IN_GC_COUNTER_BASE_011_NAME=Not Displayed
+PER_TIME_IN_GC_COUNTER_BASE_011_HELP=•\Ž¦‚³‚ê‚Ä‚¢‚Ü‚¹‚ñB
+
+TOTAL_HEAP_SIZE_COUNTER_011_NAME=# Bytes in all Heaps
+TOTAL_HEAP_SIZE_COUNTER_011_HELP=‚±‚̃JƒEƒ“ƒ^‚ÍŽŸ‚Ì 4 ‚‚̃JƒEƒ“ƒ^‚̇Œv‚Å‚·BGen 0 ƒq[ƒv ƒTƒCƒYAGen 1 ƒq[ƒv ƒTƒCƒYAGen 2 ƒq[ƒv ƒTƒCƒY ‚¨‚æ‚Ñ‘å‚«‚¢ƒIƒuƒWƒFƒNƒg‚̃q[ƒv ƒTƒCƒYB‚±‚̃JƒEƒ“ƒ^‚Í GC ƒq[ƒv‚ÉŠ„‚è“–‚Ä‚ç‚ꂽŒ»Ý‚̃oƒCƒg”‚ðŽ¦‚µ‚Ü‚·B
+
+TOTAL_COMMITTED_MEM_COUNTER_011_NAME=# Total committed Bytes
+TOTAL_COMMITTED_MEM_COUNTER_011_HELP=‚±‚̃JƒEƒ“ƒ^‚ÍAŒ»ÝƒKƒx[ƒW ƒRƒŒƒNƒ^‚É‚æ‚Á‚ăRƒ~ƒbƒg‚³‚ê‚Ä‚¢‚鉼‘zƒƒ‚ƒŠ‚ðƒoƒCƒg”‚Å•\Ž¦‚µ‚Ü‚·B (ƒRƒ~ƒbƒg ƒƒ‚ƒŠ‚ÍAƒfƒBƒXƒN‚̃y[ƒWƒ“ƒO ƒtƒ@ƒCƒ‹‚ɃXƒy[ƒX‚ª—\–ñ‚³‚ê‚Ä‚¢‚镨—“I‚ȃƒ‚ƒŠ‚Å‚·)B
+
+TOTAL_RESERVED_MEM_COUNTER_011_NAME=# Total reserved Bytes
+TOTAL_RESERVED_MEM_COUNTER_011_HELP=‚±‚̃JƒEƒ“ƒ^‚ÍAŒ»ÝƒKƒx[ƒW ƒRƒŒƒNƒ^‚É‚æ‚Á‚ăRƒ~ƒbƒg‚³‚ê‚Ä‚¢‚鉼‘zƒƒ‚ƒŠ‚ðƒoƒCƒg”‚Å•\Ž¦‚µ‚Ü‚·B(—\–ñ‚³‚ꂽƒƒ‚ƒŠ‚̓AƒvƒŠƒP[ƒVƒ‡ƒ“‚É—\–ñ‚³‚ꂽ‰¼‘zƒƒ‚ƒŠ ƒXƒy[ƒX‚ÅAƒfƒBƒXƒNA‚Ü‚½‚̓ƒCƒ“ ƒƒ‚ƒŠ ƒy[ƒW‚͉½‚àŽg—p‚³‚ê‚Ä‚¢‚Ü‚¹‚ñ)B
+
+GC_PINNED_OBJECTS_011_NAME=# of Pinned Objects
+GC_PINNED_OBJECTS_011_HELP=‚±‚̃JƒEƒ“ƒ^‚ÍÅŒã‚Ì GC ‚ÅŒ©‚‚©‚Á‚½ƒsƒ“Ž~‚߃IƒuƒWƒFƒNƒg‚Ì”‚ð•\Ž¦‚µ‚Ü‚·B‚±‚̃JƒEƒ“ƒ^‚̓Kƒx[ƒW ƒRƒŒƒNƒg‚³‚ꂽƒq[ƒv‚Ì’†‚̃sƒ“Ž~‚߃IƒuƒWƒFƒNƒg‚Ìî•ñ‚Ì‚Ý‚ð‹L˜^‚µ‚Ü‚·B‚½‚Æ‚¦‚Î Gen 0 GC ‚ÍA¶¬ 0 ƒq[ƒv“à‚ł̂݃sƒ“Ž~‚߃IƒuƒWƒFƒNƒg‚Ì—ñ‹“‚𶂶‚Ü‚·BƒKƒx[ƒW ƒRƒŒƒNƒ^‚ÍAƒsƒ“Ž~‚߃IƒuƒWƒFƒNƒg‚ðƒƒ‚ƒŠ“à‚ňړ®‚·‚邱‚Æ‚Í‚Å‚«‚Ü‚¹‚ñB
+
+GC_SINKBLOCKS_011_NAME=# of Sink Blocks in use
+GC_SINKBLOCKS_011_HELP=‚±‚̃JƒEƒ“ƒ^‚ÍŒ»ÝŽg—p‚³‚ê‚Ä‚¢‚é Sync ƒuƒƒbƒN”‚ð•\Ž¦‚µ‚Ü‚·BSync ƒuƒƒbƒN‚ÍAƒXƒgƒŒ[ƒW‚Ì“¯Šúî•ñ‚É‚½‚ß‚ÉŠ„‚è“–‚Ä‚ç‚ꂽƒIƒuƒWƒFƒNƒg‚²‚Ƃ̃f[ƒ^\‘¢‚Å‚·BSync ƒuƒƒbƒN‚̓}ƒl[ƒW ƒIƒuƒWƒFƒNƒg‚ÉŽã‚¢ŽQÆ‚ð•ÛŽ‚µAƒKƒx[ƒW ƒRƒŒƒNƒ^‚É‚æ‚Á‚ăXƒLƒƒƒ“‚³‚ê‚é•K—v‚ª‚ ‚è‚Ü‚·BSync ƒuƒƒbƒN‚Í“¯Šúî•ñ‚ð•Û‘¶‚·‚邾‚¯‚ÉŒÀ‚炸ACOM ‘ŠŒÝ‰^—p‹@”\ƒƒ^ƒf[ƒ^‚à•Û‘¶‚Å‚«‚Ü‚·B‚±‚̃JƒEƒ“ƒ^‚ÍA“¯ŠúƒvƒŠƒ~ƒeƒBƒu‚ð•p”É‚ÉŽg—p‚·‚邱‚Æ‚É‚æ‚Á‚Ķ‚¶‚é–â‘è‚ðŽw“E‚·‚é‚悤‚ɃfƒUƒCƒ“‚³‚ê‚Ü‚µ‚½B
+
+DotNetCLR_Loading_OBJECT_011_NAME=.NET CLR Loading
+DotNetCLR_Loading_OBJECT_011_HELP=CLR ƒNƒ‰ƒX ƒ[ƒ_[‚Ì“Œv
+
+LOADING_CLASSES_TOTAL_011_NAME=Total Classes Loaded
+LOADING_CLASSES_TOTAL_011_HELP=‚±‚̃JƒEƒ“ƒ^‚ÍAƒAƒvƒŠƒP[ƒVƒ‡ƒ“‚ªŠJŽn‚³‚ê‚ĈȗˆA‚·‚ׂẴAƒZƒ“ƒuƒŠ‚É“Ç‚Ýž‚܂ꂽƒNƒ‰ƒX‚Ì—ÝÏ”‚ð•\Ž¦‚µ‚Ü‚·B
+
+LOADING_TIME_011_NAME=% Time Loading
+LOADING_TIME_011_HELP=«—ˆ—˜—p‚·‚邽‚ß‚É—\–ñ‚³‚ê‚Ä‚¢‚Ü‚·B
+
+LOADING_ASMSEARCHLEN_011_NAME=Assembly Search Length
+LOADING_ASMSEARCHLEN_011_HELP=«—ˆ—˜—p‚·‚邽‚ß‚É—\–ñ‚³‚ê‚Ä‚¢‚Ü‚·B
+
+LOADING_LOADFAILURES_TOTAL_011_NAME=Total # of Load Failures
+LOADING_LOADFAILURES_TOTAL_011_HELP=‚±‚̃JƒEƒ“ƒ^‚ÍAƒAƒvƒŠƒP[ƒVƒ‡ƒ“‚ªŠJŽn‚³‚ê‚ĈȗˆA“Ç‚Ýž‚Ý‚Å‚«‚È‚©‚Á‚½ƒNƒ‰ƒX‚Ìő唂ð•\Ž¦‚µ‚Ü‚·B“Ç‚Ýž‚Ý‚ÉŽ¸”s‚µ‚½——R‚ÍA\•ª‚ȃZƒLƒ…ƒŠƒeƒBA‚Ü‚½‚ÍŠÔˆá‚Á‚½ƒtƒH[ƒ}ƒbƒg‚Æ‚©A‚¢‚ë‚¢‚ël‚¦‚ç‚ê‚Ü‚·BÚׂɂ‚¢‚Ä‚ÍAƒvƒƒtƒ@ƒCƒ‹ ƒT[ƒrƒX‚̃wƒ‹ƒv‚ÅŽQÆ‚Å‚µ‚Ä‚­‚¾‚³‚¢B
+
+LOADING_LOADFAILURES_INST_011_NAME=Rate of Load Failures
+LOADING_LOADFAILURES_INST_011_HELP=‚±‚̃JƒEƒ“ƒ^‚Í“Ç‚Ýž‚Ý‚Å‚«‚È‚©‚Á‚½ƒNƒ‰ƒX‚Ì–ˆ•b‚Ì”‚ð•\Ž¦‚µ‚Ü‚·B‚±‚̃JƒEƒ“ƒ^‚Í‘S‘Ì‚Ì•½‹Ï‚Å‚Í‚È‚­AƒTƒ“ƒvƒ‹ŠÔŠu‚ÌŒp‘±ŽžŠÔ‚ÅŠ„‚Á‚½ÅŒã‚Ì 2 ‚‚̃Tƒ“ƒvƒ‹‚ÌŠÔ‚ÅŠÏŽ@‚³‚ꂽ’l‚̈Ⴂ‚ð•\Ž¦‚µ‚Ü‚·B“Ç‚Ýž‚Ý‚ÉŽ¸”s‚µ‚½——R‚ÍA\•ª‚ȃZƒLƒ…ƒŠƒeƒBA‚Ü‚½‚ÍŠÔˆá‚Á‚½ƒtƒH[ƒ}ƒbƒg‚Æ‚©A‚¢‚ë‚¢‚ël‚¦‚ç‚ê‚Ü‚·BÚׂɂ‚¢‚Ä‚ÍAƒvƒƒtƒ@ƒCƒ‹ ƒT[ƒrƒX‚̃wƒ‹ƒv‚ÅŽQÆ‚Å‚µ‚Ä‚­‚¾‚³‚¢B
+
+LOADING_HEAPSIZE_011_NAME=Bytes in Loader Heap
+LOADING_HEAPSIZE_011_HELP=‚±‚̃JƒEƒ“ƒ^‚ÍAŒ»ÝA‚·‚×‚Ä‚Ì AppDomains ‚ŃNƒ‰ƒX ƒ[ƒ_[‚É‚æ‚Á‚ăRƒ~ƒbƒg‚³‚ê‚Ä‚¢‚郃‚ƒŠ‚ðƒoƒCƒg”‚Å•\Ž¦‚µ‚Ü‚·B (ƒRƒ~ƒbƒg ƒƒ‚ƒŠ‚ÍAƒfƒBƒXƒN‚̃y[ƒWƒ“ƒO ƒtƒ@ƒCƒ‹‚ɃXƒy[ƒX‚ª—\–ñ‚³‚ê‚Ä‚¢‚镨—“I‚ȃƒ‚ƒŠ‚Å‚·)B
+
+LOADING_APPDOMAINS_UNLOADED_TOTAL_011_NAME=Total appdomains unloaded
+LOADING_APPDOMAINS_UNLOADED_TOTAL_011_HELP=‚±‚̃JƒEƒ“ƒ^‚ÍAƒAƒvƒŠƒP[ƒVƒ‡ƒ“‚ªŠJŽn‚³‚ê‚ĈȗˆAƒAƒ“ƒ[ƒh‚³‚ꂽ AppDomains ‚̇Œv”‚ð•\Ž¦‚µ‚Ü‚·B‚±‚̃JƒEƒ“ƒ^‚ÍAAppDomain ‚ª“Ç‚Ýž‚Ü‚êA‚»‚µ‚Ä•¡”‰ñƒAƒ“ƒ[ƒh‚³‚ꂽꇂÍAŠeƒAƒ“ƒ[ƒh‚ð•ÊX‚ɃJƒEƒ“ƒg‚µ‚Ü‚·B
+
+LOADING_APPDOMAINS_UNLOADED_INST_011_NAME=Rate of appdomains unloaded
+LOADING_APPDOMAINS_UNLOADED_INST_011_HELP=‚±‚̃JƒEƒ“ƒ^‚ÍAƒAƒ“ƒ[ƒh‚³‚ꂽ AppDomains ‚Ì–ˆ•b‚Ì”‚ð•\Ž¦‚µ‚Ü‚·B‚±‚̃JƒEƒ“ƒ^‚Í‘S‘Ì‚Ì•½‹Ï‚Å‚Í‚È‚­AƒTƒ“ƒvƒ‹ŠÔŠu‚ÌŒp‘±ŽžŠÔ‚ÅŠ„‚Á‚½ÅŒã‚Ì 2 ‚‚̃Tƒ“ƒvƒ‹‚ÌŠÔ‚ÅŠÏŽ@‚³‚ꂽ’l‚̈Ⴂ‚ð•\Ž¦ ‚µ‚Ü‚·B
+
+LOADING_CLASSES_CUR_011_NAME=Current Classes Loaded
+LOADING_CLASSES_CUR_011_HELP=‚±‚̃JƒEƒ“ƒ^‚Í‚·‚ׂẴAƒZƒ“ƒuƒŠ‚É“Ç‚Ýž‚܂ꂽŒ»Ý‚̃Nƒ‰ƒX”‚ð•\Ž¦‚µ‚Ü‚·B
+
+LOADING_CLASSES_INST_011_NAME=Rate of Classes Loaded
+LOADING_CLASSES_INST_011_HELP=‚±‚̃JƒEƒ“ƒ^‚Í‚·‚ׂẴAƒZƒ“ƒuƒŠ‚É“Ç‚Ýž‚܂ꂽƒNƒ‰ƒX‚Ì–ˆ•b‚Ì”‚ð•\Ž¦‚µ‚Ü‚·B‚±‚̃JƒEƒ“ƒ^‚Í‘S‘Ì‚Ì•½‹Ï‚Å‚Í‚È‚­AƒTƒ“ƒvƒ‹ŠÔŠu‚ÌŒp‘±ŽžŠÔ‚ÅŠ„‚Á‚½ÅŒã‚Ì 2 ‚‚̃Tƒ“ƒvƒ‹‚ÌŠÔ‚ÅŠÏŽ@‚³‚ꂽ’l‚̈Ⴂ‚ð•\Ž¦‚µ‚Ü‚·B
+
+LOADING_APPDOMAINS_CUR_011_NAME=Current appdomains
+LOADING_APPDOMAINS_CUR_011_HELP=‚±‚̃JƒEƒ“ƒ^‚Í‚±‚̃AƒvƒŠƒP[ƒVƒ‡ƒ“‚É“Ç‚Ýž‚܂ꂽŒ»Ý‚Ì AppDomains ”‚ð•\Ž¦‚µ‚Ü‚·BAppDomains (ƒAƒvƒŠƒP[ƒVƒ‡ƒ“ ƒhƒƒCƒ“) ‚͈À‘S‚Å‘½—p“r‚̃vƒƒZƒX ƒ†ƒjƒbƒg‚ð’ñ‹Ÿ‚µ‚Ü‚·BCLR ‚Í‚±‚ê‚ðŽg—p‚µ‚ÄA“¯‚¶ƒvƒƒZƒX“à‚ÅŽÀs‚³‚ê‚Ä‚¢‚éƒAƒvƒŠƒP[ƒVƒ‡ƒ“‚ÌŠÔ‚Ì•ª—£‚ð’ñ‹Ÿ‚·‚邱‚Æ‚ª‚Å‚«‚Ü‚·B
+
+LOADING_APPDOMAINS_TOTAL_011_NAME=Total Appdomains
+LOADING_APPDOMAINS_TOTAL_011_HELP=‚±‚̃JƒEƒ“ƒ^‚ÍAƒAƒvƒŠƒP[ƒVƒ‡ƒ“‚ªŠJŽn‚³‚ê‚ĈȗˆA“Ç‚Ýž‚܂ꂽőå‚Ì AppDomains ”‚ð•\Ž¦‚µ‚Ü‚·BAppDomains (ƒAƒvƒŠƒP[ƒVƒ‡ƒ“ ƒhƒƒCƒ“) ‚͈À‘S‚Å‘½—p“r‚̃vƒƒZƒX ƒ†ƒjƒbƒg‚ð’ñ‹Ÿ‚µ‚Ü‚·BCLR ‚Í‚±‚ê‚ðŽg—p‚µ‚ÄA“¯‚¶ƒvƒƒZƒX“à‚ÅŽÀs‚³‚ê‚Ä‚¢‚éƒAƒvƒŠƒP[ƒVƒ‡ƒ“‚ÌŠÔ‚Ì•ª—£‚ð’ñ‹Ÿ‚·‚邱‚Æ‚ª‚Å‚«‚Ü‚·B
+
+LOADING_APPDOMAINS_INST_011_NAME=Rate of appdomains
+LOADING_APPDOMAINS_INST_011_HELP=‚±‚̃JƒEƒ“ƒ^‚Í “Ç‚Ýž‚܂ꂽ AppDomains ‚Ì–ˆ•b‚Ì”‚ð•\Ž¦‚µ‚Ü‚·BAppDomains (ƒAƒvƒŠƒP[ƒVƒ‡ƒ“ ƒhƒƒCƒ“) ‚͈À‘S‚Å‘½—p“r‚̃vƒƒZƒX ƒ†ƒjƒbƒg‚ð’ñ‹Ÿ‚µ‚Ü‚·BCLR ‚Í‚±‚ê‚ðŽg—p‚µ‚ÄA“¯‚¶ƒvƒƒZƒX“à‚ÅŽÀs‚³‚ê‚Ä‚¢‚éƒAƒvƒŠƒP[ƒVƒ‡ƒ“‚ÌŠÔ‚Ì•ª—£‚ð’ñ‹Ÿ‚·‚邱‚Æ‚ª‚Å‚«‚Ü‚·B‚±‚̃JƒEƒ“ƒ^‚Í‘S‘Ì‚Ì•½‹Ï‚Å‚Í‚È‚­AƒTƒ“ƒvƒ‹ŠÔŠu‚ÌŒp‘±ŽžŠÔ‚ÅŠ„‚Á‚½ÅŒã‚Ì 2 ‚‚̃Tƒ“ƒvƒ‹‚ÌŠÔ‚ÅŠÏŽ@‚³‚ꂽ’l‚̈Ⴂ‚ð•\Ž¦‚µ‚Ü‚·B
+
+LOADING_ASSEMBLIES_CUR_011_NAME=Current Assemblies
+LOADING_ASSEMBLIES_CUR_011_HELP=‚±‚̃JƒEƒ“ƒ^‚Í‚±‚̃AƒvƒŠƒP[ƒVƒ‡ƒ“‚Ì‚·‚×‚Ä‚Ì AppDomains ‚Å“Ç‚Ýž‚܂ꂽƒAƒZƒ“ƒuƒŠ‚ÌŒ»Ý‚Ì”‚ð•\Ž¦‚µ‚Ü‚·BƒAƒZƒ“ƒuƒŠ‚ª•¡”‚Ì AppDomains ‚©‚çƒhƒƒCƒ“’†—§‚Å“Ç‚Ýž‚܂ꂽꇂÍA‚±‚̃JƒEƒ“ƒ^‚Í 1 “x‚¾‚¯ƒCƒ“ƒNƒŠƒƒ“ƒg‚³‚ê‚Ü‚·BƒAƒZƒ“ƒuƒŠ‚ÍAƒR[ƒh‚ª‚·‚×‚Ä‚Ì AppDomains ‚Å‹¤—L‚Å‚«‚éꇂÍAƒhƒƒCƒ“’†—§‚Å“Ç‚Ýž‚Ü‚ê‚Ü‚·B‚Ü‚½‚ÍAƒR[ƒh‚ª AppDomain ‚Ƀvƒ‰ƒCƒx[ƒg‚Å‚ ‚é‚Æ‚«‚ÍAƒhƒƒCƒ“ŒÅ—L‚Æ‚µ‚Ä“Ç‚Ýž‚Ü‚ê‚Ü‚·B
+
+LOADING_ASSEMBLIES_TOTAL_011_NAME=Total Assemblies
+LOADING_ASSEMBLIES_TOTAL_011_HELP=‚±‚̃JƒEƒ“ƒ^‚ÍAƒAƒvƒŠƒP[ƒVƒ‡ƒ“‚ªŠJŽn‚³‚ê‚Ĉȗˆ“Ç‚Ýž‚܂ꂽ‡Œv‚̃AƒZƒ“ƒuƒŠ”‚ð•\Ž¦‚µ‚Ü‚·BƒAƒZƒ“ƒuƒŠ‚ª•¡”‚Ì AppDomains ‚©‚çƒhƒƒCƒ“’†—§‚Å“Ç‚Ýž‚܂ꂽꇂÍA‚±‚̃JƒEƒ“ƒ^‚Í 1 “x‚¾‚¯ƒCƒ“ƒNƒŠƒƒ“ƒg‚³‚ê‚Ü‚·BƒAƒZƒ“ƒuƒŠ‚ÍAƒR[ƒh‚ª‚·‚×‚Ä‚Ì AppDomains ‚Å‹¤—L‚Å‚«‚éꇂÍAƒhƒƒCƒ“’†—§‚Å“Ç‚Ýž‚Ü‚ê‚Ü‚·B‚Ü‚½‚ÍAƒR[ƒh‚ª AppDomain ‚Ƀvƒ‰ƒCƒx[ƒg‚Å‚ ‚é‚Æ‚«‚ÍAƒhƒƒCƒ“ŒÅ—L‚Æ‚µ‚Ä“Ç‚Ýž‚Ü‚ê‚Ü‚·B
+
+LOADING_ASSEMBLIES_INST_011_NAME=Rate of Assemblies
+LOADING_ASSEMBLIES_INST_011_HELP=‚±‚̃JƒEƒ“ƒ^‚ÍA‚·‚×‚Ä‚Ì AppDomains ‚Å“Ç‚Ýž‚܂ꂽƒAƒZƒ“ƒuƒŠ‚Ì–ˆ•b‚Ì”‚ð•\Ž¦‚µ‚Ü‚·BƒAƒZƒ“ƒuƒŠ‚ª•¡”‚Ì AppDomains ‚©‚çƒhƒƒCƒ“’†—§‚Å“Ç‚Ýž‚܂ꂽꇂÍA‚±‚̃JƒEƒ“ƒ^‚Í 1 “x‚¾‚¯ƒCƒ“ƒNƒŠƒƒ“ƒg‚³‚ê‚Ü‚·BƒAƒZƒ“ƒuƒŠ‚ÍAƒR[ƒh‚ª‚·‚×‚Ä‚Ì AppDomains ‚Å‹¤—L‚Å‚«‚éꇂÍAƒhƒƒCƒ“’†—§‚Å“Ç‚Ýž‚Ü‚ê‚Ü‚·B‚Ü‚½‚ÍAƒR[ƒh‚ª AppDomain ‚Ƀvƒ‰ƒCƒx[ƒg‚Å‚ ‚é‚Æ‚«‚ÍAƒhƒƒCƒ“ŒÅ—L‚Æ‚µ‚Ä“Ç‚Ýž‚Ü‚ê‚Ü‚·B‚±‚̃JƒEƒ“ƒ^‚Í‘S‘Ì‚Ì•½‹Ï‚Å‚Í‚È‚­AƒTƒ“ƒvƒ‹ŠÔŠu‚ÌŒp‘±ŽžŠÔ‚ÅŠ„‚Á‚½ÅŒã‚Ì 2 ‚‚̃Tƒ“ƒvƒ‹‚ÌŠÔ‚ÅŠÏŽ@‚³‚ꂽ’l‚̈Ⴂ‚ð•\Ž¦‚µ‚Ü‚·B
+
+DotNetCLR_Jit_OBJECT_011_NAME=.NET CLR Jit
+DotNetCLR_Jit_OBJECT_011_HELP=CLR Jit ‚Ì“Œv‚Å‚·B
+
+TOTAL_METHODS_JITTED_011_NAME=# of Methods Jitted
+TOTAL_METHODS_JITTED_011_HELP=‚±‚̃JƒEƒ“ƒ^‚ÍAƒAƒvƒŠƒP[ƒVƒ‡ƒ“‚ªŠJŽn‚³‚ê‚Ĉȗˆ CLR JIT ƒRƒ“ƒpƒCƒ‰‚É‚æ‚Á‚Ä Just-In-Time (JIT) ‚ɃRƒ“ƒpƒCƒ‹‚³‚ꂽƒƒ\ƒbƒh‚̇Œv”‚ð•\Ž¦‚µ‚Ü‚·B
+
+JITTED_IL_CUR_011_NAME=# of IL Bytes Jitted
+JITTED_IL_CUR_011_HELP=‚±‚̃JƒEƒ“ƒ^‚ÍAƒAƒvƒŠƒP[ƒVƒ‡ƒ“‚ªŠJŽn‚³‚ê‚Ä‚©‚çŽg—p‚³‚ꂽ‡Œv‚Ì IL ƒoƒCƒg‚ð•\Ž¦‚µ‚Ü‚·B‚±‚̃JƒEƒ“ƒ^‚ÍA "Total # of IL Bytes Jitted" ƒJƒEƒ“ƒ^‚Æ‚Ü‚Á‚½‚­“¯’l‚Å‚·B
+
+JITTED_IL_TOTAL_011_NAME=Total # of IL Bytes Jitted
+JITTED_IL_TOTAL_011_HELP=‚±‚̃JƒEƒ“ƒ^‚ÍAƒAƒvƒŠƒP[ƒVƒ‡ƒ“‚ªŠJŽn‚³‚ê‚Ä‚©‚çŽg—p‚³‚ꂽ‡Œv‚Ì IL ƒoƒCƒg‚ð•\Ž¦‚µ‚Ü‚·B‚±‚̃JƒEƒ“ƒ^‚ÍA "# of IL Bytes Jitted" ƒJƒEƒ“ƒ^‚ÆŠ®‘S‚É“¯’l‚Å‚·B
+
+JITTED_IL_INST_011_NAME=IL Bytes Jitted / sec
+JITTED_IL_INST_011_HELP=‚±‚̃JƒEƒ“ƒ^‚ÍAŽg—p‚³‚ꂽ IL ƒoƒCƒg‚Ì–ˆ•b‚ÌŠ„‡‚ð•\Ž¦‚µ‚Ü‚·B‚±‚̃JƒEƒ“ƒ^‚Í‘S‘Ì‚Ì•½‹Ï‚Å‚Í‚È‚­AƒTƒ“ƒvƒ‹ŠÔŠu‚ÌŒp‘±ŽžŠÔ‚ÅŠ„‚Á‚½ÅŒã‚Ì 2 ‚‚̃Tƒ“ƒvƒ‹‚ÌŠÔ‚ÅŠÏŽ@‚³‚ꂽ’l‚̈Ⴂ‚ð•\Ž¦‚µ‚Ü‚·B
+
+JIT_FAILURES_011_NAME=Standard Jit Failures
+JIT_FAILURES_011_HELP=‚±‚̃JƒEƒ“ƒ^‚ÍAƒAƒvƒŠƒP[ƒVƒ‡ƒ“‚ªŠJŽn‚³‚ê‚Ĉȗˆ JIT ƒRƒ“ƒpƒCƒ‰‚ª JIT ‚ÉŽ¸”s‚µ‚½Å‘å‚̃ƒ\ƒbƒh”‚ð•\Ž¦‚µ‚Ü‚·BŽ¸”s‚Í IL ‚ðŒŸØ‚Å‚«‚È‚©‚Á‚½ê‡A‚Ü‚½‚Í JIT ƒRƒ“ƒpƒCƒ‰‚É“à•”ƒGƒ‰[‚ª¶‚¶‚½ê‡‚É”­¶‚µ‚Ü‚·B
+
+TIME_IN_JIT_011_NAME=% Time in Jit
+TIME_IN_JIT_011_HELP=‚±‚̃JƒEƒ“ƒ^‚ÍAÅŒã‚Ì JIT ƒRƒ“ƒpƒCƒ‹‚Ì’iŠKˆÈ—ˆA JIT ƒRƒ“ƒpƒCƒ‰‚ðs‚¤‚½‚ß‚ÉŒo‰ß‚µ‚½ŽžŠÔ‚̃p[ƒZƒ“ƒe[ƒW‚ð•\Ž¦‚µ‚Ü‚·B‚±‚̃JƒEƒ“ƒ^‚ÍA–ˆ‰ñ‚Ì JIT ƒRƒ“ƒpƒCƒ‹‚Ì’iŠK‚ÌÅŒã‚ÉXV‚³‚ê‚Ü‚·BƒJƒEƒ“ƒ^‚Ì’l‚ÍA•½‹Ï’l‚Å‚Í‚È‚­AÅŒã‚ÉŠÏŽ@‚µ‚½’l‚𔽉f‚µ‚Ü‚·BJIT ƒRƒ“ƒpƒCƒ‹‚Ì’iŠK‚ÍAƒƒ\ƒbƒh‚¨‚æ‚Ñ‚»‚̈ˑ¶ŠÖŒW‚ªƒRƒ“ƒpƒCƒ‹‚³‚ꂽ’iŠK‚ð•\‚µ‚Ü‚·B
+
+TIME_IN_JIT_BASE_011_NAME=Not Displayed
+TIME_IN_JIT_BASE_011_HELP=•\Ž¦‚³‚ê‚Ä‚¢‚Ü‚¹‚ñB
+
+DotNetCLR_Interop_OBJECT_011_NAME=.NET CLR Interop
+DotNetCLR_Interop_OBJECT_011_HELP=CLR ‘ŠŒÝ‰^—p‹@”\‚Ì“Œv‚Å‚·B
+
+CURRENT_CCW_011_NAME=# of CCWs
+CURRENT_CCW_011_HELP=‚±‚̃JƒEƒ“ƒ^‚ÍACom ŒÄ‚Ño‚µ‰Â”\ƒ‰ƒbƒp[ (CCWs) ‚ÌŒ»Ý‚Ì”‚ð•\Ž¦‚µ‚Ü‚·BCCW ‚ÍAƒAƒ“ƒ}ƒl[ƒW‚Ì COM ƒNƒ‰ƒCƒAƒ“ƒg‚©‚çŽQÆ‚³‚ê‚Ä‚¢‚é .NET ƒ}ƒl[ƒW ƒIƒuƒWƒFƒNƒg‚̃vƒƒLƒV‚Å‚·B‚±‚̃JƒEƒ“ƒ^‚ÍAƒAƒ“ƒ}ƒl[ƒW‚Ì COM ƒNƒ‰ƒCƒAƒ“ƒg‚©‚çŽQÆ‚³‚ê‚Ä‚¢‚éƒ}ƒl[ƒW ƒIƒuƒWƒFƒNƒg‚Ì”‚ðŽ¦‚·‚悤‚ɃfƒUƒCƒ“‚³‚ê‚Ü‚µ‚½B
+
+CURRENT_STUBS_011_NAME=# of Stubs
+CURRENT_STUBS_011_HELP=‚±‚̃JƒEƒ“ƒ^‚ÍACLR ‚Å쬂³‚ꂽŒ»Ý‚̃Xƒ^ƒbƒh”‚ð•\Ž¦‚µ‚Ü‚·BƒXƒ^ƒbƒh‚͈ø”‚¨‚æ‚Ñ–ß‚è’l‚ðƒ}ƒl[ƒW‚©‚çƒAƒ“ƒ}ƒl[ƒW ƒR[ƒh‚ÖA‚Ü‚½‚̓Aƒ“ƒ}ƒl[ƒW‚©‚çƒ}ƒl[ƒW ƒR[ƒh‚Öƒ}[ƒVƒƒƒŠƒ“ƒO‚·‚é–ð–Ú‚ðŽ‚Á‚Ä‚¢‚Ü‚·B‚±‚ê‚Í COM ‘ŠŒÝ‰^—p‹@”\ŒÄ‚Ño‚µA‚Ü‚½‚Í PInvoke ŒÄ‚Ño‚µ’†‚És‚í‚ê‚Ü‚·B
+
+NUM_MARSHALLING_011_NAME=# of marshalling
+NUM_MARSHALLING_011_HELP=‚±‚̃JƒEƒ“ƒ^‚ÍAƒAƒvƒŠƒP[ƒVƒ‡ƒ“‚ªŠJŽn‚³‚ê‚ĈȗˆAˆø”‚Æ–ß‚è’l‚ªƒ}ƒl[ƒW‚©‚çƒAƒ“ƒ}ƒl[ƒW ƒR[ƒh‚ÉA‚Ü‚½ƒAƒ“ƒ}ƒl[ƒW‚©‚çƒ}ƒl[ƒW ƒR[ƒh‚Ƀ}[ƒVƒƒƒŠƒ“ƒO‚³‚ꂽ‡Œv‰ñ”‚ð•\Ž¦‚µ‚Ü‚·B‚±‚̃JƒEƒ“ƒg‚̓Xƒ^ƒbƒh‚ªƒCƒ“ƒ‰ƒCƒ“‚Ìꇂ̓Cƒ“ƒNƒŠƒƒ“ƒg‚³‚ê‚Ü‚¹‚ñB (ƒXƒ^ƒbƒh‚͈ø”‚¨‚æ‚Ñ–ß‚è’l‚ðƒ}[ƒVƒƒƒŠƒ“ƒO‚·‚é–ð–Ú‚ðŽ‚Á‚Ä‚¢‚Ü‚·)BƒXƒ^ƒbƒh‚ÍAƒ}[ƒVƒƒƒŠƒ“ƒO‚̃I[ƒo[ƒwƒbƒh‚ª¬‚³‚¢ê‡‚ÍA’ÊíƒCƒ“ƒ‰ƒCƒ“‚É‚È‚è‚Ü‚·B
+
+TOTAL_TLB_IMPORTS_011_NAME=# of TLB imports / sec
+TOTAL_TLB_IMPORTS_011_HELP=«—ˆ—˜—p‚·‚邽‚ß‚É—\–ñ‚³‚ê‚Ä‚¢‚Ü‚·B
+
+TOTAL_TLB_EXPORTS_011_NAME=# of TLB exports / sec
+TOTAL_TLB_EXPORTS_011_HELP=«—ˆ—˜—p‚·‚邽‚ß‚É—\–ñ‚³‚ê‚Ä‚¢‚Ü‚·B
+
+DotNetCLR_LocksAndThreads_OBJECT_011_NAME=.NET CLR LocksAndThreads
+DotNetCLR_LocksAndThreads_OBJECT_011_HELP=CLR ƒƒbƒN‚¨‚æ‚уXƒŒƒbƒh‚Ì“Œv‚Å‚·B
+
+CONTENTION_TOTAL_011_NAME=Total # of Contentions
+CONTENTION_TOTAL_011_HELP=‚±‚̃JƒEƒ“ƒ^‚ÍACLR “à‚̃XƒŒƒbƒh‚ªƒ}ƒl[ƒW ƒƒbƒN‚ðŽæ“¾‚µ‚悤‚Æ‚µ‚ÄŽ¸”s‚µ‚½‰ñ”‚̇Œv‚ð•\Ž¦‚µ‚Ü‚·Bƒ}ƒl[ƒW ƒƒbƒN‚ðŽæ“¾‚·‚é‚É‚Í‚¢‚ë‚¢‚ë‚È•û–@‚ª‚ ‚è‚Ü‚·B‚½‚Æ‚¦‚ÎAC# “à‚Ì "lock" ƒXƒe[ƒgƒƒ“ƒg‚ðŽg—p‚·‚éASystem.Monitor.Enter ‚ðŒÄ‚Ño‚·AMethodImplOptions.Synchronized custom ‘®«‚ðŽg—p‚·‚éA‚È‚ÇB
+
+CONTENTION_INST_011_NAME=Contention Rate / sec
+CONTENTION_INST_011_HELP=ƒ‰ƒ“ƒ^ƒCƒ€‚̃XƒŒƒbƒh‚ªƒ}ƒl[ƒW ƒƒbƒN‚ðŽæ“¾‚µ‚悤‚Æ‚µ‚ÄŽ¸”s‚µ‚½Š„‡‚Å‚·Bƒ}ƒl[ƒW ƒƒbƒN‚ðŽæ“¾‚·‚é‚É‚ÍŽŸ‚̂悤‚È•û–@‚ª‚ ‚è‚Ü‚·BC# ‚Ì "lock" ƒXƒe[ƒgƒƒ“ƒg‚ðŽg—p‚·‚éASystem.Monitor.Enter ‚̌ĂÑo‚µ‚ð‚·‚éA‚Ü‚½‚Í MethodImplOptions.Synchronized ƒJƒXƒ^ƒ€‘®«‚ðŽg—p‚·‚éB
+
+QUEUE_LENGTH_CUR_011_NAME=Current Queue Length
+QUEUE_LENGTH_CUR_011_HELP=‚±‚̃JƒEƒ“ƒ^‚ÍŒ»ÝƒAƒvƒŠƒP[ƒVƒ‡ƒ“‚Ń}ƒl[ƒW ƒƒbƒN‚ðŽæ“¾‚µ‚悤‚Æ‘Ò‚Á‚Ä‚¢‚éƒXƒŒƒbƒh‚̇Œv”‚ð•\Ž¦‚µ‚Ü‚·B‚±‚̃JƒEƒ“ƒg‚Í‘S‘Ì‚Ì•½‹Ï‚Å‚Í‚È‚­AÅŒã‚ÉŠÏŽ@‚³‚ꂽ’l‚ð•\Ž¦‚µ‚Ü‚·B
+
+QUEUE_LENGTH_TOTAL_011_NAME=Queue Length Peak
+QUEUE_LENGTH_TOTAL_011_HELP=‚±‚̃JƒEƒ“ƒ^‚ÍAƒAƒvƒŠƒP[ƒVƒ‡ƒ“‚ªŠJŽn‚µ‚Ä‚©‚çAƒ}ƒl[ƒW ƒƒbƒN‚̎擾‚ð‘Ò‚Á‚Ä‚¢‚éƒXƒŒƒbƒh‚̇Œv”‚ð•\Ž¦‚µ‚Ü‚·B
+
+QUEUE_LENGTH_INST_011_NAME=Queue Length / sec
+QUEUE_LENGTH_INST_011_HELP=‚±‚̃JƒEƒ“ƒ^‚ÍAƒAƒvƒŠƒP[ƒVƒ‡ƒ“‚ŃƒbƒN‚̎擾‚ð‘Ò‚Á‚Ä‚¢‚éƒXƒŒƒbƒh‚Ì–ˆ•b‚Ì”‚ð•\Ž¦‚µ‚Ü‚·B‚±‚̃JƒEƒ“ƒ^‚Í‘S‘Ì‚Ì•½‹Ï‚Å‚Í‚È‚­AƒTƒ“ƒvƒ‹ŠÔŠu‚ÌŒp‘±ŽžŠÔ‚ÅŠ„‚Á‚½ÅŒã‚Ì 2 ‚‚̃Tƒ“ƒvƒ‹‚ÌŠÔ‚ÅŠÏŽ@‚³‚ꂽ’l‚̈Ⴂ‚ð•\Ž¦‚µ‚Ü‚·B
+
+CURRENT_LOGICAL_THREADS_011_NAME=# of current logical Threads
+CURRENT_LOGICAL_THREADS_011_HELP=‚±‚̃JƒEƒ“ƒ^‚ÍAƒAƒvƒŠƒP[ƒVƒ‡ƒ““à‚Ì .NET ƒXƒŒƒbƒh ƒIƒuƒWƒFƒNƒg‚ÌŒ»Ý‚Ì”‚ð•\Ž¦‚µ‚Ü‚·B.NET ƒXƒŒƒbƒh ƒIƒuƒWƒFƒNƒg‚ÍV‚µ‚¢ System.Threading.Thread ‚É‚æ‚Á‚Ä쬂³‚ê‚é‚©A‚Ü‚½‚̓Aƒ“ƒ}ƒl[ƒW ƒXƒŒƒbƒh‚ªƒ}ƒl[ƒWŠÂ‹«‚É“ü‚Á‚½‚Æ‚«‚É쬂³‚ê‚Ü‚·B‚±‚̃JƒEƒ“ƒ^‚ÍAŽÀs’†‚̃XƒŒƒbƒh‚¨‚æ‚Ñ’†Ž~‚µ‚½ƒXƒŒƒbƒh‚Ì—¼•û‚̃JƒEƒ“ƒg‚ðˆÛŽ‚µ‚Ü‚·BB‚±‚̃JƒEƒ“ƒg‚Í‘S‘Ì‚Ì•½‹Ï‚Å‚Í‚È‚­AÅŒã‚ÉŠÏŽ@‚³‚ꂽ’l‚ð•\Ž¦‚µ‚Ü‚·B
+
+CURRENT_PHYSICAL_THREADS_011_NAME=# of current physical Threads
+CURRENT_PHYSICAL_THREADS_011_HELP=‚±‚̃JƒEƒ“ƒ^‚ÍACLR ‚É‚æ‚Á‚Ä쬂³‚ꊗL‚³‚ê‚ÄA.NET ƒXƒŒƒbƒh ƒIƒuƒWƒFƒNƒg‚ÌŠî‚É‚È‚éƒXƒŒƒbƒh‚Æ‚µ‚Ä“®ì‚·‚éƒlƒCƒeƒBƒu‚Ì OS ƒXƒŒƒbƒh‚Ì”‚ð•\Ž¦‚µ‚Ü‚·B‚±‚̃JƒEƒ“ƒ^‚Ì’l‚ÍA“à•”‘€ì‚Å CLR ‚É‚æ‚Á‚ÄŽg—p‚³‚ê‚éƒXƒŒƒbƒh‚ðŠÜ‚Ý‚Ü‚¹‚ñBOS ƒvƒƒZƒX‚̃XƒŒƒbƒh‚̃TƒuƒZƒbƒg‚Å‚·B
+
+RECOGNIZED_THREADS_CUR_011_NAME=# of current recognized threads
+RECOGNIZED_THREADS_CUR_011_HELP=‚±‚̃JƒEƒ“ƒ^‚ÍAŒ»Ý CLR ‚É‚æ‚Á‚Ä”FŽ¯‚³‚ê‚Ä‚¢‚éƒXƒŒƒbƒh”‚ð•\Ž¦‚µ‚Ü‚·B‚±‚ê‚ç‚̃XƒŒƒbƒh‚ÍAƒXƒŒƒbƒh‚ÆŠÖ˜A•t‚¯‚ç‚ꂽˆê’v‚·‚é .NET ƒXƒŒƒbƒh ƒIƒuƒWƒFƒNƒg‚ðŽ‚Á‚Ä‚¢‚Ü‚·B‚±‚ê‚ç‚̃XƒŒƒbƒh‚Í CLR ‚É‚æ‚Á‚Ä쬂³‚ꂸACLR ‚ÌŠO•”‚Å쬂³‚ê‚Ü‚·‚ªACLR “à‚Å­‚È‚­‚Æ‚à 1 “x‚ÍŽÀs‚³‚ê‚Ä‚¢‚Ü‚·Bî•ñ‚ª‹L˜^‚³‚ê‚é‚͈̂êˆÓ‚̃XƒŒƒbƒh‚Ì‚Ý‚Å‚·B“¯‚¶ƒXƒŒƒbƒh ID ‚Å CLR ‚ÉĂъ܂܂ꂽ‚èA‚Ü‚½I—¹Œã‚ÉÄ쬂³‚ꂽƒXƒŒƒbƒh‚Í 2 “x–ڂ̓JƒEƒ“ƒg‚³‚ê‚Ü‚¹‚ñB
+
+RECOGNIZED_THREADS_TOTAL_011_NAME=# of total recognized threads
+RECOGNIZED_THREADS_TOTAL_011_HELP=‚±‚̃JƒEƒ“ƒ^‚ÍAƒAƒvƒŠƒP[ƒVƒ‡ƒ“‚ÌŠJŽnˆÈ—ˆ CLR ‚É‚æ‚Á‚Ä”FŽ¯‚³‚ꂽƒXƒŒƒbƒh‡Œv”‚ð•\Ž¦‚µ‚Ü‚·B‚±‚ê‚ç‚̃XƒŒƒbƒh‚ÍAƒXƒŒƒbƒh‚ÆŠÖ˜A•t‚¯‚ç‚ꂽˆê’v‚·‚é .NET ƒXƒŒƒbƒh ƒIƒuƒWƒFƒNƒg‚ðŽ‚Á‚Ä‚¢‚Ü‚·B‚±‚ê‚ç‚̃XƒŒƒbƒh‚Í CLR ‚É‚æ‚Á‚Ä쬂³‚ꂸACLR ‚ÌŠO•”‚Å쬂³‚ê‚Ü‚·‚ªACLR “à‚Å­‚È‚­‚Æ‚à 1 “x‚ÍŽÀs‚³‚ê‚Ä‚¢‚Ü‚·Bî•ñ‚ª‹L˜^‚³‚ê‚é‚͈̂êˆÓ‚̃XƒŒƒbƒh‚Ì‚Ý‚Å‚·B“¯‚¶ƒXƒŒƒbƒh ID ‚Å CLR ‚ÉĂъ܂܂ꂽ‚èA‚Ü‚½I—¹Œã‚ÉÄ쬂³‚ꂽƒXƒŒƒbƒh‚Í 2 “x–ڂ̓JƒEƒ“ƒg‚³‚ê‚Ü‚¹‚ñB
+
+RECOGNIZED_THREADS_INST_011_NAME=rate of recognized threads / sec
+RECOGNIZED_THREADS_INST_011_HELP=‚±‚̃JƒEƒ“ƒ^‚ÍA CLR ‚É‚æ‚Á‚Ä”FŽ¯‚³‚ꂽƒXƒŒƒbƒh‚Ì–ˆ•b‚Ì”‚ð•\Ž¦‚µ‚Ü‚·B‚±‚ê‚ç‚̃XƒŒƒbƒh‚ÍAƒXƒŒƒbƒh‚ÆŠÖ˜A•t‚¯‚ç‚ꂽˆê’v‚·‚é .NET ƒXƒŒƒbƒh ƒIƒuƒWƒFƒNƒg‚ðŽ‚Á‚Ä‚¢‚Ü‚·B‚±‚ê‚ç‚̃XƒŒƒbƒh‚Í CLR ‚É‚æ‚Á‚Ä쬂³‚ꂸACLR ‚ÌŠO•”‚Å쬂³‚ê‚Ü‚·‚ªACLR “à‚Å­‚È‚­‚Æ‚à 1 “x‚ÍŽÀs‚³‚ê‚Ä‚¢‚Ü‚·Bî•ñ‚ª‹L˜^‚³‚ê‚é‚͈̂êˆÓ‚̃XƒŒƒbƒh‚Ì‚Ý‚Å‚·B“¯‚¶ƒXƒŒƒbƒh ID ‚Å CLR ‚ÉĂъ܂܂ꂽ‚èA‚Ü‚½I—¹Œã‚ÉÄ쬂³‚ꂽƒXƒŒƒbƒh‚Í 2 “x–ڂ̓JƒEƒ“ƒg‚³‚ê‚Ü‚¹‚ñB‚±‚̃JƒEƒ“ƒ^‚Í‘S‘Ì‚Ì•½‹Ï‚Å‚Í‚È‚­AƒTƒ“ƒvƒ‹ŠÔŠu‚ÌŒp‘±ŽžŠÔ‚ÅŠ„‚Á‚½ÅŒã‚Ì 2 ‚‚̃Tƒ“ƒvƒ‹‚ÌŠÔ‚ÅŠÏŽ@‚³‚ꂽ’l‚̈Ⴂ‚ð•\Ž¦‚µ‚Ü‚·B
+
+DotNetCLR_Security_OBJECT_011_NAME=.NET CLR Security
+DotNetCLR_Security_OBJECT_011_HELP=CLR ƒZƒLƒ…ƒŠƒeƒB‚Ì“Œv‚Å‚·B
+
+SECURITY_TOTALRTCHECKS_011_NAME=Total Runtime Checks
+SECURITY_TOTALRTCHECKS_011_HELP=‚±‚̃JƒEƒ“ƒ^‚ÍAƒAƒvƒŠƒP[ƒVƒ‡ƒ“‚ÌŠJŽnˆÈ—ˆAŽÀs‚³‚ꂽƒ‰ƒ“ƒ^ƒCƒ€ Code Access Security (CAS) ƒ`ƒFƒbƒN‚̇Œv”‚ð•\Ž¦‚µ‚Ü‚·Bƒ‰ƒ“ƒ^ƒCƒ€ Code Access Security (CAS) ƒ`ƒFƒbƒN‚ÍAŒÄ‚Ño‚µŒ³‚ªŒÄ‚Ño‚µæ‚É“Á•Ê‚̃AƒNƒZƒXŒ ŒÀ‚ð—v‹‚µ‚ČĂÑo‚µ‚½‚Æ‚«‚ÉŽÀs‚³‚ê‚Ü‚·BŒÄ‚Ño‚µŒ³‚ª–ˆ‰ñŒÄ‚Ño‚·‚²‚ƂɃ‰ƒ“ƒ^ƒCƒ€ ƒ`ƒFƒbƒN‚ªŽÀs‚³‚ê‚Ü‚·B‚Ü‚½ŒÄ‚Ño‚µŒ³‚ÌŒ»Ý‚̃XƒŒƒbƒh ƒXƒ^ƒbƒN‚𒲂ׂ邱‚Æ‚É‚æ‚Á‚ă`ƒFƒbƒN‚ªŽÀs‚³‚ê‚Ü‚·B"Stack Walk Depth" ‚Æ‹¤‚ÉŽg—p‚³‚ê‚邱‚̃JƒEƒ“ƒ^‚ÍAƒZƒLƒ…ƒŠƒeƒB ƒ`ƒFƒbƒN‚̃pƒtƒH[ƒ}ƒ“ƒX ƒyƒiƒ‹ƒeƒB‚ðŽ¦‚µ‚Ü‚·B
+
+SECURITY_TIMEAUTHORIZE_011_NAME=% Time Sig. Authenticating
+SECURITY_TIMEAUTHORIZE_011_HELP=«—ˆ—˜—p‚·‚邽‚ß‚É—\–ñ‚³‚ê‚Ä‚¢‚Ü‚·B
+
+SECURITY_LINKCHECKS_011_NAME=# Link Time Checks
+SECURITY_LINKCHECKS_011_HELP=‚±‚̃JƒEƒ“ƒ^‚ÍAƒAƒvƒŠƒP[ƒVƒ‡ƒ“‚ªŠJŽn‚µ‚Ĉȗˆ‚̃Šƒ“ƒNƒ^ƒCƒ€ Code Access Security (CAS) ƒ`ƒFƒbƒN‚̇Œv”‚ð•\Ž¦‚µ‚Ü‚·BƒŠƒ“ƒNƒ^ƒCƒ€ CAS ƒ`ƒFƒbƒN‚ÍAJIT ƒRƒ“ƒpƒCƒ‹Žž‚ÉAŒÄ‚Ño‚µŒ³‚ªŒÄ‚Ño‚µæ‚É“Á•Ê‚̃AƒNƒZƒXŒ ŒÀ‚ð—v‹‚µ‚ČĂÑo‚µ‚½‚Æ‚«‚ÉŽÀs‚³‚ê‚Ü‚·BƒŠƒ“ƒNƒ^ƒCƒ€ CAS ƒ`ƒFƒbƒN‚͌ĂÑo‚µ‚²‚Æ‚É 1 “xŽÀs‚³‚ê‚Ü‚·B‚±‚̃JƒEƒ“ƒg‚Íd‘å‚ȃpƒtƒH[ƒ}ƒ“ƒX–â‘è‚ðŽ¦‚·‚à‚Ì‚Å‚Í‚È‚­AƒZƒLƒ…ƒŠƒeƒB ƒVƒXƒeƒ€‚Ì“®ì‚ðŽ¦‚·‚à‚Ì‚Å‚·B
+
+SECURITY_TIMERTCHECKS_011_NAME=% Time in RT checks
+SECURITY_TIMERTCHECKS_011_HELP=‚±‚̃JƒEƒ“ƒ^‚ÍAÅŒã‚̃`ƒFƒbƒNˆÈ—ˆAƒ‰ƒ“ƒ^ƒCƒ€ Code Access Security (CAS) ƒ`ƒFƒbƒN‚ðs‚¤‚½‚ß‚ÉŒo‰ß‚µ‚½ŽžŠÔ‚̃p[ƒZƒ“ƒe[ƒW‚ð•\Ž¦‚µ‚Ü‚·BCAS ‚̓R[ƒh‚ɈقȂé”͈͂łÌM—Š‚ð—^‚¦‚Ü‚·BƒR[ƒh‚Ì ID ‚É]‚Á‚Ä‚±‚̈قȂéM—ŠƒŒƒxƒ‹‚ð“K—p‚µ‚Ü‚·B‚±‚̃JƒEƒ“ƒ^‚̓‰ƒ“ƒ^ƒCƒ€‚̃ZƒLƒ…ƒŠƒeƒB ƒ`ƒFƒbƒN‚ÌÅŒã‚ÉXV‚³‚ê‚Ü‚·BƒJƒEƒ“ƒ^‚Ì’l‚Í•½‹Ï’l‚Å‚Í‚È‚­AÅŒã‚ÉŠÏŽ@‚µ‚½’l‚𔽉f‚µ‚Ü‚·B
+
+SECURITY_TIMERTCHECKS_BASE_011_NAME=Not Displayed
+SECURITY_TIMERTCHECKS_BASE_011_HELP=•\Ž¦‚³‚ê‚Ä‚¢‚Ü‚¹‚ñB
+
+SECURITY_DEPTHSECURITY_011_NAME=Stack Walk Depth
+SECURITY_DEPTHSECURITY_011_HELP=‚±‚̃JƒEƒ“ƒ^‚ÍÅŒã‚̃‰ƒ“ƒ^ƒCƒ€ Code Access Security ƒ`ƒFƒbƒNŽž‚̃Xƒ^ƒbƒN‚Ì[‚³‚ð•\Ž¦‚µ‚Ü‚·Bƒ‰ƒ“ƒ^ƒCƒ€ Code Access Security ƒ`ƒFƒbƒN‚̓Xƒ^ƒbƒN‚ðƒNƒ[ƒ‹‚µ‚ÄŽÀs‚³‚ê‚Ü‚·B‚±‚̃JƒEƒ“ƒg‚Í‘S‘Ì‚Ì•½‹Ï‚Å‚Í‚È‚­AÅŒã‚ÉŠÏŽ@‚³‚ꂽ’l‚ð•\Ž¦‚µ‚Ü‚·B
+
+DotNetCLR_Remoting_OBJECT_011_NAME=.NET CLR Remoting
+DotNetCLR_Remoting_OBJECT_011_HELP=CLR ƒŠƒ‚[ƒg‚Ì“Œv‚Å‚·B
+
+CONTEXT_REMOTECALLS_INST_011_NAME=Remote Calls/sec
+CONTEXT_REMOTECALLS_INST_011_HELP=‚±‚̃JƒEƒ“ƒ^‚ÍAƒŠƒ‚[ƒg ƒvƒƒV[ƒWƒƒ‚̌ĂÑo‚µ‚ª‚È‚³‚ꂽ–ˆ•b‚̉ñ”‚ð•\Ž¦‚µ‚Ü‚·BƒŠƒ‚[ƒg ƒvƒƒV[ƒWƒƒ‚̌ĂÑo‚µ‚ÍAŒÄ‚Ño‚µŒ³‚Ì AppDomain ˆÈŠO‚̃IƒuƒWƒFƒNƒg‚É‚È‚³‚ꂽŒÄ‚Ño‚µ‚·‚ׂĂðŠÜ‚Ý‚Ü‚·B‚±‚̃JƒEƒ“ƒ^‚Í‘S‘Ì‚Ì•½‹Ï‚Å‚Í‚È‚­AƒTƒ“ƒvƒ‹ŠÔŠu‚ÌŒp‘±ŽžŠÔ‚ÅŠ„‚Á‚½ÅŒã‚Ì 2 ‚‚̃Tƒ“ƒvƒ‹‚ÌŠÔ‚ÅŠÏŽ@‚³‚ꂽ’l‚̈Ⴂ‚ð•\Ž¦‚µ‚Ü‚·B
+
+CONTEXT_CHANNELS_011_NAME=Channels
+CONTEXT_CHANNELS_011_HELP=‚±‚̃JƒEƒ“ƒ^‚ÍAƒAƒvƒŠƒP[ƒVƒ‡ƒ“‚ªŠJŽn‚³‚ê‚ĈȗˆA‚·‚×‚Ä‚Ì AppDomain ‚Å“o˜^‚³‚ê‚Ä‚¢‚郊ƒ‚[ƒg ƒ`ƒƒƒ“ƒlƒ‹‚̇Œv”‚ð•\Ž¦‚µ‚Ü‚·Bƒ`ƒƒƒ“ƒlƒ‹‚̓Šƒ‚[ƒg ƒIƒuƒWƒFƒNƒgŠÔ‚ŃƒbƒZ[ƒW‚ð‘—M‚·‚é‚Ì‚ÉŽg—p‚³‚ê‚Ü‚·B
+
+CONTEXT_PROXIES_011_NAME=Context Proxies
+CONTEXT_PROXIES_011_HELP=‚±‚̃JƒEƒ“ƒ^‚ÍAƒvƒƒZƒX‚ªŠJŽn‚³‚ê‚ĈȗˆA‚±‚̃vƒƒZƒX‚Å쬂³‚ꂽƒŠƒ‚[ƒg ƒvƒƒLƒV ƒIƒuƒWƒFƒNƒg‚̇Œv”‚ð•\Ž¦‚µ‚Ü‚·BƒvƒƒLƒV ƒIƒuƒWƒFƒNƒg‚̓Šƒ‚[ƒg ƒIƒuƒWƒFƒNƒg‚ð‘ã•\‚µ‚Ä“®ì‚µAƒvƒƒLƒV‚É‚¨‚¯‚é‚·‚ׂĂ̌ĂÑo‚µ‚ÍAƒŠƒ‚[ƒg ƒIƒuƒWƒFƒNƒg ƒCƒ“ƒXƒ^ƒ“ƒX‚ɳŠm‚É“]‘—‚³‚ê‚邱‚Æ‚ðŠmŽÀ‚É‚µ‚Ü‚·B
+
+CONTEXT_CLASSES_011_NAME=Context-Bound Classes Loaded
+CONTEXT_CLASSES_011_HELP=‚±‚̃JƒEƒ“ƒ^‚ÍA“Ç‚Ýž‚܂ꂽ context-bound ƒNƒ‰ƒX‚ÌŒ»Ý”‚ð•\Ž¦‚µ‚Ü‚·BƒRƒ“ƒeƒLƒXƒg‚ÉS‘©‚·‚邱‚Æ‚Ì‚Å‚«‚éƒNƒ‰ƒX‚Í context-bound ƒNƒ‰ƒX‚ƌĂ΂ê‚Ü‚·Bcontext-bound ƒNƒ‰ƒX‚ÍA“¯ŠúAƒXƒŒƒbƒh—ÞŽ—«Aƒgƒ‰ƒ“ƒUƒNƒVƒ‡ƒ“‚È‚Ç‚Ì‚½‚ß‚ÌŽg—p‹K‘¥‚ð’ñ‹Ÿ‚·‚é Context ‘®«‚Ń}[ƒN‚³‚ê‚Ü‚·B
+
+CONTEXT_OBJALLOC_011_NAME=Context-Bound Objects Alloc / sec
+CONTEXT_OBJALLOC_011_HELP=‚±‚̃JƒEƒ“ƒ^‚ÍAcontext-bound ƒIƒuƒWƒFƒNƒg‚ªŠ„‚è“–‚Ä‚ç‚ꂽ–ˆ•b‚Ì”‚ð•\Ž¦‚µ‚Ü‚·BƒRƒ“ƒeƒLƒXƒg‚ÉS‘©‚·‚邱‚Æ‚Ì‚Å‚«‚éƒNƒ‰ƒX‚̃Cƒ“ƒXƒ^ƒ“ƒX‚Í context-bound ƒIƒuƒWƒFƒNƒg‚ƌĂ΂ê‚Ü‚·Bcontext-bound ƒNƒ‰ƒX‚ÍA“¯ŠúAƒXƒŒƒbƒh—ÞŽ—«Aƒgƒ‰ƒ“ƒUƒNƒVƒ‡ƒ“‚È‚Ç‚Ì‚½‚ß‚ÌŽg—p‹K‘¥‚ð’ñ‹Ÿ‚·‚é Context ‘®«‚Ń}[ƒN‚³‚ê‚Ü‚·B‚±‚̃JƒEƒ“ƒ^‚Í‘S‘Ì‚Ì•½‹Ï‚Å‚Í‚È‚­AƒTƒ“ƒvƒ‹ŠÔŠu‚ÌŒp‘±ŽžŠÔ‚ÅŠ„‚Á‚½ÅŒã‚Ì 2 ‚‚̃Tƒ“ƒvƒ‹‚ÌŠÔ‚ÅŠÏŽ@‚³‚ꂽ’l‚̈Ⴂ‚ð•\Ž¦‚µ‚Ü‚·B
+
+CONTEXT_CONTEXTS_011_NAME=Contexts
+CONTEXT_CONTEXTS_011_HELP=‚±‚̃JƒEƒ“ƒ^‚ÍAƒAƒvƒŠƒP[ƒVƒ‡ƒ“‚̃Šƒ‚[ƒg ƒRƒ“ƒeƒLƒXƒg‚ÌŒ»Ý‚Ì”‚ð•\Ž¦‚µ‚Ü‚·BƒRƒ“ƒeƒLƒXƒg‚ÍA“¯ŠúAƒXƒŒƒbƒh—ÞŽ—«Aƒgƒ‰ƒ“ƒUƒNƒVƒ‡ƒ“‚È‚Ç‚Æ“¯‚¶Žg—p‹K‘¥‚ðŽ‚ƒIƒuƒWƒFƒNƒg‚̃RƒŒƒNƒVƒ‡ƒ“‚ðŠÜ‚ñ‚Å‚¢‚é‹«ŠEü‚Å‚·B
+
+CONTEXT_REMOTECALLS_TOTAL_011_NAME=Total Remote Calls
+CONTEXT_REMOTECALLS_TOTAL_011_HELP=‚±‚̃JƒEƒ“ƒ^‚ÍA‚±‚̃AƒvƒŠƒP[ƒVƒ‡ƒ“‚ªŠJŽn‚³‚ê‚Ĉȗˆ‚È‚³‚ꂽƒŠƒ‚[ƒg ƒvƒƒV[ƒWƒƒ‚̌ĂÑo‚µ‚̇Œv‰ñ”‚ð•\Ž¦‚µ‚Ü‚·BƒŠƒ‚[ƒg ƒvƒƒV[ƒWƒƒ‚̌ĂÑo‚µ‚ÍAŒÄ‚Ño‚µŒ³‚Ì AppDomain ˆÈŠO‚̃IƒuƒWƒFƒNƒg‚É‚È‚³‚ꂽŒÄ‚Ño‚µ‚·‚ׂĂðŠÜ‚Ý‚Ü‚·B
+
+DotNetCLR_Excep_OBJECT_011_NAME=.NET CLR Exceptions
+DotNetCLR_Excep_OBJECT_011_HELP=CLR —áŠOˆ—‚̃‰ƒ“ƒ^ƒCƒ€“Œv‚Å‚·B
+
+EXCEP_THROWN_TOTAL_011_NAME=# of Exceps Thrown
+EXCEP_THROWN_TOTAL_011_HELP=‚±‚̃JƒEƒ“ƒ^‚ÍAƒAƒvƒŠƒP[ƒVƒ‡ƒ“‚ªŠJŽn‚³‚ê‚ĈȗˆAƒXƒ[‚³‚ꂽ—áŠO‚̇Œv”‚ð•\Ž¦‚µ‚Ü‚·B‚±‚ê‚É‚Í .NET —áŠOA‚¨‚æ‚Ñ .NET —áŠO‚É•ÏŠ·‚³‚ꂽƒAƒ“ƒ}ƒl[ƒW—áŠO‚ªŠÜ‚Ü‚ê‚Ä‚¢‚Ü‚·B‚½‚Æ‚¦‚ÎAƒAƒ“ƒ}ƒl[ƒW ƒR[ƒh‚Ì NULL ƒ|ƒCƒ“ƒ^ŽQÆ‚Ì—áŠO‚ÍA.NET System.NullReferenceException ‚Æ‚µ‚ă}ƒl[ƒW ƒR[ƒh‚ÉÄ“xƒXƒ[‚³‚ê‚Ü‚·B‚±‚̃JƒEƒ“ƒ^‚É‚ÍAƒnƒ“ƒhƒ‹‚³‚ꂽ—áŠO‚ƃnƒ“ƒhƒ‹‚³‚ê‚Ä‚¢‚È‚¢—áŠO‚Ì—¼•û‚ðŠÜ‚Ý‚Ü‚·BÄ“xƒXƒ[‚³‚ꂽ—áŠO‚ÍÄ“xƒJƒEƒ“ƒg‚³‚ê‚Ü‚·B—áŠO‚ª”­¶‚·‚é‚Ì‚Í‚Ü‚ê‚Èó‘Ô‚Å‚ ‚èA’Êí‚̃vƒƒOƒ‰ƒ€‚Ì—¬‚ê‚Ì’†‚Å‚Í‹N‚±‚é‚ׂ«‚Å‚Í‚ ‚è‚Ü‚¹‚ñB
+
+EXCEP_THROWN_INST_011_NAME=# of Exceps Thrown / sec
+EXCEP_THROWN_INST_011_HELP=‚±‚̃JƒEƒ“ƒ^‚Í—áŠO‚ªƒXƒ[‚³‚ꂽ–ˆ•b‚Ì”‚ð•\Ž¦‚µ‚Ü‚·B‚±‚ê‚É‚Í .NET —áŠOA‚¨‚æ‚Ñ .NET —áŠO‚É•ÏŠ·‚³‚ꂽƒAƒ“ƒ}ƒl[ƒW—áŠO‚ªŠÜ‚Ü‚ê‚Ä‚¢‚Ü‚·B‚½‚Æ‚¦‚ÎAƒAƒ“ƒ}ƒl[ƒW ƒR[ƒh‚Ì NULL ƒ|ƒCƒ“ƒ^ŽQÆ‚Ì—áŠO‚ÍA.NET System.NullReferenceException ‚Æ‚µ‚ă}ƒl[ƒW ƒR[ƒh‚ÉÄ“xƒXƒ[‚³‚ê‚Ü‚·B‚±‚̃JƒEƒ“ƒ^‚É‚ÍAƒnƒ“ƒhƒ‹‚³‚ꂽ—áŠO‚ƃnƒ“ƒhƒ‹‚³‚ê‚Ä‚¢‚È‚¢—áŠO‚Ì—¼•û‚ðŠÜ‚Ý‚Ü‚·BÄ“xƒXƒ[‚³‚ꂽ—áŠO‚ÍÄ“xƒJƒEƒ“ƒg‚³‚ê‚Ü‚·B—áŠO‚ª”­¶‚·‚é‚Ì‚Í‚Ü‚ê‚Èó‘Ô‚Å‚ ‚èA’Êí‚̃vƒƒOƒ‰ƒ€‚Ì—¬‚ê‚Ì’†‚Å‚Í‹N‚±‚é‚ׂ«‚Å‚Í‚ ‚è‚Ü‚¹‚ñB‚±‚̃JƒEƒ“ƒ^‚ÍAƒXƒ[‚³‚ê‚é—áŠO‚Ì”‚ª‘å‚«‚¢‚½‚ß (>100)A‹N‚±‚é‰Â”\«‚Ì‚ ‚éƒpƒtƒH[ƒ}ƒ“ƒX–â‘è‚ðŽw“E‚·‚é‚悤‚ɃfƒUƒCƒ“‚³‚ê‚Ü‚µ‚½B‚±‚̃JƒEƒ“ƒ^‚Í‘S‘Ì‚Ì•½‹Ï‚Å‚Í‚È‚­AƒTƒ“ƒvƒ‹ŠÔŠu‚ÌŒp‘±ŽžŠÔ‚ÅŠ„‚Á‚½ÅŒã‚Ì 2 ‚‚̃Tƒ“ƒvƒ‹‚ÌŠÔ‚ÅŠÏŽ@‚³‚ꂽ’l‚̈Ⴂ‚ð•\Ž¦‚µ‚Ü‚·B
+
+TOTAL_EXCEP_FILTERS_RUN_011_NAME=# of Filters / sec
+TOTAL_EXCEP_FILTERS_RUN_011_HELP=‚±‚̃JƒEƒ“ƒ^‚ÍA.NET —áŠOƒtƒBƒ‹ƒ^‚ªŽÀs‚³‚ꂽ–ˆ•b‚Ì”‚ð•\Ž¦‚µ‚Ü‚·B—áŠOƒtƒBƒ‹ƒ^‚Í—áŠO‚ªˆ—‚³‚ê‚é‚ׂ«‚©‚Ç‚¤‚©‚ð•]‰¿‚µ‚Ü‚·B‚±‚̃JƒEƒ“ƒ^‚ÍA—áŠO‚ªˆ—‚³‚ꂽ‚©‚Ç‚¤‚©‚É‚ÍŠÖŒW‚È‚­A—áŠOƒtƒBƒ‹ƒ^‚ª•]‰¿‚³‚ꂽŠ„‡‚ð‹L˜^‚µ‚Ü‚·B‚±‚̃JƒEƒ“ƒ^‚Í‘S‘Ì‚Ì•½‹Ï‚Å‚Í‚È‚­AƒTƒ“ƒvƒ‹ŠÔŠu‚ÌŒp‘±ŽžŠÔ‚ÅŠ„‚Á‚½ÅŒã‚Ì 2 ‚‚̃Tƒ“ƒvƒ‹‚ÌŠÔ‚ÅŠÏŽ@‚³‚ꂽ’l‚̈Ⴂ‚ð•\Ž¦‚µ‚Ü‚·B
+
+TOTAL_EXCEP_FINALLYS_RUN_011_NAME=# of Finallys / sec
+TOTAL_EXCEP_FINALLYS_RUN_011_HELP=‚±‚̃JƒEƒ“ƒ^‚Í finally ƒuƒƒbƒN‚ªŽÀs‚³‚ꂽ–ˆ•b‚Ì”‚ð•\Ž¦‚µ‚Ü‚·Bfinally ƒuƒƒbƒN‚ÍAtry ƒuƒƒbƒN‚ª‚ǂ̂悤‚ÉŽÀs‚³‚ꂽ‚©‚É‚ÍŠÖŒW‚È‚­•K‚¸ŽÀs‚³‚ê‚é‚悤‚É‚È‚Á‚Ä‚¢‚Ü‚·B—áŠO‚ÉŽÀs‚³‚ꂽ finally ƒuƒƒbƒN‚¾‚¯‚ªƒJƒEƒ“ƒg‚³‚ê‚Ü‚·B’Êí‚̃R[ƒh ƒpƒX‚Ì finally ƒuƒƒbƒN‚Í‚±‚̃JƒEƒ“ƒ^‚ł̓JƒEƒ“ƒg‚³‚ê‚Ü‚¹‚ñB‚±‚̃JƒEƒ“ƒ^‚Í‘S‘Ì‚Ì•½‹Ï‚Å‚Í‚È‚­AƒTƒ“ƒvƒ‹ŠÔŠu‚ÌŒp‘±ŽžŠÔ‚ÅŠ„‚Á‚½ÅŒã‚Ì 2 ‚‚̃Tƒ“ƒvƒ‹‚ÌŠÔ‚ÅŠÏŽ@‚³‚ꂽ’l‚̈Ⴂ‚ð•\Ž¦‚µ‚Ü‚·B
+
+EXCEPT_STACK_DEPTH_011_NAME=Throw To Catch Depth / sec
+EXCEPT_STACK_DEPTH_011_HELP=‚±‚̃JƒEƒ“ƒ^‚ÍA.NET —áŠO‚ð—áŠO‚ðˆ—‚·‚éƒtƒŒ[ƒ€‚ɃXƒ[‚µ‚½ƒtƒŒ[ƒ€‚©‚çˆÚ‚³‚ꂽƒXƒ^ƒbƒN ƒtƒŒ[ƒ€‚Ì–ˆ•b‚Ì”‚ð•\Ž¦‚µ‚Ü‚·B‚±‚̃JƒEƒ“ƒ^‚ÍA—áŠOƒnƒ“ƒhƒ‰‚ª“ü—Í‚³‚ê‚é‚Æ 0 ‚ɃŠƒZƒbƒg‚³‚êA“ü‚êŽq‚É‚È‚Á‚½—áŠO‚̓nƒ“ƒhƒ‰‚ɃXƒ^ƒbƒN‚Ì[‚³‚ð•\Ž¦‚µ‚Ü‚·B‚±‚̃JƒEƒ“ƒ^‚Í‘S‘Ì‚Ì•½‹Ï‚Å‚Í‚È‚­AƒTƒ“ƒvƒ‹ŠÔŠu‚ÌŒp‘±ŽžŠÔ‚ÅŠ„‚Á‚½ÅŒã‚Ì 2 ‚‚̃Tƒ“ƒvƒ‹‚ÌŠÔ‚ÅŠÏŽ@‚³‚ꂽ’l‚̈Ⴂ‚ð•\Ž¦‚µ‚Ü‚·B
+
diff --git a/src/inc/1041/_DataPerfCounters.ini b/src/inc/1041/_DataPerfCounters.ini
new file mode 100644
index 0000000000..53f94b8131
--- /dev/null
+++ b/src/inc/1041/_DataPerfCounters.ini
Binary files differ
diff --git a/src/inc/1041/_NetworkingPerfCounters.ini b/src/inc/1041/_NetworkingPerfCounters.ini
new file mode 100644
index 0000000000..d75180bf2e
--- /dev/null
+++ b/src/inc/1041/_NetworkingPerfCounters.ini
Binary files differ
diff --git a/src/inc/1041/aspnet_perf.ini b/src/inc/1041/aspnet_perf.ini
new file mode 100644
index 0000000000..9c09cc5dcd
--- /dev/null
+++ b/src/inc/1041/aspnet_perf.ini
@@ -0,0 +1,414 @@
+[info]
+drivername=ASP.NET_1.0.3430.0
+symbolfile=aspnet_perf.h
+
+[languages]
+011=Japanese
+009=English
+
+[objects]
+OBJECT_1_009_NAME=ASP.NET v1.0.3430.0
+OBJECT_2_009_NAME=ASP.NET Apps v1.0.3430.0
+
+OBJECT_1_011_NAME=ASP.NET v1.0.3430.0
+OBJECT_2_011_NAME=ASP.NET Apps v1.0.3430.0
+
+[text]
+OBJECT_1_009_NAME=ASP.NET v1.0.3430.0
+OBJECT_1_009_HELP=ASP.NET v1.0.3430.0 global performance counters
+OBJECT_2_009_NAME=ASP.NET Apps v1.0.3430.0
+OBJECT_2_009_HELP=ASP.NET v1.0.3430.0 application performance counters
+
+OBJECT_1_011_NAME=ASP.NET v1.0.3430.0
+OBJECT_1_011_HELP=ASP.NET v1.0.3430.0 ƒOƒ[ƒoƒ‹ ƒp[ƒtƒH[ƒ}ƒ“ƒX ƒJƒEƒ“ƒ^
+OBJECT_2_011_NAME=ASP.NET Apps v1.0.3430.0
+OBJECT_2_011_HELP=ASP.NET v1.0.3430.0 ƒAƒvƒŠƒP[ƒVƒ‡ƒ“ ƒp[ƒtƒH[ƒ}ƒ“ƒX ƒJƒEƒ“ƒ^
+
+;;
+;; ASP.NET System Counters
+;;
+
+ASPNET_APPLICATION_RESTARTS_009_NAME=Application Restarts
+ASPNET_APPLICATION_RESTARTS_009_HELP=Number of times the application has been restarted during the web server's lifetime.
+
+ASPNET_APPLICATIONS_RUNNING_009_NAME=Applications Running
+ASPNET_APPLICATIONS_RUNNING_009_HELP=Number of currently running web applications.
+
+ASPNET_REQUESTS_DISCONNECTED_009_NAME=Requests Disconnected
+ASPNET_REQUESTS_DISCONNECTED_009_HELP=The number of requests disconnected due to communication errors or user terminated.
+
+ASPNET_REQUEST_EXECUTION_TIME_009_NAME=Request Execution Time
+ASPNET_REQUEST_EXECUTION_TIME_009_HELP=The number of milliseconds that it took to execute the most recent request.
+
+ASPNET_REQUESTS_REJECTED_009_NAME=Requests Rejected
+ASPNET_REQUESTS_REJECTED_009_HELP=The number of requests rejected because the request queue was full.
+
+ASPNET_REQUESTS_QUEUED_009_NAME=Requests Queued
+ASPNET_REQUESTS_QUEUED_009_HELP=The number of requests waiting to be processed.
+
+ASPNET_WPS_RUNNING_009_NAME=Worker Processes Running
+ASPNET_WPS_RUNNING_009_HELP=Number of worker processes running on the machine.
+
+ASPNET_WPS_RESTARTS_009_NAME=Worker Process Restarts
+ASPNET_WPS_RESTARTS_009_HELP=Number of times a worker process has restarted on the machine.
+
+ASPNET_REQUEST_WAIT_TIME_009_NAME=Request Wait Time
+ASPNET_REQUEST_WAIT_TIME_009_HELP=The number of milliseconds the most recent request was waiting in the queue.
+
+ASPNET_STATE_SERVER_SESSIONS_ACTIVE_009_NAME=State Server Sessions Active
+ASPNET_STATE_SERVER_SESSIONS_ACTIVE_009_HELP=The current number of sessions currently active.
+
+ASPNET_STATE_SERVER_SESSIONS_ABANDONED_009_NAME=State Server Sessions Abandoned
+ASPNET_STATE_SERVER_SESSIONS_ABANDONED_009_HELP=The number of sessions that have been explicitly abandoned.
+
+ASPNET_STATE_SERVER_SESSIONS_TIMED_OUT_009_NAME=State Server Sessions Timed Out
+ASPNET_STATE_SERVER_SESSIONS_TIMED_OUT_009_HELP=The number of sessions timed out.
+
+ASPNET_STATE_SERVER_SESSIONS_TOTAL_009_NAME=State Server Sessions Total
+ASPNET_STATE_SERVER_SESSIONS_TOTAL_009_HELP=The number of sessions total.
+
+;;
+;; ASP.NET Application Counters
+;;
+
+ASPNET_ANONYMOUS_REQUESTS_009_NAME=Anonymous Requests
+ASPNET_ANONYMOUS_REQUESTS_009_HELP=Number of requests utilizing anonymous authentication.
+
+ASPNET_ANONYMOUS_REQUESTS_RATE_009_NAME=Anonymous Requests/Sec
+ASPNET_ANONYMOUS_REQUESTS_RATE_009_HELP=Number of Authentication Anonymous Requests/Sec
+
+ASPNET_TOTAL_CACHE_ENTRIES_009_NAME=Cache Total Entries
+ASPNET_TOTAL_CACHE_ENTRIES_009_HELP=Total number of entries within the cache (both internal and user added)
+
+ASPNET_TOTAL_CACHE_TURNOVER_RATE_009_NAME=Cache Total Turnover Rate
+ASPNET_TOTAL_CACHE_TURNOVER_RATE_009_HELP=Number of additions and removals to the total cache per second.
+
+ASPNET_TOTAL_CACHE_HITS_009_NAME=Cache Total Hits
+ASPNET_TOTAL_CACHE_HITS_009_HELP=Total number of hits from the cache.
+
+ASPNET_TOTAL_CACHE_MISSES_009_NAME=Cache Total Misses
+ASPNET_TOTAL_CACHE_MISSES_009_HELP=Total number of cache misses.
+
+ASPNET_TOTAL_CACHE_RATIO_009_NAME=Cache Total Hit Ratio
+ASPNET_TOTAL_CACHE_RATIO_009_HELP=Ratio of hits from all cache calls.
+
+ASPNET_TOTAL_CACHE_RATIO_BASE_009_NAME=Cache Total Hit Ratio Base
+ASPNET_TOTAL_CACHE_RATIO_BASE_009_HELP=Cache Total Hit Ratio Base
+
+ASPNET_API_CACHE_ENTRIES_009_NAME=Cache API Entries
+ASPNET_API_CACHE_ENTRIES_009_HELP=Total number of entries within the cache added by the user.
+
+ASPNET_API_CACHE_TURNOVER_RATE_009_NAME=Cache API Turnover Rate
+ASPNET_API_CACHE_TURNOVER_RATE_009_HELP=Number of additions and removals to the API cache per second.
+
+ASPNET_API_CACHE_HITS_009_NAME=Cache API Hits
+ASPNET_API_CACHE_HITS_009_HELP=Number of cache hits from user code.
+
+ASPNET_API_CACHE_MISSES_009_NAME=Cache API Misses
+ASPNET_API_CACHE_MISSES_009_HELP=Number of cache misses called from user code.
+
+ASPNET_API_CACHE_RATIO_009_NAME=Cache API Hit Ratio
+ASPNET_API_CACHE_RATIO_009_HELP=Ratio of hits called from user code.
+
+ASPNET_API_CACHE_RATIO_BASE_009_NAME=Cache API Hit Ratio Base
+ASPNET_API_CACHE_RATIO_BASE_009_HELP=Cache API Hit Ratio Base
+
+ASPNET_OUTPUT_CACHE_ENTRIES_009_NAME=Output Cache Entries
+ASPNET_OUTPUT_CACHE_ENTRIES_009_HELP=Current number of entries in the output cache.
+
+ASPNET_OUTPUT_CACHE_TURNOVER_RATE_009_NAME=Output Cache Turnover Rate
+ASPNET_OUTPUT_CACHE_TURNOVER_RATE_009_HELP=Number of additions and removals to the output cache per second.
+
+ASPNET_OUTPUT_CACHE_HITS_009_NAME=Output Cache Hits
+ASPNET_OUTPUT_CACHE_HITS_009_HELP=Total number of ouput cacheable requests served from the output cache.
+
+ASPNET_OUTPUT_CACHE_MISSES_009_NAME=Output Cache Misses
+ASPNET_OUTPUT_CACHE_MISSES_009_HELP=Total number of ouput cacheable requests not served from the output cache.
+
+ASPNET_OUTPUT_CACHE_RATIO_009_NAME=Output Cache Hit Ratio
+ASPNET_OUTPUT_CACHE_RATIO_009_HELP=Ratio of hits to requests for output cacheable requests.
+
+ASPNET_OUTPUT_CACHE_RATIO_BASE_009_NAME=Output Cache Hit Ratio Base
+ASPNET_OUTPUT_CACHE_RATIO_BASE_009_HELP=Output Cache Hit Ratio Base
+
+ASPNET_COMPILATIONS_009_NAME=Compilations Total
+ASPNET_COMPILATIONS_009_HELP=Number of .asax, .ascx, .ashx, .asmx, or .aspx source files dynamically compiled.
+
+ASPNET_DEBUGGING_REQUESTS_009_NAME=Debugging Requests
+ASPNET_DEBUGGING_REQUESTS_009_HELP=Number of debugging requests processed.
+
+ASPNET_ERRORS_PRE_PROCESSING_009_NAME=Errors During Preprocessing
+ASPNET_ERRORS_PRE_PROCESSING_009_HELP=Number of errors that have occurred during parsing and configuration.
+
+ASPNET_ERRORS_COMPILING_009_NAME=Errors During Compilation
+ASPNET_ERRORS_COMPILING_009_HELP=Number of errors that have occurred during compilation.
+
+ASPNET_ERRORS_DURING_REQUEST_009_NAME=Errors During Execution
+ASPNET_ERRORS_DURING_REQUEST_009_HELP=Number of errors that have occurred during the processing of a request.
+
+ASPNET_ERRORS_UNHANDLED_009_NAME=Errors Unhandled During Execution
+ASPNET_ERRORS_UNHANDLED_009_HELP=Number of errors not handled by user code, but by the default error handler.
+
+ASPNET_ERRORS_UNHANDLED_RATE_009_NAME=Errors Unhandled During Execution/Sec
+ASPNET_ERRORS_UNHANDLED_RATE_009_HELP=Rate of unhandled errors.
+
+ASPNET_ERRORS_TOTAL_009_NAME=Errors Total
+ASPNET_ERRORS_TOTAL_009_HELP=Total number of errors occurred.
+
+ASPNET_ERRORS_TOTAL_RATE_009_NAME=Errors Total/Sec
+ASPNET_ERRORS_TOTAL_RATE_009_HELP=Rate of errors occurred.
+
+ASPNET_PIPELINES_009_NAME=Pipeline Instance Count
+ASPNET_PIPELINES_009_HELP=Number of active pipeline instances.
+
+ASPNET_REQUEST_BYTES_IN_009_NAME=Request Bytes In Total
+ASPNET_REQUEST_BYTES_IN_009_HELP=The total size, in bytes, of all requests.
+
+ASPNET_REQUEST_BYTES_OUT_009_NAME=Request Bytes Out Total
+ASPNET_REQUEST_BYTES_OUT_009_HELP=The total size, in bytes, of responses sent to a client. This does not include standard HTTP response headers.
+
+ASPNET_REQUESTS_EXECUTING_009_NAME=Requests Executing
+ASPNET_REQUESTS_EXECUTING_009_HELP=The number of requests currently executing.
+
+ASPNET_REQUESTS_FAILED_009_NAME=Requests Failed
+ASPNET_REQUESTS_FAILED_009_HELP=Total number of failed requests.
+
+ASPNET_REQUESTS_NOT_FOUND_009_NAME=Requests Not Found
+ASPNET_REQUESTS_NOT_FOUND_009_HELP=The number of requests for resources that were not found.
+
+ASPNET_REQUESTS_NOT_AUTHORIZED_009_NAME=Requests Not Authorized
+ASPNET_REQUESTS_NOT_AUTHORIZED_009_HELP=Number of requests failed due to unauthorized access.
+
+ASPNET_REQUESTS_TIMED_OUT_009_NAME=Requests Timed Out
+ASPNET_REQUESTS_TIMED_OUT_009_HELP=The number of requests that timed out.
+
+ASPNET_REQUESTS_SUCCEDED_009_NAME=Requests Succeeded
+ASPNET_REQUESTS_SUCCEDED_009_HELP=The number of requests that executed successfully.
+
+ASPNET_REQUESTS_TOTAL_009_NAME=Requests Total
+ASPNET_REQUESTS_TOTAL_009_HELP=The total number of requests since the application was started.
+
+ASPNET_REQUESTS_TOTAL_RATE_009_NAME=Requests/Sec
+ASPNET_REQUESTS_TOTAL_RATE_009_HELP=The number of requests executed per second.
+
+ASPNET_SESSIONS_ACTIVE_009_NAME=Sessions Active
+ASPNET_SESSIONS_ACTIVE_009_HELP=The current number of sessions currently active.
+
+ASPNET_SESSIONS_ABANDONED_009_NAME=Sessions Abandoned
+ASPNET_SESSIONS_ABANDONED_009_HELP=The number of sessions that have been explicitly abandoned.
+
+ASPNET_SESSIONS_TIMED_OUT_009_NAME=Sessions Timed Out
+ASPNET_SESSIONS_TIMED_OUT_009_HELP=The number of sessions timed out.
+
+ASPNET_SESSIONS_TOTAL_009_NAME=Sessions Total
+ASPNET_SESSIONS_TOTAL_009_HELP=Total number of sessions since the application was started.
+
+ASPNET_TRANSACTIONS_ABORTED_009_NAME=Transactions Aborted
+ASPNET_TRANSACTIONS_ABORTED_009_HELP=The number of transactions aborted.
+
+ASPNET_TRANSACTIONS_COMMITTED_009_NAME=Transactions Committed
+ASPNET_TRANSACTIONS_COMMITTED_009_HELP=The number of transactions committed.
+
+ASPNET_TRANSACTIONS_PENDING_009_NAME=Transactions Pending
+ASPNET_TRANSACTIONS_PENDING_009_HELP=Number of transactions in progress.
+
+ASPNET_TRANSACTIONS_TOTAL_009_NAME=Transactions Total
+ASPNET_TRANSACTIONS_TOTAL_009_HELP=The total number of transactions since the application was started.
+
+ASPNET_TRANSACTIONS_RATE_009_NAME=Transactions/Sec
+ASPNET_TRANSACTIONS_RATE_009_HELP=Transactions started per second.
+
+;;
+;; ASP.NET System Counters
+;;
+
+ASPNET_APPLICATION_RESTARTS_011_NAME=Application Restarts
+ASPNET_APPLICATION_RESTARTS_011_HELP=Web ƒT[ƒo[‚Ì—LŒøŠúŠÔ’†‚ɃAƒvƒŠƒP[ƒVƒ‡ƒ“‚ªÄ‹N“®‚³‚ꂽ‰ñ”‚Å‚·B
+
+ASPNET_APPLICATIONS_RUNNING_011_NAME=Applications Running
+ASPNET_APPLICATIONS_RUNNING_011_HELP=Œ»ÝŽÀs’†‚Ì Web ƒAƒvƒŠƒP[ƒVƒ‡ƒ“‚Ì”‚Å‚·B
+
+ASPNET_REQUESTS_DISCONNECTED_011_NAME=Requests Disconnected
+ASPNET_REQUESTS_DISCONNECTED_011_HELP=’ÊMƒGƒ‰[‚Ü‚½‚̓†[ƒU[‘€ì‚É‚æ‚Á‚ÄØ’f‚³‚ꂽ—v‹‚Ì”‚Å‚·B
+
+ASPNET_REQUEST_EXECUTION_TIME_011_NAME=Request Execution Time
+ASPNET_REQUEST_EXECUTION_TIME_011_HELP=ÅŒã‚Ì—v‹‚ðŽÀs‚·‚é‚Ì‚É”ï‚₵‚½ƒ~ƒŠ•b”‚Å‚·B
+
+ASPNET_REQUESTS_REJECTED_011_NAME=Requests Rejected
+ASPNET_REQUESTS_REJECTED_011_HELP=—v‹‚ª‚¢‚Á‚Ï‚¢‚É‚È‚Á‚½‚½‚ß‚É‹‘”Û‚³‚ꂽ—v‹‚Ì”‚Å‚·B
+
+ASPNET_REQUESTS_QUEUED_011_NAME=Requests Queued
+ASPNET_REQUESTS_QUEUED_011_HELP=ˆ—‘Ò‚¿‚Ì—v‹‚Ì”‚Å‚·B
+
+ASPNET_WPS_RUNNING_011_NAME=Worker Processes Running
+ASPNET_WPS_RUNNING_011_HELP=ƒRƒ“ƒsƒ…[ƒ^‚ÅŽÀs’†‚̃[ƒJ[ ƒvƒƒZƒX‚Ì”‚Å‚·B
+
+ASPNET_WPS_RESTARTS_011_NAME=Worker Process Restarts
+ASPNET_WPS_RESTARTS_011_HELP=ƒRƒ“ƒsƒ…[ƒ^‚Ń[ƒJ[ ƒvƒƒZƒX‚ªÄ‹N“®‚³‚ꂽ‰ñ”‚Å‚·B
+
+ASPNET_REQUEST_WAIT_TIME_011_NAME=Request Wait Time
+ASPNET_REQUEST_WAIT_TIME_011_HELP=ÅŒã‚Ì—v‹‚ªAƒLƒ…[‚Å‘Ò‚Á‚Ä‚¢‚鎞ŠÔ (ƒ~ƒŠ•b) ‚Å‚·B
+
+ASPNET_STATE_SERVER_SESSIONS_ACTIVE_011_NAME=State Server Sessions Active
+ASPNET_STATE_SERVER_SESSIONS_ACTIVE_011_HELP=Œ»ÝƒAƒNƒeƒBƒu‚ȃZƒbƒVƒ‡ƒ“‚Ì”‚Å‚·B
+
+ASPNET_STATE_SERVER_SESSIONS_ABANDONED_011_NAME=State Server Sessions Abandoned
+ASPNET_STATE_SERVER_SESSIONS_ABANDONED_011_HELP=–¾Ž¦“I‚É”jŠü‚³‚ꂽƒZƒbƒVƒ‡ƒ“‚Ì”‚Å‚·B
+
+ASPNET_STATE_SERVER_SESSIONS_TIMED_OUT_011_NAME=State Server Sessions Timed Out
+ASPNET_STATE_SERVER_SESSIONS_TIMED_OUT_011_HELP=ƒ^ƒCƒ€ƒAƒEƒg‚µ‚½ƒZƒbƒVƒ‡ƒ“‚Ì”‚Å‚·B
+
+ASPNET_STATE_SERVER_SESSIONS_TOTAL_011_NAME=State Server Sessions Total
+ASPNET_STATE_SERVER_SESSIONS_TOTAL_011_HELP=ƒZƒbƒVƒ‡ƒ“‚̇Œv”‚Å‚·B
+
+;;
+;; ASP.NET Application Counters
+;;
+
+ASPNET_ANONYMOUS_REQUESTS_011_NAME=Anonymous Requests
+ASPNET_ANONYMOUS_REQUESTS_011_HELP=“½–¼”FØ‚ðŽg—p‚·‚é—v‹‚Ì”‚Å‚·B
+
+ASPNET_ANONYMOUS_REQUESTS_RATE_011_NAME=Anonymous Requests/Sec
+ASPNET_ANONYMOUS_REQUESTS_RATE_011_HELP=”FØ“½–¼–³–¼—v‹‚Ì” (•b’PˆÊ) ‚Å‚·B
+
+ASPNET_TOTAL_CACHE_ENTRIES_011_NAME=Cache Total Entries
+ASPNET_TOTAL_CACHE_ENTRIES_011_HELP=ƒLƒƒƒbƒVƒ…“à‚̃Gƒ“ƒgƒŠ‚Ì‘” (“à•”‚¨‚æ‚у†[ƒU[‚ª’ljÁ‚µ‚½‚à‚Ì)
+
+ASPNET_TOTAL_CACHE_TURNOVER_RATE_011_NAME=Cache Total Turnover Rate
+ASPNET_TOTAL_CACHE_TURNOVER_RATE_011_HELP=’ljÁ/휂³‚ꂽ‡ŒvƒLƒƒƒbƒVƒ…” (•b’PˆÊ) ‚Å‚·B
+
+ASPNET_TOTAL_CACHE_HITS_011_NAME=Cache Total Hits
+ASPNET_TOTAL_CACHE_HITS_011_HELP=ƒLƒƒƒbƒVƒ…‚©‚ç‚̃qƒbƒg‚Ì‘”‚Å‚·B
+
+ASPNET_TOTAL_CACHE_MISSES_011_NAME=Cache Total Misses
+ASPNET_TOTAL_CACHE_MISSES_011_HELP=ƒLƒƒƒbƒVƒ… ƒ~ƒX‚Ì‘”‚Å‚·B
+
+ASPNET_TOTAL_CACHE_RATIO_011_NAME=Cache Total Hit Ratio
+ASPNET_TOTAL_CACHE_RATIO_011_HELP=‚·‚ׂẴLƒƒƒbƒVƒ…‚̌ĂÑo‚µ‚©‚ç‚̃qƒbƒg‚ÌŠ„‡‚Å‚·B
+
+ASPNET_TOTAL_CACHE_RATIO_BASE_011_NAME=Cache Total Hit Ratio Base
+ASPNET_TOTAL_CACHE_RATIO_BASE_011_HELP=ƒLƒƒƒbƒVƒ…‡Œvƒqƒbƒg—¦ƒx[ƒX‚Å‚·B
+
+ASPNET_API_CACHE_ENTRIES_011_NAME=Cache API Entries
+ASPNET_API_CACHE_ENTRIES_011_HELP=ƒ†[ƒU[‚ª’ljÁ‚µ‚½AƒLƒƒƒbƒVƒ…“à‚̃Gƒ“ƒgƒŠ‚Ì‘”‚Å‚·B
+
+ASPNET_API_CACHE_TURNOVER_RATE_011_NAME=Cache API Turnover Rate
+ASPNET_API_CACHE_TURNOVER_RATE_011_HELP=’ljÁ/휂³‚ꂽ API ƒLƒƒƒbƒVƒ…” (•b’PˆÊ) ‚Å‚·B
+
+ASPNET_API_CACHE_HITS_011_NAME=Cache API Hits
+ASPNET_API_CACHE_HITS_011_HELP=ƒ†[ƒU[ ƒR[ƒh‚©‚ç‚̃LƒƒƒbƒVƒ… ƒqƒbƒg‚Ì”‚Å‚·B
+
+ASPNET_API_CACHE_MISSES_011_NAME=Cache API Misses
+ASPNET_API_CACHE_MISSES_011_HELP=ƒ†[ƒU[ ƒR[ƒh‚©‚ç‚̃LƒƒƒbƒVƒ… ƒ~ƒX‚Ì”‚Å‚·B
+
+ASPNET_API_CACHE_RATIO_011_NAME=Cache API Hit Ratio
+ASPNET_API_CACHE_RATIO_011_HELP=ƒ†[ƒU[ ƒR[ƒh‚©‚çŒÄ‚Ño‚³‚ê‚éAƒqƒbƒg‚ÌŠ„‡‚Å‚·B
+
+ASPNET_API_CACHE_RATIO_BASE_011_NAME=Cache API Hit Ratio Base
+ASPNET_API_CACHE_RATIO_BASE_011_HELP=ƒLƒƒƒbƒVƒ… API ƒqƒbƒg—¦ƒx[ƒX‚Å‚·B
+
+ASPNET_OUTPUT_CACHE_ENTRIES_011_NAME=Output Cache Entries
+ASPNET_OUTPUT_CACHE_ENTRIES_011_HELP=o—̓LƒƒƒbƒVƒ…‚ÌŒ»Ý‚̃Gƒ“ƒgƒŠ‚Ì”‚Å‚·B
+
+ASPNET_OUTPUT_CACHE_TURNOVER_RATE_011_NAME=Output Cache Turnover Rate
+ASPNET_OUTPUT_CACHE_TURNOVER_RATE_011_HELP=’ljÁ/휂³‚ꂽo—̓LƒƒƒbƒVƒ…” (•b’PˆÊ) ‚Å‚·B
+
+ASPNET_OUTPUT_CACHE_HITS_011_NAME=Output Cache Hits
+ASPNET_OUTPUT_CACHE_HITS_011_HELP=o—̓LƒƒƒbƒVƒ…‚©‚ç‘—M‚³‚ꂽo—̓LƒƒƒbƒVƒ…‰Â”\‚È—v‹‚̇Œv”‚Å‚·B
+
+ASPNET_OUTPUT_CACHE_MISSES_011_NAME=Output Cache Misses
+ASPNET_OUTPUT_CACHE_MISSES_011_HELP=o—̓LƒƒƒbƒVƒ…‚©‚ç‘—M‚³‚ê‚È‚©‚Á‚½o—̓LƒƒƒbƒVƒ…‰Â”\‚È—v‹‚̇Œv”‚Å‚·B
+
+ASPNET_OUTPUT_CACHE_RATIO_011_NAME=Output Cache Hit Ratio
+ASPNET_OUTPUT_CACHE_RATIO_011_HELP=o—͂̃LƒƒƒbƒVƒ…‰Â”\—v‹‚ɑ΂·‚é—v‹‚̃qƒbƒg—¦‚Å‚·B
+
+ASPNET_OUTPUT_CACHE_RATIO_BASE_011_NAME=Output Cache Hit Ratio Base
+ASPNET_OUTPUT_CACHE_RATIO_BASE_011_HELP=o—̓LƒƒƒbƒVƒ… ƒqƒbƒg—¦ƒx[ƒX‚Å‚·B
+
+ASPNET_COMPILATIONS_011_NAME=Compilations Total
+ASPNET_COMPILATIONS_011_HELP=“®“I‚ɃRƒ“ƒpƒCƒ‹‚³‚ꂽ .asaxA.ascxA.ashxA.asmx ‚Ü‚½‚Í .aspx ƒ\[ƒX ƒtƒ@ƒCƒ‹‚Ì”‚Å‚·B
+
+ASPNET_DEBUGGING_REQUESTS_011_NAME=Debugging Requests
+ASPNET_DEBUGGING_REQUESTS_011_HELP=ˆ—‚µ‚½ƒfƒoƒbƒO ƒŠƒNƒGƒXƒg‚Ì”‚Å‚·B
+
+ASPNET_ERRORS_PRE_PROCESSING_011_NAME=Errors During Preprocessing
+ASPNET_ERRORS_PRE_PROCESSING_011_HELP=‰ðÍ‚Æ\¬’†‚É”­¶‚µ‚½ƒGƒ‰[‚Ì”‚Å‚·B
+
+ASPNET_ERRORS_COMPILING_011_NAME=Errors During Compilation
+ASPNET_ERRORS_COMPILING_011_HELP=ƒRƒ“ƒpƒCƒ‹’†‚É”­¶‚µ‚½ƒGƒ‰[‚Ì”‚Å‚·B
+
+ASPNET_ERRORS_DURING_REQUEST_011_NAME=Errors During Execution
+ASPNET_ERRORS_DURING_REQUEST_011_HELP=—v‹‚̈—’†‚É”­¶‚µ‚½ƒGƒ‰[‚Ì”‚Å‚·B
+
+ASPNET_ERRORS_UNHANDLED_011_NAME=Errors Unhandled During Execution
+ASPNET_ERRORS_UNHANDLED_011_HELP=ƒ†[ƒU[ ƒR[ƒh‚Å‚È‚­AŠù’è‚̃Gƒ‰[ ƒnƒ“ƒhƒ‰‚É‚æ‚èƒnƒ“ƒhƒ‹‚³‚ꂽƒGƒ‰[‚Ì”‚Å‚·B
+
+ASPNET_ERRORS_UNHANDLED_RATE_011_NAME=Errors Unhandled During Execution/Sec
+ASPNET_ERRORS_UNHANDLED_RATE_011_HELP=–¢ˆ—‚̃Gƒ‰[‚ÌŠ„‡‚Å‚·B
+
+ASPNET_ERRORS_TOTAL_011_NAME=Errors Total
+ASPNET_ERRORS_TOTAL_011_HELP=”­¶‚µ‚½ƒGƒ‰[‚Ì‘”‚Å‚·B
+
+ASPNET_ERRORS_TOTAL_RATE_011_NAME=Errors Total/Sec
+ASPNET_ERRORS_TOTAL_RATE_011_HELP=”­¶‚µ‚½ƒGƒ‰[‚ÌŠ„‡‚Å‚·B
+
+ASPNET_PIPELINES_011_NAME=Pipeline Instance Count
+ASPNET_PIPELINES_011_HELP=ƒAƒNƒeƒBƒu ƒpƒCƒvƒ‰ƒCƒ“ ƒCƒ“ƒXƒ^ƒ“ƒX‚Ì”‚Å‚·B
+
+ASPNET_REQUEST_BYTES_IN_011_NAME=Request Bytes In Total
+ASPNET_REQUEST_BYTES_IN_011_HELP=‚·‚ׂĂ̗v‹‚Ì‘ƒTƒCƒY‚Å‚· (ƒoƒCƒg)B
+
+ASPNET_REQUEST_BYTES_OUT_011_NAME=Request Bytes Out Total
+ASPNET_REQUEST_BYTES_OUT_011_HELP=ƒNƒ‰ƒCƒAƒ“ƒg‚É‘—M‚³‚ꂽ‰ž“š‚Ì‘ƒTƒCƒY‚Å‚· (ƒoƒCƒg)B‚±‚ê‚É‚ÍAHTTP ‰ž“šƒwƒbƒ_[‚ÍŠÜ‚Ü‚ê‚Ä‚¢‚Ü‚¹‚ñB
+
+ASPNET_REQUESTS_EXECUTING_011_NAME=Requests Executing
+ASPNET_REQUESTS_EXECUTING_011_HELP=Œ»ÝŽÀs‚µ‚Ä‚¢‚é—v‹‚Ì”‚Å‚·B
+
+ASPNET_REQUESTS_FAILED_011_NAME=Requests Failed
+ASPNET_REQUESTS_FAILED_011_HELP=Ž¸”s‚µ‚½—v‹‚Ì‘”‚Å‚·B
+
+ASPNET_REQUESTS_NOT_FOUND_011_NAME=Requests Not Found
+ASPNET_REQUESTS_NOT_FOUND_011_HELP=Œ©‚‚©‚ç‚È‚©‚Á‚½ƒŠƒ\[ƒX‚ð—v‹‚µ‚½”‚Å‚·B
+
+ASPNET_REQUESTS_NOT_AUTHORIZED_011_NAME=Requests Not Authorized
+ASPNET_REQUESTS_NOT_AUTHORIZED_011_HELP=”FØ‚Ì‚È‚¢ƒAƒNƒZƒX‚ðs‚Á‚½‚½‚ßA—v‹‚ÉŽ¸”s‚µ‚Ü‚µ‚½B
+
+ASPNET_REQUESTS_TIMED_OUT_011_NAME=Requests Timed Out
+ASPNET_REQUESTS_TIMED_OUT_011_HELP=ƒ^ƒCƒ€ƒAƒEƒg‚µ‚½—v‹‚Ì”‚Å‚·B
+
+ASPNET_REQUESTS_SUCCEDED_011_NAME=Requests Succeeded
+ASPNET_REQUESTS_SUCCEDED_011_HELP=ŽÀs‚ɬŒ÷‚µ‚½—v‹‚Ì”‚Å‚·B
+
+ASPNET_REQUESTS_TOTAL_011_NAME=Requests Total
+ASPNET_REQUESTS_TOTAL_011_HELP=ƒAƒvƒŠƒP[ƒVƒ‡ƒ“ŠJŽnŒã‚Ì—v‹”‚̇Œv‚Å‚·B
+
+ASPNET_REQUESTS_TOTAL_RATE_011_NAME=Requests/Sec
+ASPNET_REQUESTS_TOTAL_RATE_011_HELP=1 •b‚²‚Æ‚ÉŽÀs‚µ‚½—v‹‚Ì”‚Å‚·B
+
+ASPNET_SESSIONS_ACTIVE_011_NAME=Sessions Active
+ASPNET_SESSIONS_ACTIVE_011_HELP=Œ»ÝƒAƒNƒeƒBƒu‚ȃZƒbƒVƒ‡ƒ“‚Ì”‚Å‚·B
+
+ASPNET_SESSIONS_ABANDONED_011_NAME=Sessions Abandoned
+ASPNET_SESSIONS_ABANDONED_011_HELP=–¾Ž¦“I‚É”jŠü‚³‚ꂽƒZƒbƒVƒ‡ƒ“‚Ì”‚Å‚·B
+
+ASPNET_SESSIONS_TIMED_OUT_011_NAME=Sessions Timed Out
+ASPNET_SESSIONS_TIMED_OUT_011_HELP=ƒ^ƒCƒ€ƒAƒEƒg‚µ‚½ƒZƒbƒVƒ‡ƒ“‚Ì”‚Å‚·B
+
+ASPNET_SESSIONS_TOTAL_011_NAME=Sessions Total
+ASPNET_SESSIONS_TOTAL_011_HELP=ƒAƒvƒŠƒP[ƒVƒ‡ƒ“ŠJŽnŒã‚̃ZƒbƒVƒ‡ƒ“”‚̇Œv‚Å‚·B
+
+ASPNET_TRANSACTIONS_ABORTED_011_NAME=Transactions Aborted
+ASPNET_TRANSACTIONS_ABORTED_011_HELP=’†Ž~‚³‚ꂽƒgƒ‰ƒ“ƒUƒNƒVƒ‡ƒ“‚Ì”‚Å‚·B
+
+ASPNET_TRANSACTIONS_COMMITTED_011_NAME=Transactions Committed
+ASPNET_TRANSACTIONS_COMMITTED_011_HELP=ƒRƒ~ƒbƒg‚µ‚½ƒgƒ‰ƒ“ƒUƒNƒVƒ‡ƒ“‚Ì”‚Å‚·B
+
+ASPNET_TRANSACTIONS_PENDING_011_NAME=Transactions Pending
+ASPNET_TRANSACTIONS_PENDING_011_HELP=ˆ—’†‚̃gƒ‰ƒ“ƒUƒNƒVƒ‡ƒ“‚Å‚·B
+
+ASPNET_TRANSACTIONS_TOTAL_011_NAME=Transactions Total
+ASPNET_TRANSACTIONS_TOTAL_011_HELP=ƒAƒvƒŠƒP[ƒVƒ‡ƒ“ŠJŽnŒã‚̃gƒ‰ƒ“ƒUƒNƒVƒ‡ƒ“”‚̇Œv‚Å‚·B
+
+ASPNET_TRANSACTIONS_RATE_011_NAME=Transactions/Sec
+ASPNET_TRANSACTIONS_RATE_011_HELP=1 •b‚ÉŠJŽn‚³‚ê‚éƒgƒ‰ƒ“ƒUƒNƒVƒ‡ƒ“‚Å‚·B
+
diff --git a/src/inc/1041/aspnet_perf2.ini b/src/inc/1041/aspnet_perf2.ini
new file mode 100644
index 0000000000..d08121b8bb
--- /dev/null
+++ b/src/inc/1041/aspnet_perf2.ini
@@ -0,0 +1,411 @@
+[info]
+drivername=ASP.NET
+symbolfile=aspnet_perf.h
+
+[languages]
+011=Japanese
+009=English
+
+[objects]
+OBJECT_1_009_NAME=ASP.NET
+OBJECT_2_009_NAME=ASP.NET Applications
+
+OBJECT_1_011_NAME=ASP.NET
+OBJECT_2_011_NAME=ASP.NET Applications
+
+[text]
+OBJECT_1_009_NAME=ASP.NET
+OBJECT_1_009_HELP=ASP.NET global performance counters
+OBJECT_2_009_NAME=ASP.NET Applications
+OBJECT_2_009_HELP=ASP.NET Application performance counters
+
+OBJECT_1_011_NAME=ASP.NET
+OBJECT_1_011_HELP=ASP.NET ƒOƒ[ƒoƒ‹ ƒp[ƒtƒH[ƒ}ƒ“ƒX ƒJƒEƒ“ƒ^
+OBJECT_2_011_NAME=ASP.NET Applications
+OBJECT_2_011_HELP=ASP.NET ƒAƒvƒŠƒP[ƒVƒ‡ƒ“ ƒp[ƒtƒH[ƒ}ƒ“ƒX ƒJƒEƒ“ƒ^
+
+;;
+;; ASP.NET System Counters
+;;
+
+ASPNET_APPLICATION_RESTARTS_009_NAME=Application Restarts
+ASPNET_APPLICATION_RESTARTS_009_HELP=Number of times the application has been restarted during the web server's lifetime.
+
+ASPNET_APPLICATIONS_RUNNING_009_NAME=Applications Running
+ASPNET_APPLICATIONS_RUNNING_009_HELP=Number of currently running web applications.
+
+ASPNET_REQUESTS_DISCONNECTED_009_NAME=Requests Disconnected
+ASPNET_REQUESTS_DISCONNECTED_009_HELP=The number of requests disconnected due to communication errors or user terminated.
+
+ASPNET_REQUEST_EXECUTION_TIME_009_NAME=Request Execution Time
+ASPNET_REQUEST_EXECUTION_TIME_009_HELP=The number of milliseconds that it took to execute the most recent request.
+
+ASPNET_REQUESTS_REJECTED_009_NAME=Requests Rejected
+ASPNET_REQUESTS_REJECTED_009_HELP=The number of requests rejected because the request queue was full.
+
+ASPNET_REQUESTS_QUEUED_009_NAME=Requests Queued
+ASPNET_REQUESTS_QUEUED_009_HELP=The number of requests waiting to be processed.
+
+ASPNET_WPS_RUNNING_009_NAME=Worker Processes Running
+ASPNET_WPS_RUNNING_009_HELP=Number of worker processes running on the machine.
+
+ASPNET_WPS_RESTARTS_009_NAME=Worker Process Restarts
+ASPNET_WPS_RESTARTS_009_HELP=Number of times a worker process has restarted on the machine.
+
+ASPNET_REQUEST_WAIT_TIME_009_NAME=Request Wait Time
+ASPNET_REQUEST_WAIT_TIME_009_HELP=The number of milliseconds the most recent request was waiting in the queue.
+
+ASPNET_STATE_SERVER_SESSIONS_ACTIVE_009_NAME=State Server Sessions Active
+ASPNET_STATE_SERVER_SESSIONS_ACTIVE_009_HELP=The current number of sessions currently active.
+
+ASPNET_STATE_SERVER_SESSIONS_ABANDONED_009_NAME=State Server Sessions Abandoned
+ASPNET_STATE_SERVER_SESSIONS_ABANDONED_009_HELP=The number of sessions that have been explicitly abandoned.
+
+ASPNET_STATE_SERVER_SESSIONS_TIMED_OUT_009_NAME=State Server Sessions Timed Out
+ASPNET_STATE_SERVER_SESSIONS_TIMED_OUT_009_HELP=The number of sessions timed out.
+
+ASPNET_STATE_SERVER_SESSIONS_TOTAL_009_NAME=State Server Sessions Total
+ASPNET_STATE_SERVER_SESSIONS_TOTAL_009_HELP=The number of sessions total.
+
+;;
+;; ASP.NET Application Counters
+;;
+
+ASPNET_ANONYMOUS_REQUESTS_009_NAME=Anonymous Requests
+ASPNET_ANONYMOUS_REQUESTS_009_HELP=Number of requests utilizing anonymous authentication.
+
+ASPNET_ANONYMOUS_REQUESTS_RATE_009_NAME=Anonymous Requests/Sec
+ASPNET_ANONYMOUS_REQUESTS_RATE_009_HELP=Number of Authentication Anonymous Requests/Sec
+
+ASPNET_TOTAL_CACHE_ENTRIES_009_NAME=Cache Total Entries
+ASPNET_TOTAL_CACHE_ENTRIES_009_HELP=Total number of entries within the cache (both internal and user added)
+
+ASPNET_TOTAL_CACHE_TURNOVER_RATE_009_NAME=Cache Total Turnover Rate
+ASPNET_TOTAL_CACHE_TURNOVER_RATE_009_HELP=Number of additions and removals to the total cache per second.
+
+ASPNET_TOTAL_CACHE_HITS_009_NAME=Cache Total Hits
+ASPNET_TOTAL_CACHE_HITS_009_HELP=Total number of hits from the cache.
+
+ASPNET_TOTAL_CACHE_MISSES_009_NAME=Cache Total Misses
+ASPNET_TOTAL_CACHE_MISSES_009_HELP=Total number of cache misses.
+
+ASPNET_TOTAL_CACHE_RATIO_009_NAME=Cache Total Hit Ratio
+ASPNET_TOTAL_CACHE_RATIO_009_HELP=Ratio of hits from all cache calls.
+
+ASPNET_TOTAL_CACHE_RATIO_BASE_009_NAME=Cache Total Hit Ratio Base
+ASPNET_TOTAL_CACHE_RATIO_BASE_009_HELP=Cache Total Hit Ratio Base
+
+ASPNET_API_CACHE_ENTRIES_009_NAME=Cache API Entries
+ASPNET_API_CACHE_ENTRIES_009_HELP=Total number of entries within the cache added by the user.
+
+ASPNET_API_CACHE_TURNOVER_RATE_009_NAME=Cache API Turnover Rate
+ASPNET_API_CACHE_TURNOVER_RATE_009_HELP=Number of additions and removals to the API cache per second.
+
+ASPNET_API_CACHE_HITS_009_NAME=Cache API Hits
+ASPNET_API_CACHE_HITS_009_HELP=Number of cache hits from user code.
+
+ASPNET_API_CACHE_MISSES_009_NAME=Cache API Misses
+ASPNET_API_CACHE_MISSES_009_HELP=Number of cache misses called from user code.
+
+ASPNET_API_CACHE_RATIO_009_NAME=Cache API Hit Ratio
+ASPNET_API_CACHE_RATIO_009_HELP=Ratio of hits called from user code.
+
+ASPNET_API_CACHE_RATIO_BASE_009_NAME=Cache API Hit Ratio Base
+ASPNET_API_CACHE_RATIO_BASE_009_HELP=Cache API Hit Ratio Base
+
+ASPNET_OUTPUT_CACHE_ENTRIES_009_NAME=Output Cache Entries
+ASPNET_OUTPUT_CACHE_ENTRIES_009_HELP=Current number of entries in the output cache.
+
+ASPNET_OUTPUT_CACHE_TURNOVER_RATE_009_NAME=Output Cache Turnover Rate
+ASPNET_OUTPUT_CACHE_TURNOVER_RATE_009_HELP=Number of additions and removals to the output cache per second.
+
+ASPNET_OUTPUT_CACHE_HITS_009_NAME=Output Cache Hits
+ASPNET_OUTPUT_CACHE_HITS_009_HELP=Total number of ouput cacheable requests served from the output cache.
+
+ASPNET_OUTPUT_CACHE_MISSES_009_NAME=Output Cache Misses
+ASPNET_OUTPUT_CACHE_MISSES_009_HELP=Total number of ouput cacheable requests not served from the output cache.
+
+ASPNET_OUTPUT_CACHE_RATIO_009_NAME=Output Cache Hit Ratio
+ASPNET_OUTPUT_CACHE_RATIO_009_HELP=Ratio of hits to requests for output cacheable requests.
+
+ASPNET_OUTPUT_CACHE_RATIO_BASE_009_NAME=Output Cache Hit Ratio Base
+ASPNET_OUTPUT_CACHE_RATIO_BASE_009_HELP=Output Cache Hit Ratio Base
+
+ASPNET_COMPILATIONS_009_NAME=Compilations Total
+ASPNET_COMPILATIONS_009_HELP=Number of .asax, .ascx, .ashx, .asmx, or .aspx source files dynamically compiled.
+
+ASPNET_DEBUGGING_REQUESTS_009_NAME=Debugging Requests
+ASPNET_DEBUGGING_REQUESTS_009_HELP=Number of debugging requests processed.
+
+ASPNET_ERRORS_PRE_PROCESSING_009_NAME=Errors During Preprocessing
+ASPNET_ERRORS_PRE_PROCESSING_009_HELP=Number of errors that have occurred during parsing and configuration.
+
+ASPNET_ERRORS_COMPILING_009_NAME=Errors During Compilation
+ASPNET_ERRORS_COMPILING_009_HELP=Number of errors that have occurred during compilation.
+
+ASPNET_ERRORS_DURING_REQUEST_009_NAME=Errors During Execution
+ASPNET_ERRORS_DURING_REQUEST_009_HELP=Number of errors that have occurred during the processing of a request.
+
+ASPNET_ERRORS_UNHANDLED_009_NAME=Errors Unhandled During Execution
+ASPNET_ERRORS_UNHANDLED_009_HELP=Number of errors not handled by user code, but by the default error handler.
+
+ASPNET_ERRORS_UNHANDLED_RATE_009_NAME=Errors Unhandled During Execution/Sec
+ASPNET_ERRORS_UNHANDLED_RATE_009_HELP=Rate of unhandled errors.
+
+ASPNET_ERRORS_TOTAL_009_NAME=Errors Total
+ASPNET_ERRORS_TOTAL_009_HELP=Total number of errors occurred.
+
+ASPNET_ERRORS_TOTAL_RATE_009_NAME=Errors Total/Sec
+ASPNET_ERRORS_TOTAL_RATE_009_HELP=Rate of errors occurred.
+
+ASPNET_PIPELINES_009_NAME=Pipeline Instance Count
+ASPNET_PIPELINES_009_HELP=Number of active pipeline instances.
+
+ASPNET_REQUEST_BYTES_IN_009_NAME=Request Bytes In Total
+ASPNET_REQUEST_BYTES_IN_009_HELP=The total size, in bytes, of all requests.
+
+ASPNET_REQUEST_BYTES_OUT_009_NAME=Request Bytes Out Total
+ASPNET_REQUEST_BYTES_OUT_009_HELP=The total size, in bytes, of responses sent to a client. This does not include standard HTTP response headers.
+
+ASPNET_REQUESTS_EXECUTING_009_NAME=Requests Executing
+ASPNET_REQUESTS_EXECUTING_009_HELP=The number of requests currently executing.
+
+ASPNET_REQUESTS_FAILED_009_NAME=Requests Failed
+ASPNET_REQUESTS_FAILED_009_HELP=Total number of failed requests.
+
+ASPNET_REQUESTS_NOT_FOUND_009_NAME=Requests Not Found
+ASPNET_REQUESTS_NOT_FOUND_009_HELP=The number of requests for resources that were not found.
+
+ASPNET_REQUESTS_NOT_AUTHORIZED_009_NAME=Requests Not Authorized
+ASPNET_REQUESTS_NOT_AUTHORIZED_009_HELP=Number of requests failed due to unauthorized access.
+
+ASPNET_REQUESTS_TIMED_OUT_009_NAME=Requests Timed Out
+ASPNET_REQUESTS_TIMED_OUT_009_HELP=The number of requests that timed out.
+
+ASPNET_REQUESTS_SUCCEDED_009_NAME=Requests Succeeded
+ASPNET_REQUESTS_SUCCEDED_009_HELP=The number of requests that executed successfully.
+
+ASPNET_REQUESTS_TOTAL_009_NAME=Requests Total
+ASPNET_REQUESTS_TOTAL_009_HELP=The total number of requests since the application was started.
+
+ASPNET_REQUESTS_TOTAL_RATE_009_NAME=Requests/Sec
+ASPNET_REQUESTS_TOTAL_RATE_009_HELP=The number of requests executed per second.
+
+ASPNET_SESSIONS_ACTIVE_009_NAME=Sessions Active
+ASPNET_SESSIONS_ACTIVE_009_HELP=The current number of sessions currently active.
+
+ASPNET_SESSIONS_ABANDONED_009_NAME=Sessions Abandoned
+ASPNET_SESSIONS_ABANDONED_009_HELP=The number of sessions that have been explicitly abandoned.
+
+ASPNET_SESSIONS_TIMED_OUT_009_NAME=Sessions Timed Out
+ASPNET_SESSIONS_TIMED_OUT_009_HELP=The number of sessions timed out.
+
+ASPNET_SESSIONS_TOTAL_009_NAME=Sessions Total
+ASPNET_SESSIONS_TOTAL_009_HELP=Total number of sessions since the application was started.
+
+ASPNET_TRANSACTIONS_ABORTED_009_NAME=Transactions Aborted
+ASPNET_TRANSACTIONS_ABORTED_009_HELP=The number of transactions aborted.
+
+ASPNET_TRANSACTIONS_COMMITTED_009_NAME=Transactions Committed
+ASPNET_TRANSACTIONS_COMMITTED_009_HELP=The number of transactions committed.
+
+ASPNET_TRANSACTIONS_PENDING_009_NAME=Transactions Pending
+ASPNET_TRANSACTIONS_PENDING_009_HELP=Number of transactions in progress.
+
+ASPNET_TRANSACTIONS_TOTAL_009_NAME=Transactions Total
+ASPNET_TRANSACTIONS_TOTAL_009_HELP=The total number of transactions since the application was started.
+
+ASPNET_TRANSACTIONS_RATE_009_NAME=Transactions/Sec
+ASPNET_TRANSACTIONS_RATE_009_HELP=Transactions started per second.
+
+
+ASPNET_APPLICATION_RESTARTS_011_NAME=Application Restarts
+ASPNET_APPLICATION_RESTARTS_011_HELP=Web ƒT[ƒo[‚Ì—LŒøŠúŠÔ’†‚ɃAƒvƒŠƒP[ƒVƒ‡ƒ“‚ªÄ‹N“®‚³‚ꂽ‰ñ”‚Å‚·B
+
+ASPNET_APPLICATIONS_RUNNING_011_NAME=Applications Running
+ASPNET_APPLICATIONS_RUNNING_011_HELP=Œ»ÝŽÀs’†‚Ì Web ƒAƒvƒŠƒP[ƒVƒ‡ƒ“‚Ì”‚Å‚·B
+
+ASPNET_REQUESTS_DISCONNECTED_011_NAME=Requests Disconnected
+ASPNET_REQUESTS_DISCONNECTED_011_HELP=’ÊMƒGƒ‰[‚Ü‚½‚̓†[ƒU[‘€ì‚É‚æ‚Á‚ÄØ’f‚³‚ꂽ—v‹‚Ì”‚Å‚·B
+
+ASPNET_REQUEST_EXECUTION_TIME_011_NAME=Request Execution Time
+ASPNET_REQUEST_EXECUTION_TIME_011_HELP=ÅŒã‚Ì—v‹‚ðŽÀs‚·‚é‚Ì‚É”ï‚₵‚½ƒ~ƒŠ•b”‚Å‚·B
+
+ASPNET_REQUESTS_REJECTED_011_NAME=Requests Rejected
+ASPNET_REQUESTS_REJECTED_011_HELP=—v‹‚ª‚¢‚Á‚Ï‚¢‚É‚È‚Á‚½‚½‚ß‚É‹‘”Û‚³‚ꂽ—v‹‚Ì”‚Å‚·B
+
+ASPNET_REQUESTS_QUEUED_011_NAME=Requests Queued
+ASPNET_REQUESTS_QUEUED_011_HELP=ˆ—‘Ò‚¿‚Ì—v‹‚Ì”‚Å‚·B
+
+ASPNET_WPS_RUNNING_011_NAME=Worker Processes Running
+ASPNET_WPS_RUNNING_011_HELP=ƒRƒ“ƒsƒ…[ƒ^‚ÅŽÀs’†‚̃[ƒJ[ ƒvƒƒZƒX‚Ì”‚Å‚·B
+
+ASPNET_WPS_RESTARTS_011_NAME=Worker Process Restarts
+ASPNET_WPS_RESTARTS_011_HELP=ƒRƒ“ƒsƒ…[ƒ^‚Ń[ƒJ[ ƒvƒƒZƒX‚ªÄ‹N“®‚³‚ꂽ‰ñ”‚Å‚·B
+
+ASPNET_REQUEST_WAIT_TIME_011_NAME=Request Wait Time
+ASPNET_REQUEST_WAIT_TIME_011_HELP=ÅŒã‚Ì—v‹‚ªAƒLƒ…[‚Å‘Ò‚Á‚Ä‚¢‚鎞ŠÔ (ƒ~ƒŠ•b) ‚Å‚·B
+
+ASPNET_STATE_SERVER_SESSIONS_ACTIVE_011_NAME=State Server Sessions Active
+ASPNET_STATE_SERVER_SESSIONS_ACTIVE_011_HELP=Œ»ÝƒAƒNƒeƒBƒu‚ȃZƒbƒVƒ‡ƒ“‚Ì”‚Å‚·B
+
+ASPNET_STATE_SERVER_SESSIONS_ABANDONED_011_NAME=State Server Sessions Abandoned
+ASPNET_STATE_SERVER_SESSIONS_ABANDONED_011_HELP=–¾Ž¦“I‚É”jŠü‚³‚ꂽƒZƒbƒVƒ‡ƒ“‚Ì”‚Å‚·B
+
+ASPNET_STATE_SERVER_SESSIONS_TIMED_OUT_011_NAME=State Server Sessions Timed Out
+ASPNET_STATE_SERVER_SESSIONS_TIMED_OUT_011_HELP=ƒ^ƒCƒ€ƒAƒEƒg‚µ‚½ƒZƒbƒVƒ‡ƒ“‚Ì”‚Å‚·B
+
+ASPNET_STATE_SERVER_SESSIONS_TOTAL_011_NAME=State Server Sessions Total
+ASPNET_STATE_SERVER_SESSIONS_TOTAL_011_HELP=ƒZƒbƒVƒ‡ƒ“‚̇Œv”‚Å‚·B
+
+;;
+;; ASP.NET Application Counters
+;;
+
+ASPNET_ANONYMOUS_REQUESTS_011_NAME=Anonymous Requests
+ASPNET_ANONYMOUS_REQUESTS_011_HELP=“½–¼”FØ‚ðŽg—p‚·‚é—v‹‚Ì”‚Å‚·B
+
+ASPNET_ANONYMOUS_REQUESTS_RATE_011_NAME=Anonymous Requests/Sec
+ASPNET_ANONYMOUS_REQUESTS_RATE_011_HELP=”FØ“½–¼–³–¼—v‹‚Ì” (•b’PˆÊ) ‚Å‚·B
+
+ASPNET_TOTAL_CACHE_ENTRIES_011_NAME=Cache Total Entries
+ASPNET_TOTAL_CACHE_ENTRIES_011_HELP=ƒLƒƒƒbƒVƒ…“à‚̃Gƒ“ƒgƒŠ‚Ì‘” (“à•”‚¨‚æ‚у†[ƒU[‚ª’ljÁ‚µ‚½‚à‚Ì)
+
+ASPNET_TOTAL_CACHE_TURNOVER_RATE_011_NAME=Cache Total Turnover Rate
+ASPNET_TOTAL_CACHE_TURNOVER_RATE_011_HELP=’ljÁ/휂³‚ꂽ‡ŒvƒLƒƒƒbƒVƒ…” (•b’PˆÊ) ‚Å‚·B
+
+ASPNET_TOTAL_CACHE_HITS_011_NAME=Cache Total Hits
+ASPNET_TOTAL_CACHE_HITS_011_HELP=ƒLƒƒƒbƒVƒ…‚©‚ç‚̃qƒbƒg‚Ì‘”‚Å‚·B
+
+ASPNET_TOTAL_CACHE_MISSES_011_NAME=Cache Total Misses
+ASPNET_TOTAL_CACHE_MISSES_011_HELP=ƒLƒƒƒbƒVƒ… ƒ~ƒX‚Ì‘”‚Å‚·B
+
+ASPNET_TOTAL_CACHE_RATIO_011_NAME=Cache Total Hit Ratio
+ASPNET_TOTAL_CACHE_RATIO_011_HELP=‚·‚ׂẴLƒƒƒbƒVƒ…‚̌ĂÑo‚µ‚©‚ç‚̃qƒbƒg‚ÌŠ„‡‚Å‚·B
+
+ASPNET_TOTAL_CACHE_RATIO_BASE_011_NAME=Cache Total Hit Ratio Base
+ASPNET_TOTAL_CACHE_RATIO_BASE_011_HELP=ƒLƒƒƒbƒVƒ…‡Œvƒqƒbƒg—¦ƒx[ƒX‚Å‚·B
+
+ASPNET_API_CACHE_ENTRIES_011_NAME=Cache API Entries
+ASPNET_API_CACHE_ENTRIES_011_HELP=ƒ†[ƒU[‚ª’ljÁ‚µ‚½AƒLƒƒƒbƒVƒ…“à‚̃Gƒ“ƒgƒŠ‚Ì‘”‚Å‚·B
+
+ASPNET_API_CACHE_TURNOVER_RATE_011_NAME=Cache API Turnover Rate
+ASPNET_API_CACHE_TURNOVER_RATE_011_HELP=’ljÁ/휂³‚ꂽ API ƒLƒƒƒbƒVƒ…” (•b’PˆÊ) ‚Å‚·B
+
+ASPNET_API_CACHE_HITS_011_NAME=Cache API Hits
+ASPNET_API_CACHE_HITS_011_HELP=ƒ†[ƒU[ ƒR[ƒh‚©‚ç‚̃LƒƒƒbƒVƒ… ƒqƒbƒg‚Ì”‚Å‚·B
+
+ASPNET_API_CACHE_MISSES_011_NAME=Cache API Misses
+ASPNET_API_CACHE_MISSES_011_HELP=ƒ†[ƒU[ ƒR[ƒh‚©‚ç‚̃LƒƒƒbƒVƒ… ƒ~ƒX‚Ì”‚Å‚·B
+
+ASPNET_API_CACHE_RATIO_011_NAME=Cache API Hit Ratio
+ASPNET_API_CACHE_RATIO_011_HELP=ƒ†[ƒU[ ƒR[ƒh‚©‚çŒÄ‚Ño‚³‚ê‚éAƒqƒbƒg‚ÌŠ„‡‚Å‚·B
+
+ASPNET_API_CACHE_RATIO_BASE_011_NAME=Cache API Hit Ratio Base
+ASPNET_API_CACHE_RATIO_BASE_011_HELP=ƒLƒƒƒbƒVƒ… API ƒqƒbƒg—¦ƒx[ƒX‚Å‚·B
+
+ASPNET_OUTPUT_CACHE_ENTRIES_011_NAME=Output Cache Entries
+ASPNET_OUTPUT_CACHE_ENTRIES_011_HELP=o—̓LƒƒƒbƒVƒ…‚ÌŒ»Ý‚̃Gƒ“ƒgƒŠ‚Ì”‚Å‚·B
+
+ASPNET_OUTPUT_CACHE_TURNOVER_RATE_011_NAME=Output Cache Turnover Rate
+ASPNET_OUTPUT_CACHE_TURNOVER_RATE_011_HELP=’ljÁ/휂³‚ꂽo—̓LƒƒƒbƒVƒ…” (•b’PˆÊ) ‚Å‚·B
+
+ASPNET_OUTPUT_CACHE_HITS_011_NAME=Output Cache Hits
+ASPNET_OUTPUT_CACHE_HITS_011_HELP=o—̓LƒƒƒbƒVƒ…‚©‚ç‘—M‚³‚ꂽo—̓LƒƒƒbƒVƒ…‰Â”\‚È—v‹‚̇Œv”‚Å‚·B
+
+ASPNET_OUTPUT_CACHE_MISSES_011_NAME=Output Cache Misses
+ASPNET_OUTPUT_CACHE_MISSES_011_HELP=o—̓LƒƒƒbƒVƒ…‚©‚ç‘—M‚³‚ê‚È‚©‚Á‚½o—̓LƒƒƒbƒVƒ…‰Â”\‚È—v‹‚̇Œv”‚Å‚·B
+
+ASPNET_OUTPUT_CACHE_RATIO_011_NAME=Output Cache Hit Ratio
+ASPNET_OUTPUT_CACHE_RATIO_011_HELP=o—͂̃LƒƒƒbƒVƒ…‰Â”\—v‹‚ɑ΂·‚é—v‹‚̃qƒbƒg—¦‚Å‚·B
+
+ASPNET_OUTPUT_CACHE_RATIO_BASE_011_NAME=Output Cache Hit Ratio Base
+ASPNET_OUTPUT_CACHE_RATIO_BASE_011_HELP=o—̓LƒƒƒbƒVƒ… ƒqƒbƒg—¦ƒx[ƒX‚Å‚·B
+
+ASPNET_COMPILATIONS_011_NAME=Compilations Total
+ASPNET_COMPILATIONS_011_HELP=“®“I‚ɃRƒ“ƒpƒCƒ‹‚³‚ꂽ .asaxA.ascxA.ashxA.asmx ‚Ü‚½‚Í .aspx ƒ\[ƒX ƒtƒ@ƒCƒ‹‚Ì”‚Å‚·B
+
+ASPNET_DEBUGGING_REQUESTS_011_NAME=Debugging Requests
+ASPNET_DEBUGGING_REQUESTS_011_HELP=ˆ—‚µ‚½ƒfƒoƒbƒO ƒŠƒNƒGƒXƒg‚Ì”‚Å‚·B
+
+ASPNET_ERRORS_PRE_PROCESSING_011_NAME=Errors During Preprocessing
+ASPNET_ERRORS_PRE_PROCESSING_011_HELP=‰ðÍ‚Æ\¬’†‚É”­¶‚µ‚½ƒGƒ‰[‚Ì”‚Å‚·B
+
+ASPNET_ERRORS_COMPILING_011_NAME=Errors During Compilation
+ASPNET_ERRORS_COMPILING_011_HELP=ƒRƒ“ƒpƒCƒ‹’†‚É”­¶‚µ‚½ƒGƒ‰[‚Ì”‚Å‚·B
+
+ASPNET_ERRORS_DURING_REQUEST_011_NAME=Errors During Execution
+ASPNET_ERRORS_DURING_REQUEST_011_HELP=—v‹‚̈—’†‚É”­¶‚µ‚½ƒGƒ‰[‚Ì”‚Å‚·B
+
+ASPNET_ERRORS_UNHANDLED_011_NAME=Errors Unhandled During Execution
+ASPNET_ERRORS_UNHANDLED_011_HELP=ƒ†[ƒU[ ƒR[ƒh‚Å‚È‚­AŠù’è‚̃Gƒ‰[ ƒnƒ“ƒhƒ‰‚É‚æ‚èƒnƒ“ƒhƒ‹‚³‚ꂽƒGƒ‰[‚Ì”‚Å‚·B
+
+ASPNET_ERRORS_UNHANDLED_RATE_011_NAME=Errors Unhandled During Execution/Sec
+ASPNET_ERRORS_UNHANDLED_RATE_011_HELP=–¢ˆ—‚̃Gƒ‰[‚ÌŠ„‡‚Å‚·B
+
+ASPNET_ERRORS_TOTAL_011_NAME=Errors Total
+ASPNET_ERRORS_TOTAL_011_HELP=”­¶‚µ‚½ƒGƒ‰[‚Ì‘”‚Å‚·B
+
+ASPNET_ERRORS_TOTAL_RATE_011_NAME=Errors Total/Sec
+ASPNET_ERRORS_TOTAL_RATE_011_HELP=”­¶‚µ‚½ƒGƒ‰[‚ÌŠ„‡‚Å‚·B
+
+ASPNET_PIPELINES_011_NAME=Pipeline Instance Count
+ASPNET_PIPELINES_011_HELP=ƒAƒNƒeƒBƒu ƒpƒCƒvƒ‰ƒCƒ“ ƒCƒ“ƒXƒ^ƒ“ƒX‚Ì”‚Å‚·B
+
+ASPNET_REQUEST_BYTES_IN_011_NAME=Request Bytes In Total
+ASPNET_REQUEST_BYTES_IN_011_HELP=‚·‚ׂĂ̗v‹‚Ì‘ƒTƒCƒY‚Å‚· (ƒoƒCƒg)B
+
+ASPNET_REQUEST_BYTES_OUT_011_NAME=Request Bytes Out Total
+ASPNET_REQUEST_BYTES_OUT_011_HELP=ƒNƒ‰ƒCƒAƒ“ƒg‚É‘—M‚³‚ꂽ‰ž“š‚Ì‘ƒTƒCƒY‚Å‚· (ƒoƒCƒg)B‚±‚ê‚É‚ÍAHTTP ‰ž“šƒwƒbƒ_[‚ÍŠÜ‚Ü‚ê‚Ä‚¢‚Ü‚¹‚ñB
+
+ASPNET_REQUESTS_EXECUTING_011_NAME=Requests Executing
+ASPNET_REQUESTS_EXECUTING_011_HELP=Œ»ÝŽÀs‚µ‚Ä‚¢‚é—v‹‚Ì”‚Å‚·B
+
+ASPNET_REQUESTS_FAILED_011_NAME=Requests Failed
+ASPNET_REQUESTS_FAILED_011_HELP=Ž¸”s‚µ‚½—v‹‚Ì‘”‚Å‚·B
+
+ASPNET_REQUESTS_NOT_FOUND_011_NAME=Requests Not Found
+ASPNET_REQUESTS_NOT_FOUND_011_HELP=Œ©‚‚©‚ç‚È‚©‚Á‚½ƒŠƒ\[ƒX‚ð—v‹‚µ‚½”‚Å‚·B
+
+ASPNET_REQUESTS_NOT_AUTHORIZED_011_NAME=Requests Not Authorized
+ASPNET_REQUESTS_NOT_AUTHORIZED_011_HELP=”FØ‚Ì‚È‚¢ƒAƒNƒZƒX‚ðs‚Á‚½‚½‚ßA—v‹‚ÉŽ¸”s‚µ‚Ü‚µ‚½B
+
+ASPNET_REQUESTS_TIMED_OUT_011_NAME=Requests Timed Out
+ASPNET_REQUESTS_TIMED_OUT_011_HELP=ƒ^ƒCƒ€ƒAƒEƒg‚µ‚½—v‹‚Ì”‚Å‚·B
+
+ASPNET_REQUESTS_SUCCEDED_011_NAME=Requests Succeeded
+ASPNET_REQUESTS_SUCCEDED_011_HELP=ŽÀs‚ɬŒ÷‚µ‚½—v‹‚Ì”‚Å‚·B
+
+ASPNET_REQUESTS_TOTAL_011_NAME=Requests Total
+ASPNET_REQUESTS_TOTAL_011_HELP=ƒAƒvƒŠƒP[ƒVƒ‡ƒ“ŠJŽnŒã‚Ì—v‹”‚̇Œv‚Å‚·B
+
+ASPNET_REQUESTS_TOTAL_RATE_011_NAME=Requests/Sec
+ASPNET_REQUESTS_TOTAL_RATE_011_HELP=1 •b‚²‚Æ‚ÉŽÀs‚µ‚½—v‹‚Ì”‚Å‚·B
+
+ASPNET_SESSIONS_ACTIVE_011_NAME=Sessions Active
+ASPNET_SESSIONS_ACTIVE_011_HELP=Œ»ÝƒAƒNƒeƒBƒu‚ȃZƒbƒVƒ‡ƒ“‚Ì”‚Å‚·B
+
+ASPNET_SESSIONS_ABANDONED_011_NAME=Sessions Abandoned
+ASPNET_SESSIONS_ABANDONED_011_HELP=–¾Ž¦“I‚É”jŠü‚³‚ꂽƒZƒbƒVƒ‡ƒ“‚Ì”‚Å‚·B
+
+ASPNET_SESSIONS_TIMED_OUT_011_NAME=Sessions Timed Out
+ASPNET_SESSIONS_TIMED_OUT_011_HELP=ƒ^ƒCƒ€ƒAƒEƒg‚µ‚½ƒZƒbƒVƒ‡ƒ“‚Ì”‚Å‚·B
+
+ASPNET_SESSIONS_TOTAL_011_NAME=Sessions Total
+ASPNET_SESSIONS_TOTAL_011_HELP=ƒAƒvƒŠƒP[ƒVƒ‡ƒ“ŠJŽnŒã‚̃ZƒbƒVƒ‡ƒ“”‚̇Œv‚Å‚·B
+
+ASPNET_TRANSACTIONS_ABORTED_011_NAME=Transactions Aborted
+ASPNET_TRANSACTIONS_ABORTED_011_HELP=’†Ž~‚³‚ꂽƒgƒ‰ƒ“ƒUƒNƒVƒ‡ƒ“‚Ì”‚Å‚·B
+
+ASPNET_TRANSACTIONS_COMMITTED_011_NAME=Transactions Committed
+ASPNET_TRANSACTIONS_COMMITTED_011_HELP=ƒRƒ~ƒbƒg‚µ‚½ƒgƒ‰ƒ“ƒUƒNƒVƒ‡ƒ“‚Ì”‚Å‚·B
+
+ASPNET_TRANSACTIONS_PENDING_011_NAME=Transactions Pending
+ASPNET_TRANSACTIONS_PENDING_011_HELP=ˆ—’†‚̃gƒ‰ƒ“ƒUƒNƒVƒ‡ƒ“‚Å‚·B
+
+ASPNET_TRANSACTIONS_TOTAL_011_NAME=Transactions Total
+ASPNET_TRANSACTIONS_TOTAL_011_HELP=ƒAƒvƒŠƒP[ƒVƒ‡ƒ“ŠJŽnŒã‚̃gƒ‰ƒ“ƒUƒNƒVƒ‡ƒ“”‚̇Œv‚Å‚·B
+
+ASPNET_TRANSACTIONS_RATE_011_NAME=Transactions/Sec
+ASPNET_TRANSACTIONS_RATE_011_HELP=1 •b‚ÉŠJŽn‚³‚ê‚éƒgƒ‰ƒ“ƒUƒNƒVƒ‡ƒ“‚Å‚·B
+
diff --git a/src/inc/CMakeLists.txt b/src/inc/CMakeLists.txt
new file mode 100644
index 0000000000..803ca3bcc7
--- /dev/null
+++ b/src/inc/CMakeLists.txt
@@ -0,0 +1,87 @@
+set( CORGUIDS_IDL_SOURCES
+ cordebug.idl
+ xcordebug.idl
+ clrdata.idl
+ clrinternal.idl
+ xclrdata.idl
+ corprof.idl
+ corpub.idl
+ ivalidator.idl
+ ivehandler.idl
+ gchost.idl
+ fusionpriv.idl
+ mscorsvc.idl
+ tlbimpexp.idl
+ clrprivappxhosting.idl
+ clrprivbinding.idl
+ clrprivhosting.idl
+ clrprivruntimebinders.idl
+ corsym.idl
+ sospriv.idl
+)
+
+if(WIN32)
+#Build for corguids is done in two steps:
+#1. compile .idl to *_i.c : This is done using custom midl command
+#2. compile *_i.c to .lib
+
+# Get the current list of definitions to pass to midl
+get_compile_definitions(MIDL_DEFINITIONS)
+get_include_directories(MIDL_INCLUDE_DIRECTORIES)
+
+
+# Run custom midl command over each idl file
+FIND_PROGRAM( MIDL midl.exe )
+foreach(GENERATE_IDL IN LISTS CORGUIDS_IDL_SOURCES)
+ get_filename_component(IDLNAME ${GENERATE_IDL} NAME_WE)
+ set(OUT_NAME ${CMAKE_CURRENT_BINARY_DIR}/idls_out/${IDLNAME}_i.c)
+ list(APPEND CORGUIDS_SOURCES ${OUT_NAME})
+ add_custom_command(OUTPUT ${OUT_NAME}
+ COMMAND ${MIDL} ${MIDL_INCLUDE_DIRECTORIES} /h ${CMAKE_CURRENT_BINARY_DIR}/idls_out/${IDLNAME}.h ${MIDL_DEFINITIONS} /out ${CMAKE_CURRENT_BINARY_DIR}/idls_out ${CMAKE_CURRENT_SOURCE_DIR}/${GENERATE_IDL}
+ DEPENDS ${CMAKE_CURRENT_SOURCE_DIR}/${GENERATE_IDL}
+ COMMENT "Compiling ${GENERATE_IDL}")
+endforeach(GENERATE_IDL)
+
+set_source_files_properties(${CORGUIDS_SOURCES}
+ PROPERTIES GENERATED TRUE)
+
+# Compile *_i.c as C files
+add_compile_options(/TC)
+
+else()
+
+#The MIDL tool exists for Windows only, so for other systems, we have the prebuilt xxx_i.c files checked in
+
+# The prebuilt files contain extra '!_MIDL_USE_GUIDDEF_' after the #endif, but not in the comment.
+# In order to not to have to modify these prebuilt files, we disable the extra tokens warning.
+add_compile_options(-Wno-extra-tokens)
+
+foreach(IDL_SOURCE IN LISTS CORGUIDS_IDL_SOURCES)
+ get_filename_component(IDLNAME ${IDL_SOURCE} NAME_WE)
+ set(C_SOURCE ../pal/prebuilt/idl/${IDLNAME}_i.c)
+ list(APPEND CORGUIDS_SOURCES ${C_SOURCE})
+endforeach(IDL_SOURCE)
+
+add_compile_options(-fPIC)
+
+endif(WIN32)
+
+# Compile *_i.c to lib
+_add_library(corguids ${CORGUIDS_SOURCES})
+
+# Binplace the inc files for packaging later.
+
+_install (FILES cfi.h
+ cor.h
+ cordebuginfo.h
+ coredistools.h
+ corhdr.h
+ corinfo.h
+ corjit.h
+ corjithost.h
+ opcode.def
+ openum.h
+ gcinfoencoder.h
+ gcinfotypes.h
+ DESTINATION inc)
+_install (TARGETS corguids DESTINATION lib)
diff --git a/src/inc/CrstTypeTool.cs b/src/inc/CrstTypeTool.cs
new file mode 100644
index 0000000000..d6d90e427b
--- /dev/null
+++ b/src/inc/CrstTypeTool.cs
@@ -0,0 +1,990 @@
+// 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.
+
+//
+// This tool exists to transform a high level description of Crst dependencies (i.e. which Crst type may be
+// acquired before or after other Crst types) into a header file that defines a enum to describe each Crst
+// type and tables that map type to numerical ranking and a string based name.
+//
+// To use the tool, run "csc.exe CrstTypeTool.cs" and run the resulting executable.
+//
+// The Crst type definition file is written in a very simple language. Comments begin with '//' and continue
+// to the end of the line. All remaining tokens after comment removal are simply sequences of non-whitespace
+// characters separated by whitespace. Keywords are case-insensitive and identifiers (which are always Crst
+// type names) are case sensitive. The language grammar is given below in EBNF-like form:
+//
+// TopLevel ::= CrstDefinition*
+//
+// CrstDefinition ::= 'Crst' <Crst type name> CrstDependency* 'End'
+//
+// CrstDependency ::= 'AcquiredBefore' <Crst type name>*
+// | 'AcquiredAfter' <Crst type name>*
+// | 'SameLevelAs' <Crst type name>*
+// | 'Unordered'
+//
+// Crst type names match the CrstType enums used in the source code minus the 'Crst' prefix. For example
+// CrstAppDomainCache is written as 'AppDomainCache' in the .def file.
+//
+// The dependency "A 'AcquiredBefore' B" indicates that CrstA may be legally held while CrstB is acquired.
+// Similarly "A 'AcquiredAfter' B" indicates that CrstA may be legally acquired while CrstB is held. "A
+// 'AcquiredBefore' B" is logically equivalent to "B 'AcquiredAfter' A" and authors may enter the dependency
+// is whichever seems to make the most sense to them (or add both rules if they so desire).
+//
+// 'Unordered' indicates that the Crst type does not participate in ranking (there should be very few Crsts
+// like this and those that are know how to avoid or deal with deadlocks manually).
+//
+// 'SameLevelAs' indicates the given Crst type may be acquired alongside any number of instances of the Crst
+// types indicated. "A 'SameLevel' B" automatically implies "B 'SameLevel' A" so it's not necessary to specify
+// the dependency both ways though authors can do so if they wish.
+//
+// Simple validation of the .def file (over and above syntax checking) is performed by this tool prior to
+// emitting the header file. This will catch logic errors such as referencing a Crst type that is not
+// defined or using the 'Unordered' attribute along with any other attribute within a single definition. It
+// will also catch cycles in the dependency graph (i.e. definitions that logically describe a system where the
+// Crst types can't be ranked).
+//
+
+using System;
+using System.Collections.Generic;
+using System.Text;
+using System.IO;
+using System.Text.RegularExpressions;
+
+// The main application class containing the program entry point.
+class CrstTypeTool
+{
+ // A hash containing every Crst type defined by the input .def file along with its attributes. Keyed by
+ // Crst type name (which is case sensitive and doesn't include the 'Crst' enum prefix).
+ Dictionary<string, CrstType> m_crsts = new Dictionary<string, CrstType>();
+
+ // The program entry point.
+ public static int Main()
+ {
+ try
+ {
+ // Calculate the filenames of the input and output files.
+ string inputFile = "CrstTypes.def";
+ string outputFile = "CrstTypes.h";
+
+ // A common error is to forget to check out the CrstTypes.h file first. Handle this case specially
+ // so we can give a good error message.
+ if (File.Exists(outputFile) && (File.GetAttributes(outputFile) & FileAttributes.ReadOnly) != 0)
+ {
+ Console.WriteLine(outputFile + " is read-only, you must check it out of TFS/SD first");
+ return 2;
+ }
+
+ // Create an instance of our application class to store state in (specifically the collection of
+ // Crst type definitions).
+ CrstTypeTool app = new CrstTypeTool();
+
+ // Create a parser for the CrstTypes.def file and run it over the input file (errors are signalled
+ // via exception, in common with all the following steps except validation).
+ new TypeFileParser().ParseFile(inputFile, app.m_crsts);
+
+ // Validate the collection of Crst type definitions we built up during parsing for common logic
+ // errors and the presence of dependency cycles. False is returned from ValidateCrsts if an error
+ // was detected (an error message will have already been output to the console at this point).
+ if (!app.ValidateCrsts())
+ return 3;
+
+ // Perform a topological sort to map each Crst type to a numeric ranking.
+ app.LevelCrsts();
+
+ // Emit the new header file containing Crst type definitions and ranking information.
+ app.WriteHeaderFile(outputFile);
+
+ // If we get here the transformation was successful; inform the user and we're done.
+ Console.WriteLine(outputFile + " successfully updated");
+ return 0;
+ }
+ catch (TypeFileParser.ParseError pe)
+ {
+ // Syntax errors specific to parsing the input file.
+ Console.WriteLine("ParseError: " + pe.Message);
+ return 4;
+ }
+ catch (Exception e)
+ {
+ // Any other general errors (file I/O problems, out of memory etc.).
+ Console.WriteLine("Unexpected exception:");
+ Console.WriteLine(e);
+ return 5;
+ }
+ }
+
+ // Emit the CrstTypes.h output file.
+ void WriteHeaderFile(string fileName)
+ {
+ FileStream stream = new FileStream(fileName, FileMode.Create, FileAccess.Write, FileShare.None);
+ StreamWriter writer = new StreamWriter(stream);
+
+ // Create a collection based on all the Crst types we've stored in the hash. We do this so we can sort
+ // the Crst types we emit (lexically, based on type name).
+ Dictionary<string, CrstType>.ValueCollection crstCollection = m_crsts.Values;
+ CrstType[] crsts = new CrstType[crstCollection.Count];
+ crstCollection.CopyTo(crsts, 0);
+ Array.Sort(crsts);
+
+ // Emit the header. Contains copyright information, the usual goop to avoid multiple inclusion and a
+ // header comment to discourage direct editing and point the user at the CrstTypes.def file instead
+ // (where all will be explained in greater detail).
+ writer.WriteLine("//");
+ writer.WriteLine("// Licensed to the .NET Foundation under one or more agreements.");
+ writer.WriteLine("// The .NET Foundation licenses this file to you under the MIT license.");
+ writer.WriteLine("// See the LICENSE file in the project root for more information.");
+ writer.WriteLine("//");
+ writer.WriteLine();
+ writer.WriteLine("#ifndef __CRST_TYPES_INCLUDED");
+ writer.WriteLine("#define __CRST_TYPES_INCLUDED");
+ writer.WriteLine();
+ writer.WriteLine("// **** THIS IS AN AUTOMATICALLY GENERATED HEADER FILE -- DO NOT EDIT!!! ****");
+ writer.WriteLine();
+ writer.WriteLine("// This file describes the range of Crst types available and their mapping to a numeric level (used by the");
+ writer.WriteLine("// runtime in debug mode to validate we're deadlock free). To modify these settings edit the");
+ writer.WriteLine("// file:CrstTypes.def file and run the clr\\bin\\CrstTypeTool utility to generate a new version of this file.");
+ writer.WriteLine();
+
+ // Emit the CrstType enum to define a value for each crst type (along with the kNumberOfCrstTypes
+ // constant).
+ writer.WriteLine("// Each Crst type is declared as a value in the following CrstType enum.");
+ writer.WriteLine("enum CrstType");
+ writer.WriteLine("{");
+ for (int i = 0; i < crsts.Length; i++)
+ writer.WriteLine(" Crst" + crsts[i].Name + " = " + i.ToString() + ",");
+ writer.WriteLine(" kNumberOfCrstTypes = " + crsts.Length.ToString());
+ writer.WriteLine("};");
+ writer.WriteLine();
+
+ // This is the end of the regular part of the header included by most files.
+ writer.WriteLine("#endif // __CRST_TYPES_INCLUDED");
+ writer.WriteLine();
+
+ // There is a second section of the header intended for inclusion only by vm\Crst.cpp. This contains
+ // some data tables used to map crst type to rank or name. We could instead define two separate
+ // headers, but on the whole it seems simpler to do it this way.
+ writer.WriteLine("// Define some debug data in one module only -- vm\\crst.cpp.");
+ writer.WriteLine("#if defined(__IN_CRST_CPP) && defined(_DEBUG)");
+ writer.WriteLine();
+
+ // Emit the crst type to rank mapping table.
+ writer.WriteLine("// An array mapping CrstType to level.");
+ writer.WriteLine("int g_rgCrstLevelMap[] =");
+ writer.WriteLine("{");
+ foreach (CrstType crst in crsts)
+ writer.WriteLine(" " + crst.Level + ",\t\t\t// Crst" + crst.Name);
+ writer.WriteLine("};");
+ writer.WriteLine();
+
+ // Emit the crst type to name mapping table.
+ writer.WriteLine("// An array mapping CrstType to a stringized name.");
+ writer.WriteLine("LPCSTR g_rgCrstNameMap[] =");
+ writer.WriteLine("{");
+ foreach (CrstType crst in crsts)
+ writer.WriteLine(" \"Crst" + crst.Name + "\",");
+ writer.WriteLine("};");
+ writer.WriteLine();
+
+ // Emit the constant Crst.cpp uses to record an unordered rank.
+ writer.WriteLine("// Define a special level constant for unordered locks.");
+ writer.WriteLine("#define CRSTUNORDERED (-1)");
+ writer.WriteLine();
+
+ // Emit a couple of inline helpers to map type to rank or name (and validate the type while they're at
+ // it).
+ writer.WriteLine("// Define inline helpers to map Crst types to names and levels.");
+ writer.WriteLine("inline static int GetCrstLevel(CrstType crstType)");
+ writer.WriteLine("{");
+ writer.WriteLine(" LIMITED_METHOD_CONTRACT;");
+ writer.WriteLine(" _ASSERTE(crstType >= 0 && crstType < kNumberOfCrstTypes);");
+ writer.WriteLine(" return g_rgCrstLevelMap[crstType];");
+ writer.WriteLine("}");
+ writer.WriteLine("inline static LPCSTR GetCrstName(CrstType crstType)");
+ writer.WriteLine("{");
+ writer.WriteLine(" LIMITED_METHOD_CONTRACT;");
+ writer.WriteLine(" _ASSERTE(crstType >= 0 && crstType < kNumberOfCrstTypes);");
+ writer.WriteLine(" return g_rgCrstNameMap[crstType];");
+ writer.WriteLine("}");
+ writer.WriteLine();
+
+ // And that's the end of the second section of the header file.
+ writer.WriteLine("#endif // defined(__IN_CRST_CPP) && defined(_DEBUG)");
+
+ writer.Close();
+ stream.Close();
+ }
+
+ // Peform checking of the Crst type definitions we've read just read. Various forms of logic error are
+ // scanned for including cycles in the dependency graph. Returns true if no errors are found. If false is
+ // returned a descriptive error message will have already been written to the console.
+ bool ValidateCrsts()
+ {
+ // Look at each Crst type definition in turn.
+ foreach (CrstType crst in m_crsts.Values)
+ {
+ // Catch Crst types that are referenced but never defined.
+ if (!crst.Defined)
+ {
+ Console.WriteLine(String.Format("Error: CrstType 'Crst{0}' is referenced without being defined",
+ crst.Name));
+ return false;
+ }
+
+ // Catch the use of the 'Unordered' attribute alongside the 'AcquiredBefore' attribute (which
+ // indicates an ordering).
+ if (crst.Level == CrstType.CrstUnordered && (crst.AcquiredBeforeList.Count > 0 ||
+ crst.Group != null))
+ {
+ Console.WriteLine(String.Format("Error: CrstType 'Crst{0}' is declared as both unordered and acquired before 'Crst{1}'",
+ crst.Name, crst.AcquiredBeforeList[0].Name));
+ return false;
+ }
+
+ // Catch the use of the 'Unordered' attribute alongside the 'SameLevelAs' attribute (which
+ // indicates an ordering).
+ if (crst.Level == CrstType.CrstUnordered && crst.Group != null)
+ {
+ Console.WriteLine(String.Format("Error: CrstType 'Crst{0}' is declared as both unordered and in the same level as another CrstType",
+ crst.Name));
+ return false;
+ }
+
+ // Catch the simple cycle where the Crst type depends on itself.
+ if (crst.AcquiredBeforeList.Contains(crst))
+ {
+ Console.WriteLine(String.Format("Error: CrstType 'Crst{0}' is declared as being acquired before itself",
+ crst.Name));
+ return false;
+ }
+
+ // Look for deeper cycles using a recursive algorithm in 'FindCycle()'.
+ List<CrstType> cycleList = new List<CrstType>();
+ if (FindCycle(crst, crst, cycleList))
+ {
+ Console.WriteLine(String.Format("Error: CrstType 'Crst{0}' is involved in a dependency cycle with the following CrstTypes:",
+ crst.Name));
+ foreach (CrstType cycleCrst in cycleList)
+ Console.WriteLine(String.Format(" Crst{0}", cycleCrst.Name));
+ return false;
+ }
+ }
+
+ // Perform normalization of each set of Crst types that are included in the same group (i.e. have a
+ // 'SameLevelAs' relationship). Normalization means that each Crst type in a group will have exactly
+ // the same set of dependency rules as all the others.
+ CrstTypeGroup.NormalizeAllRules();
+
+ // The normalization process could have introduced cycles in the dependency graph so run the cycle
+ // detection pass again. We do separate passes like this since normalizing can lead to less intuitive
+ // error messages if a cycle is found: so if the cycle exists before normalization takes place we want
+ // to generate an error message then.
+ foreach (CrstType crst in m_crsts.Values)
+ {
+ List<CrstType> cycleList = new List<CrstType>();
+ if (FindCycle(crst, crst, cycleList))
+ {
+ Console.WriteLine(String.Format("Error: CrstType 'Crst{0}' is involved in a dependency cycle with the following CrstTypes:",
+ crst.Name));
+ foreach (CrstType cycleCrst in cycleList)
+ Console.WriteLine(String.Format(" Crst{0}", cycleCrst));
+ Console.WriteLine("Note that the cycle was detected only after 'SameLevelAs' processing was performed so some CrstType dependencies are implied by peer CrstTypes");
+ return false;
+ }
+ }
+
+ return true;
+ }
+
+ // Recursively determine if a cycle exists in the Crst type dependency graph rooted at the 'rootCrst'
+ // type. The 'currCrst' indicates the next dependency to be examined (it will be the same as the
+ // 'rootCrst' when we're first called). The 'cycleList' argument contains a list of Crst types we've
+ // already examined in this branch of the algorithm and serves both to avoid checking the same node twice
+ // and to provide a list of the involved Crst types should a cycle be detected.
+ // Note that this algorithm is not designed to detect general cycles in the graph, only those that involve
+ // the 'rootCrst' directly. This is somewhat inefficient but gives us a simple way to generate clear error
+ // messages.
+ bool FindCycle(CrstType rootCrst, CrstType currCrst, List<CrstType> cycleList)
+ {
+ // Add the current Crst type to the list of those we've seen.
+ cycleList.Add(currCrst);
+
+ // Look through all the dependencies of the current Crst type.
+ foreach (CrstType childCrst in currCrst.AcquiredBeforeList)
+ {
+ // If we find a reference back to the root Crst type then we've found a cycle. Start backing out
+ // from the recursion (keeping the list of nodes we visited intact) by returning true.
+ if (childCrst == rootCrst)
+ return true;
+
+ // Otherwise iterate over the dependencies of the current node and for each one that we haven't
+ // already seen and recursively extend the search.
+ if (!cycleList.Contains(childCrst))
+ if (FindCycle(rootCrst, childCrst, cycleList))
+ return true;
+ }
+
+ // Didn't find any cycles involving the root and this node; remove this node from the potential cycle
+ // list and return up to our caller indicating such.
+ cycleList.RemoveAt(cycleList.Count - 1);
+
+ return false;
+ }
+
+ // Topologically sort all the Crsts so we can assign a total ordering to them (in the form of a numeric
+ // ranking). Ranks start from 0 (Crst types that may be acquired at any time) and increment from there
+ // (Crst types that may only be acquired if a lower type is not already held).
+ // **** NOTE: The leveling process is destructive in that we will lose all dependency information from the
+ // Crst type definitions during the course of the algorithm.
+ void LevelCrsts()
+ {
+ // Note that Crst type dependency rules have been normalized (by the input parser) so that all
+ // AcquiredBefore/AcquiredAfter relationships have been reduced to AcquiredBefore relationships (i.e.
+ // any rule of the form "A AcquiredAfter B" has been converted to "B AcquiredBefore A". Any
+ // normalization makes the algorithm easier to program, but a normaliztion to AcquiredBefore
+ // relationships was chosen since it makes it particularly easy to implement an algorithm that assigns
+ // ranks beginning with zero and moving up to an arbitrary level. Any type that doesn't have any
+ // AcquiredBefore dependencies can always be ranked at a lower level than any remaining unranked types
+ // by definition and from this we can derive a simple iterative process to rank all the crst types.
+
+ // Calculate how many Crst types we have left to rank (some are not included in this step because
+ // they've been marked as 'Unordered' in the input file).
+ int unsorted = 0;
+ foreach (CrstType crst in m_crsts.Values)
+ if (crst.Level == CrstType.CrstUnassigned)
+ unsorted++;
+
+ // The ranking level we're going to assign to Crst types on the next pass of the algorithm.
+ int currLevel = 0;
+
+ // Iterate while we still have Crst types left to rank. On each pass we'll assign a rank to those
+ // types that no longer have any dependencies forcing them to have a higher rank and then remove
+ // dependency rules involving those newly ranked types from the remaining types.
+ while (unsorted > 0)
+ {
+ // Record a flag indicating whether we manage to assign a rank to at least one Crst type on this
+ // pass. If we ever fail to do this we've hit a cycle (this is just paranoia, the Crst declaration
+ // validation performed in ValidateCrsts() should have detected such a cycle first).
+ bool madeProgress = false;
+
+ // If we spot any types that are in a group (SameLevelAs relationship) then we defer assigning a
+ // rank till we've dealt with any non-group types (we wish to always place type groups in their
+ // very own rank else the Crst rank violation detection code won't detect violations between
+ // members of the group and singleton types that happened to be assigned rank on the same pass).
+ List<CrstTypeGroup> deferredGroups = new List<CrstTypeGroup>();
+
+ // Scan through all the Crst types.
+ foreach (CrstType crst in m_crsts.Values)
+ {
+ // Skip those types that already have a rank assigned.
+ if (crst.Level != CrstType.CrstUnassigned)
+ continue;
+
+ // We're looking for Crst types that no longer have any types that can be acquired while they
+ // are already held. This indicates that it's safe to assign the current rank to them (since
+ // there are no remaining dependencies that need to be ranked first (i.e. with a lower rank
+ // value than this type).
+ if (crst.AcquiredBeforeList.Count == 0)
+ {
+ if (crst.Group == null)
+ {
+ // If this type is not part of the group we can go and assign the rank right away.
+ crst.Level = currLevel;
+ madeProgress = true;
+ unsorted--;
+ }
+ else if (!deferredGroups.Contains(crst.Group))
+ // Otherwise we'll defer ranking this group member until all the singletons are
+ // processed.
+ deferredGroups.Add(crst.Group);
+ }
+ }
+
+ // We've gone through the entire collection of Crst types and assigned the current rank level to
+ // any singleton Crst types that qualify. Now deal with any group members we detected (it's
+ // possible that more than one group qualifies for ranking at this level but we need to be careful
+ // to assign distinct rank values to each group to avoid hiding lock rank violations (since group
+ // members are always allowed to be acquired alongside any other type with the same rank value).
+ // Iterate over each distinct group that we found in this pass.
+ foreach (CrstTypeGroup group in deferredGroups)
+ {
+ // Look at our progress flag here. If it is false then we didn't have any singleton Crst types
+ // ranked at this level and we haven't processed any other groups at this level either. Thus
+ // we can rank this group at the current level. Otherwise at least one type was already ranked
+ // with this level so we need to increment to a new, distinct level to avoid ranking
+ // ambiguity.
+ if (madeProgress)
+ currLevel++;
+
+ // Iterate through each Crst type that is a member of this group assigning them the (same)
+ // current rank.
+ foreach (CrstType crst in group.Members)
+ {
+ // Double check that each member has the same dependencies (i.e. they should all be empty
+ // by now). There should be no way that this error should ever occur, it's just paranoia
+ // on my part.
+ if (crst.AcquiredBeforeList.Count != 0)
+ throw new Exception("Internal error: SameLevel CrstTypes with differing rulesets");
+
+ crst.Level = currLevel;
+ unsorted--;
+ }
+
+ // Once we've processed at least one group we've made progress this iteration.
+ madeProgress = true;
+ }
+
+ // If we didn't manage to assign rank to at least one Crst type then we're not going to do any
+ // better next iteration either (because no state was updated in this iteration). This should only
+ // occur in the presence of a dependency cycle and we shouldn't get that here after a successful
+ // call to ValidateCrsts(), so this check is pure paranoia.
+ if (!madeProgress)
+ {
+ Console.WriteLine(String.Format("{0} unsorted remain", unsorted));
+ throw new Exception("Cycle detected trying to assign level " + currLevel.ToString());
+ }
+
+ // Loop through all the unranked Crsts types and remove any AcquiredBefore relationships that
+ // involve types we've already leveled (since those types, by definition, have already been
+ // assigned a lower rank).
+ foreach (CrstType crst in m_crsts.Values)
+ {
+ if (crst.Level != CrstType.CrstUnassigned)
+ continue;
+ List<CrstType> prunedCrsts = crst.AcquiredBeforeList.FindAll(Unleveled);
+ crst.AcquiredBeforeList = prunedCrsts;
+ }
+
+ // Done with this rank level, move to the next.
+ currLevel++;
+ }
+ }
+
+ // Predicate method used with List<T>.FindAll() to locate Crst types that haven't had their rank assigned
+ // yet.
+ static bool Unleveled(CrstType crst)
+ {
+ return crst.Level == CrstType.CrstUnassigned;
+ }
+}
+
+// Class used to parse a CrstTypes.def file into a dictionary of Crst type definitions. It uses a simple lexer
+// that removes comments then forms tokens out of any consecutive non-whitespace characters. An equally simple
+// recursive descent parser forms Crst instances by parsing the token stream.
+class TypeFileParser
+{
+ // Remember the input file name and the dictionary we're meant to populate.
+ string m_typeFileName;
+ Dictionary<string, CrstType> m_crsts;
+
+ // Compile regular expressions for detecting comments and tokens in the parser input.
+ Regex m_commentRegex = new Regex(@"//.*");
+ Regex m_tokenRegex = new Regex(@"^(\s*(\S+)\s*)*");
+
+ // Input is lexed into an array of tokens. We record the index of the token being currently parsed.
+ Token[] m_tokens;
+ int m_currToken;
+
+ // Parse the given file into Crst type definitions and place these definitions in the dictionary provided.
+ // Syntax errors are signalled via ParseError derived exceptions.
+ public void ParseFile(string typeFileName, Dictionary<string, CrstType> crsts)
+ {
+ m_typeFileName = typeFileName;
+ m_crsts = crsts;
+
+ // Lex the file into tokens.
+ InitTokenStream();
+
+ // Parse the tokens according to the grammar set out at the top of this file.
+ // Loop until we have no further tokens to process.
+ while (!IsEof())
+ {
+ // Grab the next token.
+ Token token = NextToken();
+
+ // We're at the top level, so the token had better be 'Crst'.
+ if (token.Id != KeywordId.Crst)
+ throw new UnexpectedTokenError(token, KeywordId.Crst);
+
+ // OK, parse the rest of this single Crst type definition.
+ ParseCrst();
+ }
+ }
+
+ // Parse a single Crst type definition.
+ void ParseCrst()
+ {
+ // The next token had better be an identifier (the Crst type name).
+ Token token = NextToken();
+ if (token.Id != KeywordId.Id)
+ throw new UnexpectedTokenError(token, KeywordId.Id);
+
+ // The Crst instance might already exist in the dictionary (forward references to a Crst type cause
+ // these entries to auto-vivify). But in that case the entry better not be marked as 'Defined' which
+ // would indicate a double declaration.
+ CrstType crst;
+ if (m_crsts.ContainsKey(token.Text))
+ {
+ crst = m_crsts[token.Text];
+ if (crst.Defined)
+ throw new ParseError(String.Format("Duplicate definition for CrstType '{0}'", token.Text), token);
+ }
+ else
+ {
+ // Otherwise this Crst type hasn't been seen thus far so we allocate a new instance and add it to
+ // the dictionary.
+ crst = new CrstType(token.Text);
+ m_crsts.Add(crst.Name, crst);
+ }
+
+ // We're defining, not just referencing this type.
+ crst.Defined = true;
+
+ // Parse any attributes inside this definition (until we see an 'End' token).
+ bool parsingCrst = true;
+ while (parsingCrst)
+ {
+ // Get the next token. Either some attribute keyword or 'End'.
+ token = NextToken();
+ List<CrstType> list;
+
+ switch (token.Id)
+ {
+
+ case KeywordId.AcquiredBefore:
+ // Simply parse the following list of Crst types into the current type's AcquiredBefore list.
+ ParseList(crst.AcquiredBeforeList);
+ break;
+
+ case KeywordId.AcquiredAfter:
+ // AcquiredAfter is trickier. To make the ranking algorithm's life easier we actually
+ // normalize all rules to the AcquiredBefore form (see LevelCrsts() for the reasoning). So we
+ // capture the list of Crst types that follow the AcquiredAfter keyword and then append the
+ // current type to the AcquiredBefore list of each type found.
+ list = new List<CrstType>();
+ ParseList(list);
+ foreach (CrstType priorCrst in list)
+ priorCrst.AcquiredBeforeList.Add(crst);
+ break;
+
+ case KeywordId.SameLevelAs:
+ // Parse the following list of Crst types them let the CrstTypeGroup class handle the
+ // resulting updates to the type groups we're currently maintaining. See the comments for the
+ // CrstTypeGroup class for more details.
+ list = new List<CrstType>();
+ ParseList(list);
+ foreach (CrstType sameLevelCrst in list)
+ CrstTypeGroup.Join(crst, sameLevelCrst);
+ break;
+
+ case KeywordId.Unordered:
+ crst.Level = CrstType.CrstUnordered;
+ break;
+
+ case KeywordId.End:
+ parsingCrst = false;
+ break;
+
+ default:
+ throw new UnexpectedTokenError(token,
+ KeywordId.AcquiredBefore,
+ KeywordId.AcquiredAfter,
+ KeywordId.SameLevelAs,
+ KeywordId.Unordered);
+ }
+ }
+ }
+
+ // Parse a list of Crst type names. Any other token terminates the list (without error and without
+ // consuming that token from the stream). The list of tokens is returned as a list of corresponding
+ // CrstTypes (which are auto-vivified in the output dictionary if they haven't been declared yet).
+ void ParseList(List<CrstType> list)
+ {
+ // Parse tokens until we find a non-indentifier.
+ while (true)
+ {
+ Token token = NextToken();
+ if (token.Id != KeywordId.Id)
+ {
+ // We found the list terminator. Push the non-identifier token back into the stream for our
+ // caller to parse correctly.
+ UnwindToken();
+ return;
+ }
+
+ // Look up or add a new CrstType corresponding to this type name.
+ CrstType crst;
+ if (m_crsts.ContainsKey(token.Text))
+ crst = m_crsts[token.Text];
+ else
+ {
+ crst = new CrstType(token.Text);
+ m_crsts[crst.Name] = crst;
+ }
+
+ // Add the type to the output list we're building.
+ list.Add(crst);
+ }
+ }
+
+ // Lex the input file into an array of tokens.
+ void InitTokenStream()
+ {
+ StreamReader file = new StreamReader(m_typeFileName);
+ int lineNumber = 1;
+ List<Token> tokenList = new List<Token>();
+
+ // Read the file a line at a time.
+ string line;
+ while ((line = file.ReadLine()) != null)
+ {
+ // Remove comments from the current line.
+ line = m_commentRegex.Replace(line, "");
+
+ // Match all contiguous non-whitespace characters as individual tokens.
+ Match match = m_tokenRegex.Match(line);
+ if (match.Success)
+ {
+ // For each token captured build a token instance and record the token text and the file, line
+ // and column at which it was encountered (these latter in order to produce useful syntax
+ // error messages).
+ CaptureCollection cap = match.Groups[2].Captures;
+ for (int i = 0; i < cap.Count; i++)
+ tokenList.Add(new Token(m_typeFileName, cap[i].Value, lineNumber, cap[i].Index));
+ }
+
+ lineNumber++;
+ }
+
+ // Record the list of tokens we captured as an array and reset the index of the next token to be
+ // handled by the parser.
+ m_tokens = tokenList.ToArray();
+ m_currToken = 0;
+ }
+
+ // Have we run out of tokens to parse?
+ bool IsEof()
+ {
+ return m_currToken >= m_tokens.Length;
+ }
+
+ // Get the next token and throw an exception if we ran out.
+ Token NextToken()
+ {
+ if (m_currToken >= m_tokens.Length)
+ throw new UnexpectedEofError();
+ return m_tokens[m_currToken++];
+ }
+
+ // Push the last token parsed back into the stream.
+ void UnwindToken()
+ {
+ if (m_currToken <= 0)
+ throw new InvalidOperationException();
+ m_currToken--;
+ }
+
+ // The various keywords we can encounter (plus Id for identifiers, which are currently always Crst type
+ // names).
+ internal enum KeywordId
+ {
+ Id,
+ Crst,
+ End,
+ AcquiredBefore,
+ AcquiredAfter,
+ Unordered,
+ SameLevelAs,
+ }
+
+ // Class encapsulating a single token captured from the input file.
+ internal class Token
+ {
+ // Hash of keyword text to enum values.
+ static Dictionary<string, KeywordId> s_keywords;
+
+ // The characters comprising the text of the token from the input file.
+ string m_text;
+
+ // Where the token was found (for error messages).
+ string m_file;
+ int m_line;
+ int m_column;
+
+ // The ID of the keyword this token represents (or KeywordId.Id).
+ KeywordId m_id;
+
+ // Static class initialization.
+ static Token()
+ {
+ // Populate the keyword hash. No sense building complex finite state machines to improve the
+ // efficiency of keyword lexing here since the input file (and keyword set) is never going to be
+ // big enough to justify the extra work.
+ s_keywords = new Dictionary<string, KeywordId>();
+ s_keywords.Add("crst", KeywordId.Crst);
+ s_keywords.Add("end", KeywordId.End);
+ s_keywords.Add("acquiredbefore", KeywordId.AcquiredBefore);
+ s_keywords.Add("acquiredafter", KeywordId.AcquiredAfter);
+ s_keywords.Add("unordered", KeywordId.Unordered);
+ s_keywords.Add("samelevelas", KeywordId.SameLevelAs);
+ }
+
+ public Token(string file, string text, int line, int column)
+ {
+ m_file = file;
+ m_text = text;
+ m_line = line;
+ m_column = column;
+
+ // Map token text to keyword ID. True keywords (not identifiers) are case insensitive so normalize
+ // the text to lower case before performing the keyword hash lookup.
+ string canonName = m_text.ToLower();
+ if (s_keywords.ContainsKey(canonName))
+ m_id = s_keywords[canonName];
+ else
+ m_id = KeywordId.Id;
+ }
+
+ public string Text {get { return m_text; }}
+ public string Location {get { return String.Format("{0} line {1}, column {2}", m_file, m_line, m_column); }}
+ public KeywordId Id {get { return m_id; }}
+ }
+
+ // Base class for all syntax errors reported by the parser.
+ internal class ParseError : Exception
+ {
+ // A raw error message.
+ public ParseError(string message)
+ : base(message)
+ {}
+
+ // An error message tagged with a file, line and column (coming from an error token).
+ public ParseError(string message, Token errorToken)
+ : base(String.Format("{0}: {1}", errorToken.Location, message))
+ {}
+
+ // Produce a textual name for the given keyword type.
+ protected static string IdToName(KeywordId id)
+ {
+ if (id == KeywordId.Id)
+ return "a CrstType name";
+ return String.Format("'{0}'", id.ToString());
+ }
+ }
+
+ // Syntax error used when an unexpected token is encountered which further lists the valid tokens that
+ // would otherwise have been accepted.
+ internal class UnexpectedTokenError : ParseError
+ {
+ // Produce an unexpected token message with a file, line and column coming from an error token and
+ // optionally the names of zero or more tokens that would have been accepted.
+ public UnexpectedTokenError(Token errorToken, params KeywordId[] expected)
+ : base(FormatErrorMessage(errorToken, expected))
+ {}
+
+ static string FormatErrorMessage(Token errorToken, KeywordId[] expected)
+ {
+ StringBuilder message = new StringBuilder(String.Format("Unexpected token '{0}' at {1}",
+ errorToken.Text, errorToken.Location));
+ if (expected.Length == 0)
+ {
+ }
+ else if (expected.Length == 1)
+ {
+ message.Append(String.Format("; expected {0}", IdToName(expected[0])));
+ }
+ else
+ {
+ message.Append("; expected one of ");
+ for (int i = 0; i < expected.Length - 1; i++)
+ message.Append(String.Format("{0}, ", IdToName(expected[i])));
+ message.Append(IdToName(expected[expected.Length - 1]));
+
+ }
+
+ return message.ToString();
+ }
+ }
+
+ // Syntax error used when we unexpectedly ran out of tokens.
+ internal class UnexpectedEofError : ParseError
+ {
+ public UnexpectedEofError()
+ : base("Unexpected end of file")
+ {}
+ }
+}
+
+// This class represents an instance of a Crst type. These are unqiuely identified by case-sensitive name (the
+// same as the enum name used in vm code, minus the 'Crst' prefix).
+class CrstType : IComparable
+{
+ // Special level constants used to indicate unordered Crst types or those types we haven't gotten around
+ // to ranking yet.
+ public static readonly int CrstUnordered = -1;
+ public static readonly int CrstUnassigned = -2;
+
+ // Name of the type, e.g. "AppDomainCache" for the CrstAppDomainCache type.
+ string m_name;
+
+ // The numeric ranking assigned to this type. Starts as CrstUnassigned and then becomes either
+ // CrstUnordered (while parsing the input file) or a number >= 0 (during LevelCrsts()).
+ int m_level;
+
+ // List of Crst types that can be legally acquired while this one is held. (AcquiredAfter relationships
+ // are by switching the terms and adding to the second type's AcquiredBefore list).
+ List<CrstType> m_acquiredBeforeCrsts;
+
+ // Either null if this Crst type is not in (or has not yet been determined to be in) a SameLevelAs
+ // relationship or points to a CrstTypeGroup that records all the sibling types at the same level (that
+ // have been discovered thus far during parsing).
+ CrstTypeGroup m_group;
+
+ // Set once a definition for this type has been discovered. Used to detect double definitions and types
+ // referenced without definitions.
+ bool m_defined;
+
+ public CrstType(string name)
+ {
+ m_name = name;
+ m_level = CrstUnassigned;
+ m_acquiredBeforeCrsts = new List<CrstType>();
+ m_group = null;
+ m_defined = false;
+ }
+
+ public string Name {get { return m_name; }}
+ public int Level {get { return m_level; } set { m_level = value; }}
+ public List<CrstType> AcquiredBeforeList {get { return m_acquiredBeforeCrsts; } set { m_acquiredBeforeCrsts = value; }}
+ public CrstTypeGroup Group {get { return m_group; } set { m_group = value; }}
+ public bool Defined {get {return m_defined; } set { m_defined = value; }}
+
+ // Helper used to sort CrstTypes. The sort order is lexical based on the type name.
+ public int CompareTo(object other)
+ {
+ return m_name.CompareTo(((CrstType)other).m_name);
+ }
+}
+
+// Every time a SameLevelAs relationship is used we need to be careful to keep track of the transitive closure
+// of all types bound in the relationship. That's because such a relationship impacts the other dependency
+// rules (each member of a SameLevelAs group must behave as though it has exactly the same dependency rules as
+// all the others). Identifying all the members is tricky because "A SameLevelAs B" and "B SameLevelAs C"
+// implies "A SameLevelAs C". So we use a separate tracking structure, instances of the CrstTypeGroup type, to
+// do the bookkeeping for us. Each Crst type belongs to either zero or one CrstTypeGroups. As we find new
+// SameLevelAs relationships we create new groups, add types to existing groups or merge groups (as previous
+// distinct groups are merged by the discovery of a SameLevelAs relationship that links them). By the time
+// parsing has finished we are guaranteed to have discovered all the distinct, disjoint groups and to have
+// fully populated them with the transitive closure of all related types. We can them normalize all groups
+// members so they share the same AcquiredBefore relationships.
+class CrstTypeGroup
+{
+ // We record every group that has been formed so far. This makes normalizing all groups easier.
+ static List<CrstTypeGroup> s_groups = new List<CrstTypeGroup>();
+
+ // Crst types that are members of the current group. There are no duplicates in this list.
+ List<CrstType> m_members = new List<CrstType>();
+
+ // Declare a SameLevelAs relationship between the two Crst types given. Groups will be assigned, created
+ // or merged as required to maintain our guarantees (each CrstType is a member of at most one group and
+ // all CrstTypes involved in the same transitive closure of a SameLevelAs relationship are members of one
+ // group).
+ public static void Join(CrstType crst1, CrstType crst2)
+ {
+ CrstTypeGroup group;
+
+ if (crst1 == crst2)
+ {
+ // In this case the type refers to itself. Create a singleton group for this type if it doesn't
+ // already exist.
+ if (crst1.Group == null)
+ {
+ group = new CrstTypeGroup();
+ group.m_members.Add(crst1);
+
+ s_groups.Add(group);
+
+ crst1.Group = group;
+ }
+ }
+ else if (crst1.Group == null && crst2.Group == null)
+ {
+ // Neither types belong to a group already. So we can create a new one and add both types to it.
+ group = new CrstTypeGroup();
+ group.m_members.Add(crst1);
+ group.m_members.Add(crst2);
+
+ s_groups.Add(group);
+
+ crst1.Group = group;
+ crst2.Group = group;
+ }
+ else if (crst1.Group == null)
+ {
+ // The first type doesn't belong to a group yet but the second does. So we can simply add the
+ // first type to the second group.
+ group = crst2.Group;
+ group.m_members.Add(crst1);
+
+ crst1.Group = group;
+ }
+ else if (crst2.Group == null)
+ {
+ // As for the case above but the group/no-group positions are reversed.
+ group = crst1.Group;
+ group.m_members.Add(crst2);
+
+ crst2.Group = group;
+ }
+ else if (crst1.Group != crst2.Group)
+ {
+ // Both types belong to different groups so we'll have to merge them. Add the members of group 2
+ // to group 1 and throw away group 2.
+ group = crst1.Group;
+ CrstTypeGroup absorbGroup = crst2.Group;
+ foreach (CrstType crst in absorbGroup.m_members)
+ {
+ group.m_members.Add(crst);
+ crst.Group = group;
+ }
+
+ s_groups.Remove(absorbGroup);
+ }
+
+ // The only case left is when both types are already in the same group and there's no work needed in
+ // this case.
+ }
+
+ // Normalize all the groups we created during parsing. See below for the definition of normalization.
+ public static void NormalizeAllRules()
+ {
+ foreach (CrstTypeGroup group in s_groups)
+ group.NormalizeRules();
+ }
+
+ // Normalize this group. This involves adjusting the AcquiredBefore list of each member to be the union of
+ // all such rules within the group. This step allows us to detect cycles in the dependency graph that
+ // would otherwise remain hidden if we only examined the unnormalized AcquiredBefore rules.
+ void NormalizeRules()
+ {
+ // This local will contain the union of all AcquiredBefore rules.
+ List<CrstType> acquiredBeforeList = new List<CrstType>();
+
+ // Iterate through each member of the group.
+ foreach (CrstType crst in m_members)
+ {
+ // Add each AcquiredBefore rule we haven't already seen to the union.
+ foreach (CrstType afterCrst in crst.AcquiredBeforeList)
+ if (!acquiredBeforeList.Contains(afterCrst))
+ acquiredBeforeList.Add(afterCrst);
+ }
+
+ // Reset each member's AcquiredBefore list to a copy of the union we calculated. Note it's important
+ // to make a (shallow) copy because the ranking process modifies this list and so a shared copy would
+ // cause unexpected results.
+ foreach (CrstType crst in m_members)
+ crst.AcquiredBeforeList = acquiredBeforeList.GetRange(0, acquiredBeforeList.Count);
+ }
+
+ public List<CrstType> Members {get { return m_members; }}
+}
diff --git a/src/inc/CrstTypes.def b/src/inc/CrstTypes.def
new file mode 100644
index 0000000000..bb6e710647
--- /dev/null
+++ b/src/inc/CrstTypes.def
@@ -0,0 +1,781 @@
+// 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.
+
+//
+// This file is used to describe the different types of Crst and their dependencies on other Crst types (in
+// terms of which types may be legally held while others are acquired).
+//
+// The CrstTypeTool utility is used to parse this file, verify that there are no logical inconsistencies (such
+// as a cycle in the dependencies) and generate an enum value and numerical ranking for each type. This
+// ranking is used by the runtime (in checked builds) to verify that none of the rules described below are
+// violated (which could lead to a deadlock).
+//
+// When you add a new Crst type you need to be aware of which Crst types may be already held when your Crst is
+// acquired and which other types may be subsequently acquired. You can then add a Crst definition to this
+// file and annotate it with those dependencies. Running CrstTypeTool will check to see if this introduces a
+// potential deadlock problem and if everything checks out will generate a new version of
+// file:CrstTypes.h (be sure to check this file out from TFS/SD before running CrstTypeTool).
+//
+// The format of this file is a very simple language. Comments are introduced with '//' and continue to the
+// end of the line. Keywords are case insensitive (Crst type names, however, are case sensitive since they'll
+// be translated directly to C++ enum values). Crst type names are used without the 'Crst' prefix used in C++
+// code (e.g. CrstAppDomainCache is referred to as AppDomainCache). The following words are reserved keywords
+// and may not be used as the names of Crst types:
+// Crst
+// End
+// AcquiredBefore
+// AcquiredAfter
+// Unordered
+// SameLevelAs
+//
+// Each Crst type definition has the following format (where [] indicates optional and ... indicates zero or
+// more repetitions):
+// Crst <type name>
+// [AcquiredBefore <type name>...]
+// [AcquiredAfter <type name>...]
+// [SameLevelAs <type name>...]
+// [Unordered]
+// End
+//
+// For example:
+// Crst Foo
+// AcquiredBefore Bar
+// AcquiredAfter Zob Baz
+// SameLevelAs Foo
+// End
+//
+// This introduces a new Crst type Foo (CrstFoo inside the runtime). This type may be legally acquired when
+// the current thread holds Crst instances of type Zob, Bar or even other instances of Foo. While Foo is held
+// it is legal to acquire Crsts of type Bar. Assuming that this definition does not introduce any dependency
+// cycles, CrstTypeTool will assign a numeric rank to CrstFoo that maximizes the chance that any other Crst
+// type interaction you didn't explicitly specify (e.g. holding Foo while taking a Crst of type Wibble) will
+// generate a ranking violation assert in the checked build.
+//
+// Note that the following set of definitions:
+// Crst A AcquiredBefore B End
+// Crst B End
+//
+// Crst A End
+// Crst B AcquiredAfter A End
+//
+// Crst A AcquiredBefore B End
+// Crst B AcquiredAfter A End
+//
+// are all equivalent. You are free to use whichever variant seems clearest to you (CrstTypeTool will tell you
+// if you introduce conflicting rules). Similarly "A SameLevelAs B" implies "B SameLevelAs A". The initial
+// contents of this file uses AcquiredBefore in preference to AcquiredAfter purely because it was generated
+// automatically by a profiling mechanism (the initial rules were seeded from observations of Crst usage while
+// running our test suites). Feel free to add meaningful comments to existing rules if you feel they can
+// usefully clarify the reasons for particular dependencies.
+//
+// CrstTypeTool is a csScript file at file:..\..\bin\CrstTypeTool.csScript. Simply typing "CrstTypeTool" from a
+// clrenv command window prompt should rebuild file:CrstTypes.h from the current CrstTypes.def (again,
+// remember to check out CrstTypes.h first).
+// Note: If you cannot run the script from command line, because of this error:
+// Script language type is unsupported.
+// Use /? for more help on usage.
+// Or because .csscript extension is not associated with anything on your machine,
+// Then use "csc.exe CrstTypeTool.csscript" from ClrEnv environment and run the resulting executable.
+//
+// Each Crst type definition is currently in alphabetical order. Please maintain this convention.
+//
+
+Crst AllowedFiles
+ AcquiredBefore JumpStubCache UniqueStack
+End
+
+Crst AppDomainCache
+ AcquiredBefore FusionBindContext FusionLoadContext LoaderHeap UniqueStack UnresolvedClassLock
+End
+
+Crst AppDomainHandleTable
+ AcquiredBefore AvailableParamTypes HandleTable IbcProfile SyncBlockCache SystemDomainDelayedUnloadList
+ ThreadStore SystemDomain
+End
+
+Crst ArgBasedStubCache
+End
+
+Crst AssemblyIdentityCache
+End
+
+Crst AssemblyLoader
+ AcquiredBefore DeadlockDetection UniqueStack
+End
+
+Crst AvailableClass
+ AcquiredBefore LoaderHeap
+End
+
+Crst AssemblyDependencyGraph
+End
+
+Crst AvailableParamTypes
+ AcquiredBefore FusionBindContext FusionLoadContext IbcProfile LoaderHeap
+End
+
+Crst BaseDomain
+ AcquiredBefore LoaderHeap UniqueStack
+End
+
+Crst CCompRC
+ Unordered
+End
+
+Crst Cer
+ AcquiredBefore JumpStubCache UniqueStack
+End
+
+Crst ClassFactInfoHash
+ AcquiredBefore SyncBlockCache ThreadStore
+End
+
+Crst ClassInit
+ AcquiredBefore DeadlockDetection IbcProfile
+ SameLevelAs Jit
+End
+
+Crst ClrNotification
+ Unordered
+End
+
+Crst CrstCLRPrivBinderLocalWinMDPath
+End
+
+Crst CLRPrivBinderMaps
+End
+
+Crst CLRPrivBinderMapsAdd
+ AcquiredBefore CLRPrivBinderMaps
+End
+
+Crst COMWrapperCache
+ AcquiredBefore HandleTable UniqueStack
+End
+
+Crst ConnectionNameTable
+End
+
+Crst Contexts
+ AcquiredBefore AvailableParamTypes Cer ClassInit DeadlockDetection DomainLocalBlock FuncPtrStubs
+ GlobalStrLiteralMap Jit LoaderHeap ModuleLookupTable RWLock SigConvert SingleUseLock
+ StubUnwindInfoHeapSegments SyncBlockCache TypeIDMap UnresolvedClassLock FusionClosure
+End
+
+Crst CoreCLRBinderLog
+ Unordered
+End
+
+Crst CSPCache
+ AcquiredBefore JumpStubCache
+End
+
+Crst DeadlockDetection
+End
+
+Crst DebuggerController
+ // AcquiredBefore DebuggerHeapLock DebuggerJitInfo LoaderHeap
+
+ // See bug: 581892. This has a conflict with CrstInstMethodHashTableRanking.
+ // The controller logic will be moved to OOP in V3, and so this lock will no longer be necessary.
+ // Fixing this in-proc would be difficult, and it would all be throwaway as we go oop.
+ Unordered
+End
+
+// This is a leaf debugger lock.
+Crst DebuggerFavorLock
+ AcquiredAfter DebuggerJitInfo DebuggerMutex
+End
+
+// This is the lock used by the DebuggerHeapExecutableMemoryAllocator for allocating/freeing memory.
+Crst DebuggerHeapExecMemLock
+End
+
+// Debugger Heap lock is the smallest of the debugger locks.
+Crst DebuggerHeapLock
+ AcquiredAfter DebuggerFavorLock DebuggerJitInfo DebuggerMutex
+ // Disabled per bug 581892
+ // AcquiredAfter DebuggerController
+End
+
+Crst DebuggerJitInfo
+ AcquiredBefore DebuggerHeapLock
+End
+
+// This is the major debugger lock.
+// It's the largest of the debugger locks.
+Crst DebuggerMutex
+ AcquiredBefore AvailableParamTypes ConnectionNameTable
+ DynamicIL LoaderHeap ModuleLookupTable ThreadStore
+
+ // Disabled per bug 581892
+ // AcquiredBefore DebuggerController
+ AcquiredBefore DebuggerHeapLock DebuggerJitInfo
+
+End
+
+// This lock is used only for testing data consistency (see code:DataTest::TestDataSafety)
+// and is released before taking any other lock except for CrstDataTest2
+Crst DataTest1
+ AcquiredAfter DebuggerMutex
+End
+
+// This lock is used only for testing data consistency (see code:DataTest::TestDataSafety)
+// and is released before taking any other lockCrst DataTest2
+Crst DataTest2
+ AcquiredAfter DataTest1
+End
+
+
+Crst DbgTransport
+End
+
+Crst DelegateToFPtrHash
+End
+
+Crst DomainLocalBlock
+ AcquiredBefore AppDomainHandleTable IbcProfile LoaderHeap SystemDomainDelayedUnloadList UniqueStack
+End
+
+Crst DynamicIL
+End
+
+Crst DynamicMT
+ AcquiredBefore IbcProfile
+End
+
+Crst DynLinkZapItems
+ AcquiredBefore LoaderHeap
+End
+
+Crst EventStore
+End
+
+Crst Exception
+End
+
+Crst ExecuteManLock
+ AcquiredBefore UniqueStack
+End
+
+Crst ExecuteManRangeLock
+End
+
+Crst FCall
+ AcquiredBefore LoaderHeap
+End
+
+Crst RetThunkCache
+ AcquiredBefore LoaderHeap
+End
+
+Crst FriendAccessCache
+ AcquiredBefore JumpStubCache UniqueStack
+End
+
+Crst FuncPtrStubs
+ AcquiredBefore IbcProfile LoaderHeap UniqueStack CodeFragmentHeap JumpStubCache PatchEntryPoint
+End
+
+Crst FusionAppCtx
+ AcquiredBefore FusionPolicyConfigPool FusionSingleUse FusionAssemblyDownload
+End
+
+Crst FusionAssemblyDownload
+ AcquiredBefore FusionDownload UniqueStack
+End
+
+Crst FusionBindResult
+End
+
+Crst FusionClb
+End
+
+Crst FusionClosure
+ AcquiredBefore FusionBindContext FusionLoadContext FusionAppCtx FusionClosureGraph DomainLocalBlock ModuleFixup
+End
+
+Crst FusionClosureGraph
+ AcquiredBefore FusionAppCtx FusionBindContext FusionLoadContext
+End
+
+Crst FusionConfigSettings
+End
+
+Crst FusionDownload
+End
+
+Crst FusionLoadContext
+ AcquiredBefore PEImage
+End
+
+Crst FusionBindContext
+ AcquiredBefore PEImage
+End
+
+Crst FusionLog
+ AcquiredBefore IbcProfile UniqueStack
+End
+
+Crst FusionWarningLog
+ AcquiredBefore FusionBindContext FusionLoadContext FusionLog
+End
+
+Crst FusionNgenIndex
+ AcquiredBefore SystemDomainDelayedUnloadList
+End
+
+Crst FusionNgenIndexPool
+ AcquiredBefore SystemDomainDelayedUnloadList
+End
+
+Crst FusionPcyCache
+End
+
+Crst FusionPolicyConfigPool
+ AcquiredBefore UniqueStack
+End
+
+Crst FusionSingleUse
+ AcquiredBefore PEImage
+End
+
+Crst FusionIsoLibInit
+End
+
+Crst NativeBinderInit
+ Unordered
+End
+
+Crst NativeImageCache
+ Unordered
+End
+
+Crst GCMemoryPressure
+End
+
+Crst GlobalStrLiteralMap
+ AcquiredBefore HandleTable IbcProfile SyncBlockCache SystemDomainDelayedUnloadList ThreadStore UniqueStack
+End
+
+Crst HandleTable
+ SameLevelAs HandleTable
+End
+
+Crst HostAssemblyMap
+End
+
+Crst HostAssemblyMapAdd
+ AcquiredBefore HostAssemblyMap
+End
+
+Crst IbcProfile
+End
+
+Crst IJWFixupData
+ AcquiredBefore FuncPtrStubs IJWHash LoaderHeap
+End
+
+Crst IJWHash
+End
+
+Crst ILStubGen
+ AcquiredBefore DeadlockDetection UniqueStack
+End
+
+Crst InstMethodHashTable
+ AcquiredBefore FusionBindContext FusionLoadContext LoaderHeap UniqueStack JumpStubCache
+End
+
+Crst InterfaceVTableMap
+End
+
+Crst Interop
+ AcquiredBefore AppDomainHandleTable AvailableParamTypes Cer ClassInit DeadlockDetection DomainLocalBlock
+ HandleTable InstMethodHashTable InteropData JitGenericHandleCache LoaderHeap SigConvert
+ StubDispatchCache StubUnwindInfoHeapSegments SyncBlockCache TypeIDMap UnresolvedClassLock
+End
+
+Crst InteropData
+ AcquiredBefore LoaderHeap UniqueStack
+End
+
+Crst IOThreadpoolWorker
+ AcquiredBefore ThreadIdDispenser ThreadStore
+End
+
+Crst IsJMCMethod
+End
+
+Crst ISymUnmanagedReader
+ AcquiredBefore PEImagePDBStream UniqueStack JumpStubCache
+End
+
+Crst Jit
+ AcquiredBefore DeadlockDetection JumpStubCache
+ SameLevelAs ClassInit
+End
+
+Crst JitGenericHandleCache
+End
+
+Crst JitPerf
+ Unordered
+End
+
+Crst JumpStubCache
+ AcquiredBefore ExecuteManRangeLock LoaderHeap SingleUseLock
+ AcquiredAfter AppDomainCache ExecuteManLock FusionAssemblyDownload FusionNgenIndex FusionNgenIndexPool
+ ILStubGen SharedBaseDomain ThreadpoolTimerQueue ThreadpoolWaitThreads
+ TPMethodTable TypeIDMap BaseDomain AssemblyLoader
+End
+
+Crst ListLock
+ Unordered
+End
+
+// Leaflock leveling, used for crsts that explicitly want to be a leaf lock
+Crst LeafLock
+End
+
+Crst LoaderAllocator
+ AcquiredBefore AppDomainHandleTable HandleTable UniqueStack ThreadStore
+ AcquiredAfter DomainLocalBlock
+End
+
+Crst LoaderAllocatorReferences
+ AcquiredBefore LoaderAllocator
+ AcquiredAfter PendingTypeLoadEntry InstMethodHashTable
+End
+
+Crst AssemblyList
+ AcquiredAfter LoaderAllocatorReferences ThreadStore AssemblyLoader
+End
+
+Crst LoaderHeap
+End
+
+Crst Mda
+End
+
+Crst MetadataTracker
+ Unordered
+End
+
+Crst StubCache
+ AcquiredBefore LoaderHeap
+End
+
+Crst ModIntPairList
+End
+
+Crst Module
+ AcquiredBefore LoaderHeap UniqueStack
+End
+
+Crst ModuleFixup
+ AcquiredBefore AppDomainHandleTable GlobalStrLiteralMap IbcProfile SyncBlockCache
+End
+
+Crst ModuleLookupTable
+ AcquiredBefore LoaderHeap
+End
+
+Crst MUThunkHash
+End
+
+Crst Nls
+End
+
+Crst ObjectList
+ SameLevelAs ObjectList
+End
+
+Crst OnEventManager
+End
+
+Crst PatchEntryPoint
+End
+
+Crst PEFileSecurityManager
+End
+
+Crst PEImage
+ AcquiredBefore UniqueStack
+End
+
+Crst ILFingerprintCache
+ AcquiredBefore PEImage
+End
+
+Crst PEImagePDBStream
+End
+
+Crst PendingTypeLoadEntry
+ AcquiredBefore AppDomainCache AppDomainHandleTable AssemblyLoader AvailableClass AvailableParamTypes
+ BaseDomain ClassInit DeadlockDetection DebuggerController DebuggerJitInfo DebuggerMutex
+ DomainLocalBlock DynLinkZapItems Exception ExecuteManRangeLock FuncPtrStubs
+ FusionAppCtx FusionAssemblyDownload FusionBindResult FusionClosure FusionDownload
+ FusionBindContext FusionLoadContext FusionNgenIndex FusionNgenIndexPool FusionPcyCache
+ FusionPolicyConfigPool FusionSingleUse GlobalStrLiteralMap HandleTable IbcProfile
+ IJWFixupData IJWHash ISymUnmanagedReader Jit JumpStubCache LoaderHeap ModIntPairList
+ Module ModuleLookupTable PEImage SecurityStackwalkCache SharedAssemblyCreate
+ SharedBaseDomain SigConvert SingleUseLock StubDispatchCache StubUnwindInfoHeapSegments
+ SyncBlockCache SystemDomain ThreadIdDispenser ThreadStore TypeIDMap UnresolvedClassLock
+ SameLevelAs PendingTypeLoadEntry
+End
+
+Crst PinHandle
+End
+
+// ProfilerGCRefDataFreeList synchronizes access to the profiler API's list of
+// free, previously allocated structures that track moved references and
+// root references during a GC.
+Crst ProfilerGCRefDataFreeList
+End
+
+// ProfilingAPIStatus serializes attempts to transition the global status
+// from state to state, and access to the ProfilerDetachInfo structure
+// between the thread executing DetachProfiler(), and the DetachThread
+// carrying out the evacuation order.
+Crst ProfilingAPIStatus
+End
+
+Crst PublisherCertificate
+End
+
+Crst RCWCache
+ AcquiredBefore IbcProfile LoaderHeap RCWCleanupList
+End
+
+Crst RCWRefCache
+ AcquiredBefore HandleTable
+End
+
+Crst RCWCleanupList
+End
+
+Crst ReDacl
+End
+
+Crst Reflection
+ AcquiredBefore LoaderHeap UnresolvedClassLock
+End
+
+// Used to synchronize all rejit information stored in a given AppDomain. One of these
+// crsts exist per domain (except the SharedDomain--see below)
+Crst ReJITDomainTable
+ AcquiredBefore LoaderHeap SingleUseLock DeadlockDetection JumpStubCache DebuggerController
+ AcquiredAfter ReJITGlobalRequest ThreadStore GlobalStrLiteralMap SystemDomain DebuggerMutex
+End
+
+// Same as ReJITDomainTable, but this is for the SharedDomain's ReJitManager. Only
+// reason we have a special type for the SharedDomain's ReJitManager is so that we can
+// explicitly level this guy differently from ReJITDomainTable, so that both the
+// SharedDomain's ReJitManager table lock AND one non-SharedDomain's ReJitManager table
+// lock may be held simultaneously. This is useful during ETW rundown.
+Crst ReJITSharedDomainTable
+ AcquiredBefore ReJITDomainTable
+ AcquiredAfter ReJITGlobalRequest ThreadStore GlobalStrLiteralMap SystemDomain DebuggerMutex
+End
+
+// Used to synchronize all global requests (which may span multiple AppDomains) which add
+// new functions to rejit tables, or request Reverts on existing functions in the rejit
+// tables. One of these crsts exist per runtime.
+Crst ReJITGlobalRequest
+ AcquiredBefore ThreadStore ReJITSharedDomainTable ReJITDomainTable SystemDomain
+End
+
+// ETW infrastructure uses this crst to protect a hash table of TypeHandles which is
+// used to remember which types have been logged (to avoid duplicate logging of the
+// same type).
+Crst EtwTypeLogHash
+ AcquiredAfter ThreadStore AllowedFiles Cer TPMethodTable
+ AcquiredBefore AvailableParamTypes ConnectionNameTable DeadlockDetection DebuggerController
+ DebuggerHeapLock DebuggerJitInfo DynamicIL ExecuteManRangeLock HandleTable IbcProfile
+ JitGenericHandleCache JumpStubCache LoaderHeap ModuleLookupTable ProfilingAPIStatus
+ ProfilerGCRefDataFreeList RWLock SingleUseLock SyncBlockCache SystemDomainDelayedUnloadList
+ ThreadIdDispenser ThreadStaticDataHashTable
+End
+
+Crst Remoting
+ AcquiredBefore AppDomainHandleTable AvailableParamTypes Cer ClassInit DeadlockDetection DebuggerController
+ DebuggerHeapLock DebuggerJitInfo DebuggerMutex DomainLocalBlock ExecuteManRangeLock
+ FuncPtrStubs GlobalStrLiteralMap HandleTable InstMethodHashTable Jit JitGenericHandleCache
+ JumpStubCache LoaderHeap StubCache Module ModuleLookupTable SecurityStackwalkCache SigConvert
+ SingleUseLock StubUnwindInfoHeapSegments SyncBlockCache SystemDomainDelayedUnloadList
+ ThreadStore UnresolvedClassLock PendingTypeLoadEntry
+End
+
+Crst RWLock
+End
+
+Crst SavedExceptionInfo
+ AcquiredBefore DebuggerController
+End
+
+Crst SaveModuleProfileData
+End
+
+Crst SecurityPolicyCache
+End
+
+Crst SecurityPolicyInit
+ AcquiredBefore SecurityPolicyCache
+End
+
+Crst SecurityStackwalkCache
+End
+
+Crst SharedAssemblyCreate
+ AcquiredBefore DeadlockDetection UniqueStack
+End
+
+Crst SharedBaseDomain
+ AcquiredBefore UniqueStack
+End
+
+Crst SigConvert
+ AcquiredBefore LoaderHeap
+End
+
+Crst SingleUseLock
+ AcquiredBefore ExecuteManRangeLock LoaderHeap UniqueStack DebuggerJitInfo
+End
+
+Crst UnwindInfoTableLock
+ AcquiredAfter StubUnwindInfoHeapSegments SingleUseLock
+ AcquiredBefore StressLog
+End
+
+Crst SpecialStatics
+End
+
+Crst StressLog
+ Unordered
+End
+
+Crst StrongName
+End
+
+Crst CodeFragmentHeap
+ AcquiredBefore SingleUseLock
+End
+
+Crst StubDispatchCache
+End
+
+Crst StubUnwindInfoHeapSegments
+ AcquiredAfter StubCache
+End
+
+Crst SyncBlockCache
+ AcquiredBefore ThreadIdDispenser
+End
+
+Crst SyncHashLock
+End
+
+Crst SystemBaseDomain
+End
+
+Crst SystemDomain
+ AcquiredBefore DebuggerMutex HandleTable IbcProfile SaveModuleProfileData SecurityPolicyCache
+ ThreadIdDispenser ThreadStore
+End
+
+Crst SystemDomainDelayedUnloadList
+End
+
+Crst ThreadIdDispenser
+End
+
+Crst ThreadpoolEventCache
+End
+
+Crst ThreadpoolTimerQueue
+ AcquiredBefore UniqueStack
+End
+
+Crst ThreadpoolWaitThreads
+ AcquiredBefore UniqueStack
+End
+
+Crst ThreadpoolWorker
+ AcquiredBefore ThreadIdDispenser ThreadStore
+End
+
+Crst ThreadStaticDataHashTable
+ AcquiredBefore SyncBlockCache
+End
+
+Crst ThreadStore
+ AcquiredBefore AvailableParamTypes ConnectionNameTable DeadlockDetection DebuggerController
+ DebuggerHeapLock DebuggerJitInfo DynamicIL ExecuteManRangeLock HandleTable IbcProfile
+ JitGenericHandleCache JumpStubCache LoaderHeap ModuleLookupTable ProfilingAPIStatus
+ ProfilerGCRefDataFreeList RWLock SingleUseLock SyncBlockCache SystemDomainDelayedUnloadList
+ ThreadIdDispenser ThreadStaticDataHashTable
+End
+
+Crst TPMethodTable
+ AcquiredBefore DebuggerHeapLock LoaderHeap UniqueStack AvailableParamTypes
+End
+
+Crst TypeIDMap
+ AcquiredBefore UniqueStack
+End
+
+Crst TypeEquivalenceMap
+ AcquiredBefore LoaderHeap
+End
+
+Crst UMThunkHash
+End
+
+Crst UniqueStack
+ AcquiredBefore LoaderHeap
+End
+
+Crst UnresolvedClassLock
+ AcquiredBefore AvailableParamTypes DynLinkZapItems IbcProfile JumpStubCache
+End
+
+Crst WrapperTemplate
+ AcquiredBefore IbcProfile
+End
+
+Crst UMEntryThunkCache
+ AcquiredBefore LoaderHeap
+End
+
+Crst PinnedByrefValidation
+End
+
+Crst AssemblyUsageLog
+End
+
+Crst VSDIndirectionCellLock
+ AcquiredBefore LoaderHeap
+End
+
+Crst MulticoreJitHash
+End
+
+Crst MulticoreJitManager
+ AcquiredBefore MulticoreJitHash ThreadStore
+End
+
+Crst WinRTFactoryCache
+ AcquiredBefore HandleTable
+End
+
+Crst SqmManager
+End
+
+Crst StackSampler
+End
+
+Crst InlineTrackingMap
+ AcquiredBefore IbcProfile
+End \ No newline at end of file
diff --git a/src/inc/MSCOREE.IDL b/src/inc/MSCOREE.IDL
new file mode 100644
index 0000000000..67605e23d4
--- /dev/null
+++ b/src/inc/MSCOREE.IDL
@@ -0,0 +1,2438 @@
+// 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.
+//
+
+//
+/**************************************************************************************
+ ** **
+ ** Mscoree.idl - interface definitions for mscoree.dll **
+ ** **
+ **************************************************************************************/
+
+#ifdef FEATURE_CORECLR
+// API deprecation does not apply to CoreCLR
+cpp_quote("#define DECLARE_DEPRECATED ")
+cpp_quote("#define DEPRECATED_CLR_STDAPI STDAPI")
+#else // !FEATURE_CORECLR
+// API deprecation is only applicable to Desktop runtime.
+cpp_quote("#ifndef USE_DEPRECATED_CLR_API_WITHOUT_WARNING")
+cpp_quote("#define DEPRECATED_CLR_API_MESG \"This API has been deprecated. Refer to http://go.microsoft.com/fwlink/?LinkId=143720 for more details.\"")
+cpp_quote("#define DECLARE_DEPRECATED __declspec(deprecated(DEPRECATED_CLR_API_MESG))")
+cpp_quote("#define DEPRECATED_CLR_STDAPI EXTERN_C DECLARE_DEPRECATED HRESULT STDAPICALLTYPE")
+cpp_quote("#else // USE_DEPRECATED_CLR_API_WITHOUT_WARNING")
+cpp_quote("#define DECLARE_DEPRECATED ")
+cpp_quote("#define DEPRECATED_CLR_STDAPI STDAPI")
+cpp_quote("#endif // !USE_DEPRECATED_CLR_API_WITHOUT_WARNING")
+#endif // FEATURE_CORECLR
+cpp_quote("")
+
+//
+// Interface descriptions
+//
+import "unknwn.idl";
+#if defined(FEATURE_INCLUDE_ALL_INTERFACES) || defined(FEATURE_WINDOWSPHONE)
+import "gchost.idl";
+#endif
+import "ivalidator.idl";
+
+#include "product_version.h"
+
+#ifdef FEATURE_CORECLR
+cpp_quote("struct IActivationFactory;")
+interface IActivationFactory;
+#endif
+
+const char* CLR_MAJOR_VERSION = VER_MAJORVERSION;
+const char* CLR_MINOR_VERSION = VER_MINORVERSION;
+const char* CLR_BUILD_VERSION = VER_PRODUCTBUILD;
+
+const char* CLR_ASSEMBLY_MAJOR_VERSION = VER_ASSEMBLYMAJORVERSION;
+const char* CLR_ASSEMBLY_MINOR_VERSION = VER_ASSEMBLYMINORVERSION;
+const char* CLR_ASSEMBLY_BUILD_VERSION = VER_ASSEMBLYBUILD;
+
+#ifdef FEATURE_INCLUDE_ALL_INTERFACES
+// LIBID mscoree
+cpp_quote("EXTERN_GUID(LIBID_mscoree, 0x5477469e,0x83b1,0x11d2,0x8b,0x49,0x00,0xa0,0xc9,0xb7,0xc9,0xc4);")
+
+// CLSID CorRuntimeHost : uuid(CB2F6723-AB3A-11d2-9C40-00C04FA30A3E)
+cpp_quote("EXTERN_GUID(CLSID_CorRuntimeHost, 0xcb2f6723, 0xab3a, 0x11d2, 0x9c, 0x40, 0x00, 0xc0, 0x4f, 0xa3, 0x0a, 0x3e);")
+#endif // FEATURE_INCLUDE_ALL_INTERFACES
+
+// CLSID TypeNameFactory : uuid{B81FF171-20F3-11d2-8DCC-00A0C9B00525}
+cpp_quote("EXTERN_GUID(CLSID_TypeNameFactory, 0xB81FF171, 0x20F3, 0x11d2, 0x8d, 0xcc, 0x00, 0xa0, 0xc9, 0xb0, 0x05, 0x25);")
+
+#ifdef FEATURE_INCLUDE_ALL_INTERFACES
+// CLSID CLRRuntimeHost : uuid(90F1A06E-7712-4762-86B5-7A5EBA6BDB02)
+cpp_quote("EXTERN_GUID(CLSID_CLRRuntimeHost, 0x90F1A06E, 0x7712, 0x4762, 0x86, 0xB5, 0x7A, 0x5E, 0xBA, 0x6B, 0xDB, 0x02);")
+#endif // FEATURE_INCLUDE_ALL_INTERFACES
+
+#ifdef FEATURE_COMINTEROP
+// CLSID ComCallUnmarshal
+cpp_quote("EXTERN_GUID(CLSID_ComCallUnmarshal, 0x3F281000,0xE95A,0x11d2,0x88,0x6B,0x00,0xC0,0x4F,0x86,0x9F,0x04);")
+
+// CLSID ComCallUnmarshal2
+cpp_quote("EXTERN_GUID(CLSID_ComCallUnmarshalV4, 0x45fb4600,0xe6e8,0x4928,0xb2,0x5e,0x50,0x47,0x6f,0xf7,0x94,0x25);")
+#endif // FEATURE_COMINTEROP
+
+#ifdef FEATURE_INCLUDE_ALL_INTERFACES
+// IID IObjectHandle : uuid(C460E2B4-E199-412a-8456-84DC3E4838C3)
+cpp_quote("EXTERN_GUID(IID_IObjectHandle, 0xc460e2b4, 0xe199, 0x412a, 0x84, 0x56, 0x84, 0xdc, 0x3e, 0x48, 0x38, 0xc3);")
+#endif // FEATURE_INCLUDE_ALL_INTERFACES
+
+#ifdef FEATURE_COMINTEROP
+// IID IManagedObject : uuid(C3FCC19E-A970-11d2-8B5A-00A0C9B7C9C4)
+cpp_quote("EXTERN_GUID(IID_IManagedObject, 0xc3fcc19e, 0xa970, 0x11d2, 0x8b, 0x5a, 0x00, 0xa0, 0xc9, 0xb7, 0xc9, 0xc4);")
+#endif // FEATURE_COMINTEROP
+
+#ifdef FEATURE_INCLUDE_ALL_INTERFACES
+// IID IApartmentCallback : uuid(178E5337-1528-4591-B1C9-1C6E484686D8)
+cpp_quote("EXTERN_GUID(IID_IApartmentCallback, 0x178e5337, 0x1528, 0x4591, 0xb1, 0xc9, 0x1c, 0x6e, 0x48, 0x46, 0x86, 0xd8);")
+
+// IID ICatalogServices : uuid(04C6BE1E-1DB1-4058-AB7A-700CCCFBF254)
+cpp_quote("EXTERN_GUID(IID_ICatalogServices, 0x04c6be1e, 0x1db1, 0x4058, 0xab, 0x7a, 0x70, 0x0c, 0xcc, 0xfb, 0xf2, 0x54);")
+
+// IID ICorRuntimeHost : uuid(CB2F6722-AB3A-11d2-9C40-00C04FA30A3E)
+cpp_quote("EXTERN_GUID(IID_ICorRuntimeHost, 0xcb2f6722, 0xab3a, 0x11d2, 0x9c, 0x40, 0x00, 0xc0, 0x4f, 0xa3, 0x0a, 0x3e);")
+
+// IID ICorThreadpool : uuid(84680D3A-B2C1-46e8-ACC2-DBC0A359159A)
+cpp_quote("EXTERN_GUID(IID_ICorThreadpool, 0x84680D3A, 0xB2C1, 0x46e8, 0xAC, 0xC2, 0xDB, 0xC0, 0xA3, 0x59, 0x15, 0x9A);")
+
+// IID_ICLRDebugManager : uuid(00DCAEC6-2AC0-43a9-ACF9-1E36C139B10D)
+cpp_quote("EXTERN_GUID(IID_ICLRDebugManager, 0xdcaec6, 0x2ac0, 0x43a9, 0xac, 0xf9, 0x1e, 0x36, 0xc1, 0x39, 0xb1, 0xd);")
+
+// IID IHostMemoryNeededCallback : uuid(47EB8E57-0846-4546-AF76-6F42FCFC2649)
+cpp_quote("EXTERN_GUID(IID_IHostMemoryNeededCallback, 0x47EB8E57, 0x0846, 0x4546, 0xAF, 0x76, 0x6F, 0x42, 0xFC, 0xFC, 0x26, 0x49);")
+
+// IID IHostMalloc : uuid(1831991C-CC53-4A31-B218-04E910446479)
+cpp_quote("EXTERN_GUID(IID_IHostMalloc, 0x1831991C, 0xCC53, 0x4A31, 0xB2, 0x18, 0x04, 0xE9, 0x10, 0x44, 0x64, 0x79);")
+
+// IID IHostMemoryManager : uuid(7BC698D1-F9E3-4460-9CDE-D04248E9FA25)
+cpp_quote("EXTERN_GUID(IID_IHostMemoryManager, 0x7BC698D1, 0xF9E3, 0x4460, 0x9C, 0xDE, 0xD0, 0x42, 0x48, 0xE9, 0xFA, 0x25);")
+
+// IID ICLRTask : uuid(28E66A4A-9906-4225-B231-9187C3EB8611)
+cpp_quote("EXTERN_GUID(IID_ICLRTask, 0x28E66A4A, 0x9906, 0x4225, 0xB2, 0x31, 0x91, 0x87, 0xc3, 0xeb, 0x86, 0x11);")
+
+// IID ICLRTask2 : uuid(28E66A4A-9906-4225-B231-9187C3EB8612)
+cpp_quote("EXTERN_GUID(IID_ICLRTask2, 0x28E66A4A, 0x9906, 0x4225, 0xB2, 0x31, 0x91, 0x87, 0xc3, 0xeb, 0x86, 0x12);")
+
+// IID IHostTask : uuid(C2275828-C4B1-4B55-82C9-92135F74DF1A)
+cpp_quote("EXTERN_GUID(IID_IHostTask, 0xC2275828, 0xC4B1, 0x4B55, 0x82, 0xC9, 0x92, 0x13, 0x5F, 0x74, 0xDF, 0x1A);")
+
+// IID ICLRTaskManager : uuid(4862efbe-3ae5-44f8-8feb-346190ee8a34)
+cpp_quote("EXTERN_GUID(IID_ICLRTaskManager, 0x4862efbe, 0x3ae5, 0x44f8, 0x8F, 0xEB, 0x34, 0x61, 0x90, 0xeE, 0x8A, 0x34);")
+
+// IID IHostTaskManager : uuid(997FF24C-43B7-4352-8667-0DC04FAFD354)
+cpp_quote("EXTERN_GUID(IID_IHostTaskManager, 0x997FF24C, 0x43B7, 0x4352, 0x86, 0x67, 0x0D, 0xC0, 0x4F, 0xAF, 0xD3, 0x54);")
+
+// IID IHostThreadpoolManager : uuid(983D50E2-CB15-466B-80FC-845DC6E8C5FD)
+cpp_quote("EXTERN_GUID(IID_IHostThreadpoolManager, 0x983D50E2, 0xCB15, 0x466B, 0x80, 0xFC, 0x84, 0x5D, 0xC6, 0xE8, 0xC5, 0xFD);")
+
+// IID_ICLRIOCompletionManager : uuid(2D74CE86-B8D6-4C84-B3A7-9768933B3C12)
+cpp_quote("EXTERN_GUID(IID_ICLRIoCompletionManager, 0x2D74CE86, 0xB8D6, 0x4C84, 0xB3, 0xA7, 0x97, 0x68, 0x93, 0x3B, 0x3C, 0x12);")
+
+// IID_IHostIOCompletionManager : uuid(8BDE9D80-EC06-41D6-83E6-22580EFFCC20)
+cpp_quote("EXTERN_GUID(IID_IHostIoCompletionManager, 0x8BDE9D80, 0xEC06, 0x41D6, 0x83, 0xE6, 0x22, 0x58, 0x0E, 0xFF, 0xCC, 0x20);")
+
+// IID IHostSyncManager : uuid(234330c7-5f10-4f20-9615-5122dab7a0ac)
+cpp_quote("EXTERN_GUID(IID_IHostSyncManager, 0x234330c7, 0x5f10, 0x4f20, 0x96, 0x15, 0x51, 0x22, 0xda, 0xb7, 0xa0, 0xac);")
+
+// IID IHostCrst : uuid(6DF710A6-26A4-4a65-8CD5-7237B8BDA8DC)
+cpp_quote("EXTERN_GUID(IID_IHostCrst, 0x6DF710A6, 0x26A4, 0x4a65, 0x8c, 0xd5, 0x72, 0x37, 0xb8, 0xbd, 0xa8, 0xdc);")
+
+// IID IHostAutoEvent : uuid(50B0CFCE-4063-4278-9673-E5CB4ED0BDB8)
+cpp_quote("EXTERN_GUID(IID_IHostAutoEvent, 0x50B0CFCE, 0x4063, 0x4278, 0x96, 0x73, 0xe5, 0xcb, 0x4e, 0xd0, 0xbd, 0xb8);")
+
+// IID IHostManualEvent : uuid(1BF4EC38-AFFE-4fb9-85A6-525268F15B54)
+cpp_quote("EXTERN_GUID(IID_IHostManualEvent, 0x1BF4EC38, 0xAFFE, 0x4fb9, 0x85, 0xa6, 0x52, 0x52, 0x68, 0xf1, 0x5b, 0x54);")
+
+// IID IHostSemaphore : uuid(855efd47-cc09-463a-a97d-16acab882661)
+cpp_quote("EXTERN_GUID(IID_IHostSemaphore, 0x855efd47, 0xcc09, 0x463a, 0xa9, 0x7d, 0x16, 0xac, 0xab, 0x88, 0x26, 0x61);")
+
+// IID ICLRSyncManager : uuid(55FF199D-AD21-48f9-A16C-F24EBBB8727D)
+cpp_quote("EXTERN_GUID(IID_ICLRSyncManager, 0x55FF199D, 0xAD21, 0x48f9, 0xa1, 0x6c, 0xf2, 0x4e, 0xbb, 0xb8, 0x72, 0x7d);")
+#endif // FEATURE_INCLUDE_ALL_INTERFACES
+
+#ifdef FEATURE_APPDOMAIN_RESOURCE_MONITORING
+// IID ICLRAppDomainResourceMonitor: uuid(C62DE18C-2E23-4AEA-8423-B40C1FC59EAE)
+cpp_quote("EXTERN_GUID(IID_ICLRAppDomainResourceMonitor, 0XC62DE18C, 0X2E23, 0X4AEA, 0X84, 0X23, 0XB4, 0X0C, 0X1F, 0XC5, 0X9E, 0XAE);")
+#endif //FEATURE_APPDOMAIN_RESOURCE_MONITORING
+
+// {7D290010-D781-45da-A6F8-AA5D711A730E}
+cpp_quote("EXTERN_GUID(IID_ICLRPolicyManager, 0x7D290010, 0xD781, 0x45da, 0xA6, 0xF8, 0xAA, 0x5D, 0x71, 0x1A, 0x73, 0x0E);")
+
+#if defined(FEATURE_INCLUDE_ALL_INTERFACES) || defined (FEATURE_WINDOWSPHONE)
+// IID_ICLRGCManager : uuid(54D9007E-A8E2-4885-B7BF-F998DEEE4F2A)
+cpp_quote("EXTERN_GUID(IID_ICLRGCManager, 0x54D9007E, 0xA8E2, 0x4885, 0xB7, 0xBF, 0xF9, 0x98, 0xDE, 0xEE, 0x4F, 0x2A);")
+// IID_ICLRGCManager2 : uuid(0603B793-A97A-4712-9CB4-0CD1C74C0F7C)
+cpp_quote("EXTERN_GUID(IID_ICLRGCManager2, 0x0603B793, 0xA97A, 0x4712, 0x9C, 0xB4, 0x0C, 0xD1, 0xC7, 0x4C, 0x0F, 0x7C);")
+// IID_ICLRErrorReportingManager : uuid(980D2F1A-BF79-4c08-812A-BB9778928F78)
+cpp_quote("EXTERN_GUID(IID_ICLRErrorReportingManager, 0x980d2f1a, 0xbf79, 0x4c08, 0x81, 0x2a, 0xbb, 0x97, 0x78, 0x92, 0x8f, 0x78);")
+#endif // FEATURE_INCLUDE_ALL_INTERFACES || FEATURE_WINDOWSPHONE
+
+#ifdef FEATURE_WINDOWSPHONE
+// IID_ICLRErrorReportingManager2 : uuid(C68F63B1-4D8B-4E0B-9564-9D2EFE2FA18C)
+cpp_quote("EXTERN_GUID(IID_ICLRErrorReportingManager2, 0xc68f63b1, 0x4d8b, 0x4e0b, 0x95, 0x64, 0x9d, 0x2e, 0xfe, 0x2f, 0xa1, 0x8c);")
+#endif // FEATURE_WINDOWSPHONE
+
+#ifdef FEATURE_INCLUDE_ALL_INTERFACES
+// {7AE49844-B1E3-4683-BA7C-1E8212EA3B79}
+cpp_quote("EXTERN_GUID(IID_IHostPolicyManager, 0x7AE49844, 0xB1E3, 0x4683, 0xBA, 0x7C, 0x1E, 0x82, 0x12, 0xEA, 0x3B, 0x79);")
+
+// IID IHostGCManager : uuid(5D4EC34E-F248-457B-B603-255FAABA0D21)
+cpp_quote("EXTERN_GUID(IID_IHostGCManager, 0x5D4EC34E, 0xF248, 0x457B, 0xB6, 0x03, 0x25, 0x5F, 0xAA, 0xBA, 0x0D, 0x21);")
+
+// {607BE24B-D91B-4E28-A242-61871CE56E35}
+cpp_quote("EXTERN_GUID(IID_IActionOnCLREvent, 0x607BE24B, 0xD91B, 0x4E28, 0xA2, 0x42, 0x61, 0x87, 0x1C, 0xE5, 0x6E, 0x35);")
+
+// {1D0E0132-E64F-493D-9260-025C0E32C175}
+cpp_quote("EXTERN_GUID(IID_ICLROnEventManager, 0x1D0E0132, 0xE64F, 0x493D, 0x92, 0x60, 0x02, 0x5C, 0x0E, 0x32, 0xC1, 0x75);")
+#endif // FEATURE_INCLUDE_ALL_INTERFACES
+
+// IID ICLRRuntimeHost: uuid(90F1A06C-7712-4762-86B5-7A5EBA6BDB02)
+cpp_quote("EXTERN_GUID(IID_ICLRRuntimeHost, 0x90F1A06C, 0x7712, 0x4762, 0x86, 0xB5, 0x7A, 0x5E, 0xBA, 0x6B, 0xDB, 0x02);")
+
+#ifdef FEATURE_CORECLR
+// IID ICLRRuntimeHost2: uuid(712AB73F-2C22-4807-AD7E-F501D7B72C2D)
+cpp_quote("EXTERN_GUID(IID_ICLRRuntimeHost2, 0x712AB73F, 0x2C22, 0x4807, 0xAD, 0x7E, 0xF5, 0x01, 0xD7, 0xb7, 0x2C, 0x2D);")
+
+// IID IID_ICLRExecutionManager: uuid(1000A3E7-B420-4620-AE30-FB19B587AD1D)
+cpp_quote("EXTERN_GUID(IID_ICLRExecutionManager, 0x1000A3E7, 0xB420, 0x4620, 0xAE, 0x30, 0xFB, 0x19, 0xB5, 0x87, 0xAD, 0x1D);")
+
+#endif // FEATURE_CORECLR
+
+#ifdef FEATURE_INCLUDE_ALL_INTERFACES
+// IID ICLRHostProtectionManager : uuid{89F25F5C-CEEF-43e1-9CFA-A68CE863AAAC}
+cpp_quote("EXTERN_GUID(IID_ICLRHostProtectionManager, 0x89f25f5c, 0xceef, 0x43e1, 0x9c, 0xfa, 0xa6, 0x8c, 0xe8, 0x63, 0xaa, 0xac);")
+
+// IID IHostAssemblyStore : uuid(7B102A88-3F7F-496D-8FA2-C35374E01AF3)
+cpp_quote("EXTERN_GUID(IID_IHostAssemblyStore, 0x7b102a88, 0x3f7f, 0x496d, 0x8f, 0xa2, 0xc3, 0x53, 0x74, 0xe0, 0x1a, 0xf3);")
+
+// IID IHostAssemblyManager : uuid(613dabd7-62b2-493e-9e65-c1e32a1e0c5e)
+cpp_quote("EXTERN_GUID(IID_IHostAssemblyManager, 0x613dabd7, 0x62b2, 0x493e, 0x9e, 0x65, 0xc1, 0xe3, 0x2a, 0x1e, 0x0c, 0x5e);")
+
+// IID IHostSecurityManager : uuid{75AD2468-A349-4D02-A764-76A68AEE0C4F}
+cpp_quote("EXTERN_GUID(IID_IHostSecurityManager, 0x75ad2468, 0xa349, 0x4d02, 0xa7, 0x64, 0x76, 0xa6, 0x8a, 0xee, 0x0c, 0x4f);")
+
+// IID IHostSecurityContext : uuid{7E573CE4-0343-4423-98D7-6318348A1D3C}
+cpp_quote("EXTERN_GUID(IID_IHostSecurityContext, 0x7e573ce4, 0x343, 0x4423, 0x98, 0xd7, 0x63, 0x18, 0x34, 0x8a, 0x1d, 0x3c);")
+
+// IID ICLRAssemblyIdentityManager: uuid(15f0a9da-3ff6-4393-9da9-fdfd284e6972)
+cpp_quote("EXTERN_GUID(IID_ICLRAssemblyIdentityManager, 0x15f0a9da, 0x3ff6, 0x4393, 0x9d, 0xa9, 0xfd, 0xfd, 0x28, 0x4e, 0x69, 0x72);")
+
+// IID ICLRDomainManager: uuid(270D00A2-8E15-4d0b-ADEB-37BC3E47DF77)
+cpp_quote("EXTERN_GUID(IID_ICLRDomainManager, 0x270d00a2, 0x8e15, 0x4d0b, 0xad, 0xeb, 0x37, 0xbc, 0x3e, 0x47, 0xdf, 0x77);")
+
+#endif // FEATURE_INCLUDE_ALL_INTERFACES
+
+// IID ITypeName : uuid{B81FF171-20F3-11d2-8DCC-00A0C9B00522}
+cpp_quote("EXTERN_GUID(IID_ITypeName, 0xB81FF171, 0x20F3, 0x11d2, 0x8d, 0xcc, 0x00, 0xa0, 0xc9, 0xb0, 0x05, 0x22);")
+
+#ifdef FEATURE_INCLUDE_ALL_INTERFACES
+// IID ICLRAssemblyReferenceList: uuid(1b2c9750-2e66-4bda-8b44-0a642c5cd733)
+cpp_quote("EXTERN_GUID(IID_ICLRAssemblyReferenceList, 0x1b2c9750, 0x2e66, 0x4bda, 0x8b, 0x44, 0x0a, 0x64, 0x2c, 0x5c, 0xd7, 0x33);")
+
+// IID ICLRReferenceAssemblyEnum: uuid(d509cb5d-cf32-4876-ae61-67770cf91973)
+cpp_quote("EXTERN_GUID(IID_ICLRReferenceAssemblyEnum, 0xd509cb5d, 0xcf32, 0x4876, 0xae, 0x61, 0x67, 0x77, 0x0c, 0xf9, 0x19, 0x73);")
+
+// IID ICLRProbingAssemblyEnum: uuid(d0c5fb1f-416b-4f97-81f4-7ac7dc24dd5d)
+cpp_quote("EXTERN_GUID(IID_ICLRProbingAssemblyEnum, 0xd0c5fb1f, 0x416b, 0x4f97, 0x81, 0xf4, 0x7a, 0xc7, 0xdc, 0x24, 0xdd, 0x5d);")
+
+// IID ICLRHostBindingPolicyManager: uuid(4b3545e7-1856-48c9-a8ba-24b21a753c09)
+cpp_quote("EXTERN_GUID(IID_ICLRHostBindingPolicyManager, 0x4b3545e7, 0x1856, 0x48c9, 0xa8, 0xba, 0x24, 0xb2, 0x1a, 0x75, 0x3c, 0x09);")
+#endif // FEATURE_INCLUDE_ALL_INTERFACES
+
+// IID ITypeNameBuilder : uuid{B81FF171-20F3-11d2-8DCC-00A0C9B00523}
+cpp_quote("EXTERN_GUID(IID_ITypeNameBuilder, 0xB81FF171, 0x20F3, 0x11d2, 0x8d, 0xcc, 0x00, 0xa0, 0xc9, 0xb0, 0x05, 0x23);")
+
+// IID ITypeNameFactory : uuid{B81FF171-20F3-11d2-8DCC-00A0C9B00521}
+cpp_quote("EXTERN_GUID(IID_ITypeNameFactory, 0xB81FF171, 0x20F3, 0x11d2, 0x8d, 0xcc, 0x00, 0xa0, 0xc9, 0xb0, 0x05, 0x21);")
+
+#pragma midl_echo("DEPRECATED_CLR_STDAPI GetCORSystemDirectory(_Out_writes_to_(cchBuffer, *dwLength) LPWSTR pbuffer, DWORD cchBuffer, DWORD* dwLength);")
+#pragma midl_echo("DEPRECATED_CLR_STDAPI GetCORVersion(_Out_writes_to_(cchBuffer, *dwLength) LPWSTR pbBuffer, DWORD cchBuffer, DWORD* dwLength);")
+#pragma midl_echo("DEPRECATED_CLR_STDAPI GetFileVersion(LPCWSTR szFilename, _Out_writes_to_opt_(cchBuffer, *dwLength) LPWSTR szBuffer, DWORD cchBuffer, DWORD* dwLength);")
+#pragma midl_echo("DEPRECATED_CLR_STDAPI GetCORRequiredVersion(_Out_writes_to_(cchBuffer, *dwLength) LPWSTR pbuffer, DWORD cchBuffer, DWORD* dwLength);")
+#pragma midl_echo("DEPRECATED_CLR_STDAPI GetRequestedRuntimeInfo(LPCWSTR pExe, LPCWSTR pwszVersion, LPCWSTR pConfigurationFile, DWORD startupFlags, DWORD runtimeInfoFlags, _Out_writes_opt_(dwDirectory) LPWSTR pDirectory, DWORD dwDirectory, _Out_opt_ DWORD *dwDirectoryLength, _Out_writes_opt_(cchBuffer) LPWSTR pVersion, DWORD cchBuffer, _Out_opt_ DWORD* dwlength);")
+#pragma midl_echo("DEPRECATED_CLR_STDAPI GetRequestedRuntimeVersion(_In_ LPWSTR pExe, _Out_writes_to_(cchBuffer, *dwLength) LPWSTR pVersion, DWORD cchBuffer, _Out_ DWORD* dwLength);")
+#pragma midl_echo("DEPRECATED_CLR_STDAPI CorBindToRuntimeHost(LPCWSTR pwszVersion, LPCWSTR pwszBuildFlavor, LPCWSTR pwszHostConfigFile, VOID* pReserved, DWORD startupFlags, REFCLSID rclsid, REFIID riid, LPVOID FAR *ppv);")
+#pragma midl_echo("DEPRECATED_CLR_STDAPI CorBindToRuntimeEx(LPCWSTR pwszVersion, LPCWSTR pwszBuildFlavor, DWORD startupFlags, REFCLSID rclsid, REFIID riid, LPVOID FAR *ppv);")
+#pragma midl_echo("DEPRECATED_CLR_STDAPI CorBindToRuntimeByCfg(IStream* pCfgStream, DWORD reserved, DWORD startupFlags, REFCLSID rclsid,REFIID riid, LPVOID FAR* ppv);")
+#pragma midl_echo("DEPRECATED_CLR_STDAPI CorBindToRuntime(LPCWSTR pwszVersion, LPCWSTR pwszBuildFlavor, REFCLSID rclsid, REFIID riid, LPVOID FAR *ppv);")
+#pragma midl_echo("DEPRECATED_CLR_STDAPI CorBindToCurrentRuntime(LPCWSTR pwszFileName, REFCLSID rclsid, REFIID riid, LPVOID FAR *ppv);")
+#pragma midl_echo("DEPRECATED_CLR_STDAPI ClrCreateManagedInstance(LPCWSTR pTypeName, REFIID riid, void **ppObject);")
+#pragma midl_echo("DECLARE_DEPRECATED void STDMETHODCALLTYPE CorMarkThreadInThreadPool();")
+#pragma midl_echo("DEPRECATED_CLR_STDAPI RunDll32ShimW(HWND hwnd, HINSTANCE hinst, LPCWSTR lpszCmdLine, int nCmdShow);")
+#pragma midl_echo("DEPRECATED_CLR_STDAPI LoadLibraryShim(LPCWSTR szDllName, LPCWSTR szVersion, LPVOID pvReserved, HMODULE *phModDll);")
+#pragma midl_echo("DEPRECATED_CLR_STDAPI CallFunctionShim(LPCWSTR szDllName, LPCSTR szFunctionName, LPVOID lpvArgument1, LPVOID lpvArgument2, LPCWSTR szVersion, LPVOID pvReserved);")
+#pragma midl_echo("DEPRECATED_CLR_STDAPI GetRealProcAddress(LPCSTR pwszProcName, VOID** ppv);")
+#pragma midl_echo("DECLARE_DEPRECATED void STDMETHODCALLTYPE CorExitProcess(int exitCode);")
+#pragma midl_echo("DEPRECATED_CLR_STDAPI LoadStringRC(UINT iResouceID, _Out_writes_z_(iMax) LPWSTR szBuffer, int iMax, int bQuiet);")
+#ifdef FEATURE_USE_LCID
+#pragma midl_echo("DEPRECATED_CLR_STDAPI LoadStringRCEx(LCID lcid, UINT iResouceID, _Out_writes_z_(iMax) LPWSTR szBuffer, int iMax, int bQuiet, int *pcwchUsed);")
+#endif
+
+#ifndef FEATURE_CORECLR
+// Ideally we would like to make the function pointer definition below as DEPRECATED_CLR_STDAPI. However,
+// since it is referenced in the following definition of LockClrVersion, it will result in a build failure
+// in our own build (since we treat warnings as errors).
+//
+// However, there is no other usage of this pointer outside LockClrVersion. Thus, we will not mark
+// the pointer as legacy API. This will ensure we can build the runtime and if someone tries to use
+// it via LockClrVersion, they will have build warning since LockClrVersion is marked as legacy API.
+#pragma midl_echo("typedef HRESULT (__stdcall *FLockClrVersionCallback) ();")
+#pragma midl_echo("DEPRECATED_CLR_STDAPI LockClrVersion(FLockClrVersionCallback hostCallback,FLockClrVersionCallback *pBeginHostSetup,FLockClrVersionCallback *pEndHostSetup);")
+#pragma midl_echo("DEPRECATED_CLR_STDAPI CreateDebuggingInterfaceFromVersion(int iDebuggerVersion, LPCWSTR szDebuggeeVersion, IUnknown ** ppCordb);")
+#pragma midl_echo("DEPRECATED_CLR_STDAPI GetVersionFromProcess(HANDLE hProcess, _Out_writes_to_(cchBuffer, *dwLength) LPWSTR pVersion, DWORD cchBuffer, _Out_ DWORD* dwLength);")
+#endif
+
+
+#ifdef FEATURE_CORECLR
+#pragma midl_echo("typedef HRESULT (STDAPICALLTYPE *FnGetCLRRuntimeHost)(REFIID riid, IUnknown **pUnk);")
+#endif
+
+typedef enum {
+ HOST_TYPE_DEFAULT = 0x0,
+ HOST_TYPE_APPLAUNCH = 0x1,
+ HOST_TYPE_CORFLAG = 0x2
+} HOST_TYPE;
+
+#pragma midl_echo("STDAPI CorLaunchApplication(HOST_TYPE dwClickOnceHost, LPCWSTR pwzAppFullName, DWORD dwManifestPaths, LPCWSTR* ppwzManifestPaths, DWORD dwActivationData, LPCWSTR* ppwzActivationData, LPPROCESS_INFORMATION lpProcessInformation);")
+
+typedef HRESULT (__stdcall *FExecuteInAppDomainCallback) (void* cookie);
+
+// By default GC is concurrent and only the base system library is loaded into the domain-neutral area.
+typedef enum {
+ STARTUP_CONCURRENT_GC = 0x1,
+
+ STARTUP_LOADER_OPTIMIZATION_MASK = 0x3<<1, // loader optimization mask
+ STARTUP_LOADER_OPTIMIZATION_SINGLE_DOMAIN = 0x1<<1, // no domain neutral loading
+ STARTUP_LOADER_OPTIMIZATION_MULTI_DOMAIN = 0x2<<1, // all domain neutral loading
+ STARTUP_LOADER_OPTIMIZATION_MULTI_DOMAIN_HOST = 0x3<<1, // strong name domain neutral loading
+
+
+ STARTUP_LOADER_SAFEMODE = 0x10, // Do not apply runtime version policy to the version passed in
+ STARTUP_LOADER_SETPREFERENCE = 0x100, // Set preferred runtime. Do not actally start it
+
+ STARTUP_SERVER_GC = 0x1000, // Use server GC
+ STARTUP_HOARD_GC_VM = 0x2000, // GC keeps virtual address used
+ STARTUP_SINGLE_VERSION_HOSTING_INTERFACE = 0x4000, // Disallow mixing hosting interface
+ STARTUP_LEGACY_IMPERSONATION = 0x10000, // Do not flow impersonation across async points by default
+ STARTUP_DISABLE_COMMITTHREADSTACK = 0x20000, // Don't eagerly commit thread stack
+ STARTUP_ALWAYSFLOW_IMPERSONATION = 0x40000, // Force flow impersonation across async points
+ // (impersonations achieved thru p/invoke and managed will flow.
+ // default is to flow only managed impersonation)
+ STARTUP_TRIM_GC_COMMIT = 0x80000, // GC uses less committed space when system memory low
+ STARTUP_ETW = 0x100000,
+ STARTUP_ARM = 0x400000, // Enable the ARM feature.
+#ifdef FEATURE_CORECLR
+ STARTUP_SINGLE_APPDOMAIN = 0x800000, // application runs in default domain, no more domains are created
+ STARTUP_APPX_APP_MODEL = 0x1000000, // jupiter app
+ STARTUP_DISABLE_RANDOMIZED_STRING_HASHING = 0x2000000 // Disable the randomized string hashing
+#endif
+} STARTUP_FLAGS;
+
+typedef enum {
+ CLSID_RESOLUTION_DEFAULT = 0x0, // Standard behavior that interop uses
+ CLSID_RESOLUTION_REGISTERED = 0x1, // Searches the registry and applies shim policy
+} CLSID_RESOLUTION_FLAGS;
+
+typedef enum
+{
+ RUNTIME_INFO_UPGRADE_VERSION = 0x001, // apply upgrades - i.e RTM->Everett
+ RUNTIME_INFO_REQUEST_IA64 = 0x002, // requesting a CLR for ia64
+ RUNTIME_INFO_REQUEST_AMD64 = 0x004, // requesting a CLR for amd64
+ RUNTIME_INFO_REQUEST_X86 = 0x008, // requesting a CLR for x86
+ RUNTIME_INFO_DONT_RETURN_DIRECTORY = 0x010, // don't return directory information
+ RUNTIME_INFO_DONT_RETURN_VERSION = 0x020, // don't return version information
+ RUNTIME_INFO_DONT_SHOW_ERROR_DIALOG = 0x040, // don't pop up an error dialog on failure
+ RUNTIME_INFO_IGNORE_ERROR_MODE = 0x1000,// ignore SEM_FAILCRITICALERRORS
+ // (by default the error dialog is not shown if SEM_FAILCRITICALERRORS is set)
+ // Reserved values here - see mscoreepriv.h
+} RUNTIME_INFO_FLAGS;
+
+
+typedef enum
+{
+ APPDOMAIN_SECURITY_DEFAULT =0x0,
+ APPDOMAIN_SECURITY_SANDBOXED = 0x1, // appdomain is sandboxed
+ APPDOMAIN_SECURITY_FORBID_CROSSAD_REVERSE_PINVOKE = 0x2, // no cross ad reverse pinvokes
+#ifdef FEATURE_CORECLR
+ APPDOMAIN_IGNORE_UNHANDLED_EXCEPTIONS = 0x4, //
+#endif //FEATURE_CORECLR
+ APPDOMAIN_FORCE_TRIVIAL_WAIT_OPERATIONS = 0x08, // do not pump messages during wait operations, do not call sync context
+#ifdef FEATURE_CORECLR
+ // When passed by the host, this flag will allow any assembly to perform PInvoke or COMInterop operations.
+ // Otherwise, by default, only platform assemblies can perform those operations.
+ APPDOMAIN_ENABLE_PINVOKE_AND_CLASSIC_COMINTEROP = 0x10,
+
+ APPDOMAIN_ENABLE_PLATFORM_SPECIFIC_APPS = 0x40,
+ APPDOMAIN_ENABLE_ASSEMBLY_LOADFILE = 0x80,
+
+ APPDOMAIN_DISABLE_TRANSPARENCY_ENFORCEMENT = 0x100,
+#endif //FEATURE_CORECLR
+} APPDOMAIN_SECURITY_FLAGS;
+
+#pragma midl_echo("STDAPI GetRequestedRuntimeVersionForCLSID(REFCLSID rclsid, _Out_writes_opt_(cchBuffer) LPWSTR pVersion, DWORD cchBuffer, _Out_opt_ DWORD* dwLength, CLSID_RESOLUTION_FLAGS dwResolutionFlags);")
+
+#ifdef FEATURE_INCLUDE_ALL_INTERFACES
+//*****************************************************************************
+// Interface for Object Handles
+//*****************************************************************************
+[
+ object,
+ oleautomation,
+ uuid(C460E2B4-E199-412a-8456-84DC3E4838C3),
+ helpstring("Object Handle Interface"),
+ pointer_default(unique)
+]
+interface IObjectHandle : IUnknown
+{
+ HRESULT Unwrap([out, retval] VARIANT *ppv);
+};
+
+//*****************************************************************************
+// Interface for Setting runtime configuration
+//*****************************************************************************
+[
+ uuid(5C2B07A7-1E98-11d3-872F-00C04F79ED0D),
+ version(1.0),
+ helpstring("Application Domain call back"),
+ pointer_default(unique),
+ local
+]
+interface IAppDomainBinding : IUnknown
+{
+ // <TODO>TODO: this should return an AppDomain interface
+ // The event is invoked everytime a domain is created </TODO>
+ HRESULT OnAppDomain([in] IUnknown* pAppdomain);
+}
+
+
+//*****************************************************************************
+// Interface for participating in the scheduling of threads that would
+// otherwise be blocked for a GC
+//*****************************************************************************
+[
+ uuid(F31D1788-C397-4725-87A5-6AF3472C2791),
+ version(1.0),
+ helpstring("Control over threads blocked in GC"),
+ pointer_default(unique),
+ local
+]
+interface IGCThreadControl : IUnknown
+{
+ // Notification that the thread making the call is about to block, perhaps for
+ // a GC or other suspension. This gives the host an opportunity to re-schedule
+ // the thread for unmanaged tasks.
+ HRESULT ThreadIsBlockingForSuspension();
+
+ // Notification that the runtime is beginning a thread suspension for a GC or
+ // other suspension. Do not reschedule this thread!
+ HRESULT SuspensionStarting();
+
+ // Notification that the runtime is resuming threads after a GC or other
+ // suspension. Do not reschedule this thread!
+ HRESULT SuspensionEnding(DWORD Generation);
+}
+
+//*****************************************************************************
+// Interface for GC to request change in virtual memory limit
+//*****************************************************************************
+[
+ uuid(5513D564-8374-4cb9-AED9-0083F4160A1D),
+ version(1.1),
+ helpstring("Request change in virtual memory for GC"),
+ pointer_default(unique),
+ local
+]
+interface IGCHostControl : IUnknown
+{
+ // Request to increase the virtual memeory limit of the runtime (GC heap)
+ HRESULT RequestVirtualMemLimit([in] SIZE_T sztMaxVirtualMemMB,
+ [in, out] SIZE_T* psztNewMaxVirtualMemMB);
+}
+
+//*****************************************************************************
+// Interface for accessing threadpool
+//*****************************************************************************
+cpp_quote("#ifdef __midl")
+typedef VOID (__stdcall *WAITORTIMERCALLBACK)(PVOID, BOOL);
+cpp_quote("#endif // __midl")
+
+cpp_quote("#ifdef __midl")
+typedef DWORD (__stdcall *LPTHREAD_START_ROUTINE)(LPVOID lpThreadParameter);
+typedef VOID (*LPOVERLAPPED_COMPLETION_ROUTINE)(DWORD dwErrorCode,
+ DWORD dwNumberOfBytesTransfered,
+ LPVOID lpOverlapped);
+cpp_quote("#endif // __midl")
+
+// Callback function for cleaning up TLS
+typedef VOID (__stdcall *PTLS_CALLBACK_FUNCTION)(PVOID);
+
+[
+ uuid(84680D3A-B2C1-46e8-ACC2-DBC0A359159A),
+ version(1.0),
+ helpstring("Threadpool interface"),
+ pointer_default(unique),
+ local
+]
+interface ICorThreadpool : IUnknown
+{
+ HRESULT CorRegisterWaitForSingleObject([in] HANDLE* phNewWaitObject,
+ [in] HANDLE hWaitObject,
+ [in] WAITORTIMERCALLBACK Callback,
+ [in] PVOID Context,
+ [in] ULONG timeout,
+ [in] BOOL executeOnlyOnce,
+ [out] BOOL* result );
+
+ HRESULT CorUnregisterWait([in] HANDLE hWaitObject,[in] HANDLE CompletionEvent,[out] BOOL* result);
+
+ HRESULT CorQueueUserWorkItem([in] LPTHREAD_START_ROUTINE Function,
+ [in] PVOID Context,
+ [in] BOOL executeOnlyOnce,
+ [out] BOOL* result );
+
+
+ HRESULT CorCreateTimer([in] HANDLE* phNewTimer,
+ [in] WAITORTIMERCALLBACK Callback,
+ [in] PVOID Parameter,
+ [in] DWORD DueTime,
+ [in] DWORD Period,
+ [out] BOOL* result);
+
+ HRESULT CorChangeTimer([in] HANDLE Timer, [in] ULONG DueTime, [in] ULONG Period, [out] BOOL* result);
+
+ HRESULT CorDeleteTimer([in] HANDLE Timer, [in] HANDLE CompletionEvent, [out] BOOL* result);
+
+ HRESULT CorBindIoCompletionCallback([in] HANDLE fileHandle, [in] LPOVERLAPPED_COMPLETION_ROUTINE callback);
+
+ HRESULT CorCallOrQueueUserWorkItem([in] LPTHREAD_START_ROUTINE Function,
+ [in] PVOID Context,
+ [out] BOOL* result );
+ HRESULT CorSetMaxThreads([in] DWORD MaxWorkerThreads,
+ [in] DWORD MaxIOCompletionThreads);
+
+ HRESULT CorGetMaxThreads([out] DWORD *MaxWorkerThreads,
+ [out] DWORD *MaxIOCompletionThreads);
+
+ HRESULT CorGetAvailableThreads([out] DWORD *AvailableWorkerThreads,
+ [out] DWORD *AvailableIOCompletionThreads);
+
+
+}
+#endif // FEATURE_INCLUDE_ALL_INTERFACES
+
+cpp_quote("EXTERN_GUID(IID_IDebuggerThreadControl, 0x23d86786, 0x0bb5, 0x4774, 0x8f, 0xb5, 0xe3, 0x52, 0x2a, 0xdd, 0x62, 0x46);")
+[
+ uuid(23D86786-0BB5-4774-8FB5-E3522ADD6246),
+ version(1.0),
+ helpstring("Control over threads blocked in debugging services"),
+ pointer_default(unique),
+ local
+]
+interface IDebuggerThreadControl : IUnknown
+{
+ // Notification that the thread making the call is about to
+ // block within the debugging services. This gives the host
+ // an opportunity to perform another action while the thread
+ // blocks. This will always be called on a Runtime thread.
+ HRESULT ThreadIsBlockingForDebugger();
+
+ // Notification that the debugging services is about to
+ // release all threads it has blocked. This will never be
+ // called on a Runtime thread. If the host has a Runtime
+ // thread blocked in ThreadIsBlockingForDebugger() then it
+ // should release it now.
+ HRESULT ReleaseAllRuntimeThreads();
+
+ // Notification that the debugging services are about to
+ // start blocking all threads. This could be called on a
+ // Runtime thread. This is the signal to the host to
+ // start blocking threads in ThreadIsBlockingForDebugger().
+ HRESULT StartBlockingForDebugger(DWORD dwUnused);
+}
+
+cpp_quote("EXTERN_GUID(IID_IDebuggerInfo, 0xbf24142d, 0xa47d, 0x4d24, 0xa6, 0x6d, 0x8c, 0x21, 0x41, 0x94, 0x4e, 0x44);")
+[
+ uuid(BF24142D-A47D-4d24-A66D-8C2141944E44),
+ version(1.0),
+ helpstring("Information on the state of the debugging services"),
+ pointer_default(unique),
+ local
+]
+interface IDebuggerInfo : IUnknown
+{
+ // Indicates whether or not a managed debugger is attached to this process.
+ HRESULT IsDebuggerAttached([out] BOOL *pbAttached);
+}
+
+#ifdef FEATURE_INCLUDE_ALL_INTERFACES
+// {5C2B07A5-1E98-11d3-872F-00C04F79ED0D}
+cpp_quote("EXTERN_GUID(IID_ICorConfiguration, 0x5c2b07a5, 0x1e98, 0x11d3, 0x87, 0x2f, 0x00, 0xc0, 0x4f, 0x79, 0xed, 0x0d);")
+[
+ uuid(5C2B07A5-1E98-11d3-872F-00C04F79ED0D),
+ version(1.0),
+ helpstring("Common Language Runtime Configuration Interface"),
+ pointer_default(unique),
+ local
+]
+interface ICorConfiguration : IUnknown
+{
+ // Set the callback for scheduling threads for non-runtime tasks when they
+ // would otherwise be blocked for a GC.
+ HRESULT SetGCThreadControl([in] IGCThreadControl* pGCThreadControl);
+
+ // Set the callback for gc to request a change in virtual memmory limit
+ HRESULT SetGCHostControl([in] IGCHostControl* pGCHostControl);
+
+ // Set the callback interface that the debugging services will
+ // call as Runtime threads are blocked and un-blocked for
+ // debugging.
+ HRESULT SetDebuggerThreadControl([in] IDebuggerThreadControl* pDebuggerThreadControl);
+
+ // The host may indicate to the debugging services that a
+ // particular thread should be allowed to continue to execute
+ // while the debugger has an application stopped during
+ // managed/unmanaged debugging scenarios. The specified thread
+ // will not be allowed to run managed code, or to enter the
+ // Runtime in any way. An example of such a thread would be an
+ // in-process thread to support legacy script debuggers.
+ HRESULT AddDebuggerSpecialThread([in] DWORD dwSpecialThreadId);
+}
+#endif // FEATURE_INCLUDE_ALL_INTERFACES
+
+//*****************************************************************************
+// Interface for hosting mscoree
+//*****************************************************************************
+typedef void* HDOMAINENUM;
+
+#ifdef FEATURE_INCLUDE_ALL_INTERFACES
+[
+ uuid(CB2F6722-AB3A-11d2-9C40-00C04FA30A3E),
+ version(1.0),
+ helpstring("Common Language Runtime Hosting Interface"),
+ pointer_default(unique),
+ local
+]
+interface ICorRuntimeHost : IUnknown
+{
+ HRESULT CreateLogicalThreadState();
+ HRESULT DeleteLogicalThreadState();
+ HRESULT SwitchInLogicalThreadState(
+ [in] DWORD *pFiberCookie); // [in] Cookie that indicates the fiber to use.
+
+ HRESULT SwitchOutLogicalThreadState(
+ [out] DWORD **pFiberCookie); // [out] Cookie that indicates the fiber being switched out.
+
+ HRESULT LocksHeldByLogicalThread( // Return code.
+ [out] DWORD *pCount // [out] Number of locks that the current thread holds.
+ );
+
+ HRESULT MapFile(
+ [in] HANDLE hFile, // [in] HANDLE for file
+ [out] HMODULE* hMapAddress); // [out] HINSTANCE for mapped file
+
+ //=================================================================
+ //
+ // New hosting methods
+ //
+ // Returns an object for configuring the runtime prior to
+ // it starting. If the runtime has been initialized this
+ // routine returns an error. See ICorConfiguration.
+ HRESULT GetConfiguration([out] ICorConfiguration** pConfiguration);
+
+ // Starts the runtime. This is equivalent to CoInitializeCor();
+ HRESULT Start();
+
+ // Terminates the runtime, This is equivalent CoUninitializeCor();
+ HRESULT Stop();
+
+ // Creates a domain in the runtime. The identity array is
+ // a pointer to an array TYPE containing IIdentity objects defining
+ // the security identity.
+ HRESULT CreateDomain([in] LPCWSTR pwzFriendlyName,
+ [in] IUnknown* pIdentityArray, // Optional
+ [out] IUnknown** pAppDomain);
+
+ // Returns the default domain.
+ HRESULT GetDefaultDomain([out] IUnknown** pAppDomain);
+
+
+ // Enumerate currently existing domains.
+ HRESULT EnumDomains([out] HDOMAINENUM *hEnum);
+
+ // Returns S_FALSE when there are no more domains. A domain
+ // is passed out only when S_OK is returned.
+ HRESULT NextDomain([in] HDOMAINENUM hEnum,
+ [out] IUnknown** pAppDomain);
+
+ // Close the enumeration, releasing resources
+ HRESULT CloseEnum([in] HDOMAINENUM hEnum);
+
+ HRESULT CreateDomainEx([in] LPCWSTR pwzFriendlyName, // Optional
+ [in] IUnknown* pSetup, // Optional
+ [in] IUnknown* pEvidence, // Optional
+ [out] IUnknown** pAppDomain);
+
+ HRESULT CreateDomainSetup([out] IUnknown** pAppDomainSetup);
+
+ HRESULT CreateEvidence([out] IUnknown** pEvidence);
+
+ HRESULT UnloadDomain([in] IUnknown* pAppDomain);
+
+ // Returns the thread's domain.
+ HRESULT CurrentDomain([out] IUnknown** pAppDomain);
+};
+#endif // FEATURE_INCLUDE_ALL_INTERFACES
+
+typedef enum
+{
+ eMemoryAvailableLow = 1,
+ eMemoryAvailableNeutral = 2,
+ eMemoryAvailableHigh = 3
+} EMemoryAvailable;
+
+typedef enum
+{
+ eTaskCritical = 0,
+ eAppDomainCritical = 1,
+ eProcessCritical = 2
+} EMemoryCriticalLevel;
+
+typedef enum {
+ WAIT_MSGPUMP = 0x1,
+ WAIT_ALERTABLE = 0x2,
+ WAIT_NOTINDEADLOCK = 0x4
+}WAIT_OPTION;
+
+#ifdef FEATURE_INCLUDE_ALL_INTERFACES
+cpp_quote("EXTERN_GUID(IID_ICLRMemoryNotificationCallback, 0x47EB8E57, 0x0846, 0x4546, 0xAF, 0x76, 0x6F, 0x42, 0xFC, 0xFC, 0x26, 0x49);")
+[
+ uuid(47EB8E57-0846-4546-AF76-6F42FCFC2649),
+ version(1.0),
+ helpstring("Callback by Host to notify runtime short of memory"),
+ pointer_default(unique),
+ local
+]
+interface ICLRMemoryNotificationCallback : IUnknown
+{
+ // Callback by Host on out of memory to request runtime to free memory.
+ // Runtime will do a GC and Wait for PendingFinalizer.
+ HRESULT OnMemoryNotification([in] EMemoryAvailable eMemoryAvailable);
+}
+
+[
+ uuid(1831991C-CC53-4A31-B218-04E910446479),
+ version(1.0),
+ helpstring("Host Malloc"),
+ pointer_default(unique),
+ local
+]
+interface IHostMalloc : IUnknown
+{
+ HRESULT Alloc([in] SIZE_T cbSize,
+ [in] EMemoryCriticalLevel eCriticalLevel,
+ [out] void** ppMem);
+
+ HRESULT DebugAlloc([in] SIZE_T cbSize,
+ [in] EMemoryCriticalLevel eCriticalLevel,
+ [in, annotation("_In_ ")] char* pszFileName,
+ [in] int iLineNo,
+ [out, annotation("_Outptr_result_maybenull_")] void** ppMem);
+
+ HRESULT Free([in] void* pMem);
+}
+
+typedef enum
+{
+ MALLOC_THREADSAFE = 0x1,
+ MALLOC_EXECUTABLE = 0x2,
+} MALLOC_TYPE;
+
+[
+ uuid(7BC698D1-F9E3-4460-9CDE-D04248E9FA25),
+ version(1.0),
+ helpstring("Host memory manager"),
+ pointer_default(unique),
+ local
+]
+interface IHostMemoryManager : IUnknown
+{
+ HRESULT CreateMalloc([in] DWORD dwMallocType,
+ [out] IHostMalloc **ppMalloc);
+
+ HRESULT VirtualAlloc([in] void* pAddress,
+ [in] SIZE_T dwSize,
+ [in] DWORD flAllocationType,
+ [in] DWORD flProtect,
+ [in] EMemoryCriticalLevel eCriticalLevel,
+ [out] void** ppMem);
+
+ HRESULT VirtualFree([in] LPVOID lpAddress,
+ [in] SIZE_T dwSize,
+ [in] DWORD dwFreeType);
+
+ HRESULT VirtualQuery([in] void * lpAddress,
+ [out] void* lpBuffer,
+ [in] SIZE_T dwLength,
+ [out] SIZE_T * pResult);
+
+ HRESULT VirtualProtect([in] void * lpAddress,
+ [in] SIZE_T dwSize,
+ [in] DWORD flNewProtect,
+ [out] DWORD * pflOldProtect);
+
+ HRESULT GetMemoryLoad([out] DWORD* pMemoryLoad,
+ [out] SIZE_T *pAvailableBytes);
+
+ HRESULT RegisterMemoryNotificationCallback([in] ICLRMemoryNotificationCallback * pCallback);
+
+ HRESULT NeedsVirtualAddressSpace(
+ [in] LPVOID startAddress,
+ [in] SIZE_T size
+ );
+
+ HRESULT AcquiredVirtualAddressSpace(
+ [in] LPVOID startAddress,
+ [in] SIZE_T size
+ );
+
+ HRESULT ReleasedVirtualAddressSpace(
+ [in] LPVOID startAddress
+ );
+}
+#endif // FEATURE_INCLUDE_ALL_INTERFACES
+
+typedef UINT64 TASKID;
+typedef DWORD CONNID;
+
+#ifdef FEATURE_INCLUDE_ALL_INTERFACES
+[
+ uuid(28E66A4A-9906-4225-B231-9187C3EB8611),
+ version(1.0),
+ helpstring("Callback by Host to collaborate with CLR on HostTask"),
+ pointer_default(unique),
+ local
+]
+interface ICLRTask: IUnknown
+{
+ HRESULT SwitchIn([in] HANDLE threadHandle);
+ HRESULT SwitchOut();
+ HRESULT GetMemStats([out] COR_GC_THREAD_STATS *memUsage);
+ HRESULT Reset(BOOL fFull);
+ HRESULT ExitTask();
+ HRESULT Abort();
+ HRESULT RudeAbort();
+ HRESULT NeedsPriorityScheduling([out] BOOL * pbNeedsPriorityScheduling);
+ HRESULT YieldTask();
+ HRESULT LocksHeld([out] SIZE_T *pLockCount);
+ HRESULT SetTaskIdentifier([in] TASKID asked);
+}
+
+[
+ uuid(28E66A4A-9906-4225-B231-9187C3EB8612),
+ version(1.0),
+ helpstring("Callback by Host to collaborate with CLR on HostTask"),
+ pointer_default(unique),
+ local
+]
+interface ICLRTask2 : ICLRTask
+{
+ HRESULT BeginPreventAsyncAbort();
+ HRESULT EndPreventAsyncAbort();
+}
+
+
+[
+ uuid(C2275828-C4B1-4B55-82C9-92135F74DF1A),
+ version(1.0),
+ helpstring("Called by CLR to operate on a HostTask"),
+ pointer_default(unique),
+ local
+]
+interface IHostTask : IUnknown
+{
+ HRESULT Start();
+ HRESULT Alert();
+ HRESULT Join([in] DWORD dwMilliseconds,
+ [in] DWORD option);
+ HRESULT SetPriority([in] int newPriority);
+ HRESULT GetPriority([out] int *pPriority);
+ HRESULT SetCLRTask([in] ICLRTask *pCLRTask);
+}
+#endif // FEATURE_INCLUDE_ALL_INTERFACES
+
+typedef enum ETaskType
+{
+ TT_DEBUGGERHELPER = 0x1,
+ TT_GC = 0x2,
+ TT_FINALIZER = 0x4,
+ TT_THREADPOOL_TIMER = 0x8,
+ TT_THREADPOOL_GATE = 0x10,
+ TT_THREADPOOL_WORKER = 0x20,
+ TT_THREADPOOL_IOCOMPLETION = 0x40,
+ TT_ADUNLOAD = 0x80,
+ TT_USER = 0x100,
+ TT_THREADPOOL_WAIT = 0x200,
+
+ TT_UNKNOWN = 0x80000000,
+} ETaskType;
+
+#ifdef FEATURE_INCLUDE_ALL_INTERFACES
+[
+ uuid(4862efbe-3ae5-44f8-8feb-346190ee8a34),
+ version(1.0),
+ helpstring("Functions provided by CLR to handle a CLRTask"),
+ pointer_default(unique),
+ local
+]
+interface ICLRTaskManager : IUnknown
+{
+ HRESULT CreateTask ([out] ICLRTask **pTask);
+ HRESULT GetCurrentTask ([out] ICLRTask **pTask);
+ HRESULT SetUILocale([in] LCID lcid);
+ HRESULT SetLocale([in] LCID lcid);
+
+ HRESULT GetCurrentTaskType([out] ETaskType *pTaskType);
+
+}
+
+[
+ uuid(997FF24C-43B7-4352-8667-0DC04FAFD354),
+ version(1.0),
+ helpstring("Functions provided by host to handle a HostTask"),
+ pointer_default(unique),
+ local
+]
+interface IHostTaskManager : IUnknown
+{
+ HRESULT GetCurrentTask ([out] IHostTask **pTask);
+ HRESULT CreateTask ([in] DWORD dwStackSize,
+ [in] LPTHREAD_START_ROUTINE pStartAddress,
+ [in] PVOID pParameter,
+ [out] IHostTask **ppTask);
+ HRESULT Sleep([in] DWORD dwMilliseconds,
+ [in] DWORD option);
+ HRESULT SwitchToTask([in] DWORD option);
+
+ HRESULT SetUILocale([in] LCID lcid);
+ HRESULT SetLocale([in] LCID lcid);
+
+ HRESULT CallNeedsHostHook([in] SIZE_T target,
+ [out] BOOL *pbCallNeedsHostHook);
+
+ HRESULT LeaveRuntime([in] SIZE_T target);
+ HRESULT EnterRuntime();
+
+ HRESULT ReverseLeaveRuntime();
+ HRESULT ReverseEnterRuntime();
+
+ HRESULT BeginDelayAbort();
+ HRESULT EndDelayAbort();
+ HRESULT BeginThreadAffinity();
+ HRESULT EndThreadAffinity();
+
+ HRESULT SetStackGuarantee([in] ULONG guarantee);
+ HRESULT GetStackGuarantee([out] ULONG *pGuarantee);
+
+ HRESULT SetCLRTaskManager([in] ICLRTaskManager *ppManager);
+
+}
+
+[
+ uuid(983D50E2-CB15-466B-80FC-845DC6E8C5FD),
+ version(1.0),
+ helpstring("Threadpool Functions provided by host"),
+ pointer_default(unique),
+ local
+]
+interface IHostThreadpoolManager : IUnknown
+{
+ HRESULT QueueUserWorkItem(
+ [in] LPTHREAD_START_ROUTINE Function,
+ [in] PVOID Context,
+ [in] ULONG Flags);
+ HRESULT SetMaxThreads(
+ [in] DWORD dwMaxWorkerThreads);
+ HRESULT GetMaxThreads(
+ [out] DWORD *pdwMaxWorkerThreads);
+ HRESULT GetAvailableThreads(
+ [out] DWORD *pdwAvailableWorkerThreads);
+ HRESULT SetMinThreads(
+ [in] DWORD dwMinIOCompletionThreads);
+ HRESULT GetMinThreads(
+ [out] DWORD *pdwMinIOCompletionThreads);
+}
+
+[
+ uuid(2d74ce86-b8d6-4c84-b3a7-9768933b3c12),
+ version(1.0),
+ helpstring("Asynchronous IO support callback"),
+ pointer_default(unique),
+ local
+]
+interface ICLRIoCompletionManager : IUnknown
+{
+ HRESULT OnComplete(
+ [in] DWORD dwErrorCode,
+ [in] DWORD NumberOfBytesTransferred,
+ [in] void* pvOverlapped);
+}
+
+[
+ uuid(8bde9d80-ec06-41d6-83e6-22580effcc20),
+ version(1.0),
+ helpstring("Asynchronous IO support provided by host"),
+ pointer_default(unique),
+ local
+]
+interface IHostIoCompletionManager : IUnknown
+{
+ HRESULT CreateIoCompletionPort(
+ [out] HANDLE *phPort);
+ HRESULT CloseIoCompletionPort(
+ [in] HANDLE hPort);
+ HRESULT SetMaxThreads(
+ [in] DWORD dwMaxIOCompletionThreads);
+ HRESULT GetMaxThreads(
+ [out] DWORD *pdwMaxIOCompletionThreads);
+ HRESULT GetAvailableThreads(
+ [out] DWORD *pdwAvailableIOCompletionThreads);
+ HRESULT GetHostOverlappedSize(
+ [out] DWORD * pcbSize);
+ HRESULT SetCLRIoCompletionManager(
+ [in] ICLRIoCompletionManager * pManager);
+ HRESULT InitializeHostOverlapped(
+ [in] void * pvOverlapped);
+ HRESULT Bind(
+ [in] HANDLE hPort,
+ [in] HANDLE hHandle);
+ HRESULT SetMinThreads(
+ [in] DWORD dwMinIOCompletionThreads);
+ HRESULT GetMinThreads(
+ [out] DWORD *pdwMinIOCompletionThreads);
+}
+#endif // FEATURE_INCLUDE_ALL_INTERFACES
+
+typedef enum {
+ eSymbolReadingNever = 0, // Never read PDBs
+ eSymbolReadingAlways = 1, // Always read PDBs
+ eSymbolReadingFullTrustOnly = 2 // Only read PDBs that correspond to full-trust assemblies
+} ESymbolReadingPolicy;
+
+#ifdef FEATURE_INCLUDE_ALL_INTERFACES
+[
+ uuid(00DCAEC6-2AC0-43a9-ACF9-1E36C139B10D),
+ version(1.0),
+ helpstring("CLR debugger manager"),
+ pointer_default(unique),
+ local
+]
+interface ICLRDebugManager : IUnknown
+{
+ HRESULT BeginConnection(
+ [in] CONNID dwConnectionId,
+ [in, string, annotation("_In_")] wchar_t *szConnectionName);
+ HRESULT SetConnectionTasks(
+ [in] CONNID id,
+ [in] DWORD dwCount,
+ [in, size_is(dwCount)] ICLRTask **ppCLRTask);
+ HRESULT EndConnection(
+ [in] CONNID dwConnectionId);
+ // Set ACL on shared section, events, and process
+ HRESULT SetDacl([in] PACL pacl);
+
+ // Returning the current ACL that CLR is using
+ // The memory is allocated by runtime using CoTaskmemAlloc. Caller must
+ // free the memory pointed to by pacl using CoTaskMemFree.
+ HRESULT GetDacl([out] PACL *pacl);
+
+ // Indicates whether or not a managed debugger is attached to this process.
+ HRESULT IsDebuggerAttached([out] BOOL *pbAttached);
+
+ // Specify whether the symbol reader should be used. Affects whether file and line
+ // info can be included when the CLR captures a call stack.
+ HRESULT SetSymbolReadingPolicy([in] ESymbolReadingPolicy policy);
+}
+#endif // FEATURE_INCLUDE_ALL_INTERFACES
+
+typedef enum {
+ // Default to minidump
+ DUMP_FLAVOR_Mini = 0,
+
+ // Include critical CLR state
+ DUMP_FLAVOR_CriticalCLRState = 1,
+
+ // Include critical CLR state and ngen images without including hosted heap
+ // It is host's responsibility to report hosted heap.
+ DUMP_FLAVOR_NonHeapCLRState = 2,
+
+ DUMP_FLAVOR_Default = DUMP_FLAVOR_Mini
+
+} ECustomDumpFlavor;
+
+// reserved for future extension
+typedef enum
+{
+ DUMP_ITEM_None = 0
+} ECustomDumpItemKind;
+
+//
+// The CustomDumpItem structure describes an item to be added to a dump.
+// It is defined for future expansion and is not presently used.
+//
+typedef struct
+{
+ ECustomDumpItemKind itemKind; //this affects how next fields are interpreted.
+ union
+ {
+ // Union to be expanded later if need be
+ UINT_PTR pReserved;
+ };
+} CustomDumpItem;
+
+const DWORD BucketParamsCount = 10;
+const DWORD BucketParamLength = 255;
+
+// used for indexing into BucketParameters::pszParams
+typedef enum
+{
+ Parameter1 = 0,
+ Parameter2,
+ Parameter3,
+ Parameter4,
+ Parameter5,
+ Parameter6,
+ Parameter7,
+ Parameter8,
+ Parameter9,
+ InvalidBucketParamIndex
+} BucketParameterIndex;
+
+typedef struct _BucketParameters
+{
+ BOOL fInited; // Set to TRUE if the rest of this structure is valid.
+ WCHAR pszEventTypeName[BucketParamLength]; // Name of the event type.
+ WCHAR pszParams[BucketParamsCount][BucketParamLength]; // Parameter strings.
+} BucketParameters;
+
+#if defined(FEATURE_INCLUDE_ALL_INTERFACES) || defined(FEATURE_WINDOWSPHONE)
+[
+ uuid(980D2F1A-BF79-4c08-812A-BB9778928F78),
+ version(1.0),
+ helpstring("CLR error reporting manager"),
+ pointer_default(unique),
+ local
+]
+interface ICLRErrorReportingManager : IUnknown
+{
+ // Get Watson bucket parameters for "current" exception (on calling thread).
+ HRESULT GetBucketParametersForCurrentException([out] BucketParameters *pParams);
+
+ // The BeginCustomDump function configures the custom dump support
+ HRESULT BeginCustomDump( [in] ECustomDumpFlavor dwFlavor,
+ [in] DWORD dwNumItems,
+ [in, size_is(dwNumItems), length_is(dwNumItems)] CustomDumpItem *items,
+ DWORD dwReserved);
+
+ // EndCustomDump clears the custom dump configuration
+ HRESULT EndCustomDump();
+}
+
+#ifdef FEATURE_WINDOWSPHONE
+typedef enum
+{
+ // indicates that the specified value is the Application ID
+ ApplicationID = 0x1,
+
+ // indicates that the specified value is the application's Instance ID
+ InstanceID = 0x2,
+
+ // additional values are reserved for future use
+} ApplicationDataKey;
+
+[
+ uuid(C68F63B1-4D8B-4E0B-9564-9D2EFE2FA18C),
+ version(1.0),
+ helpstring("CLR error reporting manager 2"),
+ pointer_default(unique),
+ local
+]
+interface ICLRErrorReportingManager2 : ICLRErrorReportingManager
+{
+ // This API will allow the host to specify key/value pairs of data to be consumed by the CLR.
+ //
+ // Parameters:
+ // [in] key - One of the values specified in the ApplicationDataKey enumerated type.
+ //
+ // [in] pValue - A NULL-terminated WCHAR string with a maximum length of MAX_PATH containing the corresponding
+ // value. Note that the CLR maintains its own copy of the data so this structure does not need
+ // to persist after the API call returns.
+ //
+ // Return values:
+ // S_OK upon success.
+ //
+ // Any other return value indicates that the API did not complete successfully and no value was set.
+ //
+ // Well-defined errors:
+ // E_INVALIDOPERATION if the CLR has already started.
+ // E_INVALIDARG for any of the following:
+ // key is not within the range of valid values for ApplicationDataKey
+ // pValue == NULL
+ // length of pValue is greater than MAX_PATH
+ HRESULT SetApplicationData([in] ApplicationDataKey key, [in] WCHAR const* pValue);
+
+ // This API will allow the host to specify pre-defined Watson bucket data in the event of an unhandled
+ // exception, allowing the host to override Watson bucket parameter data that is usually collected and
+ // populated by the CLR. It should be called before the CLR has started.
+ // The BucketParameters data structure must be properly initialized before calling this API by zeroing
+ // out all fields, setting pszParams entries as required, then setting fInited to TRUE.
+ // A NULL pszParams entry indicates that the bucket parameter should not be overridden, and if all pszParams
+ // entries are NULL then the API call will fail.
+ // To override a bucket parameter with an empty string specify a pszParams entry with a blank string (one or
+ // more whitespace characters).
+ //
+ // NOTE: The current implementation allows overriding of the first bucket parameter only (pszParams[0]).
+ // Any other non-NULL pszParams entries will be ignored. This is subject to change in future releases.
+ //
+ // Parameters:
+ // [in] pBucketParams - A pointer to an initialized BucketParameters structure which contains the data to be
+ // reported in the event of an unhandled exception. Note that the CLR maintains its own
+ // copy of the data so this structure does not need to persist after the API call returns.
+ //
+ // [out] pCountParams - A pointer to a DWORD indicating the number of bucket parameter values that have
+ // been overridden by the host. A count of 0 indicates that no parameters were
+ // overridden.
+ //
+ // Return values:
+ // S_OK upon success. In this case the value pointed to by pCountParams will be greater than 0.
+ //
+ // Any other return value indicates that the API did not complete successfully. In this case the value
+ // pointed to by pCountParams will be 0.
+ //
+ // Well-defined errors:
+ // E_INVALIDOPERATION if the CLR has already started.
+ // E_INVALIDARG for any of the following:
+ // pBucketParams or pCountParams is NULL
+ // pBucketParams->fInited != TRUE
+ // if all BucketParameters.pszParams are NULL
+ HRESULT SetBucketParametersForUnhandledException([in] BucketParameters const* pBucketParams, [out] DWORD* pCountParams);
+}
+#endif // FEATURE_WINDOWSPHONE
+
+#endif // defined(FEATURE_INCLUDE_ALL_INTERFACES) || defined(FEATURE_WINDOWSPHONE)
+
+#ifdef FEATURE_INCLUDE_ALL_INTERFACES
+[
+ uuid(6DF710A6-26A4-4a65-8CD5-7237B8BDA8DC),
+ version(1.0),
+ helpstring("CriticalSection provided by host"),
+ pointer_default(unique),
+ local
+]
+interface IHostCrst : IUnknown
+{
+ HRESULT Enter([in] DWORD option);
+ HRESULT Leave();
+ HRESULT TryEnter([in] DWORD option,
+ [out] BOOL *pbSucceeded);
+ HRESULT SetSpinCount([in] DWORD dwSpinCount);
+}
+
+[
+ uuid(50B0CFCE-4063-4278-9673-E5CB4ED0BDB8),
+ version(1.0),
+ helpstring("AutoEvent provided by host"),
+ pointer_default(unique),
+ local
+]
+interface IHostAutoEvent : IUnknown
+{
+ HRESULT Wait([in] DWORD dwMilliseconds,
+ [in] DWORD option);
+ HRESULT Set();
+}
+
+[
+ uuid(1BF4EC38-AFFE-4fb9-85A6-525268F15B54),
+ version(1.0),
+ helpstring("ManualEvent provided by host"),
+ pointer_default(unique),
+ local
+]
+interface IHostManualEvent : IUnknown
+{
+ HRESULT Wait([in] DWORD dwMilliseconds,
+ [in] DWORD option);
+ HRESULT Reset();
+ HRESULT Set();
+}
+
+[
+ uuid(855efd47-cc09-463a-a97d-16acab882661),
+ version(1.0),
+ helpstring("Semaphore provided by host"),
+ pointer_default(unique),
+ local
+]
+interface IHostSemaphore : IUnknown
+{
+ HRESULT Wait([in] DWORD dwMilliseconds,
+ [in] DWORD option);
+ HRESULT ReleaseSemaphore([in] LONG lReleaseCount,
+ [out] LONG *lpPreviousCount);
+}
+
+[
+ uuid(55FF199D-AD21-48f9-A16C-F24EBBB8727D),
+ version(1.0),
+ helpstring("Functions provided by CLR to provide infomation on synchronization objects"),
+ pointer_default(unique),
+ local
+]
+interface ICLRSyncManager : IUnknown
+{
+ HRESULT GetMonitorOwner ([in] SIZE_T Cookie,
+ [out] IHostTask **ppOwnerHostTask);
+
+ HRESULT CreateRWLockOwnerIterator([in] SIZE_T Cookie, [out] SIZE_T *pIterator);
+ HRESULT GetRWLockOwnerNext([in] SIZE_T Iterator, [out] IHostTask **ppOwnerHostTask);
+ HRESULT DeleteRWLockOwnerIterator([in] SIZE_T Iterator);
+}
+
+[
+ uuid(234330c7-5f10-4f20-9615-5122dab7a0ac),
+ version(1.0),
+ helpstring("Functions provided by host to create synchronization objects"),
+ pointer_default(unique),
+ local
+]
+interface IHostSyncManager : IUnknown
+{
+ HRESULT SetCLRSyncManager([in] ICLRSyncManager *pManager);
+
+ HRESULT CreateCrst([out] IHostCrst** ppCrst);
+ HRESULT CreateCrstWithSpinCount ([in] DWORD dwSpinCount,
+ [out] IHostCrst** ppCrst);
+
+ HRESULT CreateAutoEvent([out] IHostAutoEvent **ppEvent);
+ HRESULT CreateManualEvent([in] BOOL bInitialState,
+ [out] IHostManualEvent **ppEvent);
+
+ HRESULT CreateMonitorEvent([in] SIZE_T Cookie,
+ [out] IHostAutoEvent **ppEvent);
+
+ HRESULT CreateRWLockWriterEvent([in] SIZE_T Cookie,
+ [out] IHostAutoEvent **ppEvent);
+ HRESULT CreateRWLockReaderEvent([in] BOOL bInitialState,
+ [in] SIZE_T Cookie,
+ [out] IHostManualEvent **ppEvent);
+
+ HRESULT CreateSemaphore([in] DWORD dwInitial,
+ [in] DWORD dwMax,
+ [out] IHostSemaphore ** ppSemaphore);
+}
+#endif // FEATURE_INCLUDE_ALL_INTERFACES
+
+typedef enum
+{
+ OPR_ThreadAbort,
+ OPR_ThreadRudeAbortInNonCriticalRegion,
+ OPR_ThreadRudeAbortInCriticalRegion,
+ OPR_AppDomainUnload,
+ OPR_AppDomainRudeUnload,
+ OPR_ProcessExit,
+ OPR_FinalizerRun,
+ MaxClrOperation
+ // Do not add anything after this
+} EClrOperation;
+
+typedef enum
+{
+ FAIL_NonCriticalResource,
+ FAIL_CriticalResource,
+ FAIL_FatalRuntime,
+ FAIL_OrphanedLock,
+ FAIL_StackOverflow,
+ // In CoreCLR, we will treat AV specially, based upon the escalation policy.
+ // Currently only used in CoreCLR.
+ FAIL_AccessViolation,
+ FAIL_CodeContract,
+ MaxClrFailure
+ // Do not add anything after this
+} EClrFailure;
+
+typedef enum
+{
+ eRuntimeDeterminedPolicy, // default
+ eHostDeterminedPolicy, // revert back to Everett behavior, i.e. swallow all exception
+} EClrUnhandledException;
+
+typedef enum
+{
+ // !!! Please keep these ordered by severity
+ // !!! If you don't, you need to change EEPolicy::IsValidActionForOperation
+ // !!! and EEPolicy::IsValidActionForFailure
+ eNoAction,
+ eThrowException,
+ eAbortThread,
+ eRudeAbortThread,
+ eUnloadAppDomain,
+ eRudeUnloadAppDomain,
+ eExitProcess,
+ // Look at CorHost2::Stop. For eFastExitProcess, eRudeExitProcess, eDisableRuntime,
+ // Stop bypasses finalizer run.
+ eFastExitProcess,
+ eRudeExitProcess,
+ eDisableRuntime,
+ MaxPolicyAction
+} EPolicyAction;
+
+[
+ uuid(7D290010-D781-45da-A6F8-AA5D711A730E),
+ version(1.0),
+ helpstring("Allow host to specify policy for CLR to follow in abnormal condition"),
+ pointer_default(unique),
+ local
+]
+interface ICLRPolicyManager: IUnknown
+{
+ HRESULT SetDefaultAction(
+ [in] EClrOperation operation,
+ [in] EPolicyAction action);
+
+ HRESULT SetTimeout(
+ [in] EClrOperation operation,
+ [in] DWORD dwMilliseconds);
+
+ HRESULT SetActionOnTimeout(
+ [in] EClrOperation operation,
+ [in] EPolicyAction action);
+
+ HRESULT SetTimeoutAndAction(
+ [in] EClrOperation operation,
+ [in] DWORD dwMilliseconds,
+ [in] EPolicyAction action);
+
+ HRESULT SetActionOnFailure(
+ [in] EClrFailure failure,
+ [in] EPolicyAction action);
+
+ HRESULT SetUnhandledExceptionPolicy(
+ [in] EClrUnhandledException policy);
+}
+
+#ifdef FEATURE_INCLUDE_ALL_INTERFACES
+[
+ uuid(7AE49844-B1E3-4683-BA7C-1E8212EA3B79),
+ version(1.0),
+ helpstring("Notify host about how CLR handles abnormal condition"),
+ pointer_default(unique),
+ local
+]
+interface IHostPolicyManager: IUnknown
+{
+ HRESULT OnDefaultAction(
+ [in] EClrOperation operation,
+ [in] EPolicyAction action);
+
+ HRESULT OnTimeout(
+ [in] EClrOperation operation,
+ [in] EPolicyAction action);
+
+ HRESULT OnFailure(
+ [in] EClrFailure failure,
+ [in] EPolicyAction action);
+}
+#endif // FEATURE_INCLUDE_ALL_INTERFACES
+
+typedef enum
+{
+ Event_DomainUnload,
+ Event_ClrDisabled,
+ Event_MDAFired,
+ Event_StackOverflow,
+ MaxClrEvent
+ // Do not add anything after this
+} EClrEvent;
+
+// An MDAInfo is passed via OnEvent for Event_MDAFired events.
+typedef struct _MDAInfo
+{
+ LPCWSTR lpMDACaption;
+ LPCWSTR lpMDAMessage;
+ LPCWSTR lpStackTrace;
+} MDAInfo;
+
+// An StackOverflowInfo is passed via OnEvent for Event_StackOverflow events.
+typedef enum
+{
+ SO_Managed,
+ SO_ClrEngine,
+ SO_Other,
+} StackOverflowType;
+
+cpp_quote("typedef struct _StackOverflowInfo")
+cpp_quote("{")
+cpp_quote(" StackOverflowType soType;")
+cpp_quote(" EXCEPTION_POINTERS *pExceptionInfo;")
+cpp_quote("} StackOverflowInfo;")
+
+#ifdef FEATURE_INCLUDE_ALL_INTERFACES
+[
+ uuid(607BE24B-D91B-4E28-A242-61871CE56E35),
+ version(1.0),
+ helpstring("Allow host to register action on domain unload"),
+ pointer_default(unique),
+ local
+]
+interface IActionOnCLREvent: IUnknown
+{
+ HRESULT OnEvent(
+ [in] EClrEvent event,
+ [in] PVOID data
+ );
+}
+
+[
+ uuid(1D0E0132-E64F-493D-9260-025C0E32C175),
+ version(1.0),
+ helpstring("Allow host to register action on event"),
+ pointer_default(unique),
+ local
+]
+interface ICLROnEventManager: IUnknown
+{
+ HRESULT RegisterActionOnEvent(
+ [in] EClrEvent event,
+ [in] IActionOnCLREvent *pAction
+ );
+ HRESULT UnregisterActionOnEvent(
+ [in] EClrEvent event,
+ [in] IActionOnCLREvent *pAction
+ );
+}
+
+[
+ uuid(5D4EC34E-F248-457B-B603-255FAABA0D21),
+ version(1.0),
+ helpstring("Control over threads blocked in GC"),
+ pointer_default(unique),
+ local
+]
+interface IHostGCManager : IUnknown
+{
+ // Notification that the thread making the call is about to block, perhaps for
+ // a GC or other suspension. This gives the host an opportunity to re-schedule
+ // the thread for unmanaged tasks.
+ HRESULT ThreadIsBlockingForSuspension();
+
+ // Notification that the runtime is beginning a thread suspension for a GC or
+ // other suspension. Do not reschedule this thread!
+ HRESULT SuspensionStarting();
+
+ // Notification that the runtime is resuming threads after a GC or other
+ // suspension. Do not reschedule this thread!
+ HRESULT SuspensionEnding(DWORD Generation);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// ICLRAssemblyReferenceList
+//
+///////////////////////////////////////////////////////////////////////////////
+[
+ object,
+ version(1.0),
+ uuid(1b2c9750-2e66-4bda-8b44-0a642c5cd733),
+ helpstring("Generic Assembly Reference List, created by CLR."),
+ pointer_default(unique),
+ local
+]
+interface ICLRAssemblyReferenceList : IUnknown
+{
+ HRESULT IsStringAssemblyReferenceInList(
+ [in] LPCWSTR pwzAssemblyName
+ );
+
+ HRESULT IsAssemblyReferenceInList(
+ [in] IUnknown *pName
+ );
+};
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// ICLRReferenceAssemblyEnum
+//
+///////////////////////////////////////////////////////////////////////////////
+[
+ object,
+ version(1.0),
+ uuid(d509cb5d-cf32-4876-ae61-67770cf91973),
+ helpstring("Reference Enum of an Assembly."),
+ pointer_default(unique),
+ local
+]
+interface ICLRReferenceAssemblyEnum : IUnknown
+{
+ HRESULT Get(
+ [in] DWORD dwIndex,
+ [out, size_is(*pcchBufferSize), annotation("_Out_writes_all_(*pcchBufferSize)")]
+ LPWSTR pwzBuffer,
+ [in, out] DWORD *pcchBufferSize
+ );
+};
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// ICLRProbingAssemblyEnum
+//
+///////////////////////////////////////////////////////////////////////////////
+[
+ object,
+ version(1.0),
+ uuid(d0c5fb1f-416b-4f97-81f4-7ac7dc24dd5d),
+ helpstring("The assemblies CLR will probe for given assembly"),
+ pointer_default(unique),
+ local
+]
+interface ICLRProbingAssemblyEnum:IUnknown
+{
+ HRESULT Get(
+ [in] DWORD dwIndex,
+ [out, size_is(*pcchBufferSize), annotation("_Out_writes_all_(*pcchBufferSize)")]
+ LPWSTR pwzBuffer,
+ [in, out] DWORD *pcchBufferSize
+ );
+};
+
+typedef enum _CLRAssemblyIdentityFlags
+{
+ CLR_ASSEMBLY_IDENTITY_FLAGS_DEFAULT = 0
+}ECLRAssemblyIdentityFlags;
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// ICLRAssemblyIdentityManager
+//
+///////////////////////////////////////////////////////////////////////////////
+[
+ object,
+ version(1.0),
+ uuid(15f0a9da-3ff6-4393-9da9-fdfd284e6972),
+ helpstring("CLR Assembly Identity Manager"),
+ pointer_default(unique),
+ local
+]
+interface ICLRAssemblyIdentityManager : IUnknown
+{
+ HRESULT GetCLRAssemblyReferenceList(
+ [in] LPCWSTR *ppwzAssemblyReferences,
+ [in] DWORD dwNumOfReferences,
+ [out] ICLRAssemblyReferenceList **ppReferenceList
+ );
+
+ HRESULT GetBindingIdentityFromFile(
+ [in] LPCWSTR pwzFilePath,
+ [in] DWORD dwFlags,
+ [out, size_is(*pcchBufferSize), annotation("_Out_writes_all_(*pcchBufferSize)")]
+ LPWSTR pwzBuffer,
+ [in, out] DWORD *pcchBufferSize
+ );
+
+ HRESULT GetBindingIdentityFromStream(
+ [in] IStream *pStream,
+ [in] DWORD dwFlags,
+ [out, size_is(*pcchBufferSize), annotation("_Out_writes_all_(*pcchBufferSize)")]
+ LPWSTR pwzBuffer,
+ [in, out] DWORD *pcchBufferSize
+ );
+
+ HRESULT GetReferencedAssembliesFromFile(
+ [in] LPCWSTR pwzFilePath,
+ [in] DWORD dwFlags,
+ [in] ICLRAssemblyReferenceList *pExcludeAssembliesList,
+ [out] ICLRReferenceAssemblyEnum **ppReferenceEnum
+ );
+
+ HRESULT GetReferencedAssembliesFromStream(
+ [in] IStream *pStream,
+ [in] DWORD dwFlags,
+ [in] ICLRAssemblyReferenceList *pExcludeAssembliesList,
+ [out] ICLRReferenceAssemblyEnum **ppReferenceEnum
+ );
+
+ HRESULT GetProbingAssembliesFromReference(
+ [in] DWORD dwMachineType,
+ [in] DWORD dwFlags,
+ [in] LPCWSTR pwzReferenceIdentity,
+ [out] ICLRProbingAssemblyEnum **ppProbingAssemblyEnum
+ );
+
+ HRESULT IsStronglyNamed(
+ [in] LPCWSTR pwzAssemblyIdentity,
+ [out] BOOL *pbIsStronglyNamed
+ );
+};
+
+typedef enum _hostBiningPolicyModifyFlags
+{
+ HOST_BINDING_POLICY_MODIFY_DEFAULT = 0,
+ HOST_BINDING_POLICY_MODIFY_CHAIN = 1,
+ HOST_BINDING_POLICY_MODIFY_REMOVE = 2,
+ HOST_BINDING_POLICY_MODIFY_MAX = 3
+}EHostBindingPolicyModifyFlags;
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// ICLRHostBindingPolicyManager
+//
+///////////////////////////////////////////////////////////////////////////////
+[
+ object,
+ version(1.0),
+ uuid(4b3545e7-1856-48c9-a8ba-24b21a753c09),
+ helpstring("CLR Host Binding Policy Manager, managing binding policy for host."),
+ pointer_default(unique),
+ local
+]
+interface ICLRHostBindingPolicyManager : IUnknown
+{
+ HRESULT ModifyApplicationPolicy(
+ [in] LPCWSTR pwzSourceAssemblyIdentity,
+ [in] LPCWSTR pwzTargetAssemblyIdentity,
+ [in] BYTE *pbApplicationPolicy,
+ [in] DWORD cbAppPolicySize,
+ [in] DWORD dwPolicyModifyFlags,
+ [out, size_is(*pcbNewAppPolicySize), annotation("_Out_writes_all_(*pcbNewAppPolicySize)")]
+ BYTE *pbNewApplicationPolicy,
+ [in, out] DWORD *pcbNewAppPolicySize
+ );
+
+ HRESULT EvaluatePolicy(
+ [in] LPCWSTR pwzReferenceIdentity,
+ [in] BYTE *pbApplicationPolicy,
+ [in] DWORD cbAppPolicySize,
+ [out, size_is(*pcchPostPolicyReferenceIdentity), annotation("_Out_writes_all_(*pcchPostPolicyReferenceIdentity)")]
+ LPWSTR pwzPostPolicyReferenceIdentity,
+ [in, out] DWORD *pcchPostPolicyReferenceIdentity,
+ [out] DWORD *pdwPoliciesApplied
+ );
+};
+#endif // FEATURE_INCLUDE_ALL_INTERFACES
+
+#if defined(FEATURE_INCLUDE_ALL_INTERFACES) || defined(FEATURE_WINDOWSPHONE)
+
+/*
+ * This interface is used to get information about the GC system and
+ * control some aspects of the GC. This interface is for expert usage
+ * only, and can severely impact the performance of an application if
+ * used improperly!!
+ */
+[
+ uuid(54D9007E-A8E2-4885-B7BF-F998DEEE4F2A),
+ version(1.0),
+ pointer_default(unique),
+ local
+]
+interface ICLRGCManager : IUnknown
+{
+ /*
+ * Forces a collection to occur for the given generation, regardless of
+ * current GC statistics. A value of -1 means collect all generations.
+ */
+ HRESULT Collect([in] LONG Generation);
+
+ /*
+ * Returns a set of current statistics about the state of the GC system.
+ * These values can then be used by a smart allocation system to help the
+ * GC run, by say adding more memory or forcing a collection.
+ */
+ HRESULT GetStats([in][out] COR_GC_STATS *pStats);
+
+ /*
+ * Sets the segment size and gen 0 maximum size. This value may only be
+ * specified once and will not change if called later.
+ */
+ HRESULT SetGCStartupLimits([in] DWORD SegmentSize, [in] DWORD MaxGen0Size);
+}
+
+/*
+ * This interface is added to allow users to specify 64-bit numbers on 64-bit OSs
+ * for the parameters to SetGCStartupLimits.
+ */
+[
+ uuid(0603B793-A97A-4712-9CB4-0CD1C74C0F7C),
+ version(2.0),
+ pointer_default(unique),
+ local
+]
+interface ICLRGCManager2 : ICLRGCManager
+{
+ /*
+ * Sets the segment size and gen 0 maximum size. This value may only be
+ * specified once and will not change if called later.
+ */
+ HRESULT SetGCStartupLimitsEx([in] SIZE_T SegmentSize, [in] SIZE_T MaxGen0Size);
+};
+
+
+#endif //FEATURE_INCLUDE_ALL_INTERFACES || FEATURE_WINDOWSPHONE
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// enum EBindPolicyLevels
+//
+///////////////////////////////////////////////////////////////////////////////
+typedef enum
+{
+ ePolicyLevelNone = 0x0,
+ ePolicyLevelRetargetable = 0x1,
+ ePolicyUnifiedToCLR = 0x2,
+ ePolicyLevelApp = 0x4,
+ ePolicyLevelPublisher = 0x8,
+ ePolicyLevelHost = 0x10,
+ ePolicyLevelAdmin = 0x20,
+ ePolicyPortability = 0x40,
+} EBindPolicyLevels;
+///////////////////////////////////////////////////////////////////////////////
+//
+// struct AssemblyBindInfo
+//
+///////////////////////////////////////////////////////////////////////////////
+typedef struct _AssemblyBindInfo
+{
+ DWORD dwAppDomainId;
+ LPCWSTR lpReferencedIdentity;
+ LPCWSTR lpPostPolicyIdentity;
+ DWORD ePolicyLevel;
+}AssemblyBindInfo;
+///////////////////////////////////////////////////////////////////////////////
+//
+// struct ModuleBindInfo
+//
+///////////////////////////////////////////////////////////////////////////////
+typedef struct _ModuleBindInfo
+{
+ DWORD dwAppDomainId;
+ LPCWSTR lpAssemblyIdentity;
+ LPCWSTR lpModuleName;
+} ModuleBindInfo;
+
+
+typedef enum _HostApplicationPolicy
+{
+ HOST_APPLICATION_BINDING_POLICY = 1
+}EHostApplicationPolicy;
+
+
+#ifdef FEATURE_INCLUDE_ALL_INTERFACES
+///////////////////////////////////////////////////////////////////////////////
+//
+// IHostAssemblyStore
+//
+///////////////////////////////////////////////////////////////////////////////
+[
+ local,
+ object,
+ version(1.0),
+ uuid(7b102a88-3f7f-496d-8fa2-c35374e01af3),
+ helpstring("Assembly Store provided by host"),
+ pointer_default(unique)
+]
+interface IHostAssemblyStore: IUnknown
+{
+ HRESULT ProvideAssembly
+ (
+ [in] AssemblyBindInfo *pBindInfo,
+ [out] UINT64 *pAssemblyId,
+ [out] UINT64 *pContext,
+ [out] IStream **ppStmAssemblyImage,
+ [out] IStream **ppStmPDB);
+
+ HRESULT ProvideModule
+ (
+ [in] ModuleBindInfo *pBindInfo,
+ [out] DWORD *pdwModuleId,
+ [out] IStream **ppStmModuleImage,
+ [out] IStream **ppStmPDB);
+};
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// IHostAssemblyManager
+//
+///////////////////////////////////////////////////////////////////////////////
+[
+ local,
+ object,
+ version(1.0),
+ uuid(613dabd7-62b2-493e-9e65-c1e32a1e0c5e),
+ helpstring("Assembly Manager provided by host"),
+ pointer_default(unique)
+]
+interface IHostAssemblyManager: IUnknown
+{
+ HRESULT GetNonHostStoreAssemblies
+ (
+ [out] ICLRAssemblyReferenceList **ppReferenceList
+ );
+
+ HRESULT GetAssemblyStore
+ (
+ [out] IHostAssemblyStore **ppAssemblyStore
+ );
+};
+#endif // FEATURE_INCLUDE_ALL_INTERFACES
+
+// Implemented in mscorwks.dll, use mscoree!GetRealProcAddress to get
+// a function pointer of this API.
+#pragma midl_echo("STDAPI GetCLRIdentityManager(REFIID riid, IUnknown **ppManager);")
+
+// {02CA073D-7079-4860-880A-C2F7A449C991}
+cpp_quote("EXTERN_GUID(IID_IHostControl, 0x02CA073C, 0x7079, 0x4860, 0x88, 0x0A, 0xC2, 0xF7, 0xA4, 0x49, 0xC9, 0x91);")
+[
+ uuid(02CA073C-7079-4860-880A-C2F7A449C991),
+ version(1.0),
+ helpstring("Common Language Runtime Host Control Interface"),
+ pointer_default(unique),
+ local
+]
+interface IHostControl : IUnknown
+{
+ HRESULT GetHostManager(
+ [in] REFIID riid,
+ [out] void **ppObject);
+
+ /* Notify Host with IUnknown with the pointer to AppDomainManager */
+ HRESULT SetAppDomainManager(
+ [in] DWORD dwAppDomainID,
+ [in] IUnknown* pUnkAppDomainManager);
+}
+
+cpp_quote("EXTERN_GUID(IID_ICLRControl, 0x9065597E, 0xD1A1, 0x4fb2, 0xB6, 0xBA, 0x7E, 0x1F, 0xCE, 0x23, 0x0F, 0x61);")
+[
+ uuid(9065597E-D1A1-4fb2-B6BA-7E1FCE230F61),
+ version(1.0),
+ helpstring("Common Language Runtime Control Interface"),
+ pointer_default(unique),
+ local
+]
+interface ICLRControl : IUnknown
+{
+ HRESULT GetCLRManager(
+ [in] REFIID riid,
+ [out] void **ppObject);
+
+ HRESULT SetAppDomainManagerType(
+ [in] LPCWSTR pwzAppDomainManagerAssembly,
+ [in] LPCWSTR pwzAppDomainManagerType);
+}
+
+
+
+//*****************************************************************************
+// New interface for hosting mscoree
+//*****************************************************************************
+[
+ uuid(90F1A06C-7712-4762-86B5-7A5EBA6BDB02),
+ version(1.0),
+ helpstring("Common Language Runtime Hosting Interface"),
+ pointer_default(unique),
+ local
+]
+interface ICLRRuntimeHost : IUnknown
+{
+ // Starts the runtime. This is equivalent to CoInitializeCor().
+ HRESULT Start();
+
+ // Terminates the runtime, This is equivalent CoUninitializeCor();
+ HRESULT Stop();
+
+ // Returns an object for configuring runtime, e.g. threading, lock
+ // prior it starts. If the runtime has been initialized this
+ // routine returns an error. See IHostControl.
+ HRESULT SetHostControl([in] IHostControl* pHostControl);
+
+ HRESULT GetCLRControl([out] ICLRControl** pCLRControl);
+
+ HRESULT UnloadAppDomain([in] DWORD dwAppDomainId,
+ [in] BOOL fWaitUntilDone);
+
+ HRESULT ExecuteInAppDomain([in] DWORD dwAppDomainId,
+ [in] FExecuteInAppDomainCallback pCallback,
+ [in] void* cookie);
+
+ HRESULT GetCurrentAppDomainId([out] DWORD *pdwAppDomainId);
+
+ HRESULT ExecuteApplication([in] LPCWSTR pwzAppFullName,
+ [in] DWORD dwManifestPaths,
+ [in] LPCWSTR *ppwzManifestPaths, // optional
+ [in] DWORD dwActivationData,
+ [in] LPCWSTR *ppwzActivationData, // optional
+ [out] int *pReturnValue);
+
+ HRESULT ExecuteInDefaultAppDomain([in] LPCWSTR pwzAssemblyPath,
+ [in] LPCWSTR pwzTypeName,
+ [in] LPCWSTR pwzMethodName,
+ [in] LPCWSTR pwzArgument,
+ [out] DWORD *pReturnValue);
+};
+
+#ifdef FEATURE_CORECLR
+
+// Keys for ICLRRuntmeHost2::Authenticate. No longer required.
+cpp_quote("#define CORECLR_HOST_AUTHENTICATION_KEY 0x1C6CA6F94025800LL")
+cpp_quote("#define CORECLR_HOST_AUTHENTICATION_KEY_NONGEN 0x1C6CA6F94025801LL")
+
+//*****************************************************************************
+// New interface for hosting mscoree
+//*****************************************************************************
+[
+ object,
+ uuid(712AB73F-2C22-4807-AD7E-F501D7B72C2D),
+ version(2.0),
+ helpstring("Common Language Runtime Hosting Interface"),
+ pointer_default(unique),
+ local
+]
+interface ICLRRuntimeHost2 : ICLRRuntimeHost
+{
+ // Creates an app domain (sandboxed or not) with the given manager class and the given
+ // set of properties.
+ HRESULT CreateAppDomainWithManager([in] LPCWSTR wszFriendlyName,
+ [in] DWORD dwFlags,
+ [in] LPCWSTR wszAppDomainManagerAssemblyName,
+ [in] LPCWSTR wszAppDomainManagerTypeName,
+ [in] int nProperties,
+ [in] LPCWSTR* pPropertyNames,
+ [in] LPCWSTR* pPropertyValues,
+ [out] DWORD* pAppDomainID);
+
+ HRESULT CreateDelegate([in] DWORD appDomainID,
+ [in] LPCWSTR wszAssemblyName,
+ [in] LPCWSTR wszClassName,
+ [in] LPCWSTR wszMethodName,
+ [out] INT_PTR* fnPtr);
+
+ // Authenticates a host based upon a key value. No longer required.
+ HRESULT Authenticate([in] ULONGLONG authKey);
+
+ // Ensures CLR-set Mac (Mach) EH port is registered.
+ HRESULT RegisterMacEHPort();
+
+ HRESULT SetStartupFlags([in] STARTUP_FLAGS dwFlags);
+
+ HRESULT DllGetActivationFactory([in] DWORD appDomainID,
+ [in] LPCWSTR wszTypeName,
+ [out] IActivationFactory ** factory);
+
+ HRESULT ExecuteAssembly([in] DWORD dwAppDomainId,
+ [in] LPCWSTR pwzAssemblyPath,
+ [in] int argc,
+ [in] LPCWSTR* argv,
+ [out] DWORD *pReturnValue);
+
+};
+
+[
+ uuid(1000A3E7-B420-4620-AE30-FB19B587AD1D),
+ version(1.0),
+ helpstring("Pause and Resume Interface"),
+ pointer_default(unique),
+ local
+]
+interface ICLRExecutionManager : IUnknown
+{
+ // Pause all managed threads
+ // Parameters are ignored and reserved for future use.
+ HRESULT Pause([in] DWORD dwAppDomainId, [in] DWORD dwFlags);
+
+ // Resume managed threads
+ // Parameters are ignored and reserved for future use.
+ HRESULT Resume([in] DWORD dwAppDomainId);
+}
+
+#endif // FEATURE_CORECLR
+
+//*****************************************************************************
+// Interface to utilize HostProtection
+//*****************************************************************************
+typedef enum
+{
+ eNoChecks = 0,
+ //---------------------------------
+ eSynchronization = 0x1,
+ eSharedState = 0x2,
+ eExternalProcessMgmt = 0x4,
+ eSelfAffectingProcessMgmt = 0x8,
+ eExternalThreading = 0x10,
+ eSelfAffectingThreading = 0x20,
+ eSecurityInfrastructure = 0x40,
+ eUI = 0x80,
+ eMayLeakOnAbort = 0x100,
+ //----------------------------------
+ eAll = 0x1ff
+} EApiCategories;
+
+#ifdef FEATURE_INCLUDE_ALL_INTERFACES
+[
+ object,
+ uuid(89F25F5C-CEEF-43e1-9CFA-A68CE863AAAC),
+ helpstring("Host Protection Interface"),
+ pointer_default(unique)
+]
+interface ICLRHostProtectionManager : IUnknown
+{
+ // These allow the host to specify resources that could cause
+ // instability in order to guarantee protection from them.
+ HRESULT SetProtectedCategories([in] EApiCategories categories);
+
+ // Call once before starting the runtime to sacrifice a little
+ // assembly-loading-performance for a guarantee that a certain
+ // rare race condition that can result in a FatalEE error won't
+ // happen.
+ HRESULT SetEagerSerializeGrantSets();
+};
+#endif // FEATURE_INCLUDE_ALL_INTERFACES
+
+//
+// Interface for configuring the default AppDomain
+//
+
+typedef enum
+{
+ eInitializeNewDomainFlags_None = 0x0000,
+
+ // InitializeNewDomain will not make changes to the security state of the AppDomain
+ eInitializeNewDomainFlags_NoSecurityChanges = 0x0002
+}
+EInitializeNewDomainFlags;
+
+#ifdef FEATURE_INCLUDE_ALL_INTERFACES
+[
+ object,
+ uuid(270D00A2-8E15-4d0b-ADEB-37BC3E47DF77),
+ helpstring("Default AppDomain Configuration Interface"),
+ pointer_default(unique)
+]
+interface ICLRDomainManager : IUnknown
+{
+ HRESULT SetAppDomainManagerType([in] LPCWSTR wszAppDomainManagerAssembly,
+ [in] LPCWSTR wszAppDomainManagerType,
+ [in] EInitializeNewDomainFlags dwInitializeDomainFlags);
+
+ HRESULT SetPropertiesForDefaultAppDomain([in] DWORD nProperties,
+ [in] LPCWSTR *pwszPropertyNames,
+ [in] LPCWSTR *pwszPropertyValues);
+}
+#endif // FEATURE_INCLUDE_ALL_INTERFACES
+
+//*****************************************************************************
+// mscoree typelib definition
+//*****************************************************************************
+
+[
+ uuid(5477469e-83b1-11d2-8b49-00a0c9b7c9c4),
+ version(2.4),
+ helpstring("Common Language Runtime Execution Engine 2.4 Library")
+]
+library mscoree
+{
+ importlib("stdole32.tlb");
+
+#ifdef INCLUDE_SVC_IDL
+#define IN_MSCOREE
+#include "mscorsvc.idl"
+#endif
+
+ //*****************************************************************************
+ //
+ //*****************************************************************************
+ [
+ object,
+ oleautomation,
+ uuid(B81FF171-20F3-11d2-8DCC-00A0C9B00522),
+ helpstring("Type name parser"),
+ pointer_default(unique)
+ ]
+ interface ITypeName : IUnknown
+ {
+ HRESULT GetNameCount([out, retval] DWORD* pCount);
+ HRESULT GetNames([in] DWORD count, [out] BSTR* rgbszNames, [out, retval] DWORD* pCount);
+ HRESULT GetTypeArgumentCount([out, retval] DWORD* pCount);
+ HRESULT GetTypeArguments([in] DWORD count, [out] ITypeName** rgpArguments, [out, retval] DWORD* pCount);
+ HRESULT GetModifierLength([out, retval] DWORD* pCount);
+ HRESULT GetModifiers([in] DWORD count, [out] DWORD* rgModifiers, [out, retval] DWORD* pCount);
+ HRESULT GetAssemblyName([out, retval] BSTR* rgbszAssemblyNames);
+ };
+
+ //*****************************************************************************
+ //
+ //*****************************************************************************
+ [
+ object,
+ oleautomation,
+ uuid(B81FF171-20F3-11d2-8DCC-00A0C9B00523),
+ helpstring("Type name builder"),
+ pointer_default(unique)
+ ]
+ interface ITypeNameBuilder : IUnknown
+ {
+ HRESULT OpenGenericArguments();
+ HRESULT CloseGenericArguments();
+ HRESULT OpenGenericArgument();
+ HRESULT CloseGenericArgument();
+ HRESULT AddName([in] LPCWSTR szName);
+ HRESULT AddPointer();
+ HRESULT AddByRef();
+ HRESULT AddSzArray();
+ HRESULT AddArray([in] DWORD rank);
+ HRESULT AddAssemblySpec([in] LPCWSTR szAssemblySpec);
+ HRESULT ToString([out, retval] BSTR* pszStringRepresentation);
+ HRESULT Clear();
+ };
+
+ //*****************************************************************************
+ //
+ //*****************************************************************************
+ [
+ object,
+ oleautomation,
+ uuid(B81FF171-20F3-11d2-8DCC-00A0C9B00521),
+ helpstring("Type name builder and parser factory"),
+ pointer_default(unique)
+ ]
+ interface ITypeNameFactory : IUnknown
+ {
+ HRESULT ParseTypeName([in] LPCWSTR szName, [out] DWORD* pError, [out, retval] ITypeName** ppTypeName);
+ HRESULT GetTypeNameBuilder([out, retval] ITypeNameBuilder** ppTypeBuilder);
+ };
+
+#ifdef FEATURE_INCLUDE_ALL_INTERFACES
+ //*****************************************************************************
+ // Interface for apartment callbacks.
+ //*****************************************************************************
+ [
+ object,
+ oleautomation,
+ uuid(178E5337-1528-4591-B1C9-1C6E484686D8),
+ helpstring("Apartment callback interface"),
+ pointer_default(unique)
+ ]
+ interface IApartmentCallback : IUnknown
+ {
+ HRESULT _stdcall DoCallback(
+ [in] SIZE_T pFunc,
+ [in] SIZE_T pData);
+ };
+#endif // FEATURE_INCLUDE_ALL_INTERFACES
+
+#ifdef _WIN64
+ #define CCW_PTR __int64 *
+ cpp_quote("#define CCW_PTR __int64 *")
+#else // WIN64
+ #define CCW_PTR int *
+ cpp_quote("#define CCW_PTR int *")
+#endif // WIN64
+
+#ifdef FEATURE_COMINTEROP
+ //*****************************************************************************
+ // Interface for controlling a managed object
+ //*****************************************************************************
+ [
+ object,
+ oleautomation,
+ uuid(C3FCC19E-A970-11d2-8B5A-00A0C9B7C9C4),
+ helpstring("Managed Object Interface"),
+ pointer_default(unique),
+ proxy
+ ]
+ interface IManagedObject : IUnknown
+ {
+ // helper to serialize the object and marshal it to the client
+ HRESULT GetSerializedBuffer( [out] BSTR *pBSTR);
+
+ // Object identity includes, process guid, appdomain id, ccw
+ HRESULT GetObjectIdentity([out] BSTR* pBSTRGUID, [out] int* AppDomainID, [out] CCW_PTR pCCW);
+ };
+#endif // FEATURE_COMINTEROP
+
+#ifdef FEATURE_INCLUDE_ALL_INTERFACES
+ //*****************************************************************************
+ // Interface for controlling a managed object
+ //*****************************************************************************
+ [
+ object,
+ oleautomation,
+ uuid(04C6BE1E-1DB1-4058-AB7A-700CCCFBF254),
+ helpstring("ICatalogServices Interface"),
+ pointer_default(unique)
+ ]
+ interface ICatalogServices : IUnknown
+ {
+ HRESULT Autodone();
+
+ HRESULT NotAutodone();
+ };
+#endif // FEATURE_INCLUDE_ALL_INTERFACES
+
+#ifdef FEATURE_COMINTEROP
+ //*****************************************************************************
+ // IMarshal implementation for 1.0, 1.1, and 2.0 COM callable wrappers
+ //*****************************************************************************
+ [
+ uuid(3F281000-E95A-11d2-886B-00C04F869F04),
+ helpstring("Com Call Wrapper Unmarshalling Class")
+ ]
+ coclass ComCallUnmarshal
+ {
+ [default] interface IMarshal;
+ };
+
+ //*****************************************************************************
+ // IMarshal implementation for 4.0 COM callable wrappers
+ //*****************************************************************************
+ [
+ uuid(45FB4600-E6E8-4928-B25E-50476FF79425),
+ helpstring("Com Call Wrapper Unmarshalling Class 4.0")
+ ]
+ coclass ComCallUnmarshalV4
+ {
+ [default] interface IMarshal;
+ };
+#endif // FEATURE_COMINTEROP
+
+#ifdef FEATURE_INCLUDE_ALL_INTERFACES
+ [
+ uuid(CB2F6723-AB3A-11d2-9C40-00C04FA30A3E),
+ helpstring("Cor Runtime Hosting Class")
+ ]
+ coclass CorRuntimeHost
+ {
+ [default] interface ICorRuntimeHost;
+ interface IGCHost;
+ interface ICorConfiguration;
+ interface IValidator;
+ interface IDebuggerInfo;
+ };
+#endif // FEATURE_INCLUDE_ALL_INTERFACES
+
+ [
+ uuid(90F1A06E-7712-4762-86B5-7A5EBA6BDB02),
+ helpstring("CLR Runtime Hosting Class V2")
+ ]
+ coclass CLRRuntimeHost
+ {
+ [default] interface ICLRRuntimeHost;
+ interface ICLRValidator;
+ };
+
+ [
+ uuid(B81FF171-20F3-11d2-8DCC-00A0C9B00525),
+ helpstring("TypeName parser and builder")
+ ]
+ coclass TypeNameFactory
+ {
+ [default] interface ITypeNameFactory;
+ };
+};
+
+typedef enum
+{
+ eCurrentContext=0x00,
+ eRestrictedContext=0x01
+} EContextType;
+
+#ifdef FEATURE_INCLUDE_ALL_INTERFACES
+///////////////////////////////////////////////////////////////////////////////
+//
+// IHostSecurityContext
+//
+///////////////////////////////////////////////////////////////////////////////
+[
+ object,
+ version(1.0),
+ uuid(7E573CE4-0343-4423-98D7-6318348A1D3C),
+ helpstring("Security Context provided by host"),
+ pointer_default(unique),
+ local
+]
+
+interface IHostSecurityContext : IUnknown
+{
+ HRESULT Capture([out] IHostSecurityContext** ppClonedContext);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// IHostSecurityManager
+//
+///////////////////////////////////////////////////////////////////////////////
+[
+ object,
+ version(1.0),
+ uuid(75ad2468-a349-4d02-a764-76a68aee0c4f),
+ helpstring("Security Manager provided by host"),
+ pointer_default(unique),
+ local
+]
+interface IHostSecurityManager: IUnknown
+{
+ // Impersonation APIs.
+ HRESULT ImpersonateLoggedOnUser(
+ [in] HANDLE hToken);
+
+ HRESULT RevertToSelf();
+
+ HRESULT OpenThreadToken(
+ [in] DWORD dwDesiredAccess,
+ [in] BOOL bOpenAsSelf,
+ [out] HANDLE *phThreadToken
+ );
+
+ HRESULT SetThreadToken(
+ [in] HANDLE hToken);
+
+ HRESULT GetSecurityContext([in] EContextType eContextType,
+ [out] IHostSecurityContext** ppSecurityContext);
+ // May return S_OK, E_FAIL (in what circumstances?)
+ HRESULT SetSecurityContext([in] EContextType eContextType,
+ [in] IHostSecurityContext* pSecurityContext);
+
+};
+#endif // FEATURE_INCLUDE_ALL_INTERFACES
+
+#ifdef FEATURE_APPDOMAIN_RESOURCE_MONITORING
+///////////////////////////////////////////////////////////////////////////////
+//
+// ICLRAppDomainResourceMonitor
+//
+///////////////////////////////////////////////////////////////////////////////
+[
+ version(1.0),
+ uuid(c62de18c-2e23-4aea-8423-b40c1fc59eae),
+ helpstring("ARM interface"),
+ pointer_default(unique),
+ local
+]
+interface ICLRAppDomainResourceMonitor: IUnknown
+{
+ HRESULT GetCurrentAllocated([in] DWORD dwAppDomainId,
+ [out] ULONGLONG* pBytesAllocated);
+
+ HRESULT GetCurrentSurvived([in] DWORD dwAppDomainId,
+ [out] ULONGLONG* pAppDomainBytesSurvived,
+ [out] ULONGLONG* pTotalBytesSurvived);
+
+ HRESULT GetCurrentCpuTime([in] DWORD dwAppDomainId,
+ [out] ULONGLONG* pMilliseconds);
+
+
+};
+#endif //FEATURE_APPDOMAIN_RESOURCE_MONITORING
+
+cpp_quote("#undef DEPRECATED_CLR_STDAPI")
+cpp_quote("#undef DECLARE_DEPRECATED")
+cpp_quote("#undef DEPRECATED_CLR_API_MESG")
diff --git a/src/inc/OpCodeGen.pl b/src/inc/OpCodeGen.pl
new file mode 100644
index 0000000000..d9294519b0
--- /dev/null
+++ b/src/inc/OpCodeGen.pl
@@ -0,0 +1,501 @@
+# 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.
+#
+# GENREFOPS.PL
+#
+# PERL script used to generate the numbering of the reference opcodes
+#
+#use strict 'vars';
+#use strict 'subs';
+#use strict 'refs';
+
+
+my $ret = 0;
+my %oneByte;
+my %twoByte;
+my %controlFlow;
+my @singleByteArg;
+my %stackbehav;
+my %opcodetype;
+my %operandtype;
+my %opcodes;
+my $popstate;
+my $pushstate;
+
+$ctrlflowcount = 0;
+
+$count = 0;
+
+my @lowercaseAlphabet = ('a'..'z','0'..'9');
+my %upcaseAlphabet = ();
+
+foreach $letter (@lowercaseAlphabet) {
+ $j = $letter;
+ $j=~tr/a-z/A-Z/;
+ $upcaseAlphabet{$letter}=$j;
+}
+
+open (OPCODE, "opcode.def") or die "Couldn't open opcode.def: $!\n";
+open (OUTPUT, ">OpCodes.cs") or die "Couldn't open OpCodes.cs: $!\n";
+open (FCOUTPUT, ">FlowControl.cs") or die "Couldn't open FlowControl.cs: $!\n";
+open (SOUTPUT, ">StackBehaviour.cs") or die "Couldn't open StackBehaviour.cs: $!\n";
+open (OCOUTPUT, ">OpCodeType.cs") or die "Couldn't open OpCodeType.cs: $!\n";
+open (OPOUTPUT, ">OperandType.cs") or die "Couldn't open OprandType.cs: $!\n";
+
+
+print OUTPUT "/*============================================================\n";
+print OUTPUT "**\n";
+print OUTPUT "**Class: OpCodes\n";
+print OUTPUT "**\n";
+print OUTPUT "**Purpose: Exposes all of the il instructions supported by the runtime.\n";
+print OUTPUT "**\n";
+print OUTPUT "**Licensed to the .NET Foundation under one or more agreements.\n";
+print OUTPUT "**The .NET Foundation licenses this file to you under the MIT license.\n";
+print OUTPUT "**See the LICENSE file in the project root for more information.\n";
+print OUTPUT "**\n";
+print OUTPUT "** THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT BY HAND!\n";
+print OUTPUT "** See clr\src\inc\opcodegen.pl for more information.**\n";
+print OUTPUT "============================================================*/\n";
+
+print OUTPUT "namespace System.Reflection.Emit {\n\n";
+print OUTPUT "using System;\n\n";;
+print OUTPUT "public class OpCodes {\n\n";;
+print OUTPUT "/// <summary>\n";
+print OUTPUT "/// <para>\n";
+print OUTPUT "/// The IL instruction opcodes supported by the\n";
+print OUTPUT "/// runtime. The IL Instruction Specification describes each\n";
+print OUTPUT "/// Opcode.\n";
+print OUTPUT "/// </para>\n";
+print OUTPUT "/// </summary>\n";
+print OUTPUT "/// <seealso topic='IL Instruction Set Specification'/>\n";
+print OUTPUT "\n";
+print OUTPUT "\tprivate OpCodes() { \n\t}\n\n";
+
+
+print FCOUTPUT "/*============================================================\n";
+print FCOUTPUT "**\n";
+print FCOUTPUT "**Class: FlowControl\n";
+print FCOUTPUT "**\n";
+print FCOUTPUT "**Purpose: Exposes FlowControl Attribute of IL .\n";
+print FCOUTPUT "**\n";
+print FCOUTPUT "**Licensed to the .NET Foundation under one or more agreements.\n";
+print FCOUTPUT "**The .NET Foundation licenses this file to you under the MIT license.\n";
+print FCOUTPUT "**See the LICENSE file in the project root for more information.\n";
+print FCOUTPUT "**\n";
+print FCOUTPUT "** THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT BY HAND!\n";
+print FCOUTPUT "** See clr\src\inc\opcodegen.pl for more information.**\n";
+print FCOUTPUT "============================================================*/\n";
+
+print FCOUTPUT "namespace System.Reflection.Emit {\n\n";
+print FCOUTPUT "using System;\n\n";
+print FCOUTPUT "public enum FlowControl\n{\n\n";
+
+print SOUTPUT "/*============================================================\n";
+print SOUTPUT "**\n";
+print SOUTPUT "**Class: StackBehaviour\n";
+print SOUTPUT "**\n";
+print SOUTPUT "**Purpose: Exposes StackBehaviour Attribute of IL .\n";
+print SOUTPUT "**\n";
+print SOUTPUT "**Licensed to the .NET Foundation under one or more agreements.\n";
+print SOUTPUT "**The .NET Foundation licenses this file to you under the MIT license.\n";
+print SOUTPUT "**See the LICENSE file in the project root for more information.\n";
+print SOUTPUT "**\n";
+print SOUTPUT "** THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT BY HAND!\n";
+print SOUTPUT "** See clr\src\inc\opcodegen.pl for more information.**\n";
+print SOUTPUT "============================================================*/\n";
+
+print SOUTPUT "namespace System.Reflection.Emit {\n\n";
+print SOUTPUT "using System;\n\n";
+print SOUTPUT "public enum StackBehaviour\n{\n\n";
+
+print OCOUTPUT "/*============================================================\n";
+print OCOUTPUT "**\n";
+print OCOUTPUT "**Class: OpCodeType\n";
+print OCOUTPUT "**\n";
+print OCOUTPUT "**Purpose: Exposes OpCodeType Attribute of IL .\n";
+print OCOUTPUT "**\n";
+print OCOUTPUT "**Licensed to the .NET Foundation under one or more agreements.\n";
+print OCOUTPUT "**The .NET Foundation licenses this file to you under the MIT license.\n";
+print OCOUTPUT "**See the LICENSE file in the project root for more information.\n";
+print OCOUTPUT "**\n";
+print OCOUTPUT "** THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT BY HAND!\n";
+print OCOUTPUT "** See clr\src\inc\opcodegen.pl for more information.**\n";
+print OCOUTPUT "============================================================*/\n";
+
+print OCOUTPUT "namespace System.Reflection.Emit {\n\n";
+print OCOUTPUT "using System;\n\n";
+print OCOUTPUT "public enum OpCodeType\n{\n\n";
+
+print OPOUTPUT "/*============================================================\n";
+print OPOUTPUT "**\n";
+print OPOUTPUT "**Class: OperandType\n";
+print OPOUTPUT "**\n";
+print OPOUTPUT "**Purpose: Exposes OperandType Attribute of IL .\n";
+print OPOUTPUT "**\n";
+print OPOUTPUT "**Licensed to the .NET Foundation under one or more agreements.\n";
+print OPOUTPUT "**The .NET Foundation licenses this file to you under the MIT license.\n";
+print OPOUTPUT "**See the LICENSE file in the project root for more information.\n";
+print OPOUTPUT "**\n";
+print OPOUTPUT "** THIS FILE IS AUTOMATICALLY GENERATED. DO NOT EDIT BY HAND!\n";
+print OPOUTPUT "** See clr\src\inc\opcodegen.pl for more information.**\n";
+print OPOUTPUT "============================================================*/\n";
+
+print OPOUTPUT "namespace System.Reflection.Emit {\n\n";
+print OPOUTPUT "using System;\n\n";
+print OPOUTPUT "public enum OperandType\n{\n\n";
+
+while (<OPCODE>)
+{
+ # Process only OPDEF(....) lines
+ if (/OPDEF\(\s*/)
+ {
+ chop; # Strip off trailing CR
+ s/^OPDEF\(\s*//; # Strip off "OP("
+ s/\)$//; # Strip off ")" at end
+ s/,\s*/,/g; # Remove whitespace
+
+ # Split the line up into its basic parts
+ ($enumname, $stringname, $pop, $push, $operand, $type, $size, $s1, $s2, $ctrl) = split(/,/);
+ $s1 =~ s/0x//;
+ $s1 = hex($s1);
+ $s2 =~ s/0x//;
+ $s2 = hex($s2);
+
+ if ($size == 0)
+ {
+ next;
+ }
+
+ next if ($enumname =~ /UNUSED/);
+
+ #Remove the prefix
+ $enumname=~s/CEE_//g;
+
+ #Convert name to our casing convention
+ $enumname=~tr/A-Z/a-z/;
+ $enumname=~s/^(.)/\u$1/g;
+ $enumname=~s/_(.)/_\u$1/g;
+
+
+ #Convert pop to our casing convention
+ $pop=~tr/A-Z/a-z/;
+ $pop=~s/^(.)/\u$1/g;
+ $pop=~s/_(.)/_\u$1/g;
+
+
+ #Convert push to our casing convention
+ $push=~tr/A-Z/a-z/;
+ $push=~s/^(.)/\u$1/g;
+ $push=~s/_(.)/_\u$1/g;
+
+
+ #Convert operand to our casing convention
+ #$operand=~tr/A-Z/a-z/;
+ #$operand=~s/^(.)/\u$1/g;
+ #$operand=~s/_(.)/_\u$1/g;
+
+ #Remove the I prefix on type
+ $type=~s/I//g;
+
+ #Convert Type to our casing convention
+ $type=~tr/A-Z/a-z/;
+ $type=~s/^(.)/\u$1/g;
+ $type=~s/_(.)/_\u$1/g;
+
+
+ #Convert ctrl to our casing convention
+ $ctrl=~tr/A-Z/a-z/;
+ $ctrl=~s/^(.)/\u$1/g;
+ $ctrl=~s/_(.)/_\u$1/g;
+
+
+
+
+ # Make a list of the flow Control type
+
+ # Make a list of the opcodes and there values
+ if ($opcodes{$enumname})
+ {
+
+ }
+ else
+ {
+ if ($size == 1)
+ {
+ $opcodes{$enumname} = $s2;
+ }
+ else
+ {
+ $opcodes{$enumname} = ($s2 + 256 * $s1);
+ }
+ }
+
+ #Make a list of the instructions which only take one-byte arguments
+ if ($enumname =~ /^.*_S$/) {
+ #but exclude the deprecated expressions (sometimes spelled "depricated")
+ if (!($enumname=~/^Depr.cated.*/)) {
+ my $caseStatement = sprintf("\t\tcase %-20s: \n", $enumname);
+ push(@singleByteArg, $caseStatement);
+ }
+ }
+
+ #make a list of the control Flow Types
+ if ($controlFlow{$ctrl})
+ {
+ #printf("DUPE Control Flow\n");
+ }
+ else
+ {
+ $controlFlow{$ctrl} = $ctrlflowcount;
+ $ctrlflowcount++;
+ }
+
+ $ctrlflowcount = 0;
+ #make a list of the control Flow Types
+ $pop=~s/\+/_/g;
+ if ($stackbehav{$pop})
+ {
+ #printf("DUPE Control Flow\n");
+ }
+ else
+ {
+ $stackbehav{$pop} = $ctrlflowcount;
+ $ctrlflowcount++;
+ }
+
+ #make a list of the control Flow Types
+ $push=~s/\+/_/g;
+ if ($stackbehav{$push})
+ {
+ #printf("DUPE Control Flow\n");
+ }
+ else
+ {
+ $stackbehav{$push} = $ctrlflowcount;
+ $ctrlflowcount++;
+ }
+ #make a list of operand types
+ if ($operandtype{$operand})
+ {
+ #printf("DUPE Control Flow\n");
+ }
+ else
+ {
+ $operandtype{$operand} = $ctrlflowcount;
+ $ctrlflowcount++;
+ }
+
+
+ #make a list of opcode types
+ if ($opcodetype{$type})
+ {
+ #printf("DUPE Control Flow\n");
+ }
+ else
+ {
+ $opcodetype{$type} = $ctrlflowcount;
+ $ctrlflowcount++;
+ }
+
+ print "$enumname\n";
+ print "$stringname\n";
+ if ($stringname eq "arglist")
+ {
+ print "This is arglist----------\n";
+ }
+ my $line = sprintf("\tpublic static readonly OpCode %-20s = ", $enumname);
+ if ($size == 1)
+ {
+ $line .= sprintf("new OpCode(%s, StackBehaviour.%s, StackBehaviour.%s, OperandType.%s, OpCodeType.%s, %u, (byte)0x%x, (byte)0x%x, FlowControl.%s, " , $stringname, $pop, $push, $operand, $type, $size, $s1, $s2, $ctrl);
+
+
+ if ($ctrl eq "Return" || $ctrl eq "Branch" || $ctrl eq "Throw" || $stringname eq "\"jmp\"" || $stringname eq "\"jmpi\"")
+ {
+ $line .= sprintf("true, ");
+
+ }
+ else
+ {
+ $line .= sprintf("false, ");
+ }
+
+ $popstate = 0;
+ if($pop eq "Pop0" || $pop eq "Varpop")
+ {
+ $popstate = 0;
+ }
+ elsif ($pop eq "Pop1" || $pop eq "Popi" || $pop eq "Popref")
+ {
+ $popstate = $popstate -1;
+ }
+ elsif ($pop eq "Pop1_pop1" || $pop eq "Popi_pop1" || $pop eq "Popi_popi" || $pop eq "Popi_popi8" || $pop eq "Popi_popr4" || $pop eq "Popi_popr8" || $pop eq "Popref_pop1" || $pop eq "Popref_popi")
+ {
+ $popstate = $popstate -2;
+ }
+ elsif ($pop eq "Popi_popi_popi" || $pop eq "Popref_popi_popi" || $pop eq "Popref_popi_popi8" || $pop eq "Popref_popi_popr4" || $pop eq "Popref_popi_popr8" || $pop eq "Popref_popi_popref")
+ {
+ $popstate = $popstate -3;
+ }
+
+ if ($push eq "Push1" || $push eq "Pushi" ||$push eq "Pushi8" ||$push eq "Pushr4" ||$push eq "Pushr8" ||$push eq "Pushref")
+ {
+ $popstate = $popstate + 1;
+ }
+ elsif($push eq "Push1_push1")
+ {
+ $popstate = $popstate + 2;
+ }
+
+
+ $line .= sprintf(" $popstate");
+ $line .= sprintf(");\n\n");
+ if ($oneByte{$s2})
+ {
+ printf("Error opcode 0x%x already defined!\n", $s2);
+ print " Old = $oneByte{$s2}";
+ print " New = $line";
+ $ret = -1;
+ }
+ $oneByte{$s2} = $line;
+ }
+ elsif ($size == 2)
+ {
+ if ($twoByte{$s2})
+ {
+ printf("Error opcode 0x%x%x already defined!\n", $s1, $s2);
+ print " Old = $oneByte{$s2}";
+ print " New = $line";
+ $ret = -1;
+ }
+ $line .= sprintf("new OpCode(%s, StackBehaviour.%s, StackBehaviour.%s, OperandType.%s, OpCodeType.%s, %u, (byte)0x%x, (byte)0x%x, FlowControl.%s, " , $stringname, $pop, $push, $operand, $type, $size, $s1, $s2, $ctrl);
+
+ if ($ctrl eq "Return" || $ctrl eq "Branch" || $ctrl eq "Throw" || $stringname eq "\"jmp\"" || $stringname eq "\"jmpi\"")
+ {
+ $line .= sprintf("true, ");
+
+ }
+ else
+ {
+ $line .= sprintf("false, ");
+ }
+
+ $popstate = 0;
+ if($pop eq "Pop0" || $pop eq "Varpop")
+ {
+ $popstate = 0;
+ }
+ elsif($pop eq "Pop1" || $pop eq "Popi" || $pop eq "Popref")
+ {
+ $popstate = $popstate -1;
+ }
+ elsif ($pop eq "Pop1_pop1" || $pop eq "Popi_pop1" || $pop eq "Popi_popi" || $pop eq "Popi_popi8" || $pop eq "Popi_popr4" || $pop eq "Popi_popr8" || $pop eq "Popref_pop1" || $pop eq "Popref_popi")
+ {
+ $popstate = $popstate -2;
+ }
+ elsif ($pop eq "Popi_popi_popi" || $pop eq "Popref_popi_popi" || $pop eq "Popref_popi_popi8" || $pop eq "Popref_popi_popr4" || $pop eq "Popref_popi_popr8" || $pop eq "Popref_popi_popref")
+ {
+ $popstate = $popstate -3;
+ }
+
+ if ($push eq "Push1" || $push eq "Pushi" ||$push eq "Pushi8" ||$push eq "Pushr4" ||$push eq "Pushr8" ||$push eq "Pushref")
+ {
+ $popstate = $popstate + 1;
+ }
+ elsif($push eq "Push1_push1")
+ {
+ $popstate = $popstate + 2;
+ }
+
+ $line .= sprintf(" $popstate");
+ $line .= sprintf(");\n\n");
+
+ $twoByte{$s2 + 256 * $s1} = $line;
+
+ }
+ else
+ {
+ $line .= "\n";
+ push(@deprecated, $line);
+ }
+ $count++;
+ }
+}
+
+#Write out the Flow Control class
+$ctrlflowcount = 0;
+foreach $key (sort {$a cmp $b} keys (%controlFlow))
+{
+ print FCOUTPUT "\t$key";
+ print FCOUTPUT "\t= $ctrlflowcount,\n";
+ $ctrlflowcount++;
+}
+
+#end the flowcontrol class
+print FCOUTPUT "}\n}";
+
+#Write out the StackBehaviour class
+$ctrlflowcount = 0;
+foreach $key (sort {$a cmp $b} keys (%stackbehav))
+{
+ print SOUTPUT "\t$key";
+ print SOUTPUT "\t= $ctrlflowcount,\n";
+ $ctrlflowcount++;
+}
+#end the StackBehaviour class
+print SOUTPUT "}\n}";
+
+$ctrlflowcount = 0;
+foreach $key (sort {$a cmp $b} keys (%opcodetype))
+{
+ print OCOUTPUT "\t$key";
+ print OCOUTPUT "\t= $ctrlflowcount,\n";
+ $ctrlflowcount++;
+}
+#end the OpCodeTYpe class
+print OCOUTPUT "}\n}";
+
+$ctrlflowcount = 0;
+foreach $key (sort {$a cmp $b} keys (%operandtype))
+{
+ print OPOUTPUT "\t$key";
+ print OPOUTPUT "\t= $ctrlflowcount,\n";
+ $ctrlflowcount++;
+}
+#end the OperandType class
+print OPOUTPUT "}\n}";
+
+
+my $opcode;
+my $lastOp = -1;
+foreach $opcode (sort {$a <=> $b} keys(%oneByte)) {
+ printf("***** GAP %d instrs ****\n", $opcode - $lastOp) if ($lastOp + 1 != $opcode && $lastOp > 0);
+ print OUTPUT $oneByte{$opcode};
+ $lastOp = $opcode;
+}
+
+$lastOp = -1;
+foreach $opcode (sort {$a <=> $b} keys(%twoByte)) {
+ printf("***** GAP %d instrs ****\n", $opcode - $lastOp) if ($lastOp + 1 != $opcode && $lastOp > 0);
+ print OUTPUT $twoByte{$opcode};
+ $lastOp = $opcode;
+}
+
+
+
+
+
+print OUTPUT "\n\n\tpublic static bool TakesSingleByteArgument(OpCode inst)\n\t{\n";
+print OUTPUT"\t\tswitch(inst.m_operand)\n\t\t{\n";
+print OUTPUT "\t\t\tcase OperandType.ShortInlineBrTarget :\n";
+print OUTPUT "\t\t\tcase OperandType.ShortInlineI :\n";
+print OUTPUT "\t\t\tcase OperandType.ShortInlineVar :\n";
+print OUTPUT "\t\t\treturn true;\n";
+print OUTPUT "\t\t};\n";
+print OUTPUT "\t\treturn false;\n";
+print OUTPUT "\t}\n";
+print OUTPUT "}\n}";
+exit($ret);
+
+
+
diff --git a/src/inc/UacAsInvoker.manifest b/src/inc/UacAsInvoker.manifest
new file mode 100644
index 0000000000..80a5e05e20
--- /dev/null
+++ b/src/inc/UacAsInvoker.manifest
@@ -0,0 +1,11 @@
+<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
+ <ms_asmv3:trustInfo xmlns:ms_asmv3="urn:schemas-microsoft-com:asm.v3">
+ <ms_asmv3:security>
+ <ms_asmv3:requestedPrivileges>
+ <ms_asmv3:requestedExecutionLevel
+ level="asInvoker"
+ uiAccess="false"/>
+ </ms_asmv3:requestedPrivileges>
+ </ms_asmv3:security>
+ </ms_asmv3:trustInfo>
+</assembly>
diff --git a/src/inc/allocacheck.h b/src/inc/allocacheck.h
new file mode 100644
index 0000000000..3ba2e4da43
--- /dev/null
+++ b/src/inc/allocacheck.h
@@ -0,0 +1,84 @@
+// 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.
+/*********************************************************************/
+/* AllocaCheck */
+/*********************************************************************/
+
+/* check for alloca overruns (which otherwise are hard to track down
+ and often only repro on optimized builds).
+
+ USAGE:
+
+ void foo() {
+ ALLOCA_CHECK(); // Declare at function level scope
+
+ ....
+ void* mem = ALLOCA(size); // does an alloca,
+
+ } // destructor of ALLOCA_CHECK for buffer overruns.
+*/
+
+/* */
+/*********************************************************************/
+
+#ifndef AllocaCheck_h
+#define AllocaCheck_h
+#include <malloc.h> // for alloca itself
+
+#if defined(assert) && !defined(_ASSERTE)
+#define _ASSERTE assert
+#endif
+
+#if defined(_DEBUG) || defined(DEBUG)
+
+/*********************************************************************/
+class AllocaCheck {
+public:
+ enum { CheckBytes = 0xCCCDCECF,
+ };
+
+ struct AllocaSentinal {
+ int check;
+ AllocaSentinal* next;
+ };
+
+public:
+ /***************************************************/
+ AllocaCheck() {
+ sentinals = 0;
+ }
+
+ ~AllocaCheck() {
+ AllocaSentinal* ptr = sentinals;
+ while (ptr != 0) {
+ if (ptr->check != (int)CheckBytes)
+ _ASSERTE(!"alloca buffer overrun");
+ ptr = ptr->next;
+ }
+ }
+
+ void* add(void* allocaBuff, unsigned size) {
+ AllocaSentinal* newSentinal = (AllocaSentinal*) ((char*) allocaBuff + size);
+ newSentinal->check = CheckBytes;
+ newSentinal->next = sentinals;
+ sentinals = newSentinal;
+ memset(allocaBuff, 0xDD, size);
+ return allocaBuff;
+ }
+
+private:
+ AllocaSentinal* sentinals;
+};
+
+#define ALLOCA_CHECK() AllocaCheck __allocaChecker
+#define ALLOCA(size) __allocaChecker.add(_alloca(size+sizeof(AllocaCheck::AllocaSentinal)), size);
+
+#else
+
+#define ALLOCA_CHECK()
+#define ALLOCA(size) _alloca(size)
+
+#endif
+
+#endif
diff --git a/src/inc/apithreadstress.cpp b/src/inc/apithreadstress.cpp
new file mode 100644
index 0000000000..0a802a2f11
--- /dev/null
+++ b/src/inc/apithreadstress.cpp
@@ -0,0 +1,171 @@
+// 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.
+
+// ---------------------------------------------------------------------------
+// APIThreadStress.cpp (API thread stresser)
+// ---------------------------------------------------------------------------
+
+#include "stdafx.h"
+
+#ifdef _DEBUG
+#define LOGGING 1
+#endif
+
+#include "apithreadstress.h"
+#include "clrhost.h"
+#include "ex.h"
+#include "log.h"
+
+
+
+// For now, thread stress is incompatible with hosting. We need a host CreateThread
+// to fix this.
+#undef SetEvent
+#undef ResetEvent
+
+int APIThreadStress::s_threadStressCount = 0;
+
+APIThreadStress::APIThreadStress()
+{
+ m_threadCount = 0;
+
+ // Don't "fork" stress threads
+ if (ClrFlsGetValue(TlsIdx_StressThread) == NULL)
+ m_threadCount = s_threadStressCount;
+
+ if (m_threadCount != 0)
+ {
+ m_setupOK = TRUE;
+
+ m_hThreadArray = new (nothrow) HANDLE [ m_threadCount ];
+ if (m_hThreadArray == NULL)
+ m_setupOK = FALSE;
+ else
+ {
+ HANDLE *p = m_hThreadArray;
+ HANDLE *pEnd = p + m_threadCount;
+
+ while (p < pEnd)
+ {
+ DWORD id;
+ *p = ::CreateThread(NULL, 0, StartThread, this, 0, &id);
+ if (*p == NULL)
+ m_setupOK = FALSE;
+ p++;
+ }
+ }
+
+ m_syncEvent = ClrCreateManualEvent(FALSE);
+ if (m_syncEvent == INVALID_HANDLE_VALUE)
+ m_setupOK = FALSE;
+ }
+}
+
+APIThreadStress::~APIThreadStress()
+{
+ if (m_threadCount > 0)
+ {
+ HANDLE *p = m_hThreadArray;
+ HANDLE *pEnd = p + m_threadCount;
+
+ if (p != NULL)
+ {
+ while (p < pEnd)
+ {
+ if (*p != NULL)
+ {
+ if (m_threadCount > 0 && m_setupOK)
+ WaitForSingleObjectEx(*p, INFINITE, FALSE);
+
+ ::CloseHandle(*p);
+ }
+ p++;
+ }
+ delete [] m_hThreadArray;
+ }
+
+ if (m_syncEvent != INVALID_HANDLE_VALUE)
+ CloseHandle(m_syncEvent);
+ }
+}
+
+void APIThreadStress::SetThreadStressCount(int threadCount)
+{
+ s_threadStressCount = threadCount;
+}
+
+
+DWORD WINAPI APIThreadStress::StartThread(void *arg)
+{
+ APIThreadStress *pThis = (APIThreadStress *) arg;
+
+ ClrFlsSetValue(TlsIdx_StressThread, pThis);
+
+ EX_TRY
+ {
+ // Perform initial synchronization
+ WaitForSingleObjectEx(pThis->m_syncEvent, INFINITE, FALSE);
+ InterlockedIncrement(&pThis->m_runCount);
+
+ LOG((LF_SYNC, LL_INFO100, "Stressing operation on thread %d\n", GetCurrentThreadId()));
+ ((APIThreadStress *)arg)->Invoke();
+ LOG((LF_SYNC, LL_INFO100, "End stress operation on thread %d\n", GetCurrentThreadId()));
+
+ if (InterlockedDecrement(&pThis->m_runCount) == 0)
+ ::SetEvent(pThis->m_syncEvent);
+ }
+ EX_CATCH
+ {
+ LOG((LF_SYNC, LL_ERROR, "Exception during stress operation on thread %d\n", GetCurrentThreadId()));
+ }
+ EX_END_CATCH(SwallowAllExceptions);
+
+ return 0;
+}
+
+BOOL APIThreadStress::DoThreadStress()
+{
+ if (m_threadCount > 0 && m_setupOK)
+ {
+ HANDLE *p = m_hThreadArray;
+ HANDLE *pEnd = p + m_threadCount;
+
+ while (p < pEnd)
+ {
+ ::ResumeThread(*p);
+ p++;
+ }
+
+ // Start the threads at the same time
+ ::SetEvent(m_syncEvent);
+
+ return TRUE;
+ }
+ else
+ {
+ SyncThreadStress();
+ return FALSE;
+ }
+}
+
+void APIThreadStress::SyncThreadStress()
+{
+ APIThreadStress *pThis = (APIThreadStress *) ClrFlsGetValue(TlsIdx_StressThread);
+
+ if (pThis != NULL)
+ {
+ LOG((LF_SYNC, LL_INFO1000, "Syncing stress operation on thread %d\n", GetCurrentThreadId()));
+
+ ::ResetEvent(pThis->m_syncEvent);
+
+ if (InterlockedDecrement(&pThis->m_runCount) == 0)
+ ::SetEvent(pThis->m_syncEvent);
+ else
+ WaitForSingleObjectEx(pThis->m_syncEvent, INFINITE, FALSE);
+ InterlockedIncrement(&pThis->m_runCount);
+
+ LOG((LF_SYNC, LL_INFO1000, "Resuming stress operation on thread %d\n", GetCurrentThreadId()));
+ }
+}
+
diff --git a/src/inc/apithreadstress.h b/src/inc/apithreadstress.h
new file mode 100644
index 0000000000..fc18dcc6e1
--- /dev/null
+++ b/src/inc/apithreadstress.h
@@ -0,0 +1,90 @@
+// 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.
+// ---------------------------------------------------------------------------
+// APIThreadStress.h (API thread stresser)
+// ---------------------------------------------------------------------------
+
+// ---------------------------------------------------------------------------
+// This class provides a simple base to wrap "thread stress" logic around an API,
+// which will (in thread stress mode) cause an API to "fork" onto many threads
+// executing the same operation simulatenously. This can help to expose race
+// conditions.
+//
+// Usage:
+//
+// First, subtype APIThreadStress and override Invoke to implement the operation.
+// You will likely need to add data members for the arguments.
+//
+// Next, inside the API, write code like this:
+//
+// void MyRoutine(int a1, void *a2)
+// {
+// class stress : APIThreadStress
+// {
+// int a1;
+// void *a2;
+// stress(int a1, void *a2) : a1(a1), a2(a2)
+// { DoThreadStress(); }
+// void Invoke() { MyRoutine(a1, a2); }
+// } ts (a1, a2);
+//
+// // implementation
+//
+// // perhaps we have a common sub-point in the routine where we want the threads to
+// // queue up and race again
+//
+// ts.SyncThreadStress();
+//
+// // more implementation
+// }
+// ---------------------------------------------------------------------------
+
+
+#ifndef _APITHREADSTRESS_H_
+#define _APITHREADSTRESS_H_
+
+#include "utilcode.h"
+
+#ifdef STRESS_THREAD
+
+class APIThreadStress
+{
+ public:
+ APIThreadStress();
+ ~APIThreadStress();
+
+ BOOL DoThreadStress();
+ static void SyncThreadStress();
+
+ static void SetThreadStressCount(int count);
+
+ protected:
+ virtual void Invoke() {LIMITED_METHOD_CONTRACT;};
+
+ private:
+ static DWORD WINAPI StartThread(void *arg);
+
+ static int s_threadStressCount;
+
+ int m_threadCount;
+ HANDLE *m_hThreadArray;
+ BOOL m_setupOK;
+ LONG m_runCount;
+ HANDLE m_syncEvent;
+
+};
+
+#else // STRESS_THREAD
+
+class APIThreadStress
+{
+ public:
+ BOOL DoThreadStress() { return FALSE; }
+ static void SyncThreadStress() { }
+ static void SetThreadStressCount(int count) { }
+};
+
+#endif // STRESS_THREAD
+
+#endif // _APITHREADSTRESS_H_
diff --git a/src/inc/appxutil.h b/src/inc/appxutil.h
new file mode 100644
index 0000000000..2892ab7dd8
--- /dev/null
+++ b/src/inc/appxutil.h
@@ -0,0 +1,145 @@
+// 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.
+//
+
+
+#pragma once
+
+#ifdef FEATURE_APPX
+
+#include "clrtypes.h"
+#include "appmodel.h"
+#include "fusionsetup.h"
+
+#define PACKAGE_FILTER_CLR_DEFAULT (PACKAGE_FILTER_HEAD|PACKAGE_FILTER_DIRECT)
+
+
+typedef PACKAGE_INFO * PPACKAGE_INFO;
+typedef PACKAGE_INFO const * PCPACKAGE_INFO;
+
+//---------------------------------------------------------------------------------------------
+// Forward declarations
+template <typename T>
+class NewArrayHolder;
+BOOL WinRTSupported();
+
+#ifdef FEATURE_CORECLR
+
+namespace AppX
+{
+ // Returns true if process is immersive (or if running in mockup environment).
+ bool IsAppXProcess();
+
+ // On CoreCLR, the host is in charge of determining whether the process is AppX or not.
+ void SetIsAppXProcess(bool);
+
+ inline bool IsAppXNGen()
+ {
+ WRAPPER_NO_CONTRACT;
+ return false;
+ }
+
+#ifdef DACCESS_COMPILE
+ bool DacIsAppXProcess();
+#endif // DACCESS_COMPILE
+};
+
+#else // FEATURE_CORECLR
+
+struct AppXRTInfo;
+typedef DPTR(AppXRTInfo) PTR_AppXRTInfo;
+
+//---------------------------------------------------------------------------------------------
+namespace AppX
+{
+ // cleans up resources allocated in InitAppXRT()
+ void ShutDown();
+
+ // Returns true if process is immersive (or if running in mockup environment).
+ // NOTE: a return value of true doesn't necessarily indicate that the process is a
+ // real Metro app, e.g. it could be an ngen process compiling an AppX assembly.
+ bool IsAppXProcess();
+
+#ifdef DACCESS_COMPILE
+ bool DacIsAppXProcess();
+#endif // DACCESS_COMPILE
+
+ // Returns true if process is immersive (or if running in mockup environment).
+ // Use only in NOFAULT regions when you are 100% sure that code:IsAppXProcess has been already called.
+ // This function does not initialize (no faults).
+ bool IsAppXProcess_Initialized_NoFault();
+
+ // Returns true if process is NGen worker compiling an AppX assembly.
+ bool IsAppXNGen();
+
+ // Returns true if the host OS supports immersive apps.
+ inline bool IsAppXSupported()
+ { return WinRTSupported() != FALSE; }
+
+ LPCWSTR GetHeadPackageMoniker();
+
+ HRESULT GetCurrentPackageId(
+ __inout PUINT32 pBufferLength,
+ __out PBYTE pBuffer);
+
+ HRESULT GetCurrentPackageInfo(
+ __in UINT32 dwFlags,
+ __inout PUINT32 pcbBuffer,
+ __out PBYTE pbBuffer,
+ __out PUINT32 nCount);
+
+ bool IsAdaptiveApp();
+ HRESULT GetCurrentPackageRoot(_Inout_ UINT32* length, _Out_opt_ PWSTR packageRoot);
+ HRESULT GetWinMetadataDirForAdaptiveApps(_Out_ LPWSTR* winMetadDataDir);
+#ifdef FEATURE_APPX_BINDER
+ enum FindFindInPackageFlags
+ {
+ FindFindInPackageFlags_None = 0,
+ FindFindInPackageFlags_AllowLongFormatPath = 1,
+ FindFindInPackageFlags_SkipCurrentPackageGraph = 2, // Only search in alt path
+ };
+
+ // If the function succeeds, pcchPathName is set to the length of the string that is copied to the buffer,
+ // in characters, including the terminating null character, and the function returns S_OK. If the buffer
+ // is too small, pcchPathName is set to the length of the buffer required (in characters),
+ // including the terminating null character, and the function returns ERROR_INSUFFICIENT_BUFFER.
+ HRESULT FindFileInCurrentPackage(
+ __in PCWSTR pszFileName,
+ __inout PUINT32 pcchPathName,
+ __out PWSTR pszPathName,
+ __in UINT32 uiFlags = PACKAGE_FILTER_CLR_DEFAULT,
+ __in PCWSTR *rgwzAltPaths = NULL,
+ __in UINT32 cAltPaths = 0,
+ FindFindInPackageFlags findInCurrentPackageFlags = FindFindInPackageFlags_None);
+#endif // FEATURE_APPX_BINDER
+
+ // Attempts to retrieve the AppContainer SID for the specified process.
+ // For non-AppContainer processes the function will return S_FALSE and pAppContainerTokenInfo will be NULL.
+ // For AppContainer processes the function will return S_OK and pAppContainerTokenInfo will contain data.
+ // Note that there might be legitimate cases where this function fails (caller doesn't have permissions to
+ // OpenProcess() for example) so any callers must account for such failures.
+ // Use of NewArrayHolder permits method to reuse info for current process (dwPid == self) or to allocate
+ // memory (dwPid != self). Cast the result to PTOKEN_APPCONTAINER_INFORMATION;
+ HRESULT GetAppContainerTokenInfoForProcess(
+ DWORD dwPid,
+ NewArrayHolder<BYTE>& pbAppContainerTokenInfo, // Cast to PTOKEN_APPCONTAINER_INFORMATION on return.
+ DWORD* pcbAppContainerTokenInfo = nullptr);
+
+ // Called during NGen to pretend that we are in a certain package.
+ HRESULT SetCurrentPackageForNGen(__in PCWSTR pszPackageFullName);
+}
+
+#endif // FEATURE_CORECLR
+
+#else // FEATURE_APPX
+
+namespace AppX
+{
+ inline bool IsAppXProcess()
+ {
+ return false;
+ }
+}
+
+#endif // FEATURE_APPX
diff --git a/src/inc/arraylist.h b/src/inc/arraylist.h
new file mode 100644
index 0000000000..f45085bf33
--- /dev/null
+++ b/src/inc/arraylist.h
@@ -0,0 +1,305 @@
+// 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.
+
+
+#ifndef ARRAYLIST_H_
+#define ARRAYLIST_H_
+
+#include <daccess.h>
+#include <contract.h>
+#include <stddef.h> // offsetof
+
+//
+// ArrayList is a simple class which is used to contain a growable
+// list of pointers, stored in chunks. Modification is by appending
+// only currently. Access is by index (efficient if the number of
+// elements stays small) and iteration (efficient in all cases).
+//
+// An important property of an ArrayList is that the list remains
+// coherent while it is being modified. This means that readers
+// never need to lock when accessing it.
+//
+
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable : 4200) // Disable zero-sized array warning
+#endif
+
+class ArrayListBase
+{
+ public:
+
+ enum
+ {
+ ARRAY_BLOCK_SIZE_START = 5,
+ };
+
+ private:
+
+ struct ArrayListBlock
+ {
+ SPTR(ArrayListBlock) m_next;
+ DWORD m_blockSize;
+#ifdef _WIN64
+ DWORD m_padding;
+#endif
+ PTR_VOID m_array[0];
+
+#ifdef DACCESS_COMPILE
+ static ULONG32 DacSize(TADDR addr)
+ {
+ LIMITED_METHOD_CONTRACT;
+ return offsetof(ArrayListBlock, m_array) +
+ (*PTR_DWORD(addr + offsetof(ArrayListBlock, m_blockSize)) * sizeof(void*));
+ }
+#endif
+ };
+ typedef SPTR(ArrayListBlock) PTR_ArrayListBlock;
+
+ struct FirstArrayListBlock
+ {
+ PTR_ArrayListBlock m_next;
+ DWORD m_blockSize;
+#ifdef _WIN64
+ DWORD m_padding;
+#endif
+ void * m_array[ARRAY_BLOCK_SIZE_START];
+ };
+
+ typedef DPTR(FirstArrayListBlock) PTR_FirstArrayListBlock;
+
+ DWORD m_count;
+ FirstArrayListBlock m_firstBlock;
+
+ public:
+
+ PTR_VOID *GetPtr(DWORD index) const;
+ PTR_VOID Get(DWORD index) const
+ {
+ WRAPPER_NO_CONTRACT;
+ SUPPORTS_DAC;
+
+ return *GetPtr(index);
+ }
+
+ void Set(DWORD index, PTR_VOID element)
+ {
+ WRAPPER_NO_CONTRACT;
+ STATIC_CONTRACT_SO_INTOLERANT;
+ *GetPtr(index) = element;
+ }
+
+ DWORD GetCount() const { LIMITED_METHOD_DAC_CONTRACT; return m_count; }
+
+ HRESULT Append(void *element);
+
+ enum { NOT_FOUND = -1 };
+ DWORD FindElement(DWORD start, PTR_VOID element) const;
+
+ void Clear();
+
+ void Init()
+ {
+ LIMITED_METHOD_CONTRACT;
+ STATIC_CONTRACT_SO_INTOLERANT;
+
+ m_count = 0;
+ m_firstBlock.m_next = NULL;
+ m_firstBlock.m_blockSize = ARRAY_BLOCK_SIZE_START;
+ }
+
+ void Destroy()
+ {
+ WRAPPER_NO_CONTRACT;
+ STATIC_CONTRACT_SO_INTOLERANT;
+ Clear();
+ }
+
+#ifdef DACCESS_COMPILE
+ void EnumMemoryRegions(CLRDataEnumMemoryFlags flags);
+#endif
+
+ class ConstIterator;
+
+ class Iterator
+ {
+ friend class ArrayListBase;
+ friend class ConstIterator;
+
+ public:
+ BOOL Next();
+
+ void SetEmpty()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_block = NULL;
+ m_index = (DWORD)-1;
+ m_remaining = 0;
+ m_total = 0;
+ }
+
+ PTR_VOID GetElement() {LIMITED_METHOD_DAC_CONTRACT; return m_block->m_array[m_index]; }
+ PTR_VOID * GetElementPtr() {LIMITED_METHOD_CONTRACT; return m_block->m_array + m_index; }
+ DWORD GetIndex() {LIMITED_METHOD_CONTRACT; return m_index + m_total; }
+ void *GetBlock() { return m_block; }
+
+ private:
+ ArrayListBlock* m_block;
+ DWORD m_index;
+ DWORD m_remaining;
+ DWORD m_total;
+ static Iterator Create(ArrayListBlock* block, DWORD remaining)
+ {
+ LIMITED_METHOD_DAC_CONTRACT;
+ STATIC_CONTRACT_SO_INTOLERANT;
+ Iterator i;
+ i.m_block = block;
+ i.m_index = (DWORD) -1;
+ i.m_remaining = remaining;
+ i.m_total = 0;
+ return i;
+ }
+ };
+
+ class ConstIterator
+ {
+ public:
+ ConstIterator(ArrayListBlock *pBlock, DWORD dwRemaining) : m_iterator(Iterator::Create(pBlock, dwRemaining))
+ {
+ }
+
+ BOOL Next()
+ {
+ WRAPPER_NO_CONTRACT;
+ return m_iterator.Next();
+ }
+
+ PTR_VOID GetElement()
+ {
+ WRAPPER_NO_CONTRACT;
+ return m_iterator.GetElement();
+ }
+
+ private:
+ Iterator m_iterator;
+ };
+
+ Iterator Iterate()
+ {
+ STATIC_CONTRACT_SO_INTOLERANT;
+ WRAPPER_NO_CONTRACT;
+ return Iterator::Create((ArrayListBlock*)&m_firstBlock, m_count);
+ }
+
+ ConstIterator Iterate() const
+ {
+ STATIC_CONTRACT_SO_INTOLERANT;
+
+ // Const cast is safe because ConstIterator does not expose any way to modify the block
+ ArrayListBlock *pFirstBlock = const_cast<ArrayListBlock *>(reinterpret_cast<const ArrayListBlock *>(&m_firstBlock));
+ return ConstIterator(pFirstBlock, m_count);
+ }
+
+ // BlockIterator is used for only memory walking, such as prejit save/fixup.
+ // It is not appropriate for other more typical ArrayList use.
+ class BlockIterator
+ {
+ private:
+
+ ArrayListBlock *m_block;
+ DWORD m_remaining;
+
+ friend class ArrayListBase;
+ BlockIterator(ArrayListBlock *block, DWORD remaining)
+ : m_block(block), m_remaining(remaining)
+ {
+ }
+
+ public:
+
+ BOOL Next()
+ {
+ if (m_block != NULL)
+ {
+ // Prevent m_remaining from underflowing - we can have completely empty block at the end.
+ if (m_remaining > m_block->m_blockSize)
+ m_remaining -= m_block->m_blockSize;
+ else
+ m_remaining = 0;
+
+ m_block = m_block->m_next;
+ }
+ return m_block != NULL;
+ }
+
+ void ClearUnusedMemory()
+ {
+ if (m_remaining < m_block->m_blockSize)
+ ZeroMemory(&(m_block->m_array[m_remaining]), (m_block->m_blockSize - m_remaining) * sizeof(void*));
+#ifdef _WIN64
+ m_block->m_padding = 0;
+#endif
+ }
+
+ void **GetNextPtr()
+ {
+ return (void **) &m_block->m_next;
+ }
+
+ void *GetBlock()
+ {
+ return m_block;
+ }
+
+ SIZE_T GetBlockSize()
+ {
+ return offsetof(ArrayListBlock, m_array) + (m_block->m_blockSize * sizeof(void*));
+ }
+ };
+
+ void **GetInitialNextPtr()
+ {
+ return (void **) &m_firstBlock.m_next;
+ }
+
+ BlockIterator IterateBlocks()
+ {
+ return BlockIterator((ArrayListBlock *) &m_firstBlock, m_count);
+ }
+
+};
+
+class ArrayList : public ArrayListBase
+{
+public:
+#ifndef DACCESS_COMPILE
+ ArrayList()
+ {
+ STATIC_CONTRACT_SO_INTOLERANT;
+ WRAPPER_NO_CONTRACT;
+ Init();
+ }
+
+ ~ArrayList()
+ {
+ STATIC_CONTRACT_SO_INTOLERANT;
+ WRAPPER_NO_CONTRACT;
+ Destroy();
+ }
+#endif
+};
+
+/* to be used as static variable - no constructor/destructor, assumes zero
+ initialized memory */
+class ArrayListStatic : public ArrayListBase
+{
+};
+
+typedef DPTR(ArrayListStatic) PTR_ArrayListStatic;
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+
+#endif
diff --git a/src/inc/assemblyfilehash.h b/src/inc/assemblyfilehash.h
new file mode 100644
index 0000000000..5f6fb23f68
--- /dev/null
+++ b/src/inc/assemblyfilehash.h
@@ -0,0 +1,92 @@
+// 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.
+
+
+
+#ifndef __ASSEMBLYHASH_H__
+#define __ASSEMBLYHASH_H__
+
+#include "wincrypt.h"
+#include "ex.h"
+
+
+
+class AssemblyFileHash
+{
+protected:
+ BOOL m_bDataOwner;
+ PBYTE m_pbData;
+ DWORD m_cbData;
+ PBYTE m_pbHash;
+ DWORD m_cbHash;
+ HRESULT HashData(HCRYPTHASH);
+ HANDLE m_hFile;
+ BOOL m_NeedToReadData;
+
+ HRESULT ReadData();
+public:
+
+ HRESULT SetFileName(LPCWSTR wszFileName);
+ HRESULT ReleaseFileHandle()
+ {
+ WRAPPER_NO_CONTRACT;
+ return SetFileHandle(INVALID_HANDLE_VALUE);
+ };
+ HRESULT SetFileHandle(HANDLE hFile)
+ {
+ LIMITED_METHOD_CONTRACT;
+ m_hFile=hFile;
+ return S_OK;
+ };
+
+ HRESULT SetData(PBYTE pbData, DWORD cbData) // Owned by owners context. Will not be deleted
+ {
+ CONTRACTL
+ {
+ NOTHROW;
+ GC_NOTRIGGER;
+ }
+ CONTRACTL_END;
+
+ m_pbData = pbData;
+ m_cbData = cbData;
+ m_bDataOwner = FALSE;
+ m_NeedToReadData=FALSE;
+ return S_OK;
+ }
+
+ PBYTE GetHash() { LIMITED_METHOD_CONTRACT; _ASSERTE(!m_NeedToReadData);return m_pbHash; }
+ DWORD GetHashSize() { LIMITED_METHOD_CONTRACT;_ASSERTE(!m_NeedToReadData); return m_cbHash; }
+
+ HRESULT CalculateHash(DWORD algid);
+
+ AssemblyFileHash()
+ : m_pbData( NULL ),
+ m_cbData( 0 ),
+ m_pbHash( NULL ),
+ m_cbHash( 0 ),
+ m_hFile(INVALID_HANDLE_VALUE),
+ m_NeedToReadData(TRUE)
+ {
+ CONTRACTL
+ {
+ CONSTRUCTOR_CHECK;
+ NOTHROW;
+ GC_NOTRIGGER;
+ }
+ CONTRACTL_END;
+ }
+
+ ~AssemblyFileHash()
+ {
+ delete [] m_pbHash;
+ if (m_bDataOwner)
+ delete [] m_pbData;
+ if (m_hFile!=INVALID_HANDLE_VALUE)
+ CloseHandle(m_hFile);
+ m_hFile=INVALID_HANDLE_VALUE;
+ }
+};
+
+#endif
diff --git a/src/inc/assemblyusagelog.idl b/src/inc/assemblyusagelog.idl
new file mode 100644
index 0000000000..b942d59148
--- /dev/null
+++ b/src/inc/assemblyusagelog.idl
@@ -0,0 +1,51 @@
+// 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.
+//+---------------------------------------------------------------------------
+//
+// File: assemblyusageloginterface.idl
+//
+// Contents: COM interface for assembly usage log.
+//
+// Classes:
+//
+// Functions:
+//
+//
+//----------------------------------------------------------------------------
+
+cpp_quote("")
+cpp_quote("#ifdef _MSC_VER")
+cpp_quote("#pragma comment(lib,\"uuid.lib\")")
+cpp_quote("#endif")
+cpp_quote("")
+cpp_quote("//---------------------------------------------------------------------------=")
+cpp_quote("// Assembly Usage Log Interfaces")
+cpp_quote("")
+
+import "objidl.idl";
+
+cpp_quote("#ifdef _MSC_VER")
+cpp_quote("#pragma once")
+cpp_quote("#endif")
+
+cpp_quote("// {ec2b5f70-d576-4d33-876f-6e3caeb0a7ba}")
+cpp_quote("EXTERN_GUID(IID_IAssemblyUsageLog, 0xec2b5f70, 0xd576, 0x4d33, 0x87, 0x6f, 0x6e, 0x3c, 0xae, 0xb0, 0xa7, 0xba);")
+
+typedef enum
+{
+ ASSEMBLY_USAGE_LOG_FLAGS_NI = 1,
+ ASSEMBLY_USAGE_LOG_FLAGS_IL = 2,
+} ASSEMBLY_USAGE_LOG_FLAGS;
+
+[
+ local,
+ object,
+ uuid(ec2b5f70-d576-4d33-876f-6e3caeb0a7ba),
+ pointer_default(unique)
+]
+interface IAssemblyUsageLog : IUnknown
+{
+ HRESULT LogFile(LPCWSTR pwszILFile, LPCWSTR pwszNIFile, ASSEMBLY_USAGE_LOG_FLAGS flags);
+};
+
diff --git a/src/inc/assemblyusagelogmanager.h b/src/inc/assemblyusagelogmanager.h
new file mode 100644
index 0000000000..5fae606f56
--- /dev/null
+++ b/src/inc/assemblyusagelogmanager.h
@@ -0,0 +1,53 @@
+// 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.
+//
+
+#ifndef ASSEMBLY_USAGE_LOG_MANAGER_H
+#define ASSEMBLY_USAGE_LOG_MANAGER_H
+
+#include "assemblyusagelog.h"
+#include "daccess.h"
+
+class AssemblyUsageLogManager
+{
+public:
+
+ class Config
+ {
+ public:
+ LPCWSTR wszLogDir;
+ unsigned int cLogBufferSize;
+#ifdef FEATURE_APPX
+ unsigned int uiLogRefreshInterval;
+#endif
+ };
+
+ enum GENERATE_LOG_FLAGS
+ {
+ GENERATE_LOG_FLAGS_NONE = 0,
+ };
+
+ // we depend on static PODs being initialized to 0 which is why ASSEMBLY_USAGE_LOG_FLAGS_NONE is 0
+ enum ASSEMBLY_USAGE_LOG_FLAGS : DWORD
+ {
+ ASSEMBLY_USAGE_LOG_FLAGS_NONE = 0,
+ ASSEMBLY_USAGE_LOG_FLAGS_INITTED = 1,
+ ASSEMBLY_USAGE_LOG_FLAGS_APPLOCALNGENDISABLED = 2,
+ };
+
+ static HRESULT Init(const Config *pConfig);
+ static HRESULT GenerateLog(GENERATE_LOG_FLAGS flags);
+ static HRESULT GetUsageLogForContext(LPCWSTR binder, LPCWSTR binderParameter, IAssemblyUsageLog **ppUsageLog);
+ static HRESULT RegisterBinderWithUsageLog(UINT_PTR binderId, IAssemblyUsageLog *pUsageLog);
+ static HRESULT UnRegisterBinderFromUsageLog(UINT_PTR binderId);
+ static IAssemblyUsageLog *GetUsageLogForBinder(UINT_PTR binderId);
+ static ASSEMBLY_USAGE_LOG_FLAGS GetUsageLogFlags();
+ static HRESULT SetUsageLogFlag(ASSEMBLY_USAGE_LOG_FLAGS flag, BOOL);
+
+private:
+ SVAL_DECL(ASSEMBLY_USAGE_LOG_FLAGS, s_UsageLogFlags);
+};
+
+#endif /* ASSEMBLY_USAGE_LOG_MANAGER_H */
+
diff --git a/src/inc/bbsweep.h b/src/inc/bbsweep.h
new file mode 100644
index 0000000000..d5526d8e5c
--- /dev/null
+++ b/src/inc/bbsweep.h
@@ -0,0 +1,425 @@
+// 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.
+
+/*****************************************************************************\
+* *
+* BBSweep.h - Classes for sweeping profile data to disk *
+* *
+* Version 1.0 *
+*******************************************************************************
+* *
+* THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY *
+* KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE *
+* IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR *
+* PURPOSE. *
+* *
+\*****************************************************************************/
+
+#ifndef _BBSWEEP_H_
+#define _BBSWEEP_H_
+
+#ifndef FEATURE_PAL
+#include <aclapi.h>
+#endif // !FEATURE_PAL
+
+// The CLR headers don't allow us to use methods like SetEvent directly (instead
+// we need to use the host APIs). However, this file is included both in the CLR
+// and in the BBSweep tool, and the host API is not available in the tool. Moreover,
+// BBSweep is not designed to work in an environment where the host controls
+// synchronization. For this reason, we work around the problem by undefining
+// these APIs (the CLR redefines them so that they will not be used).
+#pragma push_macro("SetEvent")
+#pragma push_macro("ResetEvent")
+#pragma push_macro("ReleaseSemaphore")
+#pragma push_macro("LocalFree")
+#undef SetEvent
+#undef ResetEvent
+#undef ReleaseSemaphore
+#undef LocalFree
+
+// MAX_COUNT is the maximal number of runtime processes that can run at a given time
+#define MAX_COUNT 20
+
+#define INVALID_PID -1
+
+/* CLRBBSweepCallback is implemented by the CLR which passes it as an argument to WatchForSweepEvents.
+ * It is used by BBSweep to tell the CLR to write the profile data to disk at the right time.
+ */
+
+class ICLRBBSweepCallback
+{
+public:
+ virtual HRESULT WriteProfileData() = NULL; // tells the runtime to write the profile data to disk
+};
+
+/* BBSweep is used by both the CLR and the BBSweep utility.
+ * BBSweep: calls the PerformSweep method which returns after all the CLR processes
+ * have written their profile data to disk.
+ * CLR: starts up a sweeper thread which calls WatchForSweepEvents and waits until the
+ * sweeper program is invoked. At that point, all the CLR processes will synchronize
+ * and write their profile data to disk one at a time. The sweeper threads will then
+ * wait for the next sweep event. The CLR also calls ShutdownBBSweepThread at
+ * shutdown which returns when the BBSweep thread has terminated.
+ */
+
+class BBSweep
+{
+public:
+ BBSweep()
+ {
+ // The BBSweep constructor could be called even the the object is not used, so
+ // don't do any work here.
+ bInitialized = false;
+ bTerminate = false;
+ hSweepMutex = NULL;
+ hProfDataWriterMutex = NULL;
+ hSweepEvent = NULL;
+ hTerminationEvent = NULL;
+ hProfWriterSemaphore = NULL;
+ hBBSweepThread = NULL;
+ }
+
+ ~BBSweep()
+ {
+ // When the destructor is called, everything should be cleaned up already.
+ }
+
+ // Called by the sweeper utility to tell all the CLR threads to write their profile
+ // data to disk.
+ // THIS FUNCTIONALITY IS ALSO DUPLICATED IN TOOLBOX\MPGO\BBSWEEP.CS
+ // IF YOU CHANGE THIS CODE, YOU MUST ALSO CHANGE THAT TO MATCH!
+ bool PerformSweep(DWORD processID = INVALID_PID)
+ {
+ bool success = true;
+
+ if (!Initialize(processID, FALSE)) return false;
+
+ ::WaitForSingleObject(hSweepMutex, INFINITE);
+ {
+ success = success && ::SetEvent(hSweepEvent);
+ {
+ for (int i=0; i<MAX_COUNT; i++)
+ {
+ ::WaitForSingleObject(hProfWriterSemaphore, INFINITE);
+ }
+
+ ::ReleaseSemaphore(hProfWriterSemaphore, MAX_COUNT, NULL);
+
+ }
+ success = success && ::ResetEvent(hSweepEvent);
+ }
+ ::ReleaseMutex(hSweepMutex);
+
+ return success;
+ }
+
+ // Called by the CLR sweeper thread to wait until a sweep event, at which point
+ // it calls back into the CLR via the clrCallback interface to write the profile
+ // data to disk.
+ bool WatchForSweepEvents(ICLRBBSweepCallback *clrCallback)
+ {
+ if (!Initialize()) return false;
+
+ bool success = true;
+
+ while (!bTerminate)
+ {
+ ::WaitForSingleObject(hSweepMutex, INFINITE);
+ {
+ ::WaitForSingleObject(hProfWriterSemaphore, INFINITE);
+ }
+ ::ReleaseMutex(hSweepMutex);
+
+ HANDLE hEvents[2];
+ hEvents[0] = hSweepEvent;
+ hEvents[1] = hTerminationEvent;
+ ::WaitForMultipleObjectsEx(2, hEvents, false, INFINITE, FALSE);
+
+ ::WaitForSingleObject(hProfDataWriterMutex, INFINITE);
+ {
+ if (!bTerminate && FAILED(clrCallback->WriteProfileData()))
+ success = false;
+ }
+ ::ReleaseMutex(hProfDataWriterMutex);
+
+ ::ReleaseSemaphore(hProfWriterSemaphore, 1, NULL);
+ }
+
+ return success;
+ }
+
+ void SetBBSweepThreadHandle(HANDLE threadHandle)
+ {
+ hBBSweepThread = threadHandle;
+ }
+
+ void ShutdownBBSweepThread()
+ {
+ // Set the termination event and wait for the BBSweep thread to terminate on its own.
+ // Note that this is called by the shutdown thread (and never called by the BBSweep thread).
+ if (hBBSweepThread && bInitialized)
+ {
+ bTerminate = true;
+ ::SetEvent(hTerminationEvent);
+ ::WaitForSingleObject(hBBSweepThread, INFINITE);
+ Cleanup();
+ }
+ }
+
+ void Cleanup()
+ {
+ if (hSweepMutex) { ::CloseHandle(hSweepMutex); hSweepMutex = NULL;}
+ if (hProfDataWriterMutex) { ::CloseHandle(hProfDataWriterMutex); hProfDataWriterMutex = NULL;}
+ if (hSweepEvent) { ::CloseHandle(hSweepEvent); hSweepEvent = NULL;}
+ if (hTerminationEvent) { ::CloseHandle(hTerminationEvent); hTerminationEvent = NULL;}
+ if (hProfWriterSemaphore) { ::CloseHandle(hProfWriterSemaphore); hProfWriterSemaphore = NULL;}
+ }
+
+private:
+
+ // THIS FUNCTIONALITY IS ALSO DUPLICATED IN TOOLBOX\MPGO\BBSWEEP.CS
+ // IF YOU CHANGE THIS CODE, YOU MUST ALSO CHANGE THAT TO MATCH!
+ bool Initialize(DWORD processID = INVALID_PID, BOOL fromRuntime = TRUE)
+ {
+ if (!bInitialized)
+ {
+ SECURITY_ATTRIBUTES * pSecurityAttributes = NULL;
+
+#ifndef FEATURE_CORESYSTEM // @CORESYSTEMTODO
+ PSECURITY_DESCRIPTOR pSD = NULL;
+ PSID pAdminSid = NULL;
+ HANDLE hToken = NULL;
+ PACL pACL = NULL;
+ LPVOID buffer = NULL;
+
+ if (!OpenProcessToken(GetCurrentProcess(), TOKEN_QUERY, &hToken))
+ goto cleanup;
+
+ // don't set pSecurityAttributes for Metro processes
+ if(!IsAppContainerProcess(hToken))
+ {
+ SECURITY_ATTRIBUTES securityAttributes;
+ PSID pUserSid = NULL;
+ SID_IDENTIFIER_AUTHORITY SIDAuthNT = SECURITY_NT_AUTHORITY;
+ DWORD retLength;
+
+#ifdef _PREFAST_
+#pragma warning(push)
+#pragma warning(disable:6211) // PREfast warning: Leaking memory 'pSD' due to an exception.
+#endif /*_PREFAST_ */
+ pSD = (PSECURITY_DESCRIPTOR) new char[SECURITY_DESCRIPTOR_MIN_LENGTH];
+ if (!pSD)
+ goto cleanup;
+
+ if (GetTokenInformation(hToken, TokenOwner, NULL, 0, &retLength))
+ goto cleanup;
+
+ buffer = (LPVOID) new char[retLength];
+ if (!buffer)
+ goto cleanup;
+#ifdef _PREFAST_
+#pragma warning(pop)
+#endif /*_PREFAST_*/
+
+ // Get the SID for the current user
+ if (!GetTokenInformation(hToken, TokenOwner, (LPVOID) buffer, retLength, &retLength))
+ goto cleanup;
+
+ pUserSid = ((TOKEN_OWNER *) buffer)->Owner;
+
+ // Get the SID for the admin group
+ // Create a SID for the BUILTIN\Administrators group.
+ if(! AllocateAndInitializeSid(&SIDAuthNT, 2,
+ SECURITY_BUILTIN_DOMAIN_RID,
+ DOMAIN_ALIAS_RID_ADMINS,
+ 0, 0, 0, 0, 0, 0,
+ &pAdminSid))
+ goto cleanup;
+
+ EXPLICIT_ACCESS ea[2];
+ ZeroMemory(ea, 2 * sizeof(EXPLICIT_ACCESS));
+
+ // Initialize an EXPLICIT_ACCESS structure for an ACE.
+ // The ACE will allow the current user full access
+ ea[0].grfAccessPermissions = STANDARD_RIGHTS_ALL | SPECIFIC_RIGHTS_ALL; // KEY_ALL_ACCESS;
+ ea[0].grfAccessMode = SET_ACCESS;
+ ea[0].grfInheritance= NO_INHERITANCE;
+ ea[0].Trustee.TrusteeForm = TRUSTEE_IS_SID;
+ ea[0].Trustee.TrusteeType = TRUSTEE_IS_USER;
+ ea[0].Trustee.ptstrName = (LPTSTR) pUserSid;
+
+ // Initialize an EXPLICIT_ACCESS structure for an ACE.
+ // The ACE will allow admins full access
+ ea[1].grfAccessPermissions = STANDARD_RIGHTS_ALL | SPECIFIC_RIGHTS_ALL; //KEY_ALL_ACCESS;
+ ea[1].grfAccessMode = SET_ACCESS;
+ ea[1].grfInheritance= NO_INHERITANCE;
+ ea[1].Trustee.TrusteeForm = TRUSTEE_IS_SID;
+ ea[1].Trustee.TrusteeType = TRUSTEE_IS_GROUP;
+ ea[1].Trustee.ptstrName = (LPTSTR) pAdminSid;
+
+ if (SetEntriesInAcl(2, ea, NULL, &pACL) != ERROR_SUCCESS)
+ goto cleanup;
+
+ if (!InitializeSecurityDescriptor(pSD, SECURITY_DESCRIPTOR_REVISION))
+ goto cleanup;
+
+ if (!SetSecurityDescriptorDacl(pSD, TRUE, pACL, FALSE))
+ goto cleanup;
+
+ memset((void *) &securityAttributes, 0, sizeof(SECURITY_ATTRIBUTES));
+ securityAttributes.nLength = sizeof(SECURITY_ATTRIBUTES);
+ securityAttributes.lpSecurityDescriptor = pSD;
+ securityAttributes.bInheritHandle = FALSE;
+
+ pSecurityAttributes = &securityAttributes;
+ }
+#endif // !FEATURE_CORESYSTEM
+
+ WCHAR objectName[MAX_LONGPATH] = {0};
+ WCHAR objectNamePrefix[MAX_LONGPATH] = {0};
+ GetObjectNamePrefix(processID, fromRuntime, objectNamePrefix);
+ // if there is a non-empty name prefix, append a '\'
+ if (objectNamePrefix[0] != '\0')
+ wcscat_s(objectNamePrefix, ARRAYSIZE(objectNamePrefix), W("\\"));
+ swprintf_s(objectName, MAX_LONGPATH, W("%sBBSweep_hSweepMutex"), objectNamePrefix);
+ hSweepMutex = ::WszCreateMutex(pSecurityAttributes, false, objectName);
+ swprintf_s(objectName, MAX_LONGPATH, W("%sBBSweep_hProfDataWriterMutex"), objectNamePrefix);
+ hProfDataWriterMutex = ::WszCreateMutex(pSecurityAttributes, false, objectName);
+ swprintf_s(objectName, MAX_LONGPATH, W("%sBBSweep_hSweepEvent"), objectNamePrefix);
+ hSweepEvent = ::WszCreateEvent(pSecurityAttributes, true, false, objectName);
+
+ // Note that hTerminateEvent is not a named event. That is because it is not
+ // shared amongst the CLR processes (each process terminates at a different time)
+ hTerminationEvent = ::WszCreateEvent(pSecurityAttributes, true, false, NULL);
+ swprintf_s(objectName, MAX_LONGPATH, W("%sBBSweep_hProfWriterSemaphore"), objectNamePrefix);
+ hProfWriterSemaphore = ::WszCreateSemaphore(pSecurityAttributes, MAX_COUNT, MAX_COUNT, objectName);
+
+#ifndef FEATURE_CORESYSTEM // @CORESYSTEMTODO
+cleanup:
+ if (pSD) delete [] ((char *) pSD);
+ if (pAdminSid) FreeSid(pAdminSid);
+ if (hToken) CloseHandle(hToken);
+ if (pACL) LocalFree(pACL);
+ if (buffer) delete [] ((char *) buffer);
+#endif
+ }
+
+ bInitialized = hSweepMutex &&
+ hProfDataWriterMutex &&
+ hSweepEvent &&
+ hTerminationEvent &&
+ hProfWriterSemaphore;
+
+ if (!bInitialized) Cleanup();
+ return bInitialized;
+ }
+
+#ifndef FEATURE_PAL
+ BOOL IsAppContainerProcess(HANDLE hToken)
+ {
+#ifndef TokenIsAppContainer
+#define TokenIsAppContainer ((TOKEN_INFORMATION_CLASS) 29)
+#endif
+ BOOL fIsAppContainerProcess;
+ DWORD dwReturnLength;
+ if (!GetTokenInformation(hToken, TokenIsAppContainer, &fIsAppContainerProcess, sizeof(BOOL), &dwReturnLength) ||
+ dwReturnLength != sizeof(BOOL))
+ {
+ fIsAppContainerProcess = FALSE;
+ }
+ return fIsAppContainerProcess;
+ }
+#endif // !FEATURE_PAL
+
+ // helper to get the correct object name prefix
+ void GetObjectNamePrefix(DWORD processID, BOOL fromRuntime, __inout_z WCHAR* objectNamePrefix)
+ {
+ // default prefix
+ swprintf_s(objectNamePrefix, MAX_LONGPATH, W("Global"));
+#ifndef FEATURE_PAL
+ //
+ // This method can be called:
+ // 1. From process init code
+ // 2. From bbsweepclr.exe
+ //
+ // When called from process init code, processID is always INVALID_PID.
+ // In case it is a Win8-Metro/WP8 process, we need to add the AppContainerNamedObjectPath to prefix.
+ // And if it is a non-Metro process, we will continue to use the default prefix (Global).
+ // We use IsAppContainerProcess(CurrentProcessId) to make this decision.
+ //
+ //
+ // When called from bbsweepclr, processID is valid when sweeping a Metro or WP8 process.
+ // We use this valid processID to determine if the process being swept is Metro/WP8 indeed and then
+ // add AppContainerNamedObjectPath to prefix. This is done by IsAppContainerProcess(processID).
+ //
+ // In case INVALID_PID is passed(non-Metro process), we have to use default prefix. To handle this
+ // case we use IsAppContainerProcess(CurrentProcessId) and since bbsweepclr is a non-Metro process,
+ // this check always returns false and we end up using the intended(default) prefix.
+ //
+ if(processID == INVALID_PID) {
+ // we reach here when:
+ // * called from process init code:
+ // * called from bbsweepclr.exe and no processID has been passed as argument, that is, when sweeping a non-Metro process
+ processID = GetCurrentProcessId();
+ }
+
+ HandleHolder hProcess = OpenProcess(PROCESS_QUERY_INFORMATION, FALSE, processID);
+ if (hProcess != INVALID_HANDLE_VALUE)
+ {
+ HandleHolder hToken = NULL;
+ // if in the process init code of a Metro app or if bbsweepclr is used to sweep a Metro app,
+ // construct the object name prefix using AppContainerNamedObjectPath
+ if (OpenProcessToken(hProcess, TOKEN_QUERY, &hToken) && IsAppContainerProcess(hToken))
+ {
+ WCHAR appxNamedObjPath[MAX_LONGPATH] = { 0 };
+ ULONG appxNamedObjPathBufLen = 0;
+
+ if (fromRuntime)
+ {
+ // for Metro apps, create the object in the "default" object path, i.e. do not provide any prefix
+ objectNamePrefix[0] = W('\0');
+ }
+ else
+ {
+#if defined (FEATURE_CORESYSTEM) && !defined(CROSSGEN_COMPILE) && !defined(DACCESS_COMPILE)
+#define MODULE_NAME W("api-ms-win-security-appcontainer-l1-1-0.dll")
+#else
+#define MODULE_NAME W("kernel32.dll")
+#endif
+ typedef BOOL(WINAPI *PFN_GetAppContainerNamedObjectPath)
+ (HANDLE Token, PSID AppContainerSid, ULONG ObjectPathLength, WCHAR * ObjectPath, PULONG ReturnLength);
+
+ PFN_GetAppContainerNamedObjectPath pfnGetAppContainerNamedObjectPath = (PFN_GetAppContainerNamedObjectPath)
+ GetProcAddress(WszGetModuleHandle(MODULE_NAME), "GetAppContainerNamedObjectPath");
+ if (pfnGetAppContainerNamedObjectPath)
+ {
+ // for bbsweepclr sweeping a Metro app, create the object specifying the AppContainer's path
+ DWORD sessionId = 0;
+ ProcessIdToSessionId(processID, &sessionId);
+ pfnGetAppContainerNamedObjectPath(hToken, NULL, sizeof (appxNamedObjPath) / sizeof (WCHAR), appxNamedObjPath, &appxNamedObjPathBufLen);
+ swprintf_s(objectNamePrefix, MAX_LONGPATH, W("Global\\Session\\%d\\%s"), sessionId, appxNamedObjPath);
+ }
+ }
+ }
+ }
+#endif // FEATURE_PAL
+ }
+private:
+
+ bool bInitialized; // true when the BBSweep object has initialized successfully
+ bool bTerminate; // set to true when the CLR wants us to terminate
+ HANDLE hSweepMutex; // prevents processing from incrementing the semaphore after the sweep has began
+ HANDLE hProfDataWriterMutex; // guarantees that profile data will be written by one process at a time
+ HANDLE hSweepEvent; // tells the CLR processes to sweep their profile data
+ HANDLE hTerminationEvent; // set when the CLR process is ready to terminate
+ HANDLE hProfWriterSemaphore; // helps determine when all the writers are finished
+ HANDLE hBBSweepThread; // a handle to the CLR sweeper thread (that calls watch for sweep events)
+};
+
+#pragma pop_macro("LocalFree")
+#pragma pop_macro("ReleaseSemaphore")
+#pragma pop_macro("ResetEvent")
+#pragma pop_macro("SetEvent")
+
+#endif //_BBSWEEP_H
diff --git a/src/inc/binderngen.idl b/src/inc/binderngen.idl
new file mode 100644
index 0000000000..d20cf93701
--- /dev/null
+++ b/src/inc/binderngen.idl
@@ -0,0 +1,255 @@
+// 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.
+
+//+---------------------------------------------------------------------------
+//
+// File: binderngen.idl
+//
+// Contents: Binder to Native Binder Interfaces
+//
+// Classes:
+//
+// Functions:
+//
+//
+//----------------------------------------------------------------------------
+
+cpp_quote("")
+cpp_quote("#ifdef _MSC_VER")
+cpp_quote("#pragma comment(lib,\"uuid.lib\")")
+cpp_quote("#endif")
+cpp_quote("")
+cpp_quote("//---------------------------------------------------------------------------=")
+cpp_quote("// Binder Interfaces")
+cpp_quote("interface INativeImageInstallInfo;")
+cpp_quote("interface IILFingerprint;")
+cpp_quote("interface IILFingerprintFactory;")
+
+import "objidl.idl";
+import "fusion.idl";
+import "fusionpriv.idl";
+
+cpp_quote("#ifdef _MSC_VER")
+cpp_quote("#pragma once")
+cpp_quote("#endif")
+
+// interface IAssemblyName defined in fusion.idl
+// interface IAssemblyEnum defined in fusion.idl
+// interface IFusionBindLog defined in fusionpriv.idl
+// interface ICorSvcLogger defined in mscorsvc.idl
+
+interface IAssemblyLocation;
+interface IBindResult;
+interface IBindContext;
+interface INativeImageInstallInfo;
+interface IILFingerprint;
+
+typedef enum
+{
+ PRE_BIND_NONE = 0x00,
+ PRE_BIND_APPLY_POLICY = 0x80
+} PRE_BIND_FLAGS;
+
+
+typedef enum
+{
+ ASSEMBLY_LOCATION_PATH = 0x01,
+ ASSEMBLY_LOCATION_GAC = 0x02,
+ ASSEMBLY_LOCATION_HAS = 0x04,
+ ASSEMBLY_LOCATION_BYTE_ARRAY = 0x08
+} ASSEMBLY_LOCATION_FLAGS;
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// IAssemblyLocation
+//
+///////////////////////////////////////////////////////////////////////////////
+
+cpp_quote("// {6970aad6-d5fb-469b-9098-a03ddc65a4bd}")
+cpp_quote("EXTERN_GUID(IID_IAssemblyLocation, 0x6970aad6, 0xd5fb, 0x469b, 0x90, 0x98, 0xa0, 0x3d, 0xdc, 0x65, 0xa4, 0xbd);")
+
+[
+ local,
+ object,
+ uuid(6970aad6-d5fb-469b-9098-a03ddc65a4bd),
+ pointer_default(unique)
+]
+interface IAssemblyLocation : IUnknown
+{
+ typedef [unique] IAssemblyLocation *LPASSEMBLYLOCATION;
+
+ HRESULT GetLocationType([in] DWORD *pdwLocationType);
+
+ HRESULT GetPath([in, annotation("__inout_ecount(*pdwccAssemblyPath)")] LPWSTR pwzAssemblyPath,
+ [in, annotation("__inout")] LPDWORD pdwccAssemblyPath);
+
+ HRESULT GetHostID(UINT64 *puiHostID);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// IBindResult
+//
+// IBindResult was added mid-Dev10 when the native binder was split off
+// from Fusion. It seeks to provide a unified view of filepath-based assemblies (IAssembly),
+// host assemblies (IHostAssembly), NI images (the now-defunct CNativeImageAssembly) and
+// other things such as byte array assemblies (currently not expressible in Fusion at all.)
+//
+// At this time, it has not yet been widely adopted outside the native binder.
+//
+// @todo: Is it necessary for IBindResult to be a separately allocated object?
+// Why not create a base interface for the existing IAssembly/IHostAssembly?
+//
+//
+// Changes from Dev10:
+// Removed a bunch of methods that were added as expediencies and would
+// be long term liabilities if IBindResult is adopted as a universal assembly interface.
+//
+// In particular, it is no longer permitted to create IBindResult's that wrap
+// nothing more than an assembly name.
+//
+///////////////////////////////////////////////////////////////////////////////
+cpp_quote("// {82cff42f-55c2-45d2-aa6b-ff96e4de889c}")
+cpp_quote("EXTERN_GUID(IID_IBindResult, 0x82cff42f, 0x55c2, 0x45d2, 0xaa, 0x6b, 0xff, 0x96, 0xe4, 0xde, 0x88, 0x9c);")
+
+[
+ local,
+ object,
+ uuid(82cff42f-55c2-45d2-aa6b-ff96e4de889c),
+ pointer_default(unique)
+]
+interface IBindResult : IUnknown
+{
+ typedef [unique] IBindResult *LPBINDRESULT;
+
+ //--------------------------------------------------------------------------------
+ // These methods are good candidates for a "universal" Assembly interface.
+ //--------------------------------------------------------------------------------
+ HRESULT GetAssemblyNameDef([out] IAssemblyName **ppIAssemblyNameDef);
+
+ HRESULT GetNextAssemblyModuleName([in] DWORD dwNIndex,
+ [in, out, annotation("__inout_ecount(*pdwCCModuleName)")] LPWSTR pwzModuleName,
+ [in, out, annotation("__inout")] LPDWORD pdwCCModuleName);
+
+ HRESULT GetAssemblyLocation([out] IAssemblyLocation **ppIAssemblyLocation);
+
+
+ //--------------------------------------------------------------------------------
+ // Native image binding.
+ //
+ // @todo: Do these need to be on IBindResult? I'd say it's cleaner for
+ // these to be exposed as methods on the load context as was done pre-split.
+ //--------------------------------------------------------------------------------
+ HRESULT GetNativeImage([out] IBindResult **ppINativeImage,
+ [out] BOOL *pfNativeImageProbed);
+
+ HRESULT SetNativeImage([in] IBindResult *pINativeImage,
+ [out] IBindResult **ppINativeImageFinal);
+
+
+ //--------------------------------------------------------------------------------
+ // This is needed because IBindResults in Dev10 are not "interned" objects
+ // so we can't do pointer comparison on them as is done with IAssembly.
+ //--------------------------------------------------------------------------------
+ HRESULT IsEqual([in] IUnknown *pIUnk);
+
+
+ //--------------------------------------------------------------------------------
+ // These are used by the closure code only. We may want to rework these further
+ // post Dev10-MQ.
+ //--------------------------------------------------------------------------------
+ HRESULT GetNextAssemblyNameRef([in] DWORD dwNIndex,
+ [out] IAssemblyName **ppIAssemblyNameRef);
+
+ HRESULT GetNextDependentAssembly([in] DWORD dwNIndex,
+ [out] IUnknown **ppIUnknownAssembly);
+
+ // Ad-hoc method that gives the closure code the info it needs without native IBindResults
+ // actually having to maintain a reference to its partnered IL IBindResult.
+ HRESULT GetAssemblyLocationOfILImage([out] IAssemblyLocation **ppAssemblyLocation);
+
+
+ //--------------------------------------------------------------------------------
+ // For use on IL's only: Obtain information about IL timestamps/MVIDs/SNHashes, etc.
+ // Note that the MVID/SNHashes may be speculative (as we avoid opening the IL
+ // for workset reasons.) However, everyone in the process will see the same MVID/SNHashs
+ // for a given IL file.
+ //--------------------------------------------------------------------------------
+ HRESULT GetILFingerprint([out] IILFingerprint **ppFingerprint);
+ HRESULT GetSourceILTimestamp([out] FILETIME* pFileTime);
+ HRESULT GetSourceILSize([out] DWORD* pSize);
+
+ //--------------------------------------------------------------------------------
+ // For use on NI's only: Obtain information about NI version and dependencies.
+ //--------------------------------------------------------------------------------
+ HRESULT GetNIInfo([out] INativeImageInstallInfo** pInfo);
+
+ enum
+ {
+ IBindResultFlag_Default = 0x00,
+ IBindResultFlag_AssemblyNameDefIncomplete = 0x01,
+ };
+
+ //--------------------------------------------------------------------------------
+ // Returns the set of flags, defined in IBindResultFlags, that apply to this
+ // IBindResult object.
+ //--------------------------------------------------------------------------------
+ HRESULT GetFlags(DWORD * pdwFlags);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// IBindContext
+//
+// IBindContext represents a Fusion load context. It is an interface
+// via which Fusion provides services to the native binder.
+//
+// Note: This should *not* be adopted as a general interface for Fusion
+// load contexts. The services exposed here are quite specific to the native
+// binder's needs and it would be a liability to make them widely available.
+//
+///////////////////////////////////////////////////////////////////////////////
+cpp_quote("// {88db0d1a-460e-4341-96d7-a7c9b68f4679}")
+cpp_quote("EXTERN_GUID(IID_IBindContext, 0x88db0d1a, 0x460e, 0x4341, 0x96, 0xd7, 0xa7, 0xc9, 0xb6, 0x8f, 0x46, 0x79);")
+
+[
+ local,
+ object,
+ uuid(88db0d1a-460e-4341-96d7-a7c9b68f4679),
+ pointer_default(unique)
+]
+interface IBindContext : IUnknown
+{
+ typedef [unique] IBindContext *LPBINDCONTEXT;
+
+ HRESULT PreBind([in] IAssemblyName *pIAssemblyName,
+ [in] DWORD dwPreBindFlags,
+ [out] IBindResult **ppIBindResult);
+
+ HRESULT IsDefaultContext();
+}
+
+
+
+#pragma midl_echo("STDAPI GetBindResultFromPath(LPCWSTR pwzFilePath, DWORD dwMetaDataImportFlags, DWORD dwAssemblyLocation, IBindContext *pBindContext, IBindResult **ppIBindResult, HANDLE hFile = INVALID_HANDLE_VALUE); ")
+//
+// Interface fraction implemented by ngen binder folks.
+//
+
+typedef struct
+{
+ WCHAR *pwzZapConfigString;
+ DWORD dwZapConfigMask;
+} NativeConfigData;
+
+#pragma midl_echo("interface ICorSvcLogger;")
+#pragma midl_echo("STDAPI InitializeNativeBinder(); ")
+#pragma midl_echo("STDAPI GetZapDir(__deref_out LPCWSTR *pszZapDir); ")
+#pragma midl_echo("STDAPI InstallNativeAssembly(LPCWSTR pwzAssemblyPath, HANDLE hFile, LPCWSTR pwzZapSet, IBindContext* pBindCtx, IAssemblyName **ppAssemblyName, IAssemblyLocation **ppAssemblyLocation);")
+#pragma midl_echo("STDAPI UninstallNativeAssembly(IAssemblyName *pIAssemblyName, ICorSvcLogger *pLogSink); ")
+#pragma midl_echo("STDAPI QueryNativeAssemblyInfo(IAssemblyName *pIAssemblyName, __out_ecount(*pdwSize) LPWSTR pwzFilePath, __inout LPDWORD pdwSize); ")
+#pragma midl_echo("STDAPI GetAssemblyNameFromNIPath(LPCWSTR wszNIPath, IAssemblyName ** ppAssemblyName); ")
+#pragma midl_echo("STDAPI CreateNativeAssemblyEnum(IAssemblyEnum **ppIAssemblyEnum, IAssemblyName *pIAssemblyName);")
+#pragma midl_echo("STDAPI BindToNativeAssembly(IBindResult *pGivenILAsm, const NativeConfigData *pNativeConfigData, IBindContext *pBindContext, IFusionBindLog *pFusionBindLog); ")
+#pragma midl_echo("struct IMDInternalImport;")
diff --git a/src/inc/bitmask.h b/src/inc/bitmask.h
new file mode 100644
index 0000000000..a59d2e252d
--- /dev/null
+++ b/src/inc/bitmask.h
@@ -0,0 +1,103 @@
+// 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.
+
+//
+
+// --------------------------------------------------------------------------------
+// BitMask.h
+// --------------------------------------------------------------------------------
+
+// --------------------------------------------------------------------------------
+// BitMask is an arbitrarily large sized bitfield which has optimal storage
+// for 32 bits or less.
+// Storage is proportional to the highest index which is set.
+// --------------------------------------------------------------------------------
+
+
+#include <clrtypes.h>
+
+#ifndef _BITMASK_H_
+#define _BITMASK_H_
+
+class BitMask
+{
+ public:
+
+ BitMask();
+ ~BitMask();
+
+ BOOL TestBit(int bit);
+ void SetBit(int bit);
+ void ClearBit(int bit);
+
+ // returns true if any bit is set
+ BOOL TestAnyBit();
+
+ void ClearAllBits();
+
+ // Allocation exposed for ngen save/fixup
+ size_t GetAllocatedBlockOffset();
+ void *GetAllocatedBlock();
+ COUNT_T GetAllocatedBlockSize();
+
+ private:
+
+ static const int BIT_SIZE_SHIFT = 5;
+ static const int BIT_SIZE = (1<<BIT_SIZE_SHIFT);
+ static const int BIT_SIZE_MASK = BIT_SIZE-1;
+
+ static const COUNT_T MIN_ARRAY_ALLOCATION = 3;
+
+ // The first bit is used to indicate whether we've got a flat mask or
+ // an array of mask elements
+ BOOL IsArray();
+
+ // Indexing computations
+ COUNT_T BitToIndex(int bit);
+ COUNT_T BitToShift(int bit);
+
+ // Generic mask array access. Works for either case (array or non-array).
+ COUNT_T *GetMaskArray();
+ COUNT_T GetMaskArraySize();
+
+ // Need more bits...
+ void GrowArray(COUNT_T newSize);
+
+ union
+ {
+ COUNT_T m_mask;
+ COUNT_T *m_maskArray; // first array element is size of rest of array
+ };
+};
+
+// provides a wrapper around the BitMask class providing synchronized reads/writes safe for multithreaded access.
+// I've only added the public methods that were required by Module which needs a thread-safe BitMask. add others as required.
+class SynchronizedBitMask
+{
+ public:
+ // Allow Module access so we can use Offsetof on this class's private members during native image creation (determinism)
+ friend class Module;
+ SynchronizedBitMask();
+ ~SynchronizedBitMask() {}
+
+ BOOL TestBit(int bit);
+ void SetBit(int bit);
+ void ClearBit(int bit);
+
+ BOOL TestAnyBit();
+
+ void ClearAllBits();
+
+ private:
+
+ BitMask m_bitMask;
+
+ // note that this lock (at present) doesn't support promotion from reader->writer so be very careful
+ // when taking this lock else you might deadlock your own thread!
+ SimpleRWLock m_bitMaskLock;
+};
+
+#include <bitmask.inl>
+
+#endif // _BITMASK_H_
diff --git a/src/inc/bitmask.inl b/src/inc/bitmask.inl
new file mode 100644
index 0000000000..00bfe0138e
--- /dev/null
+++ b/src/inc/bitmask.inl
@@ -0,0 +1,292 @@
+// 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.
+
+//
+
+// --------------------------------------------------------------------------------
+// BitMask.inl
+// --------------------------------------------------------------------------------
+
+#include <bitmask.h>
+
+#ifndef _BITMASK_INL_
+#define _BITMASK_INL_
+
+inline BOOL BitMask::IsArray()
+{
+ LIMITED_METHOD_CONTRACT;
+ return (m_mask&1) == 0;
+}
+
+// Indexing computations
+inline COUNT_T BitMask::BitToIndex(int bit)
+{
+ LIMITED_METHOD_CONTRACT;
+ // First word has one less bit due to tag
+ return (bit+1) >> BIT_SIZE_SHIFT;
+}
+
+inline COUNT_T BitMask::BitToShift(int bit)
+{
+ LIMITED_METHOD_CONTRACT;
+ // First word has one less bit due to tag
+ return (bit+1) & BIT_SIZE_MASK;
+}
+
+// Array access. Note the first array element is the count of the
+// rest of the elements
+
+inline COUNT_T *BitMask::GetMaskArray()
+{
+ LIMITED_METHOD_CONTRACT;
+ if (IsArray())
+ {
+ CONSISTENCY_CHECK(CheckPointer(m_maskArray));
+ return m_maskArray+1;
+ }
+ else
+ return &m_mask;
+}
+
+inline COUNT_T BitMask::GetMaskArraySize()
+{
+ LIMITED_METHOD_CONTRACT;
+ if (IsArray())
+ return *m_maskArray;
+ else
+ return 1;
+}
+
+inline void BitMask::GrowArray(COUNT_T newSize)
+{
+ CONTRACTL
+ {
+ THROWS;
+ }
+ CONTRACTL_END;
+
+ // Ensure we don't grow too often
+
+ COUNT_T oldSize = GetMaskArraySize();
+ if (newSize <= oldSize)
+ return;
+
+ if (newSize < oldSize*2)
+ newSize = oldSize*2;
+ if (newSize < MIN_ARRAY_ALLOCATION)
+ newSize = MIN_ARRAY_ALLOCATION;
+
+ // Allocate new array
+
+ COUNT_T *newArray = new COUNT_T [newSize+1];
+ *newArray = newSize;
+
+ CopyMemory(newArray+1, GetMaskArray(), oldSize * sizeof(COUNT_T));
+ ZeroMemory(newArray+oldSize+1, (newSize - oldSize) * sizeof(COUNT_T));
+
+ if (IsArray())
+ delete [] m_maskArray;
+
+ m_maskArray = newArray;
+}
+
+inline BitMask::BitMask()
+ : m_mask(1)
+{
+ LIMITED_METHOD_CONTRACT;
+}
+
+inline BitMask::~BitMask()
+{
+ LIMITED_METHOD_CONTRACT;
+
+ if (IsArray())
+ delete [] m_maskArray;
+}
+
+inline BOOL BitMask::TestBit(int bit)
+{
+ LIMITED_METHOD_CONTRACT;
+
+ COUNT_T index = BitToIndex(bit);
+
+ if (index >= GetMaskArraySize())
+ return FALSE;
+
+ return ( GetMaskArray()[index] >> BitToShift(bit) ) & 1;
+}
+
+inline void BitMask::SetBit(int bit)
+{
+ CONTRACTL
+ {
+ THROWS;
+ }
+ CONTRACTL_END;
+
+ COUNT_T index = BitToIndex(bit);
+
+ if (index >= GetMaskArraySize())
+ GrowArray(index+1);
+
+ GetMaskArray()[index] |= (1 << BitToShift(bit));
+}
+
+inline void BitMask::ClearBit(int bit)
+{
+ LIMITED_METHOD_CONTRACT;
+
+ COUNT_T index = BitToIndex(bit);
+
+ if (index >= GetMaskArraySize())
+ return;
+
+ GetMaskArray()[index] &= ~(1 << BitToShift(bit));
+}
+
+inline BOOL BitMask::TestAnyBit()
+{
+ LIMITED_METHOD_CONTRACT;
+
+ if (IsArray())
+ {
+ COUNT_T *mask = m_maskArray+1;
+ COUNT_T *maskEnd = mask + m_maskArray[0];
+
+ while (mask < maskEnd)
+ {
+ if (*mask != 0)
+ return TRUE;
+ mask++;
+ }
+
+ return FALSE;
+ }
+ else
+ return m_mask != (COUNT_T) 1;
+}
+
+inline void BitMask::ClearAllBits()
+{
+ LIMITED_METHOD_CONTRACT;
+
+ if (IsArray())
+ delete [] m_maskArray;
+
+ m_mask = 1;
+}
+
+inline size_t BitMask::GetAllocatedBlockOffset()
+{
+ LIMITED_METHOD_CONTRACT;
+
+ return offsetof(BitMask, m_maskArray);
+}
+
+inline void *BitMask::GetAllocatedBlock()
+{
+ LIMITED_METHOD_CONTRACT;
+
+ if (IsArray())
+ return m_maskArray;
+ else
+ return NULL;
+}
+
+inline COUNT_T BitMask::GetAllocatedBlockSize()
+{
+ LIMITED_METHOD_CONTRACT;
+
+ if (IsArray())
+ return (GetMaskArraySize()+1) * sizeof(COUNT_T);
+ else
+ return 0;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+/////////////////////////////////////////////////////////////////////////////////////////////
+
+inline SynchronizedBitMask::SynchronizedBitMask()
+ : m_bitMaskLock(PREEMPTIVE, LOCK_TYPE_DEFAULT)
+{
+ LIMITED_METHOD_CONTRACT;
+}
+
+inline BOOL SynchronizedBitMask::TestBit(int bit)
+{
+ CONTRACTL
+ {
+ NOTHROW;
+ MODE_ANY;
+ CAN_TAKE_LOCK;
+ }
+ CONTRACTL_END;
+
+ SimpleReadLockHolder holder(&m_bitMaskLock);
+
+ return m_bitMask.TestBit(bit);
+}
+
+inline void SynchronizedBitMask::SetBit(int bit)
+{
+ CONTRACTL
+ {
+ THROWS;
+ MODE_ANY;
+ CAN_TAKE_LOCK;
+ }
+ CONTRACTL_END;
+
+ SimpleWriteLockHolder holder(&m_bitMaskLock);
+
+ m_bitMask.SetBit(bit);
+}
+
+inline void SynchronizedBitMask::ClearBit(int bit)
+{
+ CONTRACTL
+ {
+ NOTHROW;
+ MODE_ANY;
+ CAN_TAKE_LOCK;
+ }
+ CONTRACTL_END;
+
+ SimpleWriteLockHolder holder(&m_bitMaskLock);
+
+ m_bitMask.ClearBit(bit);
+}
+
+inline BOOL SynchronizedBitMask::TestAnyBit()
+{
+ CONTRACTL
+ {
+ NOTHROW;
+ MODE_ANY;
+ CAN_TAKE_LOCK;
+ }
+ CONTRACTL_END;
+
+ SimpleReadLockHolder holder(&m_bitMaskLock);
+
+ return m_bitMask.TestAnyBit();
+}
+
+inline void SynchronizedBitMask::ClearAllBits()
+{
+ CONTRACTL
+ {
+ NOTHROW;
+ MODE_ANY;
+ CAN_TAKE_LOCK;
+ }
+ CONTRACTL_END;
+
+ SimpleWriteLockHolder holder(&m_bitMaskLock);
+
+ m_bitMask.ClearAllBits();
+}
+
+#endif // _BITMASK_INL_
+
diff --git a/src/inc/bitposition.h b/src/inc/bitposition.h
new file mode 100644
index 0000000000..0f3831fce9
--- /dev/null
+++ b/src/inc/bitposition.h
@@ -0,0 +1,55 @@
+// 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.
+
+#ifndef _BITPOSITION_H_
+#define _BITPOSITION_H_
+
+//------------------------------------------------------------------------
+// BitPosition: Return the position of the single bit that is set in 'value'.
+//
+// Return Value:
+// The position (0 is LSB) of bit that is set in 'value'
+//
+// Notes:
+// 'value' must have exactly one bit set.
+// The algorithm is as follows:
+// - PRIME is a prime bigger than sizeof(unsigned int), which is not of the
+// form 2^n-1.
+// - Taking the modulo of 'value' with this will produce a unique hash for all
+// powers of 2 (which is what "value" is).
+// - Entries in hashTable[] which are -1 should never be used. There
+// should be PRIME-8*sizeof(value) entries which are -1 .
+//
+inline
+unsigned BitPosition(unsigned value)
+{
+ _ASSERTE((value != 0) && ((value & (value-1)) == 0));
+#ifndef _TARGET_AMD64_
+ const unsigned PRIME = 37;
+
+ static const char hashTable[PRIME] =
+ {
+ -1, 0, 1, 26, 2, 23, 27, -1, 3, 16,
+ 24, 30, 28, 11, -1, 13, 4, 7, 17, -1,
+ 25, 22, 31, 15, 29, 10, 12, 6, -1, 21,
+ 14, 9, 5, 20, 8, 19, 18
+ };
+
+ _ASSERTE(PRIME >= 8*sizeof(value));
+ _ASSERTE(sizeof(hashTable) == PRIME);
+
+
+ unsigned hash = value % PRIME;
+ unsigned index = hashTable[hash];
+ _ASSERTE(index != (unsigned char)-1);
+#else
+ // not enabled for x86 because BSF is extremely slow on Atom
+ // (15 clock cycles vs 1-3 on any other Intel CPU post-P4)
+ DWORD index;
+ BitScanForward(&index, value);
+#endif
+ return index;
+}
+
+#endif
diff --git a/src/inc/bitvector.h b/src/inc/bitvector.h
new file mode 100644
index 0000000000..a4181dbb8a
--- /dev/null
+++ b/src/inc/bitvector.h
@@ -0,0 +1,462 @@
+// 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.
+
+
+/***************************************************************************/
+/* BitVector.h */
+/***************************************************************************/
+// Routines to support a growable bitvector
+/***************************************************************************/
+
+#ifndef BITVECTOR_H
+#define BITVECTOR_H 1
+
+
+#ifndef LIMITED_METHOD_CONTRACT
+#define LIMITED_METHOD_CONTRACT
+#define UNDEF_LIMITED_METHOD_CONTRACT
+#endif
+
+#ifndef WRAPPER_NO_CONTRACT
+#define WRAPPER_NO_CONTRACT
+#define UNDEF_WRAPPER_NO_CONTRACT
+#endif
+
+#ifndef SUPPORTS_DAC
+#define SUPPORTS_DAC
+#define UNDEF_SUPPORTS_DAC
+#endif
+
+#ifndef _ASSERTE
+#define _ASSERTE(x)
+#define UNDEF_ASSERTE
+#endif
+
+#define USE_BITVECTOR 1
+#if USE_BITVECTOR
+
+/* The bitvector class is meant to be a drop in replacement for an integer
+ (that is you use it like an integer), however it grows as needed.
+
+ Features:
+ plug compatible with normal integers;
+ grows as needed
+ Optimized for the small case when the vector fits in machine word
+ Uses one machine word if vector fits in machine word (minus a bit)
+
+ Some caveates:
+ You should use mutator operators &=, |= ... instead of the
+ non-mutators whenever possible to avoid creating a temps
+
+ Specifically did NOT supply automatic coersions to
+ and from short types so that the programmer is aware of
+ when code was being injected on his behalf. The upshot of this
+ is that you have to use the BitVector() toUnsigned() to convert
+*/
+
+/***************************************************************************/
+
+class BitVector {
+ // Set this to be unsigned char to do testing, should be UINT_PTR for real life
+
+ typedef UINT_PTR ChunkType; // The size of integer type that the machine can operate on directly
+// typedef BYTE ChunkType; // Use for testing
+
+ // Maximum number of bits in our bitvector
+#define MAX_PTRARG_OFS 1024
+
+ enum {
+ IS_BIG = 1, // The low bit is used to discrimate m_val and m_vals
+ CHUNK_BITS = sizeof(ChunkType)*8, // The number of bits that we can manipuate as a chunk
+ SMALL_BITS = CHUNK_BITS - 1, // The number of bits we can fit in the small representation
+// SMALL_BITS = 5, // TESTING ONLY: The number of bits we can fit in the small representation
+ VALS_COUNT = MAX_PTRARG_OFS / CHUNK_BITS, // The number of ChunkType elements in the Vals array
+ };
+
+public:
+ BitVector()
+ {
+ LIMITED_METHOD_CONTRACT;
+ SUPPORTS_DAC;
+
+ m_val = 0;
+ }
+
+ BOOL isBig() const
+ {
+ LIMITED_METHOD_CONTRACT;
+ SUPPORTS_DAC;
+
+ return ((m_val & IS_BIG) != 0);
+ }
+
+ void toBig()
+ {
+ LIMITED_METHOD_CONTRACT;
+ SUPPORTS_DAC;
+
+ if (!isBig())
+ {
+ doBigInit(smallBits());
+ }
+ }
+
+ explicit BitVector(ChunkType arg)
+ {
+ WRAPPER_NO_CONTRACT;
+ SUPPORTS_DAC;
+
+ if (arg > MaxVal)
+ {
+ doBigInit(arg);
+ }
+ else
+ {
+ m_val = ChunkType(arg << 1);
+ }
+ }
+
+ BitVector(ChunkType arg, UINT shift)
+ {
+ WRAPPER_NO_CONTRACT;
+ SUPPORTS_DAC;
+
+ if ((arg > MaxVal) || (shift >= SMALL_BITS) || (arg > (MaxVal >> shift)))
+ {
+ doBigInit(arg);
+ doBigLeftShiftAssign(shift);
+ }
+ else
+ {
+ m_val = ChunkType(arg << (shift+1));
+ }
+ }
+
+#define CONSTRUCT_ptrArgTP(arg,shift) BitVector((arg), (shift))
+
+ BitVector(const BitVector& arg)
+ {
+ WRAPPER_NO_CONTRACT;
+ SUPPORTS_DAC;
+
+ if (arg.isBig())
+ {
+ doBigInit(arg);
+ }
+ else
+ {
+ m_val = arg.m_val;
+ }
+ }
+
+ void operator <<=(unsigned shift)
+ {
+ WRAPPER_NO_CONTRACT;
+ SUPPORTS_DAC;
+
+ if ((m_val == 0) || (shift == 0)) // Zero is a special case, don't need to do anything
+ return;
+
+ if (isBig() || (shift >= SMALL_BITS) || (m_val > (MaxVal >> (shift-1))))
+ {
+ doBigLeftShiftAssign(shift);
+ }
+ else
+ {
+ m_val <<= shift;
+ }
+ }
+
+ void operator >>=(unsigned shift)
+ {
+ WRAPPER_NO_CONTRACT;
+ SUPPORTS_DAC;
+
+ if (isBig())
+ {
+ doBigRightShiftAssign(shift);
+ }
+ else
+ {
+ m_val >>= shift;
+ m_val &= ~IS_BIG; // clear the isBig bit if it got set
+ }
+ }
+
+ void operator |=(const BitVector& arg)
+ {
+ WRAPPER_NO_CONTRACT;
+ SUPPORTS_DAC;
+
+ if (((m_val | arg.m_val) & IS_BIG) != 0)
+ {
+ doBigOrAssign(arg);
+ }
+ else
+ {
+ m_val |= arg.m_val;
+ }
+ }
+
+ // Note that that is set difference, not subtration
+ void operator -=(const BitVector& arg)
+ {
+ WRAPPER_NO_CONTRACT;
+ SUPPORTS_DAC;
+
+ if (((m_val | arg.m_val) & IS_BIG) != 0)
+ {
+ doBigDiffAssign(arg);
+ }
+ else
+ {
+ m_val &= ~arg.m_val;
+ }
+ }
+
+ void operator &=(const BitVector& arg)
+ {
+ WRAPPER_NO_CONTRACT;
+ SUPPORTS_DAC;
+
+ if (((m_val | arg.m_val) & IS_BIG) != 0)
+ {
+ doBigAndAssign(arg);
+ }
+ else
+ {
+ m_val &= arg.m_val;
+ }
+ }
+
+ friend void setDiff(BitVector& target, const BitVector& arg)
+ {
+ WRAPPER_NO_CONTRACT;
+ SUPPORTS_DAC;
+
+ target -= arg;
+ }
+
+ friend BOOL intersect(const BitVector& arg1, const BitVector& arg2)
+ {
+ WRAPPER_NO_CONTRACT;
+ SUPPORTS_DAC;
+
+ if (((arg1.m_val | arg2.m_val) & IS_BIG) != 0)
+ {
+ return arg1.doBigIntersect(arg2);
+ }
+ else
+ {
+ return ((arg1.m_val & arg2.m_val) != 0);
+ }
+ }
+
+ BOOL operator ==(const BitVector& arg) const
+ {
+ WRAPPER_NO_CONTRACT;
+ SUPPORTS_DAC;
+
+ if ((m_val | arg.m_val) & IS_BIG)
+ {
+ return doBigEquals(arg);
+ }
+ else
+ {
+ return m_val == arg.m_val;
+ }
+ }
+
+ BOOL operator !=(const BitVector& arg) const
+ {
+ WRAPPER_NO_CONTRACT;
+ SUPPORTS_DAC;
+
+ return !(*this == arg);
+ }
+
+ friend ChunkType toUnsigned(const BitVector& arg)
+ {
+ WRAPPER_NO_CONTRACT;
+ SUPPORTS_DAC;
+
+ if (arg.isBig())
+ {
+ return arg.m_vals.m_chunks[0]; // Note truncation
+ }
+ else
+ {
+ return arg.smallBits();
+ }
+ }
+
+ // Note that we require the invariant that zero is always stored in the
+ // small form so that this works bitvector is zero iff (m_val == 0)
+ friend BOOL isZero(const BitVector& arg)
+ {
+ WRAPPER_NO_CONTRACT;
+ SUPPORTS_DAC;
+
+ return arg.m_val == 0;
+ }
+
+ /* currently only used in asserts */
+ BitVector operator &(const BitVector& arg) const
+ {
+ WRAPPER_NO_CONTRACT;
+ SUPPORTS_DAC;
+
+ BitVector ret = *this;
+ ret &= arg;
+ return ret;
+ }
+
+ int NumBits() const;
+
+private:
+
+ static const ChunkType MaxVal = ((ChunkType)1 << SMALL_BITS) - 1; // Maximum value that can be stored in m_val
+
+ // This is the structure that we use when the bit vector overflows.
+ // It is a simple vector.
+ struct Vals {
+ unsigned m_encodedLength; // An encoding of the current length of the 'm_chunks' array
+ ChunkType m_chunks[VALS_COUNT];
+
+ BOOL isBig() const
+ {
+ LIMITED_METHOD_CONTRACT;
+ SUPPORTS_DAC;
+
+ return ((m_encodedLength & IS_BIG) != 0);
+ }
+
+ unsigned GetLength() const
+ {
+ LIMITED_METHOD_CONTRACT;
+ SUPPORTS_DAC;
+
+ if (isBig())
+ {
+ unsigned length = (m_encodedLength >> 1);
+ _ASSERTE(length > 0);
+ return length;
+ }
+ else
+ {
+ return 0;
+ }
+ }
+
+ void SetLength(unsigned length)
+ {
+ LIMITED_METHOD_CONTRACT;
+ SUPPORTS_DAC;
+
+ _ASSERTE(length > 0);
+ _ASSERTE(length <= VALS_COUNT);
+
+ m_encodedLength = (ChunkType) (length << 1);
+ m_encodedLength |= (ChunkType) IS_BIG;
+ }
+ };
+
+ //
+ // This is the instance data for the bitvector
+ //
+ // We discrimininate on this
+ union {
+ ChunkType m_val; // if m_val bit 0 is false, then bits 1-N are the bit vector
+ Vals m_vals; // if m_val bit 1 is true, then use Vals
+ };
+
+
+ ChunkType smallBits() const
+ {
+ LIMITED_METHOD_CONTRACT;
+ SUPPORTS_DAC;
+
+ _ASSERTE(!isBig());
+ return (m_val >> 1);
+ }
+
+#ifdef STRIKE
+ void doBigInit(ChunkType arg) {}
+#else
+ void doBigInit(ChunkType arg);
+#endif
+ void doBigInit(const BitVector& arg);
+ void doBigLeftShiftAssign(unsigned arg);
+ void doBigRightShiftAssign(unsigned arg);
+ void doBigDiffAssign(const BitVector&);
+ void doBigAndAssign(const BitVector&);
+ void doBigOrAssign(const BitVector& arg);
+ BOOL doBigEquals(const BitVector&) const;
+ BOOL doBigIntersect(const BitVector&) const;
+};
+
+typedef BitVector ptrArgTP;
+
+#else // !USE_BITVECTOR
+
+typedef unsigned __int64 ptrArgTP;
+
+ // Maximum number of bits in our bitvector
+#define MAX_PTRARG_OFS (sizeof(ptrArgTP) * 8)
+
+#define CONSTRUCT_ptrArgTP(arg,shift) (((ptrArgTP) (arg)) << (shift))
+
+inline BOOL isZero(const ptrArgTP& arg)
+{
+ LIMITED_METHOD_CONTRACT;
+ SUPPORTS_DAC;
+ return (arg == 0);
+}
+
+inline ptrArgTP toUnsigned(const ptrArgTP& arg)
+{
+ LIMITED_METHOD_CONTRACT;
+ SUPPORTS_DAC;
+ return arg;
+}
+
+inline void setDiff(ptrArgTP& target, const ptrArgTP& arg)
+{
+ LIMITED_METHOD_CONTRACT;
+ SUPPORTS_DAC;
+
+ target &= ~arg;
+}
+
+inline BOOL intersect(const ptrArgTP arg1, const ptrArgTP arg2)
+{
+ LIMITED_METHOD_CONTRACT;
+ SUPPORTS_DAC;
+
+ return ((arg1 & arg2) != 0);
+}
+
+#endif // !USE_BITVECTOR
+
+#ifdef UNDEF_LIMITED_METHOD_CONTRACT
+#undef LIMITED_METHOD_CONTRACT
+#undef UNDEF_LIMITED_METHOD_CONTRACT
+#endif
+
+#ifdef UNDEF_WRAPPER_NO_CONTRACT
+#undef WRAPPER_NO_CONTRACT
+#undef UNDEF_WRAPPER_NO_CONTRACT
+#endif
+
+#ifdef UNDEF_SUPPORTS_DAC
+#undef SUPPORTS_DAC
+#undef UNDEF_SUPPORTS_DAC
+#endif
+
+#ifdef UNDEF_ASSERTE
+#undef _ASSERTE
+#undef UNDEF_ASSERTE
+#endif
+
+#endif // BITVECTOR_H
diff --git a/src/inc/blobfetcher.h b/src/inc/blobfetcher.h
new file mode 100644
index 0000000000..0c640f0d6d
--- /dev/null
+++ b/src/inc/blobfetcher.h
@@ -0,0 +1,174 @@
+// 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.
+//*****************************************************************************
+// CBlobFetcher - it fetches binary chunks, similar to new, but more controlled
+//
+// Fast, dynamic, memory management which doesn't relocate blocks
+// m_pIndex has array of pillars, where each pillar starts off empty and has
+// just-in-time allocation. As each pillar fills up, we move to the next pillar
+// If the entire array of pillars fill up, we need to allocate a new array and
+// copy the pillars over. But the actual data returned from GetBlock() never
+// gets moved. So everyone's happy.
+//
+//*****************************************************************************
+
+
+#ifndef __BLOB_FETCHER_H_
+#define __BLOB_FETCHER_H_
+
+#include <windef.h>
+
+
+class CBlobFetcher
+{
+protected:
+
+ class CPillar {
+ public:
+ CPillar();
+ ~CPillar();
+
+ void SetAllocateSize(unsigned nSize);
+ unsigned GetAllocateSize() const;
+
+ char* MakeNewBlock(unsigned len, unsigned pad);
+ void StealDataFrom(CPillar & src);
+ unsigned GetDataLen() const;
+ char* GetRawDataStart();
+ BOOL Contains(__in char *ptr);
+ ULONG32 GetOffset(__in char *ptr);
+
+ protected:
+ unsigned m_nTargetSize; // when we allocate, make it this large
+
+ // Make these public so CBlobFetcher can do easy manipulation
+ public:
+ char* m_dataAlloc;
+ char* m_dataStart;
+ char* m_dataCur;
+ char* m_dataEnd;
+ };
+
+
+ CPillar * m_pIndex; // array of pillars
+
+ unsigned m_nIndexMax; // actual size of m_ppIndex
+ unsigned m_nIndexUsed; // current pillar, so start at 0
+
+ unsigned m_nDataLen; // sum of all pillars' lengths
+
+// Don't allow these because they'll mess up the ownership
+ CBlobFetcher(const CBlobFetcher & src);
+ CBlobFetcher& operator=(const CBlobFetcher & src);
+
+public:
+#if defined(_WIN64)
+ // needs to be 64 so that we can purposefully cache align code in ngen'd images
+ enum { maxAlign = 64 }; // maximum alignment we support
+#else
+ enum { maxAlign = 32 }; // maximum alignment we support
+#endif
+ CBlobFetcher();
+ ~CBlobFetcher();
+
+// get a block to write on (use instead of write to avoid copy)
+ char * MakeNewBlock(unsigned int nSize, unsigned align=1);
+
+// Index segment as if this were linear
+ char * ComputePointer(unsigned offset) const;
+
+// Determine if pointer came from this fetcher
+ BOOL ContainsPointer(__in char *ptr) const;
+
+// Find an offset as if this were linear
+ unsigned ComputeOffset(__in char *ptr) const;
+
+// Write out the section to the stream
+ HRESULT Write(HANDLE file);
+
+// Write out the section to memory
+ HRESULT WriteMem(void ** pMem);
+
+// Get the total length of all our data (sum of all the pillar's data length's)
+// cached value, so light weight & no computations
+ unsigned GetDataLen() const;
+
+ HRESULT Merge(CBlobFetcher *destination);
+
+// Set the blob fetcher to slow growth mode. This should be done before any allocations
+ void SetInitialGrowth(unsigned growth);
+};
+
+
+//*****************************************************************************
+// Inlines
+//*****************************************************************************
+
+// Set the size that the Pillar will allocate if we call getBlock()
+inline void CBlobFetcher::CPillar::SetAllocateSize(unsigned nSize)
+{
+ LIMITED_METHOD_CONTRACT;
+ m_nTargetSize = nSize;
+}
+
+// Get the size we will allocate so we can decide if we need to change it
+// This is not the same as the GetDataLen() and is only useful
+// before we do the allocation
+inline unsigned CBlobFetcher::CPillar::GetAllocateSize() const
+{
+ LIMITED_METHOD_CONTRACT;
+ return m_nTargetSize;
+}
+
+inline char* CBlobFetcher::CPillar::GetRawDataStart()
+{
+ LIMITED_METHOD_CONTRACT;
+ return m_dataStart;
+}
+
+inline BOOL CBlobFetcher::CPillar::Contains(__in char *ptr)
+{
+ LIMITED_METHOD_CONTRACT;
+
+ return ptr >= m_dataStart && ptr < m_dataCur;
+}
+
+inline ULONG32 CBlobFetcher::CPillar::GetOffset(__in char *ptr)
+{
+ LIMITED_METHOD_CONTRACT;
+ _ASSERTE(Contains(ptr));
+
+ return (ULONG32)(ptr - m_dataStart);
+}
+
+//-----------------------------------------------------------------------------
+// Calculate the length of data being used, (not the length allocated)
+//-----------------------------------------------------------------------------
+inline unsigned CBlobFetcher::CPillar::GetDataLen() const
+{
+ LIMITED_METHOD_CONTRACT;
+
+ _ASSERTE((m_dataCur >= m_dataStart) && (m_dataCur <= m_dataEnd));
+
+ return (unsigned)(m_dataCur - m_dataStart);
+}
+
+inline unsigned CBlobFetcher::GetDataLen() const
+{
+ LIMITED_METHOD_CONTRACT;
+
+ return m_nDataLen;
+}
+
+// Set the blob fetcher to slow growth mode. This should be done before any allocations
+inline void CBlobFetcher::SetInitialGrowth(unsigned growth)
+{
+ _ASSERTE(GetDataLen() == 0);
+ if (GetDataLen() == 0)
+ {
+ m_pIndex[0].SetAllocateSize(growth);
+ }
+}
+
+#endif // __BLOB_FETCHER_H_
diff --git a/src/inc/cahlpr.h b/src/inc/cahlpr.h
new file mode 100644
index 0000000000..903d3abddf
--- /dev/null
+++ b/src/inc/cahlpr.h
@@ -0,0 +1,41 @@
+// 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.
+//*****************************************************************************
+// File: CAHLPR.H
+//
+//
+//
+//*****************************************************************************
+#ifndef __CAHLPR_H__
+#define __CAHLPR_H__
+
+#include "caparser.h"
+
+//*****************************************************************************
+// This class assists in the parsing of CustomAttribute blobs.
+//*****************************************************************************
+struct CaValue
+{
+ union
+ {
+ signed __int8 i1;
+ unsigned __int8 u1;
+ signed __int16 i2;
+ unsigned __int16 u2;
+ signed __int32 i4;
+ unsigned __int32 u4;
+ signed __int64 i8;
+ unsigned __int64 u8;
+ float r4;
+ double r8;
+ struct
+ {
+ LPCUTF8 pStr;
+ ULONG cbStr;
+ } str;
+ };
+ unsigned __int8 tag;
+};
+
+#endif // __CAHLPR_H__
diff --git a/src/inc/caparser.h b/src/inc/caparser.h
new file mode 100644
index 0000000000..0dfbb918b2
--- /dev/null
+++ b/src/inc/caparser.h
@@ -0,0 +1,377 @@
+// 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.
+//
+// File: caparser.h
+//
+
+
+//
+
+//
+// ============================================================================
+
+#ifndef __CAPARSER_H__
+#define __CAPARSER_H__
+
+#include "stgpooli.h"
+
+class CustomAttributeParser {
+public:
+ CustomAttributeParser( // Constructor for CustomAttributeParser.
+ const void *pvBlob, // Pointer to the CustomAttribute blob.
+ ULONG cbBlob) // Size of the CustomAttribute blob.
+ : m_pbCur(reinterpret_cast<const BYTE*>(pvBlob)),
+ m_pbBlob(reinterpret_cast<const BYTE*>(pvBlob)),
+ m_cbBlob(cbBlob)
+ {
+ LIMITED_METHOD_CONTRACT;
+ }
+
+private:
+ signed __int8 GetI1()
+ {
+ LIMITED_METHOD_CONTRACT;
+ signed __int8 tmp = *reinterpret_cast<const signed __int8*>(m_pbCur);
+ m_pbCur += sizeof(signed __int8);
+ return tmp;
+ }
+ unsigned __int8 GetU1()
+ {
+ LIMITED_METHOD_CONTRACT;
+ unsigned __int8 tmp = *reinterpret_cast<const unsigned __int8*>(m_pbCur);
+ m_pbCur += sizeof(unsigned __int8);
+ return tmp;
+ }
+
+ signed __int16 GetI2()
+ {
+ LIMITED_METHOD_CONTRACT;
+ signed __int16 tmp = GET_UNALIGNED_VAL16(m_pbCur);
+ m_pbCur += sizeof(signed __int16);
+ return tmp;
+ }
+ unsigned __int16 GetU2()
+ {
+ LIMITED_METHOD_CONTRACT;
+ unsigned __int16 tmp = GET_UNALIGNED_VAL16(m_pbCur);
+ m_pbCur += sizeof(unsigned __int16 );
+ return tmp;
+ }
+
+ signed __int32 GetI4()
+ {
+ LIMITED_METHOD_CONTRACT;
+ signed __int32 tmp = GET_UNALIGNED_VAL32(m_pbCur);
+ m_pbCur += sizeof(signed __int32 );
+ return tmp;
+ }
+ unsigned __int32 GetU4()
+ {
+ LIMITED_METHOD_CONTRACT;
+ unsigned __int32 tmp = GET_UNALIGNED_VAL32(m_pbCur);
+ m_pbCur += sizeof(unsigned __int32 );
+ return tmp;
+ }
+
+ signed __int64 GetI8()
+ {
+ LIMITED_METHOD_CONTRACT;
+ signed __int64 tmp = GET_UNALIGNED_VAL64(m_pbCur);
+ m_pbCur += sizeof(signed __int64 );
+ return tmp;
+ }
+ unsigned __int64 GetU8()
+ {
+ LIMITED_METHOD_CONTRACT;
+ unsigned __int64 tmp = GET_UNALIGNED_VAL64(m_pbCur);
+ m_pbCur += sizeof(unsigned __int64 );
+ return tmp;
+ }
+
+public:
+ float GetR4()
+ {
+ LIMITED_METHOD_CONTRACT;
+ __int32 tmp = GET_UNALIGNED_VAL32(m_pbCur);
+ _ASSERTE(sizeof(__int32) == sizeof(float));
+ m_pbCur += sizeof(float);
+ return (float &)tmp;
+ }
+
+ double GetR8()
+ {
+ LIMITED_METHOD_CONTRACT;
+ __int64 tmp = GET_UNALIGNED_VAL64(m_pbCur);
+ _ASSERTE(sizeof(__int64) == sizeof(double));
+ m_pbCur += sizeof(double);
+ return (double &)tmp;
+ }
+
+private:
+ unsigned __int16 GetProlog()
+ {
+ WRAPPER_NO_CONTRACT;
+ unsigned __int16 val;
+ VERIFY(SUCCEEDED(GetProlog(&val)));
+ return val;
+ }
+
+ LPCUTF8 GetString(ULONG *pcbString)
+ {
+ WRAPPER_NO_CONTRACT;
+ LPCUTF8 val;
+ VERIFY(SUCCEEDED(GetString(&val, pcbString)));
+ return val;
+ }
+
+public:
+ HRESULT GetI1(signed __int8 *pVal)
+ {
+ WRAPPER_NO_CONTRACT;
+
+ if (BytesLeft() < (int) sizeof(signed __int8))
+ return META_E_CA_INVALID_BLOB;
+ *pVal = GetI1();
+ return S_OK;
+ }
+
+ HRESULT GetTag(CorSerializationType *pVal)
+ {
+ WRAPPER_NO_CONTRACT;
+ HRESULT hr;
+ signed __int8 tmp;
+ IfFailRet(GetI1(&tmp));
+ *pVal = (CorSerializationType)((unsigned __int8)tmp);
+ return hr;
+ }
+
+ HRESULT GetU1(unsigned __int8 *pVal)
+ {
+ WRAPPER_NO_CONTRACT;
+
+ if (BytesLeft() < (int) sizeof(unsigned __int8))
+ return META_E_CA_INVALID_BLOB;
+ *pVal = GetU1();
+ return S_OK;
+ }
+
+ HRESULT GetI2(signed __int16 *pVal)
+ {
+ WRAPPER_NO_CONTRACT;
+
+ if (BytesLeft() < (int) sizeof(signed __int16))
+ return META_E_CA_INVALID_BLOB;
+ *pVal = GetI2();
+ return S_OK;
+ }
+ HRESULT GetU2(unsigned __int16 *pVal)
+ {
+ WRAPPER_NO_CONTRACT;
+
+ if (BytesLeft() < (int) sizeof(unsigned __int16))
+ return META_E_CA_INVALID_BLOB;
+ *pVal = GetU2();
+ return S_OK;
+ }
+
+ HRESULT GetI4(signed __int32 *pVal)
+ {
+ WRAPPER_NO_CONTRACT;
+
+ if (BytesLeft() < (int) sizeof(signed __int32))
+ return META_E_CA_INVALID_BLOB;
+ *pVal = GetI4();
+ return S_OK;
+ }
+ HRESULT GetU4(unsigned __int32 *pVal)
+ {
+ WRAPPER_NO_CONTRACT;
+
+ if (BytesLeft() < (int) sizeof(unsigned __int32))
+ return META_E_CA_INVALID_BLOB;
+ *pVal = GetU4();
+ return S_OK;
+ }
+
+ HRESULT GetI8(signed __int64 *pVal)
+ {
+ WRAPPER_NO_CONTRACT;
+
+ if (BytesLeft() < (int) sizeof(signed __int64))
+ return META_E_CA_INVALID_BLOB;
+ *pVal = GetI8();
+ return S_OK;
+ }
+ HRESULT GetU8(unsigned __int64 *pVal)
+ {
+ WRAPPER_NO_CONTRACT;
+
+ if (BytesLeft() < (int) sizeof(unsigned __int64))
+ return META_E_CA_INVALID_BLOB;
+ *pVal = GetU8();
+ return S_OK;
+ }
+
+ HRESULT GetR4(float *pVal)
+ {
+ WRAPPER_NO_CONTRACT;
+
+ if (BytesLeft() < (int) sizeof(float))
+ return META_E_CA_INVALID_BLOB;
+ *pVal = GetR4();
+ return S_OK;
+ }
+ HRESULT GetR8(double *pVal)
+ {
+ WRAPPER_NO_CONTRACT;
+
+ if (BytesLeft() < (int) sizeof(double))
+ return META_E_CA_INVALID_BLOB;
+ *pVal = GetR8();
+ return S_OK;
+ }
+
+ HRESULT GetProlog(unsigned __int16 *pVal)
+ {
+ WRAPPER_NO_CONTRACT;
+
+ m_pbCur = m_pbBlob;
+
+ if (BytesLeft() < (int)(sizeof(BYTE) * 2))
+ return META_E_CA_INVALID_BLOB;
+
+ return GetU2(pVal);
+ }
+
+ // Added for compatibility with anyone that may emit
+ // blobs where the prolog is the only incorrect data.
+ HRESULT SkipProlog()
+ {
+ unsigned __int16 val;
+ return GetProlog(&val);
+ }
+
+ HRESULT ValidateProlog()
+ {
+ HRESULT hr;
+ unsigned __int16 val;
+ IfFailRet(GetProlog(&val));
+
+ if (val != 0x0001)
+ return META_E_CA_INVALID_BLOB;
+
+ return hr;
+ }
+
+ //
+ // IMPORTANT: the returned string is typically not null-terminated.
+ //
+ // This can return any of three distinct valid results:
+ // - NULL string, indicated by *pszString==NULL, *pcbString==0
+ // - empty string, indicated by *pszString!=NULL, *pcbString==0
+ // - non-empty string, indicated by *pdzString!=NULL, *pcbString!=0
+ // If you expect non-null or non-empty strings in your usage scenario,
+ // call the GetNonNullString and GetNonEmptyString helpers below.
+ //
+ HRESULT GetString(LPCUTF8 *pszString, ULONG *pcbString)
+ {
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_FORBID_FAULT;
+
+ HRESULT hr;
+
+ if (BytesLeft() == 0)
+ { // Need to check for NULL string sentinal (see below),
+ // so need to have at least one byte to read.
+ IfFailRet(META_E_CA_INVALID_BLOB);
+ }
+
+ if (*m_pbCur == 0xFF)
+ { // 0xFF indicates the NULL string, which is semantically
+ // different than the empty string.
+ *pszString = NULL;
+ *pcbString = 0;
+ m_pbCur++;
+ return S_OK;
+ }
+
+ // Get the length, pointer to data following the length.
+ return GetData((BYTE const **)pszString, pcbString);
+ }
+
+ //
+ // This can return any of two distinct valid results:
+ // - empty string, indicated by *pszString!=NULL, *pcbString==0
+ // - non-empty string, indicated by *pszString!=NULL, *pcbString!=0
+ // If you expect non-null or non-empty strings in your usage scenario,
+ // call the GetNonNullString and GetNonEmptyString helpers below.
+ //
+ HRESULT GetNonNullString(LPCUTF8 *pszString, ULONG *pcbString)
+ {
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_FORBID_FAULT;
+
+ HRESULT hr;
+
+ IfFailRet(GetString(pszString, pcbString));
+
+ if (*pszString == NULL)
+ {
+ return META_E_CA_INVALID_BLOB;
+ }
+
+ return S_OK;
+ }
+
+ //
+ // This function will only return success if the string is valid,
+ // non-NULL and non-empty; i.e., *pszString!=NULL, *pcbString!=0
+ //
+ HRESULT GetNonEmptyString(LPCUTF8 *pszString, ULONG *pcbString)
+ {
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_FORBID_FAULT;
+
+ HRESULT hr;
+
+ IfFailRet(GetNonNullString(pszString, pcbString));
+
+ if (*pcbString == 0)
+ {
+ return META_E_CA_INVALID_BLOB;
+ }
+
+ return S_OK;
+ }
+
+ // IMPORTANT: do not use with string fetching - use GetString instead.
+ HRESULT GetData(BYTE const **ppbData, ULONG *pcbData)
+ {
+ HRESULT hr;
+ IfFailRet(CPackedLen::SafeGetData(m_pbCur, m_pbBlob + m_cbBlob, pcbData, ppbData));
+ // Move past the data we just recovered
+ m_pbCur = *ppbData + *pcbData;
+
+ return S_OK;
+ }
+
+ // IMPORTANT: do not use with string fetching - use GetString instead.
+ HRESULT GetPackedValue(ULONG *pcbData)
+ {
+ return CPackedLen::SafeGetLength(m_pbCur, m_pbBlob + m_cbBlob, pcbData, &m_pbCur);
+ }
+
+ int BytesLeft()
+ {
+ LIMITED_METHOD_CONTRACT;
+ return (int)(m_cbBlob - (m_pbCur - m_pbBlob));
+ }
+
+private:
+ const BYTE *m_pbCur;
+ const BYTE *m_pbBlob;
+ ULONG m_cbBlob;
+};
+
+#endif // __CAPARSER_H__
diff --git a/src/inc/ceefilegenwriter.h b/src/inc/ceefilegenwriter.h
new file mode 100644
index 0000000000..8bfea464cc
--- /dev/null
+++ b/src/inc/ceefilegenwriter.h
@@ -0,0 +1,245 @@
+// 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.
+// ===========================================================================
+// File: CeeFileGenWriter.h
+//
+// ===========================================================================
+
+#ifndef _CEEFILEGENWRITER_H_
+#define _CEEFILEGENWRITER_H_
+//
+
+// CeeFileGenWriter contains all the code necessary to actually write an exe
+// while CCeeGen contains everything else. This lets CeeGen.exe and the VM
+// share more code without forcing the VM to carry the extra code to write an
+// exe.
+#include <windef.h>
+#include "ceegen.h"
+#include "iceefilegen.h"
+
+class PEWriter;
+class CeeFileGenWriter;
+
+// default setting for PE file
+const UINT32 CEE_IMAGE_BASE_32 = 0x00400000;
+const UINT64 CEE_IMAGE_BASE_64 = UI64(0x0000000140000000);
+const int CEE_IMAGE_SUBSYSTEM_MAJOR_VERSION = 4;
+const int CEE_IMAGE_SUBSYSTEM_MINOR_VERSION = 0;
+
+class CeeFileGenWriter : public CCeeGen
+{
+ mdToken m_entryPoint; // token for entry point
+ DWORD m_comImageFlags;
+
+ LPWSTR m_outputFileName;
+ LPWSTR m_resourceFileName;
+ LPWSTR m_libraryName;
+ GUID m_libraryGuid;
+ bool m_dllSwitch;
+
+ ULONG m_iatOffset;
+ DWORD m_dwMacroDefinitionRVA;
+ DWORD m_dwMacroDefinitionSize;
+
+ DWORD m_dwManifestRVA;
+ DWORD m_dwManifestSize;
+
+ DWORD m_dwStrongNameRVA;
+ DWORD m_dwStrongNameSize;
+
+ DWORD m_dwVTableRVA;
+ DWORD m_dwVTableSize;
+
+ bool m_linked;
+ bool m_fixed;
+
+ HRESULT checkForErrors();
+
+ struct IDataDllInfo {
+ const char *m_name;
+ int m_numMethods;
+ const char **m_methodName;
+ int m_iltOffset;
+ int m_ibnOffset;
+ int m_iatOffset;
+ int m_nameOffset;
+ } *m_iDataDlls;
+ int m_dllCount;
+
+ CeeSection *m_iDataSectionIAT;
+ int m_iDataOffsetIAT;
+ char *m_iDataIAT;
+
+#ifdef EMIT_FIXUPS
+
+ CeeSection * m_sectionFixups;
+ IMAGE_DEBUG_DIRECTORY * m_pDebugDir;
+ bool m_fFixupsUpdated;
+ bool m_fEmitFixups;
+
+#endif
+
+ HRESULT allocateIAT();
+public:
+ // Create with one of these two methods, not operator new
+ static HRESULT CreateNewInstance(CCeeGen *pCeeFileGenFrom, CeeFileGenWriter* & pGenWriter,
+ DWORD createFlags = ICEE_CREATE_FILE_PURE_IL);
+ // See ICeeFileGen.h for the definition of the bits used in createFlags
+ static HRESULT CreateNewInstanceEx(CCeeGen *pCeeFileGenFrom, CeeFileGenWriter* & pGenWriter,
+ DWORD createFlags, LPCWSTR seedFileName = NULL);
+
+ virtual HRESULT Cleanup();
+
+ PEWriter &getPEWriter();
+
+ HRESULT link(); // Layout the sections and assign their starting addresses
+ HRESULT fixup(); // Apply relocations to any pointer data. Also generate PE base relocs
+ HRESULT generateImage(void **ppImage);
+
+ HRESULT setImageBase(size_t imageBase);
+ HRESULT setImageBase64(ULONGLONG imageBase);
+ HRESULT setFileAlignment(ULONG fileAlignment);
+ HRESULT setSubsystem(DWORD subsystem, DWORD major, DWORD minor);
+
+ HRESULT getMethodRVA(ULONG codeOffset, ULONG *codeRVA);
+
+ HRESULT setEntryPoint(mdMethodDef method);
+ mdMethodDef getEntryPoint();
+
+ HRESULT setComImageFlags(DWORD mask);
+ HRESULT clearComImageFlags(DWORD mask);
+ DWORD getComImageFlags();
+
+ HRESULT setOutputFileName(__in LPWSTR outputFileName);
+ LPWSTR getOutputFileName();
+
+ HRESULT setResourceFileName(__in LPWSTR resourceFileName);
+ LPWSTR getResourceFileName();
+
+ HRESULT setLibraryName(__in LPWSTR libraryName);
+ LPWSTR getLibraryName();
+
+ HRESULT setDirectoryEntry(CeeSection &section, ULONG entry, ULONG size, ULONG offset=0);
+ HRESULT computeSectionOffset(CeeSection &section, __in char *ptr,
+ unsigned *offset);
+ HRESULT computeOffset(__in char *ptr, CeeSection **pSection,
+ unsigned *offset);
+ HRESULT getCorHeader(IMAGE_COR20_HEADER **ppHeader);
+
+ HRESULT getFileTimeStamp(DWORD *pTimeStamp);
+
+//<TODO>@FUTURE: this entry point is only here so that down level clients of this interface
+// can import the method by name in the exports table using the original name.
+// These things really ought to be exported through a v-table so there is no
+// name mangling issues. It would make the export table much smaller as well.</TODO>
+ HRESULT emitLibraryName(IMetaDataEmit *emitter);
+ HRESULT setLibraryGuid(__in LPWSTR libraryGuid);
+
+ HRESULT setDllSwitch(bool dllSwitch);
+ bool getDllSwitch();
+ HRESULT setObjSwitch(bool objSwitch);
+ bool getObjSwitch();
+ HRESULT EmitMacroDefinitions(void *pData, DWORD cData);
+ HRESULT setManifestEntry(ULONG size, ULONG offset);
+ HRESULT setStrongNameEntry(ULONG size, ULONG offset);
+ HRESULT setEnCRvaBase(ULONG dataBase, ULONG rdataBase);
+ HRESULT setVTableEntry(ULONG size, ULONG offset);
+ HRESULT setVTableEntry64(ULONG size, void* ptr);
+
+protected:
+ CeeFileGenWriter(); // ctor is protected
+
+ HRESULT emitResourceSection();
+ HRESULT emitExeMain();
+
+ HRESULT setAddrReloc(UCHAR *instrAddr, DWORD value);
+ HRESULT addAddrReloc(CeeSection &thisSection, UCHAR *instrAddr, DWORD offset, CeeSection *targetSection);
+
+ HRESULT MapTokens(CeeGenTokenMapper *pMapper, IMetaDataImport *pImport);
+ HRESULT MapTokensForMethod(CeeGenTokenMapper *pMapper,BYTE *pCode, LPCWSTR szMethodName);
+
+#ifdef EMIT_FIXUPS
+
+ HRESULT InitFixupSection();
+ HRESULT UpdateFixups();
+ HRESULT setEmitFixups();
+
+#ifdef TEST_EMIT_FIXUPS
+ HRESULT TestEmitFixups();
+#endif
+
+public:
+ HRESULT addFixup(CeeSection& secFixups, unsigned offset, CeeSectionRelocType reloc, CeeSection * relativeTo = NULL, CeeSectionRelocExtra *extra = 0);
+#endif
+};
+
+
+inline PEWriter &CeeFileGenWriter::getPEWriter()
+{
+ return (PEWriter &) *m_peSectionMan;
+}
+
+inline LPWSTR CeeFileGenWriter::getOutputFileName() {
+ return m_outputFileName;
+}
+
+inline LPWSTR CeeFileGenWriter::getResourceFileName() {
+ return m_resourceFileName;
+}
+
+inline HRESULT CeeFileGenWriter::setDllSwitch(bool dllSwitch) {
+ if((m_dllSwitch = dllSwitch)) m_objSwitch = FALSE; return S_OK;
+}
+
+inline bool CeeFileGenWriter::getDllSwitch() {
+ return m_dllSwitch;
+}
+
+inline HRESULT CeeFileGenWriter::setObjSwitch(bool objSwitch) {
+ if((m_objSwitch = objSwitch)) m_dllSwitch = FALSE; return S_OK;
+}
+
+inline bool CeeFileGenWriter::getObjSwitch() {
+ return m_objSwitch;
+}
+
+inline LPWSTR CeeFileGenWriter::getLibraryName() {
+ return m_libraryName;
+}
+
+inline mdMethodDef CeeFileGenWriter::getEntryPoint() {
+ return m_entryPoint;
+}
+
+inline HRESULT CeeFileGenWriter::setEntryPoint(mdMethodDef method) {
+ m_entryPoint = method;
+ return S_OK;
+}
+
+inline HRESULT CeeFileGenWriter::setComImageFlags(DWORD mask) {
+ m_comImageFlags |= mask; return S_OK;
+}
+
+inline HRESULT CeeFileGenWriter::clearComImageFlags(DWORD mask) {
+ m_comImageFlags &= ~mask; return S_OK;
+}
+
+inline DWORD CeeFileGenWriter::getComImageFlags() {
+ return m_comImageFlags;
+}
+
+
+//
+#if defined(_IMAGE_FILE_4K_SECTION_ALIGNMENT_)
+#define IMAGE_NT_OPTIONAL_HDR_SECTION_ALIGNMENT 0x1000
+#else
+#define IMAGE_NT_OPTIONAL_HDR_SECTION_ALIGNMENT 0x2000
+#endif
+
+// The stub is always x86 so we always mark the image as x86
+#define IMAGE_FILE_MACHINE IMAGE_FILE_MACHINE_I386
+
+
+#endif // _CEEFILEGENWRITER_H_
+
diff --git a/src/inc/ceegen.h b/src/inc/ceegen.h
new file mode 100644
index 0000000000..a2dfadfc00
--- /dev/null
+++ b/src/inc/ceegen.h
@@ -0,0 +1,440 @@
+// 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.
+// ===========================================================================
+// File: CEEGEN.H
+//
+// ===========================================================================
+
+#ifndef _CEEGEN_H_
+#define _CEEGEN_H_
+
+#include "cor.h"
+#include "iceefilegen.h"
+#include "ceegentokenmapper.h"
+
+class CeeSection;
+class CeeSectionString;
+class CCeeGen;
+class PESectionMan;
+class PESection;
+
+typedef DWORD StringRef;
+
+#if 0
+
+ This is a description of the current implementation of these types for generating
+ CLR modules.
+
+ ICeeGen - interface to generate in-memory CLR module.
+
+ CCeeGen - implementation of ICeeGen. Currently it uses both CeeSections
+ as well as PESections (inside PESectionMan), and maintains a
+ 1:1 relation between them. This is ugly.
+
+ CeeFileGenWriter - Provides functionality to write in-memory module to
+ PE format file. Uses PEWriter (m_pSectionMan) for
+ file-writing functionality
+
+ PEWriter - It can generate a PE format file. It also knows to apply
+ pointer relocs when it lays out the PESections.
+
+
+ ICeeFileGen - Interface used by compilers, ngen, etc, to generate
+ a CLR file.
+ Has a bunch of methods to emit signatures, tokens, methods,
+ etc which are not implemented. These are left over from before
+
+ CeeFileGenWriter, PEWriter and ICeeFileGen are implemented in mscorpe.dll.
+ The other types live in mscorwks.dll (src\md\CeeFileGen)
+
+ +----------------------------+
+ | ICeeGen |
+ | |
+ | COM-style version of |
+ | ICeeFileGen. HCEEFILE is |
+ | replaced with "this" |
+ +-------------------------+ | |
+ | CeeSectionImpl | +----------------------------+
+ +-------------------------+ |
+ | | |
+ | | v
+ | v +---------------------------+
+ | +------------+ | CCeeGen |
+ | | | +---------------------------+
+ | | CeeSection | contains | |
+ | | |<-------------| CeeSection* m_sections |
+ | +------------+ | |
+ | /| PESectionMan m_pSectionMan|
+ | / | |
+ | +-----------------+ / +---------------------------+
+ v | PESectionMan |<----+ |
+ +-----------+ | | contains |
+ | PESection | +-----------------+ |
+ | | contains | PESection * | v
+ | |<----------| sectStart, | +------------------------------+
+ +-----------+ | sectCur, | | CeeFileGenWriter |
+ | sectEnd | +------------------------------+
+ +-----------------+ | Does meta-data specific |
+ | | stuff and then dispatches to |
+ | | m_pSectionMan.PEWriter::***()|
+ | | |
+ v +------------------------------+
+ +------------------------+ ^
+ | PEWriter | |wraps
+ +------------------------+ |
+ | Low -level file writer | +----------------------------+
+ | Knows how to do | | ICeeFileGen |
+ | pointer relocs | | |
+ | | | C-style inteface. Deals |
+ +------------------------+ | with HCEEFILE, HCEESECTION |
+ | etc. It is mostly just a |
+ | thin wrapper for a |
+ | CeeFileGenWriter |
+ +----------------------------+
+
+#endif // 0
+
+// ***** CeeSection classes
+
+class CeeSectionImpl {
+ public:
+ virtual unsigned dataLen() = 0;
+ virtual char * getBlock(
+ unsigned len,
+ unsigned align = 1) = 0;
+ virtual HRESULT addSectReloc(
+ unsigned offset,
+ CeeSection & relativeTo,
+ CeeSectionRelocType reloc = srRelocAbsolute,
+ CeeSectionRelocExtra * extra = NULL) = 0;
+ virtual HRESULT addBaseReloc(
+ unsigned offset,
+ CeeSectionRelocType reloc = srRelocHighLow,
+ CeeSectionRelocExtra * extra = NULL) = 0;
+ virtual HRESULT directoryEntry(unsigned num) = 0;
+ virtual unsigned char * name() = 0;
+ virtual char * computePointer(unsigned offset) const = 0;
+ virtual BOOL containsPointer(__in char * ptr) const = 0;
+ virtual unsigned computeOffset(__in char * ptr) const = 0;
+ virtual unsigned getBaseRVA() = 0;
+ virtual void SetInitialGrowth(unsigned growth) = 0;
+};
+
+class CeeSection {
+ // m_ceeFile allows inter-section communication
+ CCeeGen &m_ceeFile;
+
+ // abstract away implementation to allow inheritance from CeeSection
+ CeeSectionImpl &m_impl;
+
+ public:
+ enum RelocFlags {
+ RELOC_NONE = 0,
+
+ // address should be fixed up to be a RVA not a normal address
+ RELOC_RVA = 1
+ };
+
+ CeeSection(CCeeGen &ceeFile, CeeSectionImpl &impl)
+ : m_ceeFile(ceeFile), m_impl(impl) { LIMITED_METHOD_CONTRACT; }
+
+ virtual ~CeeSection() {LIMITED_METHOD_CONTRACT; }
+
+ // bytes in this section at present
+ unsigned dataLen();
+
+ // section base, after linking
+ unsigned getBaseRVA();
+
+ // get a block to write on (use instead of write to avoid copy)
+ char* getBlock(unsigned len, unsigned align=1);
+
+ // Indicates that the DWORD at 'offset' in the current section should
+ // have the base of section 'relativeTo added to it
+ HRESULT addSectReloc(unsigned offset, CeeSection& relativeTo,
+ CeeSectionRelocType = srRelocAbsolute, CeeSectionRelocExtra *extra = 0);
+ // Add a base reloc for the given offset in the current section
+ virtual HRESULT addBaseReloc(unsigned offset, CeeSectionRelocType reloc = srRelocHighLow, CeeSectionRelocExtra *extra = 0);
+
+
+ // this section will be directory entry 'num'
+ HRESULT directoryEntry(unsigned num);
+
+ // return section name
+ unsigned char *name();
+
+ // simulate the base + offset with a more complex data storage
+ char * computePointer(unsigned offset) const;
+ BOOL containsPointer(__in char *ptr) const;
+ unsigned computeOffset(__in char *ptr) const;
+
+ CeeSectionImpl &getImpl();
+ CCeeGen &ceeFile();
+ void SetInitialGrowth(unsigned growth);
+};
+
+// ***** CCeeGen class
+// Only handles in memory stuff
+// Base class for CeeFileGenWriter (which actually generates PEFiles)
+
+class CCeeGen : public ICeeGen, ICeeGenInternal {
+ LONG m_cRefs;
+ BOOL m_encMode;
+ protected:
+ short m_textIdx; // m_sections[] index for the .text section
+ short m_metaIdx; // m_sections[] index for metadata (.text, or .cormeta for obj files)
+ short m_corHdrIdx; // m_sections[] index for the COM+ header (.text0)
+ short m_stringIdx; // m_sections[] index for strings (.text, or .rdata for EnC)
+ short m_ilIdx; // m_sections[] index for IL (.text)
+ bool m_objSwitch;
+
+ CeeGenTokenMapper *m_pTokenMap;
+ BOOLEAN m_fTokenMapSupported; // temporary to support both models
+ IMapToken *m_pRemapHandler;
+
+ CeeSection **m_sections;
+ short m_numSections;
+ short m_allocSections;
+
+ PESectionMan * m_peSectionMan;
+
+ IMAGE_COR20_HEADER *m_corHeader;
+ DWORD m_corHeaderOffset;
+
+ HRESULT allocateCorHeader();
+
+ HRESULT addSection(CeeSection *section, short *sectionIdx);
+
+ HRESULT setEnCMode();
+
+// Init process: Call static CreateNewInstance() , not operator new
+ protected:
+ HRESULT Init();
+ CCeeGen();
+
+ public:
+
+ virtual ~CCeeGen() {}
+
+ static HRESULT CreateNewInstance(CCeeGen* & pCeeFileGen); // call this to instantiate
+
+ virtual HRESULT Cleanup();
+
+ // ICeeGen interfaces
+
+ ULONG STDMETHODCALLTYPE AddRef();
+ ULONG STDMETHODCALLTYPE Release();
+ STDMETHODIMP QueryInterface(
+ REFIID riid,
+ void **ppInterface);
+
+ STDMETHODIMP EmitString (
+ __in LPWSTR lpString, // [IN] String to emit
+ ULONG *RVA);
+
+ STDMETHODIMP GetString (
+ ULONG RVA,
+ __inout LPWSTR *lpString);
+
+ STDMETHODIMP AllocateMethodBuffer (
+ ULONG cchBuffer, // [IN] Length of string to emit
+ UCHAR **lpBuffer, // [OUT] Returned buffer
+ ULONG *RVA);
+
+ STDMETHODIMP GetMethodBuffer (
+ ULONG RVA,
+ UCHAR **lpBuffer);
+
+ STDMETHODIMP GetIMapTokenIface (
+ IUnknown **pIMapToken);
+
+ STDMETHODIMP GenerateCeeFile ();
+
+ STDMETHODIMP GetIlSection (
+ HCEESECTION *section);
+
+ STDMETHODIMP GetStringSection (
+ HCEESECTION *section);
+
+ STDMETHODIMP AddSectionReloc (
+ HCEESECTION section,
+ ULONG offset,
+ HCEESECTION relativeTo,
+ CeeSectionRelocType relocType);
+
+ STDMETHODIMP GetSectionCreate (
+ const char *name,
+ DWORD flags,
+ HCEESECTION *section);
+
+ STDMETHODIMP GetSectionDataLen (
+ HCEESECTION section,
+ ULONG *dataLen);
+
+ STDMETHODIMP GetSectionBlock (
+ HCEESECTION section,
+ ULONG len,
+ ULONG align=1,
+ void **ppBytes=0);
+
+ STDMETHODIMP TruncateSection (
+ HCEESECTION section,
+ ULONG len);
+
+ STDMETHODIMP GenerateCeeMemoryImage (void **ppImage);
+
+ STDMETHODIMP ComputePointer (
+ HCEESECTION section,
+ ULONG RVA, // [IN] RVA for method to return
+ UCHAR **lpBuffer); // [OUT] Returned buffer
+
+
+ STDMETHODIMP AddNotificationHandler(IUnknown *pHandler);
+
+ // Write the metadata in "emitter" to the default metadata section is "section" is 0
+ // If 'section != 0, it will put the data in 'buffer'. This
+ // buffer is assumed to be in 'section' at 'offset' and of size 'buffLen'
+ // (should use GetSaveSize to insure that buffer is big enough
+ virtual HRESULT emitMetaData(IMetaDataEmit *emitter,
+ CeeSection* section=0, DWORD offset=0, BYTE* buffer=0, unsigned buffLen=0);
+ virtual HRESULT getMethodRVA(ULONG codeOffset, ULONG *codeRVA);
+
+ STDMETHODIMP SetInitialGrowth(DWORD growth);
+
+ CeeSection &getTextSection();
+ CeeSection &getMetaSection();
+ CeeSection &getCorHeaderSection();
+ CeeSectionString &getStringSection();
+ CeeSection &getIlSection();
+
+ virtual HRESULT getSectionCreate (const char *name, DWORD flags, CeeSection **section=NULL, short *sectionIdx = NULL);
+
+ PESectionMan* getPESectionMan() {
+ LIMITED_METHOD_CONTRACT;
+ return m_peSectionMan;
+ }
+
+ virtual HRESULT getMapTokenIface(IUnknown **pIMapToken, IMetaDataEmit *emitter=0);
+
+ CeeGenTokenMapper *getTokenMapper() {
+ LIMITED_METHOD_CONTRACT;
+ return m_pTokenMap;
+ }
+
+ virtual HRESULT addNotificationHandler(IUnknown *pHandler);
+
+ //Clone is actually a misnomer here. This method will copy all of the
+ //instance variables and then do a deep copy (as necessary) of the sections.
+ //Section data will be appended onto any information already in the section.
+ //This is done to support the DynamicIL -> PersistedIL transform.
+ virtual HRESULT cloneInstance(CCeeGen *destination);
+
+#ifdef EMIT_FIXUPS
+public:
+ virtual HRESULT addFixup(CeeSection& sectionSource, unsigned offset, CeeSectionRelocType reloc, CeeSection * sectionTarget = NULL, CeeSectionRelocExtra *extra = 0) {
+ LIMITED_METHOD_CONTRACT;
+
+ return(E_NOTIMPL);
+ }
+#endif
+};
+
+// ***** CeeSection inline methods
+
+inline unsigned CeeSection::dataLen() {
+ WRAPPER_NO_CONTRACT;
+ return m_impl.dataLen(); }
+
+inline unsigned CeeSection::getBaseRVA() {
+ WRAPPER_NO_CONTRACT;
+ return m_impl.getBaseRVA(); }
+
+inline char *CeeSection::getBlock(unsigned len, unsigned align) {
+ WRAPPER_NO_CONTRACT;
+ return m_impl.getBlock(len, align); }
+
+inline HRESULT CeeSection::addSectReloc(
+ unsigned offset, CeeSection& relativeTo, CeeSectionRelocType reloc, CeeSectionRelocExtra *extra) {
+ WRAPPER_NO_CONTRACT;
+ return(m_impl.addSectReloc(offset, relativeTo, reloc, extra));
+}
+
+inline HRESULT CeeSection::addBaseReloc(unsigned offset, CeeSectionRelocType reloc, CeeSectionRelocExtra *extra) {
+ WRAPPER_NO_CONTRACT;
+ return(m_impl.addBaseReloc(offset, reloc, extra));
+}
+
+
+inline HRESULT CeeSection::directoryEntry(unsigned num) {
+ WRAPPER_NO_CONTRACT;
+ TESTANDRETURN(num < IMAGE_NUMBEROF_DIRECTORY_ENTRIES, E_INVALIDARG);
+ m_impl.directoryEntry(num);
+ return S_OK;
+}
+
+inline CCeeGen &CeeSection::ceeFile() {
+ LIMITED_METHOD_CONTRACT;
+ return m_ceeFile; }
+
+inline CeeSectionImpl &CeeSection::getImpl() {
+ LIMITED_METHOD_CONTRACT;
+ return m_impl; }
+
+inline unsigned char *CeeSection::name() {
+ WRAPPER_NO_CONTRACT;
+ return m_impl.name();
+}
+
+inline char * CeeSection::computePointer(unsigned offset) const
+{
+ WRAPPER_NO_CONTRACT;
+ return m_impl.computePointer(offset);
+}
+
+inline BOOL CeeSection::containsPointer(__in char *ptr) const
+{
+ WRAPPER_NO_CONTRACT;
+ return m_impl.containsPointer(ptr);
+}
+
+inline unsigned CeeSection::computeOffset(__in char *ptr) const
+{
+ WRAPPER_NO_CONTRACT;
+ return m_impl.computeOffset(ptr);
+}
+
+inline void CeeSection::SetInitialGrowth(unsigned growth)
+{
+ WRAPPER_NO_CONTRACT;
+ m_impl.SetInitialGrowth(growth);
+}
+
+// ***** CCeeGen inline methods
+
+inline CeeSection &CCeeGen::getTextSection() {
+ LIMITED_METHOD_CONTRACT;
+
+ return *m_sections[m_textIdx]; }
+
+inline CeeSection &CCeeGen::getMetaSection() {
+ LIMITED_METHOD_CONTRACT;
+
+ return *m_sections[m_metaIdx]; }
+
+inline CeeSection &CCeeGen::getCorHeaderSection() {
+ LIMITED_METHOD_CONTRACT;
+ _ASSERTE(m_corHdrIdx >= 0);
+ return *m_sections[m_corHdrIdx]; }
+
+inline CeeSectionString &CCeeGen::getStringSection() {
+ LIMITED_METHOD_CONTRACT;
+
+ return *(CeeSectionString*)m_sections[m_stringIdx]; }
+
+inline CeeSection &CCeeGen::getIlSection() {
+ LIMITED_METHOD_CONTRACT;
+
+ return *m_sections[m_ilIdx]; }
+
+#endif
diff --git a/src/inc/ceegentokenmapper.h b/src/inc/ceegentokenmapper.h
new file mode 100644
index 0000000000..a2312a036c
--- /dev/null
+++ b/src/inc/ceegentokenmapper.h
@@ -0,0 +1,142 @@
+// 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.
+//*****************************************************************************
+// CeeGenTokenMapper.h
+//
+// This helper class tracks mapped tokens from their old value to the new value
+// which can happen when the data is optimized on save.
+//
+//*****************************************************************************
+
+#ifndef __CeeGenTokenMapper_h__
+#define __CeeGenTokenMapper_h__
+
+#include "utilcode.h"
+
+typedef CDynArray<mdToken> TOKENMAP;
+
+#define INDEX_OF_TYPE(type) ((type) >> 24)
+//r#define INDEX_FROM_TYPE(type) case INDEX_OF_TYPE(mdt ## type): return (tkix ## type)
+
+// Define the list of CeeGen tracked tokens
+#define CEEGEN_TRACKED_TOKENS() \
+ CEEGEN_TRACKED_TOKEN(TypeDef) \
+ CEEGEN_TRACKED_TOKEN(InterfaceImpl) \
+ CEEGEN_TRACKED_TOKEN(MethodDef) \
+ CEEGEN_TRACKED_TOKEN(TypeRef) \
+ CEEGEN_TRACKED_TOKEN(MemberRef) \
+ CEEGEN_TRACKED_TOKEN(CustomAttribute) \
+ CEEGEN_TRACKED_TOKEN(FieldDef) \
+ CEEGEN_TRACKED_TOKEN(ParamDef) \
+ CEEGEN_TRACKED_TOKEN(File) \
+ CEEGEN_TRACKED_TOKEN(GenericParam) \
+
+class CCeeGen;
+
+#define CEEGEN_TRACKED_TOKEN(x) tkix ## x,
+
+class CeeGenTokenMapper : public IMapToken
+{
+friend class CCeeGen;
+friend class PESectionMan;
+public:
+ enum
+ {
+ CEEGEN_TRACKED_TOKENS()
+ MAX_TOKENMAP
+ };
+
+ static int IndexForType(mdToken tk);
+
+ CeeGenTokenMapper() : m_pIImport(0), m_cRefs(1), m_pIMapToken(NULL) { LIMITED_METHOD_CONTRACT; }
+ virtual ~CeeGenTokenMapper() {}
+
+//*****************************************************************************
+// IUnknown implementation.
+//*****************************************************************************
+ virtual ULONG __stdcall AddRef()
+ {LIMITED_METHOD_CONTRACT; return ++m_cRefs; }
+
+ virtual ULONG __stdcall Release()
+ {
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_FORBID_FAULT;
+ SUPPORTS_DAC_HOST_ONLY;
+
+ ULONG cRefs = --m_cRefs;
+ if (cRefs == 0)
+ {
+ if (m_pIMapToken)
+ {
+ m_pIMapToken->Release();
+ m_pIMapToken = NULL;
+ }
+
+ delete this;
+ }
+ return cRefs;
+ }
+
+ virtual HRESULT __stdcall QueryInterface(REFIID iid, PVOID *ppIUnk);
+
+//*****************************************************************************
+// Called by the meta data engine when a token is remapped to a new location.
+// This value is recorded in the m_rgMap array based on type and rid of the
+// from token value.
+//*****************************************************************************
+ virtual HRESULT __stdcall Map(mdToken tkImp, mdToken tkEmit);
+
+//*****************************************************************************
+// Check the given token to see if it has moved to a new location. If so,
+// return true and give back the new token.
+//*****************************************************************************
+ virtual int HasTokenMoved(mdToken tkFrom, mdToken &tkTo);
+
+ int GetMaxMapSize() const
+ { LIMITED_METHOD_CONTRACT; return (MAX_TOKENMAP); }
+
+ IUnknown *GetMapTokenIface() const
+ { LIMITED_METHOD_CONTRACT; return ((IUnknown *) this); }
+
+
+//*****************************************************************************
+// Hand out a copy of the meta data information.
+//*****************************************************************************
+ virtual HRESULT GetMetaData(IMetaDataImport **ppIImport);
+
+//*****************************************************************************
+// Add another token mapper.
+//*****************************************************************************
+ virtual HRESULT AddTokenMapper(IMapToken *pIMapToken)
+ {
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_FORBID_FAULT;
+
+ // Add the token mapper, if there isn't already one.
+ if (m_pIMapToken == NULL)
+ {
+ m_pIMapToken = pIMapToken;
+ m_pIMapToken->AddRef();
+ return S_OK;
+ }
+ else
+ {
+ _ASSERTE(!"Token mapper already set!");
+ return E_FAIL;
+ }
+ }
+
+protected:
+// m_rgMap is an array indexed by token type. For each type, an array of
+// tokens is kept, indexed by from rid. To see if a token has been moved,
+// do a lookup by type to get the right array, then use the from rid to
+// find the to rid.
+ TOKENMAP m_rgMap[MAX_TOKENMAP];
+ IMetaDataImport *m_pIImport;
+ ULONG m_cRefs; // Ref count.
+ IMapToken *m_pIMapToken;
+
+};
+
+#endif // __CeeGenTokenMapper_h__
diff --git a/src/inc/ceesectionstring.h b/src/inc/ceesectionstring.h
new file mode 100644
index 0000000000..06a534a0c1
--- /dev/null
+++ b/src/inc/ceesectionstring.h
@@ -0,0 +1,55 @@
+// 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.
+// ===========================================================================
+// File: CeeSectionString.h
+//
+// ===========================================================================
+
+#ifndef CeeSectionString_H
+#define CeeSectionString_H
+
+#include <ole2.h>
+#include "ceegen.h"
+
+// This class is responsible for managing all the strings that have
+// been emitted for the PE file.
+
+// This class manages the strings that are added to the .rdata section.
+// It keeps track of each string that has been added using a hashtable.
+// The hash table is effectively 2-dimensional. There is a large "virtual
+// hash space" that is used to get a wide hash code distribution. The
+// virtual hash space is mapped into a real hash table where each n
+// hash values in the virtual space fall into a given hash bucket for
+// real hash table size n. Within the bucket, elements are stored in a linked
+// list in-order. When an virtual hash entry corresponds to a given bucket,
+// that bucket is searched for the matching hash id. If not found, it is
+// inserted, otherwise, the value is returned. The idea is that for smaller
+// apps, there won't be a large number of strings, so that collisions are
+// minimal and the length of each bucket's chain is small. For larger
+// numbers of strings, having a large hash space also reduces numbers
+// of collisions, avoiding string compares unless the hash codes match.
+
+struct StringTableEntry;
+
+class CeeSectionString : public CeeSection {
+ enum { MaxRealEntries = 100, MaxVirtualEntries = 10000 };
+ StringTableEntry *stringTable[MaxRealEntries];
+
+ StringTableEntry *createEntry(__in_z LPWSTR target, ULONG hashId);
+ StringTableEntry *findStringInsert(
+ StringTableEntry *&entry, __in_z LPWSTR targetValue, ULONG hashId);
+ void deleteEntries(StringTableEntry *e);
+#ifdef RDATA_STATS
+ int dumpEntries(StringTableEntry *e);
+ void dumpTable();
+#endif
+
+ public:
+ ~CeeSectionString();
+ CeeSectionString(CCeeGen &ceeFile, CeeSectionImpl &impl);
+ virtual HRESULT getEmittedStringRef(__in_z LPWSTR targetValue, StringRef *ref);
+};
+
+#endif
+
diff --git a/src/inc/cfi.h b/src/inc/cfi.h
new file mode 100644
index 0000000000..d5d77840ec
--- /dev/null
+++ b/src/inc/cfi.h
@@ -0,0 +1,33 @@
+// 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.
+
+#ifndef CFI_H_
+#define CFI_H_
+
+#define DWARF_REG_ILLEGAL -1
+enum CFI_OPCODE
+{
+ CFI_ADJUST_CFA_OFFSET, // Offset is adjusted relative to the current one.
+ CFI_DEF_CFA_REGISTER, // New register is used to compute CFA
+ CFI_REL_OFFSET // Register is saved at offset from the current CFA
+};
+
+struct CFI_CODE
+{
+ unsigned char CodeOffset;// Offset from the start of code the frame covers.
+ unsigned char CfiOpCode;
+ short DwarfReg; // Dwarf register number. 0~32 for x64.
+ int Offset;
+ CFI_CODE(unsigned char codeOffset, unsigned char cfiOpcode,
+ short dwarfReg, int offset)
+ : CodeOffset(codeOffset)
+ , CfiOpCode(cfiOpcode)
+ , DwarfReg(dwarfReg)
+ , Offset(offset)
+ {}
+};
+typedef CFI_CODE* PCFI_CODE;
+
+#endif // CFI_H
+
diff --git a/src/inc/check.h b/src/inc/check.h
new file mode 100644
index 0000000000..b1fdba9211
--- /dev/null
+++ b/src/inc/check.h
@@ -0,0 +1,734 @@
+// 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.
+// ---------------------------------------------------------------------------
+// Check.h
+//
+
+//
+// Assertion checking infrastructure
+// ---------------------------------------------------------------------------
+
+
+#ifndef CHECK_H_
+#define CHECK_H_
+
+#include "static_assert.h"
+#include "daccess.h"
+
+#ifdef _DEBUG
+
+#ifdef _MSC_VER
+// Make sure we can recurse deep enough for FORCEINLINE
+#pragma inline_recursion(on)
+#pragma inline_depth(16)
+#pragma warning(disable:4714)
+#endif // _MSC_VER
+
+#if !defined(DISABLE_CONTRACTS)
+#define CHECK_INVARIANTS 1
+#define VALIDATE_OBJECTS 1
+#endif
+
+#endif // _DEBUG
+
+#if defined(_DEBUG) && !defined(DACCESS_COMPILE)
+#define _DEBUG_IMPL 1
+#endif
+
+#ifdef _DEBUG
+#define DEBUG_ARG(x) , x
+#else
+#define DEBUG_ARG(x)
+#endif
+
+#define CHECK_STRESS 1
+
+//--------------------------------------------------------------------------------
+// A CHECK is an object which encapsulates a potential assertion
+// failure. It not only contains the result of the check, but if the check fails,
+// also records information about the condition and call site.
+//
+// CHECK also serves as a holder to prevent recursive CHECKS. These can be
+// particularly common when putting preconditions inside predicates, especially
+// routines called by an invariant.
+//
+// Note that using CHECK is perfectly efficient in a free build - the CHECK becomes
+// a simple string constant pointer (typically either NULL or (LPCSTR)1, although some
+// check failures may include messages)
+//
+// NOTE: you should NEVER use the CHECK class API directly - use the macros below.
+//--------------------------------------------------------------------------------
+
+class SString;
+
+class CHECK
+{
+protected:
+ // On retail, this is a pointer to a string literal, null or (LPCSTR)1.
+ // On debug, this is a pointer to dynamically allocated memory - that
+ // lets us have formatted strings in debug builds.
+ LPCSTR m_message;
+
+#ifdef _DEBUG
+ LPCSTR m_condition;
+ LPCSTR m_file;
+ INT m_line;
+ LONG *m_pCount;
+
+ // Keep leakage counters.
+ static size_t s_cLeakedBytes;
+ static size_t s_cNumFailures;
+#endif
+
+ static BOOL s_neverEnforceAsserts;
+
+public: // !!! NOTE: Called from macros only!!!
+
+ // If we are not in a check, return TRUE and PushCheck; otherwise return FALSE
+ BOOL EnterAssert();
+
+ // Pops check count
+ void LeaveAssert();
+
+ // Just return if we are in a check
+ BOOL IsInAssert();
+
+ // Should we skip enforcing asserts
+ static BOOL EnforceAssert();
+
+ static BOOL EnforceAssert_StaticCheckOnly();
+
+ static void ResetAssert();
+
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable:4702) // Disable bogus unreachable code warning
+#endif // _MSC_VER
+ CHECK() : m_message(NULL)
+#ifdef _DEBUG
+ , m_condition (NULL)
+ , m_file(NULL)
+ , m_line(NULL)
+ , m_pCount(NULL)
+#endif
+ {}
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif // _MSC_VER
+
+ // Fail records the result of a condition check. Can take either a
+ // boolean value or another check result
+ BOOL Fail(BOOL condition);
+ BOOL Fail(const CHECK &check);
+
+ // Setup records context info after a failure.
+ void Setup(LPCSTR message DEBUG_ARG(LPCSTR condition) DEBUG_ARG(LPCSTR file) DEBUG_ARG(INT line));
+ static LPCSTR FormatMessage(LPCSTR messageFormat, ...);
+
+ // Trigger triggers the actual check failure. The trigger may provide a reason
+ // to include in the failure message.
+ void Trigger(LPCSTR reason);
+
+ // Finally, convert to a BOOL to allow just testing the result of a Check function
+ operator BOOL();
+
+ BOOL operator!();
+
+ CHECK &operator()() { return *this; }
+
+ static inline const CHECK OK() {
+ return CHECK();
+ }
+
+ static void SetAssertEnforcement(BOOL value);
+
+ static void ReleaseTls(void* pCountTLS);
+
+ private:
+ static LONG* InitTls();
+#ifdef _DEBUG
+ static LPCSTR AllocateDynamicMessage(const SString &s);
+#endif
+};
+
+
+//--------------------------------------------------------------------------------
+// These CHECK macros are the correct way to propagate an assertion. These
+// routines are designed for use inside "Check" routines. Such routines may
+// be Invariants, Validate routines, or any other assertional predicates.
+//
+// A Check routine should return a value of type CHECK.
+//
+// It should consist of multiple CHECK or CHECK_MSG statements (along with appropritate
+// control flow) and should end with CHECK_OK() if all other checks pass.
+//
+// It may contain a CONTRACT_CHECK contract, but this is only appropriate if the
+// check is used for non-assertional purposes (otherwise the contract will never execute).
+// Note that CONTRACT_CHECK contracts do not support postconditions.
+//
+// CHECK: Check the given condition, return a CHECK failure if FALSE
+// CHECK_MSG: Same, but include a message paramter if the check fails
+// CHECK_OK: Return a successful check value;
+//--------------------------------------------------------------------------------
+
+#ifdef _DEBUG
+#define DEBUG_ONLY_MESSAGE(msg) msg
+#else
+// On retail, we don't want to add a bunch of string literals to the image,
+// so we just use the same one everywhere.
+#define DEBUG_ONLY_MESSAGE(msg) ((LPCSTR)1)
+#endif
+
+#define CHECK_MSG_EX(_condition, _message, _RESULT) \
+do \
+{ \
+ CHECK _check; \
+ if (_check.Fail(_condition)) \
+ { \
+ ENTER_DEBUG_ONLY_CODE; \
+ _check.Setup(DEBUG_ONLY_MESSAGE(_message) \
+ DEBUG_ARG(#_condition) \
+ DEBUG_ARG(__FILE__) \
+ DEBUG_ARG(__LINE__)); \
+ _RESULT(_check); \
+ LEAVE_DEBUG_ONLY_CODE; \
+ } \
+} while (0)
+
+#define RETURN_RESULT(r) return r
+
+#define CHECK_MSG(_condition, _message) \
+ CHECK_MSG_EX(_condition, _message, RETURN_RESULT)
+
+#define CHECK(_condition) \
+ CHECK_MSG(_condition, "")
+
+#define CHECK_MSGF(_condition, _args) \
+ CHECK_MSG(_condition, CHECK::FormatMessage _args)
+
+#define CHECK_FAIL(_message) \
+ CHECK_MSG(FALSE, _message); UNREACHABLE()
+
+#define CHECK_FAILF(_args) \
+ CHECK_MSGF(FALSE, _args); UNREACHABLE()
+
+#define CHECK_OK \
+ return CHECK::OK()
+
+//--------------------------------------------------------------------------------
+// ASSERT_CHECK is the proper way to trigger a check result. If the CHECK
+// has failed, the diagnostic assertion routines will fire with appropriate
+// context information.
+//
+// Note that the condition may either be a raw boolean expression or a CHECK result
+// returned from a Check routine.
+//
+// Recursion note: ASSERT_CHECKs are only performed if there is no current check in
+// progress.
+//--------------------------------------------------------------------------------
+
+#ifndef ENTER_DEBUG_ONLY_CODE
+#define ENTER_DEBUG_ONLY_CODE
+#endif
+
+#ifndef LEAVE_DEBUG_ONLY_CODE
+#define LEAVE_DEBUG_ONLY_CODE
+#endif
+
+#define ASSERT_CHECK(_condition, _message, _reason) \
+do \
+{ \
+ CHECK _check; \
+ if (_check.EnterAssert()) \
+ { \
+ ENTER_DEBUG_ONLY_CODE; \
+ if (_check.Fail(_condition)) \
+ { \
+ _check.Setup(_message \
+ DEBUG_ARG(#_condition) \
+ DEBUG_ARG(__FILE__) \
+ DEBUG_ARG(__LINE__)); \
+ _check.Trigger(_reason); \
+ } \
+ LEAVE_DEBUG_ONLY_CODE; \
+ _check.LeaveAssert(); \
+ } \
+} while (0)
+
+// ex: ASSERT_CHECKF(1+2==4, "my reason", ("Woah %d", 1+3));
+// note that the double parenthesis, the 'args' param below will include one pair of parens.
+#define ASSERT_CHECKF(_condition, _reason, _args) \
+ ASSERT_CHECK(_condition, CHECK::FormatMessage _args, _reason)
+
+//--------------------------------------------------------------------------------
+// INVARIANTS are descriptions of conditions which are always true at well defined
+// points of execution. Invariants may be checked by the caller or callee at any
+// time as paranoia requires.
+//
+// There are really two flavors of invariant. The "public invariant" describes
+// to the caller invariant behavior about the abstraction which is visible from
+// the public API (and of course it should be expressible in that public API).
+//
+// The "internal invariant" (or representation invariant), on the other hand, is
+// a description of the private implementation of the abstraction, which may examine
+// internal state of the abstraction or use private entry points.
+//
+// Classes with invariants should introduce methods called
+// void Invariant();
+// and
+// void InternalInvariant();
+// to allow invariant checks.
+//--------------------------------------------------------------------------------
+
+#if CHECK_INVARIANTS
+
+template <typename TYPENAME>
+CHECK CheckInvariant(TYPENAME &obj)
+{
+ __if_exists(TYPENAME::Invariant)
+ {
+ CHECK(obj.Invariant());
+ }
+ __if_exists(TYPENAME::InternalInvariant)
+ {
+ CHECK(obj.InternalInvariant());
+ }
+
+ CHECK_OK;
+}
+
+#define CHECK_INVARIANT(o) \
+ ASSERT_CHECK(CheckInvariant(o), NULL, "Invariant failure")
+
+#else
+
+#define CHECK_INVARIANT(o) do { } while (0)
+
+#endif
+
+//--------------------------------------------------------------------------------
+// VALIDATE is a check to be made on an object type which identifies a pointer as
+// a valid instance of the object, by calling CheckPointer on it. Normally a null
+// pointer is treated as an error; VALIDATE_NULL (or CheckPointer(o, NULL_OK))
+// may be used when a null pointer is acceptible.
+//
+// In addition to the null/non-null check, a type may provide a specific Check method
+// for more sophisticated identification. In general, the Check method
+// should answer the question
+// "Is this a valid instance of its declared compile-time type?". For instance, if
+// runtype type identification were supported for the type, it should be invoked here.
+//
+// Note that CheckPointer will also check the invariant(s) if appropriate, so the
+// invariants should NOT be explicitly invoked from the Check method.
+//--------------------------------------------------------------------------------
+
+enum IsNullOK
+{
+ NULL_NOT_OK = 0,
+ NULL_OK = 1
+};
+
+#if CHECK_INVARIANTS
+template <typename TYPENAME>
+CHECK CheckPointer(TYPENAME *o, IsNullOK ok = NULL_NOT_OK)
+{
+ if (o == NULL)
+ {
+ CHECK_MSG(ok, "Illegal null pointer");
+ }
+ else
+ {
+ __if_exists(TYPENAME::Check)
+ {
+ CHECK(o->Check());
+ }
+ }
+
+ CHECK_OK;
+}
+
+template <typename TYPENAME>
+CHECK CheckValue(TYPENAME &val)
+{
+ __if_exists(TYPENAME::Check)
+ {
+ CHECK(val.Check());
+ }
+
+ CHECK(CheckInvariant(val));
+
+ CHECK_OK;
+}
+#else // CHECK_INVARIANTS
+
+#ifdef _DEBUG_IMPL
+// Don't defined these functions to be nops for the non-debug
+// build as it may hide important checks
+template <typename TYPENAME>
+CHECK CheckPointer(TYPENAME *o, IsNullOK ok = NULL_NOT_OK)
+{
+ if (o == NULL)
+ {
+ CHECK_MSG(ok, "Illegal null pointer");
+ }
+
+ CHECK_OK;
+}
+
+template <typename TYPENAME>
+CHECK CheckValue(TYPENAME &val)
+{
+ CHECK_OK;
+}
+#endif
+
+#endif // CHECK_INVARIANTS
+
+#if VALIDATE_OBJECTS
+
+#define VALIDATE(o) \
+ ASSERT_CHECK(CheckPointer(o), "Validation failure")
+#define VALIDATE_NULL(o) \
+ ASSERT_CHECK(CheckPointer(o, NULL_OK), "Validation failure")
+
+#else
+
+#define VALIDATE(o) do { } while (0)
+#define VALIDATE_NULL(o) do { } while (0)
+
+#endif
+
+//--------------------------------------------------------------------------------
+// CONSISTENCY_CHECKS are ad-hoc assertions about the expected state of the program
+// at a given time. A failure in one of these indicates a bug in the code.
+//
+// Note that the condition may either be a raw boolean expression or a CHECK result
+// returned from a Check routine.
+//--------------------------------------------------------------------------------
+
+#define CONSISTENCY_CHECK(_condition) \
+ CONSISTENCY_CHECK_MSG(_condition, "")
+
+#ifdef _DEBUG_IMPL
+
+#define CONSISTENCY_CHECK_MSG(_condition, _message) \
+ ASSERT_CHECK(_condition, _message, "Consistency check failed")
+
+#define CONSISTENCY_CHECK_MSGF(_condition, args) \
+ ASSERT_CHECKF(_condition, "Consistency check failed", args)
+
+#else
+
+#define CONSISTENCY_CHECK_MSG(_condition, _message) do { } while (0)
+#define CONSISTENCY_CHECK_MSGF(_condition, args) do { } while (0)
+
+#endif
+
+//--------------------------------------------------------------------------------
+// SIMPLIFYING_ASSUMPTIONS are workarounds which are placed in the code to allow progress
+// to be made in the case of difficult corner cases. These should NOT be left in the
+// code; they are really just markers of things which need to be fixed.
+//
+// Note that the condition may either be a raw boolean expression or a CHECK result
+// returned from a Check routine.
+//--------------------------------------------------------------------------------
+
+// Ex usage:
+// SIMPLIFYING_ASSUMPTION(SomeExpression());
+#define SIMPLIFYING_ASSUMPTION(_condition) \
+ SIMPLIFYING_ASSUMPTION_MSG(_condition, "")
+
+
+// Helper for HRs. Will provide formatted message showing the failure code.
+#define SIMPLIFYING_ASSUMPTION_SUCCEEDED(__hr) \
+ { \
+ HRESULT __hr2 = (__hr); \
+ (void)__hr2; \
+ SIMPLIFYING_ASSUMPTION_MSGF(SUCCEEDED(__hr2), ("HRESULT failed.\n Expected success.\n Actual=0x%x\n", __hr2)); \
+ }
+
+#ifdef _DEBUG_IMPL
+
+// Ex usage:
+// SIMPLIFYING_ASSUMPTION_MSG(SUCCEEDED(hr), "It failed!");
+#define SIMPLIFYING_ASSUMPTION_MSG(_condition, _message) \
+ ASSERT_CHECK(_condition, _message, "Unhandled special case detected")
+
+// use a formatted string. Ex usage:
+// SIMPLIFYING_ASSUMPTION_MSGF(SUCCEEDED(hr), ("Woah it failed! 0x%08x", hr));
+#define SIMPLIFYING_ASSUMPTION_MSGF(_condition, args) \
+ ASSERT_CHECKF(_condition, "Unhandled special case detected", args)
+
+#else // !_DEBUG_IMPL
+
+#define SIMPLIFYING_ASSUMPTION_MSG(_condition, _message) do { } while (0)
+#define SIMPLIFYING_ASSUMPTION_MSGF(_condition, args) do { } while (0)
+
+#endif // !_DEBUG_IMPL
+
+//--------------------------------------------------------------------------------
+// COMPILER_ASSUME_MSG is a statement that tells the compiler to assume the
+// condition is true. In a checked build these turn into asserts;
+// in a free build they are passed through to the compiler to use in optimization.
+//--------------------------------------------------------------------------------
+
+#if defined(_PREFAST_) || defined(_PREFIX_)
+#define COMPILER_ASSUME_MSG(_condition, _message) if (!(_condition)) __UNREACHABLE();
+#define COMPILER_ASSUME_MSGF(_condition, args) if (!(_condition)) __UNREACHABLE();
+#else
+
+#if defined(DACCESS_COMPILE)
+#define COMPILER_ASSUME_MSG(_condition, _message) do { } while (0)
+#define COMPILER_ASSUME_MSGF(_condition, args) do { } while (0)
+#else
+
+#if defined(_DEBUG)
+#define COMPILER_ASSUME_MSG(_condition, _message) \
+ ASSERT_CHECK(_condition, _message, "Compiler optimization assumption invalid")
+#define COMPILER_ASSUME_MSGF(_condition, args) \
+ ASSERT_CHECKF(_condition, "Compiler optimization assumption invalid", args)
+#else
+#define COMPILER_ASSUME_MSG(_condition, _message) __assume(_condition)
+#define COMPILER_ASSUME_MSGF(_condition, args) __assume(_condition)
+#endif // _DEBUG
+
+#endif // DACCESS_COMPILE
+
+#endif // _PREFAST_ || _PREFIX_
+
+
+#define COMPILER_ASSUME(_condition) \
+ COMPILER_ASSUME_MSG(_condition, "")
+
+
+//--------------------------------------------------------------------------------
+// PREFIX_ASSUME_MSG and PREFAST_ASSUME_MSG are just another name
+// for COMPILER_ASSUME_MSG
+// In a checked build these turn into asserts; in a free build
+// they are passed through to the compiler to use in optimization;
+// via an __assume(_condition) optimization hint.
+//--------------------------------------------------------------------------------
+
+#define PREFIX_ASSUME_MSG(_condition, _message) \
+ COMPILER_ASSUME_MSG(_condition, _message)
+
+#define PREFIX_ASSUME_MSGF(_condition, args) \
+ COMPILER_ASSUME_MSGF(_condition, args)
+
+#define PREFIX_ASSUME(_condition) \
+ COMPILER_ASSUME_MSG(_condition, "")
+
+#define PREFAST_ASSUME_MSG(_condition, _message) \
+ COMPILER_ASSUME_MSG(_condition, _message)
+
+#define PREFAST_ASSUME_MSGF(_condition, args) \
+ COMPILER_ASSUME_MSGF(_condition, args)
+
+#define PREFAST_ASSUME(_condition) \
+ COMPILER_ASSUME_MSG(_condition, "")
+
+//--------------------------------------------------------------------------------
+// UNREACHABLE points are locations in the code which should not be able to be
+// reached under any circumstances (e.g. a default in a switch which is supposed to
+// cover all cases.). This macro tells the compiler this, and also embeds a check
+// to make sure it is always true.
+//--------------------------------------------------------------------------------
+
+#define UNREACHABLE() \
+ UNREACHABLE_MSG("")
+
+#ifdef __llvm__
+
+// LLVM complains if a function does not return what it says.
+#define UNREACHABLE_RET() do { UNREACHABLE(); return 0; } while (0)
+#define UNREACHABLE_MSG_RET(_message) UNREACHABLE_MSG(_message); return 0;
+
+#else // __llvm__
+
+#define UNREACHABLE_RET() UNREACHABLE()
+#define UNREACHABLE_MSG_RET(_message) UNREACHABLE_MSG(_message)
+
+#endif // __llvm__ else
+
+#if defined(_MSC_VER) || defined(_PREFIX_)
+#if defined(_TARGET_AMD64_)
+// Empty methods that consist of UNREACHABLE() result in a zero-sized declspec(noreturn) method
+// which causes the pdb file to make the next method declspec(noreturn) as well, thus breaking BBT
+// Remove when we get a VC compiler that fixes VSW 449170
+# define __UNREACHABLE() DebugBreak(); __assume(0);
+#else
+# define __UNREACHABLE() __assume(0)
+#endif
+#else
+#define __UNREACHABLE() do { } while(true)
+#endif
+
+#ifdef _DEBUG_IMPL
+
+// Note that the "do { } while (0)" syntax trick here doesn't work, as the compiler
+// gives an error that the while(0) is unreachable code
+#define UNREACHABLE_MSG(_message) \
+{ \
+ CHECK _check; \
+ _check.Setup(_message, "<unreachable>", __FILE__, __LINE__); \
+ _check.Trigger("Reached the \"unreachable\""); \
+} __UNREACHABLE()
+
+#else
+
+#define UNREACHABLE_MSG(_message) __UNREACHABLE()
+
+#endif
+
+
+//--------------------------------------------------------------------------------
+// STRESS_CHECK represents a check which is included in a free build
+// @todo: behavior on trigger
+//
+// Note that the condition may either be a raw boolean expression or a CHECK result
+// returned from a Check routine.
+//
+// Since Retail builds don't allow formatted checks, there's no STRESS_CHECK_MSGF.
+//--------------------------------------------------------------------------------
+
+#if CHECK_STRESS
+
+#define STRESS_CHECK(_condition, _message) \
+ ASSERT_CHECK(_condition, _message, "Stress Assertion Failure")
+
+#else
+
+#define STRESS_CHECK(_condition, _message) do { } while (0)
+
+#endif
+
+//--------------------------------------------------------------------------------
+// CONTRACT_CHECK is used to put contracts on Check function. Note that it does
+// not support postconditions.
+//--------------------------------------------------------------------------------
+
+#define CONTRACT_CHECK CONTRACTL
+#define CONTRACT_CHECK_END CONTRACTL_END
+
+//--------------------------------------------------------------------------------
+// CCHECK is used for Check functions which may fail due to out of memory
+// or other transient failures. These failures should be ignored when doing
+// assertions, but they cannot be ignored when the Check function is used in
+// normal code.
+// @todo: really crufty to have 2 sets of CHECK macros
+//--------------------------------------------------------------------------------
+
+#ifdef _DEBUG
+
+#define CCHECK_START \
+ { \
+ BOOL ___exception = FALSE; \
+ BOOL ___transient = FALSE; \
+ CHECK ___result = CHECK::OK(); \
+ EX_TRY {
+
+#define CCHECK_END \
+ } EX_CATCH { \
+ if (___result.IsInAssert()) \
+ { \
+ ___exception = TRUE; \
+ ___transient = GET_EXCEPTION()->IsTransient(); \
+ } \
+ else \
+ EX_RETHROW; \
+ } EX_END_CATCH(RethrowTerminalExceptions); \
+ \
+ if (___exception) \
+ { \
+ if (___transient) \
+ CHECK_OK; \
+ else \
+ CHECK_FAIL("Nontransient exception occurred during check"); \
+ } \
+ CHECK(___result); \
+ }
+
+#define CRETURN_RESULT(r) ___result = r
+
+#define CCHECK_MSG(_condition, _message) \
+ CHECK_MSG_EX(_condition, _message, CRETURN_RESULT)
+
+#define CCHECK(_condition) \
+ CCHECK_MSG(_condition, "")
+
+#define CCHECK_MSGF(_condition, _args) \
+ CCHECK_MSG(_condition, CHECK::FormatMessage _args)
+
+#define CCHECK_FAIL(_message) \
+ CCHECK_MSG(FALSE, _message); UNREACHABLE()
+
+#define CCHECK_FAILF(_args) \
+ CCHECK_MSGF(FALSE, _args); UNREACHABLE()
+
+#else // _DEBUG
+
+#define CCHECK_START
+#define CCHECK_END
+
+#define CCHECK CHECK
+#define CCHECK_MSG CHECK_MSG
+#define CCHECK_MSGF CHECK_MSGF
+#define CCHECK_FAIL CHECK_FAIL
+#define CCHECK_FAILF CHECK_FAILF
+
+#endif
+
+
+
+//--------------------------------------------------------------------------------
+// Common base level checks
+//--------------------------------------------------------------------------------
+
+CHECK CheckAlignment(UINT alignment);
+
+CHECK CheckAligned(UINT value, UINT alignment);
+#if defined(_MSC_VER)
+CHECK CheckAligned(ULONG value, UINT alignment);
+#endif
+CHECK CheckAligned(UINT64 value, UINT alignment);
+CHECK CheckAligned(const void *address, UINT alignment);
+
+CHECK CheckOverflow(UINT value1, UINT value2);
+#if defined(_MSC_VER)
+CHECK CheckOverflow(ULONG value1, ULONG value2);
+#endif
+CHECK CheckOverflow(UINT64 value1, UINT64 value2);
+CHECK CheckOverflow(PTR_CVOID address, UINT offset);
+#if defined(_MSC_VER)
+CHECK CheckOverflow(const void *address, ULONG offset);
+#endif
+CHECK CheckOverflow(const void *address, UINT64 offset);
+
+CHECK CheckUnderflow(UINT value1, UINT value2);
+#if defined(_MSC_VER)
+CHECK CheckUnderflow(ULONG value1, ULONG value2);
+#endif
+CHECK CheckUnderflow(UINT64 value1, UINT64 value2);
+CHECK CheckUnderflow(const void *address, UINT offset);
+#if defined(_MSC_VER)
+CHECK CheckUnderflow(const void *address, ULONG offset);
+#endif
+CHECK CheckUnderflow(const void *address, UINT64 offset);
+CHECK CheckUnderflow(const void *address, void *address2);
+
+CHECK CheckZeroedMemory(const void *memory, SIZE_T size);
+
+// These include overflow checks
+CHECK CheckBounds(const void *rangeBase, UINT32 rangeSize, UINT32 offset);
+CHECK CheckBounds(const void *rangeBase, UINT32 rangeSize, UINT32 offset, UINT32 size);
+
+void WINAPI ReleaseCheckTls(LPVOID pTlsData);
+
+// ================================================================================
+// Inline definitions
+// ================================================================================
+
+#include "check.inl"
+
+#endif // CHECK_H_
diff --git a/src/inc/check.inl b/src/inc/check.inl
new file mode 100644
index 0000000000..9a3597ef81
--- /dev/null
+++ b/src/inc/check.inl
@@ -0,0 +1,367 @@
+// 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.
+
+#ifndef CHECK_INL_
+#define CHECK_INL_
+
+#include "check.h"
+#include "clrhost.h"
+#include "debugmacros.h"
+#include "clrtypes.h"
+
+inline LONG *CHECK::InitTls()
+{
+#pragma push_macro("HeapAlloc")
+#pragma push_macro("GetProcessHeap")
+#undef HeapAlloc
+#undef GetProcessHeap
+
+ LONG *pCount = (LONG *)::HeapAlloc(GetProcessHeap(), 0, sizeof(LONG));
+ if (pCount)
+ *pCount = 0;
+
+#pragma pop_macro("HeapAlloc")
+#pragma pop_macro("GetProcessHeap")
+ ClrFlsSetValue(TlsIdx_Check, pCount);
+ ClrFlsAssociateCallback(TlsIdx_Check, ReleaseCheckTls);
+ return pCount;
+}
+
+inline void CHECK::ReleaseTls(void* pCountTLS)
+{
+#pragma push_macro("HeapFree")
+#pragma push_macro("GetProcessHeap")
+#undef HeapFree
+#undef GetProcessHeap
+ LONG* pCount = (LONG*) pCountTLS;
+ if (pCount)
+ ::HeapFree(GetProcessHeap(), 0, pCount);
+
+#pragma pop_macro("HeapFree")
+#pragma pop_macro("GetProcessHeap")
+}
+
+FORCEINLINE BOOL CHECK::EnterAssert()
+{
+ if (s_neverEnforceAsserts)
+ return FALSE;
+
+#ifdef _DEBUG_IMPL
+ m_pCount = (LONG *)ClrFlsGetValue(TlsIdx_Check);
+ if (!m_pCount)
+ {
+ m_pCount = InitTls();
+ if (!m_pCount)
+ return FALSE;
+ }
+
+ if (!*m_pCount)
+ {
+ *m_pCount = 1;
+ return TRUE;
+ }
+ else
+ return FALSE;
+#else
+ // Don't bother doing recursive checks on a free build, since checks should
+ // be extremely isolated
+ return TRUE;
+#endif
+}
+
+FORCEINLINE void CHECK::LeaveAssert()
+{
+#ifdef _DEBUG_IMPL
+ *m_pCount = 0;
+#endif
+}
+
+FORCEINLINE BOOL CHECK::IsInAssert()
+{
+#ifdef _DEBUG_IMPL
+ if (!m_pCount)
+ m_pCount = (LONG *)ClrFlsGetValue(TlsIdx_Check);
+
+ if (!m_pCount)
+ return FALSE;
+ else
+ return *m_pCount;
+#else
+ return FALSE;
+#endif
+}
+
+FORCEINLINE BOOL CHECK::EnforceAssert()
+{
+ if (s_neverEnforceAsserts)
+ return FALSE;
+ else
+ {
+ CHECK chk;
+ return !chk.IsInAssert();
+ }
+}
+
+FORCEINLINE void CHECK::ResetAssert()
+{
+ CHECK chk;
+ if (chk.IsInAssert())
+ chk.LeaveAssert();
+}
+
+inline void CHECK::SetAssertEnforcement(BOOL value)
+{
+ s_neverEnforceAsserts = !value;
+}
+
+// Fail records the result of a condition check. Can take either a
+// boolean value or another check result
+FORCEINLINE BOOL CHECK::Fail(BOOL condition)
+{
+#ifdef _DEBUG
+ if (!condition)
+ {
+ m_condition = NULL;
+ m_file = NULL;
+ m_line = 0;
+ }
+#endif
+ return !condition;
+}
+
+FORCEINLINE BOOL CHECK::Fail(const CHECK &check)
+{
+ m_message = check.m_message;
+#ifdef _DEBUG
+ if (m_message != NULL)
+ {
+ m_condition = check.m_condition;
+ m_file = check.m_file;
+ m_line = check.m_line;
+ }
+#endif
+ return m_message != NULL;
+}
+
+#ifndef _DEBUG
+FORCEINLINE void CHECK::Setup(LPCSTR message)
+{
+ m_message = message;
+}
+
+FORCEINLINE LPCSTR CHECK::FormatMessage(LPCSTR messageFormat, ...)
+{
+ return messageFormat;
+}
+#endif
+
+FORCEINLINE CHECK::operator BOOL ()
+{
+ return m_message == NULL;
+}
+
+FORCEINLINE BOOL CHECK::operator!()
+{
+ return m_message != NULL;
+}
+
+inline CHECK CheckAlignment(UINT alignment)
+{
+ STATIC_CONTRACT_WRAPPER;
+ CHECK((alignment & (alignment-1)) == 0);
+ CHECK_OK;
+}
+
+inline CHECK CheckAligned(UINT value, UINT alignment)
+{
+ STATIC_CONTRACT_WRAPPER;
+ CHECK(AlignmentTrim(value, alignment) == 0);
+ CHECK_OK;
+}
+
+#ifndef PLATFORM_UNIX
+// For Unix this and the previous function get the same types.
+// So, exclude this one.
+inline CHECK CheckAligned(ULONG value, UINT alignment)
+{
+ STATIC_CONTRACT_WRAPPER;
+ CHECK(AlignmentTrim(value, alignment) == 0);
+ CHECK_OK;
+}
+#endif // PLATFORM_UNIX
+
+inline CHECK CheckAligned(UINT64 value, UINT alignment)
+{
+ STATIC_CONTRACT_WRAPPER;
+ CHECK(AlignmentTrim(value, alignment) == 0);
+ CHECK_OK;
+}
+
+inline CHECK CheckAligned(const void *address, UINT alignment)
+{
+ STATIC_CONTRACT_WRAPPER;
+ CHECK(AlignmentTrim((SIZE_T)address, alignment) == 0);
+ CHECK_OK;
+}
+
+inline CHECK CheckOverflow(UINT value1, UINT value2)
+{
+ CHECK(value1 + value2 >= value1);
+ CHECK_OK;
+}
+
+#if defined(_MSC_VER)
+inline CHECK CheckOverflow(ULONG value1, ULONG value2)
+{
+ CHECK(value1 + value2 >= value1);
+ CHECK_OK;
+}
+#endif
+
+inline CHECK CheckOverflow(UINT64 value1, UINT64 value2)
+{
+ CHECK(value1 + value2 >= value1);
+ CHECK_OK;
+}
+
+inline CHECK CheckOverflow(PTR_CVOID address, UINT offset)
+{
+ TADDR targetAddr = dac_cast<TADDR>(address);
+#if POINTER_BITS == 32
+ CHECK((UINT) (SIZE_T)(targetAddr) + offset >= (UINT) (SIZE_T) (targetAddr));
+#else
+ CHECK((UINT64) targetAddr + offset >= (UINT64) targetAddr);
+#endif
+
+ CHECK_OK;
+}
+
+#if defined(_MSC_VER)
+inline CHECK CheckOverflow(const void *address, ULONG offset)
+{
+#if POINTER_BITS == 32
+ CHECK((ULONG) (SIZE_T) address + offset >= (ULONG) (SIZE_T) address);
+#else
+ CHECK((UINT64) address + offset >= (UINT64) address);
+#endif
+
+ CHECK_OK;
+}
+#endif
+
+inline CHECK CheckOverflow(const void *address, UINT64 offset)
+{
+#if POINTER_BITS == 32
+ CHECK(offset >> 32 == 0);
+ CHECK((UINT) (SIZE_T) address + (UINT) offset >= (UINT) (SIZE_T) address);
+#else
+ CHECK((UINT64) address + offset >= (UINT64) address);
+#endif
+
+ CHECK_OK;
+}
+
+
+inline CHECK CheckUnderflow(UINT value1, UINT value2)
+{
+ CHECK(value1 - value2 <= value1);
+
+ CHECK_OK;
+}
+
+#ifndef PLATFORM_UNIX
+// For Unix this and the previous function get the same types.
+// So, exclude this one.
+inline CHECK CheckUnderflow(ULONG value1, ULONG value2)
+{
+ CHECK(value1 - value2 <= value1);
+
+ CHECK_OK;
+}
+#endif // PLATFORM_UNIX
+
+inline CHECK CheckUnderflow(UINT64 value1, UINT64 value2)
+{
+ CHECK(value1 - value2 <= value1);
+
+ CHECK_OK;
+}
+
+inline CHECK CheckUnderflow(const void *address, UINT offset)
+{
+#if POINTER_BITS == 32
+ CHECK((UINT) (SIZE_T) address - offset <= (UINT) (SIZE_T) address);
+#else
+ CHECK((UINT64) address - offset <= (UINT64) address);
+#endif
+
+ CHECK_OK;
+}
+
+#if defined(_MSC_VER)
+inline CHECK CheckUnderflow(const void *address, ULONG offset)
+{
+#if POINTER_BITS == 32
+ CHECK((ULONG) (SIZE_T) address - offset <= (ULONG) (SIZE_T) address);
+#else
+ CHECK((UINT64) address - offset <= (UINT64) address);
+#endif
+
+ CHECK_OK;
+}
+#endif
+
+inline CHECK CheckUnderflow(const void *address, UINT64 offset)
+{
+#if POINTER_BITS == 32
+ CHECK(offset >> 32 == 0);
+ CHECK((UINT) (SIZE_T) address - (UINT) offset <= (UINT) (SIZE_T) address);
+#else
+ CHECK((UINT64) address - offset <= (UINT64) address);
+#endif
+
+ CHECK_OK;
+}
+
+inline CHECK CheckUnderflow(const void *address, void *address2)
+{
+#if POINTER_BITS == 32
+ CHECK((UINT) (SIZE_T) address - (UINT) (SIZE_T) address2 <= (UINT) (SIZE_T) address);
+#else
+ CHECK((UINT64) address - (UINT64) address2 <= (UINT64) address);
+#endif
+
+ CHECK_OK;
+}
+
+inline CHECK CheckZeroedMemory(const void *memory, SIZE_T size)
+{
+ CHECK(CheckOverflow(memory, size));
+
+ BYTE *p = (BYTE *) memory;
+ BYTE *pEnd = p + size;
+
+ while (p < pEnd)
+ CHECK(*p++ == 0);
+
+ CHECK_OK;
+}
+
+inline CHECK CheckBounds(const void *rangeBase, UINT32 rangeSize, UINT32 offset)
+{
+ CHECK(CheckOverflow(dac_cast<PTR_CVOID>(rangeBase), rangeSize));
+ CHECK(offset <= rangeSize);
+ CHECK_OK;
+}
+
+inline CHECK CheckBounds(const void *rangeBase, UINT32 rangeSize, UINT32 offset, UINT32 size)
+{
+ CHECK(CheckOverflow(dac_cast<PTR_CVOID>(rangeBase), rangeSize));
+ CHECK(CheckOverflow(offset, size));
+ CHECK(offset + size <= rangeSize);
+ CHECK_OK;
+}
+
+#endif // CHECK_INL_
+
diff --git a/src/inc/circularlog.h b/src/inc/circularlog.h
new file mode 100644
index 0000000000..4ee8d2fa99
--- /dev/null
+++ b/src/inc/circularlog.h
@@ -0,0 +1,38 @@
+// 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.
+
+
+#ifndef _CIRCULARLOG_H__
+
+#define _CIRCULARLOG_H__
+
+#include "sstring.h"
+
+class CircularLog
+{
+public:
+ CircularLog();
+ ~CircularLog();
+
+ bool Init(const WCHAR* logname, const WCHAR* logHeader, DWORD maxSize = 1024*1024);
+ void Shutdown();
+ void Log(const WCHAR* string);
+
+protected:
+
+ void CheckForLogReset(BOOL fOverflow);
+ BOOL CheckLogHeader();
+ HANDLE OpenFile();
+ void CloseFile();
+
+ bool m_bInit;
+ SString m_LogFilename;
+ SString m_LogHeader;
+ SString m_OldLogFilename;
+ SString m_LockFilename;
+ DWORD m_MaxSize;
+ unsigned m_uLogCount;
+};
+
+#endif
diff --git a/src/inc/clr/fs.h b/src/inc/clr/fs.h
new file mode 100644
index 0000000000..d6bcb75309
--- /dev/null
+++ b/src/inc/clr/fs.h
@@ -0,0 +1,16 @@
+// 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.
+//
+
+//
+// This header will include all headers relating to file system functionality.
+
+#ifndef _clr_fs_h_
+#define _clr_fs_h_
+
+#include "fs/path.h"
+#include "fs/file.h"
+#include "fs/dir.h"
+
+#endif // _clr_fs_h_
diff --git a/src/inc/clr/fs/dir.h b/src/inc/clr/fs/dir.h
new file mode 100644
index 0000000000..2516151a55
--- /dev/null
+++ b/src/inc/clr/fs/dir.h
@@ -0,0 +1,129 @@
+// 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.
+//
+
+//
+// This header provides general directory-related file system services.
+
+#ifndef _clr_fs_Dir_h_
+#define _clr_fs_Dir_h_
+
+#include "clrtypes.h"
+#include "clr/str.h"
+#include "strsafe.h"
+
+#ifndef countof
+ #define countof(x) (sizeof(x) / sizeof(x[0]))
+#endif // !countof
+
+namespace clr
+{
+ namespace fs
+ {
+ class Dir
+ {
+ public:
+ static inline bool Exists(
+ LPCWSTR wzDirPath)
+ {
+ DWORD attrs = WszGetFileAttributes(wzDirPath);
+ return (attrs != INVALID_FILE_ATTRIBUTES) && (attrs & FILE_ATTRIBUTE_DIRECTORY);
+ }
+
+ //-----------------------------------------------------------------------------------------
+ // Creates new directory indicated by wzDirPath.
+ //
+ // Returns:
+ // S_OK - on success directory creation
+ // S_FALSE - when directory previously existed
+ // HR(ERROR_PATH_NOT_FOUND) - when creation of dir fails.
+ static inline HRESULT Create(
+ LPCWSTR wzDirPath)
+ {
+ HRESULT hr = S_OK;
+
+ if (!WszCreateDirectory(wzDirPath, nullptr))
+ {
+ hr = HRESULT_FROM_GetLastError();
+ if (hr == HRESULT_FROM_WIN32(ERROR_ALREADY_EXISTS))
+ {
+ hr = S_FALSE;
+ }
+ }
+ return hr;
+ }
+
+ //-----------------------------------------------------------------------------------------
+ // Creates the specified directory and all required subdirectories. wzDirPath will be
+ // temporarily modified in the process.
+ //
+ // Returns:
+ // S_OK - on success directory creation
+ // S_FALSE - when directory previously existed
+ // HR(ERROR_PATH_NOT_FOUND) - when creation of any dir fails.
+ static inline HRESULT CreateRecursively(
+ __inout_z LPWSTR wzDirPath,
+ size_t cchDirPath = 0)
+ {
+ HRESULT hr = S_OK;
+
+ if (wzDirPath == nullptr)
+ {
+ return E_POINTER;
+ }
+
+ if (cchDirPath == 0)
+ {
+ cchDirPath = wcslen(wzDirPath);
+ }
+
+ // Try to create the path. If it fails, assume that's because the parent folder does
+ // not exist. Try to create the parent then re-attempt.
+ WCHAR chOrig = wzDirPath[cchDirPath];
+ hr = Create(wzDirPath);
+ if (hr == HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND))
+ {
+ for (WCHAR* pCurCh = wzDirPath + cchDirPath - 1; pCurCh != wzDirPath; --pCurCh)
+ {
+ if (*pCurCh == W('\\') || *pCurCh == W('\0'))
+ {
+ WCHAR chOrig = *pCurCh;
+ *pCurCh = W('\0');
+ IfFailRet(CreateRecursively(wzDirPath, pCurCh - wzDirPath));
+ *pCurCh = chOrig;
+ break;
+ }
+ }
+ IfFailRet(Create(wzDirPath));
+ }
+
+ return hr;
+ }
+
+ //-----------------------------------------------------------------------------------------
+ // Creates the specified directory and all required subdirectories.
+ static inline HRESULT CreateRecursively(
+ LPCWSTR wzDirPath)
+ {
+ HRESULT hr = S_OK;
+
+ if (wzDirPath == nullptr)
+ {
+ return E_POINTER;
+ }
+
+ // Make a writable copy of wzDirPath
+ size_t cchDirPath = wcslen(wzDirPath);
+ CQuickWSTR wzBuffer;
+ IfFailRet(wzBuffer.ReSizeNoThrow(cchDirPath + 1));
+ wcscpy_s(wzBuffer.Ptr(), wzBuffer.Size(), wzDirPath);
+ IfFailRet(CreateRecursively(wzBuffer.Ptr(), cchDirPath));
+
+ return hr;
+ }
+ };
+ }
+}
+
+#endif // _clr_fs_Dir_h_
diff --git a/src/inc/clr/fs/file.h b/src/inc/clr/fs/file.h
new file mode 100644
index 0000000000..70f22a29fa
--- /dev/null
+++ b/src/inc/clr/fs/file.h
@@ -0,0 +1,40 @@
+// 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.
+//
+
+//
+// This header provides general filename-related file system services.
+
+#ifndef _clr_fs_File_h_
+#define _clr_fs_File_h_
+
+#include "clrtypes.h"
+#include "cor.h" // SELECTANY
+
+namespace clr
+{
+ namespace fs
+ {
+ // This list taken from ndp/clr/src/bcl/system/io/path.cs
+ SELECTANY WCHAR const g_rgInvalidFileNameChars[] =
+ { W('"'), W('<'), W('>'), W('|'), W('\0'), (WCHAR)1, (WCHAR)2, (WCHAR)3, (WCHAR)4, (WCHAR)5, (WCHAR)6,
+ (WCHAR)7, (WCHAR)8, (WCHAR)9, (WCHAR)10, (WCHAR)11, (WCHAR)12, (WCHAR)13, (WCHAR)14,
+ (WCHAR)15, (WCHAR)16, (WCHAR)17, (WCHAR)18, (WCHAR)19, (WCHAR)20, (WCHAR)21, (WCHAR)22,
+ (WCHAR)23, (WCHAR)24, (WCHAR)25, (WCHAR)26, (WCHAR)27, (WCHAR)28, (WCHAR)29, (WCHAR)30,
+ (WCHAR)31, W(':'), W('*'), W('?'), W('\\'), W('/') };
+
+ class File
+ {
+ public:
+ static inline bool Exists(
+ LPCWSTR wzFilePath)
+ {
+ DWORD attrs = WszGetFileAttributes(wzFilePath);
+ return (attrs != INVALID_FILE_ATTRIBUTES) && !(attrs & FILE_ATTRIBUTE_DIRECTORY);
+ }
+ };
+ }
+}
+
+#endif // _clr_fs_File_h_
diff --git a/src/inc/clr/fs/path.h b/src/inc/clr/fs/path.h
new file mode 100644
index 0000000000..7c1995ecb2
--- /dev/null
+++ b/src/inc/clr/fs/path.h
@@ -0,0 +1,141 @@
+// 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.
+//
+
+//
+// This header provides general path-related file system services.
+
+#ifndef _clr_fs_Path_h_
+#define _clr_fs_Path_h_
+
+#include "clrtypes.h"
+#include "cor.h" // SELECTANY
+
+#include "strsafe.h"
+
+#include "clr/str.h"
+
+#ifndef LONG_FORMAT_PATH_PREFIX
+ #define LONG_FORMAT_PATH_PREFIX W("\\\\?\\")
+#endif
+
+namespace clr
+{
+ namespace fs
+ {
+ // This list taken from ndp/clr/src/bcl/system/io/path.cs
+ SELECTANY WCHAR const g_rgInvalidPathChars[] =
+ { W('"'), W('<'), W('>'), W('|'), W('\0'), (WCHAR)1, (WCHAR)2, (WCHAR)3, (WCHAR)4, (WCHAR)5, (WCHAR)6,
+ (WCHAR)7, (WCHAR)8, (WCHAR)9, (WCHAR)10, (WCHAR)11, (WCHAR)12, (WCHAR)13, (WCHAR)14,
+ (WCHAR)15, (WCHAR)16, (WCHAR)17, (WCHAR)18, (WCHAR)19, (WCHAR)20, (WCHAR)21, (WCHAR)22,
+ (WCHAR)23, (WCHAR)24, (WCHAR)25, (WCHAR)26, (WCHAR)27, (WCHAR)28, (WCHAR)29, (WCHAR)30,
+ (WCHAR)31 };
+
+ class Path
+ {
+ public:
+ //-----------------------------------------------------------------------------------------
+ static inline bool
+ Exists(
+ LPCWSTR wzPath)
+ {
+ DWORD attrs = WszGetFileAttributes(wzPath);
+ return (attrs != INVALID_FILE_ATTRIBUTES);
+ }
+
+ //-----------------------------------------------------------------------------------------
+ // Returns true if wzPath represents a long format path (i.e., prefixed with '\\?\').
+ static inline bool
+ HasLongFormatPrefix(LPCWSTR wzPath)
+ {
+ _ASSERTE(!clr::str::IsNullOrEmpty(wzPath)); // Must check this first.
+ return wcscmp(wzPath, LONG_FORMAT_PATH_PREFIX) == 0;
+ }
+
+ //-----------------------------------------------------------------------------------------
+ // Returns true if wzPath represents a relative path.
+ static inline bool
+ IsRelative(LPCWSTR wzPath)
+ {
+ _ASSERTE(wzPath != nullptr);
+
+ // Similar to System.IO.Path.IsRelative()
+#if PLATFORM_UNIX
+ if(wzPath[0] == VOLUME_SEPARATOR_CHAR_W)
+ {
+ return false;
+ }
+#else
+ // Check for a paths like "C:\..." or "\\...". Additional notes:
+ // - "\\?\..." - long format paths are considered as absolute paths due to the "\\" prefix
+ // - "\..." - these paths are relative, as they depend on the current drive
+ // - "C:..." and not "C:\..." - these paths are relative, as they depend on the current directory for drive C
+ if (wzPath[0] != W('\0') &&
+ wzPath[1] == VOLUME_SEPARATOR_CHAR_W &&
+ wzPath[2] == DIRECTORY_SEPARATOR_CHAR_W &&
+ (
+ (wzPath[0] >= W('A') && wzPath[0] <= W('Z')) ||
+ (wzPath[0] >= W('a') && wzPath[0] <= W('z'))
+ ))
+ {
+ return false;
+ }
+ if (wzPath[0] == DIRECTORY_SEPARATOR_CHAR_W && wzPath[1] == DIRECTORY_SEPARATOR_CHAR_W)
+ {
+ return false;
+ }
+#endif
+
+ return true;
+ }
+
+ //-----------------------------------------------------------------------------------------
+ // Combines two path parts. wzPathLeft must be a directory path and may be either absolute
+ // or relative. wzPathRight may be a directory or file path and must be relative. The
+ // result is placed in wzBuffer and the number of chars written is placed in pcchBuffer on
+ // success; otherwise an error HRESULT is returned.
+ static HRESULT
+ Combine(LPCWSTR wzPathLeft, LPCWSTR wzPathRight, __in DWORD *pcchBuffer, __out_ecount(*pcchBuffer) LPWSTR wzBuffer)
+ {
+ STATIC_CONTRACT_NOTHROW;
+
+ HRESULT hr = S_OK;
+
+ if (clr::str::IsNullOrEmpty(wzPathLeft) || clr::str::IsNullOrEmpty(wzPathRight) || pcchBuffer == nullptr)
+ return E_INVALIDARG;
+
+ LPWSTR wzBuf = wzBuffer;
+ size_t cchBuf = *pcchBuffer;
+
+ IfFailRet(StringCchCopyExW(wzBuf, cchBuf, wzPathLeft, &wzBuf, &cchBuf, STRSAFE_NULL_ON_FAILURE));
+ IfFailRet(StringCchCatExW(wzBuf, cchBuf, wzBuf[-1] == DIRECTORY_SEPARATOR_CHAR_W ? W("") : DIRECTORY_SEPARATOR_STR_W, &wzBuf, &cchBuf, STRSAFE_NULL_ON_FAILURE));
+ IfFailRet(StringCchCatExW(wzBuf, cchBuf, wzPathRight, &wzBuf, &cchBuf, STRSAFE_NULL_ON_FAILURE));
+
+ return S_OK;
+ }
+
+ //-----------------------------------------------------------------------------------------
+ // Checks if the path provided is valid within the specified constraints.
+ // ***NOTE: does not yet check for invalid path characters.
+ static bool
+ IsValid(LPCWSTR wzPath, DWORD cchPath, bool fAllowLongFormat)
+ {
+ if (clr::str::IsNullOrEmpty(wzPath))
+ return false;
+
+ bool fIsLongFormat = HasLongFormatPrefix(wzPath);
+
+ if (fIsLongFormat && !fAllowLongFormat)
+ return false;
+
+ if (!fIsLongFormat && cchPath > _MAX_PATH)
+ return false;
+
+ return true;
+ }
+ };
+ }
+}
+
+#endif // _clr_fs_Path_h_
diff --git a/src/inc/clr/stack.h b/src/inc/clr/stack.h
new file mode 100644
index 0000000000..f9741b274f
--- /dev/null
+++ b/src/inc/clr/stack.h
@@ -0,0 +1,99 @@
+// 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.
+//
+
+//
+// This header provides a basic stack implementation
+
+#ifndef _clr_Stack_h_
+#define _clr_Stack_h_
+
+namespace clr
+{
+ //-------------------------------------------------------------------------------------------------
+ // A basic stack class.
+ //
+ template < typename T >
+ class Stack
+ {
+ private:
+ //---------------------------------------------------------------------------------------------
+ struct Link
+ {
+ template < typename A1 >
+ Link(A1 && a1, Link * next = nullptr)
+ : _value(std::forward<A1>(a1))
+ , _next(next)
+ {}
+
+ T _value;
+ Link * _next;
+ };
+
+ public:
+ //---------------------------------------------------------------------------------------------
+ // Empty stack constructor.
+ Stack()
+ : _top(nullptr)
+ , _size(0)
+ {}
+
+ //---------------------------------------------------------------------------------------------
+ // Move constructor.
+ Stack(Stack && stack)
+ : _top(nullptr)
+ , _size(0)
+ { *this = std::move(stack); }
+
+ //---------------------------------------------------------------------------------------------
+ ~Stack()
+ {
+ while (!empty())
+ {
+ pop();
+ }
+ }
+
+ //---------------------------------------------------------------------------------------------
+ // Move assignment.
+ Stack& operator=(Stack && stack)
+ { std::swap(_top, stack._top); std::swap(_size, stack._size); }
+
+ //---------------------------------------------------------------------------------------------
+ bool empty() const
+ { return _top == nullptr; }
+
+ //---------------------------------------------------------------------------------------------
+ size_t size() const
+ { return _size; }
+
+ //---------------------------------------------------------------------------------------------
+ T & top()
+ { return _top->_value; }
+
+ //---------------------------------------------------------------------------------------------
+ T const & top() const
+ { return _top->_value; }
+
+ //---------------------------------------------------------------------------------------------
+ template < typename A1 > inline
+ void push(A1 && value)
+ {
+ STATIC_CONTRACT_THROWS;
+ _top = new Link(std::forward<A1>(value), _top);
+ ++_size;
+ }
+
+ //---------------------------------------------------------------------------------------------
+ void pop()
+ { Link * del = _top; _top = _top->_next; --_size; delete del; }
+
+ private:
+ //---------------------------------------------------------------------------------------------
+ Link * _top;
+ size_t _size;
+ };
+} // namespace clr
+
+#endif // _clr_Stack_h_
diff --git a/src/inc/clr/str.h b/src/inc/clr/str.h
new file mode 100644
index 0000000000..94c8ed46b5
--- /dev/null
+++ b/src/inc/clr/str.h
@@ -0,0 +1,28 @@
+// 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.
+//
+
+//
+// This header provides general standard string services.
+//
+
+#ifndef _clr_str_h_
+#define _clr_str_h_
+
+namespace clr
+{
+ namespace str
+ {
+ //-----------------------------------------------------------------------------------------
+ // Returns true if the provided string is a null pointer or the empty string.
+ static inline bool
+ IsNullOrEmpty(LPCWSTR wzStr)
+ {
+ return wzStr == nullptr || *wzStr == W('\0');
+ }
+ }
+}
+
+#endif // _clr_str_h_
+
diff --git a/src/inc/clr/win32.h b/src/inc/clr/win32.h
new file mode 100644
index 0000000000..a0e00c6321
--- /dev/null
+++ b/src/inc/clr/win32.h
@@ -0,0 +1,38 @@
+// 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.
+//
+// clr/win32.h
+//
+// Provides Win32-specific utility functionality.
+//
+
+//
+
+#ifndef clr_win32_h
+#define clr_win32_h
+
+#include "winwrap.h"
+
+namespace clr
+{
+ namespace win32
+ {
+ // Prevents an HMODULE from being unloaded until process termination.
+ inline
+ HRESULT PreventModuleUnload(HMODULE hMod)
+ {
+ if (!WszGetModuleHandleEx(
+ GET_MODULE_HANDLE_EX_FLAG_FROM_ADDRESS | GET_MODULE_HANDLE_EX_FLAG_PIN,
+ reinterpret_cast<LPCTSTR>(hMod),
+ &hMod))
+ {
+ return HRESULT_FROM_GetLastError();
+ }
+
+ return S_OK;
+ }
+ } // namespace win
+} // namespace clr
+
+#endif // clr_win32_h
diff --git a/src/inc/clr_std/algorithm b/src/inc/clr_std/algorithm
new file mode 100644
index 0000000000..92b4e8ece6
--- /dev/null
+++ b/src/inc/clr_std/algorithm
@@ -0,0 +1,119 @@
+// 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.
+
+//
+// clr_std/algorithm
+//
+// Copy of some key Standard Template Library functionality
+
+#ifdef _MSC_VER
+#pragma once
+#endif
+
+#ifdef USE_STL
+#include <algorithm>
+#else
+#ifndef __clr_std_algorithm_h__
+#define __clr_std_algorithm_h__
+
+namespace std
+{
+ template<class iter, class CompareFunc>
+ iter find_if ( iter first, iter last, CompareFunc comp )
+ {
+ for ( ; first!=last ; first++ )
+ if ( comp(*first) )
+ break;
+ return first;
+ }
+
+ template<class iter, class T>
+ iter find(iter first, iter last, const T& val)
+ {
+ for (;first != last; first++)
+ {
+ if (*first == val)
+ break;
+ }
+ return first;
+ }
+
+ template <class iter, class comp>
+ iter qsort_partition( iter first, iter last, iter pivot, comp compare )
+ {
+ iter lastMinusOne = last - 1;
+ swap(pivot, lastMinusOne);
+
+ // Pivot is at end
+ pivot = last - 1;
+
+ iter partitionLoc = first;
+
+ for (iter partitionWalk = first; partitionWalk != pivot; ++partitionWalk)
+ {
+ if (compare(*partitionWalk, *pivot))
+ {
+ swap(*partitionWalk, *partitionLoc);
+ partitionLoc++;
+ }
+ }
+ swap(*pivot, *partitionLoc);
+
+ return partitionLoc;
+ }
+
+ template <class iter, class comp>
+ void sort_worker ( iter first, iter last, comp compare )
+ {
+ typename iter::difference_type RangeSize = last - first;
+
+ // When down to a list of size 1, be done
+ if (RangeSize < 2)
+ return;
+
+ // Pick pivot
+
+ // Use simple pick middle algorithm
+ iter pivotLoc = first + (RangeSize / 2);
+
+ // Partition
+ pivotLoc = qsort_partition(first, last, pivotLoc, compare);
+
+ // Sort first array
+ sort_worker(first, pivotLoc, compare);
+
+ // Sort second array
+ sort_worker(pivotLoc + 1, last, compare);
+ }
+
+ template <class iter, class comp>
+ void sort ( iter first, iter last, comp compare )
+ {
+ sort_worker(first, last, compare);
+ if (first != last)
+ {
+ for (iter i = first; i < (last - 1); i++)
+ {
+ // Assert that the sort function works.
+ assert(!compare(*(i+1), *i));
+ }
+ }
+ }
+
+ template<class InIter, class OutIter, class Fn1>
+ OutIter transform( InIter first, InIter last, OutIter dest, Fn1 func )
+ {
+ for ( ; first!=last ; ++first, ++dest )
+ *dest = func(*first);
+ return dest;
+ }
+
+} // namespace std
+
+#endif /* __clr_std_algorithm_h__ */
+
+#endif // !USE_STL
+
+// Help the VIM editor figure out what kind of file this no-extension file is.
+// vim: filetype=cpp
diff --git a/src/inc/clr_std/string b/src/inc/clr_std/string
new file mode 100644
index 0000000000..e4476a60c6
--- /dev/null
+++ b/src/inc/clr_std/string
@@ -0,0 +1,414 @@
+// 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.
+
+//
+// clr_std/string
+//
+// Copy of some key Standard Template Library functionality
+//
+// This was created for use with SuperPMI. It has the minimal functionality needed by SuperPMI. It hasn't
+// been tested elsewhere.
+
+#ifdef _MSC_VER
+#pragma once
+#endif
+
+#ifdef USE_STL
+#include <string>
+#else
+#ifndef __clr_std_string_h__
+#define __clr_std_string_h__
+
+#include "clr_std/vector"
+
+namespace std
+{
+
+template<class T>
+class basic_string
+{
+public:
+ typedef T value_type;
+ typedef size_t size_type;
+ typedef typename vector<T>::iterator iterator;
+ typedef typename vector<T>::const_iterator const_iterator;
+
+ basic_string()
+ : m_string(1) // start with a string of length 1 for null terminator
+ {
+ m_string[0] = T();
+ }
+
+ basic_string(const basic_string<T>& _Right)
+ {
+ assign(_Right);
+ }
+
+ // Initialize a string with _Count characters from the string pointed at by _Ptr.
+ // If you want to include the trailing null character, _Count needs to include that.
+ basic_string(const value_type* _Ptr, size_type _Count)
+ : m_string(_Count + 1) // add 1 for a null terminator
+ {
+ copy(_Ptr, _Count);
+ }
+
+ basic_string(const value_type* _Ptr)
+ {
+ this->basic_string::basic_string(_Ptr, c_len(_Ptr));
+ }
+
+ void reserve(size_t newcapacity)
+ {
+ m_string.reserve(newcapacity + 1); // add 1 for the null terminator
+ }
+
+ //
+ // Assignment
+ //
+
+ basic_string<T>& operator=(const basic_string<T>& _Right)
+ {
+ if (this != &_Right)
+ {
+ assign(_Right);
+ }
+ return (*this);
+ }
+
+ basic_string<T>& assign(const basic_string<T>& _Right)
+ {
+ m_string.resize(_Right.size() + 1); // +1 for null terminator
+ copy(_Right);
+ return (*this);
+ }
+
+ //
+ // Basic data copying
+ //
+
+ void copy(const basic_string<T>& _Right)
+ {
+ assert(size() >= _Right.size());
+ size_type i;
+ for (i = 0; i < _Right.size(); i++)
+ {
+ m_string[i] = _Right.m_string[i];
+ }
+ m_string[i] = T();
+ }
+
+ void copy(const value_type* _Ptr, size_type _Count)
+ {
+ assert(size() >= _Count);
+ size_type i;
+ for (i = 0; i < _Count; i++)
+ {
+ m_string[i] = _Ptr[i];
+ }
+ m_string[i] = T();
+ }
+
+ //
+ // Appending
+ //
+
+ // Append a C-style string to the string.
+ basic_string<T>& operator+=(const value_type* _Ptr)
+ {
+ size_type oldsize = size(); // doesn't include null terminator
+ size_type addsize = c_len(_Ptr); // doesn't include null terminator
+ size_type newsize = oldsize + addsize + 1;
+ m_string.resize(newsize);
+ size_type i;
+ for (i = oldsize; i < newsize - 1; i++)
+ {
+ m_string[i] = *_Ptr++;
+ }
+ m_string[i] = T();
+ return (*this);
+ }
+
+ basic_string<T>& operator+=(const basic_string<T>& _Right)
+ {
+ size_type oldsize = size(); // doesn't include null terminator
+ size_type addsize = _Right.size(); // doesn't include null terminator
+ size_type newsize = oldsize + addsize + 1;
+ m_string.resize(newsize);
+ size_type new_index = oldsize, right_index = 0;
+ while (right_index < addsize)
+ {
+ m_string[new_index] = _Right.m_string[right_index];
+ ++new_index;
+ ++right_index;
+ }
+ m_string[new_index] = T();
+ return (*this);
+ }
+
+ ~basic_string()
+ {
+ // vector destructor does all the work
+ }
+
+ size_t size() const
+ {
+ assert(m_string.size() > 0);
+ return m_string.size() - 1; // Don't report the null terminator.
+ }
+
+ T& operator[](size_t iIndex)
+ {
+ assert(iIndex < size() + 1); // allow looking at the null terminator
+ return m_string[iIndex];
+ }
+
+ const T* c_str() const
+ {
+ return m_string.data();
+ }
+
+ iterator begin()
+ {
+ return m_string.begin();
+ }
+
+ iterator end()
+ {
+ return m_string.end();
+ }
+
+ const_iterator cbegin() const
+ {
+ return m_string.cbegin();
+ }
+
+ const_iterator cend() const
+ {
+ return m_string.cend();
+ }
+
+ basic_string<T> substr(size_type _Off = 0, size_type _Count = npos) const
+ {
+ size_type cursize = size();
+ if (_Off >= cursize)
+ {
+ // result will be empty
+ return basic_string<T>();
+ }
+ else
+ {
+ if ((_Count == npos) || // No count specified; take the whole string suffix
+ (_Off + _Count > cursize)) // Count specified is too many characters; just take the whole suffix
+ {
+ _Count = cursize - _Off;
+ }
+ return basic_string<T>(m_string.data() + _Off, _Count);
+ }
+ }
+
+ size_type find_last_of(value_type _Ch) const
+ {
+ for (size_type _Off = size(); _Off != 0; _Off--)
+ {
+ if (m_string[_Off - 1] == _Ch)
+ {
+ return _Off - 1;
+ }
+ }
+ return npos;
+ }
+
+ bool empty() const
+ {
+ return size() == 0;
+ }
+
+ int compare(const basic_string<T>& _Str) const
+ {
+ size_type i;
+ size_type compareSize = size();
+ if (_Str.size() < compareSize)
+ {
+ // This string is longer; compare character-by-character only as many characters as we have.
+ compareSize = _Str.size();
+ }
+ for (i = 0; i < compareSize; i++)
+ {
+ if (m_string[i] != _Str.m_string[i])
+ {
+ if (m_string[i] < _Str.m_string[i])
+ {
+ return -1;
+ }
+ else
+ {
+ return 1;
+ }
+ }
+ }
+
+ // All the characters we compared were identical, but one string might be longer than the other.
+ if (size() == _Str.size())
+ {
+ // We compared everything.
+ return 0;
+ }
+ else if (size() < _Str.size())
+ {
+ // _Str has more characters than this.
+ return -1;
+ }
+ else
+ {
+ // this has more characters than _Str
+ return 1;
+ }
+ }
+
+ static const size_type npos = size_type(-1);
+
+private:
+
+ // Compute the length in characters of a null-terminated C-style string, not including the trailing null character.
+ // _Ptr must not be nullptr.
+ size_type c_len(const value_type* _Ptr)
+ {
+ size_type count;
+ for (count = 0; *_Ptr != T(); _Ptr++)
+ {
+ count++;
+ }
+ return count;
+ }
+
+ vector<T> m_string; // use a vector<> to represent the string, to avoid reimplementing similar functionality
+
+}; // class basic_string
+
+//
+// String class instantiations
+//
+
+typedef basic_string<char> string;
+
+//
+// Numeric conversions
+//
+
+// convert integer T to string
+template<class T> inline
+string _IntToString(const char *_Fmt, T _Val)
+{
+ const size_t MaxIntBufSize = 21; /* can hold -2^63 and 2^64 - 1, plus NUL */
+ char buf[MaxIntBufSize];
+ int len = sprintf_s(buf, MaxIntBufSize, _Fmt, _Val);
+ return (string(buf, len));
+}
+
+inline string to_string(int _Val)
+{
+ return (_IntToString("%d", _Val));
+}
+
+inline string to_string(unsigned int _Val)
+{
+ return (_IntToString("%u", _Val));
+}
+
+inline string to_string(long _Val)
+{
+ return (_IntToString("%ld", _Val));
+}
+
+inline string to_string(unsigned long _Val)
+{
+ return (_IntToString("%lu", _Val));
+}
+
+inline string to_string(long long _Val)
+{
+ return (_IntToString("%lld", _Val));
+}
+
+inline string to_string(unsigned long long _Val)
+{
+ return (_IntToString("%llu", _Val));
+}
+
+//
+// Comparisons
+//
+
+template<class T> inline
+bool operator==(
+ const basic_string<T>& _Left,
+ const basic_string<T>& _Right)
+{
+ return (_Left.compare(_Right) == 0);
+}
+
+template<class T> inline
+bool operator!=(
+ const basic_string<T>& _Left,
+ const basic_string<T>& _Right)
+{
+ return (!(_Left == _Right));
+}
+
+template<class T> inline
+bool operator<(
+ const basic_string<T>& _Left,
+ const basic_string<T>& _Right)
+{
+ return (_Left.compare(_Right) < 0);
+}
+
+template<class T> inline
+bool operator>(
+ const basic_string<T>& _Left,
+ const basic_string<T>& _Right)
+{
+ return (_Right < _Left);
+}
+
+template<class T> inline
+bool operator<=(
+ const basic_string<T>& _Left,
+ const basic_string<T>& _Right)
+{
+ return (!(_Right < _Left));
+}
+
+template<class T> inline
+bool operator>=(
+ const basic_string<T>& _Left,
+ const basic_string<T>& _Right)
+{
+ return (!(_Left < _Right));
+}
+
+//
+// String concatenation and other string operations
+//
+
+template<class T> inline
+basic_string<T> operator+(
+ const basic_string<T>& _Left,
+ const basic_string<T>& _Right)
+{
+ basic_string<T> ret;
+ ret.reserve(_Left.size() + _Right.size());
+ ret += _Left;
+ ret += _Right;
+ return ret;
+}
+
+}; // namespace std
+
+#endif /* __clr_std_string_h__ */
+
+#endif // !USE_STL
+
+// Help the VIM editor figure out what kind of file this no-extension file is.
+// vim: filetype=cpp
diff --git a/src/inc/clr_std/type_traits b/src/inc/clr_std/type_traits
new file mode 100644
index 0000000000..090694e320
--- /dev/null
+++ b/src/inc/clr_std/type_traits
@@ -0,0 +1,549 @@
+// 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.
+
+//
+// clr_std/utility
+//
+// Copy of some key Standard Template Library functionality.
+// See http://msdn.microsoft.com/en-us/library/bb982077.aspx for documentation.
+//
+
+#ifdef _MSC_VER
+#pragma once
+#endif
+
+#ifndef __clr_std_type_traits_h__
+#define __clr_std_type_traits_h__
+
+#ifdef USE_STL
+
+#include <type_traits>
+
+#else
+
+namespace std
+{
+ //-----------------------------------------------------------------------------------------
+ // TEMPLATE CLASS remove_const
+ template<class _Ty>
+ struct remove_const
+ { // remove top level const qualifier
+ typedef _Ty type;
+ };
+
+ template<class _Ty>
+ struct remove_const<const _Ty>
+ { // remove top level const qualifier
+ typedef _Ty type;
+ };
+
+ template<class _Ty>
+ struct remove_const<const _Ty[]>
+ { // remove top level const qualifier
+ typedef _Ty type[];
+ };
+
+ template<class _Ty, unsigned int _Nx>
+ struct remove_const<const _Ty[_Nx]>
+ { // remove top level const qualifier
+ typedef _Ty type[_Nx];
+ };
+
+ //-----------------------------------------------------------------------------------------
+ // TEMPLATE CLASS remove_volatile
+ template<class _Ty>
+ struct remove_volatile
+ { // remove top level volatile qualifier
+ typedef _Ty type;
+ };
+
+ template<class _Ty>
+ struct remove_volatile<volatile _Ty>
+ { // remove top level volatile qualifier
+ typedef _Ty type;
+ };
+
+ template<class _Ty>
+ struct remove_volatile<volatile _Ty[]>
+ { // remove top level volatile qualifier
+ typedef _Ty type[];
+ };
+
+ template<class _Ty, unsigned int _Nx>
+ struct remove_volatile<volatile _Ty[_Nx]>
+ { // remove top level volatile qualifier
+ typedef _Ty type[_Nx];
+ };
+
+ //-----------------------------------------------------------------------------------------
+ // TEMPLATE CLASS remove_cv
+ template<class _Ty>
+ struct remove_cv
+ { // remove top level const and volatile qualifiers
+ typedef typename remove_const<typename remove_volatile<_Ty>::type>::type type;
+ };
+
+ //-----------------------------------------------------------------------------------------
+ // TEMPLATE remove_reference
+ template<class T>
+ struct remove_reference
+ { // remove reference
+ typedef T type;
+ };
+
+ template<class T>
+ struct remove_reference<T&>
+ { // remove reference
+ typedef T type;
+ };
+
+ template<class T>
+ struct remove_reference<T&&>
+ { // remove rvalue reference
+ typedef T type;
+ };
+
+ //-----------------------------------------------------------------------------------------
+ // TEMPLATE remove_pointer
+ template<class T>
+ struct remove_pointer
+ { // remove pointer
+ typedef T type;
+ };
+
+ template<class T>
+ struct remove_pointer<T*>
+ { // remove pointer
+ typedef T type;
+ };
+
+ //-----------------------------------------------------------------------------------------
+ // TEMPLATE FUNCTION identity
+ template<class T>
+ struct identity
+ { // map T to type unchanged
+ typedef T type;
+
+ inline
+ const T& operator()(const T& left) const
+ { // apply identity operator to operand
+ return (left);
+ }
+ };
+
+ //-----------------------------------------------------------------------------------------
+ // TEMPLATE CLASS integral_constant
+ template<class _Ty, _Ty _Val>
+ struct integral_constant
+ { // convenient template for integral constant types
+ static const _Ty value = _Val;
+
+ typedef _Ty value_type;
+ typedef integral_constant<_Ty, _Val> type;
+ };
+
+ typedef integral_constant<bool, true> true_type;
+ typedef integral_constant<bool, false> false_type;
+
+ // TEMPLATE CLASS _Cat_base
+ template<bool>
+ struct _Cat_base
+ : false_type
+ { // base class for type predicates
+ };
+
+ template<>
+ struct _Cat_base<true>
+ : true_type
+ { // base class for type predicates
+ };
+
+ //-----------------------------------------------------------------------------------------
+ // TEMPLATE CLASS enable_if
+ template<bool _Test, class _Type = void>
+ struct enable_if
+ { // type is undefined for assumed !_Test
+ };
+
+ template<class _Type>
+ struct enable_if<true, _Type>
+ { // type is _Type for _Test
+ typedef _Type type;
+ };
+
+ //-----------------------------------------------------------------------------------------
+ // TEMPLATE CLASS conditional
+ template<bool _Test, class _Ty1, class _Ty2>
+ struct conditional
+ { // type is _Ty2 for assumed !_Test
+ typedef _Ty2 type;
+ };
+
+ template<class _Ty1, class _Ty2>
+ struct conditional<true, _Ty1, _Ty2>
+ { // type is _Ty1 for _Test
+ typedef _Ty1 type;
+ };
+
+ //-----------------------------------------------------------------------------------------
+ // TEMPLATE CLASS is_lvalue_reference
+ template<class _Ty>
+ struct is_lvalue_reference
+ : false_type
+ { // determine whether _Ty is an lvalue reference
+ };
+
+ template<class _Ty>
+ struct is_lvalue_reference<_Ty&>
+ : true_type
+ { // determine whether _Ty is an lvalue reference
+ };
+
+ //-----------------------------------------------------------------------------------------
+ // TEMPLATE CLASS is_rvalue_reference
+ template<class _Ty>
+ struct is_rvalue_reference
+ : false_type
+ { // determine whether _Ty is an rvalue reference
+ };
+
+ template<class _Ty>
+ struct is_rvalue_reference<_Ty&&>
+ : true_type
+ { // determine whether _Ty is an rvalue reference
+ };
+
+ //-----------------------------------------------------------------------------------------
+ // TEMPLATE CLASS is_reference
+ template<class _Ty>
+ struct is_reference
+ : conditional<
+ is_lvalue_reference<_Ty>::value || is_rvalue_reference<_Ty>::value,
+ true_type,
+ false_type>::type
+ { // determine whether _Ty is a reference
+ };
+
+ // TEMPLATE CLASS is_pointer
+ template<class _Ty>
+ struct is_pointer
+ : false_type
+ { // determine whether _Ty is a pointer
+ };
+
+ template<class _Ty>
+ struct is_pointer<_Ty *>
+ : true_type
+ { // determine whether _Ty is a pointer
+ };
+
+ // TEMPLATE CLASS _Is_integral
+ template<class _Ty>
+ struct _Is_integral
+ : false_type
+ { // determine whether _Ty is integral
+ };
+
+ template<>
+ struct _Is_integral<bool>
+ : true_type
+ { // determine whether _Ty is integral
+ };
+
+ template<>
+ struct _Is_integral<char>
+ : true_type
+ { // determine whether _Ty is integral
+ };
+
+ template<>
+ struct _Is_integral<unsigned char>
+ : true_type
+ { // determine whether _Ty is integral
+ };
+
+ template<>
+ struct _Is_integral<signed char>
+ : true_type
+ { // determine whether _Ty is integral
+ };
+
+ #ifdef _NATIVE_WCHAR_T_DEFINED
+ template<>
+ struct _Is_integral<wchar_t>
+ : true_type
+ { // determine whether _Ty is integral
+ };
+ #endif /* _NATIVE_WCHAR_T_DEFINED */
+
+ template<>
+ struct _Is_integral<unsigned short>
+ : true_type
+ { // determine whether _Ty is integral
+ };
+
+ template<>
+ struct _Is_integral<signed short>
+ : true_type
+ { // determine whether _Ty is integral
+ };
+
+ template<>
+ struct _Is_integral<unsigned int>
+ : true_type
+ { // determine whether _Ty is integral
+ };
+
+ template<>
+ struct _Is_integral<signed int>
+ : true_type
+ { // determine whether _Ty is integral
+ };
+
+// On Unix 'long' is a 64-bit type (same as __int64) and the following two definitions
+// conflict with _Is_integral<unsigned __int64> and _Is_integral<signed __int64>.
+#ifndef PLATFORM_UNIX
+ template<>
+ struct _Is_integral<unsigned long>
+ : true_type
+ { // determine whether _Ty is integral
+ };
+
+ template<>
+ struct _Is_integral<signed long>
+ : true_type
+ { // determine whether _Ty is integral
+ };
+#endif /* PLATFORM_UNIX */
+
+ #if _HAS_CHAR16_T_LANGUAGE_SUPPORT
+ template<>
+ struct _Is_integral<char16_t>
+ : true_type
+ { // determine whether _Ty is integral
+ };
+
+ template<>
+ struct _Is_integral<char32_t>
+ : true_type
+ { // determine whether _Ty is integral
+ };
+ #endif /* _HAS_CHAR16_T_LANGUAGE_SUPPORT */
+
+ template<>
+ struct _Is_integral<unsigned __int64>
+ : true_type
+ { // determine whether _Ty is integral
+ };
+
+ template<>
+ struct _Is_integral<signed __int64>
+ : true_type
+ { // determine whether _Ty is integral
+ };
+
+ // TEMPLATE CLASS is_integral
+ template<class _Ty>
+ struct is_integral
+ : _Is_integral<typename remove_cv<_Ty>::type>
+ { // determine whether _Ty is integral
+ };
+
+ // TEMPLATE CLASS _Is_floating_point
+ template<class _Ty>
+ struct _Is_floating_point
+ : false_type
+ { // determine whether _Ty is floating point
+ };
+
+ template<>
+ struct _Is_floating_point<float>
+ : true_type
+ { // determine whether _Ty is floating point
+ };
+
+ template<>
+ struct _Is_floating_point<double>
+ : true_type
+ { // determine whether _Ty is floating point
+ };
+
+// In PAL, we define long as int and so this becomes int double,
+// which is a nonsense
+#ifndef FEATURE_PAL
+ template<>
+ struct _Is_floating_point<long double>
+ : true_type
+ { // determine whether _Ty is floating point
+ };
+#endif
+
+ // TEMPLATE CLASS is_floating_point
+ template<class _Ty>
+ struct is_floating_point
+ : _Is_floating_point<typename remove_cv<_Ty>::type>
+ { // determine whether _Ty is floating point
+ };
+
+ // TEMPLATE CLASS is_arithmetic
+ template<class _Ty>
+ struct is_arithmetic
+ : _Cat_base<is_integral<_Ty>::value
+ || is_floating_point<_Ty>::value>
+ { // determine whether _Ty is an arithmetic type
+ };
+
+ //-----------------------------------------------------------------------------------------
+ // TEMPLATE CLASS is_signed
+ template <typename T>
+ struct is_signed : conditional<
+ static_cast<typename remove_const<T>::type>(-1) < 0, true_type, false_type>::type {};
+
+ //-----------------------------------------------------------------------------------------
+ // TEMPLATE CLASS is_same
+ template<class T1, class T2>
+ struct is_same : false_type { };
+
+ //-----------------------------------------------------------------------------------------
+ template<class T1>
+ struct is_same<T1, T1> : true_type { };
+
+ //-----------------------------------------------------------------------------------------
+ // TEMPLATE CLASS is_base_of
+#ifdef _MSC_VER
+
+ template <typename TBase, typename TDerived>
+ struct is_base_of :
+ conditional<__is_base_of( TBase, TDerived), true_type, false_type>::type {};
+
+#else
+ namespace detail
+ {
+ //-------------------------------------------------------------------------------------
+ // Helper types Small and Big - guarantee that sizeof(Small) < sizeof(Big)
+ //
+
+ template <class T, class U>
+ struct conversion_helper
+ {
+ typedef char Small;
+ struct Big { char dummy[2]; };
+ static Big Test(...);
+ static Small Test(U);
+ static T MakeT();
+ };
+
+ //-------------------------------------------------------------------------------------
+ // class template conversion
+ // Figures out the conversion relationships between two types
+ // Invocations (T and U are types):
+ // a) conversion<T, U>::exists
+ // returns (at compile time) true if there is an implicit conversion from T
+ // to U (example: Derived to Base)
+ // b) conversion<T, U>::exists2Way
+ // returns (at compile time) true if there are both conversions from T
+ // to U and from U to T (example: int to char and back)
+ // c) conversion<T, U>::sameType
+ // returns (at compile time) true if T and U represent the same type
+ //
+ // NOTE: might not work if T and U are in a private inheritance hierarchy.
+ //
+
+ template <class T, class U>
+ struct conversion
+ {
+ typedef detail::conversion_helper<T, U> H;
+ static const bool exists = sizeof(typename H::Small) == sizeof((H::Test(H::MakeT())));
+ static const bool exists2Way = exists && conversion<U, T>::exists;
+ static const bool sameType = false;
+ };
+
+ template <class T>
+ struct conversion<T, T>
+ {
+ static const bool exists = true;
+ static const bool exists2Way = true;
+ static const bool sameType = true;
+ };
+
+ template <class T>
+ struct conversion<void, T>
+ {
+ static const bool exists = false;
+ static const bool exists2Way = false;
+ static const bool sameType = false;
+ };
+
+ template <class T>
+ struct conversion<T, void>
+ {
+ static const bool exists = false;
+ static const bool exists2Way = false;
+ static const bool sameType = false;
+ };
+
+ template <>
+ struct conversion<void, void>
+ {
+ static const bool exists = true;
+ static const bool exists2Way = true;
+ static const bool sameType = true;
+ };
+ } // detail
+
+ // Note that we need to compare pointer types here, since conversion of types by-value
+ // just tells us whether or not an implicit conversion constructor exists. We handle
+ // type parameters that are already pointers specially; see below.
+ template <typename TBase, typename TDerived>
+ struct is_base_of :
+ conditional<detail::conversion<TDerived *, TBase *>::exists, true_type, false_type>::type {};
+
+ // Specialization to handle type parameters that are already pointers.
+ template <typename TBase, typename TDerived>
+ struct is_base_of<TBase *, TDerived *> :
+ conditional<detail::conversion<TDerived *, TBase *>::exists, true_type, false_type>::type {};
+
+ // Specialization to handle invalid mixing of pointer types.
+ template <typename TBase, typename TDerived>
+ struct is_base_of<TBase *, TDerived> :
+ false_type {};
+
+ // Specialization to handle invalid mixing of pointer types.
+ template <typename TBase, typename TDerived>
+ struct is_base_of<TBase, TDerived *> :
+ false_type {};
+
+#endif
+
+ // Use to determine if a template type parameter is a string.
+ template <typename T>
+ struct is_cstr
+ : public std::false_type
+ {};
+
+ template <typename T>
+ struct is_cstr< T* >
+ : public std::conditional<
+ std::is_same<typename std::remove_cv<T>::type, char>::value ||
+ std::is_same<typename std::remove_cv<T>::type, wchar_t>::value,
+ std::true_type,
+ std::false_type>::type
+
+ { };
+
+} // namespace std
+
+#endif // !USE_STL
+
+#define REM_CONST(T) typename std::remove_const< T >::type
+#define REM_CV(T) typename std::remove_cv< T >::type
+#define REM_REF(T) typename std::remove_reference< T >::type
+
+#define REF_T(T) REM_REF(T) &
+#define REF_CT(T) REM_REF(REM_CONST(T)) const &
+
+#endif // __clr_std_type_traits_h__
+
+// Help the VIM editor figure out what kind of file this no-extension file is.
+// vim: filetype=cpp
diff --git a/src/inc/clr_std/utility b/src/inc/clr_std/utility
new file mode 100644
index 0000000000..fa2267578e
--- /dev/null
+++ b/src/inc/clr_std/utility
@@ -0,0 +1,254 @@
+// 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.
+
+//
+// clr_std/utility
+//
+// Copy of some key Standard Template Library functionality
+// See http://msdn.microsoft.com/en-us/library/bb982077.aspx for documentation.
+//
+
+#ifdef _MSC_VER
+#pragma once
+#endif
+
+#ifdef USE_STL
+#include <utility>
+#else
+#ifndef __clr_std_utility_h__
+#define __clr_std_utility_h__
+
+#include "clr_std/type_traits"
+
+namespace std
+{
+ //-----------------------------------------------------------------------------------------
+ // TEMPLATE FUNCTION move
+ template<class T> inline
+ typename remove_reference<T>::type&&
+ move(T&& arg)
+ { // forward _Arg as movable
+ return ((typename remove_reference<T>::type&&)arg);
+ }
+
+ //-----------------------------------------------------------------------------------------
+ // TEMPLATE FUNCTION swap (from <algorithm>)
+ template<class T> inline
+ void swap(T& left, T& right)
+ { // exchange values stored at left and right
+ T tmp = std::move(left);
+ left = std::move(right);
+ right = std::move(tmp);
+ }
+
+ //-----------------------------------------------------------------------------------------
+ // TEMPLATE FUNCTION forward
+ template<class T> inline
+ T&&
+ forward(typename identity<T>::type& _Arg)
+ { // forward _Arg, given explicitly specified type parameter
+ return ((T&&)_Arg);
+ }
+}
+
+namespace std
+{
+ //-----------------------------------------------------------------------------------------
+ // TEMPLATE STRUCT pair
+ template<class _Ty1, class _Ty2>
+ struct pair
+ { // store a pair of values
+ typedef pair<_Ty1, _Ty2> _Myt;
+ typedef _Ty1 first_type;
+ typedef _Ty2 second_type;
+
+ pair()
+ : first(_Ty1()), second(_Ty2())
+ { // construct from defaults
+ }
+
+ pair(const _Ty1& _Val1, const _Ty2& _Val2)
+ : first(_Val1.first), second(_Val2.second)
+ { // construct from specified values
+ }
+
+ template<class _Other1, class _Other2>
+ pair(pair<_Other1, _Other2>& _Right)
+ : first(_Right.first), second(_Right.second)
+ { // construct from compatible pair
+ }
+
+ template<class _Other1, class _Other2>
+ pair(const pair<_Other1, _Other2>& _Right)
+ : first(_Right.first), second(_Right.second)
+ { // construct from compatible pair
+ }
+
+ void swap(_Myt& _Right)
+ { // exchange contents with _Right
+ if (this != &_Right)
+ { // different, worth swapping
+ swap(this->first, _Right.first);
+ swap(this->second, _Right.second);
+ }
+ }
+
+ _Myt& operator=(const _Myt& _Right)
+ { // assign from copied pair
+ this->first = _Right.first;
+ this->second = _Right.second;
+ return (*this);
+ }
+
+ typedef typename remove_reference<_Ty1>::type _Ty1x;
+ typedef typename remove_reference<_Ty2>::type _Ty2x;
+
+ pair(_Ty1x&& _Val1, _Ty2x&& _Val2)
+ : first(std::move(_Val1)),
+ second(std::move(_Val2))
+ { // construct from specified values
+ }
+
+ pair(const _Ty1x& _Val1, _Ty2x&& _Val2)
+ : first(_Val1),
+ second(std::move(_Val2))
+ { // construct from specified values
+ }
+
+ pair(_Ty1x&& _Val1, const _Ty2x& _Val2)
+ : first(std::move(_Val1)),
+ second(_Val2)
+ { // construct from specified values
+ }
+
+ template<class _Other1, class _Other2>
+ pair(_Other1&& _Val1, _Other2&& _Val2)
+ : first(std::move(_Val1)),
+ second(std::move(_Val2))
+ { // construct from moved values
+ }
+
+ template<class _Other1, class _Other2>
+ pair(pair<_Other1, _Other2>&& _Right)
+ : first(std::move(_Right.first)),
+ second(std::move(_Right.second))
+ { // construct from moved compatible pair
+ }
+
+ pair& operator=(pair<_Ty1, _Ty2>&& _Right)
+ { // assign from moved pair
+ this->first = std::move(_Right.first);
+ this->second = std::move(_Right.second);
+ return (*this);
+ }
+
+ void swap(_Myt&& _Right)
+ { // exchange contents with _Right
+ if (this != &_Right)
+ { // different, worth swapping
+ this->first = std::move(_Right.first);
+ this->second = std::move(_Right.second);
+ }
+ }
+
+ _Ty1 first; // the first stored value
+ _Ty2 second; // the second stored value
+ }; // struct pair
+
+ //-----------------------------------------------------------------------------------------
+ // pair TEMPLATE FUNCTIONS
+
+ template<class _Ty1, class _Ty2> inline
+ void swap(pair<_Ty1, _Ty2>& _Left, pair<_Ty1, _Ty2>& _Right)
+ { // swap _Left and _Right pairs
+ _Left.swap(_Right);
+ }
+
+ template<class _Ty1, class _Ty2> inline
+ void swap(pair<_Ty1, _Ty2>& _Left, pair<_Ty1, _Ty2>&& _Right)
+ { // swap _Left and _Right pairs
+ typedef pair<_Ty1, _Ty2> _Myt;
+ _Left.swap(std::forward<_Myt>(_Right));
+ }
+
+ template<class _Ty1, class _Ty2> inline
+ void swap(
+ pair<_Ty1, _Ty2>&& _Left,
+ pair<_Ty1, _Ty2>& _Right)
+ { // swap _Left and _Right pairs
+ typedef pair<_Ty1, _Ty2> _Myt;
+ _Right.swap(std::forward<_Myt>(_Left));
+ }
+
+ template<class _Ty1, class _Ty2> inline
+ bool operator==(
+ const pair<_Ty1, _Ty2>& _Left,
+ const pair<_Ty1, _Ty2>& _Right)
+ { // test for pair equality
+ return (_Left.first == _Right.first && _Left.second == _Right.second);
+ }
+
+ template<class _Ty1, class _Ty2> inline
+ bool operator!=(
+ const pair<_Ty1, _Ty2>& _Left,
+ const pair<_Ty1, _Ty2>& _Right)
+ { // test for pair inequality
+ return (!(_Left == _Right));
+ }
+
+ template<class _Ty1, class _Ty2> inline
+ bool operator<(
+ const pair<_Ty1, _Ty2>& _Left,
+ const pair<_Ty1, _Ty2>& _Right)
+ { // test if _Left < _Right for pairs
+ return (_Left.first < _Right.first ||
+ (!(_Right.first < _Left.first) && _Left.second < _Right.second));
+ }
+
+ template<class _Ty1, class _Ty2> inline
+ bool operator>(
+ const pair<_Ty1, _Ty2>& _Left,
+ const pair<_Ty1, _Ty2>& _Right)
+ { // test if _Left > _Right for pairs
+ return (_Right < _Left);
+ }
+
+ template<class _Ty1, class _Ty2> inline
+ bool operator<=(
+ const pair<_Ty1, _Ty2>& _Left,
+ const pair<_Ty1, _Ty2>& _Right)
+ { // test if _Left <= _Right for pairs
+ return (!(_Right < _Left));
+ }
+
+ template<class _Ty1, class _Ty2> inline
+ bool operator>=(
+ const pair<_Ty1, _Ty2>& _Left,
+ const pair<_Ty1, _Ty2>& _Right)
+ { // test if _Left >= _Right for pairs
+ return (!(_Left < _Right));
+ }
+
+ template<class _InIt> inline
+ _InIt begin(
+ const pair<_InIt, _InIt>& _Pair)
+ { // return first element of pair
+ return (_Pair.first);
+ }
+
+ template<class _InIt> inline
+ _InIt end(
+ const pair<_InIt, _InIt>& _Pair)
+ { // return second element of pair
+ return (_Pair.second);
+ }
+
+} // namespace std
+
+#endif /* __clr_std_utility_h__ */
+
+#endif // !USE_STL
+
+// Help the VIM editor figure out what kind of file this no-extension file is.
+// vim: filetype=cpp
diff --git a/src/inc/clr_std/vector b/src/inc/clr_std/vector
new file mode 100644
index 0000000000..c81674617a
--- /dev/null
+++ b/src/inc/clr_std/vector
@@ -0,0 +1,431 @@
+// 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.
+
+//
+// clr_std/vector
+//
+// Copy of some key Standard Template Library functionality
+//
+
+#ifdef _MSC_VER
+#pragma once
+#endif
+
+#ifdef USE_STL
+#include <vector>
+#else
+#ifndef __clr_std_vector_h__
+#define __clr_std_vector_h__
+
+// This is defined in the debugmacrosext.h header, but don't take a dependency on that.
+#ifndef INDEBUG
+#ifdef _DEBUG
+#define INDEBUG(x) x
+#else
+#define INDEBUG(x)
+#endif
+#endif // !def INDEBUG
+
+namespace std
+{
+ template <class T>
+ class vector
+ {
+ public:
+ class const_iterator;
+
+ class iterator
+ {
+ friend class std::vector<T>::const_iterator;
+ public:
+ typedef T value_type;
+ typedef ptrdiff_t difference_type;
+ typedef T* pointer;
+ typedef T& reference;
+
+ typedef class vector<T>::iterator _MyIter;
+
+ _MyIter &operator++()
+ {
+ m_ptr++;
+ return *this;
+ }
+
+ _MyIter operator++(int)
+ {
+ // post-increment ++
+ _MyIter myiter(m_ptr);
+ m_ptr++;
+ return myiter;
+ }
+
+ _MyIter &operator--()
+ {
+ m_ptr--;
+ return *this;
+ }
+
+ _MyIter operator--(int)
+ {
+ // post-decrement --
+ _MyIter myiter(m_ptr);
+ m_ptr--;
+ return myiter;
+ }
+
+ _MyIter operator- (ptrdiff_t n)
+ {
+ _MyIter myiter(m_ptr);
+ myiter.m_ptr -= n;
+ return myiter;
+ }
+
+ ptrdiff_t operator- (_MyIter right)
+ {
+ _MyIter myiter(m_ptr);
+ return myiter.m_ptr - right.m_ptr;
+ }
+
+ _MyIter operator+ (ptrdiff_t n)
+ {
+ _MyIter myiter(m_ptr);
+ myiter.m_ptr += n;
+ return myiter;
+ }
+
+ T* operator->() const
+ {
+ return m_ptr;
+ }
+
+ T & operator*() const
+ {
+ return *m_ptr;
+ }
+
+ bool operator==(const _MyIter& _Right) const
+ {
+ bool equals = this->m_ptr == _Right.m_ptr;
+ return equals;
+ }
+
+ bool operator!=(const _MyIter& _Right) const
+ {
+ bool equals = this->m_ptr == _Right.m_ptr;
+ return !equals;
+ }
+
+ bool operator<(const _MyIter& _Right) const
+ {
+ return this->m_ptr < _Right.m_ptr;
+ }
+
+ bool operator>(const _MyIter& _Right) const
+ {
+ return this->m_ptr > _Right.m_ptr;
+ }
+ public:
+ explicit iterator(T* ptr)
+ {
+ m_ptr = ptr;
+ }
+
+ private:
+ T* m_ptr;
+ }; // class iterator
+
+ class const_iterator
+ {
+ public:
+ typedef class vector<T>::const_iterator _MyIter;
+ typedef class vector<T>::iterator _MyNonConstIter;
+
+ _MyIter &operator++()
+ {
+ m_ptr++;
+ return *this;
+ }
+
+ _MyIter operator++(int)
+ {
+ // post-increment ++
+ _MyIter myiter(m_ptr);
+ m_ptr++;
+ return myiter;
+ }
+
+ const T* operator->() const
+ {
+ return m_ptr;
+ }
+
+ const T & operator*() const
+ {
+ return *m_ptr;
+ }
+
+ bool operator==(const _MyIter& _Right) const
+ {
+ bool equals = this->m_ptr == _Right.m_ptr;
+ return equals;
+ }
+
+ bool operator!=(const _MyIter& _Right) const
+ {
+ bool equals = this->m_ptr == _Right.m_ptr;
+ return !equals;
+ }
+
+ public:
+ explicit const_iterator(T* ptr)
+ {
+ m_ptr = ptr;
+ }
+ const_iterator(const _MyNonConstIter &nonConstIterator)
+ {
+ m_ptr = nonConstIterator.m_ptr;
+ }
+
+ private:
+ T* m_ptr;
+ }; // class const iterator
+
+
+ public:
+ explicit vector(size_t n = 0)
+ {
+ m_size = 0;
+ m_capacity = 0;
+ m_pelements = NULL;
+ m_isBufferOwner = true;
+ resize(n);
+ }
+
+ ~vector()
+ {
+ if (m_isBufferOwner)
+ {
+ erase(m_pelements, 0, m_size);
+ delete [] (BYTE*)m_pelements; // cast to BYTE* as we don't want this delete to invoke T's dtor
+ }
+ else
+ {
+ m_size = 0;
+ m_capacity = 0;
+ }
+ }
+
+
+ size_t size() const
+ {
+ return m_size;
+ }
+
+ T & operator[](size_t iIndex)
+ {
+ assert(iIndex < m_size);
+ return m_pelements[iIndex];
+ }
+
+ T & operator[](size_t iIndex) const
+ {
+ assert(iIndex < m_size);
+ return m_pelements[iIndex];
+ }
+
+ void resize(size_t newsize)
+ {
+ assert(m_isBufferOwner);
+ size_t oldsize = this->size();
+ resize_noinit(newsize);
+ if (newsize > oldsize)
+ {
+ fill_uninitialized_with_default_value(m_pelements, oldsize, newsize);
+ }
+ }
+
+ void clear()
+ {
+ assert(m_isBufferOwner);
+ resize(0);
+ }
+
+ void resize(size_t newsize, T c)
+ {
+ assert(m_isBufferOwner);
+ size_t oldsize = this->size();
+ resize_noinit(newsize);
+ if (newsize > oldsize)
+ {
+ for (size_t i = oldsize; i < newsize; i++)
+ {
+ m_pelements[i] = c;
+ }
+ }
+ }
+
+ void wrap(size_t numElements, T* pElements)
+ {
+ m_size = numElements;
+ m_pelements = pElements;
+ m_isBufferOwner = false;
+ }
+
+ void resize_noinit(size_t newsize)
+ {
+ assert(m_isBufferOwner);
+ size_t oldsize = this->size();
+ if (newsize < oldsize)
+ {
+ // Shrink
+ erase(m_pelements, newsize, oldsize);
+ }
+ else if (newsize > oldsize)
+ {
+ // Grow
+ reserve(newsize);
+ }
+ m_size = newsize;
+ }
+
+ void push_back(const T & val)
+ {
+ assert(m_isBufferOwner);
+ if (m_size + 1 < m_size)
+ {
+ assert("push_back: overflow");
+ // @todo: how to throw.
+ }
+ resize(m_size + 1, val);
+ }
+
+ void reserve(size_t newcapacity)
+ {
+ assert(m_isBufferOwner);
+ if (newcapacity > m_capacity)
+ {
+ // To avoid resizing for every element that gets added to a vector, we
+ // allocate at least twice the old capacity, or 16 elements, whichever is greater.
+ newcapacity = max(newcapacity, max(m_capacity * 2, 16));
+
+ size_t bytesNeeded = newcapacity * sizeof(T);
+ if (bytesNeeded / sizeof(T) != newcapacity)
+ {
+ assert("resize: overflow");
+ // @todo: how to throw something here?
+ }
+
+
+ T *pelements = (T*)(new BYTE[bytesNeeded]); // Allocate as BYTE array to avoid automatic construction
+ INDEBUG(memset(pelements, 0xcc, bytesNeeded));
+ for (size_t i = 0; i < m_size; i++)
+ {
+ pelements[i] = m_pelements[i];
+ }
+
+ erase(m_pelements, 0, m_size);
+ delete [] (BYTE*)m_pelements; // cast to BYTE* as we don't want this delete to invoke T's dtor
+
+ m_pelements = pelements;
+ m_capacity = newcapacity;
+ }
+ }
+
+ iterator begin()
+ {
+ return iterator(m_pelements);
+ }
+
+ iterator end()
+ {
+ return iterator(m_pelements + m_size);
+ }
+
+ const_iterator cbegin() const
+ {
+ return const_iterator(m_pelements);
+ }
+
+ const_iterator cend() const
+ {
+ return const_iterator(m_pelements + m_size);
+ }
+
+ iterator erase(iterator position)
+ {
+ assert(m_isBufferOwner);
+ assert((position > begin() || position == begin()) && position < end());
+ ptrdiff_t index = position - begin();
+ erase(m_pelements, index, index + 1);
+ memcpy(&m_pelements[index], &m_pelements[index + 1], sizeof(T) * (m_size - index - 1));
+ --m_size;
+ return iterator(m_pelements + (position - begin()));
+ }
+
+ iterator erase(iterator position, iterator positionEnd)
+ {
+ assert(m_isBufferOwner);
+ assert((position > begin() || position == begin()) && position < end());
+ ptrdiff_t index = position - begin();
+ ptrdiff_t elements = positionEnd - position;
+ erase(m_pelements, index, index + elements);
+ memcpy(&m_pelements[index], &m_pelements[index + elements], sizeof(T) * (m_size - index - elements));
+ m_size -= elements;
+ return iterator(m_pelements + (position - begin()));
+ }
+
+ const T* data() const
+ {
+ return m_pelements;
+ }
+
+ private:
+ // Transition a subset of the array from uninitialized to initialized with default value for T.
+ static void fill_uninitialized_with_default_value(T* pelements, size_t startIdx, size_t endIdx)
+ {
+ assert(startIdx <= endIdx);
+ assert(pelements != NULL || startIdx == endIdx);
+ for (size_t i = startIdx; i < endIdx; i++)
+ {
+ INDEBUG(assert(0xcc == *((BYTE*)&pelements[i])));
+ pelements[i] = T();
+ }
+ }
+
+ // Transition a subset of the array from a valid value of T to uninitialized.
+ static void erase(T* pelements, size_t startIdx, size_t endIdx)
+ {
+ assert(startIdx <= endIdx);
+ assert(pelements != NULL || startIdx == endIdx);
+ for (size_t i = startIdx; i < endIdx; i++)
+ {
+ pelements[i].~T();
+ }
+
+ INDEBUG(memset(&pelements[startIdx], 0xcc, (endIdx - startIdx) * sizeof(T)));
+ }
+
+ private:
+ size_t m_size; //# of elements
+ size_t m_capacity; //# of elements allocated
+ T *m_pelements; //actual array
+ // invariants:
+ // dimensions == m_capacity
+ // elements 0 thru m_size-1 always contain constructed T values.
+ // elements from m_size thru m_capacity - 1 contain memory garbage (0xcc in DEBUG).
+ bool m_isBufferOwner; // indicate if this vector creates its own buffer, or wraps an existing buffer.
+
+
+
+
+ }; // class vector
+
+}; // namespace std
+
+#endif /* __clr_std_vector_h__ */
+
+#endif // !USE_STL
+
+// Help the VIM editor figure out what kind of file this no-extension file is.
+// vim: filetype=cpp
diff --git a/src/inc/clrconfig.h b/src/inc/clrconfig.h
new file mode 100644
index 0000000000..6d8c98190d
--- /dev/null
+++ b/src/inc/clrconfig.h
@@ -0,0 +1,259 @@
+// 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.
+//
+// --------------------------------------------------------------------------------------------------
+// CLRConfig.h
+//
+
+//
+// Unified method of accessing configuration values from environment variables, registry and config file(s).
+// This class replaces all GetConfigDWORD and GetConfigString methods in EEConfig and REGUTIL. To define a
+// flag, add an entry in the table in file:CLRConfigValues.h.
+//
+//
+//
+//
+// --------------------------------------------------------------------------------------------------
+
+
+#include "utilcode.h"
+#include "holder.h"
+#include "quirksapi.h"
+
+#ifndef __CLRConfig_h__
+#define __CLRConfig_h__
+
+class CLRConfig
+{
+public:
+ //
+ // Types
+ //
+
+ // Setting each option results in some change to the config value lookup method. Default behavior is (in
+ // the following order):
+ // * Look at environment variables (prepending COMPlus to the name)
+ // * Look at the framework registry keys (HKCU\Software\Microsoft\.NETFramework then
+ // HKLM\Software\Microsoft\.NETFramework)
+ // * Look at the available config files (system, application, host and user). For details see TODO:
+ // Link to BOTR documentation
+ enum LookupOptions {
+ // If set, don't look in environment variables.
+ IgnoreEnv = 0x1,
+ // If set, do not prepend "COMPlus_" when doing environment variable lookup.
+ DontPrependCOMPlus_ = 0x2,
+ // If set, don't look in HKLM in the registry.
+ IgnoreHKLM = 0x4,
+ // If set, don't look in HKCU in the registry.
+ IgnoreHKCU = 0x8,
+ // If set, don't look in any config files
+ IgnoreConfigFiles = 0x10,
+ // If set, look in config file(s) before looking in env/registry.
+ FavorConfigFile = 0x20,
+ // If set, look only in the system config file, ignoring other config files.
+ // (This option does not affect environment variable and registry lookups)
+ ConfigFile_SystemOnly = 0x40,
+ // If set, reverse the order of config file lookups (application config file first).
+ // (This option does not affect environment variable and registry lookups)
+ ConfigFile_ApplicationFirst = 0x80,
+ // Remove any whitespace at beginning and end of value. (Only applicable for
+ // *string* configuration values.)
+ TrimWhiteSpaceFromStringValue = 0x100,
+ // If set, check whether a PerformanceDefault is active for this value before using the built-in default
+ MayHavePerformanceDefault = 0x200,
+
+ // Legacy REGUTIL-style lookup.
+ REGUTIL_default = IgnoreConfigFiles,
+ // Legacy EEConfig-style lookup.
+ EEConfig_default = 0,
+
+ // If set, Ignore windows quirk DB lookup
+ IgnoreWindowsQuirkDB = 0x400,
+ };
+
+ // Function pointer definition used for calling EEConfig::GetConfigValueCallback .
+ typedef HRESULT (* GetConfigValueFunction)
+ (__in_z LPCWSTR /*pKey*/, __deref_out_opt LPCWSTR* /*value*/, BOOL /*systemOnly*/, BOOL /*applicationFirst*/);
+
+ // Function pointer definition used for calling PerformanceDefaults::LookupConfigValue
+ typedef BOOL (* GetPerformanceDefaultValueFunction)
+ (LPCWSTR /*name*/, DWORD* /*pValue*/);
+
+ // Struct used to store information about where/how to find a Config DWORD.
+ // NOTE: Please do NOT create instances of this struct. Use the macros in file:CLRConfigValues.h instead.
+ typedef struct ConfigDWORDInfo
+ {
+ LPCWSTR name;
+ DWORD defaultValue;
+ LookupOptions options;
+ } ConfigDWORDInfo;
+
+ // Struct used to store information about where/how to find a Config String.
+ // NOTE: Please do NOT create instances of this struct. Use the macros in file:CLRConfigValues.h instead.
+ typedef struct ConfigStringInfo
+ {
+ LPCWSTR name;
+ LookupOptions options;
+ } ConfigStringInfo;
+
+ //
+ // Declaring structs using the macro table in CLRConfigValues.h
+ //
+
+ // These macros declare ConfigDWORDInfo structs.
+ #define RETAIL_CONFIG_DWORD_INFO(symbol, name, defaultValue, description) \
+ static const ConfigDWORDInfo symbol;
+ #define RETAIL_CONFIG_DWORD_INFO_EX(symbol, name, defaultValue, description, lookupOptions) \
+ static const ConfigDWORDInfo symbol;
+
+ // These macros declare ConfigStringInfo structs.
+ #define RETAIL_CONFIG_STRING_INFO(symbol, name, description) \
+ static const ConfigStringInfo symbol;
+ #define RETAIL_CONFIG_STRING_INFO_EX(symbol, name, description, lookupOptions) \
+ static const ConfigStringInfo symbol;
+
+ // TEMPORARY macros that declare strings. These are used for config value accesses that haven't been
+ // moved over to CLRConfig yet. Once all accesses have been moved, these macros (and corresponding
+ // instantiations in file:../utilcode/CLRConfig.cpp) should be removed.
+ #define RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(symbol, name, description) \
+ static const LPCWSTR symbol;
+ #define RETAIL_CONFIG_STRING_INFO_DIRECT_ACCESS(symbol, name, description) \
+ static const LPCWSTR symbol;
+
+ //
+ // Debug versions of the macros
+ //
+#ifdef _DEBUG
+ #define CONFIG_DWORD_INFO(symbol, name, defaultValue, description) \
+ static const ConfigDWORDInfo symbol;
+ #define CONFIG_DWORD_INFO_EX(symbol, name, defaultValue, description, lookupOptions) \
+ static const ConfigDWORDInfo symbol;
+ #define CONFIG_STRING_INFO(symbol, name, description) \
+ static const ConfigStringInfo symbol;
+ #define CONFIG_STRING_INFO_EX(symbol, name, description, lookupOptions) \
+ static const ConfigStringInfo symbol;
+ #define CONFIG_DWORD_INFO_DIRECT_ACCESS(symbol, name, description) \
+ static const LPCWSTR symbol;
+ #define CONFIG_STRING_INFO_DIRECT_ACCESS(symbol, name, description) \
+ static const LPCWSTR symbol;
+#else
+ #define CONFIG_DWORD_INFO(symbol, name, defaultValue, description)
+ #define CONFIG_DWORD_INFO_EX(symbol, name, defaultValue, description, lookupOptions)
+ #define CONFIG_STRING_INFO(symbol, name, description)
+ #define CONFIG_STRING_INFO_EX(symbol, name, description, lookupOptions)
+ #define CONFIG_DWORD_INFO_DIRECT_ACCESS(symbol, name, description)
+ #define CONFIG_STRING_INFO_DIRECT_ACCESS(symbol, name, description)
+#endif // _DEBUG
+ // Now that we have defined what what the macros in file:CLRConfigValues.h mean, include it to generate the code.
+ #include "clrconfigvalues.h"
+
+ #undef RETAIL_CONFIG_DWORD_INFO
+ #undef RETAIL_CONFIG_STRING_INFO
+ #undef RETAIL_CONFIG_DWORD_INFO_EX
+ #undef RETAIL_CONFIG_STRING_INFO_EX
+ #undef RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS
+ #undef RETAIL_CONFIG_STRING_INFO_DIRECT_ACCESS
+ #undef CONFIG_DWORD_INFO
+ #undef CONFIG_STRING_INFO
+ #undef CONFIG_DWORD_INFO_EX
+ #undef CONFIG_STRING_INFO_EX
+ #undef CONFIG_DWORD_INFO_DIRECT_ACCESS
+ #undef CONFIG_STRING_INFO_DIRECT_ACCESS
+
+ //
+ // Methods to do config value (DWORD and String) lookups.
+ //
+#ifdef FEATURE_WIN_DB_APPCOMPAT
+ static HRESULT getQuirkEnabledAndValueFromWinDB(LPCWSTR wszQuirkName, BOOL* isEnabled, CPT_QUIRK_DATA* quirkData);
+#endif
+ static BOOL IsConfigEnabled(const ConfigDWORDInfo & info);
+
+ // Look up a DWORD config value.
+ static DWORD GetConfigValue(const ConfigDWORDInfo & info);
+
+ // Look up a DWORD config value.
+ static DWORD GetConfigValue(const ConfigDWORDInfo & info, bool acceptExplicitDefaultFromRegutil, /* [Out] */ bool *isDefault);
+
+ // Look up a string config value.
+ // You own the string that's returned.
+ static LPWSTR GetConfigValue(const ConfigStringInfo & info);
+
+ // Look up a string config value, passing it out through a pointer reference. Reports out of memory
+ // errors (HRESULT E_OUTOFMEMORY).
+ // You own the string that's returned.
+ static HRESULT GetConfigValue(const ConfigStringInfo & info, __deref_out_z LPWSTR * outVal);
+
+ //
+ // Check whether an option is specified (e.g. explicitly listed) in any of the CLRConfig
+ // locations: environment or registry (with or without COMPlus_) or any config file.
+ // The result is therefore a conservative approximation (some settings do not actually
+ // take effect everywhere and no setting is valid both with and without COMPlus_)
+ //
+ static BOOL IsConfigOptionSpecified(LPCWSTR name);
+
+ // Free a string returned by GetConfigValue
+ static void FreeConfigString(__in __in_z LPWSTR name);
+
+ // Register EEConfig's GetConfigValueCallback function so CLRConfig can look in config files.
+ static void RegisterGetConfigValueCallback(GetConfigValueFunction func);
+
+ // Register PerformanceDefaults' LookupConfigValue so CLRConfig can support 'MayHavePerformanceDefault' values
+ static void RegisterGetPerformanceDefaultValueCallback(GetPerformanceDefaultValueFunction func);
+
+#ifdef FEATURE_WIN_DB_APPCOMPAT
+ static void RegisterWinDbQuirkApis(PFN_CptQuirkIsEnabled3 func1, PFN_CptQuirkGetData2 func2);
+#endif // FEATURE_WIN_DB_APPCOMPAT
+
+
+private:
+ // Function pointer to EEConfig's GetConfigValueCallback function (can't static bind from utilcode to VM)
+ static GetConfigValueFunction s_GetConfigValueCallback;
+
+ // Function pointer to PerformanceDefaults' LookupConfigValue function (can't static bind from utilcode to VM)
+ static GetPerformanceDefaultValueFunction s_GetPerformanceDefaultValueCallback;
+
+#ifdef FEATURE_WIN_DB_APPCOMPAT
+ static PFN_CptQuirkIsEnabled3 s_IsQuirkEnabledCallback;
+ static PFN_CptQuirkGetData2 s_GetQuirkValueCallback;
+#endif // FEATURE_WIN_DB_APPCOMPAT
+
+ // Helper method to translate LookupOptions to REGUTIL::CORConfigLevel
+ static REGUTIL::CORConfigLevel GetConfigLevel(LookupOptions options);
+
+ //
+ // Helper methods.
+ //
+
+ // Helper method to check if a certain option is set in a ConfigDWORDInfo struct.
+ static inline BOOL CheckLookupOption(const ConfigDWORDInfo & info, LookupOptions option)
+ {
+ LIMITED_METHOD_CONTRACT;
+ return ((info.options & option) == option) ? TRUE : FALSE;
+ }
+
+ // Helper method to check if a certain option is set in a ConfigStringInfo struct.
+ static inline BOOL CheckLookupOption(const ConfigStringInfo & info, LookupOptions option)
+ {
+ LIMITED_METHOD_CONTRACT;
+ return ((info.options & option) == option) ? TRUE : FALSE;
+ }
+
+ // Helper method to check if a certain option is set in an options enum.
+ static inline BOOL CheckLookupOption(LookupOptions infoOptions, LookupOptions optionToCheck)
+ {
+ LIMITED_METHOD_CONTRACT;
+ return ((infoOptions & optionToCheck) == optionToCheck) ? TRUE : FALSE;
+ }
+
+ static HRESULT TrimWhiteSpace(LPCWSTR wszOrig, __deref_out_z LPWSTR * pwszTrimmed);
+};
+
+inline CLRConfig::LookupOptions operator|(CLRConfig::LookupOptions lhs, CLRConfig::LookupOptions rhs)
+{
+ return static_cast<CLRConfig::LookupOptions>(static_cast<DWORD>(lhs) | static_cast<DWORD>(rhs));
+}
+
+typedef Wrapper<LPWSTR, DoNothing, CLRConfig::FreeConfigString, NULL> CLRConfigStringHolder;
+
+#endif //__CLRConfig_h__
diff --git a/src/inc/clrconfigvalues.h b/src/inc/clrconfigvalues.h
new file mode 100644
index 0000000000..d6a362e0df
--- /dev/null
+++ b/src/inc/clrconfigvalues.h
@@ -0,0 +1,1186 @@
+// 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.
+//*****************************************************************************
+// CLRConfigValues.h
+//
+
+//
+// Unified method of accessing configuration values from environment variables,
+// registry and config file.
+//
+//*****************************************************************************
+
+// IMPORTANT: Before adding a new config value, please read up on naming conventions (see
+// code:#NamingConventions)
+//
+// ==========
+// CONTENTS
+// ==========
+// * How to define config values (see code:#Define)
+// * How to access config values (see code:#Access)
+// * Naming conventions (see code:#NamingConventions)
+//
+//
+// =====================================
+// #Define - Use one of the following macros to define config values. (See code:#DWORDs and code:#Strings)
+// =====================================
+//
+// By default, all macros are DEBUG ONLY. Add the "RETAIL_" prefix to make the config value available in retail builds.
+//
+// #DWORDs:
+// --------------------------------------------------------------------------
+// CONFIG_DWORD_INFO(symbol, name, defaultValue, description)
+// --------------------------------------------------------------------------
+// Use this macro to define a basic DWORD value. CLRConfig will look in environment variables (adding
+// COMPlus_ to the name), the registry (HKLM and HKCU), and all the config files for this value. To customize
+// where CLRConfig looks, use the extended version of the macro below. IMPORTANT: please follow the
+// code:#NamingConventions for the symbol and the name!
+//
+// Example: CONFIG_DWORD_INFO(INTERNAL_AllowCrossModuleInlining, W("AllowCrossModuleInlining"), 0, "")
+//
+// --------------------------------------------------------------------------
+// CONFIG_DWORD_INFO_EX(symbol, name, defaultValue, description, lookupOptions)
+// --------------------------------------------------------------------------
+// To customize where CLRConfig looks to get a DWORD, use the extended (_EX) version of the macro. For a list
+// of options and their descriptions, see code:CLRConfig.LookupOptions
+//
+// Example: CONFIG_DWORD_INFO_EX(INTERNAL_EnableInternetHREFexes, W("EnableInternetHREFexes"), 0, "",
+// (CLRConfig::LookupOptions) (CLRConfig::IgnoreEnv | CLRConfig::IgnoreHKCU))
+//
+// #Strings:
+// --------------------------------------------------------------------------
+// CONFIG_STRING_INFO(symbol, name, description)
+// --------------------------------------------------------------------------
+// Defines a string value. Same rules apply as DWORDs.
+//
+// --------------------------------------------------------------------------
+// CONFIG_STRING_INFO_EX(symbol, name, description, lookupOptions)
+// --------------------------------------------------------------------------
+// Extended version of the String macro. Again, similar to the DWORD extended macro.
+//
+//
+// ===============================================================
+// #Access - Use the following overloaded method to access config values.
+// ===============================================================
+// From anywhere, use CLRConfig::GetConfigValue(CLRConfig::<symbol>) to access any value defined in this
+// file.
+//
+//
+// ===============================================================
+// #NamingConventions
+// ===============================================================
+// ----------------
+// #Symbol - used to access values from the source. (using CLRConfig::<symbol>)
+// ----------------
+// The symbol for each config value is named as such:
+// ### <Class>_<feature area>_<name> ###
+//
+// <Class> indicates which of the following buckets the value is in:
+// * INTERNAL ? this value is for internal (CLR team) use only
+// * UNSUPPORTED ? this value is available to partners/developers, but is not officially supported
+// * EXTERNAL ? this value is available for anyone to use and is publicly documented
+//
+// Examples:
+// * INTERNAL_Security_FullAccessChecks
+// * UNSUPPORTED_Security_DisableTransparency
+// * EXTERNAL_Security_LegacyHMACMode
+//
+// ----------------
+// #Name - the name of the registry value or environment variable that CLRConfig looks up.
+// ----------------
+// The name of each value is the same as the symbol, with one exception. Names of external values do NOT
+// contain the EXTERNAL prefix.
+//
+// For compatibility reasons, current names do not follow the convention.
+//
+// Examples:
+// * W("INTERNAL_Security_FullAccessChecks")
+// * W("UNSUPPORTED_Security_DisableTransparency")
+// * W("Security_LegacyHMACMode") <---------------------- (No EXTERNAL prefix)
+
+//
+// AppDomain
+//
+CONFIG_DWORD_INFO(INTERNAL_ADBreakOnCannotUnload, W("ADBreakOnCannotUnload"), 0, "Used to troubleshoot failures to unload appdomain (e.g. someone sitting in unmanged code). In some cases by the time we throw the appropriate exception the thread has moved from the offending call. This setting allows in an instrumented build to stop exactly at the right moment.")
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(UNSUPPORTED_AddRejitNops, W("AddRejitNops"), "Control for the profiler rejit feature infrastructure")
+CONFIG_DWORD_INFO(INTERNAL_ADDumpSB, W("ADDumpSB"), 0, "Not used")
+CONFIG_DWORD_INFO(INTERNAL_ADForceSB, W("ADForceSB"), 0, "Forces sync block creation for all objects")
+CONFIG_DWORD_INFO(INTERNAL_ADLogMemory, W("ADLogMemory"), 0, "Superseded by test hooks")
+CONFIG_DWORD_INFO(INTERNAL_ADTakeDHSnapShot, W("ADTakeDHSnapShot"), 0, "Superseded by test hooks")
+CONFIG_DWORD_INFO(INTERNAL_ADTakeSnapShot, W("ADTakeSnapShot"), 0, "Superseded by test hooks")
+CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_EnableFullDebug, W("EnableFullDebug"), "Heavy-weight checking for AD boundary violations (AD leaks)")
+RETAIL_CONFIG_DWORD_INFO(INTERNAL_DisableMSIPeek, W("DisableMSIPeek"), 0, "Disable MSI check in Fusion")
+CONFIG_DWORD_INFO(INTERNAL_MsiPeekForbid, W("MsiPeekForbid"), 0, "Assert on MSI calls")
+RETAIL_CONFIG_DWORD_INFO(EXTERNAL_ADULazyMemoryRelease, W("ADULazyMemoryRelease"), 1, "On by default. Turned off in cases when people try to catch memory leaks, in which case AD unload should be immediately followed by GC)")
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(EXTERNAL_ADURetryCount, W("ADURetryCount"), "Controls timeout of AD unload. Used for workarounds when machine is too slow, there are network issues etc.")
+RETAIL_CONFIG_STRING_INFO_EX(EXTERNAL_LEGACY_APPDOMAIN_MANAGER_ASM, W("APPDOMAIN_MANAGER_ASM"), "Legacy method to specify the assembly containing the AppDomainManager to use for the default domain", CLRConfig::DontPrependCOMPlus_ | CLRConfig::IgnoreHKLM | CLRConfig::IgnoreHKCU)
+RETAIL_CONFIG_STRING_INFO_EX(EXTERNAL_LEGACY_APPDOMAIN_MANAGER_TYPE, W("APPDOMAIN_MANAGER_TYPE"), "LegacyMethod to specify the type containing the AppDomainManager to use for the default domain", CLRConfig::DontPrependCOMPlus_ | CLRConfig::IgnoreHKLM | CLRConfig::IgnoreHKCU)
+RETAIL_CONFIG_STRING_INFO_EX(EXTERNAL_AppDomainManagerAsm, W("appDomainManagerAssembly"), "Config file switch to specify the assembly for the default AppDomainManager.", CLRConfig::IgnoreEnv | CLRConfig::IgnoreHKLM | CLRConfig::IgnoreHKCU)
+RETAIL_CONFIG_STRING_INFO_EX(EXTERNAL_AppDomainManagerType, W("appDomainManagerType"), "Config file switch to specify the type for the default AppDomainManager.", CLRConfig::IgnoreEnv | CLRConfig::IgnoreHKLM | CLRConfig::IgnoreHKCU)
+CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_AppDomainAgilityChecked, W("AppDomainAgilityChecked"), "Used to detect AD boundary violations (AD leaks)")
+CONFIG_DWORD_INFO(INTERNAL_AppDomainNoUnload, W("AppDomainNoUnload"), 0, "Not used")
+RETAIL_CONFIG_STRING_INFO_EX(INTERNAL_TargetFrameworkMoniker, W("TargetFrameworkMoniker"), "Allows the test team to specify what TargetFrameworkMoniker to use.", CLRConfig::IgnoreHKLM | CLRConfig::IgnoreHKCU | CLRConfig::IgnoreConfigFiles | CLRConfig::IgnoreWindowsQuirkDB)
+RETAIL_CONFIG_STRING_INFO_EX(INTERNAL_AppContextSwitchOverrides, W("AppContextSwitchOverrides"), "Allows default switch values defined in AppContext to be overwritten by values in the Config", CLRConfig::IgnoreEnv | CLRConfig::IgnoreHKLM | CLRConfig::IgnoreHKCU | CLRConfig::IgnoreWindowsQuirkDB | CLRConfig::ConfigFile_ApplicationFirst)
+
+#ifdef FEATURE_CORECLR
+// For the proposal and discussion on why finalizers are not run on shutdown by default anymore in CoreCLR, see the API review:
+// https://github.com/dotnet/corefx/issues/5205
+#define DEFAULT_FinalizeOnShutdown (0)
+#else
+#define DEFAULT_FinalizeOnShutdown (1)
+#endif
+RETAIL_CONFIG_DWORD_INFO(EXTERNAL_FinalizeOnShutdown, W("FinalizeOnShutdown"), DEFAULT_FinalizeOnShutdown, "When enabled, on shutdown, blocks all user threads and calls finalizers for all finalizable objects, including live objects")
+
+//
+// ARM
+//
+RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_ARMEnabled, W("ARMEnabled"), (DWORD)0, "Set it to 1 to enable ARM")
+
+//
+// Assembly Loader
+//
+RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_DesignerNamespaceResolutionEnabled, W("designerNamespaceResolution"), FALSE, "Set it to 1 to enable DesignerNamespaceResolve event for WinRT types", CLRConfig::IgnoreEnv | CLRConfig::IgnoreHKLM | CLRConfig::IgnoreHKCU | CLRConfig::FavorConfigFile)
+CONFIG_DWORD_INFO_EX(INTERNAL_GetAssemblyIfLoadedIgnoreRidMap, W("GetAssemblyIfLoadedIgnoreRidMap"), 0, "Used to force loader to ignore assemblies cached in the rid-map", CLRConfig::REGUTIL_default)
+
+//
+// BCL
+//
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_BCLCorrectnessWarnings, W("BCLCorrectnessWarnings"), "Flag a few common correctness bugs in the library with additional runtime checks.")
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_BCLPerfWarnings, W("BCLPerfWarnings"), "Flag some performance-related problems via asserts when people mis-use the library.")
+RETAIL_CONFIG_DWORD_INFO(EXTERNAL_TimeSpan_LegacyFormatMode, W("TimeSpan_LegacyFormatMode"), 0, "Flag to enable System.TimeSpan legacy (.NET Framework 3.5 and earlier) ToString behavior.")
+RETAIL_CONFIG_DWORD_INFO(EXTERNAL_CompatSortNLSVersion, W("CompatSortNLSVersion"), 0, "Determines the version of desired sorting behavior for AppCompat.")
+RETAIL_CONFIG_DWORD_INFO(EXTERNAL_NetFx45_CultureAwareComparerGetHashCode_LongStrings, W("NetFx45_CultureAwareComparerGetHashCode_LongStrings"), 0, "Opt in to use the new (as of v4.5) constant space hash algorithm for strings")
+RETAIL_CONFIG_DWORD_INFO(EXTERNAL_Resources_DisableUserPreferredFallback, W("DisableUserPreferredFallback"), 0, "Resource lookups should be dependent only on the CurrentUICulture, not a user-defined list of preferred languages nor the OS preferred fallback language. Intended to avoid falling back to a right-to-left language, which is undisplayable in console apps.")
+RETAIL_CONFIG_DWORD_INFO(EXTERNAL_RelativeBindForResources , W("relativeBindForResources"), 0, "Enables probing for satellite assemblies only next to the parent assembly")
+RETAIL_CONFIG_DWORD_INFO(EXTERNAL_NetFx45_LegacyManagedDeflateStream, W("NetFx45_LegacyManagedDeflateStream"), 0, "Flag to enable legacy managed implementation of the deflater used by System.IO.Compression.DeflateStream.")
+RETAIL_CONFIG_DWORD_INFO(EXTERNAL_DateTime_NetFX35ParseMode, W("DateTime_NetFX35ParseMode"), 0, "Flag to enable the .NET 3.5 System.DateTime Token Replacement Policy")
+RETAIL_CONFIG_DWORD_INFO(EXTERNAL_ThrowUnobservedTaskExceptions, W("ThrowUnobservedTaskExceptions"), 0, "Flag to propagate unobserved task exceptions on the finalizer thread.")
+RETAIL_CONFIG_DWORD_INFO(EXTERNAL_DateTime_NetFX40AmPmParseAdjustment, W("EnableAmPmParseAdjustment"), 0, "Flag to enable the .NET 4.0 DateTimeParse to correctly parse AM/PM cases")
+#ifdef FEATURE_RANDOMIZED_STRING_HASHING
+RETAIL_CONFIG_DWORD_INFO(EXTERNAL_UseRandomizedStringHashAlgorithm, W("UseRandomizedStringHashAlgorithm"), 0, "Flag to use a string hashing algorithm who's behavior differs between AppDomains")
+#endif // FEATURE_RANDOMIZED_STRING_HASHING
+#ifdef FEATURE_APPX
+RETAIL_CONFIG_DWORD_INFO(INTERNAL_Windows8ProfileAPICheckFlag, W("Windows8ProfileAPICheckFlag"), 0, "Windows 8 Profile API check behavior (non-W8P framework APIs cannot be accessed through Reflection and RefEmit). 0: normal (only check in non-dev-mode APPX). 1: always check. 2: never check.");
+#endif
+
+//
+// Conditional breakpoints
+//
+RETAIL_CONFIG_DWORD_INFO_EX(UNSUPPORTED_BreakOnBadExit, W("BreakOnBadExit"), 0, "", CLRConfig::REGUTIL_default)
+CONFIG_STRING_INFO(INTERNAL_BreakOnClassBuild, W("BreakOnClassBuild"), "Very useful for debugging class layout code.")
+CONFIG_STRING_INFO(INTERNAL_BreakOnClassLoad, W("BreakOnClassLoad"), "Very useful for debugging class loading code.")
+CONFIG_STRING_INFO(INTERNAL_BreakOnComToClrNativeInfoInit, W("BreakOnComToClrNativeInfoInit"), "Throws an assert when native information about a COM -> CLR call are about to be gathered.")
+CONFIG_DWORD_INFO_EX(INTERNAL_BreakOnDebugBreak, W("BreakOnDebugBreak"), 0, "allows an assert in debug builds when a user break is hit", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_BreakOnDILoad, W("BreakOnDILoad"), 0, "allows an assert when the DI is loaded", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_BreakOnDumpToken, W("BreakOnDumpToken"), 0xffffffff, "Breaks when using internal logging on a particular token value.", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_EX(UNSUPPORTED_BreakOnEELoad, W("BreakOnEELoad"), 0, "", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO(INTERNAL_BreakOnEEShutdown, W("BreakOnEEShutdown"), 0, "")
+CONFIG_DWORD_INFO_EX(INTERNAL_BreakOnExceptionInGetThrowable, W("BreakOnExceptionInGetThrowable"), 0, "", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_BreakOnFinalizeTimeOut, W("BreakOnFinalizeTimeOut"), 0, "Triggers a debug break on the finalizer thread when it has exceeded the maximum wait time")
+CONFIG_DWORD_INFO(INTERNAL_BreakOnFindMethod, W("BreakOnFindMethod"), 0, "Breaks in findMethodInternal when it searches for the specified token.")
+CONFIG_DWORD_INFO_EX(INTERNAL_BreakOnFirstPass, W("BreakOnFirstPass"), 0, "", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_BreakOnHR, W("BreakOnHR"), 0, "Debug.cpp, IfFailxxx use this macro to stop if hr matches ", CLRConfig::REGUTIL_default)
+CONFIG_STRING_INFO(INTERNAL_BreakOnInstantiation, W("BreakOnInstantiation"), "Very useful for debugging generic class instantiation.")
+CONFIG_STRING_INFO(INTERNAL_BreakOnInteropStubSetup, W("BreakOnInteropStubSetup"), "Throws an assert when marshaling stub for the given method is about to be built.")
+CONFIG_STRING_INFO_EX(INTERNAL_BreakOnInteropVTableBuild, W("BreakOnInteropVTableBuild"), "Specifies a type name for which an assert should be thrown when building interop v-table.", CLRConfig::REGUTIL_default)
+CONFIG_STRING_INFO(INTERNAL_BreakOnMethodName, W("BreakOnMethodName"), "Very useful for debugging method override placement code.")
+RETAIL_CONFIG_DWORD_INFO_EX(UNSUPPORTED_BreakOnNGenRegistryAccessCount, W("BreakOnNGenRegistryAccessCount"), 0, "Breaks on the Nth' root store write", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_BreakOnNotify, W("BreakOnNotify"), 0, "", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_EX(INTERNAL_BreakOnRetailAssert, W("BreakOnRetailAssert"), 0, "Used for debugging \"retail\" asserts (fatal errors)", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_BreakOnSecondPass, W("BreakOnSecondPass"), 0, "", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_EX(UNSUPPORTED_BreakOnSO, W("BreakOnSO"), 0, "", CLRConfig::REGUTIL_default)
+CONFIG_STRING_INFO(INTERNAL_BreakOnStructMarshalSetup, W("BreakOnStructMarshalSetup"), "Throws an assert when field marshalers for the given type with layout are about to be created.")
+CONFIG_DWORD_INFO_EX(INTERNAL_BreakOnUEF, W("BreakOnUEF"), 0, "", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_BreakOnUncaughtException, W("BreakOnUncaughtException"), 0, "", CLRConfig::REGUTIL_default)
+
+//
+// CSE
+//
+CONFIG_STRING_INFO_EX(INTERNAL_CseBinarySearch, W("CseBinarySearch"), "Sets internal jit constants for CSE", CLRConfig::REGUTIL_default)
+CONFIG_STRING_INFO_EX(INTERNAL_CseMax, W("CseMax"), "Sets internal jit constants for CSE", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_STRING_INFO_EX(UNSUPPORTED_CseOn, W("CseOn"), "Internal Jit control of CSE", CLRConfig::REGUTIL_default)
+CONFIG_STRING_INFO_EX(INTERNAL_CseStats, W("CseStats"), "Collects CSE statistics", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_D__FCE, W("D::FCE"), 0, "allows an assert when crawling the managed stack for an exception handler", CLRConfig::REGUTIL_default)
+
+//
+// Debugger
+//
+CONFIG_DWORD_INFO_EX(INTERNAL_DbgBreakIfLocksUnavailable, W("DbgBreakIfLocksUnavailable"), 0, "allows an assert when the debugger can't take a lock ", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_DbgBreakOnErr, W("DbgBreakOnErr"), 0, "allows an assert when we get a failing hresult", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_DbgBreakOnMapPatchToDJI, W("DbgBreakOnMapPatchToDJI"), 0, "allows an assert when mapping a patch to an address", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_DbgBreakOnRawInt3, W("DbgBreakOnRawInt3"), 0, "allows an assert for test coverage for debug break or other int3 breaks", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_DbgBreakOnSendBreakpoint, W("DbgBreakOnSendBreakpoint"), 0, "allows an assert when sending a breakpoint to the right side", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_DbgBreakOnSetIP, W("DbgBreakOnSetIP"), 0, "allows an assert when setting the IP", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_DbgCheckInt3, W("DbgCheckInt3"), 0, "asserts if the debugger explicitly writes int3 instead of calling SetUnmanagedBreakpoint", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_DbgDACAssertOnMismatch, W("DbgDACAssertOnMismatch"), "allows an assert when the mscordacwks and mscorwks dll versions don't match")
+CONFIG_DWORD_INFO_EX(INTERNAL_DbgDACEnableAssert, W("DbgDACEnableAssert"), 0, "Enables extra validity checking in DAC - assumes target isn't corrupt", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_EX(INTERNAL_DbgDACSkipVerifyDlls, W("DbgDACSkipVerifyDlls"), 0, "allows disabling the check to ensure mscordacwks and mscorwks dll versions match", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_DbgDelayHelper, W("DbgDelayHelper"), 0, "varies the wait in the helper thread startup for testing race between threads", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_EX(INTERNAL_DbgDisableDynamicSymsCompat, W("DbgDisableDynamicSymsCompat"), 0, "", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_DbgDisableTargetConsistencyAsserts, W("DbgDisableTargetConsistencyAsserts"), 0, "allows explicitly testing with corrupt targets", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_EX(INTERNAL_DbgEnableMixedModeDebugging, W("DbgEnableMixedModeDebuggingInternalOnly"), 0, "", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_DbgExtraThreads, W("DbgExtraThreads"), 0, "allows extra unmanaged threads to run and throw debug events for stress testing", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_DbgExtraThreadsCantStop, W("DbgExtraThreadsCantStop"), 0, "allows extra unmanaged threads in can't stop region to run and throw debug events for stress testing", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_DbgExtraThreadsIB, W("DbgExtraThreadsIB"), 0, "allows extra in-band unmanaged threads to run and throw debug events for stress testing", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_DbgExtraThreadsOOB, W("DbgExtraThreadsOOB"), 0, "allows extra out of band unmanaged threads to run and throw debug events for stress testing", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_DbgFaultInHandleIPCEvent, W("DbgFaultInHandleIPCEvent"), 0, "allows testing the unhandled event filter", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_DbgInjectFEE, W("DbgInjectFEE"), 0, "allows injecting a fatal execution error for testing Watson", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_DbgLeakCheck, W("DbgLeakCheck"), 0, "allows checking for leaked Cordb objects", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_DbgNo2ndChance, W("DbgNo2ndChance"), 0, "allows breaking on (and catching bogus) 2nd chance exceptions", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_DbgNoDebugger, W("DbgNoDebugger"), 0, "allows breaking if we don't want to lazily initialize the debugger", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_EX(UNSUPPORTED_DbgNoForceContinue, W("DbgNoForceContinue"), 1, "used to force a continue on longhorn", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_DbgNoOpenMDByFile, W("DbgNoOpenMDByFile"), 0, "allows opening MD by memory for perf testing", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO(INTERNAL_DbgOOBinFEEE, W("DbgOOBinFEEE"), 0, "allows forcing oob breakpoints when a fatal error occurs")
+RETAIL_CONFIG_STRING_INFO_DIRECT_ACCESS(EXTERNAL_DbgPackShimPath, W("DbgPackShimPath"), "CoreCLR path to dbgshim.dll - we are trying to figure out if we can remove this")
+CONFIG_DWORD_INFO_EX(INTERNAL_DbgPingInterop, W("DbgPingInterop"), 0, "allows checking for deadlocks in interop debugging", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_DbgRace, W("DbgRace"), 0, "allows pausing for native debug events to get hijicked", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_EX(UNSUPPORTED_DbgRedirect, W("DbgRedirect"), 0, "allows for redirecting the event pipeline", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_STRING_INFO_DIRECT_ACCESS(EXTERNAL_DbgRedirectApplication, W("DbgRedirectApplication"), "Specifies the auxillary debugger application to launch.")
+RETAIL_CONFIG_STRING_INFO_DIRECT_ACCESS(EXTERNAL_DbgRedirectAttachCmd, W("DbgRedirectAttachCmd"), "Specifies command parameters for attaching the auxillary debugger.")
+RETAIL_CONFIG_STRING_INFO_DIRECT_ACCESS(EXTERNAL_DbgRedirectCommonCmd, W("DbgRedirectCommonCmd"), "Specifies a command line format string for the auxillary debugger.")
+RETAIL_CONFIG_STRING_INFO_DIRECT_ACCESS(EXTERNAL_DbgRedirectCreateCmd, W("DbgRedirectCreateCmd"), "Specifies command parameters when creating the auxillary debugger.")
+CONFIG_DWORD_INFO_EX(INTERNAL_DbgShortcutCanary, W("DbgShortcutCanary"), 0, "allows a way to force canary to fail to be able to test failure paths", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_DbgSkipMEOnStep, W("DbgSkipMEOnStep"), 0, "turns off MethodEnter checks", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_DbgSkipVerCheck, W("DbgSkipVerCheck"), 0, "allows different RS and LS versions (for servicing work)", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_DbgTC, W("DbgTC"), 0, "allows checking boundary compression for offset mappings", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_DbgTransportFaultInject, W("DbgTransportFaultInject"), 0, "allows injecting a fault for testing the debug transport", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_DbgTransportLog, W("DbgTransportLog"), "turns on logging for the debug transport")
+CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_DbgTransportLogClass, W("DbgTransportLogClass"), "mask to control what is logged in DbgTransportLog")
+RETAIL_CONFIG_STRING_INFO_EX(UNSUPPORTED_DbgTransportProxyAddress, W("DbgTransportProxyAddress"), "allows specifying the transport proxy address", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_DbgTrapOnSkip, W("DbgTrapOnSkip"), 0, "allows breaking when we skip a breakpoint", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_DbgWaitTimeout, W("DbgWaitTimeout"), 1, "specifies the timeout value for waits", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_EX(UNSUPPORTED_DbgWFDETimeout, W("DbgWFDETimeout"), 25, "specifies the timeout value for wait when waiting for a debug event", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_RaiseExceptionOnAssert, W("RaiseExceptionOnAssert"), 0, "Raise a first chance (if set to 1) or second chance (if set to 2) exception on asserts.", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_DebugBreakOnAssert, W("DebugBreakOnAssert"), 0, "If DACCESS_COMPILE is defined, break on asserts.", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_DebugBreakOnVerificationFailure, W("DebugBreakOnVerificationFailure"), 0, "Halts the jit on verification failure", CLRConfig::REGUTIL_default)
+CONFIG_STRING_INFO_EX(INTERNAL_DebuggerBreakPoint, W("DebuggerBreakPoint"), "allows counting various debug events", CLRConfig::REGUTIL_default)
+CONFIG_STRING_INFO_EX(INTERNAL_DebugVerify, W("DebugVerify"), "Control for tracing in peverify", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO(INTERNAL_EncApplyChanges, W("EncApplyChanges"), 0, "allows breaking when ApplyEditAndContinue is called")
+CONFIG_DWORD_INFO_EX(INTERNAL_EnCBreakOnRemapComplete, W("EnCBreakOnRemapComplete"), 0, "allows breaking after N RemapCompletes", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_EnCBreakOnRemapOpportunity, W("EnCBreakOnRemapOpportunity"), 0, "allows breaking after N RemapOpportunities", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO(INTERNAL_EncDumpApplyChanges, W("EncDumpApplyChanges"), 0, "allows dumping edits in delta metadata and il files")
+CONFIG_DWORD_INFO(INTERNAL_EncFixupFieldBreak, W("EncFixupFieldBreak"), 0, "Unlikely that this is used anymore.")
+CONFIG_DWORD_INFO(INTERNAL_EncJitUpdatedFunction, W("EncJitUpdatedFunction"), 0, "allows breaking when an updated function is jitted")
+CONFIG_DWORD_INFO(INTERNAL_EnCResolveField, W("EnCResolveField"), 0, "allows breaking when computing the address of an EnC-added field")
+CONFIG_DWORD_INFO(INTERNAL_EncResumeInUpdatedFunction, W("EncResumeInUpdatedFunction"), 0, "allows breaking when execution resumes in a new EnC version of a function")
+CONFIG_DWORD_INFO_EX(INTERNAL_DbgAssertOnDebuggeeDebugBreak, W("DbgAssertOnDebuggeeDebugBreak"), 0, "If non-zero causes the managed-only debugger to assert on unhandled breakpoints in the debuggee", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_DbgDontResumeThreadsOnUnhandledException, W("UNSUPPORTED_DbgDontResumeThreadsOnUnhandledException"), 0, "If non-zero, then don't try to unsuspend threads after continuing a 2nd-chance native exception")
+RETAIL_CONFIG_DWORD_INFO_EX(UNSUPPORTED_DbgSkipStackCheck, W("DbgSkipStackCheck"), 0, "Skip the stack pointer check during stackwalking", CLRConfig::REGUTIL_default)
+#ifdef DACCESS_COMPILE
+CONFIG_DWORD_INFO(INTERNAL_DumpGeneration_IntentionallyCorruptDataFromTarget, W("IntentionallyCorruptDataFromTarget"), 0, "Intentionally fakes bad data retrieved from target to try and break dump generation.")
+#endif
+// Note that Debugging_RequiredVersion is sometimes an 'INTERNAL' knob and sometimes an 'UNSUPPORTED' knob, but we don't change it's name.
+CONFIG_DWORD_INFO(UNSUPPORTED_Debugging_RequiredVersion, W("UNSUPPORTED_Debugging_RequiredVersion"), 0, "The lowest ICorDebug version we should attempt to emulate, or 0 for default policy. Use 2 for CLRv2, 4 for CLRv4, etc.")
+
+#ifdef FEATURE_MINIMETADATA_IN_TRIAGEDUMPS
+RETAIL_CONFIG_DWORD_INFO(INTERNAL_MiniMdBufferCapacity, W("MiniMdBufferCapacity"), 64 * 1024, "The max size of the buffer to store mini metadata information for triage- and mini-dumps.")
+#endif // FEATURE_MINIMETADATA_IN_TRIAGEDUMPS
+//
+// Diagnostics (internal general-purpose)
+//
+CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_ConditionalContracts, W("ConditionalContracts"), "?If ENABLE_CONTRACTS_IMPL is defined, sets whether contracts are conditional.")
+CONFIG_DWORD_INFO(INTERNAL_ConsistencyCheck, W("ConsistencyCheck"), 0, "")
+CONFIG_DWORD_INFO_EX(INTERNAL_ContinueOnAssert, W("ContinueOnAssert"), 0, "If set, doesn't break on asserts.", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_EX(UNSUPPORTED_disableStackOverflowProbing, W("disableStackOverflowProbing"), 0, "", CLRConfig::FavorConfigFile)
+CONFIG_DWORD_INFO(INTERNAL_EnforceEEThreadNotRequiredContracts, W("EnforceEEThreadNotRequiredContracts"), 0, "Indicates whether to enforce EE_THREAD_NOT_REQUIRED contracts (not enforced by default for perf reasons). Only applicable in dbg/chk builds--EE_THREAD_NOT_REQUIRED contracts never enforced in ret builds.")
+CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_InjectFatalError, W("InjectFatalError"), "")
+CONFIG_DWORD_INFO_EX(INTERNAL_InjectFault, W("InjectFault"), 0, "", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_SuppressChecks, W("SuppressChecks"), "")
+#ifdef WIN64EXCEPTIONS
+CONFIG_DWORD_INFO(INTERNAL_SuppressLockViolationsOnReentryFromOS, W("SuppressLockViolationsOnReentryFromOS"), 0, "64 bit OOM tests re-enter the CLR via RtlVirtualUnwind. This indicates whether to suppress resulting locking violations.")
+#endif // WIN64EXCEPTIONS
+CONFIG_STRING_INFO(INTERNAL_TestHooks, W("TestHooks"), "Used by tests to get test an insight on various CLR workings")
+
+
+//
+// Exception Handling
+//
+CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_AssertOnFailFast, W("AssertOnFailFast"), "")
+RETAIL_CONFIG_DWORD_INFO_EX(UNSUPPORTED_legacyCorruptedStateExceptionsPolicy, W("legacyCorruptedStateExceptionsPolicy"), 0, "Enabled Pre-V4 CSE behaviour", CLRConfig::FavorConfigFile)
+CONFIG_DWORD_INFO_EX(INTERNAL_SuppressLostExceptionTypeAssert, W("SuppressLostExceptionTypeAssert"), 0, "", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_EX(UNSUPPORTED_FailFastOnCorruptedStateException, W("FailFastOnCorruptedStateException"), 0, "Failfast if a CSE is encountered", CLRConfig::FavorConfigFile)
+
+//
+// Garbage collector
+//
+CONFIG_DWORD_INFO(INTERNAL_FastGCCheckStack, W("FastGCCheckStack"), 0, "")
+CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_FastGCStress, W("FastGCStress"), "reduce the number of GCs done by enabling GCStress")
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(UNSUPPORTED_GCBreakOnOOM, W("GCBreakOnOOM"), "Does a DebugBreak at the soonest time we detect an OOM")
+RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_gcConcurrent, W("gcConcurrent"), (DWORD)-1, "Enables/Disables concurrent GC")
+
+#ifdef FEATURE_CONSERVATIVE_GC
+RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_gcConservative, W("gcConservative"), 0, "Enables/Disables conservative GC")
+#endif
+#ifdef FEATURE_CORECLR
+RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_gcServer, W("gcServer"), 0, "Enables server GC")
+#endif
+CONFIG_STRING_INFO(INTERNAL_GcCoverage, W("GcCoverage"), "specify a method or regular expression of method names to run with GCStress")
+CONFIG_STRING_INFO(INTERNAL_SkipGCCoverage, W("SkipGcCoverage"), "specify a list of assembly names to skip with GC Coverage")
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(UNSUPPORTED_gcForceCompact, W("gcForceCompact"), "When set to true, always do compacting GC")
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(UNSUPPORTED_GCgen0size, W("GCgen0size"), "Specifies the smallest gen0 size")
+RETAIL_CONFIG_DWORD_INFO(INTERNAL_GCStressMix, W("GCStressMix"), 0, "Specifies whether the GC mix mode is enabled or not")
+RETAIL_CONFIG_DWORD_INFO(INTERNAL_GCStressStep, W("GCStressStep"), 1, "Specifies how often StressHeap will actually do a GC in GCStressMix mode")
+RETAIL_CONFIG_DWORD_INFO(INTERNAL_GCStressMaxFGCsPerBGC, W("GCStressMaxFGCsPerBGC"), ~0U, "Specifies how many FGCs will occur during one BGC in GCStressMix mode")
+RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_StatsUpdatePeriod, W("StatsUpdatePeriod"), 60, "Specifies the interval, in seconds, at which to update the statistics")
+RETAIL_CONFIG_STRING_INFO(UNSUPPORTED_SuspendTimeLog, W("SuspendTimeLog"), "Specifies the name of the log file for suspension statistics")
+RETAIL_CONFIG_STRING_INFO(UNSUPPORTED_GCMixLog, W("GCMixLog"), "Specifies the name of the log file for GC mix statistics")
+CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_GCLatencyMode, W("GCLatencyMode"), "Specifies the GC latency mode - batch, interactive or low latency (note that the same thing can be specified via API which is the supported way)")
+RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_GCConfigLogEnabled, W("GCConfigLogEnabled"), 0, "Specifies if you want to turn on config logging in GC")
+RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_GCLogEnabled, W("GCLogEnabled"), 0, "Specifies if you want to turn on logging in GC")
+RETAIL_CONFIG_STRING_INFO(UNSUPPORTED_GCLogFile, W("GCLogFile"), "Specifies the name of the GC log file")
+RETAIL_CONFIG_STRING_INFO(UNSUPPORTED_GCConfigLogFile, W("GCConfigLogFile"), "Specifies the name of the GC config log file")
+RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_GCLogFileSize, W("GCLogFileSize"), 0, "Specifies the GC log file size")
+RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_GCCompactRatio, W("GCCompactRatio"), 0, "Specifies the ratio compacting GCs vs sweeping ")
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(EXTERNAL_GCPollType, W("GCPollType"), "")
+RETAIL_CONFIG_STRING_INFO_EX(EXTERNAL_NewGCCalc, W("NewGCCalc"), "", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(UNSUPPORTED_GCprnLvl, W("GCprnLvl"), "Specifies the maximum level of GC logging")
+RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_GCRetainVM, W("GCRetainVM"), 0, "When set we put the segments that should be deleted on a standby list (instead of releasing them back to the OS) which will be considered to satisfy new segment requests (note that the same thing can be specified via API which is the supported way)")
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(UNSUPPORTED_GCSegmentSize, W("GCSegmentSize"), "Specifies the managed heap segment size")
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(UNSUPPORTED_GCLOHCompact, W("GCLOHCompact"), "Specifies the LOH compaction mode")
+RETAIL_CONFIG_DWORD_INFO(EXTERNAL_gcAllowVeryLargeObjects, W("gcAllowVeryLargeObjects"), 0, "allow allocation of 2GB+ objects on GC heap")
+RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_GCStress, W("GCStress"), 0, "trigger GCs at regular intervals", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_GcStressOnDirectCalls, W("GcStressOnDirectCalls"), 0, "whether to trigger a GC on direct calls", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO(EXTERNAL_GCStressStart, W("GCStressStart"), 0, "start GCStress after N stress GCs have been attempted")
+RETAIL_CONFIG_DWORD_INFO(INTERNAL_GCStressStartAtJit, W("GCStressStartAtJit"), 0, "start GCStress after N items are jitted")
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(UNSUPPORTED_GCtraceEnd, W("GCtraceEnd"), "Specifies the index of the GC when the logging should end")
+CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_GCtraceFacility, W("GCtraceFacility"), "Specifies where to log to (this allows you to log to console, the stress log or a normal CLR log (good when you need to correlate the GC activities with other CLR activities)")
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(UNSUPPORTED_GCtraceStart, W("GCtraceStart"), "Specifies the index of the GC when the logging should start")
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(EXTERNAL_gcTrimCommitOnLowMemory, W("gcTrimCommitOnLowMemory"), "When set we trim the committed space more aggressively for the ephemeral seg. This is used for running many instances of server processes where they want to keep as little memory committed as possible")
+RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_BGCSpinCount, W("BGCSpinCount"), 140, "Specifies the bgc spin count")
+RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_BGCSpin, W("BGCSpin"), 2, "Specifies the bgc spin time")
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(UNSUPPORTED_HeapVerify, W("HeapVerify"), "When set verifies the integrity of the managed heap on entry and exit of each GC")
+RETAIL_CONFIG_STRING_INFO_EX(EXTERNAL_SetupGcCoverage, W("SetupGcCoverage"), "This doesn't appear to be a config flag", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_GCNumaAware, W("GCNumaAware"), 1, "Specifies if to enable GC NUMA aware")
+RETAIL_CONFIG_DWORD_INFO(EXTERNAL_GCCpuGroup, W("GCCpuGroup"), 0, "Specifies if to enable GC to support CPU groups")
+RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_GCHeapCount, W("GCHeapCount"), 0, "")
+RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_GCNoAffinitize, W("GCNoAffinitize"), 0, "")
+
+//
+// IBC
+//
+CONFIG_STRING_INFO_EX(INTERNAL_IBCPrint, W("IBCPrint"), "", CLRConfig::REGUTIL_default)
+CONFIG_STRING_INFO_EX(INTERNAL_IBCPrint3, W("IBCPrint3"), "", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_EX(UNSUPPORTED_ConvertIbcData, W("ConvertIbcData"), 1, "Converts between v1 and v2 IBC data", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(UNSUPPORTED_DisableHotCold, W("DisableHotCold"), "Master hot/cold splitting switch in Jit64")
+RETAIL_CONFIG_DWORD_INFO_EX(UNSUPPORTED_DisableIBC, W("DisableIBC"), 0, "Disables the use of IBC data", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_UseIBCFile, W("UseIBCFile"), 0, "", CLRConfig::REGUTIL_default)
+
+
+//
+// JIT
+//
+CONFIG_DWORD_INFO_EX(INTERNAL_DumpJittedMethods, W("DumpJittedMethods"), 0, "Prints all jitted methods to the console", CLRConfig::REGUTIL_default)
+CONFIG_STRING_INFO_EX(INTERNAL_Jit64Range, W("Jit64Range"), "", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(UNSUPPORTED_JitAlignLoops, W("JitAlignLoops"), "Aligns loop targets to 8 byte boundaries")
+CONFIG_DWORD_INFO_EX(INTERNAL_JitCloneLoops, W("JitCloneLoops"), 1, "If 0, don't clone. Otherwise clone loops for optimizations.", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_JitAssertOnMaxRAPasses, W("JitAssertOnMaxRAPasses"), 0, "", CLRConfig::REGUTIL_default)
+CONFIG_STRING_INFO_EX(INTERNAL_JitBreak, W("JitBreak"), "Stops in the importer when compiling a specified method", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_JitBreakEmit, W("JitBreakEmit"), (DWORD)-1, "", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_JitBreakEmitOutputInstr, W("JitBreakEmitOutputInstr"), (DWORD)-1, "", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_JitBreakMorphTree, W("JitBreakMorphTree"), 0xFFFFFFFF, "", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_JitBreakOnBadCode, W("JitBreakOnBadCode"), "")
+CONFIG_DWORD_INFO_EX(INTERNAL_JitBreakOnUnsafeCode, W("JitBreakOnUnsafeCode"), 0, "", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_JitCanUseSSE2, W("JitCanUseSSE2"), "")
+CONFIG_STRING_INFO_EX(INTERNAL_JitDebugBreak, W("JitDebugBreak"), "", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_JitDebuggable, W("JitDebuggable"), "")
+CONFIG_DWORD_INFO_EX(INTERNAL_JitDefaultFill, W("JitDefaultFill"), 0xDD, "In debug builds, initialize the memory allocated by the nra with this byte.", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_JitDirectAlloc, W("JitDirectAlloc"), 0, "", CLRConfig::REGUTIL_default)
+#if (!defined(DEBUG) && !defined(_DEBUG)) || (defined(CROSSGEN_COMPILE) && !defined(FEATURE_CORECLR))
+#define INTERNAL_JitEnableNoWayAssert_Default 0
+#else
+#define INTERNAL_JitEnableNoWayAssert_Default 1
+#endif
+RETAIL_CONFIG_DWORD_INFO_EX(INTERNAL_JitEnableNoWayAssert, W("JitEnableNoWayAssert"), INTERNAL_JitEnableNoWayAssert_Default, "", CLRConfig::REGUTIL_default)
+CONFIG_STRING_INFO_EX(INTERNAL_JitDisasm, W("JitDisasm"), "Dumps disassembly for specified method", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_JitDoubleAlign, W("JitDoubleAlign"), "")
+CONFIG_STRING_INFO_EX(INTERNAL_JitDump, W("JitDump"), "Dumps trees for specified method", CLRConfig::REGUTIL_default)
+CONFIG_STRING_INFO_EX(INTERNAL_JitDumpIR, W("JitDumpIR"), "Dumps trees (in linear IR form) for specified method", CLRConfig::REGUTIL_default)
+CONFIG_STRING_INFO_EX(INTERNAL_JitDumpIRFormat, W("JitDumpIRFormat"), "Comma separated format control for JitDumpIR, values = {types | locals | ssa | valnums | kinds | flags | nodes | nolists | nostmts | noleafs | trees | dataflow}", CLRConfig::REGUTIL_default)
+CONFIG_STRING_INFO_EX(INTERNAL_JitDumpIRPhase, W("JitDumpIRPhase"), "Phase control for JitDumpIR, values = {* | phasename}", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_JitDumpVerboseTrees, W("JitDumpVerboseTrees"), 0, "Enable more verbose tree dumps", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_JitDumpVerboseSsa, W("JitDumpVerboseSsa"), 0, "Produce especially verbose dump output for SSA", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_JitDumpBeforeAfterMorph, W("JitDumpBeforeAfterMorph"), 0, "If 1, display each tree before/after morphing", CLRConfig::REGUTIL_default)
+CONFIG_STRING_INFO_EX(INTERNAL_JitDumpFg, W("JitDumpFg"), "Dumps Xml/Dot Flowgraph for specified method", CLRConfig::REGUTIL_default)
+CONFIG_STRING_INFO_EX(INTERNAL_JitDumpFgDir, W("JitDumpFgDir"), "Directory for Xml/Dot flowgraph dump(s)", CLRConfig::REGUTIL_default)
+CONFIG_STRING_INFO_EX(INTERNAL_JitDumpFgFile, W("JitDumpFgFile"), "Filename for Xml/Dot flowgraph dump(s)", CLRConfig::REGUTIL_default)
+CONFIG_STRING_INFO_EX(INTERNAL_JitDumpFgPhase, W("JitDumpFgPhase"), "Phase-based Xml/Dot flowgraph support. Set to the short name of a phase to see the flowgraph after that phase. Leave unset to dump after COLD-BLK (determine first cold block) or set to * for all phases", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_JitDumpFgDot, W("JitDumpFgDot"), 0, "Set to non-zero to emit Dot instead of Xml Flowgraph dump", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_JitDumpLevel, W("JitDumpLevel"), 1, "", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_JitDumpASCII, W("JitDumpASCII"), 1, "Uses only ASCII characters in tree dumps", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_JitDumpTerseLsra, W("JitDumpTerseLsra"), 1, "Produce terse dump output for LSRA", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_JitDumpToDebugger, W("JitDumpToDebugger"), 0, "Output JitDump output to the debugger", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_JitEmitPrintRefRegs, W("JitEmitPrintRefRegs"), 0, "", CLRConfig::REGUTIL_default)
+CONFIG_STRING_INFO_EX(INTERNAL_JitExclude, W("JitExclude"), "", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_JitForceFallback, W("JitForceFallback"), 0, "Set to non-zero to test NOWAY assert by forcing a retry", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_JitNoForceFallback, W("JitNoForceFallback"), 0, "Set to non-zero to prevent NOWAY assert testing. Overrides COMPlus_JitForceFallback and JIT stress flags.", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_JitExpensiveDebugCheckLevel, W("JitExpensiveDebugCheckLevel"), 0, "Level indicates how much checking beyond the default to do in debug builds (currently 1-2)", CLRConfig::REGUTIL_default)
+CONFIG_STRING_INFO_EX(INTERNAL_JitForceProcedureSplitting, W("JitForceProcedureSplitting"), "", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_JitForceVer, W("JitForceVer"), 0, "", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(UNSUPPORTED_JitFramed, W("JitFramed"), "Forces EBP frames")
+CONFIG_DWORD_INFO_EX(INTERNAL_JitFullyInt, W("JitFullyInt"), 0, "Forces Fully interruptable code", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_JitGCChecks, W("JitGCChecks"), "")
+CONFIG_STRING_INFO_EX(INTERNAL_JitGCDump, W("JitGCDump"), "", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO(INTERNAL_JitGCInfoLogging, W("JitGCInfoLogging"), 0, "If true, prints GCInfo-related output to standard output.")
+CONFIG_DWORD_INFO_EX(INTERNAL_JitGCStress, W("JitGCStress"), 0, "GC stress mode for jit", CLRConfig::REGUTIL_default)
+CONFIG_STRING_INFO_EX(INTERNAL_JitHalt, W("JitHalt"), "Emits break instruction into jitted code", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_JitHashHalt, W("JitHashHalt"), (DWORD)-1, "Same as JitHalt, but for a method hash", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_JitHashBreak, W("JitHashBreak"), (DWORD)-1, "Same as JitBreak, but for a method hash", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_JitHashDump, W("JitHashDump"), (DWORD)-1, "Same as JitDump, but for a method hash", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_JitHashDumpIR, W("JitHashDumpIR"), (DWORD)-1, "Same as JitDumpIR, but for a method hash", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO(INTERNAL_JitHeartbeat, W("JitHeartbeat"), 0, "")
+CONFIG_DWORD_INFO(INTERNAL_JitHelperLogging, W("JitHelperLogging"), 0, "")
+CONFIG_STRING_INFO_EX(INTERNAL_JitImportBreak, W("JitImportBreak"), "", CLRConfig::REGUTIL_default)
+CONFIG_STRING_INFO_EX(INTERNAL_JitInclude, W("JitInclude"), "", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_JitInlineAdditionalMultiplier, W("JitInlineAdditionalMultiplier"), 0, "", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_EX(INTERNAL_JitInlineSIMDMultiplier, W("JitInlineSIMDMultiplier"), 3, "", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_JitInlinePrintStats, W("JitInlinePrintStats"), (DWORD)0, "", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_JITInlineSize, W("JITInlineSize"), "")
+CONFIG_STRING_INFO_EX(INTERNAL_JitLateDisasm, W("JitLateDisasm"), "", CLRConfig::REGUTIL_default)
+CONFIG_STRING_INFO_EX(INTERNAL_JITLateDisasmTo, W("JITLateDisasmTo"), "", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_JITMaxTempAssert, W("JITMaxTempAssert"), 1, "", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_JitMaxUncheckedOffset, W("JitMaxUncheckedOffset"), (DWORD)8, "", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(UNSUPPORTED_JITMinOpts, W("JITMinOpts"), "Forces MinOpts")
+CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_JITMinOptsBbCount, W("JITMinOptsBbCount"), "Internal jit control of MinOpts")
+CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_JITMinOptsCodeSize, W("JITMinOptsCodeSize"), "Internal jit control of MinOpts")
+CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_JITMinOptsInstrCount, W("JITMinOptsInstrCount"), "Internal jit control of MinOpts")
+CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_JITMinOptsLvNumcount, W("JITMinOptsLvNumcount"), "Internal jit control of MinOpts")
+CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_JITMinOptsLvRefcount, W("JITMinOptsLvRefcount"), "Internal jit control of MinOpts")
+CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_JITBreakOnMinOpts, W("JITBreakOnMinOpts"), "Halt if jit switches to MinOpts")
+CONFIG_STRING_INFO_EX(INTERNAL_JITMinOptsName, W("JITMinOptsName"), "Forces MinOpts for a named function", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_STRING_INFO(EXTERNAL_JitName, W("JitName"), "Primary Jit to use")
+#if defined(ALLOW_SXS_JIT)
+RETAIL_CONFIG_STRING_INFO_EX(EXTERNAL_AltJitName, W("AltJitName"), "Alternative Jit to use, will fall back to primary jit.", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_STRING_INFO_EX(EXTERNAL_AltJit, W("AltJit"), "Enables AltJit and selectively limits it to the specified methods.", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_STRING_INFO_EX(EXTERNAL_AltJitExcludeAssemblies, W("AltJitExcludeAssemblies"), "Do not use AltJit on this semicolon-delimited list of assemblies.", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_AltJitLimit, W("AltJitLimit"), 0, "Max number of functions to use altjit for (decimal)", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_RunAltJitCode, W("RunAltJitCode"), 1, "If non-zero, and the compilation succeeds for an AltJit, then use the code. If zero, then we always throw away the generated code and fall back to the default compiler.", CLRConfig::REGUTIL_default)
+#endif // defined(ALLOW_SXS_JIT)
+
+#if defined(FEATURE_STACK_SAMPLING)
+RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_StackSamplingEnabled, W("StackSamplingEnabled"), 0, "Is stack sampling based tracking of evolving hot methods enabled.")
+RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_StackSamplingAfter, W("StackSamplingAfter"), 0, "When to start sampling (for some sort of app steady state), i.e., initial delay for sampling start in milliseconds.")
+RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_StackSamplingEvery, W("StackSamplingEvery"), 100, "How frequent should thread stacks be sampled in milliseconds.")
+RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_StackSamplingNumMethods, W("StackSamplingNumMethods"), 32, "Number of evolving methods to track as hot and JIT them in the background at a given point of execution.")
+#endif // defined(FEATURE_JIT_SAMPLING)
+
+#if defined(ALLOW_SXS_JIT_NGEN)
+RETAIL_CONFIG_STRING_INFO_EX(INTERNAL_AltJitNgen, W("AltJitNgen"), "Enables AltJit for NGEN and selectively limits it to the specified methods.", CLRConfig::REGUTIL_default)
+#endif // defined(ALLOW_SXS_JIT_NGEN)
+CONFIG_DWORD_INFO_EX(INTERNAL_JitNoCMOV, W("JitNoCMOV"), 0, "", CLRConfig::REGUTIL_default)
+
+#if defined(_TARGET_AMD64_)
+// UseRyuJIT is only looked up in HKLM in the registry, not in config files or environment variables. It should only be set by the .NET 4.6 (and later version) installers,
+// not by users. See the "RyuJIT Compatibility Fallback Design Specification.docx" document for details.
+RETAIL_CONFIG_DWORD_INFO_EX(INTERNAL_UseRyuJit, W("UseRyuJIT"), 0, "Set to 1 by .NET 4.6 installer to indicate RyuJIT should be used, not JIT64.", CLRConfig::IgnoreEnv | CLRConfig::IgnoreHKCU | CLRConfig::IgnoreConfigFiles)
+RETAIL_CONFIG_DWORD_INFO(EXTERNAL_UseLegacyJit, W("useLegacyJit"), 0, "Set to 1 to do all JITing with compatjit.dll. Only applicable to x64.")
+RETAIL_CONFIG_STRING_INFO_EX(EXTERNAL_DisableNativeImageLoadList, W("DisableNativeImageLoadList"), "Refuse to load native images corresponding to one of the assemblies on this semicolon-delimited list of assembly names.", CLRConfig::REGUTIL_default)
+#endif
+
+CONFIG_STRING_INFO_EX(INTERNAL_JitValNumCSE, W("JitValNumCSE"), "Enables ValNum CSE for the specified methods", CLRConfig::REGUTIL_default)
+CONFIG_STRING_INFO_EX(INTERNAL_JitLexicalCSE, W("JitLexicalCSE"), "Enables Lexical CSE for the specified methods", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_JitNoCSE, W("JitNoCSE"), 0, "", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_JitNoCSE2, W("JitNoCSE2"), 0, "", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_JitNoHoist, W("JitNoHoist"), 0, "", CLRConfig::REGUTIL_default)
+
+RETAIL_CONFIG_DWORD_INFO_EX(INTERNAL_JitNoInline, W("JitNoInline"), 0, "Disables inlining of all methods", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_EX(INTERNAL_JitAggressiveInlining, W("JitAggressiveInlining"), 0, "Aggressive inlining of all methods", CLRConfig::REGUTIL_default)
+
+CONFIG_STRING_INFO_EX(INTERNAL_JitNoProcedureSplitting, W("JitNoProcedureSplitting"), "Disallow procedure splitting for specified methods", CLRConfig::REGUTIL_default)
+CONFIG_STRING_INFO_EX(INTERNAL_JitNoProcedureSplittingEH, W("JitNoProcedureSplittingEH"), "Disallow procedure splitting for specified methods if they contain exception handling", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_JitNoRegLoc, W("JitNoRegLoc"), 0, "", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_JitNoStructPromotion, W("JitNoStructPromotion"), 0, "Disables struct promotion in Jit32", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_JitNoUnroll, W("JitNoUnroll"), 0, "", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_JitNoMemoryBarriers, W("JitNoMemoryBarriers"), 0, "If 1, don't generate memory barriers", CLRConfig::REGUTIL_default)
+#ifdef FEATURE_ENABLE_NO_RANGE_CHECKS
+RETAIL_CONFIG_DWORD_INFO(PRIVATE_JitNoRangeChks, W("JitNoRngChks"), 0, "If 1, don't generate range checks")
+#endif
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(EXTERNAL_JitOptimizeType, W("JitOptimizeType"), "")
+CONFIG_DWORD_INFO_EX(INTERNAL_JitOrder, W("JitOrder"), 0, "", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_JitDiffableDasm, W("JitDiffableDasm"), 0, "Make the disassembly diff-able", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_JitSlowDebugChecksEnabled, W("JitSlowDebugChecksEnabled"), 1, "Turn on slow debug checks", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_JITPInvokeCheckEnabled, W("JITPInvokeCheckEnabled"), 0, "", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO(INTERNAL_JITPInvokeEnabled, W("JITPInvokeEnabled"), 1, "")
+RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_JitPrintInlinedMethods, W("JitPrintInlinedMethods"), 0, "", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO(EXTERNAL_JitTelemetry, W("JitTelemetry"), 1, "If non-zero, gather JIT telemetry data")
+CONFIG_STRING_INFO_EX(INTERNAL_JitRange, W("JitRange"), "", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_JITRequired, W("JITRequired"), (unsigned)-1, "", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_JITRoundFloat, W("JITRoundFloat"), "")
+CONFIG_DWORD_INFO_EX(INTERNAL_JitSkipArrayBoundCheck, W("JitSkipArrayBoundCheck"), 0, "", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_JitStackChecks, W("JitStackChecks"), "")
+CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_JitStackProbes, W("JitStackProbes"), "")
+CONFIG_DWORD_INFO_EX(INTERNAL_JitStress, W("JitStress"), 0, "Internal Jit stress mode: 0 = no stress, 2 = all stress, other = vary stress based on a hash of the method and this value", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_JitStressBBProf, W("JitStressBBProf"), 0, "Internal Jit stress mode", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_JitStressFP, W("JitStressFP"), 0, "Internal Jit stress mode", CLRConfig::REGUTIL_default)
+CONFIG_STRING_INFO_EX(INTERNAL_JitStressModeNames, W("JitStressModeNames"), "Internal Jit stress mode: stress using the given set of stress mode names, e.g. STRESS_REGS, STRESS_TAILCALL", CLRConfig::REGUTIL_default)
+CONFIG_STRING_INFO_EX(INTERNAL_JitStressModeNamesNot, W("JitStressModeNamesNot"), "Internal Jit stress mode: do NOT stress using the given set of stress mode names, e.g. STRESS_REGS, STRESS_TAILCALL", CLRConfig::REGUTIL_default)
+CONFIG_STRING_INFO_EX(INTERNAL_JitStressOnly, W("JitStressOnly"), "Internal Jit stress mode: stress only the specified method(s)", CLRConfig::REGUTIL_default)
+CONFIG_STRING_INFO_EX(INTERNAL_JitStressRange, W("JitStressRange"), "Internal Jit stress mode", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_JitStressRegs, W("JitStressRegs"), 0, "", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_JitStressBiasedCSE, W("JitStressBiasedCSE"), 0x101, "Internal Jit stress mode: decimal bias value between (0,100) to perform CSE on a candidate. 100% = All CSEs. 0% = 0 CSE. (> 100) means no stress.", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_JitStrictCheckForNonVirtualCallToVirtualMethod, W("JitStrictCheckForNonVirtualCallToVirtualMethod"), 1, "", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_STRING_INFO(INTERNAL_JitTimeLogFile, W("JitTimeLogFile"), "If set, gather JIT throughput data and write to this file.")
+RETAIL_CONFIG_STRING_INFO(INTERNAL_JitTimeLogCsv, W("JitTimeLogCsv"), "If set, gather JIT throughput data and write to a CSV file. This mode must be used in internal retail builds.")
+RETAIL_CONFIG_STRING_INFO(INTERNAL_JitFuncInfoLogFile, W("JitFuncInfoLogFile"), "If set, gather JIT function info and write to this file.")
+CONFIG_STRING_INFO(INTERNAL_JitUnwindDump, W("JitUnwindDump"), "Dump the unwind codes for the method")
+CONFIG_STRING_INFO(INTERNAL_JitEHDump, W("JitEHDump"), "Dump the EH table for the method, as reported to the VM")
+CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_JitVerificationDisable, W("JitVerificationDisable"), "")
+RETAIL_CONFIG_DWORD_INFO(INTERNAL_JitLockWrite, W("JitLockWrite"), 0, "Force all volatile writes to be 'locked'")
+CONFIG_STRING_INFO_EX(INTERNAL_TailCallMax, W("TailCallMax"), "", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_STRING_INFO_EX(EXTERNAL_TailCallOpt, W("TailCallOpt"), "", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_TailcallStress, W("TailcallStress"), 0, "", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO(EXTERNAL_TailCallLoopOpt, W("TailCallLoopOpt"), 1, "Convert recursive tail calls to loops")
+RETAIL_CONFIG_DWORD_INFO(EXTERNAL_Jit_NetFx40PInvokeStackResilience, W("NetFx40_PInvokeStackResilience"), (DWORD)-1, "Makes P/Invoke resilient against mismatched signature and calling convention (significant perf penalty).")
+CONFIG_DWORD_INFO_EX(INTERNAL_JitDoSsa, W("JitDoSsa"), 1, "Perform Static Single Assignment (SSA) numbering on the variables", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_JitDoEarlyProp, W("JitDoEarlyProp"), 1, "Perform Early Value Propagataion", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_JitDoValueNumber, W("JitDoValueNumber"), 1, "Perform value numbering on method expressions", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_JitDoLoopHoisting, W("JitDoLoopHoisting"), 1, "Perform loop hoisting on loop invariant values", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_JitDoCopyProp, W("JitDoCopyProp"), 1, "Perform copy propagation on variables that appear redundant", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_JitDoAssertionProp, W("JitDoAssertionProp"), 1, "Perform assertion propagation optimization", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_JitDoRangeAnalysis, W("JitDoRangeAnalysis"), 1, "Perform range check analysis", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_JitSsaStress, W("JitSsaStress"), 0, "Perturb order of processing of blocks in SSA; 0 = no stress; 1 = use method hash; * = supplied value as random hash", CLRConfig::REGUTIL_default)
+// AltJitAssertOnNYI should be 0 on targets where JIT is under developement or bring up stage, so as to facilitate fallback to main JIT on hitting a NYI.
+#if defined(_TARGET_ARM64_) || defined(_TARGET_X86_)
+RETAIL_CONFIG_DWORD_INFO(INTERNAL_AltJitAssertOnNYI, W("AltJitAssertOnNYI"), 0, "Controls the AltJit behavior of NYI stuff")
+#else
+RETAIL_CONFIG_DWORD_INFO(INTERNAL_AltJitAssertOnNYI, W("AltJitAssertOnNYI"), 1, "Controls the AltJit behavior of NYI stuff")
+#endif
+CONFIG_DWORD_INFO_EX(INTERNAL_AltJitSkipOnAssert, W("AltJitSkipOnAssert"), 0, "If AltJit hits an assert, fall back to the fallback JIT. Useful in conjunction with COMPlus_ContinueOnAssert=1", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_JitLargeBranches, W("JitLargeBranches"), 0, "Force using the largest conditional branch format", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_JitSplitFunctionSize, W("JitSplitFunctionSize"), 0, "On ARM, use this as the maximum function/funclet size for creating function fragments (and creating multiple RUNTIME_FUNCTION entries)", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_JitRegisterFP, W("JitRegisterFP"), 3, "Control FP enregistration", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO(INTERNAL_JitELTHookEnabled, W("JitELTHookEnabled"), 0, "On ARM, setting this will emit Enter/Leave/TailCall callbacks")
+CONFIG_DWORD_INFO_EX(INTERNAL_JitComponentUnitTests, W("JitComponentUnitTests"), 0, "Run JIT component unit tests", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_JitMemStats, W("JitMemStats"), 0, "Display JIT memory usage statistics", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_JitLoopHoistStats, W("JitLoopHoistStats"), 0, "Display JIT loop hoisting statistics", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_JitDebugLogLoopCloning, W("JitDebugLogLoopCloning"), 0, "In debug builds log places where loop cloning optimizations are performed on the fast path.", CLRConfig::REGUTIL_default);
+CONFIG_DWORD_INFO_EX(INTERNAL_JitVNMapSelLimit, W("JitVNMapSelLimit"), 0, "If non-zero, assert if # of VNF_MapSelect applications considered reaches this", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO(INTERNAL_JitVNMapSelBudget, W("JitVNMapSelBudget"), 100, "Max # of MapSelect's considered for a particular top-level invocation.")
+#if defined(_TARGET_AMD64_)
+#define EXTERNAL_FeatureSIMD_Default 1
+#define EXTERNAL_JitEnableAVX_Default 1
+#else // !defined(_TARGET_AMD64_)
+#define EXTERNAL_FeatureSIMD_Default 0
+#define EXTERNAL_JitEnableAVX_Default 0
+#endif // !defined(_TARGET_AMD64_)
+RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_FeatureSIMD, W("FeatureSIMD"), EXTERNAL_FeatureSIMD_Default, "Enable SIMD support with companion SIMDVector.dll", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_EnableAVX, W("EnableAVX"), EXTERNAL_JitEnableAVX_Default, "Enable AVX instruction set for wide operations as default", CLRConfig::REGUTIL_default)
+
+#if defined(_TARGET_X86_) || defined(_TARGET_AMD64_)
+CONFIG_DWORD_INFO_EX(INTERNAL_JitEnablePCRelAddr, W("JitEnablePCRelAddr"), 1, "Whether absolute addr be encoded as PC-rel offset by RyuJIT where possible", CLRConfig::REGUTIL_default)
+#endif //_TARGET_X86_ || _TARGET_AMD64_
+
+#ifdef FEATURE_MULTICOREJIT
+
+RETAIL_CONFIG_STRING_INFO(INTERNAL_MultiCoreJitProfile, W("MultiCoreJitProfile"), "If set, use the file to store/control multi-core JIT.")
+RETAIL_CONFIG_DWORD_INFO(INTERNAL_MultiCoreJitProfileWriteDelay, W("MultiCoreJitProfileWriteDelay"), 12, "Set the delay after which the multi-core JIT profile will be written to disk.")
+
+#endif
+
+CONFIG_DWORD_INFO(INTERNAL_JitFunctionTrace, W("JitFunctionTrace"), 0, "If non-zero, print JIT start/end logging")
+
+//
+// JIT64
+//
+CONFIG_DWORD_INFO_EX(INTERNAL_Jit64_HashtableSize, W("HashTableSize"),500, "Size of Hashtable",CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_Jit64_LargeSymCount, W("LargeSymCount"),100000, "Large Sym Count Size",CLRConfig::REGUTIL_default)
+
+#ifdef FEATURE_INTERPRETER
+//
+// Interpreter
+//
+RETAIL_CONFIG_STRING_INFO_EX(INTERNAL_Interpret, W("Interpret"), "Selectively uses the interpreter to execute the specified methods", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_STRING_INFO_EX(INTERNAL_InterpretExclude, W("InterpretExclude"), "Excludes the specified methods from the set selected by 'Interpret'", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO(INTERNAL_InterpreterMethHashMin, W("InterpreterMethHashMin"), 0, "Only interpret methods selected by 'Interpret' whose hash is at least this value. or after nth")
+RETAIL_CONFIG_DWORD_INFO(INTERNAL_InterpreterMethHashMax, W("InterpreterMethHashMax"), UINT32_MAX, "If non-zero, only interpret methods selected by 'Interpret' whose hash is at most this value")
+RETAIL_CONFIG_DWORD_INFO(INTERNAL_InterpreterStubMin, W("InterpreterStubMin"), 0, "Only interpret methods selected by 'Interpret' whose stub num is at least this value.")
+RETAIL_CONFIG_DWORD_INFO(INTERNAL_InterpreterStubMax, W("InterpreterStubMax"), UINT32_MAX, "If non-zero, only interpret methods selected by 'Interpret' whose stub number is at most this value.")
+RETAIL_CONFIG_DWORD_INFO(INTERNAL_InterpreterJITThreshold, W("InterpreterJITThreshold"), 10, "The number of times a method should be interpreted before being JITted")
+RETAIL_CONFIG_DWORD_INFO(INTERNAL_InterpreterDoLoopMethods, W("InterpreterDoLoopMethods"), 0, "If set, don't check for loops, start by interpreting *all* methods")
+RETAIL_CONFIG_DWORD_INFO_EX(INTERNAL_InterpreterUseCaching, W("InterpreterUseCaching"), 1, "If non-zero, use the caching mechanism.", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_EX(INTERNAL_InterpreterLooseRules, W("InterpreterLooseRules"), 1, "If non-zero, allow ECMA spec violations required by managed C++.", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO(INTERNAL_InterpreterPrintPostMortem, W("InterpreterPrintPostMortem"), 0, "Prints summary information about the execution to the console")
+CONFIG_STRING_INFO_EX(INTERNAL_InterpreterLogFile, W("InterpreterLogFile"), "If non-null, append interpreter logging to this file, else use stdout", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO(INTERNAL_DumpInterpreterStubs, W("DumpInterpreterStubs"), 0, "Prints all interpreter stubs that are created to the console")
+CONFIG_DWORD_INFO(INTERNAL_TraceInterpreterEntries, W("TraceInterpreterEntries"), 0, "Logs entries to interpreted methods to the console")
+CONFIG_DWORD_INFO(INTERNAL_TraceInterpreterIL, W("TraceInterpreterIL"), 0, "Logs individual instructions of interpreted methods to the console")
+CONFIG_DWORD_INFO(INTERNAL_TraceInterpreterOstack, W("TraceInterpreterOstack"), 0, "Logs operand stack after each IL instruction of interpreted methods to the console")
+CONFIG_DWORD_INFO(INTERNAL_TraceInterpreterVerbose, W("TraceInterpreterVerbose"), 0, "Logs interpreter progress with detailed messages to the console")
+CONFIG_DWORD_INFO(INTERNAL_TraceInterpreterJITTransition, W("TraceInterpreterJITTransition"), 0, "Logs when the interpreter determines a method should be JITted")
+#endif
+// The JIT queries this ConfigDWORD but it doesn't know if FEATURE_INTERPRETER is enabled
+RETAIL_CONFIG_DWORD_INFO(INTERNAL_InterpreterFallback, W("InterpreterFallback"), 0, "Fallback to the interpreter when the JIT compiler fails")
+
+// Loader
+CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_APIThreadStress, W("APIThreadStress"), "Used to test Loader for race conditions")
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(EXTERNAL_ForceLog, W("ForceLog"), "Fusion flag to enforce assembly binding log. Heavily used and documented in MSDN and BLOGS.")
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(EXTERNAL_LoaderOptimization, W("LoaderOptimization"), "Controls code sharing behavior")
+RETAIL_CONFIG_STRING_INFO(INTERNAL_CoreClrBinderLog, W("CoreClrBinderLog"), "Debug flag that enabled detailed log for new binder (similar to stress logging).")
+RETAIL_CONFIG_DWORD_INFO(EXTERNAL_DisableIJWVersionCheck, W("DisableIJWVersionCheck"), 0, "Don't perform the new version check that prevents unsupported IJW in-proc SxS.")
+RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_EnableFastBindClosure, W("EnableFastBindClosure"), 0, "If set to >0 the binder uses CFastAssemblyBindingClosure instances")
+RETAIL_CONFIG_DWORD_INFO(INTERNAL_DisableFXClosureWalk, W("DisableFXClosureWalk"), 0, "Disable full closure walks even in the presence of FX binding redirects")
+CONFIG_DWORD_INFO(INTERNAL_TagAssemblyNames, W("TagAssemblyNames"), 0, "Enable CAssemblyName::_tag field for more convenient debugging.")
+RETAIL_CONFIG_STRING_INFO(INTERNAL_WinMDPath, W("WinMDPath"), "Path for Windows WinMD files")
+
+//
+// Loader heap
+//
+CONFIG_DWORD_INFO_EX(INTERNAL_LoaderHeapCallTracing, W("LoaderHeapCallTracing"), 0, "Loader heap troubleshooting", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO(INTERNAL_CodeHeapReserveForJumpStubs, W("CodeHeapReserveForJumpStubs"), 2, "Percentage of code heap to reserve for jump stubs")
+RETAIL_CONFIG_DWORD_INFO(INTERNAL_NGenReserveForJumpStubs, W("NGenReserveForJumpStubs"), 0, "Percentage of ngen image size to reserve for jump stubs")
+RETAIL_CONFIG_DWORD_INFO(INTERNAL_BreakOnOutOfMemoryWithinRange, W("BreakOnOutOfMemoryWithinRange"), 0, "Break before out of memory within range exception is thrown")
+
+//
+// Log
+//
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_LogEnable, W("LogEnable"), "Turns on the traditional CLR log.")
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_LogFacility, W("LogFacility"), "Specifies a facility mask for CLR log. (See 'loglf.h'; VM interprets string value as hex number.) Also used by stresslog.")
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_LogFacility2, W("LogFacility2"), "Specifies a facility mask for CLR log. (See 'loglf.h'; VM interprets string value as hex number.) Also used by stresslog.")
+RETAIL_CONFIG_DWORD_INFO(EXTERNAL_logFatalError, W("logFatalError"), 1, "Specifies whether EventReporter logs fatal errors in the Windows event log.")
+CONFIG_STRING_INFO_EX(INTERNAL_LogFile, W("LogFile"), "Specifies a file name for the CLR log.", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_LogFileAppend, W("LogFileAppend"), "Specifies whether to append to or replace the CLR log file.")
+CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_LogFlushFile, W("LogFlushFile"), "Specifies whether to flush the CLR log file file on each write.")
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(EXTERNAL_LogLevel, W("LogLevel"), "4=10 msgs, 9=1000000, 10=everything")
+RETAIL_CONFIG_STRING_INFO_DIRECT_ACCESS(INTERNAL_LogPath, W("LogPath"), "?Fusion debug log path.")
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_LogToConsole, W("LogToConsole"), "Writes the CLR log to console.")
+CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_LogToDebugger, W("LogToDebugger"), "Writes the CLR log to debugger (OutputDebugStringA).")
+CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_LogToFile, W("LogToFile"), "Writes the CLR log to a file.")
+CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_LogWithPid, W("LogWithPid"), "Appends pid to filename for the CLR log.")
+RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_FusionLogFileNamesIncludePid, W("FusionLogFileNamesIncludePid"), 0, "Fusion logging will append process id to log filenames.", CLRConfig::REGUTIL_default)
+
+//
+// MetaData
+//
+CONFIG_DWORD_INFO_EX(INTERNAL_MD_ApplyDeltaBreak, W("MD_ApplyDeltaBreak"), 0, "ASSERT when appplying EnC", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_AssertOnBadImageFormat, W("AssertOnBadImageFormat"), "ASSERT when invalid MD read")
+RETAIL_CONFIG_DWORD_INFO_EX(INTERNAL_MD_DeltaCheck, W("MD_DeltaCheck"), 1, "? Some checks of GUID when applying EnC?", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_MD_EncDelta, W("MD_EncDelta"), 0, "? Forces EnC Delta format in MD", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_EX(INTERNAL_MD_ForceNoColDesSharing, W("MD_ForceNoColDesSharing"), 0, "? ? Don't know - the only usage I could find is #if 0", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_MD_KeepKnownCA, W("MD_KeepKnownCA"), 0, "? Something with known CAs?", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_MD_MiniMDBreak, W("MD_MiniMDBreak"), 0, "ASSERT when creating CMiniMdRw class", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_MD_PreSaveBreak, W("MD_PreSaveBreak"), 0, "ASSERT when calling CMiniMdRw::PreSave", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_MD_RegMetaBreak, W("MD_RegMetaBreak"), 0, "ASSERT when creating RegMeta class", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_MD_RegMetaDump, W("MD_RegMetaDump"), 0, "? Dump MD in 4 functions?", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_MD_TlbImp_BreakOnErr, W("MD_TlbImp_BreakOnErr"), 0, "ASSERT when importing TLB into MD", CLRConfig::REGUTIL_default)
+CONFIG_STRING_INFO_EX(INTERNAL_MD_TlbImp_BreakOnTypeImport, W("MD_TlbImp_BreakOnTypeImport"), "ASSERT when importing a type from TLB", (CLRConfig::LookupOptions) (CLRConfig::REGUTIL_default | CLRConfig::DontPrependCOMPlus_))
+// MetaData - Desktop-only
+#ifndef FEATURE_CORECLR
+RETAIL_CONFIG_DWORD_INFO_EX(INTERNAL_MD_UseMinimalDeltas, W("MD_UseMinimalDeltas"), 1, "? Some MD modifications when applying EnC?", CLRConfig::REGUTIL_default)
+#endif //!FEATURE_CORECLR
+CONFIG_DWORD_INFO_EX(INTERNAL_MD_WinMD_Disable, W("MD_WinMD_Disable"), 0, "Never activate the WinMD import adapter", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_MD_WinMD_AssertOnIllegalUsage, W("MD_WinMD_AssertOnIllegalUsage"), 0, "ASSERT if a WinMD import adapter detects a tool incompatibility", CLRConfig::REGUTIL_default)
+
+// Metadata - mscordbi only - this flag is only intended to mitigate potential issues in bug fix 458597.
+RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_MD_PreserveDebuggerMetadataMemory, W("MD_PreserveDebuggerMetadataMemory"), 0, "Save all versions of metadata memory in the debugger when debuggee metadata is updated", CLRConfig::REGUTIL_default)
+
+//
+// MDA ?
+//
+RETAIL_CONFIG_STRING_INFO_EX(EXTERNAL_MDA, W("MDA"), "Config string to determine which MDAs to enable", CLRConfig::REGUTIL_default)
+CONFIG_STRING_INFO_EX(INTERNAL_MDAValidateFramework, W("MDAValidateFramework"), "If set, validate the XML schema for MDA", CLRConfig::REGUTIL_default)
+
+
+//
+// Spinning heuristics
+// Note that these only take effect once the runtime has been started; prior to that the values hardcoded in g_SpinConstants (vars.cpp) are used
+//
+RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_SpinInitialDuration, W("SpinInitialDuration"), 0x32, "Hex value specifying the first spin duration", EEConfig_default)
+RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_SpinBackoffFactor, W("SpinBackoffFactor"), 0x3, "Hex value specifying the growth of each successive spin duration", EEConfig_default)
+RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_SpinLimitProcCap, W("SpinLimitProcCap"), 0xFFFFFFFF, "Hex value specifying the largest value of NumProcs to use when calculating the maximum spin duration", EEConfig_default)
+RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_SpinLimitProcFactor, W("SpinLimitProcFactor"), 0x4E20, "Hex value specifying the multiplier on NumProcs to use when calculating the maximum spin duration", EEConfig_default)
+RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_SpinLimitConstant, W("SpinLimitConstant"), 0x0, "Hex value specifying the constant to add when calculating the maximum spin duration", EEConfig_default)
+RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_SpinRetryCount, W("SpinRetryCount"), 0xA, "Hex value specifying the number of times the entire spin process is repeated (when applicable)", EEConfig_default)
+
+//
+// Native Binder
+//
+
+CONFIG_DWORD_INFO(INTERNAL_NgenBind_UseTimestamp, W("NgenBind_UseTimestamp"), 0, "Use timestamp to validate a native image")
+CONFIG_STRING_INFO(INTERNAL_NgenBind_UseTimestampList, W("NgenBind_UseTimestampList"), "")
+CONFIG_STRING_INFO(INTERNAL_NgenBind_UseTimestampExcludeList, W("NgenBind_UseTimestampExcludeList"), "")
+
+CONFIG_DWORD_INFO(INTERNAL_NgenBind_ZapForbid, W("NgenBind_ZapForbid"), 0, "Assert if an assembly succeeds in binding to a native image")
+CONFIG_STRING_INFO(INTERNAL_NgenBind_ZapForbidExcludeList, W("NgenBind_ZapForbidExcludeList"), "")
+CONFIG_STRING_INFO(INTERNAL_NgenBind_ZapForbidList, W("NgenBind_ZapForbidList"), "")
+
+RETAIL_CONFIG_DWORD_INFO(EXTERNAL_NgenBind_OptimizeNonGac, W("NgenBind_OptimizeNonGac"), 0, "Skip loading IL image outside of GAC when NI can be loaded")
+
+CONFIG_DWORD_INFO_EX(INTERNAL_SymDiffDump, W("SymDiffDump"), 0, "Used to create the map file while binding the assembly. Used by SemanticDiffer", CLRConfig::REGUTIL_default)
+
+//
+// NGEN
+//
+RETAIL_CONFIG_STRING_INFO_EX(EXTERNAL_NGen_JitName, W("NGen_JitName"), "", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_NGEN_USE_PRIVATE_STORE, W("NGEN_USE_PRIVATE_STORE"), -1, "", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_NGENBreakOnInjectPerAssemblyFailure, W("NGENBreakOnInjectPerAssemblyFailure"), 0, "", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_NGENBreakOnInjectTransientFailure, W("NGENBreakOnInjectTransientFailure"), 0, "", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_NGENBreakOnWorker, W("NGENBreakOnWorker"), 0, "", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_NGenClean, W("NGenClean"), 0, "", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_EX(UNSUPPORTED_NGenCompileWorkerHang, W("NGenCompileWorkerHang"), 0, "If set to 1, NGen compile worker process hangs forever", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_NGenDeferAllCompiles, W("NGenDeferAllCompiles"), 0, "", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_EX(UNSUPPORTED_NGenDependencyWorkerHang, W("NGenDependencyWorkerHang"), 0, "If set to 1, NGen dependency walk worker process hangs forever", CLRConfig::REGUTIL_default)
+CONFIG_STRING_INFO_EX(INTERNAL_NgenDisasm, W("NgenDisasm"), "Same as JitDisasm, but for ngen", CLRConfig::REGUTIL_default)
+CONFIG_STRING_INFO_EX(INTERNAL_NgenDump, W("NgenDump"), "Same as JitDump, but for ngen", CLRConfig::REGUTIL_default)
+CONFIG_STRING_INFO_EX(INTERNAL_NgenDumpIR, W("NgenDumpIR"), "Same as JitDumpIR, but for ngen", CLRConfig::REGUTIL_default)
+CONFIG_STRING_INFO_EX(INTERNAL_NgenDumpIRFormat, W("NgenDumpIRFormat"), "Same as JitDumpIRFormat, but for ngen", CLRConfig::REGUTIL_default)
+CONFIG_STRING_INFO_EX(INTERNAL_NgenDumpIRPhase, W("NgenDumpIRPhase"), "Same as JitDumpIRPhase, but for ngen", CLRConfig::REGUTIL_default)
+CONFIG_STRING_INFO_EX(INTERNAL_NgenDumpFg, W("NgenDumpFg"), "Ngen Xml Flowgraph support", CLRConfig::REGUTIL_default)
+CONFIG_STRING_INFO_EX(INTERNAL_NgenDumpFgDir, W("NgenDumpFgDir"), "Ngen Xml Flowgraph support", CLRConfig::REGUTIL_default)
+CONFIG_STRING_INFO_EX(INTERNAL_NgenDumpFgFile, W("NgenDumpFgFile"), "Ngen Xml Flowgraph support", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_EX(UNSUPPORTED_NGenFramed, W("NGenFramed"), -1, "same as JitFramed, but for ngen", CLRConfig::REGUTIL_default)
+CONFIG_STRING_INFO_EX(INTERNAL_NgenGCDump, W("NgenGCDump"), "", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_NgenHashDump, W("NgenHashDump"), (DWORD)-1, "same as JitHashDump, but for ngen", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_NgenHashDumpIR, W("NgenHashDumpIR"), (DWORD)-1, "same as JitHashDumpIR, but for ngen", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_NGENInjectFailuresServiceOnly, W("NGENInjectFailuresServiceOnly"), 1, "", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_NGENInjectPerAssemblyFailure, W("NGENInjectPerAssemblyFailure"), 0, "", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_NGENInjectTransientFailure, W("NGENInjectTransientFailure"), 0, "", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_NGenLocalWorker, W("NGenLocalWorker"), 0, "", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_EX(UNSUPPORTED_NGenMaxLogSize, W("NGenMaxLogSize"), 0, "The maximum size ngen.log and ngen_service.log files can grow to.", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_NGenLogVerbosity, W("NGenLogVerbosity"), 2, "Default ngen log verbosity level", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_NGenOnlyOneMethod, W("NGenOnlyOneMethod"), 0, "", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_NgenOrder, W("NgenOrder"), 0, "", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_CheckNGenImageTimeStamp, W("CheckNGenImageTimeStamp"), 1, "Used to skip ngen timestamp check when switching compilers around.", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_NGenRegistryAccessCount, W("NGenRegistryAccessCount"), -1, "", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_NGenStressDelete, W("NGenStressDelete"), 0, "", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_STRING_INFO(INTERNAL_NGenUninstallKeep, W("NGenUninstallKeep"), "Semicolon-delimited list of assemblies to keep during 'ngen uninstall *'")
+CONFIG_STRING_INFO(INTERNAL_NgenUnwindDump, W("NgenUnwindDump"), "Dump the unwind codes for the method")
+CONFIG_STRING_INFO(INTERNAL_NgenEHDump, W("NgenEHDump"), "Dump the EH table for the method, as reported to the VM")
+RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_NGENUseService, W("NGENUseService"), 1, "", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_NGenWorkerCount, W("NGenWorkerCount"), 0, "", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_partialNGenStress, W("partialNGenStress"), 0, "", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_ZapDoNothing, W("ZapDoNothing"), 0, "", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(EXTERNAL_HardPrejitEnabled, W("HardPrejitEnabled"), "")
+RETAIL_CONFIG_DWORD_INFO_EX(INTERNAL_EnableHardbinding, W("EnableHardbinding"), 0, "Enables the use of hardbinding", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_WorkerRetryNgenFailures, W("WorkerRetryNgenFailures"), 0, "If set to 1, The Ngen worker will retry once when ngen fails", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_NgenForceFailureMask, W("NgenForceFailureMask"), -1, "Bitmask used to control which locations will check and raise the failure (defaults to bits: -1)", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_NgenForceFailureCount, W("NgenForceFailureCount"), 0, "If set to >0 and we have IBC data we will force a failure after we reference an IBC data item <value> times", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_NgenForceFailureKind, W("NgenForceFailureKind"), 1, "If set to 1, We will throw a TypeLoad exception; If set to 2, We will cause an A/V", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_NGenEnableCreatePdb, W("NGenEnableCreatePdb"), 0, "If set to >0 ngen.exe displays help on, recognizes createpdb in the command line")
+RETAIL_CONFIG_DWORD_INFO(INTERNAL_NGenSimulateDiskFull, W("NGenSimulateDiskFull"), 0, "If set to 1, ngen will throw a Disk full exception in ZapWriter.cpp:Save()")
+RETAIL_CONFIG_STRING_INFO(INTERNAL_NGenAssemblyUsageLog, W("NGenAssemblyUsageLog"), "Directory to store ngen usage logs in.")
+#ifdef FEATURE_APPX
+RETAIL_CONFIG_DWORD_INFO(INTERNAL_NGenAssemblyUsageLogRefreshInterval, W("NGenAssemblyUsageLogRefreshInterval"), 24 * 60 * 60, "Interval to update usage log timestamp (seconds)");
+#endif
+RETAIL_CONFIG_DWORD_INFO(INTERNAL_AppLocalAutongenNGenDisabled, W("AppLocalAutongenNGenDisabled"), 0, "Autongen disable flag.")
+RETAIL_CONFIG_DWORD_INFO(INTERNAL_PartialNGen, W("PartialNGen"), -1, "Generate partial NGen images")
+RETAIL_CONFIG_DWORD_INFO(INTERNAL_NgenAllowMscorlibSoftbind, W("NgenAllowMscorlibSoftbind"), 0, "Disable forced hard-binding to mscorlib")
+RETAIL_CONFIG_STRING_INFO_EX(UNSUPPORTED_RegistryRoot, W("RegistryRoot"), "Redirects all registry access under HKLM\Software to a specified alternative", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_STRING_INFO_EX(UNSUPPORTED_AssemblyPath, W("AssemblyPath"), "Redirects v2 GAC access to a specified alternative path", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_STRING_INFO_EX(UNSUPPORTED_AssemblyPath2, W("AssemblyPath2"), "Redirects v4 GAC access to a specified alternative path", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_STRING_INFO_EX(UNSUPPORTED_NicPath, W("NicPath"), "Redirects NIC access to a specified alternative", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO(INTERNAL_NGenTaskDelayStart, W("NGenTaskDelayStart"), 0, "Use NGen Task delay start trigger, instead of critical idle task")
+
+// Flag for cross-platform ngen: Removes all execution of managed or third-party code in the ngen compilation process.
+#ifdef FEATURE_CORECLR
+RETAIL_CONFIG_DWORD_INFO(INTERNAL_Ningen, W("Ningen"), 1, "Enable no-impact ngen")
+#else
+// Ningen is off by default for desktop to reduce compat risk
+RETAIL_CONFIG_DWORD_INFO(INTERNAL_Ningen, W("Ningen"), 0, "Enable no-impact ngen")
+#endif
+
+CONFIG_DWORD_INFO(INTERNAL_NoASLRForNgen, W("NoASLRForNgen"), 0, "Turn off IMAGE_DLLCHARACTERISTICS_DYNAMIC_BASE bit in generated ngen images. Makes nidump output repeatable from run to run.")
+RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_NgenAllowOutput, W("NgenAllowOutput"), 0, "If set to 1, the NGEN worker will bind to the parent console, thus allowing stdout output to work", CLRConfig::REGUTIL_default)
+
+#ifdef CROSSGEN_COMPILE
+RETAIL_CONFIG_DWORD_INFO(INTERNAL_CrossGenAssumeInputSigned, W("CrossGenAssumeInputSigned"), 1, "CrossGen should assume that its input assemblies will be signed before deployment")
+#endif
+
+//
+// NGEN service
+//
+// UNSUPPORTED_NGenMaxLogSize from NGEN section also applies to NGEN service.
+RETAIL_CONFIG_DWORD_INFO_EX(INTERNAL_NGENServiceAbortIdleWorkUnderDebugger, W("NGENServiceAbortIdleWorkUnderDebugger"), 1, "Determines whether the Ngen service will abort idle-time tasks while under a debugger. Off by default. Allows for single-machine debugging of the idle-time logic.", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_NGENServiceAggressiveHardDiskIdleTimeout, W("NGENServiceAggressiveHardDiskIdleTimeout"), 1*60*60*1000, "This flag was intended as a backstop for HDD idle time detection (i.e. even if the hard disk is not idle, proceed with the compilation of the high-priority assemblies after the specified timeout). The current implementation compiles high-priority assemblies regardless of the state of the machine.", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_NGENServiceAggressiveWorkWaitTimeout, W("NGENServiceAggressiveWorkWaitTimeout"), 0, "This flag was intended as a backstop for machine idle time detection (i.e. even if the machine is not idle, proceed with the compilation of the high-priority assemblies after the specified timeout). The current implementation compiles high-priority assemblies regardless of the state of the machine.", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_EX(UNSUPPORTED_NGENServiceBreakOnStart, W("NGENServiceBreakOnStart"), 0, "Determines whether the Ngen service will call DebugBreak in its start routing. Off by default. Marginally useful for debugging service startup (there are other techniques as well).", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_EX(UNSUPPORTED_NGENServiceConservative, W("NGENServiceConservative"), 0, "Determines whether the Ngen service will avoid compiling low-priority assemblies if multiple sessions exist on the machine and it can't determine their state. Off by default.", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_EX(UNSUPPORTED_NGenServiceDebugLog, W("NGenServiceDebugLog"), 0, "Configures the level of debug logging.", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_EX(UNSUPPORTED_NGENServiceIdleBatteryThreshold, W("NGENServiceIdleBatteryThreshold"), 50, "When a battery-powered system is below the threshold, Ngen will not process low-priority assemblies.", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_EX(UNSUPPORTED_NGENServiceIdleDebugInfo, W("NGENServiceIdleDebugInfo"), 0, "Determines whether the Ngen service will print the idle-time detection criteria to the debug log. Off by default. Ignored if NGenServiceDebugLog is 0.", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_EX(UNSUPPORTED_NGENServiceIdleDiskLogic, W("NGENServiceIdleDiskLogic"), 1, "Determines if the Ngen service will use hard disk idle time for its machine idle time heuristics.", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_EX(UNSUPPORTED_NGENServiceIdleDiskThreshold, W("NGENServiceIdleDiskThreshold"), 80, "The amount of time after which a disk is declared idle.", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_EX(UNSUPPORTED_NGENServiceIdleNoInputPeriod, W("NGENServiceIdleNoInputPeriod"), 5*60*1000, "The amount of time after which the machine is declared idle if no input was received.", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_EX(UNSUPPORTED_NGENServicePassiveExceptInputTimeout, W("NGENServicePassiveExceptInputTimeout"), 15*60*60*1000, "The amount of time after which only input state is considered for idle time detection (input backstop mode, which ignores everything except input).", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_EX(UNSUPPORTED_NGENServicePassiveHardDiskIdleTimeout, W("NGENServicePassiveHardDiskIdleTimeout"), 36*60*60*1000, "The amount of time after which the state of the hard disk is ignored for idle time detection.", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_EX(UNSUPPORTED_NGENServicePassiveWorkWaitTimeout, W("NGENServicePassiveWorkWaitTimeout"), 0, "The amount of time after which the machine is declared idle and low priority assemblies are compiled no matter what the actual state is (absolute backstop mode: declaring the machine as idle disregarding the actual state).", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(UNSUPPORTED_NGENServicePolicy, W("NGENServicePolicy"), "The policy that will be used for the machine (client or server). By default, it's determined from the OS SKU.")
+RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_NGENServiceRestrictWorkersPrivileges, W("NGENServiceRestrictWorkersPrivileges"), 1, "Determines if worker processes are launched with restricted tokens.")
+RETAIL_CONFIG_DWORD_INFO_EX(UNSUPPORTED_NGENServiceSynchronization, W("NGENServiceSynchronization"), 1, "Determines if multiple services coordinate themselves so that only one service is working at a time.", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_STRING_INFO_DIRECT_ACCESS(UNSUPPORTED_NGENServiceTestHookDll, W("NGENServiceTestHookDll"), "The name of a module used for testing in-process")
+RETAIL_CONFIG_STRING_INFO_DIRECT_ACCESS(UNSUPPORTED_NGENServiceWaitAggressiveWork, W("NGENServiceWaitAggressiveWork"), "Specifies how often the service will check the machine state when trying to do high-priority work.")
+RETAIL_CONFIG_DWORD_INFO_EX(UNSUPPORTED_NGENServiceWaitPassiveWork, W("NGENServiceWaitPassiveWork"), 1*60*1000, "Specifies how often the service will check the machine state when trying to do low-priority work.", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_EX(UNSUPPORTED_NGENServiceWaitWorking, W("NGENServiceWaitWorking"), 1000, "While working, the Ngen service polls the state of the machine for changes (another service trying to do higher priority work, the Ngen command line tool trying to do work, machine coming out of idle state). This variable controls the frequency of the polling.", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(UNSUPPORTED_NGENServiceWorkerPriority, W("NGENServiceWorkerPriority"), "The process priority class for workers.")
+RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_EnableMultiproc, W("EnableMultiproc"), 1, "Turns on multiproc ngen", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_SvcRetryNgenFailures, W("SvcRetryNgenFailures"), 1, "If set to 1, The Ngen service will retry once when ngen fails", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_EX(INTERNAL_NGenTaskDelayStartAmount, W("NGenTaskDelayStartAmount"), 5 * 60, "Number of seconds to delay for ngen update /queue /delay", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_EX(INTERNAL_NGenProtectedProcess_FeatureEnabled, W("NGenProtectedProcess_FeatureEnabled"), -1, "Run ngen as PPL (protected process) if needed. Set to 0 to disable the feature for compat with older Win8 builds.", CLRConfig::IgnoreConfigFiles)
+CONFIG_STRING_INFO_EX(INTERNAL_NGenProtectedProcess_RequiredList, W("NGenProtectedProcess_RequiredList"), "Semicolon-separated list of assembly names that are required to be ngen'd in PPL process. Each name in the list is matched as prefix or suffix of assembly name/assembly file name.", CLRConfig::IgnoreConfigFiles)
+CONFIG_STRING_INFO_EX(INTERNAL_NGenProtectedProcess_ForbiddenList, W("NGenProtectedProcess_ForbiddenList"), "Semicolon-separated list of assembly names that are forbidden to be ngen'd in PPL process. Each name in the list is matched as prefix or suffix of assembly name/assembly file name.", CLRConfig::IgnoreConfigFiles)
+RETAIL_CONFIG_DWORD_INFO_EX(INTERNAL_NGenCopyFromRepository_SetCachedSigningLevel, W("NGenCopyFromRepository_SetCachedSigningLevel"), 0, "Support for test tree ngen.exe flag /CopyFromRepository to also vouch for the output NIs.", CLRConfig::IgnoreConfigFiles)
+
+//
+// Perf
+//
+RETAIL_CONFIG_STRING_INFO(EXTERNAL_PerformanceScenario, W("performanceScenario"), "Activates a set of workload-specific default values for performance settings")
+
+//
+// Perfcounters
+//
+RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_ProcessNameFormat, W("ProcessNameFormat"), (DWORD)-1, "Used by corperfmonext.dll to determine whether to decorate an instance name with the corresponding PID and runtime ID", CLRConfig::IgnoreHKLM | CLRConfig::IgnoreHKCU | CLRConfig::IgnoreConfigFiles)
+
+//
+// Profiling API / ETW
+//
+RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_COR_ENABLE_PROFILING, W("COR_ENABLE_PROFILING"), 0, "Flag to indicate whether profiling should be enabled for the currently running process.", CLRConfig::DontPrependCOMPlus_ | CLRConfig::IgnoreConfigFiles)
+RETAIL_CONFIG_STRING_INFO_EX(EXTERNAL_COR_PROFILER, W("COR_PROFILER"), "Specifies GUID of profiler to load into currently running process", CLRConfig::DontPrependCOMPlus_)
+RETAIL_CONFIG_STRING_INFO_EX(EXTERNAL_COR_PROFILER_PATH, W("COR_PROFILER_PATH"), "Specifies the path to the DLL of profiler to load into currently running process", CLRConfig::DontPrependCOMPlus_)
+RETAIL_CONFIG_STRING_INFO_EX(EXTERNAL_COR_PROFILER_PATH_32, W("COR_PROFILER_PATH_32"), "Specifies the path to the DLL of profiler to load into currently running 32 bits process", CLRConfig::DontPrependCOMPlus_)
+RETAIL_CONFIG_STRING_INFO_EX(EXTERNAL_COR_PROFILER_PATH_64, W("COR_PROFILER_PATH_64"), "Specifies the path to the DLL of profiler to load into currently running 64 bits process", CLRConfig::DontPrependCOMPlus_)
+RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_CORECLR_ENABLE_PROFILING, W("CORECLR_ENABLE_PROFILING"), 0, "CoreCLR only: Flag to indicate whether profiling should be enabled for the currently running process.", CLRConfig::DontPrependCOMPlus_ | CLRConfig::IgnoreConfigFiles)
+RETAIL_CONFIG_STRING_INFO_EX(EXTERNAL_CORECLR_PROFILER, W("CORECLR_PROFILER"), "CoreCLR only: Specifies GUID of profiler to load into currently running process", CLRConfig::DontPrependCOMPlus_)
+RETAIL_CONFIG_STRING_INFO_EX(EXTERNAL_CORECLR_PROFILER_PATH, W("CORECLR_PROFILER_PATH"), "CoreCLR only: Specifies the path to the DLL of profiler to load into currently running process", CLRConfig::DontPrependCOMPlus_)
+RETAIL_CONFIG_STRING_INFO_EX(EXTERNAL_CORECLR_PROFILER_PATH_32, W("CORECLR_PROFILER_PATH_32"), "CoreCLR only: Specifies the path to the DLL of profiler to load into currently running 32 process", CLRConfig::DontPrependCOMPlus_)
+RETAIL_CONFIG_STRING_INFO_EX(EXTERNAL_CORECLR_PROFILER_PATH_64, W("CORECLR_PROFILER_PATH_64"), "CoreCLR only: Specifies the path to the DLL of profiler to load into currently running 64 process", CLRConfig::DontPrependCOMPlus_)
+RETAIL_CONFIG_STRING_INFO_EX(EXTERNAL_ProfAPI_ProfilerCompatibilitySetting, W("ProfAPI_ProfilerCompatibilitySetting"), "Specifies the profiler loading policy (the default is not to load a V2 profiler in V4)", CLRConfig::REGUTIL_default | CLRConfig::TrimWhiteSpaceFromStringValue)
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(EXTERNAL_AttachThreadAlwaysOn, W("AttachThreadAlwaysOn"), "Forces profapi attach thread to be created on startup, instead of on-demand.")
+RETAIL_CONFIG_DWORD_INFO(EXTERNAL_MsBetweenAttachCheck, W("MsBetweenAttachCheck"), 500, "")
+RETAIL_CONFIG_DWORD_INFO(EXTERNAL_ProfAPIMaxWaitForTriggerMs, W("ProfAPIMaxWaitForTriggerMs"), 5*60*1000, "Timeout in ms for profilee to wait for each blocking operation performed by trigger app.")
+RETAIL_CONFIG_DWORD_INFO(EXTERNAL_ProfAPI_DetachMinSleepMs, W("ProfAPI_DetachMinSleepMs"), 0, "The minimum time, in millseconds, the CLR will wait before checking whether a profiler that is in the process of detaching is ready to be unloaded.")
+RETAIL_CONFIG_DWORD_INFO(EXTERNAL_ProfAPI_DetachMaxSleepMs, W("ProfAPI_DetachMaxSleepMs"), 0, "The maximum time, in millseconds, the CLR will wait before checking whether a profiler that is in the process of detaching is ready to be unloaded.")
+CONFIG_DWORD_INFO(INTERNAL_ProfAPI_EnableRejitDiagnostics, W("ProfAPI_EnableRejitDiagnostics"), 0, "Enable extra dumping to stdout of rejit structures")
+RETAIL_CONFIG_DWORD_INFO(EXTERNAL_ProfAPI_AttachProfilerMinTimeoutInMs, W("ProfAPI_AttachProfilerMinTimeoutInMs"), 10*1000, "Timeout in ms for the minimum time out value of AttachProfiler")
+CONFIG_DWORD_INFO(INTERNAL_ProfAPIFault, W("ProfAPIFault"), 0, "Test-only bitmask to inject various types of faults in the profapi code")
+CONFIG_DWORD_INFO(INTERNAL_TestOnlyAllowedEventMask, W("TestOnlyAllowedEventMask"), 0, "Test-only bitmask to allow profiler tests to override CLR enforcement of COR_PRF_ALLOWABLE_AFTER_ATTACH and COR_PRF_MONITOR_IMMUTABLE")
+CONFIG_DWORD_INFO(INTERNAL_TestOnlyEnableICorProfilerInfo, W("ProfAPI_TestOnlyEnableICorProfilerInfo"), 0, "Test-only flag to allow attaching profiler tests to call ICorProfilerInfo interface, which would otherwise be disallowed for attaching profilers")
+CONFIG_DWORD_INFO(INTERNAL_TestOnlyEnableObjectAllocatedHook, W("TestOnlyEnableObjectAllocatedHook"), 0, "Test-only flag that forces CLR to initialize on startup as if ObjectAllocated callback were requested, to enable post-attach ObjectAllocated functionality.")
+CONFIG_DWORD_INFO(INTERNAL_TestOnlyEnableSlowELTHooks, W("TestOnlyEnableSlowELTHooks"), 0, "Test-only flag that forces CLR to initialize on startup as if slow-ELT were requested, to enable post-attach ELT functionality.")
+
+RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_PreVistaETWEnabled, W("ETWEnabled"), 0, "This flag is used on OSes < Vista to enable/disable ETW. It is disabled by default", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_VistaAndAboveETWEnabled, W("ETWEnabled"), 1, "This flag is used on OSes >= Vista to enable/disable ETW. It is enabled by default", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_STRING_INFO_EX(UNSUPPORTED_ETW_ObjectAllocationEventsPerTypePerSec, W("ETW_ObjectAllocationEventsPerTypePerSec"), "Desired number of GCSampledObjectAllocation ETW events to be logged per type per second. If 0, then the default built in to the implementation for the enabled event (e.g., High, Low), will be used.", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_ProfAPI_ValidateNGENInstrumentation, W("ProfAPI_ValidateNGENInstrumentation"), 0, "This flag enables additional validations when using the IMetaDataEmit APIs for NGEN'ed images to ensure only supported edits are made.")
+
+#ifdef FEATURE_PERFMAP
+RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_PerfMapEnabled, W("PerfMapEnabled"), 0, "This flag is used on Linux to enable writing /tmp/perf-$pid.map. It is disabled by default", CLRConfig::REGUTIL_default)
+#endif
+
+//
+// Shim
+//
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(UNSUPPORTED_EnableIEHosting, W("EnableIEHosting"), "Allow activation of IE hosting")
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(UNSUPPORTED_NoGuiFromShim, W("NoGuiFromShim"), "Turn off GUI in shim")
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(UNSUPPORTED_OnlyUseLatestCLR, W("OnlyUseLatestCLR"), "Big red switch for loading CLR")
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(UNSUPPORTED_FailOnInProcSxS, W("FailOnInProcSxS"), "Fails the process when a second runtime is loaded in-process")
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(UNSUPPORTED_UseLegacyV2RuntimeActivationPolicyDefaultValue, W("UseLegacyV2RuntimeActivationPolicyDefaultValue"), "Modifies the default value")
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(UNSUPPORTED_ErrorDialog, W("ErrorDialog"), "Allow showing UI on error")
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(UNSUPPORTED_Fod, W("Fod"), "Test the Feature On Demand installation")
+RETAIL_CONFIG_STRING_INFO_DIRECT_ACCESS(UNSUPPORTED_FodPath, W("FodPath"), "Name of executable for Feature On Demand mockup")
+RETAIL_CONFIG_STRING_INFO_DIRECT_ACCESS(UNSUPPORTED_FodArgs, W("FodArgs"), "Command line arguments to pass to the FOD process")
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(UNSUPPORTED_FodLaunchAsync, W("FodLaunchAsync"), "Whether to launch FOD asynchronously.")
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(UNSUPPORTED_FodConservativeMode, W("FodConservativeMode"), "Whether to be conservative wrt Fod launch.")
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(EXTERNAL_ApplicationMigrationRuntimeActivationConfigPath, W("ApplicationMigrationRuntimeActivationConfigPath"), "Provides a path in which to look for configuration files to be used for runtime activation, for application migration scenarios, before looking next to the EXE itself.")
+CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_TestOnlyEnsureImmersive, W("TestOnlyEnsureImmersive"), "Test-only flag used to indicate that it is expected that a process should be running as immersive.")
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_EnableCoreClrHost, W("EnableCoreClrHost"), "Enables hosting coreclr from desktop mscoreei.dll to run windows store apps")
+
+
+//
+// Security
+//
+CONFIG_STRING_INFO_EX(INTERNAL_Security_AptcaAssemblyBreak, W("AptcaAssemblyBreak"), "Sets a breakpoint when checking if an assembly is APTCA or not", CLRConfig::REGUTIL_default)
+CONFIG_STRING_INFO(INTERNAL_Security_AptcaAssemblySharingBreak, W("AptcaAssemblySharingBreak"), "Sets a breakpoint when checking if we can code share an assembly")
+CONFIG_DWORD_INFO(INTERNAL_Security_AptcaAssemblySharingDomainBreak, W("AptcaAssemblySharingDomainBreak"), 0, "Sets a breakpoint only in the specified domain when checking if we can code share an assembly")
+RETAIL_CONFIG_DWORD_INFO(INTERNAL_Security_DefaultSecurityRuleSet, W("DefaultSecurityRuleSet"), 0, "Overrides the security rule set that assemblies which don't explicitly select their own rule set should use")
+RETAIL_CONFIG_DWORD_INFO(EXTERNAL_Security_LegacyCasPolicy, W("legacyCasPolicy"), 0, "Enable CAS policy for the process - for test use only, official access to this switch is through NetFx40_LegacySecurityPolicy.")
+RETAIL_CONFIG_DWORD_INFO(EXTERNAL_Security_LoadFromRemoteSources, W("loadFromRemoteSources"), 0, "Enable loading from zones that are not MyComputer when not in CAS mode.")
+CONFIG_DWORD_INFO(UNSUPPORTED_Security_LogTransparencyErrors, W("LogTransparencyErrors"), 0, "Add an entry to the CLR log file for all transparency errors, rather than throwing an exception")
+RETAIL_CONFIG_DWORD_INFO(EXTERNAL_Security_NetFx40LegacySecurityPolicy, W("NetFx40_LegacySecurityPolicy"), 0, "Enable CAS policy for the process.")
+CONFIG_DWORD_INFO(INTERNAL_Security_NGenForPartialTrust, W("NGenForPartialTrust"), 0, "Force NGEN to generate code for assemblies that could be used in partial trust.")
+CONFIG_STRING_INFO_EX(INTERNAL_Security_TransparencyFieldBreak, W("TransparencyFieldBreak"), "Sets a breakpoint when figuring out the transparency of a specific field", CLRConfig::REGUTIL_default)
+CONFIG_STRING_INFO_EX(INTERNAL_Security_TransparencyMethodBreak, W("TransparencyMethodBreak"), "Sets a breakpoint when figuring out the transparency of a specific method", CLRConfig::REGUTIL_default)
+CONFIG_STRING_INFO_EX(INTERNAL_Security_TransparencyTypeBreak, W("TransparencyTypeBreak"), "Sets a breakpoint when figuring out the transparency of a specific type", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO(INTERNAL_Security_AlwaysInsertCallout, W("AlwaysInsertCallout"), 0, "Always insert security access/transparency/APTCA callouts")
+RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_Security_DisableAnonymouslyHostedDynamicMethodCreatorSecurityCheck, W("DisableAnonymouslyHostedDynamicMethodCreatorSecurityCheck"), 0, "Disables security checks for anonymously hosted dynamic methods based on their creator's security.")
+
+//
+// Serialization
+//
+RETAIL_CONFIG_DWORD_INFO(EXTERNAL_Serialization_UnsafeTypeForwarding, W("unsafeTypeForwarding"), 0, "Enable unsafe type forwarding between unrelated assemblies")
+
+//
+// Stack overflow
+//
+CONFIG_DWORD_INFO_EX(INTERNAL_SOBreakOnProbeDuringSO, W("SOBreakOnProbeDuringSO"), 0, "", CLRConfig::REGUTIL_default)
+CONFIG_STRING_INFO_EX(INTERNAL_SODumpViolationsDir, W("SODumpViolationsDir"), "", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_SODumpViolationsStackTraceLength, W("SODumpViolationsStackTraceLength"), "")
+CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_SOEnableBackoutStackValidation, W("SOEnableBackoutStackValidation"), "")
+CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_SOEnableDefaultRWValidation, W("SOEnableDefaultRWValidation"), "")
+CONFIG_DWORD_INFO_EX(INTERNAL_SOEnableStackProtectionInDebugger, W("SOEnableStackProtectionInDebugger"), 0, "", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_SOEnableStackProtectionInDebuggerForProbeAtLine, W("SOEnableStackProtectionInDebuggerForProbeAtLine"), 0, "", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_SOEntryPointProbe, W("SOEntryPointProbe"), "")
+CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_SOInteriorProbe, W("SOInteriorProbe"), "")
+CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_SOLogger, W("SOLogger"), "")
+CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_SOProbeAssertOnOverrun, W("SOProbeAssertOnOverrun"), "")
+CONFIG_DWORD_INFO_EX(INTERNAL_SOUpdateProbeAtLine, W("SOUpdateProbeAtLine"), 0, "", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_SOUpdateProbeAtLineAmount, W("SOUpdateProbeAtLineAmount"), 0, "", CLRConfig::REGUTIL_default)
+CONFIG_STRING_INFO_EX(INTERNAL_SOUpdateProbeAtLineInFile, W("SOUpdateProbeAtLineInFile"), "", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_StackWalkStressUsingOldImpl, W("StackWalkStressUsingOldImpl"), 0, "to be removed", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_StackWalkStressUsingOS, W("StackWalkStressUsingOS"), 0, "to be removed", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_STRING_INFO(EXTERNAL_StartupDelayMS, W("StartupDelayMS"), "")
+
+//
+// Stress
+//
+CONFIG_DWORD_INFO_EX(INTERNAL_StressCOMCall, W("StressCOMCall"), 0, "", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(UNSUPPORTED_StressLog, W("StressLog"), "Turns on the stress log.")
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(UNSUPPORTED_ForceEnc, W("ForceEnc"), "Forces Edit and Continue to be on for all eligable modules.")
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(UNSUPPORTED_StressLogSize, W("StressLogSize"), "Stress log size in bytes per thread.")
+CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_StressOn, W("StressOn"), "Enables the STRESS_ASSERT macro that stops runtime quickly (to prevent the clr state from changing significantly before breaking)")
+CONFIG_DWORD_INFO_EX(INTERNAL_stressSynchronized, W("stressSynchronized"), 0, "Unknown if or where this is used; unless a test is specifically depending on this, it can be removed.", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(EXTERNAL_StressThreadCount, W("StressThreadCount"), "")
+
+//
+// Thread Suspend
+//
+CONFIG_DWORD_INFO(INTERNAL_DiagnosticSuspend, W("DiagnosticSuspend"), 0, "")
+CONFIG_DWORD_INFO(INTERNAL_SuspendDeadlockTimeout, W("SuspendDeadlockTimeout"), 40000, "")
+CONFIG_DWORD_INFO(INTERNAL_SuspendThreadDeadlockTimeoutMs, W("SuspendThreadDeadlockTimeoutMs"), 2000, "")
+RETAIL_CONFIG_DWORD_INFO(INTERNAL_ThreadSuspendInjection, W("INTERNAL_ThreadSuspendInjection"), 1, "Specifies whether to inject activations for thread suspension on Unix")
+
+//
+// Threadpool
+//
+RETAIL_CONFIG_DWORD_INFO(INTERNAL_ThreadPool_ForceMinWorkerThreads, W("ThreadPool_ForceMinWorkerThreads"), 0, "Overrides the MinThreads setting for the ThreadPool worker pool")
+RETAIL_CONFIG_DWORD_INFO(INTERNAL_ThreadPool_ForceMaxWorkerThreads, W("ThreadPool_ForceMaxWorkerThreads"), 0, "Overrides the MaxThreads setting for the ThreadPool worker pool")
+RETAIL_CONFIG_DWORD_INFO(INTERNAL_ThreadPool_DisableStarvationDetection, W("ThreadPool_DisableStarvationDetection"), 0, "Disables the ThreadPool feature that forces new threads to be added when workitems run for too long")
+RETAIL_CONFIG_DWORD_INFO(INTERNAL_ThreadPool_DebugBreakOnWorkerStarvation, W("ThreadPool_DebugBreakOnWorkerStarvation"), 0, "Breaks into the debugger if the ThreadPool detects work queue starvation")
+RETAIL_CONFIG_DWORD_INFO(INTERNAL_ThreadPool_EnableWorkerTracking, W("ThreadPool_EnableWorkerTracking"), 0, "Enables extra expensive tracking of how many workers threads are working simultaneously")
+RETAIL_CONFIG_DWORD_INFO(INTERNAL_ThreadPool_UnfairSemaphoreSpinLimit, W("ThreadPool_UnfairSemaphoreSpinLimit"), 50, "Per processor limit used when calculating spin duration in UnfairSemaphore::Wait")
+RETAIL_CONFIG_DWORD_INFO(EXTERNAL_Thread_UseAllCpuGroups, W("Thread_UseAllCpuGroups"), 0, "Specifies if to automatically distribute thread across CPU Groups")
+
+CONFIG_DWORD_INFO(INTERNAL_ThreadpoolTickCountAdjustment, W("ThreadpoolTickCountAdjustment"), 0, "")
+
+RETAIL_CONFIG_DWORD_INFO(INTERNAL_HillClimbing_WavePeriod, W("HillClimbing_WavePeriod"), 4, "");
+RETAIL_CONFIG_DWORD_INFO(INTERNAL_HillClimbing_TargetSignalToNoiseRatio, W("HillClimbing_TargetSignalToNoiseRatio"), 300, "");
+RETAIL_CONFIG_DWORD_INFO(INTERNAL_HillClimbing_ErrorSmoothingFactor, W("HillClimbing_ErrorSmoothingFactor"), 1, "");
+RETAIL_CONFIG_DWORD_INFO(INTERNAL_HillClimbing_WaveMagnitudeMultiplier, W("HillClimbing_WaveMagnitudeMultiplier"), 100, "");
+RETAIL_CONFIG_DWORD_INFO(INTERNAL_HillClimbing_MaxWaveMagnitude, W("HillClimbing_MaxWaveMagnitude"), 20, "");
+RETAIL_CONFIG_DWORD_INFO(INTERNAL_HillClimbing_WaveHistorySize, W("HillClimbing_WaveHistorySize"), 8, "");
+RETAIL_CONFIG_DWORD_INFO(INTERNAL_HillClimbing_Bias, W("HillClimbing_Bias"), 15, "The 'cost' of a thread. 0 means drive for increased throughput regardless of thread count; higher values bias more against higher thread counts.");
+RETAIL_CONFIG_DWORD_INFO(INTERNAL_HillClimbing_MaxChangePerSecond, W("HillClimbing_MaxChangePerSecond"), 4, "");
+RETAIL_CONFIG_DWORD_INFO(INTERNAL_HillClimbing_MaxChangePerSample, W("HillClimbing_MaxChangePerSample"), 20, "");
+RETAIL_CONFIG_DWORD_INFO(INTERNAL_HillClimbing_MaxSampleErrorPercent, W("HillClimbing_MaxSampleErrorPercent"), 15, "");
+RETAIL_CONFIG_DWORD_INFO(INTERNAL_HillClimbing_SampleIntervalLow, W("HillClimbing_SampleIntervalLow"), 10, "");
+RETAIL_CONFIG_DWORD_INFO(INTERNAL_HillClimbing_SampleIntervalHigh, W("HillClimbing_SampleIntervalHigh"), 200, "");
+RETAIL_CONFIG_DWORD_INFO(INTERNAL_HillClimbing_GainExponent, W("HillClimbing_GainExponent"), 200, "The exponent to apply to the gain, times 100. 100 means to use linear gain, higher values will enhance large moves and damp small ones.");
+
+//
+// TypeLoader
+//
+CONFIG_DWORD_INFO(INTERNAL_TypeLoader_InjectInterfaceDuplicates, W("INTERNAL_TypeLoader_InjectInterfaceDuplicates"), 0, "Injects duplicates in interface map for all types.")
+
+//
+// Virtual call stubs
+//
+CONFIG_DWORD_INFO_EX(INTERNAL_VirtualCallStubCollideMonoPct, W("VirtualCallStubCollideMonoPct"), 0, "Used only when STUB_LOGGING is defined, which by default is not.", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_VirtualCallStubCollideWritePct, W("VirtualCallStubCollideWritePct"), 100, "Used only when STUB_LOGGING is defined, which by default is not.", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_VirtualCallStubDumpLogCounter, W("VirtualCallStubDumpLogCounter"), 0, "Used only when STUB_LOGGING is defined, which by default is not.", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_VirtualCallStubDumpLogIncr, W("VirtualCallStubDumpLogIncr"), 0, "Used only when STUB_LOGGING is defined, which by default is not.", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_VirtualCallStubLogging, W("VirtualCallStubLogging"), 0, "Worth keeping, but should be moved into \"#ifdef STUB_LOGGING\" blocks. This goes for most (or all) of the stub logging infrastructure.", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_VirtualCallStubMissCount, W("VirtualCallStubMissCount"), 100, "Used only when STUB_LOGGING is defined, which by default is not.", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_VirtualCallStubResetCacheCounter, W("VirtualCallStubResetCacheCounter"), 0, "Used only when STUB_LOGGING is defined, which by default is not.", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_VirtualCallStubResetCacheIncr, W("VirtualCallStubResetCacheIncr"), 0, "Used only when STUB_LOGGING is defined, which by default is not.", CLRConfig::REGUTIL_default)
+
+//
+// Watson
+//
+RETAIL_CONFIG_DWORD_INFO(INTERNAL_DisableWatsonForManagedExceptions, W("DisableWatsonForManagedExceptions"), 0, "disable Watson and debugger launching for managed exceptions")
+
+//
+// Zap
+//
+RETAIL_CONFIG_STRING_INFO_EX(INTERNAL_ZapBBInstr, W("ZapBBInstr"), "", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_STRING_INFO(EXTERNAL_ZapBBInstrDir, W("ZapBBInstrDir"), "")
+RETAIL_CONFIG_DWORD_INFO(EXTERNAL_ZapDisable, W("ZapDisable"), 0, "")
+CONFIG_STRING_INFO_EX(INTERNAL_ZapExclude, W("ZapExclude"), "", CLRConfig::REGUTIL_default)
+CONFIG_STRING_INFO_EX(INTERNAL_ZapOnly, W("ZapOnly"), "", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(EXTERNAL_ZapRequire, W("ZapRequire"), "")
+RETAIL_CONFIG_STRING_INFO(EXTERNAL_ZapRequireExcludeList, W("ZapRequireExcludeList"), "")
+RETAIL_CONFIG_STRING_INFO(EXTERNAL_ZapRequireList, W("ZapRequireList"), "")
+RETAIL_CONFIG_STRING_INFO_EX(EXTERNAL_ZapSet, W("ZapSet"), "", CLRConfig::REGUTIL_default)
+
+#ifdef FEATURE_LAZY_COW_PAGES
+
+#ifdef FEATURE_WINDOWSPHONE
+RETAIL_CONFIG_DWORD_INFO(INTERNAL_ZapLazyCOWPagesEnabled, W("ZapLazyCOWPagesEnabled"), 1, "");
+#else //FEATURE_WINDOWSPHONE
+RETAIL_CONFIG_DWORD_INFO(INTERNAL_ZapLazyCOWPagesEnabled, W("ZapLazyCOWPagesEnabled"), 0, "");
+#endif //FEATURE_WINDOWSPHONE
+
+CONFIG_DWORD_INFO(INTERNAL_DebugAssertOnMissedCOWPage, W("DebugAssertOnMissedCOWPage"), 1, "");
+
+#endif //FEATURE_LAZY_COW_PAGES
+
+#ifdef FEATURE_CORECLR
+RETAIL_CONFIG_DWORD_INFO(EXTERNAL_ReadyToRun, W("ReadyToRun"), 1, "Enable/disable use of ReadyToRun native code") // On by default for CoreCLR
+#else
+RETAIL_CONFIG_DWORD_INFO(EXTERNAL_ReadyToRun, W("ReadyToRun"), 0, "Enable/disable use of ReadyToRun native code") // Off by default for desktop
+#endif
+RETAIL_CONFIG_STRING_INFO(EXTERNAL_ReadyToRunExcludeList, W("ReadyToRunExcludeList"), "List of assemblies that cannot use Ready to Run images")
+RETAIL_CONFIG_STRING_INFO(EXTERNAL_ReadyToRunLogFile, W("ReadyToRunLogFile"), "Name of file to log success/failure of using Ready to Run images")
+
+#if defined(FEATURE_EVENT_TRACE) || defined(FEATURE_EVENTSOURCE_XPLAT)
+RETAIL_CONFIG_DWORD_INFO(EXTERNAL_EnableEventLog, W("EnableEventLog"), 0, "Enable/disable use of EnableEventLogging mechanism ") // Off by default
+RETAIL_CONFIG_STRING_INFO(INTERNAL_EventSourceFilter, W("EventSourceFilter"), "")
+RETAIL_CONFIG_STRING_INFO(INTERNAL_EventNameFilter, W("EventNameFilter"), "")
+#endif //defined(FEATURE_EVENT_TRACE) || defined(FEATURE_EVENTSOURCE_XPLAT)
+
+//
+// Interop
+//
+CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_ExposeExceptionsInCOM, W("ExposeExceptionsInCOM"), "")
+RETAIL_CONFIG_DWORD_INFO(EXTERNAL_ComInsteadOfManagedRemoting, W("PreferComInsteadOfManagedRemoting"), 0, "When communicating with a cross app domain CCW, use COM instead of managed remoting.")
+CONFIG_DWORD_INFO(INTERNAL_GenerateStubForHost, W("GenerateStubForHost"), 0, "Forces the host hook stub to be built for all unmanaged calls, even when not running hosted.")
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(EXTERNAL_legacyApartmentInitPolicy, W("legacyApartmentInitPolicy"), "")
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(EXTERNAL_legacyComHierarchyVisibility, W("legacyComHierarchyVisibility"), "")
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(EXTERNAL_legacyComVTableLayout, W("legacyComVTableLayout"), "")
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(EXTERNAL_newComVTableLayout, W("newComVTableLayout"), "")
+RETAIL_CONFIG_STRING_INFO_EX(EXTERNAL_PInvokeInline, W("PInvokeInline"), "", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_InteropValidatePinnedObjects, W("InteropValidatePinnedObjects"), 0, "After returning from a managed-to-unmanged interop call, validate GC heap around objects pinned by IL stubs.")
+RETAIL_CONFIG_DWORD_INFO(EXTERNAL_InteropLogArguments, W("InteropLogArguments"), 0, "Log all pinned arguments passed to an interop call")
+RETAIL_CONFIG_STRING_INFO(UNSUPPORTED_LogCCWRefCountChange, W("LogCCWRefCountChange"), "Outputs debug information and calls LogCCWRefCountChange_BREAKPOINT when AddRef or Release is called on a CCW.")
+RETAIL_CONFIG_DWORD_INFO(INTERNAL_EnableRCWCleanupOnSTAShutdown, W("EnableRCWCleanupOnSTAShutdown"), 0, "Performs RCW cleanup when STA shutdown is detected using IInitializeSpy in classic processes.")
+RETAIL_CONFIG_STRING_INFO(INTERNAL_LocalWinMDPath, W("LocalWinMDPath"), "Additional path to probe for WinMD files in if a WinRT type is not resolved using the standard paths.")
+RETAIL_CONFIG_DWORD_INFO(EXTERNAL_AllowDComReflection, W("AllowDComReflection"), 0, "Allows out of process DCOM clients to marshal blocked reflection types.")
+
+//
+// Unknown
+//
+//---------------------------------------------------------------------------------------
+// **
+// PLEASE MOVE ANY CONFIG SWITCH YOU OWN OUT OF THIS SECTION INTO A CATEGORY ABOVE
+//
+// DO NOT ADD ANY MORE CONFIG SWITCHES TO THIS SECTION!
+// **
+RETAIL_CONFIG_DWORD_INFO_EX(UNSUPPORTED_3gbEatMem, W("3gbEatMem"), 0, "Testhook: Size of memory (in 64K chunks) to be reserved before CLR starts", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_ActivatePatchSkip, W("ActivatePatchSkip"), 0, "allows an assert when ActivatePatchSkip is called", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_AlwaysCallInstantiatingStub, W("AlwaysCallInstantiatingStub"), 0, "Forces the Jit to use the instantiating stub for generics", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO(EXTERNAL_alwaysFlowImpersonationPolicy, W("alwaysFlowImpersonationPolicy"), FALSE, "Windows identities should always flow across async points")
+CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_AlwaysUseMetadataInterfaceMapLayout, W("AlwaysUseMetadataInterfaceMapLayout"), "Used for debugging generic interface map layout.")
+CONFIG_DWORD_INFO(INTERNAL_AssertOnUnneededThis, W("AssertOnUnneededThis"), 0, "While the ConfigDWORD is unnecessary, the contained ASSERT should be kept. This may result in some work tracking down violating MethodDescCallSites.")
+CONFIG_DWORD_INFO_EX(INTERNAL_AssertStacktrace, W("AssertStacktrace"), 1, "", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_STRING_INFO_DIRECT_ACCESS(UNSUPPORTED_BuildFlavor, W("BuildFlavor"), "Choice of build flavor (wks or svr) of CLR")
+CONFIG_DWORD_INFO(INTERNAL_CerLogging, W("CerLogging"), 0, "In vm\\ConstrainedExecutionRegion.cpp. Debug-only logging when we prepare methods, find reliability contract problems, restore stuff from ngen images, etc.")
+CONFIG_DWORD_INFO_EX(INTERNAL_clearNativeImageStress, W("clearNativeImageStress"), 0, "", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_STRING_INFO_DIRECT_ACCESS(INTERNAL_CLRLoadLogDir, W("CLRLoadLogDir"), "Enable logging of CLR selection")
+RETAIL_CONFIG_STRING_INFO_EX(EXTERNAL_CONFIG, W("CONFIG"), "Used to specify an XML config file for EEConfig", CLRConfig::REGUTIL_default)
+CONFIG_STRING_INFO_EX(INTERNAL_CopyPropMax, W("CopyPropMax"), "Sets internal jit constants for CopyProp", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_CPUFamily, W("CPUFamily"), "")
+CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_CPUFeatures, W("CPUFeatures"), "")
+CONFIG_STRING_INFO_EX(INTERNAL_DeadCodeMax, W("DeadCodeMax"), "Sets internal jit constants for Dead Code elmination", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_STRING_INFO_DIRECT_ACCESS(INTERNAL_DefaultVersion, W("DefaultVersion"), "Version of CLR to load.")
+RETAIL_CONFIG_STRING_INFO_DIRECT_ACCESS(EXTERNAL_developerInstallation, W("developerInstallation"), "Flag to enable DEVPATH binding feature") // TODO: check special handling
+RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_shadowCopyVerifyByTimestamp, W("shadowCopyVerifyByTimestamp"), 0, "Fusion flag to enable quick verification of files in the shadow copy directory by using timestamps.", CLRConfig::FavorConfigFile | CLRConfig::MayHavePerformanceDefault)
+RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_disableFusionUpdatesFromADManager, W("disableFusionUpdatesFromADManager"), 0, "Fusion flag to prevent changes to the AppDomainSetup object made by implementations of AppDomainManager.InitializeNewDomain from propagating to Fusion", CLRConfig::FavorConfigFile)
+RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_disableCachingBindingFailures, W("disableCachingBindingFailures"), 0, "Fusion flag to re-enable Everett bind caching behavior (Whidbey caches failures for sharing)", CLRConfig::FavorConfigFile)
+RETAIL_CONFIG_DWORD_INFO(INTERNAL_EnableVerboseInstallLogging, W("enableVerboseInstallLogging"), 0, "Fusion flag to enable detailed logging of GAC install operations")
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(EXTERNAL_disableCommitThreadStack, W("disableCommitThreadStack"), "This should only be internal but I believe ASP.Net uses this")
+RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_DisableConfigCache, W("DisableConfigCache"), 0, "Used to disable the \"probabilistic\" config cache, which walks through the appropriate config registry keys on init and probabilistically keeps track of which exist.", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(EXTERNAL_DisableStackwalkCache, W("DisableStackwalkCache"), "")
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(UNSUPPORTED_DoubleArrayToLargeObjectHeap, W("DoubleArrayToLargeObjectHeap"), "Controls double[] placement")
+CONFIG_DWORD_INFO(INTERNAL_DumpConfiguration, W("DumpConfiguration"), 0, "Dumps runtime properties of xml configuration files to the log.")
+CONFIG_STRING_INFO(INTERNAL_DumpOnClassLoad, W("DumpOnClassLoad"), "Dumps information about loaded class to log.")
+RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_EnableInternetHREFexes, W("EnableInternetHREFexes"), 0, "Part of security work related to locking down Internet No-touch deployment. It's not clear what happens to NTD in v4, but if it's till there the setting is needed", (CLRConfig::LookupOptions) (CLRConfig::REGUTIL_default | CLRConfig::IgnoreEnv | CLRConfig::IgnoreHKCU))
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(EXTERNAL_enforceFIPSPolicy, W("enforceFIPSPolicy"), "Causes crypto algorithms which have not been FIPS certified to throw an exception if they are used on a machine that requriess FIPS enforcement")
+CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_ExpandAllOnLoad, W("ExpandAllOnLoad"), "")
+RETAIL_CONFIG_DWORD_INFO_EX(UNSUPPORTED_FORCE_ASSEMREF_DUPCHECK, W("FORCE_ASSEMREF_DUPCHECK"), 0, "? Has comment: Allow Avalon to use the SecurityCriticalAttribute ? but WHY?", CLRConfig::REGUTIL_default)
+CONFIG_STRING_INFO_DIRECT_ACCESS(INTERNAL_ForcedRuntime, W("ForcedRuntime"), "Verify version of CLR loaded")
+CONFIG_DWORD_INFO_EX(INTERNAL_ForceRelocs, W("ForceRelocs"), 0, "", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_GenerateLongJumpDispatchStubRatio, W("GenerateLongJumpDispatchStubRatio"), "Useful for testing VSD on AMD64")
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(EXTERNAL_generatePublisherEvidence, W("generatePublisherEvidence"), "If set, when the CLR loads an assembly that has an Authenticode signature we will verify that signature to generate Publisher evidence, at the expense of network hits and perf.")
+CONFIG_DWORD_INFO_EX(INTERNAL_HashStack, W("HashStack"), 0, "", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO(INTERNAL_HostManagerConfig, W("HostManagerConfig"), (DWORD)-1, "")
+CONFIG_DWORD_INFO(INTERNAL_HostTestADUnload, W("HostTestADUnload"), 0, "Alows setting Rude unload as default")
+CONFIG_DWORD_INFO(INTERNAL_HostTestThreadAbort, W("HostTestThreadAbort"), 0, "")
+RETAIL_CONFIG_DWORD_INFO_EX(UNSUPPORTED_IgnoreDllMainReturn, W("IgnoreDllMainReturn"), 0, "Don't check the return value of DllMain if this is set", CLRConfig::ConfigFile_ApplicationFirst)
+RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_IJWEntrypointCompatMode, W("IJWEntrypointCompatMode"), 1, "Makes us run managed EP from DllMain. Basically brings the buggy behavior back.", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_STRING_INFO_DIRECT_ACCESS(INTERNAL_InstallRoot, W("InstallRoot"), "Directory with installed CLRs")
+CONFIG_STRING_INFO(INTERNAL_InvokeHalt, W("InvokeHalt"), "Throws an assert when the given method is invoked through reflection.")
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(EXTERNAL_legacyHMACMode, W("legacyHMACMode"), "v2.0 of the CLR shipped with a bug causing HMAC-SHA-384 and HMAC-SHA-512 to be calculated incorrectly. Orcas fixes this bug, but the config flag is added so that code which must verify v2.0 RTM HMACs can still interop with them.")
+RETAIL_CONFIG_DWORD_INFO(EXTERNAL_legacyImpersonationPolicy, W("legacyImpersonationPolicy"), FALSE, "Windows identities should never flow across async points")
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(UNSUPPORTED_legacyLoadMscorsnOnStartup, W("legacyLoadMscorsnOnStartup"), "Force mscorsn.dll to load when the VM starts")
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(UNSUPPORTED_legacyNullReferenceExceptionPolicy, W("legacyNullReferenceExceptionPolicy"), "")
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(UNSUPPORTED_legacyUnhandledExceptionPolicy, W("legacyUnhandledExceptionPolicy"), "")
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(EXTERNAL_legacyVirtualMethodCallVerification, W("legacyVirtualMethodCallVerification"), "")
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_ManagedLogFacility, W("ManagedLogFacility"), "?Log facility for managed code using the log")
+CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_MaxStackDepth, W("MaxStackDepth"), "")
+CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_MaxStubUnwindInfoSegmentSize, W("MaxStubUnwindInfoSegmentSize"), "")
+CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_MaxThreadRecord, W("MaxThreadRecord"), "")
+RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_MergeCriticalAttributes, W("MergeCriticalAttributes"), 1, "", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO(INTERNAL_MessageDebugOut, W("MessageDebugOut"), 0, "")
+CONFIG_DWORD_INFO_EX(INTERNAL_MscorsnLogging, W("MscorsnLogging"), 0, "Enables strong name logging", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_NativeImageRequire, W("NativeImageRequire"), 0, "", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_NestedEhOom, W("NestedEhOom"), 0, "", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_NO_SO_NOT_MAINLINE, W("NO_SO_NOT_MAINLINE"), 0, "", CLRConfig::REGUTIL_default)
+#if defined(CROSSGEN_COMPILE)
+#define INTERNAL_NoGuiOnAssert_Default 1
+#else
+#define INTERNAL_NoGuiOnAssert_Default 0
+#endif
+CONFIG_DWORD_INFO_EX(INTERNAL_NoGuiOnAssert, W("NoGuiOnAssert"), INTERNAL_NoGuiOnAssert_Default, "", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_NoProcedureSplitting, W("NoProcedureSplitting"), 0, "", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_EX(INTERNAL_NoStringInterning, W("NoStringInterning"), 1, "Disallows string interning. I see no value in it anymore.", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(EXTERNAL_NotifyBadAppCfg, W("NotifyBadAppCfg"), "Whether to show a message box for bad application config file.")
+CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_PauseOnLoad, W("PauseOnLoad"), "Stops in SystemDomain::init. I think it can be removed.")
+CONFIG_DWORD_INFO(INTERNAL_PerfAllocsSizeThreshold, W("PerfAllocsSizeThreshold"), 0x3FFFFFFF, "Log facility LF_GCALLOC logs object allocations. This flag controls which ones also log stacktraces. Predates ClrProfiler.")
+CONFIG_DWORD_INFO(INTERNAL_PerfNumAllocsThreshold, W("PerfNumAllocsThreshold"), 0x3FFFFFFF, "Log facility LF_GCALLOC logs object allocations. This flag controls which ones also log stacktraces. Predates ClrProfiler.")
+CONFIG_STRING_INFO(INTERNAL_PerfTypesToLog, W("PerfTypesToLog"), "Log facility LF_GCALLOC logs object allocations. This flag controls which ones also log stacktraces. Predates ClrProfiler.")
+RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_PEVerify, W("PEVerify"), 0, "", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO(EXTERNAL_Prepopulate1, W("Prepopulate1"), 1, "")
+CONFIG_STRING_INFO(INTERNAL_PrestubGC, W("PrestubGC"), "")
+CONFIG_STRING_INFO(INTERNAL_PrestubHalt, W("PrestubHalt"), "")
+RETAIL_CONFIG_STRING_INFO_EX(EXTERNAL_RepositoryDir, W("RepositoryDir"), "", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(EXTERNAL_RepositoryFlags, W("RepositoryFlags"), "")
+RETAIL_CONFIG_STRING_INFO(EXTERNAL_RestrictedGCStressExe, W("RestrictedGCStressExe"), "")
+CONFIG_DWORD_INFO_EX(INTERNAL_ReturnSourceTypeForTesting, W("ReturnSourceTypeForTesting"), 0, "allows returning the (internal only) source type of an IL to Native mapping for debugging purposes", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_EX(UNSUPPORTED_RSStressLog, W("RSStressLog"), 0, "allows turning on logging for RS startup", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_SafeHandleStackTraces, W("SafeHandleStackTraces"), "Debug-only ability to get a stack trace attached to every SafeHandle instance at creation time, for tracking down handle corruption problems.")
+CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_SaveThreadInfo, W("SaveThreadInfo"), "")
+CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_SaveThreadInfoMask, W("SaveThreadInfoMask"), "")
+CONFIG_DWORD_INFO(INTERNAL_SBDumpOnNewIndex, W("SBDumpOnNewIndex"), 0, "Used for Syncblock debugging. It's been a while since any of those have been used.")
+CONFIG_DWORD_INFO(INTERNAL_SBDumpOnResize, W("SBDumpOnResize"), 0, "Used for Syncblock debugging. It's been a while since any of those have been used.")
+CONFIG_DWORD_INFO(INTERNAL_SBDumpStyle, W("SBDumpStyle"), 0, "Used for Syncblock debugging. It's been a while since any of those have been used.")
+RETAIL_CONFIG_STRING_INFO_DIRECT_ACCESS(UNSUPPORTED_ShimDatabaseVersion, W("ShimDatabaseVersion"), "Force using shim database version in registry")
+RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_SleepOnExit, W("SleepOnExit"), 0, "Used for lrak detection. I'd say deprecated by umdh.")
+CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_StubLinkerUnwindInfoVerificationOn, W("StubLinkerUnwindInfoVerificationOn"), "")
+RETAIL_CONFIG_DWORD_INFO_EX(UNSUPPORTED_SuccessExit, W("SuccessExit"), 0, "", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO(INTERNAL_SupressAllowUntrustedCallerChecks, W("SupressAllowUntrustedCallerChecks"), 0, "Disable APTCA")
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(EXTERNAL_SymbolReadingPolicy, W("SymbolReadingPolicy"), "Specifies when PDBs may be read")
+RETAIL_CONFIG_DWORD_INFO(UNSUPPORTED_TestDataConsistency, W("TestDataConsistency"), FALSE, "allows ensuring the left side is not holding locks (and may thus be in an inconsistent state) when inspection occurs")
+RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_ThreadGuardPages, W("ThreadGuardPages"), 0, "", CLRConfig::REGUTIL_default)
+RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_Timeline, W("Timeline"), 0, "", CLRConfig::REGUTIL_default)
+CONFIG_STRING_INFO_EX(INTERNAL_TlbImpShouldBreakOnConvFunction, W("TlbImpShouldBreakOnConvFunction"), "", CLRConfig::REGUTIL_default)
+CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_TlbImpSkipLoading, W("TlbImpSkipLoading"), "")
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(UNSUPPORTED_TotalStressLogSize, W("TotalStressLogSize"), "Total stress log size in bytes.")
+
+#ifdef _DEBUG
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(EXTERNAL_TraceIUnknown, W("TraceIUnknown"), "")
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(EXTERNAL_TraceWrap, W("TraceWrap"), "")
+#endif
+
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(EXTERNAL_TURNOFFDEBUGINFO, W("TURNOFFDEBUGINFO"), "")
+RETAIL_CONFIG_DWORD_INFO(EXTERNAL_UseGenericTlsGetters, W("UseGenericTlsGetters"), 0, "")
+RETAIL_CONFIG_DWORD_INFO_EX(EXTERNAL_useLegacyIdentityFormat, W("useLegacyIdentityFormat"), 0, "Fusion flag to switch between Whidbey and Everett textual identity parser (have semantic differences)", CLRConfig::FavorConfigFile)
+RETAIL_CONFIG_DWORD_INFO(EXTERNAL_UseMethodDataCache, W("UseMethodDataCache"), FALSE, "Used during feature development; may now be removed.")
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(EXTERNAL_UseNewCrossDomainRemoting, W("UseNewCrossDomainRemoting"), "Forces the managed remoting stack to be used even for cross-domain remoting if set to 0 (default is 1)")
+RETAIL_CONFIG_DWORD_INFO(EXTERNAL_UseParentMethodData, W("UseParentMethodData"), TRUE, "Used during feature development; may now be removed.")
+CONFIG_DWORD_INFO_DIRECT_ACCESS(INTERNAL_VerifierOff, W("VerifierOff"), "")
+RETAIL_CONFIG_DWORD_INFO_DIRECT_ACCESS(EXTERNAL_VerifyAllOnLoad, W("VerifyAllOnLoad"), "")
+RETAIL_CONFIG_STRING_INFO_DIRECT_ACCESS(INTERNAL_Version, W("Version"), "Version of CLR to load.")
+RETAIL_CONFIG_STRING_INFO_DIRECT_ACCESS(INTERNAL_ShimHookLibrary, W("ShimHookLibrary"), "Path to a DLL that should be notified when shim loads the runtime DLL.")
+// **
+// PLEASE MOVE ANY CONFIG SWITCH YOU OWN OUT OF THIS SECTION INTO A CATEGORY ABOVE
+//
+// DO NOT ADD ANY MORE CONFIG SWITCHES TO THIS SECTION!
+// **
+//---------------------------------------------------------------------------------------
diff --git a/src/inc/clrdata.idl b/src/inc/clrdata.idl
new file mode 100644
index 0000000000..6ef8ddbc6f
--- /dev/null
+++ b/src/inc/clrdata.idl
@@ -0,0 +1,313 @@
+// 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.
+
+/*****************************************************************************
+ ** **
+ ** clrdata.idl - Common Language Runtime data access interfaces for **
+ ** clients needing to access runtime state from outside **
+ ** runtime, such as out-of-process debuggers. **
+ ** **
+ ** The access interface defines two different types of code running: **
+ ** The host is the user of the access interface. **
+ ** The target is the target of the access. **
+ ** **
+ ** The host and target can be have different instruction sets, **
+ ** pointer sizes, runtime versions and so on. **
+ ** **
+ *****************************************************************************/
+
+import "unknwn.idl";
+
+/* ------------------------------------------------------------------------- *
+ * Forward declarations.
+ * ------------------------------------------------------------------------- */
+
+interface ICLRDataEnumMemoryRegions;
+interface ICLRDataEnumMemoryRegionsCallback;
+interface ICLRDataEnumMemoryRegionsCallback2;
+interface ICLRDataTarget;
+interface ICLRDataTarget2;
+interface ICLRMetadataLocator;
+
+/*
+ * Addresses in the access interface are always the largest possible.
+ * If the target uses a smaller address size then addresses are converted
+ * up by sign extension.
+ */
+typedef ULONG64 CLRDATA_ADDRESS;
+
+/* ------------------------------------------------------------------------- *
+ * Creation function.
+ * Can create ICLRDataEnumMemoryRegions.
+ * ------------------------------------------------------------------------- */
+
+#pragma midl_echo("STDAPI CLRDataCreateInstance(REFIID iid, ICLRDataTarget* target, void** iface);")
+#pragma midl_echo("typedef HRESULT (STDAPICALLTYPE* PFN_CLRDataCreateInstance)(REFIID iid, ICLRDataTarget* target, void** iface);")
+
+/*
+ * Interface for providing access to a particular target process. The
+ * data access services will call functions on this interface to
+ * access memory and other data in the target process.
+ *
+ * The API client must implement this interface as appropriate for the
+ * particular target (for example, a live process or a memory dump).
+ *
+ */
+[
+ object,
+ local,
+ uuid(3E11CCEE-D08B-43e5-AF01-32717A64DA03),
+ pointer_default(unique)
+]
+interface ICLRDataTarget : IUnknown
+{
+ /*
+ * Return which kind of instruction set is in use in the
+ * target. Value is one of the IMAGE_FILE_MACHINE_* constants.
+ */
+ HRESULT GetMachineType([out] ULONG32* machineType);
+
+ /*
+ * Return the size of a pointer on the target, in bytes.
+ */
+ HRESULT GetPointerSize([out] ULONG32* pointerSize);
+
+ /*
+ * Find the base address for a given image.
+ * Image name may or may not have a path. If a path
+ * is given matching is done with the whole path, otherwise
+ * matching is done only on the file part.
+ * In either case, matching should be case-insensitive.
+ */
+ HRESULT GetImageBase([in, string] LPCWSTR imagePath,
+ [out] CLRDATA_ADDRESS* baseAddress);
+
+ /*
+ * Virtual memory access. If any bytes can be processed
+ * the call is considered successful.
+ */
+ HRESULT ReadVirtual([in] CLRDATA_ADDRESS address,
+ [out, size_is(bytesRequested), length_is(*bytesRead)] BYTE* buffer,
+ [in] ULONG32 bytesRequested,
+ [out] ULONG32* bytesRead);
+ HRESULT WriteVirtual([in] CLRDATA_ADDRESS address,
+ [in, size_is(bytesRequested)] BYTE* buffer,
+ [in] ULONG32 bytesRequested,
+ [out] ULONG32* bytesWritten);
+
+ /*
+ * TLS data access for the current thread.
+ */
+ HRESULT GetTLSValue([in] ULONG32 threadID,
+ [in] ULONG32 index,
+ [out] CLRDATA_ADDRESS* value);
+ HRESULT SetTLSValue([in] ULONG32 threadID,
+ [in] ULONG32 index,
+ [in] CLRDATA_ADDRESS value);
+
+ /*
+ * System ID for the current thread.
+ * If there is no "current" thread for the target
+ * implementation this can fail.
+ */
+ HRESULT GetCurrentThreadID([out] ULONG32* threadID);
+
+ /*
+ * Thread context.
+ */
+ HRESULT GetThreadContext([in] ULONG32 threadID,
+ [in] ULONG32 contextFlags,
+ [in] ULONG32 contextSize,
+ [out, size_is(contextSize)] BYTE* context);
+ HRESULT SetThreadContext([in] ULONG32 threadID,
+ [in] ULONG32 contextSize,
+ [in, size_is(contextSize)] BYTE* context);
+
+ /*
+ * Generic request facility to allow addition of
+ * queries and operations without requiring an interface revision.
+ */
+
+ HRESULT Request([in] ULONG32 reqCode,
+ [in] ULONG32 inBufferSize,
+ [in, size_is(inBufferSize)] BYTE* inBuffer,
+ [in] ULONG32 outBufferSize,
+ [out, size_is(outBufferSize)] BYTE* outBuffer);
+};
+
+/*
+ * Interface used by the data access services layer to manipulate
+ * virtual memory regions in the target. The target may not support
+ * modification.
+ */
+[
+ object,
+ local,
+ uuid(6d05fae3-189c-4630-a6dc-1c251e1c01ab),
+ pointer_default(unique)
+]
+interface ICLRDataTarget2 : ICLRDataTarget
+{
+ /*
+ * Ask the target to allocate memory in its address space.
+ */
+ HRESULT AllocVirtual([in] CLRDATA_ADDRESS addr,
+ [in] ULONG32 size,
+ [in] ULONG32 typeFlags,
+ [in] ULONG32 protectFlags,
+ [out] CLRDATA_ADDRESS* virt);
+
+ /*
+ * Ask the target to free a previously allocated memory block.
+ */
+ HRESULT FreeVirtual([in] CLRDATA_ADDRESS addr,
+ [in] ULONG32 size,
+ [in] ULONG32 typeFlags);
+};
+
+/*
+ * Interface for providing access to exception and context records.
+ */
+[
+ object,
+ local,
+ uuid(a5664f95-0af4-4a1b-960e-2f3346b4214c),
+ pointer_default(unique)
+]
+interface ICLRDataTarget3 : ICLRDataTarget2
+{
+ /*
+ * Returns an associated exception record, if any.
+ */
+ HRESULT GetExceptionRecord([in] ULONG32 bufferSize,
+ [out] ULONG32* bufferUsed,
+ [out, size_is(bufferSize)] BYTE* buffer);
+
+ /*
+ * Returns a context record associated with the exception, if any.
+ */
+ HRESULT GetExceptionContextRecord([in] ULONG32 bufferSize,
+ [out] ULONG32* bufferUsed,
+ [out, size_is(bufferSize)] BYTE* buffer);
+
+ /*
+ * Returns the ID of the thread raising the exception.
+ */
+ HRESULT GetExceptionThreadID([out] ULONG32* threadID);
+};
+
+/*
+ * Interface used by the data access services layer to locate metadata
+ * of assemblies in a target.
+ *
+ * The API client must implement this interface as appropriate for the
+ * particular target (for example, a live process or a memory dump).
+ *
+ * This is an old interface you should not be using.
+ * see code:ICorDebugMetaDataLocator in cordebug.idl
+ *
+ */
+[
+ object,
+ local,
+ uuid(aa8fa804-bc05-4642-b2c5-c353ed22fc63),
+ pointer_default(unique)
+]
+interface ICLRMetadataLocator : IUnknown
+{
+ /*
+ * Ask the target to retrieve metadata for an image.
+ */
+ HRESULT GetMetadata([in] LPCWSTR imagePath,
+ [in] ULONG32 imageTimestamp,
+ [in] ULONG32 imageSize,
+ [in] GUID* mvid,
+ [in] ULONG32 mdRva,
+ [in] ULONG32 flags,
+ [in] ULONG32 bufferSize,
+ [out, size_is(bufferSize), length_is(*dataSize)]
+ BYTE* buffer,
+ [out] ULONG32* dataSize);
+};
+
+
+/*
+ * Callback interface for enumerating memory regions.
+ */
+[
+ object,
+ local,
+ uuid(BCDD6908-BA2D-4ec5-96CF-DF4D5CDCB4A4)
+]
+interface ICLRDataEnumMemoryRegionsCallback : IUnknown
+{
+ /*
+ * ICLRDataEnumMemoryRegions::EnumMemoryRegions will call this
+ * function for every memory region enumerated. Regions reported
+ * through this callback may be duplicate or overlapping. Failure
+ * return results will be noted, but will not stop the
+ * enumeration.
+ */
+ HRESULT EnumMemoryRegion([in] CLRDATA_ADDRESS address,
+ [in] ULONG32 size);
+}
+
+/*
+ * Callback interface for writing/poisoning memory regions.
+ */
+[
+ object,
+ local,
+ uuid(3721A26F-8B91-4D98-A388-DB17B356FADB)
+]
+interface ICLRDataEnumMemoryRegionsCallback2 : ICLRDataEnumMemoryRegionsCallback
+{
+ /*
+ * ICLRDataEnumMemoryRegions::EnumMemoryRegions will call this function
+ * for every memory regions it needs to overwrite/poison with the specified
+ * data buffer passed as input argument.
+ */
+ HRESULT UpdateMemoryRegion(
+ [in] CLRDATA_ADDRESS address,
+ [in] ULONG32 bufferSize,
+ [in, size_is(bufferSize)] BYTE* buffer);
+}
+
+/*
+ * Flags for controlling which memory regions are enumerated.
+ */
+typedef enum CLRDataEnumMemoryFlags
+{
+ CLRDATA_ENUM_MEM_DEFAULT = 0x0,
+ CLRDATA_ENUM_MEM_MINI = CLRDATA_ENUM_MEM_DEFAULT, // generating skinny mini-dump
+ CLRDATA_ENUM_MEM_HEAP = 0x1, // generating heap dump
+ CLRDATA_ENUM_MEM_TRIAGE = 0x2, // generating triage mini-dump
+
+ /* More bits to be added here later */
+} CLRDataEnumMemoryFlags;
+
+/*
+ * Memory enumeration interface.
+ * This is one of the top-level interfaces creatable by CLRDataCreateInstance.
+ */
+[
+ object,
+ local,
+ uuid(471c35b4-7c2f-4ef0-a945-00f8c38056f1)
+]
+interface ICLRDataEnumMemoryRegions : IUnknown
+{
+ /*
+ * EnumMemoryRegions enumerates regions of interest as specified
+ * by the flags argument by calling the
+ * ICLRDataEnumMemoryRegionsCallback::EnumMemoryRegion for every
+ * region being enumerated. Attempts to enumerate as many regions
+ * as possible, even if the callback returns failures during
+ * enumeration.
+ */
+ HRESULT EnumMemoryRegions([in] ICLRDataEnumMemoryRegionsCallback *callback,
+ [in] ULONG32 miniDumpFlags,
+ [in] CLRDataEnumMemoryFlags clrFlags);
+}
+
diff --git a/src/inc/clrhost.h b/src/inc/clrhost.h
new file mode 100644
index 0000000000..8cd9e3e9c2
--- /dev/null
+++ b/src/inc/clrhost.h
@@ -0,0 +1,625 @@
+// 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.
+//
+
+//
+
+
+#ifndef __CLRHOST_H__
+#define __CLRHOST_H__
+
+#include "windows.h" // worth to include before mscoree.h so we are guaranteed to pick few definitions
+#ifdef CreateSemaphore
+#undef CreateSemaphore
+#endif
+#include "mscoree.h"
+#include "clrinternal.h"
+#include "switches.h"
+#include "holder.h"
+#include "new.hpp"
+#include "staticcontract.h"
+#include "predeftlsslot.h"
+#include "safemath.h"
+#include "debugreturn.h"
+
+#if !defined(_DEBUG_IMPL) && defined(_DEBUG) && !defined(DACCESS_COMPILE)
+#define _DEBUG_IMPL 1
+#endif
+
+#define BEGIN_PRESERVE_LAST_ERROR \
+ { \
+ DWORD __dwLastError = ::GetLastError(); \
+ DEBUG_ASSURE_NO_RETURN_BEGIN(PRESERVE_LAST_ERROR); \
+ {
+
+#define END_PRESERVE_LAST_ERROR \
+ } \
+ DEBUG_ASSURE_NO_RETURN_END(PRESERVE_LAST_ERROR); \
+ ::SetLastError(__dwLastError); \
+ }
+
+//
+// TRASH_LASTERROR macro sets bogus last error in debug builds to help find places that fail to save it
+//
+#ifdef _DEBUG
+
+#define LAST_ERROR_TRASH_VALUE 42424
+
+#define TRASH_LASTERROR \
+ SetLastError(LAST_ERROR_TRASH_VALUE)
+
+#else // _DEBUG
+
+#define TRASH_LASTERROR
+
+#endif // _DEBUG
+
+IExecutionEngine *GetExecutionEngine();
+IEEMemoryManager *GetEEMemoryManager();
+
+LPVOID ClrVirtualAlloc(LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect);
+BOOL ClrVirtualFree(LPVOID lpAddress, SIZE_T dwSize, DWORD dwFreeType);
+SIZE_T ClrVirtualQuery(LPCVOID lpAddress, PMEMORY_BASIC_INFORMATION lpBuffer, SIZE_T dwLength);
+BOOL ClrVirtualProtect(LPVOID lpAddress, SIZE_T dwSize, DWORD flNewProtect, PDWORD lpflOldProtect);
+LPVOID ClrDebugAlloc (size_t size, LPCSTR pszFile, int iLineNo);
+HANDLE ClrGetProcessHeap();
+HANDLE ClrHeapCreate(DWORD flOptions, SIZE_T dwInitialSize, SIZE_T dwMaximumSize);
+BOOL ClrHeapDestroy(HANDLE hHeap);
+LPVOID ClrHeapAlloc(HANDLE hHeap, DWORD dwFlags, S_SIZE_T dwBytes);
+BOOL ClrHeapFree(HANDLE hHeap, DWORD dwFlags, LPVOID lpMem);
+BOOL ClrHeapValidate(HANDLE hHeap, DWORD dwFlags, LPCVOID lpMem);
+HANDLE ClrGetProcessExecutableHeap();
+
+
+#ifdef FAILPOINTS_ENABLED
+extern int RFS_HashStack();
+#endif
+
+
+void ClrFlsAssociateCallback(DWORD slot, PTLS_CALLBACK_FUNCTION callback);
+
+typedef LPVOID* (*CLRFLSGETBLOCK)();
+extern CLRFLSGETBLOCK __ClrFlsGetBlock;
+
+// Combining getter/setter into a single call
+inline void ClrFlsIncrementValue(DWORD slot, int increment)
+{
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_GC_NOTRIGGER;
+ STATIC_CONTRACT_MODE_ANY;
+ STATIC_CONTRACT_CANNOT_TAKE_LOCK;
+ STATIC_CONTRACT_SO_TOLERANT;
+
+ _ASSERTE(increment != 0);
+
+ void **block = (*__ClrFlsGetBlock)();
+ size_t value;
+
+ if (block != NULL)
+ {
+ value = (size_t) block[slot];
+
+ _ASSERTE((increment > 0) || (value + increment < value));
+ block[slot] = (void *) (value + increment);
+ }
+ else
+ {
+ BEGIN_PRESERVE_LAST_ERROR;
+
+ ANNOTATION_VIOLATION(SOToleranceViolation);
+
+ IExecutionEngine * pEngine = GetExecutionEngine();
+ value = (size_t) pEngine->TLS_GetValue(slot);
+
+ _ASSERTE((increment > 0) || (value + increment < value));
+ pEngine->TLS_SetValue(slot, (void *) (value + increment));
+
+ END_PRESERVE_LAST_ERROR;
+ }
+}
+
+
+inline void * ClrFlsGetValue (DWORD slot)
+{
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_GC_NOTRIGGER;
+ STATIC_CONTRACT_MODE_ANY;
+ STATIC_CONTRACT_CANNOT_TAKE_LOCK;
+ STATIC_CONTRACT_SO_TOLERANT;
+
+ void **block = (*__ClrFlsGetBlock)();
+ if (block != NULL)
+ {
+ return block[slot];
+ }
+ else
+ {
+ ANNOTATION_VIOLATION(SOToleranceViolation);
+
+ void * value = GetExecutionEngine()->TLS_GetValue(slot);
+ return value;
+ }
+}
+
+
+inline BOOL ClrFlsCheckValue(DWORD slot, void ** pValue)
+{
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_GC_NOTRIGGER;
+ STATIC_CONTRACT_MODE_ANY;
+ STATIC_CONTRACT_SO_TOLERANT;
+
+#ifdef _DEBUG
+ *pValue = ULongToPtr(0xcccccccc);
+#endif //_DEBUG
+ void **block = (*__ClrFlsGetBlock)();
+ if (block != NULL)
+ {
+ *pValue = block[slot];
+ return TRUE;
+ }
+ else
+ {
+ ANNOTATION_VIOLATION(SOToleranceViolation);
+ BOOL result = GetExecutionEngine()->TLS_CheckValue(slot, pValue);
+ return result;
+ }
+}
+
+inline void ClrFlsSetValue(DWORD slot, void *pData)
+{
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_GC_NOTRIGGER;
+ STATIC_CONTRACT_MODE_ANY;
+ STATIC_CONTRACT_CANNOT_TAKE_LOCK;
+ STATIC_CONTRACT_SO_TOLERANT;
+
+ void **block = (*__ClrFlsGetBlock)();
+ if (block != NULL)
+ {
+ block[slot] = pData;
+ }
+ else
+ {
+ BEGIN_PRESERVE_LAST_ERROR;
+
+ ANNOTATION_VIOLATION(SOToleranceViolation);
+ GetExecutionEngine()->TLS_SetValue(slot, pData);
+
+ END_PRESERVE_LAST_ERROR;
+ }
+}
+
+typedef LPVOID (*FastAllocInProcessHeapFunc)(DWORD dwFlags, SIZE_T dwBytes);
+extern FastAllocInProcessHeapFunc __ClrAllocInProcessHeap;
+inline LPVOID ClrAllocInProcessHeap(DWORD dwFlags, S_SIZE_T dwBytes)
+{
+ STATIC_CONTRACT_SUPPORTS_DAC_HOST_ONLY;
+ if (dwBytes.IsOverflow())
+ {
+ return NULL;
+ }
+
+#ifndef SELF_NO_HOST
+ return __ClrAllocInProcessHeap(dwFlags, dwBytes.Value());
+#else
+#undef HeapAlloc
+#undef GetProcessHeap
+ static HANDLE ProcessHeap = NULL;
+ if (ProcessHeap == NULL)
+ ProcessHeap = GetProcessHeap();
+ return ::HeapAlloc(ProcessHeap,dwFlags,dwBytes.Value());
+#define HeapAlloc(hHeap, dwFlags, dwBytes) Dont_Use_HeapAlloc(hHeap, dwFlags, dwBytes)
+#define GetProcessHeap() Dont_Use_GetProcessHeap()
+#endif
+}
+
+typedef BOOL (*FastFreeInProcessHeapFunc)(DWORD dwFlags, LPVOID lpMem);
+extern FastFreeInProcessHeapFunc __ClrFreeInProcessHeap;
+inline BOOL ClrFreeInProcessHeap(DWORD dwFlags, LPVOID lpMem)
+{
+ STATIC_CONTRACT_SUPPORTS_DAC_HOST_ONLY;
+#ifndef SELF_NO_HOST
+ return __ClrFreeInProcessHeap(dwFlags, lpMem);
+#else
+#undef HeapFree
+#undef GetProcessHeap
+ static HANDLE ProcessHeap = NULL;
+ if (ProcessHeap == NULL)
+ ProcessHeap = GetProcessHeap();
+ return (BOOL)(BYTE)::HeapFree(ProcessHeap, dwFlags, lpMem);
+#define HeapFree(hHeap, dwFlags, lpMem) Dont_Use_HeapFree(hHeap, dwFlags, lpMem)
+#define GetProcessHeap() Dont_Use_GetProcessHeap()
+#endif
+}
+
+// Critical section support for CLR DLLs other than the the EE.
+// Include the header defining each Crst type and its corresponding level (relative rank). This is
+// auto-generated from a tool that takes a high-level description of each Crst type and its dependencies.
+#include "crsttypes.h"
+
+// critical section api
+CRITSEC_COOKIE ClrCreateCriticalSection(CrstType type, CrstFlags flags);
+HRESULT ClrDeleteCriticalSection(CRITSEC_COOKIE cookie);
+void ClrEnterCriticalSection(CRITSEC_COOKIE cookie);
+void ClrLeaveCriticalSection(CRITSEC_COOKIE cookie);
+
+// event api
+EVENT_COOKIE ClrCreateAutoEvent(BOOL bInitialState);
+EVENT_COOKIE ClrCreateManualEvent(BOOL bInitialState);
+void ClrCloseEvent(EVENT_COOKIE event);
+BOOL ClrSetEvent(EVENT_COOKIE event);
+BOOL ClrResetEvent(EVENT_COOKIE event);
+DWORD ClrWaitEvent(EVENT_COOKIE event, DWORD dwMilliseconds, BOOL bAlertable);
+
+// semaphore api
+SEMAPHORE_COOKIE ClrCreateSemaphore(DWORD dwInitial, DWORD dwMax);
+void ClrCloseSemaphore(SEMAPHORE_COOKIE semaphore);
+BOOL ClrReleaseSemaphore(SEMAPHORE_COOKIE semaphore, LONG lReleaseCount, LONG *lpPreviousCount);
+DWORD ClrWaitSemaphore(SEMAPHORE_COOKIE semaphore, DWORD dwMilliseconds, BOOL bAlertable);
+
+// mutex api
+MUTEX_COOKIE ClrCreateMutex(LPSECURITY_ATTRIBUTES lpMutexAttributes,BOOL bInitialOwner,LPCTSTR lpName);
+void ClrCloseMutex(MUTEX_COOKIE mutex);
+BOOL ClrReleaseMutex(MUTEX_COOKIE mutex);
+DWORD ClrWaitForMutex(MUTEX_COOKIE mutex,DWORD dwMilliseconds,BOOL bAlertable);
+DWORD ClrSleepEx(DWORD dwMilliseconds, BOOL bAlertable);
+
+// Rather than use the above APIs directly, it is recommended that holder classes
+// be used. This guarantees that the locks will be vacated when the scope is popped,
+// either on exception or on return.
+
+typedef Holder<CRITSEC_COOKIE, ClrEnterCriticalSection, ClrLeaveCriticalSection, NULL> CRITSEC_Holder;
+
+// Use this holder to manage CRITSEC_COOKIE allocation to ensure it will be released if anything goes wrong
+FORCEINLINE void VoidClrDeleteCriticalSection(CRITSEC_COOKIE cs) { if (cs != NULL) ClrDeleteCriticalSection(cs); }
+typedef Wrapper<CRITSEC_COOKIE, DoNothing<CRITSEC_COOKIE>, VoidClrDeleteCriticalSection, NULL> CRITSEC_AllocationHolder;
+
+class Event {
+public:
+ Event ()
+ : m_event(NULL)
+ {STATIC_CONTRACT_LEAF;}
+ ~Event ()
+ {
+ STATIC_CONTRACT_WRAPPER;
+ CloseEvent();
+ }
+
+ void CreateAutoEvent(BOOL bInitialState)
+ {
+ STATIC_CONTRACT_WRAPPER;
+ m_event = ClrCreateAutoEvent(bInitialState);
+ }
+ void CreateManualEvent(BOOL bInitialState)
+ {
+ STATIC_CONTRACT_WRAPPER;
+ m_event = ClrCreateManualEvent(bInitialState);
+ }
+ void CloseEvent()
+ {
+ STATIC_CONTRACT_WRAPPER;
+ if (m_event != NULL)
+ ClrCloseEvent(m_event);
+ m_event = NULL;
+ }
+
+ BOOL Set()
+ {
+ STATIC_CONTRACT_WRAPPER;
+ return ClrSetEvent(m_event);
+ }
+ BOOL Reset()
+ {
+ STATIC_CONTRACT_WRAPPER;
+ return ClrResetEvent(m_event);
+ }
+ DWORD Wait(DWORD dwMilliseconds, BOOL bAlertable)
+ {
+ STATIC_CONTRACT_WRAPPER;
+ return ClrWaitEvent(m_event, dwMilliseconds, bAlertable);
+ }
+
+private:
+ EVENT_COOKIE m_event;
+};
+
+class Semaphore {
+public:
+ Semaphore ()
+ : m_semaphore(NULL)
+ {STATIC_CONTRACT_LEAF;}
+ ~Semaphore ()
+ {
+ STATIC_CONTRACT_WRAPPER;
+ Close();
+ }
+
+ void Create(DWORD dwInitial, DWORD dwMax)
+ {
+ STATIC_CONTRACT_WRAPPER;
+ m_semaphore = ClrCreateSemaphore(dwInitial, dwMax);
+ }
+ void Close()
+ {
+ STATIC_CONTRACT_WRAPPER;
+ if (m_semaphore != NULL)
+ ClrCloseSemaphore(m_semaphore);
+ m_semaphore = NULL;
+ }
+
+ BOOL Release(LONG lReleaseCount, LONG* lpPreviousCount)
+ {
+ STATIC_CONTRACT_WRAPPER;
+ return ClrReleaseSemaphore(m_semaphore, lReleaseCount, lpPreviousCount);
+ }
+ DWORD Wait(DWORD dwMilliseconds, BOOL bAlertable)
+ {
+ STATIC_CONTRACT_WRAPPER;
+ return ClrWaitSemaphore(m_semaphore, dwMilliseconds, bAlertable);
+ }
+
+private:
+ SEMAPHORE_COOKIE m_semaphore;
+};
+
+#if defined(FEATURE_CORECLR) || !defined(SELF_NO_HOST) || defined(DACCESS_COMPILE)
+HMODULE GetCLRModule ();
+#endif // defined(FEATURE_CORECLR) || !defined(SELF_NO_HOST) || defined(DACCESS_COMPILE)
+
+#ifndef FEATURE_NO_HOST
+/*
+ Here we start the list of functions we want to deprecate.
+ We use a define to generate a linker error.
+ We must insure to include the header file that has the definition we are about
+ to deprecate before we use the #define otherwise we will run into a linker error
+ when legitimately undef'ing the function
+*/
+
+//
+// following are windows deprecates
+//
+#include <windows.h>
+
+/*
+ If you are reading this, you have probably tracked down the fact that memory Alloc,
+ etc. don't work inside your DLL because you are using src\inc & src\utilcode
+ services.
+ You need to use the ClrXXX equivalent functions to properly guarantee your code
+ works correctly wrt hosting and others execution engine requirements.
+ Check the list of Clr functions above
+*/
+
+#define GetProcessHeap() \
+ Dont_Use_GetProcessHeap()
+
+#define VirtualAlloc(lpAddress, dwSize, flAllocationType, flProtect) \
+ Dont_Use_VirtualAlloc(lpAddress, dwSize, flAllocationType, flProtect)
+
+#define VirtualFree(lpAddress, dwSize, dwFreeType) \
+ Dont_Use_VirtualFree(lpAddress, dwSize, dwFreeType)
+
+#define VirtualQuery(lpAddress, lpBuffer, dwLength) \
+ Dont_Use_VirtualQuery(lpAddress, lpBuffer, dwLength)
+
+#define VirtualProtect(lpAddress, dwSize, flNewProtect, lpflOldProtect) \
+ Dont_Use_VirtualProtect(lpAddress, dwSize, flNewProtect, lpflOldProtect)
+
+#define HeapCreate(flOptions, dwInitialSize, dwMaximumSize) \
+ Dont_Use_HeapCreate(flOptions, dwInitialSize, dwMaximumSize)
+
+#define HeapDestroy(hHeap) \
+ Dont_Use_HeapDestroy(hHeap)
+
+#define HeapAlloc(hHeap, dwFlags, dwBytes) \
+ Dont_Use_HeapAlloc(hHeap, dwFlags, dwBytes)
+
+#define HeapReAlloc(hHeap, dwFlags, lpMem, dwBytes) \
+ Dont_Use_HeapReAlloc(hHeap, dwFlags, lpMem, dwBytes)
+
+#define HeapFree(hHeap, dwFlags, lpMem) \
+ Dont_Use_HeapFree(hHeap, dwFlags, lpMem)
+
+#define HeapValidate(hHeap, dwFlags, lpMem) \
+ Dont_Use_HeapValidate(hHeap, dwFlags, lpMem)
+
+#define LocalAlloc(uFlags, uBytes) \
+ Dont_Use_LocalAlloc(uFlags, uBytes)
+
+#define LocalFree(hMem) \
+ Dont_Use_LocalFree(hMem)
+
+#define LocalReAlloc(hMem, uBytes, uFlags) \
+ Dont_Use_LocalReAlloc(hMem, uBytes, uFlags)
+
+#define GlobalAlloc(uFlags, dwBytes) \
+ Dont_Use_GlobalAlloc(uFlags, dwBytes)
+
+#define GlobalFree(hMem) \
+ Dont_Use_GlobalFree(hMem)
+
+//#define ExitThread Dont_Use_ExitThread
+
+#define ExitProcess Dont_Use_ExitProcess
+
+/*
+ If you are reading this, you have probably tracked down the fact that TlsAlloc,
+ etc. don't work inside your DLL because you are using src\inc & src\utilcode
+ services.
+
+ This is because the CLR can operate in a fiberized environment under host control.
+ When this is the case, logical thread local storage must be fiber-relative rather
+ than thread-relative.
+
+ Although the OS provides FLS routines on .NET Server, it does not yet provide
+ those services on WinXP or Win2K. So you cannot just use fiber routines from
+ the OS.
+
+ Instead, you must use the ClrFls_ routines described above. However, there are
+ some important differences between these EE-provided services and the OS TLS
+ services that you are used to:
+
+ 1) There is no TlsAlloc/FlsAlloc equivalent. You must statically describe
+ your needs via the PredefinedTlsSlots below. If you have dynamic requirements,
+ you should give yourself a single static slot and then build your dynamic
+ requirements on top of this. The lack of a dynamic API is a deliberate
+ choice on my part, rather than lack of time.
+
+ 2) You can provide a cleanup routine, which we will call on your behalf. However,
+ this can be called on a different thread than the "thread" (fiber or thread)
+ which holds the data. It can be called after that thread has actually been
+ terminated. It can be called before you see a DLL_THREAD_DETACH on your
+ physical thread. The circumstances vary based on whether the process is hosted
+ and based on whether TS_WeOwn is set on the internal Thread object. Make
+ no assumptions here.
+*/
+#define TlsAlloc() \
+ Dont_Use_TlsAlloc()
+
+#define TlsSetValue(dwTlsIndex, lpTlsValue) \
+ Dont_Use_TlsSetValue(dwTlsIndex, lpTlsValue)
+
+#define TlsGetValue(dwTlsIndex) \
+ Dont_Use_TlsGetValue(dwTlsIndex)
+
+#define TlsFree(dwTlsIndex) \
+ Dont_Use_TlsFree(dwTlsIndex)
+
+
+/*
+ If you are reading this, you have probably tracked down the fact that synchronization objects
+ and critical sections don't work inside your DLL because you are using src\inc & src\utilcode services.
+ Please refer to the ClrXXX functions described above to make proper use of synchronization obejct, etc.
+
+ Also it's extremely useful to look at the Holder classes defined above.
+ Those classes provide a nice encapsulation for synchronization object that allows automatic release of locks.
+*/
+#define InitializeCriticalSection(lpCriticalSection) \
+ Dont_Use_InitializeCriticalSection(lpCriticalSection)
+
+#define InitializeCriticalSectionAndSpinCount(lpCriticalSection, dwSpinCount) \
+ Dont_Use_InitializeCriticalSectionAndSpinCount(lpCriticalSection, dwSpinCount)
+
+#define DeleteCriticalSection(lpCriticalSection) \
+ Dont_Use_DeleteCriticalSection(lpCriticalSection)
+
+#define EnterCriticalSection(lpCriticalSection) \
+ Dont_Use_EnterCriticalSection(lpCriticalSection)
+
+#define TryEnterCriticalSection(lpCriticalSection) \
+ Dont_Use_TryEnterCriticalSection(lpCriticalSection)
+
+#define LeaveCriticalSection(lpCriticalSection) \
+ Dont_Use_LeaveCriticalSection(lpCriticalSection)
+
+#ifdef CreateEvent
+#undef CreateEvent
+#endif
+#define CreateEvent(lpEventAttributes, bManualReset, bInitialState, lpName) \
+ Dont_Use_CreateEvent(lpEventAttributes, bManualReset, bInitialState, lpName)
+
+#ifdef OpenEvent
+#undef OpenEvent
+#endif
+#define OpenEvent(dwDesiredAccess, bInheritHandle, lpName) \
+ Dont_Use_OpenEvent(dwDesiredAccess, bInheritHandle, lpName)
+
+#define ResetEvent(hEvent) \
+ Dont_Use_ResetEvent(hEvent)
+
+#define SetEvent(hEvent) \
+ Dont_Use_SetEvent(hEvent)
+
+#define PulseEvent(hEvent) \
+ Dont_Use_PulseEvent(hEvent)
+
+#ifdef CreateSemaphore
+#undef CreateSemaphore
+#endif
+#define CreateSemaphore(lpSemaphoreAttributes, lInitialCount, lMaximumCount, lpName) \
+ Dont_Use_CreateSemaphore(lpSemaphoreAttributes, lInitialCount, lMaximumCount, lpName)
+
+#ifdef OpenSemaphore
+#undef OpenSemaphore
+#endif
+#define OpenSemaphore(dwDesiredAccess, bInheritHandle, lpName) \
+ Dont_Use_OpenSemaphore(dwDesiredAccess, bInheritHandle, lpName)
+
+#define ReleaseSemaphore(hSemaphore, lReleaseCount, lpPreviousCount) \
+ Dont_Use_ReleaseSemaphore(hSemaphore, lReleaseCount, lpPreviousCount)
+
+#ifdef Sleep
+#undef Sleep
+#endif
+#define Sleep(dwMilliseconds) \
+ Dont_Use_Sleep(dwMilliseconds)
+
+#ifdef SleepEx
+#undef SleepEx
+#endif
+#define SleepEx(dwMilliseconds,bAlertable) \
+ Dont_Use_SleepEx(dwMilliseconds,bAlertable)
+
+//
+// following are clib deprecates
+//
+#include <stdlib.h>
+#include <malloc.h>
+
+#ifdef malloc
+#undef malloc
+#endif
+
+#define _CRT_EXCEPTION_NO_MALLOC
+#define malloc(size) \
+ Dont_Use_malloc(size)
+
+#ifdef realloc
+#undef realloc
+#endif
+#define realloc(memblock, size) \
+ Dont_Use_realloc(memblock, size)
+
+#ifdef free
+#undef free
+#endif
+#define free(memblock) \
+ Dont_Use_free(memblock)
+
+#endif //!FEATURE_NO_HOST
+
+extern void IncCantAllocCount();
+extern void DecCantAllocCount();
+
+class CantAllocHolder
+{
+public:
+ CantAllocHolder ()
+ {
+ IncCantAllocCount ();
+ }
+ ~CantAllocHolder()
+ {
+ DecCantAllocCount ();
+ }
+};
+
+// At places where want to allocate stress log, we need to first check if we are allowed to do so.
+// If ClrTlsInfo doesn't exist for this thread, we take it as can alloc
+inline bool IsInCantAllocRegion ()
+{
+ size_t count = 0;
+ if (ClrFlsCheckValue(TlsIdx_CantAllocCount, (LPVOID *)&count))
+ {
+ _ASSERTE (count >= 0);
+ return count > 0;
+ }
+ return false;
+}
+// for stress log the rule is more restrict, we have to check the global counter too
+extern BOOL IsInCantAllocStressLogRegion();
+
+#include "genericstackprobe.inl"
+
+#endif
diff --git a/src/inc/clrinternal.idl b/src/inc/clrinternal.idl
new file mode 100644
index 0000000000..4193d1bfe8
--- /dev/null
+++ b/src/inc/clrinternal.idl
@@ -0,0 +1,491 @@
+// 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.
+
+/**************************************************************************************
+ ** **
+ ** clrinternal.idl - interface definitions for internal usage. **
+ ** **
+ **************************************************************************************/
+
+//
+// Interface descriptions
+//
+import "unknwn.idl";
+
+// import mscoree.idl for BucketParameters definition
+import "mscoree.idl";
+
+#ifndef FEATURE_CORECLR
+import "hstring.idl";
+#endif //!FEATURE_CORECLR
+
+#ifndef FEATURE_CORECLR
+interface IActivationFactory;
+cpp_quote("interface IActivationFactory;")
+
+interface IWinRTClassActivator;
+cpp_quote("interface IWinRTClassActivator;")
+#endif //!FEATURE_CORECLR
+
+cpp_quote("#if 0")
+
+typedef struct _OSVERSIONINFOA {
+ DWORD dwOSVersionInfoSize;
+ DWORD dwMajorVersion;
+ DWORD dwMinorVersion;
+ DWORD dwBuildNumber;
+ DWORD dwPlatformId;
+ CHAR szCSDVersion[ 128 ]; // Maintenance string for PSS usage
+} OSVERSIONINFOA, *POSVERSIONINFOA, *LPOSVERSIONINFOA;
+
+typedef struct _OSVERSIONINFOW {
+ DWORD dwOSVersionInfoSize;
+ DWORD dwMajorVersion;
+ DWORD dwMinorVersion;
+ DWORD dwBuildNumber;
+ DWORD dwPlatformId;
+ WCHAR szCSDVersion[ 128 ]; // Maintenance string for PSS usage
+} OSVERSIONINFOW, *POSVERSIONINFOW, *LPOSVERSIONINFOW, RTL_OSVERSIONINFOW, *PRTL_OSVERSIONINFOW;
+#ifdef UNICODE
+typedef OSVERSIONINFOW OSVERSIONINFO;
+typedef POSVERSIONINFOW POSVERSIONINFO;
+typedef LPOSVERSIONINFOW LPOSVERSIONINFO;
+#else
+typedef OSVERSIONINFOA OSVERSIONINFO;
+typedef POSVERSIONINFOA POSVERSIONINFO;
+typedef LPOSVERSIONINFOA LPOSVERSIONINFO;
+#endif // UNICODE
+
+cpp_quote("#endif")
+
+// IID IExecutionEngine : uuid(7AF02DAC-2A33-494b-A09F-25E00A93C6F8)
+cpp_quote("EXTERN_GUID(IID_IExecutionEngine, 0x7AF02DAC, 0x2A33, 0x494b, 0xA0, 0x9F, 0x25, 0xE0, 0x0A, 0x93, 0xC6, 0xF8);")
+
+// IID IEEMemoryManager : uuid{17713B61-B59F-4e13-BAAF-91623DC8ADC0}
+cpp_quote("EXTERN_GUID(IID_IEEMemoryManager, 0x17713b61, 0xb59f, 0x4e13, 0xba, 0xaf, 0x91, 0x62, 0x3d, 0xc8, 0xad, 0xc0);")
+
+// This ID is embedded in the CLRDEBUGINFO resource so that the shim can differentiate dlls which happen to be named
+// clr.dll from official Microsoft clr.dll implementations. This is not intended to authenticate a CLR in a strong
+// security sense but short of deliberate 3rd party spoofing it should provide a good identity.
+//
+// Using a different ID allows us to completely hide different CLR SKUs from each other. The recommendation is to keep
+// the ID contant between different versions of the same SKU and use mscordbi's logic to determine whether a given
+// version is compatible. This allows debuggers to give different errors for 'future version of the CLR I don't
+// support' vs. 'No CLR is loaded at all.'
+//
+// This guid first appears in version 4.0 of CLR on x86 and amd64 - earlier versions had no resource
+// GUID CLR_ID_V4_DESKTOP : uuid{267F3989-D786-4b9a-9AF6-D19E42D557EC}
+cpp_quote("EXTERN_GUID(CLR_ID_V4_DESKTOP, 0x267f3989, 0xd786, 0x4b9a, 0x9a, 0xf6, 0xd1, 0x9e, 0x42, 0xd5, 0x57, 0xec);")
+
+// This guid has been set aside for CoreCLR usage - at present CoreCLR doesn't use it though
+// GUID CLR_ID_CORECLR : uuid{8CB8E075-0A91-408E-9228-D66E00A3BFF6}
+cpp_quote("EXTERN_GUID(CLR_ID_CORECLR, 0x8CB8E075, 0x0A91, 0x408E, 0x92, 0x28, 0xD6, 0x6E, 0x00, 0xA3, 0xBF, 0xF6 );")
+
+// This guid first appears in the CoreCLR port to Windows Phone 8 - note that it is seperate from the CoreCLR id because it will
+// potentially have a different verioning lineage than CoreCLR
+// GUID CLR_ID_PHONE_CLR : uuid{E7237E9C-31C0-488C-AD48-324D3E7ED92A}
+cpp_quote("EXTERN_GUID(CLR_ID_PHONE_CLR, 0xE7237E9C, 0x31C0, 0x488C, 0xAD, 0x48, 0x32, 0x4D, 0x3E, 0x7E, 0xD9, 0x2A);")
+
+// This guid first appears 8/19/14 as CoreCLR evolves to OneCore, ProjectK, and versions of Phone after PhoneBlue
+// The new guid intentionally creates a breaking change so we can simplify the file naming on mscordaccore.dll and mscordbi.dll
+// in xplat hosting scenarios. Old versions of dbgshim.dll will not be able to support this.
+// GUID CLR_ID_ONECORE_CLR : uuid{B1EE760D-6C4A-4533-BA41-6F4F661FABAF}
+cpp_quote("EXTERN_GUID(CLR_ID_ONECORE_CLR, 0xb1ee760d, 0x6c4a, 0x4533, 0xba, 0x41, 0x6f, 0x4f, 0x66, 0x1f, 0xab, 0xaf);")
+
+
+// IID_IPrivateManagedExceptionReporting : uuid{AD76A023-332D-4298-8001-07AA9350DCA4}
+cpp_quote("EXTERN_GUID(IID_IPrivateManagedExceptionReporting, 0xad76a023, 0x332d, 0x4298, 0x80, 0x01, 0x07, 0xaa, 0x93, 0x50, 0xdc, 0xa4);")
+
+#ifndef FEATURE_CORECLR
+// CLSID CLRRuntimeHostInternal : uuid(f7721072-bf57-476d-89f8-a7625d27683a)
+cpp_quote("EXTERN_GUID(CLSID_CLRRuntimeHostInternal, 0xf7721072, 0xbf57, 0x476d, 0x89, 0xf8, 0xa7, 0x62, 0x5d, 0x27, 0x68, 0x3a);")
+// IID ICLRRuntimeHostInternal : uuid{07C4E752-3CBA-4A07-9943-B5F206382178}
+cpp_quote("EXTERN_GUID(IID_ICLRRuntimeHostInternal, 0x07c4e752, 0x3cba, 0x4a07, 0x99, 0x43, 0xb5, 0xf2, 0x06, 0x38, 0x21, 0x78);")
+
+// CLSID_CLRShimControlInternal : uuid(62D02A5B-F527-44d8-80BC-650BBD3CB082)
+cpp_quote("EXTERN_GUID(CLSID_CLRShimControlInternal, 0x62d02a5b, 0xf527, 0x44d8, 0x80, 0xbc, 0x65, 0xb, 0xbd, 0x3c, 0xb0, 0x82);")
+
+// IID ICLRShimControlInternal : uuid{826AAAD7-717B-44f8-9BB0-7DAC368B85A5}
+cpp_quote("EXTERN_GUID(IID_ICLRShimControlInternal, 0x826AAAD7, 0x717b, 0x44f8, 0x9b, 0xb0, 0x7d, 0xac, 0x36, 0x8b, 0x85, 0xa5);")
+
+// CLSID_CLRActivationFactory : uuid{5B132A7D-DA8E-461b-A0F2-109141C768CB}
+cpp_quote("EXTERN_GUID(CLSID_CLRActivationFactory, 0x5b132a7d, 0xda8e, 0x461b, 0xa0, 0xf2, 0x10, 0x91, 0x41, 0xc7, 0x68, 0xcb );")
+
+// IID_ICLRActivationFactory : uuid{331F2F6C-385F-462c-9125-816712FB2BC6}
+cpp_quote("EXTERN_GUID(IID_ICLRActivationFactory, 0x331f2f6c, 0x385f, 0x462c, 0x91, 0x25, 0x81, 0x67, 0x12, 0xfb, 0x2b, 0xc6);")
+
+// IID_ICLRActivationFactory2 : uuid{035049E5-2658-40C0-9269-21C48D8F0748}
+cpp_quote("EXTERN_GUID(IID_ICLRActivationFactory2, 0x035049E5, 0x2658, 0x40C0, 0x92, 0x69, 0x21, 0xC4, 0x8D, 0x8F, 0x07, 0x48);")
+
+// IID IID_ICLRExecutionManager: uuid(1000A3E7-B420-4620-AE30-FB19B587AD1D)
+cpp_quote("EXTERN_GUID(IID_ICLRExecutionManager, 0x1000A3E7, 0xB420, 0x4620, 0xAE, 0x30, 0xFB, 0x19, 0xB5, 0x87, 0xAD, 0x1D);")
+#endif // !FEATURE_CORECLR
+
+//*****************************************************************************
+// Interface for exposing services from the EE to other DLLs of the CLR.
+//*****************************************************************************
+typedef void * CRITSEC_COOKIE;
+typedef void * EVENT_COOKIE;
+typedef void * SEMAPHORE_COOKIE;
+typedef void * MUTEX_COOKIE;
+
+typedef enum {
+ CRST_DEFAULT = 0x0,
+ CRST_REENTRANCY = 0x1, // allow same thread to take lock multiple times.
+ CRST_UNSAFE_SAMELEVEL = 0x2, // AVOID THIS! Can take other locks @ same level in
+ // any order.
+ CRST_UNSAFE_COOPGC = 0x4, // AVOID THIS! Lock must be taken in cooperative mode.
+ CRST_UNSAFE_ANYMODE = 0x8, // AVOID THIS! Lock can be taken in either GC mode.
+ CRST_DEBUGGER_THREAD = 0x10, // This lock can be taken on the debugger's helper thread.
+ CRST_HOST_BREAKABLE = 0x20, // This lock is held while running managed code. It can be terminated by a host.
+ // CRST_UNUSED = 0x40,
+ CRST_TAKEN_DURING_SHUTDOWN = 0x80, // This lock is taken during the shutdown sequence in EEShutdown(helper)
+ CRST_GC_NOTRIGGER_WHEN_TAKEN = 0x100,
+ // User of this lock cannot trigger GC, while it is locked.
+ // Note that Enter on this lock can trigger GC if called from COOPERATIVE mode.
+ // It is useful for locks which can be taken on GC or debugger threads.
+ CRST_DEBUG_ONLY_CHECK_FORBID_SUSPEND_THREAD = 0x200,
+ // Some rare locks should be taken only in ForbidSuspend region (i.e. profiler cannot walk the stack),
+ // this option will assert it in debug mode.
+} CrstFlags;
+
+// Callback function for cleaning up TLS
+typedef VOID (__stdcall *PTLS_CALLBACK_FUNCTION)(PVOID);
+
+
+[
+ uuid(7AF02DAC-2A33-494b-A09F-25E00A93C6F8),
+ helpstring("CLR Coordination Interface"),
+ pointer_default(unique),
+ local
+]
+interface IExecutionEngine : IUnknown
+{
+ // Thread Local Storage is based on logical threads. The underlying
+ // implementation could be threads, fibers, or something more exotic.
+ // Slot numbers are predefined. This is not a general extensibility
+ // mechanism.
+
+ // Associate a callback function for releasing TLS on thread/fiber death.
+ // This can be NULL.
+ void TLS_AssociateCallback([in] DWORD slot, [in] PTLS_CALLBACK_FUNCTION callback);
+
+ // Get the TLS block for fast Get/Set operations
+ PVOID* TLS_GetDataBlock();
+
+ // Get the value at a slot
+ PVOID TLS_GetValue([in] DWORD slot);
+
+ // Get the value at a slot, return FALSE if TLS info block doesn't exist
+ BOOL TLS_CheckValue([in] DWORD slot, [out] PVOID * pValue);
+
+ // Set the value at a slot
+ void TLS_SetValue([in] DWORD slot, [in] PVOID pData);
+
+ // Free TLS memory block and make callback
+ void TLS_ThreadDetaching();
+
+ // Critical Sections are sometimes exposed to the host and therefore need to be
+ // reflected from all CLR DLLs to the EE.
+ //
+ // In addition, we always monitor interactions between the lock & the GC, based
+ // on the GC mode in which the lock is acquired and we restrict what operations
+ // are permitted while holding the lock based on this.
+ //
+ // Finally, we we rank all our locks to prevent deadlock across all the DLLs of
+ // the CLR. This is the level argument to CreateLock.
+ //
+ // All usage of these locks must be exception-safe. To achieve this, we suggest
+ // using Holders (see holder.h & crst.h). In fact, within the EE code cannot
+ // hold locks except by using exception-safe holders.
+
+ CRITSEC_COOKIE CreateLock([in] LPCSTR szTag, [in] LPCSTR level, [in] CrstFlags flags);
+
+ void DestroyLock([in] CRITSEC_COOKIE lock);
+
+ void AcquireLock([in] CRITSEC_COOKIE lock);
+
+ void ReleaseLock([in] CRITSEC_COOKIE lock);
+
+ EVENT_COOKIE CreateAutoEvent([in] BOOL bInitialState);
+ EVENT_COOKIE CreateManualEvent([in] BOOL bInitialState);
+ void CloseEvent([in] EVENT_COOKIE event);
+ BOOL ClrSetEvent([in] EVENT_COOKIE event);
+ BOOL ClrResetEvent([in] EVENT_COOKIE event);
+ DWORD WaitForEvent([in] EVENT_COOKIE event, [in] DWORD dwMilliseconds, [in] BOOL bAlertable);
+ DWORD WaitForSingleObject([in] HANDLE handle, [in] DWORD dwMilliseconds);
+
+ // OS header file defines CreateSemaphore.
+ SEMAPHORE_COOKIE ClrCreateSemaphore([in] DWORD dwInitial, [in] DWORD dwMax);
+ void ClrCloseSemaphore([in] SEMAPHORE_COOKIE semaphore);
+ DWORD ClrWaitForSemaphore([in] SEMAPHORE_COOKIE semaphore, [in] DWORD dwMilliseconds, [in] BOOL bAlertable);
+ BOOL ClrReleaseSemaphore([in] SEMAPHORE_COOKIE semaphore, [in] LONG lReleaseCount, [in] LONG *lpPreviousCount);
+
+ MUTEX_COOKIE ClrCreateMutex([in]LPSECURITY_ATTRIBUTES lpMutexAttributes, [in]BOOL bInitialOwner, [in]LPCTSTR lpName);
+ DWORD ClrWaitForMutex([in] MUTEX_COOKIE mutex, [in] DWORD dwMilliseconds, [in] BOOL bAlertable);
+ BOOL ClrReleaseMutex([in] MUTEX_COOKIE mutex);
+ void ClrCloseMutex([in] MUTEX_COOKIE mutex);
+
+ DWORD ClrSleepEx([in] DWORD dwMilliseconds, [in] BOOL bAlertable);
+
+ BOOL ClrAllocationDisallowed();
+
+ void GetLastThrownObjectExceptionFromThread([out] void **ppvException);
+
+}; // interface IExecutionEngine
+
+
+//*****************************************************************************
+// Interface for exposing memory services from the EE to other DLLs of the CLR.
+//*****************************************************************************
+
+cpp_quote("#if !defined(_WINNT_) && !defined(_NTMMAPI_)")
+typedef void* PMEMORY_BASIC_INFORMATION;
+cpp_quote("#endif")
+
+
+[
+ uuid(17713B61-B59F-4e13-BAAF-91623DC8ADC0),
+ helpstring("CLR Memory Manager Interface"),
+ pointer_default(unique),
+ local
+]
+interface IEEMemoryManager : IUnknown
+{
+ LPVOID ClrVirtualAlloc(
+ [in] LPVOID lpAddress, // region to reserve or commit
+ [in] SIZE_T dwSize, // size of region
+ [in] DWORD flAllocationType, // type of allocation
+ [in] DWORD flProtect // type of access protection
+ );
+
+ BOOL ClrVirtualFree(
+ [in] LPVOID lpAddress, // address of region
+ [in] SIZE_T dwSize, // size of region
+ [in] DWORD dwFreeType // operation type
+ );
+
+ SIZE_T ClrVirtualQuery(
+ [in] const void* lpAddress, // address of region
+ [in] PMEMORY_BASIC_INFORMATION lpBuffer, // information buffer
+ [in] SIZE_T dwLength // size of buffer
+ );
+
+ BOOL ClrVirtualProtect(
+ [in] LPVOID lpAddress, // region of committed pages
+ [in] SIZE_T dwSize, // size of the region
+ [in] DWORD flNewProtect, // desired access protection
+ [in] DWORD* lpflOldProtect // old protection
+ );
+
+ HANDLE ClrGetProcessHeap();
+
+ HANDLE ClrHeapCreate(
+ [in] DWORD flOptions, // heap allocation attributes
+ [in] SIZE_T dwInitialSize, // initial heap size
+ [in] SIZE_T dwMaximumSize // maximum heap size
+ );
+
+ BOOL ClrHeapDestroy(
+ [in] HANDLE hHeap // handle to heap
+ );
+
+ LPVOID ClrHeapAlloc(
+ [in] HANDLE hHeap, // handle to private heap block
+ [in] DWORD dwFlags, // heap allocation control
+ [in] SIZE_T dwBytes // number of bytes to allocate
+ );
+
+ BOOL ClrHeapFree(
+ [in] HANDLE hHeap, // handle to heap
+ [in] DWORD dwFlags, // heap free options
+ [in] LPVOID lpMem // pointer to memory
+ );
+
+ BOOL ClrHeapValidate(
+ [in] HANDLE hHeap, // handle to heap
+ [in] DWORD dwFlags, // heap access options
+ [in] const void* lpMem // optional pointer to memory block
+ );
+
+ HANDLE ClrGetProcessExecutableHeap();
+
+}; // interface IEEMemoryManager
+
+//********************************************************************************************
+// Interface for exposing GetBucketParametersForCurrentException to Watson testing harness.
+//********************************************************************************************
+[
+ uuid(AD76A023-332D-4298-8001-07AA9350DCA4),
+ helpstring("Private Managed Exception Reporting Interface"),
+ pointer_default(unique),
+ local
+]
+interface IPrivateManagedExceptionReporting : IUnknown
+{
+ HRESULT GetBucketParametersForCurrentException([out]BucketParameters *pParams);
+}
+
+#ifndef FEATURE_CORECLR
+/**************************************************************************************
+ ** ICLRRuntimeHostInternal **
+ ** This is the functionality used only by CLR internal tools that moved from being **
+ ** flat APIs (loading the latest runtime) to something that is runtime-specific and **
+ ** requires the runtime to be loaded. **
+ **************************************************************************************/
+[
+ uuid(07C4E752-3CBA-4A07-9943-B5F206382178),
+ version(1.0),
+ helpstring("CLR internal hosting interface for V4.0"),
+ local
+]
+interface ICLRRuntimeHostInternal : IUnknown
+{
+ HRESULT MetaDataGetDispenser(
+ [in] REFCLSID rclsid,
+ [in] REFIID riid,
+ [out, iid_is(riid), retval] IUnknown **ppInterface);
+
+ HRESULT GetAssemblyMDImport(
+ [in] LPCWSTR wszFileName, // The scope (file name) to open.
+ [in] REFIID riid, // Desired interface.
+ [out, iid_is(riid), retval] IUnknown **ppIUnk); // Returned interface on success.
+
+ HRESULT GetMetaDataInternalInterface(
+ [in, size_is(cbData)] BYTE *pbData, // MetaData data.
+ [in] ULONG cbData, // MetaData data size.
+ [in] DWORD flags, // Flags.
+ [in] REFIID riid, // Desired interface.
+ [out, iid_is(riid), retval] LPVOID *ppInterface); // Returned interface.
+
+ HRESULT GetMetaDataInternalInterfaceFromPublic(
+ [in] IUnknown *pInterface, // Given interface.
+ [in] REFIID riid, // Desired interface.
+ [out, iid_is(riid), retval] LPVOID *ppInterface); // Returned interface.
+
+ HRESULT GetMetaDataPublicInterfaceFromInternal(
+ [in] IUnknown *pInterface, // Given interface.
+ [in] REFIID riid, // Desired interface.
+ [out, iid_is(riid), retval] LPVOID *ppInterface); // Returned interface.
+
+ /**********************************************************************************
+ ** Returns the version string that MD emitter should by default write to images.**
+ ** Supersedes: GetCORRequiredVersion **
+ **********************************************************************************/
+ HRESULT GetImageVersionString(
+ [out, size_is(*pcchBuffer), annotation("__out_ecount_opt(*pcchBuffer)")] LPWSTR pwzBuffer, // Returned version string.
+ [in, out] DWORD *pcchBuffer); // Buffer size/version length.
+
+ /**********************************************************************************
+ ** Locks the given module for this runtime. The HRESULT is S_OK if it is the **
+ ** runtime represented by this instance, S_FALSE if somebody beat us to it. **
+ **********************************************************************************/
+ HRESULT LockModuleForRuntime(
+ [in] BYTE *pModuleBase, // Address where the module is mapped.
+ [in] REFIID riid, // Desired interface.
+ [out, iid_is(riid)] LPVOID *ppRuntime); // The owning runtime.
+
+ /**********************************************************************************
+ ** Asks the Shim to attempt a graceful shutdown of all other runtimes loaded **
+ ** in this process, then to exit the process via ::ExitProcess(). V4+ runtimes **
+ ** call this instead of ::ExitProcess(). **
+ **********************************************************************************/
+ HRESULT ShutdownAllRuntimesThenExit(
+ [in] UINT exitCode); // Process exit code.
+
+ /**********************************************************************************
+ ** GetTrueOSVersion - Bypasses the OS compatibility shim **
+ **********************************************************************************/
+ HRESULT GetTrueOSVersion(
+ [out, in] LPOSVERSIONINFO osvi); // OS Version.
+
+ /**********************************************************************************
+ ** Returns the runtime that a COM component with the given CLSID would be **
+ ** activated in. Returns runtime represented by this instance for Fx types. **
+ **********************************************************************************/
+ HRESULT GetRuntimeForManagedCOMObject(
+ [in] REFCLSID rclsid, // CLSID of the component.
+ [in] REFIID riid, // Desired runtime interface.
+ [out, iid_is(riid), retval] LPVOID *ppRuntime); // Returned runtime.
+}; // interface ICLRRuntimeHostInternal
+
+/**************************************************************************************
+ ** ICLRShimControlInternal **
+ ** This is the functionality used only by CLR internal tools that moved from being **
+ ** flat APIs (loading the latest runtime) to controlshim behavior **
+ **************************************************************************************/
+[
+ uuid(826AAAD7-717B-44f8-9BB0-7DAC368B85A5),
+ version(1.0),
+ helpstring("CLR internal hosting interface for V4.0"),
+ local
+]
+interface ICLRShimControlInternal : IUnknown
+{
+ HRESULT SetShouldSkipSkuCheck(
+ [in] BOOL bValue
+ );
+}; // interface ICLRRuntimeHostInternal
+
+
+
+/**************************************************************************************
+ ** ICLRActivationFactory **
+ ** This is the functionality used only by CLR to provide in-proc **
+ ** hosting **
+ **************************************************************************************/
+[
+ uuid(331F2F6C-385F-462c-9125-816712FB2BC6),
+ version(1.0),
+ helpstring("CLR internal activation factory for V4.5"),
+ local
+]
+interface ICLRActivationFactory : IUnknown
+{
+ HRESULT CreateFactory([in] LPCWSTR activatableClassId,
+ [out, retval] IActivationFactory** factory);
+
+}; // interface ICLRActivationFactory
+
+/**************************************************************************************
+ ** ICLRActivationFactory2 **
+ ** This is functionality exposed by the CLR to enable hosting WinRT components in a **
+ ** non-AppX process **
+ **************************************************************************************/
+[
+ uuid(035049E5-2658-40C0-9269-21C48D8F0748),
+ version(1.0),
+ helpstring("CLR internal activation factory for desktop WinRT activation"),
+ local
+]
+interface ICLRActivationFactory2 : ICLRActivationFactory
+{
+ HRESULT GetClassActivatorForApplication(HSTRING appPath, [out] IWinRTClassActivator** ppActivator);
+};
+
+typedef enum
+{
+ PAUSE_APP_DOMAINS = 0x1
+
+} PauseFlags;
+
+[
+ uuid(1000A3E7-B420-4620-AE30-FB19B587AD1D),
+ version(1.0),
+ helpstring("Pause and Resume Interface"),
+ pointer_default(unique),
+ local
+]
+interface ICLRExecutionManager : IUnknown
+{
+ // Pause all managed threads
+ // Parameters are ignored and reserved for future use.
+ HRESULT Pause([in] DWORD dwAppDomainId, [in] DWORD dwFlags);
+
+ // Resume managed threads
+ // Parameters are ignored and reserved for future use.
+ HRESULT Resume([in] DWORD dwAppDomainId);
+}
+#endif // !FEATURE_CORECLR
+
diff --git a/src/inc/clrnt.h b/src/inc/clrnt.h
new file mode 100644
index 0000000000..c15bd48fa8
--- /dev/null
+++ b/src/inc/clrnt.h
@@ -0,0 +1,998 @@
+// 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.
+
+
+#ifndef CLRNT_H_
+#define CLRNT_H_
+
+#include "staticcontract.h"
+#include "cfi.h"
+
+//
+// This file is the result of some changes to the SDK header files.
+// In particular, nt.h and some of its dependencies are no longer
+// available except as "nonship" files. As a result, this file
+// was created as a simple cut and past of structures and functions
+// from NT that are either not yet documented or have been overlooked
+// as being part of the platform SDK.
+//
+
+//
+// ALL PLATFORMS
+//
+
+#define STATUS_INVALID_PARAMETER_3 ((NTSTATUS)0xC00000F1L)
+#define STATUS_INVALID_PARAMETER_4 ((NTSTATUS)0xC00000F2L)
+#define STATUS_UNSUCCESSFUL ((NTSTATUS)0xC0000001L)
+#define STATUS_SUCCESS ((NTSTATUS)0x00000000L)
+
+#ifndef STATUS_UNWIND
+#define STATUS_UNWIND ((NTSTATUS)0x80000027L)
+#endif
+
+#ifndef DBG_PRINTEXCEPTION_C
+#define DBG_PRINTEXCEPTION_C ((DWORD)0x40010006L)
+#endif
+
+#ifndef STATUS_UNWIND_CONSOLIDATE
+#define STATUS_UNWIND_CONSOLIDATE ((NTSTATUS)0x80000029L)
+#endif
+
+#ifndef STATUS_LONGJUMP
+#define STATUS_LONGJUMP ((NTSTATUS)0x80000026L)
+#endif
+
+#ifndef LOCALE_NAME_MAX_LENGTH
+#define LOCALE_NAME_MAX_LENGTH 85
+#endif // !LOCALE_NAME_MAX_LENGTH
+
+#ifndef SUBLANG_CUSTOM_DEFAULT
+#define SUBLANG_CUSTOM_DEFAULT 0x03 // default custom language/locale
+#define SUBLANG_CUSTOM_UNSPECIFIED 0x04 // custom language/locale
+#define LOCALE_CUSTOM_DEFAULT \
+ (MAKELCID(MAKELANGID(LANG_NEUTRAL, SUBLANG_CUSTOM_DEFAULT), SORT_DEFAULT))
+#define LOCALE_CUSTOM_UNSPECIFIED \
+ (MAKELCID(MAKELANGID(LANG_NEUTRAL, SUBLANG_CUSTOM_UNSPECIFIED), SORT_DEFAULT))
+#endif // !SUBLANG_CUSTOM_DEFAULT
+
+#ifndef __out_xcount_opt
+#define __out_xcount_opt(var) __out
+#endif
+
+#ifndef __encoded_pointer
+#define __encoded_pointer
+#endif
+
+#ifndef __range
+#define __range(min, man)
+#endif
+
+#ifndef __field_bcount
+#define __field_bcount(size)
+#endif
+
+#ifndef __field_ecount_opt
+#define __field_ecount_opt(nFields)
+#endif
+
+#ifndef __field_ecount
+#define __field_ecount(EHCount)
+#endif
+
+#ifdef FEATURE_CORECLR
+#undef _Ret_bytecap_
+#define _Ret_bytecap_(_Size)
+#endif
+
+#ifndef NT_SUCCESS
+#define NT_SUCCESS(Status) (((NTSTATUS)(Status)) >= 0)
+#endif
+
+#define ARGUMENT_PRESENT(ArgumentPointer) (\
+ (CHAR *)(ArgumentPointer) != (CHAR *)(NULL) )
+
+#define EXCEPTION_CHAIN_END ((PEXCEPTION_REGISTRATION_RECORD)-1)
+
+typedef signed char SCHAR;
+typedef SCHAR *PSCHAR;
+typedef LONG NTSTATUS;
+
+#ifndef FEATURE_PAL
+
+#define TLS_MINIMUM_AVAILABLE 64 // winnt
+#define TLS_EXPANSION_SLOTS 1024
+
+typedef enum _THREADINFOCLASS {
+ ThreadBasicInformation,
+ ThreadTimes,
+ ThreadPriority,
+ ThreadBasePriority,
+ ThreadAffinityMask,
+ ThreadImpersonationToken,
+ ThreadDescriptorTableEntry,
+ ThreadEnableAlignmentFaultFixup,
+ ThreadEventPair_Reusable,
+ ThreadQuerySetWin32StartAddress,
+ ThreadZeroTlsCell,
+ ThreadPerformanceCount,
+ ThreadAmILastThread,
+ ThreadIdealProcessor,
+ ThreadPriorityBoost,
+ ThreadSetTlsArrayAddress,
+ ThreadIsIoPending,
+ ThreadHideFromDebugger,
+ ThreadBreakOnTermination,
+ MaxThreadInfoClass
+ } THREADINFOCLASS;
+
+typedef enum _SYSTEM_INFORMATION_CLASS {
+ SystemBasicInformation,
+ SystemProcessorInformation, // obsolete...delete
+ SystemPerformanceInformation,
+ SystemTimeOfDayInformation,
+ SystemPathInformation,
+ SystemProcessInformation,
+ SystemCallCountInformation,
+ SystemDeviceInformation,
+ SystemProcessorPerformanceInformation,
+ SystemFlagsInformation,
+ SystemCallTimeInformation,
+ SystemModuleInformation,
+ SystemLocksInformation,
+ SystemStackTraceInformation,
+ SystemPagedPoolInformation,
+ SystemNonPagedPoolInformation,
+ SystemHandleInformation,
+ SystemObjectInformation,
+ SystemPageFileInformation,
+ SystemVdmInstemulInformation,
+ SystemVdmBopInformation,
+ SystemFileCacheInformation,
+ SystemPoolTagInformation,
+ SystemInterruptInformation,
+ SystemDpcBehaviorInformation,
+ SystemFullMemoryInformation,
+ SystemLoadGdiDriverInformation,
+ SystemUnloadGdiDriverInformation,
+ SystemTimeAdjustmentInformation,
+ SystemSummaryMemoryInformation,
+ SystemMirrorMemoryInformation,
+ SystemPerformanceTraceInformation,
+ SystemObsolete0,
+ SystemExceptionInformation,
+ SystemCrashDumpStateInformation,
+ SystemKernelDebuggerInformation,
+ SystemContextSwitchInformation,
+ SystemRegistryQuotaInformation,
+ SystemExtendServiceTableInformation,
+ SystemPrioritySeperation,
+ SystemVerifierAddDriverInformation,
+ SystemVerifierRemoveDriverInformation,
+ SystemProcessorIdleInformation,
+ SystemLegacyDriverInformation,
+ SystemCurrentTimeZoneInformation,
+ SystemLookasideInformation,
+ SystemTimeSlipNotification,
+ SystemSessionCreate,
+ SystemSessionDetach,
+ SystemSessionInformation,
+ SystemRangeStartInformation,
+ SystemVerifierInformation,
+ SystemVerifierThunkExtend,
+ SystemSessionProcessInformation,
+ SystemLoadGdiDriverInSystemSpace,
+ SystemNumaProcessorMap,
+ SystemPrefetcherInformation,
+ SystemExtendedProcessInformation,
+ SystemRecommendedSharedDataAlignment,
+ SystemComPlusPackage,
+ SystemNumaAvailableMemory,
+ SystemProcessorPowerInformation,
+ SystemEmulationBasicInformation,
+ SystemEmulationProcessorInformation,
+ SystemExtendedHandleInformation,
+ SystemLostDelayedWriteInformation
+} SYSTEM_INFORMATION_CLASS;
+
+typedef enum _EVENT_INFORMATION_CLASS {
+ EventBasicInformation
+ } EVENT_INFORMATION_CLASS;
+
+typedef struct _SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION {
+ LARGE_INTEGER IdleTime;
+ LARGE_INTEGER KernelTime;
+ LARGE_INTEGER UserTime;
+ LARGE_INTEGER DpcTime; // DEVL only
+ LARGE_INTEGER InterruptTime; // DEVL only
+ ULONG InterruptCount;
+} SYSTEM_PROCESSOR_PERFORMANCE_INFORMATION, *PSYSTEM_PROCESSOR_PERFORMANCE_INFORMATION;
+
+typedef enum _EVENT_TYPE {
+ NotificationEvent,
+ SynchronizationEvent
+ } EVENT_TYPE;
+
+typedef struct _EVENT_BASIC_INFORMATION {
+ EVENT_TYPE EventType;
+ LONG EventState;
+} EVENT_BASIC_INFORMATION, *PEVENT_BASIC_INFORMATION;
+
+#define RTL_MEG (1024UL * 1024UL)
+#define RTLP_IMAGE_MAX_DOS_HEADER ( 256UL * RTL_MEG)
+
+typedef struct _SYSTEM_KERNEL_DEBUGGER_INFORMATION {
+ BOOLEAN KernelDebuggerEnabled;
+ BOOLEAN KernelDebuggerNotPresent;
+} SYSTEM_KERNEL_DEBUGGER_INFORMATION, *PSYSTEM_KERNEL_DEBUGGER_INFORMATION;
+
+typedef struct _STRING {
+ USHORT Length;
+ USHORT MaximumLength;
+#ifdef MIDL_PASS
+ [size_is(MaximumLength), length_is(Length) ]
+#endif // MIDL_PASS
+ PCHAR Buffer;
+} STRING;
+typedef STRING *PSTRING;
+
+typedef STRING ANSI_STRING;
+typedef PSTRING PANSI_STRING;
+
+typedef STRING OEM_STRING;
+typedef PSTRING POEM_STRING;
+typedef CONST STRING* PCOEM_STRING;
+
+typedef struct _UNICODE_STRING {
+ USHORT Length;
+ USHORT MaximumLength;
+#ifdef MIDL_PASS
+ [size_is(MaximumLength / 2), length_is((Length) / 2) ] USHORT * Buffer;
+#else // MIDL_PASS
+ PWSTR Buffer;
+#endif // MIDL_PASS
+} UNICODE_STRING;
+typedef UNICODE_STRING *PUNICODE_STRING;
+typedef const UNICODE_STRING *PCUNICODE_STRING;
+#define UNICODE_NULL ((WCHAR)0) // winnt
+
+typedef struct _STRING32 {
+ USHORT Length;
+ USHORT MaximumLength;
+ ULONG Buffer;
+} STRING32;
+typedef STRING32 *PSTRING32;
+
+typedef STRING32 UNICODE_STRING32;
+typedef UNICODE_STRING32 *PUNICODE_STRING32;
+
+typedef STRING32 ANSI_STRING32;
+typedef ANSI_STRING32 *PANSI_STRING32;
+
+
+typedef struct _STRING64 {
+ USHORT Length;
+ USHORT MaximumLength;
+ ULONGLONG Buffer;
+} STRING64;
+typedef STRING64 *PSTRING64;
+
+typedef STRING64 UNICODE_STRING64;
+typedef UNICODE_STRING64 *PUNICODE_STRING64;
+
+typedef STRING64 ANSI_STRING64;
+typedef ANSI_STRING64 *PANSI_STRING64;
+
+#define GDI_HANDLE_BUFFER_SIZE32 34
+#define GDI_HANDLE_BUFFER_SIZE64 60
+
+#if !defined(_TARGET_AMD64_)
+#define GDI_HANDLE_BUFFER_SIZE GDI_HANDLE_BUFFER_SIZE32
+#else
+#define GDI_HANDLE_BUFFER_SIZE GDI_HANDLE_BUFFER_SIZE64
+#endif
+
+typedef ULONG GDI_HANDLE_BUFFER32[GDI_HANDLE_BUFFER_SIZE32];
+typedef ULONG GDI_HANDLE_BUFFER64[GDI_HANDLE_BUFFER_SIZE64];
+typedef ULONG GDI_HANDLE_BUFFER [GDI_HANDLE_BUFFER_SIZE ];
+
+
+typedef struct _PEB_LDR_DATA {
+ ULONG Length;
+ BOOLEAN Initialized;
+ HANDLE SsHandle;
+ LIST_ENTRY InLoadOrderModuleList;
+ LIST_ENTRY InMemoryOrderModuleList;
+ LIST_ENTRY InInitializationOrderModuleList;
+ PVOID EntryInProgress;
+} PEB_LDR_DATA, *PPEB_LDR_DATA;
+
+typedef struct _PEB_FREE_BLOCK {
+ struct _PEB_FREE_BLOCK *Next;
+ ULONG Size;
+} PEB_FREE_BLOCK, *PPEB_FREE_BLOCK;
+
+typedef PVOID* PPVOID;
+
+typedef
+VOID
+(*PPS_POST_PROCESS_INIT_ROUTINE) (
+ VOID
+ );
+
+typedef struct _LDR_DATA_TABLE_ENTRY {
+ LIST_ENTRY InLoadOrderLinks;
+ LIST_ENTRY InMemoryOrderLinks;
+ LIST_ENTRY InInitializationOrderLinks;
+ PVOID DllBase;
+ PVOID EntryPoint;
+ ULONG SizeOfImage;
+ UNICODE_STRING FullDllName;
+ UNICODE_STRING BaseDllName;
+ ULONG Flags;
+ USHORT LoadCount;
+ USHORT TlsIndex;
+ union _foo {
+ LIST_ENTRY HashLinks;
+ struct _bar {
+ PVOID SectionPointer;
+ ULONG CheckSum;
+ };
+ };
+ union _foo2 {
+ struct _bar2 {
+ ULONG TimeDateStamp;
+ };
+ struct _bar3 {
+ PVOID LoadedImports;
+ };
+ };
+ PVOID EntryPointActivationContext;
+} LDR_DATA_TABLE_ENTRY, *PLDR_DATA_TABLE_ENTRY;
+
+#define TYPE3(arg) arg
+
+typedef struct _PEB {
+ BOOLEAN InheritedAddressSpace; // These four fields cannot change unless the
+ BOOLEAN ReadImageFileExecOptions; //
+ BOOLEAN BeingDebugged; //
+ BOOLEAN SpareBool; //
+ HANDLE Mutant; // INITIAL_PEB structure is also updated.
+
+ PVOID ImageBaseAddress;
+ PPEB_LDR_DATA Ldr;
+ TYPE3(struct _RTL_USER_PROCESS_PARAMETERS*) ProcessParameters;
+ PVOID SubSystemData;
+ PVOID ProcessHeap;
+ TYPE3(struct _RTL_CRITICAL_SECTION*) FastPebLock;
+ PVOID FastPebLockRoutine;
+ PVOID FastPebUnlockRoutine;
+ ULONG EnvironmentUpdateCount;
+ PVOID KernelCallbackTable;
+ ULONG SystemReserved[1];
+
+ struct _foo {
+ ULONG ExecuteOptions : 2;
+ ULONG SpareBits : 30;
+ };
+
+
+ PPEB_FREE_BLOCK FreeList;
+ ULONG TlsExpansionCounter;
+ PVOID TlsBitmap;
+ ULONG TlsBitmapBits[2]; // TLS_MINIMUM_AVAILABLE bits
+ PVOID ReadOnlySharedMemoryBase;
+ PVOID ReadOnlySharedMemoryHeap;
+ PPVOID ReadOnlyStaticServerData;
+ PVOID AnsiCodePageData;
+ PVOID OemCodePageData;
+ PVOID UnicodeCaseTableData;
+
+ //
+ // Useful information for LdrpInitialize
+ ULONG NumberOfProcessors;
+ ULONG NtGlobalFlag;
+
+ //
+ // Passed up from MmCreatePeb from Session Manager registry key
+ //
+
+ LARGE_INTEGER CriticalSectionTimeout;
+ SIZE_T HeapSegmentReserve;
+ SIZE_T HeapSegmentCommit;
+ SIZE_T HeapDeCommitTotalFreeThreshold;
+ SIZE_T HeapDeCommitFreeBlockThreshold;
+
+ //
+ // Where heap manager keeps track of all heaps created for a process
+ // Fields initialized by MmCreatePeb. ProcessHeaps is initialized
+ // to point to the first free byte after the PEB and MaximumNumberOfHeaps
+ // is computed from the page size used to hold the PEB, less the fixed
+ // size of this data structure.
+ //
+
+ ULONG NumberOfHeaps;
+ ULONG MaximumNumberOfHeaps;
+ PPVOID ProcessHeaps;
+
+ //
+ //
+ PVOID GdiSharedHandleTable;
+ PVOID ProcessStarterHelper;
+ ULONG GdiDCAttributeList;
+ PVOID LoaderLock;
+
+ //
+ // Following fields filled in by MmCreatePeb from system values and/or
+ // image header.
+ //
+
+ ULONG OSMajorVersion;
+ ULONG OSMinorVersion;
+ USHORT OSBuildNumber;
+ USHORT OSCSDVersion;
+ ULONG OSPlatformId;
+ ULONG ImageSubsystem;
+ ULONG ImageSubsystemMajorVersion;
+ ULONG ImageSubsystemMinorVersion;
+ ULONG_PTR ImageProcessAffinityMask;
+ GDI_HANDLE_BUFFER GdiHandleBuffer;
+ PPS_POST_PROCESS_INIT_ROUTINE PostProcessInitRoutine;
+
+ PVOID TlsExpansionBitmap;
+ ULONG TlsExpansionBitmapBits[32]; // TLS_EXPANSION_SLOTS bits
+
+ //
+ // Id of the Hydra session in which this process is running
+ //
+ ULONG SessionId;
+
+ //
+ // Filled in by LdrpInstallAppcompatBackend
+ //
+ ULARGE_INTEGER AppCompatFlags;
+
+ //
+ // ntuser appcompat flags
+ //
+ ULARGE_INTEGER AppCompatFlagsUser;
+
+ //
+ // Filled in by LdrpInstallAppcompatBackend
+ //
+ PVOID pShimData;
+
+ //
+ // Filled in by LdrQueryImageFileExecutionOptions
+ //
+ PVOID AppCompatInfo;
+
+ //
+ // Used by GetVersionExW as the szCSDVersion string
+ //
+ UNICODE_STRING CSDVersion;
+
+ //
+ // Fusion stuff
+ //
+ PVOID ActivationContextData;
+ PVOID ProcessAssemblyStorageMap;
+ PVOID SystemDefaultActivationContextData;
+ PVOID SystemAssemblyStorageMap;
+
+ //
+ // Enforced minimum initial commit stack
+ //
+ SIZE_T MinimumStackCommit;
+
+} PEB, *PPEB;
+
+#define ACTIVATION_CONTEXT_STACK_FLAG_QUERIES_DISABLED (0x00000001)
+
+typedef struct _ACTIVATION_CONTEXT_STACK {
+ ULONG Flags;
+ ULONG NextCookieSequenceNumber;
+ PVOID ActiveFrame;
+ LIST_ENTRY FrameListCache;
+
+#if NT_SXS_PERF_COUNTERS_ENABLED
+ struct _ACTIVATION_CONTEXT_STACK_PERF_COUNTERS {
+ ULONGLONG Activations;
+ ULONGLONG ActivationCycles;
+ ULONGLONG Deactivations;
+ ULONGLONG DeactivationCycles;
+ } Counters;
+#endif // NT_SXS_PERF_COUNTERS_ENABLED
+} ACTIVATION_CONTEXT_STACK, *PACTIVATION_CONTEXT_STACK;
+
+typedef const ACTIVATION_CONTEXT_STACK *PCACTIVATION_CONTEXT_STACK;
+
+#define TEB_ACTIVE_FRAME_CONTEXT_FLAG_EXTENDED (0x00000001)
+
+typedef struct _TEB_ACTIVE_FRAME_CONTEXT {
+ ULONG Flags;
+ PCSTR FrameName;
+} TEB_ACTIVE_FRAME_CONTEXT, *PTEB_ACTIVE_FRAME_CONTEXT;
+
+typedef const struct _TEB_ACTIVE_FRAME_CONTEXT *PCTEB_ACTIVE_FRAME_CONTEXT;
+
+typedef struct _TEB_ACTIVE_FRAME_CONTEXT_EX {
+ TEB_ACTIVE_FRAME_CONTEXT BasicContext;
+ PCSTR SourceLocation; // e.g. "Z:\foo\bar\baz.c"
+} TEB_ACTIVE_FRAME_CONTEXT_EX, *PTEB_ACTIVE_FRAME_CONTEXT_EX;
+
+typedef const struct _TEB_ACTIVE_FRAME_CONTEXT_EX *PCTEB_ACTIVE_FRAME_CONTEXT_EX;
+
+#define TEB_ACTIVE_FRAME_FLAG_EXTENDED (0x00000001)
+
+typedef struct _TEB_ACTIVE_FRAME {
+ ULONG Flags;
+ TYPE3(struct _TEB_ACTIVE_FRAME*) Previous;
+ PCTEB_ACTIVE_FRAME_CONTEXT Context;
+} TEB_ACTIVE_FRAME, *PTEB_ACTIVE_FRAME;
+
+typedef const struct _TEB_ACTIVE_FRAME *PCTEB_ACTIVE_FRAME;
+
+typedef struct _TEB_ACTIVE_FRAME_EX {
+ TEB_ACTIVE_FRAME BasicFrame;
+ PVOID ExtensionIdentifier; // use address of your DLL Main or something unique to your mapping in the address space
+} TEB_ACTIVE_FRAME_EX, *PTEB_ACTIVE_FRAME_EX;
+
+typedef const struct _TEB_ACTIVE_FRAME_EX *PCTEB_ACTIVE_FRAME_EX;
+
+typedef struct _CLIENT_ID {
+ HANDLE UniqueProcess;
+ HANDLE UniqueThread;
+} CLIENT_ID;
+typedef CLIENT_ID *PCLIENT_ID;
+
+#define GDI_BATCH_BUFFER_SIZE 310
+
+typedef struct _GDI_TEB_BATCH {
+ ULONG Offset;
+ ULONG_PTR HDC;
+ ULONG Buffer[GDI_BATCH_BUFFER_SIZE];
+} GDI_TEB_BATCH,*PGDI_TEB_BATCH;
+
+typedef struct _Wx86ThreadState {
+ PULONG CallBx86Eip;
+ PVOID DeallocationCpu;
+ BOOLEAN UseKnownWx86Dll;
+ char OleStubInvoked;
+} WX86THREAD, *PWX86THREAD;
+
+#define STATIC_UNICODE_BUFFER_LENGTH 261
+#define WIN32_CLIENT_INFO_LENGTH 62
+
+typedef struct _PEB* PPEB;
+
+typedef struct _TEB {
+ NT_TIB NtTib;
+ PVOID EnvironmentPointer;
+ CLIENT_ID ClientId;
+ PVOID ActiveRpcHandle;
+ PVOID ThreadLocalStoragePointer;
+#if defined(PEBTEB_BITS)
+ PVOID ProcessEnvironmentBlock;
+#else
+ PPEB ProcessEnvironmentBlock;
+#endif
+ ULONG LastErrorValue;
+ ULONG CountOfOwnedCriticalSections;
+ PVOID CsrClientThread;
+ PVOID Win32ThreadInfo; // PtiCurrent
+ ULONG User32Reserved[26]; // user32.dll items
+ ULONG UserReserved[5]; // Winsrv SwitchStack
+ PVOID WOW32Reserved; // used by WOW
+ LCID CurrentLocale;
+ ULONG FpSoftwareStatusRegister; // offset known by outsiders!
+ PVOID SystemReserved1[54]; // Used by FP emulator
+ NTSTATUS ExceptionCode; // for RaiseUserException
+ ACTIVATION_CONTEXT_STACK ActivationContextStack; // Fusion activation stack
+ // sizeof(PVOID) is a way to express processor-dependence, more generally than #ifdef _WIN64
+ UCHAR SpareBytes1[48 - sizeof(PVOID) - sizeof(ACTIVATION_CONTEXT_STACK)];
+ GDI_TEB_BATCH GdiTebBatch; // Gdi batching
+ CLIENT_ID RealClientId;
+ HANDLE GdiCachedProcessHandle;
+ ULONG GdiClientPID;
+ ULONG GdiClientTID;
+ PVOID GdiThreadLocalInfo;
+ ULONG_PTR Win32ClientInfo[WIN32_CLIENT_INFO_LENGTH]; // User32 Client Info
+ PVOID glDispatchTable[233]; // OpenGL
+ ULONG_PTR glReserved1[29]; // OpenGL
+ PVOID glReserved2; // OpenGL
+ PVOID glSectionInfo; // OpenGL
+ PVOID glSection; // OpenGL
+ PVOID glTable; // OpenGL
+ PVOID glCurrentRC; // OpenGL
+ PVOID glContext; // OpenGL
+ ULONG LastStatusValue;
+ UNICODE_STRING StaticUnicodeString;
+ WCHAR StaticUnicodeBuffer[STATIC_UNICODE_BUFFER_LENGTH];
+ PVOID DeallocationStack;
+ PVOID TlsSlots[TLS_MINIMUM_AVAILABLE];
+ LIST_ENTRY TlsLinks;
+ PVOID Vdm;
+ PVOID ReservedForNtRpc;
+ PVOID DbgSsReserved[2];
+ ULONG HardErrorsAreDisabled;
+ PVOID Instrumentation[16];
+ PVOID WinSockData; // WinSock
+ ULONG GdiBatchCount;
+ BOOLEAN InDbgPrint;
+ BOOLEAN FreeStackOnTermination;
+ BOOLEAN HasFiberData;
+ BOOLEAN IdealProcessor;
+ ULONG Spare3;
+ PVOID ReservedForPerf;
+ PVOID ReservedForOle;
+ ULONG WaitingOnLoaderLock;
+ WX86THREAD Wx86Thread;
+ PPVOID TlsExpansionSlots;
+ LCID ImpersonationLocale; // Current locale of impersonated user
+ ULONG IsImpersonating; // Thread impersonation status
+ PVOID NlsCache; // NLS thread cache
+ PVOID pShimData; // Per thread data used in the shim
+ ULONG HeapVirtualAffinity;
+ HANDLE CurrentTransactionHandle;// reserved for TxF transaction context
+ PTEB_ACTIVE_FRAME ActiveFrame;
+} TEB;
+typedef TEB *PTEB;
+
+typedef struct _CURDIR {
+ UNICODE_STRING DosPath;
+ HANDLE Handle;
+} CURDIR, *PCURDIR;
+
+#define RTL_USER_PROC_CURDIR_CLOSE 0x00000002
+#define RTL_USER_PROC_CURDIR_INHERIT 0x00000003
+
+typedef struct _RTL_DRIVE_LETTER_CURDIR {
+ USHORT Flags;
+ USHORT Length;
+ ULONG TimeStamp;
+ STRING DosPath;
+} RTL_DRIVE_LETTER_CURDIR, *PRTL_DRIVE_LETTER_CURDIR;
+
+
+#define RTL_MAX_DRIVE_LETTERS 32
+#define RTL_DRIVE_LETTER_VALID (USHORT)0x0001
+
+typedef struct _RTL_USER_PROCESS_PARAMETERS {
+ ULONG MaximumLength;
+ ULONG Length;
+
+ ULONG Flags;
+ ULONG DebugFlags;
+
+ HANDLE ConsoleHandle;
+ ULONG ConsoleFlags;
+ HANDLE StandardInput;
+ HANDLE StandardOutput;
+ HANDLE StandardError;
+
+ CURDIR CurrentDirectory; // ProcessParameters
+ UNICODE_STRING DllPath; // ProcessParameters
+ UNICODE_STRING ImagePathName; // ProcessParameters
+ UNICODE_STRING CommandLine; // ProcessParameters
+ PVOID Environment; // NtAllocateVirtualMemory
+
+ ULONG StartingX;
+ ULONG StartingY;
+ ULONG CountX;
+ ULONG CountY;
+ ULONG CountCharsX;
+ ULONG CountCharsY;
+ ULONG FillAttribute;
+
+ ULONG WindowFlags;
+ ULONG ShowWindowFlags;
+ UNICODE_STRING WindowTitle; // ProcessParameters
+ UNICODE_STRING DesktopInfo; // ProcessParameters
+ UNICODE_STRING ShellInfo; // ProcessParameters
+ UNICODE_STRING RuntimeData; // ProcessParameters
+ RTL_DRIVE_LETTER_CURDIR CurrentDirectores[ RTL_MAX_DRIVE_LETTERS ];
+} RTL_USER_PROCESS_PARAMETERS, *PRTL_USER_PROCESS_PARAMETERS;
+
+
+typedef enum _PROCESSINFOCLASS {
+ ProcessBasicInformation,
+ ProcessQuotaLimits,
+ ProcessIoCounters,
+ ProcessVmCounters,
+ ProcessTimes,
+ ProcessBasePriority,
+ ProcessRaisePriority,
+ ProcessDebugPort,
+ ProcessExceptionPort,
+ ProcessAccessToken,
+ ProcessLdtInformation,
+ ProcessLdtSize,
+ ProcessDefaultHardErrorMode,
+ ProcessIoPortHandlers, // Note: this is kernel mode only
+ ProcessPooledUsageAndLimits,
+ ProcessWorkingSetWatch,
+ ProcessUserModeIOPL,
+ ProcessEnableAlignmentFaultFixup,
+ ProcessPriorityClass,
+ ProcessWx86Information,
+ ProcessHandleCount,
+ ProcessAffinityMask,
+ ProcessPriorityBoost,
+ ProcessDeviceMap,
+ ProcessSessionInformation,
+ ProcessForegroundInformation,
+ ProcessWow64Information,
+ ProcessImageFileName,
+ ProcessLUIDDeviceMapsEnabled,
+ ProcessBreakOnTermination,
+ ProcessDebugObjectHandle,
+ ProcessDebugFlags,
+ ProcessHandleTracing,
+ MaxProcessInfoClass // MaxProcessInfoClass should always be the last enum
+ } PROCESSINFOCLASS;
+
+
+typedef struct _VM_COUNTERS {
+ SIZE_T PeakVirtualSize;
+ SIZE_T VirtualSize;
+ ULONG PageFaultCount;
+ SIZE_T PeakWorkingSetSize;
+ SIZE_T WorkingSetSize;
+ SIZE_T QuotaPeakPagedPoolUsage;
+ SIZE_T QuotaPagedPoolUsage;
+ SIZE_T QuotaPeakNonPagedPoolUsage;
+ SIZE_T QuotaNonPagedPoolUsage;
+ SIZE_T PagefileUsage;
+ SIZE_T PeakPagefileUsage;
+} VM_COUNTERS;
+typedef VM_COUNTERS *PVM_COUNTERS;
+
+#undef TYPE3
+
+#endif // !defined(FEATURE_PAL)
+
+#if !defined(_TARGET_X86_)
+
+typedef enum _FUNCTION_TABLE_TYPE {
+ RF_SORTED,
+ RF_UNSORTED,
+ RF_CALLBACK
+} FUNCTION_TABLE_TYPE;
+
+typedef struct _DYNAMIC_FUNCTION_TABLE {
+ LIST_ENTRY Links;
+ PT_RUNTIME_FUNCTION FunctionTable;
+ LARGE_INTEGER TimeStamp;
+
+#ifdef _TARGET_ARM_
+ ULONG MinimumAddress;
+ ULONG MaximumAddress;
+ ULONG BaseAddress;
+#else
+ ULONG64 MinimumAddress;
+ ULONG64 MaximumAddress;
+ ULONG64 BaseAddress;
+#endif
+
+ PGET_RUNTIME_FUNCTION_CALLBACK Callback;
+ PVOID Context;
+ PWSTR OutOfProcessCallbackDll;
+ FUNCTION_TABLE_TYPE Type;
+ ULONG EntryCount;
+} DYNAMIC_FUNCTION_TABLE, *PDYNAMIC_FUNCTION_TABLE;
+
+#endif // !_TARGET_X86_
+
+//
+// AMD64
+//
+#ifdef _TARGET_AMD64_
+
+#define RUNTIME_FUNCTION__BeginAddress(prf) (prf)->BeginAddress
+#define RUNTIME_FUNCTION__SetBeginAddress(prf,address) ((prf)->BeginAddress = (address))
+
+#define RUNTIME_FUNCTION__EndAddress(prf, ImageBase) (prf)->EndAddress
+
+#define RUNTIME_FUNCTION__GetUnwindInfoAddress(prf) (prf)->UnwindData
+#define RUNTIME_FUNCTION__SetUnwindInfoAddress(prf,address) do { (prf)->UnwindData = (address); } while (0)
+#define OFFSETOF__RUNTIME_FUNCTION__UnwindInfoAddress offsetof(T_RUNTIME_FUNCTION, UnwindData)
+
+#include "win64unwind.h"
+
+typedef
+PEXCEPTION_ROUTINE
+(RtlVirtualUnwindFn) (
+ IN ULONG HandlerType,
+ IN ULONG64 ImageBase,
+ IN ULONG64 ControlPc,
+ IN PT_RUNTIME_FUNCTION FunctionEntry,
+ IN OUT PCONTEXT ContextRecord,
+ OUT PVOID *HandlerData,
+ OUT PULONG64 EstablisherFrame,
+ IN OUT PKNONVOLATILE_CONTEXT_POINTERS ContextPointers OPTIONAL
+ );
+
+#ifndef FEATURE_PAL
+extern RtlVirtualUnwindFn* RtlVirtualUnwind_Unsafe;
+#else // !FEATURE_PAL
+PEXCEPTION_ROUTINE
+RtlVirtualUnwind_Unsafe(
+ IN ULONG HandlerType,
+ IN ULONG64 ImageBase,
+ IN ULONG64 ControlPc,
+ IN PT_RUNTIME_FUNCTION FunctionEntry,
+ IN OUT PCONTEXT ContextRecord,
+ OUT PVOID *HandlerData,
+ OUT PULONG64 EstablisherFrame,
+ IN OUT PKNONVOLATILE_CONTEXT_POINTERS ContextPointers OPTIONAL
+ );
+#endif // !FEATURE_PAL
+
+#endif // _TARGET_AMD64_
+
+//
+// X86
+//
+
+#if defined(_TARGET_X86_)
+
+#pragma warning(push)
+#pragma warning (disable:4035) // disable 4035 (function must return something)
+#define PcTeb 0x18
+#pragma warning(pop)
+
+typedef struct _DISPATCHER_CONTEXT {
+ _EXCEPTION_REGISTRATION_RECORD* RegistrationPointer;
+} DISPATCHER_CONTEXT, *PDISPATCHER_CONTEXT;
+
+#endif // _TARGET_X86_
+
+#ifdef _TARGET_ARM_
+#include "daccess.h"
+
+//
+// Define unwind information flags.
+//
+
+#define UNW_FLAG_NHANDLER 0x0 /* any handler */
+#define UNW_FLAG_EHANDLER 0x1 /* filter handler */
+#define UNW_FLAG_UHANDLER 0x2 /* unwind handler */
+
+// This function returns the length of a function using the new unwind info on arm.
+// Taken from minkernel\ntos\rtl\arm\ntrtlarm.h.
+FORCEINLINE
+ULONG
+RtlpGetFunctionEndAddress (
+ __in PT_RUNTIME_FUNCTION FunctionEntry,
+ __in ULONG ImageBase
+ )
+{
+ ULONG FunctionLength;
+
+ FunctionLength = FunctionEntry->UnwindData;
+ if ((FunctionLength & 3) != 0) {
+ FunctionLength = (FunctionLength >> 2) & 0x7ff;
+ } else {
+ FunctionLength = *(PTR_ULONG)(ImageBase + FunctionLength) & 0x3ffff;
+ }
+
+ return FunctionEntry->BeginAddress + 2 * FunctionLength;
+}
+
+#define RUNTIME_FUNCTION__BeginAddress(FunctionEntry) ThumbCodeToDataPointer<DWORD,DWORD>((FunctionEntry)->BeginAddress)
+#define RUNTIME_FUNCTION__SetBeginAddress(FunctionEntry,address) ((FunctionEntry)->BeginAddress = DataPointerToThumbCode<DWORD,DWORD>(address))
+
+#define RUNTIME_FUNCTION__EndAddress(FunctionEntry, ImageBase) ThumbCodeToDataPointer<DWORD,DWORD>(RtlpGetFunctionEndAddress(FunctionEntry, ImageBase))
+
+#define RUNTIME_FUNCTION__SetUnwindInfoAddress(prf,address) do { (prf)->UnwindData = (address); } while (0)
+
+typedef struct _UNWIND_INFO {
+ // dummy
+} UNWIND_INFO, *PUNWIND_INFO;
+
+EXTERN_C
+NTSYSAPI
+VOID
+NTAPI
+RtlUnwindEx (
+ __in_opt PVOID TargetFrame,
+ __in_opt PVOID TargetIp,
+ __in_opt PEXCEPTION_RECORD ExceptionRecord,
+ __in PVOID ReturnValue,
+ __in PT_CONTEXT ContextRecord,
+ __in_opt PUNWIND_HISTORY_TABLE HistoryTable
+ );
+
+EXTERN_C
+NTSYSAPI
+PEXCEPTION_ROUTINE
+NTAPI
+RtlVirtualUnwind (
+ __in DWORD HandlerType,
+ __in DWORD ImageBase,
+ __in DWORD ControlPc,
+ __in PRUNTIME_FUNCTION FunctionEntry,
+ __inout PT_CONTEXT ContextRecord,
+ __out PVOID *HandlerData,
+ __out PDWORD EstablisherFrame,
+ __inout_opt PT_KNONVOLATILE_CONTEXT_POINTERS ContextPointers
+ );
+
+#define UNW_FLAG_NHANDLER 0x0
+
+#endif // _TARGET_ARM_
+
+#ifdef _TARGET_ARM64_
+#include "daccess.h"
+
+#define UNW_FLAG_NHANDLER 0x0 /* any handler */
+#define UNW_FLAG_EHANDLER 0x1 /* filter handler */
+#define UNW_FLAG_UHANDLER 0x2 /* unwind handler */
+
+// This function returns the RVA of the end of the function (exclusive, so one byte after the actual end)
+// using the unwind info on ARM64. (see ExternalAPIs\Win9CoreSystem\inc\winnt.h)
+FORCEINLINE
+ULONG64
+RtlpGetFunctionEndAddress (
+ __in PT_RUNTIME_FUNCTION FunctionEntry,
+ __in ULONG64 ImageBase
+ )
+{
+ ULONG64 FunctionLength;
+
+ FunctionLength = FunctionEntry->UnwindData;
+ if ((FunctionLength & 3) != 0) {
+ FunctionLength = (FunctionLength >> 2) & 0x7ff;
+ } else {
+ FunctionLength = *(PTR_ULONG64)(ImageBase + FunctionLength) & 0x3ffff;
+ }
+
+ return FunctionEntry->BeginAddress + 4 * FunctionLength;
+}
+
+#define RUNTIME_FUNCTION__BeginAddress(FunctionEntry) ((FunctionEntry)->BeginAddress)
+#define RUNTIME_FUNCTION__SetBeginAddress(FunctionEntry,address) ((FunctionEntry)->BeginAddress = (address))
+
+#define RUNTIME_FUNCTION__EndAddress(FunctionEntry, ImageBase) (RtlpGetFunctionEndAddress(FunctionEntry, (ULONG64)(ImageBase)))
+
+#define RUNTIME_FUNCTION__SetUnwindInfoAddress(prf,address) do { (prf)->UnwindData = (address); } while (0)
+
+typedef struct _UNWIND_INFO {
+ // dummy
+} UNWIND_INFO, *PUNWIND_INFO;
+
+EXTERN_C
+NTSYSAPI
+PEXCEPTION_ROUTINE
+NTAPI
+RtlVirtualUnwind(
+ IN ULONG HandlerType,
+ IN ULONG64 ImageBase,
+ IN ULONG64 ControlPc,
+ IN PRUNTIME_FUNCTION FunctionEntry,
+ IN OUT PCONTEXT ContextRecord,
+ OUT PVOID *HandlerData,
+ OUT PULONG64 EstablisherFrame,
+ IN OUT PKNONVOLATILE_CONTEXT_POINTERS ContextPointers OPTIONAL
+ );
+
+#ifndef IMAGE_FILE_MACHINE_ARM64
+#define IMAGE_FILE_MACHINE_ARM64 0xAA64 // ARM64 Little-Endian
+#endif
+
+#ifndef IMAGE_REL_ARM64_BRANCH26
+#define IMAGE_REL_ARM64_BRANCH26 0x0003 // 26 bit offset << 2 & sign ext. for B & BL
+#endif
+
+#ifndef IMAGE_REL_ARM64_PAGEBASE_REL21
+#define IMAGE_REL_ARM64_PAGEBASE_REL21 0x0004 // ADRP 21 bit PC-relative page address
+#endif
+
+#ifndef IMAGE_REL_ARM64_PAGEOFFSET_12A
+#define IMAGE_REL_ARM64_PAGEOFFSET_12A 0x0006 // ADD 12 bit page offset
+#endif
+
+#endif
+
+#endif // CLRNT_H_
diff --git a/src/inc/clrprivappxhosting.idl b/src/inc/clrprivappxhosting.idl
new file mode 100644
index 0000000000..04a4cf9407
--- /dev/null
+++ b/src/inc/clrprivappxhosting.idl
@@ -0,0 +1,66 @@
+// 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.
+
+import "unknwn.idl";
+
+// Forward declarations
+interface ICLRPrivAppXDomain;
+interface ICLRPrivAppXRuntime;
+
+/**************************************************************************************
+ ** ICLRPrivAppXRuntime
+ **************************************************************************************/
+[
+ uuid(6D2DF5A4-FA3A-4481-8BA0-0422FD21720F),
+ version(1.0),
+ local
+]
+interface ICLRPrivAppXRuntime : IUnknown
+{
+ /**********************************************************************************
+ ** Use to create and initialize the AppX domain. Should only be called once; all
+ ** subsequent calls will fail. Thread safe.
+ **
+ ** wzFriendlyName - the domain friendly name.
+ **********************************************************************************/
+ HRESULT InitializeAppXDomain(
+ [in] LPCWSTR wzFriendlyName);
+
+ /**********************************************************************************
+ ** Use to retrieve the AppX domain. InitializeAppXDomain must have been
+ ** successfully called previously. May be called multiple times. Thread safe.
+ **
+ ** riidDomain - the IID of the interface to be returned in ppvDomain.
+ ** ppIAppXDomain - receives the ICLRPrivAppXDomain interface.
+ **********************************************************************************/
+ HRESULT GetAppXDomain(
+ [in] REFIID riidDomain,
+ [out] LPVOID * ppvDomain);
+}
+
+/**************************************************************************************
+ ** ICLRPrivAppXDomain
+ **************************************************************************************/
+[
+ uuid(6633398E-823D-4361-B30E-824043BD4686),
+ version(1.0),
+ local
+]
+interface ICLRPrivAppXDomain : IUnknown
+{
+ /**********************************************************************************
+ ** Use to create a delegate to a static method.
+ **
+ ** wzAssemblyName - the name of the assembly that contains the target type.
+ ** wzTypeName - the name of the type that contains the target method.
+ ** wzMethodName - the static method for which to create a delegate.
+ ** ppvDelegate - receives the native-callable function pointer corresponding to
+ ** the specified static method.
+ **********************************************************************************/
+ HRESULT CreateDelegate(
+ [in] LPCWSTR wzAssemblyName,
+ [in] LPCWSTR wzTypeName,
+ [in] LPCWSTR wzMethodName,
+ [out] LPVOID * ppvDelegate);
+};
diff --git a/src/inc/clrprivbinderutil.h b/src/inc/clrprivbinderutil.h
new file mode 100644
index 0000000000..129e90388e
--- /dev/null
+++ b/src/inc/clrprivbinderutil.h
@@ -0,0 +1,872 @@
+// 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.
+//
+
+//
+// Contains helper types for assembly binding host infrastructure.
+
+#ifndef __CLRPRIVBINDERUTIL_H__
+#define __CLRPRIVBINDERUTIL_H__
+
+#include "holder.h"
+#include "internalunknownimpl.h"
+#ifdef FEATURE_FUSION
+#include "fusion.h"
+#endif
+#include "clrprivbinding.h"
+#include "slist.h"
+#ifdef FEATURE_COMINTEROP
+#include "windowsstring.h"
+#endif // FEATURE_COMINTEROP
+#include "strongnameholders.h"
+
+//=====================================================================================================================
+#define STANDARD_BIND_CONTRACT \
+ CONTRACTL { \
+ NOTHROW; \
+ GC_TRIGGERS; \
+ MODE_PREEMPTIVE; \
+ } CONTRACTL_END
+
+//=====================================================================================================================
+// Forward declarations
+interface ICLRPrivAssembly;
+typedef DPTR(ICLRPrivAssembly) PTR_ICLRPrivAssembly;
+typedef DPTR(ICLRPrivBinder) PTR_ICLRPrivBinder;
+class PEAssembly;
+class AssemblySpec;
+
+//=====================================================================================================================
+#define VALIDATE_CONDITION(condition, fail_op) \
+ do { \
+ _ASSERTE((condition)); \
+ if (!(condition)) \
+ fail_op; \
+ } while (false)
+
+#define VALIDATE_PTR_RET(val) VALIDATE_CONDITION(val != nullptr, return E_POINTER)
+#define VALIDATE_PTR_THROW(val) VALIDATE_CONDITION(val != nullptr, ThrowHR(E_POINTER))
+#define VALIDATE_ARG_RET(condition) VALIDATE_CONDITION(condition, return E_INVALIDARG)
+#define VALIDATE_ARG_THROW(condition) VALIDATE_CONDITION(condition, ThrowHR(E_INVALIDARG))
+
+//=====================================================================================================================
+namespace CLRPrivBinderUtil
+{
+ //=================================================================================================================
+ enum BindFlags
+ {
+ BF_BindIL = 1,
+ BF_BindNI = 2,
+ BF_Default = BF_BindIL | BF_BindNI,
+ };
+
+ //=================================================================================================================
+ template <typename ItfT, typename ObjT>
+ inline ItfT * ToInterface(
+ ObjT * && pObj)
+ {
+ STATIC_CONTRACT_THROWS;
+
+ ItfT * pItf = nullptr;
+ IfFailThrow(pObj->QueryInterface(__uuidof(ItfT), (void **)&pItf));
+ return pItf;
+ }
+
+ //=================================================================================================================
+ template <typename ItfT, typename ObjT>
+ inline ItfT * ToInterface_NoThrow(
+ ObjT * && pObj)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ ItfT * pItf = nullptr;
+ if (FAILED(pObj->QueryInterface(__uuidof(ItfT), (void **)&pItf)))
+ {
+ return nullptr;
+ }
+ return pItf;
+ }
+
+ //=====================================================================================================================
+#ifdef FEATURE_FUSION
+ class CLRPrivAssemblyBindResultWrapper :
+ public IUnknownCommon<
+ IBindResult,
+ IAssemblyLocation>
+ {
+ public:
+ //-----------------------------------------------------------------------------------------------------------------
+ CLRPrivAssemblyBindResultWrapper(
+ IAssemblyName *pIAssemblyName,
+ PCWSTR wzAssemblyPath,
+ IILFingerprintFactory *pILFingerprintFactory
+ );
+
+ //-----------------------------------------------------------------------------------------------------------------
+ ~CLRPrivAssemblyBindResultWrapper();
+
+ protected:
+ //=================================================================================================================
+ // IBindResult methods
+
+ //-----------------------------------------------------------------------------------------------------------------
+ STDMETHOD(GetAssemblyNameDef)(
+ /*out*/ IAssemblyName **ppIAssemblyNameDef);
+
+ //-----------------------------------------------------------------------------------------------------------------
+ STDMETHOD(GetNextAssemblyModuleName)(
+ /*in*/ DWORD dwNIndex,
+ __inout_ecount(*pdwCCModuleName) LPWSTR pwzModuleName,
+ /*in, out, annotation("__inout")*/ LPDWORD pdwCCModuleName);
+
+ //-----------------------------------------------------------------------------------------------------------------
+ STDMETHOD(GetAssemblyLocation)(
+ /*out*/ IAssemblyLocation **ppIAssemblyLocation);
+
+ //-----------------------------------------------------------------------------------------------------------------
+ STDMETHOD(GetNativeImage)(
+ /*out*/ IBindResult **ppIBindResultNI,
+ /*out*/ BOOL *pfIBindResultNIProbed);
+
+ //-----------------------------------------------------------------------------------------------------------------
+ STDMETHOD(SetNativeImage)(
+ /*in*/ IBindResult *pIBindResultNI,
+ /*out*/ IBindResult **ppIBindResultNIFinal);
+
+ //-----------------------------------------------------------------------------------------------------------------
+ STDMETHOD(IsEqual)(
+ /*in*/ IUnknown *pIUnk);
+
+ //-----------------------------------------------------------------------------------------------------------------
+ STDMETHOD(GetNextAssemblyNameRef)(
+ /*in*/ DWORD dwNIndex,
+ /*out*/ IAssemblyName **ppIAssemblyNameRef);
+
+ //-----------------------------------------------------------------------------------------------------------------
+ STDMETHOD(GetNextDependentAssembly)(
+ /*in*/ DWORD dwNIndex,
+ /*out*/ IUnknown **ppIUnknownAssembly);
+
+ //-----------------------------------------------------------------------------------------------------------------
+ STDMETHOD(GetAssemblyLocationOfILImage)(
+ /*out*/ IAssemblyLocation **ppAssemblyLocation);
+
+ //-----------------------------------------------------------------------------------------------------------------
+ STDMETHOD(GetILFingerprint)(
+ /*out*/ IILFingerprint **ppFingerprint);
+
+ //-----------------------------------------------------------------------------------------------------------------
+ STDMETHOD(GetSourceILTimestamp)(
+ /*out*/ FILETIME* pFileTime);
+
+ //-----------------------------------------------------------------------------------------------------------------
+ STDMETHOD(GetSourceILSize)(
+ /*out*/ DWORD* pSize);
+
+ //-----------------------------------------------------------------------------------------------------------------
+ STDMETHOD(GetNIInfo)(
+ /*out*/ INativeImageInstallInfo** pInfo);
+
+ //-----------------------------------------------------------------------------------------------------------------
+ STDMETHOD(GetFlags)(
+ /*out*/ DWORD * pdwFlags);
+
+ //=================================================================================================================
+ // IAssemblyLocation methods
+
+ //-----------------------------------------------------------------------------------------------------------------
+ STDMETHOD(GetLocationType)(
+ /*out*/DWORD *pdwLocationType);
+
+ //-----------------------------------------------------------------------------------------------------------------
+ STDMETHOD(GetPath)(
+ __inout_ecount(*pdwccAssemblyPath) LPWSTR pwzAssemblyPath,
+ /*in, annotation("__inout")*/ LPDWORD pdwccAssemblyPath);
+
+ //-----------------------------------------------------------------------------------------------------------------
+ STDMETHOD(GetHostID)(
+ /*out*/ UINT64 *puiHostID);
+
+ private:
+ inline PCWSTR GetILAssemblyPath()
+ { LIMITED_METHOD_CONTRACT; return m_wzAssemblyPath; }
+
+ NewArrayHolder<WCHAR> m_wzAssemblyPath;
+ IAssemblyName * m_pIAssemblyName;
+
+ // Since m_bIBindResultNISet and m_pIBindResultNI are separate data, they both need
+ // to be treated as volatile, making sure to always fetch m_bIBindResultNISet first
+ // and only read m_pIBindResultNI if m_bIBindResultNISet is true.
+ Volatile<bool> m_bIBindResultNISet;
+ VolatilePtr<IBindResult> m_pIBindResultNI;
+
+ IILFingerprint * m_pIILFingerprint;
+ ReleaseHolder<IILFingerprintFactory> m_pILFingerprintFactory;
+
+ // Used as a leaf lock for publishing, such as m_pIBindResultNI.
+ Crst m_lock;
+ }; // class CLRPrivAssemblyBindResultWrapper
+#endif // FEATURE_FUSION
+
+ //=================================================================================================================
+ // Used to create an identity-only ICLRPrivAssembly from an ICLRPrivBinder. This is currently used when
+ // creating dynamic assemblies as these use the parent assembly's ICLRPrivBinder object to provide binding
+ // functionaltiy.
+
+ class CLRPrivBinderAsAssemblyWrapper :
+ public IUnknownCommon<ICLRPrivAssembly>
+ {
+ public:
+ //-----------------------------------------------------------------------------------------------------------------
+ CLRPrivBinderAsAssemblyWrapper(
+ ICLRPrivBinder *pWrapped)
+ : _pWrapped(clr::SafeAddRef(pWrapped))
+ {
+ STANDARD_VM_CONTRACT;
+ VALIDATE_ARG_THROW(pWrapped);
+ }
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // Forwards to wrapped binder.
+ STDMETHOD(BindAssemblyByName)(
+ IAssemblyName * pAssemblyName,
+ ICLRPrivAssembly ** ppAssembly)
+ {
+ WRAPPER_NO_CONTRACT;
+ return _pWrapped->BindAssemblyByName(pAssemblyName, ppAssembly);
+ }
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // Forwards to wrapped binder.
+ STDMETHOD(VerifyBind)(
+ IAssemblyName *pAssemblyName,
+ ICLRPrivAssembly *pAssembly,
+ ICLRPrivAssemblyInfo *pAssemblyInfo)
+ {
+ WRAPPER_NO_CONTRACT;
+ return _pWrapped->VerifyBind(pAssemblyName, pAssembly, pAssemblyInfo);
+ }
+
+ //---------------------------------------------------------------------------------------------
+ // Forwards to wrapped binder.
+ STDMETHOD(GetBinderFlags)(
+ DWORD *pBinderFlags)
+ {
+ WRAPPER_NO_CONTRACT;
+ return _pWrapped->GetBinderFlags(pBinderFlags);
+ }
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // Forwards to wrapped binder.
+ STDMETHOD(GetBinderID)(
+ UINT_PTR *pBinderId)
+ {
+ WRAPPER_NO_CONTRACT;
+ return _pWrapped->GetBinderID(pBinderId);
+ }
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // Forwards to wrapped binder.
+ STDMETHOD(FindAssemblyBySpec)(
+ LPVOID pvAppDomain,
+ LPVOID pvAssemblySpec,
+ HRESULT * pResult,
+ ICLRPrivAssembly ** ppAssembly)
+ { STATIC_CONTRACT_WRAPPER; return _pWrapped->FindAssemblyBySpec(pvAppDomain, pvAssemblySpec, pResult, ppAssembly); }
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // ICLRPrivAssembly method is unsupported.
+ STDMETHOD(IsShareable)(
+ BOOL * pbIsShareable)
+ {
+ LIMITED_METHOD_CONTRACT;
+ _ASSERTE_MSG(false, "CLRPrivBinderAsAssemblyWrapper does not support ICLRPrivAssembly methods (just ICLRPrivBinder ones)!");
+ VALIDATE_ARG_RET(pbIsShareable);
+ *pbIsShareable = FALSE;
+ return HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED);
+ }
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // ICLRPrivAssembly method is unsupported.
+ STDMETHOD(GetAvailableImageTypes)(
+ LPDWORD pdwImageTypes)
+ {
+ LIMITED_METHOD_CONTRACT;
+ _ASSERTE_MSG(false, "CLRPrivBinderAsAssemblyWrapper does not support ICLRPrivAssembly methods (just ICLRPrivBinder ones)!");
+ VALIDATE_ARG_RET(pdwImageTypes);
+ *pdwImageTypes = 0;
+ return HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED);
+ }
+
+ //-----------------------------------------------------------------------------------------------------------------
+ // ICLRPrivAssembly method is unsupported.
+ STDMETHOD(GetImageResource)(
+ DWORD dwImageType,
+ DWORD* pdwImageType,
+ ICLRPrivResource ** ppIResource)
+ {
+ LIMITED_METHOD_CONTRACT;
+ _ASSERTE_MSG(false, "CLRPrivBinderAsAssemblyWrapper does not support ICLRPrivAssembly methods (just ICLRPrivBinder ones)!");
+ VALIDATE_ARG_RET(pdwImageType);
+ *pdwImageType = 0;
+ return HRESULT_FROM_WIN32(ERROR_NOT_SUPPORTED);
+ }
+
+ private:
+ ReleaseHolder<ICLRPrivBinder> _pWrapped;
+ };
+
+ //=================================================================================================================
+ // Provides a struct that can be accessed at the QWORD, DWORD, or WORD level, and is structured
+
+ struct AssemblyVersion
+ {
+#if BIGENDIAN
+ union
+ {
+ UINT64 qwMajorMinorBuildRevision;
+ struct
+ {
+ union
+ {
+ DWORD dwMajorMinor;
+ struct
+ {
+ WORD wMajor;
+ WORD wMinor;
+ };
+ };
+ union
+ {
+ DWORD dwBuildRevision;
+ struct
+ {
+ WORD wBuild;
+ WORD wRevision;
+ };
+ };
+ };
+ };
+#else
+ union
+ {
+ UINT64 qwMajorMinorBuildRevision;
+ struct
+ {
+ union
+ {
+ DWORD dwBuildRevision;
+ struct
+ {
+ WORD wRevision;
+ WORD wBuild;
+ };
+ };
+ union
+ {
+ DWORD dwMajorMinor;
+ struct
+ {
+ WORD wMinor;
+ WORD wMajor;
+ };
+ };
+ };
+ };
+#endif
+
+ // Default value is 0.0.0.0
+ AssemblyVersion()
+ : qwMajorMinorBuildRevision(static_cast<UINT64>(0))
+ { LIMITED_METHOD_CONTRACT; }
+
+ // Copy constructor
+ AssemblyVersion(AssemblyVersion const & other)
+ : qwMajorMinorBuildRevision(other.qwMajorMinorBuildRevision)
+ { LIMITED_METHOD_CONTRACT; }
+
+ // Initialize version using an IAssemblyName object.
+ HRESULT Initialize(IAssemblyName * pName);
+
+ // Initialize version using an ICLRPrivAssemblyInfo object.
+ HRESULT Initialize(ICLRPrivAssemblyInfo * pInfo);
+
+ // Relative ordering of versions.
+ static inline int Compare(
+ AssemblyVersion const & left,
+ AssemblyVersion const & right)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ if (left.qwMajorMinorBuildRevision < right.qwMajorMinorBuildRevision)
+ return -1;
+ else if (left.qwMajorMinorBuildRevision == right.qwMajorMinorBuildRevision)
+ return 0;
+ else
+ return 1;
+ }
+ }; // struct AssemblyVersion
+
+ inline bool operator ==(AssemblyVersion const & lhs, AssemblyVersion const & rhs)
+ { LIMITED_METHOD_CONTRACT; return lhs.qwMajorMinorBuildRevision == rhs.qwMajorMinorBuildRevision; }
+
+ inline bool operator !=(AssemblyVersion const & lhs, AssemblyVersion const & rhs)
+ { LIMITED_METHOD_CONTRACT; return lhs.qwMajorMinorBuildRevision != rhs.qwMajorMinorBuildRevision; }
+
+ inline bool operator <(AssemblyVersion const & lhs, AssemblyVersion const & rhs)
+ { LIMITED_METHOD_CONTRACT; return lhs.qwMajorMinorBuildRevision < rhs.qwMajorMinorBuildRevision; }
+
+ inline bool operator <=(AssemblyVersion const & lhs, AssemblyVersion const & rhs)
+ { LIMITED_METHOD_CONTRACT; return lhs.qwMajorMinorBuildRevision <= rhs.qwMajorMinorBuildRevision; }
+
+ inline bool operator >(AssemblyVersion const & lhs, AssemblyVersion const & rhs)
+ { LIMITED_METHOD_CONTRACT; return lhs.qwMajorMinorBuildRevision > rhs.qwMajorMinorBuildRevision; }
+
+ inline bool operator >=(AssemblyVersion const & lhs, AssemblyVersion const & rhs)
+ { LIMITED_METHOD_CONTRACT; return lhs.qwMajorMinorBuildRevision >= rhs.qwMajorMinorBuildRevision; }
+
+ //=================================================================================================================
+ // Encapsulates PublicKey value, can be initialized using a variety of data sources.
+
+ struct PublicKey
+ {
+ // Defaults to empty value.
+ PublicKey()
+ : m_key(nullptr)
+ , m_key_owned(false)
+ , m_size((DWORD)-1)
+ { LIMITED_METHOD_CONTRACT; }
+
+ // Construct directly from existing public key data.
+ PublicKey(PBYTE pbKey, DWORD cbKey)
+ : m_key(pbKey)
+ , m_key_owned(false)
+ , m_size(cbKey)
+ { LIMITED_METHOD_CONTRACT; }
+
+ ~PublicKey()
+ { WRAPPER_NO_CONTRACT; Uninitialize(); }
+
+ // Frees any public key data and resets to default value.
+ void Uninitialize()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ if (m_key_owned)
+ {
+ delete [] m_key;
+ m_key_owned = false;
+ }
+ m_key = nullptr;
+ m_size = 0;
+ }
+
+ // Initialize PK data form an ICLRPrivAssemblyInfo object.
+ HRESULT Initialize(ICLRPrivAssemblyInfo * pAssemblyInfo);
+
+ // Returns PK data pointer.
+ inline BYTE const * GetKey() const
+ { LIMITED_METHOD_CONTRACT; return m_key; }
+
+ // Returns size in bytes of the PK data.
+ inline DWORD GetSize() const
+ { LIMITED_METHOD_CONTRACT; return m_size; }
+
+ private:
+ PBYTE m_key;
+ bool m_key_owned;
+ DWORD m_size;
+ };
+
+ //=================================================================================================================
+ // Encapsulates PublicKeyToken value, can be initialized using a variety of data sources.
+ //
+ // Constraints: assumes that non-empty PKT data will always be 8 bytes long.
+ //
+
+ struct PublicKeyToken
+ {
+ PublicKeyToken()
+ : m_cbKeyToken(0)
+ { LIMITED_METHOD_CONTRACT; ZeroMemory(&m_rbKeyToken, sizeof(m_rbKeyToken)); }
+
+ PublicKeyToken(PublicKeyToken const & other)
+ : m_cbKeyToken(other.m_cbKeyToken)
+ { LIMITED_METHOD_CONTRACT; CopyMemory(m_rbKeyToken, other.m_rbKeyToken, sizeof(m_rbKeyToken)); }
+
+ // Initialize directly from PKT data.
+ HRESULT Initialize(BYTE * pbKeyToken, DWORD cbKeyToken);
+
+ // Converts PK data to PKT data.
+ HRESULT Initialize(PublicKey const & pk);
+
+ // Initialize using the PKT value contained by pName; returns S_FALSE if there is no associated PKT.
+ HRESULT Initialize(IAssemblyName * pName);
+
+ // Initialize using the PK data contained by pInfo; returns S_FALSE if there is no associated PK.
+ HRESULT Initialize(ICLRPrivAssemblyInfo * pInfo);
+
+ // PKT data.
+ BYTE const * GetToken() const
+ { LIMITED_METHOD_CONTRACT; return m_rbKeyToken; }
+
+ // Size in bytes of the PKT (should always be 0 or 8).
+ DWORD GetSize() const
+ { LIMITED_METHOD_CONTRACT; return m_cbKeyToken; }
+
+ private:
+ static const DWORD PUBLIC_KEY_TOKEN_LEN1 = 8;
+ BYTE m_rbKeyToken[PUBLIC_KEY_TOKEN_LEN1];
+ DWORD m_cbKeyToken;
+ };
+
+ bool operator==(PublicKeyToken const & lhs, PublicKeyToken const & rhs);
+
+ inline bool operator!=(PublicKeyToken const & lhs, PublicKeyToken const & rhs)
+ { WRAPPER_NO_CONTRACT; return !(lhs == rhs); }
+
+ //=================================================================================================================
+ // Encapsulates data required for packaged assembly identity: simple name, version, and public key token.
+ //
+ // Constraints: assumes that the assembly simple name is no longer than _MAX_PATH
+ //
+
+ struct AssemblyIdentity
+ {
+ AssemblyIdentity()
+ { LIMITED_METHOD_CONTRACT; Name[0] = W('\0'); }
+
+ AssemblyIdentity(AssemblyIdentity const & other)
+ : Version(other.Version)
+ , KeyToken(other.KeyToken)
+ { LIMITED_METHOD_CONTRACT; CopyMemory(Name, other.Name, sizeof(Name)); }
+
+ // Initialize from assembly simple name; default version and empty PKT values are used.
+ HRESULT Initialize(LPCWSTR wzName);
+
+ // Initialize from an ICLRPrivAssemblyInfo object.
+ HRESULT Initialize(ICLRPrivAssemblyInfo * pAssemblyInfo);
+
+ // Initialize from an IAssemblyName object.
+ HRESULT Initialize(IAssemblyName * pAssemblyName);
+
+ // Initialize from an AssemblySpec object.
+ HRESULT Initialize(AssemblySpec * pSpec);
+
+ // Assembly simple name
+ WCHAR Name[_MAX_PATH];
+
+ // Assembly version; defaults to 0.0.0.0.
+ CLRPrivBinderUtil::AssemblyVersion Version;
+
+ // Assembly public key token; defaults to none.
+ CLRPrivBinderUtil::PublicKeyToken KeyToken;
+ };
+
+ //=================================================================================================================
+ HRESULT VerifyBind(
+ IAssemblyName *pRefAssemblyName,
+ ICLRPrivAssemblyInfo *pDefAssemblyInfo);
+
+ //=================================================================================================================
+ HRESULT VerifyBind(
+ CLRPrivBinderUtil::AssemblyIdentity const & refIdentity,
+ CLRPrivBinderUtil::AssemblyIdentity const & defIdentity);
+
+ //=================================================================================================
+ template <typename ItfT>
+ struct CLRPrivResourceBase :
+ public IUnknownCommon<ICLRPrivResource>
+ {
+ //---------------------------------------------------------------------------------------------
+ STDMETHOD(GetResourceType)(
+ IID *pIID)
+ {
+ LIMITED_METHOD_CONTRACT;
+ if (pIID == nullptr)
+ return E_INVALIDARG;
+ *pIID = __uuidof(ItfT);
+ return S_OK;
+ }
+ };
+
+ //=================================================================================================================
+ class CLRPrivResourcePathImpl :
+ public IUnknownCommon< ItfBase< CLRPrivResourceBase< ICLRPrivResourcePath > >,
+ ICLRPrivResourcePath >
+ {
+ public:
+ //---------------------------------------------------------------------------------------------
+ CLRPrivResourcePathImpl(LPCWSTR wzPath);
+
+ //---------------------------------------------------------------------------------------------
+ LPCWSTR GetPath()
+ { return m_wzPath; }
+
+ //
+ // ICLRPrivResourcePath methods
+ //
+
+ //---------------------------------------------------------------------------------------------
+ STDMETHOD(GetPath)(
+ DWORD cchBuffer,
+ LPDWORD pcchBuffer,
+ __inout_ecount_part(cchBuffer, *pcchBuffer) LPWSTR wzBuffer);
+
+ private:
+ //---------------------------------------------------------------------------------------------
+ NewArrayHolder<WCHAR> m_wzPath;
+ };
+
+ //=================================================================================================================
+ class CLRPrivResourceStreamImpl :
+ public IUnknownCommon< ItfBase< CLRPrivResourceBase<ICLRPrivResourceStream > >,
+ ICLRPrivResourceStream>
+ {
+ public:
+ //---------------------------------------------------------------------------------------------
+ CLRPrivResourceStreamImpl(IStream * pStream);
+
+ //---------------------------------------------------------------------------------------------
+ STDMETHOD(GetStream)(
+ REFIID riid,
+ LPVOID * ppvStream);
+
+ private:
+ //---------------------------------------------------------------------------------------------
+ ReleaseHolder<IStream> m_pStream;
+ };
+
+ //=================================================================================================================
+ // Helper to prioritize binder errors. This class will ensure that all other errors have priority over
+ // CLR_E_BIND_UNRECOGNIZED_IDENTITY_FORMAT. This class should be used just like an HRESULT variable.
+ class BinderHRESULT
+ {
+ public:
+ BinderHRESULT()
+ : m_hr(S_OK)
+ {}
+
+ BinderHRESULT(HRESULT hr)
+ : m_hr(hr)
+ {}
+
+ operator HRESULT() const
+ { return m_hr; }
+
+ BinderHRESULT & operator=(HRESULT hr)
+ {
+ // Always record change in success/failure status.
+ if (FAILED(hr) != FAILED(m_hr))
+ m_hr = hr;
+
+ if (FAILED(hr))
+ {
+ if (SUCCEEDED(m_hr))
+ m_hr = hr;
+ else if (m_hr == CLR_E_BIND_UNRECOGNIZED_IDENTITY_FORMAT)
+ m_hr = hr;
+ }
+ else
+ {
+ m_hr = hr;
+ }
+ return *this;
+ }
+
+ private:
+ HRESULT m_hr;
+ }; // class BinderHRESULT
+
+ //=================================================================================================================
+ // Types for WStringList (used in WinRT binders)
+
+ typedef SListElem< PTR_WSTR > WStringListElem;
+ typedef DPTR(WStringListElem) PTR_WStringListElem;
+ typedef SList< WStringListElem, false /* = fHead default value */, PTR_WStringListElem > WStringList;
+ typedef DPTR(WStringList) PTR_WStringList;
+
+ // Destroys list of strings (code:WStringList).
+ void WStringList_Delete(WStringList * pList);
+
+#ifndef DACCESS_COMPILE
+ //=====================================================================================================================
+ // Holder of allocated code:WStringList (helper class for WinRT binders - e.g. code:CLRPrivBinderWinRT::GetFileNameListForNamespace).
+ class WStringListHolder
+ {
+ public:
+ WStringListHolder(WStringList * pList = nullptr)
+ {
+ LIMITED_METHOD_CONTRACT;
+ m_pList = pList;
+ }
+ ~WStringListHolder()
+ {
+ LIMITED_METHOD_CONTRACT;
+ Destroy();
+ }
+
+ void InsertTail(LPCWSTR wszValue)
+ {
+ CONTRACTL
+ {
+ THROWS;
+ GC_NOTRIGGER;
+ MODE_ANY;
+ }
+ CONTRACTL_END;
+
+ NewArrayHolder<WCHAR> wszElemValue = DuplicateStringThrowing(wszValue);
+ NewHolder<WStringListElem> pElem = new WStringListElem(wszElemValue);
+
+ if (m_pList == nullptr)
+ {
+ m_pList = new WStringList();
+ }
+
+ m_pList->InsertTail(pElem.Extract());
+ // The string is now owned by the list
+ wszElemValue.SuppressRelease();
+ }
+
+ WStringList * GetValue()
+ {
+ LIMITED_METHOD_CONTRACT;
+ return m_pList;
+ }
+
+ WStringList * Extract()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ WStringList * pList = m_pList;
+ m_pList = nullptr;
+ return pList;
+ }
+
+ private:
+ void Destroy()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ if (m_pList != nullptr)
+ {
+ WStringList_Delete(m_pList);
+ m_pList = nullptr;
+ }
+ }
+
+ private:
+ WStringList * m_pList;
+ }; // class WStringListHolder
+#endif //!DACCESS_COMPILE
+
+#ifdef FEATURE_COMINTEROP
+ //=====================================================================================================================
+ // Holder of allocated array of HSTRINGs (helper class for WinRT binders - e.g. code:CLRPrivBinderWinRT::m_rgAltPaths).
+ class HSTRINGArrayHolder
+ {
+ public:
+ HSTRINGArrayHolder()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_cValues = 0;
+ m_rgValues = nullptr;
+ }
+#ifndef DACCESS_COMPILE
+ ~HSTRINGArrayHolder()
+ {
+ LIMITED_METHOD_CONTRACT;
+ Destroy();
+ }
+
+ // Destroys current array and allocates a new one with cValues elements.
+ void Allocate(DWORD cValues)
+ {
+ STANDARD_VM_CONTRACT;
+
+ Destroy();
+ _ASSERTE(m_cValues == 0);
+
+ if (cValues > 0)
+ {
+ m_rgValues = new HSTRING[cValues];
+ m_cValues = cValues;
+
+ // Initialize the array values
+ for (DWORD i = 0; i < cValues; i++)
+ {
+ m_rgValues[i] = nullptr;
+ }
+ }
+ }
+#endif //!DACCESS_COMPILE
+
+ HSTRING GetAt(DWORD index) const
+ {
+ LIMITED_METHOD_CONTRACT;
+ return m_rgValues[index];
+ }
+
+ HSTRING * GetRawArray()
+ {
+ LIMITED_METHOD_CONTRACT;
+ return m_rgValues;
+ }
+
+ DWORD GetCount()
+ {
+ LIMITED_METHOD_CONTRACT;
+ return m_cValues;
+ }
+
+ private:
+#ifndef DACCESS_COMPILE
+ void Destroy()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ for (DWORD i = 0; i < m_cValues; i++)
+ {
+ if (m_rgValues[i] != nullptr)
+ {
+ WindowsDeleteString(m_rgValues[i]);
+ }
+ }
+ m_cValues = 0;
+
+ if (m_rgValues != nullptr)
+ {
+ delete [] m_rgValues;
+ m_rgValues = nullptr;
+ }
+ }
+#endif //!DACCESS_COMPILE
+
+ private:
+ DWORD m_cValues;
+ HSTRING * m_rgValues;
+ }; // class HSTRINGArrayHolder
+
+#endif // FEATURE_COMINTEROP
+
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+ ///// ----------------------------- Questionable stuff -------------------------------------------
+ ////////////////////////////////////////////////////////////////////////////////////////////////////
+
+ /** probably should be exposed on an instance (of something) method rather that magically calling GetAppDomain() **/
+ ICLRPrivAssembly* RaiseAssemblyResolveEvent(IAssemblyName *pAssemblyName, ICLRPrivAssembly* pRequestingAssembly);
+
+ /** PLACEHOLDER - CLRPRivBinderFusion::BindAssemblyByName throws, despite being an HRESULT function,
+ most presumably because returning HRESULT is too lossy **/
+
+ /** Ultimately, only the binder can do ref-def matching, and it should be opaque to CLR.
+ This is not trivial to do, however, since we cannot do data conversion as the function is nofault **/
+ BOOL CompareHostBinderSpecs(AssemblySpec* a1, AssemblySpec* a2);
+
+ /** PLACEHOLDER - the same issue as CompareHostBinderSpecs applies to hashing assemblyspecs **/
+} // namespace CLRPrivBinderUtil
+
+#endif // __CLRPRIVBINDERUTIL_H__
diff --git a/src/inc/clrprivbinding.idl b/src/inc/clrprivbinding.idl
new file mode 100644
index 0000000000..5261f076d1
--- /dev/null
+++ b/src/inc/clrprivbinding.idl
@@ -0,0 +1,324 @@
+// 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.
+
+import "unknwn.idl";
+import "objidl.idl";
+import "fusion.idl";
+
+// Forward declarations
+interface ICLRPrivBinder;
+interface ICLRPrivAssembly;
+
+interface ICLRPrivResource;
+interface ICLRPrivResourcePath;
+interface ICLRPrivResourceStream;
+interface ICLRPrivResourceHMODULE;
+
+interface ICLRPrivAssemblyInfo;
+
+typedef LPCSTR LPCUTF8;
+
+/**************************************************************************************
+ ** This IDL file defines the assembly binding host interfaces. Some things to keep
+ ** in mind:
+ ** - Equality is determined by pointer equality: two interface instances
+ ** should be considered equal if and only if their pointer values are equal.
+ ** - All operations are idempotent: when a method is called more than once with
+ ** the same input values, it is required to return identical results. The only
+ ** possible exceptions center around transient errors such as E_OUTOFMEMORY.
+ **************************************************************************************/
+
+/**************************************************************************************
+ ** ICLRPrivBinder - Use to bind to an assembly by name or by metadata reference.
+ **************************************************************************************/
+[
+ uuid(2601F621-E462-404C-B299-3E1DE72F8542),
+ version(1.0),
+ local
+]
+interface ICLRPrivBinder : IUnknown
+{
+ /**********************************************************************************
+ ** BindAssemblyByName -- Binds an assembly by name.
+ ** NOTE: This method is required to be idempotent. See general comment above.
+ **
+ ** pAssemblyName - name of the assembly for which a bind is being requested.
+ ** ppAssembly - upon success, receives the bound assembly.
+ **********************************************************************************/
+ HRESULT BindAssemblyByName(
+ [in] IAssemblyName * pAssemblyName,
+ [out, retval] ICLRPrivAssembly ** ppAssembly);
+
+ /**********************************************************************************
+ ** VerifyBind
+ **********************************************************************************/
+ HRESULT VerifyBind(
+ [in] IAssemblyName * AssemblyName,
+ [in] ICLRPrivAssembly * pAssembly,
+ [in] ICLRPrivAssemblyInfo * pAssemblyInfo);
+
+ /**********************************************************************************
+ ** GetBinderFlags
+ ** pBinderFlags, pointer to binder flags.
+ **********************************************************************************/
+ HRESULT GetBinderFlags(
+ [out, retval] DWORD *pBinderFlags);
+
+ /**********************************************************************************
+ ** GetBinderID
+ ** pBinderId, pointer to binder id. The binder id has the following properties
+ ** It is a pointer that does not change over the lifetime of a binder object
+ ** It points at an object in memory that will remain allocated for the lifetime of the binder.
+ ** This value should be the same for a set of binder objects that represent the same binder behavior.
+ **********************************************************************************/
+ HRESULT GetBinderID(
+ [out, retval] UINT_PTR *pBinderId);
+
+ /**********************************************************************************
+ ** FindAssemblyBySpec -- if it has been previously bound, guarantees that the same
+ ** result will be returned; if previous result was successful, the bound
+ ** ICLRPrivAssembly will be returned, and if previous result was not successful
+ ** the same failure HRESULT will be assigned to *pResult. Returns failure HR if
+ ** identity has not been requested previously.
+ **
+ ** pvAssemblySpec - the AssemblySpec identity to bind.
+ ** pResult - the result of the previous bind request.
+ ** ppAssembly - when successful, contains the corresponding assembly object.
+ **********************************************************************************/
+ HRESULT FindAssemblyBySpec(
+ [in] LPVOID pvAppDomain,
+ [in] LPVOID pvAssemblySpec,
+ [out] HRESULT * pResult,
+ [out] ICLRPrivAssembly ** ppAssembly);
+};
+
+enum CLR_PRIV_BINDER_FLAGS
+{
+ BINDER_NONE = 0x0,
+ BINDER_DESIGNER_BINDING_CONTEXT = 0x1,
+ BINDER_FINDASSEMBLYBYSPEC_REQUIRES_EXACT_MATCH = 0x2,
+};
+
+/**************************************************************************************
+ ** ASSEMBLY_IMAGE_TYPES - The set of assembly image formats.
+ **************************************************************************************/
+enum ASSEMBLY_IMAGE_TYPES
+{
+ // IL image format
+ ASSEMBLY_IMAGE_TYPE_IL = 0x0001,
+ // Native image (NGEN) format
+ ASSEMBLY_IMAGE_TYPE_NATIVE = 0x0002,
+ // Binder's preferred image type
+ ASSEMBLY_IMAGE_TYPE_DEFAULT = 0x0003,
+ // Only supported on CoreCLR
+ ASSEMBLY_IMAGE_TYPE_ASSEMBLY = 0x0004,
+};
+
+/**************************************************************************************
+ ** ICLRPrivAssembly - Represents an assembly bind result. Extends ICLRPrivBinder, which
+ ** implicitly tracks the parent binder, and enables simple assembly-relative binds.
+ **************************************************************************************/
+[
+ uuid(2601F621-E462-404C-B299-3E1DE72F8543),
+ version(1.0),
+ local
+]
+interface ICLRPrivAssembly : ICLRPrivBinder
+{
+ /**********************************************************************************
+ ** IsShareable - Use to determine if the assembly should be shared.
+ ** NOTE: This method is required to be idempotent. See general comment above.
+ **
+ ** A binder must adhere to the following contract when marking an assembly as
+ ** shareable:
+ ** - all assemblies in the full static binding closure must also be shareable.
+ **
+ ** pbIsShareable - set to TRUE if the assembly can be shared; FALSE otherwise.
+ **********************************************************************************/
+ HRESULT IsShareable(
+ [out, retval] BOOL * pbIsShareable);
+
+ /**********************************************************************************
+ ** GetAvailableImageTypes - Use to retrieve the set of images available for an
+ ** assembly.
+ ** NOTE: This method is required to be idempotent. See general comment above.
+ **
+ ** pdwImageTypes - set to values from ASSEMBLY_IMAGE_TYPES to indicate
+ ** which image formats are available for the assembly.
+ **********************************************************************************/
+ HRESULT GetAvailableImageTypes(
+ [out, retval] LPDWORD pdwImageTypes);
+
+ /**********************************************************************************
+ ** GetImageResource - Returns the resource for the given image type. The returned
+ ** IUnknown interface is one of the ICLRPrivResource* interfaces defined below.
+ ** It is the binder's choice as to which resource type is returned. If
+ ** pdwImageType is non-null, then this will be set to indicate the image type
+ ** returned.
+ ** NOTE: This method is required to be idempotent. See general comment above.
+ **********************************************************************************/
+ HRESULT GetImageResource(
+ [in] DWORD dwImageType,
+ [out] DWORD* pdwImageType,
+ [out, retval] ICLRPrivResource ** ppIResource);
+};
+
+/**************************************************************************************
+ ** ICLRPrivResource - Generic resource that must be queried for more specific
+ ** interface.
+ **************************************************************************************/
+[
+ uuid(2601F621-E462-404C-B299-3E1DE72F8547),
+ version(1.0),
+ local
+]
+interface ICLRPrivResource : IUnknown
+{
+ /**********************************************************************************
+ ** GetResourceType - use to query the interface IID of the specific resource type.
+ **
+ ** priid - set to the IID corresponding to the resource type.
+ **********************************************************************************/
+ HRESULT GetResourceType(
+ [out, retval] IID *pIID);
+};
+
+/**************************************************************************************
+ ** ICLRPrivResourcePath - Encapsulates a resource identified by path.
+ **************************************************************************************/
+[
+ uuid(2601F621-E462-404C-B299-3E1DE72F8544),
+ version(1.0),
+ local
+]
+interface ICLRPrivResourcePath : IUnknown
+{
+ /**********************************************************************************
+ ** GetPath - Use to retrieve the resource's absolute file path.
+ ** NOTE: This method is required to be idempotent. See general comment above.
+ **
+ ** cchBuffer - the count of unicode characters available in the buffer.
+ **********************************************************************************/
+ HRESULT GetPath(
+ [in] DWORD cchBuffer,
+ [out] LPDWORD pcchBuffer,
+ [out, size_is(cchBuffer), length_is(*pcchBuffer), string, optional] LPWSTR wzBuffer);
+};
+
+/**************************************************************************************
+ ** ICLRPrivResourceStream - Encapsulates a resource identified by IStream.
+ **************************************************************************************/
+[
+ uuid(2601F621-E462-404C-B299-3E1DE72F8545),
+ version(1.0),
+ local
+]
+interface ICLRPrivResourceStream : IUnknown
+{
+ /**********************************************************************************
+ ** GetStream - Use to retrieve IStream instance corresponding to the resource.
+ ** NOTE: This method is required to be idempotent. See general comment above.
+ **
+ ** riid - the IID of the interface to return. Typically IID_IStream.
+ ** ppvStream - contains the returned interface.
+ **********************************************************************************/
+ HRESULT GetStream(
+ [in] REFIID riid,
+ [out, iid_is(riid), retval] LPVOID * ppvStream);
+};
+
+/**************************************************************************************
+ ** ICLRPrivResourceHMODULE - Encapsulates a resource identified by HMODULE.
+ **************************************************************************************/
+[
+ uuid(2601F621-E462-404C-B299-3E1DE72F8546),
+ version(1.0),
+ local
+]
+interface ICLRPrivResourceHMODULE : IUnknown
+{
+ /**********************************************************************************
+ ** GetStream - Use to retrieve the resource's HMODULE value. The HMODULE's
+ ** reference count is not changed; the ICLRPrivResourceHMODULE instance must be
+ ** kept until the HMODULE is either reference counted or no longer used.
+ ** NOTE: This method is required to be idempotent. See general comment above.
+ **********************************************************************************/
+ HRESULT GetHMODULE(
+ [out, retval] HMODULE * phModule);
+};
+
+[
+ uuid(8d2d3cc9-1249-4ad4-977d-b772bd4e8a94),
+ version(1.0),
+ local
+]
+interface ICLRPrivResourceAssembly : IUnknown
+{
+ /**********************************************************************************
+ ** GetAssembly - Use to retrieve the resource's BINDER_SPACE::Assembly value.
+ ** NOTE: This method is required to be idempotent. See general comment above.
+ **********************************************************************************/
+ HRESULT GetAssembly(
+ [out, retval] LPVOID * pAssembly);
+};
+
+/**************************************************************************************
+ ** ICLRPrivAssemblyInfo - Encapsulates assembly image info.
+ **************************************************************************************/
+[
+ uuid(5653946E-800B-48B7-8B09-B1B879B54F68),
+ version(1.0),
+ local
+]
+interface ICLRPrivAssemblyInfo : IUnknown
+{
+ HRESULT GetAssemblyName(
+ [in] DWORD cchBuffer,
+ [out] LPDWORD pcchBuffer,
+ [out, string, optional] LPWSTR wzBuffer);
+
+ HRESULT GetAssemblyVersion(
+ [out] USHORT *pMajor,
+ [out] USHORT *pMinor,
+ [out] USHORT *pBuild,
+ [out] USHORT *pRevision);
+
+ HRESULT GetAssemblyPublicKey(
+ [in] DWORD cbBuffer,
+ [out] LPDWORD pcbBuffer,
+ [out, size_is(cbBuffer), length_is(*pcbBuffer), optional] BYTE *pbBuffer);
+};
+
+/**************************************************************************************
+ ** ICLRPrivAssemblyID_WinRT - Provides identification for WinRT assembly - allows dynamic casting inside code:CLRPrivAssemblyWinRT.
+ **************************************************************************************/
+[
+ uuid(4372D277-9906-4FED-BF53-30C0B4010896),
+ version(1.0),
+ local
+]
+interface ICLRPrivAssemblyID_WinRT : IUnknown
+{
+};
+
+/**************************************************************************************
+ ** ICLRPrivWinRtTypeBinder - Provides binding to WinRT types that are already loaded.
+ **************************************************************************************/
+[
+ uuid(6DE2A085-EFF4-4078-9F60-B9D366736398),
+ version(1.0),
+ local
+]
+interface ICLRPrivWinRtTypeBinder : IUnknown
+{
+ /**********************************************************************************
+ ** FindAssemblyForWinRtTypeIfLoaded
+ ** Finds Assembly * for type in AppDomain * if it is loaded.
+ ** Returns NULL if assembly is not loaded or type is not found.
+ **********************************************************************************/
+ void * FindAssemblyForWinRtTypeIfLoaded(
+ void * pAppDomain,
+ LPCUTF8 szNamespace,
+ LPCUTF8 szClassName);
+};
diff --git a/src/inc/clrprivhosting.idl b/src/inc/clrprivhosting.idl
new file mode 100644
index 0000000000..b288c286b6
--- /dev/null
+++ b/src/inc/clrprivhosting.idl
@@ -0,0 +1,92 @@
+// 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.
+
+import "unknwn.idl";
+import "CLRPrivBinding.idl";
+
+//=====================================================================================================================
+// Forward declarations
+interface ICLRPrivRuntime;
+
+//=====================================================================================================================
+// CLRPrivHosting coclass
+//=====================================================================================================================
+[
+ uuid("EDA73987-E6C0-42BF-A6B7-073F7B24D8C7")
+]
+library CLRPrivHosting
+{
+ //=================================================================================================================
+ // CLRPrivRuntime
+ //=================================================================================================================
+ [
+ uuid(BC1B53A8-DCBC-43B2-BB17-1E4061447AE8)
+ ]
+ coclass CLRPrivRuntime
+ {
+ [default] interface ICLRPrivRuntime;
+ };
+};
+
+//=====================================================================================================================
+// ICLRPrivRuntime
+//=====================================================================================================================
+[
+ uuid(BC1B53A8-DCBC-43B2-BB17-1E4061447AE9),
+ version(1.0),
+ local
+]
+interface ICLRPrivRuntime : IUnknown
+{
+ /**********************************************************************************
+ ** Used for accessing additional hosting functionality.
+ **
+ ** rclsid - the CoClass from which to request the interface.
+ ** riid - the IID of the interface being requested.
+ ** ppUnk - receives the interface pointer value.
+ **********************************************************************************/
+ HRESULT GetInterface(
+ [in] REFCLSID rclsid,
+ [in] REFIID riid,
+ [out, iid_is(riid), retval] LPVOID *ppUnk);
+
+ /**********************************************************************************
+ ** Creates a domain using the provided binder for the root default bind context.
+ **
+ ** pwzFriendlyName - the name to associate with the domain.
+ ** pBinder - the binder to use for root-level binds in the default context.
+ ** pdwAppDomainId - receives the ID of the created domain.
+ **********************************************************************************/
+ HRESULT CreateAppDomain(
+ [in, string] LPCWSTR pwzFriendlyName,
+ [in] ICLRPrivBinder * pBinder,
+ [out, retval] LPDWORD pdwAppDomainId);
+
+ /**********************************************************************************
+ ** Creates a native-callable function pointer to the specified method.
+ **
+ ** appDomainID - the domain in which to create the delegate.
+ ** wszAssemblyName - the name of the assembly in which the method is defined.
+ ** wszClassName - the name of the class (including namespace) in which the method
+ ** is defined.
+ ** wszMethodName - the name of the method for which to create a delegate.
+ ** ppvDelegate - receives the delegate pointer value.
+ **********************************************************************************/
+ HRESULT CreateDelegate(
+ [in] DWORD appDomainID,
+ [in, string] LPCWSTR wszAssemblyName,
+ [in, string] LPCWSTR wszClassName,
+ [in, string] LPCWSTR wszMethodName,
+ [out, retval] LPVOID * ppvDelegate);
+
+ /**********************************************************************************
+ ** Creates an AppX appdomain and executes entrypoint method of an executable there
+ **
+ **********************************************************************************/
+ HRESULT ExecuteMain(
+ [in] ICLRPrivBinder * pBinder,
+ [out, retval] int * pRetVal
+ );
+};
+
diff --git a/src/inc/clrprivruntimebinders.idl b/src/inc/clrprivruntimebinders.idl
new file mode 100644
index 0000000000..0da7e3acd7
--- /dev/null
+++ b/src/inc/clrprivruntimebinders.idl
@@ -0,0 +1,39 @@
+// 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.
+
+import "CLRPrivBinding.idl";
+
+//=====================================================================================================================
+// CLRPrivRuntime
+//=====================================================================================================================
+[
+ uuid("EA6A2170-8F6A-4007-87A9-02429F615958")
+]
+library CLRPrivRuntimeBinders
+{
+ //=================================================================================================================
+ // CLRPrivAppXBinder
+ //=================================================================================================================
+ [
+ uuid(E990F732-2D0A-48AC-87FC-EF12B618981A),
+ helpstring("Runtime-provided package-based assembly binder for AppX."),
+ ]
+ coclass CLRPrivAppXBinder
+ {
+ [default] interface ICLRPrivBinder;
+ };
+
+ //=================================================================================================================
+ // CLRPrivFusionBinder
+ //=================================================================================================================
+ [
+ uuid(E990F732-2D0A-48AC-87FC-EF12B618981C),
+ helpstring("Runtime-provided binder for wrapping ICLRPrivBinder-compatible subset of fusion functionality."),
+ ]
+ coclass CLRPrivFusionBinder
+ {
+ [default] interface ICLRPrivBinder;
+ };
+};
+
diff --git a/src/inc/clrtypes.h b/src/inc/clrtypes.h
new file mode 100644
index 0000000000..5f9de0cbf1
--- /dev/null
+++ b/src/inc/clrtypes.h
@@ -0,0 +1,422 @@
+// 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.
+// ================================================================================
+// Standard primitive types for CLR code
+//
+// This header serves as a platform layer containing all of the primitive types
+// which we use across CLR implementation code.
+// ================================================================================
+
+
+#ifndef CLRTYPES_H_
+#define CLRTYPES_H_
+
+#if defined(_MSC_VER) && !defined(SOURCE_FORMATTING) && (!defined(FEATURE_CORECLR) || defined(FEATURE_CORESYSTEM))
+ // Prefer intsafe.h when available, which defines many of the MAX/MIN
+ // values below (which is why they are in #ifndef blocks).
+ #include <intsafe.h>
+#endif
+
+#include "crtwrap.h"
+#include "winwrap.h"
+#include "staticcontract.h"
+#include "static_assert.h"
+
+#if _WIN64
+ #define POINTER_BITS 64
+#else
+ #define POINTER_BITS 32
+#endif
+
+// ================================================================================
+// Integral types - use these for all integral types
+// These types are in ALL_CAPS. Each type has a _MIN and _MAX defined for it.
+// ================================================================================
+
+// --------------------------------------------------------------------------------
+// Use these types for fixed size integers:
+// INT8 UINT8 INT16 UINT16 INT32 UINT32 INT64 UINT64
+// --------------------------------------------------------------------------------
+
+#ifndef INT8_MAX
+ typedef signed char INT8;
+ typedef unsigned char UINT8;
+ typedef short INT16;
+ typedef unsigned short UINT16;
+ typedef int INT32;
+ typedef unsigned int UINT32;
+ typedef __int64 INT64;
+ typedef unsigned __int64 UINT64;
+
+ #ifdef _MSC_VER
+ /* These macros must exactly match those in the Windows SDK's intsafe.h */
+ #define INT8_MIN (-127i8 - 1)
+ #define INT16_MIN (-32767i16 - 1)
+ #define INT32_MIN (-2147483647i32 - 1)
+ #define INT64_MIN (-9223372036854775807i64 - 1)
+
+ #define INT8_MAX 127i8
+ #define INT16_MAX 32767i16
+ #define INT32_MAX 2147483647i32
+ #define INT64_MAX 9223372036854775807i64
+
+ #define UINT8_MAX 0xffui8
+ #define UINT16_MAX 0xffffui16
+ #define UINT32_MAX 0xffffffffui32
+ #define UINT64_MAX 0xffffffffffffffffui64
+ #else
+ #define INT8_MIN ((INT8)0x80)
+ #define INT16_MIN ((INT16)0x8000)
+ #define INT32_MIN ((INT32)0x80000000)
+ #define INT64_MIN ((INT64) I64(0x8000000000000000))
+
+ #define INT8_MAX ((INT8)0x7f)
+ #define INT16_MAX ((INT16)0x7fff)
+ #define INT32_MAX ((INT32)0x7fffffff)
+ #define INT64_MAX ((INT64) I64(0x7fffffffffffffff))
+
+ #define UINT8_MAX ((UINT8)0xffU)
+ #define UINT16_MAX ((UINT16)0xffffU)
+ #define UINT32_MAX ((UINT32)0xffffffffU)
+ #define UINT64_MAX ((UINT64) UI64(0xffffffffffffffff))
+ #endif
+#endif // !INT8_MAX
+
+// UINTX_MINs aren't defined in standard header files,
+// so definition must be separately predicated.
+#ifndef UINT8_MIN
+ #ifdef _MSC_VER
+ #define UINT8_MIN 0ui8
+ #define UINT16_MIN 0ui16
+ #define UINT32_MIN 0ui32
+ #define UINT64_MIN 0ui64
+ #else
+ #define UINT8_MIN ((UINT8)0U)
+ #define UINT16_MIN ((UINT16)0U)
+ #define UINT32_MIN ((UINT32)0U)
+ #define UINT64_MIN ((UINT64) UI64(0))
+ #endif
+#endif
+
+
+// --------------------------------------------------------------------------------
+// Use these types for pointer-sized integral types
+// SIZE_T SSIZE_T
+//
+// These types are the ONLY types which can be safely cast back and forth from a
+// pointer.
+// --------------------------------------------------------------------------------
+
+#ifndef SIZE_T_MAX
+ #if NEED_POINTER_SIZED_TYPEDEFS
+ typedef size_t SIZE_T;
+ typedef ptrdiff_t SSIZE_T;
+ #endif
+
+ #if POINTER_BITS == 64
+ #define SIZE_T_MAX UINT64_MAX
+ #define SIZE_T_MIN UINT64_MIN
+
+ #define SSIZE_T_MAX INT64_MAX
+ #define SSIZE_T_MIN INT64_MIN
+ #else
+ #define SIZE_T_MAX UINT32_MAX
+ #define SIZE_T_MIN UINT32_MIN
+
+ #define SSIZE_T_MAX INT32_MAX
+ #define SSIZE_T_MIN INT32_MIN
+ #endif
+#endif
+
+// --------------------------------------------------------------------------------
+// Non-pointer sized types
+// COUNT_T SCOUNT_T
+//
+// Use these types for "large" counts or indexes which will not exceed 32 bits. They
+// may also be used for pointer differences, if you can guarantee that the pointers
+// are pointing to the same region of memory. (It can NOT be used for arbitrary
+// pointer subtraction.)
+// --------------------------------------------------------------------------------
+
+#ifndef COUNT_T_MAX
+ typedef UINT32 COUNT_T;
+ typedef INT32 SCOUNT_T;
+
+ #define COUNT_T_MAX UINT32_MAX
+ #define COUNT_T_MIN UINT32_MIN
+
+ #define SCOUNT_T_MAX INT32_MAX
+ #define SCOUNT_T_MIN INT32_MIN
+#endif
+
+// --------------------------------------------------------------------------------
+// Integral types with additional semantic content
+// BOOL BYTE
+// --------------------------------------------------------------------------------
+
+#ifndef BYTE_MAX
+ #if NEED_BOOL_TYPEDEF
+ typedef bool BOOL;
+ #endif
+
+ #define BOOL_MAX 1
+ #define BOOL_MIN 0
+
+ #define TRUE 1
+ #define FALSE 0
+
+ typedef UINT8 BYTE;
+
+ #define BYTE_MAX UINT8_MAX
+ #define BYTE_MIN UINT8_MIN
+#endif
+
+// --------------------------------------------------------------------------------
+// Character types
+// CHAR SCHAR UCHAR WCHAR
+// --------------------------------------------------------------------------------
+
+typedef char CHAR;
+typedef signed char SCHAR;
+typedef unsigned char UCHAR;
+typedef wchar_t WCHAR;
+
+typedef CHAR ASCII;
+typedef CHAR ANSI;
+typedef CHAR UTF8;
+
+// Standard C defines:
+
+// CHAR_MAX
+// CHAR_MIN
+// SCHAR_MAX
+// SCHAR_MIN
+// UCHAR_MAX
+// UCHAR_MIN
+// WCHAR_MAX
+// WCHAR_MIN
+
+#ifndef ASCII_MAX
+ #define ASCII_MIN ((ASCII)0)
+ #define ASCII_MAX ((ASCII)127)
+
+ #define ANSI_MIN ((ANSI)0)
+ #define ANSI_MAX ((ANSI)255)
+
+ #define UTF8_MIN ((UTF8)0)
+ #define UTF8_MAX ((UTF8)255)
+#endif
+
+// ================================================================================
+// Non-integral types
+// These types are in ALL_CAPS.
+// ================================================================================
+
+// --------------------------------------------------------------------------------
+// Floating point types
+// FLOAT DOUBLE
+// --------------------------------------------------------------------------------
+
+// ================================================================================
+// Runtime type definitions - these are guaranteed to be identical with the
+// corresponding managed type
+// ================================================================================
+
+typedef WCHAR CLR_CHAR;
+typedef INT8 CLR_I1;
+typedef UINT8 CLR_U1;
+typedef INT16 CLR_I2;
+typedef UINT16 CLR_U2;
+typedef INT32 CLR_I4;
+typedef UINT32 CLR_U4;
+typedef INT64 CLR_I8;
+typedef UINT64 CLR_U8;
+typedef FLOAT CLR_R4;
+typedef DOUBLE CLR_R8;
+typedef SSIZE_T CLR_I;
+typedef SIZE_T CLR_U;
+
+#define CLR_CHAR_MAX WCHAR_MAX
+#define CLR_CHAR_MIN WCHAR_MIN
+
+#define CLR_I1_MAX INT8_MAX
+#define CLR_I1_MIN INT8_MIN
+
+#define CLR_U1_MAX UINT8_MAX
+#define CLR_U1_MIN UINT8_MIN
+
+#define CLR_I2_MAX INT16_MAX
+#define CLR_I2_MIN INT16_MIN
+
+#define CLR_U2_MAX UINT16_MAX
+#define CLR_U2_MIN UINT16_MIN
+
+#define CLR_I4_MAX INT32_MAX
+#define CLR_I4_MIN INT32_MIN
+
+#define CLR_U4_MAX UINT32_MAX
+#define CLR_U4_MIN UINT32_MIN
+
+#define CLR_I8_MAX INT64_MAX
+#define CLR_I8_MIN INT64_MIN
+
+#define CLR_U8_MAX UINT64_MAX
+#define CLR_U8_MIN UINT64_MIN
+
+#define CLR_I_MAX SSIZE_T_MAX
+#define CLR_I_MIN SSIZE_T_MIN
+
+#define CLR_U_MAX SIZE_T_MAX
+#define CLR_U_MIN SIZE_T_MIN
+
+ typedef bool CLR_BOOL;
+
+static_assert_no_msg(sizeof(CLR_BOOL) == 1);
+
+#define CLR_BOOL_MAX BOOL_MAX
+#define CLR_BOOL_MIN BOOL_MIN
+
+#define CLR_NAN_32 0xFFC00000
+#define CLR_NAN_64 I64(0xFFF8000000000000)
+
+// ================================================================================
+// Simple utility functions
+// ================================================================================
+
+// Note that these routines are in terms of UINT, ULONG, and ULONG64, since those are
+// the unsigned integral types the compiler overloads based on.
+
+// --------------------------------------------------------------------------------
+// Min/Max
+// --------------------------------------------------------------------------------
+
+template <typename T>
+T Min(T v1, T v2)
+{
+ STATIC_CONTRACT_LEAF;
+ STATIC_CONTRACT_SO_TOLERANT;
+ return v1 < v2 ? v1 : v2;
+}
+
+template <typename T>
+T Max(T v1, T v2)
+{
+ STATIC_CONTRACT_LEAF;
+ STATIC_CONTRACT_SO_TOLERANT;
+ return v1 > v2 ? v1 : v2;
+}
+
+// --------------------------------------------------------------------------------
+// Alignment bit twiddling macros - "alignment" must be power of 2
+//
+// AlignUp - align value to given increment, rounding up
+// AlignmentPad - amount adjusted by AlignUp
+// AlignUp(value, x) == value + AlignmentPad(value, x)
+//
+// AlignDown - align value to given increment, rounding down
+// AlignmentTrim - amount adjusted by AlignDown
+// AlignDown(value, x) == value - AlignmentTrim(value, x)
+// --------------------------------------------------------------------------------
+
+inline UINT AlignUp(UINT value, UINT alignment)
+{
+ STATIC_CONTRACT_LEAF;
+ STATIC_CONTRACT_SO_TOLERANT;
+ STATIC_CONTRACT_SUPPORTS_DAC;
+ return (value+alignment-1)&~(alignment-1);
+}
+
+#if defined(_MSC_VER)
+inline ULONG AlignUp(ULONG value, UINT alignment)
+{
+ STATIC_CONTRACT_LEAF;
+ STATIC_CONTRACT_SO_TOLERANT;
+ STATIC_CONTRACT_SUPPORTS_DAC;
+ return (value+alignment-1)&~(alignment-1);
+}
+#endif
+
+inline UINT64 AlignUp(UINT64 value, UINT alignment)
+{
+ STATIC_CONTRACT_LEAF;
+ STATIC_CONTRACT_SO_TOLERANT;
+ STATIC_CONTRACT_SUPPORTS_DAC;
+ return (value+alignment-1)&~(UINT64)(alignment-1);
+}
+
+inline UINT AlignDown(UINT value, UINT alignment)
+{
+ STATIC_CONTRACT_LEAF;
+ STATIC_CONTRACT_SO_TOLERANT;
+ STATIC_CONTRACT_SUPPORTS_DAC;
+ return (value&~(alignment-1));
+}
+
+#if defined(_MSC_VER)
+inline ULONG AlignDown(ULONG value, UINT alignment)
+{
+ STATIC_CONTRACT_LEAF;
+ STATIC_CONTRACT_SO_TOLERANT;
+ STATIC_CONTRACT_SUPPORTS_DAC;
+ return (value&~(ULONG)(alignment-1));
+}
+#endif
+
+inline UINT64 AlignDown(UINT64 value, UINT alignment)
+{
+ STATIC_CONTRACT_LEAF;
+ STATIC_CONTRACT_SO_TOLERANT;
+ STATIC_CONTRACT_SUPPORTS_DAC;
+ return (value&~(UINT64)(alignment-1));
+}
+
+inline UINT AlignmentPad(UINT value, UINT alignment)
+{
+ STATIC_CONTRACT_WRAPPER;
+ return AlignUp(value, alignment) - value;
+}
+
+#if defined(_MSC_VER)
+inline UINT AlignmentPad(ULONG value, UINT alignment)
+{
+ STATIC_CONTRACT_WRAPPER;
+ return AlignUp(value, alignment) - value;
+}
+#endif
+
+inline UINT AlignmentPad(UINT64 value, UINT alignment)
+{
+ STATIC_CONTRACT_WRAPPER;
+ return (UINT) (AlignUp(value, alignment) - value);
+}
+
+inline UINT AlignmentTrim(UINT value, UINT alignment)
+{
+ STATIC_CONTRACT_LEAF;
+ STATIC_CONTRACT_SO_TOLERANT;
+ STATIC_CONTRACT_SUPPORTS_DAC;
+ return value&(alignment-1);
+}
+
+#ifndef PLATFORM_UNIX
+// For Unix this and the previous function get the same types.
+// So, exclude this one.
+inline UINT AlignmentTrim(ULONG value, UINT alignment)
+{
+ STATIC_CONTRACT_LEAF;
+ STATIC_CONTRACT_SO_TOLERANT;
+ STATIC_CONTRACT_SUPPORTS_DAC;
+ return value&(alignment-1);
+}
+#endif // PLATFORM_UNIX
+
+inline UINT AlignmentTrim(UINT64 value, UINT alignment)
+{
+ STATIC_CONTRACT_LEAF;
+ STATIC_CONTRACT_SO_TOLERANT;
+ STATIC_CONTRACT_SUPPORTS_DAC;
+ return ((UINT)value)&(alignment-1);
+}
+
+#endif // CLRTYPES_H_
diff --git a/src/inc/compatibilityflags.h b/src/inc/compatibilityflags.h
new file mode 100644
index 0000000000..c52e6084f3
--- /dev/null
+++ b/src/inc/compatibilityflags.h
@@ -0,0 +1,17 @@
+// 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.
+
+// Unmanaged enum with compatibility flags. See compatibilityflagsdef.h for more details.
+
+
+#ifndef __COMPATIBILITYFLAGS_H__
+#define __COMPATIBILITYFLAGS_H__
+
+enum CompatibilityFlag {
+#define COMPATFLAGDEF(name) compat##name,
+#include "compatibilityflagsdef.h"
+ compatCount,
+};
+
+#endif // __COMPATIBILITYFLAGS_H__
diff --git a/src/inc/compatibilityflagsdef.h b/src/inc/compatibilityflagsdef.h
new file mode 100644
index 0000000000..611a043f2c
--- /dev/null
+++ b/src/inc/compatibilityflagsdef.h
@@ -0,0 +1,48 @@
+// 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.
+
+// This file contains list of the CLR compatibility flags. The compatibility flags
+// are used to mitigate breaking changes in the platform code. They are used to trigger the legacy
+// behavior.
+
+// The general usage pattern is:
+
+// if (GetCompatibilityFlag(CompatibilityFlag.Foo)) {
+// // the legacy behavior
+// }
+// else {
+// // the new behavior
+// }
+
+// Add your own compatibility flags to the end of the list. You should go through the breaking
+// change approval process before adding it.
+//
+// Do not remove definitions for deprecated compatibility flags. Once the value is
+// assigned to the compatibility flag, it has to be kept forever.
+
+// This file is compiled twice: once to generate managed enum in clr\src\bcl, and second time
+// to generate the unmanaged enum in clr\src\vm.
+
+
+#ifndef COMPATFLAGDEF
+#error You must define COMPATFLAGDEF macro before including compatibilityflagsdef.h
+#endif
+
+COMPATFLAGDEF(SwallowUnhandledExceptions) // Legacy exception handling policy - swallow unhandled exceptions
+
+COMPATFLAGDEF(NullReferenceExceptionOnAV) // Legacy null reference exception policy - throw NullReferenceExceptions for access violations
+
+COMPATFLAGDEF(EagerlyGenerateRandomAsymmKeys) // Legacy mode for DSACryptoServiceProvider/RSACryptoServiceProvider - create a random key in the constructor eagerly
+
+COMPATFLAGDEF(FullTrustListAssembliesInGac) // Legacy mode for not requiring FT list assemblies to be in the GAC - if set, the requirement to be in the GAC would not be enforced.
+
+COMPATFLAGDEF(DateTimeParseIgnorePunctuation) // Through to V1.1, DateTime parse would ignore any unrecognized punctuation.
+ // This flag restores that behavior.
+
+COMPATFLAGDEF(OnlyGACDomainNeutral) // This allows late setting of app domain security and
+ // assembly evidence, even when LoaderOptimization=MultiDomain
+
+COMPATFLAGDEF(DisableReplacementCustomCulture) // This allow disabling replacement custom cultures. will always get the shipped framework culture.
+
+#undef COMPATFLAGDEF
diff --git a/src/inc/complex.h b/src/inc/complex.h
new file mode 100644
index 0000000000..159c81d04b
--- /dev/null
+++ b/src/inc/complex.h
@@ -0,0 +1,80 @@
+// 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.
+//
+// complex.h
+//
+
+//
+// Defines a basic complex number data type. We cannot use the standard C++ library's
+// complex implementation, because the CLR links to the wrong CRT.
+//
+
+#ifndef _COMPLEX_H_
+#define _COMPLEX_H_
+
+#include <math.h>
+
+//
+// Default compilation mode is /fp:precise, which disables fp intrinsics. This causes us to pull in FP stuff (sqrt,etc.) from
+// The CRT, and increases our download size. We don't need the extra precision this gets us, so let's switch to
+// the intrinsic versions.
+//
+#ifdef _MSC_VER
+#pragma float_control(precise, off, push)
+#endif
+
+
+class Complex
+{
+public:
+ double r;
+ double i;
+
+ Complex() : r(0), i(0) {}
+ Complex(double real) : r(real), i(0) {}
+ Complex(double real, double imag) : r(real), i(imag) {}
+ Complex(const Complex& other) : r(other.r), i(other.i) {}
+};
+
+inline Complex operator+(Complex left, Complex right)
+{
+ LIMITED_METHOD_CONTRACT;
+ return Complex(left.r + right.r, left.i + right.i);
+}
+
+inline Complex operator-(Complex left, Complex right)
+{
+ LIMITED_METHOD_CONTRACT;
+ return Complex(left.r - right.r, left.i - right.i);
+}
+
+inline Complex operator*(Complex left, Complex right)
+{
+ LIMITED_METHOD_CONTRACT;
+ return Complex(
+ left.r * right.r - left.i * right.i,
+ left.r * right.i + left.i * right.r);
+}
+
+inline Complex operator/(Complex left, Complex right)
+{
+ LIMITED_METHOD_CONTRACT;
+ double denom = right.r * right.r + right.i * right.i;
+ return Complex(
+ (left.r * right.r + left.i * right.i) / denom,
+ (-left.r * right.i + left.i * right.r) / denom);
+}
+
+inline double abs(Complex c)
+{
+ LIMITED_METHOD_CONTRACT;
+ return sqrt(c.r * c.r + c.i * c.i);
+}
+
+#ifdef _MSC_VER
+#pragma float_control(pop)
+#endif
+
+
+#endif //_COMPLEX_H_
diff --git a/src/inc/configuration.h b/src/inc/configuration.h
new file mode 100644
index 0000000000..d8f8dff72b
--- /dev/null
+++ b/src/inc/configuration.h
@@ -0,0 +1,57 @@
+// 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.
+//
+// --------------------------------------------------------------------------------------------------
+// configuration.h
+//
+//
+// Access and update configuration values, falling back on legacy CLRConfig methods where necessary.
+//
+// --------------------------------------------------------------------------------------------------
+
+#include "clrconfig.h"
+
+#ifndef __configuration_h__
+#define __configuration_h__
+
+class Configuration
+{
+public:
+ static void InitializeConfigurationKnobs(int numberOfConfigs, LPCWSTR *configNames, LPCWSTR *configValues);
+
+ // Returns (in priority order):
+ // - The value of the ConfigDWORDInfo if it's set
+ // - The value of the ConfigurationKnob (searched by name) if it's set (performs a wcstoul).
+ // - The default set in the ConfigDWORDInfo
+ static DWORD GetKnobDWORDValue(LPCWSTR name, const CLRConfig::ConfigDWORDInfo& dwordInfo);
+
+ // Returns (in priority order):
+ // - The value of the ConfigurationKnob (searched by name) if it's set (performs a wcstoul)
+ // - The default value passed in
+ static DWORD GetKnobDWORDValue(LPCWSTR name, DWORD defaultValue);
+
+ // Returns (in priority order):
+ // - The value of the ConfigStringInfo if it's set
+ // - The value of the ConfigurationKnob (searched by name) if it's set
+ // - nullptr
+ static LPCWSTR GetKnobStringValue(LPCWSTR name, const CLRConfig::ConfigStringInfo& stringInfo);
+
+ // Returns (in priority order):
+ // - The value of the ConfigurationKnob (searched by name) if it's set
+ // - nullptr
+ static LPCWSTR GetKnobStringValue(LPCWSTR name);
+
+ // Returns (in priority order):
+ // - The value of the ConfigDWORDInfo if it's set (1 is true, anything else is false)
+ // - The value of the ConfigurationKnob (searched by name) if it's set (performs a wcscmp with "true").
+ // - The default set in the ConfigDWORDInfo (1 is true, anything else is false)
+ static bool GetKnobBooleanValue(LPCWSTR name, const CLRConfig::ConfigDWORDInfo& dwordInfo);
+
+ // Returns (in priority order):
+ // - The value of the ConfigurationKnob (searched by name) if it's set (performs a wcscmp with "true").
+ // - The default value passed in
+ static bool GetKnobBooleanValue(LPCWSTR name, bool defaultValue);
+};
+
+#endif // __configuration_h__
diff --git a/src/inc/contract.h b/src/inc/contract.h
new file mode 100644
index 0000000000..dd66d2a6e0
--- /dev/null
+++ b/src/inc/contract.h
@@ -0,0 +1,2598 @@
+// 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.
+// ---------------------------------------------------------------------------
+// Contract.h
+//
+
+// ! I am the owner for issues in the contract *infrastructure*, not for every
+// ! CONTRACT_VIOLATION dialog that comes up. If you interrupt my work for a routine
+// ! CONTRACT_VIOLATION, you will become the new owner of this file.
+//--------------------------------------------------------------------------------
+// CONTRACTS - User Reference
+//
+// A CONTRACT is a container for a set of checked declarations about a
+// function. Besides giving developers a "laundry list" of checks to
+// make checking more complete, contracts compile these checks
+// as hidden annotations into the checked executable that our static scanner
+// uses to detect violations automatically.
+//
+// Contracts can be dynamic or static. Dynamic contracts perform runtime checks
+// as well as being visible to the static scanner. Static contracts generate no
+// runtime code but are still visible to the scanner. Dynamic contracts are
+// preferred unless perf or other considerations preclude them.
+//
+// The following annotations can appear in contracts:
+//
+//
+// THROWS an exception might be thrown out of the function
+// -or- NOTHROW an exception will NOT be thrown out of the function
+//
+//
+//
+// INJECT_FAULT(statement) function might require its caller to handle an OOM
+// -or- FAULT_FORBID function will NOT require its caller to handle an OOM
+//
+//
+//
+// GC_TRIGGERS the function can trigger a GC
+// -or- GC_NOTRIGGER the function will never trigger a GC provided its
+// called in coop mode.
+//
+//
+// MODE_COOPERATIVE the function requires Cooperative GC mode on entry
+// -or- MODE_PREEMPTIVE the function requires Preemptive GC mode on entry
+// -or- MODE_ANY the function can be entered in either mode
+//
+// LOADS_TYPE(level) the function promises not to load any types beyond "level"
+//
+// SO_INTOLERANT the function cannot tolerate an SO at any point and must run behind an
+// an SO probe via BEGIN_SO_INTOLERANT_XXX. This is the default. We want most
+// of our code to run behind an SO probe. The only time you need to explicitly
+// mark something as SO_INTOLERANT is if the static analysis tool incorrectly
+// flags it as an entry point.
+// -or- SO_TOLERANT the function can tolerate an SO. It either does not update any global state
+// that needs to be cleaned up should a random SO occur, or it protects those
+// updates behind an SO probe.
+// -or- SO_NOT_MAINLINE the function is not hardened to SO and should never run on a managed thread
+// where we need to be hardened to SO. You can use this for functions that run
+// only for ngen or Win9X etc.
+//
+// CAN_TAKE_LOCK the function has a code path that takes a lock
+// _or_ (CAN_TAKE_LOCK and CANNOT_RETAKE_LOCK)
+// the function has a code path that takes a lock, but never tries to reenter
+// locks held at the time this function was called.
+// -or- CANNOT_TAKE_LOCK the function will never allow a lock to be taken
+// -or- the default is WRAPPER(CAN_TAKE_LOCK). i.e., if any callees take locks,
+// then it's ok for this function to as well. If LIMITED_METHOD_CONTRACT is specified,
+// however, then CANNOT_TAKE_LOCK is assumed.
+//
+// EE_THREAD_NOT_REQUIRED the function does not assume an EE Thread object is available in TLS.
+// Either GetThread() is never called, or any code path that requires a Thread
+// has another code path that deals with the absence of a Thread. Any call to
+// to GetThread() must be bracketed with BEGIN_GETTHREAD_ALLOWED /
+// END_GETTHREAD_ALLOWED to avoid bogus asserts (the short-form
+// GetThreadNULLOk() may be used as well). However, this is only allowed if visual
+// inspection of the call site makes it patently obvious that the function deals
+// appropriately with the GetThread() == NULL case.
+// -or- EE_THREAD_REQUIRED the function requires an EE Thread object in TLS (i.e., GetThread() != NULL)
+// If this contract is used, we will ASSERT on entry to the function that
+// GetThread() != NULL.
+// -or- the default is DISABLED(EE_THREAD_REQUIRED). i.e., we do not assert
+// GetThread() != NULL on entry to the function and do not assert on any
+// unprotected uses of GetThread().
+// See code:GetThreadGenericFullCheck for info on how these
+// contracts are enforced.
+//
+// SUPPORTS_DAC The function has been written to be callable from out-of-process using DAC.
+// In builds where DACCESS_COMPILE is defined, such functions can only call
+// other such functions (and a few primitives like new). Functions that support
+// DAC must be carefully written to conform to the rules in daccess.h.
+//
+// SUPPORTS_DAC_HOST_ONLY The function and its call graph has been written to be callable from out of process
+// using DAC, but it differs from SUPPORTS_DAC in that these functions won't perform
+// any marshalling. Because it does no marshalling, SUPPORTS_DAC_HOST_ONLY functions
+// and their call graph won't be checked by DacCop. This should only be used by utility
+// functions which will never marshal anything.
+//
+// PRECONDITION(X) - generic CHECK or BOOL expression which should be true
+// on function entry
+//
+// POSTCONDITION(X) - generic CHECK or BOOL expression which should be true
+// on function entry. Note that variable RETVAL will be
+// available for use in the expression.
+//
+//
+// INSTANCE_CHECK - equivalent of:
+// PRECONDITION(CheckPointer(this));
+// POSTCONDITION(CheckInvariant(this));
+// INSTANCE_CHECK_NULL - equivalent of:
+// PRECONDITION(CheckPointer(this, NULL_OK));
+// POSTCONDITION(CheckInvariant(this, NULL_OK));
+// CONSTRUCTOR_CHECK - equivalent of:
+// POSTCONDITION(CheckPointer(this));
+// DESTRUCTOR_CHECK - equivalent of:
+// PRECONDITION(CheckPointer(this));
+//
+//
+//
+//
+// Contracts come in the following flavors:
+//
+// Dynamic:
+// CONTRACTL the standard version used for all dynamic contracts
+// except those including postconditions.
+//
+// CONTRACT(rettype) an uglier version of CONTRACTL that's unfortunately
+// needed to support postconditions. You must specify
+// the correct return type and it cannot be "void."
+// (Use CONTRACT_VOID instead) You must use the
+// RETURN macro rather than the "return" keyword.
+//
+// CONTRACT_VOID you can't supply "void" to a CONTRACT - use this
+// instead.
+//
+// Static:
+// LIMITED_METHOD_CONTRACT
+// A static contract equivalent to NOTHROW/GC_NOTRIGGER/FORBID_FAULT/MODE_ANY.
+// Use only for trivial functions that call only functions with LIMITED_METHOD_CONTRACTs
+// (as long as there is no cycle that may introduce infinite recursion).
+//
+// STATIC_CONTRACT_THROWS
+// STATIC_CONTRACT_NOTHROW
+// STATIC_CONTRACT_GC_TRIGGERS
+// STATIC_CONTRACT_GCNOTRIGGER
+// STATIC_CONTRACT_FAULT
+// STATIC_CONTRACT_FORBID_FAULT
+// STATIC_CONTRACT_SO_INTOLERANT
+// STATIC_CONTRACT_SO_TOLERANT
+// STATIC_CONTRACT_SO_NOT_MAINLINE
+// use to implement statically checkable contracts
+// when runtime contracts cannot be used.
+//
+//
+// WRAPPER(annotation)
+//
+// When a function does not explicitly caused a condition, use the WRAPPER macro around
+// the declaration. This implies that the function is dependent on the functions it calls
+// for its behaviour, and guarantees nothing.
+//
+//
+// CONTRACT_VIOLATION(violationmask):
+//
+// A bandaid used to suppress contract assertions. A contract violation
+// is always a bug and you're expected to remove it before shipping.
+// If a violation cannot be fixed immediately, however, it's better
+// to use this on the offending callsite than to disable a contract entirely.
+//
+// The violationmask can be one or more of the following OR'd together.
+//
+// ThrowsViolation
+// GCViolation
+// ModeViolation
+// FaultViolation
+// SOToleranceViolation
+// FaultNotFatal
+// HostViolation
+// LoadsTypeViolation
+// TakesLockViolation
+//
+// The associated assertion will be suppressed until you leave the scope
+// containing the CONTRACT_VIOLATION. Note, however, that any called
+// function that redeclares the associated annotation reinstates
+// the assert for the scope of *its* call. This prevents a CONTRACT_VIOLATION
+// placed at the root of a calltree from decimating our entire protection.
+//
+//
+// PERMANENT_CONTRACT_VIOLATION(violationmask, permanentContractViolationReason):
+//
+// Like a CONTRACT_VIOLATION but also indicates that the violation was a deliberate decision
+// and we don't plan on removing the violation in the next release. The reason
+// for the violation should be given as the second parameter to the macro. Reasons
+// are currently for documentation purposes only and do not have an effect on the binary.
+// Valid values are listed below in the definition of PermanentContractViolationReason.
+//
+//
+// CONDITIONAL_CONTRACT_VIOLATION(violationmask, condition):
+//
+// Similar to CONTRACT_VIOLATION, but only suppresses the contract if the
+// condition evaluates to non-zero. The need for this macro should be very
+// rare, but it can be useful if a contract should be suppressed based on a
+// condition known only at run-time. For example, if a particular test causes
+// call sequences never expected by real scenarios, you may want to suppress
+// resulting violations, but only when that test is run.
+//
+// WRAPPER_NO_CONTRACT
+//
+// A do-nothing contract used by functions that trivially wrap another.
+//
+//
+// "LEGACY" stuff - these features have been mostly superceded by better solutions
+// so their use should be discouraged.
+//
+//
+// DISABLED(annotation)
+//
+// Indicates that a condition is supposed to be checked but is being suppressed
+// due to some temporary bug. The more surgical CONTRACT_VIOLATION is
+// preferred over DISABLED.
+//
+// UNCHECKED(annotation)
+//
+// Indicates that a condition is supposed to be checked but is being suppressed
+// due for perf reasons. Use STATIC_CONTRACT over this.
+//
+//
+// Default values:
+// If you don't specify certain annotaions, you get defaults.
+// - THROWS/NOTHROW defaults to THROWS
+// - GCTRIGGERS/GCNOTRIGGER defaults to GCTRIGGERS within the VM directory
+// and to no check otherwise
+// - INJECT/FORBID_FAULT defaults to no check
+// - MODE defaults to MODE_ANY
+//
+// The problem is that defaults don't work well with static contracts.
+// The scanner will always treat a missing annotation as DISABLED.
+// New code should not rely on defaults. Explicitly state your invariants.
+//
+//
+//--------------------------------------------------------------------------------
+
+
+
+
+#ifndef CONTRACT_H_
+#define CONTRACT_H_
+
+#ifdef _MSC_VER
+#pragma warning(disable:4189) //local variable is initialized but not referenced
+#endif
+
+
+// We only enable contracts in _DEBUG builds
+#if defined(_DEBUG) && !defined(DISABLE_CONTRACTS)
+#define ENABLE_CONTRACTS_DATA
+#endif
+
+// Also, we won't enable contracts if this is a DAC build.
+// @ARMTODO: Disable for ARM for now, contracts slow down the debug build far too much
+#if defined(ENABLE_CONTRACTS_DATA) && !defined(DACCESS_COMPILE) && !defined(CROSS_COMPILE) && !defined(_TARGET_ARM_)
+#define ENABLE_CONTRACTS
+#endif
+
+// Finally, only define the implementaiton parts of contracts if this isn't a DAC build.
+#if defined(_DEBUG_IMPL) && defined(ENABLE_CONTRACTS)
+#define ENABLE_CONTRACTS_IMPL
+#endif
+
+#include "specstrings.h"
+#include "clrtypes.h"
+#include "malloc.h"
+#include "check.h"
+#include "debugreturn.h"
+#include "staticcontract.h"
+
+#ifdef ENABLE_CONTRACTS_DATA
+
+#include "eh.h"
+
+// We chain these onto a stack to give us a stack trace of contract assertions (useful
+// when the bug report doesn't contain valid symbols)
+
+struct ContractStackRecord
+{
+ ContractStackRecord *m_pNext;
+ const char *m_szFunction;
+ const char *m_szFile;
+ int m_lineNum;
+ UINT m_testmask; // Bitmask of Contract::TestEnum bitsf
+ const char *m_construct; // The syntactic construct that pushed this thing
+};
+
+class CrstBase;
+
+// The next few enums / structs are used to keep track of all kinds of locks
+// currently taken by the current thread (crsts, spinlocks, CLR critical sections).
+// Across the VM, there are still multiple counts of locks. The lock counts in these
+// contract structs are used to verify consistency of lock take/release in EE code, and
+// for contracts. Both user and EE locks are tracked here, but it's EE code consistency
+// we're verifying. The Thread object keeps its own counts as well, primarily of user
+// locks for implementing thread abort & escalation policy. We tried to have the Thread
+// counts also be used for consistency checking, but that doesn't work. Thread counters
+// have the following behavior that hurts our internal consistency checks:
+// - They only count user locks.
+// - Counters are reset & restored as we leave and return to AppDomains
+
+// An array of these is stored in DbgStateLockData::m_rgTakenLockInfos
+// to remember which locks we've taken. If you hit an assert that
+// indicates we're exiting locks in the wrong order, or that locks were
+// taken when we expected none to be taken, then you can use
+// DbgStateLockData::m_rgTakenLockInfos to see the locks we know about.
+struct TakenLockInfo
+{
+ // Generally, this will be a pointer to the lock, but really it's just
+ // a value that identifies which lock is taken. Ya see, sometimes we don't
+ // have a lock pointer handy (e.g., if the lock is based on a GC object,
+ // which has no persistent object pointer we can use). Look at the source
+ // indicated by m_szFile / m_lineNum to see what was specified as m_pvLock.
+ //
+ // A common case is that the lock is just a Crst, so to aid debugging, we
+ // also include a statically typed version of this pointer (m_pCrstBase) just
+ // for Crsts. Again, you'll want look at m_szFile / m_lineNum to see how to
+ // interpret this union.
+ union
+ {
+ void * m_pvLock;
+ CrstBase * m_pCrstBase;
+ };
+
+ // File & line of the *LOCK_TAKEN* macro that added this lock to our list
+ const char * m_szFile;
+ int m_lineNum;
+};
+
+enum DbgStateLockType
+{
+ // EE locks (used to sync EE structures). These do not include
+ // CRST_HOST_BREAKABLE Crsts, and are thus not held while managed
+ // code runs
+ kDbgStateLockType_EE,
+
+ // CRST_HOST_BREAKABLE Crsts. These can be held while arbitrary
+ // managed code runs.
+ kDbgStateLockType_HostBreakableCrst,
+
+ // User locks (e.g., Monitor.Enter, ReaderWriterLock class)
+ kDbgStateLockType_User,
+
+ // add more lock types here
+
+ kDbgStateLockType_Count
+};
+
+// This keeps track of how many locks, and which locks, are currently owned
+// by the current thread. There is one instance of this structure per
+// thread (no EE Thread object required). This is in contrast to the
+// ClrDebugState structure, which is instantiated once per function
+// on the stack. Reason is that ClrDebugState resets its state on exit
+// of function (Contract destructor reinstates previous ClrDebugState), whereas
+// we want DbgStateLockData to persist across function enters & exits.
+struct DbgStateLockData
+{
+ // When a lock is taken, we keep track of its pointer and file/line# when it
+ // was added in a static-size array DbgStateLockData::m_rgTakenLockInfos. This is
+ // the size of that array, and therefore indicates the maximum number of locks we
+ // expect one thread to hold at the same time. If we should exceed this limit,
+ // we'll lose this data for the latter locks that exceed this limit
+ // (though still maintaining an accurate *count* of locks).
+ static const int kMaxAllowedSimultaneousLocks = 20;
+
+ // Count of locks taken, separately by type
+ UINT m_rgcLocksTaken[kDbgStateLockType_Count];
+
+ // List of the specific locks that have been taken (all DbgStateLockTypes
+ // intermingled), in the order they were taken. If we exceed the elements
+ // in the array, we just won't track the latter locks in here (though they are
+ // included in the counts above)
+ TakenLockInfo m_rgTakenLockInfos[kMaxAllowedSimultaneousLocks];
+
+ void SetStartingValues();
+ void LockTaken(DbgStateLockType dbgStateLockType,
+ UINT cEntrances,
+ void * pvLock,
+ __in_z const char * szFunction,
+ __in_z const char * szFile,
+ int lineNum);
+ void LockReleased(DbgStateLockType dbgStateLockType, UINT cExits, void * pvLock);
+ UINT GetLockCount(DbgStateLockType dbgStateLockType);
+ UINT GetCombinedLockCount();
+};
+
+// This struct contains all lock contract information. It is created and destroyed along with
+// ClrDebugState. m_pLockData points to a DbgStateLockData object that is allocated per thread
+// and persists across function enters and exists.
+struct DbgStateLockState
+{
+private:
+ // Count of locks taken at the time the function with CANNOT_RETAKE_LOCK contract
+ // was called
+ UINT m_cLocksEnteringCannotRetakeLock;
+
+ DbgStateLockData * m_pLockData; // How many and which locks are currently taken on this thread
+
+public:
+ void SetStartingValues();
+ void OnEnterCannotRetakeLockFunction();
+ BOOL IsLockRetaken(void * pvLock);
+ BOOL IsSafeToRelease(UINT cReleases);
+ void SetDbgStateLockData(DbgStateLockData * pDbgStateLockData);
+ DbgStateLockData * GetDbgStateLockData();
+};
+
+
+#define CONTRACT_BITMASK_OK_TO_THROW 0x1 << 0
+#define CONTRACT_BITMASK_FAULT_FORBID 0x1 << 1
+#define CONTRACT_BITMASK_HOSTCALLS 0x1 << 2
+#define CONTRACT_BITMASK_SOTOLERANT 0x1 << 3
+#define CONTRACT_BITMASK_DEBUGONLY 0x1 << 4
+#define CONTRACT_BITMASK_SONOTMAINLINE 0x1 << 5
+#define CONTRACT_BITMASK_ALLOWGETTHREAD 0x1 << 6
+#define CONTRACT_BITMASK_OK_TO_LOCK 0x1 << 7
+#define CONTRACT_BITMASK_OK_TO_RETAKE_LOCK 0x1 << 8
+
+
+#define CONTRACT_BITMASK_IS_SET(whichbit) ((m_flags & (whichbit)) != 0)
+#define CONTRACT_BITMASK_SET(whichbit) (m_flags |= (whichbit))
+#define CONTRACT_BITMASK_RESET(whichbit) (m_flags &= ~(whichbit))
+#define CONTRACT_BITMASK_UPDATE(whichbit, value) ((value)?CONTRACT_BITMASK_SET(whichbit):CONTRACT_BITMASK_RESET(whichbit))
+
+
+// Stored in the FLS under TlsIdx_ClrDebugState.
+struct ClrDebugState
+{
+private:
+ UINT_PTR m_flags;
+ UINT_PTR m_violationmask; // Current CONTRACT_VIOLATIONS in effect
+ ContractStackRecord *m_pContractStackTrace;
+ UINT m_GCNoTriggerCount;
+ UINT m_GCForbidCount;
+ UINT m_maxLoadTypeLevel; // taken from enum ClassLoadLevel
+ BOOL m_allowGetThread; // TRUE if GetThread() is ok in this scope
+#ifdef FEATURE_STACK_PROBE //StackMarkerStack required only when SO infrastructure is enabled
+ /* Used to validate backout stack consumption required for StackOverflow infrastructure */
+ StackMarkerStack m_StackMarkerStack; // The stack of stack markers
+#endif
+ DbgStateLockState m_LockState;
+
+public:
+ // Use an explicit Init rather than ctor as we don't want automatic
+ // construction of the ClrDebugState embedded inside the contract.
+ void SetStartingValues()
+ {
+ m_violationmask = 0; // No violations allowed
+
+ // Default is we're in a THROWS scope. This is not ideal, but there are
+ // just too many places that I'd have to go clean up right now
+ // (hundreds) in order to make this FALSE by default.
+ // Faults not forbidden (an unfortunate default but
+ // we'd never get this debug infrastructure bootstrapped otherwise.)
+ // We start out in SO-tolerant mode and must probe before entering SO-intolerant
+ // any global state updates.
+ // Initial mode is non-debug until we say otherwise
+ // Everthing defaults to mainline
+ // By default, GetThread() is perfectly fine to call
+ // By default, it's ok to take a lock (or call someone who does)
+ m_flags = CONTRACT_BITMASK_OK_TO_THROW|
+ CONTRACT_BITMASK_HOSTCALLS|
+ CONTRACT_BITMASK_SOTOLERANT|
+ CONTRACT_BITMASK_ALLOWGETTHREAD|
+ CONTRACT_BITMASK_OK_TO_LOCK|
+ CONTRACT_BITMASK_OK_TO_RETAKE_LOCK;
+
+ m_pContractStackTrace = NULL; // At top of stack, no contracts in force
+ m_GCNoTriggerCount = 0;
+ m_GCForbidCount = 0;
+
+ m_maxLoadTypeLevel = ((UINT)(-1)); // ideally CLASS_LOAD_LEVEL_FINAL but we don't have access to that #define, so
+ // the max integer value will do as a substitute.
+
+ m_allowGetThread = TRUE; // By default, GetThread() is perfectly fine to call
+
+#ifdef FEATURE_STACK_PROBE
+ m_StackMarkerStack.Init();
+#endif
+
+ m_LockState.SetStartingValues();
+ }
+
+ void CheckOkayToThrow(__in_z const char *szFunction, __in_z const char *szFile, int lineNum); // Asserts if its not okay to throw.
+ BOOL CheckOkayToThrowNoAssert(); // Returns if OK to throw
+
+ //--//
+
+ UINT_PTR* ViolationMaskPtr()
+ {
+ return &m_violationmask;
+ }
+
+ UINT_PTR ViolationMask()
+ {
+ return m_violationmask;
+ }
+
+ void ViolationMaskSet( UINT_PTR value )
+ {
+ m_violationmask |= value;
+ }
+
+ void ViolationMaskReset( UINT_PTR value )
+ {
+ m_violationmask &= ~value;
+ }
+
+ //--//
+
+ BOOL IsOkToThrow()
+ {
+ return CONTRACT_BITMASK_IS_SET(CONTRACT_BITMASK_OK_TO_THROW);
+ }
+
+ void SetOkToThrow()
+ {
+ CONTRACT_BITMASK_SET(CONTRACT_BITMASK_OK_TO_THROW);
+ }
+
+ BOOL SetOkToThrow( BOOL value )
+ {
+ BOOL prevState = CONTRACT_BITMASK_IS_SET(CONTRACT_BITMASK_OK_TO_THROW);
+ CONTRACT_BITMASK_UPDATE(CONTRACT_BITMASK_OK_TO_THROW, value);
+ return prevState;
+ }
+
+ void ResetOkToThrow()
+ {
+ CONTRACT_BITMASK_RESET(CONTRACT_BITMASK_OK_TO_THROW);
+ }
+ //--//
+
+ BOOL IsFaultForbid()
+ {
+ return CONTRACT_BITMASK_IS_SET(CONTRACT_BITMASK_FAULT_FORBID);
+ }
+
+
+ void SetFaultForbid()
+ {
+ CONTRACT_BITMASK_SET(CONTRACT_BITMASK_FAULT_FORBID);
+ }
+
+ BOOL SetFaultForbid(BOOL value)
+ {
+ BOOL prevState = CONTRACT_BITMASK_IS_SET(CONTRACT_BITMASK_FAULT_FORBID);
+ CONTRACT_BITMASK_UPDATE(CONTRACT_BITMASK_FAULT_FORBID, value);
+ return prevState;
+ }
+
+ void ResetFaultForbid()
+ {
+ CONTRACT_BITMASK_RESET(CONTRACT_BITMASK_FAULT_FORBID);
+ }
+
+ //--//
+ BOOL IsHostCaller()
+ {
+ return CONTRACT_BITMASK_IS_SET(CONTRACT_BITMASK_HOSTCALLS);
+ }
+
+ void SetHostCaller()
+ {
+ CONTRACT_BITMASK_SET(CONTRACT_BITMASK_HOSTCALLS);
+ }
+
+
+ BOOL SetHostCaller(BOOL value)
+ {
+ BOOL prevState = CONTRACT_BITMASK_IS_SET(CONTRACT_BITMASK_HOSTCALLS);
+ CONTRACT_BITMASK_UPDATE(CONTRACT_BITMASK_HOSTCALLS,value);
+ return prevState;
+ }
+
+ void ResetHostCaller()
+ {
+ CONTRACT_BITMASK_RESET(CONTRACT_BITMASK_HOSTCALLS);
+ }
+
+#ifdef FEATURE_STACK_PROBE //SO contract functions only required when SO infrastructure is enabled
+ //--//
+ BOOL IsSOTolerant()
+ {
+ return CONTRACT_BITMASK_IS_SET(CONTRACT_BITMASK_SOTOLERANT);
+ }
+
+ void SetSOTolerance()
+ {
+ CONTRACT_BITMASK_SET(CONTRACT_BITMASK_SOTOLERANT);
+ }
+
+ BOOL SetSOTolerance(BOOL tolerance)
+ {
+ BOOL prevState = CONTRACT_BITMASK_IS_SET(CONTRACT_BITMASK_SOTOLERANT);
+ CONTRACT_BITMASK_UPDATE(CONTRACT_BITMASK_SOTOLERANT,tolerance);
+ return prevState;
+ }
+
+ void ResetSOTolerance()
+ {
+ CONTRACT_BITMASK_RESET(CONTRACT_BITMASK_SOTOLERANT);
+ }
+
+#endif
+
+ //--//
+ BOOL IsDebugOnly()
+ {
+ STATIC_CONTRACT_WRAPPER;
+ return CONTRACT_BITMASK_IS_SET(CONTRACT_BITMASK_DEBUGONLY);
+ }
+
+ void SetDebugOnly()
+ {
+ STATIC_CONTRACT_WRAPPER;
+ CONTRACT_BITMASK_SET(CONTRACT_BITMASK_DEBUGONLY);
+ }
+
+ BOOL SetDebugOnly(BOOL value)
+ {
+ STATIC_CONTRACT_WRAPPER;
+ BOOL prevState = CONTRACT_BITMASK_IS_SET(CONTRACT_BITMASK_DEBUGONLY);
+ CONTRACT_BITMASK_UPDATE(CONTRACT_BITMASK_DEBUGONLY,value);
+ return prevState;
+ }
+
+ void ResetDebugOnly()
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ CONTRACT_BITMASK_RESET(CONTRACT_BITMASK_DEBUGONLY);
+ }
+
+ #ifdef FEATURE_STACK_PROBE
+ //--//
+ BOOL IsSONotMainline()
+ {
+ return CONTRACT_BITMASK_IS_SET(CONTRACT_BITMASK_SONOTMAINLINE);
+ }
+
+ void SetSONotMainline()
+ {
+ CONTRACT_BITMASK_SET(CONTRACT_BITMASK_SONOTMAINLINE);
+ }
+
+ BOOL SetSONotMainline(BOOL value)
+ {
+ BOOL prevState = CONTRACT_BITMASK_IS_SET(CONTRACT_BITMASK_SONOTMAINLINE);
+ CONTRACT_BITMASK_UPDATE(CONTRACT_BITMASK_SONOTMAINLINE,value);
+ return prevState;
+ }
+
+ void ResetSONotMainline()
+ {
+ CONTRACT_BITMASK_RESET(CONTRACT_BITMASK_SONOTMAINLINE);
+ }
+#endif
+
+ //--//
+ BOOL IsGetThreadAllowed()
+ {
+ return CONTRACT_BITMASK_IS_SET(CONTRACT_BITMASK_ALLOWGETTHREAD);
+
+ }
+ void SetGetThreadAllowed()
+ {
+ CONTRACT_BITMASK_SET(CONTRACT_BITMASK_ALLOWGETTHREAD);
+ }
+
+
+ BOOL SetGetThreadAllowed(BOOL value)
+ {
+ BOOL prevState = CONTRACT_BITMASK_IS_SET(CONTRACT_BITMASK_ALLOWGETTHREAD);
+ CONTRACT_BITMASK_UPDATE(CONTRACT_BITMASK_ALLOWGETTHREAD,value);
+ return prevState;
+ }
+
+ void ResetGetThreadAllowed()
+ {
+ CONTRACT_BITMASK_RESET(CONTRACT_BITMASK_ALLOWGETTHREAD);
+ }
+
+ //--//
+ BOOL IsOkToLock()
+ {
+ return CONTRACT_BITMASK_IS_SET(CONTRACT_BITMASK_OK_TO_LOCK);
+ }
+
+ void SetOkToLock()
+ {
+ CONTRACT_BITMASK_SET(CONTRACT_BITMASK_OK_TO_LOCK);
+ }
+
+ BOOL SetOkToLock( BOOL value )
+ {
+ BOOL prevState = CONTRACT_BITMASK_IS_SET(CONTRACT_BITMASK_OK_TO_LOCK);
+ CONTRACT_BITMASK_UPDATE(CONTRACT_BITMASK_OK_TO_LOCK, value);
+ return prevState;
+ }
+
+ void ResetOkToLock()
+ {
+ CONTRACT_BITMASK_RESET(CONTRACT_BITMASK_OK_TO_LOCK);
+ }
+
+ //--//
+ BOOL IsOkToRetakeLock()
+ {
+ return CONTRACT_BITMASK_IS_SET(CONTRACT_BITMASK_OK_TO_RETAKE_LOCK);
+ }
+
+ void ResetOkToRetakeLock()
+ {
+ CONTRACT_BITMASK_RESET(CONTRACT_BITMASK_OK_TO_RETAKE_LOCK);
+ }
+
+
+ //--//
+ void LinkContractStackTrace( ContractStackRecord* pContractStackTrace )
+ {
+ pContractStackTrace->m_pNext = m_pContractStackTrace;
+
+ m_pContractStackTrace = pContractStackTrace;
+ }
+
+ ContractStackRecord* GetContractStackTrace()
+ {
+ return m_pContractStackTrace;
+ }
+
+ void SetContractStackTrace(ContractStackRecord* pContractStackTrace )
+ {
+ m_pContractStackTrace = pContractStackTrace;
+ }
+
+ //--//
+
+ UINT GetGCNoTriggerCount()
+ {
+ return m_GCNoTriggerCount;
+ }
+
+ void DecrementGCNoTriggerCount()
+ {
+ m_GCNoTriggerCount--;
+ }
+
+ void IncrementGCNoTriggerCount()
+ {
+ m_GCNoTriggerCount++;
+ }
+
+
+ UINT GetGCForbidCount()
+ {
+ return m_GCForbidCount;
+ }
+
+ void DecrementGCForbidCount()
+ {
+ m_GCForbidCount--;
+ }
+
+ void IncrementGCForbidCount()
+ {
+ m_GCForbidCount++;
+ }
+
+ UINT GetMaxLoadTypeLevel()
+ {
+ return m_maxLoadTypeLevel;
+ }
+
+ void SetMaxLoadTypeLevel(UINT newLevel)
+ {
+ m_maxLoadTypeLevel = newLevel;
+ }
+
+ //--//
+
+ void SetDbgStateLockData(DbgStateLockData * pDbgStateLockData)
+ {
+ m_LockState.SetDbgStateLockData(pDbgStateLockData);
+ }
+
+ DbgStateLockData * GetDbgStateLockData()
+ {
+ return m_LockState.GetDbgStateLockData();
+ }
+
+ void OnEnterCannotRetakeLockFunction()
+ {
+ m_LockState.OnEnterCannotRetakeLockFunction();
+ }
+
+#ifdef FEATURE_STACK_PROBE //SO contract functions only required when SO infrastructure is enabled
+ BOOL IsSOIntolerant()
+ {
+ return !IsSOTolerant();
+ }
+
+ BOOL BeginSOTolerant()
+ {
+ return SetSOTolerance(TRUE);
+ }
+
+ BOOL BeginSOIntolerant()
+ {
+ return SetSOTolerance(FALSE);
+ }
+
+
+ void CheckIfSOIntolerantOK(const char *szFunction, const char *szFile, int lineNum);
+
+
+
+
+
+ //--//
+
+ StackMarkerStack& GetStackMarkerStack()
+ {
+ return m_StackMarkerStack;
+ }
+#endif
+
+ void CheckOkayToLock(__in_z const char *szFunction, __in_z const char *szFile, int lineNum); // Asserts if its not okay to lock
+ BOOL CheckOkayToLockNoAssert(); // Returns if OK to lock
+ void LockTaken(DbgStateLockType dbgStateLockType,
+ UINT cEntrances,
+ void * pvLock,
+ __in_z const char * szFunction,
+ __in_z const char * szFile,
+ int lineNum);
+ void LockReleased(DbgStateLockType dbgStateLockType, UINT cExits, void * pvLock);
+ UINT GetLockCount(DbgStateLockType dbgStateLockType);
+ UINT GetCombinedLockCount();
+};
+
+#endif // ENABLE_CONTRACTS
+
+#ifdef ENABLE_CONTRACTS_IMPL
+// Create ClrDebugState.
+// This routine is not allowed to return NULL. If it can't allocate the memory needed,
+// it should return a pointer to a global static ClrDebugState that indicates
+// that debug assertions should be skipped.
+ClrDebugState *CLRInitDebugState();
+ClrDebugState *GetClrDebugState(BOOL fAlloc = TRUE);
+
+
+// This function returns a ClrDebugState if one has been created, but will not create one itself.
+inline ClrDebugState *CheckClrDebugState()
+{
+ STATIC_CONTRACT_LIMITED_METHOD;
+ STATIC_CONTRACT_SO_TOLERANT;
+ ClrDebugState *ret = (ClrDebugState*)ClrFlsGetValue(TlsIdx_ClrDebugState);
+ return ret;
+}
+
+void CONTRACT_ASSERT(const char *szElaboration,
+ UINT whichTest,
+ UINT whichTestMask,
+ const char *szFunction,
+ const char *szFile,
+ int lineNum
+ );
+
+#endif
+
+// This needs to be defined up here b/c it is used by ASSERT_CHECK which is used by the contract impl
+#ifdef _DEBUG
+#ifdef ENTER_DEBUG_ONLY_CODE
+#undef ENTER_DEBUG_ONLY_CODE
+#endif
+#ifdef LEAVE_DEBUG_ONLY_CODE
+#undef LEAVE_DEBUG_ONLY_CODE
+#endif
+
+#ifdef ENABLE_CONTRACTS_IMPL
+// This can only appear in a debug function so don't define it non-debug
+class DebugOnlyCodeHolder
+{
+public:
+ // We use GetClrDebugState on entry, but CheckClrDebugState on Leave
+ // That way we make sure to create one if we need to set state, but
+ // we don't recreated one on exit if its been deleted.
+ DEBUG_NOINLINE void Enter()
+ {
+ SCAN_SCOPE_BEGIN;
+ STATIC_CONTRACT_DEBUG_ONLY;
+
+ m_pClrDebugState = GetClrDebugState();
+ if (m_pClrDebugState)
+ {
+ m_oldDebugOnlyValue = m_pClrDebugState->IsDebugOnly();
+ m_pClrDebugState->SetDebugOnly();
+ }
+ }
+
+ DEBUG_NOINLINE void Leave()
+ {
+ SCAN_SCOPE_END;
+ STATIC_CONTRACT_DEBUG_ONLY;
+
+ m_pClrDebugState = CheckClrDebugState();
+ if (m_pClrDebugState)
+ {
+ m_pClrDebugState->SetDebugOnly( m_oldDebugOnlyValue );
+ }
+ }
+
+private:
+BOOL m_oldDebugOnlyValue;
+ClrDebugState *m_pClrDebugState;
+};
+
+#define ENTER_DEBUG_ONLY_CODE \
+ DebugOnlyCodeHolder __debugOnlyCodeHolder; \
+ __debugOnlyCodeHolder.Enter();
+
+#define LEAVE_DEBUG_ONLY_CODE \
+ __debugOnlyCodeHolder.Leave();
+
+
+class AutoCleanupDebugOnlyCodeHolder : public DebugOnlyCodeHolder
+{
+public:
+ DEBUG_NOINLINE AutoCleanupDebugOnlyCodeHolder()
+ {
+ SCAN_SCOPE_BEGIN;
+ STATIC_CONTRACT_DEBUG_ONLY;
+
+ Enter();
+ };
+
+ DEBUG_NOINLINE ~AutoCleanupDebugOnlyCodeHolder()
+ {
+ SCAN_SCOPE_END;
+
+ Leave();
+ };
+};
+
+#define DEBUG_ONLY_FUNCTION \
+ STATIC_CONTRACT_DEBUG_ONLY; \
+ AutoCleanupDebugOnlyCodeHolder __debugOnlyCodeHolder;
+
+#define DEBUG_ONLY_REGION() \
+ AutoCleanupDebugOnlyCodeHolder __debugOnlyCodeHolder;
+
+
+#define BEGIN_DEBUG_ONLY_CODE \
+ { \
+ AutoCleanupDebugOnlyCodeHolder __debugOnlyCodeHolder;
+
+#define END_DEBUG_ONLY_CODE \
+ }
+
+#else // ENABLE_CONTRACTS_IMPL
+#define DEBUG_ONLY_FUNCTION STATIC_CONTRACT_DEBUG_ONLY
+#define DEBUG_ONLY_REGION()
+#define BEGIN_DEBUG_ONLY_CODE
+#define END_DEBUG_ONLY_CODE
+#define ENTER_DEBUG_ONLY_CODE
+#define LEAVE_DEBUG_ONLY_CODE
+#endif
+
+#else // _DEBUG
+#define DEBUG_ONLY_REGION()
+#endif
+
+
+#ifdef ENABLE_CONTRACTS_IMPL
+
+// These helpers encapsulate our access to our FLS debug state. To improve
+// contract perf, we'll soon move these to a private alloced block
+// so we can reuse the pointer instead of constantly refetching it.
+// Thus, these helpers are just to bridge this transition.
+inline LPVOID GetViolationMask()
+{
+ ClrDebugState *pState = CheckClrDebugState();
+ if (pState)
+ {
+ return (LPVOID)pState->ViolationMask();
+ }
+ else
+ {
+ return 0;
+ }
+}
+
+// This is the default binding of the MAYBETEMPLATE identifier,
+// used in the RETURN macro
+template <int DUMMY>
+class ___maybetemplate
+{
+ public:
+ FORCEINLINE void *operator new (size_t size)
+ {
+ return NULL;
+ }
+};
+
+// This is an abstract base class for contracts. The main reason we have this is so that the dtor for many derived class can
+// be performant. If this class was not abstract and had a dtor, then the dtor for the derived class adds EH overhead (even if the derived
+// class did not anything special in its dtor)
+class BaseContract
+{
+ // Really private, but used by macros
+ public:
+
+ // We use a single integer to specify all the settings for intrinsic tests
+ // such as THROWS and GC_TRIGGERS. The compiler should be able to fold all
+ // these clauses into a single constant.
+ //
+ // The value "0" is significant as this is what the entire mask will be initialized to
+ // in the absence of any clauses. Hence, whichever value is assigned "0" will be the
+ // default setting for the test.
+ //
+ // Also, there must be a "disabled" setting for each category in order to support
+ // the DISABLED macro.
+ enum TestEnum
+ {
+ THROWS_Mask = 0x00000003,
+ THROWS_Yes = 0x00000000, // the default
+ THROWS_No = 0x00000001,
+ THROWS_Disabled = 0x00000002,
+
+ GC_Mask = 0x0000000C,
+ GC_Triggers = 0x00000000, // the default
+ GC_NoTrigger = 0x00000004,
+ GC_Disabled = 0x00000008,
+
+ FAULT_Mask = 0x00000030,
+ FAULT_Disabled = 0x00000000, // the default
+ FAULT_Inject = 0x00000010,
+ FAULT_Forbid = 0x00000020,
+
+ MODE_Mask = 0x000000C0,
+ MODE_Disabled = 0x00000000, // the default
+ MODE_Preempt = 0x00000040,
+ MODE_Coop = 0x00000080,
+
+ // The following are used to assert the type of global state update being done by the function.
+ // This is used by the SO infrastructure to detect if we are probing properly. A CLR process will
+ // run in one of two states: SO-tolerant or SO-intolerant. In SO-tolerant mode, an SO is OK and we
+ // will not corrupt any global state. However, we cannot allow an SO to occur in SO-intolerant code
+ // because we might end up with our global state being corrupted.
+ //
+ // When we enter the EE from any entry point, we will begin in SO-tolerant mode and must probe for sufficient
+ // stack before entering SO-intolerant code. We will tell the differnce between SO-tolerant and SO-intolerant code
+ // by contract annotations on that function: SO_TOLERANT and SO_INTOLERANT.
+
+ // We enter the EE in SO_TOLERANT mode. All entry point functions into the EE must be marked as SO_TOLERANT and
+ // and must probe before calling an SO-intolerant function. We have a static analsysis tool that ensures that every
+ // entry point is tagged as SO_TOLERANT and that it probes before calling an SO_TOLERANT function.
+
+ // By default, all unannotated functions in the EE are SO_INTOLERANT which means that they must run behind a probe.
+ // Our contract checking will verify this at runtime. We only need to annotate a function explicilty as SO_INTOLERANT
+ // to tell our static analysis tool that they are not entry points (if it can't find a caller for a function, it assumes that the
+ // function is an entry point and should be marked SO_INTOLERANT.)
+
+ SO_TOLERANCE_Mask = 0x00000300,
+ SO_TOLERANT_No = 0x00000000, // the default.
+ SO_TOLERANT_Yes = 0x00000100,
+ SO_TOLERANCE_Disabled = 0x00000200,
+
+ DEBUG_ONLY_Yes = 0x00000400, // code runs under debug only
+
+ SO_MAINLINE_No = 0x00000800, // code is not part of our mainline SO scenario
+
+ // Any place where we can't safely call into the host should have a HOST_NoCalls contract
+ HOST_Mask = 0x00003000,
+ HOST_Calls = 0x00002000,
+ HOST_NoCalls = 0x00001000,
+ HOST_Disabled = 0x00000000, // the default
+
+ // This enforces the EE_THREAD_NOT_REQUIRED contract by clearing
+ // ClrDebugState::m_allowGetThread in its scope. That causes raw calls
+ // to GetThread() to assert, unless inside a temporary "don't worry it's ok" scope
+ // via BEGIN/END_GETTHREAD_ALLOWED. Useful for enforcing our docs that
+ // state certain unmanaged API entrypoints (e.g., some from profiling API)
+ // are callable without an EE Thread in TLS.
+ EE_THREAD_Mask = 0x0000C000,
+ EE_THREAD_Disabled = 0x00000000, // the default
+ EE_THREAD_Required = 0x00004000,
+ EE_THREAD_Not_Required = 0x00008000,
+
+ // These enforce the CAN_TAKE_LOCK / CANNOT_TAKE_LOCK contracts
+ CAN_TAKE_LOCK_Mask = 0x00060000,
+ CAN_TAKE_LOCK_Yes = 0x00020000,
+ CAN_TAKE_LOCK_No = 0x00040000,
+ CAN_TAKE_LOCK_Disabled = 0x00000000, // the default
+
+ // These enforce the CANNOT_RETAKE_LOCK contract
+ CAN_RETAKE_LOCK_No = 0x00080000,
+ CAN_RETAKE_LOCK_No_Disabled = 0x00000000, // the default
+
+ PRECONDITION_Used = 0x00010000, // a PRECONDITION appeared inside the contract
+
+ // IMPORTANT!!! LOADS_TYPE_Mask and LOADS_TYPE_Shift must be kept in sync.
+ LOADS_TYPE_Mask = 0x00f00000, // the max loadstype level + 1 ("+1" because 0 is reserved for the default which is "disabled")
+ LOADS_TYPE_Shift = 20, // # of bits to right-shift to get loadstype bits to rightmost position.
+ LOADS_TYPE_Disabled = 0x00000000, // the default
+
+ ALL_Disabled = THROWS_Disabled|GC_Disabled|FAULT_Disabled|MODE_Disabled|LOADS_TYPE_Disabled|
+ SO_TOLERANCE_Disabled|HOST_Disabled|EE_THREAD_Disabled|CAN_TAKE_LOCK_Disabled|CAN_RETAKE_LOCK_No_Disabled
+
+ };
+
+ enum Operation
+ {
+ Setup = 0x01,
+ Preconditions = 0x02,
+ Postconditions = 0x04,
+ };
+
+
+ __declspec(nothrow) BaseContract() : m_pClrDebugState(NULL), m_testmask(0)
+ {
+ }
+ __declspec(nothrow) void Restore()
+ {
+ // m_pClrDebugState is setup in BaseContract::DoChecks. If an SO happens after the
+ // BaseContract object is constructed but before DoChecks is invoked, m_pClrDebugState
+ // will remain NULL (which is what it is set to in the BaseContract ctor).
+ //
+ // Thus, we should check for it being NULL before dereferencing it.
+ if (m_pClrDebugState)
+ {
+ // Backout all changes to debug state.
+ *m_pClrDebugState = m_IncomingClrDebugState;
+ }
+ }
+
+ void DoChecks(UINT testmask, __in_z const char *szFunction, __in_z char *szFile, int lineNum);
+ void Disable()
+ {
+ }
+ BOOL CheckFaultInjection();
+
+ protected:
+ UINT m_testmask;
+ // Override this function in any derived class to indicate that you have defined a destructor for that class
+ // and that dtor calls Restore()
+ virtual void DestructorDefinedThatCallsRestore() = 0;
+
+
+ protected:
+ ClrDebugState *m_pClrDebugState;
+ ClrDebugState m_IncomingClrDebugState;
+
+ ContractStackRecord m_contractStackRecord;
+
+ public:
+ // --------------------------------------------------------------------------------
+ // These classes and declarations are used to implement our fake return keyword.
+ // --------------------------------------------------------------------------------
+
+ // ___box is used to protect the "detected" return value from being combined with other parts
+ // of the return expression after we have processed it. This can happen if the return
+ // expression is a non-parenthesized expression with an operator of lower precedence than
+ // ">".
+ //
+ // If you have such a case (and see this class listed in an error message),
+ // parenthesize your return value expression.
+ template <typename T>
+ class Box__USE_PARENS_WITH_THIS_EXPRESSION
+ {
+ const T &value;
+
+ public:
+
+ FORCEINLINE Box__USE_PARENS_WITH_THIS_EXPRESSION(const T &value)
+ : value(value)
+ {
+ }
+
+ FORCEINLINE const T& Unbox()
+ {
+ return value;
+ }
+ };
+
+ // PseudoTemplate is a class which can be instantated with a template-like syntax, resulting
+ // in an expression which simply boxes a following value in a Box
+
+ template <typename T>
+ class PseudoTemplate
+ {
+ public:
+ FORCEINLINE void *operator new (size_t size)
+ {
+ return NULL;
+ }
+
+ FORCEINLINE Box__USE_PARENS_WITH_THIS_EXPRESSION<T> operator>(const T &value)
+ {
+ return Box__USE_PARENS_WITH_THIS_EXPRESSION<T>(value);
+ }
+
+ FORCEINLINE PseudoTemplate operator<(int dummy)
+ {
+ return PseudoTemplate();
+ }
+ };
+
+ // Returner is used to assign the return value to the RETVAL local. Note the use of
+ // operator , because of its low precedence.
+
+ template <typename RETURNTYPE>
+ class Returner
+ {
+ RETURNTYPE &m_value;
+ BOOL m_got;
+ public:
+
+ FORCEINLINE Returner(RETURNTYPE &value)
+ : m_value(value),
+ m_got(FALSE)
+ {
+ }
+
+ template <typename T>
+ FORCEINLINE RETURNTYPE operator,(Box__USE_PARENS_WITH_THIS_EXPRESSION<T> value)
+ {
+ m_value = value.Unbox();
+ m_got = TRUE;
+ return m_value;
+ }
+
+ FORCEINLINE void operator,(___maybetemplate<0> &dummy)
+ {
+ m_got = TRUE;
+ }
+
+ FORCEINLINE BOOL GotReturn()
+ {
+ return m_got;
+ }
+ };
+
+ // This type ensures that postconditions were run via RETURN or RETURN_VOID
+ class RanPostconditions
+ {
+ public:
+ bool ran;
+ int count;
+ const char *function;
+
+ FORCEINLINE RanPostconditions(const char *function)
+ : ran(false),
+ count(0),
+ function(function)
+ {
+ }
+
+ FORCEINLINE int operator++()
+ {
+ return ++count;
+ }
+
+ FORCEINLINE ~RanPostconditions()
+ {
+ // Note: __uncaught_exception() is not a perfect check. It will return TRUE during any exception
+ // processing. So, if there is a contract called from an exception filter (like our
+ // COMPlusFrameHandler) then it will return TRUE and the saftey check below will not be performed.
+ if (!__uncaught_exception())
+ ASSERT_CHECK(count == 0 || ran, function, "Didn't run postconditions - be sure to use RETURN at the end of the function");
+ }
+
+ };
+
+ // Set contract enforcement level
+ static void SetUnconditionalContractEnforcement(BOOL enforceUnconditionally);
+
+ // Check contract enforcement
+ static BOOL EnforceContract();
+
+ private:
+ static BOOL s_alwaysEnforceContracts;
+};
+
+class Contract: public BaseContract
+{
+ // Have to override this function in any derived class to indicate that a valid destructor is defined for this class
+ virtual void DestructorDefinedThatCallsRestore(){}
+
+ public:
+ __declspec(nothrow) ~Contract()
+ {
+ Restore();
+ }
+};
+
+#endif // ENABLE_CONTRACTS_IMPL
+
+
+#ifdef _DEBUG
+
+// Valid parameters for CONTRACT_VIOLATION macro
+enum ContractViolationBits
+{
+ ThrowsViolation = 0x00000001, // suppress THROW tags in this scope
+ GCViolation = 0x00000002, // suppress GCTRIGGER tags in this scope
+ ModeViolation = 0x00000004, // suppress MODE_PREEMP and MODE_COOP tags in this scope
+ FaultViolation = 0x00000008, // suppress INJECT_FAULT assertions in this scope
+ FaultNotFatal = 0x00000010, // suppress INJECT_FAULT but not fault injection by harness
+ SOToleranceViolation = 0x00000020, // suppress SO_TOLERANCE tags in this scope
+ LoadsTypeViolation = 0x00000040, // suppress LOADS_TYPE tags in this scope
+ TakesLockViolation = 0x00000080, // suppress CAN_TAKE_LOCK tags in this scope
+ HostViolation = 0x00000100, // suppress HOST_CALLS tags in this scope
+ EEThreadViolation = 0x00000200, // suppress EE_THREAD_REQUIRED tags in this scope
+
+ //These are not violation bits. We steal some bits out of the violation mask to serve as
+ // general flag bits.
+ CanFreeMe = 0x00010000, // If this bit is ON, the ClrDebugState was allocated by
+ // a version of utilcode that registers an Fls Callback to free
+ // the state. If this bit is OFF, the ClrDebugState was allocated
+ // by an old version of utilcode that doesn't. (And you can't
+ // assume that the old utilcode used the same allocator as the new utilcode.)
+ // (Most likely, this is because you are using an older shim with
+ // a newer mscorwks.dll)
+ //
+ // The Fls callback must only attempt to free debugstates that
+ // have this bit on.
+
+ BadDebugState = 0x00020000, // If we OOM creating the ClrDebugState, we return a pointer to
+ // a static ClrDebugState that has this bit turned on. (We don't
+ // want to slow down contracts with null tests everywhere.)
+ // Other than this specific bit, all other fields of the DebugState
+ // must be considered trash. You can stomp on them and you can bit-test them
+ // but you can't throw up any asserts based on them and you certainly
+ // can't deref any pointers stored in the bad DebugState.
+
+ AllViolation = 0xFFFFFFFF,
+};
+
+#endif
+
+#ifdef ENABLE_CONTRACTS_IMPL
+
+// Global variables allow PRECONDITION and POSTCONDITION to be used outside contracts
+static const BaseContract::Operation ___op = (Contract::Operation) (Contract::Preconditions
+ |Contract::Postconditions);
+enum {
+ ___disabled = 0
+};
+
+static UINT ___testmask;
+
+// End of global variables
+
+static int ___ran;
+
+class __SafeToUsePostCondition {
+public:
+ static int safe_to_use_postcondition() {return 0;};
+};
+
+class __YouCannotUseAPostConditionHere {
+private:
+ static int safe_to_use_postcondition() {return 0;};
+};
+
+typedef __SafeToUsePostCondition __PostConditionOK;
+
+// Uncomment the following line to disable runtime contracts completely - PRE/POST conditions will still be present
+//#define __FORCE_NORUNTIME_CONTRACTS__ 1
+
+#ifndef __FORCE_NORUNTIME_CONTRACTS__
+
+#define CONTRACT_SETUP(_contracttype, _returntype, _returnexp) \
+ _returntype RETVAL; \
+ _contracttype ___contract; \
+ Contract::Returner<_returntype> ___returner(RETVAL); \
+ Contract::RanPostconditions ___ran(__FUNCTION__); \
+ Contract::Operation ___op = Contract::Setup; \
+ DEBUG_ASSURE_NO_RETURN_BEGIN(CONTRACT) \
+ BOOL ___contract_enabled = Contract::EnforceContract(); \
+ enum {___disabled = 0}; \
+ if (!___contract_enabled) \
+ ___contract.Disable(); \
+ else \
+ { \
+ enum { ___CheckMustBeInside_CONTRACT = 1 }; \
+ if (0) \
+ { \
+ /* If you see an "unreferenced label" warning with this name, */\
+ /* Be sure that you have a RETURN at the end of your */ \
+ /* CONTRACT_VOID function */ \
+ ___run_postconditions_DID_YOU_FORGET_A_RETURN: \
+ if (___contract_enabled) \
+ { \
+ ___op = Contract::Postconditions; \
+ ___ran.ran = true; \
+ } \
+ else \
+ { \
+ DEBUG_OK_TO_RETURN_BEGIN(CONTRACT) \
+ ___run_return: \
+ return _returnexp; \
+ DEBUG_OK_TO_RETURN_END(CONTRACT) \
+ } \
+ } \
+ if (0) \
+ { \
+ ___run_preconditions: \
+ ___op = Contract::Preconditions; \
+ } \
+ UINT ___testmask = 0; \
+
+#define CONTRACTL_SETUP(_contracttype) \
+ _contracttype ___contract; \
+ BOOL ___contract_enabled = Contract::EnforceContract(); \
+ enum {___disabled = 0}; \
+ if (!___contract_enabled) \
+ ___contract.Disable(); \
+ else \
+ { \
+ typedef __YouCannotUseAPostConditionHere __PostConditionOK; \
+ enum { ___CheckMustBeInside_CONTRACT = 1 }; \
+ Contract::Operation ___op = Contract::Setup; \
+ enum {___disabled = 0}; \
+ if (0) \
+ { \
+ ___run_preconditions: \
+ ___op = Contract::Preconditions; \
+ } \
+ if (0) \
+ { \
+ /* define for CONTRACT_END even though we can't get here */ \
+ ___run_return: \
+ UNREACHABLE(); \
+ } \
+ UINT ___testmask = 0; \
+
+#else // #ifndef __FORCE_NORUNTIME_CONTRACTS__
+
+#define CONTRACT_SETUP(_contracttype, _returntype, _returnexp) \
+ _returntype RETVAL; \
+ Contract::Returner<_returntype> ___returner(RETVAL); \
+ Contract::RanPostconditions ___ran(__FUNCTION__); \
+ Contract::Operation ___op = Contract::Setup; \
+ DEBUG_ASSURE_NO_RETURN_BEGIN(CONTRACT) \
+ BOOL ___contract_enabled = Contract::EnforceContract(); \
+ enum {___disabled = 0}; \
+ { \
+ enum { ___CheckMustBeInside_CONTRACT = 1 }; \
+ if (0) \
+ { \
+ /* If you see an "unreferenced label" warning with this name, */\
+ /* Be sure that you have a RETURN at the end of your */ \
+ /* CONTRACT_VOID function */ \
+ ___run_postconditions_DID_YOU_FORGET_A_RETURN: \
+ if (___contract_enabled) \
+ { \
+ ___op = Contract::Postconditions; \
+ ___ran.ran = true; \
+ } \
+ else \
+ { \
+ DEBUG_OK_TO_RETURN_BEGIN(CONTRACT) \
+ ___run_return: \
+ return _returnexp; \
+ DEBUG_OK_TO_RETURN_END(CONTRACT) \
+ } \
+ } \
+ if (0) \
+ { \
+ ___run_preconditions: \
+ ___op = Contract::Preconditions; \
+ } \
+ UINT ___testmask = 0; \
+
+
+
+
+#define CONTRACTL_SETUP(_contracttype) \
+ BOOL ___contract_enabled = Contract::EnforceContract(); \
+ enum {___disabled = 0}; \
+ { \
+ typedef __YouCannotUseAPostConditionHere __PostConditionOK; \
+ enum { ___CheckMustBeInside_CONTRACT = 1 }; \
+ Contract::Operation ___op = Contract::Setup; \
+ enum {___disabled = 0}; \
+ if (0) \
+ { \
+ ___run_preconditions: \
+ ___op = Contract::Preconditions; \
+ } \
+ if (0) \
+ { \
+ /* define for CONTRACT_END even though we can't get here */ \
+ ___run_return: \
+ UNREACHABLE(); \
+ } \
+ UINT ___testmask = 0; \
+
+#endif // __FORCE_NORUNTIME_CONTRACTS__
+
+
+#define CUSTOM_CONTRACT(_contracttype, _returntype) \
+ typedef Contract::PseudoTemplate<_returntype> ___maybetemplate; \
+ CONTRACT_SETUP(_contracttype, _returntype, RETVAL)
+
+#define CUSTOM_CONTRACT_VOID(_contracttype) \
+ CONTRACT_SETUP(_contracttype, int, ;)
+
+#define CUSTOM_CONTRACTL(_contracttype) \
+ CONTRACTL_SETUP(_contracttype)
+
+// Although this thing only needs to run in the Setup phase, we'll let it
+// run unconditionally. This way, the compiler will see a sequence like this:
+//
+// THROWS; GC_TRIGGERS; FORBID_FAULT ==>
+//
+// ___testmask |= constant
+// ___testmask |= constant
+// ___testmask |= constant
+//
+// and be able to fold all these into a single constant at runtime.
+//
+#define REQUEST_TEST(thetest, todisable) (___testmask |= (___CheckMustBeInside_CONTRACT, (___disabled ? (todisable) : (thetest))))
+
+
+#define INJECT_FAULT(_statement) \
+ do \
+ { \
+ STATIC_CONTRACT_FAULT; \
+ REQUEST_TEST(Contract::FAULT_Inject, Contract::FAULT_Disabled); \
+ if (0) \
+ { \
+ _statement; \
+ } \
+ } \
+ while(0) \
+
+
+#define FORBID_FAULT do { STATIC_CONTRACT_FORBID_FAULT; REQUEST_TEST(Contract::FAULT_Forbid, Contract::FAULT_Disabled); } while(0)
+
+#define THROWS do { STATIC_CONTRACT_THROWS; REQUEST_TEST(Contract::THROWS_Yes, Contract::THROWS_Disabled); } while(0)
+
+#define NOTHROW do { STATIC_CONTRACT_NOTHROW; REQUEST_TEST(Contract::THROWS_No, Contract::THROWS_Disabled); } while(0) \
+
+#define ENTRY_POINT do { STATIC_CONTRACT_ENTRY_POINT; REQUEST_TEST(Contract::SO_TOLERANT_Yes, Contract::SO_TOLERANCE_Disabled); } while(0)
+
+#define LOADS_TYPE(maxlevel) do { REQUEST_TEST( ((maxlevel) + 1) << Contract::LOADS_TYPE_Shift, Contract::LOADS_TYPE_Disabled ); } while(0)
+
+#define SO_TOLERANT do { STATIC_CONTRACT_SO_TOLERANT; REQUEST_TEST(Contract::SO_TOLERANT_Yes, Contract::SO_TOLERANCE_Disabled); } while(0)
+
+#define SO_INTOLERANT do { STATIC_CONTRACT_SO_INTOLERANT; REQUEST_TEST(Contract::SO_TOLERANT_No, Contract::SO_TOLERANCE_Disabled); } while(0)
+
+#define SO_NOT_MAINLINE do { STATIC_CONTRACT_SO_NOT_MAINLINE; REQUEST_TEST(Contract::SO_MAINLINE_No, 0); } while (0)
+
+#define CAN_TAKE_LOCK do { STATIC_CONTRACT_CAN_TAKE_LOCK; REQUEST_TEST(Contract::CAN_TAKE_LOCK_Yes, Contract::CAN_TAKE_LOCK_Disabled); } while(0)
+
+#define CANNOT_TAKE_LOCK do { STATIC_CONTRACT_CANNOT_TAKE_LOCK; REQUEST_TEST(Contract::CAN_TAKE_LOCK_No, Contract::CAN_TAKE_LOCK_Disabled); } while(0)
+
+#define CANNOT_RETAKE_LOCK do { REQUEST_TEST(Contract::CAN_RETAKE_LOCK_No, Contract::CAN_RETAKE_LOCK_No_Disabled); } while(0)
+
+#define DEBUG_ONLY do { STATIC_CONTRACT_DEBUG_ONLY; REQUEST_TEST(Contract::DEBUG_ONLY_Yes, 0); } while (0)
+
+#ifndef __DISABLE_PREPOST_CONDITIONS__
+#define PRECONDITION_MSG(_expression, _message) \
+ do \
+ { \
+ enum { ___CheckMustBeInside_CONTRACT = 1 }; \
+ REQUEST_TEST(Contract::PRECONDITION_Used, 0); \
+ if ((___op&Contract::Preconditions) && !___disabled) \
+ ASSERT_CHECK(_expression, _message, "Precondition failure"); \
+ } \
+ while(0)
+
+
+#define PRECONDITION(_expression) \
+ PRECONDITION_MSG(_expression, NULL)
+
+#define POSTCONDITION_MSG(_expression, _message) \
+ ++___ran; \
+ if ((!(0 && __PostConditionOK::safe_to_use_postcondition())) && \
+ (___op&Contract::Postconditions) && \
+ !___disabled) \
+ { \
+ ASSERT_CHECK(_expression, _message, "Postcondition failure"); \
+ }
+
+#define POSTCONDITION(_expression) \
+ POSTCONDITION_MSG(_expression, NULL)
+
+#define INSTANCE_CHECK \
+ ___CheckMustBeInside_CONTRACT; \
+ if ((___op&Contract::Preconditions) && !___disabled) \
+ ASSERT_CHECK(CheckPointer(this), NULL, "Instance precheck failure"); \
+ ++___ran; \
+ if ((___op&Contract::Postconditions) && !___disabled) \
+ ASSERT_CHECK(CheckPointer(this), NULL, "Instance postcheck failure");
+
+#define INSTANCE_CHECK_NULL \
+ ___CheckMustBeInside_CONTRACT; \
+ if ((___op&Contract::Preconditions) && !___disabled) \
+ ASSERT_CHECK(CheckPointer(this, NULL_OK), NULL, "Instance precheck failure"); \
+ ++___ran; \
+ if ((___op&Contract::Postconditions) && !___disabled) \
+ ASSERT_CHECK(CheckPointer(this, NULL_OK), NULL, "Instance postcheck failure");
+
+#define CONSTRUCTOR_CHECK \
+ ___CheckMustBeInside_CONTRACT; \
+ ++___ran; \
+ if ((___op&Contract::Postconditions) && !___disabled) \
+ ASSERT_CHECK(CheckPointer(this), NULL, "Instance postcheck failure");
+
+#define DESTRUCTOR_CHECK \
+ ___CheckMustBeInside_CONTRACT; \
+ NOTHROW; \
+ if ((___op&Contract::Preconditions) && !___disabled) \
+ ASSERT_CHECK(CheckPointer(this), NULL, "Instance precheck failure");
+#else // __DISABLE_PREPOST_CONDITIONS__
+
+
+#define PRECONDITION_MSG(_expression, _message) do { } while(0)
+#define PRECONDITION(_expression) do { } while(0)
+#define POSTCONDITION_MSG(_expression, _message) do { } while(0)
+#define POSTCONDITION(_expression) do { } while(0)
+#define INSTANCE_CHECK
+#define INSTANCE_CHECK_NULL
+#define CONSTRUCTOR_CHECK
+#define DESTRUCTOR_CHECK
+
+#endif // __DISABLE_PREPOST_CONDITIONS__
+
+#define UNCHECKED(thecheck) \
+ do { \
+ ANNOTATION_UNCHECKED(thecheck); \
+ enum {___disabled = 1 }; \
+ thecheck; \
+ } while(0)
+
+#define DISABLED(thecheck) UNCHECKED(thecheck)
+
+#define WRAPPER(thecheck) UNCHECKED(thecheck)
+
+// This keyword is redundant but it's handy for reducing the nuisance editing you
+// have to when repeatedly enabling and disabling contract items while debugging.
+// You shouldn't check in code that explicitly uses ENABLED.
+#define ENABLED(_check) _check
+
+
+#ifndef __FORCE_NORUNTIME_CONTRACTS__
+#define CONTRACTL_END \
+ if (___op & Contract::Setup) \
+ { \
+ ___contract.DoChecks(___testmask, __FUNCTION__, __FILE__, __LINE__); \
+ if (___testmask & Contract::PRECONDITION_Used) \
+ { \
+ goto ___run_preconditions; \
+ } \
+ } \
+ else if (___op & Contract::Postconditions) \
+ { \
+ goto ___run_return; \
+ } \
+ ___CheckMustBeInside_CONTRACT; \
+ }
+
+#else
+
+#define CONTRACTL_END \
+ if (___op & Contract::Setup) \
+ { \
+ if (___testmask & Contract::PRECONDITION_Used) \
+ { \
+ goto ___run_preconditions; \
+ } \
+ } \
+ else if (___op & Contract::Postconditions) \
+ { \
+ goto ___run_return; \
+ } \
+ ___CheckMustBeInside_CONTRACT; \
+ } \
+
+#endif // __FORCE_NORUNTIME_CONTRACTS__
+
+#define CONTRACT_END CONTRACTL_END \
+ DEBUG_ASSURE_NO_RETURN_END(CONTRACT) \
+
+
+// The final expression in the RETURN macro deserves special explanation (or something.)
+// The expression is constructed so as to be syntactically ambiguous, depending on whether
+// __maybetemplate is a template or not. If it is a template, the expression is syntactically
+// correct as-is. If it is not, the angle brackets are interpreted as
+// less than & greater than, and the expression is incomplete. This is the point - we can
+// choose whether we need an expression or not based on the context in which the macro is used.
+// This allows the same RETURN macro to be used both in value-returning and void-returning
+// contracts.
+//
+// The "__returner ," portion of the expression is used instead of "RETVAL =", since ","
+// has lower precedence than "=". (Ain't overloaded operators fun.)
+//
+// Also note that the < and > operators on the non-template version of __maybetemplate
+// are overridden to "box" the return value in a special type and pass it
+// through to the __returner's "," operator. This is so we can detect a case where an
+// operator with lower precedence than ">" is in the return expression - in such a case we
+// will get a type error message, which instructs that parens be placed around the return
+// value expression.
+
+#define RETURN_BODY \
+ if (___returner.GotReturn()) \
+ goto ___run_postconditions_DID_YOU_FORGET_A_RETURN; \
+ else \
+ ___returner, * new ___maybetemplate < 0 >
+
+
+// We have two versions of the RETURN macro. CONTRACT_RETURN is for use inside the CONTRACT
+// scope where it is OK to return this way, even though the CONTRACT macro itself does not
+// allow a return. RETURN is for use inside the function body where it might not be OK
+// to return and we need to ensure that we don't allow a return where one should not happen
+//
+#define RETURN \
+ while (DEBUG_ASSURE_SAFE_TO_RETURN, TRUE) \
+ RETURN_BODY \
+
+#define RETURN_VOID \
+ RETURN
+
+#define CONTRACT_RETURN \
+ while (___CheckMustBeInside_CONTRACT, TRUE) \
+ RETURN_BODY \
+
+#define CONTRACT_RETURN_VOID \
+ CONTRACT_RETURN \
+
+#if 0
+#define CUSTOM_LIMITED_METHOD_CONTRACT(_contracttype) \
+ { \
+ _contracttype ___contract; \
+ STATIC_CONTRACT_LEAF; \
+ ___contract.DoChecks(Contract::THROWS_No|Contract::GC_NoTrigger|Contract::MODE_Disabled|Contract::FAULT_Disabled); \
+ /* Should add some assertion mechanism to ensure no other contracts are called */ \
+ }
+#else
+#define CUSTOM_LIMITED_METHOD_CONTRACT(_contracttype) \
+ { \
+ STATIC_CONTRACT_LEAF; \
+ }
+#endif
+
+#define CUSTOM_WRAPPER_NO_CONTRACT(_contracttype) \
+ { \
+ /* Should add some assertion mechanism to ensure one other contract is called */ \
+ STATIC_CONTRACT_WRAPPER; \
+ }
+
+#define CONTRACT_THROWS() \
+ { \
+ ::GetClrDebugState()->CheckOkayToThrow(__FUNCTION__, __FILE__, __LINE__); \
+ }
+
+#define CONTRACT_THROWSEX(__func, __file, __line) \
+ { \
+ ::GetClrDebugState()->CheckOkayToThrow(__func, __file, __line); \
+ }
+
+#else // ENABLE_CONTRACTS_IMPL
+#define CUSTOM_CONTRACT(_contracttype, _returntype) if (0) { struct YouCannotUseThisHere { int x; }; // This temporary typedef allows retail use of
+#define CUSTOM_CONTRACT_VOID(_contracttype) if (0) { struct YouCannotUseThisHere { int x; }; // FORBIDGC_LOADER_USE_ENABLED
+#define CUSTOM_CONTRACTL(_contracttype) if (0) { struct YouCannotUseThisHere { int x; }; // inside contracts and asserts but nowhere else.
+
+#define INJECT_FAULT(_statement)
+#define FORBID_FAULT
+#define THROWS
+#define NOTHROW
+#define CAN_TAKE_LOCK
+#define CANNOT_TAKE_LOCK
+#define CANNOT_RETAKE_LOCK
+#define LOADS_TYPE(maxlevel)
+#define SO_TOLERANT
+#define SO_INTOLERANT
+#define SO_NOT_MAINLINE
+#define ENTRY_POINT
+
+#ifdef _DEBUG
+// This can only appear in a debug function so don't define it non-debug
+#define DEBUG_ONLY STATIC_CONTRACT_DEBUG_ONLY
+#else
+#define DEBUG_ONLY
+#endif
+
+#define PRECONDITION_MSG(_expression, _message) do { } while(0)
+#define PRECONDITION(_expression) do { } while(0)
+#define POSTCONDITION_MSG(_expression, _message) do { } while(0)
+#define POSTCONDITION(_expression) do { } while(0)
+#define INSTANCE_CHECK
+#define INSTANCE_CHECK_NULL
+#define CONSTRUCTOR_CHECK
+#define DESTRUCTOR_CHECK
+#define UNCHECKED(thecheck)
+#define DISABLED(thecheck)
+#define WRAPPER(thecheck)
+#define ENABLED(_check)
+#define CONTRACT_END }
+#define CONTRACTL_END }
+
+#define CUSTOM_LIMITED_METHOD_CONTRACT(_contracttype) \
+ { \
+ /* Should add some assertion mechanism to ensure one other contract is called */ \
+ STATIC_CONTRACT_LEAF; \
+ }
+#define CUSTOM_WRAPPER_NO_CONTRACT(_contracttype) \
+ { \
+ /* Should add some assertion mechanism to ensure one other contract is called */ \
+ STATIC_CONTRACT_WRAPPER; \
+ }
+
+
+#define RETURN return
+#define RETURN_VOID RETURN
+
+#define CONTRACT_THROWS()
+#define CONTRACT_THROWSEX(__func, __file, __line)
+
+#endif // ENABLE_CONTRACTS_IMPL
+
+
+#define CONTRACT(_returntype) CUSTOM_CONTRACT(Contract, _returntype)
+#define CONTRACT_VOID CUSTOM_CONTRACT_VOID(Contract)
+#define CONTRACTL CUSTOM_CONTRACTL(Contract)
+
+// See description near the top of the file
+#define LIMITED_METHOD_CONTRACT CUSTOM_LIMITED_METHOD_CONTRACT(Contract)
+
+#define WRAPPER_NO_CONTRACT CUSTOM_WRAPPER_NO_CONTRACT(Contract)
+
+// GC_NOTRIGGER allowed but not currently enforced at runtime
+#define GC_NOTRIGGER STATIC_CONTRACT_GC_NOTRIGGER
+#define GC_TRIGGERS static_assert(false, "TriggersGC not supported in utilcode contracts")
+
+#ifdef ENABLE_CONTRACTS_IMPL
+template <UINT_PTR VIOLATION_MASK>
+class ContractViolationHolder
+{
+public:
+ ContractViolationHolder()
+ {
+ m_pviolationmask = NULL;
+ m_oldviolationmask = 0;
+ }
+
+ DEBUG_NOINLINE void Enter();
+
+ DEBUG_NOINLINE void Leave()
+ {
+ SCAN_SCOPE_END;
+ LeaveInternal();
+ };
+
+protected:
+ // We require that violationMask is passed as a parameter here to hopefully defeat the
+ // compiler's desire to fold all the Enter and Ctor implementations together.
+ FORCEINLINE void EnterInternal(UINT_PTR violationMask)
+ {
+ _ASSERTE(0 == (violationMask & ~(ThrowsViolation | GCViolation | ModeViolation | FaultViolation |
+ FaultNotFatal | SOToleranceViolation | HostViolation |
+ TakesLockViolation | LoadsTypeViolation)) ||
+ violationMask == AllViolation);
+
+ m_pviolationmask = GetClrDebugState()->ViolationMaskPtr();
+ m_oldviolationmask = *m_pviolationmask;
+ *m_pviolationmask = (m_oldviolationmask | violationMask);
+ };
+
+ FORCEINLINE void LeaveInternal()
+ {
+ // This can be used in places where our debug state has been destroyed, so check for it first.
+ if (CheckClrDebugState())
+ {
+ _ASSERTE(m_pviolationmask != NULL);
+ *m_pviolationmask = m_oldviolationmask;
+ }
+ };
+
+ UINT_PTR *m_pviolationmask;
+ UINT_PTR m_oldviolationmask;
+};
+
+template <UINT_PTR VIOLATION_MASK>
+class AutoCleanupContractViolationHolder : ContractViolationHolder<VIOLATION_MASK>
+{
+public:
+ DEBUG_NOINLINE AutoCleanupContractViolationHolder(BOOL fEnterViolation = TRUE);
+
+ DEBUG_NOINLINE ~AutoCleanupContractViolationHolder()
+ {
+ SCAN_SCOPE_END;
+ LeaveInternal();
+ };
+};
+
+#endif // ENABLE_CONTRACTS_IMPL
+
+#ifdef ENABLE_CONTRACTS_IMPL
+#define BEGIN_CONTRACT_VIOLATION(violationmask) \
+ { \
+ ContractViolationHolder<violationmask> __violationHolder_onlyOneAllowedPerScope; \
+ __violationHolder_onlyOneAllowedPerScope.Enter(); \
+ DEBUG_ASSURE_NO_RETURN_BEGIN(CONTRACT) \
+
+// Use this to jump out prematurely from a violation. Used for EH
+// when the function might not return
+#define RESET_CONTRACT_VIOLATION() \
+ __violationHolder_onlyOneAllowedPerScope.Leave(); \
+
+#define END_CONTRACT_VIOLATION \
+ DEBUG_ASSURE_NO_RETURN_END(CONTRACT) \
+ __violationHolder_onlyOneAllowedPerScope.Leave(); \
+ } \
+
+// See description near the top of the file
+#define CONTRACT_VIOLATION(violationMask) \
+ AutoCleanupContractViolationHolder<violationMask> __violationHolder_onlyOneAllowedPerScope;
+
+
+// Reasons for having the violation. Use one of these values as an additional parameter to
+// E.g. PERMANENT_CONTRACT_VIOLATION(ThrowsViolation, ReasonContractInfrastructure)
+// New values and explanations can be added when needed.
+enum PermanentContractViolationReason
+{
+ ReasonContractInfrastructure, // This violation is there for contract test or infrastructure purposes.
+ ReasonDebugOnly, // Code path doesn't occur on retail builds
+ ReasonNonShippingCode, // Code runs in undocumented non-shipping feature
+ ReasonIBC, // Code runs in IBC scenarios only and the violation is safe.
+ ReasonNGEN, // Code runs in NGEN scenarios only and the violation is safe.
+ ReasonProfilerCallout, // Profiler implementers are guaranteed not to throw.
+ ReasonUnsupportedForSQLF1Profiling, // This code path violates HOST_NOCALLS, but that's ok b/c SQL will never
+ // invoke it, and thus SQL/F1 profiling (the primary reason to enforce
+ // HOST_NOCALLS) is not in danger.
+ ReasonRuntimeReentrancy, // e.g. SafeQueryInterface
+ ReasonShutdownOnly, // Code path only runs as part of Shutdown and the violation is safe.
+ ReasonSOTolerance, // We would like to redesign SO contracts anyways
+ ReasonStartupOnly, // Code path only runs as part of Startup and the violation is safe.
+ ReasonWorkaroundForScanBug, // Violation is needed because of a bug in SCAN
+ ReasonProfilerAsyncCannotRetakeLock, // Profiler may call this from redirected thread, causing a CANNOT_TAKE_LOCK
+ // violation, but the scope is still protected with CANNOT_RETAKE_LOCK
+ ReasonILStubWillNotThrow, // Specially-crafted reverse COM IL stubs will not throw
+};
+
+// See the discussion near the top of the file on the use of PERMANENT_CONTRACT_VIOLATION
+// The reasonEnum is currently only used for documentation and searchability. Here
+// we have the compiler check for a typo.
+#define PERMANENT_CONTRACT_VIOLATION(violationMask, reasonEnum) \
+ if (0) \
+ PermanentContractViolationReason reason = reasonEnum; \
+ CONTRACT_VIOLATION(violationMask)
+
+#define CONDITIONAL_CONTRACT_VIOLATION(violationMask, condition) \
+ AutoCleanupContractViolationHolder<violationMask> __violationHolder_onlyOneAllowedPerScope((condition));
+
+#else
+#define BEGIN_CONTRACT_VIOLATION(violationmask)
+#define RESET_CONTRACT_VIOLATION()
+#define END_CONTRACT_VIOLATION
+#define CONTRACT_VIOLATION(violationmask)
+#define CONDITIONAL_CONTRACT_VIOLATION(violationMask, condition)
+#define PERMANENT_CONTRACT_VIOLATION(violationMask, reasonEnum)
+#endif
+
+
+
+#ifdef ENABLE_CONTRACTS_IMPL
+// Holder for setting up a faultforbid region
+class FaultForbidHolder
+{
+ public:
+ DEBUG_NOINLINE FaultForbidHolder(BOOL fConditional, BOOL fAlloc, const char *szFunction, const char *szFile, int lineNum)
+ {
+ SCAN_SCOPE_BEGIN;
+ STATIC_CONTRACT_FORBID_FAULT;
+
+ m_fConditional = fConditional;
+ if (m_fConditional)
+ {
+ m_pClrDebugState = GetClrDebugState(fAlloc);
+
+ //
+ // If we fail to get a debug state, then we must not be allocating and
+ // we simply no-op this holder.
+ //
+ if (m_pClrDebugState == NULL)
+ {
+ _ASSERTE(!fAlloc);
+ m_fConditional = FALSE;
+ return;
+ }
+
+ m_oldClrDebugState = *m_pClrDebugState;
+
+ m_pClrDebugState->ViolationMaskReset( FaultViolation|FaultNotFatal );
+ m_pClrDebugState->SetFaultForbid();
+
+ m_ContractStackRecord.m_szFunction = szFunction;
+ m_ContractStackRecord.m_szFile = szFile;
+ m_ContractStackRecord.m_lineNum = lineNum;
+ m_ContractStackRecord.m_testmask = (Contract::ALL_Disabled & ~((UINT)(Contract::FAULT_Mask))) | Contract::FAULT_Forbid;
+ m_ContractStackRecord.m_construct = "FAULT_FORBID";
+ m_pClrDebugState->LinkContractStackTrace( &m_ContractStackRecord );
+ }
+ }
+
+ DEBUG_NOINLINE ~FaultForbidHolder()
+ {
+ SCAN_SCOPE_END;
+
+ if (m_fConditional)
+ {
+ *m_pClrDebugState = m_oldClrDebugState;
+ }
+ }
+
+ private:
+ ClrDebugState *m_pClrDebugState;
+ ClrDebugState m_oldClrDebugState;
+ BOOL m_fConditional;
+ ContractStackRecord m_ContractStackRecord;
+
+};
+#endif // ENABLE_CONTRACTS_IMPL
+
+
+#ifdef ENABLE_CONTRACTS_IMPL
+
+#define FAULT_FORBID() FaultForbidHolder _ffh(TRUE, TRUE, __FUNCTION__, __FILE__, __LINE__);
+#define FAULT_FORBID_NO_ALLOC() FaultForbidHolder _ffh(TRUE, FALSE, __FUNCTION__, __FILE__, __LINE__);
+#define MAYBE_FAULT_FORBID(cond) FaultForbidHolder _ffh(cond, TRUE, __FUNCTION__, __FILE__, __LINE__);
+#define MAYBE_FAULT_FORBID_NO_ALLOC(cond) FaultForbidHolder _ffh(cond, FALSE, __FUNCTION__, __FILE__, __LINE__);
+
+#else // ENABLE_CONTRACTS_IMPL
+
+#define FAULT_FORBID() ;
+#define FAULT_FORBID_NO_ALLOC() ;
+#define MAYBE_FAULT_FORBID(cond) ;
+#define MAYBE_FAULT_FORBID_NO_ALLOC(cond) ;
+
+#endif // ENABLE_CONTRACTS_IMPL
+
+
+#ifdef ENABLE_CONTRACTS_IMPL
+
+inline BOOL AreFaultsForbiddenHelper()
+{
+ STATIC_CONTRACT_DEBUG_ONLY;
+ STATIC_CONTRACT_NOTHROW;
+
+ ClrDebugState *pClrDebugState = CheckClrDebugState();
+ if (!pClrDebugState)
+ {
+ // By default, faults are not forbidden. Not the most desirable default
+ // but we'd never get this debug infrastructure bootstrapped otherwise.
+ return FALSE;
+ }
+ else
+ {
+ return pClrDebugState->IsFaultForbid() && (!(pClrDebugState->ViolationMask() & (FaultViolation|FaultNotFatal|BadDebugState)));
+ }
+}
+
+#define ARE_FAULTS_FORBIDDEN() AreFaultsForbiddenHelper()
+#else
+
+// If you got an error about ARE_FAULTS_FORBIDDEN being undefined, it's because you tried
+// to use this predicate in a free build outside of a CONTRACT or ASSERT.
+//
+#define ARE_FAULTS_FORBIDDEN() (sizeof(YouCannotUseThisHere) != 0)
+#endif
+
+
+// This allows a fault-forbid region to invoke a non-mandatory allocation, such as for the
+// purpose of growing a lookaside cache (if the allocation fails, the code can abandon the
+// cache growing operation without negative effect.)
+//
+// Although it's implemented using CONTRACT_VIOLATION(), it's not a bug to have this in the code.
+//
+// It *is* a bug to use this to hide a situation where an OOM is genuinely fatal but not handled.
+#define FAULT_NOT_FATAL() CONTRACT_VIOLATION(FaultNotFatal)
+
+
+
+#ifdef ENABLE_CONTRACTS_IMPL
+
+//------------------------------------------------------------------------------------
+// Underlying class support for TRIGGERS_TYPE_LOAD and OVERRIDE_TYPE_LOAD_LEVEL_LIMIT.
+// Don't reference this class directly. Use the macros.
+//------------------------------------------------------------------------------------
+class LoadsTypeHolder
+{
+ public:
+ LoadsTypeHolder(BOOL fConditional,
+ UINT newLevel,
+ BOOL fEnforceLevelChangeDirection,
+ const char *szFunction,
+ const char *szFile,
+ int lineNum
+ );
+
+ ~LoadsTypeHolder();
+
+ private:
+ ClrDebugState *m_pClrDebugState;
+ ClrDebugState m_oldClrDebugState;
+ BOOL m_fConditional;
+ ContractStackRecord m_contractStackRecord;
+
+};
+
+#endif // ENABLE_CONTRACTS_IMPL
+
+
+//------------------------------------------------------------------------------------
+// TRIGGERS_TYPE_LOAD(newLevel)
+// Works just LOADS_TYPE in contracts but lets you protect individual scopes
+//
+// OVERRIDE_TYPE_LOAD_LEVEL_LIMIT(newLevel)
+// Sets a new limit just like TRIGGERS_TYPE_LOAD but does not restrict you
+// to decreasing the limit. Only the loader should use this and only when it
+// can prove structurally that no recursion will occur as a result.
+//------------------------------------------------------------------------------------
+#ifdef ENABLE_CONTRACTS_IMPL
+
+#define TRIGGERS_TYPE_LOAD(newLevel) LoadsTypeHolder _lth(TRUE, newLevel, TRUE, __FUNCTION__, __FILE__, __LINE__);
+#define MAYBE_TRIGGERS_TYPE_LOAD(newLevel, fEnable) LoadsTypeHolder _lth(fEnable, newLevel, TRUE, __FUNCTION__, __FILE__, __LINE__);
+#define OVERRIDE_TYPE_LOAD_LEVEL_LIMIT(newLevel) LoadsTypeHolder _lth(TRUE, newLevel, FALSE, __FUNCTION__, __FILE__, __LINE__);
+#define MAYBE_OVERRIDE_TYPE_LOAD_LEVEL_LIMIT(newLevel, fEnable) LoadsTypeHolder _lth(fEnable, newLevel, FALSE, __FUNCTION__, __FILE__, __LINE__);
+
+#else // ENABLE_CONTRACTS_IMPL
+
+#define TRIGGERS_TYPE_LOAD(newLevel)
+#define MAYBE_TRIGGERS_TYPE_LOAD(newLevel, fEnable)
+#define OVERRIDE_TYPE_LOAD_LEVEL_LIMIT(newLevel)
+#define MAYBE_OVERRIDE_TYPE_LOAD_LEVEL_LIMIT(newLevel, fEnable)
+
+#endif // ENABLE_CONTRACTS_IMPL
+
+
+
+#ifdef ENABLE_CONTRACTS_IMPL
+class PAL_TryMarker
+{
+public:
+ DEBUG_NOINLINE void Enter();
+ DEBUG_NOINLINE void Leave();
+};
+
+#define PAL_ENTER_THROWS_REGION \
+ PAL_TryMarker __throwsHolder_onlyOneAllowedPerScope; \
+ __throwsHolder_onlyOneAllowedPerScope.Enter();
+
+#define PAL_LEAVE_THROWS_REGION \
+ __throwsHolder_onlyOneAllowedPerScope.Leave();
+
+// This sets up a marker that says its okay to throw on this thread. This is not a public macro, and should only be
+// used from within the implementation of various try/catch macros.
+class ClrTryMarkerHolder
+{
+public:
+ DEBUG_NOINLINE ClrTryMarkerHolder()
+ {
+ SCAN_SCOPE_BEGIN;
+ STATIC_CONTRACT_THROWS;
+
+ m_pClrDebugState = GetClrDebugState();
+ m_oldOkayToThrowValue = m_pClrDebugState->IsOkToThrow();
+ m_pClrDebugState->SetOkToThrow();
+ }
+
+ DEBUG_NOINLINE ~ClrTryMarkerHolder()
+ {
+ SCAN_SCOPE_END;
+
+ m_pClrDebugState->SetOkToThrow( m_oldOkayToThrowValue );
+ }
+
+private:
+ BOOL m_oldOkayToThrowValue;
+ ClrDebugState *m_pClrDebugState;
+};
+
+#define CLR_TRY_MARKER() ClrTryMarkerHolder ___tryMarkerHolder;
+
+#else // ENABLE_CONTRACTS_IMPL
+
+#define CLR_TRY_MARKER()
+#define PAL_ENTER_THROWS_REGION
+#define PAL_LEAVE_THROWS_REGION
+
+#endif
+
+#ifdef ENABLE_CONTRACTS_IMPL
+// Note: This routine will create a ClrDebugState if called for the first time.
+// It cannot return NULL (see comment for InitClrDebugState).
+inline ClrDebugState *GetClrDebugState(BOOL fAlloc)
+{
+ STATIC_CONTRACT_LIMITED_METHOD;
+ STATIC_CONTRACT_SO_NOT_MAINLINE;
+
+ ClrDebugState *pState = CheckClrDebugState();
+
+ if (pState)
+ {
+ return pState;
+ }
+
+ if (fAlloc)
+ {
+ return CLRInitDebugState();
+ }
+
+ return NULL;
+}
+#endif // ENABLE_CONTRACTS_IMPL
+
+#ifdef FEATURE_STACK_PROBE
+
+#ifdef ENABLE_CONTRACTS_IMPL
+class SONotMainlineHolder
+{
+ public:
+ DEBUG_NOINLINE void Enter()
+ {
+ SCAN_SCOPE_BEGIN;
+ STATIC_CONTRACT_SO_NOT_MAINLINE;
+
+ m_pClrDebugState = GetClrDebugState();
+ if (m_pClrDebugState)
+ {
+ m_oldSONotMainlineValue = m_pClrDebugState->IsSONotMainline();
+ m_pClrDebugState->SetSONotMainline();
+ }
+ }
+
+ DEBUG_NOINLINE void Leave()
+ {
+ SCAN_SCOPE_END;
+
+ m_pClrDebugState = CheckClrDebugState();
+ if (m_pClrDebugState)
+ {
+ m_pClrDebugState->SetSONotMainline( m_oldSONotMainlineValue );
+ }
+ }
+
+ private:
+ BOOL m_oldSONotMainlineValue;
+ ClrDebugState *m_pClrDebugState;
+};
+
+#define ENTER_SO_NOT_MAINLINE_CODE \
+ SONotMainlineHolder __soNotMainlineHolder; \
+ __soNotMainlineHolder.Enter();
+
+#define LEAVE_SO_NOT_MAINLINE_CODE \
+ __soNotMainlineHolder.Leave();
+
+
+class AutoCleanupSONotMainlineHolder : public SONotMainlineHolder
+{
+ public:
+ DEBUG_NOINLINE AutoCleanupSONotMainlineHolder()
+ {
+ SCAN_SCOPE_BEGIN;
+ STATIC_CONTRACT_SO_NOT_MAINLINE;
+
+ Enter();
+ }
+
+ DEBUG_NOINLINE ~AutoCleanupSONotMainlineHolder()
+ {
+ SCAN_SCOPE_END;
+
+ Leave();
+ }
+};
+
+#define SO_NOT_MAINLINE_FUNCTION \
+ AutoCleanupSONotMainlineHolder __soNotMainlineHolder;
+
+#define SO_NOT_MAINLINE_REGION() \
+ AutoCleanupSONotMainlineHolder __soNotMainlineHolder;
+
+#else // ENABLE_CONTRACTS_IMPL
+#define SO_NOT_MAINLINE_FUNCTION STATIC_CONTRACT_SO_NOT_MAINLINE
+#define SO_NOT_MAINLINE_REGION() STATIC_CONTRACT_SO_NOT_MAINLINE
+#define ENTER_SO_NOT_MAINLINE_CODE
+#define LEAVE_SO_NOT_MAINLINE_CODE
+#endif
+
+#else // FEATURE_STACK_PROBE
+
+#define SO_NOT_MAINLINE_FUNCTION
+#define SO_NOT_MAINLINE_REGION()
+#define ENTER_SO_NOT_MAINLINE_CODE
+#define LEAVE_SO_NOT_MAINLINE_CODE
+
+#endif // FEATURE_STACK_PROBE
+
+#ifdef ENABLE_CONTRACTS_IMPL
+
+class HostNoCallHolder
+{
+ public:
+ DEBUG_NOINLINE HostNoCallHolder()
+ {
+ SCAN_SCOPE_BEGIN;
+ STATIC_CONTRACT_HOST_NOCALLS;
+
+ m_clrDebugState = GetClrDebugState();
+ m_previousState = m_clrDebugState->SetHostCaller(FALSE);
+ }
+
+ DEBUG_NOINLINE ~HostNoCallHolder()
+ {
+ SCAN_SCOPE_END;
+
+ m_clrDebugState->SetHostCaller(m_previousState);
+ }
+
+ private:
+ BOOL m_previousState;
+ ClrDebugState* m_clrDebugState;
+
+};
+
+#define BEGIN_HOST_NOCALL_CODE \
+ { \
+ HostNoCallHolder __hostNoCallHolder; \
+ CantAllocHolder __cantAlloc;
+
+#define END_HOST_NOCALL_CODE \
+ }
+
+#else // ENABLE_CONTRACTS_IMPL
+#define BEGIN_HOST_NOCALL_CODE \
+ { \
+ CantAllocHolder __cantAlloc; \
+
+#define END_HOST_NOCALL_CODE \
+ }
+#endif
+
+#ifdef ENABLE_CONTRACTS_IMPL
+
+class GetThreadAllowedHolder
+{
+ public:
+ GetThreadAllowedHolder(BOOL newState)
+ {
+ m_clrDebugState = ::GetClrDebugState();
+ m_previousState = m_clrDebugState->SetGetThreadAllowed(newState);
+ }
+
+ ~GetThreadAllowedHolder()
+ {
+ m_clrDebugState->SetGetThreadAllowed(m_previousState);
+ }
+
+private:
+ BOOL m_previousState;
+ ClrDebugState* m_clrDebugState;
+};
+
+// When in an EE_THREAD_NOT_REQUIRED contracted scope, it's expected that the
+// function does not assume an EE Thread object is available in TLS. Either
+// GetThread() is never called, or any code path that requires a Thread
+// has another code path that deals with the absence of a Thread. Any call to
+// to GetThread() must be bracketed with BEGIN_GETTHREAD_ALLOWED /
+// END_GETTHREAD_ALLOWED to avoid bogus asserts (the short-form
+// GetThreadNULLOk() may be used as well). However, this is only allowed if visual
+// inspection of the call site makes it patently obvious that the function deals
+// appropriately with the GetThread() == NULL case (or that case has already been
+// dealt with and control has exited before the BEGIN_GETTHREAD_ALLOWED /
+// END_GETTHREAD_ALLOWED block.
+//
+// These use holder objects, which causes the compiler to generate EH code and prevent
+// inlining. So try to avoid these in small, downstream functions (like inline
+// EE Thread member functions). Use the _IN_NO_THROW_REGION variants below instead.
+
+#define BEGIN_GETTHREAD_ALLOWED \
+ { \
+ GetThreadAllowedHolder __getThreadAllowedHolder(TRUE); \
+
+#define END_GETTHREAD_ALLOWED \
+ }
+
+// These are lighter-weight versions of BEGIN_GETTHREAD_ALLOWED /
+// END_GETTHREAD_ALLOWED. These don't use holders, so be sure only to
+// use these to bracket code that won't throw exceptions
+#define BEGIN_GETTHREAD_ALLOWED_IN_NO_THROW_REGION \
+ { \
+ ClrDebugState * __clrDebugState = ::GetClrDebugState(); \
+ BOOL __previousState = __clrDebugState->SetGetThreadAllowed(TRUE); \
+
+#define END_GETTHREAD_ALLOWED_IN_NO_THROW_REGION \
+ __clrDebugState->SetGetThreadAllowed(__previousState); \
+ }
+
+#else // ENABLE_CONTRACTS_IMPL
+#define BEGIN_GETTHREAD_ALLOWED
+#define END_GETTHREAD_ALLOWED
+#define BEGIN_GETTHREAD_ALLOWED_IN_NO_THROW_REGION
+#define END_GETTHREAD_ALLOWED_IN_NO_THROW_REGION
+#endif
+
+#if defined(ENABLE_CONTRACTS_IMPL)
+
+// Macros to indicate we're taking or releasing locks
+
+// Most general macros, not used directly
+#define LOCK_TAKEN_MULTIPLE(dbgStateLockType, cEntrances, pvLock) \
+ ::GetClrDebugState()->LockTaken((dbgStateLockType), (cEntrances), (void*) (pvLock), __FUNCTION__, __FILE__, __LINE__)
+#define LOCK_RELEASED_MULTIPLE(dbgStateLockType, cExits, pvLock) \
+ ::GetClrDebugState()->LockReleased((dbgStateLockType), (cExits), (void*) (pvLock))
+
+// Use these only if you need to force multiple entrances or exits in a single
+// line (e.g., to restore the lock to a previous state). CRWLock in vm\rwlock.cpp does this
+#define EE_LOCK_TAKEN_MULTIPLE(cEntrances, pvLock) \
+ LOCK_TAKEN_MULTIPLE(kDbgStateLockType_EE, cEntrances, pvLock)
+#define EE_LOCK_RELEASED_MULTIPLE(cExits, pvLock) \
+ LOCK_RELEASED_MULTIPLE(kDbgStateLockType_EE, cExits, pvLock)
+#define HOST_BREAKABLE_CRST_TAKEN_MULTIPLE(cEntrances, pvLock) \
+ LOCK_TAKEN_MULTIPLE(kDbgStateLockType_HostBreakableCrst, cEntrances, pvLock)
+#define HOST_BREAKABLE_CRST_RELEASED_MULTIPLE(cExits, pvLock) \
+ LOCK_RELEASED_MULTIPLE(kDbgStateLockType_HostBreakableCrst, cExits, pvLock)
+#define USER_LOCK_TAKEN_MULTIPLE(cEntrances, pvLock) \
+ LOCK_TAKEN_MULTIPLE(kDbgStateLockType_User, cEntrances, pvLock)
+#define USER_LOCK_RELEASED_MULTIPLE(cExits, pvLock) \
+ LOCK_RELEASED_MULTIPLE(kDbgStateLockType_User, cExits, pvLock)
+
+// These are most typically used
+#define EE_LOCK_TAKEN(pvLock) \
+ LOCK_TAKEN_MULTIPLE(kDbgStateLockType_EE, 1, pvLock)
+#define EE_LOCK_RELEASED(pvLock) \
+ LOCK_RELEASED_MULTIPLE(kDbgStateLockType_EE, 1, pvLock)
+#define HOST_BREAKABLE_CRST_TAKEN(pvLock) \
+ LOCK_TAKEN_MULTIPLE(kDbgStateLockType_HostBreakableCrst, 1, pvLock)
+#define HOST_BREAKABLE_CRST_RELEASED(pvLock) \
+ LOCK_RELEASED_MULTIPLE(kDbgStateLockType_HostBreakableCrst, 1, pvLock)
+#define USER_LOCK_TAKEN(pvLock) \
+ LOCK_TAKEN_MULTIPLE(kDbgStateLockType_User, 1, pvLock)
+#define USER_LOCK_RELEASED(pvLock) \
+ LOCK_RELEASED_MULTIPLE(kDbgStateLockType_User, 1, pvLock)
+
+#else // defined(ENABLE_CONTRACTS_IMPL)
+
+#define LOCK_TAKEN_MULTIPLE(dbgStateLockType, cEntrances, pvLock)
+#define LOCK_RELEASED_MULTIPLE(dbgStateLockType, cExits, pvLock)
+#define EE_LOCK_TAKEN_MULTIPLE(cEntrances, pvLock)
+#define EE_LOCK_RELEASED_MULTIPLE(cExits, pvLock)
+#define HOST_BREAKABLE_CRST_TAKEN_MULTIPLE(cEntrances, pvLock)
+#define HOST_BREAKABLE_CRST_RELEASED_MULTIPLE(cExits, pvLock)
+#define USER_LOCK_TAKEN_MULTIPLE(cEntrances, pvLock)
+#define USER_LOCK_RELEASED_MULTIPLE(cExits, pvLock)
+#define EE_LOCK_TAKEN(pvLock)
+#define EE_LOCK_RELEASED(pvLock)
+#define HOST_BREAKABLE_CRST_TAKEN(pvLock)
+#define HOST_BREAKABLE_CRST_RELEASED(pvLock)
+#define USER_LOCK_TAKEN(pvLock)
+#define USER_LOCK_RELEASED(pvLock)
+
+#endif // defined(ENABLE_CONTRACTS_IMPL)
+
+#if defined(ENABLE_CONTRACTS_IMPL)
+
+// Abbreviation for an assert that is only considered if there is a valid
+// ClrDebugState available. Useful if you want to assert based on the value
+// of GetDbgStateLockCount(), where a return of 0 (the default if there is no
+// valid ClrDebugState available) would cause your assert to fire. The variable
+// __pClrDebugState is set to the current ClrDebugState, and may be used within
+// your assert expression
+#define ASSERT_UNLESS_NO_DEBUG_STATE(e) \
+ { \
+ ClrDebugState * __pClrDebugState = GetClrDebugState(); \
+ _ASSERTE(((__pClrDebugState->ViolationMask() & BadDebugState) != 0) || (e)); \
+ }
+
+#else // defined(ENABLE_CONTRACTS_IMPL)
+
+#define ASSERT_UNLESS_NO_DEBUG_STATE(e)
+
+#endif // defined(ENABLE_CONTRACTS_IMPL)
+
+
+//-----------------------------------------------------------------------------
+// Debug support to ensure that nobody calls New on the helper thread.
+// This is for interop debugging.
+// They should be using the InteropSafe heap.
+// Having this in the meantime allows us to
+// assert that the helper thread never calls new, and maintain a finite list of
+// exceptions (bugs).
+// Eventually, all those bugs should be fixed this holder can be completely removed.
+//
+// It is also the case that we disallow allocations when any thread is OS suspended
+// This happens for a short time when we are suspending the EE. We supress both
+// of these.
+//
+// @todo- ideally this would be rolled into the ContractViolation.
+// also, we'd have contract bit for whether APIs can be called on the helper thread.
+// @todo - if we really wanted to be strict, we should make this per-thread.
+//-----------------------------------------------------------------------------
+#ifdef ENABLE_CONTRACTS_IMPL
+extern Volatile<LONG> g_DbgSuppressAllocationAsserts;
+#define SUPPRESS_ALLOCATION_ASSERTS_IN_THIS_SCOPE CounterHolder _AllowNewOnHelperHolder(&g_DbgSuppressAllocationAsserts);
+#else
+// Nothing in retail since this holder just disabled an assert.
+#define SUPPRESS_ALLOCATION_ASSERTS_IN_THIS_SCOPE
+#endif
+
+
+//-----------------------------------------------------------------------------
+// Support for contracts in DAC builds
+//
+// At the moment, most of the contract system is disabled in DAC builds.
+// We do however want some simple static contracts in order to support static
+// analysis tools that run on mscordacwks.dll like DacCop.
+// Note that we want these static contracts in both DEBUG and retail builds.
+// We also already get simple static contracts like WRAPPER and LEAF.
+//
+//-----------------------------------------------------------------------------
+#if defined(DACCESS_COMPILE)
+
+// SUPPORTS_DAC is an annotation that says the function is designed to be used in DAC builds.
+// This enables full DacCop analysis on the function, including verifying that all functions that are
+// called also support DAC.
+#define SUPPORTS_DAC do { STATIC_CONTRACT_SUPPORTS_DAC; } while(0)
+
+// Normally a function can be annotated just with WRAPPER_NO_CONTRACT, which (in addition to the normal
+// contract meaning) indicates to DacCop that the function should be considered to support DAC when
+// it is called from a supports-dac function. This is to avoid having to add a DAC-specific contract
+// to all the trivial one-line wrapper functions we have.
+// However, we occasionally want these semantics even for functions which are not appropriate to label
+// as WRAPPER_NO_CONTRACT. For example, a template function may support DAC for certain template arguments,
+// but not others (due to the functions it calls). We want to ensure that when such a function is called
+// in a DAC code path, analysis is enabled on that particular instantiation including checking all of the
+// call targets specific to this template instantiation. But we don't want to require that the call targets
+// for ALL instantiations support dac, since we may not even be using them in DAC code paths. Ideally we'd
+// remove any such code from the DAC build, but this will take time.
+#define SUPPORTS_DAC_WRAPPER do { STATIC_CONTRACT_WRAPPER; } while(0)
+
+// SUPPORTS_DAC_HOST_ONLY indicates that a function is allowed to be called in DAC builds, but rather
+// than being a normal DAC function which operates on marshalled data, it is a host-only utility function
+// that knows nothing about DAC and operates solely on the host. For example, DbgAssertDialog is a utility
+// function for popping assert dialogs - there is nothing DAC-specific about this. Ideally such utility
+// functions would be confined to their own library which had no access to DAC functionality, and which
+// is not analyzed by DacCop. At the moment splitting utilcode into two variations like this is too
+// painful, but we hope to do it in the future (primarily to support functions which can be used in either
+// DAC or host-only mode).
+// WARNING: This contract disables DacCop analysis on the function and any functions it calls, so it
+// should be used very carefully.
+#define SUPPORTS_DAC_HOST_ONLY do { STATIC_CONTRACT_SUPPORTS_DAC_HOST_ONLY; } while(0)
+
+#else
+#define SUPPORTS_DAC
+#define SUPPORTS_DAC_HOST_ONLY
+#define SUPPORTS_DAC_WRAPPER
+#endif // DACCESS_COMPILE
+
+// LIMITED_METHOD_DAC_CONTRACT is a shortcut for LIMITED_METHOD_CONTRACT and SUPPORTS_DAC. Usefull for one-line inline functions.
+#define LIMITED_METHOD_DAC_CONTRACT LIMITED_METHOD_CONTRACT; SUPPORTS_DAC
+
+//
+// The default contract is the recommended contract for ordinary code.
+// The ordinary code can throw or trigger GC any time, does not operate
+// on raw object refs, etc.
+//
+
+#define STANDARD_VM_CHECK \
+ THROWS; \
+ SO_INTOLERANT; \
+
+#define STANDARD_VM_CONTRACT \
+ CONTRACTL \
+ { \
+ STANDARD_VM_CHECK; \
+ } \
+ CONTRACTL_END; \
+
+#define STATIC_STANDARD_VM_CONTRACT \
+ STATIC_CONTRACT_THROWS; \
+ STATIC_CONTRACT_GC_TRIGGERS; \
+ STATIC_CONTRACT_MODE_PREEMPTIVE; \
+ STATIC_CONTRACT_SO_INTOLERANT
+
+#define AFTER_CONTRACTS
+#include "volatile.h"
+
+#endif // CONTRACT_H_
diff --git a/src/inc/contract.inl b/src/inc/contract.inl
new file mode 100644
index 0000000000..ff165cf55c
--- /dev/null
+++ b/src/inc/contract.inl
@@ -0,0 +1,748 @@
+// 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.
+// ---------------------------------------------------------------------------
+// Contract.inl
+//
+
+// ! I am the owner for issues in the contract *infrastructure*, not for every
+// ! CONTRACT_VIOLATION dialog that comes up. If you interrupt my work for a routine
+// ! CONTRACT_VIOLATION, you will become the new owner of this file.
+// ---------------------------------------------------------------------------
+
+#ifndef CONTRACT_INL_
+#define CONTRACT_INL_
+
+#include "contract.h"
+#include <string.h>
+
+#ifndef _countof
+#define _countof(x) (sizeof(x)/sizeof(x[0]))
+#endif
+
+#ifdef ENABLE_CONTRACTS_IMPL
+
+#ifdef FEATURE_STACK_PROBE
+/* FLAG to turn on/off dynamic SO Contract checking */
+extern BOOL g_EnableDefaultRWValidation;
+
+/* Used to report any code with SO_NOT_MAINLINE being run in a test environment
+ * with COMPLUS_NO_SO_NOT_MAINLINE enabled
+ */
+void SONotMainlineViolation(const char *szFunction, const char *szFile, int lineNum);
+
+/* Wrapper over SOTolerantViolation(). Used to report SO_Intolerant functions being called
+ * from SO_tolerant funcs without stack probing.
+ */
+void SoTolerantViolationHelper(const char *szFunction,
+ const char *szFile,
+ int lineNum);
+#endif
+
+
+inline void BaseContract::DoChecks(UINT testmask, __in_z const char *szFunction, __in_z char *szFile, int lineNum)
+{
+ STATIC_CONTRACT_DEBUG_ONLY;
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_GC_NOTRIGGER;
+
+ // Cache the pointer to our ClrDebugState if it's not already cached.
+ // Derived types could set up this ptr before calling BaseContract::DoChecks if they have access to the Thread ptr
+ if (m_pClrDebugState == NULL)
+ {
+ m_pClrDebugState = GetClrDebugState();
+ }
+
+ // Save the incoming contents for restoration in the destructor
+ m_IncomingClrDebugState = *m_pClrDebugState;
+
+ m_testmask = testmask; // Save the testmask for destructor
+
+ // Setup the new stack record.
+ m_contractStackRecord.m_szFunction = szFunction;
+ m_contractStackRecord.m_szFile = szFile;
+ m_contractStackRecord.m_lineNum = lineNum;
+ m_contractStackRecord.m_testmask = testmask;
+ m_contractStackRecord.m_construct = "CONTRACT";
+
+ // Link the new ContractStackRecord into the chain for this thread.
+ m_pClrDebugState->LinkContractStackTrace( &m_contractStackRecord );
+
+ if (testmask & DEBUG_ONLY_Yes)
+ {
+ m_pClrDebugState->SetDebugOnly();
+ }
+
+#ifdef FEATURE_STACK_PROBE //Dynamic SO contract checks only required when SO infrastructure is present.
+
+ if (testmask & SO_MAINLINE_No)
+ {
+ static DWORD dwCheckNotMainline = -1;
+
+ // Some tests should never hit an SO_NOT_MAINLINE contract
+ if (dwCheckNotMainline == -1)
+ dwCheckNotMainline = CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_NO_SO_NOT_MAINLINE);
+
+
+ if (dwCheckNotMainline)
+ {
+ SONotMainlineViolation(m_contractStackRecord.m_szFunction,
+ m_contractStackRecord.m_szFile,
+ m_contractStackRecord.m_lineNum);
+ }
+
+ m_pClrDebugState->SetSONotMainline();
+ }
+
+#endif // FEATURE_STACK_PROBE
+
+ switch (testmask & FAULT_Mask)
+ {
+ case FAULT_Forbid:
+ m_pClrDebugState->ViolationMaskReset( FaultViolation|FaultNotFatal );
+ m_pClrDebugState->SetFaultForbid();
+ break;
+
+ case FAULT_Inject:
+ if (m_pClrDebugState->IsFaultForbid() &&
+ !(m_pClrDebugState->ViolationMask() & (FaultViolation|FaultNotFatal|BadDebugState)))
+ {
+ CONTRACT_ASSERT("INJECT_FAULT called in a FAULTFORBID region.",
+ BaseContract::FAULT_Forbid,
+ BaseContract::FAULT_Mask,
+ m_contractStackRecord.m_szFunction,
+ m_contractStackRecord.m_szFile,
+ m_contractStackRecord.m_lineNum);
+ }
+ break;
+
+ case FAULT_Disabled:
+ // Nothing
+ break;
+
+ default:
+ UNREACHABLE();
+ }
+
+ switch (testmask & THROWS_Mask)
+ {
+ case THROWS_Yes:
+ m_pClrDebugState->CheckOkayToThrow(m_contractStackRecord.m_szFunction,
+ m_contractStackRecord.m_szFile,
+ m_contractStackRecord.m_lineNum);
+ break;
+
+ case THROWS_No:
+ m_pClrDebugState->ViolationMaskReset( ThrowsViolation );
+ m_pClrDebugState->ResetOkToThrow();
+ break;
+
+ case THROWS_Disabled:
+ // Nothing
+ break;
+
+ default:
+ UNREACHABLE();
+ }
+
+ // LOADS_TYPE check
+ switch (testmask & LOADS_TYPE_Mask)
+ {
+ case LOADS_TYPE_Disabled:
+ // Nothing
+ break;
+
+ default:
+ {
+ UINT newTypeLoadLevel = ((testmask & LOADS_TYPE_Mask) >> LOADS_TYPE_Shift) - 1;
+ if (newTypeLoadLevel > m_pClrDebugState->GetMaxLoadTypeLevel())
+ {
+ if (!((LoadsTypeViolation|BadDebugState) & m_pClrDebugState->ViolationMask()))
+ {
+ CONTRACT_ASSERT("A function tried to load a type past the current level limit.",
+ (m_pClrDebugState->GetMaxLoadTypeLevel() + 1) << LOADS_TYPE_Shift,
+ Contract::LOADS_TYPE_Mask,
+ m_contractStackRecord.m_szFunction,
+ m_contractStackRecord.m_szFile,
+ m_contractStackRecord.m_lineNum
+ );
+ }
+ }
+ m_pClrDebugState->SetMaxLoadTypeLevel(newTypeLoadLevel);
+ m_pClrDebugState->ViolationMaskReset(LoadsTypeViolation);
+
+ }
+ break;
+ }
+
+#ifdef FEATURE_STACK_PROBE
+
+ switch (testmask & SO_TOLERANCE_Mask)
+ {
+ case SO_TOLERANT_No:
+ if (g_EnableDefaultRWValidation)
+ {
+ m_pClrDebugState->CheckIfSOIntolerantOK(m_contractStackRecord.m_szFunction,
+ m_contractStackRecord.m_szFile,
+ m_contractStackRecord.m_lineNum);
+ }
+ break;
+
+ case SO_TOLERANT_Yes:
+ case SO_TOLERANCE_Disabled:
+ // Nothing
+ break;
+
+ default:
+ UNREACHABLE();
+ }
+
+#endif // FEATURE_STACK_PROBE
+
+ if (testmask & CAN_RETAKE_LOCK_No)
+ {
+ m_pClrDebugState->OnEnterCannotRetakeLockFunction();
+ m_pClrDebugState->ResetOkToRetakeLock();
+ }
+
+ switch (testmask & CAN_TAKE_LOCK_Mask)
+ {
+ case CAN_TAKE_LOCK_Yes:
+ m_pClrDebugState->CheckOkayToLock(m_contractStackRecord.m_szFunction,
+ m_contractStackRecord.m_szFile,
+ m_contractStackRecord.m_lineNum);
+ break;
+
+ case CAN_TAKE_LOCK_No:
+ m_pClrDebugState->ViolationMaskReset(TakesLockViolation);
+ m_pClrDebugState->ResetOkToLock();
+ break;
+
+ case CAN_TAKE_LOCK_Disabled:
+ // Nothing
+ break;
+
+ default:
+ UNREACHABLE();
+ }
+
+}
+
+FORCEINLINE BOOL BaseContract::CheckFaultInjection()
+{
+ // ??? use m_tag to see if we should trigger an injection
+ return FALSE;
+}
+
+inline BOOL ClrDebugState::CheckOkayToThrowNoAssert()
+{
+ if (!IsOkToThrow() && !(m_violationmask & (ThrowsViolation|BadDebugState)))
+ {
+ return FALSE;
+ }
+ return TRUE;
+}
+
+inline void ClrDebugState::CheckOkayToThrow(__in_z const char *szFunction, __in_z const char *szFile, int lineNum)
+{
+ STATIC_CONTRACT_DEBUG_ONLY;
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_GC_NOTRIGGER;
+
+ if (!CheckOkayToThrowNoAssert())
+ {
+ CONTRACT_ASSERT("THROWS called in a NOTHROW region.",
+ BaseContract::THROWS_No,
+ BaseContract::THROWS_Mask,
+ szFunction,
+ szFile,
+ lineNum);
+ }
+}
+
+inline BOOL ClrDebugState::CheckOkayToLockNoAssert()
+{
+ STATIC_CONTRACT_DEBUG_ONLY;
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_GC_NOTRIGGER;
+
+ if (!IsOkToLock() && !(m_violationmask & (TakesLockViolation|BadDebugState)))
+ {
+ return FALSE;
+ }
+ return TRUE;
+}
+
+inline void ClrDebugState::CheckOkayToLock(__in_z const char *szFunction, __in_z const char *szFile, int lineNum)
+{
+ STATIC_CONTRACT_DEBUG_ONLY;
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_GC_NOTRIGGER;
+
+ if (!CheckOkayToLockNoAssert())
+ {
+
+ CONTRACT_ASSERT("CAN_TAKE_LOCK called in a CANNOT_TAKE_LOCK region.",
+ BaseContract::CAN_TAKE_LOCK_No,
+ BaseContract::CAN_TAKE_LOCK_Mask,
+ szFunction,
+ szFile,
+ lineNum);
+
+ }
+}
+
+
+inline void ClrDebugState::LockTaken(DbgStateLockType dbgStateLockType,
+ UINT cTakes,
+ void * pvLock,
+ __in_z const char * szFunction,
+ __in_z const char * szFile,
+ int lineNum)
+{
+ STATIC_CONTRACT_DEBUG_ONLY;
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_GC_NOTRIGGER;
+
+ if ((m_violationmask & BadDebugState) != 0)
+ {
+ return;
+ }
+
+ // Assert if we're taking a lock in a CANNOT_TAKE_LOCK scope. Even if this asserts, we'll
+ // continue to the following lines to track the lock
+ CheckOkayToLock(szFunction, szFile, lineNum);
+
+ _ASSERTE(GetDbgStateLockData() != NULL);
+
+ if (!IsOkToRetakeLock())
+ {
+ if (m_LockState.IsLockRetaken(pvLock))
+ {
+ CONTRACT_ASSERT("You cannot take a lock which is already being held in a CANNOT_RETAKE_LOCK scope.",
+ BaseContract::CAN_RETAKE_LOCK_No,
+ BaseContract::CAN_RETAKE_LOCK_No,
+ szFunction,
+ szFile,
+ lineNum);
+ }
+ }
+
+ GetDbgStateLockData()->LockTaken(dbgStateLockType, cTakes, pvLock, szFunction, szFile, lineNum);
+}
+
+inline void ClrDebugState::LockReleased(DbgStateLockType dbgStateLockType, UINT cReleases, void * pvLock)
+{
+ STATIC_CONTRACT_DEBUG_ONLY;
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_GC_NOTRIGGER;
+
+ if ((m_violationmask & BadDebugState) != 0)
+ {
+ return;
+ }
+
+ _ASSERTE(GetDbgStateLockData() != NULL);
+
+ if (!IsOkToRetakeLock())
+ {
+ // It is very suspicious to release any locks being hold at the time this function was
+ // called in a CANNOT_RETAKE_LOCK scope
+ _ASSERTE(m_LockState.IsSafeToRelease(cReleases));
+ }
+
+ GetDbgStateLockData()->LockReleased(dbgStateLockType, cReleases, pvLock);
+}
+
+inline UINT ClrDebugState::GetLockCount(DbgStateLockType dbgStateLockType)
+{
+ STATIC_CONTRACT_DEBUG_ONLY;
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_GC_NOTRIGGER;
+
+ if ((m_violationmask & BadDebugState) != 0)
+ {
+ return 0;
+ }
+
+ _ASSERTE(GetDbgStateLockData() != NULL);
+ return GetDbgStateLockData()->GetLockCount(dbgStateLockType);
+}
+
+inline UINT ClrDebugState::GetCombinedLockCount()
+{
+ STATIC_CONTRACT_DEBUG_ONLY;
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_GC_NOTRIGGER;
+
+ if ((m_violationmask & BadDebugState) != 0)
+ {
+ return 0;
+ }
+
+ _ASSERTE(GetDbgStateLockData() != NULL);
+ return GetDbgStateLockData()->GetCombinedLockCount();
+}
+
+inline void DbgStateLockData::LockTaken(DbgStateLockType dbgStateLockType,
+ UINT cTakes, // # times we're taking this lock (usually 1)
+ void * pvLock,
+ __in_z const char * szFunction,
+ __in_z const char * szFile,
+ int lineNum)
+{
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_GC_NOTRIGGER;
+
+ // Technically the lock's already been taken before we're called, but it's
+ // handy to have this contract here at the leaf end of the call chain, as it
+ // ensures SCAN will enforce that no use of the LOCK_TAKEN macros occurs
+ // in a CANNOT_TAKE_LOCK scope (as LOCK_TAKEN macros just call this function).
+ STATIC_CONTRACT_CAN_TAKE_LOCK;
+
+ // Valid enum?
+ _ASSERTE(UINT(dbgStateLockType) < kDbgStateLockType_Count);
+
+ UINT cCombinedLocks = GetCombinedLockCount();
+
+ // Are we exceeding the threshold for what we can store in m_rgTakenLockInfos?
+ // If so, assert a warning, but we'll deal with it.
+ if ((cCombinedLocks <= _countof(m_rgTakenLockInfos)) &&
+ (cCombinedLocks + cTakes > _countof(m_rgTakenLockInfos)))
+ {
+ // Actually, for now we are NOT asserting until I can dedicate more time
+ // to this. Some class loader code paths legally hold many simultaneous
+ // locks (>10). Need to do further analysis on reasonable value to set
+ // for kMaxAllowedSimultaneousLocks. Since lock order checking is turned
+ // off for the moment anyway, exceeding kMaxAllowedSimultaneousLocks
+ // has no consequences for now anyway.
+ }
+
+ m_rgcLocksTaken[dbgStateLockType] += cTakes;
+
+ // Remember as many of these new entrances in m_rgTakenLockInfos as we can
+ for (UINT i = cCombinedLocks;
+ i < min (_countof(m_rgTakenLockInfos), cCombinedLocks + cTakes);
+ i++)
+ {
+ m_rgTakenLockInfos[i].m_pvLock = pvLock;
+ m_rgTakenLockInfos[i].m_szFile = szFile;
+ m_rgTakenLockInfos[i].m_lineNum = lineNum;
+ }
+}
+
+inline void DbgStateLockData::LockReleased(DbgStateLockType dbgStateLockType, UINT cReleases, void * pvLock)
+{
+ // Valid enum?
+ _ASSERTE(UINT(dbgStateLockType) < kDbgStateLockType_Count);
+
+ if (cReleases > m_rgcLocksTaken[dbgStateLockType])
+ {
+ _ASSERTE(!"Releasing lock(s) that were never taken");
+ cReleases = m_rgcLocksTaken[dbgStateLockType];
+ }
+
+ UINT cCombinedLocks = GetCombinedLockCount();
+
+ // If lock count is within range of our m_rgTakenLockInfos buffer size, then
+ // make sure we're releasing locks in reverse order of how we took them
+ for (UINT i = cCombinedLocks - cReleases;
+ i < min (_countof(m_rgTakenLockInfos), cCombinedLocks);
+ i++)
+ {
+ if (m_rgTakenLockInfos[i].m_pvLock != pvLock)
+ {
+ // Ok, I lied. We're not really checking that we're releasing locks in reverse
+ // order, because sometimes we legally release them out of order. (The loader
+ // does this intentionally in a few places.) We should consider whether those
+ // places can be changed, or whether we can add some kind of macro to declare
+ // that we're releasing out of order, and that it's ok & intentional. At that
+ // point, we can place a nice ASSERTE right here. Until then, do nothing.
+ }
+
+ // We may be clearing out the wrong entry in m_rgTakenLockInfos here, if the locks
+ // were released out of order. However, it will eventually correct itself once all
+ // the out-of-order locks have been released. And our count
+ // (i.e., m_rgcLocksTaken[dbgStateLockType]) will always be accurate
+ memset(&(m_rgTakenLockInfos[i]),
+ 0,
+ sizeof(m_rgTakenLockInfos[i]));
+ }
+
+ m_rgcLocksTaken[dbgStateLockType] -= cReleases;
+}
+
+inline void DbgStateLockData::SetStartingValues()
+{
+ memset(this, 0, sizeof(*this));
+}
+
+inline UINT DbgStateLockData::GetLockCount(DbgStateLockType dbgStateLockType)
+{
+ _ASSERTE(UINT(dbgStateLockType) < kDbgStateLockType_Count);
+ return m_rgcLocksTaken[dbgStateLockType];
+}
+
+inline UINT DbgStateLockData::GetCombinedLockCount()
+{
+ // If this fires, the set of lock types must have changed. You'll need to
+ // fix the sum below to include all lock types
+ _ASSERTE(kDbgStateLockType_Count == 3);
+
+ return m_rgcLocksTaken[0] + m_rgcLocksTaken[1] + m_rgcLocksTaken[2];
+}
+
+inline void DbgStateLockState::SetStartingValues()
+{
+ m_cLocksEnteringCannotRetakeLock = 0;
+ m_pLockData = NULL; // Will get filled in by CLRInitDebugState()
+}
+
+// We set a marker to record the number of locks that have been taken when
+// CANNOT_RETAKE_LOCK contract is constructed.
+inline void DbgStateLockState::OnEnterCannotRetakeLockFunction()
+{
+ m_cLocksEnteringCannotRetakeLock = m_pLockData->GetCombinedLockCount();
+}
+
+inline BOOL DbgStateLockState::IsLockRetaken(void * pvLock)
+{
+ // m_cLocksEnteringCannotRetakeLock must be in valid range
+ _ASSERTE(m_cLocksEnteringCannotRetakeLock <= m_pLockData->GetCombinedLockCount());
+
+ // m_cLocksEnteringCannotRetakeLock records the number of locks that were taken
+ // when CANNOT_RETAKE_LOCK contract was constructed.
+ for (UINT i = 0;
+ i < min(_countof(m_pLockData->m_rgTakenLockInfos), m_cLocksEnteringCannotRetakeLock);
+ ++i)
+ {
+ if (m_pLockData->m_rgTakenLockInfos[i].m_pvLock == pvLock)
+ {
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+
+inline BOOL DbgStateLockState::IsSafeToRelease(UINT cReleases)
+{
+ return m_cLocksEnteringCannotRetakeLock <= (m_pLockData->GetCombinedLockCount() - cReleases);
+}
+
+inline void DbgStateLockState::SetDbgStateLockData(DbgStateLockData * pDbgStateLockData)
+{
+ m_pLockData = pDbgStateLockData;
+}
+
+inline DbgStateLockData * DbgStateLockState::GetDbgStateLockData()
+{
+ return m_pLockData;
+}
+
+#ifdef FEATURE_STACK_PROBE
+// We don't want to allow functions that use holders to EX_TRY to be intolerant
+// code... if an exception were to occur, the holders and EX_CATCH/FINALLY would
+// have less than 1/4 clean up.
+inline void EnsureSOIntolerantOK(const char *szFunction,
+ const char *szFile,
+ int lineNum)
+{
+ // We don't want to use a holder here, because a holder will
+ // call EnsureSOIntolerantOK
+
+ DWORD error = GetLastError();
+ if (! g_EnableDefaultRWValidation)
+ {
+ SetLastError(error);
+ return;
+ }
+ ClrDebugState *pClrDebugState = CheckClrDebugState();
+ if (! pClrDebugState)
+ {
+ SetLastError(error);
+ return;
+ }
+ pClrDebugState->CheckIfSOIntolerantOK(szFunction, szFile, lineNum);
+ SetLastError(error);
+}
+
+inline void ClrDebugState::CheckIfSOIntolerantOK(const char *szFunction,
+ const char *szFile,
+ int lineNum)
+
+{
+ // If we are an RW function on a managed thread, we must be in SO-intolerant mode. Ie. we must be behind a probe.
+ if (IsSOIntolerant() || IsDebugOnly() || IsSONotMainline() || (m_violationmask & SOToleranceViolation) ||
+ !g_fpShouldValidateSOToleranceOnThisThread || !g_fpShouldValidateSOToleranceOnThisThread())
+ {
+ return;
+ }
+ SoTolerantViolationHelper(szFunction, szFile, lineNum);
+}
+
+#endif
+
+inline
+void CONTRACT_ASSERT(const char *szElaboration,
+ UINT whichTest,
+ UINT whichTestMask,
+ const char *szFunction,
+ const char *szFile,
+ int lineNum)
+{
+ if (CheckClrDebugState() && ( CheckClrDebugState()->ViolationMask() & BadDebugState))
+ {
+ _ASSERTE(!"Someone tried to assert a contract violation although the contracts were disabled in this thread due to"
+ " an OOM or a shim/mscorwks mismatch. You can probably safely ignore this assert - however, whoever"
+ " called CONTRACT_ASSERT was supposed to checked if the current violationmask had the BadDebugState set."
+ " Look up the stack, see who called CONTRACT_ASSERT and file a bug against the owner.");
+ return;
+ }
+
+ // prevent recursion - we use the same mechanism as CHECK, so this will
+ // also prevent mutual recursion involving ASSERT_CHECKs
+ CHECK _check;
+ if (_check.EnterAssert())
+ {
+ char Buf[512*20 + 2048 + 1024];
+
+ sprintf_s(Buf,_countof(Buf), "CONTRACT VIOLATION by %s at \"%s\" @ %d\n\n%s\n", szFunction, szFile, lineNum, szElaboration);
+
+ int count = 20;
+ ContractStackRecord *pRec = CheckClrDebugState() ? CheckClrDebugState()->GetContractStackTrace() : NULL;
+ BOOL foundconflict = FALSE;
+ BOOL exceptionBuildingStack = FALSE;
+
+ PAL_TRY_NAKED
+ {
+ while (pRec != NULL)
+ {
+ char tmpbuf[512];
+ BOOL fshowconflict = FALSE;
+
+ if (!foundconflict)
+ {
+ if (whichTest == (pRec->m_testmask & whichTestMask))
+ {
+ foundconflict = TRUE;
+ fshowconflict = TRUE;
+ }
+ }
+
+ if (count != 0 || fshowconflict)
+ {
+ if (count != 0)
+ {
+ count--;
+ }
+ else
+ {
+ // Show that some lines have been skipped
+ strcat_s(Buf, _countof(Buf), "\n ...");
+
+ }
+
+ sprintf_s(tmpbuf,_countof(tmpbuf),
+ "\n%s %s in %s at \"%s\" @ %d",
+ fshowconflict ? "VIOLATED-->" : " ",
+ pRec->m_construct,
+ pRec->m_szFunction,
+ pRec->m_szFile,
+ pRec->m_lineNum
+ );
+
+ strcat_s(Buf, _countof(Buf), tmpbuf);
+ }
+
+ pRec = pRec->m_pNext;
+ }
+ }
+ PAL_EXCEPT_NAKED(EXCEPTION_EXECUTE_HANDLER)
+ {
+ // We're done trying to walk the stack of contracts. We faulted trying to form the contract stack trace,
+ // and that usually means that its corrupted. A common cause of this is having CONTRACTs in functions that
+ // never return, but instead do a non-local goto.
+ count = 0;
+ exceptionBuildingStack = TRUE;
+ }
+ PAL_ENDTRY_NAKED;
+
+ if (count == 0)
+ {
+ strcat_s(Buf,_countof(Buf), "\n ...");
+ }
+
+ if (exceptionBuildingStack)
+ {
+ strcat_s(Buf,_countof(Buf),
+ "\n"
+ "\nError forming contract stack. Any contract stack displayed above is correct,"
+ "\nbut it's most probably truncated. This is probably due to a CONTRACT in a"
+ "\nfunction that does a non-local goto. There are two bugs here:"
+ "\n"
+ "\n 1) the CONTRACT violation, and"
+ "\n 2) the CONTRACT in the function with the non-local goto."
+ "\n"
+ "\nPlease fix both bugs!"
+ "\n"
+ );
+ }
+
+ strcat_s(Buf,_countof(Buf), "\n\n");
+
+ if (!foundconflict && count != 0)
+ {
+ if (whichTest == BaseContract::THROWS_No)
+ {
+ strcat_s(Buf,_countof(Buf), "You can't throw here because there is no handler on the stack.\n");
+ }
+ else
+ {
+ strcat_s(Buf,_countof(Buf), "We can't find the violated contract. Look for an old-style non-holder-based contract.\n");
+ }
+ }
+
+ DbgAssertDialog((char *)szFile, lineNum, Buf);
+ _check.LeaveAssert();
+ }
+}
+
+
+FORCEINLINE BOOL BaseContract::EnforceContract()
+{
+ if (s_alwaysEnforceContracts)
+ return TRUE;
+ else
+ return CHECK::EnforceAssert();
+}
+
+inline void BaseContract::SetUnconditionalContractEnforcement(BOOL value)
+{
+ s_alwaysEnforceContracts = value;
+}
+
+inline UINT GetDbgStateCombinedLockCount()
+{
+ return GetClrDebugState()->GetCombinedLockCount();
+}
+inline UINT GetDbgStateLockCount(DbgStateLockType dbgStateLockType)
+{
+ return GetClrDebugState()->GetLockCount(dbgStateLockType);
+}
+
+#define ASSERT_NO_USER_LOCKS_HELD() \
+ _ASSERTE(GetDbgStateLockCount(kDbgStateLockType_User) == 0)
+#define ASSERT_NO_HOST_BREAKABLE_CRSTS_HELD() \
+ _ASSERTE(GetDbgStateLockCount(kDbgStateLockType_HostBreakableCrst) == 0)
+#define ASSERT_NO_EE_LOCKS_HELD() \
+ _ASSERTE(GetDbgStateLockCount(kDbgStateLockType_EE) == 0)
+
+#else // ENABLE_CONTRACTS_IMPL
+
+#define ASSERT_NO_USER_LOCKS_HELD()
+#define ASSERT_NO_HOST_BREAKABLE_CRSTS_HELD()
+#define ASSERT_NO_EE_LOCKS_HELD()
+
+#endif // ENABLE_CONTRACTS_IMPL
+
+#endif // CONTRACT_INL_
diff --git a/src/inc/contxt.h b/src/inc/contxt.h
new file mode 100644
index 0000000000..98240b3331
--- /dev/null
+++ b/src/inc/contxt.h
@@ -0,0 +1,3472 @@
+// 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.
+
+/* this ALWAYS GENERATED file contains the definitions for the interfaces */
+
+
+/* File created by MIDL compiler version 5.01.0164 */
+/* at Mon May 01 14:39:38 2000
+ */
+/* Compiler settings for contxt.idl:
+ Os (OptLev=s), W1, Zp8, env=Win32, ms_ext, c_ext
+ error checks: allocation ref bounds_check enum stub_data
+*/
+//@@MIDL_FILE_HEADING( )
+
+
+/* verify that the <rpcndr.h> version is high enough to compile this file*/
+#ifndef __REQUIRED_RPCNDR_H_VERSION__
+#define __REQUIRED_RPCNDR_H_VERSION__ 440
+#endif
+
+#include "rpc.h"
+#include "rpcndr.h"
+
+#ifndef __RPCNDR_H_VERSION__
+#error this stub requires an updated version of <rpcndr.h>
+#endif // __RPCNDR_H_VERSION__
+
+#ifndef COM_NO_WINDOWS_H
+#include "windows.h"
+#include "ole2.h"
+#endif /*COM_NO_WINDOWS_H*/
+
+#ifndef __contxt_h__
+#define __contxt_h__
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+/* Forward Declarations */
+
+#ifndef __IEnumContextProps_FWD_DEFINED__
+#define __IEnumContextProps_FWD_DEFINED__
+typedef interface IEnumContextProps IEnumContextProps;
+#endif /* __IEnumContextProps_FWD_DEFINED__ */
+
+
+#ifndef __IContext_FWD_DEFINED__
+#define __IContext_FWD_DEFINED__
+typedef interface IContext IContext;
+#endif /* __IContext_FWD_DEFINED__ */
+
+
+#ifndef __IContextMarshaler_FWD_DEFINED__
+#define __IContextMarshaler_FWD_DEFINED__
+typedef interface IContextMarshaler IContextMarshaler;
+#endif /* __IContextMarshaler_FWD_DEFINED__ */
+
+
+#ifndef __IObjContext_FWD_DEFINED__
+#define __IObjContext_FWD_DEFINED__
+typedef interface IObjContext IObjContext;
+#endif /* __IObjContext_FWD_DEFINED__ */
+
+
+#ifndef __IGetContextId_FWD_DEFINED__
+#define __IGetContextId_FWD_DEFINED__
+typedef interface IGetContextId IGetContextId;
+#endif /* __IGetContextId_FWD_DEFINED__ */
+
+
+#ifndef __IAggregator_FWD_DEFINED__
+#define __IAggregator_FWD_DEFINED__
+typedef interface IAggregator IAggregator;
+#endif /* __IAggregator_FWD_DEFINED__ */
+
+
+#ifndef __ICall_FWD_DEFINED__
+#define __ICall_FWD_DEFINED__
+typedef interface ICall ICall;
+#endif /* __ICall_FWD_DEFINED__ */
+
+
+#ifndef __IRpcCall_FWD_DEFINED__
+#define __IRpcCall_FWD_DEFINED__
+typedef interface IRpcCall IRpcCall;
+#endif /* __IRpcCall_FWD_DEFINED__ */
+
+
+#ifndef __ICallInfo_FWD_DEFINED__
+#define __ICallInfo_FWD_DEFINED__
+typedef interface ICallInfo ICallInfo;
+#endif /* __ICallInfo_FWD_DEFINED__ */
+
+
+#ifndef __IPolicy_FWD_DEFINED__
+#define __IPolicy_FWD_DEFINED__
+typedef interface IPolicy IPolicy;
+#endif /* __IPolicy_FWD_DEFINED__ */
+
+
+#ifndef __IPolicyAsync_FWD_DEFINED__
+#define __IPolicyAsync_FWD_DEFINED__
+typedef interface IPolicyAsync IPolicyAsync;
+#endif /* __IPolicyAsync_FWD_DEFINED__ */
+
+
+#ifndef __IPolicySet_FWD_DEFINED__
+#define __IPolicySet_FWD_DEFINED__
+typedef interface IPolicySet IPolicySet;
+#endif /* __IPolicySet_FWD_DEFINED__ */
+
+
+#ifndef __IComObjIdentity_FWD_DEFINED__
+#define __IComObjIdentity_FWD_DEFINED__
+typedef interface IComObjIdentity IComObjIdentity;
+#endif /* __IComObjIdentity_FWD_DEFINED__ */
+
+
+#ifndef __IPolicyMaker_FWD_DEFINED__
+#define __IPolicyMaker_FWD_DEFINED__
+typedef interface IPolicyMaker IPolicyMaker;
+#endif /* __IPolicyMaker_FWD_DEFINED__ */
+
+
+#ifndef __IExceptionNotification_FWD_DEFINED__
+#define __IExceptionNotification_FWD_DEFINED__
+typedef interface IExceptionNotification IExceptionNotification;
+#endif /* __IExceptionNotification_FWD_DEFINED__ */
+
+
+#ifndef __IMarshalEnvoy_FWD_DEFINED__
+#define __IMarshalEnvoy_FWD_DEFINED__
+typedef interface IMarshalEnvoy IMarshalEnvoy;
+#endif /* __IMarshalEnvoy_FWD_DEFINED__ */
+
+
+#ifndef __IWrapperInfo_FWD_DEFINED__
+#define __IWrapperInfo_FWD_DEFINED__
+typedef interface IWrapperInfo IWrapperInfo;
+#endif /* __IWrapperInfo_FWD_DEFINED__ */
+
+
+#ifndef __IComThreadingInfo_FWD_DEFINED__
+#define __IComThreadingInfo_FWD_DEFINED__
+typedef interface IComThreadingInfo IComThreadingInfo;
+#endif /* __IComThreadingInfo_FWD_DEFINED__ */
+
+
+#ifndef __IComDispatchInfo_FWD_DEFINED__
+#define __IComDispatchInfo_FWD_DEFINED__
+typedef interface IComDispatchInfo IComDispatchInfo;
+#endif /* __IComDispatchInfo_FWD_DEFINED__ */
+
+
+/* header files for imported files */
+#include "wtypes.h"
+#include "objidl.h"
+
+void __RPC_FAR * __RPC_USER MIDL_user_allocate(size_t);
+void __RPC_USER MIDL_user_free( void __RPC_FAR * );
+
+/* interface __MIDL_itf_contxt_0000 */
+/* [local] */
+
+enum tagCONTEXTEVENT
+ { CONTEXTEVENT_NONE = 0,
+ CONTEXTEVENT_CALL = 0x1,
+ CONTEXTEVENT_ENTER = 0x2,
+ CONTEXTEVENT_LEAVE = 0x4,
+ CONTEXTEVENT_RETURN = 0x8,
+ CONTEXTEVENT_CALLFILLBUFFER = 0x10,
+ CONTEXTEVENT_ENTERWITHBUFFER = 0x20,
+ CONTEXTEVENT_LEAVEFILLBUFFER = 0x40,
+ CONTEXTEVENT_RETURNWITHBUFFER = 0x80,
+ CONTEXTEVENT_BEGINCALL = 0x100,
+ CONTEXTEVENT_BEGINENTER = 0x200,
+ CONTEXTEVENT_BEGINLEAVE = 0x400,
+ CONTEXTEVENT_BEGINRETURN = 0x800,
+ CONTEXTEVENT_FINISHCALL = 0x1000,
+ CONTEXTEVENT_FINISHENTER = 0x2000,
+ CONTEXTEVENT_FINISHLEAVE = 0x4000,
+ CONTEXTEVENT_FINISHRETURN = 0x8000,
+ CONTEXTEVENT_BEGINCALLFILLBUFFER = 0x10000,
+ CONTEXTEVENT_BEGINENTERWITHBUFFER = 0x20000,
+ CONTEXTEVENT_FINISHLEAVEFILLBUFFER = 0x40000,
+ CONTEXTEVENT_FINISHRETURNWITHBUFFER = 0x80000,
+ CONTEXTEVENT_LEAVEEXCEPTION = 0x100000,
+ CONTEXTEVENT_LEAVEEXCEPTIONFILLBUFFER = 0x200000,
+ CONTEXTEVENT_RETURNEXCEPTION = 0x400000,
+ CONTEXTEVENT_RETURNEXCEPTIONWITHBUFFER = 0x800000,
+ CONTEXTEVENT_ADDREFPOLICY = 0x10000000,
+ CONTEXTEVENT_RELEASEPOLICY = 0x20000000
+ };
+typedef DWORD ContextEvent;
+
+
+enum tagCPFLAGS
+ { CPFLAG_NONE = 0,
+ CPFLAG_PROPAGATE = 0x1,
+ CPFLAG_EXPOSE = 0x2,
+ CPFLAG_ENVOY = 0x4,
+ CPFLAG_MONITORSTUB = 0x8,
+ CPFLAG_MONITORPROXY = 0x10,
+ CPFLAG_DONTCOMPARE = 0x20
+ };
+typedef DWORD CPFLAGS;
+
+extern RPC_IF_HANDLE __MIDL_itf_contxt_0000_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_contxt_0000_v0_0_s_ifspec;
+
+#ifndef __IEnumContextProps_INTERFACE_DEFINED__
+#define __IEnumContextProps_INTERFACE_DEFINED__
+
+/* interface IEnumContextProps */
+/* [unique][uuid][object] */
+
+typedef /* [unique] */ IEnumContextProps __RPC_FAR *LPENUMCONTEXTPROPS;
+
+
+EXTERN_C const IID IID_IEnumContextProps;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("000001c1-0000-0000-C000-000000000046")
+ IEnumContextProps : public IUnknown
+ {
+ public:
+ virtual HRESULT STDMETHODCALLTYPE Next(
+ /* [in] */ ULONG celt,
+ /* [length_is][size_is][out] */ ContextProperty __RPC_FAR *pContextProperties,
+ /* [out] */ ULONG __RPC_FAR *pceltFetched) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Skip(
+ /* [in] */ ULONG celt) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Reset( void) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Clone(
+ /* [out] */ IEnumContextProps __RPC_FAR *__RPC_FAR *ppEnumContextProps) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Count(
+ /* [out] */ ULONG __RPC_FAR *pcelt) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IEnumContextPropsVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )(
+ IEnumContextProps __RPC_FAR * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )(
+ IEnumContextProps __RPC_FAR * This);
+
+ ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )(
+ IEnumContextProps __RPC_FAR * This);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Next )(
+ IEnumContextProps __RPC_FAR * This,
+ /* [in] */ ULONG celt,
+ /* [length_is][size_is][out] */ ContextProperty __RPC_FAR *pContextProperties,
+ /* [out] */ ULONG __RPC_FAR *pceltFetched);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Skip )(
+ IEnumContextProps __RPC_FAR * This,
+ /* [in] */ ULONG celt);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Reset )(
+ IEnumContextProps __RPC_FAR * This);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Clone )(
+ IEnumContextProps __RPC_FAR * This,
+ /* [out] */ IEnumContextProps __RPC_FAR *__RPC_FAR *ppEnumContextProps);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Count )(
+ IEnumContextProps __RPC_FAR * This,
+ /* [out] */ ULONG __RPC_FAR *pcelt);
+
+ END_INTERFACE
+ } IEnumContextPropsVtbl;
+
+ interface IEnumContextProps
+ {
+ CONST_VTBL struct IEnumContextPropsVtbl __RPC_FAR *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IEnumContextProps_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IEnumContextProps_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IEnumContextProps_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IEnumContextProps_Next(This,celt,pContextProperties,pceltFetched) \
+ (This)->lpVtbl -> Next(This,celt,pContextProperties,pceltFetched)
+
+#define IEnumContextProps_Skip(This,celt) \
+ (This)->lpVtbl -> Skip(This,celt)
+
+#define IEnumContextProps_Reset(This) \
+ (This)->lpVtbl -> Reset(This)
+
+#define IEnumContextProps_Clone(This,ppEnumContextProps) \
+ (This)->lpVtbl -> Clone(This,ppEnumContextProps)
+
+#define IEnumContextProps_Count(This,pcelt) \
+ (This)->lpVtbl -> Count(This,pcelt)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+HRESULT STDMETHODCALLTYPE IEnumContextProps_Next_Proxy(
+ IEnumContextProps __RPC_FAR * This,
+ /* [in] */ ULONG celt,
+ /* [length_is][size_is][out] */ ContextProperty __RPC_FAR *pContextProperties,
+ /* [out] */ ULONG __RPC_FAR *pceltFetched);
+
+
+void __RPC_STUB IEnumContextProps_Next_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IEnumContextProps_Skip_Proxy(
+ IEnumContextProps __RPC_FAR * This,
+ /* [in] */ ULONG celt);
+
+
+void __RPC_STUB IEnumContextProps_Skip_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IEnumContextProps_Reset_Proxy(
+ IEnumContextProps __RPC_FAR * This);
+
+
+void __RPC_STUB IEnumContextProps_Reset_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IEnumContextProps_Clone_Proxy(
+ IEnumContextProps __RPC_FAR * This,
+ /* [out] */ IEnumContextProps __RPC_FAR *__RPC_FAR *ppEnumContextProps);
+
+
+void __RPC_STUB IEnumContextProps_Clone_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IEnumContextProps_Count_Proxy(
+ IEnumContextProps __RPC_FAR * This,
+ /* [out] */ ULONG __RPC_FAR *pcelt);
+
+
+void __RPC_STUB IEnumContextProps_Count_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IEnumContextProps_INTERFACE_DEFINED__ */
+
+
+#ifndef __IContext_INTERFACE_DEFINED__
+#define __IContext_INTERFACE_DEFINED__
+
+/* interface IContext */
+/* [unique][uuid][object][local] */
+
+
+EXTERN_C const IID IID_IContext;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("000001c0-0000-0000-C000-000000000046")
+ IContext : public IUnknown
+ {
+ public:
+ virtual HRESULT STDMETHODCALLTYPE SetProperty(
+ /* [in] */ REFGUID rpolicyId,
+ /* [in] */ CPFLAGS flags,
+ /* [in] */ IUnknown __RPC_FAR *pUnk) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE RemoveProperty(
+ /* [in] */ REFGUID rPolicyId) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE GetProperty(
+ /* [in] */ REFGUID rGuid,
+ /* [out] */ CPFLAGS __RPC_FAR *pFlags,
+ /* [out] */ IUnknown __RPC_FAR *__RPC_FAR *ppUnk) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE EnumContextProps(
+ /* [out] */ IEnumContextProps __RPC_FAR *__RPC_FAR *ppEnumContextProps) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IContextVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )(
+ IContext __RPC_FAR * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )(
+ IContext __RPC_FAR * This);
+
+ ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )(
+ IContext __RPC_FAR * This);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetProperty )(
+ IContext __RPC_FAR * This,
+ /* [in] */ REFGUID rpolicyId,
+ /* [in] */ CPFLAGS flags,
+ /* [in] */ IUnknown __RPC_FAR *pUnk);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *RemoveProperty )(
+ IContext __RPC_FAR * This,
+ /* [in] */ REFGUID rPolicyId);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetProperty )(
+ IContext __RPC_FAR * This,
+ /* [in] */ REFGUID rGuid,
+ /* [out] */ CPFLAGS __RPC_FAR *pFlags,
+ /* [out] */ IUnknown __RPC_FAR *__RPC_FAR *ppUnk);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *EnumContextProps )(
+ IContext __RPC_FAR * This,
+ /* [out] */ IEnumContextProps __RPC_FAR *__RPC_FAR *ppEnumContextProps);
+
+ END_INTERFACE
+ } IContextVtbl;
+
+ interface IContext
+ {
+ CONST_VTBL struct IContextVtbl __RPC_FAR *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IContext_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IContext_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IContext_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IContext_SetProperty(This,rpolicyId,flags,pUnk) \
+ (This)->lpVtbl -> SetProperty(This,rpolicyId,flags,pUnk)
+
+#define IContext_RemoveProperty(This,rPolicyId) \
+ (This)->lpVtbl -> RemoveProperty(This,rPolicyId)
+
+#define IContext_GetProperty(This,rGuid,pFlags,ppUnk) \
+ (This)->lpVtbl -> GetProperty(This,rGuid,pFlags,ppUnk)
+
+#define IContext_EnumContextProps(This,ppEnumContextProps) \
+ (This)->lpVtbl -> EnumContextProps(This,ppEnumContextProps)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+HRESULT STDMETHODCALLTYPE IContext_SetProperty_Proxy(
+ IContext __RPC_FAR * This,
+ /* [in] */ REFGUID rpolicyId,
+ /* [in] */ CPFLAGS flags,
+ /* [in] */ IUnknown __RPC_FAR *pUnk);
+
+
+void __RPC_STUB IContext_SetProperty_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IContext_RemoveProperty_Proxy(
+ IContext __RPC_FAR * This,
+ /* [in] */ REFGUID rPolicyId);
+
+
+void __RPC_STUB IContext_RemoveProperty_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IContext_GetProperty_Proxy(
+ IContext __RPC_FAR * This,
+ /* [in] */ REFGUID rGuid,
+ /* [out] */ CPFLAGS __RPC_FAR *pFlags,
+ /* [out] */ IUnknown __RPC_FAR *__RPC_FAR *ppUnk);
+
+
+void __RPC_STUB IContext_GetProperty_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IContext_EnumContextProps_Proxy(
+ IContext __RPC_FAR * This,
+ /* [out] */ IEnumContextProps __RPC_FAR *__RPC_FAR *ppEnumContextProps);
+
+
+void __RPC_STUB IContext_EnumContextProps_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IContext_INTERFACE_DEFINED__ */
+
+
+#ifndef __IContextMarshaler_INTERFACE_DEFINED__
+#define __IContextMarshaler_INTERFACE_DEFINED__
+
+/* interface IContextMarshaler */
+/* [uuid][object][local] */
+
+typedef /* [unique] */ IContextMarshaler __RPC_FAR *LPCTXMARSHALER;
+
+
+EXTERN_C const IID IID_IContextMarshaler;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("000001D8-0000-0000-C000-000000000046")
+ IContextMarshaler : public IUnknown
+ {
+ public:
+ virtual HRESULT STDMETHODCALLTYPE GetMarshalSizeMax(
+ /* [in] */ REFIID riid,
+ /* [unique][in] */ void __RPC_FAR *pv,
+ /* [in] */ DWORD dwDestContext,
+ /* [unique][in] */ void __RPC_FAR *pvDestContext,
+ /* [in] */ DWORD mshlflags,
+ /* [out] */ DWORD __RPC_FAR *pSize) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE MarshalInterface(
+ /* [unique][in] */ IStream __RPC_FAR *pStm,
+ /* [in] */ REFIID riid,
+ /* [unique][in] */ void __RPC_FAR *pv,
+ /* [in] */ DWORD dwDestContext,
+ /* [unique][in] */ void __RPC_FAR *pvDestContext,
+ /* [in] */ DWORD mshlflags) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IContextMarshalerVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )(
+ IContextMarshaler __RPC_FAR * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )(
+ IContextMarshaler __RPC_FAR * This);
+
+ ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )(
+ IContextMarshaler __RPC_FAR * This);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetMarshalSizeMax )(
+ IContextMarshaler __RPC_FAR * This,
+ /* [in] */ REFIID riid,
+ /* [unique][in] */ void __RPC_FAR *pv,
+ /* [in] */ DWORD dwDestContext,
+ /* [unique][in] */ void __RPC_FAR *pvDestContext,
+ /* [in] */ DWORD mshlflags,
+ /* [out] */ DWORD __RPC_FAR *pSize);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MarshalInterface )(
+ IContextMarshaler __RPC_FAR * This,
+ /* [unique][in] */ IStream __RPC_FAR *pStm,
+ /* [in] */ REFIID riid,
+ /* [unique][in] */ void __RPC_FAR *pv,
+ /* [in] */ DWORD dwDestContext,
+ /* [unique][in] */ void __RPC_FAR *pvDestContext,
+ /* [in] */ DWORD mshlflags);
+
+ END_INTERFACE
+ } IContextMarshalerVtbl;
+
+ interface IContextMarshaler
+ {
+ CONST_VTBL struct IContextMarshalerVtbl __RPC_FAR *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IContextMarshaler_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IContextMarshaler_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IContextMarshaler_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IContextMarshaler_GetMarshalSizeMax(This,riid,pv,dwDestContext,pvDestContext,mshlflags,pSize) \
+ (This)->lpVtbl -> GetMarshalSizeMax(This,riid,pv,dwDestContext,pvDestContext,mshlflags,pSize)
+
+#define IContextMarshaler_MarshalInterface(This,pStm,riid,pv,dwDestContext,pvDestContext,mshlflags) \
+ (This)->lpVtbl -> MarshalInterface(This,pStm,riid,pv,dwDestContext,pvDestContext,mshlflags)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+HRESULT STDMETHODCALLTYPE IContextMarshaler_GetMarshalSizeMax_Proxy(
+ IContextMarshaler __RPC_FAR * This,
+ /* [in] */ REFIID riid,
+ /* [unique][in] */ void __RPC_FAR *pv,
+ /* [in] */ DWORD dwDestContext,
+ /* [unique][in] */ void __RPC_FAR *pvDestContext,
+ /* [in] */ DWORD mshlflags,
+ /* [out] */ DWORD __RPC_FAR *pSize);
+
+
+void __RPC_STUB IContextMarshaler_GetMarshalSizeMax_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IContextMarshaler_MarshalInterface_Proxy(
+ IContextMarshaler __RPC_FAR * This,
+ /* [unique][in] */ IStream __RPC_FAR *pStm,
+ /* [in] */ REFIID riid,
+ /* [unique][in] */ void __RPC_FAR *pv,
+ /* [in] */ DWORD dwDestContext,
+ /* [unique][in] */ void __RPC_FAR *pvDestContext,
+ /* [in] */ DWORD mshlflags);
+
+
+void __RPC_STUB IContextMarshaler_MarshalInterface_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IContextMarshaler_INTERFACE_DEFINED__ */
+
+
+// Placing the following definition here rather than with the IObjContext stuff
+// below is a temporary workaround to get around build problems where the system
+// objidl.h now has a IObjContext section but has not made much public (all the
+// interface methods are marked as reserved and the following typedef does not
+// exist). Once the system objidl.h is updated again we can remove the entire
+// section.
+#ifndef __PFNCTXCALLBACK_HACK
+#define __PFNCTXCALLBACK_HACK
+typedef /* [ref] */ HRESULT ( __stdcall __RPC_FAR *PFNCTXCALLBACK )(
+ void __RPC_FAR *pParam);
+#endif
+
+#ifndef __IObjContext_INTERFACE_DEFINED__
+#define __IObjContext_INTERFACE_DEFINED__
+
+/* interface IObjContext */
+/* [unique][uuid][object][local] */
+
+
+EXTERN_C const IID IID_IObjContext;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("000001c6-0000-0000-C000-000000000046")
+ IObjContext : public IContext
+ {
+ public:
+ virtual HRESULT STDMETHODCALLTYPE Freeze( void) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE DoCallback(
+ /* [in] */ PFNCTXCALLBACK pfnCallback,
+ /* [in] */ void __RPC_FAR *pParam,
+ /* [in] */ REFIID riid,
+ /* [in] */ unsigned int iMethod) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE SetContextMarshaler(
+ /* [in] */ IContextMarshaler __RPC_FAR *pICM) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE GetContextMarshaler(
+ /* [out] */ IContextMarshaler __RPC_FAR *__RPC_FAR *pICM) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE SetContextFlags(
+ /* [in] */ DWORD dwFlags) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE ClearContextFlags(
+ /* [in] */ DWORD dwFlags) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE GetContextFlags(
+ /* [out] */ DWORD __RPC_FAR *pdwFlags) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IObjContextVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )(
+ IObjContext __RPC_FAR * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )(
+ IObjContext __RPC_FAR * This);
+
+ ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )(
+ IObjContext __RPC_FAR * This);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetProperty )(
+ IObjContext __RPC_FAR * This,
+ /* [in] */ REFGUID rpolicyId,
+ /* [in] */ CPFLAGS flags,
+ /* [in] */ IUnknown __RPC_FAR *pUnk);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *RemoveProperty )(
+ IObjContext __RPC_FAR * This,
+ /* [in] */ REFGUID rPolicyId);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetProperty )(
+ IObjContext __RPC_FAR * This,
+ /* [in] */ REFGUID rGuid,
+ /* [out] */ CPFLAGS __RPC_FAR *pFlags,
+ /* [out] */ IUnknown __RPC_FAR *__RPC_FAR *ppUnk);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *EnumContextProps )(
+ IObjContext __RPC_FAR * This,
+ /* [out] */ IEnumContextProps __RPC_FAR *__RPC_FAR *ppEnumContextProps);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Freeze )(
+ IObjContext __RPC_FAR * This);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *DoCallback )(
+ IObjContext __RPC_FAR * This,
+ /* [in] */ PFNCTXCALLBACK pfnCallback,
+ /* [in] */ void __RPC_FAR *pParam,
+ /* [in] */ REFIID riid,
+ /* [in] */ unsigned int iMethod);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetContextMarshaler )(
+ IObjContext __RPC_FAR * This,
+ /* [in] */ IContextMarshaler __RPC_FAR *pICM);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetContextMarshaler )(
+ IObjContext __RPC_FAR * This,
+ /* [out] */ IContextMarshaler __RPC_FAR *__RPC_FAR *pICM);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetContextFlags )(
+ IObjContext __RPC_FAR * This,
+ /* [in] */ DWORD dwFlags);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *ClearContextFlags )(
+ IObjContext __RPC_FAR * This,
+ /* [in] */ DWORD dwFlags);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetContextFlags )(
+ IObjContext __RPC_FAR * This,
+ /* [out] */ DWORD __RPC_FAR *pdwFlags);
+
+ END_INTERFACE
+ } IObjContextVtbl;
+
+ interface IObjContext
+ {
+ CONST_VTBL struct IObjContextVtbl __RPC_FAR *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IObjContext_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IObjContext_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IObjContext_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IObjContext_SetProperty(This,rpolicyId,flags,pUnk) \
+ (This)->lpVtbl -> SetProperty(This,rpolicyId,flags,pUnk)
+
+#define IObjContext_RemoveProperty(This,rPolicyId) \
+ (This)->lpVtbl -> RemoveProperty(This,rPolicyId)
+
+#define IObjContext_GetProperty(This,rGuid,pFlags,ppUnk) \
+ (This)->lpVtbl -> GetProperty(This,rGuid,pFlags,ppUnk)
+
+#define IObjContext_EnumContextProps(This,ppEnumContextProps) \
+ (This)->lpVtbl -> EnumContextProps(This,ppEnumContextProps)
+
+
+#define IObjContext_Freeze(This) \
+ (This)->lpVtbl -> Freeze(This)
+
+#define IObjContext_DoCallback(This,pfnCallback,pParam,riid,iMethod) \
+ (This)->lpVtbl -> DoCallback(This,pfnCallback,pParam,riid,iMethod)
+
+#define IObjContext_SetContextMarshaler(This,pICM) \
+ (This)->lpVtbl -> SetContextMarshaler(This,pICM)
+
+#define IObjContext_GetContextMarshaler(This,pICM) \
+ (This)->lpVtbl -> GetContextMarshaler(This,pICM)
+
+#define IObjContext_SetContextFlags(This,dwFlags) \
+ (This)->lpVtbl -> SetContextFlags(This,dwFlags)
+
+#define IObjContext_ClearContextFlags(This,dwFlags) \
+ (This)->lpVtbl -> ClearContextFlags(This,dwFlags)
+
+#define IObjContext_GetContextFlags(This,pdwFlags) \
+ (This)->lpVtbl -> GetContextFlags(This,pdwFlags)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+HRESULT STDMETHODCALLTYPE IObjContext_Freeze_Proxy(
+ IObjContext __RPC_FAR * This);
+
+
+void __RPC_STUB IObjContext_Freeze_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IObjContext_DoCallback_Proxy(
+ IObjContext __RPC_FAR * This,
+ /* [in] */ PFNCTXCALLBACK pfnCallback,
+ /* [in] */ void __RPC_FAR *pParam,
+ /* [in] */ REFIID riid,
+ /* [in] */ unsigned int iMethod);
+
+
+void __RPC_STUB IObjContext_DoCallback_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IObjContext_SetContextMarshaler_Proxy(
+ IObjContext __RPC_FAR * This,
+ /* [in] */ IContextMarshaler __RPC_FAR *pICM);
+
+
+void __RPC_STUB IObjContext_SetContextMarshaler_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IObjContext_GetContextMarshaler_Proxy(
+ IObjContext __RPC_FAR * This,
+ /* [out] */ IContextMarshaler __RPC_FAR *__RPC_FAR *pICM);
+
+
+void __RPC_STUB IObjContext_GetContextMarshaler_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IObjContext_SetContextFlags_Proxy(
+ IObjContext __RPC_FAR * This,
+ /* [in] */ DWORD dwFlags);
+
+
+void __RPC_STUB IObjContext_SetContextFlags_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IObjContext_ClearContextFlags_Proxy(
+ IObjContext __RPC_FAR * This,
+ /* [in] */ DWORD dwFlags);
+
+
+void __RPC_STUB IObjContext_ClearContextFlags_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IObjContext_GetContextFlags_Proxy(
+ IObjContext __RPC_FAR * This,
+ /* [out] */ DWORD __RPC_FAR *pdwFlags);
+
+
+void __RPC_STUB IObjContext_GetContextFlags_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IObjContext_INTERFACE_DEFINED__ */
+
+
+#ifndef __IGetContextId_INTERFACE_DEFINED__
+#define __IGetContextId_INTERFACE_DEFINED__
+
+/* interface IGetContextId */
+/* [unique][uuid][object][local] */
+
+
+EXTERN_C const IID IID_IGetContextId;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("000001dd-0000-0000-C000-000000000046")
+ IGetContextId : public IUnknown
+ {
+ public:
+ virtual HRESULT STDMETHODCALLTYPE GetContextId(
+ /* [out] */ GUID __RPC_FAR *pguidCtxtId) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IGetContextIdVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )(
+ IGetContextId __RPC_FAR * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )(
+ IGetContextId __RPC_FAR * This);
+
+ ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )(
+ IGetContextId __RPC_FAR * This);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetContextId )(
+ IGetContextId __RPC_FAR * This,
+ /* [out] */ GUID __RPC_FAR *pguidCtxtId);
+
+ END_INTERFACE
+ } IGetContextIdVtbl;
+
+ interface IGetContextId
+ {
+ CONST_VTBL struct IGetContextIdVtbl __RPC_FAR *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IGetContextId_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IGetContextId_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IGetContextId_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IGetContextId_GetContextId(This,pguidCtxtId) \
+ (This)->lpVtbl -> GetContextId(This,pguidCtxtId)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+HRESULT STDMETHODCALLTYPE IGetContextId_GetContextId_Proxy(
+ IGetContextId __RPC_FAR * This,
+ /* [out] */ GUID __RPC_FAR *pguidCtxtId);
+
+
+void __RPC_STUB IGetContextId_GetContextId_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IGetContextId_INTERFACE_DEFINED__ */
+
+
+#ifndef __IAggregator_INTERFACE_DEFINED__
+#define __IAggregator_INTERFACE_DEFINED__
+
+/* interface IAggregator */
+/* [unique][uuid][object][local] */
+
+typedef /* [unique] */ IAggregator __RPC_FAR *IAGGREGATOR;
+
+
+EXTERN_C const IID IID_IAggregator;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("000001d8-0000-0000-C000-000000000046")
+ IAggregator : public IUnknown
+ {
+ public:
+ virtual HRESULT STDMETHODCALLTYPE Aggregate(
+ /* [in] */ IUnknown __RPC_FAR *pInnerUnk) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IAggregatorVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )(
+ IAggregator __RPC_FAR * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )(
+ IAggregator __RPC_FAR * This);
+
+ ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )(
+ IAggregator __RPC_FAR * This);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Aggregate )(
+ IAggregator __RPC_FAR * This,
+ /* [in] */ IUnknown __RPC_FAR *pInnerUnk);
+
+ END_INTERFACE
+ } IAggregatorVtbl;
+
+ interface IAggregator
+ {
+ CONST_VTBL struct IAggregatorVtbl __RPC_FAR *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IAggregator_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IAggregator_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IAggregator_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IAggregator_Aggregate(This,pInnerUnk) \
+ (This)->lpVtbl -> Aggregate(This,pInnerUnk)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+HRESULT STDMETHODCALLTYPE IAggregator_Aggregate_Proxy(
+ IAggregator __RPC_FAR * This,
+ /* [in] */ IUnknown __RPC_FAR *pInnerUnk);
+
+
+void __RPC_STUB IAggregator_Aggregate_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IAggregator_INTERFACE_DEFINED__ */
+
+
+#ifndef __ICall_INTERFACE_DEFINED__
+#define __ICall_INTERFACE_DEFINED__
+
+/* interface ICall */
+/* [unique][uuid][object][local] */
+
+typedef /* [unique] */ ICall __RPC_FAR *LPCALL;
+
+
+EXTERN_C const IID IID_ICall;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("000001d6-0000-0000-C000-000000000046")
+ ICall : public IUnknown
+ {
+ public:
+ virtual HRESULT STDMETHODCALLTYPE GetCallInfo(
+ /* [out] */ const void __RPC_FAR *__RPC_FAR *ppIdentity,
+ /* [out] */ IID __RPC_FAR *piid,
+ /* [out] */ DWORD __RPC_FAR *pdwMethod,
+ /* [out] */ HRESULT __RPC_FAR *phr) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Nullify(
+ /* [in] */ HRESULT hr) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE GetServerHR(
+ /* [out] */ HRESULT __RPC_FAR *phr) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct ICallVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )(
+ ICall __RPC_FAR * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )(
+ ICall __RPC_FAR * This);
+
+ ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )(
+ ICall __RPC_FAR * This);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetCallInfo )(
+ ICall __RPC_FAR * This,
+ /* [out] */ const void __RPC_FAR *__RPC_FAR *ppIdentity,
+ /* [out] */ IID __RPC_FAR *piid,
+ /* [out] */ DWORD __RPC_FAR *pdwMethod,
+ /* [out] */ HRESULT __RPC_FAR *phr);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Nullify )(
+ ICall __RPC_FAR * This,
+ /* [in] */ HRESULT hr);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetServerHR )(
+ ICall __RPC_FAR * This,
+ /* [out] */ HRESULT __RPC_FAR *phr);
+
+ END_INTERFACE
+ } ICallVtbl;
+
+ interface ICall
+ {
+ CONST_VTBL struct ICallVtbl __RPC_FAR *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define ICall_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define ICall_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define ICall_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define ICall_GetCallInfo(This,ppIdentity,piid,pdwMethod,phr) \
+ (This)->lpVtbl -> GetCallInfo(This,ppIdentity,piid,pdwMethod,phr)
+
+#define ICall_Nullify(This,hr) \
+ (This)->lpVtbl -> Nullify(This,hr)
+
+#define ICall_GetServerHR(This,phr) \
+ (This)->lpVtbl -> GetServerHR(This,phr)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+HRESULT STDMETHODCALLTYPE ICall_GetCallInfo_Proxy(
+ ICall __RPC_FAR * This,
+ /* [out] */ const void __RPC_FAR *__RPC_FAR *ppIdentity,
+ /* [out] */ IID __RPC_FAR *piid,
+ /* [out] */ DWORD __RPC_FAR *pdwMethod,
+ /* [out] */ HRESULT __RPC_FAR *phr);
+
+
+void __RPC_STUB ICall_GetCallInfo_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE ICall_Nullify_Proxy(
+ ICall __RPC_FAR * This,
+ /* [in] */ HRESULT hr);
+
+
+void __RPC_STUB ICall_Nullify_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE ICall_GetServerHR_Proxy(
+ ICall __RPC_FAR * This,
+ /* [out] */ HRESULT __RPC_FAR *phr);
+
+
+void __RPC_STUB ICall_GetServerHR_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __ICall_INTERFACE_DEFINED__ */
+
+
+#ifndef __IRpcCall_INTERFACE_DEFINED__
+#define __IRpcCall_INTERFACE_DEFINED__
+
+/* interface IRpcCall */
+/* [unique][uuid][object][local] */
+
+typedef /* [unique] */ IRpcCall __RPC_FAR *LPRPCCALL;
+
+
+EXTERN_C const IID IID_IRpcCall;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("000001c5-0000-0000-C000-000000000046")
+ IRpcCall : public IUnknown
+ {
+ public:
+ virtual HRESULT STDMETHODCALLTYPE GetRpcOleMessage(
+ /* [out] */ RPCOLEMESSAGE __RPC_FAR *__RPC_FAR *ppMessage) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IRpcCallVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )(
+ IRpcCall __RPC_FAR * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )(
+ IRpcCall __RPC_FAR * This);
+
+ ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )(
+ IRpcCall __RPC_FAR * This);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetRpcOleMessage )(
+ IRpcCall __RPC_FAR * This,
+ /* [out] */ RPCOLEMESSAGE __RPC_FAR *__RPC_FAR *ppMessage);
+
+ END_INTERFACE
+ } IRpcCallVtbl;
+
+ interface IRpcCall
+ {
+ CONST_VTBL struct IRpcCallVtbl __RPC_FAR *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IRpcCall_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IRpcCall_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IRpcCall_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IRpcCall_GetRpcOleMessage(This,ppMessage) \
+ (This)->lpVtbl -> GetRpcOleMessage(This,ppMessage)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+HRESULT STDMETHODCALLTYPE IRpcCall_GetRpcOleMessage_Proxy(
+ IRpcCall __RPC_FAR * This,
+ /* [out] */ RPCOLEMESSAGE __RPC_FAR *__RPC_FAR *ppMessage);
+
+
+void __RPC_STUB IRpcCall_GetRpcOleMessage_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IRpcCall_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_contxt_0083 */
+/* [local] */
+
+typedef
+enum _CALLSOURCE
+ { CALLSOURCE_CROSSAPT = 0,
+ CALLSOURCE_CROSSCTX = 1
+ } CALLSOURCE;
+
+
+
+extern RPC_IF_HANDLE __MIDL_itf_contxt_0083_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_contxt_0083_v0_0_s_ifspec;
+
+#ifndef __ICallInfo_INTERFACE_DEFINED__
+#define __ICallInfo_INTERFACE_DEFINED__
+
+/* interface ICallInfo */
+/* [unique][uuid][object][local] */
+
+
+EXTERN_C const IID IID_ICallInfo;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("000001dc-0000-0000-C000-000000000046")
+ ICallInfo : public IUnknown
+ {
+ public:
+ virtual HRESULT STDMETHODCALLTYPE GetCallSource(
+ /* [out] */ CALLSOURCE __RPC_FAR *pCallSource) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct ICallInfoVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )(
+ ICallInfo __RPC_FAR * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )(
+ ICallInfo __RPC_FAR * This);
+
+ ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )(
+ ICallInfo __RPC_FAR * This);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetCallSource )(
+ ICallInfo __RPC_FAR * This,
+ /* [out] */ CALLSOURCE __RPC_FAR *pCallSource);
+
+ END_INTERFACE
+ } ICallInfoVtbl;
+
+ interface ICallInfo
+ {
+ CONST_VTBL struct ICallInfoVtbl __RPC_FAR *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define ICallInfo_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define ICallInfo_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define ICallInfo_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define ICallInfo_GetCallSource(This,pCallSource) \
+ (This)->lpVtbl -> GetCallSource(This,pCallSource)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+HRESULT STDMETHODCALLTYPE ICallInfo_GetCallSource_Proxy(
+ ICallInfo __RPC_FAR * This,
+ /* [out] */ CALLSOURCE __RPC_FAR *pCallSource);
+
+
+void __RPC_STUB ICallInfo_GetCallSource_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __ICallInfo_INTERFACE_DEFINED__ */
+
+
+#ifndef __IPolicy_INTERFACE_DEFINED__
+#define __IPolicy_INTERFACE_DEFINED__
+
+/* interface IPolicy */
+/* [unique][uuid][object][local] */
+
+
+EXTERN_C const IID IID_IPolicy;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("000001c2-0000-0000-C000-000000000046")
+ IPolicy : public IUnknown
+ {
+ public:
+ virtual HRESULT STDMETHODCALLTYPE Call(
+ /* [in] */ ICall __RPC_FAR *pCall) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Enter(
+ /* [in] */ ICall __RPC_FAR *pCall) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Leave(
+ /* [in] */ ICall __RPC_FAR *pCall) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Return(
+ /* [in] */ ICall __RPC_FAR *pCall) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE CallGetSize(
+ /* [in] */ ICall __RPC_FAR *pCall,
+ /* [out] */ ULONG __RPC_FAR *pcb) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE CallFillBuffer(
+ /* [in] */ ICall __RPC_FAR *pCall,
+ /* [in] */ void __RPC_FAR *pvBuf,
+ /* [out] */ ULONG __RPC_FAR *pcb) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE EnterWithBuffer(
+ /* [in] */ ICall __RPC_FAR *pCall,
+ /* [in] */ void __RPC_FAR *pvBuf,
+ /* [in] */ ULONG cb) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE LeaveGetSize(
+ /* [in] */ ICall __RPC_FAR *pCall,
+ /* [out] */ ULONG __RPC_FAR *pcb) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE LeaveFillBuffer(
+ /* [in] */ ICall __RPC_FAR *pCall,
+ /* [in] */ void __RPC_FAR *pvBuf,
+ /* [out] */ ULONG __RPC_FAR *pcb) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE ReturnWithBuffer(
+ /* [in] */ ICall __RPC_FAR *pCall,
+ /* [in] */ void __RPC_FAR *pvBuf,
+ /* [in] */ ULONG cb) = 0;
+
+ virtual ULONG STDMETHODCALLTYPE AddRefPolicy( void) = 0;
+
+ virtual ULONG STDMETHODCALLTYPE ReleasePolicy( void) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IPolicyVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )(
+ IPolicy __RPC_FAR * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )(
+ IPolicy __RPC_FAR * This);
+
+ ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )(
+ IPolicy __RPC_FAR * This);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Call )(
+ IPolicy __RPC_FAR * This,
+ /* [in] */ ICall __RPC_FAR *pCall);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Enter )(
+ IPolicy __RPC_FAR * This,
+ /* [in] */ ICall __RPC_FAR *pCall);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Leave )(
+ IPolicy __RPC_FAR * This,
+ /* [in] */ ICall __RPC_FAR *pCall);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Return )(
+ IPolicy __RPC_FAR * This,
+ /* [in] */ ICall __RPC_FAR *pCall);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *CallGetSize )(
+ IPolicy __RPC_FAR * This,
+ /* [in] */ ICall __RPC_FAR *pCall,
+ /* [out] */ ULONG __RPC_FAR *pcb);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *CallFillBuffer )(
+ IPolicy __RPC_FAR * This,
+ /* [in] */ ICall __RPC_FAR *pCall,
+ /* [in] */ void __RPC_FAR *pvBuf,
+ /* [out] */ ULONG __RPC_FAR *pcb);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *EnterWithBuffer )(
+ IPolicy __RPC_FAR * This,
+ /* [in] */ ICall __RPC_FAR *pCall,
+ /* [in] */ void __RPC_FAR *pvBuf,
+ /* [in] */ ULONG cb);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *LeaveGetSize )(
+ IPolicy __RPC_FAR * This,
+ /* [in] */ ICall __RPC_FAR *pCall,
+ /* [out] */ ULONG __RPC_FAR *pcb);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *LeaveFillBuffer )(
+ IPolicy __RPC_FAR * This,
+ /* [in] */ ICall __RPC_FAR *pCall,
+ /* [in] */ void __RPC_FAR *pvBuf,
+ /* [out] */ ULONG __RPC_FAR *pcb);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *ReturnWithBuffer )(
+ IPolicy __RPC_FAR * This,
+ /* [in] */ ICall __RPC_FAR *pCall,
+ /* [in] */ void __RPC_FAR *pvBuf,
+ /* [in] */ ULONG cb);
+
+ ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRefPolicy )(
+ IPolicy __RPC_FAR * This);
+
+ ULONG ( STDMETHODCALLTYPE __RPC_FAR *ReleasePolicy )(
+ IPolicy __RPC_FAR * This);
+
+ END_INTERFACE
+ } IPolicyVtbl;
+
+ interface IPolicy
+ {
+ CONST_VTBL struct IPolicyVtbl __RPC_FAR *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IPolicy_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IPolicy_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IPolicy_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IPolicy_Call(This,pCall) \
+ (This)->lpVtbl -> Call(This,pCall)
+
+#define IPolicy_Enter(This,pCall) \
+ (This)->lpVtbl -> Enter(This,pCall)
+
+#define IPolicy_Leave(This,pCall) \
+ (This)->lpVtbl -> Leave(This,pCall)
+
+#define IPolicy_Return(This,pCall) \
+ (This)->lpVtbl -> Return(This,pCall)
+
+#define IPolicy_CallGetSize(This,pCall,pcb) \
+ (This)->lpVtbl -> CallGetSize(This,pCall,pcb)
+
+#define IPolicy_CallFillBuffer(This,pCall,pvBuf,pcb) \
+ (This)->lpVtbl -> CallFillBuffer(This,pCall,pvBuf,pcb)
+
+#define IPolicy_EnterWithBuffer(This,pCall,pvBuf,cb) \
+ (This)->lpVtbl -> EnterWithBuffer(This,pCall,pvBuf,cb)
+
+#define IPolicy_LeaveGetSize(This,pCall,pcb) \
+ (This)->lpVtbl -> LeaveGetSize(This,pCall,pcb)
+
+#define IPolicy_LeaveFillBuffer(This,pCall,pvBuf,pcb) \
+ (This)->lpVtbl -> LeaveFillBuffer(This,pCall,pvBuf,pcb)
+
+#define IPolicy_ReturnWithBuffer(This,pCall,pvBuf,cb) \
+ (This)->lpVtbl -> ReturnWithBuffer(This,pCall,pvBuf,cb)
+
+#define IPolicy_AddRefPolicy(This) \
+ (This)->lpVtbl -> AddRefPolicy(This)
+
+#define IPolicy_ReleasePolicy(This) \
+ (This)->lpVtbl -> ReleasePolicy(This)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+HRESULT STDMETHODCALLTYPE IPolicy_Call_Proxy(
+ IPolicy __RPC_FAR * This,
+ /* [in] */ ICall __RPC_FAR *pCall);
+
+
+void __RPC_STUB IPolicy_Call_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IPolicy_Enter_Proxy(
+ IPolicy __RPC_FAR * This,
+ /* [in] */ ICall __RPC_FAR *pCall);
+
+
+void __RPC_STUB IPolicy_Enter_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IPolicy_Leave_Proxy(
+ IPolicy __RPC_FAR * This,
+ /* [in] */ ICall __RPC_FAR *pCall);
+
+
+void __RPC_STUB IPolicy_Leave_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IPolicy_Return_Proxy(
+ IPolicy __RPC_FAR * This,
+ /* [in] */ ICall __RPC_FAR *pCall);
+
+
+void __RPC_STUB IPolicy_Return_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IPolicy_CallGetSize_Proxy(
+ IPolicy __RPC_FAR * This,
+ /* [in] */ ICall __RPC_FAR *pCall,
+ /* [out] */ ULONG __RPC_FAR *pcb);
+
+
+void __RPC_STUB IPolicy_CallGetSize_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IPolicy_CallFillBuffer_Proxy(
+ IPolicy __RPC_FAR * This,
+ /* [in] */ ICall __RPC_FAR *pCall,
+ /* [in] */ void __RPC_FAR *pvBuf,
+ /* [out] */ ULONG __RPC_FAR *pcb);
+
+
+void __RPC_STUB IPolicy_CallFillBuffer_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IPolicy_EnterWithBuffer_Proxy(
+ IPolicy __RPC_FAR * This,
+ /* [in] */ ICall __RPC_FAR *pCall,
+ /* [in] */ void __RPC_FAR *pvBuf,
+ /* [in] */ ULONG cb);
+
+
+void __RPC_STUB IPolicy_EnterWithBuffer_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IPolicy_LeaveGetSize_Proxy(
+ IPolicy __RPC_FAR * This,
+ /* [in] */ ICall __RPC_FAR *pCall,
+ /* [out] */ ULONG __RPC_FAR *pcb);
+
+
+void __RPC_STUB IPolicy_LeaveGetSize_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IPolicy_LeaveFillBuffer_Proxy(
+ IPolicy __RPC_FAR * This,
+ /* [in] */ ICall __RPC_FAR *pCall,
+ /* [in] */ void __RPC_FAR *pvBuf,
+ /* [out] */ ULONG __RPC_FAR *pcb);
+
+
+void __RPC_STUB IPolicy_LeaveFillBuffer_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IPolicy_ReturnWithBuffer_Proxy(
+ IPolicy __RPC_FAR * This,
+ /* [in] */ ICall __RPC_FAR *pCall,
+ /* [in] */ void __RPC_FAR *pvBuf,
+ /* [in] */ ULONG cb);
+
+
+void __RPC_STUB IPolicy_ReturnWithBuffer_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+ULONG STDMETHODCALLTYPE IPolicy_AddRefPolicy_Proxy(
+ IPolicy __RPC_FAR * This);
+
+
+void __RPC_STUB IPolicy_AddRefPolicy_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+ULONG STDMETHODCALLTYPE IPolicy_ReleasePolicy_Proxy(
+ IPolicy __RPC_FAR * This);
+
+
+void __RPC_STUB IPolicy_ReleasePolicy_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IPolicy_INTERFACE_DEFINED__ */
+
+
+#ifndef __IPolicyAsync_INTERFACE_DEFINED__
+#define __IPolicyAsync_INTERFACE_DEFINED__
+
+/* interface IPolicyAsync */
+/* [unique][uuid][object][local] */
+
+
+EXTERN_C const IID IID_IPolicyAsync;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("000001cd-0000-0000-C000-000000000046")
+ IPolicyAsync : public IUnknown
+ {
+ public:
+ virtual HRESULT STDMETHODCALLTYPE BeginCallGetSize(
+ /* [in] */ ICall __RPC_FAR *pCall,
+ /* [out] */ ULONG __RPC_FAR *pcb) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE BeginCall(
+ /* [in] */ ICall __RPC_FAR *pCall) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE BeginCallFillBuffer(
+ /* [in] */ ICall __RPC_FAR *pCall,
+ /* [in] */ void __RPC_FAR *pvBuf,
+ /* [out] */ ULONG __RPC_FAR *pcb) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE BeginEnter(
+ /* [in] */ ICall __RPC_FAR *pCall) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE BeginEnterWithBuffer(
+ /* [in] */ ICall __RPC_FAR *pCall,
+ /* [in] */ void __RPC_FAR *pvBuf,
+ /* [in] */ ULONG cb) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE BeginLeave(
+ /* [in] */ ICall __RPC_FAR *pCall) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE BeginReturn(
+ /* [in] */ ICall __RPC_FAR *pCall) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE FinishCall(
+ /* [in] */ ICall __RPC_FAR *pCall) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE FinishEnter(
+ /* [in] */ ICall __RPC_FAR *pCall) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE FinishLeaveGetSize(
+ /* [in] */ ICall __RPC_FAR *pCall,
+ /* [out] */ ULONG __RPC_FAR *pcb) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE FinishLeave(
+ /* [in] */ ICall __RPC_FAR *pCall) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE FinishLeaveFillBuffer(
+ /* [in] */ ICall __RPC_FAR *pCall,
+ /* [in] */ void __RPC_FAR *pvBuf,
+ /* [out] */ ULONG __RPC_FAR *pcb) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE FinishReturn(
+ /* [in] */ ICall __RPC_FAR *pCall) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE FinishReturnWithBuffer(
+ /* [in] */ ICall __RPC_FAR *pCall,
+ /* [in] */ void __RPC_FAR *pvBuf,
+ /* [in] */ ULONG cb) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IPolicyAsyncVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )(
+ IPolicyAsync __RPC_FAR * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )(
+ IPolicyAsync __RPC_FAR * This);
+
+ ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )(
+ IPolicyAsync __RPC_FAR * This);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *BeginCallGetSize )(
+ IPolicyAsync __RPC_FAR * This,
+ /* [in] */ ICall __RPC_FAR *pCall,
+ /* [out] */ ULONG __RPC_FAR *pcb);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *BeginCall )(
+ IPolicyAsync __RPC_FAR * This,
+ /* [in] */ ICall __RPC_FAR *pCall);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *BeginCallFillBuffer )(
+ IPolicyAsync __RPC_FAR * This,
+ /* [in] */ ICall __RPC_FAR *pCall,
+ /* [in] */ void __RPC_FAR *pvBuf,
+ /* [out] */ ULONG __RPC_FAR *pcb);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *BeginEnter )(
+ IPolicyAsync __RPC_FAR * This,
+ /* [in] */ ICall __RPC_FAR *pCall);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *BeginEnterWithBuffer )(
+ IPolicyAsync __RPC_FAR * This,
+ /* [in] */ ICall __RPC_FAR *pCall,
+ /* [in] */ void __RPC_FAR *pvBuf,
+ /* [in] */ ULONG cb);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *BeginLeave )(
+ IPolicyAsync __RPC_FAR * This,
+ /* [in] */ ICall __RPC_FAR *pCall);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *BeginReturn )(
+ IPolicyAsync __RPC_FAR * This,
+ /* [in] */ ICall __RPC_FAR *pCall);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *FinishCall )(
+ IPolicyAsync __RPC_FAR * This,
+ /* [in] */ ICall __RPC_FAR *pCall);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *FinishEnter )(
+ IPolicyAsync __RPC_FAR * This,
+ /* [in] */ ICall __RPC_FAR *pCall);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *FinishLeaveGetSize )(
+ IPolicyAsync __RPC_FAR * This,
+ /* [in] */ ICall __RPC_FAR *pCall,
+ /* [out] */ ULONG __RPC_FAR *pcb);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *FinishLeave )(
+ IPolicyAsync __RPC_FAR * This,
+ /* [in] */ ICall __RPC_FAR *pCall);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *FinishLeaveFillBuffer )(
+ IPolicyAsync __RPC_FAR * This,
+ /* [in] */ ICall __RPC_FAR *pCall,
+ /* [in] */ void __RPC_FAR *pvBuf,
+ /* [out] */ ULONG __RPC_FAR *pcb);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *FinishReturn )(
+ IPolicyAsync __RPC_FAR * This,
+ /* [in] */ ICall __RPC_FAR *pCall);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *FinishReturnWithBuffer )(
+ IPolicyAsync __RPC_FAR * This,
+ /* [in] */ ICall __RPC_FAR *pCall,
+ /* [in] */ void __RPC_FAR *pvBuf,
+ /* [in] */ ULONG cb);
+
+ END_INTERFACE
+ } IPolicyAsyncVtbl;
+
+ interface IPolicyAsync
+ {
+ CONST_VTBL struct IPolicyAsyncVtbl __RPC_FAR *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IPolicyAsync_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IPolicyAsync_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IPolicyAsync_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IPolicyAsync_BeginCallGetSize(This,pCall,pcb) \
+ (This)->lpVtbl -> BeginCallGetSize(This,pCall,pcb)
+
+#define IPolicyAsync_BeginCall(This,pCall) \
+ (This)->lpVtbl -> BeginCall(This,pCall)
+
+#define IPolicyAsync_BeginCallFillBuffer(This,pCall,pvBuf,pcb) \
+ (This)->lpVtbl -> BeginCallFillBuffer(This,pCall,pvBuf,pcb)
+
+#define IPolicyAsync_BeginEnter(This,pCall) \
+ (This)->lpVtbl -> BeginEnter(This,pCall)
+
+#define IPolicyAsync_BeginEnterWithBuffer(This,pCall,pvBuf,cb) \
+ (This)->lpVtbl -> BeginEnterWithBuffer(This,pCall,pvBuf,cb)
+
+#define IPolicyAsync_BeginLeave(This,pCall) \
+ (This)->lpVtbl -> BeginLeave(This,pCall)
+
+#define IPolicyAsync_BeginReturn(This,pCall) \
+ (This)->lpVtbl -> BeginReturn(This,pCall)
+
+#define IPolicyAsync_FinishCall(This,pCall) \
+ (This)->lpVtbl -> FinishCall(This,pCall)
+
+#define IPolicyAsync_FinishEnter(This,pCall) \
+ (This)->lpVtbl -> FinishEnter(This,pCall)
+
+#define IPolicyAsync_FinishLeaveGetSize(This,pCall,pcb) \
+ (This)->lpVtbl -> FinishLeaveGetSize(This,pCall,pcb)
+
+#define IPolicyAsync_FinishLeave(This,pCall) \
+ (This)->lpVtbl -> FinishLeave(This,pCall)
+
+#define IPolicyAsync_FinishLeaveFillBuffer(This,pCall,pvBuf,pcb) \
+ (This)->lpVtbl -> FinishLeaveFillBuffer(This,pCall,pvBuf,pcb)
+
+#define IPolicyAsync_FinishReturn(This,pCall) \
+ (This)->lpVtbl -> FinishReturn(This,pCall)
+
+#define IPolicyAsync_FinishReturnWithBuffer(This,pCall,pvBuf,cb) \
+ (This)->lpVtbl -> FinishReturnWithBuffer(This,pCall,pvBuf,cb)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+HRESULT STDMETHODCALLTYPE IPolicyAsync_BeginCallGetSize_Proxy(
+ IPolicyAsync __RPC_FAR * This,
+ /* [in] */ ICall __RPC_FAR *pCall,
+ /* [out] */ ULONG __RPC_FAR *pcb);
+
+
+void __RPC_STUB IPolicyAsync_BeginCallGetSize_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IPolicyAsync_BeginCall_Proxy(
+ IPolicyAsync __RPC_FAR * This,
+ /* [in] */ ICall __RPC_FAR *pCall);
+
+
+void __RPC_STUB IPolicyAsync_BeginCall_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IPolicyAsync_BeginCallFillBuffer_Proxy(
+ IPolicyAsync __RPC_FAR * This,
+ /* [in] */ ICall __RPC_FAR *pCall,
+ /* [in] */ void __RPC_FAR *pvBuf,
+ /* [out] */ ULONG __RPC_FAR *pcb);
+
+
+void __RPC_STUB IPolicyAsync_BeginCallFillBuffer_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IPolicyAsync_BeginEnter_Proxy(
+ IPolicyAsync __RPC_FAR * This,
+ /* [in] */ ICall __RPC_FAR *pCall);
+
+
+void __RPC_STUB IPolicyAsync_BeginEnter_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IPolicyAsync_BeginEnterWithBuffer_Proxy(
+ IPolicyAsync __RPC_FAR * This,
+ /* [in] */ ICall __RPC_FAR *pCall,
+ /* [in] */ void __RPC_FAR *pvBuf,
+ /* [in] */ ULONG cb);
+
+
+void __RPC_STUB IPolicyAsync_BeginEnterWithBuffer_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IPolicyAsync_BeginLeave_Proxy(
+ IPolicyAsync __RPC_FAR * This,
+ /* [in] */ ICall __RPC_FAR *pCall);
+
+
+void __RPC_STUB IPolicyAsync_BeginLeave_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IPolicyAsync_BeginReturn_Proxy(
+ IPolicyAsync __RPC_FAR * This,
+ /* [in] */ ICall __RPC_FAR *pCall);
+
+
+void __RPC_STUB IPolicyAsync_BeginReturn_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IPolicyAsync_FinishCall_Proxy(
+ IPolicyAsync __RPC_FAR * This,
+ /* [in] */ ICall __RPC_FAR *pCall);
+
+
+void __RPC_STUB IPolicyAsync_FinishCall_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IPolicyAsync_FinishEnter_Proxy(
+ IPolicyAsync __RPC_FAR * This,
+ /* [in] */ ICall __RPC_FAR *pCall);
+
+
+void __RPC_STUB IPolicyAsync_FinishEnter_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IPolicyAsync_FinishLeaveGetSize_Proxy(
+ IPolicyAsync __RPC_FAR * This,
+ /* [in] */ ICall __RPC_FAR *pCall,
+ /* [out] */ ULONG __RPC_FAR *pcb);
+
+
+void __RPC_STUB IPolicyAsync_FinishLeaveGetSize_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IPolicyAsync_FinishLeave_Proxy(
+ IPolicyAsync __RPC_FAR * This,
+ /* [in] */ ICall __RPC_FAR *pCall);
+
+
+void __RPC_STUB IPolicyAsync_FinishLeave_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IPolicyAsync_FinishLeaveFillBuffer_Proxy(
+ IPolicyAsync __RPC_FAR * This,
+ /* [in] */ ICall __RPC_FAR *pCall,
+ /* [in] */ void __RPC_FAR *pvBuf,
+ /* [out] */ ULONG __RPC_FAR *pcb);
+
+
+void __RPC_STUB IPolicyAsync_FinishLeaveFillBuffer_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IPolicyAsync_FinishReturn_Proxy(
+ IPolicyAsync __RPC_FAR * This,
+ /* [in] */ ICall __RPC_FAR *pCall);
+
+
+void __RPC_STUB IPolicyAsync_FinishReturn_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IPolicyAsync_FinishReturnWithBuffer_Proxy(
+ IPolicyAsync __RPC_FAR * This,
+ /* [in] */ ICall __RPC_FAR *pCall,
+ /* [in] */ void __RPC_FAR *pvBuf,
+ /* [in] */ ULONG cb);
+
+
+void __RPC_STUB IPolicyAsync_FinishReturnWithBuffer_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IPolicyAsync_INTERFACE_DEFINED__ */
+
+
+#ifndef __IPolicySet_INTERFACE_DEFINED__
+#define __IPolicySet_INTERFACE_DEFINED__
+
+/* interface IPolicySet */
+/* [unique][uuid][object][local] */
+
+
+EXTERN_C const IID IID_IPolicySet;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("000001c3-0000-0000-C000-000000000046")
+ IPolicySet : public IUnknown
+ {
+ public:
+ virtual HRESULT STDMETHODCALLTYPE AddPolicy(
+ /* [in] */ ContextEvent ctxEvent,
+ /* [in] */ REFGUID rguid,
+ /* [in] */ IPolicy __RPC_FAR *pPolicy) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IPolicySetVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )(
+ IPolicySet __RPC_FAR * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )(
+ IPolicySet __RPC_FAR * This);
+
+ ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )(
+ IPolicySet __RPC_FAR * This);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *AddPolicy )(
+ IPolicySet __RPC_FAR * This,
+ /* [in] */ ContextEvent ctxEvent,
+ /* [in] */ REFGUID rguid,
+ /* [in] */ IPolicy __RPC_FAR *pPolicy);
+
+ END_INTERFACE
+ } IPolicySetVtbl;
+
+ interface IPolicySet
+ {
+ CONST_VTBL struct IPolicySetVtbl __RPC_FAR *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IPolicySet_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IPolicySet_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IPolicySet_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IPolicySet_AddPolicy(This,ctxEvent,rguid,pPolicy) \
+ (This)->lpVtbl -> AddPolicy(This,ctxEvent,rguid,pPolicy)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+HRESULT STDMETHODCALLTYPE IPolicySet_AddPolicy_Proxy(
+ IPolicySet __RPC_FAR * This,
+ /* [in] */ ContextEvent ctxEvent,
+ /* [in] */ REFGUID rguid,
+ /* [in] */ IPolicy __RPC_FAR *pPolicy);
+
+
+void __RPC_STUB IPolicySet_AddPolicy_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IPolicySet_INTERFACE_DEFINED__ */
+
+
+#ifndef __IComObjIdentity_INTERFACE_DEFINED__
+#define __IComObjIdentity_INTERFACE_DEFINED__
+
+/* interface IComObjIdentity */
+/* [unique][uuid][object][local] */
+
+
+EXTERN_C const IID IID_IComObjIdentity;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("000001d7-0000-0000-C000-000000000046")
+ IComObjIdentity : public IUnknown
+ {
+ public:
+ virtual BOOL STDMETHODCALLTYPE IsServer( void) = 0;
+
+ virtual BOOL STDMETHODCALLTYPE IsDeactivated( void) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE GetIdentity(
+ /* [out] */ IUnknown __RPC_FAR *__RPC_FAR *ppUnk) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IComObjIdentityVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )(
+ IComObjIdentity __RPC_FAR * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )(
+ IComObjIdentity __RPC_FAR * This);
+
+ ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )(
+ IComObjIdentity __RPC_FAR * This);
+
+ BOOL ( STDMETHODCALLTYPE __RPC_FAR *IsServer )(
+ IComObjIdentity __RPC_FAR * This);
+
+ BOOL ( STDMETHODCALLTYPE __RPC_FAR *IsDeactivated )(
+ IComObjIdentity __RPC_FAR * This);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetIdentity )(
+ IComObjIdentity __RPC_FAR * This,
+ /* [out] */ IUnknown __RPC_FAR *__RPC_FAR *ppUnk);
+
+ END_INTERFACE
+ } IComObjIdentityVtbl;
+
+ interface IComObjIdentity
+ {
+ CONST_VTBL struct IComObjIdentityVtbl __RPC_FAR *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IComObjIdentity_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IComObjIdentity_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IComObjIdentity_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IComObjIdentity_IsServer(This) \
+ (This)->lpVtbl -> IsServer(This)
+
+#define IComObjIdentity_IsDeactivated(This) \
+ (This)->lpVtbl -> IsDeactivated(This)
+
+#define IComObjIdentity_GetIdentity(This,ppUnk) \
+ (This)->lpVtbl -> GetIdentity(This,ppUnk)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+BOOL STDMETHODCALLTYPE IComObjIdentity_IsServer_Proxy(
+ IComObjIdentity __RPC_FAR * This);
+
+
+void __RPC_STUB IComObjIdentity_IsServer_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+BOOL STDMETHODCALLTYPE IComObjIdentity_IsDeactivated_Proxy(
+ IComObjIdentity __RPC_FAR * This);
+
+
+void __RPC_STUB IComObjIdentity_IsDeactivated_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IComObjIdentity_GetIdentity_Proxy(
+ IComObjIdentity __RPC_FAR * This,
+ /* [out] */ IUnknown __RPC_FAR *__RPC_FAR *ppUnk);
+
+
+void __RPC_STUB IComObjIdentity_GetIdentity_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IComObjIdentity_INTERFACE_DEFINED__ */
+
+
+#ifndef __IPolicyMaker_INTERFACE_DEFINED__
+#define __IPolicyMaker_INTERFACE_DEFINED__
+
+/* interface IPolicyMaker */
+/* [unique][uuid][object][local] */
+
+
+EXTERN_C const IID IID_IPolicyMaker;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("000001c4-0000-0000-C000-000000000046")
+ IPolicyMaker : public IUnknown
+ {
+ public:
+ virtual HRESULT STDMETHODCALLTYPE AddClientPoliciesToSet(
+ /* [in] */ IPolicySet __RPC_FAR *pPS,
+ /* [in] */ IContext __RPC_FAR *pClientContext,
+ /* [in] */ IContext __RPC_FAR *pServerContext) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE AddEnvoyPoliciesToSet(
+ /* [in] */ IPolicySet __RPC_FAR *pPS,
+ /* [in] */ IContext __RPC_FAR *pClientContext,
+ /* [in] */ IContext __RPC_FAR *pServerContext) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE AddServerPoliciesToSet(
+ /* [in] */ IPolicySet __RPC_FAR *pPS,
+ /* [in] */ IContext __RPC_FAR *pClientContext,
+ /* [in] */ IContext __RPC_FAR *pServerContext) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Freeze(
+ /* [in] */ IObjContext __RPC_FAR *pObjContext) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE CreateStub(
+ /* [in] */ IComObjIdentity __RPC_FAR *pID) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE DestroyStub(
+ /* [in] */ IComObjIdentity __RPC_FAR *pID) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE CreateProxy(
+ /* [in] */ IComObjIdentity __RPC_FAR *pID) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE DestroyProxy(
+ /* [in] */ IComObjIdentity __RPC_FAR *pID) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IPolicyMakerVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )(
+ IPolicyMaker __RPC_FAR * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )(
+ IPolicyMaker __RPC_FAR * This);
+
+ ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )(
+ IPolicyMaker __RPC_FAR * This);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *AddClientPoliciesToSet )(
+ IPolicyMaker __RPC_FAR * This,
+ /* [in] */ IPolicySet __RPC_FAR *pPS,
+ /* [in] */ IContext __RPC_FAR *pClientContext,
+ /* [in] */ IContext __RPC_FAR *pServerContext);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *AddEnvoyPoliciesToSet )(
+ IPolicyMaker __RPC_FAR * This,
+ /* [in] */ IPolicySet __RPC_FAR *pPS,
+ /* [in] */ IContext __RPC_FAR *pClientContext,
+ /* [in] */ IContext __RPC_FAR *pServerContext);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *AddServerPoliciesToSet )(
+ IPolicyMaker __RPC_FAR * This,
+ /* [in] */ IPolicySet __RPC_FAR *pPS,
+ /* [in] */ IContext __RPC_FAR *pClientContext,
+ /* [in] */ IContext __RPC_FAR *pServerContext);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Freeze )(
+ IPolicyMaker __RPC_FAR * This,
+ /* [in] */ IObjContext __RPC_FAR *pObjContext);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *CreateStub )(
+ IPolicyMaker __RPC_FAR * This,
+ /* [in] */ IComObjIdentity __RPC_FAR *pID);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *DestroyStub )(
+ IPolicyMaker __RPC_FAR * This,
+ /* [in] */ IComObjIdentity __RPC_FAR *pID);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *CreateProxy )(
+ IPolicyMaker __RPC_FAR * This,
+ /* [in] */ IComObjIdentity __RPC_FAR *pID);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *DestroyProxy )(
+ IPolicyMaker __RPC_FAR * This,
+ /* [in] */ IComObjIdentity __RPC_FAR *pID);
+
+ END_INTERFACE
+ } IPolicyMakerVtbl;
+
+ interface IPolicyMaker
+ {
+ CONST_VTBL struct IPolicyMakerVtbl __RPC_FAR *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IPolicyMaker_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IPolicyMaker_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IPolicyMaker_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IPolicyMaker_AddClientPoliciesToSet(This,pPS,pClientContext,pServerContext) \
+ (This)->lpVtbl -> AddClientPoliciesToSet(This,pPS,pClientContext,pServerContext)
+
+#define IPolicyMaker_AddEnvoyPoliciesToSet(This,pPS,pClientContext,pServerContext) \
+ (This)->lpVtbl -> AddEnvoyPoliciesToSet(This,pPS,pClientContext,pServerContext)
+
+#define IPolicyMaker_AddServerPoliciesToSet(This,pPS,pClientContext,pServerContext) \
+ (This)->lpVtbl -> AddServerPoliciesToSet(This,pPS,pClientContext,pServerContext)
+
+#define IPolicyMaker_Freeze(This,pObjContext) \
+ (This)->lpVtbl -> Freeze(This,pObjContext)
+
+#define IPolicyMaker_CreateStub(This,pID) \
+ (This)->lpVtbl -> CreateStub(This,pID)
+
+#define IPolicyMaker_DestroyStub(This,pID) \
+ (This)->lpVtbl -> DestroyStub(This,pID)
+
+#define IPolicyMaker_CreateProxy(This,pID) \
+ (This)->lpVtbl -> CreateProxy(This,pID)
+
+#define IPolicyMaker_DestroyProxy(This,pID) \
+ (This)->lpVtbl -> DestroyProxy(This,pID)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+HRESULT STDMETHODCALLTYPE IPolicyMaker_AddClientPoliciesToSet_Proxy(
+ IPolicyMaker __RPC_FAR * This,
+ /* [in] */ IPolicySet __RPC_FAR *pPS,
+ /* [in] */ IContext __RPC_FAR *pClientContext,
+ /* [in] */ IContext __RPC_FAR *pServerContext);
+
+
+void __RPC_STUB IPolicyMaker_AddClientPoliciesToSet_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IPolicyMaker_AddEnvoyPoliciesToSet_Proxy(
+ IPolicyMaker __RPC_FAR * This,
+ /* [in] */ IPolicySet __RPC_FAR *pPS,
+ /* [in] */ IContext __RPC_FAR *pClientContext,
+ /* [in] */ IContext __RPC_FAR *pServerContext);
+
+
+void __RPC_STUB IPolicyMaker_AddEnvoyPoliciesToSet_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IPolicyMaker_AddServerPoliciesToSet_Proxy(
+ IPolicyMaker __RPC_FAR * This,
+ /* [in] */ IPolicySet __RPC_FAR *pPS,
+ /* [in] */ IContext __RPC_FAR *pClientContext,
+ /* [in] */ IContext __RPC_FAR *pServerContext);
+
+
+void __RPC_STUB IPolicyMaker_AddServerPoliciesToSet_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IPolicyMaker_Freeze_Proxy(
+ IPolicyMaker __RPC_FAR * This,
+ /* [in] */ IObjContext __RPC_FAR *pObjContext);
+
+
+void __RPC_STUB IPolicyMaker_Freeze_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IPolicyMaker_CreateStub_Proxy(
+ IPolicyMaker __RPC_FAR * This,
+ /* [in] */ IComObjIdentity __RPC_FAR *pID);
+
+
+void __RPC_STUB IPolicyMaker_CreateStub_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IPolicyMaker_DestroyStub_Proxy(
+ IPolicyMaker __RPC_FAR * This,
+ /* [in] */ IComObjIdentity __RPC_FAR *pID);
+
+
+void __RPC_STUB IPolicyMaker_DestroyStub_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IPolicyMaker_CreateProxy_Proxy(
+ IPolicyMaker __RPC_FAR * This,
+ /* [in] */ IComObjIdentity __RPC_FAR *pID);
+
+
+void __RPC_STUB IPolicyMaker_CreateProxy_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IPolicyMaker_DestroyProxy_Proxy(
+ IPolicyMaker __RPC_FAR * This,
+ /* [in] */ IComObjIdentity __RPC_FAR *pID);
+
+
+void __RPC_STUB IPolicyMaker_DestroyProxy_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IPolicyMaker_INTERFACE_DEFINED__ */
+
+
+#ifndef __IExceptionNotification_INTERFACE_DEFINED__
+#define __IExceptionNotification_INTERFACE_DEFINED__
+
+/* interface IExceptionNotification */
+/* [unique][uuid][object][local] */
+
+
+EXTERN_C const IID IID_IExceptionNotification;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("000001db-0000-0000-C000-000000000046")
+ IExceptionNotification : public IUnknown
+ {
+ public:
+ virtual void STDMETHODCALLTYPE ServerException(
+ /* [in] */ void __RPC_FAR *pExcepPtrs) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IExceptionNotificationVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )(
+ IExceptionNotification __RPC_FAR * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )(
+ IExceptionNotification __RPC_FAR * This);
+
+ ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )(
+ IExceptionNotification __RPC_FAR * This);
+
+ void ( STDMETHODCALLTYPE __RPC_FAR *ServerException )(
+ IExceptionNotification __RPC_FAR * This,
+ /* [in] */ void __RPC_FAR *pExcepPtrs);
+
+ END_INTERFACE
+ } IExceptionNotificationVtbl;
+
+ interface IExceptionNotification
+ {
+ CONST_VTBL struct IExceptionNotificationVtbl __RPC_FAR *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IExceptionNotification_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IExceptionNotification_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IExceptionNotification_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IExceptionNotification_ServerException(This,pExcepPtrs) \
+ (This)->lpVtbl -> ServerException(This,pExcepPtrs)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+void STDMETHODCALLTYPE IExceptionNotification_ServerException_Proxy(
+ IExceptionNotification __RPC_FAR * This,
+ /* [in] */ void __RPC_FAR *pExcepPtrs);
+
+
+void __RPC_STUB IExceptionNotification_ServerException_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IExceptionNotification_INTERFACE_DEFINED__ */
+
+
+#ifndef __IMarshalEnvoy_INTERFACE_DEFINED__
+#define __IMarshalEnvoy_INTERFACE_DEFINED__
+
+/* interface IMarshalEnvoy */
+/* [unique][uuid][object][local] */
+
+
+EXTERN_C const IID IID_IMarshalEnvoy;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("000001c8-0000-0000-C000-000000000046")
+ IMarshalEnvoy : public IUnknown
+ {
+ public:
+ virtual HRESULT STDMETHODCALLTYPE GetEnvoyUnmarshalClass(
+ /* [in] */ DWORD dwDestContext,
+ /* [out] */ CLSID __RPC_FAR *pClsid) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE GetEnvoySizeMax(
+ /* [in] */ DWORD dwDestContext,
+ /* [out] */ DWORD __RPC_FAR *pcb) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE MarshalEnvoy(
+ /* [in] */ IStream __RPC_FAR *pStream,
+ /* [in] */ DWORD dwDestContext) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE UnmarshalEnvoy(
+ /* [in] */ IStream __RPC_FAR *pStream,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppunk) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IMarshalEnvoyVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )(
+ IMarshalEnvoy __RPC_FAR * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )(
+ IMarshalEnvoy __RPC_FAR * This);
+
+ ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )(
+ IMarshalEnvoy __RPC_FAR * This);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetEnvoyUnmarshalClass )(
+ IMarshalEnvoy __RPC_FAR * This,
+ /* [in] */ DWORD dwDestContext,
+ /* [out] */ CLSID __RPC_FAR *pClsid);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetEnvoySizeMax )(
+ IMarshalEnvoy __RPC_FAR * This,
+ /* [in] */ DWORD dwDestContext,
+ /* [out] */ DWORD __RPC_FAR *pcb);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *MarshalEnvoy )(
+ IMarshalEnvoy __RPC_FAR * This,
+ /* [in] */ IStream __RPC_FAR *pStream,
+ /* [in] */ DWORD dwDestContext);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *UnmarshalEnvoy )(
+ IMarshalEnvoy __RPC_FAR * This,
+ /* [in] */ IStream __RPC_FAR *pStream,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppunk);
+
+ END_INTERFACE
+ } IMarshalEnvoyVtbl;
+
+ interface IMarshalEnvoy
+ {
+ CONST_VTBL struct IMarshalEnvoyVtbl __RPC_FAR *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IMarshalEnvoy_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IMarshalEnvoy_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IMarshalEnvoy_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IMarshalEnvoy_GetEnvoyUnmarshalClass(This,dwDestContext,pClsid) \
+ (This)->lpVtbl -> GetEnvoyUnmarshalClass(This,dwDestContext,pClsid)
+
+#define IMarshalEnvoy_GetEnvoySizeMax(This,dwDestContext,pcb) \
+ (This)->lpVtbl -> GetEnvoySizeMax(This,dwDestContext,pcb)
+
+#define IMarshalEnvoy_MarshalEnvoy(This,pStream,dwDestContext) \
+ (This)->lpVtbl -> MarshalEnvoy(This,pStream,dwDestContext)
+
+#define IMarshalEnvoy_UnmarshalEnvoy(This,pStream,riid,ppunk) \
+ (This)->lpVtbl -> UnmarshalEnvoy(This,pStream,riid,ppunk)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+HRESULT STDMETHODCALLTYPE IMarshalEnvoy_GetEnvoyUnmarshalClass_Proxy(
+ IMarshalEnvoy __RPC_FAR * This,
+ /* [in] */ DWORD dwDestContext,
+ /* [out] */ CLSID __RPC_FAR *pClsid);
+
+
+void __RPC_STUB IMarshalEnvoy_GetEnvoyUnmarshalClass_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IMarshalEnvoy_GetEnvoySizeMax_Proxy(
+ IMarshalEnvoy __RPC_FAR * This,
+ /* [in] */ DWORD dwDestContext,
+ /* [out] */ DWORD __RPC_FAR *pcb);
+
+
+void __RPC_STUB IMarshalEnvoy_GetEnvoySizeMax_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IMarshalEnvoy_MarshalEnvoy_Proxy(
+ IMarshalEnvoy __RPC_FAR * This,
+ /* [in] */ IStream __RPC_FAR *pStream,
+ /* [in] */ DWORD dwDestContext);
+
+
+void __RPC_STUB IMarshalEnvoy_MarshalEnvoy_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IMarshalEnvoy_UnmarshalEnvoy_Proxy(
+ IMarshalEnvoy __RPC_FAR * This,
+ /* [in] */ IStream __RPC_FAR *pStream,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppunk);
+
+
+void __RPC_STUB IMarshalEnvoy_UnmarshalEnvoy_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IMarshalEnvoy_INTERFACE_DEFINED__ */
+
+
+#ifndef __IWrapperInfo_INTERFACE_DEFINED__
+#define __IWrapperInfo_INTERFACE_DEFINED__
+
+/* interface IWrapperInfo */
+/* [unique][uuid][object][local] */
+
+
+EXTERN_C const IID IID_IWrapperInfo;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("5052f924-7ab8-11d3-b93f-00c04f990176")
+ IWrapperInfo : public IUnknown
+ {
+ public:
+ virtual void STDMETHODCALLTYPE SetMapping(
+ void __RPC_FAR *pv) = 0;
+
+ virtual void __RPC_FAR *STDMETHODCALLTYPE GetMapping( void) = 0;
+
+ virtual IObjContext __RPC_FAR *STDMETHODCALLTYPE GetServerObjectContext( void) = 0;
+
+ virtual IUnknown __RPC_FAR *STDMETHODCALLTYPE GetServerObject( void) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IWrapperInfoVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )(
+ IWrapperInfo __RPC_FAR * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )(
+ IWrapperInfo __RPC_FAR * This);
+
+ ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )(
+ IWrapperInfo __RPC_FAR * This);
+
+ void ( STDMETHODCALLTYPE __RPC_FAR *SetMapping )(
+ IWrapperInfo __RPC_FAR * This,
+ void __RPC_FAR *pv);
+
+ void __RPC_FAR *( STDMETHODCALLTYPE __RPC_FAR *GetMapping )(
+ IWrapperInfo __RPC_FAR * This);
+
+ IObjContext __RPC_FAR *( STDMETHODCALLTYPE __RPC_FAR *GetServerObjectContext )(
+ IWrapperInfo __RPC_FAR * This);
+
+ IUnknown __RPC_FAR *( STDMETHODCALLTYPE __RPC_FAR *GetServerObject )(
+ IWrapperInfo __RPC_FAR * This);
+
+ END_INTERFACE
+ } IWrapperInfoVtbl;
+
+ interface IWrapperInfo
+ {
+ CONST_VTBL struct IWrapperInfoVtbl __RPC_FAR *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IWrapperInfo_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IWrapperInfo_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IWrapperInfo_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IWrapperInfo_SetMapping(This,pv) \
+ (This)->lpVtbl -> SetMapping(This,pv)
+
+#define IWrapperInfo_GetMapping(This) \
+ (This)->lpVtbl -> GetMapping(This)
+
+#define IWrapperInfo_GetServerObjectContext(This) \
+ (This)->lpVtbl -> GetServerObjectContext(This)
+
+#define IWrapperInfo_GetServerObject(This) \
+ (This)->lpVtbl -> GetServerObject(This)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+void STDMETHODCALLTYPE IWrapperInfo_SetMapping_Proxy(
+ IWrapperInfo __RPC_FAR * This,
+ void __RPC_FAR *pv);
+
+
+void __RPC_STUB IWrapperInfo_SetMapping_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+void __RPC_FAR *STDMETHODCALLTYPE IWrapperInfo_GetMapping_Proxy(
+ IWrapperInfo __RPC_FAR * This);
+
+
+void __RPC_STUB IWrapperInfo_GetMapping_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+IObjContext __RPC_FAR *STDMETHODCALLTYPE IWrapperInfo_GetServerObjectContext_Proxy(
+ IWrapperInfo __RPC_FAR * This);
+
+
+void __RPC_STUB IWrapperInfo_GetServerObjectContext_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+IUnknown __RPC_FAR *STDMETHODCALLTYPE IWrapperInfo_GetServerObject_Proxy(
+ IWrapperInfo __RPC_FAR * This);
+
+
+void __RPC_STUB IWrapperInfo_GetServerObject_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IWrapperInfo_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_contxt_0092 */
+/* [local] */
+
+
+typedef DWORD APARTMENTID;
+
+
+
+extern RPC_IF_HANDLE __MIDL_itf_contxt_0092_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_contxt_0092_v0_0_s_ifspec;
+
+#ifndef __IComThreadingInfo_INTERFACE_DEFINED__
+#define __IComThreadingInfo_INTERFACE_DEFINED__
+
+/* interface IComThreadingInfo */
+/* [unique][uuid][object][local] */
+
+
+EXTERN_C const IID IID_IComThreadingInfo;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("000001ce-0000-0000-C000-000000000046")
+ IComThreadingInfo : public IUnknown
+ {
+ public:
+ virtual HRESULT STDMETHODCALLTYPE GetCurrentApartmentType(
+ /* [out] */ APTTYPE __RPC_FAR *pAptType) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE GetCurrentThreadType(
+ /* [out] */ THDTYPE __RPC_FAR *pThreadType) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE GetCurrentLogicalThreadId(
+ /* [out] */ GUID __RPC_FAR *pguidLogicalThreadId) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE SetCurrentLogicalThreadId(
+ /* [in] */ REFGUID rguid) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IComThreadingInfoVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )(
+ IComThreadingInfo __RPC_FAR * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )(
+ IComThreadingInfo __RPC_FAR * This);
+
+ ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )(
+ IComThreadingInfo __RPC_FAR * This);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetCurrentApartmentType )(
+ IComThreadingInfo __RPC_FAR * This,
+ /* [out] */ APTTYPE __RPC_FAR *pAptType);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetCurrentThreadType )(
+ IComThreadingInfo __RPC_FAR * This,
+ /* [out] */ THDTYPE __RPC_FAR *pThreadType);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetCurrentLogicalThreadId )(
+ IComThreadingInfo __RPC_FAR * This,
+ /* [out] */ GUID __RPC_FAR *pguidLogicalThreadId);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetCurrentLogicalThreadId )(
+ IComThreadingInfo __RPC_FAR * This,
+ /* [in] */ REFGUID rguid);
+
+ END_INTERFACE
+ } IComThreadingInfoVtbl;
+
+ interface IComThreadingInfo
+ {
+ CONST_VTBL struct IComThreadingInfoVtbl __RPC_FAR *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IComThreadingInfo_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IComThreadingInfo_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IComThreadingInfo_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IComThreadingInfo_GetCurrentApartmentType(This,pAptType) \
+ (This)->lpVtbl -> GetCurrentApartmentType(This,pAptType)
+
+#define IComThreadingInfo_GetCurrentThreadType(This,pThreadType) \
+ (This)->lpVtbl -> GetCurrentThreadType(This,pThreadType)
+
+#define IComThreadingInfo_GetCurrentLogicalThreadId(This,pguidLogicalThreadId) \
+ (This)->lpVtbl -> GetCurrentLogicalThreadId(This,pguidLogicalThreadId)
+
+#define IComThreadingInfo_SetCurrentLogicalThreadId(This,rguid) \
+ (This)->lpVtbl -> SetCurrentLogicalThreadId(This,rguid)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+HRESULT STDMETHODCALLTYPE IComThreadingInfo_GetCurrentApartmentType_Proxy(
+ IComThreadingInfo __RPC_FAR * This,
+ /* [out] */ APTTYPE __RPC_FAR *pAptType);
+
+
+void __RPC_STUB IComThreadingInfo_GetCurrentApartmentType_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IComThreadingInfo_GetCurrentThreadType_Proxy(
+ IComThreadingInfo __RPC_FAR * This,
+ /* [out] */ THDTYPE __RPC_FAR *pThreadType);
+
+
+void __RPC_STUB IComThreadingInfo_GetCurrentThreadType_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IComThreadingInfo_GetCurrentLogicalThreadId_Proxy(
+ IComThreadingInfo __RPC_FAR * This,
+ /* [out] */ GUID __RPC_FAR *pguidLogicalThreadId);
+
+
+void __RPC_STUB IComThreadingInfo_GetCurrentLogicalThreadId_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IComThreadingInfo_SetCurrentLogicalThreadId_Proxy(
+ IComThreadingInfo __RPC_FAR * This,
+ /* [in] */ REFGUID rguid);
+
+
+void __RPC_STUB IComThreadingInfo_SetCurrentLogicalThreadId_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IComThreadingInfo_INTERFACE_DEFINED__ */
+
+
+#ifndef __IComDispatchInfo_INTERFACE_DEFINED__
+#define __IComDispatchInfo_INTERFACE_DEFINED__
+
+/* interface IComDispatchInfo */
+/* [unique][uuid][object][local] */
+
+
+EXTERN_C const IID IID_IComDispatchInfo;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("000001d9-0000-0000-C000-000000000046")
+ IComDispatchInfo : public IUnknown
+ {
+ public:
+ virtual HRESULT STDMETHODCALLTYPE EnableComInits(
+ /* [out] */ void __RPC_FAR *__RPC_FAR *ppvCookie) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE DisableComInits(
+ /* [in] */ void __RPC_FAR *pvCookie) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IComDispatchInfoVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )(
+ IComDispatchInfo __RPC_FAR * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )(
+ IComDispatchInfo __RPC_FAR * This);
+
+ ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )(
+ IComDispatchInfo __RPC_FAR * This);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *EnableComInits )(
+ IComDispatchInfo __RPC_FAR * This,
+ /* [out] */ void __RPC_FAR *__RPC_FAR *ppvCookie);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *DisableComInits )(
+ IComDispatchInfo __RPC_FAR * This,
+ /* [in] */ void __RPC_FAR *pvCookie);
+
+ END_INTERFACE
+ } IComDispatchInfoVtbl;
+
+ interface IComDispatchInfo
+ {
+ CONST_VTBL struct IComDispatchInfoVtbl __RPC_FAR *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IComDispatchInfo_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IComDispatchInfo_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IComDispatchInfo_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IComDispatchInfo_EnableComInits(This,ppvCookie) \
+ (This)->lpVtbl -> EnableComInits(This,ppvCookie)
+
+#define IComDispatchInfo_DisableComInits(This,pvCookie) \
+ (This)->lpVtbl -> DisableComInits(This,pvCookie)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+HRESULT STDMETHODCALLTYPE IComDispatchInfo_EnableComInits_Proxy(
+ IComDispatchInfo __RPC_FAR * This,
+ /* [out] */ void __RPC_FAR *__RPC_FAR *ppvCookie);
+
+
+void __RPC_STUB IComDispatchInfo_EnableComInits_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IComDispatchInfo_DisableComInits_Proxy(
+ IComDispatchInfo __RPC_FAR * This,
+ /* [in] */ void __RPC_FAR *pvCookie);
+
+
+void __RPC_STUB IComDispatchInfo_DisableComInits_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IComDispatchInfo_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_contxt_0094 */
+/* [local] */
+
+typedef DWORD HActivator;
+
+STDAPI CoCreateObjectInContext(IUnknown *pUnk, IObjContext *pObjectCtx, REFIID riid, void **ppv);
+STDAPI CoGetApartmentID(APTTYPE dAptType, HActivator* pAptID);
+STDAPI CoDeactivateObject(IUnknown *pUnk, IUnknown **ppCookie);
+STDAPI CoReactivateObject(IUnknown *pUnk, IUnknown *pCookie);
+#define MSHLFLAGS_NO_IEC 0x8 // don't use IExternalConnextion
+#define MSHLFLAGS_NO_IMARSHAL 0x10 // don't use IMarshal
+#define CONTEXTFLAGS_FROZEN 0x01 // Frozen context
+#define CONTEXTFLAGS_ALLOWUNAUTH 0x02 // Allow unauthenticated calls
+#define CONTEXTFLAGS_ENVOYCONTEXT 0x04 // Envoy context
+#define CONTEXTFLAGS_DEFAULTCONTEXT 0x08 // Default context
+#define CONTEXTFLAGS_STATICCONTEXT 0x10 // Static context
+#define CONTEXTFLAGS_INPROPTABLE 0x20 // Is in property table
+#define CONTEXTFLAGS_INDESTRUCTOR 0x40 // Is in destructor
+#define CONTEXTFLAGS_URTPROPPRESENT 0x80 // CLR property added
+
+
+extern RPC_IF_HANDLE __MIDL_itf_contxt_0094_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_contxt_0094_v0_0_s_ifspec;
+
+/* Additional Prototypes for ALL interfaces */
+
+/* end of Additional Prototypes */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/src/inc/cor.h b/src/inc/cor.h
new file mode 100644
index 0000000000..9fd279e74b
--- /dev/null
+++ b/src/inc/cor.h
@@ -0,0 +1,2523 @@
+// 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.
+
+/*****************************************************************************
+ ** **
+ ** Cor.h - general header for the Runtime. **
+ ** **
+ *****************************************************************************/
+
+
+#ifndef _COR_H_
+#define _COR_H_
+
+//*****************************************************************************
+// Required includes
+#include <ole2.h> // Definitions of OLE types.
+#include <specstrings.h>
+#include "corerror.h"
+
+//*****************************************************************************
+
+#if defined(_MSC_VER) && !defined(USE_DEPRECATED_CLR_API_WITHOUT_WARNING)
+#define DEPRECATED_CLR_API_MESG "This API has been deprecated. Refer to http://go.microsoft.com/fwlink/?LinkId=143720 for more details."
+#define DECLARE_DEPRECATED __declspec(deprecated(DEPRECATED_CLR_API_MESG))
+#define DEPRECATED_CLR_STDAPI EXTERN_C DECLARE_DEPRECATED HRESULT STDAPICALLTYPE
+#define DEPRECATED_CLR_STDAPI_(type) EXTERN_C DECLARE_DEPRECATED type STDAPICALLTYPE
+#else // _MSC_VER && !USE_DEPRECATED_CLR_API_WITHOUT_WARNING
+#define DECLARE_DEPRECATED
+#define DEPRECATED_CLR_STDAPI STDAPI
+#define DEPRECATED_CLR_STDAPI_(type) STDAPI_(type)
+#endif // _MSC_VER && !USE_DEPRECATED_CLR_API_WITHOUT_WARNING
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// {BED7F4EA-1A96-11d2-8F08-00A0C9A6186D}
+EXTERN_GUID(LIBID_ComPlusRuntime, 0xbed7f4ea, 0x1a96, 0x11d2, 0x8f, 0x8, 0x0, 0xa0, 0xc9, 0xa6, 0x18, 0x6d);
+
+// {90883F05-3D28-11D2-8F17-00A0C9A6186D}
+EXTERN_GUID(GUID_ExportedFromComPlus, 0x90883f05, 0x3d28, 0x11d2, 0x8f, 0x17, 0x0, 0xa0, 0xc9, 0xa6, 0x18, 0x6d);
+
+// {0F21F359-AB84-41e8-9A78-36D110E6D2F9}
+EXTERN_GUID(GUID_ManagedName, 0xf21f359, 0xab84, 0x41e8, 0x9a, 0x78, 0x36, 0xd1, 0x10, 0xe6, 0xd2, 0xf9);
+
+// {54FC8F55-38DE-4703-9C4E-250351302B1C}
+EXTERN_GUID(GUID_Function2Getter, 0x54fc8f55, 0x38de, 0x4703, 0x9c, 0x4e, 0x25, 0x3, 0x51, 0x30, 0x2b, 0x1c);
+
+// CLSID_CorMetaDataDispenserRuntime: {1EC2DE53-75CC-11d2-9775-00A0C9B4D50C}
+// Dispenser coclass for version 1.5 and 2.0 meta data. To get the "latest" bind
+// to CLSID_MetaDataDispenser.
+EXTERN_GUID(CLSID_CorMetaDataDispenserRuntime, 0x1ec2de53, 0x75cc, 0x11d2, 0x97, 0x75, 0x0, 0xa0, 0xc9, 0xb4, 0xd5, 0xc);
+
+// {CD2BC5C9-F452-4326-B714-F9C539D4DA58}
+EXTERN_GUID(GUID_DispIdOverride, 0xcd2bc5c9, 0xf452, 0x4326, 0xb7, 0x14, 0xf9, 0xc5, 0x39, 0xd4, 0xda, 0x58);
+
+// {B64784EB-D8D4-4d9b-9ACD-0E30806426F7}
+EXTERN_GUID(GUID_ForceIEnumerable, 0xb64784eb, 0xd8d4, 0x4d9b, 0x9a, 0xcd, 0x0e, 0x30, 0x80, 0x64, 0x26, 0xf7);
+
+// {2941FF83-88D8-4F73-B6A9-BDF8712D000D}
+EXTERN_GUID(GUID_PropGetCA, 0x2941ff83, 0x88d8, 0x4f73, 0xb6, 0xa9, 0xbd, 0xf8, 0x71, 0x2d, 0x00, 0x0d);
+
+// {29533527-3683-4364-ABC0-DB1ADD822FA2}
+EXTERN_GUID(GUID_PropPutCA, 0x29533527, 0x3683, 0x4364, 0xab, 0xc0, 0xdb, 0x1a, 0xdd, 0x82, 0x2f, 0xa2);
+
+// CLSID_CLR_v1_MetaData: {005023CA-72B1-11D3-9FC4-00C04F79A0A3}
+// Used to generate v1 metadata (for v1.0 and v1.1 CLR compatibility).
+EXTERN_GUID(CLSID_CLR_v1_MetaData, 0x005023ca, 0x72b1, 0x11d3, 0x9f, 0xc4, 0x0, 0xc0, 0x4f, 0x79, 0xa0, 0xa3);
+
+// CLSID_CLR_v2_MetaData: {EFEA471A-44FD-4862-9292-0C58D46E1F3A}
+EXTERN_GUID(CLSID_CLR_v2_MetaData, 0xefea471a, 0x44fd, 0x4862, 0x92, 0x92, 0xc, 0x58, 0xd4, 0x6e, 0x1f, 0x3a);
+
+
+// CLSID_CorMetaDataRuntime:
+// This will can always be used to generate the "latest" metadata available.
+#define CLSID_CorMetaDataRuntime CLSID_CLR_v2_MetaData
+
+
+// {30FE7BE8-D7D9-11D2-9F80-00C04F79A0A3}
+EXTERN_GUID(MetaDataCheckDuplicatesFor, 0x30fe7be8, 0xd7d9, 0x11d2, 0x9f, 0x80, 0x0, 0xc0, 0x4f, 0x79, 0xa0, 0xa3);
+
+// {DE3856F8-D7D9-11D2-9F80-00C04F79A0A3}
+EXTERN_GUID(MetaDataRefToDefCheck, 0xde3856f8, 0xd7d9, 0x11d2, 0x9f, 0x80, 0x0, 0xc0, 0x4f, 0x79, 0xa0, 0xa3);
+
+// {E5D71A4C-D7DA-11D2-9F80-00C04F79A0A3}
+EXTERN_GUID(MetaDataNotificationForTokenMovement, 0xe5d71a4c, 0xd7da, 0x11d2, 0x9f, 0x80, 0x0, 0xc0, 0x4f, 0x79, 0xa0, 0xa3);
+
+// {2eee315c-d7db-11d2-9f80-00c04f79a0a3}
+EXTERN_GUID(MetaDataSetUpdate, 0x2eee315c, 0xd7db, 0x11d2, 0x9f, 0x80, 0x0, 0xc0, 0x4f, 0x79, 0xa0, 0xa3);
+#define MetaDataSetENC MetaDataSetUpdate
+
+// Use this guid in SetOption to indicate if the import enumerator should skip over
+// delete items or not. The default is yes.
+//
+// {79700F36-4AAC-11d3-84C3-009027868CB1}
+EXTERN_GUID(MetaDataImportOption, 0x79700f36, 0x4aac, 0x11d3, 0x84, 0xc3, 0x0, 0x90, 0x27, 0x86, 0x8c, 0xb1);
+
+// Use this guid in the SetOption if compiler wants to have MetaData API to take reader/writer lock
+//
+// {F7559806-F266-42ea-8C63-0ADB45E8B234}
+EXTERN_GUID(MetaDataThreadSafetyOptions, 0xf7559806, 0xf266, 0x42ea, 0x8c, 0x63, 0xa, 0xdb, 0x45, 0xe8, 0xb2, 0x34);
+
+// Use this guid in the SetOption if compiler wants error when some tokens are emitted out of order
+// {1547872D-DC03-11d2-9420-0000F8083460}
+EXTERN_GUID(MetaDataErrorIfEmitOutOfOrder, 0x1547872d, 0xdc03, 0x11d2, 0x94, 0x20, 0x0, 0x0, 0xf8, 0x8, 0x34, 0x60);
+
+// Use this guid in the SetOption to indicate if the tlbimporter should generate the
+// TCE adapters for COM connection point containers.
+// {DCC9DE90-4151-11d3-88D6-00902754C43A}
+EXTERN_GUID(MetaDataGenerateTCEAdapters, 0xdcc9de90, 0x4151, 0x11d3, 0x88, 0xd6, 0x0, 0x90, 0x27, 0x54, 0xc4, 0x3a);
+
+// Use this guid in the SetOption to specifiy a non-default namespace for typelib import.
+// {F17FF889-5A63-11d3-9FF2-00C04FF7431A}
+EXTERN_GUID(MetaDataTypeLibImportNamespace, 0xf17ff889, 0x5a63, 0x11d3, 0x9f, 0xf2, 0x0, 0xc0, 0x4f, 0xf7, 0x43, 0x1a);
+
+// Use this guid in the SetOption to specify the behavior of UnmarkAll. See CorLinkerOptions.
+// {47E099B6-AE7C-4797-8317-B48AA645B8F9}
+EXTERN_GUID(MetaDataLinkerOptions, 0x47e099b6, 0xae7c, 0x4797, 0x83, 0x17, 0xb4, 0x8a, 0xa6, 0x45, 0xb8, 0xf9);
+
+// Use this guid in the SetOption to specify the runtime version stored in the CLR metadata.
+// {47E099B7-AE7C-4797-8317-B48AA645B8F9}
+EXTERN_GUID(MetaDataRuntimeVersion, 0x47e099b7, 0xae7c, 0x4797, 0x83, 0x17, 0xb4, 0x8a, 0xa6, 0x45, 0xb8, 0xf9);
+
+// Use this guid in the SetOption to specify the behavior of the merger.
+// {132D3A6E-B35D-464e-951A-42EFB9FB6601}
+EXTERN_GUID(MetaDataMergerOptions, 0x132d3a6e, 0xb35d, 0x464e, 0x95, 0x1a, 0x42, 0xef, 0xb9, 0xfb, 0x66, 0x1);
+
+// Use this guid in SetOption to disable optimizing module-local refs to defs
+// {a55c0354-e91b-468b-8648-7cc31035d533}
+EXTERN_GUID(MetaDataPreserveLocalRefs, 0xa55c0354, 0xe91b, 0x468b, 0x86, 0x48, 0x7c, 0xc3, 0x10, 0x35, 0xd5, 0x33);
+
+interface IMetaDataImport;
+interface IMetaDataAssemblyEmit;
+interface IMetaDataAssemblyImport;
+interface IMetaDataEmit;
+interface ICeeGen;
+
+
+typedef UNALIGNED void const *UVCP_CONSTANT;
+
+
+// Constant for connection id and task id
+#define INVALID_CONNECTION_ID 0x0
+#define INVALID_TASK_ID 0x0
+#define MAX_CONNECTION_NAME MAX_PATH
+
+//*****************************************************************************
+//*****************************************************************************
+//
+// D L L P U B L I C E N T R Y P O I N T D E C L A R A T I O N S
+//
+//*****************************************************************************
+//*****************************************************************************
+
+BOOL STDMETHODCALLTYPE _CorDllMain(HINSTANCE hInst, DWORD dwReason, LPVOID lpReserved);
+__int32 STDMETHODCALLTYPE _CorExeMain();
+__int32 STDMETHODCALLTYPE _CorExeMainInternal();
+__int32 STDMETHODCALLTYPE _CorExeMain2( // Executable exit code.
+ PBYTE pUnmappedPE, // -> memory mapped code
+ DWORD cUnmappedPE, // Size of memory mapped code
+ _In_ LPWSTR pImageNameIn, // -> Executable Name
+ _In_ LPWSTR pLoadersFileName, // -> Loaders Name
+ _In_ LPWSTR pCmdLine); // -> Command Line
+
+STDAPI _CorValidateImage(PVOID *ImageBase, LPCWSTR FileName);
+STDAPI_(VOID) _CorImageUnloading(PVOID ImageBase);
+
+DEPRECATED_CLR_STDAPI CoInitializeEE(DWORD fFlags);
+DEPRECATED_CLR_STDAPI_(void) CoUninitializeEE(BOOL fFlags);
+DEPRECATED_CLR_STDAPI_(void) CoEEShutDownCOM(void);
+
+
+#ifdef FEATURE_MAIN_CLR_MODULE_USES_CORE_NAME
+
+#define MAIN_CLR_MODULE_NAME_W W("coreclr")
+#define MAIN_CLR_MODULE_NAME_A "coreclr"
+
+#define MAIN_CLR_DLL_NAME_W MAKEDLLNAME_W(MAIN_CLR_MODULE_NAME_W)
+#define MAIN_CLR_DLL_NAME_A MAKEDLLNAME_A(MAIN_CLR_MODULE_NAME_A)
+
+#else //FEATURE_MAIN_CLR_MODULE_USES_CORE_NAME
+
+#define MAIN_CLR_MODULE_NAME_W L"clr"
+#define MAIN_CLR_MODULE_NAME_A "clr"
+
+#define MAIN_CLR_DLL_NAME_W MAKEDLLNAME_W(MAIN_CLR_MODULE_NAME_W)
+#define MAIN_CLR_DLL_NAME_A MAKEDLLNAME_A(MAIN_CLR_MODULE_NAME_A)
+
+#endif //FEATURE_MAIN_CLR_MODULE_USES_CORE_NAME
+
+
+#ifdef FEATURE_CORECLR
+#define MSCOREE_SHIM_W MAIN_CLR_DLL_NAME_W
+#define MSCOREE_SHIM_A MAIN_CLR_DLL_NAME_A
+#else
+#define MSCOREE_SHIM_W L"mscoree.dll"
+#define MSCOREE_SHIM_A "mscoree.dll"
+#endif // FEATURE_CORECLR
+
+#define SWITCHOUT_HANDLE_VALUE ((HANDLE)(LONG_PTR)-2)
+
+
+//
+// CoInitializeCor flags.
+//
+typedef enum tagCOINITCOR
+{
+ COINITCOR_DEFAULT = 0x0 // Default initialization mode.
+} COINITICOR;
+
+//
+// CoInitializeEE flags.
+//
+typedef enum tagCOINITEE
+{
+ COINITEE_DEFAULT = 0x0, // Default initialization mode.
+ COINITEE_DLL = 0x1, // Initialization mode for loading DLL.
+ COINITEE_MAIN = 0x2 // Initialize prior to entering the main routine
+} COINITIEE;
+
+//
+// CoInitializeEE flags.
+//
+typedef enum tagCOUNINITEE
+{
+ COUNINITEE_DEFAULT = 0x0, // Default uninitialization mode.
+ COUNINITEE_DLL = 0x1 // Uninitialization mode for unloading DLL.
+} COUNINITIEE;
+
+//*****************************************************************************
+//*****************************************************************************
+//
+// I L & F I L E F O R M A T D E C L A R A T I O N S
+//
+//*****************************************************************************
+//*****************************************************************************
+
+
+//
+#ifndef _WINDOWS_UPDATES_
+#include <corhdr.h>
+#endif // <windows.h> updates
+
+//*****************************************************************************
+//*****************************************************************************
+//
+// D L L P U B L I C E N T R Y P O I N T D E C L A R A T I O N S
+//
+//*****************************************************************************
+//*****************************************************************************
+
+DEPRECATED_CLR_STDAPI CoInitializeCor(DWORD fFlags);
+DEPRECATED_CLR_STDAPI_(void) CoUninitializeCor(void);
+
+//
+//*****************************************************************************
+//*****************************************************************************
+
+// CLSID_Cor: {bee00000-ee77-11d0-a015-00c04fbbb884}
+EXTERN_GUID(CLSID_Cor, 0xbee00010, 0xee77, 0x11d0, 0xa0, 0x15, 0x00, 0xc0, 0x4f, 0xbb, 0xb8, 0x84);
+
+// CLSID_CorMetaDataDispenser: {E5CB7A31-7512-11d2-89CE-0080C792E5D8}
+// This is the "Master Dispenser", always guaranteed to be the most recent
+// dispenser on the machine.
+EXTERN_GUID(CLSID_CorMetaDataDispenser, 0xe5cb7a31, 0x7512, 0x11d2, 0x89, 0xce, 0x0, 0x80, 0xc7, 0x92, 0xe5, 0xd8);
+
+
+// CLSID_CorMetaDataDispenserReg: {435755FF-7397-11d2-9771-00A0C9B4D50C}
+// Dispenser coclass for version 1.0 meta data. To get the "latest" bind
+// to CLSID_CorMetaDataDispenser.
+EXTERN_GUID(CLSID_CorMetaDataDispenserReg, 0x435755ff, 0x7397, 0x11d2, 0x97, 0x71, 0x0, 0xa0, 0xc9, 0xb4, 0xd5, 0xc);
+
+
+// CLSID_CorMetaDataReg: {87F3A1F5-7397-11d2-9771-00A0C9B4D50C}
+// For COM+ Meta Data, Data Driven Registration
+EXTERN_GUID(CLSID_CorMetaDataReg, 0x87f3a1f5, 0x7397, 0x11d2, 0x97, 0x71, 0x0, 0xa0, 0xc9, 0xb4, 0xd5, 0xc);
+
+
+interface IMetaDataDispenser;
+
+//-------------------------------------
+//--- IMetaDataError
+//-------------------------------------
+// {B81FF171-20F3-11d2-8DCC-00A0C9B09C19}
+EXTERN_GUID(IID_IMetaDataError, 0xb81ff171, 0x20f3, 0x11d2, 0x8d, 0xcc, 0x0, 0xa0, 0xc9, 0xb0, 0x9c, 0x19);
+
+//---
+#undef INTERFACE
+#define INTERFACE IMetaDataError
+DECLARE_INTERFACE_(IMetaDataError, IUnknown)
+{
+ STDMETHOD(OnError)(HRESULT hrError, mdToken token) PURE;
+};
+
+//-------------------------------------
+//--- IMapToken
+//-------------------------------------
+// IID_IMapToken: {06A3EA8B-0225-11d1-BF72-00C04FC31E12}
+EXTERN_GUID(IID_IMapToken, 0x6a3ea8b, 0x225, 0x11d1, 0xbf, 0x72, 0x0, 0xc0, 0x4f, 0xc3, 0x1e, 0x12);
+
+//---
+#undef INTERFACE
+#define INTERFACE IMapToken
+DECLARE_INTERFACE_(IMapToken, IUnknown)
+{
+ STDMETHOD(Map)(mdToken tkImp, mdToken tkEmit) PURE;
+};
+
+//-------------------------------------
+//--- IMetaDataDispenser
+//-------------------------------------
+// {809C652E-7396-11D2-9771-00A0C9B4D50C}
+EXTERN_GUID(IID_IMetaDataDispenser, 0x809c652e, 0x7396, 0x11d2, 0x97, 0x71, 0x00, 0xa0, 0xc9, 0xb4, 0xd5, 0x0c);
+
+//---
+#undef INTERFACE
+#define INTERFACE IMetaDataDispenser
+DECLARE_INTERFACE_(IMetaDataDispenser, IUnknown)
+{
+ STDMETHOD(DefineScope)( // Return code.
+ REFCLSID rclsid, // [in] What version to create.
+ DWORD dwCreateFlags, // [in] Flags on the create.
+ REFIID riid, // [in] The interface desired.
+ IUnknown **ppIUnk) PURE; // [out] Return interface on success.
+
+ STDMETHOD(OpenScope)( // Return code.
+ LPCWSTR szScope, // [in] The scope to open.
+ DWORD dwOpenFlags, // [in] Open mode flags.
+ REFIID riid, // [in] The interface desired.
+ IUnknown **ppIUnk) PURE; // [out] Return interface on success.
+
+ STDMETHOD(OpenScopeOnMemory)( // Return code.
+ LPCVOID pData, // [in] Location of scope data.
+ ULONG cbData, // [in] Size of the data pointed to by pData.
+ DWORD dwOpenFlags, // [in] Open mode flags.
+ REFIID riid, // [in] The interface desired.
+ IUnknown **ppIUnk) PURE; // [out] Return interface on success.
+};
+
+//-------------------------------------
+//--- IMetaDataEmit
+//-------------------------------------
+// {BA3FEE4C-ECB9-4e41-83B7-183FA41CD859}
+EXTERN_GUID(IID_IMetaDataEmit, 0xba3fee4c, 0xecb9, 0x4e41, 0x83, 0xb7, 0x18, 0x3f, 0xa4, 0x1c, 0xd8, 0x59);
+
+//---
+#undef INTERFACE
+#define INTERFACE IMetaDataEmit
+DECLARE_INTERFACE_(IMetaDataEmit, IUnknown)
+{
+ STDMETHOD(SetModuleProps)( // S_OK or error.
+ LPCWSTR szName) PURE; // [IN] If not NULL, the name of the module to set.
+
+ STDMETHOD(Save)( // S_OK or error.
+ LPCWSTR szFile, // [IN] The filename to save to.
+ DWORD dwSaveFlags) PURE; // [IN] Flags for the save.
+
+ STDMETHOD(SaveToStream)( // S_OK or error.
+ IStream *pIStream, // [IN] A writable stream to save to.
+ DWORD dwSaveFlags) PURE; // [IN] Flags for the save.
+
+ STDMETHOD(GetSaveSize)( // S_OK or error.
+ CorSaveSize fSave, // [IN] cssAccurate or cssQuick.
+ DWORD *pdwSaveSize) PURE; // [OUT] Put the size here.
+
+ STDMETHOD(DefineTypeDef)( // S_OK or error.
+ LPCWSTR szTypeDef, // [IN] Name of TypeDef
+ DWORD dwTypeDefFlags, // [IN] CustomAttribute flags
+ mdToken tkExtends, // [IN] extends this TypeDef or typeref
+ mdToken rtkImplements[], // [IN] Implements interfaces
+ mdTypeDef *ptd) PURE; // [OUT] Put TypeDef token here
+
+ STDMETHOD(DefineNestedType)( // S_OK or error.
+ LPCWSTR szTypeDef, // [IN] Name of TypeDef
+ DWORD dwTypeDefFlags, // [IN] CustomAttribute flags
+ mdToken tkExtends, // [IN] extends this TypeDef or typeref
+ mdToken rtkImplements[], // [IN] Implements interfaces
+ mdTypeDef tdEncloser, // [IN] TypeDef token of the enclosing type.
+ mdTypeDef *ptd) PURE; // [OUT] Put TypeDef token here
+
+ STDMETHOD(SetHandler)( // S_OK.
+ IUnknown *pUnk) PURE; // [IN] The new error handler.
+
+ STDMETHOD(DefineMethod)( // S_OK or error.
+ mdTypeDef td, // Parent TypeDef
+ LPCWSTR szName, // Name of member
+ DWORD dwMethodFlags, // Member attributes
+ PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of CLR signature
+ ULONG cbSigBlob, // [IN] count of bytes in the signature blob
+ ULONG ulCodeRVA,
+ DWORD dwImplFlags,
+ mdMethodDef *pmd) PURE; // Put member token here
+
+ STDMETHOD(DefineMethodImpl)( // S_OK or error.
+ mdTypeDef td, // [IN] The class implementing the method
+ mdToken tkBody, // [IN] Method body - MethodDef or MethodRef
+ mdToken tkDecl) PURE; // [IN] Method declaration - MethodDef or MethodRef
+
+ STDMETHOD(DefineTypeRefByName)( // S_OK or error.
+ mdToken tkResolutionScope, // [IN] ModuleRef, AssemblyRef or TypeRef.
+ LPCWSTR szName, // [IN] Name of the TypeRef.
+ mdTypeRef *ptr) PURE; // [OUT] Put TypeRef token here.
+
+ STDMETHOD(DefineImportType)( // S_OK or error.
+ IMetaDataAssemblyImport *pAssemImport, // [IN] Assembly containing the TypeDef.
+ const void *pbHashValue, // [IN] Hash Blob for Assembly.
+ ULONG cbHashValue, // [IN] Count of bytes.
+ IMetaDataImport *pImport, // [IN] Scope containing the TypeDef.
+ mdTypeDef tdImport, // [IN] The imported TypeDef.
+ IMetaDataAssemblyEmit *pAssemEmit, // [IN] Assembly into which the TypeDef is imported.
+ mdTypeRef *ptr) PURE; // [OUT] Put TypeRef token here.
+
+ STDMETHOD(DefineMemberRef)( // S_OK or error
+ mdToken tkImport, // [IN] ClassRef or ClassDef importing a member.
+ LPCWSTR szName, // [IN] member's name
+ PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of CLR signature
+ ULONG cbSigBlob, // [IN] count of bytes in the signature blob
+ mdMemberRef *pmr) PURE; // [OUT] memberref token
+
+ STDMETHOD(DefineImportMember)( // S_OK or error.
+ IMetaDataAssemblyImport *pAssemImport, // [IN] Assembly containing the Member.
+ const void *pbHashValue, // [IN] Hash Blob for Assembly.
+ ULONG cbHashValue, // [IN] Count of bytes.
+ IMetaDataImport *pImport, // [IN] Import scope, with member.
+ mdToken mbMember, // [IN] Member in import scope.
+ IMetaDataAssemblyEmit *pAssemEmit, // [IN] Assembly into which the Member is imported.
+ mdToken tkParent, // [IN] Classref or classdef in emit scope.
+ mdMemberRef *pmr) PURE; // [OUT] Put member ref here.
+
+ STDMETHOD(DefineEvent) (
+ mdTypeDef td, // [IN] the class/interface on which the event is being defined
+ LPCWSTR szEvent, // [IN] Name of the event
+ DWORD dwEventFlags, // [IN] CorEventAttr
+ mdToken tkEventType, // [IN] a reference (mdTypeRef or mdTypeRef) to the Event class
+ mdMethodDef mdAddOn, // [IN] required add method
+ mdMethodDef mdRemoveOn, // [IN] required remove method
+ mdMethodDef mdFire, // [IN] optional fire method
+ mdMethodDef rmdOtherMethods[], // [IN] optional array of other methods associate with the event
+ mdEvent *pmdEvent) PURE; // [OUT] output event token
+
+ STDMETHOD(SetClassLayout) (
+ mdTypeDef td, // [IN] typedef
+ DWORD dwPackSize, // [IN] packing size specified as 1, 2, 4, 8, or 16
+ COR_FIELD_OFFSET rFieldOffsets[], // [IN] array of layout specification
+ ULONG ulClassSize) PURE; // [IN] size of the class
+
+ STDMETHOD(DeleteClassLayout) (
+ mdTypeDef td) PURE; // [IN] typedef whose layout is to be deleted.
+
+ STDMETHOD(SetFieldMarshal) (
+ mdToken tk, // [IN] given a fieldDef or paramDef token
+ PCCOR_SIGNATURE pvNativeType, // [IN] native type specification
+ ULONG cbNativeType) PURE; // [IN] count of bytes of pvNativeType
+
+ STDMETHOD(DeleteFieldMarshal) (
+ mdToken tk) PURE; // [IN] given a fieldDef or paramDef token
+
+ STDMETHOD(DefinePermissionSet) (
+ mdToken tk, // [IN] the object to be decorated.
+ DWORD dwAction, // [IN] CorDeclSecurity.
+ void const *pvPermission, // [IN] permission blob.
+ ULONG cbPermission, // [IN] count of bytes of pvPermission.
+ mdPermission *ppm) PURE; // [OUT] returned permission token.
+
+ STDMETHOD(SetRVA)( // S_OK or error.
+ mdMethodDef md, // [IN] Method for which to set offset
+ ULONG ulRVA) PURE; // [IN] The offset
+
+ STDMETHOD(GetTokenFromSig)( // S_OK or error.
+ PCCOR_SIGNATURE pvSig, // [IN] Signature to define.
+ ULONG cbSig, // [IN] Size of signature data.
+ mdSignature *pmsig) PURE; // [OUT] returned signature token.
+
+ STDMETHOD(DefineModuleRef)( // S_OK or error.
+ LPCWSTR szName, // [IN] DLL name
+ mdModuleRef *pmur) PURE; // [OUT] returned
+
+ // <TODO>@FUTURE: This should go away once everyone starts using SetMemberRefProps.</TODO>
+ STDMETHOD(SetParent)( // S_OK or error.
+ mdMemberRef mr, // [IN] Token for the ref to be fixed up.
+ mdToken tk) PURE; // [IN] The ref parent.
+
+ STDMETHOD(GetTokenFromTypeSpec)( // S_OK or error.
+ PCCOR_SIGNATURE pvSig, // [IN] TypeSpec Signature to define.
+ ULONG cbSig, // [IN] Size of signature data.
+ mdTypeSpec *ptypespec) PURE; // [OUT] returned TypeSpec token.
+
+ STDMETHOD(SaveToMemory)( // S_OK or error.
+ void *pbData, // [OUT] Location to write data.
+ ULONG cbData) PURE; // [IN] Max size of data buffer.
+
+ STDMETHOD(DefineUserString)( // Return code.
+ LPCWSTR szString, // [IN] User literal string.
+ ULONG cchString, // [IN] Length of string.
+ mdString *pstk) PURE; // [OUT] String token.
+
+ STDMETHOD(DeleteToken)( // Return code.
+ mdToken tkObj) PURE; // [IN] The token to be deleted
+
+ STDMETHOD(SetMethodProps)( // S_OK or error.
+ mdMethodDef md, // [IN] The MethodDef.
+ DWORD dwMethodFlags, // [IN] Method attributes.
+ ULONG ulCodeRVA, // [IN] Code RVA.
+ DWORD dwImplFlags) PURE; // [IN] Impl flags.
+
+ STDMETHOD(SetTypeDefProps)( // S_OK or error.
+ mdTypeDef td, // [IN] The TypeDef.
+ DWORD dwTypeDefFlags, // [IN] TypeDef flags.
+ mdToken tkExtends, // [IN] Base TypeDef or TypeRef.
+ mdToken rtkImplements[]) PURE; // [IN] Implemented interfaces.
+
+ STDMETHOD(SetEventProps)( // S_OK or error.
+ mdEvent ev, // [IN] The event token.
+ DWORD dwEventFlags, // [IN] CorEventAttr.
+ mdToken tkEventType, // [IN] A reference (mdTypeRef or mdTypeRef) to the Event class.
+ mdMethodDef mdAddOn, // [IN] Add method.
+ mdMethodDef mdRemoveOn, // [IN] Remove method.
+ mdMethodDef mdFire, // [IN] Fire method.
+ mdMethodDef rmdOtherMethods[]) PURE;// [IN] Array of other methods associate with the event.
+
+ STDMETHOD(SetPermissionSetProps)( // S_OK or error.
+ mdToken tk, // [IN] The object to be decorated.
+ DWORD dwAction, // [IN] CorDeclSecurity.
+ void const *pvPermission, // [IN] Permission blob.
+ ULONG cbPermission, // [IN] Count of bytes of pvPermission.
+ mdPermission *ppm) PURE; // [OUT] Permission token.
+
+ STDMETHOD(DefinePinvokeMap)( // Return code.
+ mdToken tk, // [IN] FieldDef or MethodDef.
+ DWORD dwMappingFlags, // [IN] Flags used for mapping.
+ LPCWSTR szImportName, // [IN] Import name.
+ mdModuleRef mrImportDLL) PURE; // [IN] ModuleRef token for the target DLL.
+
+ STDMETHOD(SetPinvokeMap)( // Return code.
+ mdToken tk, // [IN] FieldDef or MethodDef.
+ DWORD dwMappingFlags, // [IN] Flags used for mapping.
+ LPCWSTR szImportName, // [IN] Import name.
+ mdModuleRef mrImportDLL) PURE; // [IN] ModuleRef token for the target DLL.
+
+ STDMETHOD(DeletePinvokeMap)( // Return code.
+ mdToken tk) PURE; // [IN] FieldDef or MethodDef.
+
+ // New CustomAttribute functions.
+ STDMETHOD(DefineCustomAttribute)( // Return code.
+ mdToken tkOwner, // [IN] The object to put the value on.
+ mdToken tkCtor, // [IN] Constructor of the CustomAttribute type (MemberRef/MethodDef).
+ void const *pCustomAttribute, // [IN] The custom value data.
+ ULONG cbCustomAttribute, // [IN] The custom value data length.
+ mdCustomAttribute *pcv) PURE; // [OUT] The custom value token value on return.
+
+ STDMETHOD(SetCustomAttributeValue)( // Return code.
+ mdCustomAttribute pcv, // [IN] The custom value token whose value to replace.
+ void const *pCustomAttribute, // [IN] The custom value data.
+ ULONG cbCustomAttribute) PURE;// [IN] The custom value data length.
+
+ STDMETHOD(DefineField)( // S_OK or error.
+ mdTypeDef td, // Parent TypeDef
+ LPCWSTR szName, // Name of member
+ DWORD dwFieldFlags, // Member attributes
+ PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of CLR signature
+ ULONG cbSigBlob, // [IN] count of bytes in the signature blob
+ DWORD dwCPlusTypeFlag, // [IN] flag for value type. selected ELEMENT_TYPE_*
+ void const *pValue, // [IN] constant value
+ ULONG cchValue, // [IN] size of constant value (string, in wide chars).
+ mdFieldDef *pmd) PURE; // [OUT] Put member token here
+
+ STDMETHOD(DefineProperty)(
+ mdTypeDef td, // [IN] the class/interface on which the property is being defined
+ LPCWSTR szProperty, // [IN] Name of the property
+ DWORD dwPropFlags, // [IN] CorPropertyAttr
+ PCCOR_SIGNATURE pvSig, // [IN] the required type signature
+ ULONG cbSig, // [IN] the size of the type signature blob
+ DWORD dwCPlusTypeFlag, // [IN] flag for value type. selected ELEMENT_TYPE_*
+ void const *pValue, // [IN] constant value
+ ULONG cchValue, // [IN] size of constant value (string, in wide chars).
+ mdMethodDef mdSetter, // [IN] optional setter of the property
+ mdMethodDef mdGetter, // [IN] optional getter of the property
+ mdMethodDef rmdOtherMethods[], // [IN] an optional array of other methods
+ mdProperty *pmdProp) PURE; // [OUT] output property token
+
+ STDMETHOD(DefineParam)(
+ mdMethodDef md, // [IN] Owning method
+ ULONG ulParamSeq, // [IN] Which param
+ LPCWSTR szName, // [IN] Optional param name
+ DWORD dwParamFlags, // [IN] Optional param flags
+ DWORD dwCPlusTypeFlag, // [IN] flag for value type. selected ELEMENT_TYPE_*
+ void const *pValue, // [IN] constant value
+ ULONG cchValue, // [IN] size of constant value (string, in wide chars).
+ mdParamDef *ppd) PURE; // [OUT] Put param token here
+
+ STDMETHOD(SetFieldProps)( // S_OK or error.
+ mdFieldDef fd, // [IN] The FieldDef.
+ DWORD dwFieldFlags, // [IN] Field attributes.
+ DWORD dwCPlusTypeFlag, // [IN] Flag for the value type, selected ELEMENT_TYPE_*
+ void const *pValue, // [IN] Constant value.
+ ULONG cchValue) PURE; // [IN] size of constant value (string, in wide chars).
+
+ STDMETHOD(SetPropertyProps)( // S_OK or error.
+ mdProperty pr, // [IN] Property token.
+ DWORD dwPropFlags, // [IN] CorPropertyAttr.
+ DWORD dwCPlusTypeFlag, // [IN] Flag for value type, selected ELEMENT_TYPE_*
+ void const *pValue, // [IN] Constant value.
+ ULONG cchValue, // [IN] size of constant value (string, in wide chars).
+ mdMethodDef mdSetter, // [IN] Setter of the property.
+ mdMethodDef mdGetter, // [IN] Getter of the property.
+ mdMethodDef rmdOtherMethods[]) PURE;// [IN] Array of other methods.
+
+ STDMETHOD(SetParamProps)( // Return code.
+ mdParamDef pd, // [IN] Param token.
+ LPCWSTR szName, // [IN] Param name.
+ DWORD dwParamFlags, // [IN] Param flags.
+ DWORD dwCPlusTypeFlag, // [IN] Flag for value type. selected ELEMENT_TYPE_*.
+ void const *pValue, // [OUT] Constant value.
+ ULONG cchValue) PURE; // [IN] size of constant value (string, in wide chars).
+
+ // Specialized Custom Attributes for security.
+ STDMETHOD(DefineSecurityAttributeSet)( // Return code.
+ mdToken tkObj, // [IN] Class or method requiring security attributes.
+ COR_SECATTR rSecAttrs[], // [IN] Array of security attribute descriptions.
+ ULONG cSecAttrs, // [IN] Count of elements in above array.
+ ULONG *pulErrorAttr) PURE; // [OUT] On error, index of attribute causing problem.
+
+ STDMETHOD(ApplyEditAndContinue)( // S_OK or error.
+ IUnknown *pImport) PURE; // [IN] Metadata from the delta PE.
+
+ STDMETHOD(TranslateSigWithScope)(
+ IMetaDataAssemblyImport *pAssemImport, // [IN] importing assembly interface
+ const void *pbHashValue, // [IN] Hash Blob for Assembly.
+ ULONG cbHashValue, // [IN] Count of bytes.
+ IMetaDataImport *import, // [IN] importing interface
+ PCCOR_SIGNATURE pbSigBlob, // [IN] signature in the importing scope
+ ULONG cbSigBlob, // [IN] count of bytes of signature
+ IMetaDataAssemblyEmit *pAssemEmit, // [IN] emit assembly interface
+ IMetaDataEmit *emit, // [IN] emit interface
+ PCOR_SIGNATURE pvTranslatedSig, // [OUT] buffer to hold translated signature
+ ULONG cbTranslatedSigMax,
+ ULONG *pcbTranslatedSig) PURE;// [OUT] count of bytes in the translated signature
+
+ STDMETHOD(SetMethodImplFlags)( // [IN] S_OK or error.
+ mdMethodDef md, // [IN] Method for which to set ImplFlags
+ DWORD dwImplFlags) PURE;
+
+ STDMETHOD(SetFieldRVA)( // [IN] S_OK or error.
+ mdFieldDef fd, // [IN] Field for which to set offset
+ ULONG ulRVA) PURE; // [IN] The offset
+
+ STDMETHOD(Merge)( // S_OK or error.
+ IMetaDataImport *pImport, // [IN] The scope to be merged.
+ IMapToken *pHostMapToken, // [IN] Host IMapToken interface to receive token remap notification
+ IUnknown *pHandler) PURE; // [IN] An object to receive to receive error notification.
+
+ STDMETHOD(MergeEnd)() PURE; // S_OK or error.
+
+ // This interface is sealed. Do not change, add, or remove anything. Instead, derive a new iterface.
+
+}; // IMetaDataEmit
+
+//-------------------------------------
+//--- IMetaDataEmit2
+//-------------------------------------
+// {F5DD9950-F693-42e6-830E-7B833E8146A9}
+EXTERN_GUID(IID_IMetaDataEmit2, 0xf5dd9950, 0xf693, 0x42e6, 0x83, 0xe, 0x7b, 0x83, 0x3e, 0x81, 0x46, 0xa9);
+
+//---
+#undef INTERFACE
+#define INTERFACE IMetaDataEmit2
+DECLARE_INTERFACE_(IMetaDataEmit2, IMetaDataEmit)
+{
+ STDMETHOD(DefineMethodSpec)(
+ mdToken tkParent, // [IN] MethodDef or MemberRef
+ PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of COM+ signature
+ ULONG cbSigBlob, // [IN] count of bytes in the signature blob
+ mdMethodSpec *pmi) PURE; // [OUT] method instantiation token
+
+ STDMETHOD(GetDeltaSaveSize)( // S_OK or error.
+ CorSaveSize fSave, // [IN] cssAccurate or cssQuick.
+ DWORD *pdwSaveSize) PURE; // [OUT] Put the size here.
+
+ STDMETHOD(SaveDelta)( // S_OK or error.
+ LPCWSTR szFile, // [IN] The filename to save to.
+ DWORD dwSaveFlags) PURE; // [IN] Flags for the save.
+
+ STDMETHOD(SaveDeltaToStream)( // S_OK or error.
+ IStream *pIStream, // [IN] A writable stream to save to.
+ DWORD dwSaveFlags) PURE; // [IN] Flags for the save.
+
+ STDMETHOD(SaveDeltaToMemory)( // S_OK or error.
+ void *pbData, // [OUT] Location to write data.
+ ULONG cbData) PURE; // [IN] Max size of data buffer.
+
+ STDMETHOD(DefineGenericParam)( // S_OK or error.
+ mdToken tk, // [IN] TypeDef or MethodDef
+ ULONG ulParamSeq, // [IN] Index of the type parameter
+ DWORD dwParamFlags, // [IN] Flags, for future use (e.g. variance)
+ LPCWSTR szname, // [IN] Name
+ DWORD reserved, // [IN] For future use (e.g. non-type parameters)
+ mdToken rtkConstraints[], // [IN] Array of type constraints (TypeDef,TypeRef,TypeSpec)
+ mdGenericParam *pgp) PURE; // [OUT] Put GenericParam token here
+
+ STDMETHOD(SetGenericParamProps)( // S_OK or error.
+ mdGenericParam gp, // [IN] GenericParam
+ DWORD dwParamFlags, // [IN] Flags, for future use (e.g. variance)
+ LPCWSTR szName, // [IN] Optional name
+ DWORD reserved, // [IN] For future use (e.g. non-type parameters)
+ mdToken rtkConstraints[]) PURE;// [IN] Array of type constraints (TypeDef,TypeRef,TypeSpec)
+
+ STDMETHOD(ResetENCLog)() PURE; // S_OK or error.
+
+};
+
+//-------------------------------------
+//--- IMetaDataImport
+//-------------------------------------
+// {7DAC8207-D3AE-4c75-9B67-92801A497D44}
+EXTERN_GUID(IID_IMetaDataImport, 0x7dac8207, 0xd3ae, 0x4c75, 0x9b, 0x67, 0x92, 0x80, 0x1a, 0x49, 0x7d, 0x44);
+
+//---
+#undef INTERFACE
+#define INTERFACE IMetaDataImport
+DECLARE_INTERFACE_(IMetaDataImport, IUnknown)
+{
+ STDMETHOD_(void, CloseEnum)(HCORENUM hEnum) PURE;
+ STDMETHOD(CountEnum)(HCORENUM hEnum, ULONG *pulCount) PURE;
+ STDMETHOD(ResetEnum)(HCORENUM hEnum, ULONG ulPos) PURE;
+ STDMETHOD(EnumTypeDefs)(HCORENUM *phEnum, mdTypeDef rTypeDefs[],
+ ULONG cMax, ULONG *pcTypeDefs) PURE;
+ STDMETHOD(EnumInterfaceImpls)(HCORENUM *phEnum, mdTypeDef td,
+ mdInterfaceImpl rImpls[], ULONG cMax,
+ ULONG* pcImpls) PURE;
+ STDMETHOD(EnumTypeRefs)(HCORENUM *phEnum, mdTypeRef rTypeRefs[],
+ ULONG cMax, ULONG* pcTypeRefs) PURE;
+
+ STDMETHOD(FindTypeDefByName)( // S_OK or error.
+ LPCWSTR szTypeDef, // [IN] Name of the Type.
+ mdToken tkEnclosingClass, // [IN] TypeDef/TypeRef for Enclosing class.
+ mdTypeDef *ptd) PURE; // [OUT] Put the TypeDef token here.
+
+ STDMETHOD(GetScopeProps)( // S_OK or error.
+ _Out_writes_to_opt_(cchName, *pchName)
+ LPWSTR szName, // [OUT] Put the name here.
+ ULONG cchName, // [IN] Size of name buffer in wide chars.
+ ULONG *pchName, // [OUT] Put size of name (wide chars) here.
+ GUID *pmvid) PURE; // [OUT, OPTIONAL] Put MVID here.
+
+ STDMETHOD(GetModuleFromScope)( // S_OK.
+ mdModule *pmd) PURE; // [OUT] Put mdModule token here.
+
+ STDMETHOD(GetTypeDefProps)( // S_OK or error.
+ mdTypeDef td, // [IN] TypeDef token for inquiry.
+ _Out_writes_to_opt_(cchTypeDef, *pchTypeDef)
+ LPWSTR szTypeDef, // [OUT] Put name here.
+ ULONG cchTypeDef, // [IN] size of name buffer in wide chars.
+ ULONG *pchTypeDef, // [OUT] put size of name (wide chars) here.
+ DWORD *pdwTypeDefFlags, // [OUT] Put flags here.
+ mdToken *ptkExtends) PURE; // [OUT] Put base class TypeDef/TypeRef here.
+
+ STDMETHOD(GetInterfaceImplProps)( // S_OK or error.
+ mdInterfaceImpl iiImpl, // [IN] InterfaceImpl token.
+ mdTypeDef *pClass, // [OUT] Put implementing class token here.
+ mdToken *ptkIface) PURE; // [OUT] Put implemented interface token here.
+
+ STDMETHOD(GetTypeRefProps)( // S_OK or error.
+ mdTypeRef tr, // [IN] TypeRef token.
+ mdToken *ptkResolutionScope, // [OUT] Resolution scope, ModuleRef or AssemblyRef.
+ _Out_writes_to_opt_(cchName, *pchName)
+ LPWSTR szName, // [OUT] Name of the TypeRef.
+ ULONG cchName, // [IN] Size of buffer.
+ ULONG *pchName) PURE; // [OUT] Size of Name.
+
+ STDMETHOD(ResolveTypeRef)(mdTypeRef tr, REFIID riid, IUnknown **ppIScope, mdTypeDef *ptd) PURE;
+
+ STDMETHOD(EnumMembers)( // S_OK, S_FALSE, or error.
+ HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
+ mdTypeDef cl, // [IN] TypeDef to scope the enumeration.
+ mdToken rMembers[], // [OUT] Put MemberDefs here.
+ ULONG cMax, // [IN] Max MemberDefs to put.
+ ULONG *pcTokens) PURE; // [OUT] Put # put here.
+
+ STDMETHOD(EnumMembersWithName)( // S_OK, S_FALSE, or error.
+ HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
+ mdTypeDef cl, // [IN] TypeDef to scope the enumeration.
+ LPCWSTR szName, // [IN] Limit results to those with this name.
+ mdToken rMembers[], // [OUT] Put MemberDefs here.
+ ULONG cMax, // [IN] Max MemberDefs to put.
+ ULONG *pcTokens) PURE; // [OUT] Put # put here.
+
+ STDMETHOD(EnumMethods)( // S_OK, S_FALSE, or error.
+ HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
+ mdTypeDef cl, // [IN] TypeDef to scope the enumeration.
+ mdMethodDef rMethods[], // [OUT] Put MethodDefs here.
+ ULONG cMax, // [IN] Max MethodDefs to put.
+ ULONG *pcTokens) PURE; // [OUT] Put # put here.
+
+ STDMETHOD(EnumMethodsWithName)( // S_OK, S_FALSE, or error.
+ HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
+ mdTypeDef cl, // [IN] TypeDef to scope the enumeration.
+ LPCWSTR szName, // [IN] Limit results to those with this name.
+ mdMethodDef rMethods[], // [OU] Put MethodDefs here.
+ ULONG cMax, // [IN] Max MethodDefs to put.
+ ULONG *pcTokens) PURE; // [OUT] Put # put here.
+
+ STDMETHOD(EnumFields)( // S_OK, S_FALSE, or error.
+ HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
+ mdTypeDef cl, // [IN] TypeDef to scope the enumeration.
+ mdFieldDef rFields[], // [OUT] Put FieldDefs here.
+ ULONG cMax, // [IN] Max FieldDefs to put.
+ ULONG *pcTokens) PURE; // [OUT] Put # put here.
+
+ STDMETHOD(EnumFieldsWithName)( // S_OK, S_FALSE, or error.
+ HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
+ mdTypeDef cl, // [IN] TypeDef to scope the enumeration.
+ LPCWSTR szName, // [IN] Limit results to those with this name.
+ mdFieldDef rFields[], // [OUT] Put MemberDefs here.
+ ULONG cMax, // [IN] Max MemberDefs to put.
+ ULONG *pcTokens) PURE; // [OUT] Put # put here.
+
+
+ STDMETHOD(EnumParams)( // S_OK, S_FALSE, or error.
+ HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
+ mdMethodDef mb, // [IN] MethodDef to scope the enumeration.
+ mdParamDef rParams[], // [OUT] Put ParamDefs here.
+ ULONG cMax, // [IN] Max ParamDefs to put.
+ ULONG *pcTokens) PURE; // [OUT] Put # put here.
+
+ STDMETHOD(EnumMemberRefs)( // S_OK, S_FALSE, or error.
+ HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
+ mdToken tkParent, // [IN] Parent token to scope the enumeration.
+ mdMemberRef rMemberRefs[], // [OUT] Put MemberRefs here.
+ ULONG cMax, // [IN] Max MemberRefs to put.
+ ULONG *pcTokens) PURE; // [OUT] Put # put here.
+
+ STDMETHOD(EnumMethodImpls)( // S_OK, S_FALSE, or error
+ HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
+ mdTypeDef td, // [IN] TypeDef to scope the enumeration.
+ mdToken rMethodBody[], // [OUT] Put Method Body tokens here.
+ mdToken rMethodDecl[], // [OUT] Put Method Declaration tokens here.
+ ULONG cMax, // [IN] Max tokens to put.
+ ULONG *pcTokens) PURE; // [OUT] Put # put here.
+
+ STDMETHOD(EnumPermissionSets)( // S_OK, S_FALSE, or error.
+ HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
+ mdToken tk, // [IN] if !NIL, token to scope the enumeration.
+ DWORD dwActions, // [IN] if !0, return only these actions.
+ mdPermission rPermission[], // [OUT] Put Permissions here.
+ ULONG cMax, // [IN] Max Permissions to put.
+ ULONG *pcTokens) PURE; // [OUT] Put # put here.
+
+ STDMETHOD(FindMember)(
+ mdTypeDef td, // [IN] given typedef
+ LPCWSTR szName, // [IN] member name
+ PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of CLR signature
+ ULONG cbSigBlob, // [IN] count of bytes in the signature blob
+ mdToken *pmb) PURE; // [OUT] matching memberdef
+
+ STDMETHOD(FindMethod)(
+ mdTypeDef td, // [IN] given typedef
+ LPCWSTR szName, // [IN] member name
+ PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of CLR signature
+ ULONG cbSigBlob, // [IN] count of bytes in the signature blob
+ mdMethodDef *pmb) PURE; // [OUT] matching memberdef
+
+ STDMETHOD(FindField)(
+ mdTypeDef td, // [IN] given typedef
+ LPCWSTR szName, // [IN] member name
+ PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of CLR signature
+ ULONG cbSigBlob, // [IN] count of bytes in the signature blob
+ mdFieldDef *pmb) PURE; // [OUT] matching memberdef
+
+ STDMETHOD(FindMemberRef)(
+ mdTypeRef td, // [IN] given typeRef
+ LPCWSTR szName, // [IN] member name
+ PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of CLR signature
+ ULONG cbSigBlob, // [IN] count of bytes in the signature blob
+ mdMemberRef *pmr) PURE; // [OUT] matching memberref
+
+ STDMETHOD (GetMethodProps)(
+ mdMethodDef mb, // The method for which to get props.
+ mdTypeDef *pClass, // Put method's class here.
+ _Out_writes_to_opt_(cchMethod, *pchMethod)
+ LPWSTR szMethod, // Put method's name here.
+ ULONG cchMethod, // Size of szMethod buffer in wide chars.
+ ULONG *pchMethod, // Put actual size here
+ DWORD *pdwAttr, // Put flags here.
+ PCCOR_SIGNATURE *ppvSigBlob, // [OUT] point to the blob value of meta data
+ ULONG *pcbSigBlob, // [OUT] actual size of signature blob
+ ULONG *pulCodeRVA, // [OUT] codeRVA
+ DWORD *pdwImplFlags) PURE; // [OUT] Impl. Flags
+
+ STDMETHOD(GetMemberRefProps)( // S_OK or error.
+ mdMemberRef mr, // [IN] given memberref
+ mdToken *ptk, // [OUT] Put classref or classdef here.
+ _Out_writes_to_opt_(cchMember, *pchMember)
+ LPWSTR szMember, // [OUT] buffer to fill for member's name
+ ULONG cchMember, // [IN] the count of char of szMember
+ ULONG *pchMember, // [OUT] actual count of char in member name
+ PCCOR_SIGNATURE *ppvSigBlob, // [OUT] point to meta data blob value
+ ULONG *pbSig) PURE; // [OUT] actual size of signature blob
+
+ STDMETHOD(EnumProperties)( // S_OK, S_FALSE, or error.
+ HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
+ mdTypeDef td, // [IN] TypeDef to scope the enumeration.
+ mdProperty rProperties[], // [OUT] Put Properties here.
+ ULONG cMax, // [IN] Max properties to put.
+ ULONG *pcProperties) PURE; // [OUT] Put # put here.
+
+ STDMETHOD(EnumEvents)( // S_OK, S_FALSE, or error.
+ HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
+ mdTypeDef td, // [IN] TypeDef to scope the enumeration.
+ mdEvent rEvents[], // [OUT] Put events here.
+ ULONG cMax, // [IN] Max events to put.
+ ULONG *pcEvents) PURE; // [OUT] Put # put here.
+
+ STDMETHOD(GetEventProps)( // S_OK, S_FALSE, or error.
+ mdEvent ev, // [IN] event token
+ mdTypeDef *pClass, // [OUT] typedef containing the event declarion.
+ LPCWSTR szEvent, // [OUT] Event name
+ ULONG cchEvent, // [IN] the count of wchar of szEvent
+ ULONG *pchEvent, // [OUT] actual count of wchar for event's name
+ DWORD *pdwEventFlags, // [OUT] Event flags.
+ mdToken *ptkEventType, // [OUT] EventType class
+ mdMethodDef *pmdAddOn, // [OUT] AddOn method of the event
+ mdMethodDef *pmdRemoveOn, // [OUT] RemoveOn method of the event
+ mdMethodDef *pmdFire, // [OUT] Fire method of the event
+ mdMethodDef rmdOtherMethod[], // [OUT] other method of the event
+ ULONG cMax, // [IN] size of rmdOtherMethod
+ ULONG *pcOtherMethod) PURE; // [OUT] total number of other method of this event
+
+ STDMETHOD(EnumMethodSemantics)( // S_OK, S_FALSE, or error.
+ HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
+ mdMethodDef mb, // [IN] MethodDef to scope the enumeration.
+ mdToken rEventProp[], // [OUT] Put Event/Property here.
+ ULONG cMax, // [IN] Max properties to put.
+ ULONG *pcEventProp) PURE; // [OUT] Put # put here.
+
+ STDMETHOD(GetMethodSemantics)( // S_OK, S_FALSE, or error.
+ mdMethodDef mb, // [IN] method token
+ mdToken tkEventProp, // [IN] event/property token.
+ DWORD *pdwSemanticsFlags) PURE; // [OUT] the role flags for the method/propevent pair
+
+ STDMETHOD(GetClassLayout) (
+ mdTypeDef td, // [IN] give typedef
+ DWORD *pdwPackSize, // [OUT] 1, 2, 4, 8, or 16
+ COR_FIELD_OFFSET rFieldOffset[], // [OUT] field offset array
+ ULONG cMax, // [IN] size of the array
+ ULONG *pcFieldOffset, // [OUT] needed array size
+ ULONG *pulClassSize) PURE; // [OUT] the size of the class
+
+ STDMETHOD(GetFieldMarshal) (
+ mdToken tk, // [IN] given a field's memberdef
+ PCCOR_SIGNATURE *ppvNativeType, // [OUT] native type of this field
+ ULONG *pcbNativeType) PURE; // [OUT] the count of bytes of *ppvNativeType
+
+ STDMETHOD(GetRVA)( // S_OK or error.
+ mdToken tk, // Member for which to set offset
+ ULONG *pulCodeRVA, // The offset
+ DWORD *pdwImplFlags) PURE; // the implementation flags
+
+ STDMETHOD(GetPermissionSetProps) (
+ mdPermission pm, // [IN] the permission token.
+ DWORD *pdwAction, // [OUT] CorDeclSecurity.
+ void const **ppvPermission, // [OUT] permission blob.
+ ULONG *pcbPermission) PURE; // [OUT] count of bytes of pvPermission.
+
+ STDMETHOD(GetSigFromToken)( // S_OK or error.
+ mdSignature mdSig, // [IN] Signature token.
+ PCCOR_SIGNATURE *ppvSig, // [OUT] return pointer to token.
+ ULONG *pcbSig) PURE; // [OUT] return size of signature.
+
+ STDMETHOD(GetModuleRefProps)( // S_OK or error.
+ mdModuleRef mur, // [IN] moduleref token.
+ _Out_writes_to_opt_(cchName, *pchName)
+ LPWSTR szName, // [OUT] buffer to fill with the moduleref name.
+ ULONG cchName, // [IN] size of szName in wide characters.
+ ULONG *pchName) PURE; // [OUT] actual count of characters in the name.
+
+ STDMETHOD(EnumModuleRefs)( // S_OK or error.
+ HCORENUM *phEnum, // [IN|OUT] pointer to the enum.
+ mdModuleRef rModuleRefs[], // [OUT] put modulerefs here.
+ ULONG cmax, // [IN] max memberrefs to put.
+ ULONG *pcModuleRefs) PURE; // [OUT] put # put here.
+
+ STDMETHOD(GetTypeSpecFromToken)( // S_OK or error.
+ mdTypeSpec typespec, // [IN] TypeSpec token.
+ PCCOR_SIGNATURE *ppvSig, // [OUT] return pointer to TypeSpec signature
+ ULONG *pcbSig) PURE; // [OUT] return size of signature.
+
+ STDMETHOD(GetNameFromToken)( // Not Recommended! May be removed!
+ mdToken tk, // [IN] Token to get name from. Must have a name.
+ MDUTF8CSTR *pszUtf8NamePtr) PURE; // [OUT] Return pointer to UTF8 name in heap.
+
+ STDMETHOD(EnumUnresolvedMethods)( // S_OK, S_FALSE, or error.
+ HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
+ mdToken rMethods[], // [OUT] Put MemberDefs here.
+ ULONG cMax, // [IN] Max MemberDefs to put.
+ ULONG *pcTokens) PURE; // [OUT] Put # put here.
+
+ STDMETHOD(GetUserString)( // S_OK or error.
+ mdString stk, // [IN] String token.
+ _Out_writes_to_opt_(cchString, *pchString)
+ LPWSTR szString, // [OUT] Copy of string.
+ ULONG cchString, // [IN] Max chars of room in szString.
+ ULONG *pchString) PURE; // [OUT] How many chars in actual string.
+
+ STDMETHOD(GetPinvokeMap)( // S_OK or error.
+ mdToken tk, // [IN] FieldDef or MethodDef.
+ DWORD *pdwMappingFlags, // [OUT] Flags used for mapping.
+ _Out_writes_to_opt_(cchImportName, *pchImportName)
+ LPWSTR szImportName, // [OUT] Import name.
+ ULONG cchImportName, // [IN] Size of the name buffer.
+ ULONG *pchImportName, // [OUT] Actual number of characters stored.
+ mdModuleRef *pmrImportDLL) PURE; // [OUT] ModuleRef token for the target DLL.
+
+ STDMETHOD(EnumSignatures)( // S_OK or error.
+ HCORENUM *phEnum, // [IN|OUT] pointer to the enum.
+ mdSignature rSignatures[], // [OUT] put signatures here.
+ ULONG cmax, // [IN] max signatures to put.
+ ULONG *pcSignatures) PURE; // [OUT] put # put here.
+
+ STDMETHOD(EnumTypeSpecs)( // S_OK or error.
+ HCORENUM *phEnum, // [IN|OUT] pointer to the enum.
+ mdTypeSpec rTypeSpecs[], // [OUT] put TypeSpecs here.
+ ULONG cmax, // [IN] max TypeSpecs to put.
+ ULONG *pcTypeSpecs) PURE; // [OUT] put # put here.
+
+ STDMETHOD(EnumUserStrings)( // S_OK or error.
+ HCORENUM *phEnum, // [IN/OUT] pointer to the enum.
+ mdString rStrings[], // [OUT] put Strings here.
+ ULONG cmax, // [IN] max Strings to put.
+ ULONG *pcStrings) PURE; // [OUT] put # put here.
+
+ STDMETHOD(GetParamForMethodIndex)( // S_OK or error.
+ mdMethodDef md, // [IN] Method token.
+ ULONG ulParamSeq, // [IN] Parameter sequence.
+ mdParamDef *ppd) PURE; // [IN] Put Param token here.
+
+ STDMETHOD(EnumCustomAttributes)( // S_OK or error.
+ HCORENUM *phEnum, // [IN, OUT] COR enumerator.
+ mdToken tk, // [IN] Token to scope the enumeration, 0 for all.
+ mdToken tkType, // [IN] Type of interest, 0 for all.
+ mdCustomAttribute rCustomAttributes[], // [OUT] Put custom attribute tokens here.
+ ULONG cMax, // [IN] Size of rCustomAttributes.
+ ULONG *pcCustomAttributes) PURE; // [OUT, OPTIONAL] Put count of token values here.
+
+ STDMETHOD(GetCustomAttributeProps)( // S_OK or error.
+ mdCustomAttribute cv, // [IN] CustomAttribute token.
+ mdToken *ptkObj, // [OUT, OPTIONAL] Put object token here.
+ mdToken *ptkType, // [OUT, OPTIONAL] Put AttrType token here.
+ void const **ppBlob, // [OUT, OPTIONAL] Put pointer to data here.
+ ULONG *pcbSize) PURE; // [OUT, OPTIONAL] Put size of date here.
+
+ STDMETHOD(FindTypeRef)(
+ mdToken tkResolutionScope, // [IN] ModuleRef, AssemblyRef or TypeRef.
+ LPCWSTR szName, // [IN] TypeRef Name.
+ mdTypeRef *ptr) PURE; // [OUT] matching TypeRef.
+
+ STDMETHOD(GetMemberProps)(
+ mdToken mb, // The member for which to get props.
+ mdTypeDef *pClass, // Put member's class here.
+ _Out_writes_to_opt_(cchMember, *pchMember)
+ LPWSTR szMember, // Put member's name here.
+ ULONG cchMember, // Size of szMember buffer in wide chars.
+ ULONG *pchMember, // Put actual size here
+ DWORD *pdwAttr, // Put flags here.
+ PCCOR_SIGNATURE *ppvSigBlob, // [OUT] point to the blob value of meta data
+ ULONG *pcbSigBlob, // [OUT] actual size of signature blob
+ ULONG *pulCodeRVA, // [OUT] codeRVA
+ DWORD *pdwImplFlags, // [OUT] Impl. Flags
+ DWORD *pdwCPlusTypeFlag, // [OUT] flag for value type. selected ELEMENT_TYPE_*
+ UVCP_CONSTANT *ppValue, // [OUT] constant value
+ ULONG *pcchValue) PURE; // [OUT] size of constant string in chars, 0 for non-strings.
+
+ STDMETHOD(GetFieldProps)(
+ mdFieldDef mb, // The field for which to get props.
+ mdTypeDef *pClass, // Put field's class here.
+ _Out_writes_to_opt_(cchField, *pchField)
+ LPWSTR szField, // Put field's name here.
+ ULONG cchField, // Size of szField buffer in wide chars.
+ ULONG *pchField, // Put actual size here
+ DWORD *pdwAttr, // Put flags here.
+ PCCOR_SIGNATURE *ppvSigBlob, // [OUT] point to the blob value of meta data
+ ULONG *pcbSigBlob, // [OUT] actual size of signature blob
+ DWORD *pdwCPlusTypeFlag, // [OUT] flag for value type. selected ELEMENT_TYPE_*
+ UVCP_CONSTANT *ppValue, // [OUT] constant value
+ ULONG *pcchValue) PURE; // [OUT] size of constant string in chars, 0 for non-strings.
+
+ STDMETHOD(GetPropertyProps)( // S_OK, S_FALSE, or error.
+ mdProperty prop, // [IN] property token
+ mdTypeDef *pClass, // [OUT] typedef containing the property declarion.
+ LPCWSTR szProperty, // [OUT] Property name
+ ULONG cchProperty, // [IN] the count of wchar of szProperty
+ ULONG *pchProperty, // [OUT] actual count of wchar for property name
+ DWORD *pdwPropFlags, // [OUT] property flags.
+ PCCOR_SIGNATURE *ppvSig, // [OUT] property type. pointing to meta data internal blob
+ ULONG *pbSig, // [OUT] count of bytes in *ppvSig
+ DWORD *pdwCPlusTypeFlag, // [OUT] flag for value type. selected ELEMENT_TYPE_*
+ UVCP_CONSTANT *ppDefaultValue, // [OUT] constant value
+ ULONG *pcchDefaultValue, // [OUT] size of constant string in chars, 0 for non-strings.
+ mdMethodDef *pmdSetter, // [OUT] setter method of the property
+ mdMethodDef *pmdGetter, // [OUT] getter method of the property
+ mdMethodDef rmdOtherMethod[], // [OUT] other method of the property
+ ULONG cMax, // [IN] size of rmdOtherMethod
+ ULONG *pcOtherMethod) PURE; // [OUT] total number of other method of this property
+
+ STDMETHOD(GetParamProps)( // S_OK or error.
+ mdParamDef tk, // [IN]The Parameter.
+ mdMethodDef *pmd, // [OUT] Parent Method token.
+ ULONG *pulSequence, // [OUT] Parameter sequence.
+ _Out_writes_to_opt_(cchName, *pchName)
+ LPWSTR szName, // [OUT] Put name here.
+ ULONG cchName, // [OUT] Size of name buffer.
+ ULONG *pchName, // [OUT] Put actual size of name here.
+ DWORD *pdwAttr, // [OUT] Put flags here.
+ DWORD *pdwCPlusTypeFlag, // [OUT] Flag for value type. selected ELEMENT_TYPE_*.
+ UVCP_CONSTANT *ppValue, // [OUT] Constant value.
+ ULONG *pcchValue) PURE; // [OUT] size of constant string in chars, 0 for non-strings.
+
+ STDMETHOD(GetCustomAttributeByName)( // S_OK or error.
+ mdToken tkObj, // [IN] Object with Custom Attribute.
+ LPCWSTR szName, // [IN] Name of desired Custom Attribute.
+ const void **ppData, // [OUT] Put pointer to data here.
+ ULONG *pcbData) PURE; // [OUT] Put size of data here.
+
+ STDMETHOD_(BOOL, IsValidToken)( // True or False.
+ mdToken tk) PURE; // [IN] Given token.
+
+ STDMETHOD(GetNestedClassProps)( // S_OK or error.
+ mdTypeDef tdNestedClass, // [IN] NestedClass token.
+ mdTypeDef *ptdEnclosingClass) PURE; // [OUT] EnclosingClass token.
+
+ STDMETHOD(GetNativeCallConvFromSig)( // S_OK or error.
+ void const *pvSig, // [IN] Pointer to signature.
+ ULONG cbSig, // [IN] Count of signature bytes.
+ ULONG *pCallConv) PURE; // [OUT] Put calling conv here (see CorPinvokemap).
+
+ STDMETHOD(IsGlobal)( // S_OK or error.
+ mdToken pd, // [IN] Type, Field, or Method token.
+ int *pbGlobal) PURE; // [OUT] Put 1 if global, 0 otherwise.
+
+ // This interface is sealed. Do not change, add, or remove anything. Instead, derive a new iterface.
+
+}; // IMetaDataImport
+
+//-------------------------------------
+//--- IMetaDataImport2
+//-------------------------------------
+// {FCE5EFA0-8BBA-4f8e-A036-8F2022B08466}
+EXTERN_GUID(IID_IMetaDataImport2, 0xfce5efa0, 0x8bba, 0x4f8e, 0xa0, 0x36, 0x8f, 0x20, 0x22, 0xb0, 0x84, 0x66);
+
+//---
+#undef INTERFACE
+#define INTERFACE IMetaDataImport2
+DECLARE_INTERFACE_(IMetaDataImport2, IMetaDataImport)
+{
+ STDMETHOD(EnumGenericParams)(
+ HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
+ mdToken tk, // [IN] TypeDef or MethodDef whose generic parameters are requested
+ mdGenericParam rGenericParams[], // [OUT] Put GenericParams here.
+ ULONG cMax, // [IN] Max GenericParams to put.
+ ULONG *pcGenericParams) PURE; // [OUT] Put # put here.
+
+ STDMETHOD(GetGenericParamProps)( // S_OK or error.
+ mdGenericParam gp, // [IN] GenericParam
+ ULONG *pulParamSeq, // [OUT] Index of the type parameter
+ DWORD *pdwParamFlags, // [OUT] Flags, for future use (e.g. variance)
+ mdToken *ptOwner, // [OUT] Owner (TypeDef or MethodDef)
+ DWORD *reserved, // [OUT] For future use (e.g. non-type parameters)
+ _Out_writes_to_opt_(cchName, *pchName)
+ LPWSTR wzname, // [OUT] Put name here
+ ULONG cchName, // [IN] Size of buffer
+ ULONG *pchName) PURE; // [OUT] Put size of name (wide chars) here.
+
+ STDMETHOD(GetMethodSpecProps)(
+ mdMethodSpec mi, // [IN] The method instantiation
+ mdToken *tkParent, // [OUT] MethodDef or MemberRef
+ PCCOR_SIGNATURE *ppvSigBlob, // [OUT] point to the blob value of meta data
+ ULONG *pcbSigBlob) PURE; // [OUT] actual size of signature blob
+
+ STDMETHOD(EnumGenericParamConstraints)(
+ HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
+ mdGenericParam tk, // [IN] GenericParam whose constraints are requested
+ mdGenericParamConstraint rGenericParamConstraints[], // [OUT] Put GenericParamConstraints here.
+ ULONG cMax, // [IN] Max GenericParamConstraints to put.
+ ULONG *pcGenericParamConstraints) PURE; // [OUT] Put # put here.
+
+ STDMETHOD(GetGenericParamConstraintProps)( // S_OK or error.
+ mdGenericParamConstraint gpc, // [IN] GenericParamConstraint
+ mdGenericParam *ptGenericParam, // [OUT] GenericParam that is constrained
+ mdToken *ptkConstraintType) PURE; // [OUT] TypeDef/Ref/Spec constraint
+
+ STDMETHOD(GetPEKind)( // S_OK or error.
+ DWORD* pdwPEKind, // [OUT] The kind of PE (0 - not a PE)
+ DWORD* pdwMAchine) PURE; // [OUT] Machine as defined in NT header
+
+ STDMETHOD(GetVersionString)( // S_OK or error.
+ _Out_writes_to_opt_(ccBufSize, *pccBufSize)
+ LPWSTR pwzBuf, // [OUT] Put version string here.
+ DWORD ccBufSize, // [IN] size of the buffer, in wide chars
+ DWORD *pccBufSize) PURE; // [OUT] Size of the version string, wide chars, including terminating nul.
+
+ STDMETHOD(EnumMethodSpecs)(
+ HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
+ mdToken tk, // [IN] MethodDef or MemberRef whose MethodSpecs are requested
+ mdMethodSpec rMethodSpecs[], // [OUT] Put MethodSpecs here.
+ ULONG cMax, // [IN] Max tokens to put.
+ ULONG *pcMethodSpecs) PURE; // [OUT] Put actual count here.
+
+}; // IMetaDataImport2
+
+//-------------------------------------
+//--- IMetaDataFilter
+//-------------------------------------
+// {D0E80DD1-12D4-11d3-B39D-00C04FF81795}
+EXTERN_GUID(IID_IMetaDataFilter, 0xd0e80dd1, 0x12d4, 0x11d3, 0xb3, 0x9d, 0x0, 0xc0, 0x4f, 0xf8, 0x17, 0x95);
+
+//---
+#undef INTERFACE
+#define INTERFACE IMetaDataFilter
+DECLARE_INTERFACE_(IMetaDataFilter, IUnknown)
+{
+ STDMETHOD(UnmarkAll)() PURE;
+ STDMETHOD(MarkToken)(mdToken tk) PURE;
+ STDMETHOD(IsTokenMarked)(mdToken tk, BOOL *pIsMarked) PURE;
+};
+
+
+//-------------------------------------
+//--- IHostFilter
+//-------------------------------------
+// {D0E80DD3-12D4-11d3-B39D-00C04FF81795}
+EXTERN_GUID(IID_IHostFilter, 0xd0e80dd3, 0x12d4, 0x11d3, 0xb3, 0x9d, 0x0, 0xc0, 0x4f, 0xf8, 0x17, 0x95);
+
+//---
+#undef INTERFACE
+#define INTERFACE IHostFilter
+DECLARE_INTERFACE_(IHostFilter, IUnknown)
+{
+ STDMETHOD(MarkToken)(mdToken tk) PURE;
+};
+
+
+//*****************************************************************************
+// Assembly Declarations
+//*****************************************************************************
+
+typedef struct
+{
+ DWORD dwOSPlatformId; // Operating system platform.
+ DWORD dwOSMajorVersion; // OS Major version.
+ DWORD dwOSMinorVersion; // OS Minor version.
+} OSINFO;
+
+
+typedef struct
+{
+ USHORT usMajorVersion; // Major Version.
+ USHORT usMinorVersion; // Minor Version.
+ USHORT usBuildNumber; // Build Number.
+ USHORT usRevisionNumber; // Revision Number.
+ LPWSTR szLocale; // Locale.
+ ULONG cbLocale; // [IN/OUT] Size of the buffer in wide chars/Actual size.
+ DWORD *rProcessor; // Processor ID array.
+ ULONG ulProcessor; // [IN/OUT] Size of the Processor ID array/Actual # of entries filled in.
+ OSINFO *rOS; // OSINFO array.
+ ULONG ulOS; // [IN/OUT]Size of the OSINFO array/Actual # of entries filled in.
+} ASSEMBLYMETADATA;
+
+
+// {211EF15B-5317-4438-B196-DEC87B887693}
+EXTERN_GUID(IID_IMetaDataAssemblyEmit, 0x211ef15b, 0x5317, 0x4438, 0xb1, 0x96, 0xde, 0xc8, 0x7b, 0x88, 0x76, 0x93);
+
+//---
+#undef INTERFACE
+#define INTERFACE IMetaDataAssemblyEmit
+DECLARE_INTERFACE_(IMetaDataAssemblyEmit, IUnknown)
+{
+ STDMETHOD(DefineAssembly)( // S_OK or error.
+ const void *pbPublicKey, // [IN] Public key of the assembly.
+ ULONG cbPublicKey, // [IN] Count of bytes in the public key.
+ ULONG ulHashAlgId, // [IN] Hash algorithm used to hash the files.
+ LPCWSTR szName, // [IN] Name of the assembly.
+ const ASSEMBLYMETADATA *pMetaData, // [IN] Assembly MetaData.
+ DWORD dwAssemblyFlags, // [IN] Flags.
+ mdAssembly *pma) PURE; // [OUT] Returned Assembly token.
+
+ STDMETHOD(DefineAssemblyRef)( // S_OK or error.
+ const void *pbPublicKeyOrToken, // [IN] Public key or token of the assembly.
+ ULONG cbPublicKeyOrToken, // [IN] Count of bytes in the public key or token.
+ LPCWSTR szName, // [IN] Name of the assembly being referenced.
+ const ASSEMBLYMETADATA *pMetaData, // [IN] Assembly MetaData.
+ const void *pbHashValue, // [IN] Hash Blob.
+ ULONG cbHashValue, // [IN] Count of bytes in the Hash Blob.
+ DWORD dwAssemblyRefFlags, // [IN] Flags.
+ mdAssemblyRef *pmdar) PURE; // [OUT] Returned AssemblyRef token.
+
+ STDMETHOD(DefineFile)( // S_OK or error.
+ LPCWSTR szName, // [IN] Name of the file.
+ const void *pbHashValue, // [IN] Hash Blob.
+ ULONG cbHashValue, // [IN] Count of bytes in the Hash Blob.
+ DWORD dwFileFlags, // [IN] Flags.
+ mdFile *pmdf) PURE; // [OUT] Returned File token.
+
+ STDMETHOD(DefineExportedType)( // S_OK or error.
+ LPCWSTR szName, // [IN] Name of the Com Type.
+ mdToken tkImplementation, // [IN] mdFile or mdAssemblyRef or mdExportedType
+ mdTypeDef tkTypeDef, // [IN] TypeDef token within the file.
+ DWORD dwExportedTypeFlags, // [IN] Flags.
+ mdExportedType *pmdct) PURE; // [OUT] Returned ExportedType token.
+
+ STDMETHOD(DefineManifestResource)( // S_OK or error.
+ LPCWSTR szName, // [IN] Name of the resource.
+ mdToken tkImplementation, // [IN] mdFile or mdAssemblyRef that provides the resource.
+ DWORD dwOffset, // [IN] Offset to the beginning of the resource within the file.
+ DWORD dwResourceFlags, // [IN] Flags.
+ mdManifestResource *pmdmr) PURE; // [OUT] Returned ManifestResource token.
+
+ STDMETHOD(SetAssemblyProps)( // S_OK or error.
+ mdAssembly pma, // [IN] Assembly token.
+ const void *pbPublicKey, // [IN] Public key of the assembly.
+ ULONG cbPublicKey, // [IN] Count of bytes in the public key.
+ ULONG ulHashAlgId, // [IN] Hash algorithm used to hash the files.
+ LPCWSTR szName, // [IN] Name of the assembly.
+ const ASSEMBLYMETADATA *pMetaData, // [IN] Assembly MetaData.
+ DWORD dwAssemblyFlags) PURE; // [IN] Flags.
+
+ STDMETHOD(SetAssemblyRefProps)( // S_OK or error.
+ mdAssemblyRef ar, // [IN] AssemblyRefToken.
+ const void *pbPublicKeyOrToken, // [IN] Public key or token of the assembly.
+ ULONG cbPublicKeyOrToken, // [IN] Count of bytes in the public key or token.
+ LPCWSTR szName, // [IN] Name of the assembly being referenced.
+ const ASSEMBLYMETADATA *pMetaData, // [IN] Assembly MetaData.
+ const void *pbHashValue, // [IN] Hash Blob.
+ ULONG cbHashValue, // [IN] Count of bytes in the Hash Blob.
+ DWORD dwAssemblyRefFlags) PURE; // [IN] Token for Execution Location.
+
+ STDMETHOD(SetFileProps)( // S_OK or error.
+ mdFile file, // [IN] File token.
+ const void *pbHashValue, // [IN] Hash Blob.
+ ULONG cbHashValue, // [IN] Count of bytes in the Hash Blob.
+ DWORD dwFileFlags) PURE; // [IN] Flags.
+
+ STDMETHOD(SetExportedTypeProps)( // S_OK or error.
+ mdExportedType ct, // [IN] ExportedType token.
+ mdToken tkImplementation, // [IN] mdFile or mdAssemblyRef or mdExportedType.
+ mdTypeDef tkTypeDef, // [IN] TypeDef token within the file.
+ DWORD dwExportedTypeFlags) PURE; // [IN] Flags.
+
+ STDMETHOD(SetManifestResourceProps)( // S_OK or error.
+ mdManifestResource mr, // [IN] ManifestResource token.
+ mdToken tkImplementation, // [IN] mdFile or mdAssemblyRef that provides the resource.
+ DWORD dwOffset, // [IN] Offset to the beginning of the resource within the file.
+ DWORD dwResourceFlags) PURE; // [IN] Flags.
+
+}; // IMetaDataAssemblyEmit
+
+
+// {EE62470B-E94B-424e-9B7C-2F00C9249F93}
+EXTERN_GUID(IID_IMetaDataAssemblyImport, 0xee62470b, 0xe94b, 0x424e, 0x9b, 0x7c, 0x2f, 0x0, 0xc9, 0x24, 0x9f, 0x93);
+
+//---
+#undef INTERFACE
+#define INTERFACE IMetaDataAssemblyImport
+DECLARE_INTERFACE_(IMetaDataAssemblyImport, IUnknown)
+{
+ STDMETHOD(GetAssemblyProps)( // S_OK or error.
+ mdAssembly mda, // [IN] The Assembly for which to get the properties.
+ const void **ppbPublicKey, // [OUT] Pointer to the public key.
+ ULONG *pcbPublicKey, // [OUT] Count of bytes in the public key.
+ ULONG *pulHashAlgId, // [OUT] Hash Algorithm.
+ _Out_writes_to_opt_(cchName, *pchName) LPWSTR szName, // [OUT] Buffer to fill with assembly's simply name.
+ ULONG cchName, // [IN] Size of buffer in wide chars.
+ ULONG *pchName, // [OUT] Actual # of wide chars in name.
+ ASSEMBLYMETADATA *pMetaData, // [OUT] Assembly MetaData.
+ DWORD *pdwAssemblyFlags) PURE; // [OUT] Flags.
+
+ STDMETHOD(GetAssemblyRefProps)( // S_OK or error.
+ mdAssemblyRef mdar, // [IN] The AssemblyRef for which to get the properties.
+ const void **ppbPublicKeyOrToken, // [OUT] Pointer to the public key or token.
+ ULONG *pcbPublicKeyOrToken, // [OUT] Count of bytes in the public key or token.
+ _Out_writes_to_opt_(cchName, *pchName)LPWSTR szName, // [OUT] Buffer to fill with name.
+ ULONG cchName, // [IN] Size of buffer in wide chars.
+ ULONG *pchName, // [OUT] Actual # of wide chars in name.
+ ASSEMBLYMETADATA *pMetaData, // [OUT] Assembly MetaData.
+ const void **ppbHashValue, // [OUT] Hash blob.
+ ULONG *pcbHashValue, // [OUT] Count of bytes in the hash blob.
+ DWORD *pdwAssemblyRefFlags) PURE; // [OUT] Flags.
+
+ STDMETHOD(GetFileProps)( // S_OK or error.
+ mdFile mdf, // [IN] The File for which to get the properties.
+ _Out_writes_to_opt_(cchName, *pchName) LPWSTR szName, // [OUT] Buffer to fill with name.
+ ULONG cchName, // [IN] Size of buffer in wide chars.
+ ULONG *pchName, // [OUT] Actual # of wide chars in name.
+ const void **ppbHashValue, // [OUT] Pointer to the Hash Value Blob.
+ ULONG *pcbHashValue, // [OUT] Count of bytes in the Hash Value Blob.
+ DWORD *pdwFileFlags) PURE; // [OUT] Flags.
+
+ STDMETHOD(GetExportedTypeProps)( // S_OK or error.
+ mdExportedType mdct, // [IN] The ExportedType for which to get the properties.
+ _Out_writes_to_opt_(cchName, *pchName) LPWSTR szName, // [OUT] Buffer to fill with name.
+ ULONG cchName, // [IN] Size of buffer in wide chars.
+ ULONG *pchName, // [OUT] Actual # of wide chars in name.
+ mdToken *ptkImplementation, // [OUT] mdFile or mdAssemblyRef or mdExportedType.
+ mdTypeDef *ptkTypeDef, // [OUT] TypeDef token within the file.
+ DWORD *pdwExportedTypeFlags) PURE; // [OUT] Flags.
+
+ STDMETHOD(GetManifestResourceProps)( // S_OK or error.
+ mdManifestResource mdmr, // [IN] The ManifestResource for which to get the properties.
+ _Out_writes_to_opt_(cchName, *pchName)LPWSTR szName, // [OUT] Buffer to fill with name.
+ ULONG cchName, // [IN] Size of buffer in wide chars.
+ ULONG *pchName, // [OUT] Actual # of wide chars in name.
+ mdToken *ptkImplementation, // [OUT] mdFile or mdAssemblyRef that provides the ManifestResource.
+ DWORD *pdwOffset, // [OUT] Offset to the beginning of the resource within the file.
+ DWORD *pdwResourceFlags) PURE;// [OUT] Flags.
+
+ STDMETHOD(EnumAssemblyRefs)( // S_OK or error
+ HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
+ mdAssemblyRef rAssemblyRefs[], // [OUT] Put AssemblyRefs here.
+ ULONG cMax, // [IN] Max AssemblyRefs to put.
+ ULONG *pcTokens) PURE; // [OUT] Put # put here.
+
+ STDMETHOD(EnumFiles)( // S_OK or error
+ HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
+ mdFile rFiles[], // [OUT] Put Files here.
+ ULONG cMax, // [IN] Max Files to put.
+ ULONG *pcTokens) PURE; // [OUT] Put # put here.
+
+ STDMETHOD(EnumExportedTypes)( // S_OK or error
+ HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
+ mdExportedType rExportedTypes[], // [OUT] Put ExportedTypes here.
+ ULONG cMax, // [IN] Max ExportedTypes to put.
+ ULONG *pcTokens) PURE; // [OUT] Put # put here.
+
+ STDMETHOD(EnumManifestResources)( // S_OK or error
+ HCORENUM *phEnum, // [IN|OUT] Pointer to the enum.
+ mdManifestResource rManifestResources[], // [OUT] Put ManifestResources here.
+ ULONG cMax, // [IN] Max Resources to put.
+ ULONG *pcTokens) PURE; // [OUT] Put # put here.
+
+ STDMETHOD(GetAssemblyFromScope)( // S_OK or error
+ mdAssembly *ptkAssembly) PURE; // [OUT] Put token here.
+
+ STDMETHOD(FindExportedTypeByName)( // S_OK or error
+ LPCWSTR szName, // [IN] Name of the ExportedType.
+ mdToken mdtExportedType, // [IN] ExportedType for the enclosing class.
+ mdExportedType *ptkExportedType) PURE; // [OUT] Put the ExportedType token here.
+
+ STDMETHOD(FindManifestResourceByName)( // S_OK or error
+ LPCWSTR szName, // [IN] Name of the ManifestResource.
+ mdManifestResource *ptkManifestResource) PURE; // [OUT] Put the ManifestResource token here.
+
+ STDMETHOD_(void, CloseEnum)(
+ HCORENUM hEnum) PURE; // Enum to be closed.
+
+ STDMETHOD(FindAssembliesByName)( // S_OK or error
+ LPCWSTR szAppBase, // [IN] optional - can be NULL
+ LPCWSTR szPrivateBin, // [IN] optional - can be NULL
+ LPCWSTR szAssemblyName, // [IN] required - this is the assembly you are requesting
+ IUnknown *ppIUnk[], // [OUT] put IMetaDataAssemblyImport pointers here
+ ULONG cMax, // [IN] The max number to put
+ ULONG *pcAssemblies) PURE; // [OUT] The number of assemblies returned.
+}; // IMetaDataAssemblyImport
+
+
+//*****************************************************************************
+// End Assembly Declarations
+//*****************************************************************************
+
+//*****************************************************************************
+// MetaData Validator Declarations
+//*****************************************************************************
+
+// Specifies the type of the module, PE file vs. .obj file.
+typedef enum
+{
+ ValidatorModuleTypeInvalid = 0x0,
+ ValidatorModuleTypeMin = 0x00000001,
+ ValidatorModuleTypePE = 0x00000001,
+ ValidatorModuleTypeObj = 0x00000002,
+ ValidatorModuleTypeEnc = 0x00000003,
+ ValidatorModuleTypeIncr = 0x00000004,
+ ValidatorModuleTypeMax = 0x00000004,
+} CorValidatorModuleType;
+
+
+// {4709C9C6-81FF-11D3-9FC7-00C04F79A0A3}
+EXTERN_GUID(IID_IMetaDataValidate, 0x4709c9c6, 0x81ff, 0x11d3, 0x9f, 0xc7, 0x0, 0xc0, 0x4f, 0x79, 0xa0, 0xa3);
+
+//---
+#undef INTERFACE
+#define INTERFACE IMetaDataValidate
+DECLARE_INTERFACE_(IMetaDataValidate, IUnknown)
+{
+ STDMETHOD(ValidatorInit)( // S_OK or error.
+ DWORD dwModuleType, // [IN] Specifies the type of the module.
+ IUnknown *pUnk) PURE; // [IN] Validation error handler.
+
+ STDMETHOD(ValidateMetaData)( // S_OK or error.
+ ) PURE;
+}; // IMetaDataValidate
+
+//*****************************************************************************
+// End MetaData Validator Declarations
+//*****************************************************************************
+
+//*****************************************************************************
+// IMetaDataDispenserEx declarations.
+//*****************************************************************************
+
+// {31BCFCE2-DAFB-11D2-9F81-00C04F79A0A3}
+EXTERN_GUID(IID_IMetaDataDispenserEx, 0x31bcfce2, 0xdafb, 0x11d2, 0x9f, 0x81, 0x0, 0xc0, 0x4f, 0x79, 0xa0, 0xa3);
+
+#undef INTERFACE
+#define INTERFACE IMetaDataDispenserEx
+DECLARE_INTERFACE_(IMetaDataDispenserEx, IMetaDataDispenser)
+{
+ STDMETHOD(SetOption)( // Return code.
+ REFGUID optionid, // [in] GUID for the option to be set.
+ const VARIANT *value) PURE; // [in] Value to which the option is to be set.
+
+ STDMETHOD(GetOption)( // Return code.
+ REFGUID optionid, // [in] GUID for the option to be set.
+ VARIANT *pvalue) PURE; // [out] Value to which the option is currently set.
+
+ STDMETHOD(OpenScopeOnITypeInfo)( // Return code.
+ ITypeInfo *pITI, // [in] ITypeInfo to open.
+ DWORD dwOpenFlags, // [in] Open mode flags.
+ REFIID riid, // [in] The interface desired.
+ IUnknown **ppIUnk) PURE; // [out] Return interface on success.
+
+ STDMETHOD(GetCORSystemDirectory)( // Return code.
+ _Out_writes_to_opt_(cchBuffer, *pchBuffer)
+ LPWSTR szBuffer, // [out] Buffer for the directory name
+ DWORD cchBuffer, // [in] Size of the buffer
+ DWORD* pchBuffer) PURE; // [OUT] Number of characters returned
+
+ STDMETHOD(FindAssembly)( // S_OK or error
+ LPCWSTR szAppBase, // [IN] optional - can be NULL
+ LPCWSTR szPrivateBin, // [IN] optional - can be NULL
+ LPCWSTR szGlobalBin, // [IN] optional - can be NULL
+ LPCWSTR szAssemblyName, // [IN] required - this is the assembly you are requesting
+ LPCWSTR szName, // [OUT] buffer - to hold name
+ ULONG cchName, // [IN] the name buffer's size
+ ULONG *pcName) PURE; // [OUT] the number of characters returend in the buffer
+
+ STDMETHOD(FindAssemblyModule)( // S_OK or error
+ LPCWSTR szAppBase, // [IN] optional - can be NULL
+ LPCWSTR szPrivateBin, // [IN] optional - can be NULL
+ LPCWSTR szGlobalBin, // [IN] optional - can be NULL
+ LPCWSTR szAssemblyName, // [IN] required - this is the assembly you are requesting
+ LPCWSTR szModuleName, // [IN] required - the name of the module
+ _Out_writes_to_opt_(cchName, *pcName)
+ LPWSTR szName, // [OUT] buffer - to hold name
+ ULONG cchName, // [IN] the name buffer's size
+ ULONG *pcName) PURE; // [OUT] the number of characters returend in the buffer
+
+};
+
+//*****************************************************************************
+//*****************************************************************************
+//
+// Registration declarations. Will be replace by Services' Registration
+// implementation.
+//
+//*****************************************************************************
+//*****************************************************************************
+// Various flags for use in installing a module or a composite
+typedef enum
+{
+ regNoCopy = 0x00000001, // Don't copy files into destination
+ regConfig = 0x00000002, // Is a configuration
+ regHasRefs = 0x00000004 // Has class references
+} CorRegFlags;
+
+typedef GUID CVID;
+
+typedef struct {
+ short Major;
+ short Minor;
+ short Sub;
+ short Build;
+} CVStruct;
+
+
+//*****************************************************************************
+//*****************************************************************************
+//
+// CeeGen interfaces for generating in-memory Common Language Runtime files
+//
+//*****************************************************************************
+//*****************************************************************************
+
+typedef void *HCEESECTION;
+
+typedef enum {
+ sdNone = 0,
+ sdReadOnly = IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_INITIALIZED_DATA,
+ sdReadWrite = sdReadOnly | IMAGE_SCN_MEM_WRITE,
+ sdExecute = IMAGE_SCN_MEM_READ | IMAGE_SCN_CNT_CODE | IMAGE_SCN_MEM_EXECUTE
+} CeeSectionAttr;
+
+//
+// Relocation types.
+//
+
+typedef enum {
+ // generate only a section-relative reloc, nothing into .reloc section
+ srRelocAbsolute,
+
+ // generate a .reloc for a pointer sized location,
+ // This is transformed into BASED_HIGHLOW or BASED_DIR64 based on the platform
+ srRelocHighLow = 3,
+
+ // generate a .reloc for the top 16-bits of a 32 bit number, where the
+ // bottom 16 bits are included in the next word in the .reloc table
+ srRelocHighAdj, // Never Used
+
+ // generate a token map relocation, nothing into .reloc section
+ srRelocMapToken,
+
+ // relative address fixup
+ srRelocRelative,
+
+ // Generate only a section-relative reloc, nothing into .reloc
+ // section. This reloc is relative to the file position of the
+ // section, not the section's virtual address.
+ srRelocFilePos,
+
+ // code relative address fixup
+ srRelocCodeRelative,
+
+ // generate a .reloc for a 64 bit address in an ia64 movl instruction
+ srRelocIA64Imm64,
+
+ // generate a .reloc for a 64 bit address
+ srRelocDir64,
+
+ // generate a .reloc for a 25-bit PC relative address in an ia64 br.call instruction
+ srRelocIA64PcRel25,
+
+ // generate a .reloc for a 64-bit PC relative address in an ia64 brl.call instruction
+ srRelocIA64PcRel64,
+
+ // generate a 30-bit section-relative reloc, used for tagged pointer values
+ srRelocAbsoluteTagged,
+
+
+ // A sentinel value to help ensure any additions to this enum are reflected
+ // in PEWriter.cpp's RelocName array.
+ srRelocSentinel,
+
+ // Flags that can be used with the above reloc types
+
+ // do not emit base reloc
+ srNoBaseReloc = 0x4000,
+
+ // pre-fixup contents of memory are ptr rather than a section offset
+ srRelocPtr = 0x8000,
+
+ // legal enums which include the Ptr flag
+ srRelocAbsolutePtr = srRelocPtr + srRelocAbsolute,
+ srRelocHighLowPtr = srRelocPtr + srRelocHighLow,
+ srRelocRelativePtr = srRelocPtr + srRelocRelative,
+ srRelocIA64Imm64Ptr = srRelocPtr + srRelocIA64Imm64,
+ srRelocDir64Ptr = srRelocPtr + srRelocDir64,
+
+} CeeSectionRelocType;
+
+typedef union {
+ USHORT highAdj;
+} CeeSectionRelocExtra;
+
+//-------------------------------------
+//--- ICeeGen
+//-------------------------------------
+// {7ED1BDFF-8E36-11d2-9C56-00A0C9B7CC45}
+EXTERN_GUID(IID_ICeeGen, 0x7ed1bdff, 0x8e36, 0x11d2, 0x9c, 0x56, 0x0, 0xa0, 0xc9, 0xb7, 0xcc, 0x45);
+
+DECLARE_INTERFACE_(ICeeGen, IUnknown)
+{
+ STDMETHOD (EmitString) (
+ _In_
+ LPWSTR lpString, // [IN] String to emit
+ ULONG *RVA) PURE; // [OUT] RVA for string emitted string
+
+ STDMETHOD (GetString) (
+ ULONG RVA, // [IN] RVA for string to return
+ _Out_opt_
+ LPWSTR *lpString) PURE; // [OUT] Returned string
+
+ STDMETHOD (AllocateMethodBuffer) (
+ ULONG cchBuffer, // [IN] Length of buffer to create
+ UCHAR **lpBuffer, // [OUT] Returned buffer
+ ULONG *RVA) PURE; // [OUT] RVA for method
+
+ STDMETHOD (GetMethodBuffer) (
+ ULONG RVA, // [IN] RVA for method to return
+ UCHAR **lpBuffer) PURE; // [OUT] Returned buffer
+
+ STDMETHOD (GetIMapTokenIface) (
+ IUnknown **pIMapToken) PURE;
+
+ STDMETHOD (GenerateCeeFile) () PURE;
+
+ STDMETHOD (GetIlSection) (
+ HCEESECTION *section) PURE;
+
+ STDMETHOD (GetStringSection) (
+ HCEESECTION *section) PURE;
+
+ STDMETHOD (AddSectionReloc) (
+ HCEESECTION section,
+ ULONG offset,
+ HCEESECTION relativeTo,
+ CeeSectionRelocType relocType) PURE;
+
+ // use these only if you have special section requirements not handled
+ // by other APIs
+ STDMETHOD (GetSectionCreate) (
+ const char *name,
+ DWORD flags,
+ HCEESECTION *section) PURE;
+
+ STDMETHOD (GetSectionDataLen) (
+ HCEESECTION section,
+ ULONG *dataLen) PURE;
+
+ STDMETHOD (GetSectionBlock) (
+ HCEESECTION section,
+ ULONG len,
+ ULONG align=1,
+ void **ppBytes=0) PURE;
+
+ STDMETHOD (TruncateSection) (
+ HCEESECTION section,
+ ULONG len) PURE;
+
+ STDMETHOD (GenerateCeeMemoryImage) (
+ void **ppImage) PURE;
+
+ STDMETHOD (ComputePointer) (
+ HCEESECTION section,
+ ULONG RVA, // [IN] RVA for method to return
+ UCHAR **lpBuffer) PURE; // [OUT] Returned buffer
+
+};
+
+//*****************************************************************************
+//*****************************************************************************
+//
+// End of CeeGen declarations.
+//
+//*****************************************************************************
+
+//**********************************************************************
+//**********************************************************************
+//--- IMetaDataTables
+//-------------------------------------
+// This API isn't big endian friendly since it indexes directly into the memory that
+// is stored in little endian format.
+// {D8F579AB-402D-4b8e-82D9-5D63B1065C68}
+EXTERN_GUID(IID_IMetaDataTables, 0xd8f579ab, 0x402d, 0x4b8e, 0x82, 0xd9, 0x5d, 0x63, 0xb1, 0x6, 0x5c, 0x68);
+
+DECLARE_INTERFACE_(IMetaDataTables, IUnknown)
+{
+ STDMETHOD (GetStringHeapSize) (
+ ULONG *pcbStrings) PURE; // [OUT] Size of the string heap.
+
+ STDMETHOD (GetBlobHeapSize) (
+ ULONG *pcbBlobs) PURE; // [OUT] Size of the Blob heap.
+
+ STDMETHOD (GetGuidHeapSize) (
+ ULONG *pcbGuids) PURE; // [OUT] Size of the Guid heap.
+
+ STDMETHOD (GetUserStringHeapSize) (
+ ULONG *pcbBlobs) PURE; // [OUT] Size of the User String heap.
+
+ STDMETHOD (GetNumTables) (
+ ULONG *pcTables) PURE; // [OUT] Count of tables.
+
+ STDMETHOD (GetTableIndex) (
+ ULONG token, // [IN] Token for which to get table index.
+ ULONG *pixTbl) PURE; // [OUT] Put table index here.
+
+ STDMETHOD (GetTableInfo) (
+ ULONG ixTbl, // [IN] Which table.
+ ULONG *pcbRow, // [OUT] Size of a row, bytes.
+ ULONG *pcRows, // [OUT] Number of rows.
+ ULONG *pcCols, // [OUT] Number of columns in each row.
+ ULONG *piKey, // [OUT] Key column, or -1 if none.
+ const char **ppName) PURE; // [OUT] Name of the table.
+
+ STDMETHOD (GetColumnInfo) (
+ ULONG ixTbl, // [IN] Which Table
+ ULONG ixCol, // [IN] Which Column in the table
+ ULONG *poCol, // [OUT] Offset of the column in the row.
+ ULONG *pcbCol, // [OUT] Size of a column, bytes.
+ ULONG *pType, // [OUT] Type of the column.
+ const char **ppName) PURE; // [OUT] Name of the Column.
+
+ STDMETHOD (GetCodedTokenInfo) (
+ ULONG ixCdTkn, // [IN] Which kind of coded token.
+ ULONG *pcTokens, // [OUT] Count of tokens.
+ ULONG **ppTokens, // [OUT] List of tokens.
+ const char **ppName) PURE; // [OUT] Name of the CodedToken.
+
+ STDMETHOD (GetRow) (
+ ULONG ixTbl, // [IN] Which table.
+ ULONG rid, // [IN] Which row.
+ void **ppRow) PURE; // [OUT] Put pointer to row here.
+
+ STDMETHOD (GetColumn) (
+ ULONG ixTbl, // [IN] Which table.
+ ULONG ixCol, // [IN] Which column.
+ ULONG rid, // [IN] Which row.
+ ULONG *pVal) PURE; // [OUT] Put the column contents here.
+
+ STDMETHOD (GetString) (
+ ULONG ixString, // [IN] Value from a string column.
+ const char **ppString) PURE; // [OUT] Put a pointer to the string here.
+
+ STDMETHOD (GetBlob) (
+ ULONG ixBlob, // [IN] Value from a blob column.
+ ULONG *pcbData, // [OUT] Put size of the blob here.
+ const void **ppData) PURE; // [OUT] Put a pointer to the blob here.
+
+ STDMETHOD (GetGuid) (
+ ULONG ixGuid, // [IN] Value from a guid column.
+ const GUID **ppGUID) PURE; // [OUT] Put a pointer to the GUID here.
+
+ STDMETHOD (GetUserString) (
+ ULONG ixUserString, // [IN] Value from a UserString column.
+ ULONG *pcbData, // [OUT] Put size of the UserString here.
+ const void **ppData) PURE; // [OUT] Put a pointer to the UserString here.
+
+ STDMETHOD (GetNextString) (
+ ULONG ixString, // [IN] Value from a string column.
+ ULONG *pNext) PURE; // [OUT] Put the index of the next string here.
+
+ STDMETHOD (GetNextBlob) (
+ ULONG ixBlob, // [IN] Value from a blob column.
+ ULONG *pNext) PURE; // [OUT] Put the index of the netxt blob here.
+
+ STDMETHOD (GetNextGuid) (
+ ULONG ixGuid, // [IN] Value from a guid column.
+ ULONG *pNext) PURE; // [OUT] Put the index of the next guid here.
+
+ STDMETHOD (GetNextUserString) (
+ ULONG ixUserString, // [IN] Value from a UserString column.
+ ULONG *pNext) PURE; // [OUT] Put the index of the next user string here.
+
+ // Interface is sealed.
+
+};
+// This API isn't big endian friendly since it indexes directly into the memory that
+// is stored in little endian format.
+// {BADB5F70-58DA-43a9-A1C6-D74819F19B15}
+EXTERN_GUID(IID_IMetaDataTables2, 0xbadb5f70, 0x58da, 0x43a9, 0xa1, 0xc6, 0xd7, 0x48, 0x19, 0xf1, 0x9b, 0x15);
+
+DECLARE_INTERFACE_(IMetaDataTables2, IMetaDataTables)
+{
+ STDMETHOD (GetMetaDataStorage) ( //@todo: name?
+ const void **ppvMd, // [OUT] put pointer to MD section here (aka, 'BSJB').
+ ULONG *pcbMd) PURE; // [OUT] put size of the stream here.
+
+ STDMETHOD (GetMetaDataStreamInfo) ( // Get info about the MD stream.
+ ULONG ix, // [IN] Stream ordinal desired.
+ const char **ppchName, // [OUT] put pointer to stream name here.
+ const void **ppv, // [OUT] put pointer to MD stream here.
+ ULONG *pcb) PURE; // [OUT] put size of the stream here.
+
+}; // IMetaDataTables2
+
+#ifdef _DEFINE_META_DATA_META_CONSTANTS
+#ifndef _META_DATA_META_CONSTANTS_DEFINED
+#define _META_DATA_META_CONSTANTS_DEFINED
+const unsigned int iRidMax = 63;
+const unsigned int iCodedToken = 64; // base of coded tokens.
+const unsigned int iCodedTokenMax = 95;
+const unsigned int iSHORT = 96; // fixed types.
+const unsigned int iUSHORT = 97;
+const unsigned int iLONG = 98;
+const unsigned int iULONG = 99;
+const unsigned int iBYTE = 100;
+const unsigned int iSTRING = 101; // pool types.
+const unsigned int iGUID = 102;
+const unsigned int iBLOB = 103;
+
+inline int IsRidType(ULONG ix) { return ix <= iRidMax; }
+inline int IsCodedTokenType(ULONG ix) { return (ix >= iCodedToken) && (ix <= iCodedTokenMax); }
+inline int IsRidOrToken(ULONG ix) { return ix <= iCodedTokenMax; }
+inline int IsHeapType(ULONG ix) { return ix >= iSTRING; }
+inline int IsFixedType(ULONG ix) { return (ix < iSTRING) && (ix > iCodedTokenMax); }
+#endif
+#endif
+
+//**********************************************************************
+// End of IMetaDataTables.
+//**********************************************************************
+
+//-------------------------------------
+//--- IMetaDataInfo
+//-------------------------------------
+// {7998EA64-7F95-48B8-86FC-17CAF48BF5CB}
+EXTERN_GUID(IID_IMetaDataInfo, 0x7998EA64, 0x7F95, 0x48B8, 0x86, 0xFC, 0x17, 0xCA, 0xF4, 0x8B, 0xF5, 0xCB);
+
+//---
+#undef INTERFACE
+#define INTERFACE IMetaDataInfo
+DECLARE_INTERFACE_(IMetaDataInfo, IUnknown)
+{
+ // Return Values:
+ // S_OK - All parameters are filled.
+ // COR_E_NOTSUPPORTED - The API is not supported for this particular scope (e.g. .obj files, scope
+ // opened without whole file via code:IMetaDataDispenser::OpenScopeOnMemory, etc.).
+ // E_INVALIDARG - If NULL is passed as parameter.
+ STDMETHOD(GetFileMapping)(
+ const void ** ppvData, // [out] Pointer to the start of the mapped file.
+ ULONGLONG * pcbData, // [out] Size of the mapped memory region.
+ DWORD * pdwMappingType) PURE; // [out] Type of file mapping (code:CorFileMapping).
+}; // class IMetaDataInfo
+
+
+//-------------------------------------
+//--- IMetaDataWinMDImport
+//-------------------------------------
+// {969EA0C5-964E-411B-A807-B0F3C2DFCBD4}
+EXTERN_GUID(IID_IMetaDataWinMDImport, 0x969ea0c5, 0x964e, 0x411b, 0xa8, 0x7, 0xb0, 0xf3, 0xc2, 0xdf, 0xcb, 0xd4);
+
+//---
+#undef INTERFACE
+#define INTERFACE IMetaDataWinMDImport
+DECLARE_INTERFACE_(IMetaDataWinMDImport, IUnknown)
+{
+ STDMETHOD(GetUntransformedTypeRefProps)( // S_OK or error.
+ mdTypeRef tr, // [IN] TypeRef token.
+ mdToken *ptkResolutionScope, // [OUT] Resolution scope, ModuleRef or AssemblyRef.
+ _Out_writes_to_opt_(cchName, *pchName)
+ LPWSTR szName, // [OUT] Name of the TypeRef.
+ ULONG cchName, // [IN] Size of buffer.
+ ULONG *pchName) PURE; // [OUT] Size of Name.
+}; // class IMetaDataWinMDImport
+
+//**********************************************************************
+//
+// Predefined CustomAttribute and structures for these custom value
+//
+//**********************************************************************
+
+//
+// Native Link method custom value definitions. This is for N-direct support.
+//
+
+#define COR_NATIVE_LINK_CUSTOM_VALUE L"COMPLUS_NativeLink"
+#define COR_NATIVE_LINK_CUSTOM_VALUE_ANSI "COMPLUS_NativeLink"
+
+// count of chars for COR_NATIVE_LINK_CUSTOM_VALUE(_ANSI)
+#define COR_NATIVE_LINK_CUSTOM_VALUE_CC 18
+
+#include <pshpack1.h>
+typedef struct
+{
+ BYTE m_linkType; // see CorNativeLinkType below
+ BYTE m_flags; // see CorNativeLinkFlags below
+ mdMemberRef m_entryPoint; // member ref token giving entry point, format is lib:entrypoint
+} COR_NATIVE_LINK;
+#include <poppack.h>
+
+typedef enum
+{
+ nltNone = 1, // none of the keywords are specified
+ nltAnsi = 2, // ansi keyword specified
+ nltUnicode = 3, // unicode keyword specified
+ nltAuto = 4, // auto keyword specified
+ nltOle = 5, // ole keyword specified
+ nltMaxValue = 7, // used so we can assert how many bits are required for this enum
+} CorNativeLinkType;
+
+typedef enum
+{
+ nlfNone = 0x00, // no flags
+ nlfLastError = 0x01, // setLastError keyword specified
+ nlfNoMangle = 0x02, // nomangle keyword specified
+ nlfMaxValue = 0x03, // used so we can assert how many bits are required for this enum
+} CorNativeLinkFlags;
+
+//
+// Base class for security custom attributes.
+//
+
+#define COR_BASE_SECURITY_ATTRIBUTE_CLASS L"System.Security.Permissions.SecurityAttribute"
+#define COR_BASE_SECURITY_ATTRIBUTE_CLASS_ANSI "System.Security.Permissions.SecurityAttribute"
+
+//
+// Name of custom attribute used to indicate that per-call security checks should
+// be disabled for P/Invoke calls.
+//
+
+#define COR_SUPPRESS_UNMANAGED_CODE_CHECK_ATTRIBUTE L"System.Security.SuppressUnmanagedCodeSecurityAttribute"
+#define COR_SUPPRESS_UNMANAGED_CODE_CHECK_ATTRIBUTE_ANSI "System.Security.SuppressUnmanagedCodeSecurityAttribute"
+
+//
+// Name of custom attribute tagged on module to indicate it contains
+// unverifiable code.
+//
+
+#define COR_UNVER_CODE_ATTRIBUTE L"System.Security.UnverifiableCodeAttribute"
+#define COR_UNVER_CODE_ATTRIBUTE_ANSI "System.Security.UnverifiableCodeAttribute"
+
+//
+// Name of custom attribute indicating that a method requires a security object
+// slot on the caller's stack.
+//
+
+#define COR_REQUIRES_SECOBJ_ATTRIBUTE W("System.Security.DynamicSecurityMethodAttribute")
+#define COR_REQUIRES_SECOBJ_ATTRIBUTE_ANSI "System.Security.DynamicSecurityMethodAttribute"
+
+#define COR_COMPILERSERVICE_DISCARDABLEATTRIBUTE L"System.Runtime.CompilerServices.DiscardableAttribute"
+#define COR_COMPILERSERVICE_DISCARDABLEATTRIBUTE_ASNI "System.Runtime.CompilerServices.DiscardableAttribute"
+
+
+#ifdef __cplusplus
+}
+
+//*****************************************************************************
+//*****************************************************************************
+//
+// C O M + s i g n a t u r e s u p p o r t
+//
+//*****************************************************************************
+//*****************************************************************************
+
+#ifndef FORCEINLINE
+ #if _MSC_VER < 1200
+ #define FORCEINLINE inline
+ #else
+ #define FORCEINLINE __forceinline
+ #endif
+#endif
+
+
+// We need a version that is FORCEINLINE on retail and NOINLINE on debug
+
+#ifndef DEBUG_NOINLINE
+#if defined(_DEBUG)
+#define DEBUG_NOINLINE __declspec(noinline)
+#else
+#define DEBUG_NOINLINE
+#endif
+#endif
+
+#ifndef DBG_NOINLINE_X86__RET_INLINE
+#if defined(_DEBUG) && defined(_X86_)
+#define DBG_NOINLINE_X86__RET_INLINE __declspec(noinline)
+#else
+#define DBG_NOINLINE_X86__RET_INLINE FORCEINLINE
+#endif
+#endif
+
+#ifndef NOINLINE
+#ifdef _MSC_VER
+#define NOINLINE __declspec(noinline)
+#elif defined __GNUC__
+#define NOINLINE __attribute__ ((noinline))
+#else
+#define NOINLINE
+#endif
+#endif // !NOINLINE
+
+// return true if it is a primitive type, i.e. only need to store CorElementType
+FORCEINLINE int CorIsPrimitiveType(CorElementType elementtype)
+{
+ return (elementtype < ELEMENT_TYPE_PTR || elementtype == ELEMENT_TYPE_I || elementtype == ELEMENT_TYPE_U);
+}
+
+
+// Return true if element type is a modifier, i.e. ELEMENT_TYPE_MODIFIER bits are
+// turned on. For now, it is checking for ELEMENT_TYPE_PTR and ELEMENT_TYPE_BYREF
+// as well. This will be removed when we turn on ELEMENT_TYPE_MODIFIER bits for
+// these two enum members.
+//
+FORCEINLINE int CorIsModifierElementType(CorElementType elementtype)
+{
+ if (elementtype == ELEMENT_TYPE_PTR || elementtype == ELEMENT_TYPE_BYREF)
+ return 1;
+ return (elementtype & ELEMENT_TYPE_MODIFIER);
+}
+
+// Given a compress byte (*pData), return the size of the uncompressed data.
+inline ULONG CorSigUncompressedDataSize(
+ PCCOR_SIGNATURE pData)
+{
+ if ((*pData & 0x80) == 0)
+ return 1;
+ else if ((*pData & 0xC0) == 0x80)
+ return 2;
+ else
+ return 4;
+}
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+//
+// Given a compressed integer(*pData), expand the compressed int to *pDataOut.
+// Return value is the number of bytes that the integer occupies in the compressed format
+// It is caller's responsibility to ensure pDataOut has at least 4 bytes to be written to.
+//
+// This function returns -1 if pass in with an incorrectly compressed data, such as
+// (*pBytes & 0xE0) == 0XE0.
+/////////////////////////////////////////////////////////////////////////////////////////////
+inline ULONG CorSigUncompressBigData(
+ PCCOR_SIGNATURE & pData) // [IN,OUT] compressed data
+{
+ ULONG res;
+
+ // 1 byte data is handled in CorSigUncompressData
+ // _ASSERTE(*pData & 0x80);
+
+ // Medium.
+ if ((*pData & 0xC0) == 0x80) // 10?? ????
+ {
+ res = (ULONG)((*pData++ & 0x3f) << 8);
+ res |= *pData++;
+ }
+ else // 110? ????
+ {
+ res = (*pData++ & 0x1f) << 24;
+ res |= *pData++ << 16;
+ res |= *pData++ << 8;
+ res |= *pData++;
+ }
+ return res;
+}
+FORCEINLINE ULONG CorSigUncompressData(
+ PCCOR_SIGNATURE & pData) // [IN,OUT] compressed data
+{
+ // Handle smallest data inline.
+ if ((*pData & 0x80) == 0x00) // 0??? ????
+ return *pData++;
+ return CorSigUncompressBigData(pData);
+}
+
+inline HRESULT CorSigUncompressData(// return S_OK or E_BADIMAGEFORMAT if the signature is bad
+ PCCOR_SIGNATURE pData, // [IN] compressed data
+ DWORD len, // [IN] length of the signature
+ ULONG * pDataOut, // [OUT] the expanded *pData
+ ULONG * pDataLen) // [OUT] length of the expanded *pData
+{
+ HRESULT hr = S_OK;
+ BYTE const *pBytes = reinterpret_cast<BYTE const*>(pData);
+
+ // Smallest.
+ if ((*pBytes & 0x80) == 0x00) // 0??? ????
+ {
+ if (len < 1)
+ {
+ *pDataOut = 0;
+ *pDataLen = 0;
+ hr = META_E_BAD_SIGNATURE;
+ }
+ else
+ {
+ *pDataOut = *pBytes;
+ *pDataLen = 1;
+ }
+ }
+ // Medium.
+ else if ((*pBytes & 0xC0) == 0x80) // 10?? ????
+ {
+ if (len < 2)
+ {
+ *pDataOut = 0;
+ *pDataLen = 0;
+ hr = META_E_BAD_SIGNATURE;
+ }
+ else
+ {
+ *pDataOut = (ULONG)(((*pBytes & 0x3f) << 8 | *(pBytes+1)));
+ *pDataLen = 2;
+ }
+ }
+ else if ((*pBytes & 0xE0) == 0xC0) // 110? ????
+ {
+ if (len < 4)
+ {
+ *pDataOut = 0;
+ *pDataLen = 0;
+ hr = META_E_BAD_SIGNATURE;
+ }
+ else
+ {
+ *pDataOut = (ULONG)(((*pBytes & 0x1f) << 24 | *(pBytes+1) << 16 | *(pBytes+2) << 8 | *(pBytes+3)));
+ *pDataLen = 4;
+ }
+ }
+ else // We don't recognize this encoding
+ {
+ *pDataOut = 0;
+ *pDataLen = 0;
+ hr = META_E_BAD_SIGNATURE;
+ }
+
+ return hr;
+}
+
+inline ULONG CorSigUncompressData( // return number of bytes of that compressed data occupied in pData
+ PCCOR_SIGNATURE pData, // [IN] compressed data
+ ULONG *pDataOut) // [OUT] the expanded *pData
+{
+ ULONG dwSizeOfData = 0;
+
+ // We don't know how big the signature is, so we'll just say that it's big enough
+ if (FAILED(CorSigUncompressData(pData, 0xff, pDataOut, &dwSizeOfData)))
+ {
+ *pDataOut = 0;
+ return (ULONG)-1;
+ }
+
+ return dwSizeOfData;
+}
+
+
+#if !defined(SELECTANY)
+ #define SELECTANY extern __declspec(selectany)
+#endif
+
+SELECTANY const mdToken g_tkCorEncodeToken[4] ={mdtTypeDef, mdtTypeRef, mdtTypeSpec, mdtBaseType};
+
+// uncompress a token
+inline mdToken CorSigUncompressToken( // return the token.
+ PCCOR_SIGNATURE &pData) // [IN,OUT] compressed data
+{
+ mdToken tk;
+ mdToken tkType;
+
+ tk = CorSigUncompressData(pData);
+ tkType = g_tkCorEncodeToken[tk & 0x3];
+ tk = TokenFromRid(tk >> 2, tkType);
+ return tk;
+}
+
+
+inline ULONG CorSigUncompressToken( // return number of bytes of that compressed data occupied in pData
+ PCCOR_SIGNATURE pData, // [IN] compressed data
+ mdToken * pToken) // [OUT] the expanded *pData
+{
+ ULONG cb;
+ mdToken tk;
+ mdToken tkType;
+
+ cb = CorSigUncompressData(pData, (ULONG *)&tk);
+ tkType = g_tkCorEncodeToken[tk & 0x3];
+ tk = TokenFromRid(tk >> 2, tkType);
+ *pToken = tk;
+ return cb;
+}
+
+inline HRESULT CorSigUncompressToken(
+ PCCOR_SIGNATURE pData, // [IN] compressed data
+ DWORD dwLen, // [IN] Remaining length of sigature
+ mdToken * pToken, // [OUT] the expanded *pData
+ DWORD * dwTokenLength) // [OUT] The length of the token in the sigature
+{
+ mdToken tk;
+ mdToken tkType;
+
+ HRESULT hr = CorSigUncompressData(pData, dwLen, (ULONG *)&tk, dwTokenLength);
+
+ if (SUCCEEDED(hr))
+ {
+ tkType = g_tkCorEncodeToken[tk & 0x3];
+ tk = TokenFromRid(tk >> 2, tkType);
+ *pToken = tk;
+ }
+ else
+ {
+ *pToken = mdTokenNil;
+ }
+ return hr;
+}
+
+
+
+FORCEINLINE ULONG CorSigUncompressCallingConv(
+ PCCOR_SIGNATURE & pData) // [IN,OUT] Compressed data
+{
+ return *pData++;
+}
+
+FORCEINLINE HRESULT CorSigUncompressCallingConv(
+ PCCOR_SIGNATURE pData, // [IN] Signature
+ DWORD dwLen, // [IN] Length of signature
+ ULONG * data) // [OUT] Compressed data
+{
+ if (dwLen > 0)
+ {
+ *data = *pData;
+ return S_OK;
+ }
+ else
+ {
+ *data = 0;
+ return META_E_BAD_SIGNATURE;
+ }
+}
+
+
+enum {
+ SIGN_MASK_ONEBYTE = 0xffffffc0, // Mask the same size as the missing bits.
+ SIGN_MASK_TWOBYTE = 0xffffe000, // Mask the same size as the missing bits.
+ SIGN_MASK_FOURBYTE = 0xf0000000, // Mask the same size as the missing bits.
+};
+
+// uncompress a signed integer
+inline ULONG CorSigUncompressSignedInt( // return number of bytes of that compressed data occupied in pData
+ PCCOR_SIGNATURE pData, // [IN] compressed data
+ int * pInt) // [OUT] the expanded *pInt
+{
+ ULONG cb;
+ ULONG ulSigned;
+ ULONG iData;
+
+ cb = CorSigUncompressData(pData, &iData);
+ if (cb == (ULONG) -1) return cb;
+ ulSigned = iData & 0x1;
+ iData = iData >> 1;
+ if (ulSigned)
+ {
+ if (cb == 1)
+ {
+ iData |= SIGN_MASK_ONEBYTE;
+ }
+ else if (cb == 2)
+ {
+ iData |= SIGN_MASK_TWOBYTE;
+ }
+ else
+ {
+ iData |= SIGN_MASK_FOURBYTE;
+ }
+ }
+ *pInt = (int)iData;
+ return cb;
+}
+
+
+// uncompress encoded element type
+FORCEINLINE CorElementType CorSigUncompressElementType( // Element type
+ PCCOR_SIGNATURE & pData) // [IN,OUT] Compressed data
+{
+ return (CorElementType)*pData++;
+}
+
+inline ULONG CorSigUncompressElementType( // Return number of bytes of that compressed data occupied in pData
+ PCCOR_SIGNATURE pData, // [IN] Compressed data
+ CorElementType * pElementType) // [OUT] The expanded *pData
+{
+ *pElementType = (CorElementType)(*pData & 0x7f);
+ return 1;
+}
+
+
+/////////////////////////////////////////////////////////////////////////////////////////////
+//
+// Given an uncompressed unsigned integer (iLen), Store it to pDataOut in a compressed format.
+// Return value is the number of bytes that the integer occupies in the compressed format.
+// It is caller's responsibilityt to ensure *pDataOut has at least 4 bytes to write to.
+//
+// Note that this function returns -1 if iLen is too big to be compressed. We currently can
+// only represent to 0x1FFFFFFF.
+//
+/////////////////////////////////////////////////////////////////////////////////////////////
+inline ULONG CorSigCompressData( // return number of bytes that compressed form of iLen will take
+ ULONG iLen, // [IN] given uncompressed data
+ void * pDataOut) // [OUT] buffer where iLen will be compressed and stored.
+{
+ BYTE *pBytes = reinterpret_cast<BYTE *>(pDataOut);
+
+ if (iLen <= 0x7F)
+ {
+ *pBytes = BYTE(iLen);
+ return 1;
+ }
+
+ if (iLen <= 0x3FFF)
+ {
+ *pBytes = BYTE((iLen >> 8) | 0x80);
+ *(pBytes+1) = BYTE(iLen & 0xff);
+ return 2;
+ }
+
+ if (iLen <= 0x1FFFFFFF)
+ {
+ *pBytes = BYTE((iLen >> 24) | 0xC0);
+ *(pBytes+1) = BYTE((iLen >> 16) & 0xff);
+ *(pBytes+2) = BYTE((iLen >> 8) & 0xff);
+ *(pBytes+3) = BYTE(iLen & 0xff);
+ return 4;
+ }
+ return (ULONG) -1;
+}
+
+// compress a token
+// The least significant bit of the first compress byte will indicate the token type.
+//
+inline ULONG CorSigCompressToken( // return number of bytes that compressed form of the token will take
+ mdToken tk, // [IN] given token
+ void * pDataOut) // [OUT] buffer where the token will be compressed and stored.
+{
+ RID rid = RidFromToken(tk);
+ ULONG32 ulTyp = TypeFromToken(tk);
+
+ if (rid > 0x3FFFFFF)
+ // token is too big to be compressed
+ return (ULONG) -1;
+
+ rid = (rid << 2);
+
+ // TypeDef is encoded with low bits 00
+ // TypeRef is encoded with low bits 01
+ // TypeSpec is encoded with low bits 10
+ // BaseType is encoded with low bit 11
+ //
+ if (ulTyp == g_tkCorEncodeToken[1])
+ {
+ // make the last two bits 01
+ rid |= 0x1;
+ }
+ else if (ulTyp == g_tkCorEncodeToken[2])
+ {
+ // make last two bits 0
+ rid |= 0x2;
+ }
+ else if (ulTyp == g_tkCorEncodeToken[3])
+ {
+ rid |= 0x3;
+ }
+ return CorSigCompressData((ULONG)rid, pDataOut);
+}
+
+// compress a signed integer
+// The least significant bit of the first compress byte will be the signed bit.
+//
+inline ULONG CorSigCompressSignedInt( // return number of bytes that compressed form of iData will take
+ int iData, // [IN] given integer
+ void * pDataOut) // [OUT] buffer where iLen will be compressed and stored.
+{
+ ULONG isSigned = 0;
+ BYTE *pBytes = reinterpret_cast<BYTE *>(pDataOut);
+
+ if (iData < 0)
+ isSigned = 0x1;
+
+ // Note that we cannot use code:CorSigCompressData to pack the iData value, because of negative values
+ // like: 0xffffe000 (-8192) which has to be encoded as 1 in 2 bytes, i.e. 0x81 0x00
+ // However CorSigCompressedData would store value 1 as 1 byte: 0x01
+ if ((iData & SIGN_MASK_ONEBYTE) == 0 || (iData & SIGN_MASK_ONEBYTE) == SIGN_MASK_ONEBYTE)
+ {
+ iData = (int)((iData & ~SIGN_MASK_ONEBYTE) << 1 | isSigned);
+ //_ASSERTE(iData <= 0x7f);
+ *pBytes = BYTE(iData);
+ return 1;
+ }
+ else if ((iData & SIGN_MASK_TWOBYTE) == 0 || (iData & SIGN_MASK_TWOBYTE) == SIGN_MASK_TWOBYTE)
+ {
+ iData = (int)((iData & ~SIGN_MASK_TWOBYTE) << 1 | isSigned);
+ //_ASSERTE(iData <= 0x3fff);
+ *pBytes = BYTE((iData >> 8) | 0x80);
+ *(pBytes + 1) = BYTE(iData & 0xff);
+ return 2;
+ }
+ else if ((iData & SIGN_MASK_FOURBYTE) == 0 || (iData & SIGN_MASK_FOURBYTE) == SIGN_MASK_FOURBYTE)
+ {
+ iData = (int)((iData & ~SIGN_MASK_FOURBYTE) << 1 | isSigned);
+ //_ASSERTE(iData <= 0x1FFFFFFF);
+ *pBytes = BYTE((iData >> 24) | 0xC0);
+ *(pBytes + 1) = BYTE((iData >> 16) & 0xff);
+ *(pBytes + 2) = BYTE((iData >> 8) & 0xff);
+ *(pBytes + 3) = BYTE(iData & 0xff);
+ return 4;
+ }
+ // Out of compressable range
+ return (ULONG)-1;
+} // CorSigCompressSignedInt
+
+
+// uncompress encoded element type
+inline ULONG CorSigCompressElementType( // return number of bytes of that compressed data occupied in pData
+ CorElementType et, // [OUT] the expanded *pData
+ void * pData) // [IN] compressed data
+{
+ BYTE *pBytes = (BYTE *)(pData);
+
+ *pBytes = BYTE(et);
+ return 1;
+}
+
+// Compress a pointer (used for internal element types only, never for persisted
+// signatures).
+inline ULONG CorSigCompressPointer( // return number of bytes of that compressed data occupied
+ void * pvPointer, // [IN] given uncompressed data
+ void * pData) // [OUT] buffer where iLen will be compressed and stored.
+{
+ *((void * UNALIGNED *)pData) = pvPointer;
+ return sizeof(void *);
+}
+
+// Uncompress a pointer (see above for comments).
+inline ULONG CorSigUncompressPointer( // return number of bytes of that compressed data occupied
+ PCCOR_SIGNATURE pData, // [IN] compressed data
+ void ** ppvPointer) // [OUT] the expanded *pData
+{
+ *ppvPointer = *(void * const UNALIGNED *)pData;
+ return sizeof(void *);
+}
+
+#endif // __cplusplus
+
+#undef DEPRECATED_CLR_STDAPI_
+#undef DEPRECATED_CLR_STDAPI
+#undef DECLARE_DEPRECATED
+#undef DEPRECATED_CLR_API_MESG
+
+#endif // _COR_H_
+// EOF =======================================================================
diff --git a/src/inc/corbbtprof.h b/src/inc/corbbtprof.h
new file mode 100644
index 0000000000..2f69dcccc8
--- /dev/null
+++ b/src/inc/corbbtprof.h
@@ -0,0 +1,589 @@
+// 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.
+
+/*****************************************************************************\
+* *
+* CorBBTProf.h - File format for profile data *
+* *
+* Version 1.0 *
+*******************************************************************************
+* *
+* THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY *
+* KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE *
+* IMPLIED WARRANTIES OF MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR *
+* PURPOSE. *
+* *
+\*****************************************************************************/
+
+#ifndef _COR_BBTPROF_H_
+#define _COR_BBTPROF_H_
+
+#include <cor.h>
+#include <corinfo.h>
+
+const CorTokenType ibcExternalNamespace = CorTokenType(0x61000000);
+const CorTokenType ibcExternalType = CorTokenType(0x62000000);
+const CorTokenType ibcExternalSignature = CorTokenType(0x63000000);
+const CorTokenType ibcExternalMethod = CorTokenType(0x64000000);
+const CorTokenType ibcTypeSpec = CorTokenType(0x68000000);
+const CorTokenType ibcMethodSpec = CorTokenType(0x69000000);
+
+typedef mdToken idExternalNamespace; // External Namespace token in the IBC data
+typedef mdToken idExternalType; // External Type token in the IBC data
+typedef mdToken idExternalSignature; // External Signature token in the IBC data
+typedef mdToken idExternalMethod; // External Method token in the IBC data
+typedef mdToken idTypeSpec; // TypeSpec token in the IBC data
+typedef mdToken idMethodSpec; // MethodSpec token in the IBC data
+
+#define idExternalNamespaceNil ((idExternalNamespace) ibcExternalNamespace)
+#define idExternalTypeNil ((idExternalType) ibcExternalType)
+#define idExternalSignatureNil ((idExternalSignature) ibcExternalSignature)
+#define idExternalMethodNil ((idExternalMethod) ibcExternalMethod)
+#define idTypeSpecNil ((idTypeSpec) ibcTypeSpec)
+#define idMethodSpecNil ((idMethodSpec) ibcMethodSpec)
+
+//
+// File format:
+//
+// CORBBTPROF_FILE_HEADER
+// CORBBTPROF_SECTION_TABLE_HEADER
+// CORBBTPROF_SECTION_TABLE_ENTRY
+// ... (can be multiple entries)
+//
+// Method block counts section:
+// CORBBTPROF_METHOD_BLOCK_COUNTS_SECTION_HEADER
+// CORBBTPROF_METHOD_HEADER
+// CORBBTPROF_BLOCK_DATA
+// ... (can be multiple method header/block data entries)
+//
+// Method load order section:
+// CORBBTPROF_TOKEN_LIST_SECTION_HEADER
+// ... (list of tokens)
+//
+// Type token usage information
+// CORBBTPROF_TOKEN_LIST_SECTION_HEADER
+// ... (list of tokens)
+//
+
+// MethodDef token usage information
+// CORBBTPROF_TOKEN_LIST_SECTION_HEADER
+// ... (list of tokens)
+//
+
+// RIDs to not use slim headers section
+// CORBBTPROF_TOKEN_LIST_SECTION_HEADER
+// ... (list of tokens)
+//
+
+// Metadata hints to re-order some tables
+// Instantiated TypeSPecs to re-order EEClasses
+//
+// The header for the profile data file.
+// ... (list of CORBBTPROF_BLOB_ENTRY)
+// terminated by null
+
+struct CORBBTPROF_FILE_HEADER
+{
+ DWORD HeaderSize;
+ DWORD Magic;
+ DWORD Version;
+ GUID MVID;
+};
+
+// Optional in V1 and V2. Usually present in V2. Must be present in V3.
+struct CORBBTPROF_FILE_OPTIONAL_HEADER
+{
+ DWORD Size; // Including the size field
+ DWORD MinorVersion;
+ DWORD FileFlags; // Only in V3 or later
+ // future fields
+};
+
+enum CORBBTPROF_FILE_FLAGS
+{
+ CORBBTPROF_FILE_FLAG_MINIFIED = 1,
+ CORBBTPROF_FILE_FLAG_PARTIAL_NGEN = 2
+};
+
+enum
+{
+ CORBBTPROF_V0_VERSION = 0,
+ CORBBTPROF_V1_VERSION = 1,
+ CORBBTPROF_V2_VERSION = 2,
+ CORBBTPROF_V3_VERSION = 3,
+ CORBBTPROF_CURRENT_VERSION = CORBBTPROF_V2_VERSION, // V3 is opt-in
+ CORBBTPROF_MAGIC = 0xb1d0f11e,
+ CORBBTPROF_END_TOKEN = 0xb4356f98
+};
+
+//
+// The profile data can be mapped anywhere in memory. So instead of using pointers,
+// to denote sections, we will instead use offsets from the beginning of the file.
+//
+
+struct Section
+{
+ DWORD Offset;
+ DWORD Size;
+};
+
+//
+// Section types, where various sections contains different types of profile data.
+//
+
+#define CORBBTPROF_TOKEN_MAX_NUM_FLAGS 32
+
+enum TypeProfilingDataFlags
+{
+ // Important: update toolbox\ibcmerge\ibcmerge.cs if you change these
+ ReadMethodTable = 0, // 0x00001
+ ReadEEClass = 1, // 0x00002
+ WriteEEClass = 2, // 0x00004
+// ReadStoredEnumData = 3, // 0x00008
+ ReadFieldDescs = 4, // 0x00010
+ ReadCCtorInfo = 5, // 0x00020
+ ReadClassHashTable = 6, // 0x00040
+ ReadDispatchMap = 7, // 0x00080
+ ReadDispatchTable = 8, // 0x00100
+ ReadMethodTableWriteableData = 9, // 0x00200
+ ReadFieldMarshalers = 10, // 0x00400
+// Unused = 11, // 0x00800 ... Was WriteDispatchTable in the past
+// WriteMethodTable = 12, // 0x01000
+ WriteMethodTableWriteableData = 13, // 0x02000
+ ReadTypeDesc = 14, // 0x04000
+ WriteTypeDesc = 15, // 0x08000
+ ReadTypeHashTable = 16, // 0x10000
+// WriteTypeHashTable = 17, // 0x20000
+// ReadDictionary = 18, // 0x40000
+// WriteDictionary = 19, // 0x80000
+ ReadNonVirtualSlots = 20, // 0x100000
+};
+
+enum MethodProfilingDataFlags
+{
+ // Important: update toolbox\ibcmerge\ibcmerge.cs if you change these
+ ReadMethodCode = 0, // 0x00001
+ ReadMethodDesc = 1, // 0x00002
+ RunOnceMethod = 2, // 0x00004 // was CommonMethod
+ RunNeverMethod = 3, // 0x00008 // was MethodMetadataAccess
+// MethodStoredDataAccess = 4, // 0x00010
+ WriteMethodDesc = 5, // 0x00020
+// ReadFCallHash = 6, // 0x00040
+ ReadGCInfo = 7, // 0x00080
+ CommonReadGCInfo = 8, // 0x00100
+// ReadMethodDefRidMap = 9, // 0x00200
+ ReadCerMethodList = 10, // 0x00400
+ ReadMethodPrecode = 11, // 0x00800
+ WriteMethodPrecode = 12, // 0x01000
+};
+
+enum GeneralProfilingDataFlags
+{
+ // Important: update ibcmerge.cs if you change these
+ // ZapImage.h depends on 0xFFFFFFFF being an invalid flag value. If this
+ // changes, update ReadFlagWithMemory in that file.
+ // Important: make sure these don't collide with TypeProfilingDataFlags or MethodProfilingDataFlags
+ // These grow downward from CORBBTPROF_TOKEN_MAX_NUM_FLAGS-1 to minimize the chance of collision
+ ProfilingFlags_MetaData = 31, // 0x800...
+ CommonMetaData = 30, // 0x400...
+ RidMap = 29, // 0x200...
+ RVAFieldData = 28, // 0x100...
+ ProfilingFlags_MetaDataSearch = 27, // 0x080...
+};
+
+enum BlobType
+{
+ /* IMPORTANT: Keep the first four enums together in the same order and at
+ the very begining of this enum. See MetaModelPub.h for the order */
+ MetadataStringPool = 0,
+ MetadataGuidPool = 1,
+ MetadataBlobPool = 2,
+ MetadataUserStringPool = 3,
+
+ FirstMetadataPool = 0,
+ LastMetadataPool = 3,
+
+ // SectionFormat only supports tokens, which have to already exist in the module.
+ // For instantiated paramterized types, there may be no corresponding token
+ // in the module, if a dependent module caused the type to be instantiated.
+ // For such instantiated types, we save a blob/signature to identify the type.
+ //
+ ParamTypeSpec = 4, // Instantiated Type Signature
+ ParamMethodSpec = 5, // Instantiated Method Signature
+ ExternalNamespaceDef = 6, // External Namespace Token Definition
+ ExternalTypeDef = 7, // External Type Token Definition
+ ExternalSignatureDef = 8, // External Signature Definition
+ ExternalMethodDef = 9, // External Method Token Definition
+
+ IllegalBlob = 10, // Failed to allocate the blob
+
+ EndOfBlobStream = -1
+};
+
+enum SectionFormat
+{
+ // Important: update ibcmerge.cs if you change these
+ ScenarioInfo = 0,
+ MethodBlockCounts = 1, // Basic-block counts. Cold blocks will be placed in the cold-code section
+ BlobStream = 2, // metadata access, inst-type-spec and inst-method-spec blobs
+
+ FirstTokenFlagSection = 3,
+
+ ModuleProfilingData = FirstTokenFlagSection + (mdtModule >> 24),
+ TypeRefProfilingData = FirstTokenFlagSection + (mdtTypeRef >> 24),
+ TypeProfilingData = FirstTokenFlagSection + (mdtTypeDef >> 24),
+ FieldDefProfilingData = FirstTokenFlagSection + (mdtFieldDef >> 24),
+ MethodProfilingData = FirstTokenFlagSection + (mdtMethodDef >> 24),
+ ParamDefProfilingData = FirstTokenFlagSection + (mdtParamDef >> 24),
+ InterfaceImplProfilingData = FirstTokenFlagSection + (mdtInterfaceImpl >> 24),
+ MemberRefProfilingData = FirstTokenFlagSection + (mdtMemberRef >> 24),
+ CustomAttributeProfilingData = FirstTokenFlagSection + (mdtCustomAttribute >> 24),
+ PermissionProfilingData = FirstTokenFlagSection + (mdtPermission >> 24),
+ SignatureProfilingData = FirstTokenFlagSection + (mdtSignature >> 24),
+ EventProfilingData = FirstTokenFlagSection + (mdtEvent >> 24),
+ PropertyProfilingData = FirstTokenFlagSection + (mdtProperty >> 24),
+ ModuleRefProfilingData = FirstTokenFlagSection + (mdtModuleRef >> 24),
+ TypeSpecProfilingData = FirstTokenFlagSection + (mdtTypeSpec >> 24),
+ AssemblyProfilingData = FirstTokenFlagSection + (mdtAssembly >> 24),
+ AssemblyRefProfilingData = FirstTokenFlagSection + (mdtAssemblyRef >> 24),
+ FileProfilingData = FirstTokenFlagSection + (mdtFile >> 24),
+ ExportedTypeProfilingData = FirstTokenFlagSection + (mdtExportedType >> 24),
+ ManifestResourceProfilingData = FirstTokenFlagSection + (mdtManifestResource >> 24),
+ GenericParamProfilingData = FirstTokenFlagSection + (mdtGenericParam >> 24),
+ MethodSpecProfilingData = FirstTokenFlagSection + (mdtMethodSpec >> 24),
+ GenericParamConstraintProfilingData = FirstTokenFlagSection + (mdtGenericParamConstraint >> 24),
+
+ StringPoolProfilingData,
+ GuidPoolProfilingData,
+ BlobPoolProfilingData,
+ UserStringPoolProfilingData,
+
+ FirstMetadataPoolSection = StringPoolProfilingData,
+ LastMetadataPoolSection = UserStringPoolProfilingData,
+ LastTokenFlagSection = LastMetadataPoolSection,
+
+ IbcTypeSpecSection,
+ IbcMethodSpecSection,
+
+ GenericTypeProfilingData = 63, // Deprecated with V2 IBC data
+ SectionFormatCount = 64, // 0x40
+
+ SectionFormatInvalid = -1
+};
+
+struct CORBBTPROF_SECTION_TABLE_ENTRY
+{
+ SectionFormat FormatID;
+ Section Data;
+};
+
+struct CORBBTPROF_SECTION_TABLE_HEADER
+{
+ DWORD NumEntries;
+ CORBBTPROF_SECTION_TABLE_ENTRY Entries[0];
+};
+
+//
+// ScenarioInfo section
+//
+
+struct CORBBTPROF_SCENARIO_RUN
+{
+ FILETIME runTime; // the FILETIME when the scenario was cnt
+ GUID mvid; // The GUID of this assembly when the scenario was run (useful for incremental ibcdata)
+ DWORD cCmdLine; // the count of WCHAR's in the cmdLine for this run of the scenario
+ DWORD cSystemInfo; // the count of WCHAR's in the systemInfo string for this run of the scenario
+ WCHAR cmdLine[0]; // the command line used, the array is 'cName' in length
+// WCHAR systemInfo[]; // the system information, the array is 'cSystemInfo' in length
+
+ DWORD sizeofCmdLine()
+ {
+ return (cCmdLine * (DWORD)sizeof(WCHAR));
+ }
+
+ DWORD sizeofSystemInfo()
+ {
+ return (cSystemInfo * (DWORD)sizeof(WCHAR));
+ }
+
+ DWORD Size()
+ {
+ return (DWORD)sizeof(CORBBTPROF_SCENARIO_RUN) + sizeofCmdLine() + sizeofSystemInfo();
+ }
+
+ CORBBTPROF_SCENARIO_RUN* GetNextRun()
+ {
+ return reinterpret_cast< CORBBTPROF_SCENARIO_RUN* >(
+ reinterpret_cast< PBYTE >( this + 1 ) + Size() );
+ }
+};
+
+struct CORBBTPROF_SCENARIO_INFO
+{
+ DWORD ordinal; // the id number for this scenario
+ DWORD mask; // the one-bit mask use to identify this scenario
+ DWORD priority; // the priority of this scenario
+ DWORD numRuns; // the number of times this scenario was run
+ DWORD cName; // the count of WCHAR's in name[]
+ WCHAR name[0]; // the name of this scenario, the array is 'cName' in length
+// CORBBTPROF_SCENARIO_RUN run[]; // the array is 'numRuns' in length
+
+ DWORD sizeofName()
+ {
+ return (DWORD) (cName * sizeof(WCHAR));
+ }
+
+ DWORD Size()
+ {
+ return (DWORD) sizeof(CORBBTPROF_SCENARIO_INFO) + sizeofName() + sizeofRuns();
+ }
+
+ CORBBTPROF_SCENARIO_RUN* GetScenarioRun()
+ {
+ return reinterpret_cast< CORBBTPROF_SCENARIO_RUN* >(
+ reinterpret_cast< PBYTE >( this ) + (DWORD)sizeof(CORBBTPROF_SCENARIO_INFO) + sizeofName());
+ }
+
+ DWORD sizeofRuns()
+ {
+ DWORD sum = 0;
+ if (numRuns > 0)
+ {
+ DWORD cnt = 1;
+ CORBBTPROF_SCENARIO_RUN* pRun = GetScenarioRun();
+ do
+ {
+ sum += pRun->Size();
+ if (cnt == numRuns)
+ break;
+ cnt++;
+ pRun = pRun->GetNextRun();
+ }
+ while (true);
+ }
+ return sum;
+ }
+};
+
+struct CORBBTPROF_SCENARIO_HEADER
+{
+ DWORD size; // Size to skip to get to the next CORBBTPROF_SCENARIO_HEADER
+ CORBBTPROF_SCENARIO_INFO scenario;
+
+ DWORD Size()
+ {
+ return (DWORD) sizeof(CORBBTPROF_SCENARIO_HEADER) + scenario.sizeofName() + scenario.sizeofRuns();
+ }
+};
+
+struct CORBBTPROF_SCENARIO_INFO_SECTION_HEADER
+{
+ DWORD TotalNumRuns;
+ DWORD NumScenarios;
+// CORBBTPROF_SCENARIO_HEADER scenario[0]; // array is 'NumScenarios' in length
+};
+
+//
+// MethodBlockCounts section
+//
+
+struct CORBBTPROF_METHOD_BLOCK_COUNTS_SECTION_HEADER_V1
+{
+ DWORD NumMethods;
+ DWORD NumRuns;
+};
+
+struct CORBBTPROF_METHOD_BLOCK_COUNTS_SECTION_HEADER
+{
+ DWORD NumMethods;
+};
+
+struct CORBBTPROF_BLOCK_DATA // Also defined here code:ICorJitInfo.ProfileBuffer
+{
+ DWORD ILOffset;
+ DWORD ExecutionCount;
+};
+
+struct CORBBTPROF_METHOD_DETAIL_HEADER
+{
+ DWORD size; // Size to skip to get to the next CORBBTPROF_METHOD_DETAIL_HEADER at this level
+ DWORD kind; // Identifier that specifies what kind this CORBBTPROF_METHOD_DETAIL_HEADER actually represents
+
+ size_t Size()
+ {
+ return size;
+ }
+};
+
+//
+// This struct records the basic block execution counts for a method
+//
+struct CORBBTPROF_METHOD_INFO
+{
+ DWORD token; // token for this method
+ DWORD ILSize; // IL size for this method
+ DWORD cBlock; // count for block[]
+ CORBBTPROF_BLOCK_DATA block[0]; // actually 'cBlock' in length
+
+ size_t Size()
+ {
+ return sizeof(CORBBTPROF_METHOD_INFO) + sizeofBlock();
+ }
+
+ size_t sizeofBlock()
+ {
+ return cBlock * sizeof(CORBBTPROF_BLOCK_DATA);
+ }
+};
+
+struct CORBBTPROF_METHOD_HEADER_V1
+{
+ DWORD HeaderSize;
+ mdToken MethodToken;
+ DWORD Size;
+};
+
+struct CORBBTPROF_METHOD_HEADER
+{
+ DWORD size; // Size to skip to get to the next CORBBTPROF_METHOD_HEADER
+ DWORD cDetail; // the count of CORBBTPROF_METHOD_DETAIL_HEADER records that folow this record
+ CORBBTPROF_METHOD_INFO method; // Basic block execution counts for a method
+ // ... followed by 'cDetail' occurances of CORBBTPROF_METHOD_DETAIL_HEADER
+
+ size_t Size()
+ {
+ return sizeof(CORBBTPROF_METHOD_HEADER) + method.sizeofBlock();
+ }
+};
+
+
+struct CORBBTPROF_TOKEN_LIST_SECTION_HEADER
+{
+ DWORD NumTokens;
+};
+
+struct CORBBTPROF_TOKEN_LIST_ENTRY_V1
+{
+ mdToken token;
+ DWORD flags;
+};
+
+struct CORBBTPROF_TOKEN_INFO // Was CORBBTPROF_TOKEN_LIST_ENTRY
+{
+ mdToken token;
+ DWORD flags;
+ DWORD scenarios; // Could use UINT64 instead
+
+ CORBBTPROF_TOKEN_INFO()
+ : token(0)
+ , flags(0)
+ , scenarios(0)
+ {}
+
+ CORBBTPROF_TOKEN_INFO( mdToken t, DWORD f = 0, DWORD s = 0)
+ : token(t)
+ , flags(f)
+ , scenarios(s)
+ {}
+
+ CORBBTPROF_TOKEN_INFO( CORBBTPROF_TOKEN_INFO const & right )
+ : token(right.token)
+ , flags(right.flags)
+ , scenarios(right.scenarios)
+ {}
+
+ CORBBTPROF_TOKEN_INFO operator=( CORBBTPROF_TOKEN_INFO const & right )
+ {
+ token = right.token;
+ flags = right.flags;
+ scenarios = right.scenarios;
+ return *this;
+ }
+
+ bool operator<( CORBBTPROF_TOKEN_INFO const & right ) const
+ {
+ return token < right.token;
+ }
+};
+
+struct CORBBTPROF_BLOB_ENTRY_V1
+{
+ BlobType blobType;
+ DWORD flags;
+ DWORD cBuffer;
+ BYTE pBuffer[0]; // actually 'cBuffer' in length
+
+ CORBBTPROF_BLOB_ENTRY_V1 * GetNextEntry()
+ {
+ return reinterpret_cast< CORBBTPROF_BLOB_ENTRY_V1* >(
+ reinterpret_cast< PBYTE >( this + 1 ) + cBuffer );
+ }
+};
+
+struct CORBBTPROF_BLOB_ENTRY
+{
+ DWORD size;
+ BlobType type;
+ mdToken token; // The code:CORBBTPROF_BLOB_ENTRY.token field is not a real meta-data token
+ // but a look-alike that IBCMerge makes to represent blob entry
+
+ bool TypeIsValid()
+ {
+ return (type >= MetadataStringPool) && (type < IllegalBlob);
+ }
+
+ CORBBTPROF_BLOB_ENTRY * GetNextEntry()
+ {
+ return reinterpret_cast< CORBBTPROF_BLOB_ENTRY* >(
+ reinterpret_cast< PBYTE >( this ) + size);
+ }
+};
+
+struct CORBBTPROF_BLOB_PARAM_SIG_ENTRY
+{
+ CORBBTPROF_BLOB_ENTRY blob;
+ DWORD cSig;
+ COR_SIGNATURE sig[0]; // actually 'cSig' in length
+};
+
+struct CORBBTPROF_BLOB_NAMESPACE_DEF_ENTRY
+{
+ CORBBTPROF_BLOB_ENTRY blob;
+ DWORD cName;
+ CHAR name[0]; // actually cName in length
+};
+
+struct CORBBTPROF_BLOB_TYPE_DEF_ENTRY
+{
+ CORBBTPROF_BLOB_ENTRY blob;
+ mdToken assemblyRefToken;
+ mdToken nestedClassToken;
+ mdToken nameSpaceToken;
+ DWORD cName;
+ CHAR name[0]; // actually cName in length
+};
+
+struct CORBBTPROF_BLOB_SIGNATURE_DEF_ENTRY
+{
+ CORBBTPROF_BLOB_ENTRY blob;
+ DWORD cSig;
+ COR_SIGNATURE sig[0]; // actually 'cSig' in length
+};
+
+struct CORBBTPROF_BLOB_METHOD_DEF_ENTRY
+{
+ CORBBTPROF_BLOB_ENTRY blob;
+ mdToken nestedClassToken;
+ mdToken signatureToken;
+ DWORD cName;
+ CHAR name[0]; // actually cName in length
+};
+
+struct CORBBTPROF_BLOB_POOL_ENTRY
+{
+ CORBBTPROF_BLOB_ENTRY blob;
+ DWORD cBuffer;
+ BYTE buffer[0]; // actually 'cBuffer' in length
+};
+#endif /* COR_BBTPROF_H_ */
diff --git a/src/inc/corcompile.h b/src/inc/corcompile.h
new file mode 100644
index 0000000000..70db9f162b
--- /dev/null
+++ b/src/inc/corcompile.h
@@ -0,0 +1,1939 @@
+// 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.
+
+/*****************************************************************************\
+* *
+* CorCompile.h - EE / Compiler interface *
+* *
+* Version 1.0 *
+*******************************************************************************
+* *
+* *
+* *
+\*****************************************************************************/
+// See code:CorProfileData for information on Hot Cold splitting using profile data.
+
+
+#ifndef _COR_COMPILE_H_
+#define _COR_COMPILE_H_
+
+#ifndef FEATURE_PREJIT
+#error FEATURE_PREJIT is required for this file
+#endif // FEATURE_PREJIT
+
+#if !defined(_TARGET_X86_)
+#ifndef WIN64EXCEPTIONS
+#define WIN64EXCEPTIONS
+#endif
+#endif // !_TARGET_X86_
+
+#include <cor.h>
+#include <corhdr.h>
+#include <corinfo.h>
+#include <corjit.h>
+#ifdef FEATURE_FUSION
+#include <fusion.h>
+#include <fusionpriv.h>
+#include <binderngen.h>
+#endif //FEATURE_FUSION
+#include <sstring.h>
+#include <shash.h>
+#include <daccess.h>
+#include <corbbtprof.h>
+#include <clrtypes.h>
+#include <fixuppointer.h>
+
+typedef DPTR(struct CORCOMPILE_CODE_MANAGER_ENTRY)
+ PTR_CORCOMPILE_CODE_MANAGER_ENTRY;
+typedef DPTR(struct CORCOMPILE_EE_INFO_TABLE)
+ PTR_CORCOMPILE_EE_INFO_TABLE;
+typedef DPTR(struct CORCOMPILE_HEADER)
+ PTR_CORCOMPILE_HEADER;
+typedef DPTR(struct CORCOMPILE_IMPORT_TABLE_ENTRY)
+ PTR_CORCOMPILE_IMPORT_TABLE_ENTRY;
+typedef DPTR(struct CORCOMPILE_COLD_METHOD_ENTRY)
+ PTR_CORCOMPILE_COLD_METHOD_ENTRY;
+typedef DPTR(struct CORCOMPILE_EXCEPTION_LOOKUP_TABLE)
+ PTR_CORCOMPILE_EXCEPTION_LOOKUP_TABLE;
+typedef DPTR(struct CORCOMPILE_EXCEPTION_LOOKUP_TABLE_ENTRY)
+ PTR_CORCOMPILE_EXCEPTION_LOOKUP_TABLE_ENTRY;
+typedef DPTR(struct CORCOMPILE_EXCEPTION_CLAUSE)
+ PTR_CORCOMPILE_EXCEPTION_CLAUSE;
+typedef DPTR(struct CORCOMPILE_VIRTUAL_IMPORT_THUNK)
+ PTR_CORCOMPILE_VIRTUAL_IMPORT_THUNK;
+typedef DPTR(struct CORCOMPILE_EXTERNAL_METHOD_THUNK)
+ PTR_CORCOMPILE_EXTERNAL_METHOD_THUNK;
+typedef DPTR(struct CORCOMPILE_EXTERNAL_METHOD_DATA_ENTRY)
+ PTR_CORCOMPILE_EXTERNAL_METHOD_DATA_ENTRY;
+typedef DPTR(struct CORCOMPILE_VIRTUAL_SECTION_INFO)
+ PTR_CORCOMPILE_VIRTUAL_SECTION_INFO;
+typedef DPTR(struct CORCOMPILE_IMPORT_SECTION)
+ PTR_CORCOMPILE_IMPORT_SECTION;
+
+#ifdef _TARGET_X86_
+//
+// x86 ABI does not define RUNTIME_FUNCTION. Define our own to allow unification between x86 and other platforms.
+//
+typedef struct _RUNTIME_FUNCTION {
+ DWORD BeginAddress;
+ DWORD UnwindData;
+} RUNTIME_FUNCTION, *PRUNTIME_FUNCTION;
+
+typedef DPTR(RUNTIME_FUNCTION) PTR_RUNTIME_FUNCTION;
+
+#define RUNTIME_FUNCTION__BeginAddress(prf) (prf)->BeginAddress
+
+// Chained unwind info. Used for cold methods.
+#define RUNTIME_FUNCTION_INDIRECT 0x80000000
+
+#endif
+
+// The stride is choosen as maximum value that still gives good page locality of RUNTIME_FUNCTION table touches (only one page of
+// RUNTIME_FUNCTION table is going to be touched during most IP2MD lookups).
+//
+// Smaller stride values also improve speed of IP2MD lookups, but this improvement is not significant (5% when going
+// from 8192 to 1024), so the working set / page locality was used as the metric to choose the optimum value.
+//
+#define RUNTIME_FUNCTION_LOOKUP_STRIDE 8192
+
+
+typedef DPTR(struct CORCOMPILE_METHOD_PROFILE_LIST)
+ PTR_CORCOMPILE_METHOD_PROFILE_LIST;
+typedef DPTR(struct CORCOMPILE_RUNTIME_DLL_INFO)
+ PTR_CORCOMPILE_RUNTIME_DLL_INFO;
+typedef DPTR(struct CORCOMPILE_VERSION_INFO) PTR_CORCOMPILE_VERSION_INFO;
+typedef DPTR(struct COR_ILMETHOD) PTR_COR_ILMETHOD;
+
+// This can be used to specify a dll that should be used as the compiler during ngen.
+// If this is not specified, the default compiler dll will be used.
+// If this is specified, it needs to be specified for all the assemblies that are ngenned.
+#define NGEN_COMPILER_OVERRIDE_KEY W("NGen_JitName")
+
+//
+// CORCOMPILE_IMPORT_SECTION describes image range with references to other assemblies or runtime data structures
+//
+// There is number of different types of these ranges: eagerly initialized at image load vs. lazily initialized at method entry
+// vs. lazily initialized on first use; hot vs. cold, handles vs. code pointers, etc.
+//
+struct CORCOMPILE_IMPORT_SECTION
+{
+ IMAGE_DATA_DIRECTORY Section; // Section containing values to be fixed up
+ USHORT Flags; // One or more of CorCompileImportFlags
+ BYTE Type; // One of CorCompileImportType
+ BYTE EntrySize;
+ DWORD Signatures; // RVA of optional signature descriptors
+ DWORD AuxiliaryData; // RVA of optional auxiliary data (typically GC info)
+};
+
+enum CorCompileImportType
+{
+ CORCOMPILE_IMPORT_TYPE_UNKNOWN = 0,
+ CORCOMPILE_IMPORT_TYPE_EXTERNAL_METHOD = 1,
+ CORCOMPILE_IMPORT_TYPE_STUB_DISPATCH = 2,
+ CORCOMPILE_IMPORT_TYPE_STRING_HANDLE = 3,
+ CORCOMPILE_IMPORT_TYPE_TYPE_HANDLE = 4,
+ CORCOMPILE_IMPORT_TYPE_METHOD_HANDLE = 5,
+ CORCOMPILE_IMPORT_TYPE_VIRTUAL_METHOD = 6,
+};
+
+enum CorCompileImportFlags
+{
+ CORCOMPILE_IMPORT_FLAGS_EAGER = 0x0001, // Section at module load time.
+ CORCOMPILE_IMPORT_FLAGS_CODE = 0x0002, // Section contains code.
+ CORCOMPILE_IMPORT_FLAGS_PCODE = 0x0004, // Section contains pointers to code.
+};
+
+// ================================================================================
+// Portable tagged union of a pointer field with a 30 bit scalar value
+// ================================================================================
+
+// The lowest bit of the tag will be set for tagged pointers. We also set the highest bit for convenience.
+// It makes dereferences of tagged pointers to crash under normal circumstances.
+// The highest bit of the tag will be set for tagged indexes (e.g. classid).
+
+#define CORCOMPILE_TOKEN_TAG 0x80000001
+
+// These two macros are mostly used just for debug-only checks to ensure that we have either tagged pointer (lowest bit is set)
+// or tagged index (highest bit is set).
+#define CORCOMPILE_IS_POINTER_TAGGED(token) ((((SIZE_T)(token)) & 0x00000001) != 0)
+#define CORCOMPILE_IS_INDEX_TAGGED(token) ((((SIZE_T)(token)) & 0x80000000) != 0)
+
+// The token (RVA of the fixup in most cases) is stored in the mid 30 bits of DWORD
+#define CORCOMPILE_TAG_TOKEN(token) ((SIZE_T)(((token)<<1)|CORCOMPILE_TOKEN_TAG))
+#define CORCOMPILE_UNTAG_TOKEN(token) ((((SIZE_T)(token))&~CORCOMPILE_TOKEN_TAG)>>1)
+
+#ifdef _TARGET_ARM_
+// Tagging of code pointers on ARM uses inverse logic because of the thumb bit.
+#define CORCOMPILE_IS_PCODE_TAGGED(token) ((((SIZE_T)(token)) & 0x00000001) == 0x00000000)
+#define CORCOMPILE_TAG_PCODE(token) ((SIZE_T)(((token)<<1)|0x80000000))
+#else
+#define CORCOMPILE_IS_PCODE_TAGGED(token) CORCOMPILE_IS_POINTER_TAGGED(token)
+#define CORCOMPILE_TAG_PCODE(token) CORCOMPILE_TAG_TOKEN(token)
+#endif
+
+inline BOOL CORCOMPILE_IS_FIXUP_TAGGED(SIZE_T fixup, PTR_CORCOMPILE_IMPORT_SECTION pSection)
+{
+#ifdef _TARGET_ARM_
+ // Tagging of code pointers on ARM has to use inverse logic because of the thumb bit
+ if (pSection->Flags & CORCOMPILE_IMPORT_FLAGS_PCODE)
+ {
+ return CORCOMPILE_IS_PCODE_TAGGED(fixup);
+ }
+#endif
+
+ return ((((SIZE_T)(fixup)) & CORCOMPILE_TOKEN_TAG) == CORCOMPILE_TOKEN_TAG);
+}
+
+enum CorCompileBuild
+{
+ CORCOMPILE_BUILD_CHECKED,
+ CORCOMPILE_BUILD_FREE
+};
+
+enum CorCompileCodegen
+{
+ CORCOMPILE_CODEGEN_DEBUGGING = 0x0001, // suports debugging (unoptimized code with symbol info)
+
+ CORCOMPILE_CODEGEN_PROFILING = 0x0004, // supports profiling
+ CORCOMPILE_CODEGEN_PROF_INSTRUMENTING = 0x0008, // code is instrumented to collect profile count info
+
+#if defined(_TARGET_AMD64_) && !defined(FEATURE_CORECLR)
+ CORCOMPILE_CODEGEN_USE_RYUJIT = 0x0100, // code is generated by Ryu JIT
+#endif
+};
+
+#if defined(_TARGET_AMD64_) && !defined(FEATURE_CORECLR)
+bool UseRyuJit();
+#endif
+
+// Used for INativeImageInstallInfo::GetConfigMask()
+// A bind will ask for the particular bits it needs set; if all bits are set, it is a match. Additional
+// bits are ignored.
+
+enum CorCompileConfigFlags
+{
+ CORCOMPILE_CONFIG_DEBUG_NONE = 0x01, // Assembly has Optimized code
+ CORCOMPILE_CONFIG_DEBUG = 0x02, // Assembly has non-Optimized debuggable code
+ CORCOMPILE_CONFIG_DEBUG_DEFAULT = 0x08, // Additional flag set if this particular setting is the
+ // one indicated by the assembly debug custom attribute.
+
+ CORCOMPILE_CONFIG_PROFILING_NONE = 0x100, // Assembly code has profiling hooks
+ CORCOMPILE_CONFIG_PROFILING = 0x200, // Assembly code has profiling hooks
+
+ CORCOMPILE_CONFIG_INSTRUMENTATION_NONE = 0x1000, // Assembly code has no instrumentation
+ CORCOMPILE_CONFIG_INSTRUMENTATION = 0x2000, // Assembly code has basic block instrumentation
+};
+
+// Values for Flags field of CORCOMPILE_HEADER.
+enum CorCompileHeaderFlags
+{
+ CORCOMPILE_HEADER_HAS_SECURITY_DIRECTORY = 0x00000001, // Original image had a security directory
+ // Note it is useless to cache the actual directory contents
+ // since it must be verified as part of the original image
+ CORCOMPILE_HEADER_IS_IBC_OPTIMIZED = 0x00000002,
+
+ CORCOMPILE_HEADER_IS_READY_TO_RUN = 0x00000004,
+};
+
+//
+// !!! INCREMENT THE MAJOR VERSION ANY TIME THERE IS CHANGE IN CORCOMPILE_HEADER STRUCTURE !!!
+//
+#define CORCOMPILE_SIGNATURE 0x0045474E // 'NGEN'
+#define CORCOMPILE_MAJOR_VERSION 0x0001
+#define CORCOMPILE_MINOR_VERSION 0x0000
+
+// This structure is pointed to by the code:IMAGE_COR20_HEADER (see file:corcompile.h#ManagedHeader)
+// See the file:../../doc/BookOfTheRuntime/NGEN/NGENDesign.doc for more
+struct CORCOMPILE_HEADER
+{
+ // For backward compatibility reasons, VersionInfo field must be at offset 40, ManifestMetaData
+ // must be at 88, PEKind must be at 112/116 bytes, Machine must be at 120/124 bytes, and
+ // size of CORCOMPILE_HEADER must be 164/168 bytes. Be careful when you modify this struct.
+ // See code:PEDecoder::GetMetaDataHelper.
+ DWORD Signature;
+ USHORT MajorVersion;
+ USHORT MinorVersion;
+
+ IMAGE_DATA_DIRECTORY HelperTable; // Table of function pointers to JIT helpers indexed by helper number
+ IMAGE_DATA_DIRECTORY ImportSections; // points to array of code:CORCOMPILE_IMPORT_SECTION
+ IMAGE_DATA_DIRECTORY ImportTable; // points to table CORCOMPILE_IMPORT_TABLE_ENTRY
+ IMAGE_DATA_DIRECTORY StubsData; // contains the value to register with the stub manager for the delegate stubs & AMD64 tail call stubs
+ IMAGE_DATA_DIRECTORY VersionInfo; // points to a code:CORCOMPILE_VERSION_INFO
+ IMAGE_DATA_DIRECTORY Dependencies; // points to an array of code:CORCOMPILE_DEPENDENCY
+ IMAGE_DATA_DIRECTORY DebugMap; // points to an array of code:CORCOMPILE_DEBUG_RID_ENTRY hashed by method RID
+ IMAGE_DATA_DIRECTORY ModuleImage; // points to the freeze dried Module structure
+ IMAGE_DATA_DIRECTORY CodeManagerTable; // points to a code:CORCOMPILE_CODE_MANAGER_ENTRY
+ IMAGE_DATA_DIRECTORY ProfileDataList;// points to the list of code:CORCOMPILE_METHOD_PROFILE_LIST
+ IMAGE_DATA_DIRECTORY ManifestMetaData; // points to the native manifest metadata
+ IMAGE_DATA_DIRECTORY VirtualSectionsTable;// List of CORCOMPILE_VIRTUAL_SECTION_INFO. Contains a list of Section
+ // ranges for debugging purposes. There is one entry in this table per
+ // ZapVirtualSection in the NGEN image. This data is used to fire ETW
+ // events that describe the various VirtualSection in the NGEN image. These
+ // events are used for diagnostics and performance purposes. Some of the
+ // questions these events help answer are like : how effective is IBC
+ // training data. They can also be used to have better nidump support for
+ // decoding virtual section information ( start - end ranges for each
+ // virtual section )
+
+ TADDR ImageBase; // Actual image base address (ASLR fakes the image base in PE header while applying relocations in kernel)
+ DWORD Flags; // Flags, see CorCompileHeaderFlags above
+
+ DWORD PEKind; // CorPEKind of the original IL image
+
+ ULONG COR20Flags; // Cached value of code:IMAGE_COR20_HEADER.Flags from original IL image
+ WORD Machine; // Cached value of _IMAGE_FILE_HEADER.Machine from original IL image
+ WORD Characteristics;// Cached value of _IMAGE_FILE_HEADER.Characteristics from original IL image
+
+ IMAGE_DATA_DIRECTORY EEInfoTable; // points to a code:CORCOMPILE_EE_INFO_TABLE
+
+ // For backward compatibility (see above)
+ IMAGE_DATA_DIRECTORY Dummy1;
+ IMAGE_DATA_DIRECTORY Dummy2;
+ IMAGE_DATA_DIRECTORY Dummy3;
+ IMAGE_DATA_DIRECTORY Dummy4;
+};
+
+// CORCOMPILE_VIRTUAL_SECTION_INFO describes virtual section ranges. This data is used by nidump
+// and to fire ETW that are used for diagnostics and performance purposes. Some of the questions
+// these events help answer are like : how effective is IBC training data.
+struct CORCOMPILE_VIRTUAL_SECTION_INFO
+{
+ ULONG VirtualAddress;
+ ULONG Size;
+ DWORD SectionType;
+};
+
+#define CORCOMPILE_SECTION_TYPES() \
+ CORCOMPILE_SECTION_TYPE(Module) \
+ CORCOMPILE_SECTION_TYPE(EETable) \
+ CORCOMPILE_SECTION_TYPE(WriteData) \
+ CORCOMPILE_SECTION_TYPE(WriteableData) \
+ CORCOMPILE_SECTION_TYPE(Data) \
+ CORCOMPILE_SECTION_TYPE(RVAStatics) \
+ CORCOMPILE_SECTION_TYPE(EEData) \
+ CORCOMPILE_SECTION_TYPE(DelayLoadInfoTableEager) \
+ CORCOMPILE_SECTION_TYPE(DelayLoadInfoTable) \
+ CORCOMPILE_SECTION_TYPE(EEReadonlyData) \
+ CORCOMPILE_SECTION_TYPE(ReadonlyData) \
+ CORCOMPILE_SECTION_TYPE(Class) \
+ CORCOMPILE_SECTION_TYPE(CrossDomainInfo) \
+ CORCOMPILE_SECTION_TYPE(MethodDesc) \
+ CORCOMPILE_SECTION_TYPE(MethodDescWriteable) \
+ CORCOMPILE_SECTION_TYPE(Exception) \
+ CORCOMPILE_SECTION_TYPE(Instrument) \
+ CORCOMPILE_SECTION_TYPE(VirtualImportThunk) \
+ CORCOMPILE_SECTION_TYPE(ExternalMethodThunk) \
+ CORCOMPILE_SECTION_TYPE(HelperTable) \
+ CORCOMPILE_SECTION_TYPE(MethodPrecodeWriteable) \
+ CORCOMPILE_SECTION_TYPE(MethodPrecodeWrite) \
+ CORCOMPILE_SECTION_TYPE(MethodPrecode) \
+ CORCOMPILE_SECTION_TYPE(Win32Resources) \
+ CORCOMPILE_SECTION_TYPE(Header) \
+ CORCOMPILE_SECTION_TYPE(Metadata) \
+ CORCOMPILE_SECTION_TYPE(DelayLoadInfo) \
+ CORCOMPILE_SECTION_TYPE(ImportTable) \
+ CORCOMPILE_SECTION_TYPE(Code) \
+ CORCOMPILE_SECTION_TYPE(CodeHeader) \
+ CORCOMPILE_SECTION_TYPE(CodeManager) \
+ CORCOMPILE_SECTION_TYPE(UnwindData) \
+ CORCOMPILE_SECTION_TYPE(RuntimeFunction) \
+ CORCOMPILE_SECTION_TYPE(Stubs) \
+ CORCOMPILE_SECTION_TYPE(StubDispatchData) \
+ CORCOMPILE_SECTION_TYPE(ExternalMethodData) \
+ CORCOMPILE_SECTION_TYPE(DelayLoadInfoDelayList) \
+ CORCOMPILE_SECTION_TYPE(ReadonlyShared) \
+ CORCOMPILE_SECTION_TYPE(Readonly) \
+ CORCOMPILE_SECTION_TYPE(IL) \
+ CORCOMPILE_SECTION_TYPE(GCInfo) \
+ CORCOMPILE_SECTION_TYPE(ILMetadata) \
+ CORCOMPILE_SECTION_TYPE(Resources) \
+ CORCOMPILE_SECTION_TYPE(CompressedMaps) \
+ CORCOMPILE_SECTION_TYPE(Debug) \
+ CORCOMPILE_SECTION_TYPE(BaseRelocs) \
+
+// Hot: Items are frequently accessed ( Indicated by either IBC data, or
+// statically known )
+
+// Warm : Items are less frequently accessed, or frequently accessed
+// but were not touched during IBC profiling.
+
+// Cold : Least frequently accessed /shouldn't not be accessed
+// when running a scenario that was used during IBC
+// training ( training scenario )
+
+// HotColdSorted : Sections marked with this category means they contain both
+// Hot items and Cold items. The hot items are placed before
+// the cold items (Sorted)
+
+#define CORCOMPILE_SECTION_RANGE_TYPES() \
+ CORCOMPILE_SECTION_RANGE_TYPE(Hot, 0x00010000) \
+ CORCOMPILE_SECTION_RANGE_TYPE(Warm, 0x00020000) \
+ CORCOMPILE_SECTION_RANGE_TYPE(Cold, 0x00040000) \
+ CORCOMPILE_SECTION_RANGE_TYPE(HotColdSorted, 0x00080000) \
+
+
+// IBCUnProfiled: Items in this VirtualSection are statically determined to be cold.
+// (IBC Profiling wouldn't have helped put these item in a hot section).
+// Items that currently doesn't have IBC probs, or are always put in a specific section
+// regardless of IBC data should fall in this category.
+
+// IBCProfiled: IBC profiling placed items in this section, or
+// items are NOT placed into a hot section they didn't have IBC profiling data
+// ( IBC profiling would have helped put these items in a hot section )
+
+#define CORCOMPILE_SECTION_IBCTYPES() \
+ CORCOMPILE_SECTION_IBCTYPE(IBCUnProfiled, 0x01000000) \
+ CORCOMPILE_SECTION_IBCTYPE(IBCProfiled, 0x02000000) \
+
+
+// Support for VirtualSection Metadata/Categories
+// Please update the VirtualSetionType ETW map in ClrEtwAll.man if you changed this enum.
+// ZapVirtualSectionType is used to describe metadata about VirtualSections.
+// The metadata consists of 3 sub-metadata parts.
+// ---------------------------------------------------
+// 1 byte 1 byte 2 bytes --
+// <IBCType> <RangeType> <VirtualSectionType> --
+// ---------------------------------------------------
+//
+//
+// VirtualSections are a CLR concept to aggregate data
+// items that share common properties together (Hot/Cold/Warm, Writeable/
+// Readonly ...etc.). VirtualSections are tagged with some categories when they
+// are created (code:NewVirtualSection)
+// The VirtualSection categorize are described more in VirtualSectionType enum.
+// The categories describe 2 important aspects for each VirtualSection
+//
+// ***********************************************
+// IBCProfiled v.s NonIBCProfiled Categories.
+// **********************************************
+//
+// IBCProfiled: Distinguish between sections that IBC profiling data has been used
+// to decide the layout of the data items in this section.
+// NonIBCProfiled: We don't have IBC data for all our datastructures.
+// The access pattern/frequency for some data structures
+// are statically determined. Sections that contain these data items
+// are marked as NonIBCProfiled.
+//
+//***************************************************
+// Access Frequency categories
+// **************************************************
+// Hot: Data is frequently accessed
+// Warm: Less frequently accessed than Hot
+// Cold: Should be rarely accessed.
+//
+// The combination of these 2 sub-categories gives us the following valid categories
+// 1-IBCProfiled | Hot: Hot based on IBC profiling data.
+// 2-IBCProfiled | Cold: IBC profiling could have helped make this section hot.
+// 3-NonIBCProfiled | Hot: Statically determined hot.
+// 4-NonIBCProfiled | Warm: Staticaly determined warm.
+// 5-NonIBCProfiled | Cold: Statically determined cold.
+//
+// We should try to place data items into the correct section based on
+// the above categorization, this could mean that we might split
+// a virtual section into 2 sections if it contains multiple heterogeneous items.
+
+enum ZapVirtualSectionType
+{
+ // <IBCType>
+ IBCTypeReservedFlag = 0xFF000000,
+#define CORCOMPILE_SECTION_IBCTYPE(ibcType, flag) ibcType##Section = flag,
+ CORCOMPILE_SECTION_IBCTYPES()
+#undef CORCOMPILE_SECTION_IBCTYPE
+
+ // <RangeType>
+ RangeTypeReservedFlag = 0x00FF0000,
+#define CORCOMPILE_SECTION_RANGE_TYPE(rangeType, flag) rangeType##Range = flag,
+ CORCOMPILE_SECTION_RANGE_TYPES()
+#undef CORCOMPILE_SECTION_RANGE_TYPE
+
+ // <VirtualSectionType>
+ VirtualSectionTypeReservedFlag = 0x0000FFFF,
+ VirtualSectionTypeStartSection = 0x0, // reserved so the first section start at 0x1
+#define CORCOMPILE_SECTION_TYPE(virtualSectionType) virtualSectionType##Section,
+ CORCOMPILE_SECTION_TYPES()
+#undef CORCOMPILE_SECTION_TYPE
+
+ CORCOMPILE_SECTION_TYPE_COUNT
+};
+
+class VirtualSectionData
+{
+
+public :
+ static UINT8 IBCType(DWORD sectionType) { return (UINT8) ((sectionType & IBCTypeReservedFlag) >> 24); }
+ static UINT8 RangeType(DWORD sectionType) { return (UINT8) ((sectionType & RangeTypeReservedFlag) >> 16); }
+ static UINT16 VirtualSectionType(DWORD sectionType) { return (UINT16) ((sectionType & VirtualSectionTypeReservedFlag)); }
+ static BOOL IsIBCProfiledColdSection(DWORD sectionType)
+ {
+ return ((sectionType & ColdRange) == ColdRange) && ((sectionType & IBCProfiledSection) == IBCProfiledSection);
+ }
+};
+
+struct CORCOMPILE_IMPORT_TABLE_ENTRY
+{
+ USHORT wAssemblyRid;
+ USHORT wModuleRid;
+};
+
+struct CORCOMPILE_EE_INFO_TABLE
+{
+ TADDR inlinedCallFrameVptr;
+ PTR_LONG addrOfCaptureThreadGlobal;
+ PTR_DWORD addrOfJMCFlag;
+ SIZE_T gsCookie;
+ CORINFO_Object ** emptyString;
+
+ DWORD threadTlsIndex;
+
+ DWORD rvaStaticTlsIndex;
+
+// These are used by the 64-bit JITs to detect calls to thunks in the .nep section
+// and conditionally eliminate double-thunking (managed-to-native-to-managed).
+// During prejit these are set to the RVAs of the .nep section. When the prejitted
+// image is actually loaded, these are fixed up to point to the actual .nep section
+// of the ijw image (not the native image).
+
+ BYTE * nativeEntryPointStart;
+ BYTE * nativeEntryPointEnd;
+};
+
+/*********************************************************************************/
+
+// This is the offset to the compressed blob of debug information
+
+typedef ULONG CORCOMPILE_DEBUG_ENTRY;
+
+// A single generic method may be get compiled into multiple copies of code for
+// different instantiations, and can have multiple entries for the same RID.
+
+struct CORCOMPILE_DEBUG_LABELLED_ENTRY
+{
+ DWORD nativeCodeRVA; // the ngen code RVA distinguishes this entry from others with the same RID.
+ CORCOMPILE_DEBUG_ENTRY debugInfoOffset; // offset to the debug information for this native code
+};
+
+// Debug information is accessed using a table of RVAs indexed by the RID token for
+// the method.
+
+typedef CORCOMPILE_DEBUG_ENTRY CORCOMPILE_DEBUG_RID_ENTRY;
+
+// If this bit is not set, the CORCOMPILE_DEBUG_RID_ENTRY RVA points to a compressed
+// debug information blob.
+// If this bit is set, the RVA points to CORCOMPILE_DEBUG_LABELLED_ENTRY.
+// If this bit is set in CORCOMPILE_DEBUG_LABELLED_ENTRY, there is another entry following it.
+
+const CORCOMPILE_DEBUG_RID_ENTRY CORCOMPILE_DEBUG_MULTIPLE_ENTRIES = 0x80000000;
+
+inline bool IsMultipleLabelledEntries(CORCOMPILE_DEBUG_RID_ENTRY rva)
+{
+ SUPPORTS_DAC;
+
+ return (rva & CORCOMPILE_DEBUG_MULTIPLE_ENTRIES) != 0;
+}
+
+inline unsigned GetDebugRidEntryHash(mdToken token)
+{
+ SUPPORTS_DAC;
+
+ unsigned hashCode = token;
+
+ // mix it
+ hashCode -= hashCode >> 17;
+ hashCode -= hashCode >> 11;
+ hashCode -= hashCode >> 5;
+
+ return hashCode;
+}
+
+typedef DPTR(CORCOMPILE_DEBUG_ENTRY) PTR_CORCOMPILE_DEBUG_ENTRY;
+typedef DPTR(struct CORCOMPILE_DEBUG_LABELLED_ENTRY) PTR_CORCOMPILE_DEBUG_LABELLED_ENTRY;
+typedef DPTR(CORCOMPILE_DEBUG_RID_ENTRY) PTR_CORCOMPILE_DEBUG_RID_ENTRY;
+
+/*********************************************************************************/
+
+struct CORCOMPILE_CODE_MANAGER_ENTRY
+{
+ IMAGE_DATA_DIRECTORY HotCode;
+ IMAGE_DATA_DIRECTORY Code;
+ IMAGE_DATA_DIRECTORY ColdCode;
+
+ IMAGE_DATA_DIRECTORY ROData;
+
+ //Layout is
+ //HOT COMMON
+ //HOT IBC
+ //HOT GENERICS
+ //Hot due to procedure splitting
+ ULONG HotIBCMethodOffset;
+ ULONG HotGenericsMethodOffset;
+
+ //Layout is
+ //COLD IBC
+ //Cold due to procedure splitting.
+ ULONG ColdUntrainedMethodOffset;
+};
+
+#if defined(_TARGET_X86_) || defined(_TARGET_AMD64_)
+
+#define _PRECODE_EXTERNAL_METHOD_THUNK 0x41
+#define _PRECODE_VIRTUAL_IMPORT_THUNK 0x42
+
+ struct CORCOMPILE_VIRTUAL_IMPORT_THUNK
+ {
+ BYTE callJmp[5]; // Call/Jmp Pc-Rel32
+ BYTE precodeType; // 0x42 _PRECODE_VIRTUAL_IMPORT_THUNK
+ WORD slotNum;
+ };
+
+ struct CORCOMPILE_EXTERNAL_METHOD_THUNK
+ {
+ BYTE callJmp[5]; // Call/Jmp Pc-Rel32
+ BYTE precodeType; // 0x41 _PRECODE_EXTERNAL_METHOD_THUNK
+ WORD padding;
+ };
+
+#elif defined(_TARGET_ARM_)
+
+ struct CORCOMPILE_VIRTUAL_IMPORT_THUNK
+ {
+ // Array of words to do the following:
+ //
+ // mov r12, pc ; Save the current address relative to which we will get slot ID and address to patch.
+ // ldr pc, [pc, #4] ; Load the target address. Initially it will point to the helper stub that will patch it
+ // ; to point to the actual target on the first run.
+ WORD m_rgCode[3];
+
+ // WORD to store the slot ID
+ WORD slotNum;
+
+ // The target address - initially, this will point to VirtualMethodFixupStub.
+ // Post patchup by the stub, it will point to the actual method body.
+ PCODE m_pTarget;
+ };
+
+ struct CORCOMPILE_EXTERNAL_METHOD_THUNK
+ {
+ // Array of words to do the following:
+ //
+ // mov r12, pc ; Save the current address relative to which we will get GCRef bitmap and address to patch.
+ // ldr pc, [pc, #4] ; Load the target address. Initially it will point to the helper stub that will patch it
+ // ; to point to the actual target on the first run.
+ WORD m_rgCode[3];
+
+ WORD m_padding;
+
+ // The target address - initially, this will point to ExternalMethodFixupStub.
+ // Post patchup by the stub, it will point to the actual method body.
+ PCODE m_pTarget;
+ };
+
+#elif defined(_TARGET_ARM64_)
+ struct CORCOMPILE_VIRTUAL_IMPORT_THUNK
+ {
+ // Array of words to do the following:
+ //
+ // adr x12, #0 ; Save the current address relative to which we will get slot ID and address to patch.
+ // ldr x10, [x12, #16] ; Load the target address.
+ // br x10 ; Jump to the target
+ DWORD m_rgCode[3];
+
+ // WORD to store the slot ID
+ WORD slotNum;
+
+ // The target address - initially, this will point to VirtualMethodFixupStub.
+ // Post patchup by the stub, it will point to the actual method body.
+ PCODE m_pTarget;
+ };
+
+ struct CORCOMPILE_EXTERNAL_METHOD_THUNK
+ {
+ // Array of words to do the following:
+ // adr x12, #0 ; Save the current address relative to which we will get slot ID and address to patch.
+ // ldr x10, [x12, #16] ; Load the target address.
+ // br x10 ; Jump to the target
+ DWORD m_rgCode[3];
+
+ DWORD m_padding; //aligning stack to 16 bytes
+
+ // The target address - initially, this will point to ExternalMethodFixupStub.
+ // Post patchup by the stub, it will point to the actual method body.
+ PCODE m_pTarget;
+ };
+
+#endif
+
+//
+// GCRefMap blob starts with DWORDs lookup index of relative offsets into the blob. This lookup index is used to limit amount
+// of linear scanning required to find entry in the GCRefMap. The size of this lookup index is
+// <totalNumberOfEntries in the GCRefMap> / GCREFMAP_LOOKUP_STRIDE.
+//
+#define GCREFMAP_LOOKUP_STRIDE 1024
+
+enum CORCOMPILE_GCREFMAP_TOKENS
+{
+ GCREFMAP_SKIP = 0,
+ GCREFMAP_REF = 1,
+ GCREFMAP_INTERIOR = 2,
+ GCREFMAP_METHOD_PARAM = 3,
+ GCREFMAP_TYPE_PARAM = 4,
+ GCREFMAP_VASIG_COOKIE = 5,
+};
+
+// Tags for fixup blobs
+enum CORCOMPILE_FIXUP_BLOB_KIND
+{
+ ENCODE_NONE = 0,
+
+ ENCODE_MODULE_OVERRIDE = 0x80, /* When the high bit is set, override of the module immediately follows */
+
+ ENCODE_DICTIONARY_LOOKUP_THISOBJ = 0x07,
+ ENCODE_DICTIONARY_LOOKUP_TYPE = 0x08,
+ ENCODE_DICTIONARY_LOOKUP_METHOD = 0x09,
+
+ ENCODE_TYPE_HANDLE = 0x10, /* Type handle */
+ ENCODE_METHOD_HANDLE, /* Method handle */
+ ENCODE_FIELD_HANDLE, /* Field handle */
+
+ ENCODE_METHOD_ENTRY, /* For calling a method entry point */
+ ENCODE_METHOD_ENTRY_DEF_TOKEN, /* Smaller version of ENCODE_METHOD_ENTRY - method is def token */
+ ENCODE_METHOD_ENTRY_REF_TOKEN, /* Smaller version of ENCODE_METHOD_ENTRY - method is ref token */
+
+ ENCODE_VIRTUAL_ENTRY, /* For invoking a virtual method */
+ ENCODE_VIRTUAL_ENTRY_DEF_TOKEN, /* Smaller version of ENCODE_VIRTUAL_ENTRY - method is def token */
+ ENCODE_VIRTUAL_ENTRY_REF_TOKEN, /* Smaller version of ENCODE_VIRTUAL_ENTRY - method is ref token */
+ ENCODE_VIRTUAL_ENTRY_SLOT, /* Smaller version of ENCODE_VIRTUAL_ENTRY - type & slot */
+
+ ENCODE_READYTORUN_HELPER, /* ReadyToRun helper */
+ ENCODE_STRING_HANDLE, /* String token */
+
+ ENCODE_NEW_HELPER, /* Dynamically created new helpers */
+ ENCODE_NEW_ARRAY_HELPER,
+
+ ENCODE_ISINSTANCEOF_HELPER, /* Dynamically created casting helper */
+ ENCODE_CHKCAST_HELPER,
+
+ ENCODE_FIELD_ADDRESS, /* For accessing a cross-module static fields */
+ ENCODE_CCTOR_TRIGGER, /* Static constructor trigger */
+
+ ENCODE_STATIC_BASE_NONGC_HELPER, /* Dynamically created static base helpers */
+ ENCODE_STATIC_BASE_GC_HELPER,
+ ENCODE_THREAD_STATIC_BASE_NONGC_HELPER,
+ ENCODE_THREAD_STATIC_BASE_GC_HELPER,
+
+ ENCODE_FIELD_BASE_OFFSET, /* Field base */
+ ENCODE_FIELD_OFFSET,
+
+ ENCODE_TYPE_DICTIONARY,
+ ENCODE_METHOD_DICTIONARY,
+
+ ENCODE_CHECK_TYPE_LAYOUT,
+ ENCODE_CHECK_FIELD_OFFSET,
+
+ ENCODE_DELEGATE_CTOR,
+
+ ENCODE_DECLARINGTYPE_HANDLE,
+
+ ENCODE_MODULE_HANDLE = 0x50, /* Module token */
+ ENCODE_STATIC_FIELD_ADDRESS, /* For accessing a static field */
+ ENCODE_MODULE_ID_FOR_STATICS, /* For accessing static fields */
+ ENCODE_MODULE_ID_FOR_GENERIC_STATICS, /* For accessing static fields */
+ ENCODE_CLASS_ID_FOR_STATICS, /* For accessing static fields */
+ ENCODE_SYNC_LOCK, /* For synchronizing access to a type */
+ ENCODE_INDIRECT_PINVOKE_TARGET, /* For calling a pinvoke method ptr */
+ ENCODE_PROFILING_HANDLE, /* For the method's profiling counter */
+ ENCODE_VARARGS_METHODDEF, /* For calling a varargs method */
+ ENCODE_VARARGS_METHODREF,
+ ENCODE_VARARGS_SIG,
+ ENCODE_ACTIVE_DEPENDENCY, /* Conditional active dependency */
+ ENCODE_METHOD_NATIVE_ENTRY, /* NativeCallable method token */
+};
+
+enum EncodeMethodSigFlags
+{
+ ENCODE_METHOD_SIG_UnboxingStub = 0x01,
+ ENCODE_METHOD_SIG_InstantiatingStub = 0x02,
+ ENCODE_METHOD_SIG_MethodInstantiation = 0x04,
+ ENCODE_METHOD_SIG_SlotInsteadOfToken = 0x08,
+ ENCODE_METHOD_SIG_MemberRefToken = 0x10,
+ ENCODE_METHOD_SIG_Constrained = 0x20,
+ ENCODE_METHOD_SIG_OwnerType = 0x40,
+};
+
+enum EncodeFieldSigFlags
+{
+ ENCODE_FIELD_SIG_IndexInsteadOfToken = 0x08,
+ ENCODE_FIELD_SIG_MemberRefToken = 0x10,
+ ENCODE_FIELD_SIG_OwnerType = 0x40,
+};
+
+class SBuffer;
+class SigBuilder;
+class PEDecoder;
+class GCRefMapBuilder;
+
+//REVIEW: include for ee exception info
+#include "eexcp.h"
+
+struct CORCOMPILE_EXCEPTION_LOOKUP_TABLE_ENTRY
+{
+ DWORD MethodStartRVA;
+ DWORD ExceptionInfoRVA;
+};
+
+struct CORCOMPILE_EXCEPTION_LOOKUP_TABLE
+{
+ // pointer to the first element of m_numLookupEntries elements
+ CORCOMPILE_EXCEPTION_LOOKUP_TABLE_ENTRY m_Entries[1];
+
+ CORCOMPILE_EXCEPTION_LOOKUP_TABLE_ENTRY* ExceptionLookupEntry(unsigned i)
+ {
+ SUPPORTS_DAC_WRAPPER;
+ return &(PTR_CORCOMPILE_EXCEPTION_LOOKUP_TABLE_ENTRY(PTR_HOST_MEMBER_TADDR(CORCOMPILE_EXCEPTION_LOOKUP_TABLE,this,m_Entries))[i]);
+ }
+};
+
+struct CORCOMPILE_EXCEPTION_CLAUSE
+{
+ CorExceptionFlag Flags;
+ DWORD TryStartPC;
+ DWORD TryEndPC;
+ DWORD HandlerStartPC;
+ DWORD HandlerEndPC;
+ union {
+ mdToken ClassToken;
+ DWORD FilterOffset;
+ };
+};
+
+//lower order bit (HAS_EXCEPTION_INFO_MASK) used to determine if the method has any exception handling
+#define HAS_EXCEPTION_INFO_MASK 1
+
+struct CORCOMPILE_COLD_METHOD_ENTRY
+{
+#ifdef WIN64EXCEPTIONS
+ DWORD mainFunctionEntryRVA;
+#endif
+ // TODO: hotCodeSize should be encoded in GC info
+ ULONG hotCodeSize;
+};
+
+// MVID used by the metadata of all ngen images
+// {70E9452F-5F0A-4f0e-8E02-203992F4221C}
+EXTERN_GUID(NGEN_IMAGE_MVID, 0x70e9452f, 0x5f0a, 0x4f0e, 0x8e, 0x2, 0x20, 0x39, 0x92, 0xf4, 0x22, 0x1c);
+
+typedef GUID CORCOMPILE_NGEN_SIGNATURE;
+
+// To indicate that the dependency is not hardbound
+// {DB15CD8C-1378-4963-9DF3-14D97E95D1A1}
+EXTERN_GUID(INVALID_NGEN_SIGNATURE, 0xdb15cd8c, 0x1378, 0x4963, 0x9d, 0xf3, 0x14, 0xd9, 0x7e, 0x95, 0xd1, 0xa1);
+
+struct CORCOMPILE_ASSEMBLY_SIGNATURE
+{
+ // Metadata MVID.
+ GUID mvid;
+
+ // timestamp and IL image size for the source IL assembly.
+ // This is used for mini-dump to find matching metadata.
+ DWORD timeStamp;
+ DWORD ilImageSize;
+};
+
+typedef enum
+{
+#ifdef FEATURE_CORECLR
+ CORECLR_INFO,
+ CROSSGEN_COMPILER_INFO,
+#else
+ CLR_INFO,
+ NGEN_COMPILER_INFO,
+#endif
+ NUM_RUNTIME_DLLS
+} CorCompileRuntimeDlls;
+
+extern LPCWSTR CorCompileGetRuntimeDllName(CorCompileRuntimeDlls id);
+
+// Will always return a valid HMODULE for CLR_INFO, but will return NULL for NGEN_COMPILER_INFO
+// if the DLL has not yet been loaded (it does not try to cause a load).
+extern HMODULE CorCompileGetRuntimeDll(CorCompileRuntimeDlls id);
+
+struct CORCOMPILE_RUNTIME_DLL_INFO
+{
+ // This structure can only contain information not updated by authenticode signing. It is required
+ // for crossgen to work in buildlab. It particular, it cannot contain PE checksum because of it is
+ // update by authenticode signing.
+ DWORD timeStamp;
+ DWORD virtualSize;
+};
+
+
+
+struct CORCOMPILE_VERSION_INFO
+{
+ // OS
+ WORD wOSPlatformID;
+ WORD wOSMajorVersion;
+
+ // For backward compatibility reasons, the following four fields must start at offset 4,
+ // be consequtive, and be 2 bytes each. See code:PEDecoder::GetMetaDataHelper.
+ // EE Version
+ WORD wVersionMajor;
+ WORD wVersionMinor;
+ WORD wVersionBuildNumber;
+ WORD wVersionPrivateBuildNumber;
+
+ // Codegen flags
+ WORD wCodegenFlags;
+ WORD wConfigFlags;
+ WORD wBuild;
+
+ // Processor
+ WORD wMachine;
+ CORINFO_CPU cpuInfo;
+
+ // Signature of source assembly
+ CORCOMPILE_ASSEMBLY_SIGNATURE sourceAssembly;
+
+ // Signature which identifies this ngen image
+ CORCOMPILE_NGEN_SIGNATURE signature;
+
+ // Timestamp info for runtime dlls
+ CORCOMPILE_RUNTIME_DLL_INFO runtimeDllInfo[NUM_RUNTIME_DLLS];
+};
+
+
+#ifndef FEATURE_CORECLR
+enum CorCompileDependencyInfo
+{
+#ifdef FEATURE_APTCA
+ CORCOMPILE_DEPENDENCY_IS_APTCA = 0x1,
+ CORCOMPILE_DEPENDENCY_IS_CAPTCA = 0x2,
+#endif //FEATURE_APTCA
+
+ CORCOMPILE_DEPENDENCY_PEKIND_MASK = 0xff00,
+ CORCOMPILE_DEPENDENCY_PEKIND_SHIFT = 8,
+};
+#endif //!FEATURE_CORECLR
+
+
+struct CORCOMPILE_DEPENDENCY
+{
+ // Pre-bind Ref
+ mdAssemblyRef dwAssemblyRef;
+
+ // Post-bind Def
+ mdAssemblyRef dwAssemblyDef;
+ CORCOMPILE_ASSEMBLY_SIGNATURE signAssemblyDef;
+
+ CORCOMPILE_NGEN_SIGNATURE signNativeImage; // INVALID_NGEN_SIGNATURE if this a soft-bound dependency
+
+#ifdef FEATURE_APTCA
+ // Win32 version info for tracking dependency references to strong-named assemblies with APTCA
+ ULARGE_INTEGER uliFileVersion; // OS file version ~ NOT assembly version
+#endif //FEATURE_APTCA
+
+#ifndef FEATURE_CORECLR
+ CorCompileDependencyInfo dependencyInfo; //Flags about the dependency
+#endif //!FEATURE_CORECLR
+};
+
+/*********************************************************************************/
+// Flags used to encode HelperTable
+#if defined(_TARGET_ARM64_)
+#define HELPER_TABLE_ENTRY_LEN 16
+#else
+#define HELPER_TABLE_ENTRY_LEN 8
+#endif //defined(_TARGET_ARM64_)
+
+#define HELPER_TABLE_ALIGN 8
+#define CORCOMPILE_HELPER_PTR 0x80000000 // The entry is pointer to the helper (jump thunk otherwise)
+
+// The layout of this struct is required to be
+// a 'next' pointer followed by a CORBBTPROF_METHOD_HEADER
+//
+struct CORCOMPILE_METHOD_PROFILE_LIST
+{
+ CORCOMPILE_METHOD_PROFILE_LIST * next;
+// CORBBTPROF_METHOD_HEADER info;
+
+ CORBBTPROF_METHOD_HEADER * GetInfo()
+ { return (CORBBTPROF_METHOD_HEADER *) (this+1); }
+};
+
+// see code:CorProfileData.GetHotTokens for how we determine what is in hot meta-data.
+class CorProfileData
+{
+public:
+ CorProfileData(void * rawProfileData); // really of type ZapImage::ProfileDataSection*
+
+ struct CORBBTPROF_TOKEN_INFO * GetTokenFlagsData(SectionFormat section)
+ {
+ if (this == NULL)
+ return NULL;
+ return this->profilingTokenFlagsData[section].data;
+ }
+
+ DWORD GetTokenFlagsCount(SectionFormat section)
+ {
+ if (this == NULL)
+ return 0;
+ return this->profilingTokenFlagsData[section].count;
+ }
+
+ CORBBTPROF_BLOB_ENTRY * GetBlobStream()
+ {
+ if (this == NULL)
+ return NULL;
+ return this->blobStream;
+ }
+
+
+ // see code:MetaData::HotMetaDataHeader for details on reading hot meta-data
+ //
+ // for detail on where we use the API to store the hot meta data
+ // * code:CMiniMdRW.SaveFullTablesToStream#WritingHotMetaData
+ // * code:CMiniMdRW.SaveHotPoolsToStream
+ // * code:CMiniMdRW.SaveHotPoolToStream#CallToGetHotTokens
+ //
+ ULONG GetHotTokens(int table, DWORD mask, DWORD hotValue, mdToken *tokenBuffer, ULONG maxCount)
+ {
+ ULONG count = 0;
+ SectionFormat format = (SectionFormat)(FirstTokenFlagSection + table);
+
+ CORBBTPROF_TOKEN_INFO *profilingData = profilingTokenFlagsData[format].data;
+ DWORD cProfilingData = profilingTokenFlagsData[format].count;
+
+ if (profilingData != NULL)
+ {
+ for (DWORD i = 0; i < cProfilingData; i++)
+ {
+ if ((profilingData[i].flags & mask) == hotValue)
+ {
+ if (tokenBuffer != NULL && count < maxCount)
+ tokenBuffer[count] = profilingData[i].token;
+ count++;
+ }
+ }
+ }
+ return count;
+ }
+
+ //
+ // Token lookup methods
+ //
+ ULONG GetTypeProfilingFlagsOfToken(mdToken token)
+ {
+ _ASSERTE(TypeFromToken(token) == mdtTypeDef);
+ return GetProfilingFlagsOfToken(token);
+ }
+
+ CORBBTPROF_BLOB_PARAM_SIG_ENTRY *GetBlobSigEntry(mdToken token)
+ {
+ _ASSERTE((TypeFromToken(token) == ibcTypeSpec) || (TypeFromToken(token) == ibcMethodSpec));
+
+ CORBBTPROF_BLOB_ENTRY * pBlobEntry = GetBlobEntry(token);
+ if (pBlobEntry == NULL)
+ return NULL;
+
+ _ASSERTE(pBlobEntry->token == token);
+ _ASSERTE((pBlobEntry->type == ParamTypeSpec) || (pBlobEntry->type == ParamMethodSpec));
+
+ return (CORBBTPROF_BLOB_PARAM_SIG_ENTRY *) pBlobEntry;
+ }
+
+ CORBBTPROF_BLOB_NAMESPACE_DEF_ENTRY *GetBlobExternalNamespaceDef(mdToken token)
+ {
+ _ASSERTE(TypeFromToken(token) == ibcExternalNamespace);
+
+ CORBBTPROF_BLOB_ENTRY * pBlobEntry = GetBlobEntry(token);
+ if (pBlobEntry == NULL)
+ return NULL;
+
+ _ASSERTE(pBlobEntry->token == token);
+ _ASSERTE(pBlobEntry->type == ExternalNamespaceDef);
+
+ return (CORBBTPROF_BLOB_NAMESPACE_DEF_ENTRY *) pBlobEntry;
+ }
+
+ CORBBTPROF_BLOB_TYPE_DEF_ENTRY *GetBlobExternalTypeDef(mdToken token)
+ {
+ _ASSERTE(TypeFromToken(token) == ibcExternalType);
+
+ CORBBTPROF_BLOB_ENTRY * pBlobEntry = GetBlobEntry(token);
+ if (pBlobEntry == NULL)
+ return NULL;
+
+ _ASSERTE(pBlobEntry->token == token);
+ _ASSERTE(pBlobEntry->type == ExternalTypeDef);
+
+ return (CORBBTPROF_BLOB_TYPE_DEF_ENTRY *) pBlobEntry;
+ }
+
+ CORBBTPROF_BLOB_SIGNATURE_DEF_ENTRY *GetBlobExternalSignatureDef(mdToken token)
+ {
+ _ASSERTE(TypeFromToken(token) == ibcExternalSignature);
+
+ CORBBTPROF_BLOB_ENTRY * pBlobEntry = GetBlobEntry(token);
+ if (pBlobEntry == NULL)
+ return NULL;
+
+ _ASSERTE(pBlobEntry->token == token);
+ _ASSERTE(pBlobEntry->type == ExternalSignatureDef);
+
+ return (CORBBTPROF_BLOB_SIGNATURE_DEF_ENTRY *) pBlobEntry;
+ }
+
+ CORBBTPROF_BLOB_METHOD_DEF_ENTRY *GetBlobExternalMethodDef(mdToken token)
+ {
+ _ASSERTE(TypeFromToken(token) == ibcExternalMethod);
+
+ CORBBTPROF_BLOB_ENTRY * pBlobEntry = GetBlobEntry(token);
+ if (pBlobEntry == NULL)
+ return NULL;
+
+ _ASSERTE(pBlobEntry->token == token);
+ _ASSERTE(pBlobEntry->type == ExternalMethodDef);
+
+ return (CORBBTPROF_BLOB_METHOD_DEF_ENTRY *) pBlobEntry;
+ }
+
+private:
+ ULONG GetProfilingFlagsOfToken(mdToken token)
+ {
+ SectionFormat section = (SectionFormat)((TypeFromToken(token) >> 24) + FirstTokenFlagSection);
+
+ CORBBTPROF_TOKEN_INFO *profilingData = this->profilingTokenFlagsData[section].data;
+ DWORD cProfilingData = this->profilingTokenFlagsData[section].count;
+
+ if (profilingData != NULL)
+ {
+ for (DWORD i = 0; i < cProfilingData; i++)
+ {
+ if (profilingData[i].token == token)
+ return profilingData[i].flags;
+ }
+ }
+ return 0;
+ }
+
+ CORBBTPROF_BLOB_ENTRY *GetBlobEntry(idTypeSpec token)
+ {
+ CORBBTPROF_BLOB_ENTRY * pBlobEntry = this->GetBlobStream();
+ if (pBlobEntry == NULL)
+ return NULL;
+
+ while (pBlobEntry->TypeIsValid())
+ {
+ if (pBlobEntry->token == token)
+ {
+ return pBlobEntry;
+ }
+ pBlobEntry = pBlobEntry->GetNextEntry();
+ }
+
+ return NULL;
+ }
+
+private:
+ struct
+ {
+ struct CORBBTPROF_TOKEN_INFO *data;
+ DWORD count;
+ }
+ profilingTokenFlagsData[SectionFormatCount];
+
+ CORBBTPROF_BLOB_ENTRY* blobStream;
+};
+
+/*********************************************************************************/
+// IL region is used to group frequently used IL method bodies together
+
+enum CorCompileILRegion
+{
+ CORCOMPILE_ILREGION_INLINEABLE, // Public inlineable methods
+ CORCOMPILE_ILREGION_WARM, // Other inlineable methods and methods that failed to NGen
+ CORCOMPILE_ILREGION_GENERICS, // Generic methods (may be needed to compile non-NGened instantiations)
+ CORCOMPILE_ILREGION_COLD, // Everything else (should be touched in rare scenarios like reflection or profiling only)
+ CORCOMPILE_ILREGION_COUNT,
+};
+
+/*********************************************************************************
+ * ICorCompilePreloader is used to query preloaded EE data structures
+ *********************************************************************************/
+
+class ICorCompilePreloader
+{
+ public:
+ typedef void (__stdcall *CORCOMPILE_CompileStubCallback)(LPVOID pContext, CORINFO_METHOD_HANDLE hStub, DWORD dwJitFlags);
+
+ //
+ // Map methods are available after Serialize() is called
+ // (which will cause it to allocate its data.) Note that returned
+ // results are RVAs into the image.
+ //
+ // If compiling after serializing the preloaded image, these methods can
+ // be used to avoid making entries in the various info tables.
+ // Else, use ICorCompileInfo::CanEmbedXXX()
+ //
+
+ virtual DWORD MapMethodEntryPoint(
+ CORINFO_METHOD_HANDLE handle
+ ) = 0;
+
+ virtual DWORD MapClassHandle(
+ CORINFO_CLASS_HANDLE handle
+ ) = 0;
+
+ virtual DWORD MapMethodHandle(
+ CORINFO_METHOD_HANDLE handle
+ ) = 0;
+
+ virtual DWORD MapFieldHandle(
+ CORINFO_FIELD_HANDLE handle
+ ) = 0;
+
+ virtual DWORD MapAddressOfPInvokeFixup(
+ CORINFO_METHOD_HANDLE handle
+ ) = 0;
+
+ virtual DWORD MapGenericHandle(
+ CORINFO_GENERIC_HANDLE handle
+ ) = 0;
+
+ virtual DWORD MapModuleIDHandle(
+ CORINFO_MODULE_HANDLE handle
+ ) = 0;
+
+ // Load a method for the specified method def
+ // If the class or method is generic, instantiate all parameters with <object>
+ virtual CORINFO_METHOD_HANDLE LookupMethodDef(mdMethodDef token) = 0;
+
+ // Returns region that the IL should be emitted in
+ virtual CorCompileILRegion GetILRegion(mdMethodDef token) = 0;
+
+ // Find the (parameterized) type for the given blob from the profile data
+ virtual CORINFO_CLASS_HANDLE FindTypeForProfileEntry(CORBBTPROF_BLOB_PARAM_SIG_ENTRY * profileBlobEntry) = 0;
+
+ // Find the (parameterized) method for the given blob from the profile data
+ virtual CORINFO_METHOD_HANDLE FindMethodForProfileEntry(CORBBTPROF_BLOB_PARAM_SIG_ENTRY * profileBlobEntry) = 0;
+
+ virtual void ReportInlining(CORINFO_METHOD_HANDLE inliner, CORINFO_METHOD_HANDLE inlinee) = 0;
+
+ //
+ // Call Link when you want all the fixups
+ // to be applied. You may call this e.g. after
+ // compiling all the code for the module.
+ // Return some stats about the types in the ngen image
+ //
+ virtual void Link() = 0;
+
+ virtual void FixupRVAs() = 0;
+
+ virtual void SetRVAsForFields(IMetaDataEmit * pEmit) = 0;
+
+ virtual void GetRVAFieldData(mdFieldDef fd, PVOID * ppData, DWORD * pcbSize, DWORD * pcbAlignment) = 0;
+
+ // The preloader also maintains a set of uncompiled generic
+ // methods or methods in generic classes. A single method can be
+ // registered or all the methods in a class can be registered.
+ // The method is added to the set only if it should be compiled
+ // into this ngen image
+ //
+ // The zapper registers methods and classes that are resolved by
+ // findClass and findMethod during compilation
+ virtual void AddMethodToTransitiveClosureOfInstantiations(CORINFO_METHOD_HANDLE handle) = 0;
+ virtual void AddTypeToTransitiveClosureOfInstantiations(CORINFO_CLASS_HANDLE handle) = 0;
+
+ // Report reference to the given method from compiled code
+ virtual void MethodReferencedByCompiledCode(CORINFO_METHOD_HANDLE handle) = 0;
+
+ virtual BOOL IsUncompiledMethod(CORINFO_METHOD_HANDLE handle) = 0;
+
+ // Return a method handle that was previously registered and
+ // hasn't been compiled already, and remove it from the set
+ // of uncompiled methods.
+ // Return NULL if the set is empty
+ virtual CORINFO_METHOD_HANDLE NextUncompiledMethod() = 0;
+
+ // Prepare a method and its statically determinable call graph if
+ // a hint attribute has been applied. This is called to save
+ // additional preparation information into the ngen image that
+ // wouldn't normally be there (since we can't automatically
+ // determine it's needed).
+ virtual void PrePrepareMethodIfNecessary(CORINFO_METHOD_HANDLE hMethod) = 0;
+
+ // If a method requires stubs, this will call back passing method
+ // handles for those stubs.
+ virtual void GenerateMethodStubs(
+ CORINFO_METHOD_HANDLE hMethod,
+ bool fNgenProfileImage,
+ CORCOMPILE_CompileStubCallback pfnCallback,
+ LPVOID pCallbackContext) = 0;
+
+ // Determines whether or not a method is a dynamic method. This is used
+ // to prevent operations that may require metadata knowledge at times other
+ // than compile time.
+ virtual bool IsDynamicMethod(CORINFO_METHOD_HANDLE hMethod) = 0;
+
+ // Set method profiling flags for layout of EE datastructures
+ virtual void SetMethodProfilingFlags(CORINFO_METHOD_HANDLE hMethod, DWORD flags) = 0;
+
+ // Returns false if precompiled code must ensure that
+ // the EE's DoPrestub function gets run before the
+ // code for the method is used, i.e. if it returns false
+ // then an indirect call must be made.
+ //
+ // Returning true does not guaratee that a direct call can be made:
+ // there can be other reasons why the entry point cannot be embedded.
+ //
+ virtual bool CanSkipMethodPreparation (
+ CORINFO_METHOD_HANDLE callerHnd, /* IN */
+ CORINFO_METHOD_HANDLE calleeHnd, /* IN */
+ CorInfoIndirectCallReason *pReason = NULL,
+ CORINFO_ACCESS_FLAGS accessFlags = CORINFO_ACCESS_ANY) = 0;
+
+ virtual BOOL CanEmbedModuleHandle(
+ CORINFO_MODULE_HANDLE moduleHandle) = 0;
+
+ // These check if we can hardbind to a handle. They guarantee either that
+ // the structure referred to by the handle is in a referenced zapped image
+ // or will be saved into the module currently being zapped. That is the
+ // corresponding GetLoaderModuleForEmeddableXYZ call will return
+ // either the module currently being zapped or a referenced zapped module.
+ virtual BOOL CanEmbedClassID(CORINFO_CLASS_HANDLE typeHandle) = 0;
+ virtual BOOL CanEmbedModuleID(CORINFO_MODULE_HANDLE moduleHandle) = 0;
+ virtual BOOL CanEmbedClassHandle(CORINFO_CLASS_HANDLE typeHandle) = 0;
+ virtual BOOL CanEmbedMethodHandle(CORINFO_METHOD_HANDLE methodHandle, CORINFO_METHOD_HANDLE contextHandle = NULL) = 0;
+ virtual BOOL CanEmbedFieldHandle(CORINFO_FIELD_HANDLE fieldHandle) = 0;
+
+ // Return true if we can both embed a direct hardbind to the handle _and_
+ // no "restore" action is needed on the handle. Equivalent to "CanEmbed + Prerestored".
+ //
+ // Typically a handle needs runtime restore it has embedded cross-module references
+ // or other data that cannot be persisted directly.
+ virtual BOOL CanPrerestoreEmbedClassHandle(
+ CORINFO_CLASS_HANDLE classHnd) = 0;
+
+ // Return true if a method needs runtime restore
+ // This is only the case if it is instantiated and any of its type arguments need restoring.
+ virtual BOOL CanPrerestoreEmbedMethodHandle(
+ CORINFO_METHOD_HANDLE methodHnd) = 0;
+
+ // Can a method entry point be embedded?
+ virtual BOOL CanEmbedFunctionEntryPoint(
+ CORINFO_METHOD_HANDLE methodHandle,
+ CORINFO_METHOD_HANDLE contextHandle = NULL,
+ CORINFO_ACCESS_FLAGS accessFlags = CORINFO_ACCESS_ANY
+ ) = 0;
+
+ // Prestub is not able to handle method restore in all cases for generics.
+ // If it is the case the method has to be restored explicitly upfront.
+ // See the comment inside the implemenation method for more details.
+ virtual BOOL DoesMethodNeedRestoringBeforePrestubIsRun(
+ CORINFO_METHOD_HANDLE methodHandle
+ ) = 0;
+
+ // Returns true if the given activation fixup is not necessary
+ virtual BOOL CanSkipDependencyActivation(
+ CORINFO_METHOD_HANDLE context,
+ CORINFO_MODULE_HANDLE moduleFrom,
+ CORINFO_MODULE_HANDLE moduleTo) = 0;
+
+ virtual CORINFO_MODULE_HANDLE GetPreferredZapModuleForClassHandle(
+ CORINFO_CLASS_HANDLE classHnd
+ ) = 0;
+
+ virtual void NoteDeduplicatedCode(
+ CORINFO_METHOD_HANDLE method,
+ CORINFO_METHOD_HANDLE duplicateMethod) = 0;
+
+ //
+ // Release frees the preloader
+ //
+
+ virtual ULONG Release() = 0;
+};
+
+//
+// The DataImage provides several "sections", which can be used
+// to sort data into different sets for locality control. The Arrange
+// phase is responsible for placing items into sections.
+//
+
+#define CORCOMPILE_SECTIONS() \
+ CORCOMPILE_SECTION(MODULE) \
+ CORCOMPILE_SECTION(WRITE) \
+ CORCOMPILE_SECTION(METHOD_PRECODE_WRITE) \
+ CORCOMPILE_SECTION(HOT_WRITEABLE) \
+ CORCOMPILE_SECTION(WRITEABLE) \
+ CORCOMPILE_SECTION(HOT) \
+ CORCOMPILE_SECTION(METHOD_PRECODE_HOT) \
+ CORCOMPILE_SECTION(RVA_STATICS_HOT) \
+ CORCOMPILE_SECTION(RVA_STATICS_COLD) \
+ CORCOMPILE_SECTION(WARM) \
+ CORCOMPILE_SECTION(READONLY_SHARED_HOT) \
+ CORCOMPILE_SECTION(READONLY_HOT) \
+ CORCOMPILE_SECTION(READONLY_WARM) \
+ CORCOMPILE_SECTION(READONLY_COLD) \
+ CORCOMPILE_SECTION(CLASS_COLD) \
+ CORCOMPILE_SECTION(CROSS_DOMAIN_INFO) \
+ CORCOMPILE_SECTION(METHOD_PRECODE_COLD) \
+ CORCOMPILE_SECTION(METHOD_PRECODE_COLD_WRITEABLE) \
+ CORCOMPILE_SECTION(METHOD_DESC_COLD) \
+ CORCOMPILE_SECTION(METHOD_DESC_COLD_WRITEABLE) \
+ CORCOMPILE_SECTION(MODULE_COLD) \
+ CORCOMPILE_SECTION(DEBUG_COLD) \
+ CORCOMPILE_SECTION(COMPRESSED_MAPS) \
+
+enum CorCompileSection
+{
+#define CORCOMPILE_SECTION(section) CORCOMPILE_SECTION_##section,
+ CORCOMPILE_SECTIONS()
+#undef CORCOMPILE_SECTION
+
+ CORCOMPILE_SECTION_COUNT
+};
+
+enum VerboseLevel
+{
+ CORCOMPILE_NO_LOG,
+ CORCOMPILE_STATS,
+ CORCOMPILE_VERBOSE
+};
+
+class ZapImage;
+
+// When NGEN install /Profile is run, the ZapProfilingHandleImport fixup table contains
+// these 5 values per MethodDesc
+enum
+{
+ kZapProfilingHandleImportValueIndexFixup = 0,
+ kZapProfilingHandleImportValueIndexEnterAddr = 1,
+ kZapProfilingHandleImportValueIndexLeaveAddr = 2,
+ kZapProfilingHandleImportValueIndexTailcallAddr = 3,
+ kZapProfilingHandleImportValueIndexClientData = 4,
+
+ kZapProfilingHandleImportValueIndexCount
+};
+
+class ICorCompileDataStore
+{
+ public:
+ // Returns ZapImage
+ virtual ZapImage * GetZapImage() = 0;
+
+ // Reports an error during preloading. Return the error code to propagate,
+ // or S_OK to ignore the error
+ virtual void Error(mdToken token, HRESULT hr, LPCWSTR description) = 0;
+};
+
+
+class ICorCompilationDomain
+{
+ public:
+
+ // Sets the application context for fusion
+ // to use when binding, using a shell exe file path
+ virtual HRESULT SetContextInfo(
+ LPCWSTR path,
+ BOOL isExe
+ ) = 0;
+
+ // Retrieves the dependencies of the code which
+ // has been compiled
+ virtual HRESULT GetDependencies(
+ CORCOMPILE_DEPENDENCY **ppDependencies,
+ DWORD *cDependencies
+ ) = 0;
+
+#ifdef FEATURE_FUSION
+ // Use to retrieve the IBindContext to be used by the native binder.
+ // This is typically passed into InstallNativeAssembly.
+ virtual HRESULT GetIBindContext(
+ IBindContext **ppBindCtx
+ ) = 0;
+#endif
+
+#ifdef CROSSGEN_COMPILE
+ virtual HRESULT SetPlatformWinmdPaths(
+ LPCWSTR pwzPlatformWinmdPaths
+ ) = 0;
+#endif
+};
+
+/*********************************************************************************
+ * ICorCompileInfo is the interface for a compiler
+ *********************************************************************************/
+
+// Define function pointer ENCODEMODULE_CALLBACK
+typedef DWORD (__stdcall *ENCODEMODULE_CALLBACK)(LPVOID pModuleContext, CORINFO_MODULE_HANDLE moduleHandle);
+
+// Define function pointer DEFINETOKEN_CALLBACK
+typedef void (__stdcall *DEFINETOKEN_CALLBACK)(LPVOID pModuleContext, CORINFO_MODULE_HANDLE moduleHandle, DWORD index, mdTypeRef* token);
+
+typedef HRESULT (__stdcall *CROSS_DOMAIN_CALLBACK)(LPVOID pArgs);
+
+class ICorCompileInfo
+{
+ public:
+
+
+ //
+ // Currently no other instance of the EE may be running inside
+ // a process that is used as an NGEN compilation process.
+ //
+ // So, the host must call StartupAsCompilationProcess before compiling
+ // any code, and Shutdown after finishing.
+ //
+ // The arguments control which native image of mscorlib to use.
+ // This matters for hardbinding.
+ //
+
+ virtual HRESULT Startup(
+ BOOL fForceDebug,
+ BOOL fForceProfiling,
+ BOOL fForceInstrument) = 0;
+
+ // Creates a new compilation domain
+ // The BOOL arguments control what kind of a native image is
+ // to be generated. Other factors affect what kind of a native image
+ // will actually be generated. GetAssemblyVersionInfo() ultimately reflects
+ // the kind of native image that will be generated
+ //
+ // pEmitter - sets this as the emitter to use when generating tokens for
+ // the dependency list. If this is NULL, dependencies won't be computed.
+
+ virtual HRESULT CreateDomain(
+ ICorCompilationDomain **ppDomain, // [OUT]
+ IMetaDataAssemblyEmit *pEmitter,
+ BOOL fForceDebug,
+ BOOL fForceProfiling,
+ BOOL fForceInstrument,
+ BOOL fForceFulltrustDomain
+ ) = 0;
+
+ // calls pfnCallback in the specified domain
+ virtual HRESULT MakeCrossDomainCallback(
+ ICorCompilationDomain* pDomain,
+ CROSS_DOMAIN_CALLBACK pfnCallback,
+ LPVOID pArgs
+ ) = 0;
+
+ // Destroys a compilation domain
+ virtual HRESULT DestroyDomain(
+ ICorCompilationDomain *pDomain
+ ) = 0;
+
+ // Loads an assembly manifest module into the EE
+ // and returns a handle to it.
+ virtual HRESULT LoadAssemblyByPath(
+ LPCWSTR wzPath,
+ BOOL fExplicitBindToNativeImage,
+ CORINFO_ASSEMBLY_HANDLE *pHandle
+ ) = 0;
+
+#ifdef FEATURE_FUSION
+ // Loads an assembly via fusion into the EE
+ // and returns a handle to it.
+ virtual HRESULT LoadAssemblyByName(
+ LPCWSTR wzName,
+ CORINFO_ASSEMBLY_HANDLE *pHandle
+ ) = 0;
+
+ // Loads an assembly via ref into the EE
+ // and returns a handle to it. The last parameter
+ // optionally allows an IAssemblyName for the ref
+ // (pre-policy) to be returned
+ virtual HRESULT LoadAssemblyRef(
+ IMDInternalImport *pAssemblyImport,
+ mdAssemblyRef ref,
+ CORINFO_ASSEMBLY_HANDLE *pHandle,
+ IAssemblyName **refAssemblyName = NULL
+ ) = 0;
+
+ // Loads an assembly via its IAssemblyName. This is
+ // used by NGEN createpdb when generating PDBs for AutoNGENd images (it reads the
+ // IAssemblyName from the AUX file).
+ virtual HRESULT LoadAssemblyByIAssemblyName(
+ IAssemblyName *pAssemblyName,
+ CORINFO_ASSEMBLY_HANDLE *pHandle
+ ) = 0;
+
+#endif //FEATURE_FUSION
+
+#ifdef FEATURE_COMINTEROP
+ // Loads a WinRT typeref into the EE and returns
+ // a handle to it. We have to load all typerefs
+ // during dependency computation since assemblyrefs
+ // are meaningless to WinRT.
+ virtual HRESULT LoadTypeRefWinRT(
+ IMDInternalImport *pAssemblyImport,
+ mdTypeRef ref,
+ CORINFO_ASSEMBLY_HANDLE *pHandle
+ ) = 0;
+#endif
+
+ virtual BOOL IsInCurrentVersionBubble(CORINFO_MODULE_HANDLE hModule) = 0;
+
+ // Loads a module from an assembly into the EE
+ // and returns a handle to it.
+ virtual HRESULT LoadAssemblyModule(
+ CORINFO_ASSEMBLY_HANDLE assembly,
+ mdFile file,
+ CORINFO_MODULE_HANDLE *pHandle
+ ) = 0;
+
+#ifndef FEATURE_CORECLR
+ // Check if the assembly supports automatic NGen
+ virtual BOOL SupportsAutoNGen(
+ CORINFO_ASSEMBLY_HANDLE assembly
+ ) = 0;
+
+ // Tell OS to set cached signing level of the native image based on input assemblies
+ virtual HRESULT SetCachedSigningLevel(
+ HANDLE hNI,
+ HANDLE *pModules,
+ COUNT_T nModules
+ ) = 0;
+#endif
+
+ // Checks to see if an up to date zap exists for the
+ // assembly
+ virtual BOOL CheckAssemblyZap(
+ CORINFO_ASSEMBLY_HANDLE assembly,
+ __out_ecount_opt(*cAssemblyManifestModulePath)
+ LPWSTR assemblyManifestModulePath,
+ LPDWORD cAssemblyManifestModulePath
+ ) = 0;
+
+ // Sets up the compilation target in the EE
+ virtual HRESULT SetCompilationTarget(
+ CORINFO_ASSEMBLY_HANDLE assembly,
+ CORINFO_MODULE_HANDLE module
+ ) = 0;
+
+#ifdef FEATURE_FUSION
+ enum GetAssemblyNameFlags
+ {
+ GANF_Default = 0,
+ GANF_Simple = 1,
+ };
+
+ // Returns the fusion name of an assembly
+ virtual HRESULT GetAssemblyName(
+ CORINFO_ASSEMBLY_HANDLE hAssembly,
+ DWORD dwFlags,
+ __out_ecount(*cchAssemblyName)
+ __out_z LPWSTR wzAssemblyName,
+ LPDWORD cchAssemblyName
+ ) = 0;
+#endif //FEATURE_FUSION
+
+ // Returns the dependency load setting for an assembly ref
+ virtual HRESULT GetLoadHint(
+ CORINFO_ASSEMBLY_HANDLE hAssembly,
+ CORINFO_ASSEMBLY_HANDLE hAssemblyDependency,
+ LoadHintEnum *loadHint,
+ LoadHintEnum *defaultLoadHint = NULL
+ ) = 0;
+
+ // Returns information on how the assembly has been loaded
+ virtual HRESULT GetAssemblyVersionInfo(
+ CORINFO_ASSEMBLY_HANDLE hAssembly,
+ CORCOMPILE_VERSION_INFO *pInfo
+ ) = 0;
+
+ // Returns the manifest metadata for an assembly
+ // Use the internal IMDInternalImport for performance.
+ // Creation of the public IMetaDataImport * triggers
+ // conversion to R/W metadata that slows down all subsequent accesses.
+ virtual IMDInternalImport * GetAssemblyMetaDataImport(
+ CORINFO_ASSEMBLY_HANDLE assembly
+ ) = 0;
+
+ // Returns an interface to query the metadata for a loaded module
+ // Use the internal IMDInternalImport for performance.
+ // Creation of the public IMetaDataAssemblyImport * triggers
+ // conversion to R/W metadata that slows down all subsequent accesses.
+ virtual IMDInternalImport * GetModuleMetaDataImport(
+ CORINFO_MODULE_HANDLE module
+ ) = 0;
+
+ // Returns the module of the assembly which contains the manifest,
+ // or NULL if the manifest is standalone.
+ virtual CORINFO_MODULE_HANDLE GetAssemblyModule(
+ CORINFO_ASSEMBLY_HANDLE assembly
+ ) = 0;
+
+ // Returns the assembly of a loaded module
+ virtual CORINFO_ASSEMBLY_HANDLE GetModuleAssembly(
+ CORINFO_MODULE_HANDLE module
+ ) = 0;
+
+ // Returns the current PEDecoder of a loaded module.
+ virtual PEDecoder * GetModuleDecoder(
+ CORINFO_MODULE_HANDLE module
+ ) = 0;
+
+ // Gets the full file name, including path, of a loaded module
+ virtual void GetModuleFileName(
+ CORINFO_MODULE_HANDLE module,
+ SString &result
+ ) = 0;
+
+ // Get a class def token
+ virtual HRESULT GetTypeDef(
+ CORINFO_CLASS_HANDLE classHandle,
+ mdTypeDef *token
+ ) = 0;
+
+ // Get a method def token
+ virtual HRESULT GetMethodDef(
+ CORINFO_METHOD_HANDLE methodHandle,
+ mdMethodDef *token
+ ) = 0;
+
+ // Get a field def token
+ virtual HRESULT GetFieldDef(
+ CORINFO_FIELD_HANDLE fieldHandle,
+ mdFieldDef *token
+ ) = 0;
+
+ // Get the loader module for mscorlib
+ virtual CORINFO_MODULE_HANDLE GetLoaderModuleForMscorlib() = 0;
+
+ // Get the loader module for a type (where the type is regarded as
+ // living for the purposes of loading, unloading, and ngen).
+ //
+ // classHandle must have passed CanEmbedClassHandle, since the zapper
+ // should only care about the module where a type
+ // prefers to be saved if it knows that that module is either
+ // an zapped module or is the module currently being compiled.
+ // See vm\ceeload.h for more information
+ virtual CORINFO_MODULE_HANDLE GetLoaderModuleForEmbeddableType(
+ CORINFO_CLASS_HANDLE classHandle
+ ) = 0;
+
+ // Get the loader module for a method (where the method is regarded as
+ // living for the purposes of loading, unloading, and ngen)
+ //
+ // methodHandle must have passed CanEmbedMethodHandle, since the zapper
+ // should only care about the module where a type
+ // prefers to be saved if it knows that that module is either
+ // an zapped module or is the module currently being compiled.
+ // See vm\ceeload.h for more information
+ virtual CORINFO_MODULE_HANDLE GetLoaderModuleForEmbeddableMethod(
+ CORINFO_METHOD_HANDLE methodHandle
+ ) = 0;
+
+ // Get the loader module for a method (where the method is regarded as
+ // living for the purposes of loading, unloading, and ngen)
+ // See vm\ceeload.h for more information
+ virtual CORINFO_MODULE_HANDLE GetLoaderModuleForEmbeddableField(
+ CORINFO_FIELD_HANDLE fieldHandle
+ ) = 0;
+
+ // Set the list of assemblies we can hard bind to
+ virtual void SetAssemblyHardBindList(
+ __in_ecount(cHardBindList)
+ LPWSTR * pHardBindList,
+ DWORD cHardBindList
+ ) = 0;
+
+ // Encode a module for the imports table
+ virtual void EncodeModuleAsIndexes(
+ CORINFO_MODULE_HANDLE fromHandle,
+ CORINFO_MODULE_HANDLE handle,
+ DWORD *pAssemblyIndex,
+ DWORD *pModuleIndex,
+ IMetaDataAssemblyEmit *pAssemblyEmit) = 0;
+
+
+ // Encode a class into the given SigBuilder.
+ virtual void EncodeClass(
+ CORINFO_MODULE_HANDLE referencingModule,
+ CORINFO_CLASS_HANDLE classHandle,
+ SigBuilder * pSigBuilder,
+ LPVOID encodeContext,
+ ENCODEMODULE_CALLBACK pfnEncodeModule) = 0;
+
+ // Encode a method into the given SigBuilder.
+ virtual void EncodeMethod(
+ CORINFO_MODULE_HANDLE referencingModule,
+ CORINFO_METHOD_HANDLE handle,
+ SigBuilder * pSigBuilder,
+ LPVOID encodeContext,
+ ENCODEMODULE_CALLBACK pfnEncodeModule,
+ CORINFO_RESOLVED_TOKEN * pResolvedToken = NULL,
+ CORINFO_RESOLVED_TOKEN * pConstrainedResolvedToken = NULL,
+ BOOL fEncodeUsingResolvedTokenSpecStreams = FALSE) = 0;
+
+ // Returns non-null methoddef or memberref token if it is sufficient to encode the method (no generic instantiations, etc.)
+ virtual mdToken TryEncodeMethodAsToken(
+ CORINFO_METHOD_HANDLE handle,
+ CORINFO_RESOLVED_TOKEN * pResolvedToken,
+ CORINFO_MODULE_HANDLE * referencingModule) = 0;
+
+ // Returns method slot (for encoding virtual stub dispatch)
+ virtual DWORD TryEncodeMethodSlot(
+ CORINFO_METHOD_HANDLE handle) = 0;
+
+ // Encode a field into the given SigBuilder.
+ virtual void EncodeField(
+ CORINFO_MODULE_HANDLE referencingModule,
+ CORINFO_FIELD_HANDLE handle,
+ SigBuilder * pSigBuilder,
+ LPVOID encodeContext,
+ ENCODEMODULE_CALLBACK pfnEncodeModule,
+ CORINFO_RESOLVED_TOKEN * pResolvedToken = NULL,
+ BOOL fEncodeUsingResolvedTokenSpecStreams = FALSE) = 0;
+
+
+ // Encode generic dictionary signature
+ virtual void EncodeGenericSignature(
+ LPVOID signature,
+ BOOL fMethod,
+ SigBuilder * pSigBuilder,
+ LPVOID encodeContext,
+ ENCODEMODULE_CALLBACK pfnEncodeModule) = 0;
+
+
+ virtual BOOL IsEmptyString(
+ mdString token,
+ CORINFO_MODULE_HANDLE module) = 0;
+
+
+ // Preload a modules' EE data structures
+ // directly into an executable image
+
+ virtual ICorCompilePreloader * PreloadModule(
+ CORINFO_MODULE_HANDLE moduleHandle,
+ ICorCompileDataStore *pData,
+ CorProfileData *profileData
+ ) = 0;
+
+ // Gets the codebase URL for the assembly
+ virtual void GetAssemblyCodeBase(
+ CORINFO_ASSEMBLY_HANDLE hAssembly,
+ SString &result) = 0;
+
+ // Returns the GC-information for a method. This is the simple representation
+ // and can be used when a code that can trigger a GC does not have access
+ // to the CORINFO_METHOD_HANDLE (which is normally used to access the GC information)
+ //
+ // Returns S_FALSE if there is no simple representation for the method's GC info
+ //
+ virtual void GetCallRefMap(
+ CORINFO_METHOD_HANDLE hMethod,
+ GCRefMapBuilder * pBuilder) = 0;
+
+ // Returns a compressed block of debug information
+ //
+ // Uncompressed debug maps are passed in.
+ // Writes to outgoing SBuffer.
+ // Throws on failure.
+ virtual void CompressDebugInfo(
+ IN ICorDebugInfo::OffsetMapping * pOffsetMapping,
+ IN ULONG iOffsetMapping,
+ IN ICorDebugInfo::NativeVarInfo * pNativeVarInfo,
+ IN ULONG iNativeVarInfo,
+ IN OUT SBuffer * pDebugInfoBuffer
+ ) = 0;
+
+
+
+ // Allows to set verbose level for log messages, enabled in retail build too for stats
+ virtual HRESULT SetVerboseLevel(
+ IN VerboseLevel level) = 0;
+
+ // Get the compilation flags that are shared between JIT and NGen
+ virtual HRESULT GetBaseJitFlags(
+ IN CORINFO_METHOD_HANDLE hMethod,
+ OUT DWORD *pFlags) = 0;
+
+ // needed for stubs to obtain the number of bytes to copy into the native image
+ // return the beginning of the stub and the size to copy (in bytes)
+ virtual void* GetStubSize(void *pStubAddress, DWORD *pSizeToCopy) = 0;
+
+ // Takes a stub and blits it into the buffer, resetting the reference count
+ // to 1 on the clone. The buffer has to be large enough to hold the stub object and the code
+ virtual HRESULT GetStubClone(void *pStub, BYTE *pBuffer, DWORD dwBufferSize) = 0;
+
+ // true if the method has [NativeCallableAttribute]
+ virtual BOOL IsNativeCallableMethod(CORINFO_METHOD_HANDLE handle) = 0;
+
+ virtual BOOL GetIsGeneratingNgenPDB() = 0;
+ virtual void SetIsGeneratingNgenPDB(BOOL fGeneratingNgenPDB) = 0;
+
+#ifdef FEATURE_READYTORUN_COMPILER
+ virtual CORCOMPILE_FIXUP_BLOB_KIND GetFieldBaseOffset(
+ CORINFO_CLASS_HANDLE classHnd,
+ DWORD * pBaseOffset
+ ) = 0;
+
+ virtual BOOL NeedsTypeLayoutCheck(CORINFO_CLASS_HANDLE classHnd) = 0;
+ virtual void EncodeTypeLayout(CORINFO_CLASS_HANDLE classHandle, SigBuilder * pSigBuilder) = 0;
+
+ virtual BOOL AreAllClassesFullyLoaded(CORINFO_MODULE_HANDLE moduleHandle) = 0;
+
+ virtual int GetVersionResilientTypeHashCode(CORINFO_MODULE_HANDLE moduleHandle, mdToken token) = 0;
+
+ virtual int GetVersionResilientMethodHashCode(CORINFO_METHOD_HANDLE methodHandle) = 0;
+#endif
+
+ virtual BOOL HasCustomAttribute(CORINFO_METHOD_HANDLE method, LPCSTR customAttributeName) = 0;
+};
+
+/*****************************************************************************/
+// This function determines the compile flags to use for a generic intatiation
+// since only the open instantiation can be verified.
+// See the comment associated with CORJIT_FLG_SKIP_VERIFICATION for details.
+//
+// On return:
+// if *raiseVerificationException=TRUE, the caller should raise a VerificationException.
+// if *unverifiableGenericCode=TRUE, the method is a generic instantiation with
+// unverifiable code
+
+CorJitFlag GetCompileFlagsIfGenericInstantiation(
+ CORINFO_METHOD_HANDLE method,
+ CorJitFlag compileFlags,
+ ICorJitInfo * pCorJitInfo,
+ BOOL * raiseVerificationException,
+ BOOL * unverifiableGenericCode);
+
+// Returns the global instance of JIT->EE interface for NGen
+
+extern "C" ICorDynamicInfo * __stdcall GetZapJitInfo();
+
+// Returns the global instance of Zapper->EE interface
+
+extern "C" ICorCompileInfo * __stdcall GetCompileInfo();
+
+// Stress mode to leave some methods/types uncompiled in the ngen image.
+// Those methods will be JIT-compiled at runtime as needed.
+
+extern "C" unsigned __stdcall PartialNGenStressPercentage();
+
+// create a PDB dumping all functions in hAssembly into pdbPath
+extern "C" HRESULT __stdcall CreatePdb(CORINFO_ASSEMBLY_HANDLE hAssembly, BSTR pNativeImagePath, BSTR pPdbPath, BOOL pdbLines, BSTR pManagedPdbSearchPath, LPCWSTR pDiasymreaderPath);
+
+#if defined(FEATURE_CORECLR) || defined(CROSSGEN_COMPILE)
+extern bool g_fNGenMissingDependenciesOk;
+#endif
+
+extern bool g_fNGenWinMDResilient;
+
+#ifdef FEATURE_READYTORUN_COMPILER
+extern bool g_fReadyToRunCompilation;
+#endif
+
+inline bool IsReadyToRunCompilation()
+{
+#ifdef FEATURE_READYTORUN_COMPILER
+ return g_fReadyToRunCompilation;
+#else
+ return false;
+#endif
+}
+
+#endif /* COR_COMPILE_H_ */
diff --git a/src/inc/cordbpriv.h b/src/inc/cordbpriv.h
new file mode 100644
index 0000000000..30231d3788
--- /dev/null
+++ b/src/inc/cordbpriv.h
@@ -0,0 +1,68 @@
+// 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.
+
+/* ------------------------------------------------------------------------- *
+ * cordbpriv.h -- header file for private Debugger data shared by various
+ * Runtime components.
+ * ------------------------------------------------------------------------- */
+
+#ifndef _cordbpriv_h_
+#define _cordbpriv_h_
+
+#include "corhdr.h"
+#include <unknwn.h>
+
+//
+// Initial value for EnC versions
+//
+#define CorDB_DEFAULT_ENC_FUNCTION_VERSION 1
+#define CorDB_UNKNOWN_ENC_FUNCTION_VERSION ((SIZE_T)(-1))
+
+enum DebuggerLaunchSetting
+{
+ DLS_ASK_USER = 0,
+ DLS_ATTACH_DEBUGGER = 1
+};
+
+
+//
+// Flags used to control the Runtime's debugging modes. These indicate to
+// the Runtime that it needs to load the Runtime Controller, track data
+// during JIT's, etc.
+//
+enum DebuggerControlFlag
+{
+ DBCF_NORMAL_OPERATION = 0x0000,
+
+ DBCF_USER_MASK = 0x00FF,
+ DBCF_GENERATE_DEBUG_CODE = 0x0001,
+ DBCF_ALLOW_JIT_OPT = 0x0008,
+ DBCF_PROFILER_ENABLED = 0x0020,
+// DBCF_ACTIVATE_REMOTE_DEBUGGING = 0x0040, Deprecated. DO NOT USE
+
+ DBCF_INTERNAL_MASK = 0xFF00,
+ DBCF_PENDING_ATTACH = 0x0100,
+ DBCF_ATTACHED = 0x0200,
+ DBCF_FIBERMODE = 0x0400
+};
+
+//
+// Flags used to control the debuggable state of modules and
+// assemblies.
+//
+enum DebuggerAssemblyControlFlags
+{
+ DACF_NONE = 0x00,
+ DACF_USER_OVERRIDE = 0x01,
+ DACF_ALLOW_JIT_OPTS = 0x02,
+ DACF_OBSOLETE_TRACK_JIT_INFO = 0x04, // obsolete in V2.0, we're always tracking.
+ DACF_ENC_ENABLED = 0x08,
+ DACF_IGNORE_PDBS = 0x20,
+ DACF_CONTROL_FLAGS_MASK = 0x2F,
+
+ DACF_PDBS_COPIED = 0x10,
+ DACF_MISC_FLAGS_MASK = 0x10,
+};
+
+#endif /* _cordbpriv_h_ */
diff --git a/src/inc/cordebug.idl b/src/inc/cordebug.idl
new file mode 100644
index 0000000000..49b8acc923
--- /dev/null
+++ b/src/inc/cordebug.idl
@@ -0,0 +1,7292 @@
+// 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.
+
+/*****************************************************************************
+ ** **
+ ** Cordebug.idl - Common Language Runtime Debugging interfaces. **
+ ** **
+ *****************************************************************************/
+
+
+/* ------------------------------------------------------------------------- *
+ * Imported types
+ * ------------------------------------------------------------------------- */
+
+#if !DEFINITIONS_FROM_NON_IMPORTABLE_PLACES
+
+cpp_quote("#if 0")
+
+import "unknwn.idl";
+import "objidl.idl";
+
+typedef UINT32 mdToken;
+typedef mdToken mdModule;
+typedef SIZE_T mdScope;
+typedef mdToken mdTypeDef;
+typedef mdToken mdSourceFile;
+typedef mdToken mdMemberRef;
+typedef mdToken mdMethodDef;
+typedef mdToken mdFieldDef;
+typedef mdToken mdSignature;
+typedef ULONG CorElementType;
+typedef SIZE_T PCCOR_SIGNATURE;
+
+typedef SIZE_T LPDEBUG_EVENT;
+
+typedef SIZE_T LPSTARTUPINFOW;
+typedef SIZE_T LPPROCESS_INFORMATION;
+
+typedef const void far *LPCVOID;
+
+cpp_quote("#endif")
+
+typedef [wire_marshal(unsigned long)] void *HPROCESS;
+typedef [wire_marshal(unsigned long)] void *HTHREAD;
+
+typedef UINT64 TASKID;
+typedef DWORD CONNID;
+
+
+
+
+#endif
+
+cpp_quote("#ifndef _COR_IL_MAP")
+cpp_quote("#define _COR_IL_MAP")
+
+// Note that this structure is also defined in CorProf.idl - PROPOGATE CHANGES
+// BOTH WAYS, or this'll become a really insidious bug some day.
+typedef struct _COR_IL_MAP
+{
+ ULONG32 oldOffset; // Old IL offset relative to beginning of function
+ ULONG32 newOffset; // New IL offset relative to beginning of function
+ BOOL fAccurate; // TRUE if mapping is known to be good, FALSE otherwise
+} COR_IL_MAP;
+
+cpp_quote("#endif //_COR_IL_MAP")
+
+cpp_quote("#ifndef _COR_DEBUG_IL_TO_NATIVE_MAP_")
+cpp_quote("#define _COR_DEBUG_IL_TO_NATIVE_MAP_")
+
+/* ICorDebugCode:: GetILToNativeMapping returns an array of
+ * COR_DEBUG_IL_TO_NATIVE_MAP structures. In order to convey that certain
+ * ranges of native instructions correspond to special regions of code (for
+ * example, the prolog), an entry in the array may have it's ilOffset field set
+ * to one of these values.
+ */
+typedef enum CorDebugIlToNativeMappingTypes
+{
+ NO_MAPPING = -1,
+ PROLOG = -2,
+ EPILOG = -3
+} CorDebugIlToNativeMappingTypes;
+
+typedef struct COR_DEBUG_IL_TO_NATIVE_MAP
+{
+ ULONG32 ilOffset;
+ ULONG32 nativeStartOffset;
+ ULONG32 nativeEndOffset;
+} COR_DEBUG_IL_TO_NATIVE_MAP;
+
+cpp_quote("#endif // _COR_DEBUG_IL_TO_NATIVE_MAP_")
+
+cpp_quote("#define REMOTE_DEBUGGING_DLL_ENTRY L\"Software\\\\Microsoft\\\\.NETFramework\\\\Debugger\\\\ActivateRemoteDebugging\"")
+
+
+typedef enum CorDebugJITCompilerFlags
+{
+ CORDEBUG_JIT_DEFAULT = 0x1, // Track info, enable optimizations
+ CORDEBUG_JIT_DISABLE_OPTIMIZATION = 0x3, // Includes track info, disable opts,
+ CORDEBUG_JIT_ENABLE_ENC = 0x7 // Includes track & disable opt & Edit and Continue.
+} CorDebugJITCompilerFlags;
+
+typedef enum CorDebugJITCompilerFlagsDecprecated
+{
+ CORDEBUG_JIT_TRACK_DEBUG_INFO = 0x1, // Use CORDEBUG_JIT_DEFAULT instead
+} CorDebugJITCompilerFlagsDeprecated;
+
+typedef enum CorDebugNGENPolicy
+{
+ DISABLE_LOCAL_NIC = 1 // indicates that the native image cache for a modern application should be ignored
+} CorDebugNGENPolicy;
+
+/* ------------------------------------------------------------------------- *
+ * Forward declarations
+ * ------------------------------------------------------------------------- */
+#pragma warning(push)
+#pragma warning(disable:28718) //Unable to annotate as this is not a local interface
+
+interface ICorDebug;
+
+interface ICorDebugController;
+interface ICorDebugProcess;
+interface ICorDebugProcess2;
+interface ICorDebugAppDomain;
+interface ICorDebugAssembly;
+interface ICorDebugAssembly2;
+interface ICorDebugBreakpoint;
+interface ICorDebugFunctionBreakpoint;
+interface ICorDebugModuleBreakpoint;
+interface ICorDebugValueBreakpoint;
+interface ICorDebugStepper;
+interface ICorDebugEval;
+interface ICorDebugEval2;
+interface ICorDebugThread;
+interface ICorDebugThread2;
+interface ICorDebugThread3;
+interface ICorDebugThread4;
+interface ICorDebugStackWalk;
+interface ICorDebugChain;
+interface ICorDebugFrame;
+interface ICorDebugILFrame;
+interface ICorDebugInternalFrame;
+interface ICorDebugInternalFrame2;
+interface ICorDebugNativeFrame;
+interface ICorDebugNativeFrame2;
+interface ICorDebugRuntimeUnwindableFrame;
+interface ICorDebugContext;
+interface ICorDebugModule;
+interface ICorDebugFunction;
+interface ICorDebugFunction2;
+interface ICorDebugCode;
+interface ICorDebugILCode;
+interface ICorDebugClass;
+interface ICorDebugType;
+
+interface ICorDebugValue;
+interface ICorDebugGenericValue;
+interface ICorDebugReferenceValue;
+interface ICorDebugHeapValue;
+interface ICorDebugHeapValue2;
+interface ICorDebugHeapValue3;
+interface ICorDebugHandleValue;
+interface ICorDebugObjectValue;
+interface ICorDebugStringValue;
+interface ICorDebugArrayValue;
+
+interface ICorDebugEnum;
+interface ICorDebugObjectEnum;
+interface ICorDebugProcessEnum;
+interface ICorDebugBreakpointEnum;
+interface ICorDebugStepperEnum;
+interface ICorDebugModuleEnum;
+interface ICorDebugThreadEnum;
+interface ICorDebugChainEnum;
+interface ICorDebugTypeEnum;
+interface ICorDebugCodeEnum;
+interface ICorDebugFrameEnum;
+interface ICorDebugValueEnum;
+interface ICorDebugAppDomainEnum;
+interface ICorDebugAssemblyEnum;
+interface ICorDebugBlockingObjectEnum;
+
+interface ICorDebugErrorInfoEnum;
+interface ICorDebugMDA;
+
+/* DEPRECATED */
+interface ICorDebugEditAndContinueSnapshot;
+/* DEPRECATED */
+interface ICorDebugEditAndContinueErrorInfo;
+
+#pragma warning(pop)
+
+// All target addresses in ICorDebug are represented as 0-extended 64-bit integer values.
+typedef ULONG64 CORDB_ADDRESS;
+
+typedef ULONG64 CORDB_REGISTER;
+typedef DWORD CORDB_CONTINUE_STATUS;
+typedef enum CorDebugBlockingReason {
+ BLOCKING_NONE = 0x0,
+ BLOCKING_MONITOR_CRITICAL_SECTION = 0x1,
+ BLOCKING_MONITOR_EVENT = 0x2
+} CorDebugBlockingReason;
+
+typedef struct CorDebugBlockingObject {
+ ICorDebugValue *pBlockingObject;
+ DWORD dwTimeout;
+ CorDebugBlockingReason blockingReason;
+} CorDebugBlockingObject;
+
+typedef struct CorDebugExceptionObjectStackFrame
+{
+ ICorDebugModule* pModule;
+ CORDB_ADDRESS ip;
+ mdMethodDef methodDef;
+ BOOL isLastForeignExceptionFrame;
+} CorDebugExceptionObjectStackFrame;
+
+typedef struct CorDebugGuidToTypeMapping
+{
+ GUID iid;
+ ICorDebugType * pType;
+} CorDebugGuidToTypeMapping;
+
+/*
+ * Callback interface for providing access to a particular target process. The
+ * debugging services will call functions on this interface to access memory
+ * and other data in the target process. The debugger client must implement
+ * this interface as appropriate for the particular target (for example, a live
+ * process or a memory dump). The DataTarget will only be invoked from within
+ * the implementation of other ICorDebug APIs (i.e. the debugger client has
+ * control over which thread it is invoked on, and when)
+ *
+ * Error HRESULTS returned by DataTarget APIs will propagate up and be returned
+ * by the active ICorDebug API call.
+ *
+ * The DataTarget implementation must always return up-to-date information
+ * about the target. The target process should be stopped (not changing
+ * in any way) while ICorDebug APIs (and hence DataTarget APIs) are being
+ * called. If the target is a live process and it's state changes,
+ * OpenVirtualProcess needs to be called again to provide a replacement
+ * ICorDebugProcess instance.
+ */
+[
+ object,
+ local,
+ uuid(FE06DC28-49FB-4636-A4A3-E80DB4AE116C),
+ pointer_default(unique)
+]
+interface ICorDebugDataTarget : IUnknown
+{
+ /*
+ * GetPlatform returns the processor architecture and operating system on
+ * which the target process is (or was) running.
+ *
+ * This is used by ICorDebug to determine details of the target process
+ * such as its pointer size, address space layout, register set,
+ * instruction format, context layout, and calling conventions, etc.
+ * This platforms in this list are the only ones supported by this version
+ * of ICorDebug, but more may be added in future versions.
+ *
+ * Note that this may actually indicate the platform which is being
+ * emulated for the target, not the actual hardware in use. For example,
+ * a process running in the WOW on Windows x64 should use
+ * CORDB_PLATFORM_WINDOWS_X86.
+ *
+ * Implementations should be sure to describe what the platform of the
+ * target actually is, not just what the host expects it to be.
+ *
+ * This function must succeed. If it fails, the DataTarget is unusable.
+ */
+ typedef enum CorDebugPlatform
+ {
+ CORDB_PLATFORM_WINDOWS_X86, // Windows on Intel x86
+ CORDB_PLATFORM_WINDOWS_AMD64, // Windows x64 (Amd64, Intel EM64T)
+ CORDB_PLATFORM_WINDOWS_IA64, // Windows on Intel IA-64
+ CORDB_PLATFORM_MAC_PPC, // Mac OS on PowerPC (Deprecated)
+ CORDB_PLATFORM_MAC_X86, // Mac OS on Intel x86 (Deprecated, use CORDB_PLATFORM_POSIX_X86)
+ CORDB_PLATFORM_WINDOWS_ARM, // Windows on ARM
+ CORDB_PLATFORM_MAC_AMD64, // Mac OS on Intel x64 (Deprecated, use CORDB_PLATFORM_POSIX_AMD64)
+ CORDB_PLATFORM_WINDOWS_ARM64, // Windows on ARM64
+
+ CORDB_PLATFORM_POSIX_AMD64, // Posix supporting OS on Intel x64
+ CORDB_PLATFORM_POSIX_X86, // Posix supporting OS on Intel x86
+ CORDB_PLATFORM_POSIX_ARM, // Posix supporting OS on ARM32
+ CORDB_PLATFORM_POSIX_ARM64 // Posix supporting OS on ARM64
+ } CorDebugPlatform;
+
+ HRESULT GetPlatform([out] CorDebugPlatform * pTargetPlatform);
+
+ /*
+ * ReadVirtual - Read virtual memory from the target process.
+ *
+ * Requests contiguous memory starting at the specified target address to
+ * be read from the target process into the supplied buffer. If at least
+ * the first byte (at the specified start address) can be read, the call
+ * should return success (to support efficient reading of data structures
+ * with self-describing length, like null-terminated strings).
+ *
+ * On success, the actual number of bytes read must be stored into
+ * pBytesRead.
+ */
+ HRESULT ReadVirtual([in] CORDB_ADDRESS address,
+ [out, size_is(bytesRequested), length_is(*pBytesRead)] BYTE * pBuffer,
+ [in] ULONG32 bytesRequested,
+ [out] ULONG32 * pBytesRead);
+
+ /*
+ * GetThreadContext - Get the thread context (register values) for a thread.
+ *
+ * Requests the current thread context for the specified (operating-system
+ * defined) thread identifier. The size and format of the context record
+ * is platform dependant, and is determined by the result of the call to
+ * GetPlatform.
+ *
+ * The context flags specify, in a platform-dependent manor, which portions
+ * of the context should be read. contextSize specifies the size of the
+ * supplied buffer, but the function is free to not fill the whole buffer
+ * if it is possible to determine the actual size from the context.
+ *
+ * On Windows platforms, the buffer must be a CONTEXT structure appropriate
+ * for the machine type specified by GetPlatform. contextFlags has the
+ * same values as the ContextFlags field of CONTEXT.
+ */
+ HRESULT GetThreadContext([in] DWORD dwThreadID,
+ [in] ULONG32 contextFlags,
+ [in] ULONG32 contextSize,
+ [out, size_is(contextSize)] BYTE * pContext);
+};
+
+/*
+ * Used to retrieve the debug-symbol information for a static field.
+ */
+[
+ object,
+ local,
+ uuid(CBF9DA63-F68D-4BBB-A21C-15A45EAADF5B),
+ pointer_default(unique)
+]
+interface ICorDebugStaticFieldSymbol : IUnknown
+{
+ /*
+ * GetName - gives the name of the static field
+ */
+ HRESULT GetName([in] ULONG32 cchName, [out] ULONG32 *pcchName, [out, size_is(cchName), length_is(*pcchName)] WCHAR szName[]);
+
+ /*
+ * GetSize - gives the size of the static field
+ */
+ HRESULT GetSize([out] ULONG32 *pcbSize);
+
+ /*
+ * GetAddress - gives the RVA of the static field
+ */
+ HRESULT GetAddress([out] CORDB_ADDRESS *pRVA);
+}
+
+/*
+ * Used to retrieve the debug-symbol information for an instance field.
+ */
+[
+ object,
+ local,
+ uuid(A074096B-3ADC-4485-81DA-68C7A4EA52DB),
+ pointer_default(unique)
+]
+interface ICorDebugInstanceFieldSymbol : IUnknown
+{
+ /*
+ * GetName - gives the name of the instance field
+ */
+ HRESULT GetName([in] ULONG32 cchName, [out] ULONG32 *pcchName, [out, size_is(cchName), length_is(*pcchName)] WCHAR szName[]);
+
+ /*
+ * GetSize - gives the size of the instance field
+ */
+ HRESULT GetSize([out] ULONG32 *pcbSize);
+
+ /*
+ * GetOffset - gives the offset of the instance field in its parent class
+ */
+ HRESULT GetOffset([out] ULONG32 *pcbOffset);
+}
+
+/*
+ * Used to retrieve the debug-symbol information for a variable.
+ */
+[
+ object,
+ local,
+ uuid(707E8932-1163-48D9-8A93-F5B1F480FBB7),
+ pointer_default(unique)
+]
+interface ICorDebugVariableSymbol : IUnknown
+{
+ /*
+ * GetName - gives the name of the variable
+ */
+ HRESULT GetName([in] ULONG32 cchName, [out] ULONG32 *pcchName, [out, size_is(cchName), length_is(*pcchName)] WCHAR szName[]);
+
+ /*
+ * GetSize - gives the size of a variable
+ */
+ HRESULT GetSize([out] ULONG32 *pcbValue);
+
+ /*
+ * GetValue - Used to get the value of a variable as a byte array.
+ *
+ * offset: read the value starting at this offset in variable, this is used when reading member fields in an object
+ * context: thread context used to read the value
+ * cbContext: size of thread context
+ *
+ * cbValue: size of pValue buffer
+ * pcbValue: size of pValue buffer filled with value
+ * pValue: buffer used to hold the read value
+ */
+ HRESULT GetValue([in] ULONG32 offset,
+ [in] ULONG32 cbContext,
+ [in, size_is(cbContext)] BYTE context[],
+ [in] ULONG32 cbValue,
+ [out] ULONG32 *pcbValue,
+ [out, size_is(cbValue), length_is(*pcbValue)] BYTE pValue[]);
+
+ /*
+ * SetValue - Given a byte array, sets it as the value of the variable.
+ *
+ * offset: set the value starting at this offset in variable, this is used when writing member fields in an object
+ * threadID: thread id used to indentify the thread whose context must be updated to reflect the new value
+ * context: thread context used to write the value
+ * cbContext: size of thread context
+ *
+ * cbValue: size of pValue buffer
+ * pValue: buffer to hold the value to set
+ */
+ HRESULT SetValue([in] ULONG32 offset,
+ [in] DWORD threadID,
+ [in] ULONG32 cbContext,
+ [in, size_is(cbContext)] BYTE context[],
+ [in] ULONG32 cbValue,
+ [in, size_is(cbValue)] BYTE pValue[]);
+
+ /*
+ * GetSlotIndex - Gives the managed slot-index of a local variable.
+ * This slot-index can be used to retrieve the metadata information for this local.
+ *
+ * Returns E_FAIL if the variable is a function argument.
+ */
+ HRESULT GetSlotIndex([out] ULONG32 *pSlotIndex);
+}
+
+
+/*
+ * Represents an in-memory buffer.
+ */
+[
+ object,
+ uuid(677888B3-D160-4B8C-A73B-D79E6AAA1D13),
+ local,
+ pointer_default(unique)
+]
+interface ICorDebugMemoryBuffer : IUnknown
+{
+ /*
+ * GetStartAddress - Gives the address where buffer starts.
+ */
+ HRESULT GetStartAddress([out] LPCVOID *address);
+
+ /*
+ * GetStartAddress - Gives the size of memory buffer.
+ */
+ HRESULT GetSize([out] ULONG32 *pcbBufferLength);
+}
+
+/*
+ * Used to get information about a merged assembly.
+ */
+[
+ object,
+ uuid(FAA8637B-3BBE-4671-8E26-3B59875B922A),
+ local,
+ pointer_default(unique)
+]
+interface ICorDebugMergedAssemblyRecord : IUnknown
+{
+ /*
+ * GetSimpleName - Gives the simple name of the assembly (for example "System.Collections")
+ * These names do not include qualifiers such as file extensions, culture, version, or public key token
+ */
+ HRESULT GetSimpleName([in] ULONG32 cchName, [out] ULONG32 *pcchName, [out, size_is(cchName), length_is(*pcchName)] WCHAR szName[]);
+
+ /*
+ * GetVersion - Gives the assembly version information
+ */
+ HRESULT GetVersion([out] USHORT *pMajor, [out] USHORT *pMinor, [out] USHORT *pBuild, [out] USHORT *pRevision);
+
+ /*
+ * GetCulture - Gives culture string for the assembly (for example "neutral" or "en-US")
+ */
+ HRESULT GetCulture([in] ULONG32 cchCulture, [out] ULONG32 *pcchCulture, [out, size_is(cchCulture), length_is(*pcchCulture)] WCHAR szCulture[]);
+
+ /*
+ * GetPublicKey - Gives the assembly public key
+ */
+ HRESULT GetPublicKey([in] ULONG32 cbPublicKey, [out] ULONG32 *pcbPublicKey, [out, size_is(cbPublicKey), length_is(*pcbPublicKey)] BYTE pbPublicKey[]);
+
+ /*
+ * GetPublicKeyToken - Gives the assembly public key token (the last 8 bytes of a SHA1 hash of the public key)
+ */
+ HRESULT GetPublicKeyToken([in] ULONG32 cbPublicKeyToken, [out] ULONG32 *pcbPublicKeyToken,
+ [out, size_is(cbPublicKeyToken), length_is(*pcbPublicKeyToken)] BYTE pbPublicKeyToken[]);
+
+ /*
+ * GetIndex - Gives prefix index used to prevent name collisions in the merged metadata type names
+ */
+ HRESULT GetIndex([out] ULONG32 *pIndex);
+}
+
+/*
+ * Used to retrieve debug symbol information.
+ */
+[
+ object,
+ uuid(3948A999-FD8A-4C38-A708-8A71E9B04DBB),
+ local,
+ pointer_default(unique)
+]
+interface ICorDebugSymbolProvider : IUnknown
+{
+ /*
+ * GetStaticFieldSymbols - given a typespec signature, gives back its static field symbols
+ */
+ HRESULT GetStaticFieldSymbols([in] ULONG32 cbSignature,
+ [in, size_is(cbSignature)] BYTE typeSig[],
+ [in] ULONG32 cRequestedSymbols,
+ [out] ULONG32 *pcFetchedSymbols,
+ [out, size_is(cRequestedSymbols), length_is(*pcFetchedSymbols)] ICorDebugStaticFieldSymbol *pSymbols[]);
+
+ /*
+ * GetInstanceFieldSymbols - given a typespec signature, gives back its instance field symbols
+ */
+ HRESULT GetInstanceFieldSymbols([in] ULONG32 cbSignature,
+ [in, size_is(cbSignature)] BYTE typeSig[],
+ [in] ULONG32 cRequestedSymbols,
+ [out] ULONG32 *pcFetchedSymbols,
+ [out, size_is(cRequestedSymbols), length_is(*pcFetchedSymbols)] ICorDebugInstanceFieldSymbol *pSymbols[]);
+
+ /*
+ * GetMethodLocalSymbols - given rva in a method, gives back its local symbols
+ */
+ HRESULT GetMethodLocalSymbols([in] ULONG32 nativeRVA,
+ [in] ULONG32 cRequestedSymbols,
+ [out] ULONG32 *pcFetchedSymbols,
+ [out, size_is(cRequestedSymbols), length_is(*pcFetchedSymbols)] ICorDebugVariableSymbol *pSymbols[]);
+
+ /*
+ * GetMethodParameterSymbols - given rva in a method, gives back its parameter symbols
+ */
+ HRESULT GetMethodParameterSymbols([in] ULONG32 nativeRVA,
+ [in] ULONG32 cRequestedSymbols,
+ [out] ULONG32 *pcFetchedSymbols,
+ [out, size_is(cRequestedSymbols), length_is(*pcFetchedSymbols)] ICorDebugVariableSymbol *pSymbols[]);
+
+ /*
+ * GetMergedAssemblyRecords - gets symbol records for all the merged assemblies
+ */
+ HRESULT GetMergedAssemblyRecords([in] ULONG32 cRequestedRecords,
+ [out] ULONG32 *pcFetchedRecords,
+ [out, size_is(cRequestedRecords), length_is(*pcFetchedRecords)] ICorDebugMergedAssemblyRecord *pRecords[]);
+
+ /*
+ * GetMethodProps - given an rva in a method, gives back the
+ * pMethodToken - method's token
+ * pcGenericParams - number of generic parameters associated with this method
+ * cbSignature - size of signature array, set to 0 and pass signature as NULL to get the actual size in pcbSignature
+ * pcbSignature - returned size of signature
+ * signature - buffer to hold the type-spec signatures of all generic parameters
+ */
+ HRESULT GetMethodProps([in] ULONG32 codeRva,
+ [out] mdToken *pMethodToken,
+ [out] ULONG32 *pcGenericParams,
+ [in] ULONG32 cbSignature,
+ [out] ULONG32 *pcbSignature,
+ [out, size_is(cbSignature), length_is(*pcbSignature)] BYTE signature[]);
+
+ /*
+ * GetTypeProps - given a vtable rva, gives back the
+ * cbSignature - size of signature array, set to 0 and pass signature as NULL to get the actual size in pcbSignature
+ * pcbSignature - returned size of signature
+ * signature - buffer to hold the signature of type corresponding to input vtableRva
+ */
+ HRESULT GetTypeProps([in] ULONG32 vtableRva,
+ [in] ULONG32 cbSignature,
+ [out] ULONG32 *pcbSignature,
+ [out, size_is(cbSignature), length_is(*pcbSignature)] BYTE signature[]);
+
+ /*
+ * GetCodeRange - given rva in a method, gives back the method start address and size.
+ */
+ HRESULT GetCodeRange([in] ULONG32 codeRva, [out] ULONG32* pCodeStartAddress, ULONG32* pCodeSize);
+
+ /*
+ * GetAssemblyImageBytes - given an RVA in the merged assembly and size, reads data from the merged assembly and gives it back as an ICorDebugMemoryBuffer
+ */
+ HRESULT GetAssemblyImageBytes([in] CORDB_ADDRESS rva, [in] ULONG32 length, [out] ICorDebugMemoryBuffer** ppMemoryBuffer);
+
+ /*
+ * GetObjectSize - given a typespec signature, gives back its object size
+ */
+ HRESULT GetObjectSize([in] ULONG32 cbSignature,
+ [in, size_is(cbSignature)] BYTE typeSig[],
+ [out] ULONG32 *pObjectSize);
+
+ /*
+ * GetAssemblyImageMetadata - gives back the merged assembly metadata as an ICorDebugMemoryBuffer
+ */
+ HRESULT GetAssemblyImageMetadata([out] ICorDebugMemoryBuffer** ppMemoryBuffer);
+}
+
+/*
+ * Used to retrieve debug symbol information.
+ */
+[
+ object,
+ uuid(F9801807-4764-4330-9E67-4F685094165E),
+ local,
+ pointer_default(unique)
+]
+interface ICorDebugSymbolProvider2 : IUnknown
+{
+ /*
+ * Gives back the generic dictionary map as an ICorDebugMemoryBuffer
+ *
+ * At the highest level, the map consists of two sections.
+ * The first section contains a "directory" of all dictionaries (RVA) covered by this map, the second section
+ * is a byte aligned heap with instantiation information starting right after the last directory entry.
+ * Each entry in the "directory" refers to an offset inside the "heap" (relative to the start of the heap).
+ * Please note that it is possible that multiple directory entries point to the same offset into the heap.
+ *
+ * Contents of the map:
+ *
+ * - First 4 bytes: number of RVA/dictionary entries (N)
+ * If the high bit is set, the following N entries are sorted by RVA in ascending order.
+ *
+ * - N 8 byte wide entries, each entry consisting of 2 4-byte entries:
+ * 1st 4 byte entry - RVA: the dictionary's RVA
+ * 2nd 4 byte entry - Offset: an offset relative to the start of the heap.
+ *
+ * - Heap
+ *
+ * The heap's size can be computed be a stream reader by subtracting the directory size + 4.
+ *
+ * The format for each instantiation info in heap is as follows:
+ * - Length of this instantiation info (in bytes, not including this length information) in compressed ECMA metadata format.
+ * - Number of instantatiation types (T, in compressed ECMA metadata format)
+ * - T types, each expressed in ECMA type signature format
+ *
+ * The inclusion of the length for each heap element enables simple sorting of the directory section without affecting the heap.
+ */
+ HRESULT GetGenericDictionaryInfo([out] ICorDebugMemoryBuffer** ppMemoryBuffer);
+
+ /*
+ * GetFrameProps:
+ * For a given code-rva, gives the method start rva (pCodeStartRva) and parent
+ * frame's start rva (pParentFrameStartRva).
+ * If there is no parent frame, then pParentFrameStartRva is set to 0
+ */
+ HRESULT GetFrameProps([in] ULONG32 codeRva,
+ [out] ULONG32 *pCodeStartRva,
+ [out] ULONG32 *pParentFrameStartRva);
+}
+
+/*
+ * Implemented by the debugger and helps in stack unwinding.
+ */
+[
+ object,
+ uuid(F69126B7-C787-4F6B-AE96-A569786FC670),
+ local,
+ pointer_default(unique)
+]
+interface ICorDebugVirtualUnwinder : IUnknown
+{
+ /*
+ * Get the current context of this unwinder.
+ *
+ * contextBuf is passed in by ICorDebugStackWalk. As unwinding may only restore a subset of the
+ * registers, such as only non-volatile registers, the context may not exactly match the register
+ * state at the time of the actual call.
+ *
+ * Any failing HRESULT received by mscordbi is considered fatal and will cause ICorDebug
+ * APIs to return CORDBG_E_DATA_TARGET_ERROR.
+ */
+ HRESULT GetContext([in] ULONG32 contextFlags,
+ [in] ULONG32 cbContextBuf,
+ [out] ULONG32* contextSize,
+ [out, size_is(cbContextBuf)] BYTE contextBuf[]);
+
+ /*
+ * Advances to the callers context.
+ *
+ * If a failing HRESULT is returned ICorDebug APIs will return CORDBG_E_DATA_TARGET_ERROR.
+ * If the unwind can not be completed because there are no more frames the unwinder should
+ * return CORDBG_S_AT_END_OF_STACK.
+ * If the unwind occurred successfully return S_OK.
+ *
+ * The stackwalker should ensure forward progress is being made, so that eventually a call
+ * to Next() will return a failing HRESULT or CORDBG_S_AT_END_OF_STACK. Returning S_OK
+ * indefinitely may cause an infinite loop.
+ */
+ HRESULT Next();
+}
+
+
+[
+ object,
+ uuid(2eb364da-605b-4e8d-b333-3394c4828d41),
+ local,
+ pointer_default(unique)
+]
+interface ICorDebugDataTarget2 : IUnknown
+{
+ /*
+ * GetImageFromPointer:
+ * Given address in a module, gives back the module base address and size.
+ */
+ HRESULT GetImageFromPointer([in] CORDB_ADDRESS addr, [out] CORDB_ADDRESS *pImageBase, [out] ULONG32 *pSize);
+
+ /*
+ * GetImageLocation:
+ * Given module base address, gives back the module's path.
+ */
+ HRESULT GetImageLocation([in] CORDB_ADDRESS baseAddress,
+ [in] ULONG32 cchName,
+ [out] ULONG32 *pcchName,
+ [out, size_is(cchName), length_is(*pcchName)] WCHAR szName[]);
+
+ /*
+ * GetImageLocation:
+ * Given address in a module, gives back a symbol-provider for the module.
+ */
+ HRESULT GetSymbolProviderForImage([in] CORDB_ADDRESS imageBaseAddress, [out] ICorDebugSymbolProvider **ppSymProvider);
+
+ /*
+ * EnumerateThreadIDs:
+ * Gives back the list of active thread ids.
+ */
+ HRESULT EnumerateThreadIDs([in] ULONG32 cThreadIds, [out] ULONG32 *pcThreadIds, [out, size_is(cThreadIds), length_is(*pcThreadIds)] ULONG32 pThreadIds[]);
+
+ /*
+ * CreateVirtualUnwinder:
+ * Create a new stack unwinder that starts unwinding from initialContext (which isn't
+ * necessarily the leaf of a thread).
+ * Any failing HRESULT received by mscordbi is considered fatal and will cause ICorDebug
+ * APIs to return CORDBG_E_DATA_TARGET_ERROR.
+ */
+ HRESULT CreateVirtualUnwinder([in] DWORD nativeThreadID,
+ [in] ULONG32 contextFlags,
+ [in] ULONG32 cbContext,
+ [in, size_is(cbContext)] BYTE initialContext[],
+ [out] ICorDebugVirtualUnwinder ** ppUnwinder);
+};
+
+
+/*
+ * Provides the information about a loaded module.
+ * Note that this interface is implemented by debugger and is used by DBI to get
+ * the loaded module information from debugger.
+ */
+[
+ object,
+ uuid(817F343A-6630-4578-96C5-D11BC0EC5EE2),
+ local,
+ pointer_default(unique)
+]
+interface ICorDebugLoadedModule : IUnknown
+{
+ /*
+ * gives the base address
+ */
+ HRESULT GetBaseAddress([out] CORDB_ADDRESS *pAddress);
+
+ /*
+ * gives the module name
+ */
+ HRESULT GetName([in] ULONG32 cchName,
+ [out] ULONG32 *pcchName,
+ [out, size_is(cchName),
+ length_is(*pcchName)] WCHAR szName[]);
+
+ /*
+ * gives the module size
+ */
+ HRESULT GetSize([out] ULONG32 *pcBytes);
+};
+
+[
+ object,
+ uuid(D05E60C3-848C-4E7D-894E-623320FF6AFA),
+ local,
+ pointer_default(unique)
+]
+interface ICorDebugDataTarget3 : IUnknown
+{
+ /*
+ * gives back the list of modules loaded so far.
+ */
+ HRESULT GetLoadedModules([in] ULONG32 cRequestedModules,
+ [out] ULONG32 *pcFetchedModules,
+ [out, size_is(cRequestedModules),
+ length_is(*pcFetchedModules)] ICorDebugLoadedModule *pLoadedModules[]);
+};
+
+/*
+ * Data target that knows how to obtain debugee's process id.
+ * Debugee is not necessarily a living process at that time or on the same machine.
+ */
+[
+ object,
+ uuid(E799DC06-E099-4713-BDD9-906D3CC02CF2),
+ local,
+ pointer_default(unique)
+]
+interface ICorDebugDataTarget4 : IUnknown
+{
+ /*
+ * Unwinds one native stack frame in the target process/thread
+ */
+ HRESULT VirtualUnwind([in] DWORD threadId,
+ [in] ULONG32 contextSize,
+ [in, out, size_is(contextSize)] BYTE *context);
+};
+
+/*
+ * Mutable extension to the data target. This version of ICorDebugDataTarget
+ * can be implemented by targets that wish to support modification of the target
+ * process (such as for live invasive debugging).
+ *
+ * All of these APIs are optional in the sense that no core inspection-based
+ * debugging functionality will be lost by not implementing this interface or
+ * by the failure of these methods. Any failure HRESULT from these APIs will
+ * propagate out as the HRESULT from the ICorDebug API call.
+ *
+ * Note that a single ICorDebug API call may result in multiple mutations,
+ * and there is no mechanism for ensuring related mutations are applied
+ * transactionally (all-or-none). This means that if a mutation fails after
+ * others (for the same ICorDebug call) have succeeded, the target process may
+ * be left in an inconsistent state and debugging may become unreliable.
+ */
+[
+ object,
+ uuid(A1B8A756-3CB6-4CCB-979F-3DF999673A59),
+ local,
+ pointer_default(unique)
+]
+interface ICorDebugMutableDataTarget : ICorDebugDataTarget
+{
+ /*
+ * WriteVirtual - write memory into the target process address space
+ *
+ * Write the specified buffer into the target process at the specified
+ * address. If any bytes cannot be written, the call should fail without
+ * changing any bytes in the target (otherwise the target may be in an
+ * inconsistent state which makes further debugging unreliable).
+ */
+ HRESULT WriteVirtual([in] CORDB_ADDRESS address,
+ [in, size_is(bytesRequested)] const BYTE * pBuffer,
+ [in] ULONG32 bytesRequested);
+
+ /*
+ * SetThreadContext - set the context (register values) for a thread.
+ *
+ * Updates the current context for the thread specified by the (OS-defined)
+ * dwThreadID. The format of the context record is determined by the platform
+ * indicated by GetPlatform. On Windows, this is a CONTEXT structure.
+ * contextSize specifies the size of the buffer being passed.
+ */
+ HRESULT SetThreadContext([in] DWORD dwThreadID,
+ [in] ULONG32 contextSize,
+ [in, size_is(contextSize)] const BYTE * pContext);
+
+ /*
+ * Invoke to change the continue-status for the outstanding debug-event on
+ * the specified thread.
+ *
+ * Arguments:
+ * dwThreadId - OS Thread Id of the debug event
+ * continueStatus - New continue status being requested. See the
+ * definition of CORDB_CONTINUE_STATUS for details.
+ *
+ * This API is used when the Debugger makes an ICorDebug API request
+ * which requires the current debug event to be handled in a way that is
+ * potentially different from which it would be otherwise. For example,
+ * if there is an outstanding exception, and the debugger requests an
+ * operation that would cancel the exception (such as SetIp or FuncEval),
+ * than this API is used to request the exception be cancelled.
+ */
+ HRESULT ContinueStatusChanged([in] DWORD dwThreadId,
+ [in] CORDB_CONTINUE_STATUS continueStatus);
+
+};
+
+
+/*
+ * Interface used by the data access services layer to locate metadata
+ * of assemblies in a target.
+ *
+ * The API client must implement this interface as appropriate for the
+ * particular target (for example, a live process or a memory dump).
+ *
+ */
+[
+ object,
+ local,
+ uuid(7cef8ba9-2ef7-42bf-973f-4171474f87d9),
+ pointer_default(unique)
+]
+interface ICorDebugMetaDataLocator : IUnknown
+{
+ /*
+ * Ask the debugger to return the full path to a module whose metadata is
+ * needed to complete an operation the debugger requested.
+ *
+ * Arguments:
+ * wszImagePath - This buffer will always contain a NULL-terminated string
+ * representing the full path to the file when available, and the
+ * FileName.extension otherwise.
+ * dwImageTimeStamp - The TimeStamp from the image's PE headers; can
+ * potentially be used for a symsrv lookup.
+ * dwImageSize - Size of the image from PE headers; potentially used for
+ * a symsrv lookup.
+ * cchPathBuffer - The count of WCHARs pointed to by wszPathBuffer.
+ * pcchPathBuffer - When the callee returns E_NOT_SUFFICIENT_BUFFER, contains
+ * the count of WCHARs needed to store the path.
+ * For all other return values, pcchPathBuffer contains the count of
+ * WCHARs written to wszPathBuffer.
+ * wszPathBuffer - Pointer to a buffer into which the debugger will copy
+ * the full path to the file containing the requested metadata.
+ * CorOpenFlags.ofReadOnly access to the metadata in this file will
+ * be requested.
+ *
+ * Assumptions:
+ * The returned file represents a Windows module containing the metadata
+ * needed to complete a request made by the debugger.
+ *
+ * Return Value:
+ * S_OK on success. wszPathBuffer contains the full path to the file and
+ * is NULL-terminated.
+ *
+ * E_NOT_SUFFICIENT_BUFFER if the current size of wszPathBuffer is not
+ * sufficient to hold the full path. pcchPathBuffer will contain the
+ * needed count of WCHARs, including the terminating NULL.
+ * In this case GetMetaData will be called a second time with the
+ * requested buffer size.
+ *
+ * All other failure HRESULTs are interpreted to mean that the file
+ * is not retrievable.
+ *
+ * Notes:
+ * If wszImagePath contains a full path for a module from a dump, that
+ * path will be the path from the machine where the dump was collected.
+ * The file may not exist at this location, or an incorrect file with the
+ * same name may be stored on the path.
+ */
+ HRESULT GetMetaData( [in] LPCWSTR wszImagePath,
+ [in] DWORD dwImageTimeStamp,
+ [in] DWORD dwImageSize,
+ [in] ULONG32 cchPathBuffer,
+ [out, annotation("_Out_")] ULONG32 * pcchPathBuffer,
+ [out, size_is(cchPathBuffer), length_is(*pcchPathBuffer), annotation("_Out_writes_to_(cchPathBuffer, *pcchPathBuffer) ")] WCHAR wszPathBuffer[]);
+};
+
+
+/* ------------------------------------------------------------------------- *
+ * User Callback interface
+ * ------------------------------------------------------------------------- */
+
+
+#pragma warning(push)
+#pragma warning(disable:28718) /* disable warning 28718 for interface ICorDebugManagedCallback */
+/*
+ * ICorDebugManagedCallback is implemented by the user of the
+ * ICorDebug interfaces in order to respond to events in managed code
+ * in the debuggee process.
+ * This interface handles manage debug events from v1.0/v1.1
+ */
+
+[
+ object,
+ local,
+ uuid(3d6f5f60-7538-11d3-8d5b-00104b35e7ef),
+ pointer_default(unique)
+]
+interface ICorDebugManagedCallback : IUnknown
+{
+ /*
+ * All callbacks are called with the process in the synchronized state
+ * All callbacks are serialized, and are called in in the same thread.
+ * Each callback implementor must call Continue in a callback to
+ * resume execution.
+ * If Continue is not called before returning, the process will
+ * remain stopped. Continue must later be called before any more
+ * event callbacks will happen.
+ *
+ */
+
+ /*
+ * Breakpoint is called when a breakpoint is hit.
+ */
+
+ HRESULT Breakpoint([in] ICorDebugAppDomain *pAppDomain,
+ [in] ICorDebugThread *pThread,
+ [in] ICorDebugBreakpoint *pBreakpoint);
+
+ /*
+ * StepComplete is called when a step has completed. The stepper
+ * may be used to continue stepping if desired (except for TERMINATE
+ * reasons.)
+ *
+ * STEP_NORMAL means that stepping completed normally, in the same
+ * function.
+ *
+ * STEP_RETURN means that stepping continued normally, after the function
+ * returned.
+ *
+ * STEP_CALL means that stepping continued normally, at the start of
+ * a newly called function.
+ *
+ * STEP_EXCEPTION_FILTER means that control passed to an exception filter
+ * after an exception was thrown.
+ *
+ * STEP_EXCEPTION_HANDLER means that control passed to an exception handler
+ * after an exception was thrown.
+ *
+ * STEP_INTERCEPT means that control passed to an interceptor.
+ *
+ * STEP_EXIT means that the thread exited before the step completed.
+ * No more stepping can be performed with the stepper.
+ */
+
+ typedef enum CorDebugStepReason
+ {
+ STEP_NORMAL,
+ STEP_RETURN,
+ STEP_CALL,
+ STEP_EXCEPTION_FILTER,
+ STEP_EXCEPTION_HANDLER,
+ STEP_INTERCEPT,
+ STEP_EXIT
+ } CorDebugStepReason;
+
+ HRESULT StepComplete([in] ICorDebugAppDomain *pAppDomain,
+ [in] ICorDebugThread *pThread,
+ [in] ICorDebugStepper *pStepper,
+ [in] CorDebugStepReason reason);
+
+ /*
+ * Break is called when a break opcode in the code stream is
+ * executed.
+ */
+
+ HRESULT Break([in] ICorDebugAppDomain *pAppDomain,
+ [in] ICorDebugThread *thread);
+
+ /*
+ * Exception is called when an exception is thrown from managed
+ * code, The specific exception can be retrieved from the thread object.
+ *
+ * If unhandled is FALSE, this is a "first chance" exception that
+ * hasn't had a chance to be processed by the application. If
+ * unhandled is TRUE, this is an unhandled exception which will
+ * terminate the process.
+ */
+
+ HRESULT Exception([in] ICorDebugAppDomain *pAppDomain,
+ [in] ICorDebugThread *pThread,
+ [in] BOOL unhandled);
+
+ /*
+ * EvalComplete is called when an evaluation is completed.
+ */
+
+ HRESULT EvalComplete([in] ICorDebugAppDomain *pAppDomain,
+ [in] ICorDebugThread *pThread,
+ [in] ICorDebugEval *pEval);
+
+ /*
+ * EvalException is called when an evaluation terminates with
+ * an unhandled exception.
+ */
+
+ HRESULT EvalException([in] ICorDebugAppDomain *pAppDomain,
+ [in] ICorDebugThread *pThread,
+ [in] ICorDebugEval *pEval);
+
+ /*
+ * CreateProcess is called when a process is first attached to or
+ * started.
+ *
+ * This entry point won't be called until the EE is initialized.
+ * Most of the ICorDebug API will return CORDBG_E_NOTREADY prior
+ * to the CreateProcess callback.
+ */
+
+ HRESULT CreateProcess([in] ICorDebugProcess *pProcess);
+
+ /*
+ * ExitProcess is called when a process exits.
+ *
+ * Note: you don't Continue from an ExitProcess event, and this
+ * event may fire asynchronously to other events, while the
+ * process appears to be stopped. This can occur if the process
+ * dies while stopped, usually due to some external force.
+ *
+ * If the CLR is already dispatching a managed callback, this event
+ * will be delayed until after that callback has returned.
+ *
+ * This is the only exit/unload event that is guaranteed to get called
+ * on shutdown.
+ */
+
+ HRESULT ExitProcess([in] ICorDebugProcess *pProcess);
+
+ /*
+ * CreateThread is called when a thread first begins executing managed
+ * code. The thread will be positioned immediately at the first
+ * managed code to be executed.
+ */
+
+ HRESULT CreateThread([in] ICorDebugAppDomain *pAppDomain,
+ [in] ICorDebugThread *thread);
+
+ /*
+ * ExitThread is called when a thread which has run managed code exits.
+ * Once this callback is fired, the thread no longer will appear in thread enumerations.
+ */
+
+ HRESULT ExitThread([in] ICorDebugAppDomain *pAppDomain,
+ [in] ICorDebugThread *thread);
+
+ /*
+ * LoadModule is called when a Common Language Runtime module is successfully
+ * loaded. This is an appropriate time to examine metadata for the
+ * module, set JIT compiler flags, or enable or disable
+ * class loading callbacks for the module.
+ */
+
+ HRESULT LoadModule([in] ICorDebugAppDomain *pAppDomain,
+ [in] ICorDebugModule *pModule);
+
+ /*
+ * UnloadModule is called when a Common Language Runtime module (DLL) is unloaded. The module
+ * should not be used after this point.
+ */
+
+ HRESULT UnloadModule([in] ICorDebugAppDomain *pAppDomain,
+ [in] ICorDebugModule *pModule);
+
+ /*
+ * LoadClass is called when a class finishes loading. This callback only
+ * occurs if ClassLoading has been enabled for the class's module.
+ *
+ * ClassLoading is always enabled for dynamic modules. This is a good time
+ * to update symbols (ICorDebugModule3::CreateReaderForInMemorySymbols) and
+ * bind breakpoints to newly generated classes in dynamic modules.
+ */
+
+ HRESULT LoadClass([in] ICorDebugAppDomain *pAppDomain,
+ [in] ICorDebugClass *c);
+
+ /*
+ * UnloadClass is called immediately before a class is unloaded. The class
+ * should not be referenced after this point. This callback only occurs if
+ * ClassLoading has been enabled for the class's module.
+ */
+
+ HRESULT UnloadClass([in] ICorDebugAppDomain *pAppDomain,
+ [in] ICorDebugClass *c);
+
+ /*
+ * DebuggerError is called when an error occurs while attempting to
+ * handle an event from the Common Language Runtime. It is very strongly
+ * advised that debuggers log this message to the end user because
+ * this callback indicates the debugging services have been disabled due to
+ * an error.
+ *
+ * ICorDebugProcess::GetID() will be safe to call, but all other APIs should
+ * not be called and will fail if they are.
+ * This includes ICorDebugProcess::Terminate and ICorDebug Process::Detach. The
+ * debugger should use OS facilities for terminating processes to shut down the process.
+ */
+ HRESULT DebuggerError([in] ICorDebugProcess *pProcess,
+ [in] HRESULT errorHR,
+ [in] DWORD errorCode);
+
+
+ /*
+ * Enum defining log message LoggingLevels
+ */
+ typedef enum LoggingLevelEnum
+ {
+ LTraceLevel0 = 0,
+ LTraceLevel1,
+ LTraceLevel2,
+ LTraceLevel3,
+ LTraceLevel4,
+ LStatusLevel0 = 20,
+ LStatusLevel1,
+ LStatusLevel2,
+ LStatusLevel3,
+ LStatusLevel4,
+ LWarningLevel = 40,
+ LErrorLevel = 50,
+ LPanicLevel = 100
+ } LoggingLevelEnum;
+
+
+ typedef enum LogSwitchCallReason
+ {
+ SWITCH_CREATE,
+ SWITCH_MODIFY,
+ SWITCH_DELETE
+ } LogSwitchCallReason;
+
+
+ /*
+ * LogMessage is called when a Common Language Runtime managed thread calls the Log
+ * class in the System.Diagnostics package to log an event.
+ */
+ HRESULT LogMessage([in] ICorDebugAppDomain *pAppDomain,
+ [in] ICorDebugThread *pThread,
+ [in] LONG lLevel,
+ [in] WCHAR *pLogSwitchName,
+ [in] WCHAR *pMessage);
+
+ /*
+ * LogSwitch is called when a Common Language Runtime managed thread calls the LogSwitch
+ * class in the System.Diagnostics package to create/modify a LogSwitch.
+ */
+ HRESULT LogSwitch([in] ICorDebugAppDomain *pAppDomain,
+ [in] ICorDebugThread *pThread,
+ [in] LONG lLevel,
+ [in] ULONG ulReason,
+ [in] WCHAR *pLogSwitchName,
+ [in] WCHAR *pParentName);
+
+ /*
+ * CreateAppDomain is called when an app domain is created.
+ */
+ HRESULT CreateAppDomain([in] ICorDebugProcess *pProcess,
+ [in] ICorDebugAppDomain *pAppDomain);
+
+ /*
+ * ExitAppDomain is called when an app domain exits.
+ */
+ HRESULT ExitAppDomain([in] ICorDebugProcess *pProcess,
+ [in] ICorDebugAppDomain *pAppDomain);
+
+
+ /*
+ * LoadAssembly is called when a Common Language Runtime assembly is successfully
+ * loaded.
+ */
+ HRESULT LoadAssembly([in] ICorDebugAppDomain *pAppDomain,
+ [in] ICorDebugAssembly *pAssembly);
+
+ /*
+ * UnloadAssembly is called when a Common Language Runtime assembly is unloaded. The assembly
+ * should not be used after this point.
+ */
+ HRESULT UnloadAssembly([in] ICorDebugAppDomain *pAppDomain,
+ [in] ICorDebugAssembly *pAssembly);
+
+ /*
+ * ControlCTrap is called if a CTRL-C is trapped in the process being
+ * debugged. All appdomains within the process are stopped for
+ * this callback.
+ * Return values:
+ * S_OK : Debugger will handle the ControlC Trap
+ * S_FALSE : Debugger won't handle the ControlC Trap
+ */
+ HRESULT ControlCTrap([in] ICorDebugProcess *pProcess);
+
+ /*
+ * NameChange() is called if either an AppDomain's or
+ * Thread's name changes.
+ */
+ HRESULT NameChange([in] ICorDebugAppDomain *pAppDomain,
+ [in] ICorDebugThread *pThread);
+
+ /*
+ * UpdateModuleSymbols is called when PDB debug symbols are available for an
+ * in-memory module. This is a debugger's chance to load the symbols
+ * (using ISymUnmanagedBinder::GetReaderForStream), and bind source-level
+ * breakpoints for the module.
+ *
+ * This callback is no longer dispatched for dynamic modules. Instead,
+ * debuggers should call ICorDebugModule3::CreateReaderForInMemorySymbols
+ * to obtain a symbol reader for a dynamic module.
+ */
+ HRESULT UpdateModuleSymbols([in] ICorDebugAppDomain *pAppDomain,
+ [in] ICorDebugModule *pModule,
+ [in] IStream *pSymbolStream);
+
+
+ /*
+ * DEPRECATED
+ */
+ HRESULT EditAndContinueRemap([in] ICorDebugAppDomain *pAppDomain,
+ [in] ICorDebugThread *pThread,
+ [in] ICorDebugFunction *pFunction,
+ [in] BOOL fAccurate);
+
+ /*
+ * BreakpointSetError is called if the CLR was unable to accuratley bind a breakpoint that
+ * was set before a function was JIT compiled. The given breakpoint will never be hit. The
+ * debugger should deactivate it and rebind it appropiatley.
+ */
+ HRESULT BreakpointSetError([in] ICorDebugAppDomain *pAppDomain,
+ [in] ICorDebugThread *pThread,
+ [in] ICorDebugBreakpoint *pBreakpoint,
+ [in] DWORD dwError);
+};
+#pragma warning(pop)
+
+#pragma warning(push)
+
+[
+ object,
+ local,
+ uuid(264EA0FC-2591-49AA-868E-835E6515323F),
+ pointer_default(unique)
+]
+
+interface ICorDebugManagedCallback3 : IUnknown
+{
+ /* Callback indicating an enabled custom debugger notification has been
+ * raised. pThread points to the thread that issued the notification.
+ * A subsequent call to GetCurrentCustomDebuggerNotification will retrieve the object that was passed to
+ * System.Diagnostics.Debugger.CustomNotification, whose type will be one
+ * that has been enabled via SetEnableCustomNotification.
+ * Note that this will return non-null if and only if we are currently inside a CustomNotification
+ * callback.
+ * The debugger can read type-specific parameters from fields of the data
+ * object, and store responses into fields.
+ * ICorDebug imposes no policy on the types of notifications or their
+ * contents, and their semantics are strictly a contract between
+ * debuggers and applications/frameworks.
+ */
+ HRESULT CustomNotification([in] ICorDebugThread * pThread, [in] ICorDebugAppDomain * pAppDomain);
+}
+
+
+#pragma warning(disable:28718) /* disable warning 28718 for interface ICorDebugManagedCallback2 */
+
+/*
+ * ICorDebugManagedCallback2 is a logical extension to ICorDebugManagedCallback.
+ * This handles new debug events introduced in V2.0. A debugger's callback object
+ * to ICorDebug::SetManagedHandler must implement this interface if it is debugging v2.0 apps.
+ */
+[
+ object,
+ local,
+ uuid(250E5EEA-DB5C-4C76-B6F3-8C46F12E3203),
+ pointer_default(unique)
+]
+interface ICorDebugManagedCallback2 : IUnknown
+{
+
+ /*
+ * FunctionRemapOpportunity is fired whenever execution reaches a sequence point in an older version
+ * of an edited function. This event gives the debugger an opportunity to remap the IP to its proper
+ * place in the new version by calling ICorDebugILFrame2::RemapFunction. If the debugger does not call
+ * RemapFunction before calling Continue, the runtime will continue executing the old code and will
+ * fire another FunctionRemapOpportunity callback at the next sequence point
+ */
+ HRESULT FunctionRemapOpportunity([in] ICorDebugAppDomain *pAppDomain,
+ [in] ICorDebugThread *pThread,
+ [in] ICorDebugFunction *pOldFunction,
+ [in] ICorDebugFunction *pNewFunction,
+ [in] ULONG32 oldILOffset);
+
+ /*
+ * CreateConnection is called when a new connection is created.
+ */
+ HRESULT CreateConnection([in] ICorDebugProcess *pProcess,
+ [in] CONNID dwConnectionId,
+ [in] WCHAR *pConnName);
+
+ /*
+ * ChangeConnection is called when a connection's set of tasks changes.
+ */
+ HRESULT ChangeConnection([in] ICorDebugProcess *pProcess,
+ [in] CONNID dwConnectionId );
+
+ /*
+ * DestroyConnection is called when a connection is ended.
+ */
+ HRESULT DestroyConnection([in] ICorDebugProcess *pProcess,
+ [in] CONNID dwConnectionId );
+
+
+
+
+
+
+ typedef enum CorDebugExceptionCallbackType
+ {
+ DEBUG_EXCEPTION_FIRST_CHANCE = 1, /* Fired when exception thrown */
+ DEBUG_EXCEPTION_USER_FIRST_CHANCE = 2, /* Fired when search reaches first user code */
+ DEBUG_EXCEPTION_CATCH_HANDLER_FOUND = 3, /* Fired if & when search finds a handler */
+ DEBUG_EXCEPTION_UNHANDLED = 4 /* Fired if search doesnt find a handler */
+ } CorDebugExceptionCallbackType;
+
+
+ typedef enum CorDebugExceptionFlags
+ {
+ DEBUG_EXCEPTION_NONE = 0,
+ DEBUG_EXCEPTION_CAN_BE_INTERCEPTED = 0x0001 /* Indicates interceptable exception */
+ } CorDebugExceptionFlags;
+
+
+ /*
+ * Exception is called at various points during the search phase of the
+ * exception-handling process. The exception being processed can be
+ * retrieved from the ICorDebugThread.
+ */
+ HRESULT Exception( [in] ICorDebugAppDomain *pAppDomain,
+ [in] ICorDebugThread *pThread,
+ [in] ICorDebugFrame *pFrame,
+ [in] ULONG32 nOffset,
+ [in] CorDebugExceptionCallbackType dwEventType,
+ [in] DWORD dwFlags );
+
+
+ typedef enum CorDebugExceptionUnwindCallbackType
+ {
+ DEBUG_EXCEPTION_UNWIND_BEGIN = 1, /* Fired at the beginning of the unwind */
+ DEBUG_EXCEPTION_INTERCEPTED = 2 /* Fired after an exception has been intercepted */
+ } CorDebugExceptionUnwindCallbackType;
+
+
+
+ /*
+ * For non-intercepted exceptions, ExceptionUnwind is called at the beginning of the second pass
+ * when we start to unwind the stack. For intercepted exceptions, ExceptionUnwind is called when
+ * the interception is complete, conceptually at the end of the second pass.
+ *
+ * dwFlags is not currently used.
+ */
+ HRESULT ExceptionUnwind( [in] ICorDebugAppDomain *pAppDomain,
+ [in] ICorDebugThread *pThread,
+ [in] CorDebugExceptionUnwindCallbackType dwEventType,
+ [in] DWORD dwFlags );
+
+ /*
+ * FunctionRemapComplete is fired whenever execution has completed switching over to a
+ * new version of an edited function (as requested by a call to ICorDebugILFrame2::RemapFunction).
+ * At this point (and no sooner) steppers can be added to that new version of the function.
+ */
+ HRESULT FunctionRemapComplete([in] ICorDebugAppDomain *pAppDomain,
+ [in] ICorDebugThread *pThread,
+ [in] ICorDebugFunction *pFunction);
+
+ // Notification that an Managed Debug Assistant (MDA) was hit in the debuggee process.
+ // - MDAs are heuristic warnings and do not require any explicit debugger action (other than continue, of course) for proper functionality.
+ // - The CLR can change what MDAs are fired (and what data is in any given MDA) at any point.
+ // - Therefore, debuggers should not build any specific functionality requiring specific MDAs patterns.
+ // - MDAs may be queued and fired "after the fact". This could happen if the runtime needs to slip from when an
+ // MDA occurs to get to a safe point for firing it. It also means the runtime reserves the right to fire a bunch of MDAs
+ // in a single set of callback queue (similar for what we do w/ attach events).
+ //
+ // See the MDA documentation for how to enable / disable notifications.
+ //
+ // Parameters:
+ // - pController is the controller object (process or appdomain) that the MDA occurred in.
+ // Clients should not make any assumption about whether the controller is a process or appdomain (though they can
+ // always QI to find out).
+ // Call continue on this to resume the debuggee.
+ // - pThread - managed thread on which the debug event occurred. If the MDA occurred on an unmanaged thread then
+ // this will be null. Get the OS thread ID from the MDA object itself.
+ // - pMDA is an object containing MDA information.
+ // Suggested usage is that the client does not keep a reference to the MDA object after returning from this callback
+ // because that lets the CLR quickly recycle the MDA's memory. This could be a performance win if there are
+ // lots of MDAs firing.
+ HRESULT MDANotification(
+ [in] ICorDebugController * pController,
+ [in] ICorDebugThread *pThread,
+ [in] ICorDebugMDA * pMDA
+ );
+
+};
+#pragma warning(pop)
+
+[
+ object,
+ local,
+ uuid(5263E909-8CB5-11d3-BD2F-0000F80849BD),
+ pointer_default(unique)
+]
+interface ICorDebugUnmanagedCallback : IUnknown
+{
+ /*
+ * DebugEvent is called when a DEBUG_EVENT is received which is
+ * not directly related to the Common Language Runtime.
+ *
+ * DO NOT USE any parts of the debugging API from the Win32 Event
+ * Thread. Only ICorDebugController::Continue() can be called on
+ * the Win32 Event Thread, and only when continuing from an out-of-band
+ * event.
+ *
+ * This callback is an exception to the rules about callbacks.
+ * When this callback is called, the process will be in the "raw"
+ * OS debug stopped state. The process will not be synchronized.
+ * The process will automatically enter the synchronized state when
+ * necessary to satisfy certain requests for information about
+ * managed code. (Note that this may result in other nested
+ * DebugEvent callbacks.)
+ *
+ * Call ClearCurrentException on the process to ignore an
+ * exception event before continuing the process. (Causes
+ * DBG_CONTINUE to be sent on continue rather than
+ * DBG_EXCEPTION_NOT_HANDLED)
+ * Out-of-band Breakpoint and single-step exceptions are automatically cleared.
+ *
+ * fOutOfBand will be FALSE if the debugging services support
+ * interaction with the process's managed state while the process
+ * is stopped due to this event. fOutOfBand will be TRUE if
+ * interaction with the process's managed state is impossible until
+ * the unmanaged event is continued from.
+ *
+ * Out-Of-Band events can come at anytime; even when there debuggee appears stopped
+ * and even when there's already an outstanding inband event.
+ *
+ * In v2.0, it is strongly recommended that the debugger just immediately
+ * continues OOB breakpoint events. The debugger should be using the ICorDebugProcess2
+ * SetUnmanagedBreakpoint and ClearUnmanagedBreakpoint APIs to add/remove breakpoints.
+ * Those APIs will already skip over any OOB breakpoints automatically. Thus the only
+ * oob breakpoints that get dispatched should be raw breakpoints already in the
+ * instruction stream (eg, like a call to kernel32!DebugBreak). In these cases,
+ * just continuing past the breakpoint is the correct thing to do. Do not try to use
+ * any other portion of the API like ClearCurrentException or Get/SetThreadContext.
+ *
+ */
+
+ HRESULT DebugEvent([in] LPDEBUG_EVENT pDebugEvent,
+ [in] BOOL fOutOfBand);
+};
+
+/* ------------------------------------------------------------------------- *
+ * Debugger interface
+ * ------------------------------------------------------------------------- */
+
+
+typedef enum CorDebugCreateProcessFlags
+{
+ DEBUG_NO_SPECIAL_OPTIONS = 0x0000
+} CorDebugCreateProcessFlags;
+
+
+/* ICorDebugHeapValue::CreateHandle takes a handle flavor.
+ * A strong handle will keep an object alive while a weak track resurrection
+ * will not.
+ */
+typedef enum CorDebugHandleType
+{
+ HANDLE_STRONG = 1,
+ HANDLE_WEAK_TRACK_RESURRECTION = 2
+} CorDebugHandleType;
+
+#pragma warning(push)
+#pragma warning(disable:28718) /* disable warning 28718 for interface ICorDebug */
+/*
+ * ICorDebug represents an event processing loop for a debugger process.
+ *
+ * The debugger must wait for the ExitProcess callback from all
+ * processes being debugged before releasing this interface.
+ *
+ * The ICorDebug object is the initial object to control all further managed debugging.
+ * In v1.0 + v1.1, this object was a CoClass created from COM.
+ * In v2.0, this object is no longer a CoClass and must be created from the function:
+ * CreateDebuggingInterfaceFromVersion(
+ * int iDebuggerVersion, // <--- CorDebugVersion_2_0 if Debugger is V2.0
+ * LPCWSTR szDebuggeeVersion, // <--- version string of debuggee. Eg, "v1.1.4322"
+ * IUnknown ** ppCordb
+ * )
+ * declared in mscoree.idl.
+ * This new creation function is more version-aware. It allows clients to get a
+ * specific implementation (as specified by szDebuggeeVersion) of ICorDebug, which
+ * also emulates a specific version of the debugging API (as specified by iDebuggerVersion).
+ */
+[
+ object,
+ local,
+ uuid(3d6f5f61-7538-11d3-8d5b-00104b35e7ef),
+ pointer_default(unique)
+]
+interface ICorDebug : IUnknown
+{
+ /*
+ * The debugger calls this method at creation time to initialize the debugging
+ * services, and must be called at creation time before any other method on
+ * ICorDebug is called.
+ */
+
+ HRESULT Initialize();
+
+ /*
+ * Terminate must be called when the ICorDebug is no longer needed.
+ *
+ * NOTE: Terminate should not be called until an ExitProcess callback has
+ * been received for all processes being debugged.
+ *
+ */
+
+ HRESULT Terminate();
+
+ /*
+ * SetManagedHandler should be called at creation time to specify the
+ * event handler object for managed events.
+ *
+ * Returns:
+ * S_OK on success.
+ * E_NOINTERFACE - if pCallback does not implement sufficient interfaces
+ * to receive debug events for the version of the API it requested.
+ * Eg, if debugging a V2.0 app, pCallback must implement ICorDebugManagedCallback2.
+ *
+ */
+
+ HRESULT SetManagedHandler([in] ICorDebugManagedCallback *pCallback);
+
+ /*
+ * SetUnmanagedHandler should be called at creation time to specify the
+ * event handler object for unmanaged events.
+ *
+ * This should be set after Initialize and before any calls to CreateProcess or DebugActiveProcess.
+ *
+ * However, for legacy purposes, it is not absolutely required to set this until
+ * before the first native debug event is fired. Specifically, if CreateProcess has the
+ * CREATE_SUSPENDED flag, native debug events will not be dispatched until the main thread
+ * is resumed.
+ * DebugActiveProcess will dispatch native debug events immediately, and so the unmanaged callback
+ * must be set before DebugActiveProcess is called.
+ *
+ * Returns:
+ * S_OK if callback pointer is successfully updated.
+ * failure on any failure.
+ *
+ */
+
+ HRESULT SetUnmanagedHandler([in] ICorDebugUnmanagedCallback *pCallback);
+
+ /*
+ * CreateProcess launches a process under the control of the debugger
+ * All parameters are the same as the win32 CreateProcess call.
+ *
+ * To enable unmanaged (mixed-mode) debugging, pass
+ * DEBUG_PROCESS | DEBUG_ONLY_THIS_PROCESS to dwCreationFlags. DEBUG_PROCESS
+ * alone is not supported. If only managed debugging is desired, do not set
+ * these flags.
+ *
+ * The debugger and debuggee share a single console, then it's possible for
+ * the debuggee to hold "console locks" and then get stopped at a debug event.
+ * The debugger will then block trying to use the console. This is only an issue
+ * when interop debugging and if debugger + debuggee share the console.
+ * It is recommended to use the CREATE_NEW_CONSOLE flag to avoid this problem.
+ *
+ */
+
+ HRESULT CreateProcess([in] LPCWSTR lpApplicationName,
+ [in] LPWSTR lpCommandLine,
+ [in] LPSECURITY_ATTRIBUTES lpProcessAttributes,
+ [in] LPSECURITY_ATTRIBUTES lpThreadAttributes,
+ [in] BOOL bInheritHandles,
+ [in] DWORD dwCreationFlags,
+ [in] PVOID lpEnvironment,
+ [in] LPCWSTR lpCurrentDirectory,
+ [in] LPSTARTUPINFOW lpStartupInfo,
+ [in] LPPROCESS_INFORMATION lpProcessInformation,
+ [in] CorDebugCreateProcessFlags debuggingFlags,
+ [out] ICorDebugProcess **ppProcess);
+
+ /*
+ * DebugActiveProcess is used to attach to an existing process.
+ *
+ * If win32Attach is TRUE, then the debugger becomes the Win32
+ * debugger for the process and will begin dispatching the
+ * unmanaged callbacks.
+ *
+ */
+
+ HRESULT DebugActiveProcess([in] DWORD id,
+ [in] BOOL win32Attach,
+ [out] ICorDebugProcess **ppProcess);
+
+ /*
+ * EnumerateProcesses returns an enum of processes being debugged.
+ *
+ */
+
+ HRESULT EnumerateProcesses([out] ICorDebugProcessEnum **ppProcess);
+
+ /*
+ * GetProcess returns the ICorDebugProcess with the given OS Id.
+ */
+
+ HRESULT GetProcess([in] DWORD dwProcessId,
+ [out] ICorDebugProcess **ppProcess);
+
+ /*
+ * CanLaunchOrAttach returns S_OK if the debugging services believe that
+ * launching a new process or attaching to the given process is possible
+ * given what it knows about the current machine and runtime configuration.
+ *
+ * If you plan to launch with win32 debugging enabled, or to attach with
+ * win32 debugging enabled then pass in TRUE for win32DebuggineEnabled.
+ * The answer may be different if this option will be used.
+ *
+ * Note: the rest of the API will not stop you from launching or attaching
+ * to a process anyway. This function is purely informational.
+ *
+ * Possible HRESULTs: S_OK, CORDBG_E_DEBUGGING_NOT_POSSIBLE,
+ * CORDBG_E_KERNEL_DEBUGGER_PRESENT, CORDBG_E_KERNEL_DEBUGGER_ENABLED
+ *
+ */
+
+ HRESULT CanLaunchOrAttach([in] DWORD dwProcessId,
+ [in] BOOL win32DebuggingEnabled);
+};
+#pragma warning(pop)
+
+/*
+ * A debugger can implement this interface and pass it to ICorDebugRemote to specify the host name of the
+ * target machine in Mac remote debugging scenarios. This is only supported on Silverlight.
+ */
+[
+ object,
+ local,
+ uuid(C3ED8383-5A49-4cf5-B4B7-01864D9E582D),
+ pointer_default(unique)
+]
+interface ICorDebugRemoteTarget : IUnknown
+{
+ /*
+ * Return the host name of the target machine. The host name can either be a fully qualified domain name or
+ * an IPv4 address. If cchHostName is 0 and szHostName is NULL, this function just returns the number of
+ * characters including the NULL character in the host name.
+ *
+ * cchHostName is the number of characters in the buffer szHostName. If this is 0, then szHostName must
+ * be NULL. If it is not 0, then szHostName must be non-NULL.
+ *
+ * pcchHostName returns the number of characters including the NULL character in the host name. This can
+ * be NULL.
+ *
+ * szHostName is the buffer for returning the host name.
+ */
+
+ HRESULT GetHostName([in] ULONG32 cchHostName,
+ [out, annotation("_Out_")] ULONG32 * pcchHostName,
+ [out, size_is(cchHostName), length_is(*pcchHostName), annotation("_Out_writes_to_opt_(cchHostName, *pcchHostName)")]
+ WCHAR szHostName[]);
+}
+
+/*
+ * A debugger can QI for this interface from an ICorDebug interface in order to specify a target machine in
+ * Mac remote debugging scenarios. This is only supported on Silverlight.
+ */
+[
+ object,
+ local,
+ uuid(D5EBB8E2-7BBE-4c1d-98A6-A3C04CBDEF64),
+ pointer_default(unique)
+]
+interface ICorDebugRemote : IUnknown
+{
+ HRESULT CreateProcessEx([in] ICorDebugRemoteTarget * pRemoteTarget,
+ [in] LPCWSTR lpApplicationName,
+ [in, annotation("_In_")] LPWSTR lpCommandLine,
+ [in] LPSECURITY_ATTRIBUTES lpProcessAttributes,
+ [in] LPSECURITY_ATTRIBUTES lpThreadAttributes,
+ [in] BOOL bInheritHandles,
+ [in] DWORD dwCreationFlags,
+ [in] PVOID lpEnvironment,
+ [in] LPCWSTR lpCurrentDirectory,
+ [in] LPSTARTUPINFOW lpStartupInfo,
+ [in] LPPROCESS_INFORMATION lpProcessInformation,
+ [in] CorDebugCreateProcessFlags debuggingFlags,
+ [out] ICorDebugProcess ** ppProcess);
+
+
+ HRESULT DebugActiveProcessEx([in] ICorDebugRemoteTarget * pRemoteTarget,
+ [in] DWORD dwProcessId,
+ [in] BOOL fWin32Attach,
+ [out] ICorDebugProcess ** ppProcess);
+}
+
+typedef struct _COR_VERSION
+{
+ DWORD dwMajor;
+ DWORD dwMinor;
+ DWORD dwBuild;
+ DWORD dwSubBuild;
+} COR_VERSION;
+
+
+[
+ object,
+ local,
+ uuid(ECCCCF2E-B286-4b3e-A983-860A8793D105),
+ pointer_default(unique)
+]
+/*
+ * Sets the maximum version of the runtime supported by the debugger using this
+ * object.
+ */
+interface ICorDebug2 : IUnknown
+{
+ typedef enum CorDebugInterfaceVersion
+ {
+ CorDebugInvalidVersion = 0,
+ CorDebugVersion_1_0 = CorDebugInvalidVersion + 1,
+ ver_ICorDebugManagedCallback = CorDebugVersion_1_0,
+ ver_ICorDebugUnmanagedCallback = CorDebugVersion_1_0,
+ ver_ICorDebug = CorDebugVersion_1_0,
+ ver_ICorDebugController = CorDebugVersion_1_0,
+ ver_ICorDebugAppDomain = CorDebugVersion_1_0,
+ ver_ICorDebugAssembly = CorDebugVersion_1_0,
+ ver_ICorDebugProcess = CorDebugVersion_1_0,
+ ver_ICorDebugBreakpoint = CorDebugVersion_1_0,
+ ver_ICorDebugFunctionBreakpoint = CorDebugVersion_1_0,
+ ver_ICorDebugModuleBreakpoint = CorDebugVersion_1_0,
+ ver_ICorDebugValueBreakpoint = CorDebugVersion_1_0,
+ ver_ICorDebugStepper = CorDebugVersion_1_0,
+ ver_ICorDebugRegisterSet = CorDebugVersion_1_0,
+ ver_ICorDebugThread = CorDebugVersion_1_0,
+ ver_ICorDebugChain = CorDebugVersion_1_0,
+ ver_ICorDebugFrame = CorDebugVersion_1_0,
+ ver_ICorDebugILFrame = CorDebugVersion_1_0,
+ ver_ICorDebugNativeFrame = CorDebugVersion_1_0,
+ ver_ICorDebugModule = CorDebugVersion_1_0,
+ ver_ICorDebugFunction = CorDebugVersion_1_0,
+ ver_ICorDebugCode = CorDebugVersion_1_0,
+ ver_ICorDebugClass = CorDebugVersion_1_0,
+ ver_ICorDebugEval = CorDebugVersion_1_0,
+ ver_ICorDebugValue = CorDebugVersion_1_0,
+ ver_ICorDebugGenericValue = CorDebugVersion_1_0,
+ ver_ICorDebugReferenceValue = CorDebugVersion_1_0,
+ ver_ICorDebugHeapValue = CorDebugVersion_1_0,
+ ver_ICorDebugObjectValue = CorDebugVersion_1_0,
+ ver_ICorDebugBoxValue = CorDebugVersion_1_0,
+ ver_ICorDebugStringValue = CorDebugVersion_1_0,
+ ver_ICorDebugArrayValue = CorDebugVersion_1_0,
+ ver_ICorDebugContext = CorDebugVersion_1_0,
+ ver_ICorDebugEnum = CorDebugVersion_1_0,
+ ver_ICorDebugObjectEnum = CorDebugVersion_1_0,
+ ver_ICorDebugBreakpointEnum = CorDebugVersion_1_0,
+ ver_ICorDebugStepperEnum = CorDebugVersion_1_0,
+ ver_ICorDebugProcessEnum = CorDebugVersion_1_0,
+ ver_ICorDebugThreadEnum = CorDebugVersion_1_0,
+ ver_ICorDebugFrameEnum = CorDebugVersion_1_0,
+ ver_ICorDebugChainEnum = CorDebugVersion_1_0,
+ ver_ICorDebugModuleEnum = CorDebugVersion_1_0,
+ ver_ICorDebugValueEnum = CorDebugVersion_1_0,
+ ver_ICorDebugCodeEnum = CorDebugVersion_1_0,
+ ver_ICorDebugTypeEnum = CorDebugVersion_1_0,
+ ver_ICorDebugErrorInfoEnum = CorDebugVersion_1_0,
+ ver_ICorDebugAppDomainEnum = CorDebugVersion_1_0,
+ ver_ICorDebugAssemblyEnum = CorDebugVersion_1_0,
+ ver_ICorDebugEditAndContinueErrorInfo = CorDebugVersion_1_0,
+ ver_ICorDebugEditAndContinueSnapshot = CorDebugVersion_1_0,
+
+ CorDebugVersion_1_1 = CorDebugVersion_1_0 + 1,
+ // no interface definitions in v1.1
+
+ CorDebugVersion_2_0 = CorDebugVersion_1_1 + 1,
+
+ ver_ICorDebugManagedCallback2 = CorDebugVersion_2_0,
+ ver_ICorDebugAppDomain2 = CorDebugVersion_2_0,
+ ver_ICorDebugAssembly2 = CorDebugVersion_2_0,
+ ver_ICorDebugProcess2 = CorDebugVersion_2_0,
+ ver_ICorDebugStepper2 = CorDebugVersion_2_0,
+ ver_ICorDebugRegisterSet2 = CorDebugVersion_2_0,
+ ver_ICorDebugThread2 = CorDebugVersion_2_0,
+ ver_ICorDebugILFrame2 = CorDebugVersion_2_0,
+ ver_ICorDebugInternalFrame = CorDebugVersion_2_0,
+ ver_ICorDebugModule2 = CorDebugVersion_2_0,
+ ver_ICorDebugFunction2 = CorDebugVersion_2_0,
+ ver_ICorDebugCode2 = CorDebugVersion_2_0,
+ ver_ICorDebugClass2 = CorDebugVersion_2_0,
+ ver_ICorDebugValue2 = CorDebugVersion_2_0,
+ ver_ICorDebugEval2 = CorDebugVersion_2_0,
+ ver_ICorDebugObjectValue2 = CorDebugVersion_2_0,
+
+ // CLR v4 - next major CLR version after CLR v2
+ // Includes Silverlight 4
+ CorDebugVersion_4_0 = CorDebugVersion_2_0 + 1,
+
+ ver_ICorDebugThread3 = CorDebugVersion_4_0,
+ ver_ICorDebugThread4 = CorDebugVersion_4_0,
+ ver_ICorDebugStackWalk = CorDebugVersion_4_0,
+ ver_ICorDebugNativeFrame2 = CorDebugVersion_4_0,
+ ver_ICorDebugInternalFrame2 = CorDebugVersion_4_0,
+ ver_ICorDebugRuntimeUnwindableFrame = CorDebugVersion_4_0,
+ ver_ICorDebugHeapValue3 = CorDebugVersion_4_0,
+ ver_ICorDebugBlockingObjectEnum = CorDebugVersion_4_0,
+ ver_ICorDebugValue3 = CorDebugVersion_4_0,
+
+ CorDebugVersion_4_5 = CorDebugVersion_4_0 + 1,
+
+ ver_ICorDebugComObjectValue = CorDebugVersion_4_5,
+ ver_ICorDebugAppDomain3 = CorDebugVersion_4_5,
+ ver_ICorDebugCode3 = CorDebugVersion_4_5,
+ ver_ICorDebugILFrame3 = CorDebugVersion_4_5,
+
+ CorDebugLatestVersion = CorDebugVersion_4_5
+
+ } CorDebugInterfaceVersion;
+
+};
+
+/* ------------------------------------------------------------------------- *
+ * Controller interface
+ * ------------------------------------------------------------------------- */
+
+
+/*
+ * A thread's DebugState determines whether the debugger lets a thread
+ * run or not. Possible states are:
+ *
+ * THREAD_RUN - thread runs freely, unless a debug event occurs
+ * THREAD_SUSPEND - thread cannot run.
+ *
+ * NOTE: We allow for message pumping via a callback provided to the Hosting
+ * API, thus we don't need an 'interrupted' state here.
+ */
+
+typedef enum CorDebugThreadState
+{
+ THREAD_RUN,
+ THREAD_SUSPEND
+} CorDebugThreadState;
+
+
+/*
+ * ICorDebugController represents a scope at which program execution context
+ * can be controlled. It represents either a process or an app domain.
+ *
+ * If this is the controller of a process, this controller affects all
+ * threads in the process. Otherwise it just affects the threads of
+ * a particular app domain
+ */
+
+[
+ object,
+ local,
+ uuid(3d6f5f62-7538-11d3-8d5b-00104b35e7ef),
+ pointer_default(unique)
+]
+
+interface ICorDebugController : IUnknown
+{
+ /*
+ * Stop performs a cooperative stop on all threads running managed
+ * code in the process. When managed-only debugging, unmanaged threads may continue
+ * to run (but will be blocked when trying to call managed code). When-interop debugging,
+ * unmanaged threads will also be stopped.
+ * The timeout value is currently ignored and treated as INFINTE (-1).
+ * If the cooperative stop fails due to a deadlock, all threads are suspended (and E_TIMEOUT is returned)
+ *
+ * NOTE: This function is the one function in the debugging API
+ * that is synchronous. When Stop returns with S_OK, the process
+ * is stopped. (No callback will be given to notify of the stop.)
+ * The debugger must call Continue when it wishes to allow
+ * the process to resume running.
+ *
+ * The debugger maintains a "stop-counter". When the counter goes to zero, the
+ * Controller is resumed. Each call to Stop() or each dispatched callback will increment
+ * the counter. Each call to continue will decrement the counter.
+ */
+
+ HRESULT Stop([in] DWORD dwTimeoutIgnored);
+
+ /*
+ * Continue continues the process after a call to Stop.
+ *
+ * Continue continues the process. fIsOutOfBand is set to TRUE
+ * if continuing from an unmanaged event that was sent with the
+ * fOutOfBand flag in the unmanaged callback and it is set to
+ * FALSE if continuing from a managed event or a normal
+ * unmanaged event.
+ *
+ * When doing mixed-mode debugging, Continue cannot be called on
+ * the Win32 Event Thread unless it is continuing from an
+ * out-of-band event.
+ */
+
+ HRESULT Continue([in] BOOL fIsOutOfBand);
+
+ /*
+ * IsRunning returns TRUE if the threads in the process are running freely.
+ *
+ */
+
+ HRESULT IsRunning([out] BOOL *pbRunning);
+
+ /*
+ * HasQueuedCallbacks returns TRUE if there are currently managed
+ * callbacks which are queued up for the given thread. These
+ * callbacks will be dispatched one at a time, each time Continue
+ * is called.
+ *
+ * The debugger can check this flag if it wishes to report multiple
+ * debugging events which occur simultaneously.
+ *
+ * If NULL is given for the pThread parameter, HasQueuedCallbacks
+ * will return TRUE if there are currently managed callbacks
+ * queued for any thread.
+ *
+ * Note that once debug events have been queued, they've already occurred,
+ * and so the debugger must drain the entire queue to be sure of the state
+ * of the debuggee. For example, if the queue contains 2 debug events on thread X,
+ * and the debugger suspends thread X after the 1st debug event and then calls continue,
+ * the 2nd debug event for thread X will still be dispatched even though the thread
+ * is suspended.
+ *
+ */
+
+ HRESULT HasQueuedCallbacks([in] ICorDebugThread *pThread,
+ [out] BOOL *pbQueued);
+
+ /*
+ * EnumerateThreads returns an enum of all managed threads active in the process.
+ * A thread is considered Managed threads after the CreateThread callback has been
+ * dispatched and before the ExitThread callback has been dispatched.
+ * A managed thread may not necessarily have any managed frames on its stack.
+ *
+ * Threads can be enumerated even before the CreateProcess callback. The enumeration
+ * will naturally be empty.
+ */
+
+ HRESULT EnumerateThreads([out] ICorDebugThreadEnum **ppThreads);
+
+ /*
+ * SetAllThreadsDebugState sets the current debug state of each thread.
+ * See ICorDebugThread::SetDebugState for details.
+ *
+ * The pExceptThisThread parameter allows you to specify one
+ * thread which is exempted from the debug state change. Pass NULL
+ * if you want to affect all threads.
+ *
+ * This may affect threads not visible via EnumerateThreads, so threads suspended
+ * via this API will need to be resumed via this API too.
+ *
+ */
+
+ HRESULT SetAllThreadsDebugState([in] CorDebugThreadState state,
+ [in] ICorDebugThread *pExceptThisThread);
+
+ /*
+ * Detach detaches the debugger from the process. The process
+ * continues execution normally. The ICorDebugProcess object is
+ * no longer valid and no further callbacks will occur. This is
+ * not implemented for AppDomains (detaching is process-wide).
+ *
+ * Note that currently if unmanaged debugging is enabled this call will
+ * fail due to OS limitations.
+ *
+ * Returns S_OK on success.
+ *
+ */
+
+ HRESULT Detach();
+
+ /*
+ * Terminate terminates the process (with extreme prejudice, I might add).
+ *
+ * NOTE: If the process or appdomain is stopped when Terminate is called,
+ * the process or appdomain should be continued using Continue so that the
+ * ExitProcess or ExitAppDomain callback is received.
+ *
+ * NOTE: This method is not implemented by an appdomain.
+ */
+
+ HRESULT Terminate([in] UINT exitCode);
+
+ /*
+ * DEPRECATED
+ */
+
+ HRESULT CanCommitChanges([in] ULONG cSnapshots,
+ [in, size_is(cSnapshots)] ICorDebugEditAndContinueSnapshot *pSnapshots[],
+ [out] ICorDebugErrorInfoEnum **pError);
+
+
+ /*
+ * DEPRECATED
+ */
+
+ HRESULT CommitChanges([in] ULONG cSnapshots,
+ [in, size_is(cSnapshots)] ICorDebugEditAndContinueSnapshot *pSnapshots[],
+ [out] ICorDebugErrorInfoEnum **pError);
+
+};
+
+
+
+#pragma warning(push)
+#pragma warning(disable:28718) /* disable warning 28718 for interface ICorDebugAppDomain */
+/* ------------------------------------------------------------------------- *
+ *
+ * AppDomain interface
+ *
+ * ------------------------------------------------------------------------- */
+
+
+[
+ object,
+ local,
+ uuid(3d6f5f63-7538-11d3-8d5b-00104b35e7ef),
+ pointer_default(unique)
+]
+interface ICorDebugAppDomain : ICorDebugController
+{
+ /*
+ * GetProcess returns the process containing the app domain
+ */
+
+ HRESULT GetProcess([out] ICorDebugProcess **ppProcess);
+
+ /*
+ * EnumerateAssemblies enumerates all assemblies in the app domain
+ *
+ */
+
+ HRESULT EnumerateAssemblies([out] ICorDebugAssemblyEnum **ppAssemblies);
+
+ /*
+ * GetModuleFromMetaDataInterface returns the ICorDebugModule with
+ * the given metadata interface.
+ */
+
+ HRESULT GetModuleFromMetaDataInterface([in] IUnknown *pIMetaData,
+ [out] ICorDebugModule **ppModule);
+
+ /*
+ * EnumerateBreakpoints returns an enum (ICorDebugBreakpointEnum) of all active
+ * breakpoints in the app domain. This includes all types of breakpoints :
+ * function breakpoints, data breakpoints, etc.
+ */
+
+ HRESULT EnumerateBreakpoints([out] ICorDebugBreakpointEnum **ppBreakpoints);
+
+ /*
+ * EnumerateSteppers returns an enum of all active steppers in the app domain.
+ *
+ */
+
+ HRESULT EnumerateSteppers([out] ICorDebugStepperEnum **ppSteppers);
+
+ /*
+ * DEPRECATED. Always returns TRUE in V3 (attaching is process-wide).
+ */
+
+ HRESULT IsAttached([out] BOOL *pbAttached);
+
+
+ /*
+ * GetName returns the name of the app domain.
+ *
+ * Usage pattern:
+ * *pcchName is always set to the length of pInputString (including NULL) in characters. This lets
+ * callers know the full size of buffer they'd need to allocate to get the full string.
+ *
+ * if (cchName == 0) then we're in "query" mode:
+ * This fails if szName is non-null or pcchName is null
+ * Else this function will set pcchName to let the caller know how large of a buffer to allocate
+ * and return S_OK.
+ *
+ * if (cchName != 0) then
+ * This fails if szName is null.
+ * Else this copies as much as can fit into szName (it will always null terminate szName) and returns S_OK.
+ * pcchName can be null. If it's non-null, we set it.
+ *
+ * The expected usage pattern is that a client will call once to get the size of a buffer needed for the name,
+ * allocate the buffer, and then call a 2nd time to fill in the buffer.
+ *
+ * The rest of the GetName() functions have the same semantics for the parameters unless otherwise noted.
+ */
+
+ HRESULT GetName([in] ULONG32 cchName,
+ [out] ULONG32 *pcchName,
+ [out, size_is(cchName),
+ length_is(*pcchName)] WCHAR szName[]);
+
+ /*
+ * GetObject returns a reference to the System.AppDomain object which represents this AppDomain
+ * from within the runtime.
+ *
+ * Note: this object is lazily initialized within the runtime and may return NULL if the object
+ * does not yet exist. This case will return S_FALSE and is not considered a failure.
+ *
+ */
+
+ HRESULT GetObject([out] ICorDebugValue **ppObject);
+
+ /*
+ * DEPRECATED. This does nothing in V3. Attaching is process-wide.
+ */
+
+ HRESULT Attach();
+
+ /*
+ * Get the ID of this app domain. The ID will be unique within the
+ * containing process.
+ */
+
+ HRESULT GetID([out] ULONG32 *pId);
+};
+#pragma warning(pop)
+
+[
+ object,
+ local,
+ uuid(096E81D5-ECDA-4202-83F5-C65980A9EF75),
+ pointer_default(unique)
+]
+interface ICorDebugAppDomain2 : IUnknown
+{
+ /*
+ * GetArrayOrPointerType returns an array, pointer, byref or function pointer type.
+ * elementType indicated the kind of type to be created and
+ * must be one of ELEMENT_TYPE_PTR, ELEMENT_TYPE_BYREF,
+ * ELEMENT_TYPE_ARRAY or ELEMENT_TYPE_SZARRAY. If used with
+ * ELEMENT_TYPE_PTR or ELEMENT_TYPE_BYREF then nRank must be zero.
+ */
+
+ HRESULT GetArrayOrPointerType([in] CorElementType elementType,
+ [in] ULONG32 nRank,
+ [in] ICorDebugType *pTypeArg,
+ [out] ICorDebugType **ppType);
+
+ /*
+ * GetFunctionPointerType returns a function pointer type.
+ * This corresponds to ELEMENT_TYPE_FNPTR. The first type in the type arguments
+ * must be the return type and the remainder the argument types.
+ */
+
+ HRESULT GetFunctionPointerType( [in] ULONG32 nTypeArgs,
+ [in, size_is(nTypeArgs)] ICorDebugType *ppTypeArgs[],
+ [out] ICorDebugType **ppType);
+};
+
+[
+ object,
+ local,
+ uuid(6164D242-1015-4BD6-8CBE-D0DBD4B8275A),
+ pointer_default(unique)
+]
+interface ICorDebugGuidToTypeEnum : ICorDebugEnum
+{
+ /*
+ * Gets the next "celt" number of IID / Type pairs from the app domain cache.
+ * The actual number of frames retrieved is returned in "pceltFetched".
+ * Returns S_FALSE if the actual number of pairs retrieved is smaller
+ * than the number of pairs requested.
+ */
+ HRESULT Next([in] ULONG celt,
+ [out, size_is(celt), length_is(*pceltFetched)]
+ CorDebugGuidToTypeMapping values[],
+ [out] ULONG* pceltFetched);
+};
+
+[
+ object,
+ local,
+ uuid(8CB96A16-B588-42E2-B71C-DD849FC2ECCC),
+ pointer_default(unique)
+]
+interface ICorDebugAppDomain3 : IUnknown
+{
+ /*
+ * Returns an enumeration of types corresponding to the IIDs passed in
+ * guidsToResolve. The enumeration will have the same cReqTypes elements
+ * with NULL values corresponding to unknown IIDs.
+ */
+ HRESULT GetCachedWinRTTypesForIIDs(
+ [in] ULONG32 cReqTypes,
+ [in, size_is(cReqTypes)] GUID * iidsToResolve,
+ [out] ICorDebugTypeEnum ** ppTypesEnum);
+
+ /*
+ * Returns an enumeration of IID / Type pairs. This is the exhaustive
+ * list of pairs as they were cached in the current app domain.
+ */
+ HRESULT GetCachedWinRTTypes(
+ [out] ICorDebugGuidToTypeEnum ** ppGuidToTypeEnum);
+};
+
+[
+ object,
+ local,
+ uuid(FB99CC40-83BE-4724-AB3B-768E796EBAC2),
+ pointer_default(unique)
+]
+interface ICorDebugAppDomain4 : IUnknown
+{
+ /*
+ * gives back the managed object for a given CCW pointer
+ */
+ HRESULT GetObjectForCCW([in]CORDB_ADDRESS ccwPointer, [out]ICorDebugValue **ppManagedObject);
+};
+
+#pragma warning(push)
+#pragma warning(disable:28718) /* disable warning 28718 for interface ICorDebugAssembly */
+
+/* ------------------------------------------------------------------------- *
+ * Assembly interface
+ * An ICorDebugAssembly instance corresponds to a a managed assembly loaded
+ * into a specific AppDomain in the CLR. For assemblies shared between multiple
+ * AppDomains (eg. mscorlib), there will be a separate ICorDebugAssembly instance
+ * per AppDomain in which it is used.
+ * ------------------------------------------------------------------------- */
+[
+ object,
+ local,
+ uuid(df59507c-d47a-459e-bce2-6427eac8fd06),
+ pointer_default(unique)
+]
+
+interface ICorDebugAssembly : IUnknown
+{
+ /*
+ * GetProcess returns the process containing the assembly
+ */
+
+ HRESULT GetProcess([out] ICorDebugProcess **ppProcess);
+
+ /*
+ * GetAppDomain returns the app domain containing the assembly.
+ */
+
+ HRESULT GetAppDomain([out] ICorDebugAppDomain **ppAppDomain);
+
+ /*
+ * EnumerateModules enumerates all modules in the assembly
+ *
+ */
+
+ HRESULT EnumerateModules([out] ICorDebugModuleEnum **ppModules);
+
+ /*
+ * NOT YET IMPLEMENTED
+ */
+
+ HRESULT GetCodeBase([in] ULONG32 cchName,
+ [out] ULONG32 *pcchName,
+ [out, size_is(cchName),
+ length_is(*pcchName)] WCHAR szName[]);
+
+ /*
+ * GetName returns the full path and filename of the assembly.
+ * If the assembly has no filename (i.e. it is in-memory only),
+ * S_FALSE is returned, and a fabricated string is stored into szName.
+ */
+
+ HRESULT GetName([in] ULONG32 cchName,
+ [out] ULONG32 *pcchName,
+ [out, size_is(cchName),
+ length_is(*pcchName)] WCHAR szName[]);
+};
+#pragma warning(pop)
+
+[
+ object,
+ local,
+ uuid(426d1f9e-6dd4-44c8-aec7-26cdbaf4e398),
+ pointer_default(unique)
+]
+interface ICorDebugAssembly2 : IUnknown
+{
+ /*
+ * IsFullyTrusted sets a flag indicating whether the assembly has
+ * been granted full trust by the runtime security system.
+ * This may return CORDBG_E_NOTREADY if the security policy for
+ * the assembly has not yet been resolved (eg. no code in the
+ * assembly has been run yet).
+ */
+ HRESULT IsFullyTrusted([out] BOOL *pbFullyTrusted);
+};
+
+[
+ object,
+ local,
+ uuid(76361AB2-8C86-4FE9-96F2-F73D8843570A),
+ pointer_default(unique)
+]
+interface ICorDebugAssembly3 : IUnknown
+{
+ /*
+ * If this assembly has been merged with others inside a single container assembly,
+ * this gives back the container. Otherwise *ppAssembly = NULL and the result is S_FALSE.
+ */
+ HRESULT GetContainerAssembly(ICorDebugAssembly **ppAssembly);
+
+ /*
+ * Gets an enumeration for all the assemblies contained within this assembly
+ * If the assembly isn't a container, the result is S_FALSE and the enumeration
+ * will be empty. Symbols are needed to compute this result; if they aren't
+ * present an error will be returned and no enumeration provided.
+ */
+ HRESULT EnumerateContainedAssemblies(ICorDebugAssemblyEnum **ppAssemblies);
+};
+
+
+/* ------------------------------------------------------------------------- *
+ * Heap enumeration interface
+ * ------------------------------------------------------------------------- */
+
+cpp_quote("#ifndef _DEF_COR_TYPEID_")
+cpp_quote("#define _DEF_COR_TYPEID_")
+typedef struct COR_TYPEID
+{
+ UINT64 token1;
+ UINT64 token2;
+} COR_TYPEID;
+cpp_quote("#endif // _DEF_COR_TYPEID_")
+
+typedef struct _COR_HEAPOBJECT
+{
+ CORDB_ADDRESS address; // The address (in memory) of the object.
+ ULONG64 size; // The total size of the object.
+ COR_TYPEID type; // The fully instantiated type of the object.
+} COR_HEAPOBJECT;
+
+[
+ object,
+ local,
+ uuid(76D7DAB8-D044-11DF-9A15-7E29DFD72085),
+ pointer_default(unique)
+]
+interface ICorDebugHeapEnum : ICorDebugEnum
+{
+ /*
+ * Gets the next "celt" number of objects in the enumeration.
+ * The actual number of objects retrieved is returned in "pceltFetched".
+ * Returns S_FALSE if the actual number of objects retrieved is smaller
+ * than the number of objects requested.
+ */
+ HRESULT Next([in] ULONG celt,
+ [out, size_is(celt), length_is(*pceltFetched)] COR_HEAPOBJECT objects[],
+ [out] ULONG *pceltFetched);
+};
+
+
+/* ------------------------------------------------------------------------- *
+ * Segment enumeration interface
+ * ------------------------------------------------------------------------- */
+
+typedef enum CorDebugGenerationTypes
+{
+ CorDebug_Gen0 = 0,
+ CorDebug_Gen1 = 1,
+ CorDebug_Gen2 = 2,
+ CorDebug_LOH = 3,
+} CorDebugGenerationTypes;
+
+typedef struct _COR_SEGMENT
+{
+ CORDB_ADDRESS start; // The start address of the segment.
+ CORDB_ADDRESS end; // The end address of the segment.
+ CorDebugGenerationTypes type; // The generation of the segment.
+ ULONG heap; // The heap the segment resides in.
+} COR_SEGMENT;
+
+
+typedef enum CorDebugGCType
+{
+ CorDebugWorkstationGC,
+ CorDebugServerGC
+} CorDebugGCType;
+
+typedef struct _COR_HEAPINFO
+{
+ BOOL areGCStructuresValid; // TRUE if it's ok to walk the heap, FALSE otherwise.
+ DWORD pointerSize; // The size of pointers on the target architecture in bytes.
+ DWORD numHeaps; // The number of logical GC heaps in the process.
+ BOOL concurrent; // Is the GC concurrent?
+ CorDebugGCType gcType; // Workstation or Server?
+} COR_HEAPINFO;
+
+[
+ object,
+ local,
+ uuid(A2FA0F8E-D045-11DF-AC8E-CE2ADFD72085),
+ pointer_default(unique)
+]
+interface ICorDebugHeapSegmentEnum : ICorDebugEnum
+{
+ /*
+ * Gets the next "celt" number of objects in the enumeration.
+ * The actual number of objects retrieved is returned in "pceltFetched".
+ * Returns S_FALSE if the actual number of objects retrieved is smaller
+ * than the number of objects requested.
+ */
+ HRESULT Next([in] ULONG celt,
+ [out, size_is(celt), length_is(*pceltFetched)] COR_SEGMENT segments[],
+ [out] ULONG *pceltFetched);
+};
+
+
+/* ------------------------------------------------------------------------- *
+ * Reference enumeration interface
+ * ------------------------------------------------------------------------- */
+typedef enum CorGCReferenceType
+{
+ CorHandleStrong = 1<<0,
+ CorHandleStrongPinning = 1<<1,
+ CorHandleWeakShort = 1<<2,
+ CorHandleWeakLong = 1<<3,
+ CorHandleWeakRefCount = 1<<4,
+ CorHandleStrongRefCount = 1<<5,
+ CorHandleStrongDependent = 1<<6,
+ CorHandleStrongAsyncPinned = 1<<7,
+ CorHandleStrongSizedByref = 1<<8,
+ CorHandleWeakWinRT = 1<<9,
+
+ CorReferenceStack = 0x80000001,
+ CorReferenceFinalizer = 80000002,
+
+ // Used for EnumHandles
+ CorHandleStrongOnly = 0x1E3,
+ CorHandleWeakOnly = 0x21C,
+ CorHandleAll = 0x7FFFFFFF
+} CorGCReferenceType;
+
+
+cpp_quote("#ifndef _DEF_COR_GC_REFERENCE_")
+cpp_quote("#define _DEF_COR_GC_REFERENCE_")
+typedef struct COR_GC_REFERENCE
+{
+ ICorDebugAppDomain *Domain; // The AppDomain of the handle/object, may be null.
+ ICorDebugValue *Location; // A reference to the object
+ CorGCReferenceType Type; // Where the root came from.
+
+ /*
+ DependentSource - for HandleDependent
+ RefCount - for HandleStrongRefCount
+ Size - for HandleSizedByref
+ */
+ UINT64 ExtraData;
+} COR_GC_REFERENCE;
+
+cpp_quote("#endif // _DEF_COR_GC_REFERENCE_")
+
+[
+ object,
+ local,
+ uuid(7F3C24D3-7E1D-4245-AC3A-F72F8859C80C),
+ pointer_default(unique)
+]
+interface ICorDebugGCReferenceEnum : ICorDebugEnum
+{
+ HRESULT Next([in] ULONG celt,
+ [out, size_is(celt), length_is(*pceltFetched)] COR_GC_REFERENCE roots[],
+ [out] ULONG *pceltFetched);
+}
+
+cpp_quote("#ifndef _DEF_COR_ARRAY_LAYOUT_")
+cpp_quote("#define _DEF_COR_ARRAY_LAYOUT_")
+typedef struct COR_ARRAY_LAYOUT
+{
+ COR_TYPEID componentID; // The type of objects the array contains
+
+ CorElementType componentType; // Whether the component itself is a GC reference, value class, or primitive
+
+ ULONG32 firstElementOffset; // The offset to the first element
+ ULONG32 elementSize; // The size of each element
+ ULONG32 countOffset; // The offset to the number of elements in the array.
+
+ // For multidimensional arrays (works with normal arrays too).
+ ULONG32 rankSize; // The size of the rank
+ ULONG32 numRanks; // The number of ranks in the array (1 for array, N for multidimensional array)
+ ULONG32 rankOffset; // The offset at which the ranks start
+} COR_ARRAY_LAYOUT;
+
+cpp_quote("#endif // _DEF_COR_ARRAY_LAYOUT_")
+
+
+cpp_quote("#ifndef _DEF_COR_TYPE_LAYOUT_")
+cpp_quote("#define _DEF_COR_TYPE_LAYOUT_")
+typedef struct COR_TYPE_LAYOUT
+{
+ COR_TYPEID parentID;
+ ULONG32 objectSize;
+ ULONG32 numFields;
+ ULONG32 boxOffset;
+ CorElementType type;
+} COR_TYPE_LAYOUT;
+cpp_quote("#endif // _DEF_COR_TYPE_LAYOUT_")
+
+cpp_quote("#ifndef _DEF_COR_FIELD_")
+cpp_quote("#define _DEF_COR_FIELD_")
+typedef struct COR_FIELD
+{
+ mdFieldDef token; // FieldDef token to get the field info
+ ULONG32 offset; // Offset in object of data.
+ COR_TYPEID id; // TYPEID of the field
+
+ CorElementType fieldType;
+} COR_FIELD;
+cpp_quote("#endif // _DEF_COR_FIELD_")
+
+
+
+
+/* ------------------------------------------------------------------------- *
+ * Process interface
+ * ------------------------------------------------------------------------- */
+
+#pragma warning(push)
+#pragma warning(disable:28718) /* suppress warning 28718 for interface ICorDebugProcess */
+
+/*
+ * ICorDebugProcess represents a process running some managed code.
+ */
+
+[
+ object,
+ local,
+ uuid(3d6f5f64-7538-11d3-8d5b-00104b35e7ef),
+ pointer_default(unique)
+]
+interface ICorDebugProcess : ICorDebugController
+{
+ /*
+ * GetID returns the OS ID of the process.
+ */
+
+ HRESULT GetID([out] DWORD *pdwProcessId);
+
+ /*
+ * GetHandle returns a handle to the process. This handle is owned
+ * by the debugging API; the debugger should duplicate it before
+ * using it.
+ */
+
+ HRESULT GetHandle([out] HPROCESS *phProcessHandle);
+
+ /*
+ * GetThread returns the ICorDebugThread with the given OS Id.
+ *
+ * Note that eventually there will not be a one to one correspondence
+ * between OS threads and runtime threads, so this entry point will
+ * go away.
+ */
+
+ HRESULT GetThread([in] DWORD dwThreadId, [out] ICorDebugThread **ppThread);
+
+ /*
+ * NOT YET IMPLEMENTED
+ */
+
+ HRESULT EnumerateObjects([out] ICorDebugObjectEnum **ppObjects);
+
+ /*
+ * IsTransitionStub tests whether an address is inside of a transition stub
+ * which will cause a transition to managed code. This can be used by
+ * unmanaged stepping code to decide when to return stepping control to
+ * the managed stepper.
+ *
+ * Note that, tentatively, these stubs may also be able to be identified
+ * ahead of time by looking at information in the PE file.
+ *
+ */
+
+ HRESULT IsTransitionStub([in] CORDB_ADDRESS address,
+ [out] BOOL *pbTransitionStub);
+
+
+ /*
+ * IsOSSuspended returns whether or not the thread has been
+ * suspended as part of the debugger logic of stopping the process.
+ * (that is, it has had its Win32 suspend count incremented by
+ * one.) The debugger UI may want to take this into account if
+ * it shows the user the OS suspend count of the thread.
+ *
+ * This function only makes sense in the context of
+ * unmanaged debugging - during managed debugging threads are not
+ * OS suspended. (They are cooperatively suspended.)
+ */
+
+ HRESULT IsOSSuspended([in] DWORD threadID, [out] BOOL *pbSuspended);
+
+ /*
+ * GetThreadContext returns the context for the given thread. The
+ * debugger should call this function rather than the Win32
+ * GetThreadContext, because the thread may actually be in a "hijacked"
+ * state where its context has been temporarily changed.
+ *
+ * This should only be used on when a thread is in native code. Use ICorDebugRegisterSet
+ * for threads in managed code.
+ *
+ * The data returned is a CONTEXT structure for the current platform.
+ * (CONTEXT is typically declared in winnt.h) Just as with a call
+ * to Win32's GetThreadContext, the caller should initialize the
+ * CONTEXT struct before calling.
+ *
+ */
+
+ HRESULT GetThreadContext([in] DWORD threadID,
+ [in] ULONG32 contextSize,
+ [in, out, length_is(contextSize),
+ size_is(contextSize)] BYTE context[]);
+
+ /*
+ * SetThreadContext sets the context for the given thread. The
+ * debugger should call this function rather than the Win32
+ * SetThreadContext, because the thread may actually be in a "hijacked"
+ * state where its context has been temporarily changed.
+ *
+ * This should only be used on when a thread is in native code. Use ICorDebugRegisterSet
+ * for threads in managed code.
+ *
+ * This should never be needed to modify the context of a thread during an oob-debug
+ * event.
+ *
+ * The data passed should be a CONTEXT structure for the current platform.
+ * (CONTEXT is typically declared in winnt.h)
+ *
+ * This is a dangerous call which can corrupt the runtime if used
+ * improperly.
+ *
+ */
+
+ HRESULT SetThreadContext([in] DWORD threadID,
+ [in] ULONG32 contextSize,
+ [in, length_is(contextSize),
+ size_is(contextSize)] BYTE context[]);
+
+ /*
+ * ReadMemory reads memory from the process.
+ * This is primarily intended to be used by interop-debugging to inspect memory
+ * regions used by the unmanaged portion of the debuggee.
+ *
+ * This can also be used to read IL and native jitted code.
+ * Any managed breakpoints will be automatically stripped from the returned buffer.
+ * No adjustments will be made for Native breakpoints set by ICorDebugProcess2::SetUnmanagedBreakpoint
+ *
+ * No caching of process memory is peformed.
+ * These parameters have the same semantics as kernel32!ReadProcessMemory.
+ * The entire range must be read for the function to return success.
+ */
+
+ HRESULT ReadMemory([in] CORDB_ADDRESS address, [in] DWORD size,
+ [out, size_is(size), length_is(size)] BYTE buffer[],
+ [out] SIZE_T *read);
+
+ /*
+ * WriteMemory writes memory in the process.
+ * In v2.0, Native debuggers should *not* use this to inject breakpoints
+ * into the instruction stream. Use ICorDebugProcess2::SetUnamangedBreakpoint
+ * instead.
+ *
+ * This is a dangerous call which can corrupt the runtime if used
+ * improperly. It is highly recommended that this is only used outside
+ * of managed code.
+ *
+ * These parameters have the same semantics as kernel32!WriteProcessMemory.
+ */
+
+ HRESULT WriteMemory([in] CORDB_ADDRESS address, [in] DWORD size,
+ [in, size_is(size)] BYTE buffer[],
+ [out]SIZE_T *written);
+
+
+ /*
+ * ClearCurrentException clears the current unmanaged exception on
+ * the given thread. Call this before calling Continue when a
+ * thread has reported an unmanaged exception that should be
+ * ignored by the debuggee.
+ *
+ * This will clear both the outstanding IB and OOB events on the given thread.
+ * Out-of-band Breakpoint and single-step exceptions are automatically cleared.
+ *
+ * See ICorDebugThread2::InterceptCurrentException for continuing managed exceptions.
+ *
+ */
+
+ HRESULT ClearCurrentException([in] DWORD threadID);
+
+ /*
+ * EnableLogMessages enables/disables sending of log messages to the
+ * debugger for logging.
+ * This is only valid after the CreateProcess callback.
+ *
+ */
+
+ HRESULT EnableLogMessages([in]BOOL fOnOff);
+
+ /*
+ * ModifyLogSwitch modifies the specified switch's severity level.
+ * This is only valid after the CreateProcess callback.
+ *
+ */
+ HRESULT ModifyLogSwitch([in, annotation("_In_")] WCHAR *pLogSwitchName,
+ [in]LONG lLevel);
+
+ /*
+ * EnumerateAppDomains enumerates all app domains in the process.
+ * This can be used before the CreateProcess callback.
+ *
+ */
+
+ HRESULT EnumerateAppDomains([out] ICorDebugAppDomainEnum **ppAppDomains);
+
+ /*
+ * NOT YET IMPLEMENTED
+ */
+
+ HRESULT GetObject([out] ICorDebugValue **ppObject);
+
+ /*
+ * DEPRECATED
+ */
+
+ HRESULT ThreadForFiberCookie([in] DWORD fiberCookie,
+ [out] ICorDebugThread **ppThread);
+
+ /*
+ * Returns the OS thread id of the debugger's internal helper thread.
+ * During managed/unmanaged debugging, it is the debugger's
+ * responsibility to ensure that the thread with this ID remains running
+ * if it hits a breakpoint placed by the debugger. A debugger may also
+ * wish to hide this thread from the user.
+ *
+ * If there is no helper thread in the process yet, then this method
+ * will return zero as the thread id.
+ *
+ * Note: you cannot cache this value. The ID of the helper thread may
+ * change over time, so this value must be re-queried at every stopping
+ * event.
+ *
+ * Note: this value will be correct on every unmanaged CreateThread event.
+ * This will allow a debugger to determine the TID of the helper thread
+ * and hide it from the user. A thread identified as a helper thread during
+ * an unmanaged CreateThread event will never run managed user code.
+ */
+
+ HRESULT GetHelperThreadID([out] DWORD *pThreadID);
+};
+#pragma warning(pop)
+
+[
+ object,
+ local,
+ uuid(AD1B3588-0EF0-4744-A496-AA09A9F80371),
+ pointer_default(unique)
+]
+interface ICorDebugProcess2 : IUnknown
+{
+
+ /*
+ * Return a ICorDebugThread2 interface given a TASKID
+ * Host can set TASKID using ICLRTask::SetTaskIdentifier
+ */
+ HRESULT GetThreadForTaskID(
+ [in] TASKID taskid,
+ [out] ICorDebugThread2 **ppThread);
+
+
+ /*
+ * Returns the version of the runtime the debugee process is running.
+ */
+ HRESULT GetVersion([out] COR_VERSION* version);
+
+ /*
+ * Set an unmanaged breakpoint at the given native address. If the address is within
+ * the runtime, the breakpoint will be ignored.
+ * This allows the CLR to avoid dispatching out-of-band breakpoints for breakpoints
+ * set by the debugger.
+ * buffer[] returns the opcode at the address that is replaced by the breakpoint.
+ */
+
+ HRESULT SetUnmanagedBreakpoint([in] CORDB_ADDRESS address,
+ [in] ULONG32 bufsize,
+ [out, size_is(bufsize), length_is(*bufLen)] BYTE buffer[],
+ [out] ULONG32 * bufLen);
+
+ /*
+ * Remove a breakpoint set by SetUnmanagedBreakpoint.
+ */
+ HRESULT ClearUnmanagedBreakpoint([in] CORDB_ADDRESS address);
+
+
+ /*
+ * SetDesiredNGENCompilerFlags specifies the set of flags that must be set in a pre-JITted
+ * image in order for the runtime to load that image into this app domain. If no such image exists,
+ * the runtime will load the IL and JIT instead. The flags set by this function are just used to select the
+ * correct pre-JITted image; if no suitable image is found the debugger will still need to use
+ * ICorDebugModule2::SetJITCompilerFlags to set the flags as desired for JIT.
+ *
+ * This function must be called during the CreateProcess callback.
+ * Attempts to call it after this callback has been delivered will fail.
+ */
+ HRESULT SetDesiredNGENCompilerFlags( [in] DWORD pdwFlags );
+
+ /*
+ * GetDesiredNGENCompilerFlags gets the set of flags that must be set in a pre-JITted image in order
+ * for the runtime to load that image into this process.
+ */
+ HRESULT GetDesiredNGENCompilerFlags( [out] DWORD *pdwFlags );
+
+
+ /*
+ * Gets an ICorDebugReferenceValue object from a raw GC handle value.
+ *
+ * handle is the IntPtr within a GCHandle. Do not confuse
+ * this with a GC reference value. This is a potentially dangerous API and may
+ * corrupt both the debugger and debuggee if a bogus handle is passed in.
+ * This API does not necessarily validate that the handle is valid.
+ *
+ * The ICorDebugReferenceValue will behave much like a normal reference. It will
+ * be neutered on the next continue; the lifetime of the target object will
+ * not be affected by the existence of the ReferenceValue.
+ */
+ HRESULT GetReferenceValueFromGCHandle( [in] UINT_PTR handle,
+ [out] ICorDebugReferenceValue **pOutValue);
+
+};
+
+
+[
+ object,
+ local,
+ uuid(2EE06488-C0D4-42B1-B26D-F3795EF606FB),
+ pointer_default(unique)
+]
+
+interface ICorDebugProcess3 : IUnknown
+{
+ /* Enables (or disables) custom debugger notifications of a specified
+ * type (which implements ICustomDebuggerNotification).
+ * When this has been enabled, calls to
+ * System.Diagnostics.Debugger.CustomNotification with a data argument
+ * of the specified class will trigger a CustomNotification callback.
+ * Notifications are disabled by default and the debugger must opt-into
+ * any notification types it knows of and wishes to handle.
+ * Since ICorDebugClass is scoped by appdomains, the debugger needs to
+ * call this API for every appdomain in the process if it's interested in
+ * receiving the notification across the entire process.
+ */
+
+ HRESULT SetEnableCustomNotification(ICorDebugClass * pClass, BOOL fEnable);
+}
+
+[
+ object,
+ local,
+ uuid(21e9d9c0-fcb8-11df-8cff-0800200c9a66),
+ pointer_default(unique)
+]
+interface ICorDebugProcess5 : IUnknown
+{
+ HRESULT GetGCHeapInformation([out] COR_HEAPINFO *pHeapInfo);
+ HRESULT EnumerateHeap([out] ICorDebugHeapEnum **ppObjects);
+ HRESULT EnumerateHeapRegions([out] ICorDebugHeapSegmentEnum **ppRegions);
+ HRESULT GetObject([in] CORDB_ADDRESS addr, [out] ICorDebugObjectValue **pObject);
+ HRESULT EnumerateGCReferences([in] BOOL enumerateWeakReferences, [out] ICorDebugGCReferenceEnum **ppEnum);
+ HRESULT EnumerateHandles([in] CorGCReferenceType types, [out] ICorDebugGCReferenceEnum **ppEnum);
+
+ HRESULT GetTypeID([in] CORDB_ADDRESS obj, [out] COR_TYPEID *pId);
+ HRESULT GetTypeForTypeID([in] COR_TYPEID id, [out] ICorDebugType **ppType);
+
+ HRESULT GetArrayLayout([in] COR_TYPEID id, [out] COR_ARRAY_LAYOUT *pLayout);
+ HRESULT GetTypeLayout([in] COR_TYPEID id, [out] COR_TYPE_LAYOUT *pLayout);
+ HRESULT GetTypeFields([in] COR_TYPEID id, ULONG32 celt, COR_FIELD fields[], ULONG32 *pceltNeeded);
+
+ /*
+ * Enables the specified policy.
+ */
+ HRESULT EnableNGENPolicy([in] CorDebugNGENPolicy ePolicy);
+}
+
+
+// Describes formats of pRecord byte blob in DecodeEvent.
+// This is dependent on the target architecture.
+typedef enum CorDebugRecordFormat
+{
+ FORMAT_WINDOWS_EXCEPTIONRECORD32 = 1,
+ FORMAT_WINDOWS_EXCEPTIONRECORD64 = 2,
+} CorDebugRecordFormat;
+
+// dwFlags in DecodeEvent is dependent on the target architecture.
+// Definition of DecodeEvent flags on Windows.
+typedef enum CorDebugDecodeEventFlagsWindows
+{
+ IS_FIRST_CHANCE = 1,
+} CorDebugDecodeEventFlagsWindows;
+
+// Possible events which can be decoded in DecodeEvent
+typedef enum CorDebugDebugEventKind
+{
+ DEBUG_EVENT_KIND_MODULE_LOADED = 1,
+ DEBUG_EVENT_KIND_MODULE_UNLOADED = 2,
+ DEBUG_EVENT_KIND_MANAGED_EXCEPTION_FIRST_CHANCE = 3,
+ DEBUG_EVENT_KIND_MANAGED_EXCEPTION_USER_FIRST_CHANCE = 4,
+ DEBUG_EVENT_KIND_MANAGED_EXCEPTION_CATCH_HANDLER_FOUND = 5,
+ DEBUG_EVENT_KIND_MANAGED_EXCEPTION_UNHANDLED = 6
+} CorDebugDebugEventKind;
+
+// Describes what amount of cached data must be discarded based on changes to the
+// process
+typedef enum CorDebugStateChange
+{
+ PROCESS_RUNNING = 0x0000001, // The process reached a new memory state via
+ // forward execution.
+ FLUSH_ALL = 0x0000002, // The process' memory might be arbitrarily
+ // different than it was before.
+} CorDebugStateChange;
+
+// Base interface from which all ICorDebug debug events derive
+[
+ object,
+ local,
+ uuid(41BD395D-DE99-48F1-BF7A-CC0F44A6D281),
+ pointer_default(unique)
+]
+interface ICorDebugDebugEvent : IUnknown
+{
+ /*
+ * Quickly determines what kind of event this is. Based on the answer you
+ * you can QI to get a more precise debug event interface with additional data
+ * available.
+ */
+ HRESULT GetEventKind([out]CorDebugDebugEventKind *pDebugEventKind);
+
+ /*
+ * Gets the thread on which the event occurred
+ */
+ HRESULT GetThread([out]ICorDebugThread **ppThread);
+}
+
+typedef enum CorDebugCodeInvokeKind
+{
+ CODE_INVOKE_KIND_NONE, // if there is any managed code invoked by this method, it will have
+ // have to be located by explicit events/breakpoints later
+ // OR we may just miss some of the managed code this method calls
+ // because there is no easy way to stop on it
+ // OR the method may never invoke managed code
+ CODE_INVOKE_KIND_RETURN, // This method will invoke managed code via a return instruction,
+ // Stepping out should arrive at the next managed code
+ CODE_INVOKE_KIND_TAILCALL, // This method will invoke managed code via a tail-call. Single-stepping
+ // + stepping over any call instructions should arrive at managed code
+} CorDebugCodeInvokeKind;
+
+typedef enum CorDebugCodeInvokePurpose
+{
+ CODE_INVOKE_PURPOSE_NONE,
+ CODE_INVOKE_PURPOSE_NATIVE_TO_MANAGED_TRANSITION, // The managed code will run any managed entrypoint
+ // such as a reverse p-invoke. Any more detailed purpose
+ // is unknown by the runtime.
+ CODE_INVOKE_PURPOSE_CLASS_INIT, // The managed code will run a static constructor
+ CODE_INVOKE_PURPOSE_INTERFACE_DISPATCH, // The managed code will run the implementation for
+ // some interface method that was called
+} CorDebugCodeInvokePurpose;
+
+[
+ object,
+ local,
+ uuid(11588775-7205-4CEB-A41A-93753C3153E9),
+ pointer_default(unique)
+]
+interface ICorDebugProcess6 : IUnknown
+{
+ //Decodes managed debug events which have been encapsulated in the payload of
+ //specially crafted native exception debug events
+ HRESULT DecodeEvent(
+ [in, length_is(countBytes), size_is(countBytes)] const BYTE pRecord[],
+ [in] DWORD countBytes,
+ [in] CorDebugRecordFormat format,
+ [in] DWORD dwFlags,
+ [in] DWORD dwThreadId,
+ [out] ICorDebugDebugEvent **ppEvent);
+
+ // Debugger calls this to notify ICorDebug that the process is running.
+ //
+ // Notes:
+ // ProcessStateChanged(PROCESS_RUNNING) has similar semantics to
+ // ICorDebugProcess::Continue();
+ HRESULT ProcessStateChanged([in] CorDebugStateChange change);
+
+ // Get information about managed code at codeAddress
+ HRESULT GetCode([in] CORDB_ADDRESS codeAddress, [out] ICorDebugCode **ppCode);
+
+ // Virtual module splitting causes ICorDebug to recognize modules that were
+ // merged together during the build process and present them as a group of separate
+ // modules rather than a single large module. Doing this changes the behavior of
+ // various ICorDebug APIs described below.
+ //
+ // Terminology
+ // The aggregate modules are called containers, the modules inside are called
+ // sub-modules or virtual modules. Both container modules and sub-modules are
+ // represented with the ICorDebugModule interface, however the behavior of the
+ // interface is slightly different in each case, as described below.
+ // In addition there may still be modules loaded that weren't merged during build.
+ // These modules, called regular modules, are neither container modules nor
+ // sub-modules.
+ //
+ // Modules and assemblies
+ // Multi-module assemblies are not supported for assembly merging scenarios
+ // so module and assembly are exactly 1:1. Each ICorDebugModule, regardless of
+ // whether it represents a container module or a sub-module, has a corresponding
+ // ICorDebugAssembly. ICorDebugModule.GetAssembly() converts from the module to the
+ // assembly. To map the other direction, ICorDebugAssembly.EnumerateModules() will
+ // enumerate only 1 module. Because assembly and module form a tightly coupled pair
+ // in this case, the terms assembly and module become largely interchangeable.
+ //
+ // Differences in behavior for container modules vs. sub-modules
+ // Container modules:
+ // -have metadata for all of the constituent sub-modules merged together
+ // -type names may be mangled
+ // -ICorDebugModule.GetName() will return the path to an on-disk module
+ // -ICorDebugModule.GetSize() returns the size of that image.
+ // -ICorDebugAssembly3.EnumerateContainedAssemblies will list the sub-modules
+ // -ICorDebugAssembly3.GetContainerAssembly returns S_FALSE
+ // Sub-modules:
+ // -have a reduced set of metadata that corresponds only to the original
+ // assembly that was merged in.
+ // -The metadata names have no mangling.
+ // -Metadata tokens are unlikely to match with the tokens in the original
+ // assembly before it was merged in the build process
+ // -ICorDebugModule.GetName() returns the assembly name (not a file path)
+ // -ICorDebug.GetSize() returns the original unmerged image size.
+ // -ICorDebugModule3.EnumerateContainedAssemblies will return S_FALSE
+ // -ICorDebugAssembly3.GetContainerAssembly will return the containing module
+ //
+ // Interfaces retrieved from modules
+ // There are a variety of interfaces that can be created from modules, such as
+ // ICorDebugModule.GetClassFromToken() -> ICorDebugClass
+ // These objects are always cached by ICorDebug, and they will have the same pointer
+ // identity regardless of whether they were created/queried from the container module
+ // or a sub-module. The sub-module serves as a filtered view of these cached
+ // objects, not a separate cache with its own copies.
+ //
+ // Enabling Virtual Module Splitting has the following effects elsewhere in the API:
+ // ICorDebugFunction.GetModule
+ // Disabled - Returns the container module this function was merged into
+ // Enabled - Returns the sub-module this function was originally defined in
+ // ICorDebugClass.GetModule
+ // Disabled - Returns the container module this class was merged into
+ // Enabled - Returns the sub-module this class was originally defined in
+ // ICorDebugModuleDebugEvent.GetModule
+ // Enabled OR Disabled - Returns the container module that was loaded.
+ // Sub-modules are not given load events regardless of this
+ // setting.
+ // ICorDebugAppDomain.EnumerateAssemblies
+ // Disabled - Returns a list of container assemblies + regular assemblies
+ // (no sub-assemblies are shown)
+ // Enabled - Returns the list of sub-assemblies + regular assemblies
+ // (no container assemblies are shown).
+ // Note: If any container assembly is missing symbols, none of its
+ // sub-assemblies will be enumerated. If any regular assembly is
+ // missing symbols it may or may not be enumerated.
+ // ICorDebugCode.GetCode (when refering to IL code only)
+ // Disabled - Returns the IL in the post-merge assembly image.
+ // Enabled - Returns IL that would be valid in a pre-merge assembly image. Specifically
+ // any inline metadata tokens will correctly be TypeRef or MemberRef tokens
+ // when the types being refered to are not defined in the virtual module
+ // containing the IL. These TypeRefs/MemberRefs can be looked up in the
+ // IMetaDataImport for the corresponding virtual ICorDebugModule.
+ //
+ // This setting can be changed at any time. It does not incur any stateful functional
+ // changes in ICorDebug, beyond altering the behavior of the above APIs at the time they are
+ // called. Using virtual modules does incur a performance penalty for all the above
+ // APIs. Additionally the virtualized metadata may do significant in-memory caching required
+ // to correctly implement the IMetaDataImport APIs, and these caches may be retained
+ // even after virtual module splitting has been turned off.
+ HRESULT EnableVirtualModuleSplitting(BOOL enableSplitting);
+
+ // Changes internal state of the debuggee so that the System.Debugger.IsAttached API in the BCL
+ // returns true.
+ //
+ // Returns
+ // S_OK - debuggee is succesfully updated
+ // CORDBG_E_MODULE_NOT_LOADED - assembly containing System.Debugger.IsAttached API is not loaded
+ // or some other error is preventing it from being recognized such as missing metadata. This error
+ // is common and benign - it is recommended to try the call again when future assemblies load.
+ //
+ // other misc failing HRESULTs are possible, but likely indicate misbehaving debugger or compiler
+ // components
+ HRESULT MarkDebuggerAttached(BOOL fIsAttached);
+
+ // Provides information on runtime exported functions to help step to managed code
+ //
+ // Parameters
+ // pszExportName - The name of a runtime export function as written in the PE export table
+ // invokeKind - [out] A description of how the exported function will invoke managed code
+ // invokePurpose - [out] A description of why the exported function will call managed code
+ //
+ // Returns
+ // S_OK - on success
+ // E_POINTER - pInvokeKind or pInvokePurpose is NULL
+ // Other failing HRESULTs as appropriate
+ //
+ HRESULT GetExportStepInfo([in]LPCWSTR pszExportName, [out]CorDebugCodeInvokeKind* pInvokeKind, [out]CorDebugCodeInvokePurpose* pInvokePurpose);
+}
+
+typedef enum WriteableMetadataUpdateMode
+{
+ LegacyCompatPolicy,
+ AlwaysShowUpdates
+} WriteableMetadataUpdateMode;
+
+
+[
+ object,
+ local,
+ uuid(9B2C54E4-119F-4D6F-B402-527603266D69),
+ pointer_default(unique)
+]
+interface ICorDebugProcess7 : IUnknown
+{
+ // Configures how the debugger handles metadata that has been updated in-memory
+ // within the target process. These updates could come from EnC, a profiler,
+ // or Reflection.Emit
+ HRESULT SetWriteableMetadataUpdateMode(WriteableMetadataUpdateMode flags);
+}
+
+[
+ object,
+ local,
+ uuid(2E6F28C1-85EB-4141-80AD-0A90944B9639),
+ pointer_default(unique)
+]
+interface ICorDebugProcess8 : IUnknown
+{
+ /*
+ * EnableExceptionCallbacksOutsideOfMyCode enables/disables certain types of exception callback to ICorDebugManagedCallback2.
+ * If the flag is FALSE:
+ * 1) DEBUG_EXCEPTION_FIRST_CHANCE callbacks won't called in the debugger.
+ * 2) DEBUG_EXCEPTION_CATCH_HANDLER_FOUND callbacks won't be called if an exception never escapes into user code.
+ * (i.e. a path from an exception origin to an exception handler has no methods marked as JMC)
+ *
+ * Default value of this flag is TRUE.
+ */
+ HRESULT EnableExceptionCallbacksOutsideOfMyCode([in] BOOL enableExceptionsOutsideOfJMC);
+}
+
+// Event types MODULE_LOADED and MODULE_UNLOADED implement this interface
+[
+ object,
+ local,
+ uuid(51A15E8D-9FFF-4864-9B87-F4FBDEA747A2),
+ pointer_default(unique)
+]
+interface ICorDebugModuleDebugEvent : ICorDebugDebugEvent
+{
+ /*
+ * Gets the merged module that was just loaded or unloaded. Use
+ * ICorDebugDebugEvent.GetEventType() to determine whether it was load/unload.
+ */
+ HRESULT GetModule([out]ICorDebugModule **ppModule);
+}
+
+// This interface is implemented by events types:
+// MANAGED_EXCEPTION_FIRST_CHANCE,
+// MANAGED_EXCEPTION_USER_FIRST_CHANCE,
+// MANAGED_EXCEPTION_CATCH_HANDLER_FOUND,
+// MANAGED_EXCEPTION_UNHANDLED,
+[
+ object,
+ local,
+ uuid(AF79EC94-4752-419C-A626-5FB1CC1A5AB7),
+ pointer_default(unique)
+]
+interface ICorDebugExceptionDebugEvent : ICorDebugDebugEvent
+{
+ // The meaning of this stack pointer varies based on event type (available from
+ // ICorDebugDebugEvent.GetEventType())
+ //
+ // MANAGED_EXCEPTION_FIRST_CHANCE -> The stack pointer for the frame that threw the exception
+ // MANAGED_EXCEPTION_USER_FIRST_CHANCE -> The stack pointer for the user-code frame closest to the point of
+ // the thrown exception
+ // MANAGED_EXCEPTION_CATCH_HANDLER_FOUND -> The stack pointer for the frame that contains the catch handler
+ // MANAGED_EXCEPTION_UNHANDLED -> *pStackPointer will be NULL
+ HRESULT GetStackPointer([out]CORDB_ADDRESS *pStackPointer);
+
+ // The meaning of the IP varies based on event type (available from
+ // ICorDebugDebugEvent.GetEventType())
+ //
+ // MANAGED_EXCEPTION_FIRST_CHANCE -> The address of the faulting instruction
+ // MANAGED_EXCEPTION_USER_FIRST_CHANCE -> Within the frame indicated by GetStackPointer(),
+ // this is the code address where execution would resume if no exception had been
+ // raised. The exception may or may not cause different code to be executed in this
+ // frame such as a catch of finally clause.
+ // MANAGED_EXCEPTION_CATCH_HANDLER_FOUND -> Within the frame indicated by GetStackPointer(),
+ // this is the code address where catch handler execution will start
+ // MANAGED_EXCEPTION_UNHANDLED -> *pIP will be 0
+ HRESULT GetNativeIP([out]CORDB_ADDRESS *pIP);
+
+
+ // Gets a flag that indicates if the exception is interceptable.
+ HRESULT GetFlags([out]CorDebugExceptionFlags *pdwFlags);
+}
+
+/* ------------------------------------------------------------------------- *
+ * Breakpoint interface
+ * ------------------------------------------------------------------------- */
+
+/*
+ * ICorDebugBreakpoint represents a breakpoint; either a breakpoint
+ * set in a function, or a watchpoint set on a value.
+ *
+ * Note that breakpoints have no direct support for condition
+ * expressions. The debugger must implement this functionality on top of
+ * this interface if desired.
+ *
+ */
+
+[
+ object,
+ local,
+ uuid(CC7BCAE8-8A68-11d2-983C-0000F808342D),
+ pointer_default(unique)
+]
+interface ICorDebugBreakpoint : IUnknown
+{
+ /*
+ * Sets the active state of the breakpoint
+ */
+ HRESULT Activate([in] BOOL bActive);
+
+ /*
+ * Returns whether the breakpoint is active.
+ */
+ HRESULT IsActive([out] BOOL *pbActive);
+};
+
+[
+ object,
+ local,
+ uuid(CC7BCAE9-8A68-11d2-983C-0000F808342D),
+ pointer_default(unique)
+]
+interface ICorDebugFunctionBreakpoint : ICorDebugBreakpoint
+{
+ /*
+ * Returns the function on which this breakpoint is set
+ */
+ HRESULT GetFunction([out] ICorDebugFunction **ppFunction);
+
+ /*
+ * Returns the offset of this breakpoint within the function
+ */
+ HRESULT GetOffset([out] ULONG32 *pnOffset);
+};
+
+[
+ object,
+ local,
+ uuid(CC7BCAEA-8A68-11d2-983C-0000F808342D),
+ pointer_default(unique)
+]
+interface ICorDebugModuleBreakpoint : ICorDebugBreakpoint
+{
+ /*
+ * Returns the module on which this breakpoint is set.
+ */
+ HRESULT GetModule([out] ICorDebugModule **ppModule);
+};
+
+[
+ object,
+ local,
+ uuid(CC7BCAEB-8A68-11d2-983C-0000F808342D),
+ pointer_default(unique)
+]
+interface ICorDebugValueBreakpoint : ICorDebugBreakpoint
+{
+ /*
+ * Gets the value on which this breakpoint is set.
+ */
+ HRESULT GetValue([out] ICorDebugValue **ppValue);
+};
+
+/* ------------------------------------------------------------------------- *
+ * Stepper interface
+ * ------------------------------------------------------------------------- */
+
+/*
+ * A Stepper object represents a stepping operation being performed by
+ * the debugger. Note that there can be more than one stepper per
+ * thread; for instance a breakpoint may be hit in the midst of a
+ * stepping over a function, and the user may wish to start a new
+ * stepping operation inside that function. (Note that it is up to the
+ * debugger how to handle this; it may want to cancel the original
+ * stepping operation, or nest them. This API allows either behavior.)
+ *
+ * Also, a stepper may migrate between threads if a cross-thread
+ * marshalled call is made by the EE.
+ *
+ * This object serves several purposes. Its serves as an identifer between a
+ * step command issued and the completion of that command. It also
+ * provides a central interface to encapsulate all of the stepping
+ * that can be performed. Finally it provides a way to prematurely
+ * cancel a stepping operation.
+ *
+ */
+
+[
+ object,
+ local,
+ uuid(CC7BCAEC-8A68-11d2-983C-0000F808342D),
+ pointer_default(unique)
+]
+interface ICorDebugStepper : IUnknown
+{
+ /*
+ * IsActive returns whether or not the stepper is active, that is, whether
+ * it is currently stepping.
+ *
+ * Any step action remains active until StepComplete is called. Note that
+ * this automatically deactivates the stepper.
+ *
+ * A stepper may also be deactivated prematurely by calling
+ * Deactivate before a callback condition is reached.
+ */
+
+ HRESULT IsActive([out] BOOL *pbActive);
+
+ /*
+ * Deactivate causes a stepper to cancel the last stepping command it
+ * received. A new stepping command may then be issued.
+ */
+
+ HRESULT Deactivate();
+
+ /*
+ * SetInterceptMask controls which intercept code will be stepped
+ * into by the stepper. If the bit for an interceptor is set, the
+ * stepper will complete with reason STEPPER_INTERCEPT when the
+ * given type of intercept occurs. If the bit is cleared, the
+ * intercepting code will be skipped.
+ *
+ * Note that SetInterceptMask may have unforeseen interactions
+ * with SetUnmappedStopMask (from the user's point of view). For
+ * example, if the only visible (ie, non internal) portion of class
+ * init code lacks mapping info (STOP_NO_MAPPING_INFO) and
+ * STOP_NO_MAPPING_INFO isn't set, then we'll step over the class init.
+ *
+ * By default, only INTERCEPT_NONE will be used.
+ */
+
+ typedef enum CorDebugIntercept
+ {
+ INTERCEPT_NONE = 0x0 ,
+ INTERCEPT_CLASS_INIT = 0x01,
+ INTERCEPT_EXCEPTION_FILTER = 0x02,
+ INTERCEPT_SECURITY = 0x04,
+ INTERCEPT_CONTEXT_POLICY = 0x08,
+ INTERCEPT_INTERCEPTION = 0x10,
+ INTERCEPT_ALL = 0xffff
+ } CorDebugIntercept;
+
+ HRESULT SetInterceptMask([in] CorDebugIntercept mask);
+
+ /*
+ * SetUnmappedStopMask controls whether the stepper
+ * will stop in jitted code which is not mapped to IL.
+ *
+ * If the given flag is set, then that type of unmapped code
+ * will be stopped in. Otherwise stepping transparently continues.
+ *
+ * It should be noted that if one doesn't use a stepper to enter a
+ * method (for example, the main() method of C++), then one
+ * won't neccessarily step over prologs,etc.
+ *
+ * By default, STOP_OTHER_UNMAPPED will be used.
+ *
+ * STOP_UNMANAGED is only valid w/ interop debugging.
+ */
+
+ typedef enum CorDebugUnmappedStop
+ {
+ STOP_NONE = 0x0,
+ STOP_PROLOG = 0x01,
+ STOP_EPILOG = 0x02,
+ STOP_NO_MAPPING_INFO = 0x04,
+ STOP_OTHER_UNMAPPED = 0x08,
+ STOP_UNMANAGED = 0x10,
+
+ STOP_ALL = 0xffff,
+
+ } CorDebugUnmappedStop;
+
+ HRESULT SetUnmappedStopMask([in] CorDebugUnmappedStop mask);
+
+ /*
+ * Step is called when a thread is to be single stepped. The step
+ * will complete at the next managed instruction executed by the
+ * EE in the stepper's frame.
+ *
+ * If bStepIn is TRUE, any function calls made during the step
+ * will be stepped into. Otherwise they will be skipped.
+ *
+ * If Step is called on a stepper which is not in managed code,
+ * the step will complete when the next managed code is executed
+ * by the thread. (if bStepIn is FALSE, it will only complete
+ * when managed code is returned to, not when it is stepped into.)
+ */
+
+ HRESULT Step([in] BOOL bStepIn);
+
+ /*
+ * StepRange works just like Step, except it will not complete
+ * until code outside the given range is reached. This can be
+ * more efficient than stepping one instruction at a time.
+ *
+ * Ranges are specified as a list of offset pairs [start, end)
+ * (note that end is exclusive) from the start of the stepper's
+ * frame's code.
+ *
+ * Ranges are in relative to the IL code of a method. Call
+ * SetRangeIL(FALSE) to specify ranges relative to the native code
+ * of a method.
+ */
+
+ typedef struct COR_DEBUG_STEP_RANGE
+ {
+ ULONG32 startOffset, endOffset;
+ } COR_DEBUG_STEP_RANGE;
+
+ HRESULT StepRange([in] BOOL bStepIn,
+ [in,size_is(cRangeCount)] COR_DEBUG_STEP_RANGE ranges[],
+ [in] ULONG32 cRangeCount);
+
+ /*
+ * A StepOut operation will complete after the current frame is
+ * returned from normally and the previous frame is reactivated.
+ *
+ * If this is called when in unmanaged code, the step will complete
+ * when the calling managed code is returned to.
+ *
+ * In v2.0, we explicitly forbid StepOut with the STOP_UNMANAGED mask
+ * and will fail that. Interop debuggers must do step-out-to-native
+ * themselves.
+ */
+
+ HRESULT StepOut();
+
+ /*
+ * SetRangeIL is used to set whether the ranges passed StepRange are
+ * relative to the IL code or the native code for the method being
+ * stepped in.
+ *
+ * By default the range is in IL.
+ */
+
+ HRESULT SetRangeIL([in] BOOL bIL);
+};
+
+/*
+ * ICorDebugStepper2 exposes JMC functionality.
+ */
+[
+ object,
+ local,
+ uuid(C5B6E9C3-E7D1-4a8e-873B-7F047F0706F7),
+ pointer_default(unique)
+]
+interface ICorDebugStepper2 : IUnknown
+{
+ HRESULT SetJMC([in] BOOL fIsJMCStepper);
+}
+
+/* ------------------------------------------------------------------------- *
+ * Program state object interfaces
+ * ------------------------------------------------------------------------- */
+
+/*
+ * ICorDebugRegisterSet
+ */
+
+[
+ object,
+ local,
+ uuid(CC7BCB0B-8A68-11d2-983C-0000F808342D),
+ pointer_default(unique)
+]
+interface ICorDebugRegisterSet : IUnknown
+{
+ typedef enum CorDebugRegister
+ {
+ // registers (potentially) available on all architectures
+ // Note that these overlap with the architecture-specific
+ // registers
+ //
+ // NOTE: On IA64, REGISTER_FRAME_POINTER represents the BSP register.
+
+ REGISTER_INSTRUCTION_POINTER = 0,
+ REGISTER_STACK_POINTER,
+ REGISTER_FRAME_POINTER,
+
+
+ // X86 registers
+
+ REGISTER_X86_EIP = 0,
+ REGISTER_X86_ESP,
+ REGISTER_X86_EBP,
+
+ REGISTER_X86_EAX,
+ REGISTER_X86_ECX,
+ REGISTER_X86_EDX,
+ REGISTER_X86_EBX,
+
+ REGISTER_X86_ESI,
+ REGISTER_X86_EDI,
+
+ REGISTER_X86_FPSTACK_0,
+ REGISTER_X86_FPSTACK_1,
+ REGISTER_X86_FPSTACK_2,
+ REGISTER_X86_FPSTACK_3,
+ REGISTER_X86_FPSTACK_4,
+ REGISTER_X86_FPSTACK_5,
+ REGISTER_X86_FPSTACK_6,
+ REGISTER_X86_FPSTACK_7,
+
+
+ // AMD64 registers
+
+ REGISTER_AMD64_RIP = 0,
+ REGISTER_AMD64_RSP,
+ REGISTER_AMD64_RBP,
+
+ REGISTER_AMD64_RAX,
+ REGISTER_AMD64_RCX,
+ REGISTER_AMD64_RDX,
+ REGISTER_AMD64_RBX,
+
+ REGISTER_AMD64_RSI,
+ REGISTER_AMD64_RDI,
+
+ REGISTER_AMD64_R8,
+ REGISTER_AMD64_R9,
+ REGISTER_AMD64_R10,
+ REGISTER_AMD64_R11,
+ REGISTER_AMD64_R12,
+ REGISTER_AMD64_R13,
+ REGISTER_AMD64_R14,
+ REGISTER_AMD64_R15,
+
+ // Xmm FP
+
+ REGISTER_AMD64_XMM0,
+ REGISTER_AMD64_XMM1,
+ REGISTER_AMD64_XMM2,
+ REGISTER_AMD64_XMM3,
+ REGISTER_AMD64_XMM4,
+ REGISTER_AMD64_XMM5,
+ REGISTER_AMD64_XMM6,
+ REGISTER_AMD64_XMM7,
+ REGISTER_AMD64_XMM8,
+ REGISTER_AMD64_XMM9,
+ REGISTER_AMD64_XMM10,
+ REGISTER_AMD64_XMM11,
+ REGISTER_AMD64_XMM12,
+ REGISTER_AMD64_XMM13,
+ REGISTER_AMD64_XMM14,
+ REGISTER_AMD64_XMM15,
+
+
+ // IA64 registers
+
+ REGISTER_IA64_BSP = REGISTER_FRAME_POINTER,
+
+ // To get a particular general register, add the register number
+ // to REGISTER_IA64_R0. The same also goes for floating point
+ // registers.
+ //
+ // For example, if you need REGISTER_IA64_R83,
+ // use REGISTER_IA64_R0 + 83.
+ REGISTER_IA64_R0 = REGISTER_IA64_BSP + 1,
+ REGISTER_IA64_F0 = REGISTER_IA64_R0 + 128,
+
+
+ // ARM registers (@ARMTODO: FP?)
+
+ REGISTER_ARM_PC = 0,
+ REGISTER_ARM_SP,
+ REGISTER_ARM_R0,
+ REGISTER_ARM_R1,
+ REGISTER_ARM_R2,
+ REGISTER_ARM_R3,
+ REGISTER_ARM_R4,
+ REGISTER_ARM_R5,
+ REGISTER_ARM_R6,
+ REGISTER_ARM_R7,
+ REGISTER_ARM_R8,
+ REGISTER_ARM_R9,
+ REGISTER_ARM_R10,
+ REGISTER_ARM_R11,
+ REGISTER_ARM_R12,
+ REGISTER_ARM_LR,
+
+ // ARM64 registers
+
+ REGISTER_ARM64_PC = 0,
+ REGISTER_ARM64_SP,
+ REGISTER_ARM64_FP,
+ REGISTER_ARM64_X0,
+ REGISTER_ARM64_X1,
+ REGISTER_ARM64_X2,
+ REGISTER_ARM64_X3,
+ REGISTER_ARM64_X4,
+ REGISTER_ARM64_X5,
+ REGISTER_ARM64_X6,
+ REGISTER_ARM64_X7,
+ REGISTER_ARM64_X8,
+ REGISTER_ARM64_X9,
+ REGISTER_ARM64_X10,
+ REGISTER_ARM64_X11,
+ REGISTER_ARM64_X12,
+ REGISTER_ARM64_X13,
+ REGISTER_ARM64_X14,
+ REGISTER_ARM64_X15,
+ REGISTER_ARM64_X16,
+ REGISTER_ARM64_X17,
+ REGISTER_ARM64_X18,
+ REGISTER_ARM64_X19,
+ REGISTER_ARM64_X20,
+ REGISTER_ARM64_X21,
+ REGISTER_ARM64_X22,
+ REGISTER_ARM64_X23,
+ REGISTER_ARM64_X24,
+ REGISTER_ARM64_X25,
+ REGISTER_ARM64_X26,
+ REGISTER_ARM64_X27,
+ REGISTER_ARM64_X28,
+ REGISTER_ARM64_LR,
+
+ REGISTER_ARM64_V0,
+ REGISTER_ARM64_V1,
+ REGISTER_ARM64_V2,
+ REGISTER_ARM64_V3,
+ REGISTER_ARM64_V4,
+ REGISTER_ARM64_V5,
+ REGISTER_ARM64_V6,
+ REGISTER_ARM64_V7,
+ REGISTER_ARM64_V8,
+ REGISTER_ARM64_V9,
+ REGISTER_ARM64_V10,
+ REGISTER_ARM64_V11,
+ REGISTER_ARM64_V12,
+ REGISTER_ARM64_V13,
+ REGISTER_ARM64_V14,
+ REGISTER_ARM64_V15,
+ REGISTER_ARM64_V16,
+ REGISTER_ARM64_V17,
+ REGISTER_ARM64_V18,
+ REGISTER_ARM64_V19,
+ REGISTER_ARM64_V20,
+ REGISTER_ARM64_V21,
+ REGISTER_ARM64_V22,
+ REGISTER_ARM64_V23,
+ REGISTER_ARM64_V24,
+ REGISTER_ARM64_V25,
+ REGISTER_ARM64_V26,
+ REGISTER_ARM64_V27,
+ REGISTER_ARM64_V28,
+ REGISTER_ARM64_V29,
+ REGISTER_ARM64_V30,
+ REGISTER_ARM64_V31,
+
+ // other architectures here
+
+ } CorDebugRegister;
+
+ /*
+ * GetRegistersAvailable returns a mask indicating which registers
+ * are available in the given register set. Registers may be unavailable
+ * if their value is undeterminable for the given situation. The returned
+ * word contains a bit for each register (1 << register index), which will
+ * be 1 if the register is available or 0 if it is not.
+ */
+
+ HRESULT GetRegistersAvailable([out] ULONG64 *pAvailable);
+
+ /*
+ * GetRegisters returns an array of register values corresponding
+ * to the given mask. The registers which have their bit set in
+ * the mask will be packed into the resulting array. (No room is
+ * assigned in the array for registers whose mask bit is not set.)
+ * Thus, the size of the array should be equal to the number of
+ * 1's in the mask.
+ *
+ * If an unavailable register is indicated by the mask, an indeterminate
+ * value will be returned for the corresponding register.
+ *
+ * registerBufferCount should indicate number of elements in the
+ * buffer to receive the register values. If it is too small for
+ * the number of registers indicated by the mask, the higher
+ * numbered registers will be truncated from the set. Or, if it
+ * is too large, the unused registerBuffer elements will be
+ * unmodified. */
+
+ HRESULT GetRegisters([in] ULONG64 mask, [in] ULONG32 regCount,
+ [out, size_is(regCount), length_is(regCount)]
+ CORDB_REGISTER regBuffer[]);
+
+ /*
+ * NOT YET IMPLEMENTED
+ */
+
+ HRESULT SetRegisters([in] ULONG64 mask,
+ [in] ULONG32 regCount,
+ [in, size_is(regCount)] CORDB_REGISTER regBuffer[]);
+
+ /*
+ * GetThreadContext returns the context for the given thread. The
+ * debugger should call this function rather than the Win32
+ * GetThreadContext, because the thread may actually be in a "hijacked"
+ * state where its context has been temporarily changed.
+ *
+ * The data returned is a CONTEXT structure for the current platform.
+ *
+ * For non-leaf frames, clients should check which registers are valid by
+ * using GetRegistersAvailable.
+ *
+ */
+
+ HRESULT GetThreadContext([in] ULONG32 contextSize,
+ [in, out, length_is(contextSize),
+ size_is(contextSize)] BYTE context[]);
+
+ /*
+ * Not implemented in v2.0. It is too dangerous to manipulate the context of
+ * threads in Managed code. Use other high level operations (like SetIp,
+ * ICorDebugValue::SetValue) instead.
+ *
+ */
+
+ HRESULT SetThreadContext([in] ULONG32 contextSize,
+ [in, length_is(contextSize),
+ size_is(contextSize)] BYTE context[]);
+}
+
+/*
+ * ICorDebugRegisterSet2 is an extension for hardward platforms with more
+ * than 64 registers, since ICorDebugRegisterSet::GetRegisters() only
+ * recognizes a 64-bit mask.
+ */
+
+[
+ object,
+ local,
+ uuid(6DC7BA3F-89BA-4459-9EC1-9D60937B468D),
+ pointer_default(unique)
+]
+interface ICorDebugRegisterSet2 : IUnknown
+{
+ /*
+ * Given a CorDebugRegister value, its position in the mask is determined as
+ * follows:
+ *
+ * 1) (value >> 3) is used to index the array of BYTEs, and
+ * 2) (value & 7) (the least significant three bits) represents the bit position
+ * within the indexed BYTE, where bit 0 is the least significant bit.
+ *
+ * Or, in code:
+ *
+ * #define REGISTER_IA64_MAX REGISTER_IA64_F0 + 128
+ * #define MAX_MASK_COUNT ((REGISTER_IA64_MAX + 7) >> 3)
+ * #define SET_BIT_MASK(_mask, _reg) _mask[(_reg) >> 3] |= (1 << ((_reg) & 7))
+ * #define RESET_BIT_MASK(_mask, _reg) _mask[(_reg) >> 3] &= ~(1 << ((_reg) & 7))
+ * #define IS_SET_BIT_MASK(_mask, _reg) _mask[(_reg) >> 3] & (1 << ((_reg) & 7))
+ *
+ * CorDebugRegister value = <some value>;
+ * BYTE pAvailable[MAX_MASK_COUNT];
+ *
+ * GetRegistersAvailable(MAX_MASK_COUNT, pAvailable);
+ * ASSERT(value < REGISTER_IA64_MAX);
+ * IS_SET_BIT_MASK(pAvailable, value);
+ */
+
+ HRESULT GetRegistersAvailable([in] ULONG32 numChunks,
+ [out, size_is(numChunks)] BYTE availableRegChunks[]);
+
+ HRESULT GetRegisters([in] ULONG32 maskCount,
+ [in, size_is(maskCount)] BYTE mask[],
+ [in] ULONG32 regCount,
+ [out, size_is(regCount)] CORDB_REGISTER regBuffer[]);
+
+ HRESULT SetRegisters([in] ULONG32 maskCount,
+ [in, size_is(maskCount)] BYTE mask[],
+ [in] ULONG32 regCount,
+ [in, size_is(regCount)] CORDB_REGISTER regBuffer[]);
+}
+
+/*
+ * ICorDebugThread represents a thread in the process. The lifetime of a
+ * thread object is equal to the lifetime of the thread it represents.
+ */
+
+[
+ object,
+ local,
+ uuid(938c6d66-7fb6-4f69-b389-425b8987329b),
+ pointer_default(unique)
+]
+interface ICorDebugThread : IUnknown
+{
+ /*
+ * GetProcess returns the process of which this thread is a part.
+ */
+
+ HRESULT GetProcess([out] ICorDebugProcess **ppProcess);
+
+ /*
+ * GetID returns the current OS ID of the active part of the thread.
+ * Note that this may theoretically change as the process executes,
+ * and even be different for different parts of the thread.
+ */
+
+ HRESULT GetID([out] DWORD *pdwThreadId);
+
+ /*
+ * GetHandle returns the current Handle of the active part of the thread.
+ * Note that this may theoretically change as the process executes,
+ * and even be different for different parts of the thread.
+ *
+ * This handle is owned by the debugging API. The debugger should duplicate
+ * it before using it.
+ */
+
+ HRESULT GetHandle([out] HTHREAD *phThreadHandle);
+
+ /*
+ * GetAppDomain returns the app domain which the thread is currently
+ * executing in.
+ */
+
+ HRESULT GetAppDomain([out] ICorDebugAppDomain **ppAppDomain);
+
+ /*
+ * SetDebugState sets the current debug state of the thread.
+ * (The "current debug state"
+ * represents the debug state if the process were to be continued,
+ * not the actual current state.)
+ *
+ * The normal value for this is THREAD_RUNNING. Only the debugger
+ * can affect the debug state of a thread. Debug states do
+ * last across continues, so if you want to keep a thread
+ * THREAD_SUSPENDed over mulitple continues, you can set it once
+ * and thereafter not have to worry about it.
+ *
+ * Suspending threads and resuming the process can cause deadlocks, though it's
+ * usually unlikely. This is an intrinisc quality of threads and processes and is by-design.
+ * A debugger can async break and resume the threads to break the deadlock.
+ *
+ * If the thread's user state includes USER_UNSAFE_POINT, then the thread may block a GC.
+ * This means the suspended thread has a mcuh higher chance of causing a deadlock.
+ *
+ * This may not affect debug events already queued. Thus a debugger should drain the entire
+ * event queue (via calling HasQueuedCallbacks) before suspending or resuming threads. Else it
+ * may get events on a thread that it believes it has already suspended.
+ *
+ */
+
+ HRESULT SetDebugState([in] CorDebugThreadState state);
+
+ /*
+ * GetDebugState returns the current debug state of the thread.
+ * (If the process is currently stopped, the "current debug state"
+ * represents the debug state if the process were to be continued,
+ * not the actual current state.)
+ */
+
+ HRESULT GetDebugState([out] CorDebugThreadState *pState);
+
+ /*
+ * GetUserState returns the user state of the thread, that is, the state
+ * which it has when the program being debugged examines it.
+ * A thread may have multiple state bits set.
+ */
+
+ typedef enum CorDebugUserState
+ {
+ USER_STOP_REQUESTED = 0x01,
+ USER_SUSPEND_REQUESTED = 0x02,
+ USER_BACKGROUND = 0x04,
+ USER_UNSTARTED = 0x08,
+ USER_STOPPED = 0x10,
+ USER_WAIT_SLEEP_JOIN = 0x20,
+ USER_SUSPENDED = 0x40,
+
+ // An "unsafe point" is a place where the thread may block a Garbage Collection (GC).
+ // Debug events may be dispatched from unsafe points, but suspending a thread at
+ // an unsafe spot will very likely cause a deadlock (until the thread is resumed).
+ // This is a function of the thread's IP and the available GC info. The exact details
+ // of what is safe and unsafe is unspecified and highly determined by jit/gc implementation details.
+ USER_UNSAFE_POINT = 0x80,
+
+ // indicates that this thread is a threadpool thread
+ USER_THREADPOOL = 0x100,
+ } CorDebugUserState;
+
+ HRESULT GetUserState([out] CorDebugUserState *pState);
+
+ /*
+ * GetCurrentException returns the exception object which is
+ * currently being thrown by the thread. This will exist from the time the exception
+ * is thrown until the end of the catch block. That range will include filters
+ * and finallys.
+ *
+ * FuncEval will clear out the exception object on setup and restore it on completion.
+ *
+ * Exceptions can be nested (eg, if an exception is thrown in filter or a func-eval),
+ * so there may be multiple outstanding exceptions on a single thread.
+ * This returns the most current exception.
+ *
+ * The exception object and type may change throughout the life of the exception. For example, an
+ * exception of type X may be thrown, but then the CLR may run out of memory and promote
+ * that to an OutOfMemory exception.
+ */
+
+ HRESULT GetCurrentException([out] ICorDebugValue **ppExceptionObject);
+
+ /*
+ * This is not implemented.
+ */
+
+ HRESULT ClearCurrentException();
+
+ /*
+ * CreateStepper creates a stepper object which operates relative
+ * to the active frame in the given thread. (Note that this may be
+ * unmanaged code.) The Stepper API must then be used to perform
+ * actual stepping.
+ *
+ */
+
+ HRESULT CreateStepper([out] ICorDebugStepper **ppStepper);
+
+ /*
+ * EnumerateChains returns an enum which will return all the stack
+ * chains in the thread, starting at the active (most recent) one.
+ * These chains represent the physical call stack for the thread.
+ *
+ * Chain boundaries occur for several reasons:
+ * managed <-> unmanaged transitions
+ * context switches
+ * debugger hijacking of user threads
+ *
+ * Note that in the simple case for a thread running purely
+ * managed code in a single context there will be a one to one
+ * correspondence between threads & chains.
+ *
+ * A debugger may want to rearrange the physical call
+ * stacks of all threads into logical call stacks. This would involve
+ * sorting all the threads' chains by their caller/callee
+ * relationships & regrouping them.
+ *
+ */
+
+ HRESULT EnumerateChains([out] ICorDebugChainEnum **ppChains);
+
+ /*
+ * GetActiveChain is a convenience routine to return the
+ * active (most recent) chain on the thread, if any.
+ *
+ */
+
+ HRESULT GetActiveChain([out] ICorDebugChain **ppChain);
+
+ /*
+ * GetActiveFrame is a convenience routine to return the
+ * active (most recent) frame on the thread, if any.
+ * If there are no frames on the stack, ppFrame will point to NULL
+ * and the function still returns S_OK.
+ */
+
+ HRESULT GetActiveFrame([out] ICorDebugFrame **ppFrame);
+
+ /*
+ * GetRegisterSet returns the register set for the active part
+ * of the thread.
+ *
+ */
+
+ HRESULT GetRegisterSet([out] ICorDebugRegisterSet **ppRegisters);
+
+ /*
+ * CreateEval creates an evaluation object which operates on the
+ * given thread. The Eval will push a new chain on the thread before
+ * doing its computation.
+ *
+ * Note that this interrupts the computation currently
+ * being performed on the thread until the eval completes.
+ *
+ */
+
+ HRESULT CreateEval([out] ICorDebugEval **ppEval);
+
+ /*
+ * Returns the runtime thread object.
+ */
+
+ HRESULT GetObject([out] ICorDebugValue **ppObject);
+
+};
+
+/*
+ * ICorDebugThread2 is a logical extension to ICorDebugThread.
+ */
+[
+ object,
+ local,
+ uuid(2BD956D9-7B07-4bef-8A98-12AA862417C5),
+ pointer_default(unique)
+]
+interface ICorDebugThread2 : IUnknown
+{
+
+ typedef struct _COR_ACTIVE_FUNCTION
+ {
+ ICorDebugAppDomain *pAppDomain; // Pointer to the owning AppDomain of the below IL Offset.
+ ICorDebugModule *pModule; // Pointer to the owning Module of the below IL Offset.
+ ICorDebugFunction2 *pFunction; // Pointer to the owning Function of the below IL Offset.
+ ULONG32 ilOffset; // IL Offset of the frame.
+ ULONG32 flags; // Bit mask of flags, currently unused. Reserved.
+ } COR_ACTIVE_FUNCTION;
+
+ /*
+ * Retrieves the active functions for the given threads' frames. This
+ * includes AppDomain ID, Module ID, Funtion ID and IL offset for
+ * each active statement on the stack. A flags field is also included
+ * for future information about the frame that might need to be conveyed.
+ *
+ * If pFunctions is NULL, returns only the number of functions that
+ * is on the stack in pcFunctions.
+ */
+
+ HRESULT GetActiveFunctions([in] ULONG32 cFunctions,
+ [out] ULONG32 *pcFunctions,
+ [in, out, size_is(cFunctions), length_is(*pcFunctions)]
+ COR_ACTIVE_FUNCTION pFunctions[]
+ );
+ /*
+ * Returns 0 if not part of a connection
+ * Maps to a SPID in SQL Server
+ */
+ HRESULT GetConnectionID(
+ [out] CONNID *pdwConnectionId);
+
+ /*
+ * Return the TASKID of this thread.
+ */
+ HRESULT GetTaskID(
+ [out] TASKID *pTaskId);
+
+ /*
+ * Return the OS Thread ID
+ */
+ HRESULT GetVolatileOSThreadID(
+ [out] DWORD *pdwTid);
+
+ /*
+ * Allow the debugger to intercept the current exception on a thread. It can be
+ * called between an Exception callback and the associated call to ICorDebugProcess::Continue.
+ *
+ * pFrame specifies where we should intercept the exception. It must be a valid ICDFrame pointer,
+ * which can be obtained from a stackwalk. However, you must not call Continue() between
+ * doing the stackwalk and calling this function.
+ */
+ HRESULT InterceptCurrentException(
+ [in] ICorDebugFrame *pFrame);
+}
+
+
+
+/*
+ * ICorDebugThread3 is a logical extension to ICorDebugThread.
+ */
+[
+ object,
+ local,
+ uuid(F8544EC3-5E4E-46c7-8D3E-A52B8405B1F5),
+ pointer_default(unique)
+]
+interface ICorDebugThread3 : IUnknown
+{
+ HRESULT CreateStackWalk([out] ICorDebugStackWalk **ppStackWalk);
+
+ HRESULT GetActiveInternalFrames([in] ULONG32 cInternalFrames,
+ [out] ULONG32 *pcInternalFrames,
+ [in, out, size_is(cInternalFrames), length_is(*pcInternalFrames)]
+ ICorDebugInternalFrame2 * ppInternalFrames[]
+ );
+};
+
+/*
+ * ICorDebugThread4 is a logical extension to ICorDebugThread.
+ */
+[
+ object,
+ local,
+ uuid(1A1F204B-1C66-4637-823F-3EE6C744A69C),
+ pointer_default(unique)
+]
+interface ICorDebugThread4 : IUnknown
+{
+ /*
+ * Returns S_OK if ICorDebugThread::GetCurrentException() is non-NULL and the exception
+ * it refers to has completed the first pass of exception handling without locating
+ * a catch clause.
+ * Returns S_FALSE if there is no exception, it hasn't completed first pass handling,
+ * or a catch handler was located
+ * Returns an appropriate error HRESULT when the answer can not be determined
+ */
+ HRESULT HasUnhandledException();
+
+ HRESULT GetBlockingObjects([out] ICorDebugBlockingObjectEnum **ppBlockingObjectEnum);
+ /*
+ * Gets the current CustomNotification object on the current thread. This could be NULL if no
+ * current notification object exists. If we aren't currently inside a CustomNotification callback,
+ * this will always return NULL.
+ * A debugger can examine this object to determine how to handle the notification.
+ * See ICorDebugManagedCallback3::CustomNotification for more information about
+ * custom notifications.
+ */
+ HRESULT GetCurrentCustomDebuggerNotification([out] ICorDebugValue ** ppNotificationObject);
+};
+
+/*
+ * The new V3.0 stackwalking API.
+ */
+[
+ object,
+ local,
+ uuid(A0647DE9-55DE-4816-929C-385271C64CF7),
+ pointer_default(unique)
+]
+interface ICorDebugStackWalk : IUnknown
+{
+ typedef enum CorDebugSetContextFlag
+ {
+ SET_CONTEXT_FLAG_ACTIVE_FRAME = 0x1,
+ SET_CONTEXT_FLAG_UNWIND_FRAME = 0x2,
+ } CorDebugSetContextFlag;
+
+ /*
+ * Get the current context of this stack frame.
+ *
+ * The CONTEXT is retrieved from the ICorDebugStackWalk. As unwinding may only restore a subset of the
+ * registers, such as only non-volatile registers, the context may not exactly match the register state at
+ * the time of the actual call.
+ */
+ HRESULT GetContext([in] ULONG32 contextFlags,
+ [in] ULONG32 contextBufSize,
+ [out] ULONG32* contextSize,
+ [out, size_is(contextBufSize)] BYTE contextBuf[]);
+
+ /*
+ * Change the current context of this stack walk, allowing the
+ * debugger to move it to an arbitrary context. Does not actually
+ * alter the current context of the thread whose stack is being walked.
+ *
+ * The CONTEXT has to be a valid CONTEXT of a stack frame on the thread.
+ * If the CONTEXT is outside of the current thread's stack range, we'll
+ * return a failure HRESULT. Otherwise, in the case of an invalid CONTEXT,
+ * the result is undefined.
+ */
+ HRESULT SetContext([in] CorDebugSetContextFlag flag,
+ [in] ULONG32 contextSize,
+ [in, size_is(contextSize)] BYTE context[]);
+
+ /*
+ * Attempt to advance the stackwalk to the next frame.
+ * If the current frame type is a native stack frame, Next() will not advance to the caller frame.
+ * Instead, Next() will advance to the next managed stack frame or the next internal frame marker.
+ *
+ * If a debugger wants to unwind unmanaged stack frames, it needs to start from the
+ * native stack frame itself. It can seed the unwind by calling GetContext().
+ *
+ * This function will return CORDBG_S_AT_END_OF_STACK when there are no more frames.
+ */
+ HRESULT Next();
+
+ /*
+ * Return the current frame. If the stackwalker is stopped at a native stack frame, we will return S_FALSE
+ * and set pFrame to NULL.
+ */
+ HRESULT GetFrame([out] ICorDebugFrame ** pFrame);
+};
+
+
+/*
+ * ICorDebugChain represents a segment of a physical or logical call
+ * stack. All frames in a chain occupy contiguous stack space, and
+ * they share the same thread & context. A chain may represent either
+ * managed or unmanaged code. Chains may be empty. Unmanaged chains are
+ * always empty.
+ */
+
+[
+ object,
+ local,
+ uuid(CC7BCAEE-8A68-11d2-983C-0000F808342D),
+ pointer_default(unique)
+]
+interface ICorDebugChain : IUnknown
+{
+ /*
+ * GetThread returns the physical thread which this call chain is
+ * part of.
+ */
+
+ HRESULT GetThread([out] ICorDebugThread **ppThread);
+
+ /*
+ * GetStackRange returns the address range of the stack segment for the
+ * call chain. Note that you cannot make any assumptions about
+ * what is actually stored on the stack - the numeric range is to compare
+ * stack frame locations only.
+ * The start of a stack range is the leafmost boundary of the chain, and
+ * the end of a stack range is the rootmost boundary of the chain.
+ */
+
+ HRESULT GetStackRange([out] CORDB_ADDRESS *pStart, [out] CORDB_ADDRESS *pEnd);
+
+ /*
+ * NOT YET IMPLEMENTED
+ */
+
+ HRESULT GetContext([out] ICorDebugContext **ppContext);
+
+ /*
+ * GetCaller returns a pointer to the chain which called this
+ * chain. Note that this may be a chain on another thread in the
+ * case of cross-thread-marshalled calls. The caller will be NULL
+ * for spontaneously called chains (e.g. the ThreadProc, a
+ * debugger initiated call, etc.)
+ */
+
+ HRESULT GetCaller([out] ICorDebugChain **ppChain);
+
+ /*
+ * GetCallee returns a pointer to the chain which this chain is
+ * waiting on before it resumes. Note that this may be a chain on
+ * another thread in the case of cross-thread-marshalled
+ * calls. The callee will be NULL if the chain is currently
+ * actively running.
+ */
+
+ HRESULT GetCallee([out] ICorDebugChain **ppChain);
+
+ /*
+ * GetPrevious returns a pointer to the chain which was on this
+ * thread before the current one was pushed, if there is one.
+ */
+
+ HRESULT GetPrevious([out] ICorDebugChain **ppChain);
+
+ /*
+ * GetNext returns a pointer to the chain which was pushed on this
+ * thread after the current one, if there is one.
+ */
+
+ HRESULT GetNext([out] ICorDebugChain **ppChain);
+
+ /*
+ * IsManaged returns whether or not the chain is running managed
+ * code.
+ */
+
+ HRESULT IsManaged([out] BOOL *pManaged);
+
+ /*
+ * These chains represent the physical call stack for the thread.
+ * EnumerateFrames returns an iterator which will list all the stack
+ * frames in the chain, starting at the active (most recent) one. This
+ * should be called only for managed chains.
+ *
+ * NOTE: The debugging API does not provide methods for obtaining
+ * frames contained in unmanaged chains. The debugger needs to use
+ * other means to obtain this information.
+ */
+
+ HRESULT EnumerateFrames([out] ICorDebugFrameEnum **ppFrames);
+
+ /*
+ * GetActiveFrame is a convenience routine to return the
+ * active (most recent) frame on the chain, if any.
+ *
+ * If the active frame is not available, the call will succeed
+ * and *ppFrame will be NULL. Active frames will not be available
+ * for all CHAIN_ENTER_UNMANAGED chains, and for some
+ * CHAIN_CLASS_INIT chains.
+ */
+
+ HRESULT GetActiveFrame([out] ICorDebugFrame **ppFrame);
+
+ /*
+ * GetRegisterSet returns the register set for the beginnning (the leafmost end)
+ * of the chain.
+ */
+
+ HRESULT GetRegisterSet([out] ICorDebugRegisterSet **ppRegisters);
+
+ /*
+ * GetReason returns the reason for the genesis of this calling chain.
+ */
+
+ typedef enum CorDebugChainReason
+ {
+ // Note that the first five line up with CorDebugIntercept
+ CHAIN_NONE = 0x000,
+ CHAIN_CLASS_INIT = 0x001,
+ CHAIN_EXCEPTION_FILTER = 0x002,
+ CHAIN_SECURITY = 0x004,
+ CHAIN_CONTEXT_POLICY = 0x008,
+ CHAIN_INTERCEPTION = 0x010,
+ CHAIN_PROCESS_START = 0x020,
+ CHAIN_THREAD_START = 0x040,
+ CHAIN_ENTER_MANAGED = 0x080,
+ CHAIN_ENTER_UNMANAGED = 0x100,
+ CHAIN_DEBUGGER_EVAL = 0x200,
+ CHAIN_CONTEXT_SWITCH = 0x400,
+ CHAIN_FUNC_EVAL = 0x800,
+ } CorDebugChainReason;
+
+ HRESULT GetReason([out] CorDebugChainReason *pReason);
+};
+
+
+[
+ object,
+ local,
+ uuid(CC7BCAEF-8A68-11d2-983C-0000F808342D),
+ pointer_default(unique)
+]
+interface ICorDebugFrame : IUnknown
+{
+ /*
+ * GetChain returns the chain of which this stack frame is a part.
+ */
+
+ HRESULT GetChain([out] ICorDebugChain **ppChain);
+
+ /*
+ * GetCode returns the code which this stack frame is running if any.
+ */
+
+ HRESULT GetCode([out] ICorDebugCode **ppCode);
+
+ /*
+ * GetFunction returns the function for the code which this stack
+ * frame is running.
+ * For ICorDebugInternalFrames, this may point to a method the
+ * frame is associated with (which may be in a different AppDomain
+ * from the frame itself), or may fail if the frame doesn't relate to any
+ * particular function.
+ */
+
+ HRESULT GetFunction([out] ICorDebugFunction **ppFunction);
+
+ /*
+ * GetFunctionToken is a convenience routine to return the token for the
+ * function for the code which this stack frame is running.
+ * The scope to resolve the token can be gotten from the ICorDebugFunction
+ * associated with this frame.
+ */
+
+ HRESULT GetFunctionToken([out] mdMethodDef *pToken);
+
+ /*
+ * GetStackRange returns the absolute address range of the stack
+ * frame. (This is useful for piecing together interleaved stack
+ * traces gathered from multiple debugging engines.) Note that you
+ * cannot make any assumptions about what is actually stored on
+ * the stack - the numeric range is to compare stack frame
+ * locations only.
+ * The start of a stack range is the leafmost boundary of the frame, and
+ * the end of a stack range is the rootmost boundary of the frame.
+ */
+
+ HRESULT GetStackRange([out] CORDB_ADDRESS *pStart, [out] CORDB_ADDRESS *pEnd);
+
+ /*
+ * GetCaller returns a pointer to the frame in the current chain
+ * which called this frame, or NULL if this is the rootmost frame
+ * in the chain.
+ */
+
+ HRESULT GetCaller([out] ICorDebugFrame **ppFrame);
+
+ /*
+ * GetCallee returns a pointer to the frame in the current chain
+ * which this frame called, or NULL if this is the leafmost frame
+ * in the chain.
+ */
+
+ HRESULT GetCallee([out] ICorDebugFrame **ppFrame);
+
+ /*
+ * CreateStepper creates a stepper object which operates relative to the
+ * frame. The Stepper API must then be used to perform actual stepping.
+ *
+ * Note that if this frame is not active, the frame will typically have to
+ * be returned to before the step is completed.
+ *
+ */
+
+ HRESULT CreateStepper([out] ICorDebugStepper **ppStepper);
+};
+
+[
+ object,
+ local,
+ uuid(B92CC7F7-9D2D-45c4-BC2B-621FCC9DFBF4),
+ pointer_default(unique)
+]
+interface ICorDebugInternalFrame : ICorDebugFrame
+{
+
+ typedef enum CorDebugInternalFrameType
+ {
+ // This is a 'null' value for GetFrameType and is included for completeness sake.
+ // ICorDebugInternalFrame::GetFrameType() should never actually return this.
+ STUBFRAME_NONE = 0x00000000,
+
+ // This frame is a M2U stub-frame. This could include both PInvoke
+ // and COM-interop calls.
+ STUBFRAME_M2U = 0x0000001,
+
+ // This is a U2M stub frame.
+ STUBFRAME_U2M = 0x0000002,
+
+ // AppDomain transition.
+ STUBFRAME_APPDOMAIN_TRANSITION = 0x00000003,
+
+ // LightWeight method calls.
+ STUBFRAME_LIGHTWEIGHT_FUNCTION = 0x00000004,
+
+ // Start of Func-eval. This is included for CHF callbacks.
+ // Funcevals also have a chain CHAIN_FUNC_EVAL (legacy from v1.0)
+ STUBFRAME_FUNC_EVAL = 0x00000005,
+
+ // Start of an internal call into the CLR.
+ STUBFRAME_INTERNALCALL = 0x00000006,
+
+ // start of a class initialization; corresponds to CHAIN_CLASS_INIT
+ STUBFRAME_CLASS_INIT = 0x00000007,
+
+ // an exception is thrown; corresponds to CHAIN_EXCEPTION_FILTER
+ STUBFRAME_EXCEPTION = 0x00000008,
+
+ // a frame used for code-access security purposes; corresponds to CHAIN_SECURITY
+ STUBFRAME_SECURITY = 0x00000009,
+
+ // a frame used to mark that the runtime is jitting a managed method
+ STUBFRAME_JIT_COMPILATION = 0x0000000a,
+ } CorDebugInternalFrameType;
+
+ // Get the type of internal frame. This will never be STUBFRAME_NONE.
+ // Debuggers should gracefully ignore unrecognized internal frame types.
+ HRESULT GetFrameType([out] CorDebugInternalFrameType * pType);
+
+};
+
+[
+ object,
+ local,
+ uuid(C0815BDC-CFAB-447e-A779-C116B454EB5B),
+ pointer_default(unique)
+]
+interface ICorDebugInternalFrame2 : IUnknown
+{
+ /*
+ * Returns the stack address of the internal frame marker.
+ */
+ HRESULT GetAddress([out] CORDB_ADDRESS *pAddress);
+
+/*
+ * Check if an internal frame is closer to the leaf than pFrameToCompare.
+ */
+ HRESULT IsCloserToLeaf([in] ICorDebugFrame * pFrameToCompare,
+ [out] BOOL * pIsCloser);
+};
+
+/*
+ * ICorDebugILFrame is a specialized interface of ICorDebugFrame for IL frames or jitted frames.
+ * (Note that jitted frames implement both ICorDebugILFrame and ICorDebugNativeFrame.)
+ */
+
+[
+ object,
+ local,
+ uuid(03E26311-4F76-11d3-88C6-006097945418),
+ pointer_default(unique)
+]
+interface ICorDebugILFrame : ICorDebugFrame
+{
+ /*
+ * GetIP returns the stack frame's offset into the function's IL code.
+ * If this stack frame is active, this address is the next
+ * instruction to execute. If this stack frame is not active, this is the
+ * next instruction to execute when the stack frame is reactivated.
+ *
+ * Note that if this a jitted frame, the IP will be determined by
+ * mapping backwards from the actual native IP, so the value may
+ * be only approximately correct.
+ *
+ * If pMappingResult is not NULL, A mapping result is returned which
+ * indicates the details of how the IP was obtained. The following values
+ * can be returned:
+ *
+ * MAPPING_EXACT - the IP is correct; either the frame is
+ * interpreted or there is an exact IL map for the function.
+ *
+ * MAPPING_APPROXIMATE - the IP was successfully mapped, but may
+ * be only approximately correct
+ *
+ * MAPPING_UNMAPPED_ADDRESS - although there is mapping info for
+ * the function, the current address is not mappable to IL. An
+ * IP of 0 is returned.
+ *
+ * MAPPING_PROLOG - the native code is in the prolog, so an IP of
+ * 0 is returned
+ *
+ * MAPPING_EPILOG - the native code is in an epilog, so the last
+ * IP of the method is returned
+ *
+ * MAPPING_NO_INFO - no mapping info is available for the method,
+ * so an IP of 0 is returned
+ *
+ */
+
+ typedef enum CorDebugMappingResult
+ {
+ MAPPING_PROLOG = 0x1,
+ MAPPING_EPILOG = 0x2,
+ MAPPING_NO_INFO = 0x4,
+ MAPPING_UNMAPPED_ADDRESS = 0x8,
+ MAPPING_EXACT = 0x10,
+ MAPPING_APPROXIMATE = 0x20,
+ } CorDebugMappingResult;
+
+ HRESULT GetIP([out] ULONG32 *pnOffset, [out] CorDebugMappingResult *pMappingResult);
+
+ /*
+ * SetIP sets the instruction pointer to the IL at the given offset.
+ * The debugger will do its best to fix up the state of the executing code
+ * so that it is consistent with the new IP as far as the EE is concerned,
+ * while preserving as much of the state of the user program as possible.
+ *
+ * Calling SetIP immediately invalidates all frames and chains for the
+ * current thread; the debugger must perform a new stack trace if it
+ * requires frame information after calling SetIP.
+ *
+ */
+
+ HRESULT SetIP([in] ULONG32 nOffset);
+
+ /*
+ * EnumerateLocalVariables returns a list of the local variables
+ * available in the frame. Note that this may not include all of
+ * the locals in the running function, as some of them may not be
+ * active.
+ */
+
+ HRESULT EnumerateLocalVariables([out] ICorDebugValueEnum **ppValueEnum);
+
+ /*
+ * GetLocalVariable gets the value for a local variable
+ * in an IL frame. This can be used either in an IL
+ * frame or a jitted frame.
+ */
+
+ HRESULT GetLocalVariable([in] DWORD dwIndex,
+ [out] ICorDebugValue **ppValue);
+
+ /*
+ * EnumerateArguments returns a list of the arguments available in the
+ * frame. Note that this will include varargs arguments as well as
+ * arguments declared by the function signature (inlucding the implicit
+ * "this" argument if any).
+ */
+
+ HRESULT EnumerateArguments([out] ICorDebugValueEnum **ppValueEnum);
+
+ /*
+ * GetArgument gets the value for an argument
+ * in an IL frame. This can be used either in an IL
+ * frame or a jitted frame.
+ * For instance (non-static) methods, argument index 0 is the "this" object,
+ * and the normal explicit arguments start with index 1.
+ */
+
+ HRESULT GetArgument([in] DWORD dwIndex,
+ [out] ICorDebugValue **ppValue);
+
+ /*
+ * NOT YET IMPLEMENTED
+ */
+
+ HRESULT GetStackDepth([out] ULONG32 *pDepth);
+
+ /*
+ * NOT YET IMPLEMENTED
+ */
+
+ HRESULT GetStackValue([in] DWORD dwIndex,
+ [out] ICorDebugValue **ppValue);
+
+ /*
+ * CanSetIP attempts to determine if it's safe to set the instruction pointer
+ * to the IL at the given offset. If this returns S_OK, then executing
+ * SetIP (see above) will result in a safe, correct, continued execution.
+ * If CanSetIP returns anything else, SetIP can still be invoked, but
+ * continued, correct execution of the debuggee cannot be guaranteed.
+ *
+ */
+
+ HRESULT CanSetIP([in] ULONG32 nOffset);
+};
+
+
+/*
+ * ICorDebugILFrame2 is a logical extension to ICorDebugILFrame.
+ */
+[
+ object,
+ local,
+ uuid(5D88A994-6C30-479b-890F-BCEF88B129A5),
+ pointer_default(unique)
+]
+interface ICorDebugILFrame2 : IUnknown
+{
+ /*
+ * Performs an on-stack replacement for an outstanding function remap opportunity.
+ * This is used to update execution of an edited function to the latest version,
+ * preserving the current frame state (such as the values of all locals).
+ * This can only be called when a FunctionRemapOpportunity callback has been delivered
+ * for this leaf frame, and the callback has not yet been continued. newILOffset
+ * is the offset into the new function at which execution should continue.
+ * When the remap has completed, a FunctionRemapComplete callback will be delivered.
+ */
+ HRESULT RemapFunction([in] ULONG32 newILOffset);
+
+ /*
+ * EnumerateTypeParameters returns the type parameters active on a frame.
+ * This will include both the class type parameters (if any) followed by the method type
+ * parameters (if any).
+ * Use the metadata API IMetaDataImport2::EnumGenericParams to determine how many
+ * Class type parameters vs. Method Type parameters there are in this list.
+ * The type parameters will not always be available.
+ */
+
+ HRESULT EnumerateTypeParameters([out] ICorDebugTypeEnum **ppTyParEnum);
+
+};
+
+[
+ object,
+ local,
+ uuid(9A9E2ED6-04DF-4FE0-BB50-CAB64126AD24),
+ pointer_default(unique)
+]
+interface ICorDebugILFrame3 : IUnknown
+{
+ /*
+ * For the specified IL offset, obtains an ICorDebugValue object that encapsulates
+ * the return value of a function. The provided IL offset should be at a function
+ * call site and the debuggee should be stopped at a breakpoint set at the native
+ * offset returned by ICorDebugCode3::GetNativeOffsetForReturnValueBreakpoint for
+ * the same IL offset.
+ * If the debuggee is not stopped at the correct location for the specified IL offset
+ * the API will fail.
+ * If the function call doesn't return a value the API will fail.
+ */
+ HRESULT GetReturnValueForILOffset(ULONG32 ILoffset, [out] ICorDebugValue** ppReturnValue);
+};
+
+typedef enum ILCodeKind
+{
+ ILCODE_ORIGINAL_IL = 0x1,
+ ILCODE_REJIT_IL = 0x2,
+} ILCodeKind;
+
+[
+ object,
+ local,
+ uuid(AD914A30-C6D1-4AC5-9C5E-577F3BAA8A45),
+ pointer_default(unique)
+]
+interface ICorDebugILFrame4 : IUnknown
+{
+ /*
+ * EnumerateLocalVariablesEx returns a list of the local variables
+ * available in the frame. Note that this may not include all of
+ * the locals in the running function, as some of them may not be
+ * active. The Ex version of this function optionally accesses
+ * variables added in profiler ReJIT instrumentation.
+ *
+ * flags:
+ * ILCODE_ORIGINAL_IL preserves the same behavior as calling
+ * EnermateLocalVariables in ICorDebugILFrame.
+ * If the method is instrumented with additional locals, those locals
+ * will not be viewable.
+ * ILCODE_REJIT_IL allows viewing the locals defined
+ * in the profiler's updated local var signature included with the
+ * instrumented IL. If the IL is not instrumented the enumeration will
+ * be empty and S_OK is returned.
+ */
+
+ HRESULT EnumerateLocalVariablesEx([in] ILCodeKind flags, [out] ICorDebugValueEnum **ppValueEnum);
+
+ /*
+ * GetLocalVariableEx gets the value for a local variable
+ * in an IL frame. The Ex version of this function optionally accesses
+ * variables added in profiler ReJIT instrumentation.
+ *
+ * flags:
+ * ILCODE_ORIGINAL_IL preserves the same behavior as calling
+ * GetLocalVariable in ICorDebugILFrame.
+ * If the method is instrumented with additional locals, those locals
+ * will not be addressable or viewable.
+ * ILCODE_REJIT_IL allows viewing the locals defined
+ * in the profiler's updated local var signature included with the
+ * instrumented IL. If the IL is not instrumented the method will
+ * return E_INVALIDARG.
+ */
+ HRESULT GetLocalVariableEx([in] ILCodeKind flags, [in] DWORD dwIndex, [out] ICorDebugValue **ppValue);
+
+
+ /*
+ * GetCode returns the code which this stack frame is running if any.
+ *
+ * flags:
+ * ILCODE_ORIGINAL_IL preserves the same behavior as calling
+ * GetCode in ICorDebugFrame.
+ * If the method is instrumented that IL will not be visible.
+ * ILCODE_REJIT_IL allows viewing the IL defined by the profiler's
+ * rejit request. If the IL is not instrumented *ppCode will be
+ * set to NULL and S_OK is returned.
+ */
+ HRESULT GetCodeEx([in] ILCodeKind flags, [out] ICorDebugCode **ppCode);
+
+};
+
+/*
+ * ICorDebugNativeFrame is a specialized interface of ICorDebugFrame for jitted frames, i.e.
+ * native frames for managed methods.
+ * (Note that jitted frames implement both ICorDebugILFrame and ICorDebugNativeFrame.)
+ */
+
+[
+ object,
+ local,
+ uuid(03E26314-4F76-11d3-88C6-006097945418),
+ pointer_default(unique)
+]
+interface ICorDebugNativeFrame : ICorDebugFrame
+{
+ /*
+ * GetIP returns the stack frame's offset into the function's
+ * native code. If this stack frame is active, this address is
+ * the next instruction to execute. If this stack frame is not
+ * active, this is the next instruction to execute when the stack
+ * frame is reactivated.
+ */
+
+ HRESULT GetIP([out] ULONG32 *pnOffset);
+
+ /*
+ * SetIP sets the instruction pointer to the given native
+ * offset. CorDebug will attempt to keep the stack frame in a
+ * coherent state. (Note that even if the frame is in a valid
+ * state as far as the runtime is concerned, there still may be
+ * problems - e.g. uninitialized local variables, etc. The caller
+ * (or perhaps the user) is responsible for insuring coherency of
+ * the running program.)
+ *
+ * Calling SetIP immediately invalidates all frames and chains for the
+ * current thread; the debugger must perform a new stack trace if it
+ * requires frame information after calling SetIP.
+ */
+
+ HRESULT SetIP([in] ULONG32 nOffset);
+
+ /*
+ * GetRegisterSet returns the register set for the given frame.
+ *
+ */
+
+ HRESULT GetRegisterSet([out] ICorDebugRegisterSet **ppRegisters);
+
+ /*
+ * GetLocalRegisterValue gets the value for a local variable or
+ * argument stored in a register of a native frame. This can be
+ * used either in a native frame or a jitted frame.
+ */
+
+ HRESULT GetLocalRegisterValue([in] CorDebugRegister reg,
+ [in] ULONG cbSigBlob,
+ [in] PCCOR_SIGNATURE pvSigBlob,
+ [out] ICorDebugValue **ppValue);
+
+ /*
+ * GetLocalDoubleRegisterValue gets the value for a local variable
+ * or argument stored in 2 registers of a native frame. This can
+ * be used either in a native frame or a jitted frame.
+ */
+
+ HRESULT GetLocalDoubleRegisterValue([in] CorDebugRegister highWordReg,
+ [in] CorDebugRegister lowWordReg,
+ [in] ULONG cbSigBlob,
+ [in] PCCOR_SIGNATURE pvSigBlob,
+ [out] ICorDebugValue **ppValue);
+
+ /*
+ * GetLocalMemoryValue gets the value for a local variable stored
+ * at the given address.
+ */
+
+ HRESULT GetLocalMemoryValue([in] CORDB_ADDRESS address,
+ [in] ULONG cbSigBlob,
+ [in] PCCOR_SIGNATURE pvSigBlob,
+ [out] ICorDebugValue **ppValue);
+
+ /*
+ * GetLocalRegisterMemoryValue gets the value for a local which
+ * is stored half in a register and half in memory.
+ */
+
+ HRESULT GetLocalRegisterMemoryValue([in] CorDebugRegister highWordReg,
+ [in] CORDB_ADDRESS lowWordAddress,
+ [in] ULONG cbSigBlob,
+ [in] PCCOR_SIGNATURE pvSigBlob,
+ [out] ICorDebugValue **ppValue);
+
+ /*
+ * GetLocalMemoryRegisterValue gets the value for a local which
+ * is stored half in a register and half in memory.
+ */
+
+ HRESULT GetLocalMemoryRegisterValue([in] CORDB_ADDRESS highWordAddress,
+ [in] CorDebugRegister lowWordRegister,
+ [in] ULONG cbSigBlob,
+ [in] PCCOR_SIGNATURE pvSigBlob,
+ [out] ICorDebugValue **ppValue);
+ /*
+ * CanSetIP attempts to determine if it's safe to set the instruction pointer
+ * to the given native offset. If this returns S_OK, then executing
+ * SetIP (see above) will result in a safe, correct, continued execution.
+ * If CanSetIP returns anything else, SetIP can still be invoked, but
+ * continued, correct execution of the debuggee cannot be guaranteed.
+ *
+ */
+
+ HRESULT CanSetIP([in] ULONG32 nOffset);
+};
+
+#pragma warning(push)
+#pragma warning(disable:28718) /* suppress warning 28718 for interface ICorDebugModule */
+[
+ object,
+ local,
+ uuid(35389FF1-3684-4c55-A2EE-210F26C60E5E),
+ pointer_default(unique)
+]
+interface ICorDebugNativeFrame2 : IUnknown
+{
+ /*
+ * Returns true if the current frame is a child frame.
+ */
+ HRESULT IsChild([out] BOOL *pIsChild);
+
+ /*
+ * Return true if the specified frame is the parent frame of the current frame.
+ */
+ HRESULT IsMatchingParentFrame([in] ICorDebugNativeFrame2 *pPotentialParentFrame,
+ [out] BOOL *pIsParent);
+
+ /*
+ * Return the stack parameter size on x86. On other platforms, we return S_FALSE and set pSize to 0.
+ * This is because other platforms don't need this information for unwinding.
+ */
+ HRESULT GetStackParameterSize([out] ULONG32 * pSize);
+};
+
+/*
+ * ICorDebugModule3 is a logical extension to ICorDebugModule.
+ */
+[
+ object,
+ local,
+ uuid(86F012BF-FF15-4372-BD30-B6F11CAAE1DD),
+ pointer_default(unique)
+]
+interface ICorDebugModule3 : IUnknown
+{
+ /*
+ * CreateReaderForInMemorySymbols creates a debug symbol reader object (eg.
+ * ISymUnmanagedReader) for a dynamic module. This symbol reader becomes stale
+ * and is usually discarded whenever a LoadClass callback is delivered for the
+ * module.
+ *
+ * Arguments:
+ * riid - The IID of the COM interface to return (typically IID_ISymUnmanagedReader)
+ * ppObj - Where to store the reader interface.
+ *
+ * Return Value:
+ * S_OK on success
+ * Error hresults otherwise, including:
+ * CORDBG_E_MODULE_LOADED_FROM_DISK if this isn't an in-memory or dynamic module
+ * CORDBG_E_SYMBOLS_NOT_AVAILABLE if symbols weren't supplied by the application or aren't
+ * yet available.
+ *
+ * Notes:
+ * This API can also be used to create a symbol reader object for in-memory
+ * (non-dynamic) modules, but only after the symbols are first available
+ * (indicated by the UpdateModuleSymbols callback).
+ *
+ * This API returns a new reader instance every time it is called (like CoCreateInstance)
+ * and so the debugger should cache the result and only request a new one when
+ * the underlying data may have changed (i.e. a LoadClass event).
+ *
+ * Dynamic modules do not have any symbols available until the first type has been
+ * loaded into them (as indicated by the LoadClass callback).
+ */
+ HRESULT CreateReaderForInMemorySymbols([in] REFIID riid,
+ [out][iid_is(riid)] void **ppObj);
+}
+
+/*
+ * ICorDebugRuntimeUnwindableFrame is a specialized interface of ICorDebugFrame for unmanaged methods
+ * which requires special knowledge to unwind. They are not jitted code. When the debugger sees this type
+ * of frames, it should use ICorDebugStackWalk::Next() to unwind, but it should do inspection itself.
+ * The debugger can call ICorDebugStackWalk::GetContext() to retrieve the CONTEXT of the frame when it gets
+ * an ICorDebugRuntimeUnwindableFrame.
+ */
+
+[
+ object,
+ local,
+ uuid(879CAC0A-4A53-4668-B8E3-CB8473CB187F),
+ pointer_default(unique)
+]
+interface ICorDebugRuntimeUnwindableFrame : ICorDebugFrame
+{
+}
+
+/*
+ * ICorDebugModule represents a Common Language Runtime module that is loaded into a
+ * specific AppDomain. Normally this is an executable or a DLL, but it may also be
+ * some other file of a multi-module assembly. There is an ICorDebugModule instance
+ * for each AppDomain a module is loaded into, even in the case of shared modules like
+ * mscorlib.
+ */
+
+[
+ object,
+ local,
+ uuid(dba2d8c1-e5c5-4069-8c13-10a7c6abf43d),
+ pointer_default(unique)
+]
+interface ICorDebugModule : IUnknown
+{
+ /*
+ * GetProcess returns the process of which this module is a part.
+ */
+
+ HRESULT GetProcess([out] ICorDebugProcess **ppProcess);
+
+ /*
+ * GetBaseAddress returns the base address of the module.
+ *
+ * For modules loaded from NGEN images, the base address will be 0.
+ */
+
+ HRESULT GetBaseAddress([out] CORDB_ADDRESS *pAddress);
+
+ /*
+ * GetAssembly returns the assembly of which this module is a part.
+ */
+
+ HRESULT GetAssembly([out] ICorDebugAssembly **ppAssembly);
+
+ /*
+ * GetName returns a name identifying the module.
+ *
+ * For on-disk modules this is a full path. For dynamic modules this
+ * is just the filename if one was provided. Otherwise, and for other
+ * in-memory modules, this is just the simple name stored in the module's
+ * metadata.
+ */
+
+ HRESULT GetName([in] ULONG32 cchName,
+ [out] ULONG32 *pcchName,
+ [out, size_is(cchName),
+ length_is(*pcchName)] WCHAR szName[]);
+
+ /*
+ * EnableJITDebugging controls whether the jitter preserves
+ * debugging information for methods within this module.
+ * If bTrackJITInfo is true, then the jitter preserves
+ * mapping information between the IL version of a function and
+ * the jitted version for functions in the module. If bAllowJitOpts
+ * is true, then the jitter will generate code with certain (JIT-specific)
+ * optimizations.
+ *
+ * JITDebug is enabled by default for all modules loaded when the
+ * debugger is active. Programmatically enabling/disabling these
+ * settings will override global settings.
+ *
+ */
+ HRESULT EnableJITDebugging([in] BOOL bTrackJITInfo,
+ [in] BOOL bAllowJitOpts);
+
+ /*
+ * EnableClassLoadCallbacks controls whether on not LoadClass and
+ * UnloadClass callbacks are called for the particular module.
+ * For non-dynamic modules, they are off by default.
+ * For dynamic modules, they are on by default and can not be disabled.
+ */
+
+ HRESULT EnableClassLoadCallbacks([in] BOOL bClassLoadCallbacks);
+
+ /*
+ * GetFunctionFromToken returns the ICorDebugFunction from
+ * metadata information. Returns CORDBG_E_FUNCTION_NOT_IL if
+ * called with a methodDef that does not refer to an IL method.
+ * In the EnC case, this will return the most recent version of the function.
+ */
+
+ HRESULT GetFunctionFromToken([in] mdMethodDef methodDef,
+ [out] ICorDebugFunction **ppFunction);
+
+ /*
+ * NOT YET IMPLEMENTED
+ */
+
+ HRESULT GetFunctionFromRVA([in] CORDB_ADDRESS rva,
+ [out] ICorDebugFunction **ppFunction);
+
+ /*
+ * GetClassFromToken returns the ICorDebugClass from metadata information.
+ */
+
+ HRESULT GetClassFromToken([in] mdTypeDef typeDef,
+ [out] ICorDebugClass **ppClass);
+
+ /*
+ * NOT YET IMPLEMENTED
+ */
+
+ HRESULT CreateBreakpoint([out] ICorDebugModuleBreakpoint **ppBreakpoint);
+
+ /*
+ * DEPRECATED
+ */
+
+ HRESULT GetEditAndContinueSnapshot([out] ICorDebugEditAndContinueSnapshot **ppEditAndContinueSnapshot);
+
+ /*
+ * Return a metadata interface pointer that can be used to examine the
+ * metadata for this module.
+ */
+ HRESULT GetMetaDataInterface([in] REFIID riid, [out] IUnknown **ppObj);
+
+
+ /*
+ * Return the token for the Module table entry for this object. The token
+ * may then be passed to the meta data import api's.
+ */
+ HRESULT GetToken([out] mdModule *pToken);
+
+ /*
+ * If this is a dynamic module, IsDynamic sets *pDynamic to true, otherwise
+ * sets *pDynamic to false.
+ * Dynamic modules can continue to grow new classes (receive LoadClass callbacks) even after
+ * the module is loaded.
+ */
+ HRESULT IsDynamic([out] BOOL *pDynamic);
+
+ /*
+ * GetGlobalVariableValue returns a value object for the given global
+ * variable.
+ */
+ HRESULT GetGlobalVariableValue([in] mdFieldDef fieldDef,
+ [out] ICorDebugValue **ppValue);
+
+ /*
+ * GetSize returns the size, in bytes, of the module.
+ *
+ * For modules loaded from NGEN images, the size will be 0.
+ */
+ HRESULT GetSize([out] ULONG32 *pcBytes);
+
+ /*
+ * If this is a module that exists only in the debuggee's memory,
+ * then pInMemory will be set to TRUE. The Runtime supports
+ * loading assemblies from raw streams of bytes. Such modules are
+ * called "in memory" modules and they have no on-disk
+ * representation.
+ */
+ HRESULT IsInMemory([out] BOOL *pInMemory);
+};
+#pragma warning(pop)
+
+/*
+ * ICorDebugModule2 is a logical extension to ICorDebugModule.
+ */
+[
+ object,
+ local,
+ uuid(7FCC5FB5-49C0-41de-9938-3B88B5B9ADD7),
+ pointer_default(unique)
+]
+interface ICorDebugModule2 : IUnknown
+{
+ /*
+ * SetUserCode sets the user-code status of all the functions on all the classes in
+ * the module to bIsJustMyCode, except for the functions or classes in the tokens array,
+ * which it sets to !bIsJustMyCode.
+ * These settings erase all previous JMC settings in this module.
+ * JMC status can be refined by calls to SetJMCStatus on the Class and Function.
+ * Returns S_OK if all functions were set successfully,
+ * CORDBG_E_FUNCTION_NOT_DEBUGGABLE if some function to be marked TRUE was not
+ * debuggable.
+ */
+ HRESULT SetJMCStatus([in] BOOL bIsJustMyCode,
+ [in] ULONG32 cTokens,
+ [in, size_is(cTokens)] mdToken pTokens[]);
+
+ /*
+ * ApplyChanges is called to apply an Edit and Continue delta to the running process.
+ * An EnC delta consists of a delta metadata blob (created by IMetadataEmit2::SaveDelta)
+ * and a delta IL blob (a method body stream just like the one in an on disk assembly).
+ * If this operation fails, the debug session is considered to be in an invalid state
+ * and must be restarted.
+ */
+ HRESULT ApplyChanges([in] ULONG cbMetadata,
+ [in, size_is(cbMetadata)] BYTE pbMetadata[],
+ [in] ULONG cbIL,
+ [in, size_is(cbIL)] BYTE pbIL[]);
+
+ /*
+ * SetJITCompilerFlags sets the flags that control the JIT compiler. If the set of flags is invalid,
+ * the function will fail. This function can only be called from within the true LoadModule callback
+ * for the given module. Attempts to call it after this callback has been delivered or in a "faked"
+ * LoadModule callback for debugger attach will fail.
+ */
+
+ HRESULT SetJITCompilerFlags( [in] DWORD dwFlags );
+
+ /*
+ * GetJITCompilerFlags gets the set of flags that control the JIT compiler for this module.
+ */
+
+ HRESULT GetJITCompilerFlags( [out] DWORD *pdwFlags );
+
+ /*
+ * Resolve an assembly given an AssemblyRef token. Note that
+ * this will not trigger the loading of assembly. If assembly is not yet loaded,
+ * this will return an CORDBG_E_CANNOT_RESOLVE_ASSEMBLY error
+ *
+ */
+ HRESULT ResolveAssembly([in] mdToken tkAssemblyRef,
+ [out] ICorDebugAssembly **ppAssembly);
+
+};
+
+
+/*
+ ICorDebugFunction represents a managed function.
+ In the non-EnC case, it is 1:1 with a methoddef metadata token.
+ For EnC, each version of a function has its own ICorDebugFunction instance.
+ EnCed functions keep the same metadata tokens, but will get new ICorDebugCode instances.
+
+ ICorDebugFunction does not represent generic typeparameters. That means that there's
+ an ICDFunction for Func<T>, but not for Func<string> or Func<Bar>. Get the generic
+ parameters from ICorDebugIlFrame::EnumerateTypeParameters.
+*/
+[
+ object,
+ local,
+ uuid(CC7BCAF3-8A68-11d2-983C-0000F808342D),
+ pointer_default(unique)
+]
+interface ICorDebugFunction : IUnknown
+{
+ /*
+ * GetModule returns the module for the function.
+ */
+
+ HRESULT GetModule([out] ICorDebugModule **ppModule);
+
+ /*
+ * GetClass returns the class for the function. Returns null if
+ * the function is not a member.
+ */
+
+ HRESULT GetClass([out] ICorDebugClass **ppClass);
+
+ /*
+ * GetToken returns the metadata methodDef token for the function.
+ */
+
+ HRESULT GetToken([out] mdMethodDef *pMethodDef);
+
+ /*
+ * GetILCode returns the IL code for the function. Returns null
+ * if there is no IL code for the function. Note that this will
+ * get the IL code corresponding to this function's EnC version of
+ * the code in the runtime, if this function has been EnC'd.
+ */
+
+ HRESULT GetILCode([out] ICorDebugCode **ppCode);
+
+ /*
+ * GetNativeCode returns the native code for the function.
+ * Returns null if there is no native code for the function
+ * (i.e. it is an IL function which has not been jitted)
+ * If this function has been jitted multiple times (Eg, generics) this
+ * will return a random Native Code object.
+ */
+
+ HRESULT GetNativeCode([out] ICorDebugCode **ppCode);
+
+ /*
+ * CreateBreakpoint creates a breakpoint at the start of the function.
+ *
+ */
+
+ HRESULT CreateBreakpoint([out] ICorDebugFunctionBreakpoint **ppBreakpoint);
+
+ /*
+ * Returns the token for the local variable signature for this function.
+ * If there is no signature (ie, the function doesn't have any local
+ * variables), then mdSignatureNil will be returned.
+ */
+
+ HRESULT GetLocalVarSigToken([out] mdSignature *pmdSig);
+
+
+ /*
+ * Obtains the latest (largest) EnC version number for this function.
+ * If this function has never been edited with EnC, this will return
+ * the same value as ICorDebugFunction2::GetVersionNumber.
+ */
+ HRESULT GetCurrentVersionNumber([out] ULONG32 *pnCurrentVersion);
+};
+
+/*
+ ICorDebugFunction2 is a logical extension to ICorDebugFunction.
+*/
+[
+ object,
+ local,
+ uuid(EF0C490B-94C3-4e4d-B629-DDC134C532D8),
+ pointer_default(unique)
+]
+interface ICorDebugFunction2 : IUnknown
+{
+ /*
+ * Sets the User-code status (for JMC stepping) for this function.
+ * A JMC stepper will skip non-user code.
+ * User code must be a subset of debuggable code.
+ * Returns S_OK if successful, CORDBG_E_FUNCTION_NOT_DEBUGGABLE
+ * if bIsJustMyCode is TRUE and the function is not debuggable.
+ */
+ HRESULT SetJMCStatus([in] BOOL bIsJustMyCode);
+
+ /*
+ * IsUserCode outputs whether the function is marked as user code.
+ * Always outputs FALSE for non-debuggable functions.
+ * Returns S_OK if successful.
+ */
+ HRESULT GetJMCStatus([out] BOOL * pbIsJustMyCode);
+
+ /*
+ * Not yet implemented.
+ */
+
+ HRESULT EnumerateNativeCode([out] ICorDebugCodeEnum **ppCodeEnum);
+
+ /*
+ * Obtains the EnC version number of the function represented by this ICorDebugFunction2.
+ * When a function is edited with EnC, the new function has a larger version number than
+ * that of any previous version (not necessarily exactly 1 greater).
+ * This function's version number will be less than or equal to the value returned by
+ * ICorDebugFunction::GetCurrentVersionNumber.
+ */
+
+ HRESULT GetVersionNumber([out] ULONG32 *pnVersion);
+};
+
+
+/*
+ICorDebugFunction3 is a logical extension to ICorDebugFunction.
+*/
+[
+ object,
+ local,
+ uuid(09B70F28-E465-482D-99E0-81A165EB0532),
+ pointer_default(unique)
+]
+interface ICorDebugFunction3 : IUnknown
+{
+ /*
+ * If this function has an active rejit request it will be returned in
+ * pRejitedILCode.
+ * If there is no active request (a common case) then *ppRejitedILCode = NULL
+ *
+ * A rejit request becomes active just after execution returns from the call
+ * ICorProfilerCallback4::GetReJITParameters(). It may not yet be jitted
+ * and threads may still be executing in the original version of the code.
+ *
+ * A rejit request becomes inactive during the profiler's call to
+ * ICorProfInfo::RequestRevert. Even after being reverted a thread can still
+ * be executing in the rejited code.
+ */
+ HRESULT GetActiveReJitRequestILCode(ICorDebugILCode **ppReJitedILCode);
+};
+
+/*
+ ICorDebugCode represents an IL or native code blob.
+
+ For methods that take offsets, the units are the same as the units on the CordbCode object.
+ (eg, IL offsets for an IL code object, and native offsets for a native code object)
+
+ V2 allows multiple code-regions. CordbCode presents an abstraction where these
+ are merged together in a single linear, continuous space. So if the code is split
+ with 0x5 bytes at address 0x1000, and 0x10 bytes at address 0x2000,
+ then:
+ - GetAddress() yields a start address of 0x1000.
+ - GetSize() is the size of the merged regions = 0x5+ 0x10 = 0x15 bytes.
+ - The (Offset --> Address) mapping is:
+ 0x0 --> 0x1000
+ 0x1 --> 0x1001
+ 0x4 --> 0x1004
+ 0x5 --> 0x2000
+ 0x6 --> 0x2001
+ 0x15 --> 0x2010
+
+ A caller can get the specific code regions via ICorDebugCode2.
+*/
+[
+ object,
+ local,
+ uuid(CC7BCAF4-8A68-11d2-983C-0000F808342D),
+ pointer_default(unique)
+]
+interface ICorDebugCode : IUnknown
+{
+ /*
+ * IsIL returns whether the code is IL (as opposed to native.)
+ */
+
+ HRESULT IsIL([out] BOOL *pbIL);
+
+ /*
+ * GetFunction returns the function for the code.
+ */
+
+ HRESULT GetFunction([out] ICorDebugFunction **ppFunction);
+
+ /*
+ * GetAddress returns the address of the code.
+ */
+
+ HRESULT GetAddress([out] CORDB_ADDRESS *pStart);
+
+ /*
+ * GetSize returns the size in bytes of the code.
+ */
+
+ HRESULT GetSize([out] ULONG32 *pcBytes);
+
+ /*
+ * CreateBreakpoint creates a breakpoint in the function at the
+ * given offset.
+ *
+ * If this code is IL code, and there is a jitted native version
+ * of the code, the breakpoint will be applied in the jitted code
+ * as well. (The same is true if the code is later jitted.)
+ *
+ */
+
+ HRESULT CreateBreakpoint([in] ULONG32 offset,
+ [out] ICorDebugFunctionBreakpoint **ppBreakpoint);
+
+ /*
+ * GetCode returns the code of the method, suitable for disassembly. Note
+ * that instruction boundaries aren't checked.
+ * This glues together multiple code-regions into a single binary stream.
+ * Caller must use ICorDebugCode2::GetCodeChunks to get (start,size) for
+ * code chunks to be able to properly resolve addresses embedded in the instructions.
+ */
+
+ HRESULT GetCode([in] ULONG32 startOffset, [in] ULONG32 endOffset,
+ [in] ULONG32 cBufferAlloc,
+ [out, size_is(cBufferAlloc),
+ length_is(*pcBufferSize)] BYTE buffer[],
+ [out] ULONG32 *pcBufferSize);
+
+ /*
+ * GetVersionNumber returns the 1 based number identifying the
+ * version of the code that this ICorDebugCode corresponds to. The
+ * version number is incremented each time the function is Edit-And-
+ * Continue'd.
+ */
+
+ HRESULT GetVersionNumber([out] ULONG32 *nVersion);
+
+ /*
+ * GetILToNativeMapping returns a map from IL offsets to native
+ * offsets for this code. An array of COR_DEBUG_IL_TO_NATIVE_MAP
+ * structs will be returned, and some of the ilOffsets in this array
+ * map be the values specified in CorDebugIlToNativeMappingTypes.
+ *
+ * Note: this method is only valid for ICorDebugCodes representing
+ * native code that was jitted from IL code.
+ * Note: There is no ordering to the array of elements returned, nor
+ * should you assume that there is or will be.
+ */
+ HRESULT GetILToNativeMapping([in] ULONG32 cMap,
+ [out] ULONG32 *pcMap,
+ [out, size_is(cMap), length_is(*pcMap)]
+ COR_DEBUG_IL_TO_NATIVE_MAP map[]);
+
+ /*
+ * Not implemented.
+ */
+ HRESULT GetEnCRemapSequencePoints([in] ULONG32 cMap,
+ [out] ULONG32 *pcMap,
+ [out, size_is(cMap), length_is(*pcMap)]
+ ULONG32 offsets[]);
+};
+
+[
+ object,
+ local,
+ uuid(5F696509-452F-4436-A3FE-4D11FE7E2347),
+ pointer_default(unique)
+]
+interface ICorDebugCode2 : IUnknown
+{
+ typedef struct _CodeChunkInfo
+ {
+ CORDB_ADDRESS startAddr;
+ ULONG32 length;
+ } CodeChunkInfo;
+
+ // The native code for a code object may be split up into multiple regions.
+ //
+ HRESULT GetCodeChunks(
+ [in] ULONG32 cbufSize,
+ [out] ULONG32 * pcnumChunks,
+ [out, size_is(cbufSize), length_is(*pcnumChunks)] CodeChunkInfo chunks[]);
+
+
+ // GetCompilerFlags returns the flags under which this piece of code was JITted or NGENed.
+
+ HRESULT GetCompilerFlags( [out] DWORD *pdwFlags );
+};
+
+[
+ object,
+ local,
+ uuid(D13D3E88-E1F2-4020-AA1D-3D162DCBE966),
+ pointer_default(unique)
+]
+interface ICorDebugCode3 : IUnknown
+{
+ /*
+ * For the specified IL offset, obtains the native offset where a breakpoint should
+ * be placed so that the debugger can obtain the return value from a function.
+ * The provided IL offset should be at a function call site, if not the API will fail.
+ * If the function call doesn't return a value the API will fail.
+ *
+ * Returns:
+ * S_OK - on success.
+ * CORDBG_E_INVALID_OPCODE - If the given IL offset site was not a call instruction
+ * or if the function returns "void".
+ * CORDBG_E_UNSUPPORTED - If the given IL offset is a proper call, but the return
+ * type is unsupported for getting return value.
+ */
+ HRESULT GetReturnValueLiveOffset([in] ULONG32 ILoffset,
+ [in] ULONG32 bufferSize,
+ [out] ULONG32 *pFetched,
+ [out, size_is(bufferSize), length_is(*pFetched)] ULONG32 pOffsets[]);
+};
+
+
+[
+ object,
+ local,
+ uuid(598D46C2-C877-42A7-89D2-3D0C7F1C1264),
+ pointer_default(unique)
+]
+interface ICorDebugILCode : IUnknown
+{
+ /*
+ * Represents an exception clause for a given piece of IL. These fields should be interpretted
+ * the same was as an EH clause in encoded IL in the ECMA CLI specification.
+ */
+ typedef struct _CorDebugEHClause
+ {
+ ULONG32 Flags;
+ ULONG32 TryOffset;
+ ULONG32 TryLength;
+ ULONG32 HandlerOffset;
+ ULONG32 HandlerLength;
+ ULONG32 ClassToken;
+ ULONG32 FilterOffset;
+ } CorDebugEHClause;
+
+ /*
+ * Returns a list of EH clauses that were defined for this IL. The EH clause information
+ * is defined by the CLI specification.
+ * If cClauses is 0 and pcClauses is non-NULL, *pcClauses will be set to the number of
+ * available EH clauses.
+ * If cClauses is non-zero it represents the storage capacity of the clauses array, which
+ * be filled with at most cClauses entries. *pcClauses will be set to the number of clauses
+ * actually written into clauses array.
+ */
+ HRESULT GetEHClauses(
+ [in] ULONG32 cClauses,
+ [out] ULONG32 * pcClauses,
+ [out, size_is(cClauses), length_is(*pcClauses)] CorDebugEHClause clauses[]);
+}
+
+[
+ object,
+ local,
+ uuid(46586093-D3F5-4DB6-ACDB-955BCE228C15),
+ pointer_default(unique)
+]
+interface ICorDebugILCode2 : IUnknown
+{
+ /*
+ * Returns the token for the local variable signature for this function.
+ * If there is no signature (ie, the function doesn't have any local
+ * variables), then mdSignatureNil will be returned.
+ */
+ HRESULT GetLocalVarSigToken([out] mdSignature *pmdSig);
+
+ /*
+ * GetInstrumentedILMap returns a map from profiler instrumentated IL
+ * offsets to original method IL offsets.
+ *
+ * If the IL hasn't been instrumentated or the mapping wasn't provided
+ * by a profiler then this function returns S_OK and pcMap = 0.
+ */
+ HRESULT GetInstrumentedILMap([in] ULONG32 cMap,
+ [out] ULONG32 *pcMap,
+ [out, size_is(cMap), length_is(*pcMap)] COR_IL_MAP map[]);
+}
+
+
+/*
+ ICorDebugClass represents a Class (mdTypeDef) in the IL image.
+ For generic types, it represents the generic type definition (eg. List<T>) not any of
+ the specific instantiations (eg. List<int>).
+
+ Use ICorDebugClass2::GetParameterizedType to build an ICorDebugType from an
+ ICorDebugClass and type parameters.
+
+ Classes live in a module and are uniquely identified by a mdTypeDef.
+ In other words, you can round-trip a class like so:
+ ICorDebugClass * pClass1 = ...; // some initial class
+
+ ICorDebugModule * pModule = NULL;
+ pClass1->GetModule(&pModule);
+
+ mdTypeDef token;
+ pClass1->GetToken(&token);
+
+ ICorDebugClass * pClass2;
+ pModule->GetClassFromToken(token, &pClass2);
+ // Now: pClass1 == pClass2
+
+*/
+[
+ object,
+ local,
+ uuid(CC7BCAF5-8A68-11d2-983C-0000F808342D),
+ pointer_default(unique)
+]
+interface ICorDebugClass : IUnknown
+{
+ /*
+ * GetModule returns the module for the class.
+ */
+
+ HRESULT GetModule([out] ICorDebugModule **pModule);
+
+ /*
+ * GetTypeDefToken returns the metadata typedef token for the class.
+ */
+
+ HRESULT GetToken([out] mdTypeDef *pTypeDef);
+
+ /*
+ * GetStaticFieldValue returns a value object (ICorDebugValue) for the given static field
+ * variable. If the static field could possibly be relative to either
+ * a thread, context, or appdomain, then pFrame will help the debugger
+ * determine the proper value.
+ *
+ * Note that if the class accepts type parameters, then you should
+ * use GetStaticField on an appropriate ICorDebugType rather than on the
+ * ICorDebugClass.
+ *
+ * Returns:
+ * S_OK on success.
+ * CORDBG_E_FIELD_NOT_STATIC if the field is not static.
+ * CORDBG_E_STATIC_VAR_NOT_AVAILABLE if field is not yet available (storage for statics
+ * may be lazily allocated).
+ * CORDBG_E_VARIABLE_IS_ACTUALLY_LITERAL if the field is actually a metadata literal. In this
+ * case, the debugger should get the value from the metadata.
+ * error on other errors.
+ */
+
+ HRESULT GetStaticFieldValue([in] mdFieldDef fieldDef,
+ [in] ICorDebugFrame *pFrame,
+ [out] ICorDebugValue **ppValue);
+};
+
+[
+ object,
+ local,
+ uuid(B008EA8D-7AB1-43f7-BB20-FBB5A04038AE),
+ pointer_default(unique)
+]
+interface ICorDebugClass2 : IUnknown
+{
+ /*
+ * GetParameterizedType returns a type that corresponds to this class.
+ *
+ * If the class is non-generic, i.e. has no type parameters, then
+ * this simply gets the type object corresponding to the class.
+ * elementType should be set to the correct element type for the
+ * class, i.e. ELEMENT_TYPE_VALUETYPE if the class is a value type
+ * otherwise ELEMENT_TYPE_CLASS.
+ *
+ * If the class accepts type parameters, e.g. ArrayList<T>, then
+ * this function can be used to construct a type object for an
+ * instantiated type such as ArrayList<int>.
+ */
+ HRESULT GetParameterizedType([in] CorElementType elementType,
+ [in] ULONG32 nTypeArgs,
+ [in, size_is(nTypeArgs)] ICorDebugType *ppTypeArgs[],
+ [out] ICorDebugType **ppType);
+
+ /*
+ * Sets the User-code status (for JMC stepping) for all methods
+ * in this class. This is functionally equivalent to setting the
+ * JMCStatus onall methods in this class.
+ * A JMC stepper will skip non-user code.
+ * User code must be a subset of debuggable code.
+ *
+ * Returns S_OK if all methods are set succesfully.
+ * Return failure if any are not set.
+ * On failure, some may still be set.
+ */
+ HRESULT SetJMCStatus([in] BOOL bIsJustMyCode);
+
+};
+
+/* ------------------------------------------------------------------------- *
+ * Function call interfaces
+ * ------------------------------------------------------------------------- */
+
+/*
+ * ICorDebugEval collects functionality which requires running code
+ * inside the debuggee. Note that the operations do not complete until
+ * ICorDebugProcess::Continue is called, and the EvalComplete callback
+ * is called.
+ *
+ * An ICorDebugEval object is created in the context of a specific
+ * thread, which will be used to perform the evaluations.
+ *
+ * If you need to use this functionality without allowing other threads
+ * to run, set the DebugState of the program's threads to STOP
+ * before calling Continue.
+ *
+ * Note that since user code is running when the evaluation is in
+ * progress, any debug events can occur, including class loads,
+ * breakpoints, etc. Callbacks will be called normally in such a
+ * case. The state of the Eval will be seen as part of the normal
+ * program state inspection, the stack chain will be a CHAIN_FUNC_EVAL chain;
+ * the full debugger API continues to operate as normal. Evals can even be nested.
+ *
+ * Also, the user code may never complete due to deadlock or infinite
+ * looping. In this case you will need to Abort the Eval before
+ * resuming the program.
+ *
+ * All objects and types used in a given func-eval must all reside within the
+ * same app domain. That app-domain need not be the same as the current
+ * app domain of the thread.
+ *
+ */
+
+[
+ object,
+ local,
+ uuid(CC7BCAF6-8A68-11d2-983C-0000F808342D),
+ pointer_default(unique)
+]
+interface ICorDebugEval : IUnknown
+{
+ /*
+ * CallFunction sets up a function call. Note that if the function
+ * is virtual, this will perform virtual dispatch. If the function is
+ * not static, then the first argument must be the "this" object.
+ * If the function is in an a different AppDomain, a transition will
+ * occur (but all arguments must also be in the target AppDomain)
+ */
+
+ HRESULT CallFunction([in] ICorDebugFunction *pFunction,
+ [in] ULONG32 nArgs,
+ [in, size_is(nArgs)] ICorDebugValue *ppArgs[]);
+
+ /*
+ * NewObject allocates and calls the constructor for an object.
+ */
+
+ HRESULT NewObject([in] ICorDebugFunction *pConstructor,
+ [in] ULONG32 nArgs,
+ [in, size_is(nArgs)] ICorDebugValue *ppArgs[]);
+
+ /*
+ * NewObjectNoConstructor allocates a new object without
+ * attempting to call any constructor on the object.
+ */
+
+ HRESULT NewObjectNoConstructor([in] ICorDebugClass *pClass);
+
+ /*
+ * NewString allocates a string object with the given contents.
+ * The string is always created in the AppDomain the thread is currently in.
+ */
+
+ HRESULT NewString([in] LPCWSTR string);
+
+ /*
+ * NewArray allocates a new array with the given element type and
+ * dimensions. If the elementType is a primitive, pElementClass
+ * may be NULL. Otherwise, pElementClass should be the class of
+ * the elements of the array. Note: lowBounds is optional. If
+ * omitted, a zero lower bound for each dimension is assumed.
+ * The array is always created in the AppDomain the thread is currently in.
+ *
+ * NOTE: In the current release, rank must be 1.
+ */
+
+ HRESULT NewArray([in] CorElementType elementType,
+ [in] ICorDebugClass *pElementClass,
+ [in] ULONG32 rank,
+ [in, size_is(rank)] ULONG32 dims[],
+ [in, size_is(rank)] ULONG32 lowBounds[]);
+
+ /*
+ * IsActive returns whether the func-eval is currently executing.
+ */
+
+ HRESULT IsActive([out] BOOL *pbActive);
+
+ /*
+ * Abort aborts the current computation. Note that in the case of nested
+ * Evals, this may fail unless it is the most recent Eval.
+ */
+
+ HRESULT Abort();
+
+ /*
+ * GetResult returns the result of the evaluation. This is only
+ * valid after the evaluation is completed.
+ *
+ * If the evaluation completes normally, the result will be the
+ * return value. If it terminates with an exception, the result
+ * is the exception thrown. If the evaluation was for a new object,
+ * the return value is the reference to the object.
+ */
+
+ HRESULT GetResult([out] ICorDebugValue **ppResult);
+
+ /*
+ * GetThread returns the thread on which this eval will run or is running.
+ */
+
+ HRESULT GetThread([out] ICorDebugThread **ppThread);
+
+ /*
+ * CreateValue creates an ICorDebugValue of the given type for the
+ * sole purpose of using it in a function evaluation. These can be
+ * used to pass user constants as parameters. The value has a zero
+ * or NULL initial value. Use ICorDebugValue::SetValue to
+ * set the value.
+ *
+ * pElementClass is only required for value classes. Pass NULL
+ * otherwise.
+ *
+ * If elementType == ELEMENT_TYPE_CLASS, then you get an
+ * ICorDebugReferenceValue representing the NULL object reference.
+ * You can use this to pass NULL to evals that have object reference
+ * parameters. You cannot set the ICorDebugReferenceValue to
+ * anything... it always remains NULL.
+ */
+
+ HRESULT CreateValue([in] CorElementType elementType,
+ [in] ICorDebugClass *pElementClass,
+ [out] ICorDebugValue **ppValue);
+};
+
+[
+ object,
+ local,
+ uuid(FB0D9CE7-BE66-4683-9D32-A42A04E2FD91),
+ pointer_default(unique)
+]
+interface ICorDebugEval2 : IUnknown
+{
+ /*
+ * CallParameterizedFunction is like CallFunction except the function
+ * may be inside a class with type parameters, or may itself take type
+ * parameters, or both. The type arguments should be given for the
+ * class first, then the function.
+ *
+ * If the function is in an a different AppDomain, a transition will occur.
+ * However, all type and value arguments must be in the target AppDomain.
+ *
+ * Func-eval can only be performed in limited scenarios. If Call*Function
+ * fails, then the HR makes a best effort at describing the most general
+ * possible reason for failure.
+ */
+
+ HRESULT CallParameterizedFunction([in] ICorDebugFunction *pFunction,
+ [in] ULONG32 nTypeArgs,
+ [in, size_is(nTypeArgs)] ICorDebugType *ppTypeArgs[],
+ [in] ULONG32 nArgs,
+ [in, size_is(nArgs)] ICorDebugValue *ppArgs[]);
+
+ /*
+ * CreateValueForType generalizes CreateValue by allowing you to specify an
+ * arbitrary object type including constructed types such as List<int>.
+ * Once again the sole purpose is to generate a value to pass for a function evaluation.
+ *
+ * The element type of the type must be ELEMENT_TYPE_CLASS or
+ * ELEMENT_TYPE_VALUE, or one of the simple types. You cannot use this
+ * to create array values or string values.
+ */
+
+ HRESULT CreateValueForType([in] ICorDebugType *pType,
+ [out] ICorDebugValue **ppValue);
+
+ /*
+ * NewParameterizedObject allocates and calls the constructor for an object.
+ * The object may be in a class that includes type parameters.
+ */
+
+ HRESULT NewParameterizedObject([in] ICorDebugFunction *pConstructor,
+ [in] ULONG32 nTypeArgs,
+ [in, size_is(nTypeArgs)] ICorDebugType *ppTypeArgs[],
+ [in] ULONG32 nArgs,
+ [in, size_is(nArgs)] ICorDebugValue *ppArgs[]);
+
+ /*
+ * NewParameterizedObjectNoConstructor allocates a new object without
+ * attempting to call any constructor on the object.
+ * The object may be in a class that includes type parameters.
+ */
+
+ HRESULT NewParameterizedObjectNoConstructor([in] ICorDebugClass *pClass,
+ [in] ULONG32 nTypeArgs,
+ [in, size_is(nTypeArgs)] ICorDebugType *ppTypeArgs[]);
+
+ /*
+ * NewParamaterizedArray allocates a new array whose elements may be instances
+ * of a generic type. The array is always created in the AppDomain the thread is
+ * currently in.
+ */
+ HRESULT NewParameterizedArray([in] ICorDebugType *pElementType,
+ [in] ULONG32 rank,
+ [in, size_is(rank)] ULONG32 dims[],
+ [in, size_is(rank)] ULONG32 lowBounds[]);
+
+ /*
+ * NewStringWithLength allocates a string object with the given contents.
+ * The length is specified in uiLength. This is used for user to pass in null
+ * embedded string. If the string's tailing null is expected to be in
+ * the managed string, client has to ensure the length including the tailing null.
+ *
+ * The string is always created in the AppDomain the thread is currently in.
+ */
+
+ HRESULT NewStringWithLength([in] LPCWSTR string,
+ [in] UINT uiLength);
+
+ /*
+ * RudeAbort aborts the current computation. Any locks the aborted
+ * eval was holding are not released, and thus the debugging session
+ * is in an unsafe state.
+ */
+
+ HRESULT RudeAbort(void);
+
+};
+
+
+/* ------------------------------------------------------------------------- *
+ * Runtime value interfaces
+ * ------------------------------------------------------------------------- */
+
+/*
+ * ICorDebugValue represents a value in the remote process. Note that
+ * the values can be both Get and Set; they are "lvalues".
+ *
+ * In general, ownership of a value object is passed when it is returned. The
+ * recipient is responsible for removing a reference from the object when
+ * finished with it.
+ *
+ * Depending on where the value was retrieved from, the value may not remain
+ * valid after the process is resumed,
+ * so in general they shouldn't be held across continues.
+ */
+
+[
+ object,
+ local,
+ uuid(CC7BCAF7-8A68-11d2-983C-0000F808342D),
+ pointer_default(unique)
+]
+interface ICorDebugValue : IUnknown
+{
+ /*
+ * GetType returns the simple type of the value. If the object
+ * has a more complex runtime type, that type may be examined through the
+ * appropriate subclasses (e.g. ICorDebugObjectValue can get the class of
+ * an object.)
+ */
+
+ HRESULT GetType([out] CorElementType *pType);
+
+ /*
+ * GetSize returns the size of the value in bytes. Note that for reference
+ * types this will be the size of the pointer rather than the size of
+ * the object.
+ */
+
+ HRESULT GetSize([out] ULONG32 *pSize);
+
+ /*
+ * GetAddress returns the address of the value in the debugee
+ * process. This might be useful information for the debugger to
+ * show.
+ *
+ * If the value is unavailable, 0 is returned. This could happen if
+ * it is at least partly in registers or stored in a GC Handle.
+ */
+
+ HRESULT GetAddress([out] CORDB_ADDRESS *pAddress);
+
+ /*
+ * NOT YET IMPLEMENTED
+ */
+
+ HRESULT CreateBreakpoint([out] ICorDebugValueBreakpoint **ppBreakpoint);
+
+};
+
+[
+ object,
+ local,
+ uuid(5E0B54E7-D88A-4626-9420-A691E0A78B49),
+ pointer_default(unique)
+]
+interface ICorDebugValue2 : IUnknown
+{
+ /*
+ * GetExactType returns the runtime type of the object in the value.
+ */
+
+ HRESULT GetExactType([out] ICorDebugType **ppType);
+
+};
+
+[
+ object,
+ local,
+ uuid(565005FC-0F8A-4F3E-9EDB-83102B156595),
+ pointer_default(unique)
+]
+interface ICorDebugValue3 : IUnknown
+{
+ /*
+ * GetSize returns the size of the value in bytes. It has the same
+ * semantics as ICorDebugValue::GetSize except that it works
+ * for arrays >4GB.
+ */
+
+ HRESULT GetSize64([out] ULONG64 *pSize);
+
+};
+
+/*
+ * ICorDebugGenericValue is a subclass of ICorDebugValue which applies to
+ * all values, and can be used to get & set the value. It is a
+ * separate subinterface because it is non-remotable.
+ *
+ * Note that for reference types, the value is the reference rather than
+ * the contents.
+ */
+
+[
+ object,
+ local,
+ uuid(CC7BCAF8-8A68-11d2-983C-0000F808342D),
+ pointer_default(unique)
+]
+interface ICorDebugGenericValue : ICorDebugValue
+{
+ /*
+ * GetValue copies the value into the specified buffer. The buffer should
+ * be the appropriate size for the simple type.
+ */
+
+ HRESULT GetValue([out] void *pTo);
+
+ /*
+ * SetValue copies a new value from the specified buffer. The buffer should
+ * be the approprirate size for the simple type.
+ *
+ */
+
+ HRESULT SetValue([in] void *pFrom);
+};
+
+/* ISSUE: an remotable interface for each simple type
+ *
+ * It might be nice to have a subclass with a typesafe Get/Set for each simple
+ * type.
+ */
+
+/*
+ * ICorDebugReferenceValue is a subclass of ICorDebugValue which applies to
+ * a reference type.
+ * The runtime may Garbage Collect objects once the debuggee is continued. The GC may
+ * move objects around in memory.
+ *
+ * An ICorDebugReference will either cooperate with GCs such that its information is updated
+ * after the GC, or it will be implicitly neutered before the GC.
+ *
+ * The ICorDebugReferenceValue inteface may be implicitly neutered after the debuggee
+ * has been continued. The derived ICorDebugHandleValue is not neutered until explicitly
+ * released or exposed.
+ *
+ */
+
+[
+ object,
+ local,
+ uuid(CC7BCAF9-8A68-11d2-983C-0000F808342D),
+ pointer_default(unique)
+]
+interface ICorDebugReferenceValue : ICorDebugValue
+{
+ /*
+ * IsNull tests whether the reference is null.
+ */
+
+ HRESULT IsNull([out] BOOL *pbNull);
+
+ /*
+ * GetValue returns the current address of the object referred to by this
+ * reference.
+ */
+
+ HRESULT GetValue([out] CORDB_ADDRESS *pValue);
+
+ /*
+ * SetValue sets this reference to refer to a different address.
+ */
+
+ HRESULT SetValue([in] CORDB_ADDRESS value);
+
+ /*
+ * Dereference returns a ICorDebugValue representing the value
+ * referenced. This is only valid while the interface has not yet been neutered.
+ */
+
+ HRESULT Dereference([out] ICorDebugValue **ppValue);
+
+ /*
+ * DEPRECATED
+ */
+
+ HRESULT DereferenceStrong([out] ICorDebugValue **ppValue);
+};
+
+/*
+ * ICorDebugHeapValue is a subclass of ICorDebugValue which represents
+ * a garbage collected object
+ */
+
+[
+ object,
+ local,
+ uuid(CC7BCAFA-8A68-11d2-983C-0000F808342D),
+ pointer_default(unique)
+]
+interface ICorDebugHeapValue : ICorDebugValue
+{
+ /*
+ * DEPRECATED.
+ * All objects are only valid until Continue is called, at which time they are neutered.
+ */
+
+ HRESULT IsValid([out] BOOL *pbValid);
+
+ /*
+ * NOT YET IMPLEMENTED
+ */
+
+ HRESULT CreateRelocBreakpoint([out]
+ ICorDebugValueBreakpoint **ppBreakpoint);
+
+};
+
+/*
+ * ICorDebugHeapValue2
+ */
+
+[
+ object,
+ local,
+ uuid(E3AC4D6C-9CB7-43e6-96CC-B21540E5083C),
+ pointer_default(unique)
+]
+interface ICorDebugHeapValue2 : IUnknown
+{
+
+ /*
+ * Creates a handle of the given type for this heap value.
+ *
+ */
+ HRESULT CreateHandle([in] CorDebugHandleType type, [out] ICorDebugHandleValue ** ppHandle);
+
+};
+
+/*
+ * ICorDebugHeapValue3 - exposes the monitor lock properties of objects
+ */
+
+[
+ object,
+ local,
+ uuid(A69ACAD8-2374-46e9-9FF8-B1F14120D296),
+ pointer_default(unique)
+]
+interface ICorDebugHeapValue3 : IUnknown
+{
+
+ /*
+ * Gets the owning thread for a monitor lock
+ */
+ HRESULT GetThreadOwningMonitorLock([out] ICorDebugThread **ppThread, [out] DWORD *pAcquisitionCount);
+
+ /*
+ * Gets the list of threads waiting on a monitor event
+ */
+ HRESULT GetMonitorEventWaitList([out] ICorDebugThreadEnum **ppThreadEnum);
+};
+
+/*
+ * ICorDebugObjectValue is a subclass of ICorDebugValue which applies to
+ * values which contain an object.
+ * An ICorDebugObjectValue becomes invalid after the debuggee is continued.
+ */
+
+[
+ object,
+ local,
+ uuid(18AD3D6E-B7D2-11d2-BD04-0000F80849BD),
+ pointer_default(unique)
+]
+interface ICorDebugObjectValue : ICorDebugValue
+{
+ /*
+ * GetClass returns the runtime class of the object in the value.
+ */
+
+ HRESULT GetClass([out] ICorDebugClass **ppClass);
+
+ /*
+ * GetFieldValue returns a value for the given field in the given
+ * class. The class must be on the class hierarchy of the object's
+ * class, and the field must be a field of that class.
+ */
+
+ HRESULT GetFieldValue([in] ICorDebugClass *pClass,
+ [in] mdFieldDef fieldDef,
+ [out] ICorDebugValue **ppValue);
+
+ /*
+ * NOT YET IMPLEMENTED
+ */
+
+ HRESULT GetVirtualMethod([in] mdMemberRef memberRef,
+ [out] ICorDebugFunction **ppFunction);
+
+ /*
+ * NOT YET IMPLEMENTED
+ */
+
+ HRESULT GetContext([out] ICorDebugContext **ppContext);
+
+ /*
+ * IsValueClass returns true if the the class of this object is
+ * a value class.
+ */
+
+ HRESULT IsValueClass([out] BOOL *pbIsValueClass);
+
+ /*
+ * DEPRECATED
+ */
+
+ HRESULT GetManagedCopy([out] IUnknown **ppObject);
+
+ /*
+ * DEPRECATED
+ */
+
+ HRESULT SetFromManagedCopy([in] IUnknown *pObject);
+};
+
+[
+ object,
+ local,
+ uuid(49E4A320-4A9B-4eca-B105-229FB7D5009F),
+ pointer_default(unique)
+]
+interface ICorDebugObjectValue2 : IUnknown
+{
+ /*
+ * GetVirtualMethodForType returns the most derived function
+ * for the given ref on this object.
+ *
+ * Note: not yet implemented.
+ */
+
+ HRESULT GetVirtualMethodAndType([in] mdMemberRef memberRef,
+ [out] ICorDebugFunction **ppFunction,
+ [out] ICorDebugType **ppType);
+};
+
+/*
+ * ICorDebugBoxValue is a subclass of ICorDebugValue which
+ * represents a boxed value class object.
+ */
+
+[
+ object,
+ local,
+ uuid(CC7BCAFC-8A68-11d2-983C-0000F808342D),
+ pointer_default(unique)
+]
+interface ICorDebugBoxValue : ICorDebugHeapValue
+{
+ /*
+ * GetObject returns the value object which is in the box.
+ */
+
+ HRESULT GetObject([out] ICorDebugObjectValue **ppObject);
+};
+
+#pragma warning(push)
+#pragma warning(disable:28718) /* suppress warning 28718 for interface ICorDebugStringValue */
+/*
+ * ICorDebugStringValue is a subclass of ICorDebugValue which
+ * applies to values which contain a string. This interface
+ * provides an easy way to get the string contents.
+ */
+
+[
+ object,
+ local,
+ uuid(CC7BCAFD-8A68-11d2-983C-0000F808342D),
+ pointer_default(unique)
+]
+interface ICorDebugStringValue : ICorDebugHeapValue
+{
+ /*
+ * GetLength returns the number of characters in the string.
+ */
+
+ HRESULT GetLength([out] ULONG32 *pcchString);
+
+ /*
+ * GetString returns the contents of the string.
+ */
+
+ HRESULT GetString([in] ULONG32 cchString,
+ [out] ULONG32 *pcchString,
+ [out, size_is(cchString),
+ length_is(*pcchString)] WCHAR szString[]);
+};
+#pragma warning(pop)
+
+/*
+ * ICorDebugArrayValue is a subclass of ICorDebugValue which applies
+ * to values which contain an array. This interface supports both
+ * single and multidimension arrays.
+ */
+
+[
+ object,
+ local,
+ uuid(0405B0DF-A660-11d2-BD02-0000F80849BD),
+ pointer_default(unique)
+]
+interface ICorDebugArrayValue : ICorDebugHeapValue
+{
+ /*
+ * GetElementType returns the simple type of the elements in the
+ * array.
+ */
+
+ HRESULT GetElementType([out] CorElementType *pType);
+
+ /*
+ * GetRank returns the number of dimensions in the array.
+ */
+
+ HRESULT GetRank([out] ULONG32 *pnRank);
+
+ /*
+ * GetCount returns the total number of elements in the array.
+ */
+
+ HRESULT GetCount([out] ULONG32 *pnCount);
+
+ /*
+ * GetDimensions returns the dimensions of the array.
+ */
+
+ HRESULT GetDimensions([in] ULONG32 cdim,
+ [out, size_is(cdim),
+ length_is(cdim)] ULONG32 dims[]);
+
+ /*
+ * HasBaseIndicies returns whether or not the array has base indicies.
+ * If the answer is no, then all dimensions have a base index of 0.
+ */
+
+ HRESULT HasBaseIndicies([out] BOOL *pbHasBaseIndicies);
+
+ /*
+ * GetBaseIndicies returns the base index of each dimension in
+ * the array
+ */
+
+ HRESULT GetBaseIndicies([in] ULONG32 cdim,
+ [out, size_is(cdim),
+ length_is(cdim)] ULONG32 indicies[]);
+
+ /*
+ * GetElement returns a value representing the given element in the array.
+ * The indices array must not be null.
+ */
+
+ HRESULT GetElement([in] ULONG32 cdim,
+ [in, size_is(cdim),
+ length_is(cdim)] ULONG32 indices[],
+ [out] ICorDebugValue **ppValue);
+ /*
+ * GetElementAtPosition returns the element at the given position,
+ * treating the array as a zero-based, single-dimensional array.
+ *
+ * Multidimensional array layout follows the C++ style of array layout.
+ */
+
+ HRESULT GetElementAtPosition([in] ULONG32 nPosition,
+ [out] ICorDebugValue **ppValue);
+};
+
+
+/*
+ * ICorDebugHandleValue represents a reference value that the debugger has
+ * explicitly created a GC handle to. It does not represent GC Handles in the debuggee process,
+
+ * A normal ICorDebugReference becomes neutered after the debuggee has been
+ * continued. A ICorDebugHandleValue will survive across continues and can be
+ * dereferenced until the client explcitly disposes the handle.
+ *
+ *
+ * ICorDebugHeapValu2::CreateHandle will create ICorDebugHandleValue
+ */
+[
+ object,
+ local,
+ uuid(029596E8-276B-46a1-9821-732E96BBB00B),
+ pointer_default(unique)
+]
+interface ICorDebugHandleValue : ICorDebugReferenceValue
+{
+ /*
+ * returns the type of this handle.
+ *
+ */
+ HRESULT GetHandleType([out] CorDebugHandleType *pType);
+
+
+ /*
+ * The final release of the interface will also dispose of the handle. This
+ * API provides the ability for client to early dispose the handle.
+ *
+ */
+ HRESULT Dispose();
+
+};
+
+
+/*
+ * ICorDebugContext represents a context object.
+ *
+ * Interface TBD.
+ */
+
+[
+ object,
+ local,
+ uuid(CC7BCB00-8A68-11d2-983C-0000F808342D),
+ pointer_default(unique)
+]
+interface ICorDebugContext : ICorDebugObjectValue
+{
+};
+
+
+/*
+ * ICorDebugComObjectValue applies to values which contain a COM object.
+ * An ICorDebugComObjectValue becomes invalid after the debuggee is continued.
+ */
+
+[
+ object,
+ local,
+ uuid(5F69C5E5-3E12-42DF-B371-F9D761D6EE24),
+ pointer_default(unique)
+]
+interface ICorDebugComObjectValue : IUnknown
+{
+ /*
+ * GetCachedInterfaceTypes returns an enum of the types of all interfaces
+ * that are cached by the COM object.
+ */
+ HRESULT GetCachedInterfaceTypes(
+ [in] BOOL bIInspectableOnly,
+ [out] ICorDebugTypeEnum **ppInterfacesEnum);
+
+ /*
+ * GetCachedInterfacePointers returns at most celt values of the
+ * interface pointer values cached by the COM object. It fills
+ * pcEltFetched with the actual number of fetched elements.
+ * When called with NULL for ptrs, and 0 for celt, it simply returns
+ * the number of elements it needs.
+ */
+ HRESULT GetCachedInterfacePointers(
+ [in] BOOL bIInspectableOnly,
+ [in] ULONG32 celt,
+ [out] ULONG32 *pcEltFetched,
+ [out, size_is(celt), length_is(*pcEltFetched)] CORDB_ADDRESS * ptrs);
+};
+
+/* ------------------------------------------------------------------------- *
+ * Enum interfaces
+ * ------------------------------------------------------------------------- */
+
+/*
+ * ICorDebugEnum is an abstract enumerator.
+ */
+
+[
+ object,
+ local,
+ uuid(CC7BCB01-8A68-11d2-983C-0000F808342D),
+ pointer_default(unique)
+]
+interface ICorDebugEnum : IUnknown
+{
+ /*
+ * Moves the current position forward the given number of
+ * elements.
+ */
+ HRESULT Skip([in] ULONG celt);
+
+ /*
+ * Sets the position of the enumerator to the beginning of the
+ * enumeration.
+ */
+ HRESULT Reset();
+
+ /*
+ * Creates another enumerator with the same current position
+ * as this one.
+ */
+ HRESULT Clone([out] ICorDebugEnum **ppEnum);
+
+ /*
+ * Gets the number of elements in the enumeration
+ */
+ HRESULT GetCount([out] ULONG *pcelt);
+};
+
+[
+ object,
+ local,
+ uuid(CC7BCB02-8A68-11d2-983C-0000F808342D),
+ pointer_default(unique)
+]
+interface ICorDebugObjectEnum : ICorDebugEnum
+{
+ /*
+ * Gets the next "celt" number of objects in the enumeration.
+ * The actual number of objects retrieved is returned in "pceltFetched".
+ * Returns S_FALSE if the actual number of objects retrieved is smaller
+ * than the number of objects requested.
+ */
+ HRESULT Next([in] ULONG celt,
+ [out, size_is(celt),
+ length_is(*pceltFetched)] CORDB_ADDRESS objects[],
+ [out] ULONG *pceltFetched);
+};
+
+[
+ object,
+ local,
+ uuid(CC7BCB03-8A68-11d2-983C-0000F808342D),
+ pointer_default(unique)
+]
+
+interface ICorDebugBreakpointEnum : ICorDebugEnum
+{
+ /*
+ * Gets the next "celt" number of breakpoints in the enumeration.
+ * The actual number of breakpoints retrieved is returned in "pceltFetched".
+ * Returns S_FALSE if the actual number of breakpoints retrieved is smaller
+ * than the number of breakpoints requested.
+ */
+ HRESULT Next([in] ULONG celt,
+ [out, size_is(celt), length_is(*pceltFetched)]
+ ICorDebugBreakpoint *breakpoints[],
+ [out] ULONG *pceltFetched);
+};
+
+[
+ object,
+ local,
+ uuid(CC7BCB04-8A68-11d2-983C-0000F808342D),
+ pointer_default(unique)
+]
+
+interface ICorDebugStepperEnum : ICorDebugEnum
+{
+ /*
+ * Gets the next "celt" number of steppers in the enumeration.
+ * The actual number of steppers retrieved is returned in "pceltFetched".
+ * Returns S_FALSE if the actual number of steppers retrieved is smaller
+ * than the number of steppers requested.
+ */
+ HRESULT Next([in] ULONG celt,
+ [out, size_is(celt), length_is(*pceltFetched)]
+ ICorDebugStepper *steppers[],
+ [out] ULONG *pceltFetched);
+};
+
+[
+ object,
+ local,
+ uuid(CC7BCB05-8A68-11d2-983C-0000F808342D),
+ pointer_default(unique)
+]
+interface ICorDebugProcessEnum : ICorDebugEnum
+{
+ /*
+ * Gets the next "celt" number of processes in the enumeration.
+ * The actual number of processes retrieved is returned in "pceltFetched".
+ * Returns S_FALSE if the actual number of processes retrieved is smaller
+ * than the number of processes requested.
+ */
+ HRESULT Next([in] ULONG celt,
+ [out, size_is(celt), length_is(*pceltFetched)]
+ ICorDebugProcess *processes[],
+ [out] ULONG *pceltFetched);
+};
+
+[
+ object,
+ local,
+ uuid(CC7BCB06-8A68-11d2-983C-0000F808342D),
+ pointer_default(unique)
+]
+interface ICorDebugThreadEnum : ICorDebugEnum
+{
+ /*
+ * Gets the next "celt" number of threads in the enumeration.
+ * The actual number of threads retrieved is returned in "pceltFetched".
+ * Returns S_FALSE if the actual number of threads retrieved is smaller
+ * than the number of threads requested.
+ */
+ HRESULT Next([in] ULONG celt,
+ [out, size_is(celt), length_is(*pceltFetched)]
+ ICorDebugThread *threads[],
+ [out] ULONG *pceltFetched);
+};
+
+[
+ object,
+ local,
+ uuid(CC7BCB07-8A68-11d2-983C-0000F808342D),
+ pointer_default(unique)
+]
+interface ICorDebugFrameEnum : ICorDebugEnum
+{
+ /*
+ * Gets the next "celt" number of frames in the enumeration.
+ * The actual number of frames retrieved is returned in "pceltFetched".
+ * Returns S_FALSE if the actual number of frames retrieved is smaller
+ * than the number of frames requested.
+ */
+ HRESULT Next([in] ULONG celt,
+ [out, size_is(celt), length_is(*pceltFetched)]
+ ICorDebugFrame *frames[],
+ [out] ULONG *pceltFetched);
+};
+
+[
+ object,
+ local,
+ uuid(CC7BCB08-8A68-11d2-983C-0000F808342D),
+ pointer_default(unique)
+]
+interface ICorDebugChainEnum : ICorDebugEnum
+{
+ /*
+ * Gets the next "celt" number of chains in the enumeration.
+ * The actual number of chains retrieved is returned in "pceltFetched".
+ * Returns S_FALSE if the actual number of chains retrieved is smaller
+ * than the number of chains requested.
+ */
+ HRESULT Next([in] ULONG celt,
+ [out, size_is(celt), length_is(*pceltFetched)]
+ ICorDebugChain *chains[],
+ [out] ULONG *pceltFetched);
+};
+
+[
+ object,
+ local,
+ uuid(CC7BCB09-8A68-11d2-983C-0000F808342D),
+ pointer_default(unique)
+]
+interface ICorDebugModuleEnum : ICorDebugEnum
+{
+ /*
+ * Gets the next "celt" number of modules in the enumeration.
+ * The actual number of modules retrieved is returned in "pceltFetched".
+ * Returns S_FALSE if the actual number of modules retrieved is smaller
+ * than the number of modules requested.
+ */
+ HRESULT Next([in] ULONG celt,
+ [out, size_is(celt), length_is(*pceltFetched)]
+ ICorDebugModule *modules[],
+ [out] ULONG *pceltFetched);
+};
+
+[
+ object,
+ local,
+ uuid(CC7BCB0A-8A68-11d2-983C-0000F808342D),
+ pointer_default(unique)
+]
+interface ICorDebugValueEnum : ICorDebugEnum
+{
+ /*
+ * Gets the next "celt" number of values in the enumeration.
+ * The actual number of values retrieved is returned in "pceltFetched".
+ * Returns S_FALSE if the actual number of values retrieved is smaller
+ * than the number of values requested.
+ */
+ HRESULT Next([in] ULONG celt,
+ [out, size_is(celt), length_is(*pceltFetched)]
+ ICorDebugValue *values[],
+ [out] ULONG *pceltFetched);
+};
+
+[
+ object,
+ local,
+ uuid(55E96461-9645-45e4-A2FF-0367877ABCDE),
+ pointer_default(unique)
+]
+interface ICorDebugCodeEnum : ICorDebugEnum
+{
+ /*
+ * Gets the next "celt" number of code objects in the enumeration.
+ * The actual number of code objects retrieved is returned in "pceltFetched".
+ * Returns S_FALSE if the actual number of code objects retrieved is smaller
+ * than the number of code objects requested.
+ */
+ HRESULT Next([in] ULONG celt,
+ [out, size_is(celt), length_is(*pceltFetched)]
+ ICorDebugCode *values[],
+ [out] ULONG *pceltFetched);
+};
+
+[
+ object,
+ local,
+ uuid(10F27499-9DF2-43ce-8333-A321D7C99CB4),
+ pointer_default(unique)
+]
+interface ICorDebugTypeEnum : ICorDebugEnum
+{
+ /*
+ * Gets the next "celt" number of types in the enumeration.
+ * The actual number of types retrieved is returned in "pceltFetched".
+ * Returns S_FALSE if the actual number of types retrieved is smaller
+ * than the number of types requested.
+ */
+ HRESULT Next([in] ULONG celt,
+ [out, size_is(celt), length_is(*pceltFetched)]
+ ICorDebugType *values[],
+ [out] ULONG *pceltFetched);
+};
+
+
+
+/*
+ * ICorDebugType represents an instantiated type in the debugggee.
+ * Unlike ICorDebugClass, it can store type-parameter information and thus can
+ * represent instantiated generic types (Eg, List<int>)
+ * Use the metadata interfaces to get static (Compile-time) information about the type.
+ *
+ * A type (and all of its type parameters) lives in an single AppDomain and becomes
+ * invalid once the containing ICorDebugAppDomain is unloaded.
+ *
+ * Types may be lazily loaded, so if the debugger queries for a type that hasn't been
+ * loaded yet, it may be unavailable.
+ */
+[
+ object,
+ local,
+ uuid(D613F0BB-ACE1-4c19-BD72-E4C08D5DA7F5),
+ pointer_default(unique)
+]
+interface ICorDebugType : IUnknown
+{
+ /*
+ * GetType gets the basic type of the generic parameter. This can be used to
+ * determine if it is necessary to call GetClass to find the full information for the
+ * generic type parameter.
+ */
+ HRESULT GetType([out] CorElementType *ty);
+
+ /*
+ * GetClass is used if the CorElementType returned by GetType is ELEMENT_TYPE_CLASS,
+ * ELEMENT_TYPE_VALUETYPE. If the type is a constructed type, e.g. List<String>,
+ * then this will return the ICorDebugClass for the type constructor, i.e. "List<T>".
+ *
+ * GetClass should not be used if the element type is anything other than these two element
+ * types. In particular, it may not be used if the element type is ELEMENT_TYPE_STRING.
+ */
+ HRESULT GetClass([out] ICorDebugClass **ppClass);
+
+ /*
+ * EnumerateTypeParameters may be used if the CorElementType
+ * returned by GetType is one of ELEMENT_TYPE_CLASS,
+ * ELEMENT_TYPE_VALUETYPE, ELEMENT_TYPE_ARRAY, ELEMENT_TYPE_SZARRAY,
+ * ELEMENT_TYPE_BYREF, ELEMENT_TYPE_PTR or ELEMENT_TYPE_FNPTR.
+ * It returns the parameters specifying further information about
+ * the type. For example, if the type is "class Dict<String,int32>"
+ * then EnumerateTypeParameters will return "String" and "int32"
+ * in sequence.
+ *
+ */
+ HRESULT EnumerateTypeParameters([out] ICorDebugTypeEnum **ppTyParEnum);
+
+ /*
+ * GetFirstTypeParameter can be used in those cases where the further
+ * information about the type involves at most one type
+ * parameter. You can determine this from the element type returned by
+ * GetType. In particular it may be used with
+ * ELEMENT_TYPE_ARRAY, ELEMENT_TYPE_SZARRAY, ELEMENT_TYPE_BYREF
+ * or ELEMENT_TYPE_PTR.
+ * This can only be called if the type does indeed have a type-parameter.
+ */
+ HRESULT GetFirstTypeParameter([out] ICorDebugType **value);
+
+ /*
+ * GetBase returns the ICorDebugType object for the base type of this type, if it
+ * has one, i.e. if the type is a class type.
+ * For example, if
+ * class MyStringDict<T> : Dict<String,T>
+ * then the base type of "MyStringDict<int32>" will be "Dict<String,int32>".
+ *
+ * This is a helper function - you could compute this from EnumerateTypeParemeters,
+ * GetClass and the relevant metadata, but it is relatively painful: you would
+ * have to lookup the class, then the metadata of that class
+ * to find the "generic" base type, then instantiate this generic base type by
+ * looking up the type paramaters to the initial type,
+ * and then perform the appropriate instantiation in the case where the class
+ * happens to be either a generic class or a normal class with a constructed type
+ * as its parent. Looking up the base types is useful to implement common
+ * debugger functionality, e.g. printing out all the fields of an object, including its
+ * superclasses.
+ *
+ */
+
+ HRESULT GetBase([out] ICorDebugType **pBase);
+
+ /*
+ * GetStaticFieldValue returns a value object (ICorDebugValue)
+ * for the given static field variable. For non-parameterized
+ * types, this is identical to calling GetStaticFieldValue on the
+ * ICorDebugClass object returned by ICorDebugType::GetClass.
+ * For parameterized types a static field value will be relative to a
+ * particular instantiation. If in addition the static field could
+ * possibly be relative to either a thread, context, or appdomain, then pFrame
+ * will help the debugger determine the proper value.
+ *
+ * This may only be used when ICorDebugType::GetType returns
+ * ELEMENT_TYPE_CLASS or ELEMENT_TYPE_VALUETYPE.
+ */
+ HRESULT GetStaticFieldValue([in] mdFieldDef fieldDef,
+ [in] ICorDebugFrame *pFrame,
+ [out] ICorDebugValue **ppValue);
+
+
+ /*
+ * GetRank returns the number of dimensions in an array type
+ */
+
+ HRESULT GetRank([out] ULONG32 *pnRank);
+
+};
+
+
+/* ------------------------------------------------------------------------- *
+ * DEPRECATED
+ *
+ * ICorDebugErrorInfoEnum interface
+ *
+ * ------------------------------------------------------------------------- */
+[
+ object,
+ local,
+ uuid(F0E18809-72B5-11d2-976F-00A0C9B4D50C),
+ pointer_default(unique)
+]
+interface ICorDebugErrorInfoEnum : ICorDebugEnum
+{
+ /*
+ * DEPRECATED
+ */
+ HRESULT Next([in] ULONG celt,
+ [out, size_is(celt), length_is(*pceltFetched)]
+ ICorDebugEditAndContinueErrorInfo *errors[],
+ [out] ULONG *pceltFetched);
+};
+
+/* ------------------------------------------------------------------------- *
+ * AppDomainEnum interface
+ * ------------------------------------------------------------------------- */
+
+[
+ object,
+ local,
+ uuid(63ca1b24-4359-4883-bd57-13f815f58744),
+ pointer_default(unique)
+]
+
+interface ICorDebugAppDomainEnum : ICorDebugEnum
+{
+ /*
+ * Gets the next "celt" app domains in the enumeration
+ */
+ HRESULT Next([in] ULONG celt,
+ [out, size_is(celt), length_is(*pceltFetched)]
+ ICorDebugAppDomain *values[],
+ [out] ULONG *pceltFetched);
+
+};
+
+
+/* ------------------------------------------------------------------------- *
+ * AssemblyEnum interface
+ * ------------------------------------------------------------------------- */
+
+[
+ object,
+ local,
+ uuid(4a2a1ec9-85ec-4bfb-9f15-a89fdfe0fe83),
+ pointer_default(unique)
+]
+
+interface ICorDebugAssemblyEnum : ICorDebugEnum
+{
+ /*
+ * Gets the next "celt" assemblies in the enumeration
+ */
+ HRESULT Next([in] ULONG celt,
+ [out, size_is(celt), length_is(*pceltFetched)]
+ ICorDebugAssembly *values[],
+ [out] ULONG *pceltFetched);
+
+};
+
+/* ------------------------------------------------------------------------- *
+ * BlockingObjectEnum interface
+ * ------------------------------------------------------------------------- */
+
+[
+ object,
+ local,
+ uuid(976A6278-134A-4a81-81A3-8F277943F4C3),
+ pointer_default(unique)
+]
+
+interface ICorDebugBlockingObjectEnum : ICorDebugEnum
+{
+ /*
+ * Gets the next "celt" blocking objects in the enumeration
+ */
+ HRESULT Next([in] ULONG celt,
+ [out, size_is(celt), length_is(*pceltFetched)]
+ CorDebugBlockingObject values[],
+ [out] ULONG *pceltFetched);
+
+};
+
+
+#pragma warning(push)
+#pragma warning(disable:28718)
+// Represent data for an Managed Debugging Assistant (MDA) notification. See the MDA documentation for MDA-specific information like:
+// - enabling / disabling MDAs
+// - MDA naming conventions
+// - What the contents of an MDA look like, schemas, etc.
+[
+ object,
+ local,
+ uuid(CC726F2F-1DB7-459b-B0EC-05F01D841B42),
+ pointer_default(unique)
+]
+interface ICorDebugMDA : IUnknown
+{
+ // Get the string for the type of the MDA. Never empty.
+ // This is a convenient performant alternative to getting the XML stream and extracting
+ // the type from that based off the schema.
+ HRESULT GetName(
+ [in] ULONG32 cchName,
+ [out] ULONG32 * pcchName,
+ [out, size_is(cchName), length_is(*pcchName)] WCHAR szName[]);
+
+ // Get a string description of the MDA. This may be empty (0-length).
+ HRESULT GetDescription(
+ [in] ULONG32 cchName,
+ [out] ULONG32 * pcchName,
+ [out, size_is(cchName), length_is(*pcchName)] WCHAR szName[]);
+
+ // Get the full associated XML for the MDA. This may be empty.
+ // This could be a potentially expensive operation if the xml stream is large.
+ // See the MDA documentation for the schema for this XML stream.
+ HRESULT GetXML(
+ [in] ULONG32 cchName,
+ [out] ULONG32 * pcchName,
+ [out, size_is(cchName), length_is(*pcchName)] WCHAR szName[]);
+
+ // Get the flags associated w/ the MDA. New flags may be added in future versions.
+ typedef enum CorDebugMDAFlags
+ {
+ // If this flag is high, then the thread may have slipped since the MDA was fired.
+ MDA_FLAG_SLIP = 0x2
+ } CorDebugMDAFlags;
+ HRESULT GetFlags([in] CorDebugMDAFlags * pFlags);
+
+ // Thread that the MDA is fired on. We use the os tid instead of an ICDThread in case an MDA is fired on a
+ // native thread (or a managed thread that hasn't yet entered managed code and so we don't have a ICDThread
+ // object for it yet)
+ HRESULT GetOSThreadId([out] DWORD * pOsTid);
+};
+#pragma warning(pop)
+
+/* ------------------------------------------------------------------------- *
+ * Edit and Continue interfaces
+ * DEPRECATED
+ * ------------------------------------------------------------------------- */
+#pragma warning(push)
+#pragma warning(disable:28718) /* suppress warning 28718 for interface ICorDebugEditAndContinueErrorInfo */
+/*
+ * DEPRECATED
+ *
+ * ICorDebugEditAndContinueErrorInfo
+ *
+ */
+[
+ object,
+ local,
+ uuid(8D600D41-F4F6-4cb3-B7EC-7BD164944036),
+ pointer_default(unique)
+]
+interface ICorDebugEditAndContinueErrorInfo : IUnknown
+{
+ /*
+ * DEPRECATED
+ */
+ HRESULT GetModule([out] ICorDebugModule **ppModule);
+
+ /*
+ * DEPRECATED
+ */
+ HRESULT GetToken([out]mdToken *pToken);
+
+ /*
+ * DEPRECATED
+ */
+ HRESULT GetErrorCode([out]HRESULT *pHr);
+
+ /*
+ * DEPRECATED
+ */
+ HRESULT GetString([in] ULONG32 cchString,
+ [out] ULONG32 *pcchString,
+ [out, size_is(cchString),
+ length_is(*pcchString)] WCHAR szString[]);
+}
+#pragma warning(pop)
+
+/*
+ * DEPRECATED
+ *
+ * ICorDebugEditAndContinueSnapshot
+ */
+
+[
+ object,
+ local,
+ uuid(6DC3FA01-D7CB-11d2-8A95-0080C792E5D8),
+ pointer_default(unique)
+]
+interface ICorDebugEditAndContinueSnapshot : IUnknown
+{
+ /*
+ * DEPRECATED
+ */
+ HRESULT CopyMetaData([in] IStream *pIStream, [out] GUID *pMvid);
+
+ /*
+ * DEPRECATED
+ */
+ HRESULT GetMvid([out] GUID *pMvid);
+
+ /*
+ * DEPRECATED
+ */
+ HRESULT GetRoDataRVA([out] ULONG32 *pRoDataRVA);
+
+ /*
+ * DEPRECATED
+ */
+ HRESULT GetRwDataRVA([out] ULONG32 *pRwDataRVA);
+
+
+ /*
+ * DEPRECATED
+ */
+ HRESULT SetPEBytes([in] IStream *pIStream);
+
+ /*
+ * DEPRECATED
+ */
+ HRESULT SetILMap([in] mdToken mdFunction, [in] ULONG cMapSize,
+ [in, size_is(cMapSize)] COR_IL_MAP map[]);
+
+ /*
+ * DEPRECATED
+ */
+ HRESULT SetPESymbolBytes([in] IStream *pIStream);
+};
+
+[
+ object,
+ local,
+ uuid(ED775530-4DC4-41F7-86D0-9E2DEF7DFC66),
+ pointer_default(unique)
+]
+interface ICorDebugExceptionObjectCallStackEnum : ICorDebugEnum
+{
+ /*
+ * Gets the next "celt" number of frames in the enumeration.
+ * The actual number of frames retrieved is returned in "pceltFetched".
+ * Returns S_FALSE if the actual number of frames retrieved is smaller
+ * than the number of frames requested.
+ */
+ HRESULT Next([in] ULONG celt,
+ [out, size_is(celt), length_is(*pceltFetched)]
+ CorDebugExceptionObjectStackFrame values[],
+ [out] ULONG* pceltFetched);
+};
+
+[
+ object,
+ local,
+ uuid(AE4CA65D-59DD-42A2-83A5-57E8A08D8719),
+ pointer_default(unique)
+]
+interface ICorDebugExceptionObjectValue : IUnknown
+{
+ HRESULT EnumerateExceptionCallStack([out] ICorDebugExceptionObjectCallStackEnum** ppCallStackEnum);
+};
+
+/* ------------------------------------------------------------------------- *
+ * Library definition
+ * ------------------------------------------------------------------------- */
+
+[
+ uuid(53D13620-F417-11d1-9762-A63826A4F255),
+ version(1.0),
+ helpstring("Common Language Runtime Debugging 1.0 Type Library")
+]
+library CORDBLib
+{
+ importlib("stdole32.tlb");
+
+ // There should be no co-class for V2.0 CorDebug at all.
+ // Clients should create the ICorDebug object using the shim API
+ // CreateDebuggerInterfaceFromVersion defined in mscoree.idl.
+ // This guid here is the same as the v1.1 guid for setup / breaking-change purposes.
+ [
+ uuid(6fef44d0-39e7-4c77-be8e-c9f8cf988630)
+ ]
+ coclass CorDebug
+ {
+ [default] interface ICorDebug;
+ };
+
+ [
+ uuid(211f1254-bc7e-4af5-b9aa-067308d83dd1)
+ ]
+ coclass EmbeddedCLRCorDebug
+ {
+ [default] interface ICorDebug;
+ };
+
+ interface ICorDebugReferenceValue;
+ interface ICorDebugStringValue;
+ interface ICorDebugGenericValue;
+ interface ICorDebugBoxValue;
+ interface ICorDebugArrayValue;
+ interface ICorDebugILFrame;
+ interface ICorDebugInternalFrame;
+ interface ICorDebugInternalFrame2;
+ interface ICorDebugNativeFrame;
+ interface ICorDebugNativeFrame2;
+ interface ICorDebugRuntimeUnwindableFrame;
+
+ interface ICorDebugManagedCallback2;
+ interface ICorDebugAppDomain2;
+ interface ICorDebugAppDomain3;
+ interface ICorDebugAssembly2;
+ interface ICorDebugProcess2 ;
+ interface ICorDebugStepper2 ;
+ interface ICorDebugThread2 ;
+ interface ICorDebugThread3 ;
+ interface ICorDebugILFrame2;
+ interface ICorDebugModule2 ;
+ interface ICorDebugFunction2;
+ interface ICorDebugClass2 ;
+ interface ICorDebugEval2 ;
+ interface ICorDebugValue2;
+ interface ICorDebugObjectValue2;
+ interface ICorDebugHandleValue;
+ interface ICorDebugHeapValue2;
+ interface ICorDebugComObjectValue;
+
+ interface ICorDebugModule3;
+};
diff --git a/src/inc/cordebug_mktlb.rc b/src/inc/cordebug_mktlb.rc
new file mode 100644
index 0000000000..58e83bc64e
--- /dev/null
+++ b/src/inc/cordebug_mktlb.rc
@@ -0,0 +1,11 @@
+// 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.
+
+#define FX_VER_FILEDESCRIPTION_STR "Microsoft .NET Runtime Debugging Interfaces\0"
+#define FX_VER_INTERNALNAME_STR CORDEBUG.IDL
+
+#include <fxver.h>
+#include <fxver.rc>
+
+1 typelib REAL_CORDEBUG_TLB_FILE
diff --git a/src/inc/cordebuginfo.h b/src/inc/cordebuginfo.h
new file mode 100644
index 0000000000..b065c5fc06
--- /dev/null
+++ b/src/inc/cordebuginfo.h
@@ -0,0 +1,323 @@
+// 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.
+
+/**********************************************************************************/
+// DebugInfo types shared by JIT-EE interface and EE-Debugger interface
+
+class ICorDebugInfo
+{
+public:
+ /*----------------------------- Boundary-info ---------------------------*/
+
+ enum MappingTypes
+ {
+ NO_MAPPING = -1,
+ PROLOG = -2,
+ EPILOG = -3,
+ MAX_MAPPING_VALUE = -3 // Sentinal value. This should be set to the largest magnitude value in the enum
+ // so that the compression routines know the enum's range.
+ };
+
+ enum BoundaryTypes
+ {
+ NO_BOUNDARIES = 0x00, // No implicit boundaries
+ STACK_EMPTY_BOUNDARIES = 0x01, // Boundary whenever the IL evaluation stack is empty
+ NOP_BOUNDARIES = 0x02, // Before every CEE_NOP instruction
+ CALL_SITE_BOUNDARIES = 0x04, // Before every CEE_CALL, CEE_CALLVIRT, etc instruction
+
+ // Set of boundaries that debugger should always reasonably ask the JIT for.
+ DEFAULT_BOUNDARIES = STACK_EMPTY_BOUNDARIES | NOP_BOUNDARIES | CALL_SITE_BOUNDARIES
+ };
+
+ // Note that SourceTypes can be OR'd together - it's possible that
+ // a sequence point will also be a stack_empty point, and/or a call site.
+ // The debugger will check to see if a boundary offset's source field &
+ // SEQUENCE_POINT is true to determine if the boundary is a sequence point.
+
+ enum SourceTypes
+ {
+ SOURCE_TYPE_INVALID = 0x00, // To indicate that nothing else applies
+ SEQUENCE_POINT = 0x01, // The debugger asked for it.
+ STACK_EMPTY = 0x02, // The stack is empty here
+ CALL_SITE = 0x04, // This is a call site.
+ NATIVE_END_OFFSET_UNKNOWN = 0x08, // Indicates a epilog endpoint
+ CALL_INSTRUCTION = 0x10 // The actual instruction of a call.
+
+ };
+
+ struct OffsetMapping
+ {
+ DWORD nativeOffset;
+ DWORD ilOffset;
+ SourceTypes source; // The debugger needs this so that
+ // we don't put Edit and Continue breakpoints where
+ // the stack isn't empty. We can put regular breakpoints
+ // there, though, so we need a way to discriminate
+ // between offsets.
+ };
+
+ /*------------------------------ Var-info -------------------------------*/
+
+ // Note: The debugger needs to target register numbers on platforms other than which the debugger itself
+ // is running. To this end it maintains its own values for REGNUM_SP and REGNUM_AMBIENT_SP across multiple
+ // platforms. So any change here that may effect these values should be reflected in the definitions
+ // contained in debug/inc/DbgIPCEvents.h.
+ enum RegNum
+ {
+#ifdef _TARGET_X86_
+ REGNUM_EAX,
+ REGNUM_ECX,
+ REGNUM_EDX,
+ REGNUM_EBX,
+ REGNUM_ESP,
+ REGNUM_EBP,
+ REGNUM_ESI,
+ REGNUM_EDI,
+#elif _TARGET_ARM_
+ REGNUM_R0,
+ REGNUM_R1,
+ REGNUM_R2,
+ REGNUM_R3,
+ REGNUM_R4,
+ REGNUM_R5,
+ REGNUM_R6,
+ REGNUM_R7,
+ REGNUM_R8,
+ REGNUM_R9,
+ REGNUM_R10,
+ REGNUM_R11,
+ REGNUM_R12,
+ REGNUM_SP,
+ REGNUM_LR,
+ REGNUM_PC,
+#elif _TARGET_ARM64_
+ REGNUM_X0,
+ REGNUM_X1,
+ REGNUM_X2,
+ REGNUM_X3,
+ REGNUM_X4,
+ REGNUM_X5,
+ REGNUM_X6,
+ REGNUM_X7,
+ REGNUM_X8,
+ REGNUM_X9,
+ REGNUM_X10,
+ REGNUM_X11,
+ REGNUM_X12,
+ REGNUM_X13,
+ REGNUM_X14,
+ REGNUM_X15,
+ REGNUM_X16,
+ REGNUM_X17,
+ REGNUM_X18,
+ REGNUM_X19,
+ REGNUM_X20,
+ REGNUM_X21,
+ REGNUM_X22,
+ REGNUM_X23,
+ REGNUM_X24,
+ REGNUM_X25,
+ REGNUM_X26,
+ REGNUM_X27,
+ REGNUM_X28,
+ REGNUM_FP,
+ REGNUM_LR,
+ REGNUM_SP,
+ REGNUM_PC,
+#elif _TARGET_AMD64_
+ REGNUM_RAX,
+ REGNUM_RCX,
+ REGNUM_RDX,
+ REGNUM_RBX,
+ REGNUM_RSP,
+ REGNUM_RBP,
+ REGNUM_RSI,
+ REGNUM_RDI,
+ REGNUM_R8,
+ REGNUM_R9,
+ REGNUM_R10,
+ REGNUM_R11,
+ REGNUM_R12,
+ REGNUM_R13,
+ REGNUM_R14,
+ REGNUM_R15,
+#else
+ PORTABILITY_WARNING("Register numbers not defined on this platform")
+#endif
+ REGNUM_COUNT,
+ REGNUM_AMBIENT_SP, // ambient SP support. Ambient SP is the original SP in the non-BP based frame.
+ // Ambient SP should not change even if there are push/pop operations in the method.
+
+#ifdef _TARGET_X86_
+ REGNUM_FP = REGNUM_EBP,
+ REGNUM_SP = REGNUM_ESP,
+#elif _TARGET_AMD64_
+ REGNUM_SP = REGNUM_RSP,
+#elif _TARGET_ARM_
+#ifdef REDHAWK
+ REGNUM_FP = REGNUM_R7,
+#else
+ REGNUM_FP = REGNUM_R11,
+#endif //REDHAWK
+#elif _TARGET_ARM64_
+ //Nothing to do here. FP is already alloted.
+#else
+ // RegNum values should be properly defined for this platform
+ REGNUM_FP = 0,
+ REGNUM_SP = 1,
+#endif
+
+ };
+
+ // VarLoc describes the location of a native variable. Note that currently, VLT_REG_BYREF and VLT_STK_BYREF
+ // are only used for value types on X64.
+
+ enum VarLocType
+ {
+ VLT_REG, // variable is in a register
+ VLT_REG_BYREF, // address of the variable is in a register
+ VLT_REG_FP, // variable is in an fp register
+ VLT_STK, // variable is on the stack (memory addressed relative to the frame-pointer)
+ VLT_STK_BYREF, // address of the variable is on the stack (memory addressed relative to the frame-pointer)
+ VLT_REG_REG, // variable lives in two registers
+ VLT_REG_STK, // variable lives partly in a register and partly on the stack
+ VLT_STK_REG, // reverse of VLT_REG_STK
+ VLT_STK2, // variable lives in two slots on the stack
+ VLT_FPSTK, // variable lives on the floating-point stack
+ VLT_FIXED_VA, // variable is a fixed argument in a varargs function (relative to VARARGS_HANDLE)
+
+ VLT_COUNT,
+ VLT_INVALID,
+ };
+
+ struct VarLoc
+ {
+ VarLocType vlType;
+
+ union
+ {
+ // VLT_REG/VLT_REG_FP -- Any pointer-sized enregistered value (TYP_INT, TYP_REF, etc)
+ // eg. EAX
+ // VLT_REG_BYREF -- the specified register contains the address of the variable
+ // eg. [EAX]
+
+ struct
+ {
+ RegNum vlrReg;
+ } vlReg;
+
+ // VLT_STK -- Any 32 bit value which is on the stack
+ // eg. [ESP+0x20], or [EBP-0x28]
+ // VLT_STK_BYREF -- the specified stack location contains the address of the variable
+ // eg. mov EAX, [ESP+0x20]; [EAX]
+
+ struct
+ {
+ RegNum vlsBaseReg;
+ signed vlsOffset;
+ } vlStk;
+
+ // VLT_REG_REG -- TYP_LONG with both DWords enregistred
+ // eg. RBM_EAXEDX
+
+ struct
+ {
+ RegNum vlrrReg1;
+ RegNum vlrrReg2;
+ } vlRegReg;
+
+ // VLT_REG_STK -- Partly enregistered TYP_LONG
+ // eg { LowerDWord=EAX UpperDWord=[ESP+0x8] }
+
+ struct
+ {
+ RegNum vlrsReg;
+ struct
+ {
+ RegNum vlrssBaseReg;
+ signed vlrssOffset;
+ } vlrsStk;
+ } vlRegStk;
+
+ // VLT_STK_REG -- Partly enregistered TYP_LONG
+ // eg { LowerDWord=[ESP+0x8] UpperDWord=EAX }
+
+ struct
+ {
+ struct
+ {
+ RegNum vlsrsBaseReg;
+ signed vlsrsOffset;
+ } vlsrStk;
+ RegNum vlsrReg;
+ } vlStkReg;
+
+ // VLT_STK2 -- Any 64 bit value which is on the stack,
+ // in 2 successsive DWords.
+ // eg 2 DWords at [ESP+0x10]
+
+ struct
+ {
+ RegNum vls2BaseReg;
+ signed vls2Offset;
+ } vlStk2;
+
+ // VLT_FPSTK -- enregisterd TYP_DOUBLE (on the FP stack)
+ // eg. ST(3). Actually it is ST("FPstkHeigth - vpFpStk")
+
+ struct
+ {
+ unsigned vlfReg;
+ } vlFPstk;
+
+ // VLT_FIXED_VA -- fixed argument of a varargs function.
+ // The argument location depends on the size of the variable
+ // arguments (...). Inspecting the VARARGS_HANDLE indicates the
+ // location of the first arg. This argument can then be accessed
+ // relative to the position of the first arg
+
+ struct
+ {
+ unsigned vlfvOffset;
+ } vlFixedVarArg;
+
+ // VLT_MEMORY
+
+ struct
+ {
+ void *rpValue; // pointer to the in-process
+ // location of the value.
+ } vlMemory;
+ };
+ };
+
+ // This is used to report implicit/hidden arguments
+
+ enum
+ {
+ VARARGS_HND_ILNUM = -1, // Value for the CORINFO_VARARGS_HANDLE varNumber
+ RETBUF_ILNUM = -2, // Pointer to the return-buffer
+ TYPECTXT_ILNUM = -3, // ParamTypeArg for CORINFO_GENERICS_CTXT_FROM_PARAMTYPEARG
+
+ UNKNOWN_ILNUM = -4, // Unknown variable
+
+ MAX_ILNUM = -4 // Sentinal value. This should be set to the largest magnitude value in th enum
+ // so that the compression routines know the enum's range.
+ };
+
+ struct ILVarInfo
+ {
+ DWORD startOffset;
+ DWORD endOffset;
+ DWORD varNumber;
+ };
+
+ struct NativeVarInfo
+ {
+ DWORD startOffset;
+ DWORD endOffset;
+ DWORD varNumber;
+ VarLoc loc;
+ };
+};
diff --git a/src/inc/coredistools.h b/src/inc/coredistools.h
new file mode 100644
index 0000000000..c73b2f7048
--- /dev/null
+++ b/src/inc/coredistools.h
@@ -0,0 +1,142 @@
+// 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.
+
+//===--------- coredistools.h - Dissassembly tools for CoreClr ------------===//
+//
+// Core Disassembly Tools API Version 1.0.1-prerelease
+// Disassembly tools required by CoreCLR for utilities like
+// GCStress and SuperPMI
+//===----------------------------------------------------------------------===//
+
+#if !defined(_COREDISTOOLS_H_)
+#define _COREDISTOOLS_H_
+
+#include <stdint.h>
+
+#if defined(__cplusplus)
+#define EXTERN_C extern "C"
+#else
+#define EXTERN_C
+#endif // defined(__cplusplus)
+
+#if defined(_MSC_VER)
+#if defined(DllInterfaceExporter)
+#define DllIface EXTERN_C __declspec(dllexport)
+#else
+#define DllIface EXTERN_C __declspec(dllimport)
+#endif // defined(DllInterfaceExporter)
+#else
+#define DllIface EXTERN_C
+#endif // defined(_MSC_VER)
+
+enum TargetArch {
+ Target_Host, // Target is the same as host architecture
+ Target_X86,
+ Target_X64,
+ Target_Thumb,
+ Target_Arm64
+};
+
+struct CorDisasm;
+struct CorAsmDiff;
+
+// The custom print functionality to be provide by the
+// users of this Library
+typedef void(__cdecl *Printer)(const char *msg, ...);
+struct PrintControl {
+ const Printer Error;
+ const Printer Warning;
+ const Printer Log;
+ const Printer Dump;
+};
+
+// The type of a custom function provided by the user to determine
+// if two offsets are considered equivalent wrt diffing code blocks.
+// Offset1 and Offset2 are the two offsets to be compared.
+// BlockOffset is the offest of the instructions (that contain Offset1
+// and Offset2) from the beginning of their respective code blocks.
+// InstructionLength is the length of the current instruction being
+// compared for equivalency.
+typedef bool(__cdecl *OffsetComparator)(const void *UserData, size_t BlockOffset,
+ size_t InstructionLength, uint64_t Offset1,
+ uint64_t Offset2);
+
+// The Export/Import definitions for CoreDistools library are defined below.
+// A typedef for each interface function's type is defined in order to aid
+// the importer.
+
+// Initialize the disassembler, using default print controls
+typedef CorDisasm * __cdecl InitDisasm_t(enum TargetArch Target);
+DllIface InitDisasm_t InitDisasm;
+
+// Initialize the disassembler using custom print controls
+typedef CorDisasm * __cdecl NewDisasm_t(enum TargetArch Target,
+ const PrintControl *PControl);
+DllIface NewDisasm_t NewDisasm;
+
+// Delete the disassembler
+typedef void __cdecl FinishDisasm_t(const CorDisasm *Disasm);
+DllIface FinishDisasm_t FinishDisasm;
+
+// DisasmInstruction -- Disassemble one instruction
+// Arguments:
+// Disasm -- The Disassembler
+// Address -- The address at which the bytes of the instruction
+// are intended to execute
+// Bytes -- Pointer to the actual bytes which need to be disassembled
+// MaxLength -- Number of bytes available in Bytes buffer
+// Returns:
+// -- The Size of the disassembled instruction
+// -- Zero on failure
+typedef size_t __cdecl DisasmInstruction_t(const CorDisasm *Disasm,
+ const uint8_t *Address,
+ const uint8_t *Bytes, size_t Maxlength);
+DllIface DisasmInstruction_t DisasmInstruction;
+
+// Initialize the Code Differ
+typedef CorAsmDiff * __cdecl NewDiffer_t(enum TargetArch Target,
+ const PrintControl *PControl,
+ const OffsetComparator Comparator);
+DllIface NewDiffer_t NewDiffer;
+
+// Delete the Code Differ
+typedef void __cdecl FinishDiff_t(const CorAsmDiff *AsmDiff);
+DllIface FinishDiff_t FinishDiff;
+
+// NearDiffCodeBlocks -- Compare two code blocks for semantic
+// equivalence
+// Arguments:
+// AsmDiff -- The Asm-differ
+// UserData -- Any data the user wishes to pass through into
+// the OffsetComparator
+// Address1 -- Address at which first block will execute
+// Bytes1 -- Pointer to the actual bytes of the first block
+// Size1 -- The size of the first block
+// Address2 -- Address at which second block will execute
+// Bytes2 -- Pointer to the actual bytes of the second block
+// Size2 -- The size of the second block
+// Returns:
+// -- true if the two blocks are equivalent, false if not.
+typedef bool __cdecl NearDiffCodeBlocks_t(const CorAsmDiff *AsmDiff,
+ const void *UserData,
+ const uint8_t *Address1,
+ const uint8_t *Bytes1, size_t Size1,
+ const uint8_t *Address2,
+ const uint8_t *Bytes2, size_t Size2);
+DllIface NearDiffCodeBlocks_t NearDiffCodeBlocks;
+
+// Print a code block according to the Disassembler's Print Controls
+typedef void __cdecl DumpCodeBlock_t(const CorDisasm *Disasm, const uint8_t *Address,
+ const uint8_t *Bytes, size_t Size);
+DllIface DumpCodeBlock_t DumpCodeBlock;
+
+// Print the two code blocks being diffed, according to
+// AsmDiff's PrintControls.
+typedef void __cdecl DumpDiffBlocks_t(const CorAsmDiff *AsmDiff,
+ const uint8_t *Address1, const uint8_t *Bytes1,
+ size_t Size1, const uint8_t *Address2,
+ const uint8_t *Bytes2, size_t Size2);
+DllIface DumpDiffBlocks_t DumpDiffBlocks;
+
+#endif // !defined(_COREDISTOOLS_H_)
diff --git a/src/inc/coregen.h b/src/inc/coregen.h
new file mode 100644
index 0000000000..5ca7334e92
--- /dev/null
+++ b/src/inc/coregen.h
@@ -0,0 +1,22 @@
+// 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.
+//
+// ngencommon.h - cross-compilation enablement structures.
+//
+
+
+
+#ifndef _NGENCOMMON_H_
+#define _NGENCOMMON_H_
+
+#define NGENWORKER_FLAGS_TUNING 0x0001
+#define NGENWORKER_FLAGS_APPCOMPATWP8 0x0002
+#define NGENWORKER_FLAGS_MISSINGDEPENDENCIESOK 0x0004
+#define NGENWORKER_FLAGS_FULLTRUSTDOMAIN 0x0008
+
+#define NGENWORKER_FLAGS_WINMD_RESILIENT 0x1000
+#define NGENWORKER_FLAGS_READYTORUN 0x2000
+#define NGENWORKER_FLAGS_NO_METADATA 0x4000
+
+#endif // _NGENCOMMON_H_
diff --git a/src/inc/corerror.xml b/src/inc/corerror.xml
new file mode 100644
index 0000000000..a859cfac5d
--- /dev/null
+++ b/src/inc/corerror.xml
@@ -0,0 +1,6993 @@
+<?xml version="1.0"?>
+<Root><xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
+ xmlns='xsdResources'
+ targetNamespace='xsdResources'>
+ <xs:element name="ResourceStrings">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element maxOccurs="unbounded" name="HRESULT">
+ <xs:complexType>
+ <xs:sequence>
+ <xs:element name="SymbolicName" type="xs:string" />
+ <xs:element minOccurs="0" name="Message" type="xs:string" />
+ <xs:element minOccurs="0" name="Comment" type="xs:string" />
+ </xs:sequence>
+ <xs:attribute name="NumericValue" type="xs:string" use="required" />
+ </xs:complexType>
+ </xs:element>
+ </xs:sequence>
+ </xs:complexType>
+ </xs:element>
+</xs:schema>
+
+<hc:ResourceStrings xmlns:hc="xsdResources">
+
+<!-- -->
+<!-- This XML file is used to generate the public header file corerror.h -->
+<!-- and resource file msgurt.rc. All new HRESULT declarations should be added to this XML. -->
+<!-- -->
+<!-- IMPORTANT***IMPORTANT***IMPORTANT -->
+<!-- -->
+<!-- All CLR errror codes should be in -->
+<!-- HRESULT NumericValue="0x......" format -->
+<!-- -->
+<!-- These HRESULTs are used for mapping managed exceptions to COM error codes -->
+<!-- and vice versa through COM Interop. For background on COM error codes see -->
+<!-- http://msdn.microsoft.com/library/default.asp?url=/library/en-us/com/error_9td2.asp. -->
+
+<!-- The range (0x8013xxxx) and (0x13xxxx) is reserved for the .NET Framework SDK teams. -->
+<!-- Within that range, the following subranges have been allocated for different feature areas: -->
+<!-- 0x10yy for Execution Engine -->
+<!-- 0x11yy for Metadata, TypeLib Export, and CLDB -->
+<!-- 0x12yy for MetaData Validator -->
+<!-- 0x13yy for Debugger and Profiler errors -->
+<!-- 0x14yy for Security -->
+<!-- 0x15yy for BCL-->
+<!-- 0x1600 - 0x161F for Reflection -->
+<!-- 0x1620 - 0x163F for System.IO -->
+<!-- 0x1640 - 0x165F for Security -->
+<!-- 0x1660 - 0x16FF for BCL -->
+<!-- 0x17yy for shim -->
+<!-- 0x18yy for IL Verifier -->
+<!-- 0x19yy for .NET Framework -->
+<!-- 0x1Ayy for .NET Framework -->
+<!-- 0x1Byy for MetaData Validator -->
+<!-- 0x1Cyy for more debugger errors -->
+<!-- 0x1Dyy for PE Format Validation -->
+<!-- 0x1Eyy for CLR Optimization Service errors -->
+<!-- 0x1Fyy for NGEN errors -->
+<!-- 0x30yy for VSA errors -->
+<!-- 0x31yy for NGEN errors -->
+<!-- 0x32yy for binder errors -->
+<!-- Base class library HRESULTs are copied from this file into many different -->
+<!-- files named __HResults.cs under the BCL directory. Frameworks HRESULTs are -->
+<!-- defined in src/main/HResults.cs. If you make any modifications to -->
+<!-- the range allocations described above, please make sure this xml file gets updated. -->
+<!-- -->
+
+
+<HRESULT NumericValue="0x131106">
+ <SymbolicName>CLDB_S_TRUNCATION</SymbolicName>
+ <Comment> STATUS: Data value was truncated. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x131109">
+ <SymbolicName>CLDB_S_NULL</SymbolicName>
+ <Comment> NULL data value. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x131125">
+ <SymbolicName>CLDB_S_INDEX_TABLESCANREQUIRED</SymbolicName>
+ <Comment> Table scan required to run query. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x13116c">
+ <SymbolicName>TLBX_I_TYPEINFO_IMPORTED</SymbolicName>
+ <Comment> Typelib import: progress report. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x13116d">
+ <SymbolicName>TLBX_I_PIA_REGISTERED_FOR_TLB</SymbolicName>
+ <Comment> Primary interop assembly '{0}' is already registered for type library '{1}'. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x13116e">
+ <SymbolicName>TLBX_I_AGNOSTIC_ASSEMBLY</SymbolicName>
+ <Comment> Importing a type library into a platform agnostic assembly. This can cause errors if the type library is not truly platform agnostic. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x13116f">
+ <SymbolicName>TLBX_I_USEIUNKNOWN</SymbolicName>
+ <Comment> Typelib export: substituted IUnknown for type. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x131170">
+ <SymbolicName>TLBX_I_UNCONVERTABLE_ARGS</SymbolicName>
+ <Comment> Typelib import: signature can't be converted (eg, struct**) </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x131171">
+ <SymbolicName>TLBX_I_UNCONVERTABLE_FIELD</SymbolicName>
+ <Comment> Typelib import: signature can't be converted (eg, struct**) </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x131173">
+ <SymbolicName>TLBX_W_WARNING_MESSAGE</SymbolicName>
+ <Comment> Typelib export: Warning message wrapper. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x131174">
+ <SymbolicName>TLBX_W_ASSEMBLY_HAS_EMBEDDED_TLB</SymbolicName>
+ <Comment> Type library is being exported for assembly '{0}' which already contains an embedded type library </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x131175">
+ <SymbolicName>TLBX_W_CROSS_COMPILE_NO_REFS</SymbolicName>
+ <Comment> When cross-compiling, all type library references should be included on the command line to ensure the correct bit-specific type libraries are loaded. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x131176">
+ <SymbolicName>TLBX_W_PURE_CROSS_COMPILE</SymbolicName>
+ <Comment> Performing cross-compile of 32-bit non-agnostic assembly to 64-bit type library or 64-bit non-agnostic assembly to 32-bit type library. This is dangerous as pointer sizes and processor dependence will likely cause incompatibility between the assembly and resultant type library. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x131179">
+ <SymbolicName>TLBX_I_TYPE_EXPORTED</SymbolicName>
+ <Comment> Typelib export: type exported </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x13117a">
+ <SymbolicName>TLBX_I_DUPLICATE_DISPID</SymbolicName>
+ <Comment> Typelib export: duplicate dispid -- auto corrected. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x13117c">
+ <SymbolicName>TLBX_I_REF_TYPE_AS_STRUCT</SymbolicName>
+ <Comment> Typelib export: reference type had layout, exported as struct. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x13117f">
+ <SymbolicName>TLBX_I_GENERIC_TYPE</SymbolicName>
+ <Comment> TypeLib export: generic type definition </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x131184">
+ <SymbolicName>TLBX_W_NON_INTEGRAL_CA_TYPE</SymbolicName>
+ <Comment> TypeLib import: Ignoring IDL custom attribute -- does not have an integral value. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x131185">
+ <SymbolicName>TLBX_W_IENUM_CA_ON_IUNK</SymbolicName>
+ <Comment> TypeLib import: Ignoring IDL custom attribute -- using IEnum CA on an IUnknown derived interface. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x131189">
+ <SymbolicName>META_S_PARAM_MISMATCH</SymbolicName>
+ <Comment> Merge: Parameter information mismatched. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x131197">
+ <SymbolicName>META_S_DUPLICATE</SymbolicName>
+ <Comment> Attempt to define an object that already exists in valid scenerios. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x1311ac">
+ <SymbolicName>TLBX_S_REFERENCED_TYPELIB</SymbolicName>
+ <Comment> TypeLib import: reference to an external typelib. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x1311b3">
+ <SymbolicName>TLBX_S_NOSTDINTERFACE</SymbolicName>
+ <Comment> Typelib export: Found an interface marked as IID_IDispatch or IID_IUnknown. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x1311b4">
+ <SymbolicName>TLBX_S_DUPLICATE_DISPID</SymbolicName>
+ <Comment> Typelib export: duplicate dispid found; ignored. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x1311d5">
+ <SymbolicName>TLBX_W_ENUM_VALUE_TOOBIG</SymbolicName>
+ <Comment> Typelib export: The enum value is not legal for a typelib. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x1311d9">
+ <SymbolicName>TLBX_W_EXPORTING_AUTO_LAYOUT</SymbolicName>
+ <Comment> TypeLib export: Exporting an auto-layout type. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x1311db">
+ <SymbolicName>TLBX_W_DEFAULT_INTF_NOT_VISIBLE</SymbolicName>
+ <Comment> TypeLib export: ComDefaultInterface is not COMVisible. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x1311de">
+ <SymbolicName>TLBX_W_BAD_SAFEARRAYFIELD_NO_ELEMENTVT</SymbolicName>
+ <Comment> TypeLib export: System.Array SAFEARRAY field without a SafeArraySubType. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x1311df">
+ <SymbolicName>TLBX_W_LAYOUTCLASS_AS_INTERFACE</SymbolicName>
+ <Comment> TypeLib export: Class with layout parameter of field marked with UnmanagedType.Interface </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x1311e0">
+ <SymbolicName>TLBX_I_GENERIC_BASE_TYPE</SymbolicName>
+ <Comment> TypeLib export: type deriving from a generic type. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x131200">
+ <SymbolicName>VLDTR_S_WRN</SymbolicName>
+ <Comment> Warnings found in the validator. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x131201">
+ <SymbolicName>VLDTR_S_ERR</SymbolicName>
+ <Comment> Errors found in the validator. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x131202">
+ <SymbolicName>VLDTR_S_WRNERR</SymbolicName>
+ <Comment> Warnings and errors found in the validator. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x13130b">
+ <SymbolicName>CORDBG_S_BAD_START_SEQUENCE_POINT</SymbolicName>
+ <Comment> Attempt to SetIP not at a sequence point sequence point. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x13130c">
+ <SymbolicName>CORDBG_S_BAD_END_SEQUENCE_POINT</SymbolicName>
+ <Comment> Attempt to SetIP when not going to a sequence point. If both this and CORDBG_E_BAD_START_SEQUENCE_POINT are true, only CORDBG_E_BAD_START_SEQUENCE_POINT will be reported.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x13130d">
+ <SymbolicName>CORDBG_S_INSUFFICIENT_INFO_FOR_SET_IP</SymbolicName>
+ <Comment> SetIP is possible, but the debugger doesn't have enough info to fix variable locations, GC refs, or anything else. Use at your own risk. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x131316">
+ <SymbolicName>CORDBG_S_FUNC_EVAL_HAS_NO_RESULT</SymbolicName>
+ <Comment> Some Func evals will lack a return value, </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x131317">
+ <SymbolicName>CORDBG_S_VALUE_POINTS_TO_VOID</SymbolicName>
+ <Comment> The Debugging API doesn't support dereferencing void pointers. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x131319">
+ <SymbolicName>CORDBG_S_FUNC_EVAL_ABORTED</SymbolicName>
+ <Comment> The func eval completed, but was aborted. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x131324">
+ <SymbolicName>CORDBG_S_AT_END_OF_STACK</SymbolicName>
+ <Message>"The stack walk has reached the end of the stack. There are no more frames to walk."</Message>
+ <Comment> The stack walk has reached the end of the stack. There are no more frames to walk. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x131c13">
+ <SymbolicName>CORDBG_S_NOT_ALL_BITS_SET</SymbolicName>
+ <Comment> Not all bits specified were successfully applied </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131000">
+ <SymbolicName>CEE_E_ENTRYPOINT</SymbolicName>
+ <Message>"Invalid entrypoint information."</Message>
+ <Comment> The entry point info is invalid. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131001">
+ <SymbolicName>CEE_E_CVTRES_NOT_FOUND</SymbolicName>
+ <Message>"cvtres.exe not found."</Message>
+ <Comment> cannot find cvtres.exe </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131010">
+ <SymbolicName>MSEE_E_LOADLIBFAILED</SymbolicName>
+ <Message>"Failed to delayload a library."</Message>
+ <Comment> Failed to delay load library %s (Win32 error: %d). </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131011">
+ <SymbolicName>MSEE_E_GETPROCFAILED</SymbolicName>
+ <Message>"Failed to get dll entrypoint."</Message>
+ <Comment> Failed to get entry point %s (Win32 error: %d). </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131012">
+ <SymbolicName>MSEE_E_MULTCOPIESLOADED</SymbolicName>
+ <Message>"Multiple copies of mscoree.dll have been loaded into the same process."</Message>
+ <Comment> Multiple copies of MSCOREE.dll have been loaded by the same process. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131013">
+ <SymbolicName>COR_E_TYPEUNLOADED</SymbolicName>
+ <Message>"Type has been unloaded."</Message>
+ <Comment> The type had been unloaded.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131014">
+ <SymbolicName>COR_E_APPDOMAINUNLOADED</SymbolicName>
+ <Message>"Attempted to access an unloaded appdomain."</Message>
+ <Comment> access unloaded appdomain </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131015">
+ <SymbolicName>COR_E_CANNOTUNLOADAPPDOMAIN</SymbolicName>
+ <Message>"Error while unloading appdomain."</Message>
+ <Comment> Error while unloading an appdomain </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131016">
+ <SymbolicName>MSEE_E_ASSEMBLYLOADINPROGRESS</SymbolicName>
+ <Message>"Assembly is still being loaded."</Message>
+ <Comment> Assembly is being currently being loaded </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131017">
+ <SymbolicName>MSEE_E_CANNOTCREATEAPPDOMAIN</SymbolicName>
+ <Message>"Attempt to create appdomain failed."</Message>
+ <Comment> Attempt to create appdomain failed </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131018">
+ <SymbolicName>COR_E_ASSEMBLYEXPECTED</SymbolicName>
+ <Message>"The module was expected to contain an assembly manifest."</Message>
+ <Comment> The module was expected to contain an assembly manifest.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131019">
+ <SymbolicName>COR_E_FIXUPSINEXE</SymbolicName>
+ <Message>"Attempt to load an unverifiable executable with fixups (IAT with more than 2 sections or a TLS section.)"</Message>
+ <Comment> Attempt to load an unverifiable exe with fixups (IAT with more than 2 sections or a TLS section) </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013101a">
+ <SymbolicName>COR_E_NO_LOADLIBRARY_ALLOWED</SymbolicName>
+ <Message>"Attempt to LoadLibrary a managed image in an improper way (only assemblies with EAT area allowed)."</Message>
+ <Comment> Attempt to LoadLibrary a managed image in an improper way (only assemblies with EAT's area allowed.) </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013101b">
+ <SymbolicName>COR_E_NEWER_RUNTIME</SymbolicName>
+ <Message>"This assembly is built by a runtime newer than the currently loaded runtime and cannot be loaded."</Message>
+ <Comment> The assembly is built by a runtime newer than the currently loaded runtime, and cannot be loaded. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013101c">
+ <SymbolicName>COR_E_CANNOT_SET_POLICY</SymbolicName>
+ <Message>"Cannot set security policy under MultiDomain after non-GAC assemblies have been loaded in appdomain."</Message>
+ <Comment> Unable to set app domain security policy after non-GAC domain neutral assemblies are loaded </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013101d">
+ <SymbolicName>COR_E_CANNOT_SPECIFY_EVIDENCE</SymbolicName>
+ <Message>"Cannot specify assembly evidence under MultiDomain after non-GAC assemblies with default evidence have been loaded in appdomain."</Message>
+ <Comment> Unable to use assembly evidence after non-GAC domain neutral assemblies are loaded </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013101e">
+ <SymbolicName>COR_E_MULTIMODULEASSEMBLIESDIALLOWED</SymbolicName>
+ <Message>"The module cannot be loaded because only single file assemblies are supported."</Message>
+ <Comment> The module cannot be loaded because only single file assemblies are supported. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131020">
+ <SymbolicName>HOST_E_DEADLOCK</SymbolicName>
+ <Message>"Host detected a deadlock on a blocking operation."</Message>
+ <Comment> Host detects deadlock on a blocking operation </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131021">
+ <SymbolicName>HOST_E_INTERRUPTED</SymbolicName>
+ <Message>"Host interrupted a wait."</Message>
+ <Comment> Host interrupts a wait, similar to APC </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131022">
+ <SymbolicName>HOST_E_INVALIDOPERATION</SymbolicName>
+ <Message>"Invalid operation."</Message>
+ <Comment> The operation is invalid </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131023">
+ <SymbolicName>HOST_E_CLRNOTAVAILABLE</SymbolicName>
+ <Message>"CLR has been disabled due to unrecoverable error."</Message>
+ <Comment> CLR has been disabled due to unrecoverable error </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131024">
+ <SymbolicName>HOST_E_TIMEOUT</SymbolicName>
+ <Message>"A wait has timed out."</Message>
+ <Comment> A wait times out </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131025">
+ <SymbolicName>HOST_E_NOT_OWNER</SymbolicName>
+ <Message>"The leave operation has been attempted on a synchronization primitive that is not owned by the current thread."</Message>
+ <Comment> </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131026">
+ <SymbolicName>HOST_E_ABANDONED</SymbolicName>
+ <Message>"An event has been abandoned."</Message>
+ <Comment> An event is abandoned </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131027">
+ <SymbolicName>HOST_E_EXITPROCESS_THREADABORT</SymbolicName>
+ <Message>"Process exited due to ThreadAbort escalation."</Message>
+ <Comment> ExitProcess due to ThreadAbort escalation </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131028">
+ <SymbolicName>HOST_E_EXITPROCESS_ADUNLOAD</SymbolicName>
+ <Message>"Process exited due to AD Unload escalation."</Message>
+ <Comment> ExitProcess due to AD Unload escalation </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131029">
+ <SymbolicName>HOST_E_EXITPROCESS_TIMEOUT</SymbolicName>
+ <Message>"Process exited due to Timeout escalation."</Message>
+ <Comment> ExitProcess due to Timeout escalation </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013102a">
+ <SymbolicName>HOST_E_EXITPROCESS_OUTOFMEMORY</SymbolicName>
+ <Message>"Process exited due to OutOfMemory escalation."</Message>
+ <Comment> ExitProcess due to OutOfMemory escalation </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013102b">
+ <SymbolicName>HOST_E_EXITPROCESS_STACKOVERFLOW</SymbolicName>
+ <Message>"Process exited due to StackOverflow escalation."</Message>
+ <Comment> ExitProcess due to StackOverflow escalation </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131039">
+ <SymbolicName>COR_E_MODULE_HASH_CHECK_FAILED</SymbolicName>
+ <Message>"The check of the module's hash failed."</Message>
+ <Comment> The check of the module's hash failed. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131040">
+ <SymbolicName>FUSION_E_REF_DEF_MISMATCH</SymbolicName>
+ <Message>"The located assembly's manifest definition does not match the assembly reference."</Message>
+ <Comment> The located assembly's manifest definition does not match the assembly reference. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131041">
+ <SymbolicName>FUSION_E_INVALID_PRIVATE_ASM_LOCATION</SymbolicName>
+ <Message>"The private assembly was located outside the appbase directory."</Message>
+ <Comment> The private assembly was located outside the appbase directory. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131042">
+ <SymbolicName>FUSION_E_ASM_MODULE_MISSING</SymbolicName>
+ <Message>"A module specified in the manifest was not found."</Message>
+ <Comment> A module specified in the manifest was not found. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131043">
+ <SymbolicName>FUSION_E_UNEXPECTED_MODULE_FOUND</SymbolicName>
+ <Message>"Modules which are not in the manifest were streamed in."</Message>
+ <Comment> Modules which are not in the manifest were streamed in. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131044">
+ <SymbolicName>FUSION_E_PRIVATE_ASM_DISALLOWED</SymbolicName>
+ <Message>"A strongly-named assembly is required."</Message>
+ <Comment> A strongly-named assembly is required. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131045">
+ <SymbolicName>FUSION_E_SIGNATURE_CHECK_FAILED</SymbolicName>
+ <Message>"Strong name signature could not be verified. The assembly may have been tampered with, or it was delay signed but not fully signed with the correct private key."</Message>
+ <Comment> The check of the signature failed. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131046">
+ <SymbolicName>FUSION_E_DATABASE_ERROR</SymbolicName>
+ <Message>"An unexpected error was encountered in the Assembly Cache database."</Message>
+ <Comment> An unexpected error was encountered in the Assembly Cache database. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131047">
+ <SymbolicName>FUSION_E_INVALID_NAME</SymbolicName>
+ <Message>"The given assembly name or codebase was invalid."</Message>
+ <Comment> The given assembly name or codebase was invalid. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131048">
+ <SymbolicName>FUSION_E_CODE_DOWNLOAD_DISABLED</SymbolicName>
+ <Message>"HTTP download of assemblies has been disabled for this appdomain."</Message>
+ <Comment> HTTP download of assemblies has been disabled for this appdomain. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131049">
+ <SymbolicName>FUSION_E_UNINSTALL_DISALLOWED</SymbolicName>
+ <Message>"Uninstall of given assembly is not allowed."</Message>
+ <Comment> Uninstall of given assembly is not allowed. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013104A">
+ <SymbolicName>CLR_E_APP_CONFIG_NOT_ALLOWED_IN_APPX_PROCESS</SymbolicName>
+ <Message>"Application configuration file not allowed in AppX process."</Message>
+ <Comment> Application configuration file not allowed in AppX process. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131050">
+ <SymbolicName>FUSION_E_HOST_GAC_ASM_MISMATCH</SymbolicName>
+ <Message>"Assembly in host store has a different signature than assembly in GAC."</Message>
+ <Comment> Assembly in host store has a different signature than assembly in GAC </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131051">
+ <SymbolicName>FUSION_E_LOADFROM_BLOCKED</SymbolicName>
+ <Message>"LoadFrom(), LoadFile(), Load(byte[]) and LoadModule() have been disabled by the host."</Message>
+ <Comment> Hosted environment doesn't permit loading by location </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131052">
+ <SymbolicName>FUSION_E_CACHEFILE_FAILED</SymbolicName>
+ <Message>"Failed to add file to AppDomain cache."</Message>
+ <Comment> Failed to add file to AppDomain cache </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131053">
+ <SymbolicName>FUSION_E_APP_DOMAIN_LOCKED</SymbolicName>
+ <Message>"The requested assembly version conflicts with what is already bound in the app domain or specified in the manifest."</Message>
+ <Comment> The requested assembly version conflicts with what is already bound in the app domain or specified in the manifest </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131054">
+ <SymbolicName>FUSION_E_CONFIGURATION_ERROR</SymbolicName>
+ <Message>"The requested assembly name was neither found in the GAC nor in the manifest or the manifest's specified location is wrong."</Message>
+ <Comment> The requested assembly name was neither found in the GAC nor in the manifest or the manifest's specified location is wrong </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131055">
+ <SymbolicName>FUSION_E_MANIFEST_PARSE_ERROR</SymbolicName>
+ <Message>"Unexpected error while parsing the specified manifest."</Message>
+ <Comment> Unexpected error while parsing the specified manifest </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131056">
+ <SymbolicName>FUSION_E_INVALID_ASSEMBLY_REFERENCE</SymbolicName>
+ <Message>"The given assembly name is invalid because a processor architecture is specified."</Message>
+ <Comment> The given assembly name is invalid because a processor architecture is specified </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131057">
+ <SymbolicName>COR_E_ASSEMBLY_NOT_EXPECTED</SymbolicName>
+ <Message>"The module was expected to not contain an assembly manifest."</Message>
+ <Comment> The module was expected to not contain an assembly manifest.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131058">
+ <SymbolicName>COR_E_LOADING_REFERENCE_ASSEMBLY</SymbolicName>
+ <Message>"Reference assemblies should not be loaded for execution. They can only be loaded in the Reflection-only loader context."</Message>
+ <Comment> Reference assemblies should not be loaded for execution. They can only be loaded in the Reflection-only loader context. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131059">
+ <SymbolicName>COR_E_NI_AND_RUNTIME_VERSION_MISMATCH</SymbolicName>
+ <Message>"The native image could not be loaded, because it was generated for use by a different version of the runtime."</Message>
+ <Comment> The native image could not be loaded, because it was generated for use by a different version of the runtime. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131069">
+ <SymbolicName>COR_E_LOADING_WINMD_REFERENCE_ASSEMBLY</SymbolicName>
+ <Message>"Contract Windows Runtime assemblies cannot be loaded for execution. Make sure your application only contains non-contract Windows Runtime assemblies."</Message>
+ <Comment> Contract Windows Runtime assemblies cannot be loaded for execution. Make sure your application only contains non-contract Windows Runtime assemblies </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131100">
+ <SymbolicName>CLDB_E_FILE_BADREAD</SymbolicName>
+ <Message>"Error occurred during a read."</Message>
+ <Comment> Error occurred during a read. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131101">
+ <SymbolicName>CLDB_E_FILE_BADWRITE</SymbolicName>
+ <Message>"Error occurred during a write."</Message>
+ <Comment> Error occurred during a write. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131103">
+ <SymbolicName>CLDB_E_FILE_READONLY</SymbolicName>
+ <Message>"File is read only."</Message>
+ <Comment> File is read only. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131105">
+ <SymbolicName>CLDB_E_NAME_ERROR</SymbolicName>
+ <Message>"Ill-formed name."</Message>
+ <Comment> An ill-formed name was given. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131106">
+ <SymbolicName>CLDB_E_TRUNCATION</SymbolicName>
+ <Message>"Data value was truncated."</Message>
+ <Comment> ERROR: Data value was truncated. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131107">
+ <SymbolicName>CLDB_E_FILE_OLDVER</SymbolicName>
+ <Message>"Old version error."</Message>
+ <Comment> Old version error. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131108">
+ <SymbolicName>CLDB_E_RELOCATED</SymbolicName>
+ <Message>"A shared memory open failed to open at the originally assigned memory address."</Message>
+ <Comment> A shared mem open failed to open at the originally </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013110a">
+ <SymbolicName>CLDB_E_SMDUPLICATE</SymbolicName>
+ <Message>"Create of shared memory failed. A memory mapping of the same name already exists."</Message>
+ <Comment> Create of shared memory failed. A memory mapping of the same name already exists. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013110b">
+ <SymbolicName>CLDB_E_NO_DATA</SymbolicName>
+ <Message>"No .CLB data in the memory or stream."</Message>
+ <Comment> There isn't .CLB data in the memory or stream. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013110c">
+ <SymbolicName>CLDB_E_READONLY</SymbolicName>
+ <Message>"Database is read only."</Message>
+ <Comment> Database is read only. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013110d">
+ <SymbolicName>CLDB_E_INCOMPATIBLE</SymbolicName>
+ <Message>"Importing scope is not compatible with the emitting scope."</Message>
+ <Comment> The importing scope is not comptabile with the emitting scope </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013110e">
+ <SymbolicName>CLDB_E_FILE_CORRUPT</SymbolicName>
+ <Message>"File is corrupt."</Message>
+ <Comment> File is corrupt. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013110f">
+ <SymbolicName>CLDB_E_SCHEMA_VERNOTFOUND</SymbolicName>
+ <Message>"Required version of schema not found."</Message>
+ <Comment> Version %d of schema '%s' not found. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131110">
+ <SymbolicName>CLDB_E_BADUPDATEMODE</SymbolicName>
+ <Message>"Cannot open a incrementally build scope for full update."</Message>
+ <Comment> cannot open a incrementally build scope for full update </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131121">
+ <SymbolicName>CLDB_E_INDEX_NONULLKEYS</SymbolicName>
+ <Message>"Null value not allowed in unique index or primary key."</Message>
+ <Comment> Null value not allowed in unique index or primary key. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131122">
+ <SymbolicName>CLDB_E_INDEX_DUPLICATE</SymbolicName>
+ <Message>"Index has been duplicated."</Message>
+ <Comment> Unique index %s has been violated. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131123">
+ <SymbolicName>CLDB_E_INDEX_BADTYPE</SymbolicName>
+ <Message>"The columns data type is not allowed in an index."</Message>
+ <Comment> The columns data type is not allowed in an index. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131124">
+ <SymbolicName>CLDB_E_INDEX_NOTFOUND</SymbolicName>
+ <Message>"Index not found."</Message>
+ <Comment> Index %s not found. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131130">
+ <SymbolicName>CLDB_E_RECORD_NOTFOUND</SymbolicName>
+ <Message>"Record not found on lookup."</Message>
+ <Comment> Record wasn't found on lookup. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131131">
+ <SymbolicName>CLDB_E_RECORD_OVERFLOW</SymbolicName>
+ <Message>"Too many records were returned for criteria."</Message>
+ <Comment> Too many records were returned for criteria. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131132">
+ <SymbolicName>CLDB_E_RECORD_DUPLICATE</SymbolicName>
+ <Message>"Record is a duplicate."</Message>
+ <Comment> Record is a duplicate. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131133">
+ <SymbolicName>CLDB_E_RECORD_PKREQUIRED</SymbolicName>
+ <Message>"Primary key value is required."</Message>
+ <Comment> Primary key value is required. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131134">
+ <SymbolicName>CLDB_E_RECORD_DELETED</SymbolicName>
+ <Message>"Record is valid but deleted."</Message>
+ <Comment> Record is valid but deleted. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131135">
+ <SymbolicName>CLDB_E_RECORD_OUTOFORDER</SymbolicName>
+ <Message>"Record is emitted out of order."</Message>
+ <Comment> Record is emitted out of order. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131140">
+ <SymbolicName>CLDB_E_COLUMN_OVERFLOW</SymbolicName>
+ <Message>"Data too large."</Message>
+ <Comment> Data too large. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131141">
+ <SymbolicName>CLDB_E_COLUMN_READONLY</SymbolicName>
+ <Message>"Column cannot be changed."</Message>
+ <Comment> Column cannot be changed. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131142">
+ <SymbolicName>CLDB_E_COLUMN_SPECIALCOL</SymbolicName>
+ <Message>"Too many RID or primary key columns, 1 is max."</Message>
+ <Comment> Too many RID or primary key columns, 1 is max. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131143">
+ <SymbolicName>CLDB_E_COLUMN_PKNONULLS</SymbolicName>
+ <Message>"Primary key column may not allow the null value."</Message>
+ <Comment> Primary key column %s may not allow the null value. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131150">
+ <SymbolicName>CLDB_E_TABLE_CANTDROP</SymbolicName>
+ <Message>"Attempted auto-drop of table while open."</Message>
+ <Comment> Can't auto-drop table while open. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131151">
+ <SymbolicName>CLDB_E_OBJECT_NOTFOUND</SymbolicName>
+ <Message>"Object not found in the database."</Message>
+ <Comment> Object was not found in the database. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131152">
+ <SymbolicName>CLDB_E_OBJECT_COLNOTFOUND</SymbolicName>
+ <Message>"Column not found."</Message>
+ <Comment> The column was not found. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131153">
+ <SymbolicName>CLDB_E_VECTOR_BADINDEX</SymbolicName>
+ <Message>"Invalid index."</Message>
+ <Comment> The index given was invalid. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131154">
+ <SymbolicName>CLDB_E_TOO_BIG</SymbolicName>
+ <Message>"A blob or string was too big."</Message>
+ <Comment> A blob or string was too big. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013115f">
+ <SymbolicName>META_E_INVALID_TOKEN_TYPE</SymbolicName>
+ <Message>"A token of the wrong type passed to a metadata function."</Message>
+ <Comment> A token of the wrong type passed to a metadata function. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131160">
+ <SymbolicName>TLBX_E_INVALID_TYPEINFO</SymbolicName>
+ <Message>"Typelib import: Invalid type, not converted."</Message>
+ <Comment> Typelib import: invalid type, not converted. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131161">
+ <SymbolicName>TLBX_E_INVALID_TYPEINFO_UNNAMED</SymbolicName>
+ <Message>"Typelib import: Invalid type, not converted - name unknown."</Message>
+ <Comment> Typelib import: invalid type, not converted -- name unknown. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131162">
+ <SymbolicName>TLBX_E_CTX_NESTED</SymbolicName>
+ <Message>"Typelib export: TLBX_E_CTX_NESTED"</Message>
+ <Comment> Typelib export: Format string for nested contexts. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131163">
+ <SymbolicName>TLBX_E_ERROR_MESSAGE</SymbolicName>
+ <Message>"Typelib export: General error. See IError info for more information."</Message>
+ <Comment> Typelib export: Error message wrapper. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131164">
+ <SymbolicName>TLBX_E_CANT_SAVE</SymbolicName>
+ <Message>"Typelib export: SaveAllChanges() failed."</Message>
+ <Comment> Typelib export: cant "SaveAllChanges()" </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131165">
+ <SymbolicName>TLBX_W_LIBNOTREGISTERED</SymbolicName>
+ <Message>"Typelib export: Type library is not registered."</Message>
+ <Comment> Typelib export: type library is not registered. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131166">
+ <SymbolicName>TLBX_E_CANTLOADLIBRARY</SymbolicName>
+ <Message>"Typelib export: Type library could not be loaded."</Message>
+ <Comment> Typelib export: type library cannot be loaded. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131167">
+ <SymbolicName>TLBX_E_BAD_VT_TYPE</SymbolicName>
+ <Message>"Typelib import: Invalid vartype, not converted."</Message>
+ <Comment> Typelib import: invalid VT_*, not converted. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131168">
+ <SymbolicName>TLBX_E_NO_MSCOREE_TLB</SymbolicName>
+ <Message>"Typelib export: Could not load mscoree.tlb."</Message>
+ <Comment> Typelib export: can't load mscoree.tlb </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131169">
+ <SymbolicName>TLBX_E_BAD_MSCOREE_TLB</SymbolicName>
+ <Message>"Typelib export: Could not get a required typeinfo from mscoree.tlb."</Message>
+ <Comment> Typelib export: can't get a required typeinfo from mscoree.tlb. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013116a">
+ <SymbolicName>TLBX_E_TLB_EXCEPTION</SymbolicName>
+ <Message>"Typelib import: Fault reading a typelib."</Message>
+ <Comment> Typelib import: fault reading a typelib. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013116b">
+ <SymbolicName>TLBX_E_MULTIPLE_LCIDS</SymbolicName>
+ <Message>"Typelib import: Multiple [lcid] parameters on a method."</Message>
+ <Comment> Typelib import: Multiple LCID's parameters on a method. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013116d">
+ <SymbolicName>TLBX_E_AMBIGUOUS_RETURN</SymbolicName>
+ <Message>"Typelib import: Duplicate or ambiguous return types."</Message>
+ <Comment> Typelib import: duplicate or ambiguous return types. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013116e">
+ <SymbolicName>TLBX_E_DUPLICATE_TYPE_NAME</SymbolicName>
+ <Message>"Typelib import: Duplicate name (due to user-defined name)."</Message>
+ <Comment> Typelib import: duplicate name (due to user-defined name). </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131172">
+ <SymbolicName>TLBX_I_NONSEQUENTIALSTRUCT</SymbolicName>
+ <Message>"Typelib export: Cannot convert non-sequential structs."</Message>
+ <Comment> Typelib export: Can't convert non-sequential structs. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131174">
+ <SymbolicName>TLBX_I_RESOLVEREFFAILED</SymbolicName>
+ <Message>"Typelib import: The resolve ref call failed."</Message>
+ <Comment> Typelib import: The resolve ref call failed. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131175">
+ <SymbolicName>TLBX_E_ASANY</SymbolicName>
+ <Message>"Typelib export: Encountered AsAny - ignored."</Message>
+ <Comment> Typelib export: Encounterd "AsAny" -- ignored. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131176">
+ <SymbolicName>TLBX_E_INVALIDLCIDPARAM</SymbolicName>
+ <Message>"Typelib export: Encountered an [lcid] attribute set to an invalid parameter."</Message>
+ <Comment> Typelib export: Encounterd an LCID attribute set to an invalid param. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131177">
+ <SymbolicName>TLBX_E_LCIDONDISPONLYITF</SymbolicName>
+ <Message>"Typelib export: Encountered an [lcid] attribute on a pure dispatch interface."</Message>
+ <Comment> Typelib export: Encounterd an LCID attribute on a disp only interface. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131178">
+ <SymbolicName>TLBX_E_NONPUBLIC_FIELD</SymbolicName>
+ <Message>"Typelib export: Non-public field in public struct."</Message>
+ <Comment> Typelib export: Non-public field in public struct. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013117b">
+ <SymbolicName>TLBX_E_BAD_NAMES</SymbolicName>
+ <Message>"Typelib export: Bad names list."</Message>
+ <Comment> Typelib export: bad names list. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013117d">
+ <SymbolicName>TLBX_E_GENERICINST_SIGNATURE</SymbolicName>
+ <Message>"TypeLib export: generic type instance in signature."</Message>
+ <Comment> TypeLib export: generic type instance in signature. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013117e">
+ <SymbolicName>TLBX_E_GENERICPAR_SIGNATURE</SymbolicName>
+ <Message>"TypeLib export: generic type parameter in signature."</Message>
+ <Comment> TypeLib export: generic type parameter in signature. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131180">
+ <SymbolicName>META_E_DUPLICATE</SymbolicName>
+ <Message>"Attempted to define an object that already exists."</Message>
+ <Comment> Attempt to define an object that already exists. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131181">
+ <SymbolicName>META_E_GUID_REQUIRED</SymbolicName>
+ <Message>"A guid was not provided where one was required."</Message>
+ <Comment> A guid was not provided where one was required. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131182">
+ <SymbolicName>META_E_TYPEDEF_MISMATCH</SymbolicName>
+ <Message>"Merge: an import typedef matched ns.name, but not version and guid."</Message>
+ <Comment> Merge: an import typedef matched ns.name, but not version and guid. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131183">
+ <SymbolicName>META_E_MERGE_COLLISION</SymbolicName>
+ <Message>"Merge: conflict between import and emit."</Message>
+ <Comment> Merge: conflict between import and emit </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131186">
+ <SymbolicName>TLBX_E_NO_SAFEHANDLE_ARRAYS</SymbolicName>
+ <Message>"TypeLib export: Detected array of SafeHandles."</Message>
+ <Comment> TypeLib export: detected array of SafeHandles </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131187">
+ <SymbolicName>META_E_METHD_NOT_FOUND</SymbolicName>
+ <Message>"Merge: Class already in emit scope, but member not found."</Message>
+ <Comment> Merge: Class already in emit scope, but member not found </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131188">
+ <SymbolicName>META_E_FIELD_NOT_FOUND</SymbolicName>
+ <Message>"Merge: Class already in emit scope, but member not found."</Message>
+ <Comment> Merge: Class already in emit scope, but member not found </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131189">
+ <SymbolicName>META_E_PARAM_MISMATCH</SymbolicName>
+ <Message>"Merge: Parameter information mismatched."</Message>
+ <Comment> Merge: Parameter information mismatched. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013118a">
+ <SymbolicName>META_E_BADMETADATA</SymbolicName>
+ <Message>"Merge: Inconsistency in meta data import scope."</Message>
+ <Comment> Merge: Inconsistency in meta data import scope </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013118b">
+ <SymbolicName>META_E_INTFCEIMPL_NOT_FOUND</SymbolicName>
+ <Message>"Merge: Class already in emit scope, but interfaceimpl not found."</Message>
+ <Comment> Merge: Class already in emit scope, but interfaceimpl not found </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013118c">
+ <SymbolicName>TLBX_E_NO_CRITICALHANDLE_ARRAYS</SymbolicName>
+ <Message>"TypeLib export: Detected array of CriticalHandles."</Message>
+ <Comment> TypeLib export: detected array of CriticalHandles </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013118d">
+ <SymbolicName>META_E_CLASS_LAYOUT_INCONSISTENT</SymbolicName>
+ <Message>"Merge: Duplicate classes have inconsistent class layout information."</Message>
+ <Comment> Merge: Class is duplicated but class layout information is not consistent </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013118e">
+ <SymbolicName>META_E_FIELD_MARSHAL_NOT_FOUND</SymbolicName>
+ <Message>"Merge: Field is duplicated but no matching FieldMarshal information."</Message>
+ <Comment> Merge: Field is duplicated but we cannot find the matching FieldMarshal information </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013118f">
+ <SymbolicName>META_E_METHODSEM_NOT_FOUND</SymbolicName>
+ <Comment> Merge: </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131190">
+ <SymbolicName>META_E_EVENT_NOT_FOUND</SymbolicName>
+ <Message>"Merge: Method is duplicated but no matching event info."</Message>
+ <Comment> Merge: Method is duplicated but we cannot find the matching event info. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131191">
+ <SymbolicName>META_E_PROP_NOT_FOUND</SymbolicName>
+ <Message>"Merge: Method is duplicated but no matching property info."</Message>
+ <Comment> Merge: Method is duplicated but we cannot find the maching property info. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131192">
+ <SymbolicName>META_E_BAD_SIGNATURE</SymbolicName>
+ <Message>"Bad binary signature."</Message>
+ <Comment> Bad binary signature </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131193">
+ <SymbolicName>META_E_BAD_INPUT_PARAMETER</SymbolicName>
+ <Message>"Bad input parameters."</Message>
+ <Comment> Bad input parameters </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131194">
+ <SymbolicName>META_E_METHDIMPL_INCONSISTENT</SymbolicName>
+ <Message>"Merge: duplicated methods have inconsistent ImplFlags."</Message>
+ <Comment> Merge: duplicated methods have inconsistent ImplFlags </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131195">
+ <SymbolicName>META_E_MD_INCONSISTENCY</SymbolicName>
+ <Message>"Merge: Inconsistency in meta data."</Message>
+ <Comment> Merge: Inconsistency in meta data </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131196">
+ <SymbolicName>META_E_CANNOTRESOLVETYPEREF</SymbolicName>
+ <Message>"Cannot resolve typeref."</Message>
+ <Comment> Cannot resolve typeref </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131198">
+ <SymbolicName>META_E_STRINGSPACE_FULL</SymbolicName>
+ <Message>"No logical space left to create more user strings."</Message>
+ <Comment> No logical space left to create more user strings. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131199">
+ <SymbolicName>META_E_UNEXPECTED_REMAP</SymbolicName>
+ <Message>"Unexpected TokenRemap."</Message>
+ <Comment> A TokenRemap occurred which we weren't prepared to handle. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013119a">
+ <SymbolicName>META_E_HAS_UNMARKALL</SymbolicName>
+ <Message>"Unmark all has been called already."</Message>
+ <Comment> Unmark all has been called already </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013119b">
+ <SymbolicName>META_E_MUST_CALL_UNMARKALL</SymbolicName>
+ <Message>"Must call UnmarkAll first before marking."</Message>
+ <Comment> Must call UnmarkAll first before marking. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013119c">
+ <SymbolicName>META_E_GENERICPARAM_INCONSISTENT</SymbolicName>
+ <Message>"Merge: duplicated types or methods have inconsistent GenericParams."</Message>
+ <Comment> Merge: duplicated types/methods have inconsistent GenericParams </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013119d">
+ <SymbolicName>META_E_EVENT_COUNTS</SymbolicName>
+ <Message>"Merge: different event counts in import and emit scopes."</Message>
+ <Comment> Merge: different event counts in import and emit scopes. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013119e">
+ <SymbolicName>META_E_PROPERTY_COUNTS</SymbolicName>
+ <Message>"Merge: different property counts in import and emit scopes."</Message>
+ <Comment> Merge: different property counts in import and emit scopes. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013119f">
+ <SymbolicName>META_E_TYPEDEF_MISSING</SymbolicName>
+ <Message>"Merge: An input scope has a TypeRef which does not have a matching TypeDef."</Message>
+ <Comment> Merge: An input scope has a TypeRef which should but doesn't have a matching TypeDef. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801311a0">
+ <SymbolicName>TLBX_E_CANT_LOAD_MODULE</SymbolicName>
+ <Message>"TypeLib export: cannot open the module to export."</Message>
+ <Comment> TypeLib export: can't open the module to export. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801311a1">
+ <SymbolicName>TLBX_E_CANT_LOAD_CLASS</SymbolicName>
+ <Message>"TypeLib export: cannot load a class."</Message>
+ <Comment> TypeLib export: can't load a class. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801311a2">
+ <SymbolicName>TLBX_E_NULL_MODULE</SymbolicName>
+ <Message>"TypeLib export: the hModule of a loaded class is 0; cannot export it."</Message>
+ <Comment> TypeLib export: the hMod of a loaded class is 0; can't export it. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801311a3">
+ <SymbolicName>TLBX_E_NO_CLSID_KEY</SymbolicName>
+ <Message>"TypeLib export: no CLSID or Interface subkey to HKCR."</Message>
+ <Comment> TypeLib export: no CLSID or Interface subkey to HKCR. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801311a4">
+ <SymbolicName>TLBX_E_CIRCULAR_EXPORT</SymbolicName>
+ <Message>"TypeLib export: attempted to export an Assembly imported from a TLB."</Message>
+ <Comment> TypeLib export: attempt to export a CLB imported from a TLB. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801311a5">
+ <SymbolicName>TLBX_E_CIRCULAR_IMPORT</SymbolicName>
+ <Message>"TypeLib import: attempted to import a TLB exported from an Assembly."</Message>
+ <Comment> TypeLib import: attempt to import a TLB exported from a CLB. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801311a6">
+ <SymbolicName>TLBX_E_BAD_NATIVETYPE</SymbolicName>
+ <Message>"TypeLib export: bad Native type in method signature."</Message>
+ <Comment> TypeLib export: bad Native type in method signature. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801311a7">
+ <SymbolicName>TLBX_E_BAD_VTABLE</SymbolicName>
+ <Message>"TypeLib import: non-increasing vtable (duplicate slots)."</Message>
+ <Comment> TypeLib import: non-increasing vtable (duplicate slots). </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801311a8">
+ <SymbolicName>TLBX_E_CRM_NON_STATIC</SymbolicName>
+ <Message>"TypeLib export: the COM register method is non static."</Message>
+ <Comment> TypeLib export: the COM register method is non static. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801311a9">
+ <SymbolicName>TLBX_E_CRM_INVALID_SIG</SymbolicName>
+ <Message>"TypeLib export: the specified COM register method does not have the correct signature."</Message>
+ <Comment> TypeLib export: the specified COM register method does not have the correct signature. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801311aa">
+ <SymbolicName>TLBX_E_CLASS_LOAD_EXCEPTION</SymbolicName>
+ <Message>"TypeLib export: cannot load CLR type."</Message>
+ <Comment> TypeLib export: can't load, have the class load exception. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801311ab">
+ <SymbolicName>TLBX_E_UNKNOWN_SIGNATURE</SymbolicName>
+ <Message>"TypeLib export: unknown element in signature."</Message>
+ <Comment> TypeLib export: unknown element in signature. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801311ac">
+ <SymbolicName>TLBX_E_REFERENCED_TYPELIB</SymbolicName>
+ <Message>"TypeLib import: reference to an external typelib."</Message>
+ <Comment> TypeLib import: reference to an external typelib. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801311ad">
+ <SymbolicName>TLBX_E_INVALID_NAMESPACE</SymbolicName>
+ <Message>"TypeLib import: an imported typelib has an invalid namespace name."</Message>
+ <Comment> TypeLib import: an imported typelib has an invalid namespace name. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801311ae">
+ <SymbolicName>TLBX_E_LAYOUT_ERROR</SymbolicName>
+ <Message>"Typelib export: an error on Layout()"</Message>
+ <Comment> Typelib export: an error on Layout() </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801311af">
+ <SymbolicName>TLBX_E_NOTIUNKNOWN</SymbolicName>
+ <Message>"Typelib import: Interface not derived from IUnknown."</Message>
+ <Comment> Typelib import: Interface not derived from IUnknown. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801311b0">
+ <SymbolicName>TLBX_E_NONVISIBLEVALUECLASS</SymbolicName>
+ <Message>"Typelib export: Non COM visible value type in method signature."</Message>
+ <Comment> Typelib export: Non COM visible value type in method signature. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801311b1">
+ <SymbolicName>TLBX_E_LPTSTR_NOT_ALLOWED</SymbolicName>
+ <Message>"Typelib export: Types which contain the native type NATIVE_TYPE_LPTSTR are not allowed to be exported to COM."</Message>
+ <Comment> Typelib export: Types which contain the native type NATIVE_TYPE_LPTSTR are not allowed to be exported to COM. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801311b2">
+ <SymbolicName>TLBX_E_AUTO_CS_NOT_ALLOWED</SymbolicName>
+ <Message>"Typelib export: Types with a charset of auto are not allowed to be exported to COM."</Message>
+ <Comment> Typelib export: Types with a char set of auto are not allowed to be exported to COM. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801311b5">
+ <SymbolicName>TLBX_E_ENUM_VALUE_INVALID</SymbolicName>
+ <Message>"Typelib export: The enum value is not legal for a typelib."</Message>
+ <Comment> Typelib export: The enum value is not legal for a typelib. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801311b6">
+ <SymbolicName>TLBX_E_DUPLICATE_IID</SymbolicName>
+ <Message>"Typelib export: Duplicate IID."</Message>
+ <Comment> Typelib export: Duplicate IID </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801311b7">
+ <SymbolicName>TLBX_E_NO_NESTED_ARRAYS</SymbolicName>
+ <Message>"Typelib export: detected nested arrays."</Message>
+ <Comment> Tyeplib export: detected nested arrays. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801311b8">
+ <SymbolicName>TLBX_E_PARAM_ERROR_NAMED</SymbolicName>
+ <Message>"Typelib import: parameter type could not be converted."</Message>
+ <Comment> Typelib import: param type couldn't be converted. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801311b9">
+ <SymbolicName>TLBX_E_PARAM_ERROR_UNNAMED</SymbolicName>
+ <Message>"Typelib import: parameter type could not be converted - parameter name unknown."</Message>
+ <Comment> Typelib import: param type couldn't be converted -- param name unknown. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801311ba">
+ <SymbolicName>TLBX_E_AGNOST_SIGNATURE</SymbolicName>
+ <Message>"TypeLib export: size agnostic element in signature."</Message>
+ <Comment> TypeLib export: size agnostic element in signature. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801311bb">
+ <SymbolicName>TLBX_E_CONVERT_FAIL</SymbolicName>
+ <Message>"TypeLib export: exporter failed."</Message>
+ <Comment> TypeLib export: exporter failed. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801311bc">
+ <SymbolicName>TLBX_W_DUAL_NOT_DISPATCH</SymbolicName>
+ <Message>"Typelib import: [dual] interface not derived from IDispatch."</Message>
+ <Comment> Typelib import: [dual] interface not derived from IDispatch. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801311bd">
+ <SymbolicName>TLBX_E_BAD_SIGNATURE</SymbolicName>
+ <Message>"Typelib export: bad signature."</Message>
+ <Comment> Typelib export: unconvertable signature (use specific error for reporting!) </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801311be">
+ <SymbolicName>TLBX_E_ARRAY_NEEDS_NT_FIXED</SymbolicName>
+ <Message>"Typelib export: non-fixed or non-safearray array in struct."</Message>
+ <Comment> Typelib export: non-fixed/non-safearray array in struct </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801311bf">
+ <SymbolicName>TLBX_E_CLASS_NEEDS_NT_INTF</SymbolicName>
+ <Message>"Typelib export: non-interface class in struct."</Message>
+ <Comment> Typelib export: non-interface class in struct </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801311c0">
+ <SymbolicName>META_E_CA_INVALID_TARGET</SymbolicName>
+ <Message>"Known custom attribute on invalid target."</Message>
+ <Comment> Known custom attribute on invalid target. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801311c1">
+ <SymbolicName>META_E_CA_INVALID_VALUE</SymbolicName>
+ <Message>"Known custom attribute had invalid value."</Message>
+ <Comment> Known custom attribute had invalid value. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801311c2">
+ <SymbolicName>META_E_CA_INVALID_BLOB</SymbolicName>
+ <Message>"Known custom attribute blob has bad format."</Message>
+ <Comment> Known custom attribute blob is bad format. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801311c3">
+ <SymbolicName>META_E_CA_REPEATED_ARG</SymbolicName>
+ <Message>"Known custom attribute blob has repeated named argument."</Message>
+ <Comment> Known custom attribute blob has repeated named argument. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801311c4">
+ <SymbolicName>META_E_CA_UNKNOWN_ARGUMENT</SymbolicName>
+ <Message>"Known custom attribute named argument not recognized."</Message>
+ <Comment> Known custom attrubte named arg not recognized. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801311c5">
+ <SymbolicName>META_E_CA_VARIANT_NYI</SymbolicName>
+ <Message>"Known attribute named argument does not support variant."</Message>
+ <Comment> Known attribute named argument doesn't support variant. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801311c6">
+ <SymbolicName>META_E_CA_ARRAY_NYI</SymbolicName>
+ <Message>"Known attribute named argument does not support array."</Message>
+ <Comment> Known attribute named argument doesn't support array. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801311c7">
+ <SymbolicName>META_E_CA_UNEXPECTED_TYPE</SymbolicName>
+ <Message>"Known attribute parser found unexpected type."</Message>
+ <Comment> Known attribute parser found unexpected type. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801311c8">
+ <SymbolicName>META_E_CA_INVALID_ARGTYPE</SymbolicName>
+ <Message>"Known attribute parser only handles fields, not properties."</Message>
+ <Comment> Known attribute parser only handles fields -- no properties. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801311c9">
+ <SymbolicName>META_E_CA_INVALID_ARG_FOR_TYPE</SymbolicName>
+ <Message>"Known attribute parser found an argument that is invalid for the object it is applied to."</Message>
+ <Comment> Known attribute parser found an argument that is invalid for the object it is applied to. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801311ca">
+ <SymbolicName>META_E_CA_INVALID_UUID</SymbolicName>
+ <Message>"The format of the UUID was invalid."</Message>
+ <Comment> The format of the UUID was invalid. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801311cb">
+ <SymbolicName>META_E_CA_INVALID_MARSHALAS_FIELDS</SymbolicName>
+ <Message>"The MarshalAs attribute has fields set that are not valid for the specified unmanaged type."</Message>
+ <Comment> The MarshalAs attribute has fields set that are not valid for the specified unmanaged type. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801311cc">
+ <SymbolicName>META_E_CA_NT_FIELDONLY</SymbolicName>
+ <Message>"The specified unmanaged type is only valid on fields."</Message>
+ <Comment> The specified unmanaged type is only valid on fields. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801311cd">
+ <SymbolicName>META_E_CA_NEGATIVE_PARAMINDEX</SymbolicName>
+ <Message>"The parameter index cannot be negative."</Message>
+ <Comment> The parameter index cannot be negative. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801311ce">
+ <SymbolicName>META_E_CA_NEGATIVE_MULTIPLIER</SymbolicName>
+ <Message>"The multiplier cannot be negative."</Message>
+ <Comment> The multiplier cannot be negative. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801311cf">
+ <SymbolicName>META_E_CA_NEGATIVE_CONSTSIZE</SymbolicName>
+ <Message>"The constant size cannot be negative."</Message>
+ <Comment> The constant size cannot be negative. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801311d0">
+ <SymbolicName>META_E_CA_FIXEDSTR_SIZE_REQUIRED</SymbolicName>
+ <Message>"A fixed string requires a size."</Message>
+ <Comment> A fixed string requires a size. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801311d1">
+ <SymbolicName>META_E_CA_CUSTMARSH_TYPE_REQUIRED</SymbolicName>
+ <Message>"A custom marshaler requires the custom marshaler type."</Message>
+ <Comment> A custom marshaler requires the custom marshaler type. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801311d2">
+ <SymbolicName>META_E_CA_FILENAME_REQUIRED</SymbolicName>
+ <Message>"A DllImport attribute requires a filename."</Message>
+ <Comment> A DllImport attribute requires a filename. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801311d3">
+ <SymbolicName>TLBX_W_NO_PROPS_IN_EVENTS</SymbolicName>
+ <Message>"TypeLib import: Detected properties in a source dispinterface."</Message>
+ <Comment> TypeLib import: Detected properties in a source dispinterface. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801311d4">
+ <SymbolicName>META_E_NOT_IN_ENC_MODE</SymbolicName>
+ <Message>"SaveDelta was called without being in EnC mode."</Message>
+ <Comment> SaveDelta was called without being in EnC mode </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801311d6">
+ <SymbolicName>META_E_METHOD_COUNTS</SymbolicName>
+ <Message>"Merge: different method counts in import and emit scopes."</Message>
+ <Comment> Merge: different method counts in import and emit scopes. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801311d7">
+ <SymbolicName>META_E_FIELD_COUNTS</SymbolicName>
+ <Message>"Merge: different field counts in import and emit scopes."</Message>
+ <Comment> Merge: different field counts in import and emit scopes. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801311d8">
+ <SymbolicName>META_E_PARAM_COUNTS</SymbolicName>
+ <Message>"Merge: different parameter counts in import and emit scopes."</Message>
+ <Comment> Merge: different param counts in import and emit scopes. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801311da">
+ <SymbolicName>TLBX_E_TYPED_REF</SymbolicName>
+ <Message>"TypeLib export: Exporting a TypedReference."</Message>
+ <Comment> TypeLib export: Exporting a TypedReference. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801311e1">
+ <SymbolicName>TLBX_E_BITNESS_MISMATCH</SymbolicName>
+ <Message>"TypeLib export: bitness of assembly does not match bitness of output type library."</Message>
+ <Comment> TypeLib export: bitness of assembly doesn't match bitness of output type library </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801311e2">
+ <SymbolicName>TLBX_E_EVENT_WITH_NEWENUM</SymbolicName>
+ <Comment> TypeLib import: source interface with NewEnum member. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801311e3">
+ <SymbolicName>TLBX_E_PROPGET_WITHOUT_RETURN</SymbolicName>
+ <Comment> TypeLib import: propget without return type </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801311e4">
+ <SymbolicName>META_E_MISMATCHED_VISIBLITY</SymbolicName>
+ <Comment> Merge - Match found for type/method/etc but differs in visiblity </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801311e5">
+ <SymbolicName>META_E_CA_BAD_FRIENDS_ARGS</SymbolicName>
+ <Message>"InternalsVisibleTo can't have a version, culture, or processor architecture."</Message>
+ <Comment> InternalsVisibleTo can't have a version, culture, or processor architecture. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801311e6">
+ <SymbolicName>META_E_CA_FRIENDS_SN_REQUIRED</SymbolicName>
+ <Comment> Strong-name signed assemblies can only grant friend access to strong name-signed assemblies </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131203">
+ <SymbolicName>VLDTR_E_RID_OUTOFRANGE</SymbolicName>
+ <Message>"Rid is out of range."</Message>
+ <Comment> Rid is out of range. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131204">
+ <SymbolicName>VLDTR_E_CDTKN_OUTOFRANGE</SymbolicName>
+ <Message>"Coded token type is out of range."</Message>
+ <Comment> Coded token type is out of range. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131205">
+ <SymbolicName>VLDTR_E_CDRID_OUTOFRANGE</SymbolicName>
+ <Message>"Coded rid is out of range."</Message>
+ <Comment> Coded rid is out of range. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131206">
+ <SymbolicName>VLDTR_E_STRING_INVALID</SymbolicName>
+ <Message>"String offset is invalid."</Message>
+ <Comment> String offset is invalid. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131207">
+ <SymbolicName>VLDTR_E_GUID_INVALID</SymbolicName>
+ <Message>"GUID offset is invalid."</Message>
+ <Comment> GUID offset is invalid. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131208">
+ <SymbolicName>VLDTR_E_BLOB_INVALID</SymbolicName>
+ <Message>"Blob offset if invalid."</Message>
+ <Comment> Blob offset if invalid. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131209">
+ <SymbolicName>VLDTR_E_MOD_MULTI</SymbolicName>
+ <Message>"Multiple module records found."</Message>
+ <Comment> Multiple module records found. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013120a">
+ <SymbolicName>VLDTR_E_MOD_NULLMVID</SymbolicName>
+ <Message>"Module has null MVID."</Message>
+ <Comment> Module has null MVID. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013120b">
+ <SymbolicName>VLDTR_E_TR_NAMENULL</SymbolicName>
+ <Message>"TypeRef name is NULL."</Message>
+ <Comment> TypeRef name is NULL. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013120c">
+ <SymbolicName>VLDTR_E_TR_DUP</SymbolicName>
+ <Message>"TypeRef has a duplicate."</Message>
+ <Comment> TypeRef has a dup. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013120d">
+ <SymbolicName>VLDTR_E_TD_NAMENULL</SymbolicName>
+ <Message>"TypeDef name is NULL."</Message>
+ <Comment> TypeDef name is NULL. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013120e">
+ <SymbolicName>VLDTR_E_TD_DUPNAME</SymbolicName>
+ <Message>"TypeDef has a duplicate based on name+namespace."</Message>
+ <Comment> TypeDef has a dup based on name+namespace. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013120f">
+ <SymbolicName>VLDTR_E_TD_DUPGUID</SymbolicName>
+ <Message>"TypeDef has a duplicate based on GUID."</Message>
+ <Comment> TypeDef has a dup based on GUID. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131210">
+ <SymbolicName>VLDTR_E_TD_NOTIFACEOBJEXTNULL</SymbolicName>
+ <Message>"TypeDef that is not an Interface and not System.Object extends nil parent."</Message>
+ <Comment> TypeDef that's not an Interface and not System.Object extends nil parent. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131211">
+ <SymbolicName>VLDTR_E_TD_OBJEXTENDSNONNULL</SymbolicName>
+ <Message>"System.Object extends a non-nil parent."</Message>
+ <Comment> System.Object extends a non-nil parent. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131212">
+ <SymbolicName>VLDTR_E_TD_EXTENDSSEALED</SymbolicName>
+ <Message>"TypeDef extends sealed class."</Message>
+ <Comment> TypeDef extends sealed class. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131213">
+ <SymbolicName>VLDTR_E_TD_DLTNORTSPCL</SymbolicName>
+ <Message>"TypeDef is Deleted but not marked with RTSpecialName."</Message>
+ <Comment> TypeDef is Deleted but not marked with RTSpecialName. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131214">
+ <SymbolicName>VLDTR_E_TD_RTSPCLNOTDLT</SymbolicName>
+ <Message>"TypeDef is marked RTSpecialName, but is not a Deleted record."</Message>
+ <Comment> TypeDef is marked RTSpecialName, but is not a Deleted record. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131215">
+ <SymbolicName>VLDTR_E_MI_DECLPRIV</SymbolicName>
+ <Message>"MethodImpl's Decl is private."</Message>
+ <Comment> MethodImpl's Decl is private </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131216">
+ <SymbolicName>VLDTR_E_AS_BADNAME</SymbolicName>
+ <Message>"Assembly [Ref] name has path and/or extension."</Message>
+ <Comment> Assembly [Ref] name has path and/or extension. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131217">
+ <SymbolicName>VLDTR_E_FILE_SYSNAME</SymbolicName>
+ <Message>"File has a system name (con, com, aux, etc.)."</Message>
+ <Comment> File has a system name (con, com, aux, etc.). </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131218">
+ <SymbolicName>VLDTR_E_MI_BODYSTATIC</SymbolicName>
+ <Message>"MethodImpl's body is static."</Message>
+ <Comment> MethodImpl's body is static. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131219">
+ <SymbolicName>VLDTR_E_TD_IFACENOTABS</SymbolicName>
+ <Message>"TypeDef is marked Interface but not Abstract."</Message>
+ <Comment> TypeDef is marked Interface but not Abstract. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013121a">
+ <SymbolicName>VLDTR_E_TD_IFACEPARNOTNIL</SymbolicName>
+ <Message>"TypeDef is marked Interface but parent is not Nil."</Message>
+ <Comment> TypeDef is marked Interface but parent is not Nil. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013121b">
+ <SymbolicName>VLDTR_E_TD_IFACEGUIDNULL</SymbolicName>
+ <Message>"TypeDef is marked Interface but GUID is NULL."</Message>
+ <Comment> TypeDef is marked Interface but GUID is NULL. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013121c">
+ <SymbolicName>VLDTR_E_MI_DECLFINAL</SymbolicName>
+ <Message>"TMethodImpl's Decl is final."</Message>
+ <Comment> TMethodImpl's Decl is final. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013121d">
+ <SymbolicName>VLDTR_E_TD_VTNOTSEAL</SymbolicName>
+ <Message>"TypeDef is marked ValueType but not marked Sealed."</Message>
+ <Comment> TypeDef is marked ValueType but not marked Sealed. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013121e">
+ <SymbolicName>VLDTR_E_PD_BADFLAGS</SymbolicName>
+ <Message>"Parameter has extra bits in flags."</Message>
+ <Comment> Param has extra bits in flags. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013121f">
+ <SymbolicName>VLDTR_E_IFACE_DUP</SymbolicName>
+ <Message>"InterfaceImpl has a duplicate."</Message>
+ <Comment> InterfaceImpl has a dup. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131220">
+ <SymbolicName>VLDTR_E_MR_NAMENULL</SymbolicName>
+ <Message>"MemberRef name is NULL."</Message>
+ <Comment> MemberRef name is NULL. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131221">
+ <SymbolicName>VLDTR_E_MR_VTBLNAME</SymbolicName>
+ <Message>"MemberRef has an invalid name, _VtblGap*."</Message>
+ <Comment> MemberRef has an invalid name, _VtblGap*. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131222">
+ <SymbolicName>VLDTR_E_MR_DELNAME</SymbolicName>
+ <Message>"MemberRef has an invalid name, _Deleted*."</Message>
+ <Comment> MemberRef has an invalid name, _Deleted*. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131223">
+ <SymbolicName>VLDTR_E_MR_PARNIL</SymbolicName>
+ <Message>"MemberRef parent Nil in a PE file."</Message>
+ <Comment> MemberRef parent Nil in a PE file. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131224">
+ <SymbolicName>VLDTR_E_MR_BADCALLINGCONV</SymbolicName>
+ <Message>"MemberRef has invalid calling convention."</Message>
+ <Comment> MemberRef has invalid calling convention. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131225">
+ <SymbolicName>VLDTR_E_MR_NOTVARARG</SymbolicName>
+ <Message>"MemberRef has Method parent but calling convention is not VARARG."</Message>
+ <Comment> MemberRef has Method parent but calling convention is not VARARG. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131226">
+ <SymbolicName>VLDTR_E_MR_NAMEDIFF</SymbolicName>
+ <Message>"MemberRef name different from parent MethodDef."</Message>
+ <Comment> MemberRef name different from parent MethodDef. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131227">
+ <SymbolicName>VLDTR_E_MR_SIGDIFF</SymbolicName>
+ <Message>"MemberRef signature different from parent MethodDef."</Message>
+ <Comment> MemberRef signature different from parent MethodDef. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131228">
+ <SymbolicName>VLDTR_E_MR_DUP</SymbolicName>
+ <Message>"MemberRef has a duplicate."</Message>
+ <Comment> MemberRef has a dup. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131229">
+ <SymbolicName>VLDTR_E_CL_TDAUTO</SymbolicName>
+ <Message>"ClassLayout parent TypeDef is marked AutoLayout."</Message>
+ <Comment> ClassLayout parent TypeDef is marked AutoLayout. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013122a">
+ <SymbolicName>VLDTR_E_CL_BADPCKSZ</SymbolicName>
+ <Message>"ClassLayout has bad PackingSize."</Message>
+ <Comment> ClassLayout has bad PackingSize. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013122b">
+ <SymbolicName>VLDTR_E_CL_DUP</SymbolicName>
+ <Message>"ClassLayout has a duplicate."</Message>
+ <Comment> ClassLayout has dup. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013122c">
+ <SymbolicName>VLDTR_E_FL_BADOFFSET</SymbolicName>
+ <Message>"FieldLayout2 has bad offset."</Message>
+ <Comment> FieldLayout2 has bad offset. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013122d">
+ <SymbolicName>VLDTR_E_FL_TDNIL</SymbolicName>
+ <Message>"FieldLayout2 has field with nil parent."</Message>
+ <Comment> FieldLayout2 has field with nil parent. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013122e">
+ <SymbolicName>VLDTR_E_FL_NOCL</SymbolicName>
+ <Message>"FieldLayout2 has no ClassLayout record."</Message>
+ <Comment> FieldLayout2 has no ClassLayout record. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013122f">
+ <SymbolicName>VLDTR_E_FL_TDNOTEXPLCT</SymbolicName>
+ <Message>"FieldLayout2 parent TypeDef is not marked with ExplicitLayout."</Message>
+ <Comment> FieldLayout2 parent TypeDef is not marked with ExplicitLayout. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131230">
+ <SymbolicName>VLDTR_E_FL_FLDSTATIC</SymbolicName>
+ <Message>"FieldLayout2 has field marked Static."</Message>
+ <Comment> FieldLayout2 has field marked Static. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131231">
+ <SymbolicName>VLDTR_E_FL_DUP</SymbolicName>
+ <Message>"FieldLayout2 has a duplicate."</Message>
+ <Comment> FieldLayout2 has a dup. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131232">
+ <SymbolicName>VLDTR_E_MODREF_NAMENULL</SymbolicName>
+ <Message>"ModuleRef name is NULL."</Message>
+ <Comment> ModuleRef name is NULL. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131233">
+ <SymbolicName>VLDTR_E_MODREF_DUP</SymbolicName>
+ <Message>"ModuleRef has a duplicate."</Message>
+ <Comment> ModuleRef has a dup. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131234">
+ <SymbolicName>VLDTR_E_TR_BADSCOPE</SymbolicName>
+ <Message>"TypeRef has a bad resolution scope."</Message>
+ <Comment> TypeRef has a bad resolution scope. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131235">
+ <SymbolicName>VLDTR_E_TD_NESTEDNOENCL</SymbolicName>
+ <Message>"TypeDef marked nested has no encloser."</Message>
+ <Comment> TypeDef marked nested has no encloser. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131236">
+ <SymbolicName>VLDTR_E_TD_EXTTRRES</SymbolicName>
+ <Message>"TypeDef extends a TypeRef which resolves to a TypeDef in the same module."</Message>
+ <Comment> TypeDef extends a TypeRef which resolves to a TypeDef in the same module. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131237">
+ <SymbolicName>VLDTR_E_SIGNULL</SymbolicName>
+ <Message>"Signature specified is zero-sized."</Message>
+ <Comment> Signature specified is zero-sized. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131238">
+ <SymbolicName>VLDTR_E_SIGNODATA</SymbolicName>
+ <Message>"Signature does not have enough data at specified byte."</Message>
+ <Comment> Signature does not have enough data at specified byte. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131239">
+ <SymbolicName>VLDTR_E_MD_BADCALLINGCONV</SymbolicName>
+ <Message>"Method signature has invalid calling convention."</Message>
+ <Comment> Method signature has invalid calling convention. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013123a">
+ <SymbolicName>VLDTR_E_MD_THISSTATIC</SymbolicName>
+ <Message>"Method is marked static but has HASTHIS/EXPLICITTHIS set on the calling convention."</Message>
+ <Comment> Method is marked static but has HASTHIS/EXPLICITTHIS set on the calling convention. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013123b">
+ <SymbolicName>VLDTR_E_MD_NOTTHISNOTSTATIC</SymbolicName>
+ <Message>"Method is not marked static but is not HASTHIS or EXPLICITTHIS."</Message>
+ <Comment> Method is not marked static but is not HASTHIS/EXPLICITTHIS. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013123c">
+ <SymbolicName>VLDTR_E_MD_NOARGCNT</SymbolicName>
+ <Message>"Method signature is missing the argument count."</Message>
+ <Comment> Method signature is missing the argument count. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013123d">
+ <SymbolicName>VLDTR_E_SIG_MISSELTYPE</SymbolicName>
+ <Message>"Signature missing element type."</Message>
+ <Comment> Signature missing element type. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013123e">
+ <SymbolicName>VLDTR_E_SIG_MISSTKN</SymbolicName>
+ <Message>"Signature missing token."</Message>
+ <Comment> Signature missing token. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013123f">
+ <SymbolicName>VLDTR_E_SIG_TKNBAD</SymbolicName>
+ <Message>"Signature has bad token."</Message>
+ <Comment> Signature has bad token. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131240">
+ <SymbolicName>VLDTR_E_SIG_MISSFPTR</SymbolicName>
+ <Message>"Signature is missing function pointer."</Message>
+ <Comment> Signature is missing function pointer. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131241">
+ <SymbolicName>VLDTR_E_SIG_MISSFPTRARGCNT</SymbolicName>
+ <Message>"Signature has function pointer missing argument count."</Message>
+ <Comment> Signature has function pointer missing argument count. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131242">
+ <SymbolicName>VLDTR_E_SIG_MISSRANK</SymbolicName>
+ <Message>"Signature is missing rank specification."</Message>
+ <Comment> Signature is missing rank specification. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131243">
+ <SymbolicName>VLDTR_E_SIG_MISSNSIZE</SymbolicName>
+ <Message>"Signature is missing count of sized dimensions."</Message>
+ <Comment> Signature is missing count of sized dimensions. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131244">
+ <SymbolicName>VLDTR_E_SIG_MISSSIZE</SymbolicName>
+ <Message>"Signature is missing size of dimension."</Message>
+ <Comment> Signature is missing size of dimension. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131245">
+ <SymbolicName>VLDTR_E_SIG_MISSNLBND</SymbolicName>
+ <Message>"Signature is missing count of lower bounds."</Message>
+ <Comment> Signature is missing count of lower bounds. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131246">
+ <SymbolicName>VLDTR_E_SIG_MISSLBND</SymbolicName>
+ <Message>"Signature is missing a lower bound."</Message>
+ <Comment> Signature is missing a lower bound. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131247">
+ <SymbolicName>VLDTR_E_SIG_BADELTYPE</SymbolicName>
+ <Message>"Signature has bad element type."</Message>
+ <Comment> Signature has bad element type. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131248">
+ <SymbolicName>VLDTR_E_SIG_MISSVASIZE</SymbolicName>
+ <Message>"Signature has value array missing size."</Message>
+ <Comment> Signature has value array missing size. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131249">
+ <SymbolicName>VLDTR_E_FD_BADCALLINGCONV</SymbolicName>
+ <Message>"Field signature has invalid calling convention."</Message>
+ <Comment> Field signature has invalid calling convention. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013124a">
+ <SymbolicName>VLDTR_E_MD_NAMENULL</SymbolicName>
+ <Message>"Method name is NULL."</Message>
+ <Comment> Method name is NULL. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013124b">
+ <SymbolicName>VLDTR_E_MD_PARNIL</SymbolicName>
+ <Message>"Method has parent NIL."</Message>
+ <Comment> Method has parent NIL. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013124c">
+ <SymbolicName>VLDTR_E_MD_DUP</SymbolicName>
+ <Message>"Method has a duplicate."</Message>
+ <Comment> Method has dup. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013124d">
+ <SymbolicName>VLDTR_E_FD_NAMENULL</SymbolicName>
+ <Message>"Field name is NULL."</Message>
+ <Comment> Field name is NULL. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013124e">
+ <SymbolicName>VLDTR_E_FD_PARNIL</SymbolicName>
+ <Message>"Field parent is Nil."</Message>
+ <Comment> Field parent is Nil. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013124f">
+ <SymbolicName>VLDTR_E_FD_DUP</SymbolicName>
+ <Message>"Field has a duplicate."</Message>
+ <Comment> Field has dup. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131250">
+ <SymbolicName>VLDTR_E_AS_MULTI</SymbolicName>
+ <Message>"Multiple Assembly records found."</Message>
+ <Comment> Multiple Assembly records found. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131251">
+ <SymbolicName>VLDTR_E_AS_NAMENULL</SymbolicName>
+ <Message>"Assembly name is NULL."</Message>
+ <Comment> Assembly name is NULL. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131252">
+ <SymbolicName>VLDTR_E_SIG_TOKTYPEMISMATCH</SymbolicName>
+ <Message>"E_T_VALUETYPE&lt;class token&gt; or E_T_CLASS&lt;vtype token&gt;."</Message>
+ <Comment> E_T_VALUETYPE&lt;class token&gt; or E_T_CLASS&lt;vtype token&gt;. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131253">
+ <SymbolicName>VLDTR_E_CL_TDINTF</SymbolicName>
+ <Message>"Class layout on an Interface."</Message>
+ <Comment> Class layout on an Interface. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131254">
+ <SymbolicName>VLDTR_E_ASOS_OSPLTFRMIDINVAL</SymbolicName>
+ <Message>"AssemblyOS platform ID invalid."</Message>
+ <Comment> AssemblyOS platform ID invalid. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131255">
+ <SymbolicName>VLDTR_E_AR_NAMENULL</SymbolicName>
+ <Message>"AssemblyRef name is NULL."</Message>
+ <Comment> AssemblyRef name is NULL. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131256">
+ <SymbolicName>VLDTR_E_TD_ENCLNOTNESTED</SymbolicName>
+ <Message>"TypeDef not nested has encloser."</Message>
+ <Comment> TypeDef not nested has encloser. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131257">
+ <SymbolicName>VLDTR_E_AROS_OSPLTFRMIDINVAL</SymbolicName>
+ <Message>"AssemblyRefOS has invalid platform ID."</Message>
+ <Comment> AssemblyRefOS has invalid platform ID. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131258">
+ <SymbolicName>VLDTR_E_FILE_NAMENULL</SymbolicName>
+ <Message>"File name is NULL."</Message>
+ <Comment> File name is NULL. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131259">
+ <SymbolicName>VLDTR_E_CT_NAMENULL</SymbolicName>
+ <Message>"ExportedType name is NULL."</Message>
+ <Comment> ExportedType name is NULL. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013125a">
+ <SymbolicName>VLDTR_E_TD_EXTENDSCHILD</SymbolicName>
+ <Message>"TypeDef extends its own child."</Message>
+ <Comment> TypeDef extends its own child. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013125b">
+ <SymbolicName>VLDTR_E_MAR_NAMENULL</SymbolicName>
+ <Message>"ManifestResource name is NULL."</Message>
+ <Comment> ManifestResource name is NULL. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013125c">
+ <SymbolicName>VLDTR_E_FILE_DUP</SymbolicName>
+ <Message>"File has a duplicate."</Message>
+ <Comment> File has dup. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013125d">
+ <SymbolicName>VLDTR_E_FILE_NAMEFULLQLFD</SymbolicName>
+ <Message>"File name is fully qualified."</Message>
+ <Comment> File name is fully qualified. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013125e">
+ <SymbolicName>VLDTR_E_CT_DUP</SymbolicName>
+ <Message>"ExportedType has a duplicate."</Message>
+ <Comment> ExportedType has dup. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013125f">
+ <SymbolicName>VLDTR_E_MAR_DUP</SymbolicName>
+ <Message>"ManifestResource has a duplicate."</Message>
+ <Comment> ManifestResource has dup. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131260">
+ <SymbolicName>VLDTR_E_MAR_NOTPUBPRIV</SymbolicName>
+ <Message>"ManifestResource is neither Public nor Private."</Message>
+ <Comment> ManifestResource is neither Public not Private. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131261">
+ <SymbolicName>VLDTR_E_TD_ENUMNOVALUE</SymbolicName>
+ <Message>"Enum has no value__ field."</Message>
+ <Comment> Enum has no "value__" field. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131262">
+ <SymbolicName>VLDTR_E_TD_ENUMVALSTATIC</SymbolicName>
+ <Message>"Enum's value__ field is static."</Message>
+ <Comment> Enum's "value__" field is static. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131263">
+ <SymbolicName>VLDTR_E_TD_ENUMVALNOTSN</SymbolicName>
+ <Message>"Enum's value__ field is not SpecialName."</Message>
+ <Comment> Enum's "value__" field is not SpecialName. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131264">
+ <SymbolicName>VLDTR_E_TD_ENUMFLDNOTST</SymbolicName>
+ <Message>"Enum's field is not static."</Message>
+ <Comment> Enum's field is not static. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131265">
+ <SymbolicName>VLDTR_E_TD_ENUMFLDNOTLIT</SymbolicName>
+ <Message>"Enum's field is not literal."</Message>
+ <Comment> Enum's field is not literal. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131266">
+ <SymbolicName>VLDTR_E_TD_ENUMNOLITFLDS</SymbolicName>
+ <Message>"Enum has no literal fields."</Message>
+ <Comment> Enum has no literal fields. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131267">
+ <SymbolicName>VLDTR_E_TD_ENUMFLDSIGMISMATCH</SymbolicName>
+ <Message>"Enum's field signature does not match value__ signature."</Message>
+ <Comment> Enum's field sig does not match value__ sig. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131268">
+ <SymbolicName>VLDTR_E_TD_ENUMVALNOT1ST</SymbolicName>
+ <Message>"Enum's value__ field is not first."</Message>
+ <Comment> Enum's "value__" field is not first. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131269">
+ <SymbolicName>VLDTR_E_FD_NOTVALUERTSN</SymbolicName>
+ <Message>"Field is RTSpecialName but name is not value__."</Message>
+ <Comment> Field is RTSpecialName but name is not "value__". </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013126a">
+ <SymbolicName>VLDTR_E_FD_VALUEPARNOTENUM</SymbolicName>
+ <Message>"Field value__ in not Enum class."</Message>
+ <Comment> Field "value__" in not Enum class. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013126b">
+ <SymbolicName>VLDTR_E_FD_INSTINIFACE</SymbolicName>
+ <Message>"Instance field in interface."</Message>
+ <Comment> Instance field in interface. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013126c">
+ <SymbolicName>VLDTR_E_FD_NOTPUBINIFACE</SymbolicName>
+ <Message>"Non-public field in interface."</Message>
+ <Comment> Non-public field in interface. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013126d">
+ <SymbolicName>VLDTR_E_FMD_GLOBALNOTPUBPRIVSC</SymbolicName>
+ <Message>"Global field or method is neither Public nor PrivateScope."</Message>
+ <Comment> Global field/method neither Public nor PrivateScope. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013126e">
+ <SymbolicName>VLDTR_E_FMD_GLOBALNOTSTATIC</SymbolicName>
+ <Message>"Global field or method is not static."</Message>
+ <Comment> Global field/method not static. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013126f">
+ <SymbolicName>VLDTR_E_FD_GLOBALNORVA</SymbolicName>
+ <Message>"Global field has no RVA."</Message>
+ <Comment> Global field has no RVA. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131270">
+ <SymbolicName>VLDTR_E_MD_CTORZERORVA</SymbolicName>
+ <Message>".ctor or .cctor has zero RVA."</Message>
+ <Comment> .ctor,.cctor has zero RVA. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131271">
+ <SymbolicName>VLDTR_E_FD_MARKEDNOMARSHAL</SymbolicName>
+ <Message>"Field is marked marshaled but has no marshaling record."</Message>
+ <Comment> Field is marked marshaled but has no marshaling rec. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131272">
+ <SymbolicName>VLDTR_E_FD_MARSHALNOTMARKED</SymbolicName>
+ <Message>"Field has marshaling record but is not marked marshaled."</Message>
+ <Comment> Field has marshaling rec but is not marked marshaled. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131273">
+ <SymbolicName>VLDTR_E_FD_MARKEDNODEFLT</SymbolicName>
+ <Message>"Field is marked HasDefault but has no const value."</Message>
+ <Comment> Field is marked HasDefault but has no const value. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131274">
+ <SymbolicName>VLDTR_E_FD_DEFLTNOTMARKED</SymbolicName>
+ <Message>"Field has const value record but is not marked HasDefault."</Message>
+ <Comment> Field has const value rec but is not marked HasDefault. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131275">
+ <SymbolicName>VLDTR_E_FMD_MARKEDNOSECUR</SymbolicName>
+ <Message>"Field or method is marked HasSecurity but has no security record."</Message>
+ <Comment> Field/method is marked HasSecurity but has no security rec. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131276">
+ <SymbolicName>VLDTR_E_FMD_SECURNOTMARKED</SymbolicName>
+ <Message>"Field or method has security record but is not marked HasSecurity."</Message>
+ <Comment> Field/method has security rec but is not marked HasSecurity. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131277">
+ <SymbolicName>VLDTR_E_FMD_PINVOKENOTSTATIC</SymbolicName>
+ <Message>"Field or method is PInvoke but is not marked Static."</Message>
+ <Comment> Field/method is PInvoke but is not marked Static. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131278">
+ <SymbolicName>VLDTR_E_FMD_MARKEDNOPINVOKE</SymbolicName>
+ <Message>"Field or method is marked PInvoke but has no ImplMap."</Message>
+ <Comment> Field/method is marked PInvoke but has no ImplMap. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131279">
+ <SymbolicName>VLDTR_E_FMD_PINVOKENOTMARKED</SymbolicName>
+ <Message>"Field or method has ImplMap but is not marked PInvoke."</Message>
+ <Comment> Field/method has ImplMap but is not marked PInvoke. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013127a">
+ <SymbolicName>VLDTR_E_FMD_BADIMPLMAP</SymbolicName>
+ <Message>"Field or method has invalid ImplMap."</Message>
+ <Comment> Field/method has invalid ImplMap </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013127b">
+ <SymbolicName>VLDTR_E_IMAP_BADMODREF</SymbolicName>
+ <Message>"ImplMap has invalid ModuleRef."</Message>
+ <Comment> ImplMap has invalid ModuleRef </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013127c">
+ <SymbolicName>VLDTR_E_IMAP_BADMEMBER</SymbolicName>
+ <Message>"ImplMap has invalid MemberForwarded."</Message>
+ <Comment> ImplMap has invalid MemberForwarded </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013127d">
+ <SymbolicName>VLDTR_E_IMAP_BADIMPORTNAME</SymbolicName>
+ <Message>"ImplMap has invalid ImportName."</Message>
+ <Comment> ImplMap has invalid ImportName </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013127e">
+ <SymbolicName>VLDTR_E_IMAP_BADCALLCONV</SymbolicName>
+ <Message>"ImplMap has invalid call conv."</Message>
+ <Comment> ImplMap has invalid call conv </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013127f">
+ <SymbolicName>VLDTR_E_FMD_BADACCESSFLAG</SymbolicName>
+ <Message>"Field or method has invalid access flag."</Message>
+ <Comment> Field/method has invalid access flag </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131280">
+ <SymbolicName>VLDTR_E_FD_INITONLYANDLITERAL</SymbolicName>
+ <Message>"Field is InitOnly and Literal."</Message>
+ <Comment> Field is InitOnly and Literal </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131281">
+ <SymbolicName>VLDTR_E_FD_LITERALNOTSTATIC</SymbolicName>
+ <Message>"Field is Literal but not Static."</Message>
+ <Comment> Field is Literal but not Static </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131282">
+ <SymbolicName>VLDTR_E_FMD_RTSNNOTSN</SymbolicName>
+ <Message>"Field or method is RTSpec.Name but not Spec.Name."</Message>
+ <Comment> Field/method is RTSpec.Name but not Spec.Name </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131283">
+ <SymbolicName>VLDTR_E_MD_ABSTPARNOTABST</SymbolicName>
+ <Message>"Method is abstract, parent is not."</Message>
+ <Comment> Method is abstract, parent is not </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131284">
+ <SymbolicName>VLDTR_E_MD_NOTSTATABSTININTF</SymbolicName>
+ <Message>"Method not static or abstract in interface."</Message>
+ <Comment> Method not static or abstract in interface </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131285">
+ <SymbolicName>VLDTR_E_MD_NOTPUBININTF</SymbolicName>
+ <Message>"Method not public in interface."</Message>
+ <Comment> Method not public in interface </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131286">
+ <SymbolicName>VLDTR_E_MD_CTORININTF</SymbolicName>
+ <Message>".ctor in interface."</Message>
+ <Comment> ctor in interface </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131287">
+ <SymbolicName>VLDTR_E_MD_GLOBALCTORCCTOR</SymbolicName>
+ <Message>"global .ctor or .cctor."</Message>
+ <Comment> global ctor or cctor </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131288">
+ <SymbolicName>VLDTR_E_MD_CTORSTATIC</SymbolicName>
+ <Message>"static .ctor."</Message>
+ <Comment> static ctor </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131289">
+ <SymbolicName>VLDTR_E_MD_CTORNOTSNRTSN</SymbolicName>
+ <Message>".ctor or .cctor not marked SpecialName or RTSpecialName."</Message>
+ <Comment> ctor,cctor not marked SpecialName,RTSpecialName </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013128a">
+ <SymbolicName>VLDTR_E_MD_CTORVIRT</SymbolicName>
+ <Message>"virtual .ctor or .cctor."</Message>
+ <Comment> virtual ctor,cctor </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013128b">
+ <SymbolicName>VLDTR_E_MD_CTORABST</SymbolicName>
+ <Message>"abstract .ctor or .cctor."</Message>
+ <Comment> abstract ctor,cctor </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013128c">
+ <SymbolicName>VLDTR_E_MD_CCTORNOTSTATIC</SymbolicName>
+ <Message>"instance .cctor."</Message>
+ <Comment> instance cctor </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013128d">
+ <SymbolicName>VLDTR_E_MD_ZERORVA</SymbolicName>
+ <Message>"RVA set to zero, but method not abstract or pinvoke or runtime, or reverse."</Message>
+ <Comment> RVA=0, method not abstract or pinvoke or runtime, or reverse </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013128e">
+ <SymbolicName>VLDTR_E_MD_FINNOTVIRT</SymbolicName>
+ <Message>"Method is final and not virtual."</Message>
+ <Comment> Method is final and not virtual </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013128f">
+ <SymbolicName>VLDTR_E_MD_STATANDFINORVIRT</SymbolicName>
+ <Message>"Method is static and final or virtual."</Message>
+ <Comment> Method is static and final or virtual </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131290">
+ <SymbolicName>VLDTR_E_MD_ABSTANDFINAL</SymbolicName>
+ <Message>"Method is abstract and final."</Message>
+ <Comment> Method is abstract and final </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131291">
+ <SymbolicName>VLDTR_E_MD_ABSTANDIMPL</SymbolicName>
+ <Message>"Method is abstract and implemented."</Message>
+ <Comment> Method is abstract and implemented </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131292">
+ <SymbolicName>VLDTR_E_MD_ABSTANDPINVOKE</SymbolicName>
+ <Message>"Method is abstract and pinvoke."</Message>
+ <Comment> Method is abstract and pinvoke </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131293">
+ <SymbolicName>VLDTR_E_MD_ABSTNOTVIRT</SymbolicName>
+ <Message>"Method is abstract and not virtual."</Message>
+ <Comment> Method is abstract and not virtual </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131294">
+ <SymbolicName>VLDTR_E_MD_NOTABSTNOTIMPL</SymbolicName>
+ <Message>"Method is not abstract and not implemented."</Message>
+ <Comment> Method is not abstract and not implemented </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131295">
+ <SymbolicName>VLDTR_E_MD_NOTABSTBADFLAGSRVA</SymbolicName>
+ <Message>"Method is not abstract and not (non-zero RVA or PInvoke or runtime)."</Message>
+ <Comment> Method is not abstract and not (RVA!=0 or pinvoke or runtime) </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131296">
+ <SymbolicName>VLDTR_E_MD_PRIVSCOPENORVA</SymbolicName>
+ <Message>"Method is PrivateScope and has RVA set to zero."</Message>
+ <Comment> Method is PrivateScope and has RVA==0 </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131297">
+ <SymbolicName>VLDTR_E_MD_GLOBALABSTORVIRT</SymbolicName>
+ <Message>"Global method is abstract or virtual."</Message>
+ <Comment> Global method is abstract or virtual </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131298">
+ <SymbolicName>VLDTR_E_SIG_LONGFORM</SymbolicName>
+ <Message>"Signature uses long form."</Message>
+ <Comment> Signature uses long form </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131299">
+ <SymbolicName>VLDTR_E_MD_MULTIPLESEMANTICS</SymbolicName>
+ <Message>"Method has multiple semantics (warning)."</Message>
+ <Comment> Method has multiple semantics (warning) </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013129a">
+ <SymbolicName>VLDTR_E_MD_INVALIDSEMANTICS</SymbolicName>
+ <Message>"Method has invalid semantics (not event or property.)"</Message>
+ <Comment> Method has invalid semantics (not event or prop) </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013129b">
+ <SymbolicName>VLDTR_E_MD_SEMANTICSNOTEXIST</SymbolicName>
+ <Message>"Method has semantics association that does not exist."</Message>
+ <Comment> Method has semantics assoc that does not exist </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013129c">
+ <SymbolicName>VLDTR_E_MI_DECLNOTVIRT</SymbolicName>
+ <Message>"MethodImpl's Decl is not virtual."</Message>
+ <Comment> MethodImpl's Decl is not virtual </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013129d">
+ <SymbolicName>VLDTR_E_FMD_GLOBALITEM</SymbolicName>
+ <Message>"Global field or method (warning, CLS)."</Message>
+ <Comment> Global field/method (warning,CLS) </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013129e">
+ <SymbolicName>VLDTR_E_MD_MULTSEMANTICFLAGS</SymbolicName>
+ <Message>"Method has multiple semantic flags set."</Message>
+ <Comment> Method has multiple semantic flags set </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013129f">
+ <SymbolicName>VLDTR_E_MD_NOSEMANTICFLAGS</SymbolicName>
+ <Message>"Method has no semantic flags set."</Message>
+ <Comment> Method has no semantic flags set </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312a0">
+ <SymbolicName>VLDTR_E_FD_FLDINIFACE</SymbolicName>
+ <Message>"Field in Interface (warning, CLS)."</Message>
+ <Comment> Field in Interface (warning, CLS) </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312a1">
+ <SymbolicName>VLDTR_E_AS_HASHALGID</SymbolicName>
+ <Message>"Unrecognized Hash Alg ID (warning)."</Message>
+ <Comment> Unrecognized Hash Alg ID (warning) </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312a2">
+ <SymbolicName>VLDTR_E_AS_PROCID</SymbolicName>
+ <Message>"Unrecognized Processor ID in Assembly(warning)."</Message>
+ <Comment> Unrecognized Processor ID in Assembly(warning) </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312a3">
+ <SymbolicName>VLDTR_E_AR_PROCID</SymbolicName>
+ <Message>"Unrecognized Processor ID in AssemblyRef(warning)."</Message>
+ <Comment> Unrecognized Processor ID in AssemblyRef(warning) </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312a4">
+ <SymbolicName>VLDTR_E_CN_PARENTRANGE</SymbolicName>
+ <Message>"Constant: parent token out of range."</Message>
+ <Comment> Constant: parent token out of range </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312a5">
+ <SymbolicName>VLDTR_E_AS_BADFLAGS</SymbolicName>
+ <Message>"Invalid flags in Assembly."</Message>
+ <Comment> Invalid flags in Assembly </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312a6">
+ <SymbolicName>VLDTR_E_TR_HASTYPEDEF</SymbolicName>
+ <Message>"There is TypeDef with same name as TypeRef (warning)."</Message>
+ <Comment> There is TypeDef with same name as TypeRef (warning) </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312a7">
+ <SymbolicName>VLDTR_E_IFACE_BADIMPL</SymbolicName>
+ <Message>"In InterfaceImpl, the implementing token is not TypeDef."</Message>
+ <Comment> In InterfaceImpl, the implementing token is not TypeDef </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312a8">
+ <SymbolicName>VLDTR_E_IFACE_BADIFACE</SymbolicName>
+ <Message>"In InterfaceImpl, the implemented token is not TypeDef or TypeRef."</Message>
+ <Comment> In InterfaceImpl, the implemented token is not TypeDef or TypeRef </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312a9">
+ <SymbolicName>VLDTR_E_TD_SECURNOTMARKED</SymbolicName>
+ <Message>"TypeDef has security record but it is not marked HasSecurity."</Message>
+ <Comment> TypeDef has security rec but not marked HasSecurity </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312aa">
+ <SymbolicName>VLDTR_E_TD_MARKEDNOSECUR</SymbolicName>
+ <Message>"TypeDef marked HasSecurity but has no security record."</Message>
+ <Comment> TypeDef marked HasSecurity but has no security rec </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312ab">
+ <SymbolicName>VLDTR_E_MD_CCTORHASARGS</SymbolicName>
+ <Message>".cctor has arguments."</Message>
+ <Comment> .cctor has arguments </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312ac">
+ <SymbolicName>VLDTR_E_CT_BADIMPL</SymbolicName>
+ <Message>"ExportedType has invalid Implementation."</Message>
+ <Comment> ExportedType has invalid Implementation </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312ad">
+ <SymbolicName>VLDTR_E_MI_ALIENBODY</SymbolicName>
+ <Message>"MethodImpl has body from other class."</Message>
+ <Comment> MethodImpl has body from other class </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312ae">
+ <SymbolicName>VLDTR_E_MD_CCTORCALLCONV</SymbolicName>
+ <Message>".cctor has invalid calling convention."</Message>
+ <Comment> .cctor has invalid calling convention </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312af">
+ <SymbolicName>VLDTR_E_MI_BADCLASS</SymbolicName>
+ <Message>"MethodImpl has invalid Class token."</Message>
+ <Comment> MethodImpl has invalid Class token </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312b0">
+ <SymbolicName>VLDTR_E_MI_CLASSISINTF</SymbolicName>
+ <Message>"MethodImpl declared in Interface."</Message>
+ <Comment> MethodImpl declared in Interface </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312b1">
+ <SymbolicName>VLDTR_E_MI_BADDECL</SymbolicName>
+ <Message>"MethodImpl has invalid MethodDeclaration token."</Message>
+ <Comment> MethodImpl has invalid MethodDeclaration token </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312b2">
+ <SymbolicName>VLDTR_E_MI_BADBODY</SymbolicName>
+ <Message>"MethodImpl has invalid MethodBody token."</Message>
+ <Comment> MethodImpl has invalid MethodBody token </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312b3">
+ <SymbolicName>VLDTR_E_MI_DUP</SymbolicName>
+ <Message>"MethodImpl has duplicate."</Message>
+ <Comment> MethodImpl has duplicate </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312b4">
+ <SymbolicName>VLDTR_E_FD_BADPARENT</SymbolicName>
+ <Message>"Bad field parent."</Message>
+ <Comment> Bad field parent </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312b5">
+ <SymbolicName>VLDTR_E_MD_PARAMOUTOFSEQ</SymbolicName>
+ <Message>"Parameter out of sequence (warning)."</Message>
+ <Comment> Param out of sequence (warning) </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312b6">
+ <SymbolicName>VLDTR_E_MD_PARASEQTOOBIG</SymbolicName>
+ <Message>"Parameter's sequence number exceeds number of arguments."</Message>
+ <Comment> Param's sequence num exceeds num of args </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312b7">
+ <SymbolicName>VLDTR_E_MD_PARMMARKEDNOMARSHAL</SymbolicName>
+ <Message>"Parameter marked HasMarshal, has no marshaling info."</Message>
+ <Comment> Param marked HasMarshal, has no marshaling info </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312b8">
+ <SymbolicName>VLDTR_E_MD_PARMMARSHALNOTMARKED</SymbolicName>
+ <Message>"Parameter has marshaling info, not marked HasMarshal."</Message>
+ <Comment> Param has marshaling info, not marked HasMarshal </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312ba">
+ <SymbolicName>VLDTR_E_MD_PARMMARKEDNODEFLT</SymbolicName>
+ <Message>"Parameter marked HasDefault, has no const value."</Message>
+ <Comment> Param marked HasDefault, has no const value </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312bb">
+ <SymbolicName>VLDTR_E_MD_PARMDEFLTNOTMARKED</SymbolicName>
+ <Message>"Parameter has const value, not marked HasDefault."</Message>
+ <Comment> Param has const value, not marked HasDefault </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312bc">
+ <SymbolicName>VLDTR_E_PR_BADSCOPE</SymbolicName>
+ <Message>"Property has invalid scope."</Message>
+ <Comment> Prop has invalid scope </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312bd">
+ <SymbolicName>VLDTR_E_PR_NONAME</SymbolicName>
+ <Message>"Property has no name."</Message>
+ <Comment> Prop has no name </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312be">
+ <SymbolicName>VLDTR_E_PR_NOSIG</SymbolicName>
+ <Message>"Property has no signature."</Message>
+ <Comment> Prop has no signature </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312bf">
+ <SymbolicName>VLDTR_E_PR_DUP</SymbolicName>
+ <Message>"Property has a duplicate."</Message>
+ <Comment> Prop has a duplicate </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312c0">
+ <SymbolicName>VLDTR_E_PR_BADCALLINGCONV</SymbolicName>
+ <Message>"Property has bad calling convention."</Message>
+ <Comment> Prop has bad calling convention </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312c1">
+ <SymbolicName>VLDTR_E_PR_MARKEDNODEFLT</SymbolicName>
+ <Message>"Property marked HasDefault, has no const value."</Message>
+ <Comment> Prop marked HasDefault, has no const value </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312c2">
+ <SymbolicName>VLDTR_E_PR_DEFLTNOTMARKED</SymbolicName>
+ <Message>"Property has const value, not marked HasDefault."</Message>
+ <Comment> Prop has const value, not marked HasDefault </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312c3">
+ <SymbolicName>VLDTR_E_PR_BADSEMANTICS</SymbolicName>
+ <Message>"Property has method that is neither a Setter nor a Getter."</Message>
+ <Comment> Prop has method not (Setter,Getter, or Other) </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312c4">
+ <SymbolicName>VLDTR_E_PR_BADMETHOD</SymbolicName>
+ <Message>"Property has method with invalid token."</Message>
+ <Comment> Prop has method with invalid token </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312c5">
+ <SymbolicName>VLDTR_E_PR_ALIENMETHOD</SymbolicName>
+ <Message>"Property has method from another class."</Message>
+ <Comment> Prop has method from another class </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312c6">
+ <SymbolicName>VLDTR_E_CN_BLOBNOTNULL</SymbolicName>
+ <Message>"Const has non-null blob when it should not."</Message>
+ <Comment> Const has non-null blob when it should not </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312c7">
+ <SymbolicName>VLDTR_E_CN_BLOBNULL</SymbolicName>
+ <Message>"Const has null value blob."</Message>
+ <Comment> Const has null value blob </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312c8">
+ <SymbolicName>VLDTR_E_EV_BADSCOPE</SymbolicName>
+ <Message>"Event has invalid scope."</Message>
+ <Comment> Event has invalid scope </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312ca">
+ <SymbolicName>VLDTR_E_EV_NONAME</SymbolicName>
+ <Message>"Event has no name."</Message>
+ <Comment> Event has no name </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312cb">
+ <SymbolicName>VLDTR_E_EV_DUP</SymbolicName>
+ <Message>"Event has a duplicate."</Message>
+ <Comment> Event has a duplicate </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312cc">
+ <SymbolicName>VLDTR_E_EV_BADEVTYPE</SymbolicName>
+ <Message>"Event has invalid EventType."</Message>
+ <Comment> Event has invalid EventType </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312cd">
+ <SymbolicName>VLDTR_E_EV_EVTYPENOTCLASS</SymbolicName>
+ <Message>"Event's EventType is not a class."</Message>
+ <Comment> Event's EventType is not a class </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312ce">
+ <SymbolicName>VLDTR_E_EV_BADSEMANTICS</SymbolicName>
+ <Message>"Event has method not (AddOn,RemoveOn,Fire,Other)."</Message>
+ <Comment> Event has method not (AddOn,RemoveOn,Fire,Other) </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312cf">
+ <SymbolicName>VLDTR_E_EV_BADMETHOD</SymbolicName>
+ <Message>"Event has method with invalid token."</Message>
+ <Comment> Event has method with invalid token </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312d0">
+ <SymbolicName>VLDTR_E_EV_ALIENMETHOD</SymbolicName>
+ <Message>"Event has method from another class."</Message>
+ <Comment> Event has method from another class </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312d1">
+ <SymbolicName>VLDTR_E_EV_NOADDON</SymbolicName>
+ <Message>"Event has no AddOn method."</Message>
+ <Comment> Event has no AddOn method </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312d2">
+ <SymbolicName>VLDTR_E_EV_NOREMOVEON</SymbolicName>
+ <Message>"Event has no RemoveOn method."</Message>
+ <Comment> Event has no RemoveOn method </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312d3">
+ <SymbolicName>VLDTR_E_CT_DUPTDNAME</SymbolicName>
+ <Message>"ExportedType has same name as TypeDef."</Message>
+ <Comment> ExportedType has same name as TypeDef </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312d4">
+ <SymbolicName>VLDTR_E_MAR_BADOFFSET</SymbolicName>
+ <Message>"MRes refers to non-PE file with non-zero offset."</Message>
+ <Comment> MRes refers to non-PE file with offset !=0 </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312d5">
+ <SymbolicName>VLDTR_E_DS_BADOWNER</SymbolicName>
+ <Message>"Declarative security has invalid owner token."</Message>
+ <Comment> Decl.security has invalid owner token </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312d6">
+ <SymbolicName>VLDTR_E_DS_BADFLAGS</SymbolicName>
+ <Message>"Declarative security has invalid action flags."</Message>
+ <Comment> Decl.security has invalid action flags </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312d7">
+ <SymbolicName>VLDTR_E_DS_NOBLOB</SymbolicName>
+ <Message>"Declarative security has no permission blob."</Message>
+ <Comment> Decl.security has no permission blob </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312d8">
+ <SymbolicName>VLDTR_E_MAR_BADIMPL</SymbolicName>
+ <Message>"Manifest resource has invalid Implementation."</Message>
+ <Comment> Manifest resource has invalid Implementation </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312da">
+ <SymbolicName>VLDTR_E_MR_VARARGCALLINGCONV</SymbolicName>
+ <Message>"MemberRef has VARARG calling conv. (CLS warning)."</Message>
+ <Comment> MemberRef has VARARG calling conv. (CLS warning) </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312db">
+ <SymbolicName>VLDTR_E_MD_CTORNOTVOID</SymbolicName>
+ <Message>".ctor or .cctor returns something other than void."</Message>
+ <Comment> .ctor,.cctor returning not void </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312dc">
+ <SymbolicName>VLDTR_E_EV_FIRENOTVOID</SymbolicName>
+ <Message>"Fire method returns something other than void."</Message>
+ <Comment> Fire method returning not void </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312dd">
+ <SymbolicName>VLDTR_E_AS_BADLOCALE</SymbolicName>
+ <Message>"Invalid locale."</Message>
+ <Comment> Invalid locale </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312de">
+ <SymbolicName>VLDTR_E_CN_PARENTTYPE</SymbolicName>
+ <Message>"Constant has parent of invalid type."</Message>
+ <Comment> Constant has parent of invalid type </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312df">
+ <SymbolicName>VLDTR_E_SIG_SENTINMETHODDEF</SymbolicName>
+ <Message>"E_T_SENTINEL in MethodDef signature."</Message>
+ <Comment> E_T_SENTINEL in MethodDef signature </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312e0">
+ <SymbolicName>VLDTR_E_SIG_SENTMUSTVARARG</SymbolicName>
+ <Message>"E_T_SENTINEL &lt;=&gt; VARARG."</Message>
+ <Comment> E_T_SENTINEL &lt;=&gt; VARARG </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312e1">
+ <SymbolicName>VLDTR_E_SIG_MULTSENTINELS</SymbolicName>
+ <Message>"Multiple E_T_SENTINELs."</Message>
+ <Comment> Multiple E_T_SENTINELs </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312e2">
+ <SymbolicName>VLDTR_E_SIG_LASTSENTINEL</SymbolicName>
+ <Message>"E_T_SENTINEL not followed by type."</Message>
+ <Comment> E_T_SENTINEL not followed by type </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312e3">
+ <SymbolicName>VLDTR_E_SIG_MISSARG</SymbolicName>
+ <Message>"Signature missing argument."</Message>
+ <Comment> Signature missing argument </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312e4">
+ <SymbolicName>VLDTR_E_SIG_BYREFINFIELD</SymbolicName>
+ <Message>"Field of ByRef type."</Message>
+ <Comment> Field of ByRef type </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312e5">
+ <SymbolicName>VLDTR_E_MD_SYNCMETHODINVTYPE</SymbolicName>
+ <Message>"Synchronized method in value class."</Message>
+ <Comment> Synchronized method in value class </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312e6">
+ <SymbolicName>VLDTR_E_TD_NAMETOOLONG</SymbolicName>
+ <Message>"TypeDef name too long."</Message>
+ <Comment> TypeDef name too long </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312e7">
+ <SymbolicName>VLDTR_E_AS_PROCDUP</SymbolicName>
+ <Message>"Duplicate Assembly Processor."</Message>
+ <Comment> Duplicate Assembly Processor </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312e8">
+ <SymbolicName>VLDTR_E_ASOS_DUP</SymbolicName>
+ <Message>"Duplicate Assembly OS (ID+ver.major+ver.minor)."</Message>
+ <Comment> Duplicate Assembly OS (ID+ver.major+ver.minor) </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312e9">
+ <SymbolicName>VLDTR_E_MAR_BADFLAGS</SymbolicName>
+ <Message>"Manifest Resource has bad flags."</Message>
+ <Comment> Manifest Resource has bad flags </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312ea">
+ <SymbolicName>VLDTR_E_CT_NOTYPEDEFID</SymbolicName>
+ <Message>"ExportedType has nil TypeDefId."</Message>
+ <Comment> ExportedType has nil TypeDefId </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312eb">
+ <SymbolicName>VLDTR_E_FILE_BADFLAGS</SymbolicName>
+ <Message>"File has bad flags."</Message>
+ <Comment> File has bad flags </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312ec">
+ <SymbolicName>VLDTR_E_FILE_NULLHASH</SymbolicName>
+ <Message>"File has no hash blob."</Message>
+ <Comment> File has no hash blob </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312ed">
+ <SymbolicName>VLDTR_E_MOD_NONAME</SymbolicName>
+ <Message>"Module has no name."</Message>
+ <Comment> Module has no name </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312ee">
+ <SymbolicName>VLDTR_E_MOD_NAMEFULLQLFD</SymbolicName>
+ <Message>"Module has fully-qualified name."</Message>
+ <Comment> Module has fully-qualified name </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312ef">
+ <SymbolicName>VLDTR_E_TD_RTSPCLNOTSPCL</SymbolicName>
+ <Message>"TypeDef is tdRTSpecialName but not tdSpecialName."</Message>
+ <Comment> TypeDef is tdRTSpecialName but not tdSpecialName </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312f0">
+ <SymbolicName>VLDTR_E_TD_EXTENDSIFACE</SymbolicName>
+ <Message>"TypeDef extends interface."</Message>
+ <Comment> TypeDef extends interface </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312f1">
+ <SymbolicName>VLDTR_E_MD_CTORPINVOKE</SymbolicName>
+ <Message>".ctor or .cctor is PInvokeImpl."</Message>
+ <Comment> .ctor,.cctor is PInvokeImpl </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312f2">
+ <SymbolicName>VLDTR_E_TD_SYSENUMNOTCLASS</SymbolicName>
+ <Message>"System.Enum is not a class."</Message>
+ <Comment> System.Enum is not a class </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312f3">
+ <SymbolicName>VLDTR_E_TD_SYSENUMNOTEXTVTYPE</SymbolicName>
+ <Message>"System.Enum extends not System.ValueType."</Message>
+ <Comment> System.Enum extends not System.ValueType </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312f4">
+ <SymbolicName>VLDTR_E_MI_SIGMISMATCH</SymbolicName>
+ <Message>"MethodImpl's Decl and Body signatures mismatch."</Message>
+ <Comment> MethodImpl's Decl and Body signatures mismatch </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312f5">
+ <SymbolicName>VLDTR_E_TD_ENUMHASMETHODS</SymbolicName>
+ <Message>"TypeDef extends System.Enum but has methods."</Message>
+ <Comment> TypeDef extends System.Enum but has methods </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312f6">
+ <SymbolicName>VLDTR_E_TD_ENUMIMPLIFACE</SymbolicName>
+ <Message>"TypeDef extends System.Enum but implements an interface."</Message>
+ <Comment> TypeDef extends System.Enum but impls interface(s) </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312f7">
+ <SymbolicName>VLDTR_E_TD_ENUMHASPROP</SymbolicName>
+ <Message>"TypeDef extends System.Enum but has a property."</Message>
+ <Comment> TypeDef extends System.Enum but has prop(s) </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312f8">
+ <SymbolicName>VLDTR_E_TD_ENUMHASEVENT</SymbolicName>
+ <Message>"TypeDef extends System.Enum but has an event."</Message>
+ <Comment> TypeDef extends System.Enum but has event(s) </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312f9">
+ <SymbolicName>VLDTR_E_TD_BADMETHODLST</SymbolicName>
+ <Message>"TypeDef has MethodList &gt; Nmethods+1."</Message>
+ <Comment> TypeDef has MethodList &gt; Nmethods+1 </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312fa">
+ <SymbolicName>VLDTR_E_TD_BADFIELDLST</SymbolicName>
+ <Message>"TypeDef has FieldList &gt; Nfields+1."</Message>
+ <Comment> TypeDef has FieldList &gt; Nfields+1 </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312fb">
+ <SymbolicName>VLDTR_E_CN_BADTYPE</SymbolicName>
+ <Message>"Constant has wrong type."</Message>
+ <Comment> Constant has wrong type </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312fc">
+ <SymbolicName>VLDTR_E_TD_ENUMNOINSTFLD</SymbolicName>
+ <Message>"Enum has no instance fields."</Message>
+ <Comment> Enum has no instance fields </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312fd">
+ <SymbolicName>VLDTR_E_TD_ENUMMULINSTFLD</SymbolicName>
+ <Message>"Enum has multiple instance fields."</Message>
+ <Comment> Enum has multiple instance fields </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312fe">
+ <SymbolicName>VLDTR_E_INTERRUPTED</SymbolicName>
+ <Message>"Validator has been interrupted by the VEHandler."</Message>
+ <Comment> Validator has been interrupted by the VEHandler. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x801312ff">
+ <SymbolicName>VLDTR_E_NOTINIT</SymbolicName>
+ <Message>"Validator failed to initialize correctly."</Message>
+ <Comment> Validator failed to initialize correctly. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131300">
+ <SymbolicName>CORDBG_E_UNRECOVERABLE_ERROR</SymbolicName>
+ <Message>"Unrecoverable API error."</Message>
+ <Comment> Unrecoverable API error. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131301">
+ <SymbolicName>CORDBG_E_PROCESS_TERMINATED</SymbolicName>
+ <Message>"Process was terminated."</Message>
+ <Comment> Process was terminated. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131302">
+ <SymbolicName>CORDBG_E_PROCESS_NOT_SYNCHRONIZED</SymbolicName>
+ <Message>"Process not synchronized."</Message>
+ <Comment> Process not synchronized. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131303">
+ <SymbolicName>CORDBG_E_CLASS_NOT_LOADED</SymbolicName>
+ <Message>"A class is not loaded."</Message>
+ <Comment> A class is not loaded. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131304">
+ <SymbolicName>CORDBG_E_IL_VAR_NOT_AVAILABLE</SymbolicName>
+ <Message>"An IL variable is not available at the current native IP."</Message>
+ <Comment> An IL variable is not available at the </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131305">
+ <SymbolicName>CORDBG_E_BAD_REFERENCE_VALUE</SymbolicName>
+ <Message>"A reference value was found to be bad during dereferencing."</Message>
+ <Comment> A reference value was found to be bad </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131306">
+ <SymbolicName>CORDBG_E_FIELD_NOT_AVAILABLE</SymbolicName>
+ <Message>"A field in a class is not available, because the runtime optimized it away."</Message>
+ <Comment> A field in a class is not available, </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131307">
+ <SymbolicName>CORDBG_E_NON_NATIVE_FRAME</SymbolicName>
+ <Message>"'Native-frame-only' operation on non-native frame."</Message>
+ <Comment> "Native frame only" operation on </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131308">
+ <SymbolicName>CORDBG_E_NONCONTINUABLE_EXCEPTION</SymbolicName>
+ <Message>"Cannot Continue on non-continuable exception."</Message>
+ <Comment> Continue on non-continuable exception </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131309">
+ <SymbolicName>CORDBG_E_CODE_NOT_AVAILABLE</SymbolicName>
+ <Message>"The code is currently unavailable."</Message>
+ <Comment> The code is currently unavailable </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013130a">
+ <SymbolicName>CORDBG_E_FUNCTION_NOT_IL</SymbolicName>
+ <Message>"Attempt to get a ICorDebugFunction for a function that is not IL."</Message>
+ <Comment> Attempt to get a ICorDebugFunction for </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013130e">
+ <SymbolicName>CORDBG_E_CANT_SET_IP_INTO_FINALLY</SymbolicName>
+ <Message>"SetIP is not possible because SetIP would move EIP from outside of an exception handling finally clause to a point inside of one."</Message>
+ <Comment> SetIP isn't possible, because SetIP would </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013130f">
+ <SymbolicName>CORDBG_E_CANT_SET_IP_OUT_OF_FINALLY</SymbolicName>
+ <Message>"SetIP is not possible because it would move EIP from within an exception handling finally clause to a point outside of one."</Message>
+ <Comment> SetIP isn't possible because it would move </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131310">
+ <SymbolicName>CORDBG_E_CANT_SET_IP_INTO_CATCH</SymbolicName>
+ <Message>"SetIP is not possible, because SetIP would move EIP from outside of an exception handling catch clause to a point inside of one."</Message>
+ <Comment> SetIP isn't possible, because SetIP would </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131311">
+ <SymbolicName>CORDBG_E_SET_IP_NOT_ALLOWED_ON_NONLEAF_FRAME</SymbolicName>
+ <Message>"SetIP cannot be done on any frame except the leaf frame."</Message>
+ <Comment> Setip cannot be done on any frame except </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131312">
+ <SymbolicName>CORDBG_E_SET_IP_IMPOSSIBLE</SymbolicName>
+ <Message>"SetIP is not allowed."</Message>
+ <Comment> SetIP isn't allowed. For example, there is </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131313">
+ <SymbolicName>CORDBG_E_FUNC_EVAL_BAD_START_POINT</SymbolicName>
+ <Message>"Func eval cannot work. Bad starting point."</Message>
+ <Comment> Func eval can't work if we're, for example, </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131314">
+ <SymbolicName>CORDBG_E_INVALID_OBJECT</SymbolicName>
+ <Message>"This object value is no longer valid."</Message>
+ <Comment> This object value is no longer valid. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131315">
+ <SymbolicName>CORDBG_E_FUNC_EVAL_NOT_COMPLETE</SymbolicName>
+ <Message>"CordbEval::GetResult called before func eval has finished."</Message>
+ <Comment> If you call CordbEval::GetResult before the </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131318">
+ <SymbolicName>CORDBG_E_INPROC_NOT_IMPL</SymbolicName>
+ <Message>"The in-process version of the debugging API does not support this function."</Message>
+ <Comment> The inproc version of the debugging API </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013131a">
+ <SymbolicName>CORDBG_E_STATIC_VAR_NOT_AVAILABLE</SymbolicName>
+ <Message>"A static variable is not available because it has not been initialized yet."</Message>
+ <Comment> A static variable isn't available because </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013131b">
+ <SymbolicName>CORDBG_E_OBJECT_IS_NOT_COPYABLE_VALUE_CLASS</SymbolicName>
+ <Message>"Cannot copy a VC with object refs in it."</Message>
+ <Comment> Can't copy a VC with object refs in it. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013131c">
+ <SymbolicName>CORDBG_E_CANT_SETIP_INTO_OR_OUT_OF_FILTER</SymbolicName>
+ <Message>"SetIP cannot leave or enter a filter."</Message>
+ <Comment> SetIP can't leave or enter a filter </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013131d">
+ <SymbolicName>CORDBG_E_CANT_CHANGE_JIT_SETTING_FOR_ZAP_MODULE</SymbolicName>
+ <Message>"JIT settings for ZAP modules cannot be changed."</Message>
+ <Comment> You can't change JIT settings for ZAP </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013131e">
+ <SymbolicName>CORDBG_E_CANT_SET_IP_OUT_OF_FINALLY_ON_WIN64</SymbolicName>
+ <Message>"SetIP is not possible because it would move EIP from within a finally clause to a point outside of one on WIN64 platforms."</Message>
+ <Comment> SetIP isn't possible because it would move </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013131f">
+ <SymbolicName>CORDBG_E_CANT_SET_IP_OUT_OF_CATCH_ON_WIN64</SymbolicName>
+ <Message>"SetIP is not possible because it would move EIP from within a catch clause to a point outside of one on WIN64 platforms."</Message>
+ <Comment> SetIP isn't possible because it would move </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131320">
+ <SymbolicName>CORDBG_E_REMOTE_CONNECTION_CONN_RESET</SymbolicName>
+ <Message>"The remote device closed the connection."</Message>
+ <Comment> The remote device closed the connection. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131321">
+ <SymbolicName>CORDBG_E_REMOTE_CONNECTION_KEEP_ALIVE</SymbolicName>
+ <Message>"The connection was closed due to a keep-alive failure."</Message>
+ <Comment> The connection was closed due to akeep alive failure. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131322">
+ <SymbolicName>CORDBG_E_REMOTE_CONNECTION_FATAL_ERROR</SymbolicName>
+ <Message>"Generic error that the device connection has been broken with no chance for recovery."</Message>
+ <Comment> Generic error that the device connection has been broken with no chance for recovery. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131323">
+ <SymbolicName>CORDBG_E_CANT_SET_TO_JMC</SymbolicName>
+ <Message>"Cannot use JMC on this code (likely wrong JIT settings)."</Message>
+ <Comment> Can't use JMC on this code (likely wrong jit settings). </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131325">
+ <SymbolicName>CORDBG_E_NO_CONTEXT_FOR_INTERNAL_FRAME</SymbolicName>
+ <Message>"Internal frame markers have no associated context."</Message>
+ <Comment> Internal frame markers have no associated context. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131326">
+ <SymbolicName>CORDBG_E_NOT_CHILD_FRAME</SymbolicName>
+ <Message>"The current frame is not a child frame."</Message>
+ <Comment> The current frame is not a child frame. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131327">
+ <SymbolicName>CORDBG_E_NON_MATCHING_CONTEXT</SymbolicName>
+ <Message>"The provided CONTEXT does not match the specified thread."</Message>
+ <Comment> The provided CONTEXT does not match the specified thread.
+ The stack pointer in the provided CONTEXT must match the cached stack base and stack limit of the thread.
+ </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131328">
+ <SymbolicName>CORDBG_E_PAST_END_OF_STACK</SymbolicName>
+ <Message>"The stackwalker is now past the end of stack. No information is available."</Message>
+ <Comment> The stackwalker is now past the end of stack. No information is available. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131329">
+ <SymbolicName>CORDBG_E_FUNC_EVAL_CANNOT_UPDATE_REGISTER_IN_NONLEAF_FRAME</SymbolicName>
+ <Message>"Func eval cannot update a variable stored in a register on a non-leaf frame. The most likely cause is that such a variable is passed as a ref/out argument."</Message>
+ <Comment> Func eval cannot update a variable stored in a register on a non-leaf frame. The most likely cause is that such a variable is passed as a ref/out argument. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013132d">
+ <SymbolicName>CORDBG_E_BAD_THREAD_STATE</SymbolicName>
+ <Message>"The state of the thread is invalid."</Message>
+ <Comment> The state of the thread is invalid. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013132e">
+ <SymbolicName>CORDBG_E_DEBUGGER_ALREADY_ATTACHED</SymbolicName>
+ <Message>"This process has already been attached."</Message>
+ <Comment> This process has already been attached to </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013132f">
+ <SymbolicName>CORDBG_E_SUPERFLOUS_CONTINUE</SymbolicName>
+ <Message>"Returned from a call to Continue that was not matched with a stopping event."</Message>
+ <Comment> Returned from a call to Continue that was </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131330">
+ <SymbolicName>CORDBG_E_SET_VALUE_NOT_ALLOWED_ON_NONLEAF_FRAME</SymbolicName>
+ <Message>"Cannot perfrom SetValue on non-leaf frames."</Message>
+ <Comment> Can't perfrom SetValue on non-leaf frames. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131331">
+ <SymbolicName>CORDBG_E_ENC_EH_MAX_NESTING_LEVEL_CANT_INCREASE</SymbolicName>
+ <Message>"When doing Edit and Continue, some JITs do not allow increasing the maximum level to which exception handling can be nested."</Message>
+ <Comment> When doing EnC, some JITters don't let you </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131332">
+ <SymbolicName>CORDBG_E_ENC_MODULE_NOT_ENC_ENABLED</SymbolicName>
+ <Message>"Tried to do Edit and Continue on a module that was not started in Edit and Continue mode."</Message>
+ <Comment> Tried to do EnC on a module that wasn't </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131333">
+ <SymbolicName>CORDBG_E_SET_IP_NOT_ALLOWED_ON_EXCEPTION</SymbolicName>
+ <Message>"SetIP cannot be done on any exception."</Message>
+ <Comment> Setip cannot be done on any exception </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131334">
+ <SymbolicName>CORDBG_E_VARIABLE_IS_ACTUALLY_LITERAL</SymbolicName>
+ <Message>"The 'variable' does not exist because it is a literal optimized away by the compiler."</Message>
+ <Comment> The 'variable' doesn't exist because it is a </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131335">
+ <SymbolicName>CORDBG_E_PROCESS_DETACHED</SymbolicName>
+ <Message>"Process has been detached."</Message>
+ <Comment> Process has been detached from </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131336">
+ <SymbolicName>CORDBG_E_ENC_METHOD_SIG_CHANGED</SymbolicName>
+ <Message>"Not allowed to change the signature of an existing method."</Message>
+ <Comment> Not allowed to change the signature of an </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131337">
+ <SymbolicName>CORDBG_E_ENC_METHOD_NO_LOCAL_SIG</SymbolicName>
+ <Message>"Cannot get the local signature for the method."</Message>
+ <Comment> Can't get the local signature for the method </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131338">
+ <SymbolicName>CORDBG_E_ENC_CANT_ADD_FIELD_TO_VALUE_OR_LAYOUT_CLASS</SymbolicName>
+ <Message>"Adding a field to a value or layout class is prohibited."</Message>
+ <Comment> Adding a field to a value or layout class is prohibitted, </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131339">
+ <SymbolicName>CORDBG_E_ENC_CANT_CHANGE_FIELD</SymbolicName>
+ <Message>"Cannot change field after adding."</Message>
+ <Comment> Once you've got a field, you're not allowed to change </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013133a">
+ <SymbolicName>CORDBG_E_ENC_CANT_ADD_NON_PRIVATE_MEMBER</SymbolicName>
+ <Message>"Only support addition of private members."</Message>
+ <Comment> Only support addition of private members. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013133b">
+ <SymbolicName>CORDBG_E_FIELD_NOT_STATIC</SymbolicName>
+ <Message>"GetStaticFieldValue called on a non-static field."</Message>
+ <Comment> Returned if someone tries to call GetStaticFieldValue </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013133c">
+ <SymbolicName>CORDBG_E_FIELD_NOT_INSTANCE</SymbolicName>
+ <Message>"Returned if someone tries to call GetStaticFieldValue on a non-instance field."</Message>
+ <Comment> Returned if someone tries to call GetStaticFieldValue </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013133d">
+ <SymbolicName>CORDBG_E_ENC_ZAPPED_WITHOUT_ENC</SymbolicName>
+ <Message>"If a zap file was created without the Edit and Continue flag set, then we cannot do Edit and Continue on it, no matter what."</Message>
+ <Comment> If a zap file was created without the EnC flag set, then </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013133e">
+ <SymbolicName>CORDBG_E_ENC_BAD_METHOD_INFO</SymbolicName>
+ <Message>"Lacking information about method."</Message>
+ <Comment> Lacking information about method. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013133f">
+ <SymbolicName>CORDBG_E_ENC_JIT_CANT_UPDATE</SymbolicName>
+ <Message>"The JIT is unable to update the method."</Message>
+ <Comment> The JIT is unable to update the method. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131340">
+ <SymbolicName>CORDBG_E_ENC_MISSING_CLASS</SymbolicName>
+ <Message>"An internal structure about the class is missing."</Message>
+ <Comment> An internal structure about the class is missing </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131341">
+ <SymbolicName>CORDBG_E_ENC_INTERNAL_ERROR</SymbolicName>
+ <Message>"Internal Runtime Error while doing Edit-and-Continue."</Message>
+ <Comment> Generic message for "Something user doesn't control went wrong" message. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131342">
+ <SymbolicName>CORDBG_E_ENC_HANGING_FIELD</SymbolicName>
+ <Message>"The field was added via Edit and Continue after the class was loaded."</Message>
+ <Comment> The field was added via EnC after the class was loaded, and so instead of the the field being contiguous with the other fields, it's 'hanging' off the instance or type. This error is used to indicate that either the storage for this field is not yet available and so the field value cannot be read, or the debugger needs to use an EnC specific code path to get the value.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131343">
+ <SymbolicName>CORDBG_E_MODULE_NOT_LOADED</SymbolicName>
+ <Message>"Module not loaded."</Message>
+ <Comment> If the module isn't loaded, including if it's been unloaded. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131344">
+ <SymbolicName>CORDBG_E_ENC_CANT_CHANGE_SUPERCLASS</SymbolicName>
+ <Message>"Not allowed to change base class."</Message>
+ <Comment> Not allowed to change which class something inherits from </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131345">
+ <SymbolicName>CORDBG_E_UNABLE_TO_SET_BREAKPOINT</SymbolicName>
+ <Message>"Cannot set a breakpoint here."</Message>
+ <Comment> Can't set a breakpoint here. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131346">
+ <SymbolicName>CORDBG_E_DEBUGGING_NOT_POSSIBLE</SymbolicName>
+ <Message>"Debugging is not possible due to an incompatibility within the CLR implementation."</Message>
+ <Comment> Debugging isn't possible due to an incompatibility within the CLR implementation. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131347">
+ <SymbolicName>CORDBG_E_KERNEL_DEBUGGER_ENABLED</SymbolicName>
+ <Message>"A kernel debugger is enabled on the system. User-mode debugging will trap to the kernel debugger."</Message>
+ <Comment> Debugging isn't possible because a kernel debugger is enabled on the system. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131348">
+ <SymbolicName>CORDBG_E_KERNEL_DEBUGGER_PRESENT</SymbolicName>
+ <Message>"A kernel debugger is present on the system. User-mode debugging will trap to the kernel debugger."</Message>
+ <Comment> Debugging isn't possible because a kernel debugger is present on the system. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131349">
+ <SymbolicName>CORDBG_E_HELPER_THREAD_DEAD</SymbolicName>
+ <Message>"The debugger's internal helper thread is dead."</Message>
+ <Comment> The debugger's internal helper thread is dead. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013134a">
+ <SymbolicName>CORDBG_E_INTERFACE_INHERITANCE_CANT_CHANGE</SymbolicName>
+ <Message>"Not allowed to change interface inheritance."</Message>
+ <Comment> Not allowed to change interface inheritance. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013134b">
+ <SymbolicName>CORDBG_E_INCOMPATIBLE_PROTOCOL</SymbolicName>
+ <Message>"The debugger's protocol is incompatible with the debuggee."</Message>
+ <Comment> The debugger's protocol is incompatible with the debuggee. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013134c">
+ <SymbolicName>CORDBG_E_TOO_MANY_PROCESSES</SymbolicName>
+ <Message>"The debugger can only handle a finite number of debuggees."</Message>
+ <Comment> The debugger can only handle a finite number of debuggees. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013134d">
+ <SymbolicName>CORDBG_E_INTEROP_NOT_SUPPORTED</SymbolicName>
+ <Message>"Interop debugging is not supported."</Message>
+ <Comment> Interop debugging is not supported </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013134e">
+ <SymbolicName>CORDBG_E_NO_REMAP_BREAKPIONT</SymbolicName>
+ <Message>"Cannot call RemapFunction until have received RemapBreakpoint."</Message>
+ <Comment> Cannot call RemapFunction until have received RemapBreakpoint </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013134f">
+ <SymbolicName>CORDBG_E_OBJECT_NEUTERED</SymbolicName>
+ <Message>"Object is in a zombie state."</Message>
+ <Comment> Object has been neutered (it's in a zombie state). </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131350">
+ <SymbolicName>CORPROF_E_FUNCTION_NOT_COMPILED</SymbolicName>
+ <Message>"Function not yet compiled."</Message>
+ <Comment> Function not yet compiled. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131351">
+ <SymbolicName>CORPROF_E_DATAINCOMPLETE</SymbolicName>
+ <Message>"The ID is not fully loaded/defined yet."</Message>
+ <Comment> The ID is not fully loaded/defined yet. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131352">
+ <SymbolicName>CORPROF_E_NOT_REJITABLE_METHODS</SymbolicName>
+ <Message>"The Module is not configured for updateable methods."</Message>
+ <Comment> The Module is not configured for updateable methods. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131353">
+ <SymbolicName>CORPROF_E_CANNOT_UPDATE_METHOD</SymbolicName>
+ <Message>"The Method could not be updated for re-JIT."</Message>
+ <Comment> The Method could not be updated for re-jit. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131354">
+ <SymbolicName>CORPROF_E_FUNCTION_NOT_IL</SymbolicName>
+ <Message>"The Method has no associated IL."</Message>
+ <Comment> The Method has no associated IL </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131355">
+ <SymbolicName>CORPROF_E_NOT_MANAGED_THREAD</SymbolicName>
+ <Message>"The thread has never run managed code before."</Message>
+ <Comment> The thread has never run managed code before </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131356">
+ <SymbolicName>CORPROF_E_CALL_ONLY_FROM_INIT</SymbolicName>
+ <Message>"The function may only be called during profiler initialization."</Message>
+ <Comment> The function may only be called during profiler init </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131357">
+ <SymbolicName>CORPROF_E_INPROC_NOT_ENABLED</SymbolicName>
+ <Message>"In-process debugging must be enabled during initialization."</Message>
+ <Comment> Inprocess debugging must be enabled during init </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131358">
+ <SymbolicName>CORPROF_E_JITMAPS_NOT_ENABLED</SymbolicName>
+ <Message>"Cannot get a JIT map becuase they are not enabled."</Message>
+ <Comment> Can't get a JIT map becuase they are not enabled </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131359">
+ <SymbolicName>CORPROF_E_INPROC_ALREADY_BEGUN</SymbolicName>
+ <Message>"BeginInprocDebugging already called."</Message>
+ <Comment> If a profiler tries to call BeginInprocDebugging more than </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013135a">
+ <SymbolicName>CORPROF_E_INPROC_NOT_AVAILABLE</SymbolicName>
+ <Message>"In-process debugging not allowed at this point."</Message>
+ <Comment> States that inprocess debugging not allowed at this point </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013135b">
+ <SymbolicName>CORPROF_E_NOT_YET_AVAILABLE</SymbolicName>
+ <Message>"Requested information is not yet available."</Message>
+ <Comment> This is a general error used to indicated that the information </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013135c">
+ <SymbolicName>CORPROF_E_TYPE_IS_PARAMETERIZED</SymbolicName>
+ <Message>"The given type is a generic and cannot be used with this method."</Message>
+ <Comment> The given type is a generic and cannot be used with this method. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013135d">
+ <SymbolicName>CORPROF_E_FUNCTION_IS_PARAMETERIZED</SymbolicName>
+ <Message>"The given function is a generic and cannot be used with this method."</Message>
+ <Comment> The given function is a generic and cannot be used with this method. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013135e">
+ <SymbolicName>CORPROF_E_STACKSNAPSHOT_INVALID_TGT_THREAD</SymbolicName>
+ <Comment> A profiler tried to walk the stack of an invalid thread </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013135f">
+ <SymbolicName>CORPROF_E_STACKSNAPSHOT_UNMANAGED_CTX</SymbolicName>
+ <Comment> A profiler can not walk a thread that is currently executing unmanaged code </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131360">
+ <SymbolicName>CORPROF_E_STACKSNAPSHOT_UNSAFE</SymbolicName>
+ <Comment> A stackwalk at this point may cause dead locks or data corruption </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131361">
+ <SymbolicName>CORPROF_E_STACKSNAPSHOT_ABORTED</SymbolicName>
+ <Comment> Stackwalking callback requested the walk to abort </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131362">
+ <SymbolicName>CORPROF_E_LITERALS_HAVE_NO_ADDRESS</SymbolicName>
+ <Comment> Returned when asked for the address of a static that is a literal. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131363">
+ <SymbolicName>CORPROF_E_UNSUPPORTED_CALL_SEQUENCE</SymbolicName>
+ <Comment> A call was made at an unsupported time. Examples include illegally calling a profiling API method asynchronously, calling a method that might trigger a GC at an unsafe time, and calling a method at a time that could cause locks to be taken out of order. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131364">
+ <SymbolicName>CORPROF_E_ASYNCHRONOUS_UNSAFE</SymbolicName>
+ <Comment> A legal asynchronous call was made at an unsafe time (e.g., CLR locks are held) </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131365">
+ <SymbolicName>CORPROF_E_CLASSID_IS_ARRAY</SymbolicName>
+ <Comment> The specified ClassID cannot be inspected by this function because it is an array </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131366">
+ <SymbolicName>CORPROF_E_CLASSID_IS_COMPOSITE</SymbolicName>
+ <Comment> The specified ClassID is a non-array composite type (e.g., ref) and cannot be inspected </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131367">
+ <SymbolicName>CORPROF_E_PROFILER_DETACHING</SymbolicName>
+ <Comment> The profiler's call into the CLR is disallowed because the profiler is attempting to detach. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131368">
+ <SymbolicName>CORPROF_E_PROFILER_NOT_ATTACHABLE</SymbolicName>
+ <Comment> The profiler does not support attaching to a live process. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131369">
+ <SymbolicName>CORPROF_E_UNRECOGNIZED_PIPE_MSG_FORMAT</SymbolicName>
+ <Comment> The message sent on the profiling API attach pipe is in an unrecognized format. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013136A">
+ <SymbolicName>CORPROF_E_PROFILER_ALREADY_ACTIVE</SymbolicName>
+ <Comment> The request to attach a profiler was denied because a profiler is already loaded. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013136B">
+ <SymbolicName>CORPROF_E_PROFILEE_INCOMPATIBLE_WITH_TRIGGER</SymbolicName>
+ <Comment> Unable to request a profiler attach because the target profilee's runtime is of a version incompatible with the current process calling AttachProfiler(). </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013136C">
+ <SymbolicName>CORPROF_E_IPC_FAILED</SymbolicName>
+ <Comment> AttachProfiler() encountered an error while communicating on the pipe to the target profilee. This is often caused by a target profilee that is shutting down or killed while AttachProfiler() is reading or writing the pipe. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013136D">
+ <SymbolicName>CORPROF_E_PROFILEE_PROCESS_NOT_FOUND</SymbolicName>
+ <Comment> AttachProfiler() was unable to find a profilee with the specified process ID. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013136E">
+ <SymbolicName>CORPROF_E_CALLBACK3_REQUIRED</SymbolicName>
+ <Comment> Profiler must implement ICorProfilerCallback3 interface for this call to be supported. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013136F">
+ <SymbolicName>CORPROF_E_UNSUPPORTED_FOR_ATTACHING_PROFILER</SymbolicName>
+ <Comment> This call was attempted by a profiler that attached to the process after startup, but this call is only supported by profilers that are loaded into the process on startup.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131370">
+ <SymbolicName>CORPROF_E_IRREVERSIBLE_INSTRUMENTATION_PRESENT</SymbolicName>
+ <Comment> Detach is impossible because the profiler has either instrumented IL or inserted enter/leave hooks. Detach was not attempted; the profiler is still fully attached. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131371">
+ <SymbolicName>CORPROF_E_RUNTIME_UNINITIALIZED</SymbolicName>
+ <Comment> The profiler called a function that cannot complete because the CLR is not yet fully initialized. The profiler may try again once the CLR has fully started. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131372">
+ <SymbolicName>CORPROF_E_IMMUTABLE_FLAGS_SET</SymbolicName>
+ <Comment> Detach is impossible because immutable flags were set by the profiler at startup. Detach was not attempted; the profiler is still fully attached. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131373">
+ <SymbolicName>CORPROF_E_PROFILER_NOT_YET_INITIALIZED</SymbolicName>
+ <Comment> The profiler called a function that cannot complete because the profiler is not yet fully initialized. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131374">
+ <SymbolicName>CORPROF_E_INCONSISTENT_WITH_FLAGS</SymbolicName>
+ <Comment> The profiler called a function that first requires additional flags to be set in the event mask. This HRESULT may also indicate that the profiler called a function that first requires that some of the flags currently set in the event mask be reset. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131375">
+ <SymbolicName>CORPROF_E_PROFILER_CANCEL_ACTIVATION</SymbolicName>
+ <Comment> The profiler has requested that the CLR instance not load the profiler into this process. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131376">
+ <SymbolicName>CORPROF_E_CONCURRENT_GC_NOT_PROFILABLE</SymbolicName>
+ <Comment> Concurrent GC mode is enabled, which prevents use of COR_PRF_MONITOR_GC </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131377">
+ <SymbolicName>CORPROF_E_INCONSISTENT_FLAGS_WITH_HOST_PROTECTION_SETTING</SymbolicName>
+ <Comment> Host enforces host protection attributes, which prevents use of COR_PRF_USE_PROFILE_IMAGES, COR_PRF_MONITOR_CODE_TRANSITIONS, and COR_PRF_MONITOR_ENTERLEAVE </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131378">
+ <SymbolicName>CORPROF_E_DEBUGGING_DISABLED</SymbolicName>
+ <Comment> This functionality requires CoreCLR debugging to be enabled. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131379">
+ <SymbolicName>CORPROF_E_TIMEOUT_WAITING_FOR_CONCURRENT_GC</SymbolicName>
+ <Comment> Timed out on waiting for concurrent GC to finish during attach. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013137A">
+ <SymbolicName>CORPROF_E_MODULE_IS_DYNAMIC</SymbolicName>
+ <Comment> The specified module was dynamically generated (e.g., via Reflection.Emit API), and is thus not supported by this API method. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013137B">
+ <SymbolicName>CORPROF_E_CALLBACK4_REQUIRED</SymbolicName>
+ <Comment> Profiler must implement ICorProfilerCallback4 interface for this call to be supported. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013137C">
+ <SymbolicName>CORPROF_E_REJIT_NOT_ENABLED</SymbolicName>
+ <Comment> This call is not supported unless ReJIT is first enabled during initialization by setting COR_PRF_ENABLE_REJIT via SetEventMask. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013137D">
+ <SymbolicName>CORPROF_E_ACTIVE_REJIT_REQUEST_NOT_FOUND</SymbolicName>
+ <Comment> Could not revert the specified method, because a corresponding active ReJIT request was not found. Either the method was never requested to be reJITted OR the method was already reverted. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013137E">
+ <SymbolicName>CORPROF_E_FUNCTION_IS_COLLECTIBLE</SymbolicName>
+ <Comment> The specified function is instantiated into a collectible assembly, and is thus not supported by this API method. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013137F">
+ <SymbolicName>CORPROF_E_REJIT_REQUIRES_DISABLE_NGEN</SymbolicName>
+ <Comment> If the profiler specifies COR_PRF_ENABLE_REJIT to SetEventMask, it must also specify COR_PRF_DISABLE_ALL_NGEN_IMAGES. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131380">
+ <SymbolicName>CORPROF_E_CALLBACK6_REQUIRED</SymbolicName>
+ <Comment> Profiler must implement ICorProfilerCallback6 interface for this call to be supported. </Comment>
+</HRESULT>
+
+<!-- This HRESULT is used only internally by our rejit implementation right now. If it ever appears in
+ a public API HRESULT it is a bug. It is included here to prevent anyone else from defining
+ a new failure with the same value and causing confusion.
+<HRESULT NumericValue="0x80131381">
+ <SymbolicName>CORPROF_E_RUNTIME_SUSPEND_REQUIRED</SymbolicName>
+ <Comment> This call can't be completed safely because the runtime is not suspended </Comment>
+</HRESULT>
+-->
+
+<HRESULT NumericValue="0x80131382">
+ <SymbolicName>CORPROF_E_CALLBACK7_REQUIRED</SymbolicName>
+ <Comment> Profiler must implement ICorProfilerCallback7 interface for this call to be supported. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131400">
+ <SymbolicName>SECURITY_E_XML_TO_ASN_ENCODING</SymbolicName>
+ <Message>"Failed to convert XML to ASN."</Message>
+ <Comment> Failed to convert XML to ASN </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131401">
+ <SymbolicName>SECURITY_E_INCOMPATIBLE_SHARE</SymbolicName>
+ <Message>"Loading this assembly would produce a different grant set from other instances."</Message>
+ <Comment> Loading this assembly would produce a different grant set from other instances </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131402">
+ <SymbolicName>SECURITY_E_UNVERIFIABLE</SymbolicName>
+ <Message>"Unverifiable code failed policy check."</Message>
+ <Comment> Unverifable code failed policy check </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131403">
+ <SymbolicName>SECURITY_E_INCOMPATIBLE_EVIDENCE</SymbolicName>
+ <Message>"Assembly already loaded without additional security evidence."</Message>
+ <Comment> Assembly already loaded without additional security evidence. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131410">
+ <SymbolicName>CORSEC_E_DECODE_SET</SymbolicName>
+ <Message>"Failure decoding permission set."</Message>
+ <Comment> Failure decoding permission set </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131411">
+ <SymbolicName>CORSEC_E_ENCODE_SET</SymbolicName>
+ <Message>"Failure encoding permission set."</Message>
+ <Comment> Failure encoding permission set </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131412">
+ <SymbolicName>CORSEC_E_UNSUPPORTED_FORMAT</SymbolicName>
+ <Message>"Unrecognized encoding format."</Message>
+ <Comment> Unrecognized encoding format </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131413">
+ <SymbolicName>SN_CRYPTOAPI_CALL_FAILED</SymbolicName>
+ <Comment> StrongName APIs not supported on system </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131413">
+ <SymbolicName>CORSEC_E_CRYPTOAPI_CALL_FAILED</SymbolicName>
+ <Message>"StrongName APIs not supported on system."</Message>
+ <Comment> StrongName APIs not supported on system </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131414">
+ <SymbolicName>SN_NO_SUITABLE_CSP</SymbolicName>
+ <Comment> StrongName APIs couldn't locate a matching CSP </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131414">
+ <SymbolicName>CORSEC_E_NO_SUITABLE_CSP</SymbolicName>
+ <Message>"StrongName APIs could not locate a matching CSP."</Message>
+ <Comment> StrongName APIs couldn't locate a matching CSP </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131415">
+ <SymbolicName>CORSEC_E_INVALID_ATTR</SymbolicName>
+ <Message>"Invalid security custom attribute."</Message>
+ <Comment> Invalid security custom attribute </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131416">
+ <SymbolicName>CORSEC_E_POLICY_EXCEPTION</SymbolicName>
+ <Message>"PolicyException thrown."</Message>
+ <Comment> PolicyException thrown </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131417">
+ <SymbolicName>CORSEC_E_MIN_GRANT_FAIL</SymbolicName>
+ <Message>"Failed to grant minimum permission requests."</Message>
+ <Comment> Failed to grant minimum permission requests </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131418">
+ <SymbolicName>CORSEC_E_NO_EXEC_PERM</SymbolicName>
+ <Message>"Failed to grant permission to execute."</Message>
+ <Comment> Failed to grant permission to execute </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131419">
+ <SymbolicName>CORSEC_E_XMLSYNTAX</SymbolicName>
+ <Message>"XML Syntax error."</Message>
+ <Comment> XML Syntax error </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013141a">
+ <SymbolicName>CORSEC_E_INVALID_STRONGNAME</SymbolicName>
+ <Message>"Strong name validation failed."</Message>
+ <Comment> Strong name validation failed </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013141b">
+ <SymbolicName>CORSEC_E_MISSING_STRONGNAME</SymbolicName>
+ <Message>"Assembly is not strong named."</Message>
+ <Comment> Assembly is not strong named </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013141c">
+ <SymbolicName>CORSEC_E_CONTAINER_NOT_FOUND</SymbolicName>
+ <Message>"Strong name key container not found."</Message>
+ <Comment> Strong name key container not found </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013141d">
+ <SymbolicName>CORSEC_E_INVALID_IMAGE_FORMAT</SymbolicName>
+ <Message>"Invalid assembly file format."</Message>
+ <Comment> Invalid assembly file format </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013141e">
+ <SymbolicName>CORSEC_E_INVALID_PUBLICKEY</SymbolicName>
+ <Message>"Invalid assembly public key."</Message>
+ <Comment> Invalid assembly public key </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131420">
+ <SymbolicName>CORSEC_E_SIGNATURE_MISMATCH</SymbolicName>
+ <Message>"Signature size mismatch."</Message>
+ <Comment> Signature size mismatch </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131421">
+ <SymbolicName>SN_E_PUBLICKEY_MISMATCH</SymbolicName>
+ <Message>"Public key of assembly did not match signing public key."</Message>
+ <Comment> Public key of assembly did not match signing public key </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131422">
+ <SymbolicName>CORSEC_E_INVALID_SIGNATUREKEY</SymbolicName>
+ <Message>"Invalid signature public key specified in AssemblySignatureKeyAttribute."</Message>
+ <Comment> Invalid signature key (or invalid key format) specified in the assembly's attribute </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131423">
+ <SymbolicName>CORSEC_E_INVALID_COUNTERSIGNATURE</SymbolicName>
+ <Message>"Invalid countersignature specified in AssemblySignatureKeyAttribute."</Message>
+ <Comment> Invalid signature (or invalid signature format) specified in the assembly's attribute </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131430">
+ <SymbolicName>CORSEC_E_CRYPTO</SymbolicName>
+ <Message>"Failure during Cryptographic operation."</Message>
+ <Comment> generic CryptographicException </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131431">
+ <SymbolicName>CORSEC_E_CRYPTO_UNEX_OPER</SymbolicName>
+ <Message>"Unexpected Cryptographic operation."</Message>
+ <Comment> generic CryptographicUnexpectedOperationException </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013143a">
+ <SymbolicName>CORSECATTR_E_BAD_ATTRIBUTE</SymbolicName>
+ <Message>"Generic problem with a custom attribute."</Message>
+ <Comment> Generic problem with a custom attribute </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013143b">
+ <SymbolicName>CORSECATTR_E_MISSING_CONSTRUCTOR</SymbolicName>
+ <Message>"Missing a required constructor."</Message>
+ <Comment> Missing a required constructor </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013143c">
+ <SymbolicName>CORSECATTR_E_FAILED_TO_CREATE_PERM</SymbolicName>
+ <Message>"Unable to create a permission for this attribute."</Message>
+ <Comment> Unable to create a permission for this attribute </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013143d">
+ <SymbolicName>CORSECATTR_E_BAD_ACTION_ASM</SymbolicName>
+ <Message>"SecurityAction type invalid on assembly."</Message>
+ <Comment> SecurityAction type invalid on assembly </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013143e">
+ <SymbolicName>CORSECATTR_E_BAD_ACTION_OTHER</SymbolicName>
+ <Message>"SecurityAction type invalid on types and methods."</Message>
+ <Comment> SecurityAction type invalid on types and methods </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013143f">
+ <SymbolicName>CORSECATTR_E_BAD_PARENT</SymbolicName>
+ <Message>"Security custom attribute attached to invalid parent."</Message>
+ <Comment> Security custom attribute attached to invalid parent </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131440">
+ <SymbolicName>CORSECATTR_E_TRUNCATED</SymbolicName>
+ <Message>"Bad custom attribute serialized blob."</Message>
+ <Comment> Bad custom attribute serialized blob </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131441">
+ <SymbolicName>CORSECATTR_E_BAD_VERSION</SymbolicName>
+ <Message>"Bad custom attribute serialized blob version."</Message>
+ <Comment> Bad custom attribute serialized blob version </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131442">
+ <SymbolicName>CORSECATTR_E_BAD_ACTION</SymbolicName>
+ <Message>"Invalid security action code."</Message>
+ <Comment> Invalid security action code </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131443">
+ <SymbolicName>CORSECATTR_E_NO_SELF_REF</SymbolicName>
+ <Message>"CA reference to CA definition in same assembly."</Message>
+ <Comment> CA ref to CA def'd in same assembly </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131444">
+ <SymbolicName>CORSECATTR_E_BAD_NONCAS</SymbolicName>
+ <Message>"Use of non-CAS permission with invalid action."</Message>
+ <Comment> Use of non-CAS perm with invalid action </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131445">
+ <SymbolicName>CORSECATTR_E_ASSEMBLY_LOAD_FAILED</SymbolicName>
+ <Message>"Failed to load assembly containing CA (or required CA type)."</Message>
+ <Comment> Failed to load assembly containing CA (or req'd CA type) </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131446">
+ <SymbolicName>CORSECATTR_E_ASSEMBLY_LOAD_FAILED_EX</SymbolicName>
+ <Message>"Failed to load assembly containing CA (or required CA type)."</Message>
+ <Comment> Failed to load assembly containing CA (or req'd CA type) </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131447">
+ <SymbolicName>CORSECATTR_E_TYPE_LOAD_FAILED</SymbolicName>
+ <Message>"Failed to load CA type (or required CA type)."</Message>
+ <Comment> Failed to load CA type (or reqd CA type) </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131448">
+ <SymbolicName>CORSECATTR_E_TYPE_LOAD_FAILED_EX</SymbolicName>
+ <Message>"Failed to load CA type (or required CA type)."</Message>
+ <Comment> Failed to load CA type (or reqd CA type) </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131449">
+ <SymbolicName>CORSECATTR_E_ABSTRACT</SymbolicName>
+ <Message>"CA type is abstract."</Message>
+ <Comment> CA type is abstract </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013144a">
+ <SymbolicName>CORSECATTR_E_UNSUPPORTED_TYPE</SymbolicName>
+ <Message>"Security custom attributes do not support array or Type fields and properties."</Message>
+ <Comment> Security custom attributes do not support array or Type fields and properties </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013144b">
+ <SymbolicName>CORSECATTR_E_UNSUPPORTED_ENUM_TYPE</SymbolicName>
+ <Message>"Unsupported base type for enum field or property."</Message>
+ <Comment> Unsupported base type for enum field/property </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013144c">
+ <SymbolicName>CORSECATTR_E_NO_FIELD</SymbolicName>
+ <Message>"Could not find a CA field."</Message>
+ <Comment> Couldn't find a CA field </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013144d">
+ <SymbolicName>CORSECATTR_E_NO_PROPERTY</SymbolicName>
+ <Message>"Could not find a CA property."</Message>
+ <Comment> Couldn't find a CA property </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013144e">
+ <SymbolicName>CORSECATTR_E_EXCEPTION</SymbolicName>
+ <Message>"Unexpected exception."</Message>
+ <Comment> Unexpected exception </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013144f">
+ <SymbolicName>CORSECATTR_E_EXCEPTION_HR</SymbolicName>
+ <Message>"Unexpected exception."</Message>
+ <Comment> Unexpected exception </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131450">
+ <SymbolicName>ISS_E_ISOSTORE_START</SymbolicName>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131450">
+ <SymbolicName>ISS_E_ISOSTORE</SymbolicName>
+ <Message>"IsolatedStorage operation failed."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131460">
+ <SymbolicName>ISS_E_OPEN_STORE_FILE</SymbolicName>
+ <Message>"Unable to open the store."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131461">
+ <SymbolicName>ISS_E_OPEN_FILE_MAPPING</SymbolicName>
+ <Message>"Unable to create store file mapping."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131462">
+ <SymbolicName>ISS_E_MAP_VIEW_OF_FILE</SymbolicName>
+ <Message>"Unable to map the store file."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131463">
+ <SymbolicName>ISS_E_GET_FILE_SIZE</SymbolicName>
+ <Message>"Unable to determine store file size."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131464">
+ <SymbolicName>ISS_E_CREATE_MUTEX</SymbolicName>
+ <Message>"Unable to create mutex."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131465">
+ <SymbolicName>ISS_E_LOCK_FAILED</SymbolicName>
+ <Message>"Unable to lock the store."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131466">
+ <SymbolicName>ISS_E_FILE_WRITE</SymbolicName>
+ <Message>"File Write failed."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131467">
+ <SymbolicName>ISS_E_SET_FILE_POINTER</SymbolicName>
+ <Message>"Cannot set file pointer."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131468">
+ <SymbolicName>ISS_E_CREATE_DIR</SymbolicName>
+ <Message>"Unable to create the store directory."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131469">
+ <SymbolicName>ISS_E_STORE_NOT_OPEN</SymbolicName>
+ <Message>"Store must be open for this operation."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131480">
+ <SymbolicName>ISS_E_CORRUPTED_STORE_FILE</SymbolicName>
+ <Message>"Store file is corrupt."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131481">
+ <SymbolicName>ISS_E_STORE_VERSION</SymbolicName>
+ <Message>"Store version is not supported."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131482">
+ <SymbolicName>ISS_E_FILE_NOT_MAPPED</SymbolicName>
+ <Message>"Store file is not mapped."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131483">
+ <SymbolicName>ISS_E_BLOCK_SIZE_TOO_SMALL</SymbolicName>
+ <Message>"Block size is too small."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131484">
+ <SymbolicName>ISS_E_ALLOC_TOO_LARGE</SymbolicName>
+ <Message>"Allocation size is too large."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131485">
+ <SymbolicName>ISS_E_USAGE_WILL_EXCEED_QUOTA</SymbolicName>
+ <Message>"Allowed quota is fully used."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131486">
+ <SymbolicName>ISS_E_TABLE_ROW_NOT_FOUND</SymbolicName>
+ <Message>"Row not found."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801314a0">
+ <SymbolicName>ISS_E_DEPRECATE</SymbolicName>
+ <Message>"Unable to deprecate old store."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801314a1">
+ <SymbolicName>ISS_E_CALLER</SymbolicName>
+ <Message>"Unable to determine the caller."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801314a2">
+ <SymbolicName>ISS_E_PATH_LENGTH</SymbolicName>
+ <Message>"Path length is too long."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801314a3">
+ <SymbolicName>ISS_E_MACHINE</SymbolicName>
+ <Message>"Machine Store is not supported."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801314a4">
+ <SymbolicName>ISS_E_MACHINE_DACL</SymbolicName>
+ <Message>"The DACL for the machine store is incorrect or could not be created."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801314ff">
+ <SymbolicName>ISS_E_ISOSTORE_END</SymbolicName>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131500">
+ <SymbolicName>COR_E_EXCEPTION</SymbolicName>
+ <Message>"General Exception"</Message>
+ <Comment> Base class for all exceptions in the runtime</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131501">
+ <SymbolicName>COR_E_SYSTEM</SymbolicName>
+ <Message>"System.Exception"</Message>
+ <Comment> The base class for the runtime's "less serious" exceptions</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131502">
+ <SymbolicName>COR_E_ARGUMENTOUTOFRANGE</SymbolicName>
+ <Message>"An argument was out of its legal range."</Message>
+ <Comment> An argument was out of its legal range.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131503">
+ <SymbolicName>COR_E_ARRAYTYPEMISMATCH</SymbolicName>
+ <Message>"Attempted to store an object of the wrong type in an array."</Message>
+ <Comment> Attempted to store an object of the wrong type in an array</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131504">
+ <SymbolicName>COR_E_CONTEXTMARSHAL</SymbolicName>
+ <Message>"Attempted to marshal an object across a context boundary."</Message>
+ <Comment></Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131505">
+ <SymbolicName>COR_E_TIMEOUT</SymbolicName>
+ <Message>"Operation timed out."</Message>
+ <Comment></Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131506">
+ <SymbolicName>COR_E_EXECUTIONENGINE</SymbolicName>
+ <Message>"Internal CLR error."</Message>
+ <Comment> An internal error happened in the Common Language Runtime's Execution Engine</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131507">
+ <SymbolicName>COR_E_FIELDACCESS</SymbolicName>
+ <Message>"Access to this field is denied."</Message>
+ <Comment> Access to this field is denied.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131508">
+ <SymbolicName>COR_E_INDEXOUTOFRANGE</SymbolicName>
+ <Message>"Array subscript out of range."</Message>
+ <Comment> Attempted to access an element within an array by using an index that is</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131509">
+ <SymbolicName>COR_E_INVALIDOPERATION</SymbolicName>
+ <Message>"An operation is not legal in the current state."</Message>
+ <Comment> An operation is not legal in the current state.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013150a">
+ <SymbolicName>COR_E_SECURITY</SymbolicName>
+ <Message>"An error relating to security occurred."</Message>
+ <Comment> An error relating to security occurred.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013150b">
+ <SymbolicName>COR_E_REMOTING</SymbolicName>
+ <Message>"An error relating to remoting occurred."</Message>
+ <Comment> An error relating to remoting occurred.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013150c">
+ <SymbolicName>COR_E_SERIALIZATION</SymbolicName>
+ <Message>"An error relating to serialization occurred."</Message>
+ <Comment> An error relating to serialization has occurred.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013150d">
+ <SymbolicName>COR_E_VERIFICATION</SymbolicName>
+ <Message>"A verification failure has occurred."</Message>
+ <Comment> A verification failure occurred</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013150e">
+ <SymbolicName>COR_E_SERVER</SymbolicName>
+ <Message>"An error relating to remoting occurred."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013150f">
+ <SymbolicName>COR_E_SERVICEDCOMPONENT</SymbolicName>
+ <Message>"An error relating to ServicedComponent occurred."</Message>
+ <Comment> An error relating to ServicedComponent occurred.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131510">
+ <SymbolicName>COR_E_METHODACCESS</SymbolicName>
+ <Message>"Access to this method is denied."</Message>
+ <Comment> Access to this method is denied.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131511">
+ <SymbolicName>COR_E_MISSINGFIELD</SymbolicName>
+ <Message>"Field does not exist."</Message>
+ <Comment> An attempt was made to dynamically access a field that does not exist.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131512">
+ <SymbolicName>COR_E_MISSINGMEMBER</SymbolicName>
+ <Message>"Member does not exist."</Message>
+ <Comment> An attempt was made to dynamically invoke or access a field or method</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131513">
+ <SymbolicName>COR_E_MISSINGMETHOD</SymbolicName>
+ <Message>"Method does not exist."</Message>
+ <Comment> An attempt was made to dynamically invoke a method that does not exist</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131514">
+ <SymbolicName>COR_E_MULTICASTNOTSUPPORTED</SymbolicName>
+ <Message>"Attempt to combine delegates that are not multicast."</Message>
+ <Comment> Attempted to combine delegates that are not multicast</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131515">
+ <SymbolicName>COR_E_NOTSUPPORTED</SymbolicName>
+ <Message>"Operation is not supported."</Message>
+ <Comment> The operation is not supported</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131516">
+ <SymbolicName>COR_E_OVERFLOW</SymbolicName>
+ <Message>"Arithmetic, casting or conversion operation overflowed or underflowed."</Message>
+ <Comment> An arithmetic, casting, or conversion operation overflowed or underflowed.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131517">
+ <SymbolicName>COR_E_RANK</SymbolicName>
+ <Message>"An array has the wrong number of dimensions for a particular operation."</Message>
+ <Comment> An array has the wrong number of dimensions for a particular operation.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131518">
+ <SymbolicName>COR_E_SYNCHRONIZATIONLOCK</SymbolicName>
+ <Message>"This operation must be called from a synchronized block."</Message>
+ <Comment> Wait(), Notify() or NotifyAll() was called from an unsynchronized ** block of c</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131519">
+ <SymbolicName>COR_E_THREADINTERRUPTED</SymbolicName>
+ <Message>"Thread was interrupted from a waiting state."</Message>
+ <Comment> Indicates that the thread was interrupted from a waiting state</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013151a">
+ <SymbolicName>COR_E_MEMBERACCESS</SymbolicName>
+ <Message>"Access to this member is denied."</Message>
+ <Comment> Access to this member is denied.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131520">
+ <SymbolicName>COR_E_THREADSTATE</SymbolicName>
+ <Message>"Thread is in an invalid state for this operation."</Message>
+ <Comment> Indicate that the Thread class is in an invalid state for the method call</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131521">
+ <SymbolicName>COR_E_THREADSTOP</SymbolicName>
+ <Message>"Thread is stopping."</Message>
+ <Comment> Thrown into a thread to cause it to stop. This exception is typically not caught</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131522">
+ <SymbolicName>COR_E_TYPELOAD</SymbolicName>
+ <Message>"Could not find or load a type."</Message>
+ <Comment> Could not find or load a specific type (class, enum, etc).</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131523">
+ <SymbolicName>COR_E_ENTRYPOINTNOTFOUND</SymbolicName>
+ <Message>"Could not find the specified DllImport entrypoint."</Message>
+ <Comment> Could not find the specified DllImport entry point</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131524">
+ <SymbolicName>COR_E_DLLNOTFOUND</SymbolicName>
+ <Message>"Could not find the specified DllImport Dll."</Message>
+ <Comment> Could not find the specified DllImport DLL.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131525">
+ <SymbolicName>COR_E_THREADSTART</SymbolicName>
+ <Comment> Indicate that a user thread fails to start.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131527">
+ <SymbolicName>COR_E_INVALIDCOMOBJECT</SymbolicName>
+ <Message>"An invalid __ComObject has been used."</Message>
+ <Comment> An invalid __ComObject has been used.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131528">
+ <SymbolicName>COR_E_NOTFINITENUMBER</SymbolicName>
+ <Message>"Not a Number."</Message>
+ <Comment> Thrown if value (a floating point number) is either the not a number value (NaN) or +- infinity value</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131529">
+ <SymbolicName>COR_E_DUPLICATEWAITOBJECT</SymbolicName>
+ <Message>"An object appears more than once in the wait objects array."</Message>
+ <Comment> An object appears more than once in the wait objects array.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013152b">
+ <SymbolicName>COR_E_SEMAPHOREFULL</SymbolicName>
+ <Message>"Reached maximum count for semaphore."</Message>
+ <Comment> Adding the given count to the semaphore would cause it to exceed its maximum count.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013152c">
+ <SymbolicName>COR_E_WAITHANDLECANNOTBEOPENED</SymbolicName>
+ <Message>"No semaphore of the given name exists."</Message>
+ <Comment> No Semaphore of the given name exists.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013152d">
+ <SymbolicName>COR_E_ABANDONEDMUTEX</SymbolicName>
+ <Message>"The wait completed due to an abandoned mutex."</Message>
+ <Comment> The wait completed due to an abandoned mutex.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131530">
+ <SymbolicName>COR_E_THREADABORTED</SymbolicName>
+ <Message>"Thread has aborted."</Message>
+ <Comment> Thrown into a thread to cause it to abort. Not catchable.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131531">
+ <SymbolicName>COR_E_INVALIDOLEVARIANTTYPE</SymbolicName>
+ <Message>"OLE Variant has an invalid type."</Message>
+ <Comment> The type of an OLE variant that was passed into the runtime is invalid.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131532">
+ <SymbolicName>COR_E_MISSINGMANIFESTRESOURCE</SymbolicName>
+ <Message>"An expected resource in the assembly manifest was missing."</Message>
+ <Comment> An expected resource in the assembly manifest was missing.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131533">
+ <SymbolicName>COR_E_SAFEARRAYTYPEMISMATCH</SymbolicName>
+ <Message>"A mismatch has occurred between the runtime type of the array and the sub type recorded in the metadata."</Message>
+ <Comment> A mismatch has occurred between the runtime type of the array and the subtype recorded in the metadata</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131534">
+ <SymbolicName>COR_E_TYPEINITIALIZATION</SymbolicName>
+ <Message>"Uncaught exception during type initialization."</Message>
+ <Comment> An exception was thrown by a type's initializer (.cctor).</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131535">
+ <SymbolicName>COR_E_MARSHALDIRECTIVE</SymbolicName>
+ <Message>"Invalid marshaling directives."</Message>
+ <Comment> The marshaling directives are invalid.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131536">
+ <SymbolicName>COR_E_MISSINGSATELLITEASSEMBLY</SymbolicName>
+ <Message>"An expected satellite assembly containing the ultimate fallback resources for a given culture was not found or could not be loaded."</Message>
+ <Comment> An expected satellite assembly containing the ultimate fallback resources</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131537">
+ <SymbolicName>COR_E_FORMAT</SymbolicName>
+ <Message>"The format of one argument does not meet the contract of the method."</Message>
+ <Comment> The format of one argument does not meet the contract of the method.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131538">
+ <SymbolicName>COR_E_SAFEARRAYRANKMISMATCH</SymbolicName>
+ <Message>"A mismatch has occurred between the runtime rank of the array and the rank recorded in the metadata."</Message>
+ <Comment> A mismatch has occurred between the runtime rank of the array and the rank recorded in the metadata</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131539">
+ <SymbolicName>COR_E_PLATFORMNOTSUPPORTED</SymbolicName>
+ <Message>"Operation is not supported on this platform."</Message>
+ <Comment> The method is not supported on this platform</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013153a">
+ <SymbolicName>COR_E_INVALIDPROGRAM</SymbolicName>
+ <Message>"Invalid IL or CLR metadata."</Message>
+ <Comment> A program contained invalid IL or bad metadata. Usually this is a compiler bug.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013153b">
+ <SymbolicName>COR_E_OPERATIONCANCELED</SymbolicName>
+ <Message>"The operation was cancelled."</Message>
+ <Comment> The operation was cancelled.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013153d">
+ <SymbolicName>COR_E_INSUFFICIENTMEMORY</SymbolicName>
+ <Comment> Not enough memory was available for an operation.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013153e">
+ <SymbolicName>COR_E_RUNTIMEWRAPPED</SymbolicName>
+ <Comment> An object that does not derive from System.Exception has been wrapped in a RuntimeWrappedException.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131540">
+ <SymbolicName>COR_E_DEVICESNOTSUPPORTED</SymbolicName>
+ <Message>"Devices not supported."</Message>
+ <Comment></Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131541">
+ <SymbolicName>COR_E_DATAMISALIGNED</SymbolicName>
+ <Message>"A datatype misalignment was detected in a load or store instruction."</Message>
+ <Comment> A datatype misalignment was detected in a load or store instruction.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131542">
+ <SymbolicName>COR_E_CODECONTRACTFAILED</SymbolicName>
+ <Message>"A managed code contract (ie, precondition, postcondition, invariant, or assert) failed."</Message>
+ <Comment> A managed code contract (ie, precondition, postcondition, invariant, or assert) failed.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131543">
+ <SymbolicName>COR_E_TYPEACCESS</SymbolicName>
+ <Message>"Access to this type is denied."</Message>
+ <Comment>Access to this type is denied.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131544">
+ <SymbolicName>COR_E_ACCESSING_CCW</SymbolicName>
+ <Message>"Fail to access a CCW because the corresponding managed object is already collected."</Message>
+ <Comment>Fail to access a CCW because the corresponding managed object is already collected.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131545">
+ <SymbolicName>COR_E_MAXMETHODSIZE</SymbolicName>
+ <Message>"A method in this assembly is greater than the maximum allowed method size."</Message>
+ <Comment>This is Apollo only.</Comment>
+</HRESULT>
+
+
+<HRESULT NumericValue="0x80131577">
+ <SymbolicName>COR_E_KEYNOTFOUND</SymbolicName>
+ <Message>"The given key was not present in the dictionary."</Message>
+ <Comment></Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131578">
+ <SymbolicName>COR_E_INSUFFICIENTEXECUTIONSTACK</SymbolicName>
+ <Message>"Insufficient stack to continue executing the program safely. This can happen from having too many functions on the call stack or function on the stack using too much stack space."</Message>
+ <Comment> Insufficient stack to continue executing the program safely. This can happen from having too many functions on the call stack or function on the stack using too much stack space.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131600">
+ <SymbolicName>COR_E_APPLICATION</SymbolicName>
+ <Message>"Application exception"</Message>
+ <Comment> The base class for all "less serious" exceptions.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131601">
+ <SymbolicName>COR_E_INVALIDFILTERCRITERIA</SymbolicName>
+ <Message>"The given filter criteria does not match the filter content."</Message>
+ <Comment> The given filter criteria does not match the filter contract.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131602">
+ <SymbolicName>COR_E_REFLECTIONTYPELOAD</SymbolicName>
+ <Message>"Could not find or load a specific class that was requested through Reflection."</Message>
+ <Comment> Could not find or load a specific class that was requested through Reflection</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131603">
+ <SymbolicName>COR_E_TARGET</SymbolicName>
+ <Message>"Attempt to invoke non-static method with a null Object."</Message>
+ <Comment> - If you attempt to invoke a non-static method with a null Object - If you atte</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131604">
+ <SymbolicName>COR_E_TARGETINVOCATION</SymbolicName>
+ <Message>"Uncaught exception thrown by method called through Reflection."</Message>
+ <Comment> If the method called throws an exception</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131605">
+ <SymbolicName>COR_E_CUSTOMATTRIBUTEFORMAT</SymbolicName>
+ <Message>"Custom attribute has invalid format."</Message>
+ <Comment> If the binary format of a custom attribute is invalid.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131620">
+ <SymbolicName>COR_E_IO</SymbolicName>
+ <Message>"Error during managed I/O."</Message>
+ <Comment> Some sort of I/O error.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131621">
+ <SymbolicName>COR_E_FILELOAD</SymbolicName>
+ <Message>"Could not find or load a specific file."</Message>
+ <Comment></Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131622">
+ <SymbolicName>COR_E_OBJECTDISPOSED</SymbolicName>
+ <Message>"The object has already been disposed."</Message>
+ <Comment> The object has already been disposed.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131623">
+ <SymbolicName>COR_E_FAILFAST</SymbolicName>
+ <Message>"Runtime operation halted by call to System.Environment.FailFast()."</Message>
+ <Comment> Runtime operation halted by call to System.Environment.FailFast().</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131640">
+ <SymbolicName>COR_E_HOSTPROTECTION</SymbolicName>
+ <Message>"The host has forbidden this operation."</Message>
+ <Comment> Attempted to perform an operation that was forbidden by the host.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131641">
+ <SymbolicName>COR_E_ILLEGAL_REENTRANCY</SymbolicName>
+ <Message>"Attempted to call into managed code when executing inside a low level extensibility point."</Message>
+ <Comment> Attempted to call into managed code when executing inside a low level extensibility point.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131700">
+ <SymbolicName>CLR_E_SHIM_RUNTIMELOAD</SymbolicName>
+ <Message>"Failed to load the runtime."</Message>
+ <Comment> Failed to load the runtime </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131701">
+ <SymbolicName>CLR_E_SHIM_RUNTIMEEXPORT</SymbolicName>
+ <Message>"Failed to find a required export in the runtime."</Message>
+ <Comment> Failed to find a required export in the runtime </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131702">
+ <SymbolicName>CLR_E_SHIM_INSTALLROOT</SymbolicName>
+ <Message>"Install root is not defined."</Message>
+ <Comment> Install root is not defined </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131703">
+ <SymbolicName>CLR_E_SHIM_INSTALLCOMP</SymbolicName>
+ <Message>"Expected component of the runtime is not available."</Message>
+ <Comment> Expected component of the runtime is not available </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131704">
+ <SymbolicName>CLR_E_SHIM_LEGACYRUNTIMEALREADYBOUND</SymbolicName>
+ <Message>"A runtime has already been bound for legacy activation policy use."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131705">
+ <SymbolicName>CLR_E_SHIM_SHUTDOWNINPROGRESS</SymbolicName>
+ <Message>"The operation is invalid because the process may be shutting down."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131801">
+ <SymbolicName>VER_E_HRESULT</SymbolicName>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131802">
+ <SymbolicName>VER_E_OFFSET</SymbolicName>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131803">
+ <SymbolicName>VER_E_OPCODE</SymbolicName>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131804">
+ <SymbolicName>VER_E_OPERAND</SymbolicName>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131805">
+ <SymbolicName>VER_E_TOKEN</SymbolicName>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131806">
+ <SymbolicName>VER_E_EXCEPT</SymbolicName>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131807">
+ <SymbolicName>VER_E_STACK_SLOT</SymbolicName>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131808">
+ <SymbolicName>VER_E_LOC</SymbolicName>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131809">
+ <SymbolicName>VER_E_ARG</SymbolicName>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013180a">
+ <SymbolicName>VER_E_FOUND</SymbolicName>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013180b">
+ <SymbolicName>VER_E_EXPECTED</SymbolicName>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013180c">
+ <SymbolicName>VER_E_LOC_BYNAME</SymbolicName>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131810">
+ <SymbolicName>VER_E_UNKNOWN_OPCODE</SymbolicName>
+ <Message>"Unknown opcode."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131811">
+ <SymbolicName>VER_E_SIG_CALLCONV</SymbolicName>
+ <Message>"Unknown calling convention."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131812">
+ <SymbolicName>VER_E_SIG_ELEMTYPE</SymbolicName>
+ <Message>"Unknown ELEMENT_TYPE."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131814">
+ <SymbolicName>VER_E_RET_SIG</SymbolicName>
+ <Message>"[return sig]"</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131815">
+ <SymbolicName>VER_E_FIELD_SIG</SymbolicName>
+ <Message>"[field sig]"</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131816">
+ <SymbolicName>VER_E_OPEN_DLGT_PROT_ACC</SymbolicName>
+ <Message>"Protected method access through an open instance delegate is not verifiable."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131818">
+ <SymbolicName>VER_E_INTERNAL</SymbolicName>
+ <Message>"Internal error."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131819">
+ <SymbolicName>VER_E_STACK_TOO_LARGE</SymbolicName>
+ <Message>"Stack is too large."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013181a">
+ <SymbolicName>VER_E_ARRAY_NAME_LONG</SymbolicName>
+ <Message>"Array name is too long."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131820">
+ <SymbolicName>VER_E_FALLTHRU</SymbolicName>
+ <Message>"fall through end of the method without returning"</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131821">
+ <SymbolicName>VER_E_TRY_GTEQ_END</SymbolicName>
+ <Message>"try start &gt;= try end"</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131822">
+ <SymbolicName>VER_E_TRYEND_GT_CS</SymbolicName>
+ <Message>"try end &gt; code size"</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131823">
+ <SymbolicName>VER_E_HND_GTEQ_END</SymbolicName>
+ <Message>"handler start &gt;= handler end"</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131824">
+ <SymbolicName>VER_E_HNDEND_GT_CS</SymbolicName>
+ <Message>"handler end &gt; code size"</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131825">
+ <SymbolicName>VER_E_FLT_GTEQ_CS</SymbolicName>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131826">
+ <SymbolicName>VER_E_TRY_START</SymbolicName>
+ <Message>"Try starts in the middle of an instruction."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131827">
+ <SymbolicName>VER_E_HND_START</SymbolicName>
+ <Message>"Handler starts in the middle of an instruction."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131828">
+ <SymbolicName>VER_E_FLT_START</SymbolicName>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131829">
+ <SymbolicName>VER_E_TRY_OVERLAP</SymbolicName>
+ <Message>"Try block overlap with another block."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013182a">
+ <SymbolicName>VER_E_TRY_EQ_HND_FIL</SymbolicName>
+ <Message>"Try and filter/handler blocks are equivalent."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013182b">
+ <SymbolicName>VER_E_TRY_SHARE_FIN_FAL</SymbolicName>
+ <Message>"Shared try has finally or fault handler."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013182c">
+ <SymbolicName>VER_E_HND_OVERLAP</SymbolicName>
+ <Message>"Handler block overlaps with another block."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013182d">
+ <SymbolicName>VER_E_HND_EQ</SymbolicName>
+ <Message>"Handler block is the same as another block."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013182e">
+ <SymbolicName>VER_E_FIL_OVERLAP</SymbolicName>
+ <Message>"Filter block overlaps with another block."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013182f">
+ <SymbolicName>VER_E_FIL_EQ</SymbolicName>
+ <Message>"Filter block is the same as another block."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131830">
+ <SymbolicName>VER_E_FIL_CONT_TRY</SymbolicName>
+ <Message>"Filter contains try."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131831">
+ <SymbolicName>VER_E_FIL_CONT_HND</SymbolicName>
+ <Message>"Filter contains handler."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131832">
+ <SymbolicName>VER_E_FIL_CONT_FIL</SymbolicName>
+ <Message>"Nested filters."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131833">
+ <SymbolicName>VER_E_FIL_GTEQ_CS</SymbolicName>
+ <Message>"filter &gt;= code size"</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131834">
+ <SymbolicName>VER_E_FIL_START</SymbolicName>
+ <Message>"Filter starts in the middle of an instruction."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131835">
+ <SymbolicName>VER_E_FALLTHRU_EXCEP</SymbolicName>
+ <Message>"fallthru the end of an exception block"</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131836">
+ <SymbolicName>VER_E_FALLTHRU_INTO_HND</SymbolicName>
+ <Message>"fallthru into an exception handler"</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131837">
+ <SymbolicName>VER_E_FALLTHRU_INTO_FIL</SymbolicName>
+ <Message>"fallthru into an exception filter"</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131838">
+ <SymbolicName>VER_E_LEAVE</SymbolicName>
+ <Message>"Leave from outside a try or catch block."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131839">
+ <SymbolicName>VER_E_RETHROW</SymbolicName>
+ <Message>"Rethrow from outside a catch handler."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013183a">
+ <SymbolicName>VER_E_ENDFINALLY</SymbolicName>
+ <Message>"Endfinally from outside a finally handler"</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013183b">
+ <SymbolicName>VER_E_ENDFILTER</SymbolicName>
+ <Message>"Endfilter from outside an exception filter block"</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013183c">
+ <SymbolicName>VER_E_ENDFILTER_MISSING</SymbolicName>
+ <Message>"Missing Endfilter."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013183d">
+ <SymbolicName>VER_E_BR_INTO_TRY</SymbolicName>
+ <Message>"Branch into try block."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013183e">
+ <SymbolicName>VER_E_BR_INTO_HND</SymbolicName>
+ <Message>"Branch into exception handler block."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013183f">
+ <SymbolicName>VER_E_BR_INTO_FIL</SymbolicName>
+ <Message>"Branch into exception filter block."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131840">
+ <SymbolicName>VER_E_BR_OUTOF_TRY</SymbolicName>
+ <Message>"Branch out of try block."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131841">
+ <SymbolicName>VER_E_BR_OUTOF_HND</SymbolicName>
+ <Message>"Branch out of exception handler block."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131842">
+ <SymbolicName>VER_E_BR_OUTOF_FIL</SymbolicName>
+ <Message>"Branch out of exception filter block."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131843">
+ <SymbolicName>VER_E_BR_OUTOF_FIN</SymbolicName>
+ <Message>"Branch out of finally block."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131844">
+ <SymbolicName>VER_E_RET_FROM_TRY</SymbolicName>
+ <Message>"Return out of try block."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131845">
+ <SymbolicName>VER_E_RET_FROM_HND</SymbolicName>
+ <Message>"Return out of exception handler block."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131846">
+ <SymbolicName>VER_E_RET_FROM_FIL</SymbolicName>
+ <Message>"Return out of exception filter block."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131847">
+ <SymbolicName>VER_E_BAD_JMP_TARGET</SymbolicName>
+ <Message>"jmp / exception into the middle of an instruction."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131848">
+ <SymbolicName>VER_E_PATH_LOC</SymbolicName>
+ <Message>"Non-compatible types depending on path."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131849">
+ <SymbolicName>VER_E_PATH_THIS</SymbolicName>
+ <Message>"Init state for this differs depending on path."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013184a">
+ <SymbolicName>VER_E_PATH_STACK</SymbolicName>
+ <Message>"Non-compatible types on stack depending on path."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013184b">
+ <SymbolicName>VER_E_PATH_STACK_DEPTH</SymbolicName>
+ <Message>"Stack depth differs depending on path."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013184c">
+ <SymbolicName>VER_E_THIS</SymbolicName>
+ <Message>"Instance variable (this) missing."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013184d">
+ <SymbolicName>VER_E_THIS_UNINIT_EXCEP</SymbolicName>
+ <Message>"Uninitialized this on entering a try block."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013184e">
+ <SymbolicName>VER_E_THIS_UNINIT_STORE</SymbolicName>
+ <Message>"Store into this when it is uninitialized."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013184f">
+ <SymbolicName>VER_E_THIS_UNINIT_RET</SymbolicName>
+ <Message>"Return from .ctor when this is uninitialized."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131850">
+ <SymbolicName>VER_E_THIS_UNINIT_V_RET</SymbolicName>
+ <Message>"Return from .ctor before all fields are initialized."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131851">
+ <SymbolicName>VER_E_THIS_UNINIT_BR</SymbolicName>
+ <Message>"Branch back when this is uninitialized."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131852">
+ <SymbolicName>VER_E_LDFTN_CTOR</SymbolicName>
+ <Message>"ldftn and ldvirtftn not allowed on .ctor."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131853">
+ <SymbolicName>VER_E_STACK_NOT_EQ</SymbolicName>
+ <Message>"Non-compatible types on the stack."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131854">
+ <SymbolicName>VER_E_STACK_UNEXPECTED</SymbolicName>
+ <Message>"Unexpected type on the stack."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131855">
+ <SymbolicName>VER_E_STACK_EXCEPTION</SymbolicName>
+ <Message>"Missing stack slot for exception."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131856">
+ <SymbolicName>VER_E_STACK_OVERFLOW</SymbolicName>
+ <Message>"Stack overflow."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131857">
+ <SymbolicName>VER_E_STACK_UNDERFLOW</SymbolicName>
+ <Message>"Stack underflow."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131858">
+ <SymbolicName>VER_E_STACK_EMPTY</SymbolicName>
+ <Message>"Stack empty."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131859">
+ <SymbolicName>VER_E_STACK_UNINIT</SymbolicName>
+ <Message>"Uninitialized item on stack."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013185a">
+ <SymbolicName>VER_E_STACK_I_I4_I8</SymbolicName>
+ <Message>"Expected I, I4, or I8 on the stack."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013185b">
+ <SymbolicName>VER_E_STACK_R_R4_R8</SymbolicName>
+ <Message>"Expected R, R4, or R8 on the stack."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013185c">
+ <SymbolicName>VER_E_STACK_NO_R_I8</SymbolicName>
+ <Message>"unexpected R, R4, R8, or I8 on the stack."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013185d">
+ <SymbolicName>VER_E_STACK_NUMERIC</SymbolicName>
+ <Message>"Expected numeric type on the stack."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013185e">
+ <SymbolicName>VER_E_STACK_OBJREF</SymbolicName>
+ <Message>"Expected an ObjRef on the stack."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013185f">
+ <SymbolicName>VER_E_STACK_P_OBJREF</SymbolicName>
+ <Message>"Expected address of an ObjRef on the stack."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131860">
+ <SymbolicName>VER_E_STACK_BYREF</SymbolicName>
+ <Message>"Expected ByRef on the stack."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131861">
+ <SymbolicName>VER_E_STACK_METHOD</SymbolicName>
+ <Message>"Expected pointer to function on the stack."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131862">
+ <SymbolicName>VER_E_STACK_ARRAY_SD</SymbolicName>
+ <Message>"Expected single dimension array on the stack."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131863">
+ <SymbolicName>VER_E_STACK_VALCLASS</SymbolicName>
+ <Message>"Expected value type instance on the stack."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131864">
+ <SymbolicName>VER_E_STACK_P_VALCLASS</SymbolicName>
+ <Message>"Expected address of value type on the stack."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131865">
+ <SymbolicName>VER_E_STACK_NO_VALCLASS</SymbolicName>
+ <Message>"Unexpected value type instance on the stack."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131866">
+ <SymbolicName>VER_E_LOC_DEAD</SymbolicName>
+ <Message>"Local variable is unusable at this point."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131867">
+ <SymbolicName>VER_E_LOC_NUM</SymbolicName>
+ <Message>"Unrecognized local variable number."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131868">
+ <SymbolicName>VER_E_ARG_NUM</SymbolicName>
+ <Message>"Unrecognized argument number."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131869">
+ <SymbolicName>VER_E_TOKEN_RESOLVE</SymbolicName>
+ <Message>"Unable to resolve token."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013186a">
+ <SymbolicName>VER_E_TOKEN_TYPE</SymbolicName>
+ <Message>"Unable to resolve type of the token."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013186b">
+ <SymbolicName>VER_E_TOKEN_TYPE_MEMBER</SymbolicName>
+ <Message>"Expected memberRef, memberDef or methodSpec token."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013186c">
+ <SymbolicName>VER_E_TOKEN_TYPE_FIELD</SymbolicName>
+ <Message>"Expected memberRef or fieldDef token."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013186d">
+ <SymbolicName>VER_E_TOKEN_TYPE_SIG</SymbolicName>
+ <Message>"Expected signature token."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013186e">
+ <SymbolicName>VER_E_UNVERIFIABLE</SymbolicName>
+ <Message>"Instruction cannot be verified."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013186f">
+ <SymbolicName>VER_E_LDSTR_OPERAND</SymbolicName>
+ <Message>"Operand does not point to a valid string ref."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131870">
+ <SymbolicName>VER_E_RET_PTR_TO_STACK</SymbolicName>
+ <Message>"Return type is ByRef, TypedReference, ArgHandle, or ArgIterator."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131871">
+ <SymbolicName>VER_E_RET_VOID</SymbolicName>
+ <Message>"Stack must be empty on return from a void function."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131872">
+ <SymbolicName>VER_E_RET_MISSING</SymbolicName>
+ <Message>"Return value missing on the stack."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131873">
+ <SymbolicName>VER_E_RET_EMPTY</SymbolicName>
+ <Message>"Stack must contain only the return value."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131874">
+ <SymbolicName>VER_E_RET_UNINIT</SymbolicName>
+ <Message>"Return uninitialized data."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131875">
+ <SymbolicName>VER_E_ARRAY_ACCESS</SymbolicName>
+ <Message>"Illegal array access."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131876">
+ <SymbolicName>VER_E_ARRAY_V_STORE</SymbolicName>
+ <Message>"Store non Object type into Object array."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131877">
+ <SymbolicName>VER_E_ARRAY_SD</SymbolicName>
+ <Message>"Expected single dimension array."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131878">
+ <SymbolicName>VER_E_ARRAY_SD_PTR</SymbolicName>
+ <Message>"Expected single dimension array of pointer types."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131879">
+ <SymbolicName>VER_E_ARRAY_FIELD</SymbolicName>
+ <Message>"Array field access is denied."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013187a">
+ <SymbolicName>VER_E_ARGLIST</SymbolicName>
+ <Message>"Allowed only in vararg methods."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013187b">
+ <SymbolicName>VER_E_VALCLASS</SymbolicName>
+ <Message>"Value type expected."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013187c">
+ <SymbolicName>VER_E_METHOD_ACCESS</SymbolicName>
+ <Message>"Method is not visible."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013187d">
+ <SymbolicName>VER_E_FIELD_ACCESS</SymbolicName>
+ <Message>"Field is not visible."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013187e">
+ <SymbolicName>VER_E_DEAD</SymbolicName>
+ <Message>"Item is unusable at this point."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013187f">
+ <SymbolicName>VER_E_FIELD_STATIC</SymbolicName>
+ <Message>"Expected static field."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131880">
+ <SymbolicName>VER_E_FIELD_NO_STATIC</SymbolicName>
+ <Message>"Expected non-static field."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131881">
+ <SymbolicName>VER_E_ADDR</SymbolicName>
+ <Message>"Address of not allowed for this item."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131882">
+ <SymbolicName>VER_E_ADDR_BYREF</SymbolicName>
+ <Message>"Address of not allowed for ByRef."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131883">
+ <SymbolicName>VER_E_ADDR_LITERAL</SymbolicName>
+ <Message>"Address of not allowed for literal field."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131884">
+ <SymbolicName>VER_E_INITONLY</SymbolicName>
+ <Message>"Cannot change initonly field outside its .ctor."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131885">
+ <SymbolicName>VER_E_THROW</SymbolicName>
+ <Message>"Cannot throw this object."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131886">
+ <SymbolicName>VER_E_CALLVIRT_VALCLASS</SymbolicName>
+ <Message>"Callvirt on a value type method."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131887">
+ <SymbolicName>VER_E_CALL_SIG</SymbolicName>
+ <Message>"Call signature mismatch."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131888">
+ <SymbolicName>VER_E_CALL_STATIC</SymbolicName>
+ <Message>"Static function expected."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131889">
+ <SymbolicName>VER_E_CTOR</SymbolicName>
+ <Message>".ctor expected."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013188a">
+ <SymbolicName>VER_E_CTOR_VIRT</SymbolicName>
+ <Message>"Cannot use callvirt on .ctor."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013188b">
+ <SymbolicName>VER_E_CTOR_OR_SUPER</SymbolicName>
+ <Message>"Only super::ctor or typeof(this)::ctor allowed here."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013188c">
+ <SymbolicName>VER_E_CTOR_MUL_INIT</SymbolicName>
+ <Message>"Possible call to .ctor more than once."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013188d">
+ <SymbolicName>VER_E_SIG</SymbolicName>
+ <Message>"Unrecognized signature."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013188e">
+ <SymbolicName>VER_E_SIG_ARRAY</SymbolicName>
+ <Message>"Cannot resolve Array type."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013188f">
+ <SymbolicName>VER_E_SIG_ARRAY_PTR</SymbolicName>
+ <Message>"Array of ELEMENT_TYPE_PTR."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131890">
+ <SymbolicName>VER_E_SIG_ARRAY_BYREF</SymbolicName>
+ <Message>"Array of ELEMENT_TYPE_BYREF or ELEMENT_TYPE_TYPEDBYREF."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131891">
+ <SymbolicName>VER_E_SIG_ELEM_PTR</SymbolicName>
+ <Message>"ELEMENT_TYPE_PTR cannot be verified."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131892">
+ <SymbolicName>VER_E_SIG_VARARG</SymbolicName>
+ <Message>"Unexpected vararg."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131893">
+ <SymbolicName>VER_E_SIG_VOID</SymbolicName>
+ <Message>"Unexpected Void."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131894">
+ <SymbolicName>VER_E_SIG_BYREF_BYREF</SymbolicName>
+ <Message>"ByRef of ByRef"</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131896">
+ <SymbolicName>VER_E_CODE_SIZE_ZERO</SymbolicName>
+ <Message>"Code size is zero."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131897">
+ <SymbolicName>VER_E_BAD_VARARG</SymbolicName>
+ <Message>"Unrecognized use of vararg."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131898">
+ <SymbolicName>VER_E_TAIL_CALL</SymbolicName>
+ <Message>"Missing call, callvirt or calli."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131899">
+ <SymbolicName>VER_E_TAIL_BYREF</SymbolicName>
+ <Message>"Cannot pass ByRef to a tail call."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013189a">
+ <SymbolicName>VER_E_TAIL_RET</SymbolicName>
+ <Message>"Missing ret."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013189b">
+ <SymbolicName>VER_E_TAIL_RET_VOID</SymbolicName>
+ <Message>"Void ret type expected for tail call."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013189c">
+ <SymbolicName>VER_E_TAIL_RET_TYPE</SymbolicName>
+ <Message>"Tail call return type not compatible."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013189d">
+ <SymbolicName>VER_E_TAIL_STACK_EMPTY</SymbolicName>
+ <Message>"Stack not empty after tail call."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013189e">
+ <SymbolicName>VER_E_METHOD_END</SymbolicName>
+ <Message>"Method ends in the middle of an instruction."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013189f">
+ <SymbolicName>VER_E_BAD_BRANCH</SymbolicName>
+ <Message>"Branch out of the method."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318a0">
+ <SymbolicName>VER_E_FIN_OVERLAP</SymbolicName>
+ <Message>"Finally handler blocks overlap."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318a1">
+ <SymbolicName>VER_E_LEXICAL_NESTING</SymbolicName>
+ <Message>"Lexical nesting."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318a2">
+ <SymbolicName>VER_E_VOLATILE</SymbolicName>
+ <Message>"Missing ldsfld, stsfld, ldind, stind, ldfld, stfld, ldobj, stobj, initblk or cpblk."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318a3">
+ <SymbolicName>VER_E_UNALIGNED</SymbolicName>
+ <Message>"Missing ldind, stind, ldfld, stfld, ldobj, stobj, initblk or cpblk."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318a4">
+ <SymbolicName>VER_E_INNERMOST_FIRST</SymbolicName>
+ <Message>"Innermost exception blocks should be declared first."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318a5">
+ <SymbolicName>VER_E_CALLI_VIRTUAL</SymbolicName>
+ <Message>"Calli not allowed on virtual methods."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318a6">
+ <SymbolicName>VER_E_CALL_ABSTRACT</SymbolicName>
+ <Message>"Call not allowed on abstract methods."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318a7">
+ <SymbolicName>VER_E_STACK_UNEXP_ARRAY</SymbolicName>
+ <Message>"Unexpected array type on the stack."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318a8">
+ <SymbolicName>VER_E_NOT_IN_GC_HEAP</SymbolicName>
+ <Message>"Value type with NotInGCHeap attribute being created on the GC heap."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318a9">
+ <SymbolicName>VER_E_TRY_N_EMPTY_STACK</SymbolicName>
+ <Message>"Attempt to enter a try block with nonempty stack."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318aa">
+ <SymbolicName>VER_E_DLGT_CTOR</SymbolicName>
+ <Message>"Unrecognized arguments for delegate .ctor."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318ab">
+ <SymbolicName>VER_E_DLGT_BB</SymbolicName>
+ <Message>"Delegate .ctor not allowed at the start of a basic block when the function pointer argument is a virtual method."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318ac">
+ <SymbolicName>VER_E_DLGT_PATTERN</SymbolicName>
+ <Message>"Dup, ldvirtftn, newobj delegate::.ctor() pattern expected (in the same basic block)."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318ad">
+ <SymbolicName>VER_E_DLGT_LDFTN</SymbolicName>
+ <Message>"Ldftn or ldvirtftn instruction required before call to a delegate .ctor."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318ae">
+ <SymbolicName>VER_E_FTN_ABSTRACT</SymbolicName>
+ <Message>"Attempt to load address of an abstract method."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318af">
+ <SymbolicName>VER_E_SIG_C_VC</SymbolicName>
+ <Message>"ELEMENT_TYPE_CLASS ValueClass in signature."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318b0">
+ <SymbolicName>VER_E_SIG_VC_C</SymbolicName>
+ <Message>"ELEMENT_TYPE_VALUETYPE non-ValueClass in signature."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318b1">
+ <SymbolicName>VER_E_BOX_PTR_TO_STACK</SymbolicName>
+ <Message>"Box operation on TypedReference, ArgHandle, or ArgIterator."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318b2">
+ <SymbolicName>VER_E_SIG_BYREF_TB_AH</SymbolicName>
+ <Message>"ByRef of TypedReference, ArgHandle, or ArgIterator."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318b3">
+ <SymbolicName>VER_E_SIG_ARRAY_TB_AH</SymbolicName>
+ <Message>"Array of TypedReference, ArgHandle, or ArgIterator."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318b4">
+ <SymbolicName>VER_E_ENDFILTER_STACK</SymbolicName>
+ <Message>"Stack not empty when leaving an exception filter."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318b5">
+ <SymbolicName>VER_E_DLGT_SIG_I</SymbolicName>
+ <Message>"Unrecognized delegate .ctor signature; expected I."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318b6">
+ <SymbolicName>VER_E_DLGT_SIG_O</SymbolicName>
+ <Message>"Unrecognized delegate .ctor signature; expected Object."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318b7">
+ <SymbolicName>VER_E_RA_PTR_TO_STACK</SymbolicName>
+ <Message>"Mkrefany on TypedReference, ArgHandle, or ArgIterator."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318b8">
+ <SymbolicName>VER_E_CATCH_VALUE_TYPE</SymbolicName>
+ <Message>"Value type not allowed as catch type."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318b9">
+ <SymbolicName>VER_E_CATCH_BYREF</SymbolicName>
+ <Message>"ByRef not allowed as catch type."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318ba">
+ <SymbolicName>VER_E_FIL_PRECEED_HND</SymbolicName>
+ <Message>"filter block should immediately precede handler block"</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318bb">
+ <SymbolicName>VER_E_LDVIRTFTN_STATIC</SymbolicName>
+ <Message>"ldvirtftn on static"</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318bc">
+ <SymbolicName>VER_E_CALLVIRT_STATIC</SymbolicName>
+ <Message>"callvirt on static"</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318bd">
+ <SymbolicName>VER_E_INITLOCALS</SymbolicName>
+ <Message>"initlocals must be set for verifiable methods with one or more local variables."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318be">
+ <SymbolicName>VER_E_BR_TO_EXCEPTION</SymbolicName>
+ <Message>"branch or leave to the beginning of a catch/filter handler"</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318bf">
+ <SymbolicName>VER_E_CALL_CTOR</SymbolicName>
+ <Message>"Call to .ctor only allowed to initialize this pointer from within a .ctor. Try newobj."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318c0">
+ <SymbolicName>VER_E_VALCLASS_OBJREF_VAR</SymbolicName>
+ <Message>"Value type, ObjRef type or variable type expected."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318c1">
+ <SymbolicName>VER_E_STACK_P_VALCLASS_OBJREF_VAR</SymbolicName>
+ <Message>"Expected address of value type, ObjRef type or variable type on the stack."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318c2">
+ <SymbolicName>VER_E_SIG_VAR_PARAM</SymbolicName>
+ <Message>"Unrecognized type parameter of enclosing class."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318c3">
+ <SymbolicName>VER_E_SIG_MVAR_PARAM</SymbolicName>
+ <Message>"Unrecognized type parameter of enclosing method."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318c4">
+ <SymbolicName>VER_E_SIG_VAR_ARG</SymbolicName>
+ <Message>"Unrecognized type argument of referenced class instantiation."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318c5">
+ <SymbolicName>VER_E_SIG_MVAR_ARG</SymbolicName>
+ <Message>"Unrecognized type argument of referenced method instantiation."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318c6">
+ <SymbolicName>VER_E_SIG_GENERICINST</SymbolicName>
+ <Message>"Cannot resolve generic type."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318c7">
+ <SymbolicName>VER_E_SIG_METHOD_INST</SymbolicName>
+ <Message>"Method instantiation contains non boxable type arguments."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318c8">
+ <SymbolicName>VER_E_SIG_METHOD_PARENT_INST</SymbolicName>
+ <Message>"Method parent instantiation contains non boxable type arguments."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318c9">
+ <SymbolicName>VER_E_SIG_FIELD_PARENT_INST</SymbolicName>
+ <Message>"Field parent instantiation contains non boxable type arguments."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318ca">
+ <SymbolicName>VER_E_CALLCONV_NOT_GENERICINST</SymbolicName>
+ <Message>"Unrecognized calling convention for an instantiated generic method."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318cb">
+ <SymbolicName>VER_E_TOKEN_BAD_METHOD_SPEC</SymbolicName>
+ <Message>"Unrecognized generic method in method instantiation."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318cc">
+ <SymbolicName>VER_E_BAD_READONLY_PREFIX</SymbolicName>
+ <Message>"Missing ldelema or call following readonly. prefix."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318cd">
+ <SymbolicName>VER_E_BAD_CONSTRAINED_PREFIX</SymbolicName>
+ <Message>"Missing callvirt following constrained. prefix."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318ce">
+ <SymbolicName>VER_E_CIRCULAR_VAR_CONSTRAINTS</SymbolicName>
+ <Message>"Method parent has circular class type parameter constraints."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318cf">
+ <SymbolicName>VER_E_CIRCULAR_MVAR_CONSTRAINTS</SymbolicName>
+ <Message>"Method has circular method type parameter constraints."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318d0">
+ <SymbolicName>VER_E_UNSATISFIED_METHOD_INST</SymbolicName>
+ <Message>"Method instantiation has unsatisfied method type parameter constraints."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318d1">
+ <SymbolicName>VER_E_UNSATISFIED_METHOD_PARENT_INST</SymbolicName>
+ <Message>"Method parent instantiation has unsatisfied class type parameter constraints."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318d2">
+ <SymbolicName>VER_E_UNSATISFIED_FIELD_PARENT_INST</SymbolicName>
+ <Message>"Field parent instantiation has unsatisfied class type parameter constraints."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318d3">
+ <SymbolicName>VER_E_UNSATISFIED_BOX_OPERAND</SymbolicName>
+ <Message>"Type operand of box instruction has unsatisfied class type parameter constraints."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318d4">
+ <SymbolicName>VER_E_CONSTRAINED_CALL_WITH_NON_BYREF_THIS</SymbolicName>
+ <Message>"The 'this' argument to a constrained call must have ByRef type."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318d5">
+ <SymbolicName>VER_E_CONSTRAINED_OF_NON_VARIABLE_TYPE</SymbolicName>
+ <Message>"The operand to a constrained prefix instruction must be a type parameter."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318d6">
+ <SymbolicName>VER_E_READONLY_UNEXPECTED_CALLEE</SymbolicName>
+ <Message>"The readonly prefix may only be applied to calls to array methods returning ByRefs."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318d7">
+ <SymbolicName>VER_E_READONLY_ILLEGAL_WRITE</SymbolicName>
+ <Message>"Illegal write to readonly ByRef."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318d8">
+ <SymbolicName>VER_E_READONLY_IN_MKREFANY</SymbolicName>
+ <Message>"A readonly ByRef cannot be used with mkrefany."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318d9">
+ <SymbolicName>VER_E_UNALIGNED_ALIGNMENT</SymbolicName>
+ <Message>"Alignment specified for 'unaligned' prefix must be 1, 2, or 4."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318da">
+ <SymbolicName>VER_E_TAILCALL_INSIDE_EH</SymbolicName>
+ <Message>"The tail.call (or calli or callvirt) instruction cannot be used to transfer control out of a try, filter, catch, or finally block."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318db">
+ <SymbolicName>VER_E_BACKWARD_BRANCH</SymbolicName>
+ <Message>"Stack height at all points must be determinable in a single forward scan of IL."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318dc">
+ <SymbolicName>VER_E_CALL_TO_VTYPE_BASE</SymbolicName>
+ <Message>"Call to base type of valuetype."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318dd">
+ <SymbolicName>VER_E_NEWOBJ_OF_ABSTRACT_CLASS</SymbolicName>
+ <Message>"Cannot construct an instance of abstract class."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318de">
+ <SymbolicName>VER_E_UNMANAGED_POINTER</SymbolicName>
+ <Message>"Unmanaged pointers are not a verifiable type."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318df">
+ <SymbolicName>VER_E_LDFTN_NON_FINAL_VIRTUAL</SymbolicName>
+ <Message>"Cannot LDFTN a non-final virtual method."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318e0">
+ <SymbolicName>VER_E_FIELD_OVERLAP</SymbolicName>
+ <Message>"Accessing type with overlapping fields."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318e1">
+ <SymbolicName>VER_E_THIS_MISMATCH</SymbolicName>
+ <Message>"The 'this' parameter to the call must be the calling method's 'this' parameter."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318e2">
+ <SymbolicName>VER_E_STACK_I_I4</SymbolicName>
+ <Message>"Expected I4 on the stack."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318f0">
+ <SymbolicName>VER_E_BAD_PE</SymbolicName>
+ <Message>"Unverifiable PE Header/native stub."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318f1">
+ <SymbolicName>VER_E_BAD_MD</SymbolicName>
+ <Message>"Unrecognized metadata, unable to verify IL."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318f2">
+ <SymbolicName>VER_E_BAD_APPDOMAIN</SymbolicName>
+ <Message>"Unrecognized appdomain pointer."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318f3">
+ <SymbolicName>VER_E_TYPELOAD</SymbolicName>
+ <Message>"Type load failed."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318f4">
+ <SymbolicName>VER_E_PE_LOAD</SymbolicName>
+ <Message>"Module load failed."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318f5">
+ <SymbolicName>VER_E_WRITE_RVA_STATIC</SymbolicName>
+ <Message>"Cannot modify an imaged based (RVA) static"</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x801318f6">
+ <SymbolicName>VER_E_INITIALIZE_ARRAY_MISSING_TOKEN</SymbolicName>
+ <Message>"Ldtoken instruction required before call to System.Runtime.CompilerServices.InitializeArray."</Message>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131904">
+ <SymbolicName>COR_E_SqlException</SymbolicName>
+ <Comment> System.Data.SqlClient.SqlClientException </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131920">
+ <SymbolicName>COR_E_Data</SymbolicName>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131921">
+ <SymbolicName>COR_E_DataDeletedRowInaccessible</SymbolicName>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131922">
+ <SymbolicName>COR_E_DataDuplicateName</SymbolicName>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131923">
+ <SymbolicName>COR_E_DataInRowChangingEvent</SymbolicName>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131924">
+ <SymbolicName>COR_E_DataInvalidConstraint</SymbolicName>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131925">
+ <SymbolicName>COR_E_DataMissingPrimaryKey</SymbolicName>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131926">
+ <SymbolicName>COR_E_DataNoNullAllowed</SymbolicName>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131927">
+ <SymbolicName>COR_E_DataReadOnly</SymbolicName>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131928">
+ <SymbolicName>COR_E_DataRowNotInTable</SymbolicName>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131929">
+ <SymbolicName>COR_E_DataVersionNotFound</SymbolicName>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013192a">
+ <SymbolicName>COR_E_DataConstraint</SymbolicName>
+</HRESULT>
+
+<HRESULT NumericValue="0x8013192b">
+ <SymbolicName>COR_E_StrongTyping</SymbolicName>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131930">
+ <SymbolicName>COR_E_SqlType</SymbolicName>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131931">
+ <SymbolicName>COR_E_SqlNullValue</SymbolicName>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131932">
+ <SymbolicName>COR_E_SqlTruncate</SymbolicName>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131933">
+ <SymbolicName>COR_E_AdapterMapping</SymbolicName>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131934">
+ <SymbolicName>COR_E_DataAdapter</SymbolicName>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131935">
+ <SymbolicName>COR_E_DBConcurrency</SymbolicName>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131936">
+ <SymbolicName>COR_E_OperationAborted</SymbolicName>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131937">
+ <SymbolicName>COR_E_InvalidUdt</SymbolicName>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131937">
+ <SymbolicName>COR_E_OdbcException</SymbolicName>
+ <Comment> System.Data.Odbc.OdbcException </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131938">
+ <SymbolicName>COR_E_OracleException</SymbolicName>
+ <Comment> System.Data.OracleClient.OracleException </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131940">
+ <SymbolicName>COR_E_Xml</SymbolicName>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131941">
+ <SymbolicName>COR_E_XmlSchema</SymbolicName>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131942">
+ <SymbolicName>COR_E_XmlXslt</SymbolicName>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131943">
+ <SymbolicName>COR_E_XmlXPath</SymbolicName>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131944">
+ <SymbolicName>COR_E_XmlQuery</SymbolicName>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b00">
+ <SymbolicName>VLDTR_E_IFACE_NOTIFACE</SymbolicName>
+ <Message>"Interface in InterfaceImpl is not marked tdInterface."</Message>
+ <Comment> Interface in InterfaceImpl is not marked tdInterface </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b01">
+ <SymbolicName>VLDTR_E_FD_RVAHASNORVA</SymbolicName>
+ <Message>"Field marked fdHasFieldRVA but has no RVA record."</Message>
+ <Comment> Field marked fdHasFieldRVA but has no RVA rec </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b02">
+ <SymbolicName>VLDTR_E_FD_RVAHASZERORVA</SymbolicName>
+ <Message>"Field marked fdHasFieldRVA has RVA set to zero."</Message>
+ <Comment> Field marked fdHasFieldRVA has RVA =0 </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b03">
+ <SymbolicName>VLDTR_E_MD_RVAANDIMPLMAP</SymbolicName>
+ <Message>"Method has both non-zero RVA and ImplMap."</Message>
+ <Comment> Method has both RVA !=0 and ImplMap </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b04">
+ <SymbolicName>VLDTR_E_TD_EXTRAFLAGS</SymbolicName>
+ <Message>"TypeDef has extraneous bits in flags."</Message>
+ <Comment> TypeDef has extraneous bits in flags </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b05">
+ <SymbolicName>VLDTR_E_TD_EXTENDSITSELF</SymbolicName>
+ <Message>"TypeDef extends itself."</Message>
+ <Comment> TypeDef extends itself </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b06">
+ <SymbolicName>VLDTR_E_TD_SYSVTNOTEXTOBJ</SymbolicName>
+ <Message>"System.ValueType does not extend System.Object."</Message>
+ <Comment> System.ValueType does not extend System.Object </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b07">
+ <SymbolicName>VLDTR_E_TD_EXTTYPESPEC</SymbolicName>
+ <Message>"Class extends TypeSpec (warning)."</Message>
+ <Comment> Class extends TypeSpec (warning) </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b09">
+ <SymbolicName>VLDTR_E_TD_VTNOSIZE</SymbolicName>
+ <Message>"Value Class has zero size."</Message>
+ <Comment> Value Class has zero size </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b0a">
+ <SymbolicName>VLDTR_E_TD_IFACESEALED</SymbolicName>
+ <Message>"Interface is sealed."</Message>
+ <Comment> Interface is sealed </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b0b">
+ <SymbolicName>VLDTR_E_NC_BADNESTED</SymbolicName>
+ <Message>"Bad 'nested' token in NestedClass."</Message>
+ <Comment> Bad "nested" token in NestedClass </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b0c">
+ <SymbolicName>VLDTR_E_NC_BADENCLOSER</SymbolicName>
+ <Message>"Bad 'enclosing' token in NestedClass."</Message>
+ <Comment> Bad "enclosing" token in NestedClass </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b0d">
+ <SymbolicName>VLDTR_E_NC_DUP</SymbolicName>
+ <Message>"Duplicate NestedClass record."</Message>
+ <Comment> Duplicate NestedClass record </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b0e">
+ <SymbolicName>VLDTR_E_NC_DUPENCLOSER</SymbolicName>
+ <Message>"Duplicate NestedClass with different encloser."</Message>
+ <Comment> Duplicate NestedClass with different encloser </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b0f">
+ <SymbolicName>VLDTR_E_FRVA_ZERORVA</SymbolicName>
+ <Message>"RVA set to zero in FieldRVA record."</Message>
+ <Comment> RVA=0 in FieldRVA record </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b10">
+ <SymbolicName>VLDTR_E_FRVA_BADFIELD</SymbolicName>
+ <Message>"Invalid field token in FieldRVA record."</Message>
+ <Comment> Invalid field token in FieldRVA record </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b11">
+ <SymbolicName>VLDTR_E_FRVA_DUPRVA</SymbolicName>
+ <Message>"Duplicate RVA in FieldRVA record."</Message>
+ <Comment> Duplicate RVA in FieldRVA record </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b12">
+ <SymbolicName>VLDTR_E_FRVA_DUPFIELD</SymbolicName>
+ <Message>"Duplicate field in FieldRVA record."</Message>
+ <Comment> Duplicate field in FieldRVA record </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b13">
+ <SymbolicName>VLDTR_E_EP_BADTOKEN</SymbolicName>
+ <Message>"Bad token as entry point in CLR header."</Message>
+ <Comment> Bad token as entry point in CLR header </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b14">
+ <SymbolicName>VLDTR_E_EP_INSTANCE</SymbolicName>
+ <Message>"Entry point in CLR header is a token of instance method."</Message>
+ <Comment> Entry point in CLR header is a token of instance method </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b15">
+ <SymbolicName>VLDTR_E_TD_ENUMFLDBADTYPE</SymbolicName>
+ <Message>"Enum has non-integral underlying type."</Message>
+ <Comment> Enum has non-integral underlying type </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b16">
+ <SymbolicName>VLDTR_E_MD_BADRVA</SymbolicName>
+ <Message>"Method has bogus RVA."</Message>
+ <Comment> Method has bogus RVA </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b17">
+ <SymbolicName>VLDTR_E_FD_LITERALNODEFAULT</SymbolicName>
+ <Message>"Literal field has no const value."</Message>
+ <Comment> Literal field has no const value </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b18">
+ <SymbolicName>VLDTR_E_IFACE_METHNOTIMPL</SymbolicName>
+ <Message>"Class implementing an interface does not implement one of methods."</Message>
+ <Comment> Class implementing an interface doesn't impl.one of methods </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b19">
+ <SymbolicName>VLDTR_E_CA_BADPARENT</SymbolicName>
+ <Message>"CA has invalid owner."</Message>
+ <Comment> CA has invalid owner </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b1a">
+ <SymbolicName>VLDTR_E_CA_BADTYPE</SymbolicName>
+ <Message>"CA has invalid type."</Message>
+ <Comment> CA has invalid type </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b1b">
+ <SymbolicName>VLDTR_E_CA_NOTCTOR</SymbolicName>
+ <Message>"CA type is not .ctor."</Message>
+ <Comment> CA type is not .ctor </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b1c">
+ <SymbolicName>VLDTR_E_CA_BADSIG</SymbolicName>
+ <Message>"CA type has bad signature."</Message>
+ <Comment> CA type has bad signature </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b1d">
+ <SymbolicName>VLDTR_E_CA_NOSIG</SymbolicName>
+ <Message>"CA type has no signature."</Message>
+ <Comment> CA type has no signature </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b1e">
+ <SymbolicName>VLDTR_E_CA_BADPROLOG</SymbolicName>
+ <Message>"CA blob has bad prolog (not 0x01 0x00)."</Message>
+ <Comment> CA blob has bad prolog (not 0x01 0x00) </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b1f">
+ <SymbolicName>VLDTR_E_MD_BADLOCALSIGTOK</SymbolicName>
+ <Message>"Method has invalid LocalSig token."</Message>
+ <Comment> Method has invalid LocalSig token </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b20">
+ <SymbolicName>VLDTR_E_MD_BADHEADER</SymbolicName>
+ <Message>"Method has invalid header."</Message>
+ <Comment> Method has invalid header </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b21">
+ <SymbolicName>VLDTR_E_EP_TOOMANYARGS</SymbolicName>
+ <Message>"Entry point has more than one argument."</Message>
+ <Comment> Entry point has more than one arg </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b22">
+ <SymbolicName>VLDTR_E_EP_BADRET</SymbolicName>
+ <Message>"Entry point has bad return type."</Message>
+ <Comment> Entry point has bad return type </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b23">
+ <SymbolicName>VLDTR_E_EP_BADARG</SymbolicName>
+ <Message>"Entry point has bad argument."</Message>
+ <Comment> Entry point has bad argument </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b24">
+ <SymbolicName>VLDTR_E_SIG_BADVOID</SymbolicName>
+ <Message>"Illegal 'void' in signature."</Message>
+ <Comment> Illegal "void" in signature </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b25">
+ <SymbolicName>VLDTR_E_IFACE_METHMULTIMPL</SymbolicName>
+ <Message>"Multiple implementation of method."</Message>
+ <Comment> Multiple implementation of method </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b26">
+ <SymbolicName>VLDTR_E_GP_NAMENULL</SymbolicName>
+ <Message>"GenericParam name is NULL."</Message>
+ <Comment> GenericParam name is NULL </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b27">
+ <SymbolicName>VLDTR_E_GP_OWNERNIL</SymbolicName>
+ <Message>"GenericParam has nil owner."</Message>
+ <Comment> GenericParam has nil owner. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b28">
+ <SymbolicName>VLDTR_E_GP_DUPNAME</SymbolicName>
+ <Message>"GenericParam has duplicate by owner and name."</Message>
+ <Comment> GenericParam has duplicate by owner and name. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b29">
+ <SymbolicName>VLDTR_E_GP_DUPNUMBER</SymbolicName>
+ <Message>"GenericParam has duplicate by owner and number."</Message>
+ <Comment> GenericParam has duplicate by owner and number. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b2a">
+ <SymbolicName>VLDTR_E_GP_NONSEQ_BY_OWNER</SymbolicName>
+ <Message>"GenericParam is non sequential by owner."</Message>
+ <Comment> GenericParam is non sequential by owner </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b2b">
+ <SymbolicName>VLDTR_E_GP_NONSEQ_BY_NUMBER</SymbolicName>
+ <Message>"GenericParam is non sequential by number."</Message>
+ <Comment> GenericParam is non sequential by number </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b2c">
+ <SymbolicName>VLDTR_E_GP_UNEXPECTED_OWNER_FOR_VARIANT_VAR</SymbolicName>
+ <Message>"GenericParam has variance but its owner is not an interface or delegate."</Message>
+ <Comment> GenericParam has variance but its owner is not an interface or delegate </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b2d">
+ <SymbolicName>VLDTR_E_GP_ILLEGAL_VARIANT_MVAR</SymbolicName>
+ <Message>"GenericParam is a method type parameter and must be non-variant."</Message>
+ <Comment> GenericParam is a method type parameter and must be non-variant </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b2e">
+ <SymbolicName>VLDTR_E_GP_ILLEGAL_VARIANCE_FLAGS</SymbolicName>
+ <Message>"GenericParam has illegal value for variance flags."</Message>
+ <Comment> GenericParam has illegal value for variance flags </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b2f">
+ <SymbolicName>VLDTR_E_GP_REFANDVALUETYPE</SymbolicName>
+ <Message>"GenericParam has incompatible special constraints reference type and valuetype."</Message>
+ <Comment> GenericParam has incompatible special constraints reference type and valuetype </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b30">
+ <SymbolicName>VLDTR_E_GPC_OWNERNIL</SymbolicName>
+ <Message>"GenericParamConstraint has nil owner."</Message>
+ <Comment> GenericParamConstraint has nil owner </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b31">
+ <SymbolicName>VLDTR_E_GPC_DUP</SymbolicName>
+ <Message>"GenericParamConstraint has duplicate by owner and constraint."</Message>
+ <Comment> GenericParamConstraint has duplicate by owner and constraint </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b32">
+ <SymbolicName>VLDTR_E_GPC_NONCONTIGUOUS</SymbolicName>
+ <Message>"GenericParamConstraint is non-contiguous with preceeding constraints for same owner."</Message>
+ <Comment> GenericParamConstraint is non-contiguous with preceeding constraints for same owner </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b33">
+ <SymbolicName>VLDTR_E_MS_METHODNIL</SymbolicName>
+ <Message>"MethodSpec has nil method."</Message>
+ <Comment> MethodSpec has nil method </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b34">
+ <SymbolicName>VLDTR_E_MS_DUP</SymbolicName>
+ <Message>"MethodSpec has duplicate based on method and instantiation."</Message>
+ <Comment> MethodSpec has duplicate based own method and instantiation </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b35">
+ <SymbolicName>VLDTR_E_MS_BADCALLINGCONV</SymbolicName>
+ <Message>"MethodSpec signature has invalid calling convention."</Message>
+ <Comment> MethodSpec signature has invalid calling convention </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b36">
+ <SymbolicName>VLDTR_E_MS_MISSARITY</SymbolicName>
+ <Message>"MethodSpec signature is missing arity specification."</Message>
+ <Comment> MethodSpec signature is missing arity specification </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b37">
+ <SymbolicName>VLDTR_E_MS_MISSARG</SymbolicName>
+ <Message>"MethodSpec signature is missing type argument."</Message>
+ <Comment> MethodSpec signature is missing type argument </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b38">
+ <SymbolicName>VLDTR_E_MS_ARITYMISMATCH</SymbolicName>
+ <Message>"MethodSpec arity of generic method and instantiation do not match."</Message>
+ <Comment> MethodSpec arity of generic method and instantiation do not match </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b39">
+ <SymbolicName>VLDTR_E_MS_METHODNOTGENERIC</SymbolicName>
+ <Message>"MethodSpec method is not generic."</Message>
+ <Comment> MethodSpec method is not generic </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b3a">
+ <SymbolicName>VLDTR_E_SIG_MISSARITY</SymbolicName>
+ <Message>"Signature missing arity of instantiated generic type."</Message>
+ <Comment> Signature missing arity of instantiated generic type </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b3b">
+ <SymbolicName>VLDTR_E_SIG_ARITYMISMATCH</SymbolicName>
+ <Message>"Signature has generic type of arity instantiated at different arity."</Message>
+ <Comment> Signature has generic type of arity instantiated at different arity </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b3c">
+ <SymbolicName>VLDTR_E_MD_GENERIC_CCTOR</SymbolicName>
+ <Message>"Method cannot be both generic and a class constructor."</Message>
+ <Comment> Method cannot be both generic and a class constructor </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b3d">
+ <SymbolicName>VLDTR_E_MD_GENERIC_CTOR</SymbolicName>
+ <Message>"Method cannot be both generic and an instance constructor."</Message>
+ <Comment> Method cannot be both generic and an instance constructor </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b3e">
+ <SymbolicName>VLDTR_E_MD_GENERIC_IMPORT</SymbolicName>
+ <Message>"Method cannot be both generic and defined on an imported type."</Message>
+ <Comment> Method cannot be both generic and defined on an imported type </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b3f">
+ <SymbolicName>VLDTR_E_MD_GENERIC_BADCALLCONV</SymbolicName>
+ <Message>"Method cannot be both generic and have non-default calling convention."</Message>
+ <Comment> Method cannot be both generic and have non-default calling convention </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b40">
+ <SymbolicName>VLDTR_E_EP_GENERIC_METHOD</SymbolicName>
+ <Message>"Entry point in CLR header is the token for a generic method."</Message>
+ <Comment> Entry point in CLR header is the token for a generic method </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b41">
+ <SymbolicName>VLDTR_E_MD_MISSARITY</SymbolicName>
+ <Message>"Method signature is generic but is missing its arity."</Message>
+ <Comment> Method signature is generic but is missing its arity </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b42">
+ <SymbolicName>VLDTR_E_MD_ARITYZERO</SymbolicName>
+ <Message>"Method signature is generic but its arity is zero."</Message>
+ <Comment> Method signature is generic but its arity is zero </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b43">
+ <SymbolicName>VLDTR_E_SIG_ARITYZERO</SymbolicName>
+ <Message>"Signature has generic type instantiated at arity 0."</Message>
+ <Comment> Signature has generic type instantiated at arity 0 </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b44">
+ <SymbolicName>VLDTR_E_MS_ARITYZERO</SymbolicName>
+ <Message>"MethodSpec signature has arity 0."</Message>
+ <Comment> MethodSpec signature has arity 0 </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b45">
+ <SymbolicName>VLDTR_E_MD_GPMISMATCH</SymbolicName>
+ <Message>"MethodDef signature has arity n but owns m GenericParams."</Message>
+ <Comment> MethodDef signature has arity n but owns m GenericParams </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b46">
+ <SymbolicName>VLDTR_E_EP_GENERIC_TYPE</SymbolicName>
+ <Message>"Entry point in CLR header is the token for a method in a generic type."</Message>
+ <Comment> Entry point in CLR header is the token for a method in a generic type </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b47">
+ <SymbolicName>VLDTR_E_MI_DECLNOTGENERIC</SymbolicName>
+ <Message>"MethodImpl overrides non-generic method with generic method."</Message>
+ <Comment> MethodImpl overrides non-generic method with generic method </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b48">
+ <SymbolicName>VLDTR_E_MI_IMPLNOTGENERIC</SymbolicName>
+ <Message>"MethodImpl overrides non-generic method with generic method."</Message>
+ <Comment> MethodImpl overrides non-generic method with generic method </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b49">
+ <SymbolicName>VLDTR_E_MI_ARITYMISMATCH</SymbolicName>
+ <Message>"MethodImpl overrides generic method of arity n with generic method of arity m."</Message>
+ <Comment> MethodImpl overrides generic method of arity n with generic method of arity m </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b4a">
+ <SymbolicName>VLDTR_E_TD_EXTBADTYPESPEC</SymbolicName>
+ <Message>"TypeDef extends a TypeSpec that is not an instantiated type."</Message>
+ <Comment> TypeDef extends a TypeSpec that is not an instantiated type </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b4b">
+ <SymbolicName>VLDTR_E_SIG_BYREFINST</SymbolicName>
+ <Message>"Signature has type instantiated at ByRef at offset i."</Message>
+ <Comment> Signature has type instantiated at byref at offset i </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b4c">
+ <SymbolicName>VLDTR_E_MS_BYREFINST</SymbolicName>
+ <Message>"Signature has type instantiated at ByRef at offset i."</Message>
+ <Comment> Signature has type instantiated at byref at offset i </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b4d">
+ <SymbolicName>VLDTR_E_TS_EMPTY</SymbolicName>
+ <Message>"TypeSpec has empty signature."</Message>
+ <Comment> TypeSpec has empty signature </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b4e">
+ <SymbolicName>VLDTR_E_TS_HASSENTINALS</SymbolicName>
+ <Message>"TypeSpec has signature containing one or more sentinels."</Message>
+ <Comment> TypeSpec has signature containing one or more sentinals </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b4f">
+ <SymbolicName>VLDTR_E_TD_GENERICHASEXPLAYOUT</SymbolicName>
+ <Message>"TypeDef is generic but has explicit layout."</Message>
+ <Comment> TypeDef is generic but has explicit layout </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b50">
+ <SymbolicName>VLDTR_E_SIG_BADTOKTYPE</SymbolicName>
+ <Message>"Signature has token following ELEMENT_TYPE_CLASS (_VALUETYPE) that is not a TypeDef or TypeRef."</Message>
+ <Comment> Signature has token following ELEMENT_TYPE_CLASS (_VALUETYPE) that is not a TypeDef or TypeRef </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b51">
+ <SymbolicName>VLDTR_E_IFACE_METHNOTIMPLTHISMOD</SymbolicName>
+ <Message>"Warning: Class does not implement interface method in this module."</Message>
+ <Comment> Warn:Class doesn't implement interface method in this module </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131b52">
+ <SymbolicName>TLBX_E_CIRCULAR_EXPORT2</SymbolicName>
+ <Message>"TypeLib export: attempted to export an Assembly imported from a TLB."</Message>
+ <Comment> TypeLib export: attempt to export a CLB imported from a TLB. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c00">
+ <SymbolicName>CORDBG_E_THREAD_NOT_SCHEDULED</SymbolicName>
+ <Message>"Thread is not scheduled. Thus we may not have OSThreadId, handle, or context."</Message>
+ <Comment> Thread is not scheduled. Thus we may not have OSThreadId, handle, or context </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c01">
+ <SymbolicName>CORDBG_E_HANDLE_HAS_BEEN_DISPOSED</SymbolicName>
+ <Message>"Handle has been disposed."</Message>
+ <Comment> Handle has been disposed. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c02">
+ <SymbolicName>CORDBG_E_NONINTERCEPTABLE_EXCEPTION</SymbolicName>
+ <Message>"Cannot intercept this exception."</Message>
+ <Comment> Cant intercept this exception. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c03">
+ <SymbolicName>CORDBG_E_CANT_UNWIND_ABOVE_CALLBACK</SymbolicName>
+ <Message>"When intercepting an exception, cannot intercept above the current frame."</Message>
+ <Comment> When intercepting an exception, cannot intercept above the current frame. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c04">
+ <SymbolicName>CORDBG_E_INTERCEPT_FRAME_ALREADY_SET</SymbolicName>
+ <Message>"The intercept frame for this exception has already been set."</Message>
+ <Comment> The intercept frame for this exception has already been set. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c05">
+ <SymbolicName>CORDBG_E_NO_NATIVE_PATCH_AT_ADDR</SymbolicName>
+ <Message>"There is no native patch at the given address."</Message>
+ <Comment> there's no native patch at the given address. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c06">
+ <SymbolicName>CORDBG_E_MUST_BE_INTEROP_DEBUGGING</SymbolicName>
+ <Message>"This API is only allowed when interop debugging."</Message>
+ <Comment> This API is only allowed when interop debugging. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c07">
+ <SymbolicName>CORDBG_E_NATIVE_PATCH_ALREADY_AT_ADDR</SymbolicName>
+ <Message>"There is already a native patch at the address."</Message>
+ <Comment> There's already a native patch at the address </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c08">
+ <SymbolicName>CORDBG_E_TIMEOUT</SymbolicName>
+ <Message>"A wait timed out, likely an indication of deadlock."</Message>
+ <Comment> a wait timed out .. likely an indication of deadlock. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c09">
+ <SymbolicName>CORDBG_E_CANT_CALL_ON_THIS_THREAD</SymbolicName>
+ <Message>"Cannot use the API on this thread."</Message>
+ <Comment> Can't use the API on this thread. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c0a">
+ <SymbolicName>CORDBG_E_ENC_INFOLESS_METHOD</SymbolicName>
+ <Message>"Method was not JIT'd in EnC mode."</Message>
+ <Comment> Method was not JITed in EnC mode </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c0b">
+ <SymbolicName>CORDBG_E_ENC_NESTED_HANLDERS</SymbolicName>
+ <Message>"Frame cannot be updated due to change in max nesting of handlers."</Message>
+ <Comment> Frame cant be updated due to change in max nesting of handlers </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c0c">
+ <SymbolicName>CORDBG_E_ENC_IN_FUNCLET</SymbolicName>
+ <Message>"Method is in a callable handler/filter. Cannot increase stack."</Message>
+ <Comment> Method is in a callable handler/filter. Cant grow stack </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c0d">
+ <SymbolicName>CORDBG_E_ENC_LOCALLOC</SymbolicName>
+ <Message>"Frame cannot be updated due to localloc."</Message>
+ <Comment> Frame cant be updated due to localloc </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c0e">
+ <SymbolicName>CORDBG_E_ENC_EDIT_NOT_SUPPORTED</SymbolicName>
+ <Message>"Attempt to perform unsupported edit."</Message>
+ <Comment> Attempt to perform unsupported edit </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c0f">
+ <SymbolicName>CORDBG_E_FEABORT_DELAYED_UNTIL_THREAD_RESUMED</SymbolicName>
+ <Message>"Attempt to func eval abort on a suspended thread."</Message>
+ <Comment> Attempt to func eval abort on a suspended thread. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c10">
+ <SymbolicName>CORDBG_E_NOTREADY</SymbolicName>
+ <Message>"The LS is not in a good spot to perform the requested operation."</Message>
+ <Comment> The LS is not in a good spot to perform the requested operation. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c11">
+ <SymbolicName>CORDBG_E_CANNOT_RESOLVE_ASSEMBLY</SymbolicName>
+ <Message>"We failed to resolve assembly given an AssemblyRef token. Assembly may be not loaded yet or not a valid token."</Message>
+ <Comment> We failed to resolve assembly given an AssemblyRef token. Assembly may be not loaded yet or not a valid token. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c12">
+ <SymbolicName>CORDBG_E_MUST_BE_IN_LOAD_MODULE</SymbolicName>
+ <Message>"Must be in context of LoadModule callback to perform requested operation."</Message>
+ <Comment> Must be in context of LoadModule callback to perform requested operation </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c13">
+ <SymbolicName>CORDBG_E_CANNOT_BE_ON_ATTACH</SymbolicName>
+ <Message>"Requested operation cannot be performed during an attach operation."</Message>
+ <Comment> Requested operation cannot be performed during an attach operation </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c14">
+ <SymbolicName>CORDBG_E_NGEN_NOT_SUPPORTED</SymbolicName>
+ <Message>"NGEN must be supported to perform the requested operation."</Message>
+ <Comment> NGEN must be supported to perform the requested operation </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c15">
+ <SymbolicName>CORDBG_E_ILLEGAL_SHUTDOWN_ORDER</SymbolicName>
+ <Message>"Trying to shutdown out of order."</Message>
+ <Comment> Trying to shutdown out of order. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c16">
+ <SymbolicName>CORDBG_E_CANNOT_DEBUG_FIBER_PROCESS</SymbolicName>
+ <Message>"Debugging fiber mode managed process is not supported."</Message>
+ <Comment> For Whidbey, we don't support debugging fiber mode managed process </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c17">
+ <SymbolicName>CORDBG_E_MUST_BE_IN_CREATE_PROCESS</SymbolicName>
+ <Message>"Must be in context of CreateProcess callback to perform requested operation."</Message>
+ <Comment> Must be in context of CreateProcess callback to perform requested operation </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c18">
+ <SymbolicName>CORDBG_E_DETACH_FAILED_OUTSTANDING_EVALS</SymbolicName>
+ <Message>"All outstanding func-evals have not completed, detaching is not allowed at this time."</Message>
+ <Comment> All outstanding func-evals have not completed, detaching is not allowed at this time. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c19">
+ <SymbolicName>CORDBG_E_DETACH_FAILED_OUTSTANDING_STEPPERS</SymbolicName>
+ <Message>"All outstanding steppers have not been closed, detaching is not allowed at this time."</Message>
+ <Comment> All outstanding steppers have not been closed, detaching is not allowed at this time. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c20">
+ <SymbolicName>CORDBG_E_CANT_INTEROP_STEP_OUT</SymbolicName>
+ <Message>"Cannot have an ICorDebugStepper do a native step-out."</Message>
+ <Comment> Can't have an ICorDebugStepper do a native step-out. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c21">
+ <SymbolicName>CORDBG_E_DETACH_FAILED_OUTSTANDING_BREAKPOINTS</SymbolicName>
+ <Message>"All outstanding breakpoints have not been closed, detaching is not allowed at this time."</Message>
+ <Comment> All outstanding breakpoints have not been closed, detaching is not allowed at this time. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c22">
+ <SymbolicName>CORDBG_E_ILLEGAL_IN_STACK_OVERFLOW</SymbolicName>
+ <Message>"The operation is illegal because of a stack overflow."</Message>
+ <Comment> the operation is illegal because of a stackoverflow. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c23">
+ <SymbolicName>CORDBG_E_ILLEGAL_AT_GC_UNSAFE_POINT</SymbolicName>
+ <Message>"The operation failed because it is a GC unsafe point."</Message>
+ <Comment> The operation failed because it's a GC unsafe point. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c24">
+ <SymbolicName>CORDBG_E_ILLEGAL_IN_PROLOG</SymbolicName>
+ <Message>"The operation failed because the thread is in the prolog."</Message>
+ <Comment> The operation failed because the thread is in the prolog </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c25">
+ <SymbolicName>CORDBG_E_ILLEGAL_IN_NATIVE_CODE</SymbolicName>
+ <Message>"The operation failed because the thread is in native code."</Message>
+ <Comment> The operation failed because the thread is in native code </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c26">
+ <SymbolicName>CORDBG_E_ILLEGAL_IN_OPTIMIZED_CODE</SymbolicName>
+ <Message>"The operation failed because the thread is in optimized code."</Message>
+ <Comment> The operation failed because the thread is in optimized code. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c27">
+ <SymbolicName>CORDBG_E_MINIDUMP_UNSUPPORTED</SymbolicName>
+ <Message>"The information requested is not supported by minidumps."</Message>
+ <Comment> </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c28">
+ <SymbolicName>CORDBG_E_APPDOMAIN_MISMATCH</SymbolicName>
+ <Message>"A supplied object or type belongs to the wrong AppDomain."</Message>
+ <Comment> A supplied object or type belongs to the wrong AppDomain </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c29">
+ <SymbolicName>CORDBG_E_CONTEXT_UNVAILABLE</SymbolicName>
+ <Message>"The thread's context is not available."</Message>
+ <Comment> The thread's context is not available. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c30">
+ <SymbolicName>CORDBG_E_UNCOMPATIBLE_PLATFORMS</SymbolicName>
+ <Message>"The operation failed because debuggee and debugger are on incompatible platforms."</Message>
+ <Comment> The operation failed because debuggee and debugger are on incompatible platform </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c31">
+ <SymbolicName>CORDBG_E_DEBUGGING_DISABLED</SymbolicName>
+ <Message>"The operation failed because the debugging has been disabled"</Message>
+ <Comment> The operation failed because the debugging has been disabled </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c32">
+ <SymbolicName>CORDBG_E_DETACH_FAILED_ON_ENC</SymbolicName>
+ <Message>"Detach is illegal after an Edit and Continue on a module."</Message>
+ <Comment> Detach is illegal after a module has been EnCed. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c33">
+ <SymbolicName>CORDBG_E_CURRENT_EXCEPTION_IS_OUTSIDE_CURRENT_EXECUTION_SCOPE</SymbolicName>
+ <Message>"Cannot intercept the current exception at the specified frame."</Message>
+ <Comment> Interception of the current exception is not legal </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c34">
+ <SymbolicName>CORDBG_E_HELPER_MAY_DEADLOCK</SymbolicName>
+ <Message>"The debugger helper thread cannot obtain the locks it needs to perform this operation."</Message>
+ <Comment> Helper thread can not safely run code. The opereration may work at a later time. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c35">
+ <SymbolicName>CORDBG_E_MISSING_METADATA</SymbolicName>
+ <Message>"The operation failed because the debugger could not get the metadata."</Message>
+ <Comment>The operation failed because the debugger could not get the metadata.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c36">
+ <SymbolicName>CORDBG_E_TARGET_INCONSISTENT</SymbolicName>
+ <Message>"The debuggee is in a corrupt state."</Message>
+ <Comment>The debuggee is in a corrupt state.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c37">
+ <SymbolicName>CORDBG_E_DETACH_FAILED_OUTSTANDING_TARGET_RESOURCES</SymbolicName>
+ <Message>"Detach failed because there are outstanding resources in the target."</Message>
+ <Comment>The debugger is holding resource in the target (such as GC handles, function evaluations, etc).
+ These resources must be released through the appropriate ICorDebug API before detach can succeed.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c38">
+ <SymbolicName>CORDBG_E_TARGET_READONLY</SymbolicName>
+ <Message>"The debuggee is read-only."</Message>
+ <Comment>The provided ICorDebugDataTarget does not implement ICorDebugMutableDataTarget.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c39">
+ <SymbolicName>CORDBG_E_MISMATCHED_CORWKS_AND_DACWKS_DLLS</SymbolicName>
+ <Message>"The version of clr.dll in the target does not match the one mscordacwks.dll was built for."</Message>
+ <Comment>A clr/mscordacwks mismatch will cause DAC to fail to initialize in ClrDataAccess::Initialize</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c3a">
+ <SymbolicName>CORDBG_E_MODULE_LOADED_FROM_DISK</SymbolicName>
+ <Message>"Symbols are not supplied for modules loaded from disk."</Message>
+ <Comment>Symbols are not supplied for modules loaded from disk</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c3b">
+ <SymbolicName>CORDBG_E_SYMBOLS_NOT_AVAILABLE</SymbolicName>
+ <Message>"The application did not supply symbols when it loaded or created this module, or they are not yet available."</Message>
+ <Comment>The application did not supply symbols when it loaded or created this module, or they are not yet available</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c3c">
+ <SymbolicName>CORDBG_E_DEBUG_COMPONENT_MISSING</SymbolicName>
+ <Message>"A debug component is not installed."</Message>
+ <Comment>A debug component is not installed</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c3d">
+ <SymbolicName>CORDBG_E_REMOTE_MISMATCHED_CERTS</SymbolicName>
+ <Message>"Connection authentication failed due to mismatched certificates."</Message>
+ <Comment>Connection authentication failed due to mismatched certificates</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c3e">
+ <SymbolicName>CORDBG_E_REMOTE_NETWORK_FAILURE</SymbolicName>
+ <Message>"Connection failed due to a miscellaneous network error."</Message>
+ <Comment>Connection failed due to a miscellaneous network error</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c3f">
+ <SymbolicName>CORDBG_E_REMOTE_NO_LISTENER</SymbolicName>
+ <Message>"Connection failed due to no endpoint at remote machine (no proxy configured?)."</Message>
+ <Comment>Connection failed due to no endpoint at remote machine (no proxy configured?)</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c40">
+ <SymbolicName>CORDBG_E_REMOTE_UNKNOWN_TARGET</SymbolicName>
+ <Message>"Connection failed due to inability to locate remote machine."</Message>
+ <Comment>Connection failed due to inability to locate remote machine</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c41">
+ <SymbolicName>CORDBG_E_REMOTE_INVALID_CONFIG</SymbolicName>
+ <Message>"Local debugger configuration was missing or invalid."</Message>
+ <Comment>Local debugger configuration was missing or invalid</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c42">
+ <SymbolicName>CORDBG_E_REMOTE_MISMATCHED_PROTOCOLS</SymbolicName>
+ <Message>"Connection failed due to protocol version mismatch between local and remote components."</Message>
+ <Comment>Connection failed due to protocol version mismatch between local and remote components</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c43">
+ <SymbolicName>CORDBG_E_LIBRARY_PROVIDER_ERROR</SymbolicName>
+ <Message>"The ICLRDebuggingLibraryProvider callback returned an error or did not provide a valid handle."</Message>
+ <Comment>The ICLRDebuggingLibraryProvider callback returned an error or did not provide a valid handle</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c44">
+ <SymbolicName>CORDBG_E_NOT_CLR</SymbolicName>
+ <Message>"The module at the base address indicated was not recognized as a CLR"</Message>
+ <Comment>The module at the base address indicated was not recognized as a CLR</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c45">
+ <SymbolicName>CORDBG_E_MISSING_DATA_TARGET_INTERFACE</SymbolicName>
+ <Message>"The provided data target does not implement the required interfaces for this version of the runtime"</Message>
+ <Comment>The provided data target does not implement the required interfaces for this version of the runtime</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c46">
+ <SymbolicName>CORDBG_E_UNSUPPORTED_DEBUGGING_MODEL</SymbolicName>
+ <Message>"This debugging model is unsupported by the specified runtime"</Message>
+ <Comment>This debugging model is unsupported by the specified runtime</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c47">
+ <SymbolicName>CORDBG_E_UNSUPPORTED_FORWARD_COMPAT</SymbolicName>
+ <Message>"The debugger is not designed to support the version of the CLR the debuggee is using."</Message>
+ <Comment>The debugger is not designed to support the version of the CLR the debuggee is using.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c48">
+ <SymbolicName>CORDBG_E_UNSUPPORTED_VERSION_STRUCT</SymbolicName>
+ <Message>"The version struct has an unrecognized value for wStructVersion"</Message>
+ <Comment>The version struct has an unrecognized value for wStructVersion</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c49">
+ <SymbolicName>CORDBG_E_READVIRTUAL_FAILURE</SymbolicName>
+ <Message>"A call into a ReadVirtual implementation returned failure"</Message>
+ <Comment>A call into a ReadVirtual implementation returned failure</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c4a">
+ <SymbolicName>CORDBG_E_VALUE_POINTS_TO_FUNCTION</SymbolicName>
+ <Message>"The Debugging API doesn't support dereferencing function pointers."</Message>
+ <Comment>The Debugging API doesn't support dereferencing function pointers.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c4b">
+ <SymbolicName>CORDBG_E_CORRUPT_OBJECT</SymbolicName>
+ <Message>"The address provided does not point to a valid managed object."</Message>
+ <Comment>The address provided does not point to a valid managed object.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c4c">
+ <SymbolicName>CORDBG_E_GC_STRUCTURES_INVALID</SymbolicName>
+ <Message>"The GC heap structures are not in a valid state for traversal."</Message>
+ <Comment>The GC heap structures are not in a valid state for traversal.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c4d">
+ <SymbolicName>CORDBG_E_INVALID_OPCODE</SymbolicName>
+ <Message>"The specified IL offset or opcode is not supported for this operation."</Message>
+ <Comment>The specified IL offset or opcode is not supported for this operation.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c4e">
+ <SymbolicName>CORDBG_E_UNSUPPORTED</SymbolicName>
+ <Message>"The specified action is unsupported by this version of the runtime."</Message>
+ <Comment>The specified action is unsupported by this version of the runtime.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c4f">
+ <SymbolicName>CORDBG_E_MISSING_DEBUGGER_EXPORTS</SymbolicName>
+ <Message>"The debuggee memory space does not have the expected debugging export table."</Message>
+ <Comment>The debuggee memory space does not have the expected debugging export table.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c61">
+ <SymbolicName>CORDBG_E_DATA_TARGET_ERROR</SymbolicName>
+ <Message>"Failure when calling a data target method."</Message>
+ <Comment>Failure when calling a data target method.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c62">
+ <SymbolicName>CORDBG_E_CODE_HAS_NO_METADATA</SymbolicName>
+ <Message>"Couldn't find metadata for the given executable code."</Message>
+ <Comment>Couldn't find metadata for the given executable code.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c63">
+ <SymbolicName>CORDBG_E_CODE_UNRECOGNIZED</SymbolicName>
+ <Message>"Given executable code is not managed."</Message>
+ <Comment>Given executable code is not managed.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c64">
+ <SymbolicName>CORDBG_E_NO_IMAGE_AVAILABLE</SymbolicName>
+ <Message>"Couldn't find a native image."</Message>
+ <Comment>Couldn't find a native image.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c65">
+ <SymbolicName>CORDBG_E_TYPE_NOT_FOUND</SymbolicName>
+ <Message>"The type doesn't exist in the given module."</Message>
+ <Comment>The type doesn't exist in the given module.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c66">
+ <SymbolicName>CORDBG_E_VTABLE_HAS_NO_METADATA</SymbolicName>
+ <Message>"Couldn't find metadata for the given vtable."</Message>
+ <Comment>Couldn't find metadata for the given vtable.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131c67">
+ <SymbolicName>CORDBG_E_NO_GENERIC_INFO</SymbolicName>
+ <Message>"Couldn't find any generics information."</Message>
+ <Comment>Couldn't find any generics information.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131d00">
+ <SymbolicName>PEFMT_E_NO_CONTENTS</SymbolicName>
+ <Message>"File is empty."</Message>
+ <Comment> File is empty </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131d01">
+ <SymbolicName>PEFMT_E_NO_NTHEADERS</SymbolicName>
+ <Message>"File has no NT headers."</Message>
+ <Comment> File has no NT headers </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131d02">
+ <SymbolicName>PEFMT_E_64BIT</SymbolicName>
+ <Message>"File is PE32+."</Message>
+ <Comment> File is PE32+ </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131d03">
+ <SymbolicName>PEFMT_E_NO_CORHEADER</SymbolicName>
+ <Message>"File has no COR header."</Message>
+ <Comment> File has no COR header </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131d04">
+ <SymbolicName>PEFMT_E_NOT_ILONLY</SymbolicName>
+ <Message>"Flag IL_ONLY not set."</Message>
+ <Comment> Flag IL_ONLY not set </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131d05">
+ <SymbolicName>PEFMT_E_IMPORT_DLLS</SymbolicName>
+ <Message>"Bad import DLLs."</Message>
+ <Comment> Bad import DLLs </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131d06">
+ <SymbolicName>PEFMT_E_EXE_NOENTRYPOINT</SymbolicName>
+ <Message>"EXE file has no mgd entry point."</Message>
+ <Comment> EXE file has no mgd entry point </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131d07">
+ <SymbolicName>PEFMT_E_BASE_RELOCS</SymbolicName>
+ <Message>"Bad base relocations."</Message>
+ <Comment> Bad base relocations </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131d08">
+ <SymbolicName>PEFMT_E_ENTRYPOINT</SymbolicName>
+ <Message>"Bad managed entry point."</Message>
+ <Comment> Bad managed entry point </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131d09">
+ <SymbolicName>PEFMT_E_ZERO_SIZEOFCODE</SymbolicName>
+ <Message>"OptHeader.SizeOfCode is set to zero."</Message>
+ <Comment> OptHeader.SizeOfCode==0 </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131d0a">
+ <SymbolicName>PEFMT_E_BAD_CORHEADER</SymbolicName>
+ <Message>"File has invalid COR header."</Message>
+ <Comment> File has invalid COR header </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131d0b">
+ <SymbolicName>PEFMT_E_32BIT</SymbolicName>
+ <Message>"File is PE32"</Message>
+ <Comment> File is PE32 </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131e00">
+ <SymbolicName>CLR_OPTSVC_E_CONTROLLER_INTERRUPT</SymbolicName>
+ <Message>"The operation was interrupted by the CLR Optimization Service controller."</Message>
+ <Comment> Service controller interrupted work </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131f00">
+ <SymbolicName>NGEN_FAILED_GET_DEPENDENCIES</SymbolicName>
+ <Message>"Failed to get dependencies for assembly."</Message>
+ <Comment> Service manager failed to get ICorSvcDependencies interface </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131f01">
+ <SymbolicName>NGEN_FAILED_NATIVE_IMAGE_DELETE</SymbolicName>
+ <Message>"Failed to delete native image."</Message>
+ <Comment> Failed to delete native image </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131f02">
+ <SymbolicName>NGEN_E_TOO_MANY_INTERFACES</SymbolicName>
+ <Message>"Module contains too many interfaces to successfully compile all methods."</Message>
+ <Comment> Module contains too many interfaces to successfully compile all methods. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131f03">
+ <SymbolicName>NGEN_E_OLDER_RUNTIME</SymbolicName>
+ <Message>"Requested runtime does not support side-by-side NGen."</Message>
+ <Comment> Requested runtime does not support side-by-side NGen. </Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131f04">
+ <SymbolicName>NGEN_E_WORKER_UNEXPECTED_EXIT</SymbolicName>
+ <Message>"Worker exited unexpectedly during startup"</Message>
+ <Comment>An NGen worker process exited before it could be reached via DCOM.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131f05">
+ <SymbolicName>NGEN_E_WORKER_UNEXPECTED_SYNC</SymbolicName>
+ <Message>"Failed to synchronize with worker during startup"</Message>
+ <Comment>Synchronizing with an NGen worker process returned an unexpected result.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131f06">
+ <SymbolicName>NGEN_E_SYS_ASM_NI_MISSING</SymbolicName>
+ <Message>"NGen cannot proceed because Mscorlib.dll does not have a native image"</Message>
+ <Comment>Compiling any assembly other than mscorlib in the absence of mscorlib.ni.dll is not allowed.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131f07">
+ <SymbolicName>NGEN_E_EXE_MACHINE_TYPE_MISMATCH</SymbolicName>
+ <Message>"The image file is not compatible with the version of Ngen you're running. Use 32bit Ngen for 32bit assemblies, and 64bit Ngen for 64bit assemblies."</Message>
+ <Comment>The image file is not compatible with the version of Ngen you're running. Use 32bit Ngen for 32bit assemblies, and 64bit Ngen for 64bit assemblies.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131f08">
+ <SymbolicName>NGEN_E_ASSEMBLY_EXCLUSION_FILE_PARSE_ERROR</SymbolicName>
+ <Message>"There was an error parsing the NGen assembly exclusion Xml file."</Message>
+ <Comment>There was an error parsing the NGen assembly exclusion Xml file.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131f09">
+ <SymbolicName>NGEN_E_HARDBOUND_DEPENDENCY_MISSING</SymbolicName>
+ <Message>"A hardbound dependent native image is missing."</Message>
+ <Comment>A hardbound dependent native image is missing.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131f0a">
+ <SymbolicName>NGEN_E_NOT_RUNNING_IN_EXPECTED_PACKAGE</SymbolicName>
+ <Message>"NGen is not running in expected package."</Message>
+ <Comment>NGen is not running in expected package.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131f0b">
+ <SymbolicName>NGEN_E_FILE_NOT_ASSEMBLY</SymbolicName>
+ <Message>"The image being compiled is not a .NET assembly"</Message>
+ <Comment>The image being compiled is not a .NET assembly</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80131fff">
+ <SymbolicName>CLDB_E_INTERNALERROR</SymbolicName>
+</HRESULT>
+
+<HRESULT NumericValue="0x80132000">
+ <SymbolicName>CLR_E_BIND_ASSEMBLY_VERSION_TOO_LOW</SymbolicName>
+ <Message>"The bound assembly has a version that is lower than that of the request."</Message>
+ <Comment>For AppX binder, indicates that bound assembly has a version lower than that requested, and we will refuse version rollback.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80132001">
+ <SymbolicName>CLR_E_BIND_ASSEMBLY_PUBLIC_KEY_MISMATCH</SymbolicName>
+ <Message>"The assembly version has a public key token that does not match that of the request."</Message>
+ <Comment>For AppX binder, indicates that bound assembly's public key token doesn't match the key in the assembly name.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80132002">
+ <SymbolicName>CLR_E_BIND_IMAGE_UNAVAILABLE</SymbolicName>
+ <Message>"The requested image was not found or is unavailable."</Message>
+ <Comment>Occurs if a request for a native image is made on an ICLRPrivAssembly interface when one is not available.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80132003">
+ <SymbolicName>CLR_E_BIND_UNRECOGNIZED_IDENTITY_FORMAT</SymbolicName>
+ <Message>"The provided identity format is not recognized."</Message>
+ <Comment>If a binder is provided an identity format that it cannot parse, it returns this error.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80132004">
+ <SymbolicName>CLR_E_BIND_ASSEMBLY_NOT_FOUND</SymbolicName>
+ <Message>"A binding for the specified assembly name was not found."</Message>
+ <Comment>Returned by binders that bind based on assembly identity.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80132005">
+ <SymbolicName>CLR_E_BIND_TYPE_NOT_FOUND</SymbolicName>
+ <Message>"A binding for the specified type name was not found."</Message>
+ <Comment>Returned by binders that bind based on type identity.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80132006">
+ <SymbolicName>CLR_E_BIND_SYS_ASM_NI_MISSING</SymbolicName>
+ <Message>"Could not use native image because Mscorlib.dll is missing a native image"</Message>
+ <Comment>Returned when loading an assembly that only has a native image and no IL and cannot hardbind to mscorlib.ni.dll.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80132007">
+ <SymbolicName>CLR_E_BIND_NI_SECURITY_FAILURE</SymbolicName>
+ <Message>"Native image was generated in a different trust level than present at runtime"</Message>
+ <Comment>Returned when an assembly is NGened in full trust and then used in partial trust or vice versa.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80132008">
+ <SymbolicName>CLR_E_BIND_NI_DEP_IDENTITY_MISMATCH</SymbolicName>
+ <Message>"Native image identity mismatch with respect to its dependencies"</Message>
+ <Comment>Returned when an assembly's identities have changed so the native image is no longer valid.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="0x80132009">
+ <SymbolicName>CLR_E_GC_OOM</SymbolicName>
+ <Message>"Failfast due to an OOM during a GC"</Message>
+ <Comment>During a GC when we try to allocate memory for GC datastructures we could not.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="E_ACCESSDENIED">
+ <SymbolicName>COR_E_UNAUTHORIZEDACCESS</SymbolicName>
+ <Comment> 0x80070005 // Access is denied.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="E_INVALIDARG">
+ <SymbolicName>COR_E_ARGUMENT</SymbolicName>
+ <Comment> 0x80070057 // An argument does not meet the contract of the method.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="E_NOINTERFACE">
+ <SymbolicName>COR_E_INVALIDCAST</SymbolicName>
+ <Comment> 0x80004002 // Indicates a bad cast condition</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="E_OUTOFMEMORY">
+ <SymbolicName>COR_E_OUTOFMEMORY</SymbolicName>
+ <Comment> 0x8007000E // The EE thows this exception when no more memory is avaible to continue execution</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="E_POINTER">
+ <SymbolicName>COR_E_NULLREFERENCE</SymbolicName>
+ <Comment> 0x80004003 // Dereferencing a null reference. In general class libraries should not throw this</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="__HRESULT_FROM_WIN32(ERROR_ARITHMETIC_OVERFLOW)">
+ <SymbolicName>COR_E_ARITHMETIC</SymbolicName>
+ <Comment> 0x80070216 // Overflow or underflow in mathematical operations.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="__HRESULT_FROM_WIN32(ERROR_BAD_PATHNAME)">
+ <SymbolicName>COR_E_BAD_PATHNAME</SymbolicName>
+ <Comment> The specified path is invalid.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="__HRESULT_FROM_WIN32(ERROR_FILENAME_EXCED_RANGE)">
+ <SymbolicName>COR_E_PATHTOOLONG</SymbolicName>
+ <Comment> The specified path was too long.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="__HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND)">
+ <SymbolicName>COR_E_FILENOTFOUND</SymbolicName>
+ <Comment></Comment>
+</HRESULT>
+
+<HRESULT NumericValue="__HRESULT_FROM_WIN32(ERROR_HANDLE_EOF)">
+ <SymbolicName>COR_E_ENDOFSTREAM</SymbolicName>
+ <Comment> Thrown when the End of file is reached</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="__HRESULT_FROM_WIN32(ERROR_PATH_NOT_FOUND)">
+ <SymbolicName>COR_E_DIRECTORYNOTFOUND</SymbolicName>
+ <Comment> The specified path couldn't be found.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="__HRESULT_FROM_WIN32(ERROR_STACK_OVERFLOW)">
+ <SymbolicName>COR_E_STACKOVERFLOW</SymbolicName>
+ <Comment> 0x800703E9 // Is raised by the EE when the execution stack overflows as it is attempting to ex</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="_HRESULT_TYPEDEF_(0x8000211DL)">
+ <SymbolicName>COR_E_AMBIGUOUSMATCH</SymbolicName>
+ <Comment> While late binding to a method via reflection, could not resolve between</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="_HRESULT_TYPEDEF_(0x8002000EL)">
+ <SymbolicName>COR_E_TARGETPARAMCOUNT</SymbolicName>
+ <Comment> DISP_E_BADPARAMCOUNT // There was a mismatch between number of arguments provided and the number expected</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="_HRESULT_TYPEDEF_(0x80020012L)">
+ <SymbolicName>COR_E_DIVIDEBYZERO</SymbolicName>
+ <Comment> DISP_E_DIVBYZERO // Attempted to divide a number by zero.</Comment>
+</HRESULT>
+
+<HRESULT NumericValue="_HRESULT_TYPEDEF_(0x8007000BL)">
+ <SymbolicName>COR_E_BADIMAGEFORMAT</SymbolicName>
+ <Message>"The format of a DLL or executable being loaded is invalid."</Message>
+ <Comment> The format of DLL or executable being loaded is invalid.</Comment>
+</HRESULT>
+
+</hc:ResourceStrings>
+</Root>
diff --git a/src/inc/corexcep.h b/src/inc/corexcep.h
new file mode 100644
index 0000000000..f1bed3e77b
--- /dev/null
+++ b/src/inc/corexcep.h
@@ -0,0 +1,42 @@
+// 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.
+
+/*********************************************************************
+ ** **
+ ** CorExcep.h - lists the exception codes used by the CLR. **
+ ** **
+ *********************************************************************/
+
+
+#ifndef __COREXCEP_H__
+#define __COREXCEP_H__
+
+// All COM+ exceptions are expressed as a RaiseException with this exception
+// code. If you change this value, you must also change
+// mscorlib\src\system\Exception.cs's _COMPlusExceptionCode value.
+
+#define EXCEPTION_MSVC 0xe06d7363 // 0xe0000000 | 'msc'
+
+#define EXCEPTION_COMPLUS 0xe0434352 // 0xe0000000 | 'CCR'
+
+#define EXCEPTION_HIJACK 0xe0434f4e // 0xe0000000 | 'COM'+1
+
+#ifdef FEATURE_STACK_PROBE
+#define EXCEPTION_SOFTSO 0xe053534f // 0xe0000000 | 'SSO'
+ // We can not throw internal C++ exception through managed frame.
+ // At boundary, we will raise an exception with this error code
+#endif
+
+#if defined(_DEBUG)
+#define EXCEPTION_INTERNAL_ASSERT 0xe0584d4e // 0xe0000000 | 'XMN'
+ // An internal Assert will raise this exception when the config
+ // value "RaiseExceptionOnAssert" si specified. This is used in
+ // stress to facilitate failure triaging.
+#endif
+
+// This is the exception code to report SetupThread failure to caller of reverse pinvoke
+// It is misleading to use our COM+ exception code, since this is not a managed exception.
+// In the end, we picked e0455858 (EXX).
+#define EXCEPTION_EXX 0xe0455858 // 0xe0000000 | 'EXX'
+#endif // __COREXCEP_H__
diff --git a/src/inc/corguids.nativeproj b/src/inc/corguids.nativeproj
new file mode 100644
index 0000000000..762cdf142e
--- /dev/null
+++ b/src/inc/corguids.nativeproj
@@ -0,0 +1,438 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup Label="Globals">
+ <SccProjectName>SAK</SccProjectName>
+ <SccAuxPath>SAK</SccAuxPath>
+ <SccLocalPath>SAK</SccLocalPath>
+ <SccProvider>SAK</SccProvider>
+ </PropertyGroup>
+ <PropertyGroup>
+ <BuildCoreBinaries>true</BuildCoreBinaries>
+ <BuildSysBinaries>true</BuildSysBinaries>
+ </PropertyGroup>
+ <!--Import the settings-->
+ <Import Project="$(_NTDRIVE)$(_NTROOT)\ndp\clr\clr.props" />
+ <!--Leaf project Properties-->
+ <PropertyGroup>
+ <OutputName>corguids</OutputName>
+ <OutputPath>$(ClrLibDest)</OutputPath>
+ <TargetType>LIBRARY</TargetType>
+ <Ltcg>false</Ltcg>
+ <MidlTlbDir>$(IntermediateOutputDirectory)</MidlTlbDir>
+ <NoCrt>true</NoCrt>
+ <DevdivPublishFolder>$(EnlistmentRootPath)\public\devdiv\inc</DevdivPublishFolder>
+
+ <Mktypliblink>$(LINKER) -Incremental:NO</Mktypliblink>
+ <CDefines>$(CDefines);REAL_TLB_FILE=$(IntermediateOutputDirectory)\mscoree_tlb.tlb;REAL_METAHOST_TLB_FILE=$(IntermediateOutputDirectory)\metahost.tlb;REAL_CORDEBUG_TLB_FILE=$(IntermediateOutputDirectory)\cordebug.tlb</CDefines>
+ <CrimsonEventsManifest>ClrEtwAll.man</CrimsonEventsManifest>
+
+ <!-- Selects the appropriate private events manifest -->
+ <CrimsonEventsManifestSourcePath>$(Clrbase)\src\VM\$(CrimsonEventsManifest)</CrimsonEventsManifestSourcePath>
+
+ <CrimsonPubliceventsManifest>CLR-ETW.man</CrimsonPubliceventsManifest>
+ <MofEventsManifest>ClrEtwAll.mof</MofEventsManifest>
+ <MofEventsUninstallmanifest>ClrEtwAll.mof.uninstall</MofEventsUninstallmanifest>
+ <MofPubliceventsManifest>CLR.mof</MofPubliceventsManifest>
+ <MofPubliceventsTempmanifest>CLR-ETW.mof</MofPubliceventsTempmanifest>
+ <MofPubliceventsUninstallmanifest>CLR.mof.uninstall</MofPubliceventsUninstallmanifest>
+ <ClrEtwAllHeader>ClrEtwAll.h</ClrEtwAllHeader>
+ <ClrEtwAllMainHeader>ClrEtwAllMain.h</ClrEtwAllMainHeader>
+ <ClrEtwDummyHeader>etmdummy.h</ClrEtwDummyHeader>
+ <EvxmlEventsManifest>ClrEtwAll.evxml</EvxmlEventsManifest>
+ <GenetwGeneratePubliceventsManifest>-g publicman</GenetwGeneratePubliceventsManifest>
+ <McWinmetapath>$(SdkIncPath)\winmeta.xml</McWinmetapath>
+ <McEventmanpath>$(SdkIncPath)\eventman.xsd</McEventmanpath>
+ <McFlags>$(McFlags) /w $(McEventmanpath) /W $(McWinmetapath) -b -co</McFlags>
+
+ <!-- On desktop CLR 4.5+, only Vista+ is supported, and we can omit the backward-compatible gunk, which also
+ frees us up to use Vista+-only syntax, which is required for new events like MethodILToNativeMap -->
+ <McAdditionalOptions>$(McFlags) -um -p FireEtw</McAdditionalOptions>
+ </PropertyGroup>
+
+ <!-- List of files in corguids.lib is shared with cross compilation via corguids.targets -->
+ <Import Project="$(_NTDRIVE)$(_NTROOT)\ndp\clr\src\inc\corguids.targets" />
+
+ <ItemGroup>
+ <DataFile Include="$(Clrbase)\src\inc\cor.h" />
+ <DataFile Include="$(Clrbase)\src\inc\CorHdr.h" />
+ <DataFile Include="$(Clrbase)\src\inc\corhlpr.h" />
+ <DataFile Include="$(Clrbase)\src\inc\corhlpr.cpp" />
+ <DataFile Include="$(Clrbase)\src\inc\CorTpoolHdr.h" />
+ <DataFile Include="$(Clrbase)\src\inc\isolation.h" />
+ <DataFile Include="$(Clrbase)\src\inc\ICeeFileGen.h" />
+ <DataFile Include="$(Clrbase)\src\inc\openum.h" />
+ <DataFile Include="$(Clrbase)\src\inc\VerError.h" />
+ <DataFile Include="$(Clrbase)\src\inc\clrdata.idl" />
+ <DataFile Include="$(Clrbase)\src\inc\cordebug.idl" />
+ <DataFile Include="$(Clrbase)\src\inc\xcordebug.idl" />
+ <DataFile Include="$(Clrbase)\src\inc\corprof.idl" />
+ <DataFile Include="$(Clrbase)\src\inc\corpub.idl" />
+ <DataFile Include="$(Clrbase)\src\inc\fusion.idl" />
+ <DataFile Include="$(Clrbase)\src\inc\gchost.idl" />
+ <DataFile Include="$(Clrbase)\src\inc\ivalidator.idl" />
+ <DataFile Include="$(Clrbase)\src\inc\IVEHandler.idl" />
+ <DataFile Include="$(Clrbase)\src\inc\metahost.idl" />
+ <DataFile Include="$(Clrbase)\src\inc\MSCOREE.IDL" />
+ <DataFile Include="$(Clrbase)\src\inc\opcode.def" />
+ <DataFile Include="$(IntermediateOutputDirectory)\CorError.h" />
+ <DataFile Include="$(IntermediateOutputDirectory)\clrdata.h" />
+ <DataFile Include="$(IntermediateOutputDirectory)\cordebug.h" />
+ <DataFile Include="$(IntermediateOutputDirectory)\xcordebug.h" />
+ <DataFile Include="$(IntermediateOutputDirectory)\corprof.h" />
+ <DataFile Include="$(IntermediateOutputDirectory)\corpub.h" />
+ <DataFile Include="$(IntermediateOutputDirectory)\fusion.h" />
+ <DataFile Include="$(IntermediateOutputDirectory)\gchost.h" />
+ <DataFile Include="$(IntermediateOutputDirectory)\ivalidator.h" />
+ <DataFile Include="$(IntermediateOutputDirectory)\ivehandler.h" />
+ <DataFile Include="$(IntermediateOutputDirectory)\metahost.h" />
+ <DataFile Include="$(IntermediateOutputDirectory)\mscoree.h" />
+ <DataFile Include="$(IntermediateOutputDirectory)\\corsym.h" />
+ <DataFile Include="$(ClrLibPath)\$(OutputName).lib" />
+ <DataFile Include="$(Clrbase)\src\inc\CLRPrivAppXHosting.idl" />
+ <DataFile Include="$(IntermediateOutputDirectory)\CLRPrivAppXHosting.h" />
+ <DataFile Include="$(Clrbase)\src\inc\CLRPrivHosting.idl" />
+ <DataFile Include="$(IntermediateOutputDirectory)\CLRPrivHosting.h" />
+ <DataFile Include="$(Clrbase)\src\inc\CLRPrivBinding.idl" />
+ <DataFile Include="$(IntermediateOutputDirectory)\CLRPrivBinding.h" />
+ <DataFile Include="$(Clrbase)\src\inc\CLRPrivRuntimeBinders.idl" />
+ <DataFile Include="$(IntermediateOutputDirectory)\CLRPrivRuntimeBinders.h" />
+ </ItemGroup>
+
+ <ItemGroup Condition="'$(FeatureCoreClr)' == 'true'">
+ <CoreClrSDKHeader Include= "mscoree.h">
+ <SrcOverRide>$(IntermediateOutputDirectory)\</SrcOverRide>
+ </CoreClrSDKHeader>
+ </ItemGroup>
+
+ <!-- These files aren't in place until PublishLinked, and we copy from that location to binaries -->
+ <ItemGroup Condition="'$(FeatureCoreClr)' != 'true'">
+ <PostPublishCopyFile Include="$(IntermediateOutputDirectory)\mscoree.realtlb">
+ <PostPublishCopyFileDest>$(ClrInterLibPath)\mscoree.tlb</PostPublishCopyFileDest>
+ </PostPublishCopyFile>
+ <PostPublishCopyFile Include="$(IntermediateOutputDirectory)\metahost.realtlb">
+ <PostPublishCopyFileDest>$(ClrLibPath)\metahost.tlb</PostPublishCopyFileDest>
+ </PostPublishCopyFile>
+ <PostPublishCopyFile Include="$(IntermediateOutputDirectory)\cordebug.realtlb">
+ <PostPublishCopyFileDest>$(ClrLibPath)\cordebug.tlb</PostPublishCopyFileDest>
+ </PostPublishCopyFile>
+ </ItemGroup>
+
+ <ItemGroup Condition="'$(FeatureCoreClr)' != 'true'">
+ <PostPublishCopyFile Include="$(ClrInterLibPath)\mscoree.tlb">
+ <PostPublishCopyFileDest>$(BinariesDirectory)\mscoree.tlb</PostPublishCopyFileDest>
+ </PostPublishCopyFile>
+ <PostPublishCopyFile Include="$(ClrLibPath)\metahost.tlb">
+ <PostPublishCopyFileDest>$(BinariesDirectory)\metahost.tlb</PostPublishCopyFileDest>
+ </PostPublishCopyFile>
+ <PostPublishCopyFile Include="$(ClrLibPath)\cordebug.tlb">
+ <PostPublishCopyFileDest>$(BinariesDirectory)\cordebug.tlb</PostPublishCopyFileDest>
+ </PostPublishCopyFile>
+ </ItemGroup>
+ <ItemGroup>
+ <RCResourceFile Include="$(Clrbase)\src\inc\mscoree_mktlb.rc">
+ <IncludeInLib>false</IncludeInLib>
+ </RCResourceFile>
+ <RCResourceFile Include="$(Clrbase)\src\inc\metahost_mktlb.rc">
+ <IncludeInLib>false</IncludeInLib>
+ </RCResourceFile>
+ <RCResourceFile Include="$(Clrbase)\src\inc\cordebug_mktlb.rc">
+ <IncludeInLib>false</IncludeInLib>
+ </RCResourceFile>
+ </ItemGroup>
+ <!-- remove when switching to vctasks-->
+ <Target Name="VCLibLinkOptionsMapping" />
+ <Import Project="$(_NTDRIVE)$(_NTROOT)\ndp\clr\clr.targets" />
+ <PropertyGroup>
+ <BuildGeneratedDependsOn>
+ GenerateOpcodeRefops;
+ GenerateCorHdr;
+ OptimizeFxRetarget;
+ $(BuildGeneratedDependsOn);
+ </BuildGeneratedDependsOn>
+ </PropertyGroup>
+ <Target Name="PostPublishCopy" Inputs="@(PostPublishCopyFile)" AfterTargets="LinkTlbs" BeforeTargets="Publish" Outputs="@(PostPublishCopyFile->'%(PostPublishCopyFileDest)')">
+ <Copy SourceFiles="@(PostPublishCopyFile)" DestinationFiles="%(PostPublishCopyFile.PostPublishCopyFileDest)" />
+ </Target>
+ <ItemGroup>
+ <Clean Include="$(IntermediateOutputDirectory)\opcode.refops" />
+ </ItemGroup>
+ <Target Name="GenerateOpcodeRefops" Inputs="$(Clrbase)\src\inc\opcode.def" Outputs="$(IntermediateOutputDirectory)\opcode.refops" BeforeTargets="PublishGenerated">
+ <Exec Command="$(PerlCommand) genrops.pl &lt; opcode.def &gt; $(IntermediateOutputDirectory)\opcode.refops" StandardOutputImportance="Normal" />
+ </Target>
+ <ItemGroup>
+ <Clean Include="$(IntermediateOutputDirectory)\corerror.h;$(IntermediateOutputDirectory)\mscorurt.rc" />
+ </ItemGroup>
+ <Target Name="GenerateCorHdr" Inputs="$(Clrbase)\src\inc\corerror.xml" Outputs="$(IntermediateOutputDirectory)\corerror.h;$(IntermediateOutputDirectory)\mscorurt.rc">
+ <Exec Command="$(ManagedToolsPath)\genheaders.exe $(Clrbase)\src\inc\corerror.xml &quot;$(IntermediateOutputDirectory)\corerror.h&quot; &quot;$(IntermediateOutputDirectory)\mscorurt.rc&quot;" StandardOutputImportance="Normal" />
+ </Target>
+ <!-- Etw event manifest targets -->
+ <ItemGroup>
+ <MessageCompile Include="$(CrimsonEventsManifestSourcePath)" />
+ <MessageCompile Include="$(IntermediateOutputDirectory)\$(CrimsonPubliceventsManifest)" />
+ </ItemGroup>
+ <Target Name="GenerateClrEtwMan" Inputs="$(CrimsonEventsManifestSourcePath)" Outputs="$(IntermediateOutputDirectory)\$(CrimsonPubliceventsManifest)" BeforeTargets="MessageCompile">
+ <Exec Command="$(PerlCommand) $(Clrbase)\bin\genetw.pl $(GenetwGeneratePubliceventsManifest) -i $(CrimsonEventsManifestSourcePath) -o $(IntermediateOutputDirectory)\$(CrimsonPubliceventsManifest)" StandardOutputImportance="Normal" />
+ </Target>
+ <Target Name="OptimizeFxRetarget" Inputs="$(Clrbase)\src\inc\fxretarget.h" Outputs="$(IntermediateOutputDirectory)\fxretarget_generated.hpp" BeforeTargets="PublishGenerated">
+ <Exec Command="$(Clrbase)\bin\OptimizeFxRetarget.exe $(Clrbase)\src\inc\fxretarget.h $(IntermediateOutputDirectory)\fxretarget_generated.hpp" />
+ </Target>
+ <ItemGroup>
+ <Clean Include="
+ $(IntermediateOutputDirectory)\$(ClrEtwAllHeader);
+ $(IntermediateOutputDirectory)\$(ClrEtwAllMainHeader);
+ $(IntermediateOutputDirectory)\$(ClrEtwDummyHeader);
+ $(BinariesDirectory)\$(MofEventsUninstallmanifest);
+ $(BinariesDirectory)\$(MofPubliceventsUninstallmanifest);
+ $(BinariesDirectory)\$(EvxmlEventsManifest);
+ $(BinariesDirectory)\$(CrimsonEventsManifest);
+ $(BinariesDirectory)\$(CrimsonPubliceventsManifest)" />
+ </ItemGroup>
+ <Target Name="GenerateClrEtwAllHeader" Inputs="$(CrimsonEventsManifestSourcePath);$(IntermediateOutputDirectory)\$(ClrEtwAllHeader)" Outputs="$(IntermediateOutputDirectory)\$(ClrEtwAllMainHeader);$(BinariesDirectory)\$(MofEventsUninstallmanifest);$(BinariesDirectory)\$(MofPubliceventsUninstallmanifest);$(BinariesDirectory)\$(EvxmlEventsManifest);$(BinariesDirectory)\$(CrimsonEventsManifest);$(BinariesDirectory)\$(CrimsonPubliceventsManifest);$(IntermediateOutputDirectory)\$(ClrEtwDummyHeader)" AfterTargets="MessageCompile">
+ <Exec Command="$(PerlCommand) $(Clrbase)\bin\genetw.pl -g header -i $(CrimsonEventsManifestSourcePath) -o $(IntermediateOutputDirectory)\$(ClrEtwAllMainHeader) -h $(IntermediateOutputDirectory)\$(ClrEtwAllHeader)" StandardOutputImportance="Normal" />
+ <Exec Command="$(PerlCommand) $(Clrbase)\bin\genetw.pl -g dummy -i $(IntermediateOutputDirectory)\$(ClrEtwAllHeader) -o $(IntermediateOutputDirectory)\$(ClrEtwDummyHeader)" StandardOutputImportance="Normal"/>
+ <Exec Command="$(PerlCommand) $(Clrbase)\bin\genetw.pl -g mofuninstall -i $(CrimsonEventsManifestSourcePath) -o $(BinariesDirectory)\$(MofEventsUninstallmanifest)" StandardOutputImportance="Normal" />
+ <Exec Command="$(PerlCommand) $(Clrbase)\bin\genetw.pl -g mofuninstall -i $(IntermediateOutputDirectory)\$(CrimsonPubliceventsManifest) -o $(BinariesDirectory)\$(MofPubliceventsUninstallmanifest)" StandardOutputImportance="Normal" />
+ <Exec Command="$(PerlCommand) $(Clrbase)\bin\genetw.pl -g evxml -i $(CrimsonEventsManifestSourcePath) -o $(BinariesDirectory)\$(EvxmlEventsManifest)" StandardOutputImportance="Normal"/>
+ <Exec Command="$(PerlCommand) $(Clrbase)\bin\genetw.pl -g batchplaceholders -i $(CrimsonEventsManifestSourcePath) -o $(BinariesDirectory)\$(CrimsonEventsManifest)" StandardOutputImportance="Normal"/>
+ <Exec Command="$(PerlCommand) $(Clrbase)\bin\genetw.pl -g exeplaceholders -i $(IntermediateOutputDirectory)\$(CrimsonPubliceventsManifest) -o $(BinariesDirectory)\$(CrimsonPubliceventsManifest) -v $(CLRRuntimeVersion)" StandardOutputImportance="Normal"/>
+ </Target>
+ <ItemGroup>
+ <Clean Include="prep_tlbs" />
+ </ItemGroup>
+ <PropertyGroup>
+ <TlbLinkSeh Condition="'$(BuildArchitecture)' == 'i386'">true</TlbLinkSeh>
+ <TlbLinkOptions>/DYNAMICBASE /debug:none</TlbLinkOptions>
+ <TlbLinkOptions Condition="'$(BuildArchitecture)' == 'i386'">$(TlbLinkOptions) /NXCOMPAT</TlbLinkOptions>
+ <TlbLinkMachineType>$(BuildArchitecture)</TlbLinkMachineType>
+ <TlbLinkMachineType Condition="'$(BuildArchitecture)' == 'i386'">x86</TlbLinkMachineType>
+ </PropertyGroup>
+ <ItemGroup Condition="'$(FeatureCoreClr)' != 'true'">
+ <LinkTlb Include="$(IntermediateOutputPath)mscoree_mktlb.res">
+ <OutFile>$(IntermediateOutputPath)mscoree.realtlb</OutFile>
+ </LinkTlb>
+ <LinkTlb Include="$(IntermediateOutputPath)metahost_mktlb.res">
+ <OutFile>$(IntermediateOutputPath)metahost.realtlb</OutFile>
+ </LinkTlb>
+ <LinkTlb Include="$(IntermediateOutputPath)cordebug_mktlb.res">
+ <OutFile>$(IntermediateOutputPath)cordebug.realtlb</OutFile>
+ </LinkTlb>
+ </ItemGroup>
+ <Target Name="LinkTlbs" Inputs="@(LinkTlb);" Outputs="@(LinkTlb->'%(OutFile)')" BeforeTargets="PublishFilesLinked" DependsOnTargets="VCLibLinkOptionsMapping">
+ <Link
+ Sources="%(LinkTlb.Identity)"
+ TargetMachine="$(VCLinkLibMachineType)"
+ GenerateManifest="true"
+ ManifestFile="$(IntermediateOutputPath)prep_tlbs.mt"
+ LinkIncremental="false"
+ IgnoreAllDefaultLibraries="true"
+ NoEntryPoint="true"
+ LinkDLL="true"
+ OutputFile="%(LinkTlb.OutFile)"
+ AdditionalOptions="$(TlbLinkOptions)"
+ TreatLinkerWarningAsErrors="$(Internal_TlbLinkWarningsAsErrors)"
+ ImageHasSafeExceptionHandlers="$(TlbLinkSeh)"
+ StackCommitSize="0"
+ StackReserveSize="0"
+ HeapCommitSize="0"
+ HeapReserveSize="0">
+
+ </Link>
+
+ <ItemGroup>
+ <DataFile Include="@(LinkTlb->'%(OutFile)')" Condition="'$(CopyTlbToOutput)' == 'true'"/>
+ </ItemGroup>
+ </Target>
+
+ <Target Name="EnsureCopyProductFiles"
+ Condition="'$(FeatureCoreclr)' == 'true'"
+ AfterTargets="MIDL" >
+ <CallTarget Targets="CopyProductFiles"/>
+ </Target>
+
+ <ItemGroup>
+ <PublishPartGenerated Include="$(ClrInterLibPath)\mscoree.tlb" Condition="'$(FeatureCoreclr)' != 'true' and Exists('$(ClrLibPath)\mscoree.tlb')">
+ <Visibility>Inter</Visibility>
+ <FileType>Include</FileType>
+ </PublishPartGenerated>
+ <PublishPartGenerated Include="$(IntermediateOutputDirectory)\binderngen.h" Condition="'$(FeatureFusion)'=='true'">
+ <Visibility>Inter</Visibility>
+ <FileType>Include</FileType>
+ </PublishPartGenerated>
+ <PublishPartGenerated Include="$(IntermediateOutputDirectory)\fusionpriv.h">
+ <Visibility>Inter</Visibility>
+ <FileType>Include</FileType>
+ </PublishPartGenerated>
+ <PublishPartGenerated Include="$(IntermediateOutputDirectory)\assemblyusagelog.h" Condition="'$(FeatureCoreclr)' != 'true'">
+ <Visibility>Intra</Visibility>
+ <FileType>Include</FileType>
+ </PublishPartGenerated>
+ <PublishPartGenerated Include="$(Clrbase)\src\inc\isolationpriv.h">
+ <Visibility>Inter</Visibility>
+ <FileType>Include</FileType>
+ </PublishPartGenerated>
+ <PublishPartGenerated Include="$(Clrbase)\src\inc\mscoreepriv.h">
+ <Visibility>Intra</Visibility>
+ <FileType>Include</FileType>
+ </PublishPartGenerated>
+
+ <PublishPartGenerated Include="$(IntermediateOutputDirectory)\clrdata.h">
+ <Visibility>Inter</Visibility>
+ <FileType>Include</FileType>
+ </PublishPartGenerated>
+ <PublishPartGenerated Include="$(IntermediateOutputDirectory)\cordebug.h">
+ <Visibility>Inter</Visibility>
+ <FileType>Include</FileType>
+ </PublishPartGenerated>
+ <PublishPartGenerated Include="$(IntermediateOutputDirectory)\xcordebug.h">
+ <Visibility>Inter</Visibility>
+ <FileType>Include</FileType>
+ </PublishPartGenerated>
+ <PublishPartGenerated Include="$(IntermediateOutputDirectory)\corprof.h">
+ <Visibility>Inter</Visibility>
+ <FileType>Include</FileType>
+ </PublishPartGenerated>
+ <PublishPartGenerated Include="$(IntermediateOutputDirectory)\corpub.h">
+ <Visibility>Inter</Visibility>
+ <FileType>Include</FileType>
+ </PublishPartGenerated>
+ <PublishPartGenerated Include="$(IntermediateOutputDirectory)\mscorsvc.h">
+ <Visibility>Inter</Visibility>
+ <FileType>Include</FileType>
+ </PublishPartGenerated>
+ <PublishPartGenerated Include="$(IntermediateOutputDirectory)\fusion.h">
+ <Visibility>Inter</Visibility>
+ <FileType>Include</FileType>
+ </PublishPartGenerated>
+ <PublishPartGenerated Include="$(Clrbase)\src\inc\isolation.h">
+ <Visibility>Inter</Visibility>
+ <FileType>Include</FileType>
+ </PublishPartGenerated>
+ <PublishPartGenerated Include="$(IntermediateOutputDirectory)\gchost.h">
+ <Visibility>Inter</Visibility>
+ <FileType>Include</FileType>
+ </PublishPartGenerated>
+ <PublishPartGenerated Include="$(IntermediateOutputDirectory)\ivalidator.h">
+ <Visibility>Inter</Visibility>
+ <FileType>Include</FileType>
+ </PublishPartGenerated>
+ <PublishPartGenerated Include="$(IntermediateOutputDirectory)\ivehandler.h">
+ <Visibility>Inter</Visibility>
+ <FileType>Include</FileType>
+ </PublishPartGenerated>
+ <PublishPartGenerated Include="$(Clrbase)\src\inc\LegacyActivationShim.h" Condition="'$(FeatureCoreclr)' != 'true'">
+ <Visibility>Inter</Visibility>
+ <FileType>Include</FileType>
+ </PublishPartGenerated>
+ <PublishPartGenerated Include="$(Clrbase)\src\inc\LegacyActivationShimUtil.h" Condition="'$(FeatureCoreclr)' != 'true'">
+ <Visibility>Inter</Visibility>
+ <FileType>Include</FileType>
+ </PublishPartGenerated>
+ <PublishPartGenerated Include="$(Clrbase)\src\inc\LegacyActivationShimDelayLoad.h" Condition="'$(FeatureCoreclr)' != 'true'">
+ <Visibility>Inter</Visibility>
+ <FileType>Include</FileType>
+ </PublishPartGenerated>
+ <PublishPartGenerated Include="$(IntermediateOutputDirectory)\metahost.h">
+ <Visibility>Inter</Visibility>
+ <FileType>Include</FileType>
+ </PublishPartGenerated>
+ <PublishPartGenerated Include="$(IntermediateOutputDirectory)\sospriv.h">
+ <Visibility>Intra</Visibility>
+ <FileType>Include</FileType>
+ </PublishPartGenerated>
+ <PublishPartGenerated Include="$(IntermediateOutputDirectory)\mscoree.h">
+ <Visibility>Inter</Visibility>
+ <FileType>Include</FileType>
+ </PublishPartGenerated>
+ <PublishPartGenerated Include="$(IntermediateOutputDirectory)\corsym.h">
+ <Visibility>Inter</Visibility>
+ <FileType>Include</FileType>
+ </PublishPartGenerated>
+ <PublishPartGenerated Include="$(Clrbase)\src\inc\CLRPrivAppXHosting.idl">
+ <Visibility>Inter</Visibility>
+ <FileType>Include</FileType>
+ </PublishPartGenerated>
+ <PublishPartGenerated Include="$(IntermediateOutputDirectory)\CLRPrivAppXHosting.h">
+ <Visibility>Inter</Visibility>
+ <FileType>Include</FileType>
+ </PublishPartGenerated>
+
+ <PublishPartGenerated Include="$(IntermediateOutputDirectory)\CorError.h">
+ <Visibility>Inter</Visibility>
+ <FileType>Include</FileType>
+ </PublishPartGenerated>
+ <PublishPartGenerated Include="$(IntermediateOutputDirectory)\CLRInternal.h">
+ <Visibility>Intra</Visibility>
+ <FileType>Include</FileType>
+ </PublishPartGenerated>
+ <PublishPartGenerated Include="$(IntermediateOutputDirectory)\xclrdata.h">
+ <Visibility>Intra</Visibility>
+ <FileType>Include</FileType>
+ </PublishPartGenerated>
+ <PublishPartGenerated Include="$(IntermediateOutputDirectory)\ClrEtwAll.h">
+ <Visibility>Intra</Visibility>
+ <FileType>Include</FileType>
+ </PublishPartGenerated>
+ <PublishPartGenerated Include="$(IntermediateOutputDirectory)\ClrEtwAllMain.h">
+ <Visibility>Intra</Visibility>
+ <FileType>Include</FileType>
+ </PublishPartGenerated>
+ <PublishPartGenerated Include="$(IntermediateOutputDirectory)\etmdummy.h">
+ <Visibility>Intra</Visibility>
+ <FileType>Include</FileType>
+ </PublishPartGenerated>
+ <PublishPartGenerated Include="$(IntermediateOutputDirectory)\ClrPrivHosting.h">
+ <Visibility>Intra</Visibility>
+ <FileType>Include</FileType>
+ </PublishPartGenerated>
+ <PublishPartGenerated Include="$(IntermediateOutputDirectory)\CLRPrivRuntimeBinders.h">
+ <Visibility>Intra</Visibility>
+ <FileType>Include</FileType>
+ </PublishPartGenerated>
+ <PublishPartGenerated Include="$(IntermediateOutputDirectory)\CLRPrivBinding.h">
+ <Visibility>Intra</Visibility>
+ <FileType>Include</FileType>
+ </PublishPartGenerated>
+ <PublishPartGenerated Include="$(IntermediateOutputDirectory)\ClrEtwAll.rc">
+ <Visibility>Intra</Visibility>
+ <FileType>Include</FileType>
+ </PublishPartGenerated>
+ <PublishPartGenerated Include="$(IntermediateOutputDirectory)\ClrEtwAll_MSG00001.bin">
+ <Visibility>Intra</Visibility>
+ <FileType>Include</FileType>
+ </PublishPartGenerated>
+ <PublishPartGenerated Include="$(IntermediateOutputDirectory)\ClrEtwAllTEMP.BIN">
+ <Visibility>Intra</Visibility>
+ <FileType>Include</FileType>
+ </PublishPartGenerated>
+ <PublishPartGenerated Include="$(IntermediateOutputDirectory)\mscoruef.h">
+ <Visibility>Intra</Visibility>
+ <FileType>Include</FileType>
+ </PublishPartGenerated>
+ <PublishPartGenerated Include="$(IntermediateOutputDirectory)\tlbimpexp.h">
+ <Visibility>Intra</Visibility>
+ <FileType>Include</FileType>
+ </PublishPartGenerated>
+ <PublishPartGenerated Include="$(IntermediateOutputDirectory)\mscorurt.rc">
+ <Visibility>Intra</Visibility>
+ <FileType>Include</FileType>
+ </PublishPartGenerated>
+ <PublishPartGenerated Include="$(IntermediateOutputDirectory)\ClrEtwAll_MSG00001.bin">
+ <Visibility>Intra</Visibility>
+ <FileType>Include</FileType>
+ </PublishPartGenerated>
+ <PublishPartGenerated Include="$(IntermediateOutputDirectory)\ClrEtwAllTEMP.BIN">
+ <Visibility>Intra</Visibility>
+ <FileType>Include</FileType>
+ </PublishPartGenerated>
+ <PublishPartGenerated Include="$(IntermediateOutputDirectory)\fxretarget_generated.hpp">
+ <Visibility>Intra</Visibility>
+ <FileType>Include</FileType>
+ </PublishPartGenerated>
+ </ItemGroup>
+ <ItemGroup>
+ <PublishPartCompiled Include="$(ClrLibPath)\$(OutputName).lib" Condition="'$(FeatureCoreclr)'!='true'">
+ <Visibility>Inter</Visibility>
+ <FileType>Binary</FileType>
+ </PublishPartCompiled>
+ </ItemGroup>
+</Project>
diff --git a/src/inc/corguids.targets b/src/inc/corguids.targets
new file mode 100644
index 0000000000..1479b0ba6d
--- /dev/null
+++ b/src/inc/corguids.targets
@@ -0,0 +1,53 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003" ToolsVersion="dogfood">
+ <ItemGroup>
+ <CCompile Include="$(IntermediateOutputDirectory)/cordebug_i.c" />
+ <CCompile Include="$(IntermediateOutputDirectory)/xcordebug_i.c" />
+ <CCompile Include="$(IntermediateOutputDirectory)/clrdata_i.c" />
+ <CCompile Include="$(IntermediateOutputDirectory)/clrinternal_i.c" />
+ <CCompile Include="$(IntermediateOutputDirectory)/xclrdata_i.c" />
+ <CCompile Include="$(IntermediateOutputDirectory)/corprof_i.c" />
+ <CCompile Include="$(IntermediateOutputDirectory)/corpub_i.c" />
+ <CCompile Include="$(IntermediateOutputDirectory)/IValidator_i.c" />
+ <CCompile Include="$(IntermediateOutputDirectory)/IVEHandler_i.c" />
+ <CCompile Include="$(IntermediateOutputDirectory)/gchost_i.c" />
+ <CCompile Include="$(IntermediateOutputDirectory)/fusionpriv_i.c" />
+ <CCompile Include="$(IntermediateOutputDirectory)/mscorsvc_i.c" Condition="'$(FeaturePrejit)'=='true'" />
+ <CCompile Include="$(IntermediateOutputDirectory)/tlbimpexp_i.c" />
+ <CCompile Include="$(IntermediateOutputDirectory)/CLRPrivAppXHosting_i.c" />
+ <CCompile Include="$(IntermediateOutputDirectory)/CLRPrivBinding_i.c" />
+ <CCompile Include="$(IntermediateOutputDirectory)/CLRPrivHosting_i.c" />
+ <CCompile Include="$(IntermediateOutputDirectory)/CLRPrivRuntimeBinders_i.c" />
+ </ItemGroup>
+ <ItemGroup>
+ <Idl Include="$(Clrbase)\src\inc\metahost.idl" />
+ <Idl Include="$(Clrbase)\src\inc\mscoree.idl" />
+ <Idl Include="$(Clrbase)\src\inc\clrinternal.idl" />
+ <Idl Include="$(Clrbase)\src\inc\mscoree_tlb.idl" />
+ <Idl Include="$(Clrbase)\src\inc\fusion.idl" />
+ <Idl Include="$(Clrbase)\src\inc\fusionpriv.idl" />
+ <Idl Include="$(Clrbase)\src\inc\binderngen.idl" Condition="'$(FeatureFusion)'=='true'" />
+ <Idl Include="$(Clrbase)\src\inc\clrdata.idl" />
+ <Idl Include="$(Clrbase)\src\inc\xclrdata.idl" />
+ <Idl Include="$(Clrbase)\src\inc\cordebug.idl" />
+ <Idl Include="$(Clrbase)\src\inc\xcordebug.idl" />
+ <Idl Include="$(Clrbase)\src\inc\sospriv.idl" />
+ <Idl Include="$(Clrbase)\src\inc\corprof.idl" />
+ <Idl Include="$(Clrbase)\src\inc\corpub.idl" />
+ <Idl Include="$(Clrbase)\src\inc\IVEHandler.idl" />
+ <Idl Include="$(Clrbase)\src\inc\IValidator.idl" />
+ <Idl Include="$(Clrbase)\src\inc\mscorsvc.idl" Condition="'$(FeaturePrejit)'=='true'" />
+ <Idl Include="$(Clrbase)\src\inc\TlbImpExp.idl" />
+ <Idl Include="$(Clrbase)\src\inc\gchost.idl" />
+ <Idl Include="$(Clrbase)\src\inc\mscoruef.idl" />
+ <Idl Include="$(Clrbase)\src\inc\assemblyusagelog.idl" Condition="'$(FeatureCoreclr)'!='true'" />
+ <Idl Include="$(Clrbase)\src\inc\CLRPrivAppXHosting.idl" />
+ <Idl Include="$(Clrbase)\src\inc\CLRPrivBinding.idl" />
+ <Idl Include="$(Clrbase)\src\inc\CLRPrivHosting.idl" />
+ <Idl Include="$(Clrbase)\src\inc\CLRPrivRuntimeBinders.idl" />
+ <Idl Include="$(ClrBase)\src\inc\corsym.idl">
+ <CompileInterface>true</CompileInterface>
+ <CompileProxy>false</CompileProxy>
+ </Idl>
+ </ItemGroup>
+</Project>
diff --git a/src/inc/corhdr.h b/src/inc/corhdr.h
new file mode 100644
index 0000000000..c194def07f
--- /dev/null
+++ b/src/inc/corhdr.h
@@ -0,0 +1,1930 @@
+// 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.
+
+/*****************************************************************************
+ ** **
+ ** CorHdr.h - contains definitions for the Runtime structures, **
+**
+
+ ** needed to work with metadata. **
+ ** **
+ *****************************************************************************/
+//
+// The top most managed code structure in a EXE or DLL is the IMAGE_COR20_HEADER
+// see code:#ManagedHeader for more
+
+#ifndef __CORHDR_H__
+#define __CORHDR_H__
+
+#define FRAMEWORK_REGISTRY_KEY "Software\\Microsoft\\.NETFramework"
+#define FRAMEWORK_REGISTRY_KEY_W L"Software\\Microsoft\\.NETFramework"
+
+// keys for HKCU
+#ifdef _WIN64
+#define USER_FRAMEWORK_REGISTRY_KEY "Software\\Microsoft\\.NETFramework64"
+#define USER_FRAMEWORK_REGISTRY_KEY_W L"Software\\Microsoft\\.NETFramework64"
+#else
+#define USER_FRAMEWORK_REGISTRY_KEY "Software\\Microsoft\\.NETFramework"
+#define USER_FRAMEWORK_REGISTRY_KEY_W L"Software\\Microsoft\\.NETFramework"
+#endif
+
+
+#ifdef _MSC_VER
+#pragma warning(disable:4200) // nonstandard extension used : zero-sized array in struct/union.
+#endif
+typedef LPVOID mdScope; // Obsolete; not used in the runtime.
+typedef ULONG32 mdToken; // Generic token
+
+
+// Token definitions
+
+
+typedef mdToken mdModule; // Module token (roughly, a scope)
+typedef mdToken mdTypeRef; // TypeRef reference (this or other scope)
+typedef mdToken mdTypeDef; // TypeDef in this scope
+typedef mdToken mdFieldDef; // Field in this scope
+typedef mdToken mdMethodDef; // Method in this scope
+typedef mdToken mdParamDef; // param token
+typedef mdToken mdInterfaceImpl; // interface implementation token
+
+typedef mdToken mdMemberRef; // MemberRef (this or other scope)
+typedef mdToken mdCustomAttribute; // attribute token
+typedef mdToken mdPermission; // DeclSecurity
+
+typedef mdToken mdSignature; // Signature object
+typedef mdToken mdEvent; // event token
+typedef mdToken mdProperty; // property token
+
+typedef mdToken mdModuleRef; // Module reference (for the imported modules)
+
+// Assembly tokens.
+typedef mdToken mdAssembly; // Assembly token.
+typedef mdToken mdAssemblyRef; // AssemblyRef token.
+typedef mdToken mdFile; // File token.
+typedef mdToken mdExportedType; // ExportedType token.
+typedef mdToken mdManifestResource; // ManifestResource token.
+
+typedef mdToken mdTypeSpec; // TypeSpec object
+
+typedef mdToken mdGenericParam; // formal parameter to generic type or method
+typedef mdToken mdMethodSpec; // instantiation of a generic method
+typedef mdToken mdGenericParamConstraint; // constraint on a formal generic parameter
+
+// Application string.
+typedef mdToken mdString; // User literal string token.
+
+typedef mdToken mdCPToken; // constantpool token
+
+#ifndef MACROS_NOT_SUPPORTED
+typedef ULONG RID;
+#else
+typedef unsigned RID;
+#endif // MACROS_NOT_SUPPORTED
+
+typedef enum ReplacesGeneralNumericDefines
+{
+// Directory entry macro for CLR data.
+#ifndef IMAGE_DIRECTORY_ENTRY_COMHEADER
+ IMAGE_DIRECTORY_ENTRY_COMHEADER =14,
+#endif // IMAGE_DIRECTORY_ENTRY_COMHEADER
+} ReplacesGeneralNumericDefines;
+
+
+// The COMIMAGE_FLAGS_32BITREQUIRED and COMIMAGE_FLAGS_32BITPREFERRED flags defined below interact as a pair
+// in order to get the performance profile we desire for platform neutral assemblies while retaining backwards
+// compatibility with pre-4.5 runtimes/OSs, which don't know about COMIMAGE_FLAGS_32BITPREFERRED.
+//
+// COMIMAGE_FLAGS_32BITREQUIRED originally meant "this assembly is x86-only" (required to distinguish platform
+// neutral assemblies which also mark their PE MachineType as IMAGE_FILE_MACHINE_I386).
+//
+// COMIMAGE_FLAGS_32BITPREFERRED has been added so we can create a sub-class of platform neutral assembly that
+// prefers to be loaded into 32-bit environment for perf reasons, but is still compatible with 64-bit
+// environments.
+//
+// In order to retain maximum backwards compatibility you cannot simply read or write one of these flags
+// however. You must treat them as a pair, a two-bit field with the following meanings:
+//
+// 32BITREQUIRED 32BITPREFERRED
+// 0 0 : no special meaning, MachineType and ILONLY flag determine image requirements
+// 0 1 : illegal, reserved for future use
+// 1 0 : image is x86-specific
+// 1 1 : image is platform neutral and prefers to be loaded 32-bit when possible
+//
+// To simplify manipulation of these flags the following macros are provided below.
+
+#define COR_IS_32BIT_REQUIRED(_flags) \
+ (((_flags) & (COMIMAGE_FLAGS_32BITREQUIRED|COMIMAGE_FLAGS_32BITPREFERRED)) == (COMIMAGE_FLAGS_32BITREQUIRED))
+
+#define COR_IS_32BIT_PREFERRED(_flags) \
+ (((_flags) & (COMIMAGE_FLAGS_32BITREQUIRED|COMIMAGE_FLAGS_32BITPREFERRED)) == (COMIMAGE_FLAGS_32BITREQUIRED|COMIMAGE_FLAGS_32BITPREFERRED))
+
+#define COR_SET_32BIT_REQUIRED(_flagsfield) \
+ do { _flagsfield = (_flagsfield & ~COMIMAGE_FLAGS_32BITPREFERRED) | COMIMAGE_FLAGS_32BITREQUIRED; } while (false)
+
+#define COR_SET_32BIT_PREFERRED(_flagsfield) \
+ do { _flagsfield |= COMIMAGE_FLAGS_32BITPREFERRED|COMIMAGE_FLAGS_32BITREQUIRED; } while (false)
+
+#define COR_CLEAR_32BIT_REQUIRED(_flagsfield) \
+ do { _flagsfield &= ~(COMIMAGE_FLAGS_32BITREQUIRED|COMIMAGE_FLAGS_32BITPREFERRED); } while (false)
+
+#define COR_CLEAR_32BIT_PREFERRED(_flagsfield) \
+ do { _flagsfield &= ~(COMIMAGE_FLAGS_32BITREQUIRED|COMIMAGE_FLAGS_32BITPREFERRED); } while (false)
+
+
+#ifndef __IMAGE_COR20_HEADER_DEFINED__
+#define __IMAGE_COR20_HEADER_DEFINED__
+
+typedef enum ReplacesCorHdrNumericDefines
+{
+// COM+ Header entry point flags.
+ COMIMAGE_FLAGS_ILONLY =0x00000001,
+ COMIMAGE_FLAGS_32BITREQUIRED =0x00000002, // *** Do not manipulate this bit directly (see notes above)
+ COMIMAGE_FLAGS_IL_LIBRARY =0x00000004,
+ COMIMAGE_FLAGS_STRONGNAMESIGNED =0x00000008,
+ COMIMAGE_FLAGS_NATIVE_ENTRYPOINT =0x00000010,
+ COMIMAGE_FLAGS_TRACKDEBUGDATA =0x00010000,
+ COMIMAGE_FLAGS_32BITPREFERRED =0x00020000, // *** Do not manipulate this bit directly (see notes above)
+
+
+// Version flags for image.
+ COR_VERSION_MAJOR_V2 =2,
+ COR_VERSION_MAJOR =COR_VERSION_MAJOR_V2,
+ COR_VERSION_MINOR =5,
+ COR_DELETED_NAME_LENGTH =8,
+ COR_VTABLEGAP_NAME_LENGTH =8,
+
+// Maximum size of a NativeType descriptor.
+ NATIVE_TYPE_MAX_CB =1,
+ COR_ILMETHOD_SECT_SMALL_MAX_DATASIZE=0xFF,
+
+// V-table constants
+ COR_VTABLE_32BIT =0x01, // V-table slots are 32-bits in size.
+ COR_VTABLE_64BIT =0x02, // V-table slots are 64-bits in size.
+ COR_VTABLE_FROM_UNMANAGED =0x04, // If set, transition from unmanaged.
+ COR_VTABLE_FROM_UNMANAGED_RETAIN_APPDOMAIN=0x08, // NEW
+ COR_VTABLE_CALL_MOST_DERIVED =0x10, // Call most derived method described by
+
+// Max name lengths
+ //@todo: Change to unlimited name lengths.
+ MAX_CLASS_NAME =1024,
+ MAX_PACKAGE_NAME =1024,
+} ReplacesCorHdrNumericDefines;
+
+// #ManagedHeader
+//
+// A managed code EXE or DLL uses the same basic format that unmanaged executables use call the Portable
+// Executable (PE) format. See http://en.wikipedia.org/wiki/Portable_Executable or
+// http://msdn.microsoft.com/msdnmag/issues/02/02/PE/default.aspx for more on this format and RVAs.
+//
+// PE files define fixed table of well known entry pointers call Directory entries. Each entry holds the
+// relative virtual address (RVA) and length of a blob of data within the PE file. You can see these using
+// the command
+//
+// link /dump /headers <EXENAME>
+//
+//
+// Managed code has defined one of these entries (the 14th see code:IMAGE_DIRECTORY_ENTRY_COMHEADER) and the RVA points
+// that the IMAGE_COR20_HEADER. This header shows up in the previous dump as the following line
+//
+// // Managed code is identified by is following line
+//
+// 2008 [ 48] RVA [size] of COM Descriptor Directory
+//
+// The IMAGE_COR20_HEADER is mostly just RVA:Length pairs (pointers) to other interesting data structures.
+// The most important of these is the MetaData tables. The easiest way of looking at meta-data is using
+// the IlDasm.exe tool.
+//
+// MetaData holds most of the information in the IL image. THe exceptions are resource blobs and the IL
+// instructions streams for individual methods. Intstead the Meta-data for a method holds an RVA to a
+// code:IMAGE_COR_ILMETHOD which holds all the IL stream (and exception handling information).
+//
+// Precompiled (NGEN) images use the same IMAGE_COR20_HEADER but also use the ManagedNativeHeader field to
+// point at structures that only exist in precompiled images.
+//
+typedef struct IMAGE_COR20_HEADER
+{
+ // Header versioning
+ DWORD cb;
+ WORD MajorRuntimeVersion;
+ WORD MinorRuntimeVersion;
+
+ // Symbol table and startup information
+ IMAGE_DATA_DIRECTORY MetaData;
+ DWORD Flags;
+
+ // The main program if it is an EXE (not used if a DLL?)
+ // If COMIMAGE_FLAGS_NATIVE_ENTRYPOINT is not set, EntryPointToken represents a managed entrypoint.
+ // If COMIMAGE_FLAGS_NATIVE_ENTRYPOINT is set, EntryPointRVA represents an RVA to a native entrypoint
+ // (depricated for DLLs, use modules constructors intead).
+ union {
+ DWORD EntryPointToken;
+ DWORD EntryPointRVA;
+ };
+
+ // This is the blob of managed resources. Fetched using code:AssemblyNative.GetResource and
+ // code:PEFile.GetResource and accessible from managed code from
+ // System.Assembly.GetManifestResourceStream. The meta data has a table that maps names to offsets into
+ // this blob, so logically the blob is a set of resources.
+ IMAGE_DATA_DIRECTORY Resources;
+ // IL assemblies can be signed with a public-private key to validate who created it. The signature goes
+ // here if this feature is used.
+ IMAGE_DATA_DIRECTORY StrongNameSignature;
+
+ IMAGE_DATA_DIRECTORY CodeManagerTable; // Depricated, not used
+ // Used for manged codee that has unmaanaged code inside it (or exports methods as unmanaged entry points)
+ IMAGE_DATA_DIRECTORY VTableFixups;
+ IMAGE_DATA_DIRECTORY ExportAddressTableJumps;
+
+ // null for ordinary IL images. NGEN images it points at a code:CORCOMPILE_HEADER structure
+ IMAGE_DATA_DIRECTORY ManagedNativeHeader;
+
+} IMAGE_COR20_HEADER, *PIMAGE_COR20_HEADER;
+
+#else // !__IMAGE_COR20_HEADER_DEFINED__
+
+// <TODO>@TODO: This is required because we pull in the COM+ 2.0 PE header
+// definition from WinNT.h, and these constants have not yet propogated to there.</TODO>
+//
+#define COR_VTABLE_FROM_UNMANAGED_RETAIN_APPDOMAIN 0x08
+#define COMIMAGE_FLAGS_32BITPREFERRED 0x00020000
+
+#endif // __IMAGE_COR20_HEADER_DEFINED__
+
+
+// The most recent version.
+
+#define COR_CTOR_METHOD_NAME ".ctor"
+#define COR_CTOR_METHOD_NAME_W L".ctor"
+#define COR_CCTOR_METHOD_NAME ".cctor"
+#define COR_CCTOR_METHOD_NAME_W L".cctor"
+
+#define COR_ENUM_FIELD_NAME "value__"
+#define COR_ENUM_FIELD_NAME_W L"value__"
+
+// The predefined name for deleting a typeDef,MethodDef, FieldDef, Property and Event
+#define COR_DELETED_NAME_A "_Deleted"
+#define COR_DELETED_NAME_W L"_Deleted"
+#define COR_VTABLEGAP_NAME_A "_VtblGap"
+#define COR_VTABLEGAP_NAME_W L"_VtblGap"
+
+// We intentionally use strncmp so that we will ignore any suffix
+#define IsDeletedName(strName) (strncmp(strName, COR_DELETED_NAME_A, COR_DELETED_NAME_LENGTH) == 0)
+#define IsVtblGapName(strName) (strncmp(strName, COR_VTABLEGAP_NAME_A, COR_VTABLEGAP_NAME_LENGTH) == 0)
+
+// TypeDef/ExportedType attr bits, used by DefineTypeDef.
+typedef enum CorTypeAttr
+{
+ // Use this mask to retrieve the type visibility information.
+ tdVisibilityMask = 0x00000007,
+ tdNotPublic = 0x00000000, // Class is not public scope.
+ tdPublic = 0x00000001, // Class is public scope.
+ tdNestedPublic = 0x00000002, // Class is nested with public visibility.
+ tdNestedPrivate = 0x00000003, // Class is nested with private visibility.
+ tdNestedFamily = 0x00000004, // Class is nested with family visibility.
+ tdNestedAssembly = 0x00000005, // Class is nested with assembly visibility.
+ tdNestedFamANDAssem = 0x00000006, // Class is nested with family and assembly visibility.
+ tdNestedFamORAssem = 0x00000007, // Class is nested with family or assembly visibility.
+
+ // Use this mask to retrieve class layout information
+ tdLayoutMask = 0x00000018,
+ tdAutoLayout = 0x00000000, // Class fields are auto-laid out
+ tdSequentialLayout = 0x00000008, // Class fields are laid out sequentially
+ tdExplicitLayout = 0x00000010, // Layout is supplied explicitly
+ // end layout mask
+
+ // Use this mask to retrieve class semantics information.
+ tdClassSemanticsMask = 0x00000020,
+ tdClass = 0x00000000, // Type is a class.
+ tdInterface = 0x00000020, // Type is an interface.
+ // end semantics mask
+
+ // Special semantics in addition to class semantics.
+ tdAbstract = 0x00000080, // Class is abstract
+ tdSealed = 0x00000100, // Class is concrete and may not be extended
+ tdSpecialName = 0x00000400, // Class name is special. Name describes how.
+
+ // Implementation attributes.
+ tdImport = 0x00001000, // Class / interface is imported
+ tdSerializable = 0x00002000, // The class is Serializable.
+ tdWindowsRuntime = 0x00004000, // The type is a Windows Runtime type
+
+ // Use tdStringFormatMask to retrieve string information for native interop
+ tdStringFormatMask = 0x00030000,
+ tdAnsiClass = 0x00000000, // LPTSTR is interpreted as ANSI in this class
+ tdUnicodeClass = 0x00010000, // LPTSTR is interpreted as UNICODE
+ tdAutoClass = 0x00020000, // LPTSTR is interpreted automatically
+ tdCustomFormatClass = 0x00030000, // A non-standard encoding specified by CustomFormatMask
+ tdCustomFormatMask = 0x00C00000, // Use this mask to retrieve non-standard encoding information for native interop. The meaning of the values of these 2 bits is unspecified.
+
+ // end string format mask
+
+ tdBeforeFieldInit = 0x00100000, // Initialize the class any time before first static field access.
+ tdForwarder = 0x00200000, // This ExportedType is a type forwarder.
+
+ // Flags reserved for runtime use.
+ tdReservedMask = 0x00040800,
+ tdRTSpecialName = 0x00000800, // Runtime should check name encoding.
+ tdHasSecurity = 0x00040000, // Class has security associate with it.
+} CorTypeAttr;
+
+
+// Macros for accessing the members of the CorTypeAttr.
+#define IsTdNotPublic(x) (((x) & tdVisibilityMask) == tdNotPublic)
+#define IsTdPublic(x) (((x) & tdVisibilityMask) == tdPublic)
+#define IsTdNestedPublic(x) (((x) & tdVisibilityMask) == tdNestedPublic)
+#define IsTdNestedPrivate(x) (((x) & tdVisibilityMask) == tdNestedPrivate)
+#define IsTdNestedFamily(x) (((x) & tdVisibilityMask) == tdNestedFamily)
+#define IsTdNestedAssembly(x) (((x) & tdVisibilityMask) == tdNestedAssembly)
+#define IsTdNestedFamANDAssem(x) (((x) & tdVisibilityMask) == tdNestedFamANDAssem)
+#define IsTdNestedFamORAssem(x) (((x) & tdVisibilityMask) == tdNestedFamORAssem)
+#define IsTdNested(x) (((x) & tdVisibilityMask) >= tdNestedPublic)
+
+#define IsTdAutoLayout(x) (((x) & tdLayoutMask) == tdAutoLayout)
+#define IsTdSequentialLayout(x) (((x) & tdLayoutMask) == tdSequentialLayout)
+#define IsTdExplicitLayout(x) (((x) & tdLayoutMask) == tdExplicitLayout)
+
+#define IsTdClass(x) (((x) & tdClassSemanticsMask) == tdClass)
+#define IsTdInterface(x) (((x) & tdClassSemanticsMask) == tdInterface)
+
+#define IsTdAbstract(x) ((x) & tdAbstract)
+#define IsTdSealed(x) ((x) & tdSealed)
+#define IsTdSpecialName(x) ((x) & tdSpecialName)
+
+#define IsTdImport(x) ((x) & tdImport)
+#define IsTdSerializable(x) ((x) & tdSerializable)
+#define IsTdWindowsRuntime(x) ((x) & tdWindowsRuntime)
+
+#define IsTdAnsiClass(x) (((x) & tdStringFormatMask) == tdAnsiClass)
+#define IsTdUnicodeClass(x) (((x) & tdStringFormatMask) == tdUnicodeClass)
+#define IsTdAutoClass(x) (((x) & tdStringFormatMask) == tdAutoClass)
+#define IsTdCustomFormatClass(x) (((x) & tdStringFormatMask) == tdCustomFormatClass)
+#define IsTdBeforeFieldInit(x) ((x) & tdBeforeFieldInit)
+#define IsTdForwarder(x) ((x) & tdForwarder)
+
+#define IsTdRTSpecialName(x) ((x) & tdRTSpecialName)
+#define IsTdHasSecurity(x) ((x) & tdHasSecurity)
+
+// MethodDef attr bits, Used by DefineMethod.
+typedef enum CorMethodAttr
+{
+ // member access mask - Use this mask to retrieve accessibility information.
+ mdMemberAccessMask = 0x0007,
+ mdPrivateScope = 0x0000, // Member not referenceable.
+ mdPrivate = 0x0001, // Accessible only by the parent type.
+ mdFamANDAssem = 0x0002, // Accessible by sub-types only in this Assembly.
+ mdAssem = 0x0003, // Accessibly by anyone in the Assembly.
+ mdFamily = 0x0004, // Accessible only by type and sub-types.
+ mdFamORAssem = 0x0005, // Accessibly by sub-types anywhere, plus anyone in assembly.
+ mdPublic = 0x0006, // Accessibly by anyone who has visibility to this scope.
+ // end member access mask
+
+ // method contract attributes.
+ mdStatic = 0x0010, // Defined on type, else per instance.
+ mdFinal = 0x0020, // Method may not be overridden.
+ mdVirtual = 0x0040, // Method virtual.
+ mdHideBySig = 0x0080, // Method hides by name+sig, else just by name.
+
+ // vtable layout mask - Use this mask to retrieve vtable attributes.
+ mdVtableLayoutMask = 0x0100,
+ mdReuseSlot = 0x0000, // The default.
+ mdNewSlot = 0x0100, // Method always gets a new slot in the vtable.
+ // end vtable layout mask
+
+ // method implementation attributes.
+ mdCheckAccessOnOverride = 0x0200, // Overridability is the same as the visibility.
+ mdAbstract = 0x0400, // Method does not provide an implementation.
+ mdSpecialName = 0x0800, // Method is special. Name describes how.
+
+ // interop attributes
+ mdPinvokeImpl = 0x2000, // Implementation is forwarded through pinvoke.
+ mdUnmanagedExport = 0x0008, // Managed method exported via thunk to unmanaged code.
+
+ // Reserved flags for runtime use only.
+ mdReservedMask = 0xd000,
+ mdRTSpecialName = 0x1000, // Runtime should check name encoding.
+ mdHasSecurity = 0x4000, // Method has security associate with it.
+ mdRequireSecObject = 0x8000, // Method calls another method containing security code.
+
+} CorMethodAttr;
+
+// Macros for accessing the members of CorMethodAttr.
+#define IsMdPrivateScope(x) (((x) & mdMemberAccessMask) == mdPrivateScope)
+#define IsMdPrivate(x) (((x) & mdMemberAccessMask) == mdPrivate)
+#define IsMdFamANDAssem(x) (((x) & mdMemberAccessMask) == mdFamANDAssem)
+#define IsMdAssem(x) (((x) & mdMemberAccessMask) == mdAssem)
+#define IsMdFamily(x) (((x) & mdMemberAccessMask) == mdFamily)
+#define IsMdFamORAssem(x) (((x) & mdMemberAccessMask) == mdFamORAssem)
+#define IsMdPublic(x) (((x) & mdMemberAccessMask) == mdPublic)
+
+#define IsMdStatic(x) ((x) & mdStatic)
+#define IsMdFinal(x) ((x) & mdFinal)
+#define IsMdVirtual(x) ((x) & mdVirtual)
+#define IsMdHideBySig(x) ((x) & mdHideBySig)
+
+#define IsMdReuseSlot(x) (((x) & mdVtableLayoutMask) == mdReuseSlot)
+#define IsMdNewSlot(x) (((x) & mdVtableLayoutMask) == mdNewSlot)
+
+#define IsMdCheckAccessOnOverride(x) ((x) & mdCheckAccessOnOverride)
+#define IsMdAbstract(x) ((x) & mdAbstract)
+#define IsMdSpecialName(x) ((x) & mdSpecialName)
+
+#define IsMdPinvokeImpl(x) ((x) & mdPinvokeImpl)
+#define IsMdUnmanagedExport(x) ((x) & mdUnmanagedExport)
+
+#define IsMdRTSpecialName(x) ((x) & mdRTSpecialName)
+#define IsMdInstanceInitializer(x, str) (((x) & mdRTSpecialName) && !strcmp((str), COR_CTOR_METHOD_NAME))
+#define IsMdInstanceInitializerW(x, str) (((x) & mdRTSpecialName) && !wcscmp((str), COR_CTOR_METHOD_NAME_W))
+#define IsMdClassConstructor(x, str) (((x) & mdRTSpecialName) && !strcmp((str), COR_CCTOR_METHOD_NAME))
+#define IsMdClassConstructorW(x, str) (((x) & mdRTSpecialName) && !wcscmp((str), COR_CCTOR_METHOD_NAME_W))
+#define IsMdHasSecurity(x) ((x) & mdHasSecurity)
+#define IsMdRequireSecObject(x) ((x) & mdRequireSecObject)
+
+// FieldDef attr bits, used by DefineField.
+typedef enum CorFieldAttr
+{
+ // member access mask - Use this mask to retrieve accessibility information.
+ fdFieldAccessMask = 0x0007,
+ fdPrivateScope = 0x0000, // Member not referenceable.
+ fdPrivate = 0x0001, // Accessible only by the parent type.
+ fdFamANDAssem = 0x0002, // Accessible by sub-types only in this Assembly.
+ fdAssembly = 0x0003, // Accessibly by anyone in the Assembly.
+ fdFamily = 0x0004, // Accessible only by type and sub-types.
+ fdFamORAssem = 0x0005, // Accessibly by sub-types anywhere, plus anyone in assembly.
+ fdPublic = 0x0006, // Accessibly by anyone who has visibility to this scope.
+ // end member access mask
+
+ // field contract attributes.
+ fdStatic = 0x0010, // Defined on type, else per instance.
+ fdInitOnly = 0x0020, // Field may only be initialized, not written to after init.
+ fdLiteral = 0x0040, // Value is compile time constant.
+ fdNotSerialized = 0x0080, // Field does not have to be serialized when type is remoted.
+
+ fdSpecialName = 0x0200, // field is special. Name describes how.
+
+ // interop attributes
+ fdPinvokeImpl = 0x2000, // Implementation is forwarded through pinvoke.
+
+ // Reserved flags for runtime use only.
+ fdReservedMask = 0x9500,
+ fdRTSpecialName = 0x0400, // Runtime(metadata internal APIs) should check name encoding.
+ fdHasFieldMarshal = 0x1000, // Field has marshalling information.
+ fdHasDefault = 0x8000, // Field has default.
+ fdHasFieldRVA = 0x0100, // Field has RVA.
+} CorFieldAttr;
+
+// Macros for accessing the members of CorFieldAttr.
+#define IsFdPrivateScope(x) (((x) & fdFieldAccessMask) == fdPrivateScope)
+#define IsFdPrivate(x) (((x) & fdFieldAccessMask) == fdPrivate)
+#define IsFdFamANDAssem(x) (((x) & fdFieldAccessMask) == fdFamANDAssem)
+#define IsFdAssembly(x) (((x) & fdFieldAccessMask) == fdAssembly)
+#define IsFdFamily(x) (((x) & fdFieldAccessMask) == fdFamily)
+#define IsFdFamORAssem(x) (((x) & fdFieldAccessMask) == fdFamORAssem)
+#define IsFdPublic(x) (((x) & fdFieldAccessMask) == fdPublic)
+
+#define IsFdStatic(x) ((x) & fdStatic)
+#define IsFdInitOnly(x) ((x) & fdInitOnly)
+#define IsFdLiteral(x) ((x) & fdLiteral)
+#define IsFdNotSerialized(x) ((x) & fdNotSerialized)
+
+#define IsFdPinvokeImpl(x) ((x) & fdPinvokeImpl)
+#define IsFdSpecialName(x) ((x) & fdSpecialName)
+#define IsFdHasFieldRVA(x) ((x) & fdHasFieldRVA)
+
+#define IsFdRTSpecialName(x) ((x) & fdRTSpecialName)
+#define IsFdHasFieldMarshal(x) ((x) & fdHasFieldMarshal)
+#define IsFdHasDefault(x) ((x) & fdHasDefault)
+
+// Param attr bits, used by DefineParam.
+typedef enum CorParamAttr
+{
+ pdIn = 0x0001, // Param is [In]
+ pdOut = 0x0002, // Param is [out]
+ pdOptional = 0x0010, // Param is optional
+
+ // Reserved flags for Runtime use only.
+ pdReservedMask = 0xf000,
+ pdHasDefault = 0x1000, // Param has default value.
+ pdHasFieldMarshal = 0x2000, // Param has FieldMarshal.
+
+ pdUnused = 0xcfe0,
+} CorParamAttr;
+
+// Macros for accessing the members of CorParamAttr.
+#define IsPdIn(x) ((x) & pdIn)
+#define IsPdOut(x) ((x) & pdOut)
+#define IsPdOptional(x) ((x) & pdOptional)
+
+#define IsPdHasDefault(x) ((x) & pdHasDefault)
+#define IsPdHasFieldMarshal(x) ((x) & pdHasFieldMarshal)
+
+
+// Property attr bits, used by DefineProperty.
+typedef enum CorPropertyAttr
+{
+ prSpecialName = 0x0200, // property is special. Name describes how.
+
+ // Reserved flags for Runtime use only.
+ prReservedMask = 0xf400,
+ prRTSpecialName = 0x0400, // Runtime(metadata internal APIs) should check name encoding.
+ prHasDefault = 0x1000, // Property has default
+
+ prUnused = 0xe9ff,
+} CorPropertyAttr;
+
+// Macros for accessing the members of CorPropertyAttr.
+#define IsPrSpecialName(x) ((x) & prSpecialName)
+
+#define IsPrRTSpecialName(x) ((x) & prRTSpecialName)
+#define IsPrHasDefault(x) ((x) & prHasDefault)
+
+// Event attr bits, used by DefineEvent.
+typedef enum CorEventAttr
+{
+ evSpecialName = 0x0200, // event is special. Name describes how.
+
+ // Reserved flags for Runtime use only.
+ evReservedMask = 0x0400,
+ evRTSpecialName = 0x0400, // Runtime(metadata internal APIs) should check name encoding.
+} CorEventAttr;
+
+// Macros for accessing the members of CorEventAttr.
+#define IsEvSpecialName(x) ((x) & evSpecialName)
+
+#define IsEvRTSpecialName(x) ((x) & evRTSpecialName)
+
+
+// MethodSemantic attr bits, used by DefineProperty, DefineEvent.
+typedef enum CorMethodSemanticsAttr
+{
+ msSetter = 0x0001, // Setter for property
+ msGetter = 0x0002, // Getter for property
+ msOther = 0x0004, // other method for property or event
+ msAddOn = 0x0008, // AddOn method for event
+ msRemoveOn = 0x0010, // RemoveOn method for event
+ msFire = 0x0020, // Fire method for event
+} CorMethodSemanticsAttr;
+
+// Macros for accessing the members of CorMethodSemanticsAttr.
+#define IsMsSetter(x) ((x) & msSetter)
+#define IsMsGetter(x) ((x) & msGetter)
+#define IsMsOther(x) ((x) & msOther)
+#define IsMsAddOn(x) ((x) & msAddOn)
+#define IsMsRemoveOn(x) ((x) & msRemoveOn)
+#define IsMsFire(x) ((x) & msFire)
+
+
+// DeclSecurity attr bits, used by DefinePermissionSet.
+typedef enum CorDeclSecurity
+{
+ dclActionMask = 0x001f, // Mask allows growth of enum.
+ dclActionNil = 0x0000, //
+ dclRequest = 0x0001, //
+ dclDemand = 0x0002, //
+ dclAssert = 0x0003, //
+ dclDeny = 0x0004, //
+ dclPermitOnly = 0x0005, //
+ dclLinktimeCheck = 0x0006, //
+ dclInheritanceCheck = 0x0007, //
+ dclRequestMinimum = 0x0008, //
+ dclRequestOptional = 0x0009, //
+ dclRequestRefuse = 0x000a, //
+ dclPrejitGrant = 0x000b, // Persisted grant set at prejit time
+ dclPrejitDenied = 0x000c, // Persisted denied set at prejit time
+ dclNonCasDemand = 0x000d, //
+ dclNonCasLinkDemand = 0x000e, //
+ dclNonCasInheritance = 0x000f, //
+ dclMaximumValue = 0x000f, // Maximum legal value
+} CorDeclSecurity;
+
+// Macros for accessing the members of CorDeclSecurity.
+#define IsDclActionNil(x) (((x) & dclActionMask) == dclActionNil)
+
+// Is this a demand that can trigger a stackwalk?
+#define IsDclActionAnyStackModifier(x) ((((x) & dclActionMask) == dclAssert) || \
+ (((x) & dclActionMask) == dclDeny) || \
+ (((x) & dclActionMask) == dclPermitOnly))
+
+// Is this an assembly level attribute (i.e. not applicable on Type/Member)?
+#define IsAssemblyDclAction(x) (((x) >= dclRequestMinimum) && \
+ ((x) <= dclRequestRefuse))
+
+// Is this an NGen only attribute?
+#define IsNGenOnlyDclAction(x) (((x) == dclPrejitGrant) || \
+ ((x) == dclPrejitDenied))
+
+
+// MethodImpl attr bits, used by DefineMethodImpl.
+typedef enum CorMethodImpl
+{
+ // code impl mask
+ miCodeTypeMask = 0x0003, // Flags about code type.
+ miIL = 0x0000, // Method impl is IL.
+ miNative = 0x0001, // Method impl is native.
+ miOPTIL = 0x0002, // Method impl is OPTIL
+ miRuntime = 0x0003, // Method impl is provided by the runtime.
+ // end code impl mask
+
+ // managed mask
+ miManagedMask = 0x0004, // Flags specifying whether the code is managed or unmanaged.
+ miUnmanaged = 0x0004, // Method impl is unmanaged, otherwise managed.
+ miManaged = 0x0000, // Method impl is managed.
+ // end managed mask
+
+ // implementation info and interop
+ miForwardRef = 0x0010, // Indicates method is defined; used primarily in merge scenarios.
+ miPreserveSig = 0x0080, // Indicates method sig is not to be mangled to do HRESULT conversion.
+
+ miInternalCall = 0x1000, // Reserved for internal use.
+
+ miSynchronized = 0x0020, // Method is single threaded through the body.
+ miNoInlining = 0x0008, // Method may not be inlined.
+ miAggressiveInlining = 0x0100, // Method should be inlined if possible.
+ miNoOptimization = 0x0040, // Method may not be optimized.
+
+ // These are the flags that are allowed in MethodImplAttribute's Value
+ // property. This should include everything above except the code impl
+ // flags (which are used for MethodImplAttribute's MethodCodeType field).
+ miUserMask = miManagedMask | miForwardRef | miPreserveSig |
+ miInternalCall | miSynchronized |
+ miNoInlining | miAggressiveInlining |
+ miNoOptimization,
+
+ miMaxMethodImplVal = 0xffff, // Range check value
+} CorMethodImpl;
+
+// Macros for accesing the members of CorMethodImpl.
+#define IsMiIL(x) (((x) & miCodeTypeMask) == miIL)
+#define IsMiNative(x) (((x) & miCodeTypeMask) == miNative)
+#define IsMiOPTIL(x) (((x) & miCodeTypeMask) == miOPTIL)
+#define IsMiRuntime(x) (((x) & miCodeTypeMask) == miRuntime)
+
+#define IsMiUnmanaged(x) (((x) & miManagedMask) == miUnmanaged)
+#define IsMiManaged(x) (((x) & miManagedMask) == miManaged)
+
+#define IsMiForwardRef(x) ((x) & miForwardRef)
+#define IsMiPreserveSig(x) ((x) & miPreserveSig)
+
+#define IsMiInternalCall(x) ((x) & miInternalCall)
+
+#define IsMiSynchronized(x) ((x) & miSynchronized)
+#define IsMiNoInlining(x) ((x) & miNoInlining)
+#define IsMiAggressiveInlining(x) ((x) & miAggressiveInlining)
+#define IsMiNoOptimization(x) ((x) & miNoOptimization)
+
+// PinvokeMap attr bits, used by DefinePinvokeMap.
+typedef enum CorPinvokeMap
+{
+ pmNoMangle = 0x0001, // Pinvoke is to use the member name as specified.
+
+ // Use this mask to retrieve the CharSet information.
+ pmCharSetMask = 0x0006,
+ pmCharSetNotSpec = 0x0000,
+ pmCharSetAnsi = 0x0002,
+ pmCharSetUnicode = 0x0004,
+ pmCharSetAuto = 0x0006,
+
+
+ pmBestFitUseAssem = 0x0000,
+ pmBestFitEnabled = 0x0010,
+ pmBestFitDisabled = 0x0020,
+ pmBestFitMask = 0x0030,
+
+ pmThrowOnUnmappableCharUseAssem = 0x0000,
+ pmThrowOnUnmappableCharEnabled = 0x1000,
+ pmThrowOnUnmappableCharDisabled = 0x2000,
+ pmThrowOnUnmappableCharMask = 0x3000,
+
+ pmSupportsLastError = 0x0040, // Information about target function. Not relevant for fields.
+
+ // None of the calling convention flags is relevant for fields.
+ pmCallConvMask = 0x0700,
+ pmCallConvWinapi = 0x0100, // Pinvoke will use native callconv appropriate to target windows platform.
+ pmCallConvCdecl = 0x0200,
+ pmCallConvStdcall = 0x0300,
+ pmCallConvThiscall = 0x0400, // In M9, pinvoke will raise exception.
+ pmCallConvFastcall = 0x0500,
+
+ pmMaxValue = 0xFFFF,
+} CorPinvokeMap;
+
+// Macros for accessing the members of CorPinvokeMap
+#define IsPmNoMangle(x) ((x) & pmNoMangle)
+
+#define IsPmCharSetNotSpec(x) (((x) & pmCharSetMask) == pmCharSetNotSpec)
+#define IsPmCharSetAnsi(x) (((x) & pmCharSetMask) == pmCharSetAnsi)
+#define IsPmCharSetUnicode(x) (((x) & pmCharSetMask) == pmCharSetUnicode)
+#define IsPmCharSetAuto(x) (((x) & pmCharSetMask) == pmCharSetAuto)
+
+#define IsPmSupportsLastError(x) ((x) & pmSupportsLastError)
+
+#define IsPmCallConvWinapi(x) (((x) & pmCallConvMask) == pmCallConvWinapi)
+#define IsPmCallConvCdecl(x) (((x) & pmCallConvMask) == pmCallConvCdecl)
+#define IsPmCallConvStdcall(x) (((x) & pmCallConvMask) == pmCallConvStdcall)
+#define IsPmCallConvThiscall(x) (((x) & pmCallConvMask) == pmCallConvThiscall)
+#define IsPmCallConvFastcall(x) (((x) & pmCallConvMask) == pmCallConvFastcall)
+
+#define IsPmBestFitEnabled(x) (((x) & pmBestFitMask) == pmBestFitEnabled)
+#define IsPmBestFitDisabled(x) (((x) & pmBestFitMask) == pmBestFitDisabled)
+#define IsPmBestFitUseAssem(x) (((x) & pmBestFitMask) == pmBestFitUseAssem)
+
+#define IsPmThrowOnUnmappableCharEnabled(x) (((x) & pmThrowOnUnmappableCharMask) == pmThrowOnUnmappableCharEnabled)
+#define IsPmThrowOnUnmappableCharDisabled(x) (((x) & pmThrowOnUnmappableCharMask) == pmThrowOnUnmappableCharDisabled)
+#define IsPmThrowOnUnmappableCharUseAssem(x) (((x) & pmThrowOnUnmappableCharMask) == pmThrowOnUnmappableCharUseAssem)
+
+// Assembly attr bits, used by DefineAssembly.
+typedef enum CorAssemblyFlags
+{
+ afPublicKey = 0x0001, // The assembly ref holds the full (unhashed) public key.
+
+ afPA_None = 0x0000, // Processor Architecture unspecified
+ afPA_MSIL = 0x0010, // Processor Architecture: neutral (PE32)
+ afPA_x86 = 0x0020, // Processor Architecture: x86 (PE32)
+ afPA_IA64 = 0x0030, // Processor Architecture: Itanium (PE32+)
+ afPA_AMD64 = 0x0040, // Processor Architecture: AMD X64 (PE32+)
+ afPA_ARM = 0x0050, // Processor Architecture: ARM (PE32)
+ afPA_NoPlatform = 0x0070, // applies to any platform but cannot run on any (e.g. reference assembly), should not have "specified" set
+ afPA_Specified = 0x0080, // Propagate PA flags to AssemblyRef record
+ afPA_Mask = 0x0070, // Bits describing the processor architecture
+ afPA_FullMask = 0x00F0, // Bits describing the PA incl. Specified
+ afPA_Shift = 0x0004, // NOT A FLAG, shift count in PA flags <--> index conversion
+
+ afEnableJITcompileTracking = 0x8000, // From "DebuggableAttribute".
+ afDisableJITcompileOptimizer = 0x4000, // From "DebuggableAttribute".
+
+ afRetargetable = 0x0100, // The assembly can be retargeted (at runtime) to an
+ // assembly from a different publisher.
+
+ afContentType_Default = 0x0000,
+ afContentType_WindowsRuntime = 0x0200,
+ afContentType_Mask = 0x0E00, // Bits describing ContentType
+} CorAssemblyFlags;
+
+// Macros for accessing the members of CorAssemblyFlags.
+#define IsAfRetargetable(x) ((x) & afRetargetable)
+#define IsAfContentType_Default(x) (((x) & afContentType_Mask) == afContentType_Default)
+#define IsAfContentType_WindowsRuntime(x) (((x) & afContentType_Mask) == afContentType_WindowsRuntime)
+
+// Macros for accessing the Processor Architecture flags of CorAssemblyFlags.
+#define IsAfPA_MSIL(x) (((x) & afPA_Mask) == afPA_MSIL)
+#define IsAfPA_x86(x) (((x) & afPA_Mask) == afPA_x86)
+#define IsAfPA_IA64(x) (((x) & afPA_Mask) == afPA_IA64)
+#define IsAfPA_AMD64(x) (((x) & afPA_Mask) == afPA_AMD64)
+#define IsAfPA_ARM(x) (((x) & afPA_Mask) == afPA_ARM)
+#define IsAfPA_NoPlatform(x) (((x) & afPA_FullMask) == afPA_NoPlatform)
+#define IsAfPA_Specified(x) ((x) & afPA_Specified)
+#define PAIndex(x) (((x) & afPA_Mask) >> afPA_Shift)
+#define PAFlag(x) (((x) << afPA_Shift) & afPA_Mask)
+#define PrepareForSaving(x) ((x) & (((x) & afPA_Specified) ? ~afPA_Specified : ~afPA_FullMask))
+
+#define IsAfEnableJITcompileTracking(x) ((x) & afEnableJITcompileTracking)
+#define IsAfDisableJITcompileOptimizer(x) ((x) & afDisableJITcompileOptimizer)
+
+// Macros for accessing the public key flags of CorAssemblyFlags.
+#define IsAfPublicKey(x) ((x) & afPublicKey)
+#define IsAfPublicKeyToken(x) (((x) & afPublicKey) == 0)
+
+
+// ManifestResource attr bits, used by DefineManifestResource.
+typedef enum CorManifestResourceFlags
+{
+ mrVisibilityMask = 0x0007,
+ mrPublic = 0x0001, // The Resource is exported from the Assembly.
+ mrPrivate = 0x0002, // The Resource is private to the Assembly.
+} CorManifestResourceFlags;
+
+// Macros for accessing the members of CorManifestResourceFlags.
+#define IsMrPublic(x) (((x) & mrVisibilityMask) == mrPublic)
+#define IsMrPrivate(x) (((x) & mrVisibilityMask) == mrPrivate)
+
+
+// File attr bits, used by DefineFile.
+typedef enum CorFileFlags
+{
+ ffContainsMetaData = 0x0000, // This is not a resource file
+ ffContainsNoMetaData = 0x0001, // This is a resource file or other non-metadata-containing file
+} CorFileFlags;
+
+// Macros for accessing the members of CorFileFlags.
+#define IsFfContainsMetaData(x) (!((x) & ffContainsNoMetaData))
+#define IsFfContainsNoMetaData(x) ((x) & ffContainsNoMetaData)
+
+// PE file kind bits, returned by IMetaDataImport2::GetPEKind()
+typedef enum CorPEKind
+{
+ peNot = 0x00000000, // not a PE file
+ peILonly = 0x00000001, // flag IL_ONLY is set in COR header
+ pe32BitRequired=0x00000002, // flag 32BITREQUIRED is set and 32BITPREFERRED is clear in COR header
+ pe32Plus = 0x00000004, // PE32+ file (64 bit)
+ pe32Unmanaged=0x00000008, // PE32 without COR header
+ pe32BitPreferred=0x00000010 // flags 32BITREQUIRED and 32BITPREFERRED are set in COR header
+} CorPEKind;
+
+
+// GenericParam bits, used by DefineGenericParam.
+typedef enum CorGenericParamAttr
+{
+ // Variance of type parameters, only applicable to generic parameters
+ // for generic interfaces and delegates
+ gpVarianceMask = 0x0003,
+ gpNonVariant = 0x0000,
+ gpCovariant = 0x0001,
+ gpContravariant = 0x0002,
+
+ // Special constraints, applicable to any type parameters
+ gpSpecialConstraintMask = 0x001C,
+ gpNoSpecialConstraint = 0x0000,
+ gpReferenceTypeConstraint = 0x0004, // type argument must be a reference type
+ gpNotNullableValueTypeConstraint = 0x0008, // type argument must be a value type but not Nullable
+ gpDefaultConstructorConstraint = 0x0010, // type argument must have a public default constructor
+} CorGenericParamAttr;
+
+// structures and enums moved from COR.H
+typedef unsigned __int8 COR_SIGNATURE;
+
+typedef COR_SIGNATURE* PCOR_SIGNATURE; // pointer to a cor sig. Not void* so that
+ // the bytes can be incremented easily
+typedef const COR_SIGNATURE* PCCOR_SIGNATURE;
+
+
+typedef const char * MDUTF8CSTR;
+typedef char * MDUTF8STR;
+
+//*****************************************************************************
+//
+// Element type for Cor signature
+//
+//*****************************************************************************
+
+typedef enum CorElementType
+{
+ ELEMENT_TYPE_END = 0x00,
+ ELEMENT_TYPE_VOID = 0x01,
+ ELEMENT_TYPE_BOOLEAN = 0x02,
+ ELEMENT_TYPE_CHAR = 0x03,
+ ELEMENT_TYPE_I1 = 0x04,
+ ELEMENT_TYPE_U1 = 0x05,
+ ELEMENT_TYPE_I2 = 0x06,
+ ELEMENT_TYPE_U2 = 0x07,
+ ELEMENT_TYPE_I4 = 0x08,
+ ELEMENT_TYPE_U4 = 0x09,
+ ELEMENT_TYPE_I8 = 0x0a,
+ ELEMENT_TYPE_U8 = 0x0b,
+ ELEMENT_TYPE_R4 = 0x0c,
+ ELEMENT_TYPE_R8 = 0x0d,
+ ELEMENT_TYPE_STRING = 0x0e,
+
+ // every type above PTR will be simple type
+ ELEMENT_TYPE_PTR = 0x0f, // PTR <type>
+ ELEMENT_TYPE_BYREF = 0x10, // BYREF <type>
+
+ // Please use ELEMENT_TYPE_VALUETYPE. ELEMENT_TYPE_VALUECLASS is deprecated.
+ ELEMENT_TYPE_VALUETYPE = 0x11, // VALUETYPE <class Token>
+ ELEMENT_TYPE_CLASS = 0x12, // CLASS <class Token>
+ ELEMENT_TYPE_VAR = 0x13, // a class type variable VAR <number>
+ ELEMENT_TYPE_ARRAY = 0x14, // MDARRAY <type> <rank> <bcount> <bound1> ... <lbcount> <lb1> ...
+ ELEMENT_TYPE_GENERICINST = 0x15, // GENERICINST <generic type> <argCnt> <arg1> ... <argn>
+ ELEMENT_TYPE_TYPEDBYREF = 0x16, // TYPEDREF (it takes no args) a typed referece to some other type
+
+ ELEMENT_TYPE_I = 0x18, // native integer size
+ ELEMENT_TYPE_U = 0x19, // native unsigned integer size
+ ELEMENT_TYPE_FNPTR = 0x1b, // FNPTR <complete sig for the function including calling convention>
+ ELEMENT_TYPE_OBJECT = 0x1c, // Shortcut for System.Object
+ ELEMENT_TYPE_SZARRAY = 0x1d, // Shortcut for single dimension zero lower bound array
+ // SZARRAY <type>
+ ELEMENT_TYPE_MVAR = 0x1e, // a method type variable MVAR <number>
+
+ // This is only for binding
+ ELEMENT_TYPE_CMOD_REQD = 0x1f, // required C modifier : E_T_CMOD_REQD <mdTypeRef/mdTypeDef>
+ ELEMENT_TYPE_CMOD_OPT = 0x20, // optional C modifier : E_T_CMOD_OPT <mdTypeRef/mdTypeDef>
+
+ // This is for signatures generated internally (which will not be persisted in any way).
+ ELEMENT_TYPE_INTERNAL = 0x21, // INTERNAL <typehandle>
+
+ // Note that this is the max of base type excluding modifiers
+ ELEMENT_TYPE_MAX = 0x22, // first invalid element type
+
+
+ ELEMENT_TYPE_MODIFIER = 0x40,
+ ELEMENT_TYPE_SENTINEL = 0x01 | ELEMENT_TYPE_MODIFIER, // sentinel for varargs
+ ELEMENT_TYPE_PINNED = 0x05 | ELEMENT_TYPE_MODIFIER,
+
+} CorElementType;
+
+
+//*****************************************************************************
+//
+// Serialization types for Custom attribute support
+//
+//*****************************************************************************
+
+typedef enum CorSerializationType
+{
+ SERIALIZATION_TYPE_UNDEFINED = 0,
+ SERIALIZATION_TYPE_BOOLEAN = ELEMENT_TYPE_BOOLEAN,
+ SERIALIZATION_TYPE_CHAR = ELEMENT_TYPE_CHAR,
+ SERIALIZATION_TYPE_I1 = ELEMENT_TYPE_I1,
+ SERIALIZATION_TYPE_U1 = ELEMENT_TYPE_U1,
+ SERIALIZATION_TYPE_I2 = ELEMENT_TYPE_I2,
+ SERIALIZATION_TYPE_U2 = ELEMENT_TYPE_U2,
+ SERIALIZATION_TYPE_I4 = ELEMENT_TYPE_I4,
+ SERIALIZATION_TYPE_U4 = ELEMENT_TYPE_U4,
+ SERIALIZATION_TYPE_I8 = ELEMENT_TYPE_I8,
+ SERIALIZATION_TYPE_U8 = ELEMENT_TYPE_U8,
+ SERIALIZATION_TYPE_R4 = ELEMENT_TYPE_R4,
+ SERIALIZATION_TYPE_R8 = ELEMENT_TYPE_R8,
+ SERIALIZATION_TYPE_STRING = ELEMENT_TYPE_STRING,
+ SERIALIZATION_TYPE_SZARRAY = ELEMENT_TYPE_SZARRAY, // Shortcut for single dimension zero lower bound array
+ SERIALIZATION_TYPE_TYPE = 0x50,
+ SERIALIZATION_TYPE_TAGGED_OBJECT= 0x51,
+ SERIALIZATION_TYPE_FIELD = 0x53,
+ SERIALIZATION_TYPE_PROPERTY = 0x54,
+ SERIALIZATION_TYPE_ENUM = 0x55
+} CorSerializationType;
+
+//
+// Calling convention flags.
+//
+
+
+typedef enum CorCallingConvention
+{
+ IMAGE_CEE_CS_CALLCONV_DEFAULT = 0x0,
+
+ IMAGE_CEE_CS_CALLCONV_VARARG = 0x5,
+ IMAGE_CEE_CS_CALLCONV_FIELD = 0x6,
+ IMAGE_CEE_CS_CALLCONV_LOCAL_SIG = 0x7,
+ IMAGE_CEE_CS_CALLCONV_PROPERTY = 0x8,
+ IMAGE_CEE_CS_CALLCONV_UNMGD = 0x9,
+ IMAGE_CEE_CS_CALLCONV_GENERICINST = 0xa, // generic method instantiation
+ IMAGE_CEE_CS_CALLCONV_NATIVEVARARG = 0xb, // used ONLY for 64bit vararg PInvoke calls
+ IMAGE_CEE_CS_CALLCONV_MAX = 0xc, // first invalid calling convention
+
+
+ // The high bits of the calling convention convey additional info
+ IMAGE_CEE_CS_CALLCONV_MASK = 0x0f, // Calling convention is bottom 4 bits
+ IMAGE_CEE_CS_CALLCONV_HASTHIS = 0x20, // Top bit indicates a 'this' parameter
+ IMAGE_CEE_CS_CALLCONV_EXPLICITTHIS = 0x40, // This parameter is explicitly in the signature
+ IMAGE_CEE_CS_CALLCONV_GENERIC = 0x10, // Generic method sig with explicit number of type arguments (precedes ordinary parameter count)
+ // 0x80 is reserved for internal use
+} CorCallingConvention;
+
+#define IMAGE_CEE_CS_CALLCONV_INSTANTIATION IMAGE_CEE_CS_CALLCONV_GENERICINST
+
+typedef enum CorUnmanagedCallingConvention
+{
+ IMAGE_CEE_UNMANAGED_CALLCONV_C = 0x1,
+ IMAGE_CEE_UNMANAGED_CALLCONV_STDCALL = 0x2,
+ IMAGE_CEE_UNMANAGED_CALLCONV_THISCALL = 0x3,
+ IMAGE_CEE_UNMANAGED_CALLCONV_FASTCALL = 0x4,
+
+ IMAGE_CEE_CS_CALLCONV_C = IMAGE_CEE_UNMANAGED_CALLCONV_C,
+ IMAGE_CEE_CS_CALLCONV_STDCALL = IMAGE_CEE_UNMANAGED_CALLCONV_STDCALL,
+ IMAGE_CEE_CS_CALLCONV_THISCALL = IMAGE_CEE_UNMANAGED_CALLCONV_THISCALL,
+ IMAGE_CEE_CS_CALLCONV_FASTCALL = IMAGE_CEE_UNMANAGED_CALLCONV_FASTCALL,
+
+} CorUnmanagedCallingConvention;
+
+
+typedef enum CorArgType
+{
+ IMAGE_CEE_CS_END = 0x0,
+ IMAGE_CEE_CS_VOID = 0x1,
+ IMAGE_CEE_CS_I4 = 0x2,
+ IMAGE_CEE_CS_I8 = 0x3,
+ IMAGE_CEE_CS_R4 = 0x4,
+ IMAGE_CEE_CS_R8 = 0x5,
+ IMAGE_CEE_CS_PTR = 0x6,
+ IMAGE_CEE_CS_OBJECT = 0x7,
+ IMAGE_CEE_CS_STRUCT4 = 0x8,
+ IMAGE_CEE_CS_STRUCT32 = 0x9,
+ IMAGE_CEE_CS_BYVALUE = 0xA,
+} CorArgType;
+
+
+//*****************************************************************************
+//
+// Native type for N-Direct
+//
+//*****************************************************************************
+
+typedef enum CorNativeType
+{
+
+ // Kepp this in-synch with ndp\clr\src\BCL\System\runtime\interopservices\attributes.cs
+
+ NATIVE_TYPE_END = 0x0, //DEPRECATED
+ NATIVE_TYPE_VOID = 0x1, //DEPRECATED
+ NATIVE_TYPE_BOOLEAN = 0x2, // (4 byte boolean value: TRUE = non-zero, FALSE = 0)
+ NATIVE_TYPE_I1 = 0x3,
+ NATIVE_TYPE_U1 = 0x4,
+ NATIVE_TYPE_I2 = 0x5,
+ NATIVE_TYPE_U2 = 0x6,
+ NATIVE_TYPE_I4 = 0x7,
+ NATIVE_TYPE_U4 = 0x8,
+ NATIVE_TYPE_I8 = 0x9,
+ NATIVE_TYPE_U8 = 0xa,
+ NATIVE_TYPE_R4 = 0xb,
+ NATIVE_TYPE_R8 = 0xc,
+ NATIVE_TYPE_SYSCHAR = 0xd, //DEPRECATED
+ NATIVE_TYPE_VARIANT = 0xe, //DEPRECATED
+ NATIVE_TYPE_CURRENCY = 0xf,
+ NATIVE_TYPE_PTR = 0x10, //DEPRECATED
+
+ NATIVE_TYPE_DECIMAL = 0x11, //DEPRECATED
+ NATIVE_TYPE_DATE = 0x12, //DEPRECATED
+ NATIVE_TYPE_BSTR = 0x13, //COMINTEROP
+ NATIVE_TYPE_LPSTR = 0x14,
+ NATIVE_TYPE_LPWSTR = 0x15,
+ NATIVE_TYPE_LPTSTR = 0x16,
+ NATIVE_TYPE_FIXEDSYSSTRING = 0x17,
+ NATIVE_TYPE_OBJECTREF = 0x18, //DEPRECATED
+ NATIVE_TYPE_IUNKNOWN = 0x19, //COMINTEROP
+ NATIVE_TYPE_IDISPATCH = 0x1a, //COMINTEROP
+ NATIVE_TYPE_STRUCT = 0x1b,
+ NATIVE_TYPE_INTF = 0x1c, //COMINTEROP
+ NATIVE_TYPE_SAFEARRAY = 0x1d, //COMINTEROP
+ NATIVE_TYPE_FIXEDARRAY = 0x1e,
+ NATIVE_TYPE_INT = 0x1f,
+ NATIVE_TYPE_UINT = 0x20,
+
+ NATIVE_TYPE_NESTEDSTRUCT = 0x21, //DEPRECATED (use NATIVE_TYPE_STRUCT)
+
+ NATIVE_TYPE_BYVALSTR = 0x22, //COMINTEROP
+
+ NATIVE_TYPE_ANSIBSTR = 0x23, //COMINTEROP
+
+ NATIVE_TYPE_TBSTR = 0x24, // select BSTR or ANSIBSTR depending on platform
+ //COMINTEROP
+
+ NATIVE_TYPE_VARIANTBOOL = 0x25, // (2-byte boolean value: TRUE = -1, FALSE = 0)
+ //COMINTEROP
+ NATIVE_TYPE_FUNC = 0x26,
+
+ NATIVE_TYPE_ASANY = 0x28,
+
+ NATIVE_TYPE_ARRAY = 0x2a,
+ NATIVE_TYPE_LPSTRUCT = 0x2b,
+
+ NATIVE_TYPE_CUSTOMMARSHALER = 0x2c, // Custom marshaler native type. This must be followed
+ // by a string of the following format:
+ // "Native type name/0Custom marshaler type name/0Optional cookie/0"
+ // Or
+ // "{Native type GUID}/0Custom marshaler type name/0Optional cookie/0"
+
+ NATIVE_TYPE_ERROR = 0x2d, // This native type coupled with ELEMENT_TYPE_I4 will map to VT_HRESULT
+ //COMINTEROP
+
+ NATIVE_TYPE_IINSPECTABLE = 0x2e,
+ NATIVE_TYPE_HSTRING = 0x2f,
+ NATIVE_TYPE_LPUTF8STR = 0x30, // utf-8 string
+ NATIVE_TYPE_MAX = 0x50, // first invalid element type
+} CorNativeType;
+
+
+enum
+{
+ DESCR_GROUP_METHODDEF = 0, // DESCR group for MethodDefs
+ DESCR_GROUP_METHODIMPL, // DESCR group for MethodImpls
+};
+
+/***********************************************************************************/
+// a COR_ILMETHOD_SECT is a generic container for attributes that are private
+// to a particular method. The COR_ILMETHOD structure points to one of these
+// (see GetSect()). COR_ILMETHOD_SECT can decode the Kind of attribute (but not
+// its internal data layout, and can skip past the current attibute to find the
+// Next one. The overhead for COR_ILMETHOD_SECT is a minimum of 2 bytes.
+
+typedef enum CorILMethodSect // codes that identify attributes
+{
+ CorILMethod_Sect_Reserved = 0,
+ CorILMethod_Sect_EHTable = 1,
+ CorILMethod_Sect_OptILTable = 2,
+
+ CorILMethod_Sect_KindMask = 0x3F, // The mask for decoding the type code
+ CorILMethod_Sect_FatFormat = 0x40, // fat format
+ CorILMethod_Sect_MoreSects = 0x80, // there is another attribute after this one
+} CorILMethodSect;
+
+/************************************/
+/* NOTE this structure must be DWORD aligned!! */
+
+typedef struct IMAGE_COR_ILMETHOD_SECT_SMALL
+{
+ BYTE Kind;
+ BYTE DataSize;
+
+} IMAGE_COR_ILMETHOD_SECT_SMALL;
+
+
+
+/************************************/
+/* NOTE this structure must be DWORD aligned!! */
+typedef struct IMAGE_COR_ILMETHOD_SECT_FAT
+{
+ unsigned Kind : 8;
+ unsigned DataSize : 24;
+
+} IMAGE_COR_ILMETHOD_SECT_FAT;
+
+
+
+/***********************************************************************************/
+/* If COR_ILMETHOD_SECT_HEADER::Kind() = CorILMethod_Sect_EHTable then the attribute
+ is a list of exception handling clauses. There are two formats, fat or small
+*/
+typedef enum CorExceptionFlag // definitions for the Flags field below (for both big and small)
+{
+ COR_ILEXCEPTION_CLAUSE_NONE, // This is a typed handler
+ COR_ILEXCEPTION_CLAUSE_OFFSETLEN = 0x0000, // Deprecated
+ COR_ILEXCEPTION_CLAUSE_DEPRECATED = 0x0000, // Deprecated
+ COR_ILEXCEPTION_CLAUSE_FILTER = 0x0001, // If this bit is on, then this EH entry is for a filter
+ COR_ILEXCEPTION_CLAUSE_FINALLY = 0x0002, // This clause is a finally clause
+ COR_ILEXCEPTION_CLAUSE_FAULT = 0x0004, // Fault clause (finally that is called on exception only)
+ COR_ILEXCEPTION_CLAUSE_DUPLICATED = 0x0008, // duplicated clause. This clause was duplicated to a funclet which was pulled out of line
+} CorExceptionFlag;
+
+/***********************************/
+typedef struct IMAGE_COR_ILMETHOD_SECT_EH_CLAUSE_FAT
+{
+ CorExceptionFlag Flags;
+ DWORD TryOffset;
+ DWORD TryLength; // relative to start of try block
+ DWORD HandlerOffset;
+ DWORD HandlerLength; // relative to start of handler
+ union {
+ DWORD ClassToken; // use for type-based exception handlers
+ DWORD FilterOffset; // use for filter-based exception handlers (COR_ILEXCEPTION_FILTER is set)
+ };
+} IMAGE_COR_ILMETHOD_SECT_EH_CLAUSE_FAT;
+
+typedef struct IMAGE_COR_ILMETHOD_SECT_EH_FAT
+{
+ IMAGE_COR_ILMETHOD_SECT_FAT SectFat;
+ IMAGE_COR_ILMETHOD_SECT_EH_CLAUSE_FAT Clauses[1]; // actually variable size
+} IMAGE_COR_ILMETHOD_SECT_EH_FAT;
+
+/***********************************/
+typedef struct IMAGE_COR_ILMETHOD_SECT_EH_CLAUSE_SMALL
+{
+#ifdef _WIN64
+ unsigned Flags : 16;
+#else // !_WIN64
+ CorExceptionFlag Flags : 16;
+#endif
+ unsigned TryOffset : 16;
+ unsigned TryLength : 8; // relative to start of try block
+ unsigned HandlerOffset : 16;
+ unsigned HandlerLength : 8; // relative to start of handler
+ union {
+ DWORD ClassToken;
+ DWORD FilterOffset;
+ };
+} IMAGE_COR_ILMETHOD_SECT_EH_CLAUSE_SMALL;
+
+/***********************************/
+typedef struct IMAGE_COR_ILMETHOD_SECT_EH_SMALL
+{
+ IMAGE_COR_ILMETHOD_SECT_SMALL SectSmall;
+ WORD Reserved;
+ IMAGE_COR_ILMETHOD_SECT_EH_CLAUSE_SMALL Clauses[1]; // actually variable size
+} IMAGE_COR_ILMETHOD_SECT_EH_SMALL;
+
+
+
+typedef union IMAGE_COR_ILMETHOD_SECT_EH
+{
+ IMAGE_COR_ILMETHOD_SECT_EH_SMALL Small;
+ IMAGE_COR_ILMETHOD_SECT_EH_FAT Fat;
+} IMAGE_COR_ILMETHOD_SECT_EH;
+
+
+/***********************************************************************************/
+// Legal values for
+// * code:IMAGE_COR_ILMETHOD_FAT::Flags or
+// * code:IMAGE_COR_ILMETHOD_TINY::Flags_CodeSize fields.
+//
+// The only semantic flag at present is CorILMethod_InitLocals
+typedef enum CorILMethodFlags
+{
+ CorILMethod_InitLocals = 0x0010, // call default constructor on all local vars
+ CorILMethod_MoreSects = 0x0008, // there is another attribute after this one
+
+ CorILMethod_CompressedIL = 0x0040, // Not used.
+
+ // Indicates the format for the COR_ILMETHOD header
+ CorILMethod_FormatShift = 3,
+ CorILMethod_FormatMask = ((1 << CorILMethod_FormatShift) - 1),
+ CorILMethod_TinyFormat = 0x0002, // use this code if the code size is even
+ CorILMethod_SmallFormat = 0x0000,
+ CorILMethod_FatFormat = 0x0003,
+ CorILMethod_TinyFormat1 = 0x0006, // use this code if the code size is odd
+} CorILMethodFlags;
+
+/***************************************************************************/
+/* Used when the method is tiny (< 64 bytes), and there are no local vars */
+typedef struct IMAGE_COR_ILMETHOD_TINY
+{
+ BYTE Flags_CodeSize;
+} IMAGE_COR_ILMETHOD_TINY;
+
+/************************************/
+// This strucuture is the 'fat' layout, where no compression is attempted.
+// Note that this structure can be added on at the end, thus making it extensible
+typedef struct IMAGE_COR_ILMETHOD_FAT
+{
+ unsigned Flags : 12; // Flags see code:CorILMethodFlags
+ unsigned Size : 4; // size in DWords of this structure (currently 3)
+ unsigned MaxStack : 16; // maximum number of items (I4, I, I8, obj ...), on the operand stack
+ DWORD CodeSize; // size of the code
+ mdSignature LocalVarSigTok; // token that indicates the signature of the local vars (0 means none)
+
+} IMAGE_COR_ILMETHOD_FAT;
+
+// an IMAGE_COR_ILMETHOD holds the IL instructions for a individual method. To save space they come in two
+// flavors Fat and Tiny. Conceptually Tiny is just a compressed version of Fat, so code:IMAGE_COR_ILMETHOD_FAT
+// is the logical structure for all headers. Conceptually this blob holds the IL, the Exception Handling
+// Tables, the local variable information and some flags.
+typedef union IMAGE_COR_ILMETHOD
+{
+ IMAGE_COR_ILMETHOD_TINY Tiny;
+ IMAGE_COR_ILMETHOD_FAT Fat;
+} IMAGE_COR_ILMETHOD;
+
+//*****************************************************************************
+// Non VOS v-table entries. Define an array of these pointed to by
+// IMAGE_COR20_HEADER.VTableFixups. Each entry describes a contiguous array of
+// v-table slots. The slots start out initialized to the meta data token value
+// for the method they need to call. At image load time, the CLR Loader will
+// turn each entry into a pointer to machine code for the CPU and can be
+// called directly.
+//*****************************************************************************
+
+typedef struct IMAGE_COR_VTABLEFIXUP
+{
+ ULONG RVA; // Offset of v-table array in image.
+ USHORT Count; // How many entries at location.
+ USHORT Type; // COR_VTABLE_xxx type of entries.
+} IMAGE_COR_VTABLEFIXUP;
+
+
+
+
+
+//*****************************************************************************
+//*****************************************************************************
+//
+// M E T A - D A T A D E C L A R A T I O N S
+//
+//*****************************************************************************
+//*****************************************************************************
+
+//*****************************************************************************
+//
+// Enums for SetOption API.
+//
+//*****************************************************************************
+
+// flags for MetaDataCheckDuplicatesFor
+typedef enum CorCheckDuplicatesFor
+{
+ MDDupAll = 0xffffffff,
+ MDDupENC = MDDupAll,
+ MDNoDupChecks = 0x00000000,
+ MDDupTypeDef = 0x00000001,
+ MDDupInterfaceImpl = 0x00000002,
+ MDDupMethodDef = 0x00000004,
+ MDDupTypeRef = 0x00000008,
+ MDDupMemberRef = 0x00000010,
+ MDDupCustomAttribute = 0x00000020,
+ MDDupParamDef = 0x00000040,
+ MDDupPermission = 0x00000080,
+ MDDupProperty = 0x00000100,
+ MDDupEvent = 0x00000200,
+ MDDupFieldDef = 0x00000400,
+ MDDupSignature = 0x00000800,
+ MDDupModuleRef = 0x00001000,
+ MDDupTypeSpec = 0x00002000,
+ MDDupImplMap = 0x00004000,
+ MDDupAssemblyRef = 0x00008000,
+ MDDupFile = 0x00010000,
+ MDDupExportedType = 0x00020000,
+ MDDupManifestResource = 0x00040000,
+ MDDupGenericParam = 0x00080000,
+ MDDupMethodSpec = 0x00100000,
+ MDDupGenericParamConstraint = 0x00200000,
+ // gap for debug junk
+ MDDupAssembly = 0x10000000,
+
+ // This is the default behavior on metadata. It will check duplicates for TypeRef, MemberRef, Signature, TypeSpec and MethodSpec.
+ MDDupDefault = MDNoDupChecks | MDDupTypeRef | MDDupMemberRef | MDDupSignature | MDDupTypeSpec | MDDupMethodSpec,
+} CorCheckDuplicatesFor;
+
+// flags for MetaDataRefToDefCheck
+typedef enum CorRefToDefCheck
+{
+ // default behavior is to always perform TypeRef to TypeDef and MemberRef to MethodDef/FieldDef optimization
+ MDRefToDefDefault = 0x00000003,
+ MDRefToDefAll = 0xffffffff,
+ MDRefToDefNone = 0x00000000,
+ MDTypeRefToDef = 0x00000001,
+ MDMemberRefToDef = 0x00000002
+} CorRefToDefCheck;
+
+
+// MetaDataNotificationForTokenMovement
+typedef enum CorNotificationForTokenMovement
+{
+ // default behavior is to notify TypeRef, MethodDef, MemberRef, and FieldDef token remaps
+ MDNotifyDefault = 0x0000000f,
+ MDNotifyAll = 0xffffffff,
+ MDNotifyNone = 0x00000000,
+ MDNotifyMethodDef = 0x00000001,
+ MDNotifyMemberRef = 0x00000002,
+ MDNotifyFieldDef = 0x00000004,
+ MDNotifyTypeRef = 0x00000008,
+
+ MDNotifyTypeDef = 0x00000010,
+ MDNotifyParamDef = 0x00000020,
+ MDNotifyInterfaceImpl = 0x00000040,
+ MDNotifyProperty = 0x00000080,
+ MDNotifyEvent = 0x00000100,
+ MDNotifySignature = 0x00000200,
+ MDNotifyTypeSpec = 0x00000400,
+ MDNotifyCustomAttribute = 0x00000800,
+ MDNotifySecurityValue = 0x00001000,
+ MDNotifyPermission = 0x00002000,
+ MDNotifyModuleRef = 0x00004000,
+
+ MDNotifyNameSpace = 0x00008000,
+
+ MDNotifyAssemblyRef = 0x01000000,
+ MDNotifyFile = 0x02000000,
+ MDNotifyExportedType = 0x04000000,
+ MDNotifyResource = 0x08000000,
+} CorNotificationForTokenMovement;
+
+
+typedef enum CorSetENC
+{
+ MDSetENCOn = 0x00000001, // Deprecated name.
+ MDSetENCOff = 0x00000002, // Deprecated name.
+
+ MDUpdateENC = 0x00000001, // ENC mode. Tokens don't move; can be updated.
+ MDUpdateFull = 0x00000002, // "Normal" update mode.
+ MDUpdateExtension = 0x00000003, // Extension mode. Tokens don't move, adds only.
+ MDUpdateIncremental = 0x00000004, // Incremental compilation
+ MDUpdateDelta = 0x00000005, // If ENC on, save only deltas.
+ MDUpdateMask = 0x00000007,
+
+
+} CorSetENC;
+
+#define IsENCDelta(x) (((x) & MDUpdateMask) == MDUpdateDelta)
+
+// flags used in SetOption when pair with MetaDataErrorIfEmitOutOfOrder guid
+typedef enum CorErrorIfEmitOutOfOrder
+{
+ MDErrorOutOfOrderDefault = 0x00000000, // default not to generate any error
+ MDErrorOutOfOrderNone = 0x00000000, // do not generate error for out of order emit
+ MDErrorOutOfOrderAll = 0xffffffff, // generate out of order emit for method, field, param, property, and event
+ MDMethodOutOfOrder = 0x00000001, // generate error when methods are emitted out of order
+ MDFieldOutOfOrder = 0x00000002, // generate error when fields are emitted out of order
+ MDParamOutOfOrder = 0x00000004, // generate error when params are emitted out of order
+ MDPropertyOutOfOrder = 0x00000008, // generate error when properties are emitted out of order
+ MDEventOutOfOrder = 0x00000010, // generate error when events are emitted out of order
+} CorErrorIfEmitOutOfOrder;
+
+
+// flags used in SetOption when pair with MetaDataImportOption guid
+typedef enum CorImportOptions
+{
+ MDImportOptionDefault = 0x00000000, // default to skip over deleted records
+ MDImportOptionAll = 0xFFFFFFFF, // Enumerate everything
+ MDImportOptionAllTypeDefs = 0x00000001, // all of the typedefs including the deleted typedef
+ MDImportOptionAllMethodDefs = 0x00000002, // all of the methoddefs including the deleted ones
+ MDImportOptionAllFieldDefs = 0x00000004, // all of the fielddefs including the deleted ones
+ MDImportOptionAllProperties = 0x00000008, // all of the properties including the deleted ones
+ MDImportOptionAllEvents = 0x00000010, // all of the events including the deleted ones
+ MDImportOptionAllCustomAttributes = 0x00000020, // all of the custom attributes including the deleted ones
+ MDImportOptionAllExportedTypes = 0x00000040, // all of the ExportedTypes including the deleted ones
+
+} CorImportOptions;
+
+
+// flags for MetaDataThreadSafetyOptions
+typedef enum CorThreadSafetyOptions
+{
+ // default behavior is to have thread safety turn off. This means that MetaData APIs will not take reader/writer
+ // lock. Clients is responsible to make sure the properly thread synchornization when using MetaData APIs.
+ MDThreadSafetyDefault = 0x00000000,
+ MDThreadSafetyOff = 0x00000000,
+ MDThreadSafetyOn = 0x00000001,
+} CorThreadSafetyOptions;
+
+
+// flags for MetaDataLinkerOptions
+typedef enum CorLinkerOptions
+{
+ // default behavior is not to keep private types
+ MDAssembly = 0x00000000,
+ MDNetModule = 0x00000001,
+} CorLinkerOptions;
+
+// flags for MetaDataMergeOptions
+typedef enum MergeFlags
+{
+ MergeFlagsNone = 0,
+ MergeManifest = 0x00000001,
+ DropMemberRefCAs = 0x00000002,
+ NoDupCheck = 0x00000004,
+ MergeExportedTypes = 0x00000008
+} MergeFlags;
+
+// flags for MetaDataPreserveLocalRefs
+typedef enum CorLocalRefPreservation
+{
+ MDPreserveLocalRefsNone = 0x00000000,
+ MDPreserveLocalTypeRef = 0x00000001,
+ MDPreserveLocalMemberRef = 0x00000002
+} CorLocalRefPreservation;
+
+//
+// struct used to retrieve field offset
+// used by GetClassLayout and SetClassLayout
+//
+
+#ifndef _COR_FIELD_OFFSET_
+#define _COR_FIELD_OFFSET_
+
+typedef struct COR_FIELD_OFFSET
+{
+ mdFieldDef ridOfField;
+ ULONG ulOffset;
+} COR_FIELD_OFFSET;
+
+#endif
+
+
+//
+// Token tags.
+//
+typedef enum CorTokenType
+{
+ mdtModule = 0x00000000, //
+ mdtTypeRef = 0x01000000, //
+ mdtTypeDef = 0x02000000, //
+ mdtFieldDef = 0x04000000, //
+ mdtMethodDef = 0x06000000, //
+ mdtParamDef = 0x08000000, //
+ mdtInterfaceImpl = 0x09000000, //
+ mdtMemberRef = 0x0a000000, //
+ mdtCustomAttribute = 0x0c000000, //
+ mdtPermission = 0x0e000000, //
+ mdtSignature = 0x11000000, //
+ mdtEvent = 0x14000000, //
+ mdtProperty = 0x17000000, //
+ mdtMethodImpl = 0x19000000, //
+ mdtModuleRef = 0x1a000000, //
+ mdtTypeSpec = 0x1b000000, //
+ mdtAssembly = 0x20000000, //
+ mdtAssemblyRef = 0x23000000, //
+ mdtFile = 0x26000000, //
+ mdtExportedType = 0x27000000, //
+ mdtManifestResource = 0x28000000, //
+ mdtGenericParam = 0x2a000000, //
+ mdtMethodSpec = 0x2b000000, //
+ mdtGenericParamConstraint = 0x2c000000,
+
+ mdtString = 0x70000000, //
+ mdtName = 0x71000000, //
+ mdtBaseType = 0x72000000, // Leave this on the high end value. This does not correspond to metadata table
+} CorTokenType;
+
+//
+// Build / decompose tokens.
+//
+#define RidToToken(rid,tktype) ((rid) |= (tktype))
+#define TokenFromRid(rid,tktype) ((rid) | (tktype))
+#define RidFromToken(tk) ((RID) ((tk) & 0x00ffffff))
+#define TypeFromToken(tk) ((ULONG32)((tk) & 0xff000000))
+#define IsNilToken(tk) ((RidFromToken(tk)) == 0)
+
+//
+// Nil tokens
+//
+#define mdTokenNil ((mdToken)0)
+#define mdModuleNil ((mdModule)mdtModule)
+#define mdTypeRefNil ((mdTypeRef)mdtTypeRef)
+#define mdTypeDefNil ((mdTypeDef)mdtTypeDef)
+#define mdFieldDefNil ((mdFieldDef)mdtFieldDef)
+#define mdMethodDefNil ((mdMethodDef)mdtMethodDef)
+#define mdParamDefNil ((mdParamDef)mdtParamDef)
+#define mdInterfaceImplNil ((mdInterfaceImpl)mdtInterfaceImpl)
+#define mdMemberRefNil ((mdMemberRef)mdtMemberRef)
+#define mdCustomAttributeNil ((mdCustomAttribute)mdtCustomAttribute)
+#define mdPermissionNil ((mdPermission)mdtPermission)
+#define mdSignatureNil ((mdSignature)mdtSignature)
+#define mdEventNil ((mdEvent)mdtEvent)
+#define mdPropertyNil ((mdProperty)mdtProperty)
+#define mdModuleRefNil ((mdModuleRef)mdtModuleRef)
+#define mdTypeSpecNil ((mdTypeSpec)mdtTypeSpec)
+#define mdAssemblyNil ((mdAssembly)mdtAssembly)
+#define mdAssemblyRefNil ((mdAssemblyRef)mdtAssemblyRef)
+#define mdFileNil ((mdFile)mdtFile)
+#define mdExportedTypeNil ((mdExportedType)mdtExportedType)
+#define mdManifestResourceNil ((mdManifestResource)mdtManifestResource)
+
+#define mdGenericParamNil ((mdGenericParam)mdtGenericParam)
+#define mdGenericParamConstraintNil ((mdGenericParamConstraint)mdtGenericParamConstraint)
+#define mdMethodSpecNil ((mdMethodSpec)mdtMethodSpec)
+
+#define mdStringNil ((mdString)mdtString)
+
+//
+// Open bits.
+//
+typedef enum CorOpenFlags
+{
+ ofRead = 0x00000000, // Open scope for read
+ ofWrite = 0x00000001, // Open scope for write.
+ ofReadWriteMask = 0x00000001, // Mask for read/write bit.
+
+ ofCopyMemory = 0x00000002, // Open scope with memory. Ask metadata to maintain its own copy of memory.
+
+ ofReadOnly = 0x00000010, // Open scope for read. Will be unable to QI for a IMetadataEmit* interface
+ ofTakeOwnership = 0x00000020, // The memory was allocated with CoTaskMemAlloc and will be freed by the metadata
+
+ // These are obsolete and are ignored.
+ // ofCacheImage = 0x00000004, // EE maps but does not do relocations or verify image
+ // ofManifestMetadata = 0x00000008, // Open scope on ngen image, return the manifest metadata instead of the IL metadata
+ ofNoTypeLib = 0x00000080, // Don't OpenScope on a typelib.
+ ofNoTransform = 0x00001000, // Disable automatic transforms of .winmd files.
+
+ // Internal bits
+ ofReserved1 = 0x00000100, // Reserved for internal use.
+ ofReserved2 = 0x00000200, // Reserved for internal use.
+ ofReserved3 = 0x00000400, // Reserved for internal use.
+ ofReserved = 0xffffef40 // All the reserved bits.
+
+} CorOpenFlags;
+
+#define IsOfRead(x) (((x) & ofReadWriteMask) == ofRead)
+#define IsOfReadWrite(x) (((x) & ofReadWriteMask) == ofWrite)
+
+#define IsOfCopyMemory(x) ((x) & ofCopyMemory)
+
+#define IsOfReadOnly(x) ((x) & ofReadOnly)
+#define IsOfTakeOwnership(x) ((x) & ofTakeOwnership)
+
+#define IsOfReserved(x) (((x) & ofReserved) != 0)
+
+//
+// Type of file mapping returned by code:IMetaDataInfo::GetFileMapping.
+//
+typedef enum CorFileMapping
+{
+ fmFlat = 0, // Flat file mapping - file is mapped as data file (code:SEC_IMAGE flag was not
+ // passed to code:CreateFileMapping).
+ fmExecutableImage = 1, // Executable image file mapping - file is mapped for execution
+ // (either via code:LoadLibrary or code:CreateFileMapping with code:SEC_IMAGE flag).
+} CorFileMapping;
+
+
+typedef CorTypeAttr CorRegTypeAttr;
+
+//
+// Opaque type for an enumeration handle.
+//
+typedef void *HCORENUM;
+
+
+// Note that this must be kept in sync with System.AttributeTargets.
+typedef enum CorAttributeTargets
+{
+ catAssembly = 0x0001,
+ catModule = 0x0002,
+ catClass = 0x0004,
+ catStruct = 0x0008,
+ catEnum = 0x0010,
+ catConstructor = 0x0020,
+ catMethod = 0x0040,
+ catProperty = 0x0080,
+ catField = 0x0100,
+ catEvent = 0x0200,
+ catInterface = 0x0400,
+ catParameter = 0x0800,
+ catDelegate = 0x1000,
+ catGenericParameter = 0x4000,
+
+ catAll = catAssembly | catModule | catClass | catStruct | catEnum | catConstructor |
+ catMethod | catProperty | catField | catEvent | catInterface | catParameter | catDelegate | catGenericParameter,
+ catClassMembers = catClass | catStruct | catEnum | catConstructor | catMethod | catProperty | catField | catEvent | catDelegate | catInterface,
+
+} CorAttributeTargets;
+
+#ifndef MACROS_NOT_SUPPORTED
+//
+// Some well-known custom attributes
+//
+#ifndef IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS
+ #define IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS (IMAGE_CEE_CS_CALLCONV_DEFAULT | IMAGE_CEE_CS_CALLCONV_HASTHIS)
+#endif
+
+#define INTEROP_DISPID_TYPE_W L"System.Runtime.InteropServices.DispIdAttribute"
+#define INTEROP_DISPID_TYPE "System.Runtime.InteropServices.DispIdAttribute"
+#define INTEROP_DISPID_SIG {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 1, ELEMENT_TYPE_VOID, ELEMENT_TYPE_I4}
+
+#define INTEROP_INTERFACETYPE_TYPE_W L"System.Runtime.InteropServices.InterfaceTypeAttribute"
+#define INTEROP_INTERFACETYPE_TYPE "System.Runtime.InteropServices.InterfaceTypeAttribute"
+#define INTEROP_INTERFACETYPE_SIG {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 1, ELEMENT_TYPE_VOID, ELEMENT_TYPE_I2}
+
+#define INTEROP_CLASSINTERFACE_TYPE_W L"System.Runtime.InteropServices.ClassInterfaceAttribute"
+#define INTEROP_CLASSINTERFACE_TYPE "System.Runtime.InteropServices.ClassInterfaceAttribute"
+#define INTEROP_CLASSINTERFACE_SIG {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 1, ELEMENT_TYPE_VOID, ELEMENT_TYPE_I2}
+
+#define INTEROP_COMVISIBLE_TYPE_W L"System.Runtime.InteropServices.ComVisibleAttribute"
+#define INTEROP_COMVISIBLE_TYPE "System.Runtime.InteropServices.ComVisibleAttribute"
+#define INTEROP_COMVISIBLE_SIG {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 1, ELEMENT_TYPE_VOID, ELEMENT_TYPE_BOOLEAN}
+
+#define INTEROP_COMREGISTERFUNCTION_TYPE_W L"System.Runtime.InteropServices.ComRegisterFunctionAttribute"
+#define INTEROP_COMREGISTERFUNCTION_TYPE "System.Runtime.InteropServices.ComRegisterFunctionAttribute"
+#define INTEROP_COMREGISTERFUNCTION_SIG {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 0, ELEMENT_TYPE_VOID}
+
+#define INTEROP_COMUNREGISTERFUNCTION_TYPE_W L"System.Runtime.InteropServices.ComUnregisterFunctionAttribute"
+#define INTEROP_COMUNREGISTERFUNCTION_TYPE "System.Runtime.InteropServices.ComUnregisterFunctionAttribute"
+#define INTEROP_COMUNREGISTERFUNCTION_SIG {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 0, ELEMENT_TYPE_VOID}
+
+#define INTEROP_IMPORTEDFROMTYPELIB_TYPE_W L"System.Runtime.InteropServices.ImportedFromTypeLibAttribute"
+#define INTEROP_IMPORTEDFROMTYPELIB_TYPE "System.Runtime.InteropServices.ImportedFromTypeLibAttribute"
+#define INTEROP_IMPORTEDFROMTYPELIB_SIG {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 1, ELEMENT_TYPE_VOID, ELEMENT_TYPE_STRING}
+
+#define INTEROP_PRIMARYINTEROPASSEMBLY_TYPE_W L"System.Runtime.InteropServices.PrimaryInteropAssemblyAttribute"
+#define INTEROP_PRIMARYINTEROPASSEMBLY_TYPE "System.Runtime.InteropServices.PrimaryInteropAssemblyAttribute"
+#define INTEROP_PRIMARYINTEROPASSEMBLY_SIG {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 2, ELEMENT_TYPE_VOID, ELEMENT_TYPE_I4, ELEMENT_TYPE_I4}
+
+#define INTEROP_IDISPATCHIMPL_TYPE_W L"System.Runtime.InteropServices.IDispatchImplAttribute"
+#define INTEROP_IDISPATCHIMPL_TYPE "System.Runtime.InteropServices.IDispatchImplAttribute"
+#define INTEROP_IDISPATCHIMPL_SIG {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 1, ELEMENT_TYPE_VOID, ELEMENT_TYPE_I2}
+
+#define INTEROP_COMSOURCEINTERFACES_TYPE_W L"System.Runtime.InteropServices.ComSourceInterfacesAttribute"
+#define INTEROP_COMSOURCEINTERFACES_TYPE "System.Runtime.InteropServices.ComSourceInterfacesAttribute"
+#define INTEROP_COMSOURCEINTERFACES_SIG {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 1, ELEMENT_TYPE_VOID, ELEMENT_TYPE_STRING}
+
+#define INTEROP_COMDEFAULTINTERFACE_TYPE_W L"System.Runtime.InteropServices.ComDefaultInterfaceAttribute"
+#define INTEROP_COMDEFAULTINTERFACE_TYPE "System.Runtime.InteropServices.ComDefaultInterfaceAttribute"
+
+#define INTEROP_COMCONVERSIONLOSS_TYPE_W L"System.Runtime.InteropServices.ComConversionLossAttribute"
+#define INTEROP_COMCONVERSIONLOSS_TYPE "System.Runtime.InteropServices.ComConversionLossAttribute"
+#define INTEROP_COMCONVERSIONLOSS_SIG {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 0, ELEMENT_TYPE_VOID}
+
+#define INTEROP_BESTFITMAPPING_TYPE_W L"System.Runtime.InteropServices.BestFitMappingAttribute"
+#define INTEROP_BESTFITMAPPING_TYPE "System.Runtime.InteropServices.BestFitMappingAttribute"
+#define INTEROP_BESTFITMAPPING_SIG {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 2, ELEMENT_TYPE_VOID, ELEMENT_TYPE_BOOLEAN, ELEMENT_TYPE_BOOLEAN}
+
+#define INTEROP_TYPELIBTYPE_TYPE_W L"System.Runtime.InteropServices.TypeLibTypeAttribute"
+#define INTEROP_TYPELIBTYPE_TYPE "System.Runtime.InteropServices.TypeLibTypeAttribute"
+#define INTEROP_TYPELIBTYPE_SIG {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 1, ELEMENT_TYPE_VOID, ELEMENT_TYPE_I2}
+
+#define INTEROP_TYPELIBFUNC_TYPE_W L"System.Runtime.InteropServices.TypeLibFuncAttribute"
+#define INTEROP_TYPELIBFUNC_TYPE "System.Runtime.InteropServices.TypeLibFuncAttribute"
+#define INTEROP_TYPELIBFUNC_SIG {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 1, ELEMENT_TYPE_VOID, ELEMENT_TYPE_I2}
+
+#define INTEROP_TYPELIBVAR_TYPE_W L"System.Runtime.InteropServices.TypeLibVarAttribute"
+#define INTEROP_TYPELIBVAR_TYPE "System.Runtime.InteropServices.TypeLibVarAttribute"
+#define INTEROP_TYPELIBVAR_SIG {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 1, ELEMENT_TYPE_VOID, ELEMENT_TYPE_I2}
+
+#define INTEROP_MARSHALAS_TYPE_W L"System.Runtime.InteropServices.MarshalAsAttribute"
+#define INTEROP_MARSHALAS_TYPE "System.Runtime.InteropServices.MarshalAsAttribute"
+#define INTEROP_MARSHALAS_SIG {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 1, ELEMENT_TYPE_VOID, ELEMENT_TYPE_I2}
+
+#define INTEROP_COMIMPORT_TYPE_W L"System.Runtime.InteropServices.ComImportAttribute"
+#define INTEROP_COMIMPORT_TYPE "System.Runtime.InteropServices.ComImportAttribute"
+#define INTEROP_COMIMPORT_SIG {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 0, ELEMENT_TYPE_VOID}
+
+#define INTEROP_GUID_TYPE_W W("System.Runtime.InteropServices.GuidAttribute")
+#define INTEROP_GUID_TYPE "System.Runtime.InteropServices.GuidAttribute"
+#define INTEROP_GUID_SIG {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 1, ELEMENT_TYPE_VOID, ELEMENT_TYPE_STRING}
+
+#define INTEROP_DEFAULTMEMBER_TYPE_W L"System.Reflection.DefaultMemberAttribute"
+#define INTEROP_DEFAULTMEMBER_TYPE "System.Reflection.DefaultMemberAttribute"
+#define INTEROP_DEFAULTMEMBER_SIG {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 1, ELEMENT_TYPE_VOID, ELEMENT_TYPE_STRING}
+
+#define INTEROP_COMEMULATE_TYPE_W L"System.Runtime.InteropServices.ComEmulateAttribute"
+#define INTEROP_COMEMULATE_TYPE "System.Runtime.InteropServices.ComEmulateAttribute"
+#define INTEROP_COMEMULATE_SIG {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 1, ELEMENT_TYPE_VOID, ELEMENT_TYPE_STRING}
+
+#define INTEROP_PRESERVESIG_TYPE_W L"System.Runtime.InteropServices.PreserveSigAttribure"
+#define INTEROP_PRESERVESIG_TYPE "System.Runtime.InteropServices.PreserveSigAttribure"
+#define INTEROP_PRESERVESIG_SIG {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 0, ELEMENT_TYPE_BOOLEAN}
+
+#define INTEROP_IN_TYPE_W L"System.Runtime.InteropServices.InAttribute"
+#define INTEROP_IN_TYPE "System.Runtime.InteropServices.InAttribute"
+#define INTEROP_IN_SIG {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 0, ELEMENT_TYPE_VOID}
+
+#define INTEROP_OUT_TYPE_W L"System.Runtime.InteropServices.OutAttribute"
+#define INTEROP_OUT_TYPE "System.Runtime.InteropServices.OutAttribute"
+#define INTEROP_OUT_SIG {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 0, ELEMENT_TYPE_VOID}
+
+#define INTEROP_COMALIASNAME_TYPE_W L"System.Runtime.InteropServices.ComAliasNameAttribute"
+#define INTEROP_COMALIASNAME_TYPE "System.Runtime.InteropServices.ComAliasNameAttribute"
+#define INTEROP_COMALIASNAME_SIG {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 1, ELEMENT_TYPE_VOID, ELEMENT_TYPE_STRING}
+
+#define INTEROP_PARAMARRAY_TYPE_W L"System.ParamArrayAttribute"
+#define INTEROP_PARAMARRAY_TYPE "System.ParamArrayAttribute"
+#define INTEROP_PARAMARRAY_SIG {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 0, ELEMENT_TYPE_VOID}
+
+#define INTEROP_LCIDCONVERSION_TYPE_W L"System.Runtime.InteropServices.LCIDConversionAttribute"
+#define INTEROP_LCIDCONVERSION_TYPE "System.Runtime.InteropServices.LCIDConversionAttribute"
+#define INTEROP_LCIDCONVERSION_SIG {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 1, ELEMENT_TYPE_VOID, ELEMENT_TYPE_I4}
+
+#define INTEROP_COMSUBSTITUTABLEINTERFACE_TYPE_W L"System.Runtime.InteropServices.ComSubstitutableInterfaceAttribute"
+#define INTEROP_COMSUBSTITUTABLEINTERFACE_TYPE "System.Runtime.InteropServices.ComSubstitutableInterfaceAttribute"
+#define INTEROP_COMSUBSTITUTABLEINTERFACE_SIG {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 0, ELEMENT_TYPE_VOID}
+
+#define INTEROP_DECIMALVALUE_TYPE_W L"System.Runtime.CompilerServices.DecimalConstantAttribute"
+#define INTEROP_DECIMALVALUE_TYPE "System.Runtime.CompilerServices.DecimalConstantAttribute"
+#define INTEROP_DECIMALVALUE_SIG {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 5, ELEMENT_TYPE_VOID, ELEMENT_TYPE_U1, ELEMENT_TYPE_U1, ELEMENT_TYPE_U4, ELEMENT_TYPE_U4, ELEMENT_TYPE_U4}
+
+#define INTEROP_DATETIMEVALUE_TYPE_W L"System.Runtime.CompilerServices.DateTimeConstantAttribute"
+#define INTEROP_DATETIMEVALUE_TYPE "System.Runtime.CompilerServices.DateTimeConstantAttribute"
+#define INTEROP_DATETIMEVALUE_SIG {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 1, ELEMENT_TYPE_VOID, ELEMENT_TYPE_I8}
+
+#define INTEROP_IUNKNOWNVALUE_TYPE_W L"System.Runtime.CompilerServices.IUnknownConstantAttribute"
+#define INTEROP_IUNKNOWNVALUE_TYPE "System.Runtime.CompilerServices.IUnknownConstantAttribute"
+#define INTEROP_IUNKNOWNVALUE_SIG {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 0, ELEMENT_TYPE_VOID}
+
+#define INTEROP_IDISPATCHVALUE_TYPE_W L"System.Runtime.CompilerServices.IDispatchConstantAttribute"
+#define INTEROP_IDISPATCHVALUE_TYPE "System.Runtime.CompilerServices.IDispatchConstantAttribute"
+#define INTEROP_IDISPATCHVALUE_SIG {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 0, ELEMENT_TYPE_VOID}
+
+#define INTEROP_AUTOPROXY_TYPE_W L"System.Runtime.InteropServices.AutomationProxyAttribute"
+#define INTEROP_AUTOPROXY_TYPE "System.Runtime.InteropServices.AutomationProxyAttribute"
+#define INTEROP_AUTOPROXY_SIG {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 1, ELEMENT_TYPE_VOID, ELEMENT_TYPE_BOOLEAN}
+
+#define INTEROP_TYPELIBIMPORTCLASS_TYPE_W L"System.Runtime.InteropServices.TypeLibImportClassAttribute"
+#define INTEROP_TYPELIBIMPORTCLASS_TYPE "System.Runtime.InteropServices.TypeLibImportClassAttribute"
+
+
+#define INTEROP_TYPELIBVERSION_TYPE_W L"System.Runtime.InteropServices.TypeLibVersionAttribute"
+#define INTEROP_TYPELIBVERSION_TYPE "System.Runtime.InteropServices.TypeLibVersionAttribute"
+#define INTEROP_TYPELIBVERSION_SIG {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 2, ELEMENT_TYPE_VOID, ELEMENT_TYPE_I2, ELEMENT_TYPE_I2}
+
+#define INTEROP_COMCOMPATIBLEVERSION_TYPE_W L"System.Runtime.InteropServices.ComCompatibleVersionAttribute"
+#define INTEROP_COMCOMPATIBLEVERSION_TYPE "System.Runtime.InteropServices.ComCompatibleVersionAttribute"
+#define INTEROP_COMCOMPATIBLEVERSION_SIG {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 4, ELEMENT_TYPE_VOID, ELEMENT_TYPE_I2, ELEMENT_TYPE_I2, ELEMENT_TYPE_I2, ELEMENT_TYPE_I2}
+
+#define INTEROP_COMEVENTINTERFACE_TYPE_W L"System.Runtime.InteropServices.ComEventInterfaceAttribute"
+#define INTEROP_COMEVENTINTERFACE_TYPE "System.Runtime.InteropServices.ComEventInterfaceAttribute"
+
+#define INTEROP_COCLASS_TYPE_W L"System.Runtime.InteropServices.CoClassAttribute"
+#define INTEROP_COCLASS_TYPE "System.Runtime.InteropServices.CoClassAttribute"
+
+#define INTEROP_SERIALIZABLE_TYPE_W L"System.SerializableAttribute"
+#define INTEROP_SERIALIZABLE_TYPE "System.SerializableAttribute"
+#define INTEROP_SERIALIZABLE_SIG {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 0, ELEMENT_TYPE_VOID}
+
+#define INTEROP_SETWIN32CONTEXTINIDISPATCHATTRIBUTE_TYPE_W L"System.Runtime.InteropServices.SetWin32ContextInIDispatchAttribute"
+#define INTEROP_SETWIN32CONTEXTINIDISPATCHATTRIBUTE_TYPE "System.Runtime.InteropServices.SetWin32ContextInIDispatchAttribute"
+#define INTEROP_SETWIN32CONTEXTINIDISPATCHATTRIBUTE_SIG {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 0, ELEMENT_TYPE_VOID}
+
+#define FORWARD_INTEROP_STUB_METHOD_TYPE_W L"System.Runtime.InteropServices.ManagedToNativeComInteropStubAttribute"
+#define FORWARD_INTEROP_STUB_METHOD_TYPE "System.Runtime.InteropServices.ManagedToNativeComInteropStubAttribute"
+
+#define FRIEND_ASSEMBLY_TYPE_W L"System.Runtime.CompilerServices.InternalsVisibleToAttribute"
+#define FRIEND_ASSEMBLY_TYPE "System.Runtime.CompilerServices.InternalsVisibleToAttribute"
+#define FRIEND_ASSEMBLY_SIG {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 2, ELEMENT_TYPE_VOID, ELEMENT_TYPE_STRING, ELEMENT_TYPE_BOOLEAN}
+
+#define FRIEND_ACCESS_ALLOWED_ATTRIBUTE_TYPE_W L"System.Runtime.CompilerServices.FriendAccessAllowedAttribute"
+#define FRIEND_ACCESS_ALLOWED_ATTRIBUTE_TYPE "System.Runtime.CompilerServices.FriendAccessAllowedAttribute"
+#define FRIEND_ACCESS_ALLOWED_SIG {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 0, ELEMENT_TYPE_VOID}
+
+#define SUBJECT_ASSEMBLY_TYPE_W L"System.Runtime.CompilerServices.IgnoresAccessChecksToAttribute"
+#define SUBJECT_ASSEMBLY_TYPE "System.Runtime.CompilerServices.IgnoresAccessChecksToAttribute"
+#define SUBJECT_ASSEMBLY_SIG {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 1, ELEMENT_TYPE_VOID, ELEMENT_TYPE_STRING}
+
+#define DISABLED_PRIVATE_REFLECTION_TYPE_W L"System.Runtime.CompilerServices.DisablePrivateReflectionAttribute"
+#define DISABLED_PRIVATE_REFLECTION_TYPE "System.Runtime.CompilerServices.DisablePrivateReflectionAttribute"
+#define DISABLED_PRIVATE_REFLECTION_SIG {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 0, ELEMENT_TYPE_VOID}
+
+#define DEFAULTDOMAIN_STA_TYPE_W L"System.STAThreadAttribute"
+#define DEFAULTDOMAIN_STA_TYPE "System.STAThreadAttribute"
+#define DEFAULTDOMAIN_STA_SIG {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 0, ELEMENT_TYPE_VOID}
+
+#define DEFAULTDOMAIN_MTA_TYPE_W L"System.MTAThreadAttribute"
+#define DEFAULTDOMAIN_MTA_TYPE "System.MTAThreadAttribute"
+#define DEFAULTDOMAIN_MTA_SIG {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 0, ELEMENT_TYPE_VOID}
+
+#define DEFAULTDOMAIN_LOADEROPTIMIZATION_TYPE_W L"System.LoaderOptimizationAttribute"
+#define DEFAULTDOMAIN_LOADEROPTIMIZATION_TYPE "System.LoaderOptimizationAttribute"
+#define DEFAULTDOMAIN_LOADEROPTIMIZATION_SIG {IMAGE_CEE_CS_CALLCONV_DEFAULT_HASTHIS, 1, ELEMENT_TYPE_VOID, ELEMENT_TYPE_I1}
+
+#define NONVERSIONABLE_TYPE_W L"System.Runtime.Versioning.NonVersionableAttribute"
+#define NONVERSIONABLE_TYPE "System.Runtime.Versioning.NonVersionableAttribute"
+
+// Keep in sync with CompilationRelaxations.cs
+typedef enum CompilationRelaxationsEnum
+{
+ CompilationRelaxations_NoStringInterning = 0x0008,
+
+} CompilationRelaxationEnum;
+
+#define COMPILATIONRELAXATIONS_TYPE_W L"System.Runtime.CompilerServices.CompilationRelaxationsAttribute"
+#define COMPILATIONRELAXATIONS_TYPE "System.Runtime.CompilerServices.CompilationRelaxationsAttribute"
+
+
+// Keep in sync with RuntimeCompatibilityAttribute.cs
+#define RUNTIMECOMPATIBILITY_TYPE_W L"System.Runtime.CompilerServices.RuntimeCompatibilityAttribute"
+#define RUNTIMECOMPATIBILITY_TYPE "System.Runtime.CompilerServices.RuntimeCompatibilityAttribute"
+
+
+// Keep in sync with AssemblySettingAttributes.cs
+
+typedef enum NGenHintEnum
+{
+ NGenDefault = 0x0000, // No preference specified
+
+ NGenEager = 0x0001, // NGen at install time
+ NGenLazy = 0x0002, // NGen after install time
+ NGenNever = 0x0003 // Assembly should not be ngened
+} NGenHintEnum;
+
+typedef enum LoadHintEnum
+{
+ LoadDefault = 0x0000, // No preference specified
+
+ LoadAlways = 0x0001, // Dependency is always loaded
+ LoadSometimes = 0x0002, // Dependency is sometimes loaded
+ LoadNever = 0x0003 // Dependency is never loaded
+} LoadHintEnum;
+
+#define DEFAULTDEPENDENCY_TYPE_W L"System.Runtime.CompilerServices.DefaultDependencyAttribute"
+#define DEFAULTDEPENDENCY_TYPE "System.Runtime.CompilerServices.DefaultDependencyAttribute"
+
+#define DEPENDENCY_TYPE_W L"System.Runtime.CompilerServices.DependencyAttribute"
+#define DEPENDENCY_TYPE "System.Runtime.CompilerServices.DependencyAttribute"
+
+#define TARGET_FRAMEWORK_TYPE_W L"System.Runtime.Versioning.TargetFrameworkAttribute"
+#define TARGET_FRAMEWORK_TYPE "System.Runtime.Versioning.TargetFrameworkAttribute"
+
+#define ASSEMBLY_METADATA_TYPE_W L"System.Reflection.AssemblyMetadataAttribute"
+#define ASSEMBLY_METADATA_TYPE "System.Reflection.AssemblyMetadataAttribute"
+
+
+#define CMOD_CALLCONV_NAMESPACE_OLD "System.Runtime.InteropServices"
+#define CMOD_CALLCONV_NAMESPACE "System.Runtime.CompilerServices"
+#define CMOD_CALLCONV_NAME_CDECL "CallConvCdecl"
+#define CMOD_CALLCONV_NAME_STDCALL "CallConvStdcall"
+#define CMOD_CALLCONV_NAME_THISCALL "CallConvThiscall"
+#define CMOD_CALLCONV_NAME_FASTCALL "CallConvFastcall"
+
+#endif // MACROS_NOT_SUPPORTED
+
+//
+// GetSaveSize accuracy
+//
+#ifndef _CORSAVESIZE_DEFINED_
+#define _CORSAVESIZE_DEFINED_
+typedef enum CorSaveSize
+{
+ cssAccurate = 0x0000, // Find exact save size, accurate but slower.
+ cssQuick = 0x0001, // Estimate save size, may pad estimate, but faster.
+ cssDiscardTransientCAs = 0x0002, // remove all of the CAs of discardable types
+} CorSaveSize;
+#endif
+
+#define COR_IS_METHOD_MANAGED_IL(flags) ((flags & 0xf) == (miIL | miManaged))
+#define COR_IS_METHOD_MANAGED_OPTIL(flags) ((flags & 0xf) == (miOPTIL | miManaged))
+#define COR_IS_METHOD_MANAGED_NATIVE(flags) ((flags & 0xf) == (miNative | miManaged))
+#define COR_IS_METHOD_UNMANAGED_NATIVE(flags) ((flags & 0xf) == (miNative | miUnmanaged))
+
+//
+// Enum used with NATIVE_TYPE_ARRAY.
+//
+typedef enum NativeTypeArrayFlags
+{
+ ntaSizeParamIndexSpecified = 0x0001,
+ ntaReserved = 0xfffe // All the reserved bits.
+} NativeTypeArrayFlags;
+
+//
+// Opaque types for security properties and values.
+//
+typedef void * PSECURITY_PROPS ;
+typedef void * PSECURITY_VALUE ;
+typedef void ** PPSECURITY_PROPS ;
+typedef void ** PPSECURITY_VALUE ;
+
+//-------------------------------------
+//--- Security data structures
+//-------------------------------------
+
+// Descriptor for a single security custom attribute.
+typedef struct COR_SECATTR {
+ mdMemberRef tkCtor; // Ref to constructor of security attribute.
+ const void *pCustomAttribute; // Blob describing ctor args and field/property values.
+ ULONG cbCustomAttribute; // Length of the above blob.
+} COR_SECATTR;
+
+#endif // __CORHDR_H__
+
diff --git a/src/inc/corhlpr.cpp b/src/inc/corhlpr.cpp
new file mode 100644
index 0000000000..ba803a5616
--- /dev/null
+++ b/src/inc/corhlpr.cpp
@@ -0,0 +1,307 @@
+// 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.
+
+/****************************************************************************
+ ** **
+ ** Corhlpr.h - signature helpers. **
+ ** **
+ ****************************************************************************/
+#ifndef SOS_INCLUDE
+
+#ifdef _BLD_CLR
+#include "utilcode.h"
+#endif
+#include "corhlpr.h"
+#include <stdlib.h>
+
+#endif // !SOS_INCLUDE
+
+
+//*****************************************************************************
+//
+//***** File format helper classes
+//
+//*****************************************************************************
+
+extern "C" {
+
+/***************************************************************************/
+/* Note that this construtor does not set the LocalSig, but has the
+ advantage that it does not have any dependancy on EE structures.
+ inside the EE use the FunctionDesc constructor */
+
+void __stdcall DecoderInit(void *pThis, COR_ILMETHOD *header)
+{
+ COR_ILMETHOD_DECODER *decoder = (COR_ILMETHOD_DECODER *)pThis;
+
+ memset(decoder, 0, sizeof(COR_ILMETHOD_DECODER));
+ if (header->Tiny.IsTiny())
+ {
+ decoder->SetMaxStack(header->Tiny.GetMaxStack());
+ decoder->Code = header->Tiny.GetCode();
+ decoder->SetCodeSize(header->Tiny.GetCodeSize());
+ decoder->SetFlags(CorILMethod_TinyFormat);
+ return;
+ }
+ if (header->Fat.IsFat())
+ {
+#ifdef _WIN64
+ if((((size_t) header) & 3) == 0) // header is aligned
+#else
+ _ASSERTE((((size_t) header) & 3) == 0); // header is aligned
+#endif
+ {
+ *((COR_ILMETHOD_FAT *)decoder) = header->Fat;
+ decoder->Code = header->Fat.GetCode();
+ if (header->Fat.GetSize() >= (sizeof(COR_ILMETHOD_FAT) / 4)) // Size if valid
+ {
+ decoder->Sect = header->Fat.GetSect();
+ if ((decoder->Sect != NULL) && (decoder->Sect->Kind() == CorILMethod_Sect_EHTable))
+ {
+ decoder->EH = (COR_ILMETHOD_SECT_EH *)decoder->Sect;
+ decoder->Sect = decoder->Sect->Next();
+ }
+ }
+ }
+ return;
+ }
+} // DecoderInit
+
+// Calculate the total method size. First get address of end of code. If there are no sections, then
+// the end of code addr marks end of COR_ILMETHOD. Otherwise find addr of end of last section and use it
+// to mark end of COR_ILMETHOD. Assumes that the code is directly followed
+// by each section in the on-disk format
+int __stdcall DecoderGetOnDiskSize(void * pThis, COR_ILMETHOD* header)
+{
+ COR_ILMETHOD_DECODER* decoder = (COR_ILMETHOD_DECODER*)pThis;
+
+ if (decoder->Code == NULL)
+ return 0;
+
+ BYTE *lastAddr = (BYTE*)decoder->Code + decoder->GetCodeSize(); // addr of end of code
+ const COR_ILMETHOD_SECT *sect = decoder->EH;
+ if (sect != 0 && sect->Next() == 0)
+ {
+ lastAddr = (BYTE *)sect + sect->DataSize();
+ }
+ else
+ {
+ const COR_ILMETHOD_SECT *nextSect;
+ for (sect = decoder->Sect; sect; sect = nextSect)
+ {
+ nextSect = sect->Next();
+ if (nextSect == 0)
+ {
+ // sect points to the last section, so set lastAddr
+ lastAddr = (BYTE *)sect + sect->DataSize();
+ break;
+ }
+ }
+ }
+ return (int)(lastAddr - (BYTE*)header);
+}
+
+/*********************************************************************/
+/* APIs for emitting sections etc */
+
+unsigned __stdcall IlmethodSize(COR_ILMETHOD_FAT* header, BOOL moreSections)
+{
+ if (header->GetMaxStack() <= 8 && (header->GetFlags() & ~CorILMethod_FormatMask) == 0
+ && header->GetLocalVarSigTok() == 0 && header->GetCodeSize() < 64 && !moreSections)
+ return(sizeof(COR_ILMETHOD_TINY));
+
+ return(sizeof(COR_ILMETHOD_FAT));
+}
+
+/*********************************************************************/
+ // emit the header (bestFormat) return amount emitted
+unsigned __stdcall IlmethodEmit(unsigned size, COR_ILMETHOD_FAT* header,
+ BOOL moreSections, BYTE* outBuff)
+{
+#ifndef SOS_INCLUDE
+#ifdef _DEBUG
+ BYTE* origBuff = outBuff;
+#endif
+#endif // !SOS_INCLUDE
+ if (size == 1) {
+ // Tiny format
+ *outBuff++ = (BYTE) (CorILMethod_TinyFormat | (header->GetCodeSize() << 2));
+ }
+ else {
+ // Fat format
+ _ASSERTE((((size_t) outBuff) & 3) == 0); // header is dword aligned
+ COR_ILMETHOD_FAT* fatHeader = (COR_ILMETHOD_FAT*) outBuff;
+ outBuff += sizeof(COR_ILMETHOD_FAT);
+ *fatHeader = *header;
+ fatHeader->SetFlags(fatHeader->GetFlags() | CorILMethod_FatFormat);
+ _ASSERTE((fatHeader->GetFlags() & CorILMethod_FormatMask) == CorILMethod_FatFormat);
+ if (moreSections)
+ fatHeader->SetFlags(fatHeader->GetFlags() | CorILMethod_MoreSects);
+ fatHeader->SetSize(sizeof(COR_ILMETHOD_FAT) / 4);
+ }
+#ifndef SOS_INCLUDE
+ _ASSERTE(&origBuff[size] == outBuff);
+#endif // !SOS_INCLUDE
+ return(size);
+}
+
+/*********************************************************************/
+/* static */
+IMAGE_COR_ILMETHOD_SECT_EH_CLAUSE_FAT* __stdcall SectEH_EHClause(void *pSectEH, unsigned idx, IMAGE_COR_ILMETHOD_SECT_EH_CLAUSE_FAT* buff)
+{
+ if (((COR_ILMETHOD_SECT_EH *)pSectEH)->IsFat())
+ return(&(((COR_ILMETHOD_SECT_EH *)pSectEH)->Fat.Clauses[idx]));
+
+ COR_ILMETHOD_SECT_EH_CLAUSE_FAT* fatClause = (COR_ILMETHOD_SECT_EH_CLAUSE_FAT*)buff;
+ COR_ILMETHOD_SECT_EH_CLAUSE_SMALL* smallClause = (COR_ILMETHOD_SECT_EH_CLAUSE_SMALL*)&((COR_ILMETHOD_SECT_EH *)pSectEH)->Small.Clauses[idx];
+
+ // mask to remove sign extension - cast just wouldn't work
+ fatClause->SetFlags((CorExceptionFlag)(smallClause->GetFlags()&0x0000ffff));
+ fatClause->SetClassToken(smallClause->GetClassToken());
+ fatClause->SetTryOffset(smallClause->GetTryOffset());
+ fatClause->SetTryLength(smallClause->GetTryLength());
+ fatClause->SetHandlerLength(smallClause->GetHandlerLength());
+ fatClause->SetHandlerOffset(smallClause->GetHandlerOffset());
+ return(buff);
+}
+/*********************************************************************/
+ // compute the size of the section (best format)
+ // codeSize is the size of the method
+ // deprecated
+unsigned __stdcall SectEH_SizeWithCode(unsigned ehCount, unsigned codeSize)
+{
+ return((ehCount)? SectEH_SizeWorst(ehCount) : 0);
+}
+
+ // will return worse-case size and then Emit will return actual size
+unsigned __stdcall SectEH_SizeWorst(unsigned ehCount)
+{
+ return((ehCount)? (COR_ILMETHOD_SECT_EH_FAT::Size(ehCount)) : 0);
+}
+
+ // will return exact size which will match the size returned by Emit
+unsigned __stdcall SectEH_SizeExact(unsigned ehCount, IMAGE_COR_ILMETHOD_SECT_EH_CLAUSE_FAT* clauses)
+{
+ if (ehCount == 0)
+ return(0);
+
+ unsigned smallSize = COR_ILMETHOD_SECT_EH_SMALL::Size(ehCount);
+ if (smallSize > COR_ILMETHOD_SECT_SMALL_MAX_DATASIZE)
+ return(COR_ILMETHOD_SECT_EH_FAT::Size(ehCount));
+ for (unsigned i = 0; i < ehCount; i++) {
+ COR_ILMETHOD_SECT_EH_CLAUSE_FAT* fatClause = (COR_ILMETHOD_SECT_EH_CLAUSE_FAT*)&clauses[i];
+ if (fatClause->GetTryOffset() > 0xFFFF ||
+ fatClause->GetTryLength() > 0xFF ||
+ fatClause->GetHandlerOffset() > 0xFFFF ||
+ fatClause->GetHandlerLength() > 0xFF) {
+ return(COR_ILMETHOD_SECT_EH_FAT::Size(ehCount));
+ }
+ }
+ return smallSize;
+}
+
+/*********************************************************************/
+
+ // emit the section (best format);
+unsigned __stdcall SectEH_Emit(unsigned size, unsigned ehCount,
+ IMAGE_COR_ILMETHOD_SECT_EH_CLAUSE_FAT* clauses,
+ BOOL moreSections, BYTE* outBuff,
+ ULONG* ehTypeOffsets)
+{
+ if (size == 0)
+ return(0);
+
+ _ASSERTE((((size_t) outBuff) & 3) == 0); // header is dword aligned
+ BYTE* origBuff = outBuff;
+ if (ehCount <= 0)
+ return 0;
+
+ // Initialize the ehTypeOffsets array.
+ if (ehTypeOffsets)
+ {
+ for (unsigned int i = 0; i < ehCount; i++)
+ ehTypeOffsets[i] = (ULONG) -1;
+ }
+
+ if (COR_ILMETHOD_SECT_EH_SMALL::Size(ehCount) < COR_ILMETHOD_SECT_SMALL_MAX_DATASIZE) {
+ COR_ILMETHOD_SECT_EH_SMALL* EHSect = (COR_ILMETHOD_SECT_EH_SMALL*) outBuff;
+ unsigned i;
+ for (i = 0; i < ehCount; i++) {
+ COR_ILMETHOD_SECT_EH_CLAUSE_FAT* fatClause = (COR_ILMETHOD_SECT_EH_CLAUSE_FAT*)&clauses[i];
+ if (fatClause->GetTryOffset() > 0xFFFF ||
+ fatClause->GetTryLength() > 0xFF ||
+ fatClause->GetHandlerOffset() > 0xFFFF ||
+ fatClause->GetHandlerLength() > 0xFF) {
+ break; // fall through and generate as FAT
+ }
+ _ASSERTE((fatClause->GetFlags() & ~0xFFFF) == 0);
+ _ASSERTE((fatClause->GetTryOffset() & ~0xFFFF) == 0);
+ _ASSERTE((fatClause->GetTryLength() & ~0xFF) == 0);
+ _ASSERTE((fatClause->GetHandlerOffset() & ~0xFFFF) == 0);
+ _ASSERTE((fatClause->GetHandlerLength() & ~0xFF) == 0);
+
+ COR_ILMETHOD_SECT_EH_CLAUSE_SMALL* smallClause = (COR_ILMETHOD_SECT_EH_CLAUSE_SMALL*)&EHSect->Clauses[i];
+ smallClause->SetFlags((CorExceptionFlag) fatClause->GetFlags());
+ smallClause->SetTryOffset(fatClause->GetTryOffset());
+ smallClause->SetTryLength(fatClause->GetTryLength());
+ smallClause->SetHandlerOffset(fatClause->GetHandlerOffset());
+ smallClause->SetHandlerLength(fatClause->GetHandlerLength());
+ smallClause->SetClassToken(fatClause->GetClassToken());
+ }
+ if (i >= ehCount) {
+ // if actually got through all the clauses and they are small enough
+ EHSect->Kind = CorILMethod_Sect_EHTable;
+ if (moreSections)
+ EHSect->Kind |= CorILMethod_Sect_MoreSects;
+#ifndef SOS_INCLUDE
+ EHSect->DataSize = EHSect->Size(ehCount);
+#else
+ EHSect->DataSize = (BYTE) EHSect->Size(ehCount);
+#endif // !SOS_INCLUDE
+ EHSect->Reserved = 0;
+ _ASSERTE(EHSect->DataSize == EHSect->Size(ehCount)); // make sure didn't overflow
+ outBuff = (BYTE*) &EHSect->Clauses[ehCount];
+ // Set the offsets for the exception type tokens.
+ if (ehTypeOffsets)
+ {
+ for (i = 0; i < ehCount; i++) {
+ COR_ILMETHOD_SECT_EH_CLAUSE_SMALL* smallClause = (COR_ILMETHOD_SECT_EH_CLAUSE_SMALL*)&EHSect->Clauses[i];
+ if (smallClause->GetFlags() == COR_ILEXCEPTION_CLAUSE_NONE)
+ {
+ _ASSERTE(! IsNilToken(smallClause->GetClassToken()));
+ ehTypeOffsets[i] = (ULONG)((BYTE *)&smallClause->ClassToken - origBuff);
+ }
+ }
+ }
+ return(size);
+ }
+ }
+ // either total size too big or one of constituent elements too big (eg. offset or length)
+ COR_ILMETHOD_SECT_EH_FAT* EHSect = (COR_ILMETHOD_SECT_EH_FAT*) outBuff;
+ EHSect->SetKind(CorILMethod_Sect_EHTable | CorILMethod_Sect_FatFormat);
+ if (moreSections)
+ EHSect->SetKind(EHSect->GetKind() | CorILMethod_Sect_MoreSects);
+
+ EHSect->SetDataSize(EHSect->Size(ehCount));
+ memcpy(EHSect->Clauses, clauses, ehCount * sizeof(COR_ILMETHOD_SECT_EH_CLAUSE_FAT));
+ outBuff = (BYTE*) &EHSect->Clauses[ehCount];
+ _ASSERTE(&origBuff[size] == outBuff);
+ // Set the offsets for the exception type tokens.
+ if (ehTypeOffsets)
+ {
+ for (unsigned int i = 0; i < ehCount; i++) {
+ COR_ILMETHOD_SECT_EH_CLAUSE_FAT* fatClause = (COR_ILMETHOD_SECT_EH_CLAUSE_FAT*)&EHSect->Clauses[i];
+ if (fatClause->GetFlags() == COR_ILEXCEPTION_CLAUSE_NONE)
+ {
+ _ASSERTE(! IsNilToken(fatClause->GetClassToken()));
+ ehTypeOffsets[i] = (ULONG)((BYTE *)&fatClause->ClassToken - origBuff);
+ }
+ }
+ }
+ return(size);
+}
+
+} // extern "C"
+
+
diff --git a/src/inc/corhlpr.h b/src/inc/corhlpr.h
new file mode 100644
index 0000000000..02555c9ec3
--- /dev/null
+++ b/src/inc/corhlpr.h
@@ -0,0 +1,694 @@
+// 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.
+
+/*****************************************************************************
+ ** **
+ ** Corhlpr.h - **
+ ** **
+ *****************************************************************************/
+
+
+#ifndef __CORHLPR_H__
+#define __CORHLPR_H__
+
+#if defined(_MSC_VER) && defined(_X86_) && !defined(FPO_ON)
+#pragma optimize("y", on) // Small critical routines, don't put in EBP frame
+#define FPO_ON 1
+#define CORHLPR_TURNED_FPO_ON 1
+#endif
+
+#include "cor.h"
+#include "corhdr.h"
+#include "corerror.h"
+
+// This header is consumed both within the runtime and externally. In the former
+// case we need to wrap memory allocations, in the latter there is no
+// infrastructure to support this. Detect which way we're building and provide a
+// very simple abstraction layer (handles allocating bytes only).
+#ifdef _BLD_CLR
+#include "new.hpp"
+
+
+#define NEW_NOTHROW(_bytes) new (nothrow) BYTE[_bytes]
+#define NEW_THROWS(_bytes) new BYTE[_bytes]
+void DECLSPEC_NORETURN ThrowOutOfMemory();
+inline void DECLSPEC_NORETURN THROW_OUT_OF_MEMORY()
+{
+ ThrowOutOfMemory();
+}
+#else
+#define NEW_NOTHROW(_bytes) new BYTE[_bytes]
+#define NEW_THROWS(_bytes) __CorHlprNewThrows(_bytes)
+static inline void DECLSPEC_NORETURN __CorHlprThrowOOM()
+{
+ RaiseException(STATUS_NO_MEMORY, 0, 0, NULL);
+}
+static inline BYTE *__CorHlprNewThrows(size_t bytes)
+{
+ BYTE *pbMemory = new BYTE[bytes];
+ if (pbMemory == NULL)
+ __CorHlprThrowOOM();
+ return pbMemory;
+}
+inline void DECLSPEC_NORETURN THROW_OUT_OF_MEMORY()
+{
+ __CorHlprThrowOOM();
+}
+#endif
+
+
+//*****************************************************************************
+// There are a set of macros commonly used in the helpers which you will want
+// to override to get richer behavior. The following defines what is needed
+// if you chose not to do the extra work.
+//*****************************************************************************
+#ifndef IfFailGoto
+#define IfFailGoto(EXPR, LABEL) \
+do { hr = (EXPR); if(FAILED(hr)) { goto LABEL; } } while (0)
+#endif
+
+#ifndef IfFailGo
+#define IfFailGo(EXPR) IfFailGoto(EXPR, ErrExit)
+#endif
+
+#ifndef IfFailRet
+#define IfFailRet(EXPR) do { hr = (EXPR); if(FAILED(hr)) { return (hr); } } while (0)
+#endif
+
+#ifndef IfNullRet
+#define IfNullRet(EXPR) do { if ((EXPR) == NULL){ return (E_OUTOFMEMORY); } } while (0)
+#endif
+
+
+#ifndef _ASSERTE
+#define _ASSERTE(expr)
+#endif
+
+#ifndef COUNTOF
+#define COUNTOF(a) (sizeof(a) / sizeof(*a))
+#endif
+
+#if !BIGENDIAN
+#define VAL16(x) x
+#define VAL32(x) x
+#endif
+
+
+//*****************************************************************************
+//
+//***** Macro to assist with cleaning up local static variables
+//
+//*****************************************************************************
+
+#define CHECK_LOCAL_STATIC_VAR(x) \
+ x \
+
+//*****************************************************************************
+//
+//***** Utility helpers
+//
+//*****************************************************************************
+
+
+#define MAX_CLASSNAME_LENGTH 1024
+
+//*****************************************************************************
+//
+//***** Signature helpers
+//
+//*****************************************************************************
+
+inline bool isCallConv(unsigned sigByte, CorCallingConvention conv)
+{
+ return ((sigByte & IMAGE_CEE_CS_CALLCONV_MASK) == (unsigned) conv);
+}
+
+//*****************************************************************************
+//
+//***** File format helper classes
+//
+//*****************************************************************************
+
+
+
+//*****************************************************************************
+typedef struct tagCOR_ILMETHOD_SECT_SMALL : IMAGE_COR_ILMETHOD_SECT_SMALL {
+ //Data follows
+ const BYTE* Data() const
+ {
+ return(((const BYTE*) this) + sizeof(struct tagCOR_ILMETHOD_SECT_SMALL));
+ }
+
+ bool IsSmall() const
+ {
+ return (Kind & CorILMethod_Sect_FatFormat) == 0;
+ }
+
+ bool More() const
+ {
+ return (Kind & CorILMethod_Sect_MoreSects) != 0;
+ }
+} COR_ILMETHOD_SECT_SMALL;
+
+
+/************************************/
+/* NOTE this structure must be DWORD aligned!! */
+typedef struct tagCOR_ILMETHOD_SECT_FAT : IMAGE_COR_ILMETHOD_SECT_FAT {
+ //Data follows
+ const BYTE* Data() const
+ {
+ return(((const BYTE*) this) + sizeof(struct tagCOR_ILMETHOD_SECT_FAT));
+ }
+
+ //Endian-safe wrappers
+ unsigned GetKind() const {
+ /* return Kind; */
+ return *(BYTE*)this;
+ }
+ void SetKind(unsigned kind) {
+ /* Kind = kind; */
+ *(BYTE*)this = (BYTE)kind;
+ }
+
+ unsigned GetDataSize() const {
+ /* return DataSize; */
+ BYTE* p = (BYTE*)this;
+ return ((unsigned)*(p+1)) |
+ (((unsigned)*(p+2)) << 8) |
+ (((unsigned)*(p+3)) << 16);
+ }
+ void SetDataSize(unsigned datasize) {
+ /* DataSize = dataSize; */
+ BYTE* p = (BYTE*)this;
+ *(p+1) = (BYTE)(datasize);
+ *(p+2) = (BYTE)(datasize >> 8);
+ *(p+3) = (BYTE)(datasize >> 16);
+ }
+} COR_ILMETHOD_SECT_FAT;
+
+typedef struct tagCOR_ILMETHOD_SECT_EH_CLAUSE_FAT : public IMAGE_COR_ILMETHOD_SECT_EH_CLAUSE_FAT {
+ //Endian-safe wrappers
+ CorExceptionFlag GetFlags() const {
+ return (CorExceptionFlag)VAL32((unsigned)Flags);
+ }
+ void SetFlags(CorExceptionFlag flags) {
+ Flags = (CorExceptionFlag)VAL32((unsigned)flags);
+ }
+
+ DWORD GetTryOffset() const {
+ return VAL32(TryOffset);
+ }
+ void SetTryOffset(DWORD Offset) {
+ TryOffset = VAL32(Offset);
+ }
+
+ DWORD GetTryLength() const {
+ return VAL32(TryLength);
+ }
+ void SetTryLength(DWORD Length) {
+ TryLength = VAL32(Length);
+ }
+
+ DWORD GetHandlerOffset() const {
+ return VAL32(HandlerOffset);
+ }
+ void SetHandlerOffset(DWORD Offset) {
+ HandlerOffset = VAL32(Offset);
+ }
+
+ DWORD GetHandlerLength() const {
+ return VAL32(HandlerLength);
+ }
+ void SetHandlerLength(DWORD Length) {
+ HandlerLength = VAL32(Length);
+ }
+
+ DWORD GetClassToken() const {
+ return VAL32(ClassToken);
+ }
+ void SetClassToken(DWORD tok) {
+ ClassToken = VAL32(tok);
+ }
+
+ DWORD GetFilterOffset() const {
+ return VAL32(FilterOffset);
+ }
+ void SetFilterOffset(DWORD offset) {
+ FilterOffset = VAL32(offset);
+ }
+
+} COR_ILMETHOD_SECT_EH_CLAUSE_FAT;
+
+//*****************************************************************************
+struct COR_ILMETHOD_SECT_EH_FAT : public COR_ILMETHOD_SECT_FAT {
+ static unsigned Size(unsigned ehCount) {
+ return (sizeof(COR_ILMETHOD_SECT_EH_FAT) +
+ sizeof(IMAGE_COR_ILMETHOD_SECT_EH_CLAUSE_FAT) * (ehCount-1));
+ }
+
+ IMAGE_COR_ILMETHOD_SECT_EH_CLAUSE_FAT Clauses[1]; // actually variable size
+};
+
+typedef struct tagCOR_ILMETHOD_SECT_EH_CLAUSE_SMALL : public IMAGE_COR_ILMETHOD_SECT_EH_CLAUSE_SMALL {
+ //Endian-safe wrappers
+ CorExceptionFlag GetFlags() const {
+ return (CorExceptionFlag)VAL16((SHORT)Flags);
+ }
+ void SetFlags(CorExceptionFlag flags) {
+ Flags = (CorExceptionFlag)VAL16((SHORT)flags);
+ }
+
+ DWORD GetTryOffset() const {
+ return VAL16(TryOffset);
+ }
+ void SetTryOffset(DWORD Offset) {
+ _ASSERTE((Offset & ~0xffff) == 0);
+ TryOffset = VAL16(Offset);
+ }
+
+ DWORD GetTryLength() const {
+ return TryLength;
+ }
+ void SetTryLength(DWORD Length) {
+ _ASSERTE((Length & ~0xff) == 0);
+ TryLength = Length;
+ }
+
+ DWORD GetHandlerOffset() const {
+ return VAL16(HandlerOffset);
+ }
+ void SetHandlerOffset(DWORD Offset) {
+ _ASSERTE((Offset & ~0xffff) == 0);
+ HandlerOffset = VAL16(Offset);
+ }
+
+ DWORD GetHandlerLength() const {
+ return HandlerLength;
+ }
+ void SetHandlerLength(DWORD Length) {
+ _ASSERTE((Length & ~0xff) == 0);
+ HandlerLength = Length;
+ }
+
+ DWORD GetClassToken() const {
+ return VAL32(ClassToken);
+ }
+ void SetClassToken(DWORD tok) {
+ ClassToken = VAL32(tok);
+ }
+
+ DWORD GetFilterOffset() const {
+ return VAL32(FilterOffset);
+ }
+ void SetFilterOffset(DWORD offset) {
+ FilterOffset = VAL32(offset);
+ }
+} COR_ILMETHOD_SECT_EH_CLAUSE_SMALL;
+
+//*****************************************************************************
+struct COR_ILMETHOD_SECT_EH_SMALL : public COR_ILMETHOD_SECT_SMALL {
+ static unsigned Size(unsigned ehCount) {
+ return (sizeof(COR_ILMETHOD_SECT_EH_SMALL) +
+ sizeof(IMAGE_COR_ILMETHOD_SECT_EH_CLAUSE_SMALL) * (ehCount-1));
+ }
+
+ WORD Reserved; // alignment padding
+ IMAGE_COR_ILMETHOD_SECT_EH_CLAUSE_SMALL Clauses[1]; // actually variable size
+};
+
+
+/************************************/
+/* NOTE this structure must be DWORD aligned!! */
+struct COR_ILMETHOD_SECT
+{
+ bool More() const
+ {
+ return((AsSmall()->Kind & CorILMethod_Sect_MoreSects) != 0);
+ }
+
+ CorILMethodSect Kind() const
+ {
+ return((CorILMethodSect) (AsSmall()->Kind & CorILMethod_Sect_KindMask));
+ }
+
+ const COR_ILMETHOD_SECT* Next() const
+ {
+ if (!More()) return(0);
+ return ((COR_ILMETHOD_SECT*)(((BYTE *)this) + DataSize()))->Align();
+ }
+
+ const BYTE* Data() const
+ {
+ if (IsFat()) return(AsFat()->Data());
+ return(AsSmall()->Data());
+ }
+
+ unsigned DataSize() const
+ {
+ if (Kind() == CorILMethod_Sect_EHTable)
+ {
+ // VB and MC++ shipped with bug where they have not accounted for size of COR_ILMETHOD_SECT_EH_XXX
+ // in DataSize. To avoid breaking these images, we will align the size of EH sections up. This works
+ // because IMAGE_COR_ILMETHOD_SECT_EH_CLAUSE_XXX is bigger than COR_ILMETHOD_SECT_EH_XXX
+ // (see VSWhidbey #99031 and related bugs for details).
+
+ if (IsFat())
+ return Fat.Size(Fat.GetDataSize() / sizeof(IMAGE_COR_ILMETHOD_SECT_EH_CLAUSE_FAT));
+ else
+ return Small.Size(Small.DataSize / sizeof(IMAGE_COR_ILMETHOD_SECT_EH_CLAUSE_SMALL));
+ }
+ else
+ {
+ if (IsFat()) return(AsFat()->GetDataSize());
+ return(AsSmall()->DataSize);
+ }
+ }
+
+ friend struct COR_ILMETHOD;
+ friend struct tagCOR_ILMETHOD_FAT;
+ friend struct tagCOR_ILMETHOD_TINY;
+ bool IsFat() const
+ {
+ return((AsSmall()->Kind & CorILMethod_Sect_FatFormat) != 0);
+ }
+
+ const COR_ILMETHOD_SECT* Align() const
+ {
+ return((COR_ILMETHOD_SECT*) ((((UINT_PTR) this) + 3) & ~3));
+ }
+
+protected:
+ const COR_ILMETHOD_SECT_FAT* AsFat() const
+ {
+ return((COR_ILMETHOD_SECT_FAT*) this);
+ }
+
+ const COR_ILMETHOD_SECT_SMALL* AsSmall() const
+ {
+ return((COR_ILMETHOD_SECT_SMALL*) this);
+ }
+
+public:
+ // The body is either a COR_ILMETHOD_SECT_SMALL or COR_ILMETHOD_SECT_FAT
+ // (as indicated by the CorILMethod_Sect_FatFormat bit
+ union {
+ COR_ILMETHOD_SECT_EH_SMALL Small;
+ COR_ILMETHOD_SECT_EH_FAT Fat;
+ };
+};
+
+
+/***********************************/
+// exported functions (implementation in Format\Format.cpp:
+extern "C" {
+IMAGE_COR_ILMETHOD_SECT_EH_CLAUSE_FAT* __stdcall SectEH_EHClause(void *pSectEH, unsigned idx, IMAGE_COR_ILMETHOD_SECT_EH_CLAUSE_FAT* buff);
+ // compute the size of the section (best format)
+ // codeSize is the size of the method
+ // deprecated
+unsigned __stdcall SectEH_SizeWithCode(unsigned ehCount, unsigned codeSize);
+
+ // will return worse-case size and then Emit will return actual size
+unsigned __stdcall SectEH_SizeWorst(unsigned ehCount);
+
+ // will return exact size which will match the size returned by Emit
+unsigned __stdcall SectEH_SizeExact(unsigned ehCount, IMAGE_COR_ILMETHOD_SECT_EH_CLAUSE_FAT* clauses);
+
+ // emit the section (best format);
+unsigned __stdcall SectEH_Emit(unsigned size, unsigned ehCount,
+ IMAGE_COR_ILMETHOD_SECT_EH_CLAUSE_FAT* clauses,
+ BOOL moreSections, BYTE* outBuff,
+ ULONG* ehTypeOffsets = 0);
+} // extern "C"
+
+
+struct COR_ILMETHOD_SECT_EH : public COR_ILMETHOD_SECT
+{
+ unsigned EHCount() const
+ {
+ return (unsigned)(IsFat() ? (Fat.GetDataSize() / sizeof(IMAGE_COR_ILMETHOD_SECT_EH_CLAUSE_FAT)) :
+ (Small.DataSize / sizeof(IMAGE_COR_ILMETHOD_SECT_EH_CLAUSE_SMALL)));
+ }
+
+ // return one clause in its fat form. Use 'buff' if needed
+ const IMAGE_COR_ILMETHOD_SECT_EH_CLAUSE_FAT* EHClause(unsigned idx, IMAGE_COR_ILMETHOD_SECT_EH_CLAUSE_FAT* buff) const
+ {
+ return SectEH_EHClause((void *)this, idx, buff);
+ };
+ // compute the size of the section (best format)
+ // codeSize is the size of the method
+ // deprecated
+ unsigned static Size(unsigned ehCount, unsigned codeSize)
+ {
+ return SectEH_SizeWithCode(ehCount, codeSize);
+ };
+
+ // will return worse-case size and then Emit will return actual size
+ unsigned static Size(unsigned ehCount)
+ {
+ return SectEH_SizeWorst(ehCount);
+ };
+
+ // will return exact size which will match the size returned by Emit
+ unsigned static Size(unsigned ehCount, const IMAGE_COR_ILMETHOD_SECT_EH_CLAUSE_FAT* clauses)
+ {
+ return SectEH_SizeExact(ehCount, (IMAGE_COR_ILMETHOD_SECT_EH_CLAUSE_FAT*)clauses);
+ };
+
+ // emit the section (best format);
+ unsigned static Emit(unsigned size, unsigned ehCount,
+ const IMAGE_COR_ILMETHOD_SECT_EH_CLAUSE_FAT* clauses,
+ bool moreSections, BYTE* outBuff,
+ ULONG* ehTypeOffsets = 0)
+ {
+ return SectEH_Emit(size, ehCount,
+ (IMAGE_COR_ILMETHOD_SECT_EH_CLAUSE_FAT*)clauses,
+ moreSections, outBuff, ehTypeOffsets);
+ };
+};
+
+
+/***************************************************************************/
+/* Used when the method is tiny (< 64 bytes), and there are no local vars */
+typedef struct tagCOR_ILMETHOD_TINY : IMAGE_COR_ILMETHOD_TINY
+{
+ bool IsTiny() const
+ {
+ return((Flags_CodeSize & (CorILMethod_FormatMask >> 1)) == CorILMethod_TinyFormat);
+ }
+
+ unsigned GetCodeSize() const
+ {
+ return(((unsigned) Flags_CodeSize) >> (CorILMethod_FormatShift-1));
+ }
+
+ unsigned GetMaxStack() const
+ {
+ return(8);
+ }
+
+ BYTE* GetCode() const
+ {
+ return(((BYTE*) this) + sizeof(struct tagCOR_ILMETHOD_TINY));
+ }
+
+ DWORD GetLocalVarSigTok() const
+ {
+ return(0);
+ }
+
+ COR_ILMETHOD_SECT* GetSect() const
+ {
+ return(0);
+ }
+} COR_ILMETHOD_TINY;
+
+
+/************************************/
+// This strucuture is the 'fat' layout, where no compression is attempted.
+// Note that this structure can be added on at the end, thus making it extensible
+typedef struct tagCOR_ILMETHOD_FAT : IMAGE_COR_ILMETHOD_FAT
+{
+ //Endian-safe wrappers
+ unsigned GetSize() const {
+ /* return Size; */
+ BYTE* p = (BYTE*)this;
+ return *(p+1) >> 4;
+ }
+ void SetSize(unsigned size) {
+ /* Size = size; */
+ BYTE* p = (BYTE*)this;
+ *(p+1) = (BYTE)((*(p+1) & 0x0F) | (size << 4));
+ }
+
+ unsigned GetFlags() const {
+ /* return Flags; */
+ BYTE* p = (BYTE*)this;
+ return ((unsigned)*(p+0)) | (( ((unsigned)*(p+1)) & 0x0F) << 8);
+ }
+ void SetFlags(unsigned flags) {
+ /* flags = Flags; */
+ BYTE* p = (BYTE*)this;
+ *p = (BYTE)flags;
+ *(p+1) = (BYTE)((*(p+1) & 0xF0) | ((flags >> 8) & 0x0F));
+ }
+
+ bool IsFat() const {
+ /* return((IMAGE_COR_ILMETHOD_FAT::GetFlags() & CorILMethod_FormatMask) == CorILMethod_FatFormat); */
+ return (*(BYTE*)this & CorILMethod_FormatMask) == CorILMethod_FatFormat;
+ }
+
+ unsigned GetMaxStack() const {
+ /* return MaxStack; */
+ return VAL16(*(USHORT*)((BYTE*)this+2));
+ }
+ void SetMaxStack(unsigned maxStack) {
+ /* MaxStack = maxStack; */
+ *(USHORT*)((BYTE*)this+2) = VAL16((USHORT)maxStack);
+ }
+
+ unsigned GetCodeSize() const
+ {
+ return VAL32(CodeSize);
+ }
+
+ void SetCodeSize(DWORD Size)
+ {
+ CodeSize = VAL32(Size);
+ }
+
+ mdToken GetLocalVarSigTok() const
+ {
+ return VAL32(LocalVarSigTok);
+ }
+
+ void SetLocalVarSigTok(mdSignature tok)
+ {
+ LocalVarSigTok = VAL32(tok);
+ }
+
+ BYTE* GetCode() const {
+ return(((BYTE*) this) + 4*GetSize());
+ }
+
+ bool More() const {
+ // return (GetFlags() & CorILMethod_MoreSects) != 0;
+ return (*(BYTE*)this & CorILMethod_MoreSects) != 0;
+ }
+
+ const COR_ILMETHOD_SECT* GetSect() const {
+ if (!More()) return (0);
+ return(((COR_ILMETHOD_SECT*) (GetCode() + GetCodeSize()))->Align());
+ }
+} COR_ILMETHOD_FAT;
+
+
+extern "C" {
+/************************************/
+// exported functions (impl. Format\Format.cpp)
+unsigned __stdcall IlmethodSize(COR_ILMETHOD_FAT* header, BOOL MoreSections);
+ // emit the header (bestFormat) return amount emitted
+unsigned __stdcall IlmethodEmit(unsigned size, COR_ILMETHOD_FAT* header,
+ BOOL moreSections, BYTE* outBuff);
+}
+
+struct COR_ILMETHOD
+{
+ // a COR_ILMETHOD header should not be decoded by hand. Instead us
+ // COR_ILMETHOD_DECODER to decode it.
+ friend class COR_ILMETHOD_DECODER;
+
+ // compute the size of the header (best format)
+ unsigned static Size(const COR_ILMETHOD_FAT* header, bool MoreSections)
+ {
+ return IlmethodSize((COR_ILMETHOD_FAT*)header,MoreSections);
+ };
+ // emit the header (bestFormat) return amount emitted
+ unsigned static Emit(unsigned size, const COR_ILMETHOD_FAT* header,
+ bool moreSections, BYTE* outBuff)
+ {
+ return IlmethodEmit(size, (COR_ILMETHOD_FAT*)header, moreSections, outBuff);
+ };
+
+//private:
+ union
+ {
+ COR_ILMETHOD_TINY Tiny;
+ COR_ILMETHOD_FAT Fat;
+ };
+ // Code follows the Header, then immedately after the code comes
+ // any sections (COR_ILMETHOD_SECT).
+};
+
+extern "C" {
+/***************************************************************************/
+/* COR_ILMETHOD_DECODER is the only way functions internal to the EE should
+ fetch data from a COR_ILMETHOD. This way any dependancy on the file format
+ (and the multiple ways of encoding the header) is centralized to the
+ COR_ILMETHOD_DECODER constructor) */
+ void __stdcall DecoderInit(void * pThis, COR_ILMETHOD* header);
+ int __stdcall DecoderGetOnDiskSize(void * pThis, COR_ILMETHOD* header);
+} // extern "C"
+
+class COR_ILMETHOD_DECODER : public COR_ILMETHOD_FAT
+{
+public:
+ // Typically the ONLY way you should access COR_ILMETHOD is through
+ // this constructor so format changes are easier.
+ COR_ILMETHOD_DECODER(const COR_ILMETHOD* header)
+ {
+ DecoderInit(this,(COR_ILMETHOD*)header);
+ };
+
+ // The above variant of the constructor can not do a 'complete' job, because
+ // it can not look up the local variable signature meta-data token.
+ // This method should be used when you have access to the Meta data API
+ // If the construction fails, the 'Code' field is set to 0
+
+ enum DecoderStatus {SUCCESS, FORMAT_ERROR, VERIFICATION_ERROR};
+
+ // If we want the decoder to verify the that local signature is OK we
+ // will pass a non-NULL value for wbStatus
+ //
+ // When using LazyInit we want ask that the local signature be verified
+ // But if we fail verification we still need access to the 'Code' field
+ // Because we may be able to demand SkipVerification and thus it was OK
+ // to have had a verification error.
+
+ COR_ILMETHOD_DECODER(COR_ILMETHOD* header,
+ void *pInternalImport,
+ DecoderStatus* wbStatus);
+
+ unsigned EHCount() const
+ {
+ return (EH != 0) ? EH->EHCount() : 0;
+ }
+
+ unsigned GetHeaderSize() const
+ {
+ return GetCodeSize() + ((EH != 0) ? EH->DataSize() : 0);
+ }
+
+ // returns total size of method for use in copying
+ int GetOnDiskSize(const COR_ILMETHOD* header)
+ {
+ return DecoderGetOnDiskSize(this,(COR_ILMETHOD*)header);
+ }
+
+ // Flags these are available because we inherit COR_ILMETHOD_FAT
+ // MaxStack
+ // CodeSize
+ const BYTE * Code;
+ PCCOR_SIGNATURE LocalVarSig; // pointer to signature blob, or 0 if none
+ DWORD cbLocalVarSig; // size of dignature blob, or 0 if none
+ const COR_ILMETHOD_SECT_EH * EH; // eh table if any 0 if none
+ const COR_ILMETHOD_SECT * Sect; // additional sections 0 if none
+}; // class COR_ILMETHOD_DECODER
+
+#if defined(CORHLPR_TURNED_FPO_ON)
+#pragma optimize("", on) // Go back to command line default optimizations
+#undef CORHLPR_TURNED_FPO_ON
+#undef FPO_ON
+#endif
+
+#endif // __CORHLPR_H__
diff --git a/src/inc/corhlprpriv.cpp b/src/inc/corhlprpriv.cpp
new file mode 100644
index 0000000000..47e0cb13d6
--- /dev/null
+++ b/src/inc/corhlprpriv.cpp
@@ -0,0 +1,313 @@
+// 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.
+
+/****************************************************************************
+ ** **
+ ** Corhlprpriv.cpp - signature helpers. **
+ ** **
+ ****************************************************************************/
+#ifndef SOS_INCLUDE
+
+#ifdef _BLD_CLR
+#include "utilcode.h"
+#endif
+#include "corhlprpriv.h"
+#include <stdlib.h>
+
+/*************************************************************************************
+*
+* implementation of CQuickMemoryBase
+*
+*************************************************************************************/
+
+template <SIZE_T SIZE, SIZE_T INCREMENT>
+HRESULT CQuickMemoryBase<SIZE, INCREMENT>::ReSizeNoThrow(SIZE_T iItems)
+{
+#ifdef _BLD_CLR
+#ifdef _DEBUG
+#ifndef DACCESS_COMPILE
+ // Exercise heap for OOM-fault injection purposes
+ // But we can't do this if current thread suspends EE
+ if (!IsSuspendEEThread ())
+ {
+ BYTE *pTmp = NEW_NOTHROW(iItems);
+ if (!pTmp)
+ {
+ return E_OUTOFMEMORY;
+ }
+ delete [] pTmp;
+ }
+#endif
+#endif
+#endif
+ BYTE *pbBuffNew;
+ if (iItems <= cbTotal)
+ {
+ iSize = iItems;
+ return NOERROR;
+ }
+
+#ifdef _BLD_CLR
+#ifndef DACCESS_COMPILE
+ // not allowed to do allocation if current thread suspends EE
+ if (IsSuspendEEThread ())
+ return E_OUTOFMEMORY;
+#endif
+#endif
+ pbBuffNew = NEW_NOTHROW(iItems + INCREMENT);
+ if (!pbBuffNew)
+ return E_OUTOFMEMORY;
+ if (pbBuff)
+ {
+ memcpy(pbBuffNew, pbBuff, cbTotal);
+ delete [] pbBuff;
+ }
+ else
+ {
+ _ASSERTE(cbTotal == SIZE);
+ memcpy(pbBuffNew, rgData, cbTotal);
+ }
+ cbTotal = iItems + INCREMENT;
+ iSize = iItems;
+ pbBuff = pbBuffNew;
+ return NOERROR;
+}
+
+
+/*************************************************************************************
+*
+* get number of bytes consumed by one argument/return type
+*
+*************************************************************************************/
+#define CHECK_REMAINDER if(cbTotal >= cbTotalMax){hr=E_FAIL; goto ErrExit;}
+HRESULT _CountBytesOfOneArg(
+ PCCOR_SIGNATURE pbSig,
+ ULONG *pcbTotal) // Initially, *pcbTotal contains the remaining size of the sig blob
+{
+ ULONG cb;
+ ULONG cbTotal=0;
+ ULONG cbTotalMax;
+ CorElementType ulElementType;
+ ULONG ulData;
+ ULONG ulTemp;
+ int iData;
+ mdToken tk;
+ ULONG cArg;
+ ULONG callingconv;
+ ULONG cArgsIndex;
+ HRESULT hr = NOERROR;
+
+ if(pcbTotal==NULL) return E_FAIL;
+ cbTotalMax = *pcbTotal;
+
+ CHECK_REMAINDER;
+ cbTotal = CorSigUncompressElementType(pbSig, &ulElementType);
+ while (CorIsModifierElementType((CorElementType) ulElementType))
+ {
+ CHECK_REMAINDER;
+ cbTotal += CorSigUncompressElementType(&pbSig[cbTotal], &ulElementType);
+ }
+ switch (ulElementType)
+ {
+ case ELEMENT_TYPE_SZARRAY:
+ case 0x1e /* obsolete */:
+ // skip over base type
+ CHECK_REMAINDER;
+ cb = cbTotalMax - cbTotal;
+ IfFailGo( _CountBytesOfOneArg(&pbSig[cbTotal], &cb) );
+ cbTotal += cb;
+ break;
+
+ case ELEMENT_TYPE_FNPTR:
+ CHECK_REMAINDER;
+ cbTotal += CorSigUncompressData (&pbSig[cbTotal], &callingconv);
+
+ // remember number of bytes to represent the arg counts
+ CHECK_REMAINDER;
+ cbTotal += CorSigUncompressData (&pbSig[cbTotal], &cArg);
+
+ // how many bytes to represent the return type
+ CHECK_REMAINDER;
+ cb = cbTotalMax - cbTotal;
+ IfFailGo( _CountBytesOfOneArg( &pbSig[cbTotal], &cb) );
+ cbTotal += cb;
+
+ // loop through argument
+ for (cArgsIndex = 0; cArgsIndex < cArg; cArgsIndex++)
+ {
+ CHECK_REMAINDER;
+ cb = cbTotalMax - cbTotal;
+ IfFailGo( _CountBytesOfOneArg( &pbSig[cbTotal], &cb) );
+ cbTotal += cb;
+ }
+
+ break;
+
+ case ELEMENT_TYPE_ARRAY:
+ // syntax : ARRAY BaseType <rank> [i size_1... size_i] [j lowerbound_1 ... lowerbound_j]
+
+ // skip over base type
+ CHECK_REMAINDER;
+ cb = cbTotalMax - cbTotal;
+ IfFailGo( _CountBytesOfOneArg(&pbSig[cbTotal], &cb) );
+ cbTotal += cb;
+
+ // Parse for the rank
+ CHECK_REMAINDER;
+ cbTotal += CorSigUncompressData(&pbSig[cbTotal], &ulData);
+
+ // if rank == 0, we are done
+ if (ulData == 0)
+ break;
+
+ // any size of dimension specified?
+ CHECK_REMAINDER;
+ cbTotal += CorSigUncompressData(&pbSig[cbTotal], &ulData);
+ while (ulData--)
+ {
+ CHECK_REMAINDER;
+ cbTotal += CorSigUncompressData(&pbSig[cbTotal], &ulTemp);
+ }
+
+ // any lower bound specified?
+ CHECK_REMAINDER;
+ cbTotal += CorSigUncompressData(&pbSig[cbTotal], &ulData);
+
+ while (ulData--)
+ {
+ CHECK_REMAINDER;
+ cbTotal += CorSigUncompressSignedInt(&pbSig[cbTotal], &iData);
+ }
+
+ break;
+ case ELEMENT_TYPE_VALUETYPE:
+ case ELEMENT_TYPE_CLASS:
+ case ELEMENT_TYPE_CMOD_REQD:
+ case ELEMENT_TYPE_CMOD_OPT:
+ // count the bytes for the token compression
+ CHECK_REMAINDER;
+ cbTotal += CorSigUncompressToken(&pbSig[cbTotal], &tk);
+ if ( ulElementType == ELEMENT_TYPE_CMOD_REQD ||
+ ulElementType == ELEMENT_TYPE_CMOD_OPT)
+ {
+ // skip over base type
+ CHECK_REMAINDER;
+ cb = cbTotalMax - cbTotal;
+ IfFailGo( _CountBytesOfOneArg(&pbSig[cbTotal], &cb) );
+ cbTotal += cb;
+ }
+ break;
+ default:
+ break;
+ }
+
+ *pcbTotal = cbTotal;
+ErrExit:
+ return hr;
+}
+#undef CHECK_REMAINDER
+
+//*****************************************************************************
+// copy fixed part of VarArg signature to a buffer
+//*****************************************************************************
+HRESULT _GetFixedSigOfVarArg( // S_OK or error.
+ PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob of COM+ method signature
+ ULONG cbSigBlob, // [IN] size of signature
+ CQuickBytes *pqbSig, // [OUT] output buffer for fixed part of VarArg Signature
+ ULONG *pcbSigBlob) // [OUT] number of bytes written to the above output buffer
+{
+ HRESULT hr = NOERROR;
+ ULONG cbCalling;
+ ULONG cbTyArgsNumber = 0; // number of bytes to store the type arg count (generics only)
+ ULONG cbArgsNumber; // number of bytes to store the original arg count
+ ULONG cbArgsNumberTemp; // number of bytes to store the fixed arg count
+ ULONG cbTotal = 0; // total of number bytes for return type + all fixed arguments
+ ULONG cbCur = 0; // index through the pvSigBlob
+ ULONG cb;
+ ULONG cArg;
+ ULONG cTyArg;
+ ULONG callingconv;
+ ULONG cArgsIndex;
+ CorElementType ulElementType;
+ BYTE *pbSig;
+
+ _ASSERTE (pvSigBlob && pcbSigBlob);
+
+ // remember the number of bytes to represent the calling convention
+ cbCalling = CorSigUncompressData (pvSigBlob, &callingconv);
+ if (cbCalling == ((ULONG)(-1)))
+ {
+ return E_INVALIDARG;
+ }
+ _ASSERTE (isCallConv(callingconv, IMAGE_CEE_CS_CALLCONV_VARARG));
+ cbCur += cbCalling;
+
+ if (callingconv & IMAGE_CEE_CS_CALLCONV_GENERIC)
+ {
+ cbTyArgsNumber = CorSigUncompressData(&pvSigBlob[cbCur], &cTyArg);
+ if (cbTyArgsNumber == ((ULONG)(-1)))
+ {
+ return E_INVALIDARG;
+ }
+ cbCur += cbTyArgsNumber;
+ }
+
+ // remember number of bytes to represent the arg counts
+ cbArgsNumber= CorSigUncompressData (&pvSigBlob[cbCur], &cArg);
+ if (cbArgsNumber == ((ULONG)(-1)))
+ {
+ return E_INVALIDARG;
+ }
+
+ cbCur += cbArgsNumber;
+
+ // how many bytes to represent the return type
+ cb = cbSigBlob-cbCur;
+ IfFailGo( _CountBytesOfOneArg( &pvSigBlob[cbCur], &cb) );
+ cbCur += cb;
+ cbTotal += cb;
+
+ // loop through argument until we found ELEMENT_TYPE_SENTINEL or run
+ // out of arguments
+ for (cArgsIndex = 0; cArgsIndex < cArg; cArgsIndex++)
+ {
+ _ASSERTE(cbCur < cbSigBlob);
+
+ // peak the outer most ELEMENT_TYPE_*
+ CorSigUncompressElementType (&pvSigBlob[cbCur], &ulElementType);
+ if (ulElementType == ELEMENT_TYPE_SENTINEL)
+ break;
+ cb = cbSigBlob-cbCur;
+ IfFailGo( _CountBytesOfOneArg( &pvSigBlob[cbCur], &cb) );
+ cbTotal += cb;
+ cbCur += cb;
+ }
+
+ cbArgsNumberTemp = CorSigCompressData(cArgsIndex, &cArg);
+
+ // now cbCalling : the number of bytes needed to store the calling convention
+ // cbArgNumberTemp : number of bytes to store the fixed arg count
+ // cbTotal : the number of bytes to store the ret and fixed arguments
+
+ *pcbSigBlob = cbCalling + cbArgsNumberTemp + cbTotal;
+
+ // resize the buffer
+ IfFailGo( pqbSig->ReSizeNoThrow(*pcbSigBlob) );
+ pbSig = (BYTE *)pqbSig->Ptr();
+
+ // copy over the calling convention
+ cb = CorSigCompressData(callingconv, pbSig);
+
+ // copy over the fixed arg count
+ cbArgsNumberTemp = CorSigCompressData(cArgsIndex, &pbSig[cb]);
+
+ // copy over the fixed args + ret type
+ memcpy(&pbSig[cb + cbArgsNumberTemp], &pvSigBlob[cbCalling + cbArgsNumber], cbTotal);
+
+ErrExit:
+ return hr;
+}
+
+
+#endif // !SOS_INCLUDE
diff --git a/src/inc/corhlprpriv.h b/src/inc/corhlprpriv.h
new file mode 100644
index 0000000000..73b89951dd
--- /dev/null
+++ b/src/inc/corhlprpriv.h
@@ -0,0 +1,773 @@
+// 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.
+
+/*****************************************************************************
+ ** **
+ ** Corhlprpriv.h - **
+ ** **
+ *****************************************************************************/
+
+#ifndef __CORHLPRPRIV_H__
+#define __CORHLPRPRIV_H__
+
+#include "corhlpr.h"
+#include "fstring.h"
+
+#if defined(_MSC_VER) && defined(_TARGET_X86_)
+#pragma optimize("y", on) // If routines don't get inlined, don't pay the EBP frame penalty
+#endif
+
+//*****************************************************************************
+//
+//***** Utility helpers
+//
+//*****************************************************************************
+
+#ifndef SOS_INCLUDE
+
+//*****************************************************************************
+//
+// **** CQuickBytes
+// This helper class is useful for cases where 90% of the time you allocate 512
+// or less bytes for a data structure. This class contains a 512 byte buffer.
+// Alloc() will return a pointer to this buffer if your allocation is small
+// enough, otherwise it asks the heap for a larger buffer which is freed for
+// you. No mutex locking is required for the small allocation case, making the
+// code run faster, less heap fragmentation, etc... Each instance will allocate
+// 520 bytes, so use accordinly.
+//
+//*****************************************************************************
+namespace NSQuickBytesHelper
+{
+ template <BOOL bThrow>
+ struct _AllocBytes;
+
+ template <>
+ struct _AllocBytes<TRUE>
+ {
+ static BYTE *Invoke(SIZE_T iItems)
+ {
+ return NEW_THROWS(iItems);
+ }
+ };
+
+ template <>
+ struct _AllocBytes<FALSE>
+ {
+ static BYTE *Invoke(SIZE_T iItems)
+ {
+ return NEW_NOTHROW(iItems);
+ }
+ };
+};
+
+void DECLSPEC_NORETURN ThrowHR(HRESULT hr);
+
+template <SIZE_T SIZE, SIZE_T INCREMENT>
+class CQuickMemoryBase
+{
+protected:
+ template <typename ELEM_T>
+ static ELEM_T Min(ELEM_T a, ELEM_T b)
+ { return a < b ? a : b; }
+
+ template <typename ELEM_T>
+ static ELEM_T Max(ELEM_T a, ELEM_T b)
+ { return a < b ? b : a; }
+
+ // bGrow - indicates that this is a resize and that the original data
+ // needs to be copied over.
+ // bThrow - indicates whether or not memory allocations will throw.
+ template <BOOL bGrow, BOOL bThrow>
+ void *_Alloc(SIZE_T iItems)
+ {
+#if defined(_BLD_CLR) && defined(_DEBUG)
+ { // Exercise heap for OOM-fault injection purposes
+ BYTE * pb = NSQuickBytesHelper::_AllocBytes<bThrow>::Invoke(iItems);
+ _ASSERTE(!bThrow || pb != NULL); // _AllocBytes would have thrown if bThrow == TRUE
+ if (pb == NULL) return NULL; // bThrow == FALSE and we failed to allocate memory
+ delete [] pb; // Success, delete allocated memory.
+ }
+#endif
+ if (iItems <= cbTotal)
+ { // Fits within existing memory allocation
+ iSize = iItems;
+ }
+ else if (iItems <= SIZE)
+ { // Will fit in internal buffer.
+ if (pbBuff == NULL)
+ { // Any previous allocation is in the internal buffer and the new
+ // allocation fits in the internal buffer, so just update the size.
+ iSize = iItems;
+ cbTotal = SIZE;
+ }
+ else
+ { // There was a previous allocation, sitting in pbBuff
+ if (bGrow)
+ { // If growing, need to copy any existing data over.
+ memcpy(&rgData[0], pbBuff, Min(cbTotal, SIZE));
+ }
+
+ delete [] pbBuff;
+ pbBuff = NULL;
+ iSize = iItems;
+ cbTotal = SIZE;
+ }
+ }
+ else
+ { // Need to allocate a new buffer
+ SIZE_T cbTotalNew = iItems + (bGrow ? INCREMENT : 0);
+ BYTE * pbBuffNew = NSQuickBytesHelper::_AllocBytes<bThrow>::Invoke(cbTotalNew);
+
+ if (!bThrow && pbBuffNew == NULL)
+ { // Allocation failed. Zero out structure.
+ if (pbBuff != NULL)
+ { // Delete old buffer
+ delete [] pbBuff;
+ }
+ pbBuff = NULL;
+ iSize = 0;
+ cbTotal = 0;
+ return NULL;
+ }
+
+ if (bGrow && cbTotal > 0)
+ { // If growing, need to copy any existing data over.
+ memcpy(pbBuffNew, (BYTE *)Ptr(), Min(cbTotal, cbTotalNew));
+ }
+
+ if (pbBuff != NULL)
+ { // Delete old pre-existing buffer
+ delete [] pbBuff;
+ pbBuff = NULL;
+ }
+
+ pbBuff = pbBuffNew;
+ cbTotal = cbTotalNew;
+ iSize = iItems;
+ }
+
+ return Ptr();
+ }
+
+public:
+ void Init()
+ {
+ pbBuff = 0;
+ iSize = 0;
+ cbTotal = SIZE;
+ }
+
+ void Destroy()
+ {
+ if (pbBuff)
+ {
+ delete [] pbBuff;
+ pbBuff = 0;
+ }
+ }
+
+ void *AllocThrows(SIZE_T iItems)
+ {
+ return _Alloc<FALSE /*bGrow*/, TRUE /*bThrow*/>(iItems);
+ }
+
+ void *AllocNoThrow(SIZE_T iItems)
+ {
+ return _Alloc<FALSE /*bGrow*/, FALSE /*bThrow*/>(iItems);
+ }
+
+ void ReSizeThrows(SIZE_T iItems)
+ {
+ _Alloc<TRUE /*bGrow*/, TRUE /*bThrow*/>(iItems);
+ }
+
+#ifdef __llvm__
+ // This makes sure that we will not get an undefined symbol
+ // when building a release version of libcoreclr using LLVM.
+ __attribute__((used))
+#endif // __llvm__
+ HRESULT ReSizeNoThrow(SIZE_T iItems);
+
+ void Shrink(SIZE_T iItems)
+ {
+ _ASSERTE(iItems <= cbTotal);
+ iSize = iItems;
+ }
+
+ operator PVOID()
+ {
+ return ((pbBuff) ? pbBuff : (PVOID)&rgData[0]);
+ }
+
+ void *Ptr()
+ {
+ return ((pbBuff) ? pbBuff : (PVOID)&rgData[0]);
+ }
+
+ const void *Ptr() const
+ {
+ return ((pbBuff) ? pbBuff : (PVOID)&rgData[0]);
+ }
+
+ SIZE_T Size() const
+ {
+ return (iSize);
+ }
+
+ SIZE_T MaxSize() const
+ {
+ return (cbTotal);
+ }
+
+ void Maximize()
+ {
+ iSize = cbTotal;
+ }
+
+
+ // Convert UTF8 string to UNICODE string, optimized for speed
+ HRESULT ConvertUtf8_UnicodeNoThrow(const char * utf8str)
+ {
+ bool allAscii;
+ DWORD length;
+
+ HRESULT hr = FString::Utf8_Unicode_Length(utf8str, & allAscii, & length);
+
+ if (SUCCEEDED(hr))
+ {
+ LPWSTR buffer = (LPWSTR) AllocNoThrow((length + 1) * sizeof(WCHAR));
+
+ if (buffer == NULL)
+ {
+ hr = E_OUTOFMEMORY;
+ }
+ else
+ {
+ hr = FString::Utf8_Unicode(utf8str, allAscii, buffer, length);
+ }
+ }
+
+ return hr;
+ }
+
+ // Convert UTF8 string to UNICODE string, optimized for speed
+ void ConvertUtf8_Unicode(const char * utf8str)
+ {
+ bool allAscii;
+ DWORD length;
+
+ HRESULT hr = FString::Utf8_Unicode_Length(utf8str, & allAscii, & length);
+
+ if (SUCCEEDED(hr))
+ {
+ LPWSTR buffer = (LPWSTR) AllocThrows((length + 1) * sizeof(WCHAR));
+
+ hr = FString::Utf8_Unicode(utf8str, allAscii, buffer, length);
+ }
+
+ if (FAILED(hr))
+ {
+ ThrowHR(hr);
+ }
+ }
+
+ // Convert UNICODE string to UTF8 string, optimized for speed
+ void ConvertUnicode_Utf8(const WCHAR * pString)
+ {
+ bool allAscii;
+ DWORD length;
+
+ HRESULT hr = FString::Unicode_Utf8_Length(pString, & allAscii, & length);
+
+ if (SUCCEEDED(hr))
+ {
+ LPSTR buffer = (LPSTR) AllocThrows((length + 1) * sizeof(char));
+
+ hr = FString::Unicode_Utf8(pString, allAscii, buffer, length);
+ }
+
+ if (FAILED(hr))
+ {
+ ThrowHR(hr);
+ }
+ }
+
+ // Copy single byte string and hold it
+ const char * SetStringNoThrow(const char * pStr, SIZE_T len)
+ {
+ LPSTR buffer = (LPSTR) AllocNoThrow(len + 1);
+
+ if (buffer != NULL)
+ {
+ memcpy(buffer, pStr, len);
+ buffer[len] = 0;
+ }
+
+ return buffer;
+ }
+
+#ifdef DACCESS_COMPILE
+ void
+ EnumMemoryRegions(CLRDataEnumMemoryFlags flags)
+ {
+ // Assume that 'this' is enumerated, either explicitly
+ // or because this class is embedded in another.
+ DacEnumMemoryRegion(dac_cast<TADDR>(pbBuff), iSize);
+ }
+#endif // DACCESS_COMPILE
+
+ BYTE *pbBuff;
+ SIZE_T iSize; // number of bytes used
+ SIZE_T cbTotal; // total bytes allocated in the buffer
+ // use UINT64 to enforce the alignment of the memory
+ UINT64 rgData[(SIZE+sizeof(UINT64)-1)/sizeof(UINT64)];
+};
+
+// These should be multiples of 8 so that data can be naturally aligned.
+#define CQUICKBYTES_BASE_SIZE 512
+#define CQUICKBYTES_INCREMENTAL_SIZE 128
+
+class CQuickBytesBase : public CQuickMemoryBase<CQUICKBYTES_BASE_SIZE, CQUICKBYTES_INCREMENTAL_SIZE>
+{
+};
+
+
+class CQuickBytes : public CQuickBytesBase
+{
+public:
+ CQuickBytes()
+ {
+ Init();
+ }
+
+ ~CQuickBytes()
+ {
+ Destroy();
+ }
+};
+
+/* to be used as static variable - no constructor/destructor, assumes zero
+ initialized memory */
+class CQuickBytesStatic : public CQuickBytesBase
+{
+};
+
+template <SIZE_T CQUICKBYTES_BASE_SPECIFY_SIZE>
+class CQuickBytesSpecifySizeBase : public CQuickMemoryBase<CQUICKBYTES_BASE_SPECIFY_SIZE, CQUICKBYTES_INCREMENTAL_SIZE>
+{
+};
+
+template <SIZE_T CQUICKBYTES_BASE_SPECIFY_SIZE>
+class CQuickBytesSpecifySize : public CQuickBytesSpecifySizeBase<CQUICKBYTES_BASE_SPECIFY_SIZE>
+{
+public:
+ CQuickBytesSpecifySize()
+ {
+ this->Init();
+ }
+
+ ~CQuickBytesSpecifySize()
+ {
+ this->Destroy();
+ }
+};
+
+/* to be used as static variable - no constructor/destructor, assumes zero
+ initialized memory */
+template <SIZE_T CQUICKBYTES_BASE_SPECIFY_SIZE>
+class CQuickBytesSpecifySizeStatic : public CQuickBytesSpecifySizeBase<CQUICKBYTES_BASE_SPECIFY_SIZE>
+{
+};
+
+template <class T> class CQuickArrayBase : public CQuickBytesBase
+{
+public:
+ T* AllocThrows(SIZE_T iItems)
+ {
+ CheckOverflowThrows(iItems);
+ return (T*)CQuickBytesBase::AllocThrows(iItems * sizeof(T));
+ }
+
+ void ReSizeThrows(SIZE_T iItems)
+ {
+ CheckOverflowThrows(iItems);
+ CQuickBytesBase::ReSizeThrows(iItems * sizeof(T));
+ }
+
+ T* AllocNoThrow(SIZE_T iItems)
+ {
+ if (!CheckOverflowNoThrow(iItems))
+ {
+ return NULL;
+ }
+ return (T*)CQuickBytesBase::AllocNoThrow(iItems * sizeof(T));
+ }
+
+ HRESULT ReSizeNoThrow(SIZE_T iItems)
+ {
+ if (!CheckOverflowNoThrow(iItems))
+ {
+ return E_OUTOFMEMORY;
+ }
+ return CQuickBytesBase::ReSizeNoThrow(iItems * sizeof(T));
+ }
+
+ void Shrink(SIZE_T iItems)
+ {
+ CQuickBytesBase::Shrink(iItems * sizeof(T));
+ }
+
+ T* Ptr()
+ {
+ return (T*) CQuickBytesBase::Ptr();
+ }
+
+ const T* Ptr() const
+ {
+ return (T*) CQuickBytesBase::Ptr();
+ }
+
+ SIZE_T Size() const
+ {
+ return CQuickBytesBase::Size() / sizeof(T);
+ }
+
+ SIZE_T MaxSize() const
+ {
+ return CQuickBytesBase::cbTotal / sizeof(T);
+ }
+
+ T& operator[] (SIZE_T ix)
+ {
+ _ASSERTE(ix < Size());
+ return *(Ptr() + ix);
+ }
+
+ const T& operator[] (SIZE_T ix) const
+ {
+ _ASSERTE(ix < Size());
+ return *(Ptr() + ix);
+ }
+
+private:
+ inline
+ BOOL CheckOverflowNoThrow(SIZE_T iItems)
+ {
+ SIZE_T totalSize = iItems * sizeof(T);
+
+ if (totalSize / sizeof(T) != iItems)
+ {
+ return FALSE;
+ }
+
+ return TRUE;
+ }
+
+ inline
+ void CheckOverflowThrows(SIZE_T iItems)
+ {
+ if (!CheckOverflowNoThrow(iItems))
+ {
+ THROW_OUT_OF_MEMORY();
+ }
+ }
+};
+
+template <class T> class CQuickArray : public CQuickArrayBase<T>
+{
+public:
+ CQuickArray<T>()
+ {
+ this->Init();
+ }
+
+ ~CQuickArray<T>()
+ {
+ this->Destroy();
+ }
+};
+
+// This is actually more of a stack with array access. Essentially, you can
+// only add elements through Push and remove them through Pop, but you can
+// access and modify any random element with the index operator. You cannot
+// access elements that have not been added.
+
+template <class T>
+class CQuickArrayList : protected CQuickArray<T>
+{
+private:
+ SIZE_T m_curSize;
+
+public:
+ // Make these specific functions public.
+ using CQuickArray<T>::AllocThrows;
+ using CQuickArray<T>::ReSizeThrows;
+ using CQuickArray<T>::AllocNoThrow;
+ using CQuickArray<T>::ReSizeNoThrow;
+ using CQuickArray<T>::MaxSize;
+
+ CQuickArrayList()
+ : m_curSize(0)
+ {
+ this->Init();
+ }
+
+ ~CQuickArrayList()
+ {
+ this->Destroy();
+ }
+
+ // Can only access values that have been pushed.
+ T& operator[] (SIZE_T ix)
+ {
+ _ASSERTE(ix < m_curSize);
+ return CQuickArray<T>::operator[](ix);
+ }
+
+ // Can only access values that have been pushed.
+ const T& operator[] (SIZE_T ix) const
+ {
+ _ASSERTE(ix < m_curSize);
+ return CQuickArray<T>::operator[](ix);
+ }
+
+ // THROWS: Resizes if necessary.
+ void Push(const T & value)
+ {
+ // Resize if necessary - thows.
+ if (m_curSize + 1 >= CQuickArray<T>::Size())
+ ReSizeThrows((m_curSize + 1) * 2);
+
+ // Append element to end of array.
+ _ASSERTE(m_curSize + 1 < CQuickArray<T>::Size());
+ SIZE_T ix = m_curSize++;
+ (*this)[ix] = value;
+ }
+
+ T Pop()
+ {
+ _ASSERTE(m_curSize > 0);
+ T retval = (*this)[m_curSize - 1];
+ INDEBUG(ZeroMemory(&(this->Ptr()[m_curSize - 1]), sizeof(T));)
+ --m_curSize;
+ return retval;
+ }
+
+ SIZE_T Size() const
+ {
+ return m_curSize;
+ }
+
+ void Shrink()
+ {
+ CQuickArray<T>::Shrink(m_curSize);
+ }
+};
+
+
+/* to be used as static variable - no constructor/destructor, assumes zero
+ initialized memory */
+template <class T> class CQuickArrayStatic : public CQuickArrayBase<T>
+{
+};
+
+typedef CQuickArrayBase<WCHAR> CQuickWSTRBase;
+typedef CQuickArray<WCHAR> CQuickWSTR;
+typedef CQuickArrayStatic<WCHAR> CQuickWSTRStatic;
+
+typedef CQuickArrayBase<CHAR> CQuickSTRBase;
+typedef CQuickArray<CHAR> CQuickSTR;
+typedef CQuickArrayStatic<CHAR> CQuickSTRStatic;
+
+class RidBitmap
+{
+public:
+ HRESULT InsertToken(mdToken token)
+ {
+ HRESULT hr = S_OK;
+ mdToken rid = RidFromToken(token);
+ SIZE_T index = rid / 8;
+ BYTE bit = (1 << (rid % 8));
+
+ if (index >= buffer.Size())
+ {
+ SIZE_T oldSize = buffer.Size();
+ SIZE_T newSize = index+1+oldSize/8;
+ IfFailRet(buffer.ReSizeNoThrow(newSize));
+ memset(&buffer[oldSize], 0, newSize-oldSize);
+ }
+
+ buffer[index] |= bit;
+ return hr;
+ }
+
+ bool IsTokenInBitmap(mdToken token)
+ {
+ mdToken rid = RidFromToken(token);
+ SIZE_T index = rid / 8;
+ BYTE bit = (1 << (rid % 8));
+
+ return ((index < buffer.Size()) && (buffer[index] & bit));
+ }
+
+ void Reset()
+ {
+ if (buffer.Size())
+ {
+ memset(&buffer[0], 0, buffer.Size());
+ }
+ }
+
+private:
+ CQuickArray<BYTE> buffer;
+};
+
+//*****************************************************************************
+//
+//***** Signature helpers
+//
+//*****************************************************************************
+
+HRESULT _CountBytesOfOneArg(
+ PCCOR_SIGNATURE pbSig,
+ ULONG *pcbTotal);
+
+HRESULT _GetFixedSigOfVarArg( // S_OK or error.
+ PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob of CLR signature
+ ULONG cbSigBlob, // [IN] size of signature
+ CQuickBytes *pqbSig, // [OUT] output buffer for fixed part of VarArg Signature
+ ULONG *pcbSigBlob); // [OUT] number of bytes written to the above output buffer
+
+#endif //!SOS_INCLUDE
+
+#if defined(_MSC_VER) && defined(_TARGET_X86_)
+#pragma optimize("", on) // restore command line default optimizations
+#endif
+
+
+//---------------------------------------------------------------------------------------
+//
+// Reads compressed integer from buffer pData, fills the result to *pnDataOut. Advances buffer pointer.
+// Doesn't read behind the end of the buffer (the end starts at pDataEnd).
+//
+inline
+__checkReturn
+HRESULT
+CorSigUncompressData_EndPtr(
+ PCCOR_SIGNATURE & pData, // [IN,OUT] Buffer
+ PCCOR_SIGNATURE pDataEnd, // End of buffer
+ DWORD * pnDataOut) // [OUT] Compressed integer read from the buffer
+{
+ _ASSERTE(pData <= pDataEnd);
+ HRESULT hr = S_OK;
+
+ INT_PTR cbDataSize = pDataEnd - pData;
+ if (cbDataSize > 4)
+ { // Compressed integer cannot be bigger than 4 bytes
+ cbDataSize = 4;
+ }
+ DWORD dwDataSize = (DWORD)cbDataSize;
+
+ ULONG cbDataOutLength;
+ IfFailRet(CorSigUncompressData(
+ pData,
+ dwDataSize,
+ pnDataOut,
+ &cbDataOutLength));
+ pData += cbDataOutLength;
+
+ return hr;
+} // CorSigUncompressData_EndPtr
+
+//---------------------------------------------------------------------------------------
+//
+// Reads CorElementType (1 byte) from buffer pData, fills the result to *pTypeOut. Advances buffer pointer.
+// Doesn't read behind the end of the buffer (the end starts at pDataEnd).
+//
+inline
+__checkReturn
+HRESULT
+CorSigUncompressElementType_EndPtr(
+ PCCOR_SIGNATURE & pData, // [IN,OUT] Buffer
+ PCCOR_SIGNATURE pDataEnd, // End of buffer
+ CorElementType * pTypeOut) // [OUT] ELEMENT_TYPE_* value read from the buffer
+{
+ _ASSERTE(pData <= pDataEnd);
+ // We don't expect pData > pDataEnd, but the runtime check doesn't cost much and it is more secure in
+ // case caller has a bug
+ if (pData >= pDataEnd)
+ { // No data
+ return META_E_BAD_SIGNATURE;
+ }
+ // Read 'type' as 1 byte
+ *pTypeOut = (CorElementType)*pData;
+ pData++;
+
+ return S_OK;
+} // CorSigUncompressElementType_EndPtr
+
+//---------------------------------------------------------------------------------------
+//
+// Reads pointer (4/8 bytes) from buffer pData, fills the result to *ppvPointerOut. Advances buffer pointer.
+// Doesn't read behind the end of the buffer (the end starts at pDataEnd).
+//
+inline
+__checkReturn
+HRESULT
+CorSigUncompressPointer_EndPtr(
+ PCCOR_SIGNATURE & pData, // [IN,OUT] Buffer
+ PCCOR_SIGNATURE pDataEnd, // End of buffer
+ void ** ppvPointerOut) // [OUT] Pointer value read from the buffer
+{
+ _ASSERTE(pData <= pDataEnd);
+ // We could just skip this check as pointers should be only in trusted (and therefore correct)
+ // signatures and we check for that on the caller side, but it won't hurt to have this check and it will
+ // make it easier to catch invalid signatures in trusted code (e.g. IL stubs, NGEN images, etc.)
+ if (pData + sizeof(void *) > pDataEnd)
+ { // Not enough data in the buffer
+ _ASSERTE(!"This signature is invalid. Note that caller should check that it is not comming from untrusted source!");
+ return META_E_BAD_SIGNATURE;
+ }
+ *ppvPointerOut = *(void * UNALIGNED *)pData;
+ pData += sizeof(void *);
+
+ return S_OK;
+} // CorSigUncompressPointer_EndPtr
+
+//---------------------------------------------------------------------------------------
+//
+// Reads compressed TypeDef/TypeRef/TypeSpec token, fills the result to *pnDataOut. Advances buffer pointer.
+// Doesn't read behind the end of the buffer (the end starts at pDataEnd).
+//
+inline
+__checkReturn
+HRESULT
+CorSigUncompressToken_EndPtr(
+ PCCOR_SIGNATURE & pData, // [IN,OUT] Buffer
+ PCCOR_SIGNATURE pDataEnd, // End of buffer
+ mdToken * ptkTokenOut) // [OUT] Token read from the buffer
+{
+ _ASSERTE(pData <= pDataEnd);
+ HRESULT hr = S_OK;
+
+ INT_PTR cbDataSize = pDataEnd - pData;
+ if (cbDataSize > 4)
+ { // Compressed token cannot be bigger than 4 bytes
+ cbDataSize = 4;
+ }
+ DWORD dwDataSize = (DWORD)cbDataSize;
+
+ ULONG cbTokenOutLength;
+ IfFailRet(CorSigUncompressToken(
+ pData,
+ dwDataSize,
+ ptkTokenOut,
+ &cbTokenOutLength));
+ pData += cbTokenOutLength;
+
+ return hr;
+} // CorSigUncompressToken_EndPtr
+
+#endif // __CORHLPRPRIV_H__
diff --git a/src/inc/corhost.h b/src/inc/corhost.h
new file mode 100644
index 0000000000..579088ca61
--- /dev/null
+++ b/src/inc/corhost.h
@@ -0,0 +1,1188 @@
+// 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.
+//
+
+//
+//*****************************************************************************
+// CorHost.h
+//
+// Class factories are used by the pluming in COM to activate new objects.
+// This module contains the class factory code to instantiate the debugger
+// objects described in <cordb.h>.
+//
+//*****************************************************************************
+
+#ifndef __CorHost__h__
+#define __CorHost__h__
+
+
+#include "windows.h" // worth to include before mscoree.h so we are guaranteed to pick few definitions
+#ifdef CreateSemaphore
+#undef CreateSemaphore
+#endif
+
+#include "mscoree.h"
+
+#include "clrinternal.h"
+
+#include "ivehandler.h"
+#include "ivalidator.h"
+#ifdef FEATURE_FUSION
+#include "fusion.h"
+#endif
+#include "holder.h"
+
+#include "clrprivhosting.h"
+
+#ifdef FEATURE_COMINTEROP
+#include "activation.h" // WinRT activation.
+#endif
+
+class DangerousNonHostedSpinLock;
+
+#define INVALID_STACK_BASE_MARKER_FOR_CHECK_STATE 2
+
+class AppDomain;
+class Assembly;
+
+#if !defined(FEATURE_CORECLR)
+class CorThreadpool : public ICorThreadpool
+{
+public:
+ HRESULT STDMETHODCALLTYPE CorRegisterWaitForSingleObject(PHANDLE phNewWaitObject,
+ HANDLE hWaitObject,
+ WAITORTIMERCALLBACK Callback,
+ PVOID Context,
+ ULONG timeout,
+ BOOL executeOnlyOnce,
+ BOOL* pResult);
+
+ HRESULT STDMETHODCALLTYPE CorBindIoCompletionCallback(HANDLE fileHandle, LPOVERLAPPED_COMPLETION_ROUTINE callback);
+
+ HRESULT STDMETHODCALLTYPE CorUnregisterWait(HANDLE hWaitObject,HANDLE CompletionEvent, BOOL* pResult);
+
+ HRESULT STDMETHODCALLTYPE CorQueueUserWorkItem(LPTHREAD_START_ROUTINE Function,PVOID Context,BOOL executeOnlyOnce, BOOL* pResult );
+
+ HRESULT STDMETHODCALLTYPE CorCallOrQueueUserWorkItem(LPTHREAD_START_ROUTINE Function,PVOID Context,BOOL* pResult );
+
+ HRESULT STDMETHODCALLTYPE CorCreateTimer(PHANDLE phNewTimer,
+ WAITORTIMERCALLBACK Callback,
+ PVOID Parameter,
+ DWORD DueTime,
+ DWORD Period,
+ BOOL* pResult);
+
+ HRESULT STDMETHODCALLTYPE CorDeleteTimer(HANDLE Timer, HANDLE CompletionEvent, BOOL* pResult);
+
+ HRESULT STDMETHODCALLTYPE CorChangeTimer(HANDLE Timer,ULONG DueTime,ULONG Period, BOOL* pResult);
+
+ HRESULT STDMETHODCALLTYPE CorSetMaxThreads(DWORD MaxWorkerThreads,
+ DWORD MaxIOCompletionThreads);
+
+ HRESULT STDMETHODCALLTYPE CorGetMaxThreads(DWORD *MaxWorkerThreads,
+ DWORD *MaxIOCompletionThreads);
+
+ HRESULT STDMETHODCALLTYPE CorGetAvailableThreads(DWORD *AvailableWorkerThreads,
+ DWORD *AvailableIOCompletionThreads);
+};
+
+class CorGCHost : public IGCHost2
+{
+public:
+ // IGCHost
+ STDMETHODIMP STDMETHODCALLTYPE SetGCStartupLimits(
+ DWORD SegmentSize,
+ DWORD MaxGen0Size);
+
+ STDMETHODIMP STDMETHODCALLTYPE Collect(
+ LONG Generation);
+
+ STDMETHODIMP STDMETHODCALLTYPE GetStats(
+ COR_GC_STATS *pStats);
+
+ STDMETHODIMP STDMETHODCALLTYPE GetThreadStats(
+ DWORD *pFiberCookie,
+ COR_GC_THREAD_STATS *pStats);
+
+ STDMETHODIMP STDMETHODCALLTYPE SetVirtualMemLimit(
+ SIZE_T sztMaxVirtualMemMB);
+
+ // IGCHost2
+ STDMETHODIMP STDMETHODCALLTYPE SetGCStartupLimitsEx(
+ SIZE_T SegmentSize,
+ SIZE_T MaxGen0Size);
+
+private:
+
+ HRESULT _SetGCSegmentSize(SIZE_T SegmentSize);
+ HRESULT _SetGCMaxGen0Size(SIZE_T MaxGen0Size);
+};
+
+class CorConfiguration : public ICorConfiguration
+{
+public:
+ virtual HRESULT STDMETHODCALLTYPE SetGCThreadControl(
+ /* [in] */ IGCThreadControl __RPC_FAR *pGCThreadControl);
+
+ virtual HRESULT STDMETHODCALLTYPE SetGCHostControl(
+ /* [in] */ IGCHostControl __RPC_FAR *pGCHostControl);
+
+ virtual HRESULT STDMETHODCALLTYPE SetDebuggerThreadControl(
+ /* [in] */ IDebuggerThreadControl __RPC_FAR *pDebuggerThreadControl);
+
+ virtual HRESULT STDMETHODCALLTYPE AddDebuggerSpecialThread(
+ /* [in] */ DWORD dwSpecialThreadId);
+
+ // This mechanism isn't thread-safe with respect to reference counting, because
+ // the runtime will use the cached pointer without adding extra refcounts to protect
+ // itself. So if one thread calls GetGCThreadControl & another thread calls
+ // ICorHost::SetGCThreadControl, we have a race.
+ static IGCThreadControl *GetGCThreadControl()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ return m_CachedGCThreadControl;
+ }
+
+ static IGCHostControl *GetGCHostControl()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ return m_CachedGCHostControl;
+ }
+
+ static IDebuggerThreadControl *GetDebuggerThreadControl()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ return m_CachedDebuggerThreadControl;
+ }
+
+ static DWORD GetDebuggerSpecialThreadCount()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ return m_DSTCount;
+ }
+
+ static DWORD *GetDebuggerSpecialThreadArray()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ return m_DSTArray;
+ }
+
+ // Helper function that returns true if the thread is in the debugger special thread list
+ static BOOL IsDebuggerSpecialThread(DWORD dwThreadId);
+
+ // Helper function to update the thread list in the debugger control block
+ static HRESULT RefreshDebuggerSpecialThreadList();
+
+ // Clean up debugger thread control object, called at shutdown
+ static void CleanupDebuggerThreadControl();
+
+private:
+ // Cache the IGCThreadControl interface until the EE is started, at which point
+ // we pass it through.
+ static IGCThreadControl *m_CachedGCThreadControl;
+ static IGCHostControl *m_CachedGCHostControl;
+ static IDebuggerThreadControl *m_CachedDebuggerThreadControl;
+
+ // Array of ID's of threads that should be considered "special" to
+ // the debugging services.
+ static DWORD *m_DSTArray;
+ static DWORD m_DSTArraySize;
+ static DWORD m_DSTCount;
+};
+
+class CorValidator : public IValidator
+{
+protected:
+ CorValidator() {LIMITED_METHOD_CONTRACT;}
+
+public:
+ STDMETHODIMP STDMETHODCALLTYPE Validate(
+ IVEHandler *veh,
+ IUnknown *pAppDomain,
+ unsigned long ulFlags,
+ unsigned long ulMaxError,
+ unsigned long token,
+ __in_z LPWSTR fileName,
+ BYTE *pe,
+ unsigned long ulSize);
+
+ STDMETHODIMP STDMETHODCALLTYPE FormatEventInfo(
+ HRESULT hVECode,
+ VEContext Context,
+ __out_ecount(ulMaxLength) LPWSTR msg,
+ unsigned long ulMaxLength,
+ SAFEARRAY *psa);
+};
+
+class CLRValidator : public ICLRValidator
+{
+protected:
+ CLRValidator() {LIMITED_METHOD_CONTRACT;}
+
+public:
+ STDMETHODIMP STDMETHODCALLTYPE Validate(
+ IVEHandler *veh,
+ unsigned long ulAppDomainId,
+ unsigned long ulFlags,
+ unsigned long ulMaxError,
+ unsigned long token,
+ __in_z LPWSTR fileName,
+ BYTE *pe,
+ unsigned long ulSize);
+
+ STDMETHODIMP STDMETHODCALLTYPE FormatEventInfo(
+ HRESULT hVECode,
+ VEContext Context,
+ __out_ecount(ulMaxLength) LPWSTR msg,
+ unsigned long ulMaxLength,
+ SAFEARRAY *psa);
+};
+
+class CorDebuggerInfo : public IDebuggerInfo
+{
+public:
+ STDMETHODIMP IsDebuggerAttached(BOOL *pbAttached);
+};
+#endif // !defined(FEATURE_CORECLR)
+
+class CorExecutionManager
+ : public ICLRExecutionManager
+{
+public:
+ CorExecutionManager();
+
+ STDMETHODIMP STDMETHODCALLTYPE Pause(DWORD dwAppDomainId, DWORD dwFlags);
+ STDMETHODIMP STDMETHODCALLTYPE Resume(DWORD dwAppDomainId);
+
+private:
+ DWORD m_dwFlags; //flags passed to the last Pause call.
+ INT64 m_pauseStartTime;
+};
+
+class CorRuntimeHostBase
+{
+protected:
+ CorRuntimeHostBase()
+ :m_Started(FALSE),
+ m_cRef(0)
+#ifdef FEATURE_CORECLR
+ , m_fStarted(FALSE)
+#endif // FEATURE_CORECLR
+ {LIMITED_METHOD_CONTRACT;}
+
+ STDMETHODIMP_(ULONG) AddRef(void);
+
+ // Starts the runtime. This is equivalent to CoInitializeCor()
+ STDMETHODIMP Start();
+
+#ifdef FEATURE_COMINTEROP
+ // Creates a domain in the runtime. The identity array is
+ // a pointer to an array TYPE containing IIdentity objects defining
+ // the security identity.
+ STDMETHODIMP CreateDomain(LPCWSTR pwzFriendlyName, // Optional
+ IUnknown* pIdentityArray, // Optional
+ IUnknown ** pAppDomain);
+
+ // Returns the default domain.
+ STDMETHODIMP GetDefaultDomain(IUnknown ** pAppDomain);
+
+ // Enumerate currently existing domains.
+ STDMETHODIMP EnumDomains(HDOMAINENUM *hEnum);
+
+ // Returns S_FALSE when there are no more domains. A domain
+ // is passed out only when S_OK is returned.
+ STDMETHODIMP NextDomain(HDOMAINENUM hEnum,
+ IUnknown** pAppDomain);
+
+ // Close the enumeration releasing resources
+ STDMETHODIMP CloseEnum(HDOMAINENUM hEnum);
+
+ STDMETHODIMP CreateDomainEx(LPCWSTR pwzFriendlyName,
+ IUnknown* pSetup, // Optional
+ IUnknown* pEvidence, // Optional
+ IUnknown ** pAppDomain);
+
+ // Create appdomain setup object that can be passed into CreateDomainEx
+ STDMETHODIMP CreateDomainSetup(IUnknown** pAppDomainSetup);
+
+ // Create Evidence object that can be passed into CreateDomainEx
+ STDMETHODIMP CreateEvidence(IUnknown** pEvidence);
+
+ // Unload a domain, releasing the reference will only release the
+ // the wrapper to the domain not unload the domain.
+ STDMETHODIMP UnloadDomain(IUnknown* pAppDomain);
+
+ // Returns the threads domain if there is one.
+ STDMETHODIMP CurrentDomain(IUnknown ** pAppDomain);
+#endif // FEATURE_COMINTEROP
+
+ STDMETHODIMP MapFile( // Return code.
+ HANDLE hFile, // [in] Handle for file
+ HMODULE *hMapAddress // [out] HINSTANCE for mapped file
+ );
+
+ STDMETHODIMP LocksHeldByLogicalThread( // Return code.
+ DWORD *pCount // [out] Number of locks that the current thread holds.
+ );
+
+protected:
+ BOOL m_Started; // Has START been called?
+
+ LONG m_cRef; // Ref count.
+
+#ifdef FEATURE_CORECLR
+ // This flag will be used to ensure that a CoreCLR host can invoke Start/Stop in pairs only.
+ BOOL m_fStarted;
+ BOOL m_fAppDomainCreated; // this flag is used when an appdomain can only create a single appdomain
+#endif // FEATURE_CORECLR
+
+ static ULONG m_Version; // Version of ICorRuntimeHost.
+ // Some functions are only available in ICLRRuntimeHost.
+ // Some functions are no-op in ICLRRuntimeHost.
+
+ STDMETHODIMP UnloadAppDomain(DWORD dwDomainId, BOOL fWaitUntilDone);
+
+public:
+ static ULONG GetHostVersion()
+ {
+ LIMITED_METHOD_CONTRACT;
+ _ASSERTE (m_Version != 0);
+ return m_Version;
+ }
+
+};
+
+#if !defined(FEATURE_CORECLR) // simple hosting
+class CorHost :
+ public CorRuntimeHostBase, public ICorRuntimeHost, public CorThreadpool
+ , public CorGCHost, public CorConfiguration
+ , public CorValidator, public CorDebuggerInfo
+ , public CorExecutionManager
+{
+public:
+ CorHost() {WRAPPER_NO_CONTRACT;}
+
+ // *** IUnknown methods ***
+ STDMETHODIMP QueryInterface(REFIID riid, void** ppv);
+ STDMETHODIMP_(ULONG) AddRef(void)
+ {
+ WRAPPER_NO_CONTRACT;
+ STATIC_CONTRACT_SO_TOLERANT;
+ return CorRuntimeHostBase::AddRef();
+ }
+ STDMETHODIMP_(ULONG) Release(void);
+
+
+ // *** ICorRuntimeHost methods ***
+ // Returns an object for configuring the runtime prior to
+ // it starting. If the runtime has been initialized this
+ // routine returns an error. See ICorConfiguration.
+ STDMETHODIMP GetConfiguration(ICorConfiguration** pConfiguration);
+
+
+ // Starts the runtime. This is equivalent to CoInitializeCor();
+ STDMETHODIMP Start(void);
+
+ STDMETHODIMP Stop();
+
+ // Creates a domain in the runtime. The identity array is
+ // a pointer to an array TYPE containing IIdentity objects defining
+ // the security identity.
+ STDMETHODIMP CreateDomain(LPCWSTR pwzFriendlyName, // Optional
+ IUnknown* pIdentityArray, // Optional
+ IUnknown ** pAppDomain)
+ {
+ WRAPPER_NO_CONTRACT;
+ STATIC_CONTRACT_SO_TOLERANT;
+ return CorRuntimeHostBase::CreateDomain(pwzFriendlyName,pIdentityArray,pAppDomain);
+ }
+
+ // Returns the default domain.
+ STDMETHODIMP GetDefaultDomain(IUnknown ** pAppDomain)
+ {
+ WRAPPER_NO_CONTRACT;
+ STATIC_CONTRACT_SO_TOLERANT;
+ return CorRuntimeHostBase::GetDefaultDomain(pAppDomain);
+ }
+
+ // Enumerate currently existing domains.
+ STDMETHODIMP EnumDomains(HDOMAINENUM *hEnum)
+ {
+ WRAPPER_NO_CONTRACT;
+ STATIC_CONTRACT_SO_TOLERANT;
+ return CorRuntimeHostBase::EnumDomains(hEnum);
+ }
+
+ // Returns S_FALSE when there are no more domains. A domain
+ // is passed out only when S_OK is returned.
+ STDMETHODIMP NextDomain(HDOMAINENUM hEnum,
+ IUnknown** pAppDomain)
+ {
+ WRAPPER_NO_CONTRACT;
+ STATIC_CONTRACT_SO_TOLERANT;
+ return CorRuntimeHostBase::NextDomain(hEnum,pAppDomain);
+ }
+
+ // Close the enumeration releasing resources
+ STDMETHODIMP CloseEnum(HDOMAINENUM hEnum)
+ {
+ WRAPPER_NO_CONTRACT;
+ STATIC_CONTRACT_SO_TOLERANT;
+ return CorRuntimeHostBase::CloseEnum(hEnum);
+ }
+
+ STDMETHODIMP CreateDomainEx(LPCWSTR pwzFriendlyName,
+ IUnknown* pSetup, // Optional
+ IUnknown* pEvidence, // Optional
+ IUnknown ** pAppDomain)
+ {
+ WRAPPER_NO_CONTRACT;
+ STATIC_CONTRACT_SO_TOLERANT;
+ return CorRuntimeHostBase::CreateDomainEx(pwzFriendlyName,pSetup,pEvidence,pAppDomain);
+ }
+
+ // Create appdomain setup object that can be passed into CreateDomainEx
+ STDMETHODIMP CreateDomainSetup(IUnknown** pAppDomainSetup)
+ {
+ WRAPPER_NO_CONTRACT;
+ STATIC_CONTRACT_SO_TOLERANT;
+ return CorRuntimeHostBase::CreateDomainSetup(pAppDomainSetup);
+ }
+
+ // Create Evidence object that can be passed into CreateDomainEx
+ STDMETHODIMP CreateEvidence(IUnknown** pEvidence)
+ {
+ WRAPPER_NO_CONTRACT;
+ STATIC_CONTRACT_SO_TOLERANT;
+ return CorRuntimeHostBase::CreateEvidence(pEvidence);
+ }
+
+ // Unload a domain, releasing the reference will only release the
+ // the wrapper to the domain not unload the domain.
+ STDMETHODIMP UnloadDomain(IUnknown* pAppDomain)
+ {
+ WRAPPER_NO_CONTRACT;
+ STATIC_CONTRACT_SO_TOLERANT;
+ return CorRuntimeHostBase::UnloadDomain(pAppDomain);
+ }
+
+ // Returns the threads domain if there is one.
+ STDMETHODIMP CurrentDomain(IUnknown ** pAppDomain)
+ {
+ WRAPPER_NO_CONTRACT;
+ STATIC_CONTRACT_SO_TOLERANT;
+ return CorRuntimeHostBase::CurrentDomain(pAppDomain);
+ }
+
+ // TODO: Following 4 APIs should be move to CorHost for V1.
+ STDMETHODIMP CreateLogicalThreadState(); // Return code.
+ STDMETHODIMP DeleteLogicalThreadState(); // Return code.
+ STDMETHODIMP SwitchInLogicalThreadState( // Return code.
+ DWORD *pFiberCookie // [in] Cookie that indicates the fiber to use.
+ );
+
+ STDMETHODIMP SwitchOutLogicalThreadState( // Return code.
+ DWORD **pFiberCookie // [out] Cookie that indicates the fiber being switched out.
+ );
+
+ STDMETHODIMP LocksHeldByLogicalThread( // Return code.
+ DWORD *pCount // [out] Number of locks that the current thread holds.
+ )
+ {
+ WRAPPER_NO_CONTRACT;
+ STATIC_CONTRACT_SO_TOLERANT;
+ return CorRuntimeHostBase::LocksHeldByLogicalThread(pCount);
+ }
+
+ // Class factory hook-up.
+ static HRESULT CreateObject(REFIID riid, void **ppUnk);
+
+ STDMETHODIMP MapFile( // Return code.
+ HANDLE hFile, // [in] Handle for file
+ HMODULE *hMapAddress // [out] HINSTANCE for mapped file
+ )
+ {
+ WRAPPER_NO_CONTRACT;
+ STATIC_CONTRACT_SO_TOLERANT;
+ return CorRuntimeHostBase::MapFile(hFile,hMapAddress);
+ }
+};
+#endif // !defined(FEATURE_CORECLR)
+
+class ConnectionNameTable;
+typedef DPTR(class ConnectionNameTable) PTR_ConnectionNameTable;
+
+class CrstStatic;
+
+// Defines the precedence (in increading oder) of the two symbol reading knobs
+enum ESymbolReadingSetBy
+{
+ eSymbolReadingSetByDefault,
+ eSymbolReadingSetByConfig, // EEConfig - config file, env var, etc.
+ eSymbolReadingSetByHost, // Hosting API - highest precedence
+ eSymbolReadingSetBy_COUNT
+};
+
+#ifdef FEATURE_INCLUDE_ALL_INTERFACES
+// Hash table entry to keep track <connection, name> for SQL fiber support
+typedef DPTR(struct ConnectionNameHashEntry) PTR_ConnectionNameHashEntry;
+struct ConnectionNameHashEntry
+{
+ FREEHASHENTRY entry;
+ CONNID m_dwConnectionId;
+ PTR_WSTR m_pwzName;
+ ICLRTask **m_ppCLRTaskArray;
+ UINT m_CLRTaskCount;
+};
+
+
+class CCLRDebugManager : public ICLRDebugManager
+{
+public:
+ CCLRDebugManager() {LIMITED_METHOD_CONTRACT;};
+
+ STDMETHODIMP QueryInterface(REFIID riid, void** ppv);
+ STDMETHODIMP_(ULONG) AddRef(void)
+ {
+ LIMITED_METHOD_CONTRACT;
+ return 1;
+ }
+ STDMETHODIMP_(ULONG) Release(void);
+
+ // ICLRTDebugManager's interface
+ STDMETHODIMP BeginConnection(
+ CONNID dwConnectionId,
+ __in_z wchar_t *szConnectionName);
+ STDMETHODIMP SetConnectionTasks(
+ DWORD id,
+ DWORD dwCount,
+ ICLRTask **ppCLRTask);
+ STDMETHODIMP EndConnection(
+ CONNID dwConnectionId);
+
+ // Set ACL on shared section, events, and process
+ STDMETHODIMP SetDacl(PACL pacl);
+
+ // Returning the current ACL that CLR is using
+ STDMETHODIMP GetDacl(PACL *pacl);
+
+ STDMETHODIMP IsDebuggerAttached(BOOL *pbAttached);
+
+ // symbol reading policy - include file line info when getting a call stack etc.
+ STDMETHODIMP SetSymbolReadingPolicy(ESymbolReadingPolicy policy);
+
+#ifdef DACCESS_COMPILE
+ // Expose iterators for DAC. Debugger can use this on attach to find existing Connections.
+ //
+ // Example usage:
+ // HASHFIND h;
+ // ConnectionNameHashEntry * pConnection = FindFirst(&h);
+ // while(pConnection != NULL) {
+ // DoSomething(pConnection);
+ // pConnection = FindNext(&h);
+ // }
+ static ConnectionNameHashEntry * FindFirst(HASHFIND * pHashfind);
+ static ConnectionNameHashEntry * FindNext(HASHFIND * pHashfind);
+#endif
+
+ static void ProcessInit();
+ static void ProcessCleanup();
+
+ // Get the current symbol reading policy setting
+ static ESymbolReadingPolicy GetSymbolReadingPolicy()
+ {
+ return m_symbolReadingPolicy;
+ }
+
+ // Set the symbol reading policy if the setter has higher precendence than the current setting
+ static void SetSymbolReadingPolicy( ESymbolReadingPolicy policy, ESymbolReadingSetBy setBy );
+
+private:
+ static CrstStatic m_lockConnectionNameTable;
+ SPTR_DECL(ConnectionNameTable, m_pConnectionNameHash);
+
+ static ESymbolReadingPolicy m_symbolReadingPolicy;
+ static ESymbolReadingSetBy m_symbolReadingSetBy;
+};
+
+#endif // FEATURE_INCLUDE_ALL_INTERFACES
+
+#if defined(FEATURE_INCLUDE_ALL_INTERFACES) || defined(FEATURE_WINDOWSPHONE)
+class CCLRErrorReportingManager :
+#ifdef FEATURE_WINDOWSPHONE
+ public ICLRErrorReportingManager2
+#else
+ public ICLRErrorReportingManager
+#endif // FEATURE_WINDOWSPHONE
+{
+ friend class ClrDataAccess;
+ friend struct _DacGlobals;
+
+ SVAL_DECL(ECustomDumpFlavor, g_ECustomDumpFlavor);
+
+#ifdef FEATURE_WINDOWSPHONE
+ WCHAR* m_pApplicationId;
+ WCHAR* m_pInstanceId;
+
+ class BucketParamsCache
+ {
+ private:
+ WCHAR** m_pParams;
+ DWORD const m_cMaxParams;
+ public:
+ BucketParamsCache(DWORD maxNumParams);
+ ~BucketParamsCache();
+
+ WCHAR const* GetAt(BucketParameterIndex index);
+ HRESULT SetAt(BucketParameterIndex index, WCHAR const* val);
+ };
+
+ BucketParamsCache* m_pBucketParamsCache;
+
+ HRESULT CopyToDataCache(_In_ WCHAR** pTarget, WCHAR const* pSource);
+#endif // FEATURE_WINDOWSPHONE
+
+public:
+ CCLRErrorReportingManager();
+ ~CCLRErrorReportingManager();
+
+ STDMETHODIMP QueryInterface(REFIID riid, void** ppv);
+ STDMETHODIMP_(ULONG) AddRef(void);
+ STDMETHODIMP_(ULONG) Release(void);
+
+ // ICLRErrorReportingManager APIs //
+
+ // Get Watson bucket parameters for "current" exception (on calling thread).
+ STDMETHODIMP GetBucketParametersForCurrentException(BucketParameters *pParams);
+ STDMETHODIMP BeginCustomDump( ECustomDumpFlavor dwFlavor,
+ DWORD dwNumItems,
+ CustomDumpItem items[],
+ DWORD dwReserved);
+ STDMETHODIMP EndCustomDump();
+
+#ifdef FEATURE_WINDOWSPHONE
+ // ICLRErrorReportingManager2 APIs //
+
+ STDMETHODIMP SetApplicationData(ApplicationDataKey key, WCHAR const* pValue);
+ STDMETHODIMP SetBucketParametersForUnhandledException(BucketParameters const* pBucketParams, DWORD* pCountParams);
+
+ // internal APIs
+
+ // returns the application data for the specified key if available, else returns NULL.
+ WCHAR const* GetApplicationData(ApplicationDataKey key);
+
+ // returns bucket parameter override data if available, else returns NULL.
+ WCHAR const* GetBucketParamOverride(BucketParameterIndex bucketParamId);
+#endif // FEATURE_WINDOWSPHONE
+};
+
+extern CCLRErrorReportingManager g_CLRErrorReportingManager;
+#endif // defined(FEATURE_INCLUDE_ALL_INTERFACES) || defined(FEATURE_WINDOWSPHONE)
+
+#ifdef FEATURE_IPCMAN
+// @TODO:: a-meicht
+// consolidate the following class with DebuggerManager.
+//
+class CCLRSecurityAttributeManager
+{
+public:
+
+ // Set ACL on shared section, events, and process
+ STDMETHODIMP SetDACL(PACL pacl);
+
+ // Returning the current ACL that CLR is using
+ STDMETHODIMP GetDACL(PACL *pacl);
+
+ static void ProcessInit();
+ static void ProcessCleanUp();
+
+ // retrieving Host security attribute setting. If host does not set it, default to
+ // our default policy.
+ static HRESULT GetHostSecurityAttributes(SECURITY_ATTRIBUTES **ppSA);
+ static void DestroyHostSecurityAttributes(SECURITY_ATTRIBUTES *pSA);
+
+ static CrstStatic m_hostSAMutex;
+
+private:
+ static PACL m_pACL;
+
+ // Security attributes cached for the current process.
+ static SECURITY_ATTRIBUTES m_hostSA;
+ static SECURITY_DESCRIPTOR m_hostSD;
+
+ static HRESULT CopyACL(PACL pAclOriginal, PACL ppAclNew);
+};
+#endif // FEATURE_IPCMAN
+
+class CorHost2 :
+ public CorRuntimeHostBase
+#ifndef FEATURE_PAL
+ , public IPrivateManagedExceptionReporting /* This interface is for internal Watson testing only*/
+#endif // FEATURE_PAL
+#ifdef FEATURE_CORECLR
+ , public ICLRRuntimeHost2
+#else
+ , public CorThreadpool
+ , public CorGCHost
+ , public CorConfiguration
+ , public CLRValidator
+ , public CorDebuggerInfo
+ , public ICLRRuntimeHost
+ , public ICLRPrivRuntime
+#endif // FEATURE_CORECLR
+ , public CorExecutionManager
+{
+ friend struct _DacGlobals;
+
+public:
+ CorHost2();
+ virtual ~CorHost2() {}
+
+ // *** IUnknown methods ***
+ STDMETHODIMP QueryInterface(REFIID riid, void** ppv);
+ STDMETHODIMP_(ULONG) AddRef(void)
+ {
+ WRAPPER_NO_CONTRACT;
+ return CorRuntimeHostBase::AddRef();
+ }
+ STDMETHODIMP_(ULONG) Release(void);
+
+
+ // *** ICorRuntimeHost methods ***
+#ifndef FEATURE_CORECLR
+ // Returns an object for configuring the runtime prior to
+ // it starting. If the runtime has been initialized this
+ // routine returns an error. See ICorConfiguration.
+ STDMETHODIMP GetConfiguration(ICorConfiguration** pConfiguration);
+#endif // FEATURE_CORECLR
+
+#ifndef FEATURE_PAL
+ // defined in IPrivateManagedExceptionReporting interface for internal Watson testing only
+ STDMETHODIMP GetBucketParametersForCurrentException(BucketParameters *pParams);
+#endif // FEATURE_PAL
+
+ // Starts the runtime. This is equivalent to CoInitializeCor().
+ STDMETHODIMP Start();
+ STDMETHODIMP Stop();
+
+ STDMETHODIMP ExecuteInAppDomain(DWORD dwAppDomainId,
+ FExecuteInAppDomainCallback pCallback,
+ void * cookie);
+
+ STDMETHODIMP LocksHeldByLogicalThread( // Return code.
+ DWORD *pCount // [out] Number of locks that the current thread holds.
+ )
+ {
+ WRAPPER_NO_CONTRACT;
+ return CorRuntimeHostBase::LocksHeldByLogicalThread(pCount);
+ }
+
+ // Class factory hook-up.
+ static HRESULT CreateObject(REFIID riid, void **ppUnk);
+
+ STDMETHODIMP MapFile( // Return code.
+ HANDLE hFile, // [in] Handle for file
+ HMODULE *hMapAddress // [out] HINSTANCE for mapped file
+ )
+ {
+ WRAPPER_NO_CONTRACT;
+ return CorRuntimeHostBase::MapFile(hFile,hMapAddress);
+ }
+
+ STDMETHODIMP STDMETHODCALLTYPE SetHostControl(
+ IHostControl* pHostControl);
+
+ STDMETHODIMP STDMETHODCALLTYPE GetCLRControl(
+ ICLRControl** pCLRControl);
+
+ STDMETHODIMP UnloadAppDomain(DWORD dwDomainId, BOOL fWaitUntilDone);
+
+ STDMETHODIMP GetCurrentAppDomainId(DWORD *pdwAppDomainId);
+
+ STDMETHODIMP ExecuteApplication(LPCWSTR pwzAppFullName,
+ DWORD dwManifestPaths,
+ LPCWSTR *ppwzManifestPaths,
+ DWORD dwActivationData,
+ LPCWSTR *ppwzActivationData,
+ int *pReturnValue);
+
+ STDMETHODIMP ExecuteInDefaultAppDomain(LPCWSTR pwzAssemblyPath,
+ LPCWSTR pwzTypeName,
+ LPCWSTR pwzMethodName,
+ LPCWSTR pwzArgument,
+ DWORD *pReturnValue);
+
+#ifdef FEATURE_CORECLR
+ // *** ICLRRuntimeHost2 methods ***
+ STDMETHODIMP CreateAppDomainWithManager(
+ LPCWSTR wszFriendlyName,
+ DWORD dwSecurityFlags,
+ LPCWSTR wszAppDomainManagerAssemblyName,
+ LPCWSTR wszAppDomainManagerTypeName,
+ int nProperties,
+ LPCWSTR* pPropertyNames,
+ LPCWSTR* pPropertyValues,
+ DWORD* pAppDomainID);
+
+ STDMETHODIMP CreateDelegate(
+ DWORD appDomainID,
+ LPCWSTR wszAssemblyName,
+ LPCWSTR wszClassName,
+ LPCWSTR wszMethodName,
+ INT_PTR* fnPtr);
+
+ STDMETHODIMP Authenticate(ULONGLONG authKey);
+
+ STDMETHODIMP RegisterMacEHPort();
+ STDMETHODIMP SetStartupFlags(STARTUP_FLAGS flag);
+ STDMETHODIMP DllGetActivationFactory(
+ DWORD appDomainID,
+ LPCWSTR wszTypeName,
+ IActivationFactory ** factory);
+
+ STDMETHODIMP ExecuteAssembly(
+ DWORD dwAppDomainId,
+ LPCWSTR pwzAssemblyPath,
+ int argc,
+ LPCWSTR* argv,
+ DWORD* pReturnValue);
+
+#endif // !FEATURE_CORECLR
+
+#if !defined(FEATURE_CORECLR)
+ /**********************************************************************************
+ ** ICLRPrivRuntime Methods
+ **********************************************************************************/
+ STDMETHODIMP GetInterface(
+ REFCLSID rclsid,
+ REFIID riid,
+ LPVOID * ppUnk);
+
+ STDMETHODIMP CreateAppDomain(
+ LPCWSTR pwzFriendlyName,
+ ICLRPrivBinder * pBinder,
+ LPDWORD pdwAppDomainId);
+
+ STDMETHODIMP CreateDelegate(
+ DWORD appDomainID,
+ LPCWSTR wszAssemblyName,
+ LPCWSTR wszClassName,
+ LPCWSTR wszMethodName,
+ LPVOID * ppvDelegate);
+
+ STDMETHODIMP ExecuteMain(
+ ICLRPrivBinder * pBinder,
+ int * pRetVal);
+
+#endif // !FEATURE_CORECLR
+
+ static IHostControl *GetHostControl ()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+#ifdef FEATURE_CORECLR
+ return NULL;
+#else // FEATURE_CORECLR
+ return m_HostControl;
+#endif // FEATURE_CORECLR
+ }
+
+#ifdef FEATURE_INCLUDE_ALL_INTERFACES
+ static IHostMemoryManager *GetHostMemoryManager ()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+#ifdef FEATURE_CORECLR
+ return NULL;
+#else // FEATURE_CORECLR
+ return m_HostMemoryManager;
+#endif // FEATURE_CORECLR
+ }
+
+ static IHostMalloc *GetHostMalloc ()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+#ifdef FEATURE_CORECLR
+ return NULL;
+#else // FEATURE_CORECLR
+ return m_HostMalloc;
+#endif // FEATURE_CORECLR
+ }
+
+ static IHostTaskManager *GetHostTaskManager ()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+#ifdef FEATURE_CORECLR
+ return NULL;
+#else // FEATURE_CORECLR
+ return m_HostTaskManager;
+#endif // FEATURE_CORECLR
+ }
+
+ static IHostThreadpoolManager *GetHostThreadpoolManager ()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+#ifdef FEATURE_CORECLR
+ return NULL;
+#else // FEATURE_CORECLR
+ return m_HostThreadpoolManager;
+#endif // FEATURE_CORECLR
+ }
+
+ static IHostIoCompletionManager *GetHostIoCompletionManager ()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+#ifdef FEATURE_CORECLR
+ return NULL;
+#else // FEATURE_CORECLR
+ return m_HostIoCompletionManager;
+#endif // FEATURE_CORECLR
+ }
+
+ static IHostSyncManager *GetHostSyncManager ()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+#ifdef FEATURE_CORECLR
+ return NULL;
+#else // FEATURE_CORECLR
+ return m_HostSyncManager;
+#endif // FEATURE_CORECLR
+ }
+
+ static IHostAssemblyManager *GetHostAssemblyManager()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+#ifdef FEATURE_CORECLR
+ return NULL;
+#else // FEATURE_CORECLR
+ return m_HostAssemblyManager;
+#endif // FEATURE_CORECLR
+ }
+
+ static IHostGCManager *GetHostGCManager()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+#ifdef FEATURE_CORECLR
+ return NULL;
+#else // FEATURE_CORECLR
+ return m_HostGCManager;
+#endif // FEATURE_CORECLR
+ }
+
+ static IHostSecurityManager *GetHostSecurityManager()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+#ifdef FEATURE_CORECLR
+ return NULL;
+#else // FEATURE_CORECLR
+ return m_HostSecurityManager;
+#endif // FEATURE_CORECLR
+ }
+
+ static IHostPolicyManager *GetHostPolicyManager ()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+#ifdef FEATURE_CORECLR
+ return NULL;
+#else // FEATURE_CORECLR
+ return m_HostPolicyManager;
+#endif // FEATURE_CORECLR
+ }
+#endif // FEATURE_INCLUDE_ALL_INTERFACES
+
+ static int GetHostOverlappedExtensionSize()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+#ifdef FEATURE_CORECLR
+ return 0;
+#else // FEATURE_CORECLR
+ _ASSERTE (m_HostOverlappedExtensionSize != -1);
+ return m_HostOverlappedExtensionSize;
+#endif // FEATURE_CORECLR
+ }
+
+#ifdef FEATURE_INCLUDE_ALL_INTERFACES
+ static ICLRAssemblyReferenceList *GetHostDomainNeutralAsms()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+#ifdef FEATURE_CORECLR
+ return NULL;
+#else // FEATURE_CORECLR
+ return m_pHostDomainNeutralAsms;
+#endif // FEATURE_CORECLR
+ }
+#endif // FEATURE_INCLUDE_ALL_INTERFACES
+
+#ifndef FEATURE_CORECLR
+ static HRESULT SetFlagsAndHostConfig(STARTUP_FLAGS dwStartupFlags, LPCWSTR pwzHostConfigFile, BOOL fFinalize);
+ static LPCWSTR GetHostConfigFile();
+
+ static void GetDefaultAppDomainProperties(StringArrayList **ppPropertyNames, StringArrayList **ppPropertyValues);
+#endif // !FEATURE_CORECLR
+
+ static STARTUP_FLAGS GetStartupFlags();
+
+#ifndef FEATURE_CORECLR
+ static HRESULT SetPropertiesForDefaultAppDomain(DWORD nProperties,
+ __in_ecount(nProperties) LPCWSTR *pwszPropertyNames,
+ __in_ecount(nProperties) LPCWSTR *pwszPropertyValues);
+
+ static HRESULT SetAppDomainManagerType(LPCWSTR wszAppDomainManagerAssembly,
+ LPCWSTR wszAppDomainManagerType,
+ EInitializeNewDomainFlags dwInitializeDomainFlags);
+#endif // FEATURE_CORECLR
+
+ static LPCWSTR GetAppDomainManagerAsm();
+
+ static LPCWSTR GetAppDomainManagerType();
+
+ static EInitializeNewDomainFlags GetAppDomainManagerInitializeNewDomainFlags();
+
+ static BOOL HasAppDomainManagerInfo()
+ {
+ LIMITED_METHOD_CONTRACT;
+ return GetAppDomainManagerAsm() != NULL && GetAppDomainManagerType() != NULL;
+ }
+
+ static BOOL HasStarted()
+ {
+ return m_RefCount != 0;
+ }
+
+ static BOOL IsLoadFromBlocked(); // LoadFrom, LoadFile and Load(byte[]) are blocked in certain hosting scenarios
+
+private:
+#ifdef FEATURE_CORECLR
+ // This flag indicates if this instance was the first to load and start CoreCLR
+ BOOL m_fFirstToLoadCLR;
+
+ // This flag indicates if the host has authenticated with us or not
+ BOOL m_fIsHostAuthenticated;
+
+#endif // FEATURE_CORECLR
+
+ // Helpers for both ICLRRuntimeHost2 and ICLRPrivRuntime
+ HRESULT _CreateAppDomain(
+ LPCWSTR wszFriendlyName,
+ DWORD dwFlags,
+ LPCWSTR wszAppDomainManagerAssemblyName,
+ LPCWSTR wszAppDomainManagerTypeName,
+ int nProperties,
+ LPCWSTR* pPropertyNames,
+ LPCWSTR* pPropertyValues,
+#if !defined(FEATURE_CORECLR)
+ ICLRPrivBinder* pBinder,
+#endif
+ DWORD* pAppDomainID);
+
+ HRESULT _CreateDelegate(
+ DWORD appDomainID,
+ LPCWSTR wszAssemblyName,
+ LPCWSTR wszClassName,
+ LPCWSTR wszMethodName,
+ INT_PTR* fnPtr);
+
+ // entrypoint helper to be wrapped in a filter to process unhandled exceptions
+ VOID ExecuteMainInner(Assembly* pRootAssembly);
+
+ static LONG m_RefCount;
+
+ static IHostControl *m_HostControl;
+
+ static LPCWSTR s_wszAppDomainManagerAsm;
+ static LPCWSTR s_wszAppDomainManagerType;
+ static EInitializeNewDomainFlags s_dwDomainManagerInitFlags;
+
+#if !defined(FEATURE_CORECLR)
+ static StringArrayList s_defaultDomainPropertyNames;
+ static StringArrayList s_defaultDomainPropertyValues;
+
+protected:
+ static IHostMemoryManager *m_HostMemoryManager;
+ static IHostMalloc *m_HostMalloc;
+ static IHostTaskManager *m_HostTaskManager;
+ static IHostThreadpoolManager *m_HostThreadpoolManager;
+ static IHostIoCompletionManager *m_HostIoCompletionManager;
+ static IHostSyncManager *m_HostSyncManager;
+ static IHostAssemblyManager *m_HostAssemblyManager;
+ static IHostGCManager *m_HostGCManager;
+ static IHostSecurityManager *m_HostSecurityManager;
+ static IHostPolicyManager *m_HostPolicyManager;
+ static int m_HostOverlappedExtensionSize;
+ static ICLRAssemblyReferenceList *m_pHostDomainNeutralAsms;
+
+ static WCHAR m_wzHostConfigFile[_MAX_PATH];
+
+ static BOOL m_dwFlagsFinalized;
+ static DangerousNonHostedSpinLock m_FlagsLock; // protects the flags and host config
+#endif // !defined(FEATURE_CORECLR)
+
+ SVAL_DECL(STARTUP_FLAGS, m_dwStartupFlags);
+};
+
+#ifdef FEATURE_INCLUDE_ALL_INTERFACES
+class CorHostProtectionManager : public ICLRHostProtectionManager
+#else // !FEATURE_INCLUDE_ALL_INTERFACES
+class CorHostProtectionManager
+#endif // FEATURE_INCLUDE_ALL_INTERFACES
+{
+private:
+ EApiCategories m_eProtectedCategories;
+ bool m_fEagerSerializeGrantSet;
+ bool m_fFrozen;
+
+public:
+ CorHostProtectionManager();
+
+ // IUnknown methods
+ HRESULT STDMETHODCALLTYPE QueryInterface(
+ REFIID id,
+ void **pInterface);
+ ULONG STDMETHODCALLTYPE AddRef();
+ ULONG STDMETHODCALLTYPE Release();
+
+ // Interface methods
+ virtual HRESULT STDMETHODCALLTYPE SetProtectedCategories(/* [in] */ EApiCategories eFullTrustOnlyResources);
+ virtual HRESULT STDMETHODCALLTYPE SetEagerSerializeGrantSets();
+
+ // Getters
+ EApiCategories GetProtectedCategories();
+ bool GetEagerSerializeGrantSets() const;
+
+ void Freeze();
+};
+
+#ifdef FEATURE_COMINTEROP
+extern "C"
+HRESULT STDMETHODCALLTYPE DllGetActivationFactoryImpl(
+ LPCWSTR wszAssemblyName,
+ LPCWSTR wszTypeName,
+ LPCWSTR wszCodeBase,
+ IActivationFactory ** factory);
+
+#endif // defined(FEATURE_COMINTEROP)
+
+extern SIZE_T Host_SegmentSize;
+extern SIZE_T Host_MaxGen0Size;
+extern BOOL Host_fSegmentSizeSet;
+extern BOOL Host_fMaxGen0SizeSet;
+
+#define PARTIAL_TRUST_VISIBLE_ASSEMBLIES_PROPERTY W("PARTIAL_TRUST_VISIBLE_ASSEMBLIES")
+#endif // __CorHost__h__
diff --git a/src/inc/corimage.h b/src/inc/corimage.h
new file mode 100644
index 0000000000..554eb2042a
--- /dev/null
+++ b/src/inc/corimage.h
@@ -0,0 +1,67 @@
+// 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.
+
+
+//
+
+/*============================================================
+**
+** CorImage.h
+**
+** IMAGEHLP routines so we can avoid early binding to that DLL.
+**
+===========================================================*/
+
+#ifndef _CORIMAGE_H_
+#define _CORIMAGE_H_
+
+#include <daccess.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+IMAGE_NT_HEADERS *Cor_RtlImageNtHeader(VOID *pvBase,
+ ULONG FileLength);
+
+PIMAGE_SECTION_HEADER
+Cor_RtlImageRvaToSection(PTR_IMAGE_NT_HEADERS NtHeaders,
+ ULONG Rva,
+ ULONG FileLength);
+
+PIMAGE_SECTION_HEADER
+Cor_RtlImageRvaRangeToSection(PTR_IMAGE_NT_HEADERS NtHeaders,
+ ULONG Rva,
+ ULONG Range,
+ ULONG FileLength);
+
+DWORD Cor_RtlImageRvaToOffset(PTR_IMAGE_NT_HEADERS NtHeaders,
+ ULONG Rva,
+ ULONG FileLength);
+
+PBYTE Cor_RtlImageRvaToVa(PTR_IMAGE_NT_HEADERS NtHeaders,
+ PBYTE Base,
+ ULONG Rva,
+ ULONG FileLength);
+
+PBYTE Cor_RtlImageDirToVa(PTR_IMAGE_NT_HEADERS NtHeaders,
+ PBYTE Base,
+ UINT DirIndex,
+ ULONG FileLength);
+
+PBYTE Cor_RtlImageRvaToVa32(PTR_IMAGE_NT_HEADERS32 NtHeaders,
+ PBYTE Base,
+ ULONG Rva,
+ ULONG FileLength);
+
+PBYTE Cor_RtlImageRvaToVa64(PTR_IMAGE_NT_HEADERS64 NtHeaders,
+ PBYTE Base,
+ ULONG Rva,
+ ULONG FileLength);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // _CORIMAGE_H_
diff --git a/src/inc/corinfo.h b/src/inc/corinfo.h
new file mode 100644
index 0000000000..6e41d8e035
--- /dev/null
+++ b/src/inc/corinfo.h
@@ -0,0 +1,3139 @@
+// 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.
+
+//
+
+/*****************************************************************************\
+* *
+* CorInfo.h - EE / Code generator interface *
+* *
+*******************************************************************************
+*
+* This file exposes CLR runtime functionality. It can be used by compilers,
+* both Just-in-time and ahead-of-time, to generate native code which
+* executes in the runtime environment.
+*******************************************************************************
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE
+//
+// The JIT/EE interface is versioned. By "interface", we mean mean any and all communication between the
+// JIT and the EE. Any time a change is made to the interface, the JIT/EE interface version identifier
+// must be updated. See code:JITEEVersionIdentifier for more information.
+//
+// NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE
+//
+//////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#EEJitContractDetails
+
+The semantic contract between the EE and the JIT should be documented here It is incomplete, but as time goes
+on, that hopefully will change
+
+See file:../../doc/BookOfTheRuntime/JIT/JIT%20Design.doc for details on the JIT compiler. See
+code:EEStartup#TableOfContents for information on the runtime as a whole.
+
+-------------------------------------------------------------------------------
+#Tokens
+
+The tokens in IL stream needs to be resolved to EE handles (CORINFO_CLASS/METHOD/FIELD_HANDLE) that
+the runtime operates with. ICorStaticInfo::resolveToken is the method that resolves the found in IL stream
+to set of EE handles (CORINFO_RESOLVED_TOKEN). All other APIs take resolved token as input. This design
+avoids redundant token resolutions.
+
+The token validation is done as part of token resolution. The JIT is not required to do explicit upfront
+token validation.
+
+-------------------------------------------------------------------------------
+#ClassConstruction
+
+First of all class contruction comes in two flavors precise and 'beforeFieldInit'. In C# you get the former
+if you declare an explicit class constructor method and the later if you declaratively initialize static
+fields. Precise class construction guarentees that the .cctor is run precisely before the first access to any
+method or field of the class. 'beforeFieldInit' semantics guarentees only that the .cctor will be run some
+time before the first static field access (note that calling methods (static or insance) or accessing
+instance fields does not cause .cctors to be run).
+
+Next you need to know that there are two kinds of code generation that can happen in the JIT: appdomain
+neutral and appdomain specialized. The difference between these two kinds of code is how statics are handled.
+For appdomain specific code, the address of a particular static variable is embeded in the code. This makes
+it usable only for one appdomain (since every appdomain gets a own copy of its statics). Appdomain neutral
+code calls a helper that looks up static variables off of a thread local variable. Thus the same code can be
+used by mulitple appdomains in the same process.
+
+Generics also introduce a similar issue. Code for generic classes might be specialised for a particular set
+of type arguments, or it could use helpers to access data that depends on type parameters and thus be shared
+across several instantiations of the generic type.
+
+Thus there four cases
+
+ * BeforeFieldInitCCtor - Unshared code. Cctors are only called when static fields are fetched. At the
+ time the method that touches the static field is JITed (or fixed up in the case of NGENed code), the
+ .cctor is called.
+ * BeforeFieldInitCCtor - Shared code. Since the same code is used for multiple classes, the act of JITing
+ the code can not be used as a hook. However, it is also the case that since the code is shared, it
+ can not wire in a particular address for the static and thus needs to use a helper that looks up the
+ correct address based on the thread ID. This helper does the .cctor check, and thus no additional
+ cctor logic is needed.
+ * PreciseCCtor - Unshared code. Any time a method is JITTed (or fixed up in the case of NGEN), a cctor
+ check for the class of the method being JITTed is done. In addition the JIT inserts explicit checks
+ before any static field accesses. Instance methods and fields do NOT have hooks because a .ctor
+ method must be called before the instance can be created.
+ * PreciseCctor - Shared code .cctor checks are placed in the prolog of every .ctor and static method. All
+ methods that access static fields have an explicit .cctor check before use. Again instance methods
+ don't have hooks because a .ctor would have to be called first.
+
+Technically speaking, however the optimization of avoiding checks on instance methods is flawed. It requires
+that a .ctor always preceed a call to an instance methods. This break down when
+
+ * A NULL is passed to an instance method.
+ * A .ctor does not call its superclasses .ctor. This allows an instance to be created without necessarily
+ calling all the .cctors of all the superclasses. A virtual call can then be made to a instance of a
+ superclass without necessarily calling the superclass's .cctor.
+ * The class is a value class (which exists without a .ctor being called)
+
+Nevertheless, the cost of plugging these holes is considered to high and the benefit is low.
+
+----------------------------------------------------------------------
+
+#ClassConstructionFlags
+
+Thus the JIT's cctor responsibilities require it to check with the EE on every static field access using
+initClass and before jitting any method to see if a .cctor check must be placed in the prolog.
+
+ * CORINFO_FLG_BEFOREFIELDINIT indicate the class has beforeFieldInit semantics. The jit does not strictly
+ need this information however, it is valuable in optimizing static field fetch helper calls. Helper
+ call for classes with BeforeFieldInit semantics can be hoisted before other side effects where
+ classes with precise .cctor semantics do not allow this optimization.
+
+Inlining also complicates things. Because the class could have precise semantics it is also required that the
+inlining of any constructor or static method must also do the initClass check. The inliner has the option of
+inserting any required runtime check or simply not inlining the function.
+
+-------------------------------------------------------------------------------
+
+#StaticFields
+
+The first 4 options are mutially exclusive
+
+ * CORINFO_FLG_HELPER If the field has this set, then the JIT must call getFieldHelper and call the
+ returned helper with the object ref (for an instance field) and a fieldDesc. Note that this should be
+ able to handle ANY field so to get a JIT up quickly, it has the option of using helper calls for all
+ field access (and skip the complexity below). Note that for statics it is assumed that you will
+ alwasy ask for the ADDRESSS helper and to the fetch in the JIT.
+
+ * CORINFO_FLG_SHARED_HELPER This is currently only used for static fields. If this bit is set it means
+ that the field is feched by a helper call that takes a module identifier (see getModuleDomainID) and
+ a class identifier (see getClassDomainID) as arguments. The exact helper to call is determined by
+ getSharedStaticBaseHelper. The return value is of this function is the base of all statics in the
+ module. The offset from getFieldOffset must be added to this value to get the address of the field
+ itself. (see also CORINFO_FLG_STATIC_IN_HEAP).
+
+
+ * CORINFO_FLG_GENERICS_STATIC This is currently only used for static fields (of generic type). This
+ function is intended to be called with a Generic handle as a argument (from embedGenericHandle). The
+ exact helper to call is determined by getSharedStaticBaseHelper. The returned value is the base of
+ all statics in the class. The offset from getFieldOffset must be added to this value to get the
+ address of the (see also CORINFO_FLG_STATIC_IN_HEAP).
+
+ * CORINFO_FLG_TLS This indicate that the static field is a Windows style Thread Local Static. (We also
+ have managed thread local statics, which work through the HELPER. Support for this is considered
+ legacy, and going forward, the EE should
+
+ * <NONE> This is a normal static field. Its address in in memory is determined by getFieldAddress. (see
+ also CORINFO_FLG_STATIC_IN_HEAP).
+
+
+This last field can modify any of the cases above except CORINFO_FLG_HELPER
+
+CORINFO_FLG_STATIC_IN_HEAP This is currently only used for static fields of value classes. If the field has
+this set then after computing what would normally be the field, what you actually get is a object poitner
+(that must be reported to the GC) to a boxed version of the value. Thus the actual field address is computed
+by addr = (*addr+sizeof(OBJECTREF))
+
+Instance fields
+
+ * CORINFO_FLG_HELPER This is used if the class is MarshalByRef, which means that the object might be a
+ proxyt to the real object in some other appdomain or process. If the field has this set, then the JIT
+ must call getFieldHelper and call the returned helper with the object ref. If the helper returned is
+ helpers that are for structures the args are as follows
+
+ * CORINFO_HELP_GETFIELDSTRUCT - args are: retBuff, object, fieldDesc
+ * CORINFO_HELP_SETFIELDSTRUCT - args are object fieldDesc value
+
+The other GET helpers take an object fieldDesc and return the value The other SET helpers take an object
+fieldDesc and value
+
+ Note that unlike static fields there is no helper to take the address of a field because in general there
+ is no address for proxies (LDFLDA is illegal on proxies).
+
+ CORINFO_FLG_EnC This is to support adding new field for edit and continue. This field also indicates that
+ a helper is needed to access this field. However this helper is always CORINFO_HELP_GETFIELDADDR, and
+ this helper always takes the object and field handle and returns the address of the field. It is the
+ JIT's responcibility to do the fetch or set.
+
+-------------------------------------------------------------------------------
+
+TODO: Talk about initializing strutures before use
+
+
+*******************************************************************************
+*/
+
+#ifndef _COR_INFO_H_
+#define _COR_INFO_H_
+
+#include <corhdr.h>
+#include <specstrings.h>
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE
+//
+// #JITEEVersionIdentifier
+//
+// This GUID represents the version of the JIT/EE interface. Any time the interface between the JIT and
+// the EE changes (by adding or removing methods to any interface shared between them), this GUID should
+// be changed. This is the identifier verified by ICorJitCompiler::getVersionIdentifier().
+//
+// You can use "uuidgen.exe -s" to generate this value.
+//
+// **** NOTE TO INTEGRATORS:
+//
+// If there is a merge conflict here, because the version changed in two different places, you must
+// create a **NEW** GUID, not simply choose one or the other!
+//
+// NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE
+//
+//////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#if !defined(SELECTANY)
+ #define SELECTANY extern __declspec(selectany)
+#endif
+
+// COR_JIT_EE_VERSION is a #define that specifies a JIT-EE version, but on a less granular basis than the GUID.
+// The #define is intended to be used on a per-product basis. That is, for each release that we support a JIT
+// CTP build, we'll update the COR_JIT_EE_VERSION. The GUID must change any time any part of the interface changes.
+//
+// COR_JIT_EE_VERSION is set, by convention, to a number related to the the product number. So, 460 is .NET 4.60.
+// 461 would indicate .NET 4.6.1. Etc.
+//
+// Note that the EE should always build with the most current (highest numbered) version. Only the JIT will
+// potentially build with a lower version number. In that case, the COR_JIT_EE_VERSION will be specified in the
+// CTP JIT build project, such as ctpjit.nativeproj.
+
+#if !defined(COR_JIT_EE_VERSION)
+#define COR_JIT_EE_VERSION 999999999 // This means we'll take everything in the interface
+#endif
+
+#if COR_JIT_EE_VERSION > 460
+
+// Update this one
+SELECTANY const GUID JITEEVersionIdentifier = { /* 0b17dfeb-1ead-4e06-b025-d60d3a493b53 */
+ 0x0b17dfeb,
+ 0x1ead,
+ 0x4e06,
+ { 0xb0, 0x25, 0xd6, 0x0d, 0x3a, 0x49, 0x3b, 0x53 }
+};
+
+#else
+
+// ************ Leave this one alone ***************
+// We need it to build a .NET 4.6 compatible JIT for the RyuJIT CTP releases
+SELECTANY const GUID JITEEVersionIdentifier = { /* 9110edd8-8fc3-4e3d-8ac9-12555ff9be9c */
+ 0x9110edd8,
+ 0x8fc3,
+ 0x4e3d,
+ { 0x8a, 0xc9, 0x12, 0x55, 0x5f, 0xf9, 0xbe, 0x9c }
+};
+
+#endif
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// END JITEEVersionIdentifier
+//
+//////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#if COR_JIT_EE_VERSION > 460
+
+// For System V on the CLR type system number of registers to pass in and return a struct is the same.
+// The CLR type system allows only up to 2 eightbytes to be passed in registers. There is no SSEUP classification types.
+#define CLR_SYSTEMV_MAX_EIGHTBYTES_COUNT_TO_PASS_IN_REGISTERS 2
+#define CLR_SYSTEMV_MAX_EIGHTBYTES_COUNT_TO_RETURN_IN_REGISTERS 2
+#define CLR_SYSTEMV_MAX_STRUCT_BYTES_TO_PASS_IN_REGISTERS 16
+
+// System V struct passing
+// The Classification types are described in the ABI spec at http://www.x86-64.org/documentation/abi.pdf
+enum SystemVClassificationType : unsigned __int8
+{
+ SystemVClassificationTypeUnknown = 0,
+ SystemVClassificationTypeStruct = 1,
+ SystemVClassificationTypeNoClass = 2,
+ SystemVClassificationTypeMemory = 3,
+ SystemVClassificationTypeInteger = 4,
+ SystemVClassificationTypeIntegerReference = 5,
+ SystemVClassificationTypeIntegerByRef = 6,
+ SystemVClassificationTypeSSE = 7,
+ // SystemVClassificationTypeSSEUp = Unused, // Not supported by the CLR.
+ // SystemVClassificationTypeX87 = Unused, // Not supported by the CLR.
+ // SystemVClassificationTypeX87Up = Unused, // Not supported by the CLR.
+ // SystemVClassificationTypeComplexX87 = Unused, // Not supported by the CLR.
+
+ // Internal flags - never returned outside of the classification implementation.
+
+ // This value represents a very special type with two eightbytes.
+ // First ByRef, second Integer (platform int).
+ // The VM has a special Elem type for this type - ELEMENT_TYPE_TYPEDBYREF.
+ // This is the classification counterpart for that element type. It is used to detect
+ // the special TypedReference type and specialize its classification.
+ // This type is represented as a struct with two fields. The classification needs to do
+ // special handling of it since the source/methadata type of the fieds is IntPtr.
+ // The VM changes the first to ByRef. The second is left as IntPtr (TYP_I_IMPL really). The classification needs to match this and
+ // special handling is warranted (similar thing is done in the getGCLayout function for this type).
+ SystemVClassificationTypeTypedReference = 8,
+ SystemVClassificationTypeMAX = 9,
+};
+
+// Represents classification information for a struct.
+struct SYSTEMV_AMD64_CORINFO_STRUCT_REG_PASSING_DESCRIPTOR
+{
+ SYSTEMV_AMD64_CORINFO_STRUCT_REG_PASSING_DESCRIPTOR()
+ {
+ Initialize();
+ }
+
+ bool passedInRegisters; // Whether the struct is passable/passed (this includes struct returning) in registers.
+ unsigned __int8 eightByteCount; // Number of eightbytes for this struct.
+ SystemVClassificationType eightByteClassifications[CLR_SYSTEMV_MAX_EIGHTBYTES_COUNT_TO_PASS_IN_REGISTERS]; // The eightbytes type classification.
+ unsigned __int8 eightByteSizes[CLR_SYSTEMV_MAX_EIGHTBYTES_COUNT_TO_PASS_IN_REGISTERS]; // The size of the eightbytes (an eightbyte could include padding. This represents the no padding size of the eightbyte).
+ unsigned __int8 eightByteOffsets[CLR_SYSTEMV_MAX_EIGHTBYTES_COUNT_TO_PASS_IN_REGISTERS]; // The start offset of the eightbytes (in bytes).
+
+ // Members
+
+ //------------------------------------------------------------------------
+ // CopyFrom: Copies a struct classification into this one.
+ //
+ // Arguments:
+ // 'copyFrom' the struct classification to copy from.
+ //
+ void CopyFrom(const SYSTEMV_AMD64_CORINFO_STRUCT_REG_PASSING_DESCRIPTOR& copyFrom)
+ {
+ passedInRegisters = copyFrom.passedInRegisters;
+ eightByteCount = copyFrom.eightByteCount;
+
+ for (int i = 0; i < CLR_SYSTEMV_MAX_EIGHTBYTES_COUNT_TO_PASS_IN_REGISTERS; i++)
+ {
+ eightByteClassifications[i] = copyFrom.eightByteClassifications[i];
+ eightByteSizes[i] = copyFrom.eightByteSizes[i];
+ eightByteOffsets[i] = copyFrom.eightByteOffsets[i];
+ }
+ }
+
+ //------------------------------------------------------------------------
+ // IsIntegralSlot: Returns whether the eightbyte at slotIndex is of integral type.
+ //
+ // Arguments:
+ // 'slotIndex' the slot number we are determining if it is of integral type.
+ //
+ // Return value:
+ // returns true if we the eightbyte at index slotIndex is of integral type.
+ //
+
+ bool IsIntegralSlot(unsigned slotIndex) const
+ {
+ return ((eightByteClassifications[slotIndex] == SystemVClassificationTypeInteger) ||
+ (eightByteClassifications[slotIndex] == SystemVClassificationTypeIntegerReference) ||
+ (eightByteClassifications[slotIndex] == SystemVClassificationTypeIntegerByRef));
+ }
+
+ //------------------------------------------------------------------------
+ // IsSseSlot: Returns whether the eightbyte at slotIndex is SSE type.
+ //
+ // Arguments:
+ // 'slotIndex' the slot number we are determining if it is of SSE type.
+ //
+ // Return value:
+ // returns true if we the eightbyte at index slotIndex is of SSE type.
+ //
+ // Follows the rules of the AMD64 System V ABI specification at www.x86-64.org/documentation/abi.pdf.
+ // Please reffer to it for definitions/examples.
+ //
+ bool IsSseSlot(unsigned slotIndex) const
+ {
+ return (eightByteClassifications[slotIndex] == SystemVClassificationTypeSSE);
+ }
+
+private:
+ void Initialize()
+ {
+ passedInRegisters = false;
+ eightByteCount = 0;
+
+ for (int i = 0; i < CLR_SYSTEMV_MAX_EIGHTBYTES_COUNT_TO_PASS_IN_REGISTERS; i++)
+ {
+ eightByteClassifications[i] = SystemVClassificationTypeUnknown;
+ eightByteSizes[i] = 0;
+ eightByteOffsets[i] = 0;
+ }
+ }
+};
+
+#endif // COR_JIT_EE_VERSION
+
+// CorInfoHelpFunc defines the set of helpers (accessed via the ICorDynamicInfo::getHelperFtn())
+// These helpers can be called by native code which executes in the runtime.
+// Compilers can emit calls to these helpers.
+//
+// The signatures of the helpers are below (see RuntimeHelperArgumentCheck)
+
+enum CorInfoHelpFunc
+{
+ CORINFO_HELP_UNDEF, // invalid value. This should never be used
+
+ /* Arithmetic helpers */
+
+ CORINFO_HELP_DIV, // For the ARM 32-bit integer divide uses a helper call :-(
+ CORINFO_HELP_MOD,
+ CORINFO_HELP_UDIV,
+ CORINFO_HELP_UMOD,
+
+ CORINFO_HELP_LLSH,
+ CORINFO_HELP_LRSH,
+ CORINFO_HELP_LRSZ,
+ CORINFO_HELP_LMUL,
+ CORINFO_HELP_LMUL_OVF,
+ CORINFO_HELP_ULMUL_OVF,
+ CORINFO_HELP_LDIV,
+ CORINFO_HELP_LMOD,
+ CORINFO_HELP_ULDIV,
+ CORINFO_HELP_ULMOD,
+ CORINFO_HELP_LNG2DBL, // Convert a signed int64 to a double
+ CORINFO_HELP_ULNG2DBL, // Convert a unsigned int64 to a double
+ CORINFO_HELP_DBL2INT,
+ CORINFO_HELP_DBL2INT_OVF,
+ CORINFO_HELP_DBL2LNG,
+ CORINFO_HELP_DBL2LNG_OVF,
+ CORINFO_HELP_DBL2UINT,
+ CORINFO_HELP_DBL2UINT_OVF,
+ CORINFO_HELP_DBL2ULNG,
+ CORINFO_HELP_DBL2ULNG_OVF,
+ CORINFO_HELP_FLTREM,
+ CORINFO_HELP_DBLREM,
+ CORINFO_HELP_FLTROUND,
+ CORINFO_HELP_DBLROUND,
+
+ /* Allocating a new object. Always use ICorClassInfo::getNewHelper() to decide
+ which is the right helper to use to allocate an object of a given type. */
+
+ CORINFO_HELP_NEW_CROSSCONTEXT, // cross context new object
+ CORINFO_HELP_NEWFAST,
+ CORINFO_HELP_NEWSFAST, // allocator for small, non-finalizer, non-array object
+ CORINFO_HELP_NEWSFAST_ALIGN8, // allocator for small, non-finalizer, non-array object, 8 byte aligned
+ CORINFO_HELP_NEW_MDARR, // multi-dim array helper (with or without lower bounds - dimensions passed in as vararg)
+#if COR_JIT_EE_VERSION > 460
+ CORINFO_HELP_NEW_MDARR_NONVARARG,// multi-dim array helper (with or without lower bounds - dimensions passed in as unmanaged array)
+#endif
+ CORINFO_HELP_NEWARR_1_DIRECT, // helper for any one dimensional array creation
+ CORINFO_HELP_NEWARR_1_OBJ, // optimized 1-D object arrays
+ CORINFO_HELP_NEWARR_1_VC, // optimized 1-D value class arrays
+ CORINFO_HELP_NEWARR_1_ALIGN8, // like VC, but aligns the array start
+
+ CORINFO_HELP_STRCNS, // create a new string literal
+ CORINFO_HELP_STRCNS_CURRENT_MODULE, // create a new string literal from the current module (used by NGen code)
+
+ /* Object model */
+
+ CORINFO_HELP_INITCLASS, // Initialize class if not already initialized
+ CORINFO_HELP_INITINSTCLASS, // Initialize class for instantiated type
+
+ // Use ICorClassInfo::getCastingHelper to determine
+ // the right helper to use
+
+ CORINFO_HELP_ISINSTANCEOFINTERFACE, // Optimized helper for interfaces
+ CORINFO_HELP_ISINSTANCEOFARRAY, // Optimized helper for arrays
+ CORINFO_HELP_ISINSTANCEOFCLASS, // Optimized helper for classes
+ CORINFO_HELP_ISINSTANCEOFANY, // Slow helper for any type
+
+ CORINFO_HELP_CHKCASTINTERFACE,
+ CORINFO_HELP_CHKCASTARRAY,
+ CORINFO_HELP_CHKCASTCLASS,
+ CORINFO_HELP_CHKCASTANY,
+ CORINFO_HELP_CHKCASTCLASS_SPECIAL, // Optimized helper for classes. Assumes that the trivial cases
+ // has been taken care of by the inlined check
+
+ CORINFO_HELP_BOX,
+ CORINFO_HELP_BOX_NULLABLE, // special form of boxing for Nullable<T>
+ CORINFO_HELP_UNBOX,
+ CORINFO_HELP_UNBOX_NULLABLE, // special form of unboxing for Nullable<T>
+ CORINFO_HELP_GETREFANY, // Extract the byref from a TypedReference, checking that it is the expected type
+
+ CORINFO_HELP_ARRADDR_ST, // assign to element of object array with type-checking
+ CORINFO_HELP_LDELEMA_REF, // does a precise type comparision and returns address
+
+ /* Exceptions */
+
+ CORINFO_HELP_THROW, // Throw an exception object
+ CORINFO_HELP_RETHROW, // Rethrow the currently active exception
+ CORINFO_HELP_USER_BREAKPOINT, // For a user program to break to the debugger
+ CORINFO_HELP_RNGCHKFAIL, // array bounds check failed
+ CORINFO_HELP_OVERFLOW, // throw an overflow exception
+ CORINFO_HELP_THROWDIVZERO, // throw a divide by zero exception
+#if COR_JIT_EE_VERSION > 460
+ CORINFO_HELP_THROWNULLREF, // throw a null reference exception
+#endif // COR_JIT_EE_VERSION
+
+ CORINFO_HELP_INTERNALTHROW, // Support for really fast jit
+ CORINFO_HELP_VERIFICATION, // Throw a VerificationException
+ CORINFO_HELP_SEC_UNMGDCODE_EXCPT, // throw a security unmanaged code exception
+ CORINFO_HELP_FAIL_FAST, // Kill the process avoiding any exceptions or stack and data dependencies (use for GuardStack unsafe buffer checks)
+
+ CORINFO_HELP_METHOD_ACCESS_EXCEPTION,//Throw an access exception due to a failed member/class access check.
+ CORINFO_HELP_FIELD_ACCESS_EXCEPTION,
+ CORINFO_HELP_CLASS_ACCESS_EXCEPTION,
+
+ CORINFO_HELP_ENDCATCH, // call back into the EE at the end of a catch block
+
+ /* Synchronization */
+
+ CORINFO_HELP_MON_ENTER,
+ CORINFO_HELP_MON_EXIT,
+ CORINFO_HELP_MON_ENTER_STATIC,
+ CORINFO_HELP_MON_EXIT_STATIC,
+
+ CORINFO_HELP_GETCLASSFROMMETHODPARAM, // Given a generics method handle, returns a class handle
+ CORINFO_HELP_GETSYNCFROMCLASSHANDLE, // Given a generics class handle, returns the sync monitor
+ // in its ManagedClassObject
+
+ /* Security callout support */
+
+ CORINFO_HELP_SECURITY_PROLOG, // Required if CORINFO_FLG_SECURITYCHECK is set, or CORINFO_FLG_NOSECURITYWRAP is not set
+ CORINFO_HELP_SECURITY_PROLOG_FRAMED, // Slow version of CORINFO_HELP_SECURITY_PROLOG. Used for instrumentation.
+
+ CORINFO_HELP_METHOD_ACCESS_CHECK, // Callouts to runtime security access checks
+ CORINFO_HELP_FIELD_ACCESS_CHECK,
+ CORINFO_HELP_CLASS_ACCESS_CHECK,
+
+ CORINFO_HELP_DELEGATE_SECURITY_CHECK, // Callout to delegate security transparency check
+
+ /* Verification runtime callout support */
+
+ CORINFO_HELP_VERIFICATION_RUNTIME_CHECK, // Do a Demand for UnmanagedCode permission at runtime
+
+ /* GC support */
+
+ CORINFO_HELP_STOP_FOR_GC, // Call GC (force a GC)
+ CORINFO_HELP_POLL_GC, // Ask GC if it wants to collect
+
+ CORINFO_HELP_STRESS_GC, // Force a GC, but then update the JITTED code to be a noop call
+ CORINFO_HELP_CHECK_OBJ, // confirm that ECX is a valid object pointer (debugging only)
+
+ /* GC Write barrier support */
+
+ CORINFO_HELP_ASSIGN_REF, // universal helpers with F_CALL_CONV calling convention
+ CORINFO_HELP_CHECKED_ASSIGN_REF,
+ CORINFO_HELP_ASSIGN_REF_ENSURE_NONHEAP, // Do the store, and ensure that the target was not in the heap.
+
+ CORINFO_HELP_ASSIGN_BYREF,
+ CORINFO_HELP_ASSIGN_STRUCT,
+
+
+ /* Accessing fields */
+
+ // For COM object support (using COM get/set routines to update object)
+ // and EnC and cross-context support
+ CORINFO_HELP_GETFIELD8,
+ CORINFO_HELP_SETFIELD8,
+ CORINFO_HELP_GETFIELD16,
+ CORINFO_HELP_SETFIELD16,
+ CORINFO_HELP_GETFIELD32,
+ CORINFO_HELP_SETFIELD32,
+ CORINFO_HELP_GETFIELD64,
+ CORINFO_HELP_SETFIELD64,
+ CORINFO_HELP_GETFIELDOBJ,
+ CORINFO_HELP_SETFIELDOBJ,
+ CORINFO_HELP_GETFIELDSTRUCT,
+ CORINFO_HELP_SETFIELDSTRUCT,
+ CORINFO_HELP_GETFIELDFLOAT,
+ CORINFO_HELP_SETFIELDFLOAT,
+ CORINFO_HELP_GETFIELDDOUBLE,
+ CORINFO_HELP_SETFIELDDOUBLE,
+
+ CORINFO_HELP_GETFIELDADDR,
+
+ CORINFO_HELP_GETSTATICFIELDADDR_CONTEXT, // Helper for context-static fields
+ CORINFO_HELP_GETSTATICFIELDADDR_TLS, // Helper for PE TLS fields
+
+ // There are a variety of specialized helpers for accessing static fields. The JIT should use
+ // ICorClassInfo::getSharedStaticsOrCCtorHelper to determine which helper to use
+
+ // Helpers for regular statics
+ CORINFO_HELP_GETGENERICS_GCSTATIC_BASE,
+ CORINFO_HELP_GETGENERICS_NONGCSTATIC_BASE,
+ CORINFO_HELP_GETSHARED_GCSTATIC_BASE,
+ CORINFO_HELP_GETSHARED_NONGCSTATIC_BASE,
+ CORINFO_HELP_GETSHARED_GCSTATIC_BASE_NOCTOR,
+ CORINFO_HELP_GETSHARED_NONGCSTATIC_BASE_NOCTOR,
+ CORINFO_HELP_GETSHARED_GCSTATIC_BASE_DYNAMICCLASS,
+ CORINFO_HELP_GETSHARED_NONGCSTATIC_BASE_DYNAMICCLASS,
+ // Helper to class initialize shared generic with dynamicclass, but not get static field address
+ CORINFO_HELP_CLASSINIT_SHARED_DYNAMICCLASS,
+
+ // Helpers for thread statics
+ CORINFO_HELP_GETGENERICS_GCTHREADSTATIC_BASE,
+ CORINFO_HELP_GETGENERICS_NONGCTHREADSTATIC_BASE,
+ CORINFO_HELP_GETSHARED_GCTHREADSTATIC_BASE,
+ CORINFO_HELP_GETSHARED_NONGCTHREADSTATIC_BASE,
+ CORINFO_HELP_GETSHARED_GCTHREADSTATIC_BASE_NOCTOR,
+ CORINFO_HELP_GETSHARED_NONGCTHREADSTATIC_BASE_NOCTOR,
+ CORINFO_HELP_GETSHARED_GCTHREADSTATIC_BASE_DYNAMICCLASS,
+ CORINFO_HELP_GETSHARED_NONGCTHREADSTATIC_BASE_DYNAMICCLASS,
+
+ /* Debugger */
+
+ CORINFO_HELP_DBG_IS_JUST_MY_CODE, // Check if this is "JustMyCode" and needs to be stepped through.
+
+ /* Profiling enter/leave probe addresses */
+ CORINFO_HELP_PROF_FCN_ENTER, // record the entry to a method (caller)
+ CORINFO_HELP_PROF_FCN_LEAVE, // record the completion of current method (caller)
+ CORINFO_HELP_PROF_FCN_TAILCALL, // record the completionof current method through tailcall (caller)
+
+ /* Miscellaneous */
+
+ CORINFO_HELP_BBT_FCN_ENTER, // record the entry to a method for collecting Tuning data
+
+ CORINFO_HELP_PINVOKE_CALLI, // Indirect pinvoke call
+ CORINFO_HELP_TAILCALL, // Perform a tail call
+
+ CORINFO_HELP_GETCURRENTMANAGEDTHREADID,
+
+ CORINFO_HELP_INIT_PINVOKE_FRAME, // initialize an inlined PInvoke Frame for the JIT-compiler
+
+ CORINFO_HELP_MEMSET, // Init block of memory
+ CORINFO_HELP_MEMCPY, // Copy block of memory
+
+ CORINFO_HELP_RUNTIMEHANDLE_METHOD, // determine a type/field/method handle at run-time
+ CORINFO_HELP_RUNTIMEHANDLE_METHOD_LOG, // determine a type/field/method handle at run-time, with IBC logging
+ CORINFO_HELP_RUNTIMEHANDLE_CLASS, // determine a type/field/method handle at run-time
+ CORINFO_HELP_RUNTIMEHANDLE_CLASS_LOG, // determine a type/field/method handle at run-time, with IBC logging
+
+ // These helpers are required for MDIL backward compatibility only. They are not used by current JITed code.
+ CORINFO_HELP_TYPEHANDLE_TO_RUNTIMETYPEHANDLE_OBSOLETE, // Convert from a TypeHandle (native structure pointer) to RuntimeTypeHandle at run-time
+ CORINFO_HELP_METHODDESC_TO_RUNTIMEMETHODHANDLE_OBSOLETE, // Convert from a MethodDesc (native structure pointer) to RuntimeMethodHandle at run-time
+ CORINFO_HELP_FIELDDESC_TO_RUNTIMEFIELDHANDLE_OBSOLETE, // Convert from a FieldDesc (native structure pointer) to RuntimeFieldHandle at run-time
+
+ CORINFO_HELP_TYPEHANDLE_TO_RUNTIMETYPE, // Convert from a TypeHandle (native structure pointer) to RuntimeType at run-time
+ CORINFO_HELP_TYPEHANDLE_TO_RUNTIMETYPE_MAYBENULL, // Convert from a TypeHandle (native structure pointer) to RuntimeType at run-time, the type may be null
+ CORINFO_HELP_METHODDESC_TO_STUBRUNTIMEMETHOD, // Convert from a MethodDesc (native structure pointer) to RuntimeMethodHandle at run-time
+ CORINFO_HELP_FIELDDESC_TO_STUBRUNTIMEFIELD, // Convert from a FieldDesc (native structure pointer) to RuntimeFieldHandle at run-time
+
+ CORINFO_HELP_VIRTUAL_FUNC_PTR, // look up a virtual method at run-time
+ //CORINFO_HELP_VIRTUAL_FUNC_PTR_LOG, // look up a virtual method at run-time, with IBC logging
+
+ // Not a real helpers. Instead of taking handle arguments, these helpers point to a small stub that loads the handle argument and calls the static helper.
+ CORINFO_HELP_READYTORUN_NEW,
+ CORINFO_HELP_READYTORUN_NEWARR_1,
+ CORINFO_HELP_READYTORUN_ISINSTANCEOF,
+ CORINFO_HELP_READYTORUN_CHKCAST,
+ CORINFO_HELP_READYTORUN_STATIC_BASE,
+ CORINFO_HELP_READYTORUN_VIRTUAL_FUNC_PTR,
+#if COR_JIT_EE_VERSION > 460
+ CORINFO_HELP_READYTORUN_GENERIC_HANDLE,
+ CORINFO_HELP_READYTORUN_DELEGATE_CTOR,
+#else
+ #define CORINFO_HELP_READYTORUN_DELEGATE_CTOR CORINFO_HELP_EE_PRESTUB
+#endif // COR_JIT_EE_VERSION
+
+ CORINFO_HELP_EE_PRESTUB, // Not real JIT helper. Used in native images.
+
+ CORINFO_HELP_EE_PRECODE_FIXUP, // Not real JIT helper. Used for Precode fixup in native images.
+ CORINFO_HELP_EE_PINVOKE_FIXUP, // Not real JIT helper. Used for PInvoke target fixup in native images.
+ CORINFO_HELP_EE_VSD_FIXUP, // Not real JIT helper. Used for VSD cell fixup in native images.
+ CORINFO_HELP_EE_EXTERNAL_FIXUP, // Not real JIT helper. Used for to fixup external method thunks in native images.
+ CORINFO_HELP_EE_VTABLE_FIXUP, // Not real JIT helper. Used for inherited vtable slot fixup in native images.
+
+ CORINFO_HELP_EE_REMOTING_THUNK, // Not real JIT helper. Used for remoting precode in native images.
+
+ CORINFO_HELP_EE_PERSONALITY_ROUTINE,// Not real JIT helper. Used in native images.
+ CORINFO_HELP_EE_PERSONALITY_ROUTINE_FILTER_FUNCLET,// Not real JIT helper. Used in native images to detect filter funclets.
+
+ // ASSIGN_REF_EAX - CHECKED_ASSIGN_REF_EBP: NOGC_WRITE_BARRIERS JIT helper calls
+ //
+ // For unchecked versions EDX is required to point into GC heap.
+ //
+ // NOTE: these helpers are only used for x86.
+ CORINFO_HELP_ASSIGN_REF_EAX, // EAX holds GC ptr, do a 'mov [EDX], EAX' and inform GC
+ CORINFO_HELP_ASSIGN_REF_EBX, // EBX holds GC ptr, do a 'mov [EDX], EBX' and inform GC
+ CORINFO_HELP_ASSIGN_REF_ECX, // ECX holds GC ptr, do a 'mov [EDX], ECX' and inform GC
+ CORINFO_HELP_ASSIGN_REF_ESI, // ESI holds GC ptr, do a 'mov [EDX], ESI' and inform GC
+ CORINFO_HELP_ASSIGN_REF_EDI, // EDI holds GC ptr, do a 'mov [EDX], EDI' and inform GC
+ CORINFO_HELP_ASSIGN_REF_EBP, // EBP holds GC ptr, do a 'mov [EDX], EBP' and inform GC
+
+ CORINFO_HELP_CHECKED_ASSIGN_REF_EAX, // These are the same as ASSIGN_REF above ...
+ CORINFO_HELP_CHECKED_ASSIGN_REF_EBX, // ... but also check if EDX points into heap.
+ CORINFO_HELP_CHECKED_ASSIGN_REF_ECX,
+ CORINFO_HELP_CHECKED_ASSIGN_REF_ESI,
+ CORINFO_HELP_CHECKED_ASSIGN_REF_EDI,
+ CORINFO_HELP_CHECKED_ASSIGN_REF_EBP,
+
+ CORINFO_HELP_LOOP_CLONE_CHOICE_ADDR, // Return the reference to a counter to decide to take cloned path in debug stress.
+ CORINFO_HELP_DEBUG_LOG_LOOP_CLONING, // Print a message that a loop cloning optimization has occurred in debug mode.
+
+#if COR_JIT_EE_VERSION > 460
+ CORINFO_HELP_THROW_ARGUMENTEXCEPTION, // throw ArgumentException
+ CORINFO_HELP_THROW_ARGUMENTOUTOFRANGEEXCEPTION, // throw ArgumentOutOfRangeException
+
+ CORINFO_HELP_JIT_PINVOKE_BEGIN, // Transition to preemptive mode before a P/Invoke, frame is the first argument
+ CORINFO_HELP_JIT_PINVOKE_END, // Transition to cooperative mode after a P/Invoke, frame is the first argument
+
+ CORINFO_HELP_JIT_REVERSE_PINVOKE_ENTER, // Transition to cooperative mode in reverse P/Invoke prolog, frame is the first argument
+ CORINFO_HELP_JIT_REVERSE_PINVOKE_EXIT, // Transition to preemptive mode in reverse P/Invoke epilog, frame is the first argument
+#endif
+
+ CORINFO_HELP_COUNT,
+};
+
+#define CORINFO_HELP_READYTORUN_ATYPICAL_CALLSITE 0x40000000
+
+//This describes the signature for a helper method.
+enum CorInfoHelpSig
+{
+ CORINFO_HELP_SIG_UNDEF,
+ CORINFO_HELP_SIG_NO_ALIGN_STUB,
+ CORINFO_HELP_SIG_NO_UNWIND_STUB,
+ CORINFO_HELP_SIG_REG_ONLY,
+ CORINFO_HELP_SIG_4_STACK,
+ CORINFO_HELP_SIG_8_STACK,
+ CORINFO_HELP_SIG_12_STACK,
+ CORINFO_HELP_SIG_16_STACK,
+ CORINFO_HELP_SIG_8_VA, //2 arguments plus varargs
+
+ CORINFO_HELP_SIG_EBPCALL, //special calling convention that uses EDX and
+ //EBP as arguments
+
+ CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB,
+
+ CORINFO_HELP_SIG_COUNT
+};
+
+// The enumeration is returned in 'getSig','getType', getArgType methods
+enum CorInfoType
+{
+ CORINFO_TYPE_UNDEF = 0x0,
+ CORINFO_TYPE_VOID = 0x1,
+ CORINFO_TYPE_BOOL = 0x2,
+ CORINFO_TYPE_CHAR = 0x3,
+ CORINFO_TYPE_BYTE = 0x4,
+ CORINFO_TYPE_UBYTE = 0x5,
+ CORINFO_TYPE_SHORT = 0x6,
+ CORINFO_TYPE_USHORT = 0x7,
+ CORINFO_TYPE_INT = 0x8,
+ CORINFO_TYPE_UINT = 0x9,
+ CORINFO_TYPE_LONG = 0xa,
+ CORINFO_TYPE_ULONG = 0xb,
+ CORINFO_TYPE_NATIVEINT = 0xc,
+ CORINFO_TYPE_NATIVEUINT = 0xd,
+ CORINFO_TYPE_FLOAT = 0xe,
+ CORINFO_TYPE_DOUBLE = 0xf,
+ CORINFO_TYPE_STRING = 0x10, // Not used, should remove
+ CORINFO_TYPE_PTR = 0x11,
+ CORINFO_TYPE_BYREF = 0x12,
+ CORINFO_TYPE_VALUECLASS = 0x13,
+ CORINFO_TYPE_CLASS = 0x14,
+ CORINFO_TYPE_REFANY = 0x15,
+
+ // CORINFO_TYPE_VAR is for a generic type variable.
+ // Generic type variables only appear when the JIT is doing
+ // verification (not NOT compilation) of generic code
+ // for the EE, in which case we're running
+ // the JIT in "import only" mode.
+
+ CORINFO_TYPE_VAR = 0x16,
+ CORINFO_TYPE_COUNT, // number of jit types
+};
+
+enum CorInfoTypeWithMod
+{
+ CORINFO_TYPE_MASK = 0x3F, // lower 6 bits are type mask
+ CORINFO_TYPE_MOD_PINNED = 0x40, // can be applied to CLASS, or BYREF to indiate pinned
+};
+
+inline CorInfoType strip(CorInfoTypeWithMod val) {
+ return CorInfoType(val & CORINFO_TYPE_MASK);
+}
+
+// The enumeration is returned in 'getSig'
+
+enum CorInfoCallConv
+{
+ // These correspond to CorCallingConvention
+
+ CORINFO_CALLCONV_DEFAULT = 0x0,
+ CORINFO_CALLCONV_C = 0x1,
+ CORINFO_CALLCONV_STDCALL = 0x2,
+ CORINFO_CALLCONV_THISCALL = 0x3,
+ CORINFO_CALLCONV_FASTCALL = 0x4,
+ CORINFO_CALLCONV_VARARG = 0x5,
+ CORINFO_CALLCONV_FIELD = 0x6,
+ CORINFO_CALLCONV_LOCAL_SIG = 0x7,
+ CORINFO_CALLCONV_PROPERTY = 0x8,
+ CORINFO_CALLCONV_NATIVEVARARG = 0xb, // used ONLY for IL stub PInvoke vararg calls
+
+ CORINFO_CALLCONV_MASK = 0x0f, // Calling convention is bottom 4 bits
+ CORINFO_CALLCONV_GENERIC = 0x10,
+ CORINFO_CALLCONV_HASTHIS = 0x20,
+ CORINFO_CALLCONV_EXPLICITTHIS=0x40,
+ CORINFO_CALLCONV_PARAMTYPE = 0x80, // Passed last. Same as CORINFO_GENERICS_CTXT_FROM_PARAMTYPEARG
+};
+
+enum CorInfoUnmanagedCallConv
+{
+ // These correspond to CorUnmanagedCallingConvention
+
+ CORINFO_UNMANAGED_CALLCONV_UNKNOWN,
+ CORINFO_UNMANAGED_CALLCONV_C,
+ CORINFO_UNMANAGED_CALLCONV_STDCALL,
+ CORINFO_UNMANAGED_CALLCONV_THISCALL,
+ CORINFO_UNMANAGED_CALLCONV_FASTCALL
+};
+
+// These are returned from getMethodOptions
+enum CorInfoOptions
+{
+ CORINFO_OPT_INIT_LOCALS = 0x00000010, // zero initialize all variables
+
+ CORINFO_GENERICS_CTXT_FROM_THIS = 0x00000020, // is this shared generic code that access the generic context from the this pointer? If so, then if the method has SEH then the 'this' pointer must always be reported and kept alive.
+ CORINFO_GENERICS_CTXT_FROM_METHODDESC = 0x00000040, // is this shared generic code that access the generic context from the ParamTypeArg(that is a MethodDesc)? If so, then if the method has SEH then the 'ParamTypeArg' must always be reported and kept alive. Same as CORINFO_CALLCONV_PARAMTYPE
+ CORINFO_GENERICS_CTXT_FROM_METHODTABLE = 0x00000080, // is this shared generic code that access the generic context from the ParamTypeArg(that is a MethodTable)? If so, then if the method has SEH then the 'ParamTypeArg' must always be reported and kept alive. Same as CORINFO_CALLCONV_PARAMTYPE
+ CORINFO_GENERICS_CTXT_MASK = (CORINFO_GENERICS_CTXT_FROM_THIS |
+ CORINFO_GENERICS_CTXT_FROM_METHODDESC |
+ CORINFO_GENERICS_CTXT_FROM_METHODTABLE),
+ CORINFO_GENERICS_CTXT_KEEP_ALIVE = 0x00000100, // Keep the generics context alive throughout the method even if there is no explicit use, and report its location to the CLR
+
+};
+
+//
+// what type of code region we are in
+//
+enum CorInfoRegionKind
+{
+ CORINFO_REGION_NONE,
+ CORINFO_REGION_HOT,
+ CORINFO_REGION_COLD,
+ CORINFO_REGION_JIT,
+};
+
+
+// these are the attribute flags for fields and methods (getMethodAttribs)
+enum CorInfoFlag
+{
+// CORINFO_FLG_UNUSED = 0x00000001,
+// CORINFO_FLG_UNUSED = 0x00000002,
+ CORINFO_FLG_PROTECTED = 0x00000004,
+ CORINFO_FLG_STATIC = 0x00000008,
+ CORINFO_FLG_FINAL = 0x00000010,
+ CORINFO_FLG_SYNCH = 0x00000020,
+ CORINFO_FLG_VIRTUAL = 0x00000040,
+// CORINFO_FLG_UNUSED = 0x00000080,
+ CORINFO_FLG_NATIVE = 0x00000100,
+// CORINFO_FLG_UNUSED = 0x00000200,
+ CORINFO_FLG_ABSTRACT = 0x00000400,
+
+ CORINFO_FLG_EnC = 0x00000800, // member was added by Edit'n'Continue
+
+ // These are internal flags that can only be on methods
+ CORINFO_FLG_FORCEINLINE = 0x00010000, // The method should be inlined if possible.
+ CORINFO_FLG_SHAREDINST = 0x00020000, // the code for this method is shared between different generic instantiations (also set on classes/types)
+ CORINFO_FLG_DELEGATE_INVOKE = 0x00040000, // "Delegate
+ CORINFO_FLG_PINVOKE = 0x00080000, // Is a P/Invoke call
+ CORINFO_FLG_SECURITYCHECK = 0x00100000, // Is one of the security routines that does a stackwalk (e.g. Assert, Demand)
+ CORINFO_FLG_NOGCCHECK = 0x00200000, // This method is FCALL that has no GC check. Don't put alone in loops
+ CORINFO_FLG_INTRINSIC = 0x00400000, // This method MAY have an intrinsic ID
+ CORINFO_FLG_CONSTRUCTOR = 0x00800000, // This method is an instance or type initializer
+// CORINFO_FLG_UNUSED = 0x01000000,
+// CORINFO_FLG_UNUSED = 0x02000000,
+ CORINFO_FLG_NOSECURITYWRAP = 0x04000000, // The method requires no security checks
+ CORINFO_FLG_DONT_INLINE = 0x10000000, // The method should not be inlined
+ CORINFO_FLG_DONT_INLINE_CALLER = 0x20000000, // The method should not be inlined, nor should its callers. It cannot be tail called.
+// CORINFO_FLG_UNUSED = 0x40000000,
+
+ // These are internal flags that can only be on Classes
+ CORINFO_FLG_VALUECLASS = 0x00010000, // is the class a value class
+// This flag is define din the Methods section, but is also valid on classes.
+// CORINFO_FLG_SHAREDINST = 0x00020000, // This class is satisfies TypeHandle::IsCanonicalSubtype
+ CORINFO_FLG_VAROBJSIZE = 0x00040000, // the object size varies depending of constructor args
+ CORINFO_FLG_ARRAY = 0x00080000, // class is an array class (initialized differently)
+ CORINFO_FLG_OVERLAPPING_FIELDS = 0x00100000, // struct or class has fields that overlap (aka union)
+ CORINFO_FLG_INTERFACE = 0x00200000, // it is an interface
+ CORINFO_FLG_CONTEXTFUL = 0x00400000, // is this a contextful class?
+ CORINFO_FLG_CUSTOMLAYOUT = 0x00800000, // does this struct have custom layout?
+ CORINFO_FLG_CONTAINS_GC_PTR = 0x01000000, // does the class contain a gc ptr ?
+ CORINFO_FLG_DELEGATE = 0x02000000, // is this a subclass of delegate or multicast delegate ?
+ CORINFO_FLG_MARSHAL_BYREF = 0x04000000, // is this a subclass of MarshalByRef ?
+ CORINFO_FLG_CONTAINS_STACK_PTR = 0x08000000, // This class has a stack pointer inside it
+ CORINFO_FLG_VARIANCE = 0x10000000, // MethodTable::HasVariance (sealed does *not* mean uncast-able)
+ CORINFO_FLG_BEFOREFIELDINIT = 0x20000000, // Additional flexibility for when to run .cctor (see code:#ClassConstructionFlags)
+ CORINFO_FLG_GENERIC_TYPE_VARIABLE = 0x40000000, // This is really a handle for a variable type
+ CORINFO_FLG_UNSAFE_VALUECLASS = 0x80000000, // Unsafe (C++'s /GS) value type
+};
+
+// Flags computed by a runtime compiler
+enum CorInfoMethodRuntimeFlags
+{
+ CORINFO_FLG_BAD_INLINEE = 0x00000001, // The method is not suitable for inlining
+ CORINFO_FLG_VERIFIABLE = 0x00000002, // The method has verifiable code
+ CORINFO_FLG_UNVERIFIABLE = 0x00000004, // The method has unverifiable code
+};
+
+
+enum CORINFO_ACCESS_FLAGS
+{
+ CORINFO_ACCESS_ANY = 0x0000, // Normal access
+ CORINFO_ACCESS_THIS = 0x0001, // Accessed via the this reference
+ CORINFO_ACCESS_UNWRAP = 0x0002, // Accessed via an unwrap reference
+
+ CORINFO_ACCESS_NONNULL = 0x0004, // Instance is guaranteed non-null
+
+ CORINFO_ACCESS_LDFTN = 0x0010, // Accessed via ldftn
+
+ // Field access flags
+ CORINFO_ACCESS_GET = 0x0100, // Field get (ldfld)
+ CORINFO_ACCESS_SET = 0x0200, // Field set (stfld)
+ CORINFO_ACCESS_ADDRESS = 0x0400, // Field address (ldflda)
+ CORINFO_ACCESS_INIT_ARRAY = 0x0800, // Field use for InitializeArray
+ CORINFO_ACCESS_ATYPICAL_CALLSITE = 0x4000, // Atypical callsite that cannot be disassembled by delay loading helper
+ CORINFO_ACCESS_INLINECHECK= 0x8000, // Return fieldFlags and fieldAccessor only. Used by JIT64 during inlining.
+};
+
+// These are the flags set on an CORINFO_EH_CLAUSE
+enum CORINFO_EH_CLAUSE_FLAGS
+{
+ CORINFO_EH_CLAUSE_NONE = 0,
+ CORINFO_EH_CLAUSE_FILTER = 0x0001, // If this bit is on, then this EH entry is for a filter
+ CORINFO_EH_CLAUSE_FINALLY = 0x0002, // This clause is a finally clause
+ CORINFO_EH_CLAUSE_FAULT = 0x0004, // This clause is a fault clause
+};
+
+// This enumeration is passed to InternalThrow
+enum CorInfoException
+{
+ CORINFO_NullReferenceException,
+ CORINFO_DivideByZeroException,
+ CORINFO_InvalidCastException,
+ CORINFO_IndexOutOfRangeException,
+ CORINFO_OverflowException,
+ CORINFO_SynchronizationLockException,
+ CORINFO_ArrayTypeMismatchException,
+ CORINFO_RankException,
+ CORINFO_ArgumentNullException,
+ CORINFO_ArgumentException,
+ CORINFO_Exception_Count,
+};
+
+
+// This enumeration is returned by getIntrinsicID. Methods corresponding to
+// these values will have "well-known" specified behavior. Calls to these
+// methods could be replaced with inlined code corresponding to the
+// specified behavior (without having to examine the IL beforehand).
+
+enum CorInfoIntrinsics
+{
+ CORINFO_INTRINSIC_Sin,
+ CORINFO_INTRINSIC_Cos,
+ CORINFO_INTRINSIC_Sqrt,
+ CORINFO_INTRINSIC_Abs,
+ CORINFO_INTRINSIC_Round,
+ CORINFO_INTRINSIC_Cosh,
+ CORINFO_INTRINSIC_Sinh,
+ CORINFO_INTRINSIC_Tan,
+ CORINFO_INTRINSIC_Tanh,
+ CORINFO_INTRINSIC_Asin,
+ CORINFO_INTRINSIC_Acos,
+ CORINFO_INTRINSIC_Atan,
+ CORINFO_INTRINSIC_Atan2,
+ CORINFO_INTRINSIC_Log10,
+ CORINFO_INTRINSIC_Pow,
+ CORINFO_INTRINSIC_Exp,
+ CORINFO_INTRINSIC_Ceiling,
+ CORINFO_INTRINSIC_Floor,
+ CORINFO_INTRINSIC_GetChar, // fetch character out of string
+ CORINFO_INTRINSIC_Array_GetDimLength, // Get number of elements in a given dimension of an array
+ CORINFO_INTRINSIC_Array_Get, // Get the value of an element in an array
+ CORINFO_INTRINSIC_Array_Address, // Get the address of an element in an array
+ CORINFO_INTRINSIC_Array_Set, // Set the value of an element in an array
+ CORINFO_INTRINSIC_StringGetChar, // fetch character out of string
+ CORINFO_INTRINSIC_StringLength, // get the length
+ CORINFO_INTRINSIC_InitializeArray, // initialize an array from static data
+ CORINFO_INTRINSIC_GetTypeFromHandle,
+ CORINFO_INTRINSIC_RTH_GetValueInternal,
+ CORINFO_INTRINSIC_TypeEQ,
+ CORINFO_INTRINSIC_TypeNEQ,
+ CORINFO_INTRINSIC_Object_GetType,
+ CORINFO_INTRINSIC_StubHelpers_GetStubContext,
+ CORINFO_INTRINSIC_StubHelpers_GetStubContextAddr,
+ CORINFO_INTRINSIC_StubHelpers_GetNDirectTarget,
+ CORINFO_INTRINSIC_InterlockedAdd32,
+ CORINFO_INTRINSIC_InterlockedAdd64,
+ CORINFO_INTRINSIC_InterlockedXAdd32,
+ CORINFO_INTRINSIC_InterlockedXAdd64,
+ CORINFO_INTRINSIC_InterlockedXchg32,
+ CORINFO_INTRINSIC_InterlockedXchg64,
+ CORINFO_INTRINSIC_InterlockedCmpXchg32,
+ CORINFO_INTRINSIC_InterlockedCmpXchg64,
+ CORINFO_INTRINSIC_MemoryBarrier,
+ CORINFO_INTRINSIC_GetCurrentManagedThread,
+ CORINFO_INTRINSIC_GetManagedThreadId,
+
+ CORINFO_INTRINSIC_Count,
+ CORINFO_INTRINSIC_Illegal = -1, // Not a true intrinsic,
+};
+
+// Can a value be accessed directly from JITed code.
+enum InfoAccessType
+{
+ IAT_VALUE, // The info value is directly available
+ IAT_PVALUE, // The value needs to be accessed via an indirection
+ IAT_PPVALUE // The value needs to be accessed via a double indirection
+};
+
+enum CorInfoGCType
+{
+ TYPE_GC_NONE, // no embedded objectrefs
+ TYPE_GC_REF, // Is an object ref
+ TYPE_GC_BYREF, // Is an interior pointer - promote it but don't scan it
+ TYPE_GC_OTHER // requires type-specific treatment
+};
+
+enum CorInfoClassId
+{
+ CLASSID_SYSTEM_OBJECT,
+ CLASSID_TYPED_BYREF,
+ CLASSID_TYPE_HANDLE,
+ CLASSID_FIELD_HANDLE,
+ CLASSID_METHOD_HANDLE,
+ CLASSID_STRING,
+ CLASSID_ARGUMENT_HANDLE,
+ CLASSID_RUNTIME_TYPE,
+};
+
+enum CorInfoInline
+{
+ INLINE_PASS = 0, // Inlining OK
+
+ // failures are negative
+ INLINE_FAIL = -1, // Inlining not OK for this case only
+ INLINE_NEVER = -2, // This method should never be inlined, regardless of context
+};
+
+enum CorInfoInlineRestrictions
+{
+ INLINE_RESPECT_BOUNDARY = 0x00000001, // You can inline if there are no calls from the method being inlined
+ INLINE_NO_CALLEE_LDSTR = 0x00000002, // You can inline only if you guarantee that if inlinee does an ldstr
+ // inlinee's module will never see that string (by any means).
+ // This is due to how we implement the NoStringInterningAttribute
+ // (by reusing the fixup table).
+ INLINE_SAME_THIS = 0x00000004, // You can inline only if the callee is on the same this reference as caller
+};
+
+
+// If you add more values here, keep it in sync with TailCallTypeMap in ..\vm\ClrEtwAll.man
+// and the string enum in CEEInfo::reportTailCallDecision in ..\vm\JITInterface.cpp
+enum CorInfoTailCall
+{
+ TAILCALL_OPTIMIZED = 0, // Optimized tail call (epilog + jmp)
+ TAILCALL_RECURSIVE = 1, // Optimized into a loop (only when a method tail calls itself)
+ TAILCALL_HELPER = 2, // Helper assisted tail call (call to JIT_TailCall)
+
+ // failures are negative
+ TAILCALL_FAIL = -1, // Couldn't do a tail call
+};
+
+enum CorInfoCanSkipVerificationResult
+{
+ CORINFO_VERIFICATION_CANNOT_SKIP = 0, // Cannot skip verification during jit time.
+ CORINFO_VERIFICATION_CAN_SKIP = 1, // Can skip verification during jit time.
+ CORINFO_VERIFICATION_RUNTIME_CHECK = 2, // Cannot skip verification during jit time,
+ // but need to insert a callout to the VM to ask during runtime
+ // whether to raise a verification or not (if the method is unverifiable).
+ CORINFO_VERIFICATION_DONT_JIT = 3, // Cannot skip verification during jit time,
+ // but do not jit the method if is is unverifiable.
+};
+
+enum CorInfoInitClassResult
+{
+ CORINFO_INITCLASS_NOT_REQUIRED = 0x00, // No class initialization required, but the class is not actually initialized yet
+ // (e.g. we are guaranteed to run the static constructor in method prolog)
+ CORINFO_INITCLASS_INITIALIZED = 0x01, // Class initialized
+ CORINFO_INITCLASS_SPECULATIVE = 0x02, // Class may be initialized speculatively
+ CORINFO_INITCLASS_USE_HELPER = 0x04, // The JIT must insert class initialization helper call.
+ CORINFO_INITCLASS_DONT_INLINE = 0x08, // The JIT should not inline the method requesting the class initialization. The class
+ // initialization requires helper class now, but will not require initialization
+ // if the method is compiled standalone. Or the method cannot be inlined due to some
+ // requirement around class initialization such as shared generics.
+};
+
+// Reason codes for making indirect calls
+#define INDIRECT_CALL_REASONS() \
+ INDIRECT_CALL_REASON_FUNC(CORINFO_INDIRECT_CALL_UNKNOWN) \
+ INDIRECT_CALL_REASON_FUNC(CORINFO_INDIRECT_CALL_EXOTIC) \
+ INDIRECT_CALL_REASON_FUNC(CORINFO_INDIRECT_CALL_PINVOKE) \
+ INDIRECT_CALL_REASON_FUNC(CORINFO_INDIRECT_CALL_GENERIC) \
+ INDIRECT_CALL_REASON_FUNC(CORINFO_INDIRECT_CALL_NO_CODE) \
+ INDIRECT_CALL_REASON_FUNC(CORINFO_INDIRECT_CALL_FIXUPS) \
+ INDIRECT_CALL_REASON_FUNC(CORINFO_INDIRECT_CALL_STUB) \
+ INDIRECT_CALL_REASON_FUNC(CORINFO_INDIRECT_CALL_REMOTING) \
+ INDIRECT_CALL_REASON_FUNC(CORINFO_INDIRECT_CALL_CER) \
+ INDIRECT_CALL_REASON_FUNC(CORINFO_INDIRECT_CALL_RESTORE_METHOD) \
+ INDIRECT_CALL_REASON_FUNC(CORINFO_INDIRECT_CALL_RESTORE_FIRST_CALL) \
+ INDIRECT_CALL_REASON_FUNC(CORINFO_INDIRECT_CALL_RESTORE_VALUE_TYPE) \
+ INDIRECT_CALL_REASON_FUNC(CORINFO_INDIRECT_CALL_RESTORE) \
+ INDIRECT_CALL_REASON_FUNC(CORINFO_INDIRECT_CALL_CANT_PATCH) \
+ INDIRECT_CALL_REASON_FUNC(CORINFO_INDIRECT_CALL_PROFILING) \
+ INDIRECT_CALL_REASON_FUNC(CORINFO_INDIRECT_CALL_OTHER_LOADER_MODULE) \
+
+enum CorInfoIndirectCallReason
+{
+ #undef INDIRECT_CALL_REASON_FUNC
+ #define INDIRECT_CALL_REASON_FUNC(x) x,
+ INDIRECT_CALL_REASONS()
+
+ #undef INDIRECT_CALL_REASON_FUNC
+
+ CORINFO_INDIRECT_CALL_COUNT
+};
+
+// This is for use when the JIT is compiling an instantiation
+// of generic code. The JIT needs to know if the generic code itself
+// (which can be verified once and for all independently of the
+// instantiations) passed verification.
+enum CorInfoInstantiationVerification
+{
+ // The method is NOT a concrete instantiation (eg. List<int>.Add()) of a method
+ // in a generic class or a generic method. It is either the typical instantiation
+ // (eg. List<T>.Add()) or entirely non-generic.
+ INSTVER_NOT_INSTANTIATION = 0,
+
+ // The method is an instantiation of a method in a generic class or a generic method,
+ // and the generic class was successfully verified
+ INSTVER_GENERIC_PASSED_VERIFICATION = 1,
+
+ // The method is an instantiation of a method in a generic class or a generic method,
+ // and the generic class failed verification
+ INSTVER_GENERIC_FAILED_VERIFICATION = 2,
+};
+
+// When using CORINFO_HELPER_TAILCALL, the JIT needs to pass certain special
+// calling convention/argument passing/handling details to the helper
+enum CorInfoHelperTailCallSpecialHandling
+{
+ CORINFO_TAILCALL_NORMAL = 0x00000000,
+ CORINFO_TAILCALL_STUB_DISPATCH_ARG = 0x00000001,
+};
+
+
+inline bool dontInline(CorInfoInline val) {
+ return(val < 0);
+}
+
+// Cookie types consumed by the code generator (these are opaque values
+// not inspected by the code generator):
+
+typedef struct CORINFO_ASSEMBLY_STRUCT_* CORINFO_ASSEMBLY_HANDLE;
+typedef struct CORINFO_MODULE_STRUCT_* CORINFO_MODULE_HANDLE;
+typedef struct CORINFO_DEPENDENCY_STRUCT_* CORINFO_DEPENDENCY_HANDLE;
+typedef struct CORINFO_CLASS_STRUCT_* CORINFO_CLASS_HANDLE;
+typedef struct CORINFO_METHOD_STRUCT_* CORINFO_METHOD_HANDLE;
+typedef struct CORINFO_FIELD_STRUCT_* CORINFO_FIELD_HANDLE;
+typedef struct CORINFO_ARG_LIST_STRUCT_* CORINFO_ARG_LIST_HANDLE; // represents a list of argument types
+typedef struct CORINFO_JUST_MY_CODE_HANDLE_*CORINFO_JUST_MY_CODE_HANDLE;
+typedef struct CORINFO_PROFILING_STRUCT_* CORINFO_PROFILING_HANDLE; // a handle guaranteed to be unique per process
+typedef struct CORINFO_GENERIC_STRUCT_* CORINFO_GENERIC_HANDLE; // a generic handle (could be any of the above)
+
+// what is actually passed on the varargs call
+typedef struct CORINFO_VarArgInfo * CORINFO_VARARGS_HANDLE;
+
+// Generic tokens are resolved with respect to a context, which is usually the method
+// being compiled. The CORINFO_CONTEXT_HANDLE indicates which exact instantiation
+// (or the open instantiation) is being referred to.
+// CORINFO_CONTEXT_HANDLE is more tightly scoped than CORINFO_MODULE_HANDLE. For cases
+// where the exact instantiation does not matter, CORINFO_MODULE_HANDLE is used.
+typedef CORINFO_METHOD_HANDLE CORINFO_CONTEXT_HANDLE;
+
+typedef struct CORINFO_DEPENDENCY_STRUCT_
+{
+ CORINFO_MODULE_HANDLE moduleFrom;
+ CORINFO_MODULE_HANDLE moduleTo;
+} CORINFO_DEPENDENCY;
+
+// Bit-twiddling of contexts assumes word-alignment of method handles and type handles
+// If this ever changes, some other encoding will be needed
+enum CorInfoContextFlags
+{
+ CORINFO_CONTEXTFLAGS_METHOD = 0x00, // CORINFO_CONTEXT_HANDLE is really a CORINFO_METHOD_HANDLE
+ CORINFO_CONTEXTFLAGS_CLASS = 0x01, // CORINFO_CONTEXT_HANDLE is really a CORINFO_CLASS_HANDLE
+ CORINFO_CONTEXTFLAGS_MASK = 0x01
+};
+
+#define MAKE_CLASSCONTEXT(c) (CORINFO_CONTEXT_HANDLE((size_t) (c) | CORINFO_CONTEXTFLAGS_CLASS))
+#define MAKE_METHODCONTEXT(m) (CORINFO_CONTEXT_HANDLE((size_t) (m) | CORINFO_CONTEXTFLAGS_METHOD))
+
+enum CorInfoSigInfoFlags
+{
+ CORINFO_SIGFLAG_IS_LOCAL_SIG = 0x01,
+ CORINFO_SIGFLAG_IL_STUB = 0x02,
+};
+
+struct CORINFO_SIG_INST
+{
+ unsigned classInstCount;
+ CORINFO_CLASS_HANDLE * classInst; // (representative, not exact) instantiation for class type variables in signature
+ unsigned methInstCount;
+ CORINFO_CLASS_HANDLE * methInst; // (representative, not exact) instantiation for method type variables in signature
+};
+
+struct CORINFO_SIG_INFO
+{
+ CorInfoCallConv callConv;
+ CORINFO_CLASS_HANDLE retTypeClass; // if the return type is a value class, this is its handle (enums are normalized)
+ CORINFO_CLASS_HANDLE retTypeSigClass;// returns the value class as it is in the sig (enums are not converted to primitives)
+ CorInfoType retType : 8;
+ unsigned flags : 8; // used by IL stubs code
+ unsigned numArgs : 16;
+ struct CORINFO_SIG_INST sigInst; // information about how type variables are being instantiated in generic code
+ CORINFO_ARG_LIST_HANDLE args;
+ PCCOR_SIGNATURE pSig;
+ unsigned cbSig;
+ CORINFO_MODULE_HANDLE scope; // passed to getArgClass
+ mdToken token;
+
+ CorInfoCallConv getCallConv() { return CorInfoCallConv((callConv & CORINFO_CALLCONV_MASK)); }
+ bool hasThis() { return ((callConv & CORINFO_CALLCONV_HASTHIS) != 0); }
+ bool hasExplicitThis() { return ((callConv & CORINFO_CALLCONV_EXPLICITTHIS) != 0); }
+ unsigned totalILArgs() { return (numArgs + hasThis()); }
+ bool isVarArg() { return ((getCallConv() == CORINFO_CALLCONV_VARARG) || (getCallConv() == CORINFO_CALLCONV_NATIVEVARARG)); }
+ bool hasTypeArg() { return ((callConv & CORINFO_CALLCONV_PARAMTYPE) != 0); }
+};
+
+struct CORINFO_METHOD_INFO
+{
+ CORINFO_METHOD_HANDLE ftn;
+ CORINFO_MODULE_HANDLE scope;
+ BYTE * ILCode;
+ unsigned ILCodeSize;
+ unsigned maxStack;
+ unsigned EHcount;
+ CorInfoOptions options;
+ CorInfoRegionKind regionKind;
+ CORINFO_SIG_INFO args;
+ CORINFO_SIG_INFO locals;
+};
+
+//----------------------------------------------------------------------------
+// Looking up handles and addresses.
+//
+// When the JIT requests a handle, the EE may direct the JIT that it must
+// access the handle in a variety of ways. These are packed as
+// CORINFO_CONST_LOOKUP
+// or CORINFO_LOOKUP (contains either a CORINFO_CONST_LOOKUP or a CORINFO_RUNTIME_LOOKUP)
+//
+// Constant Lookups v. Runtime Lookups (i.e. when will Runtime Lookups be generated?)
+// -----------------------------------------------------------------------------------
+//
+// CORINFO_LOOKUP_KIND is part of the result type of embedGenericHandle,
+// getVirtualCallInfo and any other functions that may require a
+// runtime lookup when compiling shared generic code.
+//
+// CORINFO_LOOKUP_KIND indicates whether a particular token in the instruction stream can be:
+// (a) Mapped to a handle (type, field or method) at compile-time (!needsRuntimeLookup)
+// (b) Must be looked up at run-time, and if so which runtime lookup technique should be used (see below)
+//
+// If the JIT or EE does not support code sharing for generic code, then
+// all CORINFO_LOOKUP results will be "constant lookups", i.e.
+// the needsRuntimeLookup of CORINFO_LOOKUP.lookupKind.needsRuntimeLookup
+// will be false.
+//
+// Constant Lookups
+// ----------------
+//
+// Constant Lookups are either:
+// IAT_VALUE: immediate (relocatable) values,
+// IAT_PVALUE: immediate values access via an indirection through an immediate (relocatable) address
+// IAT_PPVALUE: immediate values access via a double indirection through an immediate (relocatable) address
+//
+// Runtime Lookups
+// ---------------
+//
+// CORINFO_LOOKUP_KIND is part of the result type of embedGenericHandle,
+// getVirtualCallInfo and any other functions that may require a
+// runtime lookup when compiling shared generic code.
+//
+// CORINFO_LOOKUP_KIND indicates whether a particular token in the instruction stream can be:
+// (a) Mapped to a handle (type, field or method) at compile-time (!needsRuntimeLookup)
+// (b) Must be looked up at run-time using the class dictionary
+// stored in the vtable of the this pointer (needsRuntimeLookup && THISOBJ)
+// (c) Must be looked up at run-time using the method dictionary
+// stored in the method descriptor parameter passed to a generic
+// method (needsRuntimeLookup && METHODPARAM)
+// (d) Must be looked up at run-time using the class dictionary stored
+// in the vtable parameter passed to a method in a generic
+// struct (needsRuntimeLookup && CLASSPARAM)
+
+struct CORINFO_CONST_LOOKUP
+{
+ // If the handle is obtained at compile-time, then this handle is the "exact" handle (class, method, or field)
+ // Otherwise, it's a representative...
+ // If accessType is
+ // IAT_VALUE --> "handle" stores the real handle or "addr " stores the computed address
+ // IAT_PVALUE --> "addr" stores a pointer to a location which will hold the real handle
+ // IAT_PPVALUE --> "addr" stores a double indirection to a location which will hold the real handle
+
+ InfoAccessType accessType;
+ union
+ {
+ CORINFO_GENERIC_HANDLE handle;
+ void * addr;
+ };
+};
+
+enum CORINFO_RUNTIME_LOOKUP_KIND
+{
+ CORINFO_LOOKUP_THISOBJ,
+ CORINFO_LOOKUP_METHODPARAM,
+ CORINFO_LOOKUP_CLASSPARAM,
+};
+
+#if COR_JIT_EE_VERSION > 460
+
+struct CORINFO_LOOKUP_KIND
+{
+ bool needsRuntimeLookup;
+ CORINFO_RUNTIME_LOOKUP_KIND runtimeLookupKind;
+
+ // The 'runtimeLookupFlags' and 'runtimeLookupArgs' fields
+ // are just for internal VM / ZAP communication, not to be used by the JIT.
+ WORD runtimeLookupFlags;
+ void * runtimeLookupArgs;
+} ;
+
+#else
+
+struct CORINFO_LOOKUP_KIND
+{
+ bool needsRuntimeLookup;
+ CORINFO_RUNTIME_LOOKUP_KIND runtimeLookupKind;
+} ;
+
+#endif
+
+
+// CORINFO_RUNTIME_LOOKUP indicates the details of the runtime lookup
+// operation to be performed.
+//
+// CORINFO_MAXINDIRECTIONS is the maximum number of
+// indirections used by runtime lookups.
+// This accounts for up to 2 indirections to get at a dictionary followed by a possible spill slot
+//
+#define CORINFO_MAXINDIRECTIONS 4
+#define CORINFO_USEHELPER ((WORD) 0xffff)
+
+struct CORINFO_RUNTIME_LOOKUP
+{
+ // This is signature you must pass back to the runtime lookup helper
+ LPVOID signature;
+
+ // Here is the helper you must call. It is one of CORINFO_HELP_RUNTIMEHANDLE_* helpers.
+ CorInfoHelpFunc helper;
+
+ // Number of indirections to get there
+ // CORINFO_USEHELPER = don't know how to get it, so use helper function at run-time instead
+ // 0 = use the this pointer itself (e.g. token is C<!0> inside code in sealed class C)
+ // or method desc itself (e.g. token is method void M::mymeth<!!0>() inside code in M::mymeth)
+ // Otherwise, follow each byte-offset stored in the "offsets[]" array (may be negative)
+ WORD indirections;
+
+ // If set, test for null and branch to helper if null
+ bool testForNull;
+
+ // If set, test the lowest bit and dereference if set (see code:FixupPointer)
+ bool testForFixup;
+
+ SIZE_T offsets[CORINFO_MAXINDIRECTIONS];
+} ;
+
+// Result of calling embedGenericHandle
+struct CORINFO_LOOKUP
+{
+ CORINFO_LOOKUP_KIND lookupKind;
+
+ union
+ {
+ // If kind.needsRuntimeLookup then this indicates how to do the lookup
+ CORINFO_RUNTIME_LOOKUP runtimeLookup;
+
+ // If the handle is obtained at compile-time, then this handle is the "exact" handle (class, method, or field)
+ // Otherwise, it's a representative... If accessType is
+ // IAT_VALUE --> "handle" stores the real handle or "addr " stores the computed address
+ // IAT_PVALUE --> "addr" stores a pointer to a location which will hold the real handle
+ // IAT_PPVALUE --> "addr" stores a double indirection to a location which will hold the real handle
+ CORINFO_CONST_LOOKUP constLookup;
+ };
+};
+
+enum CorInfoGenericHandleType
+{
+ CORINFO_HANDLETYPE_UNKNOWN,
+ CORINFO_HANDLETYPE_CLASS,
+ CORINFO_HANDLETYPE_METHOD,
+ CORINFO_HANDLETYPE_FIELD
+};
+
+//----------------------------------------------------------------------------
+// Embedding type, method and field handles (for "ldtoken" or to pass back to helpers)
+
+// Result of calling embedGenericHandle
+struct CORINFO_GENERICHANDLE_RESULT
+{
+ CORINFO_LOOKUP lookup;
+
+ // compileTimeHandle is guaranteed to be either NULL or a handle that is usable during compile time.
+ // It must not be embedded in the code because it might not be valid at run-time.
+ CORINFO_GENERIC_HANDLE compileTimeHandle;
+
+ // Type of the result
+ CorInfoGenericHandleType handleType;
+};
+
+#define CORINFO_ACCESS_ALLOWED_MAX_ARGS 4
+
+enum CorInfoAccessAllowedHelperArgType
+{
+ CORINFO_HELPER_ARG_TYPE_Invalid = 0,
+ CORINFO_HELPER_ARG_TYPE_Field = 1,
+ CORINFO_HELPER_ARG_TYPE_Method = 2,
+ CORINFO_HELPER_ARG_TYPE_Class = 3,
+ CORINFO_HELPER_ARG_TYPE_Module = 4,
+ CORINFO_HELPER_ARG_TYPE_Const = 5,
+};
+struct CORINFO_HELPER_ARG
+{
+ union
+ {
+ CORINFO_FIELD_HANDLE fieldHandle;
+ CORINFO_METHOD_HANDLE methodHandle;
+ CORINFO_CLASS_HANDLE classHandle;
+ CORINFO_MODULE_HANDLE moduleHandle;
+ size_t constant;
+ };
+ CorInfoAccessAllowedHelperArgType argType;
+
+ void Set(CORINFO_METHOD_HANDLE handle)
+ {
+ argType = CORINFO_HELPER_ARG_TYPE_Method;
+ methodHandle = handle;
+ }
+
+ void Set(CORINFO_FIELD_HANDLE handle)
+ {
+ argType = CORINFO_HELPER_ARG_TYPE_Field;
+ fieldHandle = handle;
+ }
+
+ void Set(CORINFO_CLASS_HANDLE handle)
+ {
+ argType = CORINFO_HELPER_ARG_TYPE_Class;
+ classHandle = handle;
+ }
+
+ void Set(size_t value)
+ {
+ argType = CORINFO_HELPER_ARG_TYPE_Const;
+ constant = value;
+ }
+};
+
+struct CORINFO_HELPER_DESC
+{
+ CorInfoHelpFunc helperNum;
+ unsigned numArgs;
+ CORINFO_HELPER_ARG args[CORINFO_ACCESS_ALLOWED_MAX_ARGS];
+};
+
+//----------------------------------------------------------------------------
+// getCallInfo and CORINFO_CALL_INFO: The EE instructs the JIT about how to make a call
+//
+// callKind
+// --------
+//
+// CORINFO_CALL :
+// Indicates that the JIT can use getFunctionEntryPoint to make a call,
+// i.e. there is nothing abnormal about the call. The JITs know what to do if they get this.
+// Except in the case of constraint calls (see below), [targetMethodHandle] will hold
+// the CORINFO_METHOD_HANDLE that a call to findMethod would
+// have returned.
+// This flag may be combined with nullInstanceCheck=TRUE for uses of callvirt on methods that can
+// be resolved at compile-time (non-virtual, final or sealed).
+//
+// CORINFO_CALL_CODE_POINTER (shared generic code only) :
+// Indicates that the JIT should do an indirect call to the entrypoint given by address, which may be specified
+// as a runtime lookup by CORINFO_CALL_INFO::codePointerLookup.
+// [targetMethodHandle] will not hold a valid value.
+// This flag may be combined with nullInstanceCheck=TRUE for uses of callvirt on methods whose target method can
+// be resolved at compile-time but whose instantiation can be resolved only through runtime lookup.
+//
+// CORINFO_VIRTUALCALL_STUB (interface calls) :
+// Indicates that the EE supports "stub dispatch" and request the JIT to make a
+// "stub dispatch" call (an indirect call through CORINFO_CALL_INFO::stubLookup,
+// similar to CORINFO_CALL_CODE_POINTER).
+// "Stub dispatch" is a specialized calling sequence (that may require use of NOPs)
+// which allow the runtime to determine the call-site after the call has been dispatched.
+// If the call is too complex for the JIT (e.g. because
+// fetching the dispatch stub requires a runtime lookup, i.e. lookupKind.needsRuntimeLookup
+// is set) then the JIT is allowed to implement the call as if it were CORINFO_VIRTUALCALL_LDVIRTFTN
+// [targetMethodHandle] will hold the CORINFO_METHOD_HANDLE that a call to findMethod would
+// have returned.
+// This flag is always accompanied by nullInstanceCheck=TRUE.
+//
+// CORINFO_VIRTUALCALL_LDVIRTFTN (virtual generic methods) :
+// Indicates that the EE provides no way to implement the call directly and
+// that the JIT should use a LDVIRTFTN sequence (as implemented by CORINFO_HELP_VIRTUAL_FUNC_PTR)
+// followed by an indirect call.
+// [targetMethodHandle] will hold the CORINFO_METHOD_HANDLE that a call to findMethod would
+// have returned.
+// This flag is always accompanied by nullInstanceCheck=TRUE though typically the null check will
+// be implicit in the access through the instance pointer.
+//
+// CORINFO_VIRTUALCALL_VTABLE (regular virtual methods) :
+// Indicates that the EE supports vtable dispatch and that the JIT should use getVTableOffset etc.
+// to implement the call.
+// [targetMethodHandle] will hold the CORINFO_METHOD_HANDLE that a call to findMethod would
+// have returned.
+// This flag is always accompanied by nullInstanceCheck=TRUE though typically the null check will
+// be implicit in the access through the instance pointer.
+//
+// thisTransform and constraint calls
+// ----------------------------------
+//
+// For evertyhing besides "constrained." calls "thisTransform" is set to
+// CORINFO_NO_THIS_TRANSFORM.
+//
+// For "constrained." calls the EE attempts to resolve the call at compile
+// time to a more specific method, or (shared generic code only) to a runtime lookup
+// for a code pointer for the more specific method.
+//
+// In order to permit this, the "this" pointer supplied for a "constrained." call
+// is a byref to an arbitrary type (see the IL spec). The "thisTransform" field
+// will indicate how the JIT must transform the "this" pointer in order
+// to be able to call the resolved method:
+//
+// CORINFO_NO_THIS_TRANSFORM --> Leave it as a byref to an unboxed value type
+// CORINFO_BOX_THIS --> Box it to produce an object
+// CORINFO_DEREF_THIS --> Deref the byref to get an object reference
+//
+// In addition, the "kind" field will be set as follows for constraint calls:
+
+// CORINFO_CALL --> the call was resolved at compile time, and
+// can be compiled like a normal call.
+// CORINFO_CALL_CODE_POINTER --> the call was resolved, but the target address will be
+// computed at runtime. Only returned for shared generic code.
+// CORINFO_VIRTUALCALL_STUB,
+// CORINFO_VIRTUALCALL_LDVIRTFTN,
+// CORINFO_VIRTUALCALL_VTABLE --> usual values indicating that a virtual call must be made
+
+enum CORINFO_CALL_KIND
+{
+ CORINFO_CALL,
+ CORINFO_CALL_CODE_POINTER,
+ CORINFO_VIRTUALCALL_STUB,
+ CORINFO_VIRTUALCALL_LDVIRTFTN,
+ CORINFO_VIRTUALCALL_VTABLE
+};
+
+
+
+enum CORINFO_THIS_TRANSFORM
+{
+ CORINFO_NO_THIS_TRANSFORM,
+ CORINFO_BOX_THIS,
+ CORINFO_DEREF_THIS
+};
+
+enum CORINFO_CALLINFO_FLAGS
+{
+ CORINFO_CALLINFO_NONE = 0x0000,
+ CORINFO_CALLINFO_ALLOWINSTPARAM = 0x0001, // Can the compiler generate code to pass an instantiation parameters? Simple compilers should not use this flag
+ CORINFO_CALLINFO_CALLVIRT = 0x0002, // Is it a virtual call?
+ CORINFO_CALLINFO_KINDONLY = 0x0004, // This is set to only query the kind of call to perform, without getting any other information
+ CORINFO_CALLINFO_VERIFICATION = 0x0008, // Gets extra verification information.
+ CORINFO_CALLINFO_SECURITYCHECKS = 0x0010, // Perform security checks.
+ CORINFO_CALLINFO_LDFTN = 0x0020, // Resolving target of LDFTN
+ CORINFO_CALLINFO_ATYPICAL_CALLSITE = 0x0040, // Atypical callsite that cannot be disassembled by delay loading helper
+};
+
+enum CorInfoIsAccessAllowedResult
+{
+ CORINFO_ACCESS_ALLOWED = 0, // Call allowed
+ CORINFO_ACCESS_ILLEGAL = 1, // Call not allowed
+ CORINFO_ACCESS_RUNTIME_CHECK = 2, // Ask at runtime whether to allow the call or not
+};
+
+
+// This enum is used for JIT to tell EE where this token comes from.
+// E.g. Depending on different opcodes, we might allow/disallow certain types of tokens or
+// return different types of handles (e.g. boxed vs. regular entrypoints)
+enum CorInfoTokenKind
+{
+ CORINFO_TOKENKIND_Class = 0x01,
+ CORINFO_TOKENKIND_Method = 0x02,
+ CORINFO_TOKENKIND_Field = 0x04,
+ CORINFO_TOKENKIND_Mask = 0x07,
+
+ // token comes from CEE_LDTOKEN
+ CORINFO_TOKENKIND_Ldtoken = 0x10 | CORINFO_TOKENKIND_Class | CORINFO_TOKENKIND_Method | CORINFO_TOKENKIND_Field,
+
+ // token comes from CEE_CASTCLASS or CEE_ISINST
+ CORINFO_TOKENKIND_Casting = 0x20 | CORINFO_TOKENKIND_Class,
+
+ // token comes from CEE_NEWARR
+ CORINFO_TOKENKIND_Newarr = 0x40 | CORINFO_TOKENKIND_Class,
+
+ // token comes from CEE_BOX
+ CORINFO_TOKENKIND_Box = 0x80 | CORINFO_TOKENKIND_Class,
+
+ // token comes from CEE_CONSTRAINED
+ CORINFO_TOKENKIND_Constrained = 0x100 | CORINFO_TOKENKIND_Class,
+
+#if COR_JIT_EE_VERSION > 460
+ // token comes from CEE_NEWOBJ
+ CORINFO_TOKENKIND_NewObj = 0x200 | CORINFO_TOKENKIND_Method,
+#endif
+};
+
+struct CORINFO_RESOLVED_TOKEN
+{
+ //
+ // [In] arguments of resolveToken
+ //
+ CORINFO_CONTEXT_HANDLE tokenContext; //Context for resolution of generic arguments
+ CORINFO_MODULE_HANDLE tokenScope;
+ mdToken token; //The source token
+ CorInfoTokenKind tokenType;
+
+ //
+ // [Out] arguments of resolveToken.
+ // - Type handle is always non-NULL.
+ // - At most one of method and field handles is non-NULL (according to the token type).
+ // - Method handle is an instantiating stub only for generic methods. Type handle
+ // is required to provide the full context for methods in generic types.
+ //
+ CORINFO_CLASS_HANDLE hClass;
+ CORINFO_METHOD_HANDLE hMethod;
+ CORINFO_FIELD_HANDLE hField;
+
+ //
+ // [Out] TypeSpec and MethodSpec signatures for generics. NULL otherwise.
+ //
+ PCCOR_SIGNATURE pTypeSpec;
+ ULONG cbTypeSpec;
+ PCCOR_SIGNATURE pMethodSpec;
+ ULONG cbMethodSpec;
+};
+
+struct CORINFO_CALL_INFO
+{
+ CORINFO_METHOD_HANDLE hMethod; //target method handle
+ unsigned methodFlags; //flags for the target method
+
+ unsigned classFlags; //flags for CORINFO_RESOLVED_TOKEN::hClass
+
+ CORINFO_SIG_INFO sig;
+
+ //Verification information
+ unsigned verMethodFlags; // flags for CORINFO_RESOLVED_TOKEN::hMethod
+ CORINFO_SIG_INFO verSig;
+ //All of the regular method data is the same... hMethod might not be the same as CORINFO_RESOLVED_TOKEN::hMethod
+
+
+ //If set to:
+ // - CORINFO_ACCESS_ALLOWED - The access is allowed.
+ // - CORINFO_ACCESS_ILLEGAL - This access cannot be allowed (i.e. it is public calling private). The
+ // JIT may either insert the callsiteCalloutHelper into the code (as per a verification error) or
+ // call throwExceptionFromHelper on the callsiteCalloutHelper. In this case callsiteCalloutHelper
+ // is guaranteed not to return.
+ // - CORINFO_ACCESS_RUNTIME_CHECK - The jit must insert the callsiteCalloutHelper at the call site.
+ // the helper may return
+ CorInfoIsAccessAllowedResult accessAllowed;
+ CORINFO_HELPER_DESC callsiteCalloutHelper;
+
+ // See above section on constraintCalls to understand when these are set to unusual values.
+ CORINFO_THIS_TRANSFORM thisTransform;
+
+ CORINFO_CALL_KIND kind;
+ BOOL nullInstanceCheck;
+
+ // Context for inlining and hidden arg
+ CORINFO_CONTEXT_HANDLE contextHandle;
+ BOOL exactContextNeedsRuntimeLookup; // Set if contextHandle is approx handle. Runtime lookup is required to get the exact handle.
+
+ // If kind.CORINFO_VIRTUALCALL_STUB then stubLookup will be set.
+ // If kind.CORINFO_CALL_CODE_POINTER then entryPointLookup will be set.
+ union
+ {
+ CORINFO_LOOKUP stubLookup;
+
+ CORINFO_LOOKUP codePointerLookup;
+ };
+
+ CORINFO_CONST_LOOKUP instParamLookup; // Used by Ready-to-Run
+
+ BOOL secureDelegateInvoke;
+};
+
+//----------------------------------------------------------------------------
+// getFieldInfo and CORINFO_FIELD_INFO: The EE instructs the JIT about how to access a field
+
+enum CORINFO_FIELD_ACCESSOR
+{
+ CORINFO_FIELD_INSTANCE, // regular instance field at given offset from this-ptr
+ CORINFO_FIELD_INSTANCE_WITH_BASE, // instance field with base offset (used by Ready-to-Run)
+ CORINFO_FIELD_INSTANCE_HELPER, // instance field accessed using helper (arguments are this, FieldDesc * and the value)
+ CORINFO_FIELD_INSTANCE_ADDR_HELPER, // instance field accessed using address-of helper (arguments are this and FieldDesc *)
+
+ CORINFO_FIELD_STATIC_ADDRESS, // field at given address
+ CORINFO_FIELD_STATIC_RVA_ADDRESS, // RVA field at given address
+ CORINFO_FIELD_STATIC_SHARED_STATIC_HELPER, // static field accessed using the "shared static" helper (arguments are ModuleID + ClassID)
+ CORINFO_FIELD_STATIC_GENERICS_STATIC_HELPER, // static field access using the "generic static" helper (argument is MethodTable *)
+ CORINFO_FIELD_STATIC_ADDR_HELPER, // static field accessed using address-of helper (argument is FieldDesc *)
+ CORINFO_FIELD_STATIC_TLS, // unmanaged TLS access
+
+ CORINFO_FIELD_INTRINSIC_ZERO, // intrinsic zero (IntPtr.Zero, UIntPtr.Zero)
+ CORINFO_FIELD_INTRINSIC_EMPTY_STRING, // intrinsic emptry string (String.Empty)
+};
+
+// Set of flags returned in CORINFO_FIELD_INFO::fieldFlags
+enum CORINFO_FIELD_FLAGS
+{
+ CORINFO_FLG_FIELD_STATIC = 0x00000001,
+ CORINFO_FLG_FIELD_UNMANAGED = 0x00000002, // RVA field
+ CORINFO_FLG_FIELD_FINAL = 0x00000004,
+ CORINFO_FLG_FIELD_STATIC_IN_HEAP = 0x00000008, // See code:#StaticFields. This static field is in the GC heap as a boxed object
+ CORINFO_FLG_FIELD_SAFESTATIC_BYREF_RETURN = 0x00000010, // Field can be returned safely (has GC heap lifetime)
+ CORINFO_FLG_FIELD_INITCLASS = 0x00000020, // initClass has to be called before accessing the field
+ CORINFO_FLG_FIELD_PROTECTED = 0x00000040,
+};
+
+struct CORINFO_FIELD_INFO
+{
+ CORINFO_FIELD_ACCESSOR fieldAccessor;
+ unsigned fieldFlags;
+
+ // Helper to use if the field access requires it
+ CorInfoHelpFunc helper;
+
+ // Field offset if there is one
+ DWORD offset;
+
+ CorInfoType fieldType;
+ CORINFO_CLASS_HANDLE structType; //possibly null
+
+ //See CORINFO_CALL_INFO.accessAllowed
+ CorInfoIsAccessAllowedResult accessAllowed;
+ CORINFO_HELPER_DESC accessCalloutHelper;
+
+ CORINFO_CONST_LOOKUP fieldLookup; // Used by Ready-to-Run
+};
+
+//----------------------------------------------------------------------------
+// Exception handling
+
+struct CORINFO_EH_CLAUSE
+{
+ CORINFO_EH_CLAUSE_FLAGS Flags;
+ DWORD TryOffset;
+ DWORD TryLength;
+ DWORD HandlerOffset;
+ DWORD HandlerLength;
+ union
+ {
+ DWORD ClassToken; // use for type-based exception handlers
+ DWORD FilterOffset; // use for filter-based exception handlers (COR_ILEXCEPTION_FILTER is set)
+ };
+};
+
+enum CORINFO_OS
+{
+ CORINFO_WINNT,
+ CORINFO_PAL,
+};
+
+struct CORINFO_CPU
+{
+ DWORD dwCPUType;
+ DWORD dwFeatures;
+ DWORD dwExtendedFeatures;
+};
+
+enum CORINFO_RUNTIME_ABI
+{
+ CORINFO_DESKTOP_ABI = 0x100,
+ CORINFO_CORECLR_ABI = 0x200,
+ CORINFO_CORERT_ABI = 0x300,
+};
+
+// For some highly optimized paths, the JIT must generate code that directly
+// manipulates internal EE data structures. The getEEInfo() helper returns
+// this structure containing the needed offsets and values.
+struct CORINFO_EE_INFO
+{
+ // Information about the InlinedCallFrame structure layout
+ struct InlinedCallFrameInfo
+ {
+ // Size of the Frame structure
+ unsigned size;
+
+ unsigned offsetOfGSCookie;
+ unsigned offsetOfFrameVptr;
+ unsigned offsetOfFrameLink;
+ unsigned offsetOfCallSiteSP;
+ unsigned offsetOfCalleeSavedFP;
+ unsigned offsetOfCallTarget;
+ unsigned offsetOfReturnAddress;
+ }
+ inlinedCallFrameInfo;
+
+ // Offsets into the Thread structure
+ unsigned offsetOfThreadFrame; // offset of the current Frame
+ unsigned offsetOfGCState; // offset of the preemptive/cooperative state of the Thread
+
+ // Delegate offsets
+ unsigned offsetOfDelegateInstance;
+ unsigned offsetOfDelegateFirstTarget;
+
+ // Secure delegate offsets
+ unsigned offsetOfSecureDelegateIndirectCell;
+
+ // Remoting offsets
+ unsigned offsetOfTransparentProxyRP;
+ unsigned offsetOfRealProxyServer;
+
+ // Array offsets
+ unsigned offsetOfObjArrayData;
+
+#if COR_JIT_EE_VERSION > 460
+ // Reverse PInvoke offsets
+ unsigned sizeOfReversePInvokeFrame;
+
+ // OS Page size
+ size_t osPageSize;
+
+ // Null object offset
+ size_t maxUncheckedOffsetForNullObject;
+
+ // Target ABI. Combined with target architecture and OS to determine
+ // GC, EH, and unwind styles.
+ CORINFO_RUNTIME_ABI targetAbi;
+#endif
+
+ CORINFO_OS osType;
+ unsigned osMajor;
+ unsigned osMinor;
+ unsigned osBuild;
+};
+
+// This is used to indicate that a finally has been called
+// "locally" by the try block
+enum { LCL_FINALLY_MARK = 0xFC }; // FC = "Finally Call"
+
+/**********************************************************************************
+ * The following is the internal structure of an object that the compiler knows about
+ * when it generates code
+ **********************************************************************************/
+
+#if COR_JIT_EE_VERSION <= 460
+
+#define CORINFO_PAGE_SIZE 0x1000 // the page size on the machine
+
+#ifndef FEATURE_PAL
+#define MAX_UNCHECKED_OFFSET_FOR_NULL_OBJECT ((32*1024)-1) // when generating JIT code
+#else // !FEATURE_PAL
+#define MAX_UNCHECKED_OFFSET_FOR_NULL_OBJECT ((OS_PAGE_SIZE / 2) - 1)
+#endif // !FEATURE_PAL
+
+#endif // COR_JIT_EE_VERISION <= 460
+
+#include <pshpack4.h>
+
+typedef void* CORINFO_MethodPtr; // a generic method pointer
+
+struct CORINFO_Object
+{
+ CORINFO_MethodPtr *methTable; // the vtable for the object
+};
+
+struct CORINFO_String : public CORINFO_Object
+{
+ unsigned stringLen;
+ wchar_t chars[1]; // actually of variable size
+};
+
+struct CORINFO_Array : public CORINFO_Object
+{
+ unsigned length;
+#ifdef _WIN64
+ unsigned alignpad;
+#endif // _WIN64
+
+#if 0
+ /* Multi-dimensional arrays have the lengths and bounds here */
+ unsigned dimLength[length];
+ unsigned dimBound[length];
+#endif
+
+ union
+ {
+ __int8 i1Elems[1]; // actually of variable size
+ unsigned __int8 u1Elems[1];
+ __int16 i2Elems[1];
+ unsigned __int16 u2Elems[1];
+ __int32 i4Elems[1];
+ unsigned __int32 u4Elems[1];
+ float r4Elems[1];
+ };
+};
+
+#include <pshpack4.h>
+struct CORINFO_Array8 : public CORINFO_Object
+{
+ unsigned length;
+#ifdef _WIN64
+ unsigned alignpad;
+#endif // _WIN64
+
+ union
+ {
+ double r8Elems[1];
+ __int64 i8Elems[1];
+ unsigned __int64 u8Elems[1];
+ };
+};
+
+#include <poppack.h>
+
+struct CORINFO_RefArray : public CORINFO_Object
+{
+ unsigned length;
+#ifdef _WIN64
+ unsigned alignpad;
+#endif // _WIN64
+
+#if 0
+ /* Multi-dimensional arrays have the lengths and bounds here */
+ unsigned dimLength[length];
+ unsigned dimBound[length];
+#endif
+
+ CORINFO_Object* refElems[1]; // actually of variable size;
+};
+
+struct CORINFO_RefAny
+{
+ void * dataPtr;
+ CORINFO_CLASS_HANDLE type;
+};
+
+// The jit assumes the CORINFO_VARARGS_HANDLE is a pointer to a subclass of this
+struct CORINFO_VarArgInfo
+{
+ unsigned argBytes; // number of bytes the arguments take up.
+ // (The CORINFO_VARARGS_HANDLE counts as an arg)
+};
+
+#include <poppack.h>
+
+enum CorInfoSecurityRuntimeChecks
+{
+ CORINFO_ACCESS_SECURITY_NONE = 0,
+ CORINFO_ACCESS_SECURITY_TRANSPARENCY = 0x0001 // check that transparency rules are enforced between the caller and callee
+};
+
+
+/* data to optimize delegate construction */
+struct DelegateCtorArgs
+{
+ void * pMethod;
+ void * pArg3;
+ void * pArg4;
+ void * pArg5;
+};
+
+// use offsetof to get the offset of the fields above
+#include <stddef.h> // offsetof
+#ifndef offsetof
+#define offsetof(s,m) ((size_t)&(((s *)0)->m))
+#endif
+
+// Guard-stack cookie for preventing against stack buffer overruns
+typedef SIZE_T GSCookie;
+
+#include "cordebuginfo.h"
+
+/**********************************************************************************/
+// Some compilers cannot arbitrarily allow the handler nesting level to grow
+// arbitrarily during Edit'n'Continue.
+// This is the maximum nesting level that a compiler needs to support for EnC
+
+const int MAX_EnC_HANDLER_NESTING_LEVEL = 6;
+
+//
+// This interface is logically split into sections for each class of information
+// (ICorMethodInfo, ICorModuleInfo, etc.). This split used to exist physically as well
+// using virtual inheritance, but was eliminated to improve efficiency of the JIT-EE
+// interface calls.
+//
+class ICorStaticInfo
+{
+public:
+ /**********************************************************************************/
+ //
+ // ICorMethodInfo
+ //
+ /**********************************************************************************/
+
+ // return flags (defined above, CORINFO_FLG_PUBLIC ...)
+ virtual DWORD getMethodAttribs (
+ CORINFO_METHOD_HANDLE ftn /* IN */
+ ) = 0;
+
+ // sets private JIT flags, which can be, retrieved using getAttrib.
+ virtual void setMethodAttribs (
+ CORINFO_METHOD_HANDLE ftn, /* IN */
+ CorInfoMethodRuntimeFlags attribs /* IN */
+ ) = 0;
+
+ // Given a method descriptor ftnHnd, extract signature information into sigInfo
+ //
+ // 'memberParent' is typically only set when verifying. It should be the
+ // result of calling getMemberParent.
+ virtual void getMethodSig (
+ CORINFO_METHOD_HANDLE ftn, /* IN */
+ CORINFO_SIG_INFO *sig, /* OUT */
+ CORINFO_CLASS_HANDLE memberParent = NULL /* IN */
+ ) = 0;
+
+ /*********************************************************************
+ * Note the following methods can only be used on functions known
+ * to be IL. This includes the method being compiled and any method
+ * that 'getMethodInfo' returns true for
+ *********************************************************************/
+
+ // return information about a method private to the implementation
+ // returns false if method is not IL, or is otherwise unavailable.
+ // This method is used to fetch data needed to inline functions
+ virtual bool getMethodInfo (
+ CORINFO_METHOD_HANDLE ftn, /* IN */
+ CORINFO_METHOD_INFO* info /* OUT */
+ ) = 0;
+
+ // Decides if you have any limitations for inlining. If everything's OK, it will return
+ // INLINE_PASS and will fill out pRestrictions with a mask of restrictions the caller of this
+ // function must respect. If caller passes pRestrictions = NULL, if there are any restrictions
+ // INLINE_FAIL will be returned
+ //
+ // The callerHnd must be the immediate caller (i.e. when we have a chain of inlined calls)
+ //
+ // The inlined method need not be verified
+
+ virtual CorInfoInline canInline (
+ CORINFO_METHOD_HANDLE callerHnd, /* IN */
+ CORINFO_METHOD_HANDLE calleeHnd, /* IN */
+ DWORD* pRestrictions /* OUT */
+ ) = 0;
+
+ // Reports whether or not a method can be inlined, and why. canInline is responsible for reporting all
+ // inlining results when it returns INLINE_FAIL and INLINE_NEVER. All other results are reported by the
+ // JIT.
+ virtual void reportInliningDecision (CORINFO_METHOD_HANDLE inlinerHnd,
+ CORINFO_METHOD_HANDLE inlineeHnd,
+ CorInfoInline inlineResult,
+ const char * reason) = 0;
+
+
+ // Returns false if the call is across security boundaries thus we cannot tailcall
+ //
+ // The callerHnd must be the immediate caller (i.e. when we have a chain of inlined calls)
+ virtual bool canTailCall (
+ CORINFO_METHOD_HANDLE callerHnd, /* IN */
+ CORINFO_METHOD_HANDLE declaredCalleeHnd, /* IN */
+ CORINFO_METHOD_HANDLE exactCalleeHnd, /* IN */
+ bool fIsTailPrefix /* IN */
+ ) = 0;
+
+ // Reports whether or not a method can be tail called, and why.
+ // canTailCall is responsible for reporting all results when it returns
+ // false. All other results are reported by the JIT.
+ virtual void reportTailCallDecision (CORINFO_METHOD_HANDLE callerHnd,
+ CORINFO_METHOD_HANDLE calleeHnd,
+ bool fIsTailPrefix,
+ CorInfoTailCall tailCallResult,
+ const char * reason) = 0;
+
+ // get individual exception handler
+ virtual void getEHinfo(
+ CORINFO_METHOD_HANDLE ftn, /* IN */
+ unsigned EHnumber, /* IN */
+ CORINFO_EH_CLAUSE* clause /* OUT */
+ ) = 0;
+
+ // return class it belongs to
+ virtual CORINFO_CLASS_HANDLE getMethodClass (
+ CORINFO_METHOD_HANDLE method
+ ) = 0;
+
+ // return module it belongs to
+ virtual CORINFO_MODULE_HANDLE getMethodModule (
+ CORINFO_METHOD_HANDLE method
+ ) = 0;
+
+ // This function returns the offset of the specified method in the
+ // vtable of it's owning class or interface.
+ virtual void getMethodVTableOffset (
+ CORINFO_METHOD_HANDLE method, /* IN */
+ unsigned* offsetOfIndirection, /* OUT */
+ unsigned* offsetAfterIndirection /* OUT */
+ ) = 0;
+
+ // If a method's attributes have (getMethodAttribs) CORINFO_FLG_INTRINSIC set,
+ // getIntrinsicID() returns the intrinsic ID.
+ // *pMustExpand tells whether or not JIT must expand the intrinsic.
+#if COR_JIT_EE_VERSION > 460
+ virtual CorInfoIntrinsics getIntrinsicID(
+ CORINFO_METHOD_HANDLE method,
+ bool* pMustExpand = NULL /* OUT */
+ ) = 0;
+#else
+ virtual CorInfoIntrinsics getIntrinsicID(
+ CORINFO_METHOD_HANDLE method
+ ) = 0;
+#endif
+
+ // Is the given module the System.Numerics.Vectors module?
+ // This defaults to false.
+ virtual bool isInSIMDModule(
+ CORINFO_CLASS_HANDLE classHnd
+ ) { return false; }
+
+ // return the unmanaged calling convention for a PInvoke
+ virtual CorInfoUnmanagedCallConv getUnmanagedCallConv(
+ CORINFO_METHOD_HANDLE method
+ ) = 0;
+
+ // return if any marshaling is required for PInvoke methods. Note that
+ // method == 0 => calli. The call site sig is only needed for the varargs or calli case
+ virtual BOOL pInvokeMarshalingRequired(
+ CORINFO_METHOD_HANDLE method,
+ CORINFO_SIG_INFO* callSiteSig
+ ) = 0;
+
+ // Check constraints on method type arguments (only).
+ // The parent class should be checked separately using satisfiesClassConstraints(parent).
+ virtual BOOL satisfiesMethodConstraints(
+ CORINFO_CLASS_HANDLE parent, // the exact parent of the method
+ CORINFO_METHOD_HANDLE method
+ ) = 0;
+
+ // Given a delegate target class, a target method parent class, a target method,
+ // a delegate class, check if the method signature is compatible with the Invoke method of the delegate
+ // (under the typical instantiation of any free type variables in the memberref signatures).
+ virtual BOOL isCompatibleDelegate(
+ CORINFO_CLASS_HANDLE objCls, /* type of the delegate target, if any */
+ CORINFO_CLASS_HANDLE methodParentCls, /* exact parent of the target method, if any */
+ CORINFO_METHOD_HANDLE method, /* (representative) target method, if any */
+ CORINFO_CLASS_HANDLE delegateCls, /* exact type of the delegate */
+ BOOL *pfIsOpenDelegate /* is the delegate open */
+ ) = 0;
+
+ // Determines whether the delegate creation obeys security transparency rules
+ virtual BOOL isDelegateCreationAllowed (
+ CORINFO_CLASS_HANDLE delegateHnd,
+ CORINFO_METHOD_HANDLE calleeHnd
+ ) = 0;
+
+
+ // Indicates if the method is an instance of the generic
+ // method that passes (or has passed) verification
+ virtual CorInfoInstantiationVerification isInstantiationOfVerifiedGeneric (
+ CORINFO_METHOD_HANDLE method /* IN */
+ ) = 0;
+
+ // Loads the constraints on a typical method definition, detecting cycles;
+ // for use in verification.
+ virtual void initConstraintsForVerification(
+ CORINFO_METHOD_HANDLE method, /* IN */
+ BOOL *pfHasCircularClassConstraints, /* OUT */
+ BOOL *pfHasCircularMethodConstraint /* OUT */
+ ) = 0;
+
+ // Returns enum whether the method does not require verification
+ // Also see ICorModuleInfo::canSkipVerification
+ virtual CorInfoCanSkipVerificationResult canSkipMethodVerification (
+ CORINFO_METHOD_HANDLE ftnHandle
+ ) = 0;
+
+ // load and restore the method
+ virtual void methodMustBeLoadedBeforeCodeIsRun(
+ CORINFO_METHOD_HANDLE method
+ ) = 0;
+
+ virtual CORINFO_METHOD_HANDLE mapMethodDeclToMethodImpl(
+ CORINFO_METHOD_HANDLE method
+ ) = 0;
+
+ // Returns the global cookie for the /GS unsafe buffer checks
+ // The cookie might be a constant value (JIT), or a handle to memory location (Ngen)
+ virtual void getGSCookie(
+ GSCookie * pCookieVal, // OUT
+ GSCookie ** ppCookieVal // OUT
+ ) = 0;
+
+ /**********************************************************************************/
+ //
+ // ICorModuleInfo
+ //
+ /**********************************************************************************/
+
+ // Resolve metadata token into runtime method handles. This function may not
+ // return normally (e.g. it may throw) if it encounters invalid metadata or other
+ // failures during token resolution.
+ virtual void resolveToken(/* IN, OUT */ CORINFO_RESOLVED_TOKEN * pResolvedToken) = 0;
+
+#if COR_JIT_EE_VERSION > 460
+ // Attempt to resolve a metadata token into a runtime method handle. Returns true
+ // if resolution succeeded and false otherwise (e.g. if it encounters invalid metadata
+ // during token reoslution). This method should be used instead of `resolveToken` in
+ // situations that need to be resilient to invalid metadata.
+ virtual bool tryResolveToken(/* IN, OUT */ CORINFO_RESOLVED_TOKEN * pResolvedToken) = 0;
+#endif
+
+ // Signature information about the call sig
+ virtual void findSig (
+ CORINFO_MODULE_HANDLE module, /* IN */
+ unsigned sigTOK, /* IN */
+ CORINFO_CONTEXT_HANDLE context, /* IN */
+ CORINFO_SIG_INFO *sig /* OUT */
+ ) = 0;
+
+ // for Varargs, the signature at the call site may differ from
+ // the signature at the definition. Thus we need a way of
+ // fetching the call site information
+ virtual void findCallSiteSig (
+ CORINFO_MODULE_HANDLE module, /* IN */
+ unsigned methTOK, /* IN */
+ CORINFO_CONTEXT_HANDLE context, /* IN */
+ CORINFO_SIG_INFO *sig /* OUT */
+ ) = 0;
+
+ virtual CORINFO_CLASS_HANDLE getTokenTypeAsHandle (
+ CORINFO_RESOLVED_TOKEN * pResolvedToken /* IN */) = 0;
+
+ // Returns true if the module does not require verification
+ //
+ // If fQuickCheckOnlyWithoutCommit=TRUE, the function only checks that the
+ // module does not currently require verification in the current AppDomain.
+ // This decision could change in the future, and so should not be cached.
+ // If it is cached, it should only be used as a hint.
+ // This is only used by ngen for calculating certain hints.
+ //
+
+ // Returns enum whether the module does not require verification
+ // Also see ICorMethodInfo::canSkipMethodVerification();
+ virtual CorInfoCanSkipVerificationResult canSkipVerification (
+ CORINFO_MODULE_HANDLE module /* IN */
+ ) = 0;
+
+ // Checks if the given metadata token is valid
+ virtual BOOL isValidToken (
+ CORINFO_MODULE_HANDLE module, /* IN */
+ unsigned metaTOK /* IN */
+ ) = 0;
+
+ // Checks if the given metadata token is valid StringRef
+ virtual BOOL isValidStringRef (
+ CORINFO_MODULE_HANDLE module, /* IN */
+ unsigned metaTOK /* IN */
+ ) = 0;
+
+ virtual BOOL shouldEnforceCallvirtRestriction(
+ CORINFO_MODULE_HANDLE scope
+ ) = 0;
+
+ /**********************************************************************************/
+ //
+ // ICorClassInfo
+ //
+ /**********************************************************************************/
+
+ // If the value class 'cls' is isomorphic to a primitive type it will
+ // return that type, otherwise it will return CORINFO_TYPE_VALUECLASS
+ virtual CorInfoType asCorInfoType (
+ CORINFO_CLASS_HANDLE cls
+ ) = 0;
+
+ // for completeness
+ virtual const char* getClassName (
+ CORINFO_CLASS_HANDLE cls
+ ) = 0;
+
+
+ // Append a (possibly truncated) representation of the type cls to the preallocated buffer ppBuf of length pnBufLen
+ // If fNamespace=TRUE, include the namespace/enclosing classes
+ // If fFullInst=TRUE (regardless of fNamespace and fAssembly), include namespace and assembly for any type parameters
+ // If fAssembly=TRUE, suffix with a comma and the full assembly qualification
+ // return size of representation
+ virtual int appendClassName(
+ __deref_inout_ecount(*pnBufLen) WCHAR** ppBuf,
+ int* pnBufLen,
+ CORINFO_CLASS_HANDLE cls,
+ BOOL fNamespace,
+ BOOL fFullInst,
+ BOOL fAssembly
+ ) = 0;
+
+ // Quick check whether the type is a value class. Returns the same value as getClassAttribs(cls) & CORINFO_FLG_VALUECLASS, except faster.
+ virtual BOOL isValueClass(CORINFO_CLASS_HANDLE cls) = 0;
+
+ // If this method returns true, JIT will do optimization to inline the check for
+ // GetTypeFromHandle(handle) == obj.GetType()
+ virtual BOOL canInlineTypeCheckWithObjectVTable(CORINFO_CLASS_HANDLE cls) = 0;
+
+ // return flags (defined above, CORINFO_FLG_PUBLIC ...)
+ virtual DWORD getClassAttribs (
+ CORINFO_CLASS_HANDLE cls
+ ) = 0;
+
+ // Returns "TRUE" iff "cls" is a struct type such that return buffers used for returning a value
+ // of this type must be stack-allocated. This will generally be true only if the struct
+ // contains GC pointers, and does not exceed some size limit. Maintaining this as an invariant allows
+ // an optimization: the JIT may assume that return buffer pointers for return types for which this predicate
+ // returns TRUE are always stack allocated, and thus, that stores to the GC-pointer fields of such return
+ // buffers do not require GC write barriers.
+ virtual BOOL isStructRequiringStackAllocRetBuf(CORINFO_CLASS_HANDLE cls) = 0;
+
+ virtual CORINFO_MODULE_HANDLE getClassModule (
+ CORINFO_CLASS_HANDLE cls
+ ) = 0;
+
+ // Returns the assembly that contains the module "mod".
+ virtual CORINFO_ASSEMBLY_HANDLE getModuleAssembly (
+ CORINFO_MODULE_HANDLE mod
+ ) = 0;
+
+ // Returns the name of the assembly "assem".
+ virtual const char* getAssemblyName (
+ CORINFO_ASSEMBLY_HANDLE assem
+ ) = 0;
+
+ // Allocate and delete process-lifetime objects. Should only be
+ // referred to from static fields, lest a leak occur.
+ // Note that "LongLifetimeFree" does not execute destructors, if "obj"
+ // is an array of a struct type with a destructor.
+ virtual void* LongLifetimeMalloc(size_t sz) = 0;
+ virtual void LongLifetimeFree(void* obj) = 0;
+
+ virtual size_t getClassModuleIdForStatics (
+ CORINFO_CLASS_HANDLE cls,
+ CORINFO_MODULE_HANDLE *pModule,
+ void **ppIndirection
+ ) = 0;
+
+ // return the number of bytes needed by an instance of the class
+ virtual unsigned getClassSize (
+ CORINFO_CLASS_HANDLE cls
+ ) = 0;
+
+ virtual unsigned getClassAlignmentRequirement (
+ CORINFO_CLASS_HANDLE cls,
+ BOOL fDoubleAlignHint = FALSE
+ ) = 0;
+
+ // This is only called for Value classes. It returns a boolean array
+ // in representing of 'cls' from a GC perspective. The class is
+ // assumed to be an array of machine words
+ // (of length // getClassSize(cls) / sizeof(void*)),
+ // 'gcPtrs' is a poitner to an array of BYTEs of this length.
+ // getClassGClayout fills in this array so that gcPtrs[i] is set
+ // to one of the CorInfoGCType values which is the GC type of
+ // the i-th machine word of an object of type 'cls'
+ // returns the number of GC pointers in the array
+ virtual unsigned getClassGClayout (
+ CORINFO_CLASS_HANDLE cls, /* IN */
+ BYTE *gcPtrs /* OUT */
+ ) = 0;
+
+ // returns the number of instance fields in a class
+ virtual unsigned getClassNumInstanceFields (
+ CORINFO_CLASS_HANDLE cls /* IN */
+ ) = 0;
+
+ virtual CORINFO_FIELD_HANDLE getFieldInClass(
+ CORINFO_CLASS_HANDLE clsHnd,
+ INT num
+ ) = 0;
+
+ virtual BOOL checkMethodModifier(
+ CORINFO_METHOD_HANDLE hMethod,
+ LPCSTR modifier,
+ BOOL fOptional
+ ) = 0;
+
+ // returns the "NEW" helper optimized for "newCls."
+ virtual CorInfoHelpFunc getNewHelper(
+ CORINFO_RESOLVED_TOKEN * pResolvedToken,
+ CORINFO_METHOD_HANDLE callerHandle
+ ) = 0;
+
+ // returns the newArr (1-Dim array) helper optimized for "arrayCls."
+ virtual CorInfoHelpFunc getNewArrHelper(
+ CORINFO_CLASS_HANDLE arrayCls
+ ) = 0;
+
+ // returns the optimized "IsInstanceOf" or "ChkCast" helper
+ virtual CorInfoHelpFunc getCastingHelper(
+ CORINFO_RESOLVED_TOKEN * pResolvedToken,
+ bool fThrowing
+ ) = 0;
+
+ // returns helper to trigger static constructor
+ virtual CorInfoHelpFunc getSharedCCtorHelper(
+ CORINFO_CLASS_HANDLE clsHnd
+ ) = 0;
+
+ virtual CorInfoHelpFunc getSecurityPrologHelper(
+ CORINFO_METHOD_HANDLE ftn
+ ) = 0;
+
+ // This is not pretty. Boxing nullable<T> actually returns
+ // a boxed<T> not a boxed Nullable<T>. This call allows the verifier
+ // to call back to the EE on the 'box' instruction and get the transformed
+ // type to use for verification.
+ virtual CORINFO_CLASS_HANDLE getTypeForBox(
+ CORINFO_CLASS_HANDLE cls
+ ) = 0;
+
+ // returns the correct box helper for a particular class. Note
+ // that if this returns CORINFO_HELP_BOX, the JIT can assume
+ // 'standard' boxing (allocate object and copy), and optimize
+ virtual CorInfoHelpFunc getBoxHelper(
+ CORINFO_CLASS_HANDLE cls
+ ) = 0;
+
+ // returns the unbox helper. If 'helperCopies' points to a true
+ // value it means the JIT is requesting a helper that unboxes the
+ // value into a particular location and thus has the signature
+ // void unboxHelper(void* dest, CORINFO_CLASS_HANDLE cls, Object* obj)
+ // Otherwise (it is null or points at a FALSE value) it is requesting
+ // a helper that returns a poitner to the unboxed data
+ // void* unboxHelper(CORINFO_CLASS_HANDLE cls, Object* obj)
+ // The EE has the option of NOT returning the copy style helper
+ // (But must be able to always honor the non-copy style helper)
+ // The EE set 'helperCopies' on return to indicate what kind of
+ // helper has been created.
+
+ virtual CorInfoHelpFunc getUnBoxHelper(
+ CORINFO_CLASS_HANDLE cls
+ ) = 0;
+
+#if COR_JIT_EE_VERSION > 460
+ virtual bool getReadyToRunHelper(
+ CORINFO_RESOLVED_TOKEN * pResolvedToken,
+ CORINFO_LOOKUP_KIND * pGenericLookupKind,
+ CorInfoHelpFunc id,
+ CORINFO_CONST_LOOKUP * pLookup
+ ) = 0;
+
+ virtual void getReadyToRunDelegateCtorHelper(
+ CORINFO_RESOLVED_TOKEN * pTargetMethod,
+ CORINFO_CLASS_HANDLE delegateType,
+ CORINFO_CONST_LOOKUP * pLookup
+ ) = 0;
+#else
+ virtual void getReadyToRunHelper(
+ CORINFO_RESOLVED_TOKEN * pResolvedToken,
+ CorInfoHelpFunc id,
+ CORINFO_CONST_LOOKUP * pLookup
+ ) = 0;
+#endif
+
+
+ virtual const char* getHelperName(
+ CorInfoHelpFunc
+ ) = 0;
+
+ // This function tries to initialize the class (run the class constructor).
+ // this function returns whether the JIT must insert helper calls before
+ // accessing static field or method.
+ //
+ // See code:ICorClassInfo#ClassConstruction.
+ virtual CorInfoInitClassResult initClass(
+ CORINFO_FIELD_HANDLE field, // Non-NULL - inquire about cctor trigger before static field access
+ // NULL - inquire about cctor trigger in method prolog
+ CORINFO_METHOD_HANDLE method, // Method referencing the field or prolog
+ CORINFO_CONTEXT_HANDLE context, // Exact context of method
+ BOOL speculative = FALSE // TRUE means don't actually run it
+ ) = 0;
+
+ // This used to be called "loadClass". This records the fact
+ // that the class must be loaded (including restored if necessary) before we execute the
+ // code that we are currently generating. When jitting code
+ // the function loads the class immediately. When zapping code
+ // the zapper will if necessary use the call to record the fact that we have
+ // to do a fixup/restore before running the method currently being generated.
+ //
+ // This is typically used to ensure value types are loaded before zapped
+ // code that manipulates them is executed, so that the GC can access information
+ // about those value types.
+ virtual void classMustBeLoadedBeforeCodeIsRun(
+ CORINFO_CLASS_HANDLE cls
+ ) = 0;
+
+ // returns the class handle for the special builtin classes
+ virtual CORINFO_CLASS_HANDLE getBuiltinClass (
+ CorInfoClassId classId
+ ) = 0;
+
+ // "System.Int32" ==> CORINFO_TYPE_INT..
+ virtual CorInfoType getTypeForPrimitiveValueClass(
+ CORINFO_CLASS_HANDLE cls
+ ) = 0;
+
+ // TRUE if child is a subtype of parent
+ // if parent is an interface, then does child implement / extend parent
+ virtual BOOL canCast(
+ CORINFO_CLASS_HANDLE child, // subtype (extends parent)
+ CORINFO_CLASS_HANDLE parent // base type
+ ) = 0;
+
+ // TRUE if cls1 and cls2 are considered equivalent types.
+ virtual BOOL areTypesEquivalent(
+ CORINFO_CLASS_HANDLE cls1,
+ CORINFO_CLASS_HANDLE cls2
+ ) = 0;
+
+ // returns is the intersection of cls1 and cls2.
+ virtual CORINFO_CLASS_HANDLE mergeClasses(
+ CORINFO_CLASS_HANDLE cls1,
+ CORINFO_CLASS_HANDLE cls2
+ ) = 0;
+
+ // Given a class handle, returns the Parent type.
+ // For COMObjectType, it returns Class Handle of System.Object.
+ // Returns 0 if System.Object is passed in.
+ virtual CORINFO_CLASS_HANDLE getParentType (
+ CORINFO_CLASS_HANDLE cls
+ ) = 0;
+
+ // Returns the CorInfoType of the "child type". If the child type is
+ // not a primitive type, *clsRet will be set.
+ // Given an Array of Type Foo, returns Foo.
+ // Given BYREF Foo, returns Foo
+ virtual CorInfoType getChildType (
+ CORINFO_CLASS_HANDLE clsHnd,
+ CORINFO_CLASS_HANDLE *clsRet
+ ) = 0;
+
+ // Check constraints on type arguments of this class and parent classes
+ virtual BOOL satisfiesClassConstraints(
+ CORINFO_CLASS_HANDLE cls
+ ) = 0;
+
+ // Check if this is a single dimensional array type
+ virtual BOOL isSDArray(
+ CORINFO_CLASS_HANDLE cls
+ ) = 0;
+
+ // Get the numbmer of dimensions in an array
+ virtual unsigned getArrayRank(
+ CORINFO_CLASS_HANDLE cls
+ ) = 0;
+
+ // Get static field data for an array
+ virtual void * getArrayInitializationData(
+ CORINFO_FIELD_HANDLE field,
+ DWORD size
+ ) = 0;
+
+ // Check Visibility rules.
+ virtual CorInfoIsAccessAllowedResult canAccessClass(
+ CORINFO_RESOLVED_TOKEN * pResolvedToken,
+ CORINFO_METHOD_HANDLE callerHandle,
+ CORINFO_HELPER_DESC *pAccessHelper /* If canAccessMethod returns something other
+ than ALLOWED, then this is filled in. */
+ ) = 0;
+
+ /**********************************************************************************/
+ //
+ // ICorFieldInfo
+ //
+ /**********************************************************************************/
+
+ // this function is for debugging only. It returns the field name
+ // and if 'moduleName' is non-null, it sets it to something that will
+ // says which method (a class name, or a module name)
+ virtual const char* getFieldName (
+ CORINFO_FIELD_HANDLE ftn, /* IN */
+ const char **moduleName /* OUT */
+ ) = 0;
+
+ // return class it belongs to
+ virtual CORINFO_CLASS_HANDLE getFieldClass (
+ CORINFO_FIELD_HANDLE field
+ ) = 0;
+
+ // Return the field's type, if it is CORINFO_TYPE_VALUECLASS 'structType' is set
+ // the field's value class (if 'structType' == 0, then don't bother
+ // the structure info).
+ //
+ // 'memberParent' is typically only set when verifying. It should be the
+ // result of calling getMemberParent.
+ virtual CorInfoType getFieldType(
+ CORINFO_FIELD_HANDLE field,
+ CORINFO_CLASS_HANDLE *structType,
+ CORINFO_CLASS_HANDLE memberParent = NULL /* IN */
+ ) = 0;
+
+ // return the data member's instance offset
+ virtual unsigned getFieldOffset(
+ CORINFO_FIELD_HANDLE field
+ ) = 0;
+
+ // TODO: jit64 should be switched to the same plan as the i386 jits - use
+ // getClassGClayout to figure out the need for writebarrier helper, and inline the copying.
+ // The interpretted value class copy is slow. Once this happens, USE_WRITE_BARRIER_HELPERS
+ virtual bool isWriteBarrierHelperRequired(
+ CORINFO_FIELD_HANDLE field) = 0;
+
+ virtual void getFieldInfo (CORINFO_RESOLVED_TOKEN * pResolvedToken,
+ CORINFO_METHOD_HANDLE callerHandle,
+ CORINFO_ACCESS_FLAGS flags,
+ CORINFO_FIELD_INFO *pResult
+ ) = 0;
+
+ // Returns true iff "fldHnd" represents a static field.
+ virtual bool isFieldStatic(CORINFO_FIELD_HANDLE fldHnd) = 0;
+
+ /*********************************************************************************/
+ //
+ // ICorDebugInfo
+ //
+ /*********************************************************************************/
+
+ // Query the EE to find out where interesting break points
+ // in the code are. The native compiler will ensure that these places
+ // have a corresponding break point in native code.
+ //
+ // Note that unless CORJIT_FLG_DEBUG_CODE is specified, this function will
+ // be used only as a hint and the native compiler should not change its
+ // code generation.
+ virtual void getBoundaries(
+ CORINFO_METHOD_HANDLE ftn, // [IN] method of interest
+ unsigned int *cILOffsets, // [OUT] size of pILOffsets
+ DWORD **pILOffsets, // [OUT] IL offsets of interest
+ // jit MUST free with freeArray!
+ ICorDebugInfo::BoundaryTypes *implictBoundaries // [OUT] tell jit, all boundries of this type
+ ) = 0;
+
+ // Report back the mapping from IL to native code,
+ // this map should include all boundaries that 'getBoundaries'
+ // reported as interesting to the debugger.
+
+ // Note that debugger (and profiler) is assuming that all of the
+ // offsets form a contiguous block of memory, and that the
+ // OffsetMapping is sorted in order of increasing native offset.
+ virtual void setBoundaries(
+ CORINFO_METHOD_HANDLE ftn, // [IN] method of interest
+ ULONG32 cMap, // [IN] size of pMap
+ ICorDebugInfo::OffsetMapping *pMap // [IN] map including all points of interest.
+ // jit allocated with allocateArray, EE frees
+ ) = 0;
+
+ // Query the EE to find out the scope of local varables.
+ // normally the JIT would trash variables after last use, but
+ // under debugging, the JIT needs to keep them live over their
+ // entire scope so that they can be inspected.
+ //
+ // Note that unless CORJIT_FLG_DEBUG_CODE is specified, this function will
+ // be used only as a hint and the native compiler should not change its
+ // code generation.
+ virtual void getVars(
+ CORINFO_METHOD_HANDLE ftn, // [IN] method of interest
+ ULONG32 *cVars, // [OUT] size of 'vars'
+ ICorDebugInfo::ILVarInfo **vars, // [OUT] scopes of variables of interest
+ // jit MUST free with freeArray!
+ bool *extendOthers // [OUT] it TRUE, then assume the scope
+ // of unmentioned vars is entire method
+ ) = 0;
+
+ // Report back to the EE the location of every variable.
+ // note that the JIT might split lifetimes into different
+ // locations etc.
+
+ virtual void setVars(
+ CORINFO_METHOD_HANDLE ftn, // [IN] method of interest
+ ULONG32 cVars, // [IN] size of 'vars'
+ ICorDebugInfo::NativeVarInfo *vars // [IN] map telling where local vars are stored at what points
+ // jit allocated with allocateArray, EE frees
+ ) = 0;
+
+ /*-------------------------- Misc ---------------------------------------*/
+
+ // Used to allocate memory that needs to handed to the EE.
+ // For eg, use this to allocated memory for reporting debug info,
+ // which will be handed to the EE by setVars() and setBoundaries()
+ virtual void * allocateArray(
+ ULONG cBytes
+ ) = 0;
+
+ // JitCompiler will free arrays passed by the EE using this
+ // For eg, The EE returns memory in getVars() and getBoundaries()
+ // to the JitCompiler, which the JitCompiler should release using
+ // freeArray()
+ virtual void freeArray(
+ void *array
+ ) = 0;
+
+ /*********************************************************************************/
+ //
+ // ICorArgInfo
+ //
+ /*********************************************************************************/
+
+ // advance the pointer to the argument list.
+ // a ptr of 0, is special and always means the first argument
+ virtual CORINFO_ARG_LIST_HANDLE getArgNext (
+ CORINFO_ARG_LIST_HANDLE args /* IN */
+ ) = 0;
+
+ // Get the type of a particular argument
+ // CORINFO_TYPE_UNDEF is returned when there are no more arguments
+ // If the type returned is a primitive type (or an enum) *vcTypeRet set to NULL
+ // otherwise it is set to the TypeHandle associted with the type
+ // Enumerations will always look their underlying type (probably should fix this)
+ // Otherwise vcTypeRet is the type as would be seen by the IL,
+ // The return value is the type that is used for calling convention purposes
+ // (Thus if the EE wants a value class to be passed like an int, then it will
+ // return CORINFO_TYPE_INT
+ virtual CorInfoTypeWithMod getArgType (
+ CORINFO_SIG_INFO* sig, /* IN */
+ CORINFO_ARG_LIST_HANDLE args, /* IN */
+ CORINFO_CLASS_HANDLE *vcTypeRet /* OUT */
+ ) = 0;
+
+ // If the Arg is a CORINFO_TYPE_CLASS fetch the class handle associated with it
+ virtual CORINFO_CLASS_HANDLE getArgClass (
+ CORINFO_SIG_INFO* sig, /* IN */
+ CORINFO_ARG_LIST_HANDLE args /* IN */
+ ) = 0;
+
+ // Returns type of HFA for valuetype
+ virtual CorInfoType getHFAType (
+ CORINFO_CLASS_HANDLE hClass
+ ) = 0;
+
+ /*****************************************************************************
+ * ICorErrorInfo contains methods to deal with SEH exceptions being thrown
+ * from the corinfo interface. These methods may be called when an exception
+ * with code EXCEPTION_COMPLUS is caught.
+ *****************************************************************************/
+
+ // Returns the HRESULT of the current exception
+ virtual HRESULT GetErrorHRESULT(
+ struct _EXCEPTION_POINTERS *pExceptionPointers
+ ) = 0;
+
+ // Fetches the message of the current exception
+ // Returns the size of the message (including terminating null). This can be
+ // greater than bufferLength if the buffer is insufficient.
+ virtual ULONG GetErrorMessage(
+ __inout_ecount(bufferLength) LPWSTR buffer,
+ ULONG bufferLength
+ ) = 0;
+
+ // returns EXCEPTION_EXECUTE_HANDLER if it is OK for the compile to handle the
+ // exception, abort some work (like the inlining) and continue compilation
+ // returns EXCEPTION_CONTINUE_SEARCH if exception must always be handled by the EE
+ // things like ThreadStoppedException ...
+ // returns EXCEPTION_CONTINUE_EXECUTION if exception is fixed up by the EE
+
+ virtual int FilterException(
+ struct _EXCEPTION_POINTERS *pExceptionPointers
+ ) = 0;
+
+ // Cleans up internal EE tracking when an exception is caught.
+ virtual void HandleException(
+ struct _EXCEPTION_POINTERS *pExceptionPointers
+ ) = 0;
+
+ virtual void ThrowExceptionForJitResult(
+ HRESULT result) = 0;
+
+ //Throws an exception defined by the given throw helper.
+ virtual void ThrowExceptionForHelper(
+ const CORINFO_HELPER_DESC * throwHelper) = 0;
+
+#if COR_JIT_EE_VERSION > 460
+ // Runs the given function under an error trap. This allows the JIT to make calls
+ // to interface functions that may throw exceptions without needing to be aware of
+ // the EH ABI, exception types, etc. Returns true if the given function completed
+ // successfully and false otherwise.
+ virtual bool runWithErrorTrap(
+ void (*function)(void*), // The function to run
+ void* parameter // The context parameter that will be passed to the function and the handler
+ ) = 0;
+#endif
+
+/*****************************************************************************
+ * ICorStaticInfo contains EE interface methods which return values that are
+ * constant from invocation to invocation. Thus they may be embedded in
+ * persisted information like statically generated code. (This is of course
+ * assuming that all code versions are identical each time.)
+ *****************************************************************************/
+
+ // Return details about EE internal data structures
+ virtual void getEEInfo(
+ CORINFO_EE_INFO *pEEInfoOut
+ ) = 0;
+
+ // Returns name of the JIT timer log
+ virtual LPCWSTR getJitTimeLogFilename() = 0;
+
+ /*********************************************************************************/
+ //
+ // Diagnostic methods
+ //
+ /*********************************************************************************/
+
+ // this function is for debugging only. Returns method token.
+ // Returns mdMethodDefNil for dynamic methods.
+ virtual mdMethodDef getMethodDefFromMethod(
+ CORINFO_METHOD_HANDLE hMethod
+ ) = 0;
+
+ // this function is for debugging only. It returns the method name
+ // and if 'moduleName' is non-null, it sets it to something that will
+ // says which method (a class name, or a module name)
+ virtual const char* getMethodName (
+ CORINFO_METHOD_HANDLE ftn, /* IN */
+ const char **moduleName /* OUT */
+ ) = 0;
+
+ // this function is for debugging only. It returns a value that
+ // is will always be the same for a given method. It is used
+ // to implement the 'jitRange' functionality
+ virtual unsigned getMethodHash (
+ CORINFO_METHOD_HANDLE ftn /* IN */
+ ) = 0;
+
+ // this function is for debugging only.
+ virtual size_t findNameOfToken (
+ CORINFO_MODULE_HANDLE module, /* IN */
+ mdToken metaTOK, /* IN */
+ __out_ecount (FQNameCapacity) char * szFQName, /* OUT */
+ size_t FQNameCapacity /* IN */
+ ) = 0;
+
+#if COR_JIT_EE_VERSION > 460
+
+ // returns whether the struct is enregisterable. Only valid on a System V VM. Returns true on success, false on failure.
+ virtual bool getSystemVAmd64PassStructInRegisterDescriptor(
+ /* IN */ CORINFO_CLASS_HANDLE structHnd,
+ /* OUT */ SYSTEMV_AMD64_CORINFO_STRUCT_REG_PASSING_DESCRIPTOR* structPassInRegDescPtr
+ ) = 0;
+
+#endif // COR_JIT_EE_VERSION
+
+};
+
+/*****************************************************************************
+ * ICorDynamicInfo contains EE interface methods which return values that may
+ * change from invocation to invocation. They cannot be embedded in persisted
+ * data; they must be requeried each time the EE is run.
+ *****************************************************************************/
+
+class ICorDynamicInfo : public ICorStaticInfo
+{
+public:
+
+ //
+ // These methods return values to the JIT which are not constant
+ // from session to session.
+ //
+ // These methods take an extra parameter : void **ppIndirection.
+ // If a JIT supports generation of prejit code (install-o-jit), it
+ // must pass a non-null value for this parameter, and check the
+ // resulting value. If *ppIndirection is NULL, code should be
+ // generated normally. If non-null, then the value of
+ // *ppIndirection is an address in the cookie table, and the code
+ // generator needs to generate an indirection through the table to
+ // get the resulting value. In this case, the return result of the
+ // function must NOT be directly embedded in the generated code.
+ //
+ // Note that if a JIT does not support prejit code generation, it
+ // may ignore the extra parameter & pass the default of NULL - the
+ // prejit ICorDynamicInfo implementation will see this & generate
+ // an error if the jitter is used in a prejit scenario.
+ //
+
+ // Return details about EE internal data structures
+
+ virtual DWORD getThreadTLSIndex(
+ void **ppIndirection = NULL
+ ) = 0;
+
+ virtual const void * getInlinedCallFrameVptr(
+ void **ppIndirection = NULL
+ ) = 0;
+
+ virtual LONG * getAddrOfCaptureThreadGlobal(
+ void **ppIndirection = NULL
+ ) = 0;
+
+ virtual SIZE_T* getAddrModuleDomainID(CORINFO_MODULE_HANDLE module) = 0;
+
+ // return the native entry point to an EE helper (see CorInfoHelpFunc)
+ virtual void* getHelperFtn (
+ CorInfoHelpFunc ftnNum,
+ void **ppIndirection = NULL
+ ) = 0;
+
+ // return a callable address of the function (native code). This function
+ // may return a different value (depending on whether the method has
+ // been JITed or not.
+ virtual void getFunctionEntryPoint(
+ CORINFO_METHOD_HANDLE ftn, /* IN */
+ CORINFO_CONST_LOOKUP * pResult, /* OUT */
+ CORINFO_ACCESS_FLAGS accessFlags = CORINFO_ACCESS_ANY) = 0;
+
+ // return a directly callable address. This can be used similarly to the
+ // value returned by getFunctionEntryPoint() except that it is
+ // guaranteed to be multi callable entrypoint.
+ virtual void getFunctionFixedEntryPoint(
+ CORINFO_METHOD_HANDLE ftn,
+ CORINFO_CONST_LOOKUP * pResult) = 0;
+
+ // get the synchronization handle that is passed to monXstatic function
+ virtual void* getMethodSync(
+ CORINFO_METHOD_HANDLE ftn,
+ void **ppIndirection = NULL
+ ) = 0;
+
+ // get slow lazy string literal helper to use (CORINFO_HELP_STRCNS*).
+ // Returns CORINFO_HELP_UNDEF if lazy string literal helper cannot be used.
+ virtual CorInfoHelpFunc getLazyStringLiteralHelper(
+ CORINFO_MODULE_HANDLE handle
+ ) = 0;
+
+ virtual CORINFO_MODULE_HANDLE embedModuleHandle(
+ CORINFO_MODULE_HANDLE handle,
+ void **ppIndirection = NULL
+ ) = 0;
+
+ virtual CORINFO_CLASS_HANDLE embedClassHandle(
+ CORINFO_CLASS_HANDLE handle,
+ void **ppIndirection = NULL
+ ) = 0;
+
+ virtual CORINFO_METHOD_HANDLE embedMethodHandle(
+ CORINFO_METHOD_HANDLE handle,
+ void **ppIndirection = NULL
+ ) = 0;
+
+ virtual CORINFO_FIELD_HANDLE embedFieldHandle(
+ CORINFO_FIELD_HANDLE handle,
+ void **ppIndirection = NULL
+ ) = 0;
+
+ // Given a module scope (module), a method handle (context) and
+ // a metadata token (metaTOK), fetch the handle
+ // (type, field or method) associated with the token.
+ // If this is not possible at compile-time (because the current method's
+ // code is shared and the token contains generic parameters)
+ // then indicate how the handle should be looked up at run-time.
+ //
+ virtual void embedGenericHandle(
+ CORINFO_RESOLVED_TOKEN * pResolvedToken,
+ BOOL fEmbedParent, // TRUE - embeds parent type handle of the field/method handle
+ CORINFO_GENERICHANDLE_RESULT * pResult) = 0;
+
+ // Return information used to locate the exact enclosing type of the current method.
+ // Used only to invoke .cctor method from code shared across generic instantiations
+ // !needsRuntimeLookup statically known (enclosing type of method itself)
+ // needsRuntimeLookup:
+ // CORINFO_LOOKUP_THISOBJ use vtable pointer of 'this' param
+ // CORINFO_LOOKUP_CLASSPARAM use vtable hidden param
+ // CORINFO_LOOKUP_METHODPARAM use enclosing type of method-desc hidden param
+ virtual CORINFO_LOOKUP_KIND getLocationOfThisType(
+ CORINFO_METHOD_HANDLE context
+ ) = 0;
+
+ // NOTE: the two methods below--getPInvokeUnmanagedTarget and getAddressOfPInvokeFixup--are
+ // deprecated. New code (i.e. anything that can depend on COR_JIT_EE_VERSION being
+ // greater than 460) should instead use getAddressOfPInvokeTarget, which subsumes the
+ // functionality of these methods.
+
+ // return the unmanaged target *if method has already been prelinked.*
+ virtual void* getPInvokeUnmanagedTarget(
+ CORINFO_METHOD_HANDLE method,
+ void **ppIndirection = NULL
+ ) = 0;
+
+ // return address of fixup area for late-bound PInvoke calls.
+ virtual void* getAddressOfPInvokeFixup(
+ CORINFO_METHOD_HANDLE method,
+ void **ppIndirection = NULL
+ ) = 0;
+
+#if COR_JIT_EE_VERSION > 460
+ // return the address of the PInvoke target. May be a fixup area in the
+ // case of late-bound PInvoke calls.
+ virtual void getAddressOfPInvokeTarget(
+ CORINFO_METHOD_HANDLE method,
+ CORINFO_CONST_LOOKUP *pLookup
+ ) = 0;
+#endif
+
+ // Generate a cookie based on the signature that would needs to be passed
+ // to CORINFO_HELP_PINVOKE_CALLI
+ virtual LPVOID GetCookieForPInvokeCalliSig(
+ CORINFO_SIG_INFO* szMetaSig,
+ void ** ppIndirection = NULL
+ ) = 0;
+
+ // returns true if a VM cookie can be generated for it (might be false due to cross-module
+ // inlining, in which case the inlining should be aborted)
+ virtual bool canGetCookieForPInvokeCalliSig(
+ CORINFO_SIG_INFO* szMetaSig
+ ) = 0;
+
+ // Gets a handle that is checked to see if the current method is
+ // included in "JustMyCode"
+ virtual CORINFO_JUST_MY_CODE_HANDLE getJustMyCodeHandle(
+ CORINFO_METHOD_HANDLE method,
+ CORINFO_JUST_MY_CODE_HANDLE**ppIndirection = NULL
+ ) = 0;
+
+ // Gets a method handle that can be used to correlate profiling data.
+ // This is the IP of a native method, or the address of the descriptor struct
+ // for IL. Always guaranteed to be unique per process, and not to move. */
+ virtual void GetProfilingHandle(
+ BOOL *pbHookFunction,
+ void **pProfilerHandle,
+ BOOL *pbIndirectedHandles
+ ) = 0;
+
+ // Returns instructions on how to make the call. See code:CORINFO_CALL_INFO for possible return values.
+ virtual void getCallInfo(
+ // Token info
+ CORINFO_RESOLVED_TOKEN * pResolvedToken,
+
+ //Generics info
+ CORINFO_RESOLVED_TOKEN * pConstrainedResolvedToken,
+
+ //Security info
+ CORINFO_METHOD_HANDLE callerHandle,
+
+ //Jit info
+ CORINFO_CALLINFO_FLAGS flags,
+
+ //out params
+ CORINFO_CALL_INFO *pResult
+ ) = 0;
+
+ virtual BOOL canAccessFamily(CORINFO_METHOD_HANDLE hCaller,
+ CORINFO_CLASS_HANDLE hInstanceType) = 0;
+
+ // Returns TRUE if the Class Domain ID is the RID of the class (currently true for every class
+ // except reflection emitted classes and generics)
+ virtual BOOL isRIDClassDomainID(CORINFO_CLASS_HANDLE cls) = 0;
+
+ // returns the class's domain ID for accessing shared statics
+ virtual unsigned getClassDomainID (
+ CORINFO_CLASS_HANDLE cls,
+ void **ppIndirection = NULL
+ ) = 0;
+
+
+ // return the data's address (for static fields only)
+ virtual void* getFieldAddress(
+ CORINFO_FIELD_HANDLE field,
+ void **ppIndirection = NULL
+ ) = 0;
+
+ // registers a vararg sig & returns a VM cookie for it (which can contain other stuff)
+ virtual CORINFO_VARARGS_HANDLE getVarArgsHandle(
+ CORINFO_SIG_INFO *pSig,
+ void **ppIndirection = NULL
+ ) = 0;
+
+ // returns true if a VM cookie can be generated for it (might be false due to cross-module
+ // inlining, in which case the inlining should be aborted)
+ virtual bool canGetVarArgsHandle(
+ CORINFO_SIG_INFO *pSig
+ ) = 0;
+
+ // Allocate a string literal on the heap and return a handle to it
+ virtual InfoAccessType constructStringLiteral(
+ CORINFO_MODULE_HANDLE module,
+ mdToken metaTok,
+ void **ppValue
+ ) = 0;
+
+ virtual InfoAccessType emptyStringLiteral(
+ void **ppValue
+ ) = 0;
+
+ // (static fields only) given that 'field' refers to thread local store,
+ // return the ID (TLS index), which is used to find the begining of the
+ // TLS data area for the particular DLL 'field' is associated with.
+ virtual DWORD getFieldThreadLocalStoreID (
+ CORINFO_FIELD_HANDLE field,
+ void **ppIndirection = NULL
+ ) = 0;
+
+ // Sets another object to intercept calls to "self" and current method being compiled
+ virtual void setOverride(
+ ICorDynamicInfo *pOverride,
+ CORINFO_METHOD_HANDLE currentMethod
+ ) = 0;
+
+ // Adds an active dependency from the context method's module to the given module
+ // This is internal callback for the EE. JIT should not call it directly.
+ virtual void addActiveDependency(
+ CORINFO_MODULE_HANDLE moduleFrom,
+ CORINFO_MODULE_HANDLE moduleTo
+ ) = 0;
+
+ virtual CORINFO_METHOD_HANDLE GetDelegateCtor(
+ CORINFO_METHOD_HANDLE methHnd,
+ CORINFO_CLASS_HANDLE clsHnd,
+ CORINFO_METHOD_HANDLE targetMethodHnd,
+ DelegateCtorArgs * pCtorData
+ ) = 0;
+
+ virtual void MethodCompileComplete(
+ CORINFO_METHOD_HANDLE methHnd
+ ) = 0;
+
+ // return a thunk that will copy the arguments for the given signature.
+ virtual void* getTailCallCopyArgsThunk (
+ CORINFO_SIG_INFO *pSig,
+ CorInfoHelperTailCallSpecialHandling flags
+ ) = 0;
+};
+
+/**********************************************************************************/
+
+// It would be nicer to use existing IMAGE_REL_XXX constants instead of defining our own here...
+#define IMAGE_REL_BASED_REL32 0x10
+#define IMAGE_REL_BASED_THUMB_BRANCH24 0x13
+
+#endif // _COR_INFO_H_
diff --git a/src/inc/corjit.h b/src/inc/corjit.h
new file mode 100644
index 0000000000..e4deabd0e1
--- /dev/null
+++ b/src/inc/corjit.h
@@ -0,0 +1,575 @@
+// 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.
+
+/*****************************************************************************\
+* *
+* CorJit.h - EE / JIT interface *
+* *
+* Version 1.0 *
+*******************************************************************************
+* *
+* *
+* *
+\*****************************************************************************/
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE
+//
+// The JIT/EE interface is versioned. By "interface", we mean mean any and all communication between the
+// JIT and the EE. Any time a change is made to the interface, the JIT/EE interface version identifier
+// must be updated. See code:JITEEVersionIdentifier for more information.
+//
+// NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE
+//
+//////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+#ifndef _COR_JIT_H_
+#define _COR_JIT_H_
+
+#include <corinfo.h>
+
+#include <stdarg.h>
+
+#define CORINFO_STACKPROBE_DEPTH 256*sizeof(UINT_PTR) // Guaranteed stack until an fcall/unmanaged
+ // code can set up a frame. Please make sure
+ // this is less than a page. This is due to
+ // 2 reasons:
+ //
+ // If we need to probe more than a page
+ // size, we need one instruction per page
+ // (7 bytes per instruction)
+ //
+ // The JIT wants some safe space so it doesn't
+ // have to put a probe on every call site. It achieves
+ // this by probing n bytes more than CORINFO_STACKPROBE_DEPTH
+ // If it hasn't used more than n for its own stuff, it
+ // can do a call without doing any other probe
+ //
+ // In any case, we do really expect this define to be
+ // small, as setting up a frame should be only pushing
+ // a couple of bytes on the stack
+ //
+ // There is a compile time assert
+ // in the x86 jit to protect you from this
+ //
+
+
+
+
+/*****************************************************************************/
+ // These are error codes returned by CompileMethod
+enum CorJitResult
+{
+ // Note that I dont use FACILITY_NULL for the facility number,
+ // we may want to get a 'real' facility number
+ CORJIT_OK = NO_ERROR,
+ CORJIT_BADCODE = MAKE_HRESULT(SEVERITY_ERROR,FACILITY_NULL, 1),
+ CORJIT_OUTOFMEM = MAKE_HRESULT(SEVERITY_ERROR,FACILITY_NULL, 2),
+ CORJIT_INTERNALERROR = MAKE_HRESULT(SEVERITY_ERROR,FACILITY_NULL, 3),
+ CORJIT_SKIPPED = MAKE_HRESULT(SEVERITY_ERROR,FACILITY_NULL, 4),
+ CORJIT_RECOVERABLEERROR = MAKE_HRESULT(SEVERITY_ERROR,FACILITY_NULL, 5),
+};
+
+
+/* values for flags in compileMethod */
+
+enum CorJitFlag
+{
+ CORJIT_FLG_SPEED_OPT = 0x00000001,
+ CORJIT_FLG_SIZE_OPT = 0x00000002,
+ CORJIT_FLG_DEBUG_CODE = 0x00000004, // generate "debuggable" code (no code-mangling optimizations)
+ CORJIT_FLG_DEBUG_EnC = 0x00000008, // We are in Edit-n-Continue mode
+ CORJIT_FLG_DEBUG_INFO = 0x00000010, // generate line and local-var info
+ CORJIT_FLG_MIN_OPT = 0x00000020, // disable all jit optimizations (not necesarily debuggable code)
+ CORJIT_FLG_GCPOLL_CALLS = 0x00000040, // Emit calls to JIT_POLLGC for thread suspension.
+ CORJIT_FLG_MCJIT_BACKGROUND = 0x00000080, // Calling from multicore JIT background thread, do not call JitComplete
+
+ CORJIT_FLG_UNUSED1 = 0x00000100,
+
+#if defined(_TARGET_X86_)
+
+ CORJIT_FLG_PINVOKE_RESTORE_ESP = 0x00000200, // Restore ESP after returning from inlined PInvoke
+ CORJIT_FLG_TARGET_P4 = 0x00000400,
+ CORJIT_FLG_USE_FCOMI = 0x00000800, // Generated code may use fcomi(p) instruction
+ CORJIT_FLG_USE_CMOV = 0x00001000, // Generated code may use cmov instruction
+ CORJIT_FLG_USE_SSE2 = 0x00002000, // Generated code may use SSE-2 instructions
+
+#elif defined(_TARGET_AMD64_)
+
+ CORJIT_FLG_USE_SSE3_4 = 0x00000200,
+ CORJIT_FLG_USE_AVX = 0x00000400,
+ CORJIT_FLG_USE_AVX2 = 0x00000800,
+ CORJIT_FLG_USE_AVX_512 = 0x00001000,
+ CORJIT_FLG_FEATURE_SIMD = 0x00002000,
+
+#else // !defined(_TARGET_X86_) && !defined(_TARGET_AMD64_)
+
+ CORJIT_FLG_UNUSED2 = 0x00000200,
+ CORJIT_FLG_UNUSED3 = 0x00000400,
+ CORJIT_FLG_UNUSED4 = 0x00000800,
+ CORJIT_FLG_UNUSED5 = 0x00001000,
+ CORJIT_FLG_UNUSED6 = 0x00002000,
+
+#endif // !defined(_TARGET_X86_) && !defined(_TARGET_AMD64_)
+
+ CORJIT_FLG_MAKEFINALCODE = 0x00008000, // Use the final code generator, i.e., not the interpreter.
+ CORJIT_FLG_READYTORUN = 0x00010000, // Use version-resilient code generation
+
+ CORJIT_FLG_PROF_ENTERLEAVE = 0x00020000, // Instrument prologues/epilogues
+ CORJIT_FLG_PROF_REJIT_NOPS = 0x00040000, // Insert NOPs to ensure code is re-jitable
+ CORJIT_FLG_PROF_NO_PINVOKE_INLINE
+ = 0x00080000, // Disables PInvoke inlining
+ CORJIT_FLG_SKIP_VERIFICATION = 0x00100000, // (lazy) skip verification - determined without doing a full resolve. See comment below
+ CORJIT_FLG_PREJIT = 0x00200000, // jit or prejit is the execution engine.
+ CORJIT_FLG_RELOC = 0x00400000, // Generate relocatable code
+ CORJIT_FLG_IMPORT_ONLY = 0x00800000, // Only import the function
+ CORJIT_FLG_IL_STUB = 0x01000000, // method is an IL stub
+ CORJIT_FLG_PROCSPLIT = 0x02000000, // JIT should separate code into hot and cold sections
+ CORJIT_FLG_BBINSTR = 0x04000000, // Collect basic block profile information
+ CORJIT_FLG_BBOPT = 0x08000000, // Optimize method based on profile information
+ CORJIT_FLG_FRAMED = 0x10000000, // All methods have an EBP frame
+ CORJIT_FLG_ALIGN_LOOPS = 0x20000000, // add NOPs before loops to align them at 16 byte boundaries
+ CORJIT_FLG_PUBLISH_SECRET_PARAM= 0x40000000, // JIT must place stub secret param into local 0. (used by IL stubs)
+ CORJIT_FLG_GCPOLL_INLINE = 0x80000000, // JIT must inline calls to GCPoll when possible
+
+#if COR_JIT_EE_VERSION > 460
+ CORJIT_FLG_CALL_GETJITFLAGS = 0xffffffff, // Indicates that the JIT should retrieve flags in the form of a
+ // pointer to a CORJIT_FLAGS value via ICorJitInfo::getJitFlags().
+#endif
+};
+
+enum CorJitFlag2
+{
+ CORJIT_FLG2_SAMPLING_JIT_BACKGROUND = 0x00000001, // JIT is being invoked as a result of stack sampling for hot methods in the background
+#if COR_JIT_EE_VERSION > 460
+ CORJIT_FLG2_USE_PINVOKE_HELPERS = 0x00000002, // The JIT should use the PINVOKE_{BEGIN,END} helpers instead of emitting inline transitions
+ CORJIT_FLG2_REVERSE_PINVOKE = 0x00000004, // The JIT should insert REVERSE_PINVOKE_{ENTER,EXIT} helpers into method prolog/epilog
+ CORJIT_FLG2_DESKTOP_QUIRKS = 0x00000008, // The JIT should generate desktop-quirk-compatible code
+#endif
+};
+
+struct CORJIT_FLAGS
+{
+ unsigned corJitFlags; // Values are from CorJitFlag
+ unsigned corJitFlags2; // Values are from CorJitFlag2
+};
+
+/*****************************************************************************
+Here is how CORJIT_FLG_SKIP_VERIFICATION should be interepreted.
+Note that even if any method is inlined, it need not be verified.
+
+if (CORJIT_FLG_SKIP_VERIFICATION is passed in to ICorJitCompiler::compileMethod())
+{
+ No verification needs to be done.
+ Just compile the method, generating unverifiable code if necessary
+}
+else
+{
+ switch(ICorMethodInfo::isInstantiationOfVerifiedGeneric())
+ {
+ case INSTVER_NOT_INSTANTIATION:
+
+ //
+ // Non-generic case, or open generic instantiation
+ //
+
+ switch(canSkipMethodVerification())
+ {
+ case CORINFO_VERIFICATION_CANNOT_SKIP:
+ {
+ ICorMethodInfo::initConstraintsForVerification(&circularConstraints)
+ if (circularConstraints)
+ {
+ Just emit code to call CORINFO_HELP_VERIFICATION
+ The IL will not be compiled
+ }
+ else
+ {
+ Verify the method.
+ if (unverifiable code is detected)
+ {
+ In place of branches with unverifiable code, emit code to call CORINFO_HELP_VERIFICATION
+ Mark the method (and any of its instantiations) as unverifiable
+ }
+ Compile the rest of the verifiable code
+ }
+ }
+
+ case CORINFO_VERIFICATION_CAN_SKIP:
+ {
+ No verification needs to be done.
+ Just compile the method, generating unverifiable code if necessary
+ }
+
+ case CORINFO_VERIFICATION_RUNTIME_CHECK:
+ {
+ ICorMethodInfo::initConstraintsForVerification(&circularConstraints)
+ if (circularConstraints)
+ {
+ Just emit code to call CORINFO_HELP_VERIFICATION
+ The IL will not be compiled
+
+ TODO: This could be changed to call CORINFO_HELP_VERIFICATION_RUNTIME_CHECK
+ }
+ else
+ {
+ Verify the method.
+ if (unverifiable code is detected)
+ {
+ In the prolog, emit code to call CORINFO_HELP_VERIFICATION_RUNTIME_CHECK
+ Mark the method (and any of its instantiations) as unverifiable
+ }
+ Compile the method, generating unverifiable code if necessary
+ }
+ }
+ case CORINFO_VERIFICATION_DONT_JIT:
+ {
+ ICorMethodInfo::initConstraintsForVerification(&circularConstraints)
+ if (circularConstraints)
+ {
+ Just emit code to call CORINFO_HELP_VERIFICATION
+ The IL will not be compiled
+ }
+ else
+ {
+ Verify the method.
+ if (unverifiable code is detected)
+ {
+ Fail the jit
+ }
+ }
+ }
+ }
+
+ case INSTVER_GENERIC_PASSED_VERIFICATION:
+ {
+ This cannot ever happen because the VM would pass in CORJIT_FLG_SKIP_VERIFICATION.
+ }
+
+ case INSTVER_GENERIC_FAILED_VERIFICATION:
+
+ switch(canSkipMethodVerification())
+ {
+ case CORINFO_VERIFICATION_CANNOT_SKIP:
+ {
+ This cannot be supported because the compiler does not know which branches should call CORINFO_HELP_VERIFICATION.
+ The CLR will throw a VerificationException instead of trying to compile this method
+ }
+
+ case CORINFO_VERIFICATION_CAN_SKIP:
+ {
+ This cannot ever happen because the CLR would pass in CORJIT_FLG_SKIP_VERIFICATION.
+ }
+
+ case CORINFO_VERIFICATION_RUNTIME_CHECK:
+ {
+ No verification needs to be done.
+ In the prolog, emit code to call CORINFO_HELP_VERIFICATION_RUNTIME_CHECK
+ Compile the method, generating unverifiable code if necessary
+ }
+ case CORINFO_VERIFICATION_DONT_JIT:
+ {
+ Fail the jit
+ }
+ }
+ }
+}
+
+*/
+
+/*****************************************************************************/
+// These are flags passed to ICorJitInfo::allocMem
+// to guide the memory allocation for the code, readonly data, and read-write data
+enum CorJitAllocMemFlag
+{
+ CORJIT_ALLOCMEM_DEFAULT_CODE_ALIGN = 0x00000000, // The code will be use the normal alignment
+ CORJIT_ALLOCMEM_FLG_16BYTE_ALIGN = 0x00000001, // The code will be 16-byte aligned
+ CORJIT_ALLOCMEM_FLG_RODATA_16BYTE_ALIGN = 0x00000002, // The read-only data will be 16-byte aligned
+};
+
+inline CorJitAllocMemFlag operator |(CorJitAllocMemFlag a, CorJitAllocMemFlag b)
+{
+ return static_cast<CorJitAllocMemFlag>(static_cast<int>(a) | static_cast<int>(b));
+}
+
+enum CorJitFuncKind
+{
+ CORJIT_FUNC_ROOT, // The main/root function (always id==0)
+ CORJIT_FUNC_HANDLER, // a funclet associated with an EH handler (finally, fault, catch, filter handler)
+ CORJIT_FUNC_FILTER // a funclet associated with an EH filter
+};
+
+// We have a performance-investigation mode (defined by the FEATURE_USE_ASM_GC_WRITE_BARRIERS and
+// FEATURE_COUNT_GC_WRITE_BARRIER preprocessor symbols) in which the JIT adds an argument of this
+// enumeration to checked write barrier calls in order to classify them.
+enum CheckedWriteBarrierKinds {
+ CWBKind_Unclassified, // Not one of the ones below.
+ CWBKind_RetBuf, // Store through a return buffer pointer argument.
+ CWBKind_ByRefArg, // Store through a by-ref argument (not an implicit return buffer).
+ CWBKind_OtherByRefLocal, // Store through a by-ref local variable.
+ CWBKind_AddrOfLocal, // Store through the address of a local (arguably a bug that this happens at all).
+};
+
+#if COR_JIT_EE_VERSION > 460
+
+#include "corjithost.h"
+
+extern "C" void __stdcall jitStartup(ICorJitHost* host);
+
+#endif
+
+class ICorJitCompiler;
+class ICorJitInfo;
+struct IEEMemoryManager;
+
+extern "C" ICorJitCompiler* __stdcall getJit();
+
+// #EEToJitInterface
+// ICorJitCompiler is the interface that the EE uses to get IL bytecode converted to native code. Note that
+// to accomplish this the JIT has to call back to the EE to get symbolic information. The code:ICorJitInfo
+// type passed as 'comp' to compileMethod is the mechanism to get this information. This is often the more
+// interesting interface.
+//
+//
+class ICorJitCompiler
+{
+public:
+ // compileMethod is the main routine to ask the JIT Compiler to create native code for a method. The
+ // method to be compiled is passed in the 'info' parameter, and the code:ICorJitInfo is used to allow the
+ // JIT to resolve tokens, and make any other callbacks needed to create the code. nativeEntry, and
+ // nativeSizeOfCode are just for convenience because the JIT asks the EE for the memory to emit code into
+ // (see code:ICorJitInfo.allocMem), so really the EE already knows where the method starts and how big
+ // it is (in fact, it could be in more than one chunk).
+ //
+ // * In the 32 bit jit this is implemented by code:CILJit.compileMethod
+ // * For the 64 bit jit this is implemented by code:PreJit.compileMethod
+ //
+ // Note: Obfuscators that are hacking the JIT depend on this method having __stdcall calling convention
+ virtual CorJitResult __stdcall compileMethod (
+ ICorJitInfo *comp, /* IN */
+ struct CORINFO_METHOD_INFO *info, /* IN */
+ unsigned /* code:CorJitFlag */ flags, /* IN */
+ BYTE **nativeEntry, /* OUT */
+ ULONG *nativeSizeOfCode /* OUT */
+ ) = 0;
+
+ // Some JIT compilers (most notably Phoenix), cache information about EE structures from one invocation
+ // of the compiler to the next. This can be a problem when appdomains are unloaded, as some of this
+ // cached information becomes stale. The code:ICorJitCompiler.isCacheCleanupRequired is called by the EE
+ // early first to see if jit needs these notifications, and if so, the EE will call ClearCache is called
+ // whenever the compiler should abandon its cache (eg on appdomain unload)
+ virtual void clearCache() = 0;
+ virtual BOOL isCacheCleanupRequired() = 0;
+
+ // Do any appropriate work at process shutdown. Default impl is to do nothing.
+ virtual void ProcessShutdownWork(ICorStaticInfo* info) {};
+
+ // The EE asks the JIT for a "version identifier". This represents the version of the JIT/EE interface.
+ // If the JIT doesn't implement the same JIT/EE interface expected by the EE (because the JIT doesn't
+ // return the version identifier that the EE expects), then the EE fails to load the JIT.
+ //
+ virtual void getVersionIdentifier(
+ GUID* versionIdentifier /* OUT */
+ ) = 0;
+
+ // When the EE loads the System.Numerics.Vectors assembly, it asks the JIT what length (in bytes) of
+ // SIMD vector it supports as an intrinsic type. Zero means that the JIT does not support SIMD
+ // intrinsics, so the EE should use the default size (i.e. the size of the IL implementation).
+ virtual unsigned getMaxIntrinsicSIMDVectorLength(DWORD cpuCompileFlags) { return 0; }
+
+ // IL obfuscators sometimes interpose on the EE-JIT interface. This function allows the VM to
+ // tell the JIT to use a particular ICorJitCompiler to implement the methods of this interface,
+ // and not to implement those methods itself. The JIT must not return this method when getJit()
+ // is called. Instead, it must pass along all calls to this interface from within its own
+ // ICorJitCompiler implementation. If 'realJitCompiler' is nullptr, then the JIT should resume
+ // executing all the functions itself.
+ virtual void setRealJit(ICorJitCompiler* realJitCompiler) { }
+
+};
+
+//------------------------------------------------------------------------------------------
+// #JitToEEInterface
+//
+// ICorJitInfo is the main interface that the JIT uses to call back to the EE and get information. It is
+// the companion to code:ICorJitCompiler#EEToJitInterface. The concrete implementation of this in the
+// runtime is the code:CEEJitInfo type. There is also a version of this for the NGEN case.
+//
+// See code:ICorMethodInfo#EEJitContractDetails for subtle conventions used by this interface.
+//
+// There is more information on the JIT in the book of the runtime entry
+// http://devdiv/sites/CLR/Product%20Documentation/2.0/BookOfTheRuntime/JIT/JIT%20Design.doc
+//
+class ICorJitInfo : public ICorDynamicInfo
+{
+public:
+ // return memory manager that the JIT can use to allocate a regular memory
+ virtual IEEMemoryManager* getMemoryManager() = 0;
+
+ // get a block of memory for the code, readonly data, and read-write data
+ virtual void allocMem (
+ ULONG hotCodeSize, /* IN */
+ ULONG coldCodeSize, /* IN */
+ ULONG roDataSize, /* IN */
+ ULONG xcptnsCount, /* IN */
+ CorJitAllocMemFlag flag, /* IN */
+ void ** hotCodeBlock, /* OUT */
+ void ** coldCodeBlock, /* OUT */
+ void ** roDataBlock /* OUT */
+ ) = 0;
+
+ // Reserve memory for the method/funclet's unwind information.
+ // Note that this must be called before allocMem. It should be
+ // called once for the main method, once for every funclet, and
+ // once for every block of cold code for which allocUnwindInfo
+ // will be called.
+ //
+ // This is necessary because jitted code must allocate all the
+ // memory needed for the unwindInfo at the allocMem call.
+ // For prejitted code we split up the unwinding information into
+ // separate sections .rdata and .pdata.
+ //
+ virtual void reserveUnwindInfo (
+ BOOL isFunclet, /* IN */
+ BOOL isColdCode, /* IN */
+ ULONG unwindSize /* IN */
+ ) = 0;
+
+ // Allocate and initialize the .rdata and .pdata for this method or
+ // funclet, and get the block of memory needed for the machine-specific
+ // unwind information (the info for crawling the stack frame).
+ // Note that allocMem must be called first.
+ //
+ // Parameters:
+ //
+ // pHotCode main method code buffer, always filled in
+ // pColdCode cold code buffer, only filled in if this is cold code,
+ // null otherwise
+ // startOffset start of code block, relative to appropriate code buffer
+ // (e.g. pColdCode if cold, pHotCode if hot).
+ // endOffset end of code block, relative to appropriate code buffer
+ // unwindSize size of unwind info pointed to by pUnwindBlock
+ // pUnwindBlock pointer to unwind info
+ // funcKind type of funclet (main method code, handler, filter)
+ //
+ virtual void allocUnwindInfo (
+ BYTE * pHotCode, /* IN */
+ BYTE * pColdCode, /* IN */
+ ULONG startOffset, /* IN */
+ ULONG endOffset, /* IN */
+ ULONG unwindSize, /* IN */
+ BYTE * pUnwindBlock, /* IN */
+ CorJitFuncKind funcKind /* IN */
+ ) = 0;
+
+ // Get a block of memory needed for the code manager information,
+ // (the info for enumerating the GC pointers while crawling the
+ // stack frame).
+ // Note that allocMem must be called first
+ virtual void * allocGCInfo (
+ size_t size /* IN */
+ ) = 0;
+
+ virtual void yieldExecution() = 0;
+
+ // Indicate how many exception handler blocks are to be returned.
+ // This is guaranteed to be called before any 'setEHinfo' call.
+ // Note that allocMem must be called before this method can be called.
+ virtual void setEHcount (
+ unsigned cEH /* IN */
+ ) = 0;
+
+ // Set the values for one particular exception handler block.
+ //
+ // Handler regions should be lexically contiguous.
+ // This is because FinallyIsUnwinding() uses lexicality to
+ // determine if a "finally" clause is executing.
+ virtual void setEHinfo (
+ unsigned EHnumber, /* IN */
+ const CORINFO_EH_CLAUSE *clause /* IN */
+ ) = 0;
+
+ // Level -> fatalError, Level 2 -> Error, Level 3 -> Warning
+ // Level 4 means happens 10 times in a run, level 5 means 100, level 6 means 1000 ...
+ // returns non-zero if the logging succeeded
+ virtual BOOL logMsg(unsigned level, const char* fmt, va_list args) = 0;
+
+ // do an assert. will return true if the code should retry (DebugBreak)
+ // returns false, if the assert should be igored.
+ virtual int doAssert(const char* szFile, int iLine, const char* szExpr) = 0;
+
+ virtual void reportFatalError(CorJitResult result) = 0;
+
+ struct ProfileBuffer // Also defined here: code:CORBBTPROF_BLOCK_DATA
+ {
+ ULONG ILOffset;
+ ULONG ExecutionCount;
+ };
+
+ // allocate a basic block profile buffer where execution counts will be stored
+ // for jitted basic blocks.
+ virtual HRESULT allocBBProfileBuffer (
+ ULONG count, // The number of basic blocks that we have
+ ProfileBuffer ** profileBuffer
+ ) = 0;
+
+ // get profile information to be used for optimizing the current method. The format
+ // of the buffer is the same as the format the JIT passes to allocBBProfileBuffer.
+ virtual HRESULT getBBProfileData(
+ CORINFO_METHOD_HANDLE ftnHnd,
+ ULONG * count, // The number of basic blocks that we have
+ ProfileBuffer ** profileBuffer,
+ ULONG * numRuns
+ ) = 0;
+
+ // Associates a native call site, identified by its offset in the native code stream, with
+ // the signature information and method handle the JIT used to lay out the call site. If
+ // the call site has no signature information (e.g. a helper call) or has no method handle
+ // (e.g. a CALLI P/Invoke), then null should be passed instead.
+ virtual void recordCallSite(
+ ULONG instrOffset, /* IN */
+ CORINFO_SIG_INFO * callSig, /* IN */
+ CORINFO_METHOD_HANDLE methodHandle /* IN */
+ ) = 0;
+
+ // A relocation is recorded if we are pre-jitting.
+ // A jump thunk may be inserted if we are jitting
+ virtual void recordRelocation(
+ void * location, /* IN */
+ void * target, /* IN */
+ WORD fRelocType, /* IN */
+ WORD slotNum = 0, /* IN */
+ INT32 addlDelta = 0 /* IN */
+ ) = 0;
+
+ virtual WORD getRelocTypeHint(void * target) = 0;
+
+ // A callback to identify the range of address known to point to
+ // compiler-generated native entry points that call back into
+ // MSIL.
+ virtual void getModuleNativeEntryPointRange(
+ void ** pStart, /* OUT */
+ void ** pEnd /* OUT */
+ ) = 0;
+
+ // For what machine does the VM expect the JIT to generate code? The VM
+ // returns one of the IMAGE_FILE_MACHINE_* values. Note that if the VM
+ // is cross-compiling (such as the case for crossgen), it will return a
+ // different value than if it was compiling for the host architecture.
+ //
+ virtual DWORD getExpectedTargetArchitecture() = 0;
+
+#if COR_JIT_EE_VERSION > 460
+ // Fetches extended flags for a particular compilation instance. Returns
+ // the number of bytes written to the provided buffer.
+ virtual DWORD getJitFlags(
+ CORJIT_FLAGS* flags, /* IN: Points to a buffer that will hold the extended flags. */
+ DWORD sizeInBytes /* IN: The size of the buffer. Note that this is effectively a
+ version number for the CORJIT_FLAGS value. */
+ ) = 0;
+#endif
+};
+
+/**********************************************************************************/
+#endif // _COR_CORJIT_H_
diff --git a/src/inc/corjithost.h b/src/inc/corjithost.h
new file mode 100644
index 0000000000..8242fab2b8
--- /dev/null
+++ b/src/inc/corjithost.h
@@ -0,0 +1,48 @@
+// 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.
+
+#ifndef __CORJITHOST_H__
+#define __CORJITHOST_H__
+
+// ICorJitHost
+//
+// ICorJitHost provides the interface that the JIT uses to access some functionality that
+// would normally be provided by the operating system. This is intended to allow for
+// host-specific policies re: memory allocation, configuration value access, etc. It is
+// expected that the `ICorJitHost` value provided to `jitStartup` lives at least as
+// long as the JIT itself.
+class ICorJitHost
+{
+public:
+ // Allocate memory of the given size in bytes. All bytes of the returned block
+ // must be initialized to zero. If `usePageAllocator` is true, the implementation
+ // should use an allocator that deals in OS pages if one exists.
+ virtual void* allocateMemory(size_t size, bool usePageAllocator = false) = 0;
+
+ // Frees memory previous obtained by a call to `ICorJitHost::allocateMemory`. The
+ // value of the `usePageAllocator` parameter must match the value that was
+ // provided to the call to used to allocate the memory.
+ virtual void freeMemory(void* block, bool usePageAllocator = false) = 0;
+
+ // Return an integer config value for the given key, if any exists.
+ virtual int getIntConfigValue(
+ const wchar_t* name,
+ int defaultValue
+ ) = 0;
+
+ // Return a string config value for the given key, if any exists.
+ virtual const wchar_t* getStringConfigValue(
+ const wchar_t* name
+ ) = 0;
+
+ // Free a string ConfigValue returned by the runtime.
+ // JITs using the getStringConfigValue query are required
+ // to return the string values to the runtime for deletion.
+ // This avoids leaking the memory in the JIT.
+ virtual void freeStringConfigValue(
+ const wchar_t* value
+ ) = 0;
+};
+
+#endif
diff --git a/src/inc/corperm.h b/src/inc/corperm.h
new file mode 100644
index 0000000000..e8c7cc7c99
--- /dev/null
+++ b/src/inc/corperm.h
@@ -0,0 +1,205 @@
+// 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.
+//*****************************************************************************
+// File: CorPerm.H
+//
+// Defines the public routines defined in the security libraries. All these
+// routines are defined within CorPerm.lib.
+//
+//*****************************************************************************
+
+#ifndef _CORPERM_H_
+#define _CORPERM_H_
+
+#include <ole2.h> // Definitions of OLE types.
+
+#ifndef FEATURE_PAL
+#include <wintrust.h>
+#endif
+
+#include <specstrings.h>
+#include "corhdr.h"
+#include "corpolicy.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+
+//--------------------------------------------------------------------------
+// Global security settings
+// ------------------------
+//
+
+// Needs to be in sync with URLZONE
+typedef enum {
+ LocalMachine = 0, /* URLZONE_LOCAL_MACHINE */ // 0, My Computer
+ Intranet = 1, /* URLZONE_INTRANET */ // 1, The Intranet
+ Trusted = 2, /* URLZONE_TRUSTED */ // 2, Trusted Zone
+ Internet = 3, /* URLZONE_INTERNET */ // 3, The Internet
+ Untrusted = 4, /* URLZONE_UNTRUSTED */ // 4, Untrusted Zone
+ NumZones = 5,
+ NoZone = -1
+} SecZone;
+
+// Managed URL action flags (see urlmon.idl)
+#define URLACTION_MANAGED_MIN 0x00002000
+#define URLACTION_MANAGED_SIGNED 0x00002001
+#define URLACTION_MANAGED_UNSIGNED 0x00002004
+#define URLACTION_MANAGED_MANIFEST_PERMISSIONS 0x00002007
+#define URLACTION_MANAGED_MAX 0x000020FF
+
+// Global disable flags. These are set for every zone.
+#define CORSETTING_EXECUTION_PERMISSION_CHECK_DISABLED 0x00000100
+
+// Trust Levels
+#define URLPOLICY_COR_NOTHING 0x00000000
+#define URLPOLICY_COR_TIME 0x00010000
+#define URLPOLICY_COR_EQUIPMENT 0x00020000
+#define URLPOLICY_COR_EVERYTHING 0x00030000
+#define URLPOLICY_COR_CUSTOM 0x00800000
+
+// Manifest permission settings - note that URLPOLICY_DISABLED is also a valid value
+#define URLPOLICY_COR_HIGH_SAFETY 0x00010000
+#define URLPOLICY_COR_LOW_SAFETY 0x00030000
+
+#define KEY_COM_SECURITY_POLICY L"\\Security\\Policy"
+#define KEY_COM_SECURITY_ZONEOVERRIDE L"TreatCustomZonesAsInternetZone"
+#define HKEY_POLICY_ROOT HKEY_LOCAL_MACHINE
+
+#ifndef FEATURE_PAL
+
+//--------------------------------------------------------------------
+// GetPublisher
+// ------------
+// Returns signature information (Encoded signature and permissions)
+// NOTE: This does perform any policy checks on the certificates. All
+// that can be determined is the File was signed and the bits are OK.
+//
+// Free information with CoTaskMemFree (just the pointer not the contents)
+//
+
+#define COR_UNSIGNED_NO 0x0
+#define COR_UNSIGNED_YES 0x1
+#define COR_UNSIGNED_ALWAYS 0x2
+
+extern HRESULT DisplayUnsignedRequestDialog(HWND hParent, // Parents hwnd
+ PCRYPT_PROVIDER_DATA pData,
+ LPCWSTR pURL, // Url associated with code
+ LPCWSTR pZONE, // Zone associated with code
+ DWORD* pdwState); // Return COR_UNSIGNED_YES or COR_UNSIGNED_NO
+
+// For dwFlag values
+#define COR_NOUI 0x01
+#define COR_NOPOLICY 0x02
+#define COR_DISPLAYGRANTED 0x04 // Intersect the requested permissions with the policy to
+ // to display the granted set
+
+HRESULT STDMETHODCALLTYPE
+GetPublisher(__in __in_z IN LPWSTR pwsFileName, // File name, this is required even with the handle
+ IN HANDLE hFile, // Optional file name
+ IN DWORD dwFlags, // COR_NOUI or COR_NOPOLICY
+ OUT PCOR_TRUST *pInfo, // Returns a PCOR_TRUST (Use CoTaskMemFree)
+ OUT DWORD *dwInfo); // Size of pInfo.
+
+#endif // !FEATURE_PAL
+
+interface IMetaDataAssemblyImport;
+
+// Structure used to describe an individual security permission.
+class CORSEC_ATTRIBUTE
+{
+public:
+ DWORD dwIndex; // Unique permission index used for error tracking
+ CHAR* pName; // Fully qualified permission class name
+ mdMemberRef tkCtor; // Custom attribute constructor
+ mdTypeRef tkTypeRef; // Custom attribute class ref
+ mdAssemblyRef tkAssemblyRef; // Custom attribute class assembly
+ BYTE *pbValues; // Serialized field/property initializers
+ SIZE_T cbValues; // Byte count for above
+ WORD wValues; // Count of values in above
+
+ CORSEC_ATTRIBUTE()
+ {
+ pbValues = NULL;
+ pName = NULL;
+ }
+
+ ~CORSEC_ATTRIBUTE()
+ {
+ delete [] pbValues;
+ delete [] pName;
+ }
+};
+
+// Context structure that tracks the creation of a security permission set from
+// individual permission requests.
+class CORSEC_ATTRSET
+{
+public:
+ mdToken tkObj; // Parent object
+ DWORD dwAction; // Security action type (CorDeclSecurity)
+ DWORD dwAttrCount; // Number of attributes in set
+ CORSEC_ATTRIBUTE *pAttrs; // Pointer to array of attributes
+ DWORD dwAllocated; // Number of elements in above array
+#ifdef __cplusplus
+ IMetaDataAssemblyImport *pImport; // Current meta data scope
+ IUnknown *pAppDomain; // AppDomain in which managed security code will be run.
+
+#else
+ void *pImport;
+ void *pAppDomain;
+#endif
+
+ CORSEC_ATTRSET()
+ {
+ pAttrs = NULL;
+ }
+
+ ~CORSEC_ATTRSET()
+ {
+ delete [] pAttrs;
+ }
+};
+
+// Reads permission requests (if any) from the manifest of an assembly.
+HRESULT STDMETHODCALLTYPE
+GetPermissionRequests(LPCWSTR pwszFileName,
+ BYTE **ppbMinimal,
+ DWORD *pcbMinimal,
+ BYTE **ppbOptional,
+ DWORD *pcbOptional,
+ BYTE **ppbRefused,
+ DWORD *pcbRefused);
+
+// Translate a set of security custom attributes into a serialized permission set blob.
+HRESULT STDMETHODCALLTYPE
+TranslateSecurityAttributes(CORSEC_ATTRSET *pPset,
+ BYTE **ppbOutput,
+ DWORD *pcbOutput,
+ BYTE **ppbNonCasOutput,
+ DWORD *pcbNonCasOutput,
+ DWORD *pdwErrorIndex);
+
+class CMiniMdRW;
+struct IMDInternalImport;
+
+HRESULT STDMETHODCALLTYPE
+GroupSecurityAttributesByAction(CORSEC_ATTRSET /*OUT*/rPermSets[],
+ COR_SECATTR rSecAttrs[],
+ ULONG cSecAttrs,
+ mdToken tkObj,
+ ULONG *pulErrorAttr,
+ CMiniMdRW* pMiniMd,
+ IMDInternalImport* pInternalImport);
+
+// if pBuffer is NULL, this just sets *pCount to the number of bytes required
+// if pBuffer is not NULL, it serializes pAttrSet into pBuffer
+HRESULT AttributeSetToBlob(CORSEC_ATTRSET* pAttrSet, BYTE* pBuffer, SIZE_T* pCount, IMetaDataAssemblyImport *pImport, DWORD dwAction);
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/src/inc/corperme.h b/src/inc/corperme.h
new file mode 100644
index 0000000000..7b2eec9639
--- /dev/null
+++ b/src/inc/corperme.h
@@ -0,0 +1,56 @@
+// 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.
+//*****************************************************************************
+// File: CorPermE.H
+//
+// Defines the Memory and Error routines defined in the secuirty libraries.
+// These routines are mainly for the security dll and the runtime.
+//
+//*****************************************************************************
+
+#ifndef _CORPERME_H_
+#define _CORPERME_H_
+
+//=============================================================================
+// Error macros so we do not have to see goto's in the code
+// Adds structure to where error handling and clean up code goes. Be careful
+// when rethrowing EE exceptions, the routine must be cleaned up first.
+//=============================================================================
+typedef struct _CorError {
+ HRESULT corError;
+} CorError;
+
+#define CORTRY HRESULT _tcorError = 0;
+#define CORTHROW(x) {_tcorError = x; goto CORERROR;} //
+#define CORCATCH(x) goto CORCONT; \
+ CORERROR: \
+ { CorError x; x.corError = _tcorError;
+#define COREND } CORCONT: //
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#define WIDEN_CP CP_UTF8
+
+// Helper macros for security logging
+#define WIDEN(psz, pwsz) \
+ LPCSTR _##psz = (LPCSTR) psz; \
+ int _cc##psz = _##psz ? strlen(_##psz) + 1 : 0; \
+ LPWSTR pwsz = (LPWSTR) (_cc##psz ? _alloca((_cc##psz) * sizeof(WCHAR)) : NULL); \
+ if(pwsz) WszMultiByteToWideChar(WIDEN_CP, 0, _##psz, _cc##psz, pwsz, _cc##psz);
+
+
+#define NARROW(pwsz, psz) \
+ LPCWSTR _##pwsz = (LPCWSTR) pwsz; \
+ int _cc##psz = _##pwsz ? WszWideCharToMultiByte(WIDEN_CP, 0, _##pwsz, -1, NULL, 0, NULL, NULL) : 0; \
+ LPSTR psz = (LPSTR) (_cc##psz ? _alloca(_cc##psz) : NULL); \
+ if(psz) WszWideCharToMultiByte(WIDEN_CP, 0, _##pwsz, -1, psz, _cc##psz, NULL, NULL);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
diff --git a/src/inc/corpermp.h b/src/inc/corpermp.h
new file mode 100644
index 0000000000..3f77893425
--- /dev/null
+++ b/src/inc/corpermp.h
@@ -0,0 +1,57 @@
+// 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.
+//*****************************************************************************
+// File: CorPermP.H
+//
+// Defines the Private routines defined in the secuirty libraries. These routines
+// are mainly for the security dll and the runtime.
+//
+//*****************************************************************************
+
+#ifndef _CORPERMP_H_
+#define _CORPERMP_H_
+
+#include "utilcode.h"
+#include "corperme.h"
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+//==========================================================================
+// Encoding and Decoding PermissionSets
+
+//==========================================================================
+// Initialization routines for registering installable OIDS for capi20
+// Currently there is no C/C++ support for OID parsing. It is only supported
+// by using the permission objects within the runtime
+//
+// Parameter:
+// dllName The name of the module (eg. mscorsec.dll)
+// Returns:
+// S_OK This routines only returns S_OK currently
+//==========================================================================
+HRESULT WINAPI CorPermRegisterServer(LPCWSTR dllName);
+HRESULT WINAPI CorPermUnregisterServer();
+
+//==========================================================================
+// Removes the capi entries for installable OID's. Is not currently supported
+// so does nothing
+//
+// Returns:
+// S_OK This routines only returns S_OK currently
+//==========================================================================
+HRESULT WINAPI CorFactoryRegister(HINSTANCE hInst);
+
+HRESULT WINAPI CorFactoryUnregister();
+
+HRESULT WINAPI CorFactoryCanUnloadNow();
+
+#ifdef __cplusplus
+}
+#endif
+
+
+#include "corperm.h"
+#endif
diff --git a/src/inc/corpolicy.h b/src/inc/corpolicy.h
new file mode 100644
index 0000000000..ce37db463e
--- /dev/null
+++ b/src/inc/corpolicy.h
@@ -0,0 +1,129 @@
+// 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.
+
+
+#ifndef _CORPOLICY_H
+#define _CORPOLICY_H
+
+#include <ole2.h> // Definitions of OLE types.
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+#include "product_version.h"
+
+// {D41E4F1D-A407-11d1-8BC9-00C04FA30A41}
+#define COR_POLICY_PROVIDER_DOWNLOAD \
+{ 0xd41e4f1d, 0xa407, 0x11d1, {0x8b, 0xc9, 0x0, 0xc0, 0x4f, 0xa3, 0xa, 0x41 } }
+
+// {D41E4F1E-A407-11d1-8BC9-00C04FA30A41}
+#define COR_POLICY_PROVIDER_CHECK \
+{ 0xd41e4f1e, 0xa407, 0x11d1, {0x8b, 0xc9, 0x0, 0xc0, 0x4f, 0xa3, 0xa, 0x41 } }
+
+
+// {D41E4F1F-A407-11d1-8BC9-00C04FA30A41}
+#define COR_POLICY_LOCKDOWN_CHECK \
+{ 0xd41e4f1f, 0xa407, 0x11d1, {0x8b, 0xc9, 0x0, 0xc0, 0x4f, 0xa3, 0xa, 0x41 } }
+
+
+#ifndef FEATURE_CORECLR
+// See if we're set up to do a version check
+#if (VER_MAJORVERSION < 4)
+#error "Looks like major version isn't set correctly. Are you including product_version.h?"
+#endif
+
+// The following check has been added to ensure the right thing is done
+// for SxS compatibility of mscorsecimpl.dll when moving to a new framework
+// version.
+//
+// The library is registered using a full path and a GUID in the following location:
+// HKLM\SOFTWARE\Microsoft\Cryptography\Providers\Trust\*
+// With a new SxS version of the framework, we need to move to a new
+// GUID so older versions continue to work unimpacted.
+//
+// The check will fail when the runtime version changes; when it does,
+// please do the following:
+//
+// If the new version is NOT a SxS release with the version number in the #if,
+// update the version number in the #if below to the new version and you're done.
+//
+// If the new release is a SxS release, then there's a bit more work involved:
+// 1. Change COREE_POLICY_PROVIDER in CorPolicy.h to a new GUID.
+// 2. Update batchSetup to use the new GUID. To do so, update
+// all occurrences of the GUID in
+// ndp\clr\src\dlls\mscorsecimpl\mscorsecimpl.vrg
+// 3. Update "real" setup to use the new GUID. To do so, update
+// all occurrences of the GUID in
+// setupauthoring\netfx\clr\Components\mscorsec.dll.ddc
+// 4. Update the version number in the #if below.
+
+#if !(VER_MAJORVERSION == 4 && VER_MINORVERSION == 0)
+#error "The guid for mscorsecimpl needs to change when the runtime version changes"
+#endif
+
+// {A7F4C378-21BE-494e-BA0F-BB12C5D208C5}
+#define COREE_POLICY_PROVIDER \
+{ 0xa7f4c378, 0x21be, 0x494e, {0xba, 0x0f, 0xbb, 0x12, 0xc5, 0xd2, 0x08, 0xc5 } }
+
+#endif //#ifndef FEATURE_CORECLR
+
+// This structure is returned from the winverify trust call, free up the structure
+// using CoTaskMemAlloc except for COREE_POLICY_PROVIDER which uses LocalALLoc.
+
+typedef struct _COR_TRUST {
+ DWORD cbSize; // Size of structure
+ DWORD flag; // Reserved
+ BOOL fAllActiveXPermissions; // ActiveX explicitly asked for all (must have been signed)
+ BOOL fAllPermissions; // Cor permissions, explicit ask for all
+ DWORD dwEncodingType; // Encoding type
+ PBYTE pbCorPermissions; // Encoded cor permission blob
+ DWORD cbCorPermissions;
+ PBYTE pbSigner; // Encoded signer.
+ DWORD cbSigner;
+ LPCWSTR pwszZone; // Zone index (copied from action data)
+ GUID guidZone; // Not used currently
+ HRESULT hVerify; // Authenticode policy return
+} COR_TRUST, *PCOR_TRUST;
+
+// Pass this structure into WinVerifyTrust (corpol trust provider). The result
+// is returned in pbCorTrust.
+typedef struct _COR_POLICY_PROVIDER {
+ DWORD cbSize; // Size of policy provider
+ LPVOID pZoneManager; // Zone interface manager
+ LPCWSTR pwszZone; // Zone index
+ BOOL fNoBadUI; // Optional bad ui
+ PCOR_TRUST pbCorTrust; // Returned cor information (CoTaskMemAlloc)
+ DWORD cbCorTrust; // Total allocated size of pCorTrust
+ DWORD dwActionID; // Optional ActionID ID
+ DWORD dwUnsignedActionID; // Optional ActionID ID
+ BOOL VMBased; // Called from VM (FALSE by DEFAULT)
+ DWORD dwZoneIndex; // IE zone numbers
+} COR_POLICY_PROVIDER, *PCOR_POLICY_PROVIDER;
+
+// Returned flags in COR_TRUST flag
+#define COR_NOUI_DISPLAYED 0x1
+#define COR_DELAYED_PERMISSIONS 0x02 // The subject was unsigned, returned
+ // look up information in pbCorPermissions
+ // to be passed into GetUnsignedPermissions().
+ // If this flag is not set and pbCorPermissions
+ // is not NULL then pbCorPermissions contains
+ // encoded permissions
+
+//--------------------------------------------------------------------
+// For COR_POLICY_LOCKDOWN_CHECK:
+// -----------------------------
+
+// Structure to pass into WVT
+typedef struct _COR_LOCKDOWN {
+ DWORD cbSize; // Size of policy provider
+ DWORD flag; // reserved
+ BOOL fAllPublishers; // Trust all publishers or just ones in the trusted data base
+} COR_LOCKDOWN, *PCOR_LOCKDOWN;
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif // _CORPOLICY_H
diff --git a/src/inc/corpriv.h b/src/inc/corpriv.h
new file mode 100644
index 0000000000..8c737c7607
--- /dev/null
+++ b/src/inc/corpriv.h
@@ -0,0 +1,731 @@
+// 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.
+// ===========================================================================
+// File: CORPRIV.H
+//
+// ===========================================================================
+
+#ifndef _CORPRIV_H_
+#define _CORPRIV_H_
+#if _MSC_VER >= 1000
+#pragma once
+#endif // _MSC_VER >= 1000
+
+// %%Includes: ---------------------------------------------------------------
+// avoid taking DLL import hit on intra-DLL calls
+#define NODLLIMPORT
+#include <daccess.h>
+#include "cor.h"
+#include "corimage.h"
+#include "metadata.h"
+#include <sstring.h>
+#include "peinformation.h"
+//
+
+#ifndef FEATURE_CORECLR
+interface IILFingerprint;
+interface IILFingerprintFactory;
+#endif
+interface IAssemblyName;
+
+// PE images loaded through the runtime.
+typedef struct _dummyCOR { BYTE b; } *HCORMODULE;
+
+class UTSemReadWrite;
+
+// Helper function to get a pointer to the Dispenser interface.
+STDAPI MetaDataGetDispenser( // Return HRESULT
+ REFCLSID rclsid, // The class to desired.
+ REFIID riid, // Interface wanted on class factory.
+ LPVOID FAR *ppv); // Return interface pointer here.
+
+// Helper function to check whether policy allows accessing the file
+STDAPI RuntimeCheckLocationAccess(LPCWSTR wszLocation);
+STDAPI RuntimeIsNativeImageOptedOut(IAssemblyName* pAssemblyDef);
+
+#ifdef FEATURE_VERSIONING
+LocaleID RuntimeGetFileSystemLocale();
+#endif // FEATURE_VERSIONING
+
+BOOL RuntimeFileNotFound(HRESULT hr);
+
+// Helper function to get an Internal interface with an in-memory metadata section
+STDAPI GetMetaDataInternalInterface(
+ LPVOID pData, // [IN] in memory metadata section
+ ULONG cbData, // [IN] size of the metadata section
+ DWORD flags, // [IN] CorOpenFlags
+ REFIID riid, // [IN] desired interface
+ void **ppv); // [OUT] returned interface
+
+// Helper function to get an internal scopeless interface given a scope.
+STDAPI GetMetaDataInternalInterfaceFromPublic(
+ IUnknown *pv, // [IN] Given interface
+ REFIID riid, // [IN] desired interface
+ void **ppv); // [OUT] returned interface
+
+// Helper function to get an internal scopeless interface given a scope.
+STDAPI GetMetaDataPublicInterfaceFromInternal(
+ void *pv, // [IN] Given interface
+ REFIID riid, // [IN] desired interface
+ void **ppv); // [OUT] returned interface
+
+// Converts an internal MD import API into the read/write version of this API.
+// This could support edit and continue, or modification of the metadata at
+// runtime (say for profiling).
+STDAPI ConvertMDInternalImport( // S_OK or error.
+ IMDInternalImport *pIMD, // [IN] The metadata to be updated.
+ IMDInternalImport **ppIMD); // [OUT] Put RW interface here.
+
+STDAPI GetAssemblyMDInternalImport( // Return code.
+ LPCWSTR szFileName, // [IN] The scope to open.
+ REFIID riid, // [IN] The interface desired.
+ IUnknown **ppIUnk); // [OUT] Return interface on success.
+
+HRESULT GetAssemblyMDInternalImportFromImage(
+ HCORMODULE hImage, //[IN] pointer to module handle to get the metadata from.
+ REFIID riid, //[IN] The interface desired.
+ IUnknown **ppIUnk); //[OUT] Return Interface on success.
+
+STDAPI GetAssemblyMDInternalImportByStream( // Return code.
+ IStream *pIStream, // [IN] The IStream for the file
+ UINT64 AssemblyId, // [IN] Unique Id for the assembly
+ REFIID riid, // [IN] The interface desired.
+ IUnknown **ppIUnk); // [OUT] Return interface on success.
+
+
+enum MDInternalImportFlags
+{
+ MDInternalImport_Default = 0,
+ MDInternalImport_NoCache = 1, // Do not share/cached the results of opening the image
+#ifdef FEATURE_PREJIT
+ MDInternalImport_TrustedNativeImage = 2, // The image is a native image, and so its format can be trusted
+ MDInternalImport_ILMetaData = 4, // Open the IL metadata, even if this is a native image
+ MDInternalImport_TrustedNativeImage_and_IL = MDInternalImport_TrustedNativeImage | MDInternalImport_ILMetaData,
+ MDInternalImport_NativeImageInstall = 0x100, // The image is a native image that is being installed into NIC
+#endif
+ MDInternalImport_CheckLongPath =8, // also check long version of the path
+ MDInternalImport_CheckShortPath =0x10, // also check long version of the path
+ MDInternalImport_OnlyLookInCache =0x20, // Only look in the cache. (If the cache does not have the image already loaded, return NULL)
+}; // enum MDInternalImportFlags
+
+
+
+STDAPI GetAssemblyMDInternalImportEx( // Return code.
+ LPCWSTR szFileName, // [IN] The scope to open.
+ REFIID riid, // [IN] The interface desired.
+ MDInternalImportFlags flags, // [in] Flags to control opening the assembly
+ IUnknown **ppIUnk, // [OUT] Return interface on success.
+ HANDLE hFile = INVALID_HANDLE_VALUE);
+
+STDAPI GetAssemblyMDInternalImportByStreamEx( // Return code.
+ IStream *pIStream, // [IN] The IStream for the file
+ UINT64 AssemblyId, // [IN] Unique Id for the assembly
+ REFIID riid, // [IN] The interface desired.
+ MDInternalImportFlags flags, // [in] Flags to control opening the assembly
+ IUnknown **ppIUnk); // [OUT] Return interface on success.
+
+
+// Returns part of the "Zap string" which describes the properties of a native image
+
+__success(SUCCEEDED(return))
+STDAPI GetNativeImageDescription(
+ __in_z LPCWSTR wzCustomString, // [IN] Custom string of the native image
+ DWORD dwConfigMask, // [IN] Config mask of the native image
+ __out_ecount_part_opt(*pdwLength,*pdwLength) LPWSTR pwzZapInfo,// [OUT] The description string. Can be NULL to find the size of buffer to allocate
+ LPDWORD pdwLength); // [IN/OUT] Length of the pwzZapInfo buffer on IN.
+ // Number of WCHARs (including termintating NULL) on OUT
+
+
+class CQuickBytes;
+
+
+// predefined constant for parent token for global functions
+#define COR_GLOBAL_PARENT_TOKEN TokenFromRid(1, mdtTypeDef)
+
+
+
+//////////////////////////////////////////////////////////////////////////
+//
+//////////////////////////////////////////////////////////////////////////
+
+// %%Interfaces: -------------------------------------------------------------
+
+// interface IMetaDataHelper
+
+// {AD93D71D-E1F2-11d1-9409-0000F8083460}
+EXTERN_GUID(IID_IMetaDataHelper, 0xad93d71d, 0xe1f2, 0x11d1, 0x94, 0x9, 0x0, 0x0, 0xf8, 0x8, 0x34, 0x60);
+
+#undef INTERFACE
+#define INTERFACE IMetaDataHelper
+DECLARE_INTERFACE_(IMetaDataHelper, IUnknown)
+{
+ // helper functions
+ // This function is exposing the ability to translate signature from a given
+ // source scope to a given target scope.
+ //
+ STDMETHOD(TranslateSigWithScope)(
+ IMetaDataAssemblyImport *pAssemImport, // [IN] importing assembly interface
+ const void *pbHashValue, // [IN] Hash Blob for Assembly.
+ ULONG cbHashValue, // [IN] Count of bytes.
+ IMetaDataImport *import, // [IN] importing interface
+ PCCOR_SIGNATURE pbSigBlob, // [IN] signature in the importing scope
+ ULONG cbSigBlob, // [IN] count of bytes of signature
+ IMetaDataAssemblyEmit *pAssemEmit, // [IN] emit assembly interface
+ IMetaDataEmit *emit, // [IN] emit interface
+ PCOR_SIGNATURE pvTranslatedSig, // [OUT] buffer to hold translated signature
+ ULONG cbTranslatedSigMax,
+ ULONG *pcbTranslatedSig) PURE;// [OUT] count of bytes in the translated signature
+
+ STDMETHOD(GetMetadata)(
+ ULONG ulSelect, // [IN] Selector.
+ void **ppData) PURE; // [OUT] Put pointer to data here.
+
+ STDMETHOD_(IUnknown *, GetCachedInternalInterface)(BOOL fWithLock) PURE; // S_OK or error
+ STDMETHOD(SetCachedInternalInterface)(IUnknown * pUnk) PURE; // S_OK or error
+ STDMETHOD_(UTSemReadWrite*, GetReaderWriterLock)() PURE; // return the reader writer lock
+ STDMETHOD(SetReaderWriterLock)(UTSemReadWrite * pSem) PURE;
+}; // IMetaDataHelper
+
+
+EXTERN_GUID(IID_IMetaDataEmitHelper, 0x5c240ae4, 0x1e09, 0x11d3, 0x94, 0x24, 0x0, 0x0, 0xf8, 0x8, 0x34, 0x60);
+
+#undef INTERFACE
+#define INTERFACE IMetaDataEmitHelper
+DECLARE_INTERFACE_(IMetaDataEmitHelper, IUnknown)
+{
+ // emit helper functions
+ STDMETHOD(DefineMethodSemanticsHelper)(
+ mdToken tkAssociation, // [IN] property or event token
+ DWORD dwFlags, // [IN] semantics
+ mdMethodDef md) PURE; // [IN] method to associated with
+
+ STDMETHOD(SetFieldLayoutHelper)( // Return hresult.
+ mdFieldDef fd, // [IN] field to associate the layout info
+ ULONG ulOffset) PURE; // [IN] the offset for the field
+
+ STDMETHOD(DefineEventHelper) (
+ mdTypeDef td, // [IN] the class/interface on which the event is being defined
+ LPCWSTR szEvent, // [IN] Name of the event
+ DWORD dwEventFlags, // [IN] CorEventAttr
+ mdToken tkEventType, // [IN] a reference (mdTypeRef or mdTypeRef) to the Event class
+ mdEvent *pmdEvent) PURE; // [OUT] output event token
+
+ STDMETHOD(AddDeclarativeSecurityHelper) (
+ mdToken tk, // [IN] Parent token (typedef/methoddef)
+ DWORD dwAction, // [IN] Security action (CorDeclSecurity)
+ void const *pValue, // [IN] Permission set blob
+ DWORD cbValue, // [IN] Byte count of permission set blob
+ mdPermission*pmdPermission) PURE; // [OUT] Output permission token
+
+ STDMETHOD(SetResolutionScopeHelper)( // Return hresult.
+ mdTypeRef tr, // [IN] TypeRef record to update
+ mdToken rs) PURE; // [IN] new ResolutionScope
+
+ STDMETHOD(SetManifestResourceOffsetHelper)( // Return hresult.
+ mdManifestResource mr, // [IN] The manifest token
+ ULONG ulOffset) PURE; // [IN] new offset
+
+ STDMETHOD(SetTypeParent)( // Return hresult.
+ mdTypeDef td, // [IN] Type definition
+ mdToken tkExtends) PURE; // [IN] parent type
+
+ STDMETHOD(AddInterfaceImpl)( // Return hresult.
+ mdTypeDef td, // [IN] Type definition
+ mdToken tkInterface) PURE; // [IN] interface type
+
+}; // IMetaDataEmitHelper
+
+//////////////////////////////////////////////////////////////////////////////
+// enum CorElementTypeZapSig defines some additional internal ELEMENT_TYPE's
+// values that are only used by ZapSig signatures.
+//////////////////////////////////////////////////////////////////////////////
+typedef enum CorElementTypeZapSig
+{
+ // ZapSig encoding for ELEMENT_TYPE_VAR and ELEMENT_TYPE_MVAR. It is always followed
+ // by the RID of a GenericParam token, encoded as a compressed integer.
+ ELEMENT_TYPE_VAR_ZAPSIG = 0x3b,
+
+ // ZapSig encoding for an array MethodTable to allow it to remain such after decoding
+ // (rather than being transformed into the TypeHandle representing that array)
+ //
+ // The element is always followed by ELEMENT_TYPE_SZARRAY or ELEMENT_TYPE_ARRAY
+ ELEMENT_TYPE_NATIVE_ARRAY_TEMPLATE_ZAPSIG = 0x3c,
+
+ // ZapSig encoding for native value types in IL stubs. IL stub signatures may contain
+ // ELEMENT_TYPE_INTERNAL followed by ParamTypeDesc with ELEMENT_TYPE_VALUETYPE element
+ // type. It acts like a modifier to the underlying structure making it look like its
+ // unmanaged view (size determined by unmanaged layout, blittable, no GC pointers).
+ //
+ // ELEMENT_TYPE_NATIVE_VALUETYPE_ZAPSIG is used when encoding such types to NGEN images.
+ // The signature looks like this: ET_NATIVE_VALUETYPE_ZAPSIG ET_VALUETYPE <token>.
+ // See code:ZapSig.GetSignatureForTypeHandle and code:SigPointer.GetTypeHandleThrowing
+ // where the encoding/decoding takes place.
+ ELEMENT_TYPE_NATIVE_VALUETYPE_ZAPSIG = 0x3d,
+
+ ELEMENT_TYPE_CANON_ZAPSIG = 0x3e, // zapsig encoding for [mscorlib]System.__Canon
+ ELEMENT_TYPE_MODULE_ZAPSIG = 0x3f, // zapsig encoding for external module id#
+
+} CorElementTypeZapSig;
+
+typedef enum CorCallingConventionInternal
+{
+ // IL stub signatures containing types that need to be restored have the highest
+ // bit of the calling convention set.
+ IMAGE_CEE_CS_CALLCONV_NEEDSRESTORE = 0x80,
+
+} CorCallingConventionInternal;
+
+//////////////////////////////////////////////////////////////////////////
+// Obsoleted ELEMENT_TYPE values which are not supported anymore.
+// They are not part of CLI ECMA spec, they were only experimental before v1.0 RTM.
+// They are needed for indexing arrays initialized using file:corTypeInfo.h
+// 0x17 ... VALUEARRAY <type> <bound>
+// 0x1a ... CPU native floating-point type
+//////////////////////////////////////////////////////////////////////////
+#define ELEMENT_TYPE_VALUEARRAY_UNSUPPORTED ((CorElementType) 0x17)
+#define ELEMENT_TYPE_R_UNSUPPORTED ((CorElementType) 0x1a)
+
+// Use this guid in the SetOption if Reflection.Emit wants to control size of the initially allocated
+// MetaData. See values: code:CorMetaDataInitialSize.
+//
+// {2675b6bf-f504-4cb4-a4d5-084eea770ddc}
+EXTERN_GUID(MetaDataInitialSize, 0x2675b6bf, 0xf504, 0x4cb4, 0xa4, 0xd5, 0x08, 0x4e, 0xea, 0x77, 0x0d, 0xdc);
+
+// Allowed values for code:MetaDataInitialSize option.
+typedef enum CorMetaDataInitialSize
+{
+ MDInitialSizeDefault = 0,
+ MDInitialSizeMinimal = 1
+} CorMetaDataInitialSize;
+
+// Internal extension of open flags code:CorOpenFlags
+typedef enum CorOpenFlagsInternal
+{
+#ifdef FEATURE_METADATA_LOAD_TRUSTED_IMAGES
+ // Flag code:ofTrustedImage is used by mscordbi.dll, therefore defined in file:CorPriv.h
+ ofTrustedImage = ofReserved3 // We trust this PE file (we are willing to do a LoadLibrary on it).
+ // It is optional and only an (VM) optimization - typically for NGEN images
+ // opened by debugger.
+#endif
+} CorOpenFlagsInternal;
+
+#ifdef FEATURE_METADATA_LOAD_TRUSTED_IMAGES
+#define IsOfTrustedImage(x) ((x) & ofTrustedImage)
+#endif
+
+// %%Classes: ----------------------------------------------------------------
+#ifndef offsetof
+#define offsetof(s,f) ((ULONG)(&((s*)0)->f))
+#endif
+#ifndef lengthof
+#define lengthof(rg) (sizeof(rg)/sizeof(rg[0]))
+#endif
+
+#define COR_MODULE_CLASS "<Module>"
+#define COR_WMODULE_CLASS W("<Module>")
+
+STDAPI RuntimeOpenImage(LPCWSTR pszFileName, HCORMODULE* hHandle);
+STDAPI RuntimeOpenImageInternal(LPCWSTR pszFileName, HCORMODULE* hHandle,
+ DWORD *pdwLength, MDInternalImportFlags flags, HANDLE hFile = INVALID_HANDLE_VALUE);
+STDAPI RuntimeOpenImageByStream(IStream* pIStream, UINT64 AssemblyId, DWORD dwModuleId,
+ HCORMODULE* hHandle, DWORD *pdwLength, MDInternalImportFlags flags);
+
+#ifndef FEATURE_CORECLR
+// NOTE: Performance critical codepaths should cache the result of this function.
+STDAPI RuntimeGetILFingerprintForPath(LPCWSTR path, IILFingerprint **ppFingerprint);
+STDAPI RuntimeCreateCachingILFingerprintFactory(IILFingerprintFactory **ppILFingerprintFactory);
+#endif //!FEATURE_CORECLR
+void RuntimeAddRefHandle(HCORMODULE hHandle);
+STDAPI RuntimeReleaseHandle(HCORMODULE hHandle);
+STDAPI RuntimeGetImageBase(HCORMODULE hHandle, LPVOID* base, BOOL bMapped, COUNT_T* dwSize);
+STDAPI RuntimeGetImageKind(HCORMODULE hHandle, DWORD* pdwKind, DWORD* pdwMachine);
+STDAPI RuntimeOSHandle(HCORMODULE hHandle, HMODULE* hModule);
+STDAPI RuntimeGetAssemblyStrongNameHashForModule(HCORMODULE hModule,
+ IMetaDataImport *pMDimport,
+ BYTE *pbSNHash,
+ DWORD *pcbSNHash);
+STDAPI RuntimeGetMDInternalImport(HCORMODULE hHandle,
+ MDInternalImportFlags flags,
+ IMDInternalImport** ppMDImport);
+
+FORCEINLINE
+void ReleaseHCorModule(HCORMODULE hModule)
+{
+ HRESULT hr = RuntimeReleaseHandle(hModule);
+ _ASSERTE(SUCCEEDED(hr));
+}
+
+typedef Wrapper<HCORMODULE, DoNothing<HCORMODULE>, ReleaseHCorModule, (UINT_PTR) NULL> HCORMODULEHolder;
+
+
+// ===========================================================================
+// ISNAssemblySignature (similar to IAssemblySignature in V1)
+//
+// This is a private interface that allows querying of the strong name
+// signature.
+// This can be used for (strong-named) assemblies added to the GAC as
+// a unique identifier.
+//
+
+// {848845BC-0C4A-42e3-8915-DC850112443D}
+EXTERN_GUID(IID_ISNAssemblySignature, 0x848845BC, 0x0C4A, 0x42e3, 0x89, 0x15, 0xDC, 0x85, 0x01, 0x12, 0x44, 0x3D);
+
+#undef INTERFACE
+#define INTERFACE ISNAssemblySignature
+DECLARE_INTERFACE_(ISNAssemblySignature, IUnknown)
+{
+ // Returns the strong-name signature if the assembly is strong-name-signed
+ // Returns the MVID if the assembly is delay-signed.
+ // Fails if the assembly is not signed at all.
+ STDMETHOD(GetSNAssemblySignature) (
+ BYTE *pbSig, // [IN, OUT] Buffer to write signature
+ DWORD *pcbSig // [IN, OUT] Size of buffer, bytes written
+ ) PURE;
+};
+
+//-------------------------------------
+//--- ICeeGenInternal
+//-------------------------------------
+// {9fd3c7af-dc4e-4b9b-be22-9cf8cc577489}
+EXTERN_GUID(IID_ICeeGenInternal, 0x9fd3c7af, 0xdc4e, 0x4b9b, 0xbe, 0x22, 0x9c, 0xf8, 0xcc, 0x57, 0x74, 0x89);
+
+#undef INTERFACE
+#define INTERFACE ICeeGenInternal
+DECLARE_INTERFACE_(ICeeGenInternal, IUnknown)
+{
+ STDMETHOD (SetInitialGrowth) (DWORD growth) PURE;
+};
+
+// ===========================================================================
+#ifdef FEATURE_PREJIT
+// ===========================================================================
+
+#define CLR_OPTIMIZATION_SERVICE_DLL_NAME W("mscorsvc.dll")
+#define CLR_OPT_SVC_ENTRY_POINT "CorGetSvc"
+
+// Use the default JIT compiler
+#define DEFAULT_NGEN_COMPILER_DLL_NAME W("clrjit.dll")
+
+
+struct CORCOMPILE_ASSEMBLY_SIGNATURE;
+
+//
+// IGetIMDInternalImport
+//
+// Private interface exposed by
+// AssemblyMDInternalImport - gives us access to the internally stored IMDInternalImport*.
+//
+// RegMeta, WinMDImport - supports the internal GetMetaDataInternalInterfaceFromPublic() "api".
+//
+// {92B2FEF9-F7F5-420d-AD42-AECEEE10A1EF}
+EXTERN_GUID(IID_IGetIMDInternalImport, 0x92b2fef9, 0xf7f5, 0x420d, 0xad, 0x42, 0xae, 0xce, 0xee, 0x10, 0xa1, 0xef);
+#undef INTERFACE
+#define INTERFACE IGetIMDInternalImport
+DECLARE_INTERFACE_(IGetIMDInternalImport, IUnknown)
+{
+ STDMETHOD(GetIMDInternalImport) (
+ IMDInternalImport ** ppIMDInternalImport // [OUT] Buffer to receive IMDInternalImport*
+ ) PURE;
+};
+
+
+
+#ifndef DACCESS_COMPILE
+
+/* --------------------------------------------------------------------------- *
+ * NGen logger
+ * --------------------------------------------------------------------------- */
+ #include "mscorsvc.h"
+
+struct ICorSvcLogger;
+class SvcLogger
+{
+public:
+
+ SvcLogger();
+ ~SvcLogger();
+ void ReleaseLogger();
+ void SetSvcLogger(ICorSvcLogger *pCorSvcLoggerArg);
+ BOOL HasSvcLogger();
+ ICorSvcLogger* GetSvcLogger();
+ void Printf(const CHAR *format, ...);
+ void SvcPrintf(const CHAR *format, ...);
+ void Printf(const WCHAR *format, ...);
+ void Printf(CorSvcLogLevel logLevel, const WCHAR *format, ...);
+ void SvcPrintf(const WCHAR *format, ...);
+ void Log(const WCHAR *message, CorSvcLogLevel logLevel = LogLevel_Warning);
+ //Need to add this to allocate StackSString, as we don't want static class
+
+private:
+
+ void LogHelper(SString s, CorSvcLogLevel logLevel = LogLevel_Success);
+ //instantiations that need VM services like contracts in dllmain.
+ void CheckInit();
+
+ StackSString* pss;
+ ICorSvcLogger *pCorSvcLogger;
+}; // class SvcLogger
+
+SvcLogger *GetSvcLogger();
+BOOL HasSvcLogger();
+#endif // #ifndef DACCESS_COMPILE
+
+// ===========================================================================
+#endif // #ifdef FEATURE_PREJIT
+// ===========================================================================
+
+struct CORCOMPILE_ASSEMBLY_SIGNATURE;
+struct CORCOMPILE_VERSION_INFO;
+struct CORCOMPILE_DEPENDENCY;
+typedef GUID CORCOMPILE_NGEN_SIGNATURE;
+
+#ifdef FEATURE_FUSION
+//**********************************************************************
+// Gets the dependancies of a native image. If these change, then
+// the native image cannot be used.
+//
+// IMetaDataImport::GetAssemblyRefProps() can be used to obtain information about
+// the mdAssemblyRefs.
+//*****************************************************************************
+
+// {814C9E35-3F3F-4975-977A-371F0A878AC7}
+EXTERN_GUID(IID_INativeImageDependency, 0x814c9e35, 0x3f3f, 0x4975, 0x97, 0x7a, 0x37, 0x1f, 0xa, 0x87, 0x8a, 0xc7);
+
+DECLARE_INTERFACE_(INativeImageDependency, IUnknown)
+{
+ // Get the referenced assembly
+ STDMETHOD (GetILAssemblyRef) (
+ mdAssemblyRef * pAssemblyRef // [OUT]
+ ) PURE;
+
+ // Get the post-policy assembly actually used
+ STDMETHOD (GetILAssemblyDef) (
+ mdAssemblyRef * ppAssemblyDef, // [OUT]
+ CORCOMPILE_ASSEMBLY_SIGNATURE * pSign // [OUT]
+ ) PURE;
+
+ // Get the native image corresponding to GetILAssemblyDef() IF
+ // there is a hard-bound (directly-referenced) native dependancy
+ //
+ // We do not need the configStrig because configStrings have to
+ // be an exact part. Any partial matches are factored out into GetConfigMask()
+ STDMETHOD (GetNativeAssemblyDef) (
+ CORCOMPILE_NGEN_SIGNATURE * pNativeSign // [OUT] INVALID_NGEN_SIGNATURE if there is no hard-bound dependancy
+ ) PURE;
+
+ // Get PEKIND of the referenced assembly
+ STDMETHOD (GetPEKind) (
+ PEKIND * CorPEKind // [OUT]
+ ) PURE;
+
+}; // INativeImageDependency
+
+//*****************************************************************************
+//
+// Fusion uses IFusionNativeImageInfo to obtain (and cache) informaton
+// about a native image being installed into the native image cache.
+// This allows Fusion to bind directly to native images
+// without requiring (expensively) binding to the IL assembly first.
+//
+// IMetaDataAssemblyImport can be queried for this interface
+//
+//*****************************************************************************
+// {0EA273D0-B4DA-4008-A60D-8D6EFFDD6E91}
+EXTERN_GUID(IID_INativeImageInstallInfo, 0xea273d0, 0xb4da, 0x4008, 0xa6, 0xd, 0x8d, 0x6e, 0xff, 0xdd, 0x6e, 0x91);
+
+DECLARE_INTERFACE_(INativeImageInstallInfo, IUnknown)
+{
+ // Signature of the ngen image
+ // This matches the argument type of INativeImageDependency::GetNativeAssemblyDef
+
+ STDMETHOD (GetSignature) (
+ CORCOMPILE_NGEN_SIGNATURE * pNgenSign // [OUT]
+ ) PURE;
+
+
+ // CLR timestamp, CPU, compile options, OS type and other attributes of the
+ // NI image. This can be used to verify that the NI image was built
+ // with the running CLR.
+
+ STDMETHOD (GetVersionInfo) (
+ CORCOMPILE_VERSION_INFO * pVersionInfo // [OUT]
+ ) PURE;
+
+
+ // Signature of the source IL assembly. This can be used to
+ // verify that the IL image matches a candidate ngen image.
+ // This matches the argument type of IAssemblyRuntimeSignature::CheckSignature
+ //
+
+ STDMETHOD (GetILSignature) (
+ CORCOMPILE_ASSEMBLY_SIGNATURE * pILSign // [OUT]
+ ) PURE;
+
+ // A partial match is allowed for the current NativeImage to be valid
+
+ STDMETHOD (GetConfigMask) (
+ DWORD * pConfigMask // [OUT]
+ ) PURE;
+
+ //
+ // Dependancy assemblies. The native image is only valid
+ // if the dependancies have not changed.
+ //
+
+ STDMETHOD (EnumDependencies) (
+ HCORENUM * phEnum, // [IN/OUT] - Pointer to the enum
+ INativeImageDependency *rDeps[], // [OUT]
+ ULONG cMax, // [IN] Max dependancies to enumerate in this iteration
+ DWORD * pdwCount // [OUT] - Number of dependancies actually enumerated
+ ) PURE;
+
+
+ // Retrieve a specific dependency by the ngen signature.
+
+ STDMETHOD (GetDependency) (
+ const CORCOMPILE_NGEN_SIGNATURE *pcngenSign, // [IN] ngenSig of dependency you want
+ CORCOMPILE_DEPENDENCY *pDep // [OUT] matching dependency
+ ) PURE;
+
+}; // INativeImageInstallInfo
+
+//*****************************************************************************
+//
+// Runtime callback made by Fusion into the CLR to determine if the NativeAssembly
+// can be used. The pUnkBindSink argument of CAssemblyName::BindToObject() can
+// be queried for this interface
+//
+//*****************************************************************************
+// {065AA013-9BDC-447c-922F-FEE929908447}
+EXTERN_GUID(IID_INativeImageEvaluate, 0x65aa013, 0x9bdc, 0x447c, 0x92, 0x2f, 0xfe, 0xe9, 0x29, 0x90, 0x84, 0x47);
+
+#ifdef _PREFAST_
+#pragma warning(push)
+#pragma warning(disable:28718)
+#endif //_PREFAST_
+
+interface IAssembly;
+
+#ifdef _PREFAST_
+#pragma warning(pop)
+#endif //_PREFAST_
+
+
+DECLARE_INTERFACE_(INativeImageEvaluate, IUnknown)
+{
+ // This will be called before the assemblies are actually loaded.
+ //
+ // Returns S_FALSE if the native-image cannot be used.
+
+ STDMETHOD (Evaluate) (
+ IAssembly *pILAssembly, // [IN] IL assembly in question
+ IAssembly *pNativeAssembly, // [IN] NGen image we are trying to use for pILAssembly
+ BYTE * pbCachedData, // [IN] Data cached when the native-image was generated
+ DWORD dwDataSize // [IN] Size of the pbCachedData buffer
+ ) PURE;
+}; // INativeImageEvaluate
+
+#endif // FEATURE_FUSION
+
+//**********************************************************************
+// Internal versions of shim functions for use by the CLR.
+
+STDAPI LoadLibraryShimInternal(
+ LPCWSTR szDllName,
+ LPCWSTR szVersion,
+ LPVOID pvReserved,
+ HMODULE *phModDll);
+
+STDAPI GetCORSystemDirectoryInternaL(
+ SString& pBuffer
+ );
+
+//LONGPATH:TODO: Remove this once Desktop usage has been removed
+STDAPI GetCORSystemDirectoryInternal(
+ __out_ecount_part_opt(cchBuffer, *pdwLength) LPWSTR pBuffer,
+ DWORD cchBuffer,
+ __out_opt DWORD* pdwLength
+ );
+
+STDAPI GetCORVersionInternal(
+ __out_ecount_z_opt(cchBuffer) LPWSTR pBuffer,
+ DWORD cchBuffer,
+ __out DWORD *pdwLength);
+
+STDAPI GetRequestedRuntimeInfoInternal(LPCWSTR pExe,
+ LPCWSTR pwszVersion,
+ LPCWSTR pConfigurationFile,
+ DWORD startupFlags,
+ DWORD runtimeInfoFlags,
+ __out_ecount_opt(dwDirectory) LPWSTR pDirectory,
+ DWORD dwDirectory,
+ __out_opt DWORD *pdwDirectoryLength,
+ __out_ecount_opt(cchBuffer) LPWSTR pVersion,
+ DWORD cchBuffer,
+ __out_opt DWORD* pdwLength);
+
+
+#ifdef FEATURE_PREJIT
+
+//**********************************************************************
+// Access to native image validation logic in the runtime.
+//
+// An interface only a mother could live as this logic should really be encapsulated in
+// the native binder. But for historical reasons, it lives in the VM directory
+// and is shared by the desktop and coreclr's which have separate native binders.
+// Hence, this interface inherits a lot of "baggage."
+
+#ifdef FEATURE_FUSION
+interface IFusionBindLog;
+interface IAssemblyName;
+#endif // FEATURE_FUSION
+
+
+// A small shim around PEAssemblies/IBindResult that allow us to write Fusion/CLR-agnostic code
+// for logging native bind failures to the Fusion log/CLR log.
+//
+// These objects are stack-based and non-thread-safe. They are created for the duration of a single RuntimeVerify call.
+// The methods are expected to compute their data lazily as they are only used in bind failures or in checked builds.
+//
+// This class also exposes the IFusionBindLog pointer. This isn't really the appropriate place to expose that but
+// it serves to avoid compiling references to IFUsionBindLog into code that doesn't define FEATURE_FUSION.
+class LoggableAssembly
+{
+ public:
+ virtual SString DisplayString() = 0; // Returns an unspecified representation suitable for injecting into log messages.
+#ifdef FEATURE_FUSION
+ virtual IAssemblyName* FusionAssemblyName() = 0; // Can return NULL. Caller must NOT release result.
+ virtual IFusionBindLog* FusionBindLog() = 0; // Can return NULL. Caller must NOT release result.
+#endif // FEATURE_FUSION
+};
+
+
+// Validates that an NI matches the running CLR, OS, CPU, etc.
+BOOL RuntimeVerifyNativeImageVersion(const CORCOMPILE_VERSION_INFO *pVerInfo, LoggableAssembly *pLogAsm);
+
+// Validates that an NI matches the required flavor (debug, instrumented, etc.)
+BOOL RuntimeVerifyNativeImageFlavor(const CORCOMPILE_VERSION_INFO *pVerInfo, LoggableAssembly *pLogAsm);
+
+// Validates that a hard-dep matches the a parent NI's compile-time hard-dep.
+BOOL RuntimeVerifyNativeImageDependency(const CORCOMPILE_NGEN_SIGNATURE &ngenSigExpected,
+ const CORCOMPILE_VERSION_INFO *pActual,
+ LoggableAssembly *pLogAsm);
+
+BOOL RuntimeVerifyNativeImageDependency(const CORCOMPILE_DEPENDENCY *pExpected,
+ const CORCOMPILE_VERSION_INFO *pActual,
+ LoggableAssembly *pLogAsm);
+
+#endif // FEATURE_PREJIT
+
+
+
+#ifndef FEATURE_CORECLR
+
+#include "iilfingerprint.h"
+
+#endif //!FEATURE_CORECLR
+
+#endif // _CORPRIV_H_
+// EOF =======================================================================
+
diff --git a/src/inc/corprof.idl b/src/inc/corprof.idl
new file mode 100644
index 0000000000..4288897844
--- /dev/null
+++ b/src/inc/corprof.idl
@@ -0,0 +1,3857 @@
+// 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.
+
+/**************************************************************************************
+ ** **
+ ** Corprof.idl - CLR Profiling interfaces. **
+ ** **
+ **************************************************************************************/
+
+/* -------------------------------------------------------------------------- *
+ * Imported types
+ * -------------------------------------------------------------------------- */
+
+#if !DEFINITIONS_FROM_NON_IMPORTABLE_PLACES
+
+cpp_quote("#define CorDB_CONTROL_Profiling \"Cor_Enable_Profiling\"")
+cpp_quote("#define CorDB_CONTROL_ProfilingL L\"Cor_Enable_Profiling\"")
+
+cpp_quote("#if 0")
+
+
+import "unknwn.idl";
+
+typedef LONG32 mdToken;
+typedef mdToken mdModule;
+typedef mdToken mdTypeDef;
+typedef mdToken mdMethodDef;
+typedef mdToken mdFieldDef;
+typedef ULONG CorElementType;
+
+// Forward declaration of enum in CorHdr.h
+enum CorElementType;
+
+// Forward declaration of structs in Cor.h
+
+typedef struct
+{
+ DWORD dwOSPlatformId; // Operating system platform.
+ DWORD dwOSMajorVersion; // OS Major version.
+ DWORD dwOSMinorVersion; // OS Minor version.
+} OSINFO;
+
+typedef struct
+{
+ USHORT usMajorVersion; // Major Version.
+ USHORT usMinorVersion; // Minor Version.
+ USHORT usBuildNumber; // Build Number.
+ USHORT usRevisionNumber; // Revision Number.
+ LPWSTR szLocale; // Locale.
+ ULONG cbLocale; // [IN/OUT] Size of the buffer in wide chars/Actual size.
+ DWORD *rProcessor; // Processor ID array.
+ ULONG ulProcessor; // [IN/OUT] Size of the Processor ID array/Actual # of entries filled in.
+ OSINFO *rOS; // OSINFO array.
+ ULONG ulOS; // [IN/OUT]Size of the OSINFO array/Actual # of entries filled in.
+} ASSEMBLYMETADATA;
+
+cpp_quote("#endif")
+
+typedef const BYTE *LPCBYTE;
+typedef BYTE *LPBYTE;
+
+#endif
+
+
+cpp_quote("#ifndef _COR_IL_MAP")
+cpp_quote("#define _COR_IL_MAP")
+
+#ifdef INTERNAL_DOCS
+// Note that this structure is also defined in CorDebug.idl - PROPAGATE CHANGES
+// BOTH WAYS, or this'll become a really insidious bug some day.
+#endif
+typedef struct _COR_IL_MAP
+{
+ ULONG32 oldOffset; // Old IL offset relative to beginning of function
+ ULONG32 newOffset; // New IL offset relative to beginning of function
+ BOOL fAccurate; //put here for compatibility with the Debugger structure.
+} COR_IL_MAP;
+
+cpp_quote("#endif //_COR_IL_MAP")
+
+cpp_quote("#ifndef _COR_DEBUG_IL_TO_NATIVE_MAP_")
+cpp_quote("#define _COR_DEBUG_IL_TO_NATIVE_MAP_")
+
+/* ICorProfilerInfo:: GetILToNativeMapping returns an array of
+ * COR_DEBUG_IL_TO_NATIVE_MAP structures. In order to convey that certain
+ * ranges of native instructions correspond to special regions of code (for
+ * example, the prolog), an entry in the array may have it's ilOffset field set
+ * to one of these values.
+ */
+typedef enum CorDebugIlToNativeMappingTypes
+{
+ NO_MAPPING = -1,
+ PROLOG = -2,
+ EPILOG = -3
+} CorDebugIlToNativeMappingTypes;
+
+typedef struct COR_DEBUG_IL_TO_NATIVE_MAP
+{
+ ULONG32 ilOffset;
+ ULONG32 nativeStartOffset;
+ ULONG32 nativeEndOffset;
+} COR_DEBUG_IL_TO_NATIVE_MAP;
+
+cpp_quote("#endif // _COR_DEBUG_IL_TO_NATIVE_MAP_")
+
+cpp_quote("#ifndef _COR_FIELD_OFFSET_")
+cpp_quote("#define _COR_FIELD_OFFSET_")
+
+typedef struct _COR_FIELD_OFFSET
+{
+ mdFieldDef ridOfField; // fieldDef token of the field
+ ULONG ulOffset; // offset (from the ObjectID pointer) of the field
+} COR_FIELD_OFFSET;
+
+cpp_quote("#endif // _COR_FIELD_OFFSET_")
+
+
+#ifndef DO_NO_IMPORTS
+import "wtypes.idl";
+import "unknwn.idl";
+#endif
+
+typedef UINT_PTR ProcessID;
+typedef UINT_PTR AssemblyID;
+typedef UINT_PTR AppDomainID;
+typedef UINT_PTR ModuleID;
+typedef UINT_PTR ClassID;
+typedef UINT_PTR ThreadID;
+typedef UINT_PTR ContextID;
+typedef UINT_PTR FunctionID;
+typedef UINT_PTR ObjectID;
+typedef UINT_PTR GCHandleID;
+typedef UINT_PTR COR_PRF_ELT_INFO;
+typedef UINT_PTR ReJITID;
+
+typedef union {FunctionID functionID; UINT_PTR clientID;} FunctionIDOrClientID;
+
+/*
+ * The FunctionIDMapper type definition is used by the
+ * ICorProfilerInfo::SetFunctionIDMapper method to specify
+ * a function that will be called to map FunctionIDs to alternative
+ * values that will be passed to the function entry and function exit
+ * callbacks supplied to the ICorProfilerInfo::SetEnterLeaveFunctionHooks
+ * method. The mapper can be set only once and it is recommended to do so
+ * in the Initialize callback.
+ *
+ * NOTE: There is a known bug in this API that must be worked around.
+ * The return value of FunctionIDMapper cannot be NULL (unless the boolean
+ * value in pbHookTheFunction is FALSE). All other values are treated as
+ * opaque data to be passed to the entry/exit callback functions. The use
+ * of a NULL return value will produce unpredictable results, including
+ * possibly halting the process.
+ *
+ * NOTE: Profilers should be tolerant of cases where multiple threads of
+ * a profiled app are calling the same method simultaneously. In such
+ * cases, the profiler may receive multiple FunctionIDMapper callbacks
+ * for the same functionId. The profiler should be certain to return
+ * the same values from this callback when it is called multiple times
+ * with the same functionId.
+ *
+ */
+typedef UINT_PTR __stdcall FunctionIDMapper(
+ FunctionID funcId,
+ BOOL *pbHookFunction);
+
+typedef UINT_PTR __stdcall FunctionIDMapper2(
+ FunctionID funcId,
+ void *clientData,
+ BOOL *pbHookFunction);
+
+/*
+ * Enum for specifying how much data to pass back with a stack snapshot
+ */
+typedef enum _COR_PRF_SNAPSHOT_INFO
+{
+ COR_PRF_SNAPSHOT_DEFAULT = 0x0,
+
+ // Return a register context for each frame
+ COR_PRF_SNAPSHOT_REGISTER_CONTEXT = 0x1,
+
+ // Use a quicker stack walk algorithm based on the EBP frame chain. This is available
+ // on x86 only.
+ COR_PRF_SNAPSHOT_X86_OPTIMIZED = 0x2,
+} COR_PRF_SNAPSHOT_INFO;
+
+/*
+ * Opaque handle that represents information about a given stack frame. It is only
+ * valid during the callback to which it is passed.
+ */
+typedef UINT_PTR COR_PRF_FRAME_INFO;
+
+/*
+ * Describes a range of function arguments stored contiguously in left-to-right
+ * order in memory.
+ */
+typedef struct _COR_PRF_FUNCTION_ARGUMENT_RANGE
+{
+ UINT_PTR startAddress; // start address of the range
+ ULONG length; // contiguous length of the range
+} COR_PRF_FUNCTION_ARGUMENT_RANGE;
+
+/*
+ * Describes the locations in memory of a function's arguments, in
+ * left-to-right order. Note that arguments stored in registers are
+ * spilled to memory to build these structures.
+ */
+typedef struct _COR_PRF_FUNCTION_ARGUMENT_INFO
+{
+ ULONG numRanges; // number of chunks of arguments
+ ULONG totalArgumentSize; // total size of arguments
+ COR_PRF_FUNCTION_ARGUMENT_RANGE ranges[1]; // chunks
+} COR_PRF_FUNCTION_ARGUMENT_INFO;
+
+/*
+ * Represents one contiguous chunk of native code
+ */
+typedef struct _COR_PRF_CODE_INFO
+{
+ UINT_PTR startAddress;
+ SIZE_T size;
+} COR_PRF_CODE_INFO;
+
+/*
+ * Enum for describing the type of static a field is. These may be bit-wise
+ * or'ed with each other if the field is multiple types.
+ */
+typedef enum
+{
+ COR_PRF_FIELD_NOT_A_STATIC = 0x0,
+ COR_PRF_FIELD_APP_DOMAIN_STATIC = 0x1,
+ COR_PRF_FIELD_THREAD_STATIC = 0x2,
+ COR_PRF_FIELD_CONTEXT_STATIC = 0x4,
+ COR_PRF_FIELD_RVA_STATIC = 0x8
+} COR_PRF_STATIC_TYPE;
+
+/*
+ * Represents a function uniquely by combining the FunctionID
+ * with a ReJITID.
+ */
+typedef struct _COR_PRF_FUNCTION
+{
+ FunctionID functionId;
+ ReJITID reJitId;
+} COR_PRF_FUNCTION;
+
+
+/*
+ * Structure populated by profiler when declaring additional assembly references
+ * that the CLR should consider when performing an assembly reference closure
+ * walk. See ICorProfilerCallback6::GetAssemblyReferences and
+ * ICorProfilerAssemblyReferenceProvider::AddAssemblyReference
+ */
+typedef struct _COR_PRF_ASSEMBLY_REFERENCE_INFO
+{
+ void *pbPublicKeyOrToken; // Public key or token of the assembly.
+ ULONG cbPublicKeyOrToken; // Count of bytes in the public key or token.
+ LPCWSTR szName; // Name of the assembly being referenced.
+ ASSEMBLYMETADATA * pMetaData; // Assembly MetaData, as defined in cor.h
+ void *pbHashValue; // Hash Blob.
+ ULONG cbHashValue; // Count of bytes in the Hash Blob.
+ DWORD dwAssemblyRefFlags; // Flags.
+} COR_PRF_ASSEMBLY_REFERENCE_INFO;
+
+
+/*
+ * Represents a IL methods uniquely by combining the module ID and method token.
+ */
+typedef struct _COR_PRF_METHOD
+{
+ ModuleID moduleId;
+ mdMethodDef methodId;
+} COR_PRF_METHOD;
+
+/*
+ * NOTE!!!
+ *
+ * The following applies to ALL FunctionEnter[2,3], FunctionLeave[2,3],
+ * FunctionTailcall[2,3] hooks below:
+ *
+ * It is VERY IMPORTANT to note that these function implementations must be
+ * __declspec(naked), since the EE is not saving any registers before calling
+ * any of them. YOU MUST SAVE ALL REGISTERS YOU USE, INCLUDING FPU REGISTERS
+ * IF THE FPU STACK IS NOT EMPTY AND YOU INTEND TO USE IT.
+ *
+ * NOTE: The profiler should not block here, since the stack may not be in a
+ * GC-friendly state and so preemptive GC cannot be enabled. If the
+ * profiler blocks here and a GC is attempted, the runtime will block
+ * until this callback returns. Also, the profiler may NOT call into
+ * managed code or in any way cause a managed memory allocation.
+ */
+
+ /*
+ * NOTE: DEPRECATED IN V2
+ *
+ * These functions are considered deprecated in V2 and higher. They will
+ * continue to work, but incur a performance penalty for usage. For equivalent
+ * functionality, use the FunctionEnter3/Leave3/Tailcall3 callbacks with
+ * bits cleared for COR_PRF_ENABLE_FRAME_INFO, COR_PRF_ENABLE_FUNCTION_RETVAL
+ * and COR_PRF_ENABLE_FUNCTION_ARGS.
+ */
+typedef void __stdcall FunctionEnter(
+ FunctionID funcID);
+
+typedef void __stdcall FunctionLeave(
+ FunctionID funcID);
+
+typedef void __stdcall FunctionTailcall(
+ FunctionID funcID);
+
+/*
+ * NOTE: DEPRECATED IN V4
+ *
+ * These functions are considered deprecated in V4 and higher. They will
+ * continue to work, but incur a performance penalty for usage. For equivalent
+ * functionality, use the FunctionEnter3/Leave3/Tailcall3 callbacks.
+ */
+
+typedef void __stdcall FunctionEnter2(
+ FunctionID funcId,
+ UINT_PTR clientData,
+ COR_PRF_FRAME_INFO func,
+ COR_PRF_FUNCTION_ARGUMENT_INFO *argumentInfo);
+
+typedef void __stdcall FunctionLeave2(
+ FunctionID funcId,
+ UINT_PTR clientData,
+ COR_PRF_FRAME_INFO func,
+ COR_PRF_FUNCTION_ARGUMENT_RANGE *retvalRange);
+
+typedef void __stdcall FunctionTailcall2(
+ FunctionID funcId,
+ UINT_PTR clientData,
+ COR_PRF_FRAME_INFO func);
+
+/*
+ * When you are not interested in inspecting arguments or return values, then
+ * use these to be notified as functions are called and return. Use
+ * SetEnterLeaveFunctionHooks3 to register your implementations of these
+ * functions.
+ *
+ * functionIDOrClientID: if the profiler returned a remapped value from
+ * FunctionIDMapper[2], then this is that remapped value; else it is the
+ * true FunctionID of the function.
+ */
+
+typedef void __stdcall FunctionEnter3(
+ FunctionIDOrClientID functionIDOrClientID);
+
+typedef void __stdcall FunctionLeave3(
+ FunctionIDOrClientID functionIDOrClientID);
+
+typedef void __stdcall FunctionTailcall3(
+ FunctionIDOrClientID functionIDOrClientID);
+
+/*
+ * When you are interested in inspecting arguments and return values, then
+ * use these to be notified as functions are called and return. Use
+ * SetEnterLeaveFunctionHooks3WithInfo to register your implementations of these
+ * functions.
+ *
+ * functionIDOrClientID: if the profiler returned a remapped value from
+ * FunctionIDMapper[2], then this is that remapped value; else it is the
+ * true FunctionID of the function.
+ *
+ * eltInfo is an opaque handle that represents information about a given stack frame.
+ * It is only valid during the callback to which it is passed.
+ */
+
+typedef void __stdcall FunctionEnter3WithInfo(
+ FunctionIDOrClientID functionIDOrClientID,
+ COR_PRF_ELT_INFO eltInfo);
+
+typedef void __stdcall FunctionLeave3WithInfo(
+ FunctionIDOrClientID functionIDOrClientID,
+ COR_PRF_ELT_INFO eltInfo);
+
+typedef void __stdcall FunctionTailcall3WithInfo(
+ FunctionIDOrClientID functionIDOrClientID,
+ COR_PRF_ELT_INFO eltInfo);
+
+/*
+ * Stack snapshot callback definition.
+ *
+ * This callback is called once per managed frame or run of unmanaged frames.
+ *
+ * funcID is the FunctionID of the managed function. If funcID == 0, the callback is
+ * for a run of unmanaged frames. The profiler may either ignore the frame, or use
+ * the register context to perform its own unmanaged stackwalk.
+ *
+ * ip is the native IP in the frame
+ *
+ * frameInfo is the COR_PRF_FRAME_INFO for this frame. It is only valid for
+ * use during this callback.
+ *
+ * context is a Win32 CONTEXT struct for the current platform (size given in
+ * contextSize). It will only be valid if the COR_PRF_SNAPSHOT_CONTEXT flag
+ * was passed to DoStackSnapshot.
+ *
+ * clientData is a void* passed straight through from DoStackSnapshot
+ *
+ * NOTE: One must limit the complexity of work done in StackSnapshotCallback.
+ * For example, particularly when using DoStackSnapshot in an asynchronous manner,
+ * the target thread may be holding locks. Executing code within StackSnapshotCallback
+ * that requires the same locks could lead to deadlock.
+ */
+typedef HRESULT __stdcall StackSnapshotCallback(
+ FunctionID funcId,
+ UINT_PTR ip,
+ COR_PRF_FRAME_INFO frameInfo,
+ ULONG32 contextSize,
+ BYTE context[],
+ void *clientData);
+
+typedef enum
+{
+ // These flags represent classes of callback events
+ COR_PRF_MONITOR_NONE = 0x00000000,
+
+ // MONITOR_FUNCTION_UNLOADS controls the
+ // FunctionUnloadStarted callback.
+ COR_PRF_MONITOR_FUNCTION_UNLOADS = 0x00000001,
+
+ // MONITOR_CLASS_LOADS controls the ClassLoad*
+ // and ClassUnload* callbacks.
+ // See the comments on those callbacks for important
+ // behavior changes in V2.
+ COR_PRF_MONITOR_CLASS_LOADS = 0x00000002,
+
+ // MONITOR_MODULE_LOADS controls the
+ // ModuleLoad*, ModuleUnload*, and ModuleAttachedToAssembly
+ // callbacks.
+ COR_PRF_MONITOR_MODULE_LOADS = 0x00000004,
+
+ // MONITOR_ASSEMBLY_LOADS controls the
+ // AssemblyLoad* and AssemblyUnload* callbacks
+ COR_PRF_MONITOR_ASSEMBLY_LOADS = 0x00000008,
+
+ // MONITOR_APPDOMAIN_LOADS controls the
+ // AppDomainCreation* and AppDomainShutdown* callbacks
+ COR_PRF_MONITOR_APPDOMAIN_LOADS = 0x00000010,
+
+ // MONITOR_JIT_COMPILATION controls the
+ // JITCompilation*, JITFunctionPitched, and JITInlining
+ // callbacks.
+ COR_PRF_MONITOR_JIT_COMPILATION = 0x00000020,
+
+
+ // MONITOR_EXCEPTIONS controls the ExceptionThrown,
+ // ExceptionSearch*, ExceptionOSHandler*, ExceptionUnwind*,
+ // and ExceptionCatcher* callbacks.
+ COR_PRF_MONITOR_EXCEPTIONS = 0x00000040,
+
+ // MONITOR_GC controls the GarbageCollectionStarted/Finished,
+ // MovedReferences, SurvivingReferences,
+ // ObjectReferences, ObjectsAllocatedByClass,
+ // RootReferences*, HandleCreated/Destroyed, and FinalizeableObjectQueued
+ // callbacks.
+ COR_PRF_MONITOR_GC = 0x00000080,
+
+ // MONITOR_OBJECT_ALLOCATED controls the
+ // ObjectAllocated callback.
+ COR_PRF_MONITOR_OBJECT_ALLOCATED = 0x00000100,
+
+ // MONITOR_THREADS controls the ThreadCreated,
+ // ThreadDestroyed, ThreadAssignedToOSThread,
+ // and ThreadNameChanged callbacks.
+ COR_PRF_MONITOR_THREADS = 0x00000200,
+
+ // MONITOR_REMOTING controls the Remoting*
+ // callbacks.
+ COR_PRF_MONITOR_REMOTING = 0x00000400,
+
+ // MONITOR_CODE_TRANSITIONS controls the
+ // UnmanagedToManagedTransition and
+ // ManagedToUnmanagedTransition callbacks.
+ COR_PRF_MONITOR_CODE_TRANSITIONS = 0x00000800,
+
+ // MONITOR_ENTERLEAVE controls the
+ // FunctionEnter*/Leave*/Tailcall* callbacks
+ COR_PRF_MONITOR_ENTERLEAVE = 0x00001000,
+
+ // MONITOR_CCW controls the COMClassicVTable*
+ // callbacks.
+ COR_PRF_MONITOR_CCW = 0x00002000,
+
+ // MONITOR_REMOTING_COOKIE controls whether
+ // a cookie will be passed to the Remoting* callbacks
+ COR_PRF_MONITOR_REMOTING_COOKIE = 0x00004000 | COR_PRF_MONITOR_REMOTING,
+
+ // MONITOR_REMOTING_ASYNC controls whether
+ // the Remoting* callbacks will monitor async events
+ COR_PRF_MONITOR_REMOTING_ASYNC = 0x00008000 | COR_PRF_MONITOR_REMOTING,
+
+ // MONITOR_SUSPENDS controls the RuntimeSuspend*,
+ // RuntimeResume*, RuntimeThreadSuspended, and
+ // RuntimeThreadResumed callbacks.
+ COR_PRF_MONITOR_SUSPENDS = 0x00010000,
+
+ // MONITOR_CACHE_SEARCHES controls the
+ // JITCachedFunctionSearch* callbacks.
+ // See the comments on those callbacks for important
+ // behavior changes in V2.
+ COR_PRF_MONITOR_CACHE_SEARCHES = 0x00020000,
+
+ // NOTE: ReJIT is now supported again. The profiler must set this flag on
+ // startup in order to use RequestReJIT or RequestRevert. If the profiler specifies
+ // this flag, then the profiler must also specify COR_PRF_DISABLE_ALL_NGEN_IMAGES
+ COR_PRF_ENABLE_REJIT = 0x00040000,
+
+ // V2 MIGRATION WARNING: DEPRECATED
+ // Inproc debugging is no longer supported. ENABLE_INPROC_DEBUGGING
+ // has no effect.
+ COR_PRF_ENABLE_INPROC_DEBUGGING = 0x00080000,
+
+ // V2 MIGRATION NOTE: DEPRECATED
+ // The runtime now always tracks IL-native maps; this flag is thus always
+ // considered to be set.
+ COR_PRF_ENABLE_JIT_MAPS = 0x00100000,
+
+ // DISABLE_INLINING tells the runtime to disable all inlining
+ COR_PRF_DISABLE_INLINING = 0x00200000,
+
+ // DISABLE_OPTIMIZATIONS tells the runtime to disable all code optimizations
+ COR_PRF_DISABLE_OPTIMIZATIONS = 0x00400000,
+
+ // ENABLE_OBJECT_ALLOCATED tells the runtime that the profiler may want
+ // object allocation notifications. This must be set during initialization if the profiler
+ // ever wants object notifications (using COR_PRF_MONITOR_OBJECT_ALLOCATED)
+ COR_PRF_ENABLE_OBJECT_ALLOCATED = 0x00800000,
+
+ // MONITOR_CLR_EXCEPTIONS controls the ExceptionCLRCatcher*
+ // callbacks.
+ COR_PRF_MONITOR_CLR_EXCEPTIONS = 0x01000000,
+
+ // All callback events are enabled with this flag
+ COR_PRF_MONITOR_ALL = 0x0107FFFF,
+
+ // ENABLE_FUNCTION_ARGS enables argument tracing through FunctionEnter2.
+ COR_PRF_ENABLE_FUNCTION_ARGS = 0X02000000,
+
+ // ENABLE_FUNCTION_RETVAL enables retval tracing through FunctionLeave2.
+ COR_PRF_ENABLE_FUNCTION_RETVAL = 0X04000000,
+
+ // ENABLE_FRAME_INFO enables retrieval of exact ClassIDs for generic functions using
+ // GetFunctionInfo2 with a COR_PRF_FRAME_INFO obtained from FunctionEnter2.
+ COR_PRF_ENABLE_FRAME_INFO = 0X08000000,
+
+ // ENABLE_STACK_SNAPSHOT enables the used of DoStackSnapshot calls.
+ COR_PRF_ENABLE_STACK_SNAPSHOT = 0X10000000,
+
+ // USE_PROFILE_IMAGES causes the native image search to look for profiler-enhanced
+ // images. If no profiler-enhanced image is found for a given assembly the
+ // runtime will fallback to JIT for that assembly.
+ COR_PRF_USE_PROFILE_IMAGES = 0x20000000,
+
+ // COR_PRF_DISABLE_TRANSPARENCY_CHECKS_UNDER_FULL_TRUST will disable security
+ // transparency checks normally done during JIT compilation and class loading for
+ // full trust assemblies. This can make some instrumentation easier to perform.
+ COR_PRF_DISABLE_TRANSPARENCY_CHECKS_UNDER_FULL_TRUST
+ = 0x40000000,
+
+ // Prevents all NGEN images (including profiler-enhanced images) from loading. If
+ // this and COR_PRF_USE_PROFILE_IMAGES are both specified,
+ // COR_PRF_DISABLE_ALL_NGEN_IMAGES wins.
+ COR_PRF_DISABLE_ALL_NGEN_IMAGES = 0x80000000,
+
+ // The mask for valid mask bits
+ COR_PRF_ALL = 0x8FFFFFFF,
+
+ // COR_PRF_REQUIRE_PROFILE_IMAGE represents all flags that require profiler-enhanced
+ // images.
+ COR_PRF_REQUIRE_PROFILE_IMAGE = COR_PRF_USE_PROFILE_IMAGES |
+ COR_PRF_MONITOR_CODE_TRANSITIONS |
+ COR_PRF_MONITOR_ENTERLEAVE,
+
+ COR_PRF_ALLOWABLE_AFTER_ATTACH = COR_PRF_MONITOR_THREADS |
+ COR_PRF_MONITOR_MODULE_LOADS |
+ COR_PRF_MONITOR_ASSEMBLY_LOADS |
+ COR_PRF_MONITOR_APPDOMAIN_LOADS |
+ COR_PRF_ENABLE_STACK_SNAPSHOT |
+ COR_PRF_MONITOR_GC |
+ COR_PRF_MONITOR_SUSPENDS |
+ COR_PRF_MONITOR_CLASS_LOADS |
+ COR_PRF_MONITOR_EXCEPTIONS |
+ COR_PRF_MONITOR_JIT_COMPILATION,
+
+ // MONITOR_IMMUTABLE represents all flags that may only be set during initialization.
+ // Trying to change any of these flags elsewhere will result in a
+ // failed HRESULT.
+ COR_PRF_MONITOR_IMMUTABLE = COR_PRF_MONITOR_CODE_TRANSITIONS |
+ COR_PRF_MONITOR_REMOTING |
+ COR_PRF_MONITOR_REMOTING_COOKIE |
+ COR_PRF_MONITOR_REMOTING_ASYNC |
+ COR_PRF_ENABLE_REJIT |
+ COR_PRF_ENABLE_INPROC_DEBUGGING |
+ COR_PRF_ENABLE_JIT_MAPS |
+ COR_PRF_DISABLE_OPTIMIZATIONS |
+ COR_PRF_DISABLE_INLINING |
+ COR_PRF_ENABLE_OBJECT_ALLOCATED |
+ COR_PRF_ENABLE_FUNCTION_ARGS |
+ COR_PRF_ENABLE_FUNCTION_RETVAL |
+ COR_PRF_ENABLE_FRAME_INFO |
+ COR_PRF_USE_PROFILE_IMAGES |
+ COR_PRF_DISABLE_TRANSPARENCY_CHECKS_UNDER_FULL_TRUST |
+ COR_PRF_DISABLE_ALL_NGEN_IMAGES
+} COR_PRF_MONITOR;
+
+/*
+ * Additional flags the profiler can specify via SetEventMask2 when loading
+ */
+typedef enum
+{
+ COR_PRF_HIGH_MONITOR_NONE = 0x00000000,
+
+ COR_PRF_HIGH_ADD_ASSEMBLY_REFERENCES = 0x00000001,
+
+ COR_PRF_HIGH_IN_MEMORY_SYMBOLS_UPDATED = 0x00000002,
+
+ COR_PRF_HIGH_REQUIRE_PROFILE_IMAGE = 0,
+
+ COR_PRF_HIGH_ALLOWABLE_AFTER_ATTACH = COR_PRF_HIGH_IN_MEMORY_SYMBOLS_UPDATED,
+
+ // MONITOR_IMMUTABLE represents all flags that may only be set during initialization.
+ // Trying to change any of these flags elsewhere will result in a
+ // failed HRESULT.
+ COR_PRF_HIGH_MONITOR_IMMUTABLE = 0,
+
+} COR_PRF_HIGH_MONITOR;
+
+/*
+ * COR_PRF_MISC contains miscellaneous constant ID's used for special
+ * purposes.
+ */
+typedef enum
+{
+ // PROFILER_PARENT_UNKNOWN is the AssemblyID used by GetModuleInfo
+ // when a module has not yet been attached to an assembly.
+ PROFILER_PARENT_UNKNOWN = 0xFFFFFFFD,
+
+ // PROFILER_GLOBAL_CLASS is a ClassID used for globals that belong to no class
+ PROFILER_GLOBAL_CLASS = 0xFFFFFFFE,
+
+ // PROFILER_GLOBAL_MODULE is a ModuleID used for globals that belong
+ // to no module in particular
+ PROFILER_GLOBAL_MODULE = 0xFFFFFFFF
+} COR_PRF_MISC;
+
+/*
+ * COR_PRF_JIT_CACHE contains values used to express the result of a
+ * cached function search. Note that FOUND is 0, and thus this is not truly
+ * a boolean.
+ */
+typedef enum
+{
+ COR_PRF_CACHED_FUNCTION_FOUND,
+ COR_PRF_CACHED_FUNCTION_NOT_FOUND
+} COR_PRF_JIT_CACHE;
+
+/*
+ * COR_PRF_TRANSITION_REASON contains values used to describe
+ * the reason for a ManagedToUnmanaged or UnmanagedToManagedTransition
+ * callback.
+ */
+typedef enum
+{
+ COR_PRF_TRANSITION_CALL,
+ COR_PRF_TRANSITION_RETURN
+} COR_PRF_TRANSITION_REASON;
+
+/*
+ * COR_PRF_SUSPEND_REASON contains values used to describe the
+ * reason for suspending the runtime. See the RuntimeSuspension*
+ * callbacks for detailed descriptions of each.
+ */
+typedef enum
+{
+ COR_PRF_SUSPEND_OTHER = 0,
+ COR_PRF_SUSPEND_FOR_GC = 1,
+ COR_PRF_SUSPEND_FOR_APPDOMAIN_SHUTDOWN = 2,
+ COR_PRF_SUSPEND_FOR_CODE_PITCHING = 3,
+ COR_PRF_SUSPEND_FOR_SHUTDOWN = 4,
+ COR_PRF_SUSPEND_FOR_INPROC_DEBUGGER = 6,
+ COR_PRF_SUSPEND_FOR_GC_PREP = 7,
+ COR_PRF_SUSPEND_FOR_REJIT = 8,
+} COR_PRF_SUSPEND_REASON;
+
+/*
+ * COR_PRF_RUNTIME_TYPE contains values used to indicate the
+ * type of runtime.
+ */
+typedef enum
+{
+ COR_PRF_DESKTOP_CLR = 0x1,
+ COR_PRF_CORE_CLR = 0x2,
+} COR_PRF_RUNTIME_TYPE;
+
+
+/* -------------------------------------------------------------------------- *
+ * Forward declarations
+ * -------------------------------------------------------------------------- */
+
+interface ICorProfilerCallback;
+interface ICorProfilerCallback2;
+interface ICorProfilerCallback3;
+interface ICorProfilerCallback4;
+interface ICorProfilerInfo;
+interface ICorProfilerInfo2;
+interface ICorProfilerInfo3;
+interface ICorProfilerInfo4;
+interface ICorProfilerObjectEnum;
+interface ICorProfilerFunctionEnum;
+interface ICorProfilerModuleEnum;
+interface ICorProfilerThreadEnum;
+interface ICorProfilerMethodEnum;
+interface IMethodMalloc;
+interface ICorProfilerFunctionControl;
+interface ICorProfilerAssemblyReferenceProvider;
+/* -------------------------------------------------------------------------- *
+ * User Callback interface
+ * -------------------------------------------------------------------------- */
+
+/*
+ * The ICorProfilerCallback interface is used by the CLR to notify a
+ * code profiler when events have occurred that the code profiler has registered
+ * an in interest in receiving. This is the primary callback interface through
+ * which the CLR communicates with the code profiler. A code profiler
+ * must register this callback interface in the Win32 registry. This object has
+ * several methods that receive notification from the runtime when an event is
+ * about to occur in an executing runtime process.
+ *
+ * The methods implemented on this interface return S_OK on success, or E_FAIL
+ * on failure.
+ */
+
+[
+ object,
+ uuid(176FBED1-A55C-4796-98CA-A9DA0EF883E7),
+ pointer_default(unique),
+ local
+]
+interface ICorProfilerCallback : IUnknown
+{
+
+ /*
+ *
+ * STARTUP/SHUTDOWN EVENTS
+ *
+ */
+
+ /*
+ * The CLR calls Initialize to setup the code profiler
+ * whenever a new CLR application is started. The call provides
+ * an IUnknown interface pointer that should be QI'd for an ICorProfilerInfo
+ * interface pointer.
+ *
+ * NOTE: this is the only opportunity to enable callbacks that are a part
+ * of COR_PRF_MONITOR_IMMUTABLE, since they can no longer be changed after
+ * returning from this function. This is done through SetEventMask on the
+ * ICorProfilerInfo object.
+ */
+ HRESULT Initialize(
+ [in] IUnknown *pICorProfilerInfoUnk);
+
+ /*
+ * The CLR calls Shutdown to notify the code profiler that
+ * the application is exiting. This is the profiler's last opportunity to
+ * safely call functions on the ICorProfilerInfo interface. After returning
+ * from this function the runtime will proceed to unravel its internal data
+ * structures and any calls to ICorProfilerInfo are undefined in their
+ * behaviour.
+ *
+ * NOTE: Certain IMMUTABLE events may still occur after Shutdown.
+ *
+ * NOTE: Shutdown will only fire where the managed application that is being
+ * profiled was started running managed code (i.e., the initial frame on the
+ * process' stack is managed). If the application being profiled started
+ * life as unmanaged code, which later 'jumped into' managed code (thereby
+ * creating an instance of the CLR), then Shutdown will not fire. In these
+ * cases, the profiler should include a DllMain routine in their library that
+ * uses Win32's DLL_PROCESS_DETACH call to free any resources and perform tidy-up
+ * processing of its data (flush traces to disk, etc)
+ *
+ * NOTE: The profiler must in general cope with unexpected shutdowns, such as
+ * when the process is "killed" by Win32's TerminateProcess.
+ *
+ * NOTE: Sometimes the CLR will violently kill certain managed threads
+ * (background threads) without delivering orderly destruction messages for them.
+ */
+ HRESULT Shutdown();
+
+
+ /*
+ *
+ * APPLICATION DOMAIN EVENTS
+ *
+ */
+
+ /*
+ * Called when an application domain creation has begun and ended.
+ * The ID is not valid for any information request until the Finished
+ * event is called.
+ *
+ * Some parts of app domain loading may take place lazily at some time
+ * after the Finished callback. Therefore, while a failure HRESULT in
+ * hrStatus definitely indicates a failure, a success HRESULT only indicates
+ * that the first part of app domain creation succeeded.
+ */
+ HRESULT AppDomainCreationStarted(
+ [in] AppDomainID appDomainId);
+
+ HRESULT AppDomainCreationFinished(
+ [in] AppDomainID appDomainId,
+ [in] HRESULT hrStatus);
+
+ /*
+ * Called before and after an app domain is unloaded from a process.
+ * The ID is no longer valid after the Started event returns.
+ *
+ * Some parts of app domain unloading may take place lazily at some time
+ * after the Finished callback. Therefore, while a failure HRESULT in
+ * hrStatus definitely indicates a failure, a success HRESULT only indicates
+ * that the first part of app domain unloading succeeded.
+ */
+ HRESULT AppDomainShutdownStarted(
+ [in] AppDomainID appDomainId);
+
+ HRESULT AppDomainShutdownFinished(
+ [in] AppDomainID appDomainId,
+ [in] HRESULT hrStatus);
+
+ /*
+ *
+ * ASSEMBLY EVENTS
+ *
+ */
+
+ /*
+ * Called when an Assembly load has begun and ended. The ID is not valid
+ * for any information request until the Finished event is called.
+ *
+ * Some parts of assembly loading may take place lazily at some time
+ * after the Finished callback. Therefore, while a failure HRESULT in
+ * hrStatus definitely indicates a failure, a success HRESULT only indicates
+ * that the first part of assembly loading succeeded.
+ */
+ HRESULT AssemblyLoadStarted(
+ [in] AssemblyID assemblyId);
+
+ HRESULT AssemblyLoadFinished(
+ [in] AssemblyID assemblyId,
+ [in] HRESULT hrStatus);
+
+ /*
+ * Called before and after an assembly is unloaded.
+ * The ID is no longer valid after the Started event returns.
+ *
+ * Some parts of assembly unloading may take place lazily at some time
+ * after the Finished callback. Therefore, while a failure HRESULT in
+ * hrStatus definitely indicates a failure, a success HRESULT only indicates
+ * that the first part of assembly unloading succeeded.
+ */
+ HRESULT AssemblyUnloadStarted(
+ [in] AssemblyID assemblyId);
+
+ HRESULT AssemblyUnloadFinished(
+ [in] AssemblyID assemblyId,
+ [in] HRESULT hrStatus);
+
+
+ /*
+ *
+ * MODULE EVENTS
+ *
+ */
+
+ /*
+ * Called when a module load has begun and ended. The ID is not valid
+ * for any information request until the Finished event is called.
+ *
+ * Some parts of module loading may take place lazily at some time
+ * after the Finished callback. Therefore, while a failure HRESULT in
+ * hrStatus definitely indicates a failure, a success HRESULT only indicates
+ * that the first part of module loading succeeded.
+ *
+ * Note that when a module load is reported as finished this indicates
+ * that the load has completed but it has not yet returned to the caller.
+ * This is the opportunity for the profiler to note that other notifications regarding
+ * this module may start coming afterwards however internal safeguards
+ * protecting the runtime from recursive loading are still present and so it is
+ * a bad time to begin inquiries on this module. The notification is informational
+ * only.
+ *
+ * Note: ModuleLoadFinished is a reasonable time to interrogate MetaData via API's
+ * like GetModuleMetadata, however APIs that create (e.g. ClassID's and FunctionID's)
+ * are not safe to use here. Profiler writers are advised to stay in the universe of
+ * tokens.
+ *
+ */
+ HRESULT ModuleLoadStarted(
+ [in] ModuleID moduleId);
+
+ HRESULT ModuleLoadFinished(
+ [in] ModuleID moduleId,
+ [in] HRESULT hrStatus);
+
+ /*
+ * Called before and after a module is unloaded.
+ * The ID is no longer valid after the Started event returns.
+ *
+ * Some parts of module unloading may take place lazily at some time
+ * after the Finished callback. Therefore, while a failure HRESULT in
+ * hrStatus definitely indicates a failure, a success HRESULT only indicates
+ * that the first part of module unloading succeeded.
+ */
+ HRESULT ModuleUnloadStarted(
+ [in] ModuleID moduleId);
+
+ HRESULT ModuleUnloadFinished(
+ [in] ModuleID moduleId,
+ [in] HRESULT hrStatus);
+
+ /*
+ * A module can get loaded through legacy means (ie: IAT or LoadLibrary) or
+ * through a metadata reference. The CLR loader therefore has many code
+ * paths for determining what assembly a module lives in. It is therefore
+ * possible that after a ModuleLoadFinished event, the module does not
+ * know what assembly it is in and getting the parent AssemblyID is not possible.
+ * This event is fired when the module is officially attached to its parent
+ * assembly. Calling GetModuleInfo after this function is called will return the
+ * proper parent assembly.
+ */
+ HRESULT ModuleAttachedToAssembly(
+ [in] ModuleID moduleId,
+ [in] AssemblyID AssemblyId);
+
+
+ /*
+ *
+ * CLASS EVENTS
+ *
+ */
+
+ /*
+ * Called when a class load has begun and ended. The ID is not valid
+ * for any information request until the Finished event is called.
+ *
+ * Some parts of class loading may take place lazily at some time
+ * after the Finished callback. Therefore, while a failure HRESULT in
+ * hrStatus definitely indicates a failure, a success HRESULT only indicates
+ * that the first part of class loading succeeded.
+ *
+ * Note that when a class load is reported as finished this indicates
+ * that the load has completed but it has not yet returned to the caller.
+ * This is the opportunity for the profiler to note that other notifications regarding
+ * this class may start coming afterwards however internal safeguards
+ * protecting the runtime from recursive loading are still present and so it is
+ * a bad time to begin inquiries on this class. The notification is informational
+ * only.
+ *
+ */
+ HRESULT ClassLoadStarted(
+ [in] ClassID classId);
+
+ HRESULT ClassLoadFinished(
+ [in] ClassID classId,
+ [in] HRESULT hrStatus);
+
+ /*
+ * Called before and after a class is unloaded.
+ * The ID is no longer valid after the Started event returns.
+ *
+ * Some parts of class unloading may take place lazily at some time
+ * after the Finished callback. Therefore, while a failure HRESULT in
+ * hrStatus definitely indicates a failure, a success HRESULT only indicates
+ * that the first part of class unloading succeeded.
+ */
+ HRESULT ClassUnloadStarted(
+ [in] ClassID classId);
+
+ HRESULT ClassUnloadFinished(
+ [in] ClassID classId,
+ [in] HRESULT hrStatus);
+
+ /*
+ *
+ * JIT EVENTS
+ *
+ */
+
+ /*
+ * The CLR calls FunctionUnloadStarted to notify the code
+ * profiler that a function is being unloaded. After returning from this
+ * call, the FunctionID is no longer valid.
+ */
+ HRESULT FunctionUnloadStarted(
+ [in] FunctionID functionId);
+
+
+ /*
+ * The CLR calls JITCompilationStarted to notify the code
+ * profiler that the JIT compiler is starting to compile a function.
+ *
+ * The fIsSafeToBlock argument tells the profiler whether or not blocking
+ * will affect the operation of the runtime. If true, blocking may cause
+ * the runtime to wait for the calling thread to return from this callback.
+ * Although this will not harm the runtime, it will skew the profiling
+ * results.
+ *
+ * NOTE: It is possible to receive more than one JITCompilationStarted/
+ * JITCompilationFinished pair for each method. This is because of how
+ * the runtime handles class constructors: method A starts to be JIT'd,
+ * then realizes that the class ctor for class B needs to be run, so
+ * JIT's it and runs it, and while it's running makes a call to original
+ * method A, which causes it to be JIT'd again, and causes the original
+ * (incomplete) JIT'ing of A to be aborted. However, both attempts to
+ * JIT A are reported with JIT compilation events. If the profiler is
+ * going to replace IL code for this method with SetILFunctionBody, then
+ * it must do so for both JITCompilationStarted events, but may use the
+ * same IL block for both.
+ *
+ * NOTE: A profiler should be tolerant of the sequence of JIT callbacks
+ * received in cases where two threads are simultaneously calling a
+ * method. For example, thread A receives JITCompilationStarted.
+ * But before thread A receives JITCompilationFinished, thread B
+ * receives FunctionEnter with the functionId from thread A's
+ * JITCompilationStarted callback. It may appear that functionId should
+ * not yet be valid because JITCompilationFinished had not yet been
+ * received. But it is indeed valid in such a case.
+ */
+ HRESULT JITCompilationStarted(
+ [in] FunctionID functionId,
+ [in] BOOL fIsSafeToBlock);
+
+ /*
+ * The CLR calls JITCompilationFinished to notify the code
+ * profiler that the JIT compiler has finished compiling a function.
+ *
+ * The fIsSafeToBlock argument tells the profiler whether or not blocking
+ * will affect the operation of the runtime. If true, blocking may cause
+ * the runtime to wait for the calling thread to return from this callback.
+ * Although this will not harm the runtime, it will skew the profiling
+ * results.
+ *
+ * The FunctionID is now valid in ICorProfilerInfo APIs.
+ *
+ * The hrStatus provides the success or failure of the operation
+ */
+ HRESULT JITCompilationFinished(
+ [in] FunctionID functionId,
+ [in] HRESULT hrStatus,
+ [in] BOOL fIsSafeToBlock);
+
+ /*
+ * V2 MIGRATION WARNING: DOES NOT ALWAYS OCCUR
+ * The JITCachedFunctionSearchStarted/Finished callbacks
+ * will now occur only for some functions in regular NGEN images;
+ * only profiler-optimized NGEN images will generate callbacks for
+ * all functions in the image. Profilers which do not use these callbacks
+ * to force a function to be JIT-compiled should move to using a lazy
+ * strategy for gathering function information.
+ *
+ * This notifies the profiler when a search for a prejitted function is
+ * starting.
+ *
+ * functionId: the function for which the search is being performed.
+ * bUseCachedFunction: if true, the EE uses the cached function (if applicable)
+ * if false, the EE jits the function instead of
+ * using a pre-jitted version.
+ *
+ * NOTE: Profilers should be tolerant of cases where multiple threads of
+ * a profiled app are calling the same method simultaneously. For example,
+ * thread A may receive JITCachedFunctionSearchStarted (and the
+ * profiler sets *pbUseCachedFunction=FALSE to force a JIT), thread A
+ * then receives JITCompilationStarted/JITCompilationFinished, then
+ * thread B receives another JITCachedFunctionSearchStarted for the same
+ * method. It might appear odd to receive this final callback, since the
+ * profiler already stated its intention to JIT the method. But this is
+ * occurring because the CLR in thread B decided to send this callback
+ * before thread A responded to JITCachedFunctionSearchStarted
+ * with *pbUseCachedFunction=FALSE, and the thread B callback
+ * hadn't actually been sent until now due how the threads
+ * happened to be scheduled. In such cases where the profiler
+ * receives duplicate JITCachedFunctionSearchStarted callbacks for
+ * the same functionId, the profiler should be certain to set
+ * *pbUseCachedFunction to the same value from this callback
+ * when it is called multiple times with the same functionId.
+ */
+ HRESULT JITCachedFunctionSearchStarted(
+ [in] FunctionID functionId,
+ [out] BOOL *pbUseCachedFunction);
+
+ /*
+ * V2 MIGRATION WARNING: DOES NOT ALWAYS OCCUR
+ * The JITCachedFunctionSearchStarted/Finished callbacks
+ * will now occur only for some functions in regular NGEN images;
+ * only profiler-optimized NGEN images will generate callbacks for
+ * all functions in the image. Profilers which do not use these callbacks
+ * to force a function to be JIT-compiled should move to using a lazy
+ * strategy for gathering function information.
+ *
+ * This notifies the profiler when a search for a cached function has been
+ * performed.
+ *
+ * functionId: the function for which the search has been performed.
+ * result: the result of the search. There are two possible results:
+ * COR_PRF_CACHED_FUNCTION_FOUND
+ * COR_PRF_CACHED_FUNCTION_NOT_FOUND
+ *
+ */
+ HRESULT JITCachedFunctionSearchFinished(
+ [in] FunctionID functionId,
+ [in] COR_PRF_JIT_CACHE result);
+
+ /*
+ * The CLR calls JITFunctionPitched to notify the profiler
+ * that a jitted function was removed from memory. If the pitched
+ * function is called in the future, the profiler will receive new
+ * JIT compilation events as it is re-jitted.
+ *
+ * Currently the CLR JIT does not pitch functions, so this callback
+ * will not be received.
+ *
+ * NOTE: the FunctionID is not valid until it is re-jitted. When it is
+ * re-jitted, it will use the same FunctionID value.
+ */
+ HRESULT JITFunctionPitched(
+ [in] FunctionID functionId);
+
+ /*
+ * The CLR calls JITInlining to notify the profiler that the jitter
+ * is about to inline calleeId into callerId. Set pfShouldInline to FALSE
+ * to prevent the callee from being inlined into the caller, and set to
+ * TRUE to allow the inline to occur.
+ *
+ * NOTE: Inlined functions do not provide Enter/Leave events, so if you desire
+ * an accurate callgraph, you should set FALSE. Be aware that
+ * setting FALSE will affect performance, since inlining typically
+ * increases speed and reduces separate jitting events for the inlined
+ * method.
+ *
+ * NOTE: It is also possible to globally disable inlining by setting the
+ * COR_PRF_DISABLE_INLINING flag.
+ */
+ HRESULT JITInlining(
+ [in] FunctionID callerId,
+ [in] FunctionID calleeId,
+ [out] BOOL *pfShouldInline);
+
+ /*
+ *
+ * THREAD EVENTS
+ *
+ */
+
+ /*
+ * The CLR calls ThreadCreated to notify the code profiler
+ * that a thread has been created. The ThreadID is valid immediately.
+ */
+ HRESULT ThreadCreated(
+ [in] ThreadID threadId);
+
+ /*
+ * The CLR calls ThreadDestroyed to notify the code profiler
+ * that a thread has been destroyed. The ThreadID is no longer valid
+ * at the time of this call.
+ */
+ HRESULT ThreadDestroyed(
+ [in] ThreadID threadId);
+
+ /*
+ * The CLR calls ThreadAssignedToOSThread to tell the profiler
+ * that a managed thread is being implemented via a particualr OS thread.
+ * This callback exists so that the profiler can maintain an accurate
+ * OS to Managed thread mapping across fibres.
+ */
+ HRESULT ThreadAssignedToOSThread(
+ [in] ThreadID managedThreadId,
+ [in] DWORD osThreadId);
+
+ /*
+ *
+ * REMOTING EVENTS
+ *
+ */
+
+ //
+ // Client-side events
+ //
+
+ /*
+ * NOTE: each of the following pairs of callbacks will occur on the same
+ * thread
+ * RemotingClientInvocationStarted & RemotingClientSendingMessage
+ * RemotingClientReceivingReply & RemotingClientInvocationFinished
+ * RemotingServerInvocationReturned & RemotingServerSendingReply
+ *
+ * There are a few issues with the remoting callbacks that should be outlined.
+ * First, remoting function execution is not reflected by the profiler API, so
+ * the notifications for functions that are called from the client and executed
+ * to the server are not properly received. The actual invocation happens via a
+ * proxy object. That creates the illusion to the profiler that certain
+ * functions get jit-compiled but they never get used. Second, the profiler does
+ * not receive accurate notifications for asynchronous remoting events.
+ */
+
+ /*
+ * The CLR calls RemotingClientInvocationStarted to notify the profiler that
+ * a remoting call has begun. This event is the same for synchronous and
+ * asynchronous calls.
+ */
+ HRESULT RemotingClientInvocationStarted();
+
+ /*
+ * The CLR calls RemotingClientSendingMessage to notify the profiler that
+ * a remoting call is requiring the the caller to send an invocation request through
+ * a remoting channel.
+ *
+ * pCookie - if remoting GUID cookies are active, this value will correspond with the
+ * the value provided in RemotingServerReceivingMessage, if the channel
+ * succeeds in transmitting the message, and if GUID cookies are active on
+ * the server-side process. This allows easy pairing of remoting calls,
+ * and the creation of a logical call stack.
+ * fIsAsync - is true if the call is asynchronous.
+ */
+ HRESULT RemotingClientSendingMessage(
+ [in] GUID *pCookie,
+ [in] BOOL fIsAsync);
+
+ /*
+ * The CLR calls RemotingClientReceivingReply to notify the profiler that
+ * the server-side portion of a remoting call has completed and that the client is
+ * now receiving and about to process the reply.
+ *
+ * pCookie - if remoting GUID cookies are active, this value will correspond with the
+ * the value provided in RemotingServerSendingReply, if the channel
+ * succeeds in transmitting the message, and if GUID cookies are active on
+ * the server-side process. This allows easy pairing of remoting calls.
+ * fIsAsync - is true if the call is asynchronous.
+ */
+ HRESULT RemotingClientReceivingReply(
+ [in] GUID *pCookie,
+ [in] BOOL fIsAsync);
+
+ /*
+ * The CLR calls RemotingClientInvocationFinished to notify the profiler that
+ * a remoting invocation has run to completion on the client side. If the call was
+ * synchronous, this means that it has also run to completion on the server side. If
+ * the call was asynchronous, a reply may still be expected when the call is handled.
+ * If the call is asynchronous, and a reply is expected, then the reply will occur in
+ * the form of a call to RemotingClientReceivingReply and an additional call to
+ * RemotingClientInvocationFinished to indicate the required secondary processing of
+ * an asynchronous call.
+ */
+ HRESULT RemotingClientInvocationFinished();
+
+ //
+ // Server-side events
+ //
+
+ /*
+ * The CLR calls RemotingServerReceivingMessage to notify the profiler that
+ * the process has received a remote method invocation (or activation) request. If
+ * the message request is asynchronous, then the request may be serviced by any
+ * arbitrary thread.
+ *
+ * pCookie - if remoting GUID cookies are active, this value will correspond with the
+ * the value provided in RemotingClientSendingMessage, if the channel
+ * succeeds in transmitting the message, and if GUID cookies are active on
+ * the client-side process. This allows easy pairing of remoting calls.
+ * fIsAsync - is true if the call is asynchronous.
+ */
+ HRESULT RemotingServerReceivingMessage(
+ [in] GUID *pCookie,
+ [in] BOOL fIsAsync);
+
+ /*
+ * The CLR calls RemotingServerInvocationStarted to notify the profiler that
+ * the process is invoking a method due to a remote method invocation request.
+ */
+ HRESULT RemotingServerInvocationStarted();
+
+ /*
+ * The CLR calls RemotingServerInvocationReturned to notify the profiler that
+ * the process has finished invoking a method due to a remote method invocation request.
+ */
+ HRESULT RemotingServerInvocationReturned();
+
+ /*
+ * The CLR calls RemotingServerSendingReply to notify the profiler that
+ * the process has finished processing a remote method invocation request and is
+ * about to transmit the reply through a channel.
+ *
+ * pCookie - if remoting GUID cookies are active, this value will correspond with the
+ * the value provided in RemotingClientReceivingReply, if the channel
+ * succeeds in transmitting the message, and if GUID cookies are active on
+ * the client-side process. This allows easy pairing of remoting calls.
+ * fIsAsync - is true if the call is asynchronous.
+ */
+ HRESULT RemotingServerSendingReply(
+ [in] GUID *pCookie,
+ [in] BOOL fIsAsync);
+
+ /*
+ *
+ * TRANSITION EVENTS
+ *
+ */
+
+ /*
+ * The CLR calls UnmanagedToManagedTransition to notify the
+ * code profiler that a transition from unmanaged code to managed code has
+ * occurred. functionId is always the ID of the callee, and reason
+ * indicates whether the transition was due to a call into managed code from
+ * unmanaged, or a return from an unmanaged function called by a managed one.
+ *
+ * Note that if the reason is COR_PRF_TRANSITION_RETURN and the functionId is
+ * non-NULL, then the functionId is that of the unmanaged function, and will
+ * never have been jitted. Unmanaged functions still have some basic
+ * information associated with them, such as a name, and some metadata.
+ *
+ * Note that if the reason is COR_PRF_TRANSITION_RETURN and the callee was
+ * a PInvoke call indirect, then the runtime does not know the destination
+ * of the call and functionId will be NULL.
+ *
+ * Note that if the reason is COR_PRF_TRANSITION_CALL then it may be possible
+ * that the callee has not yet been JIT-compiled.
+ */
+ HRESULT UnmanagedToManagedTransition(
+ [in] FunctionID functionId,
+ [in] COR_PRF_TRANSITION_REASON reason);
+
+
+ /*
+ * The CLR calls ManagedToUnmanagedTransition to notify the
+ * code profiler that a transition from managed code to unmanaged code has
+ * occurred. functionId is always the ID of the callee, and reason
+ * indicates whether the transition was due to a call into unmanaged code from
+ * managed, or a return from an managed function called by an unmanaged one.
+ *
+ * Note that if the reason is COR_PRF_TRANSITION_CALL, then the functionId
+ * is that of the unmanaged function, and will never have been jitted.
+ * Unmanaged functions still have some basic information associated with
+ * them, such as a name, and some metadata.
+ *
+ * Note that if the reason is COR_PRF_TRANSITION_CALL and the callee is
+ * a PInvoke call indirect, then the runtime does not know the destination
+ * of the call and functionId will be NULL.
+ */
+ HRESULT ManagedToUnmanagedTransition(
+ [in] FunctionID functionId,
+ [in] COR_PRF_TRANSITION_REASON reason);
+
+
+ /*
+ *
+ * RUNTIME SUSPENSION EVENTS
+ *
+ */
+
+ /*
+ * The CLR calls RuntimeSuspendStarted to notify the code profiler
+ * that the runtime is about to suspend all of the runtime threads.
+ * All runtime threads that are in unmanaged code are permitted to continue
+ * running until they try to re-enter the runtime, at which point they will
+ * also suspend until the runtime resumes. This also applies to new threads
+ * that enter the runtime. All threads within the runtime are either
+ * suspended immediately if they are in interruptible code, or asked to
+ * suspend when they do reach interruptible code.
+ *
+ * suspendReason make be any of the following values:
+ * COR_PRF_SUSPEND_FOR_GC
+ * the runtime is suspending to service a GC request. The GC-related
+ * callbacks will occur between the RuntimeSuspendFinished and
+ * RuntimeResumeStarted events.
+ * COR_PRF_SUSPEND_FOR_CODE_PITCHING
+ * the runtime is suspending so that code pitching may occur. This
+ * only occurs when the EJit is active with code pitching enabled.
+ * Code pitching callbacks will occur between the
+ * RuntimeSuspendFinished and RuntimeResumeStarted events.
+ * COR_PRF_SUSPEND_FOR_APPDOMAIN_SHUTDOWN
+ * the runtime is suspending so that an AppDomain can be shut down.
+ * While the runtime is suspended, the runtime will determine which
+ * threads are in the AppDomain that is being shut down, set them to
+ * abort when they resume, and then resumes the runtime. There are
+ * no AppDomain-specific callbacks during this suspension.
+ * COR_PRF_SUSPEND_FOR_SHUTDOWN
+ * the runtime is shutting down, and it must suspend all threads to
+ * complete the operation.
+ * COR_PRF_SUSPEND_FOR_GC_PREP
+ * the runtime is preparing for a GC.
+ * COR_PRF_SUSPEND_FOR_INPROC_DEBUGGER
+ * the runtime is suspending for in-process debugging.
+ * COR_PRF_SUSPEND_OTHER
+ * the runtime is suspending for a reason other than those above.
+ */
+ HRESULT RuntimeSuspendStarted(
+ [in] COR_PRF_SUSPEND_REASON suspendReason);
+
+ /*
+ * The CLR calls RuntimeSuspendFinished to notify the code profiler
+ * that the runtime has suspended all threads needed for a runtime
+ * suspension. Note that not all runtime threads are required to be
+ * suspended, as described in the comment for RuntimeSuspendStarted.
+ *
+ * NOTE: It is guaranteed that this event will occur on the same ThreadID
+ * as RuntimeSuspendStarted occurred on.
+ */
+ HRESULT RuntimeSuspendFinished();
+
+ /*
+ * The CLR calls RuntimeSuspendAborted to notify the code profiler
+ * that the runtime is aborting the runtime suspension that was occurring.
+ * This may occur if two threads simultaneously attempt to suspend the
+ * runtime.
+ *
+ * NOTE: It is guaranteed that this event will occur on the same ThreadID
+ * as the RuntimeSuspendStarted occurred on, and that only one of
+ * RuntimeSuspendFinished and RuntimeSuspendAborted may occur on a single
+ * thread following a RuntimeSuspendStarted event.
+ */
+ HRESULT RuntimeSuspendAborted();
+
+ /*
+ * The CLR calls RuntimeResumeStarted to notify the code profiler
+ * that the runtime is about to resume all of the runtime threads.
+ */
+ HRESULT RuntimeResumeStarted();
+
+ /*
+ * The CLR calls RuntimeResumeFinished to notify the code profiler
+ * that the runtime has finished resuming all of it's threads and is now
+ * back in normal operation.
+ *
+ * NOTE: It is *NOT* guaranteed that this event will occur on the same
+ * ThreadID as the RuntimeSuspendStarted occurred on, but is guaranteed
+ * to occur on the same ThreadID as the RuntimeResumeStarted occurred on.
+ */
+ HRESULT RuntimeResumeFinished();
+
+ /*
+ * The CLR calls RuntimeThreadSuspended to notify the code profiler
+ * that a particular thread has been suspended.
+ *
+ * This notification may occur any time between the RuntimeSuspendStarted
+ * and the associated RuntimeResumeStarted. Notifications that occur
+ * between RuntimeSuspendFinished and RuntimeResumeStarted are for
+ * threads that had been running in unmanaged code and were suspended
+ * upon entry to the runtime.
+ */
+ HRESULT RuntimeThreadSuspended(
+ [in] ThreadID threadId);
+
+ /*
+ * The CLR calls RuntimeThreadResumed to notify the code profiler
+ * that a particular thread has been resumed after being suspended due to
+ * a runtime suspension.
+ */
+ HRESULT RuntimeThreadResumed(
+ [in] ThreadID threadId);
+
+ /*
+ *
+ * GC EVENTS
+ *
+ * NOTE: All of these callbacks (except ObjectAllocated) are made while the
+ * runtime is suspended, so none of the ObjectID values can change until
+ * the runtime resumes and another GC occurs.
+ *
+ * NOTE: The profiler will receive GC-related events (except ObjectAllocated)
+ * when the profiler has been suspended for COR_PRF_SUSPEND_FOR_GC *except*
+ * for one special case. When the runtime is shutting down, there is a
+ * stage where it is suspended for COR_PRF_SUSPEND_FOR_SHUTDOWN reason and
+ * is never resumed. But after this suspension a garbage collection may
+ * occur without a COR_PRF_SUSPEND_FOR_GC suspension notification, and
+ * the profiler will thus receive GC-related callbacks.
+ *
+ * NOTE: All of these callbacks (except ObjectAllocated) may be called more than
+ * once during the same GC. These calls should be considered multiple parts of
+ * one long report; the profiler should simply aggregate the information provided
+ * in all of them.
+ */
+
+ /*
+ * The CLR calls MovedReferences with information about
+ * object references that moved as a result of garbage collection.
+ *
+ * cMovedObjectIDRanges is a count of the number of ObjectID ranges that
+ * were moved.
+ * oldObjectIDRangeStart is an array of elements, each of which is the start
+ * value of a range of ObjectID values before being moved.
+ * newObjectIDRangeStart is an array of elements, each of which is the start
+ * value of a range of ObjectID values after being moved.
+ * cObjectIDRangeLength is an array of elements, each of which states the
+ * size of the moved ObjectID value range.
+ *
+ * The last three arguments of this function are parallel arrays.
+ *
+ * In other words, if an ObjectID value lies within the range
+ * oldObjectIDRangeStart[i] <= ObjectID < oldObjectIDRangeStart[i] + cObjectIDRangeLength[i]
+ * for 0 <= i < cMovedObjectIDRanges, then the ObjectID value has changed to
+ * ObjectID - oldObjectIDRangeStart[i] + newObjectIDRangeStart[i]
+ *
+ * NOTE: None of the objectIDs returned by MovedReferences are valid during the callback
+ * itself, as the GC may be in the middle of moving objects from old to new. Thus profilers
+ * should not attempt to inspect objects during a MovedReferences call. At
+ * GarbageCollectionFinished, all objects have been moved to their new locations, and
+ * inspection may be done.
+ *
+ * THIS CALLBACK IS OBSOLETE. It reports ranges for objects >4GB as ULONG_MAX
+ * on 64-bit platforms. Use ICorProfilerCallback4::MovedReferences2 instead.
+ */
+ HRESULT MovedReferences(
+ [in] ULONG cMovedObjectIDRanges,
+ [in, size_is(cMovedObjectIDRanges)] ObjectID oldObjectIDRangeStart[] ,
+ [in, size_is(cMovedObjectIDRanges)] ObjectID newObjectIDRangeStart[] ,
+ [in, size_is(cMovedObjectIDRanges)] ULONG cObjectIDRangeLength[] );
+
+ /*
+ * The CLR calls ObjectAllocated to notify the code profiler
+ * an object was allocated on the heap. This notification does not fire
+ * for allocations from the stack, nor from unmanaged memory.
+ *
+ * It is possible to receive a classId that corresponds to a regular class
+ * that has not been loaded yet. The profiler will receive a class load
+ * callback for that class immediately after the object creation callback.
+ */
+ HRESULT ObjectAllocated(
+ [in] ObjectID objectId,
+ [in] ClassID classId);
+
+ /*
+ * The CLR calls ObjectsAllocatedByClass to notify the code
+ * profiler about the number of objects of a particular class that were
+ * allocated since the previous garbage collection. The classes and the
+ * counts are passed in parallel arrays. (Classes for which no instances
+ * have been allocated since the previous GC are omitted entirely.)
+ *
+ * NOTE: This callback will not report objects allocated in the large
+ * object heap.
+ *
+ * NOTE: The numbers here are only estimates. Use ObjectAllocated for
+ * exact counts.
+ */
+ HRESULT ObjectsAllocatedByClass(
+ [in] ULONG cClassCount,
+ [in, size_is(cClassCount)] ClassID classIds[] ,
+ [in, size_is(cClassCount)] ULONG cObjects[] );
+
+ /*
+ * The CLR calls ObjectReferences to provide information
+ * about objects in memory referenced by a given object. This function
+ * is called for each object remaining in the GC heap after a collection
+ * has completed. If the profiler returns an error from this callback,
+ * the profiling services will discontinue invoking this callback until the
+ * next GC. This callback can be used in conjunction with the
+ * RootReferences callback to create a complete object reference graph for
+ * the runtime.
+ *
+ * NOTE: The CLR will ensure that each object reference is reported only
+ * once by this function.
+ *
+ * NOTE: None of the objectIDs returned by ObjectReferences are valid during the callback
+ * itself, as the GC may be in the middle of moving objects from old to new. Thus profilers
+ * should not attempt to inspect objects during an ObjectReferences call. At
+ * GarbageCollectionFinished, all objects have been moved to their new locations, and
+ * inspection may be done.
+ */
+ HRESULT ObjectReferences(
+ [in] ObjectID objectId,
+ [in] ClassID classId,
+ [in] ULONG cObjectRefs,
+ [in, size_is(cObjectRefs)] ObjectID objectRefIds[] );
+
+ /*
+ * The CLR calls RootReferences with information about root
+ * references after a garbage collection has occurred. Static object
+ * references and references to objects on a stack are co-mingled in the
+ * arrays.
+ *
+ * NOTE: It is possible to get NULL ObjectIDs in the RootReferences callback.
+ * For example, all object references declared on the stack are treated as
+ * roots by the GC, and will always be reported.
+ *
+ * NOTE: None of the objectIDs returned by RootReferences are valid during the callback
+ * itself, as the GC may be in the middle of moving objects from old to new. Thus profilers
+ * should not attempt to inspect objects during a RootReferences call. At
+ * GarbageCollectionFinished, all objects have been moved to their new locations, and
+ * inspection may be done.
+ */
+ HRESULT RootReferences(
+ [in] ULONG cRootRefs,
+ [in, size_is(cRootRefs)] ObjectID rootRefIds[] );
+
+
+ /*
+ *
+ * EXCEPTION EVENTS
+ *
+ */
+
+ //
+ // Exception creation
+ //
+
+ /*
+ * The CLR calls ExceptionThrown to notify the code
+ * profiler that an exception has been thrown.
+ *
+ * NOTE: This function is only called if the exception reaches
+ * managed code.
+ *
+ * NOTE: The profiler should not block here, since the stack may not be in a
+ * GC-friendly state and so preemptive GC cannot be enabled. If the
+ * profiler blocks here and a GC is attempted, the runtime will block
+ * until this callback returns. Also, the profiler may NOT call into
+ * managed code or in any way cause a managed memory allocation.
+ */
+ HRESULT ExceptionThrown(
+ [in] ObjectID thrownObjectId);
+
+ //
+ // Search phase
+ //
+
+ /*
+ * The CLR calls ExceptionSearchFunctionEnter to notify the profiler
+ * that the search phase of exception handling has entered a function.
+ */
+ HRESULT ExceptionSearchFunctionEnter(
+ [in] FunctionID functionId);
+
+ /*
+ * The CLR calls ExceptionSearchFunctionLeave to notify the profiler
+ * that the search phase of exception handling has left a function.
+ */
+ HRESULT ExceptionSearchFunctionLeave();
+
+ /*
+ * The CLR will call ExceptionSearchFilterEnter just before excecuting
+ * a user filter. The functionID is that of the function containing the filter.
+ */
+ HRESULT ExceptionSearchFilterEnter(
+ [in] FunctionID functionId);
+
+ /*
+ * The CLR will call ExceptionSearchFilterLeave immediately after
+ * executing a user filter.
+ */
+ HRESULT ExceptionSearchFilterLeave();
+
+ /*
+ * The CLR will call ExceptionSearchCatcherFound when the search
+ * phase of exception handling has located a handler for the exception that
+ * was thrown.
+ */
+ HRESULT ExceptionSearchCatcherFound(
+ [in] FunctionID functionId);
+
+ /*
+ * DEPRECATED. It is the job of the unmanaged profiler to detect OS
+ * handling of exceptions.
+ */
+ HRESULT ExceptionOSHandlerEnter(
+ [in] UINT_PTR __unused);
+
+ /*
+ * DEPRECATED. It is the job of the unmanaged profiler to detect OS
+ * handling of exceptions.
+ */
+ HRESULT ExceptionOSHandlerLeave(
+ [in] UINT_PTR __unused);
+
+ //
+ // Unwind phase
+ //
+
+ /*
+ * The CLR calls ExceptionUnwindFunctionEnter to notify the profiler
+ * that the unwind phase of exception handling has entered a function.
+ *
+ * NOTE: The profiler should not block here, since the stack may not be in a
+ * GC-friendly state and so preemptive GC cannot be enabled. If the
+ * profiler blocks here and a GC is attempted, the runtime will block
+ * until this callback returns. Also, the profiler may NOT call into
+ * managed code or in any way cause a managed memory allocation.
+ */
+ HRESULT ExceptionUnwindFunctionEnter(
+ [in] FunctionID functionId);
+
+ /*
+ * The CLR calls ExceptionUnwindFunctionLeave to notify the profiler
+ * that the unwind phase of exception handling has left a function. The
+ * function instance and it's stack data has now been removed from the stack.
+ *
+ * NOTE: The profiler should not block here, since the stack may not be in a
+ * GC-friendly state and so preemptive GC cannot be enabled. If the
+ * profiler blocks here and a GC is attempted, the runtime will block
+ * until this callback returns. Also, the profiler may NOT call into
+ * managed code or in any way cause a managed memory allocation.
+ */
+ HRESULT ExceptionUnwindFunctionLeave();
+
+ /*
+ * The CLR calls ExceptionUnwindFinallyEnter to notify the profiler
+ * that the unwind phase of exception is entering a finally clause contained
+ * in the specified function.
+ *
+ * NOTE: The profiler should not block here, since the stack may not be in a
+ * GC-friendly state and so preemptive GC cannot be enabled. If the
+ * profiler blocks here and a GC is attempted, the runtime will block
+ * until this callback returns. Also, the profiler may NOT call into
+ * managed code or in any way cause a managed memory allocation.
+ */
+ HRESULT ExceptionUnwindFinallyEnter(
+ [in] FunctionID functionId);
+
+ /*
+ * The CLR calls ExceptionUnwindFinallyLeave to notify the profiler
+ * that the unwind phase of exception is leaving a finally clause.
+ *
+ * NOTE: The profiler should not block here, since the stack may not be in a
+ * GC-friendly state and so preemptive GC cannot be enabled. If the
+ * profiler blocks here and a GC is attempted, the runtime will block
+ * until this callback returns. Also, the profiler may NOT call into
+ * managed code or in any way cause a managed memory allocation.
+ */
+ HRESULT ExceptionUnwindFinallyLeave();
+
+ /*
+ * The CLR calls this function just before passing control to
+ * the appropriate catch block. Note that this is called only if the
+ * catch point is in JIT'ed code. An exception that is caught in
+ * unmanaged code, or in the internal code of the CLR will
+ * not generate this notification. The ObjectID is passed again since
+ * a GC could have moved the object since the ExceptionThrown
+ * notification.
+ *
+ * NOTE: The profiler should not block here, since the stack may not be in a
+ * GC-friendly state and so preemptive GC cannot be enabled. If the
+ * profiler blocks here and a GC is attempted, the runtime will block
+ * until this callback returns. Also, the profiler may NOT call into
+ * managed code or in any way cause a managed memory allocation.
+ */
+ HRESULT ExceptionCatcherEnter(
+ [in] FunctionID functionId,
+ [in] ObjectID objectId);
+
+ /*
+ * The CLR calls ExceptionCatcherLeave when the runtime leaves
+ * the catcher's code.
+ *
+ * NOTE: The profiler should not block here, since the stack may not be in a
+ * GC-friendly state and so preemptive GC cannot be enabled. If the
+ * profiler blocks here and a GC is attempted, the runtime will block
+ * until this callback returns. Also, the profiler may NOT call into
+ * managed code or in any way cause a managed memory allocation.
+ */
+ HRESULT ExceptionCatcherLeave();
+
+ /*
+ * CLR<->COM interop vtable creation/destruction.
+ */
+
+ /*
+ * The CLR calls this function when an CLR<->COM interop vtable
+ * for a particular IID and for a particular class has been created.
+ * This provides the ClassID of the class for which this vtable has been
+ * created, the IID it implements, the start of the vtable and how many
+ * slots are in it.
+ *
+ * NOTE: The profiler should not block here, since the stack may not be in a
+ * GC-friendly state and so preemptive GC cannot be enabled. If the
+ * profiler blocks here and a GC is attempted, the runtime will block
+ * until this callback returns. Also, the profiler may NOT call into
+ * managed code or in any way cause a managed memory allocation.
+ *
+ * NOTE: It is possible to receive a NULL GUID if the interface is
+ * internal only.
+ */
+ HRESULT COMClassicVTableCreated(
+ [in] ClassID wrappedClassId,
+ [in] REFGUID implementedIID,
+ [in] void *pVTable,
+ [in] ULONG cSlots);
+
+ /*
+ * The CLR calls this function when a CLR<->COM interop vtable is
+ * being destroyed. Provided are the ClassID, IID and vtable pointer for
+ * the destroyed vtable.
+ *
+ * NOTE: The profiler should not block here, since the stack may not be in a
+ * GC-friendly state and so preemptive GC cannot be enabled. If the
+ * profiler blocks here and a GC is attempted, the runtime will block
+ * until this callback returns. Also, the profiler may NOT call into
+ * managed code or in any way cause a managed memory allocation.
+ *
+ * NOTE: It is possible to receive a NULL GUID if the interface is
+ * internal only.
+ *
+ * NOTE: This callback is likely never to occur, since the destruction of
+ * vtables occurs very close to Shutdown.
+ */
+ HRESULT COMClassicVTableDestroyed(
+ [in] ClassID wrappedClassId,
+ [in] REFGUID implementedIID,
+ [in] void *pVTable);
+
+ /*
+ * DEPRECATED. These callbacks are no longer delivered.
+ */
+ HRESULT ExceptionCLRCatcherFound();
+
+ HRESULT ExceptionCLRCatcherExecute();
+}
+
+/*
+ * COR_PRF_GC_ROOT_KIND describes the kind of GC root exposed by
+ * the RootReferences2 callback.
+ */
+
+typedef enum
+{
+ COR_PRF_GC_ROOT_STACK = 1, // Variables on the stack
+ COR_PRF_GC_ROOT_FINALIZER = 2, // Entry in the finalizer queue
+ COR_PRF_GC_ROOT_HANDLE = 3, // GC Handle
+ COR_PRF_GC_ROOT_OTHER = 0 //Misc. roots
+} COR_PRF_GC_ROOT_KIND;
+
+
+/*
+ * COR_PRF_GC_ROOT_FLAGS describes properties of a GC root
+ * exposed by the RootReferences callback.
+ */
+
+typedef enum
+{
+ COR_PRF_GC_ROOT_PINNING = 0x1, // Prevents GC from moving the object
+ COR_PRF_GC_ROOT_WEAKREF = 0x2, // Does not prevent collection
+ COR_PRF_GC_ROOT_INTERIOR = 0x4, // Refers to a field of the object rather than the object itself
+ COR_PRF_GC_ROOT_REFCOUNTED = 0x8, // Whether it prevents collection depends on a refcount - if not,
+ // COR_PRF_GC_ROOT_WEAKREF will be set also
+} COR_PRF_GC_ROOT_FLAGS;
+
+
+/*
+ * COR_PRF_FINALIZER_FLAGS is used by FinalizableObjectQueued to describe
+ * the finalizer for the object.
+ */
+
+typedef enum
+{
+ COR_PRF_FINALIZER_CRITICAL = 0x1 // Critical finalizer
+} COR_PRF_FINALIZER_FLAGS;
+
+
+/*
+ * COR_PRF_GC_GENERATION contains the numbers used to represent each GC generation
+ * in the GetGenerationBounds and GetObjectGeneration functions.
+ */
+
+typedef enum
+{
+ COR_PRF_GC_GEN_0 = 0,
+ COR_PRF_GC_GEN_1 = 1,
+ COR_PRF_GC_GEN_2 = 2,
+ COR_PRF_GC_LARGE_OBJECT_HEAP = 3
+} COR_PRF_GC_GENERATION;
+
+
+/*
+ * COR_PRF_GC_GENERATION_RANGE describes a range of memory in the GetGenerationBounds and GetObjectGeneration functions.
+ * Note that the rangeLength member is only guaranteed to be accurate if GetGenerationBounds or GetObjectGeneration are
+ * called from a GarbageCollectionStarted or GarbageCollectionFinished notification
+ */
+typedef struct COR_PRF_GC_GENERATION_RANGE
+{
+ COR_PRF_GC_GENERATION generation; // what generation the range of memory belongs to
+ ObjectID rangeStart; // the start of the range
+ UINT_PTR rangeLength; // the used length of the range
+ UINT_PTR rangeLengthReserved; // the amount of memory reserved for the range (including rangeLength)
+
+} COR_PRF_GC_GENERATION_RANGE;
+
+
+
+/*
+ * COR_PRF_CLAUSE_TYPE defines the various clause codes for the EX clauses
+ */
+typedef enum
+{
+ COR_PRF_CLAUSE_NONE = 0, // not a real clause (only used in error cases)
+ COR_PRF_CLAUSE_FILTER = 1,
+ COR_PRF_CLAUSE_CATCH = 2,
+ COR_PRF_CLAUSE_FINALLY = 3,
+} COR_PRF_CLAUSE_TYPE;
+
+/*
+ * COR_PRF_EX_CLAUSE_INFO identifies a specific exception clause instance and its associated frame.
+ * When an exception notification is received, GetNotifiedExceptionClauseInfo() may be used to get the
+ * native address and frame information for the exception clause (catch/finally/filter) that is
+ * about to be run (ExceptionCatchEnter, ExceptionUnwindFinallyEnter, ExceptionFilterEnter) or has just
+ * been run (ExceptionCatchLeave, ExceptionUnwindFinallyLeave, ExceptionFilterLeave).
+ */
+typedef struct COR_PRF_EX_CLAUSE_INFO
+{
+ COR_PRF_CLAUSE_TYPE clauseType; // the type of clause we just entered or left
+ UINT_PTR programCounter; // the native entry point of the clause handler (e.g. EIP)
+ UINT_PTR framePointer; // the logical frame pointer (e.g. EBP) for that clause handler
+ UINT_PTR shadowStackPointer; // the shadow stack pointer (IA64 only, BSP)
+} COR_PRF_EX_CLAUSE_INFO;
+
+/*
+ * COR_PRF_GC_REASON describes the reason for a given GC.
+ */
+typedef enum
+{
+ COR_PRF_GC_INDUCED = 1, // Induced by GC.Collect
+ COR_PRF_GC_OTHER = 0 // Anything else
+} COR_PRF_GC_REASON;
+
+/*
+ * Bits from COR_PRF_MODULE_FLAGS are returned to the profiler in GetModuleInfo2's
+ * pdwModuleFlags output parameter. Some combinations of 2 or more flags are possible,
+ * though not all combinations are possible.
+ */
+typedef enum
+{
+ // The module was loaded from disk
+ COR_PRF_MODULE_DISK = 0x00000001,
+
+ // The module had been generated via NGEN
+ COR_PRF_MODULE_NGEN = 0x00000002,
+
+ // The module was created via methods in the Reflection.Emit namespace
+ COR_PRF_MODULE_DYNAMIC = 0x00000004,
+
+ // The module's lifetime is managed by the garbage collector.
+ COR_PRF_MODULE_COLLECTIBLE = 0x00000008,
+
+ // The module contains no metadata and is used strictly as a resource. The managed
+ // equivalent of this bit is the System.Reflection.Module.IsResource() method.
+ COR_PRF_MODULE_RESOURCE = 0x00000010,
+
+ // The module's layout in memory is flat, as opposed to mapped. For modules that have
+ // this bit set, profilers that directly read information out of the PE header will
+ // need to be careful when interpreting RVAs present in the PE header.
+ COR_PRF_MODULE_FLAT_LAYOUT = 0x00000020,
+
+ // The Windows Runtime content type flag is set in the metadata for this module's
+ // assembly
+ COR_PRF_MODULE_WINDOWS_RUNTIME = 0x00000040,
+} COR_PRF_MODULE_FLAGS;
+/*
+ * The ICorProfilerCallback2 interface is used by the CLR to notify a
+ * code profiler when events have occurred that the code profiler has registered
+ * an in interest in receiving. These are new callbacks implemented in V2.0
+ * of the runtime.
+ *
+ * The methods implemented on this interface return S_OK on success, or E_FAIL
+ * on failure.
+ */
+
+[
+ object,
+ uuid(8A8CC829-CCF2-49fe-BBAE-0F022228071A),
+ pointer_default(unique),
+ local
+]
+interface ICorProfilerCallback2 : ICorProfilerCallback
+{
+
+ /*
+ *
+ * THREAD EVENTS
+ *
+ */
+
+ /*
+ * The CLR calls ThreadNameChanged to notify the code profiler
+ * that a thread's name has changed.
+ *
+ * name is not NULL terminated.
+ *
+ */
+ HRESULT ThreadNameChanged(
+ [in] ThreadID threadId,
+ [in] ULONG cchName,
+ [in, annotation("_In_reads_opt_(cchName)")] WCHAR name[]);
+
+ /*
+ *
+ * GARBAGE COLLECTION EVENTS
+ *
+ */
+
+ /*
+ * The CLR calls GarbageCollectionStarted before beginning a
+ * garbage collection. All GC callbacks pertaining to this
+ * collection will occur between the GarbageCollectionStarted
+ * callback and the corresponding GarbageCollectionFinished
+ * callback. Corresponding GarbageCollectionStarted and
+ * GarbageCollectionFinished callbacks need not occur on the same thread.
+ *
+ * cGenerations indicates the total number of entries in
+ * the generationCollected array
+ * generationCollected is an array of booleans, indexed
+ * by COR_PRF_GC_GENERATIONS, indicating which
+ * generations are being collected in this collection
+ * reason indicates whether this GC was induced
+ * by the application calling GC.Collect().
+ *
+ * NOTE: It is safe to inspect objects in their original locations
+ * during this callback. The GC will begin moving objects after
+ * the profiler returns from this callback. Therefore, after
+ * returning, the profiler should consider all ObjectIDs to be invalid
+ * until it receives a GarbageCollectionFinished callback.
+ */
+ HRESULT GarbageCollectionStarted(
+ [in] int cGenerations,
+ [in, size_is(cGenerations)] BOOL generationCollected[],
+ [in] COR_PRF_GC_REASON reason);
+
+ /*
+ * The CLR calls SurvivingReferences with information about
+ * object references that survived a garbage collection.
+ *
+ * Generally, the CLR calls SurvivingReferences for non-compacting garbage collections.
+ * For compacting garbage collections, MovedReferences is called instead.
+ *
+ * The exception to this rule is that the CLR always calls SurvivingReferences for objects
+ * in the large object heap, which is not compacted.
+ *
+ * Multiple calls to SurvivingReferences may be received during a particular
+ * garbage collection, due to limited internal buffering, multiple threads reporting
+ * in the case of server gc, and other reasons.
+ * In the case of multiple calls, the information is cumulative - all of the references
+ * reported in any SurvivingReferences call survive this collection.
+ *
+ * cSurvivingObjectIDRanges is a count of the number of ObjectID ranges that
+ * survived.
+ * objectIDRangeStart is an array of elements, each of which is the start
+ * value of a range of ObjectID values that survived the collection.
+ * cObjectIDRangeLength is an array of elements, each of which states the
+ * size of the surviving ObjectID value range.
+ *
+ * The last two arguments of this function are parallel arrays.
+ *
+ * In other words, if an ObjectID value lies within the range
+ * objectIDRangeStart[i] <= ObjectID < objectIDRangeStart[i] + cObjectIDRangeLength[i]
+ * for 0 <= i < cMovedObjectIDRanges, then the ObjectID has survived the collection
+ *
+ * THIS CALLBACK IS OBSOLETE. It reports ranges for objects >4GB as ULONG_MAX
+ * on 64-bit platforms. Use ICorProfilerCallback4::SurvivingReferences2 instead.
+ */
+ HRESULT SurvivingReferences(
+ [in] ULONG cSurvivingObjectIDRanges,
+ [in, size_is(cSurvivingObjectIDRanges)] ObjectID objectIDRangeStart[] ,
+ [in, size_is(cSurvivingObjectIDRanges)] ULONG cObjectIDRangeLength[] );
+ /*
+ * The CLR calls GarbageCollectionFinished after a garbage
+ * collection has completed and all GC callbacks have been
+ * issued for it.
+ *
+ * NOTE: It is now safe to inspect objects in their
+ * final locations.
+ */
+ HRESULT GarbageCollectionFinished();
+
+ /*
+ * The CLR calls FinalizeableObjectQueued to notify the code profiler
+ * that an object with a finalizer (destructor in C# parlance) has
+ * just been queued to the finalizer thread for execution of its
+ * Finalize method.
+ *
+ * finalizerFlags describes aspects of the finalizer, and takes its
+ * value from COR_PRF_FINALIZER_FLAGS.
+ *
+ */
+
+ HRESULT FinalizeableObjectQueued(
+ [in] DWORD finalizerFlags,
+ [in] ObjectID objectID);
+
+ /*
+ * The CLR calls RootReferences2 with information about root
+ * references after a garbage collection has occurred.
+ * For each root reference in rootRefIds, there is information in
+ * rootClassifications to classify it. Depending on the classification,
+ * rootsIds may contain additional information. The information in
+ * rootKinds and rootFlags contains information about the location and
+ * properties of the reference.
+ *
+ * If the profiler implements ICorProfilerCallback2, both
+ * ICorProfilerCallback::RootReferences and ICorProfilerCallback2::RootReferences2
+ * are called. As the information passed to RootReferences2 is a superset
+ * of the one passed to RootReferences, profilers will normally implement
+ * one or the other, but not both.
+ *
+ * If the root kind is STACK, the ID is the FunctionID of the
+ * function containing the variable. If the FunctionID is 0, the function
+ * is an unnamed function internal to the CLR.
+ *
+ * If the root kind is HANDLE, the ID is the GCHandleID.
+ *
+ * For the other root kinds, the ID is an opaque value and should
+ * be ignored.
+ *
+ * It's possible for entries in rootRefIds to be 0 - this just
+ * implies the corresponding root reference was null and thus did not
+ * refer to an object on the managed heap.
+ *
+ * NOTE: None of the objectIDs returned by RootReferences2 are valid during the callback
+ * itself, as the GC may be in the middle of moving objects from old to new. Thus profilers
+ * should not attempt to inspect objects during a RootReferences2 call. At
+ * GarbageCollectionFinished, all objects have been moved to their new locations, and
+ * inspection may be done.
+ */
+
+ HRESULT RootReferences2(
+ [in] ULONG cRootRefs,
+ [in, size_is(cRootRefs)] ObjectID rootRefIds[],
+ [in, size_is(cRootRefs)] COR_PRF_GC_ROOT_KIND rootKinds[],
+ [in, size_is(cRootRefs)] COR_PRF_GC_ROOT_FLAGS rootFlags[],
+ [in, size_is(cRootRefs)] UINT_PTR rootIds[]);
+
+ /*
+ * The CLR calls HandleCreated when a gc handle has been created.
+ *
+ */
+
+ HRESULT HandleCreated(
+ [in] GCHandleID handleId,
+ [in] ObjectID initialObjectId);
+
+ /*
+ * The CLR calls HandleDestroyed when a gc handle has been destroyed.
+ *
+ */
+
+ HRESULT HandleDestroyed(
+ [in] GCHandleID handleId);
+}
+
+[
+ object,
+ uuid(4FD2ED52-7731-4b8d-9469-03D2CC3086C5),
+ pointer_default(unique),
+ local
+]
+interface ICorProfilerCallback3 : ICorProfilerCallback2
+{
+ HRESULT InitializeForAttach(
+ [in] IUnknown * pCorProfilerInfoUnk,
+ [in] void * pvClientData,
+ [in] UINT cbClientData);
+
+ HRESULT ProfilerAttachComplete();
+
+ HRESULT ProfilerDetachSucceeded();
+};
+
+[
+ object,
+ uuid(7B63B2E3-107D-4d48-B2F6-F61E229470D2),
+ pointer_default(unique),
+ local
+]
+interface ICorProfilerCallback4 : ICorProfilerCallback3
+{
+ /*
+ * Similar to JITCompilationStarted, except called when rejitting a method
+ */
+ HRESULT ReJITCompilationStarted(
+ [in] FunctionID functionId,
+ [in] ReJITID rejitId,
+ [in] BOOL fIsSafeToBlock);
+
+ /*
+ * This is called exactly once per method (which may represent more than
+ * one function id), to allow the code profiler to set alternate code
+ * generation flags or a new method body.
+ */
+ HRESULT GetReJITParameters(
+ [in] ModuleID moduleId,
+ [in] mdMethodDef methodId,
+ [in] ICorProfilerFunctionControl *pFunctionControl);
+
+ /*
+ * Similar to JITCompilationFinished, except called when rejitting a method
+ */
+ HRESULT ReJITCompilationFinished(
+ [in] FunctionID functionId,
+ [in] ReJITID rejitId,
+ [in] HRESULT hrStatus,
+ [in] BOOL fIsSafeToBlock);
+
+ /*
+ * This is called to report an error encountered while processing a ReJIT request.
+ * This may either be called from within the RequestReJIT call itself, or called after
+ * RequestReJIT returns, if the error was encountered later on.
+ */
+ HRESULT ReJITError(
+ [in] ModuleID moduleId,
+ [in] mdMethodDef methodId,
+ [in] FunctionID functionId,
+ [in] HRESULT hrStatus);
+
+ /*
+ * The CLR calls MovedReferences with information about
+ * object references that moved as a result of garbage collection.
+ *
+ * cMovedObjectIDRanges is a count of the number of ObjectID ranges that
+ * were moved.
+ * oldObjectIDRangeStart is an array of elements, each of which is the start
+ * value of a range of ObjectID values before being moved.
+ * newObjectIDRangeStart is an array of elements, each of which is the start
+ * value of a range of ObjectID values after being moved.
+ * cObjectIDRangeLength is an array of elements, each of which states the
+ * size of the moved ObjectID value range.
+ *
+ * The last three arguments of this function are parallel arrays.
+ *
+ * In other words, if an ObjectID value lies within the range
+ * oldObjectIDRangeStart[i] <= ObjectID < oldObjectIDRangeStart[i] + cObjectIDRangeLength[i]
+ * for 0 <= i < cMovedObjectIDRanges, then the ObjectID value has changed to
+ * ObjectID - oldObjectIDRangeStart[i] + newObjectIDRangeStart[i]
+ *
+ * NOTE: None of the objectIDs returned by MovedReferences are valid during the callback
+ * itself, as the GC may be in the middle of moving objects from old to new. Thus profilers
+ * should not attempt to inspect objects during a MovedReferences call. At
+ * GarbageCollectionFinished, all objects have been moved to their new locations, and
+ * inspection may be done.
+ *
+ * If the profiler implements ICorProfilerCallback4, ICorProfilerCallback4::MovedReferences2
+ * is called first and ICorProfilerCallback::MovedReferences is called second but only if
+ * ICorProfilerCallback4::MovedReferences2 returned success. Profilers can return failure
+ * from ICorProfilerCallback4::MovedReferences2 to save some chattiness.
+ */
+ HRESULT MovedReferences2(
+ [in] ULONG cMovedObjectIDRanges,
+ [in, size_is(cMovedObjectIDRanges)] ObjectID oldObjectIDRangeStart[] ,
+ [in, size_is(cMovedObjectIDRanges)] ObjectID newObjectIDRangeStart[] ,
+ [in, size_is(cMovedObjectIDRanges)] SIZE_T cObjectIDRangeLength[] );
+
+ /*
+ * The CLR calls SurvivingReferences with information about
+ * object references that survived a garbage collection.
+ *
+ * Generally, the CLR calls SurvivingReferences for non-compacting garbage collections.
+ * For compacting garbage collections, MovedReferences is called instead.
+ *
+ * The exception to this rule is that the CLR always calls SurvivingReferences for objects
+ * in the large object heap, which is not compacted.
+ *
+ * Multiple calls to SurvivingReferences may be received during a particular
+ * garbage collection, due to limited internal buffering, multiple threads reporting
+ * in the case of server gc, and other reasons.
+ * In the case of multiple calls, the information is cumulative - all of the references
+ * reported in any SurvivingReferences call survive this collection.
+ *
+ * cSurvivingObjectIDRanges is a count of the number of ObjectID ranges that
+ * survived.
+ * objectIDRangeStart is an array of elements, each of which is the start
+ * value of a range of ObjectID values that survived the collection.
+ * cObjectIDRangeLength is an array of elements, each of which states the
+ * size of the surviving ObjectID value range.
+ *
+ * The last two arguments of this function are parallel arrays.
+ *
+ * In other words, if an ObjectID value lies within the range
+ * objectIDRangeStart[i] <= ObjectID < objectIDRangeStart[i] + cObjectIDRangeLength[i]
+ * for 0 <= i < cMovedObjectIDRanges, then the ObjectID has survived the collection
+ *
+ * If the profiler implements ICorProfilerCallback4, ICorProfilerCallback4::SurvivingReferences2
+ * is called first and ICorProfilerCallback2::SurvivingReferences is called second but only if
+ * ICorProfilerCallback4::SurvivingReferences2 returned success. Profilers can return failure
+ * from ICorProfilerCallback4::SurvivingReferences2 to save some chattiness.
+ */
+ HRESULT SurvivingReferences2(
+ [in] ULONG cSurvivingObjectIDRanges,
+ [in, size_is(cSurvivingObjectIDRanges)] ObjectID objectIDRangeStart[] ,
+ [in, size_is(cSurvivingObjectIDRanges)] SIZE_T cObjectIDRangeLength[] );
+
+};
+
+
+[
+ object,
+ uuid(8DFBA405-8C9F-45F8-BFFA-83B14CEF78B5),
+ pointer_default(unique),
+ local
+]
+interface ICorProfilerCallback5 : ICorProfilerCallback4
+{
+ /*
+ * The CLR calls ConditionalWeakTableElementReferences with information
+ * about dependent handles after a garbage collection has occurred.
+ *
+ * For each root ID in rootIds, keyRefIds will contain the ObjectID for
+ * the primary element in the dependent handle pair, and valueRefIds will
+ * contain the ObjectID for the secondary element (keyRefIds[i] keeps
+ * valueRefIds[i] alive).
+ *
+ * NOTE: None of the objectIDs returned by ConditionalWeakTableElementReferences
+ * are valid during the callback itself, as the GC may be in the middle
+ * of moving objects from old to new. Thus profilers should not attempt
+ * to inspect objects during a ConditionalWeakTableElementReferences call.
+ * At GarbageCollectionFinished, all objects have been moved to their new
+ * locations, and inspection may be done.
+ */
+ HRESULT ConditionalWeakTableElementReferences(
+ [in] ULONG cRootRefs,
+ [in, size_is(cRootRefs)] ObjectID keyRefIds[],
+ [in, size_is(cRootRefs)] ObjectID valueRefIds[],
+ [in, size_is(cRootRefs)] GCHandleID rootIds[]);
+};
+
+
+[
+ object,
+ uuid(FC13DF4B-4448-4F4F-950C-BA8D19D00C36),
+ pointer_default(unique),
+ local
+]
+interface ICorProfilerCallback6 : ICorProfilerCallback5
+{
+ // Controlled by the COR_PRF_HIGH_ADD_ASSEMBLY_REFERENCES event mask flag.
+ // Notifies the profiler of a very early stage in the loading of an Assembly, where the CLR
+ // performs an assembly reference closure walk. This is useful ONLY if the profiler will need
+ // to modify the metadata of the Assembly to add AssemblyRefs (later, in ModuleLoadFinished). In
+ // such a case, the profiler should implement this callback as well, to inform the CLR that assembly references
+ // will be added once the module has loaded. This is useful to ensure that assembly sharing decisions
+ // made by the CLR during this early stage remain valid even though the profiler plans to modify the metadata
+ // assembly references later on. This can be used to avoid some instances where profiler metadata
+ // modifications can cause the SECURITY_E_INCOMPATIBLE_SHARE error to be thrown.
+ //
+ // The profiler uses the ICorProfilerAssemblyReferenceProvider provided to add assembly references
+ // to the CLR assembly reference closure walker. The ICorProfilerAssemblyReferenceProvider
+ // should only be used from within this callback. The profiler will still need to explicitly add assembly
+ // references via IMetaDataAssemblyEmit, from within the ModuleLoadFinished callback for the referencing assembly,
+ // even though the profiler implements this GetAssemblyReferences callback. This callback does not result in
+ // modified metadata; only in a modified assembly reference closure walk.
+ //
+ // The profiler should be prepared to receive duplicate calls to this callback for the same assembly,
+ // and should respond identically for each such duplicate call (by making the same set of
+ // ICorProfilerAssemblyReferenceProvider::AddAssemblyReference calls).
+ HRESULT GetAssemblyReferences(
+ [in, string] const WCHAR * wszAssemblyPath,
+ [in] ICorProfilerAssemblyReferenceProvider * pAsmRefProvider);
+};
+
+
+[
+ object,
+ uuid(F76A2DBA-1D52-4539-866C-2AA518F9EFC3),
+ pointer_default(unique),
+ local
+]
+interface ICorProfilerCallback7 : ICorProfilerCallback6
+{
+ // This event is triggered whenever the symbol stream associated with an
+ // in-memory module is updated. Even when symbols are provided up-front in
+ // a call to the managed API Assembly.Load(byte[], byte[], ...) the runtime
+ // may not actually associate the symbolic data with the module until after
+ // the ModuleLoadFinished callback has occured. This event provides a later
+ // opportunity to collect symbols for such modules.
+ //
+ // This event is controlled by the COR_PRF_HIGH_IN_MEMORY_SYMBOLS_UPDATED
+ // event mask flag.
+ //
+ // Note: This event is not currently raised for symbols implicitly created or
+ // modified via Reflection.Emit APIs.
+ HRESULT ModuleInMemorySymbolsUpdated(ModuleID moduleId);
+}
+
+
+/*
+ * COR_PRF_CODEGEN_FLAGS controls various flags and hooks for a specific
+ * method. A combination of COR_PRF_CODEGEN_FLAGS is provided by the
+ * profiler in its call to ICorProfilerFunctionControl::SetCodegenFlags()
+ * when rejitting a method.
+ */
+typedef enum
+{
+ COR_PRF_CODEGEN_DISABLE_INLINING = 0x0001,
+ COR_PRF_CODEGEN_DISABLE_ALL_OPTIMIZATIONS = 0x0002,
+} COR_PRF_CODEGEN_FLAGS;
+
+
+/*
+ * The CLR implements the ICorProfilerInfo interface. This interface is
+ * used by a code profiler to communicate with the CLR to control event
+ * monitoring and request information. The CLR passes an
+ * ICorProfilerInfo interface to each code profiler during initialization.
+ *
+ * A code profiler can call methods on the ICorProfilerInfo interface to get
+ * information about managed code being executed under the control of the CLR
+ *
+ * The ICorProfilerInfo interface implemented by the CLR uses the free
+ * threaded model.
+ *
+ * The methods implemented on this interface return S_OK on success, or E_FAIL
+ * on failure.
+ *
+ */
+
+[
+ object,
+ uuid(28B5557D-3F3F-48b4-90B2-5F9EEA2F6C48),
+ pointer_default(unique),
+ local
+]
+interface ICorProfilerInfo : IUnknown
+{
+ /*
+ * The code profiler calls GetClassFromObject to obtain the ClassID of an
+ * object given its ObjectID.
+ */
+ HRESULT GetClassFromObject(
+ [in] ObjectID objectId,
+ [out] ClassID *pClassId);
+
+ /*
+ * V2 MIGRATION WARNING - DOES NOT WORK FOR GENERIC TYPES
+ *
+ * This function will be removed in a future release, so
+ * use GetClassFromTokenAndTypeArgs for all types.
+ */
+ HRESULT GetClassFromToken(
+ [in] ModuleID moduleId,
+ [in] mdTypeDef typeDef,
+ [out] ClassID *pClassId);
+
+ /*
+ * V2 MIGRATION WARNING - WILL NOT WORK WITH .NET FRAMEWORK
+ * FUNCTIONS
+ *
+ * This function will be removed in a future release; use GetCodeInfo2
+ * in all cases.
+ */
+ HRESULT GetCodeInfo(
+ [in] FunctionID functionId,
+ [out] LPCBYTE *pStart,
+ [out] ULONG *pcSize);
+
+ /*
+ * RECOMMENDATION: USE GetEventMask2 INSTEAD. WHILE THIS METHOD CONTINUES TO
+ * TO WORK, GetEventMask2 PROVIDES MORE FUNCTIONALITY.
+ *
+ * The code profiler calls GetEventMask to obtain the current event
+ * categories for which it is to receive event notifications from the COM+
+ * Runtime.
+ */
+ HRESULT GetEventMask(
+ [out] DWORD *pdwEvents);
+
+ /*
+ * The code profiler calls GetFunctionFromIP to map an instruction pointer
+ * in managed code to a FunctionID.
+ */
+ HRESULT GetFunctionFromIP(
+ [in] LPCBYTE ip,
+ [out] FunctionID *pFunctionId);
+
+ /*
+ * V2 MIGRATION WARNING - WILL NOT WORK FOR GENERIC FUNCTIONS OR
+ * FUNCTIONS ON GENERIC TYPES
+ *
+ * This function will be removed in a future release, so use
+ * GetFunctionFromTokenAndTypeArgs for all functions.
+ */
+ HRESULT GetFunctionFromToken(
+ [in] ModuleID moduleId,
+ [in] mdToken token,
+ [out] FunctionID *pFunctionId);
+
+ /*
+ * The code profiler calls GetHandleFromThread to map a ThreadID to a Win32
+ * thread handle. The profiler must call DuplicateHandle on the handle
+ * before using it.
+ */
+ HRESULT GetHandleFromThread(
+ [in] ThreadID threadId,
+ [out] HANDLE *phThread);
+
+ /*
+ * The code profiler calls GetObjectSize to obtain the size of an object.
+ * Note that types like arrays and strings may have a different size for each object.
+ *
+ * THIS API IS OBSOLETE. It does not work for objects >4GB on 64-bit platforms.
+ * Use ICorProfilerInfo4::GetObjectSize2 instead.
+ */
+ HRESULT GetObjectSize(
+ [in] ObjectID objectId,
+ [out] ULONG *pcSize);
+
+ /*
+ * This will return S_OK if the ClassID provided is an array class, and will
+ * fill out the information for any non-null out params. S_FALSE will be
+ * returned if the ClassID is not an array.
+ *
+ * classId : the ClassID to return information about
+ * pBaseElemType : the array's base element type
+ * pBaseClassId : the base ClassID if the element type == ELEMENT_TYPE_CLASS
+ * pcRank : the number of dimensions of the array
+ */
+ HRESULT IsArrayClass(
+ [in] ClassID classId,
+ [out] CorElementType *pBaseElemType,
+ [out] ClassID *pBaseClassId,
+ [out] ULONG *pcRank);
+
+ /*
+ * The code profiler calls GetThreadInfo to obtain the current Win32 thread ID for
+ * the specified thread.
+ */
+ HRESULT GetThreadInfo(
+ [in] ThreadID threadId,
+ [out] DWORD *pdwWin32ThreadId);
+
+ /*
+ * The code profiler calls GetCurrentThreadID to get the managed thread ID
+ * for the current thread.
+ *
+ * NOTE: GetCurrentThreadID may return CORPROF_E_NOT_MANAGED_THREAD if the
+ * current thread is an internal runtime thread, and the returned value of
+ * pThreadId will be NULL.
+ */
+ HRESULT GetCurrentThreadID(
+ [out] ThreadID *pThreadId);
+
+ /*
+ * V2 MIGRATION NOTE - More information is available for generic types
+ * from GetClassIDInfo2.
+ *
+ * Returns the parent module a class is defined in, along with the
+ * metadata token for the class. One can call GetModuleMetaData
+ * to obtain the metadata interface for a given module. The token
+ * can then be used to access the metadata for this class.
+ */
+ HRESULT GetClassIDInfo(
+ [in] ClassID classId,
+ [out] ModuleID *pModuleId,
+ [out] mdTypeDef *pTypeDefToken);
+
+ /*
+ * Return the parent class for a given function. Also return the metadata
+ * token which can be used to read the metadata.
+ *
+ * V2 MIGRATION WARNING - LESS INFORMATION FOR GENERIC CLASSES
+ * The ClassID of a function on a generic class may not be obtainable without
+ * more context about the use of the function. In this case, *pClassId will be 0;
+ * try using GetFunctionInfo2 with a COR_PRF_FRAME_INFO to give more context.
+ */
+ HRESULT GetFunctionInfo(
+ [in] FunctionID functionId,
+ [out] ClassID *pClassId,
+ [out] ModuleID *pModuleId,
+ [out] mdToken *pToken);
+
+ /*
+ * RECOMMENDATION: USE SetEventMask2 INSTEAD. WHILE THIS METHOD CONTINUES TO
+ * TO WORK, SetEventMask2 PROVIDES MORE FUNCTIONALITY.
+ *
+ * The code profiler calls SetEventMask to set the event categories for
+ * which it is set to receive notification from the CLR.
+ */
+ HRESULT SetEventMask(
+ [in] DWORD dwEvents);
+
+ /*
+ * The code profiler calls SetFunctionHooks to specify handlers
+ * for FunctionEnter, FunctionLeave, and FunctionTailcall.
+ *
+ * Note that only one set of callbacks may be active at a time. Thus,
+ * if a profiler calls SetEnterLeaveFunctionHooks, SetEnterLeaveFunctionHooks2
+ * and SetEnterLeaveFunctionHooks3(WithInfo), then SetEnterLeaveFunctionHooks3(WithInfo)
+ * wins. SetEnterLeaveFunctionHooks2 takes precedence over SetEnterLeaveFunctionHooks
+ * when both are set.
+ *
+ * Each function pointer may be null to disable that callback.
+ *
+ * SetEnterLeaveFunctionHooks may only be called from the
+ * profiler's Initialize() callback.
+ */
+ HRESULT SetEnterLeaveFunctionHooks(
+ [in] FunctionEnter *pFuncEnter,
+ [in] FunctionLeave *pFuncLeave,
+ [in] FunctionTailcall *pFuncTailcall);
+
+ /*
+ * This is used for mapping FunctionIDs to alternative values that will be
+ * passed to the callbacks
+ */
+ HRESULT SetFunctionIDMapper(
+ [in] FunctionIDMapper *pFunc);
+
+ /*
+ * For a given function, retrieve the token value and an instance of the
+ * meta data interface which can be used against this token.
+ */
+ HRESULT GetTokenAndMetaDataFromFunction(
+ [in] FunctionID functionId,
+ [in] REFIID riid,
+ [out] IUnknown **ppImport,
+ [out] mdToken *pToken);
+
+ /*
+ * Retrieve information about a given module.
+ *
+ * When the module is loaded from disk, the name returned will be the filename;
+ * otherwise, the name will be the name from the metadata Module table (i.e.,
+ * the same as the managed System.Reflection.Module.ScopeName).
+ *
+ * NOTE: While this function may be called as soon as the moduleId is alive,
+ * the AssemblyID of the containing assembly will not be available until the
+ * ModuleAttachedToAssembly callback.
+ *
+ * NOTE: More information is available by using ICorProfilerInfo3::GetModuleInfo2 instead.
+ */
+ HRESULT GetModuleInfo(
+ [in] ModuleID moduleId,
+ [out] LPCBYTE *ppBaseLoadAddress,
+ [in] ULONG cchName,
+ [out] ULONG *pcchName,
+ [out, annotation("_Out_writes_to_(cchName, *pcchName)")]
+ WCHAR szName[] ,
+ [out] AssemblyID *pAssemblyId);
+
+ /*
+ * Get a metadata interface instance which maps to the given module.
+ * One may ask for the metadata to be opened in read+write mode, but
+ * this will result in slower metadata execution of the program, because
+ * changes made to the metadata cannot be optimized as they were from
+ * the compiler.
+ *
+ * NOTE: Some modules (such as resource modules) have no metadata. In
+ * those cases, GetModuleMetaData will return S_FALSE, and a NULL
+ * IUnknown.
+ *
+ * NOTE: the only values valid for dwOpenFlags are ofRead and ofWrite.
+ */
+ HRESULT GetModuleMetaData(
+ [in] ModuleID moduleId,
+ [in] DWORD dwOpenFlags,
+ [in] REFIID riid,
+ [out] IUnknown **ppOut);
+
+ /*
+ * Retrieve a pointer to the body of a method starting at it's header.
+ * A method is scoped by the module it lives in. Because this function
+ * is designed to give a tool access to IL before it has been loaded
+ * by the Runtime, it uses the metadata token of the method to find
+ * the instance desired.
+ *
+ * GetILFunctionBody can return CORPROF_E_FUNCTION_NOT_IL if the methodId
+ * points to a method without any IL (such as an abstract method, or a
+ * P/Invoke method).
+ */
+ HRESULT GetILFunctionBody(
+ [in] ModuleID moduleId,
+ [in] mdMethodDef methodId,
+ [out] LPCBYTE *ppMethodHeader,
+ [out] ULONG *pcbMethodSize);
+
+ /*
+ * IL method bodies must be located as RVA's to the loaded module, which
+ * means they come after the module within 4 gb. In order to make it
+ * easier for a tool to swap out the body of a method, this allocator
+ * will ensure memory is allocated within that range.
+ */
+ HRESULT GetILFunctionBodyAllocator(
+ [in] ModuleID moduleId,
+ [out] IMethodMalloc **ppMalloc);
+
+ /*
+ * Replaces the method body for a function in a module. This will replace
+ * the RVA of the method in the metadata to point to this new method body,
+ * and adjust any internal data structures as required. This function can
+ * only be called on those methods which have never been compiled by a JITTER.
+ * Please use the GetILFunctionAllocator to allocate space for the new method to
+ * ensure the buffer is compatible.
+ */
+ HRESULT SetILFunctionBody(
+ [in] ModuleID moduleId,
+ [in] mdMethodDef methodid,
+ [in] LPCBYTE pbNewILMethodHeader);
+
+ /*
+ * Retrieve app domain information given its id.
+ */
+ HRESULT GetAppDomainInfo(
+ [in] AppDomainID appDomainId,
+ [in] ULONG cchName,
+ [out] ULONG *pcchName,
+ [out, annotation("_Out_writes_to_(cchName, *pcchName)")]
+ WCHAR szName[] ,
+ [out] ProcessID *pProcessId);
+
+ /*
+ * Retrieve information about an assembly given its ID.
+ */
+ HRESULT GetAssemblyInfo(
+ [in] AssemblyID assemblyId,
+ [in] ULONG cchName,
+ [out] ULONG *pcchName,
+ [out, annotation("_Out_writes_to_(cchName, *pcchName)")]
+ WCHAR szName[] ,
+ [out] AppDomainID *pAppDomainId,
+ [out] ModuleID *pModuleId);
+
+
+ /*
+ * V2 MIGRATION WARNING: DEPRECATED. Returns E_NOTIMPL always.
+ *
+ * See ICorProfilerInfo4::RequestReJIT instead
+ *
+ */
+ HRESULT SetFunctionReJIT(
+ [in] FunctionID functionId);
+
+ /*
+ * ForceGC forces a GC to occur within the runtime.
+ *
+ * NOTE: This method needs to be called from a thread that does not have any
+ * profiler callbacks on its stack. The most convenient way to implement this is
+ * to create a separate thread within the profiler and have it call ForceGC when
+ * signalled.
+ */
+ HRESULT ForceGC();
+
+ /*
+ *
+ * V2 MIGRATION NOTE - Calling SetILInstrumentedCodeMap on any one
+ * of the multiple FunctionIDs that represent a generic function in a given
+ * AppDomain will affect all instantiations of that function in the AppDomain.
+ *
+ * fStartJit should be set to true the first time this function is called for
+ * a given FunctionID, and false thereafter.
+ *
+ * The format of the map is as follows:
+ * The debugger will assume that each oldOffset refers to an IL offset
+ * within the original, unmodified IL code. newOffset refers to the corresponding
+ * IL offset within the new, instrumented code.
+ *
+ * The map should be sorted in increasing order. For stepping to work properly:
+ * - Instrumented IL should not be reordered (so both old & new are sorted)
+ * - original IL should not be removed
+ * - the map should include entries to map all of the sequence points from the pdb.
+ *
+ * The map does not interpolate missing entries. So given the following map:
+ * (0 old, 0 new)
+ * (5 old, 10 new)
+ * (9 old, 20 new)
+ * - An old offset of 0,1,2,3,4 will be mapped to a new offset of 0
+ * - An old offset of 5,6,7, or 8 will be mapped to new offset 10.
+ * - An old offset of 9 or higher will be mapped to new offset 20.
+ * - A new offset of 0, 1,...8,9 will be mapped to old offset 0
+ * - A new offset of 10,11,...18,19 will be mapped to old offset 5.
+ * - A new offset of 20 or higher will be mapped to old offset 9.
+ *
+ */
+ HRESULT SetILInstrumentedCodeMap(
+ [in] FunctionID functionId,
+ [in] BOOL fStartJit,
+ [in] ULONG cILMapEntries,
+ [in, size_is(cILMapEntries)] COR_IL_MAP rgILMapEntries[] );
+
+ /*
+ * DEPRECATED.
+ */
+ HRESULT GetInprocInspectionInterface(
+ [out] IUnknown **ppicd);
+
+ /*
+ * DEPRECATED.
+ */
+ HRESULT GetInprocInspectionIThisThread(
+ [out] IUnknown **ppicd);
+
+ /*
+ * This will return the ContextID currently associated with the calling
+ * runtime thread. This will set pContextId to NULL if the calling thread
+ * is not a runtime thread.
+ */
+ HRESULT GetThreadContext(
+ [in] ThreadID threadId,
+ [out] ContextID *pContextId);
+
+ /*
+ * DEPRECATED.
+ */
+ HRESULT BeginInprocDebugging(
+ [in] BOOL fThisThreadOnly,
+ [out] DWORD *pdwProfilerContext);
+
+ /*
+ * DEPRECATED.
+ */
+ HRESULT EndInprocDebugging(
+ [in] DWORD dwProfilerContext);
+
+ /*
+ * GetILToNativeMapping returns a map from IL offsets to native
+ * offsets for this code. An array of COR_PROF_IL_TO_NATIVE_MAP
+ * structs will be returned, and some of the ilOffsets in this array
+ * may be the values specified in CorDebugIlToNativeMappingTypes.
+ */
+ HRESULT GetILToNativeMapping(
+ [in] FunctionID functionId,
+ [in] ULONG32 cMap,
+ [out] ULONG32 *pcMap,
+ [out, size_is(cMap), length_is(*pcMap)]
+ COR_DEBUG_IL_TO_NATIVE_MAP map[]);
+}
+
+/*
+ * The CLR implements the ICorProfilerInfo2 interface. This interface is
+ * used by a code profiler to communicate with the CLR to control event
+ * monitoring and request information. The CLR passes an
+ * ICorProfilerInfo2 interface to each code profiler during initialization.
+ *
+ * A code profiler can call methods on the ICorProfilerInfo2 interface to get
+ * information about managed code being executed under the control of the CLR
+ *
+ * The ICorProfilerInfo2 interface implemented by the CLR uses the free
+ * threaded model.
+ *
+ * The methods implemented on this interface return S_OK on success, or E_FAIL
+ * on failure.
+ *
+ */
+
+[
+ object,
+ uuid(CC0935CD-A518-487d-B0BB-A93214E65478),
+ pointer_default(unique),
+ local
+]
+interface ICorProfilerInfo2 : ICorProfilerInfo
+{
+ /*
+ * The code profiler calls DoStackSnapshot to do sparse one-off stack snapshots.
+ *
+ * Passing NULL for thread yields a snapshot of the current thread. If a ThreadID
+ * of a different thread is passed, the runtime will suspend that thread, perform
+ * the snapshot, and resume.
+ *
+ * infoFlags come from the COR_PRF_SNAPSHOT_INFO enum.
+ *
+ * context is a platform-dependent CONTEXT structure, representing the complete
+ * register context that the profiling API will use to seed the stack walk. If this
+ * is non-NULL, it must point to JITd or NGENd code, or else DoStackSnapshot
+ * will return CORPROF_E_STACKSNAPSHOT_UNMANAGED_CTX. Contexts are
+ * only provided by profilers that hijack threads to force them to walk their
+ * own stacks; profilers should not attempt to provide a context when walking
+ * another thread's stack. If context is NULL, the stack walk will begin at the
+ * last available managed frame for the target thread.
+ *
+ * See the definition of StackSnapshotCallback for more information.
+ */
+ HRESULT DoStackSnapshot(
+ [in] ThreadID thread,
+ [in] StackSnapshotCallback *callback,
+ [in] ULONG32 infoFlags,
+ [in] void *clientData,
+ [in, size_is(contextSize)] BYTE context[],
+ [in] ULONG32 contextSize);
+
+ /*
+ * The code profiler calls SetFunctionHooks2 to specify handlers
+ * for FunctionEnter2, FunctionLeave2, and FunctionTailcall2
+ * callbacks.
+ *
+ * Note that only one set of callbacks may be active at a time. Thus,
+ * if a profiler calls SetEnterLeaveFunctionHooks, SetEnterLeaveFunctionHooks2
+ * and SetEnterLeaveFunctionHooks3(WithInfo), then SetEnterLeaveFunctionHooks3(WithInfo)
+ * wins. SetEnterLeaveFunctionHooks2 takes precedence over SetEnterLeaveFunctionHooks
+ * when both are set.
+ *
+ * Each pointer may be null to disable that particular callback.
+ *
+ * SetEnterLeaveFunctionHooks2 may only be called from the
+ * profiler's Initialize() callback.
+ */
+ HRESULT SetEnterLeaveFunctionHooks2(
+ [in] FunctionEnter2 *pFuncEnter,
+ [in] FunctionLeave2 *pFuncLeave,
+ [in] FunctionTailcall2 *pFuncTailcall);
+
+ /*
+ * GetFunctionInfo2 returns the parent class of a function, plus the
+ * function's metadata token and the ClassIDs of its type arguments
+ * (if any).
+ *
+ * When a COR_PRF_FRAME_INFO obtained from a FunctionEnter2
+ * callback is passed, the ClassID and all type arguments will be exact.
+ *
+ * When a COR_PRF_FRAME_INFO from any other source is passed, or
+ * when 0 is passed as the frameInfo argument, exact ClassID and type
+ * arguments cannot always be determined. The value returned in pClassId
+ * may be NULL and some type args will come back as System.Object.
+ *
+ */
+ HRESULT GetFunctionInfo2(
+ [in] FunctionID funcId,
+ [in] COR_PRF_FRAME_INFO frameInfo,
+ [out] ClassID *pClassId,
+ [out] ModuleID *pModuleId,
+ [out] mdToken *pToken,
+ [in] ULONG32 cTypeArgs,
+ [out] ULONG32 *pcTypeArgs,
+ [out] ClassID typeArgs[]);
+
+ /*
+ * GetStringLayout returns detailed information about how string objects are stored.
+ *
+ * *pBufferLengthOffset is the offset (from the ObjectID pointer) to a DWORD that
+ * stores the length of the string's buffer
+ *
+ * *pStringLengthOffset is the offset (from the ObjectID pointer) to a DWORD that
+ * stores the length of the string itself
+ *
+ * *pBufferOffset is the offset (from the ObjectID pointer) to the actual buffer
+ * of wide characters
+ *
+ * Strings may or may not be null-terminated.
+ */
+ HRESULT GetStringLayout(
+ [out] ULONG *pBufferLengthOffset,
+ [out] ULONG *pStringLengthOffset,
+ [out] ULONG *pBufferOffset);
+
+ /*
+ * GetClassLayout returns detailed information how a specific class is stored.
+ * It only returns the fields defined by the class itself; if the parent class
+ * defined fields as well, the profiler must call GetClassLayout on the parent class
+ * to obtain those fields.
+ *
+ * It will fail with E_INVALIDARG for string and array classes.
+ */
+ HRESULT GetClassLayout(
+ [in] ClassID classID,
+ [in, out] COR_FIELD_OFFSET rFieldOffset[],
+ [in] ULONG cFieldOffset,
+ [out] ULONG *pcFieldOffset,
+ [out] ULONG *pulClassSize);
+
+ /*
+ * Returns the parent module a class is defined in, along with the
+ * metadata token for the class, the ClassID of its parent class, and the
+ * ClassIDs of its type arguments (if any).
+ *
+ * One can call GetModuleMetaData to obtain the metadata interface for
+ * a given module. The token can then be used to access the metadata for this
+ * class.
+ */
+ HRESULT GetClassIDInfo2(
+ [in] ClassID classId,
+ [out] ModuleID *pModuleId,
+ [out] mdTypeDef *pTypeDefToken,
+ [out] ClassID *pParentClassId,
+ [in] ULONG32 cNumTypeArgs,
+ [out] ULONG32 *pcNumTypeArgs,
+ [out] ClassID typeArgs[]);
+
+ /*
+ * GetCodeInfo2 returns the extents of native code associated with the
+ * given FunctionID. These extents are returned sorted in order of increasing
+ * IL offset.
+ */
+ HRESULT GetCodeInfo2(
+ [in] FunctionID functionID,
+ [in] ULONG32 cCodeInfos,
+ [out] ULONG32 *pcCodeInfos,
+ [out, size_is(cCodeInfos), length_is(*pcCodeInfos)]
+ COR_PRF_CODE_INFO codeInfos[]);
+
+ /*
+ * GetClassFromTokenAndTypeArgs returns the ClassID of a type given its metadata
+ * token (typedef) and the ClassIDs of its type arguments (if any).
+ *
+ * cTypeArgs must be equal to the number of type parameters for the given type
+ * (0 for non-generic types)
+ * typeArgs may be NULL if cTypeArgs == 0
+ *
+ * Calling this function with a TypeRef token can have unpredictable results; callers
+ * should resolve the TypeRef to a TypeDef and use that.
+ *
+ * If the type is not already loaded, calling this function will cause it to be.
+ * Loading is a dangerous operation in many contexts. For example, calling
+ * this function during loading of modules or other types could lead to an infinite
+ * loop as the runtime attempts to circularly load things.
+ *
+ * In general, use of this function is discouraged. If profilers are interested in
+ * events for a particular type, they should store the ModuleID and TypeDef of that type,
+ * and use GetClassIDInfo2 to check whether a given ClassID is the desired type.
+ */
+ HRESULT GetClassFromTokenAndTypeArgs(
+ [in] ModuleID moduleID,
+ [in] mdTypeDef typeDef,
+ [in] ULONG32 cTypeArgs,
+ [in, size_is(cTypeArgs)] ClassID typeArgs[],
+ [out] ClassID* pClassID);
+
+ /*
+ * GetFunctionFromTokenAndTypeArgs returns the FunctionID of a function given
+ * its metadata token (methoddef), containing class, and type args (if any).
+ *
+ * classID may be 0 if the containing class is not generic
+ * typeArgs may be NULL if cTypeArgs == 0
+ *
+ * Calling this function with a MethodRef token can have unpredictable results; callers
+ * should resolve the MethodRef to a MethodDef and use that.
+ *
+ * If the function is not already loaded, calling this function will cause it to be.
+ * Loading is a dangerous operation in many contexts. For example, calling
+ * this function during loading of modules or types could lead to an infinite
+ * loop as the runtime attempts to circularly load things.
+ *
+ * In general, use of this function is discouraged. If profilers are interested in
+ * events for a particular function, they should store the ModuleID and MethodDef of that function,
+ * and use GetFunctionInfo2 to check whether a given FunctionID is the desired function.
+ */
+ HRESULT GetFunctionFromTokenAndTypeArgs(
+ [in] ModuleID moduleID,
+ [in] mdMethodDef funcDef,
+ [in] ClassID classId,
+ [in] ULONG32 cTypeArgs,
+ [in, size_is(cTypeArgs)] ClassID typeArgs[],
+ [out] FunctionID* pFunctionID);
+
+ /*
+ * Returns an enumerator over all frozen objects in the given module.
+ */
+ HRESULT EnumModuleFrozenObjects(
+ [in] ModuleID moduleID,
+ [out] ICorProfilerObjectEnum** ppEnum);
+
+
+
+ /*
+ * GetArrayObjectInfo returns detailed information about an array object.
+ * objectId is a valid array object.
+ * cDimensions is the rank (# of dimensions).
+ * On success:
+ * pDimensionSizes, pDimensionLowerBounds are parallel arrays describing the size and lower bound for each dimension.
+ * (*ppData) is a pointer to the raw buffer for the array, which is laid out according to the C++
+ * convention
+ */
+ HRESULT GetArrayObjectInfo(
+ [in] ObjectID objectId,
+ [in] ULONG32 cDimensions,
+ [out, size_is(cDimensions)] ULONG32 pDimensionSizes[],
+ [out, size_is(cDimensions)] int pDimensionLowerBounds[],
+ [out] BYTE **ppData);
+
+ /*
+ * GetBoxClassLayout returns information about how a particular value type is laid out
+ * when boxed.
+ *
+ * *pBufferOffset is the offset (from the ObjectID pointer) to where the value type
+ * is stored within the box. The value type's class layout may then be used to
+ * interpret it.
+ */
+ HRESULT GetBoxClassLayout(
+ [in] ClassID classId,
+ [out] ULONG32 *pBufferOffset);
+
+
+ /*
+ * GetThreadAppDomain returns the AppDomainID currently associated with\
+ * the given ThreadID
+ */
+ HRESULT GetThreadAppDomain(
+ [in] ThreadID threadId,
+ [out] AppDomainID *pAppDomainId);
+
+
+ /*
+ * GetRVAStaticAddress gets the address of the home for the given
+ * RVA static. It must be called from a managed thread. Otherwise,
+ * it will return CORPROF_E_NOT_MANAGED_THREAD.
+ */
+ HRESULT GetRVAStaticAddress(
+ [in] ClassID classId,
+ [in] mdFieldDef fieldToken,
+ [out] void **ppAddress);
+
+ /*
+ * GetAppDomainStaticAddress gets the address of the home for the given
+ * AppDomain static in the given AppDomain.
+ *
+ * This function may return CORPROF_E_DATAINCOMPLETE if the given static
+ * has not been assigned a home in the given AppDomain.
+ */
+ HRESULT GetAppDomainStaticAddress(
+ [in] ClassID classId,
+ [in] mdFieldDef fieldToken,
+ [in] AppDomainID appDomainId,
+ [out] void **ppAddress);
+
+ /*
+ * GetThreadStaticAddress gets the address of the home for the given
+ * Thread static in the given Thread. threadId must be the current thread
+ * ID or NULL, which means using curernt thread ID.
+ *
+ * This function may return CORPROF_E_DATAINCOMPLETE if the given static
+ * has not been assigned a home in the given Thread.
+ */
+ HRESULT GetThreadStaticAddress(
+ [in] ClassID classId,
+ [in] mdFieldDef fieldToken,
+ [in] ThreadID threadId,
+ [out] void **ppAddress);
+
+ /*
+ * GetContextStaticAddress gets the address of the home for the given
+ * Context static in the given context. It must be called from a managed
+ * thread. Otherwise, it will return CORPROF_E_NOT_MANAGED_THREAD.
+ *
+ * This function may return CORPROF_E_DATAINCOMPLETE if the given static
+ * has not been assigned a home in the given Context.
+ */
+ HRESULT GetContextStaticAddress(
+ [in] ClassID classId,
+ [in] mdFieldDef fieldToken,
+ [in] ContextID contextId,
+ [out] void **ppAddress);
+
+ /*
+ * GetStaticFieldInfo gets COR_PRF_STATIC_TYPE for a specific
+ * field in a class. This information can be used to decide which
+ * function to call to get the address of the static.
+ *
+ * NOTE: One should still check the metadata for a static to ensure
+ * it is actually going to have an address. Statics that are literals
+ * (aka constants) exist only in the metadata and do not have an address.
+ *
+ */
+ HRESULT GetStaticFieldInfo(
+ [in] ClassID classId,
+ [in] mdFieldDef fieldToken,
+ [out] COR_PRF_STATIC_TYPE *pFieldInfo);
+
+ /*
+ * GetGenerationBounds returns the memory regions that make up a given
+ * GC generation in memory. It may be called from any profiler callback as long
+ * as a GC is not in progress. (To be exact, it may be called from any callback
+ * except for those that occur between GarbageCollectionStarted and GarbageCollectionFinished.)
+ *
+ * Most shifting of generations takes place during garbage collections; between
+ * collections generations may grow, but generally do not move around. Therefore
+ * the most interesting places to call this function are in GarbageCollectionStarted
+ * and Finished.
+ *
+ * During program startup, some objects are allocated by the CLR itself, generally
+ * in generations 3 and 0. So by the time managed code starts executing, these
+ * generations will already contain objects. Generations 1 and 2 will be normally
+ * empty, except for dummy objects generated by the garbage collector (of size 12
+ * bytes in 32-bit implementations of the CLR, larger in 64-bit implementaions).
+ * You may also see generation 2 ranges that are inside modules generated by ngen.
+ * These are "frozen objects" generated at ngen time rather than allocated by the
+ * garbage collector.
+ *
+ * cObjectRanges is a count of the number of elements allocated by the caller for
+ * the ranges array
+ * pcObjectRanges is an out param for the number of ranges in the given generation
+ * ranges is an array of elements of type COR_PRF_GC_GENERATION_RANGE, each of which
+ * describes a range of memory used by the garbage collector
+ */
+
+ HRESULT GetGenerationBounds(
+ [in] ULONG cObjectRanges,
+ [out] ULONG *pcObjectRanges,
+ [out, size_is(cObjectRanges), length_is(*pcObjectRanges)] COR_PRF_GC_GENERATION_RANGE ranges[]);
+
+ /*
+ * GetObjectGeneration returns which generation the given object is currently in, along
+ * with the start and length of the segment containing the object. It may be called
+ * at any time as long as a GC is not in progress.
+ */
+
+ HRESULT GetObjectGeneration(
+ [in] ObjectID objectId,
+ [out] COR_PRF_GC_GENERATION_RANGE *range);
+
+
+ /*
+ * When an exception notification is received, GetNotifiedExceptionClauseInfo() may be used
+ * to get the native address and frame information for the exception clause (catch/finally/filter)
+ * that is about to be run (ExceptionCatchEnter, ExceptionUnwindFinallyEnter, ExceptionFilterEnter)
+ * or has just been run (ExceptionCatchLeave, ExceptionUnwindFinallyLeave, ExceptionFilterLeave).
+ *
+ * This call may be made at any time after one of the Enter calls above until either the matching
+ * Leave call is received or until a nested exception throws out of the current clause in which case
+ * there will be no Leave notification for that clause. Note it is not possible for a throw to escape
+ * a Filter so there is always a Leave in that case.
+ *
+ * Return values:
+ * S_OK indicates success
+ * S_FALSE indicates that no exception clause is active
+ * CORPROF_E_NOT_MANAGED_THREAD indicates an unmanaged thread.
+ */
+
+ HRESULT GetNotifiedExceptionClauseInfo(
+ [out] COR_PRF_EX_CLAUSE_INFO *pinfo);
+}
+
+/*
+ * The CLR implements the ICorProfilerInfo3 interface. This interface is
+ * used by a code profiler to communicate with the CLR to control event
+ * monitoring and request information. The CLR passes an
+ * ICorProfilerInfo3 interface to each code profiler during initialization.
+ *
+ * A code profiler can call methods on the ICorProfilerInfo3 interface to get
+ * information about managed code being executed under the control of the CLR
+ *
+ * The ICorProfilerInfo3 interface implemented by the CLR uses the free
+ * threaded model.
+ *
+ * The methods implemented on this interface return S_OK on success, or E_FAIL
+ * on failure.
+ *
+ */
+
+[
+ object,
+ uuid(B555ED4F-452A-4E54-8B39-B5360BAD32A0),
+ pointer_default(unique),
+ local
+]
+interface ICorProfilerInfo3 : ICorProfilerInfo2
+{
+ /*
+ * Returns an enumerator for all previously jitted functions. May overlap with
+ * functions previously reported via CompilationStarted callbacks.
+ * NOTE: The returned enumeration will only include '0' for the value of the
+ * COR_PRF_FUNCTION::reJitId field. If you require valid COR_PRF_FUNCTION::reJitId values, use
+ * ICorProfilerInfo4::EnumJITedFunctions2.
+ */
+ HRESULT EnumJITedFunctions([out] ICorProfilerFunctionEnum** ppEnum);
+
+ HRESULT RequestProfilerDetach([in] DWORD dwExpectedCompletionMilliseconds);
+
+ HRESULT SetFunctionIDMapper2(
+ [in] FunctionIDMapper2 *pFunc,
+ [in] void *clientData);
+
+ /*
+ * GetStringLayout2 returns detailed information about how string objects are stored.
+ *
+ * *pStringLengthOffset is the offset (from the ObjectID pointer) to a DWORD that
+ * stores the length of the string itself
+ *
+ * *pBufferOffset is the offset (from the ObjectID pointer) to the actual buffer
+ * of wide characters
+ *
+ * Strings may or may not be null-terminated.
+ */
+ HRESULT GetStringLayout2(
+ [out] ULONG *pStringLengthOffset,
+ [out] ULONG *pBufferOffset);
+
+ /*
+ * The code profiler calls SetFunctionHooks3 to specify handlers
+ * for FunctionEnter3, FunctionLeave3, and FunctionTailcall3, and calls
+ * SetFunctionHooks3WithInfo to specify handlers for FunctionEnter3WithInfo,
+ * FunctionLeave3WithInfo, and FunctionTailcall3WithInfo.
+ *
+ * Note that only one set of callbacks may be active at a time. Thus,
+ * if a profiler calls SetEnterLeaveFunctionHooks, SetEnterLeaveFunctionHooks2
+ * and SetEnterLeaveFunctionHooks3(WithInfo), then SetEnterLeaveFunctionHooks3(WithInfo)
+ * wins. SetEnterLeaveFunctionHooks2 takes precedence over SetEnterLeaveFunctionHooks
+ * when both are set.
+ *
+ * Each function pointer may be null to disable that callback.
+ *
+ * SetEnterLeaveFunctionHooks3(WithInfo) may only be called from the
+ * profiler's Initialize() callback.
+ */
+ HRESULT SetEnterLeaveFunctionHooks3(
+ [in] FunctionEnter3 *pFuncEnter3,
+ [in] FunctionLeave3 *pFuncLeave3,
+ [in] FunctionTailcall3 *pFuncTailcall3);
+
+
+ HRESULT SetEnterLeaveFunctionHooks3WithInfo(
+ [in] FunctionEnter3WithInfo *pFuncEnter3WithInfo,
+ [in] FunctionLeave3WithInfo *pFuncLeave3WithInfo,
+ [in] FunctionTailcall3WithInfo *pFuncTailcall3WithInfo);
+
+ /*
+ * The profiler can call GetFunctionEnter3Info to gather frame info and argument info
+ * in FunctionEnter3WithInfo callback. The profiler needs to allocate sufficient space
+ * for COR_PRF_FUNCTION_ARGUMENT_INFO of the function it's inspecting and indicate the
+ * size in a ULONG pointed by pcbArgumentInfo.
+ */
+ HRESULT GetFunctionEnter3Info(
+ [in] FunctionID functionId,
+ [in] COR_PRF_ELT_INFO eltInfo,
+ [out] COR_PRF_FRAME_INFO *pFrameInfo,
+ [in, out] ULONG *pcbArgumentInfo,
+ [out, size_is(*pcbArgumentInfo)] COR_PRF_FUNCTION_ARGUMENT_INFO *pArgumentInfo);
+
+ /*
+ * The profiler can call GetFunctionLeave3Info to gather frame info and return value
+ * in FunctionLeave3WithInfo callback.
+ */
+ HRESULT GetFunctionLeave3Info(
+ [in] FunctionID functionId,
+ [in] COR_PRF_ELT_INFO eltInfo,
+ [out] COR_PRF_FRAME_INFO *pFrameInfo,
+ [out] COR_PRF_FUNCTION_ARGUMENT_RANGE *pRetvalRange);
+
+ /*
+ * The profiler can call GetFunctionTailcall3Info to gather frame info in
+ * FunctionTailcall3WithInfo callback.
+ */
+ HRESULT GetFunctionTailcall3Info(
+ [in] FunctionID functionId,
+ [in] COR_PRF_ELT_INFO eltInfo,
+ [out] COR_PRF_FRAME_INFO *pFrameInfo);
+
+ HRESULT EnumModules([out] ICorProfilerModuleEnum** ppEnum);
+
+ /*
+ * The profiler can call GetRuntimeInformation to query CLR version information.
+ * Passing NULL to any parameter is acceptable except pcchVersionString cannot
+ * be NULL if szVersionString is not NULL.
+ */
+ HRESULT GetRuntimeInformation([out] USHORT *pClrInstanceId,
+ [out] COR_PRF_RUNTIME_TYPE *pRuntimeType,
+ [out] USHORT *pMajorVersion,
+ [out] USHORT *pMinorVersion,
+ [out] USHORT *pBuildNumber,
+ [out] USHORT *pQFEVersion,
+ [in] ULONG cchVersionString,
+ [out] ULONG *pcchVersionString,
+ [out, annotation("_Out_writes_to_(cchVersionString, *pcchVersionString)")]
+ WCHAR szVersionString[]);
+
+ /*
+ * GetThreadStaticAddress2 gets the address of the home for the given
+ * Thread static in the given Thread.
+ *
+ * This function may return CORPROF_E_DATAINCOMPLETE if the given static
+ * has not been assigned a home in the given Thread.
+ */
+ HRESULT GetThreadStaticAddress2(
+ [in] ClassID classId,
+ [in] mdFieldDef fieldToken,
+ [in] AppDomainID appDomainId,
+ [in] ThreadID threadId,
+ [out] void **ppAddress);
+
+ /*
+ * GetAppDomainsContainingModule returns the AppDomainIDs in which the
+ * given module has been loaded
+ */
+ HRESULT GetAppDomainsContainingModule(
+ [in] ModuleID moduleId,
+ [in] ULONG32 cAppDomainIds,
+ [out] ULONG32 *pcAppDomainIds,
+ [out, size_is(cAppDomainIds), length_is(*pcAppDomainIds)] AppDomainID appDomainIds[]);
+
+
+ /*
+ * Retrieve information about a given module.
+ *
+ * When the module is loaded from disk, the name returned will be the filename;
+ * otherwise, the name will be the name from the metadata Module table (i.e.,
+ * the same as the managed System.Reflection.Module.ScopeName).
+ *
+ * *pdwModuleFlags will be filled in with a bitmask of values from COR_PRF_MODULE_FLAGS
+ * that specify some properties of the module.
+ *
+ * NOTE: While this function may be called as soon as the moduleId is alive,
+ * the AssemblyID of the containing assembly will not be available until the
+ * ModuleAttachedToAssembly callback.
+ *
+ */
+ HRESULT GetModuleInfo2(
+ [in] ModuleID moduleId,
+ [out] LPCBYTE *ppBaseLoadAddress,
+ [in] ULONG cchName,
+ [out] ULONG *pcchName,
+ [out, annotation("_Out_writes_to_(cchName, *pcchName)")]
+ WCHAR szName[],
+ [out] AssemblyID *pAssemblyId,
+ [out] DWORD *pdwModuleFlags);
+
+
+}
+
+
+/*
+ * This interface lets you iterate over the frozen objects from ngen images.
+ */
+
+[
+ object,
+ uuid(2C6269BD-2D13-4321-AE12-6686365FD6AF),
+ pointer_default(unique),
+ local
+]
+interface ICorProfilerObjectEnum : IUnknown
+{
+ HRESULT Skip(
+ [in] ULONG celt);
+
+ HRESULT Reset();
+
+ HRESULT Clone(
+ [out] ICorProfilerObjectEnum **ppEnum);
+
+ HRESULT GetCount(
+ [out] ULONG *pcelt);
+
+ HRESULT Next(
+ [in] ULONG celt,
+ [out, size_is(celt), length_is(*pceltFetched)] ObjectID objects[],
+ [out] ULONG *pceltFetched);
+}
+
+
+/*
+ * This interface lets you iterate over functions in the runtime.
+ */
+
+[
+ object,
+ uuid(FF71301A-B994-429D-A10B-B345A65280EF),
+ pointer_default(unique),
+ local
+]
+interface ICorProfilerFunctionEnum : IUnknown
+{
+ HRESULT Skip([in] ULONG celt);
+
+ HRESULT Reset();
+
+ HRESULT Clone([out] ICorProfilerFunctionEnum **ppEnum);
+
+ HRESULT GetCount([out] ULONG *pcelt);
+
+ HRESULT Next([in] ULONG celt,
+ [out, size_is(celt), length_is(*pceltFetched)]
+ COR_PRF_FUNCTION ids[],
+ [out] ULONG * pceltFetched);
+};
+
+/*
+ * This interface lets you iterate over modules in the runtime.
+ */
+
+[
+ object,
+ uuid(b0266d75-2081-4493-af7f-028ba34db891),
+ pointer_default(unique),
+ local
+]
+interface ICorProfilerModuleEnum : IUnknown
+{
+ HRESULT Skip([in] ULONG celt);
+
+ HRESULT Reset();
+
+ HRESULT Clone([out] ICorProfilerModuleEnum **ppEnum);
+
+ HRESULT GetCount([out] ULONG *pcelt);
+
+ HRESULT Next([in] ULONG celt,
+ [out, size_is(celt), length_is(*pceltFetched)]
+ ModuleID ids[],
+ [out] ULONG * pceltFetched);
+};
+
+/*
+ * NOTE: DEPRECATED, now you can use your any allocator.
+ *
+ * This is simple allocator that only allows you to allocate memory.
+ * You may not free it. This was used in conjunction with
+ * ICorProfilerInfo::SetILFunctionBody.
+ */
+[
+ object,
+ uuid(A0EFB28B-6EE2-4d7b-B983-A75EF7BEEDB8),
+ pointer_default(unique),
+ local
+]
+interface IMethodMalloc : IUnknown
+{
+ /*
+ * Tries to allocate memory above the start address of the module from
+ * which it was created. It is important to note that this method may
+ * fail to allocate the memory specified above the start address, and
+ * may as a result return NULL.
+ */
+ PVOID Alloc(
+ [in] ULONG cb);
+}
+
+/*
+ * The CLR implements the ICorProfilerFunctionControl interface. This interface
+ * is used by a code profiler to communicate with the CLR to control how the
+ * JIT should generate code when rejitting a specific method.
+ *
+ * The ICorProfilerFunctionControl interface implemented by the CLR uses the
+ * free threaded model.
+ */
+
+[
+ object,
+ uuid(F0963021-E1EA-4732-8581-E01B0BD3C0C6),
+ pointer_default(unique),
+ local
+]
+interface ICorProfilerFunctionControl : IUnknown
+{
+ /*
+ * Set one or more flags from COR_PRF_CODEGEN_FLAGS to control code
+ * generation just for this method.
+ */
+ HRESULT SetCodegenFlags(
+ [in] DWORD flags);
+
+ /*
+ * Override the method body.
+ */
+ HRESULT SetILFunctionBody(
+ [in] ULONG cbNewILMethodHeader,
+ [in, size_is(cbNewILMethodHeader)] LPCBYTE pbNewILMethodHeader);
+
+ /*
+ * This is not currently implemented, and will return E_NOTIMPL
+ */
+ HRESULT SetILInstrumentedCodeMap(
+ [in] ULONG cILMapEntries,
+ [in, size_is(cILMapEntries)] COR_IL_MAP rgILMapEntries[]);
+
+}
+
+/*
+ * The CLR implements the ICorProfilerInfo4 interface. This interface is
+ * used by a code profiler to communicate with the CLR to control event
+ * monitoring and request information. The CLR passes an
+ * ICorProfilerInfo4 interface to each code profiler during initialization.
+ *
+ * A code profiler can call methods on the ICorProfilerInfo4 interface to get
+ * information about managed code being executed under the control of the CLR
+ *
+ * The ICorProfilerInfo4 interface implemented by the CLR uses the free
+ * threaded model.
+ *
+ * The methods implemented on this interface return S_OK on success, or E_FAIL
+ * on failure.
+ *
+ */
+
+[
+ object,
+ uuid(0d8fdcaa-6257-47bf-b1bf-94dac88466ee),
+ pointer_default(unique),
+ local
+]
+interface ICorProfilerInfo4 : ICorProfilerInfo3
+{
+ HRESULT EnumThreads([out] ICorProfilerThreadEnum **ppEnum);
+ HRESULT InitializeCurrentThread();
+
+ /*
+ * Call RequestReJIT to have the runtime re-JIT a particular set of methods.
+ * A code profiler can then adjust the code generated when the method is
+ * re-JITed through the ICorProfilerFunctionControl interface. This does
+ * not impact currently executing methods, only future invocations.
+ *
+ * A return code of S_OK indicates that all of the requested methods were
+ * attempted to be rejitted. However, the profiler must implement
+ * ICorProfilerCallback4::ReJITError to determine which of the methods were
+ * successfully re-JITed.
+ *
+ * A failure return value (E_*) indicates some failure that prevents any
+ * re-JITs.
+ */
+ HRESULT RequestReJIT(
+ [in] ULONG cFunctions,
+ [in, size_is(cFunctions)] ModuleID moduleIds[],
+ [in, size_is(cFunctions)] mdMethodDef methodIds[]);
+
+ /*
+ * RequestRevert will instruct the runtime to revert to using/calling the
+ * original method (original IL and flags) rather than whatever was
+ * ReJITed. This does not change any currently active methods, only future
+ * invocations.
+ *
+ */
+ HRESULT RequestRevert(
+ [in] ULONG cFunctions,
+ [in, size_is(cFunctions)] ModuleID moduleIds[],
+ [in, size_is(cFunctions)] mdMethodDef methodIds[],
+ [out, size_is(cFunctions)] HRESULT status[]);
+
+ /*
+ * Same as GetCodeInfo2, except instead of always returning the code info
+ * associated with the original IL/function, you can request the code info
+ * for a particular re-JITed version of a function.
+ */
+ HRESULT GetCodeInfo3(
+ [in] FunctionID functionID,
+ [in] ReJITID reJitId,
+ [in] ULONG32 cCodeInfos,
+ [out] ULONG32 * pcCodeInfos,
+ [out, size_is(cCodeInfos), length_is(*pcCodeInfos)]
+ COR_PRF_CODE_INFO codeInfos[]);
+
+ /*
+ * Same as GetFunctionFromIP, but also returns which re-JITed version is
+ * associated with the IP address.
+ */
+ HRESULT GetFunctionFromIP2(
+ [in] LPCBYTE ip,
+ [out] FunctionID * pFunctionId,
+ [out] ReJITID * pReJitId);
+
+ /*
+ * GetReJITIDs can be used to find all of the re-JITed versions of the
+ * given function.
+ */
+ HRESULT GetReJITIDs(
+ [in] FunctionID functionId,
+ [in] ULONG cReJitIds,
+ [out] ULONG * pcReJitIds,
+ [out, size_is(cReJitIds), length_is(*pcReJitIds)]
+ ReJITID reJitIds[]);
+
+ /*
+ * Same as GetILToNativeMapping, but allows the code profiler to specify
+ * which re-JITed version it applies to.
+ */
+ HRESULT GetILToNativeMapping2(
+ [in] FunctionID functionId,
+ [in] ReJITID reJitId,
+ [in] ULONG32 cMap,
+ [out] ULONG32 * pcMap,
+ [out, size_is(cMap),length_is(*pcMap)]
+ COR_DEBUG_IL_TO_NATIVE_MAP map[]);
+
+ /*
+ * Returns an enumerator for all previously jitted functions. May overlap with
+ * functions previously reported via CompilationStarted callbacks. The returned
+ * enumeration will include values for the COR_PRF_FUNCTION::reJitId field
+ */
+ HRESULT EnumJITedFunctions2([out] ICorProfilerFunctionEnum** ppEnum);
+
+ /*
+ * The code profiler calls GetObjectSize to obtain the size of an object.
+ * Note that types like arrays and strings may have a different size for each object.
+ */
+ HRESULT GetObjectSize2(
+ [in] ObjectID objectId,
+ [out] SIZE_T *pcSize);
+
+}
+
+[
+ object,
+ uuid(07602928-CE38-4B83-81E7-74ADAF781214),
+ pointer_default(unique),
+ local
+]
+interface ICorProfilerInfo5 : ICorProfilerInfo4
+{
+ /*
+ * The code profiler calls GetEventMask2 to obtain the current event
+ * categories for which it is to receive event notifications from the CLR
+ *
+ * *pdwEventsLow is a bitwise combination of values from COR_PRF_MONITOR
+ * *pdwEventsHigh is a bitwise combination of values from COR_PRF_HIGH_MONITOR
+ */
+ HRESULT GetEventMask2(
+ [out] DWORD *pdwEventsLow,
+ [out] DWORD *pdwEventsHigh);
+
+ /*
+ * The code profiler calls SetEventMask2 to set the event categories for
+ * which it is set to receive notification from the CLR.
+ *
+ * dwEventsLow is a bitwise combination of values from COR_PRF_MONITOR
+ * dwEventsHigh is a bitwise combination of values from COR_PRF_HIGH_MONITOR
+ */
+ HRESULT SetEventMask2(
+ [in] DWORD dwEventsLow,
+ [in] DWORD dwEventsHigh);
+};
+
+
+[
+ object,
+ uuid(F30A070D-BFFB-46A7-B1D8-8781EF7B698A),
+ pointer_default(unique),
+ local
+]
+interface ICorProfilerInfo6 : ICorProfilerInfo5
+{
+ /*
+ * Returns an enumerator for all methods that
+ * - belong to a given NGen module (inlinersModuleId) and
+ * - inlined a body of a given method (inlineeModuleId / inlineeMethodId).
+ *
+ * If incompleteData is set to TRUE after function is called, it means that the methods enumerator
+ * doesn't contain all methods inlining a given method.
+ * It can happen when one or more direct or indirect dependencies of inliners module haven't been loaded yet.
+ * If profiler needs accurate data it should retry later when more modules are loaded (preferable on each module load).
+ *
+ * It can be used to lift limitation on inlining for ReJIT.
+ */
+ HRESULT EnumNgenModuleMethodsInliningThisMethod(
+ [in] ModuleID inlinersModuleId,
+ [in] ModuleID inlineeModuleId,
+ [in] mdMethodDef inlineeMethodId,
+ [out] BOOL *incompleteData,
+ [out] ICorProfilerMethodEnum** ppEnum);
+};
+
+[
+ object,
+ uuid(9AEECC0D-63E0-4187-8C00-E312F503F663),
+ pointer_default(unique),
+ local
+]
+interface ICorProfilerInfo7 : ICorProfilerInfo6
+{
+ /*
+ * Applies the newly emitted Metadata.
+ *
+ * This method can be used to apply the newly defined metadata by IMetadataEmit::Define* methods
+ * to the module.
+ *
+ * If metadata changes are made after ModuleLoadFinished callback,
+ * it is required to call this method before using the new metadata
+ */
+ HRESULT ApplyMetaData(
+ [in] ModuleID moduleId);
+
+ /* Returns the length of an in-memory symbol stream
+ *
+ * If the module has in-memory symbols the length of the stream will
+ * be placed in pCountSymbolBytes. If the module doesn't have in-memory
+ * symbols, *pCountSymbolBytes = 0
+ *
+ * Returns S_OK if the length could be determined (even if it is 0)
+ *
+ * Note: The current implementation does not support reflection.emit.
+ * CORPROF_E_MODULE_IS_DYNAMIC will be returned in that case.
+ */
+ HRESULT GetInMemorySymbolsLength(
+ [in] ModuleID moduleId,
+ [out] DWORD* pCountSymbolBytes);
+
+ /* Reads bytes from an in-memory symbol stream
+ *
+ * This function attempts to read countSymbolBytes of data starting at offset
+ * symbolsReadOffset within the in-memory stream. The data will be copied into
+ * pSymbolBytes which is expected to have countSymbolBytes of space available.
+ * pCountSymbolsBytesRead contains the actual number of bytes read which
+ * may be less than countSymbolBytes if the end of the stream is reached.
+ *
+ * Returns S_OK if a non-zero number of bytes were read.
+ *
+ * Note: The current implementation does not support reflection.emit.
+ * CORPROF_E_MODULE_IS_DYNAMIC will be returned in that case.
+ */
+ HRESULT ReadInMemorySymbols(
+ [in] ModuleID moduleId,
+ [in] DWORD symbolsReadOffset,
+ [out] BYTE* pSymbolBytes,
+ [in] DWORD countSymbolBytes,
+ [out] DWORD* pCountSymbolBytesRead);
+
+};
+
+/*
+* This interface lets you iterate over methods in the runtime.
+*/
+
+[
+ object,
+ uuid(FCCEE788-0088-454B-A811-C99F298D1942),
+ pointer_default(unique),
+ local
+]
+interface ICorProfilerMethodEnum : IUnknown
+{
+ HRESULT Skip([in] ULONG celt);
+
+ HRESULT Reset();
+
+ HRESULT Clone([out] ICorProfilerMethodEnum **ppEnum);
+
+ HRESULT GetCount([out] ULONG *pcelt);
+
+ HRESULT Next([in] ULONG celt,
+ [out, size_is(celt), length_is(*pceltFetched)]
+ COR_PRF_METHOD elements[],
+ [out] ULONG * pceltFetched);
+}
+
+/*
+ * This interface lets you iterate over threads in the runtime.
+ */
+
+[
+ object,
+ uuid(571194f7-25ed-419f-aa8b-7016b3159701),
+ pointer_default(unique),
+ local
+]
+interface ICorProfilerThreadEnum : IUnknown
+{
+ HRESULT Skip([in] ULONG celt);
+
+ HRESULT Reset();
+
+ HRESULT Clone([out] ICorProfilerThreadEnum **ppEnum);
+
+ HRESULT GetCount([out] ULONG *pcelt);
+
+ HRESULT Next([in] ULONG celt,
+ [out, size_is(celt), length_is(*pceltFetched)]
+ ThreadID ids[],
+ [out] ULONG * pceltFetched);
+}
+
+
+/*
+ * This interface is given to the profiler in the GetAssemblyReferences() callback, to
+ * allow the profiler to inform the CLR of assembly references that the profiler plans to
+ * add later on during ModuleLoadFinished. This improves the accuracy of the CLR assembly
+ * reference closure walker, and its algorithms for determining whether assemblies may be shared
+ *
+ * This interface is valid for use only within the GetAssemblyReferences callback that passed
+ * this interface to the profiler
+ */
+[
+ object,
+ uuid(66A78C24-2EEF-4F65-B45F-DD1D8038BF3C),
+ pointer_default(unique),
+ local
+]
+interface ICorProfilerAssemblyReferenceProvider : IUnknown
+{
+ // The profiler calls this for each target assembly it plans to reference from the
+ // assembly specified in the wszAssemblyPath argument of the GetAssemblyReferences callback.
+ HRESULT AddAssemblyReference(const COR_PRF_ASSEMBLY_REFERENCE_INFO * pAssemblyRefInfo);
+};
diff --git a/src/inc/corpub.idl b/src/inc/corpub.idl
new file mode 100644
index 0000000000..f5f0e73640
--- /dev/null
+++ b/src/inc/corpub.idl
@@ -0,0 +1,265 @@
+// 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.
+
+/* -------------------------------------------------------------------------- *
+ * Common Language Runtime Process Publishing Interfaces
+ * -------------------------------------------------------------------------- */
+
+cpp_quote("#if 0")
+#ifndef DO_NO_IMPORTS
+import "unknwn.idl";
+#endif
+cpp_quote("#endif")
+
+typedef enum
+{
+ COR_PUB_MANAGEDONLY = 0x00000001 // Must always be set,
+ // only enumerates
+ // managed processes
+} COR_PUB_ENUMPROCESS;
+
+
+/* -------------------------------------------------------------------------- *
+ * Forward declarations
+ * -------------------------------------------------------------------------- */
+#pragma warning(push)
+#pragma warning(disable:28718) //Unable to annotate as this is not a local interface
+
+interface ICorPublish;
+interface ICorPublishProcess;
+interface ICorPublishAppDomain;
+interface ICorPublishProcessEnum;
+interface ICorPublishAppDomainEnum;
+
+#pragma warning(pop)
+
+/* ------------------------------------------------------------------------- *
+ * Library defintion
+ * ------------------------------------------------------------------------- */
+
+[
+ uuid(e97ca460-657d-11d3-8d5b-00104b35e7ef),
+ version(1.0),
+ helpstring("Common Language Runtime Process Publishing Library")
+]
+library CorpubProcessLib
+{
+ importlib("STDOLE2.TLB");
+
+ // CorPublish is a shared component across all version of the runtime.
+ [
+ uuid(047a9a40-657e-11d3-8d5b-00104b35e7ef)
+ ]
+ coclass CorpubPublish
+ {
+ [default] interface ICorPublish;
+ interface ICorPublishProcess;
+ interface ICorPublishAppDomain;
+ interface ICorPublishProcessEnum;
+ interface ICorPublishAppDomainEnum;
+ };
+};
+
+
+/* -------------------------------------------------------------------------- *
+ * Interface definitions
+ * -------------------------------------------------------------------------- */
+
+/*
+ * This interface is the top level interface for publishing of processes.
+ */
+[
+ object,
+ uuid(9613A0E7-5A68-11d3-8F84-00A0C9B4D50C),
+ pointer_default(unique),
+ local
+]
+interface ICorPublish : IUnknown
+{
+ /*
+ * Retrieves a list of managed processes on this machine which
+ * the current user has permission to debug. In this version,
+ * Type must always be equal to COR_PUB_MANAGEDONLY.
+ * The list is based on a snapshot of the processes running when
+ * the enum method is called. The enumerator will not reflect any
+ * processes that start before or terminate after EnumProcesses is called.
+ * If EnumProcesses is called more than once on this ICorPublish
+ * instance, a new up-to-date enumeration will be returned without
+ * affecting any previous ones.
+ */
+ HRESULT EnumProcesses([in] COR_PUB_ENUMPROCESS Type,
+ [out] ICorPublishProcessEnum **ppIEnum);
+
+ /*
+ * Gets a new ICorPublishProcess object for the managed process
+ * with the given process ID. Returns failure if the process doesn't
+ * exist, or isn't a managed process that can be debugged by the current
+ * user.
+ */
+ HRESULT GetProcess([in] unsigned pid,
+ [out] ICorPublishProcess **ppProcess);
+}
+
+/*
+ * An abstract enumerator.
+ */
+[
+ object,
+ uuid(C0B22967-5A69-11d3-8F84-00A0C9B4D50C),
+ pointer_default(unique),
+ local
+]
+interface ICorPublishEnum : IUnknown
+{
+ /*
+ * Moves the current position forward the given number of
+ * elements.
+ */
+ HRESULT Skip([in] ULONG celt);
+
+ /*
+ * Sets the position of the enumerator to the beginning of the
+ * enumeration.
+ */
+ HRESULT Reset();
+
+ /*
+ * Creates another enumerator with the same current position
+ * as this one.
+ */
+ HRESULT Clone([out] ICorPublishEnum **ppEnum);
+
+ /*
+ * Gets the number of elements in the enumeration
+ */
+ HRESULT GetCount([out] ULONG *pcelt);
+};
+
+#pragma warning(push)
+#pragma warning(disable:28718)
+/*
+ * Describes a process on a machine.
+ */
+[
+ object,
+ uuid(18D87AF1-5A6A-11d3-8F84-00A0C9B4D50C),
+ pointer_default(unique),
+ local
+]
+interface ICorPublishProcess : IUnknown
+{
+ /*
+ * Returns true if the process is known to have managed code
+ * running in it. Since this version of ICorPublish only provides access
+ * to managed processes, this method always returns true.
+ */
+ HRESULT IsManaged([out] BOOL *pbManaged);
+
+ /*
+ * Enumerates the list of known application domains in this process.
+ * This list is based on a snapshot of the existing AppDomains when
+ * this method is called. This method may be called more than
+ * once to create a new up-to-date list. Existing enumerations will not
+ * be affected by calls to this method. If the process has been
+ * terminated, this will fail with CORDBG_E_PROCESS_TERMINATED.
+ */
+ HRESULT EnumAppDomains([out] ICorPublishAppDomainEnum **ppEnum);
+
+ /*
+ * Returns the OS ID for this process.
+ */
+ HRESULT GetProcessID([out] unsigned *pid);
+
+ /*
+ * Get the full path of the executable for this process.
+ * If szName is non-null, this copies up to cchName characters (including
+ * the null terminator) into szName, and ensures it is null-terminated.
+ * If pcchName is non-null, the actual number of characters in the name
+ * (including the null terminator) is stored there. This method returns
+ * S_OK regardless of how many characters were copied.
+ */
+ HRESULT GetDisplayName([in] ULONG32 cchName,
+ [out] ULONG32 *pcchName,
+ [out, size_is(cchName),
+ length_is(*pcchName)] WCHAR *szName);
+}
+#pragma warning(pop)
+
+#pragma warning(push)
+#pragma warning(disable:28718)
+/*
+ * Provide information on an Application Domain object.
+ */
+[
+ object,
+ uuid(D6315C8F-5A6A-11d3-8F84-00A0C9B4D50C),
+ pointer_default(unique),
+ local
+]
+interface ICorPublishAppDomain : IUnknown
+{
+ /*
+ * Gets the identification number of this application domain.
+ * Note that this number is unique to this AppDomain, but only
+ * within the containing process.
+ */
+ HRESULT GetID([out] ULONG32 *puId);
+
+ /*
+ * Get the name for an application domain.
+ * If szName is non-null, this copies up to cchName characters (including
+ * the null terminator) into szName, and ensures it is null-terminated.
+ * If pcchName is non-null, the actual number of characters in the name
+ * (including the null terminator) is stored there. This method returns
+ * S_OK regardless of how many characters were copied.
+ */
+ HRESULT GetName([in] ULONG32 cchName,
+ [out] ULONG32 *pcchName,
+ [out, size_is(cchName),
+ length_is(*pcchName)] WCHAR *szName);
+}
+#pragma warning(pop)
+
+
+/*
+ * Enumerate a list of processes based on the filter criteria given
+ * when the enumerator object was created.
+ */
+[
+ object,
+ uuid(A37FBD41-5A69-11d3-8F84-00A0C9B4D50C),
+ pointer_default(unique),
+ local
+]
+interface ICorPublishProcessEnum : ICorPublishEnum
+{
+ /*
+ * Gets the next "celt" processes in the enumeration.
+ */
+ HRESULT Next([in] ULONG celt,
+ [out, size_is(celt),
+ length_is(*pceltFetched)] ICorPublishProcess **objects,
+ [out] ULONG *pceltFetched);
+}
+
+/*
+ * Enumerate a list of app domains based in a process.
+ */
+[
+ object,
+ uuid(9F0C98F5-5A6A-11d3-8F84-00A0C9B4D50C),
+ pointer_default(unique),
+ local
+]
+interface ICorPublishAppDomainEnum : ICorPublishEnum
+{
+ /*
+ * Gets the next "celt" application domains in the enumeration.
+ */
+ HRESULT Next([in] ULONG celt,
+ [out, size_is(celt),
+ length_is(*pceltFetched)] ICorPublishAppDomain **objects,
+ [out] ULONG *pceltFetched);
+}
+
diff --git a/src/inc/corsym.idl b/src/inc/corsym.idl
new file mode 100644
index 0000000000..8d7aa3f67d
--- /dev/null
+++ b/src/inc/corsym.idl
@@ -0,0 +1,1785 @@
+// 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.
+
+/* ------------------------------------------------------------------------- *
+ * Common Language Runtime Debugging Symbol Reader/Writer/Binder Interfaces
+ * ------------------------------------------------------------------------- */
+
+/* ------------------------------------------------------------------------- *
+ * Imported types
+ * ------------------------------------------------------------------------- */
+
+cpp_quote("#if 0")
+typedef UINT32 mdToken;
+typedef mdToken mdTypeDef;
+typedef mdToken mdMethodDef;
+typedef SIZE_T IMAGE_DEBUG_DIRECTORY;
+cpp_quote("#endif")
+
+cpp_quote("#ifndef __CORHDR_H__")
+typedef mdToken mdSignature;
+cpp_quote("#endif")
+
+#include "winerror.h"
+
+/* ------------------------------------------------------------------------- *
+ * Guids for known languages, language vendors, and document types
+ * ------------------------------------------------------------------------- */
+
+cpp_quote("EXTERN_GUID(CorSym_LanguageType_C, 0x63a08714, 0xfc37, 0x11d2, 0x90, 0x4c, 0x0, 0xc0, 0x4f, 0xa3, 0x02, 0xa1);")
+cpp_quote("EXTERN_GUID(CorSym_LanguageType_CPlusPlus, 0x3a12d0b7, 0xc26c, 0x11d0, 0xb4, 0x42, 0x0, 0xa0, 0x24, 0x4a, 0x1d, 0xd2);")
+cpp_quote("EXTERN_GUID(CorSym_LanguageType_CSharp, 0x3f5162f8, 0x07c6, 0x11d3, 0x90, 0x53, 0x0, 0xc0, 0x4f, 0xa3, 0x02, 0xa1);")
+cpp_quote("EXTERN_GUID(CorSym_LanguageType_Basic, 0x3a12d0b8, 0xc26c, 0x11d0, 0xb4, 0x42, 0x0, 0xa0, 0x24, 0x4a, 0x1d, 0xd2);")
+cpp_quote("EXTERN_GUID(CorSym_LanguageType_Java, 0x3a12d0b4, 0xc26c, 0x11d0, 0xb4, 0x42, 0x0, 0xa0, 0x24, 0x4a, 0x1d, 0xd2);")
+cpp_quote("EXTERN_GUID(CorSym_LanguageType_Cobol, 0xaf046cd1, 0xd0e1, 0x11d2, 0x97, 0x7c, 0x0, 0xa0, 0xc9, 0xb4, 0xd5, 0xc);")
+cpp_quote("EXTERN_GUID(CorSym_LanguageType_Pascal, 0xaf046cd2, 0xd0e1, 0x11d2, 0x97, 0x7c, 0x0, 0xa0, 0xc9, 0xb4, 0xd5, 0xc);")
+cpp_quote("EXTERN_GUID(CorSym_LanguageType_ILAssembly, 0xaf046cd3, 0xd0e1, 0x11d2, 0x97, 0x7c, 0x0, 0xa0, 0xc9, 0xb4, 0xd5, 0xc);")
+cpp_quote("EXTERN_GUID(CorSym_LanguageType_JScript, 0x3a12d0b6, 0xc26c, 0x11d0, 0xb4, 0x42, 0x00, 0xa0, 0x24, 0x4a, 0x1d, 0xd2);")
+cpp_quote("EXTERN_GUID(CorSym_LanguageType_SMC, 0xd9b9f7b, 0x6611, 0x11d3, 0xbd, 0x2a, 0x0, 0x0, 0xf8, 0x8, 0x49, 0xbd);")
+cpp_quote("EXTERN_GUID(CorSym_LanguageType_MCPlusPlus, 0x4b35fde8, 0x07c6, 0x11d3, 0x90, 0x53, 0x0, 0xc0, 0x4f, 0xa3, 0x02, 0xa1);")
+cpp_quote("EXTERN_GUID(CorSym_LanguageVendor_Microsoft, 0x994b45c4, 0xe6e9, 0x11d2, 0x90, 0x3f, 0x00, 0xc0, 0x4f, 0xa3, 0x02, 0xa1);")
+cpp_quote("EXTERN_GUID(CorSym_DocumentType_Text, 0x5a869d0b, 0x6611, 0x11d3, 0xbd, 0x2a, 0x0, 0x0, 0xf8, 0x8, 0x49, 0xbd);")
+cpp_quote("EXTERN_GUID(CorSym_DocumentType_MC, 0xeb40cb65, 0x3c1f, 0x4352, 0x9d, 0x7b, 0xba, 0xf, 0xc4, 0x7a, 0x9d, 0x77);")
+
+#ifdef INTEROPLIB
+module LanguageType
+{
+ const LPSTR C = "{63a08714-fc37-11d2-904c-00c04fa302a1}";
+ const LPSTR CPlusPlus = "{3a12d0b7-c26c-11d0-b442-00a0244a1dd2}";
+ const LPSTR CSharp = "{3f5162f8-07c6-11d3-9053-00c04fa302a1}";
+ const LPSTR Basic = "{3a12d0b8-c26c-11d0-b442-00a0244a1dd2}";
+ const LPSTR Java = "{3a12d0b4-c26c-11d0-b442-00a0244a1dd2}";
+ const LPSTR Cobol = "{af046cd1-d0e1-11d2-977c-00a0c9b4d50c}";
+ const LPSTR Pascal = "{af046cd2-d0e1-11d2-977c-00a0c9b4d50c}";
+ const LPSTR ILAssembly ="{af046cd3-d0e1-11d2-977c-00a0c9b4d50c}";
+ const LPSTR JScript = "{3a12d0b6-c26c-11d0-b442-00a0244a1dd2}";
+ const LPSTR SMC = "{0d9b9f7b-6611-11d3-bd2a-0000f80849bd}";
+ const LPSTR MCPlusPlus ="{4b35fde8-07c6-11d3-9053-00c04fa302a1}";
+}
+
+
+module ErrorCodes80
+{
+ const int E_SYM_DESTROYED = MAKE_HRESULT(1, FACILITY_ITF, 0xdead);
+}
+
+
+#endif // ndef INTEROPLIB
+
+
+/* ------------------------------------------------------------------------- *
+ * Guids for known Source Hash Algorithms
+ * ------------------------------------------------------------------------- */
+
+cpp_quote("EXTERN_GUID(CorSym_SourceHash_MD5, 0x406ea660, 0x64cf, 0x4c82, 0xb6, 0xf0, 0x42, 0xd4, 0x81, 0x72, 0xa7, 0x99);")
+cpp_quote("EXTERN_GUID(CorSym_SourceHash_SHA1, 0xff1816ec, 0xaa5e, 0x4d10, 0x87, 0xf7, 0x6f, 0x49, 0x63, 0x83, 0x34, 0x60);")
+
+
+/* ------------------------------------------------------------------------- *
+ * Forward declarations
+ * ------------------------------------------------------------------------- */
+
+interface ISymUnmanagedDocument;
+interface ISymUnmanagedDocumentWriter;
+interface ISymUnmanagedMethod;
+interface ISymUnmanagedNamespace;
+interface ISymUnmanagedReader;
+interface ISymUnmanagedReaderSymbolSearchInfo;
+interface ISymUnmanagedScope;
+interface ISymUnmanagedVariable;
+interface ISymUnmanagedSymbolSearchInfo;
+interface ISymUnmanagedWriter;
+interface ISymUnmanagedWriter2;
+interface ISymUnmanagedBinder;
+
+/* ------------------------------------------------------------------------- *
+ * CorSymAddrKind -- specifies the kinds of addresses used by the interfaces
+ * ------------------------------------------------------------------------- */
+
+typedef enum CorSymAddrKind
+{
+ /*
+ * ADDR_IL_OFFSET: addr1 = IL local var or param index.
+ */
+ ADDR_IL_OFFSET = 1,
+
+ /*
+ * ADDR_NATIVE_RVA: addr1 = RVA into module.
+ */
+ ADDR_NATIVE_RVA = 2,
+
+ /*
+ * ADDR_NATIVE_REGISTER: addr1 = register the var is stored in.
+ */
+ ADDR_NATIVE_REGISTER = 3,
+
+ /*
+ * ADDR_NATIVE_REGREL: addr1 = register, addr2 = offset.
+ */
+ ADDR_NATIVE_REGREL = 4,
+
+ /*
+ * ADDR_NATIVE_OFFSET: addr1 = offset from start of parent.
+ */
+ ADDR_NATIVE_OFFSET = 5,
+
+ /*
+ * ADDR_NATIVE_REGREG: addr1 = reg low, addr2 = reg high.
+ */
+ ADDR_NATIVE_REGREG = 6,
+
+ /*
+ * ADDR_NATIVE_REGSTK: addr1 = reg low, addr2 = reg stk, addr3 = offset.
+ */
+ ADDR_NATIVE_REGSTK = 7,
+
+ /*
+ * ADDR_NATIVE_STKREG: addr1 = reg stk, addr2 = offset, addr3 = reg high.
+ */
+ ADDR_NATIVE_STKREG = 8,
+
+ /*
+ * ADDR_BITFIELD: addr1 = field start, addr = field length.
+ */
+ ADDR_BITFIELD = 9,
+
+ /*
+ * ADDR_NATIVE_SECTOFF: addr1 = section, addr = offset
+ */
+ ADDR_NATIVE_ISECTOFFSET = 10
+
+} CorSymAddrKind;
+
+typedef enum CorSymVarFlag {
+
+ /*
+ * VAR_IS_COMP_GEN: Variable is compiler generated.
+ */
+ VAR_IS_COMP_GEN = 1
+
+} CorSymVarFlag;
+
+/* ------------------------------------------------------------------------- *
+ * Library defintion
+ *
+ * Use the _SxS coclasses for tools designed to work with .NET Framework
+ * 1.1 and above. On computers that only have version 1.0 installed, fall
+ * back to the _deprecated coclasses if CoCreating the _SxS ones fails.
+ * ------------------------------------------------------------------------- */
+
+#ifndef INTEROPLIB
+
+[
+ uuid(7E348441-7E1F-380E-A0F6-22668F0F9E4B),
+ version(1.0),
+ helpstring("Common Language Runtime Symbol Store 1.0 Type Library")
+]
+library CorSymLib
+{
+ importlib("STDOLE2.TLB");
+
+#endif // ndef INTEROPLIB
+
+
+ [
+ uuid(108296C1-281E-11d3-BD22-0000F80849BD)
+ ]
+ coclass CorSymWriter_deprecated
+ {
+ [default] interface ISymUnmanagedWriter;
+ };
+
+ [
+ uuid(108296C2-281E-11d3-BD22-0000F80849BD)
+ ]
+ coclass CorSymReader_deprecated
+ {
+ [default] interface ISymUnmanagedReader;
+ };
+
+ [
+ uuid(AA544D41-28CB-11d3-BD22-0000F80849BD)
+ ]
+ coclass CorSymBinder_deprecated
+ {
+ [default] interface ISymUnmanagedBinder;
+ };
+
+ [
+ uuid(0AE2DEB0-F901-478b-BB9F-881EE8066788)
+ ]
+ coclass CorSymWriter_SxS
+ {
+ [default] interface ISymUnmanagedWriter;
+ };
+
+ [
+ uuid(0A3976C5-4529-4ef8-B0B0-42EED37082CD)
+ ]
+ coclass CorSymReader_SxS
+ {
+ [default] interface ISymUnmanagedReader;
+ };
+
+ [
+ uuid(0A29FF9E-7F9C-4437-8B11-F424491E3931)
+ ]
+ coclass CorSymBinder_SxS
+ {
+ [default] interface ISymUnmanagedBinder;
+ };
+
+
+#ifndef INTEROPLIB
+};
+#endif // ndef INTEROPLIB
+
+
+/* ------------------------------------------------------------------------- *
+ * ISymUnmanagedBinder interface
+ * ------------------------------------------------------------------------- */
+
+[
+ object,
+ uuid(AA544D42-28CB-11d3-BD22-0000F80849BD),
+ pointer_default(unique)
+]
+interface ISymUnmanagedBinder : IUnknown
+{
+ /*
+ * Given a metadata interface and a file name, returns the
+ * correct ISymUnmanagedReader that will read the debugging symbols
+ * associated with the module.
+ *
+ * This will only open the Pdb if it is next to the Exe.
+ * This change has been made for security purposes
+ *
+ * If you need a more extensive search for the pdb
+ * use ISymUnmanagedBinder2.
+ */
+
+ HRESULT GetReaderForFile([in] IUnknown *importer,
+ [in] const WCHAR *fileName,
+ [in] const WCHAR *searchPath,
+ [out, retval] ISymUnmanagedReader **pRetVal);
+
+ /*
+ * Given a metadata interface and a stream that contains
+ * the symbol store, returns the correct ISymUnmanagedReader
+ * that will read the debugging symbols from the given
+ * symbol store.
+ */
+ HRESULT GetReaderFromStream([in] IUnknown *importer,
+ [in] IStream *pstream,
+ [out,retval] ISymUnmanagedReader **pRetVal);
+};
+
+typedef enum CorSymSearchPolicyAttributes
+{
+ AllowRegistryAccess = 0x1, // query the registry for symbol search paths
+ AllowSymbolServerAccess = 0x2, // access a symbol server
+ AllowOriginalPathAccess = 0x4, // look at the path specified in Debug Directory
+ AllowReferencePathAccess = 0x8 // look for PDB in the place where the exe is.
+} CorSymSearchPolicyAttributes;
+
+/* ------------------------------------------------------------------------- *
+ * ISymUnmanagedBinder2 interface: QI from an ISymUnmanagedBinder
+ * ------------------------------------------------------------------------- */
+[
+ object,
+ uuid(ACCEE350-89AF-4ccb-8B40-1C2C4C6F9434),
+ pointer_default(unique)
+]
+interface ISymUnmanagedBinder2 : ISymUnmanagedBinder
+{
+ /*
+ * Given a metadata interface and a file name, returns the correct
+ * ISymUnmanagedReader interface that will read the debugging symbols associated
+ * with the module.
+ *
+ * This version of the function can search for the PDB in areas other than
+ * right next to the module.
+ * The search policy can be controlled by combining CorSymSearchPolicyAttributes
+ * e.g AllowReferencePathAccess|AllowSymbolServerAccess will look for the pdb next
+ * to the PE file and on a symbol server, but won't query the registry or use the path
+ * in the PE file.
+ * If a searchPath is provided, those directories will always be searched.
+ */
+
+ HRESULT GetReaderForFile2([in] IUnknown *importer,
+ [in] const WCHAR *fileName,
+ [in] const WCHAR *searchPath,
+ [in] ULONG32 searchPolicy,
+ [out,retval] ISymUnmanagedReader **pRetVal);
+
+};
+
+/* ------------------------------------------------------------------------- *
+ * ISymUnmanagedBinder3 interface: QI from an ISymUnmanagedBinder
+ * ------------------------------------------------------------------------- */
+[
+ object,
+ uuid(28AD3D43-B601-4d26-8A1B-25F9165AF9D7),
+ pointer_default(unique)
+]
+interface ISymUnmanagedBinder3 : ISymUnmanagedBinder2
+{
+ /*
+ * GetReaderFromCallback allows the user to implement supply via callback either an
+ * IID_IDiaReadExeAtRVACallback or IID_IDiaReadExeAtOffsetCallback to obtain the
+ * Debug directory information from memory.
+ */
+ HRESULT GetReaderFromCallback([in] IUnknown *importer,
+ [in] const WCHAR *fileName,
+ [in] const WCHAR *searchPath,
+ [in] ULONG32 searchPolicy,
+ [in] IUnknown *callback,
+ [out,retval] ISymUnmanagedReader **pRetVal);
+};
+
+cpp_quote("static const int E_SYM_DESTROYED = MAKE_HRESULT(1, FACILITY_ITF, 0xdead);")
+
+[
+ object,
+ uuid(969708D2-05E5-4861-A3B0-96E473CDF63F),
+ pointer_default(unique)
+]
+interface ISymUnmanagedDispose : IUnknown
+{
+
+ /*
+ * Calling this function will cause the underlying object to
+ * release all internal references and return failure on any subsequent
+ * method calls.
+ */
+
+ HRESULT Destroy();
+};
+
+/* ------------------------------------------------------------------------- *
+ * ISymUnmanagedDocument interface
+ *
+ * Represents a document referenced by a symbol store. A document is defined
+ * by an URL and a document type GUID. Using the URL and document type GUID,
+ * one can locate the document however it is stored. Document source can
+ * optionally be stored in the symbol store, and retrieved through this
+ * interface.
+ * ------------------------------------------------------------------------- */
+
+[
+ object,
+ uuid(40DE4037-7C81-3E1E-B022-AE1ABFF2CA08),
+ pointer_default(unique)
+]
+interface ISymUnmanagedDocument : IUnknown
+{
+ /*
+ * Return the URL for this document.
+ */
+ HRESULT GetURL([in] ULONG32 cchUrl,
+ [out] ULONG32 *pcchUrl,
+ [out, size_is(cchUrl),
+ length_is(*pcchUrl)] WCHAR szUrl[]);
+
+ /*
+ * Get the document type of this document.
+ */
+ HRESULT GetDocumentType([out, retval] GUID* pRetVal);
+
+ /*
+ * Get the language id of this document.
+ */
+ HRESULT GetLanguage([out, retval] GUID* pRetVal);
+
+ /*
+ * Get the language vendor of this document.
+ */
+ HRESULT GetLanguageVendor([out, retval] GUID* pRetVal);
+
+ /*
+ * Get the check sum algorithm id. Returns a guid of all zeros if
+ * there is no checksum.
+ */
+ HRESULT GetCheckSumAlgorithmId([out, retval] GUID* pRetVal);
+
+ /*
+ * Get the check sum.
+ */
+ HRESULT GetCheckSum([in] ULONG32 cData,
+ [out] ULONG32 *pcData,
+ [out, size_is(cData),
+ length_is(*pcData)] BYTE data[]);
+
+ /*
+ * Given a line in this document that may or may not be a sequence
+ * point, return the closest line that is a sequence point. */
+ HRESULT FindClosestLine([in] ULONG32 line,
+ [out, retval] ULONG32* pRetVal);
+
+ /*
+ * Returns true if the document has source embedded in the
+ * debugging symbols.
+ */
+ HRESULT HasEmbeddedSource([out, retval] BOOL *pRetVal);
+
+ /*
+ * Returns the length, in bytes, of the embedded source.
+ */
+ HRESULT GetSourceLength([out, retval] ULONG32* pRetVal);
+
+ /*
+ * Returns the embedded source into the given buffer. The buffer must
+ * be large enough to hold the source.
+ */
+ HRESULT GetSourceRange([in] ULONG32 startLine,
+ [in] ULONG32 startColumn,
+ [in] ULONG32 endLine,
+ [in] ULONG32 endColumn,
+ [in] ULONG32 cSourceBytes,
+ [out] ULONG32 *pcSourceBytes,
+ [out, size_is(cSourceBytes),
+ length_is(*pcSourceBytes)] BYTE source[]);
+
+};
+
+/* ------------------------------------------------------------------------- *
+ * ISymUnmanagedDocumentWriter interface
+ *
+ * Provides functions for writing to a document referenced by a symbol
+ * store.
+ * ------------------------------------------------------------------------- */
+
+[
+ object,
+ uuid(B01FAFEB-C450-3A4D-BEEC-B4CEEC01E006),
+ pointer_default(unique)
+]
+interface ISymUnmanagedDocumentWriter : IUnknown
+{
+ /*
+ * Sets embedded source for a document being written.
+ */
+ HRESULT SetSource([in] ULONG32 sourceSize,
+ [in, size_is(sourceSize)] BYTE source[]);
+
+ /*
+ * Sets check sum info.
+ */
+ HRESULT SetCheckSum([in] GUID algorithmId,
+ [in] ULONG32 checkSumSize,
+ [in, size_is(checkSumSize)] BYTE checkSum[]);
+};
+
+/* ------------------------------------------------------------------------- *
+ * ISymUnmanagedMethod interface
+ *
+ * Represents a method within the symbol store. Provides access to only the
+ * symbol-related attributes of a method, rather than type-related attributes.
+ * ------------------------------------------------------------------------- */
+
+[
+ object,
+ uuid(B62B923C-B500-3158-A543-24F307A8B7E1),
+ pointer_default(unique)
+]
+interface ISymUnmanagedMethod : IUnknown
+{
+ /*
+ * Return the metadata token for this method.
+ */
+ HRESULT GetToken([out, retval] mdMethodDef *pToken);
+
+ /*
+ * Get the count of sequence points within this method.
+ */
+ HRESULT GetSequencePointCount([out, retval] ULONG32* pRetVal);
+
+ /*
+ * Get the root lexical scope within this method.
+ * This scope encloses the entire method.
+ */
+ HRESULT GetRootScope([out, retval] ISymUnmanagedScope** pRetVal);
+
+ /*
+ * Get the most enclosing lexical scope within this method that
+ * encloses the given offset. This can be used to start
+ * local variable searches.
+ */
+ HRESULT GetScopeFromOffset([in] ULONG32 offset,
+ [out, retval] ISymUnmanagedScope** pRetVal);
+
+ /*
+ * Given a position within a document, return the offset within
+ * this method that cooresponds to the position.
+ */
+ HRESULT GetOffset([in] ISymUnmanagedDocument* document,
+ [in] ULONG32 line,
+ [in] ULONG32 column,
+ [out, retval] ULONG32* pRetVal);
+
+ /*
+ * Given a position in a document, return an array of start/end
+ * offset paris that correspond to the ranges of IL that the
+ * position covers within this method. The array is an array of
+ * integers and is [start,end,start,end]. The number of range
+ * pairs is the length of the array / 2.
+ */
+ HRESULT GetRanges([in] ISymUnmanagedDocument* document,
+ [in] ULONG32 line,
+ [in] ULONG32 column,
+ [in] ULONG32 cRanges,
+ [out] ULONG32 *pcRanges,
+ [out, size_is(cRanges),
+ length_is(*pcRanges)] ULONG32 ranges[]);
+
+ /*
+ * Get the parameters for this method. The parameters are returned
+ * in the order they are defined within the method's signature.
+ */
+ HRESULT GetParameters([in] ULONG32 cParams,
+ [out] ULONG32 *pcParams,
+ [out, size_is(cParams),
+ length_is(*pcParams)] ISymUnmanagedVariable* params[]);
+
+ /*
+ * Get the namespace that this method is defined within.
+ */
+ HRESULT GetNamespace([out] ISymUnmanagedNamespace **pRetVal);
+
+ /*
+ * Get the start/end document positions for the source of this
+ * method. The first array position is the start while the second
+ * is the end. Returns true if positions were defined, false
+ * otherwise.
+ */
+ HRESULT GetSourceStartEnd([in] ISymUnmanagedDocument *docs[2],
+ [in] ULONG32 lines[2],
+ [in] ULONG32 columns[2],
+ [out] BOOL *pRetVal);
+
+ /*
+ * Get all the sequence points within this method.
+ */
+ HRESULT GetSequencePoints([in] ULONG32 cPoints,
+ [out] ULONG32 *pcPoints,
+ [in, size_is(cPoints)] ULONG32 offsets[],
+ [in, size_is(cPoints)] ISymUnmanagedDocument* documents[],
+ [in, size_is(cPoints)] ULONG32 lines[],
+ [in, size_is(cPoints)] ULONG32 columns[],
+ [in, size_is(cPoints)] ULONG32 endLines[],
+ [in, size_is(cPoints)] ULONG32 endColumns[]);
+};
+
+[
+ object,
+ uuid(85E891DA-A631-4c76-ACA2-A44A39C46B8C),
+ pointer_default(unique)
+]
+interface ISymENCUnmanagedMethod : IUnknown
+{
+ /*
+ * Get the file name for the line associated with offset dwOffset.
+ */
+ HRESULT GetFileNameFromOffset([in] ULONG32 dwOffset,
+ [in] ULONG32 cchName,
+ [out] ULONG32 *pcchName,
+ [out, size_is(cchName),
+ length_is(*pcchName)] WCHAR szName[]);
+
+ /*
+ * Get the Line information associated with dwOffset.
+ * If dwOffset is not a sequence point it is associated with the previous one.
+ * pdwStartOffset provides the associated sequence point.
+ */
+ HRESULT GetLineFromOffset([in] ULONG32 dwOffset,
+ [out] ULONG32* pline,
+ [out] ULONG32* pcolumn,
+ [out] ULONG32* pendLine,
+ [out] ULONG32* pendColumn,
+ [out] ULONG32* pdwStartOffset);
+
+ /*
+ * Get the number of Documents that this method has lines in.
+ */
+ HRESULT GetDocumentsForMethodCount([out, retval] ULONG32* pRetVal);
+
+ /*
+ * Get the documents this method has lines in.
+ */
+ HRESULT GetDocumentsForMethod([in] ULONG32 cDocs,
+ [out] ULONG32 *pcDocs,
+ [in, size_is(cDocs)] ISymUnmanagedDocument* documents[]);
+ /*
+ * Get the smallest start line and largest end line, for the method, in a specific document.
+ */
+ HRESULT GetSourceExtentInDocument([in] ISymUnmanagedDocument *document,
+ [out] ULONG32* pstartLine,
+ [out] ULONG32* pendLine);
+};
+
+/* ------------------------------------------------------------------------- *
+ * ISymUnmanagedNamespace interface
+ *
+ * Represents a namespace.
+ * ------------------------------------------------------------------------- */
+
+[
+ object,
+ uuid(0DFF7289-54F8-11d3-BD28-0000F80849BD),
+ pointer_default(unique)
+]
+interface ISymUnmanagedNamespace : IUnknown
+{
+ /*
+ * Get the name of this namespace.
+ */
+ HRESULT GetName([in] ULONG32 cchName,
+ [out] ULONG32 *pcchName,
+ [out, size_is(cchName),
+ length_is(*pcchName)] WCHAR szName[]);
+
+ /*
+ * Get the children of this namespace.
+ */
+ HRESULT GetNamespaces([in] ULONG32 cNameSpaces,
+ [out] ULONG32 *pcNameSpaces,
+ [out, size_is(cNameSpaces),
+ length_is(*pcNameSpaces)]
+ ISymUnmanagedNamespace* namespaces[]);
+
+ /*
+ * Return all variables defined at global scope within this namespace.
+ */
+ HRESULT GetVariables([in] ULONG32 cVars,
+ [out] ULONG32 *pcVars,
+ [out, size_is(cVars),
+ length_is(*pcVars)] ISymUnmanagedVariable *pVars[]);
+};
+
+/* ------------------------------------------------------------------------- *
+ * ISymUnmanagedReader interface
+ *
+ * Represents a symbol reader. Provides access to documents, methods, and
+ * variables within a symbol store.
+ * ------------------------------------------------------------------------- */
+
+[
+ object,
+ uuid(B4CE6286-2A6B-3712-A3B7-1EE1DAD467B5),
+ pointer_default(unique)
+]
+interface ISymUnmanagedReader : IUnknown
+{
+ /*
+ * Find a document. Language, vendor, and document type are optional.
+ */
+ HRESULT GetDocument([in] WCHAR *url,
+ [in] GUID language,
+ [in] GUID languageVendor,
+ [in] GUID documentType,
+ [out, retval] ISymUnmanagedDocument** pRetVal);
+
+ /*
+ * Return an array of all the documents defined in the symbol store.
+ */
+ HRESULT GetDocuments([in] ULONG32 cDocs,
+ [out] ULONG32 *pcDocs,
+ [out, size_is(cDocs),
+ length_is(*pcDocs)] ISymUnmanagedDocument *pDocs[]);
+
+ /*
+ * Return the method that was specified as the user entry point
+ * for the module, if any. This would be, perhaps, the user's main
+ * method rather than compiler generated stubs before main.
+ */
+ HRESULT GetUserEntryPoint([out, retval] mdMethodDef *pToken);
+
+ /*
+ * Get a symbol reader method given a method token.
+ */
+ HRESULT GetMethod([in] mdMethodDef token,
+ [out, retval] ISymUnmanagedMethod** pRetVal);
+
+ /*
+ * Get a symbol reader method given a method token and an E&C
+ * version number. Version numbers start at 1 and are incremented
+ * each time the method is changed due to an E&C operation.
+ */
+ HRESULT GetMethodByVersion([in] mdMethodDef token,
+ [in] int version,
+ [out, retval] ISymUnmanagedMethod** pRetVal);
+
+ /*
+ * Return a non-local variable given its parent and name.
+ */
+ HRESULT GetVariables([in] mdToken parent,
+ [in] ULONG32 cVars,
+ [out] ULONG32 *pcVars,
+ [out, size_is(cVars),
+ length_is(*pcVars)] ISymUnmanagedVariable *pVars[]);
+ /*
+ * Return all global variables.
+ */
+ HRESULT GetGlobalVariables([in] ULONG32 cVars,
+ [out] ULONG32 *pcVars,
+ [out, size_is(cVars),
+ length_is(*pcVars)] ISymUnmanagedVariable *pVars[]);
+
+ /*
+ * Given a position in a document, return the ISymUnmanagedMethod that
+ * contains that position.
+ */
+ HRESULT GetMethodFromDocumentPosition([in] ISymUnmanagedDocument* document,
+ [in] ULONG32 line,
+ [in] ULONG32 column,
+ [out, retval] ISymUnmanagedMethod** pRetVal);
+
+ /*
+ * Gets a custom attribute based upon its name. Not to be
+ * confused with Metadata custom attributes, these attributes are
+ * held in the symbol store.
+ */
+ HRESULT GetSymAttribute([in] mdToken parent,
+ [in] WCHAR *name,
+ [in] ULONG32 cBuffer,
+ [out] ULONG32 *pcBuffer,
+ [out, size_is(cBuffer),
+ length_is(*pcBuffer)] BYTE buffer[]);
+
+ /*
+ * Get the namespaces defined at global scope within this symbol store.
+ */
+ HRESULT GetNamespaces([in] ULONG32 cNameSpaces,
+ [out] ULONG32 *pcNameSpaces,
+ [out, size_is(cNameSpaces),
+ length_is(*pcNameSpaces)]
+ ISymUnmanagedNamespace* namespaces[]);
+
+ /*
+ * Initialize the symbol reader with the metadata importer interface
+ * that this reader will be associated with, along with the filename
+ * of the module. This can only be called once, and must be called
+ * before any other reader methods are called.
+ *
+ * Note: you need only specify one of the filename or the pIStream,
+ * not both. The searchPath parameter is optional.
+ */
+ HRESULT Initialize([in] IUnknown *importer,
+ [in] const WCHAR *filename,
+ [in] const WCHAR *searchPath,
+ [in] IStream *pIStream);
+
+ /*
+ * Update the existing symbol reader with a delta symbol store. This
+ * is used in EnC scenarios as a way to update the symbol store to
+ * match deltas to the original PE file.
+ *
+ * Only one of the filename or pIStream parameters need be specified.
+ * If a filename is specified, the symbol store will be updated with
+ * the symbols in that file. If a IStream is specified, the store will
+ * be updated with the data from the IStream.
+ */
+ HRESULT UpdateSymbolStore([in] const WCHAR *filename,
+ [in] IStream *pIStream);
+
+ /*
+ * Update the existing symbol reader with a delta symbol
+ * store. This is much like UpdateSymbolStore, but the given detla
+ * acts as a complete replacement rather than an update.
+ *
+ * Only one of the filename or pIStream parameters need be specified.
+ * If a filename is specified, the symbol store will be updated with
+ * the symbols in that file. If a IStream is specified, the store will
+ * be updated with the data from the IStream.
+ */
+ HRESULT ReplaceSymbolStore([in] const WCHAR *filename,
+ [in] IStream *pIStream);
+
+ /*
+ * Provides the on disk filename of the symbol store.
+ */
+
+ HRESULT GetSymbolStoreFileName( [in] ULONG32 cchName,
+ [out] ULONG32 *pcchName,
+ [out, size_is(cchName),
+ length_is(*pcchName)] WCHAR szName[]);
+
+ /*
+ * Given a position in a document, return the ISymUnmanagedMethods that
+ * contains that position.
+ */
+ HRESULT GetMethodsFromDocumentPosition([in] ISymUnmanagedDocument* document,
+ [in] ULONG32 line,
+ [in] ULONG32 column,
+ [in] ULONG32 cMethod,
+ [out] ULONG32* pcMethod,
+ [out, size_is(cMethod),
+ length_is(*pcMethod)] ISymUnmanagedMethod* pRetVal[]);
+
+ /*
+ * Get the given version of the given document.
+ * The document version starts at 1 and is incremented each time
+ * the document is updated via UpdateSymbols.
+ * bCurrent is true is this is the latest version of the document.
+ */
+ HRESULT GetDocumentVersion([in] ISymUnmanagedDocument *pDoc,
+ [out] int* version,
+ [out] BOOL* pbCurrent);
+
+ /*
+ * The method version starts at 1 and is incremented each time
+ * the method is recompiled. (This can happen without changes to the method.)
+ */
+ HRESULT GetMethodVersion([in] ISymUnmanagedMethod* pMethod,
+ [out] int* version);
+
+};
+
+//
+// ISymUnmanagedSourceServerModule
+//
+// QI for this interface from an ISymUnmanagedReader
+[
+ object,
+ uuid(997DD0CC-A76F-4c82-8D79-EA87559D27AD),
+ pointer_default(unique)
+]
+interface ISymUnmanagedSourceServerModule : IUnknown
+{
+ // returns the source server data for the module
+ // caller must free using CoTaskMemFree()
+ HRESULT GetSourceServerData(
+ [out] ULONG* pDataByteCount,
+ [out, size_is (, *pDataByteCount)] BYTE** ppData);
+
+}
+
+// QI for this interface from an ISymUnmanagedReader
+[
+ object,
+ uuid(E502D2DD-8671-4338-8F2A-FC08229628C4),
+ pointer_default(unique)
+]
+interface ISymUnmanagedENCUpdate : IUnknown
+{
+
+ // UpdateSymbolStore2:
+
+ // Line deltas allow a compiler to omit functions that have not been modified from
+ // the pdb stream provided the line information meets the following condition.
+ // The correct line information can be determined with the old pdb line info and
+ // one delta for all lines in the function.
+ //
+
+ typedef struct _SYMLINEDELTA
+ {
+ mdMethodDef mdMethod;
+ INT32 delta;
+ } SYMLINEDELTA;
+
+ HRESULT UpdateSymbolStore2([in] IStream *pIStream,
+ [in] SYMLINEDELTA* pDeltaLines,
+ [in] ULONG cDeltaLines);
+
+ HRESULT GetLocalVariableCount([in] mdMethodDef mdMethodToken,
+ [out] ULONG *pcLocals);
+
+ HRESULT GetLocalVariables([in] mdMethodDef mdMethodToken,
+ [in] ULONG cLocals,
+ [out, size_is(cLocals),
+ length_is(*pceltFetched)] ISymUnmanagedVariable *rgLocals[],
+ [out] ULONG *pceltFetched);
+
+ // Perf: Allow method boundaries to be computed before the first
+ // UpdateSymbolStore2.
+ HRESULT InitializeForEnc();
+
+ //
+ // This allows updating the line info for a method that has not been recompiled,
+ // but whose lines have moved independently. A delta for each statement is allowed.
+ //
+ HRESULT UpdateMethodLines([in] mdMethodDef mdMethodToken,
+ [in, size_is(cDeltas)] INT32* pDeltas,
+ [in] ULONG cDeltas);
+};
+
+/* ------------------------------------------------------------------------- *
+ * ISymUnmanagedReaderSymbolSearchInfo interface
+ * ------------------------------------------------------------------------- */
+
+// QI for this interface from an ISymUnmanagedReader
+[
+ object,
+ uuid(20D9645D-03CD-4e34-9C11-9848A5B084F1),
+ pointer_default(unique)
+]
+interface ISymUnmanagedReaderSymbolSearchInfo : IUnknown
+{
+ HRESULT GetSymbolSearchInfoCount([out] ULONG32 *pcSearchInfo);
+
+ HRESULT GetSymbolSearchInfo([in] ULONG32 cSearchInfo,
+ [out] ULONG32 *pcSearchInfo,
+ [out, size_is(cSearchInfo),
+ length_is(*pcSearchInfo)] ISymUnmanagedSymbolSearchInfo **rgpSearchInfo);
+};
+
+/* ------------------------------------------------------------------------- *
+ * ISymUnmanagedScope interface
+ *
+ * Represents a lexical scope within a method.
+ * ------------------------------------------------------------------------- */
+
+[
+ object,
+ uuid(68005D0F-B8E0-3B01-84D5-A11A94154942),
+ pointer_default(unique)
+]
+interface ISymUnmanagedScope : IUnknown
+{
+ /*
+ * Get the method that contains this scope.
+ */
+ HRESULT GetMethod([out, retval] ISymUnmanagedMethod** pRetVal);
+
+ /*
+ * Get the parent scope of this scope.
+ */
+ HRESULT GetParent([out, retval] ISymUnmanagedScope** pRetVal);
+
+ /*
+ * Get the children of this scope.
+ */
+ HRESULT GetChildren([in] ULONG32 cChildren,
+ [out] ULONG32 *pcChildren,
+ [out, size_is(cChildren),
+ length_is(*pcChildren)] ISymUnmanagedScope* children[]);
+
+ /*
+ * Get the start offset for this scope,
+ */
+ HRESULT GetStartOffset([out, retval] ULONG32* pRetVal);
+
+ /*
+ * Get the end offset for this scope.
+ */
+ HRESULT GetEndOffset([out, retval] ULONG32* pRetVal);
+
+ /*
+ * Get a count of the number of local variables defined within this
+ * scope.
+ */
+ HRESULT GetLocalCount([out, retval] ULONG32 *pRetVal);
+
+ /*
+ * Get the local variables defined within this scope.
+ */
+ HRESULT GetLocals([in] ULONG32 cLocals,
+ [out] ULONG32 *pcLocals,
+ [out, size_is(cLocals),
+ length_is(*pcLocals)] ISymUnmanagedVariable* locals[]);
+
+ /*
+ * Get the namespaces that are being "used" within this scope.
+ */
+ HRESULT GetNamespaces([in] ULONG32 cNameSpaces,
+ [out] ULONG32 *pcNameSpaces,
+ [out, size_is(cNameSpaces),
+ length_is(*pcNameSpaces)]
+ ISymUnmanagedNamespace* namespaces[]);
+};
+
+[
+ object,
+ uuid(48B25ED8-5BAD-41bc-9CEE-CD62FABC74E9),
+ pointer_default(unique)
+]
+interface ISymUnmanagedConstant : IUnknown
+{
+ /*
+ * Get the name of this constant.
+ */
+ HRESULT GetName([in] ULONG32 cchName,
+ [out] ULONG32 *pcchName,
+ [out, size_is(cchName),
+ length_is(*pcchName)] WCHAR szName[]);
+
+ HRESULT GetValue(VARIANT* pValue);
+
+ HRESULT GetSignature([in] ULONG32 cSig,
+ [out] ULONG32 *pcSig,
+ [out, size_is(cSig),
+ length_is(*pcSig)] BYTE sig[]);
+
+};
+
+/*
+ * QI for this interface from an ISymUnmanagedScope.
+ */
+[
+ object,
+ uuid(AE932FBA-3FD8-4dba-8232-30A2309B02DB),
+ pointer_default(unique)
+]
+interface ISymUnmanagedScope2 : ISymUnmanagedScope
+{
+ /*
+ * Get a count of the number of constants defined within this
+ * scope.
+ */
+ HRESULT GetConstantCount([out, retval] ULONG32 *pRetVal);
+ /*
+ * Get the local constants defined within this scope.
+ */
+ HRESULT GetConstants([in] ULONG32 cConstants,
+ [out] ULONG32 *pcConstants,
+ [out, size_is(cConstants),
+ length_is(*pcConstants)] ISymUnmanagedConstant* constants[]);
+};
+
+/* ------------------------------------------------------------------------- *
+ * ISymUnmanagedVariable interface
+ *
+ * Represents a variable--a parameter, a local variable, or a field.
+ * ------------------------------------------------------------------------- */
+
+[
+ object,
+ uuid(9F60EEBE-2D9A-3F7C-BF58-80BC991C60BB),
+ pointer_default(unique)
+]
+interface ISymUnmanagedVariable : IUnknown
+{
+ /*
+ * Get the name of this variable.
+ */
+ HRESULT GetName([in] ULONG32 cchName,
+ [out] ULONG32 *pcchName,
+ [out, size_is(cchName),
+ length_is(*pcchName)] WCHAR szName[]);
+
+ /*
+ * Get the attribute flags for this variable.
+ */
+ HRESULT GetAttributes([out, retval] ULONG32* pRetVal);
+
+ /*
+ * Get the signature of this variable.
+ */
+ HRESULT GetSignature([in] ULONG32 cSig,
+ [out] ULONG32 *pcSig,
+ [out, size_is(cSig),
+ length_is(*pcSig)] BYTE sig[]);
+
+ /*
+ * Get the kind of address of this variable
+ * The retval will be one of the CorSymAddrKind constants.
+ */
+ HRESULT GetAddressKind([out, retval] ULONG32* pRetVal);
+
+ /*
+ * Get the first address field for this variable. Its meaning depends
+ * on the address kind.
+ */
+ HRESULT GetAddressField1([out, retval] ULONG32* pRetVal);
+
+ /*
+ * Get the second address field for this variable. Its meaning depends
+ * on the address kind.
+ */
+ HRESULT GetAddressField2([out, retval] ULONG32* pRetVal);
+
+ /*
+ * Get the third address field for this variable. Its meaning depends
+ * on the address kind.
+ */
+ HRESULT GetAddressField3([out, retval] ULONG32* pRetVal);
+
+ /*
+ * Get the start offset of this variable within its parent. If this is
+ * a local variable within a scope, this will fall within the offsets
+ * defined for the scope.
+ */
+ HRESULT GetStartOffset([out, retval] ULONG32* pRetVal);
+
+ /*
+ * Get the end offset of this variable within its parent. If this is
+ * a local variable within a scope, this will fall within the offsets
+ * defined for the scope.
+ */
+ HRESULT GetEndOffset([out, retval] ULONG32* pRetVal);
+};
+
+/* ------------------------------------------------------------------------- *
+ * ISymUnmanagedSymbolSearchInfo interface
+ * ------------------------------------------------------------------------- */
+
+[
+ object,
+ uuid(F8B3534A-A46B-4980-B520-BEC4ACEABA8F),
+ pointer_default(unique)
+]
+interface ISymUnmanagedSymbolSearchInfo : IUnknown
+{
+ HRESULT GetSearchPathLength([out] ULONG32 *pcchPath);
+
+ HRESULT GetSearchPath([in] ULONG32 cchPath,
+ [out] ULONG32 *pcchPath,
+ [out, size_is(cchPath),
+ length_is(*pcchPath)] WCHAR szPath[]);
+
+ HRESULT GetHRESULT([out] HRESULT *phr);
+};
+
+/* ------------------------------------------------------------------------- *
+ * ISymUnmanagedWriter interface
+ *
+ * Represents a symbol writer. Provides methods to define documents,
+ * sequence points, lexical scopes, and variables.
+ * ------------------------------------------------------------------------- */
+
+[
+ object,
+ uuid(ED14AA72-78E2-4884-84E2-334293AE5214),
+ pointer_default(unique)
+]
+interface ISymUnmanagedWriter : IUnknown
+{
+ /*
+ * Define a source document. Guid's will be provided for languages,
+ * vendors, and document types that we currently know about.
+ */
+ HRESULT DefineDocument([in] const WCHAR *url,
+ [in] const GUID *language,
+ [in] const GUID *languageVendor,
+ [in] const GUID *documentType,
+ [out, retval] ISymUnmanagedDocumentWriter** pRetVal);
+
+ /*
+ * Define the method that the user has defined as their entry point
+ * for this module. This would be, perhaps, the user's main method
+ * rather than compiler generated stubs before main.
+ */
+ HRESULT SetUserEntryPoint([in] mdMethodDef entryMethod);
+
+ /*
+ * Open a method to emit symbol information into. The given method
+ * becomes the current method for calls do define sequence points,
+ * parameters and lexical scopes. There is an implicit lexical
+ * scope around the entire method. Re-opening a method that has
+ * been previously closed effectivley erases any previously
+ * defined symbols for that method.
+ *
+ * There can be only one open method at a time.
+ */
+ HRESULT OpenMethod([in] mdMethodDef method);
+
+ /*
+ * Close the current method. Once a method is closed, no more
+ * symbols can be defined within it.
+ */
+ HRESULT CloseMethod();
+
+ /*
+ * Open a new lexical scope in the current method. The scope
+ * becomes the new current scope and is effectivley pushed onto a
+ * stack of scopes. startOffset is the offset, in bytes from the
+ * beginning of the method, of the first instruction in the
+ * lexical scope. Scopes must form a hierarchy. Siblings are not
+ * allowed to overlap.
+ *
+ * OpenScope returns an opaque scope id that can be used with
+ * SetScopeRange to define a scope's start/end offset at a later
+ * time. In this case, the offsets passed to OpenScope and
+ * CloseScope are ignored.
+ *
+ * Note: scope id's are only valid in the current method.
+ */
+ HRESULT OpenScope([in] ULONG32 startOffset,
+ [out, retval] ULONG32* pRetVal);
+
+ /*
+ * Close the current lexical scope. Once a scope is closed no more
+ * variables can be defined within it. endOffset points past the
+ * last instruction in the scope.
+ */
+ HRESULT CloseScope([in] ULONG32 endOffset);
+
+ /*
+ * Define the offset range for a given lexical scope.
+ */
+ HRESULT SetScopeRange([in] ULONG32 scopeID,
+ [in] ULONG32 startOffset,
+ [in] ULONG32 endOffset);
+
+ /*
+ * Define a single variable in the current lexical
+ * scope. startOffset and endOffset are optional. If 0, then they
+ * are ignored and the variable is defined over the entire
+ * scope. If non-zero, then they must fall within the offsets of
+ * the current scope. This can be called multiple times for a
+ * variable of the same name that has multiple homes throughout a
+ * scope. (Note: start/end offsets must not overlap in such a
+ * case.)
+ */
+ HRESULT DefineLocalVariable([in] const WCHAR *name,
+ [in] ULONG32 attributes,
+ [in] ULONG32 cSig,
+ [in, size_is(cSig)] unsigned char signature[],
+ [in] ULONG32 addrKind,
+ [in] ULONG32 addr1,
+ [in] ULONG32 addr2,
+ [in] ULONG32 addr3,
+ [in] ULONG32 startOffset,
+ [in] ULONG32 endOffset);
+
+ /*
+ * Define a single parameter in the current method. The type of
+ * each parameter is taken from its position (sequence) within the
+ * method's signature.
+ *
+ * Note: if parameters are defined in the metadata for a given
+ * method, then clearly one would not have to define them again
+ * with calls to this method. The symbol readers will have to be
+ * smart enough to check the normal metadata for these first then
+ * fall back to the symbol store.
+ */
+ HRESULT DefineParameter([in] const WCHAR *name,
+ [in] ULONG32 attributes,
+ [in] ULONG32 sequence,
+ [in] ULONG32 addrKind,
+ [in] ULONG32 addr1,
+ [in] ULONG32 addr2,
+ [in] ULONG32 addr3);
+
+ /*
+ * Define a single variable not within a method. This is used for
+ * certian fields in classes, bitfields, etc.
+ */
+ HRESULT DefineField([in] mdTypeDef parent,
+ [in] const WCHAR *name,
+ [in] ULONG32 attributes,
+ [in] ULONG32 cSig,
+ [in, size_is(cSig)] unsigned char signature[],
+ [in] ULONG32 addrKind,
+ [in] ULONG32 addr1,
+ [in] ULONG32 addr2,
+ [in] ULONG32 addr3);
+
+ /*
+ * Define a single global variable.
+ */
+ HRESULT DefineGlobalVariable([in] const WCHAR *name,
+ [in] ULONG32 attributes,
+ [in] ULONG32 cSig,
+ [in, size_is(cSig)] unsigned char signature[],
+ [in] ULONG32 addrKind,
+ [in] ULONG32 addr1,
+ [in] ULONG32 addr2,
+ [in] ULONG32 addr3);
+
+ /*
+ * Close will close the ISymUnmanagedWriter and commit the symbols
+ * to the symbol store. The ISymUnmanagedWriter becomes invalid
+ * after this call for further updates.
+ */
+ HRESULT Close();
+
+ /*
+ * Defines a custom attribute based upon its name. Not to be
+ * confused with Metadata custom attributes, these attributes are
+ * held in the symbol store.
+ */
+ HRESULT SetSymAttribute([in] mdToken parent,
+ [in] const WCHAR *name,
+ [in] ULONG32 cData,
+ [in, size_is(cData)] unsigned char data[]);
+
+ /*
+ * Opens a new namespace. Call this before defining methods or
+ * variables that live within a namespace. Namespaces can be nested.
+ */
+ HRESULT OpenNamespace([in] const WCHAR *name);
+
+ /*
+ * Close the most recently opened namespace.
+ */
+ HRESULT CloseNamespace();
+
+ /*
+ * Specifies that the given, fully qualified namespace name is
+ * being used within the currently open lexical scope. Closing the
+ * current scope will also stop using the namespace, and the
+ * namespace will be in use in all scopes that inherit from the
+ * currently open scope.
+ */
+ HRESULT UsingNamespace([in] const WCHAR *fullName);
+
+ /*
+ * Specifies the true start and end of a method within a source
+ * file. Use this to specify the extent of a method independently
+ * of what sequence points exist within the method.
+ */
+ HRESULT SetMethodSourceRange([in] ISymUnmanagedDocumentWriter *startDoc,
+ [in] ULONG32 startLine,
+ [in] ULONG32 startColumn,
+ [in] ISymUnmanagedDocumentWriter *endDoc,
+ [in] ULONG32 endLine,
+ [in] ULONG32 endColumn);
+
+ /*
+ * Sets the metadata emitter interface that this writer will be
+ * associated with. Also sets the output filename of where the
+ * debugging symbols will be written. This can only be called once,
+ * and must be called before any other writer methods are called.
+ *
+ * Some writers may require a filename, while others may not. A
+ * filename can always be passed to this method, however, with
+ * no ill effects on writers that do not use it.
+ *
+ * The pIStream parameter is optional. If specified, the symbol
+ * writer will emit the symbols into the given IStream rather than
+ * to the file specified in filename.
+ *
+ * The fFullBuild parameter indicates to the symbol writer whether
+ * this is a full build or an incremental build.
+ */
+ HRESULT Initialize([in] IUnknown *emitter,
+ [in] const WCHAR *filename,
+ [in] IStream *pIStream,
+ [in] BOOL fFullBuild);
+
+ /*
+ * Returns the necessary info for a compiler to write the
+ * necessary debug directory entry into the PE header.
+ *
+ * pIDD should point to a IMAGE_DEBUG_DIRECTORY that the symbol
+ * writer will fill out. All fields except for TimeDateStamp and
+ * PointerToRawData will be filled out by the symbol writer. (The
+ * compiler is responsible for setting TimeDateStamp and
+ * PointerToRawData appropiatley.)
+ *
+ * data should point to a buffer large enough to hold the debug
+ * data for the symbol store.
+ *
+ * A compiler should call this method, then emit the data blob to
+ * the PE file and set the PointerToRawData field in the
+ * IMAGE_DEBUG_DIRECTORY to point to the emitted data. Then, the
+ * IMAGE_DEBUG_DIRECTORY should be written to the PE file. The
+ * compiler should also set the TimeDateStamp field to equal the
+ * TimeDateStamp of the PE file being generated.
+ */
+ HRESULT GetDebugInfo([in, out] IMAGE_DEBUG_DIRECTORY *pIDD,
+ [in] DWORD cData,
+ [out] DWORD *pcData,
+ [out, size_is(cData),
+ length_is(*pcData)] BYTE data[]);
+
+ /*
+ * Define a group of sequence points within the current method.
+ * Each line/column defines the start of a statement within a
+ * method. Each end line/column defines the end of a statement
+ * with a method. (End line/column is optional.) The arrays should
+ * be sorted by offset. The offset is always the offset from the
+ * start of the method, in bytes.
+ */
+ HRESULT DefineSequencePoints([in] ISymUnmanagedDocumentWriter* document,
+ [in] ULONG32 spCount,
+ [in, size_is(spCount)] ULONG32 offsets[],
+ [in, size_is(spCount)] ULONG32 lines[],
+ [in, size_is(spCount)] ULONG32 columns[],
+ [in, size_is(spCount)] ULONG32 endLines[],
+ [in, size_is(spCount)] ULONG32 endColumns[]);
+
+ /*
+ * This method tells the symbol writer that a metadata token has
+ * been remapped as the metadata was emitted. If the symbol writer
+ * has stored the old token within the symbol store, it must
+ * either update the stored token to the new value, or persist the
+ * map for the corresponding symbol reader to remap during the
+ * read phase.
+ */
+ HRESULT RemapToken([in] mdToken oldToken,
+ [in] mdToken newToken);
+
+ /*
+ * Same as Initialize except that the final path name is the path string to
+ * name the final location of the pdb file. This is used in build enviroments in
+ * which the pdb is built in a temporary location and moved when the build is
+ * complete.
+ */
+ HRESULT Initialize2([in] IUnknown *emitter,
+ [in] const WCHAR *tempfilename,
+ [in] IStream *pIStream,
+ [in] BOOL fFullBuild,
+ [in] const WCHAR *finalfilename);
+
+ /*
+ * Defines a name for a constant value.
+ */
+ HRESULT DefineConstant( [in] const WCHAR *name,
+ [in] VARIANT value,
+ [in] ULONG32 cSig,
+ [in, size_is(cSig)] unsigned char signature[]);
+
+ /*
+ * Abort will close the ISymUnmanagedWriter without committing the symbols
+ * to the symbol store. The ISymUnmanagedWriter becomes invalid
+ * after this call for further updates.
+ */
+ HRESULT Abort();
+
+};
+
+/* ------------------------------------------------------------------------- *
+ * ISymUnmanagedWriter2 interface
+ * ------------------------------------------------------------------------- */
+
+[
+ object,
+ uuid(0B97726E-9E6D-4f05-9A26-424022093CAA),
+ pointer_default(unique)
+]
+interface ISymUnmanagedWriter2 : ISymUnmanagedWriter
+{
+ /*
+ * Define a single variable in the current lexical
+ * scope. startOffset and endOffset are optional. If 0, then they
+ * are ignored and the variable is defined over the entire
+ * scope. If non-zero, then they must fall within the offsets of
+ * the current scope. This can be called multiple times for a
+ * variable of the same name that has multiple homes throughout a
+ * scope. (Note: start/end offsets must not overlap in such a
+ * case.)
+ */
+ HRESULT DefineLocalVariable2([in] const WCHAR *name,
+ [in] ULONG32 attributes,
+ [in] mdSignature sigToken,
+ [in] ULONG32 addrKind,
+ [in] ULONG32 addr1,
+ [in] ULONG32 addr2,
+ [in] ULONG32 addr3,
+ [in] ULONG32 startOffset,
+ [in] ULONG32 endOffset);
+
+ /*
+ * Define a single global variable.
+ */
+ HRESULT DefineGlobalVariable2([in] const WCHAR *name,
+ [in] ULONG32 attributes,
+ [in] mdSignature sigToken,
+ [in] ULONG32 addrKind,
+ [in] ULONG32 addr1,
+ [in] ULONG32 addr2,
+ [in] ULONG32 addr3);
+
+
+ /*
+ * Defines a name for a constant value.
+ */
+ HRESULT DefineConstant2( [in] const WCHAR *name,
+ [in] VARIANT value,
+ [in] mdSignature sigToken);
+
+};
+
+/* ------------------------------------------------------------------------- *
+ * ISymUnmanagedWriter3 interface
+ * ------------------------------------------------------------------------- */
+
+[
+ object,
+ uuid(12F1E02C-1E05-4B0E-9468-EBC9D1BB040F),
+ pointer_default(unique)
+]
+interface ISymUnmanagedWriter3 : ISymUnmanagedWriter2
+{
+ /*
+ * Open a method, and also provide its real section offset in image
+ */
+ HRESULT OpenMethod2( [in] mdMethodDef method,
+ [in] ULONG32 isect,
+ [in] ULONG32 offset);
+
+ /*
+ * Commit the changes written so far to the stream
+ */
+
+ HRESULT Commit();
+};
+
+/* ------------------------------------------------------------------------- *
+ * ISymUnmanagedWriter4 interface
+ * ------------------------------------------------------------------------- */
+
+[
+ object,
+ uuid(BC7E3F53-F458-4C23-9DBD-A189E6E96594),
+ pointer_default(unique)
+]
+interface ISymUnmanagedWriter4 : ISymUnmanagedWriter3
+{
+ /*
+ * Functions the same as ISymUnmanagedWriter::GetDebugInfo with the exception
+ * that the path string is padded with zeros following the terminating null
+ * character to make the string data a fixed size of MAX_PATH. Padding is only
+ * given if the path string length itself is less than MAX_PATH.
+ *
+ * This makes writing tools that difference PE files easier.
+ */
+ HRESULT GetDebugInfoWithPadding([in, out] IMAGE_DEBUG_DIRECTORY *pIDD,
+ [in] DWORD cData,
+ [out] DWORD *pcData,
+ [out, size_is(cData),
+ length_is(*pcData)] BYTE data[]);
+};
+
+/* ------------------------------------------------------------------------- *
+ * ISymUnmanagedWriter5 interface
+ * ------------------------------------------------------------------------- */
+
+[
+ object,
+ uuid(DCF7780D-BDE9-45DF-ACFE-21731A32000C),
+ pointer_default(unique)
+]
+interface ISymUnmanagedWriter5 : ISymUnmanagedWriter4
+{
+ /*
+ * Open a special custom data section to emit token to source span mapping
+ * information into. Opening this section while a method is already open
+ * or vice versa is an error.
+ */
+ HRESULT OpenMapTokensToSourceSpans();
+
+ /*
+ * Close the special custom data section for token to source span mapping
+ * information. Once it is closed no more mapping information can be added.
+ */
+ HRESULT CloseMapTokensToSourceSpans();
+
+ /*
+ * Maps the given metadata token to the given source line span in the specified
+ * source file.
+ *
+ * Must be called between calls to OpenMapTokensToSourceSpans() and
+ * CloseMapTokensToSourceSpans().
+ */
+ HRESULT MapTokenToSourceSpan([in] mdToken token,
+ [in] ISymUnmanagedDocumentWriter* document,
+ [in] ULONG32 line,
+ [in] ULONG32 column,
+ [in] ULONG32 endLine,
+ [in] ULONG32 endColumn);
+};
+
+
+/* ------------------------------------------------------------------------- *
+ * ISymUnmanagedReader interface
+ * ------------------------------------------------------------------------- */
+
+[
+ object,
+ uuid(A09E53B2-2A57-4cca-8F63-B84F7C35D4AA),
+ pointer_default(unique)
+]
+interface ISymUnmanagedReader2 : ISymUnmanagedReader
+{
+ /*
+ * Get a symbol reader method given a method token and an E&C
+ * version number. Version numbers start at 1 and are incremented
+ * each time the method is changed due to an E&C operation.
+ */
+ HRESULT GetMethodByVersionPreRemap([in] mdMethodDef token,
+ [in] int version,
+ [out, retval] ISymUnmanagedMethod** pRetVal);
+ /*
+ * Gets a custom attribute based upon its name. Not to be
+ * confused with Metadata custom attributes, these attributes are
+ * held in the symbol store.
+ */
+ HRESULT GetSymAttributePreRemap([in] mdToken parent,
+ [in] WCHAR *name,
+ [in] ULONG32 cBuffer,
+ [out] ULONG32 *pcBuffer,
+ [out, size_is(cBuffer),
+ length_is(*pcBuffer)] BYTE buffer[]);
+
+ /*
+ * Gets every method that has line information in the provided Document.
+ */
+ HRESULT GetMethodsInDocument([in] ISymUnmanagedDocument *document,
+ [in] ULONG32 cMethod,
+ [out] ULONG32* pcMethod,
+ [out, size_is(cMethod),
+ length_is(*pcMethod)] ISymUnmanagedMethod* pRetVal[]);
+
+};
+
+/* ------------------------------------------------------------------------- *
+ * ISymNGenWriter interface
+ * ------------------------------------------------------------------------- */
+
+[
+ object,
+ uuid(d682fd12-43de-411c-811b-be8404cea126),
+ pointer_default(unique)
+]
+interface ISymNGenWriter : IUnknown
+{
+ /*
+ * Add a new public symbol to the NGEN PDB.
+ */
+ HRESULT AddSymbol([in] BSTR pSymbol,
+ [in] USHORT iSection,
+ [in] ULONGLONG rva);
+
+ /*
+ * Adds a new section to the NGEN PDB.
+ */
+ HRESULT AddSection([in] USHORT iSection,
+ [in] USHORT flags,
+ [in] long offset,
+ [in] long cb);
+};
+
+
+/* ------------------------------------------------------------------------- *
+ * ISymNGenWriter2 interface
+ * ------------------------------------------------------------------------- */
+[
+ object,
+ local,
+ uuid(B029E51B-4C55-4fe2-B993-9F7BC1F10DB4),
+ pointer_default(unique)
+]
+interface ISymNGenWriter2 : ISymNGenWriter
+{
+ HRESULT OpenModW([in] const wchar_t* wszModule,
+ [in] const wchar_t* wszObjFile,
+ [out] BYTE** ppmod);
+
+ HRESULT CloseMod([in] BYTE* pmod);
+
+ HRESULT ModAddSymbols([in] BYTE* pmod, [in] BYTE* pbSym, [in] long cb);
+
+ HRESULT ModAddSecContribEx(
+ [in] BYTE* pmod,
+ [in] USHORT isect,
+ [in] long off,
+ [in] long cb,
+ [in] ULONG dwCharacteristics,
+ [in] DWORD dwDataCrc,
+ [in] DWORD dwRelocCrc);
+
+ HRESULT QueryPDBNameExW(
+ [out, size_is(cchMax)] wchar_t wszPDB[],
+ [in] SIZE_T cchMax);
+};
+
+
+/* ------------------------------------------------------------------------- *
+ * ISymUnmanagedAsyncPropertiesWriter interface
+ *
+ * Allows definition of optional async method information per method symbol.
+ * Must use with an opened method (i.e. between calls to ISymUnmanagedWriter's
+ * OpenMethod and CloseMethod methods).
+ * ------------------------------------------------------------------------- */
+
+[
+ object,
+ uuid(FC073774-1739-4232-BD56-A027294BEC15),
+ pointer_default(unique)
+]
+interface ISymUnmanagedAsyncMethodPropertiesWriter : IUnknown
+{
+ /*
+ * Sets the starting method that initiates the async operation.
+ *
+ * When performing a step-out of an async method, if the caller matches
+ * the kickoff method, we will step out synchronously. Otherwise, an
+ * async step-out will occur.
+ *
+ * This works in C#/VB because there is an initial method stub that
+ * creates the state machine object and starts if off, hence "kickoff"
+ * Still have to determine if this will work with F#.
+ */
+ HRESULT DefineKickoffMethod([in] mdToken kickoffMethod);
+
+ /*
+ * Sets the IL offset for the compiler generated catch handler that wraps
+ * an async method.
+ *
+ * The IL offset of the generated catch is used by the debugger to handle
+ * the catch as though it were non-user code even though it may occur in
+ * a user code method. In particular it is used in response to a
+ * CatchHandlerFound exception event.
+ */
+ HRESULT DefineCatchHandlerILOffset([in] ULONG32 catchHandlerOffset);
+
+ /*
+ * Define a group of async scopes within the current method.
+ *
+ * Each yield offset matches an await's return instruction,
+ * identifying a potential yield. Each breakpointMethod/breakpointOffset
+ * pair tells us where the asynchronous operation will resume
+ * (which may be in a different method).
+ */
+ HRESULT DefineAsyncStepInfo([in] ULONG32 count,
+ [in, size_is(count)] ULONG32 yieldOffsets[],
+ [in, size_is(count)] ULONG32 breakpointOffset[],
+ [in, size_is(count)] mdToken breakpointMethod[]);
+};
+
+/* ------------------------------------------------------------------------- *
+ * ISymUnmanagedAsyncMethod interface
+ *
+ * This interface is the reading complement to
+ * ISymUnmanangedAsyncMethodPropertiesWriter
+ * ------------------------------------------------------------------------- */
+
+[
+ object,
+ uuid(B20D55B3-532E-4906-87E7-25BD5734ABD2),
+ pointer_default(unique)
+]
+interface ISymUnmanagedAsyncMethod : IUnknown
+{
+ /*
+ * Checks if the method has asynch information or not.
+ *
+ * If this method returns FALSE then it is invalid to call any
+ * other methods in this interface. They will all return
+ * E_UNEXPECTED in this case.
+ */
+ HRESULT IsAsyncMethod([out, retval] BOOL* pRetVal);
+
+ /*
+ * See ISymUnmanagedAsyncMethodPropertiesWriter::DefineKickoffMethod
+ */
+ HRESULT GetKickoffMethod([out, retval] mdToken* kickoffMethod);
+
+ /*
+ * See ISymUnmanagedAsyncMethodPropertiesWriter::DefineCatchHandlerILOffset
+ */
+ HRESULT HasCatchHandlerILOffset([out, retval] BOOL* pRetVal);
+
+ /*
+ * See ISymUnmanagedAsyncMethodPropertiesWriter::DefineCatchHandlerILOffset
+ */
+ HRESULT GetCatchHandlerILOffset([out, retval] ULONG32* pRetVal);
+
+ /*
+ * See ISymUnmanagedAsyncMethodPropertiesWriter::DefineAsyncStepInfo
+ */
+ HRESULT GetAsyncStepInfoCount([out, retval] ULONG32* pRetVal);
+
+ /*
+ * See ISymUnmanagedAsyncMethodPropertiesWriter::DefineAsyncStepInfo
+ */
+ HRESULT GetAsyncStepInfo([in] ULONG32 cStepInfo,
+ [out] ULONG32 *pcStepInfo,
+ [in, size_is(cStepInfo)] ULONG32 yieldOffsets[],
+ [in, size_is(cStepInfo)] ULONG32 breakpointOffset[],
+ [in, size_is(cStepInfo)] mdToken breakpointMethod[]);
+};
diff --git a/src/inc/cortpoolhdr.h b/src/inc/cortpoolhdr.h
new file mode 100644
index 0000000000..1db08b121e
--- /dev/null
+++ b/src/inc/cortpoolhdr.h
@@ -0,0 +1,50 @@
+// 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.
+//+------------------------------------------------------------------------
+//
+// Declare DLL entry points for Cor API to threadpool
+//
+//-------------------------------------------------------------------------
+
+#ifdef EXPORTING_THREADPOOL_API
+#define DllExportOrImport extern "C" __declspec (dllexport)
+#else
+#define DllExportOrImport extern "C"
+#endif
+
+typedef VOID (__stdcall *WAITORTIMERCALLBACK)(PVOID, BOOL);
+
+DllExportOrImport BOOL __cdecl CorRegisterWaitForSingleObject(PHANDLE phNewWaitObject,
+ HANDLE hWaitObject,
+ WAITORTIMERCALLBACK Callback,
+ PVOID Context,
+ ULONG timeout,
+ BOOL executeOnlyOnce );
+
+
+
+DllExportOrImport BOOL __cdecl CorUnregisterWait(HANDLE hWaitObject,HANDLE CompletionEvent);
+
+DllExportOrImport BOOL __cdecl CorQueueUserWorkItem(LPTHREAD_START_ROUTINE Function,
+ PVOID Context,
+ BOOL executeOnlyOnce );
+
+
+DllExportOrImport BOOL __cdecl CorCreateTimer(PHANDLE phNewTimer,
+ WAITORTIMERCALLBACK Callback,
+ PVOID Parameter,
+ DWORD DueTime,
+ DWORD Period);
+
+DllExportOrImport BOOL __cdecl CorChangeTimer(HANDLE Timer,
+ ULONG DueTime,
+ ULONG Period);
+
+DllExportOrImport BOOL __cdecl CorDeleteTimer(HANDLE Timer,
+ HANDLE CompletionEvent);
+
+DllExportOrImport VOID __cdecl CorBindIoCompletionCallback(HANDLE fileHandle, LPOVERLAPPED_COMPLETION_ROUTINE callback);
+
+
+DllExportOrImport VOID __cdecl CorDoDelegateInvocation(int cookie);
diff --git a/src/inc/cortypeinfo.h b/src/inc/cortypeinfo.h
new file mode 100644
index 0000000000..ee75b8f48b
--- /dev/null
+++ b/src/inc/cortypeinfo.h
@@ -0,0 +1,49 @@
+// 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.
+
+// This describes information about the COM+ primitive types
+
+#define NO_SIZE ((BYTE)-1)
+
+// TYPEINFO(type (CorElementType), namespace, class, size, gcType, isArray,isPrim, isFloat,isModifier,isGenVariable)
+
+TYPEINFO(ELEMENT_TYPE_END, NULL, NULL, NO_SIZE, TYPE_GC_NONE, false, false, false, false, false) // 0x00
+TYPEINFO(ELEMENT_TYPE_VOID, "System", "Void", 0, TYPE_GC_NONE, false, true, false, false, false) // 0x01
+TYPEINFO(ELEMENT_TYPE_BOOLEAN, "System", "Boolean", 1, TYPE_GC_NONE, false, true, false, false, false) // 0x02
+TYPEINFO(ELEMENT_TYPE_CHAR, "System", "Char", 2, TYPE_GC_NONE, false, true, false, false, false) // 0x03
+TYPEINFO(ELEMENT_TYPE_I1, "System", "SByte", 1, TYPE_GC_NONE, false, true, false, false, false) // 0x04
+TYPEINFO(ELEMENT_TYPE_U1, "System", "Byte", 1, TYPE_GC_NONE, false, true, false, false, false) // 0x05
+TYPEINFO(ELEMENT_TYPE_I2, "System", "Int16", 2, TYPE_GC_NONE, false, true, false, false, false) // 0x06
+TYPEINFO(ELEMENT_TYPE_U2, "System", "UInt16", 2, TYPE_GC_NONE, false, true, false, false, false) // 0x07
+TYPEINFO(ELEMENT_TYPE_I4, "System", "Int32", 4, TYPE_GC_NONE, false, true, false, false, false) // 0x08
+TYPEINFO(ELEMENT_TYPE_U4, "System", "UInt32", 4, TYPE_GC_NONE, false, true, false, false, false) // 0x09
+TYPEINFO(ELEMENT_TYPE_I8, "System", "Int64", 8, TYPE_GC_NONE, false, true, false, false, false) // 0x0a
+TYPEINFO(ELEMENT_TYPE_U8, "System", "UInt64", 8, TYPE_GC_NONE, false, true, false, false, false) // 0x0b
+
+TYPEINFO(ELEMENT_TYPE_R4, "System", "Single", 4, TYPE_GC_NONE, false, true, true, false, false) // 0x0c
+TYPEINFO(ELEMENT_TYPE_R8, "System", "Double", 8, TYPE_GC_NONE, false, true, true, false, false) // 0x0d
+
+TYPEINFO(ELEMENT_TYPE_STRING, "System", "String", sizeof(void*), TYPE_GC_REF, false, false, false, false, false) // 0x0e
+TYPEINFO(ELEMENT_TYPE_PTR, NULL, NULL, sizeof(void*), TYPE_GC_NONE, false, false, false, true, false) // 0x0f
+TYPEINFO(ELEMENT_TYPE_BYREF, NULL, NULL, sizeof(void*), TYPE_GC_BYREF, false, false, false, true, false) // 0x10
+TYPEINFO(ELEMENT_TYPE_VALUETYPE, NULL, NULL, NO_SIZE, TYPE_GC_OTHER, false, false, false, false, false) // 0x11
+TYPEINFO(ELEMENT_TYPE_CLASS, NULL, NULL, sizeof(void*), TYPE_GC_REF, false, false, false, false, false) // 0x12
+TYPEINFO(ELEMENT_TYPE_VAR, NULL, NULL, sizeof(void*), TYPE_GC_OTHER, false, false, false, false, true) // 0x13
+TYPEINFO(ELEMENT_TYPE_ARRAY, NULL, NULL, sizeof(void*), TYPE_GC_REF, true, false, false, true, false) // 0x14
+
+TYPEINFO(ELEMENT_TYPE_GENERICINST, NULL, NULL, sizeof(void*), TYPE_GC_OTHER, false, false, false, false, false) // 0x15
+TYPEINFO(ELEMENT_TYPE_TYPEDBYREF, "System", "TypedReference",2*sizeof(void*),TYPE_GC_BYREF, false, false, false, false, false) // 0x16
+TYPEINFO(ELEMENT_TYPE_VALUEARRAY_UNSUPPORTED, NULL,NULL, NO_SIZE, TYPE_GC_NONE, false, false, false, false, false) // 0x17 (unsupported, not in the ECMA spec)
+
+TYPEINFO(ELEMENT_TYPE_I, "System", "IntPtr", sizeof(void*), TYPE_GC_NONE, false, true, false, false, false) // 0x18
+TYPEINFO(ELEMENT_TYPE_U, "System", "UIntPtr", sizeof(void*), TYPE_GC_NONE, false, true, false, false, false) // 0x19
+TYPEINFO(ELEMENT_TYPE_R_UNSUPPORTED,NULL, NULL, NO_SIZE, TYPE_GC_NONE, false, false, false, false, false) // 0x1a (unsupported, not in the ECMA spec)
+
+TYPEINFO(ELEMENT_TYPE_FNPTR, NULL, NULL, sizeof(void*), TYPE_GC_NONE, false, false, false, false, false) // 0x1b
+TYPEINFO(ELEMENT_TYPE_OBJECT, "System", "Object", sizeof(void*), TYPE_GC_REF, false, false, false, false, false) // 0x1c
+TYPEINFO(ELEMENT_TYPE_SZARRAY, NULL, NULL, sizeof(void*), TYPE_GC_REF, true, false, false, true, false) // 0x1d
+TYPEINFO(ELEMENT_TYPE_MVAR, NULL, NULL, sizeof(void*), TYPE_GC_OTHER, false, false, false, false, true) // x01e
+TYPEINFO(ELEMENT_TYPE_CMOD_REQD, NULL, NULL, 0, TYPE_GC_NONE, false, false, false, false, false) // 0x1f
+TYPEINFO(ELEMENT_TYPE_CMOD_OPT, NULL, NULL, 0, TYPE_GC_NONE, false, false, false, false, false) // 0x20
+TYPEINFO(ELEMENT_TYPE_INTERNAL, NULL, NULL, 0, TYPE_GC_OTHER, false, false, false, false, false) // 0x21
diff --git a/src/inc/crosscomp.h b/src/inc/crosscomp.h
new file mode 100644
index 0000000000..3d54166331
--- /dev/null
+++ b/src/inc/crosscomp.h
@@ -0,0 +1,363 @@
+// 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.
+//
+// crosscomp.h - cross-compilation enablement structures.
+//
+
+
+#pragma once
+
+#if defined(_X86_) && defined(_TARGET_ARM_) // Host X86 managing ARM related code
+
+#ifndef CROSS_COMPILE
+#define CROSS_COMPILE
+#endif
+
+#define ARM_MAX_BREAKPOINTS 8
+#define ARM_MAX_WATCHPOINTS 1
+
+#define CONTEXT_UNWOUND_TO_CALL 0x20000000
+
+typedef struct _NEON128 {
+ ULONGLONG Low;
+ LONGLONG High;
+} NEON128, *PNEON128;
+
+typedef struct DECLSPEC_ALIGN(8) _T_CONTEXT {
+ //
+ // Control flags.
+ //
+
+ DWORD ContextFlags;
+
+ //
+ // Integer registers
+ //
+
+ DWORD R0;
+ DWORD R1;
+ DWORD R2;
+ DWORD R3;
+ DWORD R4;
+ DWORD R5;
+ DWORD R6;
+ DWORD R7;
+ DWORD R8;
+ DWORD R9;
+ DWORD R10;
+ DWORD R11;
+ DWORD R12;
+
+ //
+ // Control Registers
+ //
+
+ DWORD Sp;
+ DWORD Lr;
+ DWORD Pc;
+ DWORD Cpsr;
+
+ //
+ // Floating Point/NEON Registers
+ //
+
+ DWORD Fpscr;
+ DWORD Padding;
+ union {
+ NEON128 Q[16];
+ ULONGLONG D[32];
+ DWORD S[32];
+ } DUMMYUNIONNAME;
+
+ //
+ // Debug registers
+ //
+
+ DWORD Bvr[ARM_MAX_BREAKPOINTS];
+ DWORD Bcr[ARM_MAX_BREAKPOINTS];
+ DWORD Wvr[ARM_MAX_WATCHPOINTS];
+ DWORD Wcr[ARM_MAX_WATCHPOINTS];
+
+ DWORD Padding2[2];
+
+} T_CONTEXT, *PT_CONTEXT;
+
+//
+// Define function table entry - a function table entry is generated for
+// each frame function.
+//
+
+typedef struct _RUNTIME_FUNCTION {
+ DWORD BeginAddress;
+ DWORD UnwindData;
+} RUNTIME_FUNCTION, *PRUNTIME_FUNCTION;
+
+//
+// Define unwind history table structure.
+//
+
+#define UNWIND_HISTORY_TABLE_SIZE 12
+
+typedef struct _UNWIND_HISTORY_TABLE_ENTRY {
+ DWORD ImageBase;
+ PRUNTIME_FUNCTION FunctionEntry;
+} UNWIND_HISTORY_TABLE_ENTRY, *PUNWIND_HISTORY_TABLE_ENTRY;
+
+typedef struct _UNWIND_HISTORY_TABLE {
+ DWORD Count;
+ BYTE LocalHint;
+ BYTE GlobalHint;
+ BYTE Search;
+ BYTE Once;
+ DWORD LowAddress;
+ DWORD HighAddress;
+ UNWIND_HISTORY_TABLE_ENTRY Entry[UNWIND_HISTORY_TABLE_SIZE];
+} UNWIND_HISTORY_TABLE, *PUNWIND_HISTORY_TABLE;
+
+
+//
+// Nonvolatile context pointer record.
+//
+
+typedef struct _T_KNONVOLATILE_CONTEXT_POINTERS {
+
+ PDWORD R4;
+ PDWORD R5;
+ PDWORD R6;
+ PDWORD R7;
+ PDWORD R8;
+ PDWORD R9;
+ PDWORD R10;
+ PDWORD R11;
+ PDWORD Lr;
+
+ PULONGLONG D8;
+ PULONGLONG D9;
+ PULONGLONG D10;
+ PULONGLONG D11;
+ PULONGLONG D12;
+ PULONGLONG D13;
+ PULONGLONG D14;
+ PULONGLONG D15;
+
+} T_KNONVOLATILE_CONTEXT_POINTERS, *PT_KNONVOLATILE_CONTEXT_POINTERS;
+
+//
+// Define dynamic function table entry.
+//
+
+typedef
+PRUNTIME_FUNCTION
+(*PGET_RUNTIME_FUNCTION_CALLBACK) (
+ IN DWORD64 ControlPc,
+ IN PVOID Context
+ );
+
+typedef struct _T_DISPATCHER_CONTEXT {
+ ULONG ControlPc;
+ ULONG ImageBase;
+ PRUNTIME_FUNCTION FunctionEntry;
+ ULONG EstablisherFrame;
+ ULONG TargetPc;
+ PT_CONTEXT ContextRecord;
+ PEXCEPTION_ROUTINE LanguageHandler;
+ PVOID HandlerData;
+ PUNWIND_HISTORY_TABLE HistoryTable;
+ ULONG ScopeIndex;
+ BOOLEAN ControlPcIsUnwound;
+ PUCHAR NonVolatileRegisters;
+} T_DISPATCHER_CONTEXT, *PT_DISPATCHER_CONTEXT;
+
+#define T_RUNTIME_FUNCTION RUNTIME_FUNCTION
+#define PT_RUNTIME_FUNCTION PRUNTIME_FUNCTION
+
+#elif defined(_AMD64_) && defined(_TARGET_ARM64_) // Host amd64 managing ARM64 related code
+
+#ifndef CROSS_COMPILE
+#define CROSS_COMPILE
+#endif
+
+//
+// Specify the number of breakpoints and watchpoints that the OS
+// will track. Architecturally, ARM64 supports up to 16. In practice,
+// however, almost no one implements more than 4 of each.
+//
+
+#define ARM64_MAX_BREAKPOINTS 8
+#define ARM64_MAX_WATCHPOINTS 2
+
+#define CONTEXT_UNWOUND_TO_CALL 0x20000000
+
+typedef union _NEON128 {
+ struct {
+ ULONGLONG Low;
+ LONGLONG High;
+ } DUMMYSTRUCTNAME;
+ double D[2];
+ float S[4];
+ WORD H[8];
+ BYTE B[16];
+} NEON128, *PNEON128;
+
+typedef struct DECLSPEC_ALIGN(16) _T_CONTEXT {
+
+ //
+ // Control flags.
+ //
+
+ /* +0x000 */ DWORD ContextFlags;
+
+ //
+ // Integer registers
+ //
+
+ /* +0x004 */ DWORD Cpsr; // NZVF + DAIF + CurrentEL + SPSel
+ /* +0x008 */ union {
+ struct {
+ DWORD64 X0;
+ DWORD64 X1;
+ DWORD64 X2;
+ DWORD64 X3;
+ DWORD64 X4;
+ DWORD64 X5;
+ DWORD64 X6;
+ DWORD64 X7;
+ DWORD64 X8;
+ DWORD64 X9;
+ DWORD64 X10;
+ DWORD64 X11;
+ DWORD64 X12;
+ DWORD64 X13;
+ DWORD64 X14;
+ DWORD64 X15;
+ DWORD64 X16;
+ DWORD64 X17;
+ DWORD64 X18;
+ DWORD64 X19;
+ DWORD64 X20;
+ DWORD64 X21;
+ DWORD64 X22;
+ DWORD64 X23;
+ DWORD64 X24;
+ DWORD64 X25;
+ DWORD64 X26;
+ DWORD64 X27;
+ DWORD64 X28;
+ };
+ DWORD64 X[29];
+ };
+ /* +0x0f0 */ DWORD64 Fp;
+ /* +0x0f8 */ DWORD64 Lr;
+ /* +0x100 */ DWORD64 Sp;
+ /* +0x108 */ DWORD64 Pc;
+
+ //
+ // Floating Point/NEON Registers
+ //
+
+ /* +0x110 */ NEON128 V[32];
+ /* +0x310 */ DWORD Fpcr;
+ /* +0x314 */ DWORD Fpsr;
+
+ //
+ // Debug registers
+ //
+
+ /* +0x318 */ DWORD Bcr[ARM64_MAX_BREAKPOINTS];
+ /* +0x338 */ DWORD64 Bvr[ARM64_MAX_BREAKPOINTS];
+ /* +0x378 */ DWORD Wcr[ARM64_MAX_WATCHPOINTS];
+ /* +0x380 */ DWORD64 Wvr[ARM64_MAX_WATCHPOINTS];
+ /* +0x390 */
+
+} T_CONTEXT, *PT_CONTEXT;
+
+// _IMAGE_ARM64_RUNTIME_FUNCTION_ENTRY (see ExternalAPIs\Win9CoreSystem\inc\winnt.h)
+typedef struct _T_RUNTIME_FUNCTION {
+ DWORD BeginAddress;
+ union {
+ DWORD UnwindData;
+ struct {
+ DWORD Flag : 2;
+ DWORD FunctionLength : 11;
+ DWORD RegF : 3;
+ DWORD RegI : 4;
+ DWORD H : 1;
+ DWORD CR : 2;
+ DWORD FrameSize : 9;
+ } PackedUnwindData;
+ } DUMMYUNIONNAME;
+} T_RUNTIME_FUNCTION, *PT_RUNTIME_FUNCTION;
+
+
+//
+// Define exception dispatch context structure.
+//
+
+typedef struct _T_DISPATCHER_CONTEXT {
+ DWORD64 ControlPc;
+ DWORD64 ImageBase;
+ PT_RUNTIME_FUNCTION FunctionEntry;
+ DWORD64 EstablisherFrame;
+ DWORD64 TargetPc;
+ PCONTEXT ContextRecord;
+ PEXCEPTION_ROUTINE LanguageHandler;
+ PVOID HandlerData;
+ PUNWIND_HISTORY_TABLE HistoryTable;
+ DWORD ScopeIndex;
+ BOOLEAN ControlPcIsUnwound;
+ PBYTE NonVolatileRegisters;
+} T_DISPATCHER_CONTEXT, *PT_DISPATCHER_CONTEXT;
+
+
+
+//
+// Nonvolatile context pointer record.
+//
+
+typedef struct _T_KNONVOLATILE_CONTEXT_POINTERS {
+
+ PDWORD64 X19;
+ PDWORD64 X20;
+ PDWORD64 X21;
+ PDWORD64 X22;
+ PDWORD64 X23;
+ PDWORD64 X24;
+ PDWORD64 X25;
+ PDWORD64 X26;
+ PDWORD64 X27;
+ PDWORD64 X28;
+ PDWORD64 Fp;
+ PDWORD64 Lr;
+
+ PDWORD64 D8;
+ PDWORD64 D9;
+ PDWORD64 D10;
+ PDWORD64 D11;
+ PDWORD64 D12;
+ PDWORD64 D13;
+ PDWORD64 D14;
+ PDWORD64 D15;
+
+} T_KNONVOLATILE_CONTEXT_POINTERS, *PT_KNONVOLATILE_CONTEXT_POINTERS;
+
+#else // !(defined(_X86_) && defined(_TARGET_ARM_)) && !(defined(_AMD64_) && defined(_TARGET_ARM64_))
+
+#define T_CONTEXT CONTEXT
+#define PT_CONTEXT PCONTEXT
+
+#define T_DISPATCHER_CONTEXT DISPATCHER_CONTEXT
+#define PT_DISPATCHER_CONTEXT PDISPATCHER_CONTEXT
+
+#define T_KNONVOLATILE_CONTEXT_POINTERS KNONVOLATILE_CONTEXT_POINTERS
+#define PT_KNONVOLATILE_CONTEXT_POINTERS PKNONVOLATILE_CONTEXT_POINTERS
+
+#define T_RUNTIME_FUNCTION RUNTIME_FUNCTION
+#define PT_RUNTIME_FUNCTION PRUNTIME_FUNCTION
+
+#endif
+
+
+#ifdef CROSSGEN_COMPILE
+void CrossGenNotSupported(const char * message);
+#endif
diff --git a/src/inc/crsttypes.h b/src/inc/crsttypes.h
new file mode 100644
index 0000000000..8c702fa553
--- /dev/null
+++ b/src/inc/crsttypes.h
@@ -0,0 +1,559 @@
+// 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.
+
+#ifndef __CRST_TYPES_INCLUDED
+#define __CRST_TYPES_INCLUDED
+
+// **** THIS IS AN AUTOMATICALLY GENERATED HEADER FILE -- DO NOT EDIT!!! ****
+
+// This file describes the range of Crst types available and their mapping to a numeric level (used by the
+// runtime in debug mode to validate we're deadlock free). To modify these settings edit the
+// file:CrstTypes.def file and run the clr\bin\CrstTypeTool utility to generate a new version of this file.
+
+// Each Crst type is declared as a value in the following CrstType enum.
+enum CrstType
+{
+ CrstAllowedFiles = 0,
+ CrstAppDomainCache = 1,
+ CrstAppDomainHandleTable = 2,
+ CrstArgBasedStubCache = 3,
+ CrstAssemblyDependencyGraph = 4,
+ CrstAssemblyIdentityCache = 5,
+ CrstAssemblyList = 6,
+ CrstAssemblyLoader = 7,
+ CrstAssemblyUsageLog = 8,
+ CrstAvailableClass = 9,
+ CrstAvailableParamTypes = 10,
+ CrstBaseDomain = 11,
+ CrstCCompRC = 12,
+ CrstCer = 13,
+ CrstClassFactInfoHash = 14,
+ CrstClassInit = 15,
+ CrstClrNotification = 16,
+ CrstCLRPrivBinderMaps = 17,
+ CrstCLRPrivBinderMapsAdd = 18,
+ CrstCodeFragmentHeap = 19,
+ CrstCOMWrapperCache = 20,
+ CrstConnectionNameTable = 21,
+ CrstContexts = 22,
+ CrstCoreCLRBinderLog = 23,
+ CrstCrstCLRPrivBinderLocalWinMDPath = 24,
+ CrstCSPCache = 25,
+ CrstDataTest1 = 26,
+ CrstDataTest2 = 27,
+ CrstDbgTransport = 28,
+ CrstDeadlockDetection = 29,
+ CrstDebuggerController = 30,
+ CrstDebuggerFavorLock = 31,
+ CrstDebuggerHeapExecMemLock = 32,
+ CrstDebuggerHeapLock = 33,
+ CrstDebuggerJitInfo = 34,
+ CrstDebuggerMutex = 35,
+ CrstDelegateToFPtrHash = 36,
+ CrstDomainLocalBlock = 37,
+ CrstDynamicIL = 38,
+ CrstDynamicMT = 39,
+ CrstDynLinkZapItems = 40,
+ CrstEtwTypeLogHash = 41,
+ CrstEventStore = 42,
+ CrstException = 43,
+ CrstExecuteManLock = 44,
+ CrstExecuteManRangeLock = 45,
+ CrstFCall = 46,
+ CrstFriendAccessCache = 47,
+ CrstFuncPtrStubs = 48,
+ CrstFusionAppCtx = 49,
+ CrstFusionAssemblyDownload = 50,
+ CrstFusionBindContext = 51,
+ CrstFusionBindResult = 52,
+ CrstFusionClb = 53,
+ CrstFusionClosure = 54,
+ CrstFusionClosureGraph = 55,
+ CrstFusionConfigSettings = 56,
+ CrstFusionDownload = 57,
+ CrstFusionIsoLibInit = 58,
+ CrstFusionLoadContext = 59,
+ CrstFusionLog = 60,
+ CrstFusionNgenIndex = 61,
+ CrstFusionNgenIndexPool = 62,
+ CrstFusionPcyCache = 63,
+ CrstFusionPolicyConfigPool = 64,
+ CrstFusionSingleUse = 65,
+ CrstFusionWarningLog = 66,
+ CrstGCMemoryPressure = 67,
+ CrstGlobalStrLiteralMap = 68,
+ CrstHandleTable = 69,
+ CrstHostAssemblyMap = 70,
+ CrstHostAssemblyMapAdd = 71,
+ CrstIbcProfile = 72,
+ CrstIJWFixupData = 73,
+ CrstIJWHash = 74,
+ CrstILFingerprintCache = 75,
+ CrstILStubGen = 76,
+ CrstInlineTrackingMap = 77,
+ CrstInstMethodHashTable = 78,
+ CrstInterfaceVTableMap = 79,
+ CrstInterop = 80,
+ CrstInteropData = 81,
+ CrstIOThreadpoolWorker = 82,
+ CrstIsJMCMethod = 83,
+ CrstISymUnmanagedReader = 84,
+ CrstJit = 85,
+ CrstJitGenericHandleCache = 86,
+ CrstJitPerf = 87,
+ CrstJumpStubCache = 88,
+ CrstLeafLock = 89,
+ CrstListLock = 90,
+ CrstLoaderAllocator = 91,
+ CrstLoaderAllocatorReferences = 92,
+ CrstLoaderHeap = 93,
+ CrstMda = 94,
+ CrstMetadataTracker = 95,
+ CrstModIntPairList = 96,
+ CrstModule = 97,
+ CrstModuleFixup = 98,
+ CrstModuleLookupTable = 99,
+ CrstMulticoreJitHash = 100,
+ CrstMulticoreJitManager = 101,
+ CrstMUThunkHash = 102,
+ CrstNativeBinderInit = 103,
+ CrstNativeImageCache = 104,
+ CrstNls = 105,
+ CrstObjectList = 106,
+ CrstOnEventManager = 107,
+ CrstPatchEntryPoint = 108,
+ CrstPEFileSecurityManager = 109,
+ CrstPEImage = 110,
+ CrstPEImagePDBStream = 111,
+ CrstPendingTypeLoadEntry = 112,
+ CrstPinHandle = 113,
+ CrstPinnedByrefValidation = 114,
+ CrstProfilerGCRefDataFreeList = 115,
+ CrstProfilingAPIStatus = 116,
+ CrstPublisherCertificate = 117,
+ CrstRCWCache = 118,
+ CrstRCWCleanupList = 119,
+ CrstRCWRefCache = 120,
+ CrstReDacl = 121,
+ CrstReflection = 122,
+ CrstReJITDomainTable = 123,
+ CrstReJITGlobalRequest = 124,
+ CrstReJITSharedDomainTable = 125,
+ CrstRemoting = 126,
+ CrstRetThunkCache = 127,
+ CrstRWLock = 128,
+ CrstSavedExceptionInfo = 129,
+ CrstSaveModuleProfileData = 130,
+ CrstSecurityPolicyCache = 131,
+ CrstSecurityPolicyInit = 132,
+ CrstSecurityStackwalkCache = 133,
+ CrstSharedAssemblyCreate = 134,
+ CrstSharedBaseDomain = 135,
+ CrstSigConvert = 136,
+ CrstSingleUseLock = 137,
+ CrstSpecialStatics = 138,
+ CrstSqmManager = 139,
+ CrstStackSampler = 140,
+ CrstStressLog = 141,
+ CrstStrongName = 142,
+ CrstStubCache = 143,
+ CrstStubDispatchCache = 144,
+ CrstStubUnwindInfoHeapSegments = 145,
+ CrstSyncBlockCache = 146,
+ CrstSyncHashLock = 147,
+ CrstSystemBaseDomain = 148,
+ CrstSystemDomain = 149,
+ CrstSystemDomainDelayedUnloadList = 150,
+ CrstThreadIdDispenser = 151,
+ CrstThreadpoolEventCache = 152,
+ CrstThreadpoolTimerQueue = 153,
+ CrstThreadpoolWaitThreads = 154,
+ CrstThreadpoolWorker = 155,
+ CrstThreadStaticDataHashTable = 156,
+ CrstThreadStore = 157,
+ CrstTPMethodTable = 158,
+ CrstTypeEquivalenceMap = 159,
+ CrstTypeIDMap = 160,
+ CrstUMEntryThunkCache = 161,
+ CrstUMThunkHash = 162,
+ CrstUniqueStack = 163,
+ CrstUnresolvedClassLock = 164,
+ CrstUnwindInfoTableLock = 165,
+ CrstVSDIndirectionCellLock = 166,
+ CrstWinRTFactoryCache = 167,
+ CrstWrapperTemplate = 168,
+ kNumberOfCrstTypes = 169
+};
+
+#endif // __CRST_TYPES_INCLUDED
+
+// Define some debug data in one module only -- vm\crst.cpp.
+#if defined(__IN_CRST_CPP) && defined(_DEBUG)
+
+// An array mapping CrstType to level.
+int g_rgCrstLevelMap[] =
+{
+ 9, // CrstAllowedFiles
+ 9, // CrstAppDomainCache
+ 13, // CrstAppDomainHandleTable
+ 0, // CrstArgBasedStubCache
+ 0, // CrstAssemblyDependencyGraph
+ 0, // CrstAssemblyIdentityCache
+ 0, // CrstAssemblyList
+ 7, // CrstAssemblyLoader
+ 0, // CrstAssemblyUsageLog
+ 3, // CrstAvailableClass
+ 6, // CrstAvailableParamTypes
+ 7, // CrstBaseDomain
+ -1, // CrstCCompRC
+ 9, // CrstCer
+ 11, // CrstClassFactInfoHash
+ 8, // CrstClassInit
+ -1, // CrstClrNotification
+ 0, // CrstCLRPrivBinderMaps
+ 3, // CrstCLRPrivBinderMapsAdd
+ 6, // CrstCodeFragmentHeap
+ 4, // CrstCOMWrapperCache
+ 0, // CrstConnectionNameTable
+ 17, // CrstContexts
+ -1, // CrstCoreCLRBinderLog
+ 0, // CrstCrstCLRPrivBinderLocalWinMDPath
+ 7, // CrstCSPCache
+ 3, // CrstDataTest1
+ 0, // CrstDataTest2
+ 0, // CrstDbgTransport
+ 0, // CrstDeadlockDetection
+ -1, // CrstDebuggerController
+ 3, // CrstDebuggerFavorLock
+ 0, // CrstDebuggerHeapExecMemLock
+ 0, // CrstDebuggerHeapLock
+ 4, // CrstDebuggerJitInfo
+ 11, // CrstDebuggerMutex
+ 0, // CrstDelegateToFPtrHash
+ 15, // CrstDomainLocalBlock
+ 0, // CrstDynamicIL
+ 3, // CrstDynamicMT
+ 3, // CrstDynLinkZapItems
+ 7, // CrstEtwTypeLogHash
+ 0, // CrstEventStore
+ 0, // CrstException
+ 7, // CrstExecuteManLock
+ 0, // CrstExecuteManRangeLock
+ 3, // CrstFCall
+ 7, // CrstFriendAccessCache
+ 7, // CrstFuncPtrStubs
+ 9, // CrstFusionAppCtx
+ 7, // CrstFusionAssemblyDownload
+ 5, // CrstFusionBindContext
+ 0, // CrstFusionBindResult
+ 0, // CrstFusionClb
+ 16, // CrstFusionClosure
+ 10, // CrstFusionClosureGraph
+ 0, // CrstFusionConfigSettings
+ 0, // CrstFusionDownload
+ 0, // CrstFusionIsoLibInit
+ 5, // CrstFusionLoadContext
+ 4, // CrstFusionLog
+ 7, // CrstFusionNgenIndex
+ 7, // CrstFusionNgenIndexPool
+ 0, // CrstFusionPcyCache
+ 4, // CrstFusionPolicyConfigPool
+ 5, // CrstFusionSingleUse
+ 6, // CrstFusionWarningLog
+ 0, // CrstGCMemoryPressure
+ 11, // CrstGlobalStrLiteralMap
+ 1, // CrstHandleTable
+ 0, // CrstHostAssemblyMap
+ 3, // CrstHostAssemblyMapAdd
+ 0, // CrstIbcProfile
+ 9, // CrstIJWFixupData
+ 0, // CrstIJWHash
+ 5, // CrstILFingerprintCache
+ 7, // CrstILStubGen
+ 3, // CrstInlineTrackingMap
+ 16, // CrstInstMethodHashTable
+ 0, // CrstInterfaceVTableMap
+ 17, // CrstInterop
+ 4, // CrstInteropData
+ 11, // CrstIOThreadpoolWorker
+ 0, // CrstIsJMCMethod
+ 7, // CrstISymUnmanagedReader
+ 8, // CrstJit
+ 0, // CrstJitGenericHandleCache
+ -1, // CrstJitPerf
+ 6, // CrstJumpStubCache
+ 0, // CrstLeafLock
+ -1, // CrstListLock
+ 14, // CrstLoaderAllocator
+ 15, // CrstLoaderAllocatorReferences
+ 0, // CrstLoaderHeap
+ 0, // CrstMda
+ -1, // CrstMetadataTracker
+ 0, // CrstModIntPairList
+ 4, // CrstModule
+ 14, // CrstModuleFixup
+ 3, // CrstModuleLookupTable
+ 0, // CrstMulticoreJitHash
+ 11, // CrstMulticoreJitManager
+ 0, // CrstMUThunkHash
+ -1, // CrstNativeBinderInit
+ -1, // CrstNativeImageCache
+ 0, // CrstNls
+ 2, // CrstObjectList
+ 0, // CrstOnEventManager
+ 0, // CrstPatchEntryPoint
+ 0, // CrstPEFileSecurityManager
+ 4, // CrstPEImage
+ 0, // CrstPEImagePDBStream
+ 18, // CrstPendingTypeLoadEntry
+ 0, // CrstPinHandle
+ 0, // CrstPinnedByrefValidation
+ 0, // CrstProfilerGCRefDataFreeList
+ 0, // CrstProfilingAPIStatus
+ 0, // CrstPublisherCertificate
+ 3, // CrstRCWCache
+ 0, // CrstRCWCleanupList
+ 3, // CrstRCWRefCache
+ 0, // CrstReDacl
+ 9, // CrstReflection
+ 7, // CrstReJITDomainTable
+ 13, // CrstReJITGlobalRequest
+ 9, // CrstReJITSharedDomainTable
+ 19, // CrstRemoting
+ 3, // CrstRetThunkCache
+ 0, // CrstRWLock
+ 3, // CrstSavedExceptionInfo
+ 0, // CrstSaveModuleProfileData
+ 0, // CrstSecurityPolicyCache
+ 3, // CrstSecurityPolicyInit
+ 0, // CrstSecurityStackwalkCache
+ 4, // CrstSharedAssemblyCreate
+ 7, // CrstSharedBaseDomain
+ 3, // CrstSigConvert
+ 5, // CrstSingleUseLock
+ 0, // CrstSpecialStatics
+ 0, // CrstSqmManager
+ 0, // CrstStackSampler
+ -1, // CrstStressLog
+ 0, // CrstStrongName
+ 5, // CrstStubCache
+ 0, // CrstStubDispatchCache
+ 4, // CrstStubUnwindInfoHeapSegments
+ 3, // CrstSyncBlockCache
+ 0, // CrstSyncHashLock
+ 0, // CrstSystemBaseDomain
+ 12, // CrstSystemDomain
+ 0, // CrstSystemDomainDelayedUnloadList
+ 0, // CrstThreadIdDispenser
+ 0, // CrstThreadpoolEventCache
+ 7, // CrstThreadpoolTimerQueue
+ 7, // CrstThreadpoolWaitThreads
+ 11, // CrstThreadpoolWorker
+ 4, // CrstThreadStaticDataHashTable
+ 10, // CrstThreadStore
+ 9, // CrstTPMethodTable
+ 3, // CrstTypeEquivalenceMap
+ 7, // CrstTypeIDMap
+ 3, // CrstUMEntryThunkCache
+ 0, // CrstUMThunkHash
+ 3, // CrstUniqueStack
+ 7, // CrstUnresolvedClassLock
+ 3, // CrstUnwindInfoTableLock
+ 3, // CrstVSDIndirectionCellLock
+ 3, // CrstWinRTFactoryCache
+ 3, // CrstWrapperTemplate
+};
+
+// An array mapping CrstType to a stringized name.
+LPCSTR g_rgCrstNameMap[] =
+{
+ "CrstAllowedFiles",
+ "CrstAppDomainCache",
+ "CrstAppDomainHandleTable",
+ "CrstArgBasedStubCache",
+ "CrstAssemblyDependencyGraph",
+ "CrstAssemblyIdentityCache",
+ "CrstAssemblyList",
+ "CrstAssemblyLoader",
+ "CrstAssemblyUsageLog",
+ "CrstAvailableClass",
+ "CrstAvailableParamTypes",
+ "CrstBaseDomain",
+ "CrstCCompRC",
+ "CrstCer",
+ "CrstClassFactInfoHash",
+ "CrstClassInit",
+ "CrstClrNotification",
+ "CrstCLRPrivBinderMaps",
+ "CrstCLRPrivBinderMapsAdd",
+ "CrstCodeFragmentHeap",
+ "CrstCOMWrapperCache",
+ "CrstConnectionNameTable",
+ "CrstContexts",
+ "CrstCoreCLRBinderLog",
+ "CrstCrstCLRPrivBinderLocalWinMDPath",
+ "CrstCSPCache",
+ "CrstDataTest1",
+ "CrstDataTest2",
+ "CrstDbgTransport",
+ "CrstDeadlockDetection",
+ "CrstDebuggerController",
+ "CrstDebuggerFavorLock",
+ "CrstDebuggerHeapExecMemLock",
+ "CrstDebuggerHeapLock",
+ "CrstDebuggerJitInfo",
+ "CrstDebuggerMutex",
+ "CrstDelegateToFPtrHash",
+ "CrstDomainLocalBlock",
+ "CrstDynamicIL",
+ "CrstDynamicMT",
+ "CrstDynLinkZapItems",
+ "CrstEtwTypeLogHash",
+ "CrstEventStore",
+ "CrstException",
+ "CrstExecuteManLock",
+ "CrstExecuteManRangeLock",
+ "CrstFCall",
+ "CrstFriendAccessCache",
+ "CrstFuncPtrStubs",
+ "CrstFusionAppCtx",
+ "CrstFusionAssemblyDownload",
+ "CrstFusionBindContext",
+ "CrstFusionBindResult",
+ "CrstFusionClb",
+ "CrstFusionClosure",
+ "CrstFusionClosureGraph",
+ "CrstFusionConfigSettings",
+ "CrstFusionDownload",
+ "CrstFusionIsoLibInit",
+ "CrstFusionLoadContext",
+ "CrstFusionLog",
+ "CrstFusionNgenIndex",
+ "CrstFusionNgenIndexPool",
+ "CrstFusionPcyCache",
+ "CrstFusionPolicyConfigPool",
+ "CrstFusionSingleUse",
+ "CrstFusionWarningLog",
+ "CrstGCMemoryPressure",
+ "CrstGlobalStrLiteralMap",
+ "CrstHandleTable",
+ "CrstHostAssemblyMap",
+ "CrstHostAssemblyMapAdd",
+ "CrstIbcProfile",
+ "CrstIJWFixupData",
+ "CrstIJWHash",
+ "CrstILFingerprintCache",
+ "CrstILStubGen",
+ "CrstInlineTrackingMap",
+ "CrstInstMethodHashTable",
+ "CrstInterfaceVTableMap",
+ "CrstInterop",
+ "CrstInteropData",
+ "CrstIOThreadpoolWorker",
+ "CrstIsJMCMethod",
+ "CrstISymUnmanagedReader",
+ "CrstJit",
+ "CrstJitGenericHandleCache",
+ "CrstJitPerf",
+ "CrstJumpStubCache",
+ "CrstLeafLock",
+ "CrstListLock",
+ "CrstLoaderAllocator",
+ "CrstLoaderAllocatorReferences",
+ "CrstLoaderHeap",
+ "CrstMda",
+ "CrstMetadataTracker",
+ "CrstModIntPairList",
+ "CrstModule",
+ "CrstModuleFixup",
+ "CrstModuleLookupTable",
+ "CrstMulticoreJitHash",
+ "CrstMulticoreJitManager",
+ "CrstMUThunkHash",
+ "CrstNativeBinderInit",
+ "CrstNativeImageCache",
+ "CrstNls",
+ "CrstObjectList",
+ "CrstOnEventManager",
+ "CrstPatchEntryPoint",
+ "CrstPEFileSecurityManager",
+ "CrstPEImage",
+ "CrstPEImagePDBStream",
+ "CrstPendingTypeLoadEntry",
+ "CrstPinHandle",
+ "CrstPinnedByrefValidation",
+ "CrstProfilerGCRefDataFreeList",
+ "CrstProfilingAPIStatus",
+ "CrstPublisherCertificate",
+ "CrstRCWCache",
+ "CrstRCWCleanupList",
+ "CrstRCWRefCache",
+ "CrstReDacl",
+ "CrstReflection",
+ "CrstReJITDomainTable",
+ "CrstReJITGlobalRequest",
+ "CrstReJITSharedDomainTable",
+ "CrstRemoting",
+ "CrstRetThunkCache",
+ "CrstRWLock",
+ "CrstSavedExceptionInfo",
+ "CrstSaveModuleProfileData",
+ "CrstSecurityPolicyCache",
+ "CrstSecurityPolicyInit",
+ "CrstSecurityStackwalkCache",
+ "CrstSharedAssemblyCreate",
+ "CrstSharedBaseDomain",
+ "CrstSigConvert",
+ "CrstSingleUseLock",
+ "CrstSpecialStatics",
+ "CrstSqmManager",
+ "CrstStackSampler",
+ "CrstStressLog",
+ "CrstStrongName",
+ "CrstStubCache",
+ "CrstStubDispatchCache",
+ "CrstStubUnwindInfoHeapSegments",
+ "CrstSyncBlockCache",
+ "CrstSyncHashLock",
+ "CrstSystemBaseDomain",
+ "CrstSystemDomain",
+ "CrstSystemDomainDelayedUnloadList",
+ "CrstThreadIdDispenser",
+ "CrstThreadpoolEventCache",
+ "CrstThreadpoolTimerQueue",
+ "CrstThreadpoolWaitThreads",
+ "CrstThreadpoolWorker",
+ "CrstThreadStaticDataHashTable",
+ "CrstThreadStore",
+ "CrstTPMethodTable",
+ "CrstTypeEquivalenceMap",
+ "CrstTypeIDMap",
+ "CrstUMEntryThunkCache",
+ "CrstUMThunkHash",
+ "CrstUniqueStack",
+ "CrstUnresolvedClassLock",
+ "CrstUnwindInfoTableLock",
+ "CrstVSDIndirectionCellLock",
+ "CrstWinRTFactoryCache",
+ "CrstWrapperTemplate",
+};
+
+// Define a special level constant for unordered locks.
+#define CRSTUNORDERED (-1)
+
+// Define inline helpers to map Crst types to names and levels.
+inline static int GetCrstLevel(CrstType crstType)
+{
+ LIMITED_METHOD_CONTRACT;
+ _ASSERTE(crstType >= 0 && crstType < kNumberOfCrstTypes);
+ return g_rgCrstLevelMap[crstType];
+}
+inline static LPCSTR GetCrstName(CrstType crstType)
+{
+ LIMITED_METHOD_CONTRACT;
+ _ASSERTE(crstType >= 0 && crstType < kNumberOfCrstTypes);
+ return g_rgCrstNameMap[crstType];
+}
+
+#endif // defined(__IN_CRST_CPP) && defined(_DEBUG)
diff --git a/src/inc/crtwrap.h b/src/inc/crtwrap.h
new file mode 100644
index 0000000000..56f63cb422
--- /dev/null
+++ b/src/inc/crtwrap.h
@@ -0,0 +1,30 @@
+// 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.
+//*****************************************************************************
+// CrtWrap.h
+//
+// Wrapper code for the C runtime library.
+//
+//*****************************************************************************
+
+#ifndef __CrtWrap_h__
+#define __CrtWrap_h__
+
+#include <stdint.h>
+#include <windows.h>
+#include <objbase.h>
+#include <tchar.h>
+#include "debugmacros.h"
+#include <stdlib.h>
+#include <malloc.h>
+#include <wchar.h>
+#include <stdio.h>
+
+#ifndef PUB
+// PUB is defined to influence method visibility for some compilers.
+#define PUB
+#endif // !PUB
+
+#endif // __CrtWrap_h__
+
diff --git a/src/inc/cvconst.h b/src/inc/cvconst.h
new file mode 100644
index 0000000000..98eb19e257
--- /dev/null
+++ b/src/inc/cvconst.h
@@ -0,0 +1,3728 @@
+// 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.
+
+// cvconst.h - codeview constant definitions
+//-----------------------------------------------------------------
+//
+// Copyright Microsoft Corporation. All Rights Reserved.
+//
+//---------------------------------------------------------------
+#ifndef _CVCONST_H_
+#define _CVCONST_H_
+
+
+
+// Enumeration for function call type
+
+
+typedef enum CV_call_e {
+ CV_CALL_NEAR_C = 0x00, // near right to left push, caller pops stack
+ CV_CALL_FAR_C = 0x01, // far right to left push, caller pops stack
+ CV_CALL_NEAR_PASCAL = 0x02, // near left to right push, callee pops stack
+ CV_CALL_FAR_PASCAL = 0x03, // far left to right push, callee pops stack
+ CV_CALL_NEAR_FAST = 0x04, // near left to right push with regs, callee pops stack
+ CV_CALL_FAR_FAST = 0x05, // far left to right push with regs, callee pops stack
+ CV_CALL_SKIPPED = 0x06, // skipped (unused) call index
+ CV_CALL_NEAR_STD = 0x07, // near standard call
+ CV_CALL_FAR_STD = 0x08, // far standard call
+ CV_CALL_NEAR_SYS = 0x09, // near sys call
+ CV_CALL_FAR_SYS = 0x0a, // far sys call
+ CV_CALL_THISCALL = 0x0b, // this call (this passed in register)
+ CV_CALL_MIPSCALL = 0x0c, // Mips call
+ CV_CALL_GENERIC = 0x0d, // Generic call sequence
+ CV_CALL_ALPHACALL = 0x0e, // Alpha call
+ CV_CALL_PPCCALL = 0x0f, // PPC call
+ CV_CALL_SHCALL = 0x10, // Hitachi SuperH call
+ CV_CALL_ARMCALL = 0x11, // ARM call
+ CV_CALL_AM33CALL = 0x12, // AM33 call
+ CV_CALL_TRICALL = 0x13, // TriCore Call
+ CV_CALL_SH5CALL = 0x14, // Hitachi SuperH-5 call
+ CV_CALL_M32RCALL = 0x15, // M32R Call
+ CV_CALL_CLRCALL = 0x16, // clr call
+ CV_CALL_INLINE = 0x17, // Marker for routines always inlined and thus lacking a convention
+ CV_CALL_NEAR_VECTOR = 0x18, // near left to right push with regs, callee pops stack
+ CV_CALL_RESERVED = 0x19 // first unused call enumeration
+
+ // Do NOT add any more machine specific conventions. This is to be used for
+ // calling conventions in the source only (e.g. __cdecl, __stdcall).
+} CV_call_e;
+
+
+// Values for the access protection of class attributes
+
+
+typedef enum CV_access_e {
+ CV_private = 1,
+ CV_protected = 2,
+ CV_public = 3
+} CV_access_e;
+
+typedef enum THUNK_ORDINAL {
+ THUNK_ORDINAL_NOTYPE, // standard thunk
+ THUNK_ORDINAL_ADJUSTOR, // "this" adjustor thunk
+ THUNK_ORDINAL_VCALL, // virtual call thunk
+ THUNK_ORDINAL_PCODE, // pcode thunk
+ THUNK_ORDINAL_LOAD, // thunk which loads the address to jump to
+ // via unknown means...
+
+ // trampoline thunk ordinals - only for use in Trampoline thunk symbols
+ THUNK_ORDINAL_TRAMP_INCREMENTAL,
+ THUNK_ORDINAL_TRAMP_BRANCHISLAND,
+
+} THUNK_ORDINAL;
+
+
+enum CV_SourceChksum_t {
+ CHKSUM_TYPE_NONE = 0, // indicates no checksum is available
+ CHKSUM_TYPE_MD5,
+ CHKSUM_TYPE_SHA1,
+ CHKSUM_TYPE_SHA_256,
+};
+
+//
+// DIA enums
+//
+
+enum SymTagEnum
+{
+ SymTagNull,
+ SymTagExe,
+ SymTagCompiland,
+ SymTagCompilandDetails,
+ SymTagCompilandEnv,
+ SymTagFunction,
+ SymTagBlock,
+ SymTagData,
+ SymTagAnnotation,
+ SymTagLabel,
+ SymTagPublicSymbol,
+ SymTagUDT,
+ SymTagEnum,
+ SymTagFunctionType,
+ SymTagPointerType,
+ SymTagArrayType,
+ SymTagBaseType,
+ SymTagTypedef,
+ SymTagBaseClass,
+ SymTagFriend,
+ SymTagFunctionArgType,
+ SymTagFuncDebugStart,
+ SymTagFuncDebugEnd,
+ SymTagUsingNamespace,
+ SymTagVTableShape,
+ SymTagVTable,
+ SymTagCustom,
+ SymTagThunk,
+ SymTagCustomType,
+ SymTagManagedType,
+ SymTagDimension,
+ SymTagCallSite,
+ SymTagInlineSite,
+ SymTagBaseInterface,
+ SymTagVectorType,
+ SymTagMatrixType,
+ SymTagHLSLType,
+ SymTagCaller,
+ SymTagCallee,
+ SymTagExport,
+ SymTagHeapAllocationSite,
+ SymTagCoffGroup,
+ SymTagMax
+};
+
+enum LocationType
+{
+ LocIsNull,
+ LocIsStatic,
+ LocIsTLS,
+ LocIsRegRel,
+ LocIsThisRel,
+ LocIsEnregistered,
+ LocIsBitField,
+ LocIsSlot,
+ LocIsIlRel,
+ LocInMetaData,
+ LocIsConstant,
+ LocTypeMax
+};
+
+enum DataKind
+{
+ DataIsUnknown,
+ DataIsLocal,
+ DataIsStaticLocal,
+ DataIsParam,
+ DataIsObjectPtr,
+ DataIsFileStatic,
+ DataIsGlobal,
+ DataIsMember,
+ DataIsStaticMember,
+ DataIsConstant
+};
+
+enum UdtKind
+{
+ UdtStruct,
+ UdtClass,
+ UdtUnion,
+ UdtInterface
+};
+
+enum BasicType
+{
+ btNoType = 0,
+ btVoid = 1,
+ btChar = 2,
+ btWChar = 3,
+ btInt = 6,
+ btUInt = 7,
+ btFloat = 8,
+ btBCD = 9,
+ btBool = 10,
+ btLong = 13,
+ btULong = 14,
+ btCurrency = 25,
+ btDate = 26,
+ btVariant = 27,
+ btComplex = 28,
+ btBit = 29,
+ btBSTR = 30,
+ btHresult = 31,
+ btChar16 = 32, // char16_t
+ btChar32 = 33, // char32_t
+};
+
+
+// enumeration for type modifier values
+
+typedef enum CV_modifier_e {
+ // 0x0000 - 0x01ff - Reserved.
+
+ CV_MOD_INVALID = 0x0000,
+
+ // Standard modifiers.
+
+ CV_MOD_CONST = 0x0001,
+ CV_MOD_VOLATILE = 0x0002,
+ CV_MOD_UNALIGNED = 0x0003,
+
+ // 0x0200 - 0x03ff - HLSL modifiers.
+
+ CV_MOD_HLSL_UNIFORM = 0x0200,
+ CV_MOD_HLSL_LINE = 0x0201,
+ CV_MOD_HLSL_TRIANGLE = 0x0202,
+ CV_MOD_HLSL_LINEADJ = 0x0203,
+ CV_MOD_HLSL_TRIANGLEADJ = 0x0204,
+ CV_MOD_HLSL_LINEAR = 0x0205,
+ CV_MOD_HLSL_CENTROID = 0x0206,
+ CV_MOD_HLSL_CONSTINTERP = 0x0207,
+ CV_MOD_HLSL_NOPERSPECTIVE = 0x0208,
+ CV_MOD_HLSL_SAMPLE = 0x0209,
+ CV_MOD_HLSL_CENTER = 0x020a,
+ CV_MOD_HLSL_SNORM = 0x020b,
+ CV_MOD_HLSL_UNORM = 0x020c,
+ CV_MOD_HLSL_PRECISE = 0x020d,
+ CV_MOD_HLSL_UAV_GLOBALLY_COHERENT = 0x020e,
+
+ // 0x0400 - 0xffff - Unused.
+
+} CV_modifier_e;
+
+
+// built-in type kinds
+
+
+typedef enum CV_builtin_e {
+
+ // 0x0000 - 0x01ff - Reserved.
+ CV_BI_INVALID = 0x0000,
+
+ // 0x0200 - 0x03ff - HLSL types.
+
+ CV_BI_HLSL_INTERFACE_POINTER = 0x0200,
+ CV_BI_HLSL_TEXTURE1D = 0x0201,
+ CV_BI_HLSL_TEXTURE1D_ARRAY = 0x0202,
+ CV_BI_HLSL_TEXTURE2D = 0x0203,
+ CV_BI_HLSL_TEXTURE2D_ARRAY = 0x0204,
+ CV_BI_HLSL_TEXTURE3D = 0x0205,
+ CV_BI_HLSL_TEXTURECUBE = 0x0206,
+ CV_BI_HLSL_TEXTURECUBE_ARRAY = 0x0207,
+ CV_BI_HLSL_TEXTURE2DMS = 0x0208,
+ CV_BI_HLSL_TEXTURE2DMS_ARRAY = 0x0209,
+ CV_BI_HLSL_SAMPLER = 0x020a,
+ CV_BI_HLSL_SAMPLERCOMPARISON = 0x020b,
+ CV_BI_HLSL_BUFFER = 0x020c,
+ CV_BI_HLSL_POINTSTREAM = 0x020d,
+ CV_BI_HLSL_LINESTREAM = 0x020e,
+ CV_BI_HLSL_TRIANGLESTREAM = 0x020f,
+ CV_BI_HLSL_INPUTPATCH = 0x0210,
+ CV_BI_HLSL_OUTPUTPATCH = 0x0211,
+ CV_BI_HLSL_RWTEXTURE1D = 0x0212,
+ CV_BI_HLSL_RWTEXTURE1D_ARRAY = 0x0213,
+ CV_BI_HLSL_RWTEXTURE2D = 0x0214,
+ CV_BI_HLSL_RWTEXTURE2D_ARRAY = 0x0215,
+ CV_BI_HLSL_RWTEXTURE3D = 0x0216,
+ CV_BI_HLSL_RWBUFFER = 0x0217,
+ CV_BI_HLSL_BYTEADDRESS_BUFFER = 0x0218,
+ CV_BI_HLSL_RWBYTEADDRESS_BUFFER = 0x0219,
+ CV_BI_HLSL_STRUCTURED_BUFFER = 0x021a,
+ CV_BI_HLSL_RWSTRUCTURED_BUFFER = 0x021b,
+ CV_BI_HLSL_APPEND_STRUCTURED_BUFFER = 0x021c,
+ CV_BI_HLSL_CONSUME_STRUCTURED_BUFFER= 0x021d,
+ CV_BI_HLSL_MIN8FLOAT = 0x021e,
+ CV_BI_HLSL_MIN10FLOAT = 0x021f,
+ CV_BI_HLSL_MIN16FLOAT = 0x0220,
+ CV_BI_HLSL_MIN12INT = 0x0221,
+ CV_BI_HLSL_MIN16INT = 0x0222,
+ CV_BI_HLSL_MIN16UINT = 0x0223,
+
+ // 0x0400 - 0xffff - Unused.
+
+} CV_builtin_e;
+
+
+// enum describing the compile flag source language
+
+
+typedef enum CV_CFL_LANG {
+ CV_CFL_C = 0x00,
+ CV_CFL_CXX = 0x01,
+ CV_CFL_FORTRAN = 0x02,
+ CV_CFL_MASM = 0x03,
+ CV_CFL_PASCAL = 0x04,
+ CV_CFL_BASIC = 0x05,
+ CV_CFL_COBOL = 0x06,
+ CV_CFL_LINK = 0x07,
+ CV_CFL_CVTRES = 0x08,
+ CV_CFL_CVTPGD = 0x09,
+ CV_CFL_CSHARP = 0x0A, // C#
+ CV_CFL_VB = 0x0B, // Visual Basic
+ CV_CFL_ILASM = 0x0C, // IL (as in CLR) ASM
+ CV_CFL_JAVA = 0x0D,
+ CV_CFL_JSCRIPT = 0x0E,
+ CV_CFL_MSIL = 0x0F, // Unknown MSIL (LTCG of .NETMODULE)
+ CV_CFL_HLSL = 0x10, // High Level Shader Language
+} CV_CFL_LANG;
+
+
+// enum describing target processor
+
+
+typedef enum CV_CPU_TYPE_e {
+ CV_CFL_8080 = 0x00,
+ CV_CFL_8086 = 0x01,
+ CV_CFL_80286 = 0x02,
+ CV_CFL_80386 = 0x03,
+ CV_CFL_80486 = 0x04,
+ CV_CFL_PENTIUM = 0x05,
+ CV_CFL_PENTIUMII = 0x06,
+ CV_CFL_PENTIUMPRO = CV_CFL_PENTIUMII,
+ CV_CFL_PENTIUMIII = 0x07,
+ CV_CFL_MIPS = 0x10,
+ CV_CFL_MIPSR4000 = CV_CFL_MIPS, // don't break current code
+ CV_CFL_MIPS16 = 0x11,
+ CV_CFL_MIPS32 = 0x12,
+ CV_CFL_MIPS64 = 0x13,
+ CV_CFL_MIPSI = 0x14,
+ CV_CFL_MIPSII = 0x15,
+ CV_CFL_MIPSIII = 0x16,
+ CV_CFL_MIPSIV = 0x17,
+ CV_CFL_MIPSV = 0x18,
+ CV_CFL_M68000 = 0x20,
+ CV_CFL_M68010 = 0x21,
+ CV_CFL_M68020 = 0x22,
+ CV_CFL_M68030 = 0x23,
+ CV_CFL_M68040 = 0x24,
+ CV_CFL_ALPHA = 0x30,
+ CV_CFL_ALPHA_21064 = 0x30,
+ CV_CFL_ALPHA_21164 = 0x31,
+ CV_CFL_ALPHA_21164A = 0x32,
+ CV_CFL_ALPHA_21264 = 0x33,
+ CV_CFL_ALPHA_21364 = 0x34,
+ CV_CFL_PPC601 = 0x40,
+ CV_CFL_PPC603 = 0x41,
+ CV_CFL_PPC604 = 0x42,
+ CV_CFL_PPC620 = 0x43,
+ CV_CFL_PPCFP = 0x44,
+ CV_CFL_PPCBE = 0x45,
+ CV_CFL_SH3 = 0x50,
+ CV_CFL_SH3E = 0x51,
+ CV_CFL_SH3DSP = 0x52,
+ CV_CFL_SH4 = 0x53,
+ CV_CFL_SHMEDIA = 0x54,
+ CV_CFL_ARM3 = 0x60,
+ CV_CFL_ARM4 = 0x61,
+ CV_CFL_ARM4T = 0x62,
+ CV_CFL_ARM5 = 0x63,
+ CV_CFL_ARM5T = 0x64,
+ CV_CFL_ARM6 = 0x65,
+ CV_CFL_ARM_XMAC = 0x66,
+ CV_CFL_ARM_WMMX = 0x67,
+ CV_CFL_ARM7 = 0x68,
+ CV_CFL_OMNI = 0x70,
+ CV_CFL_IA64 = 0x80,
+ CV_CFL_IA64_1 = 0x80,
+ CV_CFL_IA64_2 = 0x81,
+ CV_CFL_CEE = 0x90,
+ CV_CFL_AM33 = 0xA0,
+ CV_CFL_M32R = 0xB0,
+ CV_CFL_TRICORE = 0xC0,
+ CV_CFL_X64 = 0xD0,
+ CV_CFL_AMD64 = CV_CFL_X64,
+ CV_CFL_EBC = 0xE0,
+ CV_CFL_THUMB = 0xF0,
+ CV_CFL_ARMNT = 0xF4,
+ CV_CFL_ARM64 = 0xF6,
+ CV_CFL_D3D11_SHADER = 0x100,
+} CV_CPU_TYPE_e;
+
+typedef enum CV_HREG_e {
+ // Register subset shared by all processor types,
+ // must not overlap with any of the ranges below, hence the high values
+
+ CV_ALLREG_ERR = 30000,
+ CV_ALLREG_TEB = 30001,
+ CV_ALLREG_TIMER = 30002,
+ CV_ALLREG_EFAD1 = 30003,
+ CV_ALLREG_EFAD2 = 30004,
+ CV_ALLREG_EFAD3 = 30005,
+ CV_ALLREG_VFRAME= 30006,
+ CV_ALLREG_HANDLE= 30007,
+ CV_ALLREG_PARAMS= 30008,
+ CV_ALLREG_LOCALS= 30009,
+ CV_ALLREG_TID = 30010,
+ CV_ALLREG_ENV = 30011,
+ CV_ALLREG_CMDLN = 30012,
+
+
+ // Register set for the Intel 80x86 and ix86 processor series
+ // (plus PCODE registers)
+
+ CV_REG_NONE = 0,
+ CV_REG_AL = 1,
+ CV_REG_CL = 2,
+ CV_REG_DL = 3,
+ CV_REG_BL = 4,
+ CV_REG_AH = 5,
+ CV_REG_CH = 6,
+ CV_REG_DH = 7,
+ CV_REG_BH = 8,
+ CV_REG_AX = 9,
+ CV_REG_CX = 10,
+ CV_REG_DX = 11,
+ CV_REG_BX = 12,
+ CV_REG_SP = 13,
+ CV_REG_BP = 14,
+ CV_REG_SI = 15,
+ CV_REG_DI = 16,
+ CV_REG_EAX = 17,
+ CV_REG_ECX = 18,
+ CV_REG_EDX = 19,
+ CV_REG_EBX = 20,
+ CV_REG_ESP = 21,
+ CV_REG_EBP = 22,
+ CV_REG_ESI = 23,
+ CV_REG_EDI = 24,
+ CV_REG_ES = 25,
+ CV_REG_CS = 26,
+ CV_REG_SS = 27,
+ CV_REG_DS = 28,
+ CV_REG_FS = 29,
+ CV_REG_GS = 30,
+ CV_REG_IP = 31,
+ CV_REG_FLAGS = 32,
+ CV_REG_EIP = 33,
+ CV_REG_EFLAGS = 34,
+ CV_REG_TEMP = 40, // PCODE Temp
+ CV_REG_TEMPH = 41, // PCODE TempH
+ CV_REG_QUOTE = 42, // PCODE Quote
+ CV_REG_PCDR3 = 43, // PCODE reserved
+ CV_REG_PCDR4 = 44, // PCODE reserved
+ CV_REG_PCDR5 = 45, // PCODE reserved
+ CV_REG_PCDR6 = 46, // PCODE reserved
+ CV_REG_PCDR7 = 47, // PCODE reserved
+ CV_REG_CR0 = 80, // CR0 -- control registers
+ CV_REG_CR1 = 81,
+ CV_REG_CR2 = 82,
+ CV_REG_CR3 = 83,
+ CV_REG_CR4 = 84, // Pentium
+ CV_REG_DR0 = 90, // Debug register
+ CV_REG_DR1 = 91,
+ CV_REG_DR2 = 92,
+ CV_REG_DR3 = 93,
+ CV_REG_DR4 = 94,
+ CV_REG_DR5 = 95,
+ CV_REG_DR6 = 96,
+ CV_REG_DR7 = 97,
+ CV_REG_GDTR = 110,
+ CV_REG_GDTL = 111,
+ CV_REG_IDTR = 112,
+ CV_REG_IDTL = 113,
+ CV_REG_LDTR = 114,
+ CV_REG_TR = 115,
+
+ CV_REG_PSEUDO1 = 116,
+ CV_REG_PSEUDO2 = 117,
+ CV_REG_PSEUDO3 = 118,
+ CV_REG_PSEUDO4 = 119,
+ CV_REG_PSEUDO5 = 120,
+ CV_REG_PSEUDO6 = 121,
+ CV_REG_PSEUDO7 = 122,
+ CV_REG_PSEUDO8 = 123,
+ CV_REG_PSEUDO9 = 124,
+
+ CV_REG_ST0 = 128,
+ CV_REG_ST1 = 129,
+ CV_REG_ST2 = 130,
+ CV_REG_ST3 = 131,
+ CV_REG_ST4 = 132,
+ CV_REG_ST5 = 133,
+ CV_REG_ST6 = 134,
+ CV_REG_ST7 = 135,
+ CV_REG_CTRL = 136,
+ CV_REG_STAT = 137,
+ CV_REG_TAG = 138,
+ CV_REG_FPIP = 139,
+ CV_REG_FPCS = 140,
+ CV_REG_FPDO = 141,
+ CV_REG_FPDS = 142,
+ CV_REG_ISEM = 143,
+ CV_REG_FPEIP = 144,
+ CV_REG_FPEDO = 145,
+
+ CV_REG_MM0 = 146,
+ CV_REG_MM1 = 147,
+ CV_REG_MM2 = 148,
+ CV_REG_MM3 = 149,
+ CV_REG_MM4 = 150,
+ CV_REG_MM5 = 151,
+ CV_REG_MM6 = 152,
+ CV_REG_MM7 = 153,
+
+ CV_REG_XMM0 = 154, // KATMAI registers
+ CV_REG_XMM1 = 155,
+ CV_REG_XMM2 = 156,
+ CV_REG_XMM3 = 157,
+ CV_REG_XMM4 = 158,
+ CV_REG_XMM5 = 159,
+ CV_REG_XMM6 = 160,
+ CV_REG_XMM7 = 161,
+
+ CV_REG_XMM00 = 162, // KATMAI sub-registers
+ CV_REG_XMM01 = 163,
+ CV_REG_XMM02 = 164,
+ CV_REG_XMM03 = 165,
+ CV_REG_XMM10 = 166,
+ CV_REG_XMM11 = 167,
+ CV_REG_XMM12 = 168,
+ CV_REG_XMM13 = 169,
+ CV_REG_XMM20 = 170,
+ CV_REG_XMM21 = 171,
+ CV_REG_XMM22 = 172,
+ CV_REG_XMM23 = 173,
+ CV_REG_XMM30 = 174,
+ CV_REG_XMM31 = 175,
+ CV_REG_XMM32 = 176,
+ CV_REG_XMM33 = 177,
+ CV_REG_XMM40 = 178,
+ CV_REG_XMM41 = 179,
+ CV_REG_XMM42 = 180,
+ CV_REG_XMM43 = 181,
+ CV_REG_XMM50 = 182,
+ CV_REG_XMM51 = 183,
+ CV_REG_XMM52 = 184,
+ CV_REG_XMM53 = 185,
+ CV_REG_XMM60 = 186,
+ CV_REG_XMM61 = 187,
+ CV_REG_XMM62 = 188,
+ CV_REG_XMM63 = 189,
+ CV_REG_XMM70 = 190,
+ CV_REG_XMM71 = 191,
+ CV_REG_XMM72 = 192,
+ CV_REG_XMM73 = 193,
+
+ CV_REG_XMM0L = 194,
+ CV_REG_XMM1L = 195,
+ CV_REG_XMM2L = 196,
+ CV_REG_XMM3L = 197,
+ CV_REG_XMM4L = 198,
+ CV_REG_XMM5L = 199,
+ CV_REG_XMM6L = 200,
+ CV_REG_XMM7L = 201,
+
+ CV_REG_XMM0H = 202,
+ CV_REG_XMM1H = 203,
+ CV_REG_XMM2H = 204,
+ CV_REG_XMM3H = 205,
+ CV_REG_XMM4H = 206,
+ CV_REG_XMM5H = 207,
+ CV_REG_XMM6H = 208,
+ CV_REG_XMM7H = 209,
+
+ CV_REG_MXCSR = 211, // XMM status register
+
+ CV_REG_EDXEAX = 212, // EDX:EAX pair
+
+ CV_REG_EMM0L = 220, // XMM sub-registers (WNI integer)
+ CV_REG_EMM1L = 221,
+ CV_REG_EMM2L = 222,
+ CV_REG_EMM3L = 223,
+ CV_REG_EMM4L = 224,
+ CV_REG_EMM5L = 225,
+ CV_REG_EMM6L = 226,
+ CV_REG_EMM7L = 227,
+
+ CV_REG_EMM0H = 228,
+ CV_REG_EMM1H = 229,
+ CV_REG_EMM2H = 230,
+ CV_REG_EMM3H = 231,
+ CV_REG_EMM4H = 232,
+ CV_REG_EMM5H = 233,
+ CV_REG_EMM6H = 234,
+ CV_REG_EMM7H = 235,
+
+ // do not change the order of these regs, first one must be even too
+ CV_REG_MM00 = 236,
+ CV_REG_MM01 = 237,
+ CV_REG_MM10 = 238,
+ CV_REG_MM11 = 239,
+ CV_REG_MM20 = 240,
+ CV_REG_MM21 = 241,
+ CV_REG_MM30 = 242,
+ CV_REG_MM31 = 243,
+ CV_REG_MM40 = 244,
+ CV_REG_MM41 = 245,
+ CV_REG_MM50 = 246,
+ CV_REG_MM51 = 247,
+ CV_REG_MM60 = 248,
+ CV_REG_MM61 = 249,
+ CV_REG_MM70 = 250,
+ CV_REG_MM71 = 251,
+
+ CV_REG_YMM0 = 252, // AVX registers
+ CV_REG_YMM1 = 253,
+ CV_REG_YMM2 = 254,
+ CV_REG_YMM3 = 255,
+ CV_REG_YMM4 = 256,
+ CV_REG_YMM5 = 257,
+ CV_REG_YMM6 = 258,
+ CV_REG_YMM7 = 259,
+
+ CV_REG_YMM0H = 260,
+ CV_REG_YMM1H = 261,
+ CV_REG_YMM2H = 262,
+ CV_REG_YMM3H = 263,
+ CV_REG_YMM4H = 264,
+ CV_REG_YMM5H = 265,
+ CV_REG_YMM6H = 266,
+ CV_REG_YMM7H = 267,
+
+ CV_REG_YMM0I0 = 268, // AVX integer registers
+ CV_REG_YMM0I1 = 269,
+ CV_REG_YMM0I2 = 270,
+ CV_REG_YMM0I3 = 271,
+ CV_REG_YMM1I0 = 272,
+ CV_REG_YMM1I1 = 273,
+ CV_REG_YMM1I2 = 274,
+ CV_REG_YMM1I3 = 275,
+ CV_REG_YMM2I0 = 276,
+ CV_REG_YMM2I1 = 277,
+ CV_REG_YMM2I2 = 278,
+ CV_REG_YMM2I3 = 279,
+ CV_REG_YMM3I0 = 280,
+ CV_REG_YMM3I1 = 281,
+ CV_REG_YMM3I2 = 282,
+ CV_REG_YMM3I3 = 283,
+ CV_REG_YMM4I0 = 284,
+ CV_REG_YMM4I1 = 285,
+ CV_REG_YMM4I2 = 286,
+ CV_REG_YMM4I3 = 287,
+ CV_REG_YMM5I0 = 288,
+ CV_REG_YMM5I1 = 289,
+ CV_REG_YMM5I2 = 290,
+ CV_REG_YMM5I3 = 291,
+ CV_REG_YMM6I0 = 292,
+ CV_REG_YMM6I1 = 293,
+ CV_REG_YMM6I2 = 294,
+ CV_REG_YMM6I3 = 295,
+ CV_REG_YMM7I0 = 296,
+ CV_REG_YMM7I1 = 297,
+ CV_REG_YMM7I2 = 298,
+ CV_REG_YMM7I3 = 299,
+
+ CV_REG_YMM0F0 = 300, // AVX floating-point single precise registers
+ CV_REG_YMM0F1 = 301,
+ CV_REG_YMM0F2 = 302,
+ CV_REG_YMM0F3 = 303,
+ CV_REG_YMM0F4 = 304,
+ CV_REG_YMM0F5 = 305,
+ CV_REG_YMM0F6 = 306,
+ CV_REG_YMM0F7 = 307,
+ CV_REG_YMM1F0 = 308,
+ CV_REG_YMM1F1 = 309,
+ CV_REG_YMM1F2 = 310,
+ CV_REG_YMM1F3 = 311,
+ CV_REG_YMM1F4 = 312,
+ CV_REG_YMM1F5 = 313,
+ CV_REG_YMM1F6 = 314,
+ CV_REG_YMM1F7 = 315,
+ CV_REG_YMM2F0 = 316,
+ CV_REG_YMM2F1 = 317,
+ CV_REG_YMM2F2 = 318,
+ CV_REG_YMM2F3 = 319,
+ CV_REG_YMM2F4 = 320,
+ CV_REG_YMM2F5 = 321,
+ CV_REG_YMM2F6 = 322,
+ CV_REG_YMM2F7 = 323,
+ CV_REG_YMM3F0 = 324,
+ CV_REG_YMM3F1 = 325,
+ CV_REG_YMM3F2 = 326,
+ CV_REG_YMM3F3 = 327,
+ CV_REG_YMM3F4 = 328,
+ CV_REG_YMM3F5 = 329,
+ CV_REG_YMM3F6 = 330,
+ CV_REG_YMM3F7 = 331,
+ CV_REG_YMM4F0 = 332,
+ CV_REG_YMM4F1 = 333,
+ CV_REG_YMM4F2 = 334,
+ CV_REG_YMM4F3 = 335,
+ CV_REG_YMM4F4 = 336,
+ CV_REG_YMM4F5 = 337,
+ CV_REG_YMM4F6 = 338,
+ CV_REG_YMM4F7 = 339,
+ CV_REG_YMM5F0 = 340,
+ CV_REG_YMM5F1 = 341,
+ CV_REG_YMM5F2 = 342,
+ CV_REG_YMM5F3 = 343,
+ CV_REG_YMM5F4 = 344,
+ CV_REG_YMM5F5 = 345,
+ CV_REG_YMM5F6 = 346,
+ CV_REG_YMM5F7 = 347,
+ CV_REG_YMM6F0 = 348,
+ CV_REG_YMM6F1 = 349,
+ CV_REG_YMM6F2 = 350,
+ CV_REG_YMM6F3 = 351,
+ CV_REG_YMM6F4 = 352,
+ CV_REG_YMM6F5 = 353,
+ CV_REG_YMM6F6 = 354,
+ CV_REG_YMM6F7 = 355,
+ CV_REG_YMM7F0 = 356,
+ CV_REG_YMM7F1 = 357,
+ CV_REG_YMM7F2 = 358,
+ CV_REG_YMM7F3 = 359,
+ CV_REG_YMM7F4 = 360,
+ CV_REG_YMM7F5 = 361,
+ CV_REG_YMM7F6 = 362,
+ CV_REG_YMM7F7 = 363,
+
+ CV_REG_YMM0D0 = 364, // AVX floating-point double precise registers
+ CV_REG_YMM0D1 = 365,
+ CV_REG_YMM0D2 = 366,
+ CV_REG_YMM0D3 = 367,
+ CV_REG_YMM1D0 = 368,
+ CV_REG_YMM1D1 = 369,
+ CV_REG_YMM1D2 = 370,
+ CV_REG_YMM1D3 = 371,
+ CV_REG_YMM2D0 = 372,
+ CV_REG_YMM2D1 = 373,
+ CV_REG_YMM2D2 = 374,
+ CV_REG_YMM2D3 = 375,
+ CV_REG_YMM3D0 = 376,
+ CV_REG_YMM3D1 = 377,
+ CV_REG_YMM3D2 = 378,
+ CV_REG_YMM3D3 = 379,
+ CV_REG_YMM4D0 = 380,
+ CV_REG_YMM4D1 = 381,
+ CV_REG_YMM4D2 = 382,
+ CV_REG_YMM4D3 = 383,
+ CV_REG_YMM5D0 = 384,
+ CV_REG_YMM5D1 = 385,
+ CV_REG_YMM5D2 = 386,
+ CV_REG_YMM5D3 = 387,
+ CV_REG_YMM6D0 = 388,
+ CV_REG_YMM6D1 = 389,
+ CV_REG_YMM6D2 = 390,
+ CV_REG_YMM6D3 = 391,
+ CV_REG_YMM7D0 = 392,
+ CV_REG_YMM7D1 = 393,
+ CV_REG_YMM7D2 = 394,
+ CV_REG_YMM7D3 = 395,
+
+ CV_REG_BND0 = 396,
+ CV_REG_BND1 = 397,
+ CV_REG_BND2 = 398,
+ CV_REG_BND3 = 399,
+
+ // registers for the 68K processors
+
+ CV_R68_D0 = 0,
+ CV_R68_D1 = 1,
+ CV_R68_D2 = 2,
+ CV_R68_D3 = 3,
+ CV_R68_D4 = 4,
+ CV_R68_D5 = 5,
+ CV_R68_D6 = 6,
+ CV_R68_D7 = 7,
+ CV_R68_A0 = 8,
+ CV_R68_A1 = 9,
+ CV_R68_A2 = 10,
+ CV_R68_A3 = 11,
+ CV_R68_A4 = 12,
+ CV_R68_A5 = 13,
+ CV_R68_A6 = 14,
+ CV_R68_A7 = 15,
+ CV_R68_CCR = 16,
+ CV_R68_SR = 17,
+ CV_R68_USP = 18,
+ CV_R68_MSP = 19,
+ CV_R68_SFC = 20,
+ CV_R68_DFC = 21,
+ CV_R68_CACR = 22,
+ CV_R68_VBR = 23,
+ CV_R68_CAAR = 24,
+ CV_R68_ISP = 25,
+ CV_R68_PC = 26,
+ //reserved 27
+ CV_R68_FPCR = 28,
+ CV_R68_FPSR = 29,
+ CV_R68_FPIAR = 30,
+ //reserved 31
+ CV_R68_FP0 = 32,
+ CV_R68_FP1 = 33,
+ CV_R68_FP2 = 34,
+ CV_R68_FP3 = 35,
+ CV_R68_FP4 = 36,
+ CV_R68_FP5 = 37,
+ CV_R68_FP6 = 38,
+ CV_R68_FP7 = 39,
+ //reserved 40
+ CV_R68_MMUSR030 = 41,
+ CV_R68_MMUSR = 42,
+ CV_R68_URP = 43,
+ CV_R68_DTT0 = 44,
+ CV_R68_DTT1 = 45,
+ CV_R68_ITT0 = 46,
+ CV_R68_ITT1 = 47,
+ //reserved 50
+ CV_R68_PSR = 51,
+ CV_R68_PCSR = 52,
+ CV_R68_VAL = 53,
+ CV_R68_CRP = 54,
+ CV_R68_SRP = 55,
+ CV_R68_DRP = 56,
+ CV_R68_TC = 57,
+ CV_R68_AC = 58,
+ CV_R68_SCC = 59,
+ CV_R68_CAL = 60,
+ CV_R68_TT0 = 61,
+ CV_R68_TT1 = 62,
+ //reserved 63
+ CV_R68_BAD0 = 64,
+ CV_R68_BAD1 = 65,
+ CV_R68_BAD2 = 66,
+ CV_R68_BAD3 = 67,
+ CV_R68_BAD4 = 68,
+ CV_R68_BAD5 = 69,
+ CV_R68_BAD6 = 70,
+ CV_R68_BAD7 = 71,
+ CV_R68_BAC0 = 72,
+ CV_R68_BAC1 = 73,
+ CV_R68_BAC2 = 74,
+ CV_R68_BAC3 = 75,
+ CV_R68_BAC4 = 76,
+ CV_R68_BAC5 = 77,
+ CV_R68_BAC6 = 78,
+ CV_R68_BAC7 = 79,
+
+ // Register set for the MIPS 4000
+
+ CV_M4_NOREG = CV_REG_NONE,
+
+ CV_M4_IntZERO = 10, /* CPU REGISTER */
+ CV_M4_IntAT = 11,
+ CV_M4_IntV0 = 12,
+ CV_M4_IntV1 = 13,
+ CV_M4_IntA0 = 14,
+ CV_M4_IntA1 = 15,
+ CV_M4_IntA2 = 16,
+ CV_M4_IntA3 = 17,
+ CV_M4_IntT0 = 18,
+ CV_M4_IntT1 = 19,
+ CV_M4_IntT2 = 20,
+ CV_M4_IntT3 = 21,
+ CV_M4_IntT4 = 22,
+ CV_M4_IntT5 = 23,
+ CV_M4_IntT6 = 24,
+ CV_M4_IntT7 = 25,
+ CV_M4_IntS0 = 26,
+ CV_M4_IntS1 = 27,
+ CV_M4_IntS2 = 28,
+ CV_M4_IntS3 = 29,
+ CV_M4_IntS4 = 30,
+ CV_M4_IntS5 = 31,
+ CV_M4_IntS6 = 32,
+ CV_M4_IntS7 = 33,
+ CV_M4_IntT8 = 34,
+ CV_M4_IntT9 = 35,
+ CV_M4_IntKT0 = 36,
+ CV_M4_IntKT1 = 37,
+ CV_M4_IntGP = 38,
+ CV_M4_IntSP = 39,
+ CV_M4_IntS8 = 40,
+ CV_M4_IntRA = 41,
+ CV_M4_IntLO = 42,
+ CV_M4_IntHI = 43,
+
+ CV_M4_Fir = 50,
+ CV_M4_Psr = 51,
+
+ CV_M4_FltF0 = 60, /* Floating point registers */
+ CV_M4_FltF1 = 61,
+ CV_M4_FltF2 = 62,
+ CV_M4_FltF3 = 63,
+ CV_M4_FltF4 = 64,
+ CV_M4_FltF5 = 65,
+ CV_M4_FltF6 = 66,
+ CV_M4_FltF7 = 67,
+ CV_M4_FltF8 = 68,
+ CV_M4_FltF9 = 69,
+ CV_M4_FltF10 = 70,
+ CV_M4_FltF11 = 71,
+ CV_M4_FltF12 = 72,
+ CV_M4_FltF13 = 73,
+ CV_M4_FltF14 = 74,
+ CV_M4_FltF15 = 75,
+ CV_M4_FltF16 = 76,
+ CV_M4_FltF17 = 77,
+ CV_M4_FltF18 = 78,
+ CV_M4_FltF19 = 79,
+ CV_M4_FltF20 = 80,
+ CV_M4_FltF21 = 81,
+ CV_M4_FltF22 = 82,
+ CV_M4_FltF23 = 83,
+ CV_M4_FltF24 = 84,
+ CV_M4_FltF25 = 85,
+ CV_M4_FltF26 = 86,
+ CV_M4_FltF27 = 87,
+ CV_M4_FltF28 = 88,
+ CV_M4_FltF29 = 89,
+ CV_M4_FltF30 = 90,
+ CV_M4_FltF31 = 91,
+ CV_M4_FltFsr = 92,
+
+
+ // Register set for the ALPHA AXP
+
+ CV_ALPHA_NOREG = CV_REG_NONE,
+
+ CV_ALPHA_FltF0 = 10, // Floating point registers
+ CV_ALPHA_FltF1 = 11,
+ CV_ALPHA_FltF2 = 12,
+ CV_ALPHA_FltF3 = 13,
+ CV_ALPHA_FltF4 = 14,
+ CV_ALPHA_FltF5 = 15,
+ CV_ALPHA_FltF6 = 16,
+ CV_ALPHA_FltF7 = 17,
+ CV_ALPHA_FltF8 = 18,
+ CV_ALPHA_FltF9 = 19,
+ CV_ALPHA_FltF10 = 20,
+ CV_ALPHA_FltF11 = 21,
+ CV_ALPHA_FltF12 = 22,
+ CV_ALPHA_FltF13 = 23,
+ CV_ALPHA_FltF14 = 24,
+ CV_ALPHA_FltF15 = 25,
+ CV_ALPHA_FltF16 = 26,
+ CV_ALPHA_FltF17 = 27,
+ CV_ALPHA_FltF18 = 28,
+ CV_ALPHA_FltF19 = 29,
+ CV_ALPHA_FltF20 = 30,
+ CV_ALPHA_FltF21 = 31,
+ CV_ALPHA_FltF22 = 32,
+ CV_ALPHA_FltF23 = 33,
+ CV_ALPHA_FltF24 = 34,
+ CV_ALPHA_FltF25 = 35,
+ CV_ALPHA_FltF26 = 36,
+ CV_ALPHA_FltF27 = 37,
+ CV_ALPHA_FltF28 = 38,
+ CV_ALPHA_FltF29 = 39,
+ CV_ALPHA_FltF30 = 40,
+ CV_ALPHA_FltF31 = 41,
+
+ CV_ALPHA_IntV0 = 42, // Integer registers
+ CV_ALPHA_IntT0 = 43,
+ CV_ALPHA_IntT1 = 44,
+ CV_ALPHA_IntT2 = 45,
+ CV_ALPHA_IntT3 = 46,
+ CV_ALPHA_IntT4 = 47,
+ CV_ALPHA_IntT5 = 48,
+ CV_ALPHA_IntT6 = 49,
+ CV_ALPHA_IntT7 = 50,
+ CV_ALPHA_IntS0 = 51,
+ CV_ALPHA_IntS1 = 52,
+ CV_ALPHA_IntS2 = 53,
+ CV_ALPHA_IntS3 = 54,
+ CV_ALPHA_IntS4 = 55,
+ CV_ALPHA_IntS5 = 56,
+ CV_ALPHA_IntFP = 57,
+ CV_ALPHA_IntA0 = 58,
+ CV_ALPHA_IntA1 = 59,
+ CV_ALPHA_IntA2 = 60,
+ CV_ALPHA_IntA3 = 61,
+ CV_ALPHA_IntA4 = 62,
+ CV_ALPHA_IntA5 = 63,
+ CV_ALPHA_IntT8 = 64,
+ CV_ALPHA_IntT9 = 65,
+ CV_ALPHA_IntT10 = 66,
+ CV_ALPHA_IntT11 = 67,
+ CV_ALPHA_IntRA = 68,
+ CV_ALPHA_IntT12 = 69,
+ CV_ALPHA_IntAT = 70,
+ CV_ALPHA_IntGP = 71,
+ CV_ALPHA_IntSP = 72,
+ CV_ALPHA_IntZERO = 73,
+
+
+ CV_ALPHA_Fpcr = 74, // Control registers
+ CV_ALPHA_Fir = 75,
+ CV_ALPHA_Psr = 76,
+ CV_ALPHA_FltFsr = 77,
+ CV_ALPHA_SoftFpcr = 78,
+
+ // Register Set for Motorola/IBM PowerPC
+
+ /*
+ ** PowerPC General Registers ( User Level )
+ */
+ CV_PPC_GPR0 = 1,
+ CV_PPC_GPR1 = 2,
+ CV_PPC_GPR2 = 3,
+ CV_PPC_GPR3 = 4,
+ CV_PPC_GPR4 = 5,
+ CV_PPC_GPR5 = 6,
+ CV_PPC_GPR6 = 7,
+ CV_PPC_GPR7 = 8,
+ CV_PPC_GPR8 = 9,
+ CV_PPC_GPR9 = 10,
+ CV_PPC_GPR10 = 11,
+ CV_PPC_GPR11 = 12,
+ CV_PPC_GPR12 = 13,
+ CV_PPC_GPR13 = 14,
+ CV_PPC_GPR14 = 15,
+ CV_PPC_GPR15 = 16,
+ CV_PPC_GPR16 = 17,
+ CV_PPC_GPR17 = 18,
+ CV_PPC_GPR18 = 19,
+ CV_PPC_GPR19 = 20,
+ CV_PPC_GPR20 = 21,
+ CV_PPC_GPR21 = 22,
+ CV_PPC_GPR22 = 23,
+ CV_PPC_GPR23 = 24,
+ CV_PPC_GPR24 = 25,
+ CV_PPC_GPR25 = 26,
+ CV_PPC_GPR26 = 27,
+ CV_PPC_GPR27 = 28,
+ CV_PPC_GPR28 = 29,
+ CV_PPC_GPR29 = 30,
+ CV_PPC_GPR30 = 31,
+ CV_PPC_GPR31 = 32,
+
+ /*
+ ** PowerPC Condition Register ( User Level )
+ */
+ CV_PPC_CR = 33,
+ CV_PPC_CR0 = 34,
+ CV_PPC_CR1 = 35,
+ CV_PPC_CR2 = 36,
+ CV_PPC_CR3 = 37,
+ CV_PPC_CR4 = 38,
+ CV_PPC_CR5 = 39,
+ CV_PPC_CR6 = 40,
+ CV_PPC_CR7 = 41,
+
+ /*
+ ** PowerPC Floating Point Registers ( User Level )
+ */
+ CV_PPC_FPR0 = 42,
+ CV_PPC_FPR1 = 43,
+ CV_PPC_FPR2 = 44,
+ CV_PPC_FPR3 = 45,
+ CV_PPC_FPR4 = 46,
+ CV_PPC_FPR5 = 47,
+ CV_PPC_FPR6 = 48,
+ CV_PPC_FPR7 = 49,
+ CV_PPC_FPR8 = 50,
+ CV_PPC_FPR9 = 51,
+ CV_PPC_FPR10 = 52,
+ CV_PPC_FPR11 = 53,
+ CV_PPC_FPR12 = 54,
+ CV_PPC_FPR13 = 55,
+ CV_PPC_FPR14 = 56,
+ CV_PPC_FPR15 = 57,
+ CV_PPC_FPR16 = 58,
+ CV_PPC_FPR17 = 59,
+ CV_PPC_FPR18 = 60,
+ CV_PPC_FPR19 = 61,
+ CV_PPC_FPR20 = 62,
+ CV_PPC_FPR21 = 63,
+ CV_PPC_FPR22 = 64,
+ CV_PPC_FPR23 = 65,
+ CV_PPC_FPR24 = 66,
+ CV_PPC_FPR25 = 67,
+ CV_PPC_FPR26 = 68,
+ CV_PPC_FPR27 = 69,
+ CV_PPC_FPR28 = 70,
+ CV_PPC_FPR29 = 71,
+ CV_PPC_FPR30 = 72,
+ CV_PPC_FPR31 = 73,
+
+ /*
+ ** PowerPC Floating Point Status and Control Register ( User Level )
+ */
+ CV_PPC_FPSCR = 74,
+
+ /*
+ ** PowerPC Machine State Register ( Supervisor Level )
+ */
+ CV_PPC_MSR = 75,
+
+ /*
+ ** PowerPC Segment Registers ( Supervisor Level )
+ */
+ CV_PPC_SR0 = 76,
+ CV_PPC_SR1 = 77,
+ CV_PPC_SR2 = 78,
+ CV_PPC_SR3 = 79,
+ CV_PPC_SR4 = 80,
+ CV_PPC_SR5 = 81,
+ CV_PPC_SR6 = 82,
+ CV_PPC_SR7 = 83,
+ CV_PPC_SR8 = 84,
+ CV_PPC_SR9 = 85,
+ CV_PPC_SR10 = 86,
+ CV_PPC_SR11 = 87,
+ CV_PPC_SR12 = 88,
+ CV_PPC_SR13 = 89,
+ CV_PPC_SR14 = 90,
+ CV_PPC_SR15 = 91,
+
+ /*
+ ** For all of the special purpose registers add 100 to the SPR# that the
+ ** Motorola/IBM documentation gives with the exception of any imaginary
+ ** registers.
+ */
+
+ /*
+ ** PowerPC Special Purpose Registers ( User Level )
+ */
+ CV_PPC_PC = 99, // PC (imaginary register)
+
+ CV_PPC_MQ = 100, // MPC601
+ CV_PPC_XER = 101,
+ CV_PPC_RTCU = 104, // MPC601
+ CV_PPC_RTCL = 105, // MPC601
+ CV_PPC_LR = 108,
+ CV_PPC_CTR = 109,
+
+ CV_PPC_COMPARE = 110, // part of XER (internal to the debugger only)
+ CV_PPC_COUNT = 111, // part of XER (internal to the debugger only)
+
+ /*
+ ** PowerPC Special Purpose Registers ( Supervisor Level )
+ */
+ CV_PPC_DSISR = 118,
+ CV_PPC_DAR = 119,
+ CV_PPC_DEC = 122,
+ CV_PPC_SDR1 = 125,
+ CV_PPC_SRR0 = 126,
+ CV_PPC_SRR1 = 127,
+ CV_PPC_SPRG0 = 372,
+ CV_PPC_SPRG1 = 373,
+ CV_PPC_SPRG2 = 374,
+ CV_PPC_SPRG3 = 375,
+ CV_PPC_ASR = 280, // 64-bit implementations only
+ CV_PPC_EAR = 382,
+ CV_PPC_PVR = 287,
+ CV_PPC_BAT0U = 628,
+ CV_PPC_BAT0L = 629,
+ CV_PPC_BAT1U = 630,
+ CV_PPC_BAT1L = 631,
+ CV_PPC_BAT2U = 632,
+ CV_PPC_BAT2L = 633,
+ CV_PPC_BAT3U = 634,
+ CV_PPC_BAT3L = 635,
+ CV_PPC_DBAT0U = 636,
+ CV_PPC_DBAT0L = 637,
+ CV_PPC_DBAT1U = 638,
+ CV_PPC_DBAT1L = 639,
+ CV_PPC_DBAT2U = 640,
+ CV_PPC_DBAT2L = 641,
+ CV_PPC_DBAT3U = 642,
+ CV_PPC_DBAT3L = 643,
+
+ /*
+ ** PowerPC Special Purpose Registers Implementation Dependent ( Supervisor Level )
+ */
+
+ /*
+ ** Doesn't appear that IBM/Motorola has finished defining these.
+ */
+
+ CV_PPC_PMR0 = 1044, // MPC620,
+ CV_PPC_PMR1 = 1045, // MPC620,
+ CV_PPC_PMR2 = 1046, // MPC620,
+ CV_PPC_PMR3 = 1047, // MPC620,
+ CV_PPC_PMR4 = 1048, // MPC620,
+ CV_PPC_PMR5 = 1049, // MPC620,
+ CV_PPC_PMR6 = 1050, // MPC620,
+ CV_PPC_PMR7 = 1051, // MPC620,
+ CV_PPC_PMR8 = 1052, // MPC620,
+ CV_PPC_PMR9 = 1053, // MPC620,
+ CV_PPC_PMR10 = 1054, // MPC620,
+ CV_PPC_PMR11 = 1055, // MPC620,
+ CV_PPC_PMR12 = 1056, // MPC620,
+ CV_PPC_PMR13 = 1057, // MPC620,
+ CV_PPC_PMR14 = 1058, // MPC620,
+ CV_PPC_PMR15 = 1059, // MPC620,
+
+ CV_PPC_DMISS = 1076, // MPC603
+ CV_PPC_DCMP = 1077, // MPC603
+ CV_PPC_HASH1 = 1078, // MPC603
+ CV_PPC_HASH2 = 1079, // MPC603
+ CV_PPC_IMISS = 1080, // MPC603
+ CV_PPC_ICMP = 1081, // MPC603
+ CV_PPC_RPA = 1082, // MPC603
+
+ CV_PPC_HID0 = 1108, // MPC601, MPC603, MPC620
+ CV_PPC_HID1 = 1109, // MPC601
+ CV_PPC_HID2 = 1110, // MPC601, MPC603, MPC620 ( IABR )
+ CV_PPC_HID3 = 1111, // Not Defined
+ CV_PPC_HID4 = 1112, // Not Defined
+ CV_PPC_HID5 = 1113, // MPC601, MPC604, MPC620 ( DABR )
+ CV_PPC_HID6 = 1114, // Not Defined
+ CV_PPC_HID7 = 1115, // Not Defined
+ CV_PPC_HID8 = 1116, // MPC620 ( BUSCSR )
+ CV_PPC_HID9 = 1117, // MPC620 ( L2CSR )
+ CV_PPC_HID10 = 1118, // Not Defined
+ CV_PPC_HID11 = 1119, // Not Defined
+ CV_PPC_HID12 = 1120, // Not Defined
+ CV_PPC_HID13 = 1121, // MPC604 ( HCR )
+ CV_PPC_HID14 = 1122, // Not Defined
+ CV_PPC_HID15 = 1123, // MPC601, MPC604, MPC620 ( PIR )
+
+ //
+ // JAVA VM registers
+ //
+
+ CV_JAVA_PC = 1,
+
+ //
+ // Register set for the Hitachi SH3
+ //
+
+ CV_SH3_NOREG = CV_REG_NONE,
+
+ CV_SH3_IntR0 = 10, // CPU REGISTER
+ CV_SH3_IntR1 = 11,
+ CV_SH3_IntR2 = 12,
+ CV_SH3_IntR3 = 13,
+ CV_SH3_IntR4 = 14,
+ CV_SH3_IntR5 = 15,
+ CV_SH3_IntR6 = 16,
+ CV_SH3_IntR7 = 17,
+ CV_SH3_IntR8 = 18,
+ CV_SH3_IntR9 = 19,
+ CV_SH3_IntR10 = 20,
+ CV_SH3_IntR11 = 21,
+ CV_SH3_IntR12 = 22,
+ CV_SH3_IntR13 = 23,
+ CV_SH3_IntFp = 24,
+ CV_SH3_IntSp = 25,
+ CV_SH3_Gbr = 38,
+ CV_SH3_Pr = 39,
+ CV_SH3_Mach = 40,
+ CV_SH3_Macl = 41,
+
+ CV_SH3_Pc = 50,
+ CV_SH3_Sr = 51,
+
+ CV_SH3_BarA = 60,
+ CV_SH3_BasrA = 61,
+ CV_SH3_BamrA = 62,
+ CV_SH3_BbrA = 63,
+ CV_SH3_BarB = 64,
+ CV_SH3_BasrB = 65,
+ CV_SH3_BamrB = 66,
+ CV_SH3_BbrB = 67,
+ CV_SH3_BdrB = 68,
+ CV_SH3_BdmrB = 69,
+ CV_SH3_Brcr = 70,
+
+ //
+ // Additional registers for Hitachi SH processors
+ //
+
+ CV_SH_Fpscr = 75, // floating point status/control register
+ CV_SH_Fpul = 76, // floating point communication register
+
+ CV_SH_FpR0 = 80, // Floating point registers
+ CV_SH_FpR1 = 81,
+ CV_SH_FpR2 = 82,
+ CV_SH_FpR3 = 83,
+ CV_SH_FpR4 = 84,
+ CV_SH_FpR5 = 85,
+ CV_SH_FpR6 = 86,
+ CV_SH_FpR7 = 87,
+ CV_SH_FpR8 = 88,
+ CV_SH_FpR9 = 89,
+ CV_SH_FpR10 = 90,
+ CV_SH_FpR11 = 91,
+ CV_SH_FpR12 = 92,
+ CV_SH_FpR13 = 93,
+ CV_SH_FpR14 = 94,
+ CV_SH_FpR15 = 95,
+
+ CV_SH_XFpR0 = 96,
+ CV_SH_XFpR1 = 97,
+ CV_SH_XFpR2 = 98,
+ CV_SH_XFpR3 = 99,
+ CV_SH_XFpR4 = 100,
+ CV_SH_XFpR5 = 101,
+ CV_SH_XFpR6 = 102,
+ CV_SH_XFpR7 = 103,
+ CV_SH_XFpR8 = 104,
+ CV_SH_XFpR9 = 105,
+ CV_SH_XFpR10 = 106,
+ CV_SH_XFpR11 = 107,
+ CV_SH_XFpR12 = 108,
+ CV_SH_XFpR13 = 109,
+ CV_SH_XFpR14 = 110,
+ CV_SH_XFpR15 = 111,
+
+ //
+ // Register set for the ARM processor.
+ //
+
+ CV_ARM_NOREG = CV_REG_NONE,
+
+ CV_ARM_R0 = 10,
+ CV_ARM_R1 = 11,
+ CV_ARM_R2 = 12,
+ CV_ARM_R3 = 13,
+ CV_ARM_R4 = 14,
+ CV_ARM_R5 = 15,
+ CV_ARM_R6 = 16,
+ CV_ARM_R7 = 17,
+ CV_ARM_R8 = 18,
+ CV_ARM_R9 = 19,
+ CV_ARM_R10 = 20,
+ CV_ARM_R11 = 21, // Frame pointer, if allocated
+ CV_ARM_R12 = 22,
+ CV_ARM_SP = 23, // Stack pointer
+ CV_ARM_LR = 24, // Link Register
+ CV_ARM_PC = 25, // Program counter
+ CV_ARM_CPSR = 26, // Current program status register
+
+ CV_ARM_ACC0 = 27, // DSP co-processor 0 40 bit accumulator
+
+ //
+ // Registers for ARM VFP10 support
+ //
+
+ CV_ARM_FPSCR = 40,
+ CV_ARM_FPEXC = 41,
+
+ CV_ARM_FS0 = 50,
+ CV_ARM_FS1 = 51,
+ CV_ARM_FS2 = 52,
+ CV_ARM_FS3 = 53,
+ CV_ARM_FS4 = 54,
+ CV_ARM_FS5 = 55,
+ CV_ARM_FS6 = 56,
+ CV_ARM_FS7 = 57,
+ CV_ARM_FS8 = 58,
+ CV_ARM_FS9 = 59,
+ CV_ARM_FS10 = 60,
+ CV_ARM_FS11 = 61,
+ CV_ARM_FS12 = 62,
+ CV_ARM_FS13 = 63,
+ CV_ARM_FS14 = 64,
+ CV_ARM_FS15 = 65,
+ CV_ARM_FS16 = 66,
+ CV_ARM_FS17 = 67,
+ CV_ARM_FS18 = 68,
+ CV_ARM_FS19 = 69,
+ CV_ARM_FS20 = 70,
+ CV_ARM_FS21 = 71,
+ CV_ARM_FS22 = 72,
+ CV_ARM_FS23 = 73,
+ CV_ARM_FS24 = 74,
+ CV_ARM_FS25 = 75,
+ CV_ARM_FS26 = 76,
+ CV_ARM_FS27 = 77,
+ CV_ARM_FS28 = 78,
+ CV_ARM_FS29 = 79,
+ CV_ARM_FS30 = 80,
+ CV_ARM_FS31 = 81,
+
+ //
+ // ARM VFP Floating Point Extra control registers
+ //
+
+ CV_ARM_FPEXTRA0 = 90,
+ CV_ARM_FPEXTRA1 = 91,
+ CV_ARM_FPEXTRA2 = 92,
+ CV_ARM_FPEXTRA3 = 93,
+ CV_ARM_FPEXTRA4 = 94,
+ CV_ARM_FPEXTRA5 = 95,
+ CV_ARM_FPEXTRA6 = 96,
+ CV_ARM_FPEXTRA7 = 97,
+
+ // XSCALE Concan co-processor registers
+ CV_ARM_WR0 = 128,
+ CV_ARM_WR1 = 129,
+ CV_ARM_WR2 = 130,
+ CV_ARM_WR3 = 131,
+ CV_ARM_WR4 = 132,
+ CV_ARM_WR5 = 133,
+ CV_ARM_WR6 = 134,
+ CV_ARM_WR7 = 135,
+ CV_ARM_WR8 = 136,
+ CV_ARM_WR9 = 137,
+ CV_ARM_WR10 = 138,
+ CV_ARM_WR11 = 139,
+ CV_ARM_WR12 = 140,
+ CV_ARM_WR13 = 141,
+ CV_ARM_WR14 = 142,
+ CV_ARM_WR15 = 143,
+
+ // XSCALE Concan co-processor control registers
+ CV_ARM_WCID = 144,
+ CV_ARM_WCON = 145,
+ CV_ARM_WCSSF = 146,
+ CV_ARM_WCASF = 147,
+ CV_ARM_WC4 = 148,
+ CV_ARM_WC5 = 149,
+ CV_ARM_WC6 = 150,
+ CV_ARM_WC7 = 151,
+ CV_ARM_WCGR0 = 152,
+ CV_ARM_WCGR1 = 153,
+ CV_ARM_WCGR2 = 154,
+ CV_ARM_WCGR3 = 155,
+ CV_ARM_WC12 = 156,
+ CV_ARM_WC13 = 157,
+ CV_ARM_WC14 = 158,
+ CV_ARM_WC15 = 159,
+
+ //
+ // ARM VFPv3/Neon extended floating Point
+ //
+
+ CV_ARM_FS32 = 200,
+ CV_ARM_FS33 = 201,
+ CV_ARM_FS34 = 202,
+ CV_ARM_FS35 = 203,
+ CV_ARM_FS36 = 204,
+ CV_ARM_FS37 = 205,
+ CV_ARM_FS38 = 206,
+ CV_ARM_FS39 = 207,
+ CV_ARM_FS40 = 208,
+ CV_ARM_FS41 = 209,
+ CV_ARM_FS42 = 210,
+ CV_ARM_FS43 = 211,
+ CV_ARM_FS44 = 212,
+ CV_ARM_FS45 = 213,
+ CV_ARM_FS46 = 214,
+ CV_ARM_FS47 = 215,
+ CV_ARM_FS48 = 216,
+ CV_ARM_FS49 = 217,
+ CV_ARM_FS50 = 218,
+ CV_ARM_FS51 = 219,
+ CV_ARM_FS52 = 220,
+ CV_ARM_FS53 = 221,
+ CV_ARM_FS54 = 222,
+ CV_ARM_FS55 = 223,
+ CV_ARM_FS56 = 224,
+ CV_ARM_FS57 = 225,
+ CV_ARM_FS58 = 226,
+ CV_ARM_FS59 = 227,
+ CV_ARM_FS60 = 228,
+ CV_ARM_FS61 = 229,
+ CV_ARM_FS62 = 230,
+ CV_ARM_FS63 = 231,
+
+ // ARM double-precision floating point
+
+ CV_ARM_ND0 = 300,
+ CV_ARM_ND1 = 301,
+ CV_ARM_ND2 = 302,
+ CV_ARM_ND3 = 303,
+ CV_ARM_ND4 = 304,
+ CV_ARM_ND5 = 305,
+ CV_ARM_ND6 = 306,
+ CV_ARM_ND7 = 307,
+ CV_ARM_ND8 = 308,
+ CV_ARM_ND9 = 309,
+ CV_ARM_ND10 = 310,
+ CV_ARM_ND11 = 311,
+ CV_ARM_ND12 = 312,
+ CV_ARM_ND13 = 313,
+ CV_ARM_ND14 = 314,
+ CV_ARM_ND15 = 315,
+ CV_ARM_ND16 = 316,
+ CV_ARM_ND17 = 317,
+ CV_ARM_ND18 = 318,
+ CV_ARM_ND19 = 319,
+ CV_ARM_ND20 = 320,
+ CV_ARM_ND21 = 321,
+ CV_ARM_ND22 = 322,
+ CV_ARM_ND23 = 323,
+ CV_ARM_ND24 = 324,
+ CV_ARM_ND25 = 325,
+ CV_ARM_ND26 = 326,
+ CV_ARM_ND27 = 327,
+ CV_ARM_ND28 = 328,
+ CV_ARM_ND29 = 329,
+ CV_ARM_ND30 = 330,
+ CV_ARM_ND31 = 331,
+
+ // ARM extended precision floating point
+
+ CV_ARM_NQ0 = 400,
+ CV_ARM_NQ1 = 401,
+ CV_ARM_NQ2 = 402,
+ CV_ARM_NQ3 = 403,
+ CV_ARM_NQ4 = 404,
+ CV_ARM_NQ5 = 405,
+ CV_ARM_NQ6 = 406,
+ CV_ARM_NQ7 = 407,
+ CV_ARM_NQ8 = 408,
+ CV_ARM_NQ9 = 409,
+ CV_ARM_NQ10 = 410,
+ CV_ARM_NQ11 = 411,
+ CV_ARM_NQ12 = 412,
+ CV_ARM_NQ13 = 413,
+ CV_ARM_NQ14 = 414,
+ CV_ARM_NQ15 = 415,
+
+ //
+ // Register set for ARM64
+ //
+
+ CV_ARM64_NOREG = CV_REG_NONE,
+
+ // General purpose 32-bit integer registers
+
+ CV_ARM64_W0 = 10,
+ CV_ARM64_W1 = 11,
+ CV_ARM64_W2 = 12,
+ CV_ARM64_W3 = 13,
+ CV_ARM64_W4 = 14,
+ CV_ARM64_W5 = 15,
+ CV_ARM64_W6 = 16,
+ CV_ARM64_W7 = 17,
+ CV_ARM64_W8 = 18,
+ CV_ARM64_W9 = 19,
+ CV_ARM64_W10 = 20,
+ CV_ARM64_W11 = 21,
+ CV_ARM64_W12 = 22,
+ CV_ARM64_W13 = 23,
+ CV_ARM64_W14 = 24,
+ CV_ARM64_W15 = 25,
+ CV_ARM64_W16 = 26,
+ CV_ARM64_W17 = 27,
+ CV_ARM64_W18 = 28,
+ CV_ARM64_W19 = 29,
+ CV_ARM64_W20 = 30,
+ CV_ARM64_W21 = 31,
+ CV_ARM64_W22 = 32,
+ CV_ARM64_W23 = 33,
+ CV_ARM64_W24 = 34,
+ CV_ARM64_W25 = 35,
+ CV_ARM64_W26 = 36,
+ CV_ARM64_W27 = 37,
+ CV_ARM64_W28 = 38,
+ CV_ARM64_W29 = 39,
+ CV_ARM64_W30 = 40,
+ CV_ARM64_WZR = 41,
+
+ // General purpose 64-bit integer registers
+
+ CV_ARM64_X0 = 50,
+ CV_ARM64_X1 = 51,
+ CV_ARM64_X2 = 52,
+ CV_ARM64_X3 = 53,
+ CV_ARM64_X4 = 54,
+ CV_ARM64_X5 = 55,
+ CV_ARM64_X6 = 56,
+ CV_ARM64_X7 = 57,
+ CV_ARM64_X8 = 58,
+ CV_ARM64_X9 = 59,
+ CV_ARM64_X10 = 60,
+ CV_ARM64_X11 = 61,
+ CV_ARM64_X12 = 62,
+ CV_ARM64_X13 = 63,
+ CV_ARM64_X14 = 64,
+ CV_ARM64_X15 = 65,
+ CV_ARM64_IP0 = 66,
+ CV_ARM64_IP1 = 67,
+ CV_ARM64_X18 = 68,
+ CV_ARM64_X19 = 69,
+ CV_ARM64_X20 = 70,
+ CV_ARM64_X21 = 71,
+ CV_ARM64_X22 = 72,
+ CV_ARM64_X23 = 73,
+ CV_ARM64_X24 = 74,
+ CV_ARM64_X25 = 75,
+ CV_ARM64_X26 = 76,
+ CV_ARM64_X27 = 77,
+ CV_ARM64_X28 = 78,
+ CV_ARM64_FP = 79,
+ CV_ARM64_LR = 80,
+ CV_ARM64_SP = 81,
+ CV_ARM64_ZR = 82,
+
+ // statue register
+
+ CV_ARM64_NZCV = 90,
+
+ // 32-bit floating point registers
+
+ CV_ARM64_S0 = 100,
+ CV_ARM64_S1 = 101,
+ CV_ARM64_S2 = 102,
+ CV_ARM64_S3 = 103,
+ CV_ARM64_S4 = 104,
+ CV_ARM64_S5 = 105,
+ CV_ARM64_S6 = 106,
+ CV_ARM64_S7 = 107,
+ CV_ARM64_S8 = 108,
+ CV_ARM64_S9 = 109,
+ CV_ARM64_S10 = 110,
+ CV_ARM64_S11 = 111,
+ CV_ARM64_S12 = 112,
+ CV_ARM64_S13 = 113,
+ CV_ARM64_S14 = 114,
+ CV_ARM64_S15 = 115,
+ CV_ARM64_S16 = 116,
+ CV_ARM64_S17 = 117,
+ CV_ARM64_S18 = 118,
+ CV_ARM64_S19 = 119,
+ CV_ARM64_S20 = 120,
+ CV_ARM64_S21 = 121,
+ CV_ARM64_S22 = 122,
+ CV_ARM64_S23 = 123,
+ CV_ARM64_S24 = 124,
+ CV_ARM64_S25 = 125,
+ CV_ARM64_S26 = 126,
+ CV_ARM64_S27 = 127,
+ CV_ARM64_S28 = 128,
+ CV_ARM64_S29 = 129,
+ CV_ARM64_S30 = 130,
+ CV_ARM64_S31 = 131,
+
+ // 64-bit floating point registers
+
+ CV_ARM64_D0 = 140,
+ CV_ARM64_D1 = 141,
+ CV_ARM64_D2 = 142,
+ CV_ARM64_D3 = 143,
+ CV_ARM64_D4 = 144,
+ CV_ARM64_D5 = 145,
+ CV_ARM64_D6 = 146,
+ CV_ARM64_D7 = 147,
+ CV_ARM64_D8 = 148,
+ CV_ARM64_D9 = 149,
+ CV_ARM64_D10 = 150,
+ CV_ARM64_D11 = 151,
+ CV_ARM64_D12 = 152,
+ CV_ARM64_D13 = 153,
+ CV_ARM64_D14 = 154,
+ CV_ARM64_D15 = 155,
+ CV_ARM64_D16 = 156,
+ CV_ARM64_D17 = 157,
+ CV_ARM64_D18 = 158,
+ CV_ARM64_D19 = 159,
+ CV_ARM64_D20 = 160,
+ CV_ARM64_D21 = 161,
+ CV_ARM64_D22 = 162,
+ CV_ARM64_D23 = 163,
+ CV_ARM64_D24 = 164,
+ CV_ARM64_D25 = 165,
+ CV_ARM64_D26 = 166,
+ CV_ARM64_D27 = 167,
+ CV_ARM64_D28 = 168,
+ CV_ARM64_D29 = 169,
+ CV_ARM64_D30 = 170,
+ CV_ARM64_D31 = 171,
+
+ // 128-bit SIMD registers
+
+ CV_ARM64_Q0 = 180,
+ CV_ARM64_Q1 = 181,
+ CV_ARM64_Q2 = 182,
+ CV_ARM64_Q3 = 183,
+ CV_ARM64_Q4 = 184,
+ CV_ARM64_Q5 = 185,
+ CV_ARM64_Q6 = 186,
+ CV_ARM64_Q7 = 187,
+ CV_ARM64_Q8 = 188,
+ CV_ARM64_Q9 = 189,
+ CV_ARM64_Q10 = 190,
+ CV_ARM64_Q11 = 191,
+ CV_ARM64_Q12 = 192,
+ CV_ARM64_Q13 = 193,
+ CV_ARM64_Q14 = 194,
+ CV_ARM64_Q15 = 195,
+ CV_ARM64_Q16 = 196,
+ CV_ARM64_Q17 = 197,
+ CV_ARM64_Q18 = 198,
+ CV_ARM64_Q19 = 199,
+ CV_ARM64_Q20 = 200,
+ CV_ARM64_Q21 = 201,
+ CV_ARM64_Q22 = 202,
+ CV_ARM64_Q23 = 203,
+ CV_ARM64_Q24 = 204,
+ CV_ARM64_Q25 = 205,
+ CV_ARM64_Q26 = 206,
+ CV_ARM64_Q27 = 207,
+ CV_ARM64_Q28 = 208,
+ CV_ARM64_Q29 = 209,
+ CV_ARM64_Q30 = 210,
+ CV_ARM64_Q31 = 211,
+
+ // Floating point status register
+
+ CV_ARM64_FPSR = 220,
+
+ //
+ // Register set for Intel IA64
+ //
+
+ CV_IA64_NOREG = CV_REG_NONE,
+
+ // Branch Registers
+
+ CV_IA64_Br0 = 512,
+ CV_IA64_Br1 = 513,
+ CV_IA64_Br2 = 514,
+ CV_IA64_Br3 = 515,
+ CV_IA64_Br4 = 516,
+ CV_IA64_Br5 = 517,
+ CV_IA64_Br6 = 518,
+ CV_IA64_Br7 = 519,
+
+ // Predicate Registers
+
+ CV_IA64_P0 = 704,
+ CV_IA64_P1 = 705,
+ CV_IA64_P2 = 706,
+ CV_IA64_P3 = 707,
+ CV_IA64_P4 = 708,
+ CV_IA64_P5 = 709,
+ CV_IA64_P6 = 710,
+ CV_IA64_P7 = 711,
+ CV_IA64_P8 = 712,
+ CV_IA64_P9 = 713,
+ CV_IA64_P10 = 714,
+ CV_IA64_P11 = 715,
+ CV_IA64_P12 = 716,
+ CV_IA64_P13 = 717,
+ CV_IA64_P14 = 718,
+ CV_IA64_P15 = 719,
+ CV_IA64_P16 = 720,
+ CV_IA64_P17 = 721,
+ CV_IA64_P18 = 722,
+ CV_IA64_P19 = 723,
+ CV_IA64_P20 = 724,
+ CV_IA64_P21 = 725,
+ CV_IA64_P22 = 726,
+ CV_IA64_P23 = 727,
+ CV_IA64_P24 = 728,
+ CV_IA64_P25 = 729,
+ CV_IA64_P26 = 730,
+ CV_IA64_P27 = 731,
+ CV_IA64_P28 = 732,
+ CV_IA64_P29 = 733,
+ CV_IA64_P30 = 734,
+ CV_IA64_P31 = 735,
+ CV_IA64_P32 = 736,
+ CV_IA64_P33 = 737,
+ CV_IA64_P34 = 738,
+ CV_IA64_P35 = 739,
+ CV_IA64_P36 = 740,
+ CV_IA64_P37 = 741,
+ CV_IA64_P38 = 742,
+ CV_IA64_P39 = 743,
+ CV_IA64_P40 = 744,
+ CV_IA64_P41 = 745,
+ CV_IA64_P42 = 746,
+ CV_IA64_P43 = 747,
+ CV_IA64_P44 = 748,
+ CV_IA64_P45 = 749,
+ CV_IA64_P46 = 750,
+ CV_IA64_P47 = 751,
+ CV_IA64_P48 = 752,
+ CV_IA64_P49 = 753,
+ CV_IA64_P50 = 754,
+ CV_IA64_P51 = 755,
+ CV_IA64_P52 = 756,
+ CV_IA64_P53 = 757,
+ CV_IA64_P54 = 758,
+ CV_IA64_P55 = 759,
+ CV_IA64_P56 = 760,
+ CV_IA64_P57 = 761,
+ CV_IA64_P58 = 762,
+ CV_IA64_P59 = 763,
+ CV_IA64_P60 = 764,
+ CV_IA64_P61 = 765,
+ CV_IA64_P62 = 766,
+ CV_IA64_P63 = 767,
+
+ CV_IA64_Preds = 768,
+
+ // Banked General Registers
+
+ CV_IA64_IntH0 = 832,
+ CV_IA64_IntH1 = 833,
+ CV_IA64_IntH2 = 834,
+ CV_IA64_IntH3 = 835,
+ CV_IA64_IntH4 = 836,
+ CV_IA64_IntH5 = 837,
+ CV_IA64_IntH6 = 838,
+ CV_IA64_IntH7 = 839,
+ CV_IA64_IntH8 = 840,
+ CV_IA64_IntH9 = 841,
+ CV_IA64_IntH10 = 842,
+ CV_IA64_IntH11 = 843,
+ CV_IA64_IntH12 = 844,
+ CV_IA64_IntH13 = 845,
+ CV_IA64_IntH14 = 846,
+ CV_IA64_IntH15 = 847,
+
+ // Special Registers
+
+ CV_IA64_Ip = 1016,
+ CV_IA64_Umask = 1017,
+ CV_IA64_Cfm = 1018,
+ CV_IA64_Psr = 1019,
+
+ // Banked General Registers
+
+ CV_IA64_Nats = 1020,
+ CV_IA64_Nats2 = 1021,
+ CV_IA64_Nats3 = 1022,
+
+ // General-Purpose Registers
+
+ // Integer registers
+ CV_IA64_IntR0 = 1024,
+ CV_IA64_IntR1 = 1025,
+ CV_IA64_IntR2 = 1026,
+ CV_IA64_IntR3 = 1027,
+ CV_IA64_IntR4 = 1028,
+ CV_IA64_IntR5 = 1029,
+ CV_IA64_IntR6 = 1030,
+ CV_IA64_IntR7 = 1031,
+ CV_IA64_IntR8 = 1032,
+ CV_IA64_IntR9 = 1033,
+ CV_IA64_IntR10 = 1034,
+ CV_IA64_IntR11 = 1035,
+ CV_IA64_IntR12 = 1036,
+ CV_IA64_IntR13 = 1037,
+ CV_IA64_IntR14 = 1038,
+ CV_IA64_IntR15 = 1039,
+ CV_IA64_IntR16 = 1040,
+ CV_IA64_IntR17 = 1041,
+ CV_IA64_IntR18 = 1042,
+ CV_IA64_IntR19 = 1043,
+ CV_IA64_IntR20 = 1044,
+ CV_IA64_IntR21 = 1045,
+ CV_IA64_IntR22 = 1046,
+ CV_IA64_IntR23 = 1047,
+ CV_IA64_IntR24 = 1048,
+ CV_IA64_IntR25 = 1049,
+ CV_IA64_IntR26 = 1050,
+ CV_IA64_IntR27 = 1051,
+ CV_IA64_IntR28 = 1052,
+ CV_IA64_IntR29 = 1053,
+ CV_IA64_IntR30 = 1054,
+ CV_IA64_IntR31 = 1055,
+
+ // Register Stack
+ CV_IA64_IntR32 = 1056,
+ CV_IA64_IntR33 = 1057,
+ CV_IA64_IntR34 = 1058,
+ CV_IA64_IntR35 = 1059,
+ CV_IA64_IntR36 = 1060,
+ CV_IA64_IntR37 = 1061,
+ CV_IA64_IntR38 = 1062,
+ CV_IA64_IntR39 = 1063,
+ CV_IA64_IntR40 = 1064,
+ CV_IA64_IntR41 = 1065,
+ CV_IA64_IntR42 = 1066,
+ CV_IA64_IntR43 = 1067,
+ CV_IA64_IntR44 = 1068,
+ CV_IA64_IntR45 = 1069,
+ CV_IA64_IntR46 = 1070,
+ CV_IA64_IntR47 = 1071,
+ CV_IA64_IntR48 = 1072,
+ CV_IA64_IntR49 = 1073,
+ CV_IA64_IntR50 = 1074,
+ CV_IA64_IntR51 = 1075,
+ CV_IA64_IntR52 = 1076,
+ CV_IA64_IntR53 = 1077,
+ CV_IA64_IntR54 = 1078,
+ CV_IA64_IntR55 = 1079,
+ CV_IA64_IntR56 = 1080,
+ CV_IA64_IntR57 = 1081,
+ CV_IA64_IntR58 = 1082,
+ CV_IA64_IntR59 = 1083,
+ CV_IA64_IntR60 = 1084,
+ CV_IA64_IntR61 = 1085,
+ CV_IA64_IntR62 = 1086,
+ CV_IA64_IntR63 = 1087,
+ CV_IA64_IntR64 = 1088,
+ CV_IA64_IntR65 = 1089,
+ CV_IA64_IntR66 = 1090,
+ CV_IA64_IntR67 = 1091,
+ CV_IA64_IntR68 = 1092,
+ CV_IA64_IntR69 = 1093,
+ CV_IA64_IntR70 = 1094,
+ CV_IA64_IntR71 = 1095,
+ CV_IA64_IntR72 = 1096,
+ CV_IA64_IntR73 = 1097,
+ CV_IA64_IntR74 = 1098,
+ CV_IA64_IntR75 = 1099,
+ CV_IA64_IntR76 = 1100,
+ CV_IA64_IntR77 = 1101,
+ CV_IA64_IntR78 = 1102,
+ CV_IA64_IntR79 = 1103,
+ CV_IA64_IntR80 = 1104,
+ CV_IA64_IntR81 = 1105,
+ CV_IA64_IntR82 = 1106,
+ CV_IA64_IntR83 = 1107,
+ CV_IA64_IntR84 = 1108,
+ CV_IA64_IntR85 = 1109,
+ CV_IA64_IntR86 = 1110,
+ CV_IA64_IntR87 = 1111,
+ CV_IA64_IntR88 = 1112,
+ CV_IA64_IntR89 = 1113,
+ CV_IA64_IntR90 = 1114,
+ CV_IA64_IntR91 = 1115,
+ CV_IA64_IntR92 = 1116,
+ CV_IA64_IntR93 = 1117,
+ CV_IA64_IntR94 = 1118,
+ CV_IA64_IntR95 = 1119,
+ CV_IA64_IntR96 = 1120,
+ CV_IA64_IntR97 = 1121,
+ CV_IA64_IntR98 = 1122,
+ CV_IA64_IntR99 = 1123,
+ CV_IA64_IntR100 = 1124,
+ CV_IA64_IntR101 = 1125,
+ CV_IA64_IntR102 = 1126,
+ CV_IA64_IntR103 = 1127,
+ CV_IA64_IntR104 = 1128,
+ CV_IA64_IntR105 = 1129,
+ CV_IA64_IntR106 = 1130,
+ CV_IA64_IntR107 = 1131,
+ CV_IA64_IntR108 = 1132,
+ CV_IA64_IntR109 = 1133,
+ CV_IA64_IntR110 = 1134,
+ CV_IA64_IntR111 = 1135,
+ CV_IA64_IntR112 = 1136,
+ CV_IA64_IntR113 = 1137,
+ CV_IA64_IntR114 = 1138,
+ CV_IA64_IntR115 = 1139,
+ CV_IA64_IntR116 = 1140,
+ CV_IA64_IntR117 = 1141,
+ CV_IA64_IntR118 = 1142,
+ CV_IA64_IntR119 = 1143,
+ CV_IA64_IntR120 = 1144,
+ CV_IA64_IntR121 = 1145,
+ CV_IA64_IntR122 = 1146,
+ CV_IA64_IntR123 = 1147,
+ CV_IA64_IntR124 = 1148,
+ CV_IA64_IntR125 = 1149,
+ CV_IA64_IntR126 = 1150,
+ CV_IA64_IntR127 = 1151,
+
+ // Floating-Point Registers
+
+ // Low Floating Point Registers
+ CV_IA64_FltF0 = 2048,
+ CV_IA64_FltF1 = 2049,
+ CV_IA64_FltF2 = 2050,
+ CV_IA64_FltF3 = 2051,
+ CV_IA64_FltF4 = 2052,
+ CV_IA64_FltF5 = 2053,
+ CV_IA64_FltF6 = 2054,
+ CV_IA64_FltF7 = 2055,
+ CV_IA64_FltF8 = 2056,
+ CV_IA64_FltF9 = 2057,
+ CV_IA64_FltF10 = 2058,
+ CV_IA64_FltF11 = 2059,
+ CV_IA64_FltF12 = 2060,
+ CV_IA64_FltF13 = 2061,
+ CV_IA64_FltF14 = 2062,
+ CV_IA64_FltF15 = 2063,
+ CV_IA64_FltF16 = 2064,
+ CV_IA64_FltF17 = 2065,
+ CV_IA64_FltF18 = 2066,
+ CV_IA64_FltF19 = 2067,
+ CV_IA64_FltF20 = 2068,
+ CV_IA64_FltF21 = 2069,
+ CV_IA64_FltF22 = 2070,
+ CV_IA64_FltF23 = 2071,
+ CV_IA64_FltF24 = 2072,
+ CV_IA64_FltF25 = 2073,
+ CV_IA64_FltF26 = 2074,
+ CV_IA64_FltF27 = 2075,
+ CV_IA64_FltF28 = 2076,
+ CV_IA64_FltF29 = 2077,
+ CV_IA64_FltF30 = 2078,
+ CV_IA64_FltF31 = 2079,
+
+ // High Floating Point Registers
+ CV_IA64_FltF32 = 2080,
+ CV_IA64_FltF33 = 2081,
+ CV_IA64_FltF34 = 2082,
+ CV_IA64_FltF35 = 2083,
+ CV_IA64_FltF36 = 2084,
+ CV_IA64_FltF37 = 2085,
+ CV_IA64_FltF38 = 2086,
+ CV_IA64_FltF39 = 2087,
+ CV_IA64_FltF40 = 2088,
+ CV_IA64_FltF41 = 2089,
+ CV_IA64_FltF42 = 2090,
+ CV_IA64_FltF43 = 2091,
+ CV_IA64_FltF44 = 2092,
+ CV_IA64_FltF45 = 2093,
+ CV_IA64_FltF46 = 2094,
+ CV_IA64_FltF47 = 2095,
+ CV_IA64_FltF48 = 2096,
+ CV_IA64_FltF49 = 2097,
+ CV_IA64_FltF50 = 2098,
+ CV_IA64_FltF51 = 2099,
+ CV_IA64_FltF52 = 2100,
+ CV_IA64_FltF53 = 2101,
+ CV_IA64_FltF54 = 2102,
+ CV_IA64_FltF55 = 2103,
+ CV_IA64_FltF56 = 2104,
+ CV_IA64_FltF57 = 2105,
+ CV_IA64_FltF58 = 2106,
+ CV_IA64_FltF59 = 2107,
+ CV_IA64_FltF60 = 2108,
+ CV_IA64_FltF61 = 2109,
+ CV_IA64_FltF62 = 2110,
+ CV_IA64_FltF63 = 2111,
+ CV_IA64_FltF64 = 2112,
+ CV_IA64_FltF65 = 2113,
+ CV_IA64_FltF66 = 2114,
+ CV_IA64_FltF67 = 2115,
+ CV_IA64_FltF68 = 2116,
+ CV_IA64_FltF69 = 2117,
+ CV_IA64_FltF70 = 2118,
+ CV_IA64_FltF71 = 2119,
+ CV_IA64_FltF72 = 2120,
+ CV_IA64_FltF73 = 2121,
+ CV_IA64_FltF74 = 2122,
+ CV_IA64_FltF75 = 2123,
+ CV_IA64_FltF76 = 2124,
+ CV_IA64_FltF77 = 2125,
+ CV_IA64_FltF78 = 2126,
+ CV_IA64_FltF79 = 2127,
+ CV_IA64_FltF80 = 2128,
+ CV_IA64_FltF81 = 2129,
+ CV_IA64_FltF82 = 2130,
+ CV_IA64_FltF83 = 2131,
+ CV_IA64_FltF84 = 2132,
+ CV_IA64_FltF85 = 2133,
+ CV_IA64_FltF86 = 2134,
+ CV_IA64_FltF87 = 2135,
+ CV_IA64_FltF88 = 2136,
+ CV_IA64_FltF89 = 2137,
+ CV_IA64_FltF90 = 2138,
+ CV_IA64_FltF91 = 2139,
+ CV_IA64_FltF92 = 2140,
+ CV_IA64_FltF93 = 2141,
+ CV_IA64_FltF94 = 2142,
+ CV_IA64_FltF95 = 2143,
+ CV_IA64_FltF96 = 2144,
+ CV_IA64_FltF97 = 2145,
+ CV_IA64_FltF98 = 2146,
+ CV_IA64_FltF99 = 2147,
+ CV_IA64_FltF100 = 2148,
+ CV_IA64_FltF101 = 2149,
+ CV_IA64_FltF102 = 2150,
+ CV_IA64_FltF103 = 2151,
+ CV_IA64_FltF104 = 2152,
+ CV_IA64_FltF105 = 2153,
+ CV_IA64_FltF106 = 2154,
+ CV_IA64_FltF107 = 2155,
+ CV_IA64_FltF108 = 2156,
+ CV_IA64_FltF109 = 2157,
+ CV_IA64_FltF110 = 2158,
+ CV_IA64_FltF111 = 2159,
+ CV_IA64_FltF112 = 2160,
+ CV_IA64_FltF113 = 2161,
+ CV_IA64_FltF114 = 2162,
+ CV_IA64_FltF115 = 2163,
+ CV_IA64_FltF116 = 2164,
+ CV_IA64_FltF117 = 2165,
+ CV_IA64_FltF118 = 2166,
+ CV_IA64_FltF119 = 2167,
+ CV_IA64_FltF120 = 2168,
+ CV_IA64_FltF121 = 2169,
+ CV_IA64_FltF122 = 2170,
+ CV_IA64_FltF123 = 2171,
+ CV_IA64_FltF124 = 2172,
+ CV_IA64_FltF125 = 2173,
+ CV_IA64_FltF126 = 2174,
+ CV_IA64_FltF127 = 2175,
+
+ // Application Registers
+
+ CV_IA64_ApKR0 = 3072,
+ CV_IA64_ApKR1 = 3073,
+ CV_IA64_ApKR2 = 3074,
+ CV_IA64_ApKR3 = 3075,
+ CV_IA64_ApKR4 = 3076,
+ CV_IA64_ApKR5 = 3077,
+ CV_IA64_ApKR6 = 3078,
+ CV_IA64_ApKR7 = 3079,
+ CV_IA64_AR8 = 3080,
+ CV_IA64_AR9 = 3081,
+ CV_IA64_AR10 = 3082,
+ CV_IA64_AR11 = 3083,
+ CV_IA64_AR12 = 3084,
+ CV_IA64_AR13 = 3085,
+ CV_IA64_AR14 = 3086,
+ CV_IA64_AR15 = 3087,
+ CV_IA64_RsRSC = 3088,
+ CV_IA64_RsBSP = 3089,
+ CV_IA64_RsBSPSTORE = 3090,
+ CV_IA64_RsRNAT = 3091,
+ CV_IA64_AR20 = 3092,
+ CV_IA64_StFCR = 3093,
+ CV_IA64_AR22 = 3094,
+ CV_IA64_AR23 = 3095,
+ CV_IA64_EFLAG = 3096,
+ CV_IA64_CSD = 3097,
+ CV_IA64_SSD = 3098,
+ CV_IA64_CFLG = 3099,
+ CV_IA64_StFSR = 3100,
+ CV_IA64_StFIR = 3101,
+ CV_IA64_StFDR = 3102,
+ CV_IA64_AR31 = 3103,
+ CV_IA64_ApCCV = 3104,
+ CV_IA64_AR33 = 3105,
+ CV_IA64_AR34 = 3106,
+ CV_IA64_AR35 = 3107,
+ CV_IA64_ApUNAT = 3108,
+ CV_IA64_AR37 = 3109,
+ CV_IA64_AR38 = 3110,
+ CV_IA64_AR39 = 3111,
+ CV_IA64_StFPSR = 3112,
+ CV_IA64_AR41 = 3113,
+ CV_IA64_AR42 = 3114,
+ CV_IA64_AR43 = 3115,
+ CV_IA64_ApITC = 3116,
+ CV_IA64_AR45 = 3117,
+ CV_IA64_AR46 = 3118,
+ CV_IA64_AR47 = 3119,
+ CV_IA64_AR48 = 3120,
+ CV_IA64_AR49 = 3121,
+ CV_IA64_AR50 = 3122,
+ CV_IA64_AR51 = 3123,
+ CV_IA64_AR52 = 3124,
+ CV_IA64_AR53 = 3125,
+ CV_IA64_AR54 = 3126,
+ CV_IA64_AR55 = 3127,
+ CV_IA64_AR56 = 3128,
+ CV_IA64_AR57 = 3129,
+ CV_IA64_AR58 = 3130,
+ CV_IA64_AR59 = 3131,
+ CV_IA64_AR60 = 3132,
+ CV_IA64_AR61 = 3133,
+ CV_IA64_AR62 = 3134,
+ CV_IA64_AR63 = 3135,
+ CV_IA64_RsPFS = 3136,
+ CV_IA64_ApLC = 3137,
+ CV_IA64_ApEC = 3138,
+ CV_IA64_AR67 = 3139,
+ CV_IA64_AR68 = 3140,
+ CV_IA64_AR69 = 3141,
+ CV_IA64_AR70 = 3142,
+ CV_IA64_AR71 = 3143,
+ CV_IA64_AR72 = 3144,
+ CV_IA64_AR73 = 3145,
+ CV_IA64_AR74 = 3146,
+ CV_IA64_AR75 = 3147,
+ CV_IA64_AR76 = 3148,
+ CV_IA64_AR77 = 3149,
+ CV_IA64_AR78 = 3150,
+ CV_IA64_AR79 = 3151,
+ CV_IA64_AR80 = 3152,
+ CV_IA64_AR81 = 3153,
+ CV_IA64_AR82 = 3154,
+ CV_IA64_AR83 = 3155,
+ CV_IA64_AR84 = 3156,
+ CV_IA64_AR85 = 3157,
+ CV_IA64_AR86 = 3158,
+ CV_IA64_AR87 = 3159,
+ CV_IA64_AR88 = 3160,
+ CV_IA64_AR89 = 3161,
+ CV_IA64_AR90 = 3162,
+ CV_IA64_AR91 = 3163,
+ CV_IA64_AR92 = 3164,
+ CV_IA64_AR93 = 3165,
+ CV_IA64_AR94 = 3166,
+ CV_IA64_AR95 = 3167,
+ CV_IA64_AR96 = 3168,
+ CV_IA64_AR97 = 3169,
+ CV_IA64_AR98 = 3170,
+ CV_IA64_AR99 = 3171,
+ CV_IA64_AR100 = 3172,
+ CV_IA64_AR101 = 3173,
+ CV_IA64_AR102 = 3174,
+ CV_IA64_AR103 = 3175,
+ CV_IA64_AR104 = 3176,
+ CV_IA64_AR105 = 3177,
+ CV_IA64_AR106 = 3178,
+ CV_IA64_AR107 = 3179,
+ CV_IA64_AR108 = 3180,
+ CV_IA64_AR109 = 3181,
+ CV_IA64_AR110 = 3182,
+ CV_IA64_AR111 = 3183,
+ CV_IA64_AR112 = 3184,
+ CV_IA64_AR113 = 3185,
+ CV_IA64_AR114 = 3186,
+ CV_IA64_AR115 = 3187,
+ CV_IA64_AR116 = 3188,
+ CV_IA64_AR117 = 3189,
+ CV_IA64_AR118 = 3190,
+ CV_IA64_AR119 = 3191,
+ CV_IA64_AR120 = 3192,
+ CV_IA64_AR121 = 3193,
+ CV_IA64_AR122 = 3194,
+ CV_IA64_AR123 = 3195,
+ CV_IA64_AR124 = 3196,
+ CV_IA64_AR125 = 3197,
+ CV_IA64_AR126 = 3198,
+ CV_IA64_AR127 = 3199,
+
+ // CPUID Registers
+
+ CV_IA64_CPUID0 = 3328,
+ CV_IA64_CPUID1 = 3329,
+ CV_IA64_CPUID2 = 3330,
+ CV_IA64_CPUID3 = 3331,
+ CV_IA64_CPUID4 = 3332,
+
+ // Control Registers
+
+ CV_IA64_ApDCR = 4096,
+ CV_IA64_ApITM = 4097,
+ CV_IA64_ApIVA = 4098,
+ CV_IA64_CR3 = 4099,
+ CV_IA64_CR4 = 4100,
+ CV_IA64_CR5 = 4101,
+ CV_IA64_CR6 = 4102,
+ CV_IA64_CR7 = 4103,
+ CV_IA64_ApPTA = 4104,
+ CV_IA64_ApGPTA = 4105,
+ CV_IA64_CR10 = 4106,
+ CV_IA64_CR11 = 4107,
+ CV_IA64_CR12 = 4108,
+ CV_IA64_CR13 = 4109,
+ CV_IA64_CR14 = 4110,
+ CV_IA64_CR15 = 4111,
+ CV_IA64_StIPSR = 4112,
+ CV_IA64_StISR = 4113,
+ CV_IA64_CR18 = 4114,
+ CV_IA64_StIIP = 4115,
+ CV_IA64_StIFA = 4116,
+ CV_IA64_StITIR = 4117,
+ CV_IA64_StIIPA = 4118,
+ CV_IA64_StIFS = 4119,
+ CV_IA64_StIIM = 4120,
+ CV_IA64_StIHA = 4121,
+ CV_IA64_CR26 = 4122,
+ CV_IA64_CR27 = 4123,
+ CV_IA64_CR28 = 4124,
+ CV_IA64_CR29 = 4125,
+ CV_IA64_CR30 = 4126,
+ CV_IA64_CR31 = 4127,
+ CV_IA64_CR32 = 4128,
+ CV_IA64_CR33 = 4129,
+ CV_IA64_CR34 = 4130,
+ CV_IA64_CR35 = 4131,
+ CV_IA64_CR36 = 4132,
+ CV_IA64_CR37 = 4133,
+ CV_IA64_CR38 = 4134,
+ CV_IA64_CR39 = 4135,
+ CV_IA64_CR40 = 4136,
+ CV_IA64_CR41 = 4137,
+ CV_IA64_CR42 = 4138,
+ CV_IA64_CR43 = 4139,
+ CV_IA64_CR44 = 4140,
+ CV_IA64_CR45 = 4141,
+ CV_IA64_CR46 = 4142,
+ CV_IA64_CR47 = 4143,
+ CV_IA64_CR48 = 4144,
+ CV_IA64_CR49 = 4145,
+ CV_IA64_CR50 = 4146,
+ CV_IA64_CR51 = 4147,
+ CV_IA64_CR52 = 4148,
+ CV_IA64_CR53 = 4149,
+ CV_IA64_CR54 = 4150,
+ CV_IA64_CR55 = 4151,
+ CV_IA64_CR56 = 4152,
+ CV_IA64_CR57 = 4153,
+ CV_IA64_CR58 = 4154,
+ CV_IA64_CR59 = 4155,
+ CV_IA64_CR60 = 4156,
+ CV_IA64_CR61 = 4157,
+ CV_IA64_CR62 = 4158,
+ CV_IA64_CR63 = 4159,
+ CV_IA64_SaLID = 4160,
+ CV_IA64_SaIVR = 4161,
+ CV_IA64_SaTPR = 4162,
+ CV_IA64_SaEOI = 4163,
+ CV_IA64_SaIRR0 = 4164,
+ CV_IA64_SaIRR1 = 4165,
+ CV_IA64_SaIRR2 = 4166,
+ CV_IA64_SaIRR3 = 4167,
+ CV_IA64_SaITV = 4168,
+ CV_IA64_SaPMV = 4169,
+ CV_IA64_SaCMCV = 4170,
+ CV_IA64_CR75 = 4171,
+ CV_IA64_CR76 = 4172,
+ CV_IA64_CR77 = 4173,
+ CV_IA64_CR78 = 4174,
+ CV_IA64_CR79 = 4175,
+ CV_IA64_SaLRR0 = 4176,
+ CV_IA64_SaLRR1 = 4177,
+ CV_IA64_CR82 = 4178,
+ CV_IA64_CR83 = 4179,
+ CV_IA64_CR84 = 4180,
+ CV_IA64_CR85 = 4181,
+ CV_IA64_CR86 = 4182,
+ CV_IA64_CR87 = 4183,
+ CV_IA64_CR88 = 4184,
+ CV_IA64_CR89 = 4185,
+ CV_IA64_CR90 = 4186,
+ CV_IA64_CR91 = 4187,
+ CV_IA64_CR92 = 4188,
+ CV_IA64_CR93 = 4189,
+ CV_IA64_CR94 = 4190,
+ CV_IA64_CR95 = 4191,
+ CV_IA64_CR96 = 4192,
+ CV_IA64_CR97 = 4193,
+ CV_IA64_CR98 = 4194,
+ CV_IA64_CR99 = 4195,
+ CV_IA64_CR100 = 4196,
+ CV_IA64_CR101 = 4197,
+ CV_IA64_CR102 = 4198,
+ CV_IA64_CR103 = 4199,
+ CV_IA64_CR104 = 4200,
+ CV_IA64_CR105 = 4201,
+ CV_IA64_CR106 = 4202,
+ CV_IA64_CR107 = 4203,
+ CV_IA64_CR108 = 4204,
+ CV_IA64_CR109 = 4205,
+ CV_IA64_CR110 = 4206,
+ CV_IA64_CR111 = 4207,
+ CV_IA64_CR112 = 4208,
+ CV_IA64_CR113 = 4209,
+ CV_IA64_CR114 = 4210,
+ CV_IA64_CR115 = 4211,
+ CV_IA64_CR116 = 4212,
+ CV_IA64_CR117 = 4213,
+ CV_IA64_CR118 = 4214,
+ CV_IA64_CR119 = 4215,
+ CV_IA64_CR120 = 4216,
+ CV_IA64_CR121 = 4217,
+ CV_IA64_CR122 = 4218,
+ CV_IA64_CR123 = 4219,
+ CV_IA64_CR124 = 4220,
+ CV_IA64_CR125 = 4221,
+ CV_IA64_CR126 = 4222,
+ CV_IA64_CR127 = 4223,
+
+ // Protection Key Registers
+
+ CV_IA64_Pkr0 = 5120,
+ CV_IA64_Pkr1 = 5121,
+ CV_IA64_Pkr2 = 5122,
+ CV_IA64_Pkr3 = 5123,
+ CV_IA64_Pkr4 = 5124,
+ CV_IA64_Pkr5 = 5125,
+ CV_IA64_Pkr6 = 5126,
+ CV_IA64_Pkr7 = 5127,
+ CV_IA64_Pkr8 = 5128,
+ CV_IA64_Pkr9 = 5129,
+ CV_IA64_Pkr10 = 5130,
+ CV_IA64_Pkr11 = 5131,
+ CV_IA64_Pkr12 = 5132,
+ CV_IA64_Pkr13 = 5133,
+ CV_IA64_Pkr14 = 5134,
+ CV_IA64_Pkr15 = 5135,
+
+ // Region Registers
+
+ CV_IA64_Rr0 = 6144,
+ CV_IA64_Rr1 = 6145,
+ CV_IA64_Rr2 = 6146,
+ CV_IA64_Rr3 = 6147,
+ CV_IA64_Rr4 = 6148,
+ CV_IA64_Rr5 = 6149,
+ CV_IA64_Rr6 = 6150,
+ CV_IA64_Rr7 = 6151,
+
+ // Performance Monitor Data Registers
+
+ CV_IA64_PFD0 = 7168,
+ CV_IA64_PFD1 = 7169,
+ CV_IA64_PFD2 = 7170,
+ CV_IA64_PFD3 = 7171,
+ CV_IA64_PFD4 = 7172,
+ CV_IA64_PFD5 = 7173,
+ CV_IA64_PFD6 = 7174,
+ CV_IA64_PFD7 = 7175,
+ CV_IA64_PFD8 = 7176,
+ CV_IA64_PFD9 = 7177,
+ CV_IA64_PFD10 = 7178,
+ CV_IA64_PFD11 = 7179,
+ CV_IA64_PFD12 = 7180,
+ CV_IA64_PFD13 = 7181,
+ CV_IA64_PFD14 = 7182,
+ CV_IA64_PFD15 = 7183,
+ CV_IA64_PFD16 = 7184,
+ CV_IA64_PFD17 = 7185,
+
+ // Performance Monitor Config Registers
+
+ CV_IA64_PFC0 = 7424,
+ CV_IA64_PFC1 = 7425,
+ CV_IA64_PFC2 = 7426,
+ CV_IA64_PFC3 = 7427,
+ CV_IA64_PFC4 = 7428,
+ CV_IA64_PFC5 = 7429,
+ CV_IA64_PFC6 = 7430,
+ CV_IA64_PFC7 = 7431,
+ CV_IA64_PFC8 = 7432,
+ CV_IA64_PFC9 = 7433,
+ CV_IA64_PFC10 = 7434,
+ CV_IA64_PFC11 = 7435,
+ CV_IA64_PFC12 = 7436,
+ CV_IA64_PFC13 = 7437,
+ CV_IA64_PFC14 = 7438,
+ CV_IA64_PFC15 = 7439,
+
+ // Instruction Translation Registers
+
+ CV_IA64_TrI0 = 8192,
+ CV_IA64_TrI1 = 8193,
+ CV_IA64_TrI2 = 8194,
+ CV_IA64_TrI3 = 8195,
+ CV_IA64_TrI4 = 8196,
+ CV_IA64_TrI5 = 8197,
+ CV_IA64_TrI6 = 8198,
+ CV_IA64_TrI7 = 8199,
+
+ // Data Translation Registers
+
+ CV_IA64_TrD0 = 8320,
+ CV_IA64_TrD1 = 8321,
+ CV_IA64_TrD2 = 8322,
+ CV_IA64_TrD3 = 8323,
+ CV_IA64_TrD4 = 8324,
+ CV_IA64_TrD5 = 8325,
+ CV_IA64_TrD6 = 8326,
+ CV_IA64_TrD7 = 8327,
+
+ // Instruction Breakpoint Registers
+
+ CV_IA64_DbI0 = 8448,
+ CV_IA64_DbI1 = 8449,
+ CV_IA64_DbI2 = 8450,
+ CV_IA64_DbI3 = 8451,
+ CV_IA64_DbI4 = 8452,
+ CV_IA64_DbI5 = 8453,
+ CV_IA64_DbI6 = 8454,
+ CV_IA64_DbI7 = 8455,
+
+ // Data Breakpoint Registers
+
+ CV_IA64_DbD0 = 8576,
+ CV_IA64_DbD1 = 8577,
+ CV_IA64_DbD2 = 8578,
+ CV_IA64_DbD3 = 8579,
+ CV_IA64_DbD4 = 8580,
+ CV_IA64_DbD5 = 8581,
+ CV_IA64_DbD6 = 8582,
+ CV_IA64_DbD7 = 8583,
+
+ //
+ // Register set for the TriCore processor.
+ //
+
+ CV_TRI_NOREG = CV_REG_NONE,
+
+ // General Purpose Data Registers
+
+ CV_TRI_D0 = 10,
+ CV_TRI_D1 = 11,
+ CV_TRI_D2 = 12,
+ CV_TRI_D3 = 13,
+ CV_TRI_D4 = 14,
+ CV_TRI_D5 = 15,
+ CV_TRI_D6 = 16,
+ CV_TRI_D7 = 17,
+ CV_TRI_D8 = 18,
+ CV_TRI_D9 = 19,
+ CV_TRI_D10 = 20,
+ CV_TRI_D11 = 21,
+ CV_TRI_D12 = 22,
+ CV_TRI_D13 = 23,
+ CV_TRI_D14 = 24,
+ CV_TRI_D15 = 25,
+
+ // General Purpose Address Registers
+
+ CV_TRI_A0 = 26,
+ CV_TRI_A1 = 27,
+ CV_TRI_A2 = 28,
+ CV_TRI_A3 = 29,
+ CV_TRI_A4 = 30,
+ CV_TRI_A5 = 31,
+ CV_TRI_A6 = 32,
+ CV_TRI_A7 = 33,
+ CV_TRI_A8 = 34,
+ CV_TRI_A9 = 35,
+ CV_TRI_A10 = 36,
+ CV_TRI_A11 = 37,
+ CV_TRI_A12 = 38,
+ CV_TRI_A13 = 39,
+ CV_TRI_A14 = 40,
+ CV_TRI_A15 = 41,
+
+ // Extended (64-bit) data registers
+
+ CV_TRI_E0 = 42,
+ CV_TRI_E2 = 43,
+ CV_TRI_E4 = 44,
+ CV_TRI_E6 = 45,
+ CV_TRI_E8 = 46,
+ CV_TRI_E10 = 47,
+ CV_TRI_E12 = 48,
+ CV_TRI_E14 = 49,
+
+ // Extended (64-bit) address registers
+
+ CV_TRI_EA0 = 50,
+ CV_TRI_EA2 = 51,
+ CV_TRI_EA4 = 52,
+ CV_TRI_EA6 = 53,
+ CV_TRI_EA8 = 54,
+ CV_TRI_EA10 = 55,
+ CV_TRI_EA12 = 56,
+ CV_TRI_EA14 = 57,
+
+ CV_TRI_PSW = 58,
+ CV_TRI_PCXI = 59,
+ CV_TRI_PC = 60,
+ CV_TRI_FCX = 61,
+ CV_TRI_LCX = 62,
+ CV_TRI_ISP = 63,
+ CV_TRI_ICR = 64,
+ CV_TRI_BIV = 65,
+ CV_TRI_BTV = 66,
+ CV_TRI_SYSCON = 67,
+ CV_TRI_DPRx_0 = 68,
+ CV_TRI_DPRx_1 = 69,
+ CV_TRI_DPRx_2 = 70,
+ CV_TRI_DPRx_3 = 71,
+ CV_TRI_CPRx_0 = 68,
+ CV_TRI_CPRx_1 = 69,
+ CV_TRI_CPRx_2 = 70,
+ CV_TRI_CPRx_3 = 71,
+ CV_TRI_DPMx_0 = 68,
+ CV_TRI_DPMx_1 = 69,
+ CV_TRI_DPMx_2 = 70,
+ CV_TRI_DPMx_3 = 71,
+ CV_TRI_CPMx_0 = 68,
+ CV_TRI_CPMx_1 = 69,
+ CV_TRI_CPMx_2 = 70,
+ CV_TRI_CPMx_3 = 71,
+ CV_TRI_DBGSSR = 72,
+ CV_TRI_EXEVT = 73,
+ CV_TRI_SWEVT = 74,
+ CV_TRI_CREVT = 75,
+ CV_TRI_TRnEVT = 76,
+ CV_TRI_MMUCON = 77,
+ CV_TRI_ASI = 78,
+ CV_TRI_TVA = 79,
+ CV_TRI_TPA = 80,
+ CV_TRI_TPX = 81,
+ CV_TRI_TFA = 82,
+
+ //
+ // Register set for the AM33 and related processors.
+ //
+
+ CV_AM33_NOREG = CV_REG_NONE,
+
+ // "Extended" (general purpose integer) registers
+ CV_AM33_E0 = 10,
+ CV_AM33_E1 = 11,
+ CV_AM33_E2 = 12,
+ CV_AM33_E3 = 13,
+ CV_AM33_E4 = 14,
+ CV_AM33_E5 = 15,
+ CV_AM33_E6 = 16,
+ CV_AM33_E7 = 17,
+
+ // Address registers
+ CV_AM33_A0 = 20,
+ CV_AM33_A1 = 21,
+ CV_AM33_A2 = 22,
+ CV_AM33_A3 = 23,
+
+ // Integer data registers
+ CV_AM33_D0 = 30,
+ CV_AM33_D1 = 31,
+ CV_AM33_D2 = 32,
+ CV_AM33_D3 = 33,
+
+ // (Single-precision) floating-point registers
+ CV_AM33_FS0 = 40,
+ CV_AM33_FS1 = 41,
+ CV_AM33_FS2 = 42,
+ CV_AM33_FS3 = 43,
+ CV_AM33_FS4 = 44,
+ CV_AM33_FS5 = 45,
+ CV_AM33_FS6 = 46,
+ CV_AM33_FS7 = 47,
+ CV_AM33_FS8 = 48,
+ CV_AM33_FS9 = 49,
+ CV_AM33_FS10 = 50,
+ CV_AM33_FS11 = 51,
+ CV_AM33_FS12 = 52,
+ CV_AM33_FS13 = 53,
+ CV_AM33_FS14 = 54,
+ CV_AM33_FS15 = 55,
+ CV_AM33_FS16 = 56,
+ CV_AM33_FS17 = 57,
+ CV_AM33_FS18 = 58,
+ CV_AM33_FS19 = 59,
+ CV_AM33_FS20 = 60,
+ CV_AM33_FS21 = 61,
+ CV_AM33_FS22 = 62,
+ CV_AM33_FS23 = 63,
+ CV_AM33_FS24 = 64,
+ CV_AM33_FS25 = 65,
+ CV_AM33_FS26 = 66,
+ CV_AM33_FS27 = 67,
+ CV_AM33_FS28 = 68,
+ CV_AM33_FS29 = 69,
+ CV_AM33_FS30 = 70,
+ CV_AM33_FS31 = 71,
+
+ // Special purpose registers
+
+ // Stack pointer
+ CV_AM33_SP = 80,
+
+ // Program counter
+ CV_AM33_PC = 81,
+
+ // Multiply-divide/accumulate registers
+ CV_AM33_MDR = 82,
+ CV_AM33_MDRQ = 83,
+ CV_AM33_MCRH = 84,
+ CV_AM33_MCRL = 85,
+ CV_AM33_MCVF = 86,
+
+ // CPU status words
+ CV_AM33_EPSW = 87,
+ CV_AM33_FPCR = 88,
+
+ // Loop buffer registers
+ CV_AM33_LIR = 89,
+ CV_AM33_LAR = 90,
+
+ //
+ // Register set for the Mitsubishi M32R
+ //
+
+ CV_M32R_NOREG = CV_REG_NONE,
+
+ CV_M32R_R0 = 10,
+ CV_M32R_R1 = 11,
+ CV_M32R_R2 = 12,
+ CV_M32R_R3 = 13,
+ CV_M32R_R4 = 14,
+ CV_M32R_R5 = 15,
+ CV_M32R_R6 = 16,
+ CV_M32R_R7 = 17,
+ CV_M32R_R8 = 18,
+ CV_M32R_R9 = 19,
+ CV_M32R_R10 = 20,
+ CV_M32R_R11 = 21,
+ CV_M32R_R12 = 22, // Gloabal Pointer, if used
+ CV_M32R_R13 = 23, // Frame Pointer, if allocated
+ CV_M32R_R14 = 24, // Link Register
+ CV_M32R_R15 = 25, // Stack Pointer
+ CV_M32R_PSW = 26, // Preocessor Status Register
+ CV_M32R_CBR = 27, // Condition Bit Register
+ CV_M32R_SPI = 28, // Interrupt Stack Pointer
+ CV_M32R_SPU = 29, // User Stack Pointer
+ CV_M32R_SPO = 30, // OS Stack Pointer
+ CV_M32R_BPC = 31, // Backup Program Counter
+ CV_M32R_ACHI = 32, // Accumulator High
+ CV_M32R_ACLO = 33, // Accumulator Low
+ CV_M32R_PC = 34, // Program Counter
+
+ //
+ // Register set for the SuperH SHMedia processor including compact
+ // mode
+ //
+
+ // Integer - 64 bit general registers
+ CV_SHMEDIA_NOREG = CV_REG_NONE,
+ CV_SHMEDIA_R0 = 10,
+ CV_SHMEDIA_R1 = 11,
+ CV_SHMEDIA_R2 = 12,
+ CV_SHMEDIA_R3 = 13,
+ CV_SHMEDIA_R4 = 14,
+ CV_SHMEDIA_R5 = 15,
+ CV_SHMEDIA_R6 = 16,
+ CV_SHMEDIA_R7 = 17,
+ CV_SHMEDIA_R8 = 18,
+ CV_SHMEDIA_R9 = 19,
+ CV_SHMEDIA_R10 = 20,
+ CV_SHMEDIA_R11 = 21,
+ CV_SHMEDIA_R12 = 22,
+ CV_SHMEDIA_R13 = 23,
+ CV_SHMEDIA_R14 = 24,
+ CV_SHMEDIA_R15 = 25,
+ CV_SHMEDIA_R16 = 26,
+ CV_SHMEDIA_R17 = 27,
+ CV_SHMEDIA_R18 = 28,
+ CV_SHMEDIA_R19 = 29,
+ CV_SHMEDIA_R20 = 30,
+ CV_SHMEDIA_R21 = 31,
+ CV_SHMEDIA_R22 = 32,
+ CV_SHMEDIA_R23 = 33,
+ CV_SHMEDIA_R24 = 34,
+ CV_SHMEDIA_R25 = 35,
+ CV_SHMEDIA_R26 = 36,
+ CV_SHMEDIA_R27 = 37,
+ CV_SHMEDIA_R28 = 38,
+ CV_SHMEDIA_R29 = 39,
+ CV_SHMEDIA_R30 = 40,
+ CV_SHMEDIA_R31 = 41,
+ CV_SHMEDIA_R32 = 42,
+ CV_SHMEDIA_R33 = 43,
+ CV_SHMEDIA_R34 = 44,
+ CV_SHMEDIA_R35 = 45,
+ CV_SHMEDIA_R36 = 46,
+ CV_SHMEDIA_R37 = 47,
+ CV_SHMEDIA_R38 = 48,
+ CV_SHMEDIA_R39 = 49,
+ CV_SHMEDIA_R40 = 50,
+ CV_SHMEDIA_R41 = 51,
+ CV_SHMEDIA_R42 = 52,
+ CV_SHMEDIA_R43 = 53,
+ CV_SHMEDIA_R44 = 54,
+ CV_SHMEDIA_R45 = 55,
+ CV_SHMEDIA_R46 = 56,
+ CV_SHMEDIA_R47 = 57,
+ CV_SHMEDIA_R48 = 58,
+ CV_SHMEDIA_R49 = 59,
+ CV_SHMEDIA_R50 = 60,
+ CV_SHMEDIA_R51 = 61,
+ CV_SHMEDIA_R52 = 62,
+ CV_SHMEDIA_R53 = 63,
+ CV_SHMEDIA_R54 = 64,
+ CV_SHMEDIA_R55 = 65,
+ CV_SHMEDIA_R56 = 66,
+ CV_SHMEDIA_R57 = 67,
+ CV_SHMEDIA_R58 = 68,
+ CV_SHMEDIA_R59 = 69,
+ CV_SHMEDIA_R60 = 70,
+ CV_SHMEDIA_R61 = 71,
+ CV_SHMEDIA_R62 = 72,
+ CV_SHMEDIA_R63 = 73,
+
+ // Target Registers - 32 bit
+ CV_SHMEDIA_TR0 = 74,
+ CV_SHMEDIA_TR1 = 75,
+ CV_SHMEDIA_TR2 = 76,
+ CV_SHMEDIA_TR3 = 77,
+ CV_SHMEDIA_TR4 = 78,
+ CV_SHMEDIA_TR5 = 79,
+ CV_SHMEDIA_TR6 = 80,
+ CV_SHMEDIA_TR7 = 81,
+ CV_SHMEDIA_TR8 = 82, // future-proof
+ CV_SHMEDIA_TR9 = 83, // future-proof
+ CV_SHMEDIA_TR10 = 84, // future-proof
+ CV_SHMEDIA_TR11 = 85, // future-proof
+ CV_SHMEDIA_TR12 = 86, // future-proof
+ CV_SHMEDIA_TR13 = 87, // future-proof
+ CV_SHMEDIA_TR14 = 88, // future-proof
+ CV_SHMEDIA_TR15 = 89, // future-proof
+
+ // Single - 32 bit fp registers
+ CV_SHMEDIA_FR0 = 128,
+ CV_SHMEDIA_FR1 = 129,
+ CV_SHMEDIA_FR2 = 130,
+ CV_SHMEDIA_FR3 = 131,
+ CV_SHMEDIA_FR4 = 132,
+ CV_SHMEDIA_FR5 = 133,
+ CV_SHMEDIA_FR6 = 134,
+ CV_SHMEDIA_FR7 = 135,
+ CV_SHMEDIA_FR8 = 136,
+ CV_SHMEDIA_FR9 = 137,
+ CV_SHMEDIA_FR10 = 138,
+ CV_SHMEDIA_FR11 = 139,
+ CV_SHMEDIA_FR12 = 140,
+ CV_SHMEDIA_FR13 = 141,
+ CV_SHMEDIA_FR14 = 142,
+ CV_SHMEDIA_FR15 = 143,
+ CV_SHMEDIA_FR16 = 144,
+ CV_SHMEDIA_FR17 = 145,
+ CV_SHMEDIA_FR18 = 146,
+ CV_SHMEDIA_FR19 = 147,
+ CV_SHMEDIA_FR20 = 148,
+ CV_SHMEDIA_FR21 = 149,
+ CV_SHMEDIA_FR22 = 150,
+ CV_SHMEDIA_FR23 = 151,
+ CV_SHMEDIA_FR24 = 152,
+ CV_SHMEDIA_FR25 = 153,
+ CV_SHMEDIA_FR26 = 154,
+ CV_SHMEDIA_FR27 = 155,
+ CV_SHMEDIA_FR28 = 156,
+ CV_SHMEDIA_FR29 = 157,
+ CV_SHMEDIA_FR30 = 158,
+ CV_SHMEDIA_FR31 = 159,
+ CV_SHMEDIA_FR32 = 160,
+ CV_SHMEDIA_FR33 = 161,
+ CV_SHMEDIA_FR34 = 162,
+ CV_SHMEDIA_FR35 = 163,
+ CV_SHMEDIA_FR36 = 164,
+ CV_SHMEDIA_FR37 = 165,
+ CV_SHMEDIA_FR38 = 166,
+ CV_SHMEDIA_FR39 = 167,
+ CV_SHMEDIA_FR40 = 168,
+ CV_SHMEDIA_FR41 = 169,
+ CV_SHMEDIA_FR42 = 170,
+ CV_SHMEDIA_FR43 = 171,
+ CV_SHMEDIA_FR44 = 172,
+ CV_SHMEDIA_FR45 = 173,
+ CV_SHMEDIA_FR46 = 174,
+ CV_SHMEDIA_FR47 = 175,
+ CV_SHMEDIA_FR48 = 176,
+ CV_SHMEDIA_FR49 = 177,
+ CV_SHMEDIA_FR50 = 178,
+ CV_SHMEDIA_FR51 = 179,
+ CV_SHMEDIA_FR52 = 180,
+ CV_SHMEDIA_FR53 = 181,
+ CV_SHMEDIA_FR54 = 182,
+ CV_SHMEDIA_FR55 = 183,
+ CV_SHMEDIA_FR56 = 184,
+ CV_SHMEDIA_FR57 = 185,
+ CV_SHMEDIA_FR58 = 186,
+ CV_SHMEDIA_FR59 = 187,
+ CV_SHMEDIA_FR60 = 188,
+ CV_SHMEDIA_FR61 = 189,
+ CV_SHMEDIA_FR62 = 190,
+ CV_SHMEDIA_FR63 = 191,
+
+ // Double - 64 bit synonyms for 32bit fp register pairs
+ // subtract 128 to find first base single register
+ CV_SHMEDIA_DR0 = 256,
+ CV_SHMEDIA_DR2 = 258,
+ CV_SHMEDIA_DR4 = 260,
+ CV_SHMEDIA_DR6 = 262,
+ CV_SHMEDIA_DR8 = 264,
+ CV_SHMEDIA_DR10 = 266,
+ CV_SHMEDIA_DR12 = 268,
+ CV_SHMEDIA_DR14 = 270,
+ CV_SHMEDIA_DR16 = 272,
+ CV_SHMEDIA_DR18 = 274,
+ CV_SHMEDIA_DR20 = 276,
+ CV_SHMEDIA_DR22 = 278,
+ CV_SHMEDIA_DR24 = 280,
+ CV_SHMEDIA_DR26 = 282,
+ CV_SHMEDIA_DR28 = 284,
+ CV_SHMEDIA_DR30 = 286,
+ CV_SHMEDIA_DR32 = 288,
+ CV_SHMEDIA_DR34 = 290,
+ CV_SHMEDIA_DR36 = 292,
+ CV_SHMEDIA_DR38 = 294,
+ CV_SHMEDIA_DR40 = 296,
+ CV_SHMEDIA_DR42 = 298,
+ CV_SHMEDIA_DR44 = 300,
+ CV_SHMEDIA_DR46 = 302,
+ CV_SHMEDIA_DR48 = 304,
+ CV_SHMEDIA_DR50 = 306,
+ CV_SHMEDIA_DR52 = 308,
+ CV_SHMEDIA_DR54 = 310,
+ CV_SHMEDIA_DR56 = 312,
+ CV_SHMEDIA_DR58 = 314,
+ CV_SHMEDIA_DR60 = 316,
+ CV_SHMEDIA_DR62 = 318,
+
+ // Vector - 128 bit synonyms for 32bit fp register quads
+ // subtract 384 to find first base single register
+ CV_SHMEDIA_FV0 = 512,
+ CV_SHMEDIA_FV4 = 516,
+ CV_SHMEDIA_FV8 = 520,
+ CV_SHMEDIA_FV12 = 524,
+ CV_SHMEDIA_FV16 = 528,
+ CV_SHMEDIA_FV20 = 532,
+ CV_SHMEDIA_FV24 = 536,
+ CV_SHMEDIA_FV28 = 540,
+ CV_SHMEDIA_FV32 = 544,
+ CV_SHMEDIA_FV36 = 548,
+ CV_SHMEDIA_FV40 = 552,
+ CV_SHMEDIA_FV44 = 556,
+ CV_SHMEDIA_FV48 = 560,
+ CV_SHMEDIA_FV52 = 564,
+ CV_SHMEDIA_FV56 = 568,
+ CV_SHMEDIA_FV60 = 572,
+
+ // Matrix - 512 bit synonyms for 16 adjacent 32bit fp registers
+ // subtract 896 to find first base single register
+ CV_SHMEDIA_MTRX0 = 1024,
+ CV_SHMEDIA_MTRX16 = 1040,
+ CV_SHMEDIA_MTRX32 = 1056,
+ CV_SHMEDIA_MTRX48 = 1072,
+
+ // Control - Implementation defined 64bit control registers
+ CV_SHMEDIA_CR0 = 2000,
+ CV_SHMEDIA_CR1 = 2001,
+ CV_SHMEDIA_CR2 = 2002,
+ CV_SHMEDIA_CR3 = 2003,
+ CV_SHMEDIA_CR4 = 2004,
+ CV_SHMEDIA_CR5 = 2005,
+ CV_SHMEDIA_CR6 = 2006,
+ CV_SHMEDIA_CR7 = 2007,
+ CV_SHMEDIA_CR8 = 2008,
+ CV_SHMEDIA_CR9 = 2009,
+ CV_SHMEDIA_CR10 = 2010,
+ CV_SHMEDIA_CR11 = 2011,
+ CV_SHMEDIA_CR12 = 2012,
+ CV_SHMEDIA_CR13 = 2013,
+ CV_SHMEDIA_CR14 = 2014,
+ CV_SHMEDIA_CR15 = 2015,
+ CV_SHMEDIA_CR16 = 2016,
+ CV_SHMEDIA_CR17 = 2017,
+ CV_SHMEDIA_CR18 = 2018,
+ CV_SHMEDIA_CR19 = 2019,
+ CV_SHMEDIA_CR20 = 2020,
+ CV_SHMEDIA_CR21 = 2021,
+ CV_SHMEDIA_CR22 = 2022,
+ CV_SHMEDIA_CR23 = 2023,
+ CV_SHMEDIA_CR24 = 2024,
+ CV_SHMEDIA_CR25 = 2025,
+ CV_SHMEDIA_CR26 = 2026,
+ CV_SHMEDIA_CR27 = 2027,
+ CV_SHMEDIA_CR28 = 2028,
+ CV_SHMEDIA_CR29 = 2029,
+ CV_SHMEDIA_CR30 = 2030,
+ CV_SHMEDIA_CR31 = 2031,
+ CV_SHMEDIA_CR32 = 2032,
+ CV_SHMEDIA_CR33 = 2033,
+ CV_SHMEDIA_CR34 = 2034,
+ CV_SHMEDIA_CR35 = 2035,
+ CV_SHMEDIA_CR36 = 2036,
+ CV_SHMEDIA_CR37 = 2037,
+ CV_SHMEDIA_CR38 = 2038,
+ CV_SHMEDIA_CR39 = 2039,
+ CV_SHMEDIA_CR40 = 2040,
+ CV_SHMEDIA_CR41 = 2041,
+ CV_SHMEDIA_CR42 = 2042,
+ CV_SHMEDIA_CR43 = 2043,
+ CV_SHMEDIA_CR44 = 2044,
+ CV_SHMEDIA_CR45 = 2045,
+ CV_SHMEDIA_CR46 = 2046,
+ CV_SHMEDIA_CR47 = 2047,
+ CV_SHMEDIA_CR48 = 2048,
+ CV_SHMEDIA_CR49 = 2049,
+ CV_SHMEDIA_CR50 = 2050,
+ CV_SHMEDIA_CR51 = 2051,
+ CV_SHMEDIA_CR52 = 2052,
+ CV_SHMEDIA_CR53 = 2053,
+ CV_SHMEDIA_CR54 = 2054,
+ CV_SHMEDIA_CR55 = 2055,
+ CV_SHMEDIA_CR56 = 2056,
+ CV_SHMEDIA_CR57 = 2057,
+ CV_SHMEDIA_CR58 = 2058,
+ CV_SHMEDIA_CR59 = 2059,
+ CV_SHMEDIA_CR60 = 2060,
+ CV_SHMEDIA_CR61 = 2061,
+ CV_SHMEDIA_CR62 = 2062,
+ CV_SHMEDIA_CR63 = 2063,
+
+ CV_SHMEDIA_FPSCR = 2064,
+
+ // Compact mode synonyms
+ CV_SHMEDIA_GBR = CV_SHMEDIA_R16,
+ CV_SHMEDIA_MACL = 90, // synonym for lower 32bits of media R17
+ CV_SHMEDIA_MACH = 91, // synonym for upper 32bits of media R17
+ CV_SHMEDIA_PR = CV_SHMEDIA_R18,
+ CV_SHMEDIA_T = 92, // synonym for lowest bit of media R19
+ CV_SHMEDIA_FPUL = CV_SHMEDIA_FR32,
+ CV_SHMEDIA_PC = 93,
+ CV_SHMEDIA_SR = CV_SHMEDIA_CR0,
+
+ //
+ // AMD64 registers
+ //
+
+ CV_AMD64_AL = 1,
+ CV_AMD64_CL = 2,
+ CV_AMD64_DL = 3,
+ CV_AMD64_BL = 4,
+ CV_AMD64_AH = 5,
+ CV_AMD64_CH = 6,
+ CV_AMD64_DH = 7,
+ CV_AMD64_BH = 8,
+ CV_AMD64_AX = 9,
+ CV_AMD64_CX = 10,
+ CV_AMD64_DX = 11,
+ CV_AMD64_BX = 12,
+ CV_AMD64_SP = 13,
+ CV_AMD64_BP = 14,
+ CV_AMD64_SI = 15,
+ CV_AMD64_DI = 16,
+ CV_AMD64_EAX = 17,
+ CV_AMD64_ECX = 18,
+ CV_AMD64_EDX = 19,
+ CV_AMD64_EBX = 20,
+ CV_AMD64_ESP = 21,
+ CV_AMD64_EBP = 22,
+ CV_AMD64_ESI = 23,
+ CV_AMD64_EDI = 24,
+ CV_AMD64_ES = 25,
+ CV_AMD64_CS = 26,
+ CV_AMD64_SS = 27,
+ CV_AMD64_DS = 28,
+ CV_AMD64_FS = 29,
+ CV_AMD64_GS = 30,
+ CV_AMD64_FLAGS = 32,
+ CV_AMD64_RIP = 33,
+ CV_AMD64_EFLAGS = 34,
+
+ // Control registers
+ CV_AMD64_CR0 = 80,
+ CV_AMD64_CR1 = 81,
+ CV_AMD64_CR2 = 82,
+ CV_AMD64_CR3 = 83,
+ CV_AMD64_CR4 = 84,
+ CV_AMD64_CR8 = 88,
+
+ // Debug registers
+ CV_AMD64_DR0 = 90,
+ CV_AMD64_DR1 = 91,
+ CV_AMD64_DR2 = 92,
+ CV_AMD64_DR3 = 93,
+ CV_AMD64_DR4 = 94,
+ CV_AMD64_DR5 = 95,
+ CV_AMD64_DR6 = 96,
+ CV_AMD64_DR7 = 97,
+ CV_AMD64_DR8 = 98,
+ CV_AMD64_DR9 = 99,
+ CV_AMD64_DR10 = 100,
+ CV_AMD64_DR11 = 101,
+ CV_AMD64_DR12 = 102,
+ CV_AMD64_DR13 = 103,
+ CV_AMD64_DR14 = 104,
+ CV_AMD64_DR15 = 105,
+
+ CV_AMD64_GDTR = 110,
+ CV_AMD64_GDTL = 111,
+ CV_AMD64_IDTR = 112,
+ CV_AMD64_IDTL = 113,
+ CV_AMD64_LDTR = 114,
+ CV_AMD64_TR = 115,
+
+ CV_AMD64_ST0 = 128,
+ CV_AMD64_ST1 = 129,
+ CV_AMD64_ST2 = 130,
+ CV_AMD64_ST3 = 131,
+ CV_AMD64_ST4 = 132,
+ CV_AMD64_ST5 = 133,
+ CV_AMD64_ST6 = 134,
+ CV_AMD64_ST7 = 135,
+ CV_AMD64_CTRL = 136,
+ CV_AMD64_STAT = 137,
+ CV_AMD64_TAG = 138,
+ CV_AMD64_FPIP = 139,
+ CV_AMD64_FPCS = 140,
+ CV_AMD64_FPDO = 141,
+ CV_AMD64_FPDS = 142,
+ CV_AMD64_ISEM = 143,
+ CV_AMD64_FPEIP = 144,
+ CV_AMD64_FPEDO = 145,
+
+ CV_AMD64_MM0 = 146,
+ CV_AMD64_MM1 = 147,
+ CV_AMD64_MM2 = 148,
+ CV_AMD64_MM3 = 149,
+ CV_AMD64_MM4 = 150,
+ CV_AMD64_MM5 = 151,
+ CV_AMD64_MM6 = 152,
+ CV_AMD64_MM7 = 153,
+
+ CV_AMD64_XMM0 = 154, // KATMAI registers
+ CV_AMD64_XMM1 = 155,
+ CV_AMD64_XMM2 = 156,
+ CV_AMD64_XMM3 = 157,
+ CV_AMD64_XMM4 = 158,
+ CV_AMD64_XMM5 = 159,
+ CV_AMD64_XMM6 = 160,
+ CV_AMD64_XMM7 = 161,
+
+ CV_AMD64_XMM0_0 = 162, // KATMAI sub-registers
+ CV_AMD64_XMM0_1 = 163,
+ CV_AMD64_XMM0_2 = 164,
+ CV_AMD64_XMM0_3 = 165,
+ CV_AMD64_XMM1_0 = 166,
+ CV_AMD64_XMM1_1 = 167,
+ CV_AMD64_XMM1_2 = 168,
+ CV_AMD64_XMM1_3 = 169,
+ CV_AMD64_XMM2_0 = 170,
+ CV_AMD64_XMM2_1 = 171,
+ CV_AMD64_XMM2_2 = 172,
+ CV_AMD64_XMM2_3 = 173,
+ CV_AMD64_XMM3_0 = 174,
+ CV_AMD64_XMM3_1 = 175,
+ CV_AMD64_XMM3_2 = 176,
+ CV_AMD64_XMM3_3 = 177,
+ CV_AMD64_XMM4_0 = 178,
+ CV_AMD64_XMM4_1 = 179,
+ CV_AMD64_XMM4_2 = 180,
+ CV_AMD64_XMM4_3 = 181,
+ CV_AMD64_XMM5_0 = 182,
+ CV_AMD64_XMM5_1 = 183,
+ CV_AMD64_XMM5_2 = 184,
+ CV_AMD64_XMM5_3 = 185,
+ CV_AMD64_XMM6_0 = 186,
+ CV_AMD64_XMM6_1 = 187,
+ CV_AMD64_XMM6_2 = 188,
+ CV_AMD64_XMM6_3 = 189,
+ CV_AMD64_XMM7_0 = 190,
+ CV_AMD64_XMM7_1 = 191,
+ CV_AMD64_XMM7_2 = 192,
+ CV_AMD64_XMM7_3 = 193,
+
+ CV_AMD64_XMM0L = 194,
+ CV_AMD64_XMM1L = 195,
+ CV_AMD64_XMM2L = 196,
+ CV_AMD64_XMM3L = 197,
+ CV_AMD64_XMM4L = 198,
+ CV_AMD64_XMM5L = 199,
+ CV_AMD64_XMM6L = 200,
+ CV_AMD64_XMM7L = 201,
+
+ CV_AMD64_XMM0H = 202,
+ CV_AMD64_XMM1H = 203,
+ CV_AMD64_XMM2H = 204,
+ CV_AMD64_XMM3H = 205,
+ CV_AMD64_XMM4H = 206,
+ CV_AMD64_XMM5H = 207,
+ CV_AMD64_XMM6H = 208,
+ CV_AMD64_XMM7H = 209,
+
+ CV_AMD64_MXCSR = 211, // XMM status register
+
+ CV_AMD64_EMM0L = 220, // XMM sub-registers (WNI integer)
+ CV_AMD64_EMM1L = 221,
+ CV_AMD64_EMM2L = 222,
+ CV_AMD64_EMM3L = 223,
+ CV_AMD64_EMM4L = 224,
+ CV_AMD64_EMM5L = 225,
+ CV_AMD64_EMM6L = 226,
+ CV_AMD64_EMM7L = 227,
+
+ CV_AMD64_EMM0H = 228,
+ CV_AMD64_EMM1H = 229,
+ CV_AMD64_EMM2H = 230,
+ CV_AMD64_EMM3H = 231,
+ CV_AMD64_EMM4H = 232,
+ CV_AMD64_EMM5H = 233,
+ CV_AMD64_EMM6H = 234,
+ CV_AMD64_EMM7H = 235,
+
+ // do not change the order of these regs, first one must be even too
+ CV_AMD64_MM00 = 236,
+ CV_AMD64_MM01 = 237,
+ CV_AMD64_MM10 = 238,
+ CV_AMD64_MM11 = 239,
+ CV_AMD64_MM20 = 240,
+ CV_AMD64_MM21 = 241,
+ CV_AMD64_MM30 = 242,
+ CV_AMD64_MM31 = 243,
+ CV_AMD64_MM40 = 244,
+ CV_AMD64_MM41 = 245,
+ CV_AMD64_MM50 = 246,
+ CV_AMD64_MM51 = 247,
+ CV_AMD64_MM60 = 248,
+ CV_AMD64_MM61 = 249,
+ CV_AMD64_MM70 = 250,
+ CV_AMD64_MM71 = 251,
+
+ // Extended KATMAI registers
+ CV_AMD64_XMM8 = 252, // KATMAI registers
+ CV_AMD64_XMM9 = 253,
+ CV_AMD64_XMM10 = 254,
+ CV_AMD64_XMM11 = 255,
+ CV_AMD64_XMM12 = 256,
+ CV_AMD64_XMM13 = 257,
+ CV_AMD64_XMM14 = 258,
+ CV_AMD64_XMM15 = 259,
+
+ CV_AMD64_XMM8_0 = 260, // KATMAI sub-registers
+ CV_AMD64_XMM8_1 = 261,
+ CV_AMD64_XMM8_2 = 262,
+ CV_AMD64_XMM8_3 = 263,
+ CV_AMD64_XMM9_0 = 264,
+ CV_AMD64_XMM9_1 = 265,
+ CV_AMD64_XMM9_2 = 266,
+ CV_AMD64_XMM9_3 = 267,
+ CV_AMD64_XMM10_0 = 268,
+ CV_AMD64_XMM10_1 = 269,
+ CV_AMD64_XMM10_2 = 270,
+ CV_AMD64_XMM10_3 = 271,
+ CV_AMD64_XMM11_0 = 272,
+ CV_AMD64_XMM11_1 = 273,
+ CV_AMD64_XMM11_2 = 274,
+ CV_AMD64_XMM11_3 = 275,
+ CV_AMD64_XMM12_0 = 276,
+ CV_AMD64_XMM12_1 = 277,
+ CV_AMD64_XMM12_2 = 278,
+ CV_AMD64_XMM12_3 = 279,
+ CV_AMD64_XMM13_0 = 280,
+ CV_AMD64_XMM13_1 = 281,
+ CV_AMD64_XMM13_2 = 282,
+ CV_AMD64_XMM13_3 = 283,
+ CV_AMD64_XMM14_0 = 284,
+ CV_AMD64_XMM14_1 = 285,
+ CV_AMD64_XMM14_2 = 286,
+ CV_AMD64_XMM14_3 = 287,
+ CV_AMD64_XMM15_0 = 288,
+ CV_AMD64_XMM15_1 = 289,
+ CV_AMD64_XMM15_2 = 290,
+ CV_AMD64_XMM15_3 = 291,
+
+ CV_AMD64_XMM8L = 292,
+ CV_AMD64_XMM9L = 293,
+ CV_AMD64_XMM10L = 294,
+ CV_AMD64_XMM11L = 295,
+ CV_AMD64_XMM12L = 296,
+ CV_AMD64_XMM13L = 297,
+ CV_AMD64_XMM14L = 298,
+ CV_AMD64_XMM15L = 299,
+
+ CV_AMD64_XMM8H = 300,
+ CV_AMD64_XMM9H = 301,
+ CV_AMD64_XMM10H = 302,
+ CV_AMD64_XMM11H = 303,
+ CV_AMD64_XMM12H = 304,
+ CV_AMD64_XMM13H = 305,
+ CV_AMD64_XMM14H = 306,
+ CV_AMD64_XMM15H = 307,
+
+ CV_AMD64_EMM8L = 308, // XMM sub-registers (WNI integer)
+ CV_AMD64_EMM9L = 309,
+ CV_AMD64_EMM10L = 310,
+ CV_AMD64_EMM11L = 311,
+ CV_AMD64_EMM12L = 312,
+ CV_AMD64_EMM13L = 313,
+ CV_AMD64_EMM14L = 314,
+ CV_AMD64_EMM15L = 315,
+
+ CV_AMD64_EMM8H = 316,
+ CV_AMD64_EMM9H = 317,
+ CV_AMD64_EMM10H = 318,
+ CV_AMD64_EMM11H = 319,
+ CV_AMD64_EMM12H = 320,
+ CV_AMD64_EMM13H = 321,
+ CV_AMD64_EMM14H = 322,
+ CV_AMD64_EMM15H = 323,
+
+ // Low byte forms of some standard registers
+ CV_AMD64_SIL = 324,
+ CV_AMD64_DIL = 325,
+ CV_AMD64_BPL = 326,
+ CV_AMD64_SPL = 327,
+
+ // 64-bit regular registers
+ CV_AMD64_RAX = 328,
+ CV_AMD64_RBX = 329,
+ CV_AMD64_RCX = 330,
+ CV_AMD64_RDX = 331,
+ CV_AMD64_RSI = 332,
+ CV_AMD64_RDI = 333,
+ CV_AMD64_RBP = 334,
+ CV_AMD64_RSP = 335,
+
+ // 64-bit integer registers with 8-, 16-, and 32-bit forms (B, W, and D)
+ CV_AMD64_R8 = 336,
+ CV_AMD64_R9 = 337,
+ CV_AMD64_R10 = 338,
+ CV_AMD64_R11 = 339,
+ CV_AMD64_R12 = 340,
+ CV_AMD64_R13 = 341,
+ CV_AMD64_R14 = 342,
+ CV_AMD64_R15 = 343,
+
+ CV_AMD64_R8B = 344,
+ CV_AMD64_R9B = 345,
+ CV_AMD64_R10B = 346,
+ CV_AMD64_R11B = 347,
+ CV_AMD64_R12B = 348,
+ CV_AMD64_R13B = 349,
+ CV_AMD64_R14B = 350,
+ CV_AMD64_R15B = 351,
+
+ CV_AMD64_R8W = 352,
+ CV_AMD64_R9W = 353,
+ CV_AMD64_R10W = 354,
+ CV_AMD64_R11W = 355,
+ CV_AMD64_R12W = 356,
+ CV_AMD64_R13W = 357,
+ CV_AMD64_R14W = 358,
+ CV_AMD64_R15W = 359,
+
+ CV_AMD64_R8D = 360,
+ CV_AMD64_R9D = 361,
+ CV_AMD64_R10D = 362,
+ CV_AMD64_R11D = 363,
+ CV_AMD64_R12D = 364,
+ CV_AMD64_R13D = 365,
+ CV_AMD64_R14D = 366,
+ CV_AMD64_R15D = 367,
+
+ // AVX registers 256 bits
+ CV_AMD64_YMM0 = 368,
+ CV_AMD64_YMM1 = 369,
+ CV_AMD64_YMM2 = 370,
+ CV_AMD64_YMM3 = 371,
+ CV_AMD64_YMM4 = 372,
+ CV_AMD64_YMM5 = 373,
+ CV_AMD64_YMM6 = 374,
+ CV_AMD64_YMM7 = 375,
+ CV_AMD64_YMM8 = 376,
+ CV_AMD64_YMM9 = 377,
+ CV_AMD64_YMM10 = 378,
+ CV_AMD64_YMM11 = 379,
+ CV_AMD64_YMM12 = 380,
+ CV_AMD64_YMM13 = 381,
+ CV_AMD64_YMM14 = 382,
+ CV_AMD64_YMM15 = 383,
+
+ // AVX registers upper 128 bits
+ CV_AMD64_YMM0H = 384,
+ CV_AMD64_YMM1H = 385,
+ CV_AMD64_YMM2H = 386,
+ CV_AMD64_YMM3H = 387,
+ CV_AMD64_YMM4H = 388,
+ CV_AMD64_YMM5H = 389,
+ CV_AMD64_YMM6H = 390,
+ CV_AMD64_YMM7H = 391,
+ CV_AMD64_YMM8H = 392,
+ CV_AMD64_YMM9H = 393,
+ CV_AMD64_YMM10H = 394,
+ CV_AMD64_YMM11H = 395,
+ CV_AMD64_YMM12H = 396,
+ CV_AMD64_YMM13H = 397,
+ CV_AMD64_YMM14H = 398,
+ CV_AMD64_YMM15H = 399,
+
+ //Lower/upper 8 bytes of XMM registers. Unlike CV_AMD64_XMM<regnum><H/L>, these
+ //values reprsesent the bit patterns of the registers as 64-bit integers, not
+ //the representation of these registers as a double.
+ CV_AMD64_XMM0IL = 400,
+ CV_AMD64_XMM1IL = 401,
+ CV_AMD64_XMM2IL = 402,
+ CV_AMD64_XMM3IL = 403,
+ CV_AMD64_XMM4IL = 404,
+ CV_AMD64_XMM5IL = 405,
+ CV_AMD64_XMM6IL = 406,
+ CV_AMD64_XMM7IL = 407,
+ CV_AMD64_XMM8IL = 408,
+ CV_AMD64_XMM9IL = 409,
+ CV_AMD64_XMM10IL = 410,
+ CV_AMD64_XMM11IL = 411,
+ CV_AMD64_XMM12IL = 412,
+ CV_AMD64_XMM13IL = 413,
+ CV_AMD64_XMM14IL = 414,
+ CV_AMD64_XMM15IL = 415,
+
+ CV_AMD64_XMM0IH = 416,
+ CV_AMD64_XMM1IH = 417,
+ CV_AMD64_XMM2IH = 418,
+ CV_AMD64_XMM3IH = 419,
+ CV_AMD64_XMM4IH = 420,
+ CV_AMD64_XMM5IH = 421,
+ CV_AMD64_XMM6IH = 422,
+ CV_AMD64_XMM7IH = 423,
+ CV_AMD64_XMM8IH = 424,
+ CV_AMD64_XMM9IH = 425,
+ CV_AMD64_XMM10IH = 426,
+ CV_AMD64_XMM11IH = 427,
+ CV_AMD64_XMM12IH = 428,
+ CV_AMD64_XMM13IH = 429,
+ CV_AMD64_XMM14IH = 430,
+ CV_AMD64_XMM15IH = 431,
+
+ CV_AMD64_YMM0I0 = 432, // AVX integer registers
+ CV_AMD64_YMM0I1 = 433,
+ CV_AMD64_YMM0I2 = 434,
+ CV_AMD64_YMM0I3 = 435,
+ CV_AMD64_YMM1I0 = 436,
+ CV_AMD64_YMM1I1 = 437,
+ CV_AMD64_YMM1I2 = 438,
+ CV_AMD64_YMM1I3 = 439,
+ CV_AMD64_YMM2I0 = 440,
+ CV_AMD64_YMM2I1 = 441,
+ CV_AMD64_YMM2I2 = 442,
+ CV_AMD64_YMM2I3 = 443,
+ CV_AMD64_YMM3I0 = 444,
+ CV_AMD64_YMM3I1 = 445,
+ CV_AMD64_YMM3I2 = 446,
+ CV_AMD64_YMM3I3 = 447,
+ CV_AMD64_YMM4I0 = 448,
+ CV_AMD64_YMM4I1 = 449,
+ CV_AMD64_YMM4I2 = 450,
+ CV_AMD64_YMM4I3 = 451,
+ CV_AMD64_YMM5I0 = 452,
+ CV_AMD64_YMM5I1 = 453,
+ CV_AMD64_YMM5I2 = 454,
+ CV_AMD64_YMM5I3 = 455,
+ CV_AMD64_YMM6I0 = 456,
+ CV_AMD64_YMM6I1 = 457,
+ CV_AMD64_YMM6I2 = 458,
+ CV_AMD64_YMM6I3 = 459,
+ CV_AMD64_YMM7I0 = 460,
+ CV_AMD64_YMM7I1 = 461,
+ CV_AMD64_YMM7I2 = 462,
+ CV_AMD64_YMM7I3 = 463,
+ CV_AMD64_YMM8I0 = 464,
+ CV_AMD64_YMM8I1 = 465,
+ CV_AMD64_YMM8I2 = 466,
+ CV_AMD64_YMM8I3 = 467,
+ CV_AMD64_YMM9I0 = 468,
+ CV_AMD64_YMM9I1 = 469,
+ CV_AMD64_YMM9I2 = 470,
+ CV_AMD64_YMM9I3 = 471,
+ CV_AMD64_YMM10I0 = 472,
+ CV_AMD64_YMM10I1 = 473,
+ CV_AMD64_YMM10I2 = 474,
+ CV_AMD64_YMM10I3 = 475,
+ CV_AMD64_YMM11I0 = 476,
+ CV_AMD64_YMM11I1 = 477,
+ CV_AMD64_YMM11I2 = 478,
+ CV_AMD64_YMM11I3 = 479,
+ CV_AMD64_YMM12I0 = 480,
+ CV_AMD64_YMM12I1 = 481,
+ CV_AMD64_YMM12I2 = 482,
+ CV_AMD64_YMM12I3 = 483,
+ CV_AMD64_YMM13I0 = 484,
+ CV_AMD64_YMM13I1 = 485,
+ CV_AMD64_YMM13I2 = 486,
+ CV_AMD64_YMM13I3 = 487,
+ CV_AMD64_YMM14I0 = 488,
+ CV_AMD64_YMM14I1 = 489,
+ CV_AMD64_YMM14I2 = 490,
+ CV_AMD64_YMM14I3 = 491,
+ CV_AMD64_YMM15I0 = 492,
+ CV_AMD64_YMM15I1 = 493,
+ CV_AMD64_YMM15I2 = 494,
+ CV_AMD64_YMM15I3 = 495,
+
+ CV_AMD64_YMM0F0 = 496, // AVX floating-point single precise registers
+ CV_AMD64_YMM0F1 = 497,
+ CV_AMD64_YMM0F2 = 498,
+ CV_AMD64_YMM0F3 = 499,
+ CV_AMD64_YMM0F4 = 500,
+ CV_AMD64_YMM0F5 = 501,
+ CV_AMD64_YMM0F6 = 502,
+ CV_AMD64_YMM0F7 = 503,
+ CV_AMD64_YMM1F0 = 504,
+ CV_AMD64_YMM1F1 = 505,
+ CV_AMD64_YMM1F2 = 506,
+ CV_AMD64_YMM1F3 = 507,
+ CV_AMD64_YMM1F4 = 508,
+ CV_AMD64_YMM1F5 = 509,
+ CV_AMD64_YMM1F6 = 510,
+ CV_AMD64_YMM1F7 = 511,
+ CV_AMD64_YMM2F0 = 512,
+ CV_AMD64_YMM2F1 = 513,
+ CV_AMD64_YMM2F2 = 514,
+ CV_AMD64_YMM2F3 = 515,
+ CV_AMD64_YMM2F4 = 516,
+ CV_AMD64_YMM2F5 = 517,
+ CV_AMD64_YMM2F6 = 518,
+ CV_AMD64_YMM2F7 = 519,
+ CV_AMD64_YMM3F0 = 520,
+ CV_AMD64_YMM3F1 = 521,
+ CV_AMD64_YMM3F2 = 522,
+ CV_AMD64_YMM3F3 = 523,
+ CV_AMD64_YMM3F4 = 524,
+ CV_AMD64_YMM3F5 = 525,
+ CV_AMD64_YMM3F6 = 526,
+ CV_AMD64_YMM3F7 = 527,
+ CV_AMD64_YMM4F0 = 528,
+ CV_AMD64_YMM4F1 = 529,
+ CV_AMD64_YMM4F2 = 530,
+ CV_AMD64_YMM4F3 = 531,
+ CV_AMD64_YMM4F4 = 532,
+ CV_AMD64_YMM4F5 = 533,
+ CV_AMD64_YMM4F6 = 534,
+ CV_AMD64_YMM4F7 = 535,
+ CV_AMD64_YMM5F0 = 536,
+ CV_AMD64_YMM5F1 = 537,
+ CV_AMD64_YMM5F2 = 538,
+ CV_AMD64_YMM5F3 = 539,
+ CV_AMD64_YMM5F4 = 540,
+ CV_AMD64_YMM5F5 = 541,
+ CV_AMD64_YMM5F6 = 542,
+ CV_AMD64_YMM5F7 = 543,
+ CV_AMD64_YMM6F0 = 544,
+ CV_AMD64_YMM6F1 = 545,
+ CV_AMD64_YMM6F2 = 546,
+ CV_AMD64_YMM6F3 = 547,
+ CV_AMD64_YMM6F4 = 548,
+ CV_AMD64_YMM6F5 = 549,
+ CV_AMD64_YMM6F6 = 550,
+ CV_AMD64_YMM6F7 = 551,
+ CV_AMD64_YMM7F0 = 552,
+ CV_AMD64_YMM7F1 = 553,
+ CV_AMD64_YMM7F2 = 554,
+ CV_AMD64_YMM7F3 = 555,
+ CV_AMD64_YMM7F4 = 556,
+ CV_AMD64_YMM7F5 = 557,
+ CV_AMD64_YMM7F6 = 558,
+ CV_AMD64_YMM7F7 = 559,
+ CV_AMD64_YMM8F0 = 560,
+ CV_AMD64_YMM8F1 = 561,
+ CV_AMD64_YMM8F2 = 562,
+ CV_AMD64_YMM8F3 = 563,
+ CV_AMD64_YMM8F4 = 564,
+ CV_AMD64_YMM8F5 = 565,
+ CV_AMD64_YMM8F6 = 566,
+ CV_AMD64_YMM8F7 = 567,
+ CV_AMD64_YMM9F0 = 568,
+ CV_AMD64_YMM9F1 = 569,
+ CV_AMD64_YMM9F2 = 570,
+ CV_AMD64_YMM9F3 = 571,
+ CV_AMD64_YMM9F4 = 572,
+ CV_AMD64_YMM9F5 = 573,
+ CV_AMD64_YMM9F6 = 574,
+ CV_AMD64_YMM9F7 = 575,
+ CV_AMD64_YMM10F0 = 576,
+ CV_AMD64_YMM10F1 = 577,
+ CV_AMD64_YMM10F2 = 578,
+ CV_AMD64_YMM10F3 = 579,
+ CV_AMD64_YMM10F4 = 580,
+ CV_AMD64_YMM10F5 = 581,
+ CV_AMD64_YMM10F6 = 582,
+ CV_AMD64_YMM10F7 = 583,
+ CV_AMD64_YMM11F0 = 584,
+ CV_AMD64_YMM11F1 = 585,
+ CV_AMD64_YMM11F2 = 586,
+ CV_AMD64_YMM11F3 = 587,
+ CV_AMD64_YMM11F4 = 588,
+ CV_AMD64_YMM11F5 = 589,
+ CV_AMD64_YMM11F6 = 590,
+ CV_AMD64_YMM11F7 = 591,
+ CV_AMD64_YMM12F0 = 592,
+ CV_AMD64_YMM12F1 = 593,
+ CV_AMD64_YMM12F2 = 594,
+ CV_AMD64_YMM12F3 = 595,
+ CV_AMD64_YMM12F4 = 596,
+ CV_AMD64_YMM12F5 = 597,
+ CV_AMD64_YMM12F6 = 598,
+ CV_AMD64_YMM12F7 = 599,
+ CV_AMD64_YMM13F0 = 600,
+ CV_AMD64_YMM13F1 = 601,
+ CV_AMD64_YMM13F2 = 602,
+ CV_AMD64_YMM13F3 = 603,
+ CV_AMD64_YMM13F4 = 604,
+ CV_AMD64_YMM13F5 = 605,
+ CV_AMD64_YMM13F6 = 606,
+ CV_AMD64_YMM13F7 = 607,
+ CV_AMD64_YMM14F0 = 608,
+ CV_AMD64_YMM14F1 = 609,
+ CV_AMD64_YMM14F2 = 610,
+ CV_AMD64_YMM14F3 = 611,
+ CV_AMD64_YMM14F4 = 612,
+ CV_AMD64_YMM14F5 = 613,
+ CV_AMD64_YMM14F6 = 614,
+ CV_AMD64_YMM14F7 = 615,
+ CV_AMD64_YMM15F0 = 616,
+ CV_AMD64_YMM15F1 = 617,
+ CV_AMD64_YMM15F2 = 618,
+ CV_AMD64_YMM15F3 = 619,
+ CV_AMD64_YMM15F4 = 620,
+ CV_AMD64_YMM15F5 = 621,
+ CV_AMD64_YMM15F6 = 622,
+ CV_AMD64_YMM15F7 = 623,
+
+ CV_AMD64_YMM0D0 = 624, // AVX floating-point double precise registers
+ CV_AMD64_YMM0D1 = 625,
+ CV_AMD64_YMM0D2 = 626,
+ CV_AMD64_YMM0D3 = 627,
+ CV_AMD64_YMM1D0 = 628,
+ CV_AMD64_YMM1D1 = 629,
+ CV_AMD64_YMM1D2 = 630,
+ CV_AMD64_YMM1D3 = 631,
+ CV_AMD64_YMM2D0 = 632,
+ CV_AMD64_YMM2D1 = 633,
+ CV_AMD64_YMM2D2 = 634,
+ CV_AMD64_YMM2D3 = 635,
+ CV_AMD64_YMM3D0 = 636,
+ CV_AMD64_YMM3D1 = 637,
+ CV_AMD64_YMM3D2 = 638,
+ CV_AMD64_YMM3D3 = 639,
+ CV_AMD64_YMM4D0 = 640,
+ CV_AMD64_YMM4D1 = 641,
+ CV_AMD64_YMM4D2 = 642,
+ CV_AMD64_YMM4D3 = 643,
+ CV_AMD64_YMM5D0 = 644,
+ CV_AMD64_YMM5D1 = 645,
+ CV_AMD64_YMM5D2 = 646,
+ CV_AMD64_YMM5D3 = 647,
+ CV_AMD64_YMM6D0 = 648,
+ CV_AMD64_YMM6D1 = 649,
+ CV_AMD64_YMM6D2 = 650,
+ CV_AMD64_YMM6D3 = 651,
+ CV_AMD64_YMM7D0 = 652,
+ CV_AMD64_YMM7D1 = 653,
+ CV_AMD64_YMM7D2 = 654,
+ CV_AMD64_YMM7D3 = 655,
+ CV_AMD64_YMM8D0 = 656,
+ CV_AMD64_YMM8D1 = 657,
+ CV_AMD64_YMM8D2 = 658,
+ CV_AMD64_YMM8D3 = 659,
+ CV_AMD64_YMM9D0 = 660,
+ CV_AMD64_YMM9D1 = 661,
+ CV_AMD64_YMM9D2 = 662,
+ CV_AMD64_YMM9D3 = 663,
+ CV_AMD64_YMM10D0 = 664,
+ CV_AMD64_YMM10D1 = 665,
+ CV_AMD64_YMM10D2 = 666,
+ CV_AMD64_YMM10D3 = 667,
+ CV_AMD64_YMM11D0 = 668,
+ CV_AMD64_YMM11D1 = 669,
+ CV_AMD64_YMM11D2 = 670,
+ CV_AMD64_YMM11D3 = 671,
+ CV_AMD64_YMM12D0 = 672,
+ CV_AMD64_YMM12D1 = 673,
+ CV_AMD64_YMM12D2 = 674,
+ CV_AMD64_YMM12D3 = 675,
+ CV_AMD64_YMM13D0 = 676,
+ CV_AMD64_YMM13D1 = 677,
+ CV_AMD64_YMM13D2 = 678,
+ CV_AMD64_YMM13D3 = 679,
+ CV_AMD64_YMM14D0 = 680,
+ CV_AMD64_YMM14D1 = 681,
+ CV_AMD64_YMM14D2 = 682,
+ CV_AMD64_YMM14D3 = 683,
+ CV_AMD64_YMM15D0 = 684,
+ CV_AMD64_YMM15D1 = 685,
+ CV_AMD64_YMM15D2 = 686,
+ CV_AMD64_YMM15D3 = 687
+
+
+ // Note: Next set of platform registers need to go into a new enum...
+ // this one is above 44K now.
+
+} CV_HREG_e;
+
+typedef enum CV_HLSLREG_e {
+ CV_HLSLREG_TEMP = 0,
+ CV_HLSLREG_INPUT = 1,
+ CV_HLSLREG_OUTPUT = 2,
+ CV_HLSLREG_INDEXABLE_TEMP = 3,
+ CV_HLSLREG_IMMEDIATE32 = 4,
+ CV_HLSLREG_IMMEDIATE64 = 5,
+ CV_HLSLREG_SAMPLER = 6,
+ CV_HLSLREG_RESOURCE = 7,
+ CV_HLSLREG_CONSTANT_BUFFER = 8,
+ CV_HLSLREG_IMMEDIATE_CONSTANT_BUFFER = 9,
+ CV_HLSLREG_LABEL = 10,
+ CV_HLSLREG_INPUT_PRIMITIVEID = 11,
+ CV_HLSLREG_OUTPUT_DEPTH = 12,
+ CV_HLSLREG_NULL = 13,
+ CV_HLSLREG_RASTERIZER = 14,
+ CV_HLSLREG_OUTPUT_COVERAGE_MASK = 15,
+ CV_HLSLREG_STREAM = 16,
+ CV_HLSLREG_FUNCTION_BODY = 17,
+ CV_HLSLREG_FUNCTION_TABLE = 18,
+ CV_HLSLREG_INTERFACE = 19,
+ CV_HLSLREG_FUNCTION_INPUT = 20,
+ CV_HLSLREG_FUNCTION_OUTPUT = 21,
+ CV_HLSLREG_OUTPUT_CONTROL_POINT_ID = 22,
+ CV_HLSLREG_INPUT_FORK_INSTANCE_ID = 23,
+ CV_HLSLREG_INPUT_JOIN_INSTANCE_ID = 24,
+ CV_HLSLREG_INPUT_CONTROL_POINT = 25,
+ CV_HLSLREG_OUTPUT_CONTROL_POINT = 26,
+ CV_HLSLREG_INPUT_PATCH_CONSTANT = 27,
+ CV_HLSLREG_INPUT_DOMAIN_POINT = 28,
+ CV_HLSLREG_THIS_POINTER = 29,
+ CV_HLSLREG_UNORDERED_ACCESS_VIEW = 30,
+ CV_HLSLREG_THREAD_GROUP_SHARED_MEMORY = 31,
+ CV_HLSLREG_INPUT_THREAD_ID = 32,
+ CV_HLSLREG_INPUT_THREAD_GROUP_ID = 33,
+ CV_HLSLREG_INPUT_THREAD_ID_IN_GROUP = 34,
+ CV_HLSLREG_INPUT_COVERAGE_MASK = 35,
+ CV_HLSLREG_INPUT_THREAD_ID_IN_GROUP_FLATTENED = 36,
+ CV_HLSLREG_INPUT_GS_INSTANCE_ID = 37,
+ CV_HLSLREG_OUTPUT_DEPTH_GREATER_EQUAL = 38,
+ CV_HLSLREG_OUTPUT_DEPTH_LESS_EQUAL = 39,
+ CV_HLSLREG_CYCLE_COUNTER = 40,
+} CV_HLSLREG_e;
+
+enum StackFrameTypeEnum
+{
+ FrameTypeFPO, // Frame pointer omitted, FPO info available
+ FrameTypeTrap, // Kernel Trap frame
+ FrameTypeTSS, // Kernel Trap frame
+ FrameTypeStandard, // Standard EBP stackframe
+ FrameTypeFrameData, // Frame pointer omitted, FrameData info available
+
+ FrameTypeUnknown = -1, // Frame which does not have any debug info
+};
+
+enum MemoryTypeEnum
+{
+ MemTypeCode, // Read only code memory
+ MemTypeData, // Read only data/stack memory
+ MemTypeStack, // Read only stack memory
+ MemTypeCodeOnHeap, // Read only memory for code generated on heap by runtime
+
+ MemTypeAny = -1,
+};
+
+typedef enum CV_HLSLMemorySpace_e
+{
+ // HLSL specific memory spaces
+
+ CV_HLSL_MEMSPACE_DATA = 0x00,
+ CV_HLSL_MEMSPACE_SAMPLER = 0x01,
+ CV_HLSL_MEMSPACE_RESOURCE = 0x02,
+ CV_HLSL_MEMSPACE_RWRESOURCE = 0x03,
+
+ CV_HLSL_MEMSPACE_MAX = 0x0F,
+} CV_HLSLMemorySpace_e;
+
+#endif
diff --git a/src/inc/cvinfo.h b/src/inc/cvinfo.h
new file mode 100644
index 0000000000..c2e42e5d72
--- /dev/null
+++ b/src/inc/cvinfo.h
@@ -0,0 +1,4989 @@
+// 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.
+
+/*** cvinfo.h - Generic CodeView information definitions
+ *
+ * Structures, constants, etc. for accessing and interpreting
+ * CodeView information.
+ *
+ */
+
+
+/*** The master copy of this file resides in the langapi project.
+ * All Microsoft projects are required to use the master copy without
+ * modification. Modification of the master version or a copy
+ * without consultation with all parties concerned is extremely
+ * risky.
+ *
+ */
+
+#pragma once
+
+#include "cvconst.h"
+
+#ifndef _CV_INFO_INCLUDED
+#define _CV_INFO_INCLUDED
+
+#ifdef __cplusplus
+#pragma warning ( disable: 4200 )
+#endif
+
+#ifndef __INLINE
+#ifdef __cplusplus
+#define __INLINE inline
+#else
+#define __INLINE __inline
+#endif
+#endif
+
+#pragma pack ( push, 1 )
+typedef unsigned long CV_uoff32_t;
+typedef long CV_off32_t;
+typedef unsigned short CV_uoff16_t;
+typedef short CV_off16_t;
+typedef unsigned short CV_typ16_t;
+typedef unsigned long CV_typ_t;
+typedef unsigned long CV_pubsymflag_t; // must be same as CV_typ_t.
+typedef unsigned short _2BYTEPAD;
+typedef unsigned long CV_tkn_t;
+
+#if !defined (CV_ZEROLEN)
+#define CV_ZEROLEN
+#endif
+
+#if !defined (FLOAT10)
+#if defined(_M_I86) // 16 bit x86 supporting long double
+typedef long double FLOAT10;
+#else // 32 bit w/o long double support
+typedef struct FLOAT10
+{
+ char b[10];
+} FLOAT10;
+#endif
+#endif
+
+
+#define CV_SIGNATURE_C6 0L // Actual signature is >64K
+#define CV_SIGNATURE_C7 1L // First explicit signature
+#define CV_SIGNATURE_C11 2L // C11 (vc5.x) 32-bit types
+#define CV_SIGNATURE_C13 4L // C13 (vc7.x) zero terminated names
+#define CV_SIGNATURE_RESERVED 5L // All signatures from 5 to 64K are reserved
+
+#define CV_MAXOFFSET 0xffffffff
+
+#ifndef GUID_DEFINED
+#define GUID_DEFINED
+
+typedef struct _GUID { // size is 16
+ unsigned long Data1;
+ unsigned short Data2;
+ unsigned short Data3;
+ unsigned char Data4[8];
+} GUID;
+
+#endif // !GUID_DEFINED
+
+typedef GUID SIG70; // new to 7.0 are 16-byte guid-like signatures
+typedef SIG70 * PSIG70;
+typedef const SIG70 * PCSIG70;
+
+
+
+/** CodeView Symbol and Type OMF type information is broken up into two
+ * ranges. Type indices less than 0x1000 describe type information
+ * that is frequently used. Type indices above 0x1000 are used to
+ * describe more complex features such as functions, arrays and
+ * structures.
+ */
+
+
+
+
+/** Primitive types have predefined meaning that is encoded in the
+ * values of the various bit fields in the value.
+ *
+ * A CodeView primitive type is defined as:
+ *
+ * 1 1
+ * 1 089 7654 3 210
+ * r mode type r sub
+ *
+ * Where
+ * mode is the pointer mode
+ * type is a type indicator
+ * sub is a subtype enumeration
+ * r is a reserved field
+ *
+ * See Microsoft Symbol and Type OMF (Version 4.0) for more
+ * information.
+ */
+
+
+#define CV_MMASK 0x700 // mode mask
+#define CV_TMASK 0x0f0 // type mask
+
+// can we use the reserved bit ??
+#define CV_SMASK 0x00f // subtype mask
+
+#define CV_MSHIFT 8 // primitive mode right shift count
+#define CV_TSHIFT 4 // primitive type right shift count
+#define CV_SSHIFT 0 // primitive subtype right shift count
+
+// macros to extract primitive mode, type and size
+
+#define CV_MODE(typ) (((typ) & CV_MMASK) >> CV_MSHIFT)
+#define CV_TYPE(typ) (((typ) & CV_TMASK) >> CV_TSHIFT)
+#define CV_SUBT(typ) (((typ) & CV_SMASK) >> CV_SSHIFT)
+
+// macros to insert new primitive mode, type and size
+
+#define CV_NEWMODE(typ, nm) ((CV_typ_t)(((typ) & ~CV_MMASK) | ((nm) << CV_MSHIFT)))
+#define CV_NEWTYPE(typ, nt) (((typ) & ~CV_TMASK) | ((nt) << CV_TSHIFT))
+#define CV_NEWSUBT(typ, ns) (((typ) & ~CV_SMASK) | ((ns) << CV_SSHIFT))
+
+
+
+// pointer mode enumeration values
+
+typedef enum CV_prmode_e {
+ CV_TM_DIRECT = 0, // mode is not a pointer
+ CV_TM_NPTR = 1, // mode is a near pointer
+ CV_TM_FPTR = 2, // mode is a far pointer
+ CV_TM_HPTR = 3, // mode is a huge pointer
+ CV_TM_NPTR32 = 4, // mode is a 32 bit near pointer
+ CV_TM_FPTR32 = 5, // mode is a 32 bit far pointer
+ CV_TM_NPTR64 = 6, // mode is a 64 bit near pointer
+ CV_TM_NPTR128 = 7, // mode is a 128 bit near pointer
+} CV_prmode_e;
+
+
+
+
+// type enumeration values
+
+
+typedef enum CV_type_e {
+ CV_SPECIAL = 0x00, // special type size values
+ CV_SIGNED = 0x01, // signed integral size values
+ CV_UNSIGNED = 0x02, // unsigned integral size values
+ CV_BOOLEAN = 0x03, // Boolean size values
+ CV_REAL = 0x04, // real number size values
+ CV_COMPLEX = 0x05, // complex number size values
+ CV_SPECIAL2 = 0x06, // second set of special types
+ CV_INT = 0x07, // integral (int) values
+ CV_CVRESERVED = 0x0f,
+} CV_type_e;
+
+
+
+
+// subtype enumeration values for CV_SPECIAL
+
+
+typedef enum CV_special_e {
+ CV_SP_NOTYPE = 0x00,
+ CV_SP_ABS = 0x01,
+ CV_SP_SEGMENT = 0x02,
+ CV_SP_VOID = 0x03,
+ CV_SP_CURRENCY = 0x04,
+ CV_SP_NBASICSTR = 0x05,
+ CV_SP_FBASICSTR = 0x06,
+ CV_SP_NOTTRANS = 0x07,
+ CV_SP_HRESULT = 0x08,
+} CV_special_e;
+
+
+
+
+// subtype enumeration values for CV_SPECIAL2
+
+
+typedef enum CV_special2_e {
+ CV_S2_BIT = 0x00,
+ CV_S2_PASCHAR = 0x01, // Pascal CHAR
+ CV_S2_BOOL32FF = 0x02, // 32-bit BOOL where true is 0xffffffff
+} CV_special2_e;
+
+
+
+
+
+// subtype enumeration values for CV_SIGNED, CV_UNSIGNED and CV_BOOLEAN
+
+
+typedef enum CV_integral_e {
+ CV_IN_1BYTE = 0x00,
+ CV_IN_2BYTE = 0x01,
+ CV_IN_4BYTE = 0x02,
+ CV_IN_8BYTE = 0x03,
+ CV_IN_16BYTE = 0x04
+} CV_integral_e;
+
+
+
+
+
+// subtype enumeration values for CV_REAL and CV_COMPLEX
+
+
+typedef enum CV_real_e {
+ CV_RC_REAL32 = 0x00,
+ CV_RC_REAL64 = 0x01,
+ CV_RC_REAL80 = 0x02,
+ CV_RC_REAL128 = 0x03,
+ CV_RC_REAL48 = 0x04,
+ CV_RC_REAL32PP = 0x05, // 32-bit partial precision real
+ CV_RC_REAL16 = 0x06,
+} CV_real_e;
+
+
+
+
+// subtype enumeration values for CV_INT (really int)
+
+
+typedef enum CV_int_e {
+ CV_RI_CHAR = 0x00,
+ CV_RI_INT1 = 0x00,
+ CV_RI_WCHAR = 0x01,
+ CV_RI_UINT1 = 0x01,
+ CV_RI_INT2 = 0x02,
+ CV_RI_UINT2 = 0x03,
+ CV_RI_INT4 = 0x04,
+ CV_RI_UINT4 = 0x05,
+ CV_RI_INT8 = 0x06,
+ CV_RI_UINT8 = 0x07,
+ CV_RI_INT16 = 0x08,
+ CV_RI_UINT16 = 0x09,
+ CV_RI_CHAR16 = 0x0a, // char16_t
+ CV_RI_CHAR32 = 0x0b, // char32_t
+} CV_int_e;
+
+
+
+// macros to check the type of a primitive
+
+#define CV_TYP_IS_DIRECT(typ) (CV_MODE(typ) == CV_TM_DIRECT)
+#define CV_TYP_IS_PTR(typ) (CV_MODE(typ) != CV_TM_DIRECT)
+#define CV_TYP_IS_NPTR(typ) (CV_MODE(typ) == CV_TM_NPTR)
+#define CV_TYP_IS_FPTR(typ) (CV_MODE(typ) == CV_TM_FPTR)
+#define CV_TYP_IS_HPTR(typ) (CV_MODE(typ) == CV_TM_HPTR)
+#define CV_TYP_IS_NPTR32(typ) (CV_MODE(typ) == CV_TM_NPTR32)
+#define CV_TYP_IS_FPTR32(typ) (CV_MODE(typ) == CV_TM_FPTR32)
+
+#define CV_TYP_IS_SIGNED(typ) (((CV_TYPE(typ) == CV_SIGNED) && CV_TYP_IS_DIRECT(typ)) || \
+ (typ == T_INT1) || \
+ (typ == T_INT2) || \
+ (typ == T_INT4) || \
+ (typ == T_INT8) || \
+ (typ == T_INT16) || \
+ (typ == T_RCHAR))
+
+#define CV_TYP_IS_UNSIGNED(typ) (((CV_TYPE(typ) == CV_UNSIGNED) && CV_TYP_IS_DIRECT(typ)) || \
+ (typ == T_UINT1) || \
+ (typ == T_UINT2) || \
+ (typ == T_UINT4) || \
+ (typ == T_UINT8) || \
+ (typ == T_UINT16))
+
+#define CV_TYP_IS_REAL(typ) ((CV_TYPE(typ) == CV_REAL) && CV_TYP_IS_DIRECT(typ))
+
+#define CV_FIRST_NONPRIM 0x1000
+#define CV_IS_PRIMITIVE(typ) ((typ) < CV_FIRST_NONPRIM)
+#define CV_TYP_IS_COMPLEX(typ) ((CV_TYPE(typ) == CV_COMPLEX) && CV_TYP_IS_DIRECT(typ))
+#define CV_IS_INTERNAL_PTR(typ) (CV_IS_PRIMITIVE(typ) && \
+ CV_TYPE(typ) == CV_CVRESERVED && \
+ CV_TYP_IS_PTR(typ))
+
+
+
+
+
+
+// selected values for type_index - for a more complete definition, see
+// Microsoft Symbol and Type OMF document
+
+
+
+
+// Special Types
+
+typedef enum TYPE_ENUM_e {
+// Special Types
+
+ T_NOTYPE = 0x0000, // uncharacterized type (no type)
+ T_ABS = 0x0001, // absolute symbol
+ T_SEGMENT = 0x0002, // segment type
+ T_VOID = 0x0003, // void
+ T_HRESULT = 0x0008, // OLE/COM HRESULT
+ T_32PHRESULT = 0x0408, // OLE/COM HRESULT __ptr32 *
+ T_64PHRESULT = 0x0608, // OLE/COM HRESULT __ptr64 *
+
+ T_PVOID = 0x0103, // near pointer to void
+ T_PFVOID = 0x0203, // far pointer to void
+ T_PHVOID = 0x0303, // huge pointer to void
+ T_32PVOID = 0x0403, // 32 bit pointer to void
+ T_32PFVOID = 0x0503, // 16:32 pointer to void
+ T_64PVOID = 0x0603, // 64 bit pointer to void
+ T_CURRENCY = 0x0004, // BASIC 8 byte currency value
+ T_NBASICSTR = 0x0005, // Near BASIC string
+ T_FBASICSTR = 0x0006, // Far BASIC string
+ T_NOTTRANS = 0x0007, // type not translated by cvpack
+ T_BIT = 0x0060, // bit
+ T_PASCHAR = 0x0061, // Pascal CHAR
+ T_BOOL32FF = 0x0062, // 32-bit BOOL where true is 0xffffffff
+
+
+// Character types
+
+ T_CHAR = 0x0010, // 8 bit signed
+ T_PCHAR = 0x0110, // 16 bit pointer to 8 bit signed
+ T_PFCHAR = 0x0210, // 16:16 far pointer to 8 bit signed
+ T_PHCHAR = 0x0310, // 16:16 huge pointer to 8 bit signed
+ T_32PCHAR = 0x0410, // 32 bit pointer to 8 bit signed
+ T_32PFCHAR = 0x0510, // 16:32 pointer to 8 bit signed
+ T_64PCHAR = 0x0610, // 64 bit pointer to 8 bit signed
+
+ T_UCHAR = 0x0020, // 8 bit unsigned
+ T_PUCHAR = 0x0120, // 16 bit pointer to 8 bit unsigned
+ T_PFUCHAR = 0x0220, // 16:16 far pointer to 8 bit unsigned
+ T_PHUCHAR = 0x0320, // 16:16 huge pointer to 8 bit unsigned
+ T_32PUCHAR = 0x0420, // 32 bit pointer to 8 bit unsigned
+ T_32PFUCHAR = 0x0520, // 16:32 pointer to 8 bit unsigned
+ T_64PUCHAR = 0x0620, // 64 bit pointer to 8 bit unsigned
+
+
+// really a character types
+
+ T_RCHAR = 0x0070, // really a char
+ T_PRCHAR = 0x0170, // 16 bit pointer to a real char
+ T_PFRCHAR = 0x0270, // 16:16 far pointer to a real char
+ T_PHRCHAR = 0x0370, // 16:16 huge pointer to a real char
+ T_32PRCHAR = 0x0470, // 32 bit pointer to a real char
+ T_32PFRCHAR = 0x0570, // 16:32 pointer to a real char
+ T_64PRCHAR = 0x0670, // 64 bit pointer to a real char
+
+
+// really a wide character types
+
+ T_WCHAR = 0x0071, // wide char
+ T_PWCHAR = 0x0171, // 16 bit pointer to a wide char
+ T_PFWCHAR = 0x0271, // 16:16 far pointer to a wide char
+ T_PHWCHAR = 0x0371, // 16:16 huge pointer to a wide char
+ T_32PWCHAR = 0x0471, // 32 bit pointer to a wide char
+ T_32PFWCHAR = 0x0571, // 16:32 pointer to a wide char
+ T_64PWCHAR = 0x0671, // 64 bit pointer to a wide char
+
+// really a 16-bit unicode char
+
+ T_CHAR16 = 0x007a, // 16-bit unicode char
+ T_PCHAR16 = 0x017a, // 16 bit pointer to a 16-bit unicode char
+ T_PFCHAR16 = 0x027a, // 16:16 far pointer to a 16-bit unicode char
+ T_PHCHAR16 = 0x037a, // 16:16 huge pointer to a 16-bit unicode char
+ T_32PCHAR16 = 0x047a, // 32 bit pointer to a 16-bit unicode char
+ T_32PFCHAR16 = 0x057a, // 16:32 pointer to a 16-bit unicode char
+ T_64PCHAR16 = 0x067a, // 64 bit pointer to a 16-bit unicode char
+
+// really a 32-bit unicode char
+
+ T_CHAR32 = 0x007b, // 32-bit unicode char
+ T_PCHAR32 = 0x017b, // 16 bit pointer to a 32-bit unicode char
+ T_PFCHAR32 = 0x027b, // 16:16 far pointer to a 32-bit unicode char
+ T_PHCHAR32 = 0x037b, // 16:16 huge pointer to a 32-bit unicode char
+ T_32PCHAR32 = 0x047b, // 32 bit pointer to a 32-bit unicode char
+ T_32PFCHAR32 = 0x057b, // 16:32 pointer to a 32-bit unicode char
+ T_64PCHAR32 = 0x067b, // 64 bit pointer to a 32-bit unicode char
+
+// 8 bit int types
+
+ T_INT1 = 0x0068, // 8 bit signed int
+ T_PINT1 = 0x0168, // 16 bit pointer to 8 bit signed int
+ T_PFINT1 = 0x0268, // 16:16 far pointer to 8 bit signed int
+ T_PHINT1 = 0x0368, // 16:16 huge pointer to 8 bit signed int
+ T_32PINT1 = 0x0468, // 32 bit pointer to 8 bit signed int
+ T_32PFINT1 = 0x0568, // 16:32 pointer to 8 bit signed int
+ T_64PINT1 = 0x0668, // 64 bit pointer to 8 bit signed int
+
+ T_UINT1 = 0x0069, // 8 bit unsigned int
+ T_PUINT1 = 0x0169, // 16 bit pointer to 8 bit unsigned int
+ T_PFUINT1 = 0x0269, // 16:16 far pointer to 8 bit unsigned int
+ T_PHUINT1 = 0x0369, // 16:16 huge pointer to 8 bit unsigned int
+ T_32PUINT1 = 0x0469, // 32 bit pointer to 8 bit unsigned int
+ T_32PFUINT1 = 0x0569, // 16:32 pointer to 8 bit unsigned int
+ T_64PUINT1 = 0x0669, // 64 bit pointer to 8 bit unsigned int
+
+
+// 16 bit short types
+
+ T_SHORT = 0x0011, // 16 bit signed
+ T_PSHORT = 0x0111, // 16 bit pointer to 16 bit signed
+ T_PFSHORT = 0x0211, // 16:16 far pointer to 16 bit signed
+ T_PHSHORT = 0x0311, // 16:16 huge pointer to 16 bit signed
+ T_32PSHORT = 0x0411, // 32 bit pointer to 16 bit signed
+ T_32PFSHORT = 0x0511, // 16:32 pointer to 16 bit signed
+ T_64PSHORT = 0x0611, // 64 bit pointer to 16 bit signed
+
+ T_USHORT = 0x0021, // 16 bit unsigned
+ T_PUSHORT = 0x0121, // 16 bit pointer to 16 bit unsigned
+ T_PFUSHORT = 0x0221, // 16:16 far pointer to 16 bit unsigned
+ T_PHUSHORT = 0x0321, // 16:16 huge pointer to 16 bit unsigned
+ T_32PUSHORT = 0x0421, // 32 bit pointer to 16 bit unsigned
+ T_32PFUSHORT = 0x0521, // 16:32 pointer to 16 bit unsigned
+ T_64PUSHORT = 0x0621, // 64 bit pointer to 16 bit unsigned
+
+
+// 16 bit int types
+
+ T_INT2 = 0x0072, // 16 bit signed int
+ T_PINT2 = 0x0172, // 16 bit pointer to 16 bit signed int
+ T_PFINT2 = 0x0272, // 16:16 far pointer to 16 bit signed int
+ T_PHINT2 = 0x0372, // 16:16 huge pointer to 16 bit signed int
+ T_32PINT2 = 0x0472, // 32 bit pointer to 16 bit signed int
+ T_32PFINT2 = 0x0572, // 16:32 pointer to 16 bit signed int
+ T_64PINT2 = 0x0672, // 64 bit pointer to 16 bit signed int
+
+ T_UINT2 = 0x0073, // 16 bit unsigned int
+ T_PUINT2 = 0x0173, // 16 bit pointer to 16 bit unsigned int
+ T_PFUINT2 = 0x0273, // 16:16 far pointer to 16 bit unsigned int
+ T_PHUINT2 = 0x0373, // 16:16 huge pointer to 16 bit unsigned int
+ T_32PUINT2 = 0x0473, // 32 bit pointer to 16 bit unsigned int
+ T_32PFUINT2 = 0x0573, // 16:32 pointer to 16 bit unsigned int
+ T_64PUINT2 = 0x0673, // 64 bit pointer to 16 bit unsigned int
+
+
+// 32 bit long types
+
+ T_LONG = 0x0012, // 32 bit signed
+ T_ULONG = 0x0022, // 32 bit unsigned
+ T_PLONG = 0x0112, // 16 bit pointer to 32 bit signed
+ T_PULONG = 0x0122, // 16 bit pointer to 32 bit unsigned
+ T_PFLONG = 0x0212, // 16:16 far pointer to 32 bit signed
+ T_PFULONG = 0x0222, // 16:16 far pointer to 32 bit unsigned
+ T_PHLONG = 0x0312, // 16:16 huge pointer to 32 bit signed
+ T_PHULONG = 0x0322, // 16:16 huge pointer to 32 bit unsigned
+
+ T_32PLONG = 0x0412, // 32 bit pointer to 32 bit signed
+ T_32PULONG = 0x0422, // 32 bit pointer to 32 bit unsigned
+ T_32PFLONG = 0x0512, // 16:32 pointer to 32 bit signed
+ T_32PFULONG = 0x0522, // 16:32 pointer to 32 bit unsigned
+ T_64PLONG = 0x0612, // 64 bit pointer to 32 bit signed
+ T_64PULONG = 0x0622, // 64 bit pointer to 32 bit unsigned
+
+
+// 32 bit int types
+
+ T_INT4 = 0x0074, // 32 bit signed int
+ T_PINT4 = 0x0174, // 16 bit pointer to 32 bit signed int
+ T_PFINT4 = 0x0274, // 16:16 far pointer to 32 bit signed int
+ T_PHINT4 = 0x0374, // 16:16 huge pointer to 32 bit signed int
+ T_32PINT4 = 0x0474, // 32 bit pointer to 32 bit signed int
+ T_32PFINT4 = 0x0574, // 16:32 pointer to 32 bit signed int
+ T_64PINT4 = 0x0674, // 64 bit pointer to 32 bit signed int
+
+ T_UINT4 = 0x0075, // 32 bit unsigned int
+ T_PUINT4 = 0x0175, // 16 bit pointer to 32 bit unsigned int
+ T_PFUINT4 = 0x0275, // 16:16 far pointer to 32 bit unsigned int
+ T_PHUINT4 = 0x0375, // 16:16 huge pointer to 32 bit unsigned int
+ T_32PUINT4 = 0x0475, // 32 bit pointer to 32 bit unsigned int
+ T_32PFUINT4 = 0x0575, // 16:32 pointer to 32 bit unsigned int
+ T_64PUINT4 = 0x0675, // 64 bit pointer to 32 bit unsigned int
+
+
+// 64 bit quad types
+
+ T_QUAD = 0x0013, // 64 bit signed
+ T_PQUAD = 0x0113, // 16 bit pointer to 64 bit signed
+ T_PFQUAD = 0x0213, // 16:16 far pointer to 64 bit signed
+ T_PHQUAD = 0x0313, // 16:16 huge pointer to 64 bit signed
+ T_32PQUAD = 0x0413, // 32 bit pointer to 64 bit signed
+ T_32PFQUAD = 0x0513, // 16:32 pointer to 64 bit signed
+ T_64PQUAD = 0x0613, // 64 bit pointer to 64 bit signed
+
+ T_UQUAD = 0x0023, // 64 bit unsigned
+ T_PUQUAD = 0x0123, // 16 bit pointer to 64 bit unsigned
+ T_PFUQUAD = 0x0223, // 16:16 far pointer to 64 bit unsigned
+ T_PHUQUAD = 0x0323, // 16:16 huge pointer to 64 bit unsigned
+ T_32PUQUAD = 0x0423, // 32 bit pointer to 64 bit unsigned
+ T_32PFUQUAD = 0x0523, // 16:32 pointer to 64 bit unsigned
+ T_64PUQUAD = 0x0623, // 64 bit pointer to 64 bit unsigned
+
+
+// 64 bit int types
+
+ T_INT8 = 0x0076, // 64 bit signed int
+ T_PINT8 = 0x0176, // 16 bit pointer to 64 bit signed int
+ T_PFINT8 = 0x0276, // 16:16 far pointer to 64 bit signed int
+ T_PHINT8 = 0x0376, // 16:16 huge pointer to 64 bit signed int
+ T_32PINT8 = 0x0476, // 32 bit pointer to 64 bit signed int
+ T_32PFINT8 = 0x0576, // 16:32 pointer to 64 bit signed int
+ T_64PINT8 = 0x0676, // 64 bit pointer to 64 bit signed int
+
+ T_UINT8 = 0x0077, // 64 bit unsigned int
+ T_PUINT8 = 0x0177, // 16 bit pointer to 64 bit unsigned int
+ T_PFUINT8 = 0x0277, // 16:16 far pointer to 64 bit unsigned int
+ T_PHUINT8 = 0x0377, // 16:16 huge pointer to 64 bit unsigned int
+ T_32PUINT8 = 0x0477, // 32 bit pointer to 64 bit unsigned int
+ T_32PFUINT8 = 0x0577, // 16:32 pointer to 64 bit unsigned int
+ T_64PUINT8 = 0x0677, // 64 bit pointer to 64 bit unsigned int
+
+
+// 128 bit octet types
+
+ T_OCT = 0x0014, // 128 bit signed
+ T_POCT = 0x0114, // 16 bit pointer to 128 bit signed
+ T_PFOCT = 0x0214, // 16:16 far pointer to 128 bit signed
+ T_PHOCT = 0x0314, // 16:16 huge pointer to 128 bit signed
+ T_32POCT = 0x0414, // 32 bit pointer to 128 bit signed
+ T_32PFOCT = 0x0514, // 16:32 pointer to 128 bit signed
+ T_64POCT = 0x0614, // 64 bit pointer to 128 bit signed
+
+ T_UOCT = 0x0024, // 128 bit unsigned
+ T_PUOCT = 0x0124, // 16 bit pointer to 128 bit unsigned
+ T_PFUOCT = 0x0224, // 16:16 far pointer to 128 bit unsigned
+ T_PHUOCT = 0x0324, // 16:16 huge pointer to 128 bit unsigned
+ T_32PUOCT = 0x0424, // 32 bit pointer to 128 bit unsigned
+ T_32PFUOCT = 0x0524, // 16:32 pointer to 128 bit unsigned
+ T_64PUOCT = 0x0624, // 64 bit pointer to 128 bit unsigned
+
+
+// 128 bit int types
+
+ T_INT16 = 0x0078, // 128 bit signed int
+ T_PINT16 = 0x0178, // 16 bit pointer to 128 bit signed int
+ T_PFINT16 = 0x0278, // 16:16 far pointer to 128 bit signed int
+ T_PHINT16 = 0x0378, // 16:16 huge pointer to 128 bit signed int
+ T_32PINT16 = 0x0478, // 32 bit pointer to 128 bit signed int
+ T_32PFINT16 = 0x0578, // 16:32 pointer to 128 bit signed int
+ T_64PINT16 = 0x0678, // 64 bit pointer to 128 bit signed int
+
+ T_UINT16 = 0x0079, // 128 bit unsigned int
+ T_PUINT16 = 0x0179, // 16 bit pointer to 128 bit unsigned int
+ T_PFUINT16 = 0x0279, // 16:16 far pointer to 128 bit unsigned int
+ T_PHUINT16 = 0x0379, // 16:16 huge pointer to 128 bit unsigned int
+ T_32PUINT16 = 0x0479, // 32 bit pointer to 128 bit unsigned int
+ T_32PFUINT16 = 0x0579, // 16:32 pointer to 128 bit unsigned int
+ T_64PUINT16 = 0x0679, // 64 bit pointer to 128 bit unsigned int
+
+
+// 16 bit real types
+
+ T_REAL16 = 0x0046, // 16 bit real
+ T_PREAL16 = 0x0146, // 16 bit pointer to 16 bit real
+ T_PFREAL16 = 0x0246, // 16:16 far pointer to 16 bit real
+ T_PHREAL16 = 0x0346, // 16:16 huge pointer to 16 bit real
+ T_32PREAL16 = 0x0446, // 32 bit pointer to 16 bit real
+ T_32PFREAL16 = 0x0546, // 16:32 pointer to 16 bit real
+ T_64PREAL16 = 0x0646, // 64 bit pointer to 16 bit real
+
+
+// 32 bit real types
+
+ T_REAL32 = 0x0040, // 32 bit real
+ T_PREAL32 = 0x0140, // 16 bit pointer to 32 bit real
+ T_PFREAL32 = 0x0240, // 16:16 far pointer to 32 bit real
+ T_PHREAL32 = 0x0340, // 16:16 huge pointer to 32 bit real
+ T_32PREAL32 = 0x0440, // 32 bit pointer to 32 bit real
+ T_32PFREAL32 = 0x0540, // 16:32 pointer to 32 bit real
+ T_64PREAL32 = 0x0640, // 64 bit pointer to 32 bit real
+
+
+// 32 bit partial-precision real types
+
+ T_REAL32PP = 0x0045, // 32 bit PP real
+ T_PREAL32PP = 0x0145, // 16 bit pointer to 32 bit PP real
+ T_PFREAL32PP = 0x0245, // 16:16 far pointer to 32 bit PP real
+ T_PHREAL32PP = 0x0345, // 16:16 huge pointer to 32 bit PP real
+ T_32PREAL32PP = 0x0445, // 32 bit pointer to 32 bit PP real
+ T_32PFREAL32PP = 0x0545, // 16:32 pointer to 32 bit PP real
+ T_64PREAL32PP = 0x0645, // 64 bit pointer to 32 bit PP real
+
+
+// 48 bit real types
+
+ T_REAL48 = 0x0044, // 48 bit real
+ T_PREAL48 = 0x0144, // 16 bit pointer to 48 bit real
+ T_PFREAL48 = 0x0244, // 16:16 far pointer to 48 bit real
+ T_PHREAL48 = 0x0344, // 16:16 huge pointer to 48 bit real
+ T_32PREAL48 = 0x0444, // 32 bit pointer to 48 bit real
+ T_32PFREAL48 = 0x0544, // 16:32 pointer to 48 bit real
+ T_64PREAL48 = 0x0644, // 64 bit pointer to 48 bit real
+
+
+// 64 bit real types
+
+ T_REAL64 = 0x0041, // 64 bit real
+ T_PREAL64 = 0x0141, // 16 bit pointer to 64 bit real
+ T_PFREAL64 = 0x0241, // 16:16 far pointer to 64 bit real
+ T_PHREAL64 = 0x0341, // 16:16 huge pointer to 64 bit real
+ T_32PREAL64 = 0x0441, // 32 bit pointer to 64 bit real
+ T_32PFREAL64 = 0x0541, // 16:32 pointer to 64 bit real
+ T_64PREAL64 = 0x0641, // 64 bit pointer to 64 bit real
+
+
+// 80 bit real types
+
+ T_REAL80 = 0x0042, // 80 bit real
+ T_PREAL80 = 0x0142, // 16 bit pointer to 80 bit real
+ T_PFREAL80 = 0x0242, // 16:16 far pointer to 80 bit real
+ T_PHREAL80 = 0x0342, // 16:16 huge pointer to 80 bit real
+ T_32PREAL80 = 0x0442, // 32 bit pointer to 80 bit real
+ T_32PFREAL80 = 0x0542, // 16:32 pointer to 80 bit real
+ T_64PREAL80 = 0x0642, // 64 bit pointer to 80 bit real
+
+
+// 128 bit real types
+
+ T_REAL128 = 0x0043, // 128 bit real
+ T_PREAL128 = 0x0143, // 16 bit pointer to 128 bit real
+ T_PFREAL128 = 0x0243, // 16:16 far pointer to 128 bit real
+ T_PHREAL128 = 0x0343, // 16:16 huge pointer to 128 bit real
+ T_32PREAL128 = 0x0443, // 32 bit pointer to 128 bit real
+ T_32PFREAL128 = 0x0543, // 16:32 pointer to 128 bit real
+ T_64PREAL128 = 0x0643, // 64 bit pointer to 128 bit real
+
+
+// 32 bit complex types
+
+ T_CPLX32 = 0x0050, // 32 bit complex
+ T_PCPLX32 = 0x0150, // 16 bit pointer to 32 bit complex
+ T_PFCPLX32 = 0x0250, // 16:16 far pointer to 32 bit complex
+ T_PHCPLX32 = 0x0350, // 16:16 huge pointer to 32 bit complex
+ T_32PCPLX32 = 0x0450, // 32 bit pointer to 32 bit complex
+ T_32PFCPLX32 = 0x0550, // 16:32 pointer to 32 bit complex
+ T_64PCPLX32 = 0x0650, // 64 bit pointer to 32 bit complex
+
+
+// 64 bit complex types
+
+ T_CPLX64 = 0x0051, // 64 bit complex
+ T_PCPLX64 = 0x0151, // 16 bit pointer to 64 bit complex
+ T_PFCPLX64 = 0x0251, // 16:16 far pointer to 64 bit complex
+ T_PHCPLX64 = 0x0351, // 16:16 huge pointer to 64 bit complex
+ T_32PCPLX64 = 0x0451, // 32 bit pointer to 64 bit complex
+ T_32PFCPLX64 = 0x0551, // 16:32 pointer to 64 bit complex
+ T_64PCPLX64 = 0x0651, // 64 bit pointer to 64 bit complex
+
+
+// 80 bit complex types
+
+ T_CPLX80 = 0x0052, // 80 bit complex
+ T_PCPLX80 = 0x0152, // 16 bit pointer to 80 bit complex
+ T_PFCPLX80 = 0x0252, // 16:16 far pointer to 80 bit complex
+ T_PHCPLX80 = 0x0352, // 16:16 huge pointer to 80 bit complex
+ T_32PCPLX80 = 0x0452, // 32 bit pointer to 80 bit complex
+ T_32PFCPLX80 = 0x0552, // 16:32 pointer to 80 bit complex
+ T_64PCPLX80 = 0x0652, // 64 bit pointer to 80 bit complex
+
+
+// 128 bit complex types
+
+ T_CPLX128 = 0x0053, // 128 bit complex
+ T_PCPLX128 = 0x0153, // 16 bit pointer to 128 bit complex
+ T_PFCPLX128 = 0x0253, // 16:16 far pointer to 128 bit complex
+ T_PHCPLX128 = 0x0353, // 16:16 huge pointer to 128 bit real
+ T_32PCPLX128 = 0x0453, // 32 bit pointer to 128 bit complex
+ T_32PFCPLX128 = 0x0553, // 16:32 pointer to 128 bit complex
+ T_64PCPLX128 = 0x0653, // 64 bit pointer to 128 bit complex
+
+
+// boolean types
+
+ T_BOOL08 = 0x0030, // 8 bit boolean
+ T_PBOOL08 = 0x0130, // 16 bit pointer to 8 bit boolean
+ T_PFBOOL08 = 0x0230, // 16:16 far pointer to 8 bit boolean
+ T_PHBOOL08 = 0x0330, // 16:16 huge pointer to 8 bit boolean
+ T_32PBOOL08 = 0x0430, // 32 bit pointer to 8 bit boolean
+ T_32PFBOOL08 = 0x0530, // 16:32 pointer to 8 bit boolean
+ T_64PBOOL08 = 0x0630, // 64 bit pointer to 8 bit boolean
+
+ T_BOOL16 = 0x0031, // 16 bit boolean
+ T_PBOOL16 = 0x0131, // 16 bit pointer to 16 bit boolean
+ T_PFBOOL16 = 0x0231, // 16:16 far pointer to 16 bit boolean
+ T_PHBOOL16 = 0x0331, // 16:16 huge pointer to 16 bit boolean
+ T_32PBOOL16 = 0x0431, // 32 bit pointer to 18 bit boolean
+ T_32PFBOOL16 = 0x0531, // 16:32 pointer to 16 bit boolean
+ T_64PBOOL16 = 0x0631, // 64 bit pointer to 18 bit boolean
+
+ T_BOOL32 = 0x0032, // 32 bit boolean
+ T_PBOOL32 = 0x0132, // 16 bit pointer to 32 bit boolean
+ T_PFBOOL32 = 0x0232, // 16:16 far pointer to 32 bit boolean
+ T_PHBOOL32 = 0x0332, // 16:16 huge pointer to 32 bit boolean
+ T_32PBOOL32 = 0x0432, // 32 bit pointer to 32 bit boolean
+ T_32PFBOOL32 = 0x0532, // 16:32 pointer to 32 bit boolean
+ T_64PBOOL32 = 0x0632, // 64 bit pointer to 32 bit boolean
+
+ T_BOOL64 = 0x0033, // 64 bit boolean
+ T_PBOOL64 = 0x0133, // 16 bit pointer to 64 bit boolean
+ T_PFBOOL64 = 0x0233, // 16:16 far pointer to 64 bit boolean
+ T_PHBOOL64 = 0x0333, // 16:16 huge pointer to 64 bit boolean
+ T_32PBOOL64 = 0x0433, // 32 bit pointer to 64 bit boolean
+ T_32PFBOOL64 = 0x0533, // 16:32 pointer to 64 bit boolean
+ T_64PBOOL64 = 0x0633, // 64 bit pointer to 64 bit boolean
+
+
+// ???
+
+ T_NCVPTR = 0x01f0, // CV Internal type for created near pointers
+ T_FCVPTR = 0x02f0, // CV Internal type for created far pointers
+ T_HCVPTR = 0x03f0, // CV Internal type for created huge pointers
+ T_32NCVPTR = 0x04f0, // CV Internal type for created near 32-bit pointers
+ T_32FCVPTR = 0x05f0, // CV Internal type for created far 32-bit pointers
+ T_64NCVPTR = 0x06f0, // CV Internal type for created near 64-bit pointers
+
+} TYPE_ENUM_e;
+
+/** No leaf index can have a value of 0x0000. The leaf indices are
+ * separated into ranges depending upon the use of the type record.
+ * The second range is for the type records that are directly referenced
+ * in symbols. The first range is for type records that are not
+ * referenced by symbols but instead are referenced by other type
+ * records. All type records must have a starting leaf index in these
+ * first two ranges. The third range of leaf indices are used to build
+ * up complex lists such as the field list of a class type record. No
+ * type record can begin with one of the leaf indices. The fourth ranges
+ * of type indices are used to represent numeric data in a symbol or
+ * type record. These leaf indices are greater than 0x8000. At the
+ * point that type or symbol processor is expecting a numeric field, the
+ * next two bytes in the type record are examined. If the value is less
+ * than 0x8000, then the two bytes contain the numeric value. If the
+ * value is greater than 0x8000, then the data follows the leaf index in
+ * a format specified by the leaf index. The final range of leaf indices
+ * are used to force alignment of subfields within a complex type record..
+ */
+
+
+typedef enum LEAF_ENUM_e {
+ // leaf indices starting records but referenced from symbol records
+
+ LF_MODIFIER_16t = 0x0001,
+ LF_POINTER_16t = 0x0002,
+ LF_ARRAY_16t = 0x0003,
+ LF_CLASS_16t = 0x0004,
+ LF_STRUCTURE_16t = 0x0005,
+ LF_UNION_16t = 0x0006,
+ LF_ENUM_16t = 0x0007,
+ LF_PROCEDURE_16t = 0x0008,
+ LF_MFUNCTION_16t = 0x0009,
+ LF_VTSHAPE = 0x000a,
+ LF_COBOL0_16t = 0x000b,
+ LF_COBOL1 = 0x000c,
+ LF_BARRAY_16t = 0x000d,
+ LF_LABEL = 0x000e,
+ LF_NULL = 0x000f,
+ LF_NOTTRAN = 0x0010,
+ LF_DIMARRAY_16t = 0x0011,
+ LF_VFTPATH_16t = 0x0012,
+ LF_PRECOMP_16t = 0x0013, // not referenced from symbol
+ LF_ENDPRECOMP = 0x0014, // not referenced from symbol
+ LF_OEM_16t = 0x0015, // oem definable type string
+ LF_TYPESERVER_ST = 0x0016, // not referenced from symbol
+
+ // leaf indices starting records but referenced only from type records
+
+ LF_SKIP_16t = 0x0200,
+ LF_ARGLIST_16t = 0x0201,
+ LF_DEFARG_16t = 0x0202,
+ LF_LIST = 0x0203,
+ LF_FIELDLIST_16t = 0x0204,
+ LF_DERIVED_16t = 0x0205,
+ LF_BITFIELD_16t = 0x0206,
+ LF_METHODLIST_16t = 0x0207,
+ LF_DIMCONU_16t = 0x0208,
+ LF_DIMCONLU_16t = 0x0209,
+ LF_DIMVARU_16t = 0x020a,
+ LF_DIMVARLU_16t = 0x020b,
+ LF_REFSYM = 0x020c,
+
+ LF_BCLASS_16t = 0x0400,
+ LF_VBCLASS_16t = 0x0401,
+ LF_IVBCLASS_16t = 0x0402,
+ LF_ENUMERATE_ST = 0x0403,
+ LF_FRIENDFCN_16t = 0x0404,
+ LF_INDEX_16t = 0x0405,
+ LF_MEMBER_16t = 0x0406,
+ LF_STMEMBER_16t = 0x0407,
+ LF_METHOD_16t = 0x0408,
+ LF_NESTTYPE_16t = 0x0409,
+ LF_VFUNCTAB_16t = 0x040a,
+ LF_FRIENDCLS_16t = 0x040b,
+ LF_ONEMETHOD_16t = 0x040c,
+ LF_VFUNCOFF_16t = 0x040d,
+
+// 32-bit type index versions of leaves, all have the 0x1000 bit set
+//
+ LF_TI16_MAX = 0x1000,
+
+ LF_MODIFIER = 0x1001,
+ LF_POINTER = 0x1002,
+ LF_ARRAY_ST = 0x1003,
+ LF_CLASS_ST = 0x1004,
+ LF_STRUCTURE_ST = 0x1005,
+ LF_UNION_ST = 0x1006,
+ LF_ENUM_ST = 0x1007,
+ LF_PROCEDURE = 0x1008,
+ LF_MFUNCTION = 0x1009,
+ LF_COBOL0 = 0x100a,
+ LF_BARRAY = 0x100b,
+ LF_DIMARRAY_ST = 0x100c,
+ LF_VFTPATH = 0x100d,
+ LF_PRECOMP_ST = 0x100e, // not referenced from symbol
+ LF_OEM = 0x100f, // oem definable type string
+ LF_ALIAS_ST = 0x1010, // alias (typedef) type
+ LF_OEM2 = 0x1011, // oem definable type string
+
+ // leaf indices starting records but referenced only from type records
+
+ LF_SKIP = 0x1200,
+ LF_ARGLIST = 0x1201,
+ LF_DEFARG_ST = 0x1202,
+ LF_FIELDLIST = 0x1203,
+ LF_DERIVED = 0x1204,
+ LF_BITFIELD = 0x1205,
+ LF_METHODLIST = 0x1206,
+ LF_DIMCONU = 0x1207,
+ LF_DIMCONLU = 0x1208,
+ LF_DIMVARU = 0x1209,
+ LF_DIMVARLU = 0x120a,
+
+ LF_BCLASS = 0x1400,
+ LF_VBCLASS = 0x1401,
+ LF_IVBCLASS = 0x1402,
+ LF_FRIENDFCN_ST = 0x1403,
+ LF_INDEX = 0x1404,
+ LF_MEMBER_ST = 0x1405,
+ LF_STMEMBER_ST = 0x1406,
+ LF_METHOD_ST = 0x1407,
+ LF_NESTTYPE_ST = 0x1408,
+ LF_VFUNCTAB = 0x1409,
+ LF_FRIENDCLS = 0x140a,
+ LF_ONEMETHOD_ST = 0x140b,
+ LF_VFUNCOFF = 0x140c,
+ LF_NESTTYPEEX_ST = 0x140d,
+ LF_MEMBERMODIFY_ST = 0x140e,
+ LF_MANAGED_ST = 0x140f,
+
+ // Types w/ SZ names
+
+ LF_ST_MAX = 0x1500,
+
+ LF_TYPESERVER = 0x1501, // not referenced from symbol
+ LF_ENUMERATE = 0x1502,
+ LF_ARRAY = 0x1503,
+ LF_CLASS = 0x1504,
+ LF_STRUCTURE = 0x1505,
+ LF_UNION = 0x1506,
+ LF_ENUM = 0x1507,
+ LF_DIMARRAY = 0x1508,
+ LF_PRECOMP = 0x1509, // not referenced from symbol
+ LF_ALIAS = 0x150a, // alias (typedef) type
+ LF_DEFARG = 0x150b,
+ LF_FRIENDFCN = 0x150c,
+ LF_MEMBER = 0x150d,
+ LF_STMEMBER = 0x150e,
+ LF_METHOD = 0x150f,
+ LF_NESTTYPE = 0x1510,
+ LF_ONEMETHOD = 0x1511,
+ LF_NESTTYPEEX = 0x1512,
+ LF_MEMBERMODIFY = 0x1513,
+ LF_MANAGED = 0x1514,
+ LF_TYPESERVER2 = 0x1515,
+
+ LF_STRIDED_ARRAY = 0x1516, // same as LF_ARRAY, but with stride between adjacent elements
+ LF_HLSL = 0x1517,
+ LF_MODIFIER_EX = 0x1518,
+ LF_INTERFACE = 0x1519,
+ LF_BINTERFACE = 0x151a,
+ LF_VECTOR = 0x151b,
+ LF_MATRIX = 0x151c,
+
+ LF_VFTABLE = 0x151d, // a virtual function table
+ LF_ENDOFLEAFRECORD = LF_VFTABLE,
+
+ LF_TYPE_LAST, // one greater than the last type record
+ LF_TYPE_MAX = LF_TYPE_LAST - 1,
+
+ LF_FUNC_ID = 0x1601, // global func ID
+ LF_MFUNC_ID = 0x1602, // member func ID
+ LF_BUILDINFO = 0x1603, // build info: tool, version, command line, src/pdb file
+ LF_SUBSTR_LIST = 0x1604, // similar to LF_ARGLIST, for list of sub strings
+ LF_STRING_ID = 0x1605, // string ID
+
+ LF_UDT_SRC_LINE = 0x1606, // source and line on where an UDT is defined
+ // only generated by compiler
+
+ LF_UDT_MOD_SRC_LINE = 0x1607, // module, source and line on where an UDT is defined
+ // only generated by linker
+
+ LF_ID_LAST, // one greater than the last ID record
+ LF_ID_MAX = LF_ID_LAST - 1,
+
+ LF_NUMERIC = 0x8000,
+ LF_CHAR = 0x8000,
+ LF_SHORT = 0x8001,
+ LF_USHORT = 0x8002,
+ LF_LONG = 0x8003,
+ LF_ULONG = 0x8004,
+ LF_REAL32 = 0x8005,
+ LF_REAL64 = 0x8006,
+ LF_REAL80 = 0x8007,
+ LF_REAL128 = 0x8008,
+ LF_QUADWORD = 0x8009,
+ LF_UQUADWORD = 0x800a,
+ LF_REAL48 = 0x800b,
+ LF_COMPLEX32 = 0x800c,
+ LF_COMPLEX64 = 0x800d,
+ LF_COMPLEX80 = 0x800e,
+ LF_COMPLEX128 = 0x800f,
+ LF_VARSTRING = 0x8010,
+
+ LF_OCTWORD = 0x8017,
+ LF_UOCTWORD = 0x8018,
+
+ LF_DECIMAL = 0x8019,
+ LF_DATE = 0x801a,
+ LF_UTF8STRING = 0x801b,
+
+ LF_REAL16 = 0x801c,
+
+ LF_PAD0 = 0xf0,
+ LF_PAD1 = 0xf1,
+ LF_PAD2 = 0xf2,
+ LF_PAD3 = 0xf3,
+ LF_PAD4 = 0xf4,
+ LF_PAD5 = 0xf5,
+ LF_PAD6 = 0xf6,
+ LF_PAD7 = 0xf7,
+ LF_PAD8 = 0xf8,
+ LF_PAD9 = 0xf9,
+ LF_PAD10 = 0xfa,
+ LF_PAD11 = 0xfb,
+ LF_PAD12 = 0xfc,
+ LF_PAD13 = 0xfd,
+ LF_PAD14 = 0xfe,
+ LF_PAD15 = 0xff,
+
+} LEAF_ENUM_e;
+
+// end of leaf indices
+
+
+
+
+// Type enum for pointer records
+// Pointers can be one of the following types
+
+
+typedef enum CV_ptrtype_e {
+ CV_PTR_NEAR = 0x00, // 16 bit pointer
+ CV_PTR_FAR = 0x01, // 16:16 far pointer
+ CV_PTR_HUGE = 0x02, // 16:16 huge pointer
+ CV_PTR_BASE_SEG = 0x03, // based on segment
+ CV_PTR_BASE_VAL = 0x04, // based on value of base
+ CV_PTR_BASE_SEGVAL = 0x05, // based on segment value of base
+ CV_PTR_BASE_ADDR = 0x06, // based on address of base
+ CV_PTR_BASE_SEGADDR = 0x07, // based on segment address of base
+ CV_PTR_BASE_TYPE = 0x08, // based on type
+ CV_PTR_BASE_SELF = 0x09, // based on self
+ CV_PTR_NEAR32 = 0x0a, // 32 bit pointer
+ CV_PTR_FAR32 = 0x0b, // 16:32 pointer
+ CV_PTR_64 = 0x0c, // 64 bit pointer
+ CV_PTR_UNUSEDPTR = 0x0d // first unused pointer type
+} CV_ptrtype_e;
+
+
+
+
+
+// Mode enum for pointers
+// Pointers can have one of the following modes
+//
+// To support for l-value and r-value reference, we added CV_PTR_MODE_LVREF
+// and CV_PTR_MODE_RVREF. CV_PTR_MODE_REF should be removed at some point.
+// We keep it now so that old code that uses it won't be broken.
+//
+
+typedef enum CV_ptrmode_e {
+ CV_PTR_MODE_PTR = 0x00, // "normal" pointer
+ CV_PTR_MODE_REF = 0x01, // "old" reference
+ CV_PTR_MODE_LVREF = 0x01, // l-value reference
+ CV_PTR_MODE_PMEM = 0x02, // pointer to data member
+ CV_PTR_MODE_PMFUNC = 0x03, // pointer to member function
+ CV_PTR_MODE_RVREF = 0x04, // r-value reference
+ CV_PTR_MODE_RESERVED= 0x05 // first unused pointer mode
+} CV_ptrmode_e;
+
+
+// enumeration for pointer-to-member types
+
+typedef enum CV_pmtype_e {
+ CV_PMTYPE_Undef = 0x00, // not specified (pre VC8)
+ CV_PMTYPE_D_Single = 0x01, // member data, single inheritance
+ CV_PMTYPE_D_Multiple= 0x02, // member data, multiple inheritance
+ CV_PMTYPE_D_Virtual = 0x03, // member data, virtual inheritance
+ CV_PMTYPE_D_General = 0x04, // member data, most general
+ CV_PMTYPE_F_Single = 0x05, // member function, single inheritance
+ CV_PMTYPE_F_Multiple= 0x06, // member function, multiple inheritance
+ CV_PMTYPE_F_Virtual = 0x07, // member function, virtual inheritance
+ CV_PMTYPE_F_General = 0x08, // member function, most general
+} CV_pmtype_e;
+
+// enumeration for method properties
+
+typedef enum CV_methodprop_e {
+ CV_MTvanilla = 0x00,
+ CV_MTvirtual = 0x01,
+ CV_MTstatic = 0x02,
+ CV_MTfriend = 0x03,
+ CV_MTintro = 0x04,
+ CV_MTpurevirt = 0x05,
+ CV_MTpureintro = 0x06
+} CV_methodprop_e;
+
+
+
+
+// enumeration for virtual shape table entries
+
+typedef enum CV_VTS_desc_e {
+ CV_VTS_near = 0x00,
+ CV_VTS_far = 0x01,
+ CV_VTS_thin = 0x02,
+ CV_VTS_outer = 0x03,
+ CV_VTS_meta = 0x04,
+ CV_VTS_near32 = 0x05,
+ CV_VTS_far32 = 0x06,
+ CV_VTS_unused = 0x07
+} CV_VTS_desc_e;
+
+
+
+
+// enumeration for LF_LABEL address modes
+
+typedef enum CV_LABEL_TYPE_e {
+ CV_LABEL_NEAR = 0, // near return
+ CV_LABEL_FAR = 4 // far return
+} CV_LABEL_TYPE_e;
+
+
+
+// enumeration for LF_MODIFIER values
+
+
+typedef struct CV_modifier_t {
+ unsigned short MOD_const :1;
+ unsigned short MOD_volatile :1;
+ unsigned short MOD_unaligned :1;
+ unsigned short MOD_unused :13;
+} CV_modifier_t;
+
+
+
+
+// enumeration for HFA kinds
+
+typedef enum CV_HFA_e {
+ CV_HFA_none = 0,
+ CV_HFA_float = 1,
+ CV_HFA_double = 2,
+ CV_HFA_other = 3
+} CV_HFA_e;
+
+// enumeration for MoCOM UDT kinds
+
+typedef enum CV_MOCOM_UDT_e {
+ CV_MOCOM_UDT_none = 0,
+ CV_MOCOM_UDT_ref = 1,
+ CV_MOCOM_UDT_value = 2,
+ CV_MOCOM_UDT_interface = 3
+} CV_MOCOM_UDT_e;
+
+// bit field structure describing class/struct/union/enum properties
+
+typedef struct CV_prop_t {
+ unsigned short packed :1; // true if structure is packed
+ unsigned short ctor :1; // true if constructors or destructors present
+ unsigned short ovlops :1; // true if overloaded operators present
+ unsigned short isnested :1; // true if this is a nested class
+ unsigned short cnested :1; // true if this class contains nested types
+ unsigned short opassign :1; // true if overloaded assignment (=)
+ unsigned short opcast :1; // true if casting methods
+ unsigned short fwdref :1; // true if forward reference (incomplete defn)
+ unsigned short scoped :1; // scoped definition
+ unsigned short hasuniquename :1; // true if there is a decorated name following the regular name
+ unsigned short sealed :1; // true if class cannot be used as a base class
+ unsigned short hfa :2; // CV_HFA_e
+ unsigned short intrinsic :1; // true if class is an intrinsic type (e.g. __m128d)
+ unsigned short mocom :2; // CV_MOCOM_UDT_e
+} CV_prop_t;
+
+
+
+
+// class field attribute
+
+typedef struct CV_fldattr_t {
+ unsigned short access :2; // access protection CV_access_t
+ unsigned short mprop :3; // method properties CV_methodprop_t
+ unsigned short pseudo :1; // compiler generated fcn and does not exist
+ unsigned short noinherit :1; // true if class cannot be inherited
+ unsigned short noconstruct :1; // true if class cannot be constructed
+ unsigned short compgenx :1; // compiler generated fcn and does exist
+ unsigned short sealed :1; // true if method cannot be overridden
+ unsigned short unused :6; // unused
+} CV_fldattr_t;
+
+
+// function flags
+
+typedef struct CV_funcattr_t {
+ unsigned char cxxreturnudt :1; // true if C++ style ReturnUDT
+ unsigned char ctor :1; // true if func is an instance constructor
+ unsigned char ctorvbase :1; // true if func is an instance constructor of a class with virtual bases
+ unsigned char unused :5; // unused
+} CV_funcattr_t;
+
+
+// matrix flags
+
+typedef struct CV_matrixattr_t {
+ unsigned char row_major :1; // true if matrix has row-major layout (column-major is default)
+ unsigned char unused :7; // unused
+} CV_matrixattr_t;
+
+
+// Structures to access to the type records
+
+
+typedef struct TYPTYPE {
+ unsigned short len;
+ unsigned short leaf;
+ unsigned char data[CV_ZEROLEN];
+} TYPTYPE; // general types record
+
+__INLINE char *NextType ( _In_ char * pType) {
+ return (pType + ((TYPTYPE *)pType)->len + sizeof(unsigned short));
+}
+
+typedef enum CV_PMEMBER {
+ CV_PDM16_NONVIRT = 0x00, // 16:16 data no virtual fcn or base
+ CV_PDM16_VFCN = 0x01, // 16:16 data with virtual functions
+ CV_PDM16_VBASE = 0x02, // 16:16 data with virtual bases
+ CV_PDM32_NVVFCN = 0x03, // 16:32 data w/wo virtual functions
+ CV_PDM32_VBASE = 0x04, // 16:32 data with virtual bases
+
+ CV_PMF16_NEARNVSA = 0x05, // 16:16 near method nonvirtual single address point
+ CV_PMF16_NEARNVMA = 0x06, // 16:16 near method nonvirtual multiple address points
+ CV_PMF16_NEARVBASE = 0x07, // 16:16 near method virtual bases
+ CV_PMF16_FARNVSA = 0x08, // 16:16 far method nonvirtual single address point
+ CV_PMF16_FARNVMA = 0x09, // 16:16 far method nonvirtual multiple address points
+ CV_PMF16_FARVBASE = 0x0a, // 16:16 far method virtual bases
+
+ CV_PMF32_NVSA = 0x0b, // 16:32 method nonvirtual single address point
+ CV_PMF32_NVMA = 0x0c, // 16:32 method nonvirtual multiple address point
+ CV_PMF32_VBASE = 0x0d // 16:32 method virtual bases
+} CV_PMEMBER;
+
+
+
+// memory representation of pointer to member. These representations are
+// indexed by the enumeration above in the LF_POINTER record
+
+
+
+
+// representation of a 16:16 pointer to data for a class with no
+// virtual functions or virtual bases
+
+
+struct CV_PDMR16_NONVIRT {
+ CV_off16_t mdisp; // displacement to data (NULL = -1)
+};
+
+
+
+
+// representation of a 16:16 pointer to data for a class with virtual
+// functions
+
+
+struct CV_PMDR16_VFCN {
+ CV_off16_t mdisp; // displacement to data ( NULL = 0)
+};
+
+
+
+
+// representation of a 16:16 pointer to data for a class with
+// virtual bases
+
+
+struct CV_PDMR16_VBASE {
+ CV_off16_t mdisp; // displacement to data
+ CV_off16_t pdisp; // this pointer displacement to vbptr
+ CV_off16_t vdisp; // displacement within vbase table
+ // NULL = (,,0xffff)
+};
+
+
+
+
+// representation of a 32 bit pointer to data for a class with
+// or without virtual functions and no virtual bases
+
+
+struct CV_PDMR32_NVVFCN {
+ CV_off32_t mdisp; // displacement to data (NULL = 0x80000000)
+};
+
+
+
+
+// representation of a 32 bit pointer to data for a class
+// with virtual bases
+
+
+struct CV_PDMR32_VBASE {
+ CV_off32_t mdisp; // displacement to data
+ CV_off32_t pdisp; // this pointer displacement
+ CV_off32_t vdisp; // vbase table displacement
+ // NULL = (,,0xffffffff)
+};
+
+
+
+
+// representation of a 16:16 pointer to near member function for a
+// class with no virtual functions or bases and a single address point
+
+
+struct CV_PMFR16_NEARNVSA {
+ CV_uoff16_t off; // near address of function (NULL = 0)
+};
+
+
+
+// representation of a 16 bit pointer to member functions of a
+// class with no virtual bases and multiple address points
+
+
+struct CV_PMFR16_NEARNVMA {
+ CV_uoff16_t off; // offset of function (NULL = 0,x)
+ signed short disp;
+};
+
+
+
+
+// representation of a 16 bit pointer to member function of a
+// class with virtual bases
+
+
+struct CV_PMFR16_NEARVBASE {
+ CV_uoff16_t off; // offset of function (NULL = 0,x,x,x)
+ CV_off16_t mdisp; // displacement to data
+ CV_off16_t pdisp; // this pointer displacement
+ CV_off16_t vdisp; // vbase table displacement
+};
+
+
+
+
+// representation of a 16:16 pointer to far member function for a
+// class with no virtual bases and a single address point
+
+
+struct CV_PMFR16_FARNVSA {
+ CV_uoff16_t off; // offset of function (NULL = 0:0)
+ unsigned short seg; // segment of function
+};
+
+
+
+
+// representation of a 16:16 far pointer to member functions of a
+// class with no virtual bases and multiple address points
+
+
+struct CV_PMFR16_FARNVMA {
+ CV_uoff16_t off; // offset of function (NULL = 0:0,x)
+ unsigned short seg;
+ signed short disp;
+};
+
+
+
+
+// representation of a 16:16 far pointer to member function of a
+// class with virtual bases
+
+
+struct CV_PMFR16_FARVBASE {
+ CV_uoff16_t off; // offset of function (NULL = 0:0,x,x,x)
+ unsigned short seg;
+ CV_off16_t mdisp; // displacement to data
+ CV_off16_t pdisp; // this pointer displacement
+ CV_off16_t vdisp; // vbase table displacement
+
+};
+
+
+
+
+// representation of a 32 bit pointer to member function for a
+// class with no virtual bases and a single address point
+
+
+struct CV_PMFR32_NVSA {
+ CV_uoff32_t off; // near address of function (NULL = 0L)
+};
+
+
+
+
+// representation of a 32 bit pointer to member function for a
+// class with no virtual bases and multiple address points
+
+
+struct CV_PMFR32_NVMA {
+ CV_uoff32_t off; // near address of function (NULL = 0L,x)
+ CV_off32_t disp;
+};
+
+
+
+
+// representation of a 32 bit pointer to member function for a
+// class with virtual bases
+
+
+struct CV_PMFR32_VBASE {
+ CV_uoff32_t off; // near address of function (NULL = 0L,x,x,x)
+ CV_off32_t mdisp; // displacement to data
+ CV_off32_t pdisp; // this pointer displacement
+ CV_off32_t vdisp; // vbase table displacement
+};
+
+
+
+
+
+// Easy leaf - used for generic casting to reference leaf field
+// of a subfield of a complex list
+
+typedef struct lfEasy {
+ unsigned short leaf; // LF_...
+} lfEasy;
+
+
+/** The following type records are basically variant records of the
+ * above structure. The "unsigned short leaf" of the above structure and
+ * the "unsigned short leaf" of the following type definitions are the same
+ * symbol. When the OMF record is locked via the MHOMFLock API
+ * call, the address of the "unsigned short leaf" is returned
+ */
+
+/** Notes on alignment
+ * Alignment of the fields in most of the type records is done on the
+ * basis of the TYPTYPE record base. That is why in most of the lf*
+ * records that the CV_typ_t (32-bit types) is located on what appears to
+ * be a offset mod 4 == 2 boundary. The exception to this rule are those
+ * records that are in a list (lfFieldList, lfMethodList), which are
+ * aligned to their own bases since they don't have the length field
+ */
+
+/**** Change log for 16-bit to 32-bit type and symbol records
+
+ Record type Change (f == field arrangement, p = padding added)
+ ----------------------------------------------------------------------
+ lfModifer f
+ lfPointer fp
+ lfClass f
+ lfStructure f
+ lfUnion f
+ lfEnum f
+ lfVFTPath p
+ lfPreComp p
+ lfOEM p
+ lfArgList p
+ lfDerived p
+ mlMethod p (method list member)
+ lfBitField f
+ lfDimCon f
+ lfDimVar p
+ lfIndex p (field list member)
+ lfBClass f (field list member)
+ lfVBClass f (field list member)
+ lfFriendCls p (field list member)
+ lfFriendFcn p (field list member)
+ lfMember f (field list member)
+ lfSTMember f (field list member)
+ lfVFuncTab p (field list member)
+ lfVFuncOff p (field list member)
+ lfNestType p (field list member)
+
+ DATASYM32 f
+ PROCSYM32 f
+ VPATHSYM32 f
+ REGREL32 f
+ THREADSYM32 f
+ PROCSYMMIPS f
+
+
+*/
+
+// Type record for LF_MODIFIER
+
+typedef struct lfModifier_16t {
+ unsigned short leaf; // LF_MODIFIER_16t
+ CV_modifier_t attr; // modifier attribute modifier_t
+ CV_typ16_t type; // modified type
+} lfModifier_16t;
+
+typedef struct lfModifier {
+ unsigned short leaf; // LF_MODIFIER
+ CV_typ_t type; // modified type
+ CV_modifier_t attr; // modifier attribute modifier_t
+} lfModifier;
+
+
+
+
+// type record for LF_POINTER
+
+#ifndef __cplusplus
+typedef struct lfPointer_16t {
+#endif
+ struct lfPointerBody_16t {
+ unsigned short leaf; // LF_POINTER_16t
+ struct lfPointerAttr_16t {
+ unsigned char ptrtype :5; // ordinal specifying pointer type (CV_ptrtype_e)
+ unsigned char ptrmode :3; // ordinal specifying pointer mode (CV_ptrmode_e)
+ unsigned char isflat32 :1; // true if 0:32 pointer
+ unsigned char isvolatile :1; // TRUE if volatile pointer
+ unsigned char isconst :1; // TRUE if const pointer
+ unsigned char isunaligned :1; // TRUE if unaligned pointer
+ unsigned char unused :4;
+ } attr;
+ CV_typ16_t utype; // type index of the underlying type
+#if (defined(__cplusplus) || defined(_MSC_VER)) // for C++ and MS compilers that support unnamed unions
+ };
+#else
+ } u;
+#endif
+#ifdef __cplusplus
+typedef struct lfPointer_16t : public lfPointerBody_16t {
+#endif
+ union {
+ struct {
+ CV_typ16_t pmclass; // index of containing class for pointer to member
+ unsigned short pmenum; // enumeration specifying pm format (CV_pmtype_e)
+ } pm;
+ unsigned short bseg; // base segment if PTR_BASE_SEG
+ unsigned char Sym[1]; // copy of base symbol record (including length)
+ struct {
+ CV_typ16_t index; // type index if CV_PTR_BASE_TYPE
+ unsigned char name[1]; // name of base type
+ } btype;
+ } pbase;
+} lfPointer_16t;
+
+#ifndef __cplusplus
+typedef struct lfPointer {
+#endif
+ struct lfPointerBody {
+ unsigned short leaf; // LF_POINTER
+ CV_typ_t utype; // type index of the underlying type
+ struct lfPointerAttr {
+ unsigned long ptrtype :5; // ordinal specifying pointer type (CV_ptrtype_e)
+ unsigned long ptrmode :3; // ordinal specifying pointer mode (CV_ptrmode_e)
+ unsigned long isflat32 :1; // true if 0:32 pointer
+ unsigned long isvolatile :1; // TRUE if volatile pointer
+ unsigned long isconst :1; // TRUE if const pointer
+ unsigned long isunaligned :1; // TRUE if unaligned pointer
+ unsigned long isrestrict :1; // TRUE if restricted pointer (allow agressive opts)
+ unsigned long size :6; // size of pointer (in bytes)
+ unsigned long ismocom :1; // TRUE if it is a MoCOM pointer (^ or %)
+ unsigned long islref :1; // TRUE if it is this pointer of member function with & ref-qualifier
+ unsigned long isrref :1; // TRUE if it is this pointer of member function with && ref-qualifier
+ unsigned long unused :10;// pad out to 32-bits for following cv_typ_t's
+ } attr;
+#if (defined(__cplusplus) || defined(_MSC_VER)) // for C++ and MS compilers that support unnamed unions
+ };
+#else
+ } u;
+#endif
+#ifdef __cplusplus
+typedef struct lfPointer : public lfPointerBody {
+#endif
+ union {
+ struct {
+ CV_typ_t pmclass; // index of containing class for pointer to member
+ unsigned short pmenum; // enumeration specifying pm format (CV_pmtype_e)
+ } pm;
+ unsigned short bseg; // base segment if PTR_BASE_SEG
+ unsigned char Sym[1]; // copy of base symbol record (including length)
+ struct {
+ CV_typ_t index; // type index if CV_PTR_BASE_TYPE
+ unsigned char name[1]; // name of base type
+ } btype;
+ } pbase;
+} lfPointer;
+
+
+
+
+// type record for LF_ARRAY
+
+
+typedef struct lfArray_16t {
+ unsigned short leaf; // LF_ARRAY_16t
+ CV_typ16_t elemtype; // type index of element type
+ CV_typ16_t idxtype; // type index of indexing type
+ unsigned char data[CV_ZEROLEN]; // variable length data specifying
+ // size in bytes and name
+} lfArray_16t;
+
+typedef struct lfArray {
+ unsigned short leaf; // LF_ARRAY
+ CV_typ_t elemtype; // type index of element type
+ CV_typ_t idxtype; // type index of indexing type
+ unsigned char data[CV_ZEROLEN]; // variable length data specifying
+ // size in bytes and name
+} lfArray;
+
+typedef struct lfStridedArray {
+ unsigned short leaf; // LF_STRIDED_ARRAY
+ CV_typ_t elemtype; // type index of element type
+ CV_typ_t idxtype; // type index of indexing type
+ unsigned long stride;
+ unsigned char data[CV_ZEROLEN]; // variable length data specifying
+ // size in bytes and name
+} lfStridedArray;
+
+
+
+
+// type record for LF_VECTOR
+
+
+typedef struct lfVector {
+ unsigned short leaf; // LF_VECTOR
+ CV_typ_t elemtype; // type index of element type
+ unsigned long count; // number of elements in the vector
+ unsigned char data[CV_ZEROLEN]; // variable length data specifying
+ // size in bytes and name
+} lfVector;
+
+
+
+
+// type record for LF_MATRIX
+
+
+typedef struct lfMatrix {
+ unsigned short leaf; // LF_MATRIX
+ CV_typ_t elemtype; // type index of element type
+ unsigned long rows; // number of rows
+ unsigned long cols; // number of columns
+ unsigned long majorStride;
+ CV_matrixattr_t matattr; // attributes
+ unsigned char data[CV_ZEROLEN]; // variable length data specifying
+ // size in bytes and name
+} lfMatrix;
+
+
+
+
+// type record for LF_CLASS, LF_STRUCTURE
+
+
+typedef struct lfClass_16t {
+ unsigned short leaf; // LF_CLASS_16t, LF_STRUCT_16t
+ unsigned short count; // count of number of elements in class
+ CV_typ16_t field; // type index of LF_FIELD descriptor list
+ CV_prop_t property; // property attribute field (prop_t)
+ CV_typ16_t derived; // type index of derived from list if not zero
+ CV_typ16_t vshape; // type index of vshape table for this class
+ unsigned char data[CV_ZEROLEN]; // data describing length of structure in
+ // bytes and name
+} lfClass_16t;
+typedef lfClass_16t lfStructure_16t;
+
+
+typedef struct lfClass {
+ unsigned short leaf; // LF_CLASS, LF_STRUCT, LF_INTERFACE
+ unsigned short count; // count of number of elements in class
+ CV_prop_t property; // property attribute field (prop_t)
+ CV_typ_t field; // type index of LF_FIELD descriptor list
+ CV_typ_t derived; // type index of derived from list if not zero
+ CV_typ_t vshape; // type index of vshape table for this class
+ unsigned char data[CV_ZEROLEN]; // data describing length of structure in
+ // bytes and name
+} lfClass;
+typedef lfClass lfStructure;
+typedef lfClass lfInterface;
+
+// type record for LF_UNION
+
+
+typedef struct lfUnion_16t {
+ unsigned short leaf; // LF_UNION_16t
+ unsigned short count; // count of number of elements in class
+ CV_typ16_t field; // type index of LF_FIELD descriptor list
+ CV_prop_t property; // property attribute field
+ unsigned char data[CV_ZEROLEN]; // variable length data describing length of
+ // structure and name
+} lfUnion_16t;
+
+
+typedef struct lfUnion {
+ unsigned short leaf; // LF_UNION
+ unsigned short count; // count of number of elements in class
+ CV_prop_t property; // property attribute field
+ CV_typ_t field; // type index of LF_FIELD descriptor list
+ unsigned char data[CV_ZEROLEN]; // variable length data describing length of
+ // structure and name
+} lfUnion;
+
+
+// type record for LF_ALIAS
+
+typedef struct lfAlias {
+ unsigned short leaf; // LF_ALIAS
+ CV_typ_t utype; // underlying type
+ unsigned char Name[1]; // alias name
+} lfAlias;
+
+// Item Id is a stricter typeindex which may referenced from symbol stream.
+// The code item always had a name.
+
+typedef CV_typ_t CV_ItemId;
+
+typedef struct lfFuncId {
+ unsigned short leaf; // LF_FUNC_ID
+ CV_ItemId scopeId; // parent scope of the ID, 0 if global
+ CV_typ_t type; // function type
+ unsigned char name[CV_ZEROLEN];
+} lfFuncId;
+
+typedef struct lfMFuncId {
+ unsigned short leaf; // LF_MFUNC_ID
+ CV_typ_t parentType; // type index of parent
+ CV_typ_t type; // function type
+ unsigned char name[CV_ZEROLEN];
+} lfMFuncId;
+
+typedef struct lfStringId {
+ unsigned short leaf; // LF_STRING_ID
+ CV_ItemId id; // ID to list of sub string IDs
+ unsigned char name[CV_ZEROLEN];
+} lfStringId;
+
+typedef struct lfUdtSrcLine {
+ unsigned short leaf; // LF_UDT_SRC_LINE
+ CV_typ_t type; // UDT's type index
+ CV_ItemId src; // index to LF_STRING_ID record where source file name is saved
+ unsigned long line; // line number
+} lfUdtSrcLine;
+
+typedef struct lfUdtModSrcLine {
+ unsigned short leaf; // LF_UDT_MOD_SRC_LINE
+ CV_typ_t type; // UDT's type index
+ CV_ItemId src; // index into string table where source file name is saved
+ unsigned long line; // line number
+ unsigned short imod; // module that contributes this UDT definition
+} lfUdtModSrcLine;
+
+typedef enum CV_BuildInfo_e {
+ CV_BuildInfo_CurrentDirectory = 0,
+ CV_BuildInfo_BuildTool = 1, // Cl.exe
+ CV_BuildInfo_SourceFile = 2, // foo.cpp
+ CV_BuildInfo_ProgramDatabaseFile = 3, // foo.pdb
+ CV_BuildInfo_CommandArguments = 4, // -I etc
+ CV_BUILDINFO_KNOWN
+} CV_BuildInfo_e;
+
+// type record for build information
+
+typedef struct lfBuildInfo {
+ unsigned short leaf; // LF_BUILDINFO
+ unsigned short count; // number of arguments
+ CV_ItemId arg[CV_BUILDINFO_KNOWN]; // arguments as CodeItemId
+} lfBuildInfo;
+
+// type record for LF_MANAGED
+
+typedef struct lfManaged {
+ unsigned short leaf; // LF_MANAGED
+ unsigned char Name[1]; // utf8, zero terminated managed type name
+} lfManaged;
+
+
+// type record for LF_ENUM
+
+
+typedef struct lfEnum_16t {
+ unsigned short leaf; // LF_ENUM_16t
+ unsigned short count; // count of number of elements in class
+ CV_typ16_t utype; // underlying type of the enum
+ CV_typ16_t field; // type index of LF_FIELD descriptor list
+ CV_prop_t property; // property attribute field
+ unsigned char Name[1]; // length prefixed name of enum
+} lfEnum_16t;
+
+typedef struct lfEnum {
+ unsigned short leaf; // LF_ENUM
+ unsigned short count; // count of number of elements in class
+ CV_prop_t property; // property attribute field
+ CV_typ_t utype; // underlying type of the enum
+ CV_typ_t field; // type index of LF_FIELD descriptor list
+ unsigned char Name[1]; // length prefixed name of enum
+} lfEnum;
+
+
+
+// Type record for LF_PROCEDURE
+
+
+typedef struct lfProc_16t {
+ unsigned short leaf; // LF_PROCEDURE_16t
+ CV_typ16_t rvtype; // type index of return value
+ unsigned char calltype; // calling convention (CV_call_t)
+ CV_funcattr_t funcattr; // attributes
+ unsigned short parmcount; // number of parameters
+ CV_typ16_t arglist; // type index of argument list
+} lfProc_16t;
+
+typedef struct lfProc {
+ unsigned short leaf; // LF_PROCEDURE
+ CV_typ_t rvtype; // type index of return value
+ unsigned char calltype; // calling convention (CV_call_t)
+ CV_funcattr_t funcattr; // attributes
+ unsigned short parmcount; // number of parameters
+ CV_typ_t arglist; // type index of argument list
+} lfProc;
+
+
+
+// Type record for member function
+
+
+typedef struct lfMFunc_16t {
+ unsigned short leaf; // LF_MFUNCTION_16t
+ CV_typ16_t rvtype; // type index of return value
+ CV_typ16_t classtype; // type index of containing class
+ CV_typ16_t thistype; // type index of this pointer (model specific)
+ unsigned char calltype; // calling convention (call_t)
+ CV_funcattr_t funcattr; // attributes
+ unsigned short parmcount; // number of parameters
+ CV_typ16_t arglist; // type index of argument list
+ long thisadjust; // this adjuster (long because pad required anyway)
+} lfMFunc_16t;
+
+typedef struct lfMFunc {
+ unsigned short leaf; // LF_MFUNCTION
+ CV_typ_t rvtype; // type index of return value
+ CV_typ_t classtype; // type index of containing class
+ CV_typ_t thistype; // type index of this pointer (model specific)
+ unsigned char calltype; // calling convention (call_t)
+ CV_funcattr_t funcattr; // attributes
+ unsigned short parmcount; // number of parameters
+ CV_typ_t arglist; // type index of argument list
+ long thisadjust; // this adjuster (long because pad required anyway)
+} lfMFunc;
+
+
+
+
+// type record for virtual function table shape
+
+
+typedef struct lfVTShape {
+ unsigned short leaf; // LF_VTSHAPE
+ unsigned short count; // number of entries in vfunctable
+ unsigned char desc[CV_ZEROLEN]; // 4 bit (CV_VTS_desc) descriptors
+} lfVTShape;
+
+// type record for a virtual function table
+typedef struct lfVftable {
+ unsigned short leaf; // LF_VFTABLE
+ CV_typ_t type; // class/structure that owns the vftable
+ CV_typ_t baseVftable; // vftable from which this vftable is derived
+ unsigned long offsetInObjectLayout; // offset of the vfptr to this table, relative to the start of the object layout.
+ unsigned long len; // length of the Names array below in bytes.
+ unsigned char Names[1]; // array of names.
+ // The first is the name of the vtable.
+ // The others are the names of the methods.
+ // TS-TODO: replace a name with a NamedCodeItem once Weiping is done, to
+ // avoid duplication of method names.
+} lfVftable;
+
+// type record for cobol0
+
+
+typedef struct lfCobol0_16t {
+ unsigned short leaf; // LF_COBOL0_16t
+ CV_typ16_t type; // parent type record index
+ unsigned char data[CV_ZEROLEN];
+} lfCobol0_16t;
+
+typedef struct lfCobol0 {
+ unsigned short leaf; // LF_COBOL0
+ CV_typ_t type; // parent type record index
+ unsigned char data[CV_ZEROLEN];
+} lfCobol0;
+
+
+
+
+// type record for cobol1
+
+
+typedef struct lfCobol1 {
+ unsigned short leaf; // LF_COBOL1
+ unsigned char data[CV_ZEROLEN];
+} lfCobol1;
+
+
+
+
+// type record for basic array
+
+
+typedef struct lfBArray_16t {
+ unsigned short leaf; // LF_BARRAY_16t
+ CV_typ16_t utype; // type index of underlying type
+} lfBArray_16t;
+
+typedef struct lfBArray {
+ unsigned short leaf; // LF_BARRAY
+ CV_typ_t utype; // type index of underlying type
+} lfBArray;
+
+// type record for assembler labels
+
+
+typedef struct lfLabel {
+ unsigned short leaf; // LF_LABEL
+ unsigned short mode; // addressing mode of label
+} lfLabel;
+
+
+
+// type record for dimensioned arrays
+
+
+typedef struct lfDimArray_16t {
+ unsigned short leaf; // LF_DIMARRAY_16t
+ CV_typ16_t utype; // underlying type of the array
+ CV_typ16_t diminfo; // dimension information
+ unsigned char name[1]; // length prefixed name
+} lfDimArray_16t;
+
+typedef struct lfDimArray {
+ unsigned short leaf; // LF_DIMARRAY
+ CV_typ_t utype; // underlying type of the array
+ CV_typ_t diminfo; // dimension information
+ unsigned char name[1]; // length prefixed name
+} lfDimArray;
+
+
+
+// type record describing path to virtual function table
+
+
+typedef struct lfVFTPath_16t {
+ unsigned short leaf; // LF_VFTPATH_16t
+ unsigned short count; // count of number of bases in path
+ CV_typ16_t base[1]; // bases from root to leaf
+} lfVFTPath_16t;
+
+typedef struct lfVFTPath {
+ unsigned short leaf; // LF_VFTPATH
+ unsigned long count; // count of number of bases in path
+ CV_typ_t base[1]; // bases from root to leaf
+} lfVFTPath;
+
+
+// type record describing inclusion of precompiled types
+
+
+typedef struct lfPreComp_16t {
+ unsigned short leaf; // LF_PRECOMP_16t
+ unsigned short start; // starting type index included
+ unsigned short count; // number of types in inclusion
+ unsigned long signature; // signature
+ unsigned char name[CV_ZEROLEN]; // length prefixed name of included type file
+} lfPreComp_16t;
+
+typedef struct lfPreComp {
+ unsigned short leaf; // LF_PRECOMP
+ unsigned long start; // starting type index included
+ unsigned long count; // number of types in inclusion
+ unsigned long signature; // signature
+ unsigned char name[CV_ZEROLEN]; // length prefixed name of included type file
+} lfPreComp;
+
+
+
+// type record describing end of precompiled types that can be
+// included by another file
+
+
+typedef struct lfEndPreComp {
+ unsigned short leaf; // LF_ENDPRECOMP
+ unsigned long signature; // signature
+} lfEndPreComp;
+
+
+
+
+
+// type record for OEM definable type strings
+
+
+typedef struct lfOEM_16t {
+ unsigned short leaf; // LF_OEM_16t
+ unsigned short cvOEM; // MS assigned OEM identified
+ unsigned short recOEM; // OEM assigned type identifier
+ unsigned short count; // count of type indices to follow
+ CV_typ16_t index[CV_ZEROLEN]; // array of type indices followed
+ // by OEM defined data
+} lfOEM_16t;
+
+typedef struct lfOEM {
+ unsigned short leaf; // LF_OEM
+ unsigned short cvOEM; // MS assigned OEM identified
+ unsigned short recOEM; // OEM assigned type identifier
+ unsigned long count; // count of type indices to follow
+ CV_typ_t index[CV_ZEROLEN]; // array of type indices followed
+ // by OEM defined data
+} lfOEM;
+
+#define OEM_MS_FORTRAN90 0xF090
+#define OEM_ODI 0x0010
+#define OEM_THOMSON_SOFTWARE 0x5453
+#define OEM_ODI_REC_BASELIST 0x0000
+
+typedef struct lfOEM2 {
+ unsigned short leaf; // LF_OEM2
+ unsigned char idOem[16]; // an oem ID (GUID)
+ unsigned long count; // count of type indices to follow
+ CV_typ_t index[CV_ZEROLEN]; // array of type indices followed
+ // by OEM defined data
+} lfOEM2;
+
+// type record describing using of a type server
+
+typedef struct lfTypeServer {
+ unsigned short leaf; // LF_TYPESERVER
+ unsigned long signature; // signature
+ unsigned long age; // age of database used by this module
+ unsigned char name[CV_ZEROLEN]; // length prefixed name of PDB
+} lfTypeServer;
+
+// type record describing using of a type server with v7 (GUID) signatures
+
+typedef struct lfTypeServer2 {
+ unsigned short leaf; // LF_TYPESERVER2
+ SIG70 sig70; // guid signature
+ unsigned long age; // age of database used by this module
+ unsigned char name[CV_ZEROLEN]; // length prefixed name of PDB
+} lfTypeServer2;
+
+// description of type records that can be referenced from
+// type records referenced by symbols
+
+
+
+// type record for skip record
+
+
+typedef struct lfSkip_16t {
+ unsigned short leaf; // LF_SKIP_16t
+ CV_typ16_t type; // next valid index
+ unsigned char data[CV_ZEROLEN]; // pad data
+} lfSkip_16t;
+
+typedef struct lfSkip {
+ unsigned short leaf; // LF_SKIP
+ CV_typ_t type; // next valid index
+ unsigned char data[CV_ZEROLEN]; // pad data
+} lfSkip;
+
+
+
+// argument list leaf
+
+
+typedef struct lfArgList_16t {
+ unsigned short leaf; // LF_ARGLIST_16t
+ unsigned short count; // number of arguments
+ CV_typ16_t arg[CV_ZEROLEN]; // number of arguments
+} lfArgList_16t;
+
+typedef struct lfArgList {
+ unsigned short leaf; // LF_ARGLIST, LF_SUBSTR_LIST
+ unsigned long count; // number of arguments
+ CV_typ_t arg[CV_ZEROLEN]; // number of arguments
+} lfArgList;
+
+
+
+
+// derived class list leaf
+
+
+typedef struct lfDerived_16t {
+ unsigned short leaf; // LF_DERIVED_16t
+ unsigned short count; // number of arguments
+ CV_typ16_t drvdcls[CV_ZEROLEN]; // type indices of derived classes
+} lfDerived_16t;
+
+typedef struct lfDerived {
+ unsigned short leaf; // LF_DERIVED
+ unsigned long count; // number of arguments
+ CV_typ_t drvdcls[CV_ZEROLEN]; // type indices of derived classes
+} lfDerived;
+
+
+
+
+// leaf for default arguments
+
+
+typedef struct lfDefArg_16t {
+ unsigned short leaf; // LF_DEFARG_16t
+ CV_typ16_t type; // type of resulting expression
+ unsigned char expr[CV_ZEROLEN]; // length prefixed expression string
+} lfDefArg_16t;
+
+typedef struct lfDefArg {
+ unsigned short leaf; // LF_DEFARG
+ CV_typ_t type; // type of resulting expression
+ unsigned char expr[CV_ZEROLEN]; // length prefixed expression string
+} lfDefArg;
+
+
+
+// list leaf
+// This list should no longer be used because the utilities cannot
+// verify the contents of the list without knowing what type of list
+// it is. New specific leaf indices should be used instead.
+
+
+typedef struct lfList {
+ unsigned short leaf; // LF_LIST
+ char data[CV_ZEROLEN]; // data format specified by indexing type
+} lfList;
+
+
+
+
+// field list leaf
+// This is the header leaf for a complex list of class and structure
+// subfields.
+
+
+typedef struct lfFieldList_16t {
+ unsigned short leaf; // LF_FIELDLIST_16t
+ char data[CV_ZEROLEN]; // field list sub lists
+} lfFieldList_16t;
+
+
+typedef struct lfFieldList {
+ unsigned short leaf; // LF_FIELDLIST
+ char data[CV_ZEROLEN]; // field list sub lists
+} lfFieldList;
+
+
+
+
+
+
+
+// type record for non-static methods and friends in overloaded method list
+
+typedef struct mlMethod_16t {
+ CV_fldattr_t attr; // method attribute
+ CV_typ16_t index; // index to type record for procedure
+ unsigned long vbaseoff[CV_ZEROLEN]; // offset in vfunctable if intro virtual
+} mlMethod_16t;
+
+typedef struct mlMethod {
+ CV_fldattr_t attr; // method attribute
+ _2BYTEPAD pad0; // internal padding, must be 0
+ CV_typ_t index; // index to type record for procedure
+ unsigned long vbaseoff[CV_ZEROLEN]; // offset in vfunctable if intro virtual
+} mlMethod;
+
+
+typedef struct lfMethodList_16t {
+ unsigned short leaf;
+ unsigned char mList[CV_ZEROLEN]; // really a mlMethod_16t type
+} lfMethodList_16t;
+
+typedef struct lfMethodList {
+ unsigned short leaf;
+ unsigned char mList[CV_ZEROLEN]; // really a mlMethod type
+} lfMethodList;
+
+
+
+
+
+// type record for LF_BITFIELD
+
+
+typedef struct lfBitfield_16t {
+ unsigned short leaf; // LF_BITFIELD_16t
+ unsigned char length;
+ unsigned char position;
+ CV_typ16_t type; // type of bitfield
+
+} lfBitfield_16t;
+
+typedef struct lfBitfield {
+ unsigned short leaf; // LF_BITFIELD
+ CV_typ_t type; // type of bitfield
+ unsigned char length;
+ unsigned char position;
+
+} lfBitfield;
+
+
+
+
+// type record for dimensioned array with constant bounds
+
+
+typedef struct lfDimCon_16t {
+ unsigned short leaf; // LF_DIMCONU_16t or LF_DIMCONLU_16t
+ unsigned short rank; // number of dimensions
+ CV_typ16_t typ; // type of index
+ unsigned char dim[CV_ZEROLEN]; // array of dimension information with
+ // either upper bounds or lower/upper bound
+} lfDimCon_16t;
+
+typedef struct lfDimCon {
+ unsigned short leaf; // LF_DIMCONU or LF_DIMCONLU
+ CV_typ_t typ; // type of index
+ unsigned short rank; // number of dimensions
+ unsigned char dim[CV_ZEROLEN]; // array of dimension information with
+ // either upper bounds or lower/upper bound
+} lfDimCon;
+
+
+
+
+// type record for dimensioned array with variable bounds
+
+
+typedef struct lfDimVar_16t {
+ unsigned short leaf; // LF_DIMVARU_16t or LF_DIMVARLU_16t
+ unsigned short rank; // number of dimensions
+ CV_typ16_t typ; // type of index
+ CV_typ16_t dim[CV_ZEROLEN]; // array of type indices for either
+ // variable upper bound or variable
+ // lower/upper bound. The referenced
+ // types must be LF_REFSYM or T_VOID
+} lfDimVar_16t;
+
+typedef struct lfDimVar {
+ unsigned short leaf; // LF_DIMVARU or LF_DIMVARLU
+ unsigned long rank; // number of dimensions
+ CV_typ_t typ; // type of index
+ CV_typ_t dim[CV_ZEROLEN]; // array of type indices for either
+ // variable upper bound or variable
+ // lower/upper bound. The count of type
+ // indices is rank or rank*2 depending on
+ // whether it is LFDIMVARU or LF_DIMVARLU.
+ // The referenced types must be
+ // LF_REFSYM or T_VOID
+} lfDimVar;
+
+
+
+
+// type record for referenced symbol
+
+
+typedef struct lfRefSym {
+ unsigned short leaf; // LF_REFSYM
+ unsigned char Sym[1]; // copy of referenced symbol record
+ // (including length)
+} lfRefSym;
+
+
+
+// type record for generic HLSL type
+
+
+typedef struct lfHLSL {
+ unsigned short leaf; // LF_HLSL
+ CV_typ_t subtype; // sub-type index, if any
+ unsigned short kind; // kind of built-in type from CV_builtin_e
+ unsigned short numprops : 4; // number of numeric properties
+ unsigned short unused : 12; // padding, must be 0
+ unsigned char data[CV_ZEROLEN]; // variable-length array of numeric properties
+ // followed by byte size
+} lfHLSL;
+
+
+
+
+// type record for a generalized built-in type modifier
+
+
+typedef struct lfModifierEx {
+ unsigned short leaf; // LF_MODIFIER_EX
+ CV_typ_t type; // type being modified
+ unsigned short count; // count of modifier values
+ unsigned short mods[CV_ZEROLEN]; // modifiers from CV_modifier_e
+} lfModifierEx;
+
+
+
+
+/** the following are numeric leaves. They are used to indicate the
+ * size of the following variable length data. When the numeric
+ * data is a single byte less than 0x8000, then the data is output
+ * directly. If the data is more the 0x8000 or is a negative value,
+ * then the data is preceeded by the proper index.
+ */
+
+
+
+// signed character leaf
+
+typedef struct lfChar {
+ unsigned short leaf; // LF_CHAR
+ signed char val; // signed 8-bit value
+} lfChar;
+
+
+
+
+// signed short leaf
+
+typedef struct lfShort {
+ unsigned short leaf; // LF_SHORT
+ short val; // signed 16-bit value
+} lfShort;
+
+
+
+
+// unsigned short leaf
+
+typedef struct lfUShort {
+ unsigned short leaf; // LF_unsigned short
+ unsigned short val; // unsigned 16-bit value
+} lfUShort;
+
+
+
+
+// signed long leaf
+
+typedef struct lfLong {
+ unsigned short leaf; // LF_LONG
+ long val; // signed 32-bit value
+} lfLong;
+
+
+
+
+// unsigned long leaf
+
+typedef struct lfULong {
+ unsigned short leaf; // LF_ULONG
+ unsigned long val; // unsigned 32-bit value
+} lfULong;
+
+
+
+
+// signed quad leaf
+
+typedef struct lfQuad {
+ unsigned short leaf; // LF_QUAD
+ unsigned char val[8]; // signed 64-bit value
+} lfQuad;
+
+
+
+
+// unsigned quad leaf
+
+typedef struct lfUQuad {
+ unsigned short leaf; // LF_UQUAD
+ unsigned char val[8]; // unsigned 64-bit value
+} lfUQuad;
+
+
+// signed int128 leaf
+
+typedef struct lfOct {
+ unsigned short leaf; // LF_OCT
+ unsigned char val[16]; // signed 128-bit value
+} lfOct;
+
+// unsigned int128 leaf
+
+typedef struct lfUOct {
+ unsigned short leaf; // LF_UOCT
+ unsigned char val[16]; // unsigned 128-bit value
+} lfUOct;
+
+
+
+
+// real 16-bit leaf
+
+typedef struct lfReal16 {
+ unsigned short leaf; // LF_REAL16
+ unsigned short val; // 16-bit real value
+} lfReal16;
+
+
+
+
+// real 32-bit leaf
+
+typedef struct lfReal32 {
+ unsigned short leaf; // LF_REAL32
+ float val; // 32-bit real value
+} lfReal32;
+
+
+
+
+// real 48-bit leaf
+
+typedef struct lfReal48 {
+ unsigned short leaf; // LF_REAL48
+ unsigned char val[6]; // 48-bit real value
+} lfReal48;
+
+
+
+
+// real 64-bit leaf
+
+typedef struct lfReal64 {
+ unsigned short leaf; // LF_REAL64
+ double val; // 64-bit real value
+} lfReal64;
+
+
+
+
+// real 80-bit leaf
+
+typedef struct lfReal80 {
+ unsigned short leaf; // LF_REAL80
+ FLOAT10 val; // real 80-bit value
+} lfReal80;
+
+
+
+
+// real 128-bit leaf
+
+typedef struct lfReal128 {
+ unsigned short leaf; // LF_REAL128
+ char val[16]; // real 128-bit value
+} lfReal128;
+
+
+
+
+// complex 32-bit leaf
+
+typedef struct lfCmplx32 {
+ unsigned short leaf; // LF_COMPLEX32
+ float val_real; // real component
+ float val_imag; // imaginary component
+} lfCmplx32;
+
+
+
+
+// complex 64-bit leaf
+
+typedef struct lfCmplx64 {
+ unsigned short leaf; // LF_COMPLEX64
+ double val_real; // real component
+ double val_imag; // imaginary component
+} flCmplx64;
+
+
+
+
+// complex 80-bit leaf
+
+typedef struct lfCmplx80 {
+ unsigned short leaf; // LF_COMPLEX80
+ FLOAT10 val_real; // real component
+ FLOAT10 val_imag; // imaginary component
+} lfCmplx80;
+
+
+
+
+// complex 128-bit leaf
+
+typedef struct lfCmplx128 {
+ unsigned short leaf; // LF_COMPLEX128
+ char val_real[16]; // real component
+ char val_imag[16]; // imaginary component
+} lfCmplx128;
+
+
+
+// variable length numeric field
+
+typedef struct lfVarString {
+ unsigned short leaf; // LF_VARSTRING
+ unsigned short len; // length of value in bytes
+ unsigned char value[CV_ZEROLEN]; // value
+} lfVarString;
+
+//***********************************************************************
+
+
+// index leaf - contains type index of another leaf
+// a major use of this leaf is to allow the compilers to emit a
+// long complex list (LF_FIELD) in smaller pieces.
+
+typedef struct lfIndex_16t {
+ unsigned short leaf; // LF_INDEX_16t
+ CV_typ16_t index; // type index of referenced leaf
+} lfIndex_16t;
+
+typedef struct lfIndex {
+ unsigned short leaf; // LF_INDEX
+ _2BYTEPAD pad0; // internal padding, must be 0
+ CV_typ_t index; // type index of referenced leaf
+} lfIndex;
+
+
+// subfield record for base class field
+
+typedef struct lfBClass_16t {
+ unsigned short leaf; // LF_BCLASS_16t
+ CV_typ16_t index; // type index of base class
+ CV_fldattr_t attr; // attribute
+ unsigned char offset[CV_ZEROLEN]; // variable length offset of base within class
+} lfBClass_16t;
+
+typedef struct lfBClass {
+ unsigned short leaf; // LF_BCLASS, LF_BINTERFACE
+ CV_fldattr_t attr; // attribute
+ CV_typ_t index; // type index of base class
+ unsigned char offset[CV_ZEROLEN]; // variable length offset of base within class
+} lfBClass;
+typedef lfBClass lfBInterface;
+
+
+
+
+// subfield record for direct and indirect virtual base class field
+
+typedef struct lfVBClass_16t {
+ unsigned short leaf; // LF_VBCLASS_16t | LV_IVBCLASS_16t
+ CV_typ16_t index; // type index of direct virtual base class
+ CV_typ16_t vbptr; // type index of virtual base pointer
+ CV_fldattr_t attr; // attribute
+ unsigned char vbpoff[CV_ZEROLEN]; // virtual base pointer offset from address point
+ // followed by virtual base offset from vbtable
+} lfVBClass_16t;
+
+typedef struct lfVBClass {
+ unsigned short leaf; // LF_VBCLASS | LV_IVBCLASS
+ CV_fldattr_t attr; // attribute
+ CV_typ_t index; // type index of direct virtual base class
+ CV_typ_t vbptr; // type index of virtual base pointer
+ unsigned char vbpoff[CV_ZEROLEN]; // virtual base pointer offset from address point
+ // followed by virtual base offset from vbtable
+} lfVBClass;
+
+
+
+
+
+// subfield record for friend class
+
+
+typedef struct lfFriendCls_16t {
+ unsigned short leaf; // LF_FRIENDCLS_16t
+ CV_typ16_t index; // index to type record of friend class
+} lfFriendCls_16t;
+
+typedef struct lfFriendCls {
+ unsigned short leaf; // LF_FRIENDCLS
+ _2BYTEPAD pad0; // internal padding, must be 0
+ CV_typ_t index; // index to type record of friend class
+} lfFriendCls;
+
+
+
+
+
+// subfield record for friend function
+
+
+typedef struct lfFriendFcn_16t {
+ unsigned short leaf; // LF_FRIENDFCN_16t
+ CV_typ16_t index; // index to type record of friend function
+ unsigned char Name[1]; // name of friend function
+} lfFriendFcn_16t;
+
+typedef struct lfFriendFcn {
+ unsigned short leaf; // LF_FRIENDFCN
+ _2BYTEPAD pad0; // internal padding, must be 0
+ CV_typ_t index; // index to type record of friend function
+ unsigned char Name[1]; // name of friend function
+} lfFriendFcn;
+
+
+
+// subfield record for non-static data members
+
+typedef struct lfMember_16t {
+ unsigned short leaf; // LF_MEMBER_16t
+ CV_typ16_t index; // index of type record for field
+ CV_fldattr_t attr; // attribute mask
+ unsigned char offset[CV_ZEROLEN]; // variable length offset of field followed
+ // by length prefixed name of field
+} lfMember_16t;
+
+typedef struct lfMember {
+ unsigned short leaf; // LF_MEMBER
+ CV_fldattr_t attr; // attribute mask
+ CV_typ_t index; // index of type record for field
+ unsigned char offset[CV_ZEROLEN]; // variable length offset of field followed
+ // by length prefixed name of field
+} lfMember;
+
+
+
+// type record for static data members
+
+typedef struct lfSTMember_16t {
+ unsigned short leaf; // LF_STMEMBER_16t
+ CV_typ16_t index; // index of type record for field
+ CV_fldattr_t attr; // attribute mask
+ unsigned char Name[1]; // length prefixed name of field
+} lfSTMember_16t;
+
+typedef struct lfSTMember {
+ unsigned short leaf; // LF_STMEMBER
+ CV_fldattr_t attr; // attribute mask
+ CV_typ_t index; // index of type record for field
+ unsigned char Name[1]; // length prefixed name of field
+} lfSTMember;
+
+
+
+// subfield record for virtual function table pointer
+
+typedef struct lfVFuncTab_16t {
+ unsigned short leaf; // LF_VFUNCTAB_16t
+ CV_typ16_t type; // type index of pointer
+} lfVFuncTab_16t;
+
+typedef struct lfVFuncTab {
+ unsigned short leaf; // LF_VFUNCTAB
+ _2BYTEPAD pad0; // internal padding, must be 0
+ CV_typ_t type; // type index of pointer
+} lfVFuncTab;
+
+
+
+// subfield record for virtual function table pointer with offset
+
+typedef struct lfVFuncOff_16t {
+ unsigned short leaf; // LF_VFUNCOFF_16t
+ CV_typ16_t type; // type index of pointer
+ CV_off32_t offset; // offset of virtual function table pointer
+} lfVFuncOff_16t;
+
+typedef struct lfVFuncOff {
+ unsigned short leaf; // LF_VFUNCOFF
+ _2BYTEPAD pad0; // internal padding, must be 0.
+ CV_typ_t type; // type index of pointer
+ CV_off32_t offset; // offset of virtual function table pointer
+} lfVFuncOff;
+
+
+
+// subfield record for overloaded method list
+
+
+typedef struct lfMethod_16t {
+ unsigned short leaf; // LF_METHOD_16t
+ unsigned short count; // number of occurrences of function
+ CV_typ16_t mList; // index to LF_METHODLIST record
+ unsigned char Name[1]; // length prefixed name of method
+} lfMethod_16t;
+
+typedef struct lfMethod {
+ unsigned short leaf; // LF_METHOD
+ unsigned short count; // number of occurrences of function
+ CV_typ_t mList; // index to LF_METHODLIST record
+ unsigned char Name[1]; // length prefixed name of method
+} lfMethod;
+
+
+
+// subfield record for nonoverloaded method
+
+
+typedef struct lfOneMethod_16t {
+ unsigned short leaf; // LF_ONEMETHOD_16t
+ CV_fldattr_t attr; // method attribute
+ CV_typ16_t index; // index to type record for procedure
+ unsigned long vbaseoff[CV_ZEROLEN]; // offset in vfunctable if
+ // intro virtual followed by
+ // length prefixed name of method
+} lfOneMethod_16t;
+
+typedef struct lfOneMethod {
+ unsigned short leaf; // LF_ONEMETHOD
+ CV_fldattr_t attr; // method attribute
+ CV_typ_t index; // index to type record for procedure
+ unsigned long vbaseoff[CV_ZEROLEN]; // offset in vfunctable if
+ // intro virtual followed by
+ // length prefixed name of method
+} lfOneMethod;
+
+
+// subfield record for enumerate
+
+typedef struct lfEnumerate {
+ unsigned short leaf; // LF_ENUMERATE
+ CV_fldattr_t attr; // access
+ unsigned char value[CV_ZEROLEN]; // variable length value field followed
+ // by length prefixed name
+} lfEnumerate;
+
+
+// type record for nested (scoped) type definition
+
+typedef struct lfNestType_16t {
+ unsigned short leaf; // LF_NESTTYPE_16t
+ CV_typ16_t index; // index of nested type definition
+ unsigned char Name[1]; // length prefixed type name
+} lfNestType_16t;
+
+typedef struct lfNestType {
+ unsigned short leaf; // LF_NESTTYPE
+ _2BYTEPAD pad0; // internal padding, must be 0
+ CV_typ_t index; // index of nested type definition
+ unsigned char Name[1]; // length prefixed type name
+} lfNestType;
+
+// type record for nested (scoped) type definition, with attributes
+// new records for vC v5.0, no need to have 16-bit ti versions.
+
+typedef struct lfNestTypeEx {
+ unsigned short leaf; // LF_NESTTYPEEX
+ CV_fldattr_t attr; // member access
+ CV_typ_t index; // index of nested type definition
+ unsigned char Name[1]; // length prefixed type name
+} lfNestTypeEx;
+
+// type record for modifications to members
+
+typedef struct lfMemberModify {
+ unsigned short leaf; // LF_MEMBERMODIFY
+ CV_fldattr_t attr; // the new attributes
+ CV_typ_t index; // index of base class type definition
+ unsigned char Name[1]; // length prefixed member name
+} lfMemberModify;
+
+// type record for pad leaf
+
+typedef struct lfPad {
+ unsigned char leaf;
+} SYM_PAD;
+
+
+
+// Symbol definitions
+
+typedef enum SYM_ENUM_e {
+ S_COMPILE = 0x0001, // Compile flags symbol
+ S_REGISTER_16t = 0x0002, // Register variable
+ S_CONSTANT_16t = 0x0003, // constant symbol
+ S_UDT_16t = 0x0004, // User defined type
+ S_SSEARCH = 0x0005, // Start Search
+ S_END = 0x0006, // Block, procedure, "with" or thunk end
+ S_SKIP = 0x0007, // Reserve symbol space in $$Symbols table
+ S_CVRESERVE = 0x0008, // Reserved symbol for CV internal use
+ S_OBJNAME_ST = 0x0009, // path to object file name
+ S_ENDARG = 0x000a, // end of argument/return list
+ S_COBOLUDT_16t = 0x000b, // special UDT for cobol that does not symbol pack
+ S_MANYREG_16t = 0x000c, // multiple register variable
+ S_RETURN = 0x000d, // return description symbol
+ S_ENTRYTHIS = 0x000e, // description of this pointer on entry
+
+ S_BPREL16 = 0x0100, // BP-relative
+ S_LDATA16 = 0x0101, // Module-local symbol
+ S_GDATA16 = 0x0102, // Global data symbol
+ S_PUB16 = 0x0103, // a public symbol
+ S_LPROC16 = 0x0104, // Local procedure start
+ S_GPROC16 = 0x0105, // Global procedure start
+ S_THUNK16 = 0x0106, // Thunk Start
+ S_BLOCK16 = 0x0107, // block start
+ S_WITH16 = 0x0108, // with start
+ S_LABEL16 = 0x0109, // code label
+ S_CEXMODEL16 = 0x010a, // change execution model
+ S_VFTABLE16 = 0x010b, // address of virtual function table
+ S_REGREL16 = 0x010c, // register relative address
+
+ S_BPREL32_16t = 0x0200, // BP-relative
+ S_LDATA32_16t = 0x0201, // Module-local symbol
+ S_GDATA32_16t = 0x0202, // Global data symbol
+ S_PUB32_16t = 0x0203, // a public symbol (CV internal reserved)
+ S_LPROC32_16t = 0x0204, // Local procedure start
+ S_GPROC32_16t = 0x0205, // Global procedure start
+ S_THUNK32_ST = 0x0206, // Thunk Start
+ S_BLOCK32_ST = 0x0207, // block start
+ S_WITH32_ST = 0x0208, // with start
+ S_LABEL32_ST = 0x0209, // code label
+ S_CEXMODEL32 = 0x020a, // change execution model
+ S_VFTABLE32_16t = 0x020b, // address of virtual function table
+ S_REGREL32_16t = 0x020c, // register relative address
+ S_LTHREAD32_16t = 0x020d, // local thread storage
+ S_GTHREAD32_16t = 0x020e, // global thread storage
+ S_SLINK32 = 0x020f, // static link for MIPS EH implementation
+
+ S_LPROCMIPS_16t = 0x0300, // Local procedure start
+ S_GPROCMIPS_16t = 0x0301, // Global procedure start
+
+ // if these ref symbols have names following then the names are in ST format
+ S_PROCREF_ST = 0x0400, // Reference to a procedure
+ S_DATAREF_ST = 0x0401, // Reference to data
+ S_ALIGN = 0x0402, // Used for page alignment of symbols
+
+ S_LPROCREF_ST = 0x0403, // Local Reference to a procedure
+ S_OEM = 0x0404, // OEM defined symbol
+
+ // sym records with 32-bit types embedded instead of 16-bit
+ // all have 0x1000 bit set for easy identification
+ // only do the 32-bit target versions since we don't really
+ // care about 16-bit ones anymore.
+ S_TI16_MAX = 0x1000,
+
+ S_REGISTER_ST = 0x1001, // Register variable
+ S_CONSTANT_ST = 0x1002, // constant symbol
+ S_UDT_ST = 0x1003, // User defined type
+ S_COBOLUDT_ST = 0x1004, // special UDT for cobol that does not symbol pack
+ S_MANYREG_ST = 0x1005, // multiple register variable
+ S_BPREL32_ST = 0x1006, // BP-relative
+ S_LDATA32_ST = 0x1007, // Module-local symbol
+ S_GDATA32_ST = 0x1008, // Global data symbol
+ S_PUB32_ST = 0x1009, // a public symbol (CV internal reserved)
+ S_LPROC32_ST = 0x100a, // Local procedure start
+ S_GPROC32_ST = 0x100b, // Global procedure start
+ S_VFTABLE32 = 0x100c, // address of virtual function table
+ S_REGREL32_ST = 0x100d, // register relative address
+ S_LTHREAD32_ST = 0x100e, // local thread storage
+ S_GTHREAD32_ST = 0x100f, // global thread storage
+
+ S_LPROCMIPS_ST = 0x1010, // Local procedure start
+ S_GPROCMIPS_ST = 0x1011, // Global procedure start
+
+ S_FRAMEPROC = 0x1012, // extra frame and proc information
+ S_COMPILE2_ST = 0x1013, // extended compile flags and info
+
+ // new symbols necessary for 16-bit enumerates of IA64 registers
+ // and IA64 specific symbols
+
+ S_MANYREG2_ST = 0x1014, // multiple register variable
+ S_LPROCIA64_ST = 0x1015, // Local procedure start (IA64)
+ S_GPROCIA64_ST = 0x1016, // Global procedure start (IA64)
+
+ // Local symbols for IL
+ S_LOCALSLOT_ST = 0x1017, // local IL sym with field for local slot index
+ S_PARAMSLOT_ST = 0x1018, // local IL sym with field for parameter slot index
+
+ S_ANNOTATION = 0x1019, // Annotation string literals
+
+ // symbols to support managed code debugging
+ S_GMANPROC_ST = 0x101a, // Global proc
+ S_LMANPROC_ST = 0x101b, // Local proc
+ S_RESERVED1 = 0x101c, // reserved
+ S_RESERVED2 = 0x101d, // reserved
+ S_RESERVED3 = 0x101e, // reserved
+ S_RESERVED4 = 0x101f, // reserved
+ S_LMANDATA_ST = 0x1020,
+ S_GMANDATA_ST = 0x1021,
+ S_MANFRAMEREL_ST= 0x1022,
+ S_MANREGISTER_ST= 0x1023,
+ S_MANSLOT_ST = 0x1024,
+ S_MANMANYREG_ST = 0x1025,
+ S_MANREGREL_ST = 0x1026,
+ S_MANMANYREG2_ST= 0x1027,
+ S_MANTYPREF = 0x1028, // Index for type referenced by name from metadata
+ S_UNAMESPACE_ST = 0x1029, // Using namespace
+
+ // Symbols w/ SZ name fields. All name fields contain utf8 encoded strings.
+ S_ST_MAX = 0x1100, // starting point for SZ name symbols
+
+ S_OBJNAME = 0x1101, // path to object file name
+ S_THUNK32 = 0x1102, // Thunk Start
+ S_BLOCK32 = 0x1103, // block start
+ S_WITH32 = 0x1104, // with start
+ S_LABEL32 = 0x1105, // code label
+ S_REGISTER = 0x1106, // Register variable
+ S_CONSTANT = 0x1107, // constant symbol
+ S_UDT = 0x1108, // User defined type
+ S_COBOLUDT = 0x1109, // special UDT for cobol that does not symbol pack
+ S_MANYREG = 0x110a, // multiple register variable
+ S_BPREL32 = 0x110b, // BP-relative
+ S_LDATA32 = 0x110c, // Module-local symbol
+ S_GDATA32 = 0x110d, // Global data symbol
+ S_PUB32 = 0x110e, // a public symbol (CV internal reserved)
+ S_LPROC32 = 0x110f, // Local procedure start
+ S_GPROC32 = 0x1110, // Global procedure start
+ S_REGREL32 = 0x1111, // register relative address
+ S_LTHREAD32 = 0x1112, // local thread storage
+ S_GTHREAD32 = 0x1113, // global thread storage
+
+ S_LPROCMIPS = 0x1114, // Local procedure start
+ S_GPROCMIPS = 0x1115, // Global procedure start
+ S_COMPILE2 = 0x1116, // extended compile flags and info
+ S_MANYREG2 = 0x1117, // multiple register variable
+ S_LPROCIA64 = 0x1118, // Local procedure start (IA64)
+ S_GPROCIA64 = 0x1119, // Global procedure start (IA64)
+ S_LOCALSLOT = 0x111a, // local IL sym with field for local slot index
+ S_SLOT = S_LOCALSLOT, // alias for LOCALSLOT
+ S_PARAMSLOT = 0x111b, // local IL sym with field for parameter slot index
+
+ // symbols to support managed code debugging
+ S_LMANDATA = 0x111c,
+ S_GMANDATA = 0x111d,
+ S_MANFRAMEREL = 0x111e,
+ S_MANREGISTER = 0x111f,
+ S_MANSLOT = 0x1120,
+ S_MANMANYREG = 0x1121,
+ S_MANREGREL = 0x1122,
+ S_MANMANYREG2 = 0x1123,
+ S_UNAMESPACE = 0x1124, // Using namespace
+
+ // ref symbols with name fields
+ S_PROCREF = 0x1125, // Reference to a procedure
+ S_DATAREF = 0x1126, // Reference to data
+ S_LPROCREF = 0x1127, // Local Reference to a procedure
+ S_ANNOTATIONREF = 0x1128, // Reference to an S_ANNOTATION symbol
+ S_TOKENREF = 0x1129, // Reference to one of the many MANPROCSYM's
+
+ // continuation of managed symbols
+ S_GMANPROC = 0x112a, // Global proc
+ S_LMANPROC = 0x112b, // Local proc
+
+ // short, light-weight thunks
+ S_TRAMPOLINE = 0x112c, // trampoline thunks
+ S_MANCONSTANT = 0x112d, // constants with metadata type info
+
+ // native attributed local/parms
+ S_ATTR_FRAMEREL = 0x112e, // relative to virtual frame ptr
+ S_ATTR_REGISTER = 0x112f, // stored in a register
+ S_ATTR_REGREL = 0x1130, // relative to register (alternate frame ptr)
+ S_ATTR_MANYREG = 0x1131, // stored in >1 register
+
+ // Separated code (from the compiler) support
+ S_SEPCODE = 0x1132,
+
+ S_LOCAL_2005 = 0x1133, // defines a local symbol in optimized code
+ S_DEFRANGE_2005 = 0x1134, // defines a single range of addresses in which symbol can be evaluated
+ S_DEFRANGE2_2005 = 0x1135, // defines ranges of addresses in which symbol can be evaluated
+
+ S_SECTION = 0x1136, // A COFF section in a PE executable
+ S_COFFGROUP = 0x1137, // A COFF group
+ S_EXPORT = 0x1138, // A export
+
+ S_CALLSITEINFO = 0x1139, // Indirect call site information
+ S_FRAMECOOKIE = 0x113a, // Security cookie information
+
+ S_DISCARDED = 0x113b, // Discarded by LINK /OPT:REF (experimental, see richards)
+
+ S_COMPILE3 = 0x113c, // Replacement for S_COMPILE2
+ S_ENVBLOCK = 0x113d, // Environment block split off from S_COMPILE2
+
+ S_LOCAL = 0x113e, // defines a local symbol in optimized code
+ S_DEFRANGE = 0x113f, // defines a single range of addresses in which symbol can be evaluated
+ S_DEFRANGE_SUBFIELD = 0x1140, // ranges for a subfield
+
+ S_DEFRANGE_REGISTER = 0x1141, // ranges for en-registered symbol
+ S_DEFRANGE_FRAMEPOINTER_REL = 0x1142, // range for stack symbol.
+ S_DEFRANGE_SUBFIELD_REGISTER = 0x1143, // ranges for en-registered field of symbol
+ S_DEFRANGE_FRAMEPOINTER_REL_FULL_SCOPE = 0x1144, // range for stack symbol span valid full scope of function body, gap might apply.
+ S_DEFRANGE_REGISTER_REL = 0x1145, // range for symbol address as register + offset.
+
+ // S_PROC symbols that reference ID instead of type
+ S_LPROC32_ID = 0x1146,
+ S_GPROC32_ID = 0x1147,
+ S_LPROCMIPS_ID = 0x1148,
+ S_GPROCMIPS_ID = 0x1149,
+ S_LPROCIA64_ID = 0x114a,
+ S_GPROCIA64_ID = 0x114b,
+
+ S_BUILDINFO = 0x114c, // build information.
+ S_INLINESITE = 0x114d, // inlined function callsite.
+ S_INLINESITE_END = 0x114e,
+ S_PROC_ID_END = 0x114f,
+
+ S_DEFRANGE_HLSL = 0x1150,
+ S_GDATA_HLSL = 0x1151,
+ S_LDATA_HLSL = 0x1152,
+
+ S_FILESTATIC = 0x1153,
+
+#if defined(CC_DP_CXX) && CC_DP_CXX
+
+ S_LOCAL_DPC_GROUPSHARED = 0x1154, // DPC groupshared variable
+ S_LPROC32_DPC = 0x1155, // DPC local procedure start
+ S_LPROC32_DPC_ID = 0x1156,
+ S_DEFRANGE_DPC_PTR_TAG = 0x1157, // DPC pointer tag definition range
+ S_DPC_SYM_TAG_MAP = 0x1158, // DPC pointer tag value to symbol record map
+
+#endif // CC_DP_CXX
+
+ S_ARMSWITCHTABLE = 0x1159,
+ S_CALLEES = 0x115a,
+ S_CALLERS = 0x115b,
+ S_POGODATA = 0x115c,
+ S_INLINESITE2 = 0x115d, // extended inline site information
+
+ S_HEAPALLOCSITE = 0x115e, // heap allocation site
+
+ S_MOD_TYPEREF = 0x115f, // only generated at link time
+
+ S_REF_MINIPDB = 0x1160, // only generated at link time for mini PDB
+ S_PDBMAP = 0x1161, // only generated at link time for mini PDB
+
+ S_GDATA_HLSL32 = 0x1162,
+ S_LDATA_HLSL32 = 0x1163,
+
+ S_GDATA_HLSL32_EX = 0x1164,
+ S_LDATA_HLSL32_EX = 0x1165,
+
+ S_RECTYPE_MAX, // one greater than last
+ S_RECTYPE_LAST = S_RECTYPE_MAX - 1,
+ S_RECTYPE_PAD = S_RECTYPE_MAX + 0x100 // Used *only* to verify symbol record types so that current PDB code can potentially read
+ // future PDBs (assuming no format change, etc).
+
+} SYM_ENUM_e;
+
+
+// enum describing compile flag ambient data model
+
+
+typedef enum CV_CFL_DATA {
+ CV_CFL_DNEAR = 0x00,
+ CV_CFL_DFAR = 0x01,
+ CV_CFL_DHUGE = 0x02
+} CV_CFL_DATA;
+
+
+
+
+// enum describing compile flag ambiant code model
+
+
+typedef enum CV_CFL_CODE_e {
+ CV_CFL_CNEAR = 0x00,
+ CV_CFL_CFAR = 0x01,
+ CV_CFL_CHUGE = 0x02
+} CV_CFL_CODE_e;
+
+
+
+
+// enum describing compile flag target floating point package
+
+typedef enum CV_CFL_FPKG_e {
+ CV_CFL_NDP = 0x00,
+ CV_CFL_EMU = 0x01,
+ CV_CFL_ALT = 0x02
+} CV_CFL_FPKG_e;
+
+
+// enum describing function return method
+
+
+typedef struct CV_PROCFLAGS {
+ union {
+ unsigned char bAll;
+ unsigned char grfAll;
+ struct {
+ unsigned char CV_PFLAG_NOFPO :1; // frame pointer present
+ unsigned char CV_PFLAG_INT :1; // interrupt return
+ unsigned char CV_PFLAG_FAR :1; // far return
+ unsigned char CV_PFLAG_NEVER :1; // function does not return
+ unsigned char CV_PFLAG_NOTREACHED:1; // label isn't fallen into
+ unsigned char CV_PFLAG_CUST_CALL :1; // custom calling convention
+ unsigned char CV_PFLAG_NOINLINE :1; // function marked as noinline
+ unsigned char CV_PFLAG_OPTDBGINFO:1; // function has debug information for optimized code
+ };
+ };
+} CV_PROCFLAGS;
+
+// Extended proc flags
+//
+typedef struct CV_EXPROCFLAGS {
+ CV_PROCFLAGS cvpf;
+ union {
+ unsigned char grfAll;
+ struct {
+ unsigned char __reserved_byte :8; // must be zero
+ };
+ };
+} CV_EXPROCFLAGS;
+
+// local variable flags
+typedef struct CV_LVARFLAGS {
+ unsigned short fIsParam :1; // variable is a parameter
+ unsigned short fAddrTaken :1; // address is taken
+ unsigned short fCompGenx :1; // variable is compiler generated
+ unsigned short fIsAggregate :1; // the symbol is splitted in temporaries,
+ // which are treated by compiler as
+ // independent entities
+ unsigned short fIsAggregated :1; // Counterpart of fIsAggregate - tells
+ // that it is a part of a fIsAggregate symbol
+ unsigned short fIsAliased :1; // variable has multiple simultaneous lifetimes
+ unsigned short fIsAlias :1; // represents one of the multiple simultaneous lifetimes
+ unsigned short fIsRetValue :1; // represents a function return value
+ unsigned short fIsOptimizedOut :1; // variable has no lifetimes
+ unsigned short fIsEnregGlob :1; // variable is an enregistered global
+ unsigned short fIsEnregStat :1; // variable is an enregistered static
+
+ unsigned short unused :5; // must be zero
+
+} CV_LVARFLAGS;
+
+// extended attributes common to all local variables
+typedef struct CV_lvar_attr {
+ CV_uoff32_t off; // first code address where var is live
+ unsigned short seg;
+ CV_LVARFLAGS flags; // local var flags
+} CV_lvar_attr;
+
+// This is max length of a lexical linear IP range.
+// The upper number are reserved for seeded and flow based range
+
+#define CV_LEXICAL_RANGE_MAX 0xF000
+
+// represents an address range, used for optimized code debug info
+
+typedef struct CV_LVAR_ADDR_RANGE { // defines a range of addresses
+ CV_uoff32_t offStart;
+ unsigned short isectStart;
+ unsigned short cbRange;
+} CV_LVAR_ADDR_RANGE;
+
+// Represents the holes in overall address range, all address is pre-bbt.
+// it is for compress and reduce the amount of relocations need.
+
+typedef struct CV_LVAR_ADDR_GAP {
+ unsigned short gapStartOffset; // relative offset from the beginning of the live range.
+ unsigned short cbRange; // length of this gap.
+} CV_LVAR_ADDR_GAP;
+
+#if defined(CC_DP_CXX) && CC_DP_CXX
+
+// Represents a mapping from a DPC pointer tag value to the corresponding symbol record
+typedef struct CV_DPC_SYM_TAG_MAP_ENTRY {
+ unsigned int tagValue; // address taken symbol's pointer tag value.
+ CV_off32_t symRecordOffset; // offset of the symbol record from the S_LPROC32_DPC record it is nested within
+} CV_DPC_SYM_TAG_MAP_ENTRY;
+
+#endif // CC_DP_CXX
+
+// enum describing function data return method
+
+typedef enum CV_GENERIC_STYLE_e {
+ CV_GENERIC_VOID = 0x00, // void return type
+ CV_GENERIC_REG = 0x01, // return data is in registers
+ CV_GENERIC_ICAN = 0x02, // indirect caller allocated near
+ CV_GENERIC_ICAF = 0x03, // indirect caller allocated far
+ CV_GENERIC_IRAN = 0x04, // indirect returnee allocated near
+ CV_GENERIC_IRAF = 0x05, // indirect returnee allocated far
+ CV_GENERIC_UNUSED = 0x06 // first unused
+} CV_GENERIC_STYLE_e;
+
+
+typedef struct CV_GENERIC_FLAG {
+ unsigned short cstyle :1; // true push varargs right to left
+ unsigned short rsclean :1; // true if returnee stack cleanup
+ unsigned short unused :14; // unused
+} CV_GENERIC_FLAG;
+
+
+// flag bitfields for separated code attributes
+
+typedef struct CV_SEPCODEFLAGS {
+ unsigned long fIsLexicalScope : 1; // S_SEPCODE doubles as lexical scope
+ unsigned long fReturnsToParent : 1; // code frag returns to parent
+ unsigned long pad : 30; // must be zero
+} CV_SEPCODEFLAGS;
+
+// Generic layout for symbol records
+
+typedef struct SYMTYPE {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // Record type
+ char data[CV_ZEROLEN];
+} SYMTYPE;
+
+__INLINE SYMTYPE *NextSym (SYMTYPE * pSym) {
+ return (SYMTYPE *) ((char *)pSym + pSym->reclen + sizeof(unsigned short));
+}
+
+// non-model specific symbol types
+
+
+
+typedef struct REGSYM_16t {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_REGISTER_16t
+ CV_typ16_t typind; // Type index
+ unsigned short reg; // register enumerate
+ unsigned char name[1]; // Length-prefixed name
+} REGSYM_16t;
+
+typedef struct REGSYM {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_REGISTER
+ CV_typ_t typind; // Type index or Metadata token
+ unsigned short reg; // register enumerate
+ unsigned char name[1]; // Length-prefixed name
+} REGSYM;
+
+typedef struct ATTRREGSYM {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_MANREGISTER | S_ATTR_REGISTER
+ CV_typ_t typind; // Type index or Metadata token
+ CV_lvar_attr attr; // local var attributes
+ unsigned short reg; // register enumerate
+ unsigned char name[1]; // Length-prefixed name
+} ATTRREGSYM;
+
+typedef struct MANYREGSYM_16t {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_MANYREG_16t
+ CV_typ16_t typind; // Type index
+ unsigned char count; // count of number of registers
+ unsigned char reg[1]; // count register enumerates followed by
+ // length-prefixed name. Registers are
+ // most significant first.
+} MANYREGSYM_16t;
+
+typedef struct MANYREGSYM {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_MANYREG
+ CV_typ_t typind; // Type index or metadata token
+ unsigned char count; // count of number of registers
+ unsigned char reg[1]; // count register enumerates followed by
+ // length-prefixed name. Registers are
+ // most significant first.
+} MANYREGSYM;
+
+typedef struct MANYREGSYM2 {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_MANYREG2
+ CV_typ_t typind; // Type index or metadata token
+ unsigned short count; // count of number of registers
+ unsigned short reg[1]; // count register enumerates followed by
+ // length-prefixed name. Registers are
+ // most significant first.
+} MANYREGSYM2;
+
+typedef struct ATTRMANYREGSYM {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_MANMANYREG
+ CV_typ_t typind; // Type index or metadata token
+ CV_lvar_attr attr; // local var attributes
+ unsigned char count; // count of number of registers
+ unsigned char reg[1]; // count register enumerates followed by
+ // length-prefixed name. Registers are
+ // most significant first.
+ unsigned char name[CV_ZEROLEN]; // utf-8 encoded zero terminate name
+} ATTRMANYREGSYM;
+
+typedef struct ATTRMANYREGSYM2 {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_MANMANYREG2 | S_ATTR_MANYREG
+ CV_typ_t typind; // Type index or metadata token
+ CV_lvar_attr attr; // local var attributes
+ unsigned short count; // count of number of registers
+ unsigned short reg[1]; // count register enumerates followed by
+ // length-prefixed name. Registers are
+ // most significant first.
+ unsigned char name[CV_ZEROLEN]; // utf-8 encoded zero terminate name
+} ATTRMANYREGSYM2;
+
+typedef struct CONSTSYM_16t {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_CONSTANT_16t
+ CV_typ16_t typind; // Type index (containing enum if enumerate)
+ unsigned short value; // numeric leaf containing value
+ unsigned char name[CV_ZEROLEN]; // Length-prefixed name
+} CONSTSYM_16t;
+
+typedef struct CONSTSYM {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_CONSTANT or S_MANCONSTANT
+ CV_typ_t typind; // Type index (containing enum if enumerate) or metadata token
+ unsigned short value; // numeric leaf containing value
+ unsigned char name[CV_ZEROLEN]; // Length-prefixed name
+} CONSTSYM;
+
+
+typedef struct UDTSYM_16t {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_UDT_16t | S_COBOLUDT_16t
+ CV_typ16_t typind; // Type index
+ unsigned char name[1]; // Length-prefixed name
+} UDTSYM_16t;
+
+
+typedef struct UDTSYM {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_UDT | S_COBOLUDT
+ CV_typ_t typind; // Type index
+ unsigned char name[1]; // Length-prefixed name
+} UDTSYM;
+
+typedef struct MANTYPREF {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_MANTYPREF
+ CV_typ_t typind; // Type index
+} MANTYPREF;
+
+typedef struct SEARCHSYM {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_SSEARCH
+ unsigned long startsym; // offset of the procedure
+ unsigned short seg; // segment of symbol
+} SEARCHSYM;
+
+
+typedef struct CFLAGSYM {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_COMPILE
+ unsigned char machine; // target processor
+ struct {
+ unsigned char language :8; // language index
+ unsigned char pcode :1; // true if pcode present
+ unsigned char floatprec :2; // floating precision
+ unsigned char floatpkg :2; // float package
+ unsigned char ambdata :3; // ambient data model
+ unsigned char ambcode :3; // ambient code model
+ unsigned char mode32 :1; // true if compiled 32 bit mode
+ unsigned char pad :4; // reserved
+ } flags;
+ unsigned char ver[1]; // Length-prefixed compiler version string
+} CFLAGSYM;
+
+
+typedef struct COMPILESYM {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_COMPILE2
+ struct {
+ unsigned long iLanguage : 8; // language index
+ unsigned long fEC : 1; // compiled for E/C
+ unsigned long fNoDbgInfo : 1; // not compiled with debug info
+ unsigned long fLTCG : 1; // compiled with LTCG
+ unsigned long fNoDataAlign : 1; // compiled with -Bzalign
+ unsigned long fManagedPresent : 1; // managed code/data present
+ unsigned long fSecurityChecks : 1; // compiled with /GS
+ unsigned long fHotPatch : 1; // compiled with /hotpatch
+ unsigned long fCVTCIL : 1; // converted with CVTCIL
+ unsigned long fMSILModule : 1; // MSIL netmodule
+ unsigned long pad : 15; // reserved, must be 0
+ } flags;
+ unsigned short machine; // target processor
+ unsigned short verFEMajor; // front end major version #
+ unsigned short verFEMinor; // front end minor version #
+ unsigned short verFEBuild; // front end build version #
+ unsigned short verMajor; // back end major version #
+ unsigned short verMinor; // back end minor version #
+ unsigned short verBuild; // back end build version #
+ unsigned char verSt[1]; // Length-prefixed compiler version string, followed
+ // by an optional block of zero terminated strings
+ // terminated with a double zero.
+} COMPILESYM;
+
+typedef struct COMPILESYM3 {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_COMPILE3
+ struct {
+ unsigned long iLanguage : 8; // language index
+ unsigned long fEC : 1; // compiled for E/C
+ unsigned long fNoDbgInfo : 1; // not compiled with debug info
+ unsigned long fLTCG : 1; // compiled with LTCG
+ unsigned long fNoDataAlign : 1; // compiled with -Bzalign
+ unsigned long fManagedPresent : 1; // managed code/data present
+ unsigned long fSecurityChecks : 1; // compiled with /GS
+ unsigned long fHotPatch : 1; // compiled with /hotpatch
+ unsigned long fCVTCIL : 1; // converted with CVTCIL
+ unsigned long fMSILModule : 1; // MSIL netmodule
+ unsigned long fSdl : 1; // compiled with /sdl
+ unsigned long fPGO : 1; // compiled with /ltcg:pgo or pgu
+ unsigned long fExp : 1; // .exp module
+ unsigned long pad : 12; // reserved, must be 0
+ } flags;
+ unsigned short machine; // target processor
+ unsigned short verFEMajor; // front end major version #
+ unsigned short verFEMinor; // front end minor version #
+ unsigned short verFEBuild; // front end build version #
+ unsigned short verFEQFE; // front end QFE version #
+ unsigned short verMajor; // back end major version #
+ unsigned short verMinor; // back end minor version #
+ unsigned short verBuild; // back end build version #
+ unsigned short verQFE; // back end QFE version #
+ char verSz[1]; // Zero terminated compiler version string
+} COMPILESYM3;
+
+typedef struct ENVBLOCKSYM {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_ENVBLOCK
+ struct {
+ unsigned char rev : 1; // reserved
+ unsigned char pad : 7; // reserved, must be 0
+ } flags;
+ unsigned char rgsz[1]; // Sequence of zero-terminated strings
+} ENVBLOCKSYM;
+
+typedef struct OBJNAMESYM {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_OBJNAME
+ unsigned long signature; // signature
+ unsigned char name[1]; // Length-prefixed name
+} OBJNAMESYM;
+
+
+typedef struct ENDARGSYM {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_ENDARG
+} ENDARGSYM;
+
+
+typedef struct RETURNSYM {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_RETURN
+ CV_GENERIC_FLAG flags; // flags
+ unsigned char style; // CV_GENERIC_STYLE_e return style
+ // followed by return method data
+} RETURNSYM;
+
+
+typedef struct ENTRYTHISSYM {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_ENTRYTHIS
+ unsigned char thissym; // symbol describing this pointer on entry
+} ENTRYTHISSYM;
+
+
+// symbol types for 16:16 memory model
+
+
+typedef struct BPRELSYM16 {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_BPREL16
+ CV_off16_t off; // BP-relative offset
+ CV_typ16_t typind; // Type index
+ unsigned char name[1]; // Length-prefixed name
+} BPRELSYM16;
+
+
+typedef struct DATASYM16 {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_LDATA or S_GDATA
+ CV_uoff16_t off; // offset of symbol
+ unsigned short seg; // segment of symbol
+ CV_typ16_t typind; // Type index
+ unsigned char name[1]; // Length-prefixed name
+} DATASYM16;
+typedef DATASYM16 PUBSYM16;
+
+
+typedef struct PROCSYM16 {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_GPROC16 or S_LPROC16
+ unsigned long pParent; // pointer to the parent
+ unsigned long pEnd; // pointer to this blocks end
+ unsigned long pNext; // pointer to next symbol
+ unsigned short len; // Proc length
+ unsigned short DbgStart; // Debug start offset
+ unsigned short DbgEnd; // Debug end offset
+ CV_uoff16_t off; // offset of symbol
+ unsigned short seg; // segment of symbol
+ CV_typ16_t typind; // Type index
+ CV_PROCFLAGS flags; // Proc flags
+ unsigned char name[1]; // Length-prefixed name
+} PROCSYM16;
+
+
+typedef struct THUNKSYM16 {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_THUNK
+ unsigned long pParent; // pointer to the parent
+ unsigned long pEnd; // pointer to this blocks end
+ unsigned long pNext; // pointer to next symbol
+ CV_uoff16_t off; // offset of symbol
+ unsigned short seg; // segment of symbol
+ unsigned short len; // length of thunk
+ unsigned char ord; // THUNK_ORDINAL specifying type of thunk
+ unsigned char name[1]; // name of thunk
+ unsigned char variant[CV_ZEROLEN]; // variant portion of thunk
+} THUNKSYM16;
+
+typedef struct LABELSYM16 {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_LABEL16
+ CV_uoff16_t off; // offset of symbol
+ unsigned short seg; // segment of symbol
+ CV_PROCFLAGS flags; // flags
+ unsigned char name[1]; // Length-prefixed name
+} LABELSYM16;
+
+
+typedef struct BLOCKSYM16 {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_BLOCK16
+ unsigned long pParent; // pointer to the parent
+ unsigned long pEnd; // pointer to this blocks end
+ unsigned short len; // Block length
+ CV_uoff16_t off; // offset of symbol
+ unsigned short seg; // segment of symbol
+ unsigned char name[1]; // Length-prefixed name
+} BLOCKSYM16;
+
+
+typedef struct WITHSYM16 {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_WITH16
+ unsigned long pParent; // pointer to the parent
+ unsigned long pEnd; // pointer to this blocks end
+ unsigned short len; // Block length
+ CV_uoff16_t off; // offset of symbol
+ unsigned short seg; // segment of symbol
+ unsigned char expr[1]; // Length-prefixed expression
+} WITHSYM16;
+
+
+typedef enum CEXM_MODEL_e {
+ CEXM_MDL_table = 0x00, // not executable
+ CEXM_MDL_jumptable = 0x01, // Compiler generated jump table
+ CEXM_MDL_datapad = 0x02, // Data padding for alignment
+ CEXM_MDL_native = 0x20, // native (actually not-pcode)
+ CEXM_MDL_cobol = 0x21, // cobol
+ CEXM_MDL_codepad = 0x22, // Code padding for alignment
+ CEXM_MDL_code = 0x23, // code
+ CEXM_MDL_sql = 0x30, // sql
+ CEXM_MDL_pcode = 0x40, // pcode
+ CEXM_MDL_pcode32Mac = 0x41, // macintosh 32 bit pcode
+ CEXM_MDL_pcode32MacNep = 0x42, // macintosh 32 bit pcode native entry point
+ CEXM_MDL_javaInt = 0x50,
+ CEXM_MDL_unknown = 0xff
+} CEXM_MODEL_e;
+
+// use the correct enumerate name
+#define CEXM_MDL_SQL CEXM_MDL_sql
+
+typedef enum CV_COBOL_e {
+ CV_COBOL_dontstop,
+ CV_COBOL_pfm,
+ CV_COBOL_false,
+ CV_COBOL_extcall
+} CV_COBOL_e;
+
+typedef struct CEXMSYM16 {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_CEXMODEL16
+ CV_uoff16_t off; // offset of symbol
+ unsigned short seg; // segment of symbol
+ unsigned short model; // execution model
+ union {
+ struct {
+ CV_uoff16_t pcdtable; // offset to pcode function table
+ CV_uoff16_t pcdspi; // offset to segment pcode information
+ } pcode;
+ struct {
+ unsigned short subtype; // see CV_COBOL_e above
+ unsigned short flag;
+ } cobol;
+ };
+} CEXMSYM16;
+
+
+typedef struct VPATHSYM16 {
+ unsigned short reclen; // record length
+ unsigned short rectyp; // S_VFTPATH16
+ CV_uoff16_t off; // offset of virtual function table
+ unsigned short seg; // segment of virtual function table
+ CV_typ16_t root; // type index of the root of path
+ CV_typ16_t path; // type index of the path record
+} VPATHSYM16;
+
+
+typedef struct REGREL16 {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_REGREL16
+ CV_uoff16_t off; // offset of symbol
+ unsigned short reg; // register index
+ CV_typ16_t typind; // Type index
+ unsigned char name[1]; // Length-prefixed name
+} REGREL16;
+
+
+typedef struct BPRELSYM32_16t {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_BPREL32_16t
+ CV_off32_t off; // BP-relative offset
+ CV_typ16_t typind; // Type index
+ unsigned char name[1]; // Length-prefixed name
+} BPRELSYM32_16t;
+
+typedef struct BPRELSYM32 {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_BPREL32
+ CV_off32_t off; // BP-relative offset
+ CV_typ_t typind; // Type index or Metadata token
+ unsigned char name[1]; // Length-prefixed name
+} BPRELSYM32;
+
+typedef struct FRAMERELSYM {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_MANFRAMEREL | S_ATTR_FRAMEREL
+ CV_off32_t off; // Frame relative offset
+ CV_typ_t typind; // Type index or Metadata token
+ CV_lvar_attr attr; // local var attributes
+ unsigned char name[1]; // Length-prefixed name
+} FRAMERELSYM;
+
+typedef FRAMERELSYM ATTRFRAMERELSYM;
+
+
+typedef struct SLOTSYM32 {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_LOCALSLOT or S_PARAMSLOT
+ unsigned long iSlot; // slot index
+ CV_typ_t typind; // Type index or Metadata token
+ unsigned char name[1]; // Length-prefixed name
+} SLOTSYM32;
+
+typedef struct ATTRSLOTSYM {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_MANSLOT
+ unsigned long iSlot; // slot index
+ CV_typ_t typind; // Type index or Metadata token
+ CV_lvar_attr attr; // local var attributes
+ unsigned char name[1]; // Length-prefixed name
+} ATTRSLOTSYM;
+
+typedef struct ANNOTATIONSYM {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_ANNOTATION
+ CV_uoff32_t off;
+ unsigned short seg;
+ unsigned short csz; // Count of zero terminated annotation strings
+ unsigned char rgsz[1]; // Sequence of zero terminated annotation strings
+} ANNOTATIONSYM;
+
+typedef struct DATASYM32_16t {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_LDATA32_16t, S_GDATA32_16t or S_PUB32_16t
+ CV_uoff32_t off;
+ unsigned short seg;
+ CV_typ16_t typind; // Type index
+ unsigned char name[1]; // Length-prefixed name
+} DATASYM32_16t;
+typedef DATASYM32_16t PUBSYM32_16t;
+
+typedef struct DATASYM32 {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_LDATA32, S_GDATA32, S_LMANDATA, S_GMANDATA
+ CV_typ_t typind; // Type index, or Metadata token if a managed symbol
+ CV_uoff32_t off;
+ unsigned short seg;
+ unsigned char name[1]; // Length-prefixed name
+} DATASYM32;
+
+typedef struct DATASYMHLSL {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_GDATA_HLSL, S_LDATA_HLSL
+ CV_typ_t typind; // Type index
+ unsigned short regType; // register type from CV_HLSLREG_e
+ unsigned short dataslot; // Base data (cbuffer, groupshared, etc.) slot
+ unsigned short dataoff; // Base data byte offset start
+ unsigned short texslot; // Texture slot start
+ unsigned short sampslot; // Sampler slot start
+ unsigned short uavslot; // UAV slot start
+ unsigned char name[1]; // name
+} DATASYMHLSL;
+
+typedef struct DATASYMHLSL32 {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_GDATA_HLSL32, S_LDATA_HLSL32
+ CV_typ_t typind; // Type index
+ unsigned long dataslot; // Base data (cbuffer, groupshared, etc.) slot
+ unsigned long dataoff; // Base data byte offset start
+ unsigned long texslot; // Texture slot start
+ unsigned long sampslot; // Sampler slot start
+ unsigned long uavslot; // UAV slot start
+ unsigned short regType; // register type from CV_HLSLREG_e
+ unsigned char name[1]; // name
+} DATASYMHLSL32;
+
+typedef struct DATASYMHLSL32_EX {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_GDATA_HLSL32_EX, S_LDATA_HLSL32_EX
+ CV_typ_t typind; // Type index
+ unsigned long regID; // Register index
+ unsigned long dataoff; // Base data byte offset start
+ unsigned long bindSpace; // Binding space
+ unsigned long bindSlot; // Lower bound in binding space
+ unsigned short regType; // register type from CV_HLSLREG_e
+ unsigned char name[1]; // name
+} DATASYMHLSL32_EX;
+
+typedef enum CV_PUBSYMFLAGS_e
+ {
+ cvpsfNone = 0,
+ cvpsfCode = 0x00000001,
+ cvpsfFunction = 0x00000002,
+ cvpsfManaged = 0x00000004,
+ cvpsfMSIL = 0x00000008,
+} CV_PUBSYMFLAGS_e;
+
+typedef union CV_PUBSYMFLAGS {
+ CV_pubsymflag_t grfFlags;
+ struct {
+ CV_pubsymflag_t fCode : 1; // set if public symbol refers to a code address
+ CV_pubsymflag_t fFunction : 1; // set if public symbol is a function
+ CV_pubsymflag_t fManaged : 1; // set if managed code (native or IL)
+ CV_pubsymflag_t fMSIL : 1; // set if managed IL code
+ CV_pubsymflag_t __unused : 28; // must be zero
+ };
+} CV_PUBSYMFLAGS;
+
+typedef struct PUBSYM32 {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_PUB32
+ CV_PUBSYMFLAGS pubsymflags;
+ CV_uoff32_t off;
+ unsigned short seg;
+ unsigned char name[1]; // Length-prefixed name
+} PUBSYM32;
+
+
+typedef struct PROCSYM32_16t {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_GPROC32_16t or S_LPROC32_16t
+ unsigned long pParent; // pointer to the parent
+ unsigned long pEnd; // pointer to this blocks end
+ unsigned long pNext; // pointer to next symbol
+ unsigned long len; // Proc length
+ unsigned long DbgStart; // Debug start offset
+ unsigned long DbgEnd; // Debug end offset
+ CV_uoff32_t off;
+ unsigned short seg;
+ CV_typ16_t typind; // Type index
+ CV_PROCFLAGS flags; // Proc flags
+ unsigned char name[1]; // Length-prefixed name
+} PROCSYM32_16t;
+
+typedef struct PROCSYM32 {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_GPROC32, S_LPROC32, S_GPROC32_ID, S_LPROC32_ID, S_LPROC32_DPC or S_LPROC32_DPC_ID
+ unsigned long pParent; // pointer to the parent
+ unsigned long pEnd; // pointer to this blocks end
+ unsigned long pNext; // pointer to next symbol
+ unsigned long len; // Proc length
+ unsigned long DbgStart; // Debug start offset
+ unsigned long DbgEnd; // Debug end offset
+ CV_typ_t typind; // Type index or ID
+ CV_uoff32_t off;
+ unsigned short seg;
+ CV_PROCFLAGS flags; // Proc flags
+ unsigned char name[1]; // Length-prefixed name
+} PROCSYM32;
+
+typedef struct MANPROCSYM {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_GMANPROC, S_LMANPROC, S_GMANPROCIA64 or S_LMANPROCIA64
+ unsigned long pParent; // pointer to the parent
+ unsigned long pEnd; // pointer to this blocks end
+ unsigned long pNext; // pointer to next symbol
+ unsigned long len; // Proc length
+ unsigned long DbgStart; // Debug start offset
+ unsigned long DbgEnd; // Debug end offset
+ CV_tkn_t token; // COM+ metadata token for method
+ CV_uoff32_t off;
+ unsigned short seg;
+ CV_PROCFLAGS flags; // Proc flags
+ unsigned short retReg; // Register return value is in (may not be used for all archs)
+ unsigned char name[1]; // optional name field
+} MANPROCSYM;
+
+typedef struct MANPROCSYMMIPS {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_GMANPROCMIPS or S_LMANPROCMIPS
+ unsigned long pParent; // pointer to the parent
+ unsigned long pEnd; // pointer to this blocks end
+ unsigned long pNext; // pointer to next symbol
+ unsigned long len; // Proc length
+ unsigned long DbgStart; // Debug start offset
+ unsigned long DbgEnd; // Debug end offset
+ unsigned long regSave; // int register save mask
+ unsigned long fpSave; // fp register save mask
+ CV_uoff32_t intOff; // int register save offset
+ CV_uoff32_t fpOff; // fp register save offset
+ CV_tkn_t token; // COM+ token type
+ CV_uoff32_t off;
+ unsigned short seg;
+ unsigned char retReg; // Register return value is in
+ unsigned char frameReg; // Frame pointer register
+ unsigned char name[1]; // optional name field
+} MANPROCSYMMIPS;
+
+typedef struct THUNKSYM32 {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_THUNK32
+ unsigned long pParent; // pointer to the parent
+ unsigned long pEnd; // pointer to this blocks end
+ unsigned long pNext; // pointer to next symbol
+ CV_uoff32_t off;
+ unsigned short seg;
+ unsigned short len; // length of thunk
+ unsigned char ord; // THUNK_ORDINAL specifying type of thunk
+ unsigned char name[1]; // Length-prefixed name
+ unsigned char variant[CV_ZEROLEN]; // variant portion of thunk
+} THUNKSYM32;
+
+typedef enum TRAMP_e { // Trampoline subtype
+ trampIncremental, // incremental thunks
+ trampBranchIsland, // Branch island thunks
+} TRAMP_e;
+
+typedef struct TRAMPOLINESYM { // Trampoline thunk symbol
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_TRAMPOLINE
+ unsigned short trampType; // trampoline sym subtype
+ unsigned short cbThunk; // size of the thunk
+ CV_uoff32_t offThunk; // offset of the thunk
+ CV_uoff32_t offTarget; // offset of the target of the thunk
+ unsigned short sectThunk; // section index of the thunk
+ unsigned short sectTarget; // section index of the target of the thunk
+} TRAMPOLINE;
+
+typedef struct LABELSYM32 {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_LABEL32
+ CV_uoff32_t off;
+ unsigned short seg;
+ CV_PROCFLAGS flags; // flags
+ unsigned char name[1]; // Length-prefixed name
+} LABELSYM32;
+
+
+typedef struct BLOCKSYM32 {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_BLOCK32
+ unsigned long pParent; // pointer to the parent
+ unsigned long pEnd; // pointer to this blocks end
+ unsigned long len; // Block length
+ CV_uoff32_t off; // Offset in code segment
+ unsigned short seg; // segment of label
+ unsigned char name[1]; // Length-prefixed name
+} BLOCKSYM32;
+
+
+typedef struct WITHSYM32 {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_WITH32
+ unsigned long pParent; // pointer to the parent
+ unsigned long pEnd; // pointer to this blocks end
+ unsigned long len; // Block length
+ CV_uoff32_t off; // Offset in code segment
+ unsigned short seg; // segment of label
+ unsigned char expr[1]; // Length-prefixed expression string
+} WITHSYM32;
+
+
+
+typedef struct CEXMSYM32 {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_CEXMODEL32
+ CV_uoff32_t off; // offset of symbol
+ unsigned short seg; // segment of symbol
+ unsigned short model; // execution model
+ union {
+ struct {
+ CV_uoff32_t pcdtable; // offset to pcode function table
+ CV_uoff32_t pcdspi; // offset to segment pcode information
+ } pcode;
+ struct {
+ unsigned short subtype; // see CV_COBOL_e above
+ unsigned short flag;
+ } cobol;
+ struct {
+ CV_uoff32_t calltableOff; // offset to function table
+ unsigned short calltableSeg; // segment of function table
+ } pcode32Mac;
+ };
+} CEXMSYM32;
+
+
+
+typedef struct VPATHSYM32_16t {
+ unsigned short reclen; // record length
+ unsigned short rectyp; // S_VFTABLE32_16t
+ CV_uoff32_t off; // offset of virtual function table
+ unsigned short seg; // segment of virtual function table
+ CV_typ16_t root; // type index of the root of path
+ CV_typ16_t path; // type index of the path record
+} VPATHSYM32_16t;
+
+typedef struct VPATHSYM32 {
+ unsigned short reclen; // record length
+ unsigned short rectyp; // S_VFTABLE32
+ CV_typ_t root; // type index of the root of path
+ CV_typ_t path; // type index of the path record
+ CV_uoff32_t off; // offset of virtual function table
+ unsigned short seg; // segment of virtual function table
+} VPATHSYM32;
+
+
+
+
+
+typedef struct REGREL32_16t {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_REGREL32_16t
+ CV_uoff32_t off; // offset of symbol
+ unsigned short reg; // register index for symbol
+ CV_typ16_t typind; // Type index
+ unsigned char name[1]; // Length-prefixed name
+} REGREL32_16t;
+
+typedef struct REGREL32 {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_REGREL32
+ CV_uoff32_t off; // offset of symbol
+ CV_typ_t typind; // Type index or metadata token
+ unsigned short reg; // register index for symbol
+ unsigned char name[1]; // Length-prefixed name
+} REGREL32;
+
+typedef struct ATTRREGREL {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_MANREGREL | S_ATTR_REGREL
+ CV_uoff32_t off; // offset of symbol
+ CV_typ_t typind; // Type index or metadata token
+ unsigned short reg; // register index for symbol
+ CV_lvar_attr attr; // local var attributes
+ unsigned char name[1]; // Length-prefixed name
+} ATTRREGREL;
+
+typedef ATTRREGREL ATTRREGRELSYM;
+
+typedef struct THREADSYM32_16t {
+ unsigned short reclen; // record length
+ unsigned short rectyp; // S_LTHREAD32_16t | S_GTHREAD32_16t
+ CV_uoff32_t off; // offset into thread storage
+ unsigned short seg; // segment of thread storage
+ CV_typ16_t typind; // type index
+ unsigned char name[1]; // length prefixed name
+} THREADSYM32_16t;
+
+typedef struct THREADSYM32 {
+ unsigned short reclen; // record length
+ unsigned short rectyp; // S_LTHREAD32 | S_GTHREAD32
+ CV_typ_t typind; // type index
+ CV_uoff32_t off; // offset into thread storage
+ unsigned short seg; // segment of thread storage
+ unsigned char name[1]; // length prefixed name
+} THREADSYM32;
+
+typedef struct SLINK32 {
+ unsigned short reclen; // record length
+ unsigned short rectyp; // S_SLINK32
+ unsigned long framesize; // frame size of parent procedure
+ CV_off32_t off; // signed offset where the static link was saved relative to the value of reg
+ unsigned short reg;
+} SLINK32;
+
+typedef struct PROCSYMMIPS_16t {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_GPROCMIPS_16t or S_LPROCMIPS_16t
+ unsigned long pParent; // pointer to the parent
+ unsigned long pEnd; // pointer to this blocks end
+ unsigned long pNext; // pointer to next symbol
+ unsigned long len; // Proc length
+ unsigned long DbgStart; // Debug start offset
+ unsigned long DbgEnd; // Debug end offset
+ unsigned long regSave; // int register save mask
+ unsigned long fpSave; // fp register save mask
+ CV_uoff32_t intOff; // int register save offset
+ CV_uoff32_t fpOff; // fp register save offset
+ CV_uoff32_t off; // Symbol offset
+ unsigned short seg; // Symbol segment
+ CV_typ16_t typind; // Type index
+ unsigned char retReg; // Register return value is in
+ unsigned char frameReg; // Frame pointer register
+ unsigned char name[1]; // Length-prefixed name
+} PROCSYMMIPS_16t;
+
+typedef struct PROCSYMMIPS {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_GPROCMIPS or S_LPROCMIPS
+ unsigned long pParent; // pointer to the parent
+ unsigned long pEnd; // pointer to this blocks end
+ unsigned long pNext; // pointer to next symbol
+ unsigned long len; // Proc length
+ unsigned long DbgStart; // Debug start offset
+ unsigned long DbgEnd; // Debug end offset
+ unsigned long regSave; // int register save mask
+ unsigned long fpSave; // fp register save mask
+ CV_uoff32_t intOff; // int register save offset
+ CV_uoff32_t fpOff; // fp register save offset
+ CV_typ_t typind; // Type index
+ CV_uoff32_t off; // Symbol offset
+ unsigned short seg; // Symbol segment
+ unsigned char retReg; // Register return value is in
+ unsigned char frameReg; // Frame pointer register
+ unsigned char name[1]; // Length-prefixed name
+} PROCSYMMIPS;
+
+typedef struct PROCSYMIA64 {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_GPROCIA64 or S_LPROCIA64
+ unsigned long pParent; // pointer to the parent
+ unsigned long pEnd; // pointer to this blocks end
+ unsigned long pNext; // pointer to next symbol
+ unsigned long len; // Proc length
+ unsigned long DbgStart; // Debug start offset
+ unsigned long DbgEnd; // Debug end offset
+ CV_typ_t typind; // Type index
+ CV_uoff32_t off; // Symbol offset
+ unsigned short seg; // Symbol segment
+ unsigned short retReg; // Register return value is in
+ CV_PROCFLAGS flags; // Proc flags
+ unsigned char name[1]; // Length-prefixed name
+} PROCSYMIA64;
+
+typedef struct REFSYM {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_PROCREF_ST, S_DATAREF_ST, or S_LPROCREF_ST
+ unsigned long sumName; // SUC of the name
+ unsigned long ibSym; // Offset of actual symbol in $$Symbols
+ unsigned short imod; // Module containing the actual symbol
+ unsigned short usFill; // align this record
+} REFSYM;
+
+typedef struct REFSYM2 {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_PROCREF, S_DATAREF, or S_LPROCREF
+ unsigned long sumName; // SUC of the name
+ unsigned long ibSym; // Offset of actual symbol in $$Symbols
+ unsigned short imod; // Module containing the actual symbol
+ unsigned char name[1]; // hidden name made a first class member
+} REFSYM2;
+
+typedef struct ALIGNSYM {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_ALIGN
+} ALIGNSYM;
+
+typedef struct OEMSYMBOL {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_OEM
+ unsigned char idOem[16]; // an oem ID (GUID)
+ CV_typ_t typind; // Type index
+ unsigned long rgl[]; // user data, force 4-byte alignment
+} OEMSYMBOL;
+
+// generic block definition symbols
+// these are similar to the equivalent 16:16 or 16:32 symbols but
+// only define the length, type and linkage fields
+
+typedef struct PROCSYM {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_GPROC16 or S_LPROC16
+ unsigned long pParent; // pointer to the parent
+ unsigned long pEnd; // pointer to this blocks end
+ unsigned long pNext; // pointer to next symbol
+} PROCSYM;
+
+
+typedef struct THUNKSYM {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_THUNK
+ unsigned long pParent; // pointer to the parent
+ unsigned long pEnd; // pointer to this blocks end
+ unsigned long pNext; // pointer to next symbol
+} THUNKSYM;
+
+typedef struct BLOCKSYM {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_BLOCK16
+ unsigned long pParent; // pointer to the parent
+ unsigned long pEnd; // pointer to this blocks end
+} BLOCKSYM;
+
+
+typedef struct WITHSYM {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_WITH16
+ unsigned long pParent; // pointer to the parent
+ unsigned long pEnd; // pointer to this blocks end
+} WITHSYM;
+
+typedef struct FRAMEPROCSYM {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_FRAMEPROC
+ unsigned long cbFrame; // count of bytes of total frame of procedure
+ unsigned long cbPad; // count of bytes of padding in the frame
+ CV_uoff32_t offPad; // offset (relative to frame poniter) to where
+ // padding starts
+ unsigned long cbSaveRegs; // count of bytes of callee save registers
+ CV_uoff32_t offExHdlr; // offset of exception handler
+ unsigned short sectExHdlr; // section id of exception handler
+
+ struct {
+ unsigned long fHasAlloca : 1; // function uses _alloca()
+ unsigned long fHasSetJmp : 1; // function uses setjmp()
+ unsigned long fHasLongJmp : 1; // function uses longjmp()
+ unsigned long fHasInlAsm : 1; // function uses inline asm
+ unsigned long fHasEH : 1; // function has EH states
+ unsigned long fInlSpec : 1; // function was speced as inline
+ unsigned long fHasSEH : 1; // function has SEH
+ unsigned long fNaked : 1; // function is __declspec(naked)
+ unsigned long fSecurityChecks : 1; // function has buffer security check introduced by /GS.
+ unsigned long fAsyncEH : 1; // function compiled with /EHa
+ unsigned long fGSNoStackOrdering : 1; // function has /GS buffer checks, but stack ordering couldn't be done
+ unsigned long fWasInlined : 1; // function was inlined within another function
+ unsigned long fGSCheck : 1; // function is __declspec(strict_gs_check)
+ unsigned long fSafeBuffers : 1; // function is __declspec(safebuffers)
+ unsigned long encodedLocalBasePointer : 2; // record function's local pointer explicitly.
+ unsigned long encodedParamBasePointer : 2; // record function's parameter pointer explicitly.
+ unsigned long fPogoOn : 1; // function was compiled with PGO/PGU
+ unsigned long fValidCounts : 1; // Do we have valid Pogo counts?
+ unsigned long fOptSpeed : 1; // Did we optimize for speed?
+ unsigned long fGuardCF : 1; // function contains CFG checks (and no write checks)
+ unsigned long fGuardCFW : 1; // function contains CFW checks and/or instrumentation
+ unsigned long pad : 9; // must be zero
+ } flags;
+} FRAMEPROCSYM;
+
+#ifdef __cplusplus
+namespace CodeViewInfo
+{
+__inline unsigned short ExpandEncodedBasePointerReg(unsigned machineType, unsigned encodedFrameReg)
+{
+ static const unsigned short rgFramePointerRegX86[] = {
+ CV_REG_NONE, CV_ALLREG_VFRAME, CV_REG_EBP, CV_REG_EBX};
+ static const unsigned short rgFramePointerRegX64[] = {
+ CV_REG_NONE, CV_AMD64_RSP, CV_AMD64_RBP, CV_AMD64_R13};
+ static const unsigned short rgFramePointerRegArm[] = {
+ CV_REG_NONE, CV_ARM_SP, CV_ARM_R7, CV_REG_NONE};
+
+ if (encodedFrameReg >= 4) {
+ return CV_REG_NONE;
+ }
+ switch (machineType) {
+ case CV_CFL_8080 :
+ case CV_CFL_8086 :
+ case CV_CFL_80286 :
+ case CV_CFL_80386 :
+ case CV_CFL_80486 :
+ case CV_CFL_PENTIUM :
+ case CV_CFL_PENTIUMII :
+ case CV_CFL_PENTIUMIII :
+ return rgFramePointerRegX86[encodedFrameReg];
+ case CV_CFL_AMD64 :
+ return rgFramePointerRegX64[encodedFrameReg];
+ case CV_CFL_ARMNT :
+ return rgFramePointerRegArm[encodedFrameReg];
+ default:
+ return CV_REG_NONE;
+ }
+}
+}
+#endif
+
+typedef struct UNAMESPACE {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_UNAMESPACE
+ unsigned char name[1]; // name
+} UNAMESPACE;
+
+typedef struct SEPCODESYM {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_SEPCODE
+ unsigned long pParent; // pointer to the parent
+ unsigned long pEnd; // pointer to this block's end
+ unsigned long length; // count of bytes of this block
+ CV_SEPCODEFLAGS scf; // flags
+ CV_uoff32_t off; // sect:off of the separated code
+ CV_uoff32_t offParent; // sectParent:offParent of the enclosing scope
+ unsigned short sect; // (proc, block, or sepcode)
+ unsigned short sectParent;
+} SEPCODESYM;
+
+typedef struct BUILDINFOSYM {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_BUILDINFO
+ CV_ItemId id; // CV_ItemId of Build Info.
+} BUILDINFOSYM;
+
+typedef struct INLINESITESYM {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_INLINESITE
+ unsigned long pParent; // pointer to the inliner
+ unsigned long pEnd; // pointer to this block's end
+ CV_ItemId inlinee; // CV_ItemId of inlinee
+ unsigned char binaryAnnotations[CV_ZEROLEN]; // an array of compressed binary annotations.
+} INLINESITESYM;
+
+typedef struct INLINESITESYM2 {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_INLINESITE2
+ unsigned long pParent; // pointer to the inliner
+ unsigned long pEnd; // pointer to this block's end
+ CV_ItemId inlinee; // CV_ItemId of inlinee
+ unsigned long invocations; // entry count
+ unsigned char binaryAnnotations[CV_ZEROLEN]; // an array of compressed binary annotations.
+} INLINESITESYM2;
+
+
+// Defines a locals and it is live range, how to evaluate.
+// S_DEFRANGE modifies previous local S_LOCAL, it has to consecutive.
+
+typedef struct LOCALSYM {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_LOCAL
+ CV_typ_t typind; // type index
+ CV_LVARFLAGS flags; // local var flags
+
+ unsigned char name[CV_ZEROLEN]; // Name of this symbol, a null terminated array of UTF8 characters.
+} LOCALSYM;
+
+typedef struct FILESTATICSYM {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_FILESTATIC
+ CV_typ_t typind; // type index
+ CV_uoff32_t modOffset; // index of mod filename in stringtable
+ CV_LVARFLAGS flags; // local var flags
+
+ unsigned char name[CV_ZEROLEN]; // Name of this symbol, a null terminated array of UTF8 characters
+} FILESTATICSYM;
+
+typedef struct DEFRANGESYM { // A live range of sub field of variable
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_DEFRANGE
+
+ CV_uoff32_t program; // DIA program to evaluate the value of the symbol
+
+ CV_LVAR_ADDR_RANGE range; // Range of addresses where this program is valid
+ CV_LVAR_ADDR_GAP gaps[CV_ZEROLEN]; // The value is not available in following gaps.
+} DEFRANGESYM;
+
+typedef struct DEFRANGESYMSUBFIELD { // A live range of sub field of variable. like locala.i
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_DEFRANGE_SUBFIELD
+
+ CV_uoff32_t program; // DIA program to evaluate the value of the symbol
+
+ CV_uoff32_t offParent; // Offset in parent variable.
+
+ CV_LVAR_ADDR_RANGE range; // Range of addresses where this program is valid
+ CV_LVAR_ADDR_GAP gaps[CV_ZEROLEN]; // The value is not available in following gaps.
+} DEFRANGESYMSUBFIELD;
+
+typedef struct CV_RANGEATTR {
+ unsigned short maybe : 1; // May have no user name on one of control flow path.
+ unsigned short padding : 15; // Padding for future use.
+} CV_RANGEATTR;
+
+typedef struct DEFRANGESYMREGISTER { // A live range of en-registed variable
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_DEFRANGE_REGISTER
+ unsigned short reg; // Register to hold the value of the symbol
+ CV_RANGEATTR attr; // Attribute of the register range.
+ CV_LVAR_ADDR_RANGE range; // Range of addresses where this program is valid
+ CV_LVAR_ADDR_GAP gaps[CV_ZEROLEN]; // The value is not available in following gaps.
+} DEFRANGESYMREGISTER;
+
+typedef struct DEFRANGESYMFRAMEPOINTERREL { // A live range of frame variable
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_DEFRANGE_FRAMEPOINTER_REL
+
+ CV_off32_t offFramePointer; // offset to frame pointer
+
+ CV_LVAR_ADDR_RANGE range; // Range of addresses where this program is valid
+ CV_LVAR_ADDR_GAP gaps[CV_ZEROLEN]; // The value is not available in following gaps.
+} DEFRANGESYMFRAMEPOINTERREL;
+
+typedef struct DEFRANGESYMFRAMEPOINTERREL_FULL_SCOPE { // A frame variable valid in all function scope
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_DEFRANGE_FRAMEPOINTER_REL
+
+ CV_off32_t offFramePointer; // offset to frame pointer
+} DEFRANGESYMFRAMEPOINTERREL_FULL_SCOPE;
+
+#define CV_OFFSET_PARENT_LENGTH_LIMIT 12
+
+// Note DEFRANGESYMREGISTERREL and DEFRANGESYMSUBFIELDREGISTER had same layout.
+typedef struct DEFRANGESYMSUBFIELDREGISTER { // A live range of sub field of variable. like locala.i
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_DEFRANGE_SUBFIELD_REGISTER
+
+ unsigned short reg; // Register to hold the value of the symbol
+ CV_RANGEATTR attr; // Attribute of the register range.
+ CV_uoff32_t offParent : CV_OFFSET_PARENT_LENGTH_LIMIT; // Offset in parent variable.
+ CV_uoff32_t padding : 20; // Padding for future use.
+ CV_LVAR_ADDR_RANGE range; // Range of addresses where this program is valid
+ CV_LVAR_ADDR_GAP gaps[CV_ZEROLEN]; // The value is not available in following gaps.
+} DEFRANGESYMSUBFIELDREGISTER;
+
+// Note DEFRANGESYMREGISTERREL and DEFRANGESYMSUBFIELDREGISTER had same layout.
+// Used when /GS Copy parameter as local variable or other variable don't cover by FRAMERELATIVE.
+typedef struct DEFRANGESYMREGISTERREL { // A live range of variable related to a register.
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_DEFRANGE_REGISTER_REL
+
+ unsigned short baseReg; // Register to hold the base pointer of the symbol
+ unsigned short spilledUdtMember : 1; // Spilled member for s.i.
+ unsigned short padding : 3; // Padding for future use.
+ unsigned short offsetParent : CV_OFFSET_PARENT_LENGTH_LIMIT; // Offset in parent variable.
+ CV_off32_t offBasePointer; // offset to register
+
+ CV_LVAR_ADDR_RANGE range; // Range of addresses where this program is valid
+ CV_LVAR_ADDR_GAP gaps[CV_ZEROLEN]; // The value is not available in following gaps.
+} DEFRANGESYMREGISTERREL;
+
+typedef struct DEFRANGESYMHLSL { // A live range of variable related to a symbol in HLSL code.
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_DEFRANGE_HLSL or S_DEFRANGE_DPC_PTR_TAG
+
+ unsigned short regType; // register type from CV_HLSLREG_e
+
+ unsigned short regIndices : 2; // 0, 1 or 2, dimensionality of register space
+ unsigned short spilledUdtMember : 1; // this is a spilled member
+ unsigned short memorySpace : 4; // memory space
+ unsigned short padding : 9; // for future use
+
+ unsigned short offsetParent; // Offset in parent variable.
+ unsigned short sizeInParent; // Size of enregistered portion
+
+ CV_LVAR_ADDR_RANGE range; // Range of addresses where this program is valid
+ unsigned char data[CV_ZEROLEN]; // variable length data specifying gaps where the value is not available
+ // followed by multi-dimensional offset of variable location in register
+ // space (see CV_DEFRANGESYMHLSL_* macros below)
+} DEFRANGESYMHLSL;
+
+#define CV_DEFRANGESYM_GAPS_COUNT(x) \
+ (((x)->reclen + sizeof((x)->reclen) - sizeof(DEFRANGESYM)) / sizeof(CV_LVAR_ADDR_GAP))
+
+#define CV_DEFRANGESYMSUBFIELD_GAPS_COUNT(x) \
+ (((x)->reclen + sizeof((x)->reclen) - sizeof(DEFRANGESYMSUBFIELD)) / sizeof(CV_LVAR_ADDR_GAP))
+
+#define CV_DEFRANGESYMHLSL_GAPS_COUNT(x) \
+ (((x)->reclen + sizeof((x)->reclen) - sizeof(DEFRANGESYMHLSL) - (x)->regIndices * sizeof(CV_uoff32_t)) / sizeof(CV_LVAR_ADDR_GAP))
+
+#define CV_DEFRANGESYMHLSL_GAPS_PTR_BASE(x, t) reinterpret_cast<t>((x)->data)
+
+#define CV_DEFRANGESYMHLSL_GAPS_CONST_PTR(x) \
+ CV_DEFRANGESYMHLSL_GAPS_PTR_BASE(x, const CV_LVAR_ADDR_GAP*)
+
+#define CV_DEFRANGESYMHLSL_GAPS_PTR(x) \
+ CV_DEFRANGESYMHLSL_GAPS_PTR_BASE(x, CV_LVAR_ADDR_GAP*)
+
+#define CV_DEFRANGESYMHLSL_OFFSET_PTR_BASE(x, t) \
+ reinterpret_cast<t>(((CV_LVAR_ADDR_GAP*)(x)->data) + CV_DEFRANGESYMHLSL_GAPS_COUNT(x))
+
+#define CV_DEFRANGESYMHLSL_OFFSET_CONST_PTR(x) \
+ CV_DEFRANGESYMHLSL_OFFSET_PTR_BASE(x, const CV_uoff32_t*)
+
+#define CV_DEFRANGESYMHLSL_OFFSET_PTR(x) \
+ CV_DEFRANGESYMHLSL_OFFSET_PTR_BASE(x, CV_uoff32_t*)
+
+#if defined(CC_DP_CXX) && CC_DP_CXX
+
+// Defines a local DPC group shared variable and its location.
+typedef struct LOCALDPCGROUPSHAREDSYM {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_LOCAL_DPC_GROUPSHARED
+ CV_typ_t typind; // type index
+ CV_LVARFLAGS flags; // local var flags
+
+ unsigned short dataslot; // Base data (cbuffer, groupshared, etc.) slot
+ unsigned short dataoff; // Base data byte offset start
+
+ unsigned char name[CV_ZEROLEN]; // Name of this symbol, a null terminated array of UTF8 characters.
+} LOCALDPCGROUPSHAREDSYM;
+
+typedef struct DPCSYMTAGMAP { // A map for DPC pointer tag values to symbol records.
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_DPC_SYM_TAG_MAP
+
+ CV_DPC_SYM_TAG_MAP_ENTRY mapEntries[CV_ZEROLEN]; // Array of mappings from DPC pointer tag values to symbol record offsets
+} DPCSYMTAGMAP;
+
+#define CV_DPCSYMTAGMAP_COUNT(x) \
+ (((x)->reclen + sizeof((x)->reclen) - sizeof(DPCSYMTAGMAP)) / sizeof(CV_DPC_SYM_TAG_MAP_ENTRY))
+
+#endif // CC_DP_CXX
+
+typedef enum CV_armswitchtype {
+ CV_SWT_INT1 = 0,
+ CV_SWT_UINT1 = 1,
+ CV_SWT_INT2 = 2,
+ CV_SWT_UINT2 = 3,
+ CV_SWT_INT4 = 4,
+ CV_SWT_UINT4 = 5,
+ CV_SWT_POINTER = 6,
+ CV_SWT_UINT1SHL1 = 7,
+ CV_SWT_UINT2SHL1 = 8,
+ CV_SWT_INT1SHL1 = 9,
+ CV_SWT_INT2SHL1 = 10,
+ CV_SWT_TBB = CV_SWT_UINT1SHL1,
+ CV_SWT_TBH = CV_SWT_UINT2SHL1,
+} CV_armswitchtype;
+
+typedef struct FUNCTIONLIST {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_CALLERS or S_CALLEES
+
+ unsigned long count; // Number of functions
+ CV_typ_t funcs[CV_ZEROLEN]; // List of functions, dim == count
+ // unsigned long invocations[CV_ZEROLEN]; Followed by a parallel array of
+ // invocation counts. Counts > reclen are assumed to be zero
+} FUNCTIONLIST;
+
+typedef struct POGOINFO {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_POGODATA
+
+ unsigned long invocations; // Number of times function was called
+ __int64 dynCount; // Dynamic instruction count
+ unsigned long numInstrs; // Static instruction count
+ unsigned long staInstLive; // Final static instruction count (post inlining)
+} POGOINFO;
+
+typedef struct ARMSWITCHTABLE {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_ARMSWITCHTABLE
+
+ CV_uoff32_t offsetBase; // Section-relative offset to the base for switch offsets
+ unsigned short sectBase; // Section index of the base for switch offsets
+ unsigned short switchType; // type of each entry
+ CV_uoff32_t offsetBranch; // Section-relative offset to the table branch instruction
+ CV_uoff32_t offsetTable; // Section-relative offset to the start of the table
+ unsigned short sectBranch; // Section index of the table branch instruction
+ unsigned short sectTable; // Section index of the table
+ unsigned long cEntries; // number of switch table entries
+} ARMSWITCHTABLE;
+
+typedef struct MODTYPEREF {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_MOD_TYPEREF
+
+ unsigned long fNone : 1; // module doesn't reference any type
+ unsigned long fRefTMPCT : 1; // reference /Z7 PCH types
+ unsigned long fOwnTMPCT : 1; // module contains /Z7 PCH types
+ unsigned long fOwnTMR : 1; // module contains type info (/Z7)
+ unsigned long fOwnTM : 1; // module contains type info (/Zi or /ZI)
+ unsigned long fRefTM : 1; // module references type info owned by other module
+ unsigned long reserved : 9;
+
+ unsigned short word0; // these two words contain SN or module index depending
+ unsigned short word1; // on above flags
+} MODTYPEREF;
+
+typedef struct SECTIONSYM {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_SECTION
+
+ unsigned short isec; // Section number
+ unsigned char align; // Alignment of this section (power of 2)
+ unsigned char bReserved; // Reserved. Must be zero.
+ unsigned long rva;
+ unsigned long cb;
+ unsigned long characteristics;
+ unsigned char name[1]; // name
+} SECTIONSYM;
+
+typedef struct COFFGROUPSYM {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_COFFGROUP
+
+ unsigned long cb;
+ unsigned long characteristics;
+ CV_uoff32_t off; // Symbol offset
+ unsigned short seg; // Symbol segment
+ unsigned char name[1]; // name
+} COFFGROUPSYM;
+
+typedef struct EXPORTSYM {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_EXPORT
+
+ unsigned short ordinal;
+ unsigned short fConstant : 1; // CONSTANT
+ unsigned short fData : 1; // DATA
+ unsigned short fPrivate : 1; // PRIVATE
+ unsigned short fNoName : 1; // NONAME
+ unsigned short fOrdinal : 1; // Ordinal was explicitly assigned
+ unsigned short fForwarder : 1; // This is a forwarder
+ unsigned short reserved : 10; // Reserved. Must be zero.
+ unsigned char name[1]; // name of
+} EXPORTSYM;
+
+//
+// Symbol for describing indirect calls when they are using
+// a function pointer cast on some other type or temporary.
+// Typical content will be an LF_POINTER to an LF_PROCEDURE
+// type record that should mimic an actual variable with the
+// function pointer type in question.
+//
+// Since the compiler can sometimes tail-merge a function call
+// through a function pointer, there may be more than one
+// S_CALLSITEINFO record at an address. This is similar to what
+// you could do in your own code by:
+//
+// if (expr)
+// pfn = &function1;
+// else
+// pfn = &function2;
+//
+// (*pfn)(arg list);
+//
+
+typedef struct CALLSITEINFO {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_CALLSITEINFO
+ CV_off32_t off; // offset of call site
+ unsigned short sect; // section index of call site
+ unsigned short __reserved_0; // alignment padding field, must be zero
+ CV_typ_t typind; // type index describing function signature
+} CALLSITEINFO;
+
+typedef struct HEAPALLOCSITE {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_HEAPALLOCSITE
+ CV_off32_t off; // offset of call site
+ unsigned short sect; // section index of call site
+ unsigned short cbInstr; // length of heap allocation call instruction
+ CV_typ_t typind; // type index describing function signature
+} HEAPALLOCSITE;
+
+// Frame cookie information
+
+typedef enum CV_cookietype_e
+{
+ CV_COOKIETYPE_COPY = 0,
+ CV_COOKIETYPE_XOR_SP,
+ CV_COOKIETYPE_XOR_BP,
+ CV_COOKIETYPE_XOR_R13,
+} CV_cookietype_e;
+
+// Symbol for describing security cookie's position and type
+// (raw, xor'd with esp, xor'd with ebp).
+
+typedef struct FRAMECOOKIE {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_FRAMECOOKIE
+ CV_off32_t off; // Frame relative offset
+ unsigned short reg; // Register index
+ CV_cookietype_e cookietype; // Type of the cookie
+ unsigned char flags; // Flags describing this cookie
+} FRAMECOOKIE;
+
+typedef enum CV_DISCARDED_e
+{
+ CV_DISCARDED_UNKNOWN,
+ CV_DISCARDED_NOT_SELECTED,
+ CV_DISCARDED_NOT_REFERENCED,
+} CV_DISCARDED_e;
+
+typedef struct DISCARDEDSYM {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_DISCARDED
+ unsigned long discarded : 8; // CV_DISCARDED_e
+ unsigned long reserved : 24; // Unused
+ unsigned long fileid; // First FILEID if line number info present
+ unsigned long linenum; // First line number
+ char data[CV_ZEROLEN]; // Original record(s) with invalid type indices
+} DISCARDEDSYM;
+
+typedef struct REFMINIPDB {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_REF_MINIPDB
+ union {
+ unsigned long isectCoff; // coff section
+ CV_typ_t typind; // type index
+ };
+ unsigned short imod; // mod index
+ unsigned short fLocal : 1; // reference to local (vs. global) func or data
+ unsigned short fData : 1; // reference to data (vs. func)
+ unsigned short fUDT : 1; // reference to UDT
+ unsigned short fLabel : 1; // reference to label
+ unsigned short fConst : 1; // reference to const
+ unsigned short reserved : 11; // reserved, must be zero
+ unsigned char name[1]; // zero terminated name string
+} REFMINIPDB;
+
+typedef struct PDBMAP {
+ unsigned short reclen; // Record length
+ unsigned short rectyp; // S_PDBMAP
+ unsigned char name[CV_ZEROLEN]; // zero terminated source PDB filename followed by zero
+ // terminated destination PDB filename, both in wchar_t
+} PDBMAP;
+
+//
+// V7 line number data types
+//
+
+enum DEBUG_S_SUBSECTION_TYPE {
+ DEBUG_S_IGNORE = 0x80000000, // if this bit is set in a subsection type then ignore the subsection contents
+
+ DEBUG_S_SYMBOLS = 0xf1,
+ DEBUG_S_LINES,
+ DEBUG_S_STRINGTABLE,
+ DEBUG_S_FILECHKSMS,
+ DEBUG_S_FRAMEDATA,
+ DEBUG_S_INLINEELINES,
+ DEBUG_S_CROSSSCOPEIMPORTS,
+ DEBUG_S_CROSSSCOPEEXPORTS,
+
+ DEBUG_S_IL_LINES,
+ DEBUG_S_FUNC_MDTOKEN_MAP,
+ DEBUG_S_TYPE_MDTOKEN_MAP,
+ DEBUG_S_MERGED_ASSEMBLYINPUT,
+
+ DEBUG_S_COFF_SYMBOL_RVA,
+};
+
+struct CV_DebugSSubsectionHeader_t {
+ enum DEBUG_S_SUBSECTION_TYPE type;
+ CV_off32_t cbLen;
+};
+
+struct CV_DebugSLinesHeader_t {
+ CV_off32_t offCon;
+ unsigned short segCon;
+ unsigned short flags;
+ CV_off32_t cbCon;
+};
+
+struct CV_DebugSLinesFileBlockHeader_t {
+ CV_off32_t offFile;
+ CV_off32_t nLines;
+ CV_off32_t cbBlock;
+ // CV_Line_t lines[nLines];
+ // CV_Column_t columns[nColumns];
+};
+
+//
+// Line flags (data present)
+//
+#define CV_LINES_HAVE_COLUMNS 0x0001
+
+struct CV_Line_t {
+ unsigned long offset; // Offset to start of code bytes for line number
+ unsigned long linenumStart:24; // line where statement/expression starts
+ unsigned long deltaLineEnd:7; // delta to line where statement ends (optional)
+ unsigned long fStatement:1; // true if a statement linenumber, else an expression line num
+};
+
+typedef unsigned short CV_columnpos_t; // byte offset in a source line
+
+struct CV_Column_t {
+ CV_columnpos_t offColumnStart;
+ CV_columnpos_t offColumnEnd;
+};
+
+struct tagFRAMEDATA {
+ unsigned long ulRvaStart;
+ unsigned long cbBlock;
+ unsigned long cbLocals;
+ unsigned long cbParams;
+ unsigned long cbStkMax;
+ unsigned long frameFunc;
+ unsigned short cbProlog;
+ unsigned short cbSavedRegs;
+ unsigned long fHasSEH:1;
+ unsigned long fHasEH:1;
+ unsigned long fIsFunctionStart:1;
+ unsigned long reserved:29;
+};
+
+typedef struct tagFRAMEDATA FRAMEDATA, * PFRAMEDATA;
+
+typedef struct tagXFIXUP_DATA {
+ unsigned short wType;
+ unsigned short wExtra;
+ unsigned long rva;
+ unsigned long rvaTarget;
+} XFIXUP_DATA;
+
+// Those cross scope IDs are private convention,
+// it used to delay the ID merging for frontend and backend even linker.
+// It is transparent for DIA client.
+// Use those ID will let DIA run a litter slower and but
+// avoid the copy type tree in some scenarios.
+
+#ifdef __cplusplus
+namespace CodeViewInfo
+{
+
+typedef struct ComboID
+{
+ static const unsigned int IndexBitWidth = 20;
+ static const unsigned int ImodBitWidth = 12;
+
+ ComboID(unsigned short imod, unsigned int index)
+ {
+ m_comboID = (((unsigned int) imod) << IndexBitWidth) | index;
+ }
+
+ ComboID(unsigned int comboID)
+ {
+ m_comboID = comboID;
+ }
+
+ operator unsigned int()
+ {
+ return m_comboID;
+ }
+
+ unsigned short GetModIndex()
+ {
+ return (unsigned short) (m_comboID >> IndexBitWidth);
+ }
+
+ unsigned int GetIndex()
+ {
+ return (m_comboID & ((1 << IndexBitWidth) - 1));
+ }
+
+private:
+
+ unsigned int m_comboID;
+} ComboID;
+
+
+typedef struct CrossScopeId
+{
+ static const unsigned int LocalIdBitWidth = 20;
+ static const unsigned int IdScopeBitWidth = 11;
+ static const unsigned int StartCrossScopeId =
+ (unsigned int) (1 << (LocalIdBitWidth + IdScopeBitWidth));
+ static const unsigned int LocalIdMask = (1 << LocalIdBitWidth) - 1;
+ static const unsigned int ScopeIdMask = StartCrossScopeId - (1 << LocalIdBitWidth);
+
+ // Compilation unit at most reference 1M constructed type.
+ static const unsigned int MaxLocalId = (1 << LocalIdBitWidth) - 1;
+
+ // Compilation unit at most reference to another 2K compilation units.
+ static const unsigned int MaxScopeId = (1 << IdScopeBitWidth) - 1;
+
+ CrossScopeId(unsigned short aIdScopeId, unsigned int aLocalId)
+ {
+ crossScopeId = StartCrossScopeId
+ | (aIdScopeId << LocalIdBitWidth)
+ | aLocalId;
+ }
+
+ operator unsigned int() {
+ return crossScopeId;
+ }
+
+ unsigned int GetLocalId() {
+ return crossScopeId & LocalIdMask;
+ }
+
+ unsigned int GetIdScopeId() {
+ return (crossScopeId & ScopeIdMask) >> LocalIdBitWidth;
+ }
+
+ static bool IsCrossScopeId(unsigned int i)
+ {
+ return (StartCrossScopeId & i) != 0;
+ }
+
+ static CrossScopeId Decode(unsigned int i)
+ {
+ CrossScopeId retval;
+ retval.crossScopeId = i;
+ return retval;
+ }
+
+private:
+
+ CrossScopeId() {}
+
+ unsigned int crossScopeId;
+
+} CrossScopeId;
+
+// Combined encoding of TI or FuncId, In compiler implementation
+// Id prefixed by 1 if it is function ID.
+
+typedef struct DecoratedItemId
+{
+ DecoratedItemId(bool isFuncId, CV_ItemId inputId) {
+ if (isFuncId) {
+ decoratedItemId = 0x80000000 | inputId;
+ } else {
+ decoratedItemId = inputId;
+ }
+ }
+
+ DecoratedItemId(CV_ItemId encodedId) {
+ decoratedItemId = encodedId;
+ }
+
+ operator unsigned int() {
+ return decoratedItemId;
+ }
+
+ bool IsFuncId()
+ {
+ return (decoratedItemId & 0x80000000) == 0x80000000;
+ }
+
+ CV_ItemId GetItemId()
+ {
+ return decoratedItemId & 0x7fffffff;
+ }
+
+private:
+
+ unsigned int decoratedItemId;
+
+} DecoratedItemId;
+
+// Compilation Unit object file path include library name
+// Or compile time PDB full path
+
+typedef struct tagPdbIdScope {
+ CV_off32_t offObjectFilePath;
+} PdbIdScope;
+
+// An array of all imports by import module.
+// List all cross reference for a specific ID scope.
+// Format of DEBUG_S_CROSSSCOPEIMPORTS subsection is
+typedef struct tagCrossScopeReferences {
+ PdbIdScope externalScope; // Module of definition Scope.
+ unsigned int countOfCrossReferences; // Count of following array.
+ CV_ItemId referenceIds[CV_ZEROLEN]; // CV_ItemId in another compilation unit.
+} CrossScopeReferences;
+
+// An array of all exports in this module.
+// Format of DEBUG_S_CROSSSCOPEEXPORTS subsection is
+typedef struct tagLocalIdAndGlobalIdPair {
+ CV_ItemId localId; // local id inside the compile time PDB scope. 0 based
+ CV_ItemId globalId; // global id inside the link time PDB scope, if scope are different.
+} LocalIdAndGlobalIdPair;
+
+// Format of DEBUG_S_INLINEELINEINFO subsection
+// List start source file information for an inlined function.
+
+#define CV_INLINEE_SOURCE_LINE_SIGNATURE 0x0
+#define CV_INLINEE_SOURCE_LINE_SIGNATURE_EX 0x1
+
+typedef struct tagInlineeSourceLine {
+ CV_ItemId inlinee; // function id.
+ CV_off32_t fileId; // offset into file table DEBUG_S_FILECHKSMS
+ CV_off32_t sourceLineNum; // definition start line number.
+} InlineeSourceLine;
+
+typedef struct tagInlineeSourceLineEx {
+ CV_ItemId inlinee; // function id
+ CV_off32_t fileId; // offset into file table DEBUG_S_FILECHKSMS
+ CV_off32_t sourceLineNum; // definition start line number
+ unsigned int countOfExtraFiles;
+ CV_off32_t extraFileId[CV_ZEROLEN];
+} InlineeSourceLineEx;
+
+// BinaryAnnotations ::= BinaryAnnotationInstruction+
+// BinaryAnnotationInstruction ::= BinaryAnnotationOpcode Operand+
+//
+// The binary annotation mechanism supports recording a list of annotations
+// in an instruction stream. The X64 unwind code and the DWARF standard have
+// similar design.
+//
+// One annotation contains opcode and a number of 32bits operands.
+//
+// The initial set of annotation instructions are for line number table
+// encoding only. These annotations append to S_INLINESITE record, and
+// operands are unsigned except for BA_OP_ChangeLineOffset.
+
+enum BinaryAnnotationOpcode
+{
+ BA_OP_Invalid, // link time pdb contains PADDINGs
+ BA_OP_CodeOffset, // param : start offset
+ BA_OP_ChangeCodeOffsetBase, // param : nth separated code chunk (main code chunk == 0)
+ BA_OP_ChangeCodeOffset, // param : delta of offset
+ BA_OP_ChangeCodeLength, // param : length of code, default next start
+ BA_OP_ChangeFile, // param : fileId
+ BA_OP_ChangeLineOffset, // param : line offset (signed)
+ BA_OP_ChangeLineEndDelta, // param : how many lines, default 1
+ BA_OP_ChangeRangeKind, // param : either 1 (default, for statement)
+ // or 0 (for expression)
+
+ BA_OP_ChangeColumnStart, // param : start column number, 0 means no column info
+ BA_OP_ChangeColumnEndDelta, // param : end column number delta (signed)
+
+ // Combo opcodes for smaller encoding size.
+
+ BA_OP_ChangeCodeOffsetAndLineOffset, // param : ((sourceDelta << 4) | CodeDelta)
+ BA_OP_ChangeCodeLengthAndCodeOffset, // param : codeLength, codeOffset
+
+ BA_OP_ChangeColumnEnd, // param : end column number
+};
+
+inline int BinaryAnnotationInstructionOperandCount(BinaryAnnotationOpcode op)
+{
+ return (op == BA_OP_ChangeCodeLengthAndCodeOffset) ? 2 : 1;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// This routine a simplified variant from cor.h.
+//
+// Compress an unsigned integer (iLen) and store the result into pDataOut.
+//
+// Return value is the number of bytes that the compressed data occupies. It
+// is caller's responsibilityt to ensure *pDataOut has at least 4 bytes to be
+// written to.
+//
+// Note that this function returns -1 if iLen is too big to be compressed.
+// We currently can only encode numbers no larger than 0x1FFFFFFF.
+//
+///////////////////////////////////////////////////////////////////////////////
+
+typedef unsigned __int8 UInt8;
+typedef unsigned __int32 UInt32;
+
+typedef UInt8 CompressedAnnotation;
+typedef CompressedAnnotation* PCompressedAnnotation;
+
+inline UInt32 CVCompressData(
+ UInt32 iLen, // [IN] given uncompressed data
+ void * pDataOut) // [OUT] buffer for the compressed data
+{
+ UInt8 *pBytes = reinterpret_cast<UInt8 *>(pDataOut);
+
+ if (iLen <= 0x7F) {
+ *pBytes = UInt8(iLen);
+ return 1;
+ }
+
+ if (iLen <= 0x3FFF) {
+ *pBytes = UInt8((iLen >> 8) | 0x80);
+ *(pBytes+1) = UInt8(iLen & 0xff);
+ return 2;
+ }
+
+ if (iLen <= 0x1FFFFFFF) {
+ *pBytes = UInt8((iLen >> 24) | 0xC0);
+ *(pBytes+1) = UInt8((iLen >> 16) & 0xff);
+ *(pBytes+2) = UInt8((iLen >> 8) & 0xff);
+ *(pBytes+3) = UInt8(iLen & 0xff);
+ return 4;
+ }
+
+ return (UInt32) -1;
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// Uncompress the data in pData and store the result into pDataOut.
+//
+// Return value is the uncompressed unsigned integer. pData is incremented to
+// point to the next piece of uncompressed data.
+//
+// Returns -1 if what is passed in is incorrectly compressed data, such as
+// (*pBytes & 0xE0) == 0xE0.
+//
+///////////////////////////////////////////////////////////////////////////////
+
+inline UInt32 CVUncompressData(
+ PCompressedAnnotation & pData) // [IN,OUT] compressed data
+{
+ UInt32 res = (UInt32)(-1);
+
+ if ((*pData & 0x80) == 0x00) {
+ // 0??? ????
+
+ res = (UInt32)(*pData++);
+ }
+ else if ((*pData & 0xC0) == 0x80) {
+ // 10?? ????
+
+ res = (UInt32)((*pData++ & 0x3f) << 8);
+ res |= *pData++;
+ }
+ else if ((*pData & 0xE0) == 0xC0) {
+ // 110? ????
+
+ res = (*pData++ & 0x1f) << 24;
+ res |= *pData++ << 16;
+ res |= *pData++ << 8;
+ res |= *pData++;
+ }
+
+ return res;
+}
+
+// Encode smaller absolute numbers with smaller buffer.
+//
+// General compression only work for input < 0x1FFFFFFF
+// algorithm will not work on 0x80000000
+
+inline unsigned __int32 EncodeSignedInt32(__int32 input)
+{
+ unsigned __int32 rotatedInput;
+
+ if (input >= 0) {
+ rotatedInput = input << 1;
+ } else {
+ rotatedInput = ((-input) << 1) | 1;
+ }
+
+ return rotatedInput;
+}
+
+inline __int32 DecodeSignedInt32(unsigned __int32 input)
+{
+ __int32 rotatedInput;
+
+ if (input & 1) {
+ rotatedInput = - (int)(input >> 1);
+ } else {
+ rotatedInput = input >> 1;
+ }
+
+ return rotatedInput;
+}
+
+}
+#endif
+#pragma pack ( pop )
+
+#endif /* CV_INFO_INCLUDED */
diff --git a/src/inc/cycletimer.h b/src/inc/cycletimer.h
new file mode 100644
index 0000000000..229fddb33f
--- /dev/null
+++ b/src/inc/cycletimer.h
@@ -0,0 +1,56 @@
+// 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.
+
+//
+// CycleTimer has methods related to getting cycle timer values.
+// It uses an all-statics class as a namespace mechanism.
+//
+
+#ifndef _CYCLETIMER_H_
+#define _CYCLETIMER_H_
+
+#include "windef.h"
+
+class CycleTimer
+{
+ // This returns the value of the *non-thread-virtualized* cycle counter.
+ static unsigned __int64 GetCycleCount64();
+
+
+ // This wraps GetCycleCount64 in the signature of QueryThreadCycleTime -- but note
+ // that it ignores the "thrd" argument.
+ static BOOL WINAPI DefaultQueryThreadCycleTime(__in HANDLE thrd, __out PULONG64 cyclesPtr);
+
+ // The function pointer type for QueryThreadCycleTime.
+ typedef BOOL (WINAPI *QueryThreadCycleTimeSig)(__in HANDLE, __out PULONG64);
+
+ // Returns a function pointer for QueryThreadCycleTime, or else BadFPtr.
+ static QueryThreadCycleTimeSig GetQueryThreadCycleTime();
+
+ // Initialized once from NULL to either BadFPtr or QueryThreadCycleTime.
+ static QueryThreadCycleTimeSig s_QueryThreadCycleTimeFPtr;
+
+ public:
+
+ // This method computes the number of cycles/sec for the current machine. The cycles are those counted
+ // by GetThreadCycleTime; we assume that these are of equal duration, though that is not necessarily true.
+ // If any OS interaction fails, returns 0.0.
+ static double CyclesPerSecond();
+
+ // Does a large number of queries, and returns the average of their overhead, so other measurements
+ // can adjust for this.
+ static unsigned __int64 QueryOverhead();
+
+ // There's no "native" atomic add for 64 bit, so we have this convenience function.
+ static void InterlockedAddU64(unsigned __int64* loc, unsigned __int64 amount);
+
+ // Attempts to query the cycle counter of the current thread. If successful, returns "true" and sets
+ // *cycles to the cycle counter value. Otherwise, returns false. Note that the value returned is (currently)
+ // virtualized to the current thread only on Windows; on non-windows x86/x64 platforms, directly reads
+ // the cycle counter and returns that value.
+ static bool GetThreadCyclesS(unsigned __int64* cycles);
+};
+
+#endif // _CYCLETIMER_H_
+
diff --git a/src/inc/daccess.h b/src/inc/daccess.h
new file mode 100644
index 0000000000..b4c5044bd9
--- /dev/null
+++ b/src/inc/daccess.h
@@ -0,0 +1,2463 @@
+// 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.
+//*****************************************************************************
+// File: daccess.h
+//
+
+//
+// Support for external access of runtime data structures. These
+// macros and templates hide the details of pointer and data handling
+// so that data structures and code can be compiled to work both
+// in-process and through a special memory access layer.
+//
+// This code assumes the existence of two different pieces of code,
+// the target, the runtime code that is going to be examined, and
+// the host, the code that's doing the examining. Access to the
+// target is abstracted so the target may be a live process on the
+// same machine, a live process on a different machine, a dump file
+// or whatever. No assumptions should be made about accessibility
+// of the target.
+//
+// This code assumes that the data in the target is static. Any
+// time the target's data changes the interfaces must be reset so
+// that potentially stale data is discarded.
+//
+// This code is intended for read access and there is no
+// way to write data back currently.
+//
+// DAC-ized code:
+// - is read-only (non-invasive). So DACized codepaths can not trigger a GC.
+// - has no Thread* object. In reality, DAC-ized codepaths are
+// ReadProcessMemory calls from out-of-process. Conceptually, they
+// are like a pure-native (preemptive) thread.
+////
+// This means that in particular, you cannot DACize a GCTRIGGERS function.
+// Neither can you DACize a function that throws if this will involve
+// allocating a new exception object. There may be
+// exceptions to these rules if you can guarantee that the DACized
+// part of the code path cannot cause a garbage collection (see
+// EditAndContinueModule::ResolveField for an example).
+// If you need to DACize a function that may trigger
+// a GC, it is probably best to refactor the function so that the DACized
+// part of the code path is in a separate function. For instance,
+// functions with GetOrCreate() semantics are hard to DAC-ize because
+// they the Create portion is inherently invasive. Instead, consider refactoring
+// into a GetOrFail() function that DAC can call; and then make GetOrCreate()
+// a wrapper around that.
+
+//
+// This code works by hiding the details of access to target memory.
+// Access is divided into two types:
+// 1. DPTR - access to a piece of data.
+// 2. VPTR - access to a class with a vtable. The class can only have
+// a single vtable pointer at the beginning of the class instance.
+// Things only need to be declared as VPTRs when it is necessary to
+// call virtual functions in the host. In that case the access layer
+// must do extra work to provide a host vtable for the object when
+// it is retrieved so that virtual functions can be called.
+//
+// When compiling with DACCESS_COMPILE the macros turn into templates
+// which replace pointers with smart pointers that know how to fetch
+// data from the target process and provide a host process version of it.
+// Normal data structure access will transparently receive a host copy
+// of the data and proceed, so code such as
+// typedef DPTR(Class) PTR_Class;
+// PTR_Class cls;
+// int val = cls->m_Int;
+// will work without modification. The appropriate operators are overloaded
+// to provide transparent access, such as the -> operator in this case.
+// Note that the convention is to create an appropriate typedef for
+// each type that will be accessed. This hides the particular details
+// of the type declaration and makes the usage look more like regular code.
+//
+// The ?PTR classes also have an implicit base type cast operator to
+// produce a host-pointer instance of the given type. For example
+// Class* cls = PTR_Class(addr);
+// works by implicit conversion from the PTR_Class created by wrapping
+// to a host-side Class instance. Again, this means that existing code
+// can work without modification.
+//
+// Code Example:
+//
+// typedef struct _rangesection
+// {
+// PTR_IJitManager pjit;
+// PTR_RangeSection pright;
+// PTR_RangeSection pleft;
+// ... Other fields omitted ...
+// } RangeSection;
+//
+// RangeSection* pRS = m_RangeTree;
+//
+// while (pRS != NULL)
+// {
+// if (currentPC < pRS->LowAddress)
+// pRS=pRS->pleft;
+// else if (currentPC > pRS->HighAddress)
+// pRS=pRS->pright;
+// else
+// {
+// return pRS->pjit;
+// }
+// }
+//
+// This code does not require any modifications. The global reference
+// provided by m_RangeTree will be a host version of the RangeSection
+// instantiated by conversion. The references to pRS->pleft and
+// pRS->pright will refer to DPTRs due to the modified declaration.
+// In the assignment statement the compiler will automatically use
+// the implicit conversion from PTR_RangeSection to RangeSection*,
+// causing a host instance to be created. Finally, if an appropriate
+// section is found the use of pRS->pjit will cause an implicit
+// conversion from PTR_IJitManager to IJitManager. The VPTR code
+// will look at target memory to determine the actual derived class
+// for the JitManager and instantiate the right class in the host so
+// that host virtual functions can be used just as they would in
+// the target.
+//
+// There are situations where code modifications are required, though.
+//
+// 1. Any time the actual value of an address matters, such as using
+// it as a search key in a tree, the target address must be used.
+//
+// An example of this is the RangeSection tree used to locate JIT
+// managers. A portion of this code is shown above. Each
+// RangeSection node in the tree describes a range of addresses
+// managed by the JitMan. These addresses are just being used as
+// values, not to dereference through, so there are not DPTRs. When
+// searching the range tree for an address the address used in the
+// search must be a target address as that's what values are kept in
+// the RangeSections. In the code shown above, currentPC must be a
+// target address as the RangeSections in the tree are all target
+// addresses. Use dac_cast<TADDR> to retrieve the target address
+// of a ?PTR, as well as to convert a host address to the
+// target address used to retrieve that particular instance. Do not
+// use dac_cast with any raw target pointer types (such as BYTE*).
+//
+// 2. Any time an address is modified, such as by address arithmetic,
+// the arithmetic must be performed on the target address.
+//
+// When a host instance is created it is created for the type in use.
+// There is no particular relation to any other instance, so address
+// arithmetic cannot be used to get from one instance to any other
+// part of memory. For example
+// char* Func(Class* cls)
+// {
+// // String follows the basic Class data.
+// return (char*)(cls + 1);
+// }
+// does not work with external access because the Class* used would
+// have retrieved only a Class worth of data. There is no string
+// following the host instance. Instead, this code should use
+// dac_cast<TADDR> to get the target address of the Class
+// instance, add sizeof(*cls) and then create a new ?PTR to access
+// the desired data. Note that the newly retrieved data will not
+// be contiguous with the Class instance, so address arithmetic
+// will still not work.
+//
+// Previous Code:
+//
+// BOOL IsTarget(LPVOID ip)
+// {
+// StubCallInstrs* pStubCallInstrs = GetStubCallInstrs();
+//
+// if (ip == (LPVOID) &(pStubCallInstrs->m_op))
+// {
+// return TRUE;
+// }
+//
+// Modified Code:
+//
+// BOOL IsTarget(LPVOID ip)
+// {
+// StubCallInstrs* pStubCallInstrs = GetStubCallInstrs();
+//
+// if ((TADDR)ip == dac_cast<TADDR>(pStubCallInstrs) +
+// (TADDR)offsetof(StubCallInstrs, m_op))
+// {
+// return TRUE;
+// }
+//
+// The parameter ip is a target address, so the host pStubCallInstrs
+// cannot be used to derive an address from. The member & reference
+// has to be replaced with a conversion from host to target address
+// followed by explicit offsetting for the field.
+//
+// PTR_HOST_MEMBER_TADDR is a convenience macro that encapsulates
+// these two operations, so the above code could also be:
+//
+// if ((TADDR)ip ==
+// PTR_HOST_MEMBER_TADDR(StubCallInstrs, pStubCallInstrs, m_op))
+//
+// 3. Any time the amount of memory referenced through an address
+// changes, such as by casting to a different type, a new ?PTR
+// must be created.
+//
+// Host instances are created and stored based on both the target
+// address and size of access. The access code has no way of knowing
+// all possible ways that data will be retrieved for a given address
+// so if code changes the way it accesses through an address a new
+// ?PTR must be used, which may lead to a difference instance and
+// different host address. This means that pointer identity does not hold
+// across casts, so code like
+// Class* cls = PTR_Class(addr);
+// Class2* cls2 = PTR_Class2(addr);
+// return cls == cls2;
+// will fail because the host-side instances have no relation to each
+// other. That isn't a problem, since by rule #1 you shouldn't be
+// relying on specific host address values.
+//
+// Previous Code:
+//
+// return (ArrayClass *) m_pMethTab->GetClass();
+//
+// Modified Code:
+//
+// return PTR_ArrayClass(m_pMethTab->GetClass());
+//
+// The ?PTR templates have an implicit conversion from a host pointer
+// to a target address, so the cast above constructs a new
+// PTR_ArrayClass by implicitly converting the host pointer result
+// from GetClass() to its target address and using that as the address
+// of the new PTR_ArrayClass. As mentioned, the actual host-side
+// pointer values may not be the same.
+//
+// Host pointer identity can be assumed as long as the type of access
+// is the same. In the example above, if both accesses were of type
+// Class then the host pointer will be the same, so it is safe to
+// retrieve the target address of an instance and then later get
+// a new host pointer for the target address using the same type as
+// the host pointer in that case will be the same. This is enabled
+// by caching all of the retrieved host instances. This cache is searched
+// by the addr:size pair and when there's a match the existing instance
+// is reused. This increases performance and also allows simple
+// pointer identity to hold. It does mean that host memory grows
+// in proportion to the amount of target memory being referenced,
+// so retrieving extraneous data should be avoided.
+// The host-side data cache grows until the Flush() method is called,
+// at which point all host-side data is discarded. No host
+// instance pointers should be held across a Flush().
+//
+// Accessing into an object can lead to some unusual behavior. For
+// example, the SList class relies on objects to contain an SLink
+// instance that it uses for list maintenance. This SLink can be
+// embedded anywhere in the larger object. The SList access is always
+// purely to an SLink, so when using the access layer it will only
+// retrieve an SLink's worth of data. The SList template will then
+// do some address arithmetic to determine the start of the real
+// object and cast the resulting pointer to the final object type.
+// When using the access layer this results in a new ?PTR being
+// created and used, so a new instance will result. The internal
+// SLink instance will have no relation to the new object instance
+// even though in target address terms one is embedded in the other.
+// The assumption of data stability means that this won't cause
+// a problem, but care must be taken with the address arithmetic,
+// as layed out in rules #2 and #3.
+//
+// 4. Global address references cannot be used. Any reference to a
+// global piece of code or data, such as a function address, global
+// variable or class static variable, must be changed.
+//
+// The external access code may load at a different base address than
+// the target process code. Global addresses are therefore not
+// meaningful and must be replaced with something else. There isn't
+// a single solution, so replacements must be done on a case-by-case
+// basis.
+//
+// The simplest case is a global or class static variable. All
+// declarations must be replaced with a special declaration that
+// compiles into a modified accessor template value when compiled for
+// external data access. Uses of the variable automatically are fixed
+// up by the template instance. Note that assignment to the global
+// must be independently ifdef'ed as the external access layer should
+// not make any modifications.
+//
+// Macros allow for simple declaration of a class static and global
+// values that compile into an appropriate templated value.
+//
+// Previous Code:
+//
+// static RangeSection* m_RangeTree;
+// RangeSection* ExecutionManager::m_RangeTree;
+//
+// extern ThreadStore* g_pThreadStore;
+// ThreadStore* g_pThreadStore = &StaticStore;
+// class SystemDomain : public BaseDomain {
+// ...
+// ArrayListStatic m_appDomainIndexList;
+// ...
+// }
+//
+// SystemDomain::m_appDomainIndexList;
+//
+// extern DWORD gThreadTLSIndex;
+//
+// DWORD gThreadTLSIndex = TLS_OUT_OF_INDEXES;
+//
+// Modified Code:
+//
+// typedef DPTR(RangeSection) PTR_RangeSection;
+// SPTR_DECL(RangeSection, m_RangeTree);
+// SPTR_IMPL(RangeSection, ExecutionManager, m_RangeTree);
+//
+// typedef DPTR(ThreadStore) PTR_ThreadStore
+// GPTR_DECL(ThreadStore, g_pThreadStore);
+// GPTR_IMPL_INIT(ThreadStore, g_pThreadStore, &StaticStore);
+//
+// class SystemDomain : public BaseDomain {
+// ...
+// SVAL_DECL(ArrayListStatic; m_appDomainIndexList);
+// ...
+// }
+//
+// SVAL_IMPL(ArrayListStatic, SystemDomain, m_appDomainIndexList);
+//
+// GVAL_DECL(DWORD, gThreadTLSIndex);
+//
+// GVAL_IMPL_INIT(DWORD, gThreadTLSIndex, TLS_OUT_OF_INDEXES);
+//
+// When declaring the variable, the first argument declares the
+// variable's type and the second argument declares the variable's
+// name. When defining the variable the arguments are similar, with
+// an extra class name parameter for the static class variable case.
+// If an initializer is needed the IMPL_INIT macro should be used.
+//
+// Things get slightly more complicated when declaring an embedded
+// array. In this case the data element is not a single element and
+// therefore cannot be represented by a ?PTR. In the case of a global
+// array, you should use the GARY_DECL and GARY_IMPL macros.
+// We durrently have no support for declaring static array data members
+// or initialized arrays. Array data members that are dynamically allocated
+// need to be treated as pointer members. To reference individual elements
+// you must use pointer arithmetic (see rule 2 above). An array declared
+// as a local variable within a function does not need to be DACized.
+//
+//
+// All uses of ?VAL_DECL must have a corresponding entry given in the
+// DacGlobals structure in src\inc\dacvars.h. For SVAL_DECL the entry
+// is class__name. For GVAL_DECL the entry is dac__name. You must add
+// these entries in dacvars.h using the DEFINE_DACVAR macro. Note that
+// these entries also are used for dumping memory in mini dumps and
+// heap dumps. If it's not appropriate to dump a variable, (e.g.,
+// it's an array or some other value that is not important to have
+// in a minidump) a second macro, DEFINE_DACVAR_NO_DUMP, will allow
+// you to make the required entry in the DacGlobals structure without
+// dumping its value.
+//
+// For convenience, here is a list of the various variable declaration and
+// initialization macros:
+// SVAL_DECL(type, name) static non-pointer data class MyClass
+// member declared within {
+// the class declaration // static int i;
+// SVAL_DECL(int, i);
+// }
+//
+// SVAL_IMPL(type, cls, name) static non-pointer data // int MyClass::i;
+// member defined outside SVAL_IMPL(int, MyClass, i);
+// the class declaration
+//
+// SVAL_IMPL_INIT(type, cls, static non-pointer data // int MyClass::i = 0;
+// name, val) member defined and SVAL_IMPL_INIT(int, MyClass, i, 0);
+// initialized outside the
+// class declaration
+// ------------------------------------------------------------------------------------------------
+// SPTR_DECL(type, name) static pointer data class MyClass
+// member declared within {
+// the class declaration // static int * pInt;
+// SPTR_DECL(int, pInt);
+// }
+//
+// SPTR_IMPL(type, cls, name) static pointer data // int * MyClass::pInt;
+// member defined outside SPTR_IMPL(int, MyClass, pInt);
+// the class declaration
+//
+// SPTR_IMPL_INIT(type, cls, static pointer data // int * MyClass::pInt = NULL;
+// name, val) member defined and SPTR_IMPL_INIT(int, MyClass, pInt, NULL);
+// initialized outside the
+// class declaration
+// ------------------------------------------------------------------------------------------------
+// GVAL_DECL(type, name) extern declaration of // extern int g_i
+// global non-pointer GVAL_DECL(int, g_i);
+// variable
+//
+// GVAL_IMPL(type, name) declaration of a // int g_i
+// global non-pointer GVAL_IMPL(int, g_i);
+// variable
+//
+// GVAL_IMPL_INIT (type, declaration and // int g_i = 0;
+// name, initialization of a GVAL_IMPL_INIT(int, g_i, 0);
+// val) global non-pointer
+// variable
+// ****Note****
+// If you use GVAL_? to declare a global variable of a structured type and you need to
+// access a member of the type, you cannot use the dot operator. Instead, you must take the
+// address of the variable and use the arrow operator. For example:
+// struct
+// {
+// int x;
+// char ch;
+// } MyStruct;
+// GVAL_IMPL(MyStruct, g_myStruct);
+// int i = (&g_myStruct)->x;
+// ------------------------------------------------------------------------------------------------
+// GPTR_DECL(type, name) extern declaration of // extern int * g_pInt
+// global pointer GPTR_DECL(int, g_pInt);
+// variable
+//
+// GPTR_IMPL(type, name) declaration of a // int * g_pInt
+// global pointer GPTR_IMPL(int, g_pInt);
+// variable
+//
+// GPTR_IMPL_INIT (type, declaration and // int * g_pInt = 0;
+// name, initialization of a GPTR_IMPL_INIT(int, g_pInt, NULL);
+// val) global pointer
+// variable
+// ------------------------------------------------------------------------------------------------
+// GARY_DECL(type, name) extern declaration of // extern int g_rgIntList[MAX_ELEMENTS];
+// a global array GPTR_DECL(int, g_rgIntList, MAX_ELEMENTS);
+// variable
+//
+// GARY_IMPL(type, name) declaration of a // int g_rgIntList[MAX_ELEMENTS];
+// global pointer GPTR_IMPL(int, g_rgIntList, MAX_ELEMENTS);
+// variable
+//
+//
+// Certain pieces of code, such as the stack walker, rely on identifying
+// an object from its vtable address. As the target vtable addresses
+// do not necessarily correspond to the vtables used in the host, these
+// references must be translated. The access layer maintains translation
+// tables for all classes used with VPTR and can return the target
+// vtable pointer for any host vtable in the known list of VPTR classes.
+//
+// ----- Errors:
+//
+// All errors in the access layer are reported via exceptions. The
+// formal access layer methods catch all such exceptions and turn
+// them into the appropriate error, so this generally isn't visible
+// to users of the access layer.
+//
+// ----- DPTR Declaration:
+//
+// Create a typedef for the type with typedef DPTR(type) PTR_type;
+// Replace type* with PTR_type.
+//
+// ----- VPTR Declaration:
+//
+// VPTR can only be used on classes that have a single vtable
+// pointer at the beginning of the object. This should be true
+// for a normal single-inheritance object.
+//
+// All of the classes that may be instantiated need to be identified
+// and marked. In the base class declaration add either
+// VPTR_BASE_VTABLE_CLASS if the class is abstract or
+// VPTR_BASE_CONCRETE_VTABLE_CLASS if the class is concrete. In each
+// derived class add VPTR_VTABLE_CLASS. If you end up with compile or
+// link errors for an unresolved method called VPtrSize you missed a
+// derived class declaration.
+//
+// As described above, dac can only handle classes with a single
+// vtable. However, there's a special case for multiple inheritance
+// situations when only one of the classes is needed for dac. If
+// the base class needed is the first class in the derived class's
+// layout then it can be used with dac via using the VPTR_MULTI_CLASS
+// macros. Use with extreme care.
+//
+// All classes to be instantiated must be listed in src\inc\vptr_list.h.
+//
+// Create a typedef for the type with typedef VPTR(type) PTR_type;
+// When using a VPTR, replace Class* with PTR_Class.
+//
+// ----- Specific Macros:
+//
+// PTR_TO_TADDR(ptr)
+// Retrieves the raw target address for a ?PTR.
+// See code:dac_cast for the preferred alternative
+//
+// PTR_HOST_TO_TADDR(host)
+// Given a host address of an instance produced by a ?PTR reference,
+// return the original target address. The host address must
+// be an exact match for an instance.
+// See code:dac_cast for the preferred alternative
+//
+// PTR_HOST_INT_TO_TADDR(host)
+// Given a host address which resides somewhere within an instance
+// produced by a ?PTR reference (a host interior pointer) return the
+// corresponding target address. This is useful for evaluating
+// relative pointers (e.g. RelativePointer<T>) where calculating the
+// target address requires knowledge of the target address of the
+// relative pointer field itself. This lookup is slower than that for
+// a non-interior host pointer so use it sparingly.
+//
+// VPTR_HOST_VTABLE_TO_TADDR(host)
+// Given the host vtable pointer for a known VPTR class, return
+// the target vtable pointer.
+//
+// PTR_HOST_MEMBER_TADDR(type, host, memb)
+// Retrieves the target address of a host instance pointer and
+// offsets it by the given member's offset within the type.
+//
+// PTR_HOST_INT_MEMBER_TADDR(type, host, memb)
+// As above but will work for interior host pointers (see the
+// description of PTR_HOST_INT_TO_TADDR for an explanation of host
+// interior pointers).
+//
+// PTR_READ(addr, size)
+// Reads a block of memory from the target and returns a host
+// pointer for it. Useful for reading blocks of data from the target
+// whose size is only known at runtime, such as raw code for a jitted
+// method. If the data being read is actually an object, use SPTR
+// instead to get better type semantics.
+//
+// DAC_EMPTY()
+// DAC_EMPTY_ERR()
+// DAC_EMPTY_RET(retVal)
+// DAC_UNEXPECTED()
+// Provides an empty method implementation when compiled
+// for DACCESS_COMPILE. For example, use to stub out methods needed
+// for vtable entries but otherwise unused.
+//
+// These macros are designed to turn into normal code when compiled
+// without DACCESS_COMPILE.
+//
+//*****************************************************************************
+
+
+#ifndef __daccess_h__
+#define __daccess_h__
+
+#include <stdint.h>
+
+#include "switches.h"
+#include "safemath.h"
+#include "corerror.h"
+
+#ifndef __in
+#include <specstrings.h>
+#endif
+
+#define DACCESS_TABLE_RESOURCE "COREXTERNALDATAACCESSRESOURCE"
+
+#ifdef PAL_STDCPP_COMPAT
+#include <type_traits>
+#else
+#include "clr_std/type_traits"
+#include "crosscomp.h"
+#endif
+
+// Information stored in the DAC table of interest to the DAC implementation
+// Note that this information is shared between all instantiations of ClrDataAccess, so initialize
+// it just once in code:ClrDataAccess.GetDacGlobals (rather than use fields in ClrDataAccess);
+struct DacTableInfo
+{
+ // On Windows, the first DWORD is the 32-bit timestamp read out of the runtime dll's debug directory.
+ // The remaining 3 DWORDS must all be 0.
+ // On Mac, this is the 16-byte UUID of the runtime dll.
+ // It is used to validate that mscorwks is the same version as mscordacwks
+ DWORD dwID0;
+ DWORD dwID1;
+ DWORD dwID2;
+ DWORD dwID3;
+};
+
+// The header of the DAC table. This includes the number of globals, the number of vptrs, and
+// the DacTableInfo structure. We need the DacTableInfo and DacTableHeader structs outside
+// of a DACCESS_COMPILE since soshost walks the Dac table headers to find the UUID of CoreCLR
+// in the target process.
+struct DacTableHeader
+{
+ ULONG numGlobals;
+ ULONG numVptrs;
+ DacTableInfo info;
+};
+
+//
+// This version of things wraps pointer access in
+// templates which understand how to retrieve data
+// through an access layer. In this case no assumptions
+// can be made that the current compilation processor or
+// pointer types match the target's processor or pointer types.
+//
+
+// Define TADDR as a non-pointer value so use of it as a pointer
+// will not work properly. Define it as unsigned so
+// pointer comparisons aren't affected by sign.
+// This requires special casting to ULONG64 to sign-extend if necessary.
+typedef ULONG_PTR TADDR;
+
+// TSIZE_T used for counts or ranges that need to span the size of a
+// target pointer. For cross-plat, this may be different than SIZE_T
+// which reflects the host pointer size.
+typedef SIZE_T TSIZE_T;
+
+
+//
+// The following table contains all the global information that data access needs to begin
+// operation. All of the values stored here are RVAs. DacGlobalBase() returns the current
+// base address to combine with to get a full target address.
+//
+
+typedef struct _DacGlobals
+{
+#ifdef FEATURE_PAL
+ static void Initialize();
+ void InitializeEntries(TADDR baseAddress);
+#ifdef FEATURE_SVR_GC
+ void InitializeSVREntries(TADDR baseAddress);
+#endif // FEATURE_SVR_GC
+#endif // FEATURE_PAL
+
+// These will define all of the dac related mscorwks static and global variables
+#define DEFINE_DACVAR(id_type, size, id, var) id_type id;
+#define DEFINE_DACVAR_SVR(id_type, size, id, var) id_type id;
+#define DEFINE_DACVAR_NO_DUMP(id_type, size, id, var) id_type id;
+#include "dacvars.h"
+
+ // Global functions.
+ ULONG fn__ThreadpoolMgr__AsyncTimerCallbackCompletion;
+ ULONG fn__DACNotifyCompilationFinished;
+ ULONG fn__ThePreStub;
+ ULONG fn__ThePreStubPatchLabel;
+ ULONG fn__PrecodeFixupThunk;
+ ULONG fn__StubDispatchFixupStub;
+ ULONG fn__StubDispatchFixupPatchLabel;;
+#ifdef FEATURE_COMINTEROP
+ ULONG fn__Unknown_AddRef;
+ ULONG fn__Unknown_AddRefSpecial;
+ ULONG fn__Unknown_AddRefInner;
+#endif
+
+ // Vtable pointer values for all classes that must
+ // be instanted using vtable pointers as the identity.
+#define VPTR_CLASS(name) ULONG name##__vtAddr;
+#define VPTR_MULTI_CLASS(name, keyBase) ULONG name##__##keyBase##__mvtAddr;
+#include <vptr_list.h>
+#undef VPTR_CLASS
+#undef VPTR_MULTI_CLASS
+} DacGlobals;
+
+#ifdef DACCESS_COMPILE
+
+extern DacTableInfo g_dacTableInfo;
+extern DacGlobals g_dacGlobals;
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// These two functions are largely just for marking code
+// that is not fully converted. DacWarning prints a debug
+// message, while DacNotImpl throws a not-implemented exception.
+void __cdecl DacWarning(__in __in_z char* format, ...);
+void DacNotImpl(void);
+
+void DacError(HRESULT err);
+void DECLSPEC_NORETURN DacError_NoRet(HRESULT err);
+TADDR DacGlobalBase(void);
+HRESULT DacReadAll(TADDR addr, PVOID buffer, ULONG32 size, bool throwEx);
+HRESULT DacWriteAll(TADDR addr, PVOID buffer, ULONG32 size, bool throwEx);
+HRESULT DacAllocVirtual(TADDR addr, ULONG32 size,
+ ULONG32 typeFlags, ULONG32 protectFlags,
+ bool throwEx, TADDR* mem);
+HRESULT DacFreeVirtual(TADDR mem, ULONG32 size, ULONG32 typeFlags,
+ bool throwEx);
+PVOID DacInstantiateTypeByAddress(TADDR addr, ULONG32 size, bool throwEx);
+PVOID DacInstantiateTypeByAddressNoReport(TADDR addr, ULONG32 size, bool throwEx);
+PVOID DacInstantiateClassByVTable(TADDR addr, ULONG32 minSize, bool throwEx);
+
+// Copy a null-terminated ascii or unicode string from the target to the host.
+// Note that most of the work here is to find the null terminator. If you know the exact length,
+// then you can also just call DacInstantiateTypebyAddress.
+PSTR DacInstantiateStringA(TADDR addr, ULONG32 maxChars, bool throwEx);
+PWSTR DacInstantiateStringW(TADDR addr, ULONG32 maxChars, bool throwEx);
+
+TADDR DacGetTargetAddrForHostAddr(LPCVOID ptr, bool throwEx);
+TADDR DacGetTargetAddrForHostInteriorAddr(LPCVOID ptr, bool throwEx);
+TADDR DacGetTargetVtForHostVt(LPCVOID vtHost, bool throwEx);
+PWSTR DacGetVtNameW(TADDR targetVtable);
+
+// Report a region of memory to the debugger
+bool DacEnumMemoryRegion(TADDR addr, TSIZE_T size, bool fExpectSuccess = true);
+
+// Report a region of memory to the debugger
+bool DacUpdateMemoryRegion(TADDR addr, TSIZE_T bufferSize, BYTE* buffer);
+
+HRESULT DacWriteHostInstance(PVOID host, bool throwEx);
+
+// This is meant to mimic the RethrowTerminalExceptions/
+// SwallowAllExceptions/RethrowTransientExceptions macros to allow minidump
+// gathering cancelation for details see
+// code:ClrDataAccess.EnumMemoryRegionsWrapper
+
+// This is usable in EX_TRY exactly how RethrowTerminalExceptions et cetera
+#define RethrowCancelExceptions \
+ if (GET_EXCEPTION()->GetHR() == COR_E_OPERATIONCANCELED) \
+ { \
+ EX_RETHROW; \
+ }
+
+// Occasionally it's necessary to allocate some host memory for
+// instance data that's created on the fly and so doesn't directly
+// correspond to target memory. These are held and freed on flush
+// like other instances but can't be looked up by address.
+PVOID DacAllocHostOnlyInstance(ULONG32 size, bool throwEx);
+
+// Determines whether ASSERTs should be raised when inconsistencies in the target are detected
+bool DacTargetConsistencyAssertsEnabled();
+
+// Host instances can be marked as they are enumerated in
+// order to break cycles. This function returns true if
+// the instance is already marked, otherwise it marks the
+// instance and returns false.
+bool DacHostPtrHasEnumMark(LPCVOID host);
+
+// Determines if EnumMemoryRegions has been called on a method descriptor.
+// This helps perf for minidumps of apps with large managed stacks.
+bool DacHasMethodDescBeenEnumerated(LPCVOID pMD);
+
+// Sets a flag indicating that EnumMemoryRegions on a method desciptor
+// has been successfully called. The function returns true if
+// this flag had been previously set.
+bool DacSetMethodDescEnumerated(LPCVOID pMD);
+
+// Determines if a method descriptor is valid
+BOOL DacValidateMD(LPCVOID pMD);
+
+// Enumerate the instructions around a call site to help debugger stack walking heuristics
+void DacEnumCodeForStackwalk(TADDR taCallEnd);
+
+// Given the address and the size of a memory range which is stored in the buffer, replace all the patches
+// in the buffer with the real opcodes. This is especially important on X64 where the unwinder needs to
+// disassemble the native instructions.
+class MemoryRange;
+HRESULT DacReplacePatchesInHostMemory(MemoryRange range, PVOID pBuffer);
+
+//
+// Convenience macros for EnumMemoryRegions implementations.
+//
+
+// Enumerate the given host instance and return
+// true if the instance hasn't already been enumerated.
+#define DacEnumHostDPtrMem(host) \
+ (!DacHostPtrHasEnumMark(host) ? \
+ (DacEnumMemoryRegion(PTR_HOST_TO_TADDR(host), sizeof(*host)), \
+ true) : false)
+#define DacEnumHostSPtrMem(host, type) \
+ (!DacHostPtrHasEnumMark(host) ? \
+ (DacEnumMemoryRegion(PTR_HOST_TO_TADDR(host), \
+ type::DacSize(PTR_HOST_TO_TADDR(host))), \
+ true) : false)
+#define DacEnumHostVPtrMem(host) \
+ (!DacHostPtrHasEnumMark(host) ? \
+ (DacEnumMemoryRegion(PTR_HOST_TO_TADDR(host), (host)->VPtrSize()), \
+ true) : false)
+
+// Check enumeration of 'this' and return if this has already been
+// enumerated. Making this the first line of an object's EnumMemoryRegions
+// method will prevent cycles.
+#define DAC_CHECK_ENUM_THIS() \
+ if (DacHostPtrHasEnumMark(this)) return
+#define DAC_ENUM_DTHIS() \
+ if (!DacEnumHostDPtrMem(this)) return
+#define DAC_ENUM_STHIS(type) \
+ if (!DacEnumHostSPtrMem(this, type)) return
+#define DAC_ENUM_VTHIS() \
+ if (!DacEnumHostVPtrMem(this)) return
+
+#ifdef __cplusplus
+}
+class ReflectionModule;
+interface IMDInternalImport* DacGetMDImport(const class PEFile* peFile,
+ bool throwEx);
+interface IMDInternalImport* DacGetMDImport(const ReflectionModule* reflectionModule,
+ bool throwEx);
+
+int DacGetIlMethodSize(TADDR methAddr);
+struct COR_ILMETHOD* DacGetIlMethod(TADDR methAddr);
+#if defined(WIN64EXCEPTIONS)
+struct _UNWIND_INFO * DacGetUnwindInfo(TADDR taUnwindInfo);
+
+// virtually unwind a CONTEXT out-of-process
+struct _KNONVOLATILE_CONTEXT_POINTERS;
+BOOL DacUnwindStackFrame(T_CONTEXT * pContext, T_KNONVOLATILE_CONTEXT_POINTERS* pContextPointers);
+
+#if defined(FEATURE_PAL)
+// call back through data target to unwind out-of-process
+HRESULT DacVirtualUnwind(ULONG32 threadId, PCONTEXT context, PT_KNONVOLATILE_CONTEXT_POINTERS contextPointers);
+#endif // FEATURE_PAL
+#endif // _WIN64
+
+#ifdef FEATURE_MINIMETADATA_IN_TRIAGEDUMPS
+class SString;
+void DacMdCacheAddEEName(TADDR taEE, const SString& ssEEName);
+bool DacMdCacheGetEEName(TADDR taEE, SString & ssEEName);
+#endif // FEATURE_MINIMETADATA_IN_TRIAGEDUMPS
+
+//
+// Computes (taBase + (dwIndex * dwElementSize()), with overflow checks.
+//
+// Arguments:
+// taBase the base TADDR value
+// dwIndex the index of the offset
+// dwElementSize the size of each element (to multiply the offset by)
+//
+// Return value:
+// The resulting TADDR, or throws CORDB_E_TARGET_INCONSISTENT on overlow.
+//
+// Notes:
+// The idea here is that overflows during address arithmetic suggest that we're operating on corrupt
+// pointers. It helps to improve reliability to detect the cases we can (like overflow) and fail. Note
+// that this is just a heuristic, not a security measure. We can't trust target data regardless -
+// failing on overflow is just one easy case of corruption to detect. There is no need to use checked
+// arithmetic everywhere in the DAC infrastructure, this is intended just for the places most likely to
+// help catch bugs (eg. __DPtr::operator[]).
+//
+inline TADDR DacTAddrOffset( TADDR taBase, TSIZE_T dwIndex, TSIZE_T dwElementSize )
+{
+ ClrSafeInt<TADDR> t(taBase);
+ t += ClrSafeInt<TSIZE_T>(dwIndex) * ClrSafeInt<TSIZE_T>(dwElementSize);
+ if( t.IsOverflow() )
+ {
+ // Pointer arithmetic overflow - probably due to corrupt target data
+ DacError(CORDBG_E_TARGET_INCONSISTENT);
+ }
+ return t.Value();
+}
+
+
+// Base pointer wrapper which provides common behavior.
+class __TPtrBase
+{
+public:
+ __TPtrBase(void)
+ {
+ // Make uninitialized pointers obvious.
+ m_addr = (TADDR)-1;
+ }
+ __TPtrBase(TADDR addr)
+ {
+ m_addr = addr;
+ }
+
+ bool operator!() const
+ {
+ return m_addr == 0;
+ }
+ // We'd like to have an implicit conversion to bool here since the C++
+ // standard says all pointer types are implicitly converted to bool.
+ // Unfortunately, that would cause ambiguous overload errors for uses
+ // of operator== and operator!=. Instead callers will have to compare
+ // directly against NULL.
+
+ bool operator==(TADDR addr) const
+ {
+ return m_addr == addr;
+ }
+ bool operator!=(TADDR addr) const
+ {
+ return m_addr != addr;
+ }
+ bool operator<(TADDR addr) const
+ {
+ return m_addr < addr;
+ }
+ bool operator>(TADDR addr) const
+ {
+ return m_addr > addr;
+ }
+ bool operator<=(TADDR addr) const
+ {
+ return m_addr <= addr;
+ }
+ bool operator>=(TADDR addr) const
+ {
+ return m_addr >= addr;
+ }
+
+ TADDR GetAddr(void) const
+ {
+ return m_addr;
+ }
+ TADDR SetAddr(TADDR addr)
+ {
+ m_addr = addr;
+ return addr;
+ }
+
+protected:
+ TADDR m_addr;
+};
+
+// Pointer wrapper base class for various forms of normal data.
+// This has the common functionality between __DPtr and __ArrayDPtr.
+// The DPtrType type parameter is the actual derived type in use. This is necessary so that
+// inhereted functions preserve exact return types.
+template<typename type, typename DPtrType>
+class __DPtrBase : public __TPtrBase
+{
+public:
+ typedef type _Type;
+ typedef type* _Ptr;
+
+protected:
+ // Constructors
+ // All protected - this type should not be used directly - use one of the derived types instead.
+ __DPtrBase< type, DPtrType >(void) : __TPtrBase() {}
+ __DPtrBase< type, DPtrType >(TADDR addr) : __TPtrBase(addr) {}
+
+ explicit __DPtrBase< type, DPtrType >(__TPtrBase addr)
+ {
+ m_addr = addr.GetAddr();
+ }
+ explicit __DPtrBase< type, DPtrType >(type const * host)
+ {
+ m_addr = DacGetTargetAddrForHostAddr(host, true);
+ }
+
+public:
+ DPtrType& operator=(const __TPtrBase& ptr)
+ {
+ m_addr = ptr.GetAddr();
+ return DPtrType(m_addr);
+ }
+ DPtrType& operator=(TADDR addr)
+ {
+ m_addr = addr;
+ return DPtrType(m_addr);
+ }
+
+ type& operator*(void) const
+ {
+ return *(type*)DacInstantiateTypeByAddress(m_addr, sizeof(type), true);
+ }
+
+ bool operator==(const DPtrType& ptr) const
+ {
+ return m_addr == ptr.GetAddr();
+ }
+ bool operator==(TADDR addr) const
+ {
+ return m_addr == addr;
+ }
+ bool operator!=(const DPtrType& ptr) const
+ {
+ return !operator==(ptr);
+ }
+ bool operator!=(TADDR addr) const
+ {
+ return m_addr != addr;
+ }
+ bool operator<(const DPtrType& ptr) const
+ {
+ return m_addr < ptr.GetAddr();
+ }
+ bool operator>(const DPtrType& ptr) const
+ {
+ return m_addr > ptr.GetAddr();
+ }
+ bool operator<=(const DPtrType& ptr) const
+ {
+ return m_addr <= ptr.GetAddr();
+ }
+ bool operator>=(const DPtrType& ptr) const
+ {
+ return m_addr >= ptr.GetAddr();
+ }
+
+ // Array index operator
+ // we want an operator[] for all possible numeric types (rather than rely on
+ // implicit numeric conversions on the argument) to prevent ambiguity with
+ // DPtr's implicit conversion to type* and the built-in operator[].
+ // @dbgtodo : we could also use this technique to simplify other operators below.
+ template<typename indexType>
+ type& operator[](indexType index)
+ {
+ // Compute the address of the element.
+ TADDR elementAddr;
+ if( index >= 0 )
+ {
+ elementAddr = DacTAddrOffset(m_addr, index, sizeof(type));
+ }
+ else
+ {
+ // Don't bother trying to do overflow checking for negative indexes - they are rare compared to
+ // positive ones. ClrSafeInt doesn't support signed datatypes yet (although we should be able to add it
+ // pretty easily).
+ elementAddr = m_addr + index * sizeof(type);
+ }
+
+ // Marshal over a single instance and return a reference to it.
+ return *(type*) DacInstantiateTypeByAddress(elementAddr, sizeof(type), true);
+ }
+
+ template<typename indexType>
+ type const & operator[](indexType index) const
+ {
+ return (*const_cast<__DPtrBase*>(this))[index];
+ }
+
+ //-------------------------------------------------------------------------
+ // operator+
+
+ DPtrType operator+(unsigned short val)
+ {
+ return DPtrType(DacTAddrOffset(m_addr, val, sizeof(type)));
+ }
+ DPtrType operator+(short val)
+ {
+ return DPtrType(m_addr + val * sizeof(type));
+ }
+ // size_t is unsigned int on Win32, so we need
+ // to ifdef here to make sure the unsigned int
+ // and size_t overloads don't collide. size_t
+ // is marked __w64 so a simple unsigned int
+ // will not work on Win32, it has to be size_t.
+ DPtrType operator+(size_t val)
+ {
+ return DPtrType(DacTAddrOffset(m_addr, val, sizeof(type)));
+ }
+#if defined (_WIN64)
+ DPtrType operator+(unsigned int val)
+ {
+ return DPtrType(DacTAddrOffset(m_addr, val, sizeof(type)));
+ }
+#endif
+ DPtrType operator+(int val)
+ {
+ return DPtrType(m_addr + val * sizeof(type));
+ }
+ // Because of the size difference between long and int on non MS compilers,
+ // we only need to define these operators on Windows. These provide compatible
+ // overloads for DWORD addition operations.
+#ifdef _MSC_VER
+ DPtrType operator+(unsigned long val)
+ {
+ return DPtrType(DacTAddrOffset(m_addr, val, sizeof(type)));
+ }
+ DPtrType operator+(long val)
+ {
+ return DPtrType(m_addr + val * sizeof(type));
+ }
+#endif
+
+ //-------------------------------------------------------------------------
+ // operator-
+
+ DPtrType operator-(unsigned short val)
+ {
+ return DPtrType(m_addr - val * sizeof(type));
+ }
+ DPtrType operator-(short val)
+ {
+ return DPtrType(m_addr - val * sizeof(type));
+ }
+ // size_t is unsigned int on Win32, so we need
+ // to ifdef here to make sure the unsigned int
+ // and size_t overloads don't collide. size_t
+ // is marked __w64 so a simple unsigned int
+ // will not work on Win32, it has to be size_t.
+ DPtrType operator-(size_t val)
+ {
+ return DPtrType(m_addr - val * sizeof(type));
+ }
+#ifdef _WIN64
+ DPtrType operator-(unsigned int val)
+ {
+ return DPtrType(m_addr - val * sizeof(type));
+ }
+#endif
+ DPtrType operator-(int val)
+ {
+ return DPtrType(m_addr - val * sizeof(type));
+ }
+ // Because of the size difference between long and int on non MS compilers,
+ // we only need to define these operators on Windows. These provide compatible
+ // overloads for DWORD addition operations.
+#ifdef _MSC_VER // for now, everything else is 32 bit
+ DPtrType operator-(unsigned long val)
+ {
+ return DPtrType(m_addr - val * sizeof(type));
+ }
+ DPtrType operator-(long val)
+ {
+ return DPtrType(m_addr - val * sizeof(type));
+ }
+#endif
+ size_t operator-(const DPtrType& val)
+ {
+ return (m_addr - val.m_addr) / sizeof(type);
+ }
+
+ //-------------------------------------------------------------------------
+
+ DPtrType& operator+=(size_t val)
+ {
+ m_addr += val * sizeof(type);
+ return static_cast<DPtrType&>(*this);
+ }
+ DPtrType& operator-=(size_t val)
+ {
+ m_addr -= val * sizeof(type);
+ return static_cast<DPtrType&>(*this);
+ }
+
+ DPtrType& operator++()
+ {
+ m_addr += sizeof(type);
+ return static_cast<DPtrType&>(*this);
+ }
+ DPtrType& operator--()
+ {
+ m_addr -= sizeof(type);
+ return static_cast<DPtrType&>(*this);
+ }
+ DPtrType operator++(int postfix)
+ {
+ DPtrType orig = DPtrType(*this);
+ m_addr += sizeof(type);
+ return orig;
+ }
+ DPtrType operator--(int postfix)
+ {
+ DPtrType orig = DPtrType(*this);
+ m_addr -= sizeof(type);
+ return orig;
+ }
+
+ bool IsValid(void) const
+ {
+ return m_addr &&
+ DacInstantiateTypeByAddress(m_addr, sizeof(type),
+ false) != NULL;
+ }
+ void EnumMem(void) const
+ {
+ DacEnumMemoryRegion(m_addr, sizeof(type));
+ }
+};
+
+// forward declaration
+template<typename acc_type, typename store_type>
+class __GlobalPtr;
+
+// Pointer wrapper for objects which are just plain data
+// and need no special handling.
+template<typename type>
+class __DPtr : public __DPtrBase<type,__DPtr<type> >
+{
+public:
+ // constructors - all chain to __DPtrBase constructors
+ __DPtr< type >(void) : __DPtrBase<type,__DPtr<type> >() {}
+ __DPtr< type >(TADDR addr) : __DPtrBase<type,__DPtr<type> >(addr) {}
+
+ // construct const from non-const
+ typedef typename std::remove_const<type>::type mutable_type;
+ __DPtr< type >(__DPtr<mutable_type> const & rhs) : __DPtrBase<type,__DPtr<type> >(rhs.GetAddr()) {}
+
+ // construct from GlobalPtr
+ explicit __DPtr< type >(__GlobalPtr< type*, __DPtr< type > > globalPtr) :
+ __DPtrBase<type,__DPtr<type> >(globalPtr.GetAddr()) {}
+
+ explicit __DPtr< type >(__TPtrBase addr) : __DPtrBase<type,__DPtr<type> >(addr) {}
+ explicit __DPtr< type >(type const * host) : __DPtrBase<type,__DPtr<type> >(host) {}
+
+ operator type*() const
+ {
+ return (type*)DacInstantiateTypeByAddress(this->m_addr, sizeof(type), true);
+ }
+ type* operator->() const
+ {
+ return (type*)DacInstantiateTypeByAddress(this->m_addr, sizeof(type), true);
+ }
+};
+
+#define DPTR(type) __DPtr< type >
+
+// A restricted form of DPtr that doesn't have any conversions to pointer types.
+// This is useful for pointer types that almost always represent arrays, as opposed
+// to pointers to single instances (eg. PTR_BYTE). In these cases, allowing implicit
+// conversions to (for eg.) BYTE* would usually result in incorrect usage (eg. pointer
+// arithmetic and array indexing), since only a single instance has been marshalled to the host.
+// If you really must marshal a single instance (eg. converting T* to PTR_T is too painful for now),
+// then use code:DacUnsafeMarshalSingleElement so we can identify such unsafe code.
+template<typename type>
+class __ArrayDPtr : public __DPtrBase<type,__ArrayDPtr<type> >
+{
+public:
+ // constructors - all chain to __DPtrBase constructors
+ __ArrayDPtr< type >(void) : __DPtrBase<type,__ArrayDPtr<type> >() {}
+ __ArrayDPtr< type >(TADDR addr) : __DPtrBase<type,__ArrayDPtr<type> >(addr) {}
+
+ // construct const from non-const
+ typedef typename std::remove_const<type>::type mutable_type;
+ __ArrayDPtr< type >(__ArrayDPtr<mutable_type> const & rhs) : __DPtrBase<type,__ArrayDPtr<type> >(rhs.GetAddr()) {}
+
+ explicit __ArrayDPtr< type >(__TPtrBase addr) : __DPtrBase<type,__ArrayDPtr<type> >(addr) {}
+
+ // Note that there is also no explicit constructor from host instances (type*).
+ // Going this direction is less problematic, but often still represents risky coding.
+};
+
+#define ArrayDPTR(type) __ArrayDPtr< type >
+
+
+// Pointer wrapper for objects which are just plain data
+// but whose size is not the same as the base type size.
+// This can be used for prefetching data for arrays or
+// for cases where an object has a variable size.
+template<typename type>
+class __SPtr : public __TPtrBase
+{
+public:
+ typedef type _Type;
+ typedef type* _Ptr;
+
+ __SPtr< type >(void) : __TPtrBase() {}
+ __SPtr< type >(TADDR addr) : __TPtrBase(addr) {}
+ explicit __SPtr< type >(__TPtrBase addr)
+ {
+ m_addr = addr.GetAddr();
+ }
+ explicit __SPtr< type >(type* host)
+ {
+ m_addr = DacGetTargetAddrForHostAddr(host, true);
+ }
+
+ __SPtr< type >& operator=(const __TPtrBase& ptr)
+ {
+ m_addr = ptr.GetAddr();
+ return *this;
+ }
+ __SPtr< type >& operator=(TADDR addr)
+ {
+ m_addr = addr;
+ return *this;
+ }
+
+ operator type*() const
+ {
+ if (m_addr)
+ {
+ return (type*)DacInstantiateTypeByAddress(m_addr,
+ type::DacSize(m_addr),
+ true);
+ }
+ else
+ {
+ return (type*)NULL;
+ }
+ }
+ type* operator->() const
+ {
+ if (m_addr)
+ {
+ return (type*)DacInstantiateTypeByAddress(m_addr,
+ type::DacSize(m_addr),
+ true);
+ }
+ else
+ {
+ return (type*)NULL;
+ }
+ }
+ type& operator*(void) const
+ {
+ if (!m_addr)
+ {
+ DacError(E_INVALIDARG);
+ }
+
+ return *(type*)DacInstantiateTypeByAddress(m_addr,
+ type::DacSize(m_addr),
+ true);
+ }
+
+ bool IsValid(void) const
+ {
+ return m_addr &&
+ DacInstantiateTypeByAddress(m_addr, type::DacSize(m_addr),
+ false) != NULL;
+ }
+ void EnumMem(void) const
+ {
+ if (m_addr)
+ {
+ DacEnumMemoryRegion(m_addr, type::DacSize(m_addr));
+ }
+ }
+};
+
+#define SPTR(type) __SPtr< type >
+
+// Pointer wrapper for objects which have a single leading
+// vtable, such as objects in a single-inheritance tree.
+// The base class of all such trees must have use
+// VPTR_BASE_VTABLE_CLASS in their declaration and all
+// instantiable members of the tree must be listed in vptr_list.h.
+template<class type>
+class __VPtr : public __TPtrBase
+{
+public:
+ // VPtr::_Type has to be a pointer as
+ // often the type is an abstract class.
+ // This type is not expected to be used anyway.
+ typedef type* _Type;
+ typedef type* _Ptr;
+
+ __VPtr< type >(void) : __TPtrBase() {}
+ __VPtr< type >(TADDR addr) : __TPtrBase(addr) {}
+ explicit __VPtr< type >(__TPtrBase addr)
+ {
+ m_addr = addr.GetAddr();
+ }
+ explicit __VPtr< type >(type* host)
+ {
+ m_addr = DacGetTargetAddrForHostAddr(host, true);
+ }
+
+ __VPtr< type >& operator=(const __TPtrBase& ptr)
+ {
+ m_addr = ptr.GetAddr();
+ return *this;
+ }
+ __VPtr< type >& operator=(TADDR addr)
+ {
+ m_addr = addr;
+ return *this;
+ }
+
+ operator type*() const
+ {
+ return (type*)DacInstantiateClassByVTable(m_addr, sizeof(type), true);
+ }
+ type* operator->() const
+ {
+ return (type*)DacInstantiateClassByVTable(m_addr, sizeof(type), true);
+ }
+
+ bool operator==(const __VPtr< type >& ptr) const
+ {
+ return m_addr == ptr.m_addr;
+ }
+ bool operator==(TADDR addr) const
+ {
+ return m_addr == addr;
+ }
+ bool operator!=(const __VPtr< type >& ptr) const
+ {
+ return !operator==(ptr);
+ }
+ bool operator!=(TADDR addr) const
+ {
+ return m_addr != addr;
+ }
+
+ bool IsValid(void) const
+ {
+ return m_addr &&
+ DacInstantiateClassByVTable(m_addr, sizeof(type), false) != NULL;
+ }
+ void EnumMem(void) const
+ {
+ if (IsValid())
+ {
+ DacEnumMemoryRegion(m_addr, (operator->())->VPtrSize());
+ }
+ }
+};
+
+#define VPTR(type) __VPtr< type >
+
+// Pointer wrapper for 8-bit strings.
+template<typename type, ULONG32 maxChars = 32760>
+class __Str8Ptr : public __DPtr<char>
+{
+public:
+ typedef type _Type;
+ typedef type* _Ptr;
+
+ __Str8Ptr< type, maxChars >(void) : __DPtr<char>() {}
+ __Str8Ptr< type, maxChars >(TADDR addr) : __DPtr<char>(addr) {}
+ explicit __Str8Ptr< type, maxChars >(__TPtrBase addr)
+ {
+ m_addr = addr.GetAddr();
+ }
+ explicit __Str8Ptr< type, maxChars >(type* host)
+ {
+ m_addr = DacGetTargetAddrForHostAddr(host, true);
+ }
+
+ __Str8Ptr< type, maxChars >& operator=(const __TPtrBase& ptr)
+ {
+ m_addr = ptr.GetAddr();
+ return *this;
+ }
+ __Str8Ptr< type, maxChars >& operator=(TADDR addr)
+ {
+ m_addr = addr;
+ return *this;
+ }
+
+ operator type*() const
+ {
+ return (type*)DacInstantiateStringA(m_addr, maxChars, true);
+ }
+
+ bool IsValid(void) const
+ {
+ return m_addr &&
+ DacInstantiateStringA(m_addr, maxChars, false) != NULL;
+ }
+ void EnumMem(void) const
+ {
+ char* str = DacInstantiateStringA(m_addr, maxChars, false);
+ if (str)
+ {
+ DacEnumMemoryRegion(m_addr, strlen(str) + 1);
+ }
+ }
+};
+
+#define S8PTR(type) __Str8Ptr< type >
+#define S8PTRMAX(type, maxChars) __Str8Ptr< type, maxChars >
+
+// Pointer wrapper for 16-bit strings.
+template<typename type, ULONG32 maxChars = 32760>
+class __Str16Ptr : public __DPtr<WCHAR>
+{
+public:
+ typedef type _Type;
+ typedef type* _Ptr;
+
+ __Str16Ptr< type, maxChars >(void) : __DPtr<WCHAR>() {}
+ __Str16Ptr< type, maxChars >(TADDR addr) : __DPtr<WCHAR>(addr) {}
+ explicit __Str16Ptr< type, maxChars >(__TPtrBase addr)
+ {
+ m_addr = addr.GetAddr();
+ }
+ explicit __Str16Ptr< type, maxChars >(type* host)
+ {
+ m_addr = DacGetTargetAddrForHostAddr(host, true);
+ }
+
+ __Str16Ptr< type, maxChars >& operator=(const __TPtrBase& ptr)
+ {
+ m_addr = ptr.GetAddr();
+ return *this;
+ }
+ __Str16Ptr< type, maxChars >& operator=(TADDR addr)
+ {
+ m_addr = addr;
+ return *this;
+ }
+
+ operator type*() const
+ {
+ return (type*)DacInstantiateStringW(m_addr, maxChars, true);
+ }
+
+ bool IsValid(void) const
+ {
+ return m_addr &&
+ DacInstantiateStringW(m_addr, maxChars, false) != NULL;
+ }
+ void EnumMem(void) const
+ {
+ char* str = DacInstantiateStringW(m_addr, maxChars, false);
+ if (str)
+ {
+ DacEnumMemoryRegion(m_addr, strlen(str) + 1);
+ }
+ }
+};
+
+#define S16PTR(type) __Str16Ptr< type >
+#define S16PTRMAX(type, maxChars) __Str16Ptr< type, maxChars >
+
+template<typename type>
+class __GlobalVal
+{
+public:
+ __GlobalVal< type >(PULONG rvaPtr)
+ {
+ m_rvaPtr = rvaPtr;
+ }
+
+ operator type() const
+ {
+ return (type)*__DPtr< type >(DacGlobalBase() + *m_rvaPtr);
+ }
+
+ __DPtr< type > operator&() const
+ {
+ return __DPtr< type >(DacGlobalBase() + *m_rvaPtr);
+ }
+
+ // @dbgtodo dac support: This updates values in the host. This seems extremely dangerous
+ // to do silently. I'd prefer that a specific (searchable) write function
+ // was used. Try disabling this and see what fails...
+ __GlobalVal<type> & operator=(const type & val)
+ {
+ type* ptr = __DPtr< type >(DacGlobalBase() + *m_rvaPtr);
+ // Update the host copy;
+ *ptr = val;
+ // Write back to the target.
+ DacWriteHostInstance(ptr, true);
+ return *this;
+ }
+
+ bool IsValid(void) const
+ {
+ return __DPtr< type >(DacGlobalBase() + *m_rvaPtr).IsValid();
+ }
+ void EnumMem(void) const
+ {
+ TADDR p = DacGlobalBase() + *m_rvaPtr;
+ __DPtr< type >(p).EnumMem();
+ }
+
+private:
+ PULONG m_rvaPtr;
+};
+
+template<typename type, size_t size>
+class __GlobalArray
+{
+public:
+ __GlobalArray< type, size >(PULONG rvaPtr)
+ {
+ m_rvaPtr = rvaPtr;
+ }
+
+ __DPtr< type > operator&() const
+ {
+ return __DPtr< type >(DacGlobalBase() + *m_rvaPtr);
+ }
+
+ type& operator[](unsigned int index) const
+ {
+ return __DPtr< type >(DacGlobalBase() + *m_rvaPtr)[index];
+ }
+
+ bool IsValid(void) const
+ {
+ // Only validates the base pointer, not the full array range.
+ return __DPtr< type >(DacGlobalBase() + *m_rvaPtr).IsValid();
+ }
+ void EnumMem(void) const
+ {
+ DacEnumMemoryRegion(DacGlobalBase() + *m_rvaPtr, sizeof(type) * size);
+ }
+
+private:
+ PULONG m_rvaPtr;
+};
+
+template<typename acc_type, typename store_type>
+class __GlobalPtr
+{
+public:
+ __GlobalPtr< acc_type, store_type >(PULONG rvaPtr)
+ {
+ m_rvaPtr = rvaPtr;
+ }
+
+ __DPtr< store_type > operator&() const
+ {
+ return __DPtr< store_type >(DacGlobalBase() + *m_rvaPtr);
+ }
+
+ store_type & operator=(store_type & val)
+ {
+ store_type* ptr = __DPtr< store_type >(DacGlobalBase() + *m_rvaPtr);
+ // Update the host copy;
+ *ptr = val;
+ // Write back to the target.
+ DacWriteHostInstance(ptr, true);
+ return val;
+ }
+
+ acc_type operator->() const
+ {
+ return (acc_type)*__DPtr< store_type >(DacGlobalBase() + *m_rvaPtr);
+ }
+ operator acc_type() const
+ {
+ return (acc_type)*__DPtr< store_type >(DacGlobalBase() + *m_rvaPtr);
+ }
+ operator store_type() const
+ {
+ return *__DPtr< store_type >(DacGlobalBase() + *m_rvaPtr);
+ }
+ bool operator!() const
+ {
+ return !*__DPtr< store_type >(DacGlobalBase() + *m_rvaPtr);
+ }
+
+ typename store_type::_Type& operator[](int index)
+ {
+ return (*__DPtr< store_type >(DacGlobalBase() + *m_rvaPtr))[index];
+ }
+
+ typename store_type::_Type& operator[](unsigned int index)
+ {
+ return (*__DPtr< store_type >(DacGlobalBase() + *m_rvaPtr))[index];
+ }
+
+ TADDR GetAddr() const
+ {
+ return (*__DPtr< store_type >(DacGlobalBase() + *m_rvaPtr)).GetAddr();
+ }
+
+ TADDR GetAddrRaw () const
+ {
+ return DacGlobalBase() + *m_rvaPtr;
+ }
+
+ // This is only testing the the pointer memory is available but does not verify
+ // the memory that it points to.
+ //
+ bool IsValidPtr(void) const
+ {
+ return __DPtr< store_type >(DacGlobalBase() + *m_rvaPtr).IsValid();
+ }
+
+ bool IsValid(void) const
+ {
+ return __DPtr< store_type >(DacGlobalBase() + *m_rvaPtr).IsValid() &&
+ (*__DPtr< store_type >(DacGlobalBase() + *m_rvaPtr)).IsValid();
+ }
+ void EnumMem(void) const
+ {
+ __DPtr< store_type > ptr(DacGlobalBase() + *m_rvaPtr);
+ ptr.EnumMem();
+ if (ptr.IsValid())
+ {
+ (*ptr).EnumMem();
+ }
+ }
+
+ PULONG m_rvaPtr;
+};
+
+template<typename acc_type, typename store_type>
+inline bool operator==(const __GlobalPtr<acc_type, store_type>& gptr,
+ acc_type host)
+{
+ return DacGetTargetAddrForHostAddr(host, true) ==
+ *__DPtr< TADDR >(DacGlobalBase() + *gptr.m_rvaPtr);
+}
+template<typename acc_type, typename store_type>
+inline bool operator!=(const __GlobalPtr<acc_type, store_type>& gptr,
+ acc_type host)
+{
+ return !operator==(gptr, host);
+}
+
+template<typename acc_type, typename store_type>
+inline bool operator==(acc_type host,
+ const __GlobalPtr<acc_type, store_type>& gptr)
+{
+ return DacGetTargetAddrForHostAddr(host, true) ==
+ *__DPtr< TADDR >(DacGlobalBase() + *gptr.m_rvaPtr);
+}
+template<typename acc_type, typename store_type>
+inline bool operator!=(acc_type host,
+ const __GlobalPtr<acc_type, store_type>& gptr)
+{
+ return !operator==(host, gptr);
+}
+
+
+//
+// __VoidPtr is a type that behaves like void* but for target pointers.
+// Behavior of PTR_VOID:
+// * has void* semantics. Will compile to void* in non-DAC builds (just like
+// other PTR types. Unlike TADDR, we want pointer semantics.
+// * NOT assignable from host pointer types or convertible to host pointer
+// types - ensures we can't confuse host and target pointers (we'll get
+// compiler errors if we try and cast between them).
+// * like void*, no pointer arithmetic or dereferencing is allowed
+// * like TADDR, can be used to construct any __DPtr / __VPtr instance
+// * representation is the same as a void* (for marshalling / casting)
+//
+// One way in which __VoidPtr is unlike void* is that it can't be cast to
+// pointer or integer types. On the one hand, this is a good thing as it forces
+// us to keep target pointers separate from other data types. On the other hand
+// in practice this means we have to use dac_cast<TADDR> in places where we used
+// to use a (TADDR) cast. Unfortunately C++ provides us no way to allow the
+// explicit cast to primitive types without also allowing implicit conversions.
+//
+// This is very similar in spirit to TADDR. The primary difference is that
+// PTR_VOID has pointer semantics, where TADDR has integer semantics. When
+// dacizing uses of void* to TADDR, casts must be inserted everywhere back to
+// pointer types. If we switch a use of TADDR to PTR_VOID, those casts in
+// DACCESS_COMPILE regions no longer compile (see above). Also, TADDR supports
+// pointer arithmetic, but that might not be necessary (could use PTR_BYTE
+// instead etc.). Ideally we'd probably have just one type for this purpose
+// (named TADDR but with the semantics of PTR_VOID), but outright conversion
+// would require too much work.
+//
+class __VoidPtr : public __TPtrBase
+{
+public:
+ __VoidPtr(void) : __TPtrBase() {}
+ __VoidPtr(TADDR addr) : __TPtrBase(addr) {}
+
+ // Note, unlike __DPtr, this ctor form is not explicit. We allow implicit
+ // conversions from any pointer type (just like for void*).
+ __VoidPtr(__TPtrBase addr)
+ {
+ m_addr = addr.GetAddr();
+ }
+
+ // Like TPtrBase, VoidPtrs can also be created impicitly from all GlobalPtrs
+ template<typename acc_type, typename store_type>
+ __VoidPtr(__GlobalPtr<acc_type, store_type> globalPtr)
+ {
+ m_addr = globalPtr.GetAddr();
+ }
+
+ // Note, unlike __DPtr, there is no explicit conversion from host pointer
+ // types. Since void* cannot be marshalled, there is no such thing as
+ // a void* DAC instance in the host.
+
+ // Also, we don't want an implicit conversion to TADDR because then the
+ // compiler will allow pointer arithmetic (which it wouldn't allow for
+ // void*). Instead, callers can use dac_cast<TADDR> if they want.
+
+ // Note, unlike __DPtr, any pointer type can be assigned to a __VoidPtr
+ // This is to mirror the assignability of any pointer type to a void*
+ __VoidPtr& operator=(const __TPtrBase& ptr)
+ {
+ m_addr = ptr.GetAddr();
+ return *this;
+ }
+ __VoidPtr& operator=(TADDR addr)
+ {
+ m_addr = addr;
+ return *this;
+ }
+
+ // note, no marshalling operators (type* conversion, operator ->, operator*)
+ // A void* can't be marshalled because we don't know how much to copy
+
+ // PTR_Void can be compared to any other pointer type (because conceptually,
+ // any other pointer type should be implicitly convertible to void*)
+ bool operator==(const __TPtrBase& ptr) const
+ {
+ return m_addr == ptr.GetAddr();
+ }
+ bool operator==(TADDR addr) const
+ {
+ return m_addr == addr;
+ }
+ bool operator!=(const __TPtrBase& ptr) const
+ {
+ return !operator==(ptr);
+ }
+ bool operator!=(TADDR addr) const
+ {
+ return m_addr != addr;
+ }
+ bool operator<(const __TPtrBase& ptr) const
+ {
+ return m_addr < ptr.GetAddr();
+ }
+ bool operator>(const __TPtrBase& ptr) const
+ {
+ return m_addr > ptr.GetAddr();
+ }
+ bool operator<=(const __TPtrBase& ptr) const
+ {
+ return m_addr <= ptr.GetAddr();
+ }
+ bool operator>=(const __TPtrBase& ptr) const
+ {
+ return m_addr >= ptr.GetAddr();
+ }
+};
+
+typedef __VoidPtr PTR_VOID;
+typedef DPTR(PTR_VOID) PTR_PTR_VOID;
+
+// For now we treat pointers to const and non-const void the same in DAC
+// builds. In general, DAC is read-only anyway and so there isn't a danger of
+// writing to these pointers. Also, the non-dac builds will ensure
+// const-correctness. However, if we wanted to support true void* / const void*
+// behavior, we could probably build the follow functionality by templating
+// __VoidPtr:
+// * A PTR_VOID would be implicitly convertable to PTR_CVOID
+// * An explicit coercion (ideally const_cast) would be required to convert a
+// PTR_CVOID to a PTR_VOID
+// * Similarily, an explicit coercion would be required to convert a cost PTR
+// type (eg. PTR_CBYTE) to a PTR_VOID.
+typedef __VoidPtr PTR_CVOID;
+
+
+// The special empty ctor declared here allows the whole
+// class hierarchy to be instantiated easily by the
+// external access code. The actual class body will be
+// read externally so no members should be initialized.
+
+//
+// VPTR_ANY_CLASS_METHODS - Defines the following methods for all VPTR classes
+//
+// VPtrSize
+// Returns the size of the dynamic type of the object (as opposed to sizeof
+// which is based only on the static type).
+//
+// VPtrHostVTable
+// Returns the address of the vtable for this type.
+// We create a temporary instance of this type in order to read it's vtable pointer
+// (at offset 0). For this temporary instance, we do not want to initialize any fields,
+// so we use the marshalling ctor. Since we didn't initialize any fields, we also don't
+// wan't to run the dtor (marshaled data structures don't normally expect their destructor
+// or non-DAC constructors to be called in DAC builds anyway). So, rather than create a
+// normal stack object, or put the object on the heap, we create the temporary object
+// on the stack using placement-new and alloca, and don't destruct it.
+//
+#define VPTR_ANY_CLASS_METHODS(name) \
+ virtual ULONG32 VPtrSize(void) { SUPPORTS_DAC; return sizeof(name); } \
+ static PVOID VPtrHostVTable() { \
+ void * pBuf = _alloca(sizeof(name)); \
+ name * dummy = new (pBuf) name((TADDR)0, (TADDR)0); \
+ return *((PVOID*)dummy); }
+
+#define VPTR_CLASS_METHODS(name) \
+ VPTR_ANY_CLASS_METHODS(name) \
+ static TADDR VPtrTargetVTable() { \
+ SUPPORTS_DAC; \
+ return DacGlobalBase() + g_dacGlobals.name##__vtAddr; }
+
+#define VPTR_MULTI_CLASS_METHODS(name, keyBase) \
+ VPTR_ANY_CLASS_METHODS(name) \
+ static TADDR VPtrTargetVTable() { \
+ SUPPORTS_DAC; \
+ return DacGlobalBase() + g_dacGlobals.name##__##keyBase##__mvtAddr; }
+
+#define VPTR_VTABLE_CLASS(name, base) \
+public: name(TADDR addr, TADDR vtAddr) : base(addr, vtAddr) {} \
+ VPTR_CLASS_METHODS(name)
+
+#define VPTR_VTABLE_CLASS_AND_CTOR(name, base) \
+ VPTR_VTABLE_CLASS(name, base)
+
+#define VPTR_MULTI_VTABLE_CLASS(name, base) \
+public: name(TADDR addr, TADDR vtAddr) : base(addr, vtAddr) {} \
+ VPTR_MULTI_CLASS_METHODS(name, base)
+
+// Used for base classes that can be instantiated directly.
+// The fake vfn is still used to force a vtable even when
+// all the normal vfns are ifdef'ed out.
+#define VPTR_BASE_CONCRETE_VTABLE_CLASS(name) \
+public: name(TADDR addr, TADDR vtAddr) {} \
+ VPTR_CLASS_METHODS(name)
+
+#define VPTR_BASE_CONCRETE_VTABLE_CLASS_NO_CTOR_BODY(name) \
+public: name(TADDR addr, TADDR vtAddr); \
+ VPTR_CLASS_METHODS(name)
+
+// The pure virtual method forces all derivations to use
+// VPTR_VTABLE_CLASS to compile.
+#define VPTR_BASE_VTABLE_CLASS(name) \
+public: name(TADDR addr, TADDR vtAddr) {} \
+ virtual ULONG32 VPtrSize(void) = 0;
+
+#define VPTR_BASE_VTABLE_CLASS_AND_CTOR(name) \
+ VPTR_BASE_VTABLE_CLASS(name)
+
+#define VPTR_BASE_VTABLE_CLASS_NO_CTOR_BODY(name) \
+public: name(TADDR addr, TADDR vtAddr); \
+ virtual ULONG32 VPtrSize(void) = 0;
+
+#define VPTR_ABSTRACT_VTABLE_CLASS(name, base) \
+public: name(TADDR addr, TADDR vtAddr) : base(addr, vtAddr) {}
+
+#define VPTR_ABSTRACT_VTABLE_CLASS_AND_CTOR(name, base) \
+ VPTR_ABSTRACT_VTABLE_CLASS(name, base)
+
+#define VPTR_ABSTRACT_VTABLE_CLASS_NO_CTOR_BODY(name, base) \
+public: name(TADDR addr, TADDR vtAddr);
+
+// helper macro to make the vtables unique for DAC
+#define VPTR_UNIQUE(unique)
+
+// Safe access for retrieving the target address of a PTR.
+#define PTR_TO_TADDR(ptr) ((ptr).GetAddr())
+
+#define GFN_TADDR(name) (DacGlobalBase() + g_dacGlobals.fn__ ## name)
+
+// ROTORTODO - g++ 3 doesn't like the use of the operator& in __GlobalVal
+// here. Putting GVAL_ADDR in to get things to compile while I discuss
+// this matter with the g++ authors.
+
+#define GVAL_ADDR(g) \
+ ((g).operator&())
+
+//
+// References to class static and global data.
+// These all need to be redirected through the global
+// data table.
+//
+
+#define _SPTR_DECL(acc_type, store_type, var) \
+ static __GlobalPtr< acc_type, store_type > var
+#define _SPTR_IMPL(acc_type, store_type, cls, var) \
+ __GlobalPtr< acc_type, store_type > cls::var(&g_dacGlobals.cls##__##var)
+#define _SPTR_IMPL_INIT(acc_type, store_type, cls, var, init) \
+ __GlobalPtr< acc_type, store_type > cls::var(&g_dacGlobals.cls##__##var)
+#define _SPTR_IMPL_NS(acc_type, store_type, ns, cls, var) \
+ __GlobalPtr< acc_type, store_type > cls::var(&g_dacGlobals.ns##__##cls##__##var)
+#define _SPTR_IMPL_NS_INIT(acc_type, store_type, ns, cls, var, init) \
+ __GlobalPtr< acc_type, store_type > cls::var(&g_dacGlobals.ns##__##cls##__##var)
+
+#define _GPTR_DECL(acc_type, store_type, var) \
+ extern __GlobalPtr< acc_type, store_type > var
+#define _GPTR_IMPL(acc_type, store_type, var) \
+ __GlobalPtr< acc_type, store_type > var(&g_dacGlobals.dac__##var)
+#define _GPTR_IMPL_INIT(acc_type, store_type, var, init) \
+ __GlobalPtr< acc_type, store_type > var(&g_dacGlobals.dac__##var)
+
+#define SVAL_DECL(type, var) \
+ static __GlobalVal< type > var
+#define SVAL_IMPL(type, cls, var) \
+ __GlobalVal< type > cls::var(&g_dacGlobals.cls##__##var)
+#define SVAL_IMPL_INIT(type, cls, var, init) \
+ __GlobalVal< type > cls::var(&g_dacGlobals.cls##__##var)
+#define SVAL_IMPL_NS(type, ns, cls, var) \
+ __GlobalVal< type > cls::var(&g_dacGlobals.ns##__##cls##__##var)
+#define SVAL_IMPL_NS_INIT(type, ns, cls, var, init) \
+ __GlobalVal< type > cls::var(&g_dacGlobals.ns##__##cls##__##var)
+
+#define GVAL_DECL(type, var) \
+ extern __GlobalVal< type > var
+#define GVAL_IMPL(type, var) \
+ __GlobalVal< type > var(&g_dacGlobals.dac__##var)
+#define GVAL_IMPL_INIT(type, var, init) \
+ __GlobalVal< type > var(&g_dacGlobals.dac__##var)
+
+#define GARY_DECL(type, var, size) \
+ extern __GlobalArray< type, size > var
+#define GARY_IMPL(type, var, size) \
+ __GlobalArray< type, size > var(&g_dacGlobals.dac__##var)
+
+// Translation from a host pointer back to the target address
+// that was used to retrieve the data for the host pointer.
+#define PTR_HOST_TO_TADDR(host) DacGetTargetAddrForHostAddr(host, true)
+// Translation from a host interior pointer back to the corresponding
+// target address. The host address must reside within a previously
+// retrieved instance.
+#define PTR_HOST_INT_TO_TADDR(host) DacGetTargetAddrForHostInteriorAddr(host, true)
+// Translation from a host vtable pointer to a target vtable pointer.
+#define VPTR_HOST_VTABLE_TO_TADDR(host) DacGetTargetVtForHostVt(host, true)
+
+// Construct a pointer to a member of the given type.
+#define PTR_HOST_MEMBER_TADDR(type, host, memb) \
+ (PTR_HOST_TO_TADDR(host) + (TADDR)offsetof(type, memb))
+
+// Construct a pointer to a member of the given type given an interior
+// host address.
+#define PTR_HOST_INT_MEMBER_TADDR(type, host, memb) \
+ (PTR_HOST_INT_TO_TADDR(host) + (TADDR)offsetof(type, memb))
+
+#define PTR_TO_MEMBER_TADDR(type, ptr, memb) \
+ (PTR_TO_TADDR(ptr) + (TADDR)offsetof(type, memb))
+
+// Constructs an arbitrary data instance for a piece of
+// memory in the target.
+#define PTR_READ(addr, size) \
+ DacInstantiateTypeByAddress(addr, size, true)
+
+// This value is used to intiailize target pointers to NULL. We want this to be TADDR type
+// (as opposed to, say, __TPtrBase) so that it can be used in the non-explicit ctor overloads,
+// eg. as an argument default value.
+// We can't always just use NULL because that's 0 which (in C++) can be any integer or pointer
+// type (causing an ambiguous overload compiler error when used in explicit ctor forms).
+#define PTR_NULL ((TADDR)0)
+
+// Provides an empty method implementation when compiled
+// for DACCESS_COMPILE. For example, use to stub out methods needed
+// for vtable entries but otherwise unused.
+// Note that these functions are explicitly NOT marked SUPPORTS_DAC so that we'll get a
+// DacCop warning if any calls to them are detected.
+// @dbgtodo : It's probably almost always wrong to call any such function, so
+// we should probably throw a better error (DacNotImpl), and ideally mark the function
+// DECLSPEC_NORETURN so we don't have to deal with fabricating return values and we can
+// get compiler warnings (unreachable code) anytime functions marked this way are called.
+#define DAC_EMPTY() { LIMITED_METHOD_CONTRACT; }
+#define DAC_EMPTY_ERR() { LIMITED_METHOD_CONTRACT; DacError(E_UNEXPECTED); }
+#define DAC_EMPTY_RET(retVal) { LIMITED_METHOD_CONTRACT; DacError(E_UNEXPECTED); return retVal; }
+#define DAC_UNEXPECTED() { LIMITED_METHOD_CONTRACT; DacError_NoRet(E_UNEXPECTED); }
+
+#endif // #ifdef __cplusplus
+
+// Implementation details for dac_cast, should never be accessed directly.
+// See code:dac_cast for details and discussion.
+namespace dac_imp
+{
+ // Helper functions to get the target address of specific types
+ inline TADDR getTaddr(TADDR addr) { return addr; }
+ inline TADDR getTaddr(__TPtrBase const &tptr) { return PTR_TO_TADDR(tptr); }
+ inline TADDR getTaddr(void const * host) { return PTR_HOST_TO_TADDR((void *)host); }
+ template<typename acc_type, typename store_type>
+ inline TADDR getTaddr(__GlobalPtr<acc_type, store_type> const &gptr) { return PTR_TO_TADDR(gptr); }
+
+ // It is an error to try dac_cast on a __GlobalVal or a __GlobalArray. Declare
+ // but do not define the methods so that a compile-time error results.
+ template<typename type>
+ TADDR getTaddr(__GlobalVal<type> const &gval);
+ template<typename type, size_t size>
+ TADDR getTaddr(__GlobalArray<type, size> const &garr);
+
+ // Helper class to instantiate DAC instances from a TADDR
+ // The default implementation assumes we want to create an instance of a PTR type
+ template<typename T> struct makeDacInst
+ {
+ static inline T fromTaddr(TADDR addr)
+ {
+ static_assert((std::is_base_of<__TPtrBase, T>::value), "is_base_of constraint violation");
+ return T(addr);
+ }
+ };
+
+ // Partial specialization for creating TADDRs
+ // This is the only other way to create a DAC type instance other than PTR types (above)
+ template<> struct makeDacInst<TADDR>
+ {
+ static inline TADDR fromTaddr(TADDR addr) { return addr; }
+ };
+} // namespace dac_imp
+
+
+// DacCop in-line exclusion mechanism
+
+// Warnings - official home is DacCop\Shared\Warnings.cs, but we want a way for users to indicate
+// warning codes in a way that is descriptive to readers (not just code numbers). The names here
+// don't matter - DacCop just looks at the value
+enum DacCopWarningCode
+{
+ // General Rules
+ FieldAccess = 1,
+ PointerArith = 2,
+ PointerComparison = 3,
+ InconsistentMarshalling = 4,
+ CastBetweenAddressSpaces = 5,
+ CastOfMarshalledType = 6,
+ VirtualCallToNonVPtr = 7,
+ UndacizedGlobalVariable = 8,
+
+ // Function graph related
+ CallUnknown = 701,
+ CallNonDac = 702,
+ CallVirtualUnknown = 704,
+ CallVirtualNonDac = 705,
+};
+
+// DACCOP_IGNORE is a mechanism to suppress DacCop violations from within the source-code.
+// See the DacCop wiki for guidance on how best to use this: http://mswikis/clr/dev/Pages/DacCop.aspx
+//
+// DACCOP_IGNORE will suppress a DacCop violation for the following (non-compound) statement.
+// For example:
+// // The "dual-mode DAC problem" occurs in a few places where a class is used both
+// // in the host, and marshalled from the target ... <further details>
+// DACCOP_IGNORE(CastBetweenAddressSpaces,"SBuffer has the dual-mode DAC problem");
+// TADDR bufAddr = (TADDR)m_buffer;
+//
+// A call to DACCOP_IGNORE must occur as it's own statement, and can apply only to following
+// single-statements (not to compound statement blocks). Occasionally it is necessary to hoist
+// violation-inducing code out to its own statement (e.g., if it occurs in the conditional of an
+// if).
+//
+// Arguments:
+// code: a literal value from DacCopWarningCode indicating which violation should be suppressed.
+// szReasonString: a short description of why this exclusion is necessary. This is intended just
+// to help readers of the code understand the source of the problem, and what would be required
+// to fix it. More details can be provided in comments if desired.
+//
+inline void DACCOP_IGNORE(DacCopWarningCode code, const char * szReasonString)
+{
+ // DacCop detects calls to this function. No implementation is necessary.
+}
+
+#else // #ifdef DACCESS_COMPILE
+
+//
+// This version of the macros turns into normal pointers
+// for unmodified in-proc compilation.
+
+// *******************************************************
+// !!!!!!!!!!!!!!!!!!!!!!!!!NOTE!!!!!!!!!!!!!!!!!!!!!!!!!!
+//
+// Please search this file for the type name to find the
+// DAC versions of these definitions
+//
+// !!!!!!!!!!!!!!!!!!!!!!!!!NOTE!!!!!!!!!!!!!!!!!!!!!!!!!!
+// *******************************************************
+
+
+// Declare TADDR as a non-pointer type so that arithmetic
+// can be done on it directly, as with the DACCESS_COMPILE definition.
+// This also helps expose pointer usage that may need to be changed.
+typedef ULONG_PTR TADDR;
+
+typedef void* PTR_VOID;
+typedef LPVOID* PTR_PTR_VOID;
+typedef const void* PTR_CVOID;
+
+#define DPTR(type) type*
+#define ArrayDPTR(type) type*
+#define SPTR(type) type*
+#define VPTR(type) type*
+#define S8PTR(type) type*
+#define S8PTRMAX(type, maxChars) type*
+#define S16PTR(type) type*
+#define S16PTRMAX(type, maxChars) type*
+
+#if defined(FEATURE_PAL)
+
+#define VPTR_VTABLE_CLASS(name, base) \
+ friend struct _DacGlobals; \
+public: name(int dummy) : base(dummy) {}
+
+#define VPTR_VTABLE_CLASS_AND_CTOR(name, base) \
+ VPTR_VTABLE_CLASS(name, base) \
+ name() : base() {}
+
+#define VPTR_MULTI_VTABLE_CLASS(name, base) \
+ friend struct _DacGlobals; \
+public: name(int dummy) : base(dummy) {}
+
+#define VPTR_BASE_CONCRETE_VTABLE_CLASS(name) \
+ friend struct _DacGlobals; \
+public: name(int dummy) {}
+
+#define VPTR_BASE_VTABLE_CLASS(name) \
+ friend struct _DacGlobals; \
+public: name(int dummy) {}
+
+#define VPTR_BASE_VTABLE_CLASS_AND_CTOR(name) \
+ VPTR_BASE_VTABLE_CLASS(name) \
+ name() {}
+
+#define VPTR_ABSTRACT_VTABLE_CLASS(name, base) \
+ friend struct _DacGlobals; \
+public: name(int dummy) : base(dummy) {}
+
+#define VPTR_ABSTRACT_VTABLE_CLASS_AND_CTOR(name, base) \
+ VPTR_ABSTRACT_VTABLE_CLASS(name, base) \
+ name() : base() {}
+
+#else // FEATURE_PAL
+
+#define VPTR_VTABLE_CLASS(name, base)
+#define VPTR_VTABLE_CLASS_AND_CTOR(name, base)
+#define VPTR_MULTI_VTABLE_CLASS(name, base)
+#define VPTR_BASE_CONCRETE_VTABLE_CLASS(name)
+#define VPTR_BASE_VTABLE_CLASS(name)
+#define VPTR_BASE_VTABLE_CLASS_AND_CTOR(name)
+#define VPTR_ABSTRACT_VTABLE_CLASS(name, base)
+#define VPTR_ABSTRACT_VTABLE_CLASS_AND_CTOR(name, base)
+
+#endif // FEATURE_PAL
+
+// helper macro to make the vtables unique for DAC
+#define VPTR_UNIQUE(unique) virtual int MakeVTableUniqueForDAC() { STATIC_CONTRACT_SO_TOLERANT; return unique; }
+#define VPTR_UNIQUE_BaseDomain (100000)
+#define VPTR_UNIQUE_SystemDomain (VPTR_UNIQUE_BaseDomain + 1)
+#define VPTR_UNIQUE_ComMethodFrame (VPTR_UNIQUE_SystemDomain + 1)
+#define VPTR_UNIQUE_StubHelperFrame (VPTR_UNIQUE_ComMethodFrame + 1)
+#define VPTR_UNIQUE_RedirectedThreadFrame (VPTR_UNIQUE_StubHelperFrame + 1)
+#define VPTR_UNIQUE_HijackFrame (VPTR_UNIQUE_RedirectedThreadFrame + 1)
+
+#define PTR_TO_TADDR(ptr) ((TADDR)(ptr))
+#define GFN_TADDR(name) ((TADDR)(name))
+
+#define GVAL_ADDR(g) (&(g))
+#define _SPTR_DECL(acc_type, store_type, var) \
+ static store_type var
+#define _SPTR_IMPL(acc_type, store_type, cls, var) \
+ store_type cls::var
+#define _SPTR_IMPL_INIT(acc_type, store_type, cls, var, init) \
+ store_type cls::var = init
+#define _SPTR_IMPL_NS(acc_type, store_type, ns, cls, var) \
+ store_type cls::var
+#define _SPTR_IMPL_NS_INIT(acc_type, store_type, ns, cls, var, init) \
+ store_type cls::var = init
+#define _GPTR_DECL(acc_type, store_type, var) \
+ extern store_type var
+#define _GPTR_IMPL(acc_type, store_type, var) \
+ store_type var
+#define _GPTR_IMPL_INIT(acc_type, store_type, var, init) \
+ store_type var = init
+#define SVAL_DECL(type, var) \
+ static type var
+#define SVAL_IMPL(type, cls, var) \
+ type cls::var
+#define SVAL_IMPL_INIT(type, cls, var, init) \
+ type cls::var = init
+#define SVAL_IMPL_NS(type, ns, cls, var) \
+ type cls::var
+#define SVAL_IMPL_NS_INIT(type, ns, cls, var, init) \
+ type cls::var = init
+#define GVAL_DECL(type, var) \
+ extern type var
+#define GVAL_IMPL(type, var) \
+ type var
+#define GVAL_IMPL_INIT(type, var, init) \
+ type var = init
+#define GARY_DECL(type, var, size) \
+ extern type var[size]
+#define GARY_IMPL(type, var, size) \
+ type var[size]
+#define PTR_HOST_TO_TADDR(host) ((TADDR)(host))
+#define PTR_HOST_INT_TO_TADDR(host) ((TADDR)(host))
+#define VPTR_HOST_VTABLE_TO_TADDR(host) ((TADDR)(host))
+#define PTR_HOST_MEMBER_TADDR(type, host, memb) ((TADDR)&(host)->memb)
+#define PTR_HOST_INT_MEMBER_TADDR(type, host, memb) ((TADDR)&(host)->memb)
+#define PTR_TO_MEMBER_TADDR(type, ptr, memb) ((TADDR)&((ptr)->memb))
+#define PTR_READ(addr, size) ((PVOID)(addr))
+
+#define PTR_NULL NULL
+
+#define DAC_EMPTY()
+#define DAC_EMPTY_ERR()
+#define DAC_EMPTY_RET(retVal)
+#define DAC_UNEXPECTED()
+
+#define DACCOP_IGNORE(warningCode, reasonString)
+
+#endif // #ifdef DACCESS_COMPILE
+
+//----------------------------------------------------------------------------
+// dac_cast
+// Casting utility, to be used for casting one class pointer type to another.
+// Use as you would use static_cast
+//
+// dac_cast is designed to act just as static_cast does when
+// dealing with pointers and their DAC abstractions. Specifically,
+// it handles these coversions:
+//
+// dac_cast<TargetType>(SourceTypeVal)
+//
+// where TargetType <- SourceTypeVal are
+//
+// ?PTR(Tgt) <- TADDR - Create PTR type (DPtr etc.) from TADDR
+// ?PTR(Tgt) <- ?PTR(Src) - Convert one PTR type to another
+// ?PTR(Tgt) <- Src * - Create PTR type from dac host object instance
+// TADDR <- ?PTR(Src) - Get TADDR of PTR object (DPtr etc.)
+// TADDR <- Src * - Get TADDR of dac host object instance
+//
+// Note that there is no direct convertion to other host-pointer types (because we don't
+// know if you want a DPTR or VPTR etc.). However, due to the implicit DAC conversions,
+// you can just use dac_cast<PTR_Foo> and assign that to a Foo*.
+//
+// The beauty of this syntax is that it is consistent regardless
+// of source and target casting types. You just use dac_cast
+// and the partial template specialization will do the right thing.
+//
+// One important thing to realise is that all "Foo *" types are
+// assumed to be pointers to host instances that were marshalled by DAC. This should
+// fail at runtime if it's not the case.
+//
+// Some examples would be:
+//
+// - Host pointer of one type to a related host pointer of another
+// type, i.e., MethodDesc * <-> InstantiatedMethodDesc *
+// Syntax: with MethodDesc *pMD, InstantiatedMethodDesc *pInstMD
+// pInstMd = dac_cast<PTR_InstantiatedMethodDesc>(pMD)
+// pMD = dac_cast<PTR_MethodDesc>(pInstMD)
+//
+// - (D|V)PTR of one encapsulated pointer type to a (D|V)PTR of
+// another type, i.e., PTR_AppDomain <-> PTR_BaseDomain
+// Syntax: with PTR_AppDomain pAD, PTR_BaseDomain pBD
+// dac_cast<PTR_AppDomain>(pBD)
+// dac_cast<PTR_BaseDomain>(pAD)
+//
+// Example comparsions of some old and new syntax, where
+// h is a host pointer, such as "Foo *h;"
+// p is a DPTR, such as "PTR_Foo p;"
+//
+// PTR_HOST_TO_TADDR(h) ==> dac_cast<TADDR>(h)
+// PTR_TO_TADDR(p) ==> dac_cast<TADDR>(p)
+// PTR_Foo(PTR_HOST_TO_TADDR(h)) ==> dac_cast<PTR_Foo>(h)
+//
+//----------------------------------------------------------------------------
+template <typename Tgt, typename Src>
+inline Tgt dac_cast(Src src)
+{
+#ifdef DACCESS_COMPILE
+ // In DAC builds, first get a TADDR for the source, then create the
+ // appropriate destination instance.
+ TADDR addr = dac_imp::getTaddr(src);
+ return dac_imp::makeDacInst<Tgt>::fromTaddr(addr);
+#else
+ // In non-DAC builds, dac_cast is the same as a C-style cast because we need to support:
+ // - casting away const
+ // - conversions between pointers and TADDR
+ // Perhaps we should more precisely restrict it's usage, but we get the precise
+ // restrictions in DAC builds, so it wouldn't buy us much.
+ return (Tgt)(src);
+#endif
+}
+
+//----------------------------------------------------------------------------
+//
+// Convenience macros which work for either mode.
+//
+//----------------------------------------------------------------------------
+
+#define SPTR_DECL(type, var) _SPTR_DECL(type*, PTR_##type, var)
+#define SPTR_IMPL(type, cls, var) _SPTR_IMPL(type*, PTR_##type, cls, var)
+#define SPTR_IMPL_INIT(type, cls, var, init) _SPTR_IMPL_INIT(type*, PTR_##type, cls, var, init)
+#define SPTR_IMPL_NS(type, ns, cls, var) _SPTR_IMPL_NS(type*, PTR_##type, ns, cls, var)
+#define SPTR_IMPL_NS_INIT(type, ns, cls, var, init) _SPTR_IMPL_NS_INIT(type*, PTR_##type, ns, cls, var, init)
+#define GPTR_DECL(type, var) _GPTR_DECL(type*, PTR_##type, var)
+#define GPTR_IMPL(type, var) _GPTR_IMPL(type*, PTR_##type, var)
+#define GPTR_IMPL_INIT(type, var, init) _GPTR_IMPL_INIT(type*, PTR_##type, var, init)
+
+
+// If you want to marshal a single instance of an ArrayDPtr over to the host and
+// return a pointer to it, you can use this function. However, this is unsafe because
+// users of value may assume they can do pointer arithmetic on it. This is exactly
+// the bugs ArrayDPtr is designed to prevent. See code:__ArrayDPtr for details.
+template<typename type>
+inline type* DacUnsafeMarshalSingleElement( ArrayDPTR(type) arrayPtr )
+{
+ return (DPTR(type))(arrayPtr);
+}
+
+//----------------------------------------------------------------------------
+//
+// Forward typedefs for system types. This is a convenient place
+// to declare things for system types, plus it gives us a central
+// place to look at when deciding what types may cause issues for
+// cross-platform compilation.
+//
+//----------------------------------------------------------------------------
+
+typedef ArrayDPTR(BYTE) PTR_BYTE;
+typedef ArrayDPTR(uint8_t) PTR_uint8_t;
+typedef DPTR(PTR_BYTE) PTR_PTR_BYTE;
+typedef DPTR(PTR_uint8_t) PTR_PTR_uint8_t;
+typedef DPTR(PTR_PTR_BYTE) PTR_PTR_PTR_BYTE;
+typedef ArrayDPTR(signed char) PTR_SBYTE;
+typedef ArrayDPTR(const BYTE) PTR_CBYTE;
+typedef DPTR(INT8) PTR_INT8;
+typedef DPTR(INT16) PTR_INT16;
+typedef DPTR(WORD) PTR_WORD;
+typedef DPTR(USHORT) PTR_USHORT;
+typedef DPTR(DWORD) PTR_DWORD;
+typedef DPTR(uint32_t) PTR_uint32_t;
+typedef DPTR(LONG) PTR_LONG;
+typedef DPTR(ULONG) PTR_ULONG;
+typedef DPTR(INT32) PTR_INT32;
+typedef DPTR(UINT32) PTR_UINT32;
+typedef DPTR(ULONG64) PTR_ULONG64;
+typedef DPTR(INT64) PTR_INT64;
+typedef DPTR(UINT64) PTR_UINT64;
+typedef DPTR(SIZE_T) PTR_SIZE_T;
+typedef DPTR(size_t) PTR_size_t;
+typedef DPTR(TADDR) PTR_TADDR;
+typedef DPTR(int) PTR_int;
+typedef DPTR(BOOL) PTR_BOOL;
+typedef DPTR(unsigned) PTR_unsigned;
+
+typedef S8PTR(char) PTR_STR;
+typedef S8PTR(const char) PTR_CSTR;
+typedef S8PTR(char) PTR_UTF8;
+typedef S8PTR(const char) PTR_CUTF8;
+typedef S16PTR(WCHAR) PTR_WSTR;
+typedef S16PTR(const WCHAR) PTR_CWSTR;
+
+typedef DPTR(T_CONTEXT) PTR_CONTEXT;
+typedef DPTR(PTR_CONTEXT) PTR_PTR_CONTEXT;
+typedef DPTR(struct _EXCEPTION_POINTERS) PTR_EXCEPTION_POINTERS;
+typedef DPTR(struct _EXCEPTION_RECORD) PTR_EXCEPTION_RECORD;
+
+typedef DPTR(struct _EXCEPTION_REGISTRATION_RECORD) PTR_EXCEPTION_REGISTRATION_RECORD;
+
+typedef DPTR(struct IMAGE_COR_VTABLEFIXUP) PTR_IMAGE_COR_VTABLEFIXUP;
+typedef DPTR(IMAGE_DATA_DIRECTORY) PTR_IMAGE_DATA_DIRECTORY;
+typedef DPTR(IMAGE_DEBUG_DIRECTORY) PTR_IMAGE_DEBUG_DIRECTORY;
+typedef DPTR(IMAGE_DOS_HEADER) PTR_IMAGE_DOS_HEADER;
+typedef DPTR(IMAGE_NT_HEADERS) PTR_IMAGE_NT_HEADERS;
+typedef DPTR(IMAGE_NT_HEADERS32) PTR_IMAGE_NT_HEADERS32;
+typedef DPTR(IMAGE_NT_HEADERS64) PTR_IMAGE_NT_HEADERS64;
+typedef DPTR(IMAGE_SECTION_HEADER) PTR_IMAGE_SECTION_HEADER;
+typedef DPTR(IMAGE_TLS_DIRECTORY) PTR_IMAGE_TLS_DIRECTORY;
+
+#if defined(DACCESS_COMPILE)
+#include <corhdr.h>
+#include <clrdata.h>
+#include <xclrdata.h>
+#endif
+
+#ifdef _WIN64
+typedef DPTR(T_RUNTIME_FUNCTION) PTR_RUNTIME_FUNCTION;
+typedef DPTR(struct _UNWIND_INFO) PTR_UNWIND_INFO;
+#if defined(_TARGET_AMD64_)
+typedef DPTR(union _UNWIND_CODE) PTR_UNWIND_CODE;
+#endif // _TARGET_AMD64_
+#endif // _WIN64
+
+#ifdef _TARGET_ARM_
+typedef DPTR(RUNTIME_FUNCTION) PTR_RUNTIME_FUNCTION;
+#endif
+
+//----------------------------------------------------------------------------
+//
+// A PCODE is a valid PC/IP value -- a pointer to an instruction, possibly including some processor mode bits.
+// (On ARM, for example, a PCODE value should should have the low-order THUMB_CODE bit set if the code should
+// be executed in that mode.)
+//
+typedef TADDR PCODE;
+typedef DPTR(PCODE) PTR_PCODE;
+typedef DPTR(PTR_PCODE) PTR_PTR_PCODE;
+
+// There is another concept we should have, "pointer to the start of an instruction" -- a PCODE with any mode bits masked off.
+// Attempts to introduce this concept, and classify uses of PCODE as one or the other,
+// turned out to be too hard: either name choice required *many* code changes, and decisions in unfamiliar code. So despite the
+// the comment above, the PCODE is currently sometimes used for the PINSTR concept.
+
+// See PCODEToPINSTR in utilcode.h for conversion from PCODE to PINSTR.
+
+//----------------------------------------------------------------------------
+//
+// The access code compile must compile data structures that exactly
+// match the real structures for access to work. The access code
+// doesn't want all of the debugging validation code, though, so
+// distinguish between _DEBUG, for declaring general debugging data
+// and always-on debug code, and _DEBUG_IMPL, for debugging code
+// which will be disabled when compiling for external access.
+//
+//----------------------------------------------------------------------------
+
+#if !defined(_DEBUG_IMPL) && defined(_DEBUG) && !defined(DACCESS_COMPILE)
+#define _DEBUG_IMPL 1
+#endif
+
+// Helper macro for tracking EnumMemoryRegions progress.
+#if 0
+#define EMEM_OUT(args) DacWarning args
+#else
+#define EMEM_OUT(args)
+#endif
+
+// Macros like MAIN_CLR_MODULE_NAME* for the DAC module
+#ifdef FEATURE_MAIN_CLR_MODULE_USES_CORE_NAME
+#define MAIN_DAC_MODULE_NAME_W W("mscordaccore")
+#define MAIN_DAC_MODULE_DLL_NAME_W W("mscordaccore.dll")
+#else
+#define MAIN_DAC_MODULE_NAME_W W("mscordacwks")
+#define MAIN_DAC_MODULE_DLL_NAME_W W("mscordacwks.dll")
+#endif
+
+// TARGET_CONSISTENCY_CHECK represents a condition that should not fail unless the DAC target is corrupt.
+// This is in contrast to ASSERTs in DAC infrastructure code which shouldn't fail regardless of the memory
+// read from the target. At the moment we treat these the same, but in the future we will want a mechanism
+// for disabling just the target consistency checks (eg. for tests that intentionally use corrupted targets).
+// @dbgtodo : Separating asserts and target consistency checks is tracked by DevDiv Bugs 31674
+#define TARGET_CONSISTENCY_CHECK(expr,msg) _ASSERTE_MSG(expr,msg)
+
+#endif // #ifndef __daccess_h__
diff --git a/src/inc/dacprivate.h b/src/inc/dacprivate.h
new file mode 100644
index 0000000000..5a09abe113
--- /dev/null
+++ b/src/inc/dacprivate.h
@@ -0,0 +1,1010 @@
+// 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.
+//*****************************************************************************
+//
+// Internal data access functionality.
+//
+//*****************************************************************************
+
+#ifndef _DACPRIVATE_H_
+#define _DACPRIVATE_H_
+
+#include <cor.h>
+#include <clrdata.h>
+#include <xclrdata.h>
+#include <sospriv.h>
+
+#ifndef FEATURE_PAL
+// It is unfortunate having to include this header just to get the definition of GenericModeBlock
+#include <msodw.h>
+#endif // FEATURE_PAL
+
+//----------------------------------------------------------------------------
+//
+// Utility class to allow for zero initialization of our Dacp- structs.
+//
+//----------------------------------------------------------------------------
+
+template <class T>
+struct ZeroInit
+{
+ ZeroInit()
+ { memset(static_cast<T*>(this), 0, sizeof(T)); }
+};
+
+
+#include <livedatatarget.h>
+
+//----------------------------------------------------------------------------
+//
+// Internal CLRData requests.
+//
+//----------------------------------------------------------------------------
+
+
+// Private requests for DataModules
+enum
+{
+ DACDATAMODULEPRIV_REQUEST_GET_MODULEPTR = 0xf0000000,
+ DACDATAMODULEPRIV_REQUEST_GET_MODULEDATA = 0xf0000001
+};
+
+
+// Private requests for stack walkers.
+enum
+{
+ DACSTACKPRIV_REQUEST_FRAME_DATA = 0xf0000000
+};
+
+enum DacpObjectType { OBJ_STRING=0,OBJ_FREE,OBJ_OBJECT,OBJ_ARRAY,OBJ_OTHER };
+struct DacpObjectData : ZeroInit<DacpObjectData>
+{
+ CLRDATA_ADDRESS MethodTable;
+ DacpObjectType ObjectType;
+ ULONG64 Size;
+ CLRDATA_ADDRESS ElementTypeHandle;
+ CorElementType ElementType;
+ DWORD dwRank;
+ ULONG64 dwNumComponents;
+ ULONG64 dwComponentSize;
+ CLRDATA_ADDRESS ArrayDataPtr;
+ CLRDATA_ADDRESS ArrayBoundsPtr;
+ CLRDATA_ADDRESS ArrayLowerBoundsPtr;
+
+ CLRDATA_ADDRESS RCW;
+ CLRDATA_ADDRESS CCW;
+
+ HRESULT Request(ISOSDacInterface *sos, CLRDATA_ADDRESS addr)
+ {
+ return sos->GetObjectData(addr, this);
+ }
+};
+
+struct DacpExceptionObjectData : ZeroInit<DacpExceptionObjectData>
+{
+ CLRDATA_ADDRESS Message;
+ CLRDATA_ADDRESS InnerException;
+ CLRDATA_ADDRESS StackTrace;
+ CLRDATA_ADDRESS WatsonBuckets;
+ CLRDATA_ADDRESS StackTraceString;
+ CLRDATA_ADDRESS RemoteStackTraceString;
+ INT32 HResult;
+ INT32 XCode;
+
+ HRESULT Request(ISOSDacInterface *sos, CLRDATA_ADDRESS addr)
+ {
+ HRESULT hr;
+ ISOSDacInterface2 *psos2 = NULL;
+ if (SUCCEEDED(hr = sos->QueryInterface(__uuidof(ISOSDacInterface2), (void**) &psos2)))
+ {
+ hr = psos2->GetObjectExceptionData(addr, this);
+ psos2->Release();
+ }
+ return hr;
+ }
+};
+
+struct DacpUsefulGlobalsData : ZeroInit<DacpUsefulGlobalsData>
+{
+ CLRDATA_ADDRESS ArrayMethodTable;
+ CLRDATA_ADDRESS StringMethodTable;
+ CLRDATA_ADDRESS ObjectMethodTable;
+ CLRDATA_ADDRESS ExceptionMethodTable;
+ CLRDATA_ADDRESS FreeMethodTable;
+};
+
+struct DacpFieldDescData : ZeroInit<DacpFieldDescData>
+{
+ CorElementType Type;
+ CorElementType sigType; // ELEMENT_TYPE_XXX from signature. We need this to disply pretty name for String in minidump's case
+ CLRDATA_ADDRESS MTOfType; // NULL if Type is not loaded
+
+ CLRDATA_ADDRESS ModuleOfType;
+ mdTypeDef TokenOfType;
+
+ mdFieldDef mb;
+ CLRDATA_ADDRESS MTOfEnclosingClass;
+ DWORD dwOffset;
+ BOOL bIsThreadLocal;
+ BOOL bIsContextLocal;
+ BOOL bIsStatic;
+ CLRDATA_ADDRESS NextField;
+
+ HRESULT Request(ISOSDacInterface *sos, CLRDATA_ADDRESS addr)
+ {
+ return sos->GetFieldDescData(addr, this);
+ }
+};
+
+struct DacpMethodTableFieldData : ZeroInit<DacpMethodTableFieldData>
+{
+ WORD wNumInstanceFields;
+ WORD wNumStaticFields;
+ WORD wNumThreadStaticFields;
+
+ CLRDATA_ADDRESS FirstField; // If non-null, you can retrieve more
+
+ WORD wContextStaticOffset;
+ WORD wContextStaticsSize;
+
+ HRESULT Request(ISOSDacInterface *sos, CLRDATA_ADDRESS addr)
+ {
+ return sos->GetMethodTableFieldData(addr, this);
+ }
+};
+
+struct DacpMethodTableTransparencyData : ZeroInit<DacpMethodTableTransparencyData>
+{
+ BOOL bHasCriticalTransparentInfo;
+ BOOL bIsCritical;
+ BOOL bIsTreatAsSafe;
+
+ HRESULT Request(ISOSDacInterface *sos, CLRDATA_ADDRESS addr)
+ {
+ return sos->GetMethodTableTransparencyData(addr, this);
+ }
+};
+
+struct DacpDomainLocalModuleData : ZeroInit<DacpDomainLocalModuleData>
+{
+ // These two parameters are used as input params when calling the
+ // no-argument form of Request below.
+ CLRDATA_ADDRESS appDomainAddr;
+ ULONG64 ModuleID;
+
+ CLRDATA_ADDRESS pClassData;
+ CLRDATA_ADDRESS pDynamicClassTable;
+ CLRDATA_ADDRESS pGCStaticDataStart;
+ CLRDATA_ADDRESS pNonGCStaticDataStart;
+
+ // Called when you have a pointer to the DomainLocalModule
+ HRESULT Request(ISOSDacInterface *sos, CLRDATA_ADDRESS addr)
+ {
+ return sos->GetDomainLocalModuleData(addr, this);
+ }
+};
+
+
+struct DacpThreadLocalModuleData : ZeroInit<DacpThreadLocalModuleData>
+{
+ // These two parameters are used as input params when calling the
+ // no-argument form of Request below.
+ CLRDATA_ADDRESS threadAddr;
+ ULONG64 ModuleIndex;
+
+ CLRDATA_ADDRESS pClassData;
+ CLRDATA_ADDRESS pDynamicClassTable;
+ CLRDATA_ADDRESS pGCStaticDataStart;
+ CLRDATA_ADDRESS pNonGCStaticDataStart;
+};
+
+
+struct DacpModuleData : ZeroInit<DacpModuleData>
+{
+ CLRDATA_ADDRESS Address;
+ CLRDATA_ADDRESS File; // A PEFile addr
+ CLRDATA_ADDRESS ilBase;
+ CLRDATA_ADDRESS metadataStart;
+ ULONG64 metadataSize;
+ CLRDATA_ADDRESS Assembly; // Assembly pointer
+ BOOL bIsReflection;
+ BOOL bIsPEFile;
+ ULONG64 dwBaseClassIndex;
+ ULONG64 dwModuleID;
+
+ DWORD dwTransientFlags;
+
+ CLRDATA_ADDRESS TypeDefToMethodTableMap;
+ CLRDATA_ADDRESS TypeRefToMethodTableMap;
+ CLRDATA_ADDRESS MethodDefToDescMap;
+ CLRDATA_ADDRESS FieldDefToDescMap;
+ CLRDATA_ADDRESS MemberRefToDescMap;
+ CLRDATA_ADDRESS FileReferencesMap;
+ CLRDATA_ADDRESS ManifestModuleReferencesMap;
+
+ CLRDATA_ADDRESS pLookupTableHeap;
+ CLRDATA_ADDRESS pThunkHeap;
+
+ ULONG64 dwModuleIndex;
+
+ DacpModuleData()
+ {
+ }
+
+ HRESULT Request(ISOSDacInterface *sos, CLRDATA_ADDRESS addr)
+ {
+ return sos->GetModuleData(addr, this);
+ }
+
+private:
+ // Ensure that this data structure is not copied.
+ DacpModuleData(const DacpModuleData&);
+ void operator=(const DacpModuleData&);
+};
+
+struct DacpMethodTableData : ZeroInit<DacpMethodTableData>
+{
+ BOOL bIsFree; // everything else is NULL if this is true.
+ CLRDATA_ADDRESS Module;
+ CLRDATA_ADDRESS Class;
+ CLRDATA_ADDRESS ParentMethodTable;
+ WORD wNumInterfaces;
+ WORD wNumMethods;
+ WORD wNumVtableSlots;
+ WORD wNumVirtuals;
+ DWORD BaseSize;
+ DWORD ComponentSize;
+ mdTypeDef cl; // Metadata token
+ DWORD dwAttrClass; // cached metadata
+ BOOL bIsShared; // flags & enum_flag_DomainNeutral
+ BOOL bIsDynamic;
+ BOOL bContainsPointers;
+
+ HRESULT Request(ISOSDacInterface *sos, CLRDATA_ADDRESS addr)
+ {
+ return sos->GetMethodTableData(addr, this);
+ }
+};
+
+
+// Copied from util.hpp, for DacpThreadStoreData.fHostConfig below.
+#define CLRMEMORYHOSTED 0x1
+#define CLRTASKHOSTED 0x2
+#define CLRSYNCHOSTED 0x4
+#define CLRTHREADPOOLHOSTED 0x8
+#define CLRIOCOMPLETIONHOSTED 0x10
+#define CLRASSEMBLYHOSTED 0x20
+#define CLRGCHOSTED 0x40
+#define CLRSECURITYHOSTED 0x80
+#define CLRHOSTED 0x80000000
+
+struct DacpThreadStoreData : ZeroInit<DacpThreadStoreData>
+{
+ LONG threadCount;
+ LONG unstartedThreadCount;
+ LONG backgroundThreadCount;
+ LONG pendingThreadCount;
+ LONG deadThreadCount;
+ CLRDATA_ADDRESS firstThread;
+ CLRDATA_ADDRESS finalizerThread;
+ CLRDATA_ADDRESS gcThread;
+ DWORD fHostConfig; // Uses hosting flags defined above
+
+ HRESULT Request(ISOSDacInterface *sos)
+ {
+ return sos->GetThreadStoreData(this);
+ }
+};
+
+struct DacpAppDomainStoreData : ZeroInit<DacpAppDomainStoreData>
+{
+ CLRDATA_ADDRESS sharedDomain;
+ CLRDATA_ADDRESS systemDomain;
+ LONG DomainCount;
+
+ HRESULT Request(ISOSDacInterface *sos)
+ {
+ return sos->GetAppDomainStoreData(this);
+ }
+};
+
+struct DacpCOMInterfacePointerData : ZeroInit<DacpCOMInterfacePointerData>
+{
+ CLRDATA_ADDRESS methodTable;
+ CLRDATA_ADDRESS interfacePtr;
+ CLRDATA_ADDRESS comContext;
+};
+
+struct DacpRCWData : ZeroInit<DacpRCWData>
+{
+ CLRDATA_ADDRESS identityPointer;
+ CLRDATA_ADDRESS unknownPointer;
+ CLRDATA_ADDRESS managedObject;
+ CLRDATA_ADDRESS jupiterObject;
+ CLRDATA_ADDRESS vtablePtr;
+ CLRDATA_ADDRESS creatorThread;
+ CLRDATA_ADDRESS ctxCookie;
+
+ LONG refCount;
+ LONG interfaceCount;
+
+ BOOL isJupiterObject;
+ BOOL supportsIInspectable;
+ BOOL isAggregated;
+ BOOL isContained;
+ BOOL isFreeThreaded;
+ BOOL isDisconnected;
+
+ HRESULT Request(ISOSDacInterface *sos, CLRDATA_ADDRESS rcw)
+ {
+ return sos->GetRCWData(rcw, this);
+ }
+
+ HRESULT IsDCOMProxy(ISOSDacInterface *sos, CLRDATA_ADDRESS rcw, BOOL* isDCOMProxy)
+ {
+ ISOSDacInterface2 *pSOS2 = nullptr;
+ HRESULT hr = sos->QueryInterface(__uuidof(ISOSDacInterface2), reinterpret_cast<LPVOID*>(&pSOS2));
+ if (SUCCEEDED(hr))
+ {
+ hr = pSOS2->IsRCWDCOMProxy(rcw, isDCOMProxy);
+ pSOS2->Release();
+ }
+
+ return hr;
+ }
+};
+
+struct DacpCCWData : ZeroInit<DacpCCWData>
+{
+ CLRDATA_ADDRESS outerIUnknown;
+ CLRDATA_ADDRESS managedObject;
+ CLRDATA_ADDRESS handle;
+ CLRDATA_ADDRESS ccwAddress;
+
+ LONG refCount;
+ LONG interfaceCount;
+ BOOL isNeutered;
+
+ LONG jupiterRefCount;
+ BOOL isPegged;
+ BOOL isGlobalPegged;
+ BOOL hasStrongRef;
+ BOOL isExtendsCOMObject;
+ BOOL isAggregated;
+
+ HRESULT Request(ISOSDacInterface *sos, CLRDATA_ADDRESS ccw)
+ {
+ return sos->GetCCWData(ccw, this);
+ }
+};
+
+enum DacpAppDomainDataStage {
+ STAGE_CREATING,
+ STAGE_READYFORMANAGEDCODE,
+ STAGE_ACTIVE,
+ STAGE_OPEN,
+ STAGE_UNLOAD_REQUESTED,
+ STAGE_EXITING,
+ STAGE_EXITED,
+ STAGE_FINALIZING,
+ STAGE_FINALIZED,
+ STAGE_HANDLETABLE_NOACCESS,
+ STAGE_CLEARED,
+ STAGE_COLLECTED,
+ STAGE_CLOSED
+};
+
+// Information about a BaseDomain (AppDomain, SharedDomain or SystemDomain).
+// For types other than AppDomain, some fields (like dwID, DomainLocalBlock, etc.) will be 0/null.
+struct DacpAppDomainData : ZeroInit<DacpAppDomainData>
+{
+ // The pointer to the BaseDomain (not necessarily an AppDomain).
+ // It's useful to keep this around in the structure
+ CLRDATA_ADDRESS AppDomainPtr;
+ CLRDATA_ADDRESS AppSecDesc;
+ CLRDATA_ADDRESS pLowFrequencyHeap;
+ CLRDATA_ADDRESS pHighFrequencyHeap;
+ CLRDATA_ADDRESS pStubHeap;
+ CLRDATA_ADDRESS DomainLocalBlock;
+ CLRDATA_ADDRESS pDomainLocalModules;
+ // The creation sequence number of this app domain (starting from 1)
+ DWORD dwId;
+ LONG AssemblyCount;
+ LONG FailedAssemblyCount;
+ DacpAppDomainDataStage appDomainStage;
+
+ HRESULT Request(ISOSDacInterface *sos, CLRDATA_ADDRESS addr)
+ {
+ return sos->GetAppDomainData(addr, this);
+ }
+};
+
+struct DacpAssemblyData : ZeroInit<DacpAssemblyData>
+{
+ CLRDATA_ADDRESS AssemblyPtr; //useful to have
+ CLRDATA_ADDRESS ClassLoader;
+ CLRDATA_ADDRESS ParentDomain;
+ CLRDATA_ADDRESS BaseDomainPtr;
+ CLRDATA_ADDRESS AssemblySecDesc;
+ BOOL isDynamic;
+ UINT ModuleCount;
+ UINT LoadContext;
+ BOOL isDomainNeutral;
+ DWORD dwLocationFlags;
+
+ HRESULT Request(ISOSDacInterface *sos, CLRDATA_ADDRESS addr, CLRDATA_ADDRESS baseDomainPtr)
+ {
+ return sos->GetAssemblyData(baseDomainPtr, addr, this);
+ }
+
+ HRESULT Request(ISOSDacInterface *sos, CLRDATA_ADDRESS addr)
+ {
+ return Request(sos, addr, NULL);
+ }
+};
+
+
+struct DacpThreadData : ZeroInit<DacpThreadData>
+{
+ DWORD corThreadId;
+ DWORD osThreadId;
+ int state;
+ ULONG preemptiveGCDisabled;
+ CLRDATA_ADDRESS allocContextPtr;
+ CLRDATA_ADDRESS allocContextLimit;
+ CLRDATA_ADDRESS context;
+ CLRDATA_ADDRESS domain;
+ CLRDATA_ADDRESS pFrame;
+ DWORD lockCount;
+ CLRDATA_ADDRESS firstNestedException; // Pass this pointer to DacpNestedExceptionInfo
+ CLRDATA_ADDRESS teb;
+ CLRDATA_ADDRESS fiberData;
+ CLRDATA_ADDRESS lastThrownObjectHandle;
+ CLRDATA_ADDRESS nextThread;
+
+ HRESULT Request(ISOSDacInterface *sos, CLRDATA_ADDRESS addr)
+ {
+ return sos->GetThreadData(addr, this);
+ }
+};
+
+
+struct DacpReJitData : ZeroInit<DacpReJitData>
+{
+ enum Flags
+ {
+ kUnknown,
+ kRequested,
+ kActive,
+ kReverted,
+ };
+
+ CLRDATA_ADDRESS rejitID;
+ Flags flags;
+ CLRDATA_ADDRESS NativeCodeAddr;
+};
+
+struct DacpMethodDescData : ZeroInit<DacpMethodDescData>
+{
+ BOOL bHasNativeCode;
+ BOOL bIsDynamic;
+ WORD wSlotNumber;
+ CLRDATA_ADDRESS NativeCodeAddr;
+ // Useful for breaking when a method is jitted.
+ CLRDATA_ADDRESS AddressOfNativeCodeSlot;
+
+ CLRDATA_ADDRESS MethodDescPtr;
+ CLRDATA_ADDRESS MethodTablePtr;
+ CLRDATA_ADDRESS ModulePtr;
+
+ mdToken MDToken;
+ CLRDATA_ADDRESS GCInfo;
+ CLRDATA_ADDRESS GCStressCodeCopy;
+
+ // This is only valid if bIsDynamic is true
+ CLRDATA_ADDRESS managedDynamicMethodObject;
+
+ CLRDATA_ADDRESS requestedIP;
+
+ // Gives info for the single currently active version of a method
+ DacpReJitData rejitDataCurrent;
+
+ // Gives info corresponding to requestedIP (for !ip2md)
+ DacpReJitData rejitDataRequested;
+
+ // Total number of rejit versions that have been jitted
+ ULONG cJittedRejitVersions;
+
+ HRESULT Request(ISOSDacInterface *sos, CLRDATA_ADDRESS addr)
+ {
+ return sos->GetMethodDescData(
+ addr,
+ NULL, // IP address
+ this,
+ 0, // cRejitData
+ NULL, // rejitData[]
+ NULL // pcNeededRejitData
+ );
+ }
+};
+
+struct DacpMethodDescTransparencyData : ZeroInit<DacpMethodDescTransparencyData>
+{
+ BOOL bHasCriticalTransparentInfo;
+ BOOL bIsCritical;
+ BOOL bIsTreatAsSafe;
+
+ HRESULT Request(ISOSDacInterface *sos, CLRDATA_ADDRESS addr)
+ {
+ return sos->GetMethodDescTransparencyData(addr, this);
+ }
+};
+
+// for JITType
+enum JITTypes {TYPE_UNKNOWN=0,TYPE_JIT,TYPE_PJIT};
+
+struct DacpCodeHeaderData : ZeroInit<DacpCodeHeaderData>
+{
+ CLRDATA_ADDRESS GCInfo;
+ JITTypes JITType;
+ CLRDATA_ADDRESS MethodDescPtr;
+ CLRDATA_ADDRESS MethodStart;
+ DWORD MethodSize;
+ CLRDATA_ADDRESS ColdRegionStart;
+ DWORD ColdRegionSize;
+ DWORD HotRegionSize;
+
+ HRESULT Request(ISOSDacInterface *sos, CLRDATA_ADDRESS IPAddr)
+ {
+ return sos->GetCodeHeaderData(IPAddr, this);
+ }
+};
+
+struct DacpWorkRequestData : ZeroInit<DacpWorkRequestData>
+{
+ CLRDATA_ADDRESS Function;
+ CLRDATA_ADDRESS Context;
+ CLRDATA_ADDRESS NextWorkRequest;
+
+ HRESULT Request(ISOSDacInterface *sos, CLRDATA_ADDRESS addr)
+ {
+ return sos->GetWorkRequestData(addr, this);
+ }
+};
+
+struct DacpHillClimbingLogEntry : ZeroInit<DacpHillClimbingLogEntry>
+{
+ DWORD TickCount;
+ int Transition;
+ int NewControlSetting;
+ int LastHistoryCount;
+ double LastHistoryMean;
+
+ HRESULT Request(ISOSDacInterface *sos, CLRDATA_ADDRESS entry)
+ {
+ return sos->GetHillClimbingLogEntry(entry, this);
+ }
+};
+
+
+// Used for CLR versions >= 4.0
+struct DacpThreadpoolData : ZeroInit<DacpThreadpoolData>
+{
+ LONG cpuUtilization;
+ int NumIdleWorkerThreads;
+ int NumWorkingWorkerThreads;
+ int NumRetiredWorkerThreads;
+ LONG MinLimitTotalWorkerThreads;
+ LONG MaxLimitTotalWorkerThreads;
+
+ CLRDATA_ADDRESS FirstUnmanagedWorkRequest;
+
+ CLRDATA_ADDRESS HillClimbingLog;
+ int HillClimbingLogFirstIndex;
+ int HillClimbingLogSize;
+
+ DWORD NumTimers;
+ // TODO: Add support to enumerate timers too.
+
+ LONG NumCPThreads;
+ LONG NumFreeCPThreads;
+ LONG MaxFreeCPThreads;
+ LONG NumRetiredCPThreads;
+ LONG MaxLimitTotalCPThreads;
+ LONG CurrentLimitTotalCPThreads;
+ LONG MinLimitTotalCPThreads;
+
+ CLRDATA_ADDRESS AsyncTimerCallbackCompletionFPtr;
+
+ HRESULT Request(ISOSDacInterface *sos)
+ {
+ return sos->GetThreadpoolData(this);
+ }
+};
+
+struct DacpGenerationData : ZeroInit<DacpGenerationData>
+{
+ CLRDATA_ADDRESS start_segment;
+ CLRDATA_ADDRESS allocation_start;
+
+ // These are examined only for generation 0, otherwise NULL
+ CLRDATA_ADDRESS allocContextPtr;
+ CLRDATA_ADDRESS allocContextLimit;
+};
+
+#define DAC_NUMBERGENERATIONS 4
+
+
+struct DacpAllocData : ZeroInit<DacpAllocData>
+{
+ CLRDATA_ADDRESS allocBytes;
+ CLRDATA_ADDRESS allocBytesLoh;
+};
+
+struct DacpGenerationAllocData : ZeroInit<DacpGenerationAllocData>
+{
+ DacpAllocData allocData[DAC_NUMBERGENERATIONS];
+};
+
+struct DacpGcHeapDetails : ZeroInit<DacpGcHeapDetails>
+{
+ CLRDATA_ADDRESS heapAddr; // Only filled in in server mode, otherwise NULL
+ CLRDATA_ADDRESS alloc_allocated;
+
+ CLRDATA_ADDRESS mark_array;
+ CLRDATA_ADDRESS current_c_gc_state;
+ CLRDATA_ADDRESS next_sweep_obj;
+ CLRDATA_ADDRESS saved_sweep_ephemeral_seg;
+ CLRDATA_ADDRESS saved_sweep_ephemeral_start;
+ CLRDATA_ADDRESS background_saved_lowest_address;
+ CLRDATA_ADDRESS background_saved_highest_address;
+
+ DacpGenerationData generation_table [DAC_NUMBERGENERATIONS];
+ CLRDATA_ADDRESS ephemeral_heap_segment;
+ CLRDATA_ADDRESS finalization_fill_pointers [DAC_NUMBERGENERATIONS + 3];
+ CLRDATA_ADDRESS lowest_address;
+ CLRDATA_ADDRESS highest_address;
+ CLRDATA_ADDRESS card_table;
+
+ // Use this for workstation mode (DacpGcHeapDat.bServerMode==FALSE).
+ HRESULT Request(ISOSDacInterface *sos)
+ {
+ return sos->GetGCHeapStaticData(this);
+ }
+
+ // Use this for Server mode, as there are multiple heaps,
+ // and you need to pass a heap address in addr.
+ HRESULT Request(ISOSDacInterface *sos, CLRDATA_ADDRESS addr)
+ {
+ return sos->GetGCHeapDetails(addr, this);
+ }
+};
+
+struct DacpGcHeapData
+ : ZeroInit<DacpGcHeapData>
+{
+ BOOL bServerMode;
+ BOOL bGcStructuresValid;
+ UINT HeapCount;
+ UINT g_max_generation;
+
+ HRESULT Request(ISOSDacInterface *sos)
+ {
+ return sos->GetGCHeapData(this);
+ }
+};
+
+struct DacpHeapSegmentData
+ : ZeroInit<DacpHeapSegmentData>
+{
+ CLRDATA_ADDRESS segmentAddr;
+ CLRDATA_ADDRESS allocated;
+ CLRDATA_ADDRESS committed;
+ CLRDATA_ADDRESS reserved;
+ CLRDATA_ADDRESS used;
+ CLRDATA_ADDRESS mem;
+ // pass this to request if non-null to get the next segments.
+ CLRDATA_ADDRESS next;
+ CLRDATA_ADDRESS gc_heap; // only filled in in server mode, otherwise NULL
+ // computed field: if this is the ephemeral segment highMark includes the ephemeral generation
+ CLRDATA_ADDRESS highAllocMark;
+
+ size_t flags;
+ CLRDATA_ADDRESS background_allocated;
+
+ HRESULT Request(ISOSDacInterface *sos, CLRDATA_ADDRESS addr, const DacpGcHeapDetails& heap)
+ {
+ HRESULT hr = sos->GetHeapSegmentData(addr, this);
+
+ // if this is the start segment, set highAllocMark too.
+ if (SUCCEEDED(hr))
+ {
+ // TODO: This needs to be put on the Dac side.
+ if (this->segmentAddr == heap.generation_table[0].start_segment)
+ highAllocMark = heap.alloc_allocated;
+ else
+ highAllocMark = allocated;
+ }
+ return hr;
+ }
+};
+
+struct DacpOomData : ZeroInit<DacpOomData>
+{
+ int reason;
+ ULONG64 alloc_size;
+ ULONG64 available_pagefile_mb;
+ ULONG64 gc_index;
+ int fgm;
+ ULONG64 size;
+ BOOL loh_p;
+
+ HRESULT Request(ISOSDacInterface *sos)
+ {
+ return sos->GetOOMStaticData(this);
+ }
+
+ // Use this for Server mode, as there are multiple heaps,
+ // and you need to pass a heap address in addr.
+ HRESULT Request(ISOSDacInterface *sos, CLRDATA_ADDRESS addr)
+ {
+ return sos->GetOOMData(addr, this);
+ }
+};
+
+// This is the value of max_idp_count in ndp\clr\src\vm\gcpriv.h
+#define NUM_GC_DATA_POINTS 9
+// These are from ndp\clr\src\vm\gcrecord.h
+#define MAX_COMPACT_REASONS_COUNT 11
+#define MAX_EXPAND_MECHANISMS_COUNT 6
+#define MAX_GC_MECHANISM_BITS_COUNT 2
+// This is from ndp\clr\src\vm\common.h
+#define MAX_GLOBAL_GC_MECHANISMS_COUNT 6
+struct DacpGCInterestingInfoData : ZeroInit<DacpGCInterestingInfoData>
+{
+ size_t interestingDataPoints[NUM_GC_DATA_POINTS];
+ size_t compactReasons[MAX_COMPACT_REASONS_COUNT];
+ size_t expandMechanisms[MAX_EXPAND_MECHANISMS_COUNT];
+ size_t bitMechanisms[MAX_GC_MECHANISM_BITS_COUNT];
+ size_t globalMechanisms[MAX_GLOBAL_GC_MECHANISMS_COUNT];
+
+ HRESULT RequestGlobal(ISOSDacInterface *sos)
+ {
+ HRESULT hr;
+ ISOSDacInterface3 *psos3 = NULL;
+ if (SUCCEEDED(hr = sos->QueryInterface(__uuidof(ISOSDacInterface3), (void**) &psos3)))
+ {
+ hr = psos3->GetGCGlobalMechanisms(globalMechanisms);
+ psos3->Release();
+ }
+ return hr;
+ }
+
+ HRESULT Request(ISOSDacInterface *sos)
+ {
+ HRESULT hr;
+ ISOSDacInterface3 *psos3 = NULL;
+ if (SUCCEEDED(hr = sos->QueryInterface(__uuidof(ISOSDacInterface3), (void**) &psos3)))
+ {
+ hr = psos3->GetGCInterestingInfoStaticData(this);
+ psos3->Release();
+ }
+ return hr;
+ }
+
+ // Use this for Server mode, as there are multiple heaps,
+ // and you need to pass a heap address in addr.
+ HRESULT Request(ISOSDacInterface *sos, CLRDATA_ADDRESS addr)
+ {
+ HRESULT hr;
+ ISOSDacInterface3 *psos3 = NULL;
+ if (SUCCEEDED(hr = sos->QueryInterface(__uuidof(ISOSDacInterface3), (void**) &psos3)))
+ {
+ hr = psos3->GetGCInterestingInfoData(addr, this);
+ psos3->Release();
+ }
+ return hr;
+ }
+};
+
+struct DacpGcHeapAnalyzeData
+ : ZeroInit<DacpGcHeapAnalyzeData>
+{
+ CLRDATA_ADDRESS heapAddr; // Only filled in in server mode, otherwise NULL
+
+ CLRDATA_ADDRESS internal_root_array;
+ ULONG64 internal_root_array_index;
+ BOOL heap_analyze_success;
+
+ // Use this for workstation mode (DacpGcHeapDat.bServerMode==FALSE).
+ HRESULT Request(ISOSDacInterface *sos)
+ {
+ return sos->GetHeapAnalyzeStaticData(this);
+ }
+
+ // Use this for Server mode, as there are multiple heaps,
+ // and you need to pass a heap address in addr.
+ HRESULT Request(ISOSDacInterface *sos, CLRDATA_ADDRESS addr)
+ {
+ return sos->GetHeapAnalyzeData(addr, this);
+ }
+};
+
+
+#define SYNCBLOCKDATA_COMFLAGS_CCW 1
+#define SYNCBLOCKDATA_COMFLAGS_RCW 2
+#define SYNCBLOCKDATA_COMFLAGS_CF 4
+
+struct DacpSyncBlockData : ZeroInit<DacpSyncBlockData>
+{
+ CLRDATA_ADDRESS Object;
+ BOOL bFree; // if set, no other fields are useful
+
+ // fields below provide data from this, so it's just for display
+ CLRDATA_ADDRESS SyncBlockPointer;
+ DWORD COMFlags;
+ UINT MonitorHeld;
+ UINT Recursion;
+ CLRDATA_ADDRESS HoldingThread;
+ UINT AdditionalThreadCount;
+ CLRDATA_ADDRESS appDomainPtr;
+
+ // SyncBlockCount will always be filled in with the number of SyncBlocks.
+ // SyncBlocks may be requested from [1,SyncBlockCount]
+ UINT SyncBlockCount;
+
+ // SyncBlockNumber must be from [1,SyncBlockCount]
+ // If there are no SyncBlocks, a call to Request with SyncBlockCount = 1
+ // will return E_FAIL.
+ HRESULT Request(ISOSDacInterface *sos, UINT SyncBlockNumber)
+ {
+ return sos->GetSyncBlockData(SyncBlockNumber, this);
+ }
+};
+
+struct DacpSyncBlockCleanupData : ZeroInit<DacpSyncBlockCleanupData>
+{
+ CLRDATA_ADDRESS SyncBlockPointer;
+
+ CLRDATA_ADDRESS nextSyncBlock;
+ CLRDATA_ADDRESS blockRCW;
+ CLRDATA_ADDRESS blockClassFactory;
+ CLRDATA_ADDRESS blockCCW;
+
+ // Pass NULL on the first request to start a traversal.
+ HRESULT Request(ISOSDacInterface *sos, CLRDATA_ADDRESS psyncBlock)
+ {
+ return sos->GetSyncBlockCleanupData(psyncBlock, this);
+ }
+};
+
+///////////////////////////////////////////////////////////////////////////
+
+enum EHClauseType {EHFault, EHFinally, EHFilter, EHTyped, EHUnknown};
+
+struct DACEHInfo : ZeroInit<DACEHInfo>
+{
+ EHClauseType clauseType;
+ CLRDATA_ADDRESS tryStartOffset;
+ CLRDATA_ADDRESS tryEndOffset;
+ CLRDATA_ADDRESS handlerStartOffset;
+ CLRDATA_ADDRESS handlerEndOffset;
+ BOOL isDuplicateClause;
+ CLRDATA_ADDRESS filterOffset; // valid when clauseType is EHFilter
+ BOOL isCatchAllHandler; // valid when clauseType is EHTyped
+ CLRDATA_ADDRESS moduleAddr; // when == 0 mtCatch contains a MethodTable, when != 0 tokCatch contains a type token
+ CLRDATA_ADDRESS mtCatch; // the method table of the TYPED clause type
+ mdToken tokCatch; // the type token of the TYPED clause type
+};
+
+struct DacpGetModuleAddress : ZeroInit<DacpGetModuleAddress>
+{
+ CLRDATA_ADDRESS ModulePtr;
+ HRESULT Request(IXCLRDataModule* pDataModule)
+ {
+ return pDataModule->Request(DACDATAMODULEPRIV_REQUEST_GET_MODULEPTR, 0, NULL, sizeof(*this), (PBYTE) this);
+ }
+};
+
+struct DacpGetModuleData : ZeroInit<DacpGetModuleData>
+{
+ BOOL IsDynamic;
+ BOOL IsInMemory;
+ BOOL IsFileLayout;
+ CLRDATA_ADDRESS PEFile;
+ CLRDATA_ADDRESS LoadedPEAddress;
+ ULONG64 LoadedPESize;
+ CLRDATA_ADDRESS InMemoryPdbAddress;
+ ULONG64 InMemoryPdbSize;
+
+ HRESULT Request(IXCLRDataModule* pDataModule)
+ {
+ return pDataModule->Request(DACDATAMODULEPRIV_REQUEST_GET_MODULEDATA, 0, NULL, sizeof(*this), (PBYTE) this);
+ }
+};
+
+struct DacpFrameData : ZeroInit<DacpFrameData>
+{
+ CLRDATA_ADDRESS frameAddr;
+
+ // Could also be implemented for IXCLRDataFrame if desired.
+ HRESULT Request(IXCLRDataStackWalk* dac)
+ {
+ return dac->Request(DACSTACKPRIV_REQUEST_FRAME_DATA,
+ 0, NULL,
+ sizeof(*this), (PBYTE)this);
+ }
+};
+
+struct DacpJitManagerInfo : ZeroInit<DacpJitManagerInfo>
+{
+ CLRDATA_ADDRESS managerAddr;
+ DWORD codeType; // for union below
+ CLRDATA_ADDRESS ptrHeapList; // A HeapList * if IsMiIL(codeType)
+};
+
+enum CodeHeapType {CODEHEAP_LOADER=0,CODEHEAP_HOST,CODEHEAP_UNKNOWN};
+
+struct DacpJitCodeHeapInfo : ZeroInit<DacpJitCodeHeapInfo>
+{
+ DWORD codeHeapType; // for union below
+
+ union
+ {
+ CLRDATA_ADDRESS LoaderHeap; // if CODEHEAP_LOADER
+ struct
+ {
+ CLRDATA_ADDRESS baseAddr; // if CODEHEAP_HOST
+ CLRDATA_ADDRESS currentAddr;
+ } HostData;
+ };
+};
+
+#include "static_assert.h"
+
+/* DAC datastructures are frozen as of dev11 shipping. Do NOT add fields, remove fields, or change the fields of
+ * these structs in any way. The correct way to get new data out of the runtime is to create a new struct and
+ * add a new function to the latest Dac<-->SOS interface to produce this data.
+ */
+static_assert(sizeof(DacpAllocData) == 0x10, "Dacp structs cannot be modified due to backwards compatibility.");
+static_assert(sizeof(DacpGenerationAllocData) == 0x40, "Dacp structs cannot be modified due to backwards compatibility.");
+static_assert(sizeof(DacpSyncBlockCleanupData) == 0x28, "Dacp structs cannot be modified due to backwards compatibility.");
+static_assert(sizeof(DacpThreadStoreData) == 0x38, "Dacp structs cannot be modified due to backwards compatibility.");
+static_assert(sizeof(DacpAppDomainStoreData) == 0x18, "Dacp structs cannot be modified due to backwards compatibility.");
+static_assert(sizeof(DacpAppDomainData) == 0x48, "Dacp structs cannot be modified due to backwards compatibility.");
+static_assert(sizeof(DacpAssemblyData) == 0x40, "Dacp structs cannot be modified due to backwards compatibility.");
+static_assert(sizeof(DacpThreadData) == 0x68, "Dacp structs cannot be modified due to backwards compatibility.");
+static_assert(sizeof(DacpMethodDescData) == 0x98, "Dacp structs cannot be modified due to backwards compatibility.");
+static_assert(sizeof(DacpCodeHeaderData) == 0x38, "Dacp structs cannot be modified due to backwards compatibility.");
+static_assert(sizeof(DacpThreadpoolData) == 0x58, "Dacp structs cannot be modified due to backwards compatibility.");
+static_assert(sizeof(DacpObjectData) == 0x60, "Dacp structs cannot be modified due to backwards compatibility.");
+static_assert(sizeof(DacpMethodTableData) == 0x48, "Dacp structs cannot be modified due to backwards compatibility.");
+static_assert(sizeof(DacpWorkRequestData) == 0x18, "Dacp structs cannot be modified due to backwards compatibility.");
+static_assert(sizeof(DacpFieldDescData) == 0x40, "Dacp structs cannot be modified due to backwards compatibility.");
+static_assert(sizeof(DacpModuleData) == 0xa0, "Dacp structs cannot be modified due to backwards compatibility.");
+static_assert(sizeof(DacpGcHeapData) == 0x10, "Dacp structs cannot be modified due to backwards compatibility.");
+static_assert(sizeof(DacpJitManagerInfo) == 0x18, "Dacp structs cannot be modified due to backwards compatibility.");
+static_assert(sizeof(DacpHeapSegmentData) == 0x58, "Dacp structs cannot be modified due to backwards compatibility.");
+static_assert(sizeof(DacpDomainLocalModuleData) == 0x30, "Dacp structs cannot be modified due to backwards compatibility.");
+static_assert(sizeof(DacpUsefulGlobalsData) == 0x28, "Dacp structs cannot be modified due to backwards compatibility.");
+static_assert(sizeof(DACEHInfo) == 0x58, "Dacp structs cannot be modified due to backwards compatibility.");
+static_assert(sizeof(DacpRCWData) == 0x58, "Dacp structs cannot be modified due to backwards compatibility.");
+static_assert(sizeof(DacpCCWData) == 0x48, "Dacp structs cannot be modified due to backwards compatibility.");
+static_assert(sizeof(DacpMethodTableFieldData) == 0x18, "Dacp structs cannot be modified due to backwards compatibility.");
+static_assert(sizeof(DacpMethodTableTransparencyData) == 0xc, "Dacp structs cannot be modified due to backwards compatibility.");
+static_assert(sizeof(DacpThreadLocalModuleData) == 0x30, "Dacp structs cannot be modified due to backwards compatibility.");
+static_assert(sizeof(DacpCOMInterfacePointerData) == 0x18, "Dacp structs cannot be modified due to backwards compatibility.");
+static_assert(sizeof(DacpMethodDescTransparencyData) == 0xc, "Dacp structs cannot be modified due to backwards compatibility.");
+static_assert(sizeof(DacpHillClimbingLogEntry) == 0x18, "Dacp structs cannot be modified due to backwards compatibility.");
+static_assert(sizeof(DacpGenerationData) == 0x20, "Dacp structs cannot be modified due to backwards compatibility.");
+static_assert(sizeof(DacpGcHeapDetails) == 0x120, "Dacp structs cannot be modified due to backwards compatibility.");
+static_assert(sizeof(DacpOomData) == 0x38, "Dacp structs cannot be modified due to backwards compatibility.");
+static_assert(sizeof(DacpGcHeapAnalyzeData) == 0x20, "Dacp structs cannot be modified due to backwards compatibility.");
+static_assert(sizeof(DacpSyncBlockData) == 0x48, "Dacp structs cannot be modified due to backwards compatibility.");
+static_assert(sizeof(DacpGetModuleAddress) == 0x8, "Dacp structs cannot be modified due to backwards compatibility.");
+static_assert(sizeof(DacpFrameData) == 0x8, "Dacp structs cannot be modified due to backwards compatibility.");
+static_assert(sizeof(DacpJitCodeHeapInfo) == 0x18, "Dacp structs cannot be modified due to backwards compatibility.");
+static_assert(sizeof(DacpExceptionObjectData) == 0x38, "Dacp structs cannot be modified due to backwards compatibility.");
+
+#endif // _DACPRIVATE_H_
diff --git a/src/inc/dacvars.h b/src/inc/dacvars.h
new file mode 100644
index 0000000000..fb052b3f5d
--- /dev/null
+++ b/src/inc/dacvars.h
@@ -0,0 +1,339 @@
+// 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.
+// This file contains the globals and statics that are visible to DAC.
+// It is used for the following:
+// 1. in daccess.h to build the table of DAC globals
+// 2. in enummem.cpp to dump out the related memory of static and globals
+// in a mini dump or heap dump
+// 3. in DacUpdateDll and toolbox\DacTablenGen\main.cs
+//
+// To use this functionality for other tools or purposes, define the
+// DEFINE_DACVAR macro & include dacvars.h like so (see enummem.cpp and/or
+// daccess.h for examples):
+//
+// #define DEFINE_DACVAR(type, size, id, var) type id; //this defn. discards
+// //the size
+// #include "dacvars.h"
+//
+// @dbgtodo:
+// Ideally we may be able to build a tool that generates this automatically.
+// At the least, we should automatically verify that the contents of this file
+// are consistent with the uses of all the macros like SVAL_DECL and GARY_DECL.
+//
+//=================================================
+// INSTRUCTIONS FOR ADDING VARIABLES TO THIS FILE
+//=================================================
+// You need to add a global or static declared with DAC macros, such as SPTR_*
+// GPTR_*, SVAL_*, GVAL_*, or GARY_*, only if the global or static is actually used
+// in a DACized code path. If you have declared a static or global that way just
+// because you were pattern-matching or because you anticipate that the variable
+// may eventually be used in a DACized code path, you don't need to add it here,
+// although in that case, you should not really use the DAC macro when you declare
+// the global or static.
+// * * *
+// The FIRST ARGUMENT should always be specified as ULONG. This is the type of
+// the offsets for the corresponding id in the _DacGlobals table.
+// @dbgtodo:
+// We should get rid of the ULONG argument since it's always the same. We would
+// also need to modify DacTablenGen\main.cs.
+// * * *
+// The SECOND ARGUMENT, "true_type," is used to calculate the true size of the
+// static/global variable. It is currently used only in enummem.cpp to write out
+// theproper size of memory for dumps.
+// * * *
+// The THIRD ARGUMENT should be a qualified name. If the variable is a static data
+// member, the name should be <class_name>__<member_name>. If the variable is a
+// global, the name should be <dac>__<global_name>.
+// * * *
+// The FOURTH ARGUMENT should be the actual name of the static/global variable. If
+// static data the should be [<namespace>::]<class_name>::<member_name>. If global,
+// it should look like <global_name>.
+// * * *
+// If you need to add an entry to this file, your type may not be visible when
+// this file is compiled. In that case, you need to do one of two things:
+// - If the type is a pointer type, you can simply use UNKNOWN_POINTER_TYPE as the
+// "true type." It may be useful to specify the non-visible type in a comment.
+// - If the type is a composite/user-defined type, you must #include the header
+// file that defines the type in enummem.cpp. Do NOT #include it in daccess.h
+// Array types may be dumped via an explicit call to enumMem, so they should
+// be declared with DEFINE_DACVAR_NO_DUMP. The size in this case is immaterial, since
+// nothing will be dumped.
+
+#ifndef DEFINE_DACVAR
+#define DEFINE_DACVAR(type, true_type, id, var)
+#endif
+
+// Use this macro for any server (namespace SVR) variables
+#ifndef DEFINE_DACVAR_SVR
+#define DEFINE_DACVAR_SVR(type, true_type, id, var)
+#endif
+
+// Use this macro to define a static var that is known to DAC, but not captured in a dump.
+#ifndef DEFINE_DACVAR_NO_DUMP
+#define DEFINE_DACVAR_NO_DUMP(type, true_type, id, var)
+#endif
+
+#define UNKNOWN_POINTER_TYPE SIZE_T
+
+DEFINE_DACVAR(ULONG, PTR_RangeSection, ExecutionManager__m_CodeRangeList, ExecutionManager::m_CodeRangeList)
+DEFINE_DACVAR(ULONG, PTR_EECodeManager, ExecutionManager__m_pDefaultCodeMan, ExecutionManager::m_pDefaultCodeMan)
+DEFINE_DACVAR(ULONG, LONG, ExecutionManager__m_dwReaderCount, ExecutionManager::m_dwReaderCount)
+DEFINE_DACVAR(ULONG, LONG, ExecutionManager__m_dwWriterLock, ExecutionManager::m_dwWriterLock)
+
+DEFINE_DACVAR(ULONG, PTR_EEJitManager, ExecutionManager__m_pEEJitManager, ExecutionManager::m_pEEJitManager)
+#ifdef FEATURE_PREJIT
+DEFINE_DACVAR(ULONG, PTR_NativeImageJitManager, ExecutionManager__m_pNativeImageJitManager, ExecutionManager::m_pNativeImageJitManager)
+#endif
+#ifdef FEATURE_READYTORUN
+DEFINE_DACVAR(ULONG, PTR_ReadyToRunJitManager, ExecutionManager__m_pReadyToRunJitManager, ExecutionManager::m_pReadyToRunJitManager)
+#endif
+
+DEFINE_DACVAR_NO_DUMP(ULONG, VMHELPDEF *, dac__hlpFuncTable, ::hlpFuncTable)
+DEFINE_DACVAR(ULONG, VMHELPDEF *, dac__hlpDynamicFuncTable, ::hlpDynamicFuncTable)
+
+#ifdef FEATURE_INCLUDE_ALL_INTERFACES
+DEFINE_DACVAR(ULONG, PTR_ConnectionNameTable, CCLRDebugManager__m_pConnectionNameHash, CCLRDebugManager::m_pConnectionNameHash)
+#endif // FEATURE_INCLUDE_ALL_INTERFACES
+DEFINE_DACVAR(ULONG, PTR_StubManager, StubManager__g_pFirstManager, StubManager::g_pFirstManager)
+DEFINE_DACVAR(ULONG, PTR_PrecodeStubManager, PrecodeStubManager__g_pManager, PrecodeStubManager::g_pManager)
+DEFINE_DACVAR(ULONG, PTR_StubLinkStubManager, StubLinkStubManager__g_pManager, StubLinkStubManager::g_pManager)
+DEFINE_DACVAR(ULONG, PTR_ThunkHeapStubManager, ThunkHeapStubManager__g_pManager, ThunkHeapStubManager::g_pManager)
+DEFINE_DACVAR(ULONG, PTR_JumpStubStubManager, JumpStubStubManager__g_pManager, JumpStubStubManager::g_pManager)
+DEFINE_DACVAR(ULONG, PTR_RangeSectionStubManager, RangeSectionStubManager__g_pManager, RangeSectionStubManager::g_pManager)
+DEFINE_DACVAR(ULONG, PTR_DelegateInvokeStubManager, DelegateInvokeStubManager__g_pManager, DelegateInvokeStubManager::g_pManager)
+DEFINE_DACVAR(ULONG, PTR_VirtualCallStubManagerManager, VirtualCallStubManagerManager__g_pManager, VirtualCallStubManagerManager::g_pManager)
+
+DEFINE_DACVAR(ULONG, PTR_ThreadStore, ThreadStore__s_pThreadStore, ThreadStore::s_pThreadStore)
+
+DEFINE_DACVAR(ULONG, int, ThreadpoolMgr__cpuUtilization, ThreadpoolMgr::cpuUtilization)
+DEFINE_DACVAR(ULONG, ThreadpoolMgr::ThreadCounter, ThreadpoolMgr__WorkerCounter, ThreadpoolMgr::WorkerCounter)
+DEFINE_DACVAR(ULONG, int, ThreadpoolMgr__MinLimitTotalWorkerThreads, ThreadpoolMgr::MinLimitTotalWorkerThreads)
+DEFINE_DACVAR(ULONG, DWORD, ThreadpoolMgr__MaxLimitTotalWorkerThreads, ThreadpoolMgr::MaxLimitTotalWorkerThreads)
+DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE /*PTR_WorkRequest*/, ThreadpoolMgr__WorkRequestHead, ThreadpoolMgr::WorkRequestHead) // PTR_WorkRequest is not defined. So use a pointer type
+DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE /*PTR_WorkRequest*/, ThreadpoolMgr__WorkRequestTail, ThreadpoolMgr::WorkRequestTail) //
+DEFINE_DACVAR(ULONG, ThreadpoolMgr::ThreadCounter, ThreadpoolMgr__CPThreadCounter, ThreadpoolMgr::CPThreadCounter)
+DEFINE_DACVAR(ULONG, LONG, ThreadpoolMgr__MaxFreeCPThreads, ThreadpoolMgr::MaxFreeCPThreads)
+DEFINE_DACVAR(ULONG, LONG, ThreadpoolMgr__MaxLimitTotalCPThreads, ThreadpoolMgr::MaxLimitTotalCPThreads)
+DEFINE_DACVAR(ULONG, LONG, ThreadpoolMgr__MinLimitTotalCPThreads, ThreadpoolMgr::MinLimitTotalCPThreads)
+DEFINE_DACVAR(ULONG, LIST_ENTRY, ThreadpoolMgr__TimerQueue, ThreadpoolMgr::TimerQueue)
+DEFINE_DACVAR_NO_DUMP(ULONG, SIZE_T, dac__HillClimbingLog, ::HillClimbingLog)
+DEFINE_DACVAR(ULONG, int, dac__HillClimbingLogFirstIndex, ::HillClimbingLogFirstIndex)
+DEFINE_DACVAR(ULONG, int, dac__HillClimbingLogSize, ::HillClimbingLogSize)
+
+DEFINE_DACVAR(ULONG, PTR_Thread, dac__g_pFinalizerThread, ::g_pFinalizerThread)
+DEFINE_DACVAR(ULONG, PTR_Thread, dac__g_pSuspensionThread, ::g_pSuspensionThread)
+
+#ifdef FEATURE_SVR_GC
+DEFINE_DACVAR(ULONG, DWORD, GCHeap__gcHeapType, GCHeap::gcHeapType)
+#endif // FEATURE_SVR_GC
+
+DEFINE_DACVAR(ULONG, PTR_BYTE, WKS__gc_heap__alloc_allocated, WKS::gc_heap::alloc_allocated)
+DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE /*PTR_heap_segment*/, WKS__gc_heap__ephemeral_heap_segment, WKS::gc_heap::ephemeral_heap_segment)
+DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE /*PTR_CFinalize*/, WKS__gc_heap__finalize_queue, WKS::gc_heap::finalize_queue)
+
+// Can not use MULTIPLE_HEAPS here because desktop build contains it is not defined for workstation GC
+// but we include workstation GC in mscorwks.dll.
+#ifdef FEATURE_SVR_GC
+DEFINE_DACVAR_SVR(ULONG, int, SVR__gc_heap__n_heaps, SVR::gc_heap::n_heaps)
+DEFINE_DACVAR_SVR(ULONG, UNKNOWN_POINTER_TYPE /*(PTR_gc_heap*)*/, SVR__gc_heap__g_heaps, SVR::gc_heap::g_heaps)
+#endif // FEATURE_SVR_GC
+DEFINE_DACVAR(ULONG, oom_history, WKS__gc_heap__oom_info, WKS::gc_heap::oom_info)
+
+DEFINE_DACVAR(ULONG, PTR_SystemDomain, SystemDomain__m_pSystemDomain, SystemDomain::m_pSystemDomain)
+DEFINE_DACVAR(ULONG, ArrayListStatic, SystemDomain__m_appDomainIndexList, SystemDomain::m_appDomainIndexList)
+DEFINE_DACVAR(ULONG, BOOL, SystemDomain__s_fForceDebug, SystemDomain::s_fForceDebug)
+DEFINE_DACVAR(ULONG, BOOL, SystemDomain__s_fForceProfiling, SystemDomain::s_fForceProfiling)
+DEFINE_DACVAR(ULONG, BOOL, SystemDomain__s_fForceInstrument, SystemDomain::s_fForceInstrument)
+DEFINE_DACVAR(ULONG, PTR_SharedDomain, SharedDomain__m_pSharedDomain, SharedDomain::m_pSharedDomain)
+
+
+DEFINE_DACVAR(ULONG, DWORD, CExecutionEngine__TlsIndex, CExecutionEngine::TlsIndex)
+
+DEFINE_DACVAR(ULONG, LONG, GCScan__m_GcStructuresInvalidCnt, GCScan::m_GcStructuresInvalidCnt)
+
+#if defined(FEATURE_INCLUDE_ALL_INTERFACES) || defined(FEATURE_WINDOWSPHONE)
+DEFINE_DACVAR(ULONG, int, CCLRErrorReportingManager__g_ECustomDumpFlavor, CCLRErrorReportingManager::g_ECustomDumpFlavor)
+#endif
+
+DEFINE_DACVAR(ULONG, PTR_SString, SString__s_Empty, SString::s_Empty)
+
+#ifdef FEATURE_APPX
+#if defined(FEATURE_CORECLR)
+DEFINE_DACVAR(ULONG, BOOL, dac__g_fAppX, ::g_fAppX)
+#else
+DEFINE_DACVAR(ULONG, PTR_AppXRTInfo, dac__g_pAppXRTInfo, ::g_pAppXRTInfo)
+#endif
+#endif // FEATURE_APPX
+
+DEFINE_DACVAR(ULONG, BOOL, SString__s_IsANSIMultibyte, SString::s_IsANSIMultibyte)
+
+#ifdef FEATURE_REMOTING
+DEFINE_DACVAR_NO_DUMP(ULONG, MethodTable, CTPMethodTable__s_pThunkTable, CTPMethodTable::s_pThunkTable)
+#endif // FEATURE_REMOTING
+
+DEFINE_DACVAR(ULONG, INT32, ArrayBase__s_arrayBoundsZero, ArrayBase::s_arrayBoundsZero)
+
+DEFINE_DACVAR(ULONG, BOOL, StackwalkCache__s_Enabled, StackwalkCache::s_Enabled)
+
+DEFINE_DACVAR(ULONG, PTR_JITNotification, dac__g_pNotificationTable, ::g_pNotificationTable)
+DEFINE_DACVAR(ULONG, ULONG32, dac__g_dacNotificationFlags, ::g_dacNotificationFlags)
+DEFINE_DACVAR(ULONG, PTR_GcNotification, dac__g_pGcNotificationTable, ::g_pGcNotificationTable)
+
+#ifndef FEATURE_IMPLICIT_TLS
+DEFINE_DACVAR(ULONG, DWORD, dac__gThreadTLSIndex, ::gThreadTLSIndex)
+DEFINE_DACVAR(ULONG, DWORD, dac__gAppDomainTLSIndex, ::gAppDomainTLSIndex)
+#endif
+
+DEFINE_DACVAR(ULONG, PTR_EEConfig, dac__g_pConfig, ::g_pConfig)
+
+DEFINE_DACVAR(ULONG, MscorlibBinder, dac__g_Mscorlib, ::g_Mscorlib)
+
+#if defined(PROFILING_SUPPORTED) || defined(PROFILING_SUPPORTED_DATA)
+DEFINE_DACVAR(ULONG, ProfControlBlock, dac__g_profControlBlock, ::g_profControlBlock)
+#endif // defined(PROFILING_SUPPORTED) || defined(PROFILING_SUPPORTED_DATA)
+
+DEFINE_DACVAR_NO_DUMP(ULONG, SIZE_T, dac__generation_table, WKS::generation_table)
+DEFINE_DACVAR(ULONG, PTR_DWORD, dac__g_card_table, ::g_card_table)
+DEFINE_DACVAR(ULONG, PTR_BYTE, dac__g_lowest_address, ::g_lowest_address)
+DEFINE_DACVAR(ULONG, PTR_BYTE, dac__g_highest_address, ::g_highest_address)
+
+DEFINE_DACVAR(ULONG, GCHeap, dac__g_pGCHeap, ::g_pGCHeap)
+
+#ifdef GC_CONFIG_DRIVEN
+DEFINE_DACVAR_NO_DUMP(ULONG, SIZE_T, dac__interesting_data_per_heap, WKS::interesting_data_per_heap)
+DEFINE_DACVAR_NO_DUMP(ULONG, SIZE_T, dac__compact_reasons_per_heap, WKS::compact_reasons_per_heap)
+DEFINE_DACVAR_NO_DUMP(ULONG, SIZE_T, dac__expand_mechanisms_per_heap, WKS::expand_mechanisms_per_heap)
+DEFINE_DACVAR_NO_DUMP(ULONG, SIZE_T, dac__interesting_mechanism_bits_per_heap, WKS::interesting_mechanism_bits_per_heap)
+DEFINE_DACVAR_NO_DUMP(ULONG, SIZE_T, dac__gc_global_mechanisms, ::gc_global_mechanisms)
+#endif //GC_CONFIG_DRIVEN
+
+DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE, dac__g_pThinLockThreadIdDispenser, ::g_pThinLockThreadIdDispenser)
+DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE, dac__g_pModuleIndexDispenser, ::g_pModuleIndexDispenser)
+DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE, dac__g_pObjectClass, ::g_pObjectClass)
+DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE, dac__g_pRuntimeTypeClass, ::g_pRuntimeTypeClass)
+DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE, dac__g_pCanonMethodTableClass, ::g_pCanonMethodTableClass)
+DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE, dac__g_pStringClass, ::g_pStringClass)
+DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE, dac__g_pArrayClass, ::g_pArrayClass)
+DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE, dac__g_pSZArrayHelperClass, ::g_pSZArrayHelperClass)
+DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE, dac__g_pNullableClass, ::g_pNullableClass)
+DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE, dac__g_pExceptionClass, ::g_pExceptionClass)
+DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE, dac__g_pThreadAbortExceptionClass, ::g_pThreadAbortExceptionClass)
+DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE, dac__g_pOutOfMemoryExceptionClass, ::g_pOutOfMemoryExceptionClass)
+DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE, dac__g_pStackOverflowExceptionClass, ::g_pStackOverflowExceptionClass)
+DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE, dac__g_pExecutionEngineExceptionClass, ::g_pExecutionEngineExceptionClass)
+DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE, dac__g_pDelegateClass, ::g_pDelegateClass)
+DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE, dac__g_pMulticastDelegateClass, ::g_pMulticastDelegateClass)
+DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE, dac__g_pFreeObjectMethodTable, ::g_pFreeObjectMethodTable)
+DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE, dac__g_pOverlappedDataClass, ::g_pOverlappedDataClass)
+DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE, dac__g_pValueTypeClass, ::g_pValueTypeClass)
+DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE, dac__g_pEnumClass, ::g_pEnumClass)
+DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE, dac__g_pThreadClass, ::g_pThreadClass)
+DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE, dac__g_pCriticalFinalizerObjectClass, ::g_pCriticalFinalizerObjectClass)
+DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE, dac__g_pAsyncFileStream_AsyncResultClass, ::g_pAsyncFileStream_AsyncResultClass)
+DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE, dac__g_pPredefinedArrayTypes, ::g_pPredefinedArrayTypes)
+DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE, dac__g_TypedReferenceMT, ::g_TypedReferenceMT)
+DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE, dac__g_pByteArrayMT, ::g_pByteArrayMT)
+
+#ifdef FEATURE_COMINTEROP
+DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE, dac__g_pBaseCOMObject, ::g_pBaseCOMObject)
+DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE, dac__g_pBaseRuntimeClass, ::g_pBaseRuntimeClass)
+#endif
+
+#ifdef FEATURE_ICASTABLE
+DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE, dac__g_pICastableInterface, ::g_pICastableInterface)
+#endif // FEATURE_ICASTABLE
+
+DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE, dac__g_pPrepareConstrainedRegionsMethod, ::g_pPrepareConstrainedRegionsMethod)
+DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE, dac__g_pExecuteBackoutCodeHelperMethod, ::g_pExecuteBackoutCodeHelperMethod)
+
+DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE, dac__g_pObjectCtorMD, ::g_pObjectCtorMD)
+DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE, dac__g_pObjectFinalizerMD, ::g_pObjectFinalizerMD)
+
+DEFINE_DACVAR(ULONG, bool, dac__g_fProcessDetach, ::g_fProcessDetach)
+DEFINE_DACVAR(ULONG, DWORD, dac__g_fEEShutDown, ::g_fEEShutDown)
+DEFINE_DACVAR(ULONG, DWORD, dac__g_fHostConfig, ::g_fHostConfig)
+
+DEFINE_DACVAR(ULONG, ULONG, dac__g_CORDebuggerControlFlags, ::g_CORDebuggerControlFlags)
+DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE, dac__g_pDebugger, ::g_pDebugger)
+DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE, dac__g_pDebugInterface, ::g_pDebugInterface)
+DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE, dac__g_pEEDbgInterfaceImpl, ::g_pEEDbgInterfaceImpl)
+DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE, dac__g_pEEInterface, ::g_pEEInterface)
+
+DEFINE_DACVAR(ULONG, BOOL, Debugger__s_fCanChangeNgenFlags, Debugger::s_fCanChangeNgenFlags)
+
+DEFINE_DACVAR(ULONG, PTR_DebuggerPatchTable, DebuggerController__g_patches, DebuggerController::g_patches)
+DEFINE_DACVAR(ULONG, BOOL, DebuggerController__g_patchTableValid, DebuggerController::g_patchTableValid)
+
+
+DEFINE_DACVAR(ULONG, SIZE_T, dac__gLowestFCall, ::gLowestFCall)
+DEFINE_DACVAR(ULONG, SIZE_T, dac__gHighestFCall, ::gHighestFCall)
+DEFINE_DACVAR(ULONG, SIZE_T, dac__gFCallMethods, ::gFCallMethods)
+
+DEFINE_DACVAR(ULONG, PTR_SyncTableEntry, dac__g_pSyncTable, ::g_pSyncTable)
+#ifdef FEATURE_COMINTEROP
+DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE, dac__g_pRCWCleanupList, ::g_pRCWCleanupList)
+DEFINE_DACVAR(ULONG, BOOL, RCWWalker__s_bIsGlobalPeggingOn, RCWWalker::s_bIsGlobalPeggingOn)
+#endif // FEATURE_COMINTEROP
+
+#ifndef FEATURE_PAL
+DEFINE_DACVAR(ULONG, SIZE_T, dac__g_runtimeLoadedBaseAddress, ::g_runtimeLoadedBaseAddress)
+DEFINE_DACVAR(ULONG, SIZE_T, dac__g_runtimeVirtualSize, ::g_runtimeVirtualSize)
+#endif // !FEATURE_PAL
+
+DEFINE_DACVAR(ULONG, SyncBlockCache *, SyncBlockCache__s_pSyncBlockCache, SyncBlockCache::s_pSyncBlockCache)
+
+DEFINE_DACVAR(ULONG, HandleTableMap, dac__g_HandleTableMap, ::g_HandleTableMap)
+DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE, dac__g_pStressLog, ::g_pStressLog)
+
+DEFINE_DACVAR(ULONG, SIZE_T, dac__s_gsCookie, ::s_gsCookie)
+
+#ifdef FEATURE_IPCMAN
+DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE, dac__g_pIPCManagerInterface, ::g_pIPCManagerInterface)
+#endif // FEATURE_IPCMAN
+
+DEFINE_DACVAR_NO_DUMP(ULONG, SIZE_T, dac__g_FCDynamicallyAssignedImplementations, ::g_FCDynamicallyAssignedImplementations)
+
+DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE /*BYTE**/, WKS__gc_heap__internal_root_array, WKS::gc_heap::internal_root_array)
+DEFINE_DACVAR(ULONG, size_t, WKS__gc_heap__internal_root_array_index, WKS::gc_heap::internal_root_array_index)
+DEFINE_DACVAR(ULONG, ULONG, WKS__gc_heap__heap_analyze_success, WKS::gc_heap::heap_analyze_success)
+
+DEFINE_DACVAR(ULONG, SIZE_T, WKS__gc_heap__mark_array, WKS::gc_heap::mark_array)
+DEFINE_DACVAR(ULONG, SIZE_T, WKS__gc_heap__current_c_gc_state, WKS::gc_heap::current_c_gc_state)
+DEFINE_DACVAR(ULONG, PTR_BYTE, WKS__gc_heap__next_sweep_obj, WKS::gc_heap::next_sweep_obj)
+DEFINE_DACVAR(ULONG, UNKNOWN_POINTER_TYPE /* PTR_heap_segment */, WKS__gc_heap__saved_sweep_ephemeral_seg, WKS::gc_heap::saved_sweep_ephemeral_seg)
+DEFINE_DACVAR(ULONG, PTR_BYTE, WKS__gc_heap__saved_sweep_ephemeral_start, WKS::gc_heap::saved_sweep_ephemeral_start)
+DEFINE_DACVAR(ULONG, PTR_BYTE, WKS__gc_heap__background_saved_lowest_address, WKS::gc_heap::background_saved_lowest_address)
+DEFINE_DACVAR(ULONG, PTR_BYTE, WKS__gc_heap__background_saved_highest_address, WKS::gc_heap::background_saved_highest_address)
+
+#ifdef FEATURE_CORECLR
+#ifndef FEATURE_PAL
+DEFINE_DACVAR(ULONG, HANDLE, dac__g_hContinueStartupEvent, ::g_hContinueStartupEvent)
+#endif // !FEATURE_PAL
+DEFINE_DACVAR(ULONG, DWORD, CorHost2__m_dwStartupFlags, CorHost2::m_dwStartupFlags)
+#endif // FEATURE_CORECLR
+
+DEFINE_DACVAR(ULONG, HRESULT, dac__g_hrFatalError, ::g_hrFatalError)
+
+#if defined(DEBUGGING_SUPPORTED) && defined (FEATURE_PREJIT)
+ DEFINE_DACVAR(ULONG, DWORD, PEFile__s_NGENDebugFlags, PEFile::s_NGENDebugFlags)
+#endif //defined(DEBUGGING_SUPPORTED) && defined (FEATURE_PREJIT)
+
+#ifndef FEATURE_CORECLR
+DEFINE_DACVAR(ULONG, DWORD, AssemblyUsageLogManager__s_UsageLogFlags, AssemblyUsageLogManager::s_UsageLogFlags)
+#endif // FEATURE_CORECLR
+
+#if defined(FEATURE_APPX_BINDER)
+DEFINE_DACVAR(ULONG, PTR_CLRPrivBinderAppX, CLRPrivBinderAppX__s_pSingleton, CLRPrivBinderAppX::s_pSingleton)
+#endif //defined(FEATURE_APPX)
+
+#ifdef FEATURE_MINIMETADATA_IN_TRIAGEDUMPS
+DEFINE_DACVAR(ULONG, DWORD, dac__g_MiniMetaDataBuffMaxSize, ::g_MiniMetaDataBuffMaxSize)
+DEFINE_DACVAR(ULONG, TADDR, dac__g_MiniMetaDataBuffAddress, ::g_MiniMetaDataBuffAddress)
+#endif // FEATURE_MINIMETADATA_IN_TRIAGEDUMPS
+
+DEFINE_DACVAR(ULONG, SIZE_T, dac__g_clrNotificationArguments, ::g_clrNotificationArguments)
+
+#undef DEFINE_DACVAR
+#undef DEFINE_DACVAR_SVR
+#undef DEFINE_DACVAR_NO_DUMP
diff --git a/src/inc/dbgconfigstrings.h b/src/inc/dbgconfigstrings.h
new file mode 100644
index 0000000000..acbb7eb0ac
--- /dev/null
+++ b/src/inc/dbgconfigstrings.h
@@ -0,0 +1,23 @@
+// 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.
+
+//
+// This header lists the names of the string resources used by the Windows portion of Mac CoreCLR debugging
+// configuration. It's designed to be included multiple times with different definitions of CORECLR_STRING_DEF
+// to build either enumerated integer values for each key or a table mapping enum values to key names.
+//
+
+CORECLR_STRING_DEF(CreateFile)
+CORECLR_STRING_DEF(WriteFile)
+CORECLR_STRING_DEF(CreateDir)
+CORECLR_STRING_DEF(InternalError)
+CORECLR_STRING_DEF(DecryptFailure)
+CORECLR_STRING_DEF(OutOfMemory)
+CORECLR_STRING_DEF(Success)
+CORECLR_STRING_DEF(DialogTitleMain)
+CORECLR_STRING_DEF(DialogTitleInfo)
+CORECLR_STRING_DEF(DialogTitleError)
+CORECLR_STRING_DEF(OKButton)
+CORECLR_STRING_DEF(CancelButton)
+CORECLR_STRING_DEF(HeaderText)
diff --git a/src/inc/dbgenginemetrics.h b/src/inc/dbgenginemetrics.h
new file mode 100644
index 0000000000..174888565e
--- /dev/null
+++ b/src/inc/dbgenginemetrics.h
@@ -0,0 +1,30 @@
+// 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.
+//
+// DbgEngineMetrics.h
+//
+// This file contains the defintion of CLR_ENGINE_METRICS. This struct is used for Silverlight debugging.
+//
+// ======================================================================================
+
+
+
+#ifndef __DbgEngineMetrics_h__
+#define __DbgEngineMetrics_h__
+
+//---------------------------------------------------------------------------------------
+//
+// This struct contains information necessary for Silverlight debugging. coreclr.dll has a static struct
+// of this type. It is read by dbgshim.dll to help synchronize the debugger and coreclr.dll in launch
+// and early attach scenarios.
+//
+
+typedef struct tagCLR_ENGINE_METRICS
+{
+ DWORD cbSize; // the size of the struct; also identifies the format of the struct
+ DWORD dwDbiVersion; // the version of the debugging interface expected by this CoreCLR
+ LPVOID phContinueStartupEvent; // pointer to the continue startup event handle
+} CLR_ENGINE_METRICS;
+
+#endif // __DbgEngineMetrics_h__
diff --git a/src/inc/dbgmeta.h b/src/inc/dbgmeta.h
new file mode 100644
index 0000000000..ce7a3bbdf3
--- /dev/null
+++ b/src/inc/dbgmeta.h
@@ -0,0 +1,38 @@
+// 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.
+
+/* ------------------------------------------------------------------------- *
+ * DbgMeta.h - header file for debugger metadata routines
+ * ------------------------------------------------------------------------- */
+
+#ifndef _DbgMeta_h_
+#define _DbgMeta_h_
+
+#include <cor.h>
+
+/* ------------------------------------------------------------------------- *
+ * Structs to support line numbers and variables
+ * ------------------------------------------------------------------------- */
+
+class DebuggerLexicalScope;
+
+//
+// DebuggerVarInfo
+//
+// Holds basic information about local variables, method arguments,
+// and class static and instance variables.
+//
+struct DebuggerVarInfo
+{
+ LPCSTR name;
+ PCCOR_SIGNATURE sig;
+ unsigned int varNumber; // placement info for IL code
+ DebuggerLexicalScope* scope; // containing scope
+
+ DebuggerVarInfo() : name(NULL), sig(NULL), varNumber(0),
+ scope(NULL) {}
+};
+
+#endif /* _DbgMeta_h_ */
+
diff --git a/src/inc/dbgportable.h b/src/inc/dbgportable.h
new file mode 100644
index 0000000000..4a035642c2
--- /dev/null
+++ b/src/inc/dbgportable.h
@@ -0,0 +1,141 @@
+// 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.
+
+#ifndef __DBG_PORTABLE_INCLUDED
+#define __DBG_PORTABLE_INCLUDED
+
+//
+// This header defines the template class Portable<T> which is designed to wrap primitive types in such a way
+// that their physical representation is in a canonical format that can be safely transferred between hosts on
+// different platforms.
+//
+// This is achieved by storing the wrapped datum in little-endian format (since most of our platforms are
+// little-endian this makes the most sense from a performance perspective). On little-endian platforms the
+// wrapper code will become a no-op and get optimized away by the compiler. On big-endian platforms
+// assignments to a Portable<T> value will reverse the order of the bytes in the T value and reverse them back
+// again on a read.
+//
+// Portable<T> is typically used to wrap the fields of structures sent directly over a network channel. In
+// this fashion many of the values that would otherwise require manual endian-ness fixups are now marshalled
+// and unmarshalled transparent right at the network transition.
+//
+// Care must be taken to identify any code that takes the address of a Portable<T>, since this is not
+// generally safe (it could expose naive code to the network encoded form of the datum). In such situations
+// the code is normally re-written to create a temporary instance of T on the stack, initialized to the
+// correct host value by reading from the Portable<T> field. The address of this variable can now be taken
+// safely (assuming its value is required only for some lexically scoped operation). Once the value is no
+// longer being used, and if there is a possibility that the value may have been updated, the new value can be
+// copied back into the Portable<T> field.
+//
+// Note that this header uses very basic data types only as it is included from both Win32/PAL code and native
+// Mac code.
+//
+
+#if BIGENDIAN || __BIG_ENDIAN__
+#define DBG_BYTE_SWAP_REQUIRED
+#endif
+
+#if defined(_ASSERTE)
+#define _PASSERT(_expr) _ASSERTE(_expr)
+#elif defined(assert)
+#define _PASSERT(_expr) assert(_expr)
+#else
+#define _PASSERT(_expr)
+#endif
+
+// Lowest level helper used to reverse the order of a sequence of bytes, either as an in-place operation or as
+// part of a copy.
+inline void ByteSwapPrimitive(const void *pSrc, void *pDst, unsigned int cbSize)
+{
+ _PASSERT(cbSize == 2 || cbSize == 4 || cbSize == 8);
+
+ unsigned char *pbSrc = (unsigned char*)pSrc;
+ unsigned char *pbDst = (unsigned char*)pDst;
+
+ for (unsigned int i = 0; i < (cbSize / 2); i++)
+ {
+ unsigned int j = cbSize - i - 1;
+ unsigned char bTemp = pbSrc[i];
+ pbDst[i] = pbSrc[j];
+ pbDst[j] = bTemp;
+ }
+}
+
+template <typename T>
+class Portable
+{
+ T m_data;
+
+public:
+ // No constructors -- this will be used in unions.
+
+ // Convert data to portable format on assignment.
+ T operator = (T value)
+ {
+ _PASSERT(sizeof(value) <= sizeof(double));
+#ifdef DBG_BYTE_SWAP_REQUIRED
+ m_data = ByteSwap(value);
+#else // DBG_BYTE_SWAP_REQUIRED
+ m_data = value;
+#endif // DBG_BYTE_SWAP_REQUIRED
+ return value;
+ }
+
+ // Return data in native format on access.
+ operator T () const
+ {
+#ifdef DBG_BYTE_SWAP_REQUIRED
+ return ByteSwap(m_data);
+#else // DBG_BYTE_SWAP_REQUIRED
+ return m_data;
+#endif // DBG_BYTE_SWAP_REQUIRED
+ }
+
+ bool operator == (T other) const
+ {
+#ifdef DBG_BYTE_SWAP_REQUIRED
+ return ByteSwap(m_data) == other;
+#else // DBG_BYTE_SWAP_REQUIRED
+ return m_data == other;
+#endif // DBG_BYTE_SWAP_REQUIRED
+ }
+
+ bool operator != (T other) const
+ {
+#ifdef DBG_BYTE_SWAP_REQUIRED
+ return ByteSwap(m_data) != other;
+#else // DBG_BYTE_SWAP_REQUIRED
+ return m_data != other;
+#endif // DBG_BYTE_SWAP_REQUIRED
+ }
+
+ T Unwrap()
+ {
+#ifdef DBG_BYTE_SWAP_REQUIRED
+ return ByteSwap(m_data);
+#else // DBG_BYTE_SWAP_REQUIRED
+ return m_data;
+#endif // DBG_BYTE_SWAP_REQUIRED
+ }
+
+private:
+#ifdef DBG_BYTE_SWAP_REQUIRED
+ // Big endian helper routine to swap the order of bytes of an arbitrary sized type
+ // (though obviously this type must be an integral primitive for this to make any
+ // sense).
+ static T ByteSwap(T inval)
+ {
+ if (sizeof(T) > 1)
+ {
+ T outval;
+ ByteSwapPrimitive(&inval, &outval, sizeof(T));
+ return outval;
+ }
+ else
+ return inval;
+ }
+#endif // DBG_BYTE_SWAP_REQUIRED
+};
+
+#endif // !__DBG_PORTABLE_INCLUDED
diff --git a/src/inc/debugmacros.h b/src/inc/debugmacros.h
new file mode 100644
index 0000000000..e1468a7d47
--- /dev/null
+++ b/src/inc/debugmacros.h
@@ -0,0 +1,270 @@
+// 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.
+//*****************************************************************************
+// DebugMacros.h
+//
+// Wrappers for Debugging purposes.
+//
+//*****************************************************************************
+
+#ifndef __DebugMacros_h__
+#define __DebugMacros_h__
+
+#include "stacktrace.h"
+#include "debugmacrosext.h"
+
+#undef _ASSERTE
+#undef VERIFY
+
+#ifdef __cplusplus
+extern "C" {
+#endif // __cplusplus
+
+#if defined(_DEBUG)
+
+class SString;
+bool GetStackTraceAtContext(SString & s, struct _CONTEXT * pContext);
+
+void _cdecl DbgWriteEx(LPCTSTR szFmt, ...);
+bool _DbgBreakCheck(LPCSTR szFile, int iLine, LPCSTR szExpr, BOOL fConstrained = FALSE);
+
+extern VOID DbgAssertDialog(const char *szFile, int iLine, const char *szExpr);
+
+#define TRACE_BUFF_SIZE (cchMaxAssertStackLevelStringLen * cfrMaxAssertStackLevels + cchMaxAssertExprLen + 1)
+extern char g_szExprWithStack[TRACE_BUFF_SIZE];
+
+extern int _DbgBreakCount;
+
+#define PRE_ASSERTE /* if you need to change modes before doing asserts override */
+#define POST_ASSERTE /* put it back */
+
+#if !defined(_ASSERTE_MSG)
+ #define _ASSERTE_MSG(expr, msg) \
+ do { \
+ if (!(expr)) { \
+ PRE_ASSERTE \
+ DbgAssertDialog(__FILE__, __LINE__, msg); \
+ POST_ASSERTE \
+ } \
+ } while (0)
+#endif // _ASSERTE_MSG
+
+#if !defined(_ASSERTE)
+ #define _ASSERTE(expr) _ASSERTE_MSG(expr, #expr)
+#endif // !_ASSERTE
+
+
+#define VERIFY(stmt) _ASSERTE((stmt))
+
+#define _ASSERTE_ALL_BUILDS(file, expr) _ASSERTE((expr))
+
+#define FreeBuildDebugBreak() DebugBreak()
+
+#else // !_DEBUG
+
+#define _DbgBreakCount 0
+
+#define _ASSERTE(expr) ((void)0)
+#define _ASSERTE_MSG(expr, msg) ((void)0)
+#define VERIFY(stmt) (void)(stmt)
+
+void __FreeBuildDebugBreak();
+void DECLSPEC_NORETURN __FreeBuildAssertFail(const char *szFile, int iLine, const char *szExpr);
+
+#define FreeBuildDebugBreak() __FreeBuildDebugBreak()
+
+// At this point, EEPOLICY_HANDLE_FATAL_ERROR may or may not be defined. It will be defined
+// if we are building the VM folder, but outside VM, its not necessarily defined. Currently,
+// this is applicable to the usage of RetailAssertIfExpectedClean that is used from outside
+// the VM folder and uses _ASSERTE_ALL_BUILDS macro as well.
+//
+// Thus, if EEPOLICY_HANDLE_FATAL_ERROR is not defined, we will call into __FreeBuildAssertFail,
+// but if it is defined, we will use it.
+//
+// Failing here implies an error in the runtime - hence we use COR_E_EXECUTIONENGINE.
+
+#ifdef EEPOLICY_HANDLE_FATAL_ERROR
+#define _ASSERTE_ALL_BUILDS(file, expr) if (!(expr)) EEPOLICY_HANDLE_FATAL_ERROR(COR_E_EXECUTIONENGINE);
+#else // !EEPOLICY_HANDLE_FATAL_ERROR
+#define _ASSERTE_ALL_BUILDS(file, expr) if (!(expr)) __FreeBuildAssertFail(file, __LINE__, #expr);
+#endif // EEPOLICY_HANDLE_FATAL_ERROR
+
+#endif
+
+
+#define ASSERT_AND_CHECK(x) { \
+ BOOL bResult = x; \
+ if (!bResult) \
+ { \
+ _ASSERTE(x); \
+ return FALSE; \
+ } \
+}
+
+
+#ifdef _DEBUG_IMPL
+
+// A macro to execute a statement only in _DEBUG_IMPL.
+#define DEBUG_IMPL_STMT(stmt) stmt
+
+#define _ASSERTE_IMPL(expr) _ASSERTE((expr))
+
+#if defined(_M_IX86)
+#if defined(_MSC_VER)
+#define _DbgBreak() __asm { int 3 }
+#elif defined(__GNUC__)
+#define _DbgBreak() __asm__ ("int $3");
+#else
+#error Unknown compiler
+#endif
+#else
+#define _DbgBreak() DebugBreak()
+#endif
+
+extern VOID DebBreak();
+extern VOID DebBreakHr(HRESULT hr);
+
+#ifndef IfFailGoto
+#define IfFailGoto(EXPR, LABEL) \
+do { hr = (EXPR); if(FAILED(hr)) { DebBreakHr(hr); goto LABEL; } } while (0)
+#endif
+
+#ifndef IfFailRet
+#define IfFailRet(EXPR) \
+do { hr = (EXPR); if(FAILED(hr)) { DebBreakHr(hr); return (hr); } } while (0)
+#endif
+
+#ifndef IfFailWin32Ret
+#define IfFailWin32Ret(EXPR) \
+do { hr = (EXPR); if(hr != ERROR_SUCCESS) { hr = HRESULT_FROM_WIN32(hr); DebBreakHr(hr); return hr;} } while (0)
+#endif
+
+#ifndef IfFailWin32Goto
+#define IfFailWin32Goto(EXPR, LABEL) \
+do { hr = (EXPR); if(hr != ERROR_SUCCESS) { hr = HRESULT_FROM_WIN32(hr); DebBreakHr(hr); goto LABEL; } } while (0)
+#endif
+
+#ifndef IfFailGo
+#define IfFailGo(EXPR) IfFailGoto(EXPR, ErrExit)
+#endif
+
+#ifndef IfFailWin32Go
+#define IfFailWin32Go(EXPR) IfFailWin32Goto(EXPR, ErrExit)
+#endif
+
+#else // _DEBUG_IMPL
+
+#define _DbgBreak() {}
+
+#define DEBUG_IMPL_STMT(stmt)
+
+#define _ASSERTE_IMPL(expr)
+
+#define IfFailGoto(EXPR, LABEL) \
+do { hr = (EXPR); if(FAILED(hr)) { goto LABEL; } } while (0)
+
+#define IfFailRet(EXPR) \
+do { hr = (EXPR); if(FAILED(hr)) { return (hr); } } while (0)
+
+#define IfFailWin32Ret(EXPR) \
+do { hr = (EXPR); if(hr != ERROR_SUCCESS) { hr = HRESULT_FROM_WIN32(hr); return hr;} } while (0)
+
+#define IfFailWin32Goto(EXPR, LABEL) \
+do { hr = (EXPR); if(hr != ERROR_SUCCESS) { hr = HRESULT_FROM_WIN32(hr); goto LABEL; } } while (0)
+
+#define IfFailGo(EXPR) IfFailGoto(EXPR, ErrExit)
+
+#define IfFailWin32Go(EXPR) IfFailWin32Goto(EXPR, ErrExit)
+
+#endif // _DEBUG_IMPL
+
+
+#define IfNullGoto(EXPR, LABEL) \
+ do { if ((EXPR) == NULL) { OutOfMemory(); IfFailGoto(E_OUTOFMEMORY, LABEL); } } while (false)
+
+#ifndef IfNullRet
+#define IfNullRet(EXPR) \
+ do { if ((EXPR) == NULL) { OutOfMemory(); return E_OUTOFMEMORY; } } while (false)
+#endif //!IfNullRet
+
+#define IfNullGo(EXPR) IfNullGoto(EXPR, ErrExit)
+
+#ifdef __cplusplus
+}
+
+#endif // __cplusplus
+
+
+#undef assert
+#define assert _ASSERTE
+#undef _ASSERT
+#define _ASSERT _ASSERTE
+
+
+#if defined(_DEBUG) && !defined(FEATURE_PAL)
+
+// This function returns the EXE time stamp (effectively a random number)
+// Under retail it always returns 0. This is meant to be used in the
+// RandomOnExe macro
+unsigned DbgGetEXETimeStamp();
+
+// returns true 'fractionOn' amount of the time using the EXE timestamp
+// as the random number seed. For example DbgRandomOnExe(.1) returns true 1/10
+// of the time. We use the line number so that different uses of DbgRandomOnExe
+// will not be coorelated with each other (9973 is prime). Returns false on a retail build
+#define DbgRandomOnHashAndExe(hash, fractionOn) \
+ (((DbgGetEXETimeStamp() * __LINE__ * ((hash) ? (hash) : 1)) % 9973) < \
+ unsigned(fractionOn * 9973))
+#define DbgRandomOnExe(fractionOn) DbgRandomOnHashAndExe(0, fractionOn)
+#define DbgRandomOnStringAndExe(string, fractionOn) DbgRandomOnHashAndExe(HashStringA(string), fractionOn)
+
+#else
+
+#define DbgGetEXETimeStamp() 0
+#define DbgRandomOnHashAndExe(hash, fractionOn) 0
+#define DbgRandomOnExe(fractionOn) 0
+#define DbgRandomOnStringAndExe(fractionOn) 0
+
+#endif // _DEBUG && !FEATUREPAL
+
+#ifdef _DEBUG
+namespace clr
+{
+ namespace dbg
+ {
+ // In debug builds, this can be used to write known bad values into
+ // memory. One example is in ComUtil::IUnknownCommon::~IUnknownCommon,
+ // which overwrites its instance memory with a known bad value after
+ // completing its destructor.
+ template < typename T >
+ void PoisonMem(T &val)
+ {
+ ZeroMemory((void*)&val, sizeof(T));
+ }
+
+ template < typename T >
+ void PoisonMem(T* ptr, size_t len)
+ {
+ ZeroMemory((void*)ptr, sizeof(T)* len);
+ }
+ }
+}
+#else
+
+// Empty versions of the functions in retail that will be inlined
+// and completely elided.
+namespace clr
+{
+ namespace dbg
+ {
+ template < typename T >
+ inline void PoisonMem(T &) {}
+
+ template < typename T >
+ void PoisonMem(T* ptr, size_t len){}
+ }
+}
+#endif
+
+#endif
diff --git a/src/inc/debugmacrosext.h b/src/inc/debugmacrosext.h
new file mode 100644
index 0000000000..e1aade65b5
--- /dev/null
+++ b/src/inc/debugmacrosext.h
@@ -0,0 +1,46 @@
+// 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.
+//*****************************************************************************
+// DebugMacrosExt.h
+//
+// Simple debugging macros that take no dependencies on CLR headers.
+// This header can be used from outside the CLR.
+//
+//*****************************************************************************
+
+#ifndef __DebugMacrosExt_h__
+#define __DebugMacrosExt_h__
+
+#if !defined(_DEBUG_IMPL) && defined(_DEBUG) && !defined(DACCESS_COMPILE)
+#define _DEBUG_IMPL 1
+#endif
+
+#ifdef _DEBUG
+// A macro to execute a statement only in _DEBUG.
+#define DEBUG_STMT(stmt) stmt
+#define INDEBUG(x) x
+#define INDEBUG_COMMA(x) x,
+#define COMMA_INDEBUG(x) ,x
+#define NOT_DEBUG(x)
+#else
+#define DEBUG_STMT(stmt)
+#define INDEBUG(x)
+#define INDEBUG_COMMA(x)
+#define COMMA_INDEBUG(x)
+#define NOT_DEBUG(x) x
+#endif
+
+
+#ifdef _DEBUG_IMPL
+#define INDEBUGIMPL(x) x
+#define INDEBUGIMPL_COMMA(x) x,
+#define COMMA_INDEBUGIMPL(x) ,x
+#else
+#define INDEBUGIMPL(x)
+#define INDEBUGIMPL_COMMA(x)
+#define COMMA_INDEBUGIMPL(x)
+#endif
+
+
+#endif
diff --git a/src/inc/debugreturn.h b/src/inc/debugreturn.h
new file mode 100644
index 0000000000..dbcbd2bb46
--- /dev/null
+++ b/src/inc/debugreturn.h
@@ -0,0 +1,127 @@
+// 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.
+
+
+#ifndef _DEBUGRETURN_H_
+#define _DEBUGRETURN_H_
+
+// Note that with OACR Prefast is run over checked (_DEBUG is defined) sources
+// so we have to first check the _PREFAST_ define followed by the _DEBUG define
+//
+#ifdef _PREFAST_
+
+// Use prefast to detect gotos out of no-return blocks. The gotos out of no-return blocks
+// should be reported as memory leaks by prefast. The (nothrow) is because PREfix sees the
+// throw from the new statement, and doesn't like these macros used in a destructor (and
+// the NULL returned by failure works just fine in delete[])
+
+#define DEBUG_ASSURE_NO_RETURN_BEGIN(arg) { char* __noReturnInThisBlock_##arg = ::new (nothrow) char[1];
+#define DEBUG_ASSURE_NO_RETURN_END(arg) ::delete[] __noReturnInThisBlock_##arg; }
+
+#define DEBUG_OK_TO_RETURN_BEGIN(arg) { ::delete[] __noReturnInThisBlock_##arg;
+#define DEBUG_OK_TO_RETURN_END(arg) __noReturnInThisBlock_##arg = ::new (nothrow) char[1]; }
+
+#define DEBUG_ASSURE_SAFE_TO_RETURN TRUE
+#define return return
+
+#else // !_PREFAST_
+
+// This is disabled in VS2015 Update 3 and earlier because only C++11 constexpr is supported,
+// which doesn't allow the use of 'if' statements within the body of a constexpr function.
+#if defined(_DEBUG) && (!defined(_MSC_FULL_VER) || _MSC_FULL_VER > 190024210)
+
+// Code to generate a compile-time error if return statements appear where they
+// shouldn't.
+//
+// Here's the way it works...
+//
+// We create two classes with a safe_to_return() method. The method is static,
+// returns void, and does nothing. One class has the method as public, the other
+// as private. We introduce a global scope typedef for __ReturnOK that refers to
+// the class with the public method. So, by default, the expression
+//
+// __ReturnOK::safe_to_return()
+//
+// quietly compiles and does nothing. When we enter a block in which we want to
+// inhibit returns, we introduce a new typedef that defines __ReturnOK as the
+// class with the private method. Inside this scope,
+//
+// __ReturnOK::safe_to_return()
+//
+// generates a compile-time error.
+//
+// To cause the method to be called, we have to #define the return keyword.
+// The simplest working version would be
+//
+// #define return if (0) __ReturnOK::safe_to_return(); else return
+//
+// but we've used
+//
+// #define return for (;1;__ReturnOK::safe_to_return()) return
+//
+// because it happens to generate somewhat faster code in a checked build. (They
+// both introduce no overhead in a fastchecked build.)
+//
+class __SafeToReturn {
+public:
+ static int safe_to_return() {return 0;};
+ static int used() {return 0;};
+};
+
+class __YouCannotUseAReturnStatementHere {
+private:
+ // If you got here, and you're wondering what you did wrong -- you're using
+ // a return statement where it's not allowed. Likely, it's inside one of:
+ // GCPROTECT_BEGIN ... GCPROTECT_END
+ // HELPER_METHOD_FRAME_BEGIN ... HELPER_METHOD_FRAME_END
+ //
+ static int safe_to_return() {return 0;};
+public:
+ // Some compilers warn if all member functions in a class are private
+ // or if a typedef is unused. Rather than disable the warning, we'll work
+ // around it here.
+ static int used() {return 0;};
+};
+
+typedef __SafeToReturn __ReturnOK;
+
+// Use this to ensure that it is safe to return from a given scope
+#define DEBUG_ASSURE_SAFE_TO_RETURN __ReturnOK::safe_to_return()
+
+// Unfortunately, the only way to make this work is to #define all return statements --
+// even the ones at global scope. This actually generates better code that appears.
+// The call is dead, and does not appear in the generated code, even in a checked
+// build. (And, in fastchecked, there is no penalty at all.)
+//
+#ifdef _MSC_VER
+#define return if (0 && __ReturnOK::safe_to_return()) { } else return
+#else // _MSC_VER
+#define return for (;1;__ReturnOK::safe_to_return()) return
+#endif // _MSC_VER
+
+#define DEBUG_ASSURE_NO_RETURN_BEGIN(arg) { typedef __YouCannotUseAReturnStatementHere __ReturnOK; if (0 && __ReturnOK::used()) { } else {
+#define DEBUG_ASSURE_NO_RETURN_END(arg) } }
+
+// rotor_pal.h defaulted these to empty macros; this file redefines them
+#undef DEBUG_OK_TO_RETURN_BEGIN
+#undef DEBUG_OK_TO_RETURN_END
+
+#define DEBUG_OK_TO_RETURN_BEGIN(arg) { typedef __SafeToReturn __ReturnOK; if (0 && __ReturnOK::used()) { } else {
+#define DEBUG_OK_TO_RETURN_END(arg) } }
+
+#else // defined(_DEBUG) && (!defined(_MSC_FULL_VER) || _MSC_FULL_VER > 190024210)
+
+#define DEBUG_ASSURE_SAFE_TO_RETURN TRUE
+
+#define DEBUG_ASSURE_NO_RETURN_BEGIN(arg) {
+#define DEBUG_ASSURE_NO_RETURN_END(arg) }
+
+#define DEBUG_OK_TO_RETURN_BEGIN(arg) {
+#define DEBUG_OK_TO_RETURN_END(arg) }
+
+#endif // defined(_DEBUG) && (!defined(_MSC_FULL_VER) || _MSC_FULL_VER > 190024210)
+
+#endif // !_PREFAST_
+
+#endif // _DEBUGRETURN_H_
diff --git a/src/inc/declsec.h b/src/inc/declsec.h
new file mode 100644
index 0000000000..e55916e074
--- /dev/null
+++ b/src/inc/declsec.h
@@ -0,0 +1,255 @@
+// 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.
+
+/*
+ * COM+99 Declarative Security Header
+ *
+ * HISTORY: Created, 4/15/98
+ */
+
+#ifndef _DECLSEC_H
+#define _DECLSEC_H
+//
+// PSECURITY_PROPS and PSECURITY_VALUES are opaque types (void*s) defined in cor.h
+// so that cor.h does not need to know about these structures. This file relates
+// the opaque types in cor.h to concrete types, which are also defined here.
+//
+// a PSECURITY_PROPS is a pSecurityProperties
+// a PSECURITY_VALUE is a pSecurityValue
+//
+
+#include "cor.h"
+
+// First, some flag values
+
+#define DECLSEC_DEMANDS 0x00000001
+#define DECLSEC_ASSERTIONS 0x00000002
+#define DECLSEC_DENIALS 0x00000004
+#define DECLSEC_INHERIT_CHECKS 0x00000008
+#define DECLSEC_LINK_CHECKS 0x00000010
+#define DECLSEC_PERMITONLY 0x00000020
+#define DECLSEC_REQUESTS 0x00000040
+#define DECLSEC_UNMNGD_ACCESS_DEMAND 0x00000080 // Used by PInvoke/Interop
+#define DECLSEC_NONCAS_DEMANDS 0x00000100
+#define DECLSEC_NONCAS_LINK_DEMANDS 0x00000200
+#define DECLSEC_NONCAS_INHERITANCE 0x00000400
+#define DECLSEC_LINK_CHECKS_HPONLY 0x00000800 // If the DECLSEC_LINK_CHECKS flag is set due to HPA (and not due to any CAS linkdemand), this flag is set
+
+#define DECLSEC_NULL_OFFSET 16
+
+#define DECLSEC_NULL_INHERIT_CHECKS (DECLSEC_INHERIT_CHECKS << DECLSEC_NULL_OFFSET)
+#define DECLSEC_NULL_LINK_CHECKS (DECLSEC_LINK_CHECKS << DECLSEC_NULL_OFFSET)
+
+#define DECLSEC_RUNTIME_ACTIONS (DECLSEC_DEMANDS | \
+ DECLSEC_NONCAS_DEMANDS | \
+ DECLSEC_ASSERTIONS | \
+ DECLSEC_DENIALS | \
+ DECLSEC_PERMITONLY | \
+ DECLSEC_UNMNGD_ACCESS_DEMAND)
+
+#define DECLSEC_FRAME_ACTIONS (DECLSEC_ASSERTIONS | \
+ DECLSEC_DENIALS | \
+ DECLSEC_PERMITONLY)
+
+#define DECLSEC_OVERRIDES (DECLSEC_DENIALS | \
+ DECLSEC_PERMITONLY)
+
+#define DECLSEC_NON_RUNTIME_ACTIONS (DECLSEC_REQUESTS | \
+ DECLSEC_INHERIT_CHECKS | \
+ DECLSEC_LINK_CHECKS | \
+ DECLSEC_NONCAS_LINK_DEMANDS | \
+ DECLSEC_NONCAS_INHERITANCE)
+
+#define BIT_TST(I,B) ((I) & (B))
+#define BIT_SET(I,B) ((I) |= (B))
+#define BIT_CLR(I,B) ((I) &= (~(B)))
+
+class LoaderHeap;
+
+class SecurityProperties
+{
+#ifdef DACCESS_COMPILE
+ friend class NativeImageDumper;
+#endif
+private:
+ DWORD dwFlags ;
+// PermList plDemands ;
+
+public:
+ void *operator new(size_t size, LoaderHeap *pHeap);
+ void operator delete(void *pMem);
+
+ SecurityProperties ()
+ {
+ LIMITED_METHOD_CONTRACT;
+ dwFlags = 0 ;
+ }
+ SecurityProperties(DWORD _dwFlags)
+ {
+ LIMITED_METHOD_CONTRACT;
+ dwFlags = _dwFlags;
+ }
+ ~SecurityProperties ()
+ {
+ LIMITED_METHOD_CONTRACT;
+ dwFlags = 0 ;
+ }
+ inline BOOL FDemandsOnly()
+ {
+ LIMITED_METHOD_CONTRACT;
+ return ( (dwFlags & ~(DECLSEC_DEMANDS|DECLSEC_UNMNGD_ACCESS_DEMAND)) == 0);
+ }
+ inline BOOL FDeclarationsExist()
+ {
+ LIMITED_METHOD_CONTRACT;
+ return dwFlags;
+ }
+ inline BOOL FDemandsExist()
+ {
+ LIMITED_METHOD_CONTRACT;
+ return BIT_TST(dwFlags, DECLSEC_DEMANDS);
+ }
+ inline void SetDemandsExist()
+ {
+ LIMITED_METHOD_CONTRACT;
+ BIT_SET(dwFlags, DECLSEC_DEMANDS);
+ }
+ inline void ResetDemandsExist()
+ {
+ LIMITED_METHOD_CONTRACT;
+ BIT_CLR(dwFlags, DECLSEC_DEMANDS);
+ }
+
+ inline BOOL FAssertionsExist()
+ {
+ LIMITED_METHOD_CONTRACT;
+ return BIT_TST(dwFlags, DECLSEC_ASSERTIONS);
+ }
+ inline void SetAssertionsExist()
+ {
+ LIMITED_METHOD_CONTRACT;
+ BIT_SET(dwFlags, DECLSEC_ASSERTIONS);
+ }
+ inline void ResetAssertionsExist()
+ {
+ LIMITED_METHOD_CONTRACT;
+ BIT_CLR(dwFlags, DECLSEC_ASSERTIONS);
+ }
+
+ inline BOOL FDenialsExist()
+ {
+ LIMITED_METHOD_CONTRACT;
+ return BIT_TST(dwFlags, DECLSEC_DENIALS);
+ }
+ inline void SetDenialsExist()
+ {
+ LIMITED_METHOD_CONTRACT;
+ BIT_SET(dwFlags, DECLSEC_DENIALS);
+ }
+ inline void ResetDenialsExist()
+ {
+ LIMITED_METHOD_CONTRACT;
+ BIT_CLR(dwFlags, DECLSEC_DENIALS);
+ }
+
+ inline BOOL FInherit_ChecksExist()
+ {
+ LIMITED_METHOD_CONTRACT;
+ return BIT_TST(dwFlags, DECLSEC_INHERIT_CHECKS);
+ }
+ inline void SetInherit_ChecksExist()
+ {
+ LIMITED_METHOD_CONTRACT;
+ BIT_SET(dwFlags, DECLSEC_INHERIT_CHECKS);
+ }
+ inline void ResetInherit_ChecksExist()
+ {
+ LIMITED_METHOD_CONTRACT;
+ BIT_CLR(dwFlags, DECLSEC_INHERIT_CHECKS);
+ }
+
+ // The class requires an inheritance check only if there are inherit checks and
+ // they aren't null.
+ inline BOOL RequiresCasInheritanceCheck () {LIMITED_METHOD_CONTRACT; return (dwFlags & (DECLSEC_INHERIT_CHECKS | DECLSEC_NULL_INHERIT_CHECKS))
+ == DECLSEC_INHERIT_CHECKS ;}
+
+ inline BOOL RequiresNonCasInheritanceCheck () {LIMITED_METHOD_CONTRACT; return dwFlags & DECLSEC_NONCAS_INHERITANCE;}
+
+
+ inline BOOL RequiresInheritanceCheck () {WRAPPER_NO_CONTRACT; return (RequiresCasInheritanceCheck() ||
+ RequiresNonCasInheritanceCheck()) ;}
+
+ inline BOOL FLink_ChecksExist()
+ {
+ LIMITED_METHOD_CONTRACT;
+ return BIT_TST(dwFlags, DECLSEC_LINK_CHECKS);
+ }
+ inline void SetLink_ChecksExist()
+ {
+ LIMITED_METHOD_CONTRACT;
+ BIT_SET(dwFlags, DECLSEC_LINK_CHECKS);
+ }
+ inline void ResetLink_ChecksExist()
+ {
+ LIMITED_METHOD_CONTRACT;
+ BIT_CLR(dwFlags, DECLSEC_LINK_CHECKS);
+ }
+
+ inline BOOL RequiresCasLinktimeCheck () {LIMITED_METHOD_CONTRACT; return (dwFlags & (DECLSEC_LINK_CHECKS | DECLSEC_NULL_LINK_CHECKS))
+ == DECLSEC_LINK_CHECKS ;}
+
+ inline BOOL RequiresNonCasLinktimeCheck () {LIMITED_METHOD_CONTRACT; return (dwFlags & DECLSEC_NONCAS_LINK_DEMANDS);}
+
+
+ inline BOOL RequiresLinktimeCheck () {WRAPPER_NO_CONTRACT; return RequiresCasLinktimeCheck() ||
+ RequiresNonCasLinktimeCheck();}
+ inline BOOL RequiresLinkTimeCheckHostProtectionOnly () {LIMITED_METHOD_CONTRACT; return (dwFlags & DECLSEC_LINK_CHECKS_HPONLY);}
+
+ inline BOOL FPermitOnlyExist()
+ {
+ LIMITED_METHOD_CONTRACT;
+ return BIT_TST(dwFlags, DECLSEC_PERMITONLY);
+ }
+ inline void SetPermitOnlyExist()
+ {
+ LIMITED_METHOD_CONTRACT;
+ BIT_SET(dwFlags, DECLSEC_PERMITONLY);
+ }
+ inline void ResetPermitOnlyExist()
+ {
+ LIMITED_METHOD_CONTRACT;
+ BIT_CLR(dwFlags, DECLSEC_PERMITONLY);
+ }
+
+ inline void SetFlags(DWORD dw)
+ {
+ LIMITED_METHOD_CONTRACT;
+ dwFlags = dw;
+ }
+
+ inline void SetFlags(DWORD dw, DWORD dwNull)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ dwFlags = (dw | (dwNull << DECLSEC_NULL_OFFSET));
+ }
+
+ inline DWORD GetRuntimeActions()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ return dwFlags & DECLSEC_RUNTIME_ACTIONS;
+ }
+
+ inline DWORD GetNullRuntimeActions()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ return (dwFlags >> DECLSEC_NULL_OFFSET) & DECLSEC_RUNTIME_ACTIONS;
+ }
+} ;
+
+typedef SecurityProperties * PSecurityProperties, ** PpSecurityProperties ;
+
+#endif
diff --git a/src/inc/defaultallocator.h b/src/inc/defaultallocator.h
new file mode 100644
index 0000000000..ee342dff8b
--- /dev/null
+++ b/src/inc/defaultallocator.h
@@ -0,0 +1,49 @@
+// 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.
+
+#ifndef _DEFAULTALLOCATOR_H_
+#define _DEFAULTALLOCATOR_H_
+
+// The "DefaultAllocator" class may be used by classes that wish to
+// provide the flexibility of using an "IAllocator" may avoid writing
+// conditionals at allocation sites about whether a non-default
+// "IAllocator" has been provided: if none is, they can simply set the
+// allocator to DefaultAllocator::Singleton().
+class DefaultAllocator: public IAllocator
+{
+ static DefaultAllocator s_singleton;
+
+public:
+ void* Alloc(size_t sz)
+ {
+ return ::operator new(sz);
+ }
+
+ void* ArrayAlloc(size_t elemSize, size_t numElems)
+ {
+ ClrSafeInt<size_t> safeElemSize(elemSize);
+ ClrSafeInt<size_t> safeNumElems(numElems);
+ ClrSafeInt<size_t> sz = safeElemSize * safeNumElems;
+ if (sz.IsOverflow())
+ {
+ return NULL;
+ }
+ else
+ {
+ return ::operator new(sz.Value());
+ }
+ }
+
+ virtual void Free(void * p)
+ {
+ ::operator delete(p);
+ }
+
+ static DefaultAllocator* Singleton()
+ {
+ return &s_singleton;
+ }
+};
+
+#endif // _DEFAULTALLOCATOR_H_
diff --git a/src/inc/delayloadhelpers.h b/src/inc/delayloadhelpers.h
new file mode 100644
index 0000000000..2a62a8d95c
--- /dev/null
+++ b/src/inc/delayloadhelpers.h
@@ -0,0 +1,113 @@
+// 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.
+//
+
+//
+// Contains convenience functionality for lazily loading modules
+// and getting entrypoints within them.
+//
+
+#ifndef DelayLoadHelpers_h
+#define DelayLoadHelpers_h
+
+#include "volatile.h"
+
+namespace DelayLoad
+{
+ //=================================================================================================================
+ // Contains information needed to load and cache a module. Use through
+ // the DELAY_LOADED_MODULE macro defined below.
+ struct Module
+ {
+ LPCWSTR const m_wzDllName;
+ HMODULE m_hMod;
+ HRESULT m_hr;
+ Volatile<bool> m_fInitialized;
+
+ // Returns a non-ref-counted HMODULE; will load the module if necessary.
+ // Do not FreeLibrary the returned value.
+ HRESULT GetValue(HMODULE *pHMODULE);
+ };
+}
+
+//=====================================================================================================================
+// Use at global scope to declare a delay loaded module represented as a
+// DelayLoad::Module instance. The module may then be accessed as
+// 'DelayLoad::Modules::DLL_NAME'.
+//
+// Parameters:
+// DLL_NAME - the simple name (without extension) of the DLL.
+//
+// Example:
+// DELAY_LOADED_MODULE(Kernel32);
+// void Foo() {
+// HMODULE hModKernel32 = nullptr;
+// IfFailThrow(DelayLoad::Modules::Kernel32.GetValue(&hModKernel32));
+// // Use hModKernel32 as needed. Do not FreeLibrary the value!
+// }
+
+#define DELAY_LOADED_MODULE(DLL_NAME) \
+ namespace DelayLoad { \
+ namespace Modules { \
+ SELECTANY Module DLL_NAME = { L#DLL_NAME W(".dll"), nullptr, S_OK, false }; \
+ } \
+ }
+
+namespace DelayLoad
+{
+ //=================================================================================================================
+ // Contains information needed to load a function pointer from a DLL. Builds
+ // on the DelayLoad::Module functionality, and should be used through
+ // the DELAY_LOADED_FUNCTION macro defined below.
+ struct Function
+ {
+ Module * const m_pModule;
+ LPCSTR const m_szFunctionName;
+ PVOID m_pvFunction;
+ HRESULT m_hr;
+ Volatile<bool> m_fInitialized;
+
+ // On success, ppvFunc is set to point to the entrypoint corresponding to
+ // m_szFunctionName as exported from m_pModule.
+ HRESULT GetValue(LPVOID * ppvFunc);
+
+ // Convenience function that does the necessary casting for you.
+ template <typename FnT> inline
+ HRESULT GetValue(FnT ** ppFunc)
+ {
+ return GetValue(reinterpret_cast<LPVOID*>(ppFunc));
+ }
+ };
+}
+
+//=====================================================================================================================
+// Use at global scope to declare a delay loaded function and its associated module,
+// represented as DelayLoad::Function and DelayLoad::Module instances, respectively.
+// The function may then be accessed as 'DelayLoad::DLL_NAME::FUNC_NAME', and the
+// module may be access as described in DELAY_LOADED_MODULE's comment.
+//
+// Parameters:
+// DLL_NAME - unquoted simple name (without extension) of the DLL containing
+// the function.
+// FUNC_NAME - unquoted entrypoint name exported from the DLL.
+//
+// Example:
+// DELAY_LOADED_FUNCTION(MyDll, MyFunction);
+// HRESULT Foo(...) {
+// typedef HRESULT MyFunction_t(<args>);
+// MyFunction_t * pFunc = nullptr;
+// IfFailRet(DelayLoad::WinTypes::RoResolveNamespace.GetValue(&pFunc));
+// return (*pFunc)(...);
+// }
+
+#define DELAY_LOADED_FUNCTION(DLL_NAME, FUNC_NAME) \
+ DELAY_LOADED_MODULE(DLL_NAME) \
+ namespace DelayLoad { \
+ namespace DLL_NAME { \
+ SELECTANY Function FUNC_NAME = { &Modules::##DLL_NAME, #FUNC_NAME, nullptr, S_OK, false }; \
+ } \
+ }
+
+#endif // DelayLoadHelpers_h
+
diff --git a/src/inc/dlwrap.h b/src/inc/dlwrap.h
new file mode 100644
index 0000000000..853bc58d7f
--- /dev/null
+++ b/src/inc/dlwrap.h
@@ -0,0 +1,205 @@
+// 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.
+
+
+//
+
+#ifndef _DLWRAP_H
+#define _DLWRAP_H
+
+//include this file if you get contract violation because of delayload
+
+//nothrow implementations
+
+#if defined(VER_H) && !defined (GetFileVersionInfoSizeW_NoThrow)
+DWORD
+GetFileVersionInfoSizeW_NoThrow(
+ LPCWSTR lptstrFilename, /* Filename of version stamped file */
+ LPDWORD lpdwHandle
+ );
+#endif
+
+#if defined(VER_H) && !defined (GetFileVersionInfoW_NoThrow)
+BOOL
+GetFileVersionInfoW_NoThrow(
+ LPCWSTR lptstrFilename, /* Filename of version stamped file */
+ DWORD dwHandle, /* Information from GetFileVersionSize */
+ DWORD dwLen, /* Length of buffer for info */
+ LPVOID lpData
+ );
+#endif
+
+#if defined(VER_H) && !defined (VerQueryValueW_NoThrow)
+BOOL
+VerQueryValueW_NoThrow(
+ const LPVOID pBlock,
+ LPCWSTR lpSubBlock,
+ LPVOID * lplpBuffer,
+ PUINT puLen
+ );
+#endif
+
+#if defined(_WININET_) && !defined (CreateUrlCacheEntryW_NoThrow)
+__success(return)
+BOOL
+CreateUrlCacheEntryW_NoThrow(
+ IN LPCWSTR lpszUrlName,
+ IN DWORD dwExpectedFileSize,
+ IN LPCWSTR lpszFileExtension,
+ __out_ecount(MAX_LONGPATH+1) LPWSTR lpszFileName,
+ IN DWORD dwReserved
+ );
+#endif
+
+#if defined(_WININET_) && !defined (CommitUrlCacheEntryW_NoThrow)
+BOOL
+CommitUrlCacheEntryW_NoThrow(
+ IN LPCWSTR lpszUrlName,
+ IN LPCWSTR lpszLocalFileName,
+ IN FILETIME ExpireTime,
+ IN FILETIME LastModifiedTime,
+ IN DWORD CacheEntryType,
+ IN LPCWSTR lpHeaderInfo,
+ IN DWORD dwHeaderSize,
+ IN LPCWSTR lpszFileExtension,
+ IN LPCWSTR lpszOriginalUrl
+ );
+#endif
+
+#if defined(_WININET_) && !defined (InternetTimeToSystemTimeA_NoThrow)
+BOOL
+InternetTimeToSystemTimeA_NoThrow(
+ IN LPCSTR lpszTime, // NULL terminated string
+ OUT SYSTEMTIME *pst, // output in GMT time
+ IN DWORD dwReserved
+ );
+#endif
+
+#if defined(__urlmon_h__) && !defined(CoInternetCreateSecurityManager_NoThrow)
+HRESULT
+CoInternetCreateSecurityManager_NoThrow(
+ IServiceProvider *pSP,
+ IInternetSecurityManager **ppSM,
+ DWORD dwReserved
+ );
+#endif
+
+#if defined(__urlmon_h__) && !defined(URLDownloadToCacheFileW_NoThrow)
+HRESULT
+URLDownloadToCacheFileW_NoThrow(
+ LPUNKNOWN lpUnkcaller,
+ LPCWSTR szURL,
+ __out_ecount(dwBufLength) LPWSTR szFileName,
+ DWORD dwBufLength,
+ DWORD dwReserved,
+ IBindStatusCallback *pBSC
+ );
+#endif
+
+#if defined(__urlmon_h__) && !defined(CoInternetGetSession_NoThrow)
+HRESULT
+CoInternetGetSession_NoThrow(
+ WORD dwSessionMode,
+ IInternetSession **ppIInternetSession,
+ DWORD dwReserved
+ );
+#endif
+
+#if defined(__urlmon_h__) && !defined(CopyBindInfo_NoThrow)
+HRESULT
+CopyBindInfo_NoThrow(
+ const BINDINFO * pcbiSrc, BINDINFO * pbiDest
+ );
+#endif
+
+
+
+//overrides
+#undef InternetTimeToSystemTimeA
+#undef CommitUrlCacheEntryW
+#undef HttpQueryInfoA
+#undef InternetCloseHandle
+#undef HttpSendRequestA
+#undef HttpOpenRequestA
+#undef InternetConnectA
+#undef InternetOpenA
+#undef InternetReadFile
+#undef CreateUrlCacheEntryW
+#undef CoInternetGetSession
+#undef CopyBindInfo
+#undef CoInternetCreateSecurityManager
+#undef URLDownloadToCacheFileW
+#undef FDICreate
+#undef FDIIsCabinet
+#undef FDICopy
+#undef FDIDestroy
+#undef VerQueryValueW
+#undef GetFileVersionInfoW
+#undef GetFileVersionInfoSizeW
+#undef VerQueryValueA
+#undef GetFileVersionInfoA
+#undef GetFileVersionInfoSizeA
+
+
+#define InternetTimeToSystemTimeA InternetTimeToSystemTimeA_NoThrow
+#define CommitUrlCacheEntryW CommitUrlCacheEntryW_NoThrow
+#define CreateUrlCacheEntryW CreateUrlCacheEntryW_NoThrow
+#define CoInternetGetSession CoInternetGetSession_NoThrow
+#define CopyBindInfo CopyBindInfo_NoThrow
+#define CoInternetCreateSecurityManager CoInternetCreateSecurityManager_NoThrow
+#define URLDownloadToCacheFileW URLDownloadToCacheFileW_NoThrow
+#define VerQueryValueW VerQueryValueW_NoThrow
+#define GetFileVersionInfoW GetFileVersionInfoW_NoThrow
+#define GetFileVersionInfoSizeW GetFileVersionInfoSizeW_NoThrow
+#define VerQueryValueA Use_VerQueryValueW
+#define GetFileVersionInfoA Use_GetFileVersionInfoW
+#define GetFileVersionInfoSizeA Use_GetFileVersionInfoSizeW
+
+#if defined(_WININET_)
+ inline
+ HRESULT HrCreateUrlCacheEntryW(
+ IN LPCWSTR lpszUrlName,
+ IN DWORD dwExpectedFileSize,
+ IN LPCWSTR lpszFileExtension,
+ __out_ecount(MAX_LONGPATH+1) LPWSTR lpszFileName,
+ IN DWORD dwReserved
+ )
+ {
+ if (!CreateUrlCacheEntryW(lpszUrlName, dwExpectedFileSize, lpszFileExtension, lpszFileName, dwReserved))
+ {
+ return HRESULT_FROM_WIN32(GetLastError());
+ }
+ else
+ {
+ return S_OK;
+ }
+ }
+
+ inline
+ HRESULT HrCommitUrlCacheEntryW(
+ IN LPCWSTR lpszUrlName,
+ IN LPCWSTR lpszLocalFileName,
+ IN FILETIME ExpireTime,
+ IN FILETIME LastModifiedTime,
+ IN DWORD CacheEntryType,
+ IN LPCWSTR lpHeaderInfo,
+ IN DWORD dwHeaderSize,
+ IN LPCWSTR lpszFileExtension,
+ IN LPCWSTR lpszOriginalUrl
+ )
+ {
+ if (!CommitUrlCacheEntryW(lpszUrlName, lpszLocalFileName, ExpireTime, LastModifiedTime, CacheEntryType,
+ lpHeaderInfo, dwHeaderSize, lpszFileExtension, lpszOriginalUrl))
+ {
+ return HRESULT_FROM_WIN32(GetLastError());
+ }
+ else
+ {
+ return S_OK;
+ }
+ }
+#endif // defined(_WININET_)
+
+#endif
+
diff --git a/src/inc/downlevel.h b/src/inc/downlevel.h
new file mode 100644
index 0000000000..b32673288c
--- /dev/null
+++ b/src/inc/downlevel.h
@@ -0,0 +1,239 @@
+// 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.
+////////////////////////////////////////////////////////////////////////////
+//
+// File: downlevel.h
+//
+
+
+//
+// Purpose: emulation on downlevel platforms.
+//
+////////////////////////////////////////////////////////////////////////////
+
+
+
+// Vista LCTYPES
+#ifndef LOCALE_SNAN
+#define LOCALE_SNAN 0x00000069 // Not a Number
+#endif
+
+#ifndef LOCALE_SPOSINFINITY
+#define LOCALE_SPOSINFINITY 0x0000006a // + Infinity
+#endif
+
+#ifndef LOCALE_SNEGINFINITY
+#define LOCALE_SNEGINFINITY 0x0000006b // - Infinity
+#endif
+
+#ifndef LOCALE_SPARENT
+#define LOCALE_SPARENT 0x0000006d // Fallback name for resources, eg "en" for "en-US"
+#endif
+
+// Win7 LCTYPES
+#ifndef LOCALE_IREADINGLAYOUT
+#define LOCALE_IREADINGLAYOUT 0x00000070 // Returns one of the following 4 reading layout values:
+ // 0 - Left to right (eg en-US)
+ // 1 - Right to left (eg arabic locales)
+ // 2 - Vertical top to bottom with columns to the left and also left to right (ja-JP locales)
+ // 3 - Vertical top to bottom with columns proceeding to the right
+#endif
+
+#ifndef LOCALE_INEUTRAL
+#define LOCALE_INEUTRAL 0x00000071 // Returns 0 for specific cultures, 1 for neutral cultures.
+#endif
+
+// Win7 LCTypes
+//
+// These are the various forms of the name of the locale:
+//
+#define LOCALE_SLOCALIZEDDISPLAYNAME 0x00000002 // localized name of locale, eg "German (Germany)" in UI language
+#define LOCALE_SENGLISHDISPLAYNAME 0x00000072 // Display name (language + country usually) in English, eg "German (Germany)"
+#define LOCALE_SNATIVEDISPLAYNAME 0x00000073 // Display name in native locale language, eg "Deutsch (Deutschland)
+
+#define LOCALE_SLOCALIZEDLANGUAGENAME 0x0000006f // Language Display Name for a language, eg "German" in UI language
+#define LOCALE_SENGLISHLANGUAGENAME 0x00001001 // English name of language, eg "German"
+#define LOCALE_SNATIVELANGUAGENAME 0x00000004 // native name of language, eg "Deutsch"
+
+#define LOCALE_SLOCALIZEDCOUNTRYNAME 0x00000006 // localized name of country, eg "Germany" in UI language
+#define LOCALE_SENGLISHCOUNTRYNAME 0x00001002 // English name of country, eg "Germany"
+#define LOCALE_SNATIVECOUNTRYNAME 0x00000008 // native name of country, eg "Deutschland"
+
+#define LOCALE_INEGATIVEPERCENT 0x00000074 // Returns 0-11 for the negative percent format
+#define LOCALE_IPOSITIVEPERCENT 0x00000075 // Returns 0-3 for the positive percent formatIPOSITIVEPERCENT
+#define LOCALE_SPERCENT 0x00000076 // Returns the percent symbol
+#define LOCALE_SPERMILLE 0x00000077 // Returns the permille (U+2030) symbol
+#define LOCALE_SMONTHDAY 0x00000078 // Returns the preferred month/day format
+#define LOCALE_SSHORTTIME 0x00000079 // Returns the preferred short time format (ie: no seconds, just h:mm)
+#define LOCALE_SOPENTYPELANGUAGETAG 0x0000007a // Open type language tag, eg: "latn" or "dflt"
+#define LOCALE_SSORTLOCALE 0x0000007b // Name of locale to use for sorting/collation/casing behavior.
+
+// TODO: These didn't make it to windows
+// const LCTYPE RESERVED_SADERA = 0x000008b; // Era name for gregorian calendar (ie: A.D.)
+// const LCTYPE RESERVED_SABBREVADERA = 0x000008c; // Abbreviated era name for gregorian calendar (ie: AD)
+
+// Vista CALTypes
+#ifndef CAL_SSHORTESTDAYNAME1
+#define CAL_SSHORTESTDAYNAME1 0x00000031
+#define CAL_SSHORTESTDAYNAME2 0x00000032
+#define CAL_SSHORTESTDAYNAME3 0x00000033
+#define CAL_SSHORTESTDAYNAME4 0x00000034
+#define CAL_SSHORTESTDAYNAME5 0x00000035
+#define CAL_SSHORTESTDAYNAME6 0x00000036
+#define CAL_SSHORTESTDAYNAME7 0x00000037
+#endif
+
+// Win7 CALTypes
+#define CAL_SMONTHDAY 0x00000038 // Month/day format
+#define CAL_SABBREVERASTRING 0x00000039 // Abbreviated era string (eg: AD)
+
+// Vista linguistic comparison flags
+#ifndef LINGUISTIC_IGNORECASE
+#define LINGUISTIC_IGNORECASE 0x00000010 // linguistically appropriate 'ignore case'
+#endif
+
+#ifndef LINGUISTIC_IGNOREDIACRITIC
+#define LINGUISTIC_IGNOREDIACRITIC 0x00000020 // linguistically appropriate 'ignore nonspace'
+#endif
+
+#ifndef NORM_LINGUISTIC_CASING
+#define NORM_LINGUISTIC_CASING 0x08000000 // use linguistic rules for casing
+#endif
+
+#ifndef LCMAP_TITLECASE
+#define LCMAP_TITLECASE 0x00000300 // reserved for title case behavior
+#endif
+
+#ifndef CALINFO_ENUMPROCEXEX
+typedef BOOL (CALLBACK* CALINFO_ENUMPROCEXEX)(LPWSTR, CALID, LPWSTR, LPARAM);
+#endif
+
+#ifndef DATEFMT_ENUMPROCEXEX
+typedef BOOL (CALLBACK* DATEFMT_ENUMPROCEXEX)(LPWSTR, CALID, LPARAM);
+#endif
+
+#ifndef TIMEFMT_ENUMPROCEX
+typedef BOOL (CALLBACK* TIMEFMT_ENUMPROCEX)(LPWSTR, LPARAM);
+#endif
+
+#ifndef HIGH_SURROGATE_START
+#define HIGH_SURROGATE_START 0xd800
+#define HIGH_SURROGATE_END 0xdbff
+#define LOW_SURROGATE_START 0xdc00
+#define LOW_SURROGATE_END 0xdfff
+#endif
+
+#ifndef PRIVATE_USE_BEGIN
+#define PRIVATE_USE_BEGIN 0xe000
+#define PRIVATE_USE_END 0xf8ff
+#endif
+
+#ifndef LCMAP_TITLECASE
+#define LCMAP_TITLECASE 0x00000300 // Title Case Letters
+#endif
+
+#ifndef __out_xcount_opt
+#define __out_xcount_opt(var) __out
+#endif
+
+namespace DownLevel
+{
+ // User /system defaults
+ // TODO: I don't think we need all of these.
+ int GetSystemDefaultLocaleName(__out_ecount(cchLocaleName) LPWSTR lpLocaleName, __in int cchLocaleName);
+ __success(return == 1) DWORD GetUserPreferredUILanguages (__in DWORD dwFlags, __out PULONG pulNumLanguages, __out_ecount_opt(*pcchLanguagesBuffer) PWSTR pwszLanguagesBuffer, __in PULONG pcchLanguagesBuffer);
+ int GetUserDefaultLocaleName(__out_ecount(cchLocaleName) LPWSTR lpLocaleName, __in int cchLocaleName);
+
+ // Locale and calendar information
+ int GetLocaleInfoEx (__in LPCWSTR lpLocaleName, __in LCTYPE LCType, __out_ecount_opt(cchData) LPWSTR lpLCData, __in int cchData);
+ int GetDateFormatEx(__in LPCWSTR lpLocaleName, __in DWORD dwFlags, __in_opt CONST SYSTEMTIME* lpDate, __in_opt LPCWSTR lpFormat,
+ __out_ecount(cchDate) LPWSTR lpDateStr, __in int cchDate, __in_opt LPCWSTR lpCalendar);
+ __success(return != 0)
+ int GetCalendarInfoEx(__in LPCWSTR lpLocaleName,
+ __in CALID Calendar,
+ __in_opt LPCWSTR pReserved,
+ __in CALTYPE CalType,
+ __out_ecount_opt(cchData) LPWSTR lpCalData,
+ __in int cchData,
+ __out_opt LPDWORD lpValue);
+
+ // Compareinfo type information
+ int TurkishCompareStringIgnoreCase(LCID lcid, DWORD dwCmpFlags, LPCWSTR lpString1, int cchCount1, LPCWSTR lpString2, int cchCount2);
+
+ int CompareStringEx(__in LPCWSTR lpLocaleName, __in DWORD dwCmpFlags, __in_ecount(cchCount1) LPCWSTR lpString1, __in int cchCount1, __in_ecount(cchCount2) LPCWSTR lpString2,
+ __in int cchCount2, __in_opt LPNLSVERSIONINFO lpVersionInformation, __in_opt LPVOID lpReserved, __in_opt LPARAM lParam );
+
+ int CompareStringOrdinal(__in_ecount(cchCount1) LPCWSTR string1, __in int cchCount1, __in_ecount(cchCount2) LPCWSTR string2, __in int cchCount2, __in BOOL bIgnoreCase);
+
+ __success(return != 0)
+ int LCMapStringEx(__in LPCWSTR lpLocaleName,
+ __in DWORD dwMapFlags,
+ __in_ecount(cchSrc) LPCWSTR lpSrcStr,
+ __in int cchSrc,
+ __out_xcount_opt(cchDest) LPWSTR lpDestStr,
+ __in int cchDest,
+ __in_opt LPNLSVERSIONINFO lpVersionInformation,
+ __in_opt LPVOID lpReserved,
+ __in_opt LPARAM lParam);
+
+ __success(return != -1)
+ int FindNLSStringEx(__in LPCWSTR lpLocaleName,
+ __in DWORD dwFindNLSStringFlags,
+ __in_ecount(cchSource) LPCWSTR lpStringSource,
+ __in int cchSource,
+ __in_ecount(cchValue) LPCWSTR lpStringValue,
+ __in int cchValue,
+ __out_opt LPINT pcchFound,
+ __in_opt LPNLSVERSIONINFO lpVersionInformation,
+ __in_opt LPVOID lpReserved,
+ __in_opt LPARAM lParam);
+
+ BOOL IsNLSDefinedString(NLS_FUNCTION Function, DWORD dwFlags, LPNLSVERSIONINFOEX lpVersionInfo, LPCWSTR lpString, int cchStr );
+
+ // Enumerations
+ namespace LegacyCallbacks
+ {
+ BOOL EnumDateFormatsExEx(DATEFMT_ENUMPROCEXEX lpDateFmtEnumProcExEx, LPCWSTR lpLocaleName, DWORD dwFlags, LPARAM lParam);
+ BOOL EnumTimeFormatsEx(TIMEFMT_ENUMPROCEX lpTimeFmtEnumProcEx, LPCWSTR lpLocaleName, DWORD dwFlags, LPARAM lParam);
+ BOOL EnumCalendarInfoExEx(CALINFO_ENUMPROCEXEX pCalInfoEnumProcExEx, LPCWSTR lpLocaleName, CALID Calendar, LPCWSTR lpReserved, CALTYPE CalType, LPARAM lParam);
+ }
+
+ // This is where we fudge data the OS doesn't know (even on Vista)
+ namespace UplevelFallback
+ {
+ __success(return != 0)
+ int LCMapStringEx(__in LPCWSTR lpLocaleName,
+ __in DWORD dwMapFlags,
+ __in_ecount(cchSrc) LPCWSTR lpSrcStr,
+ __in int cchSrc,
+ __out_xcount_opt(cchDest) LPWSTR lpDestStr,
+ __in int cchDest,
+ __in_opt LPNLSVERSIONINFO lpVersionInformation,
+ __in_opt LPVOID lpReserved,
+ __in_opt LPARAM lParam);
+
+ int GetLocaleInfoEx(__in LPCWSTR lpLocaleName, __in LCID lcid, __in LCTYPE LCType, __out_ecount_opt(cchData) LPWSTR lpLCData, __in int cchData);
+ int GetCalendarInfoEx(__in LPCWSTR lpLocaleName,
+ __in CALID Calendar,
+ __in_opt LPCWSTR pReserved,
+ __in CALTYPE CalType,
+ __out_ecount_opt(cchData) LPWSTR lpCalData,
+ __in int cchData,
+ __out_opt LPDWORD lpValue);
+ }
+
+ int LCIDToLocaleName(__in LCID Locale, __out_ecount_opt(cchName) LPWSTR lpName, __in int cchName, __in DWORD dwFlags);
+ LCID LocaleNameToLCID(__in LPCWSTR lpName , __in DWORD dwFlags);
+
+ int ResolveLocaleName(__in LPCWSTR lpNameToResolve, __in_ecount_opt(cchLocaleName) LPWSTR lpLocaleName, __in int cchLocaleName);
+
+ __success(return)
+ BOOL GetThreadPreferredUILanguages( __in DWORD dwFlags,
+ __out PULONG pulNumLanguages,
+ __out_ecount_opt(*pcchLanguagesBuffer) PWSTR pwszLanguagesBuffer,
+ __inout PULONG pcchLanguagesBuffer);
+
+};
+
+
diff --git a/src/inc/eetwain.h b/src/inc/eetwain.h
new file mode 100644
index 0000000000..6e183c5546
--- /dev/null
+++ b/src/inc/eetwain.h
@@ -0,0 +1,725 @@
+// 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.
+//*****************************************************************************
+//
+// EETwain.h
+//
+// This file has the definition of ICodeManager and EECodeManager.
+//
+// ICorJitCompiler compiles the IL of a method to native code, and stores
+// auxilliary data called as GCInfo (via ICorJitInfo::allocGCInfo()).
+// The data is used by the EE to manage the method's garbage collection,
+// exception handling, stack-walking etc.
+// This data can be parsed by an ICodeManager corresponding to that
+// ICorJitCompiler.
+//
+// EECodeManager is an implementation of ICodeManager for a default format
+// of GCInfo. Various ICorJitCompiler's are free to share this format so that
+// they do not need to provide their own implementation of ICodeManager
+// (though they are permitted to, if they want).
+//
+//*****************************************************************************
+
+#ifndef _EETWAIN_H
+#define _EETWAIN_H
+//*****************************************************************************
+
+#include <daccess.h>
+#include "regdisp.h"
+#include "corjit.h" // For NativeVarInfo
+#include "stackwalktypes.h"
+#include "bitvector.h"
+#include "gcinfotypes.h"
+
+#if !defined(_TARGET_X86_)
+#define USE_GC_INFO_DECODER
+#endif
+
+
+#if CHECK_APP_DOMAIN_LEAKS
+#define CHECK_APP_DOMAIN GC_CALL_CHECK_APP_DOMAIN
+#else
+#define CHECK_APP_DOMAIN 0
+#endif
+
+#define NO_OVERRIDE_OFFSET (DWORD)-1
+
+struct EHContext;
+
+#ifdef DACCESS_COMPILE
+typedef struct _DAC_SLOT_LOCATION
+{
+ int reg;
+ int regOffset;
+ bool targetPtr;
+
+ _DAC_SLOT_LOCATION(int _reg, int _regOffset, bool _targetPtr)
+ : reg(_reg), regOffset(_regOffset), targetPtr(_targetPtr)
+ {
+ }
+} DacSlotLocation;
+#endif
+
+typedef void (*GCEnumCallback)(
+ LPVOID hCallback, // callback data
+ OBJECTREF* pObject, // address of obect-reference we are reporting
+ uint32_t flags // is this a pinned and/or interior pointer
+ DAC_ARG(DacSlotLocation loc) // where the reference came from
+);
+
+/******************************************************************************
+ The stackwalker maintains some state on behalf of ICodeManager.
+*/
+
+const int CODEMAN_STATE_SIZE = 512;
+
+struct CodeManState
+{
+ DWORD dwIsSet; // Is set to 0 by the stackwalk as appropriate
+ BYTE stateBuf[CODEMAN_STATE_SIZE];
+};
+
+/******************************************************************************
+ These flags are used by some functions, although not all combinations might
+ make sense for all functions.
+*/
+
+enum ICodeManagerFlags
+{
+ ActiveStackFrame = 0x0001, // this is the currently active function
+ ExecutionAborted = 0x0002, // execution of this function has been aborted
+ // (i.e. it will not continue execution at the
+ // current location)
+ AbortingCall = 0x0004, // The current call will never return
+ UpdateAllRegs = 0x0008, // update full register set
+ CodeAltered = 0x0010, // code of that function might be altered
+ // (e.g. by debugger), need to call EE
+ // for original code
+ SpeculativeStackwalk
+ = 0x0020, // we're in the middle of a stackwalk seeded
+ // by an untrusted source (e.g., sampling profiler)
+
+ ParentOfFuncletStackFrame
+ = 0x0040, // A funclet for this frame was previously reported
+ NoReportUntracked
+ = 0x0080, // EnumGCRefs/EnumerateLiveSlots should *not* include
+ // any untracked slots
+};
+
+//*****************************************************************************
+//
+// EECodeInfo is used by ICodeManager to get information about the
+// method whose GCInfo is being processed.
+// It is useful so that some information which is available elsewhere does
+// not need to be cached in the GCInfo.
+//
+
+class EECodeInfo;
+
+enum GenericParamContextType
+{
+ GENERIC_PARAM_CONTEXT_NONE = 0,
+ GENERIC_PARAM_CONTEXT_THIS = 1,
+ GENERIC_PARAM_CONTEXT_METHODDESC = 2,
+ GENERIC_PARAM_CONTEXT_METHODTABLE = 3
+};
+
+//*****************************************************************************
+//
+// ICodeManager is the abstract class that all CodeManagers
+// must inherit from. This will probably need to move into
+// cor.h and become a real com interface.
+//
+//*****************************************************************************
+
+class ICodeManager
+{
+ VPTR_BASE_VTABLE_CLASS_AND_CTOR(ICodeManager)
+
+public:
+
+/*
+ Last chance for the runtime support to do fixups in the context
+ before execution continues inside a filter, catch handler, or fault/finally
+*/
+
+enum ContextType
+{
+ FILTER_CONTEXT,
+ CATCH_CONTEXT,
+ FINALLY_CONTEXT
+};
+
+/* Type of funclet corresponding to a shadow stack-pointer */
+
+enum
+{
+ SHADOW_SP_IN_FILTER = 0x1,
+ SHADOW_SP_FILTER_DONE = 0x2,
+ SHADOW_SP_BITS = 0x3
+};
+
+#ifndef DACCESS_COMPILE
+
+virtual void FixContext(ContextType ctxType,
+ EHContext *ctx,
+ EECodeInfo *pCodeInfo,
+ DWORD dwRelOffset,
+ DWORD nestingLevel,
+ OBJECTREF thrownObject,
+ CodeManState *pState,
+ size_t ** ppShadowSP, // OUT
+ size_t ** ppEndRegion) = 0; // OUT
+
+#endif // #ifndef DACCESS_COMPILE
+
+/*
+ Gets the ambient stack pointer value at the given nesting level within
+ the method.
+*/
+virtual TADDR GetAmbientSP(PREGDISPLAY pContext,
+ EECodeInfo *pCodeInfo,
+ DWORD dwRelOffset,
+ DWORD nestingLevel,
+ CodeManState *pState) = 0;
+
+/*
+ Get the number of bytes used for stack parameters.
+ This is currently only used on x86.
+*/
+virtual ULONG32 GetStackParameterSize(EECodeInfo* pCodeInfo) = 0;
+
+/*
+ Unwind the current stack frame, i.e. update the virtual register
+ set in pContext. This will be similar to the state after the function
+ returns back to caller (IP points to after the call, Frame and Stack
+ pointer has been reset, callee-saved registers restored
+ (if UpdateAllRegs), callee-UNsaved registers are trashed)
+ Returns success of operation.
+*/
+virtual bool UnwindStackFrame(PREGDISPLAY pContext,
+ EECodeInfo *pCodeInfo,
+ unsigned flags,
+ CodeManState *pState,
+ StackwalkCacheUnwindInfo *pUnwindInfo) = 0;
+
+/*
+ Is the function currently at a "GC safe point" ?
+ Can call EnumGcRefs() successfully
+*/
+virtual bool IsGcSafe(EECodeInfo *pCodeInfo,
+ DWORD dwRelOffset) = 0;
+
+#if defined(_TARGET_AMD64_) && defined(_DEBUG)
+/*
+ Locates the end of the last interruptible region in the given code range.
+ Returns 0 if the entire range is uninterruptible. Returns the end point
+ if the entire range is interruptible.
+*/
+virtual unsigned FindEndOfLastInterruptibleRegion(unsigned curOffset,
+ unsigned endOffset,
+ GCInfoToken gcInfoToken) = 0;
+#endif // _TARGET_AMD64_ && _DEBUG
+
+/*
+ Enumerate all live object references in that function using
+ the virtual register set. Same reference location cannot be enumerated
+ multiple times (but all differenct references pointing to the same
+ object have to be individually enumerated).
+ Returns success of operation.
+*/
+virtual bool EnumGcRefs(PREGDISPLAY pContext,
+ EECodeInfo *pCodeInfo,
+ unsigned flags,
+ GCEnumCallback pCallback,
+ LPVOID hCallBack,
+ DWORD relOffsetOverride = NO_OVERRIDE_OFFSET) = 0;
+
+/*
+ Return the address of the local security object reference
+ (if available).
+*/
+virtual OBJECTREF* GetAddrOfSecurityObject(CrawlFrame *pCF) = 0;
+
+/*
+ For a non-static method, "this" pointer is passed in as argument 0.
+ However, if there is a "ldarga 0" or "starg 0" in the IL,
+ JIT will create a copy of arg0 and redirect all "ldarg(a) 0" and "starg 0" to this copy.
+ (See Compiler::lvaArg0Var for more details.)
+
+ The following method returns the original "this" argument, i.e. the one that is passed in,
+ if it is a non-static method AND the object is still alive.
+ Returns NULL in all other cases.
+*/
+virtual OBJECTREF GetInstance(PREGDISPLAY pContext,
+ EECodeInfo* pCodeInfo) = 0;
+
+/*
+ Returns the extra argument passed to to shared generic code if it is still alive.
+ Returns NULL in all other cases.
+*/
+virtual PTR_VOID GetParamTypeArg(PREGDISPLAY pContext,
+ EECodeInfo * pCodeInfo) = 0;
+
+// Returns the type of the context parameter (this, methodtable, methoddesc, or none)
+virtual GenericParamContextType GetParamContextType(PREGDISPLAY pContext,
+ EECodeInfo * pCodeInfo) = 0;
+
+/*
+ Returns the offset of the GuardStack cookie if it exists.
+ Returns NULL if there is no cookie.
+*/
+virtual void * GetGSCookieAddr(PREGDISPLAY pContext,
+ EECodeInfo * pCodeInfo,
+ CodeManState * pState) = 0;
+
+/*
+ Returns true if the given IP is in the given method's prolog or an epilog.
+*/
+virtual bool IsInPrologOrEpilog(DWORD relPCOffset,
+ PTR_VOID methodInfoPtr,
+ size_t* prologSize) = 0;
+
+/*
+ Returns true if the given IP is in the synchronized region of the method (valid for synchronized methods only)
+*/
+virtual bool IsInSynchronizedRegion(
+ DWORD relOffset,
+ PTR_VOID methodInfoPtr,
+ unsigned flags) = 0;
+
+/*
+ Returns the size of a given function as reported in the GC info (does
+ not take procedure splitting into account). For the actual size of
+ the hot region call IJitManager::JitTokenToMethodHotSize.
+*/
+virtual size_t GetFunctionSize(GCInfoToken gcInfoToken) = 0;
+
+/*
+ Returns the size of the frame (barring localloc)
+*/
+virtual unsigned int GetFrameSize(PTR_VOID methodInfoPtr) = 0;
+
+#ifndef DACCESS_COMPILE
+
+/* Debugger API */
+
+virtual const BYTE* GetFinallyReturnAddr(PREGDISPLAY pReg)=0;
+
+virtual BOOL IsInFilter(void *methodInfoPtr,
+ unsigned offset,
+ PCONTEXT pCtx,
+ DWORD curNestLevel) = 0;
+
+virtual BOOL LeaveFinally(void *methodInfoPtr,
+ unsigned offset,
+ PCONTEXT pCtx) = 0;
+
+virtual void LeaveCatch(void *methodInfoPtr,
+ unsigned offset,
+ PCONTEXT pCtx)=0;
+
+#ifdef EnC_SUPPORTED
+
+/*
+ Last chance for the runtime support to do fixups in the context
+ before execution continues inside an EnC updated function.
+*/
+
+virtual HRESULT FixContextForEnC(PCONTEXT pCtx,
+ EECodeInfo * pOldCodeInfo,
+ const ICorDebugInfo::NativeVarInfo * oldMethodVars,
+ SIZE_T oldMethodVarsCount,
+ EECodeInfo * pNewCodeInfo,
+ const ICorDebugInfo::NativeVarInfo * newMethodVars,
+ SIZE_T newMethodVarsCount) = 0;
+
+#endif // EnC_SUPPORTED
+
+#endif // #ifndef DACCESS_COMPILE
+
+
+#ifdef DACCESS_COMPILE
+ virtual void EnumMemoryRegions(CLRDataEnumMemoryFlags flags) = 0;
+#endif
+};
+
+//*****************************************************************************
+//
+// EECodeManager is the EE's implementation of the ICodeManager which
+// supports the default format of GCInfo.
+//
+//*****************************************************************************
+
+struct hdrInfo;
+
+class EECodeManager : public ICodeManager {
+
+ VPTR_VTABLE_CLASS_AND_CTOR(EECodeManager, ICodeManager)
+
+public:
+
+
+#ifndef DACCESS_COMPILE
+
+/*
+ Last chance for the runtime support to do fixups in the context
+ before execution continues inside a filter, catch handler, or finally
+*/
+virtual
+void FixContext(ContextType ctxType,
+ EHContext *ctx,
+ EECodeInfo *pCodeInfo,
+ DWORD dwRelOffset,
+ DWORD nestingLevel,
+ OBJECTREF thrownObject,
+ CodeManState *pState,
+ size_t ** ppShadowSP, // OUT
+ size_t ** ppEndRegion); // OUT
+
+#endif // #ifndef DACCESS_COMPILE
+
+/*
+ Gets the ambient stack pointer value at the given nesting level within
+ the method.
+*/
+virtual
+TADDR GetAmbientSP(PREGDISPLAY pContext,
+ EECodeInfo *pCodeInfo,
+ DWORD dwRelOffset,
+ DWORD nestingLevel,
+ CodeManState *pState);
+
+/*
+ Get the number of bytes used for stack parameters.
+ This is currently only used on x86.
+*/
+virtual
+ULONG32 GetStackParameterSize(EECodeInfo* pCodeInfo);
+
+/*
+ Unwind the current stack frame, i.e. update the virtual register
+ set in pContext. This will be similar to the state after the function
+ returns back to caller (IP points to after the call, Frame and Stack
+ pointer has been reset, callee-saved registers restored
+ (if UpdateAllRegs), callee-UNsaved registers are trashed)
+ Returns success of operation.
+*/
+virtual
+bool UnwindStackFrame(
+ PREGDISPLAY pContext,
+ EECodeInfo *pCodeInfo,
+ unsigned flags,
+ CodeManState *pState,
+ StackwalkCacheUnwindInfo *pUnwindInfo);
+
+enum QuickUnwindFlag
+{
+ UnwindCurrentStackFrame,
+ EnsureCallerStackFrameIsValid
+};
+
+/*
+ * Light unwind the current stack frame, using provided cache entry.
+ * only pPC and Esp of pContext are updated. And pEbp if necessary.
+ */
+
+static
+void QuickUnwindStackFrame(
+ PREGDISPLAY pRD,
+ StackwalkCacheEntry *pCacheEntry,
+ QuickUnwindFlag flag);
+
+/*
+ Is the function currently at a "GC safe point" ?
+ Can call EnumGcRefs() successfully
+*/
+virtual
+bool IsGcSafe( EECodeInfo *pCodeInfo,
+ DWORD dwRelOffset);
+
+#if defined(_TARGET_AMD64_) && defined(_DEBUG)
+/*
+ Locates the end of the last interruptible region in the given code range.
+ Returns 0 if the entire range is uninterruptible. Returns the end point
+ if the entire range is interruptible.
+*/
+virtual
+unsigned FindEndOfLastInterruptibleRegion(unsigned curOffset,
+ unsigned endOffset,
+ GCInfoToken gcInfoToken);
+#endif // _TARGET_AMD64_ && _DEBUG
+
+/*
+ Enumerate all live object references in that function using
+ the virtual register set. Same reference location cannot be enumerated
+ multiple times (but all differenct references pointing to the same
+ object have to be individually enumerated).
+ Returns success of operation.
+*/
+virtual
+bool EnumGcRefs(PREGDISPLAY pContext,
+ EECodeInfo *pCodeInfo,
+ unsigned flags,
+ GCEnumCallback pCallback,
+ LPVOID hCallBack,
+ DWORD relOffsetOverride = NO_OVERRIDE_OFFSET);
+
+#ifdef FEATURE_CONSERVATIVE_GC
+// Temporary conservative collection, for testing purposes, until we have
+// accurate gc info from the JIT.
+bool EnumGcRefsConservative(PREGDISPLAY pRD,
+ EECodeInfo *pCodeInfo,
+ unsigned flags,
+ GCEnumCallback pCallBack,
+ LPVOID hCallBack);
+#endif // FEATURE_CONSERVATIVE_GC
+
+/*
+ Return the address of the local security object reference
+ using data that was previously cached before in UnwindStackFrame
+ using StackwalkCacheUnwindInfo
+*/
+static OBJECTREF* GetAddrOfSecurityObjectFromCachedInfo(
+ PREGDISPLAY pRD,
+ StackwalkCacheUnwindInfo * stackwalkCacheUnwindInfo);
+
+virtual
+OBJECTREF* GetAddrOfSecurityObject(CrawlFrame *pCF) DAC_UNEXPECTED();
+
+virtual
+OBJECTREF GetInstance(
+ PREGDISPLAY pContext,
+ EECodeInfo * pCodeInfo);
+
+/*
+ Returns the extra argument passed to to shared generic code if it is still alive.
+ Returns NULL in all other cases.
+*/
+virtual
+PTR_VOID GetParamTypeArg(PREGDISPLAY pContext,
+ EECodeInfo * pCodeInfo);
+
+// Returns the type of the context parameter (this, methodtable, methoddesc, or none)
+virtual GenericParamContextType GetParamContextType(PREGDISPLAY pContext,
+ EECodeInfo * pCodeInfo);
+
+#if defined(WIN64EXCEPTIONS) && !defined(CROSSGEN_COMPILE)
+/*
+ Returns the generics token. This is used by GetInstance() and GetParamTypeArg() on WIN64.
+*/
+static
+PTR_VOID GetExactGenericsToken(PREGDISPLAY pContext,
+ EECodeInfo * pCodeInfo);
+
+static
+PTR_VOID GetExactGenericsToken(SIZE_T baseStackSlot,
+ EECodeInfo * pCodeInfo);
+
+
+#endif // WIN64EXCEPTIONS && !CROSSGEN_COMPILE
+
+/*
+ Returns the offset of the GuardStack cookie if it exists.
+ Returns NULL if there is no cookie.
+*/
+virtual
+void * GetGSCookieAddr(PREGDISPLAY pContext,
+ EECodeInfo * pCodeInfo,
+ CodeManState * pState);
+
+
+/*
+ Returns true if the given IP is in the given method's prolog or an epilog.
+*/
+virtual
+bool IsInPrologOrEpilog(
+ DWORD relOffset,
+ PTR_VOID methodInfoPtr,
+ size_t* prologSize);
+
+/*
+ Returns true if the given IP is in the synchronized region of the method (valid for synchronized functions only)
+*/
+virtual
+bool IsInSynchronizedRegion(
+ DWORD relOffset,
+ PTR_VOID methodInfoPtr,
+ unsigned flags);
+
+/*
+ Returns the size of a given function.
+*/
+virtual
+size_t GetFunctionSize(GCInfoToken gcInfoToken);
+
+/*
+ Returns the size of the frame (barring localloc)
+*/
+virtual
+unsigned int GetFrameSize(
+ PTR_VOID methodInfoPtr);
+
+#ifndef DACCESS_COMPILE
+
+virtual const BYTE* GetFinallyReturnAddr(PREGDISPLAY pReg);
+virtual BOOL LeaveFinally(void *methodInfoPtr,
+ unsigned offset,
+ PCONTEXT pCtx);
+virtual BOOL IsInFilter(void *methodInfoPtr,
+ unsigned offset,
+ PCONTEXT pCtx,
+ DWORD curNestLevel);
+virtual void LeaveCatch(void *methodInfoPtr,
+ unsigned offset,
+ PCONTEXT pCtx);
+
+#ifdef EnC_SUPPORTED
+/*
+ Last chance for the runtime support to do fixups in the context
+ before execution continues inside an EnC updated function.
+*/
+virtual
+HRESULT FixContextForEnC(PCONTEXT pCtx,
+ EECodeInfo * pOldCodeInfo,
+ const ICorDebugInfo::NativeVarInfo * oldMethodVars,
+ SIZE_T oldMethodVarsCount,
+ EECodeInfo * pNewCodeInfo,
+ const ICorDebugInfo::NativeVarInfo * newMethodVars,
+ SIZE_T newMethodVarsCount);
+#endif // EnC_SUPPORTED
+
+#endif // #ifndef DACCESS_COMPILE
+
+#ifndef _TARGET_X86_
+ static void EnsureCallerContextIsValid( PREGDISPLAY pRD, StackwalkCacheEntry* pCacheEntry, EECodeInfo * pCodeInfo = NULL );
+ static size_t GetCallerSp( PREGDISPLAY pRD );
+#endif
+
+#ifdef DACCESS_COMPILE
+ virtual void EnumMemoryRegions(CLRDataEnumMemoryFlags flags);
+#endif
+
+};
+
+
+/*****************************************************************************
+ <TODO>ToDo: Do we want to include JIT/IL/target.h? </TODO>
+ */
+
+enum regNum
+{
+ REGI_EAX, REGI_ECX, REGI_EDX, REGI_EBX,
+ REGI_ESP, REGI_EBP, REGI_ESI, REGI_EDI,
+ REGI_COUNT,
+ REGI_NA = REGI_COUNT
+};
+
+/*****************************************************************************
+ Register masks
+ */
+
+enum RegMask
+{
+ RM_EAX = 0x01,
+ RM_ECX = 0x02,
+ RM_EDX = 0x04,
+ RM_EBX = 0x08,
+ RM_ESP = 0x10,
+ RM_EBP = 0x20,
+ RM_ESI = 0x40,
+ RM_EDI = 0x80,
+
+ RM_NONE = 0x00,
+ RM_ALL = (RM_EAX|RM_ECX|RM_EDX|RM_EBX|RM_ESP|RM_EBP|RM_ESI|RM_EDI),
+ RM_CALLEE_SAVED = (RM_EBP|RM_EBX|RM_ESI|RM_EDI),
+ RM_CALLEE_TRASHED = (RM_ALL & ~RM_CALLEE_SAVED),
+};
+
+/*****************************************************************************
+ *
+ * Helper to extract basic info from a method info block.
+ */
+
+struct hdrInfo
+{
+ unsigned int methodSize; // native code bytes
+ unsigned int argSize; // in bytes
+ unsigned int stackSize; /* including callee saved registers */
+ unsigned int rawStkSize; /* excluding callee saved registers */
+
+ unsigned int prologSize;
+
+ // Size of the epilogs in the method.
+ // For methods which use CEE_JMP, some epilogs may end with a "ret" instruction
+ // and some may end with a "jmp". The epilogSize reported should be for the
+ // epilog with the smallest size.
+ unsigned int epilogSize;
+
+ unsigned char epilogCnt;
+ bool epilogEnd; // is the epilog at the end of the method
+
+ bool ebpFrame; // locals and arguments addressed relative to EBP
+ bool doubleAlign; // is the stack double-aligned? locals addressed relative to ESP, and arguments relative to EBP
+ bool interruptible; // intr. at all times (excluding prolog/epilog), not just call sites
+
+ bool securityCheck; // has a slot for security object
+ bool handlers; // has callable handlers
+ bool localloc; // uses localloc
+ bool editNcontinue; // has been compiled in EnC mode
+ bool varargs; // is this a varargs routine
+ bool profCallbacks; // does the method have Enter-Leave callbacks
+ bool genericsContext;// has a reported generic context paramter
+ bool genericsContextIsMethodDesc;// reported generic context parameter is methoddesc
+ bool isSpeculativeStackWalk; // is the stackwalk seeded by an untrusted source (e.g., sampling profiler)?
+
+ // These always includes EBP for EBP-frames and double-aligned-frames
+ RegMask savedRegMask:8; // which callee-saved regs are saved on stack
+
+ // Count of the callee-saved registers, excluding the frame pointer.
+ // This does not include EBP for EBP-frames and double-aligned-frames.
+ unsigned int savedRegsCountExclFP;
+
+ unsigned int untrackedCnt;
+ unsigned int varPtrTableSize;
+ unsigned int argTabOffset; // INVALID_ARGTAB_OFFSET if argtab must be reached by stepping through ptr tables
+ unsigned int gsCookieOffset; // INVALID_GS_COOKIE_OFFSET if there is no GuardStack cookie
+
+ unsigned int syncStartOffset; // start/end code offset of the protected region in synchronized methods.
+ unsigned int syncEndOffset; // INVALID_SYNC_OFFSET if there not synchronized method
+ unsigned int syncEpilogStart; // The start of the epilog. Synchronized methods are guaranteed to have no more than one epilog.
+
+ enum { NOT_IN_PROLOG = -1, NOT_IN_EPILOG = -1 };
+
+ int prologOffs; // NOT_IN_PROLOG if not in prolog
+ int epilogOffs; // NOT_IN_EPILOG if not in epilog. It is never 0
+
+ //
+ // Results passed back from scanArgRegTable
+ //
+ regNum thisPtrResult; // register holding "this"
+ RegMask regMaskResult; // registers currently holding GC ptrs
+ RegMask iregMaskResult; // iptr qualifier for regMaskResult
+ unsigned argHnumResult;
+ PTR_CBYTE argTabResult; // Table of encoded offsets of pending ptr args
+ unsigned argTabBytes; // Number of bytes in argTabResult[]
+
+ // These next two are now large structs (i.e 132 bytes each)
+
+ ptrArgTP argMaskResult; // pending arguments mask
+ ptrArgTP iargMaskResult; // iptr qualifier for argMaskResult
+};
+
+/*****************************************************************************
+ How the stackwalkers buffer will be interpreted
+*/
+
+struct CodeManStateBuf
+{
+ DWORD hdrInfoSize;
+ hdrInfo hdrInfoBody;
+};
+//*****************************************************************************
+#endif // _EETWAIN_H
+//*****************************************************************************
diff --git a/src/inc/eexcp.h b/src/inc/eexcp.h
new file mode 100644
index 0000000000..b91522b4d8
--- /dev/null
+++ b/src/inc/eexcp.h
@@ -0,0 +1,156 @@
+// 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.
+
+// ==++==
+//
+
+//
+//
+
+//
+// ==--==
+
+
+#ifndef __eexcp_h__
+#define __eexcp_h__
+
+#include "corhlpr.h"
+#include "daccess.h"
+
+struct EE_ILEXCEPTION_CLAUSE;
+typedef DPTR(EE_ILEXCEPTION_CLAUSE) PTR_EE_ILEXCEPTION_CLAUSE;
+
+// The exception handling sub-system needs to keep track of EH clause that is handling given exception.
+// PTR_EXCEPTION_CLAUSE_TOKEN is opaque pointer that uniquely identifies
+// exception handling clause. It abstracts away encoding differences of EH clauses between JIT and NGen.
+typedef PTR_VOID PTR_EXCEPTION_CLAUSE_TOKEN;
+
+struct EE_ILEXCEPTION_CLAUSE {
+ //Flags is not marked as volatile since it is always accessed
+ // from within a critical section
+ CorExceptionFlag Flags;
+ DWORD TryStartPC;
+ DWORD TryEndPC;
+ DWORD HandlerStartPC;
+ DWORD HandlerEndPC;
+ union {
+ void* TypeHandle;
+ mdToken ClassToken;
+ DWORD FilterOffset;
+ };
+};
+
+struct EE_ILEXCEPTION;
+typedef DPTR(EE_ILEXCEPTION) PTR_EE_ILEXCEPTION;
+
+struct EE_ILEXCEPTION : public COR_ILMETHOD_SECT_FAT
+{
+ EE_ILEXCEPTION_CLAUSE Clauses[1]; // actually variable size
+
+ void Init(unsigned ehCount)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ SetKind(CorILMethod_Sect_FatFormat);
+ SetDataSize((unsigned)sizeof(EE_ILEXCEPTION_CLAUSE) * ehCount);
+ }
+
+ unsigned EHCount() const
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ return GetDataSize() / (DWORD) sizeof(EE_ILEXCEPTION_CLAUSE);
+ }
+
+ static unsigned Size(unsigned ehCount)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ _ASSERTE(ehCount > 0);
+
+ return (offsetof(EE_ILEXCEPTION, Clauses) + sizeof(EE_ILEXCEPTION_CLAUSE) * ehCount);
+ }
+ EE_ILEXCEPTION_CLAUSE *EHClause(unsigned i)
+ {
+ LIMITED_METHOD_DAC_CONTRACT;
+ return &(PTR_EE_ILEXCEPTION_CLAUSE(PTR_HOST_MEMBER_TADDR(EE_ILEXCEPTION,this,Clauses))[i]);
+ }
+};
+
+#define COR_ILEXCEPTION_CLAUSE_CACHED_CLASS 0x10000000
+
+inline BOOL HasCachedTypeHandle(EE_ILEXCEPTION_CLAUSE *EHClause)
+{
+ _ASSERTE(sizeof(EHClause->Flags) == sizeof(DWORD));
+ return (EHClause->Flags & COR_ILEXCEPTION_CLAUSE_CACHED_CLASS);
+}
+
+inline void SetHasCachedTypeHandle(EE_ILEXCEPTION_CLAUSE *EHClause)
+{
+ _ASSERTE(! HasCachedTypeHandle(EHClause));
+ EHClause->Flags = (CorExceptionFlag)(EHClause->Flags | COR_ILEXCEPTION_CLAUSE_CACHED_CLASS);
+}
+
+inline BOOL IsFinally(EE_ILEXCEPTION_CLAUSE *EHClause)
+{
+ LIMITED_METHOD_CONTRACT;
+
+ return (EHClause->Flags & COR_ILEXCEPTION_CLAUSE_FINALLY);
+}
+
+inline BOOL IsFault(EE_ILEXCEPTION_CLAUSE *EHClause)
+{
+ LIMITED_METHOD_CONTRACT;
+
+ return (EHClause->Flags & COR_ILEXCEPTION_CLAUSE_FAULT);
+}
+
+inline BOOL IsFaultOrFinally(EE_ILEXCEPTION_CLAUSE *EHClause)
+{
+ return IsFault(EHClause) || IsFinally(EHClause);
+}
+
+inline BOOL IsFilterHandler(EE_ILEXCEPTION_CLAUSE *EHClause)
+{
+ LIMITED_METHOD_CONTRACT;
+
+ return EHClause->Flags & COR_ILEXCEPTION_CLAUSE_FILTER;
+}
+
+inline BOOL IsTypedHandler(EE_ILEXCEPTION_CLAUSE *EHClause)
+{
+ return ! (IsFilterHandler(EHClause) || IsFaultOrFinally(EHClause));
+}
+
+inline BOOL IsDuplicateClause(EE_ILEXCEPTION_CLAUSE* pEHClause)
+{
+ return pEHClause->Flags & COR_ILEXCEPTION_CLAUSE_DUPLICATED;
+}
+
+#if defined(_TARGET_AMD64_) || defined(_TARGET_ARM64_)
+// Finally is the only EH construct that can be part of the execution as being fall-through.
+//
+// "Cloned" finally is a contruct that represents a finally block that is used as
+// fall through for normal try-block execution. Such a "cloned" finally will:
+//
+// 1) Have its try-clause's Start and End PC the same as its handler's start PC (i.e. will have
+// zero length try block), AND
+// 2) Is marked duplicate
+//
+// Because of their fall-through nature, JIT guarantees that only finally constructs can be cloned,
+// and not catch or fault (since they cannot be fallen through but are invoked as funclets).
+//
+// The cloned finally construct is also used to mark "call to finally" thunks that are not within
+// the EH region protected by the finally, and also not within the enclosing region. This is done
+// to prevent ThreadAbortException from creating an infinite loop of calling the same finally.
+inline BOOL IsClonedFinally(EE_ILEXCEPTION_CLAUSE* pEHClause)
+{
+ return ((pEHClause->TryStartPC == pEHClause->TryEndPC) &&
+ (pEHClause->TryStartPC == pEHClause->HandlerStartPC) &&
+ IsFinally(pEHClause) && IsDuplicateClause(pEHClause));
+}
+#endif // defined(_TARGET_AMD64_) || defined(_TARGET_ARM64_)
+
+#endif // __eexcp_h__
+
diff --git a/src/inc/entrypoints.h b/src/inc/entrypoints.h
new file mode 100644
index 0000000000..064f4ede29
--- /dev/null
+++ b/src/inc/entrypoints.h
@@ -0,0 +1,60 @@
+// 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.
+//-----------------------------------------------------------------------------
+// Entrypoint markers
+// Used to identify all external entrypoints into the CLR (via COM, exports, etc)
+// and perform various tasks on all of them
+//-----------------------------------------------------------------------------
+
+
+#ifndef __ENTRYPOINTS_h__
+#define __ENTRYPOINTS_h__
+
+#define BEGIN_ENTRYPOINT_THROWS \
+ BEGIN_SO_INTOLERANT_CODE(GetThread()) \
+
+
+#define END_ENTRYPOINT_THROWS \
+ END_SO_INTOLERANT_CODE;
+
+#define BEGIN_ENTRYPOINT_THROWS_WITH_THREAD(____thread) \
+ BEGIN_SO_INTOLERANT_CODE(____thread) \
+
+#define END_ENTRYPOINT_THROWS_WITH_THREAD \
+ END_SO_INTOLERANT_CODE;
+
+#define BEGIN_ENTRYPOINT_NOTHROW_WITH_THREAD(___thread) \
+ BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(return COR_E_STACKOVERFLOW)
+
+#define END_ENTRYPOINT_NOTHROW_WITH_THREAD \
+ END_SO_INTOLERANT_CODE;
+
+#define BEGIN_ENTRYPOINT_NOTHROW \
+ BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(return COR_E_STACKOVERFLOW)
+
+#define END_ENTRYPOINT_NOTHROW \
+ END_SO_INTOLERANT_CODE;
+
+extern void (*g_fpHandleSoftStackOverflow)(BOOL fSkipDebugger);
+inline void FailedVoidEntryPoint()
+{
+ if (g_fpHandleSoftStackOverflow)
+ {
+ g_fpHandleSoftStackOverflow(FALSE);
+ }
+}
+#define BEGIN_ENTRYPOINT_VOIDRET \
+ BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(FailedVoidEntryPoint();)
+
+#define END_ENTRYPOINT_VOIDRET \
+ END_SO_INTOLERANT_CODE;
+
+#define BEGIN_CLEANUP_ENTRYPOINT \
+ VALIDATE_BACKOUT_STACK_CONSUMPTION;
+
+#define END_CLEANUP_ENTRYPOINT
+
+#endif // __ENTRYPOINTS_h__
+
+
diff --git a/src/inc/eventtrace.h b/src/inc/eventtrace.h
new file mode 100644
index 0000000000..67d9b7942e
--- /dev/null
+++ b/src/inc/eventtrace.h
@@ -0,0 +1,346 @@
+// 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.
+//
+// File: eventtrace.h
+// Abstract: This module implements Event Tracing support. This includes
+// eventtracebase.h, and adds VM-specific ETW helpers to support features like type
+// logging, allocation logging, and gc heap walk logging.
+//
+
+//
+
+//
+//
+// #EventTracing
+// Windows
+// ETW (Event Tracing for Windows) is a high-performance, low overhead and highly scalable
+// tracing facility provided by the Windows Operating System. ETW is available on Win2K and above. There are
+// four main types of components in ETW: event providers, controllers, consumers, and event trace sessions.
+// An event provider is a logical entity that writes events to ETW sessions. The event provider must register
+// a provider ID with ETW through the registration API. A provider first registers with ETW and writes events
+// from various points in the code by invoking the ETW logging API. When a provider is enabled dynamically by
+// the ETW controller application, calls to the logging API sends events to a specific trace session
+// designated by the controller. Each event sent by the event provider to the trace session consists of a
+// fixed header that includes event metadata and additional variable user-context data. CLR is an event
+// provider.
+
+// Mac
+// DTrace is similar to ETW and has been made to look like ETW at most of the places.
+// For convenience, it is called ETM (Event Tracing for Mac) and exists only on the Mac Leopard OS
+// ============================================================================
+
+#ifndef _VMEVENTTRACE_H_
+#define _VMEVENTTRACE_H_
+
+#include "eventtracebase.h"
+
+
+#ifndef FEATURE_REDHAWK
+
+namespace ETW
+{
+ class LoggedTypesFromModule;
+
+ // We keep a hash of these to keep track of:
+ // * Which types have been logged through ETW (so we can avoid logging dupe Type
+ // events), and
+ // * GCSampledObjectAllocation stats to help with "smart sampling" which
+ // dynamically adjusts sampling rate of objects by type.
+ // See code:LoggedTypesFromModuleTraits
+ struct TypeLoggingInfo
+ {
+ public:
+ TypeLoggingInfo(TypeHandle thParam)
+ {
+ Init(thParam);
+ }
+
+ TypeLoggingInfo()
+ {
+ Init(TypeHandle());
+ }
+
+ void Init(TypeHandle thParam)
+ {
+ th = thParam;
+ dwTickOfCurrentTimeBucket = 0;
+ dwAllocCountInCurrentBucket = 0;
+ flAllocPerMSec = 0;
+
+ dwAllocsToSkipPerSample = 0;
+ dwAllocsSkippedForSample = 0;
+ cbIgnoredSizeForSample = 0;
+ };
+
+ // The type this TypeLoggingInfo represents
+ TypeHandle th;
+
+ // Smart sampling
+
+ // These bucket values remember stats of a particular time slice that are used to
+ // help adjust the sampling rate
+ DWORD dwTickOfCurrentTimeBucket;
+ DWORD dwAllocCountInCurrentBucket;
+ float flAllocPerMSec;
+
+ // The number of data points to ignore before taking a "sample" (i.e., logging a
+ // GCSampledObjectAllocation ETW event for this type)
+ DWORD dwAllocsToSkipPerSample;
+
+ // The current number of data points actually ignored for the current sample
+ DWORD dwAllocsSkippedForSample;
+
+ // The current count of bytes of objects of this type actually allocated (and
+ // ignored) for the current sample
+ SIZE_T cbIgnoredSizeForSample;
+ };
+
+ // Class to wrap all type system logic for ETW
+ class TypeSystemLog
+ {
+ private:
+ // Global type hash
+ static AllLoggedTypes *s_pAllLoggedTypes;
+
+ // An unsigned value that gets incremented whenever a global change is made.
+ // When this occurs, threads must synchronize themselves with the global state.
+ // Examples include unloading of modules and disabling of allocation sampling.
+ static unsigned int s_nEpoch;
+
+ // See code:ETW::TypeSystemLog::PostRegistrationInit
+ static BOOL s_fHeapAllocEventEnabledOnStartup;
+ static BOOL s_fHeapAllocHighEventEnabledNow;
+ static BOOL s_fHeapAllocLowEventEnabledNow;
+
+ // If COMPLUS_UNSUPPORTED_ETW_ObjectAllocationEventsPerTypePerSec is set, then
+ // this is used to determine the event frequency, overriding
+ // s_nDefaultMsBetweenEvents above (regardless of which
+ // GCSampledObjectAllocation*Keyword was used)
+ static int s_nCustomMsBetweenEvents;
+
+ public:
+ // This customizes the type logging behavior in LogTypeAndParametersIfNecessary
+ enum TypeLogBehavior
+ {
+ // Take lock, and consult hash table to see if this is the first time we've
+ // encountered the type, in which case, log it
+ kTypeLogBehaviorTakeLockAndLogIfFirstTime,
+
+ // Don't take lock, don't consult hash table. Just log the type. (This is
+ // used in cases when checking for dupe type logging isn't worth it, such as
+ // when logging the finalization of an object.)
+ kTypeLogBehaviorAlwaysLog,
+
+ // When logging the type for GCSampledObjectAllocation events,
+ // we already know we need to log the type (since we already
+ // looked it up in the hash). But we would still need to consult the hash
+ // for any type parameters, so kTypeLogBehaviorAlwaysLog isn't appropriate,
+ // and this is used instead.
+ kTypeLogBehaviorAlwaysLogTopLevelType,
+ };
+
+ static HRESULT PreRegistrationInit();
+ static void PostRegistrationInit();
+ static BOOL IsHeapAllocEventEnabled();
+ static void SendObjectAllocatedEvent(Object * pObject);
+ static CrstBase * GetHashCrst();
+ static VOID LogTypeAndParametersIfNecessary(BulkTypeEventLogger * pBulkTypeEventLogger, ULONGLONG thAsAddr, TypeLogBehavior typeLogBehavior);
+ static VOID OnModuleUnload(Module * pModule);
+ static void OnKeywordsChanged();
+ static void Cleanup();
+ static VOID DeleteTypeHashNoLock(AllLoggedTypes **ppAllLoggedTypes);
+ static VOID FlushObjectAllocationEvents();
+
+ private:
+ static BOOL ShouldLogType(TypeHandle th);
+ static TypeLoggingInfo LookupOrCreateTypeLoggingInfo(TypeHandle th, BOOL * pfCreatedNew, LoggedTypesFromModule ** ppLoggedTypesFromModule = NULL);
+ static BOOL AddTypeToGlobalCacheIfNotExists(TypeHandle th, BOOL * pfCreatedNew);
+ static BOOL AddOrReplaceTypeLoggingInfo(ETW::LoggedTypesFromModule * pLoggedTypesFromModule, const ETW::TypeLoggingInfo * pTypeLoggingInfo);
+ static int GetDefaultMsBetweenEvents();
+ static VOID OnTypesKeywordTurnedOff();
+ };
+
+#endif // FEATURE_REDHAWK
+
+
+ // Class to wrap all GC logic for ETW
+ class GCLog
+ {
+ private:
+ // When WPA triggers a GC, it gives us this unique number to append to our
+ // GCStart event so WPA can correlate the CLR's GC with the JScript GC they
+ // triggered at the same time.
+ //
+ // We set this value when the GC is triggered, and then retrieve the value on the
+ // first subsequent FireGcStart() method call for a full, induced GC, assuming
+ // that that's the GC that WPA triggered. This is imperfect, and if we were in
+ // the act of beginning another full, induced GC (for some other reason), then
+ // we'll attach this sequence number to that GC instead of to the WPA-induced GC,
+ // but who cares? When parsing ETW logs later on, it's indistinguishable if both
+ // GCs really were induced at around the same time.
+#ifdef FEATURE_REDHAWK
+ static volatile LONGLONG s_l64LastClientSequenceNumber;
+#else // FEATURE_REDHAWK
+ static Volatile<LONGLONG> s_l64LastClientSequenceNumber;
+#endif // FEATURE_REDHAWK
+
+ public:
+ typedef union st_GCEventInfo {
+ typedef struct _GenerationInfo {
+ ULONGLONG GenerationSize;
+ ULONGLONG TotalPromotedSize;
+ } GenerationInfo;
+
+ struct {
+ GenerationInfo GenInfo[4]; // the heap info on gen0, gen1, gen2 and the large object heap.
+ ULONGLONG FinalizationPromotedSize; //not available per generation
+ ULONGLONG FinalizationPromotedCount; //not available per generation
+ ULONG PinnedObjectCount;
+ ULONG SinkBlockCount;
+ ULONG GCHandleCount;
+ } HeapStats;
+
+ typedef enum _HeapType {
+ SMALL_OBJECT_HEAP, LARGE_OBJECT_HEAP, READ_ONLY_HEAP
+ } HeapType;
+ struct {
+ ULONGLONG Address;
+ ULONGLONG Size;
+ HeapType Type;
+ } GCCreateSegment;
+
+ struct {
+ ULONGLONG Address;
+ } GCFreeSegment;
+ struct {
+ ULONG Count;
+ ULONG Depth;
+ } GCEnd;
+
+ typedef enum _AllocationKind {
+ AllocationSmall = 0,
+ AllocationLarge
+ }AllocationKind;
+ struct {
+ ULONG Allocation;
+ AllocationKind Kind;
+ } AllocationTick;
+
+ // These values are gotten from the gc_reason
+ // in gcimpl.h
+ typedef enum _GC_REASON {
+ GC_ALLOC_SOH = 0,
+ GC_INDUCED = 1,
+ GC_LOWMEMORY = 2,
+ GC_EMPTY = 3,
+ GC_ALLOC_LOH = 4,
+ GC_OOS_SOH = 5,
+ GC_OOS_LOH = 6,
+ GC_INDUCED_NOFORCE = 7,
+ GC_GCSTRESS = 8,
+ GC_LOWMEMORY_BLOCKING = 9,
+ GC_INDUCED_COMPACTING = 10,
+ GC_LOWMEMORY_HOST = 11
+ } GC_REASON;
+ typedef enum _GC_TYPE {
+ GC_NGC = 0,
+ GC_BGC = 1,
+ GC_FGC = 2
+ } GC_TYPE;
+ typedef enum _GC_ROOT_KIND {
+ GC_ROOT_STACK = 0,
+ GC_ROOT_FQ = 1,
+ GC_ROOT_HANDLES = 2,
+ GC_ROOT_OLDER = 3,
+ GC_ROOT_SIZEDREF = 4,
+ GC_ROOT_OVERFLOW = 5
+ } GC_ROOT_KIND;
+ struct {
+ ULONG Count;
+ ULONG Depth;
+ GC_REASON Reason;
+ GC_TYPE Type;
+ } GCStart;
+
+ struct {
+ ULONG Count; // how many finalizers we called.
+ } GCFinalizers;
+
+ struct {
+ ULONG Reason;
+ // This is only valid when SuspendEE is called by GC (ie, Reason is either
+ // SUSPEND_FOR_GC or SUSPEND_FOR_GC_PREP.
+ ULONG GcCount;
+ } SuspendEE;
+
+ struct {
+ ULONG HeapNum;
+ } GCMark;
+
+ struct {
+ ULONGLONG SegmentSize;
+ ULONGLONG LargeObjectSegmentSize;
+ BOOL ServerGC; // TRUE means it's server GC; FALSE means it's workstation.
+ } GCSettings;
+
+ struct {
+ // The generation that triggered this notification.
+ ULONG Count;
+ // 1 means the notification was due to allocation; 0 means it was due to other factors.
+ ULONG Alloc;
+ } GCFullNotify;
+ } ETW_GC_INFO, *PETW_GC_INFO;
+
+#ifdef FEATURE_EVENT_TRACE
+ static VOID GCSettingsEvent();
+#else
+ static VOID GCSettingsEvent() {};
+#endif // FEATURE_EVENT_TRACE
+
+ static BOOL ShouldWalkHeapObjectsForEtw();
+ static BOOL ShouldWalkHeapRootsForEtw();
+ static BOOL ShouldTrackMovementForEtw();
+ static HRESULT ForceGCForDiagnostics();
+ static VOID ForceGC(LONGLONG l64ClientSequenceNumber);
+ static VOID FireGcStartAndGenerationRanges(ETW_GC_INFO * pGcInfo);
+ static VOID FireGcEndAndGenerationRanges(ULONG Count, ULONG Depth);
+ static VOID FireSingleGenerationRangeEvent(
+ void * /* context */,
+ int generation,
+ BYTE * rangeStart,
+ BYTE * rangeEnd,
+ BYTE * rangeEndReserved);
+ static VOID RootReference(
+ LPVOID pvHandle,
+ Object * pRootedNode,
+ Object * pSecondaryNodeForDependentHandle,
+ BOOL fDependentHandle,
+ ProfilingScanContext * profilingScanContext,
+ DWORD dwGCFlags,
+ DWORD rootFlags);
+ static VOID ObjectReference(
+ ProfilerWalkHeapContext * profilerWalkHeapContext,
+ Object * pObjReferenceSource,
+ ULONGLONG typeID,
+ ULONGLONG cRefs,
+ Object ** rgObjReferenceTargets);
+ static BOOL ShouldWalkStaticsAndCOMForEtw();
+ static VOID WalkStaticsAndCOMForETW();
+ static VOID EndHeapDump(ProfilerWalkHeapContext * profilerWalkHeapContext);
+#ifdef FEATURE_EVENT_TRACE
+ static VOID BeginMovedReferences(size_t * pProfilingContext);
+ static VOID MovedReference(BYTE * pbMemBlockStart, BYTE * pbMemBlockEnd, ptrdiff_t cbRelocDistance, size_t profilingContext, BOOL fCompacting, BOOL fAllowProfApiNotification = TRUE);
+ static VOID EndMovedReferences(size_t profilingContext, BOOL fAllowProfApiNotification = TRUE);
+#else
+ // TODO: Need to be implemented for PROFILING_SUPPORTED.
+ static VOID BeginMovedReferences(size_t * pProfilingContext) {};
+ static VOID MovedReference(BYTE * pbMemBlockStart, BYTE * pbMemBlockEnd, ptrdiff_t cbRelocDistance, size_t profilingContext, BOOL fCompacting, BOOL fAllowProfApiNotification = TRUE) {};
+ static VOID EndMovedReferences(size_t profilingContext, BOOL fAllowProfApiNotification = TRUE) {};
+#endif // FEATURE_EVENT_TRACE
+ static VOID SendFinalizeObjectEvent(MethodTable * pMT, Object * pObj);
+ };
+};
+
+
+#endif //_VMEVENTTRACE_H_
diff --git a/src/inc/eventtracebase.h b/src/inc/eventtracebase.h
new file mode 100644
index 0000000000..f773a7c375
--- /dev/null
+++ b/src/inc/eventtracebase.h
@@ -0,0 +1,1082 @@
+// 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.
+//
+// File: eventtracebase.h
+// Abstract: This module implements base Event Tracing support (excluding some of the
+// CLR VM-specific ETW helpers).
+//
+
+//
+
+//
+//
+// #EventTracing
+// Windows
+// ETW (Event Tracing for Windows) is a high-performance, low overhead and highly scalable
+// tracing facility provided by the Windows Operating System. ETW is available on Win2K and above. There are
+// four main types of components in ETW: event providers, controllers, consumers, and event trace sessions.
+// An event provider is a logical entity that writes events to ETW sessions. The event provider must register
+// a provider ID with ETW through the registration API. A provider first registers with ETW and writes events
+// from various points in the code by invoking the ETW logging API. When a provider is enabled dynamically by
+// the ETW controller application, calls to the logging API sends events to a specific trace session
+// designated by the controller. Each event sent by the event provider to the trace session consists of a
+// fixed header that includes event metadata and additional variable user-context data. CLR is an event
+// provider.
+// ============================================================================
+
+#ifndef _ETWTRACER_HXX_
+#define _ETWTRACER_HXX_
+
+struct EventStructTypeData;
+void InitializeEventTracing();
+
+// !!!!!!! NOTE !!!!!!!!
+// The flags must match those in the ETW manifest exactly
+// !!!!!!! NOTE !!!!!!!!
+
+// These flags need to be defined either when FEATURE_EVENT_TRACE is enabled or the
+// PROFILING_SUPPORTED is set, since they are used both by event tracing and profiling.
+
+enum EtwGCRootFlags
+{
+ kEtwGCRootFlagsPinning = 0x1,
+ kEtwGCRootFlagsWeakRef = 0x2,
+ kEtwGCRootFlagsInterior = 0x4,
+ kEtwGCRootFlagsRefCounted = 0x8,
+};
+
+enum EtwGCRootKind
+{
+ kEtwGCRootKindStack = 0,
+ kEtwGCRootKindFinalizer = 1,
+ kEtwGCRootKindHandle = 2,
+ kEtwGCRootKindOther = 3,
+};
+
+enum EtwTypeFlags
+{
+ kEtwTypeFlagsDelegate = 0x1,
+ kEtwTypeFlagsFinalizable = 0x2,
+ kEtwTypeFlagsExternallyImplementedCOMObject = 0x4,
+ kEtwTypeFlagsArray = 0x8,
+};
+
+enum EtwThreadFlags
+{
+ kEtwThreadFlagGCSpecial = 0x00000001,
+ kEtwThreadFlagFinalizer = 0x00000002,
+ kEtwThreadFlagThreadPoolWorker = 0x00000004,
+};
+
+#ifndef FEATURE_REDHAWK
+
+#if defined(FEATURE_EVENT_TRACE)
+#if !defined(FEATURE_PAL)
+
+//
+// Use this macro at the least before calling the Event Macros
+//
+
+#define ETW_TRACING_INITIALIZED(RegHandle) \
+ (g_pEtwTracer && RegHandle)
+
+//
+// Use this macro to check if an event is enabled
+// if the fields in the event are not cheap to calculate
+//
+#define ETW_EVENT_ENABLED(Context, EventDescriptor) \
+ (MCGEN_ENABLE_CHECK(Context, EventDescriptor))
+
+//
+// Use this macro to check if a category of events is enabled
+//
+
+#define ETW_CATEGORY_ENABLED(Context, Level, Keyword) \
+ (Context.IsEnabled && McGenEventProviderEnabled(&Context, Level, Keyword))
+
+
+// This macro only checks if a provider is enabled
+// It does not check the flags and keywords for which it is enabled
+#define ETW_PROVIDER_ENABLED(ProviderSymbol) \
+ ProviderSymbol##_Context.IsEnabled
+
+
+#else //defined(FEATURE_PAL)
+
+#define ETW_INLINE
+#define ETWOnStartup(StartEventName, EndEventName)
+#define ETWFireEvent(EventName)
+
+#define ETW_TRACING_INITIALIZED(RegHandle) (TRUE)
+#define ETW_EVENT_ENABLED(Context, EventDescriptor) (XplatEventLogger::IsEventLoggingEnabled())
+#define ETW_CATEGORY_ENABLED(Context, Level, Keyword) (XplatEventLogger::IsEventLoggingEnabled())
+#define ETW_TRACING_ENABLED(Context, EventDescriptor) (EventEnabled##EventDescriptor())
+#define ETW_TRACING_CATEGORY_ENABLED(Context, Level, Keyword) (XplatEventLogger::IsEventLoggingEnabled())
+#define ETW_PROVIDER_ENABLED(ProviderSymbol) (TRUE)
+
+#endif // !defined(FEATURE_PAL)
+
+#else // FEATURE_EVENT_TRACE
+
+#define ETWOnStartup(StartEventName, EndEventName)
+#define ETWFireEvent(EventName)
+
+#define ETW_TRACING_INITIALIZED(RegHandle) (FALSE)
+#define ETW_EVENT_ENABLED(Context, EventDescriptor) (FALSE)
+#define ETW_CATEGORY_ENABLED(Context, Level, Keyword) (FALSE)
+#define ETW_TRACING_ENABLED(Context, EventDescriptor) (FALSE)
+#define ETW_TRACING_CATEGORY_ENABLED(Context, Level, Keyword) (FALSE)
+#define ETW_PROVIDER_ENABLED(ProviderSymbol) (TRUE)
+
+#endif // FEATURE_EVENT_TRACE
+
+#endif // FEATURE_REDHAWK
+
+// During a heap walk, this is the storage for keeping track of all the nodes and edges
+// being batched up by ETW, and for remembering whether we're also supposed to call into
+// a profapi profiler. This is allocated toward the end of a GC and passed to us by the
+// GC heap walker.
+struct ProfilerWalkHeapContext
+{
+public:
+ ProfilerWalkHeapContext(BOOL fProfilerPinnedParam, LPVOID pvEtwContextParam)
+ {
+ fProfilerPinned = fProfilerPinnedParam;
+ pvEtwContext = pvEtwContextParam;
+ }
+
+ BOOL fProfilerPinned;
+ LPVOID pvEtwContext;
+};
+
+#ifdef FEATURE_EVENT_TRACE
+
+class Object;
+#if !defined(FEATURE_PAL)
+/******************************/
+/* CLR ETW supported versions */
+/******************************/
+#define ETW_SUPPORTED_MAJORVER 5 // ETW is supported on win2k and above
+#define ETW_ENABLED_MAJORVER 6 // OS versions >= to this we enable ETW registration by default, since on XP and Windows 2003, registration is too slow.
+
+/***************************************/
+/* Tracing levels supported by CLR ETW */
+/***************************************/
+#define ETWMAX_TRACE_LEVEL 6 // Maximum Number of Trace Levels supported
+#define TRACE_LEVEL_NONE 0 // Tracing is not on
+#define TRACE_LEVEL_FATAL 1 // Abnormal exit or termination
+#define TRACE_LEVEL_ERROR 2 // Severe errors that need logging
+#define TRACE_LEVEL_WARNING 3 // Warnings such as allocation failure
+#define TRACE_LEVEL_INFORMATION 4 // Includes non-error cases such as Entry-Exit
+#define TRACE_LEVEL_VERBOSE 5 // Detailed traces from intermediate steps
+
+struct ProfilingScanContext;
+
+//
+// Use this macro to check if ETW is initialized and the event is enabled
+//
+#define ETW_TRACING_ENABLED(Context, EventDescriptor) \
+ (Context.IsEnabled && ETW_TRACING_INITIALIZED(Context.RegistrationHandle) && ETW_EVENT_ENABLED(Context, EventDescriptor))
+
+//
+// Using KEYWORDZERO means when checking the events category ignore the keyword
+//
+#define KEYWORDZERO 0x0
+
+//
+// Use this macro to check if ETW is initialized and the category is enabled
+//
+#define ETW_TRACING_CATEGORY_ENABLED(Context, Level, Keyword) \
+ (ETW_TRACING_INITIALIZED(Context.RegistrationHandle) && ETW_CATEGORY_ENABLED(Context, Level, Keyword))
+
+ #define ETWOnStartup(StartEventName, EndEventName) \
+ ETWTraceStartup trace##StartEventName##(Microsoft_Windows_DotNETRuntimePrivateHandle, &StartEventName, &StartupId, &EndEventName, &StartupId);
+ #define ETWFireEvent(EventName) \
+ ETWTraceStartup::StartupTraceEvent(Microsoft_Windows_DotNETRuntimePrivateHandle, &EventName, &StartupId);
+
+#ifndef FEATURE_REDHAWK
+// Headers
+#include <initguid.h>
+#include <wmistr.h>
+#include <evntrace.h>
+#include <evntprov.h>
+#if !defined(DONOT_DEFINE_ETW_CALLBACK) && !defined(DACCESS_COMPILE)
+#define GetVersionEx(Version) (GetOSVersion((LPOSVERSIONINFOW)Version))
+#else
+#define GetVersionEx(Version) (WszGetVersionEx((LPOSVERSIONINFOW)Version))
+#endif // !DONOT_DEFINE_ETW_CALLBACK && !DACCESS_COMPILE
+#endif //!FEATURE_REDHAWK
+#endif //!defined(FEATURE_PAL)
+
+
+#else // FEATURE_EVENT_TRACE
+
+#include "etmdummy.h"
+#endif // FEATURE_EVENT_TRACE
+
+#ifndef FEATURE_REDHAWK
+
+#include "corprof.h"
+
+// g_nClrInstanceId is defined in Utilcode\Util.cpp. The definition goes into Utilcode.lib.
+// This enables both the VM and Utilcode to raise ETW events.
+extern UINT32 g_nClrInstanceId;
+extern BOOL g_fEEManagedEXEStartup;
+extern BOOL g_fEEIJWStartup;
+
+#define GetClrInstanceId() (static_cast<UINT16>(g_nClrInstanceId))
+
+#if defined(FEATURE_EVENT_TRACE) || defined(FEATURE_EVENTSOURCE_XPLAT)
+
+#include "clrconfig.h"
+ class XplatEventLogger
+{
+ public:
+ inline static BOOL IsEventLoggingEnabled()
+ {
+ static ConfigDWORD configEventLogging;
+ return configEventLogging.val(CLRConfig::EXTERNAL_EnableEventLog);
+ }
+};
+
+#endif //defined(FEATURE_EVENT_TRACE)
+
+#if defined(FEATURE_EVENT_TRACE)
+
+#ifndef FEATURE_PAL
+// Callback and stack support
+#if !defined(DONOT_DEFINE_ETW_CALLBACK) && !defined(DACCESS_COMPILE)
+extern "C" {
+ /* ETW control callback
+ * Desc: This function handles the ETW control
+ * callback.
+ * Ret: success or failure
+ ***********************************************/
+ VOID EtwCallback(
+ _In_ LPCGUID SourceId,
+ _In_ ULONG ControlCode,
+ _In_ UCHAR Level,
+ _In_ ULONGLONG MatchAnyKeyword,
+ _In_ ULONGLONG MatchAllKeyword,
+ _In_opt_ PEVENT_FILTER_DESCRIPTOR FilterData,
+ _Inout_opt_ PVOID CallbackContext);
+}
+
+//
+// User defined callback
+//
+#define MCGEN_PRIVATE_ENABLE_CALLBACK(RequestCode, Context, InOutBufferSize, Buffer) \
+ EtwCallback(NULL /* SourceId */, (RequestCode==WMI_ENABLE_EVENTS) ? EVENT_CONTROL_CODE_ENABLE_PROVIDER : EVENT_CONTROL_CODE_DISABLE_PROVIDER, 0 /* Level */, 0 /* MatchAnyKeyword */, 0 /* MatchAllKeyword */, NULL /* FilterData */, Context)
+
+//
+// User defined callback2
+//
+#define MCGEN_PRIVATE_ENABLE_CALLBACK_V2(SourceId, ControlCode, Level, MatchAnyKeyword, MatchAllKeyword, FilterData, CallbackContext) \
+ EtwCallback(SourceId, ControlCode, Level, MatchAnyKeyword, MatchAllKeyword, FilterData, CallbackContext)
+
+extern "C" {
+ /* ETW callout
+ * Desc: This function handles the ETW callout
+ * Ret: success or failure
+ ***********************************************/
+ VOID EtwCallout(
+ REGHANDLE RegHandle,
+ PCEVENT_DESCRIPTOR Descriptor,
+ ULONG ArgumentCount,
+ PEVENT_DATA_DESCRIPTOR EventData);
+}
+
+//
+// Call user defined callout
+//
+#define MCGEN_CALLOUT(RegHandle, Descriptor, NumberOfArguments, EventData) \
+ EtwCallout(RegHandle, Descriptor, NumberOfArguments, EventData)
+#endif //!DONOT_DEFINE_ETW_CALLBACK && !DACCESS_COMPILE
+
+#endif //!FEATURE_PAL
+
+#include "clretwallmain.h"
+
+#endif // FEATURE_EVENT_TRACE
+
+/**************************/
+/* CLR ETW infrastructure */
+/**************************/
+// #CEtwTracer
+// On Windows Vista, ETW has gone through a major upgrade, and one of the most significant changes is the
+// introduction of the unified event provider model and APIs. The older architecture used the classic ETW
+// events. The new ETW architecture uses the manifest based events. To support both types of events at the
+// same time, we use the manpp tool for generating event macros that can be directly used to fire ETW events
+// from various components within the CLR.
+// (http://diagnostics/sites/etw/Lists/Announcements/DispForm.aspx?ID=10&Source=http%3A%2F%2Fdiagnostics%2Fsites%2Fetw%2Fdefault%2Easpx)
+// Every ETW provider has to Register itself to the system, so that when enabled, it is capable of firing
+// ETW events. file:../VM/eventtrace.cpp#Registration is where the actual Provider Registration takes place.
+// At process shutdown, a registered provider need to be unregistered.
+// file:../VM/eventtrace.cpp#Unregistration. Since ETW can also be enabled at any instant after the process
+// has started, one may want to do something useful when that happens (e.g enumerate all the loaded modules
+// in the system). To enable this, we have to implement a callback routine.
+// file:../VM/eventtrace.cpp#EtwCallback is CLR's implementation of the callback.
+//
+
+#include "daccess.h"
+class Module;
+class Assembly;
+class MethodDesc;
+class MethodTable;
+class BaseDomain;
+class AppDomain;
+class SString;
+class CrawlFrame;
+class LoaderAllocator;
+class AssemblyLoaderAllocator;
+struct AllLoggedTypes;
+class CrstBase;
+class BulkTypeEventLogger;
+class TypeHandle;
+class Thread;
+
+
+// All ETW helpers must be a part of this namespace
+// We have auto-generated macros to directly fire the events
+// but in some cases, gathering the event payload information involves some work
+// and it can be done in a relevant helper class like the one's in this namespace
+namespace ETW
+{
+ // Class to wrap the ETW infrastructure logic
+#if !defined(FEATURE_PAL)
+ class CEtwTracer
+ {
+#if defined(FEATURE_EVENT_TRACE)
+ ULONG RegGuids(LPCGUID ProviderId, PENABLECALLBACK EnableCallback, PVOID CallbackContext, PREGHANDLE RegHandle);
+#endif
+
+ public:
+#ifdef FEATURE_EVENT_TRACE
+ // Registers all the Event Tracing providers
+ HRESULT Register();
+
+ // Unregisters all the Event Tracing providers
+ HRESULT UnRegister();
+#else
+ HRESULT Register()
+ {
+ return S_OK;
+ }
+ HRESULT UnRegister()
+ {
+ return S_OK;
+ }
+#endif // FEATURE_EVENT_TRACE
+ };
+#endif // !defined(FEATURE_PAL)
+
+ class LoaderLog;
+ class MethodLog;
+ // Class to wrap all the enumeration logic for ETW
+ class EnumerationLog
+ {
+ friend class ETW::LoaderLog;
+ friend class ETW::MethodLog;
+#ifdef FEATURE_EVENT_TRACE
+ static VOID SendThreadRundownEvent();
+ static VOID IterateDomain(BaseDomain *pDomain, DWORD enumerationOptions);
+ static VOID IterateAppDomain(AppDomain * pAppDomain, DWORD enumerationOptions);
+ static VOID IterateCollectibleLoaderAllocator(AssemblyLoaderAllocator *pLoaderAllocator, DWORD enumerationOptions);
+ static VOID IterateAssembly(Assembly *pAssembly, DWORD enumerationOptions);
+ static VOID IterateModule(Module *pModule, DWORD enumerationOptions);
+ static VOID EnumerationHelper(Module *moduleFilter, BaseDomain *domainFilter, DWORD enumerationOptions);
+ static DWORD GetEnumerationOptionsFromRuntimeKeywords();
+ public:
+ typedef union _EnumerationStructs
+ {
+ typedef enum _EnumerationOptions
+ {
+ None= 0x00000000,
+ DomainAssemblyModuleLoad= 0x00000001,
+ DomainAssemblyModuleUnload= 0x00000002,
+ DomainAssemblyModuleDCStart= 0x00000004,
+ DomainAssemblyModuleDCEnd= 0x00000008,
+ JitMethodLoad= 0x00000010,
+ JitMethodUnload= 0x00000020,
+ JitMethodDCStart= 0x00000040,
+ JitMethodDCEnd= 0x00000080,
+ NgenMethodLoad= 0x00000100,
+ NgenMethodUnload= 0x00000200,
+ NgenMethodDCStart= 0x00000400,
+ NgenMethodDCEnd= 0x00000800,
+ ModuleRangeLoad= 0x00001000,
+ ModuleRangeDCStart= 0x00002000,
+ ModuleRangeDCEnd= 0x00004000,
+ ModuleRangeLoadPrivate= 0x00008000,
+ MethodDCStartILToNativeMap= 0x00010000,
+ MethodDCEndILToNativeMap= 0x00020000,
+ JitMethodILToNativeMap= 0x00040000,
+ TypeUnload= 0x00080000,
+
+ // Helpers
+ ModuleRangeEnabledAny = ModuleRangeLoad | ModuleRangeDCStart | ModuleRangeDCEnd | ModuleRangeLoadPrivate,
+ JitMethodLoadOrDCStartAny = JitMethodLoad | JitMethodDCStart | MethodDCStartILToNativeMap,
+ JitMethodUnloadOrDCEndAny = JitMethodUnload | JitMethodDCEnd | MethodDCEndILToNativeMap,
+ }EnumerationOptions;
+ }EnumerationStructs;
+
+ static VOID ProcessShutdown();
+ static VOID ModuleRangeRundown();
+ static VOID StartRundown();
+ static VOID EndRundown();
+ static VOID EnumerateForCaptureState();
+#else
+ public:
+ static VOID ProcessShutdown() {};
+ static VOID StartRundown() {};
+ static VOID EndRundown() {};
+#endif // FEATURE_EVENT_TRACE
+ };
+
+
+ // Class to wrap all the sampling logic for ETW
+
+ class SamplingLog
+ {
+#if defined(FEATURE_EVENT_TRACE) && !defined(FEATURE_PAL)
+ public:
+ typedef enum _EtwStackWalkStatus
+ {
+ Completed = 0,
+ UnInitialized = 1,
+ InProgress = 2
+ } EtwStackWalkStatus;
+ private:
+ static const UINT8 s_MaxStackSize=100;
+ UINT32 m_FrameCount;
+ SIZE_T m_EBPStack[SamplingLog::s_MaxStackSize];
+ VOID Append(SIZE_T currentFrame);
+ EtwStackWalkStatus SaveCurrentStack(int skipTopNFrames=1);
+ public:
+ static ULONG SendStackTrace(MCGEN_TRACE_CONTEXT TraceContext, PCEVENT_DESCRIPTOR Descriptor, LPCGUID EventGuid);
+ EtwStackWalkStatus GetCurrentThreadsCallStack(UINT32 *frameCount, PVOID **Stack);
+#endif // FEATURE_EVENT_TRACE && !defined(FEATURE_PAL)
+ };
+
+ // Class to wrap all Loader logic for ETW
+ class LoaderLog
+ {
+ friend class ETW::EnumerationLog;
+#if defined(FEATURE_EVENT_TRACE)
+ static VOID SendModuleEvent(Module *pModule, DWORD dwEventOptions, BOOL bFireDomainModuleEvents=FALSE);
+ static ULONG SendModuleRange(__in Module *pModule, __in DWORD dwEventOptions);
+ static VOID SendAssemblyEvent(Assembly *pAssembly, DWORD dwEventOptions);
+ static VOID SendDomainEvent(BaseDomain *pBaseDomain, DWORD dwEventOptions, LPCWSTR wszFriendlyName=NULL);
+ public:
+ typedef union _LoaderStructs
+ {
+ typedef enum _AppDomainFlags
+ {
+ DefaultDomain=0x1,
+ ExecutableDomain=0x2,
+ SharedDomain=0x4
+ }AppDomainFlags;
+
+ typedef enum _AssemblyFlags
+ {
+ DomainNeutralAssembly=0x1,
+ DynamicAssembly=0x2,
+ NativeAssembly=0x4,
+ CollectibleAssembly=0x8,
+ }AssemblyFlags;
+
+ typedef enum _ModuleFlags
+ {
+ DomainNeutralModule=0x1,
+ NativeModule=0x2,
+ DynamicModule=0x4,
+ ManifestModule=0x8,
+ IbcOptimized=0x10
+ }ModuleFlags;
+
+ typedef enum _RangeFlags
+ {
+ HotRange=0x0
+ }RangeFlags;
+
+ }LoaderStructs;
+
+ static VOID DomainLoadReal(BaseDomain *pDomain, __in_opt LPWSTR wszFriendlyName=NULL);
+
+ static VOID DomainLoad(BaseDomain *pDomain, __in_opt LPWSTR wszFriendlyName = NULL)
+ {
+ if (ETW_PROVIDER_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PROVIDER))
+ {
+ DomainLoadReal(pDomain, wszFriendlyName);
+ }
+ }
+
+ static VOID DomainUnload(AppDomain *pDomain);
+ static VOID CollectibleLoaderAllocatorUnload(AssemblyLoaderAllocator *pLoaderAllocator);
+ static VOID ModuleLoad(Module *pModule, LONG liReportedSharedModule);
+#else
+ public:
+ static VOID DomainLoad(BaseDomain *pDomain, __in_opt LPWSTR wszFriendlyName=NULL) {};
+ static VOID DomainUnload(AppDomain *pDomain) {};
+ static VOID CollectibleLoaderAllocatorUnload(AssemblyLoaderAllocator *pLoaderAllocator) {};
+ static VOID ModuleLoad(Module *pModule, LONG liReportedSharedModule) {};
+#endif // FEATURE_EVENT_TRACE
+ };
+
+ // Class to wrap all Method logic for ETW
+ class MethodLog
+ {
+ friend class ETW::EnumerationLog;
+#ifdef FEATURE_EVENT_TRACE
+ static VOID SendEventsForJitMethods(BaseDomain *pDomainFilter, LoaderAllocator *pLoaderAllocatorFilter, DWORD dwEventOptions);
+ static VOID SendEventsForJitMethodsHelper(BaseDomain *pDomainFilter,
+ LoaderAllocator *pLoaderAllocatorFilter,
+ DWORD dwEventOptions,
+ BOOL fLoadOrDCStart,
+ BOOL fUnloadOrDCEnd,
+ BOOL fSendMethodEvent,
+ BOOL fSendILToNativeMapEvent,
+ BOOL fGetReJitIDs);
+ static VOID SendEventsForNgenMethods(Module *pModule, DWORD dwEventOptions);
+ static VOID SendMethodJitStartEvent(MethodDesc *pMethodDesc, SString *namespaceOrClassName=NULL, SString *methodName=NULL, SString *methodSignature=NULL);
+ static VOID SendMethodILToNativeMapEvent(MethodDesc * pMethodDesc, DWORD dwEventOptions, ReJITID rejitID);
+ static VOID SendMethodEvent(MethodDesc *pMethodDesc, DWORD dwEventOptions, BOOL bIsJit, SString *namespaceOrClassName=NULL, SString *methodName=NULL, SString *methodSignature=NULL, SIZE_T pCode = 0, ReJITID rejitID = 0);
+ static VOID SendHelperEvent(ULONGLONG ullHelperStartAddress, ULONG ulHelperSize, LPCWSTR pHelperName);
+ public:
+ typedef union _MethodStructs
+ {
+ typedef enum _MethodFlags
+ {
+ DynamicMethod=0x1,
+ GenericMethod=0x2,
+ SharedGenericCode=0x4,
+ JittedMethod=0x8,
+ JitHelperMethod=0x10
+ }MethodFlags;
+
+ typedef enum _MethodExtent
+ {
+ HotSection=0x00000000,
+ ColdSection=0x10000000
+ }MethodExtent;
+
+ }MethodStructs;
+
+ static VOID MethodJitting(MethodDesc *pMethodDesc, SString *namespaceOrClassName=NULL, SString *methodName=NULL, SString *methodSignature=NULL);
+ static VOID MethodJitted(MethodDesc *pMethodDesc, SString *namespaceOrClassName=NULL, SString *methodName=NULL, SString *methodSignature=NULL, SIZE_T pCode = 0, ReJITID rejitID = 0);
+ static VOID StubInitialized(ULONGLONG ullHelperStartAddress, LPCWSTR pHelperName);
+ static VOID StubsInitialized(PVOID *pHelperStartAddresss, PVOID *pHelperNames, LONG ulNoOfHelpers);
+ static VOID MethodRestored(MethodDesc * pMethodDesc);
+ static VOID MethodTableRestored(MethodTable * pMethodTable);
+ static VOID DynamicMethodDestroyed(MethodDesc *pMethodDesc);
+#else // FEATURE_EVENT_TRACE
+ public:
+ static VOID MethodJitting(MethodDesc *pMethodDesc, SString *namespaceOrClassName=NULL, SString *methodName=NULL, SString *methodSignature=NULL) {};
+ static VOID MethodJitted(MethodDesc *pMethodDesc, SString *namespaceOrClassName=NULL, SString *methodName=NULL, SString *methodSignature=NULL, SIZE_T pCode = 0, ReJITID rejitID = 0) {};
+ static VOID StubInitialized(ULONGLONG ullHelperStartAddress, LPCWSTR pHelperName) {};
+ static VOID StubsInitialized(PVOID *pHelperStartAddresss, PVOID *pHelperNames, LONG ulNoOfHelpers) {};
+ static VOID MethodRestored(MethodDesc * pMethodDesc) {};
+ static VOID MethodTableRestored(MethodTable * pMethodTable) {};
+ static VOID DynamicMethodDestroyed(MethodDesc *pMethodDesc) {};
+#endif // FEATURE_EVENT_TRACE
+ };
+
+ // Class to wrap all Security logic for ETW
+ class SecurityLog
+ {
+#ifdef FEATURE_EVENT_TRACE
+ public:
+ static VOID StrongNameVerificationStart(DWORD dwInFlags, __in LPWSTR strFullyQualifiedAssemblyName);
+ static VOID StrongNameVerificationStop(DWORD dwInFlags,ULONG result, __in LPWSTR strFullyQualifiedAssemblyName);
+
+ static void FireFieldTransparencyComputationStart(LPCWSTR wszFieldName,
+ LPCWSTR wszModuleName,
+ DWORD dwAppDomain);
+ static void FireFieldTransparencyComputationEnd(LPCWSTR wszFieldName,
+ LPCWSTR wszModuleName,
+ DWORD dwAppDomain,
+ BOOL fIsCritical,
+ BOOL fIsTreatAsSafe);
+
+ static void FireMethodTransparencyComputationStart(LPCWSTR wszMethodName,
+ LPCWSTR wszModuleName,
+ DWORD dwAppDomain);
+ static void FireMethodTransparencyComputationEnd(LPCWSTR wszMethodName,
+ LPCWSTR wszModuleName,
+ DWORD dwAppDomain,
+ BOOL fIsCritical,
+ BOOL fIsTreatAsSafe);
+
+ static void FireModuleTransparencyComputationStart(LPCWSTR wszModuleName, DWORD dwAppDomain);
+ static void FireModuleTransparencyComputationEnd(LPCWSTR wszModuleName,
+ DWORD dwAppDomain,
+ BOOL fIsAllCritical,
+ BOOL fIsAllTransparent,
+ BOOL fIsTreatAsSafe,
+ BOOL fIsOpportunisticallyCritical,
+ DWORD dwSecurityRuleSet);
+
+ static void FireTokenTransparencyComputationStart(DWORD dwToken,
+ LPCWSTR wszModuleName,
+ DWORD dwAppDomain);
+ static void FireTokenTransparencyComputationEnd(DWORD dwToken,
+ LPCWSTR wszModuleName,
+ DWORD dwAppDomain,
+ BOOL fIsCritical,
+ BOOL fIsTreatAsSafe);
+
+ static void FireTypeTransparencyComputationStart(LPCWSTR wszTypeName,
+ LPCWSTR wszModuleName,
+ DWORD dwAppDomain);
+ static void FireTypeTransparencyComputationEnd(LPCWSTR wszTypeName,
+ LPCWSTR wszModuleName,
+ DWORD dwAppDomain,
+ BOOL fIsAllCritical,
+ BOOL fIsAllTransparent,
+ BOOL fIsCritical,
+ BOOL fIsTreatAsSafe);
+#else
+ public:
+ static VOID StrongNameVerificationStart(DWORD dwInFlags, _In_z_ LPWSTR strFullyQualifiedAssemblyName) {};
+ static VOID StrongNameVerificationStop(DWORD dwInFlags,ULONG result, _In_z_ LPWSTR strFullyQualifiedAssemblyName) {};
+
+ static void FireFieldTransparencyComputationStart(LPCWSTR wszFieldName,
+ LPCWSTR wszModuleName,
+ DWORD dwAppDomain) {};
+ static void FireFieldTransparencyComputationEnd(LPCWSTR wszFieldName,
+ LPCWSTR wszModuleName,
+ DWORD dwAppDomain,
+ BOOL fIsCritical,
+ BOOL fIsTreatAsSafe) {};
+
+ static void FireMethodTransparencyComputationStart(LPCWSTR wszMethodName,
+ LPCWSTR wszModuleName,
+ DWORD dwAppDomain) {};
+ static void FireMethodTransparencyComputationEnd(LPCWSTR wszMethodName,
+ LPCWSTR wszModuleName,
+ DWORD dwAppDomain,
+ BOOL fIsCritical,
+ BOOL fIsTreatAsSafe) {};
+
+ static void FireModuleTransparencyComputationStart(LPCWSTR wszModuleName, DWORD dwAppDomain) {};
+ static void FireModuleTransparencyComputationEnd(LPCWSTR wszModuleName,
+ DWORD dwAppDomain,
+ BOOL fIsAllCritical,
+ BOOL fIsAllTransparent,
+ BOOL fIsTreatAsSafe,
+ BOOL fIsOpportunisticallyCritical,
+ DWORD dwSecurityRuleSet) {};
+
+ static void FireTokenTransparencyComputationStart(DWORD dwToken,
+ LPCWSTR wszModuleName,
+ DWORD dwAppDomain) {};
+ static void FireTokenTransparencyComputationEnd(DWORD dwToken,
+ LPCWSTR wszModuleName,
+ DWORD dwAppDomain,
+ BOOL fIsCritical,
+ BOOL fIsTreatAsSafe) {};
+
+ static void FireTypeTransparencyComputationStart(LPCWSTR wszTypeName,
+ LPCWSTR wszModuleName,
+ DWORD dwAppDomain) {};
+ static void FireTypeTransparencyComputationEnd(LPCWSTR wszTypeName,
+ LPCWSTR wszModuleName,
+ DWORD dwAppDomain,
+ BOOL fIsAllCritical,
+ BOOL fIsAllTransparent,
+ BOOL fIsCritical,
+ BOOL fIsTreatAsSafe) {};
+#endif // FEATURE_EVENT_TRACE
+ };
+
+ // Class to wrap all Binder logic for ETW
+ class BinderLog
+ {
+ public:
+ typedef union _BinderStructs {
+ typedef enum _NGENBINDREJECT_REASON {
+ NGEN_BIND_START_BIND = 0,
+ NGEN_BIND_NO_INDEX = 1,
+ NGEN_BIND_SYSTEM_ASSEMBLY_NOT_AVAILABLE = 2,
+ NGEN_BIND_NO_NATIVE_IMAGE = 3,
+ NGEN_BIND_REJECT_CONFIG_MASK = 4,
+ NGEN_BIND_FAIL = 5,
+ NGEN_BIND_INDEX_CORRUPTION = 6,
+ NGEN_BIND_REJECT_TIMESTAMP = 7,
+ NGEN_BIND_REJECT_NATIVEIMAGE_NOT_FOUND = 8,
+ NGEN_BIND_REJECT_IL_SIG = 9,
+ NGEN_BIND_REJECT_LOADER_EVAL_FAIL = 10,
+ NGEN_BIND_MISSING_FOUND = 11,
+ NGEN_BIND_REJECT_HOSTASM = 12,
+ NGEN_BIND_REJECT_IL_NOT_FOUND = 13,
+ NGEN_BIND_REJECT_APPBASE_NOT_FILE = 14,
+ NGEN_BIND_BIND_DEPEND_REJECT_REF_DEF_MISMATCH = 15,
+ NGEN_BIND_BIND_DEPEND_REJECT_NGEN_SIG = 16,
+ NGEN_BIND_APPLY_EXTERNAL_RELOCS_FAILED = 17,
+ NGEN_BIND_SYSTEM_ASSEMBLY_NATIVEIMAGE_NOT_AVAILABLE = 18,
+ NGEN_BIND_ASSEMBLY_HAS_DIFFERENT_GRANT = 19,
+ NGEN_BIND_ASSEMBLY_NOT_DOMAIN_NEUTRAL = 20,
+ NGEN_BIND_NATIVEIMAGE_VERSION_MISMATCH = 21,
+ NGEN_BIND_LOADFROM_NOT_ALLOWED = 22,
+ NGEN_BIND_DEPENDENCY_HAS_DIFFERENT_IDENTITY = 23
+ } NGENBINDREJECT_REASON;
+ } BinderStructs;
+ };
+
+ // Class to wrap all Exception logic for ETW
+ class ExceptionLog
+ {
+ public:
+#ifdef FEATURE_EVENT_TRACE
+ static VOID ExceptionThrown(CrawlFrame *pCf, BOOL bIsReThrownException, BOOL bIsNewException);
+ static VOID ExceptionThrownEnd();
+ static VOID ExceptionCatchBegin(MethodDesc * pMethodDesc, PVOID pEntryEIP);
+ static VOID ExceptionCatchEnd();
+ static VOID ExceptionFinallyBegin(MethodDesc * pMethodDesc, PVOID pEntryEIP);
+ static VOID ExceptionFinallyEnd();
+ static VOID ExceptionFilterBegin(MethodDesc * pMethodDesc, PVOID pEntryEIP);
+ static VOID ExceptionFilterEnd();
+
+#else
+ static VOID ExceptionThrown(CrawlFrame *pCf, BOOL bIsReThrownException, BOOL bIsNewException) {};
+ static VOID ExceptionThrownEnd() {};
+ static VOID ExceptionCatchBegin(MethodDesc * pMethodDesc, PVOID pEntryEIP) {};
+ static VOID ExceptionCatchEnd() {};
+ static VOID ExceptionFinallyBegin(MethodDesc * pMethodDesc, PVOID pEntryEIP) {};
+ static VOID ExceptionFinallyEnd() {};
+ static VOID ExceptionFilterBegin(MethodDesc * pMethodDesc, PVOID pEntryEIP) {};
+ static VOID ExceptionFilterEnd() {};
+#endif // FEATURE_EVENT_TRACE
+ typedef union _ExceptionStructs
+ {
+ typedef enum _ExceptionThrownFlags
+ {
+ HasInnerException=0x1,
+ IsNestedException=0x2,
+ IsReThrownException=0x4,
+ IsCSE=0x8,
+ IsCLSCompliant=0x10
+ }ExceptionThrownFlags;
+ }ExceptionStructs;
+ };
+ // Class to wrap all Contention logic for ETW
+ class ContentionLog
+ {
+ public:
+ typedef union _ContentionStructs
+ {
+ typedef enum _ContentionFlags {
+ ManagedContention=0,
+ NativeContention=1
+ } ContentionFlags;
+ } ContentionStructs;
+ };
+ // Class to wrap all Interop logic for ETW
+ class InteropLog
+ {
+ public:
+ };
+
+ // Class to wrap all Information logic for ETW
+ class InfoLog
+ {
+ public:
+ typedef union _InfoStructs
+ {
+ typedef enum _StartupMode
+ {
+ ManagedExe=0x1,
+ HostedCLR=0x2,
+ IJW=0x4,
+ COMActivated=0x8,
+ Other=0x10
+ }StartupMode;
+
+ typedef enum _Sku
+ {
+ DesktopCLR=0x1,
+ CoreCLR=0x2
+ }Sku;
+
+ typedef enum _EtwMode
+ {
+ Normal=0x0,
+ Callback=0x1
+ }EtwMode;
+ }InfoStructs;
+
+#ifdef FEATURE_EVENT_TRACE
+ static VOID RuntimeInformation(INT32 type);
+#else
+ static VOID RuntimeInformation(INT32 type) {};
+#endif // FEATURE_EVENT_TRACE
+ };
+
+ class CodeSymbolLog
+ {
+ public:
+#ifdef FEATURE_EVENT_TRACE
+ static VOID EmitCodeSymbols(Module* pModule);
+ static HRESULT GetInMemorySymbolsLength(Module* pModule, DWORD* pCountSymbolBytes);
+ static HRESULT ReadInMemorySymbols(Module* pmodule, DWORD symbolsReadOffset, BYTE* pSymbolBytes,
+ DWORD countSymbolBytes, DWORD* pCountSymbolBytesRead);
+#else
+ static VOID EmitCodeSymbols(Module* pModule) {}
+ static HRESULT GetInMemorySymbolsLength(Module* pModule, DWORD* pCountSymbolBytes) { return S_OK; }
+ static HRESULT ReadInMemorySymbols(Module* pmodule, DWORD symbolsReadOffset, BYTE* pSymbolBytes,
+ DWORD countSymbolBytes, DWORD* pCountSymbolBytesRead) { return S_OK; }
+#endif // FEATURE_EVENT_TRACE
+ };
+};
+
+
+#define ETW_IS_TRACE_ON(level) ( FALSE ) // for fusion which is eventually going to get removed
+#define ETW_IS_FLAG_ON(flag) ( FALSE ) // for fusion which is eventually going to get removed
+
+// Commonly used constats for ETW Assembly Loader and Assembly Binder events.
+#define ETWLoadContextNotAvailable (LOADCTX_TYPE_HOSTED + 1)
+#define ETWAppDomainIdNotAvailable 0 // Valid AppDomain IDs start from 1
+
+#define ETWFieldUnused 0 // Indicates that a particular field in the ETW event payload template is currently unused.
+
+#define ETWLoaderLoadTypeNotAvailable 0 // Static or Dynamic Load is only valid at LoaderPhaseStart and LoaderPhaseEnd events - for other events, 0 indicates "not available"
+#define ETWLoaderStaticLoad 0 // Static reference load
+#define ETWLoaderDynamicLoad 1 // Dynamic assembly load
+
+#if defined(FEATURE_EVENT_TRACE) && !defined(FEATURE_PAL)
+//
+// The ONE and only ONE global instantiation of this class
+//
+extern ETW::CEtwTracer * g_pEtwTracer;
+
+//
+// Special Handling of Startup events
+//
+
+// "mc.exe -MOF" already generates this block for XP-suported builds inside ClrEtwAll.h;
+// on Vista+ builds, mc is run without -MOF, and we still have code that depends on it, so
+// we manually place it here.
+ETW_INLINE
+ULONG
+CoMofTemplate_h(
+ __in REGHANDLE RegHandle,
+ __in PCEVENT_DESCRIPTOR Descriptor,
+ __in_opt LPCGUID EventGuid,
+ __in const unsigned short ClrInstanceID
+ )
+{
+#define ARGUMENT_COUNT_h 1
+ ULONG Error = ERROR_SUCCESS;
+typedef struct _MCGEN_TRACE_BUFFER {
+ EVENT_TRACE_HEADER Header;
+ EVENT_DATA_DESCRIPTOR EventData[ARGUMENT_COUNT_h];
+} MCGEN_TRACE_BUFFER;
+
+ MCGEN_TRACE_BUFFER TraceBuf;
+ PEVENT_DATA_DESCRIPTOR EventData = TraceBuf.EventData;
+
+ EventDataDescCreate(&EventData[0], &ClrInstanceID, sizeof(const unsigned short) );
+
+
+ {
+ Error = EventWrite(RegHandle, Descriptor, ARGUMENT_COUNT_h, EventData);
+
+ }
+
+#ifdef MCGEN_CALLOUT
+MCGEN_CALLOUT(RegHandle,
+ Descriptor,
+ ARGUMENT_COUNT_h,
+ EventData);
+#endif
+
+ return Error;
+}
+
+class ETWTraceStartup {
+ REGHANDLE TraceHandle;
+ PCEVENT_DESCRIPTOR EventStartDescriptor;
+ LPCGUID EventStartGuid;
+ PCEVENT_DESCRIPTOR EventEndDescriptor;
+ LPCGUID EventEndGuid;
+public:
+ ETWTraceStartup(REGHANDLE _TraceHandle, PCEVENT_DESCRIPTOR _EventStartDescriptor, LPCGUID _EventStartGuid, PCEVENT_DESCRIPTOR _EventEndDescriptor, LPCGUID _EventEndGuid) {
+ TraceHandle = _TraceHandle;
+ EventStartDescriptor = _EventStartDescriptor;
+ EventEndDescriptor = _EventEndDescriptor;
+ EventStartGuid = _EventStartGuid;
+ EventEndGuid = _EventEndGuid;
+ StartupTraceEvent(TraceHandle, EventStartDescriptor, EventStartGuid);
+ }
+ ~ETWTraceStartup() {
+ StartupTraceEvent(TraceHandle, EventEndDescriptor, EventEndGuid);
+ }
+ static void StartupTraceEvent(REGHANDLE _TraceHandle, PCEVENT_DESCRIPTOR _EventDescriptor, LPCGUID _EventGuid) {
+ EVENT_DESCRIPTOR desc = *_EventDescriptor;
+ if(ETW_TRACING_ENABLED(MICROSOFT_WINDOWS_DOTNETRUNTIME_PRIVATE_PROVIDER_Context, desc))
+ {
+ CoMofTemplate_h(MICROSOFT_WINDOWS_DOTNETRUNTIME_PRIVATE_PROVIDER_Context.RegistrationHandle, _EventDescriptor, _EventGuid, GetClrInstanceId());
+ }
+ }
+};
+// "mc.exe -MOF" already generates this block for XP-suported builds inside ClrEtwAll.h;
+// on Vista+ builds, mc is run without -MOF, and we still have code that depends on it, so
+// we manually place it here.
+FORCEINLINE
+BOOLEAN __stdcall
+McGenEventTracingEnabled(
+ __in PMCGEN_TRACE_CONTEXT EnableInfo,
+ __in PCEVENT_DESCRIPTOR EventDescriptor
+ )
+{
+
+ if(!EnableInfo){
+ return FALSE;
+ }
+
+
+ //
+ // Check if the event Level is lower than the level at which
+ // the channel is enabled.
+ // If the event Level is 0 or the channel is enabled at level 0,
+ // all levels are enabled.
+ //
+
+ if ((EventDescriptor->Level <= EnableInfo->Level) || // This also covers the case of Level == 0.
+ (EnableInfo->Level == 0)) {
+
+ //
+ // Check if Keyword is enabled
+ //
+
+ if ((EventDescriptor->Keyword == (ULONGLONG)0) ||
+ ((EventDescriptor->Keyword & EnableInfo->MatchAnyKeyword) &&
+ ((EventDescriptor->Keyword & EnableInfo->MatchAllKeyword) == EnableInfo->MatchAllKeyword))) {
+ return TRUE;
+ }
+ }
+
+ return FALSE;
+}
+
+
+ETW_INLINE
+ULONG
+ETW::SamplingLog::SendStackTrace(
+ MCGEN_TRACE_CONTEXT TraceContext,
+ PCEVENT_DESCRIPTOR Descriptor,
+ LPCGUID EventGuid)
+{
+#define ARGUMENT_COUNT_CLRStackWalk 5
+ ULONG Result = ERROR_SUCCESS;
+typedef struct _MCGEN_TRACE_BUFFER {
+ EVENT_TRACE_HEADER Header;
+ EVENT_DATA_DESCRIPTOR EventData[ARGUMENT_COUNT_CLRStackWalk];
+} MCGEN_TRACE_BUFFER;
+
+ REGHANDLE RegHandle = TraceContext.RegistrationHandle;
+ if(!TraceContext.IsEnabled || !McGenEventTracingEnabled(&TraceContext, Descriptor))
+ {
+ return Result;
+ }
+
+ PVOID *Stack = NULL;
+ UINT32 FrameCount = 0;
+ ETW::SamplingLog stackObj;
+ if(stackObj.GetCurrentThreadsCallStack(&FrameCount, &Stack) == ETW::SamplingLog::Completed)
+ {
+ UCHAR Reserved1=0, Reserved2=0;
+ UINT16 ClrInstanceId = GetClrInstanceId();
+ MCGEN_TRACE_BUFFER TraceBuf;
+ PEVENT_DATA_DESCRIPTOR EventData = TraceBuf.EventData;
+
+ EventDataDescCreate(&EventData[0], &ClrInstanceId, sizeof(const UINT16) );
+
+ EventDataDescCreate(&EventData[1], &Reserved1, sizeof(const UCHAR) );
+
+ EventDataDescCreate(&EventData[2], &Reserved2, sizeof(const UCHAR) );
+
+ EventDataDescCreate(&EventData[3], &FrameCount, sizeof(const unsigned int) );
+
+ EventDataDescCreate(&EventData[4], Stack, sizeof(PVOID) * FrameCount );
+
+ return EventWrite(RegHandle, Descriptor, ARGUMENT_COUNT_CLRStackWalk, EventData);
+ }
+ return Result;
+};
+
+#endif // FEATURE_EVENT_TRACE && !defined(FEATURE_PAL)
+#ifdef FEATURE_EVENT_TRACE
+#ifdef _TARGET_X86_
+struct CallStackFrame
+{
+ struct CallStackFrame* m_Next;
+ SIZE_T m_ReturnAddress;
+};
+#endif // _TARGET_X86_
+#endif // FEATURE_EVENT_TRACE
+
+#if defined(FEATURE_EVENT_TRACE) && !defined(FEATURE_PAL)
+FORCEINLINE
+BOOLEAN __stdcall
+McGenEventProviderEnabled(
+ __in PMCGEN_TRACE_CONTEXT Context,
+ __in UCHAR Level,
+ __in ULONGLONG Keyword
+ )
+{
+ if(!Context) {
+ return FALSE;
+ }
+
+ //
+ // Check if the event Level is lower than the level at which
+ // the channel is enabled.
+ // If the event Level is 0 or the channel is enabled at level 0,
+ // all levels are enabled.
+ //
+
+ if ((Level <= Context->Level) || // This also covers the case of Level == 0.
+ (Context->Level == 0)) {
+
+ //
+ // Check if Keyword is enabled
+ //
+
+ if ((Keyword == (ULONGLONG)0) ||
+ ((Keyword & Context->MatchAnyKeyword) &&
+ ((Keyword & Context->MatchAllKeyword) == Context->MatchAllKeyword))) {
+ return TRUE;
+ }
+ }
+ return FALSE;
+}
+#endif // FEATURE_EVENT_TRACE && !defined(FEATURE_PAL)
+
+
+#endif // !FEATURE_REDHAWK
+
+// These parts of the ETW namespace are common for both FEATURE_REDHAWK and
+// !FEATURE_REDHAWK builds.
+
+
+struct ProfilingScanContext;
+class Object;
+
+namespace ETW
+{
+ // Class to wrap the logging of threads (runtime and rundown providers)
+ class ThreadLog
+ {
+ private:
+ static DWORD GetEtwThreadFlags(Thread * pThread);
+
+ public:
+ static VOID FireThreadCreated(Thread * pThread);
+ static VOID FireThreadDC(Thread * pThread);
+ };
+};
+
+
+#endif //_ETWTRACER_HXX_
diff --git a/src/inc/ex.h b/src/inc/ex.h
new file mode 100644
index 0000000000..80b9aa0a07
--- /dev/null
+++ b/src/inc/ex.h
@@ -0,0 +1,1519 @@
+// 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.
+
+
+#if !defined(_EX_H_)
+#define _EX_H_
+
+void RetailAssertIfExpectedClean(); // Defined in src/utilcode/debug.cpp
+
+#ifdef FEATURE_PAL
+#define EX_TRY_HOLDER \
+ HardwareExceptionHolder \
+ NativeExceptionHolderCatchAll __exceptionHolder; \
+ __exceptionHolder.Push(); \
+
+#else // FEATURE_PAL
+#define EX_TRY_HOLDER
+#endif // FEATURE_PAL
+
+#include "sstring.h"
+#include "crtwrap.h"
+#include "winwrap.h"
+#include "corerror.h"
+#include "stresslog.h"
+#include "genericstackprobe.h"
+#include "staticcontract.h"
+#include "entrypoints.h"
+
+#if !defined(_DEBUG_IMPL) && defined(_DEBUG) && !defined(DACCESS_COMPILE)
+#define _DEBUG_IMPL 1
+#endif
+
+
+//===========================================================================================
+// These abstractions hide the difference between legacy desktop CLR's (that don't support
+// side-by-side-inproc and rely on a fixed SEH code to identify managed exceptions) and
+// new CLR's that support side-by-side inproc.
+//
+// The new CLR's use a different set of SEH codes to avoid conflicting with the legacy CLR's.
+// In addition, to distinguish between EH's raised by different inproc instances of the CLR,
+// the module handle of the owning CLR is stored in ExceptionRecord.ExceptionInformation[4].
+//
+// (Note: all existing SEH's use either only slot [0] or no slots at all. We are leaving
+// slots [1] thru [3] open for future expansion.)
+//===========================================================================================
+
+// Is this exception code one of the special CLR-specific SEH codes that participate in the
+// instance-tagging scheme?
+BOOL IsInstanceTaggedSEHCode(DWORD dwExceptionCode);
+
+
+// This set of overloads generates the NumberParameters and ExceptionInformation[] array to
+// pass to RaiseException().
+//
+// Parameters:
+// exceptionArgs: a fixed-size array of size INSTANCE_TAGGED_SEH_PARAM_ARRAY_SIZE.
+// This will get filled in by this function. (The module handle goes
+// in the last slot if this is a side-by-side-inproc enabled build.)
+//
+// exceptionArg1... up to four arguments that go in slots [0]..[3]. These depends
+// the specific requirements of your exception code.
+//
+// Returns:
+// The NumberParameters to pass to RaiseException().
+//
+// Basically, this is either INSTANCE_TAGGED_SEH_PARAM_ARRAY_SIZE or the count of your
+// fixed arguments depending on whether this tagged-SEH-enabled build.
+//
+// This function is not permitted to fail.
+
+#define INSTANCE_TAGGED_SEH_PARAM_ARRAY_SIZE 5
+DWORD MarkAsThrownByUs(/*out*/ ULONG_PTR exceptionArgs[INSTANCE_TAGGED_SEH_PARAM_ARRAY_SIZE]);
+DWORD MarkAsThrownByUs(/*out*/ ULONG_PTR exceptionArgs[INSTANCE_TAGGED_SEH_PARAM_ARRAY_SIZE], ULONG_PTR arg0);
+// (the existing system can support more overloads up to 4 fixed arguments but we don't need them at this time.)
+
+
+// Given an exception record, checks if it's exception code matches a specific exception code
+// *and* whether it was tagged by the calling instance of the CLR.
+//
+// If this is a non-tagged-SEH-enabled build, it is blindly assumed to be tagged by the
+// calling instance of the CLR.
+BOOL WasThrownByUs(const EXCEPTION_RECORD *pcER, DWORD dwExceptionCode);
+
+
+//-----------------------------------------------------------------------------------
+// The following group wraps the basic abstracts specifically for EXCEPTION_COMPLUS.
+//-----------------------------------------------------------------------------------
+BOOL IsComPlusException(const EXCEPTION_RECORD *pcER);
+VOID RaiseComPlusException();
+
+
+//===========================================================================================
+//===========================================================================================
+
+
+//-------------------------------------------------------------------------------------------
+// This routine will generate the most descriptive possible error message for an hresult.
+// It will generate at minimum the hex value. It will also try to generate the symbolic name
+// (E_POINTER) and the friendly description (from the message tables.)
+//
+// bNoGeekStuff suppresses hex HR codes. Use this sparingly as most error strings generated by the
+// CLR are aimed at developers, not end-users.
+//-------------------------------------------------------------------------------------------
+void GetHRMsg(HRESULT hresult, SString &result, BOOL bNoGeekStuff = FALSE);
+
+
+//-------------------------------------------------------------------------------------------
+// Similar to GetHRMsg but phrased for top-level exception message.
+//-------------------------------------------------------------------------------------------
+void GenerateTopLevelHRExceptionMessage(HRESULT hresult, SString &result);
+
+
+// ---------------------------------------------------------------------------
+// We save current ExceptionPointers using VectoredExceptionHandler. The save data is only valid
+// duing exception handling. GetCurrentExceptionPointers returns the saved data.
+// ---------------------------------------------------------------------------
+void GetCurrentExceptionPointers(PEXCEPTION_POINTERS pExceptionInfo);
+
+// ---------------------------------------------------------------------------
+// We save current ExceptionPointers using VectoredExceptionHandler. The save data is only valid
+// duing exception handling. GetCurrentExceptionCode returns the current exception code.
+// ---------------------------------------------------------------------------
+DWORD GetCurrentExceptionCode();
+
+// ---------------------------------------------------------------------------
+// We save current ExceptionPointers using VectoredExceptionHandler. The save data is only valid
+// duing exception handling. Return TRUE if the current exception is hard or soft SO.
+// ---------------------------------------------------------------------------
+bool IsCurrentExceptionSO();
+
+// ---------------------------------------------------------------------------
+// Return TRUE if the current exception is hard( or soft) SO. Soft SO
+// is defined when the stack probing code is enabled (FEATURE_STACK_PROBE)
+// ---------------------------------------------------------------------------
+bool IsSOExceptionCode(DWORD exceptionCode);
+
+// ---------------------------------------------------------------------------
+// Standard exception hierarchy & infrastructure for library code & EE
+// ---------------------------------------------------------------------------
+
+// ---------------------------------------------------------------------------
+// Exception class. Abstract root exception of our hierarchy.
+// ---------------------------------------------------------------------------
+
+class Exception;
+class SEHException;
+
+
+// Exception hierarchy:
+/* GetInstanceType
+Exception
+ |
+ |-> HRException Y
+ | |
+ | |-> HRMsgException
+ | |-> COMException
+ |
+ |-> SEHException Y
+ |
+ |-> DelegatingException Y
+ |
+ |-> StackOverflowException Y
+ |
+ |-> OutOfMemoryException Y
+ |
+ |-> CLRException Y
+ |
+ |-> EEException Y
+ | |
+ | |-> EEMessageException
+ | |
+ | |-> EEResourceException
+ | |
+ | |-> EECOMException
+ | |
+ | |-> EEFieldException
+ | |
+ | |-> EEMethodException
+ | |
+ | |-> EEArgumentException
+ | |
+ | |-> EETypeLoadException
+ | |
+ | |-> EEFileLoadException
+ |
+ |-> ObjrefException Y
+ |
+ |-> CLRLastThrownObjectException Y
+*/
+
+class Exception
+{
+ friend bool DebugIsEECxxExceptionPointer(void* pv);
+
+ private:
+ static const int c_type = 0x524f4f54; // 'ROOT'
+ static Exception * g_OOMException;
+ static Exception * g_SOException;
+
+ protected:
+ Exception *m_innerException;
+
+ public:
+ Exception() {LIMITED_METHOD_DAC_CONTRACT; m_innerException = NULL;}
+ virtual ~Exception() {LIMITED_METHOD_DAC_CONTRACT; if (m_innerException != NULL) Exception::Delete(m_innerException); }
+ virtual BOOL IsDomainBound() {return m_innerException!=NULL && m_innerException->IsDomainBound();} ;
+ virtual HRESULT GetHR() = 0;
+ virtual void GetMessage(SString &s);
+ virtual IErrorInfo *GetErrorInfo() { LIMITED_METHOD_CONTRACT; return NULL; }
+ virtual HRESULT SetErrorInfo() { LIMITED_METHOD_CONTRACT; return S_OK; }
+ void SetInnerException(Exception * pInnerException) { LIMITED_METHOD_CONTRACT; m_innerException = pInnerException; }
+
+ // Dynamic type query for catchers
+ static int GetType() { LIMITED_METHOD_CONTRACT; return c_type; }
+ // !!! If GetInstanceType is implemented, IsSameInstanceType should be implemented
+ virtual int GetInstanceType() = 0;
+ virtual BOOL IsType(int type) {LIMITED_METHOD_CONTRACT; return type == c_type; }
+
+ // This is used in CLRException::GetThrowable to detect if we are in a recursive situation.
+ virtual BOOL IsSameInstanceType(Exception *pException) = 0;
+
+ // Will create a new instance of the Exception. Note that this will
+ // be free of app domain or thread affinity. Not every type of exception
+ // can be cloned with full fidelity.
+ virtual Exception *Clone();
+
+ // DomainBoundClone is a specialized form of cloning which is guaranteed
+ // to provide full fidelity. However, the result is bound to the current
+ // app domain and should not be leaked.
+ Exception *DomainBoundClone();
+
+ class HandlerState
+ {
+ enum CaughtFlags
+ {
+ Caught = 1,
+ CaughtSO = 2,
+ CaughtCxx = 4,
+ };
+
+ DWORD m_dwFlags;
+ public:
+ Exception* m_pExceptionPtr;
+
+ HandlerState();
+
+ void CleanupTry();
+ void SetupCatch(INDEBUG_COMMA(__in_z const char * szFile) int lineNum, bool fVMInitialized = true);
+ void SucceedCatch();
+
+ BOOL DidCatch() { return (m_dwFlags & Caught); }
+ void SetCaught() { m_dwFlags |= Caught; }
+
+ BOOL DidCatchSO() { return (m_dwFlags & CaughtSO); }
+ void SetCaughtSO() { m_dwFlags |= CaughtSO; }
+
+ BOOL DidCatchCxx() { return (m_dwFlags & CaughtCxx); }
+ void SetCaughtCxx() { m_dwFlags |= CaughtCxx; }
+ };
+
+ // Is this exception type considered "uncatchable"?
+ BOOL IsTerminal();
+
+ // Is this exception type considered "transient" (would a retry possibly succeed)?
+ BOOL IsTransient();
+ static BOOL IsTransient(HRESULT hr);
+
+ // Get an HRESULT's source representation, if known
+ static LPCSTR GetHRSymbolicName(HRESULT hr);
+
+ static Exception* GetOOMException();
+
+ // Preallocated exceptions: If there is a preallocated instance of some
+ // subclass of Exception, override this function and return a correct
+ // value. The default implementation returns constant FALSE
+ virtual BOOL IsPreallocatedException();
+ BOOL IsPreallocatedOOMException();
+
+ static void Delete(Exception* pvMemory);
+
+protected:
+
+ // This virtual method must be implemented by any non abstract Exception
+ // derived class. It must allocate a NEW exception of the identical type and
+ // copy all the relevant fields from the current exception to the new one.
+ // It is NOT responsible however for copying the inner exception. This
+ // will be handled by the base Exception class.
+ virtual Exception *CloneHelper();
+
+ // This virtual method must be implemented by Exception subclasses whose
+ // DomainBoundClone behavior is different than their normal clone behavior.
+ // It must allocate a NEW exception of the identical type and
+ // copy all the relevant fields from the current exception to the new one.
+ // It is NOT responsible however for copying the inner exception. This
+ // will be handled by the base Exception class.
+ virtual Exception *DomainBoundCloneHelper() { return CloneHelper(); }
+};
+
+#if 1
+template <typename T>
+inline void Exception__Delete(T* pvMemory);
+
+template <>
+inline void Exception__Delete<Exception>(Exception* pvMemory)
+{
+ Exception::Delete(pvMemory);
+}
+
+NEW_WRAPPER_TEMPLATE1(ExceptionHolderTemplate, Exception__Delete<_TYPE>);
+typedef ExceptionHolderTemplate<Exception> ExceptionHolder;
+#else
+
+//------------------------------------------------------------------------------
+// class ExceptionHolder
+//
+// This is a very lightweight holder class for use inside the EX_TRY family
+// of macros. It is based on the standard Holder classes, but has been
+// highly specialized for this one function, so that extra code can be
+// removed, and the resulting code can be simple enough for all of the
+// non-exceptional-case code to be inlined.
+class ExceptionHolder
+{
+private:
+ Exception *m_value;
+ BOOL m_acquired;
+
+public:
+ FORCEINLINE ExceptionHolder(Exception *pException = NULL, BOOL take = TRUE)
+ : m_value(pException)
+ {
+ m_acquired = pException && take;
+ }
+
+ FORCEINLINE ~ExceptionHolder()
+ {
+ if (m_acquired)
+ {
+ Exception::Delete(m_value);
+ }
+ }
+
+ Exception* operator->() { return m_value; }
+
+ void operator=(Exception *p)
+ {
+ Release();
+ m_value = p;
+ Acquire();
+ }
+
+ BOOL IsNull() { return m_value == NULL; }
+
+ operator Exception*() { return m_value; }
+
+ Exception* GetValue() { return m_value; }
+
+ void SuppressRelease() { m_acquired = FALSE; }
+
+private:
+ void Acquire()
+ {
+ _ASSERTE(!m_acquired);
+
+ if (!IsNull())
+ {
+ m_acquired = TRUE;
+ }
+ }
+ void Release()
+ {
+ if (m_acquired)
+ {
+ _ASSERTE(!IsNull());
+ Exception::Delete(m_value);
+ m_acquired = FALSE;
+ }
+ }
+
+};
+
+#endif
+
+// ---------------------------------------------------------------------------
+// HRException class. Implements exception API for exceptions generated from HRESULTs
+// ---------------------------------------------------------------------------
+
+class HRException : public Exception
+{
+ friend bool DebugIsEECxxExceptionPointer(void* pv);
+
+ protected:
+ HRESULT m_hr;
+
+ public:
+ HRException();
+ HRException(HRESULT hr);
+
+ static const int c_type = 0x48522020; // 'HR '
+
+ // Dynamic type query for catchers
+ static int GetType() {LIMITED_METHOD_DAC_CONTRACT; return c_type; }
+ virtual int GetInstanceType() { LIMITED_METHOD_CONTRACT; return c_type; }
+ virtual BOOL IsType(int type) { WRAPPER_NO_CONTRACT; return type == c_type || Exception::IsType(type); }
+ // Virtual overrides
+ HRESULT GetHR();
+
+ BOOL IsSameInstanceType(Exception *pException)
+ {
+ WRAPPER_NO_CONTRACT;
+ return pException->GetInstanceType() == GetType() && pException->GetHR() == m_hr;
+ }
+
+ protected:
+ virtual Exception *CloneHelper()
+ {
+ WRAPPER_NO_CONTRACT;
+ return new HRException(m_hr);
+ }
+};
+
+// ---------------------------------------------------------------------------
+// HRMessageException class. Implements exception API for exceptions
+// generated from HRESULTs, and includes in info message.
+// ---------------------------------------------------------------------------
+
+class HRMsgException : public HRException
+{
+ friend bool DebugIsEECxxExceptionPointer(void* pv);
+
+ protected:
+ SString m_msg;
+
+ public:
+ HRMsgException();
+ HRMsgException(HRESULT hr, SString const &msg);
+
+ // Virtual overrides
+ void GetMessage(SString &s);
+
+ protected:
+ virtual Exception *CloneHelper()
+ {
+ WRAPPER_NO_CONTRACT;
+ return new HRMsgException(m_hr, m_msg);
+ }
+};
+
+// ---------------------------------------------------------------------------
+// COMException class. Implements exception API for standard COM-based error info
+// ---------------------------------------------------------------------------
+
+class COMException : public HRException
+{
+ friend bool DebugIsEECxxExceptionPointer(void* pv);
+
+ private:
+ IErrorInfo *m_pErrorInfo;
+
+ public:
+ COMException();
+ COMException(HRESULT hr) ;
+ COMException(HRESULT hr, IErrorInfo *pErrorInfo);
+ ~COMException();
+
+ // Virtual overrides
+ IErrorInfo *GetErrorInfo();
+ void GetMessage(SString &result);
+
+ protected:
+ virtual Exception *CloneHelper()
+ {
+ WRAPPER_NO_CONTRACT;
+ return new COMException(m_hr, m_pErrorInfo);
+ }
+};
+
+// ---------------------------------------------------------------------------
+// SEHException class. Implements exception API for SEH exception info
+// ---------------------------------------------------------------------------
+
+class SEHException : public Exception
+{
+ friend bool DebugIsEECxxExceptionPointer(void* pv);
+
+ public:
+ EXCEPTION_RECORD m_exception;
+
+ SEHException();
+ SEHException(EXCEPTION_RECORD *pRecord, T_CONTEXT *pContext = NULL);
+
+ static const int c_type = 0x53454820; // 'SEH '
+
+ // Dynamic type query for catchers
+ static int GetType() {LIMITED_METHOD_CONTRACT; return c_type; }
+ virtual int GetInstanceType() { LIMITED_METHOD_CONTRACT; return c_type; }
+ virtual BOOL IsType(int type) { WRAPPER_NO_CONTRACT; return type == c_type || Exception::IsType(type); }
+
+ BOOL IsSameInstanceType(Exception *pException)
+ {
+ WRAPPER_NO_CONTRACT;
+ return pException->GetInstanceType() == GetType() && pException->GetHR() == GetHR();
+ }
+
+ // Virtual overrides
+ HRESULT GetHR();
+ IErrorInfo *GetErrorInfo();
+ void GetMessage(SString &result);
+
+ protected:
+ virtual Exception *CloneHelper()
+ {
+ WRAPPER_NO_CONTRACT;
+ return new SEHException(&m_exception);
+ }
+};
+
+// ---------------------------------------------------------------------------
+// DelegatingException class. Implements exception API for "foreign" exceptions.
+// ---------------------------------------------------------------------------
+
+class DelegatingException : public Exception
+{
+ Exception *m_delegatedException;
+ Exception* GetDelegate();
+
+ enum {DELEGATE_NOT_YET_SET = -1};
+ bool IsDelegateSet() {LIMITED_METHOD_DAC_CONTRACT; return m_delegatedException != (Exception*)DELEGATE_NOT_YET_SET; }
+ bool IsDelegateValid() {LIMITED_METHOD_DAC_CONTRACT; return IsDelegateSet() && m_delegatedException != NULL; }
+
+ public:
+
+ DelegatingException();
+ ~DelegatingException();
+
+ static const int c_type = 0x44454C20; // 'DEL '
+
+ // Dynamic type query for catchers
+ static int GetType() {LIMITED_METHOD_CONTRACT; return c_type; }
+ virtual int GetInstanceType() { LIMITED_METHOD_CONTRACT; return c_type; }
+ virtual BOOL IsType(int type) { WRAPPER_NO_CONTRACT; return type == c_type || Exception::IsType(type); }
+
+ BOOL IsSameInstanceType(Exception *pException)
+ {
+ WRAPPER_NO_CONTRACT;
+ return pException->GetInstanceType() == GetType() && pException->GetHR() == GetHR();
+ }
+
+ // Virtual overrides
+ virtual BOOL IsDomainBound() {return Exception::IsDomainBound() ||(m_delegatedException!=NULL && m_delegatedException->IsDomainBound());} ;
+ HRESULT GetHR();
+ IErrorInfo *GetErrorInfo();
+ void GetMessage(SString &result);
+ virtual Exception *Clone();
+
+ protected:
+ virtual Exception *CloneHelper()
+ {
+ WRAPPER_NO_CONTRACT;
+ return new DelegatingException();
+ }
+};
+
+//------------------------------------------------------------------------------
+// class OutOfMemoryException
+//
+// While there could be any number of instances of this class, there is one
+// special instance, the pre-allocated OOM exception. Storage for that
+// instance is allocated in the image, so we can always obtain it, even
+// in low memory situations.
+// Note that, in fact, there is only one instance.
+//------------------------------------------------------------------------------
+class OutOfMemoryException : public Exception
+{
+ private:
+ static const int c_type = 0x4F4F4D20; // 'OOM '
+ BOOL bIsPreallocated;
+
+ public:
+ OutOfMemoryException() : bIsPreallocated(FALSE) {}
+ OutOfMemoryException(BOOL b) : bIsPreallocated(b) {}
+
+ // Dynamic type query for catchers
+ static int GetType() {LIMITED_METHOD_CONTRACT; return c_type; }
+ virtual int GetInstanceType() { LIMITED_METHOD_CONTRACT; return c_type; }
+ BOOL IsType(int type) { WRAPPER_NO_CONTRACT; return type == c_type || Exception::IsType(type); }
+
+ BOOL IsSameInstanceType(Exception *pException)
+ {
+ WRAPPER_NO_CONTRACT;
+ return pException->GetInstanceType() == GetType();
+ }
+
+ HRESULT GetHR() {LIMITED_METHOD_DAC_CONTRACT; return E_OUTOFMEMORY; }
+ void GetMessage(SString &result) { WRAPPER_NO_CONTRACT; result.SetASCII("Out Of Memory"); }
+
+ virtual Exception *Clone();
+
+ virtual BOOL IsPreallocatedException() { return bIsPreallocated; }
+};
+
+template <typename STATETYPE>
+class CAutoTryCleanup
+{
+public:
+ DEBUG_NOINLINE CAutoTryCleanup(STATETYPE& refState) :
+ m_refState(refState)
+ {
+ SCAN_SCOPE_BEGIN;
+ STATIC_CONTRACT_THROWS;
+ STATIC_CONTRACT_SUPPORTS_DAC;
+
+#ifdef ENABLE_CONTRACTS_IMPL
+ // This is similar to ClrTryMarkerHolder. We're marking that its okay to throw on this thread now because
+ // we're within a try block. We fold this into here strictly for performance reasons... we have one
+ // stack-allocated object do the work.
+ m_pClrDebugState = GetClrDebugState();
+ m_oldOkayToThrowValue = m_pClrDebugState->IsOkToThrow();
+ m_pClrDebugState->SetOkToThrow();
+#endif
+ }
+
+ DEBUG_NOINLINE ~CAutoTryCleanup()
+ {
+ SCAN_SCOPE_END;
+ WRAPPER_NO_CONTRACT;
+
+ m_refState.CleanupTry();
+
+#ifdef ENABLE_CONTRACTS_IMPL
+ // Restore the original OkayToThrow value since we're leaving the try block.
+
+ m_pClrDebugState->SetOkToThrow( m_oldOkayToThrowValue );
+#endif // ENABLE_CONTRACTS_IMPL
+ }
+
+protected:
+ STATETYPE& m_refState;
+
+#ifdef ENABLE_CONTRACTS_DATA
+private:
+ BOOL m_oldOkayToThrowValue;
+ ClrDebugState *m_pClrDebugState;
+#endif
+};
+
+// ---------------------------------------------------------------------------
+// Throw/Catch macros
+//
+// Usage:
+//
+// EX_TRY
+// {
+// EX_THROW(HRException, (E_FAIL));
+// }
+// EX_CATCH
+// {
+// Exception *e = GET_EXCEPTION();
+// EX_RETHROW;
+// }
+// EX_END_CATCH(RethrowTerminalExceptions, RethrowTransientExceptions or SwallowAllExceptions)
+//
+// ---------------------------------------------------------------------------
+
+// ---------------------------------------------------------------------------
+// #NO_HOST_CPP_EH_ONLY
+//
+// The EX_CATCH* macros defined below can work one of two ways:
+// 1. They catch all exceptions, both C++ and SEH exceptions.
+// 2. They catch only C++ exceptions.
+//
+// Which way they are defined depends on what sort of handling of SEH
+// exceptions, like AV's, you wish to have in your DLL. In general we
+// do not typically want to catch and swallow AV's.
+//
+// By default, the macros catch all exceptions. This is how they work when
+// compiled into the primary runtime DLL (clr.dll). This is reasonable for
+// the CLR becuase it needs to also catch managed exceptions, which are SEH
+// exceptions, and because that DLL also includes a vectored exception
+// handler that will take down the process on any AV within clr.dll.
+//
+// But for uses of these macros outside of the CLR DLL there are other
+// possibilities. If a DLL only uses facilities in Utilcode that throw the
+// C++ exceptions defined above, and never needs to catch a managed exception,
+// then that DLL should setup the macros to only catch C++ exceptions. That
+// way, AV's are not accidentally swallowed and hidden.
+//
+// On the other hand, if a DLL needs to catch managed exceptions, then it has
+// no choice but to also catch all SEH exceptions, including AV's. In that case
+// the DLL should also include a vectored handler, like CLR.dll, to take the
+// process down on an AV.
+//
+// The behavior difference is controled by NO_HOST_CPP_EH_ONLY. When defined,
+// the EX_CATCH* macros only catch C++ exceptions. When not defined, they catch
+// C++ and SEH exceptions.
+//
+// Note: use of NO_HOST_CPP_EH_ONLY is only valid outside the primary CLR DLLs.
+// Thus it is an error to attempt to define it without also defining SELF_NO_HOST.
+// ---------------------------------------------------------------------------
+
+#if defined(NO_HOST_CPP_EH_ONLY) && !defined(SELF_NO_HOST)
+#error It is incorrect to attempt to have C++-only EH macros when hosted. This is only valid for components outside the runtime DLLs.
+#endif
+
+//-----------------------------------------------------------------------
+// EX_END_CATCH has a mandatory argument which is one of "RethrowTerminalExceptions",
+// "RethrowTransientExceptions", or "SwallowAllExceptions".
+//
+// If an exception is considered "terminal" (e->IsTerminal()), it should normally
+// be allowed to proceed. Hence, most of the time, you should use RethrowTerminalExceptions.
+//
+// In some cases you will want transient exceptions (terminal plus things like
+// resource exhaustion) to proceed as well. Use RethrowTransientExceptions for this cas.
+//
+// If you have a good reason to use SwallowAllExceptions, (e.g. a hard COM interop boundary)
+// use one of the higher level macros for this if available, or consider developing one.
+// Otherwise, clearly document why you're swallowing terminal exceptions. Raw uses of
+// SwallowAllExceptions will cause the cleanup police to come knocking on your door
+// at some point.
+//
+// A lot of existing TRY's swallow terminals right now simply because there is
+// backout code following the END_CATCH that has to be executed. The solution is
+// to replace that backout code with holder objects.
+
+
+// This is a rotten way to define an enum but as long as we're treating
+// "if (optimizabletoconstant)" warnings as fatal errors, we have little choice.
+
+//-----------------------------------------------------------------------
+
+#define RethrowTransientExceptions \
+ if (GET_EXCEPTION()->IsTransient()) \
+ { \
+ EX_RETHROW; \
+ } \
+
+#define RethrowSOExceptions \
+ if (__state.DidCatchSO()) \
+ { \
+ STATIC_CONTRACT_THROWS_TERMINAL; \
+ EX_RETHROW; \
+ } \
+
+
+// Don't use this - use RethrowCorruptingExceptions (see below) instead.
+#define SwallowAllExceptions ;
+
+//////////////////////////////////////////////////////////////////////
+//
+// Corrupted State Exception Support
+//
+/////////////////////////////////////////////////////////////////////
+
+#ifdef FEATURE_CORRUPTING_EXCEPTIONS
+
+#define CORRUPTING_EXCEPTIONS_ONLY(expr) expr
+#define COMMA_CORRUPTING_EXCEPTIONS_ONLY(expr) ,expr
+
+// EX_END_CATCH has been modified to not swallow Corrupting Exceptions (CE) when one of the
+// following arguments are passed to it:
+//
+// 1) RethrowTerminalExceptions - rethrows both terminal and corrupting exceptions
+// 2) RethrowCorruptingExceptions - swallows all exceptions exception corrupting exceptions. This SHOULD BE USED instead of SwallowAllExceptions.
+// 3) RethrowTerminalExceptionsEx - same as (1) but rethrow of CE can be controlled via a condition.
+// 4) RethrowCorruptingExceptionsEx - same as (2) but rethrow of CE can be controlled via a condition.
+//
+// By default, if a CE is encountered when one of the above policies are applied, the runtime will
+// ensure that the CE propagates up the stack and not get swallowed unless the developer chooses to override the behaviour.
+// This can be done by using the "Ex" versions above that take a conditional which evaluates to a BOOL. In such a case,
+// the CE will *only* be rethrown if the conditional evalutes to TRUE. For examples, refer to COMToCLRWorker or
+// DispatchInfo::InvokeMember implementations.
+//
+// SET_CE_RETHROW_FLAG_FOR_EX_CATCH macros helps evaluate if the CE is to be rethrown or not. This has been redefined in
+// Clrex.h to add the condition of evaluating the throwable as well (which is not available outside the VM folder).
+//
+// Typically, SET_CE_RETHROW_FLAG_FOR_EX_CATCH would rethrow a Corrupted State Exception. However, SO needs to be dealt
+// with specially and this work is done during EX_CATCH, by calling SetupCatch against the handler state, and by EX_ENDTRY
+// by calling HANDLE_STACKOVERFLOW_AFTER_CATCH.
+//
+// Passing FALSE as the second argument to IsProcessCorruptedStateException implies that SET_CE_RETHROW_FLAG_FOR_EX_CATCH
+// will ensure that we dont rethrow SO and allow EX_ENDTRY to SO specific processing. If none is done, then EX_ENDTRY will
+// rethrow SO. By that time stack has been reclaimed and thus, throwing SO will be safe.
+//
+// We also check the global override flag incase it has been set to force pre-V4 beahviour. "0" implies it has not
+// been overriden.
+#define SET_CE_RETHROW_FLAG_FOR_EX_CATCH(expr) (((expr == TRUE) && \
+ (CLRConfig::GetConfigValue(CLRConfig::UNSUPPORTED_legacyCorruptedStateExceptionsPolicy) == 0) && \
+ IsProcessCorruptedStateException(GetCurrentExceptionCode(), FALSE)))
+
+// This rethrow policy can be used in EX_END_CATCH to swallow all exceptions except the corrupting ones.
+// This macro can be used to rethrow the CE based upon a BOOL condition.
+#define RethrowCorruptingExceptionsEx(expr) \
+ if (SET_CE_RETHROW_FLAG_FOR_EX_CATCH(expr)) \
+ { \
+ STATIC_CONTRACT_THROWS_TERMINAL; \
+ EX_RETHROW; \
+ }
+
+#define RethrowCorruptingExceptionsExAndHookRethrow(shouldRethrowExpr, aboutToRethrowExpr) \
+ if (SET_CE_RETHROW_FLAG_FOR_EX_CATCH(shouldRethrowExpr)) \
+ { \
+ STATIC_CONTRACT_THROWS_TERMINAL; \
+ aboutToRethrowExpr; \
+ EX_RETHROW; \
+ }
+
+#else // !FEATURE_CORRUPTING_EXCEPTIONS
+
+#define CORRUPTING_EXCEPTIONS_ONLY(expr)
+#define COMMA_CORRUPTING_EXCEPTIONS_ONLY(expr)
+
+// When we dont have support for CE, just map it to SwallowAllExceptions
+#define RethrowCorruptingExceptionsEx(expr) SwallowAllExceptions
+#define RethrowCorruptingExceptionsExAndHookRethrow(shouldRethrowExpr, aboutToRethrowExpr) SwallowAllExceptions
+#define SET_CE_RETHROW_FLAG_FOR_EX_CATCH(expr) !TRUE
+#endif // FEATURE_CORRUPTING_EXCEPTIONS
+
+// Map to RethrowCorruptingExceptionsEx so that it does the "right" thing
+#define RethrowCorruptingExceptions RethrowCorruptingExceptionsEx(TRUE)
+
+// This macro can be used to rethrow the CE based upon a BOOL condition. It will continue to rethrow terminal
+// exceptions unconditionally.
+#define RethrowTerminalExceptionsEx(expr) \
+ if (GET_EXCEPTION()->IsTerminal() || \
+ SET_CE_RETHROW_FLAG_FOR_EX_CATCH(expr)) \
+ { \
+ STATIC_CONTRACT_THROWS_TERMINAL; \
+ EX_RETHROW; \
+ } \
+
+
+// When applied to EX_END_CATCH, this policy will always rethrow Terminal and Corrupting exceptions if they are
+// encountered.
+#define RethrowTerminalExceptions RethrowTerminalExceptionsEx(TRUE)
+
+// Special define to be used in EEStartup that will also check for VM initialization before
+// commencing on a path that may use the managed thread object.
+#define RethrowTerminalExceptionsWithInitCheck \
+ if ((g_fEEStarted == TRUE) && (GetThread() != NULL)) \
+ { \
+ RethrowTerminalExceptions \
+ }
+
+#ifdef _DEBUG
+
+void ExThrowTrap(const char *fcn, const char *file, int line, const char *szType, HRESULT hr, const char *args);
+
+#define EX_THROW_DEBUG_TRAP(fcn, file, line, szType, hr, args) ExThrowTrap(fcn, file, line, szType, hr, args)
+
+#else
+
+#define EX_THROW_DEBUG_TRAP(fcn, file, line, szType, hr, args)
+
+#endif
+
+#define HANDLE_SO_TOLERANCE_FOR_THROW
+
+#define EX_THROW(_type, _args) \
+ { \
+ FAULT_NOT_FATAL(); \
+ \
+ HANDLE_SO_TOLERANCE_FOR_THROW; \
+ _type * ___pExForExThrow = new _type _args ; \
+ /* don't embed file names in retail to save space and avoid IP */ \
+ /* a findstr /n will allow you to locate it in a pinch */ \
+ STRESS_LOG3(LF_EH, LL_INFO100, "EX_THROW Type = 0x%x HR = 0x%x, " \
+ INDEBUG(__FILE__) " line %d\n", _type::GetType(), \
+ ___pExForExThrow->GetHR(), __LINE__); \
+ EX_THROW_DEBUG_TRAP(__FUNCTION__, __FILE__, __LINE__, #_type, ___pExForExThrow->GetHR(), #_args); \
+ PAL_CPP_THROW(_type *, ___pExForExThrow); \
+ }
+
+//--------------------------------------------------------------------------------
+// Clones an exception into the current domain. Also handles special cases for
+// OOM and other stuff. Making this a function so we don't inline all this logic
+// every place we call EX_THROW_WITH_INNER.
+//--------------------------------------------------------------------------------
+Exception *ExThrowWithInnerHelper(Exception *inner);
+
+// This macro will set the m_innerException into the newly created exception
+// The passed in _type has to be derived from CLRException. You cannot put OOM
+// as the inner exception. If we are throwing in OOM case, allocate more memory (this macro will clone)
+// does not make any sense.
+//
+#define EX_THROW_WITH_INNER(_type, _args, _inner) \
+ { \
+ FAULT_NOT_FATAL(); \
+ \
+ HANDLE_SO_TOLERANCE_FOR_THROW; \
+ Exception *_inner2 = ExThrowWithInnerHelper(_inner); \
+ _type *___pExForExThrow = new _type _args ; \
+ ___pExForExThrow->SetInnerException(_inner2); \
+ STRESS_LOG3(LF_EH, LL_INFO100, "EX_THROW_WITH_INNER Type = 0x%x HR = 0x%x, " \
+ INDEBUG(__FILE__) " line %d\n", _type::GetType(), \
+ ___pExForExThrow->GetHR(), __LINE__); \
+ EX_THROW_DEBUG_TRAP(__FUNCTION__, __FILE__, __LINE__, #_type, ___pExForExThrow->GetHR(), #_args); \
+ PAL_CPP_THROW(_type *, ___pExForExThrow); \
+ }
+
+//#define IsCLRException(ex) ((ex !=NULL) && ex->IsType(CLRException::GetType())
+
+#define EX_TRY_IMPL EX_TRY_CUSTOM(Exception::HandlerState, , DelegatingException /* was SEHException*/)
+
+#define EX_TRY_CPP_ONLY EX_TRY_CUSTOM_CPP_ONLY(Exception::HandlerState, , DelegatingException /* was SEHException*/)
+
+#ifndef INCONTRACT
+#ifdef ENABLE_CONTRACTS
+#define INCONTRACT(x) x
+#else
+#define INCONTRACT(x)
+#endif
+#endif
+
+#define EX_TRY_CUSTOM(STATETYPE, STATEARG, DEFAULT_EXCEPTION_TYPE) \
+ { \
+ STATETYPE __state STATEARG; \
+ typedef DEFAULT_EXCEPTION_TYPE __defaultException_t; \
+ SCAN_EHMARKER(); \
+ PAL_CPP_TRY \
+ { \
+ SCAN_EHMARKER_TRY(); \
+ SCAN_EHMARKER(); \
+ PAL_CPP_TRY \
+ { \
+ SCAN_EHMARKER_TRY(); \
+ CAutoTryCleanup<STATETYPE> __autoCleanupTry(__state); \
+ /* prevent annotations from being dropped by optimizations in debug */ \
+ INDEBUG(static bool __alwayszero;) \
+ INDEBUG(VolatileLoad(&__alwayszero);) \
+ { \
+ /* this is necessary for Rotor exception handling to work */ \
+ DEBUG_ASSURE_NO_RETURN_BEGIN(EX_TRY) \
+ EX_TRY_HOLDER \
+
+
+#define EX_CATCH_IMPL_EX(DerivedExceptionClass) \
+ DEBUG_ASSURE_NO_RETURN_END(EX_TRY) \
+ } \
+ SCAN_EHMARKER_END_TRY(); \
+ } \
+ PAL_CPP_CATCH_DERIVED (DerivedExceptionClass, __pExceptionRaw) \
+ { \
+ SCAN_EHMARKER_CATCH(); \
+ __state.SetCaughtCxx(); \
+ __state.m_pExceptionPtr = __pExceptionRaw; \
+ SCAN_EHMARKER_END_CATCH(); \
+ SCAN_IGNORE_THROW_MARKER; \
+ PAL_CPP_RETHROW; \
+ } \
+ PAL_CPP_ENDTRY \
+ SCAN_EHMARKER_END_TRY(); \
+ } \
+ PAL_CPP_CATCH_ALL \
+ { \
+ SCAN_EHMARKER_CATCH(); \
+ VALIDATE_BACKOUT_STACK_CONSUMPTION; \
+ __defaultException_t __defaultException; \
+ CHECK::ResetAssert(); \
+ ExceptionHolder __pException(__state.m_pExceptionPtr); \
+ /* work around unreachable code warning */ \
+ if (true) { \
+ DEBUG_ASSURE_NO_RETURN_BEGIN(EX_CATCH) \
+ /* don't embed file names in retail to save space and avoid IP */ \
+ /* a findstr /n will allow you to locate it in a pinch */ \
+ __state.SetupCatch(INDEBUG_COMMA(__FILE__) __LINE__); \
+
+#define EX_CATCH_IMPL EX_CATCH_IMPL_EX(Exception)
+
+#define EX_TRY_CUSTOM_CPP_ONLY(STATETYPE, STATEARG, DEFAULT_EXCEPTION_TYPE) \
+ { \
+ STATETYPE __state STATEARG; \
+ typedef DEFAULT_EXCEPTION_TYPE __defaultException_t; \
+ SCAN_EHMARKER(); \
+ PAL_CPP_TRY \
+ { \
+ SCAN_EHMARKER_TRY(); \
+ CAutoTryCleanup<STATETYPE> __autoCleanupTry(__state); \
+ /* prevent annotations from being dropped by optimizations in debug */ \
+ INDEBUG(static bool __alwayszero;) \
+ INDEBUG(VolatileLoad(&__alwayszero);) \
+ { \
+ /* this is necessary for Rotor exception handling to work */ \
+ DEBUG_ASSURE_NO_RETURN_BEGIN(EX_TRY) \
+
+#define EX_CATCH_IMPL_CPP_ONLY \
+ DEBUG_ASSURE_NO_RETURN_END(EX_TRY) \
+ } \
+ SCAN_EHMARKER_END_TRY(); \
+ } \
+ PAL_CPP_CATCH_DERIVED (Exception, __pExceptionRaw) \
+ { \
+ SCAN_EHMARKER_CATCH(); \
+ __state.SetCaughtCxx(); \
+ __state.m_pExceptionPtr = __pExceptionRaw; \
+ SCAN_EHMARKER_END_CATCH(); \
+ SCAN_IGNORE_THROW_MARKER; \
+ VALIDATE_BACKOUT_STACK_CONSUMPTION; \
+ __defaultException_t __defaultException; \
+ CHECK::ResetAssert(); \
+ ExceptionHolder __pException(__state.m_pExceptionPtr); \
+ /* work around unreachable code warning */ \
+ if (true) { \
+ DEBUG_ASSURE_NO_RETURN_BEGIN(EX_CATCH) \
+ /* don't embed file names in retail to save space and avoid IP */ \
+ /* a findstr /n will allow you to locate it in a pinch */ \
+ __state.SetupCatch(INDEBUG_COMMA(__FILE__) __LINE__); \
+
+
+// Here we finally define the EX_CATCH* macros that will be used throughout the system.
+// These can catch C++ and SEH exceptions, or just C++ exceptions.
+// See code:NO_HOST_CPP_EH_ONLY for more details.
+//
+// Note: we make it illegal to use forms that are redundant with the basic EX_CATCH
+// version. I.e., in the C++ & SEH version, EX_CATCH_CPP_AND_SEH is the same as EX_CATCH.
+// Likewise, in the C++ only version, EX_CATCH_CPP_ONLY is redundant with EX_CATCH.
+
+#ifndef NO_HOST_CPP_EH_ONLY
+#define EX_TRY EX_TRY_IMPL
+#define EX_CATCH EX_CATCH_IMPL
+#define EX_CATCH_EX EX_CATCH_IMPL_EX
+#define EX_CATCH_CPP_ONLY EX_CATCH_IMPL_CPP_ONLY
+#define EX_CATCH_CPP_AND_SEH Dont_Use_EX_CATCH_CPP_AND_SEH
+#else
+#define EX_TRY EX_TRY_CPP_ONLY
+#define EX_CATCH EX_CATCH_IMPL_CPP_ONLY
+#define EX_CATCH_CPP_ONLY Dont_Use_EX_CATCH_CPP_ONLY
+#define EX_CATCH_CPP_AND_SEH EX_CATCH_IMPL
+
+// Note: at this time we don't have a use case for EX_CATCH_EX, and we do not have
+// the C++-only version of the implementation available. Thus we disallow its use at this time.
+// If a real use case arises then we should go ahead and enable this.
+#define EX_CATCH_EX Dont_Use_EX_CATCH_EX
+#endif
+
+#define EX_END_CATCH_UNREACHABLE \
+ DEBUG_ASSURE_NO_RETURN_END(EX_CATCH) \
+ } \
+ SCAN_EHMARKER_END_CATCH(); \
+ UNREACHABLE(); \
+ } \
+ PAL_CPP_ENDTRY \
+ } \
+
+
+// "terminalexceptionpolicy" must be one of "RethrowTerminalExceptions",
+// "RethrowTransientExceptions", or "SwallowAllExceptions"
+
+#define EX_END_CATCH(terminalexceptionpolicy) \
+ terminalexceptionpolicy; \
+ __state.SucceedCatch(); \
+ DEBUG_ASSURE_NO_RETURN_END(EX_CATCH) \
+ } \
+ SCAN_EHMARKER_END_CATCH(); \
+ } \
+ EX_ENDTRY \
+ } \
+
+
+#define EX_END_CATCH_FOR_HOOK \
+ __state.SucceedCatch(); \
+ DEBUG_ASSURE_NO_RETURN_END(EX_CATCH) \
+ ANNOTATION_HANDLER_END; \
+ } \
+ SCAN_EHMARKER_END_CATCH(); \
+ } \
+ EX_ENDTRY \
+
+#define EX_ENDTRY \
+ PAL_CPP_ENDTRY \
+ if (__state.DidCatch()) \
+ { \
+ RESTORE_SO_TOLERANCE_STATE; \
+ } \
+ if (__state.DidCatchSO()) \
+ { \
+ HANDLE_STACKOVERFLOW_AFTER_CATCH; \
+ }
+
+#define EX_RETHROW \
+ { \
+ __pException.SuppressRelease(); \
+ PAL_CPP_RETHROW; \
+ } \
+
+ // Define a copy of GET_EXCEPTION() that will not be redefined by clrex.h
+#define GET_EXCEPTION() (__pException == NULL ? &__defaultException : __pException.GetValue())
+#define EXTRACT_EXCEPTION() (__pException.Extract())
+
+
+//==============================================================================
+// High-level macros for common uses of EX_TRY. Try using these rather
+// than the raw EX_TRY constructs.
+//==============================================================================
+
+//===================================================================================
+// Macro for converting exceptions into HR internally. Unlike EX_CATCH_HRESULT,
+// it does not set up IErrorInfo on the current thread.
+//
+// Usage:
+//
+// HRESULT hr = S_OK;
+// EX_TRY
+// <do managed stuff>
+// EX_CATCH_HRESULT_NO_ERRORINFO(hr);
+// return hr;
+//
+// Comments:
+// Since IErrorInfo is not set up, this does not require COM interop to be started.
+//===================================================================================
+
+#define EX_CATCH_HRESULT_NO_ERRORINFO(_hr) \
+ EX_CATCH \
+ { \
+ (_hr) = GET_EXCEPTION()->GetHR(); \
+ _ASSERTE(FAILED(_hr)); \
+ } \
+ EX_END_CATCH(SwallowAllExceptions)
+
+
+//===================================================================================
+// Macro for catching managed exception object.
+//
+// Usage:
+//
+// OBJECTREF pThrowable = NULL;
+// EX_TRY
+// <do managed stuff>
+// EX_CATCH_THROWABLE(&pThrowable);
+//
+//===================================================================================
+
+#define EX_CATCH_THROWABLE(ppThrowable) \
+ EX_CATCH \
+ { \
+ if (NULL != ppThrowable) \
+ { \
+ *ppThrowable = GET_THROWABLE(); \
+ } \
+ } \
+ EX_END_CATCH(SwallowAllExceptions)
+
+
+#ifdef FEATURE_COMINTEROP
+
+//===================================================================================
+// Macro for defining external entrypoints such as COM interop boundaries.
+// The boundary will catch all exceptions (including terminals) and convert
+// them into HR/IErrorInfo pairs as appropriate.
+//
+// Usage:
+//
+// HRESULT hr = S_OK;
+// EX_TRY
+// <do managed stuff>
+// EX_CATCH_HRESULT(hr);
+// return hr;
+//
+// Comments:
+// Note that IErrorInfo will automatically be set up on the thread if appropriate.
+//===================================================================================
+
+#define EX_CATCH_HRESULT(_hr) \
+ EX_CATCH \
+ { \
+ (_hr) = GET_EXCEPTION()->GetHR(); \
+ _ASSERTE(FAILED(_hr)); \
+ IErrorInfo *pErr = GET_EXCEPTION()->GetErrorInfo(); \
+ if (pErr != NULL) \
+ { \
+ SetErrorInfo(0, pErr); \
+ pErr->Release(); \
+ } \
+ } \
+ EX_END_CATCH(SwallowAllExceptions)
+
+//===================================================================================
+// Macro to make conditional catching more succinct.
+//
+// Usage:
+//
+// EX_TRY
+// ...
+// EX_CATCH_HRESULT_IF(IsHRESULTForExceptionKind(GET_EXCEPTION()->GetHR(), kFileNotFoundException));
+//===================================================================================
+
+#define EX_CATCH_HRESULT_IF(HR, ...) \
+ EX_CATCH \
+ { \
+ (HR) = GET_EXCEPTION()->GetHR(); \
+ \
+ /* Rethrow if condition is false. */ \
+ if (!(__VA_ARGS__)) \
+ EX_RETHROW; \
+ \
+ _ASSERTE(FAILED(HR)); \
+ IErrorInfo *pErr = GET_EXCEPTION()->GetErrorInfo(); \
+ if (pErr != NULL) \
+ { \
+ SetErrorInfo(0, pErr); \
+ pErr->Release(); \
+ } \
+ } \
+ EX_END_CATCH(SwallowAllExceptions)
+
+
+//===================================================================================
+// Variant of the above Macro for used by ngen and mscorsvc to add
+// a RetailAssert when a reg key is set if we get an unexpected HRESULT
+// from one of the RPC calls.
+//===================================================================================
+
+#define EX_CATCH_HRESULT_AND_NGEN_CLEAN(_hr) \
+ EX_CATCH \
+ { \
+ (_hr) = GET_EXCEPTION()->GetHR(); \
+ RetailAssertIfExpectedClean(); \
+ /* Enable this assert after we fix EH so that GetHR() never */ \
+ /* mistakenly returns S_OK */ \
+ /***/ \
+ /* _ASSERTE(FAILED(_hr)); */ \
+ IErrorInfo *pErr = GET_EXCEPTION()->GetErrorInfo(); \
+ if (pErr != NULL) \
+ { \
+ SetErrorInfo(0, pErr); \
+ pErr->Release(); \
+ } \
+ } \
+ EX_END_CATCH(SwallowAllExceptions)
+
+#else // FEATURE_COMINTEROP
+
+#define EX_CATCH_HRESULT(_hr) EX_CATCH_HRESULT_NO_ERRORINFO(_hr)
+
+#endif // FEATURE_COMINTEROP
+
+//===================================================================================
+// Macro for containing normal exceptions but letting terminal exceptions continue to propagate.
+//
+// Usage:
+//
+// EX_TRY
+// {
+// ...your stuff...
+// }
+// EX_SWALLOW_NONTERMINAL
+//
+// Remember, terminal exceptions (such as ThreadAbort) will still throw out of this
+// block. So don't use this as a substitute for exception-safe cleanup!
+//===================================================================================
+
+#define EX_SWALLOW_NONTERMINAL \
+ EX_CATCH \
+ { \
+ } \
+ EX_END_CATCH(RethrowTerminalExceptions) \
+
+
+//===================================================================================
+// Macro for containing normal exceptions but letting transient exceptions continue to propagate.
+//
+// Usage:
+//
+// EX_TRY
+// {
+// ...your stuff...
+// }
+// EX_SWALLOW_NONTRANSIENT
+//
+// Terminal exceptions (such as ThreadAbort and OutOfMemory) will still throw out of this
+// block. So don't use this as a substitute for exception-safe cleanup!
+//===================================================================================
+
+#define EX_SWALLOW_NONTRANSIENT \
+ EX_CATCH \
+ { \
+ } \
+ EX_END_CATCH(RethrowTransientExceptions) \
+
+
+//===================================================================================
+// Macro for observing or wrapping exceptions in flight.
+//
+// Usage:
+//
+// EX_TRY
+// {
+// ... your stuff ...
+// }
+// EX_HOOK
+// {
+// ... your stuff ...
+// }
+// EX_END_HOOK
+// ... control will never get here ...
+//
+//
+// EX_HOOK is like EX_CATCH except that you can't prevent the
+// exception from being rethrown. You can throw a new exception inside the hook
+// (for example, if you want to wrap the exception in flight with your own).
+// But if control reaches the end of the hook, the original exception gets rethrown.
+//
+// Avoid using EX_HOOK for conditional backout if a destructor-based holder
+// will suffice. Because these macros are implemented on top of SEH, using them will
+// prevent the use of holders anywhere else inside the same function. That is, instead
+// of saying this:
+//
+// EX_TRY // DON'T DO THIS
+// {
+// thing = new Thing();
+// blah
+// }
+// EX_HOOK
+// {
+// delete thing; // if it failed, we don't want to keep the Thing.
+// }
+// EX_END_HOOK
+//
+// do this:
+//
+// Holder<Thing> thing = new Thing(); //DO THIS INSTEAD
+// blah
+// // If we got here, we succeeded. So tell holder we want to keep the thing.
+// thing.SuppressRelease();
+//
+// We won't rethrow the exception if it is a Stack Overflow exception. Instead, we'll throw a new
+// exception. This will allow the stack to unwind point, and so we won't be jeopardizing a
+// second stack overflow.
+//===================================================================================
+#define EX_HOOK \
+ EX_CATCH \
+ { \
+
+#define EX_END_HOOK \
+ } \
+ ANNOTATION_HANDLER_END; \
+ if (IsCurrentExceptionSO()) \
+ __state.SetCaughtSO(); \
+ VM_NO_SO_INFRASTRUCTURE_CODE(_ASSERTE(!__state.DidCatchSO());) \
+ if (!__state.DidCatchSO()) \
+ EX_RETHROW; \
+ EX_END_CATCH_FOR_HOOK; \
+ SO_INFRASTRUCTURE_CODE(if (__state.DidCatchSO())) \
+ SO_INFRASTRUCTURE_CODE(ThrowStackOverflow();) \
+ } \
+
+// ---------------------------------------------------------------------------
+// Inline implementations. Pay no attention to that man behind the curtain.
+// ---------------------------------------------------------------------------
+
+inline Exception::HandlerState::HandlerState()
+{
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_SO_TOLERANT;
+ STATIC_CONTRACT_CANNOT_TAKE_LOCK;
+ STATIC_CONTRACT_SUPPORTS_DAC;
+
+ m_dwFlags = 0;
+ m_pExceptionPtr = NULL;
+
+#if defined(STACK_GUARDS_DEBUG) && defined(ENABLE_CONTRACTS_IMPL)
+ // If we have a debug state, use its setting for SO tolerance. The default
+ // is SO-tolerant if we have no debug state. Can't probe w/o debug state and
+ // can't enter SO-interolant mode w/o probing.
+ GetClrDebugState();
+#endif
+}
+
+inline void Exception::HandlerState::CleanupTry()
+{
+ LIMITED_METHOD_DAC_CONTRACT;
+}
+
+inline void Exception::HandlerState::SetupCatch(INDEBUG_COMMA(__in_z const char * szFile) int lineNum, bool fVMInitialized /* = true */)
+{
+ WRAPPER_NO_CONTRACT;
+
+ if (fVMInitialized)
+ {
+ // Calling into IsCurrentExceptionSO will end up using various VM support entities (e.g. TLS slots, accessing CExecutionEngine
+ // implementation that accesses other VM specific data, etc) that may not be ready/initialized
+ // until the VM is initialized.
+ //
+ // This is particularly important when we have exceptions thrown/triggerred during runtime's initialization
+ // and accessing such data can result in possible recursive AV's in the runtime.
+ if (IsCurrentExceptionSO())
+ SetCaughtSO();
+ }
+
+ /* don't embed file names in retail to save space and avoid IP */
+ /* a findstr /n will allow you to locate it in a pinch */
+#ifdef _DEBUG
+ STRESS_LOG2(LF_EH, LL_INFO100, "EX_CATCH %s line %d\n", szFile, lineNum);
+#else
+ STRESS_LOG1(LF_EH, LL_INFO100, "EX_CATCH line %d\n", lineNum);
+#endif
+
+ SetCaught();
+}
+
+inline void Exception::HandlerState::SucceedCatch()
+{
+ LIMITED_METHOD_DAC_CONTRACT;
+}
+
+inline HRException::HRException()
+ : m_hr(E_UNEXPECTED)
+{
+ LIMITED_METHOD_CONTRACT;
+ SUPPORTS_DAC;
+}
+
+inline HRException::HRException(HRESULT hr)
+ : m_hr(hr)
+{
+ LIMITED_METHOD_CONTRACT;
+ SUPPORTS_DAC;
+
+ // Catchers assume only failing hresults
+ _ASSERTE(FAILED(hr));
+}
+
+inline HRMsgException::HRMsgException()
+ : HRException()
+{
+ LIMITED_METHOD_CONTRACT;
+}
+
+inline HRMsgException::HRMsgException(HRESULT hr, SString const &s)
+ : HRException(hr), m_msg(s)
+{
+ WRAPPER_NO_CONTRACT;
+}
+
+inline COMException::COMException()
+ : HRException(),
+ m_pErrorInfo(NULL)
+{
+ WRAPPER_NO_CONTRACT;
+}
+
+inline COMException::COMException(HRESULT hr)
+ : HRException(hr),
+ m_pErrorInfo(NULL)
+{
+ LIMITED_METHOD_CONTRACT;
+}
+
+inline COMException::COMException(HRESULT hr, IErrorInfo *pErrorInfo)
+ : HRException(hr),
+ m_pErrorInfo(pErrorInfo)
+{
+ LIMITED_METHOD_CONTRACT;
+}
+
+inline SEHException::SEHException()
+{
+ LIMITED_METHOD_CONTRACT;
+ memset(&m_exception, 0, sizeof(EXCEPTION_RECORD));
+}
+
+inline SEHException::SEHException(EXCEPTION_RECORD *pointers, T_CONTEXT *pContext)
+{
+ LIMITED_METHOD_CONTRACT;
+ memcpy(&m_exception, pointers, sizeof(EXCEPTION_RECORD));
+}
+
+// The exception throwing helpers are intentionally not inlined
+// Exception throwing is a rare slow codepath that should be optimized for code size
+
+void DECLSPEC_NORETURN ThrowHR(HRESULT hr);
+void DECLSPEC_NORETURN ThrowHR(HRESULT hr, SString const &msg);
+void DECLSPEC_NORETURN ThrowHR(HRESULT hr, UINT uText);
+void DECLSPEC_NORETURN ThrowWin32(DWORD err);
+void DECLSPEC_NORETURN ThrowLastError();
+void DECLSPEC_NORETURN ThrowOutOfMemory();
+void DECLSPEC_NORETURN ThrowStackOverflow();
+void DECLSPEC_NORETURN ThrowMessage(LPCSTR message, ...);
+
+#undef IfFailThrow
+inline HRESULT IfFailThrow(HRESULT hr)
+{
+ WRAPPER_NO_CONTRACT;
+
+ if (FAILED(hr))
+ {
+ ThrowHR(hr);
+ }
+
+ return hr;
+}
+
+inline HRESULT IfFailThrow(HRESULT hr, SString &msg)
+{
+ WRAPPER_NO_CONTRACT;
+
+ if (FAILED(hr))
+ {
+ ThrowHR(hr, msg);
+ }
+
+ return hr;
+}
+
+inline HRESULT IfTransientFailThrow(HRESULT hr)
+{
+ WRAPPER_NO_CONTRACT;
+
+ if (FAILED(hr) && Exception::IsTransient(hr))
+ {
+ ThrowHR(hr);
+ }
+
+ return hr;
+}
+
+// Set if fatal error (like stack overflow or out of memory) occurred in this process.
+GVAL_DECL(HRESULT, g_hrFatalError);
+
+#endif // _EX_H_
diff --git a/src/inc/expandarray.h b/src/inc/expandarray.h
new file mode 100644
index 0000000000..380461b67f
--- /dev/null
+++ b/src/inc/expandarray.h
@@ -0,0 +1,210 @@
+// 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.
+
+#ifndef EXPANDARRAY_H
+#define EXPANDARRAY_H
+
+#include "iallocator.h"
+
+// An array of T that expands (and never shrinks) to accomodate references (with default value T() for
+// elements newly created by expansion.)
+template<class T>
+class ExpandArray
+{
+protected:
+ IAllocator* m_alloc; // The IAllocator object that should be used to allocate members.
+ T* m_members; // Pointer to the element array.
+ unsigned m_size; // The size of "m_members".
+ unsigned m_minSize; // The minimum array size to allocate.
+
+ // Ensures that "m_size" > "idx", and that "m_members" is at least large enough to be
+ // indexed by "idx".
+ void EnsureCoversInd(unsigned idx);
+
+ // Requires that m_members is not NULL, and that
+ // low <= high <= m_size. Sets elements low to high-1 of m_members to T().
+ void InitializeRange(unsigned low, unsigned high)
+ {
+ assert(m_members != NULL);
+ assert(low <= high && high <= m_size);
+ for (unsigned i = low; i < high; i++) m_members[i] = T();
+ }
+
+public:
+ // Initializes "*this" to represent an empty array of size zero.
+ // Use "alloc" for allocation of internal objects. If "minSize" is specified,
+ // the allocated size of the internal representation will hold at least that many
+ // T's.
+ ExpandArray(IAllocator* alloc, unsigned minSize = 1) :
+ m_alloc(alloc), m_members(NULL), m_size(0), m_minSize(minSize)
+ {
+ assert(minSize > 0);
+ }
+
+ ~ExpandArray()
+ {
+ if (m_members != NULL) m_alloc->Free(m_members);
+ }
+
+ // Like the constructor above, to re-initialize to the empty state.
+ void Init(IAllocator* alloc, unsigned minSize = 1)
+ {
+ if (m_members != NULL) m_alloc->Free(m_members);
+ m_alloc = alloc;
+ m_members = NULL;
+ m_size = 0;
+ m_minSize = minSize;
+ }
+
+ // Resets "*this" to represent an array of size zero, with the given "minSize".
+ void Reset(unsigned minSize)
+ {
+ m_minSize = minSize;
+ Reset();
+ }
+
+ // Resets "*this" to represent an array of size zero, whose
+ // allocated representation can represent at least "m_minSize" T's.
+ void Reset()
+ {
+ if (m_minSize > m_size) EnsureCoversInd(m_minSize-1);
+ InitializeRange(0, m_size);
+ }
+
+ // Returns the T at index "idx". Expands the representation, if necessary,
+ // to contain "idx" in its domain, so the result will be an all-zero T if
+ // it had not previously been set.
+ T Get(unsigned idx)
+ {
+ EnsureCoversInd(idx);
+ return m_members[idx];
+ }
+
+ // Like "Get", but returns a reference, so suitable for use as the LHS of an assignment.
+ T& GetRef(unsigned idx)
+ {
+ EnsureCoversInd(idx);
+ return m_members[idx];
+ }
+
+ // Expands the representation, if necessary, to contain "idx" in its domain, and
+ // sets the value at "idx" to "val".
+ void Set(unsigned idx, T val)
+ {
+ EnsureCoversInd(idx);
+ m_members[idx] = val;
+ }
+
+ T& operator[](unsigned idx)
+ {
+ EnsureCoversInd(idx);
+ return m_members[idx];
+ }
+};
+
+template<class T>
+class ExpandArrayStack: public ExpandArray<T>
+{
+ unsigned m_used;
+
+ public:
+ ExpandArrayStack(IAllocator* alloc, unsigned minSize = 1) : ExpandArray<T>(alloc, minSize), m_used(0) {}
+
+ void Set(unsigned idx, T val)
+ {
+ ExpandArray<T>::Set(idx, val);
+ m_used = max((idx + 1), m_used);
+ }
+
+ // Resets "*this" to represent an array of size zero, whose
+ // allocated representation can represent at least "m_minSize" T's.
+ void Reset()
+ {
+ ExpandArray<T>::Reset();
+ m_used = 0;
+ }
+
+ // Returns the index at which "val" is stored.
+ unsigned Push(T val)
+ {
+ unsigned res = m_used;
+ ExpandArray<T>::Set(m_used, val);
+ m_used++;
+ return res;
+ }
+
+ // Requires Size() > 0
+ T Pop()
+ {
+ assert(Size() > 0);
+ m_used--;
+ return this->m_members[m_used];
+ }
+
+ // Requires Size() > 0
+ T Top()
+ {
+ assert(Size() > 0);
+ return this->m_members[m_used-1];
+ }
+
+ // Requires Size() > 0
+ T& TopRef()
+ {
+ assert(Size() > 0);
+ return this->m_members[m_used-1];
+ }
+
+ // Requires that "idx" < "m_used" (asserting this in debug), and returns
+ // "Get(idx)" (which is covered, by the invariant that all indices in "[0..m_used)" are
+ // covered).
+ T GetNoExpand(unsigned idx)
+ {
+ assert(idx < m_used);
+ return this->m_members[idx];
+ }
+
+ // Requires that "idx" < "m_used" (asserting this in debug).
+ // Removes the element at "idx" and shifts contents of the array beyond "idx", if any,
+ // to occupy the free slot created at "idx".
+ // O(n) worst case operation, no memory is allocated.
+ void Remove(unsigned idx)
+ {
+ assert(idx < m_used);
+ if (idx < m_used - 1)
+ {
+ memmove(&this->m_members[idx], &this->m_members[idx + 1], (m_used - idx - 1) * sizeof(T));
+ }
+ m_used--;
+ }
+
+ unsigned Size() { return m_used; }
+};
+
+template<class T>
+void ExpandArray<T>::EnsureCoversInd(unsigned idx)
+{
+ if (idx >= m_size)
+ {
+ unsigned oldSize = m_size;
+ T* oldMembers = m_members;
+ m_size = max(idx + 1, max(m_minSize, m_size * 2));
+ if (sizeof(T) < sizeof(int))
+ {
+ m_members = (T*)m_alloc->ArrayAlloc(ALIGN_UP(m_size*sizeof(T), sizeof(int)), sizeof(BYTE));
+ }
+ else
+ {
+ m_members = (T*)m_alloc->ArrayAlloc(m_size, sizeof(T));
+ }
+ if (oldMembers != NULL)
+ {
+ memcpy(m_members, oldMembers, oldSize * sizeof(T));
+ m_alloc->Free(oldMembers);
+ }
+ InitializeRange(oldSize, m_size);
+ }
+}
+
+#endif // EXPANDARRAY_H
diff --git a/src/inc/factory.h b/src/inc/factory.h
new file mode 100644
index 0000000000..ae618fe2dd
--- /dev/null
+++ b/src/inc/factory.h
@@ -0,0 +1,49 @@
+// 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.
+
+
+#ifndef _FACTORY_H_
+#define _FACTORY_H_
+
+template<typename PRODUCT>
+class Factory
+{
+public:
+ virtual PRODUCT* Create() = 0;
+ virtual ~Factory() {}
+};
+
+template<typename PRODUCT, DWORD MAX_FACTORY_PRODUCT = 64>
+class InlineFactory : public Factory<PRODUCT>
+{
+public:
+ InlineFactory() : m_next(NULL), m_cProduct(0) { WRAPPER_NO_CONTRACT; }
+ ~InlineFactory() { WRAPPER_NO_CONTRACT; if (m_next) delete m_next; }
+ PRODUCT* Create();
+
+private:
+ InlineFactory* GetNext()
+ {
+ CONTRACTL {
+ NOTHROW;
+ GC_NOTRIGGER;
+ } CONTRACTL_END;
+
+ if (m_next == NULL)
+ {
+ m_next = new (nothrow) InlineFactory<PRODUCT, MAX_FACTORY_PRODUCT>();
+ }
+
+ return m_next;
+ }
+
+ InlineFactory* m_next;
+ PRODUCT m_product[MAX_FACTORY_PRODUCT];
+ INT32 m_cProduct;
+};
+
+#include "factory.inl"
+
+#endif
+
diff --git a/src/inc/factory.inl b/src/inc/factory.inl
new file mode 100644
index 0000000000..b49b90a749
--- /dev/null
+++ b/src/inc/factory.inl
@@ -0,0 +1,32 @@
+// 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.
+
+#ifndef _FACTORY_INL_
+#define _FACTORY_INL_
+
+#include "factory.h"
+
+template<typename PRODUCT, DWORD MAX_FACTORY_PRODUCT>
+PRODUCT* InlineFactory<PRODUCT, MAX_FACTORY_PRODUCT>::Create()
+{
+ WRAPPER_NO_CONTRACT;
+
+ if (m_cProduct == MAX_FACTORY_PRODUCT)
+ {
+ InlineFactory* pNext = GetNext();
+ if (pNext)
+ {
+ return pNext->Create();
+ }
+ else
+ {
+ return NULL;
+ }
+ }
+
+ return &m_product[m_cProduct++];
+}
+
+#endif
+
diff --git a/src/inc/fixedsizestring.h b/src/inc/fixedsizestring.h
new file mode 100644
index 0000000000..18becea349
--- /dev/null
+++ b/src/inc/fixedsizestring.h
@@ -0,0 +1,188 @@
+// 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.
+
+//
+
+// Fixed size string: no dynamic memory allocation, no destructor, no exception
+template<typename T>
+class FixedSizeString
+{
+ enum { FixedStringSize = 256 };
+
+ T m_string[FixedStringSize]; // Using template to support both char and wchar_t
+ HRESULT m_error;
+ unsigned m_pos;
+
+public:
+ FixedSizeString()
+ {
+ Reset();
+ }
+
+ void Reset()
+ {
+ m_string[0] = 0;
+ m_pos = 0;
+ m_error = S_OK;
+ }
+
+ HRESULT GetError() const
+ {
+ return m_error;
+ }
+
+ void Append(char ch)
+ {
+ _ASSERTE((m_pos + 1) < FixedStringSize);
+
+ if ((m_pos + 1) < FixedStringSize)
+ {
+ m_string[m_pos ++] = ch;
+ m_string[m_pos ] = 0;
+ }
+ else
+ {
+ m_error = E_OUTOFMEMORY;
+ }
+ }
+
+ void Append(const char * pStr)
+ {
+ while (* pStr)
+ {
+ _ASSERTE((m_pos + 1) < FixedStringSize);
+
+ if ((m_pos + 1) < FixedStringSize)
+ {
+ _ASSERTE((pStr[0] & 0x80) == 0);
+ m_string[m_pos ++] = * pStr ++;
+ }
+ else
+ {
+ m_error = E_OUTOFMEMORY;
+ return;
+ }
+ }
+
+ m_string[m_pos] = 0;
+ }
+
+ operator const T * () const
+ {
+ return m_string;
+ }
+
+ // Decode encoded assembly/function/field/attribute name back to string, add '.' as seperator
+ void DecodeName(int count, const unsigned char * pCode, const LPCSTR * pDic)
+ {
+ Reset();
+
+ for (int i = 0; i < count; i ++)
+ {
+ unsigned char code = pCode[i];
+
+ if (code == 0)
+ {
+ break;
+ }
+
+ if (i != 0)
+ {
+ Append('.');
+ }
+
+ Append(pDic[code]);
+ }
+
+ _ASSERTE(SUCCEEDED(GetError()));
+ }
+};
+
+
+// Same as fusion\utils\helpers.cpp HashString(wsKey, 0, dwHashSize, FALSE), duplicated here because cee_wks does not include fusion\utils\helpers.cpp
+
+// Needs to match public static uint HashLCString(string str) in OptimizeFxRetarget.csscript
+
+inline DWORD HashLCString(LPCSTR pKey)
+{
+ DWORD dwHash = 0;
+
+ while (* pKey)
+ {
+ char ch = * pKey ++;
+
+ if ((ch >= 'A') && (ch <= 'Z'))
+ {
+ ch += 32;
+ }
+
+ dwHash = (dwHash * 65599) + (DWORD) ch;
+ }
+
+ return dwHash;
+}
+
+
+inline DWORD HashLCString(LPCWSTR pKey)
+{
+ DWORD dwHash = 0;
+
+ while (* pKey)
+ {
+ wchar_t ch = * pKey ++;
+
+ if ((ch >= 'A') && (ch <= 'Z'))
+ {
+ ch += 32;
+ }
+
+ dwHash = (dwHash * 65599) + (DWORD) ch;
+ }
+
+ return dwHash;
+}
+
+
+// Enumerator for auto-generated hash table
+
+// There are two arrays in the hash: hash array and collision array
+// Each entry is two bytes : <index + 1, collision index>
+// The first entry in collision array is always (0, 0) for termination
+
+class StringHashEnumerator
+{
+ const BYTE * m_pHash;
+ const BYTE * m_pCollision;
+
+public:
+
+ StringHashEnumerator(LPCWSTR pStr, const BYTE * pHash, size_t hashCount, const BYTE * pCollision)
+ {
+ // lower case string hashing, half the size of hash array
+ DWORD hash = HashLCString(pStr) % ((DWORD) hashCount / 2);
+
+ m_pCollision = pCollision;
+ m_pHash = pHash + hash * 2; // pointing to entry in hash array
+ }
+
+ StringHashEnumerator(LPCSTR pStr, const BYTE * pHash, size_t hashCount, const BYTE * pCollision)
+ {
+ // lower case string hashing, half the size of hash array
+ DWORD hash = HashLCString(pStr) % ((DWORD) hashCount / 2);
+
+ m_pCollision = pCollision;
+ m_pHash = pHash + hash * 2; // pointing to entry in hash array
+ }
+
+ int GetNext() // negative is ending
+ {
+ BYTE index = m_pHash[0];
+
+ m_pHash = m_pCollision + m_pHash[1] * 2; // move to the next one: collision array
+
+ return index - 1;
+ }
+};
+
+
diff --git a/src/inc/fixuppointer.h b/src/inc/fixuppointer.h
new file mode 100644
index 0000000000..5a1b62c455
--- /dev/null
+++ b/src/inc/fixuppointer.h
@@ -0,0 +1,597 @@
+// 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.
+/*****************************************************************************\
+* *
+* FixupPointer.h - Fixup pointer holder types *
+* *
+\*****************************************************************************/
+
+#ifndef _FIXUPPOINTER_H
+#define _FIXUPPOINTER_H
+
+#include "daccess.h"
+
+#ifdef FEATURE_PREJIT
+
+//----------------------------------------------------------------------------
+// RelativePointer is pointer encoded as relative offset. It is used to reduce size of
+// relocation section in NGen images. Conversion from/to RelativePointer needs
+// address of the pointer ("this") converted to TADDR passed in from outside.
+// Converting "this" to TADDR is not possible in the DAC transparently because
+// DAC is based on exact pointers, not ranges.
+// There are several flavors of conversions from/to RelativePointer:
+// - GetValue/SetValue: The most common version. Assumes that the pointer is not NULL.
+// - GetValueMaybeNull/SetValueMaybeNull: Pointer can be NULL.
+// - GetValueAtPtr/SetValueAtPtr: Static version of GetValue/SetValue. It is
+// meant to simplify access to arrays of RelativePointers.
+// - GetValueMaybeNullAtPtr/SetValueMaybeNullAtPtr
+template<typename PTR_TYPE>
+class RelativePointer
+{
+public:
+ // Returns whether the encoded pointer is NULL.
+ BOOL IsNull() const
+ {
+ LIMITED_METHOD_DAC_CONTRACT;
+ // Pointer pointing to itself is treated as NULL
+ return m_delta == (TADDR)NULL;
+ }
+
+ // Returns value of the encoded pointer. Assumes that the pointer is not NULL.
+ PTR_TYPE GetValue(TADDR base) const
+ {
+ LIMITED_METHOD_DAC_CONTRACT;
+ PRECONDITION(!IsNull());
+ return dac_cast<PTR_TYPE>(base + m_delta);
+ }
+
+#ifndef DACCESS_COMPILE
+ // Returns value of the encoded pointer. Assumes that the pointer is not NULL.
+ // Does not need explicit base and thus can be used in non-DAC builds only.
+ FORCEINLINE PTR_TYPE GetValue() const
+ {
+ LIMITED_METHOD_CONTRACT;
+ return GetValue((TADDR)this);
+ }
+#endif
+
+ // Static version of GetValue. It is meant to simplify access to arrays of pointers.
+ FORCEINLINE static PTR_TYPE GetValueAtPtr(TADDR base)
+ {
+ LIMITED_METHOD_DAC_CONTRACT;
+ return dac_cast<DPTR(RelativePointer<PTR_TYPE>)>(base)->GetValue(base);
+ }
+
+ // Returns value of the encoded pointer. The pointer can be NULL.
+ PTR_TYPE GetValueMaybeNull(TADDR base) const
+ {
+ LIMITED_METHOD_DAC_CONTRACT;
+
+ // Cache local copy of delta to avoid races when the value is changing under us.
+ TADDR delta = m_delta;
+
+ if (delta == 0)
+ return NULL;
+
+ return dac_cast<PTR_TYPE>(base + delta);
+ }
+
+#ifndef DACCESS_COMPILE
+ // Returns value of the encoded pointer. The pointer can be NULL.
+ // Does not need explicit base and thus can be used in non-DAC builds only.
+ FORCEINLINE PTR_TYPE GetValueMaybeNull() const
+ {
+ LIMITED_METHOD_CONTRACT;
+ return GetValueMaybeNull((TADDR)this);
+ }
+#endif
+
+ // Static version of GetValueMaybeNull. It is meant to simplify access to arrays of pointers.
+ FORCEINLINE static PTR_TYPE GetValueMaybeNullAtPtr(TADDR base)
+ {
+ LIMITED_METHOD_DAC_CONTRACT;
+ return dac_cast<DPTR(RelativePointer<PTR_TYPE>)>(base)->GetValueMaybeNull(base);
+ }
+
+ // Set encoded value of the pointer. Assumes that the value is not NULL.
+ void SetValue(TADDR base, PTR_TYPE addr)
+ {
+ LIMITED_METHOD_CONTRACT;
+ PRECONDITION(addr != NULL);
+ m_delta = dac_cast<TADDR>(addr) - base;
+ }
+
+#ifndef DACCESS_COMPILE
+ // Set encoded value of the pointer. Assumes that the value is not NULL.
+ // Does not need explicit base and thus can be used in non-DAC builds only.
+ FORCEINLINE void SetValue(PTR_TYPE addr)
+ {
+ LIMITED_METHOD_CONTRACT;
+ return SetValue((TADDR)this, addr);
+ }
+#endif
+
+ // Static version of SetValue. It is meant to simplify access to arrays of pointers.
+ FORCEINLINE static void SetValueAtPtr(TADDR base, PTR_TYPE addr)
+ {
+ LIMITED_METHOD_CONTRACT;
+ dac_cast<DPTR(RelativePointer<PTR_TYPE>)>(base)->SetValue(base, addr);
+ }
+
+ // Set encoded value of the pointer. The value can be NULL.
+ void SetValueMaybeNull(TADDR base, PTR_TYPE addr)
+ {
+ LIMITED_METHOD_CONTRACT;
+ if (addr == NULL) m_delta = NULL; else SetValue(base, addr);
+ }
+
+#ifndef DACCESS_COMPILE
+ // Set encoded value of the pointer. The value can be NULL.
+ // Does not need explicit base and thus can be used in non-DAC builds only.
+ FORCEINLINE void SetValueMaybeNull(PTR_TYPE addr)
+ {
+ LIMITED_METHOD_CONTRACT;
+ return SetValueMaybeNull((TADDR)this, addr);
+ }
+#endif
+
+ // Static version of SetValueMaybeNull. It is meant to simplify access to arrays of pointers.
+ FORCEINLINE static void SetValueMaybeNullAtPtr(TADDR base, PTR_TYPE addr)
+ {
+ LIMITED_METHOD_CONTRACT;
+ dac_cast<DPTR(RelativePointer<PTR_TYPE>)>(base)->SetValueMaybeNull(base, addr);
+ }
+
+private:
+#ifndef DACCESS_COMPILE
+ Volatile<TADDR> m_delta;
+#else
+ TADDR m_delta;
+#endif
+};
+
+//----------------------------------------------------------------------------
+// FixupPointer is pointer with optional indirection. It is used to reduce number
+// of private pages in NGen images - cross-module pointers that written to at runtime
+// are packed together and accessed via indirection.
+//
+// The direct flavor (lowest bit of m_addr is cleared) is user for intra-module pointers
+// in NGen images, and in datastructuters allocated at runtime.
+//
+// The indirect mode (lowest bit of m_addr is set) is used for cross-module pointers
+// in NGen images.
+//
+
+// Friendly name for lowest bit that marks the indirection
+#define FIXUP_POINTER_INDIRECTION 1
+
+template<typename PTR_TYPE>
+class FixupPointer
+{
+public:
+ // Returns whether the encoded pointer is NULL.
+ BOOL IsNull() const
+ {
+ LIMITED_METHOD_DAC_CONTRACT;
+ return m_addr == 0;
+ }
+
+ // Returns whether the indirection cell contain fixup that has not been converted to real pointer yet.
+ FORCEINLINE BOOL IsTagged() const
+ {
+ LIMITED_METHOD_DAC_CONTRACT;
+ TADDR addr = m_addr;
+ if ((addr & FIXUP_POINTER_INDIRECTION) != 0)
+ return (*PTR_TADDR(addr - FIXUP_POINTER_INDIRECTION) & 1) != 0;
+ return FALSE;
+ }
+
+ // Returns value of the encoded pointer.
+ FORCEINLINE PTR_TYPE GetValue() const
+ {
+ LIMITED_METHOD_DAC_CONTRACT;
+ TADDR addr = m_addr;
+ if ((addr & FIXUP_POINTER_INDIRECTION) != 0)
+ addr = *PTR_TADDR(addr - FIXUP_POINTER_INDIRECTION);
+ return dac_cast<PTR_TYPE>(addr);
+ }
+
+ // Returns the pointer to the indirection cell.
+ PTR_TYPE * GetValuePtr() const
+ {
+ LIMITED_METHOD_DAC_CONTRACT;
+ TADDR addr = m_addr;
+ if ((addr & FIXUP_POINTER_INDIRECTION) != 0)
+ return dac_cast<DPTR(PTR_TYPE)>(addr - FIXUP_POINTER_INDIRECTION);
+ return (PTR_TYPE *)&m_addr;
+ }
+
+ // Returns value of the encoded pointer.
+ // Allows the value to be tagged.
+ FORCEINLINE TADDR GetValueMaybeTagged() const
+ {
+ LIMITED_METHOD_DAC_CONTRACT;
+ TADDR addr = m_addr;
+ if ((addr & FIXUP_POINTER_INDIRECTION) != 0)
+ addr = *PTR_TADDR(addr - FIXUP_POINTER_INDIRECTION);
+ return addr;
+ }
+
+ void SetValue(PTR_TYPE addr)
+ {
+ LIMITED_METHOD_CONTRACT;
+ m_addr = dac_cast<TADDR>(addr);
+ }
+
+private:
+ TADDR m_addr;
+};
+
+//----------------------------------------------------------------------------
+// RelativeFixupPointer is combination of RelativePointer and FixupPointer
+template<typename PTR_TYPE>
+class RelativeFixupPointer
+{
+public:
+ // Returns whether the encoded pointer is NULL.
+ BOOL IsNull() const
+ {
+ LIMITED_METHOD_DAC_CONTRACT;
+ // Pointer pointing to itself is treated as NULL
+ return m_delta == (TADDR)NULL;
+ }
+
+ // Returns whether the indirection cell contain fixup that has not been converted to real pointer yet.
+ FORCEINLINE BOOL IsTagged(TADDR base) const
+ {
+ LIMITED_METHOD_DAC_CONTRACT;
+ TADDR addr = base + m_delta;
+ if ((addr & FIXUP_POINTER_INDIRECTION) != 0)
+ return (*PTR_TADDR(addr - FIXUP_POINTER_INDIRECTION) & 1) != 0;
+ return FALSE;
+ }
+
+ // Returns value of the encoded pointer. Assumes that the pointer is not NULL.
+ FORCEINLINE PTR_TYPE GetValue(TADDR base) const
+ {
+ LIMITED_METHOD_DAC_CONTRACT;
+ PRECONDITION(!IsNull());
+ PRECONDITION(!IsTagged(base));
+ TADDR addr = base + m_delta;
+ if ((addr & FIXUP_POINTER_INDIRECTION) != 0)
+ addr = *PTR_TADDR(addr - FIXUP_POINTER_INDIRECTION);
+ return dac_cast<PTR_TYPE>(addr);
+ }
+
+#ifndef DACCESS_COMPILE
+ // Returns value of the encoded pointer. Assumes that the pointer is not NULL.
+ // Does not need explicit base and thus can be used in non-DAC builds only.
+ FORCEINLINE PTR_TYPE GetValue() const
+ {
+ LIMITED_METHOD_CONTRACT;
+ return GetValue((TADDR)this);
+ }
+#endif
+
+ // Static version of GetValue. It is meant to simplify access to arrays of pointers.
+ FORCEINLINE static PTR_TYPE GetValueAtPtr(TADDR base)
+ {
+ LIMITED_METHOD_DAC_CONTRACT;
+ return dac_cast<DPTR(RelativeFixupPointer<PTR_TYPE>)>(base)->GetValue(base);
+ }
+
+ // Returns value of the encoded pointer. The pointer can be NULL.
+ PTR_TYPE GetValueMaybeNull(TADDR base) const
+ {
+ LIMITED_METHOD_DAC_CONTRACT;
+ PRECONDITION(!IsTagged(base));
+
+ // Cache local copy of delta to avoid races when the value is changing under us.
+ TADDR delta = m_delta;
+
+ if (delta == 0)
+ return NULL;
+
+ TADDR addr = base + delta;
+ if ((addr & FIXUP_POINTER_INDIRECTION) != 0)
+ addr = *PTR_TADDR(addr - FIXUP_POINTER_INDIRECTION);
+ return dac_cast<PTR_TYPE>(addr);
+ }
+
+#ifndef DACCESS_COMPILE
+ // Returns value of the encoded pointer. The pointer can be NULL.
+ // Does not need explicit base and thus can be used in non-DAC builds only.
+ FORCEINLINE PTR_TYPE GetValueMaybeNull() const
+ {
+ LIMITED_METHOD_CONTRACT;
+ return GetValueMaybeNull((TADDR)this);
+ }
+#endif
+
+ // Static version of GetValueMaybeNull. It is meant to simplify access to arrays of pointers.
+ FORCEINLINE static PTR_TYPE GetValueMaybeNullAtPtr(TADDR base)
+ {
+ LIMITED_METHOD_DAC_CONTRACT;
+ return dac_cast<DPTR(RelativeFixupPointer<PTR_TYPE>)>(base)->GetValueMaybeNull(base);
+ }
+
+ // Set encoded value of the pointer. Assumes that the value is not NULL.
+ void SetValue(TADDR base, PTR_TYPE addr)
+ {
+ LIMITED_METHOD_CONTRACT;
+ PRECONDITION(addr != NULL);
+ m_delta = dac_cast<TADDR>(addr) - base;
+ }
+
+#ifndef DACCESS_COMPILE
+ // Set encoded value of the pointer. Assumes that the value is not NULL.
+ // Does not need explicit base and thus can be used in non-DAC builds only.
+ FORCEINLINE void SetValue(PTR_TYPE addr)
+ {
+ LIMITED_METHOD_CONTRACT;
+ return SetValue((TADDR)this, addr);
+ }
+#endif
+
+ // Static version of SetValue. It is meant to simplify access to arrays of pointers.
+ FORCEINLINE static void SetValueAtPtr(TADDR base, PTR_TYPE addr)
+ {
+ LIMITED_METHOD_CONTRACT;
+ dac_cast<DPTR(RelativeFixupPointer<PTR_TYPE>)>(base)->SetValue(base, addr);
+ }
+
+ // Set encoded value of the pointer. The value can be NULL.
+ void SetValueMaybeNull(TADDR base, PTR_TYPE addr)
+ {
+ LIMITED_METHOD_CONTRACT;
+ if (addr == NULL) m_delta = NULL; else SetValue(base, addr);
+ }
+
+#ifndef DACCESS_COMPILE
+ // Set encoded value of the pointer. The value can be NULL.
+ // Does not need explicit base and thus can be used in non-DAC builds only.
+ FORCEINLINE void SetValueMaybeNull(PTR_TYPE addr)
+ {
+ LIMITED_METHOD_CONTRACT;
+ return SetValueMaybeNull((TADDR)this, addr);
+ }
+#endif
+
+ // Static version of SetValueMaybeNull. It is meant to simplify access to arrays of pointers.
+ FORCEINLINE static void SetValueMaybeNullAtPtr(TADDR base, PTR_TYPE addr)
+ {
+ LIMITED_METHOD_CONTRACT;
+ dac_cast<DPTR(RelativeFixupPointer<PTR_TYPE>)>(base)->SetValueMaybeNull(base, addr);
+ }
+
+ // Returns the pointer to the indirection cell.
+ PTR_TYPE * GetValuePtr(TADDR base) const
+ {
+ LIMITED_METHOD_CONTRACT;
+ TADDR addr = base + m_delta;
+ _ASSERTE((addr & FIXUP_POINTER_INDIRECTION) != 0);
+ return dac_cast<DPTR(PTR_TYPE)>(addr - FIXUP_POINTER_INDIRECTION);
+ }
+
+ // Returns value of the encoded pointer. Assumes that the pointer is not NULL.
+ // Allows the value to be tagged.
+ FORCEINLINE TADDR GetValueMaybeTagged(TADDR base) const
+ {
+ LIMITED_METHOD_DAC_CONTRACT;
+ PRECONDITION(!IsNull());
+ TADDR addr = base + m_delta;
+ if ((addr & FIXUP_POINTER_INDIRECTION) != 0)
+ addr = *PTR_TADDR(addr - FIXUP_POINTER_INDIRECTION);
+ return addr;
+ }
+
+private:
+#ifndef DACCESS_COMPILE
+ Volatile<TADDR> m_delta;
+#else
+ TADDR m_delta;
+#endif
+};
+
+// Fixup used for RelativePointer
+#define IMAGE_REL_BASED_RelativePointer IMAGE_REL_BASED_RELPTR
+
+#else // FEATURE_PREJIT
+
+//----------------------------------------------------------------------------
+// PlainPointer is simple pointer wrapper to support compilation without indirections
+// This is useful for building size-constrained runtime without NGen support.
+template<typename PTR_TYPE>
+class PlainPointer
+{
+public:
+ // Returns whether the encoded pointer is NULL.
+ BOOL IsNull() const
+ {
+ LIMITED_METHOD_DAC_CONTRACT;
+ return m_ptr == NULL;
+ }
+
+ // Returns whether the indirection cell contain fixup that has not been converted to real pointer yet.
+ BOOL IsTagged() const
+ {
+ LIMITED_METHOD_DAC_CONTRACT;
+ return m_ptr & 1;
+ }
+
+ // Returns value of the encoded pointer.
+ PTR_TYPE GetValue() const
+ {
+ LIMITED_METHOD_DAC_CONTRACT;
+ return dac_cast<PTR_TYPE>(m_ptr);
+ }
+
+ // Returns the pointer to the indirection cell.
+ PTR_TYPE * GetValuePtr() const
+ {
+ LIMITED_METHOD_DAC_CONTRACT;
+ return (PTR_TYPE *)&m_ptr;
+ }
+
+ // Returns value of the encoded pointer. Assumes that the pointer is not NULL.
+ PTR_TYPE GetValue(TADDR base) const
+ {
+ LIMITED_METHOD_DAC_CONTRACT;
+ PRECONDITION(!IsNull());
+ return dac_cast<PTR_TYPE>(m_ptr);
+ }
+
+ // Static version of GetValue. It is meant to simplify access to arrays of pointers.
+ FORCEINLINE static PTR_TYPE GetValueAtPtr(TADDR base)
+ {
+ LIMITED_METHOD_DAC_CONTRACT;
+ return dac_cast<DPTR(PlainPointer<PTR_TYPE>)>(base)->GetValue(base);
+ }
+
+ // Returns value of the encoded pointer. The pointer can be NULL.
+ PTR_TYPE GetValueMaybeNull(TADDR base) const
+ {
+ LIMITED_METHOD_DAC_CONTRACT;
+ return dac_cast<PTR_TYPE>(m_ptr);
+ }
+
+ // Static version of GetValueMaybeNull. It is meant to simplify access to arrays of pointers.
+ FORCEINLINE static PTR_TYPE GetValueMaybeNullAtPtr(TADDR base)
+ {
+ LIMITED_METHOD_DAC_CONTRACT;
+ return dac_cast<DPTR(PlainPointer<PTR_TYPE>)>(base)->GetValueMaybeNull(base);
+ }
+
+ void SetValue(PTR_TYPE addr)
+ {
+ LIMITED_METHOD_CONTRACT;
+ m_ptr = dac_cast<TADDR>(addr);
+ }
+
+ // Set encoded value of the pointer. Assumes that the value is not NULL.
+ void SetValue(TADDR base, PTR_TYPE addr)
+ {
+ LIMITED_METHOD_CONTRACT;
+ PRECONDITION(addr != NULL);
+ m_ptr = dac_cast<TADDR>(addr);
+ }
+
+ // Static version of SetValue. It is meant to simplify access to arrays of pointers.
+ FORCEINLINE static void SetValueAtPtr(TADDR base, PTR_TYPE addr)
+ {
+ LIMITED_METHOD_CONTRACT;
+ dac_cast<DPTR(PlainPointer<PTR_TYPE>)>(base)->SetValue(base, addr);
+ }
+
+ // Set encoded value of the pointer. The value can be NULL.
+ void SetValueMaybeNull(TADDR base, PTR_TYPE addr)
+ {
+ LIMITED_METHOD_CONTRACT;
+ m_ptr = dac_cast<TADDR>(addr);
+ }
+
+#ifndef DACCESS_COMPILE
+ // Set encoded value of the pointer. The value can be NULL.
+ // Does not need explicit base and thus can be used in non-DAC builds only.
+ FORCEINLINE void SetValueMaybeNull(PTR_TYPE addr)
+ {
+ LIMITED_METHOD_CONTRACT;
+ return SetValueMaybeNull((TADDR)this, addr);
+ }
+#endif
+
+ // Static version of SetValueMaybeNull. It is meant to simplify access to arrays of pointers.
+ FORCEINLINE static void SetValueMaybeNullAtPtr(TADDR base, PTR_TYPE addr)
+ {
+ LIMITED_METHOD_CONTRACT;
+ dac_cast<DPTR(PlainPointer<PTR_TYPE>)>(base)->SetValueMaybeNull(base, addr);
+ }
+
+private:
+ TADDR m_ptr;
+};
+
+#define FixupPointer PlainPointer
+#define RelativePointer PlainPointer
+#define RelativeFixupPointer PlainPointer
+
+#endif // FEATURE_PREJIT
+
+//----------------------------------------------------------------------------
+// RelativePointer32 is pointer encoded as relative 32-bit offset. It is used
+// to reduce both the size of the pointer itself as well as size of relocation
+// section for pointers that live exlusively in NGen images.
+template<typename PTR_TYPE>
+class RelativePointer32
+{
+public:
+ // Returns whether the encoded pointer is NULL.
+ BOOL IsNull() const
+ {
+ LIMITED_METHOD_DAC_CONTRACT;
+ // Pointer pointing to itself is treated as NULL
+ return m_delta == 0;
+ }
+
+ // Returns value of the encoded pointer. Assumes that the pointer is not NULL.
+ PTR_TYPE GetValue(TADDR base) const
+ {
+ LIMITED_METHOD_DAC_CONTRACT;
+ PRECONDITION(!IsNull());
+ return dac_cast<PTR_TYPE>(base + m_delta);
+ }
+
+#ifndef DACCESS_COMPILE
+ // Returns value of the encoded pointer. Assumes that the pointer is not NULL.
+ // Does not need explicit base and thus can be used in non-DAC builds only.
+ FORCEINLINE PTR_TYPE GetValue() const
+ {
+ LIMITED_METHOD_CONTRACT;
+ return GetValue((TADDR)this);
+ }
+#endif
+
+ // Static version of GetValue. It is meant to simplify access to arrays of pointers.
+ FORCEINLINE static PTR_TYPE GetValueAtPtr(TADDR base)
+ {
+ LIMITED_METHOD_DAC_CONTRACT;
+ return dac_cast<DPTR(RelativePointer<PTR_TYPE>)>(base)->GetValue(base);
+ }
+
+ // Returns value of the encoded pointer. The pointer can be NULL.
+ PTR_TYPE GetValueMaybeNull(TADDR base) const
+ {
+ LIMITED_METHOD_DAC_CONTRACT;
+
+ // Cache local copy of delta to avoid races when the value is changing under us.
+ TADDR delta = m_delta;
+
+ if (delta == 0)
+ return NULL;
+
+ return dac_cast<PTR_TYPE>(base + delta);
+ }
+
+#ifndef DACCESS_COMPILE
+ // Returns value of the encoded pointer. The pointer can be NULL.
+ // Does not need explicit base and thus can be used in non-DAC builds only.
+ FORCEINLINE PTR_TYPE GetValueMaybeNull() const
+ {
+ LIMITED_METHOD_CONTRACT;
+ return GetValueMaybeNull((TADDR)this);
+ }
+#endif
+
+ // Static version of GetValueMaybeNull. It is meant to simplify access to arrays of pointers.
+ FORCEINLINE static PTR_TYPE GetValueMaybeNullAtPtr(TADDR base)
+ {
+ LIMITED_METHOD_DAC_CONTRACT;
+ return dac_cast<DPTR(RelativePointer<PTR_TYPE>)>(base)->GetValueMaybeNull(base);
+ }
+
+private:
+ INT32 m_delta;
+};
+
+#endif //_FIXUPPOINTER_H
diff --git a/src/inc/formattype.cpp b/src/inc/formattype.cpp
new file mode 100644
index 0000000000..76aa506bf1
--- /dev/null
+++ b/src/inc/formattype.cpp
@@ -0,0 +1,1574 @@
+// 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.
+//
+
+//
+/******************************************************************************/
+/* formatType.cpp */
+/******************************************************************************/
+#include "formattype.h"
+
+/******************************************************************************/
+char* asString(CQuickBytes *out) {
+ CONTRACTL
+ {
+ THROWS;
+ GC_NOTRIGGER;
+ }
+ CONTRACTL_END;
+
+ SIZE_T oldSize = out->Size();
+ out->ReSizeThrows(oldSize + 1);
+ char* cur = &((char*) out->Ptr())[oldSize];
+ *cur = 0;
+ out->ReSizeThrows(oldSize); // Don't count the null character
+ return((char*) out->Ptr());
+}
+
+void appendStr(CQuickBytes *out, const char* str, unsigned len) {
+ CONTRACTL
+ {
+ THROWS;
+ GC_NOTRIGGER;
+ }
+ CONTRACTL_END;
+
+ if(len == (unsigned)(-1)) len = (unsigned)strlen(str);
+ SIZE_T oldSize = out->Size();
+ out->ReSizeThrows(oldSize + len);
+ char* cur = &((char*) out->Ptr())[oldSize];
+ memcpy(cur, str, len);
+ // Note no trailing null!
+}
+
+void appendChar(CQuickBytes *out, char chr) {
+ CONTRACTL
+ {
+ THROWS;
+ GC_NOTRIGGER;
+ }
+ CONTRACTL_END;
+
+ SIZE_T oldSize = out->Size();
+ out->ReSizeThrows(oldSize + 1);
+ ((char*) out->Ptr())[oldSize] = chr;
+ // Note no trailing null!
+}
+
+void insertStr(CQuickBytes *out, const char* str) {
+ CONTRACTL
+ {
+ THROWS;
+ GC_NOTRIGGER;
+ }
+ CONTRACTL_END;
+
+ unsigned len = (unsigned)strlen(str);
+ SIZE_T oldSize = out->Size();
+ out->ReSizeThrows(oldSize + len);
+ char* cur = &((char*) out->Ptr())[len];
+ memmove(cur,out->Ptr(),oldSize);
+ memcpy(out->Ptr(), str, len);
+ // Note no trailing null!
+}
+
+static void appendStrNum(CQuickBytes *out, int num) {
+ CONTRACTL
+ {
+ THROWS;
+ GC_NOTRIGGER;
+ }
+ CONTRACTL_END;
+
+ char buff[16];
+ sprintf_s(buff, COUNTOF(buff), "%d", num);
+ appendStr(out, buff);
+}
+
+const PCCOR_SIGNATURE PrettyPrintSignature(
+ PCCOR_SIGNATURE typePtr, // type to convert,
+ unsigned typeLen, // the lenght of 'typePtr'
+ const char* name, // can be "", the name of the method for this sig 0 means local var sig
+ CQuickBytes *out, // where to put the pretty printed string
+ IMDInternalImport *pIMDI, // ptr to IMDInternalImport class with ComSig
+ _In_opt_z_ const char* inlabel, // prefix for names (NULL if no names required)
+ BOOL printTyArity=FALSE);
+
+
+PCCOR_SIGNATURE PrettyPrintTypeOrDef(
+ PCCOR_SIGNATURE typePtr, // type to convert,
+ CQuickBytes *out, // where to put the pretty printed string
+ IMDInternalImport *pIMDI); // ptr to IMDInternal class with ComSig
+
+//*****************************************************************************
+// Parse a length, return the length, size of the length.
+//*****************************************************************************
+ULONG GetLength( // Length or -1 on error.
+ void const *pData, // First byte of length.
+ int *pSizeLen) // Put size of length here, if not 0.
+{
+ LIMITED_METHOD_CONTRACT;
+
+ BYTE const *pBytes = reinterpret_cast<BYTE const*>(pData);
+
+ if(pBytes)
+ {
+ if ((*pBytes & 0x80) == 0x00) // 0??? ????
+ {
+ if (pSizeLen) *pSizeLen = 1;
+ return (*pBytes & 0x7f);
+ }
+
+ if ((*pBytes & 0xC0) == 0x80) // 10?? ????
+ {
+ if (pSizeLen) *pSizeLen = 2;
+ return ((*pBytes & 0x3f) << 8 | *(pBytes+1));
+ }
+
+ if ((*pBytes & 0xE0) == 0xC0) // 110? ????
+ {
+ if (pSizeLen) *pSizeLen = 4;
+ return ((*pBytes & 0x1f) << 24 | *(pBytes+1) << 16 | *(pBytes+2) << 8 | *(pBytes+3));
+ }
+ }
+ if(pSizeLen) *pSizeLen = 0;
+ return 0;
+}
+
+
+/******************************************************************************/
+const char* PrettyPrintSig(
+ PCCOR_SIGNATURE typePtr, // type to convert,
+ unsigned typeLen, // the length of 'typePtr'
+ const char* name, // can be "", the name of the method for this sig 0 means local var sig
+ CQuickBytes *out, // where to put the pretty printed string
+ IMDInternalImport *pIMDI, // ptr to IMDInternalImport class with ComSig
+ const char* inlabel, // prefix for names (NULL if no names required)
+ BOOL printTyArity)
+{
+ STATIC_CONTRACT_THROWS;
+
+ // This had a _try/__except handler earlier that would swallow exceptions like
+ // SO and breakpoint. Obviously, swallowing any of them is not the right thing to do.
+ //
+ // Thus, we replace it with EX_TRY/EX_CATCH that automatically kicks in with SO
+ // handling if it sees any SO going past it. Also, C++ catch will not swallow
+ // the breakpoint exception (which is what we want).
+ EX_TRY
+ {
+ PrettyPrintSignature(typePtr,
+ typeLen,
+ name,
+ out,
+ pIMDI,
+ inlabel,
+ printTyArity);
+ }
+ EX_CATCH
+ {
+ out->Shrink(0);
+ appendStr(out,"ERROR PARSING THE SIGNATURE");
+ }
+#if defined(__ILDASM__)
+ // Dont allow ildasm to swallow bad SEH exceptions
+ EX_END_CATCH(RethrowCorruptingExceptions);
+#else // __ILDASM__
+ EX_END_CATCH(SwallowAllExceptions);
+#endif // __ILDASM__
+
+ return(asString(out));
+}
+
+/********************************************************************************/
+// Converts a com signature to a printable signature.
+// Note that return value is pointing at the CQuickBytes buffer,
+
+const PCCOR_SIGNATURE PrettyPrintSignature(
+ PCCOR_SIGNATURE typePtr, // type to convert,
+ unsigned typeLen, // the lenght of 'typePtr'
+ const char* name, // can be "", the name of the method for this sig 0 means local var sig
+ CQuickBytes *out, // where to put the pretty printed string
+ IMDInternalImport *pIMDI, // ptr to IMDInternalImport class with ComSig
+ const char* inlabel, // prefix for names (NULL if no names required)
+ BOOL printTyArity)
+{
+ CONTRACTL
+ {
+ THROWS;
+ GC_NOTRIGGER;
+ }
+ CONTRACTL_END;
+
+ unsigned numArgs;
+ unsigned numTyArgs = 0;
+ PCCOR_SIGNATURE typeEnd = typePtr + typeLen;
+ unsigned ixArg= 0; //arg index
+ char argname[1024];
+ char label[MAX_PREFIX_SIZE];
+ const char* openpar = "(";
+ const char* closepar = ")";
+ ParamDescriptor* pszArgName = NULL; // ptr to array of names (if provided by debug info)
+
+ if(inlabel && *inlabel) // check for *inlabel is totally unnecessary, added to pacify the PREFIX
+ {
+ strcpy_s(label,MAX_PREFIX_SIZE,inlabel);
+ ixArg = label[strlen(label)-1] - '0';
+ label[strlen(label)-1] = 0;
+ if(label[0] == '@') // it's pointer!
+ {
+#ifdef _WIN64
+ pszArgName = (ParamDescriptor*)_atoi64(&label[1]);
+#else // !_WIN64
+ pszArgName = (ParamDescriptor*)(size_t)atoi(&label[1]);
+#endif // _WIN64
+ }
+ }
+
+ // 0 means a local var sig
+ if (name != 0)
+ {
+ // get the calling convention out
+ unsigned callConv = CorSigUncompressData(typePtr);
+
+ // should not be a local var sig
+ _ASSERTE(!isCallConv(callConv, IMAGE_CEE_CS_CALLCONV_LOCAL_SIG));
+
+ if (isCallConv(callConv, IMAGE_CEE_CS_CALLCONV_FIELD))
+ {
+ typePtr = PrettyPrintTypeOrDef(typePtr, out, pIMDI);
+ if (*name)
+ {
+ appendChar(out, ' ');
+ appendStr(out, name);
+ }
+ return(typePtr);
+ }
+
+ if (callConv & IMAGE_CEE_CS_CALLCONV_EXPLICITTHIS)
+ appendStr(out, KEYWORD("explicit "));
+
+ if (callConv & IMAGE_CEE_CS_CALLCONV_HASTHIS)
+ appendStr(out, KEYWORD("instance "));
+
+ if (isCallConv(callConv, IMAGE_CEE_CS_CALLCONV_GENERICINST))
+ {
+ openpar = LTN();
+ closepar = GTN();
+ }
+ else
+ {
+ static const char* const callConvNames[8] = {
+ "",
+ "unmanaged cdecl ",
+ "unmanaged stdcall ",
+ "unmanaged thiscall ",
+ "unmanaged fastcall ",
+ "vararg ",
+ "<error> ",
+ "<error> "
+ };
+ appendStr(out, KEYWORD(callConvNames[callConv & 7]));
+ }
+
+ if (callConv & IMAGE_CEE_CS_CALLCONV_GENERIC)
+ {
+ numTyArgs = CorSigUncompressData(typePtr);
+ }
+ numArgs = CorSigUncompressData(typePtr);
+ if (!isCallConv(callConv, IMAGE_CEE_CS_CALLCONV_GENERICINST))
+ {
+ // do return type
+ if(pszArgName)
+ {
+ argname[0] = 0;
+ DumpParamAttr(argname,COUNTOF(argname),pszArgName[ixArg+numArgs].attr);
+ appendStr(out,argname);
+ }
+ typePtr = PrettyPrintTypeOrDef(typePtr, out, pIMDI);
+ if(pszArgName)
+ {
+ argname[0] = ' '; argname[1] = 0;
+ DumpMarshaling(pIMDI,argname,COUNTOF(argname),pszArgName[ixArg+numArgs].tok);
+ appendStr(out,argname);
+ }
+ if(*name != 0)
+ {
+ appendChar(out, ' ');
+ appendStr(out, name);
+ }
+ if((numTyArgs != 0)&&printTyArity)
+ {
+ appendStr(out,LTN());
+ appendChar(out,'[');
+ appendStrNum(out,numTyArgs);
+ appendChar(out,']');
+ appendStr(out,GTN());
+ }
+ }
+ }
+ else
+ {
+ // get the calling convention out
+#ifdef _DEBUG
+ unsigned callConv =
+#endif
+ CorSigUncompressData(typePtr);
+#ifdef _DEBUG
+ (void)callConv; //prevent "unused variable" warning from GCC
+ // should be a local var sig
+ _ASSERTE(callConv == IMAGE_CEE_CS_CALLCONV_LOCAL_SIG);
+#endif
+
+ numArgs = CorSigUncompressData(typePtr);
+ }
+
+ appendStr(out, openpar);
+
+ bool needComma = false;
+ while(typePtr < typeEnd)
+ {
+ if(name) // printing the arguments
+ {
+ PREFIX_ASSUME(typePtr != NULL);
+ if (*typePtr == ELEMENT_TYPE_SENTINEL)
+ {
+ if (needComma)
+ appendChar(out, ',');
+ appendStr(out, "...");
+ typePtr++;
+ }
+ else
+ {
+ if (numArgs <= 0)
+ break;
+ if (needComma)
+ appendChar(out, ',');
+ if(pszArgName)
+ {
+ argname[0] = 0;
+ DumpParamAttr(argname,COUNTOF(argname),pszArgName[ixArg].attr);
+ appendStr(out,argname);
+ }
+ typePtr = PrettyPrintTypeOrDef(typePtr, out, pIMDI);
+ if(inlabel)
+ {
+ if(pszArgName)
+ {
+ argname[0] = ' '; argname[1] = 0;
+ DumpMarshaling(pIMDI,argname,COUNTOF(argname),pszArgName[ixArg].tok);
+ strcat_s(argname, COUNTOF(argname), ProperName(pszArgName[ixArg++].name));
+ }
+ else sprintf_s(argname,COUNTOF(argname)," %s_%d",label,ixArg++);
+ appendStr(out,argname);
+ }
+ --numArgs;
+ }
+ }
+ else // printing local vars
+ {
+ if (numArgs <= 0)
+ break;
+ if(pszArgName)
+ {
+ if(pszArgName[ixArg].attr == 0xFFFFFFFF)
+ {
+ CQuickBytes fake_out;
+ typePtr = PrettyPrintTypeOrDef(typePtr, &fake_out, pIMDI);
+ ixArg++;
+ numArgs--;
+ continue;
+ }
+ }
+ if (needComma)
+ appendChar(out, ',');
+ if(pszArgName)
+ {
+ sprintf_s(argname,COUNTOF(argname),"[%d] ",pszArgName[ixArg].attr);
+ appendStr(out,argname);
+ }
+ typePtr = PrettyPrintTypeOrDef(typePtr, out, pIMDI);
+ if(inlabel)
+ {
+ if(pszArgName)
+ {
+ sprintf_s(argname,COUNTOF(argname)," %s",ProperLocalName(pszArgName[ixArg++].name));
+ }
+ else sprintf_s(argname,COUNTOF(argname)," %s_%d",label,ixArg++);
+ appendStr(out,argname);
+ }
+ --numArgs;
+ }
+ needComma = true;
+ }
+ // Have we finished printing all the arguments?
+ if (numArgs > 0) {
+ appendStr(out, ERRORMSG(" [SIGNATURE ENDED PREMATURELY]"));
+ }
+
+ appendStr(out, closepar);
+ return(typePtr);
+}
+
+
+/******************************************************************************/
+// pretty prints 'type' or its 'typedef' to the buffer 'out' returns a poitner to the next type,
+// or 0 on a format failure; outside ILDASM -- simple wrapper for PrettyPrintType
+
+PCCOR_SIGNATURE PrettyPrintTypeOrDef(
+ PCCOR_SIGNATURE typePtr, // type to convert,
+ CQuickBytes *out, // where to put the pretty printed string
+ IMDInternalImport *pIMDI) // ptr to IMDInternal class with ComSig
+{
+ CONTRACTL
+ {
+ THROWS;
+ SO_TOLERANT;
+ GC_NOTRIGGER;
+ }
+ CONTRACTL_END;
+
+ PCCOR_SIGNATURE pBegin, pEnd=NULL;
+
+ BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(ThrowStackOverflow());
+
+#ifdef __ILDASM__
+ ULONG L = (ULONG)(out->Size());
+#endif
+ pBegin = typePtr;
+ pEnd = PrettyPrintType(typePtr,out,pIMDI);
+#ifdef __ILDASM__
+ if(pEnd > pBegin) // PrettyPrintType can return NULL
+ {
+ DWORD i;
+ ULONG l = (ULONG)(pEnd - pBegin);
+ for(i=0; i < g_NumTypedefs; i++)
+ {
+ if(((*g_typedefs)[i].cb == l)
+ && (memcmp((*g_typedefs)[i].psig,pBegin,l)==0))
+ {
+ out->Shrink(L); // discard output of PrettyPrintType
+ appendStr(out, JUMPPT(ProperName((*g_typedefs)[i].szName),(*g_typedefs)[i].tkSelf));
+ break;
+ }
+ }
+ }
+#endif
+ END_SO_INTOLERANT_CODE;
+ return pEnd;
+}
+
+/******************************************************************************/
+// pretty prints 'type' to the buffer 'out' returns a pointer to the next type,
+// or 0 on a format failure
+
+PCCOR_SIGNATURE PrettyPrintType(
+ PCCOR_SIGNATURE typePtr, // type to convert,
+ CQuickBytes *out, // where to put the pretty printed string
+ IMDInternalImport *pIMDI) // ptr to IMDInternal class with ComSig
+{
+ CONTRACTL
+ {
+ THROWS;
+ GC_NOTRIGGER;
+ }
+ CONTRACTL_END;
+
+ mdToken tk;
+ const char* str;
+ int typ;
+ CQuickBytes tmp;
+ CQuickBytes Appendix;
+ BOOL Reiterate;
+ int n;
+
+ do {
+ Reiterate = FALSE;
+ switch(typ = *typePtr++) {
+ case ELEMENT_TYPE_VOID :
+ str = "void"; goto APPEND;
+ case ELEMENT_TYPE_BOOLEAN :
+ str = "bool"; goto APPEND;
+ case ELEMENT_TYPE_CHAR :
+ str = "char"; goto APPEND;
+ case ELEMENT_TYPE_I1 :
+ str = "int8"; goto APPEND;
+ case ELEMENT_TYPE_U1 :
+ str = "uint8"; goto APPEND;
+ case ELEMENT_TYPE_I2 :
+ str = "int16"; goto APPEND;
+ case ELEMENT_TYPE_U2 :
+ str = "uint16"; goto APPEND;
+ case ELEMENT_TYPE_I4 :
+ str = "int32"; goto APPEND;
+ case ELEMENT_TYPE_U4 :
+ str = "uint32"; goto APPEND;
+ case ELEMENT_TYPE_I8 :
+ str = "int64"; goto APPEND;
+ case ELEMENT_TYPE_U8 :
+ str = "uint64"; goto APPEND;
+ case ELEMENT_TYPE_R4 :
+ str = "float32"; goto APPEND;
+ case ELEMENT_TYPE_R8 :
+ str = "float64"; goto APPEND;
+ case ELEMENT_TYPE_U :
+ str = "native uint"; goto APPEND;
+ case ELEMENT_TYPE_I :
+ str = "native int"; goto APPEND;
+ case ELEMENT_TYPE_OBJECT :
+ str = "object"; goto APPEND;
+ case ELEMENT_TYPE_STRING :
+ str = "string"; goto APPEND;
+ case ELEMENT_TYPE_TYPEDBYREF :
+ str = "typedref"; goto APPEND;
+ APPEND:
+ appendStr(out, KEYWORD((char*)str));
+ break;
+
+ case ELEMENT_TYPE_VALUETYPE :
+ str = "valuetype ";
+ goto DO_CLASS;
+ case ELEMENT_TYPE_CLASS :
+ str = "class ";
+ goto DO_CLASS;
+
+ DO_CLASS:
+ appendStr(out, KEYWORD((char*)str));
+ typePtr += CorSigUncompressToken(typePtr, &tk);
+ if(IsNilToken(tk))
+ {
+ appendStr(out, "[ERROR! NIL TOKEN]");
+ }
+ else PrettyPrintClass(out, tk, pIMDI);
+ REGISTER_REF(g_tkRefUser,tk)
+ break;
+
+ case ELEMENT_TYPE_SZARRAY :
+ insertStr(&Appendix,"[]");
+ Reiterate = TRUE;
+ break;
+
+ case ELEMENT_TYPE_ARRAY :
+ {
+ typePtr = PrettyPrintTypeOrDef(typePtr, out, pIMDI);
+ PREFIX_ASSUME(typePtr != NULL);
+ unsigned rank = CorSigUncompressData(typePtr);
+ // <TODO> what is the syntax for the rank 0 case? </TODO>
+ if (rank == 0) {
+ appendStr(out, ERRORMSG("[BAD: RANK == 0!]"));
+ }
+ else {
+ _ASSERTE(rank != 0);
+
+#ifdef _PREFAST_
+#pragma prefast(push)
+#pragma prefast(disable:22009 "Suppress PREFAST warnings about integer overflow")
+#endif
+ int* lowerBounds = (int*) _alloca(sizeof(int)*2*rank);
+ int* sizes = &lowerBounds[rank];
+ memset(lowerBounds, 0, sizeof(int)*2*rank);
+
+ unsigned numSizes = CorSigUncompressData(typePtr);
+ _ASSERTE(numSizes <= rank);
+ unsigned i;
+ for(i =0; i < numSizes; i++)
+ sizes[i] = CorSigUncompressData(typePtr);
+
+ unsigned numLowBounds = CorSigUncompressData(typePtr);
+ _ASSERTE(numLowBounds <= rank);
+ for(i = 0; i < numLowBounds; i++)
+ typePtr+=CorSigUncompressSignedInt(typePtr,&lowerBounds[i]);
+
+ appendChar(out, '[');
+ if (rank == 1 && numSizes == 0 && numLowBounds == 0)
+ appendStr(out, "...");
+ else {
+ for(i = 0; i < rank; i++)
+ {
+ //if (sizes[i] != 0 || lowerBounds[i] != 0)
+ {
+ if (lowerBounds[i] == 0 && i < numSizes)
+ appendStrNum(out, sizes[i]);
+ else
+ {
+ if(i < numLowBounds)
+ {
+ appendStrNum(out, lowerBounds[i]);
+ appendStr(out, "...");
+ if (/*sizes[i] != 0 && */i < numSizes)
+ appendStrNum(out, lowerBounds[i] + sizes[i] - 1);
+ }
+ }
+ }
+ if (i < rank-1)
+ appendChar(out, ',');
+ }
+ }
+ appendChar(out, ']');
+#ifdef _PREFAST_
+#pragma prefast(pop)
+#endif
+ }
+ } break;
+
+ case ELEMENT_TYPE_VAR :
+ appendChar(out, '!');
+ n = CorSigUncompressData(typePtr);
+#ifdef __ILDASM__
+ if(!PrettyPrintGP(g_tkVarOwner,out,n))
+#endif
+ appendStrNum(out, n);
+ break;
+
+ case ELEMENT_TYPE_MVAR :
+ appendChar(out, '!');
+ appendChar(out, '!');
+ n = CorSigUncompressData(typePtr);
+#ifdef __ILDASM__
+ if(!PrettyPrintGP(g_tkMVarOwner,out,n))
+#endif
+ appendStrNum(out, n);
+ break;
+
+ case ELEMENT_TYPE_FNPTR :
+ appendStr(out, KEYWORD("method "));
+ typePtr = PrettyPrintSignature(typePtr, 0x7FFF, "*", out, pIMDI, NULL);
+ break;
+
+ case ELEMENT_TYPE_GENERICINST :
+ {
+ typePtr = PrettyPrintTypeOrDef(typePtr, out, pIMDI);
+ appendStr(out, LTN());
+ unsigned numArgs = CorSigUncompressData(typePtr);
+ bool needComma = false;
+ while(numArgs--)
+ {
+ if (needComma)
+ appendChar(out, ',');
+ typePtr = PrettyPrintTypeOrDef(typePtr, out, pIMDI);
+ needComma = true;
+ }
+ appendStr(out, GTN());
+ break;
+ }
+
+#ifndef __ILDASM__
+ case ELEMENT_TYPE_INTERNAL :
+ {
+ // ELEMENT_TYPE_INTERNAL <TypeHandle>
+ _ASSERTE(sizeof(TypeHandle) == sizeof(void *));
+ TypeHandle typeHandle;
+ typePtr += CorSigUncompressPointer(typePtr, (void **)&typeHandle);
+
+ MethodTable *pMT = NULL;
+ if (typeHandle.IsTypeDesc())
+ {
+ pMT = typeHandle.AsTypeDesc()->GetMethodTable();
+ if (pMT)
+ {
+ PrettyPrintClass(out, pMT->GetCl(), pMT->GetMDImport());
+
+ // It could be a "native version" of the managed type used in interop
+ if (typeHandle.AsTypeDesc()->IsNativeValueType())
+ appendStr(out, "_NativeValueType");
+ }
+ else
+ appendStr(out, "(null)");
+ }
+ else
+ {
+ pMT = typeHandle.AsMethodTable();
+ if (pMT)
+ PrettyPrintClass(out, pMT->GetCl(), pMT->GetMDImport());
+ else
+ appendStr(out, "(null)");
+ }
+
+ char sz[32];
+ if(IsCompilationProcess())
+ {
+ sprintf_s(sz, COUNTOF(sz), " /* TOKEN: 0x%x */", pMT != NULL ? pMT->GetCl() : 0);
+ }
+ else
+ {
+ sprintf_s(sz, COUNTOF(sz), " /* MT: 0x%p */", pMT);
+ }
+ appendStr(out, sz);
+ break;
+ }
+#endif
+
+
+ // Modifiers or depedent types
+ case ELEMENT_TYPE_CMOD_OPT :
+ str = " modopt("; goto ADDCLASSTOCMOD;
+ case ELEMENT_TYPE_CMOD_REQD :
+ str = " modreq(";
+ ADDCLASSTOCMOD:
+ typePtr += CorSigUncompressToken(typePtr, &tk);
+ if (IsNilToken(tk))
+ {
+ Debug_ReportError("Nil token in custom modifier");
+ }
+ tmp.Shrink(0);
+ appendStr(&tmp, KEYWORD((char*)str));
+ PrettyPrintClass(&tmp, tk, pIMDI);
+ appendChar(&tmp,')');
+ str = (const char *) asString(&tmp);
+ goto MODIFIER;
+ case ELEMENT_TYPE_PINNED :
+ str = " pinned"; goto MODIFIER;
+ case ELEMENT_TYPE_PTR :
+ str = "*"; goto MODIFIER;
+ case ELEMENT_TYPE_BYREF :
+ str = AMP(); goto MODIFIER;
+ MODIFIER:
+ insertStr(&Appendix, str);
+ Reiterate = TRUE;
+ break;
+
+ default:
+ case ELEMENT_TYPE_SENTINEL :
+ case ELEMENT_TYPE_END :
+ //_ASSERTE(!"Unknown Type");
+ if(typ)
+ {
+ char sz[64];
+ sprintf_s(sz,COUNTOF(sz),"/* UNKNOWN TYPE (0x%X)*/",typ);
+ appendStr(out, ERRORMSG(sz));
+ }
+ break;
+ } // end switch
+ } while(Reiterate);
+ appendStr(out,asString(&Appendix));
+ return(typePtr);
+}
+
+/******************************************************************/
+const char* PrettyPrintClass(
+ CQuickBytes *out, // where to put the pretty printed string
+ mdToken tk, // The class token to look up
+ IMDInternalImport *pIMDI) // ptr to IMDInternalImport class with ComSig
+{
+ CONTRACTL
+ {
+ THROWS;
+ GC_NOTRIGGER;
+ }
+ CONTRACTL_END;
+
+ if(tk == mdTokenNil) // Zero resolution scope for "somewhere here" TypeRefs
+ {
+ appendStr(out,"[*]");
+ return(asString(out));
+ }
+ if(!pIMDI->IsValidToken(tk))
+ {
+ char str[1024];
+ sprintf_s(str,COUNTOF(str)," [ERROR: INVALID TOKEN 0x%8.8X] ",tk);
+ appendStr(out,ERRORMSG(str));
+ return(asString(out));
+ }
+ switch(TypeFromToken(tk))
+ {
+ case mdtTypeRef:
+ case mdtTypeDef:
+#ifdef __ILDASM__
+ DWORD ix;
+ for(ix = 0; ix < g_NumTypedefs; ix++)
+ {
+ if((*g_typedefs)[ix].tkTypeSpec == tk) break;
+ }
+ if(ix < g_NumTypedefs)
+ {
+ appendStr(out,JUMPPT(ProperName((*g_typedefs)[ix].szName),(*g_typedefs)[ix].tkSelf));
+ }
+ else
+#endif
+ {
+ const char *nameSpace = 0;
+ const char *name = 0;
+ mdToken tkEncloser;
+
+ if (TypeFromToken(tk) == mdtTypeRef)
+ {
+ if (FAILED(pIMDI->GetResolutionScopeOfTypeRef(tk, &tkEncloser)))
+ {
+ tkEncloser = mdTypeDefNil;
+ }
+ if (FAILED(pIMDI->GetNameOfTypeRef(tk, &nameSpace, &name)))
+ {
+ nameSpace = name = "Invalid TypeRef record";
+ }
+ }
+ else
+ {
+ if (FAILED(pIMDI->GetNestedClassProps(tk,&tkEncloser)))
+ {
+ tkEncloser = mdTypeDefNil;
+ }
+ if (FAILED(pIMDI->GetNameOfTypeDef(tk, &name, &nameSpace)))
+ {
+ nameSpace = name = "Invalid TypeDef record";
+ }
+ }
+ MAKE_NAME_IF_NONE(name,tk);
+ if((tkEncloser == mdTokenNil) || RidFromToken(tkEncloser))
+ {
+ PrettyPrintClass(out,tkEncloser,pIMDI);
+ if (TypeFromToken(tkEncloser) == mdtTypeRef || TypeFromToken(tkEncloser) == mdtTypeDef)
+ {
+ appendChar(out, '/');
+ //nameSpace = ""; //don't print namespaces for nested classes!
+ }
+ }
+ if(TypeFromToken(tk)==mdtTypeDef)
+ {
+ unsigned L = (unsigned)strlen(ProperName(name))+1;
+ char* szFN = NULL;
+ if(nameSpace && *nameSpace)
+ {
+ const char* sz = ProperName(nameSpace);
+ L+= (unsigned)strlen(sz)+1;
+ szFN = new char[L];
+ sprintf_s(szFN,L,"%s.",sz);
+ }
+ else
+ {
+ szFN = new char[L];
+ *szFN = 0;
+ }
+ strcat_s(szFN,L, ProperName(name));
+ appendStr(out,JUMPPT(szFN,tk));
+ VDELETE(szFN);
+ }
+ else
+ {
+ if (nameSpace && *nameSpace) {
+ appendStr(out, ProperName(nameSpace));
+ appendChar(out, '.');
+ }
+
+ appendStr(out, ProperName(name));
+ }
+ if(g_fDumpTokens)
+ {
+ char tmp[16];
+ sprintf_s(tmp,COUNTOF(tmp),"/*%08X*/",tk);
+ appendStr(out,COMMENT(tmp));
+ }
+ }
+ break;
+
+ case mdtAssemblyRef:
+ {
+ LPCSTR szName = NULL;
+#ifdef __ILDASM__
+ if (rAsmRefName && (RidFromToken(tk) <= ulNumAsmRefs))
+ {
+ szName = rAsmRefName[RidFromToken(tk)-1];
+ }
+ else
+#endif
+ {
+ if (FAILED(pIMDI->GetAssemblyRefProps(tk,NULL,NULL,&szName,NULL,NULL,NULL,NULL)))
+ {
+ szName = NULL;
+ }
+ }
+ if ((szName != NULL) && ((*szName) != 0 ))
+ {
+ appendChar(out, '[');
+ appendStr(out,JUMPPT(ProperName(szName),tk));
+ if(g_fDumpTokens)
+ {
+ char tmp[16];
+ sprintf_s(tmp,COUNTOF(tmp),"/*%08X*/",tk);
+ appendStr(out,COMMENT(tmp));
+ }
+ appendChar(out, ']');
+ }
+ }
+ break;
+ case mdtAssembly:
+ {
+ LPCSTR szName;
+ if (FAILED(pIMDI->GetAssemblyProps(tk,NULL,NULL,NULL,&szName,NULL,NULL)))
+ {
+ szName = NULL;
+ }
+ if ((szName != NULL) && ((*szName) != 0))
+ {
+ appendChar(out, '[');
+ appendStr(out,JUMPPT(ProperName(szName),tk));
+ if(g_fDumpTokens)
+ {
+ char tmp[16];
+ sprintf_s(tmp,COUNTOF(tmp),"/* %08X */",tk);
+ appendStr(out,COMMENT(tmp));
+ }
+ appendChar(out, ']');
+ }
+ }
+ break;
+ case mdtModuleRef:
+ {
+ LPCSTR szName;
+ if (FAILED(pIMDI->GetModuleRefProps(tk, &szName)))
+ {
+ szName = NULL;
+ }
+ if ((szName != NULL) && ((*szName) != 0))
+ {
+ appendChar(out, '[');
+ appendStr(out,KEYWORD(".module "));
+ appendStr(out,JUMPPT(ProperName(szName),tk));
+ if(g_fDumpTokens)
+ {
+ char tmp[16];
+ sprintf_s(tmp,COUNTOF(tmp),"/*%08X*/",tk);
+ appendStr(out,COMMENT(tmp));
+ }
+ appendChar(out, ']');
+ }
+ }
+ break;
+
+ case mdtTypeSpec:
+ {
+#ifdef __ILDASM__
+ DWORD ix;
+ for(ix = 0; ix < g_NumTypedefs; ix++)
+ {
+ if((*g_typedefs)[ix].tkTypeSpec == tk) break;
+ }
+ if(ix < g_NumTypedefs)
+ {
+ appendStr(out,JUMPPT(ProperName((*g_typedefs)[ix].szName),(*g_typedefs)[ix].tkSelf));
+ }
+ else
+#endif
+ {
+ ULONG cSig;
+ PCCOR_SIGNATURE sig;
+ if (FAILED(pIMDI->GetSigFromToken(tk, &cSig, &sig)))
+ {
+ char tmp[64];
+ sprintf_s(tmp, COUNTOF(tmp), "/*Invalid %08X record*/", tk);
+ appendStr(out, COMMENT(tmp));
+ }
+ else
+ {
+ PrettyPrintType(sig, out, pIMDI);
+ }
+ }
+ if(g_fDumpTokens)
+ {
+ char tmp[16];
+ sprintf_s(tmp,COUNTOF(tmp),"/*%08X*/",tk);
+ appendStr(out,COMMENT(tmp));
+ }
+ }
+ break;
+
+ case mdtModule:
+ break;
+
+ default:
+ {
+ char str[128];
+ sprintf_s(str,COUNTOF(str)," [ERROR: INVALID TOKEN TYPE 0x%8.8X] ",tk);
+ appendStr(out,ERRORMSG(str));
+ }
+ }
+ return(asString(out));
+}
+
+const char* TrySigUncompressAndDumpSimpleNativeType(
+ PCCOR_SIGNATURE pData, // [IN] compressed data
+ ULONG *pDataOut, // [OUT] the expanded *pData
+ ULONG &cbCur,
+ SString &buf)
+{
+ const char* sz = NULL;
+ ULONG ulSize = CorSigUncompressData(pData, pDataOut);
+ if (ulSize != (ULONG)-1)
+ {
+ switch (*pDataOut)
+ {
+ case NATIVE_TYPE_VOID: sz = " void"; break;
+ case NATIVE_TYPE_BOOLEAN: sz = " bool"; break;
+ case NATIVE_TYPE_I1: sz = " int8"; break;
+ case NATIVE_TYPE_U1: sz = " unsigned int8"; break;
+ case NATIVE_TYPE_I2: sz = " int16"; break;
+ case NATIVE_TYPE_U2: sz = " unsigned int16"; break;
+ case NATIVE_TYPE_I4: sz = " int32"; break;
+ case NATIVE_TYPE_U4: sz = " unsigned int32"; break;
+ case NATIVE_TYPE_I8: sz = " int64"; break;
+ case NATIVE_TYPE_U8: sz = " unsigned int64"; break;
+ case NATIVE_TYPE_R4: sz = " float32"; break;
+ case NATIVE_TYPE_R8: sz = " float64"; break;
+ case NATIVE_TYPE_SYSCHAR: sz = " syschar"; break;
+ case NATIVE_TYPE_VARIANT: sz = " variant"; break;
+ case NATIVE_TYPE_CURRENCY: sz = " currency"; break;
+ case NATIVE_TYPE_DECIMAL: sz = " decimal"; break;
+ case NATIVE_TYPE_DATE: sz = " date"; break;
+ case NATIVE_TYPE_BSTR: sz = " bstr"; break;
+ case NATIVE_TYPE_LPSTR: sz = " lpstr"; break;
+ case NATIVE_TYPE_LPWSTR: sz = " lpwstr"; break;
+ case NATIVE_TYPE_LPTSTR: sz = " lptstr"; break;
+ case NATIVE_TYPE_OBJECTREF: sz = " objectref"; break;
+ case NATIVE_TYPE_STRUCT: sz = " struct"; break;
+ case NATIVE_TYPE_ERROR: sz = " error"; break;
+ case NATIVE_TYPE_INT: sz = " int"; break;
+ case NATIVE_TYPE_UINT: sz = " uint"; break;
+ case NATIVE_TYPE_NESTEDSTRUCT: sz = " nested struct"; break;
+ case NATIVE_TYPE_BYVALSTR: sz = " byvalstr"; break;
+ case NATIVE_TYPE_ANSIBSTR: sz = " ansi bstr"; break;
+ case NATIVE_TYPE_TBSTR: sz = " tbstr"; break;
+ case NATIVE_TYPE_VARIANTBOOL: sz = " variant bool"; break;
+ case NATIVE_TYPE_FUNC: sz = " method"; break;
+ case NATIVE_TYPE_ASANY: sz = " as any"; break;
+ case NATIVE_TYPE_LPSTRUCT: sz = " lpstruct"; break;
+ case NATIVE_TYPE_PTR:
+ case NATIVE_TYPE_SAFEARRAY:
+ case NATIVE_TYPE_ARRAY:
+ case NATIVE_TYPE_FIXEDSYSSTRING:
+ case NATIVE_TYPE_FIXEDARRAY:
+ case NATIVE_TYPE_INTF:
+ case NATIVE_TYPE_IUNKNOWN:
+ case NATIVE_TYPE_IDISPATCH:
+ case NATIVE_TYPE_CUSTOMMARSHALER:
+ case NATIVE_TYPE_END:
+ case NATIVE_TYPE_MAX:
+ sz = ""; break;
+ default: sz = NULL;
+ }
+ }
+ if (sz)
+ cbCur += ulSize;
+ else
+ buf.Clear();
+
+ return sz;
+}
+
+bool TrySigUncompress(PCCOR_SIGNATURE pData, // [IN] compressed data
+ ULONG *pDataOut, // [OUT] the expanded *pData
+ ULONG &cbCur,
+ SString &buf)
+{
+ ULONG ulSize = CorSigUncompressData(pData, pDataOut);
+ if (ulSize == (ULONG)-1)
+ {
+ buf.Clear();
+ return false;
+ } else
+ {
+ cbCur += ulSize;
+ return true;
+ }
+}
+
+
+#ifdef _PREFAST_
+#pragma warning(push)
+#pragma warning(disable:21000) // Suppress PREFast warning about overly large function
+#endif
+char* DumpMarshaling(IMDInternalImport* pImport,
+ __inout_ecount(cchszString) char* szString,
+ DWORD cchszString,
+ mdToken tok)
+{
+ CONTRACTL
+ {
+ THROWS;
+ GC_NOTRIGGER;
+ }
+ CONTRACTL_END;
+
+ PCCOR_SIGNATURE pSigNativeType = NULL;
+ ULONG cbNativeType = 0;
+ SString buf;
+ if (RidFromToken(tok) &&
+ SUCCEEDED(pImport->GetFieldMarshal( // return error if no native type associate with the token
+ tok, // [IN] given fielddef
+ &pSigNativeType, // [OUT] the native type signature
+ &cbNativeType))) // [OUT] the count of bytes of *ppvNativeType
+ {
+ ULONG cbCur = 0;
+ ULONG ulData;
+ const char *sz = NULL;
+ BOOL fAddAsterisk = FALSE, fAddBrackets = FALSE;
+ buf.AppendPrintf(" %s(", KEYWORD("marshal"));
+ while (cbCur < cbNativeType)
+ {
+ ulData = NATIVE_TYPE_MAX;
+ sz = TrySigUncompressAndDumpSimpleNativeType(&pSigNativeType[cbCur], &ulData, cbCur, buf);
+ if (!sz)
+ goto error;
+ if(*sz == 0)
+ {
+ switch (ulData)
+ {
+ case NATIVE_TYPE_PTR:
+ sz = "";
+ fAddAsterisk = TRUE;
+ break;
+ case NATIVE_TYPE_SAFEARRAY:
+ sz = "";
+ buf.AppendASCII(KEYWORD(" safearray"));
+ ulData = VT_EMPTY;
+ if (cbCur < cbNativeType)
+ {
+ if (!TrySigUncompress(&pSigNativeType[cbCur], &ulData, cbCur, buf))
+ goto error;
+ }
+ switch(ulData & VT_TYPEMASK)
+ {
+ case VT_EMPTY: sz=""; break;
+ case VT_NULL: sz=" null"; break;
+ case VT_VARIANT: sz=" variant"; break;
+ case VT_CY: sz=" currency"; break;
+ case VT_VOID: sz=" void"; break;
+ case VT_BOOL: sz=" bool"; break;
+ case VT_I1: sz=" int8"; break;
+ case VT_I2: sz=" int16"; break;
+ case VT_I4: sz=" int32"; break;
+ case VT_I8: sz=" int64"; break;
+ case VT_R4: sz=" float32"; break;
+ case VT_R8: sz=" float64"; break;
+ case VT_UI1: sz=" unsigned int8"; break;
+ case VT_UI2: sz=" unsigned int16"; break;
+ case VT_UI4: sz=" unsigned int32"; break;
+ case VT_UI8: sz=" unsigned int64"; break;
+ case VT_PTR: sz=" *"; break;
+ case VT_DECIMAL: sz=" decimal"; break;
+ case VT_DATE: sz=" date"; break;
+ case VT_BSTR: sz=" bstr"; break;
+ case VT_LPSTR: sz=" lpstr"; break;
+ case VT_LPWSTR: sz=" lpwstr"; break;
+ case VT_UNKNOWN: sz=" iunknown"; break;
+ case VT_DISPATCH: sz=" idispatch"; break;
+ case VT_SAFEARRAY: sz=" safearray"; break;
+ case VT_INT: sz=" int"; break;
+ case VT_UINT: sz=" unsigned int"; break;
+ case VT_ERROR: sz=" error"; break;
+ case VT_HRESULT: sz=" hresult"; break;
+ case VT_CARRAY: sz=" carray"; break;
+ case VT_USERDEFINED: sz=" userdefined"; break;
+ case VT_RECORD: sz=" record"; break;
+ case VT_FILETIME: sz=" filetime"; break;
+ case VT_BLOB: sz=" blob"; break;
+ case VT_STREAM: sz=" stream"; break;
+ case VT_STORAGE: sz=" storage"; break;
+ case VT_STREAMED_OBJECT: sz=" streamed_object"; break;
+ case VT_STORED_OBJECT: sz=" stored_object"; break;
+ case VT_BLOB_OBJECT: sz=" blob_object"; break;
+ case VT_CF: sz=" cf"; break;
+ case VT_CLSID: sz=" clsid"; break;
+ default: sz=NULL; break;
+ }
+ if(sz) buf.AppendASCII(KEYWORD(sz));
+ else
+ {
+ // buf.AppendPrintf(ERRORMSG(" [ILLEGAL VARIANT TYPE 0x%X]"),ulData & VT_TYPEMASK);
+ buf.Clear();
+ goto error;
+ }
+ sz="";
+ switch(ulData & (~VT_TYPEMASK))
+ {
+ case VT_ARRAY: sz = "[]"; break;
+ case VT_VECTOR: sz = " vector"; break;
+ case VT_BYREF: sz = "&"; break;
+ case VT_BYREF|VT_ARRAY: sz = "&[]"; break;
+ case VT_BYREF|VT_VECTOR: sz = "& vector"; break;
+ case VT_ARRAY|VT_VECTOR: sz = "[] vector"; break;
+ case VT_BYREF|VT_ARRAY|VT_VECTOR: sz = "&[] vector"; break;
+ }
+ buf.AppendASCII(KEYWORD(sz));
+ sz="";
+
+ // Extract the user defined sub type name.
+ if (cbCur < cbNativeType)
+ {
+ LPUTF8 strTemp = NULL;
+ int strLen = 0;
+ int ByteCountLength = 0;
+ strLen = GetLength(&pSigNativeType[cbCur], &ByteCountLength);
+ cbCur += ByteCountLength;
+ if(strLen)
+ {
+#ifdef _PREFAST_
+#pragma prefast(push)
+#pragma prefast(disable:22009 "Suppress PREFAST warnings about integer overflow")
+#endif
+ strTemp = (LPUTF8)_alloca(strLen + 1);
+ memcpy(strTemp, (LPUTF8)&pSigNativeType[cbCur], strLen);
+ strTemp[strLen] = 0;
+ buf.AppendPrintf(", \"%s\"", UnquotedProperName(strTemp));
+ cbCur += strLen;
+#ifdef _PREFAST_
+#pragma prefast(pop)
+#endif
+ }
+ }
+ break;
+
+ case NATIVE_TYPE_ARRAY:
+ sz = "";
+ fAddBrackets = TRUE;
+ break;
+ case NATIVE_TYPE_FIXEDSYSSTRING:
+ {
+ sz = "";
+ buf.AppendASCII(KEYWORD(" fixed sysstring"));
+ buf.AppendASCII(" [");
+ if (cbCur < cbNativeType)
+ {
+ if (!TrySigUncompress(&pSigNativeType[cbCur], &ulData, cbCur, buf))
+ goto error;
+ buf.AppendPrintf("%d",ulData);
+ }
+ buf.AppendASCII("]");
+ }
+ break;
+ case NATIVE_TYPE_FIXEDARRAY:
+ {
+ sz = "";
+ buf.AppendASCII(KEYWORD(" fixed array"));
+ buf.AppendASCII(" [");
+ if (cbCur < cbNativeType)
+ {
+ if (!TrySigUncompress(&pSigNativeType[cbCur], &ulData, cbCur, buf))
+ goto error;
+ buf.AppendPrintf("%d",ulData);
+ }
+ buf.AppendASCII("]");
+ if (cbCur < cbNativeType)
+ {
+ sz = TrySigUncompressAndDumpSimpleNativeType(&pSigNativeType[cbCur], &ulData, cbCur, buf);
+ if (!sz)
+ goto error;
+ }
+ }
+ break;
+
+ case NATIVE_TYPE_INTF:
+ buf.AppendASCII(KEYWORD(" interface"));
+ goto DumpIidParamIndex;
+ case NATIVE_TYPE_IUNKNOWN:
+ buf.AppendASCII(KEYWORD(" iunknown"));
+ goto DumpIidParamIndex;
+ case NATIVE_TYPE_IDISPATCH:
+ buf.AppendASCII(KEYWORD(" idispatch"));
+ DumpIidParamIndex:
+ sz = " ";
+ if (cbCur < cbNativeType)
+ {
+ if (!TrySigUncompress(&pSigNativeType[cbCur], &ulData, cbCur, buf))
+ goto error;
+ buf.AppendPrintf("(%s = %d)",KEYWORD("iidparam"),ulData);
+ }
+ break;
+
+ case NATIVE_TYPE_CUSTOMMARSHALER:
+ {
+ LPUTF8 strTemp = NULL;
+ int strLen = 0;
+ int ByteCountLength = 0;
+ BOOL fFourStrings = FALSE;
+
+ sz = "";
+ buf.AppendASCII(KEYWORD(" custom"));
+ buf.AppendASCII(" (");
+ // Extract the typelib GUID.
+ strLen = GetLength(&pSigNativeType[cbCur], &ByteCountLength);
+ cbCur += ByteCountLength;
+ if(strLen)
+ {
+ fFourStrings = TRUE;
+ strTemp = (LPUTF8)(new char[strLen + 1]);
+ if(strTemp)
+ {
+ memcpy(strTemp, (LPUTF8)&pSigNativeType[cbCur], strLen);
+ strTemp[strLen] = 0;
+ buf.AppendPrintf("\"%s\",",UnquotedProperName(strTemp));
+ cbCur += strLen;
+ VDELETE(strTemp);
+ }
+ }
+ if(cbCur >= cbNativeType)
+ {
+ // buf.AppendASCII(ERRORMSG("/* INCOMPLETE MARSHALER INFO */"));
+ buf.Clear();
+ goto error;
+ }
+ else
+ {
+ //_ASSERTE(cbCur < cbNativeType);
+
+ // Extract the name of the native type.
+ strLen = GetLength(&pSigNativeType[cbCur], &ByteCountLength);
+ cbCur += ByteCountLength;
+ if(fFourStrings)
+ {
+ if(strLen)
+ {
+ strTemp = (LPUTF8)(new char[strLen + 1]);
+ if(strTemp)
+ {
+ memcpy(strTemp, (LPUTF8)&pSigNativeType[cbCur], strLen);
+ strTemp[strLen] = 0;
+ buf.AppendPrintf("\"%s\",",UnquotedProperName(strTemp));
+ cbCur += strLen;
+ VDELETE(strTemp);
+ }
+ }
+ else buf.AppendASCII("\"\",");
+ }
+ if(cbCur >= cbNativeType)
+ {
+ // buf.AppendASCII(ERRORMSG("/* INCOMPLETE MARSHALER INFO */"));
+ buf.Clear();
+ goto error;
+ }
+ else
+ {
+ //_ASSERTE(cbCur < cbNativeType);
+
+ // Extract the name of the custom marshaler.
+ strLen = GetLength(&pSigNativeType[cbCur], &ByteCountLength);
+ cbCur += ByteCountLength;
+ if(strLen)
+ {
+ strTemp = (LPUTF8)(new char[strLen + 1]);
+ if(strTemp)
+ {
+ memcpy(strTemp, (LPUTF8)&pSigNativeType[cbCur], strLen);
+ strTemp[strLen] = 0;
+ buf.AppendPrintf("\"%s\",",UnquotedProperName(strTemp));
+ cbCur += strLen;
+ VDELETE(strTemp);
+ }
+ }
+ else buf.AppendASCII("\"\",");
+ if(cbCur >= cbNativeType)
+ {
+ // buf.AppendASCII(ERRORMSG("/* INCOMPLETE MARSHALER INFO */"));
+ buf.Clear();
+ goto error;
+ }
+ else
+ {
+ // Extract the cookie string.
+ strLen = GetLength(&pSigNativeType[cbCur], &ByteCountLength);
+ cbCur += ByteCountLength;
+
+ if(cbCur+strLen > cbNativeType)
+ {
+ // buf.AppendASCII(ERRORMSG("/* INCOMPLETE MARSHALER INFO */"));
+ buf.Clear();
+ goto error;
+ }
+ else
+ {
+ if(strLen)
+ {
+ strTemp = (LPUTF8)(new (nothrow) char[strLen + 1]);
+ if(strTemp)
+ {
+ memcpy(strTemp, (LPUTF8)&pSigNativeType[cbCur], strLen);
+ strTemp[strLen] = 0;
+
+ buf.AppendASCII("\"");
+ // Copy the cookie string and transform the embedded nulls into \0's.
+ for (int i = 0; i < strLen - 1; i++, cbCur++)
+ {
+ if (strTemp[i] == 0)
+ buf.AppendASCII("\\0");
+ else
+ {
+ buf.AppendPrintf("%c", strTemp[i]);
+ }
+ }
+ buf.AppendPrintf("%c\"", strTemp[strLen - 1]);
+ cbCur++;
+ VDELETE(strTemp);
+ }
+ }
+ else
+ buf.AppendASCII("\"\"");
+ //_ASSERTE(cbCur <= cbNativeType);
+ }
+ }
+ }
+ }
+ buf.AppendASCII(")");
+ }
+ break;
+ default:
+ {
+ sz = "";
+ }
+ } // end switch
+ }
+ if(*sz)
+ {
+ buf.AppendASCII(KEYWORD(sz));
+ if(fAddAsterisk)
+ {
+ buf.AppendASCII("*");
+ fAddAsterisk = FALSE;
+ }
+ if(fAddBrackets)
+ {
+ ULONG ulSizeParam=(ULONG)-1,ulSizeConst=(ULONG)-1;
+ buf.AppendASCII("[");
+ fAddBrackets = FALSE;
+ if (cbCur < cbNativeType)
+ {
+ if (!TrySigUncompress(&pSigNativeType[cbCur], &ulData, cbCur, buf))
+ goto error;
+ ulSizeParam = ulData;
+ if (cbCur < cbNativeType)
+ {
+ if (!TrySigUncompress(&pSigNativeType[cbCur], &ulData, cbCur, buf))
+ goto error;
+ ulSizeConst = ulData;
+ if (cbCur < cbNativeType)
+ {
+ // retrieve flags
+ if (!TrySigUncompress(&pSigNativeType[cbCur], &ulData, cbCur, buf))
+ goto error;
+ if((ulData & 1) == 0) ulSizeParam = 0xFFFFFFFF;
+ }
+ }
+ }
+ if(ulSizeConst != 0xFFFFFFFF)
+ {
+ buf.AppendPrintf("%d",ulSizeConst);
+ // if(ulSizeParam == 0) ulSizeParam = 0xFFFFFFFF; // don't need +0
+ }
+ if(ulSizeParam != 0xFFFFFFFF)
+ {
+ buf.AppendPrintf(" + %d",ulSizeParam);
+ }
+ buf.AppendASCII("]");
+ }
+
+ }
+
+ if (ulData >= NATIVE_TYPE_MAX)
+ break;
+ } // end while (cbCur < cbNativeType)
+ // still can have outstanding asterisk or brackets
+ if(fAddAsterisk)
+ {
+ buf.AppendASCII("*");
+ fAddAsterisk = FALSE;
+ }
+ if(fAddBrackets)
+ {
+ ULONG ulSizeParam=(ULONG)-1,ulSizeConst=(ULONG)-1;
+ buf.AppendASCII("[");
+ fAddBrackets = FALSE;
+ if (cbCur < cbNativeType)
+ {
+ if (!TrySigUncompress(&pSigNativeType[cbCur], &ulData, cbCur, buf))
+ goto error;
+ ulSizeParam = ulData;
+ if (cbCur < cbNativeType)
+ {
+ if (!TrySigUncompress(&pSigNativeType[cbCur], &ulData, cbCur, buf))
+ goto error;
+ ulSizeConst = ulData;
+ }
+ }
+ if(ulSizeConst != 0xFFFFFFFF)
+ {
+ buf.AppendPrintf("%d",ulSizeConst);
+ // if(ulSizeParam == 0) ulSizeParam = 0xFFFFFFFF; // don't need +0
+ }
+ if(ulSizeParam != 0xFFFFFFFF)
+ {
+ buf.AppendPrintf(" + %d",ulSizeParam);
+ }
+ buf.AppendASCII("]");
+ }
+ buf.AppendASCII(") ");
+ }// end if(SUCCEEDED
+error:
+ if (buf.IsEmpty() && cbNativeType != 0)
+ {
+ // There was something that we didn't grok in the signature.
+ // Just dump out the blob as hex
+ buf.AppendPrintf(" %s({", KEYWORD("marshal"));
+ while (cbNativeType--)
+ buf.AppendPrintf(" %2.2X", *pSigNativeType++);
+ buf.AppendASCII(" }) ");
+
+ char * tgt = szString + strlen(szString);
+ int sprintf_ret = sprintf_s(tgt, cchszString - (tgt - szString), "%S", buf.GetUnicode());
+ if (sprintf_ret == -1)
+ {
+ // Hit an error. Oh well, nothing to do...
+ return tgt;
+ }
+ else
+ {
+ return tgt + sprintf_ret;
+ }
+ }
+ else
+ {
+ char * tgt = szString + strlen(szString);
+ int sprintf_ret = sprintf_s(tgt, cchszString - (tgt - szString), "%S", buf.GetUnicode());
+ if (sprintf_ret == -1)
+ {
+ // There was an error, possibly with converting the Unicode characters.
+ buf.Clear();
+ if (cbNativeType != 0)
+ goto error;
+ return tgt; // Oh well, nothing to do...
+ }
+ else
+ {
+ return tgt + sprintf_ret;
+ }
+ }
+}
+#ifdef _PREFAST_
+#pragma warning(pop)
+#endif
+
+char* DumpParamAttr(__inout_ecount(cchszString) char* szString, DWORD cchszString, DWORD dwAttr)
+{
+ CONTRACTL
+ {
+ THROWS;
+ GC_NOTRIGGER;
+ }
+ CONTRACTL_END;
+
+ char *szptr = &szString[strlen(szString)];
+ char *was_szptr = szptr;
+ if(IsPdIn(dwAttr))
+ {
+ szptr+=sprintf_s(szptr,cchszString - (szptr - was_szptr), KEYWORD("[in]"));
+ }
+ if(IsPdOut(dwAttr))
+ {
+ szptr+=sprintf_s(szptr,cchszString - (szptr - was_szptr),KEYWORD("[out]"));
+ }
+ if(IsPdOptional(dwAttr))
+ {
+ szptr+=sprintf_s(szptr,cchszString - (szptr - was_szptr),KEYWORD("[opt]"));
+ }
+ if(szptr != was_szptr)
+ {
+ szptr+=sprintf_s(szptr,cchszString - (szptr - was_szptr)," ");
+ }
+ return szptr;
+}
diff --git a/src/inc/formattype.h b/src/inc/formattype.h
new file mode 100644
index 0000000000..31a17e06f2
--- /dev/null
+++ b/src/inc/formattype.h
@@ -0,0 +1,181 @@
+// 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.
+
+#ifndef _formatType_h
+#define _formatType_h
+
+#include "corpriv.h" // for IMDInternalImport
+
+// ILDASM code doesn't memcpy on gc pointers, so it prefers the real
+// memcpy rather than GCSafeMemCpy.
+#if defined(_DEBUG) && !defined(DACCESS_COMPILE)
+#ifdef memcpy
+#undef memcpy
+#endif
+#endif
+
+#define MAX_PREFIX_SIZE 32
+
+struct ParamDescriptor
+{
+ char* name;
+ mdToken tok;
+ DWORD attr;
+};
+
+char* DumpMarshaling(IMDInternalImport* pImport,
+ __inout_ecount(cchszString) char* szString,
+ DWORD cchszString,
+ mdToken tok);
+char* DumpParamAttr(__inout_ecount(cchszString) char* szString,
+ DWORD cchszString,
+ DWORD dwAttr);
+
+void appendStr(CQuickBytes *out, const char* str, unsigned len=(unsigned)-1);
+void insertStr(CQuickBytes *out, const char* str);
+char* asString(CQuickBytes *out);
+
+const char* PrettyPrintSig(
+ PCCOR_SIGNATURE typePtr, // type to convert,
+ unsigned typeLen, // the lenght of 'typePtr'
+ const char* name, // can be "", the name of the method for this sig 0 means local var sig
+ CQuickBytes *out, // where to put the pretty printed string
+ IMDInternalImport *pIMDI, // ptr to IMDInternalImport class with ComSig
+ __in_opt const char* inlabel, // prefix for names (NULL if no names required)
+ BOOL printTyArity=FALSE); // flag to print Type Param number (MemberRefs only)
+
+PCCOR_SIGNATURE PrettyPrintType(
+ PCCOR_SIGNATURE typePtr, // type to convert,
+ CQuickBytes *out, // where to put the pretty printed string
+ IMDInternalImport *pIMDI); // ptr to IMDInternal class with ComSig
+
+PCCOR_SIGNATURE PrettyPrintTypeOrDef( // outside ILDASM - simple wrapper of PrettyPrintType
+ PCCOR_SIGNATURE typePtr, // type to convert,
+ CQuickBytes *out, // where to put the pretty printed string
+ IMDInternalImport *pIMDI); // ptr to IMDInternal class with ComSig
+
+
+const char* PrettyPrintClass(
+ CQuickBytes *out, // where to put the pretty printed string
+ mdToken tk, // The class token to look up
+ IMDInternalImport *pIMDI); // ptr to IMDInternalImport class with ComSig
+
+//================= ILDASM-specific ==================================================================
+
+#ifdef __ILDASM__
+
+#include "../ildasm/dynamicarray.h"
+
+bool IsNameToQuote(const char *name);
+bool IsLocalToQuote(const char *name);
+const char* UnquotedProperName(__in __nullterminated const char* name, unsigned len=(unsigned)-1);
+const char* ProperName(__in __nullterminated const char* name, bool isLocalName = false);
+#define ProperLocalName(x) ProperName(x, true)
+const char* KEYWORD(__in_opt __nullterminated const char* szOrig);
+const char* COMMENT(__in_opt __nullterminated const char* szOrig);
+const char* ERRORMSG(__in_opt __nullterminated const char* szOrig);
+const char* ANCHORPT(__in __nullterminated const char* szOrig, mdToken tk);
+const char* JUMPPT(__in __nullterminated const char* szOrig, mdToken tk);
+const char* SCOPE(void);
+const char* UNSCOPE(void);
+const char* LTN(void);
+const char* GTN(void);
+const char* AMP(void);
+
+extern BOOL g_fDumpRTF,g_fDumpHTML; // declared in FormatType.cpp
+//-------------------------------------------------------------------------------
+// Protection against null names
+extern const char* const szStdNamePrefix[]; //declared in formatType.cpp
+
+extern DynamicArray<mdToken> *g_dups;
+extern DWORD g_NumDups;
+inline BOOL IsDup(mdToken tk)
+{
+ if(g_NumDups)
+ {
+ mdToken tktype = TypeFromToken(tk);
+ if((tktype==mdtTypeDef)||(tktype==mdtMethodDef)||(tktype==mdtFieldDef))
+ {
+ for (unsigned i=0; i<g_NumDups; i++)
+ {
+ if((*g_dups)[i] == tk) return TRUE;
+ }
+ }
+ }
+ return FALSE;
+}
+#define MAKE_NAME_IF_NONE(psz, tk) { if((!(psz && *psz))||IsDup(tk)) { char* sz = (char*)_alloca(16); \
+sprintf_s(sz,16,"$%s$%X",szStdNamePrefix[tk>>24],tk&0x00FFFFFF); psz = sz; } }
+
+
+struct TypeDefDescr
+{
+ char* szName;
+ mdToken tkTypeSpec;
+ mdToken tkSelf;
+ PCCOR_SIGNATURE psig;
+ ULONG cb;
+};
+extern DynamicArray<TypeDefDescr> *g_typedefs;
+extern DWORD g_NumTypedefs;
+
+
+//-------------------------------------------------------------------------------
+// Reference analysis (ILDASM)
+struct TokPair
+{
+ mdToken tkUser;
+ mdToken tkRef;
+ TokPair() { tkUser = tkRef = 0; };
+};
+extern DynamicArray<TokPair> *g_refs;
+extern DWORD g_NumRefs;
+extern mdToken g_tkRefUser; // for PrettyPrintSig
+#define REGISTER_REF(x,y) if(g_refs && (x)){ (*g_refs)[g_NumRefs].tkUser = x; (*g_refs)[g_NumRefs++].tkRef = y;}
+
+//--------------------------------------------------------------------------------
+// No-throw deallocators
+
+#define SDELETE(x) {PAL_CPP_TRY{ delete (x); } PAL_CPP_CATCH_ALL { _ASSERTE(!"AV in scalar deallocator");} PAL_CPP_ENDTRY; (x)=NULL; }
+#define VDELETE(x) {PAL_CPP_TRY{ delete [] (x); } PAL_CPP_CATCH_ALL { _ASSERTE(!"AV in vector deallocator");}; PAL_CPP_ENDTRY; (x)=NULL; }
+
+//--------------------------------------------------------------------------------
+// Generic param names
+extern mdToken g_tkVarOwner;
+extern mdToken g_tkMVarOwner;
+//void SetVarOwner(mdToken tk) { g_tkVarOwner = tk; }
+//void SetMVarOwner(mdToken tk) { g_tkMVarOwner = tk; }
+BOOL PrettyPrintGP( // defined in dasm.cpp
+ mdToken tkOwner, // Class, method or 0
+ CQuickBytes *out, // where to put the pretty printed generic param
+ int n); // Index of generic param
+
+//============== End of ILDASM-specific ================================================================
+
+#else
+
+#define IsNameToQuote(x) false
+#define IsLocalToQuote(x) false
+#define UnquotedProperName(x) x
+#define ProperName(x) x
+#define ProperLocalName(x) x
+#define KEYWORD(x) x
+#define COMMENT(x) x
+#define ERRORMSG(x) x
+#define ANCHORPT(x,y) x
+#define JUMPPT(x,y) x
+#define SCOPE() "{"
+#define UNSCOPE() "}"
+#define LTN() "<"
+#define GTN() ">"
+#define AMP() "&"
+#define REGISTER_REF(x,y) {}
+#define MAKE_NAME_IF_NONE(x,y) { }
+#define g_fDumpTokens false
+#define SDELETE(x) delete (x)
+#define VDELETE(x) delete [] (x)
+
+#endif
+
+#endif
diff --git a/src/inc/fstream.h b/src/inc/fstream.h
new file mode 100644
index 0000000000..aa81ec8cfd
--- /dev/null
+++ b/src/inc/fstream.h
@@ -0,0 +1,50 @@
+// 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.
+
+
+#ifndef __FSTREAM_H_INCLUDED__
+#define __FSTREAM_H_INCLUDED__
+
+#include <objidl.h>
+
+class CFileStream : public IStream
+{
+ public:
+ CFileStream();
+ virtual ~CFileStream();
+
+ HRESULT OpenForRead(LPCWSTR wzFilePath);
+ HRESULT OpenForWrite(LPCWSTR wzFilePath);
+
+ // IUnknown methods:
+ STDMETHODIMP_(ULONG) AddRef();
+ STDMETHODIMP_(ULONG) Release();
+ STDMETHODIMP QueryInterface(REFIID riid, LPVOID *ppvObj);
+
+ // ISequentialStream methods:
+ STDMETHODIMP Read(void *pv, ULONG cb, ULONG *pcbRead);
+ STDMETHODIMP Write(void const *pv, ULONG cb, ULONG *pcbWritten);
+
+ // IStream methods:
+ STDMETHODIMP Seek(LARGE_INTEGER dlibMove, DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition);
+ STDMETHODIMP SetSize(ULARGE_INTEGER libNewSize);
+ STDMETHODIMP CopyTo(IStream *pstm, ULARGE_INTEGER cb, ULARGE_INTEGER *pcbRead, ULARGE_INTEGER *pcbWritten);
+ STDMETHODIMP Commit(DWORD grfCommitFlags);
+ STDMETHODIMP Revert();
+ STDMETHODIMP LockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType);
+ STDMETHODIMP UnlockRegion(ULARGE_INTEGER libOffset, ULARGE_INTEGER cb, DWORD dwLockType);
+ STDMETHODIMP Stat(STATSTG *pstatstg, DWORD grfStatFlag);
+ STDMETHODIMP Clone(IStream **ppIStream);
+
+ private:
+ BOOL Close();
+
+ private:
+ LONG _cRef;
+ HANDLE _hFile;
+
+};
+
+#endif
+
diff --git a/src/inc/fstring.h b/src/inc/fstring.h
new file mode 100644
index 0000000000..68c9098c8f
--- /dev/null
+++ b/src/inc/fstring.h
@@ -0,0 +1,42 @@
+// 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.
+// ---------------------------------------------------------------------------
+// FString.h (Fast String)
+//
+
+// ---------------------------------------------------------------------------
+
+// ------------------------------------------------------------------------------------------
+// FString is fast string handling namespace
+
+
+// 1) Simple
+// 2) No C++ exception
+// 3) Optimized for speed
+
+
+#ifndef _FSTRING_H_
+#define _FSTRING_H_
+
+namespace FString
+{
+ // Scan for ASCII only string, calculate result UTF8 string length
+ HRESULT Unicode_Utf8_Length(__in_z LPCWSTR pString, __out bool * pAllAscii, __out DWORD * pLength);
+
+ // Convert UNICODE string to UTF8 string. Direct/fast conversion if ASCII
+ HRESULT Unicode_Utf8(__in_z LPCWSTR pString, bool allAscii, __out_z LPSTR pBuffer, DWORD length);
+
+ // Scan for ASCII string, calculate result UNICODE string length
+ HRESULT Utf8_Unicode_Length(__in_z LPCSTR pString, __out bool * pAllAscii, __out DWORD * pLength);
+
+ // Convert UTF8 string to UNICODE. Direct/fast conversion if ASCII
+ HRESULT Utf8_Unicode(__in_z LPCSTR pString, bool allAscii, __out_z LPWSTR pBuffer, DWORD length);
+
+ HRESULT ConvertUnicode_Utf8(__in_z LPCWSTR pString, __out_z LPSTR * pBuffer);
+
+ HRESULT ConvertUtf8_Unicode(__in_z LPCSTR pString, __out_z LPWSTR * pBuffer);
+
+} // namespace FString
+
+#endif // _FSTRING_H_
diff --git a/src/inc/fusion.idl b/src/inc/fusion.idl
new file mode 100644
index 0000000000..e64909e845
--- /dev/null
+++ b/src/inc/fusion.idl
@@ -0,0 +1,530 @@
+// 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.
+
+//+---------------------------------------------------------------------------
+//
+// Microsoft Windows
+// File: fusion.idl
+//
+// Contents: Fusion Interfaces
+//
+// Classes:
+//
+// Functions:
+//
+//
+//----------------------------------------------------------------------------
+
+cpp_quote("")
+cpp_quote("#ifdef _MSC_VER")
+cpp_quote("#pragma comment(lib,\"uuid.lib\")")
+cpp_quote("#endif")
+cpp_quote("")
+cpp_quote("//---------------------------------------------------------------------------=")
+cpp_quote("// Fusion Interfaces.")
+cpp_quote("")
+
+import "objidl.idl";
+
+cpp_quote("#ifdef _MSC_VER")
+cpp_quote("#pragma once")
+cpp_quote("#endif")
+
+#if !defined(FEATURE_FUSION) && !defined(FEATURE_VERSIONING)
+cpp_quote("#if defined(_CLR_BLD) && !defined(FEATURE_FUSION)")
+cpp_quote("#error FEATURE_FUSION is not enabled, please do not include fusion.h")
+cpp_quote("#endif")
+#endif // !defined(FEATURE_FUSION) && !defined(FEATURE_VERSIONING)
+
+interface IAssemblyCache;
+interface IAssemblyCacheItem;
+interface IAssemblyName;
+interface IAssemblyEnum;
+
+#ifdef FEATURE_FUSION
+typedef enum
+{
+ ASM_CACHE_ZAP = 0x1,
+ ASM_CACHE_GAC = 0x2,
+ ASM_CACHE_DOWNLOAD = 0x4,
+ ASM_CACHE_ROOT = 0x8, //This is only meaningful on GetCachePath.
+ ASM_CACHE_ROOT_EX = 0x80 // Only valid when used with GetCachePath.
+} ASM_CACHE_FLAGS;
+#endif
+
+cpp_quote("#ifndef PEKIND_ENUM_DEFINED")
+cpp_quote("#define PEKIND_ENUM_DEFINED")
+// This must match the definition of pekind in peinformation.h
+typedef enum _tagPEKIND
+{
+ peNone = 0x00000000,
+ peMSIL = 0x00000001,
+ peI386 = 0x00000002,
+ peIA64 = 0x00000003,
+ peAMD64 = 0x00000004,
+ peARM = 0x00000005,
+ peARM64 = 0x00000006,
+ peInvalid = 0xffffffff
+} PEKIND;
+cpp_quote("#endif")
+
+typedef enum _tagAssemblyContentType
+{
+ AssemblyContentType_Default = 0x00000000,
+ AssemblyContentType_WindowsRuntime = 0x00000001,
+ AssemblyContentType_Invalid = 0xffffffff
+} AssemblyContentType;
+
+#ifdef FEATURE_FUSION
+///////////////////////////////////////////////////////////////////////////////
+//
+// IAssemblyCache
+//
+///////////////////////////////////////////////////////////////////////////////
+
+cpp_quote("// {E707DCDE-D1CD-11D2-BAB9-00C04F8ECEAE}")
+cpp_quote("EXTERN_GUID(IID_IAssemblyCache, 0xE707DCDE, 0xD1CD, 0x11D2, 0xBA, 0xB9, 0x00, 0xC0, 0x4F, 0x8E, 0xCE, 0xAE);")
+
+[
+ local,
+ object,
+ uuid(e707dcde-d1cd-11d2-bab9-00c04f8eceae),
+ pointer_default(unique)
+]
+interface IAssemblyCache : IUnknown
+{
+ cpp_quote("// {8cedc215-ac4b-488b-93c0-a50a49cb2fb8}")
+ cpp_quote("EXTERN_GUID(FUSION_REFCOUNT_UNINSTALL_SUBKEY_GUID, 0x8cedc215, 0xac4b, 0x488b, 0x93, 0xc0, 0xa5, 0x0a, 0x49, 0xcb, 0x2f, 0xb8);")
+ cpp_quote("")
+ cpp_quote("// {b02f9d65-fb77-4f7a-afa5-b391309f11c9}")
+ cpp_quote("EXTERN_GUID(FUSION_REFCOUNT_FILEPATH_GUID, 0xb02f9d65, 0xfb77, 0x4f7a, 0xaf, 0xa5, 0xb3, 0x91, 0x30, 0x9f, 0x11, 0xc9);")
+ cpp_quote("")
+ cpp_quote("// {2ec93463-b0c3-45e1-8364-327e96aea856}")
+ cpp_quote("EXTERN_GUID(FUSION_REFCOUNT_OPAQUE_STRING_GUID, 0x2ec93463, 0xb0c3, 0x45e1, 0x83, 0x64, 0x32, 0x7e, 0x96, 0xae, 0xa8, 0x56);")
+
+ cpp_quote(" // {25df0fc1-7f97-4070-add7-4b13bbfd7cb8} // this GUID cannot be used for installing into GAC.")
+ cpp_quote("EXTERN_GUID(FUSION_REFCOUNT_MSI_GUID, 0x25df0fc1, 0x7f97, 0x4070, 0xad, 0xd7, 0x4b, 0x13, 0xbb, 0xfd, 0x7c, 0xb8); ")
+
+ cpp_quote(" // {d16d444c-56d8-11d5-882d-0080c847b195}")
+ cpp_quote("EXTERN_GUID(FUSION_REFCOUNT_OSINSTALL_GUID, 0xd16d444c, 0x56d8, 0x11d5, 0x88, 0x2d, 0x00, 0x80, 0xc8, 0x47, 0xb1, 0x95); ")
+
+ typedef struct _FUSION_INSTALL_REFERENCE_
+ {
+ DWORD cbSize;
+ DWORD dwFlags;
+ GUID guidScheme; // contains one of the pre-defined guids.
+ LPCWSTR szIdentifier; // unique identifier for app installing this assembly.
+ LPCWSTR szNonCannonicalData; // data is description; relevent to the guid above
+ } FUSION_INSTALL_REFERENCE, *LPFUSION_INSTALL_REFERENCE;
+
+ typedef const FUSION_INSTALL_REFERENCE *LPCFUSION_INSTALL_REFERENCE;
+
+
+ typedef struct _ASSEMBLY_INFO
+ {
+ ULONG cbAssemblyInfo; // size of this structure for future expansion
+ DWORD dwAssemblyFlags;
+ ULARGE_INTEGER uliAssemblySizeInKB;
+ LPWSTR pszCurrentAssemblyPathBuf;
+ ULONG cchBuf; // size of path buf.
+ } ASSEMBLY_INFO;
+
+ cpp_quote("#define IASSEMBLYCACHE_INSTALL_FLAG_REFRESH (0x00000001)")
+ cpp_quote("#define IASSEMBLYCACHE_INSTALL_FLAG_FORCE_REFRESH (0x00000002)")
+
+ cpp_quote("#define IASSEMBLYCACHE_UNINSTALL_DISPOSITION_UNINSTALLED (1)")
+ cpp_quote("#define IASSEMBLYCACHE_UNINSTALL_DISPOSITION_STILL_IN_USE (2)")
+ cpp_quote("#define IASSEMBLYCACHE_UNINSTALL_DISPOSITION_ALREADY_UNINSTALLED (3)")
+ cpp_quote("#define IASSEMBLYCACHE_UNINSTALL_DISPOSITION_DELETE_PENDING (4)")
+ cpp_quote("#define IASSEMBLYCACHE_UNINSTALL_DISPOSITION_HAS_INSTALL_REFERENCES (5)")
+ cpp_quote("#define IASSEMBLYCACHE_UNINSTALL_DISPOSITION_REFERENCE_NOT_FOUND (6)")
+
+ cpp_quote("#define QUERYASMINFO_FLAG_VALIDATE (0x00000001)")
+ cpp_quote("#define QUERYASMINFO_FLAG_GETSIZE (0x00000002)")
+
+ // these flags are for dwAssemblyFlags field in struct _ASSEMBLY_INFO
+ cpp_quote("#define ASSEMBLYINFO_FLAG_INSTALLED (0x00000001)")
+ cpp_quote("#define ASSEMBLYINFO_FLAG_PAYLOADRESIDENT (0x00000002)")
+
+ HRESULT UninstallAssembly(
+ [in] DWORD dwFlags,
+ [in] LPCWSTR pszAssemblyName,
+ [in] LPCFUSION_INSTALL_REFERENCE pRefData,
+ [out, optional] ULONG *pulDisposition
+ );
+
+ HRESULT QueryAssemblyInfo(
+ [in] DWORD dwFlags,
+ [in] LPCWSTR pszAssemblyName,
+ [in, out] ASSEMBLY_INFO *pAsmInfo
+ );
+
+ HRESULT CreateAssemblyCacheItem(
+ [in] DWORD dwFlags,
+ [in] PVOID pvReserved,
+ [out] IAssemblyCacheItem **ppAsmItem,
+ [in, optional] LPCWSTR pszAssemblyName // uncanonicalized, comma separted name=value pairs.
+ );
+
+ HRESULT CreateAssemblyScavenger
+ (
+ [out] IUnknown **ppUnkReserved
+ );
+
+ HRESULT InstallAssembly( // if you use this, fusion will do the streaming & commit.
+ [in] DWORD dwFlags,
+ [in] LPCWSTR pszManifestFilePath,
+ [in] LPCFUSION_INSTALL_REFERENCE pRefData
+ );
+
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// IAssemblyCacheItem
+//
+///////////////////////////////////////////////////////////////////////////////
+
+cpp_quote("// {9e3aaeb4-d1cd-11d2-bab9-00c04f8eceae}")
+cpp_quote("EXTERN_GUID(IID_IAssemblyCacheItem, 0x9e3aaeb4,0xd1cd,0x11d2,0xba,0xb9,0x00,0xc0,0x4f,0x8e,0xce,0xae);")
+
+[
+ local,
+ object,
+ uuid(9e3aaeb4-d1cd-11d2-bab9-00c04f8eceae),
+ pointer_default(unique)
+]
+interface IAssemblyCacheItem : IUnknown
+{
+ cpp_quote("#define STREAM_FORMAT_COMPLIB_MODULE 0")
+ cpp_quote("#define STREAM_FORMAT_COMPLIB_MANIFEST 1")
+ cpp_quote("#define STREAM_FORMAT_WIN32_MODULE 2")
+ cpp_quote("#define STREAM_FORMAT_WIN32_MANIFEST 4")
+
+ cpp_quote("#define IASSEMBLYCACHEITEM_COMMIT_FLAG_REFRESH (0x00000001)")
+ cpp_quote("#define IASSEMBLYCACHEITEM_COMMIT_FLAG_FORCE_REFRESH (0x00000002)")
+
+ cpp_quote("#define IASSEMBLYCACHEITEM_COMMIT_DISPOSITION_INSTALLED (1)") // first time install
+ cpp_quote("#define IASSEMBLYCACHEITEM_COMMIT_DISPOSITION_REFRESHED (2)") // overwrite, if existing
+ cpp_quote("#define IASSEMBLYCACHEITEM_COMMIT_DISPOSITION_ALREADY_INSTALLED (3)") // existing,
+
+
+ HRESULT CreateStream(
+ [in] DWORD dwFlags, // For general API flags
+ [in] LPCWSTR pszStreamName, // Name of the stream to be passed in
+ [in] DWORD dwFormat, // format of the file to be streamed in.
+ [in] DWORD dwFormatFlags, // format-specific flags
+ [out] IStream **ppIStream,
+ [in, optional] ULARGE_INTEGER *puliMaxSize // Max size of the Stream.
+ );
+
+ HRESULT Commit
+ (
+ [in] DWORD dwFlags, // For general API flags like IASSEMBLYCACHEITEM _COMMIT_FLAG_REFRESH
+ [out, optional] ULONG *pulDisposition
+ );
+
+ HRESULT AbortItem(); // If you have created IAssemblyCacheItem and don't plan to use it, its good idea to call AbortItem before releasing it.
+
+}
+#endif // FEATURE_FUSION
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// IAssemblyName
+//
+///////////////////////////////////////////////////////////////////////////////
+
+cpp_quote("// {CD193BC0-B4BC-11d2-9833-00C04FC31D2E}")
+cpp_quote("EXTERN_GUID(IID_IAssemblyName, 0xCD193BC0, 0xB4BC, 0x11d2, 0x98, 0x33, 0x00, 0xC0, 0x4F, 0xC3, 0x1D, 0x2E);")
+
+
+[
+ local,
+ object,
+ uuid(CD193BC0-B4BC-11d2-9833-00C04FC31D2E),
+ pointer_default(unique)
+]
+interface IAssemblyName: IUnknown
+{
+ typedef [unique] IAssemblyName *LPASSEMBLYNAME;
+
+ typedef enum {
+ CANOF_PARSE_DISPLAY_NAME = 0x1,
+ CANOF_SET_DEFAULT_VALUES = 0x2,
+ CANOF_VERIFY_FRIEND_ASSEMBLYNAME = 0x4,
+ CANOF_PARSE_FRIEND_DISPLAY_NAME = CANOF_PARSE_DISPLAY_NAME | CANOF_VERIFY_FRIEND_ASSEMBLYNAME
+ } CREATE_ASM_NAME_OBJ_FLAGS;
+
+ typedef enum
+ {
+ ASM_NAME_PUBLIC_KEY = 0, // 0
+ ASM_NAME_PUBLIC_KEY_TOKEN, // 1
+ ASM_NAME_HASH_VALUE, // 2
+ ASM_NAME_NAME, // 3
+ ASM_NAME_MAJOR_VERSION, // 4
+ ASM_NAME_MINOR_VERSION, // 5
+ ASM_NAME_BUILD_NUMBER, // 6
+ ASM_NAME_REVISION_NUMBER, // 7
+ ASM_NAME_CULTURE, // 8
+ ASM_NAME_PROCESSOR_ID_ARRAY, // 9
+ ASM_NAME_OSINFO_ARRAY, // 10 ... 0x0a
+ ASM_NAME_HASH_ALGID, // 11 ... 0x0b
+ ASM_NAME_ALIAS, // 12 ... 0x0c
+ ASM_NAME_CODEBASE_URL, // 13 ... 0x0d
+ ASM_NAME_CODEBASE_LASTMOD, // 14 ... 0x0e
+ ASM_NAME_NULL_PUBLIC_KEY, // 15 ... 0x0f
+ ASM_NAME_NULL_PUBLIC_KEY_TOKEN, // 16 ... 0x10
+ ASM_NAME_CUSTOM, // 17 ... 0x11
+ ASM_NAME_NULL_CUSTOM, // 18 ... 0x12
+ ASM_NAME_MVID, // 19 ... 0x13
+ ASM_NAME_FILE_MAJOR_VERSION, // 20 ... 0x14
+ ASM_NAME_FILE_MINOR_VERSION, // 21 ... 0x15
+ ASM_NAME_FILE_BUILD_NUMBER, // 22 ... 0x16
+ ASM_NAME_FILE_REVISION_NUMBER, // 23 ... 0x17
+ ASM_NAME_RETARGET, // 24 ... 0x18
+ ASM_NAME_SIGNATURE_BLOB, // 25 ... 0x19
+ ASM_NAME_CONFIG_MASK, // 26 ... 0x1a
+ ASM_NAME_ARCHITECTURE, // 27 ... 0x1b
+ ASM_NAME_CONTENT_TYPE, // 28 ... 0x1c
+ ASM_NAME_MAX_PARAMS // 29 ... 0x1d
+ } ASM_NAME;
+
+ typedef enum
+ {
+ ASM_DISPLAYF_VERSION = 0x1,
+ ASM_DISPLAYF_CULTURE = 0x2,
+ ASM_DISPLAYF_PUBLIC_KEY_TOKEN = 0x4,
+ ASM_DISPLAYF_PUBLIC_KEY = 0x8,
+ ASM_DISPLAYF_CUSTOM = 0x10,
+ ASM_DISPLAYF_PROCESSORARCHITECTURE = 0x20,
+ ASM_DISPLAYF_LANGUAGEID = 0x40,
+ ASM_DISPLAYF_RETARGET = 0x80,
+ ASM_DISPLAYF_CONFIG_MASK = 0x100,
+ ASM_DISPLAYF_MVID = 0x200,
+ ASM_DISPLAYF_CONTENT_TYPE = 0x400,
+
+
+ // ASM_DISPLAYF_FULL shows the full identity of the assembly.
+ // It should be used when you are working with APIs taking
+ // assembly full identity, such as GAC APIs.
+ //
+ // WARNING!!! ASM_DISPLAYF_FULL will change in the future,
+ // when we introduce new attributes. This means the identity returned
+ // will change from CLR version to version. Don't ever assume
+ // the identity will not change. !!!
+ ASM_DISPLAYF_FULL = ASM_DISPLAYF_VERSION
+ | ASM_DISPLAYF_CULTURE
+ | ASM_DISPLAYF_PUBLIC_KEY_TOKEN
+ | ASM_DISPLAYF_RETARGET
+ | ASM_DISPLAYF_PROCESSORARCHITECTURE
+ | ASM_DISPLAYF_CONTENT_TYPE,
+ } ASM_DISPLAY_FLAGS;
+
+ typedef enum
+ {
+ ASM_CMPF_NAME = 0x1,
+
+ ASM_CMPF_MAJOR_VERSION = 0x2,
+ ASM_CMPF_MINOR_VERSION = 0x4,
+ ASM_CMPF_BUILD_NUMBER = 0x8,
+ ASM_CMPF_REVISION_NUMBER = 0x10,
+
+ ASM_CMPF_VERSION = ASM_CMPF_MAJOR_VERSION
+ |ASM_CMPF_MINOR_VERSION
+ |ASM_CMPF_BUILD_NUMBER
+ |ASM_CMPF_REVISION_NUMBER,
+
+ ASM_CMPF_PUBLIC_KEY_TOKEN = 0x20,
+ ASM_CMPF_CULTURE = 0x40,
+ ASM_CMPF_CUSTOM = 0x80,
+
+ ASM_CMPF_DEFAULT = 0x100,
+
+ ASM_CMPF_RETARGET = 0x200,
+ ASM_CMPF_ARCHITECTURE = 0x400,
+ ASM_CMPF_CONFIG_MASK = 0x800,
+ ASM_CMPF_MVID = 0x1000,
+ ASM_CMPF_SIGNATURE = 0x2000,
+ ASM_CMPF_CONTENT_TYPE = 0x4000,
+
+ ASM_CMPF_IL_ALL = ASM_CMPF_NAME
+ | ASM_CMPF_VERSION
+ | ASM_CMPF_PUBLIC_KEY_TOKEN
+ | ASM_CMPF_CULTURE,
+
+ ASM_CMPF_IL_NO_VERSION = ASM_CMPF_NAME
+ | ASM_CMPF_PUBLIC_KEY_TOKEN
+ | ASM_CMPF_CULTURE
+ } ASM_CMP_FLAGS;
+
+ HRESULT SetProperty(
+ [in] DWORD PropertyId,
+ [in] void const * pvProperty,
+ [in] DWORD cbProperty);
+
+ HRESULT GetProperty(
+ [in] DWORD PropertyId,
+ [out] LPVOID pvProperty,
+ [in, out] LPDWORD pcbProperty);
+
+ HRESULT Finalize();
+
+ HRESULT GetDisplayName(
+ [out, annotation("_Out_writes_opt_(*pccDisplayName)")]
+ LPOLESTR szDisplayName,
+ [in, out] LPDWORD pccDisplayName,
+ [in] DWORD dwDisplayFlags);
+
+ HRESULT Reserved(
+ [in] REFIID refIID,
+ [in] IUnknown *pUnkReserved1,
+ [in] IUnknown *pUnkReserved2,
+ [in] LPCOLESTR szReserved,
+ [in] LONGLONG llReserved,
+ [in] LPVOID pvReserved,
+ [in] DWORD cbReserved,
+ [out] LPVOID *ppReserved);
+
+
+ HRESULT GetName(
+ [in, out, annotation("_Inout_")] LPDWORD lpcwBuffer,
+ [out, annotation("_Out_writes_opt_(*lpcwBuffer)")] WCHAR *pwzName);
+
+ HRESULT GetVersion(
+ [out] LPDWORD pdwVersionHi,
+ [out] LPDWORD pdwVersionLow);
+
+ HRESULT IsEqual(
+ [in] IAssemblyName *pName,
+ [in] DWORD dwCmpFlags);
+
+ HRESULT Clone(
+ [out] IAssemblyName **pName);
+
+}
+
+#ifdef FEATURE_FUSION
+///////////////////////////////////////////////////////////////////////////////
+//
+// IAssemblyEnum
+//
+///////////////////////////////////////////////////////////////////////////////
+cpp_quote("// {21B8916C-F28E-11D2-A473-00C04F8EF448}")
+cpp_quote("EXTERN_GUID(IID_IAssemblyEnum, 0x21B8916C,0xF28E,0x11D2,0xA4,0x73,0x00,0xC0,0x4F,0x8E,0xF4,0x48);")
+
+[
+ local,
+ object,
+ uuid(21b8916c-f28e-11d2-a473-00c04f8ef448),
+ pointer_default(unique)
+]
+interface IAssemblyEnum : IUnknown
+{
+
+ HRESULT GetNextAssembly
+ (
+ [in] LPVOID pvReserved,
+ [out] IAssemblyName **ppName,
+ [in] DWORD dwFlags
+ );
+
+ HRESULT Reset(void);
+
+ HRESULT Clone
+ (
+ [out] IAssemblyEnum **ppEnum
+ );
+
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// IInstallReferenceItem
+//
+///////////////////////////////////////////////////////////////////////////////
+
+cpp_quote("// {582dac66-e678-449f-aba6-6faaec8a9394}")
+cpp_quote("EXTERN_GUID(IID_IInstallReferenceItem, 0x582dac66,0xe678,0x449f,0xab,0xa6,0x6f,0xaa,0xec,0x8a,0x93,0x94);")
+
+[
+ local,
+ object,
+ uuid(582dac66-e678-449f-aba6-6faaec8a9394),
+ pointer_default(unique)
+]
+interface IInstallReferenceItem : IUnknown
+{
+ HRESULT GetReference
+ (
+ [out] LPFUSION_INSTALL_REFERENCE *ppRefData,
+ [in] DWORD dwFlags,
+ [in] LPVOID pvReserved
+ );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// IInstallReferenceEnum
+//
+///////////////////////////////////////////////////////////////////////////////
+
+cpp_quote("// {56b1a988-7c0c-4aa2-8639-c3eb5a90226f}")
+cpp_quote("EXTERN_GUID(IID_IInstallReferenceEnum, 0x56b1a988,0x7c0c,0x4aa2,0x86,0x39,0xc3,0xeb,0x5a,0x90,0x22,0x6f);")
+
+[
+ local,
+ object,
+ uuid(56b1a988-7c0c-4aa2-8639-c3eb5a90226f),
+ pointer_default(unique)
+]
+interface IInstallReferenceEnum : IUnknown
+{
+ HRESULT GetNextInstallReferenceItem
+ (
+ [out] IInstallReferenceItem **ppRefItem,
+ [in] DWORD dwFlags,
+ [in] LPVOID pvReserved
+ );
+}
+
+typedef enum _tagAssemblyComparisonResult
+{
+ ACR_Unknown, // Unknown
+ ACR_EquivalentFullMatch, // all fields match
+ ACR_EquivalentWeakNamed, // match based on weak-name, version numbers ignored
+ ACR_EquivalentFXUnified, // match based on FX-unification of version numbers
+ ACR_EquivalentUnified, // match based on legacy-unification of version numbers
+ ACR_NonEquivalentVersion, // all fields match except version field
+ ACR_NonEquivalent, // no match
+
+ ACR_EquivalentPartialMatch,
+ ACR_EquivalentPartialWeakNamed,
+ ACR_EquivalentPartialUnified,
+ ACR_EquivalentPartialFXUnified,
+ ACR_NonEquivalentPartialVersion
+} AssemblyComparisonResult;
+
+
+#pragma midl_echo("STDAPI CreateAssemblyConfigCookie(LPCWSTR wzConfigFilePath, struct AssemblyConfig **ppAssemblyConfigOut);")
+#pragma midl_echo("STDAPI DestroyAssemblyConfigCookie(struct AssemblyConfig *pAssemblyConfig);")
+
+#pragma midl_echo("STDAPI CompareAssemblyIdentity(LPCWSTR pwzAssemblyIdentity1, BOOL fUnified1, LPCWSTR pwzAssemblyIdentity2, BOOL fUnified2, BOOL *pfEquivalent, AssemblyComparisonResult *pResult); ")
+#pragma midl_echo("STDAPI CompareAssemblyIdentityWithConfig(LPCWSTR pwzAssemblyIdentity1, BOOL fUnified1, LPCWSTR pwzAssemblyIdentity2, BOOL fUnified2, struct AssemblyConfig *pAssemblyConfig, BOOL *pfEquivalent, AssemblyComparisonResult *pResult); ")
+#pragma midl_echo("STDAPI CreateInstallReferenceEnum(IInstallReferenceEnum **ppRefEnum, IAssemblyName *pName, DWORD dwFlags, LPVOID pvReserved); ")
+#pragma midl_echo("STDAPI CreateAssemblyEnum(IAssemblyEnum **pEnum, IUnknown *pUnkReserved, IAssemblyName *pName, DWORD dwFlags, LPVOID pvReserved); ")
+#endif // FEATURE_FUSION
+
+#pragma midl_echo("STDAPI CreateAssemblyNameObject(LPASSEMBLYNAME *ppAssemblyNameObj, LPCWSTR szAssemblyName, DWORD dwFlags, LPVOID pvReserved); ")
+
+#ifdef FEATURE_FUSION
+#pragma midl_echo("STDAPI CreateAssemblyCache(IAssemblyCache **ppAsmCache, DWORD dwReserved); ")
+#pragma midl_echo("STDAPI GetCachePath(ASM_CACHE_FLAGS dwCacheFlags, _Out_writes_to_(*pcchPath,*pcchPath) LPWSTR pwzCachePath, PDWORD pcchPath); ")
+#pragma midl_echo("STDAPI GetAssemblyIdentityFromFile(LPCWSTR pwzFilePAth, REFIID riid, IUnknown **ppIdentity); ")
+#pragma midl_echo("STDAPI ClearDownloadCache();")
+#pragma midl_echo("typedef unsigned long MSIHANDLE;")
+#pragma midl_echo("STDAPI SetMSIHandleForLogging(MSIHANDLE hMSIHandle);")
+#endif // FEATURE_FUSION
diff --git a/src/inc/fusionbind.h b/src/inc/fusionbind.h
new file mode 100644
index 0000000000..8628d3f9ce
--- /dev/null
+++ b/src/inc/fusionbind.h
@@ -0,0 +1,316 @@
+// 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.
+
+
+
+/*============================================================
+**
+** Header: FusionBind.hpp
+**
+** Purpose: Implements FusionBind (loader domain) architecture
+**
+**
+===========================================================*/
+#ifndef _FUSIONBIND_H
+#define _FUSIONBIND_H
+
+#ifndef FEATURE_FUSION
+#error FEATURE_FUSION is not enabled, please do not include fusionbind.h
+#endif
+
+#include <fusion.h>
+#include <fusionpriv.h>
+#include "metadata.h"
+#include "fusionsink.h"
+#include "utilcode.h"
+#include "loaderheap.h"
+#include "fusionsetup.h"
+#include "sstring.h"
+#include "ex.h"
+#ifdef PAL_STDCPP_COMPAT
+#include <type_traits>
+#else
+#include "clr_std/type_traits"
+#endif
+
+#include "binderngen.h"
+#include "clrprivbinding.h"
+
+class FusionBind
+{
+public:
+
+ //****************************************************************************************
+ //
+
+ static HRESULT GetVersion(__out_ecount(*pdwVersion) LPWSTR pVersion, __inout DWORD* pdwVersion);
+
+
+ //****************************************************************************************
+ //
+ // Creates a fusion context for the application domain. All ApplicationContext properties
+ // must be set in the AppDomain store prior to this call. Any changes or additions to the
+ // AppDomain store are ignored.
+ static HRESULT CreateFusionContext(LPCWSTR pzName, IApplicationContext** ppFusionContext);
+
+
+ //****************************************************************************************
+ //
+ // Loads an environmental value into the fusion context
+ static HRESULT AddEnvironmentProperty(__in LPCWSTR variable,
+ __in LPCWSTR pProperty,
+ IApplicationContext* pFusionContext);
+
+ //****************************************************************************************
+ //
+ static HRESULT SetupFusionContext(LPCWSTR szAppBase,
+ LPCWSTR szPrivateBin,
+ IApplicationContext** ppFusionContext);
+
+ // Starts remote load of an assembly. The thread is parked on
+ // an event waiting for fusion to report success or failure.
+ static HRESULT RemoteLoad(IApplicationContext * pFusionContext,
+ FusionSink* pSink,
+ IAssemblyName *pName,
+ IAssembly *pParentAssembly,
+ LPCWSTR pCodeBase,
+ IAssembly** ppIAssembly,
+ IHostAssembly** ppIHostAssembly,
+ IBindResult** ppNativeFusionAssembly,
+ BOOL fForIntrospectionOnly,
+ BOOL fSuppressSecurityChecks);
+
+ static HRESULT RemoteLoadModule(IApplicationContext * pFusionContext,
+ IAssemblyModuleImport* pModule,
+ FusionSink *pSink,
+ IAssemblyModuleImport** pResult);
+
+ static BOOL VerifyBindingStringW(LPCWSTR pwStr) {
+ WRAPPER_NO_CONTRACT;
+ if (wcschr(pwStr, '\\') ||
+ wcschr(pwStr, '/') ||
+ wcschr(pwStr, ':'))
+ return FALSE;
+
+ return TRUE;
+ }
+
+ static HRESULT VerifyBindingString(LPCSTR pName) {
+ CONTRACTL
+ {
+ NOTHROW;
+ GC_NOTRIGGER;
+ INJECT_FAULT(return E_OUTOFMEMORY;);
+ }
+ CONTRACTL_END;
+
+ DWORD dwStrLen = WszMultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, pName, -1, NULL, NULL);
+ CQuickBytes qb;
+ LPWSTR pwStr = (LPWSTR) qb.AllocNoThrow(dwStrLen*sizeof(WCHAR));
+ if (!pwStr)
+ return E_OUTOFMEMORY;
+
+ if(!WszMultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, pName, -1, pwStr, dwStrLen))
+ return HRESULT_FROM_GetLastError();
+
+ if (VerifyBindingStringW(pwStr))
+ return S_OK;
+ else
+ return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND);
+ }
+
+ static void GetAssemblyManifestModulePath(IAssembly *pFusionAssembly, SString &result)
+ {
+ CONTRACTL
+ {
+ THROWS;
+ INJECT_FAULT(ThrowOutOfMemory());
+ }
+ CONTRACTL_END;
+
+ DWORD dwSize = 0;
+ LPWSTR buffer = NULL;
+ COUNT_T allocation = result.GetUnicodeAllocation();
+ if (allocation > 0) {
+ // pass in the buffer if we got one
+ dwSize = allocation + 1;
+ buffer = result.OpenUnicodeBuffer(allocation);
+ }
+ HRESULT hr = pFusionAssembly->GetManifestModulePath(buffer, &dwSize);
+ if (hr == HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER))
+ {
+ if (buffer != NULL)
+ result.CloseBuffer(0);
+ buffer = result.OpenUnicodeBuffer(dwSize-1);
+ hr = pFusionAssembly->GetManifestModulePath(buffer, &dwSize);
+ }
+ if (buffer != NULL)
+ result.CloseBuffer((SUCCEEDED(hr) && dwSize >= 1) ? (dwSize-1) : 0);
+ IfFailThrow(hr);
+ }
+
+ static SString& GetAssemblyNameDisplayName(
+ IAssemblyName *pName,
+ SString &result,
+ DWORD flags = 0 /* default */)
+ {
+ CONTRACTL
+ {
+ GC_NOTRIGGER;
+ THROWS;
+ INJECT_FAULT(ThrowOutOfMemory());
+ }
+ CONTRACTL_END;
+
+ DWORD dwSize = 0;
+ LPWSTR buffer = NULL;
+ COUNT_T allocation = result.GetUnicodeAllocation();
+ if (allocation > 0)
+ {
+ // pass in the buffer if we got one
+ dwSize = allocation + 1;
+ buffer = result.OpenUnicodeBuffer(allocation);
+ }
+
+ HRESULT hr = pName->GetDisplayName(buffer, &dwSize, flags);
+ if (hr == HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER))
+ {
+ if (buffer != NULL)
+ result.CloseBuffer(0);
+ buffer = result.OpenUnicodeBuffer(dwSize-1);
+ hr = pName->GetDisplayName(buffer, &dwSize, flags);
+ }
+
+ if (buffer != NULL)
+ {
+ result.CloseBuffer((SUCCEEDED(hr) && dwSize >= 1) ? (dwSize-1) : 0);
+ }
+
+ IfFailThrow(hr);
+ return result;
+ }
+
+ static BOOL GetAssemblyNameStringProperty(IAssemblyName *pName, DWORD property, SString &result)
+ {
+ CONTRACTL
+ {
+ THROWS;
+ INJECT_FAULT(ThrowOutOfMemory());
+ }
+ CONTRACTL_END;
+
+ DWORD dwSize = 0;
+ LPWSTR buffer = NULL;
+ COUNT_T allocation = result.GetUnicodeAllocation();
+ if (allocation > 0) {
+ // pass in the buffer if we got one
+ dwSize = (allocation + 1) * sizeof(WCHAR);
+ buffer = result.OpenUnicodeBuffer(allocation);
+ }
+ HRESULT hr = pName->GetProperty(property, (LPVOID)buffer, &dwSize);
+ if (hr == HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER))
+ {
+ if (buffer != NULL)
+ result.CloseBuffer(0);
+ buffer = result.OpenUnicodeBuffer(dwSize/sizeof(WCHAR) - 1);
+ hr = pName->GetProperty(property, (LPVOID)buffer, &dwSize);
+ }
+ if (buffer != NULL)
+ result.CloseBuffer((SUCCEEDED(hr) && dwSize >= sizeof(WCHAR)) ? (dwSize/sizeof(WCHAR)-1) : 0);
+ if (hr == HRESULT_FROM_WIN32(ERROR_NOT_FOUND))
+ {
+ return FALSE;
+ }
+ IfFailThrow(hr);
+
+ return TRUE;
+ }
+
+ static BOOL GetApplicationContextStringProperty(IApplicationContext *pContext,
+ LPCWSTR property, SString &result)
+ {
+ CONTRACTL
+ {
+ THROWS;
+ INJECT_FAULT(ThrowOutOfMemory());
+ }
+ CONTRACTL_END;
+
+ DWORD dwSize = 0;
+ LPWSTR buffer = NULL;
+ COUNT_T allocation = result.GetUnicodeAllocation();
+ if (allocation > 0) {
+ // pass in the buffer if we got one
+ dwSize = (allocation + 1) * sizeof(WCHAR);
+ buffer = result.OpenUnicodeBuffer(allocation);
+ }
+ HRESULT hr = pContext->Get(property, (LPVOID)buffer, &dwSize, 0);
+ if (hr == HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER))
+ {
+ if (buffer != NULL)
+ result.CloseBuffer(0);
+ buffer = result.OpenUnicodeBuffer(dwSize/sizeof(WCHAR) - 1);
+ hr = pContext->Get(property, (LPVOID)buffer, &dwSize, 0);
+ }
+ if (buffer != NULL)
+ result.CloseBuffer((SUCCEEDED(hr) && dwSize >= sizeof(WCHAR)) ? (dwSize/sizeof(WCHAR)-1) : 0);
+ if (hr == HRESULT_FROM_WIN32(ERROR_NOT_FOUND))
+ {
+ return FALSE;
+ }
+ IfFailThrow(hr);
+
+ return TRUE;
+ }
+
+ static BOOL GetApplicationContextDWORDProperty(IApplicationContext *pContext,
+ LPCWSTR property, DWORD *result)
+ {
+ CONTRACTL
+ {
+ THROWS;
+ INJECT_FAULT(return E_OUTOFMEMORY;);
+ }
+ CONTRACTL_END;
+
+ DWORD dwSize = sizeof(DWORD);
+ HRESULT hr = pContext->Get(property, result, &dwSize, 0);
+ if (hr == HRESULT_FROM_WIN32(ERROR_NOT_FOUND))
+ return FALSE;
+
+ IfFailThrow(hr);
+
+ return TRUE;
+ }
+
+ static void SetApplicationContextStringProperty(IApplicationContext *pContext, LPCWSTR property,
+ SString &value)
+ {
+ CONTRACTL
+ {
+ THROWS;
+ INJECT_FAULT(ThrowOutOfMemory());
+ }
+ CONTRACTL_END;
+
+ IfFailThrow(pContext->Set(property, (void *) value.GetUnicode(),
+ (value.GetCount()+1)*sizeof(WCHAR), 0));
+ }
+
+ static void SetApplicationContextDWORDProperty(IApplicationContext *pContext, LPCWSTR property,
+ DWORD value)
+ {
+ CONTRACTL
+ {
+ THROWS;
+ INJECT_FAULT(ThrowOutOfMemory());
+ }
+ CONTRACTL_END;
+
+ IfFailThrow(pContext->Set(property, &value, sizeof(value), 0));
+ }
+};
+
+#endif
+
diff --git a/src/inc/fusionpriv.idl b/src/inc/fusionpriv.idl
new file mode 100644
index 0000000000..f9aaefcd9c
--- /dev/null
+++ b/src/inc/fusionpriv.idl
@@ -0,0 +1,970 @@
+// 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.
+//+---------------------------------------------------------------------------
+//
+// Microsoft Windows
+// File: fusionpriv.idl
+//
+// Contents: Fusion Interfaces
+//
+// Classes:
+//
+// Functions:
+//
+//
+//----------------------------------------------------------------------------
+cpp_quote("//=--------------------------------------------------------------------------=")
+cpp_quote("// fusionpriv.h")
+cpp_quote("//=--------------------------------------------------------------------------=")
+cpp_quote("// Licensed to the .NET Foundation under one or more agreements.")
+cpp_quote("// The .NET Foundation licenses this file to you under the MIT license.")
+cpp_quote("// See the LICENSE file in the project root for more information.")
+cpp_quote("//=--------------------------------------------------------------------------=")
+cpp_quote("")
+cpp_quote("#ifdef _MSC_VER")
+cpp_quote("#pragma comment(lib,\"uuid.lib\")")
+cpp_quote("#endif")
+cpp_quote("")
+cpp_quote("//---------------------------------------------------------------------------=")
+cpp_quote("// Fusion Interfaces.")
+cpp_quote("")
+
+cpp_quote("#if defined(_CLR_BLD) && !defined(FEATURE_FUSION)")
+cpp_quote("#error FEATURE_FUSION is not enabled, please do not include fusionpriv.h")
+cpp_quote("#endif")
+
+
+import "objidl.idl";
+import "oleidl.idl";
+import "fusion.idl";
+
+#ifndef FEATURE_CORECLR
+import "binderngen.idl";
+#endif
+
+cpp_quote("#ifdef _MSC_VER")
+cpp_quote("#pragma once")
+cpp_quote("#endif")
+
+interface IAssembly;
+interface IAssemblyBindSink;
+interface IAssemblyBinding;
+interface IAssemblyManifestImport;
+interface IAssemblyModuleImport;
+interface IAssemblyBindingClosure;
+
+interface IAssemblyNameBinder;
+interface IHistoryAssembly;
+interface IHistoryReader;
+interface IFusionBindLog;
+
+interface IAssemblyScavenger;
+
+interface IHostAssembly;
+interface IHostAssemblyModuleImport;
+
+interface IMetaDataAssemblyImport;
+#pragma midl_echo("struct IMetaDataAssemblyImport;")
+
+struct AssemblyReferenceClosureWalkContextForProfAPI;
+
+cpp_quote("EXTERN_C const IID IID_IApplicationContext; ")
+cpp_quote("EXTERN_C const IID IID_IAssembly; ")
+cpp_quote("EXTERN_C const IID IID_IAssemblyBindSink; ")
+cpp_quote("EXTERN_C const IID IID_IAssemblyBinding; ")
+cpp_quote("EXTERN_C const IID IID_IAssemblyManifestImport;")
+cpp_quote("EXTERN_C const IID IID_IAssemblyModuleImport; ")
+
+cpp_quote("EXTERN_C const IID IID_IHistoryAssembly; ")
+cpp_quote("EXTERN_C const IID IID_IHistoryReader; ")
+cpp_quote("EXTERN_C const IID IID_IMetaDataAssemblyImportControl; ")
+
+cpp_quote("EXTERN_C const IID IID_IAssemblyScavenger; ")
+
+cpp_quote("EXTERN_C const IID IID_IHostAssembly; ")
+cpp_quote("EXTERN_C const IID IID_IHostAssemblyModuleImport; ")
+//
+// Bind flags for IAssemblyName::BindToObject
+//
+// External caller of IAssemblyName::BindToObject should only use ASM_BINDF_PARENT_ASM_HINT/ASM_BINDF_NONE/ASM_BINDF_INSPECTION_ONLY.
+// The rest is used internally by fusion. They can(and should) be set via IApplicationContext::Set.
+//
+typedef enum
+{
+ ASM_BINDF_NONE = 0x0,
+ ASM_BINDF_FORCE_CACHE_INSTALL = 0x1,
+ ASM_BINDF_RFS_INTEGRITY_CHECK = 0x2,
+ ASM_BINDF_RFS_MODULE_CHECK = 0x4,
+ ASM_BINDF_BINPATH_PROBE_ONLY = 0x8,
+ //ASM_BINDF_SHARED_BINPATH_HINT = 0x10,
+ ASM_BINDF_PARENT_ASM_HINT = 0x20,
+ ASM_BINDF_DISALLOW_APPLYPUBLISHERPOLICY = 0x40,
+ ASM_BINDF_DISALLOW_APPBINDINGREDIRECTS = 0x80,
+ ASM_BINDF_DISABLE_FX_UNIFICATION = 0x100,
+ ASM_BINDF_DO_NOT_PROBE_NATIVE_IMAGE = 0x200,
+ ASM_BINDF_DISABLE_DOWNLOAD = 0x400,
+ ASM_BINDF_INSPECTION_ONLY = 0x800,
+ ASM_BINDF_DISALLOW_APP_BASE_PROBING = 0x1000,
+ ASM_BINDF_SUPPRESS_SECURITY_CHECKS = 0x2000
+} ASM_BIND_FLAGS;
+
+typedef enum tagDEVOVERRIDEMODE {
+ DEVOVERRIDE_LOCAL = 0x1,
+ DEVOVERRIDE_GLOBAL = 0x2
+} DEVOVERRIDEMODE;
+
+typedef enum tagWALK_LEVEL
+{
+ LEVEL_STARTING, // only basic info
+ LEVEL_WINRTCHECK, // WinRT specific checks
+ LEVEL_GACCHECK, // until find something outside of the GAC
+ LEVEL_COMPLETE, // no reason to request higher than this
+ LEVEL_FXPREDICTED, // full walk, but FX assemblies were predicted
+ LEVEL_FXPROBED // full walk, but FX assemblies could not be predicted
+} WALK_LEVEL;
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// IHistoryAssembly
+//
+///////////////////////////////////////////////////////////////////////////////
+[
+ local,
+ object,
+ uuid(e6096a07-e188-4a49-8d50-2a0172a0d205),
+ pointer_default(unique)
+]
+interface IHistoryAssembly : IUnknown
+{
+ HRESULT GetAssemblyName
+ (
+ [out, annotation("__out")] LPWSTR wzAsmName,
+ [in, out, annotation("__inout")] DWORD *pdwSize
+ );
+
+ HRESULT GetPublicKeyToken
+ (
+ [out, annotation("__out")] LPWSTR wzPublicKeyToken,
+ [in, out, annotation("__inout")] DWORD *pdwSize
+ );
+
+ HRESULT GetCulture
+ (
+ [out, annotation("__out")] LPWSTR wzCulture,
+ [in, out, annotation("__inout")] DWORD *pdwSize
+ );
+
+ HRESULT GetReferenceVersion
+ (
+ [out, annotation("__out")] LPWSTR wzVerRef,
+ [in, out, annotation("__inout")] DWORD *pdwSize
+ );
+
+ HRESULT GetActivationDate
+ (
+ [out, annotation("__out")] LPWSTR wzActivationDate,
+ [in, out, annotation("__inout")] DWORD *pdwSize
+ );
+
+ HRESULT GetAppCfgVersion
+ (
+ [out, annotation("__out")] LPWSTR pwzVerAppCfg,
+ [in, out, annotation("__inout")] DWORD *pdwSize
+ );
+
+ HRESULT GetPublisherCfgVersion
+ (
+ [out, annotation("__out")] LPWSTR pwzVerPublisherCfg,
+ [in, out, annotation("__inout")] DWORD *pdwSize
+ );
+
+ HRESULT GetAdminCfgVersion
+ (
+ [out, annotation("__out")] LPWSTR pwzAdminCfg,
+ [in, out, annotation("__inout")] DWORD *pdwSize
+ );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// IHistoryReader
+//
+///////////////////////////////////////////////////////////////////////////////
+[
+ local,
+ object,
+ uuid(1d23df4d-a1e2-4b8b-93d6-6ea3dc285a54),
+ pointer_default(unique)
+]
+interface IHistoryReader : IUnknown
+{
+ HRESULT GetFilePath
+ (
+ [out, annotation("__out")] LPWSTR wzFilePath,
+ [in, out, annotation("__inout")] DWORD *pdwSize
+ );
+
+ HRESULT GetApplicationName
+ (
+ [out, annotation("__out")] LPWSTR wzAppName,
+ [in, out, annotation("__inout")] DWORD *pdwSize
+ );
+
+ HRESULT GetEXEModulePath
+ (
+ [out, annotation("__out")] LPWSTR wzExePath,
+ [in, out, annotation("__inout")] DWORD *pdwSize
+ );
+
+
+ HRESULT GetNumActivations
+ (
+ [out] DWORD *pdwNumActivations
+ );
+
+ HRESULT GetActivationDate
+ (
+ [in] DWORD dwIdx,
+ [out] FILETIME *pftDate
+ );
+
+ HRESULT GetRunTimeVersion
+ (
+ [in] FILETIME *pftActivationDate,
+ [out, annotation("__out")] LPWSTR wzRunTimeVersion,
+ [in, out, annotation("__inout")] DWORD *pdwSize
+ );
+
+ HRESULT GetNumAssemblies
+ (
+ [in] FILETIME *pftActivationDate,
+ [out] DWORD *pdwNumAsms
+ );
+
+ HRESULT GetHistoryAssembly
+ (
+ [in] FILETIME *pftActivationDate,
+ [in] DWORD dwIdx,
+ [out] IHistoryAssembly **ppHistAsm
+ );
+}
+
+typedef enum {
+ LOADCTX_TYPE_DEFAULT,
+ LOADCTX_TYPE_LOADFROM,
+ LOADCTX_TYPE_UNKNOWN,
+ LOADCTX_TYPE_HOSTED, // Assembly bind was provided by hosted binder.
+} LOADCTX_TYPE;
+
+// Log for normal assembly binding
+cpp_quote("#define FUSION_BIND_LOG_CATEGORY_DEFAULT 0")
+// Log for native image binding
+cpp_quote("#define FUSION_BIND_LOG_CATEGORY_NGEN 1")
+// max entry for bind log kinds. Should always point to the biggest one
+cpp_quote("#define FUSION_BIND_LOG_CATEGORY_MAX 2")
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// IFusionBindLog
+//
+///////////////////////////////////////////////////////////////////////////////
+
+[
+ local,
+ object,
+ uuid(67E9F87D-8B8A-4a90-9D3E-85ED5B2DCC83),
+ pointer_default(unique)
+]
+interface IFusionBindLog : IUnknown
+{
+ HRESULT SetResultCode
+ (
+ [in] DWORD dwLogCategory,
+ [in] HRESULT hr
+ );
+
+ HRESULT GetResultCode
+ (
+ [in] DWORD dwLogCategory,
+ [out] HRESULT *pHr
+ );
+
+ HRESULT GetBindLog
+ (
+ [in] DWORD dwDetailLevel,
+ [in] DWORD dwLogCategory,
+ [out, annotation("__out_opt")] LPWSTR pwzDebugLog,
+ [in, out, annotation("__inout")] DWORD *pcbDebugLog
+ );
+
+ HRESULT LogMessage
+ (
+ [in] DWORD dwDetailLevel,
+ [in] DWORD dwLogCategory,
+ [in] LPCWSTR pwzDebugLog
+ );
+
+ HRESULT Flush
+ (
+ [in] DWORD dwDetailLevel,
+ [in] DWORD dwLogCategory
+ );
+
+ HRESULT GetBindingID
+ (
+ [out] ULONGLONG *pullBindingID
+ );
+
+ HRESULT ETWTraceLogMessage
+ (
+ [in] DWORD dwETWLogCategory,
+ [in] IAssemblyName *pAsm
+ );
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// IAssemblyManifestImport
+//
+///////////////////////////////////////////////////////////////////////////////
+[
+ local,
+ object,
+ uuid( de9a68ba-0fa2-11d3-94aa-00c04fc308ff),
+ pointer_default(unique)
+]
+interface IAssemblyManifestImport: IUnknown
+{
+ typedef [unique] IAssemblyManifestImport *LPASSEMBLY_MANIFEST_IMPORT;
+
+ HRESULT GetAssemblyNameDef(
+ [out] IAssemblyName **ppAssemblyName);
+
+ HRESULT GetNextAssemblyNameRef(
+ [in] DWORD nIndex,
+ [out] IAssemblyName ** ppAssemblyName);
+
+ HRESULT GetNextAssemblyModule(
+ [in] DWORD nIndex,
+ [out] IAssemblyModuleImport **ppImport);
+
+ HRESULT GetModuleByName(
+ [in] LPCOLESTR szModuleName,
+ [out] IAssemblyModuleImport **ppModImport);
+
+ HRESULT GetManifestModulePath(
+ [out, size_is(*pccModulePath), annotation("__out_ecount_full(*pccModulePath)")] LPOLESTR szModulePath,
+ [in, out] LPDWORD pccModulePath);
+
+ HRESULT GetInternalMDImport(
+ [out] IMetaDataAssemblyImport **ppMDImport);
+
+ HRESULT LoadDataFromMDImport(
+ [in] IMetaDataAssemblyImport *ppMDImport);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// IApplicationContext
+//
+///////////////////////////////////////////////////////////////////////////////
+[
+ local,
+ object,
+ uuid(7c23ff90-33af-11d3-95da-00a024a85b51),
+ pointer_default(unique)
+]
+interface IApplicationContext: IUnknown
+{
+ cpp_quote("// App context configuration variables")
+ cpp_quote("#define ACTAG_APP_BASE_URL L\"APPBASE\"")
+ cpp_quote("#define ACTAG_MACHINE_CONFIG L\"MACHINE_CONFIG\"")
+ cpp_quote("#define ACTAG_APP_PRIVATE_BINPATH L\"PRIVATE_BINPATH\"")
+ cpp_quote("#define ACTAG_APP_SHARED_BINPATH L\"SHARED_BINPATH\"")
+ cpp_quote("#define ACTAG_APP_SNAPSHOT_ID L\"SNAPSHOT_ID\"")
+ cpp_quote("#define ACTAG_APP_CONFIG_FILE L\"APP_CONFIG_FILE\"")
+ cpp_quote("#define ACTAG_APP_ID L\"APPLICATION_ID\"")
+ cpp_quote("#define ACTAG_APP_SHADOW_COPY_DIRS L\"SHADOW_COPY_DIRS\"")
+ cpp_quote("#define ACTAG_APP_DYNAMIC_BASE L\"DYNAMIC_BASE\"")
+ cpp_quote("#define ACTAG_APP_CACHE_BASE L\"CACHE_BASE\"")
+ cpp_quote("#define ACTAG_APP_NAME L\"APP_NAME\"")
+ cpp_quote("#define ACTAG_DEV_PATH L\"DEV_PATH\"")
+ cpp_quote("#define ACTAG_HOST_CONFIG_FILE L\"HOST_CONFIG\"")
+ cpp_quote("#define ACTAG_SXS_ACTIVATION_CONTEXT L\"SXS\"")
+ cpp_quote("#define ACTAG_APP_CFG_LOCAL_FILEPATH L\"APP_CFG_LOCAL_FILEPATH\"")
+ cpp_quote("#define ACTAG_ZAP_STRING L\"ZAP_STRING\"")
+ cpp_quote("#define ACTAG_ZAP_CONFIG_FLAGS L\"ZAP_CONFIG_FLAGS\"")
+ cpp_quote("#define ACTAG_APP_DOMAIN_ID L\"APPDOMAIN_ID\"")
+ cpp_quote("#define ACTAG_APP_CONFIG_BLOB L\"APP_CONFIG_BLOB\"")
+ cpp_quote("#define ACTAG_FX_ONLY L\"FX_ONLY\"")
+
+ cpp_quote("// App context flag overrides")
+ cpp_quote("#define ACTAG_FORCE_CACHE_INSTALL L\"FORCE_CACHE_INSTALL\"")
+ cpp_quote("#define ACTAG_RFS_INTEGRITY_CHECK L\"RFS_INTEGRITY_CHECK\"")
+ cpp_quote("#define ACTAG_RFS_MODULE_CHECK L\"RFS_MODULE_CHECK\"")
+ cpp_quote("#define ACTAG_BINPATH_PROBE_ONLY L\"BINPATH_PROBE_ONLY\"")
+ cpp_quote("#define ACTAG_DISALLOW_APPLYPUBLISHERPOLICY L\"DISALLOW_APP\"")
+ cpp_quote("#define ACTAG_DISALLOW_APP_BINDING_REDIRECTS L\"DISALLOW_APP_REDIRECTS\"")
+ cpp_quote("#define ACTAG_DISALLOW_APP_BASE_PROBING L\"DISALLOW_APP_BASE_PROBING\"")
+ cpp_quote("#define ACTAG_CODE_DOWNLOAD_DISABLED L\"CODE_DOWNLOAD_DISABLED\"")
+ cpp_quote("#define ACTAG_DISABLE_FX_ASM_UNIFICATION L\"DISABLE_FX_ASM_UNIFICATION\"")
+
+ typedef [unique] IApplicationContext *LPAPPLICATIONCONTEXT;
+
+ typedef enum
+ {
+ APP_CTX_FLAGS_INTERFACE = 0x1
+ } APP_FLAGS;
+
+ HRESULT SetContextNameObject(
+ [in] LPASSEMBLYNAME pName);
+
+ HRESULT GetContextNameObject(
+ [out] LPASSEMBLYNAME * ppName);
+
+
+ HRESULT Set(
+ [in] LPCOLESTR szName,
+ [in] LPVOID pvValue,
+ [in] DWORD cbValue,
+ [in] DWORD dwFlags);
+
+ HRESULT Get(
+ [in] LPCOLESTR szName,
+ [out] LPVOID pvValue,
+ [in, out] LPDWORD pcbValue,
+ [in] DWORD dwFlags);
+
+ HRESULT GetDynamicDirectory(
+ [out, annotation("__out_ecount_opt(*pdwSize)")] LPWSTR wzDynamicDir,
+ [in, out] LPDWORD pdwSize);
+
+ HRESULT GetAppCacheDirectory(
+ [out, annotation("__out_ecount_opt(*pdwSize)")] LPWSTR wzAppCacheDir,
+ [in, out] LPDWORD pdwSize);
+
+ HRESULT RegisterKnownAssembly(
+ [in] IAssemblyName *pName,
+ [in] LPCWSTR pwzAsmURL,
+ [out] IAssembly **ppAsmOut);
+
+ HRESULT PrefetchAppConfigFile();
+
+ // This will give a IAssemblyBindingClosure object without really walking
+ // the closure. Any of the APIs on IAssemblyBindingClosure may trigger a
+ // real walking.
+ //
+ // This closure is not cached in fusion. Caller is responsible to cache the closure.
+ //
+ // pUnk is the result of a previous bind within the same application context.
+ // It could be IHostAssembly or IAssembly. The assembly has to be strongly named.
+ //
+ // dwSharingFlags cannot be 0 now.
+ HRESULT GetAssemblyBindingClosure(
+ [in] IUnknown *pUnk,
+ [in] LPCWSTR pwzNativeImagePath,
+ [out] IAssemblyBindingClosure **ppAsmClosure
+ );
+}
+
+[
+ local,
+ object,
+ uuid(56972d9d-0f6c-47de-a038-e82d5de3a777),
+ pointer_default(unique)
+]
+interface IAssemblyNameBinder : IUnknown
+{
+ HRESULT BindToObject(
+ [in] REFIID refIID,
+ [in] IUnknown *pUnkSink,
+ [in] IUnknown *pUnkContext,
+ [in] LPCOLESTR szCodeBase,
+ [in] LONGLONG llFlags,
+ [in] LPVOID pParentAssembly,
+ [in] DWORD cbReserved,
+ [out] LPVOID *ppv,
+ [out] LPVOID *ppvNI);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// IAssembly
+//
+///////////////////////////////////////////////////////////////////////////////
+[
+ local,
+ object,
+ uuid(ff08d7d4-04c2-11d3-94aa-00c04fc308ff),
+ pointer_default(unique)
+]
+interface IAssembly : IUnknown
+{
+ typedef [unique] IAssembly *LPASSEMBLY;
+
+ cpp_quote("#define ASMLOC_LOCATION_MASK 0x0000001B")
+ cpp_quote("#define ASMLOC_UNKNOWN 0x00000000")
+ cpp_quote("#define ASMLOC_GAC 0x00000001")
+ cpp_quote("#define ASMLOC_DOWNLOAD_CACHE 0x00000002")
+ cpp_quote("#define ASMLOC_RUN_FROM_SOURCE 0x00000003")
+ cpp_quote("#define ASMLOC_CODEBASE_HINT 0x00000004")
+ cpp_quote("#define ASMLOC_ZAP 0x00000008")
+ cpp_quote("#define ASMLOC_DEV_OVERRIDE 0x00000010")
+
+ HRESULT GetAssemblyNameDef(
+ [out] IAssemblyName **ppAssemblyName);
+
+ HRESULT GetNextAssemblyNameRef(
+ [in] DWORD nIndex,
+ [out] IAssemblyName **ppAssemblyName);
+
+ HRESULT GetNextAssemblyModule(
+ [in] DWORD nIndex,
+ [out] IAssemblyModuleImport **ppModImport);
+
+ HRESULT GetModuleByName(
+ [in] LPCOLESTR szModuleName,
+ [out] IAssemblyModuleImport **ppModImport);
+
+ HRESULT GetManifestModulePath(
+ [out, size_is(*pccModulePath), annotation("__out_ecount_full_opt(*pccModulePath)")] LPOLESTR szModulePath,
+ [in, out] LPDWORD pccModulePath);
+
+ HRESULT GetAssemblyPath(
+ [out, size_is(*lpcwBuffer), annotation("__out_ecount_full_opt(*lpcwBuffer)")] LPOLESTR pStr,
+ [in, out] LPDWORD lpcwBuffer);
+
+ HRESULT GetAssemblyLocation(
+ [out] DWORD *pdwAsmLocation);
+
+ LOADCTX_TYPE GetFusionLoadContext();
+
+ HRESULT GetNextHardBoundDependency(
+ [in] DWORD dwIndex,
+ [out] IAssembly **ppILAsm,
+ [out] IAssembly **ppNIAsm);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// IAssemblyBindingClosureEnumerator
+//
+///////////////////////////////////////////////////////////////////////////////
+[
+ local,
+ object,
+ uuid(b3f1e4ed-cb09-4b85-9a1b-6809582f1ebc),
+ pointer_default(unique)
+]
+interface IAssemblyBindingClosureEnumerator : IUnknown
+{
+ // Get the next assembly in the closure's path
+ HRESULT GetNextAssemblyPath(
+ [out] LPCOLESTR *ppPath,
+ [out] LPCOLESTR *ppniPath);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// IAssemblyBindingClosure
+//
+///////////////////////////////////////////////////////////////////////////////
+[
+ local,
+ object,
+ uuid(415c226a-e513-41ba-9651-9c48e97aa5de),
+ pointer_default(unique)
+]
+interface IAssemblyBindingClosure : IUnknown
+{
+ // Test if all the assemblies in the closure are in GAC.
+ // return:
+ // S_OK all assemblies are in GAC.
+ // S_FALSE not all assemblies are in GAC.
+ // otherwise failure.
+ HRESULT IsAllAssembliesInGAC();
+
+ // Test to see if two closures are semantically the same
+ // under the specified sharing context.
+ // return:
+ // S_OK Equal.
+ // S_FALSE Not Equal.
+ // otherwise failure.
+ HRESULT IsEqual(
+ [in] IAssemblyBindingClosure *pAssemblyClosure
+ );
+
+ HRESULT GetNextFailureAssembly(
+ [in] DWORD dwIndex,
+ [out] IAssemblyName **ppName,
+ [out] HRESULT *pHResult);
+
+ // ensure enough data is available
+ HRESULT EnsureWalked(
+ [in] IUnknown *pStartingAssembly,
+ [in] IApplicationContext *pAppCtx,
+ [in] WALK_LEVEL level);
+
+ // Iterate over assembly paths in the closure
+ HRESULT EnumerateAssemblies(
+ [out] IAssemblyBindingClosureEnumerator **ppEnumerator);
+
+ HRESULT HasBeenWalked([in] WALK_LEVEL level);
+
+ // Test if the assembly might have unknonwn dependecies because of WinRT
+ // return:
+ // S_OK May.
+ // S_FALSE No, all dependecies are traceable or FX.
+ // otherwise failure.
+ HRESULT MayHaveUnknownDependencies();
+
+
+ // The closure walker asks the profiler (when present) for any additional
+ // assembly references the profiler wishes to add. This method is then called
+ // back by the profiler for each such assembly reference.
+ HRESULT AddProfilerAssemblyReference(
+ [in] LPVOID pbPublicKeyOrToken,
+ [in] ULONG cbPublicKeyOrToken,
+ [in] LPCWSTR szName,
+ [in] LPVOID pMetaData,
+ [in] void *pbHashValue,
+ [in] ULONG cbHashValue,
+ [in] DWORD dwAssemblyRefFlags,
+ [in] struct AssemblyReferenceClosureWalkContextForProfAPI * pContext);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// IAssemblyBindSink
+//
+///////////////////////////////////////////////////////////////////////////////
+[
+ local,
+ object,
+ uuid(af0bc960-0b9a-11d3-95ca-00a024a85b51),
+ pointer_default(unique)
+]
+interface IAssemblyBindSink : IUnknown
+{
+ typedef [unique] IAssemblyBindSink *LPASSEMBLY_BIND_SINK;
+
+ typedef struct _tagFusionBindInfo
+ {
+ IFusionBindLog *pdbglog;
+ IAssemblyName *pNamePolicy;
+ DWORD dwPoliciesApplied;
+ } FusionBindInfo;
+
+ typedef enum
+ {
+ ASM_NOTIFICATION_START,
+ ASM_NOTIFICATION_PROGRESS,
+ ASM_NOTIFICATION_SUSPEND,
+ ASM_NOTIFICATION_ATTEMPT_NEXT_CODEBASE,
+ ASM_NOTIFICATION_BIND_INFO,
+ ASM_NOTIFICATION_DONE,
+ ASM_NOTIFICATION_NATIVE_IMAGE_DONE
+ } ASM_NOTIFICATION;
+
+
+ HRESULT OnProgress(
+ [in] DWORD dwNotification,
+ [in] HRESULT hrNotification,
+ [in] LPCWSTR szNotification,
+ [in] DWORD dwProgress,
+ [in] DWORD dwProgressMax,
+ [in] LPVOID pvBindInfo,
+ [in] IUnknown *pUnk);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// IAssemblyBinding
+//
+///////////////////////////////////////////////////////////////////////////////
+[
+ local,
+ object,
+ uuid(cfe52a80-12bd-11d3-95ca-00a024a85b51),
+ pointer_default(unique)
+]
+interface IAssemblyBinding : IUnknown
+{
+ typedef [unique] IAssemblyBinding *LPASSEMBLY_BINDINDING;
+
+ HRESULT Control(
+ [in] HRESULT hrControl);
+
+ HRESULT DoDefaultUI(
+ [in] HWND hWnd,
+ [in] DWORD dwFlags);
+}
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// IAssemblyModuleImport
+//
+///////////////////////////////////////////////////////////////////////////////
+[
+ local,
+ object,
+ uuid(da0cd4b0-1117-11d3-95ca-00a024a85b51),
+ pointer_default(unique)
+]
+interface IAssemblyModuleImport : IStream
+{
+ typedef [unique] IAssemblyModuleImport *LPASSEMBLY_MODULE_IMPORT;
+
+ HRESULT GetModuleName(
+ [out, size_is(*pccModuleName), annotation("__out_ecount_full_opt(*pccModuleName)")] LPOLESTR szModuleName,
+ [in, out] LPDWORD pccModuleName);
+
+ HRESULT GetHashAlgId(
+ [out] LPDWORD pdwHashAlgId);
+
+ HRESULT GetHashValue(
+ [out, size_is(*pcbHashValue)] BYTE *pbHashValue,
+ [in, out] LPDWORD pcbHashValue);
+
+ HRESULT GetFlags(
+ [out] LPDWORD pdwFlags);
+
+ HRESULT GetModulePath(
+ [out, size_is(*pccModulePath), annotation("__out_ecount_full_opt(*pccModulePath)")] LPOLESTR szModulePath,
+ [in, out] LPDWORD pccModulePath);
+
+ BOOL IsAvailable();
+
+ HRESULT BindToObject(
+ [in] IAssemblyBindSink *pBindSink,
+ [in] IApplicationContext *pAppCtx,
+ [in] LONGLONG llFlags,
+ [out] LPVOID *ppv);
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+//
+// IAssemblyScavenger
+//
+///////////////////////////////////////////////////////////////////////////////
+[
+ local,
+ object,
+ uuid(21b8916c-f28e-11d2-a473-00ccff8ef448),
+ pointer_default(unique)
+]
+interface IAssemblyScavenger : IUnknown
+{
+
+ HRESULT ScavengeAssemblyCache
+ (
+ );
+
+ HRESULT GetCacheDiskQuotas
+ (
+ [out] DWORD *pdwZapQuotaInGAC,
+ [out] DWORD *pdwDownloadQuotaAdmin,
+ [out] DWORD *pdwDownloadQuotaUser
+ );
+
+ HRESULT SetCacheDiskQuotas
+ (
+ [in] DWORD dwZapQuotaInGAC,
+ [in] DWORD dwDownloadQuotaAdmin,
+ [in] DWORD dwDownloadQuotaUser
+ );
+
+ HRESULT GetCurrentCacheUsage
+ (
+ [out] DWORD *dwZapUsage,
+ [out] DWORD *dwDownloadUsage
+ );
+}
+
+
+///////////////////////////////////////////////////////////////////////////////
+
+[
+ local,
+ object,
+ uuid(D8FB9BD6-3969-11d3-B4AF-00C04F8ECB26),
+ pointer_default(unique)
+]
+interface ICodebaseList : IUnknown
+{
+ HRESULT AddCodebase
+ (
+ [in] LPCWSTR wzCodebase,
+ [in] DWORD dwFlags
+ );
+
+ HRESULT RemoveCodebase
+ (
+ [in] DWORD dwIndex
+ );
+
+ HRESULT RemoveAll();
+
+ HRESULT GetCount
+ (
+ [out] DWORD *pdwCount
+ );
+
+ HRESULT GetCodebase
+ (
+ [in] DWORD dwIndex,
+ [out] DWORD *pdwFlags,
+ [out, annotation("__out_ecount_opt(*pcbCodebase)")]
+ LPWSTR wzCodebase,
+ [in, out] DWORD *pcbCodebase
+ );
+}
+
+[
+ local,
+ object,
+ uuid(0A6F16F8-ACD7-11d3-B4ED-00C04F8ECB26),
+ pointer_default(unique)
+]
+interface IDownloadMgr : IUnknown
+{
+ HRESULT PreDownloadCheck
+ (
+ [out] void **ppv,
+ [out] void **ppvNI
+ );
+
+ HRESULT DoSetup
+ (
+ [in] LPCWSTR wzSourceUrl,
+ [in] LPCWSTR wzFilePath,
+ [in] const FILETIME *pftLastMod,
+ [out] IUnknown **ppUnk,
+ [out] IUnknown **ppAsmNI
+ );
+
+ HRESULT ProbeFailed
+ (
+ [out] IUnknown **ppUnk
+ );
+
+ HRESULT IsDuplicate
+ (
+ [out] IDownloadMgr *ppDLMgr
+ );
+
+ HRESULT LogResult();
+
+ HRESULT DownloadEnabled
+ (
+ [out] BOOL *pbEnabled
+ );
+
+ HRESULT GetBindInfo
+ (
+ [out] FusionBindInfo *pBindInfo
+ );
+
+ HRESULT CacheBindingResult
+ (
+ [in] HRESULT hrResult
+ );
+}
+
+
+[
+ local,
+ object,
+ uuid(711f7c2d-8234-4505-b02f-7554f46cbf29),
+ pointer_default(unique)
+]
+interface IHostAssembly : IUnknown
+{
+ typedef [unique] IHostAssembly *LPHOSTASSEMBLY;
+
+ HRESULT GetAssemblyNameDef(
+ [out] IAssemblyName **ppAssemblyName);
+
+ HRESULT GetNextAssemblyNameRef(
+ [in] DWORD nIndex,
+ [out] IAssemblyName **ppAssemblyName);
+
+ HRESULT GetNextAssemblyModule(
+ [in] DWORD nIndex,
+ [out] IHostAssemblyModuleImport **ppModImport);
+
+ HRESULT GetModuleByName(
+ [in] LPCOLESTR szModuleName,
+ [out] IHostAssemblyModuleImport **ppModImport);
+
+ // Always release the copy in fusion
+ HRESULT GetAssemblyStream(
+ [out] IStream **ppStreamAsm);
+
+ HRESULT GetAssemblyId(
+ [out] UINT64 *pAssemblyId);
+
+ // Always release the copy in fusion
+ HRESULT GetAssemblyDebugStream(
+ [out] IStream **ppDebugStream);
+
+ LOADCTX_TYPE GetFusionLoadContext(
+ );
+
+ HRESULT GetAssemblyContext(
+ [out] UINT64 *pdwAssemblyContext);
+}
+
+[
+ local,
+ object,
+ uuid(b6f2729d-6c0f-4944-b692-e5a2ce2c6e7a),
+ pointer_default(unique)
+]
+interface IHostAssemblyModuleImport : IUnknown
+{
+ typedef [unique] IHostAssemblyModuleImport *LPHOSTASSEMBLY_MODULE_IMPORT;
+
+ HRESULT GetModuleName(
+ [out, size_is(*pccModuleName), annotation("__out_ecount_full(*pccModuleName)")] LPOLESTR szModuleName,
+ [in, out] LPDWORD pccModuleName);
+
+ HRESULT GetModuleStream(
+ [out] IStream **ppStreamModule);
+
+ HRESULT GetModuleId(
+ [out] DWORD *pdwModuleId);
+
+ HRESULT GetModuleDebugStream(
+ [out] IStream **ppDebugStream);
+}
+
+
+#pragma midl_echo("STDAPI CreateHistoryReader(LPCWSTR wzFilePath, IHistoryReader **ppHistReader);")
+#pragma midl_echo("STDAPI LookupHistoryAssembly(LPCWSTR pwzFilePath, FILETIME *pftActivationDate, LPCWSTR pwzAsmName, LPCWSTR pwzPublicKeyToken, LPCWSTR wzCulture, LPCWSTR pwzVerRef, IHistoryAssembly **pHistAsm);")
+#pragma midl_echo("STDAPI GetHistoryFileDirectory(__out_ecount_opt(*pdwSize) LPWSTR wzDir, DWORD *pdwSize);")
+#pragma midl_echo("STDAPI PreBindAssembly(IApplicationContext *pAppCtx, IAssemblyName *pName, IAssembly *pAsmParent, IAssemblyName **ppNamePostPolicy, LPVOID pvReserved); ")
+
+#pragma midl_echo("STDAPI CreateApplicationContext(IAssemblyName *pName, LPAPPLICATIONCONTEXT *ppCtx); ")
+#pragma midl_echo("STDAPI IsRetargetableAssembly(IAssemblyName *pName, BOOL *pbIsRetargetable); ")
+#pragma midl_echo("STDAPI IsOptionallyRetargetableAssembly(IAssemblyName *pName, BOOL *pbIsRetargetable); ")
+
+
+cpp_quote("#define EXPLICITBIND_FLAGS_NON_BINDABLE 0x0")
+cpp_quote("#define EXPLICITBIND_FLAGS_EXE 0x1")
+
+#ifndef FEATURE_CORECLR
+#pragma midl_echo("HRESULT BindToSystem(IAssemblyName *pNameSystem, LPCWSTR pcwzSystemDirectory, IUnknown *pNIEva, IApplicationContext *pAppCtx, IAssembly **ppAsmOut, IBindResult **ppNIAsmOut, IFusionBindLog **ppdbglog);")
+
+#pragma midl_echo("HRESULT ExplicitBind(LPCWSTR wzPath, IApplicationContext *pAppCtx, DWORD dwFlags, IUnknown *pNIEva, IAssembly **ppAsmOut, IBindResult **ppNIAsmOut, IFusionBindLog **ppdbglog);")
+
+#pragma midl_echo("HRESULT GetBindContextFromApplicationContext(IApplicationContext *pAppCtx, IBindContext **ppBindCtx);")
+
+#pragma midl_echo("HRESULT SetApplicationContext_WinRTBinder(IApplicationContext * pAppCtx, IBindContext * pWinRTBinder);")
+
+// Used by InstallNativeImage() to extract dependency names from the NI's CORCOMPILE_DEPENDENCY_INFO records.
+#pragma midl_echo("STDAPI FusionGetAssemblyNameRefFromMDImport(IMetaDataAssemblyImport *pMDImport, /* This is really an mdAssemblyRef */ DWORD mdar, DWORD dwFlags, IAssemblyName **ppName);")
+
+#endif //!FEATURE_CORECLR
diff --git a/src/inc/fusionsetup.h b/src/inc/fusionsetup.h
new file mode 100644
index 0000000000..87b3e443e2
--- /dev/null
+++ b/src/inc/fusionsetup.h
@@ -0,0 +1,63 @@
+// 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.
+
+
+
+/*============================================================
+**
+** Header: FusionSetup.h
+**
+** Purpose: Defines that are used in both managed and unmanged
+** code
+**
+**
+===========================================================*/
+#ifndef _FUSIONSETUP_H
+#define _FUSIONSETUP_H
+
+#define DYNAMIC_DIRECTORY L"DYNAMIC_DIRECTORY"
+#define LOADER_OPTIMIZATION L"LOADER_OPTIMIZATION"
+#define LICENSE_FILE L"LICENSE_FILE"
+#define APPENV_BASE L"APPBASE"
+#define APPENV_RELATIVEPATH L"RELPATH"
+#define APPENV_GLOBALPATH L"CORPATH"
+#define APPENV_DEVPATH L"DEVPATH"
+#define APPENV_RUNFROMSOURCE L"__FUSION_RUN_FROM_SOURCE__"
+#define CONFIGURATION_EXTENSION L".config"
+#define MACHINE_CONFIGURATION_FILE L"config\\machine.config"
+#define MANIFEST_FILE_PATH L"MANIFEST_FILE_PATH"
+#define VERSIONING_MANIFEST_BASE L"VERSIONING_MANIFEST_BASE"
+
+#ifndef ACTAG_HOST_CONFIG_FILE
+#define ACTAG_HOST_CONFIG_FILE L"HOST_CONFIG"
+#endif
+
+// These are defines instead of enums because they are
+// used to change FusionSetup.cs as well as being used in
+// unmanaged code.
+// If you add a new value, add the corresponding enum value
+// to AppDomainSetup+LoaderInformation, and add the corresponding
+// property value to AppDomain.GetData() and SetData()'s switch
+// statements.
+#define LOADER_APPLICATION_BASE 0
+#define LOADER_CONFIGURATION_BASE 1
+#define LOADER_DYNAMIC_BASE 2
+#define LOADER_DEVPATH 3
+#define LOADER_APPLICATION_NAME 4
+#define LOADER_PRIVATE_PATH 5
+#define LOADER_PRIVATE_BIN_PATH_PROBE 6
+#define LOADER_SHADOW_COPY_DIRECTORIES 7
+#define LOADER_SHADOW_COPY_FILES 8
+#define LOADER_CACHE_PATH 9
+#define LOADER_LICENSE_FILE 10
+#define LOADER_DISALLOW_PUBLISHER_POLICY 11
+#define LOADER_DISALLOW_CODE_DOWNLOAD 12
+#define LOADER_DISALLOW_BINDING_REDIRECTS 13
+#define LOADER_DISALLOW_APPBASE_PROBING 14
+#define LOADER_CONFIGURATION_BYTES 15
+#define LOADER_MANIFEST_FILE_PATH 16
+#define LOADER_VERSIONING_MANIFEST_BASE 17
+#define LOADER_MAXIMUM 18
+
+#endif
diff --git a/src/inc/fusionsink.h b/src/inc/fusionsink.h
new file mode 100644
index 0000000000..adf88d4cd4
--- /dev/null
+++ b/src/inc/fusionsink.h
@@ -0,0 +1,129 @@
+// 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.
+
+
+
+/*============================================================
+**
+** Header: FusionSink.hpp
+**
+** Purpose: Implements FusionSink
+**
+**
+===========================================================*/
+#ifndef _FUSIONSINK_H
+#define _FUSIONSINK_H
+
+#include <fusion.h>
+#include <fusionpriv.h>
+#include "corhlpr.h"
+#include "corpriv.h"
+
+class FusionSink : public IAssemblyBindSink, public INativeImageEvaluate
+{
+public:
+
+ FusionSink() :
+ m_punk(NULL),
+ m_pNIunk(NULL),
+ m_pAbortUnk(NULL),
+ m_pFusionLog(NULL),
+ m_cRef(1),
+ m_hEvent(NULL),
+ m_LastResult(S_OK)
+ {
+ WRAPPER_NO_CONTRACT;
+ }
+
+ virtual void Reset()
+ {
+ CONTRACTL
+ {
+ INSTANCE_CHECK;
+ NOTHROW;
+ }
+ CONTRACTL_END;
+
+ if(m_pAbortUnk) {
+ m_pAbortUnk->Release();
+ m_pAbortUnk = NULL;
+ }
+
+ if(m_punk) {
+ m_punk->Release();
+ m_punk = NULL;
+ }
+
+ if(m_pNIunk) {
+ m_pNIunk->Release();
+ m_pNIunk = NULL;
+ }
+
+ if(m_pFusionLog) {
+ m_pFusionLog->Release();
+ m_pFusionLog = NULL;
+ }
+
+ m_LastResult = S_OK;
+ }
+
+ ~FusionSink()
+ {
+ CONTRACTL
+ {
+ DESTRUCTOR_CHECK;
+ NOTHROW;
+ }
+ CONTRACTL_END;
+
+ if(m_hEvent) {
+ delete m_hEvent;
+ m_hEvent = NULL;
+ }
+
+ Reset();
+ }
+
+ HRESULT AssemblyResetEvent();
+ HRESULT LastResult()
+ {
+ LIMITED_METHOD_CONTRACT;
+ return m_LastResult;
+ }
+
+ STDMETHODIMP QueryInterface(REFIID riid, void **ppInterface);
+ ULONG STDMETHODCALLTYPE AddRef(void);
+ ULONG STDMETHODCALLTYPE Release(void);
+
+ STDMETHODIMP OnProgress(DWORD dwNotification,
+ HRESULT hrNotification,
+ LPCWSTR szNotification,
+ DWORD dwProgress,
+ DWORD dwProgressMax,
+ LPVOID pvBindInfo,
+ IUnknown* punk);
+
+ // Wait on the event.
+ virtual HRESULT Wait();
+
+ STDMETHODIMP Evaluate(
+ IAssembly *pILAssembly,
+ IAssembly *pNativeAssembly,
+ BYTE * pbCachedData,
+ DWORD dwDataSize);
+
+ IUnknown* m_punk; // Getting an assembly
+ IUnknown* m_pNIunk; // Getting an assembly
+ IUnknown* m_pAbortUnk; // pUnk for aborting a bind
+ IFusionBindLog *m_pFusionLog;
+
+protected:
+ HRESULT AssemblyCreateEvent();
+
+ LONG m_cRef; // Ref count.
+ Event *m_hEvent; // Event to block thread.
+ HRESULT m_LastResult; // Last notification result
+};
+
+#endif // _FUSIONSINK_H
diff --git a/src/inc/fxretarget.h b/src/inc/fxretarget.h
new file mode 100644
index 0000000000..abac8d8047
--- /dev/null
+++ b/src/inc/fxretarget.h
@@ -0,0 +1,340 @@
+// 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.
+
+// ==++==
+//
+
+//
+// This header file contains the .NET Framework unification list. It is included by
+// fusion\binder\fxretarget.cpp for clr.dll, and dlls\mscorsvc\taskhelper.cpp for mscorsvc.dll.
+//
+// ==--==
+
+
+//
+
+
+// Automatically roll forward FX 2.0/3.0/3.5 -> 4.0
+#define NDP4_AUTO_VERSION_ROLLFORWARD
+
+#define VER_VS_ASSEMBLYVERSION_STR_L L"10.0.0.0"
+#define VER_VC_STLCLR_ASSEMBLYVERSION_STR_L L"2.0.0.0"
+
+
+// Working set optimization: using file:..\..\bin\OptimizeFxRetarget.cs (.exe) to generate condensed tables with less string data and less pointers
+
+#include "fixedsizestring.h"
+
+namespace FxPolicyHelper
+{
+ // Forward declarations from file:fxretarget_generated.hpp
+ extern LPCSTR const g_rgAssemblyNamePartStrings[];
+ extern LPCWSTR const g_rgAssemblyKeyVersionStrings[];
+
+ enum AppXBinderSupport
+ {
+ AppXBinder_Blocked = 0,
+ AppXBinder_Supported = 1
+ };
+};
+
+struct FrameworkConfig
+{
+ // Working set optimization, store assembly name as 4-bytes, PKT/Version as 1-byte; long assembly names broken into parts stored in ANSI
+ unsigned char m_compressedName[4];
+ unsigned char m_nPKT;
+ unsigned char m_nNewVersion : 7;
+ unsigned char m_fSupportedInAppXBinder : 1;
+
+ const LPCWSTR GetPKT() const
+ {
+ return FxPolicyHelper::g_rgAssemblyKeyVersionStrings[m_nPKT];
+ }
+
+ const LPCWSTR GetNewVersion() const
+ {
+ return FxPolicyHelper::g_rgAssemblyKeyVersionStrings[m_nNewVersion];
+ }
+
+ BOOL IsSupportedInAppXBinder() const
+ {
+ _ASSERTE((m_fSupportedInAppXBinder == FxPolicyHelper::AppXBinder_Blocked) ||
+ (m_fSupportedInAppXBinder == FxPolicyHelper::AppXBinder_Supported));
+
+ return (m_fSupportedInAppXBinder == FxPolicyHelper::AppXBinder_Supported);
+ }
+
+ // Using template to avoid converting it to UNICODE when possible,
+ // more important avoid converting the ANSI string it's going to be compared with to be converted to UNICODE
+ template<typename T>
+ void GetFxAssemblyName(FixedSizeString<T> & output) const
+ {
+ output.DecodeName(_countof(m_compressedName), m_compressedName, FxPolicyHelper::g_rgAssemblyNamePartStrings);
+ }
+};
+
+#define StringHashIterator(name, table, asmName) StringHashEnumerator name(asmName, table ## _Hash, _countof(table ## _Hash), table ## _HashCollision);
+
+#ifdef NEEDDATA
+
+// This file is auto generated by file:..\..\bin\OptimizeFxRetarget.cs (.exe), saved in intermediate directory
+#include "fxretarget_generated.hpp"
+
+#endif
+
+#ifdef ORIGINAL_SOURCE
+
+typedef struct tagFrameworkConfig
+{
+ LPCWSTR pwzName;
+// culture by default is NULL/Neutral
+// LPCWSTR pwzCulture;
+ LPCWSTR pwzPKT;
+ LPCWSTR pwzNewVersion;
+ FxPolicyHelper::AppXBinderSupport fSupportedInAppXBinder;
+} FrameworkConfig;
+
+const FrameworkConfig g_arFxPolicy[] =
+{
+// This table is parsed and processed by file:..\..\bin\OptimizeFxRetarget.cs (.exe):
+// STARTDICTIONARY(FxPolicyHelper,AssemblyNamePart,AssemblyKeyVersion,FrameworkConfig,g_arFxPolicy)
+ {L"Accessibility", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"CustomMarshalers", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"ISymWrapper", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"Microsoft.JScript", MICROSOFT_PUBLICKEY_STR_L, VER_VS_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"Microsoft.VisualBasic", MICROSOFT_PUBLICKEY_STR_L, VER_VS_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"Microsoft.VisualBasic.Compatibility", MICROSOFT_PUBLICKEY_STR_L, VER_VS_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"Microsoft.VisualBasic.Compatibility.Data", MICROSOFT_PUBLICKEY_STR_L, VER_VS_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"Microsoft.VisualC", MICROSOFT_PUBLICKEY_STR_L, VER_VS_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"mscorlib", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.Configuration", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.Configuration.Install", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"System.Data", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.Data.OracleClient", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"System.Data.SqlXml", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.Deployment", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"System.Design", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"System.DirectoryServices", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.DirectoryServices.Protocols", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"System.Drawing", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"System.Drawing.Design", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"System.EnterpriseServices", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.Management", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"System.Messaging", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"System.Runtime.Remoting", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.Runtime.Serialization.Formatters.Soap", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.Security", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.ServiceProcess", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"System.Transactions", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.Web", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"System.Web.Mobile", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"System.Web.RegularExpressions", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"System.Web.Services", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported}, // Has to be supported in AppX, because it is in transitive closure of supported assemblies
+ {L"System.Windows.Forms", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"System.Xml", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+
+#ifdef NDP4_AUTO_VERSION_ROLLFORWARD
+
+ // Post-Everett FX 2.0 assemblies:
+ {L"AspNetMMCExt", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"sysglobl", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"Microsoft.Build.Engine", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"Microsoft.Build.Framework", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+
+ // FX 3.0 assemblies:
+ // Note: we shipped .NET 4.0 with entries in this list for PresentationCFFRasterizer and System.ServiceModel.Install
+ // even though these assemblies did not ship with .NET 4.0. To maintain 100% compatibility with 4.0 we will keep
+ // these in .NET 4.5, but we should remove them in a future SxS version of the Framework.
+ {L"PresentationCFFRasterizer", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked}, // See note above
+ {L"PresentationCore", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"PresentationFramework", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"PresentationFramework.Aero", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"PresentationFramework.Classic", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"PresentationFramework.Luna", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"PresentationFramework.Royale", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"PresentationUI", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"ReachFramework", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"System.Printing", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"System.Speech", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"UIAutomationClient", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"UIAutomationClientsideProviders", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"UIAutomationProvider", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"UIAutomationTypes", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"WindowsBase", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"WindowsFormsIntegration", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"SMDiagnostics", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.IdentityModel", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.IdentityModel.Selectors", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.IO.Log", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"System.Runtime.Serialization", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.ServiceModel", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.ServiceModel.Install", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked}, // See note above
+ {L"System.ServiceModel.WasHosting", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"System.Workflow.Activities", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"System.Workflow.ComponentModel", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"System.Workflow.Runtime", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"Microsoft.Transactions.Bridge", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"Microsoft.Transactions.Bridge.Dtc", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+
+ // FX 3.5 assemblies:
+ {L"System.AddIn", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"System.AddIn.Contract", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"System.ComponentModel.Composition", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported}, // Shipping out-of-band
+ {L"System.Core", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.Data.DataSetExtensions", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"System.Data.Linq", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"System.Xml.Linq", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.DirectoryServices.AccountManagement", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"System.Management.Instrumentation", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"System.Net", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.ServiceModel.Web", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported}, // Needed for portable libraries
+ {L"System.Web.Extensions", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"System.Web.Extensions.Design", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"System.Windows.Presentation", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"System.WorkflowServices", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ // Microsoft.Data.Entity.Build.Tasks.dll should not be unified on purpose - it is supported SxS, i.e. both 3.5 and 4.0 versions can be loaded into CLR 4.0+.
+ // {L"Microsoft.Data.Entity.Build.Tasks", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L},
+
+ // FX 3.5 SP1 assemblies:
+ {L"System.ComponentModel.DataAnnotations", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.Data.Entity", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"System.Data.Entity.Design", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"System.Data.Services", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"System.Data.Services.Client", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"System.Data.Services.Design", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"System.Web.Abstractions", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"System.Web.DynamicData", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"System.Web.DynamicData.Design", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"System.Web.Entity", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"System.Web.Entity.Design", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"System.Web.Routing", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+
+ // FX 4.0 assemblies:
+ {L"Microsoft.Build", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"Microsoft.CSharp", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.Dynamic", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.Numerics", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.Xaml", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ // Microsoft.Workflow.Compiler.exe:
+ // System.Workflow.ComponentModel.dll started to depend on Microsoft.Workflow.Compiler.exe in 4.0 RTM
+ {L"Microsoft.Workflow.Compiler", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+
+ // FX 4.5 assemblies:
+ {L"Microsoft.Activities.Build", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"Microsoft.Build.Conversion.v4.0", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"Microsoft.Build.Tasks.v4.0", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"Microsoft.Build.Utilities.v4.0", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"Microsoft.Internal.Tasks.Dataflow", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"Microsoft.VisualBasic.Activities.Compiler", MICROSOFT_PUBLICKEY_STR_L, VER_VS_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"Microsoft.VisualC.STLCLR", MICROSOFT_PUBLICKEY_STR_L, VER_VC_STLCLR_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"Microsoft.Windows.ApplicationServer.Applications", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"PresentationBuildTasks", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"PresentationFramework.Aero2", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"PresentationFramework.AeroLite", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"PresentationFramework-SystemCore", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"PresentationFramework-SystemData", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"PresentationFramework-SystemDrawing", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"PresentationFramework-SystemXml", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"PresentationFramework-SystemXmlLinq", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"System.Activities", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"System.Activities.Core.Presentation", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"System.Activities.DurableInstancing", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"System.Activities.Presentation", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"System.ComponentModel.Composition.Registration", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.Device", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"System.IdentityModel.Services", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"System.IO.Compression", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.IO.Compression.FileSystem", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"System.Net.Http", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.Net.Http.WebRequest", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.Reflection.Context", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.Runtime.Caching", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"System.Runtime.DurableInstancing", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.Runtime.WindowsRuntime", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.Runtime.WindowsRuntime.UI.Xaml", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.ServiceModel.Activation", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"System.ServiceModel.Activities", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"System.ServiceModel.Channels", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"System.ServiceModel.Discovery", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"System.ServiceModel.Internals", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.ServiceModel.Routing", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"System.ServiceModel.ServiceMoniker40", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"System.Web.ApplicationServices", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported}, // Has to be supported in AppX, because it is in transitive closure of supported assemblies
+ {L"System.Web.DataVisualization", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"System.Web.DataVisualization.Design", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"System.Windows.Controls.Ribbon", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"System.Windows.Forms.DataVisualization", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"System.Windows.Forms.DataVisualization.Design", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"System.Windows.Input.Manipulations", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"System.Xaml.Hosting", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"XamlBuildTask", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"XsdBuildTask", SHAREDLIB_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Blocked},
+ {L"System.Numerics.Vectors", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+
+ // FX 4.5 facade assemblies:
+ {L"System.Collections", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.Collections.Concurrent", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.ComponentModel", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.ComponentModel.Annotations", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.ComponentModel.EventBasedAsync", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.Diagnostics.Contracts", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.Diagnostics.Debug", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.Diagnostics.Tools", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.Diagnostics.Tracing", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.Dynamic.Runtime", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.Globalization", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.IO", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.Linq", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.Linq.Expressions", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.Linq.Parallel", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.Linq.Queryable", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.Net.Http.Rtc", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.Net.NetworkInformation", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.Net.Primitives", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.Net.Requests", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.Net.WebHeaderCollection", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.ObjectModel", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.Reflection", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.Reflection.Emit", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.Reflection.Emit.ILGeneration", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.Reflection.Emit.Lightweight", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.Reflection.Extensions", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.Reflection.Primitives", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.Resources.ResourceManager", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.Runtime", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.Runtime.Extensions", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.Runtime.Handles", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.Runtime.InteropServices", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.Runtime.InteropServices.WindowsRuntime", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.Runtime.Numerics", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.Runtime.Serialization.Json", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.Runtime.Serialization.Primitives", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.Runtime.Serialization.Xml", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.Security.Principal", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.ServiceModel.Duplex", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.ServiceModel.Http", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.ServiceModel.NetTcp", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.ServiceModel.Primitives", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.ServiceModel.Security", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.Text.Encoding", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.Text.Encoding.Extensions", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.Text.RegularExpressions", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.Threading", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.Threading.Tasks", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.Threading.Tasks.Parallel", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.Threading.Timer", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.Xml.ReaderWriter", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.Xml.XDocument", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.Xml.XmlSerializer", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ // Manually added facades
+ {L"System.Windows", MICROSOFT_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+ {L"System.Xml.Serialization", ECMA_PUBLICKEY_STR_L, VER_ASSEMBLYVERSION_STR_L, FxPolicyHelper::AppXBinder_Supported},
+
+#endif // NDP4_AUTO_VERSION_ROLLFORWARD
+
+// ENDDICTIONARY
+}; //g_arFxPolicy
+
+#endif //ORIGINAL_SOURCE
diff --git a/src/inc/gcdecoder.cpp b/src/inc/gcdecoder.cpp
new file mode 100644
index 0000000000..d337faeebc
--- /dev/null
+++ b/src/inc/gcdecoder.cpp
@@ -0,0 +1,589 @@
+// 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.
+
+/*XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XX XX
+XX GCDecode XX
+XX XX
+XX Logic to decode the JIT method header and GC pointer tables XX
+XX XX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX
+*/
+
+
+#ifdef _TARGET_X86_
+
+/* This file is shared between the VM and JIT/IL and SOS/Strike directories */
+
+#include "gcinfotypes.h"
+
+/*****************************************************************************/
+/*
+ * This entire file depends upon GC2_ENCODING being set to 1
+ *
+ *****************************************************************************/
+
+size_t FASTCALL decodeUnsigned(PTR_CBYTE src, unsigned* val)
+{
+ LIMITED_METHOD_CONTRACT;
+
+ size_t size = 1;
+ BYTE byte = *src++;
+ unsigned value = byte & 0x7f;
+ while (byte & 0x80) {
+ size++;
+ byte = *src++;
+ value <<= 7;
+ value += byte & 0x7f;
+ }
+ *val = value;
+ return size;
+}
+
+size_t FASTCALL decodeUDelta(PTR_CBYTE src, unsigned* value, unsigned lastValue)
+{
+ CONTRACTL {
+ NOTHROW;
+ GC_NOTRIGGER;
+ } CONTRACTL_END;
+
+ unsigned delta;
+ size_t size = decodeUnsigned(src, &delta);
+ *value = lastValue + delta;
+ return size;
+}
+
+size_t FASTCALL decodeSigned(PTR_CBYTE src, int* val)
+{
+ CONTRACTL {
+ NOTHROW;
+ GC_NOTRIGGER;
+ } CONTRACTL_END;
+
+ size_t size = 1;
+ BYTE byte = *src++;
+ BYTE first = byte;
+ int value = byte & 0x3f;
+ while (byte & 0x80)
+ {
+ size++;
+ byte = *src++;
+ value <<= 7;
+ value += byte & 0x7f;
+ }
+ if (first & 0x40)
+ value = -value;
+ *val = value;
+ return size;
+}
+
+/*****************************************************************************/
+
+#if defined(_MSC_VER)
+#pragma optimize("tgy", on)
+#endif
+
+PTR_CBYTE FASTCALL decodeHeader(PTR_CBYTE table, InfoHdr* header)
+{
+ LIMITED_METHOD_DAC_CONTRACT;
+
+ BYTE byte = *table++;
+ BYTE encoding = byte & 0x7f;
+
+ GetInfoHdr(encoding, header);
+
+ while (byte & 0x80)
+ {
+ byte = *table++;
+ encoding = byte & 0x7f;
+ if (encoding < NEXT_FOUR_START)
+ {
+ if (encoding < SET_ARGCOUNT)
+ {
+ header->frameSize = encoding - SET_FRAMESIZE;
+ }
+ else if (encoding < SET_PROLOGSIZE)
+ {
+ header->argCount = encoding - SET_ARGCOUNT;
+ }
+ else if (encoding < SET_EPILOGSIZE)
+ {
+ header->prologSize = encoding - SET_PROLOGSIZE;
+ }
+ else if (encoding < SET_EPILOGCNT)
+ {
+ header->epilogSize = encoding - SET_EPILOGSIZE;
+ }
+ else if (encoding < SET_UNTRACKED)
+ {
+ header->epilogCount = (encoding - SET_EPILOGCNT) / 2;
+ header->epilogAtEnd = ((encoding - SET_EPILOGCNT) & 1) == 1;
+ assert(!header->epilogAtEnd || (header->epilogCount == 1));
+ }
+ else if (encoding < FIRST_FLIP)
+ {
+ header->untrackedCnt = encoding - SET_UNTRACKED;
+ }
+ else switch (encoding)
+ {
+ default:
+ assert(!"Unexpected encoding");
+ break;
+ case FLIP_EDI_SAVED:
+ header->ediSaved ^= 1;
+ break;
+ case FLIP_ESI_SAVED:
+ header->esiSaved ^= 1;
+ break;
+ case FLIP_EBX_SAVED:
+ header->ebxSaved ^= 1;
+ break;
+ case FLIP_EBP_SAVED:
+ header->ebpSaved ^= 1;
+ break;
+ case FLIP_EBP_FRAME:
+ header->ebpFrame ^= 1;
+ break;
+ case FLIP_INTERRUPTIBLE:
+ header->interruptible ^= 1;
+ break;
+ case FLIP_DOUBLE_ALIGN:
+ header->doubleAlign ^= 1;
+ break;
+ case FLIP_SECURITY:
+ header->security ^= 1;
+ break;
+ case FLIP_HANDLERS:
+ header->handlers ^= 1;
+ break;
+ case FLIP_LOCALLOC:
+ header->localloc ^= 1;
+ break;
+ case FLIP_EDITnCONTINUE:
+ header->editNcontinue ^= 1;
+ break;
+ case FLIP_VAR_PTR_TABLE_SZ:
+ header->varPtrTableSize ^= HAS_VARPTR;
+ break;
+ case FFFF_UNTRACKED_CNT:
+ header->untrackedCnt = HAS_UNTRACKED;
+ break;
+ case FLIP_VARARGS:
+ header->varargs ^= 1;
+ break;
+ case FLIP_PROF_CALLBACKS:
+ header->profCallbacks ^= 1;
+ break;
+ case FLIP_HAS_GENERICS_CONTEXT:
+ header->genericsContext ^= 1;
+ break;
+ case FLIP_GENERICS_CONTEXT_IS_METHODDESC:
+ header->genericsContextIsMethodDesc ^= 1;
+ break;
+ case FLIP_HAS_GS_COOKIE:
+ header->gsCookieOffset ^= HAS_GS_COOKIE_OFFSET;
+ break;
+ case FLIP_SYNC:
+ header->syncStartOffset ^= HAS_SYNC_OFFSET;
+ break;
+ }
+ }
+ else
+ {
+ unsigned char lowBits;
+ switch (encoding >> 4)
+ {
+ default:
+ assert(!"Unexpected encoding");
+ break;
+ case 5:
+ assert(NEXT_FOUR_FRAMESIZE == 0x50);
+ lowBits = encoding & 0xf;
+ header->frameSize <<= 4;
+ header->frameSize += lowBits;
+ break;
+ case 6:
+ assert(NEXT_FOUR_ARGCOUNT == 0x60);
+ lowBits = encoding & 0xf;
+ header->argCount <<= 4;
+ header->argCount += lowBits;
+ break;
+ case 7:
+ if ((encoding & 0x8) == 0)
+ {
+ assert(NEXT_THREE_PROLOGSIZE == 0x70);
+ lowBits = encoding & 0x7;
+ header->prologSize <<= 3;
+ header->prologSize += lowBits;
+ }
+ else
+ {
+ assert(NEXT_THREE_EPILOGSIZE == 0x78);
+ lowBits = encoding & 0x7;
+ header->epilogSize <<= 3;
+ header->epilogSize += lowBits;
+ }
+ break;
+ }
+ }
+ }
+ return table;
+}
+
+void FASTCALL decodeCallPattern(int pattern,
+ unsigned * argCnt,
+ unsigned * regMask,
+ unsigned * argMask,
+ unsigned * codeDelta)
+{
+ CONTRACTL {
+ NOTHROW;
+ GC_NOTRIGGER;
+ SUPPORTS_DAC;
+ } CONTRACTL_END;
+
+ assert((pattern>=0) && (pattern<80));
+ CallPattern pat;
+ pat.val = callPatternTable[pattern];
+ *argCnt = pat.fld.argCnt;
+ *regMask = pat.fld.regMask; // EBP,EBX,ESI,EDI
+ *argMask = pat.fld.argMask;
+ *codeDelta = pat.fld.codeDelta;
+}
+
+#define YES HAS_VARPTR
+
+const InfoHdrSmall infoHdrShortcut[128] = {
+// Prolog size
+// |
+// | Epilog size
+// | |
+// | | Epilog count
+// | | |
+// | | | Epilog at end
+// | | | |
+// | | | | EDI saved
+// | | | | |
+// | | | | | ESI saved
+// | | | | | |
+// | | | | | | EBX saved
+// | | | | | | |
+// | | | | | | | EBP saved
+// | | | | | | | |
+// | | | | | | | | EBP-frame
+// | | | | | | | | |
+// | | | | | | | | | Interruptible method
+// | | | | | | | | | |
+// | | | | | | | | | | doubleAlign
+// | | | | | | | | | | |
+// | | | | | | | | | | | security flag
+// | | | | | | | | | | | |
+// | | | | | | | | | | | | handlers
+// | | | | | | | | | | | | |
+// | | | | | | | | | | | | | localloc
+// | | | | | | | | | | | | | |
+// | | | | | | | | | | | | | | edit and continue
+// | | | | | | | | | | | | | | |
+// | | | | | | | | | | | | | | | varargs
+// | | | | | | | | | | | | | | | |
+// | | | | | | | | | | | | | | | | ProfCallbacks
+// | | | | | | | | | | | | | | | | |
+// | | | | | | | | | | | | | | | | | genericsContext
+// | | | | | | | | | | | | | | | | | |
+// | | | | | | | | | | | | | | | | | | genericsContextIsMethodDesc
+// | | | | | | | | | | | | | | | | | | |
+// | | | | | | | | | | | | | | | | | | | Arg count
+// | | | | | | | | | | | | | | | | | | | | Counted occurances
+// | | | | | | | | | | | | | | | | | | | | Frame size |
+// | | | | | | | | | | | | | | | | | | | | | |
+// | | | | | | | | | | | | | | | | | | | | | untrackedCnt | Header encoding
+// | | | | | | | | | | | | | | | | | | | | | | | |
+// | | | | | | | | | | | | | | | | | | | | | | varPtrTable | |
+// | | | | | | | | | | | | | | | | | | | | | | | | |
+// | | | | | | | | | | | | | | | | | | | | | | | gsCookieOffs | |
+// | | | | | | | | | | | | | | | | | | | | | | | | | |
+// | | | | | | | | | | | | | | | | | | | | | | | | syncOffs | |
+// | | | | | | | | | | | | | | | | | | | | | | | | | | | |
+// | | | | | | | | | | | | | | | | | | | | | | | | | | | |
+// | | | | | | | | | | | | | | | | | | | | | | | | | | | |
+// v v v v v v v v v v v v v v v v v v v v v v v v v v v v
+ { 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // 1139 00
+ { 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // 128738 01
+ { 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // 3696 02
+ { 0, 1, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // 402 03
+ { 0, 3, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 }, // 4259 04
+ { 0, 3, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0 }, // 3379 05
+ { 0, 3, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0 }, // 2058 06
+ { 0, 3, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 1, 0 }, // 728 07
+ { 0, 3, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0 }, // 984 08
+ { 0, 3, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0, 0 }, // 606 09
+ { 0, 3, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0, 0 }, // 1110 0a
+ { 0, 3, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 1, 0 }, // 414 0b
+ { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, YES }, // 1553 0c
+ { 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, YES }, // 584 0d
+ { 1, 2, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, YES }, // 2182 0e
+ { 1, 2, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // 3445 0f
+ { 1, 2, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 }, // 1369 10
+ { 1, 2, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // 515 11
+ { 1, 2, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // 21127 12
+ { 1, 2, 2, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // 3517 13
+ { 1, 2, 3, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // 750 14
+ { 1, 4, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 }, // 1876 15
+ { 1, 4, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0 }, // 1665 16
+ { 1, 4, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0 }, // 729 17
+ { 1, 4, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0 }, // 484 18
+ { 1, 4, 2, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 }, // 331 19
+ { 2, 3, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, YES }, // 361 1a
+ { 2, 3, 1, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // 964 1b
+ { 2, 3, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // 3713 1c
+ { 2, 3, 1, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // 466 1d
+ { 2, 3, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 }, // 1325 1e
+ { 2, 3, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, YES }, // 712 1f
+ { 2, 3, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // 588 20
+ { 2, 3, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // 20542 21
+ { 2, 3, 2, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // 3802 22
+ { 2, 3, 3, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // 798 23
+ { 2, 5, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 }, // 1900 24
+ { 2, 5, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0 }, // 385 25
+ { 2, 5, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 }, // 1617 26
+ { 2, 5, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0 }, // 1743 27
+ { 2, 5, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0 }, // 909 28
+ { 2, 5, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 1, 0 }, // 602 29
+ { 2, 5, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0 }, // 352 2a
+ { 2, 6, 1, 1, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, YES }, // 657 2b
+ { 2, 7, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, YES }, // 1283 2c
+ { 2, 7, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, YES }, // 1286 2d
+ { 3, 4, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 }, // 1495 2e
+ { 3, 4, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // 1989 2f
+ { 3, 4, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 }, // 1154 30
+ { 3, 4, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // 9300 31
+ { 3, 4, 2, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 }, // 392 32
+ { 3, 4, 2, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // 1720 33
+ { 3, 6, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 }, // 1246 34
+ { 3, 6, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0 }, // 800 35
+ { 3, 6, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 }, // 1179 36
+ { 3, 6, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0 }, // 1368 37
+ { 3, 6, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0 }, // 349 38
+ { 3, 6, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 2, 0 }, // 505 39
+ { 3, 6, 2, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 }, // 629 3a
+ { 3, 8, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 2, YES }, // 365 3b
+ { 4, 5, 1, 0, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 }, // 487 3c
+ { 4, 5, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // 1752 3d
+ { 4, 5, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 }, // 1959 3e
+ { 4, 5, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // 2436 3f
+ { 4, 5, 2, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // 861 40
+ { 4, 7, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 }, // 1459 41
+ { 4, 7, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0 }, // 950 42
+ { 4, 7, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 }, // 1491 43
+ { 4, 7, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 1, 0 }, // 879 44
+ { 4, 7, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0, 0 }, // 408 45
+ { 5, 4, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // 4870 46
+ { 5, 6, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 }, // 359 47
+ { 5, 6, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0 }, // 915 48
+ { 5, 6, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0 }, // 412 49
+ { 5, 6, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 }, // 1288 4a
+ { 5, 6, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, YES }, // 1591 4b
+ { 5, 6, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, YES }, // 361 4c
+ { 5, 6, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 0, 0 }, // 623 4d
+ { 5, 8, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0 }, // 1239 4e
+ { 6, 0, 0, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // 457 4f
+ { 6, 0, 0, 0, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // 606 50
+ { 6, 4, 1, 0, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, YES }, // 1073 51
+ { 6, 4, 1, 1, 0, 0, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, YES }, // 508 52
+ { 6, 6, 1, 0, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 }, // 330 53
+ { 6, 6, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 }, // 1709 54
+ { 6, 7, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0 }, // 1164 55
+ { 7, 4, 1, 0, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 }, // 556 56
+ { 7, 5, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, YES }, // 529 57
+ { 7, 5, 1, 0, 0, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 5, 0, YES }, // 1423 58
+ { 7, 8, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, YES }, // 2455 59
+ { 7, 8, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0 }, // 956 5a
+ { 7, 8, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, YES }, // 1399 5b
+ { 7, 8, 2, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 3, 0, YES }, // 587 5c
+ { 7, 10, 1, 0, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 6, 1, YES }, // 743 5d
+ { 7, 10, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 0, 0 }, // 1004 5e
+ { 7, 10, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 2, 1, YES }, // 487 5f
+ { 7, 10, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 2, 0, 0 }, // 337 60
+ { 7, 10, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 3, 0, YES }, // 361 61
+ { 8, 3, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0 }, // 560 62
+ { 8, 6, 1, 1, 1, 1, 0, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0 }, // 1377 63
+ { 9, 4, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0 }, // 877 64
+ { 9, 7, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 0, 0 }, // 3041 65
+ { 9, 7, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, YES }, // 349 66
+ { 10, 5, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 1, 0 }, // 2061 67
+ { 10, 5, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0 }, // 577 68
+ { 11, 6, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 4, 1, 0 }, // 1195 69
+ { 12, 5, 1, 1, 0, 1, 0, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0 }, // 491 6a
+ { 13, 8, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 9, 0, YES }, // 627 6b
+ { 13, 8, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 1, 0 }, // 1099 6c
+ { 13, 10, 1, 0, 1, 1, 1, 1, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 2, 6, 1, YES }, // 488 6d
+ { 14, 7, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, YES }, // 574 6e
+ { 16, 7, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 4, 0, YES }, // 1281 6f
+ { 16, 7, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, YES }, // 1881 70
+ { 16, 7, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0, YES }, // 339 71
+ { 16, 7, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 3, 0, 0 }, // 2594 72
+ { 16, 7, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 4, 0, 0 }, // 339 73
+ { 16, 7, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 4, 0, YES }, // 2107 74
+ { 16, 7, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 5, 0, YES }, // 2372 75
+ { 16, 7, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 6, 0, YES }, // 1078 76
+ { 16, 7, 2, 0, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 4, 0, YES }, // 384 77
+ { 16, 9, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 1, 4, 1, YES }, // 1541 78
+ { 16, 9, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 2, 4, 1, YES }, // 975 79
+ { 19, 7, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 5, 0, YES }, // 546 7a
+ { 24, 7, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 5, 0, YES }, // 675 7b
+ { 45, 9, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0 }, // 902 7c
+ { 51, 7, 1, 0, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 13, 0, YES }, // 432 7d
+ { 51, 7, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, YES }, // 361 7e
+ { 51, 7, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 11, 0, 0 }, // 703 7f
+};
+
+
+bool InfoHdrSmall::isHeaderMatch(const InfoHdr& target) const
+{
+#ifdef _ASSERTE
+ // target cannot have place-holder values.
+ _ASSERTE(target.untrackedCnt != HAS_UNTRACKED &&
+ target.varPtrTableSize != HAS_VARPTR &&
+ target.gsCookieOffset != HAS_GS_COOKIE_OFFSET &&
+ target.syncStartOffset != HAS_SYNC_OFFSET);
+#endif
+
+ // compare two InfoHdr's up to but not including the untrackCnt field
+ if (memcmp(this, &target, offsetof(InfoHdr, untrackedCnt)) != 0)
+ return false;
+
+ if (untrackedCnt != target.untrackedCnt) {
+ if (target.untrackedCnt <= SET_UNTRACKED_MAX)
+ return false;
+ else if (untrackedCnt != HAS_UNTRACKED)
+ return false;
+ }
+
+ if (varPtrTableSize != target.varPtrTableSize) {
+ if ((varPtrTableSize != 0) != (target.varPtrTableSize != 0))
+ return false;
+ }
+
+ if (target.gsCookieOffset != INVALID_GS_COOKIE_OFFSET)
+ return false;
+
+ return target.syncStartOffset == INVALID_SYNC_OFFSET;
+}
+
+
+const unsigned callCommonDelta[4] = { 6,8,10,12 };
+
+/*
+ * In the callPatternTable each 32-bit unsigned value represents four bytes:
+ *
+ * byte0,byte1,byte2,byte3 => codeDelta,argMask,regMask,argCnt
+ * for example 0x0c000301 => codeDelta of 12, argMask of 0,
+ * regMask of 0x3, argCnt of 1
+ *
+ * Furthermore within the table the following maximum values are in place:
+ *
+ * codeDelta <= CP_MAX_CODE_DELTA // (0x23)
+ * argCnt <= CP_MAX_ARG_CNT // (0x02)
+ * argMask <= CP_MAX_ARG_MASK // (0x00)
+ *
+ * Note that ARG_CNT is the count of pushed args for a nested call site.
+ * And since the first two arguments are always passed in registers
+ * an ARG_CNT of 1 would mean that the nested call site had three arguments
+ *
+ * Note that ARG_MASK is the mask of pushed args that contain GC pointers
+ * since the first two arguments are always passed in registers it is
+ * a fairly rare occurance to push a GC pointer as an argument, since it
+ * only occurs for nested calls, when the third or later argument for the
+ * outer call contains a GC ref.
+ *
+ * Additionally the encoding of the regMask uses the following bits:
+ * EDI = 0x1, ESI = 0x2, EBX = 0x4, EBP = 0x8
+ *
+ */
+const unsigned callPatternTable[80] = { // # of occurances
+ 0x0a000200, // 30109
+ 0x0c000200, // 22970
+ 0x0c000201, // 19005
+ 0x0a000300, // 12193
+ 0x0c000300, // 10614
+ 0x0e000200, // 10253
+ 0x10000200, // 9746
+ 0x0b000200, // 9698
+ 0x0d000200, // 9625
+ 0x08000200, // 8909
+ 0x0c000301, // 8522
+ 0x11000200, // 7382
+ 0x0e000300, // 7357
+ 0x12000200, // 7139
+ 0x10000300, // 7062
+ 0x11000300, // 6970
+ 0x0a000201, // 6842
+ 0x0a000100, // 6803
+ 0x0f000200, // 6795
+ 0x13000200, // 6559
+ 0x08000300, // 6079
+ 0x15000200, // 5874
+ 0x0d000201, // 5492
+ 0x0c000100, // 5193
+ 0x0d000300, // 5165
+ 0x23000200, // 5143
+ 0x1b000200, // 5035
+ 0x14000200, // 4872
+ 0x0f000300, // 4850
+ 0x0a000700, // 4781
+ 0x09000200, // 4560
+ 0x12000300, // 4496
+ 0x16000200, // 4180
+ 0x07000200, // 4021
+ 0x09000300, // 4012
+ 0x0c000700, // 3988
+ 0x0c000600, // 3946
+ 0x0e000100, // 3823
+ 0x1a000200, // 3764
+ 0x18000200, // 3744
+ 0x17000200, // 3736
+ 0x1f000200, // 3671
+ 0x13000300, // 3559
+ 0x0a000600, // 3214
+ 0x0e000600, // 3109
+ 0x08000201, // 2984
+ 0x0b000300, // 2928
+ 0x0a000301, // 2859
+ 0x07000100, // 2826
+ 0x13000100, // 2782
+ 0x09000301, // 2644
+ 0x19000200, // 2638
+ 0x11000700, // 2618
+ 0x21000200, // 2518
+ 0x0d000202, // 2484
+ 0x10000100, // 2480
+ 0x0f000600, // 2413
+ 0x14000300, // 2363
+ 0x0c000500, // 2362
+ 0x08000301, // 2285
+ 0x20000200, // 2245
+ 0x10000700, // 2240
+ 0x0f000100, // 2236
+ 0x1e000200, // 2214
+ 0x0c000400, // 2193
+ 0x16000300, // 2171
+ 0x12000600, // 2132
+ 0x22000200, // 2011
+ 0x1d000200, // 2011
+ 0x0c000f00, // 1996
+ 0x0e000700, // 1971
+ 0x0a000400, // 1970
+ 0x09000201, // 1932
+ 0x10000600, // 1903
+ 0x15000300, // 1847
+ 0x0a000101, // 1814
+ 0x0a000b00, // 1771
+ 0x0c000601, // 1737
+ 0x09000700, // 1737
+ 0x07000300, // 1684
+};
+
+#endif // _TARGET_X86_
diff --git a/src/inc/gcdump.h b/src/inc/gcdump.h
new file mode 100644
index 0000000000..cd73940ded
--- /dev/null
+++ b/src/inc/gcdump.h
@@ -0,0 +1,102 @@
+// 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.
+
+/*****************************************************************************
+ * GCDump.h
+ *
+ * Defines functions to display the GCInfo as defined by the GC-encoding
+ * spec. The GC information may be either dynamically created by a
+ * Just-In-Time compiler conforming to the standard code-manager spec,
+ * or may be persisted by a managed native code compiler conforming
+ * to the standard code-manager spec.
+ */
+
+/*****************************************************************************/
+#ifndef __GCDUMP_H__
+#define __GCDUMP_H__
+/*****************************************************************************/
+
+#include "gcinfotypes.h" // For InfoHdr
+
+#ifndef FASTCALL
+#ifndef FEATURE_PAL
+#define FASTCALL __fastcall
+#else
+#define FASTCALL
+#endif
+#endif
+
+
+class GCDump
+{
+public:
+
+ GCDump (UINT32 gcInfoVersion,
+ bool encBytes = true,
+ unsigned maxEncBytes = 5,
+ bool dumpCodeOffs = true);
+
+#ifdef _TARGET_X86_
+ /*-------------------------------------------------------------------------
+ * Dumps the InfoHdr to 'stdout'
+ * table : Start of the GC info block
+ * verifyGCTables : If the JIT has been compiled with VERIFY_GC_TABLES
+ * Return value : Size in bytes of the header encoding
+ */
+
+ unsigned FASTCALL DumpInfoHdr (PTR_CBYTE gcInfoBlock,
+ InfoHdr * header, /* OUT */
+ unsigned * methodSize, /* OUT */
+ bool verifyGCTables = false);
+#endif
+
+ /*-------------------------------------------------------------------------
+ * Dumps the GC tables to 'stdout'
+ * table : The GCInfoToken
+ * verifyGCTables : If the JIT has been compiled with VERIFY_GC_TABLES
+ * Return value : Size in bytes of the GC table encodings
+ */
+
+ size_t FASTCALL DumpGCTable (PTR_CBYTE gcInfoBlock,
+#ifdef _TARGET_X86_
+ const InfoHdr& header,
+#endif
+ unsigned methodSize,
+ bool verifyGCTables = false);
+
+ /*-------------------------------------------------------------------------
+ * Dumps the location of ptrs for the given code offset
+ * verifyGCTables : If the JIT has been compiled with VERIFY_GC_TABLES
+ */
+
+ void FASTCALL DumpPtrsInFrame(PTR_CBYTE infoBlock,
+ PTR_CBYTE codeBlock,
+ unsigned offs,
+ bool verifyGCTables = false);
+
+
+public:
+ typedef void (*printfFtn)(const char* fmt, ...);
+ printfFtn gcPrintf;
+ UINT32 gcInfoVersion;
+ //-------------------------------------------------------------------------
+protected:
+
+ bool fDumpEncBytes;
+ unsigned cMaxEncBytes;
+
+ bool fDumpCodeOffsets;
+
+ /* Helper methods */
+
+ PTR_CBYTE DumpEncoding(PTR_CBYTE gcInfoBlock,
+ int cDumpBytes);
+ void DumpOffset (unsigned o);
+ void DumpOffsetEx(unsigned o);
+
+};
+
+/*****************************************************************************/
+#endif // __GC_DUMP_H__
+/*****************************************************************************/
diff --git a/src/inc/gchost.idl b/src/inc/gchost.idl
new file mode 100644
index 0000000000..3aa528f028
--- /dev/null
+++ b/src/inc/gchost.idl
@@ -0,0 +1,144 @@
+// 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.
+/* -------------------------------------------------------------------------- *
+ * Common Language Runtime Profiling interfaces
+ *
+ * The IGCHost allows a host environment to get statistics about the
+ * garbage collector as well as to gain some limited control over collections.
+ * This interface can be QueryInterface'd for on from the CorHost object.
+ * -------------------------------------------------------------------------- */
+import "unknwn.idl";
+
+#ifdef FEATURE_INCLUDE_ALL_INTERFACES
+typedef enum
+{
+ COR_GC_COUNTS = 0x00000001, // Fill out count values.
+ COR_GC_MEMORYUSAGE = 0x00000002, // Fill out memory usage values.
+} COR_GC_STAT_TYPES;
+
+typedef enum
+{
+ COR_GC_THREAD_HAS_PROMOTED_BYTES = 0x00000001 // Thread has bytes promoted in the last GC
+ // if flags set to this value.
+} COR_GC_THREAD_STATS_TYPES;
+
+#endif // FEATURE_INCLUDE_ALL_INTERFACES
+
+#if defined(FEATURE_INCLUDE_ALL_INTERFACES) || defined(FEATURE_WINDOWSPHONE)
+/*
+ * This structure is used to return statics for the GC system. Set the Flags
+ * value to a bitmask of values that should be returned. Only those values which
+ * are requested are calculated and returned to the caller.
+ */
+typedef struct _COR_GC_STATS
+{
+ ULONG Flags; // What values to get.
+
+ // Value when COR_GC_COUNTS is specified.
+ SIZE_T ExplicitGCCount; // How many times was GC forced to run by external request.
+ SIZE_T GenCollectionsTaken[3]; // Number of collections done for each generation
+
+ // Memory sizes, valid for COR_GC_MEMORYUSAGE.
+ SIZE_T CommittedKBytes; // Total committed bytes from all heaps.
+ SIZE_T ReservedKBytes; // Total reserved bytes from all heaps.
+ SIZE_T Gen0HeapSizeKBytes; // Size of gen 0 heap.
+ SIZE_T Gen1HeapSizeKBytes; // Size of gen 1 heap.
+ SIZE_T Gen2HeapSizeKBytes; // Size of gen 2 heap.
+ SIZE_T LargeObjectHeapSizeKBytes; // Size of large object heap.
+ SIZE_T KBytesPromotedFromGen0; // How many bytes promoted to next generation.
+ SIZE_T KBytesPromotedFromGen1;
+
+} COR_GC_STATS;
+#endif // FEATURE_INCLUDE_ALL_INTERFACES || FEATURE_WINDOWSPHONE
+
+#ifdef FEATURE_INCLUDE_ALL_INTERFACES
+/*
+ * This structure is used to return per-thread statistics related to GC.
+ */
+typedef struct _COR_GC_THREAD_STATS
+{
+ ULONGLONG PerThreadAllocation; // Amount of memory allocated on this
+ // thread. Cleared to 0 on each Gen 0 collection.
+ ULONG Flags; // Thread has bytes promoted in the last GC?
+} COR_GC_THREAD_STATS;
+
+
+/*
+ * This interface is used to get information about the GC system and
+ * control some aspects of the GC. This interface is for expert usage
+ * only, and can severely impact the performance of an application if
+ * used improperly!!
+ */
+[
+ object,
+ uuid(FAC34F6E-0DCD-47b5-8021-531BC5ECCA63),
+ pointer_default(unique),
+ local
+]
+interface IGCHost : IUnknown
+{
+
+ /*
+ * Sets the segment size and gen 0 maximum size. This value may only be
+ * specified once and will not change if called later.
+ */
+ HRESULT SetGCStartupLimits([in] DWORD SegmentSize, [in] DWORD MaxGen0Size);
+
+ /*
+ * Forces a collection to occur for the given generation, regardless of
+ * current GC statistics. A value of -1 means collect all generations.
+ */
+ HRESULT Collect([in] LONG Generation);
+
+ /*
+ * Returns a set of current statistics about the state of the GC system.
+ * These values can then be used by a smart allocation system to help the
+ * GC run, by say adding more memory or forcing a collection.
+ */
+ HRESULT GetStats([in][out] COR_GC_STATS *pStats);
+
+ /*
+ * This method returns the per-thread statics gathered by the GC.
+ */
+ HRESULT GetThreadStats([in] DWORD *pFiberCookie, [in][out] COR_GC_THREAD_STATS *pStats);
+
+ /*
+ * This method allows the caller to set virtual memory limit (MB) of the runtime. This limit
+ * can be changed dynamically.
+ */
+ HRESULT SetVirtualMemLimit ([in] SIZE_T sztMaxVirtualMemMB);
+}
+
+[
+ object,
+ uuid(A1D70CEC-2DBE-4E2F-9291-FDF81438A1DF),
+ pointer_default(unique),
+ local
+]
+interface IGCHost2 : IGCHost
+{
+ /*
+ * Sets the segment size and gen 0 maximum size. This value may only be
+ * specified once and will not change if called later.
+ */
+ HRESULT SetGCStartupLimitsEx([in] SIZE_T SegmentSize, [in] SIZE_T MaxGen0Size);
+}
+
+#else // FEATURE_INCLUDE_ALL_INTERFACES
+cpp_quote("/*")
+cpp_quote(" * WARNING - This is a dummy interface that should never be used.")
+cpp_quote(" * The code is written this way because Midl requires a CoClass, Interface, etc... that generates")
+cpp_quote(" * a guid. Removing the IGCHost interface for FEATURE_INCLUDE_ALL_INTERFACES removes the only guid")
+cpp_quote(" * This option was selected because ifdefs are not simple to implement for excluding files in SOURCES")
+cpp_quote("*/")
+[
+ object,
+ uuid(F9423916-2A35-4f03-9EE9-DDAFA3C8AEE0),
+ pointer_default(unique),
+ local
+]
+interface IDummyDoNotUse : IUnknown
+{
+}
+#endif // FEATURE_INCLUDE_ALL_INTERFACES
diff --git a/src/inc/gcinfo.h b/src/inc/gcinfo.h
new file mode 100644
index 0000000000..8d249a38a6
--- /dev/null
+++ b/src/inc/gcinfo.h
@@ -0,0 +1,82 @@
+// 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.
+
+
+/*****************************************************************************/
+#ifndef _GCINFO_H_
+#define _GCINFO_H_
+/*****************************************************************************/
+
+#include "daccess.h"
+#include "windef.h" // For BYTE
+
+// Some declarations in this file are used on non-x86 platforms, but most are x86-specific.
+
+// Use the lower 2 bits of the offsets stored in the tables
+// to encode properties
+
+const unsigned OFFSET_MASK = 0x3; // mask to access the low 2 bits
+
+//
+// Note for untracked locals the flags allowed are "pinned" and "byref"
+// and for tracked locals the flags allowed are "this" and "byref"
+// Note that these definitions should also match the definitions of
+// GC_CALL_INTERIOR and GC_CALL_PINNED in VM/gc.h
+//
+const unsigned byref_OFFSET_FLAG = 0x1; // the offset is an interior ptr
+const unsigned pinned_OFFSET_FLAG = 0x2; // the offset is a pinned ptr
+const unsigned this_OFFSET_FLAG = 0x2; // the offset is "this"
+
+//-----------------------------------------------------------------------------
+// The current GCInfo Version
+//-----------------------------------------------------------------------------
+
+#ifdef _TARGET_X86_
+// X86 GcInfo encoding is yet to be changed.
+#define GCINFO_VERSION 1
+#else
+#define GCINFO_VERSION 2
+#endif // _TARGET_X86_
+
+#define MIN_GCINFO_VERSION_WITH_RETURN_KIND 2
+#define MIN_GCINFO_VERSION_WITH_REV_PINVOKE_FRAME 2
+//-----------------------------------------------------------------------------
+// GCInfoToken: A wrapper that contains the GcInfo data and version number.
+//
+// The version# is not stored in the GcInfo structure -- because it is
+// wasteful to store the version once for every method.
+// Instead, the version# istracked per range-section of generated/loaded methods.
+//
+// The GCInfo version is computed as :
+// 1) The current GCINFO_VERSION for JITted and Ngened images
+// 2) A function of the Ready - to - run major version stored in READYTORUN_HEADER
+// for ready - to - run images.ReadyToRunJitManager::JitTokenToGCInfoVersion()
+// provides the GcInfo version for any Method.
+//-----------------------------------------------------------------------------
+
+struct GCInfoToken
+{
+ PTR_VOID Info;
+ UINT32 Version;
+
+ BOOL IsReturnKindAvailable()
+ {
+ return (Version >= MIN_GCINFO_VERSION_WITH_RETURN_KIND);
+ }
+ BOOL IsReversePInvokeFrameAvailable()
+ {
+ return (Version >= MIN_GCINFO_VERSION_WITH_REV_PINVOKE_FRAME);
+ }
+
+ static UINT32 ReadyToRunVersionToGcInfoVersion(UINT32 readyToRunMajorVersion)
+ {
+ // GcInfo version is 1 up to ReadyTorun version 1.x
+ // GcInfo version is current from ReadyToRun version 2.0
+ return (readyToRunMajorVersion == 1) ? 1 : GCINFO_VERSION;
+ }
+};
+
+/*****************************************************************************/
+#endif //_GCINFO_H_
+/*****************************************************************************/
diff --git a/src/inc/gcinfoarraylist.h b/src/inc/gcinfoarraylist.h
new file mode 100644
index 0000000000..c19f00d42f
--- /dev/null
+++ b/src/inc/gcinfoarraylist.h
@@ -0,0 +1,114 @@
+// 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.
+
+#ifndef _GCINFOARRAYLIST_H_
+#define _GCINFOARRAYLIST_H_
+
+// GCInfoArrayList is basically a more efficient linked list--it's useful for accumulating
+// lots of small fixed-size allocations into larger chunks which in a typical linked list
+// would incur an unnecessarily high amount of overhead.
+
+class GcInfoArrayListBase
+{
+private:
+ static const size_t GrowthFactor = 2;
+
+protected:
+ friend class IteratorBase;
+
+ struct ChunkBase
+ {
+ ChunkBase* m_next; // actually GcInfoArrayListChunk<ElementType>*
+ };
+
+ class IteratorBase
+ {
+ protected:
+ IteratorBase(GcInfoArrayListBase* list, size_t firstChunkCapacity);
+ ChunkBase* GetNextChunk(size_t& elementCount);
+
+ private:
+ GcInfoArrayListBase* m_list;
+ ChunkBase* m_currentChunk;
+ size_t m_currentChunkCount;
+ };
+
+ GcInfoArrayListBase(IAllocator* allocator);
+ virtual ~GcInfoArrayListBase();
+
+ void AppendNewChunk(size_t firstChunkCapacity, size_t elementSize, size_t chunkAlignment);
+
+public:
+ size_t Count()
+ {
+ return m_itemCount;
+ }
+
+protected:
+ IAllocator* m_allocator;
+ ChunkBase* m_firstChunk; // actually GcInfoArrayListChunk<ElementType>*
+ ChunkBase* m_lastChunk; // actually GcInfoArrayListChunk<ElementType>*
+ size_t m_lastChunkCount;
+ size_t m_lastChunkCapacity;
+ size_t m_itemCount;
+};
+
+template <typename ElementType, size_t FirstChunkCapacity>
+class GcInfoArrayList : public GcInfoArrayListBase
+{
+private:
+ struct Chunk : public ChunkBase
+ {
+ ElementType m_items[];
+ };
+
+public:
+ friend class Iterator;
+
+ struct Iterator : IteratorBase
+ {
+ Iterator(GcInfoArrayList* list)
+ : IteratorBase(list, FirstChunkCapacity)
+ {
+ }
+
+ ElementType* GetNext(size_t* elementCount)
+ {
+ Chunk* chunk = reinterpret_cast<Chunk*>(GetNextChunk(*elementCount));
+ return chunk == nullptr ? nullptr : &chunk->m_items[0];
+ }
+ };
+
+ GcInfoArrayList(IAllocator* allocator)
+ : GcInfoArrayListBase(allocator)
+ {
+ }
+
+ ElementType* Append()
+ {
+ if (m_lastChunk == nullptr || m_lastChunkCount == m_lastChunkCapacity)
+ {
+ AppendNewChunk(FirstChunkCapacity, sizeof(ElementType), __alignof(ElementType));
+ }
+
+ m_itemCount++;
+ m_lastChunkCount++;
+ return &reinterpret_cast<Chunk*>(m_lastChunk)->m_items[m_lastChunkCount - 1];
+ }
+
+ void CopyTo(ElementType* dest)
+ {
+ Iterator iter(this);
+ ElementType* source;
+ size_t elementCount;
+
+ while (source = iter.GetNext(&elementCount), source != nullptr)
+ {
+ memcpy(dest, source, elementCount * sizeof(ElementType));
+ dest += elementCount;
+ }
+ }
+};
+
+#endif
diff --git a/src/inc/gcinfodecoder.h b/src/inc/gcinfodecoder.h
new file mode 100644
index 0000000000..c77c3598b0
--- /dev/null
+++ b/src/inc/gcinfodecoder.h
@@ -0,0 +1,661 @@
+// 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.
+
+/*****************************************************************
+ *
+ * GC Information Decoding API
+ *
+ *****************************************************************/
+
+#ifndef _GC_INFO_DECODER_
+#define _GC_INFO_DECODER_
+
+#include "gcinfotypes.h"
+
+#define _max(a, b) (((a) > (b)) ? (a) : (b))
+#define _min(a, b) (((a) < (b)) ? (a) : (b))
+
+#ifndef GCINFODECODER_NO_EE
+
+#include "eetwain.h"
+
+#else // GCINFODECODER_NO_EE
+
+// Stuff from cgencpu.h:
+
+#ifndef __cgencpu_h__
+
+inline void SetIP(T_CONTEXT* context, PCODE rip)
+{
+ _ASSERTE(!"don't call this");
+}
+
+inline TADDR GetSP(T_CONTEXT* context)
+{
+#ifdef _TARGET_AMD64_
+ return (TADDR)context->Rsp;
+#elif defined(_TARGET_ARM_)
+ return (TADDR)context->Sp;
+#elif defined(_TARGET_ARM64_)
+ return (TADDR)context->Sp;
+#else
+ _ASSERTE(!"nyi for platform");
+#endif
+}
+
+inline PCODE GetIP(T_CONTEXT* context)
+{
+#ifdef _TARGET_AMD64_
+ return (PCODE) context->Rip;
+#elif defined(_TARGET_ARM_)
+ return (PCODE)context->Pc;
+#elif defined(_TARGET_ARM64_)
+ return (PCODE)context->Pc;
+#else
+ _ASSERTE(!"nyi for platform");
+#endif
+}
+
+#endif // !__cgencpu_h__
+
+// Misc. VM types:
+
+#ifndef DEFINE_OBJECTREF
+#define DEFINE_OBJECTREF
+class Object;
+typedef Object *OBJECTREF;
+#endif
+typedef SIZE_T TADDR;
+
+// Stuff from gc.h:
+
+#ifndef __GC_H
+
+#define GC_CALL_INTERIOR 0x1
+#define GC_CALL_PINNED 0x2
+
+#endif // !__GC_H
+
+// Stuff from stdmacros.h (can't include because it includes contract.h, which uses #pragma once)
+
+#ifndef _stdmacros_h_
+
+inline BOOL IS_ALIGNED( size_t val, size_t alignment )
+{
+ // alignment must be a power of 2 for this implementation to work (need modulo otherwise)
+ _ASSERTE( 0 == (alignment & (alignment - 1)) );
+ return 0 == (val & (alignment - 1));
+}
+inline BOOL IS_ALIGNED( void* val, size_t alignment )
+{
+ return IS_ALIGNED( (size_t) val, alignment );
+}
+
+#define FMT_REG "r%d "
+#define FMT_STK "sp%s0x%02x "
+
+#define DBG_STK(off) \
+ (off >= 0) ? "+" : "-", \
+ (off >= 0) ? off : -off
+
+#endif
+
+// Stuff from check.h:
+
+#ifndef UNREACHABLE
+#define UNREACHABLE() __assume(0)
+#endif
+
+// Stuff from eetwain.h:
+
+#ifndef _EETWAIN_H
+
+typedef void (*GCEnumCallback)(
+ LPVOID hCallback, // callback data
+ OBJECTREF* pObject, // address of obect-reference we are reporting
+ uint32_t flags // is this a pinned and/or interior pointer
+);
+
+#ifndef _strike_h
+
+enum ICodeManagerFlags
+{
+ ActiveStackFrame = 0x0001, // this is the currently active function
+ ExecutionAborted = 0x0002, // execution of this function has been aborted
+ // (i.e. it will not continue execution at the
+ // current location)
+ ParentOfFuncletStackFrame
+ = 0x0040, // A funclet for this frame was previously reported
+
+ NoReportUntracked
+ = 0x0080, // EnumGCRefs/EnumerateLiveSlots should *not* include
+ // any untracked slots
+};
+
+#endif // !_strike_h
+
+#if !defined(_TARGET_X86_)
+#define USE_GC_INFO_DECODER
+#endif
+
+#include "regdisp.h"
+
+#endif // !_EETWAIN_H
+
+#endif // GCINFODECODER_NO_EE
+
+#include "gcinfotypes.h"
+
+#ifdef _DEBUG
+ #define MAX_PREDECODED_SLOTS 4
+#else
+ #define MAX_PREDECODED_SLOTS 64
+#endif
+
+#if defined(FEATURE_PAL) && !defined(STATIC_CONTRACT_SUPPORTS_DAC_HOST_ONLY)
+#define STATIC_CONTRACT_SUPPORTS_DAC_HOST_ONLY
+#endif
+
+
+
+enum GcInfoDecoderFlags
+{
+ DECODE_EVERYTHING = 0x0,
+ DECODE_SECURITY_OBJECT = 0x01, // stack location of security object
+ DECODE_CODE_LENGTH = 0x02,
+ DECODE_VARARG = 0x04,
+ DECODE_INTERRUPTIBILITY = 0x08,
+ DECODE_GC_LIFETIMES = 0x10,
+ DECODE_NO_VALIDATION = 0x20,
+ DECODE_PSP_SYM = 0x40,
+ DECODE_GENERICS_INST_CONTEXT = 0x80, // stack location of instantiation context for generics
+ // (this may be either the 'this' ptr or the instantiation secret param)
+ DECODE_GS_COOKIE = 0x100, // stack location of the GS cookie
+ DECODE_FOR_RANGES_CALLBACK = 0x200,
+ DECODE_PROLOG_LENGTH = 0x400, // length of the prolog (used to avoid reporting generics context)
+ DECODE_EDIT_AND_CONTINUE = 0x800,
+ DECODE_REVERSE_PINVOKE_VAR = 0x1000,
+ DECODE_RETURN_KIND = 0x2000
+};
+
+enum GcInfoHeaderFlags
+{
+ GC_INFO_IS_VARARG = 0x1,
+ GC_INFO_HAS_SECURITY_OBJECT = 0x2,
+ GC_INFO_HAS_GS_COOKIE = 0x4,
+ GC_INFO_HAS_PSP_SYM = 0x8,
+ GC_INFO_HAS_GENERICS_INST_CONTEXT_MASK = 0x30,
+ GC_INFO_HAS_GENERICS_INST_CONTEXT_NONE = 0x00,
+ GC_INFO_HAS_GENERICS_INST_CONTEXT_MT = 0x10,
+ GC_INFO_HAS_GENERICS_INST_CONTEXT_MD = 0x20,
+ GC_INFO_HAS_GENERICS_INST_CONTEXT_THIS = 0x30,
+ GC_INFO_HAS_STACK_BASE_REGISTER = 0x40,
+ GC_INFO_WANTS_REPORT_ONLY_LEAF = 0x80,
+ GC_INFO_HAS_EDIT_AND_CONTINUE_PRESERVED_SLOTS = 0x100,
+ GC_INFO_REVERSE_PINVOKE_FRAME = 0x200,
+
+ GC_INFO_FLAGS_BIT_SIZE_VERSION_1 = 9,
+ GC_INFO_FLAGS_BIT_SIZE = 10,
+};
+
+class BitStreamReader
+{
+public:
+ BitStreamReader()
+ {
+ SUPPORTS_DAC;
+ }
+
+ BitStreamReader( PTR_CBYTE pBuffer )
+ {
+ SUPPORTS_DAC;
+
+ _ASSERTE( pBuffer != NULL );
+
+ m_pCurrent = m_pBuffer = dac_cast<PTR_size_t>((size_t)dac_cast<TADDR>(pBuffer) & ~((size_t)sizeof(size_t)-1));
+ m_RelPos = m_InitialRelPos = (int)((size_t)dac_cast<TADDR>(pBuffer) % sizeof(size_t)) * 8;
+ }
+
+ BitStreamReader(const BitStreamReader& other)
+ {
+ SUPPORTS_DAC;
+
+ m_pBuffer = other.m_pBuffer;
+ m_InitialRelPos = other.m_InitialRelPos;
+ m_pCurrent = other.m_pCurrent;
+ m_RelPos = other.m_RelPos;
+ }
+
+ const BitStreamReader& operator=(const BitStreamReader& other)
+ {
+ SUPPORTS_DAC;
+
+ m_pBuffer = other.m_pBuffer;
+ m_InitialRelPos = other.m_InitialRelPos;
+ m_pCurrent = other.m_pCurrent;
+ m_RelPos = other.m_RelPos;
+ return *this;
+ }
+
+ // NOTE: This routine is perf-critical
+ __forceinline size_t Read( int numBits )
+ {
+ SUPPORTS_DAC;
+
+ _ASSERTE(numBits > 0 && numBits <= BITS_PER_SIZE_T);
+
+ size_t result = (*m_pCurrent) >> m_RelPos;
+ int newRelPos = m_RelPos + numBits;
+ if(newRelPos >= BITS_PER_SIZE_T)
+ {
+ m_pCurrent++;
+ newRelPos -= BITS_PER_SIZE_T;
+ if(newRelPos > 0)
+ {
+ size_t extraBits = (*m_pCurrent) << (numBits - newRelPos);
+ result ^= extraBits;
+ }
+ }
+ m_RelPos = newRelPos;
+ result &= SAFE_SHIFT_LEFT(1, numBits) - 1;
+ return result;
+ }
+
+ // This version reads one bit, returning zero/non-zero (not 0/1)
+ // NOTE: This routine is perf-critical
+ __forceinline size_t ReadOneFast()
+ {
+ SUPPORTS_DAC;
+
+ size_t result = (*m_pCurrent) & (((size_t)1) << m_RelPos);
+ if(++m_RelPos == BITS_PER_SIZE_T)
+ {
+ m_pCurrent++;
+ m_RelPos = 0;
+ }
+ return result;
+ }
+
+
+ __forceinline size_t GetCurrentPos()
+ {
+ SUPPORTS_DAC;
+ return (size_t) ((m_pCurrent - m_pBuffer) * BITS_PER_SIZE_T + m_RelPos - m_InitialRelPos);
+ }
+
+ __forceinline void SetCurrentPos( size_t pos )
+ {
+ STATIC_CONTRACT_SUPPORTS_DAC_HOST_ONLY; // note: this will set only the host instance, not the target instance
+
+ size_t adjPos = pos + m_InitialRelPos;
+ m_pCurrent = m_pBuffer + adjPos / BITS_PER_SIZE_T;
+ m_RelPos = (int)(adjPos % BITS_PER_SIZE_T);
+ _ASSERTE(GetCurrentPos() == pos);
+ }
+
+ __forceinline void Skip( SSIZE_T numBitsToSkip )
+ {
+ SUPPORTS_DAC;
+
+ SetCurrentPos(GetCurrentPos() + numBitsToSkip);
+ }
+
+ __forceinline void AlignUpToByte()
+ {
+ if(m_RelPos <= BITS_PER_SIZE_T - 8)
+ {
+ m_RelPos = (m_RelPos + 7) & ~7;
+ }
+ else
+ {
+ m_RelPos = 0;
+ m_pCurrent++;
+ }
+ }
+
+ __forceinline size_t ReadBitAtPos( size_t pos )
+ {
+ size_t adjPos = pos + m_InitialRelPos;
+ size_t* ptr = m_pBuffer + adjPos / BITS_PER_SIZE_T;
+ int relPos = (int)(adjPos % BITS_PER_SIZE_T);
+ return (*ptr) & (((size_t)1) << relPos);
+ }
+
+
+ //--------------------------------------------------------------------------
+ // Decode variable length numbers
+ // See the corresponding methods on BitStreamWriter for more information on the format
+ //--------------------------------------------------------------------------
+
+ inline size_t DecodeVarLengthUnsigned( int base )
+ {
+ _ASSERTE((base > 0) && (base < (int)BITS_PER_SIZE_T));
+ size_t numEncodings = 1 << base;
+ size_t result = 0;
+ for(int shift=0; ; shift+=base)
+ {
+ _ASSERTE(shift+base <= (int)BITS_PER_SIZE_T);
+
+ size_t currentChunk = Read(base+1);
+ result |= (currentChunk & (numEncodings-1)) << shift;
+ if(!(currentChunk & numEncodings))
+ {
+ // Extension bit is not set, we're done.
+ return result;
+ }
+ }
+ }
+
+ inline SSIZE_T DecodeVarLengthSigned( int base )
+ {
+ _ASSERTE((base > 0) && (base < (int)BITS_PER_SIZE_T));
+ size_t numEncodings = 1 << base;
+ SSIZE_T result = 0;
+ for(int shift=0; ; shift+=base)
+ {
+ _ASSERTE(shift+base <= (int)BITS_PER_SIZE_T);
+
+ size_t currentChunk = Read(base+1);
+ result |= (currentChunk & (numEncodings-1)) << shift;
+ if(!(currentChunk & numEncodings))
+ {
+ // Extension bit is not set, sign-extend and we're done.
+ int sbits = BITS_PER_SIZE_T - (shift+base);
+ result <<= sbits;
+ result >>= sbits; // This provides the sign extension
+ return result;
+ }
+ }
+ }
+
+private:
+ PTR_size_t m_pBuffer;
+ int m_InitialRelPos;
+ PTR_size_t m_pCurrent;
+ int m_RelPos;
+};
+
+struct GcSlotDesc
+{
+ union
+ {
+ UINT32 RegisterNumber;
+ GcStackSlot Stack;
+ } Slot;
+ GcSlotFlags Flags;
+};
+
+class GcSlotDecoder
+{
+public:
+ GcSlotDecoder()
+ {}
+
+ void DecodeSlotTable(BitStreamReader& reader);
+
+ UINT32 GetNumSlots()
+ {
+ return m_NumSlots;
+ }
+
+ UINT32 GetNumUntracked()
+ {
+ return m_NumUntracked;
+ }
+
+ UINT32 GetNumTracked()
+ {
+ return m_NumSlots - m_NumUntracked;
+ }
+
+ UINT32 GetNumRegisters()
+ {
+ return m_NumRegisters;
+ }
+
+ const GcSlotDesc* GetSlotDesc(UINT32 slotIndex);
+
+private:
+ GcSlotDesc m_SlotArray[MAX_PREDECODED_SLOTS];
+ BitStreamReader m_SlotReader;
+ UINT32 m_NumSlots;
+ UINT32 m_NumRegisters;
+ UINT32 m_NumUntracked;
+
+ UINT32 m_NumDecodedSlots;
+ GcSlotDesc* m_pLastSlot;
+};
+
+class GcInfoDecoder
+{
+public:
+
+ // If you are not insterested in interruptibility or gc lifetime information, pass 0 as instructionOffset
+ GcInfoDecoder(
+ GCInfoToken gcInfoToken,
+ GcInfoDecoderFlags flags = DECODE_EVERYTHING,
+ UINT32 instructionOffset = 0
+ );
+
+ //------------------------------------------------------------------------
+ // Interruptibility
+ //------------------------------------------------------------------------
+
+ bool IsInterruptible();
+
+#ifdef PARTIALLY_INTERRUPTIBLE_GC_SUPPORTED
+ // This is used for gccoverage
+ bool IsSafePoint(UINT32 codeOffset);
+
+ typedef void EnumerateSafePointsCallback (UINT32 offset, LPVOID hCallback);
+ void EnumerateSafePoints(EnumerateSafePointsCallback *pCallback, LPVOID hCallback);
+
+#endif
+ // Returns true to stop enumerating.
+ typedef bool EnumerateInterruptibleRangesCallback (UINT32 startOffset, UINT32 stopOffset, LPVOID hCallback);
+
+ void EnumerateInterruptibleRanges (
+ EnumerateInterruptibleRangesCallback *pCallback,
+ LPVOID hCallback);
+
+ //------------------------------------------------------------------------
+ // GC lifetime information
+ //------------------------------------------------------------------------
+
+ bool EnumerateLiveSlots(
+ PREGDISPLAY pRD,
+ bool reportScratchSlots,
+ unsigned flags,
+ GCEnumCallback pCallBack,
+ LPVOID hCallBack
+ );
+
+ // Public for the gc info dumper
+ void EnumerateUntrackedSlots(
+ PREGDISPLAY pRD,
+ unsigned flags,
+ GCEnumCallback pCallBack,
+ LPVOID hCallBack
+ );
+
+ //------------------------------------------------------------------------
+ // Miscellaneous method information
+ //------------------------------------------------------------------------
+
+ INT32 GetSecurityObjectStackSlot();
+ INT32 GetGSCookieStackSlot();
+ UINT32 GetGSCookieValidRangeStart();
+ UINT32 GetGSCookieValidRangeEnd();
+ UINT32 GetPrologSize();
+ INT32 GetPSPSymStackSlot();
+ INT32 GetGenericsInstContextStackSlot();
+ INT32 GetReversePInvokeStackSlot();
+ bool HasMethodDescGenericsInstContext();
+ bool HasMethodTableGenericsInstContext();
+ bool GetIsVarArg();
+ bool WantsReportOnlyLeaf();
+ ReturnKind GetReturnKind();
+ UINT32 GetCodeLength();
+ UINT32 GetStackBaseRegister();
+ UINT32 GetSizeOfEditAndContinuePreservedArea();
+ size_t GetNumBytesRead();
+
+#ifdef FIXED_STACK_PARAMETER_SCRATCH_AREA
+ UINT32 GetSizeOfStackParameterArea();
+#endif // FIXED_STACK_PARAMETER_SCRATCH_AREA
+
+
+private:
+ BitStreamReader m_Reader;
+ UINT32 m_InstructionOffset;
+
+ // Pre-decoded information
+ bool m_IsInterruptible;
+ bool m_IsVarArg;
+ bool m_GenericSecretParamIsMD;
+ bool m_GenericSecretParamIsMT;
+ bool m_WantsReportOnlyLeaf;
+ INT32 m_SecurityObjectStackSlot;
+ INT32 m_GSCookieStackSlot;
+ INT32 m_ReversePInvokeStackSlot;
+ UINT32 m_ValidRangeStart;
+ UINT32 m_ValidRangeEnd;
+ INT32 m_PSPSymStackSlot;
+ INT32 m_GenericsInstContextStackSlot;
+ UINT32 m_CodeLength;
+ UINT32 m_StackBaseRegister;
+ UINT32 m_SizeOfEditAndContinuePreservedArea;
+ INT32 m_ReversePInvokeFrameSlot;
+ ReturnKind m_ReturnKind;
+#ifdef PARTIALLY_INTERRUPTIBLE_GC_SUPPORTED
+ UINT32 m_NumSafePoints;
+ UINT32 m_SafePointIndex;
+ UINT32 FindSafePoint(UINT32 codeOffset);
+#endif
+ UINT32 m_NumInterruptibleRanges;
+
+#ifdef FIXED_STACK_PARAMETER_SCRATCH_AREA
+ UINT32 m_SizeOfStackOutgoingAndScratchArea;
+#endif // FIXED_STACK_PARAMETER_SCRATCH_AREA
+
+#ifdef _DEBUG
+ GcInfoDecoderFlags m_Flags;
+ PTR_CBYTE m_GcInfoAddress;
+#endif
+ UINT32 m_Version;
+
+ static bool SetIsInterruptibleCB (UINT32 startOffset, UINT32 stopOffset, LPVOID hCallback);
+
+ OBJECTREF* GetRegisterSlot(
+ int regNum,
+ PREGDISPLAY pRD
+ );
+
+#ifdef FEATURE_PAL
+ OBJECTREF* GetCapturedRegister(
+ int regNum,
+ PREGDISPLAY pRD
+ );
+#endif // FEATURE_PAL
+
+ OBJECTREF* GetStackSlot(
+ INT32 spOffset,
+ GcStackSlotBase spBase,
+ PREGDISPLAY pRD
+ );
+
+#ifdef DACCESS_COMPILE
+ int GetStackReg(int spBase);
+#endif // DACCESS_COMPILE
+
+ bool IsScratchRegister(int regNum, PREGDISPLAY pRD);
+ bool IsScratchStackSlot(INT32 spOffset, GcStackSlotBase spBase, PREGDISPLAY pRD);
+
+ void ReportUntrackedSlots(
+ GcSlotDecoder& slotDecoder,
+ PREGDISPLAY pRD,
+ unsigned flags,
+ GCEnumCallback pCallBack,
+ LPVOID hCallBack
+ );
+
+ void ReportRegisterToGC(
+ int regNum,
+ unsigned gcFlags,
+ PREGDISPLAY pRD,
+ unsigned flags,
+ GCEnumCallback pCallBack,
+ LPVOID hCallBack
+ );
+
+ void ReportStackSlotToGC(
+ INT32 spOffset,
+ GcStackSlotBase spBase,
+ unsigned gcFlags,
+ PREGDISPLAY pRD,
+ unsigned flags,
+ GCEnumCallback pCallBack,
+ LPVOID hCallBack
+ );
+
+
+ inline void ReportSlotToGC(
+ GcSlotDecoder& slotDecoder,
+ UINT32 slotIndex,
+ PREGDISPLAY pRD,
+ bool reportScratchSlots,
+ unsigned inputFlags,
+ GCEnumCallback pCallBack,
+ LPVOID hCallBack
+ )
+ {
+ _ASSERTE(slotIndex < slotDecoder.GetNumSlots());
+ const GcSlotDesc* pSlot = slotDecoder.GetSlotDesc(slotIndex);
+
+ if(slotIndex < slotDecoder.GetNumRegisters())
+ {
+ UINT32 regNum = pSlot->Slot.RegisterNumber;
+ if( reportScratchSlots || !IsScratchRegister( regNum, pRD ) )
+ {
+ ReportRegisterToGC(
+ regNum,
+ pSlot->Flags,
+ pRD,
+ inputFlags,
+ pCallBack,
+ hCallBack
+ );
+ }
+ else
+ {
+ LOG((LF_GCROOTS, LL_INFO1000, "\"Live\" scratch register " FMT_REG " not reported\n", regNum));
+ }
+ }
+ else
+ {
+ INT32 spOffset = pSlot->Slot.Stack.SpOffset;
+ GcStackSlotBase spBase = pSlot->Slot.Stack.Base;
+ if( reportScratchSlots || !IsScratchStackSlot(spOffset, spBase, pRD) )
+ {
+ ReportStackSlotToGC(
+ spOffset,
+ spBase,
+ pSlot->Flags,
+ pRD,
+ inputFlags,
+ pCallBack,
+ hCallBack
+ );
+ }
+ else
+ {
+ LOG((LF_GCROOTS, LL_INFO1000, "\"Live\" scratch stack slot " FMT_STK " not reported\n", DBG_STK(spOffset)));
+ }
+ }
+ }
+};
+
+
+#endif // _GC_INFO_DECODER_
+
diff --git a/src/inc/gcinfodumper.h b/src/inc/gcinfodumper.h
new file mode 100644
index 0000000000..296dd29543
--- /dev/null
+++ b/src/inc/gcinfodumper.h
@@ -0,0 +1,117 @@
+// 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.
+
+#ifndef __GCINFODUMPER_H__
+#define __GCINFODUMPER_H__
+
+#include "gcinfotypes.h"
+#include "gcinfodecoder.h"
+
+
+//
+// This class dumps the contents of the gc encodings, providing outputs
+// similar to the inputs to GcInfoEncoder. This uses the same GcInfoDecoder
+// functions that the EE uses (vs. decoding the bits directly).
+//
+class GcInfoDumper
+{
+public:
+
+ GcInfoDumper (GCInfoToken gcInfoToken);
+ ~GcInfoDumper ();
+
+ // Returns TRUE to stop decoding.
+ typedef BOOL InterruptibleStateChangeProc (
+ UINT32 CodeOffset,
+ BOOL fInterruptible,
+ PVOID pvData);
+
+ // Returns TRUE to stop decoding.
+ typedef BOOL OnSafePointProc (
+ UINT32 CodeOffset,
+ PVOID pvData);
+
+ // Returns TRUE to stop decoding.
+ typedef BOOL RegisterStateChangeProc (
+ UINT32 CodeOffset,
+ UINT32 RegisterNumber,
+ GcSlotFlags Flags,
+ GcSlotState NewState,
+ PVOID pvData);
+
+ // Returns TRUE to stop decoding.
+ typedef BOOL StackSlotStateChangeProc (
+ UINT32 CodeOffset,
+ GcSlotFlags flags,
+ GcStackSlotBase BaseRegister,
+ SSIZE_T StackOffset,
+ GcSlotState NewState,
+ PVOID pvData);
+
+ enum EnumerateStateChangesResults
+ {
+ SUCCESS = 0,
+ OUT_OF_MEMORY,
+ REPORTED_REGISTER_IN_CALLERS_FRAME,
+ REPORTED_FRAME_POINTER,
+ REPORTED_INVALID_BASE_REGISTER,
+ REPORTED_INVALID_POINTER,
+ DECODER_FAILED,
+ };
+
+ // Returns TRUE if successful. FALSE if out of memory, invalid data, etc.
+ EnumerateStateChangesResults EnumerateStateChanges (
+ InterruptibleStateChangeProc *pfnInterruptibleStateChange,
+ RegisterStateChangeProc *pfnRegisterStateChange,
+ StackSlotStateChangeProc *pfnStackSlotStateChange,
+ OnSafePointProc *pfnSafePointFunc,
+ PVOID pvData);
+
+ size_t GetGCInfoSize();
+
+private:
+
+ struct LivePointerRecord
+ {
+ OBJECTREF *ppObject;
+ DWORD flags;
+ LivePointerRecord *pNext;
+ UINT marked;
+ };
+
+ GCInfoToken m_gcTable;
+ UINT32 m_StackBaseRegister;
+ UINT32 m_SizeOfEditAndContinuePreservedArea;
+ LivePointerRecord *m_pRecords;
+ RegisterStateChangeProc *m_pfnRegisterStateChange;
+ StackSlotStateChangeProc *m_pfnStackSlotStateChange;
+ PVOID m_pvCallbackData;
+ EnumerateStateChangesResults m_Error;
+ size_t m_gcInfoSize;
+
+ static void LivePointerCallback (
+ LPVOID hCallback, // callback data
+ OBJECTREF* pObject, // address of obect-reference we are reporting
+ uint32_t flags // is this a pinned and/or interior pointer
+ DAC_ARG(DacSlotLocation loc)); // the location the pointer came from
+
+ static void FreePointerRecords (LivePointerRecord *pRecords);
+
+ // Return TRUE if callback requested to stop decoding.
+ BOOL ReportPointerRecord (
+ UINT32 CodeOffset,
+ BOOL fLive,
+ REGDISPLAY *pRD,
+ LivePointerRecord *pRecord);
+
+ // Return TRUE if callback requested to stop decoding.
+ BOOL ReportPointerDifferences (
+ UINT32 offset,
+ REGDISPLAY *pRD,
+ LivePointerRecord *pPrevState);
+};
+
+
+#endif // !__GCINFODUMPER_H__
+
diff --git a/src/inc/gcinfoencoder.h b/src/inc/gcinfoencoder.h
new file mode 100644
index 0000000000..838f1babf7
--- /dev/null
+++ b/src/inc/gcinfoencoder.h
@@ -0,0 +1,552 @@
+// 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.
+/*****************************************************************
+ *
+ * GC Information Encoding API
+ *
+ *****************************************************************/
+
+/*****************************************************************
+
+ ENCODING LAYOUT
+
+ 1. Header
+
+ Slim Header for simple and common cases:
+ - EncodingType[Slim]
+ - ReturnKind (Fat: 2 bits)
+ - CodeLength
+ - NumCallSites (#ifdef PARTIALLY_INTERRUPTIBLE_GC_SUPPORTED)
+
+ Fat Header for other cases:
+ - EncodingType[Fat]
+ - Flag: isVarArg,
+ hasSecurityObject,
+ hasGSCookie,
+ hasPSPSymStackSlot,
+ hasGenericsInstContextStackSlot,
+ hasStackBaseregister,
+ wantsReportOnlyLeaf,
+ hasSizeOfEditAndContinuePreservedArea
+ hasReversePInvokeFrame,
+ - ReturnKind (Fat: 4 bits)
+ - CodeLength
+ - Prolog (if hasSecurityObject || hasGenericsInstContextStackSlot || hasGSCookie)
+ - Epilog (if hasGSCookie)
+ - SecurityObjectStackSlot (if any)
+ - GSCookieStackSlot (if any)
+ - PSPSymStackSlot (if any)
+ - GenericsInstContextStackSlot (if any)
+ - StackBaseRegister (if any)
+ - SizeOfEditAndContinuePreservedArea (if any)
+ - ReversePInvokeFrameSlot (if any)
+ - SizeOfStackOutgoingAndScratchArea (#ifdef FIXED_STACK_PARAMETER_SCRATCH_AREA)
+ - NumCallSites (#ifdef PARTIALLY_INTERRUPTIBLE_GC_SUPPORTED)
+ - NumInterruptibleRanges
+
+ 2. Call sites offsets (#ifdef PARTIALLY_INTERRUPTIBLE_GC_SUPPORTED)
+ 3. Fully-interruptible ranges
+ 4. Slot table
+ 5. GC state at call sites (#ifdef PARTIALLY_INTERRUPTIBLE_GC_SUPPORTED)
+ 6. GC state at try clauses (#ifdef PARTIALLY_INTERRUPTIBLE_GC_SUPPORTED)
+ 7. Chunk pointers
+ 8. Chunk encodings
+
+
+ STANDALONE_BUILD
+
+ The STANDALONE_BUILD switch can be used to build the GcInfoEncoder library
+ independently by clients outside the CoreClr tree.
+
+ The GcInfo library uses some custom data-structures (ex: ArrayList, SimplerHashTable)
+ and includes some utility libraries (ex: UtilCode) which pull in several other
+ headers with considerable unrelated content. Rather than porting all the
+ utility code to suite other clients, the STANDALONE_BUILD switch can be used
+ to include only the minimal set of headers specific to GcInfo encodings.
+
+ Clients of STANDALONE_BUILD will likely use standard library
+ implementations of data-structures like ArrayList, HashMap etc., in place
+ of the custom implementation currently used by GcInfoEncoder.
+
+ Rather than spew the GcInfoEnoder code with
+ #ifdef STANDALONE_BUILD ... #else .. #endif blocks, we include a special
+ header GcInfoUtil.h in STANDALONE_BUILD mode. GcInfoUtil.h is expected to
+ supply the interface/implementation for the data-structures and utilities
+ used by GcInfoEncoder. This header should be provided by the clients doing
+ the standalone build in their source tree.
+
+*****************************************************************/
+
+
+#ifndef __GCINFOENCODER_H__
+#define __GCINFOENCODER_H__
+
+#ifdef STANDALONE_BUILD
+#include <wchar.h>
+#include <stdio.h>
+#include "GcInfoUtil.h"
+#include "corjit.h"
+#else
+#include <windows.h>
+#include <wchar.h>
+#include <stdio.h>
+#include "corjit.h"
+#include "iallocator.h"
+#include "gcinfoarraylist.h"
+#include "stdmacros.h"
+#include "eexcp.h"
+#endif
+
+#include "gcinfotypes.h"
+
+#ifdef MEASURE_GCINFO
+struct GcInfoSize
+{
+ size_t TotalSize;
+
+ size_t NumMethods;
+ size_t NumCallSites;
+ size_t NumRanges;
+ size_t NumRegs;
+ size_t NumStack;
+ size_t NumEh;
+ size_t NumTransitions;
+ size_t SizeOfCode;
+
+ size_t FlagsSize;
+ size_t RetKindSize;
+ size_t CodeLengthSize;
+ size_t ProEpilogSize;
+ size_t SecObjSize;
+ size_t GsCookieSize;
+ size_t PspSymSize;
+ size_t GenericsCtxSize;
+ size_t StackBaseSize;
+ size_t ReversePInvokeFrameSize;
+ size_t FixedAreaSize;
+ size_t NumCallSitesSize;
+ size_t NumRangesSize;
+ size_t CallSitePosSize;
+ size_t RangeSize;
+ size_t NumRegsSize;
+ size_t NumStackSize;
+ size_t RegSlotSize;
+ size_t StackSlotSize;
+ size_t CallSiteStateSize;
+ size_t NumEhSize;
+ size_t EhPosSize;
+ size_t EhStateSize;
+ size_t ChunkPtrSize;
+ size_t ChunkMaskSize;
+ size_t ChunkFinalStateSize;
+ size_t ChunkTransitionSize;
+
+ GcInfoSize();
+ GcInfoSize& operator+=(const GcInfoSize& other);
+ void Log(DWORD level, const char * header);
+};
+#endif
+
+struct GcSlotDesc
+{
+ union
+ {
+ UINT32 RegisterNumber;
+ GcStackSlot Stack;
+ } Slot;
+ GcSlotFlags Flags;
+
+ BOOL IsRegister() const
+ {
+ return (Flags & GC_SLOT_IS_REGISTER);
+ }
+ BOOL IsInterior() const
+ {
+ return (Flags & GC_SLOT_INTERIOR);
+ }
+ BOOL IsPinned() const
+ {
+ return (Flags & GC_SLOT_PINNED);
+ }
+ BOOL IsUntracked() const
+ {
+ return (Flags & GC_SLOT_UNTRACKED);
+ }
+ BOOL IsDeleted() const
+ {
+ return (Flags & GC_SLOT_IS_DELETED);
+ }
+ void MarkDeleted()
+ {
+ Flags = (GcSlotFlags) (Flags | GC_SLOT_IS_DELETED);
+ }
+};
+
+class BitArray;
+class BitStreamWriter
+{
+public:
+ BitStreamWriter( IAllocator* pAllocator );
+
+ // bit 0 is the least significative bit
+ void Write( size_t data, UINT32 count );
+ void Write( BitArray& a, UINT32 count );
+
+ inline size_t GetBitCount()
+ {
+ return m_BitCount;
+ }
+
+ inline size_t GetByteCount()
+ {
+ return ( m_BitCount + 7 ) / 8;
+ }
+
+
+ void CopyTo( BYTE* buffer );
+ void Dispose();
+
+ //--------------------------------------------------------
+ // Compute the number of bits used to encode variable length numbers
+ // Uses base+1 bits at minimum
+ // Bits 0..(base-1) represent the encoded quantity
+ // If it doesn't fit, set bit #base to 1 and use base+1 more bits
+ //--------------------------------------------------------
+ static int SizeofVarLengthUnsigned( size_t n, UINT32 base );
+
+ //--------------------------------------------------------
+ // Encode variable length numbers
+ // Uses base+1 bits at minimum
+ // Bits 0..(base-1) represent the encoded quantity
+ // If it doesn't fit, set bit #base to 1 and use base+1 more bits
+ //--------------------------------------------------------
+ int EncodeVarLengthUnsigned( size_t n, UINT32 base );
+
+ //--------------------------------------------------------
+ // Signed quantities are encoded the same as unsigned
+ // The most relevant difference is that a number is considered
+ // to fit in base bits if the topmost bit of a base-long chunk
+ // matches the sign of the whole number
+ //--------------------------------------------------------
+ int EncodeVarLengthSigned( SSIZE_T n, UINT32 base );
+
+private:
+ class MemoryBlockList;
+ class MemoryBlock
+ {
+ friend class MemoryBlockList;
+ MemoryBlock* m_next;
+
+ public:
+ size_t Contents[];
+
+ inline MemoryBlock* Next()
+ {
+ return m_next;
+ }
+ };
+
+ class MemoryBlockList
+ {
+ MemoryBlock* m_head;
+ MemoryBlock* m_tail;
+
+ public:
+ MemoryBlockList();
+
+ inline MemoryBlock* Head()
+ {
+ return m_head;
+ }
+
+ MemoryBlock* AppendNew(IAllocator* allocator, size_t bytes);
+ void Dispose(IAllocator* allocator);
+ };
+
+ IAllocator* m_pAllocator;
+ size_t m_BitCount;
+ UINT32 m_FreeBitsInCurrentSlot;
+ MemoryBlockList m_MemoryBlocks;
+ const static int m_MemoryBlockSize = 128; // must be a multiple of the pointer size
+ size_t* m_pCurrentSlot; // bits are written through this pointer
+ size_t* m_OutOfBlockSlot; // sentinel value to determine when the block is full
+#ifdef _DEBUG
+ int m_MemoryBlocksCount;
+#endif
+
+private:
+ // Writes bits knowing that they will all fit in the current memory slot
+ inline void WriteInCurrentSlot( size_t data, UINT32 count )
+ {
+ data &= SAFE_SHIFT_LEFT(1, count) - 1;
+ data <<= (BITS_PER_SIZE_T - m_FreeBitsInCurrentSlot);
+ *m_pCurrentSlot |= data;
+ }
+
+ inline void AllocMemoryBlock()
+ {
+ _ASSERTE( IS_ALIGNED( m_MemoryBlockSize, sizeof( size_t ) ) );
+ MemoryBlock* pMemBlock = m_MemoryBlocks.AppendNew(m_pAllocator, m_MemoryBlockSize);
+
+ m_pCurrentSlot = pMemBlock->Contents;
+ m_OutOfBlockSlot = m_pCurrentSlot + m_MemoryBlockSize / sizeof( size_t );
+
+#ifdef _DEBUG
+ m_MemoryBlocksCount++;
+#endif
+
+ }
+
+ inline void InitCurrentSlot()
+ {
+ m_FreeBitsInCurrentSlot = BITS_PER_SIZE_T;
+ *m_pCurrentSlot = 0;
+ }
+};
+
+
+typedef UINT32 GcSlotId;
+
+
+inline UINT32 GetNormCodeOffsetChunk(UINT32 normCodeOffset)
+{
+ return normCodeOffset / NUM_NORM_CODE_OFFSETS_PER_CHUNK;
+}
+
+inline UINT32 GetCodeOffsetChunk(UINT32 codeOffset)
+{
+ return (NORMALIZE_CODE_OFFSET(codeOffset)) / NUM_NORM_CODE_OFFSETS_PER_CHUNK;
+}
+
+enum GENERIC_CONTEXTPARAM_TYPE
+{
+ GENERIC_CONTEXTPARAM_NONE = 0,
+ GENERIC_CONTEXTPARAM_MT = 1,
+ GENERIC_CONTEXTPARAM_MD = 2,
+ GENERIC_CONTEXTPARAM_THIS = 3,
+};
+
+extern void DECLSPEC_NORETURN ThrowOutOfMemory();
+
+class GcInfoEncoder
+{
+public:
+ typedef void (*NoMemoryFunction)(void);
+
+ GcInfoEncoder(
+ ICorJitInfo* pCorJitInfo,
+ CORINFO_METHOD_INFO* pMethodInfo,
+ IAllocator* pJitAllocator,
+ NoMemoryFunction pNoMem = ::ThrowOutOfMemory
+ );
+
+ struct LifetimeTransition
+ {
+ UINT32 CodeOffset;
+ GcSlotId SlotId;
+ BYTE BecomesLive;
+ BYTE IsDeleted;
+ };
+
+
+#ifdef PARTIALLY_INTERRUPTIBLE_GC_SUPPORTED
+ void DefineCallSites(UINT32* pCallSites, BYTE* pCallSiteSizes, UINT32 numCallSites);
+#endif
+
+ //------------------------------------------------------------------------
+ // Interruptibility
+ //------------------------------------------------------------------------
+
+ // An instruction at offset x will be interruptible
+ // if-and-only-if startInstructionOffset <= x < startInstructionOffset+length
+ void DefineInterruptibleRange( UINT32 startInstructionOffset, UINT32 length );
+
+
+ //------------------------------------------------------------------------
+ // Slot information
+ //------------------------------------------------------------------------
+
+ //
+ // If spOffset is relative to the current SP, spOffset must be non-negative.
+ // If spOffset is relative to the SP of the caller (same as SP at the method entry and exit)
+ // Negative offsets describe GC refs in the local and outgoing areas.
+ // Positive offsets describe GC refs in the scratch area
+ // Note that if the dynamic allocation area is resized, the outgoing area will not be valid anymore
+ // Old slots must be declared dead and new ones can be defined.
+ // It's up to the JIT to do the right thing. We don't enforce this.
+
+ GcSlotId GetRegisterSlotId( UINT32 regNum, GcSlotFlags flags );
+ GcSlotId GetStackSlotId( INT32 spOffset, GcSlotFlags flags, GcStackSlotBase spBase = GC_CALLER_SP_REL );
+
+ //
+ // After a FinalizeSlotIds is called, no more slot definitions can be made.
+ // FinalizeSlotIds must be called once and only once before calling Build()
+ //
+ void FinalizeSlotIds();
+
+
+ //------------------------------------------------------------------------
+ // Fully-interruptible information
+ //------------------------------------------------------------------------
+
+ //
+ // For inputs, pass zero as offset
+ //
+
+ // Indicates that the GC state of slot "slotId" becomes (and remains, until another transition)
+ // "slotState" after the instruction preceding "instructionOffset" (so it is first in this state when
+ // the IP of a suspended thread is at this instruction offset).
+
+ void SetSlotState( UINT32 instructionOffset,
+ GcSlotId slotId,
+ GcSlotState slotState
+ );
+
+
+ //------------------------------------------------------------------------
+ // ReturnKind
+ //------------------------------------------------------------------------
+
+ void SetReturnKind(ReturnKind returnKind);
+
+ //------------------------------------------------------------------------
+ // Miscellaneous method information
+ //------------------------------------------------------------------------
+
+ void SetSecurityObjectStackSlot( INT32 spOffset );
+ void SetPrologSize( UINT32 prologSize );
+ void SetGSCookieStackSlot( INT32 spOffsetGSCookie, UINT32 validRangeStart, UINT32 validRangeEnd );
+ void SetPSPSymStackSlot( INT32 spOffsetPSPSym );
+ void SetGenericsInstContextStackSlot( INT32 spOffsetGenericsContext, GENERIC_CONTEXTPARAM_TYPE type);
+ void SetReversePInvokeFrameSlot(INT32 spOffset);
+ void SetIsVarArg();
+ void SetCodeLength( UINT32 length );
+
+ // Optional in the general case. Required if the method uses GC_FRAMEREG_REL stack slots
+ void SetStackBaseRegister( UINT32 registerNumber );
+
+ // Number of slots preserved during EnC remap
+ void SetSizeOfEditAndContinuePreservedArea( UINT32 size );
+
+ // Used to only report a frame once for the leaf function/funclet
+ // instead of once for each live function/funclet on the stack.
+ // Called only by RyuJIT (not JIT64)
+ void SetWantsReportOnlyLeaf();
+
+#ifdef FIXED_STACK_PARAMETER_SCRATCH_AREA
+ void SetSizeOfStackOutgoingAndScratchArea( UINT32 size );
+#endif // FIXED_STACK_PARAMETER_SCRATCH_AREA
+
+
+ //------------------------------------------------------------------------
+ // Encoding
+ //------------------------------------------------------------------------
+
+ //
+ // Build() encodes GC information into temporary buffers.
+ // The method description cannot change after Build is called
+ //
+ void Build();
+
+ //
+ // Write encoded information to its final destination and frees temporary buffers.
+ // The encoder shouldn't be used anymore after calling this method.
+ // It returns a pointer to the destination buffer, which address is byte-aligned
+ //
+ BYTE* Emit();
+
+private:
+
+ friend int __cdecl CompareLifetimeTransitionsByOffsetThenSlot(const void*, const void*);
+ friend int CompareLifetimeTransitionsByChunk(const void*, const void*);
+
+
+ struct InterruptibleRange
+ {
+ UINT32 NormStartOffset;
+ UINT32 NormStopOffset;
+ };
+
+ ICorJitInfo* m_pCorJitInfo;
+ CORINFO_METHOD_INFO* m_pMethodInfo;
+ IAllocator* m_pAllocator;
+ NoMemoryFunction m_pNoMem;
+
+#ifdef _DEBUG
+ const char *m_MethodName, *m_ModuleName;
+#endif
+
+ BitStreamWriter m_Info1; // Used for everything except for chunk encodings
+ BitStreamWriter m_Info2; // Used for chunk encodings
+
+ GcInfoArrayList<InterruptibleRange, 8> m_InterruptibleRanges;
+ GcInfoArrayList<LifetimeTransition, 64> m_LifetimeTransitions;
+
+ bool m_IsVarArg;
+ bool m_WantsReportOnlyLeaf;
+ INT32 m_SecurityObjectStackSlot;
+ INT32 m_GSCookieStackSlot;
+ UINT32 m_GSCookieValidRangeStart;
+ UINT32 m_GSCookieValidRangeEnd;
+ INT32 m_PSPSymStackSlot;
+ INT32 m_GenericsInstContextStackSlot;
+ GENERIC_CONTEXTPARAM_TYPE m_contextParamType;
+ ReturnKind m_ReturnKind;
+ UINT32 m_CodeLength;
+ UINT32 m_StackBaseRegister;
+ UINT32 m_SizeOfEditAndContinuePreservedArea;
+ INT32 m_ReversePInvokeFrameSlot;
+ InterruptibleRange* m_pLastInterruptibleRange;
+
+#ifdef FIXED_STACK_PARAMETER_SCRATCH_AREA
+ UINT32 m_SizeOfStackOutgoingAndScratchArea;
+#endif // FIXED_STACK_PARAMETER_SCRATCH_AREA
+
+ void * eeAllocGCInfo (size_t blockSize);
+
+private:
+
+ friend class EncoderCheckState;
+
+ static const UINT32 m_SlotTableInitialSize = 32;
+ UINT32 m_SlotTableSize;
+ UINT32 m_NumSlots;
+ GcSlotDesc *m_SlotTable;
+
+#ifdef PARTIALLY_INTERRUPTIBLE_GC_SUPPORTED
+ UINT32* m_pCallSites;
+ BYTE* m_pCallSiteSizes;
+ UINT32 m_NumCallSites;
+#endif // PARTIALLY_INTERRUPTIBLE_GC_SUPPORTED
+
+ void GrowSlotTable();
+
+ void WriteSlotStateVector(BitStreamWriter &writer, const BitArray& vector);
+
+ UINT32 SizeofSlotStateVarLengthVector(const BitArray& vector, UINT32 baseSkip, UINT32 baseRun);
+ void SizeofSlotStateVarLengthVector(const BitArray& vector, UINT32 baseSkip, UINT32 baseRun, UINT32 * pSizeofSimple, UINT32 * pSizeofRLE, UINT32 * pSizeofRLENeg);
+ UINT32 WriteSlotStateVarLengthVector(BitStreamWriter &writer, const BitArray& vector, UINT32 baseSkip, UINT32 baseRun);
+
+ bool IsAlwaysScratch(GcSlotDesc &slot);
+
+ // Assumes that "*ppTransitions" is has size "numTransitions", is sorted by CodeOffset then by SlotId,
+ // and that "*ppEndTransitions" points one beyond the end of the array. If "*ppTransitions" contains
+ // any dead/live transitions pairs for the same CodeOffset and SlotID, removes those, by allocating a
+ // new array, and copying the non-removed elements into it. If it does this, sets "*ppTransitions" to
+ // point to the new array, "*pNumTransitions" to its shorted length, and "*ppEndTransitions" to
+ // point one beyond the used portion of this array.
+ void EliminateRedundantLiveDeadPairs(LifetimeTransition** ppTransitions,
+ size_t* pNumTransitions,
+ LifetimeTransition** ppEndTransitions);
+
+#ifdef _DEBUG
+ bool m_IsSlotTableFrozen;
+#endif
+
+#ifdef MEASURE_GCINFO
+ GcInfoSize m_CurrentMethodSize;
+#endif
+};
+
+#endif // !__GCINFOENCODER_H__
diff --git a/src/inc/gcinfotypes.h b/src/inc/gcinfotypes.h
new file mode 100644
index 0000000000..cd19759634
--- /dev/null
+++ b/src/inc/gcinfotypes.h
@@ -0,0 +1,832 @@
+// 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.
+
+
+#ifndef __GCINFOTYPES_H__
+#define __GCINFOTYPES_H__
+
+#include "gcinfo.h"
+
+// This file is included when building an "alt jit". In that case, we are doing a cross-compile:
+// we may be building the ARM jit on x86, for example. We generally make that work by conditionalizing on
+// a _TARGET_XXX_ variable that we explicitly set in the build, rather than the _XXX_ variable implicitly
+// set by the compiler. But this file is *also* included by the runtime, and needs in that case to be
+// conditionalized by the actual platform we're compiling for. We solve this by:
+// 1) conditionalizing on _TARGET_XXX_ in this file,
+// 2) having a _TARGET_SET_ variable so we know whether we're in a compilation for JIT in which some
+// _TARGET_XXX_ has already been set, and
+// 3) if _TARGET_SET_ is not set, set the _TARGET_XXX_ variable appropriate for the current _XXX_.
+//
+#ifndef _TARGET_SET_
+
+//#ifdef _X86_
+//#define _TARGET_X86_
+//#endif
+
+//#ifdef _AMD64_
+//#define _TARGET_AMD64_
+//#endif
+
+//#ifdef _ARM_
+//#define _TARGET_ARM_
+//#endif
+
+#endif // _TARGET_SET_
+
+#if defined(_TARGET_AMD64_) || defined(_TARGET_ARM_) || defined(_TARGET_ARM64_)
+#define PARTIALLY_INTERRUPTIBLE_GC_SUPPORTED
+#endif
+
+#ifdef PARTIALLY_INTERRUPTIBLE_GC_SUPPORTED
+//
+// The EH vector mechanism is not completely worked out,
+// so it's temporarily disabled. We rely on fully-interruptible instead.
+//
+#define DISABLE_EH_VECTORS
+#endif
+
+#if defined(_TARGET_AMD64_) || defined(_TARGET_ARM_) || defined(_TARGET_ARM64_)
+#define FIXED_STACK_PARAMETER_SCRATCH_AREA
+#endif
+
+#define BITS_PER_SIZE_T ((int)sizeof(size_t)*8)
+
+
+//--------------------------------------------------------------------------------
+// It turns out, that ((size_t)x) << y == x, when y is not a literal
+// and its value is BITS_PER_SIZE_T
+// I guess the processor only shifts of the right operand modulo BITS_PER_SIZE_T
+// In many cases, we want the above operation to yield 0,
+// hence the following macros
+//--------------------------------------------------------------------------------
+__forceinline size_t SAFE_SHIFT_LEFT(size_t x, size_t count)
+{
+ _ASSERTE(count <= BITS_PER_SIZE_T);
+ return (x << 1) << (count - 1);
+}
+__forceinline size_t SAFE_SHIFT_RIGHT(size_t x, size_t count)
+{
+ _ASSERTE(count <= BITS_PER_SIZE_T);
+ return (x >> 1) >> (count - 1);
+}
+
+inline UINT32 CeilOfLog2(size_t x)
+{
+ _ASSERTE(x > 0);
+ UINT32 result = (x & (x - 1)) ? 1 : 0;
+ while (x != 1)
+ {
+ result++;
+ x >>= 1;
+ }
+ return result;
+}
+
+enum GcSlotFlags
+{
+ GC_SLOT_BASE = 0x0,
+ GC_SLOT_INTERIOR = 0x1,
+ GC_SLOT_PINNED = 0x2,
+ GC_SLOT_UNTRACKED = 0x4,
+
+ // For internal use by the encoder/decoder
+ GC_SLOT_IS_REGISTER = 0x8,
+ GC_SLOT_IS_DELETED = 0x10,
+};
+
+enum GcStackSlotBase
+{
+ GC_CALLER_SP_REL = 0x0,
+ GC_SP_REL = 0x1,
+ GC_FRAMEREG_REL = 0x2,
+
+ GC_SPBASE_FIRST = GC_CALLER_SP_REL,
+ GC_SPBASE_LAST = GC_FRAMEREG_REL,
+};
+
+#ifdef _DEBUG
+const char* const GcStackSlotBaseNames[] =
+{
+ "caller.sp",
+ "sp",
+ "frame",
+};
+#endif
+
+enum GcSlotState
+{
+ GC_SLOT_DEAD = 0x0,
+ GC_SLOT_LIVE = 0x1,
+};
+
+struct GcStackSlot
+{
+ INT32 SpOffset;
+ GcStackSlotBase Base;
+
+ bool operator==(const GcStackSlot& other)
+ {
+ return ((SpOffset == other.SpOffset) && (Base == other.Base));
+ }
+ bool operator!=(const GcStackSlot& other)
+ {
+ return ((SpOffset != other.SpOffset) || (Base != other.Base));
+ }
+};
+
+//--------------------------------------------------------------------------------
+// ReturnKind -- encoding return type information in GcInfo
+//
+// When a method is stopped at a call - site for GC (ex: via return-address
+// hijacking) the runtime needs to know whether the value is a GC - value
+// (gc - pointer or gc - pointers stored in an aggregate).
+// It needs this information so that mark - phase can preserve the gc-pointers
+// being returned.
+//
+// The Runtime doesn't need the precise return-type of a method.
+// It only needs to find the GC-pointers in the return value.
+// The only scenarios currently supported by CoreCLR are:
+// 1. Object references
+// 2. ByRef pointers
+// 3. ARM64/X64 only : Structs returned in two registers
+// 4. X86 only : Floating point returns to perform the correct save/restore
+// of the return value around return-hijacking.
+//
+// Based on these cases, the legal set of ReturnKind enumerations are specified
+// for each architecture/encoding.
+// A value of this enumeration is stored in the GcInfo header.
+//
+//--------------------------------------------------------------------------------
+
+// RT_Unset: An intermediate step for staged bringup.
+// When ReturnKind is RT_Unset, it means that the JIT did not set
+// the ReturnKind in the GCInfo, and therefore the VM cannot rely on it,
+// and must use other mechanisms (similar to GcInfo ver 1) to determine
+// the Return type's GC information.
+//
+// RT_Unset is only used in the following situations:
+// X64: Used by JIT64 until updated to use GcInfo v2 API
+// ARM: Used by JIT32 until updated to use GcInfo v2 API
+//
+// RT_Unset should have a valid encoding, whose bits are actually stored in the image.
+// For X86, there are no free bits, and there's no RT_Unused enumeration.
+
+#if defined(_TARGET_X86_)
+
+// 00 RT_Scalar
+// 01 RT_Object
+// 10 RT_ByRef
+// 11 RT_Float
+
+#elif defined(_TARGET_ARM_)
+
+// 00 RT_Scalar
+// 01 RT_Object
+// 10 RT_ByRef
+// 11 RT_Unset
+
+#elif defined(_TARGET_AMD64_) || defined(_TARGET_ARM64_)
+
+// Slim Header:
+
+// 00 RT_Scalar
+// 01 RT_Object
+// 10 RT_ByRef
+// 11 RT_Unset
+
+// Fat Header:
+
+// 0000 RT_Scalar
+// 0001 RT_Object
+// 0010 RT_ByRef
+// 0011 RT_Unset
+// 0100 RT_Scalar_Obj
+// 1000 RT_Scalar_ByRef
+// 0101 RT_Obj_Obj
+// 1001 RT_Obj_ByRef
+// 0110 RT_ByRef_Obj
+// 1010 RT_ByRef_ByRef
+
+#else
+#ifdef PORTABILITY_WARNING
+PORTABILITY_WARNING("Need ReturnKind for new Platform")
+#endif // PORTABILITY_WARNING
+#endif // Target checks
+
+enum ReturnKind {
+
+ // Cases for Return in one register
+
+ RT_Scalar = 0,
+ RT_Object = 1,
+ RT_ByRef = 2,
+
+#ifdef _TARGET_X86_
+ RT_Float = 3, // Encoding 3 means RT_Float on X86
+#else
+ RT_Unset = 3, // RT_Unset on other platforms
+#endif // _TARGET_X86_
+
+ // Cases for Struct Return in two registers
+ //
+ // We have the following equivalencies, because the VM's behavior is the same
+ // for both cases:
+ // RT_Scalar_Scalar == RT_Scalar
+ // RT_Obj_Scalar == RT_Object
+ // RT_ByRef_Scalar == RT_Byref
+ // The encoding for these equivalencies will play out well because
+ // RT_Scalar is zero.
+ //
+ // Naming: RT_firstReg_secondReg
+ // Encoding: <Two bits for secondRef> <Two bits for first Reg>
+ //
+ // This encoding with exclusive bits for each register is chosen for ease of use,
+ // and because it doesn't cost any more bits.
+ // It can be changed (ex: to a linear sequence) if necessary.
+ // For example, we can encode the GC-information for the two registers in 3 bits (instead of 4)
+ // if we approximate RT_Obj_ByRef and RT_ByRef_Obj as RT_ByRef_ByRef.
+
+ // RT_Scalar_Scalar = RT_Scalar
+ RT_Scalar_Obj = RT_Object << 2 | RT_Scalar,
+ RT_Scalar_ByRef = RT_ByRef << 2 | RT_Scalar,
+
+ // RT_Obj_Scalar = RT_Object
+ RT_Obj_Obj = RT_Object << 2 | RT_Object,
+ RT_Obj_ByRef = RT_ByRef << 2 | RT_Object,
+
+ // RT_ByRef_Scalar = RT_Byref
+ RT_ByRef_Obj = RT_Object << 2 | RT_ByRef,
+ RT_ByRef_ByRef = RT_ByRef << 2 | RT_ByRef,
+
+ // Illegal or uninitialized value,
+ // Not a valid encoding, never written to image.
+ RT_Illegal = 0xFF
+};
+
+// Identify ReturnKinds containing useful information
+inline bool IsValidReturnKind(ReturnKind returnKind)
+{
+ return (returnKind != RT_Illegal)
+#ifndef _TARGET_X86_
+ && (returnKind != RT_Unset)
+#endif // _TARGET_X86_
+ ;
+}
+
+// Identify ReturnKinds that can be a part of a multi-reg struct return
+inline bool IsValidFieldReturnKind(ReturnKind returnKind)
+{
+ return (returnKind == RT_Scalar || returnKind == RT_Object || returnKind == RT_ByRef);
+}
+
+inline bool IsValidReturnRegister(size_t regNo)
+{
+ return (regNo == 0)
+#ifdef FEATURE_MULTIREG_RETURN
+ || (regNo == 1)
+#endif // FEATURE_MULTIREG_RETURN
+ ;
+}
+
+inline bool IsStructReturnKind(ReturnKind returnKind)
+{
+ // Two bits encode integer/ref/float return-kinds.
+ // Encodings needing more than two bits are (non-scalar) struct-returns.
+ return returnKind > 3;
+}
+
+// Helpers for combining/extracting individual ReturnKinds from/to Struct ReturnKinds.
+// Encoding is two bits per register
+
+inline ReturnKind GetStructReturnKind(ReturnKind reg0, ReturnKind reg1)
+{
+ _ASSERTE(IsValidFieldReturnKind(reg0) && IsValidFieldReturnKind(reg1));
+
+ ReturnKind structReturnKind = (ReturnKind)(reg1 << 2 | reg0);
+
+ _ASSERTE(IsValidReturnKind(structReturnKind));
+
+ return structReturnKind;
+}
+
+// Extract returnKind for the specified return register.
+// Also determines if higher ordinal return registers contain object references
+inline ReturnKind ExtractRegReturnKind(ReturnKind returnKind, size_t returnRegOrdinal, bool& moreRegs)
+{
+ _ASSERTE(IsValidReturnKind(returnKind));
+ _ASSERTE(IsValidReturnRegister(returnRegOrdinal));
+
+ // Return kind of each return register is encoded in two bits at returnRegOrdinal*2 position from LSB
+ ReturnKind regReturnKind = (ReturnKind)((returnKind >> (returnRegOrdinal * 2)) & 3);
+
+ // Check if any other higher ordinal return registers have object references.
+ // ReturnKind of higher ordinal return registers are encoded at (returnRegOrdinal+1)*2) position from LSB
+ // If all of the remaining bits are 0 then there isn't any more RT_Object or RT_ByRef encoded in returnKind.
+ moreRegs = (returnKind >> ((returnRegOrdinal+1) * 2)) != 0;
+
+ _ASSERTE(IsValidReturnKind(regReturnKind));
+ _ASSERTE((returnRegOrdinal == 0) || IsValidFieldReturnKind(regReturnKind));
+
+ return regReturnKind;
+}
+
+inline const char *ReturnKindToString(ReturnKind returnKind)
+{
+ switch (returnKind) {
+ case RT_Scalar: return "Scalar";
+ case RT_Object: return "Object";
+ case RT_ByRef: return "ByRef";
+#ifdef _TARGET_X86_
+ case RT_Float: return "Float";
+#else
+ case RT_Unset: return "UNSET";
+#endif // _TARGET_X86_
+ case RT_Scalar_Obj: return "{Scalar, Object}";
+ case RT_Scalar_ByRef: return "{Scalar, ByRef}";
+ case RT_Obj_Obj: return "{Object, Object}";
+ case RT_Obj_ByRef: return "{Object, ByRef}";
+ case RT_ByRef_Obj: return "{ByRef, Object}";
+ case RT_ByRef_ByRef: return "{ByRef, ByRef}";
+
+ case RT_Illegal: return "<Illegal>";
+ default: return "!Impossible!";
+ }
+}
+
+#ifdef _TARGET_X86_
+
+#include <stdlib.h> // For memcmp()
+#include "bitvector.h" // for ptrArgTP
+
+#ifndef FASTCALL
+#define FASTCALL __fastcall
+#endif
+
+// we use offsetof to get the offset of a field
+#include <stddef.h> // offsetof
+#ifndef offsetof
+#define offsetof(s,m) ((size_t)&(((s *)0)->m))
+#endif
+
+enum infoHdrAdjustConstants {
+ // Constants
+ SET_FRAMESIZE_MAX = 7,
+ SET_ARGCOUNT_MAX = 8, // Change to 6
+ SET_PROLOGSIZE_MAX = 16,
+ SET_EPILOGSIZE_MAX = 10, // Change to 6
+ SET_EPILOGCNT_MAX = 4,
+ SET_UNTRACKED_MAX = 3
+};
+
+//
+// Enum to define the 128 codes that are used to incrementally adjust the InfoHdr structure
+//
+enum infoHdrAdjust {
+
+ SET_FRAMESIZE = 0, // 0x00
+ SET_ARGCOUNT = SET_FRAMESIZE + SET_FRAMESIZE_MAX + 1, // 0x08
+ SET_PROLOGSIZE = SET_ARGCOUNT + SET_ARGCOUNT_MAX + 1, // 0x11
+ SET_EPILOGSIZE = SET_PROLOGSIZE + SET_PROLOGSIZE_MAX + 1, // 0x22
+ SET_EPILOGCNT = SET_EPILOGSIZE + SET_EPILOGSIZE_MAX + 1, // 0x2d
+ SET_UNTRACKED = SET_EPILOGCNT + (SET_EPILOGCNT_MAX + 1) * 2, // 0x37
+
+ FIRST_FLIP = SET_UNTRACKED + SET_UNTRACKED_MAX + 1,
+
+ FLIP_EDI_SAVED = FIRST_FLIP, // 0x3b
+ FLIP_ESI_SAVED, // 0x3c
+ FLIP_EBX_SAVED, // 0x3d
+ FLIP_EBP_SAVED, // 0x3e
+ FLIP_EBP_FRAME, // 0x3f
+ FLIP_INTERRUPTIBLE, // 0x40
+ FLIP_DOUBLE_ALIGN, // 0x41
+ FLIP_SECURITY, // 0x42
+ FLIP_HANDLERS, // 0x43
+ FLIP_LOCALLOC, // 0x44
+ FLIP_EDITnCONTINUE, // 0x45
+ FLIP_VAR_PTR_TABLE_SZ, // 0x46 Flip whether a table-size exits after the header encoding
+ FFFF_UNTRACKED_CNT, // 0x47 There is a count (>SET_UNTRACKED_MAX) after the header encoding
+ FLIP_VARARGS, // 0x48
+ FLIP_PROF_CALLBACKS, // 0x49
+ FLIP_HAS_GS_COOKIE, // 0x4A - The offset of the GuardStack cookie follows after the header encoding
+ FLIP_SYNC, // 0x4B
+ FLIP_HAS_GENERICS_CONTEXT,// 0x4C
+ FLIP_GENERICS_CONTEXT_IS_METHODDESC,// 0x4D
+
+ // 0x4E .. 0x4f unused
+
+ NEXT_FOUR_START = 0x50,
+ NEXT_FOUR_FRAMESIZE = 0x50,
+ NEXT_FOUR_ARGCOUNT = 0x60,
+ NEXT_THREE_PROLOGSIZE = 0x70,
+ NEXT_THREE_EPILOGSIZE = 0x78
+};
+
+#define HAS_UNTRACKED ((unsigned int) -1)
+#define HAS_VARPTR ((unsigned int) -1)
+// 0 is not a valid offset for EBP-frames as all locals are at a negative offset
+// For ESP frames, the cookie is above (at a higher address than) the buffers,
+// and so cannot be at offset 0.
+#define INVALID_GS_COOKIE_OFFSET 0
+// Temporary value to indicate that the offset needs to be read after the header
+#define HAS_GS_COOKIE_OFFSET ((unsigned int) -1)
+
+// 0 is not a valid sync offset
+#define INVALID_SYNC_OFFSET 0
+// Temporary value to indicate that the offset needs to be read after the header
+#define HAS_SYNC_OFFSET ((unsigned int) -1)
+
+#define INVALID_ARGTAB_OFFSET 0
+
+#include <pshpack1.h>
+
+// Working set optimization: saving 12 * 128 = 1536 bytes in infoHdrShortcut
+struct InfoHdr;
+
+struct InfoHdrSmall {
+ unsigned char prologSize; // 0
+ unsigned char epilogSize; // 1
+ unsigned char epilogCount : 3; // 2 [0:2]
+ unsigned char epilogAtEnd : 1; // 2 [3]
+ unsigned char ediSaved : 1; // 2 [4] which callee-saved regs are pushed onto stack
+ unsigned char esiSaved : 1; // 2 [5]
+ unsigned char ebxSaved : 1; // 2 [6]
+ unsigned char ebpSaved : 1; // 2 [7]
+ unsigned char ebpFrame : 1; // 3 [0] locals accessed relative to ebp
+ unsigned char interruptible : 1; // 3 [1] is intr. at all points (except prolog/epilog), not just call-sites
+ unsigned char doubleAlign : 1; // 3 [2] uses double-aligned stack (ebpFrame will be false)
+ unsigned char security : 1; // 3 [3] has slot for security object
+ unsigned char handlers : 1; // 3 [4] has callable handlers
+ unsigned char localloc : 1; // 3 [5] uses localloc
+ unsigned char editNcontinue : 1; // 3 [6] was JITed in EnC mode
+ unsigned char varargs : 1; // 3 [7] function uses varargs calling convention
+ unsigned char profCallbacks : 1; // 4 [0]
+ unsigned char genericsContext : 1;//4 [1] function reports a generics context parameter is present
+ unsigned char genericsContextIsMethodDesc : 1;//4[2]
+ unsigned short argCount; // 5,6 in bytes
+ unsigned int frameSize; // 7,8,9,10 in bytes
+ unsigned int untrackedCnt; // 11,12,13,14
+ unsigned int varPtrTableSize; // 15.16,17,18
+
+ // Checks whether "this" is compatible with "target".
+ // It is not an exact bit match as "this" could have some
+ // marker/place-holder values, which will have to be written out
+ // after the header.
+
+ bool isHeaderMatch(const InfoHdr& target) const;
+};
+
+
+struct InfoHdr : public InfoHdrSmall {
+ // 0 (zero) means that there is no GuardStack cookie
+ // The cookie is either at ESP+gsCookieOffset or EBP-gsCookieOffset
+ unsigned int gsCookieOffset; // 19,20,21,22
+ unsigned int syncStartOffset; // 23,24,25,26
+ unsigned int syncEndOffset; // 27,28,29,30
+
+ // 31 bytes total
+
+ // Checks whether "this" is compatible with "target".
+ // It is not an exact bit match as "this" could have some
+ // marker/place-holder values, which will have to be written out
+ // after the header.
+
+ bool isHeaderMatch(const InfoHdr& target) const
+ {
+#ifdef _ASSERTE
+ // target cannot have place-holder values.
+ _ASSERTE(target.untrackedCnt != HAS_UNTRACKED &&
+ target.varPtrTableSize != HAS_VARPTR &&
+ target.gsCookieOffset != HAS_GS_COOKIE_OFFSET &&
+ target.syncStartOffset != HAS_SYNC_OFFSET);
+#endif
+
+ // compare two InfoHdr's up to but not including the untrackCnt field
+ if (memcmp(this, &target, offsetof(InfoHdr, untrackedCnt)) != 0)
+ return false;
+
+ if (untrackedCnt != target.untrackedCnt) {
+ if (target.untrackedCnt <= SET_UNTRACKED_MAX)
+ return false;
+ else if (untrackedCnt != HAS_UNTRACKED)
+ return false;
+ }
+
+ if (varPtrTableSize != target.varPtrTableSize) {
+ if ((varPtrTableSize != 0) != (target.varPtrTableSize != 0))
+ return false;
+ }
+
+ if ((gsCookieOffset == INVALID_GS_COOKIE_OFFSET) !=
+ (target.gsCookieOffset == INVALID_GS_COOKIE_OFFSET))
+ return false;
+
+ if ((syncStartOffset == INVALID_SYNC_OFFSET) !=
+ (target.syncStartOffset == INVALID_SYNC_OFFSET))
+ return false;
+
+ return true;
+ }
+};
+
+
+union CallPattern {
+ struct {
+ unsigned char argCnt;
+ unsigned char regMask; // EBP=0x8, EBX=0x4, ESI=0x2, EDI=0x1
+ unsigned char argMask;
+ unsigned char codeDelta;
+ } fld;
+ unsigned val;
+};
+
+#include <poppack.h>
+
+#define IH_MAX_PROLOG_SIZE (51)
+
+extern const InfoHdrSmall infoHdrShortcut[];
+extern int infoHdrLookup[];
+
+inline void GetInfoHdr(int index, InfoHdr * header)
+{
+ *((InfoHdrSmall *)header) = infoHdrShortcut[index];
+
+ header->gsCookieOffset = 0;
+ header->syncStartOffset = 0;
+ header->syncEndOffset = 0;
+}
+
+PTR_CBYTE FASTCALL decodeHeader(PTR_CBYTE table, InfoHdr* header);
+
+BYTE FASTCALL encodeHeaderFirst(const InfoHdr& header, InfoHdr* state, int* more, int *pCached);
+BYTE FASTCALL encodeHeaderNext(const InfoHdr& header, InfoHdr* state);
+
+size_t FASTCALL decodeUnsigned(PTR_CBYTE src, unsigned* value);
+size_t FASTCALL decodeUDelta(PTR_CBYTE src, unsigned* value, unsigned lastValue);
+size_t FASTCALL decodeSigned(PTR_CBYTE src, int * value);
+
+#define CP_MAX_CODE_DELTA (0x23)
+#define CP_MAX_ARG_CNT (0x02)
+#define CP_MAX_ARG_MASK (0x00)
+
+extern const unsigned callPatternTable[];
+extern const unsigned callCommonDelta[];
+
+
+int FASTCALL lookupCallPattern(unsigned argCnt,
+ unsigned regMask,
+ unsigned argMask,
+ unsigned codeDelta);
+
+void FASTCALL decodeCallPattern(int pattern,
+ unsigned * argCnt,
+ unsigned * regMask,
+ unsigned * argMask,
+ unsigned * codeDelta);
+
+#endif // _TARGET_86_
+
+// Stack offsets must be 8-byte aligned, so we use this unaligned
+// offset to represent that the method doesn't have a security object
+#define NO_SECURITY_OBJECT (-1)
+#define NO_GS_COOKIE (-1)
+#define NO_STACK_BASE_REGISTER (0xffffffff)
+#define NO_SIZE_OF_EDIT_AND_CONTINUE_PRESERVED_AREA (0xffffffff)
+#define NO_GENERICS_INST_CONTEXT (-1)
+#define NO_REVERSE_PINVOKE_FRAME (-1)
+#define NO_PSP_SYM (-1)
+
+#if defined(_TARGET_AMD64_)
+
+#ifndef TARGET_POINTER_SIZE
+#define TARGET_POINTER_SIZE 8 // equal to sizeof(void*) and the managed pointer size in bytes for this target
+#endif
+#define NUM_NORM_CODE_OFFSETS_PER_CHUNK (64)
+#define NUM_NORM_CODE_OFFSETS_PER_CHUNK_LOG2 (6)
+#define NORMALIZE_STACK_SLOT(x) ((x)>>3)
+#define DENORMALIZE_STACK_SLOT(x) ((x)<<3)
+#define NORMALIZE_CODE_LENGTH(x) (x)
+#define DENORMALIZE_CODE_LENGTH(x) (x)
+// Encode RBP as 0
+#define NORMALIZE_STACK_BASE_REGISTER(x) ((x) ^ 5)
+#define DENORMALIZE_STACK_BASE_REGISTER(x) ((x) ^ 5)
+#define NORMALIZE_SIZE_OF_STACK_AREA(x) ((x)>>3)
+#define DENORMALIZE_SIZE_OF_STACK_AREA(x) ((x)<<3)
+#define CODE_OFFSETS_NEED_NORMALIZATION 0
+#define NORMALIZE_CODE_OFFSET(x) (x)
+#define DENORMALIZE_CODE_OFFSET(x) (x)
+#define NORMALIZE_REGISTER(x) (x)
+#define DENORMALIZE_REGISTER(x) (x)
+#define NORMALIZE_NUM_SAFE_POINTS(x) (x)
+#define DENORMALIZE_NUM_SAFE_POINTS(x) (x)
+#define NORMALIZE_NUM_INTERRUPTIBLE_RANGES(x) (x)
+#define DENORMALIZE_NUM_INTERRUPTIBLE_RANGES(x) (x)
+
+#define PSP_SYM_STACK_SLOT_ENCBASE 6
+#define GENERICS_INST_CONTEXT_STACK_SLOT_ENCBASE 6
+#define SECURITY_OBJECT_STACK_SLOT_ENCBASE 6
+#define GS_COOKIE_STACK_SLOT_ENCBASE 6
+#define CODE_LENGTH_ENCBASE 8
+#define SIZE_OF_RETURN_KIND_IN_SLIM_HEADER 2
+#define SIZE_OF_RETURN_KIND_IN_FAT_HEADER 4
+#define STACK_BASE_REGISTER_ENCBASE 3
+#define SIZE_OF_STACK_AREA_ENCBASE 3
+#define SIZE_OF_EDIT_AND_CONTINUE_PRESERVED_AREA_ENCBASE 4
+#define REVERSE_PINVOKE_FRAME_ENCBASE 6
+#define NUM_REGISTERS_ENCBASE 2
+#define NUM_STACK_SLOTS_ENCBASE 2
+#define NUM_UNTRACKED_SLOTS_ENCBASE 1
+#define NORM_PROLOG_SIZE_ENCBASE 5
+#define NORM_EPILOG_SIZE_ENCBASE 3
+#define NORM_CODE_OFFSET_DELTA_ENCBASE 3
+#define INTERRUPTIBLE_RANGE_DELTA1_ENCBASE 6
+#define INTERRUPTIBLE_RANGE_DELTA2_ENCBASE 6
+#define REGISTER_ENCBASE 3
+#define REGISTER_DELTA_ENCBASE 2
+#define STACK_SLOT_ENCBASE 6
+#define STACK_SLOT_DELTA_ENCBASE 4
+#define NUM_SAFE_POINTS_ENCBASE 2
+#define NUM_INTERRUPTIBLE_RANGES_ENCBASE 1
+#define NUM_EH_CLAUSES_ENCBASE 2
+#define POINTER_SIZE_ENCBASE 3
+#define LIVESTATE_RLE_RUN_ENCBASE 2
+#define LIVESTATE_RLE_SKIP_ENCBASE 4
+
+#elif defined(_TARGET_ARM_)
+
+#ifndef TARGET_POINTER_SIZE
+#define TARGET_POINTER_SIZE 4 // equal to sizeof(void*) and the managed pointer size in bytes for this target
+#endif
+#define NUM_NORM_CODE_OFFSETS_PER_CHUNK (64)
+#define NUM_NORM_CODE_OFFSETS_PER_CHUNK_LOG2 (6)
+#define NORMALIZE_STACK_SLOT(x) ((x)>>2)
+#define DENORMALIZE_STACK_SLOT(x) ((x)<<2)
+#define NORMALIZE_CODE_LENGTH(x) ((x)>>1)
+#define DENORMALIZE_CODE_LENGTH(x) ((x)<<1)
+// Encode R11 as zero
+#define NORMALIZE_STACK_BASE_REGISTER(x) ((((x) - 4) & 7) ^ 7)
+#define DENORMALIZE_STACK_BASE_REGISTER(x) (((x) ^ 7) + 4)
+#define NORMALIZE_SIZE_OF_STACK_AREA(x) ((x)>>2)
+#define DENORMALIZE_SIZE_OF_STACK_AREA(x) ((x)<<2)
+#define CODE_OFFSETS_NEED_NORMALIZATION 1
+#define NORMALIZE_CODE_OFFSET(x) (x) // Instructions are 2/4 bytes long in Thumb/ARM states,
+#define DENORMALIZE_CODE_OFFSET(x) (x) // but the safe-point offsets are encoded with a -1 adjustment.
+#define NORMALIZE_REGISTER(x) (x)
+#define DENORMALIZE_REGISTER(x) (x)
+#define NORMALIZE_NUM_SAFE_POINTS(x) (x)
+#define DENORMALIZE_NUM_SAFE_POINTS(x) (x)
+#define NORMALIZE_NUM_INTERRUPTIBLE_RANGES(x) (x)
+#define DENORMALIZE_NUM_INTERRUPTIBLE_RANGES(x) (x)
+
+// The choices of these encoding bases only affects space overhead
+// and performance, not semantics/correctness.
+#define PSP_SYM_STACK_SLOT_ENCBASE 5
+#define GENERICS_INST_CONTEXT_STACK_SLOT_ENCBASE 5
+#define SECURITY_OBJECT_STACK_SLOT_ENCBASE 5
+#define GS_COOKIE_STACK_SLOT_ENCBASE 5
+#define CODE_LENGTH_ENCBASE 7
+#define SIZE_OF_RETURN_KIND_IN_SLIM_HEADER 2
+#define SIZE_OF_RETURN_KIND_IN_FAT_HEADER 2
+#define STACK_BASE_REGISTER_ENCBASE 1
+#define SIZE_OF_STACK_AREA_ENCBASE 3
+#define SIZE_OF_EDIT_AND_CONTINUE_PRESERVED_AREA_ENCBASE 3
+#define REVERSE_PINVOKE_FRAME_ENCBASE 5
+#define NUM_REGISTERS_ENCBASE 2
+#define NUM_STACK_SLOTS_ENCBASE 3
+#define NUM_UNTRACKED_SLOTS_ENCBASE 3
+#define NORM_PROLOG_SIZE_ENCBASE 5
+#define NORM_EPILOG_SIZE_ENCBASE 3
+#define NORM_CODE_OFFSET_DELTA_ENCBASE 3
+#define INTERRUPTIBLE_RANGE_DELTA1_ENCBASE 4
+#define INTERRUPTIBLE_RANGE_DELTA2_ENCBASE 6
+#define REGISTER_ENCBASE 2
+#define REGISTER_DELTA_ENCBASE 1
+#define STACK_SLOT_ENCBASE 6
+#define STACK_SLOT_DELTA_ENCBASE 4
+#define NUM_SAFE_POINTS_ENCBASE 3
+#define NUM_INTERRUPTIBLE_RANGES_ENCBASE 2
+#define NUM_EH_CLAUSES_ENCBASE 3
+#define POINTER_SIZE_ENCBASE 3
+#define LIVESTATE_RLE_RUN_ENCBASE 2
+#define LIVESTATE_RLE_SKIP_ENCBASE 4
+
+#elif defined(_TARGET_ARM64_)
+
+#ifndef TARGET_POINTER_SIZE
+#define TARGET_POINTER_SIZE 8 // equal to sizeof(void*) and the managed pointer size in bytes for this target
+#endif
+#define NUM_NORM_CODE_OFFSETS_PER_CHUNK (64)
+#define NUM_NORM_CODE_OFFSETS_PER_CHUNK_LOG2 (6)
+#define NORMALIZE_STACK_SLOT(x) ((x)>>3) // GC Pointers are 8-bytes aligned
+#define DENORMALIZE_STACK_SLOT(x) ((x)<<3)
+#define NORMALIZE_CODE_LENGTH(x) ((x)>>2) // All Instructions are 4 bytes long
+#define DENORMALIZE_CODE_LENGTH(x) ((x)<<2)
+#define NORMALIZE_STACK_BASE_REGISTER(x) ((x)^29) // Encode Frame pointer X29 as zero
+#define DENORMALIZE_STACK_BASE_REGISTER(x) ((x)^29)
+#define NORMALIZE_SIZE_OF_STACK_AREA(x) ((x)>>3)
+#define DENORMALIZE_SIZE_OF_STACK_AREA(x) ((x)<<3)
+#define CODE_OFFSETS_NEED_NORMALIZATION 0
+#define NORMALIZE_CODE_OFFSET(x) (x) // Instructions are 4 bytes long, but the safe-point
+#define DENORMALIZE_CODE_OFFSET(x) (x) // offsets are encoded with a -1 adjustment.
+#define NORMALIZE_REGISTER(x) (x)
+#define DENORMALIZE_REGISTER(x) (x)
+#define NORMALIZE_NUM_SAFE_POINTS(x) (x)
+#define DENORMALIZE_NUM_SAFE_POINTS(x) (x)
+#define NORMALIZE_NUM_INTERRUPTIBLE_RANGES(x) (x)
+#define DENORMALIZE_NUM_INTERRUPTIBLE_RANGES(x) (x)
+
+#define PSP_SYM_STACK_SLOT_ENCBASE 6
+#define GENERICS_INST_CONTEXT_STACK_SLOT_ENCBASE 6
+#define SECURITY_OBJECT_STACK_SLOT_ENCBASE 6
+#define GS_COOKIE_STACK_SLOT_ENCBASE 6
+#define CODE_LENGTH_ENCBASE 8
+#define SIZE_OF_RETURN_KIND_IN_SLIM_HEADER 2
+#define SIZE_OF_RETURN_KIND_IN_FAT_HEADER 4
+#define STACK_BASE_REGISTER_ENCBASE 2 // FP encoded as 0, SP as 2.
+#define SIZE_OF_STACK_AREA_ENCBASE 3
+#define SIZE_OF_EDIT_AND_CONTINUE_PRESERVED_AREA_ENCBASE 4
+#define REVERSE_PINVOKE_FRAME_ENCBASE 6
+#define NUM_REGISTERS_ENCBASE 3
+#define NUM_STACK_SLOTS_ENCBASE 2
+#define NUM_UNTRACKED_SLOTS_ENCBASE 1
+#define NORM_PROLOG_SIZE_ENCBASE 5
+#define NORM_EPILOG_SIZE_ENCBASE 3
+#define NORM_CODE_OFFSET_DELTA_ENCBASE 3
+#define INTERRUPTIBLE_RANGE_DELTA1_ENCBASE 6
+#define INTERRUPTIBLE_RANGE_DELTA2_ENCBASE 6
+#define REGISTER_ENCBASE 3
+#define REGISTER_DELTA_ENCBASE 2
+#define STACK_SLOT_ENCBASE 6
+#define STACK_SLOT_DELTA_ENCBASE 4
+#define NUM_SAFE_POINTS_ENCBASE 3
+#define NUM_INTERRUPTIBLE_RANGES_ENCBASE 1
+#define NUM_EH_CLAUSES_ENCBASE 2
+#define POINTER_SIZE_ENCBASE 3
+#define LIVESTATE_RLE_RUN_ENCBASE 2
+#define LIVESTATE_RLE_SKIP_ENCBASE 4
+
+#else
+
+#ifndef _TARGET_X86_
+#ifdef PORTABILITY_WARNING
+PORTABILITY_WARNING("Please specialize these definitions for your platform!")
+#endif
+#endif
+
+#ifndef TARGET_POINTER_SIZE
+#define TARGET_POINTER_SIZE 4 // equal to sizeof(void*) and the managed pointer size in bytes for this target
+#endif
+#define NUM_NORM_CODE_OFFSETS_PER_CHUNK (64)
+#define NUM_NORM_CODE_OFFSETS_PER_CHUNK_LOG2 (6)
+#define NORMALIZE_STACK_SLOT(x) (x)
+#define DENORMALIZE_STACK_SLOT(x) (x)
+#define NORMALIZE_CODE_LENGTH(x) (x)
+#define DENORMALIZE_CODE_LENGTH(x) (x)
+#define NORMALIZE_STACK_BASE_REGISTER(x) (x)
+#define DENORMALIZE_STACK_BASE_REGISTER(x) (x)
+#define NORMALIZE_SIZE_OF_STACK_AREA(x) (x)
+#define DENORMALIZE_SIZE_OF_STACK_AREA(x) (x)
+#define CODE_OFFSETS_NEED_NORMALIZATION 0
+#define NORMALIZE_CODE_OFFSET(x) (x)
+#define DENORMALIZE_CODE_OFFSET(x) (x)
+#define NORMALIZE_REGISTER(x) (x)
+#define DENORMALIZE_REGISTER(x) (x)
+#define NORMALIZE_NUM_SAFE_POINTS(x) (x)
+#define DENORMALIZE_NUM_SAFE_POINTS(x) (x)
+#define NORMALIZE_NUM_INTERRUPTIBLE_RANGES(x) (x)
+#define DENORMALIZE_NUM_INTERRUPTIBLE_RANGES(x) (x)
+
+#define PSP_SYM_STACK_SLOT_ENCBASE 6
+#define GENERICS_INST_CONTEXT_STACK_SLOT_ENCBASE 6
+#define SECURITY_OBJECT_STACK_SLOT_ENCBASE 6
+#define GS_COOKIE_STACK_SLOT_ENCBASE 6
+#define CODE_LENGTH_ENCBASE 6
+#define SIZE_OF_RETURN_KIND_IN_SLIM_HEADER 2
+#define SIZE_OF_RETURN_KIND_IN_FAT_HEADER 2
+#define STACK_BASE_REGISTER_ENCBASE 3
+#define SIZE_OF_STACK_AREA_ENCBASE 6
+#define SIZE_OF_EDIT_AND_CONTINUE_PRESERVED_AREA_ENCBASE 3
+#define REVERSE_PINVOKE_FRAME_ENCBASE 6
+#define NUM_REGISTERS_ENCBASE 3
+#define NUM_STACK_SLOTS_ENCBASE 5
+#define NUM_UNTRACKED_SLOTS_ENCBASE 5
+#define NORM_PROLOG_SIZE_ENCBASE 4
+#define NORM_EPILOG_SIZE_ENCBASE 3
+#define NORM_CODE_OFFSET_DELTA_ENCBASE 3
+#define INTERRUPTIBLE_RANGE_DELTA1_ENCBASE 5
+#define INTERRUPTIBLE_RANGE_DELTA2_ENCBASE 5
+#define REGISTER_ENCBASE 3
+#define REGISTER_DELTA_ENCBASE REGISTER_ENCBASE
+#define STACK_SLOT_ENCBASE 6
+#define STACK_SLOT_DELTA_ENCBASE 4
+#define NUM_SAFE_POINTS_ENCBASE 4
+#define NUM_INTERRUPTIBLE_RANGES_ENCBASE 1
+#define NUM_EH_CLAUSES_ENCBASE 2
+#define POINTER_SIZE_ENCBASE 3
+#define LIVESTATE_RLE_RUN_ENCBASE 2
+#define LIVESTATE_RLE_SKIP_ENCBASE 4
+
+#endif
+
+#endif // !__GCINFOTYPES_H__
+
diff --git a/src/inc/gcrefmap.h b/src/inc/gcrefmap.h
new file mode 100644
index 0000000000..0e07074cda
--- /dev/null
+++ b/src/inc/gcrefmap.h
@@ -0,0 +1,247 @@
+// 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.
+
+
+#ifndef _GCREFMAP_H_
+#define _GCREFMAP_H_
+
+#include "sigbuilder.h"
+
+//
+// The GCRef map is used to encode GC type of arguments for callsites. Logically, it is sequence <pos, token> where pos is
+// position of the reference in the stack frame and token is type of GC reference (one of GCREFMAP_XXX values).
+//
+// - The encoding always starts at the byte boundary. The high order bit of each byte is used to signal end of the encoding
+// stream. The last byte has the high order bit zero. It means that there are 7 useful bits in each byte.
+// - "pos" is always encoded as delta from previous pos.
+// - The basic encoding unit is two bits. Values 0, 1 and 2 are the common constructs (skip single slot, GC reference, interior
+// pointer). Value 3 means that extended encoding follows.
+// - The extended information is integer encoded in one or more four bit blocks. The high order bit of the four bit block is
+// used to signal the end.
+// - For x86, the encoding starts by size of the callee poped stack. The size is encoded using the same mechanism as above (two bit
+// basic encoding, with extended encoding for large values).
+
+/////////////////////////////////////////////////////////////////////////////////////
+// A utility class to encode sequence of GC summaries for a callsite
+
+class GCRefMapBuilder
+{
+ int m_PendingByte; // Pending value, not yet written out
+
+ int m_Bits; // Number of bits in pending byte. Note that the trailing zero bits are not written out,
+ // so this can be more than 7.
+
+ int m_Pos; // Current position
+
+ SigBuilder m_SigBuilder;
+
+ // Append single bit to the stream
+ void AppendBit(int bit)
+ {
+ if (bit != 0)
+ {
+ while (m_Bits >= 7)
+ {
+ m_SigBuilder.AppendByte((BYTE)(m_PendingByte | 0x80));
+ m_PendingByte = 0;
+ m_Bits -= 7;
+ }
+
+ m_PendingByte |= (1 << m_Bits);
+ }
+
+ m_Bits++;
+ }
+
+ void AppendTwoBit(int bits)
+ {
+ AppendBit(bits & 1);
+ AppendBit(bits >> 1);
+ }
+
+ void AppendInt(int val)
+ {
+ do {
+ AppendBit(val & 1);
+ AppendBit((val >> 1) & 1);
+ AppendBit((val >> 2) & 1);
+
+ val >>= 3;
+
+ AppendBit((val != 0) ? 1 : 0);
+ }
+ while (val != 0);
+ }
+
+public:
+ GCRefMapBuilder()
+ : m_PendingByte(0), m_Bits(0), m_Pos(0)
+ {
+ }
+
+#ifdef _TARGET_X86_
+ void WriteStackPop(int stackPop)
+ {
+ if (stackPop < 3)
+ {
+ AppendTwoBit(stackPop);
+ }
+ else
+ {
+ AppendTwoBit(3);
+ AppendInt(stackPop - 3);
+ }
+ }
+#endif
+
+ void WriteToken(int pos, int gcRefMapToken)
+ {
+ int posDelta = pos - m_Pos;
+ m_Pos = pos + 1;
+
+ if (posDelta != 0)
+ {
+ if (posDelta < 4)
+ {
+ // Skipping by one slot at a time for small deltas produces smaller encoding.
+ while (posDelta > 0)
+ {
+ AppendTwoBit(0);
+ posDelta--;
+ }
+ }
+ else
+ {
+ AppendTwoBit(3);
+ AppendInt((posDelta - 4) << 1);
+ }
+ }
+
+ if (gcRefMapToken < 3)
+ {
+ AppendTwoBit(gcRefMapToken);
+ }
+ else
+ {
+ AppendTwoBit(3);
+ AppendInt(((gcRefMapToken - 3) << 1) | 1);
+ }
+ }
+
+ void Flush()
+ {
+ if ((m_PendingByte & 0x7F) != 0 || m_Pos == 0)
+ m_SigBuilder.AppendByte((BYTE)(m_PendingByte & 0x7F));
+
+ m_PendingByte = 0;
+ m_Bits = 0;
+
+ m_Pos = 0;
+ }
+
+ PVOID GetBlob(DWORD * pdwLength)
+ {
+ return m_SigBuilder.GetSignature(pdwLength);
+ }
+
+ DWORD GetBlobLength()
+ {
+ return m_SigBuilder.GetSignatureLength();
+ }
+};
+
+/////////////////////////////////////////////////////////////////////////////////////
+// A utility class to decode a GC summary for a callsite
+
+class GCRefMapDecoder
+{
+ PTR_BYTE m_pCurrentByte;
+ int m_PendingByte;
+ int m_Pos;
+
+ FORCEINLINE int GetBit()
+ {
+ int x = m_PendingByte;
+ if (x & 0x80)
+ {
+ x = *m_pCurrentByte++;
+ x |= ((x & 0x80) << 7);
+ }
+ m_PendingByte = x >> 1;
+ return x & 1;
+ }
+
+ FORCEINLINE int GetTwoBit()
+ {
+ int result = GetBit();
+ result |= GetBit() << 1;
+ return result;
+ }
+
+ int GetInt()
+ {
+ int result = 0;
+
+ int bit = 0;
+ do {
+ result |= GetBit() << (bit++);
+ result |= GetBit() << (bit++);
+ result |= GetBit() << (bit++);
+ }
+ while (GetBit() != 0);
+
+ return result;
+ }
+
+public:
+ GCRefMapDecoder(PTR_BYTE pBlob)
+ : m_pCurrentByte(pBlob), m_PendingByte(0x80), m_Pos(0)
+ {
+ }
+
+ BOOL AtEnd()
+ {
+ return m_PendingByte == 0;
+ }
+
+#ifdef _TARGET_X86_
+ UINT ReadStackPop()
+ {
+ int x = GetTwoBit();
+
+ if (x == 3)
+ x = GetInt() + 3;
+
+ return x;
+ }
+#endif
+
+ int CurrentPos()
+ {
+ return m_Pos;
+ }
+
+ int ReadToken()
+ {
+ int val = GetTwoBit();
+ if (val == 3)
+ {
+ int ext = GetInt();
+ if ((ext & 1) == 0)
+ {
+ m_Pos += (ext >> 1) + 4;
+ return GCREFMAP_SKIP;
+ }
+ else
+ {
+ m_Pos++;
+ return (ext >> 1) + 3;
+ }
+ }
+ m_Pos++;
+ return val;
+ }
+};
+
+#endif // _GCREFMAP_H_
diff --git a/src/inc/genericstackprobe.h b/src/inc/genericstackprobe.h
new file mode 100644
index 0000000000..591bcc8596
--- /dev/null
+++ b/src/inc/genericstackprobe.h
@@ -0,0 +1,610 @@
+// 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.
+//
+
+//
+//-----------------------------------------------------------------------------
+// Generic Stack Probe Code
+// Used to setup stack guards and probes outside the VM tree
+//-----------------------------------------------------------------------------
+
+#ifndef __GENERICSTACKPROBE_h__
+#define __GENERICSTACKPROBE_h__
+
+#include "staticcontract.h"
+#include "predeftlsslot.h"
+
+#if defined(DISABLE_CONTRACTS)
+#undef FEATURE_STACK_PROBE
+#endif
+
+#if defined(FEATURE_STACK_PROBE)
+#ifdef _DEBUG
+#define STACK_GUARDS_DEBUG
+#else
+#define STACK_GUARDS_RELEASE
+#endif
+#endif
+
+#ifdef FEATURE_STACK_PROBE
+#define SO_INFRASTRUCTURE_CODE(x) x
+#define NO_SO_INFRASTRUCTURE_CODE_ASSERTE(x)
+#else
+#define SO_INFRASTRUCTURE_CODE(x)
+#define NO_SO_INFRASTRUCTURE_CODE_ASSERTE(x) _ASSERTE(x);
+#endif
+
+/* This macro is redefined in stackprobe.h
+ * so that code expanded using this macro is present only for files
+ * within VM directory. See StackProbe.h for more details
+ */
+#define VM_NO_SO_INFRASTRUCTURE_CODE(x)
+
+// The types of stack validation we support in holders.
+enum HolderStackValidation
+{
+ HSV_NoValidation,
+ HSV_ValidateMinimumStackReq,
+ HSV_ValidateNormalStackReq,
+};
+
+// Used to track transitions into the profiler
+#define REMOVE_STACK_GUARD_FOR_PROFILER_CALL \
+ REMOVE_STACK_GUARD
+
+// For AMD64, the stack size is 4K, same as X86, but the pointer size is 64, so the
+// stack tends to grow a lot faster than X86.
+#ifdef _TARGET_AMD64_
+#define ADJUST_PROBE(n) (2 * (n))
+#else
+#define ADJUST_PROBE(n) (n)
+#endif
+
+#if defined(FEATURE_STACK_PROBE)
+
+#ifdef STACK_GUARDS_DEBUG // DAC and non-DAC - all data structures referenced in DAC'ized code
+ // must be included so we can calculate layout. SO probes are not
+ // active in the DAC but the SO probe structures contribute to layout
+
+
+// This class is used to place a marker upstack and verify that it was not overrun. It is
+// different from the full blown stack probes in that it does not chain with other probes or
+// test for stack overflow. Its sole purpose is to verify stack consumption.
+// It is effectively an implicit probe though, because we are guaranteeing that we have
+// enought stack to run and will not take an SO. So we enter SO-intolerant code when
+// we install one of these.
+
+class StackMarkerStack;
+struct ClrDebugState;
+
+class BaseStackMarker
+{
+ friend StackMarkerStack;
+
+ ClrDebugState *m_pDebugState;
+ BOOL m_prevWasSOTolerant; // Were we SO-tolerant when we came in?
+ BOOL m_fMarkerSet; // Has the marker been set?
+ BOOL m_fTemporarilyDisabled;// Has the marker been temporarely disabled?
+ BOOL m_fAddedToStack; // Has this BaseStackMarker been added to the stack of markers for the thread.
+ float m_numPages;
+ UINT_PTR *m_pMarker; // Pointer to where to put our marker cookie on the stack.
+ BaseStackMarker*m_pPrevious;
+ BOOL m_fProtectedStackPage;
+ BOOL m_fAllowDisabling;
+
+ BaseStackMarker() {}; // no default construction allowed
+
+ // These should only be called by the ClrDebugState.
+ void RareDisableMarker();
+ void RareReEnableMarker();
+
+ public:
+ BaseStackMarker(float numPages, BOOL fAllowDisabling);
+
+ // we have this so that the check of the global can be inlined
+ // and we don't make the call to CheckMarker unless we need to.
+ void CheckForBackoutViolation();
+
+ void SetMarker(float numPages);
+ void CheckMarker();
+
+ void ProtectMarkerPageInDebugger();
+ void UndoPageProtectionInDebugger();
+
+};
+
+class StackMarkerStack
+{
+public:
+ // Since this is used from the ClrDebugState which can't have a default constructor,
+ // we need to provide an Init method to intialize the instance instead of having a constructor.
+ void Init()
+ {
+ m_pTopStackMarker = NULL;
+ m_fDisabled = FALSE;
+ }
+
+ void PushStackMarker(BaseStackMarker *pStackMarker);
+ BaseStackMarker *PopStackMarker();
+
+ BOOL IsEmpty()
+ {
+ return (m_pTopStackMarker == NULL);
+ }
+ BOOL IsDisabled()
+ {
+ return m_fDisabled;
+ }
+
+ void RareDisableStackMarkers();
+ void RareReEnableStackMarkers();
+
+private:
+ BaseStackMarker *m_pTopStackMarker; // The top of the stack of stack markers for the current thread.
+ BOOL m_fDisabled;
+};
+
+#endif // STACK_GUARDS_DEBUG
+
+#if !defined(DACCESS_COMPILE)
+
+// In debug builds, we redefine DEFAULT_ENTRY_PROBE_AMOUNT to a global static
+// so that we can tune the entry point probe size at runtime.
+#define DEFAULT_ENTRY_PROBE_SIZE 12
+#define DEFAULT_ENTRY_PROBE_AMOUNT DEFAULT_ENTRY_PROBE_SIZE
+
+#define BACKOUT_CODE_STACK_LIMIT 4.0
+#define HOLDER_CODE_NORMAL_STACK_LIMIT BACKOUT_CODE_STACK_LIMIT
+#define HOLDER_CODE_MINIMUM_STACK_LIMIT 0.25
+
+void DontCallDirectlyForceStackOverflow();
+void SOBackoutViolation(const char *szFunction, const char *szFile, int lineNum);
+typedef void *EEThreadHandle;
+class SOIntolerantTransitionHandler;
+extern bool g_StackProbingEnabled;
+extern void (*g_fpCheckForSOInSOIntolerantCode)();
+extern void (*g_fpSetSOIntolerantTransitionMarker)();
+extern BOOL (*g_fpDoProbe)(unsigned int n);
+extern void (*g_fpHandleSoftStackOverflow)(BOOL fSkipDebugger);
+
+// Once we enter SO-intolerant code, we can never take a hard SO as we will be
+// in an unknown state. SOIntolerantTransitionHandler is used to detect a hard SO in SO-intolerant
+// code and to raise a Fatal Error if one occurs.
+class SOIntolerantTransitionHandler
+{
+private:
+ bool m_exceptionOccurred;
+ void * m_pPreviousHandler;
+
+public:
+ FORCEINLINE SOIntolerantTransitionHandler()
+ {
+ if (g_StackProbingEnabled)
+ {
+ CtorImpl();
+ }
+ }
+
+ FORCEINLINE ~SOIntolerantTransitionHandler()
+ {
+ if (g_StackProbingEnabled)
+ {
+ DtorImpl();
+ }
+ }
+
+ NOINLINE void CtorImpl();
+ NOINLINE void DtorImpl();
+
+ void SetNoException()
+ {
+ m_exceptionOccurred = false;
+ }
+
+ bool DidExceptionOccur()
+ {
+ return m_exceptionOccurred;
+ }
+};
+
+
+extern void (*g_fpHandleStackOverflowAfterCatch)();
+void HandleStackOverflowAfterCatch();
+
+#if defined(STACK_GUARDS_DEBUG)
+
+#ifdef _WIN64
+#define STACK_COOKIE_VALUE 0x0123456789ABCDEF
+#define DISABLED_STACK_COOKIE_VALUE 0xDCDCDCDCDCDCDCDC
+#else
+#define STACK_COOKIE_VALUE 0x01234567
+#define DISABLED_STACK_COOKIE_VALUE 0xDCDCDCDC
+#endif
+
+// This allows us to adjust the probe amount at run-time in checked builds
+#undef DEFAULT_ENTRY_PROBE_AMOUNT
+#define DEFAULT_ENTRY_PROBE_AMOUNT g_EntryPointProbeAmount
+
+class BaseStackGuardGeneric;
+class BaseStackGuard;
+
+extern void (*g_fpRestoreCurrentStackGuard)(BOOL fDisabled);
+extern BOOL (*g_fp_BaseStackGuard_RequiresNStackPages)(BaseStackGuardGeneric *pGuard, unsigned int n, BOOL fThrowOnSO);
+extern void (*g_fp_BaseStackGuard_CheckStack)(BaseStackGuardGeneric *pGuard);
+extern BOOL (*g_fpCheckNStackPagesAvailable)(unsigned int n);
+extern BOOL g_ProtectStackPagesInDebugger;
+void RestoreSOToleranceState();
+void EnsureSOTolerant();
+
+extern BOOL g_EnableBackoutStackValidation;
+extern DWORD g_EntryPointProbeAmount;
+
+//-----------------------------------------------------------------------------
+// Check if a cookie is still at the given marker
+//-----------------------------------------------------------------------------
+inline BOOL IsMarkerOverrun(UINT_PTR *pMarker)
+{
+ return (*pMarker != STACK_COOKIE_VALUE);
+}
+
+class AutoCleanupStackMarker : public BaseStackMarker
+{
+public:
+ DEBUG_NOINLINE AutoCleanupStackMarker(float numPages) :
+ BaseStackMarker(numPages, TRUE)
+ {
+ SCAN_SCOPE_BEGIN;
+ ANNOTATION_FN_SO_INTOLERANT;
+ }
+
+ DEBUG_NOINLINE ~AutoCleanupStackMarker()
+ {
+ SCAN_SCOPE_END;
+ CheckForBackoutViolation();
+ }
+};
+
+#define VALIDATE_BACKOUT_STACK_CONSUMPTION \
+ AutoCleanupStackMarker __stackMarker(ADJUST_PROBE(BACKOUT_CODE_STACK_LIMIT));
+
+#define VALIDATE_BACKOUT_STACK_CONSUMPTION_FOR(numPages) \
+ AutoCleanupStackMarker __stackMarker(ADJUST_PROBE(numPages));
+
+#define UNSAFE_BEGIN_VALIDATE_BACKOUT_STACK_CONSUMPTION_NO_DISABLE \
+ BaseStackMarker __stackMarkerNoDisable(ADJUST_PROBE(BACKOUT_CODE_STACK_LIMIT), FALSE);
+
+#define UNSAFE_BEGIN_VALIDATE_BACKOUT_STACK_CONSUMPTION_NO_DISABLE_FOR(numPages) \
+ BaseStackMarker __stackMarkerNoDisable(ADJUST_PROBE(numPages), FALSE);
+
+#define UNSAFE_END_VALIDATE_BACKOUT_STACK_CONSUMPTION_NO_DISABLE \
+ __stackMarkerNoDisable.CheckForBackoutViolation();
+
+#define VALIDATE_HOLDER_STACK_CONSUMPTION_FOR_TYPE(validationType) \
+ _ASSERTE(validationType != HSV_NoValidation); \
+ AutoCleanupStackMarker __stackMarker( \
+ ADJUST_PROBE(validationType == HSV_ValidateNormalStackReq ? HOLDER_CODE_NORMAL_STACK_LIMIT : HOLDER_CODE_MINIMUM_STACK_LIMIT));
+
+class AutoCleanupDisableBackoutStackValidation
+{
+ public:
+ AutoCleanupDisableBackoutStackValidation();
+ ~AutoCleanupDisableBackoutStackValidation();
+
+private:
+ BOOL m_fAlreadyDisabled;
+
+};
+
+// This macros disables the backout stack validation in the current scope. It should
+// only be used in very rare situations. If you think you might have such a situation,
+// please talk to the stack overflow devs before using it.
+#define DISABLE_BACKOUT_STACK_VALIDATION \
+ AutoCleanupDisableBackoutStackValidation __disableBacoutStackValidation;
+
+// In debug mode, we want to do a little more work on this transition to note the transition in the thread.
+class DebugSOIntolerantTransitionHandler : public SOIntolerantTransitionHandler
+{
+ BOOL m_prevSOTolerantState;
+ ClrDebugState* m_clrDebugState;
+
+ public:
+ DebugSOIntolerantTransitionHandler();
+ ~DebugSOIntolerantTransitionHandler();
+};
+
+// This is the base class structure for our probe infrastructure. We declare it here
+// so that we can properly declare instances outside of the VM tree. But we only do the
+// probes when we have a managed thread.
+class BaseStackGuardGeneric
+{
+public:
+ enum
+ {
+ cPartialInit, // Not yet intialized
+ cInit, // Initialized and installed
+ cUnwound, // Unwound on a normal path (used for debugging)
+ cEHUnwound // Unwound on an exception path (used for debugging)
+ } m_eInitialized;
+
+ // *** Following fields must not move. The fault injection framework depends on them.
+ BaseStackGuard *m_pPrevGuard; // Previous guard for this thread.
+ UINT_PTR *m_pMarker; // Pointer to where to put our marker cookie on the stack.
+ unsigned int m_numPages; // space needed, specified in number of pages
+ BOOL m_isBoundaryGuard; // used to mark when we've left the EE
+ BOOL m_fDisabled; // Used to enable/disable stack guard
+
+
+ // *** End of fault injection-dependent fields
+
+ // The following fields are really here to provide us with some nice debugging information.
+ const char *m_szFunction;
+ const char *m_szFile;
+ unsigned int m_lineNum;
+ const char *m_szNextFunction; // Name of the probe that came after us.
+ const char *m_szNextFile;
+ unsigned int m_nextLineNum;
+ DWORD m_UniqueId;
+ unsigned int m_depth; // How deep is this guard in the list of guards for this thread?
+ BOOL m_fProtectedStackPage; // TRUE if we protected a stack page with PAGE_NOACCESS.
+ BOOL m_fEHInProgress; // Is an EH in progress? This is cleared on a catch.
+ BOOL m_exceptionOccurred; // Did an exception occur through this probe?
+
+protected:
+ BaseStackGuardGeneric()
+ {
+ }
+
+public:
+ BaseStackGuardGeneric(const char *szFunction, const char *szFile, unsigned int lineNum) :
+ m_pPrevGuard(NULL), m_pMarker(NULL),
+ m_szFunction(szFunction), m_szFile(szFile), m_lineNum(lineNum),
+ m_szNextFunction(NULL), m_szNextFile(NULL), m_nextLineNum(0),
+ m_fProtectedStackPage(FALSE), m_UniqueId(-1), m_numPages(0),
+ m_eInitialized(cPartialInit), m_fDisabled(FALSE),
+ m_isBoundaryGuard(FALSE),
+ m_fEHInProgress(FALSE),
+ m_exceptionOccurred(FALSE)
+ {
+ STATIC_CONTRACT_LEAF;
+ }
+
+ BOOL RequiresNStackPages(unsigned int n, BOOL fThrowOnSO = TRUE)
+ {
+ if (g_fp_BaseStackGuard_RequiresNStackPages == NULL)
+ {
+ return TRUE;
+ }
+ return g_fp_BaseStackGuard_RequiresNStackPages(this, n, fThrowOnSO);
+ }
+
+ BOOL RequiresNStackPagesThrowing(unsigned int n)
+ {
+ if (g_fp_BaseStackGuard_RequiresNStackPages == NULL)
+ {
+ return TRUE;
+ }
+ return g_fp_BaseStackGuard_RequiresNStackPages(this, n, TRUE);
+ }
+
+ BOOL RequiresNStackPagesNoThrow(unsigned int n)
+ {
+ if (g_fp_BaseStackGuard_RequiresNStackPages == NULL)
+ {
+ return TRUE;
+ }
+ return g_fp_BaseStackGuard_RequiresNStackPages(this, n, FALSE);
+ }
+
+ void CheckStack()
+ {
+ if (m_eInitialized == cInit)
+ {
+ g_fp_BaseStackGuard_CheckStack(this);
+ }
+ }
+
+ void SetNoException()
+ {
+ m_exceptionOccurred = FALSE;
+ }
+
+ BOOL DidExceptionOccur()
+ {
+ return m_exceptionOccurred;
+ }
+
+ BOOL Enabled()
+ {
+ return !m_fDisabled;
+ }
+
+ void DisableGuard()
+ {
+ // As long as we don't have threads mucking with other thread's stack
+ // guards, we don't need to synchronize this.
+ m_fDisabled = TRUE;
+ }
+
+ void EnableGuard()
+ {
+ // As long as we don't have threads mucking with other thread's stack
+ // guards, we don't need to synchronize this.
+ m_fDisabled = FALSE;
+ }
+
+
+};
+
+class StackGuardDisabler
+{
+ BOOL m_fDisabledGuard;
+
+public:
+ StackGuardDisabler();
+ ~StackGuardDisabler();
+ void NeverRestoreGuard();
+
+};
+
+
+
+// Derived version, add a dtor that automatically calls Check_Stack, move convenient, but can't use with SEH.
+class AutoCleanupStackGuardGeneric : public BaseStackGuardGeneric
+{
+protected:
+ AutoCleanupStackGuardGeneric()
+ {
+ }
+
+public:
+ AutoCleanupStackGuardGeneric(const char *szFunction, const char *szFile, unsigned int lineNum) :
+ BaseStackGuardGeneric(szFunction, szFile, lineNum)
+ {
+ STATIC_CONTRACT_LEAF;
+ }
+
+ ~AutoCleanupStackGuardGeneric()
+ {
+ STATIC_CONTRACT_WRAPPER;
+ CheckStack();
+ }
+};
+
+
+// Used to remove stack guard... (kind of like a poor man's BEGIN_SO_TOLERANT
+#define REMOVE_STACK_GUARD \
+ StackGuardDisabler __guardDisable;
+
+// Used to transition into intolerant code when handling a SO
+#define BEGIN_SO_INTOLERANT_CODE_NOPROBE \
+ { \
+ DebugSOIntolerantTransitionHandler __soIntolerantTransitionHandler; \
+ /* work around unreachable code warning */ \
+ if (true) \
+ { \
+ DEBUG_ASSURE_NO_RETURN_BEGIN(SO_INTOLERANT)
+
+#define END_SO_INTOLERANT_CODE_NOPROBE \
+ ; \
+ DEBUG_ASSURE_NO_RETURN_END(SO_INTOLERANT) \
+ } \
+ __soIntolerantTransitionHandler.SetNoException(); \
+ } \
+
+
+
+#define BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(ActionOnSO) \
+ { \
+ AutoCleanupStackGuardGeneric stack_guard_XXX(__FUNCTION__, __FILE__, __LINE__); \
+ if (! stack_guard_XXX.RequiresNStackPagesNoThrow(ADJUST_PROBE(g_EntryPointProbeAmount))) \
+ { \
+ ActionOnSO; \
+ } \
+ else \
+ { \
+ DebugSOIntolerantTransitionHandler __soIntolerantTransitionHandler; \
+ ANNOTATION_SO_PROBE_BEGIN(DEFAULT_ENTRY_PROBE_AMOUNT); \
+ if (true) \
+ { \
+ DEBUG_ASSURE_NO_RETURN_BEGIN(SO_INTOLERANT)
+
+
+#define END_SO_INTOLERANT_CODE \
+ ; \
+ DEBUG_ASSURE_NO_RETURN_END(SO_INTOLERANT) \
+ } \
+ ANNOTATION_SO_PROBE_END; \
+ __soIntolerantTransitionHandler.SetNoException(); \
+ stack_guard_XXX.SetNoException(); \
+ } \
+ } \
+
+
+#define BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD_FORCE_SO() \
+ EnsureSOTolerant(); \
+ BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(DontCallDirectlyForceStackOverflow()); \
+
+
+// Restores the SO-tolerance state and the marker for the current guard if any
+#define RESTORE_SO_TOLERANCE_STATE \
+ RestoreSOToleranceState();
+
+#define HANDLE_STACKOVERFLOW_AFTER_CATCH \
+ HandleStackOverflowAfterCatch()
+
+#elif defined(STACK_GUARDS_RELEASE)
+
+#define VALIDATE_BACKOUT_STACK_CONSUMPTION
+#define VALIDATE_BACKOUT_STACK_CONSUMPTION_FOR
+#define UNSAFE_BEGIN_VALIDATE_BACKOUT_STACK_CONSUMPTION_NO_DISABLE
+#define UNSAFE_BEGIN_VALIDATE_BACKOUT_STACK_CONSUMPTION_NO_DISABLE_FOR(numPages)
+#define UNSAFE_END_VALIDATE_BACKOUT_STACK_CONSUMPTION_NO_DISABLE
+#define VALIDATE_HOLDER_STACK_CONSUMPTION_FOR_TYPE(validationType)
+#define RESTORE_SO_TOLERANCE_STATE
+#define HANDLE_STACKOVERFLOW_AFTER_CATCH \
+ HandleStackOverflowAfterCatch()
+#define DISABLE_BACKOUT_STACK_VALIDATION
+#define BACKOUT_STACK_VALIDATION_VIOLATION
+#define BEGIN_SO_INTOLERANT_CODE_NOPROBE
+#define END_SO_INTOLERANT_CODE_NOPROBE
+#define REMOVE_STACK_GUARD
+
+#define BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(ActionOnSO) \
+ { \
+ if (g_StackProbingEnabled && !g_fpDoProbe(ADJUST_PROBE(DEFAULT_ENTRY_PROBE_AMOUNT)))\
+ { \
+ ActionOnSO; \
+ } else { \
+ SOIntolerantTransitionHandler __soIntolerantTransitionHandler; \
+ /* work around unreachable code warning */ \
+ if (true) \
+ { \
+ DEBUG_ASSURE_NO_RETURN_BEGIN(SO_INTOLERANT)
+
+#define BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD_FORCE_SO() \
+ BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(DontCallDirectlyForceStackOverflow()); \
+
+#define END_SO_INTOLERANT_CODE \
+ ; \
+ DEBUG_ASSURE_NO_RETURN_END(SO_INTOLERANT) \
+ } \
+ __soIntolerantTransitionHandler.SetNoException(); \
+ } \
+ }
+
+#endif
+
+#endif // !DACCESS_COMPILE
+#endif // FEATURE_STACK_PROBES
+
+// if the feature is off or we are compiling for DAC, disable all the probes
+#if !defined(FEATURE_STACK_PROBE) || defined(DACCESS_COMPILE)
+
+#define VALIDATE_BACKOUT_STACK_CONSUMPTION
+#define VALIDATE_BACKOUT_STACK_CONSUMPTION_FOR
+#define UNSAFE_BEGIN_VALIDATE_BACKOUT_STACK_CONSUMPTION_NO_DISABLE
+#define UNSAFE_BEGIN_VALIDATE_BACKOUT_STACK_CONSUMPTION_NO_DISABLE_FOR(numPages)
+#define UNSAFE_END_VALIDATE_BACKOUT_STACK_CONSUMPTION_NO_DISABLE
+#define VALIDATE_HOLDER_STACK_CONSUMPTION_FOR_TYPE(validationType)
+#define BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD(ActionOnSO)
+#define BEGIN_SO_INTOLERANT_CODE_NO_THROW_CHECK_THREAD_FORCE_SO()
+#define END_SO_INTOLERANT_CODE
+#define RESTORE_SO_TOLERANCE_STATE
+
+#define HANDLE_STACKOVERFLOW_AFTER_CATCH
+
+#define DISABLE_BACKOUT_STACK_VALIDATION
+#define BACKOUT_STACK_VALIDATION_VIOLATION
+#define BEGIN_SO_INTOLERANT_CODE_NOPROBE
+#define END_SO_INTOLERANT_CODE_NOPROBE
+#define REMOVE_STACK_GUARD
+
+// Probe size is 0 as Stack Overflow probing is not enabled
+#define DEFAULT_ENTRY_PROBE_AMOUNT 0
+
+#define BACKOUT_CODE_STACK_LIMIT 0
+
+#endif //!FEATURE_STACK_PROBE || DACCESS_COMPILE
+
+#endif // __GENERICSTACKPROBE_h__
diff --git a/src/inc/genericstackprobe.inl b/src/inc/genericstackprobe.inl
new file mode 100644
index 0000000000..9b8dd410be
--- /dev/null
+++ b/src/inc/genericstackprobe.inl
@@ -0,0 +1,15 @@
+// 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.
+//
+
+//
+
+
+#ifndef _GENERICSTACKPROBE_INL_
+#define _GENERICSTACKPROBE_INL_
+
+#include "genericstackprobe.h"
+
+
+#endif // _GENERICSTACKPROBE_INL_
diff --git a/src/inc/genheaders.cs b/src/inc/genheaders.cs
new file mode 100644
index 0000000000..af33b1d17f
--- /dev/null
+++ b/src/inc/genheaders.cs
@@ -0,0 +1,222 @@
+using System;
+using System.Xml;
+using System.Xml.Schema;
+using System.IO;
+
+public class GenerateHeaders {
+
+ public static void Main(string[] args) {
+
+ if (args.Length != 3) {
+ Console.WriteLine("Usage:genheaders XML-file header-file resorce-file");
+ return;
+ }
+
+ ValidateXML(args[0]);
+ String Message=null;
+ String SymbolicName=null;
+ String NumericValue=null;
+ String tempheaderfile = "temp.h";
+ String temprcfile = "temp.rc";
+
+ StreamWriter HSW=File.CreateText(tempheaderfile);
+ StreamWriter RSW=File.CreateText(temprcfile);
+
+ int FaciltyUrt=0x13;
+ int SeveritySuccess=0;
+ int SeverityError=1;
+
+ int minSR = MakeHresult(SeveritySuccess,FaciltyUrt,0);
+ int maxSR = MakeHresult(SeveritySuccess,FaciltyUrt,0xffff);
+ int minHR = MakeHresult(SeverityError,FaciltyUrt,0);
+ int maxHR = MakeHresult(SeverityError,FaciltyUrt,0xffff);
+
+
+ PrintHeader(HSW);
+ PrintResourceHeader(RSW);
+
+ XmlTextReader rdr = new XmlTextReader(args[0]);
+ rdr.WhitespaceHandling = WhitespaceHandling.None;
+
+ while (rdr.Read()) {
+
+ switch (rdr.NodeType) {
+
+ case XmlNodeType.Element:
+
+ if (rdr.Name.ToString() == "HRESULT") {
+ NumericValue=rdr.GetAttribute("NumericValue");
+ }
+ if (rdr.Name.ToString() == "Message") {
+ Message = rdr.ReadString();
+ }
+ if (rdr.Name.ToString() == "SymbolicName") {
+ SymbolicName = rdr.ReadString();
+ }
+
+ break;
+
+ case XmlNodeType.EndElement:
+ if(rdr.Name.ToString() == "HRESULT"){
+
+ // For CLR Hresult's we take the last 4 digits as the resource strings.
+
+ if ( (NumericValue.StartsWith("0x")) || (NumericValue.StartsWith("0X")) ) {
+
+ String HexResult = NumericValue.Substring(2);
+ int num = int.Parse(HexResult, System.Globalization.NumberStyles.HexNumber);
+
+ if ((num>minSR) && (num <= maxSR)) {
+ num = num & 0xffff;
+ HSW.WriteLine("#define " + SymbolicName + " SMAKEHR(0x" + num.ToString("x") + ")");
+ } else if ((num>minHR) && (num <= maxHR)) {
+ num = num & 0xffff;
+ HSW.WriteLine("#define " + SymbolicName + " EMAKEHR(0x" + num.ToString("x") + ")");
+ } else {
+ HSW.WriteLine("#define " + SymbolicName + " " + NumericValue );
+ }
+
+
+
+ } else {
+ HSW.WriteLine("#define " + SymbolicName + " " + NumericValue );
+ }
+
+ if (Message != null) {
+ RSW.Write("\tMSG_FOR_URT_HR(" + SymbolicName + ") ");
+ RSW.WriteLine(Message);
+ }
+
+ SymbolicName = null;
+ NumericValue = null;
+ Message = null;
+ }
+ break;
+
+ }
+ }
+
+ PrintFooter(HSW);
+ PrintResourceFooter(RSW);
+
+ HSW.Close();
+ RSW.Close();
+
+ bool AreFilesEqual = false;
+
+ if (File.Exists(args[1])) {
+ StreamReader sr1 = new StreamReader(tempheaderfile);
+ StreamReader sr2 = new StreamReader(args[1]);
+ AreFilesEqual = CompareFiles(sr1, sr2);
+ sr1.Close();
+ sr2.Close();
+ }
+
+ if (!AreFilesEqual) {
+ File.Copy(tempheaderfile, args[1], true);
+ File.Copy(temprcfile, args[2], true);
+ }
+
+ if (!File.Exists(args[2])) {
+ File.Copy(temprcfile, args[2], true);
+ }
+
+ File.Delete(tempheaderfile);
+ File.Delete(temprcfile);
+ }
+
+ private static void ValidateXML (String XMLFile) {
+
+ // Set the validation settings on the XmlReaderSettings object.
+ XmlReaderSettings settings = new XmlReaderSettings();
+
+ settings.ValidationType = ValidationType.Schema;
+ settings.ValidationFlags |= XmlSchemaValidationFlags.ProcessInlineSchema;
+
+ settings.ValidationEventHandler += new ValidationEventHandler (ValidationCallBack);
+
+ // Create the XmlReader object.
+ XmlReader reader = XmlReader.Create(XMLFile, settings);
+
+ // Parse the file.
+
+ while (reader.Read()) {
+ }
+ }
+
+ // Display any validation errors.
+ private static void ValidationCallBack(object sender, ValidationEventArgs e) {
+ Console.WriteLine("Validation Error: {0}", e.Message);
+ Environment.Exit(-1);
+ }
+
+
+ private static void PrintHeader(StreamWriter SW) {
+
+ SW.WriteLine("#ifndef __COMMON_LANGUAGE_RUNTIME_HRESULTS__");
+ SW.WriteLine("#define __COMMON_LANGUAGE_RUNTIME_HRESULTS__");
+ SW.WriteLine();
+ SW.WriteLine("#include <winerror.h>");
+ SW.WriteLine();
+ SW.WriteLine();
+ SW.WriteLine("//");
+ SW.WriteLine("//This file is AutoGenerated -- Do Not Edit by hand!!!");
+ SW.WriteLine("//");
+ SW.WriteLine("//Add new HRESULTS along with their corresponding error messages to");
+ SW.WriteLine("//corerror.xml");
+ SW.WriteLine("//");
+ SW.WriteLine();
+ SW.WriteLine("#ifndef FACILITY_URT");
+ SW.WriteLine("#define FACILITY_URT 0x13");
+ SW.WriteLine("#endif");
+ SW.WriteLine("#ifndef EMAKEHR");
+ SW.WriteLine("#define SMAKEHR(val) MAKE_HRESULT(SEVERITY_SUCCESS, FACILITY_URT, val)");
+ SW.WriteLine("#define EMAKEHR(val) MAKE_HRESULT(SEVERITY_ERROR, FACILITY_URT, val)");
+ SW.WriteLine("#endif");
+ SW.WriteLine();
+ }
+
+ private static void PrintFooter(StreamWriter SW) {
+ SW.WriteLine();
+ SW.WriteLine();
+ SW.WriteLine("#endif // __COMMON_LANGUAGE_RUNTIME_HRESULTS__");
+ }
+
+ private static void PrintResourceHeader(StreamWriter SW) {
+ SW.WriteLine("STRINGTABLE DISCARDABLE");
+ SW.WriteLine("BEGIN");
+ }
+
+ private static void PrintResourceFooter(StreamWriter SW) {
+ SW.WriteLine("END");
+ }
+
+ private static bool CompareFiles(StreamReader sr1, StreamReader sr2) {
+ String line1,line2;
+
+ while (true) {
+ line1 = sr1.ReadLine();
+ line2 = sr2.ReadLine();
+
+ if ( (line1 == null) && (line2 == null) ) {
+ return true;
+ }
+
+ if (line1 != line2) {
+ return false;
+ }
+
+ }
+
+ }
+
+ private static int MakeHresult(int sev, int fac, int code) {
+ return ((sev<<31) | (fac<<16) | (code));
+ }
+}
+
+
+
+
+
+
diff --git a/src/inc/genrops.pl b/src/inc/genrops.pl
new file mode 100644
index 0000000000..415eea731a
--- /dev/null
+++ b/src/inc/genrops.pl
@@ -0,0 +1,91 @@
+# 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.
+#
+# GENREFOPS.PL
+#
+# PERL script used to generate the numbering of the reference opcodes
+#
+#use strict 'vars';
+#use strict 'subs';
+#use strict 'refs';
+
+print "Reference opcodes\n";
+print "This file is presently only for human consumption\n";
+print "This file is generated from opcode.def using the genrops.pl script\n\n";
+print "Name String Name refop encode\n";
+print "-----------------------------------------------------------------\n";
+
+my $ret = 0;
+my %oneByte;
+my %twoByte;
+$count = 0;
+while (<>)
+{
+ # Process only OPDEF(....) lines
+ if (/OPDEF\(\s*/)
+ {
+ chop; # Strip off trailing CR
+ s/^OPDEF\(\s*//; # Strip off "OP("
+ s/\)$//; # Strip off ")" at end
+ s/,\s*/,/g; # Remove whitespace
+
+ # Split the line up into its basic parts
+ ($enumname, $stringname, $pop, $push, $operand, $type, $size, $s1, $s2, $ctrl) = split(/,/);
+ $s1 =~ s/0x//;
+ $s1 = hex($s1);
+ $s2 =~ s/0x//;
+ $s2 = hex($s2);
+
+
+ my $line = sprintf("%-24s %-24s 0x%03x",
+ $enumname, $stringname, $count);
+ if ($size == 1) {
+ $line .= sprintf(" 0x%02x\n", $s2);
+ if ($oneByte{$s2}) {
+ printf("Error opcode 0x%x already defined!\n", $s2);
+ print " Old = $oneByte{$s2}";
+ print " New = $line";
+ $ret = -1;
+ }
+ $oneByte{$s2} = $line;
+ }
+ elsif ($size == 2) {
+ if ($twoByte{$s2}) {
+ printf("Error opcode 0x%x 0x%x already defined!\n", $s1, $s2);
+ print " Old = $twoByte{$s2}";
+ print " New = $line";
+ $ret = -1;
+ }
+ $line .= sprintf(" 0x%02x 0x%02x\n", $s1, $s2);
+ $twoByte{$s2 + 256 * $s1} = $line;
+ }
+ else {
+ $line .= "\n";
+ push(@deprecated, $line);
+ }
+ $count++;
+ }
+}
+
+my $opcode;
+my $lastOp = -1;
+foreach $opcode (sort {$a <=> $b} keys(%oneByte)) {
+ printf("***** GAP %d instrs ****\n", $opcode - $lastOp) if ($lastOp + 1 != $opcode && $lastOp > 0);
+ print $oneByte{$opcode};
+ $lastOp = $opcode;
+}
+
+$lastOp = -1;
+foreach $opcode (sort {$a <=> $b} keys(%twoByte)) {
+ printf("***** GAP %d instrs ****\n", $opcode - $lastOp) if ($lastOp + 1 != $opcode && $lastOp > 0);
+ print $twoByte{$opcode};
+ $lastOp = $opcode;
+}
+
+print @deprecated;
+
+exit($ret);
+
+
+
diff --git a/src/inc/getproductversionnumber.h b/src/inc/getproductversionnumber.h
new file mode 100644
index 0000000000..81367fa3e5
--- /dev/null
+++ b/src/inc/getproductversionnumber.h
@@ -0,0 +1,77 @@
+// 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.
+//
+// GetProductVersionNumber.h
+//
+// Helper function to retrieve the file version number of a file.
+//
+// ======================================================================================
+
+
+
+#ifndef __GetProductVersionNumber_h__
+#define __GetProductVersionNumber_h__
+
+#include "contract.h"
+#include "sstring.h"
+#include "holder.h"
+#include "ex.h"
+
+//---------------------------------------------------------------------------------------
+//
+// Given the full path to an image, return the product version number.
+//
+// Arguments:
+// szFullPath - full path to the image
+// pdwVersionMS - out parameter; return the most significant 4 bytes of the version number according to
+// the VS_FIXEDFILEINFO convention
+// pdwVersionLS - out parameter; return the least significant 4 bytes of the version number according to
+// the VS_FIXEDFILEINFO convention
+//
+// Notes:
+// Throws on error
+
+void inline GetProductVersionNumber(SString &szFullPath, DWORD * pdwVersionMS, DWORD * pdwVersionLS)
+{
+ WRAPPER_NO_CONTRACT;
+#ifndef FEATURE_PAL
+
+ DWORD dwDummy = 0;
+ DWORD dwFileInfoSize = 0;
+
+ // Get the size of all of the file version information.
+ dwFileInfoSize = GetFileVersionInfoSize(szFullPath, &dwDummy);
+ if (dwFileInfoSize == 0)
+ {
+ ThrowLastError();
+ }
+
+ // Create the buffer to store the file information.
+ NewHolder<BYTE> pbFileInfo(new BYTE[dwFileInfoSize]);
+
+ // Actually retrieve the file version information.
+ if (!GetFileVersionInfo(szFullPath, NULL, dwFileInfoSize, pbFileInfo))
+ {
+ ThrowLastError();
+ }
+
+ // Now retrieve only the relevant version information, which will be returned in a VS_FIXEDFILEINFO.
+ UINT uVersionInfoSize = 0;
+ VS_FIXEDFILEINFO * pVersionInfo = NULL;
+
+ if (!VerQueryValue(pbFileInfo, W("\\"), reinterpret_cast<LPVOID *>(&pVersionInfo), &uVersionInfoSize))
+ {
+ ThrowLastError();
+ }
+ _ASSERTE(uVersionInfoSize == sizeof(VS_FIXEDFILEINFO));
+
+ *pdwVersionMS = pVersionInfo->dwProductVersionMS;
+ *pdwVersionLS = pVersionInfo->dwProductVersionLS;
+#else
+ *pdwVersionMS = 0;
+ *pdwVersionLS = 0;
+#endif // FEATURE_PAL
+}
+
+#endif // __GetProductVersionNumber_h__
diff --git a/src/inc/guidfromname.h b/src/inc/guidfromname.h
new file mode 100644
index 0000000000..2974de44aa
--- /dev/null
+++ b/src/inc/guidfromname.h
@@ -0,0 +1,19 @@
+// 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.
+
+
+#ifndef GUIDFROMNAME_H_
+#define GUIDFROMNAME_H_
+
+// GuidFromName.h - function prototype
+
+void CorGuidFromNameW
+(
+ GUID * pGuidResult, // resulting GUID
+ LPCWSTR wzName, // the unicode name from which to generate a GUID
+ SIZE_T cchName // name length in count of unicode character.
+ // -1 if lstrlen(wzName)+1 should be used
+);
+
+#endif // GUIDFROMNAME_H_
diff --git a/src/inc/holder.h b/src/inc/holder.h
new file mode 100644
index 0000000000..a4d19bbf92
--- /dev/null
+++ b/src/inc/holder.h
@@ -0,0 +1,1515 @@
+// 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.
+
+
+#ifndef __HOLDER_H_
+#define __HOLDER_H_
+
+#include <wincrypt.h>
+#include "cor.h"
+#include "genericstackprobe.h"
+#include "staticcontract.h"
+#include "volatile.h"
+#include "palclr.h"
+
+#ifdef PAL_STDCPP_COMPAT
+#include <utility>
+#include <type_traits>
+#else
+#include "clr_std/utility"
+#include "clr_std/type_traits"
+#endif
+
+#if defined(FEATURE_COMINTEROP) && !defined(STRIKE)
+#include <Activation.h>
+#include <Inspectable.h>
+#endif
+
+// Note: you can't use CONTRACT's in this file. You can't use dynamic contracts because the impl of dynamic
+// contracts depends on holders. You can't use static contracts because they include the function name as a string,
+// and the template names in this file are just too long, so you get a compiler error.
+//
+// All the functions in this file are pretty basic, so the lack of CONTRACT's isn't a big loss.
+
+#ifdef _MSC_VER
+// Make sure we can recurse deep enough for FORCEINLINE
+#pragma inline_recursion(on)
+#pragma inline_depth(16)
+#pragma warning(disable:4714)
+#endif // _MSC_VER
+
+//------------------------------------------------------------------------------------------------
+// Declare but do not define methods that would normally be automatically generated by the
+// compiler. This will produce a link-time error if they are used. This is involved in object
+// initialization and operator eliding; see
+// http://groups.google.com/group/comp.lang.c++/msg/3cd673ab749bed83?dmode=source
+// for the intricate details.
+
+#ifdef __GNUC__
+// GCC checks accessibility of the copy ctor before performing elision optimization, so
+// it must be declared as public. VC does not, so we can declare it private to give an
+// earlier error message.
+#define HIDE_GENERATED_METHODS(_NAME) \
+ public: \
+ _NAME(_NAME const &); \
+ private: \
+ _NAME & operator=(_NAME const &);
+#else
+#define HIDE_GENERATED_METHODS(_NAME) \
+ private: \
+ _NAME(_NAME const &); \
+ _NAME & operator=(_NAME const &);
+#endif
+
+
+#ifdef _DEBUG
+
+#ifdef FEATURE_FUSION
+namespace NATIVE_BINDER_SPACE
+{
+ class NativeAssembly;
+}
+#endif //FEATURE_FUSION
+
+//------------------------------------------------------------------------------------------------
+// This is used to make Visual Studio autoexp.dat work sensibly with holders again.
+// The problem is that certain codebases (particulary Fusion) implement key data structures
+// using a class but refer to it using a holder to an interface type. This combination prevents
+// autoexp rules from working as desired.
+//
+// Example: Take this useful autoexp rule for CAssemblyName.
+//
+// CAssemblyName=<_rProp._rProp[3].asStr>
+//
+// To get the same rule to fire when your assemblyname is wrapped in a ReleaseHolder,
+// add these companion rules.
+//
+// HolderBase<CAssemblyName *>=<m_value->_rProp._rProp[3].asStr>
+// HolderBase<IAssemblyName *>=<m_pAutoExpVisibleValue->_asCAssemblyName->_rProp._rProp[3].asStr>
+//
+//------------------------------------------------------------------------------------------------
+struct AutoExpVisibleValue
+{
+ private:
+ union
+ {
+ // Only include a class name here if it is customarily referred to through an abstract interface.
+#ifdef FEATURE_FUSION
+ const class CAssemblyName *_asCAssemblyName;
+ const class CAssembly *_asCAssembly;
+ const class CAssemblyManifestImport *_asCAssemblyManifestImport;
+ const class CAssemblyModuleImport *_asCAssemblyModuleImport;
+ const class CHostAssembly *_asCHostAssembly;
+ const class CHostAssemblyModuleImport *_asCHostAssemblyModuleImport;
+ const class BindResult *_asBindResult;
+ const class BindContext *_asBindContext;
+ const class NATIVE_BINDER_SPACE::NativeAssembly *_asNativeAssembly;
+ const class AssemblyLocation *_asAssemblyLocation;
+#endif //FEATURE_FUSION
+
+#if defined(FEATURE_APPX)
+ const class AppXBindResultImpl *_asAppXBindResultImpl;
+#endif
+
+#ifndef FEATURE_CORECLR
+ const class PEFingerprint *_asPEFingerprint;
+#endif //!FEATURE_CORECLR
+ const void *_pPreventEmptyUnion;
+ };
+};
+#endif //_DEBUG
+
+//-----------------------------------------------------------------------------
+// Holder is the base class of all holder objects. Any backout object should derive from it.
+// (Eventually some additional bookeeping and exception handling code will be placed in this
+// base class.)
+//
+// There are several ways to use this class:
+// 1. Derive from HolderBase, and instantiate a Holder or Wrapper around your base. This is necessary
+// if you need to add more state to your holder.
+// 2. Instantiate the Holder template with your type and functions.
+// 3. Instantiate the Wrapper template with your type and functions. The Wrapper adds some additional
+// operator overloads to provide "smart pointer" like behavior
+// 4. Use a prebaked Holder. This is ALWAYS the preferable strategy. It is expected that
+// the general design patter is that Holders will be provided as part of a typical data abstraction.
+// (See Crst for an example of this.)
+//-----------------------------------------------------------------------------
+
+
+
+//-----------------------------------------------------------------------------
+// HolderBase defines the base holder functionality. You can subtype and plug in
+// a different base if you need to add more members for access during
+// acquire & release
+//-----------------------------------------------------------------------------
+template <typename TYPE>
+class HolderBase
+{
+ protected:
+ TYPE m_value;
+
+ HolderBase(TYPE value)
+ : m_value(value)
+ {
+ // TODO: Find a way to enable this check.
+ // We can have a holder in SO tolerant, then probe, then acquire a value. This works
+ // because the dtor is guaranteed to run with enough stack.
+ // EnsureSOIntolerantOK(__FUNCTION__, __FILE__, __LINE__);
+
+#ifdef _DEBUG
+ m_pAutoExpVisibleValue = (const AutoExpVisibleValue *)(&m_value);
+#endif //_DEBUG
+ }
+
+ void DoAcquire()
+ {
+ // Insert any global or thread bookeeping here
+ }
+
+ void DoRelease()
+ {
+ // Insert any global or thread bookeeping here
+ }
+
+#ifdef _DEBUG
+ private:
+ // NOT DEAD CODE: This field is not referenced in the source code but it is not a dead field. See comments above "class AutoExpVisibleValue" for why this field exists.
+ // Note: What we really want is for m_value and m_pAutoExpVisibleValue to be members of a union. But the compiler won't let you build that
+ // since it can't prove that "TYPE" doesn't have a non-trivial constructor.
+ const AutoExpVisibleValue *m_pAutoExpVisibleValue; // This field is to be referenced from individual autoexp.dat files, NOT from the CLR source code.
+#endif //_DEBUG
+
+}; // class HolderBase<>
+
+#ifndef _PREFAST_ // Work around an ICE error in EspX.dll
+
+template <typename TYPE>
+BOOL CompareDefault(TYPE value, TYPE defaultValue)
+{
+ STATIC_CONTRACT_SUPPORTS_DAC;
+ return value == defaultValue;
+}
+
+#else
+
+template <typename TYPE>
+BOOL CompareDefault(TYPE value, TYPE defaultValue)
+{
+ return FALSE;
+}
+
+#endif
+
+
+template <typename TYPE>
+BOOL NoNull(TYPE value, TYPE defaultValue)
+{
+ return FALSE;
+}
+
+// Used e.g. for retail version of code:SyncAccessHolder
+template <typename TYPE>
+class NoOpBaseHolder
+{
+ public:
+ FORCEINLINE NoOpBaseHolder()
+ {
+ }
+ FORCEINLINE NoOpBaseHolder(TYPE value, BOOL take = TRUE)
+ {
+ }
+ FORCEINLINE ~NoOpBaseHolder()
+ {
+ }
+ FORCEINLINE void Assign(TYPE value, BOOL fTake = TRUE)
+ {
+ }
+ FORCEINLINE void Acquire()
+ {
+ }
+ FORCEINLINE void Release()
+ {
+ }
+ FORCEINLINE void Clear()
+ {
+ }
+ FORCEINLINE void SuppressRelease()
+ {
+ }
+ FORCEINLINE TYPE Extract()
+ {
+ }
+ FORCEINLINE TYPE GetValue()
+ {
+ }
+ FORCEINLINE BOOL IsNull() const
+ {
+ return FALSE;
+ }
+
+ private:
+ NoOpBaseHolder& operator=(NoOpBaseHolder const &);
+ NoOpBaseHolder(NoOpBaseHolder const &);
+}; // NoOpBaseHolder<>
+
+
+template
+ <
+ typename TYPE,
+ typename BASE,
+ UINT_PTR DEFAULTVALUE = 0,
+ BOOL IS_NULL(TYPE, TYPE) = CompareDefault<TYPE>,
+ HolderStackValidation VALIDATION_TYPE = HSV_ValidateNormalStackReq
+ >
+class BaseHolder : protected BASE
+{
+ protected:
+ BOOL m_acquired; // Have we acquired the resource?
+
+ static_assert(!std::is_pointer<TYPE>::value || DEFAULTVALUE == 0 || DEFAULTVALUE == UINT_PTR(-1 /*INVALID_HANDLE_VALUE*/),
+ "DEFAULTVALUE must be NULL for pointer holders and wrappers.");
+
+ public:
+ FORCEINLINE BaseHolder()
+ : BASE(TYPE(DEFAULTVALUE)),
+ m_acquired(FALSE)
+ {
+ }
+ FORCEINLINE BaseHolder(TYPE value)
+ : BASE(value),
+ m_acquired(FALSE)
+ {
+ if (!IsNull())
+ Acquire();
+ }
+ FORCEINLINE BaseHolder(TYPE value, BOOL takeOwnership)
+ : BASE(value),
+ m_acquired(FALSE)
+ {
+ if (takeOwnership)
+ Acquire();
+ }
+ FORCEINLINE ~BaseHolder()
+ {
+ Release();
+ }
+ // Sets the value to 'value'. Doesn't call Acquire if value is DEFAULTVALUE.
+ FORCEINLINE void Assign(TYPE value)
+ {
+ Assign(value, !IS_NULL(value, TYPE(DEFAULTVALUE)));
+ }
+ // Sets the value to 'value'. Doesn't call Acquire if fTake is FALSE.
+ FORCEINLINE void Assign(TYPE value, BOOL takeOwnership)
+ {
+ Release();
+ this->m_value = value;
+ if (takeOwnership)
+ Acquire();
+ }
+ FORCEINLINE void Acquire()
+ {
+ STATIC_CONTRACT_WRAPPER;
+ _ASSERTE(!m_acquired);
+
+ if (!IsNull())
+ {
+ this->DoAcquire();
+ m_acquired = TRUE;
+ }
+ }
+ FORCEINLINE void Release()
+ {
+ STATIC_CONTRACT_WRAPPER;
+ if (m_acquired)
+ {
+ _ASSERTE(!IsNull());
+
+ if (VALIDATION_TYPE != HSV_NoValidation)
+ {
+ VALIDATE_HOLDER_STACK_CONSUMPTION_FOR_TYPE(VALIDATION_TYPE);
+ this->DoRelease();
+ }
+ else
+ {
+ this->DoRelease();
+ }
+ m_acquired = FALSE;
+ }
+ }
+
+ FORCEINLINE void Clear()
+ {
+ STATIC_CONTRACT_WRAPPER;
+ Assign(TYPE(DEFAULTVALUE), FALSE);
+ }
+ FORCEINLINE void SuppressRelease()
+ {
+ STATIC_CONTRACT_LEAF;
+ m_acquired = FALSE;
+ }
+ FORCEINLINE TYPE Extract()
+ {
+ STATIC_CONTRACT_WRAPPER;
+ SuppressRelease();
+ return GetValue();
+ }
+ FORCEINLINE TYPE GetValue()
+ {
+ STATIC_CONTRACT_LEAF;
+ return this->m_value;
+ }
+ FORCEINLINE BOOL IsNull() const
+ {
+ STATIC_CONTRACT_WRAPPER;
+ return IS_NULL(this->m_value, TYPE(DEFAULTVALUE));
+ }
+
+ HIDE_GENERATED_METHODS(BaseHolder)
+}; // BaseHolder<>
+
+template <void (*ACQUIRE)(), void (*RELEASEF)(), HolderStackValidation VALIDATION_TYPE = HSV_ValidateNormalStackReq>
+class StateHolder
+{
+ private:
+ BOOL m_acquired; // Have we acquired the state?
+
+ public:
+ FORCEINLINE StateHolder(BOOL take = TRUE)
+ : m_acquired(FALSE)
+ {
+ STATIC_CONTRACT_WRAPPER;
+ if (take)
+ Acquire();
+ }
+ FORCEINLINE ~StateHolder()
+ {
+ STATIC_CONTRACT_WRAPPER;
+ Release();
+ }
+ FORCEINLINE void Acquire()
+ {
+ STATIC_CONTRACT_WRAPPER;
+ // Insert any global or thread bookeeping here
+
+ _ASSERTE(!m_acquired);
+
+ ACQUIRE();
+ m_acquired = TRUE;
+ }
+ FORCEINLINE void Release()
+ {
+ STATIC_CONTRACT_WRAPPER;
+ // Insert any global or thread bookeeping here
+
+ if (m_acquired)
+ {
+ if (VALIDATION_TYPE != HSV_NoValidation)
+ {
+ VALIDATE_HOLDER_STACK_CONSUMPTION_FOR_TYPE(VALIDATION_TYPE);
+ RELEASEF();
+ }
+ else
+ {
+ RELEASEF();
+ }
+ m_acquired = FALSE;
+ }
+ }
+ FORCEINLINE void Clear()
+ {
+ STATIC_CONTRACT_WRAPPER;
+ if (m_acquired)
+ {
+ RELEASEF();
+ }
+
+ m_acquired = FALSE;
+ }
+ FORCEINLINE void SuppressRelease()
+ {
+ STATIC_CONTRACT_LEAF;
+ m_acquired = FALSE;
+ }
+
+ HIDE_GENERATED_METHODS(StateHolder)
+}; // class StateHolder<>
+
+// Holder for the case where the acquire function can fail.
+template <typename VALUE, BOOL (*ACQUIRE)(VALUE value), void (*RELEASEF)(VALUE value), HolderStackValidation VALIDATION_TYPE = HSV_ValidateNormalStackReq>
+class ConditionalStateHolder
+{
+ private:
+ VALUE m_value;
+ BOOL m_acquired; // Have we acquired the state?
+
+ public:
+ FORCEINLINE ConditionalStateHolder(VALUE value, BOOL take = TRUE)
+ : m_value(value), m_acquired(FALSE)
+ {
+ STATIC_CONTRACT_WRAPPER;
+ if (take)
+ Acquire();
+ }
+ FORCEINLINE ~ConditionalStateHolder()
+ {
+ STATIC_CONTRACT_WRAPPER;
+ Release();
+ }
+ FORCEINLINE BOOL Acquire()
+ {
+ STATIC_CONTRACT_WRAPPER;
+ // Insert any global or thread bookeeping here
+
+ _ASSERTE(!m_acquired);
+
+ m_acquired = ACQUIRE(m_value);
+
+ return m_acquired;
+ }
+ FORCEINLINE void Release()
+ {
+ STATIC_CONTRACT_WRAPPER;
+ // Insert any global or thread bookeeping here
+
+ if (m_acquired)
+ {
+ if (VALIDATION_TYPE != HSV_NoValidation)
+ {
+ VALIDATE_HOLDER_STACK_CONSUMPTION_FOR_TYPE(VALIDATION_TYPE);
+ RELEASEF(m_value);
+ }
+ else
+ {
+ RELEASEF(m_value);
+ }
+ m_acquired = FALSE;
+ }
+ }
+ FORCEINLINE void Clear()
+ {
+ STATIC_CONTRACT_WRAPPER;
+ if (m_acquired)
+ {
+ RELEASEF(m_value);
+ }
+
+ m_acquired = FALSE;
+ }
+ FORCEINLINE void SuppressRelease()
+ {
+ STATIC_CONTRACT_LEAF;
+ m_acquired = FALSE;
+ }
+ FORCEINLINE BOOL Acquired()
+ {
+ STATIC_CONTRACT_LEAF;
+
+ return m_acquired;
+ }
+
+ HIDE_GENERATED_METHODS(ConditionalStateHolder)
+}; // class ConditionalStateHolder<>
+
+
+// Making the copy constructor private produces a warning about "can't generate copy
+// constructor" on all holders (duh, that's the point.)
+#ifdef _MSC_VER
+#pragma warning(disable:4511)
+#endif // _MSC_VER
+
+//-----------------------------------------------------------------------------
+// BaseWrapper is just Base like a Holder, but it "transparently" proxies the type it contains,
+// using operator overloads. Use this when you want a holder to expose the functionality of
+// the value it contains.
+//-----------------------------------------------------------------------------
+template <typename TYPE, typename BASE,
+ UINT_PTR DEFAULTVALUE = 0, BOOL IS_NULL(TYPE, TYPE) = CompareDefault<TYPE>, HolderStackValidation VALIDATION_TYPE = HSV_ValidateNormalStackReq>
+class BaseWrapper : public BaseHolder<TYPE, BASE, DEFAULTVALUE, IS_NULL, VALIDATION_TYPE>
+{
+ typedef BaseHolder<TYPE, BASE, DEFAULTVALUE, IS_NULL, VALIDATION_TYPE> BaseT;
+
+
+#ifdef __GNUC__
+//#pragma GCC visibility push(hidden)
+#endif // __GNUC__
+ // This temporary object takes care of the case where we are initializing
+ // a holder's contents by passing it as an out parameter. The object is
+ // guaranteed to live longer than the call it is passed to, hence we should
+ // properly acquire the object on return
+ friend class AddressInitHolder;
+ class AddressInitHolder
+ {
+ protected:
+ BaseWrapper<TYPE,BASE,DEFAULTVALUE,IS_NULL> &m_holder;
+
+ public:
+ FORCEINLINE AddressInitHolder(BaseWrapper<TYPE,BASE,DEFAULTVALUE,IS_NULL> &holder)
+ : m_holder(holder)
+ {
+ //
+ // We must clear the value, to avoid the following scenario:
+ //
+ // ReleaseHolder<MyType> pMyType;
+ // hr = MyFunction(&pMyType, ...);
+ // <do something with pMyType>
+ // hr = MyFunction(&pMyType, ...); <- calls Release before call and Acquire on return.
+ //
+ // If the second call to MyFunction were to fail and return without updating the
+ // out parameter, then ~AddressInitHolder will all Acquire, which is a no-op on
+ // the underlying pointer but sets m_acquired to TRUE. Thus, when pMyType goes
+ // out of scope, ReleaseHolder will cause a double-release of pMyType.
+ //
+ // By calling Clear, then the call to Acquire in the dtor will not set m_acquired
+ // to true since IsNull(m_holder.m_value) will return true.
+ //
+ m_holder.Clear();
+ }
+ FORCEINLINE ~AddressInitHolder()
+ {
+ m_holder.Acquire();
+ }
+
+ // It's not optimal to have to declare these casting operators. But if we don't,
+ // people cannot cast the result of &holder to these values. (The C++ compiler won't
+ // automatically use the TYPE * cast as an intermediate value.) So we put them here,
+ // rather than forcing callers to double cast in these common cases.
+
+ FORCEINLINE operator IUnknown **()
+ {
+ IUnknown *unknown;
+ // Typesafe check. This will fail at compile time if
+ // m_holder.m_value can't be converted to an IUnknown *.
+ unknown = static_cast<IUnknown*>(m_holder.m_value);
+ // do the cast with an unsafe cast
+ return (IUnknown **)(&m_holder.m_value);
+ }
+
+#if defined(FEATURE_COMINTEROP) && !defined(STRIKE)
+ FORCEINLINE operator IInspectable **()
+ {
+ IInspectable *inspectable;
+ // Typesafe check. This will fail at compile time if
+ // m_holder.m_value can't be converted to an IInspectable *.
+ inspectable = static_cast<IInspectable *>(m_holder.m_value);
+ return (IInspectable **)(&m_holder.m_value);
+
+ }
+#endif // FEATURE_COMINTEROP
+
+ FORCEINLINE operator void **()
+ {
+ return (void **)(&m_holder.m_value);
+ }
+ FORCEINLINE operator void *()
+ {
+ return (void *)(&m_holder.m_value);
+ }
+ };
+
+ // Separate out method with TYPE * cast operator, since it may clash with IUnknown ** or
+ // void ** cast operator.
+ friend class TypedAddressInitHolder;
+ class TypedAddressInitHolder : public AddressInitHolder
+ {
+ public:
+ FORCEINLINE TypedAddressInitHolder(BaseWrapper & holder)
+ : AddressInitHolder(holder)
+ {
+ }
+
+ FORCEINLINE operator TYPE *()
+ {
+ return static_cast<TYPE *>(&this->m_holder.m_value);
+ }
+ };
+#ifdef __GNUC__
+//#pragma GCC visibility pop
+#endif // __GNUC__
+
+ public:
+ FORCEINLINE BaseWrapper()
+ : BaseT(TYPE(DEFAULTVALUE), FALSE)
+ {
+ }
+ FORCEINLINE BaseWrapper(TYPE value)
+ : BaseT(value)
+ {
+ }
+ FORCEINLINE BaseWrapper(TYPE value, BOOL take)
+ : BaseT(value, take)
+ {
+ }
+ FORCEINLINE BaseWrapper& operator=(TYPE value)
+ {
+ BaseT::Assign(value);
+ return *this;
+ }
+ FORCEINLINE operator TYPE() const
+ {
+ return this->m_value;
+ }
+ FORCEINLINE TypedAddressInitHolder operator&()
+ {
+ return TypedAddressInitHolder(*this);
+ }
+ template <typename T>
+ FORCEINLINE bool operator==(T const & value) const
+ {
+ return !!(this->m_value == TYPE(value));
+ }
+ template <typename T>
+ FORCEINLINE bool operator!=(T const & value) const
+ {
+ return !!(this->m_value != TYPE(value));
+ }
+#ifdef __llvm__
+ // This handles the NULL value that is an int and clang
+ // doesn't want to convert int to a pointer
+ FORCEINLINE bool operator==(int value) const
+ {
+ return !!(this->m_value == TYPE((void*)(SIZE_T)value));
+ }
+ FORCEINLINE bool operator!=(int value) const
+ {
+ return !!(this->m_value != TYPE((void*)(SIZE_T)value));
+ }
+#endif // __llvm__
+ FORCEINLINE const TYPE &operator->() const
+ {
+ return this->m_value;
+ }
+ FORCEINLINE int operator!() const
+ {
+ return this->IsNull();
+ }
+
+ private:
+ HIDE_GENERATED_METHODS(BaseWrapper)
+}; // class BaseWrapper<>
+
+//-----------------------------------------------------------------------------
+// Generic templates to use to wrap up acquire/release functionality for Holder
+//-----------------------------------------------------------------------------
+
+template <typename TYPE>
+FORCEINLINE void DoNothing(TYPE value)
+{
+ // @TODO: Due to prefast template problems, implementations of the DoNothing macro have been changed
+ // Search by prefast, and remove them when prefast is ready
+}
+
+FORCEINLINE void DoNothing()
+{
+}
+
+// Prefast stuff.We should have DoNothing<type*> in the holder declaration, but currently
+// prefast doesnt support, it, so im stuffing all these here so if we need to change the template you can change
+// everything here. When prefast works, remove the following functions
+struct ConnectionCookie;
+FORCEINLINE void ConnectionCookieDoNothing(ConnectionCookie* p)
+{
+}
+
+class ComCallWrapper;
+FORCEINLINE void CCWHolderDoNothing(ComCallWrapper* p)
+{
+}
+
+
+FORCEINLINE void DispParamHolderDoNothing(VARIANT* p)
+{
+}
+
+FORCEINLINE void VariantPtrDoNothing(VARIANT* p)
+{
+}
+
+FORCEINLINE void VariantDoNothing(VARIANT)
+{
+}
+
+FORCEINLINE void ZeroDoNothing(VOID* p)
+{
+}
+
+class CtxEntry;
+FORCEINLINE void CtxEntryDoNothing(CtxEntry* p)
+{
+}
+
+struct RCW;
+FORCEINLINE void NewRCWHolderDoNothing(RCW*)
+{
+}
+
+// Prefast stuff.We should have DoNothing<SafeArray*> in the holder declaration
+FORCEINLINE void SafeArrayDoNothing(SAFEARRAY* p)
+{
+}
+
+
+
+
+//-----------------------------------------------------------------------------
+// Holder/Wrapper are the simplest way to define holders - they synthesizes a base class out of
+// function pointers
+//-----------------------------------------------------------------------------
+
+template <typename TYPE, void (*ACQUIREF)(TYPE), void (*RELEASEF)(TYPE), HolderStackValidation VALIDATION_TYPE = HSV_ValidateNormalStackReq>
+class FunctionBase : protected HolderBase<TYPE>
+{
+ protected:
+
+ FORCEINLINE FunctionBase(TYPE value)
+ : HolderBase<TYPE>(value)
+ {
+ }
+
+ FORCEINLINE void DoAcquire()
+ {
+ ACQUIREF(this->m_value);
+ }
+
+ void DoRelease()
+ {
+ // <TODO> Consider removing this stack validation since it is redundant with the
+ // one that is already being done in BaseHolder & BaseWrapper. </TODO>
+ if (VALIDATION_TYPE != HSV_NoValidation)
+ {
+ VALIDATE_HOLDER_STACK_CONSUMPTION_FOR_TYPE(VALIDATION_TYPE);
+ RELEASEF(this->m_value);
+ }
+ else
+ {
+ RELEASEF(this->m_value);
+ }
+ }
+}; // class Function<>
+
+template
+ <
+ typename TYPE,
+ void (*ACQUIREF)(TYPE),
+ void (*RELEASEF)(TYPE),
+ UINT_PTR DEFAULTVALUE = 0,
+ BOOL IS_NULL(TYPE, TYPE) = CompareDefault<TYPE>,
+ HolderStackValidation VALIDATION_TYPE = HSV_ValidateNormalStackReq,
+ // For legacy compat (see EEJitManager::WriterLockHolder), where default ctor
+ // causes ACQUIREF(DEFAULTVALUE), but ACQUIREF ignores the argument and
+ // operates on static or global value instead.
+ bool DEFAULT_CTOR_ACQUIRE = true
+ >
+class Holder : public BaseHolder<TYPE, FunctionBase<TYPE, ACQUIREF, RELEASEF, VALIDATION_TYPE>,
+ DEFAULTVALUE, IS_NULL, VALIDATION_TYPE>
+{
+ typedef BaseHolder<TYPE, FunctionBase<TYPE, ACQUIREF, RELEASEF, VALIDATION_TYPE>,
+ DEFAULTVALUE, IS_NULL, VALIDATION_TYPE> BaseT;
+
+ public:
+ FORCEINLINE Holder()
+ : BaseT(TYPE(DEFAULTVALUE), DEFAULT_CTOR_ACQUIRE)
+ {
+ STATIC_CONTRACT_WRAPPER;
+ }
+
+ FORCEINLINE Holder(TYPE value)
+ : BaseT(value)
+ {
+ STATIC_CONTRACT_WRAPPER;
+ }
+
+ FORCEINLINE Holder(TYPE value, BOOL takeOwnership)
+ : BaseT(value, takeOwnership)
+ {
+ STATIC_CONTRACT_WRAPPER;
+ }
+
+ FORCEINLINE Holder& operator=(TYPE p)
+ {
+ STATIC_CONTRACT_WRAPPER;
+ BaseT::operator=(p);
+ return *this;
+ }
+
+ HIDE_GENERATED_METHODS(Holder)
+};
+
+//---------------------------------------------------------------------------------------
+//
+template
+ <
+ typename TYPE,
+ void (*ACQUIREF)(TYPE),
+ void (*RELEASEF)(TYPE),
+ UINT_PTR DEFAULTVALUE = 0,
+ BOOL IS_NULL(TYPE, TYPE) = CompareDefault<TYPE>,
+ HolderStackValidation VALIDATION_TYPE = HSV_ValidateNormalStackReq,
+ // For legacy compat (see EEJitManager::WriterLockHolder), where default ctor
+ // causes ACQUIREF(DEFAULTVALUE), but ACQUIREF ignores the argument and
+ // operates on static or global value instead.
+ bool DEFAULT_CTOR_ACQUIRE = true
+ >
+class Wrapper : public BaseWrapper<TYPE, FunctionBase<TYPE, ACQUIREF, RELEASEF, VALIDATION_TYPE>,
+ DEFAULTVALUE, IS_NULL, VALIDATION_TYPE>
+{
+ typedef BaseWrapper<TYPE, FunctionBase<TYPE, ACQUIREF, RELEASEF, VALIDATION_TYPE>,
+ DEFAULTVALUE, IS_NULL, VALIDATION_TYPE> BaseT;
+
+ public:
+ FORCEINLINE Wrapper()
+ : BaseT(TYPE(DEFAULTVALUE), DEFAULT_CTOR_ACQUIRE)
+ {
+ STATIC_CONTRACT_WRAPPER;
+ }
+
+ FORCEINLINE Wrapper(TYPE value)
+ : BaseT(value)
+ {
+ STATIC_CONTRACT_WRAPPER;
+ }
+
+ FORCEINLINE Wrapper(TYPE value, BOOL takeOwnership)
+ : BaseT(value, takeOwnership)
+ {
+ STATIC_CONTRACT_WRAPPER;
+ }
+
+ FORCEINLINE Wrapper& operator=(TYPE const & value)
+ {
+ STATIC_CONTRACT_WRAPPER;
+ BaseT::operator=(value);
+ return *this;
+ }
+
+ HIDE_GENERATED_METHODS(Wrapper)
+}; // Wrapper<>
+
+//---------------------------------------------------------------------------------------
+// - Cannot use the standard INDEBUG macro: holder.h is used in places where INDEBUG is defined in the nonstandard way
+#if defined(_DEBUG)
+#define INDEBUG_AND_WINDOWS_FOR_HOLDERS(x) x
+#else
+#define INDEBUG_AND_WINDOWS_FOR_HOLDERS(x)
+#endif
+
+//---------------------------------------------------------------------------------------
+//
+// New template wrapper type macros. These save some effort when specializing
+// existing holder templates. (We would rather use a construct like:
+//
+// template <P1>
+// typedef Holder<...> NewHolder;
+//
+// But this construct doesn't exist in C++. These macros ease some of the cruft necessary
+// to get similar functionality out of class templates.
+//-----------------------------------------------------------------------------
+
+// Dev10 VC++ has some of the new C++0x language extensions. Of particular interest here:
+// rvalue references, which enables differentiation between named (lvalue) and
+// temporary (rvalue) object references, enabling move semantics and perfect forwarding.
+// See http://msdn.microsoft.com/en-us/library/dd293668.aspx for more information.
+
+// Enable copy construction and assignment from temporary objects. This permits Wrapper objects
+// to be returned from methods, and for move assignment.
+#define NEW_WRAPPER_TEMPLATE_RVALREF_METHODS(_NAME) \
+ public: \
+ FORCEINLINE _NAME(_NAME && other) \
+ : BaseT(NULL, FALSE) \
+ { \
+ STATIC_CONTRACT_WRAPPER; \
+ INDEBUG_AND_WINDOWS_FOR_HOLDERS(m_pvalue = &this->m_value;) \
+ *this = std::move(other); \
+ } \
+ FORCEINLINE _NAME& operator=(_NAME && other) \
+ { \
+ std::swap(BaseT::m_value, other.BaseT::m_value); \
+ std::swap(BaseT::m_acquired, other.BaseT::m_acquired); \
+ return *this; \
+ }
+
+#define NEW_WRAPPER_TEMPLATE1(_NAME, _RELEASEF) \
+ template <typename _TYPE> \
+ class _NAME : public Wrapper<_TYPE*, DoNothing<_TYPE*>, _RELEASEF, NULL> \
+ { \
+ typedef Wrapper<_TYPE*, DoNothing<_TYPE*>, _RELEASEF, NULL> BaseT; \
+ public: \
+ FORCEINLINE _NAME() : BaseT(NULL, FALSE) \
+ { \
+ STATIC_CONTRACT_WRAPPER; \
+ INDEBUG_AND_WINDOWS_FOR_HOLDERS(m_pvalue = &this->m_value;) \
+ } \
+ FORCEINLINE _NAME(_TYPE* value) : BaseT(value) \
+ { \
+ STATIC_CONTRACT_WRAPPER; \
+ INDEBUG_AND_WINDOWS_FOR_HOLDERS(m_pvalue = &this->m_value;) \
+ } \
+ FORCEINLINE _NAME(_TYPE* value, BOOL takeOwnership) : BaseT(value, takeOwnership) \
+ { \
+ STATIC_CONTRACT_WRAPPER; \
+ INDEBUG_AND_WINDOWS_FOR_HOLDERS(m_pvalue = &this->m_value;) \
+ } \
+ FORCEINLINE ~_NAME() \
+ { \
+ } \
+ FORCEINLINE _NAME& operator=(_TYPE * value) \
+ { \
+ STATIC_CONTRACT_WRAPPER; \
+ BaseT::operator=(value); \
+ return *this; \
+ } \
+ /* Since operator& is overloaded we need a way to get a type safe this pointer. */ \
+ FORCEINLINE _NAME* GetAddr() \
+ { \
+ STATIC_CONTRACT_LEAF; \
+ return this; \
+ } \
+ NEW_WRAPPER_TEMPLATE_RVALREF_METHODS(_NAME) \
+ HIDE_GENERATED_METHODS(_NAME) \
+ private: \
+ /* m_ppValue: Do not use from source code: Only for convenient use from debugger */ \
+ /* watch windows - saves five mouseclicks when inspecting holders. */ \
+ INDEBUG_AND_WINDOWS_FOR_HOLDERS(_TYPE ** m_pvalue;) \
+ };
+
+//-----------------------------------------------------------------------------
+// NOTE: THIS IS UNSAFE TO USE IN THE VM for interop COM objects!!
+// WE DO NOT CORRECTLY CHANGE TO PREEMPTIVE MODE BEFORE CALLING RELEASE!!
+// USE SafeComHolder
+//
+// ReleaseHolder : COM Interface holder for use outside the VM (or on well known instances
+// which do not need preemptive Relesae)
+//
+// Usage example:
+//
+// {
+// ReleaseHolder<IFoo> foo;
+// hr = FunctionToGetRefOfFoo(&foo);
+// // Note ComHolder doesn't call AddRef - it assumes you already have a ref (if non-0).
+// } // foo->Release() on out of scope (WITHOUT RESPECT FOR GC MODE!!)
+//
+//-----------------------------------------------------------------------------
+
+template <typename TYPE>
+FORCEINLINE void DoTheRelease(TYPE *value)
+{
+ if (value)
+ {
+ VALIDATE_HOLDER_STACK_CONSUMPTION_FOR_TYPE(HSV_ValidateNormalStackReq);
+ value->Release();
+ }
+}
+
+NEW_WRAPPER_TEMPLATE1(DoNothingHolder, DoNothing<_TYPE*>);
+
+NEW_WRAPPER_TEMPLATE1(ReleaseHolder, DoTheRelease<_TYPE>);
+
+NEW_WRAPPER_TEMPLATE1(NonVMComHolder, DoTheRelease<_TYPE>);
+
+
+//-----------------------------------------------------------------------------
+// StubHolder : holder for stubs
+//
+// Usage example:
+//
+// {
+// StubHolder<Stub> foo;
+// foo = new Stub();
+// foo->AddRef();
+// // Note StubHolder doesn't call AddRef for you.
+// } // foo->DecRef() on out of scope
+//
+//-----------------------------------------------------------------------------
+template <typename TYPE>
+FORCEINLINE void StubRelease(TYPE* value)
+{
+ if (value)
+ value->DecRef();
+}
+
+NEW_WRAPPER_TEMPLATE1(StubHolder, StubRelease<_TYPE>);
+
+//-----------------------------------------------------------------------------
+// CoTaskMemHolder : CoTaskMemAlloc allocated memory holder
+//
+// {
+// CoTaskMemHolder<Foo> foo = (Foo*) CoTaskMemAlloc(sizeof(Foo));
+// } // delete foo on out of scope
+//-----------------------------------------------------------------------------
+
+template <typename TYPE>
+FORCEINLINE void DeleteCoTaskMem(TYPE *value)
+{
+ if (value)
+ CoTaskMemFree(value);
+}
+
+NEW_WRAPPER_TEMPLATE1(CoTaskMemHolder, DeleteCoTaskMem<_TYPE>);
+
+//-----------------------------------------------------------------------------
+// NewHolder : New'ed memory holder
+//
+// {
+// NewHolder<Foo> foo = new Foo ();
+// } // delete foo on out of scope
+//-----------------------------------------------------------------------------
+
+template <typename TYPE>
+FORCEINLINE void Delete(TYPE *value)
+{
+ STATIC_CONTRACT_LEAF;
+
+ static_assert(!std::is_same<typename std::remove_cv<TYPE>::type, WCHAR>::value,
+ "Must use NewArrayHolder (not NewHolder) for strings.");
+ static_assert(!std::is_same<typename std::remove_cv<TYPE>::type, CHAR>::value,
+ "Must use NewArrayHolder (not NewHolder) for strings.");
+
+ delete value;
+}
+
+NEW_WRAPPER_TEMPLATE1(NewHolder, Delete<_TYPE>);
+
+ //-----------------------------------------------------------------------------
+// NewExecutableHolder : New'ed memory holder for executable memory.
+//
+// {
+// NewExecutableHolder<Foo> foo = (Foo*) new (executable) Byte[num];
+// } // delete foo on out of scope
+//-----------------------------------------------------------------------------
+// IJW
+template<class T> void DeleteExecutable(T *p);
+
+NEW_WRAPPER_TEMPLATE1(NewExecutableHolder, DeleteExecutable<_TYPE>);
+
+//-----------------------------------------------------------------------------
+// NewArrayHolder : New []'ed pointer holder
+// {
+// NewArrayHolder<Foo> foo = new Foo [30];
+// } // delete [] foo on out of scope
+//-----------------------------------------------------------------------------
+
+template <typename TYPE>
+FORCEINLINE void DeleteArray(TYPE *value)
+{
+ STATIC_CONTRACT_WRAPPER;
+ delete [] value;
+ value = NULL;
+}
+
+NEW_WRAPPER_TEMPLATE1(NewArrayHolder, DeleteArray<_TYPE>);
+typedef NewArrayHolder<CHAR> AStringHolder;
+typedef NewArrayHolder<WCHAR> WStringHolder;
+
+//-----------------------------------------------------------------------------
+// A special array holder that expects its contents are interface pointers,
+// and will call Release() on them.
+//
+// NOTE: You may ONLY use this if you've determined that it is SAFE to call
+// Release() on the contained interface pointers (e.g., as opposed to SafeRelease)
+//
+template <typename INTERFACE>
+class NewInterfaceArrayHolder : public NewArrayHolder<INTERFACE *>
+{
+public:
+ NewInterfaceArrayHolder() :
+ NewArrayHolder<INTERFACE *>(),
+ m_cElements(0)
+ {
+ STATIC_CONTRACT_WRAPPER;
+ }
+
+ NewInterfaceArrayHolder& operator=(INTERFACE ** value)
+ {
+ STATIC_CONTRACT_WRAPPER;
+ NewArrayHolder<INTERFACE *>::operator=(value);
+ return *this;
+ }
+
+ void SetElementCount(ULONG32 cElements)
+ {
+ STATIC_CONTRACT_LEAF;
+ m_cElements = cElements;
+ }
+
+ ~NewInterfaceArrayHolder()
+ {
+ STATIC_CONTRACT_LEAF;
+ for (ULONG32 i=0; i < m_cElements; i++)
+ {
+ if (this->m_value[i] != NULL)
+ this->m_value[i]->Release();
+ }
+ }
+
+protected:
+ ULONG32 m_cElements;
+};
+
+
+//-----------------------------------------------------------------------------
+// ResetPointerHolder : pointer which needs to be set to NULL
+// {
+// ResetPointerHolder<Foo> holder = &pFoo;
+// } // "*pFoo=NULL" on out of scope
+//-----------------------------------------------------------------------------
+#ifdef __GNUC__
+// With -fvisibility-inlines-hidden, the Invoke methods below
+// get hidden, which causes warnings when visible classes expose them.
+#define VISIBLE __attribute__ ((visibility("default")))
+#else
+#define VISIBLE
+#endif // __GNUC__
+
+namespace detail
+{
+ template <typename T>
+ struct ZeroMem
+ {
+ static VISIBLE void Invoke(T * pVal)
+ {
+ ZeroMemory(pVal, sizeof(T));
+ }
+ };
+
+ template <typename T>
+ struct ZeroMem<T*>
+ {
+ static VISIBLE void Invoke(T ** pVal)
+ {
+ *pVal = NULL;
+ }
+ };
+
+}
+#undef VISIBLE
+
+NEW_WRAPPER_TEMPLATE1(ResetPointerHolder, detail::ZeroMem<_TYPE>::Invoke);
+NEW_WRAPPER_TEMPLATE1(FieldNuller, detail::ZeroMem<_TYPE>::Invoke);
+
+//-----------------------------------------------------------------------------
+// Wrap win32 functions using HANDLE
+//-----------------------------------------------------------------------------
+
+FORCEINLINE void VoidCloseHandle(HANDLE h) { if (h != NULL) CloseHandle(h); }
+// (UINT_PTR) -1 is INVALID_HANDLE_VALUE
+FORCEINLINE void VoidCloseFileHandle(HANDLE h) { if (h != ((HANDLE)((LONG_PTR) -1))) CloseHandle(h); }
+FORCEINLINE void VoidFindClose(HANDLE h) { FindClose(h); }
+FORCEINLINE void VoidUnmapViewOfFile(void *ptr) { UnmapViewOfFile(ptr); }
+
+template <typename TYPE>
+FORCEINLINE void TypeUnmapViewOfFile(TYPE *ptr) { UnmapViewOfFile(ptr); }
+
+// (UINT_PTR) -1 is INVALID_HANDLE_VALUE
+//@TODO: Dangerous default value. Some Win32 functions return INVALID_HANDLE_VALUE, some return NULL (such as CreatEvent).
+typedef Wrapper<HANDLE, DoNothing<HANDLE>, VoidCloseHandle, (UINT_PTR) -1> HandleHolder;
+typedef Wrapper<HANDLE, DoNothing<HANDLE>, VoidCloseFileHandle, (UINT_PTR) -1> FileHandleHolder;
+typedef Wrapper<HANDLE, DoNothing<HANDLE>, VoidFindClose, (UINT_PTR) -1> FindHandleHolder;
+
+typedef Wrapper<void *, DoNothing, VoidUnmapViewOfFile> MapViewHolder;
+
+#ifdef WszDeleteFile
+// Deletes a file with the specified path. Do not use if you care about failures
+// deleting the file, as failures are ignored by VoidDeleteFile.
+FORCEINLINE void VoidDeleteFile(LPCWSTR wszFilePath) { WszDeleteFile(wszFilePath); }
+typedef Wrapper<LPCWSTR, DoNothing<LPCWSTR>, VoidDeleteFile, NULL> DeleteFileHolder;
+#endif // WszDeleteFile
+
+#if !defined(FEATURE_CORECLR) || defined(FEATURE_CRYPTO)
+// Crypto holders
+FORCEINLINE void VoidCryptReleaseContext(HCRYPTPROV h) { CryptReleaseContext(h, 0); }
+FORCEINLINE void VoidCryptDestroyHash(HCRYPTHASH h) { CryptDestroyHash(h); }
+FORCEINLINE void VoidCryptDestroyKey(HCRYPTKEY h) { CryptDestroyKey(h); }
+
+typedef Wrapper<HCRYPTPROV, DoNothing, VoidCryptReleaseContext, 0> HandleCSPHolder;
+typedef Wrapper<HCRYPTHASH, DoNothing, VoidCryptDestroyHash, 0> HandleHashHolder;
+typedef Wrapper<HCRYPTKEY, DoNothing, VoidCryptDestroyKey, 0> HandleKeyHolder;
+#endif // !FEATURE_CORECLR || FEATURE_CRYPTO
+
+//-----------------------------------------------------------------------------
+// Misc holders
+//-----------------------------------------------------------------------------
+
+// A holder for HMODULE.
+FORCEINLINE void HolderFreeLibrary(HMODULE h) { FreeLibrary(h); }
+
+typedef Wrapper<HMODULE, DoNothing<HMODULE>, HolderFreeLibrary, NULL> HModuleHolder;
+
+template <typename T> FORCEINLINE
+void DoLocalFree(T* pMem) { (LocalFree)((HLOCAL)pMem); }
+
+NEW_WRAPPER_TEMPLATE1(LocalAllocHolder, DoLocalFree<_TYPE>);
+
+inline void BoolSet( _Out_ bool * val ) { *val = true; }
+inline void BoolUnset( _Out_ bool * val ) { *val = false; }
+
+typedef Wrapper< bool *, BoolSet, BoolUnset > BoolFlagStateHolder;
+
+//
+// We need the following methods to have volatile arguments, so that they can accept
+// raw pointers in addition to the results of the & operator on Volatile<T>.
+//
+
+FORCEINLINE void CounterIncrease(RAW_KEYWORD(volatile) LONG* p) {InterlockedIncrement(p);};
+FORCEINLINE void CounterDecrease(RAW_KEYWORD(volatile) LONG* p) {InterlockedDecrement(p);};
+
+typedef Wrapper<RAW_KEYWORD(volatile) LONG*, CounterIncrease, CounterDecrease, (UINT_PTR)0, CompareDefault<RAW_KEYWORD(volatile) LONG*>, HSV_NoValidation> CounterHolder;
+
+
+#ifndef FEATURE_PAL
+FORCEINLINE void RegKeyRelease(HKEY k) {RegCloseKey(k);};
+typedef Wrapper<HKEY,DoNothing,RegKeyRelease> RegKeyHolder;
+#endif // !FEATURE_PAL
+
+class ErrorModeHolder
+{
+ UINT m_oldMode;
+public:
+ ErrorModeHolder(UINT newMode){m_oldMode=SetErrorMode(newMode);};
+ ~ErrorModeHolder(){SetErrorMode(m_oldMode);};
+ UINT OldMode() {return m_oldMode;};
+};
+
+#ifndef FEATURE_PAL
+//-----------------------------------------------------------------------------
+// HKEYHolder : HKEY holder, Calls RegCloseKey on scope exit.
+//
+// {
+// HKEYHolder hFoo = NULL;
+// WszRegOpenKeyEx(HKEY_CLASSES_ROOT, L"Interface",0, KEY_READ, hFoo);
+//
+// } // close key on out of scope via RegCloseKey.
+//-----------------------------------------------------------------------------
+
+class HKEYHolder
+{
+public:
+ HKEYHolder()
+ {
+ STATIC_CONTRACT_LEAF;
+ m_value = 0;
+ }
+
+ ~HKEYHolder()
+ {
+ STATIC_CONTRACT_WRAPPER;
+ if (m_value != NULL)
+ ::RegCloseKey(m_value);
+ }
+
+ FORCEINLINE void operator=(HKEY p)
+ {
+ STATIC_CONTRACT_LEAF;
+ if (p != 0)
+ m_value = p;
+ }
+
+ FORCEINLINE operator HKEY()
+ {
+ STATIC_CONTRACT_LEAF;
+ return m_value;
+ }
+
+ FORCEINLINE operator HKEY*()
+ {
+ STATIC_CONTRACT_LEAF;
+ return &m_value;
+ }
+
+ FORCEINLINE HKEY* operator&()
+ {
+ STATIC_CONTRACT_LEAF;
+ return &m_value;
+ }
+
+private:
+ HKEY m_value;
+};
+#endif // !FEATURE_PAL
+
+//-----------------------------------------------------------------------------
+// Wrapper to suppress auto-destructor (UNDER CONSTRUCTION)
+// Usage:
+//
+// BEGIN_MANUAL_HOLDER(NewArrayHolder<Foo>, foo);
+// ... use foo via ->
+// END_MANUAL_HOLDER(foo);
+//
+//-----------------------------------------------------------------------------
+
+template <typename TYPE, SIZE_T SIZE = sizeof(TYPE)>
+class NoAuto__DONTUSEDIRECTLY
+{
+ private:
+ BYTE hiddeninstance[SIZE];
+
+ public:
+ // Unfortunately, you can only use the default constructor
+ NoAuto__DONTUSEDIRECTLY()
+ {
+ new (hiddeninstance) TYPE ();
+ }
+
+ operator TYPE& () { return *(TYPE *)hiddeninstance; }
+ TYPE& operator->() { return *(TYPE *)hiddeninstance; }
+ TYPE& operator*() { return *(TYPE *)hiddeninstance; }
+
+ void Destructor() { (*(TYPE*)hiddeninstance)->TYPE::~TYPE(); }
+};
+
+#define BEGIN_MANUAL_HOLDER(_TYPE, _NAME) \
+ { \
+ NoAuto__DONTUSEDIRECTLY<_TYPE> _NAME; \
+ __try \
+ {
+
+#define END_MANUAL_HOLDER(_NAME) \
+ } \
+ __finally \
+ { \
+ _NAME.Destructor(); \
+ } \
+ }
+
+//----------------------------------------------------------------------------
+//
+// External data access does not want certain holder implementations
+// to be active as locks should not be taken and so on. Provide
+// a no-op in that case.
+//
+//----------------------------------------------------------------------------
+
+#ifndef DACCESS_COMPILE
+
+#define DacHolder Holder
+
+#else
+
+template <typename TYPE, void (*ACQUIRE)(TYPE), void (*RELEASEF)(TYPE), UINT_PTR DEFAULTVALUE = 0, BOOL IS_NULL(TYPE, TYPE) = CompareDefault<TYPE>, BOOL VALIDATE_BACKOUT_STACK = TRUE>
+class DacHolder
+{
+ protected:
+ TYPE m_value;
+
+ private:
+ BOOL m_acquired; // Have we acquired the resource?
+
+ public:
+ FORCEINLINE DacHolder()
+ : m_value(TYPE(DEFAULTVALUE)),
+ m_acquired(FALSE)
+ {
+ STATIC_CONTRACT_SUPPORTS_DAC;
+ }
+
+ // construct a new instance of DacHolder
+ // Arguments:
+ // input: value - the resource held
+ // take - indicates whether the lock should be taken--the default is true. See Notes:
+ // Note: In DAC builds, the Acquire function does not actually take the lock, instead
+ // it determines whether the lock is held (by the LS). If it is, the locked data
+ // is assumed to be inconsistent and the Acquire function will throw.
+ FORCEINLINE DacHolder(TYPE value, BOOL take = TRUE)
+ : m_value(value),
+ m_acquired(FALSE)
+ {
+ STATIC_CONTRACT_SUPPORTS_DAC;
+ if (take)
+ Acquire();
+
+ }
+ FORCEINLINE ~DacHolder()
+ {
+ STATIC_CONTRACT_SUPPORTS_DAC;
+ }
+ // Sets the value to 'value'. Doesn't call Acquire/Release if fTake is FALSE.
+ FORCEINLINE void Assign(TYPE value, BOOL fTake = TRUE)
+ {
+ m_value = value;
+ }
+ FORCEINLINE void Acquire()
+ {
+ STATIC_CONTRACT_SUPPORTS_DAC;
+
+ if (!IsNull())
+ {
+ m_acquired = TRUE;
+ // because ACQUIRE is a template argument, if the line m_acquired = TRUE is placed after the call
+ // where it logically belongs, the compiler flags it as "unreachable code."
+ ACQUIRE(this->m_value);
+ }
+ }
+ FORCEINLINE void Release()
+ {
+ // Insert any global or thread bookeeping here
+
+ if (m_acquired)
+ {
+ m_acquired = FALSE;
+ }
+ }
+ FORCEINLINE void Clear()
+ {
+ m_value = TYPE(DEFAULTVALUE);
+ m_acquired = FALSE;
+ }
+ FORCEINLINE void SuppressRelease()
+ {
+ m_acquired = FALSE;
+ }
+ FORCEINLINE TYPE GetValue()
+ {
+ return m_value;
+ }
+ FORCEINLINE BOOL IsNull() const
+ {
+ return IS_NULL(m_value, TYPE(DEFAULTVALUE));
+ }
+
+ private:
+ FORCEINLINE DacHolder& operator=(const Holder<TYPE, ACQUIRE, RELEASEF> &holder)
+ {
+ }
+
+ FORCEINLINE DacHolder(const Holder<TYPE, ACQUIRE, RELEASEF> &holder)
+ {
+ }
+};
+
+#endif // #ifndef DACCESS_COMPILE
+
+// Holder-specific clr::SafeAddRef and clr::SafeRelease helper functions.
+namespace clr
+{
+ template < typename ItfT > __checkReturn
+ ItfT *
+ SafeAddRef(ReleaseHolder<ItfT> & pItf)
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ //@TODO: Would be good to add runtime validation that the return value is used.
+ return SafeAddRef(pItf.GetValue());
+ }
+
+ namespace detail
+ {
+ template <typename T>
+ char IsHolderHelper(HolderBase<T>*);
+ int IsHolderHelper(...);
+
+ template <typename T>
+ struct IsHolder : public std::conditional<
+ sizeof(IsHolderHelper(reinterpret_cast<T*>(NULL))) == sizeof(char),
+ std::true_type,
+ std::false_type>::type
+ {};
+ }
+
+ template < typename T >
+ typename std::enable_if<detail::IsHolder<T>::value, ULONG>::type
+ SafeRelease(T& arg)
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ return arg.Release();
+ }
+}
+
+#endif // __HOLDER_H_
diff --git a/src/inc/holderinst.h b/src/inc/holderinst.h
new file mode 100644
index 0000000000..ee59da0842
--- /dev/null
+++ b/src/inc/holderinst.h
@@ -0,0 +1,33 @@
+// 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.
+
+
+#ifndef __HOLDERINST_H_
+#define __HOLDERINST_H_
+
+// This file contains holder instantiations which we can't put in holder.h because
+// the instantiations require _ASSERTE to be defined, which is not always the case
+// for placed that include holder.h.
+
+FORCEINLINE void SafeArrayRelease(SAFEARRAY* p)
+{
+ SafeArrayDestroy(p);
+}
+
+
+class SafeArrayHolder : public Wrapper<SAFEARRAY*, SafeArrayDoNothing, SafeArrayRelease, NULL>
+{
+public:
+ SafeArrayHolder(SAFEARRAY* p = NULL)
+ : Wrapper<SAFEARRAY*, SafeArrayDoNothing, SafeArrayRelease, NULL>(p)
+ {
+ }
+
+ FORCEINLINE void operator=(SAFEARRAY* p)
+ {
+ Wrapper<SAFEARRAY*, SafeArrayDoNothing, SafeArrayRelease, NULL>::operator=(p);
+ }
+};
+
+#endif // __HOLDERINST_H_
diff --git a/src/inc/iallocator.h b/src/inc/iallocator.h
new file mode 100644
index 0000000000..b4c1b71120
--- /dev/null
+++ b/src/inc/iallocator.h
@@ -0,0 +1,77 @@
+// 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.
+
+// We would like to allow "util" collection classes to be usable both
+// from the VM and from the JIT. The latter case presents a
+// difficulty, because in the (x86, soon to be cross-platform) JIT
+// compiler, we require allocation to be done using a "no-release"
+// (aka, arena-style) allocator that is provided as methods of the
+// JIT's Compiler type.
+
+// To allow utilcode collection classes to deal with this, they may be
+// written to do allocation and freeing via an instance of the
+// "IAllocator" class defined in this file.
+//
+#ifndef _IALLOCATOR_DEFINED_
+#define _IALLOCATOR_DEFINED_
+
+#include "contract.h"
+#include "safemath.h"
+
+class IAllocator
+{
+ public:
+ virtual void* Alloc(size_t sz) = 0;
+
+ // Allocate space for an array of "elems" elements, each of size "elemSize".
+ virtual void* ArrayAlloc(size_t elems, size_t elemSize) = 0;
+
+ virtual void Free(void* p) = 0;
+};
+
+// This class wraps an allocator that does not allow zero-length allocations,
+// producing one that does (every zero-length allocation produces a pointer to the same
+// statically-allocated memory, and freeing that pointer is a no-op).
+class AllowZeroAllocator: public IAllocator
+{
+ int m_zeroLenAllocTarg;
+ IAllocator* m_alloc;
+
+public:
+ AllowZeroAllocator(IAllocator* alloc) : m_alloc(alloc) {}
+
+ void* Alloc(size_t sz)
+ {
+ if (sz == 0)
+ {
+ return (void*)(&m_zeroLenAllocTarg);
+ }
+ else
+ {
+ return m_alloc->Alloc(sz);
+ }
+ }
+
+ void* ArrayAlloc(size_t elemSize, size_t numElems)
+ {
+ if (elemSize == 0 || numElems == 0)
+ {
+ return (void*)(&m_zeroLenAllocTarg);
+ }
+ else
+ {
+ return m_alloc->ArrayAlloc(elemSize, numElems);
+ }
+ }
+
+ virtual void Free(void * p)
+ {
+ if (p != (void*)(&m_zeroLenAllocTarg))
+ {
+ m_alloc->Free(p);
+ }
+ }
+};
+
+#endif // _IALLOCATOR_DEFINED_
diff --git a/src/inc/iappdomainsetup.h b/src/inc/iappdomainsetup.h
new file mode 100644
index 0000000000..ef8d9a3cfa
--- /dev/null
+++ b/src/inc/iappdomainsetup.h
@@ -0,0 +1,612 @@
+// 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.
+
+//
+
+// ********************************************************
+// ********************************************************
+// ********************************************************
+//
+// !!!! DON'T USE THIS FILE, IT WILL BE OBSOLETE SOON !!!!
+//
+// ********************************************************
+// ********************************************************
+// ********************************************************
+
+
+
+
+#ifndef FEATURE_COMINTEROP
+#error FEATURE_COMINTEROP is required for this file
+#endif // FEATURE_COMINTEROP
+
+
+
+#ifdef _MSC_VER
+#pragma warning( disable: 4049 ) /* more than 64k source lines */
+#endif
+
+/* this ALWAYS GENERATED file contains the definitions for the interfaces */
+
+
+ /* File created by MIDL compiler version 6.00.0338 */
+/* at Wed Jan 17 16:59:41 2001
+ */
+/* Compiler settings for IAppDomainSetup.idl:
+ Os, W1, Zp8, env=Win32 (32b run)
+ protocol : dce , ms_ext, c_ext
+ error checks: allocation ref bounds_check enum stub_data
+ VC __declspec() decoration level:
+ __declspec(uuid()), __declspec(selectany), __declspec(novtable)
+ DECLSPEC_UUID(), MIDL_INTERFACE()
+*/
+//@@MIDL_FILE_HEADING( )
+
+
+/* verify that the <rpcndr.h> version is high enough to compile this file*/
+#ifndef __REQUIRED_RPCNDR_H_VERSION__
+#define __REQUIRED_RPCNDR_H_VERSION__ 440
+#endif
+
+#include "rpc.h"
+#include "rpcndr.h"
+
+#ifndef __RPCNDR_H_VERSION__
+#error this stub requires an updated version of <rpcndr.h>
+#endif // __RPCNDR_H_VERSION__
+
+#ifndef COM_NO_WINDOWS_H
+#include "windows.h"
+#include "ole2.h"
+#endif /*COM_NO_WINDOWS_H*/
+
+#ifndef __IAppDomainSetup_h__
+#define __IAppDomainSetup_h__
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+#pragma once
+#endif
+
+/* Forward Declarations */
+
+#ifndef __IAppDomainSetup_FWD_DEFINED__
+#define __IAppDomainSetup_FWD_DEFINED__
+typedef interface IAppDomainSetup IAppDomainSetup;
+#endif /* __IAppDomainSetup_FWD_DEFINED__ */
+
+
+/* header files for imported files */
+#include "unknwn.h"
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+void * __RPC_USER MIDL_user_allocate(size_t);
+void __RPC_USER MIDL_user_free( void * );
+
+#ifndef __IAppDomainSetup_INTERFACE_DEFINED__
+#define __IAppDomainSetup_INTERFACE_DEFINED__
+
+/* interface IAppDomainSetup */
+/* [object][oleautomation][version][uuid] */
+
+
+EXTERN_C const IID IID_IAppDomainSetup;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("27FFF232-A7A8-40DD-8D4A-734AD59FCD41")
+ IAppDomainSetup : public IUnknown
+ {
+ public:
+ virtual /* [propget] */ HRESULT __stdcall get_ApplicationBase(
+ /* [retval][out] */ BSTR *pRetVal) = 0;
+
+ virtual /* [propput] */ HRESULT __stdcall put_ApplicationBase(
+ /* [in] */ BSTR pRetVal) = 0;
+
+ virtual /* [propget] */ HRESULT __stdcall get_ApplicationName(
+ /* [retval][out] */ BSTR *pRetVal) = 0;
+
+ virtual /* [propput] */ HRESULT __stdcall put_ApplicationName(
+ /* [in] */ BSTR pRetVal) = 0;
+
+ virtual /* [propget] */ HRESULT __stdcall get_CachePath(
+ /* [retval][out] */ BSTR *pRetVal) = 0;
+
+ virtual /* [propput] */ HRESULT __stdcall put_CachePath(
+ /* [in] */ BSTR pRetVal) = 0;
+
+ virtual /* [propget] */ HRESULT __stdcall get_ConfigurationFile(
+ /* [retval][out] */ BSTR *pRetVal) = 0;
+
+ virtual /* [propput] */ HRESULT __stdcall put_ConfigurationFile(
+ /* [in] */ BSTR pRetVal) = 0;
+
+ virtual /* [propget] */ HRESULT __stdcall get_DynamicBase(
+ /* [retval][out] */ BSTR *pRetVal) = 0;
+
+ virtual /* [propput] */ HRESULT __stdcall put_DynamicBase(
+ /* [in] */ BSTR pRetVal) = 0;
+
+ virtual /* [propget] */ HRESULT __stdcall get_LicenseFile(
+ /* [retval][out] */ BSTR *pRetVal) = 0;
+
+ virtual /* [propput] */ HRESULT __stdcall put_LicenseFile(
+ /* [in] */ BSTR pRetVal) = 0;
+
+ virtual /* [propget] */ HRESULT __stdcall get_PrivateBinPath(
+ /* [retval][out] */ BSTR *pRetVal) = 0;
+
+ virtual /* [propput] */ HRESULT __stdcall put_PrivateBinPath(
+ /* [in] */ BSTR pRetVal) = 0;
+
+ virtual /* [propget] */ HRESULT __stdcall get_PrivateBinPathProbe(
+ /* [retval][out] */ BSTR *pRetVal) = 0;
+
+ virtual /* [propput] */ HRESULT __stdcall put_PrivateBinPathProbe(
+ /* [in] */ BSTR pRetVal) = 0;
+
+ virtual /* [propget] */ HRESULT __stdcall get_ShadowCopyDirectories(
+ /* [retval][out] */ BSTR *pRetVal) = 0;
+
+ virtual /* [propput] */ HRESULT __stdcall put_ShadowCopyDirectories(
+ /* [in] */ BSTR pRetVal) = 0;
+
+ virtual /* [propget] */ HRESULT __stdcall get_ShadowCopyFiles(
+ /* [retval][out] */ BSTR *pRetVal) = 0;
+
+ virtual /* [propput] */ HRESULT __stdcall put_ShadowCopyFiles(
+ /* [in] */ BSTR pRetVal) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IAppDomainSetupVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IAppDomainSetup * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IAppDomainSetup * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IAppDomainSetup * This);
+
+ /* [propget] */ HRESULT ( __stdcall *get_ApplicationBase )(
+ IAppDomainSetup * This,
+ /* [retval][out] */ BSTR *pRetVal);
+
+ /* [propput] */ HRESULT ( __stdcall *put_ApplicationBase )(
+ IAppDomainSetup * This,
+ /* [in] */ BSTR pRetVal);
+
+ /* [propget] */ HRESULT ( __stdcall *get_ApplicationName )(
+ IAppDomainSetup * This,
+ /* [retval][out] */ BSTR *pRetVal);
+
+ /* [propput] */ HRESULT ( __stdcall *put_ApplicationName )(
+ IAppDomainSetup * This,
+ /* [in] */ BSTR pRetVal);
+
+ /* [propget] */ HRESULT ( __stdcall *get_CachePath )(
+ IAppDomainSetup * This,
+ /* [retval][out] */ BSTR *pRetVal);
+
+ /* [propput] */ HRESULT ( __stdcall *put_CachePath )(
+ IAppDomainSetup * This,
+ /* [in] */ BSTR pRetVal);
+
+ /* [propget] */ HRESULT ( __stdcall *get_ConfigurationFile )(
+ IAppDomainSetup * This,
+ /* [retval][out] */ BSTR *pRetVal);
+
+ /* [propput] */ HRESULT ( __stdcall *put_ConfigurationFile )(
+ IAppDomainSetup * This,
+ /* [in] */ BSTR pRetVal);
+
+ /* [propget] */ HRESULT ( __stdcall *get_DynamicBase )(
+ IAppDomainSetup * This,
+ /* [retval][out] */ BSTR *pRetVal);
+
+ /* [propput] */ HRESULT ( __stdcall *put_DynamicBase )(
+ IAppDomainSetup * This,
+ /* [in] */ BSTR pRetVal);
+
+ /* [propget] */ HRESULT ( __stdcall *get_LicenseFile )(
+ IAppDomainSetup * This,
+ /* [retval][out] */ BSTR *pRetVal);
+
+ /* [propput] */ HRESULT ( __stdcall *put_LicenseFile )(
+ IAppDomainSetup * This,
+ /* [in] */ BSTR pRetVal);
+
+ /* [propget] */ HRESULT ( __stdcall *get_PrivateBinPath )(
+ IAppDomainSetup * This,
+ /* [retval][out] */ BSTR *pRetVal);
+
+ /* [propput] */ HRESULT ( __stdcall *put_PrivateBinPath )(
+ IAppDomainSetup * This,
+ /* [in] */ BSTR pRetVal);
+
+ /* [propget] */ HRESULT ( __stdcall *get_PrivateBinPathProbe )(
+ IAppDomainSetup * This,
+ /* [retval][out] */ BSTR *pRetVal);
+
+ /* [propput] */ HRESULT ( __stdcall *put_PrivateBinPathProbe )(
+ IAppDomainSetup * This,
+ /* [in] */ BSTR pRetVal);
+
+ /* [propget] */ HRESULT ( __stdcall *get_ShadowCopyDirectories )(
+ IAppDomainSetup * This,
+ /* [retval][out] */ BSTR *pRetVal);
+
+ /* [propput] */ HRESULT ( __stdcall *put_ShadowCopyDirectories )(
+ IAppDomainSetup * This,
+ /* [in] */ BSTR pRetVal);
+
+ /* [propget] */ HRESULT ( __stdcall *get_ShadowCopyFiles )(
+ IAppDomainSetup * This,
+ /* [retval][out] */ BSTR *pRetVal);
+
+ /* [propput] */ HRESULT ( __stdcall *put_ShadowCopyFiles )(
+ IAppDomainSetup * This,
+ /* [in] */ BSTR pRetVal);
+
+ END_INTERFACE
+ } IAppDomainSetupVtbl;
+
+ interface IAppDomainSetup
+ {
+ CONST_VTBL struct IAppDomainSetupVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IAppDomainSetup_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IAppDomainSetup_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IAppDomainSetup_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IAppDomainSetup_get_ApplicationBase(This,pRetVal) \
+ (This)->lpVtbl -> get_ApplicationBase(This,pRetVal)
+
+#define IAppDomainSetup_put_ApplicationBase(This,pRetVal) \
+ (This)->lpVtbl -> put_ApplicationBase(This,pRetVal)
+
+#define IAppDomainSetup_get_ApplicationName(This,pRetVal) \
+ (This)->lpVtbl -> get_ApplicationName(This,pRetVal)
+
+#define IAppDomainSetup_put_ApplicationName(This,pRetVal) \
+ (This)->lpVtbl -> put_ApplicationName(This,pRetVal)
+
+#define IAppDomainSetup_get_CachePath(This,pRetVal) \
+ (This)->lpVtbl -> get_CachePath(This,pRetVal)
+
+#define IAppDomainSetup_put_CachePath(This,pRetVal) \
+ (This)->lpVtbl -> put_CachePath(This,pRetVal)
+
+#define IAppDomainSetup_get_ConfigurationFile(This,pRetVal) \
+ (This)->lpVtbl -> get_ConfigurationFile(This,pRetVal)
+
+#define IAppDomainSetup_put_ConfigurationFile(This,pRetVal) \
+ (This)->lpVtbl -> put_ConfigurationFile(This,pRetVal)
+
+#define IAppDomainSetup_get_DynamicBase(This,pRetVal) \
+ (This)->lpVtbl -> get_DynamicBase(This,pRetVal)
+
+#define IAppDomainSetup_put_DynamicBase(This,pRetVal) \
+ (This)->lpVtbl -> put_DynamicBase(This,pRetVal)
+
+#define IAppDomainSetup_get_LicenseFile(This,pRetVal) \
+ (This)->lpVtbl -> get_LicenseFile(This,pRetVal)
+
+#define IAppDomainSetup_put_LicenseFile(This,pRetVal) \
+ (This)->lpVtbl -> put_LicenseFile(This,pRetVal)
+
+#define IAppDomainSetup_get_PrivateBinPath(This,pRetVal) \
+ (This)->lpVtbl -> get_PrivateBinPath(This,pRetVal)
+
+#define IAppDomainSetup_put_PrivateBinPath(This,pRetVal) \
+ (This)->lpVtbl -> put_PrivateBinPath(This,pRetVal)
+
+#define IAppDomainSetup_get_PrivateBinPathProbe(This,pRetVal) \
+ (This)->lpVtbl -> get_PrivateBinPathProbe(This,pRetVal)
+
+#define IAppDomainSetup_put_PrivateBinPathProbe(This,pRetVal) \
+ (This)->lpVtbl -> put_PrivateBinPathProbe(This,pRetVal)
+
+#define IAppDomainSetup_get_ShadowCopyDirectories(This,pRetVal) \
+ (This)->lpVtbl -> get_ShadowCopyDirectories(This,pRetVal)
+
+#define IAppDomainSetup_put_ShadowCopyDirectories(This,pRetVal) \
+ (This)->lpVtbl -> put_ShadowCopyDirectories(This,pRetVal)
+
+#define IAppDomainSetup_get_ShadowCopyFiles(This,pRetVal) \
+ (This)->lpVtbl -> get_ShadowCopyFiles(This,pRetVal)
+
+#define IAppDomainSetup_put_ShadowCopyFiles(This,pRetVal) \
+ (This)->lpVtbl -> put_ShadowCopyFiles(This,pRetVal)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+/* [propget] */ HRESULT __stdcall IAppDomainSetup_get_ApplicationBase_Proxy(
+ IAppDomainSetup * This,
+ /* [retval][out] */ BSTR *pRetVal);
+
+
+void __RPC_STUB IAppDomainSetup_get_ApplicationBase_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propput] */ HRESULT __stdcall IAppDomainSetup_put_ApplicationBase_Proxy(
+ IAppDomainSetup * This,
+ /* [in] */ BSTR pRetVal);
+
+
+void __RPC_STUB IAppDomainSetup_put_ApplicationBase_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT __stdcall IAppDomainSetup_get_ApplicationName_Proxy(
+ IAppDomainSetup * This,
+ /* [retval][out] */ BSTR *pRetVal);
+
+
+void __RPC_STUB IAppDomainSetup_get_ApplicationName_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propput] */ HRESULT __stdcall IAppDomainSetup_put_ApplicationName_Proxy(
+ IAppDomainSetup * This,
+ /* [in] */ BSTR pRetVal);
+
+
+void __RPC_STUB IAppDomainSetup_put_ApplicationName_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT __stdcall IAppDomainSetup_get_CachePath_Proxy(
+ IAppDomainSetup * This,
+ /* [retval][out] */ BSTR *pRetVal);
+
+
+void __RPC_STUB IAppDomainSetup_get_CachePath_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propput] */ HRESULT __stdcall IAppDomainSetup_put_CachePath_Proxy(
+ IAppDomainSetup * This,
+ /* [in] */ BSTR pRetVal);
+
+
+void __RPC_STUB IAppDomainSetup_put_CachePath_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT __stdcall IAppDomainSetup_get_ConfigurationFile_Proxy(
+ IAppDomainSetup * This,
+ /* [retval][out] */ BSTR *pRetVal);
+
+
+void __RPC_STUB IAppDomainSetup_get_ConfigurationFile_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propput] */ HRESULT __stdcall IAppDomainSetup_put_ConfigurationFile_Proxy(
+ IAppDomainSetup * This,
+ /* [in] */ BSTR pRetVal);
+
+
+void __RPC_STUB IAppDomainSetup_put_ConfigurationFile_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT __stdcall IAppDomainSetup_get_DynamicBase_Proxy(
+ IAppDomainSetup * This,
+ /* [retval][out] */ BSTR *pRetVal);
+
+
+void __RPC_STUB IAppDomainSetup_get_DynamicBase_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propput] */ HRESULT __stdcall IAppDomainSetup_put_DynamicBase_Proxy(
+ IAppDomainSetup * This,
+ /* [in] */ BSTR pRetVal);
+
+
+void __RPC_STUB IAppDomainSetup_put_DynamicBase_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT __stdcall IAppDomainSetup_get_LicenseFile_Proxy(
+ IAppDomainSetup * This,
+ /* [retval][out] */ BSTR *pRetVal);
+
+
+void __RPC_STUB IAppDomainSetup_get_LicenseFile_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propput] */ HRESULT __stdcall IAppDomainSetup_put_LicenseFile_Proxy(
+ IAppDomainSetup * This,
+ /* [in] */ BSTR pRetVal);
+
+
+void __RPC_STUB IAppDomainSetup_put_LicenseFile_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT __stdcall IAppDomainSetup_get_PrivateBinPath_Proxy(
+ IAppDomainSetup * This,
+ /* [retval][out] */ BSTR *pRetVal);
+
+
+void __RPC_STUB IAppDomainSetup_get_PrivateBinPath_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propput] */ HRESULT __stdcall IAppDomainSetup_put_PrivateBinPath_Proxy(
+ IAppDomainSetup * This,
+ /* [in] */ BSTR pRetVal);
+
+
+void __RPC_STUB IAppDomainSetup_put_PrivateBinPath_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT __stdcall IAppDomainSetup_get_PrivateBinPathProbe_Proxy(
+ IAppDomainSetup * This,
+ /* [retval][out] */ BSTR *pRetVal);
+
+
+void __RPC_STUB IAppDomainSetup_get_PrivateBinPathProbe_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propput] */ HRESULT __stdcall IAppDomainSetup_put_PrivateBinPathProbe_Proxy(
+ IAppDomainSetup * This,
+ /* [in] */ BSTR pRetVal);
+
+
+void __RPC_STUB IAppDomainSetup_put_PrivateBinPathProbe_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT __stdcall IAppDomainSetup_get_ShadowCopyDirectories_Proxy(
+ IAppDomainSetup * This,
+ /* [retval][out] */ BSTR *pRetVal);
+
+
+void __RPC_STUB IAppDomainSetup_get_ShadowCopyDirectories_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propput] */ HRESULT __stdcall IAppDomainSetup_put_ShadowCopyDirectories_Proxy(
+ IAppDomainSetup * This,
+ /* [in] */ BSTR pRetVal);
+
+
+void __RPC_STUB IAppDomainSetup_put_ShadowCopyDirectories_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT __stdcall IAppDomainSetup_get_ShadowCopyFiles_Proxy(
+ IAppDomainSetup * This,
+ /* [retval][out] */ BSTR *pRetVal);
+
+
+void __RPC_STUB IAppDomainSetup_get_ShadowCopyFiles_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propput] */ HRESULT __stdcall IAppDomainSetup_put_ShadowCopyFiles_Proxy(
+ IAppDomainSetup * This,
+ /* [in] */ BSTR pRetVal);
+
+
+void __RPC_STUB IAppDomainSetup_put_ShadowCopyFiles_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IAppDomainSetup_INTERFACE_DEFINED__ */
+
+
+/* Additional Prototypes for ALL interfaces */
+
+unsigned long __RPC_USER BSTR_UserSize( unsigned long *, unsigned long , BSTR * );
+unsigned char * __RPC_USER BSTR_UserMarshal( unsigned long *, unsigned char *, BSTR * );
+unsigned char * __RPC_USER BSTR_UserUnmarshal(unsigned long *, unsigned char *, BSTR * );
+void __RPC_USER BSTR_UserFree( unsigned long *, BSTR * );
+
+/* end of Additional Prototypes */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+
diff --git a/src/inc/iceefilegen.h b/src/inc/iceefilegen.h
new file mode 100644
index 0000000000..58c1ebc249
--- /dev/null
+++ b/src/inc/iceefilegen.h
@@ -0,0 +1,245 @@
+// 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.
+
+/*****************************************************************************
+ ** **
+ ** ICeeFileGen.h - code generator interface. **
+ ** **
+ ** This interface provides functionality to create a CLR PE executable. **
+ ** This will typically be used by compilers to generate their compiled **
+ ** output executable. **
+ ** **
+ ** The implemenation lives in mscorpe.dll **
+ ** **
+ *****************************************************************************/
+
+/*
+ This is how this is typically used:
+
+ // Step #1 ... Get CLR hosting API:
+ #include <mscoree.h>
+ #include <metahost.h>
+
+ ICLRMetaHost * pMetaHost;
+ CLRCreateInstance(CLSID_CLRMetaHost, IID_ICLRMetaHost, &pMetaHost); // defined in mscoree.h
+
+ ICLRRuntimeInfo * pCLRRuntimeInfo;
+ pMetaHost->GetRuntime(wszClrVersion, IID_ICLRRuntimeInfo, &pCLRRuntimeInfo);
+
+ // Step #2 ... Load mscorpe.dll and get its entrypoints
+ HMODULE hModule;
+ pCLRRuntimeInfo->LoadLibrary(L"mscorpe.dll", &hModule);
+
+ PFN_CreateICeeFileGen pfnCreateICeeFileGen = (PFN_CreateICeeFileGen)::GetProcAddress("CreateICeeFileGen"); // Windows API
+ PFN_DestroyICeeFileGen pfnDestroyICeeFileGen = (PFN_DestroyICeeFileGen)::GetProcAddress("DestroyICeeFileGen"); // Windows API
+
+ // Step #3 ... Use mscorpe.dll APIs
+ pfnCreateICeeFileGen(...); // Get a ICeeFileGen
+
+ CreateCeeFile(...); // Get a HCEEFILE (called for every output file needed)
+ SetOutputFileName(...); // Set the name for the output file
+ pEmit = IMetaDataEmit object; // Get a metadata emitter
+ GetSectionBlock(...);, AddSectionReloc(...); ... // Get blocks, write non-metadata information, and add necessary relocation
+ EmitMetaDataEx(pEmit); // Write out the metadata
+ GenerateCeeFile(...); // Write out the file. Implicitly calls LinkCeeFile and FixupCeeFile
+
+ pfnDestroyICeeFileGen(...); // Release the ICeeFileGen object
+*/
+
+
+#ifndef _ICEEFILEGEN_H_
+#define _ICEEFILEGEN_H_
+
+#include <ole2.h>
+#include "cor.h"
+
+class ICeeFileGen;
+
+typedef void *HCEEFILE;
+
+#ifdef FEATURE_CORECLR
+EXTERN_C HRESULT __stdcall CreateICeeFileGen(ICeeFileGen** pCeeFileGen);
+EXTERN_C HRESULT __stdcall DestroyICeeFileGen(ICeeFileGen ** ppCeeFileGen);
+#endif
+
+typedef HRESULT (__stdcall * PFN_CreateICeeFileGen)(ICeeFileGen ** ceeFileGen); // call this to instantiate an ICeeFileGen interface
+typedef HRESULT (__stdcall * PFN_DestroyICeeFileGen)(ICeeFileGen ** ceeFileGen); // call this to delete an ICeeFileGen
+
+#define ICEE_CREATE_FILE_PE32 0x00000001 // Create a PE (32-bit)
+#define ICEE_CREATE_FILE_PE64 0x00000002 // Create a PE+ (64-bit)
+#define ICEE_CREATE_FILE_CORMAIN_STUB 0x00000004 // add a mscoree!_Cor___Main call stub
+#define ICEE_CREATE_FILE_STRIP_RELOCS 0x00000008 // strip the .reloc section
+#define ICEE_CREATE_FILE_EMIT_FIXUPS 0x00000010 // emit fixups for use by Vulcan
+
+#define ICEE_CREATE_MACHINE_MASK 0x0000FF00 // space for up to 256 machine targets
+#define ICEE_CREATE_MACHINE_ILLEGAL 0x00000000 // An illegal machine name
+#define ICEE_CREATE_MACHINE_I386 0x00000100 // Create a IMAGE_FILE_MACHINE_I386
+#define ICEE_CREATE_MACHINE_IA64 0x00000200 // Create a IMAGE_FILE_MACHINE_IA64
+#define ICEE_CREATE_MACHINE_AMD64 0x00000400 // Create a IMAGE_FILE_MACHINE_AMD64
+#define ICEE_CREATE_MACHINE_ARM 0x00000800 // Create a IMAGE_FILE_MACHINE_ARMNT
+
+ // Pass this to CreateCeeFileEx to create a pure IL Exe or DLL
+#define ICEE_CREATE_FILE_PURE_IL ICEE_CREATE_FILE_PE32 | \
+ ICEE_CREATE_FILE_CORMAIN_STUB | \
+ ICEE_CREATE_MACHINE_I386
+
+class ICeeFileGen {
+ public:
+ virtual HRESULT CreateCeeFile(HCEEFILE *ceeFile); // call this to instantiate a file handle
+
+ // <TODO>@FUTURE: remove this function. We no longer support mdScope.</TODO>
+ virtual HRESULT EmitMetaData (HCEEFILE ceeFile, IMetaDataEmit *emitter, mdScope scope);
+ virtual HRESULT EmitLibraryName (HCEEFILE ceeFile, IMetaDataEmit *emitter, mdScope scope);
+ virtual HRESULT EmitMethod (); // <TODO>@FUTURE: remove</TODO>
+ virtual HRESULT GetMethodRVA (HCEEFILE ceeFile, ULONG codeOffset, ULONG *codeRVA);
+ virtual HRESULT EmitSignature (); // <TODO>@FUTURE: remove</TODO>
+
+ virtual HRESULT EmitString (HCEEFILE ceeFile,_In_ LPWSTR strValue, ULONG *strRef);
+ virtual HRESULT GenerateCeeFile (HCEEFILE ceeFile);
+
+ virtual HRESULT SetOutputFileName (HCEEFILE ceeFile, _In_ LPWSTR outputFileName);
+ _Return_type_success_(return == S_OK)
+ virtual HRESULT GetOutputFileName (HCEEFILE ceeFile, _Out_ LPWSTR *outputFileName);
+
+ virtual HRESULT SetResourceFileName (HCEEFILE ceeFile, _In_ LPWSTR resourceFileName);
+
+ _Return_type_success_(return == S_OK)
+ virtual HRESULT GetResourceFileName (HCEEFILE ceeFile, _Out_ LPWSTR *resourceFileName);
+
+ virtual HRESULT SetImageBase(HCEEFILE ceeFile, size_t imageBase);
+
+ virtual HRESULT SetSubsystem(HCEEFILE ceeFile, DWORD subsystem, DWORD major, DWORD minor);
+
+ virtual HRESULT SetEntryClassToken (); //<TODO>@FUTURE: remove</TODO>
+ virtual HRESULT GetEntryClassToken (); //<TODO>@FUTURE: remove</TODO>
+
+ virtual HRESULT SetEntryPointDescr (); //<TODO>@FUTURE: remove</TODO>
+ virtual HRESULT GetEntryPointDescr (); //<TODO>@FUTURE: remove</TODO>
+
+ virtual HRESULT SetEntryPointFlags (); //<TODO>@FUTURE: remove</TODO>
+ virtual HRESULT GetEntryPointFlags (); //<TODO>@FUTURE: remove</TODO>
+
+ virtual HRESULT SetDllSwitch (HCEEFILE ceeFile, BOOL dllSwitch);
+ virtual HRESULT GetDllSwitch (HCEEFILE ceeFile, BOOL *dllSwitch);
+
+ virtual HRESULT SetLibraryName (HCEEFILE ceeFile, _In_ LPWSTR LibraryName);
+ _Return_type_success_( return == S_OK )
+ virtual HRESULT GetLibraryName (HCEEFILE ceeFile, _Out_ LPWSTR *LibraryName);
+
+ virtual HRESULT SetLibraryGuid (HCEEFILE ceeFile, _In_ LPWSTR LibraryGuid);
+
+ virtual HRESULT DestroyCeeFile(HCEEFILE *ceeFile); // call this to delete a file handle
+
+ virtual HRESULT GetSectionCreate (HCEEFILE ceeFile, const char *name, DWORD flags, HCEESECTION *section);
+ virtual HRESULT GetIlSection (HCEEFILE ceeFile, HCEESECTION *section);
+ virtual HRESULT GetRdataSection (HCEEFILE ceeFile, HCEESECTION *section);
+
+ virtual HRESULT GetSectionDataLen (HCEESECTION section, ULONG *dataLen);
+ virtual HRESULT GetSectionBlock (HCEESECTION section, ULONG len, ULONG align=1, void **ppBytes=0);
+ virtual HRESULT TruncateSection (HCEESECTION section, ULONG len);
+ virtual HRESULT AddSectionReloc (HCEESECTION section, ULONG offset, HCEESECTION relativeTo, CeeSectionRelocType relocType);
+
+ // deprecated: use SetDirectoryEntry instead
+ virtual HRESULT SetSectionDirectoryEntry (HCEESECTION section, ULONG num);
+
+ virtual HRESULT CreateSig (); //<TODO>@FUTURE: Remove</TODO>
+ virtual HRESULT AddSigArg (); //<TODO>@FUTURE: Remove</TODO>
+ virtual HRESULT SetSigReturnType (); //<TODO>@FUTURE: Remove</TODO>
+ virtual HRESULT SetSigCallingConvention (); //<TODO>@FUTURE: Remove</TODO>
+ virtual HRESULT DeleteSig (); //<TODO>@FUTURE: Remove</TODO>
+
+ virtual HRESULT SetEntryPoint (HCEEFILE ceeFile, mdMethodDef method);
+ virtual HRESULT GetEntryPoint (HCEEFILE ceeFile, mdMethodDef *method);
+
+ virtual HRESULT SetComImageFlags (HCEEFILE ceeFile, DWORD mask);
+ virtual HRESULT GetComImageFlags (HCEEFILE ceeFile, DWORD *mask);
+
+ // get IMapToken interface for tracking mapped tokens
+ virtual HRESULT GetIMapTokenIface(HCEEFILE ceeFile, IMetaDataEmit *emitter, IUnknown **pIMapToken);
+ virtual HRESULT SetDirectoryEntry (HCEEFILE ceeFile, HCEESECTION section, ULONG num, ULONG size, ULONG offset = 0);
+
+ // Write out the metadata in "emitter" to the metadata section in "ceeFile"
+ // Use EmitMetaDataAt() for more control
+ virtual HRESULT EmitMetaDataEx (HCEEFILE ceeFile, IMetaDataEmit *emitter);
+
+ virtual HRESULT EmitLibraryNameEx (HCEEFILE ceeFile, IMetaDataEmit *emitter);
+ virtual HRESULT GetIMapTokenIfaceEx(HCEEFILE ceeFile, IMetaDataEmit *emitter, IUnknown **pIMapToken);
+
+ virtual HRESULT EmitMacroDefinitions(HCEEFILE ceeFile, void *pData, DWORD cData);
+ virtual HRESULT CreateCeeFileFromICeeGen(
+ ICeeGen *pFromICeeGen, HCEEFILE *ceeFile, DWORD createFlags = ICEE_CREATE_FILE_PURE_IL); // call this to instantiate a file handle
+
+ virtual HRESULT SetManifestEntry(HCEEFILE ceeFile, ULONG size, ULONG offset);
+
+ virtual HRESULT SetEnCRVABase(HCEEFILE ceeFile, ULONG dataBase, ULONG rdataBase);
+ virtual HRESULT GenerateCeeMemoryImage (HCEEFILE ceeFile, void **ppImage);
+
+ virtual HRESULT ComputeSectionOffset(HCEESECTION section, _In_ char *ptr,
+ unsigned *offset);
+
+ virtual HRESULT ComputeOffset(HCEEFILE file, _In_ char *ptr,
+ HCEESECTION *pSection, unsigned *offset);
+
+ virtual HRESULT GetCorHeader(HCEEFILE ceeFile,
+ IMAGE_COR20_HEADER **header);
+
+ // Layout the sections and assign their starting addresses
+ virtual HRESULT LinkCeeFile (HCEEFILE ceeFile);
+
+ // Apply relocations to any pointer data. Also generate PE base relocs
+ virtual HRESULT FixupCeeFile (HCEEFILE ceeFile);
+
+ // Base RVA assinged to the section. To be called only after LinkCeeFile()
+ virtual HRESULT GetSectionRVA (HCEESECTION section, ULONG *rva);
+
+ _Return_type_success_(return == S_OK)
+ virtual HRESULT ComputeSectionPointer(HCEESECTION section, ULONG offset,
+ _Out_ char **ptr);
+
+ virtual HRESULT SetObjSwitch (HCEEFILE ceeFile, BOOL objSwitch);
+ virtual HRESULT GetObjSwitch (HCEEFILE ceeFile, BOOL *objSwitch);
+ virtual HRESULT SetVTableEntry(HCEEFILE ceeFile, ULONG size, ULONG offset);
+ // See the end of interface for another overload of AetVTableEntry
+
+ virtual HRESULT SetStrongNameEntry(HCEEFILE ceeFile, ULONG size, ULONG offset);
+
+ // Emit the metadata from "emitter".
+ // If 'section != 0, it will put the data in 'buffer'. This
+ // buffer is assumed to be in 'section' at 'offset' and of size 'buffLen'
+ // (should use GetSaveSize to insure that buffer is big enough
+ virtual HRESULT EmitMetaDataAt (HCEEFILE ceeFile, IMetaDataEmit *emitter,
+ HCEESECTION section, DWORD offset,
+ BYTE* buffer, unsigned buffLen);
+
+ virtual HRESULT GetFileTimeStamp (HCEEFILE ceeFile, DWORD *pTimeStamp);
+
+ // Add a notification handler. If it implements an interface that
+ // the ICeeFileGen understands, S_OK is returned. Otherwise,
+ // E_NOINTERFACE.
+ virtual HRESULT AddNotificationHandler(HCEEFILE ceeFile,
+ IUnknown *pHandler);
+
+ virtual HRESULT SetFileAlignment(HCEEFILE ceeFile, ULONG fileAlignment);
+
+ virtual HRESULT ClearComImageFlags (HCEEFILE ceeFile, DWORD mask);
+
+ // call this to instantiate a PE+ (64-bit PE file)
+ virtual HRESULT CreateCeeFileEx(HCEEFILE *ceeFile, ULONG createFlags);
+ virtual HRESULT SetImageBase64(HCEEFILE ceeFile, ULONGLONG imageBase);
+
+ virtual HRESULT GetHeaderInfo (HCEEFILE ceeFile, PIMAGE_NT_HEADERS *ppNtHeaders,
+ PIMAGE_SECTION_HEADER *ppSections,
+ ULONG *pNumSections);
+
+ // Seed file is a base file which is copied over into the output file
+ // Note that there are restrictions on the seed file (the sections
+ // cannot be relocated), and that the copy is not complete as the new
+ // headers overwrite the seed file headers.
+ virtual HRESULT CreateCeeFileEx2(HCEEFILE *ceeFile, ULONG createFlags,
+ LPCWSTR seedFileName = NULL);
+
+ virtual HRESULT SetVTableEntry64(HCEEFILE ceeFile, ULONG size, void* ptr);
+};
+
+#endif
diff --git a/src/inc/iilfingerprint.h b/src/inc/iilfingerprint.h
new file mode 100644
index 0000000000..e5a26986e8
--- /dev/null
+++ b/src/inc/iilfingerprint.h
@@ -0,0 +1,128 @@
+// 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.
+// ===========================================================================
+// File: IILFingerprint.h
+// ===========================================================================
+
+#ifndef __IILFingerprint_h__
+#define __IILFingerprint_h__
+
+#include "cor.h"
+
+//**********************************************************************
+// IILFingerprint:
+//
+// When ngen images are present, the CLR often avoids opening IL files altogether while
+// still making assumptions about their contents (in particular when binding native images.)
+// This raise a vulnerability where someone may overwrite the IL during a running process.
+// Should the runtime need to delay-load the IL file (e.g. in an IJW app), it may find to
+// its dismay that the IL file's contents have changed, or were out of sync with the native image
+// cache's data all along.
+//
+// To address this, the CLR maintains a process-wide "ILFingerprint" object for each IL file with a unique path.
+// As the process runs, and components (i.e. native binder) makes assumptions about the contents
+// of the unopened IL file, the fingerprint collects these assumptions and ensures that everyone
+// work off the same assumptions.
+//
+// If the file is ever opened, the fingerprint reads the actual data from the IL file and compares
+// it to the stored assumptions. If they are conflict, the runtime raises a torn state condition
+// and refuses to load the file.
+//
+// Data model:
+//
+// The fingerprint is conceptually a property bag. For efficiency purposes, each property type
+// is associated with a fixed-size memory blob with non-customizable copy and compare operations
+// (they are memcpy and memcmp, respectively.)
+//
+// This allows for efficient operation (native binding is perf sensitive) at the expense of
+// some flexibility. (Given the free-for-all that IAssemblyNames became when it became too accomodating a
+// property bag, that inflexibility is by design, actually.)
+//
+// Implementation:
+// The actual implementation of ILFingerprint is the PEFingerprint class, implemented in VM\PEFingerprint.cpp.
+// Since PEImages are already memoized by pathname, they serve as the fingerprint custodian.
+
+
+typedef enum
+{
+ ILFTagTimestamp = 0, // datatype == FILETIME (8 bytes)
+ ILFTagSize = 1, // datatype == DWORD (4 bytes)
+ ILFTagMvid = 2, // datatype == GUID (16 bytes)
+
+ // NB: If you add or change constants here, you must update PEFingerprint::s_offsets and PEFingerprint::s_sizes in PEFingerprint.cpp
+
+ ILFTagCount = 3, // used for range verification
+} ILFingerprintTag;
+
+typedef struct
+{
+ ILFingerprintTag _tag;
+ LPCVOID _data;
+} ILFingerprintComponent;
+
+interface IILFingerprint
+{
+ public:
+ //---------------------------------------------------------------------------------------------
+ // Lifetime management methods.
+ //---------------------------------------------------------------------------------------------
+ STDMETHOD_(ULONG, AddRef)() = 0;
+ STDMETHOD_(ULONG, Release)() = 0;
+
+ //---------------------------------------------------------------------------------------------
+ // Convenience fcn: equivalent to calling CommitAndCompareMulti() with one component.
+ //---------------------------------------------------------------------------------------------
+ STDMETHOD_(BOOL, CommitAndCompare)(
+ ILFingerprintTag componentType,
+ LPCVOID data) = 0;
+
+ //---------------------------------------------------------------------------------------------
+ // CommitAndCompareMulti(): Atomically commits one or more fingerprint components into
+ // the fingerprint. Once a component is committed, its value can never change.
+ //
+ // An attempt to commit a component succeeds only if the component was not already committed
+ // or the prior value maches the new one exactly.
+ //
+ // Calling CommitAndCompare() multiple times is not equivalent to calling CommitAndCompareMulti().
+ // CommitAndCompareMulti() is atomic - either all the commits happen or none of them do.
+ //
+ // Returns:
+ // TRUE: All passed components committed successful.
+ // FALSE: At leat one component failed to commit successfully.
+ //---------------------------------------------------------------------------------------------
+ STDMETHOD_(BOOL, CommitAndCompareMulti)(
+ UINT numComponents,
+ const ILFingerprintComponent *pComponents) = 0;
+
+
+ //---------------------------------------------------------------------------------------------
+ // LockAndLoadIL()
+ //
+ // Forces the runtime to open the IL file and lock it against future overwrites. This
+ // is bad for working set so this should be avoided.
+ //
+ // Once opened and locked, this method extracts the actual fingerprint from the IL file
+ // and attempts to commit it into the ILFingerprint. If successful, all future commits
+ // will now be compared against this trusted data. If unsuccessful, this is a torn state
+ // situation and LockAndLoadIL() throws the torn state exception.
+ //---------------------------------------------------------------------------------------------
+ STDMETHOD_(VOID, LockAndLoadIL)() = 0;
+};
+
+interface IILFingerprintFactory
+{
+ public:
+ //---------------------------------------------------------------------------------------------
+ // Lifetime management methods.
+ //---------------------------------------------------------------------------------------------
+ STDMETHOD_(ULONG, AddRef)() = 0;
+ STDMETHOD_(ULONG, Release)() = 0;
+
+ STDMETHOD(GetILFingerprintForPath)(
+ LPCWSTR path,
+ IILFingerprint **ppFingerprint) = 0;
+};
+
+#endif // __IILFingerprint_h__
+
diff --git a/src/inc/il_kywd.h b/src/inc/il_kywd.h
new file mode 100644
index 0000000000..e16d7c7b9d
--- /dev/null
+++ b/src/inc/il_kywd.h
@@ -0,0 +1,303 @@
+// 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.
+//
+//
+// COM+ IL keywords, symbols and values
+//
+// This is the master table used in ILASM (asmparse.y)
+// and ILDASM (dis.cpp)
+// symbols and values are defined in asmparse.y
+// and not used in dis.cpp
+//
+
+#ifndef __IL_KYWD_H_
+#define __IL_KYWD_H_
+
+ KYWD( "void", VOID_, NO_VALUE )
+ KYWD( "bool", BOOL_, NO_VALUE )
+ KYWD( "char", CHAR_, NO_VALUE )
+ KYWD( "wchar", CHAR_, NO_VALUE )
+ KYWD( "int", INT_, NO_VALUE )
+ KYWD( "int8", INT8_, NO_VALUE )
+ KYWD( "int16", INT16_, NO_VALUE )
+ KYWD( "int32", INT32_, NO_VALUE )
+ KYWD( "int64", INT64_, NO_VALUE )
+ KYWD( "uint", UINT_, NO_VALUE )
+ KYWD( "uint8", UINT8_, NO_VALUE )
+ KYWD( "uint16", UINT16_, NO_VALUE )
+ KYWD( "uint32", UINT32_, NO_VALUE )
+ KYWD( "uint64", UINT64_, NO_VALUE )
+ KYWD( "float", FLOAT_, NO_VALUE )
+ KYWD( "float32", FLOAT32_, NO_VALUE )
+ KYWD( "float64", FLOAT64_, NO_VALUE )
+ KYWD( "refany", TYPEDREF_, NO_VALUE )
+ KYWD( "typedref", TYPEDREF_, NO_VALUE )
+ KYWD( "object", OBJECT_, NO_VALUE )
+ KYWD( "string", STRING_, NO_VALUE )
+ KYWD( "native", NATIVE_, NO_VALUE )
+ KYWD( "unsigned", UNSIGNED_, NO_VALUE )
+ KYWD( "value", VALUE_, NO_VALUE )
+ KYWD( "valuetype", VALUETYPE_, NO_VALUE )
+ KYWD( "class", CLASS_, NO_VALUE )
+ KYWD( "vararg", VARARG_, NO_VALUE )
+ KYWD( "default", DEFAULT_, NO_VALUE )
+ KYWD( "stdcall", STDCALL_, NO_VALUE )
+ KYWD( "thiscall", THISCALL_, NO_VALUE )
+ KYWD( "fastcall", FASTCALL_, NO_VALUE )
+ KYWD( "unmanaged", UNMANAGED_, NO_VALUE )
+ KYWD( "beforefieldinit",BEFOREFIELDINIT_, NO_VALUE )
+ KYWD( "instance", INSTANCE_, NO_VALUE )
+ KYWD( "filter", FILTER_, NO_VALUE )
+ KYWD( "catch", CATCH_, NO_VALUE )
+ KYWD( "static", STATIC_ , NO_VALUE )
+ KYWD( "public", PUBLIC_, NO_VALUE )
+ KYWD( "private", PRIVATE_, NO_VALUE )
+ KYWD( "forwarder", FORWARDER_, NO_VALUE )
+ KYWD( "synchronized", SYNCHRONIZED_, NO_VALUE )
+ KYWD( "interface", INTERFACE_, NO_VALUE )
+ KYWD( "extends", EXTENDS_, NO_VALUE )
+ KYWD( "implements", IMPLEMENTS_, NO_VALUE )
+ KYWD( "handler", HANDLER_, NO_VALUE )
+ KYWD( "finally", FINALLY_, NO_VALUE )
+ KYWD( "fault", FAULT_, NO_VALUE )
+ KYWD( "to", TO_, NO_VALUE )
+ KYWD( "abstract", ABSTRACT_, NO_VALUE )
+ KYWD( "auto", AUTO_, NO_VALUE )
+ KYWD( "sequential", SEQUENTIAL_, NO_VALUE )
+ KYWD( "explicit", EXPLICIT_, NO_VALUE )
+ KYWD( "ansi", ANSI_, NO_VALUE )
+ KYWD( "unicode", UNICODE_, NO_VALUE )
+ KYWD( "autochar", AUTOCHAR_, NO_VALUE )
+ KYWD( "import", IMPORT_, NO_VALUE )
+ KYWD( "enum", ENUM_, NO_VALUE )
+ KYWD( "virtual", VIRTUAL_, NO_VALUE )
+ KYWD( "strict", STRICT_, NO_VALUE )
+ KYWD( "il", CIL_, NO_VALUE )
+ KYWD( "cil", CIL_, NO_VALUE )
+ KYWD( "optil", OPTIL_, NO_VALUE )
+ KYWD( "managed", MANAGED_, NO_VALUE )
+ KYWD( "preservesig", PRESERVESIG_, NO_VALUE )
+ KYWD( "runtime", RUNTIME_, NO_VALUE )
+ KYWD( "method", METHOD_, NO_VALUE )
+ KYWD( "field", FIELD_, NO_VALUE )
+ KYWD( "property", PROPERTY_, NO_VALUE )
+ KYWD( "bytearray", BYTEARRAY_, NO_VALUE )
+ KYWD( "final", FINAL_, NO_VALUE )
+ KYWD( "sealed", SEALED_, NO_VALUE )
+ KYWD( "specialname", SPECIALNAME_, NO_VALUE )
+ KYWD( "family", FAMILY_, NO_VALUE )
+ KYWD( "assembly", ASSEMBLY_, NO_VALUE )
+ KYWD( "famandassem", FAMANDASSEM_, NO_VALUE )
+ KYWD( "famorassem", FAMORASSEM_, NO_VALUE )
+ KYWD( "privatescope", PRIVATESCOPE_, NO_VALUE )
+ KYWD( "nested", NESTED_, NO_VALUE )
+ KYWD( "hidebysig", HIDEBYSIG_, NO_VALUE )
+ KYWD( "newslot", NEWSLOT_, NO_VALUE )
+ KYWD( "aggressiveinlining",AGGRESSIVEINLINING_,NO_VALUE )
+ KYWD( "rtspecialname", RTSPECIALNAME_, NO_VALUE )
+ KYWD( "pinvokeimpl", PINVOKEIMPL_, NO_VALUE )
+ KYWD( "unmanagedexp", UNMANAGEDEXP_, NO_VALUE )
+ KYWD( "reqsecobj", REQSECOBJ_, NO_VALUE )
+ KYWD( ".ctor", _CTOR, NO_VALUE )
+ KYWD( ".cctor", _CCTOR, NO_VALUE )
+ KYWD( "initonly", INITONLY_, NO_VALUE )
+ KYWD( "literal", LITERAL_, NO_VALUE )
+ KYWD( "notserialized", NOTSERIALIZED_, NO_VALUE )
+ KYWD( "forwardref", FORWARDREF_, NO_VALUE )
+ KYWD( "internalcall", INTERNALCALL_, NO_VALUE )
+ KYWD( "noinlining", NOINLINING_, NO_VALUE )
+ KYWD( "nooptimization", NOOPTIMIZATION_, NO_VALUE )
+ KYWD( "nomangle", NOMANGLE_, NO_VALUE )
+ KYWD( "lasterr", LASTERR_, NO_VALUE )
+ KYWD( "winapi", WINAPI_, NO_VALUE )
+ KYWD( "cdecl", CDECL_, NO_VALUE )
+ KYWD( "as", AS_, NO_VALUE )
+ KYWD( "pinned", PINNED_, NO_VALUE )
+ KYWD( "modreq", MODREQ_, NO_VALUE )
+ KYWD( "modopt", MODOPT_, NO_VALUE )
+ KYWD( "serializable", SERIALIZABLE_, NO_VALUE )
+ KYWD( "at", AT_, NO_VALUE )
+ KYWD( "tls", TLS_, NO_VALUE )
+ KYWD( "true", TRUE_, NO_VALUE )
+ KYWD( "false", FALSE_, NO_VALUE )
+ KYWD( "on", ON_, NO_VALUE )
+ KYWD( "off", OFF_, NO_VALUE )
+ KYWD( "bestfit", BESTFIT_, NO_VALUE )
+ KYWD( "charmaperror", CHARMAPERROR_, NO_VALUE )
+
+ /* assembler directives */
+ KYWD( ".class", _CLASS, NO_VALUE )
+ KYWD( ".this", _THIS, NO_VALUE )
+ KYWD( ".base", _BASE, NO_VALUE )
+ KYWD( ".nester", _NESTER, NO_VALUE )
+ KYWD( ".namespace", _NAMESPACE, NO_VALUE )
+ KYWD( ".method", _METHOD, NO_VALUE )
+ KYWD( ".field", _FIELD, NO_VALUE )
+ KYWD( ".emitbyte", _EMITBYTE, NO_VALUE )
+ KYWD( ".try", _TRY, NO_VALUE )
+ KYWD( ".maxstack", _MAXSTACK, NO_VALUE )
+ KYWD( ".locals", _LOCALS, NO_VALUE )
+ KYWD( ".entrypoint", _ENTRYPOINT, NO_VALUE )
+ KYWD( ".zeroinit", _ZEROINIT, NO_VALUE )
+ KYWD( ".data", _DATA, NO_VALUE )
+
+ KYWD( ".event", _EVENT, NO_VALUE )
+ KYWD( ".addon", _ADDON, NO_VALUE )
+ KYWD( ".removeon", _REMOVEON, NO_VALUE )
+ KYWD( ".fire", _FIRE, NO_VALUE )
+ KYWD( ".other", _OTHER, NO_VALUE )
+
+ KYWD( ".property", _PROPERTY, NO_VALUE )
+ KYWD( ".set", _SET, NO_VALUE )
+ KYWD( ".get", _GET, NO_VALUE )
+
+ KYWD( ".permission", _PERMISSION, NO_VALUE )
+ KYWD( ".permissionset", _PERMISSIONSET, NO_VALUE )
+
+ /* security actions */
+ KYWD( "request", REQUEST_, NO_VALUE )
+ KYWD( "demand", DEMAND_, NO_VALUE )
+ KYWD( "assert", ASSERT_, NO_VALUE )
+ KYWD( "deny", DENY_, NO_VALUE )
+ KYWD( "permitonly", PERMITONLY_, NO_VALUE )
+ KYWD( "linkcheck", LINKCHECK_, NO_VALUE )
+ KYWD( "inheritcheck", INHERITCHECK_, NO_VALUE )
+ KYWD( "reqmin", REQMIN_, NO_VALUE )
+ KYWD( "reqopt", REQOPT_, NO_VALUE )
+ KYWD( "reqrefuse", REQREFUSE_, NO_VALUE )
+ KYWD( "prejitgrant", PREJITGRANT_, NO_VALUE )
+ KYWD( "prejitdeny", PREJITDENY_, NO_VALUE )
+ KYWD( "noncasdemand", NONCASDEMAND_, NO_VALUE )
+ KYWD( "noncaslinkdemand",NONCASLINKDEMAND_, NO_VALUE )
+ KYWD( "noncasinheritance",NONCASINHERITANCE_,NO_VALUE )
+
+ /* extern debug data specifier */
+ KYWD( ".line", _LINE, NO_VALUE )
+ KYWD( ".language", _LANGUAGE, NO_VALUE )
+ KYWD( "#line", P_LINE, NO_VALUE )
+ /* custom value specifier */
+ KYWD( ".custom", _CUSTOM, NO_VALUE )
+ /* IL method attribute */
+ KYWD( "init", INIT_, NO_VALUE )
+ /* Class layout directives */
+ KYWD( ".size", _SIZE, NO_VALUE )
+ KYWD( ".pack", _PACK, NO_VALUE )
+ /* Manifest-related keywords */
+ KYWD( ".file", _FILE, NO_VALUE )
+ KYWD( "nometadata", NOMETADATA_, NO_VALUE )
+ KYWD( ".hash", _HASH, NO_VALUE )
+ KYWD( ".assembly", _ASSEMBLY, NO_VALUE )
+ KYWD( "retargetable", RETARGETABLE_, NO_VALUE )
+ KYWD( "windowsruntime", WINDOWSRUNTIME_, NO_VALUE )
+ KYWD( "noplatform", NOPLATFORM_, NO_VALUE )
+ KYWD( "legacy", LEGACY_, NO_VALUE )
+ KYWD( "library", LIBRARY_, NO_VALUE )
+ KYWD( "x86", X86_, NO_VALUE )
+ KYWD( "ia64", IA64_, NO_VALUE )
+ KYWD( "amd64", AMD64_, NO_VALUE )
+ KYWD( "arm", ARM_, NO_VALUE )
+ KYWD( ".publickey", _PUBLICKEY, NO_VALUE )
+ KYWD( ".publickeytoken",_PUBLICKEYTOKEN, NO_VALUE )
+ KYWD( "algorithm", ALGORITHM_, NO_VALUE )
+ KYWD( ".ver", _VER, NO_VALUE )
+ KYWD( ".locale", _LOCALE, NO_VALUE )
+ KYWD( "extern", EXTERN_, NO_VALUE )
+ KYWD( ".export", _EXPORT, NO_VALUE )
+ KYWD( ".manifestres", _MRESOURCE, NO_VALUE )
+ KYWD( ".mresource", _MRESOURCE, NO_VALUE )
+ KYWD( ".module", _MODULE, NO_VALUE )
+ /* Field marshaling keywords */
+ KYWD( "marshal", MARSHAL_, NO_VALUE )
+ KYWD( "custom", CUSTOM_, NO_VALUE )
+ KYWD( "sysstring", SYSSTRING_, NO_VALUE )
+ KYWD( "fixed", FIXED_, NO_VALUE )
+ KYWD( "variant", VARIANT_, NO_VALUE )
+ KYWD( "currency", CURRENCY_, NO_VALUE )
+ KYWD( "syschar", SYSCHAR_, NO_VALUE )
+ KYWD( "decimal", DECIMAL_, NO_VALUE )
+ KYWD( "date", DATE_, NO_VALUE )
+ KYWD( "bstr", BSTR_, NO_VALUE )
+ KYWD( "tbstr", TBSTR_, NO_VALUE )
+ KYWD( "lpstr", LPSTR_, NO_VALUE )
+ KYWD( "lpwstr", LPWSTR_, NO_VALUE )
+ KYWD( "lptstr", LPTSTR_, NO_VALUE )
+ KYWD( "objectref", OBJECTREF_, NO_VALUE )
+ KYWD( "iunknown", IUNKNOWN_, NO_VALUE )
+ KYWD( "idispatch", IDISPATCH_, NO_VALUE )
+ KYWD( "iidparam", IIDPARAM_, NO_VALUE )
+ KYWD( "struct", STRUCT_, NO_VALUE )
+ KYWD( "safearray", SAFEARRAY_, NO_VALUE )
+ KYWD( "byvalstr", BYVALSTR_, NO_VALUE )
+ KYWD( "lpvoid", LPVOID_, NO_VALUE )
+ KYWD( "any", ANY_, NO_VALUE )
+ KYWD( "array", ARRAY_, NO_VALUE )
+ KYWD( "lpstruct", LPSTRUCT_, NO_VALUE )
+ /* VTable fixup keywords */
+ KYWD( ".vtfixup", _VTFIXUP, NO_VALUE )
+ KYWD( "fromunmanaged", FROMUNMANAGED_, NO_VALUE )
+ KYWD( "retainappdomain",RETAINAPPDOMAIN_, NO_VALUE )
+ KYWD( "callmostderived",CALLMOSTDERIVED_, NO_VALUE )
+ KYWD( ".vtentry", _VTENTRY, NO_VALUE )
+ /* Parameter attributes */
+ KYWD( "in", IN_, NO_VALUE )
+ KYWD( "out", OUT_, NO_VALUE )
+ KYWD( "opt", OPT_, NO_VALUE )
+ KYWD( ".param", PARAM_, NO_VALUE )
+ /* Method implementations */
+ KYWD( ".override", _OVERRIDE, NO_VALUE )
+ KYWD( "with", WITH_, NO_VALUE )
+ /* VariantType keywords */
+ KYWD( "null", NULL_, NO_VALUE )
+ KYWD( "error", ERROR_, NO_VALUE )
+ KYWD( "hresult", HRESULT_, NO_VALUE )
+ KYWD( "carray", CARRAY_, NO_VALUE )
+ KYWD( "userdefined", USERDEFINED_, NO_VALUE )
+ KYWD( "record", RECORD_, NO_VALUE )
+ KYWD( "filetime", FILETIME_, NO_VALUE )
+ KYWD( "blob", BLOB_, NO_VALUE )
+ KYWD( "stream", STREAM_, NO_VALUE )
+ KYWD( "storage", STORAGE_, NO_VALUE )
+ KYWD( "streamed_object",STREAMED_OBJECT_, NO_VALUE )
+ KYWD( "stored_object", STORED_OBJECT_, NO_VALUE )
+ KYWD( "blob_object", BLOB_OBJECT_, NO_VALUE )
+ KYWD( "cf", CF_, NO_VALUE )
+ KYWD( "clsid", CLSID_, NO_VALUE )
+ KYWD( "vector", VECTOR_, NO_VALUE )
+ /* Null reference keyword for InitOpt */
+ KYWD( "nullref", NULLREF_, NO_VALUE )
+ KYWD( "type", TYPE_, NO_VALUE )
+ KYWD( ".interfaceimpl", _INTERFACEIMPL, NO_VALUE )
+ /* Header flags keywords */
+ KYWD( ".subsystem", _SUBSYSTEM, NO_VALUE )
+ KYWD( ".corflags", _CORFLAGS, NO_VALUE )
+ KYWD( "alignment", ALIGNMENT_, NO_VALUE )
+ KYWD( ".imagebase", _IMAGEBASE, NO_VALUE )
+ KYWD( ".stackreserve", _STACKRESERVE, NO_VALUE )
+ /* Explicit binary flag specification keywords */
+ KYWD( "flags", FLAGS_, NO_VALUE )
+ KYWD( "callconv", CALLCONV_, NO_VALUE )
+ KYWD( "mdtoken", MDTOKEN_, NO_VALUE )
+
+ /* Some ILASM-specific syntactic sugar */
+ KYWD( ".typedef", _TYPEDEF, NO_VALUE )
+ KYWD( ".template", _TEMPLATE, NO_VALUE )
+ KYWD( ".typelist", _TYPELIST, NO_VALUE )
+ KYWD( ".mscorlib", _MSCORLIB, NO_VALUE )
+
+ /* Compilation control keywords */
+ KYWD( "#define", P_DEFINE, NO_VALUE )
+ KYWD( "#undef", P_UNDEF, NO_VALUE )
+ KYWD( "#ifdef", P_IFDEF, NO_VALUE )
+ KYWD( "#ifndef", P_IFNDEF, NO_VALUE )
+ KYWD( "#else", P_ELSE, NO_VALUE )
+ KYWD( "#endif", P_ENDIF, NO_VALUE )
+ KYWD( "#include", P_INCLUDE, NO_VALUE )
+
+
+ /* Deprecated keywords */
+ KYWD( ".vtable", _VTABLE, NO_VALUE )
+
+
+ KYWD( "^THE_END^", 0, NO_VALUE )
+#endif
diff --git a/src/inc/ildbsymlib.h b/src/inc/ildbsymlib.h
new file mode 100644
index 0000000000..6c2d4d0edf
--- /dev/null
+++ b/src/inc/ildbsymlib.h
@@ -0,0 +1,21 @@
+// 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.
+//*****************************************************************************
+// IldbSymLib.h
+//
+// ILDB debug symbols functions implemented in IldbSymLib.lib
+// Provides support for ILDB-format debug symbols using the same interfaces
+// that diasymreader.dll exposes for PDB symbols.
+//
+//*****************************************************************************
+#ifndef __IldbSymLib_h__
+#define __IldbSymLib_h__
+
+// Get the IClassFactory for one of the ILDB symbols CLSIDs
+STDAPI IldbSymbolsGetClassObject(REFCLSID rclsid, REFIID riid, void** ppvObject);
+
+// Create an inststance of an ILDB ISymUnmanagedReader, ISymUnmanagedWriter or ISymUnmanagedBinder
+STDAPI IldbSymbolsCreateInstance(REFCLSID rclsid, REFIID riid, void** ppvIUnknown);
+
+#endif // __IldbSymLib_h__
diff --git a/src/inc/ilformatter.h b/src/inc/ilformatter.h
new file mode 100644
index 0000000000..7593aa65bc
--- /dev/null
+++ b/src/inc/ilformatter.h
@@ -0,0 +1,76 @@
+// 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.
+
+
+/***************************************************************************/
+/* ILFormatter.h */
+/***************************************************************************/
+
+#ifndef ILFormatter_h
+#define ILFormatter_h
+
+#include "opinfo.h"
+#include "outstring.h"
+
+struct IMetaDataImport;
+
+#define INVALID_IL_OFFSET 0x80000000
+
+/***************************************************************************/
+class ILFormatter {
+public:
+ ILFormatter() : start(0), targetStart(0), stackStart(0) {}
+
+ ILFormatter(IMetaDataImport* aMeta, const BYTE* aStart,
+ const BYTE* aLimit, unsigned maxStack, const COR_ILMETHOD_SECT_EH* eh)
+ : targetStart(0), stackStart(0) {
+ init(aMeta, aStart, aLimit, maxStack, eh);
+ }
+ ~ILFormatter() { delete [] stackStart; delete [] targetStart; }
+
+ void init(IMetaDataImport* aMeta, const BYTE* aStart,
+ const BYTE* aLimit, unsigned maxStack, const COR_ILMETHOD_SECT_EH* eh);
+ const BYTE* formatStatement(const BYTE* stmtIL, OutString* out);
+ const BYTE* formatInstr(const BYTE* instrIL, OutString* out);
+private:
+
+ void formatInstrArgs(OpInfo op, OpArgsVal arg, OutString* out, size_t curIP=INVALID_IL_OFFSET);
+ void formatArgs(unsigned numArgs, OutString* out);
+ void spillStack(OutString* out);
+ void setStackAsTarget(size_t ilOffset);
+ void setTarget(size_t ilOffset, size_t depth);
+
+private:
+ const BYTE* start; // keeps us sane
+ const BYTE* limit;
+ IMetaDataImport* meta; // used to parse tokens etc
+
+ struct StackEntry {
+ OutString val;
+ int prec;
+ };
+
+ struct Target {
+ size_t ilOffset;
+ size_t stackDepth;
+ };
+
+ Target* targetStart;
+ Target* targetEnd;
+ Target* targetCur;
+
+ size_t stackDepth();
+ void pushAndClear(OutString* val, int prec);
+ OutString* pop(int prec = 0);
+ OutString* top();
+ void popN(size_t num);
+
+ StackEntry* stackStart;
+ StackEntry* stackEnd;
+ StackEntry* stackCur; // points at the next slot to fill
+
+};
+
+#endif
+
diff --git a/src/inc/internalunknownimpl.h b/src/inc/internalunknownimpl.h
new file mode 100644
index 0000000000..9b561fad64
--- /dev/null
+++ b/src/inc/internalunknownimpl.h
@@ -0,0 +1,494 @@
+// 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.
+//*****************************************************************************
+//
+// InternalUnknownImpl.h
+//
+// Defines utility class ComUtil::IUnknownCommon, which provides default
+// implementations for IUnknown's AddRef, Release, and QueryInterface methods.
+//
+// Use: a class that implements one or more interfaces should derive from
+// ComUtil::IUnknownCommon with a template parameter list consisting of the
+// list of implemented interfaces.
+//
+// Example:
+// class MyInterfacesImpl :
+// public IUnknownCommon<MyInterface1, MyInterface2>
+// { ... };
+//
+// IUnknownCommon will provide base AddRef and Release semantics, and will
+// also provide an implementation of QueryInterface that will evaluate the
+// arguments against the set of supported interfaces and return the
+// appropriate result.
+//
+// If you need to specify multiple interfaces where one is a base interface
+// of another and implementing all of them would result in a compiler error,
+// you can use the NoDerive wrapper to tell IUnknownCommon to not derive from
+// this interface but just use it for QueryInterface calls.
+//
+// Example:
+// interface A
+// { ... };
+// interface B : public A
+// { ... };
+// class MyInterfacesImpl : public IUnknownCommon<B, NoDerive<A> >
+// { ... };
+//
+// If a base type also implements IUnknownCommon, then you must override
+// QueryInterface with a method that delegates to your type's
+// IUnknownCommon::QueryInterface and then to BaseType::QueryInterface.
+//
+
+
+//
+//*****************************************************************************
+
+#ifndef __InternalUnknownImpl_h__
+#define __InternalUnknownImpl_h__
+
+#include <winnt.h>
+#include "winwrap.h"
+#include "contract.h"
+#include "ex.h"
+#include "volatile.h"
+#include "mpl/type_list"
+#include "debugmacros.h"
+
+#define COMUTIL_IIDOF(x) __uuidof(x)
+
+namespace ComUtil
+{
+ //---------------------------------------------------------------------------------------------
+ template <typename T>
+ struct TypeWrapper
+ { typedef T wrapped_type; };
+
+ namespace detail
+ {
+ typedef char (&_Yes)[1];
+ typedef char (&_No)[2];
+
+ static inline _No _IsTypeWrapper(...);
+
+ template <typename T>
+ static _Yes _IsTypeWrapper(T *, typename T::wrapped_type * = nullptr);
+ }
+
+ //---------------------------------------------------------------------------------------------
+ template <typename T>
+ struct IsTypeWrapper
+ {
+ static const bool value = std::integral_constant<
+ bool,
+ sizeof(detail::_IsTypeWrapper((T*)0)) == sizeof(detail::_Yes)>::value;
+ };
+
+ //-----------------------------------------------------------------------------------------
+ // Utility to remove marker type wrappers.
+ template <typename T, bool IsWrapper = IsTypeWrapper<T>::value>
+ struct UnwrapOne
+ { typedef T type; };
+
+ template <typename T>
+ struct UnwrapOne<T, true>
+ { typedef typename T::wrapped_type type; };
+
+ template <typename T, bool IsWrapper = IsTypeWrapper<T>::value>
+ struct Unwrap
+ { typedef T type; };
+
+ template <typename T>
+ struct Unwrap<T, true>
+ { typedef typename Unwrap< typename UnwrapOne<T>::type >::type type; };
+
+ //---------------------------------------------------------------------------------------------
+ // Used as a flag to indicate that an interface should not be used as a base class.
+ // See DeriveTypeList below.
+ template <typename T>
+ struct NoDerive : public TypeWrapper<T>
+ { };
+
+ //---------------------------------------------------------------------------------------------
+ // Used to indicate that a base class contributes implemented interfaces.
+ template <typename T>
+ struct ItfBase : public TypeWrapper<T>
+ { };
+
+ namespace detail
+ {
+ using namespace mpl;
+
+ //-----------------------------------------------------------------------------------------
+ // Exposes a type that derives every type in the given type list, except for those marked
+ // with NoDerive.
+ template <typename ListT>
+ struct DeriveTypeList;
+
+ // Common case. Derive from list head and recursively on list tail.
+ template <typename HeadT, typename TailT>
+ struct DeriveTypeList< type_list<HeadT, TailT> > :
+ public Unwrap<HeadT>::type,
+ public DeriveTypeList<TailT>
+ {};
+
+ // Non-derived case. Skip this type, continue with tail.
+ template <typename HeadT, typename TailT>
+ struct DeriveTypeList< type_list< NoDerive< HeadT >, TailT> > :
+ public DeriveTypeList<TailT>
+ {};
+
+ // Termination case.
+ template <>
+ struct DeriveTypeList<null_type>
+ {};
+
+ //-----------------------------------------------------------------------------------------
+ template <typename ItfTypeListT>
+ struct GetFirstInterface;
+
+ template <typename HeadT, typename TailT>
+ struct GetFirstInterface< type_list<HeadT, TailT> >
+ { typedef HeadT type; };
+
+ template <typename HeadT, typename TailT>
+ struct GetFirstInterface< type_list< ItfBase< HeadT >, TailT> >
+ { typedef typename GetFirstInterface<TailT>::type type; };
+
+ template <>
+ struct GetFirstInterface< null_type >
+ { typedef IUnknown type; };
+
+ //-----------------------------------------------------------------------------------------
+ // Uses type lists to implement the helper. Type lists are implemented
+ // through templates, and can be best understood if compared to Scheme
+ // cdr and cons: each list type has a head type and a tail type. The
+ // head type is typically a concrete type, and the tail type is
+ // typically another list containing the remainder of the list. Type
+ // lists are terminated with a head type of null_type.
+ //
+ // QueryInterface is implemented using QIHelper, which uses type_lists
+ // and partial specialization to recursively walk the type list and
+ // look to see if the requested interface is supported. If not, then
+ // the termination case is reached and a final test against IUknown
+ // is made before returning a failure.
+ //-----------------------------------------------------------------------------------------
+ template <typename InterfaceTypeList>
+ struct QIHelper;
+
+ template <typename HeadT, typename TailT>
+ struct QIHelper< type_list< HeadT, TailT > >
+ {
+ template <typename IUnknownCommonT>
+ static inline HRESULT QI(
+ REFIID riid,
+ void **ppvObject,
+ IUnknownCommonT *pThis)
+ {
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_GC_NOTRIGGER;
+ STATIC_CONTRACT_ENTRY_POINT;
+
+ HRESULT hr = S_OK;
+
+ typedef typename Unwrap<HeadT>::type ItfT;
+
+ // If the interface type matches that of the head of the list,
+ // then cast to it and return success.
+ if (riid == COMUTIL_IIDOF(ItfT))
+ {
+ ItfT *pItf = static_cast<ItfT *>(pThis);
+ pItf->AddRef();
+ *ppvObject = pItf;
+ }
+ // If not, recurse on the tail of the list.
+ else
+ hr = QIHelper<TailT>::QI(riid, ppvObject, pThis);
+
+ return hr;
+ }
+ };
+
+ template <typename HeadT, typename TailT>
+ struct QIHelper< type_list< ItfBase< HeadT >, TailT> >
+ {
+ template <typename IUnknownCommonT>
+ static inline HRESULT QI(
+ REFIID riid,
+ void **ppvObject,
+ IUnknownCommonT *pThis)
+ {
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_GC_NOTRIGGER;
+ STATIC_CONTRACT_ENTRY_POINT;
+
+ HRESULT hr = S_OK;
+
+ hr = pThis->HeadT::QueryInterface(riid, ppvObject);
+
+ if (hr == E_NOINTERFACE)
+ hr = QIHelper<TailT>::QI(riid, ppvObject, pThis);
+
+ return hr;
+ }
+ };
+
+ // This is the termination case. In this case, we check if the
+ // requested interface is IUnknown (which is common to all interfaces).
+ template <>
+ struct QIHelper< null_type >
+ {
+ template <typename IUnknownCommonT>
+ static inline HRESULT QI(
+ REFIID riid,
+ void **ppvObject,
+ IUnknownCommonT *pThis)
+ {
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_GC_NOTRIGGER;
+ STATIC_CONTRACT_ENTRY_POINT;
+
+ HRESULT hr = S_OK;
+
+ // If the request was for IUnknown, cast and return success.
+ if (riid == COMUTIL_IIDOF(IUnknown))
+ {
+ typedef typename detail::GetFirstInterface<
+ typename IUnknownCommonT::InterfaceListT>::type IUnknownCastHelper;
+
+ // Cast to first interface type to then cast to IUnknown unambiguously.
+ IUnknown *pItf = static_cast<IUnknown *>(
+ static_cast<IUnknownCastHelper *>(pThis));
+ pItf->AddRef();
+ *ppvObject = pItf;
+ }
+ // Otherwise none of the interfaces match the requested IID,
+ // so return E_NOINTERFACE.
+ else
+ {
+ *ppvObject = nullptr;
+ hr = E_NOINTERFACE;
+ }
+
+ return hr;
+ }
+ };
+
+ //-----------------------------------------------------------------------------------------
+ // Is used as a virtual base to ensure that there is a single reference count field.
+ struct IUnknownCommonRef
+ {
+ inline
+ IUnknownCommonRef()
+ : m_cRef(0)
+ {}
+
+ Volatile<LONG> m_cRef;
+ };
+ }
+
+ //---------------------------------------------------------------------------------------------
+ // IUnknownCommon
+ //
+ // T0-T9 - the list of interfaces to implement.
+ template
+ <
+ typename T0 = mpl::null_type,
+ typename T1 = mpl::null_type,
+ typename T2 = mpl::null_type,
+ typename T3 = mpl::null_type,
+ typename T4 = mpl::null_type,
+ typename T5 = mpl::null_type,
+ typename T6 = mpl::null_type,
+ typename T7 = mpl::null_type,
+ typename T8 = mpl::null_type,
+ typename T9 = mpl::null_type
+ >
+ class IUnknownCommon :
+ virtual protected detail::IUnknownCommonRef,
+ public detail::DeriveTypeList< typename mpl::make_type_list<
+ T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>::type >
+ {
+ public:
+ typedef typename mpl::make_type_list<
+ T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>::type InterfaceListT;
+
+ // Add a virtual destructor to force derived types to also have virtual destructors.
+ virtual ~IUnknownCommon()
+ {
+ WRAPPER_NO_CONTRACT;
+ clr::dbg::PoisonMem(*this);
+ }
+
+ // Standard AddRef implementation
+ STDMETHOD_(ULONG, AddRef())
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ STATIC_CONTRACT_ENTRY_POINT;
+
+ return InterlockedIncrement(&m_cRef);
+ }
+
+ // Standard Release implementation.
+ STDMETHOD_(ULONG, Release())
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ STATIC_CONTRACT_ENTRY_POINT;
+
+ _ASSERTE(m_cRef > 0);
+
+ ULONG cRef = InterlockedDecrement(&m_cRef);
+
+ if (cRef == 0)
+ delete this; // Relies on virtual dtor to work properly.
+
+ return cRef;
+ }
+
+ // Uses detail::QIHelper for implementation.
+ STDMETHOD(QueryInterface(REFIID riid, void **ppvObject))
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ STATIC_CONTRACT_ENTRY_POINT;
+
+ if (ppvObject == nullptr)
+ return E_INVALIDARG;
+
+ *ppvObject = nullptr;
+
+ return detail::QIHelper<InterfaceListT>::QI(
+ riid, ppvObject, this);
+ }
+
+ template <typename ItfT>
+ HRESULT QueryInterface(ItfT **ppItf)
+ {
+ return QueryInterface(__uuidof(ItfT), reinterpret_cast<void**>(ppItf));
+ }
+
+ protected:
+ // May only be constructed as a base type.
+ inline IUnknownCommon() :
+ IUnknownCommonRef()
+ { WRAPPER_NO_CONTRACT; }
+ };
+
+ //---------------------------------------------------------------------------------------------
+ // IUnknownCommonExternal
+ //
+ // T0-T9 - the list of interfaces to implement.
+ template
+ <
+ typename T0 = mpl::null_type,
+ typename T1 = mpl::null_type,
+ typename T2 = mpl::null_type,
+ typename T3 = mpl::null_type,
+ typename T4 = mpl::null_type,
+ typename T5 = mpl::null_type,
+ typename T6 = mpl::null_type,
+ typename T7 = mpl::null_type,
+ typename T8 = mpl::null_type,
+ typename T9 = mpl::null_type
+ >
+ class IUnknownCommonExternal :
+ virtual protected detail::IUnknownCommonRef,
+ public detail::DeriveTypeList< typename mpl::make_type_list<
+ T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>::type >
+ {
+ public:
+ typedef typename mpl::make_type_list<
+ T0, T1, T2, T3, T4, T5, T6, T7, T8, T9>::type InterfaceListT;
+
+ // Standard AddRef implementation
+ STDMETHOD_(ULONG, AddRef())
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ STATIC_CONTRACT_ENTRY_POINT;
+
+ return InterlockedIncrement(&m_cRef);
+ }
+
+ // Standard Release implementation.
+ // Should be called outside VM only
+ STDMETHOD_(ULONG, Release())
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ STATIC_CONTRACT_ENTRY_POINT;
+
+ _ASSERTE(m_cRef > 0);
+
+ ULONG cRef = InterlockedDecrement(&m_cRef);
+
+ if (cRef == 0)
+ {
+ Cleanup(); // Cleans up the object
+ delete this;
+ }
+
+ return cRef;
+ }
+
+ // Internal release
+ // Should be called inside VM only
+ STDMETHOD_(ULONG, InternalRelease())
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ _ASSERTE(m_cRef > 0);
+
+ ULONG cRef = InterlockedDecrement(&m_cRef);
+
+ if (cRef == 0)
+ {
+ InternalCleanup(); // Cleans up the object, internal version
+ delete this;
+ }
+
+ return cRef;
+ }
+
+ // Uses detail::QIHelper for implementation.
+ STDMETHOD(QueryInterface(REFIID riid, void **ppvObject))
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ STATIC_CONTRACT_ENTRY_POINT;
+
+ if (ppvObject == nullptr)
+ return E_INVALIDARG;
+
+ *ppvObject = nullptr;
+
+ return detail::QIHelper<InterfaceListT>::QI(
+ riid, ppvObject, this);
+ }
+
+ template <typename ItfT>
+ HRESULT QueryInterface(ItfT **ppItf)
+ {
+ return QueryInterface(__uuidof(ItfT), reinterpret_cast<void**>(ppItf));
+ }
+
+ protected:
+ // May only be constructed as a base type.
+ inline IUnknownCommonExternal() :
+ IUnknownCommonRef()
+ { WRAPPER_NO_CONTRACT; }
+
+ // Internal version of cleanup
+ virtual void InternalCleanup() = 0;
+
+ // External version of cleanup
+ // Not surprisingly, this should call InternalCleanup to avoid duplicate code
+ // Not implemented here to avoid bringing too much into this header file
+ virtual void Cleanup() = 0;
+ };
+}
+
+#undef COMUTIL_IIDOF
+
+using ComUtil::NoDerive;
+using ComUtil::ItfBase;
+using ComUtil::IUnknownCommon;
+using ComUtil::IUnknownCommonExternal;
+
+#endif // __InternalUnknownImpl_h__
diff --git a/src/inc/intrinsic.h b/src/inc/intrinsic.h
new file mode 100644
index 0000000000..50bcd52b28
--- /dev/null
+++ b/src/inc/intrinsic.h
@@ -0,0 +1,25 @@
+// 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.
+//*****************************************************************************
+// Intrinsic.h
+//
+// Force several very useful functions to be intrinsic, which means that the
+// compiler will generate code inline for the functions instead of generating
+// a call to the function.
+//
+//*****************************************************************************
+
+#ifndef __intrinsic_h__
+#define __intrinsic_h__
+
+#ifdef _MSC_VER
+#pragma intrinsic(memcmp)
+#pragma intrinsic(memcpy)
+#pragma intrinsic(memset)
+#pragma intrinsic(strcmp)
+#pragma intrinsic(strcpy)
+#pragma intrinsic(strlen)
+#endif // defined(_MSC_VER)
+
+#endif // __intrinsic_h__
diff --git a/src/inc/ipcfunccall.h b/src/inc/ipcfunccall.h
new file mode 100644
index 0000000000..15034e09f8
--- /dev/null
+++ b/src/inc/ipcfunccall.h
@@ -0,0 +1,117 @@
+// 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.
+//*****************************************************************************
+// File: IPCFuncCall.h
+//
+// Define class to support a cross process function call.
+//
+//*****************************************************************************
+
+
+#ifndef _IPCFUNCCALLIMPL_H_
+#define _IPCFUNCCALLIMPL_H_
+
+//-----------------------------------------------------------------------------
+// 1. Handler creates a IPCFuncCallHandler object and inits it with
+// a callback function.
+// 2. Source calls IPCFuncCallSource::DoThreadSafeCall(). This will pause the
+// thread and trigger the callback on the handlers side.
+//
+// This mechanism is very robust. See the error return codes on
+// DoThreadSafeCall() for more details.
+//-----------------------------------------------------------------------------
+
+//-----------------------------------------------------------------------------
+// Send the call
+//-----------------------------------------------------------------------------
+class IPCFuncCallSource
+{
+public:
+//.............................................................................
+// Error return codes for members.
+// Our biggest error concerns are timeouts and no handlers. HRESULTS won't
+// help us with these, so we'll have to use our own codes.
+//.............................................................................
+ enum EError
+ {
+ // (Common) the function was called, and we waited for the full duration.
+ Ok,
+
+ // (Common) The function MAY have been called, but we timed out before it
+ // finished This means either: The function was called, but took too long
+ // to finish or The handler died on us right after we hooked up to it and
+ // so the function never even got called.
+ Fail_Timeout_Call,
+
+ // (Common) There was no handler for us to call
+ Fail_NoHandler,
+
+ // (rare) The function was never called. We successfully connected to the handler,
+ // but we timed out waiting for the mutex.
+ Fail_Timeout_Lock,
+
+ // (very rare) We were unable to create the mutex to serialize
+ Fail_CreateMutex,
+
+ // (very rare) Catch-all General Failure.
+ Failed
+
+ };
+
+
+// Make a call, wrapped in a mutex
+ static EError DoThreadSafeCall();
+
+
+protected:
+
+};
+
+
+//-----------------------------------------------------------------------------
+// AuxThread Callback
+//-----------------------------------------------------------------------------
+DWORD WINAPI HandlerAuxThreadProc(LPVOID lpParameter);
+
+
+//-----------------------------------------------------------------------------
+// Callback for handler. AuxThread will call this.
+//-----------------------------------------------------------------------------
+typedef void (*HANDLER_CALLBACK)();
+
+//-----------------------------------------------------------------------------
+// Receieves the call. This should be in a different process than the source
+//-----------------------------------------------------------------------------
+class IPCFuncCallHandler
+{
+public:
+ HRESULT InitFCHandler(HANDLER_CALLBACK pfnCallback, HANDLER_CALLBACK pfnCleanupCallback);
+ void TerminateFCHandler();
+ void WaitForShutdown();
+
+ IPCFuncCallHandler();
+ ~IPCFuncCallHandler();
+
+protected:
+ BOOL IsShutdownComplete();
+ void SafeCleanup();
+ HANDLE m_hStartEnum; // event to notify start call
+ HANDLE m_hDoneEnum; // event to notify end call
+
+ Volatile<HANDLE> m_hAuxThread; // thread to listen for m_hStartEnum
+
+ HANDLER_CALLBACK m_pfnCallback;
+ HANDLER_CALLBACK m_pfnCleanupCallback;
+
+ Volatile<BOOL> m_fShutdownAuxThread; // flag the Aux thread to finish up gracefully
+ HANDLE m_hShutdownThread; // Event to signal the Aux thread to finish up gracefully
+
+ HMODULE m_hCallbackModule; // Hold the module's ref to make sure that the
+ // aux thread's code doesn't get unmapped.
+// Make auxthread our friend so he can access all our eventing objects
+ friend DWORD WINAPI HandlerAuxThreadProc(LPVOID);
+};
+
+
+#endif // _IPCFUNCCALLIMPL_H_
diff --git a/src/inc/ipcmanagerinterface.h b/src/inc/ipcmanagerinterface.h
new file mode 100644
index 0000000000..ef71371273
--- /dev/null
+++ b/src/inc/ipcmanagerinterface.h
@@ -0,0 +1,204 @@
+// 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.
+//*****************************************************************************
+// File: IPCManagerInterface.h
+//
+// Interface for InterProcess Communication with a COM+ process.
+//
+//*****************************************************************************
+
+
+#ifndef _IPCMANAGERINTERFACE_H_
+#define _IPCMANAGERINTERFACE_H_
+
+#include "../ipcman/ipcheader.h"
+
+struct PerfCounterIPCControlBlock;
+struct AppDomainEnumerationIPCBlock;
+
+#include "../ipcman/ipcmanagerimpl.h"
+
+// These are the right that we will give to the global section and global events used
+// in communicating between debugger and debugee
+//
+// SECTION_ALL_ACCESS is needed for the IPC block. Unfortunately, we DACL our events and
+// IPC block identically. Or this particular right does not need to bleed into here.
+//
+#define CLR_IPC_GENERIC_RIGHT (GENERIC_READ | GENERIC_WRITE | GENERIC_EXECUTE | STANDARD_RIGHTS_ALL | SECTION_ALL_ACCESS)
+
+//-----------------------------------------------------------------------------
+// Writer - create a COM+ IPC Block with security attributes.
+//-----------------------------------------------------------------------------
+class IPCWriterInterface : public IPCWriterImpl
+{
+public:
+
+ BOOL TryAllocBlock(DWORD numRetries);
+ BOOL TryFreeBlock();
+
+ //.............................................................................
+ // Creation / Destruction only on implementation
+ //.............................................................................
+ HRESULT Init();
+ void Terminate();
+
+ //.............................................................................
+ // Marks the data in the IPC block as initialized
+ //.............................................................................
+ void Publish();
+
+ //.............................................................................
+ // Accessor for the Perf block
+ //.............................................................................
+ PerfCounterIPCControlBlock * GetPerfBlock();
+
+ void DestroySecurityAttributes(SECURITY_ATTRIBUTES *pSA);
+
+#ifndef DACCESS_COMPILE
+
+ //.............................................................................
+ // Create the SxS Public IPC block.
+ //.............................................................................
+ HRESULT CreateSxSPublicBlockOnPid(DWORD PID);
+
+ //.............................................................................
+ // Open the SxS Public IPC block that has alread been created.
+ //.............................................................................
+ HRESULT OpenSxSPublicBlockOnPid(DWORD PID);
+
+ HRESULT GetSxSPublicSecurityAttributes(DWORD pid, SECURITY_ATTRIBUTES **ppSA);
+
+#endif
+
+ DWORD GetBlockTableSize();
+ PTR_VOID GetBlockTableStart();
+
+ /*********************************** LEGACY FUNCTIONS ***********************************
+ *
+ * Though newer versions of the runtime do not open the LegacyPrivate block or the LegacyPublic
+ * block, we need functionality in the reader to inspect the LegacyPrivate block and LegacyPublic
+ * block so reading data from older runtimes.
+ *
+ ****************************************************************************************/
+
+ //.............................................................................
+ // The AppDomain block resides within the LegacyPrivate IPC block.
+ //.............................................................................
+ AppDomainEnumerationIPCBlock * GetAppDomainBlock();
+
+ //.............................................................................
+ // Create the LegacyPrivate IPC block. If this fails because the IPC block has already been
+ // created by another module then the phInstIPCBlockOwner argument will be set to the
+ // HINSTANCE of the module that created the IPC block.
+ // Set inService to TRUE if creating from within a service on behalf of a process.
+ //.............................................................................
+ HRESULT CreateLegacyPrivateBlockTempV4OnPid(DWORD PID, BOOL inService, HINSTANCE *phInstIPCBlockOwner);
+
+ //.............................................................................
+ // Open the LegacyPrivate IPC block that has alread been created.
+ //.............................................................................
+ HRESULT OpenLegacyPrivateBlockOnPid(DWORD PID);
+
+ //.............................................................................
+ // ReDacl our LegacyPrivate block after it has been created.
+ //.............................................................................
+ HRESULT ReDaclLegacyPrivateBlock(PSECURITY_DESCRIPTOR pSecurityDescriptor);
+
+ //.............................................................................
+ // Accessors - return info from header -
+ // These functions work on LegacyPrivate Block
+ //.............................................................................
+ DWORD GetBlockSize();
+ PTR_VOID GetBlockStart();
+ PCWSTR GetInstancePath();
+};
+
+//-----------------------------------------------------------------------------
+// IPCReader class connects to a COM+ IPC block and reads from it
+// <TODO>@FUTURE - make global & private readers</TODO>
+//-----------------------------------------------------------------------------
+class IPCReaderInterface : public IPCReaderImpl
+{
+public:
+
+ void MakeInstanceName(const WCHAR * szProcessName, DWORD pid, DWORD runtimeId, SString & sName);
+ void MakeInstanceNameWhidbey(const WCHAR * szProcessName, DWORD pid, SString & sName);
+
+ BOOL TryOpenBlock(IPCHeaderReadHelper & readHelper, DWORD blockIndex);
+
+ //.............................................................................
+ // Create & Destroy
+ //.............................................................................
+ ~IPCReaderInterface();
+
+ HRESULT OpenLegacyPrivateBlockTempV4OnPid(DWORD pid);
+ HRESULT OpenLegacyPrivateBlockTempV4OnPid(DWORD pid, DWORD dwDesiredAccess);
+
+ HRESULT OpenLegacyPrivateBlockOnPid(DWORD pid);
+ HRESULT OpenLegacyPrivateBlockOnPid(DWORD pid, DWORD dwDesiredAccess);
+ HRESULT OpenLegacyPrivateBlockOnPidReadWrite(DWORD pid);
+ HRESULT OpenLegacyPrivateBlockOnPidReadOnly(DWORD pid);
+ void CloseLegacyPrivateBlock();
+
+#ifndef DACCESS_COMPILE
+ HRESULT OpenLegacyPublicBlockOnPid(DWORD pid);
+ HRESULT OpenLegacyPublicBlockOnPid(DWORD pid, DWORD dwDesiredAccess);
+ HRESULT OpenLegacyPublicBlockOnPidReadOnly(DWORD pid);
+ void CloseLegacyPublicBlock();
+
+ HRESULT OpenBlockTableOnPid(DWORD pid);
+ HRESULT OpenBlockTableOnPid(DWORD pid, DWORD dwDesiredAccess);
+ HRESULT OpenBlockTableOnPidReadOnly(DWORD pid);
+ void CloseBlockTable();
+#endif
+
+ //.............................................................................
+ // Accessors - return info from header
+ // <TODO>@FUTURE - factor this into IPCWriterInterface as well.</TODO>
+ //.............................................................................
+ USHORT GetBlockVersion();
+ USHORT GetLegacyPublicBlockVersion();
+ HINSTANCE GetInstance();
+ USHORT GetBuildYear();
+ USHORT GetBuildNumber();
+ PVOID GetBlockStart();
+ PCWSTR GetInstancePath();
+
+ //........................................
+ // Check the block to see if its valid
+ //........................................
+ BOOL IsValidLegacy(BOOL fIsLegacyPublicBlock);
+
+#ifndef DACCESS_COMPILE
+ //BOOL IsValidForSxSPublic(IPCControlBlock * pBlock);
+#endif
+
+ //.............................................................................
+ // Get different sections of the IPC
+ //.............................................................................
+ void * GetLegacyPrivateBlock(ELegacyPrivateIPCClient eClient);
+ void * GetLegacyPublicBlock(ELegacyPublicIPCClient eClient);
+#ifndef DACCESS_COMPILE
+ //void * GetSxSPublicBlock(DWORD chunkIndex, EIPCClient eClient);
+#endif
+
+ void * GetPerfBlockLegacyPrivate();
+ void * GetPerfBlockLegacyPublic();
+#ifndef DACCESS_COMPILE
+ //PerfCounterIPCControlBlock * GetPerfBlockSxSPublic(DWORD chunkIndex);
+#endif
+ AppDomainEnumerationIPCBlock * GetAppDomainBlock();
+
+ //.............................................................................
+ // Return true if we're connected to a memory-mapped file, else false.
+ //.............................................................................
+ bool IsLegacyPrivateBlockOpen() const;
+ bool IsLegacyPublicBlockOpen() const;
+ bool IsBlockTableOpen() const;
+
+ HRESULT IsCompatablePlatformForDebuggerAndDebuggee(DWORD pid, BOOL * pfCompatible);
+};
+
+#endif
+
diff --git a/src/inc/isolation.h b/src/inc/isolation.h
new file mode 100644
index 0000000000..04fe165319
--- /dev/null
+++ b/src/inc/isolation.h
@@ -0,0 +1,2577 @@
+// 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.
+
+/* verify that the <rpcndr.h> version is high enough to compile this file*/
+#ifndef __REQUIRED_RPCNDR_H_VERSION__
+#define __REQUIRED_RPCNDR_H_VERSION__ 475
+#endif
+
+#include <specstrings.h>
+
+#include "rpc.h"
+#include "rpcndr.h"
+
+#ifndef __RPCNDR_H_VERSION__
+#error this stub requires an updated version of <rpcndr.h>
+#endif // __RPCNDR_H_VERSION__
+
+#ifndef COM_NO_WINDOWS_H
+#include "windows.h"
+#include "ole2.h"
+#endif /*COM_NO_WINDOWS_H*/
+
+#ifndef __isolation_h__
+#define __isolation_h__
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+#pragma once
+#endif
+
+/* Forward Declarations */
+
+#ifndef __IReferenceIdentity_FWD_DEFINED__
+#define __IReferenceIdentity_FWD_DEFINED__
+typedef interface IReferenceIdentity IReferenceIdentity;
+#endif /* __IReferenceIdentity_FWD_DEFINED__ */
+
+
+#ifndef __IDefinitionIdentity_FWD_DEFINED__
+#define __IDefinitionIdentity_FWD_DEFINED__
+typedef interface IDefinitionIdentity IDefinitionIdentity;
+#endif /* __IDefinitionIdentity_FWD_DEFINED__ */
+
+
+#ifndef __IEnumIDENTITY_ATTRIBUTE_FWD_DEFINED__
+#define __IEnumIDENTITY_ATTRIBUTE_FWD_DEFINED__
+typedef interface IEnumIDENTITY_ATTRIBUTE IEnumIDENTITY_ATTRIBUTE;
+#endif /* __IEnumIDENTITY_ATTRIBUTE_FWD_DEFINED__ */
+
+
+#ifndef __IEnumDefinitionIdentity_FWD_DEFINED__
+#define __IEnumDefinitionIdentity_FWD_DEFINED__
+typedef interface IEnumDefinitionIdentity IEnumDefinitionIdentity;
+#endif /* __IEnumDefinitionIdentity_FWD_DEFINED__ */
+
+
+#ifndef __IEnumReferenceIdentity_FWD_DEFINED__
+#define __IEnumReferenceIdentity_FWD_DEFINED__
+typedef interface IEnumReferenceIdentity IEnumReferenceIdentity;
+#endif /* __IEnumReferenceIdentity_FWD_DEFINED__ */
+
+
+#ifndef __IDefinitionAppId_FWD_DEFINED__
+#define __IDefinitionAppId_FWD_DEFINED__
+typedef interface IDefinitionAppId IDefinitionAppId;
+#endif /* __IDefinitionAppId_FWD_DEFINED__ */
+
+
+#ifndef __IReferenceAppId_FWD_DEFINED__
+#define __IReferenceAppId_FWD_DEFINED__
+typedef interface IReferenceAppId IReferenceAppId;
+#endif /* __IReferenceAppId_FWD_DEFINED__ */
+
+
+#ifndef __IIdentityAuthority_FWD_DEFINED__
+#define __IIdentityAuthority_FWD_DEFINED__
+typedef interface IIdentityAuthority IIdentityAuthority;
+#endif /* __IIdentityAuthority_FWD_DEFINED__ */
+
+
+#ifndef __IAppIdAuthority_FWD_DEFINED__
+#define __IAppIdAuthority_FWD_DEFINED__
+typedef interface IAppIdAuthority IAppIdAuthority;
+#endif /* __IAppIdAuthority_FWD_DEFINED__ */
+
+
+#ifndef __IIdentityAuthority_FWD_DEFINED__
+#define __IIdentityAuthority_FWD_DEFINED__
+typedef interface IIdentityAuthority IIdentityAuthority;
+#endif /* __IIdentityAuthority_FWD_DEFINED__ */
+
+
+#ifndef __IAppIdAuthority_FWD_DEFINED__
+#define __IAppIdAuthority_FWD_DEFINED__
+typedef interface IAppIdAuthority IAppIdAuthority;
+#endif /* __IAppIdAuthority_FWD_DEFINED__ */
+
+
+#ifndef __IDefinitionIdentity_FWD_DEFINED__
+#define __IDefinitionIdentity_FWD_DEFINED__
+typedef interface IDefinitionIdentity IDefinitionIdentity;
+#endif /* __IDefinitionIdentity_FWD_DEFINED__ */
+
+
+#ifndef __IReferenceIdentity_FWD_DEFINED__
+#define __IReferenceIdentity_FWD_DEFINED__
+typedef interface IReferenceIdentity IReferenceIdentity;
+#endif /* __IReferenceIdentity_FWD_DEFINED__ */
+
+
+#ifndef __IDefinitionAppId_FWD_DEFINED__
+#define __IDefinitionAppId_FWD_DEFINED__
+typedef interface IDefinitionAppId IDefinitionAppId;
+#endif /* __IDefinitionAppId_FWD_DEFINED__ */
+
+
+#ifndef __IReferenceAppId_FWD_DEFINED__
+#define __IReferenceAppId_FWD_DEFINED__
+typedef interface IReferenceAppId IReferenceAppId;
+#endif /* __IReferenceAppId_FWD_DEFINED__ */
+
+
+#ifndef __IEnumIDENTITY_ATTRIBUTE_FWD_DEFINED__
+#define __IEnumIDENTITY_ATTRIBUTE_FWD_DEFINED__
+typedef interface IEnumIDENTITY_ATTRIBUTE IEnumIDENTITY_ATTRIBUTE;
+#endif /* __IEnumIDENTITY_ATTRIBUTE_FWD_DEFINED__ */
+
+
+#ifndef __IEnumDefinitionIdentity_FWD_DEFINED__
+#define __IEnumDefinitionIdentity_FWD_DEFINED__
+typedef interface IEnumDefinitionIdentity IEnumDefinitionIdentity;
+#endif /* __IEnumDefinitionIdentity_FWD_DEFINED__ */
+
+
+#ifndef __IEnumReferenceIdentity_FWD_DEFINED__
+#define __IEnumReferenceIdentity_FWD_DEFINED__
+typedef interface IEnumReferenceIdentity IEnumReferenceIdentity;
+#endif /* __IEnumReferenceIdentity_FWD_DEFINED__ */
+
+
+/* header files for imported files */
+#include "unknwn.h"
+#include "oaidl.h"
+#include "ocidl.h"
+#include "propidl.h"
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+_Success_(return != NULL)
+_Ret_maybenull_
+_Post_writable_byte_size_(size)
+void * __RPC_USER MIDL_user_allocate(size_t size);
+#pragma warning(suppress: 4985) // Windows annotates with declspecs
+
+
+typedef struct _IDENTITY_ATTRIBUTE
+ {
+ LPCWSTR pszNamespace;
+ LPCWSTR pszName;
+ LPCWSTR pszValue;
+ } IDENTITY_ATTRIBUTE;
+
+typedef struct _IDENTITY_ATTRIBUTE *PIDENTITY_ATTRIBUTE;
+
+typedef const IDENTITY_ATTRIBUTE *PCIDENTITY_ATTRIBUTE;
+
+
+#ifndef __IReferenceIdentity_INTERFACE_DEFINED__
+#define __IReferenceIdentity_INTERFACE_DEFINED__
+
+/* interface IReferenceIdentity */
+/* [local][unique][uuid][object] */
+
+
+EXTERN_C const IID IID_IReferenceIdentity;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("6eaf5ace-7917-4f3c-b129-e046a9704766")
+ IReferenceIdentity : public IUnknown
+ {
+ public:
+ virtual HRESULT STDMETHODCALLTYPE GetAttribute(
+ /* [unique][in] */ LPCWSTR pszNamespace,
+ /* [in] */ LPCWSTR pszName,
+ /* [retval][out] */ LPWSTR *ppszValue) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE SetAttribute(
+ /* [unique][in] */ LPCWSTR pszNamespace,
+ /* [in] */ LPCWSTR pszName,
+ /* [unique][in] */ LPCWSTR pszValue) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE EnumAttributes(
+ /* [retval][out] */ IEnumIDENTITY_ATTRIBUTE **ppIEnumIDENTITY_ATTRIBUTE) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Clone(
+ /* [in] */ SIZE_T cDeltas,
+ /* [size_is][in] */ const IDENTITY_ATTRIBUTE rgDeltas[ ],
+ /* [retval][out] */ IReferenceIdentity **ppIReferenceIdentity) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IReferenceIdentityVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IReferenceIdentity * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IReferenceIdentity * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IReferenceIdentity * This);
+
+ HRESULT ( STDMETHODCALLTYPE *GetAttribute )(
+ IReferenceIdentity * This,
+ /* [unique][in] */ LPCWSTR pszNamespace,
+ /* [in] */ LPCWSTR pszName,
+ /* [retval][out] */ LPWSTR *ppszValue);
+
+ HRESULT ( STDMETHODCALLTYPE *SetAttribute )(
+ IReferenceIdentity * This,
+ /* [unique][in] */ LPCWSTR pszNamespace,
+ /* [in] */ LPCWSTR pszName,
+ /* [unique][in] */ LPCWSTR pszValue);
+
+ HRESULT ( STDMETHODCALLTYPE *EnumAttributes )(
+ IReferenceIdentity * This,
+ /* [retval][out] */ IEnumIDENTITY_ATTRIBUTE **ppIEnumIDENTITY_ATTRIBUTE);
+
+ HRESULT ( STDMETHODCALLTYPE *Clone )(
+ IReferenceIdentity * This,
+ /* [in] */ SIZE_T cDeltas,
+ /* [size_is][in] */ const IDENTITY_ATTRIBUTE rgDeltas[ ],
+ /* [retval][out] */ IReferenceIdentity **ppIReferenceIdentity);
+
+ END_INTERFACE
+ } IReferenceIdentityVtbl;
+
+ interface IReferenceIdentity
+ {
+ CONST_VTBL struct IReferenceIdentityVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IReferenceIdentity_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IReferenceIdentity_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IReferenceIdentity_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IReferenceIdentity_GetAttribute(This,pszNamespace,pszName,ppszValue) \
+ (This)->lpVtbl -> GetAttribute(This,pszNamespace,pszName,ppszValue)
+
+#define IReferenceIdentity_SetAttribute(This,pszNamespace,pszName,pszValue) \
+ (This)->lpVtbl -> SetAttribute(This,pszNamespace,pszName,pszValue)
+
+#define IReferenceIdentity_EnumAttributes(This,ppIEnumIDENTITY_ATTRIBUTE) \
+ (This)->lpVtbl -> EnumAttributes(This,ppIEnumIDENTITY_ATTRIBUTE)
+
+#define IReferenceIdentity_Clone(This,cDeltas,rgDeltas,ppIReferenceIdentity) \
+ (This)->lpVtbl -> Clone(This,cDeltas,rgDeltas,ppIReferenceIdentity)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+HRESULT STDMETHODCALLTYPE IReferenceIdentity_GetAttribute_Proxy(
+ IReferenceIdentity * This,
+ /* [unique][in] */ LPCWSTR pszNamespace,
+ /* [in] */ LPCWSTR pszName,
+ /* [retval][out] */ LPWSTR *ppszValue);
+
+
+void __RPC_STUB IReferenceIdentity_GetAttribute_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IReferenceIdentity_SetAttribute_Proxy(
+ IReferenceIdentity * This,
+ /* [unique][in] */ LPCWSTR pszNamespace,
+ /* [in] */ LPCWSTR pszName,
+ /* [unique][in] */ LPCWSTR pszValue);
+
+
+void __RPC_STUB IReferenceIdentity_SetAttribute_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IReferenceIdentity_EnumAttributes_Proxy(
+ IReferenceIdentity * This,
+ /* [retval][out] */ IEnumIDENTITY_ATTRIBUTE **ppIEnumIDENTITY_ATTRIBUTE);
+
+
+void __RPC_STUB IReferenceIdentity_EnumAttributes_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IReferenceIdentity_Clone_Proxy(
+ IReferenceIdentity * This,
+ /* [in] */ SIZE_T cDeltas,
+ /* [size_is][in] */ const IDENTITY_ATTRIBUTE rgDeltas[ ],
+ /* [retval][out] */ IReferenceIdentity **ppIReferenceIdentity);
+
+
+void __RPC_STUB IReferenceIdentity_Clone_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IReferenceIdentity_INTERFACE_DEFINED__ */
+
+
+#ifndef __IDefinitionIdentity_INTERFACE_DEFINED__
+#define __IDefinitionIdentity_INTERFACE_DEFINED__
+
+/* interface IDefinitionIdentity */
+/* [local][unique][uuid][object] */
+
+
+EXTERN_C const IID IID_IDefinitionIdentity;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("587bf538-4d90-4a3c-9ef1-58a200a8a9e7")
+ IDefinitionIdentity : public IUnknown
+ {
+ public:
+ virtual HRESULT STDMETHODCALLTYPE GetAttribute(
+ /* [unique][in] */ LPCWSTR pszNamespace,
+ /* [in] */ LPCWSTR pszName,
+ /* [retval][out] */ LPWSTR *ppszValue) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE SetAttribute(
+ /* [unique][in] */ LPCWSTR pszNamespace,
+ /* [in] */ LPCWSTR pszName,
+ /* [unique][in] */ LPCWSTR pszValue) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE EnumAttributes(
+ /* [retval][out] */ IEnumIDENTITY_ATTRIBUTE **ppIEAIA) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Clone(
+ /* [in] */ SIZE_T cDeltas,
+ /* [size_is][in] */ const IDENTITY_ATTRIBUTE prgDeltas[ ],
+ /* [retval][out] */ IDefinitionIdentity **ppIDefinitionIdentity) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IDefinitionIdentityVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IDefinitionIdentity * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IDefinitionIdentity * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IDefinitionIdentity * This);
+
+ HRESULT ( STDMETHODCALLTYPE *GetAttribute )(
+ IDefinitionIdentity * This,
+ /* [unique][in] */ LPCWSTR pszNamespace,
+ /* [in] */ LPCWSTR pszName,
+ /* [retval][out] */ LPWSTR *ppszValue);
+
+ HRESULT ( STDMETHODCALLTYPE *SetAttribute )(
+ IDefinitionIdentity * This,
+ /* [unique][in] */ LPCWSTR pszNamespace,
+ /* [in] */ LPCWSTR pszName,
+ /* [unique][in] */ LPCWSTR pszValue);
+
+ HRESULT ( STDMETHODCALLTYPE *EnumAttributes )(
+ IDefinitionIdentity * This,
+ /* [retval][out] */ IEnumIDENTITY_ATTRIBUTE **ppIEAIA);
+
+ HRESULT ( STDMETHODCALLTYPE *Clone )(
+ IDefinitionIdentity * This,
+ /* [in] */ SIZE_T cDeltas,
+ /* [size_is][in] */ const IDENTITY_ATTRIBUTE prgDeltas[ ],
+ /* [retval][out] */ IDefinitionIdentity **ppIDefinitionIdentity);
+
+ END_INTERFACE
+ } IDefinitionIdentityVtbl;
+
+ interface IDefinitionIdentity
+ {
+ CONST_VTBL struct IDefinitionIdentityVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IDefinitionIdentity_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IDefinitionIdentity_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IDefinitionIdentity_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IDefinitionIdentity_GetAttribute(This,pszNamespace,pszName,ppszValue) \
+ (This)->lpVtbl -> GetAttribute(This,pszNamespace,pszName,ppszValue)
+
+#define IDefinitionIdentity_SetAttribute(This,pszNamespace,pszName,pszValue) \
+ (This)->lpVtbl -> SetAttribute(This,pszNamespace,pszName,pszValue)
+
+#define IDefinitionIdentity_EnumAttributes(This,ppIEAIA) \
+ (This)->lpVtbl -> EnumAttributes(This,ppIEAIA)
+
+#define IDefinitionIdentity_Clone(This,cDeltas,prgDeltas,ppIDefinitionIdentity) \
+ (This)->lpVtbl -> Clone(This,cDeltas,prgDeltas,ppIDefinitionIdentity)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+HRESULT STDMETHODCALLTYPE IDefinitionIdentity_GetAttribute_Proxy(
+ IDefinitionIdentity * This,
+ /* [unique][in] */ LPCWSTR pszNamespace,
+ /* [in] */ LPCWSTR pszName,
+ /* [retval][out] */ LPWSTR *ppszValue);
+
+
+void __RPC_STUB IDefinitionIdentity_GetAttribute_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IDefinitionIdentity_SetAttribute_Proxy(
+ IDefinitionIdentity * This,
+ /* [unique][in] */ LPCWSTR pszNamespace,
+ /* [in] */ LPCWSTR pszName,
+ /* [unique][in] */ LPCWSTR pszValue);
+
+
+void __RPC_STUB IDefinitionIdentity_SetAttribute_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IDefinitionIdentity_EnumAttributes_Proxy(
+ IDefinitionIdentity * This,
+ /* [retval][out] */ IEnumIDENTITY_ATTRIBUTE **ppIEAIA);
+
+
+void __RPC_STUB IDefinitionIdentity_EnumAttributes_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IDefinitionIdentity_Clone_Proxy(
+ IDefinitionIdentity * This,
+ /* [in] */ SIZE_T cDeltas,
+ /* [size_is][in] */ const IDENTITY_ATTRIBUTE prgDeltas[ ],
+ /* [retval][out] */ IDefinitionIdentity **ppIDefinitionIdentity);
+
+
+void __RPC_STUB IDefinitionIdentity_Clone_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IDefinitionIdentity_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_isolation_0320 */
+/* [local] */
+
+typedef struct _IDENTITY_ATTRIBUTE_BLOB
+ {
+ DWORD ofsNamespace;
+ DWORD ofsName;
+ DWORD ofsValue;
+ } IDENTITY_ATTRIBUTE_BLOB;
+
+typedef struct _IDENTITY_ATTRIBUTE_BLOB *PIDENTITY_ATTRIBUTE_BLOB;
+
+
+
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0320_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0320_v0_0_s_ifspec;
+
+#ifndef __IEnumIDENTITY_ATTRIBUTE_INTERFACE_DEFINED__
+#define __IEnumIDENTITY_ATTRIBUTE_INTERFACE_DEFINED__
+
+/* interface IEnumIDENTITY_ATTRIBUTE */
+/* [local][unique][uuid][object] */
+
+
+EXTERN_C const IID IID_IEnumIDENTITY_ATTRIBUTE;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("9cdaae75-246e-4b00-a26d-b9aec137a3eb")
+ IEnumIDENTITY_ATTRIBUTE : public IUnknown
+ {
+ public:
+ virtual HRESULT STDMETHODCALLTYPE Next(
+ /* [in] */ ULONG celt,
+ /* [length_is][size_is][out] */ IDENTITY_ATTRIBUTE rgAttributes[ ],
+ /* [optional][out] */ ULONG *pceltWritten) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE CurrentIntoBuffer(
+ /* [in] */ SIZE_T cbAvailable,
+ /* [length_is][size_is][out][in] */ BYTE pbData[ ],
+ /* [out] */ SIZE_T *pcbUsed) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Skip(
+ /* [in] */ ULONG celt) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Reset( void) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Clone(
+ /* [out] */ IEnumIDENTITY_ATTRIBUTE **ppIEnumIDENTITY_ATTRIBUTE) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IEnumIDENTITY_ATTRIBUTEVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IEnumIDENTITY_ATTRIBUTE * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IEnumIDENTITY_ATTRIBUTE * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IEnumIDENTITY_ATTRIBUTE * This);
+
+ HRESULT ( STDMETHODCALLTYPE *Next )(
+ IEnumIDENTITY_ATTRIBUTE * This,
+ /* [in] */ ULONG celt,
+ /* [length_is][size_is][out] */ IDENTITY_ATTRIBUTE rgAttributes[ ],
+ /* [optional][out] */ ULONG *pceltWritten);
+
+ HRESULT ( STDMETHODCALLTYPE *CurrentIntoBuffer )(
+ IEnumIDENTITY_ATTRIBUTE * This,
+ /* [in] */ SIZE_T cbAvailable,
+ /* [length_is][size_is][out][in] */ BYTE pbData[ ],
+ /* [out] */ SIZE_T *pcbUsed);
+
+ HRESULT ( STDMETHODCALLTYPE *Skip )(
+ IEnumIDENTITY_ATTRIBUTE * This,
+ /* [in] */ ULONG celt);
+
+ HRESULT ( STDMETHODCALLTYPE *Reset )(
+ IEnumIDENTITY_ATTRIBUTE * This);
+
+ HRESULT ( STDMETHODCALLTYPE *Clone )(
+ IEnumIDENTITY_ATTRIBUTE * This,
+ /* [out] */ IEnumIDENTITY_ATTRIBUTE **ppIEnumIDENTITY_ATTRIBUTE);
+
+ END_INTERFACE
+ } IEnumIDENTITY_ATTRIBUTEVtbl;
+
+ interface IEnumIDENTITY_ATTRIBUTE
+ {
+ CONST_VTBL struct IEnumIDENTITY_ATTRIBUTEVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IEnumIDENTITY_ATTRIBUTE_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IEnumIDENTITY_ATTRIBUTE_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IEnumIDENTITY_ATTRIBUTE_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IEnumIDENTITY_ATTRIBUTE_Next(This,celt,rgAttributes,pceltWritten) \
+ (This)->lpVtbl -> Next(This,celt,rgAttributes,pceltWritten)
+
+#define IEnumIDENTITY_ATTRIBUTE_CurrentIntoBuffer(This,cbAvailable,pbData,pcbUsed) \
+ (This)->lpVtbl -> CurrentIntoBuffer(This,cbAvailable,pbData,pcbUsed)
+
+#define IEnumIDENTITY_ATTRIBUTE_Skip(This,celt) \
+ (This)->lpVtbl -> Skip(This,celt)
+
+#define IEnumIDENTITY_ATTRIBUTE_Reset(This) \
+ (This)->lpVtbl -> Reset(This)
+
+#define IEnumIDENTITY_ATTRIBUTE_Clone(This,ppIEnumIDENTITY_ATTRIBUTE) \
+ (This)->lpVtbl -> Clone(This,ppIEnumIDENTITY_ATTRIBUTE)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+HRESULT STDMETHODCALLTYPE IEnumIDENTITY_ATTRIBUTE_Next_Proxy(
+ IEnumIDENTITY_ATTRIBUTE * This,
+ /* [in] */ ULONG celt,
+ /* [length_is][size_is][out] */ IDENTITY_ATTRIBUTE rgAttributes[ ],
+ /* [optional][out] */ ULONG *pceltWritten);
+
+
+void __RPC_STUB IEnumIDENTITY_ATTRIBUTE_Next_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IEnumIDENTITY_ATTRIBUTE_CurrentIntoBuffer_Proxy(
+ IEnumIDENTITY_ATTRIBUTE * This,
+ /* [in] */ SIZE_T cbAvailable,
+ /* [length_is][size_is][out][in] */ BYTE pbData[ ],
+ /* [out] */ SIZE_T *pcbUsed);
+
+
+void __RPC_STUB IEnumIDENTITY_ATTRIBUTE_CurrentIntoBuffer_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IEnumIDENTITY_ATTRIBUTE_Skip_Proxy(
+ IEnumIDENTITY_ATTRIBUTE * This,
+ /* [in] */ ULONG celt);
+
+
+void __RPC_STUB IEnumIDENTITY_ATTRIBUTE_Skip_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IEnumIDENTITY_ATTRIBUTE_Reset_Proxy(
+ IEnumIDENTITY_ATTRIBUTE * This);
+
+
+void __RPC_STUB IEnumIDENTITY_ATTRIBUTE_Reset_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IEnumIDENTITY_ATTRIBUTE_Clone_Proxy(
+ IEnumIDENTITY_ATTRIBUTE * This,
+ /* [out] */ IEnumIDENTITY_ATTRIBUTE **ppIEnumIDENTITY_ATTRIBUTE);
+
+
+void __RPC_STUB IEnumIDENTITY_ATTRIBUTE_Clone_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IEnumIDENTITY_ATTRIBUTE_INTERFACE_DEFINED__ */
+
+
+#ifndef __IEnumDefinitionIdentity_INTERFACE_DEFINED__
+#define __IEnumDefinitionIdentity_INTERFACE_DEFINED__
+
+/* interface IEnumDefinitionIdentity */
+/* [local][unique][uuid][object] */
+
+
+EXTERN_C const IID IID_IEnumDefinitionIdentity;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("f3549d9c-fc73-4793-9c00-1cd204254c0c")
+ IEnumDefinitionIdentity : public IUnknown
+ {
+ public:
+ virtual HRESULT STDMETHODCALLTYPE Next(
+ /* [in] */ ULONG celt,
+ /* [length_is][size_is][out] */ IDefinitionIdentity *rgpIDefinitionIdentity[ ],
+ /* [out] */ ULONG *pceltWritten) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Skip(
+ /* [in] */ ULONG celt) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Reset( void) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Clone(
+ /* [out] */ IEnumDefinitionIdentity **ppIEnumDefinitionIdentity) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IEnumDefinitionIdentityVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IEnumDefinitionIdentity * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IEnumDefinitionIdentity * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IEnumDefinitionIdentity * This);
+
+ HRESULT ( STDMETHODCALLTYPE *Next )(
+ IEnumDefinitionIdentity * This,
+ /* [in] */ ULONG celt,
+ /* [length_is][size_is][out] */ IDefinitionIdentity *rgpIDefinitionIdentity[ ],
+ /* [out] */ ULONG *pceltWritten);
+
+ HRESULT ( STDMETHODCALLTYPE *Skip )(
+ IEnumDefinitionIdentity * This,
+ /* [in] */ ULONG celt);
+
+ HRESULT ( STDMETHODCALLTYPE *Reset )(
+ IEnumDefinitionIdentity * This);
+
+ HRESULT ( STDMETHODCALLTYPE *Clone )(
+ IEnumDefinitionIdentity * This,
+ /* [out] */ IEnumDefinitionIdentity **ppIEnumDefinitionIdentity);
+
+ END_INTERFACE
+ } IEnumDefinitionIdentityVtbl;
+
+ interface IEnumDefinitionIdentity
+ {
+ CONST_VTBL struct IEnumDefinitionIdentityVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IEnumDefinitionIdentity_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IEnumDefinitionIdentity_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IEnumDefinitionIdentity_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IEnumDefinitionIdentity_Next(This,celt,rgpIDefinitionIdentity,pceltWritten) \
+ (This)->lpVtbl -> Next(This,celt,rgpIDefinitionIdentity,pceltWritten)
+
+#define IEnumDefinitionIdentity_Skip(This,celt) \
+ (This)->lpVtbl -> Skip(This,celt)
+
+#define IEnumDefinitionIdentity_Reset(This) \
+ (This)->lpVtbl -> Reset(This)
+
+#define IEnumDefinitionIdentity_Clone(This,ppIEnumDefinitionIdentity) \
+ (This)->lpVtbl -> Clone(This,ppIEnumDefinitionIdentity)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+HRESULT STDMETHODCALLTYPE IEnumDefinitionIdentity_Next_Proxy(
+ IEnumDefinitionIdentity * This,
+ /* [in] */ ULONG celt,
+ /* [length_is][size_is][out] */ IDefinitionIdentity *rgpIDefinitionIdentity[ ],
+ /* [out] */ ULONG *pceltWritten);
+
+
+void __RPC_STUB IEnumDefinitionIdentity_Next_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IEnumDefinitionIdentity_Skip_Proxy(
+ IEnumDefinitionIdentity * This,
+ /* [in] */ ULONG celt);
+
+
+void __RPC_STUB IEnumDefinitionIdentity_Skip_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IEnumDefinitionIdentity_Reset_Proxy(
+ IEnumDefinitionIdentity * This);
+
+
+void __RPC_STUB IEnumDefinitionIdentity_Reset_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IEnumDefinitionIdentity_Clone_Proxy(
+ IEnumDefinitionIdentity * This,
+ /* [out] */ IEnumDefinitionIdentity **ppIEnumDefinitionIdentity);
+
+
+void __RPC_STUB IEnumDefinitionIdentity_Clone_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IEnumDefinitionIdentity_INTERFACE_DEFINED__ */
+
+
+#ifndef __IEnumReferenceIdentity_INTERFACE_DEFINED__
+#define __IEnumReferenceIdentity_INTERFACE_DEFINED__
+
+/* interface IEnumReferenceIdentity */
+/* [local][unique][uuid][object] */
+
+
+EXTERN_C const IID IID_IEnumReferenceIdentity;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("b30352cf-23da-4577-9b3f-b4e6573be53b")
+ IEnumReferenceIdentity : public IUnknown
+ {
+ public:
+ virtual HRESULT STDMETHODCALLTYPE Next(
+ /* [in] */ ULONG celt,
+ /* [length_is][size_is][out] */ IReferenceIdentity **prgpIReferenceIdentity,
+ /* [out] */ ULONG *pceltWritten) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Skip(
+ ULONG celt) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Reset( void) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Clone(
+ IEnumReferenceIdentity **ppIEnumReferenceIdentity) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IEnumReferenceIdentityVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IEnumReferenceIdentity * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IEnumReferenceIdentity * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IEnumReferenceIdentity * This);
+
+ HRESULT ( STDMETHODCALLTYPE *Next )(
+ IEnumReferenceIdentity * This,
+ /* [in] */ ULONG celt,
+ /* [length_is][size_is][out] */ IReferenceIdentity **prgpIReferenceIdentity,
+ /* [out] */ ULONG *pceltWritten);
+
+ HRESULT ( STDMETHODCALLTYPE *Skip )(
+ IEnumReferenceIdentity * This,
+ ULONG celt);
+
+ HRESULT ( STDMETHODCALLTYPE *Reset )(
+ IEnumReferenceIdentity * This);
+
+ HRESULT ( STDMETHODCALLTYPE *Clone )(
+ IEnumReferenceIdentity * This,
+ IEnumReferenceIdentity **ppIEnumReferenceIdentity);
+
+ END_INTERFACE
+ } IEnumReferenceIdentityVtbl;
+
+ interface IEnumReferenceIdentity
+ {
+ CONST_VTBL struct IEnumReferenceIdentityVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IEnumReferenceIdentity_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IEnumReferenceIdentity_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IEnumReferenceIdentity_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IEnumReferenceIdentity_Next(This,celt,prgpIReferenceIdentity,pceltWritten) \
+ (This)->lpVtbl -> Next(This,celt,prgpIReferenceIdentity,pceltWritten)
+
+#define IEnumReferenceIdentity_Skip(This,celt) \
+ (This)->lpVtbl -> Skip(This,celt)
+
+#define IEnumReferenceIdentity_Reset(This) \
+ (This)->lpVtbl -> Reset(This)
+
+#define IEnumReferenceIdentity_Clone(This,ppIEnumReferenceIdentity) \
+ (This)->lpVtbl -> Clone(This,ppIEnumReferenceIdentity)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+HRESULT STDMETHODCALLTYPE IEnumReferenceIdentity_Next_Proxy(
+ IEnumReferenceIdentity * This,
+ /* [in] */ ULONG celt,
+ /* [length_is][size_is][out] */ IReferenceIdentity **prgpIReferenceIdentity,
+ /* [out] */ ULONG *pceltWritten);
+
+
+void __RPC_STUB IEnumReferenceIdentity_Next_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IEnumReferenceIdentity_Skip_Proxy(
+ IEnumReferenceIdentity * This,
+ ULONG celt);
+
+
+void __RPC_STUB IEnumReferenceIdentity_Skip_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IEnumReferenceIdentity_Reset_Proxy(
+ IEnumReferenceIdentity * This);
+
+
+void __RPC_STUB IEnumReferenceIdentity_Reset_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IEnumReferenceIdentity_Clone_Proxy(
+ IEnumReferenceIdentity * This,
+ IEnumReferenceIdentity **ppIEnumReferenceIdentity);
+
+
+void __RPC_STUB IEnumReferenceIdentity_Clone_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IEnumReferenceIdentity_INTERFACE_DEFINED__ */
+
+
+#ifndef __IDefinitionAppId_INTERFACE_DEFINED__
+#define __IDefinitionAppId_INTERFACE_DEFINED__
+
+/* interface IDefinitionAppId */
+/* [local][unique][uuid][object] */
+
+
+EXTERN_C const IID IID_IDefinitionAppId;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("d91e12d8-98ed-47fa-9936-39421283d59b")
+ IDefinitionAppId : public IUnknown
+ {
+ public:
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SubscriptionId(
+ /* [retval][out] */ LPWSTR *ppszSubscription) = 0;
+
+ virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_SubscriptionId(
+ /* [in] */ LPCWSTR pszSubscription) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Codebase(
+ /* [retval][out] */ LPWSTR *ppszCodebase) = 0;
+
+ virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_Codebase(
+ /* [in] */ LPCWSTR pszCodebase) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE EnumAppPath(
+ /* [out] */ IEnumDefinitionIdentity **ppIEnumDefinitionIdentity) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE SetAppPath(
+ /* [in] */ ULONG cIDefinitionIdentity,
+ /* [size_is][in] */ IDefinitionIdentity *rgIDefinitionIdentity[ ]) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IDefinitionAppIdVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IDefinitionAppId * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IDefinitionAppId * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IDefinitionAppId * This);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_SubscriptionId )(
+ IDefinitionAppId * This,
+ /* [retval][out] */ LPWSTR *ppszSubscription);
+
+ /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_SubscriptionId )(
+ IDefinitionAppId * This,
+ /* [in] */ LPCWSTR pszSubscription);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Codebase )(
+ IDefinitionAppId * This,
+ /* [retval][out] */ LPWSTR *ppszCodebase);
+
+ /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_Codebase )(
+ IDefinitionAppId * This,
+ /* [in] */ LPCWSTR pszCodebase);
+
+ HRESULT ( STDMETHODCALLTYPE *EnumAppPath )(
+ IDefinitionAppId * This,
+ /* [out] */ IEnumDefinitionIdentity **ppIEnumDefinitionIdentity);
+
+ HRESULT ( STDMETHODCALLTYPE *SetAppPath )(
+ IDefinitionAppId * This,
+ /* [in] */ ULONG cIDefinitionIdentity,
+ /* [size_is][in] */ IDefinitionIdentity *rgIDefinitionIdentity[ ]);
+
+ END_INTERFACE
+ } IDefinitionAppIdVtbl;
+
+ interface IDefinitionAppId
+ {
+ CONST_VTBL struct IDefinitionAppIdVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IDefinitionAppId_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IDefinitionAppId_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IDefinitionAppId_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IDefinitionAppId_get_SubscriptionId(This,ppszSubscription) \
+ (This)->lpVtbl -> get_SubscriptionId(This,ppszSubscription)
+
+#define IDefinitionAppId_put_SubscriptionId(This,pszSubscription) \
+ (This)->lpVtbl -> put_SubscriptionId(This,pszSubscription)
+
+#define IDefinitionAppId_get_Codebase(This,ppszCodebase) \
+ (This)->lpVtbl -> get_Codebase(This,ppszCodebase)
+
+#define IDefinitionAppId_put_Codebase(This,pszCodebase) \
+ (This)->lpVtbl -> put_Codebase(This,pszCodebase)
+
+#define IDefinitionAppId_EnumAppPath(This,ppIEnumDefinitionIdentity) \
+ (This)->lpVtbl -> EnumAppPath(This,ppIEnumDefinitionIdentity)
+
+#define IDefinitionAppId_SetAppPath(This,cIDefinitionIdentity,rgIDefinitionIdentity) \
+ (This)->lpVtbl -> SetAppPath(This,cIDefinitionIdentity,rgIDefinitionIdentity)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IDefinitionAppId_get_SubscriptionId_Proxy(
+ IDefinitionAppId * This,
+ /* [retval][out] */ LPWSTR *ppszSubscription);
+
+
+void __RPC_STUB IDefinitionAppId_get_SubscriptionId_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propput] */ HRESULT STDMETHODCALLTYPE IDefinitionAppId_put_SubscriptionId_Proxy(
+ IDefinitionAppId * This,
+ /* [in] */ LPCWSTR pszSubscription);
+
+
+void __RPC_STUB IDefinitionAppId_put_SubscriptionId_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IDefinitionAppId_get_Codebase_Proxy(
+ IDefinitionAppId * This,
+ /* [retval][out] */ _Outptr_result_maybenull_ LPWSTR *ppszCodebase);
+
+
+void __RPC_STUB IDefinitionAppId_get_Codebase_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propput] */ HRESULT STDMETHODCALLTYPE IDefinitionAppId_put_Codebase_Proxy(
+ IDefinitionAppId * This,
+ /* [in] */ LPCWSTR pszCodebase);
+
+
+void __RPC_STUB IDefinitionAppId_put_Codebase_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IDefinitionAppId_EnumAppPath_Proxy(
+ IDefinitionAppId * This,
+ /* [out] */ IEnumDefinitionIdentity **ppIEnumDefinitionIdentity);
+
+
+void __RPC_STUB IDefinitionAppId_EnumAppPath_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IDefinitionAppId_SetAppPath_Proxy(
+ IDefinitionAppId * This,
+ /* [in] */ ULONG cIDefinitionIdentity,
+ /* [size_is][in] */ IDefinitionIdentity *rgIDefinitionIdentity[ ]);
+
+
+void __RPC_STUB IDefinitionAppId_SetAppPath_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IDefinitionAppId_INTERFACE_DEFINED__ */
+
+
+#ifndef __IReferenceAppId_INTERFACE_DEFINED__
+#define __IReferenceAppId_INTERFACE_DEFINED__
+
+/* interface IReferenceAppId */
+/* [local][unique][uuid][object] */
+
+
+EXTERN_C const IID IID_IReferenceAppId;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("054f0bef-9e45-4363-8f5a-2f8e142d9a3b")
+ IReferenceAppId : public IUnknown
+ {
+ public:
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SubscriptionId(
+ /* [retval][out] */ LPWSTR *ppszSubscription) = 0;
+
+ virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_SubscriptionId(
+ /* [in] */ LPCWSTR pszSubscription) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Codebase(
+ /* [retval][out] */ LPWSTR *ppszCodebase) = 0;
+
+ virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_Codebase(
+ /* [in] */ LPCWSTR pszCodebase) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE EnumAppPath(
+ /* [out] */ IEnumReferenceIdentity **ppIReferenceAppId) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IReferenceAppIdVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IReferenceAppId * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IReferenceAppId * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IReferenceAppId * This);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_SubscriptionId )(
+ IReferenceAppId * This,
+ /* [retval][out] */ LPWSTR *ppszSubscription);
+
+ /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_SubscriptionId )(
+ IReferenceAppId * This,
+ /* [in] */ LPCWSTR pszSubscription);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Codebase )(
+ IReferenceAppId * This,
+ /* [retval][out] */ LPWSTR *ppszCodebase);
+
+ /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_Codebase )(
+ IReferenceAppId * This,
+ /* [in] */ LPCWSTR pszCodebase);
+
+ HRESULT ( STDMETHODCALLTYPE *EnumAppPath )(
+ IReferenceAppId * This,
+ /* [out] */ IEnumReferenceIdentity **ppIReferenceAppId);
+
+ END_INTERFACE
+ } IReferenceAppIdVtbl;
+
+ interface IReferenceAppId
+ {
+ CONST_VTBL struct IReferenceAppIdVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IReferenceAppId_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IReferenceAppId_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IReferenceAppId_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IReferenceAppId_get_SubscriptionId(This,ppszSubscription) \
+ (This)->lpVtbl -> get_SubscriptionId(This,ppszSubscription)
+
+#define IReferenceAppId_put_SubscriptionId(This,pszSubscription) \
+ (This)->lpVtbl -> put_SubscriptionId(This,pszSubscription)
+
+#define IReferenceAppId_get_Codebase(This,ppszCodebase) \
+ (This)->lpVtbl -> get_Codebase(This,ppszCodebase)
+
+#define IReferenceAppId_put_Codebase(This,pszCodebase) \
+ (This)->lpVtbl -> put_Codebase(This,pszCodebase)
+
+#define IReferenceAppId_EnumAppPath(This,ppIReferenceAppId) \
+ (This)->lpVtbl -> EnumAppPath(This,ppIReferenceAppId)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IReferenceAppId_get_SubscriptionId_Proxy(
+ IReferenceAppId * This,
+ /* [retval][out] */ LPWSTR *ppszSubscription);
+
+
+void __RPC_STUB IReferenceAppId_get_SubscriptionId_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propput] */ HRESULT STDMETHODCALLTYPE IReferenceAppId_put_SubscriptionId_Proxy(
+ IReferenceAppId * This,
+ /* [in] */ LPCWSTR pszSubscription);
+
+
+void __RPC_STUB IReferenceAppId_put_SubscriptionId_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IReferenceAppId_get_Codebase_Proxy(
+ IReferenceAppId * This,
+ /* [retval][out] */ _Outptr_result_maybenull_ LPWSTR *ppszCodebase);
+
+
+void __RPC_STUB IReferenceAppId_get_Codebase_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propput] */ HRESULT STDMETHODCALLTYPE IReferenceAppId_put_Codebase_Proxy(
+ IReferenceAppId * This,
+ /* [in] */ LPCWSTR pszCodebase);
+
+
+void __RPC_STUB IReferenceAppId_put_Codebase_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IReferenceAppId_EnumAppPath_Proxy(
+ IReferenceAppId * This,
+ /* [out] */ IEnumReferenceIdentity **ppIReferenceAppId);
+
+
+void __RPC_STUB IReferenceAppId_EnumAppPath_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IReferenceAppId_INTERFACE_DEFINED__ */
+
+
+#ifndef __IIdentityAuthority_INTERFACE_DEFINED__
+#define __IIdentityAuthority_INTERFACE_DEFINED__
+
+/* interface IIdentityAuthority */
+/* [local][unique][uuid][object] */
+
+/* [v1_enum] */
+enum _TEXT_TO_DEFINITION_IDENTITY_FLAGS
+ { TEXT_TO_DEFINITION_IDENTITY_FLAG_ALLOW_UNKNOWN_ATTRIBUTES_IN_NULL_NAMESPACE = 0x1
+ } ;
+/* [v1_enum] */
+enum _TEXT_TO_REFERENCE_IDENTITY_FLAGS
+ { TEXT_TO_REFERENCE_IDENTITY_FLAG_ALLOW_UNKNOWN_ATTRIBUTES_IN_NULL_NAMESPACE = 0x1
+ } ;
+/* [v1_enum] */
+enum _DEFINITION_IDENTITY_TO_TEXT_FLAGS
+ { DEFINITION_IDENTITY_TO_TEXT_FLAG_CANONICAL = 0x1
+ } ;
+/* [v1_enum] */
+enum _REFERENCE_IDENTITY_TO_TEXT_FLAGS
+ { REFERENCE_IDENTITY_TO_TEXT_FLAG_CANONICAL = 0x1
+ } ;
+/* [v1_enum] */
+enum _IIDENTITYAUTHORITY_DOES_DEFINITION_MATCH_REFERENCE_FLAGS
+ { IIDENTITYAUTHORITY_DOES_DEFINITION_MATCH_REFERENCE_FLAG_EXACT_MATCH_REQUIRED = 0x1
+ } ;
+/* [v1_enum] */
+enum _IIDENTITYAUTHORITY_DOES_TEXTUAL_DEFINITION_MATCH_TEXTUAL_REFERENCE_FLAGS
+ { IIDENTITYAUTHORITY_DOES_TEXTUAL_DEFINITION_MATCH_TEXTUAL_REFERENCE_FLAG_EXACT_MATCH_REQUIRED = 0x1
+ } ;
+
+EXTERN_C const IID IID_IIdentityAuthority;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("261a6983-c35d-4d0d-aa5b-7867259e77bc")
+ IIdentityAuthority : public IUnknown
+ {
+ public:
+ virtual HRESULT STDMETHODCALLTYPE TextToDefinition(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ LPCWSTR pszIdentity,
+ /* [out] */ IDefinitionIdentity **ppIDefinitionIdentity) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE TextToReference(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ LPCWSTR pszIdentity,
+ /* [out] */ IReferenceIdentity **ppIReferenceIdentity) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE DefinitionToText(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
+ /* [out] */ LPWSTR *ppszFormattedIdentity) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE DefinitionToTextBuffer(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
+ /* [in] */ ULONG cchBufferSize,
+ /* [length_is][size_is][out][in] */ WCHAR wchBuffer[ ],
+ /* [out] */ ULONG *pcchBufferRequired) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE ReferenceToText(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IReferenceIdentity *pIReferenceIdentity,
+ /* [out] */ LPWSTR *ppszFormattedIdentity) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE ReferenceToTextBuffer(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IReferenceIdentity *pIReferenceIdentity,
+ /* [in] */ ULONG cchBufferSize,
+ /* [length_is][size_is][out][in] */ WCHAR wchBuffer[ ],
+ /* [out] */ ULONG *pcchBufferRequired) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE AreDefinitionsEqual(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionIdentity *pDefinition1,
+ /* [in] */ IDefinitionIdentity *pDefinition2,
+ /* [out] */ BOOL *pfEqual) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE AreReferencesEqual(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IReferenceIdentity *pReference1,
+ /* [in] */ IReferenceIdentity *pReference2,
+ /* [out] */ BOOL *pfEqual) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE AreTextualDefinitionsEqual(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ LPCWSTR pszIdentityLeft,
+ /* [in] */ LPCWSTR pszIdentityRight,
+ /* [out] */ BOOL *pfEqual) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE AreTextualReferencesEqual(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ LPCWSTR pszIdentityLeft,
+ /* [in] */ LPCWSTR pszIdentityRight,
+ /* [out] */ BOOL *pfEqual) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE DoesDefinitionMatchReference(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
+ /* [in] */ IReferenceIdentity *pIReferenceIdentity,
+ /* [out] */ BOOL *pfMatches) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE DoesTextualDefinitionMatchTextualReference(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ LPCWSTR pszDefinition,
+ /* [in] */ LPCWSTR pszReference,
+ /* [out] */ BOOL *pfMatches) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE HashReference(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IReferenceIdentity *pIReferenceIdentity,
+ /* [out] */ ULONGLONG *pullPseudoKey) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE HashDefinition(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
+ /* [out] */ ULONGLONG *pullPseudoKey) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE GenerateDefinitionKey(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
+ /* [out] */ LPWSTR *ppszKeyForm) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE GenerateReferenceKey(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IReferenceIdentity *pIReferenceIdentity,
+ /* [out] */ LPWSTR *ppszKeyForm) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE CreateDefinition(
+ /* [retval][out] */ IDefinitionIdentity **ppNewIdentity) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE CreateReference(
+ /* [retval][out] */ IReferenceIdentity **ppNewIdentity) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IIdentityAuthorityVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IIdentityAuthority * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IIdentityAuthority * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IIdentityAuthority * This);
+
+ HRESULT ( STDMETHODCALLTYPE *TextToDefinition )(
+ IIdentityAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ LPCWSTR pszIdentity,
+ /* [out] */ IDefinitionIdentity **ppIDefinitionIdentity);
+
+ HRESULT ( STDMETHODCALLTYPE *TextToReference )(
+ IIdentityAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ LPCWSTR pszIdentity,
+ /* [out] */ IReferenceIdentity **ppIReferenceIdentity);
+
+ HRESULT ( STDMETHODCALLTYPE *DefinitionToText )(
+ IIdentityAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
+ /* [out] */ LPWSTR *ppszFormattedIdentity);
+
+ HRESULT ( STDMETHODCALLTYPE *DefinitionToTextBuffer )(
+ IIdentityAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
+ /* [in] */ ULONG cchBufferSize,
+ /* [length_is][size_is][out][in] */ WCHAR wchBuffer[ ],
+ /* [out] */ ULONG *pcchBufferRequired);
+
+ HRESULT ( STDMETHODCALLTYPE *ReferenceToText )(
+ IIdentityAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IReferenceIdentity *pIReferenceIdentity,
+ /* [out] */ LPWSTR *ppszFormattedIdentity);
+
+ HRESULT ( STDMETHODCALLTYPE *ReferenceToTextBuffer )(
+ IIdentityAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IReferenceIdentity *pIReferenceIdentity,
+ /* [in] */ ULONG cchBufferSize,
+ /* [length_is][size_is][out][in] */ WCHAR wchBuffer[ ],
+ /* [out] */ ULONG *pcchBufferRequired);
+
+ HRESULT ( STDMETHODCALLTYPE *AreDefinitionsEqual )(
+ IIdentityAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionIdentity *pDefinition1,
+ /* [in] */ IDefinitionIdentity *pDefinition2,
+ /* [out] */ BOOL *pfEqual);
+
+ HRESULT ( STDMETHODCALLTYPE *AreReferencesEqual )(
+ IIdentityAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IReferenceIdentity *pReference1,
+ /* [in] */ IReferenceIdentity *pReference2,
+ /* [out] */ BOOL *pfEqual);
+
+ HRESULT ( STDMETHODCALLTYPE *AreTextualDefinitionsEqual )(
+ IIdentityAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ LPCWSTR pszIdentityLeft,
+ /* [in] */ LPCWSTR pszIdentityRight,
+ /* [out] */ BOOL *pfEqual);
+
+ HRESULT ( STDMETHODCALLTYPE *AreTextualReferencesEqual )(
+ IIdentityAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ LPCWSTR pszIdentityLeft,
+ /* [in] */ LPCWSTR pszIdentityRight,
+ /* [out] */ BOOL *pfEqual);
+
+ HRESULT ( STDMETHODCALLTYPE *DoesDefinitionMatchReference )(
+ IIdentityAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
+ /* [in] */ IReferenceIdentity *pIReferenceIdentity,
+ /* [out] */ BOOL *pfMatches);
+
+ HRESULT ( STDMETHODCALLTYPE *DoesTextualDefinitionMatchTextualReference )(
+ IIdentityAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ LPCWSTR pszDefinition,
+ /* [in] */ LPCWSTR pszReference,
+ /* [out] */ BOOL *pfMatches);
+
+ HRESULT ( STDMETHODCALLTYPE *HashReference )(
+ IIdentityAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IReferenceIdentity *pIReferenceIdentity,
+ /* [out] */ ULONGLONG *pullPseudoKey);
+
+ HRESULT ( STDMETHODCALLTYPE *HashDefinition )(
+ IIdentityAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
+ /* [out] */ ULONGLONG *pullPseudoKey);
+
+ HRESULT ( STDMETHODCALLTYPE *GenerateDefinitionKey )(
+ IIdentityAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
+ /* [out] */ LPWSTR *ppszKeyForm);
+
+ HRESULT ( STDMETHODCALLTYPE *GenerateReferenceKey )(
+ IIdentityAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IReferenceIdentity *pIReferenceIdentity,
+ /* [out] */ LPWSTR *ppszKeyForm);
+
+ HRESULT ( STDMETHODCALLTYPE *CreateDefinition )(
+ IIdentityAuthority * This,
+ /* [retval][out] */ IDefinitionIdentity **ppNewIdentity);
+
+ HRESULT ( STDMETHODCALLTYPE *CreateReference )(
+ IIdentityAuthority * This,
+ /* [retval][out] */ IReferenceIdentity **ppNewIdentity);
+
+ END_INTERFACE
+ } IIdentityAuthorityVtbl;
+
+ interface IIdentityAuthority
+ {
+ CONST_VTBL struct IIdentityAuthorityVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IIdentityAuthority_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IIdentityAuthority_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IIdentityAuthority_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IIdentityAuthority_TextToDefinition(This,dwFlags,pszIdentity,ppIDefinitionIdentity) \
+ (This)->lpVtbl -> TextToDefinition(This,dwFlags,pszIdentity,ppIDefinitionIdentity)
+
+#define IIdentityAuthority_TextToReference(This,dwFlags,pszIdentity,ppIReferenceIdentity) \
+ (This)->lpVtbl -> TextToReference(This,dwFlags,pszIdentity,ppIReferenceIdentity)
+
+#define IIdentityAuthority_DefinitionToText(This,dwFlags,pIDefinitionIdentity,ppszFormattedIdentity) \
+ (This)->lpVtbl -> DefinitionToText(This,dwFlags,pIDefinitionIdentity,ppszFormattedIdentity)
+
+#define IIdentityAuthority_DefinitionToTextBuffer(This,dwFlags,pIDefinitionIdentity,cchBufferSize,wchBuffer,pcchBufferRequired) \
+ (This)->lpVtbl -> DefinitionToTextBuffer(This,dwFlags,pIDefinitionIdentity,cchBufferSize,wchBuffer,pcchBufferRequired)
+
+#define IIdentityAuthority_ReferenceToText(This,dwFlags,pIReferenceIdentity,ppszFormattedIdentity) \
+ (This)->lpVtbl -> ReferenceToText(This,dwFlags,pIReferenceIdentity,ppszFormattedIdentity)
+
+#define IIdentityAuthority_ReferenceToTextBuffer(This,dwFlags,pIReferenceIdentity,cchBufferSize,wchBuffer,pcchBufferRequired) \
+ (This)->lpVtbl -> ReferenceToTextBuffer(This,dwFlags,pIReferenceIdentity,cchBufferSize,wchBuffer,pcchBufferRequired)
+
+#define IIdentityAuthority_AreDefinitionsEqual(This,dwFlags,pDefinition1,pDefinition2,pfEqual) \
+ (This)->lpVtbl -> AreDefinitionsEqual(This,dwFlags,pDefinition1,pDefinition2,pfEqual)
+
+#define IIdentityAuthority_AreReferencesEqual(This,dwFlags,pReference1,pReference2,pfEqual) \
+ (This)->lpVtbl -> AreReferencesEqual(This,dwFlags,pReference1,pReference2,pfEqual)
+
+#define IIdentityAuthority_AreTextualDefinitionsEqual(This,dwFlags,pszIdentityLeft,pszIdentityRight,pfEqual) \
+ (This)->lpVtbl -> AreTextualDefinitionsEqual(This,dwFlags,pszIdentityLeft,pszIdentityRight,pfEqual)
+
+#define IIdentityAuthority_AreTextualReferencesEqual(This,dwFlags,pszIdentityLeft,pszIdentityRight,pfEqual) \
+ (This)->lpVtbl -> AreTextualReferencesEqual(This,dwFlags,pszIdentityLeft,pszIdentityRight,pfEqual)
+
+#define IIdentityAuthority_DoesDefinitionMatchReference(This,dwFlags,pIDefinitionIdentity,pIReferenceIdentity,pfMatches) \
+ (This)->lpVtbl -> DoesDefinitionMatchReference(This,dwFlags,pIDefinitionIdentity,pIReferenceIdentity,pfMatches)
+
+#define IIdentityAuthority_DoesTextualDefinitionMatchTextualReference(This,dwFlags,pszDefinition,pszReference,pfMatches) \
+ (This)->lpVtbl -> DoesTextualDefinitionMatchTextualReference(This,dwFlags,pszDefinition,pszReference,pfMatches)
+
+#define IIdentityAuthority_HashReference(This,dwFlags,pIReferenceIdentity,pullPseudoKey) \
+ (This)->lpVtbl -> HashReference(This,dwFlags,pIReferenceIdentity,pullPseudoKey)
+
+#define IIdentityAuthority_HashDefinition(This,dwFlags,pIDefinitionIdentity,pullPseudoKey) \
+ (This)->lpVtbl -> HashDefinition(This,dwFlags,pIDefinitionIdentity,pullPseudoKey)
+
+#define IIdentityAuthority_GenerateDefinitionKey(This,dwFlags,pIDefinitionIdentity,ppszKeyForm) \
+ (This)->lpVtbl -> GenerateDefinitionKey(This,dwFlags,pIDefinitionIdentity,ppszKeyForm)
+
+#define IIdentityAuthority_GenerateReferenceKey(This,dwFlags,pIReferenceIdentity,ppszKeyForm) \
+ (This)->lpVtbl -> GenerateReferenceKey(This,dwFlags,pIReferenceIdentity,ppszKeyForm)
+
+#define IIdentityAuthority_CreateDefinition(This,ppNewIdentity) \
+ (This)->lpVtbl -> CreateDefinition(This,ppNewIdentity)
+
+#define IIdentityAuthority_CreateReference(This,ppNewIdentity) \
+ (This)->lpVtbl -> CreateReference(This,ppNewIdentity)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+HRESULT STDMETHODCALLTYPE IIdentityAuthority_TextToDefinition_Proxy(
+ IIdentityAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ LPCWSTR pszIdentity,
+ /* [out] */ IDefinitionIdentity **ppIDefinitionIdentity);
+
+
+void __RPC_STUB IIdentityAuthority_TextToDefinition_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IIdentityAuthority_TextToReference_Proxy(
+ IIdentityAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ LPCWSTR pszIdentity,
+ /* [out] */ IReferenceIdentity **ppIReferenceIdentity);
+
+
+void __RPC_STUB IIdentityAuthority_TextToReference_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IIdentityAuthority_DefinitionToText_Proxy(
+ IIdentityAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
+ /* [out] */ _Outptr_result_maybenull_ LPWSTR *ppszFormattedIdentity);
+
+
+void __RPC_STUB IIdentityAuthority_DefinitionToText_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IIdentityAuthority_DefinitionToTextBuffer_Proxy(
+ IIdentityAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
+ /* [in] */ ULONG cchBufferSize,
+ /* [length_is][size_is][out][in] */ WCHAR wchBuffer[ ],
+ /* [out] */ ULONG *pcchBufferRequired);
+
+
+void __RPC_STUB IIdentityAuthority_DefinitionToTextBuffer_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IIdentityAuthority_ReferenceToText_Proxy(
+ IIdentityAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IReferenceIdentity *pIReferenceIdentity,
+ /* [out] */ _Outptr_result_maybenull_ LPWSTR *ppszFormattedIdentity);
+
+
+void __RPC_STUB IIdentityAuthority_ReferenceToText_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IIdentityAuthority_ReferenceToTextBuffer_Proxy(
+ IIdentityAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IReferenceIdentity *pIReferenceIdentity,
+ /* [in] */ ULONG cchBufferSize,
+ /* [length_is][size_is][out][in] */ WCHAR wchBuffer[ ],
+ /* [out] */ ULONG *pcchBufferRequired);
+
+
+void __RPC_STUB IIdentityAuthority_ReferenceToTextBuffer_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IIdentityAuthority_AreDefinitionsEqual_Proxy(
+ IIdentityAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionIdentity *pDefinition1,
+ /* [in] */ IDefinitionIdentity *pDefinition2,
+ /* [out] */ BOOL *pfEqual);
+
+
+void __RPC_STUB IIdentityAuthority_AreDefinitionsEqual_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IIdentityAuthority_AreReferencesEqual_Proxy(
+ IIdentityAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IReferenceIdentity *pReference1,
+ /* [in] */ IReferenceIdentity *pReference2,
+ /* [out] */ BOOL *pfEqual);
+
+
+void __RPC_STUB IIdentityAuthority_AreReferencesEqual_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IIdentityAuthority_AreTextualDefinitionsEqual_Proxy(
+ IIdentityAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ LPCWSTR pszIdentityLeft,
+ /* [in] */ LPCWSTR pszIdentityRight,
+ /* [out] */ BOOL *pfEqual);
+
+
+void __RPC_STUB IIdentityAuthority_AreTextualDefinitionsEqual_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IIdentityAuthority_AreTextualReferencesEqual_Proxy(
+ IIdentityAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ LPCWSTR pszIdentityLeft,
+ /* [in] */ LPCWSTR pszIdentityRight,
+ /* [out] */ BOOL *pfEqual);
+
+
+void __RPC_STUB IIdentityAuthority_AreTextualReferencesEqual_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IIdentityAuthority_DoesDefinitionMatchReference_Proxy(
+ IIdentityAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
+ /* [in] */ IReferenceIdentity *pIReferenceIdentity,
+ /* [out] */ BOOL *pfMatches);
+
+
+void __RPC_STUB IIdentityAuthority_DoesDefinitionMatchReference_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IIdentityAuthority_DoesTextualDefinitionMatchTextualReference_Proxy(
+ IIdentityAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ LPCWSTR pszDefinition,
+ /* [in] */ LPCWSTR pszReference,
+ /* [out] */ BOOL *pfMatches);
+
+
+void __RPC_STUB IIdentityAuthority_DoesTextualDefinitionMatchTextualReference_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IIdentityAuthority_HashReference_Proxy(
+ IIdentityAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IReferenceIdentity *pIReferenceIdentity,
+ /* [out] */ ULONGLONG *pullPseudoKey);
+
+
+void __RPC_STUB IIdentityAuthority_HashReference_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IIdentityAuthority_HashDefinition_Proxy(
+ IIdentityAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
+ /* [out] */ ULONGLONG *pullPseudoKey);
+
+
+void __RPC_STUB IIdentityAuthority_HashDefinition_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IIdentityAuthority_GenerateDefinitionKey_Proxy(
+ IIdentityAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
+ /* [out] */ _Outptr_result_maybenull_ LPWSTR *ppszKeyForm);
+
+
+void __RPC_STUB IIdentityAuthority_GenerateDefinitionKey_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IIdentityAuthority_GenerateReferenceKey_Proxy(
+ IIdentityAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IReferenceIdentity *pIReferenceIdentity,
+ /* [out] */ _Outptr_result_maybenull_ LPWSTR *ppszKeyForm);
+
+
+void __RPC_STUB IIdentityAuthority_GenerateReferenceKey_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IIdentityAuthority_CreateDefinition_Proxy(
+ IIdentityAuthority * This,
+ /* [retval][out] */ IDefinitionIdentity **ppNewIdentity);
+
+
+void __RPC_STUB IIdentityAuthority_CreateDefinition_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IIdentityAuthority_CreateReference_Proxy(
+ IIdentityAuthority * This,
+ /* [retval][out] */ IReferenceIdentity **ppNewIdentity);
+
+
+void __RPC_STUB IIdentityAuthority_CreateReference_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IIdentityAuthority_INTERFACE_DEFINED__ */
+
+
+#ifndef __IAppIdAuthority_INTERFACE_DEFINED__
+#define __IAppIdAuthority_INTERFACE_DEFINED__
+
+/* interface IAppIdAuthority */
+/* [local][unique][uuid][object] */
+
+/* [v1_enum] */
+enum IAPPIDAUTHORITY_ARE_DEFINITIONS_EQUAL_FLAGS
+ { IAPPIDAUTHORITY_ARE_DEFINITIONS_EQUAL_FLAG_IGNORE_VERSION = 0x1
+ } ;
+/* [v1_enum] */
+enum IAPPIDAUTHORITY_ARE_REFERENCES_EQUAL_FLAGS
+ { IAPPIDAUTHORITY_ARE_REFERENCES_EQUAL_FLAG_IGNORE_VERSION = 0x1
+ } ;
+
+EXTERN_C const IID IID_IAppIdAuthority;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("8c87810c-2541-4f75-b2d0-9af515488e23")
+ IAppIdAuthority : public IUnknown
+ {
+ public:
+ virtual HRESULT STDMETHODCALLTYPE TextToDefinition(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ LPCWSTR pszIdentity,
+ /* [out] */ IDefinitionAppId **ppIDefinitionAppId) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE TextToReference(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ LPCWSTR pszIdentity,
+ /* [out] */ IReferenceAppId **ppIReferenceAppId) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE DefinitionToText(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionAppId *pIDefinitionAppId,
+ /* [out] */ LPWSTR *ppszFormattedIdentity) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE ReferenceToText(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IReferenceAppId *pIReferenceAppId,
+ /* [out] */ LPWSTR *ppszFormattedIdentity) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE AreDefinitionsEqual(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionAppId *pDefinition1,
+ /* [in] */ IDefinitionAppId *pDefinition2,
+ /* [out] */ BOOL *pfAreEqual) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE AreReferencesEqual(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IReferenceAppId *pReference1,
+ /* [in] */ IReferenceAppId *pReference2,
+ /* [out] */ BOOL *pfAreEqual) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE AreTextualDefinitionsEqual(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ LPCWSTR pszAppIdLeft,
+ /* [in] */ LPCWSTR pszAppIdRight,
+ /* [out] */ BOOL *pfAreEqual) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE AreTextualReferencesEqual(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ LPCWSTR pszAppIdLeft,
+ /* [in] */ LPCWSTR pszAppIdRight,
+ /* [out] */ BOOL *pfAreEqual) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE DoesDefinitionMatchReference(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionAppId *pIDefinitionIdentity,
+ /* [in] */ IReferenceAppId *pIReferenceIdentity,
+ /* [out] */ BOOL *pfMatches) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE DoesTextualDefinitionMatchTextualReference(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ LPCWSTR pszDefinition,
+ /* [in] */ LPCWSTR pszReference,
+ /* [out] */ BOOL *pfMatches) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE HashReference(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IReferenceAppId *pIReferenceIdentity,
+ /* [out] */ ULONGLONG *pullPseudoKey) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE HashDefinition(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionAppId *pIDefinitionIdentity,
+ /* [out] */ ULONGLONG *pullPseudoKey) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE GenerateDefinitionKey(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionAppId *pIDefinitionIdentity,
+ /* [out] */ LPWSTR *ppszKeyForm) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE GenerateReferenceKey(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IReferenceAppId *pIReferenceIdentity,
+ /* [out] */ LPWSTR *ppszKeyForm) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE CreateDefinition(
+ /* [retval][out] */ IDefinitionAppId **ppNewIdentity) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE CreateReference(
+ /* [retval][out] */ IReferenceAppId **ppNewIdentity) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IAppIdAuthorityVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IAppIdAuthority * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IAppIdAuthority * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IAppIdAuthority * This);
+
+ HRESULT ( STDMETHODCALLTYPE *TextToDefinition )(
+ IAppIdAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ LPCWSTR pszIdentity,
+ /* [out] */ IDefinitionAppId **ppIDefinitionAppId);
+
+ HRESULT ( STDMETHODCALLTYPE *TextToReference )(
+ IAppIdAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ LPCWSTR pszIdentity,
+ /* [out] */ IReferenceAppId **ppIReferenceAppId);
+
+ HRESULT ( STDMETHODCALLTYPE *DefinitionToText )(
+ IAppIdAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionAppId *pIDefinitionAppId,
+ /* [out] */ LPWSTR *ppszFormattedIdentity);
+
+ HRESULT ( STDMETHODCALLTYPE *ReferenceToText )(
+ IAppIdAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IReferenceAppId *pIReferenceAppId,
+ /* [out] */ LPWSTR *ppszFormattedIdentity);
+
+ HRESULT ( STDMETHODCALLTYPE *AreDefinitionsEqual )(
+ IAppIdAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionAppId *pDefinition1,
+ /* [in] */ IDefinitionAppId *pDefinition2,
+ /* [out] */ BOOL *pfAreEqual);
+
+ HRESULT ( STDMETHODCALLTYPE *AreReferencesEqual )(
+ IAppIdAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IReferenceAppId *pReference1,
+ /* [in] */ IReferenceAppId *pReference2,
+ /* [out] */ BOOL *pfAreEqual);
+
+ HRESULT ( STDMETHODCALLTYPE *AreTextualDefinitionsEqual )(
+ IAppIdAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ LPCWSTR pszAppIdLeft,
+ /* [in] */ LPCWSTR pszAppIdRight,
+ /* [out] */ BOOL *pfAreEqual);
+
+ HRESULT ( STDMETHODCALLTYPE *AreTextualReferencesEqual )(
+ IAppIdAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ LPCWSTR pszAppIdLeft,
+ /* [in] */ LPCWSTR pszAppIdRight,
+ /* [out] */ BOOL *pfAreEqual);
+
+ HRESULT ( STDMETHODCALLTYPE *DoesDefinitionMatchReference )(
+ IAppIdAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionAppId *pIDefinitionIdentity,
+ /* [in] */ IReferenceAppId *pIReferenceIdentity,
+ /* [out] */ BOOL *pfMatches);
+
+ HRESULT ( STDMETHODCALLTYPE *DoesTextualDefinitionMatchTextualReference )(
+ IAppIdAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ LPCWSTR pszDefinition,
+ /* [in] */ LPCWSTR pszReference,
+ /* [out] */ BOOL *pfMatches);
+
+ HRESULT ( STDMETHODCALLTYPE *HashReference )(
+ IAppIdAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IReferenceAppId *pIReferenceIdentity,
+ /* [out] */ ULONGLONG *pullPseudoKey);
+
+ HRESULT ( STDMETHODCALLTYPE *HashDefinition )(
+ IAppIdAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionAppId *pIDefinitionIdentity,
+ /* [out] */ ULONGLONG *pullPseudoKey);
+
+ HRESULT ( STDMETHODCALLTYPE *GenerateDefinitionKey )(
+ IAppIdAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionAppId *pIDefinitionIdentity,
+ /* [out] */ LPWSTR *ppszKeyForm);
+
+ HRESULT ( STDMETHODCALLTYPE *GenerateReferenceKey )(
+ IAppIdAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IReferenceAppId *pIReferenceIdentity,
+ /* [out] */ LPWSTR *ppszKeyForm);
+
+ HRESULT ( STDMETHODCALLTYPE *CreateDefinition )(
+ IAppIdAuthority * This,
+ /* [retval][out] */ IDefinitionAppId **ppNewIdentity);
+
+ HRESULT ( STDMETHODCALLTYPE *CreateReference )(
+ IAppIdAuthority * This,
+ /* [retval][out] */ IReferenceAppId **ppNewIdentity);
+
+ END_INTERFACE
+ } IAppIdAuthorityVtbl;
+
+ interface IAppIdAuthority
+ {
+ CONST_VTBL struct IAppIdAuthorityVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IAppIdAuthority_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IAppIdAuthority_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IAppIdAuthority_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IAppIdAuthority_TextToDefinition(This,dwFlags,pszIdentity,ppIDefinitionAppId) \
+ (This)->lpVtbl -> TextToDefinition(This,dwFlags,pszIdentity,ppIDefinitionAppId)
+
+#define IAppIdAuthority_TextToReference(This,dwFlags,pszIdentity,ppIReferenceAppId) \
+ (This)->lpVtbl -> TextToReference(This,dwFlags,pszIdentity,ppIReferenceAppId)
+
+#define IAppIdAuthority_DefinitionToText(This,dwFlags,pIDefinitionAppId,ppszFormattedIdentity) \
+ (This)->lpVtbl -> DefinitionToText(This,dwFlags,pIDefinitionAppId,ppszFormattedIdentity)
+
+#define IAppIdAuthority_ReferenceToText(This,dwFlags,pIReferenceAppId,ppszFormattedIdentity) \
+ (This)->lpVtbl -> ReferenceToText(This,dwFlags,pIReferenceAppId,ppszFormattedIdentity)
+
+#define IAppIdAuthority_AreDefinitionsEqual(This,dwFlags,pDefinition1,pDefinition2,pfAreEqual) \
+ (This)->lpVtbl -> AreDefinitionsEqual(This,dwFlags,pDefinition1,pDefinition2,pfAreEqual)
+
+#define IAppIdAuthority_AreReferencesEqual(This,dwFlags,pReference1,pReference2,pfAreEqual) \
+ (This)->lpVtbl -> AreReferencesEqual(This,dwFlags,pReference1,pReference2,pfAreEqual)
+
+#define IAppIdAuthority_AreTextualDefinitionsEqual(This,dwFlags,pszAppIdLeft,pszAppIdRight,pfAreEqual) \
+ (This)->lpVtbl -> AreTextualDefinitionsEqual(This,dwFlags,pszAppIdLeft,pszAppIdRight,pfAreEqual)
+
+#define IAppIdAuthority_AreTextualReferencesEqual(This,dwFlags,pszAppIdLeft,pszAppIdRight,pfAreEqual) \
+ (This)->lpVtbl -> AreTextualReferencesEqual(This,dwFlags,pszAppIdLeft,pszAppIdRight,pfAreEqual)
+
+#define IAppIdAuthority_DoesDefinitionMatchReference(This,dwFlags,pIDefinitionIdentity,pIReferenceIdentity,pfMatches) \
+ (This)->lpVtbl -> DoesDefinitionMatchReference(This,dwFlags,pIDefinitionIdentity,pIReferenceIdentity,pfMatches)
+
+#define IAppIdAuthority_DoesTextualDefinitionMatchTextualReference(This,dwFlags,pszDefinition,pszReference,pfMatches) \
+ (This)->lpVtbl -> DoesTextualDefinitionMatchTextualReference(This,dwFlags,pszDefinition,pszReference,pfMatches)
+
+#define IAppIdAuthority_HashReference(This,dwFlags,pIReferenceIdentity,pullPseudoKey) \
+ (This)->lpVtbl -> HashReference(This,dwFlags,pIReferenceIdentity,pullPseudoKey)
+
+#define IAppIdAuthority_HashDefinition(This,dwFlags,pIDefinitionIdentity,pullPseudoKey) \
+ (This)->lpVtbl -> HashDefinition(This,dwFlags,pIDefinitionIdentity,pullPseudoKey)
+
+#define IAppIdAuthority_GenerateDefinitionKey(This,dwFlags,pIDefinitionIdentity,ppszKeyForm) \
+ (This)->lpVtbl -> GenerateDefinitionKey(This,dwFlags,pIDefinitionIdentity,ppszKeyForm)
+
+#define IAppIdAuthority_GenerateReferenceKey(This,dwFlags,pIReferenceIdentity,ppszKeyForm) \
+ (This)->lpVtbl -> GenerateReferenceKey(This,dwFlags,pIReferenceIdentity,ppszKeyForm)
+
+#define IAppIdAuthority_CreateDefinition(This,ppNewIdentity) \
+ (This)->lpVtbl -> CreateDefinition(This,ppNewIdentity)
+
+#define IAppIdAuthority_CreateReference(This,ppNewIdentity) \
+ (This)->lpVtbl -> CreateReference(This,ppNewIdentity)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+HRESULT STDMETHODCALLTYPE IAppIdAuthority_TextToDefinition_Proxy(
+ IAppIdAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ LPCWSTR pszIdentity,
+ /* [out] */ IDefinitionAppId **ppIDefinitionAppId);
+
+
+void __RPC_STUB IAppIdAuthority_TextToDefinition_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IAppIdAuthority_TextToReference_Proxy(
+ IAppIdAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ LPCWSTR pszIdentity,
+ /* [out] */ IReferenceAppId **ppIReferenceAppId);
+
+
+void __RPC_STUB IAppIdAuthority_TextToReference_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IAppIdAuthority_DefinitionToText_Proxy(
+ IAppIdAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionAppId *pIDefinitionAppId,
+ /* [out] */ _Outptr_result_maybenull_ LPWSTR *ppszFormattedIdentity);
+
+
+void __RPC_STUB IAppIdAuthority_DefinitionToText_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IAppIdAuthority_ReferenceToText_Proxy(
+ IAppIdAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IReferenceAppId *pIReferenceAppId,
+ /* [out] */ _Outptr_result_maybenull_ LPWSTR *ppszFormattedIdentity);
+
+
+void __RPC_STUB IAppIdAuthority_ReferenceToText_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IAppIdAuthority_AreDefinitionsEqual_Proxy(
+ IAppIdAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionAppId *pDefinition1,
+ /* [in] */ IDefinitionAppId *pDefinition2,
+ /* [out] */ BOOL *pfAreEqual);
+
+
+void __RPC_STUB IAppIdAuthority_AreDefinitionsEqual_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IAppIdAuthority_AreReferencesEqual_Proxy(
+ IAppIdAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IReferenceAppId *pReference1,
+ /* [in] */ IReferenceAppId *pReference2,
+ /* [out] */ BOOL *pfAreEqual);
+
+
+void __RPC_STUB IAppIdAuthority_AreReferencesEqual_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IAppIdAuthority_AreTextualDefinitionsEqual_Proxy(
+ IAppIdAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ LPCWSTR pszAppIdLeft,
+ /* [in] */ LPCWSTR pszAppIdRight,
+ /* [out] */ BOOL *pfAreEqual);
+
+
+void __RPC_STUB IAppIdAuthority_AreTextualDefinitionsEqual_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IAppIdAuthority_AreTextualReferencesEqual_Proxy(
+ IAppIdAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ LPCWSTR pszAppIdLeft,
+ /* [in] */ LPCWSTR pszAppIdRight,
+ /* [out] */ BOOL *pfAreEqual);
+
+
+void __RPC_STUB IAppIdAuthority_AreTextualReferencesEqual_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IAppIdAuthority_DoesDefinitionMatchReference_Proxy(
+ IAppIdAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionAppId *pIDefinitionIdentity,
+ /* [in] */ IReferenceAppId *pIReferenceIdentity,
+ /* [out] */ BOOL *pfMatches);
+
+
+void __RPC_STUB IAppIdAuthority_DoesDefinitionMatchReference_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IAppIdAuthority_DoesTextualDefinitionMatchTextualReference_Proxy(
+ IAppIdAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ LPCWSTR pszDefinition,
+ /* [in] */ LPCWSTR pszReference,
+ /* [out] */ BOOL *pfMatches);
+
+
+void __RPC_STUB IAppIdAuthority_DoesTextualDefinitionMatchTextualReference_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IAppIdAuthority_HashReference_Proxy(
+ IAppIdAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IReferenceAppId *pIReferenceIdentity,
+ /* [out] */ ULONGLONG *pullPseudoKey);
+
+
+void __RPC_STUB IAppIdAuthority_HashReference_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IAppIdAuthority_HashDefinition_Proxy(
+ IAppIdAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionAppId *pIDefinitionIdentity,
+ /* [out] */ ULONGLONG *pullPseudoKey);
+
+
+void __RPC_STUB IAppIdAuthority_HashDefinition_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IAppIdAuthority_GenerateDefinitionKey_Proxy(
+ IAppIdAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionAppId *pIDefinitionIdentity,
+ /* [out] */ _Outptr_result_maybenull_ LPWSTR *ppszKeyForm);
+
+
+void __RPC_STUB IAppIdAuthority_GenerateDefinitionKey_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IAppIdAuthority_GenerateReferenceKey_Proxy(
+ IAppIdAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IReferenceAppId *pIReferenceIdentity,
+ /* [out] */ _Outptr_result_maybenull_ LPWSTR *ppszKeyForm);
+
+
+void __RPC_STUB IAppIdAuthority_GenerateReferenceKey_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IAppIdAuthority_CreateDefinition_Proxy(
+ IAppIdAuthority * This,
+ /* [retval][out] */ IDefinitionAppId **ppNewIdentity);
+
+
+void __RPC_STUB IAppIdAuthority_CreateDefinition_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IAppIdAuthority_CreateReference_Proxy(
+ IAppIdAuthority * This,
+ /* [retval][out] */ IReferenceAppId **ppNewIdentity);
+
+
+void __RPC_STUB IAppIdAuthority_CreateReference_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IAppIdAuthority_INTERFACE_DEFINED__ */
+
+
+/* [local] */ HRESULT __stdcall GetAppIdAuthority(
+ /* [out] */ IAppIdAuthority **ppIAppIdAuthority);
+
+/* [local] */ HRESULT __stdcall GetIdentityAuthority(
+ /* [out] */ IIdentityAuthority **ppIIdentityAuthority);
+
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
diff --git a/src/inc/isolationpriv.h b/src/inc/isolationpriv.h
new file mode 100644
index 0000000000..7179724cf1
--- /dev/null
+++ b/src/inc/isolationpriv.h
@@ -0,0 +1,18263 @@
+// 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.
+
+
+
+/* this ALWAYS GENERATED file contains the definitions for the interfaces */
+
+
+ /* File created by MIDL compiler version 6.00.0366 */
+/* Compiler settings for isolation.idl:
+ Oicf, W1, Zp8, env=Win32 (32b run)
+ protocol : dce , ms_ext, c_ext, robust
+ error checks: allocation ref bounds_check enum stub_data
+ VC __declspec() decoration level:
+ __declspec(uuid()), __declspec(selectany), __declspec(novtable)
+ DECLSPEC_UUID(), MIDL_INTERFACE()
+*/
+//@@MIDL_FILE_HEADING( )
+
+#pragma warning( disable: 4049 ) /* more than 64k source lines */
+
+
+/* verify that the <rpcndr.h> version is high enough to compile this file*/
+#ifndef __REQUIRED_RPCNDR_H_VERSION__
+#define __REQUIRED_RPCNDR_H_VERSION__ 475
+#endif
+
+#include "rpc.h"
+#include "rpcndr.h"
+
+#ifndef __RPCNDR_H_VERSION__
+#error this stub requires an updated version of <rpcndr.h>
+#endif // __RPCNDR_H_VERSION__
+
+#ifndef COM_NO_WINDOWS_H
+#include "windows.h"
+#include "ole2.h"
+#endif /*COM_NO_WINDOWS_H*/
+
+#ifndef __isolation_h__
+#define __isolation_h__
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+#pragma once
+#endif
+
+/* Forward Declarations */
+
+#ifndef __ISectionEntry_FWD_DEFINED__
+#define __ISectionEntry_FWD_DEFINED__
+typedef interface ISectionEntry ISectionEntry;
+#endif /* __ISectionEntry_FWD_DEFINED__ */
+
+
+#ifndef __ISection_FWD_DEFINED__
+#define __ISection_FWD_DEFINED__
+typedef interface ISection ISection;
+#endif /* __ISection_FWD_DEFINED__ */
+
+
+#ifndef __ICDF_FWD_DEFINED__
+#define __ICDF_FWD_DEFINED__
+typedef interface ICDF ICDF;
+#endif /* __ICDF_FWD_DEFINED__ */
+
+
+#ifndef __ISectionWithStringKey_FWD_DEFINED__
+#define __ISectionWithStringKey_FWD_DEFINED__
+typedef interface ISectionWithStringKey ISectionWithStringKey;
+#endif /* __ISectionWithStringKey_FWD_DEFINED__ */
+
+
+#ifndef __ISectionWithBlobKey_FWD_DEFINED__
+#define __ISectionWithBlobKey_FWD_DEFINED__
+typedef interface ISectionWithBlobKey ISectionWithBlobKey;
+#endif /* __ISectionWithBlobKey_FWD_DEFINED__ */
+
+
+#ifndef __ISectionWithGuidKey_FWD_DEFINED__
+#define __ISectionWithGuidKey_FWD_DEFINED__
+typedef interface ISectionWithGuidKey ISectionWithGuidKey;
+#endif /* __ISectionWithGuidKey_FWD_DEFINED__ */
+
+
+#ifndef __ISectionWithIntegerKey_FWD_DEFINED__
+#define __ISectionWithIntegerKey_FWD_DEFINED__
+typedef interface ISectionWithIntegerKey ISectionWithIntegerKey;
+#endif /* __ISectionWithIntegerKey_FWD_DEFINED__ */
+
+
+#ifndef __ISectionWithDefinitionIdentityKey_FWD_DEFINED__
+#define __ISectionWithDefinitionIdentityKey_FWD_DEFINED__
+typedef interface ISectionWithDefinitionIdentityKey ISectionWithDefinitionIdentityKey;
+#endif /* __ISectionWithDefinitionIdentityKey_FWD_DEFINED__ */
+
+
+#ifndef __ISectionWithReferenceIdentityKey_FWD_DEFINED__
+#define __ISectionWithReferenceIdentityKey_FWD_DEFINED__
+typedef interface ISectionWithReferenceIdentityKey ISectionWithReferenceIdentityKey;
+#endif /* __ISectionWithReferenceIdentityKey_FWD_DEFINED__ */
+
+
+#ifndef __ICMS_FWD_DEFINED__
+#define __ICMS_FWD_DEFINED__
+typedef interface ICMS ICMS;
+#endif /* __ICMS_FWD_DEFINED__ */
+
+
+#ifndef __IMuiResourceIdLookupMapEntry_FWD_DEFINED__
+#define __IMuiResourceIdLookupMapEntry_FWD_DEFINED__
+typedef interface IMuiResourceIdLookupMapEntry IMuiResourceIdLookupMapEntry;
+#endif /* __IMuiResourceIdLookupMapEntry_FWD_DEFINED__ */
+
+
+#ifndef __IMuiResourceTypeIdStringEntry_FWD_DEFINED__
+#define __IMuiResourceTypeIdStringEntry_FWD_DEFINED__
+typedef interface IMuiResourceTypeIdStringEntry IMuiResourceTypeIdStringEntry;
+#endif /* __IMuiResourceTypeIdStringEntry_FWD_DEFINED__ */
+
+
+#ifndef __IMuiResourceTypeIdIntEntry_FWD_DEFINED__
+#define __IMuiResourceTypeIdIntEntry_FWD_DEFINED__
+typedef interface IMuiResourceTypeIdIntEntry IMuiResourceTypeIdIntEntry;
+#endif /* __IMuiResourceTypeIdIntEntry_FWD_DEFINED__ */
+
+
+#ifndef __IMuiResourceMapEntry_FWD_DEFINED__
+#define __IMuiResourceMapEntry_FWD_DEFINED__
+typedef interface IMuiResourceMapEntry IMuiResourceMapEntry;
+#endif /* __IMuiResourceMapEntry_FWD_DEFINED__ */
+
+
+#ifndef __IHashElementEntry_FWD_DEFINED__
+#define __IHashElementEntry_FWD_DEFINED__
+typedef interface IHashElementEntry IHashElementEntry;
+#endif /* __IHashElementEntry_FWD_DEFINED__ */
+
+
+#ifndef __IFileEntry_FWD_DEFINED__
+#define __IFileEntry_FWD_DEFINED__
+typedef interface IFileEntry IFileEntry;
+#endif /* __IFileEntry_FWD_DEFINED__ */
+
+
+#ifndef __IFileAssociationEntry_FWD_DEFINED__
+#define __IFileAssociationEntry_FWD_DEFINED__
+typedef interface IFileAssociationEntry IFileAssociationEntry;
+#endif /* __IFileAssociationEntry_FWD_DEFINED__ */
+
+
+#ifndef __ICategoryMembershipDataEntry_FWD_DEFINED__
+#define __ICategoryMembershipDataEntry_FWD_DEFINED__
+typedef interface ICategoryMembershipDataEntry ICategoryMembershipDataEntry;
+#endif /* __ICategoryMembershipDataEntry_FWD_DEFINED__ */
+
+
+#ifndef __ISubcategoryMembershipEntry_FWD_DEFINED__
+#define __ISubcategoryMembershipEntry_FWD_DEFINED__
+typedef interface ISubcategoryMembershipEntry ISubcategoryMembershipEntry;
+#endif /* __ISubcategoryMembershipEntry_FWD_DEFINED__ */
+
+
+#ifndef __ICategoryMembershipEntry_FWD_DEFINED__
+#define __ICategoryMembershipEntry_FWD_DEFINED__
+typedef interface ICategoryMembershipEntry ICategoryMembershipEntry;
+#endif /* __ICategoryMembershipEntry_FWD_DEFINED__ */
+
+
+#ifndef __ICOMServerEntry_FWD_DEFINED__
+#define __ICOMServerEntry_FWD_DEFINED__
+typedef interface ICOMServerEntry ICOMServerEntry;
+#endif /* __ICOMServerEntry_FWD_DEFINED__ */
+
+
+#ifndef __IProgIdRedirectionEntry_FWD_DEFINED__
+#define __IProgIdRedirectionEntry_FWD_DEFINED__
+typedef interface IProgIdRedirectionEntry IProgIdRedirectionEntry;
+#endif /* __IProgIdRedirectionEntry_FWD_DEFINED__ */
+
+
+#ifndef __ICLRSurrogateEntry_FWD_DEFINED__
+#define __ICLRSurrogateEntry_FWD_DEFINED__
+typedef interface ICLRSurrogateEntry ICLRSurrogateEntry;
+#endif /* __ICLRSurrogateEntry_FWD_DEFINED__ */
+
+
+#ifndef __IAssemblyReferenceDependentAssemblyEntry_FWD_DEFINED__
+#define __IAssemblyReferenceDependentAssemblyEntry_FWD_DEFINED__
+typedef interface IAssemblyReferenceDependentAssemblyEntry IAssemblyReferenceDependentAssemblyEntry;
+#endif /* __IAssemblyReferenceDependentAssemblyEntry_FWD_DEFINED__ */
+
+
+#ifndef __IAssemblyReferenceEntry_FWD_DEFINED__
+#define __IAssemblyReferenceEntry_FWD_DEFINED__
+typedef interface IAssemblyReferenceEntry IAssemblyReferenceEntry;
+#endif /* __IAssemblyReferenceEntry_FWD_DEFINED__ */
+
+
+#ifndef __IWindowClassEntry_FWD_DEFINED__
+#define __IWindowClassEntry_FWD_DEFINED__
+typedef interface IWindowClassEntry IWindowClassEntry;
+#endif /* __IWindowClassEntry_FWD_DEFINED__ */
+
+
+#ifndef __IResourceTableMappingEntry_FWD_DEFINED__
+#define __IResourceTableMappingEntry_FWD_DEFINED__
+typedef interface IResourceTableMappingEntry IResourceTableMappingEntry;
+#endif /* __IResourceTableMappingEntry_FWD_DEFINED__ */
+
+
+#ifndef __IEntryPointEntry_FWD_DEFINED__
+#define __IEntryPointEntry_FWD_DEFINED__
+typedef interface IEntryPointEntry IEntryPointEntry;
+#endif /* __IEntryPointEntry_FWD_DEFINED__ */
+
+
+#ifndef __IPermissionSetEntry_FWD_DEFINED__
+#define __IPermissionSetEntry_FWD_DEFINED__
+typedef interface IPermissionSetEntry IPermissionSetEntry;
+#endif /* __IPermissionSetEntry_FWD_DEFINED__ */
+
+
+#ifndef __IAssemblyRequestEntry_FWD_DEFINED__
+#define __IAssemblyRequestEntry_FWD_DEFINED__
+typedef interface IAssemblyRequestEntry IAssemblyRequestEntry;
+#endif /* __IAssemblyRequestEntry_FWD_DEFINED__ */
+
+
+#ifndef __IDescriptionMetadataEntry_FWD_DEFINED__
+#define __IDescriptionMetadataEntry_FWD_DEFINED__
+typedef interface IDescriptionMetadataEntry IDescriptionMetadataEntry;
+#endif /* __IDescriptionMetadataEntry_FWD_DEFINED__ */
+
+
+#ifndef __IDeploymentMetadataEntry_FWD_DEFINED__
+#define __IDeploymentMetadataEntry_FWD_DEFINED__
+typedef interface IDeploymentMetadataEntry IDeploymentMetadataEntry;
+#endif /* __IDeploymentMetadataEntry_FWD_DEFINED__ */
+
+
+#ifndef __IDependentOSMetadataEntry_FWD_DEFINED__
+#define __IDependentOSMetadataEntry_FWD_DEFINED__
+typedef interface IDependentOSMetadataEntry IDependentOSMetadataEntry;
+#endif /* __IDependentOSMetadataEntry_FWD_DEFINED__ */
+
+
+#ifndef __ICompatibleFrameworksMetadataEntry_FWD_DEFINED__
+#define __ICompatibleFrameworksMetadataEntry_FWD_DEFINED__
+typedef interface ICompatibleFrameworksMetadataEntry ICompatibleFrameworksMetadataEntry;
+#endif /* __ICompatibleFrameworksMetadataEntry_FWD_DEFINED__ */
+
+
+#ifndef __IMetadataSectionEntry_FWD_DEFINED__
+#define __IMetadataSectionEntry_FWD_DEFINED__
+typedef interface IMetadataSectionEntry IMetadataSectionEntry;
+#endif /* __IMetadataSectionEntry_FWD_DEFINED__ */
+
+
+#ifndef __IEventEntry_FWD_DEFINED__
+#define __IEventEntry_FWD_DEFINED__
+typedef interface IEventEntry IEventEntry;
+#endif /* __IEventEntry_FWD_DEFINED__ */
+
+
+#ifndef __IEventMapEntry_FWD_DEFINED__
+#define __IEventMapEntry_FWD_DEFINED__
+typedef interface IEventMapEntry IEventMapEntry;
+#endif /* __IEventMapEntry_FWD_DEFINED__ */
+
+
+#ifndef __IEventTagEntry_FWD_DEFINED__
+#define __IEventTagEntry_FWD_DEFINED__
+typedef interface IEventTagEntry IEventTagEntry;
+#endif /* __IEventTagEntry_FWD_DEFINED__ */
+
+
+#ifndef __IRegistryValueEntry_FWD_DEFINED__
+#define __IRegistryValueEntry_FWD_DEFINED__
+typedef interface IRegistryValueEntry IRegistryValueEntry;
+#endif /* __IRegistryValueEntry_FWD_DEFINED__ */
+
+
+#ifndef __IRegistryKeyEntry_FWD_DEFINED__
+#define __IRegistryKeyEntry_FWD_DEFINED__
+typedef interface IRegistryKeyEntry IRegistryKeyEntry;
+#endif /* __IRegistryKeyEntry_FWD_DEFINED__ */
+
+
+#ifndef __IDirectoryEntry_FWD_DEFINED__
+#define __IDirectoryEntry_FWD_DEFINED__
+typedef interface IDirectoryEntry IDirectoryEntry;
+#endif /* __IDirectoryEntry_FWD_DEFINED__ */
+
+
+#ifndef __ISecurityDescriptorReferenceEntry_FWD_DEFINED__
+#define __ISecurityDescriptorReferenceEntry_FWD_DEFINED__
+typedef interface ISecurityDescriptorReferenceEntry ISecurityDescriptorReferenceEntry;
+#endif /* __ISecurityDescriptorReferenceEntry_FWD_DEFINED__ */
+
+
+#ifndef __ICounterSetEntry_FWD_DEFINED__
+#define __ICounterSetEntry_FWD_DEFINED__
+typedef interface ICounterSetEntry ICounterSetEntry;
+#endif /* __ICounterSetEntry_FWD_DEFINED__ */
+
+
+#ifndef __ICounterEntry_FWD_DEFINED__
+#define __ICounterEntry_FWD_DEFINED__
+typedef interface ICounterEntry ICounterEntry;
+#endif /* __ICounterEntry_FWD_DEFINED__ */
+
+
+#ifndef __ICompatibleFrameworkEntry_FWD_DEFINED__
+#define __ICompatibleFrameworkEntry_FWD_DEFINED__
+typedef interface ICompatibleFrameworkEntry ICompatibleFrameworkEntry;
+#endif /* __ICompatibleFrameworkEntry_FWD_DEFINED__ */
+
+
+#ifndef __IACS_FWD_DEFINED__
+#define __IACS_FWD_DEFINED__
+typedef interface IACS IACS;
+#endif /* __IACS_FWD_DEFINED__ */
+
+
+#ifndef __IAppIdMetadataEntry_FWD_DEFINED__
+#define __IAppIdMetadataEntry_FWD_DEFINED__
+typedef interface IAppIdMetadataEntry IAppIdMetadataEntry;
+#endif /* __IAppIdMetadataEntry_FWD_DEFINED__ */
+
+
+#ifndef __IMemberComponentEntry_FWD_DEFINED__
+#define __IMemberComponentEntry_FWD_DEFINED__
+typedef interface IMemberComponentEntry IMemberComponentEntry;
+#endif /* __IMemberComponentEntry_FWD_DEFINED__ */
+
+
+#ifndef __IMemberLookupEntry_FWD_DEFINED__
+#define __IMemberLookupEntry_FWD_DEFINED__
+typedef interface IMemberLookupEntry IMemberLookupEntry;
+#endif /* __IMemberLookupEntry_FWD_DEFINED__ */
+
+
+#ifndef __IStoreCoherencyEntry_FWD_DEFINED__
+#define __IStoreCoherencyEntry_FWD_DEFINED__
+typedef interface IStoreCoherencyEntry IStoreCoherencyEntry;
+#endif /* __IStoreCoherencyEntry_FWD_DEFINED__ */
+
+
+#ifndef __IReferenceIdentity_FWD_DEFINED__
+#define __IReferenceIdentity_FWD_DEFINED__
+typedef interface IReferenceIdentity IReferenceIdentity;
+#endif /* __IReferenceIdentity_FWD_DEFINED__ */
+
+
+#ifndef __IDefinitionIdentity_FWD_DEFINED__
+#define __IDefinitionIdentity_FWD_DEFINED__
+typedef interface IDefinitionIdentity IDefinitionIdentity;
+#endif /* __IDefinitionIdentity_FWD_DEFINED__ */
+
+
+#ifndef __IEnumIDENTITY_ATTRIBUTE_FWD_DEFINED__
+#define __IEnumIDENTITY_ATTRIBUTE_FWD_DEFINED__
+typedef interface IEnumIDENTITY_ATTRIBUTE IEnumIDENTITY_ATTRIBUTE;
+#endif /* __IEnumIDENTITY_ATTRIBUTE_FWD_DEFINED__ */
+
+
+#ifndef __IEnumDefinitionIdentity_FWD_DEFINED__
+#define __IEnumDefinitionIdentity_FWD_DEFINED__
+typedef interface IEnumDefinitionIdentity IEnumDefinitionIdentity;
+#endif /* __IEnumDefinitionIdentity_FWD_DEFINED__ */
+
+
+#ifndef __IEnumReferenceIdentity_FWD_DEFINED__
+#define __IEnumReferenceIdentity_FWD_DEFINED__
+typedef interface IEnumReferenceIdentity IEnumReferenceIdentity;
+#endif /* __IEnumReferenceIdentity_FWD_DEFINED__ */
+
+
+#ifndef __IDefinitionAppId_FWD_DEFINED__
+#define __IDefinitionAppId_FWD_DEFINED__
+typedef interface IDefinitionAppId IDefinitionAppId;
+#endif /* __IDefinitionAppId_FWD_DEFINED__ */
+
+
+#ifndef __IReferenceAppId_FWD_DEFINED__
+#define __IReferenceAppId_FWD_DEFINED__
+typedef interface IReferenceAppId IReferenceAppId;
+#endif /* __IReferenceAppId_FWD_DEFINED__ */
+
+
+#ifndef __IIdentityAuthority_FWD_DEFINED__
+#define __IIdentityAuthority_FWD_DEFINED__
+typedef interface IIdentityAuthority IIdentityAuthority;
+#endif /* __IIdentityAuthority_FWD_DEFINED__ */
+
+
+#ifndef __IAppIdAuthority_FWD_DEFINED__
+#define __IAppIdAuthority_FWD_DEFINED__
+typedef interface IAppIdAuthority IAppIdAuthority;
+#endif /* __IAppIdAuthority_FWD_DEFINED__ */
+
+
+#ifndef __IEnumSTORE_CATEGORY_FWD_DEFINED__
+#define __IEnumSTORE_CATEGORY_FWD_DEFINED__
+typedef interface IEnumSTORE_CATEGORY IEnumSTORE_CATEGORY;
+#endif /* __IEnumSTORE_CATEGORY_FWD_DEFINED__ */
+
+
+#ifndef __IEnumSTORE_CATEGORY_SUBCATEGORY_FWD_DEFINED__
+#define __IEnumSTORE_CATEGORY_SUBCATEGORY_FWD_DEFINED__
+typedef interface IEnumSTORE_CATEGORY_SUBCATEGORY IEnumSTORE_CATEGORY_SUBCATEGORY;
+#endif /* __IEnumSTORE_CATEGORY_SUBCATEGORY_FWD_DEFINED__ */
+
+
+#ifndef __IEnumSTORE_CATEGORY_INSTANCE_FWD_DEFINED__
+#define __IEnumSTORE_CATEGORY_INSTANCE_FWD_DEFINED__
+typedef interface IEnumSTORE_CATEGORY_INSTANCE IEnumSTORE_CATEGORY_INSTANCE;
+#endif /* __IEnumSTORE_CATEGORY_INSTANCE_FWD_DEFINED__ */
+
+
+#ifndef __IStore_FWD_DEFINED__
+#define __IStore_FWD_DEFINED__
+typedef interface IStore IStore;
+#endif /* __IStore_FWD_DEFINED__ */
+
+
+#ifndef __IMigrateStore_FWD_DEFINED__
+#define __IMigrateStore_FWD_DEFINED__
+typedef interface IMigrateStore IMigrateStore;
+#endif /* __IMigrateStore_FWD_DEFINED__ */
+
+
+#ifndef __IEnumSTORE_DEPLOYMENT_METADATA_FWD_DEFINED__
+#define __IEnumSTORE_DEPLOYMENT_METADATA_FWD_DEFINED__
+typedef interface IEnumSTORE_DEPLOYMENT_METADATA IEnumSTORE_DEPLOYMENT_METADATA;
+#endif /* __IEnumSTORE_DEPLOYMENT_METADATA_FWD_DEFINED__ */
+
+
+#ifndef __IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY_FWD_DEFINED__
+#define __IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY_FWD_DEFINED__
+typedef interface IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY;
+#endif /* __IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY_FWD_DEFINED__ */
+
+
+#ifndef __IEnumSTORE_ASSEMBLY_FWD_DEFINED__
+#define __IEnumSTORE_ASSEMBLY_FWD_DEFINED__
+typedef interface IEnumSTORE_ASSEMBLY IEnumSTORE_ASSEMBLY;
+#endif /* __IEnumSTORE_ASSEMBLY_FWD_DEFINED__ */
+
+
+#ifndef __IEnumSTORE_ASSEMBLY_FILE_FWD_DEFINED__
+#define __IEnumSTORE_ASSEMBLY_FILE_FWD_DEFINED__
+typedef interface IEnumSTORE_ASSEMBLY_FILE IEnumSTORE_ASSEMBLY_FILE;
+#endif /* __IEnumSTORE_ASSEMBLY_FILE_FWD_DEFINED__ */
+
+
+#ifndef __IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE_FWD_DEFINED__
+#define __IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE_FWD_DEFINED__
+typedef interface IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE;
+#endif /* __IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE_FWD_DEFINED__ */
+
+
+#ifndef __IEnumCATEGORY_FWD_DEFINED__
+#define __IEnumCATEGORY_FWD_DEFINED__
+typedef interface IEnumCATEGORY IEnumCATEGORY;
+#endif /* __IEnumCATEGORY_FWD_DEFINED__ */
+
+
+#ifndef __IEnumCATEGORY_SUBCATEGORY_FWD_DEFINED__
+#define __IEnumCATEGORY_SUBCATEGORY_FWD_DEFINED__
+typedef interface IEnumCATEGORY_SUBCATEGORY IEnumCATEGORY_SUBCATEGORY;
+#endif /* __IEnumCATEGORY_SUBCATEGORY_FWD_DEFINED__ */
+
+
+#ifndef __IEnumCATEGORY_INSTANCE_FWD_DEFINED__
+#define __IEnumCATEGORY_INSTANCE_FWD_DEFINED__
+typedef interface IEnumCATEGORY_INSTANCE IEnumCATEGORY_INSTANCE;
+#endif /* __IEnumCATEGORY_INSTANCE_FWD_DEFINED__ */
+
+
+#ifndef __IManifestInformation_FWD_DEFINED__
+#define __IManifestInformation_FWD_DEFINED__
+typedef interface IManifestInformation IManifestInformation;
+#endif /* __IManifestInformation_FWD_DEFINED__ */
+
+
+#ifndef __IActContext_FWD_DEFINED__
+#define __IActContext_FWD_DEFINED__
+typedef interface IActContext IActContext;
+#endif /* __IActContext_FWD_DEFINED__ */
+
+
+#ifndef __IStateManager_FWD_DEFINED__
+#define __IStateManager_FWD_DEFINED__
+typedef interface IStateManager IStateManager;
+#endif /* __IStateManager_FWD_DEFINED__ */
+
+
+#ifndef __IManifestParseErrorCallback_FWD_DEFINED__
+#define __IManifestParseErrorCallback_FWD_DEFINED__
+typedef interface IManifestParseErrorCallback IManifestParseErrorCallback;
+#endif /* __IManifestParseErrorCallback_FWD_DEFINED__ */
+
+
+#ifndef __IMuiResourceIdLookupMapEntry_FWD_DEFINED__
+#define __IMuiResourceIdLookupMapEntry_FWD_DEFINED__
+typedef interface IMuiResourceIdLookupMapEntry IMuiResourceIdLookupMapEntry;
+#endif /* __IMuiResourceIdLookupMapEntry_FWD_DEFINED__ */
+
+
+#ifndef __IMuiResourceTypeIdStringEntry_FWD_DEFINED__
+#define __IMuiResourceTypeIdStringEntry_FWD_DEFINED__
+typedef interface IMuiResourceTypeIdStringEntry IMuiResourceTypeIdStringEntry;
+#endif /* __IMuiResourceTypeIdStringEntry_FWD_DEFINED__ */
+
+
+#ifndef __IMuiResourceTypeIdIntEntry_FWD_DEFINED__
+#define __IMuiResourceTypeIdIntEntry_FWD_DEFINED__
+typedef interface IMuiResourceTypeIdIntEntry IMuiResourceTypeIdIntEntry;
+#endif /* __IMuiResourceTypeIdIntEntry_FWD_DEFINED__ */
+
+
+#ifndef __IMuiResourceMapEntry_FWD_DEFINED__
+#define __IMuiResourceMapEntry_FWD_DEFINED__
+typedef interface IMuiResourceMapEntry IMuiResourceMapEntry;
+#endif /* __IMuiResourceMapEntry_FWD_DEFINED__ */
+
+
+#ifndef __IHashElementEntry_FWD_DEFINED__
+#define __IHashElementEntry_FWD_DEFINED__
+typedef interface IHashElementEntry IHashElementEntry;
+#endif /* __IHashElementEntry_FWD_DEFINED__ */
+
+
+#ifndef __IFileEntry_FWD_DEFINED__
+#define __IFileEntry_FWD_DEFINED__
+typedef interface IFileEntry IFileEntry;
+#endif /* __IFileEntry_FWD_DEFINED__ */
+
+
+#ifndef __IFileAssociationEntry_FWD_DEFINED__
+#define __IFileAssociationEntry_FWD_DEFINED__
+typedef interface IFileAssociationEntry IFileAssociationEntry;
+#endif /* __IFileAssociationEntry_FWD_DEFINED__ */
+
+
+#ifndef __ICategoryMembershipDataEntry_FWD_DEFINED__
+#define __ICategoryMembershipDataEntry_FWD_DEFINED__
+typedef interface ICategoryMembershipDataEntry ICategoryMembershipDataEntry;
+#endif /* __ICategoryMembershipDataEntry_FWD_DEFINED__ */
+
+
+#ifndef __ISubcategoryMembershipEntry_FWD_DEFINED__
+#define __ISubcategoryMembershipEntry_FWD_DEFINED__
+typedef interface ISubcategoryMembershipEntry ISubcategoryMembershipEntry;
+#endif /* __ISubcategoryMembershipEntry_FWD_DEFINED__ */
+
+
+#ifndef __ICategoryMembershipEntry_FWD_DEFINED__
+#define __ICategoryMembershipEntry_FWD_DEFINED__
+typedef interface ICategoryMembershipEntry ICategoryMembershipEntry;
+#endif /* __ICategoryMembershipEntry_FWD_DEFINED__ */
+
+
+#ifndef __ICOMServerEntry_FWD_DEFINED__
+#define __ICOMServerEntry_FWD_DEFINED__
+typedef interface ICOMServerEntry ICOMServerEntry;
+#endif /* __ICOMServerEntry_FWD_DEFINED__ */
+
+
+#ifndef __IProgIdRedirectionEntry_FWD_DEFINED__
+#define __IProgIdRedirectionEntry_FWD_DEFINED__
+typedef interface IProgIdRedirectionEntry IProgIdRedirectionEntry;
+#endif /* __IProgIdRedirectionEntry_FWD_DEFINED__ */
+
+
+#ifndef __ICLRSurrogateEntry_FWD_DEFINED__
+#define __ICLRSurrogateEntry_FWD_DEFINED__
+typedef interface ICLRSurrogateEntry ICLRSurrogateEntry;
+#endif /* __ICLRSurrogateEntry_FWD_DEFINED__ */
+
+
+#ifndef __IAssemblyReferenceDependentAssemblyEntry_FWD_DEFINED__
+#define __IAssemblyReferenceDependentAssemblyEntry_FWD_DEFINED__
+typedef interface IAssemblyReferenceDependentAssemblyEntry IAssemblyReferenceDependentAssemblyEntry;
+#endif /* __IAssemblyReferenceDependentAssemblyEntry_FWD_DEFINED__ */
+
+
+#ifndef __IAssemblyReferenceEntry_FWD_DEFINED__
+#define __IAssemblyReferenceEntry_FWD_DEFINED__
+typedef interface IAssemblyReferenceEntry IAssemblyReferenceEntry;
+#endif /* __IAssemblyReferenceEntry_FWD_DEFINED__ */
+
+
+#ifndef __IWindowClassEntry_FWD_DEFINED__
+#define __IWindowClassEntry_FWD_DEFINED__
+typedef interface IWindowClassEntry IWindowClassEntry;
+#endif /* __IWindowClassEntry_FWD_DEFINED__ */
+
+
+#ifndef __IResourceTableMappingEntry_FWD_DEFINED__
+#define __IResourceTableMappingEntry_FWD_DEFINED__
+typedef interface IResourceTableMappingEntry IResourceTableMappingEntry;
+#endif /* __IResourceTableMappingEntry_FWD_DEFINED__ */
+
+
+#ifndef __IEntryPointEntry_FWD_DEFINED__
+#define __IEntryPointEntry_FWD_DEFINED__
+typedef interface IEntryPointEntry IEntryPointEntry;
+#endif /* __IEntryPointEntry_FWD_DEFINED__ */
+
+
+#ifndef __IPermissionSetEntry_FWD_DEFINED__
+#define __IPermissionSetEntry_FWD_DEFINED__
+typedef interface IPermissionSetEntry IPermissionSetEntry;
+#endif /* __IPermissionSetEntry_FWD_DEFINED__ */
+
+
+#ifndef __IAssemblyRequestEntry_FWD_DEFINED__
+#define __IAssemblyRequestEntry_FWD_DEFINED__
+typedef interface IAssemblyRequestEntry IAssemblyRequestEntry;
+#endif /* __IAssemblyRequestEntry_FWD_DEFINED__ */
+
+
+#ifndef __IDescriptionMetadataEntry_FWD_DEFINED__
+#define __IDescriptionMetadataEntry_FWD_DEFINED__
+typedef interface IDescriptionMetadataEntry IDescriptionMetadataEntry;
+#endif /* __IDescriptionMetadataEntry_FWD_DEFINED__ */
+
+
+#ifndef __IDeploymentMetadataEntry_FWD_DEFINED__
+#define __IDeploymentMetadataEntry_FWD_DEFINED__
+typedef interface IDeploymentMetadataEntry IDeploymentMetadataEntry;
+#endif /* __IDeploymentMetadataEntry_FWD_DEFINED__ */
+
+
+#ifndef __IDependentOSMetadataEntry_FWD_DEFINED__
+#define __IDependentOSMetadataEntry_FWD_DEFINED__
+typedef interface IDependentOSMetadataEntry IDependentOSMetadataEntry;
+#endif /* __IDependentOSMetadataEntry_FWD_DEFINED__ */
+
+
+#ifndef __ICompatibleFrameworksMetadataEntry_FWD_DEFINED__
+#define __ICompatibleFrameworksMetadataEntry_FWD_DEFINED__
+typedef interface ICompatibleFrameworksMetadataEntry ICompatibleFrameworksMetadataEntry;
+#endif /* __ICompatibleFrameworksMetadataEntry_FWD_DEFINED__ */
+
+
+#ifndef __IMetadataSectionEntry_FWD_DEFINED__
+#define __IMetadataSectionEntry_FWD_DEFINED__
+typedef interface IMetadataSectionEntry IMetadataSectionEntry;
+#endif /* __IMetadataSectionEntry_FWD_DEFINED__ */
+
+
+#ifndef __IEventEntry_FWD_DEFINED__
+#define __IEventEntry_FWD_DEFINED__
+typedef interface IEventEntry IEventEntry;
+#endif /* __IEventEntry_FWD_DEFINED__ */
+
+
+#ifndef __IEventMapEntry_FWD_DEFINED__
+#define __IEventMapEntry_FWD_DEFINED__
+typedef interface IEventMapEntry IEventMapEntry;
+#endif /* __IEventMapEntry_FWD_DEFINED__ */
+
+
+#ifndef __IEventTagEntry_FWD_DEFINED__
+#define __IEventTagEntry_FWD_DEFINED__
+typedef interface IEventTagEntry IEventTagEntry;
+#endif /* __IEventTagEntry_FWD_DEFINED__ */
+
+
+#ifndef __IRegistryValueEntry_FWD_DEFINED__
+#define __IRegistryValueEntry_FWD_DEFINED__
+typedef interface IRegistryValueEntry IRegistryValueEntry;
+#endif /* __IRegistryValueEntry_FWD_DEFINED__ */
+
+
+#ifndef __IRegistryKeyEntry_FWD_DEFINED__
+#define __IRegistryKeyEntry_FWD_DEFINED__
+typedef interface IRegistryKeyEntry IRegistryKeyEntry;
+#endif /* __IRegistryKeyEntry_FWD_DEFINED__ */
+
+
+#ifndef __IDirectoryEntry_FWD_DEFINED__
+#define __IDirectoryEntry_FWD_DEFINED__
+typedef interface IDirectoryEntry IDirectoryEntry;
+#endif /* __IDirectoryEntry_FWD_DEFINED__ */
+
+
+#ifndef __ISecurityDescriptorReferenceEntry_FWD_DEFINED__
+#define __ISecurityDescriptorReferenceEntry_FWD_DEFINED__
+typedef interface ISecurityDescriptorReferenceEntry ISecurityDescriptorReferenceEntry;
+#endif /* __ISecurityDescriptorReferenceEntry_FWD_DEFINED__ */
+
+
+#ifndef __ICounterSetEntry_FWD_DEFINED__
+#define __ICounterSetEntry_FWD_DEFINED__
+typedef interface ICounterSetEntry ICounterSetEntry;
+#endif /* __ICounterSetEntry_FWD_DEFINED__ */
+
+
+#ifndef __ICounterEntry_FWD_DEFINED__
+#define __ICounterEntry_FWD_DEFINED__
+typedef interface ICounterEntry ICounterEntry;
+#endif /* __ICounterEntry_FWD_DEFINED__ */
+
+
+#ifndef __ICompatibleFrameworkEntry_FWD_DEFINED__
+#define __ICompatibleFrameworkEntry_FWD_DEFINED__
+typedef interface ICompatibleFrameworkEntry ICompatibleFrameworkEntry;
+#endif /* __ICompatibleFrameworkEntry_FWD_DEFINED__ */
+
+
+#ifndef __ICDF_FWD_DEFINED__
+#define __ICDF_FWD_DEFINED__
+typedef interface ICDF ICDF;
+#endif /* __ICDF_FWD_DEFINED__ */
+
+
+#ifndef __ISectionEntry_FWD_DEFINED__
+#define __ISectionEntry_FWD_DEFINED__
+typedef interface ISectionEntry ISectionEntry;
+#endif /* __ISectionEntry_FWD_DEFINED__ */
+
+
+#ifndef __ISection_FWD_DEFINED__
+#define __ISection_FWD_DEFINED__
+typedef interface ISection ISection;
+#endif /* __ISection_FWD_DEFINED__ */
+
+
+#ifndef __ISectionWithStringKey_FWD_DEFINED__
+#define __ISectionWithStringKey_FWD_DEFINED__
+typedef interface ISectionWithStringKey ISectionWithStringKey;
+#endif /* __ISectionWithStringKey_FWD_DEFINED__ */
+
+
+#ifndef __ISectionWithIntegerKey_FWD_DEFINED__
+#define __ISectionWithIntegerKey_FWD_DEFINED__
+typedef interface ISectionWithIntegerKey ISectionWithIntegerKey;
+#endif /* __ISectionWithIntegerKey_FWD_DEFINED__ */
+
+
+#ifndef __ISectionWithGuidKey_FWD_DEFINED__
+#define __ISectionWithGuidKey_FWD_DEFINED__
+typedef interface ISectionWithGuidKey ISectionWithGuidKey;
+#endif /* __ISectionWithGuidKey_FWD_DEFINED__ */
+
+
+#ifndef __ISectionWithBlobKey_FWD_DEFINED__
+#define __ISectionWithBlobKey_FWD_DEFINED__
+typedef interface ISectionWithBlobKey ISectionWithBlobKey;
+#endif /* __ISectionWithBlobKey_FWD_DEFINED__ */
+
+
+#ifndef __ISectionWithReferenceIdentityKey_FWD_DEFINED__
+#define __ISectionWithReferenceIdentityKey_FWD_DEFINED__
+typedef interface ISectionWithReferenceIdentityKey ISectionWithReferenceIdentityKey;
+#endif /* __ISectionWithReferenceIdentityKey_FWD_DEFINED__ */
+
+
+#ifndef __ISectionWithDefinitionIdentityKey_FWD_DEFINED__
+#define __ISectionWithDefinitionIdentityKey_FWD_DEFINED__
+typedef interface ISectionWithDefinitionIdentityKey ISectionWithDefinitionIdentityKey;
+#endif /* __ISectionWithDefinitionIdentityKey_FWD_DEFINED__ */
+
+
+#ifndef __IIdentityAuthority_FWD_DEFINED__
+#define __IIdentityAuthority_FWD_DEFINED__
+typedef interface IIdentityAuthority IIdentityAuthority;
+#endif /* __IIdentityAuthority_FWD_DEFINED__ */
+
+
+#ifndef __IAppIdAuthority_FWD_DEFINED__
+#define __IAppIdAuthority_FWD_DEFINED__
+typedef interface IAppIdAuthority IAppIdAuthority;
+#endif /* __IAppIdAuthority_FWD_DEFINED__ */
+
+
+#ifndef __IDefinitionIdentity_FWD_DEFINED__
+#define __IDefinitionIdentity_FWD_DEFINED__
+typedef interface IDefinitionIdentity IDefinitionIdentity;
+#endif /* __IDefinitionIdentity_FWD_DEFINED__ */
+
+
+#ifndef __IReferenceIdentity_FWD_DEFINED__
+#define __IReferenceIdentity_FWD_DEFINED__
+typedef interface IReferenceIdentity IReferenceIdentity;
+#endif /* __IReferenceIdentity_FWD_DEFINED__ */
+
+
+#ifndef __IDefinitionAppId_FWD_DEFINED__
+#define __IDefinitionAppId_FWD_DEFINED__
+typedef interface IDefinitionAppId IDefinitionAppId;
+#endif /* __IDefinitionAppId_FWD_DEFINED__ */
+
+
+#ifndef __IReferenceAppId_FWD_DEFINED__
+#define __IReferenceAppId_FWD_DEFINED__
+typedef interface IReferenceAppId IReferenceAppId;
+#endif /* __IReferenceAppId_FWD_DEFINED__ */
+
+
+#ifndef __IActContext_FWD_DEFINED__
+#define __IActContext_FWD_DEFINED__
+typedef interface IActContext IActContext;
+#endif /* __IActContext_FWD_DEFINED__ */
+
+
+#ifndef __IManifestParseErrorCallback_FWD_DEFINED__
+#define __IManifestParseErrorCallback_FWD_DEFINED__
+typedef interface IManifestParseErrorCallback IManifestParseErrorCallback;
+#endif /* __IManifestParseErrorCallback_FWD_DEFINED__ */
+
+
+#ifndef __IStore_FWD_DEFINED__
+#define __IStore_FWD_DEFINED__
+typedef interface IStore IStore;
+#endif /* __IStore_FWD_DEFINED__ */
+
+
+#ifndef __IMigrateStore_FWD_DEFINED__
+#define __IMigrateStore_FWD_DEFINED__
+typedef interface IMigrateStore IMigrateStore;
+#endif /* __IMigrateStore_FWD_DEFINED__ */
+
+
+#ifndef __IEnumIDENTITY_ATTRIBUTE_FWD_DEFINED__
+#define __IEnumIDENTITY_ATTRIBUTE_FWD_DEFINED__
+typedef interface IEnumIDENTITY_ATTRIBUTE IEnumIDENTITY_ATTRIBUTE;
+#endif /* __IEnumIDENTITY_ATTRIBUTE_FWD_DEFINED__ */
+
+
+#ifndef __IEnumSTORE_CATEGORY_FWD_DEFINED__
+#define __IEnumSTORE_CATEGORY_FWD_DEFINED__
+typedef interface IEnumSTORE_CATEGORY IEnumSTORE_CATEGORY;
+#endif /* __IEnumSTORE_CATEGORY_FWD_DEFINED__ */
+
+
+#ifndef __IEnumSTORE_CATEGORY_INSTANCE_FWD_DEFINED__
+#define __IEnumSTORE_CATEGORY_INSTANCE_FWD_DEFINED__
+typedef interface IEnumSTORE_CATEGORY_INSTANCE IEnumSTORE_CATEGORY_INSTANCE;
+#endif /* __IEnumSTORE_CATEGORY_INSTANCE_FWD_DEFINED__ */
+
+
+#ifndef __IEnumSTORE_CATEGORY_SUBCATEGORY_FWD_DEFINED__
+#define __IEnumSTORE_CATEGORY_SUBCATEGORY_FWD_DEFINED__
+typedef interface IEnumSTORE_CATEGORY_SUBCATEGORY IEnumSTORE_CATEGORY_SUBCATEGORY;
+#endif /* __IEnumSTORE_CATEGORY_SUBCATEGORY_FWD_DEFINED__ */
+
+
+#ifndef __IEnumSTORE_ASSEMBLY_FWD_DEFINED__
+#define __IEnumSTORE_ASSEMBLY_FWD_DEFINED__
+typedef interface IEnumSTORE_ASSEMBLY IEnumSTORE_ASSEMBLY;
+#endif /* __IEnumSTORE_ASSEMBLY_FWD_DEFINED__ */
+
+
+#ifndef __IEnumSTORE_ASSEMBLY_FILE_FWD_DEFINED__
+#define __IEnumSTORE_ASSEMBLY_FILE_FWD_DEFINED__
+typedef interface IEnumSTORE_ASSEMBLY_FILE IEnumSTORE_ASSEMBLY_FILE;
+#endif /* __IEnumSTORE_ASSEMBLY_FILE_FWD_DEFINED__ */
+
+
+#ifndef __IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE_FWD_DEFINED__
+#define __IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE_FWD_DEFINED__
+typedef interface IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE;
+#endif /* __IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE_FWD_DEFINED__ */
+
+
+#ifndef __IEnumDefinitionIdentity_FWD_DEFINED__
+#define __IEnumDefinitionIdentity_FWD_DEFINED__
+typedef interface IEnumDefinitionIdentity IEnumDefinitionIdentity;
+#endif /* __IEnumDefinitionIdentity_FWD_DEFINED__ */
+
+
+#ifndef __IEnumReferenceIdentity_FWD_DEFINED__
+#define __IEnumReferenceIdentity_FWD_DEFINED__
+typedef interface IEnumReferenceIdentity IEnumReferenceIdentity;
+#endif /* __IEnumReferenceIdentity_FWD_DEFINED__ */
+
+
+/* header files for imported files */
+#include "unknwn.h"
+#include "oaidl.h"
+#include "ocidl.h"
+#include "propidl.h"
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+void * __RPC_USER MIDL_user_allocate(size_t);
+void __RPC_USER MIDL_user_free( void * );
+
+/* interface __MIDL_itf_isolation_0000 */
+/* [local] */
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+// {3B6DEF2E-5BB3-487f-B6C3-E888FF42A337}
+DEFINE_GUID(
+ SXS_INSTALL_REFERENCE_SCHEME_CSUTIL,
+ 0x3b6def2e,
+ 0x5bb3,
+ 0x487f,
+ 0xb6, 0xc3, 0xe8, 0x88, 0xff, 0x42, 0xa3, 0x37);
+
+// {8cedc215-ac4b-488b-93c0-a50a49cb2fb8}
+DEFINE_GUID(
+ SXS_INSTALL_REFERENCE_SCHEME_UNINSTALLKEY,
+ 0x8cedc215,
+ 0xac4b,
+ 0x488b,
+ 0x93, 0xc0, 0xa5, 0x0a, 0x49, 0xcb, 0x2f, 0xb8);
+
+// {b02f9d65-fb77-4f7a-afa5-b391309f11c9}
+DEFINE_GUID(
+ SXS_INSTALL_REFERENCE_SCHEME_KEYFILE,
+ 0xb02f9d65,
+ 0xfb77,
+ 0x4f7a,
+ 0xaf, 0xa5, 0xb3, 0x91, 0x30, 0x9f, 0x11, 0xc9);
+
+// {2ec93463-b0c3-45e1-8364-327e96aea856}
+DEFINE_GUID(
+ SXS_INSTALL_REFERENCE_SCHEME_OPAQUESTRING,
+ 0x2ec93463,
+ 0xb0c3,
+ 0x45e1,
+ 0x83, 0x64, 0x32, 0x7e, 0x96, 0xae, 0xa8, 0x56);
+
+// d16d444c-56d8-11d5-882d-0080c847b195
+DEFINE_GUID(
+ SXS_INSTALL_REFERENCE_SCHEME_OSINSTALL,
+ 0xd16d444c,
+ 0x56d8,
+ 0x11d5,
+ 0x88, 0x2d, 0x00, 0x80, 0xc8, 0x47, 0xb1, 0x95);
+
+//
+// Guid for the -installed by sxsinstallassemblyw, who knows?-
+// 27dec61e-b43c-4ac8-88db-e209a8242d90
+//
+DEFINE_GUID(
+ SXS_INSTALL_REFERENCE_SCHEME_SXS_INSTALL_ASSEMBLY,
+ 0x27dec61e,
+ 0xb43c,
+ 0x4ac8,
+ 0x88, 0xdb, 0xe2, 0x09, 0xa8, 0x24, 0x2d, 0x90);
+
+typedef struct _CULTURE_FALLBACK_LIST
+ {
+ SIZE_T nCultures;
+ /* [size_is] */ const LPCWSTR *prgpszCultures;
+ } CULTURE_FALLBACK_LIST;
+
+typedef struct _CULTURE_FALLBACK_LIST *PCULTURE_FALLBACK_LIST;
+
+typedef const CULTURE_FALLBACK_LIST *PCCULTURE_FALLBACK_LIST;
+
+typedef union _COMPONENT_VERSION
+ {
+ ULONGLONG Version64;
+ struct __MIDL___MIDL_itf_isolation_0000_0001
+ {
+ ULONG BuildAndRevision;
+ ULONG MajorAndMinor;
+ } Version32;
+ struct __MIDL___MIDL_itf_isolation_0000_0002
+ {
+ USHORT Revision;
+ USHORT Build;
+ USHORT Minor;
+ USHORT Major;
+ } Version16;
+ } COMPONENT_VERSION;
+
+typedef union _COMPONENT_VERSION *PCOMPONENT_VERSION;
+
+typedef const COMPONENT_VERSION *PCCOMPONENT_VERSION;
+
+
+
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0000_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0000_v0_0_s_ifspec;
+
+#ifndef __ISectionEntry_INTERFACE_DEFINED__
+#define __ISectionEntry_INTERFACE_DEFINED__
+
+/* interface ISectionEntry */
+/* [unique][uuid][object] */
+
+
+EXTERN_C const IID IID_ISectionEntry;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("285a8861-c84a-11d7-850f-005cd062464f")
+ ISectionEntry : public IUnknown
+ {
+ public:
+ virtual HRESULT STDMETHODCALLTYPE GetField(
+ /* [in] */ ULONG fieldId,
+ /* [retval][out] */ PROPVARIANT *fieldValue) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE GetFieldName(
+ /* [in] */ ULONG fieldId,
+ /* [retval][out] */ LPWSTR *pszFieldName) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct ISectionEntryVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ ISectionEntry * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ ISectionEntry * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ ISectionEntry * This);
+
+ HRESULT ( STDMETHODCALLTYPE *GetField )(
+ ISectionEntry * This,
+ /* [in] */ ULONG fieldId,
+ /* [retval][out] */ PROPVARIANT *fieldValue);
+
+ HRESULT ( STDMETHODCALLTYPE *GetFieldName )(
+ ISectionEntry * This,
+ /* [in] */ ULONG fieldId,
+ /* [retval][out] */ LPWSTR *pszFieldName);
+
+ END_INTERFACE
+ } ISectionEntryVtbl;
+
+ interface ISectionEntry
+ {
+ CONST_VTBL struct ISectionEntryVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define ISectionEntry_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define ISectionEntry_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define ISectionEntry_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define ISectionEntry_GetField(This,fieldId,fieldValue) \
+ (This)->lpVtbl -> GetField(This,fieldId,fieldValue)
+
+#define ISectionEntry_GetFieldName(This,fieldId,pszFieldName) \
+ (This)->lpVtbl -> GetFieldName(This,fieldId,pszFieldName)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+HRESULT STDMETHODCALLTYPE ISectionEntry_GetField_Proxy(
+ ISectionEntry * This,
+ /* [in] */ ULONG fieldId,
+ /* [retval][out] */ PROPVARIANT *fieldValue);
+
+
+void __RPC_STUB ISectionEntry_GetField_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE ISectionEntry_GetFieldName_Proxy(
+ ISectionEntry * This,
+ /* [in] */ ULONG fieldId,
+ /* [retval][out] */ LPWSTR *pszFieldName);
+
+
+void __RPC_STUB ISectionEntry_GetFieldName_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __ISectionEntry_INTERFACE_DEFINED__ */
+
+
+#ifndef __ISection_INTERFACE_DEFINED__
+#define __ISection_INTERFACE_DEFINED__
+
+/* interface ISection */
+/* [unique][uuid][object] */
+
+
+EXTERN_C const IID IID_ISection;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("285a8862-c84a-11d7-850f-005cd062464f")
+ ISection : public IUnknown
+ {
+ public:
+ virtual /* [restricted][propget] */ HRESULT STDMETHODCALLTYPE get__NewEnum(
+ /* [retval][out] */ IUnknown **ppunkSectionEntryEnum) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Count(
+ /* [retval][out] */ ULONG *pdwSectionEntryCount) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SectionID(
+ /* [retval][out] */ ULONG *pSectionId) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SectionName(
+ /* [retval][out] */ LPWSTR *pszSectionName) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct ISectionVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ ISection * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ ISection * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ ISection * This);
+
+ /* [restricted][propget] */ HRESULT ( STDMETHODCALLTYPE *get__NewEnum )(
+ ISection * This,
+ /* [retval][out] */ IUnknown **ppunkSectionEntryEnum);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Count )(
+ ISection * This,
+ /* [retval][out] */ ULONG *pdwSectionEntryCount);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_SectionID )(
+ ISection * This,
+ /* [retval][out] */ ULONG *pSectionId);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_SectionName )(
+ ISection * This,
+ /* [retval][out] */ LPWSTR *pszSectionName);
+
+ END_INTERFACE
+ } ISectionVtbl;
+
+ interface ISection
+ {
+ CONST_VTBL struct ISectionVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define ISection_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define ISection_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define ISection_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define ISection_get__NewEnum(This,ppunkSectionEntryEnum) \
+ (This)->lpVtbl -> get__NewEnum(This,ppunkSectionEntryEnum)
+
+#define ISection_get_Count(This,pdwSectionEntryCount) \
+ (This)->lpVtbl -> get_Count(This,pdwSectionEntryCount)
+
+#define ISection_get_SectionID(This,pSectionId) \
+ (This)->lpVtbl -> get_SectionID(This,pSectionId)
+
+#define ISection_get_SectionName(This,pszSectionName) \
+ (This)->lpVtbl -> get_SectionName(This,pszSectionName)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+/* [restricted][propget] */ HRESULT STDMETHODCALLTYPE ISection_get__NewEnum_Proxy(
+ ISection * This,
+ /* [retval][out] */ IUnknown **ppunkSectionEntryEnum);
+
+
+void __RPC_STUB ISection_get__NewEnum_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ISection_get_Count_Proxy(
+ ISection * This,
+ /* [retval][out] */ ULONG *pdwSectionEntryCount);
+
+
+void __RPC_STUB ISection_get_Count_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ISection_get_SectionID_Proxy(
+ ISection * This,
+ /* [retval][out] */ ULONG *pSectionId);
+
+
+void __RPC_STUB ISection_get_SectionID_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ISection_get_SectionName_Proxy(
+ ISection * This,
+ /* [retval][out] */ LPWSTR *pszSectionName);
+
+
+void __RPC_STUB ISection_get_SectionName_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __ISection_INTERFACE_DEFINED__ */
+
+
+#ifndef __ICDF_INTERFACE_DEFINED__
+#define __ICDF_INTERFACE_DEFINED__
+
+/* interface ICDF */
+/* [unique][uuid][object] */
+
+
+EXTERN_C const IID IID_ICDF;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("285a8860-c84a-11d7-850f-005cd062464f")
+ ICDF : public IUnknown
+ {
+ public:
+ virtual HRESULT STDMETHODCALLTYPE GetRootSection(
+ /* [in] */ ULONG SectionID,
+ /* [out] */ ISection **ppSection) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE GetRootSectionEntry(
+ /* [in] */ ULONG SectionID,
+ /* [out] */ ISectionEntry **ppSectionEntry) = 0;
+
+ virtual /* [restricted][propget] */ HRESULT STDMETHODCALLTYPE get__NewEnum(
+ /* [retval][out] */ IUnknown **ppunkEnum) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Count(
+ /* [retval][out] */ ULONG *pdwCount) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Item(
+ /* [in] */ ULONG SectionID,
+ /* [retval][out] */ IUnknown **ppUnknown) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct ICDFVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ ICDF * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ ICDF * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ ICDF * This);
+
+ HRESULT ( STDMETHODCALLTYPE *GetRootSection )(
+ ICDF * This,
+ /* [in] */ ULONG SectionID,
+ /* [out] */ ISection **ppSection);
+
+ HRESULT ( STDMETHODCALLTYPE *GetRootSectionEntry )(
+ ICDF * This,
+ /* [in] */ ULONG SectionID,
+ /* [out] */ ISectionEntry **ppSectionEntry);
+
+ /* [restricted][propget] */ HRESULT ( STDMETHODCALLTYPE *get__NewEnum )(
+ ICDF * This,
+ /* [retval][out] */ IUnknown **ppunkEnum);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Count )(
+ ICDF * This,
+ /* [retval][out] */ ULONG *pdwCount);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Item )(
+ ICDF * This,
+ /* [in] */ ULONG SectionID,
+ /* [retval][out] */ IUnknown **ppUnknown);
+
+ END_INTERFACE
+ } ICDFVtbl;
+
+ interface ICDF
+ {
+ CONST_VTBL struct ICDFVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define ICDF_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define ICDF_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define ICDF_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define ICDF_GetRootSection(This,SectionID,ppSection) \
+ (This)->lpVtbl -> GetRootSection(This,SectionID,ppSection)
+
+#define ICDF_GetRootSectionEntry(This,SectionID,ppSectionEntry) \
+ (This)->lpVtbl -> GetRootSectionEntry(This,SectionID,ppSectionEntry)
+
+#define ICDF_get__NewEnum(This,ppunkEnum) \
+ (This)->lpVtbl -> get__NewEnum(This,ppunkEnum)
+
+#define ICDF_get_Count(This,pdwCount) \
+ (This)->lpVtbl -> get_Count(This,pdwCount)
+
+#define ICDF_get_Item(This,SectionID,ppUnknown) \
+ (This)->lpVtbl -> get_Item(This,SectionID,ppUnknown)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+HRESULT STDMETHODCALLTYPE ICDF_GetRootSection_Proxy(
+ ICDF * This,
+ /* [in] */ ULONG SectionID,
+ /* [out] */ ISection **ppSection);
+
+
+void __RPC_STUB ICDF_GetRootSection_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE ICDF_GetRootSectionEntry_Proxy(
+ ICDF * This,
+ /* [in] */ ULONG SectionID,
+ /* [out] */ ISectionEntry **ppSectionEntry);
+
+
+void __RPC_STUB ICDF_GetRootSectionEntry_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [restricted][propget] */ HRESULT STDMETHODCALLTYPE ICDF_get__NewEnum_Proxy(
+ ICDF * This,
+ /* [retval][out] */ IUnknown **ppunkEnum);
+
+
+void __RPC_STUB ICDF_get__NewEnum_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ICDF_get_Count_Proxy(
+ ICDF * This,
+ /* [retval][out] */ ULONG *pdwCount);
+
+
+void __RPC_STUB ICDF_get_Count_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ICDF_get_Item_Proxy(
+ ICDF * This,
+ /* [in] */ ULONG SectionID,
+ /* [retval][out] */ IUnknown **ppUnknown);
+
+
+void __RPC_STUB ICDF_get_Item_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __ICDF_INTERFACE_DEFINED__ */
+
+
+#ifndef __ISectionWithStringKey_INTERFACE_DEFINED__
+#define __ISectionWithStringKey_INTERFACE_DEFINED__
+
+/* interface ISectionWithStringKey */
+/* [unique][uuid][object] */
+
+
+EXTERN_C const IID IID_ISectionWithStringKey;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("285a8871-c84a-11d7-850f-005cd062464f")
+ ISectionWithStringKey : public IUnknown
+ {
+ public:
+ virtual HRESULT STDMETHODCALLTYPE Lookup(
+ /* [in] */ LPCWSTR wzStringKey,
+ /* [out] */ IUnknown **ppUnknown) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_IsCaseInsensitive(
+ /* [retval][out] */ VARIANT_BOOL *pbIsCaseInsentitive) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct ISectionWithStringKeyVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ ISectionWithStringKey * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ ISectionWithStringKey * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ ISectionWithStringKey * This);
+
+ HRESULT ( STDMETHODCALLTYPE *Lookup )(
+ ISectionWithStringKey * This,
+ /* [in] */ LPCWSTR wzStringKey,
+ /* [out] */ IUnknown **ppUnknown);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_IsCaseInsensitive )(
+ ISectionWithStringKey * This,
+ /* [retval][out] */ VARIANT_BOOL *pbIsCaseInsentitive);
+
+ END_INTERFACE
+ } ISectionWithStringKeyVtbl;
+
+ interface ISectionWithStringKey
+ {
+ CONST_VTBL struct ISectionWithStringKeyVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define ISectionWithStringKey_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define ISectionWithStringKey_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define ISectionWithStringKey_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define ISectionWithStringKey_Lookup(This,wzStringKey,ppUnknown) \
+ (This)->lpVtbl -> Lookup(This,wzStringKey,ppUnknown)
+
+#define ISectionWithStringKey_get_IsCaseInsensitive(This,pbIsCaseInsentitive) \
+ (This)->lpVtbl -> get_IsCaseInsensitive(This,pbIsCaseInsentitive)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+HRESULT STDMETHODCALLTYPE ISectionWithStringKey_Lookup_Proxy(
+ ISectionWithStringKey * This,
+ /* [in] */ LPCWSTR wzStringKey,
+ /* [out] */ IUnknown **ppUnknown);
+
+
+void __RPC_STUB ISectionWithStringKey_Lookup_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ISectionWithStringKey_get_IsCaseInsensitive_Proxy(
+ ISectionWithStringKey * This,
+ /* [retval][out] */ VARIANT_BOOL *pbIsCaseInsentitive);
+
+
+void __RPC_STUB ISectionWithStringKey_get_IsCaseInsensitive_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __ISectionWithStringKey_INTERFACE_DEFINED__ */
+
+
+#ifndef __ISectionWithBlobKey_INTERFACE_DEFINED__
+#define __ISectionWithBlobKey_INTERFACE_DEFINED__
+
+/* interface ISectionWithBlobKey */
+/* [unique][uuid][object] */
+
+
+EXTERN_C const IID IID_ISectionWithBlobKey;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("285a8872-c84a-11d7-850f-005cd062464f")
+ ISectionWithBlobKey : public IUnknown
+ {
+ public:
+ virtual HRESULT STDMETHODCALLTYPE Lookup(
+ /* [size_is][in] */ byte *pBlobKey,
+ /* [in] */ ULONG ulBlobSize,
+ /* [out] */ IUnknown **ppUnknown) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct ISectionWithBlobKeyVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ ISectionWithBlobKey * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ ISectionWithBlobKey * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ ISectionWithBlobKey * This);
+
+ HRESULT ( STDMETHODCALLTYPE *Lookup )(
+ ISectionWithBlobKey * This,
+ /* [size_is][in] */ byte *pBlobKey,
+ /* [in] */ ULONG ulBlobSize,
+ /* [out] */ IUnknown **ppUnknown);
+
+ END_INTERFACE
+ } ISectionWithBlobKeyVtbl;
+
+ interface ISectionWithBlobKey
+ {
+ CONST_VTBL struct ISectionWithBlobKeyVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define ISectionWithBlobKey_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define ISectionWithBlobKey_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define ISectionWithBlobKey_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define ISectionWithBlobKey_Lookup(This,pBlobKey,ulBlobSize,ppUnknown) \
+ (This)->lpVtbl -> Lookup(This,pBlobKey,ulBlobSize,ppUnknown)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+HRESULT STDMETHODCALLTYPE ISectionWithBlobKey_Lookup_Proxy(
+ ISectionWithBlobKey * This,
+ /* [size_is][in] */ byte *pBlobKey,
+ /* [in] */ ULONG ulBlobSize,
+ /* [out] */ IUnknown **ppUnknown);
+
+
+void __RPC_STUB ISectionWithBlobKey_Lookup_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __ISectionWithBlobKey_INTERFACE_DEFINED__ */
+
+
+#ifndef __ISectionWithGuidKey_INTERFACE_DEFINED__
+#define __ISectionWithGuidKey_INTERFACE_DEFINED__
+
+/* interface ISectionWithGuidKey */
+/* [unique][uuid][object] */
+
+
+EXTERN_C const IID IID_ISectionWithGuidKey;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("285a8873-c84a-11d7-850f-005cd062464f")
+ ISectionWithGuidKey : public IUnknown
+ {
+ public:
+ virtual HRESULT STDMETHODCALLTYPE Lookup(
+ /* [in] */ const GUID *pGuidKey,
+ /* [out] */ IUnknown **ppUnknown) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct ISectionWithGuidKeyVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ ISectionWithGuidKey * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ ISectionWithGuidKey * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ ISectionWithGuidKey * This);
+
+ HRESULT ( STDMETHODCALLTYPE *Lookup )(
+ ISectionWithGuidKey * This,
+ /* [in] */ const GUID *pGuidKey,
+ /* [out] */ IUnknown **ppUnknown);
+
+ END_INTERFACE
+ } ISectionWithGuidKeyVtbl;
+
+ interface ISectionWithGuidKey
+ {
+ CONST_VTBL struct ISectionWithGuidKeyVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define ISectionWithGuidKey_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define ISectionWithGuidKey_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define ISectionWithGuidKey_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define ISectionWithGuidKey_Lookup(This,pGuidKey,ppUnknown) \
+ (This)->lpVtbl -> Lookup(This,pGuidKey,ppUnknown)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+HRESULT STDMETHODCALLTYPE ISectionWithGuidKey_Lookup_Proxy(
+ ISectionWithGuidKey * This,
+ /* [in] */ const GUID *pGuidKey,
+ /* [out] */ IUnknown **ppUnknown);
+
+
+void __RPC_STUB ISectionWithGuidKey_Lookup_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __ISectionWithGuidKey_INTERFACE_DEFINED__ */
+
+
+#ifndef __ISectionWithIntegerKey_INTERFACE_DEFINED__
+#define __ISectionWithIntegerKey_INTERFACE_DEFINED__
+
+/* interface ISectionWithIntegerKey */
+/* [unique][uuid][object] */
+
+
+EXTERN_C const IID IID_ISectionWithIntegerKey;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("285a8874-c84a-11d7-850f-005cd062464f")
+ ISectionWithIntegerKey : public IUnknown
+ {
+ public:
+ virtual HRESULT STDMETHODCALLTYPE Lookup(
+ /* [in] */ ULONG ulIntegerKey,
+ /* [out] */ IUnknown **ppUnknown) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct ISectionWithIntegerKeyVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ ISectionWithIntegerKey * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ ISectionWithIntegerKey * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ ISectionWithIntegerKey * This);
+
+ HRESULT ( STDMETHODCALLTYPE *Lookup )(
+ ISectionWithIntegerKey * This,
+ /* [in] */ ULONG ulIntegerKey,
+ /* [out] */ IUnknown **ppUnknown);
+
+ END_INTERFACE
+ } ISectionWithIntegerKeyVtbl;
+
+ interface ISectionWithIntegerKey
+ {
+ CONST_VTBL struct ISectionWithIntegerKeyVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define ISectionWithIntegerKey_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define ISectionWithIntegerKey_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define ISectionWithIntegerKey_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define ISectionWithIntegerKey_Lookup(This,ulIntegerKey,ppUnknown) \
+ (This)->lpVtbl -> Lookup(This,ulIntegerKey,ppUnknown)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+HRESULT STDMETHODCALLTYPE ISectionWithIntegerKey_Lookup_Proxy(
+ ISectionWithIntegerKey * This,
+ /* [in] */ ULONG ulIntegerKey,
+ /* [out] */ IUnknown **ppUnknown);
+
+
+void __RPC_STUB ISectionWithIntegerKey_Lookup_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __ISectionWithIntegerKey_INTERFACE_DEFINED__ */
+
+
+#ifndef __ISectionWithDefinitionIdentityKey_INTERFACE_DEFINED__
+#define __ISectionWithDefinitionIdentityKey_INTERFACE_DEFINED__
+
+/* interface ISectionWithDefinitionIdentityKey */
+/* [unique][uuid][object] */
+
+
+EXTERN_C const IID IID_ISectionWithDefinitionIdentityKey;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("285a8875-c84a-11d7-850f-005cd062464f")
+ ISectionWithDefinitionIdentityKey : public IUnknown
+ {
+ public:
+ virtual HRESULT STDMETHODCALLTYPE Lookup(
+ /* [in] */ IDefinitionIdentity *pDefinitionIdentityKey,
+ /* [out] */ IUnknown **ppUnknown) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct ISectionWithDefinitionIdentityKeyVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ ISectionWithDefinitionIdentityKey * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ ISectionWithDefinitionIdentityKey * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ ISectionWithDefinitionIdentityKey * This);
+
+ HRESULT ( STDMETHODCALLTYPE *Lookup )(
+ ISectionWithDefinitionIdentityKey * This,
+ /* [in] */ IDefinitionIdentity *pDefinitionIdentityKey,
+ /* [out] */ IUnknown **ppUnknown);
+
+ END_INTERFACE
+ } ISectionWithDefinitionIdentityKeyVtbl;
+
+ interface ISectionWithDefinitionIdentityKey
+ {
+ CONST_VTBL struct ISectionWithDefinitionIdentityKeyVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define ISectionWithDefinitionIdentityKey_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define ISectionWithDefinitionIdentityKey_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define ISectionWithDefinitionIdentityKey_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define ISectionWithDefinitionIdentityKey_Lookup(This,pDefinitionIdentityKey,ppUnknown) \
+ (This)->lpVtbl -> Lookup(This,pDefinitionIdentityKey,ppUnknown)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+HRESULT STDMETHODCALLTYPE ISectionWithDefinitionIdentityKey_Lookup_Proxy(
+ ISectionWithDefinitionIdentityKey * This,
+ /* [in] */ IDefinitionIdentity *pDefinitionIdentityKey,
+ /* [out] */ IUnknown **ppUnknown);
+
+
+void __RPC_STUB ISectionWithDefinitionIdentityKey_Lookup_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __ISectionWithDefinitionIdentityKey_INTERFACE_DEFINED__ */
+
+
+#ifndef __ISectionWithReferenceIdentityKey_INTERFACE_DEFINED__
+#define __ISectionWithReferenceIdentityKey_INTERFACE_DEFINED__
+
+/* interface ISectionWithReferenceIdentityKey */
+/* [unique][uuid][object] */
+
+
+EXTERN_C const IID IID_ISectionWithReferenceIdentityKey;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("285a8876-c84a-11d7-850f-005cd062464f")
+ ISectionWithReferenceIdentityKey : public IUnknown
+ {
+ public:
+ virtual HRESULT STDMETHODCALLTYPE Lookup(
+ /* [in] */ IReferenceIdentity *pReferenceIdentityKey,
+ /* [out] */ IUnknown **ppUnknown) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct ISectionWithReferenceIdentityKeyVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ ISectionWithReferenceIdentityKey * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ ISectionWithReferenceIdentityKey * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ ISectionWithReferenceIdentityKey * This);
+
+ HRESULT ( STDMETHODCALLTYPE *Lookup )(
+ ISectionWithReferenceIdentityKey * This,
+ /* [in] */ IReferenceIdentity *pReferenceIdentityKey,
+ /* [out] */ IUnknown **ppUnknown);
+
+ END_INTERFACE
+ } ISectionWithReferenceIdentityKeyVtbl;
+
+ interface ISectionWithReferenceIdentityKey
+ {
+ CONST_VTBL struct ISectionWithReferenceIdentityKeyVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define ISectionWithReferenceIdentityKey_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define ISectionWithReferenceIdentityKey_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define ISectionWithReferenceIdentityKey_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define ISectionWithReferenceIdentityKey_Lookup(This,pReferenceIdentityKey,ppUnknown) \
+ (This)->lpVtbl -> Lookup(This,pReferenceIdentityKey,ppUnknown)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+HRESULT STDMETHODCALLTYPE ISectionWithReferenceIdentityKey_Lookup_Proxy(
+ ISectionWithReferenceIdentityKey * This,
+ /* [in] */ IReferenceIdentity *pReferenceIdentityKey,
+ /* [out] */ IUnknown **ppUnknown);
+
+
+void __RPC_STUB ISectionWithReferenceIdentityKey_Lookup_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __ISectionWithReferenceIdentityKey_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_isolation_0278 */
+/* [local] */
+
+typedef
+enum _CMSSECTIONID
+ { CMSSECTIONID_FILE_SECTION = 1,
+ CMSSECTIONID_CATEGORY_INSTANCE_SECTION = 2,
+ CMSSECTIONID_COM_REDIRECTION_SECTION = 3,
+ CMSSECTIONID_PROGID_REDIRECTION_SECTION = 4,
+ CMSSECTIONID_CLR_SURROGATE_SECTION = 5,
+ CMSSECTIONID_ASSEMBLY_REFERENCE_SECTION = 6,
+ CMSSECTIONID_WINDOW_CLASS_SECTION = 8,
+ CMSSECTIONID_STRING_SECTION = 9,
+ CMSSECTIONID_ENTRYPOINT_SECTION = 10,
+ CMSSECTIONID_PERMISSION_SET_SECTION = 11,
+ CMSSECTIONENTRYID_METADATA = 12,
+ CMSSECTIONID_ASSEMBLY_REQUEST_SECTION = 13,
+ CMSSECTIONID_REGISTRY_KEY_SECTION = 16,
+ CMSSECTIONID_DIRECTORY_SECTION = 17,
+ CMSSECTIONID_FILE_ASSOCIATION_SECTION = 18,
+ CMSSECTIONID_COMPATIBLE_FRAMEWORKS_SECTION = 19,
+ CMSSECTIONID_EVENT_SECTION = 101,
+ CMSSECTIONID_EVENT_MAP_SECTION = 102,
+ CMSSECTIONID_EVENT_TAG_SECTION = 103,
+ CMSSECTIONID_COUNTERSET_SECTION = 110,
+ CMSSECTIONID_COUNTER_SECTION = 111
+ } CMSSECTIONID;
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+enum __MIDL___MIDL_itf_isolation_0278_0001
+ { CMS_ASSEMBLY_DEPLOYMENT_FLAG_BEFORE_APPLICATION_STARTUP = 4,
+ CMS_ASSEMBLY_DEPLOYMENT_FLAG_RUN_AFTER_INSTALL = 16,
+ CMS_ASSEMBLY_DEPLOYMENT_FLAG_INSTALL = 32,
+ CMS_ASSEMBLY_DEPLOYMENT_FLAG_TRUST_URL_PARAMETERS = 64,
+ CMS_ASSEMBLY_DEPLOYMENT_FLAG_DISALLOW_URL_ACTIVATION = 128,
+ CMS_ASSEMBLY_DEPLOYMENT_FLAG_MAP_FILE_EXTENSIONS = 256,
+ CMS_ASSEMBLY_DEPLOYMENT_FLAG_CREATE_DESKTOP_SHORTCUT = 512
+ } ;
+
+enum __MIDL___MIDL_itf_isolation_0278_0002
+ { CMS_ASSEMBLY_REFERENCE_FLAG_OPTIONAL = 1,
+ CMS_ASSEMBLY_REFERENCE_FLAG_VISIBLE = 2,
+ CMS_ASSEMBLY_REFERENCE_FLAG_FOLLOW = 4,
+ CMS_ASSEMBLY_REFERENCE_FLAG_IS_PLATFORM = 8,
+ CMS_ASSEMBLY_REFERENCE_FLAG_CULTURE_WILDCARDED = 16,
+ CMS_ASSEMBLY_REFERENCE_FLAG_PROCESSOR_ARCHITECTURE_WILDCARDED = 32,
+ CMS_ASSEMBLY_REFERENCE_FLAG_PREREQUISITE = 128
+ } ;
+
+enum __MIDL___MIDL_itf_isolation_0278_0003
+ { CMS_ASSEMBLY_REFERENCE_DEPENDENT_ASSEMBLY_FLAG_OPTIONAL = 1,
+ CMS_ASSEMBLY_REFERENCE_DEPENDENT_ASSEMBLY_FLAG_VISIBLE = 2,
+ CMS_ASSEMBLY_REFERENCE_DEPENDENT_ASSEMBLY_FLAG_PREREQUISITE = 4,
+ CMS_ASSEMBLY_REFERENCE_DEPENDENT_ASSEMBLY_FLAG_RESOURCE_FALLBACK_CULTURE_INTERNAL = 8,
+ CMS_ASSEMBLY_REFERENCE_DEPENDENT_ASSEMBLY_FLAG_INSTALL = 16,
+ CMS_ASSEMBLY_REFERENCE_DEPENDENT_ASSEMBLY_FLAG_ALLOW_DELAYED_BINDING = 32
+ } ;
+
+enum __MIDL___MIDL_itf_isolation_0278_0004
+ { CMS_FILE_FLAG_OPTIONAL = 1
+ } ;
+
+enum __MIDL___MIDL_itf_isolation_0278_0005
+ { CMS_ENTRY_POINT_FLAG_HOST_IN_BROWSER = 1,
+ CMS_ENTRY_POINT_FLAG_CUSTOMHOSTSPECIFIED = 2,
+ CMS_ENTRY_POINT_FLAG_CUSTOMUX = 4
+ } ;
+
+enum __MIDL___MIDL_itf_isolation_0278_0006
+ { CMS_COM_SERVER_FLAG_IS_CLR_CLASS = 1
+ } ;
+
+enum __MIDL___MIDL_itf_isolation_0278_0007
+ { CMS_REGISTRY_KEY_FLAG_OWNER = 1,
+ CMS_REGISTRY_KEY_FLAG_LEAF_IN_MANIFEST = 2
+ } ;
+
+enum __MIDL___MIDL_itf_isolation_0278_0008
+ { CMS_REGISTRY_VALUE_FLAG_OWNER = 1
+ } ;
+
+enum __MIDL___MIDL_itf_isolation_0278_0009
+ { CMS_DIRECTORY_FLAG_OWNER = 1
+ } ;
+
+enum __MIDL___MIDL_itf_isolation_0278_0010
+ { CMS_MANIFEST_FLAG_ASSEMBLY = 1,
+ CMS_MANIFEST_FLAG_CATEGORY = 2,
+ CMS_MANIFEST_FLAG_FEATURE = 3,
+ CMS_MANIFEST_FLAG_APPLICATION = 4,
+ CMS_MANIFEST_FLAG_USEMANIFESTFORTRUST = 8
+ } ;
+
+enum __MIDL___MIDL_itf_isolation_0278_0011
+ { CMS_USAGE_PATTERN_SCOPE_APPLICATION = 1,
+ CMS_USAGE_PATTERN_SCOPE_PROCESS = 2,
+ CMS_USAGE_PATTERN_SCOPE_MACHINE = 3,
+ CMS_USAGE_PATTERN_SCOPE_MASK = 7
+ } ;
+typedef
+enum _CMS_SCHEMA_VERSION
+ { CMS_SCHEMA_VERSION_V1 = 1,
+ CMS_SCHEMA_VERSION_V2 = 2
+ } CMS_SCHEMA_VERSION;
+
+typedef enum _CMS_SCHEMA_VERSION *PCMS_SCHEMA_VERSION;
+
+typedef const CMS_SCHEMA_VERSION *PCCMS_SCHEMA_VERSION;
+
+typedef
+enum _CMS_FILE_HASH_ALGORITHM
+ { CMS_FILE_HASH_ALGORITHM_SHA1 = 1,
+ CMS_FILE_HASH_ALGORITHM_SHA256 = 2,
+ CMS_FILE_HASH_ALGORITHM_SHA384 = 3,
+ CMS_FILE_HASH_ALGORITHM_SHA512 = 4,
+ CMS_FILE_HASH_ALGORITHM_MD5 = 5,
+ CMS_FILE_HASH_ALGORITHM_MD4 = 6,
+ CMS_FILE_HASH_ALGORITHM_MD2 = 7
+ } CMS_FILE_HASH_ALGORITHM;
+
+typedef enum _CMS_FILE_HASH_ALGORITHM *PCMS_FILE_HASH_ALGORITHM;
+
+typedef const CMS_FILE_HASH_ALGORITHM *PCCMS_FILE_HASH_ALGORITHM;
+
+typedef
+enum _CMS_TIME_UNIT_TYPE
+ { CMS_TIME_UNIT_TYPE_HOURS = 1,
+ CMS_TIME_UNIT_TYPE_DAYS = 2,
+ CMS_TIME_UNIT_TYPE_WEEKS = 3,
+ CMS_TIME_UNIT_TYPE_MONTHS = 4
+ } CMS_TIME_UNIT_TYPE;
+
+typedef enum _CMS_TIME_UNIT_TYPE *PCMS_TIME_UNIT_TYPE;
+
+typedef const CMS_TIME_UNIT_TYPE *PCCMS_TIME_UNIT_TYPE;
+
+typedef
+enum _CMS_REGISTRY_VALUE_TYPE
+ { CMS_REGISTRY_VALUE_TYPE_NONE = 0,
+ CMS_REGISTRY_VALUE_TYPE_SZ = 1,
+ CMS_REGISTRY_VALUE_TYPE_EXPAND_SZ = 2,
+ CMS_REGISTRY_VALUE_TYPE_MULTI_SZ = 3,
+ CMS_REGISTRY_VALUE_TYPE_BINARY = 4,
+ CMS_REGISTRY_VALUE_TYPE_DWORD = 5,
+ CMS_REGISTRY_VALUE_TYPE_DWORD_LITTLE_ENDIAN = 6,
+ CMS_REGISTRY_VALUE_TYPE_DWORD_BIG_ENDIAN = 7,
+ CMS_REGISTRY_VALUE_TYPE_LINK = 8,
+ CMS_REGISTRY_VALUE_TYPE_RESOURCE_LIST = 9,
+ CMS_REGISTRY_VALUE_TYPE_FULL_RESOURCE_DESCRIPTOR = 10,
+ CMS_REGISTRY_VALUE_TYPE_RESOURCE_REQUIREMENTS_LIST = 11,
+ CMS_REGISTRY_VALUE_TYPE_QWORD = 12,
+ CMS_REGISTRY_VALUE_TYPE_QWORD_LITTLE_ENDIAN = 13
+ } CMS_REGISTRY_VALUE_TYPE;
+
+typedef enum _CMS_REGISTRY_VALUE_TYPE *PCMS_REGISTRY_VALUE_TYPE;
+
+typedef const CMS_REGISTRY_VALUE_TYPE *PCCMS_REGISTRY_VALUE_TYPE;
+
+typedef
+enum _CMS_REGISTRY_VALUE_HINT
+ { CMS_REGISTRY_VALUE_HINT_REPLACE = 1,
+ CMS_REGISTRY_VALUE_HINT_APPEND = 2,
+ CMS_REGISTRY_VALUE_HINT_PREPEND = 3
+ } CMS_REGISTRY_VALUE_HINT;
+
+typedef enum _CMS_REGISTRY_VALUE_HINT *PCMS_REGISTRY_VALUE_HINT;
+
+typedef const CMS_REGISTRY_VALUE_HINT *PCCMS_REGISTRY_VALUE_HINT;
+
+typedef
+enum _CMS_SYSTEM_PROTECTION
+ { CMS_SYSTEM_PROTECTION_READ_ONLY_IGNORE_WRITES = 1,
+ CMS_SYSTEM_PROTECTION_READ_ONLY_FAIL_WRITES = 2,
+ CMS_SYSTEM_PROTECTION_OS_ONLY_IGNORE_WRITES = 3,
+ CMS_SYSTEM_PROTECTION_OS_ONLY_FAIL_WRITES = 4,
+ CMS_SYSTEM_PROTECTION_TRANSACTED = 5,
+ CMS_SYSTEM_PROTECTION_APPLICATION_VIRTUALIZED = 6,
+ CMS_SYSTEM_PROTECTION_USER_VIRTUALIZED = 7,
+ CMS_SYSTEM_PROTECTION_APPLICATION_AND_USER_VIRTUALIZED = 8,
+ CMS_SYSTEM_PROTECTION_INHERIT = 9,
+ CMS_SYSTEM_PROTECTION_NOT_PROTECTED = 10
+ } CMS_SYSTEM_PROTECTION;
+
+typedef enum _CMS_SYSTEM_PROTECTION *PCMS_SYSTEM_PROTECTION;
+
+typedef const CMS_SYSTEM_PROTECTION *PCCMS_SYSTEM_PROTECTION;
+
+typedef
+enum _CMS_FILE_WRITABLE_TYPE
+ { CMS_FILE_WRITABLE_TYPE_NOT_WRITABLE = 1,
+ CMS_FILE_WRITABLE_TYPE_APPLICATION_DATA = 2
+ } CMS_FILE_WRITABLE_TYPE;
+
+typedef enum _CMS_FILE_WRITABLE_TYPE *PCMS_FILE_WRITABLE_TYPE;
+
+typedef const CMS_FILE_WRITABLE_TYPE *PCCMS_FILE_WRITABLE_TYPE;
+
+typedef
+enum _CMS_HASH_TRANSFORM
+ { CMS_HASH_TRANSFORM_IDENTITY = 1,
+ CMS_HASH_TRANSFORM_MANIFESTINVARIANT = 2
+ } CMS_HASH_TRANSFORM;
+
+typedef enum _CMS_HASH_TRANSFORM *PCMS_HASH_TRANSFORM;
+
+typedef const CMS_HASH_TRANSFORM *PCCMS_HASH_TRANSFORM;
+
+typedef
+enum _CMS_HASH_DIGESTMETHOD
+ { CMS_HASH_DIGESTMETHOD_SHA1 = 1,
+ CMS_HASH_DIGESTMETHOD_SHA256 = 2,
+ CMS_HASH_DIGESTMETHOD_SHA384 = 3,
+ CMS_HASH_DIGESTMETHOD_SHA512 = 4
+ } CMS_HASH_DIGESTMETHOD;
+
+typedef enum _CMS_HASH_DIGESTMETHOD *PCMS_HASH_DIGESTMETHOD;
+
+typedef const CMS_HASH_DIGESTMETHOD *PCCMS_HASH_DIGESTMETHOD;
+
+
+
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0278_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0278_v0_0_s_ifspec;
+
+#ifndef __ICMS_INTERFACE_DEFINED__
+#define __ICMS_INTERFACE_DEFINED__
+
+/* interface ICMS */
+/* [unique][uuid][object] */
+
+
+EXTERN_C const IID IID_ICMS;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("a504e5b0-8ccf-4cb4-9902-c9d1b9abd033")
+ ICMS : public IUnknown
+ {
+ public:
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Identity(
+ /* [retval][out] */ IDefinitionIdentity **__MIDL_0015) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_FileSection(
+ /* [retval][out] */ ISection **__MIDL_0016) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_CategoryMembershipSection(
+ /* [retval][out] */ ISection **__MIDL_0017) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_COMRedirectionSection(
+ /* [retval][out] */ ISection **__MIDL_0018) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ProgIdRedirectionSection(
+ /* [retval][out] */ ISection **__MIDL_0019) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_CLRSurrogateSection(
+ /* [retval][out] */ ISection **__MIDL_0020) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AssemblyReferenceSection(
+ /* [retval][out] */ ISection **__MIDL_0021) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_WindowClassSection(
+ /* [retval][out] */ ISection **__MIDL_0022) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_StringSection(
+ /* [retval][out] */ ISection **__MIDL_0023) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_EntryPointSection(
+ /* [retval][out] */ ISection **__MIDL_0024) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_PermissionSetSection(
+ /* [retval][out] */ ISection **__MIDL_0025) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_MetadataSectionEntry(
+ /* [retval][out] */ ISectionEntry **__MIDL_0026) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AssemblyRequestSection(
+ /* [retval][out] */ ISection **__MIDL_0027) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_RegistryKeySection(
+ /* [retval][out] */ ISection **__MIDL_0028) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_DirectorySection(
+ /* [retval][out] */ ISection **__MIDL_0029) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_FileAssociationSection(
+ /* [retval][out] */ ISection **__MIDL_0030) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_CompatibleFrameworksSection(
+ /* [retval][out] */ ISection **__MIDL_0031) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_EventSection(
+ /* [retval][out] */ ISection **__MIDL_0032) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_EventMapSection(
+ /* [retval][out] */ ISection **__MIDL_0033) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_EventTagSection(
+ /* [retval][out] */ ISection **__MIDL_0034) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_CounterSetSection(
+ /* [retval][out] */ ISection **__MIDL_0035) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_CounterSection(
+ /* [retval][out] */ ISection **__MIDL_0036) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct ICMSVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ ICMS * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ ICMS * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ ICMS * This);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Identity )(
+ ICMS * This,
+ /* [retval][out] */ IDefinitionIdentity **__MIDL_0015);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FileSection )(
+ ICMS * This,
+ /* [retval][out] */ ISection **__MIDL_0016);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_CategoryMembershipSection )(
+ ICMS * This,
+ /* [retval][out] */ ISection **__MIDL_0017);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_COMRedirectionSection )(
+ ICMS * This,
+ /* [retval][out] */ ISection **__MIDL_0018);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ProgIdRedirectionSection )(
+ ICMS * This,
+ /* [retval][out] */ ISection **__MIDL_0019);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_CLRSurrogateSection )(
+ ICMS * This,
+ /* [retval][out] */ ISection **__MIDL_0020);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AssemblyReferenceSection )(
+ ICMS * This,
+ /* [retval][out] */ ISection **__MIDL_0021);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_WindowClassSection )(
+ ICMS * This,
+ /* [retval][out] */ ISection **__MIDL_0022);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_StringSection )(
+ ICMS * This,
+ /* [retval][out] */ ISection **__MIDL_0023);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_EntryPointSection )(
+ ICMS * This,
+ /* [retval][out] */ ISection **__MIDL_0024);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_PermissionSetSection )(
+ ICMS * This,
+ /* [retval][out] */ ISection **__MIDL_0025);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_MetadataSectionEntry )(
+ ICMS * This,
+ /* [retval][out] */ ISectionEntry **__MIDL_0026);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AssemblyRequestSection )(
+ ICMS * This,
+ /* [retval][out] */ ISection **__MIDL_0027);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_RegistryKeySection )(
+ ICMS * This,
+ /* [retval][out] */ ISection **__MIDL_0028);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_DirectorySection )(
+ ICMS * This,
+ /* [retval][out] */ ISection **__MIDL_0029);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FileAssociationSection )(
+ ICMS * This,
+ /* [retval][out] */ ISection **__MIDL_0030);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_CompatibleFrameworksSection )(
+ ICMS * This,
+ /* [retval][out] */ ISection **__MIDL_0031);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_EventSection )(
+ ICMS * This,
+ /* [retval][out] */ ISection **__MIDL_0032);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_EventMapSection )(
+ ICMS * This,
+ /* [retval][out] */ ISection **__MIDL_0033);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_EventTagSection )(
+ ICMS * This,
+ /* [retval][out] */ ISection **__MIDL_0034);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_CounterSetSection )(
+ ICMS * This,
+ /* [retval][out] */ ISection **__MIDL_0035);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_CounterSection )(
+ ICMS * This,
+ /* [retval][out] */ ISection **__MIDL_0036);
+
+ END_INTERFACE
+ } ICMSVtbl;
+
+ interface ICMS
+ {
+ CONST_VTBL struct ICMSVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define ICMS_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define ICMS_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define ICMS_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define ICMS_get_Identity(This,__MIDL_0015) \
+ (This)->lpVtbl -> get_Identity(This,__MIDL_0015)
+
+#define ICMS_get_FileSection(This,__MIDL_0016) \
+ (This)->lpVtbl -> get_FileSection(This,__MIDL_0016)
+
+#define ICMS_get_CategoryMembershipSection(This,__MIDL_0017) \
+ (This)->lpVtbl -> get_CategoryMembershipSection(This,__MIDL_0017)
+
+#define ICMS_get_COMRedirectionSection(This,__MIDL_0018) \
+ (This)->lpVtbl -> get_COMRedirectionSection(This,__MIDL_0018)
+
+#define ICMS_get_ProgIdRedirectionSection(This,__MIDL_0019) \
+ (This)->lpVtbl -> get_ProgIdRedirectionSection(This,__MIDL_0019)
+
+#define ICMS_get_CLRSurrogateSection(This,__MIDL_0020) \
+ (This)->lpVtbl -> get_CLRSurrogateSection(This,__MIDL_0020)
+
+#define ICMS_get_AssemblyReferenceSection(This,__MIDL_0021) \
+ (This)->lpVtbl -> get_AssemblyReferenceSection(This,__MIDL_0021)
+
+#define ICMS_get_WindowClassSection(This,__MIDL_0022) \
+ (This)->lpVtbl -> get_WindowClassSection(This,__MIDL_0022)
+
+#define ICMS_get_StringSection(This,__MIDL_0023) \
+ (This)->lpVtbl -> get_StringSection(This,__MIDL_0023)
+
+#define ICMS_get_EntryPointSection(This,__MIDL_0024) \
+ (This)->lpVtbl -> get_EntryPointSection(This,__MIDL_0024)
+
+#define ICMS_get_PermissionSetSection(This,__MIDL_0025) \
+ (This)->lpVtbl -> get_PermissionSetSection(This,__MIDL_0025)
+
+#define ICMS_get_MetadataSectionEntry(This,__MIDL_0026) \
+ (This)->lpVtbl -> get_MetadataSectionEntry(This,__MIDL_0026)
+
+#define ICMS_get_AssemblyRequestSection(This,__MIDL_0027) \
+ (This)->lpVtbl -> get_AssemblyRequestSection(This,__MIDL_0027)
+
+#define ICMS_get_RegistryKeySection(This,__MIDL_0028) \
+ (This)->lpVtbl -> get_RegistryKeySection(This,__MIDL_0028)
+
+#define ICMS_get_DirectorySection(This,__MIDL_0029) \
+ (This)->lpVtbl -> get_DirectorySection(This,__MIDL_0029)
+
+#define ICMS_get_FileAssociationSection(This,__MIDL_0030) \
+ (This)->lpVtbl -> get_FileAssociationSection(This,__MIDL_0030)
+
+#define ICMS_get_CompatibleFrameworksSection(This,__MIDL_0031) \
+ (This)->lpVtbl -> get_CompatibleFrameworksSection(This,__MIDL_0031)
+
+#define ICMS_get_EventSection(This,__MIDL_0032) \
+ (This)->lpVtbl -> get_EventSection(This,__MIDL_0032)
+
+#define ICMS_get_EventMapSection(This,__MIDL_0033) \
+ (This)->lpVtbl -> get_EventMapSection(This,__MIDL_0033)
+
+#define ICMS_get_EventTagSection(This,__MIDL_0034) \
+ (This)->lpVtbl -> get_EventTagSection(This,__MIDL_0034)
+
+#define ICMS_get_CounterSetSection(This,__MIDL_0035) \
+ (This)->lpVtbl -> get_CounterSetSection(This,__MIDL_0035)
+
+#define ICMS_get_CounterSection(This,__MIDL_0036) \
+ (This)->lpVtbl -> get_CounterSection(This,__MIDL_0036)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ICMS_get_Identity_Proxy(
+ ICMS * This,
+ /* [retval][out] */ IDefinitionIdentity **__MIDL_0015);
+
+
+void __RPC_STUB ICMS_get_Identity_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ICMS_get_FileSection_Proxy(
+ ICMS * This,
+ /* [retval][out] */ ISection **__MIDL_0016);
+
+
+void __RPC_STUB ICMS_get_FileSection_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ICMS_get_CategoryMembershipSection_Proxy(
+ ICMS * This,
+ /* [retval][out] */ ISection **__MIDL_0017);
+
+
+void __RPC_STUB ICMS_get_CategoryMembershipSection_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ICMS_get_COMRedirectionSection_Proxy(
+ ICMS * This,
+ /* [retval][out] */ ISection **__MIDL_0018);
+
+
+void __RPC_STUB ICMS_get_COMRedirectionSection_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ICMS_get_ProgIdRedirectionSection_Proxy(
+ ICMS * This,
+ /* [retval][out] */ ISection **__MIDL_0019);
+
+
+void __RPC_STUB ICMS_get_ProgIdRedirectionSection_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ICMS_get_CLRSurrogateSection_Proxy(
+ ICMS * This,
+ /* [retval][out] */ ISection **__MIDL_0020);
+
+
+void __RPC_STUB ICMS_get_CLRSurrogateSection_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ICMS_get_AssemblyReferenceSection_Proxy(
+ ICMS * This,
+ /* [retval][out] */ ISection **__MIDL_0021);
+
+
+void __RPC_STUB ICMS_get_AssemblyReferenceSection_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ICMS_get_WindowClassSection_Proxy(
+ ICMS * This,
+ /* [retval][out] */ ISection **__MIDL_0022);
+
+
+void __RPC_STUB ICMS_get_WindowClassSection_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ICMS_get_StringSection_Proxy(
+ ICMS * This,
+ /* [retval][out] */ ISection **__MIDL_0023);
+
+
+void __RPC_STUB ICMS_get_StringSection_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ICMS_get_EntryPointSection_Proxy(
+ ICMS * This,
+ /* [retval][out] */ ISection **__MIDL_0024);
+
+
+void __RPC_STUB ICMS_get_EntryPointSection_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ICMS_get_PermissionSetSection_Proxy(
+ ICMS * This,
+ /* [retval][out] */ ISection **__MIDL_0025);
+
+
+void __RPC_STUB ICMS_get_PermissionSetSection_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ICMS_get_MetadataSectionEntry_Proxy(
+ ICMS * This,
+ /* [retval][out] */ ISectionEntry **__MIDL_0026);
+
+
+void __RPC_STUB ICMS_get_MetadataSectionEntry_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ICMS_get_AssemblyRequestSection_Proxy(
+ ICMS * This,
+ /* [retval][out] */ ISection **__MIDL_0027);
+
+
+void __RPC_STUB ICMS_get_AssemblyRequestSection_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ICMS_get_RegistryKeySection_Proxy(
+ ICMS * This,
+ /* [retval][out] */ ISection **__MIDL_0028);
+
+
+void __RPC_STUB ICMS_get_RegistryKeySection_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ICMS_get_DirectorySection_Proxy(
+ ICMS * This,
+ /* [retval][out] */ ISection **__MIDL_0029);
+
+
+void __RPC_STUB ICMS_get_DirectorySection_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ICMS_get_FileAssociationSection_Proxy(
+ ICMS * This,
+ /* [retval][out] */ ISection **__MIDL_0030);
+
+
+void __RPC_STUB ICMS_get_FileAssociationSection_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ICMS_get_CompatibleFrameworksSection_Proxy(
+ ICMS * This,
+ /* [retval][out] */ ISection **__MIDL_0031);
+
+
+void __RPC_STUB ICMS_get_CompatibleFrameworksSection_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ICMS_get_EventSection_Proxy(
+ ICMS * This,
+ /* [retval][out] */ ISection **__MIDL_0032);
+
+
+void __RPC_STUB ICMS_get_EventSection_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ICMS_get_EventMapSection_Proxy(
+ ICMS * This,
+ /* [retval][out] */ ISection **__MIDL_0033);
+
+
+void __RPC_STUB ICMS_get_EventMapSection_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ICMS_get_EventTagSection_Proxy(
+ ICMS * This,
+ /* [retval][out] */ ISection **__MIDL_0034);
+
+
+void __RPC_STUB ICMS_get_EventTagSection_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ICMS_get_CounterSetSection_Proxy(
+ ICMS * This,
+ /* [retval][out] */ ISection **__MIDL_0035);
+
+
+void __RPC_STUB ICMS_get_CounterSetSection_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ICMS_get_CounterSection_Proxy(
+ ICMS * This,
+ /* [retval][out] */ ISection **__MIDL_0036);
+
+
+void __RPC_STUB ICMS_get_CounterSection_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __ICMS_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_isolation_0280 */
+/* [local] */
+
+typedef struct _MuiResourceIdLookupMapEntry
+ {
+ ULONG Count;
+ } MuiResourceIdLookupMapEntry;
+
+typedef
+enum _MuiResourceIdLookupMapEntryFieldId
+ { MuiResourceIdLookupMap_Count = 0
+ } MuiResourceIdLookupMapEntryFieldId;
+
+
+
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0280_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0280_v0_0_s_ifspec;
+
+#ifndef __IMuiResourceIdLookupMapEntry_INTERFACE_DEFINED__
+#define __IMuiResourceIdLookupMapEntry_INTERFACE_DEFINED__
+
+/* interface IMuiResourceIdLookupMapEntry */
+/* [uuid][unique][object][local] */
+
+
+EXTERN_C const IID IID_IMuiResourceIdLookupMapEntry;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("24abe1f7-a396-4a03-9adf-1d5b86a5569f")
+ IMuiResourceIdLookupMapEntry : public IUnknown
+ {
+ public:
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
+ /* [retval][out] */ MuiResourceIdLookupMapEntry **__MIDL_0037) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Count(
+ /* [retval][out] */ ULONG *__MIDL_0038) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IMuiResourceIdLookupMapEntryVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IMuiResourceIdLookupMapEntry * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IMuiResourceIdLookupMapEntry * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IMuiResourceIdLookupMapEntry * This);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
+ IMuiResourceIdLookupMapEntry * This,
+ /* [retval][out] */ MuiResourceIdLookupMapEntry **__MIDL_0037);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Count )(
+ IMuiResourceIdLookupMapEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0038);
+
+ END_INTERFACE
+ } IMuiResourceIdLookupMapEntryVtbl;
+
+ interface IMuiResourceIdLookupMapEntry
+ {
+ CONST_VTBL struct IMuiResourceIdLookupMapEntryVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IMuiResourceIdLookupMapEntry_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IMuiResourceIdLookupMapEntry_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IMuiResourceIdLookupMapEntry_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IMuiResourceIdLookupMapEntry_get_AllData(This,__MIDL_0037) \
+ (This)->lpVtbl -> get_AllData(This,__MIDL_0037)
+
+#define IMuiResourceIdLookupMapEntry_get_Count(This,__MIDL_0038) \
+ (This)->lpVtbl -> get_Count(This,__MIDL_0038)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IMuiResourceIdLookupMapEntry_get_AllData_Proxy(
+ IMuiResourceIdLookupMapEntry * This,
+ /* [retval][out] */ MuiResourceIdLookupMapEntry **__MIDL_0037);
+
+
+void __RPC_STUB IMuiResourceIdLookupMapEntry_get_AllData_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IMuiResourceIdLookupMapEntry_get_Count_Proxy(
+ IMuiResourceIdLookupMapEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0038);
+
+
+void __RPC_STUB IMuiResourceIdLookupMapEntry_get_Count_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IMuiResourceIdLookupMapEntry_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_isolation_0281 */
+/* [local] */
+
+typedef struct _MuiResourceTypeIdStringEntry
+ {
+ /* [size_is] */ BYTE *StringIds;
+ ULONG StringIdsSize;
+ /* [size_is] */ BYTE *IntegerIds;
+ ULONG IntegerIdsSize;
+ } MuiResourceTypeIdStringEntry;
+
+typedef
+enum _MuiResourceTypeIdStringEntryFieldId
+ { MuiResourceTypeIdString_StringIds = 0,
+ MuiResourceTypeIdString_StringIdsSize = MuiResourceTypeIdString_StringIds + 1,
+ MuiResourceTypeIdString_IntegerIds = MuiResourceTypeIdString_StringIdsSize + 1,
+ MuiResourceTypeIdString_IntegerIdsSize = MuiResourceTypeIdString_IntegerIds + 1
+ } MuiResourceTypeIdStringEntryFieldId;
+
+
+
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0281_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0281_v0_0_s_ifspec;
+
+#ifndef __IMuiResourceTypeIdStringEntry_INTERFACE_DEFINED__
+#define __IMuiResourceTypeIdStringEntry_INTERFACE_DEFINED__
+
+/* interface IMuiResourceTypeIdStringEntry */
+/* [uuid][unique][object][local] */
+
+
+EXTERN_C const IID IID_IMuiResourceTypeIdStringEntry;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("11df5cad-c183-479b-9a44-3842b71639ce")
+ IMuiResourceTypeIdStringEntry : public IUnknown
+ {
+ public:
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
+ /* [retval][out] */ MuiResourceTypeIdStringEntry **__MIDL_0039) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_StringIds(
+ /* [retval][out] */ IStream **__MIDL_0040) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_IntegerIds(
+ /* [retval][out] */ IStream **__MIDL_0041) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IMuiResourceTypeIdStringEntryVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IMuiResourceTypeIdStringEntry * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IMuiResourceTypeIdStringEntry * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IMuiResourceTypeIdStringEntry * This);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
+ IMuiResourceTypeIdStringEntry * This,
+ /* [retval][out] */ MuiResourceTypeIdStringEntry **__MIDL_0039);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_StringIds )(
+ IMuiResourceTypeIdStringEntry * This,
+ /* [retval][out] */ IStream **__MIDL_0040);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_IntegerIds )(
+ IMuiResourceTypeIdStringEntry * This,
+ /* [retval][out] */ IStream **__MIDL_0041);
+
+ END_INTERFACE
+ } IMuiResourceTypeIdStringEntryVtbl;
+
+ interface IMuiResourceTypeIdStringEntry
+ {
+ CONST_VTBL struct IMuiResourceTypeIdStringEntryVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IMuiResourceTypeIdStringEntry_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IMuiResourceTypeIdStringEntry_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IMuiResourceTypeIdStringEntry_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IMuiResourceTypeIdStringEntry_get_AllData(This,__MIDL_0039) \
+ (This)->lpVtbl -> get_AllData(This,__MIDL_0039)
+
+#define IMuiResourceTypeIdStringEntry_get_StringIds(This,__MIDL_0040) \
+ (This)->lpVtbl -> get_StringIds(This,__MIDL_0040)
+
+#define IMuiResourceTypeIdStringEntry_get_IntegerIds(This,__MIDL_0041) \
+ (This)->lpVtbl -> get_IntegerIds(This,__MIDL_0041)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IMuiResourceTypeIdStringEntry_get_AllData_Proxy(
+ IMuiResourceTypeIdStringEntry * This,
+ /* [retval][out] */ MuiResourceTypeIdStringEntry **__MIDL_0039);
+
+
+void __RPC_STUB IMuiResourceTypeIdStringEntry_get_AllData_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IMuiResourceTypeIdStringEntry_get_StringIds_Proxy(
+ IMuiResourceTypeIdStringEntry * This,
+ /* [retval][out] */ IStream **__MIDL_0040);
+
+
+void __RPC_STUB IMuiResourceTypeIdStringEntry_get_StringIds_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IMuiResourceTypeIdStringEntry_get_IntegerIds_Proxy(
+ IMuiResourceTypeIdStringEntry * This,
+ /* [retval][out] */ IStream **__MIDL_0041);
+
+
+void __RPC_STUB IMuiResourceTypeIdStringEntry_get_IntegerIds_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IMuiResourceTypeIdStringEntry_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_isolation_0282 */
+/* [local] */
+
+typedef struct _MuiResourceTypeIdIntEntry
+ {
+ /* [size_is] */ BYTE *StringIds;
+ ULONG StringIdsSize;
+ /* [size_is] */ BYTE *IntegerIds;
+ ULONG IntegerIdsSize;
+ } MuiResourceTypeIdIntEntry;
+
+typedef
+enum _MuiResourceTypeIdIntEntryFieldId
+ { MuiResourceTypeIdInt_StringIds = 0,
+ MuiResourceTypeIdInt_StringIdsSize = MuiResourceTypeIdInt_StringIds + 1,
+ MuiResourceTypeIdInt_IntegerIds = MuiResourceTypeIdInt_StringIdsSize + 1,
+ MuiResourceTypeIdInt_IntegerIdsSize = MuiResourceTypeIdInt_IntegerIds + 1
+ } MuiResourceTypeIdIntEntryFieldId;
+
+
+
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0282_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0282_v0_0_s_ifspec;
+
+#ifndef __IMuiResourceTypeIdIntEntry_INTERFACE_DEFINED__
+#define __IMuiResourceTypeIdIntEntry_INTERFACE_DEFINED__
+
+/* interface IMuiResourceTypeIdIntEntry */
+/* [uuid][unique][object][local] */
+
+
+EXTERN_C const IID IID_IMuiResourceTypeIdIntEntry;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("55b2dec1-d0f6-4bf4-91b1-30f73ad8e4df")
+ IMuiResourceTypeIdIntEntry : public IUnknown
+ {
+ public:
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
+ /* [retval][out] */ MuiResourceTypeIdIntEntry **__MIDL_0042) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_StringIds(
+ /* [retval][out] */ IStream **__MIDL_0043) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_IntegerIds(
+ /* [retval][out] */ IStream **__MIDL_0044) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IMuiResourceTypeIdIntEntryVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IMuiResourceTypeIdIntEntry * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IMuiResourceTypeIdIntEntry * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IMuiResourceTypeIdIntEntry * This);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
+ IMuiResourceTypeIdIntEntry * This,
+ /* [retval][out] */ MuiResourceTypeIdIntEntry **__MIDL_0042);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_StringIds )(
+ IMuiResourceTypeIdIntEntry * This,
+ /* [retval][out] */ IStream **__MIDL_0043);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_IntegerIds )(
+ IMuiResourceTypeIdIntEntry * This,
+ /* [retval][out] */ IStream **__MIDL_0044);
+
+ END_INTERFACE
+ } IMuiResourceTypeIdIntEntryVtbl;
+
+ interface IMuiResourceTypeIdIntEntry
+ {
+ CONST_VTBL struct IMuiResourceTypeIdIntEntryVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IMuiResourceTypeIdIntEntry_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IMuiResourceTypeIdIntEntry_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IMuiResourceTypeIdIntEntry_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IMuiResourceTypeIdIntEntry_get_AllData(This,__MIDL_0042) \
+ (This)->lpVtbl -> get_AllData(This,__MIDL_0042)
+
+#define IMuiResourceTypeIdIntEntry_get_StringIds(This,__MIDL_0043) \
+ (This)->lpVtbl -> get_StringIds(This,__MIDL_0043)
+
+#define IMuiResourceTypeIdIntEntry_get_IntegerIds(This,__MIDL_0044) \
+ (This)->lpVtbl -> get_IntegerIds(This,__MIDL_0044)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IMuiResourceTypeIdIntEntry_get_AllData_Proxy(
+ IMuiResourceTypeIdIntEntry * This,
+ /* [retval][out] */ MuiResourceTypeIdIntEntry **__MIDL_0042);
+
+
+void __RPC_STUB IMuiResourceTypeIdIntEntry_get_AllData_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IMuiResourceTypeIdIntEntry_get_StringIds_Proxy(
+ IMuiResourceTypeIdIntEntry * This,
+ /* [retval][out] */ IStream **__MIDL_0043);
+
+
+void __RPC_STUB IMuiResourceTypeIdIntEntry_get_StringIds_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IMuiResourceTypeIdIntEntry_get_IntegerIds_Proxy(
+ IMuiResourceTypeIdIntEntry * This,
+ /* [retval][out] */ IStream **__MIDL_0044);
+
+
+void __RPC_STUB IMuiResourceTypeIdIntEntry_get_IntegerIds_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IMuiResourceTypeIdIntEntry_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_isolation_0283 */
+/* [local] */
+
+typedef struct _MuiResourceMapEntry
+ {
+ /* [size_is] */ BYTE *ResourceTypeIdInt;
+ ULONG ResourceTypeIdIntSize;
+ /* [size_is] */ BYTE *ResourceTypeIdString;
+ ULONG ResourceTypeIdStringSize;
+ } MuiResourceMapEntry;
+
+typedef
+enum _MuiResourceMapEntryFieldId
+ { MuiResourceMap_ResourceTypeIdInt = 0,
+ MuiResourceMap_ResourceTypeIdIntSize = MuiResourceMap_ResourceTypeIdInt + 1,
+ MuiResourceMap_ResourceTypeIdString = MuiResourceMap_ResourceTypeIdIntSize + 1,
+ MuiResourceMap_ResourceTypeIdStringSize = MuiResourceMap_ResourceTypeIdString + 1
+ } MuiResourceMapEntryFieldId;
+
+
+
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0283_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0283_v0_0_s_ifspec;
+
+#ifndef __IMuiResourceMapEntry_INTERFACE_DEFINED__
+#define __IMuiResourceMapEntry_INTERFACE_DEFINED__
+
+/* interface IMuiResourceMapEntry */
+/* [uuid][unique][object][local] */
+
+
+EXTERN_C const IID IID_IMuiResourceMapEntry;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("397927f5-10f2-4ecb-bfe1-3c264212a193")
+ IMuiResourceMapEntry : public IUnknown
+ {
+ public:
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
+ /* [retval][out] */ MuiResourceMapEntry **__MIDL_0045) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ResourceTypeIdInt(
+ /* [retval][out] */ IStream **__MIDL_0046) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ResourceTypeIdString(
+ /* [retval][out] */ IStream **__MIDL_0047) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IMuiResourceMapEntryVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IMuiResourceMapEntry * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IMuiResourceMapEntry * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IMuiResourceMapEntry * This);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
+ IMuiResourceMapEntry * This,
+ /* [retval][out] */ MuiResourceMapEntry **__MIDL_0045);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ResourceTypeIdInt )(
+ IMuiResourceMapEntry * This,
+ /* [retval][out] */ IStream **__MIDL_0046);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ResourceTypeIdString )(
+ IMuiResourceMapEntry * This,
+ /* [retval][out] */ IStream **__MIDL_0047);
+
+ END_INTERFACE
+ } IMuiResourceMapEntryVtbl;
+
+ interface IMuiResourceMapEntry
+ {
+ CONST_VTBL struct IMuiResourceMapEntryVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IMuiResourceMapEntry_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IMuiResourceMapEntry_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IMuiResourceMapEntry_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IMuiResourceMapEntry_get_AllData(This,__MIDL_0045) \
+ (This)->lpVtbl -> get_AllData(This,__MIDL_0045)
+
+#define IMuiResourceMapEntry_get_ResourceTypeIdInt(This,__MIDL_0046) \
+ (This)->lpVtbl -> get_ResourceTypeIdInt(This,__MIDL_0046)
+
+#define IMuiResourceMapEntry_get_ResourceTypeIdString(This,__MIDL_0047) \
+ (This)->lpVtbl -> get_ResourceTypeIdString(This,__MIDL_0047)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IMuiResourceMapEntry_get_AllData_Proxy(
+ IMuiResourceMapEntry * This,
+ /* [retval][out] */ MuiResourceMapEntry **__MIDL_0045);
+
+
+void __RPC_STUB IMuiResourceMapEntry_get_AllData_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IMuiResourceMapEntry_get_ResourceTypeIdInt_Proxy(
+ IMuiResourceMapEntry * This,
+ /* [retval][out] */ IStream **__MIDL_0046);
+
+
+void __RPC_STUB IMuiResourceMapEntry_get_ResourceTypeIdInt_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IMuiResourceMapEntry_get_ResourceTypeIdString_Proxy(
+ IMuiResourceMapEntry * This,
+ /* [retval][out] */ IStream **__MIDL_0047);
+
+
+void __RPC_STUB IMuiResourceMapEntry_get_ResourceTypeIdString_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IMuiResourceMapEntry_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_isolation_0284 */
+/* [local] */
+
+typedef struct _HashElementEntry
+ {
+ ULONG index;
+ UCHAR Transform;
+ /* [size_is] */ BYTE *TransformMetadata;
+ ULONG TransformMetadataSize;
+ UCHAR DigestMethod;
+ /* [size_is] */ BYTE *DigestValue;
+ ULONG DigestValueSize;
+ LPCWSTR Xml;
+ } HashElementEntry;
+
+typedef
+enum _HashElementEntryFieldId
+ { HashElement_Transform = 0,
+ HashElement_TransformMetadata = HashElement_Transform + 1,
+ HashElement_TransformMetadataSize = HashElement_TransformMetadata + 1,
+ HashElement_DigestMethod = HashElement_TransformMetadataSize + 1,
+ HashElement_DigestValue = HashElement_DigestMethod + 1,
+ HashElement_DigestValueSize = HashElement_DigestValue + 1,
+ HashElement_Xml = HashElement_DigestValueSize + 1
+ } HashElementEntryFieldId;
+
+
+
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0284_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0284_v0_0_s_ifspec;
+
+#ifndef __IHashElementEntry_INTERFACE_DEFINED__
+#define __IHashElementEntry_INTERFACE_DEFINED__
+
+/* interface IHashElementEntry */
+/* [uuid][unique][object][local] */
+
+
+EXTERN_C const IID IID_IHashElementEntry;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("9D46FB70-7B54-4f4f-9331-BA9E87833FF5")
+ IHashElementEntry : public IUnknown
+ {
+ public:
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
+ /* [retval][out] */ HashElementEntry **__MIDL_0048) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_index(
+ /* [retval][out] */ ULONG *__MIDL_0049) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Transform(
+ /* [retval][out] */ UCHAR *__MIDL_0050) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_TransformMetadata(
+ /* [retval][out] */ IStream **__MIDL_0051) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_DigestMethod(
+ /* [retval][out] */ UCHAR *__MIDL_0052) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_DigestValue(
+ /* [retval][out] */ IStream **__MIDL_0053) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Xml(
+ /* [retval][out] */ LPCWSTR *__MIDL_0054) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IHashElementEntryVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IHashElementEntry * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IHashElementEntry * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IHashElementEntry * This);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
+ IHashElementEntry * This,
+ /* [retval][out] */ HashElementEntry **__MIDL_0048);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_index )(
+ IHashElementEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0049);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Transform )(
+ IHashElementEntry * This,
+ /* [retval][out] */ UCHAR *__MIDL_0050);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_TransformMetadata )(
+ IHashElementEntry * This,
+ /* [retval][out] */ IStream **__MIDL_0051);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_DigestMethod )(
+ IHashElementEntry * This,
+ /* [retval][out] */ UCHAR *__MIDL_0052);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_DigestValue )(
+ IHashElementEntry * This,
+ /* [retval][out] */ IStream **__MIDL_0053);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Xml )(
+ IHashElementEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0054);
+
+ END_INTERFACE
+ } IHashElementEntryVtbl;
+
+ interface IHashElementEntry
+ {
+ CONST_VTBL struct IHashElementEntryVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IHashElementEntry_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IHashElementEntry_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IHashElementEntry_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IHashElementEntry_get_AllData(This,__MIDL_0048) \
+ (This)->lpVtbl -> get_AllData(This,__MIDL_0048)
+
+#define IHashElementEntry_get_index(This,__MIDL_0049) \
+ (This)->lpVtbl -> get_index(This,__MIDL_0049)
+
+#define IHashElementEntry_get_Transform(This,__MIDL_0050) \
+ (This)->lpVtbl -> get_Transform(This,__MIDL_0050)
+
+#define IHashElementEntry_get_TransformMetadata(This,__MIDL_0051) \
+ (This)->lpVtbl -> get_TransformMetadata(This,__MIDL_0051)
+
+#define IHashElementEntry_get_DigestMethod(This,__MIDL_0052) \
+ (This)->lpVtbl -> get_DigestMethod(This,__MIDL_0052)
+
+#define IHashElementEntry_get_DigestValue(This,__MIDL_0053) \
+ (This)->lpVtbl -> get_DigestValue(This,__MIDL_0053)
+
+#define IHashElementEntry_get_Xml(This,__MIDL_0054) \
+ (This)->lpVtbl -> get_Xml(This,__MIDL_0054)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IHashElementEntry_get_AllData_Proxy(
+ IHashElementEntry * This,
+ /* [retval][out] */ HashElementEntry **__MIDL_0048);
+
+
+void __RPC_STUB IHashElementEntry_get_AllData_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IHashElementEntry_get_index_Proxy(
+ IHashElementEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0049);
+
+
+void __RPC_STUB IHashElementEntry_get_index_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IHashElementEntry_get_Transform_Proxy(
+ IHashElementEntry * This,
+ /* [retval][out] */ UCHAR *__MIDL_0050);
+
+
+void __RPC_STUB IHashElementEntry_get_Transform_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IHashElementEntry_get_TransformMetadata_Proxy(
+ IHashElementEntry * This,
+ /* [retval][out] */ IStream **__MIDL_0051);
+
+
+void __RPC_STUB IHashElementEntry_get_TransformMetadata_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IHashElementEntry_get_DigestMethod_Proxy(
+ IHashElementEntry * This,
+ /* [retval][out] */ UCHAR *__MIDL_0052);
+
+
+void __RPC_STUB IHashElementEntry_get_DigestMethod_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IHashElementEntry_get_DigestValue_Proxy(
+ IHashElementEntry * This,
+ /* [retval][out] */ IStream **__MIDL_0053);
+
+
+void __RPC_STUB IHashElementEntry_get_DigestValue_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IHashElementEntry_get_Xml_Proxy(
+ IHashElementEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0054);
+
+
+void __RPC_STUB IHashElementEntry_get_Xml_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IHashElementEntry_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_isolation_0285 */
+/* [local] */
+
+typedef struct _FileEntry
+ {
+ LPCWSTR Name;
+ ULONG HashAlgorithm;
+ LPCWSTR LoadFrom;
+ LPCWSTR SourcePath;
+ LPCWSTR ImportPath;
+ LPCWSTR SourceName;
+ LPCWSTR Location;
+ /* [size_is] */ BYTE *HashValue;
+ ULONG HashValueSize;
+ ULONGLONG Size;
+ LPCWSTR Group;
+ ULONG Flags;
+ MuiResourceMapEntry MuiMapping;
+ ULONG WritableType;
+ ISection *HashElements;
+ } FileEntry;
+
+typedef
+enum _FileEntryFieldId
+ { File_HashAlgorithm = 0,
+ File_LoadFrom = File_HashAlgorithm + 1,
+ File_SourcePath = File_LoadFrom + 1,
+ File_ImportPath = File_SourcePath + 1,
+ File_SourceName = File_ImportPath + 1,
+ File_Location = File_SourceName + 1,
+ File_HashValue = File_Location + 1,
+ File_HashValueSize = File_HashValue + 1,
+ File_Size = File_HashValueSize + 1,
+ File_Group = File_Size + 1,
+ File_Flags = File_Group + 1,
+ File_MuiMapping = File_Flags + 1,
+ File_WritableType = File_MuiMapping + 1,
+ File_HashElements = File_WritableType + 1
+ } FileEntryFieldId;
+
+
+
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0285_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0285_v0_0_s_ifspec;
+
+#ifndef __IFileEntry_INTERFACE_DEFINED__
+#define __IFileEntry_INTERFACE_DEFINED__
+
+/* interface IFileEntry */
+/* [uuid][unique][object][local] */
+
+
+EXTERN_C const IID IID_IFileEntry;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("A2A55FAD-349B-469b-BF12-ADC33D14A937")
+ IFileEntry : public IUnknown
+ {
+ public:
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
+ /* [retval][out] */ FileEntry **__MIDL_0055) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Name(
+ /* [retval][out] */ LPCWSTR *__MIDL_0056) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_HashAlgorithm(
+ /* [retval][out] */ ULONG *__MIDL_0057) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_LoadFrom(
+ /* [retval][out] */ LPCWSTR *__MIDL_0058) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SourcePath(
+ /* [retval][out] */ LPCWSTR *__MIDL_0059) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ImportPath(
+ /* [retval][out] */ LPCWSTR *__MIDL_0060) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SourceName(
+ /* [retval][out] */ LPCWSTR *__MIDL_0061) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Location(
+ /* [retval][out] */ LPCWSTR *__MIDL_0062) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_HashValue(
+ /* [retval][out] */ IStream **__MIDL_0063) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Size(
+ /* [retval][out] */ ULONGLONG *__MIDL_0064) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Group(
+ /* [retval][out] */ LPCWSTR *__MIDL_0065) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Flags(
+ /* [retval][out] */ ULONG *__MIDL_0066) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_MuiMapping(
+ /* [retval][out] */ IMuiResourceMapEntry **__MIDL_0067) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_WritableType(
+ /* [retval][out] */ ULONG *__MIDL_0068) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_HashElements(
+ /* [retval][out] */ ISection **HashElement) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IFileEntryVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IFileEntry * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IFileEntry * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IFileEntry * This);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
+ IFileEntry * This,
+ /* [retval][out] */ FileEntry **__MIDL_0055);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Name )(
+ IFileEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0056);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_HashAlgorithm )(
+ IFileEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0057);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_LoadFrom )(
+ IFileEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0058);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_SourcePath )(
+ IFileEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0059);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ImportPath )(
+ IFileEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0060);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_SourceName )(
+ IFileEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0061);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Location )(
+ IFileEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0062);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_HashValue )(
+ IFileEntry * This,
+ /* [retval][out] */ IStream **__MIDL_0063);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Size )(
+ IFileEntry * This,
+ /* [retval][out] */ ULONGLONG *__MIDL_0064);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Group )(
+ IFileEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0065);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Flags )(
+ IFileEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0066);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_MuiMapping )(
+ IFileEntry * This,
+ /* [retval][out] */ IMuiResourceMapEntry **__MIDL_0067);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_WritableType )(
+ IFileEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0068);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_HashElements )(
+ IFileEntry * This,
+ /* [retval][out] */ ISection **HashElement);
+
+ END_INTERFACE
+ } IFileEntryVtbl;
+
+ interface IFileEntry
+ {
+ CONST_VTBL struct IFileEntryVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IFileEntry_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IFileEntry_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IFileEntry_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IFileEntry_get_AllData(This,__MIDL_0055) \
+ (This)->lpVtbl -> get_AllData(This,__MIDL_0055)
+
+#define IFileEntry_get_Name(This,__MIDL_0056) \
+ (This)->lpVtbl -> get_Name(This,__MIDL_0056)
+
+#define IFileEntry_get_HashAlgorithm(This,__MIDL_0057) \
+ (This)->lpVtbl -> get_HashAlgorithm(This,__MIDL_0057)
+
+#define IFileEntry_get_LoadFrom(This,__MIDL_0058) \
+ (This)->lpVtbl -> get_LoadFrom(This,__MIDL_0058)
+
+#define IFileEntry_get_SourcePath(This,__MIDL_0059) \
+ (This)->lpVtbl -> get_SourcePath(This,__MIDL_0059)
+
+#define IFileEntry_get_ImportPath(This,__MIDL_0060) \
+ (This)->lpVtbl -> get_ImportPath(This,__MIDL_0060)
+
+#define IFileEntry_get_SourceName(This,__MIDL_0061) \
+ (This)->lpVtbl -> get_SourceName(This,__MIDL_0061)
+
+#define IFileEntry_get_Location(This,__MIDL_0062) \
+ (This)->lpVtbl -> get_Location(This,__MIDL_0062)
+
+#define IFileEntry_get_HashValue(This,__MIDL_0063) \
+ (This)->lpVtbl -> get_HashValue(This,__MIDL_0063)
+
+#define IFileEntry_get_Size(This,__MIDL_0064) \
+ (This)->lpVtbl -> get_Size(This,__MIDL_0064)
+
+#define IFileEntry_get_Group(This,__MIDL_0065) \
+ (This)->lpVtbl -> get_Group(This,__MIDL_0065)
+
+#define IFileEntry_get_Flags(This,__MIDL_0066) \
+ (This)->lpVtbl -> get_Flags(This,__MIDL_0066)
+
+#define IFileEntry_get_MuiMapping(This,__MIDL_0067) \
+ (This)->lpVtbl -> get_MuiMapping(This,__MIDL_0067)
+
+#define IFileEntry_get_WritableType(This,__MIDL_0068) \
+ (This)->lpVtbl -> get_WritableType(This,__MIDL_0068)
+
+#define IFileEntry_get_HashElements(This,HashElement) \
+ (This)->lpVtbl -> get_HashElements(This,HashElement)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IFileEntry_get_AllData_Proxy(
+ IFileEntry * This,
+ /* [retval][out] */ FileEntry **__MIDL_0055);
+
+
+void __RPC_STUB IFileEntry_get_AllData_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IFileEntry_get_Name_Proxy(
+ IFileEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0056);
+
+
+void __RPC_STUB IFileEntry_get_Name_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IFileEntry_get_HashAlgorithm_Proxy(
+ IFileEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0057);
+
+
+void __RPC_STUB IFileEntry_get_HashAlgorithm_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IFileEntry_get_LoadFrom_Proxy(
+ IFileEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0058);
+
+
+void __RPC_STUB IFileEntry_get_LoadFrom_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IFileEntry_get_SourcePath_Proxy(
+ IFileEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0059);
+
+
+void __RPC_STUB IFileEntry_get_SourcePath_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IFileEntry_get_ImportPath_Proxy(
+ IFileEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0060);
+
+
+void __RPC_STUB IFileEntry_get_ImportPath_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IFileEntry_get_SourceName_Proxy(
+ IFileEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0061);
+
+
+void __RPC_STUB IFileEntry_get_SourceName_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IFileEntry_get_Location_Proxy(
+ IFileEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0062);
+
+
+void __RPC_STUB IFileEntry_get_Location_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IFileEntry_get_HashValue_Proxy(
+ IFileEntry * This,
+ /* [retval][out] */ IStream **__MIDL_0063);
+
+
+void __RPC_STUB IFileEntry_get_HashValue_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IFileEntry_get_Size_Proxy(
+ IFileEntry * This,
+ /* [retval][out] */ ULONGLONG *__MIDL_0064);
+
+
+void __RPC_STUB IFileEntry_get_Size_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IFileEntry_get_Group_Proxy(
+ IFileEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0065);
+
+
+void __RPC_STUB IFileEntry_get_Group_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IFileEntry_get_Flags_Proxy(
+ IFileEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0066);
+
+
+void __RPC_STUB IFileEntry_get_Flags_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IFileEntry_get_MuiMapping_Proxy(
+ IFileEntry * This,
+ /* [retval][out] */ IMuiResourceMapEntry **__MIDL_0067);
+
+
+void __RPC_STUB IFileEntry_get_MuiMapping_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IFileEntry_get_WritableType_Proxy(
+ IFileEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0068);
+
+
+void __RPC_STUB IFileEntry_get_WritableType_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IFileEntry_get_HashElements_Proxy(
+ IFileEntry * This,
+ /* [retval][out] */ ISection **HashElement);
+
+
+void __RPC_STUB IFileEntry_get_HashElements_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IFileEntry_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_isolation_0286 */
+/* [local] */
+
+typedef struct _FileAssociationEntry
+ {
+ LPCWSTR Extension;
+ LPCWSTR Description;
+ LPCWSTR ProgID;
+ LPCWSTR DefaultIcon;
+ LPCWSTR Parameter;
+ } FileAssociationEntry;
+
+typedef
+enum _FileAssociationEntryFieldId
+ { FileAssociation_Description = 0,
+ FileAssociation_ProgID = FileAssociation_Description + 1,
+ FileAssociation_DefaultIcon = FileAssociation_ProgID + 1,
+ FileAssociation_Parameter = FileAssociation_DefaultIcon + 1
+ } FileAssociationEntryFieldId;
+
+
+
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0286_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0286_v0_0_s_ifspec;
+
+#ifndef __IFileAssociationEntry_INTERFACE_DEFINED__
+#define __IFileAssociationEntry_INTERFACE_DEFINED__
+
+/* interface IFileAssociationEntry */
+/* [uuid][unique][object][local] */
+
+
+EXTERN_C const IID IID_IFileAssociationEntry;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("0C66F299-E08E-48c5-9264-7CCBEB4D5CBB")
+ IFileAssociationEntry : public IUnknown
+ {
+ public:
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
+ /* [retval][out] */ FileAssociationEntry **__MIDL_0069) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Extension(
+ /* [retval][out] */ LPCWSTR *__MIDL_0070) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Description(
+ /* [retval][out] */ LPCWSTR *__MIDL_0071) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ProgID(
+ /* [retval][out] */ LPCWSTR *__MIDL_0072) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_DefaultIcon(
+ /* [retval][out] */ LPCWSTR *__MIDL_0073) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Parameter(
+ /* [retval][out] */ LPCWSTR *__MIDL_0074) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IFileAssociationEntryVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IFileAssociationEntry * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IFileAssociationEntry * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IFileAssociationEntry * This);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
+ IFileAssociationEntry * This,
+ /* [retval][out] */ FileAssociationEntry **__MIDL_0069);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Extension )(
+ IFileAssociationEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0070);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Description )(
+ IFileAssociationEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0071);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ProgID )(
+ IFileAssociationEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0072);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_DefaultIcon )(
+ IFileAssociationEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0073);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Parameter )(
+ IFileAssociationEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0074);
+
+ END_INTERFACE
+ } IFileAssociationEntryVtbl;
+
+ interface IFileAssociationEntry
+ {
+ CONST_VTBL struct IFileAssociationEntryVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IFileAssociationEntry_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IFileAssociationEntry_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IFileAssociationEntry_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IFileAssociationEntry_get_AllData(This,__MIDL_0069) \
+ (This)->lpVtbl -> get_AllData(This,__MIDL_0069)
+
+#define IFileAssociationEntry_get_Extension(This,__MIDL_0070) \
+ (This)->lpVtbl -> get_Extension(This,__MIDL_0070)
+
+#define IFileAssociationEntry_get_Description(This,__MIDL_0071) \
+ (This)->lpVtbl -> get_Description(This,__MIDL_0071)
+
+#define IFileAssociationEntry_get_ProgID(This,__MIDL_0072) \
+ (This)->lpVtbl -> get_ProgID(This,__MIDL_0072)
+
+#define IFileAssociationEntry_get_DefaultIcon(This,__MIDL_0073) \
+ (This)->lpVtbl -> get_DefaultIcon(This,__MIDL_0073)
+
+#define IFileAssociationEntry_get_Parameter(This,__MIDL_0074) \
+ (This)->lpVtbl -> get_Parameter(This,__MIDL_0074)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IFileAssociationEntry_get_AllData_Proxy(
+ IFileAssociationEntry * This,
+ /* [retval][out] */ FileAssociationEntry **__MIDL_0069);
+
+
+void __RPC_STUB IFileAssociationEntry_get_AllData_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IFileAssociationEntry_get_Extension_Proxy(
+ IFileAssociationEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0070);
+
+
+void __RPC_STUB IFileAssociationEntry_get_Extension_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IFileAssociationEntry_get_Description_Proxy(
+ IFileAssociationEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0071);
+
+
+void __RPC_STUB IFileAssociationEntry_get_Description_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IFileAssociationEntry_get_ProgID_Proxy(
+ IFileAssociationEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0072);
+
+
+void __RPC_STUB IFileAssociationEntry_get_ProgID_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IFileAssociationEntry_get_DefaultIcon_Proxy(
+ IFileAssociationEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0073);
+
+
+void __RPC_STUB IFileAssociationEntry_get_DefaultIcon_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IFileAssociationEntry_get_Parameter_Proxy(
+ IFileAssociationEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0074);
+
+
+void __RPC_STUB IFileAssociationEntry_get_Parameter_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IFileAssociationEntry_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_isolation_0287 */
+/* [local] */
+
+typedef struct _CategoryMembershipDataEntry
+ {
+ ULONG index;
+ LPCWSTR Xml;
+ LPCWSTR Description;
+ } CategoryMembershipDataEntry;
+
+typedef
+enum _CategoryMembershipDataEntryFieldId
+ { CategoryMembershipData_Xml = 0,
+ CategoryMembershipData_Description = CategoryMembershipData_Xml + 1
+ } CategoryMembershipDataEntryFieldId;
+
+
+
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0287_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0287_v0_0_s_ifspec;
+
+#ifndef __ICategoryMembershipDataEntry_INTERFACE_DEFINED__
+#define __ICategoryMembershipDataEntry_INTERFACE_DEFINED__
+
+/* interface ICategoryMembershipDataEntry */
+/* [uuid][unique][object][local] */
+
+
+EXTERN_C const IID IID_ICategoryMembershipDataEntry;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("DA0C3B27-6B6B-4b80-A8F8-6CE14F4BC0A4")
+ ICategoryMembershipDataEntry : public IUnknown
+ {
+ public:
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
+ /* [retval][out] */ CategoryMembershipDataEntry **__MIDL_0075) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_index(
+ /* [retval][out] */ ULONG *__MIDL_0076) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Xml(
+ /* [retval][out] */ LPCWSTR *__MIDL_0077) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Description(
+ /* [retval][out] */ LPCWSTR *__MIDL_0078) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct ICategoryMembershipDataEntryVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ ICategoryMembershipDataEntry * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ ICategoryMembershipDataEntry * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ ICategoryMembershipDataEntry * This);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
+ ICategoryMembershipDataEntry * This,
+ /* [retval][out] */ CategoryMembershipDataEntry **__MIDL_0075);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_index )(
+ ICategoryMembershipDataEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0076);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Xml )(
+ ICategoryMembershipDataEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0077);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Description )(
+ ICategoryMembershipDataEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0078);
+
+ END_INTERFACE
+ } ICategoryMembershipDataEntryVtbl;
+
+ interface ICategoryMembershipDataEntry
+ {
+ CONST_VTBL struct ICategoryMembershipDataEntryVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define ICategoryMembershipDataEntry_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define ICategoryMembershipDataEntry_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define ICategoryMembershipDataEntry_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define ICategoryMembershipDataEntry_get_AllData(This,__MIDL_0075) \
+ (This)->lpVtbl -> get_AllData(This,__MIDL_0075)
+
+#define ICategoryMembershipDataEntry_get_index(This,__MIDL_0076) \
+ (This)->lpVtbl -> get_index(This,__MIDL_0076)
+
+#define ICategoryMembershipDataEntry_get_Xml(This,__MIDL_0077) \
+ (This)->lpVtbl -> get_Xml(This,__MIDL_0077)
+
+#define ICategoryMembershipDataEntry_get_Description(This,__MIDL_0078) \
+ (This)->lpVtbl -> get_Description(This,__MIDL_0078)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ICategoryMembershipDataEntry_get_AllData_Proxy(
+ ICategoryMembershipDataEntry * This,
+ /* [retval][out] */ CategoryMembershipDataEntry **__MIDL_0075);
+
+
+void __RPC_STUB ICategoryMembershipDataEntry_get_AllData_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ICategoryMembershipDataEntry_get_index_Proxy(
+ ICategoryMembershipDataEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0076);
+
+
+void __RPC_STUB ICategoryMembershipDataEntry_get_index_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ICategoryMembershipDataEntry_get_Xml_Proxy(
+ ICategoryMembershipDataEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0077);
+
+
+void __RPC_STUB ICategoryMembershipDataEntry_get_Xml_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ICategoryMembershipDataEntry_get_Description_Proxy(
+ ICategoryMembershipDataEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0078);
+
+
+void __RPC_STUB ICategoryMembershipDataEntry_get_Description_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __ICategoryMembershipDataEntry_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_isolation_0288 */
+/* [local] */
+
+typedef struct _SubcategoryMembershipEntry
+ {
+ LPCWSTR Subcategory;
+ ISection *CategoryMembershipData;
+ } SubcategoryMembershipEntry;
+
+typedef
+enum _SubcategoryMembershipEntryFieldId
+ { SubcategoryMembership_CategoryMembershipData = 0
+ } SubcategoryMembershipEntryFieldId;
+
+
+
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0288_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0288_v0_0_s_ifspec;
+
+#ifndef __ISubcategoryMembershipEntry_INTERFACE_DEFINED__
+#define __ISubcategoryMembershipEntry_INTERFACE_DEFINED__
+
+/* interface ISubcategoryMembershipEntry */
+/* [uuid][unique][object][local] */
+
+
+EXTERN_C const IID IID_ISubcategoryMembershipEntry;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("5A7A54D7-5AD5-418e-AB7A-CF823A8D48D0")
+ ISubcategoryMembershipEntry : public IUnknown
+ {
+ public:
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
+ /* [retval][out] */ SubcategoryMembershipEntry **__MIDL_0079) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Subcategory(
+ /* [retval][out] */ LPCWSTR *__MIDL_0080) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_CategoryMembershipData(
+ /* [retval][out] */ ISection **CategoryMembershipData) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct ISubcategoryMembershipEntryVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ ISubcategoryMembershipEntry * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ ISubcategoryMembershipEntry * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ ISubcategoryMembershipEntry * This);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
+ ISubcategoryMembershipEntry * This,
+ /* [retval][out] */ SubcategoryMembershipEntry **__MIDL_0079);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Subcategory )(
+ ISubcategoryMembershipEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0080);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_CategoryMembershipData )(
+ ISubcategoryMembershipEntry * This,
+ /* [retval][out] */ ISection **CategoryMembershipData);
+
+ END_INTERFACE
+ } ISubcategoryMembershipEntryVtbl;
+
+ interface ISubcategoryMembershipEntry
+ {
+ CONST_VTBL struct ISubcategoryMembershipEntryVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define ISubcategoryMembershipEntry_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define ISubcategoryMembershipEntry_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define ISubcategoryMembershipEntry_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define ISubcategoryMembershipEntry_get_AllData(This,__MIDL_0079) \
+ (This)->lpVtbl -> get_AllData(This,__MIDL_0079)
+
+#define ISubcategoryMembershipEntry_get_Subcategory(This,__MIDL_0080) \
+ (This)->lpVtbl -> get_Subcategory(This,__MIDL_0080)
+
+#define ISubcategoryMembershipEntry_get_CategoryMembershipData(This,CategoryMembershipData) \
+ (This)->lpVtbl -> get_CategoryMembershipData(This,CategoryMembershipData)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ISubcategoryMembershipEntry_get_AllData_Proxy(
+ ISubcategoryMembershipEntry * This,
+ /* [retval][out] */ SubcategoryMembershipEntry **__MIDL_0079);
+
+
+void __RPC_STUB ISubcategoryMembershipEntry_get_AllData_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ISubcategoryMembershipEntry_get_Subcategory_Proxy(
+ ISubcategoryMembershipEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0080);
+
+
+void __RPC_STUB ISubcategoryMembershipEntry_get_Subcategory_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ISubcategoryMembershipEntry_get_CategoryMembershipData_Proxy(
+ ISubcategoryMembershipEntry * This,
+ /* [retval][out] */ ISection **CategoryMembershipData);
+
+
+void __RPC_STUB ISubcategoryMembershipEntry_get_CategoryMembershipData_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __ISubcategoryMembershipEntry_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_isolation_0289 */
+/* [local] */
+
+typedef struct _CategoryMembershipEntry
+ {
+ IDefinitionIdentity *Identity;
+ ISection *SubcategoryMembership;
+ } CategoryMembershipEntry;
+
+typedef
+enum _CategoryMembershipEntryFieldId
+ { CategoryMembership_SubcategoryMembership = 0
+ } CategoryMembershipEntryFieldId;
+
+
+
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0289_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0289_v0_0_s_ifspec;
+
+#ifndef __ICategoryMembershipEntry_INTERFACE_DEFINED__
+#define __ICategoryMembershipEntry_INTERFACE_DEFINED__
+
+/* interface ICategoryMembershipEntry */
+/* [uuid][unique][object][local] */
+
+
+EXTERN_C const IID IID_ICategoryMembershipEntry;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("97FDCA77-B6F2-4718-A1EB-29D0AECE9C03")
+ ICategoryMembershipEntry : public IUnknown
+ {
+ public:
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
+ /* [retval][out] */ CategoryMembershipEntry **__MIDL_0081) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Identity(
+ /* [retval][out] */ IDefinitionIdentity **__MIDL_0082) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SubcategoryMembership(
+ /* [retval][out] */ ISection **SubcategoryMembership) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct ICategoryMembershipEntryVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ ICategoryMembershipEntry * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ ICategoryMembershipEntry * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ ICategoryMembershipEntry * This);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
+ ICategoryMembershipEntry * This,
+ /* [retval][out] */ CategoryMembershipEntry **__MIDL_0081);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Identity )(
+ ICategoryMembershipEntry * This,
+ /* [retval][out] */ IDefinitionIdentity **__MIDL_0082);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_SubcategoryMembership )(
+ ICategoryMembershipEntry * This,
+ /* [retval][out] */ ISection **SubcategoryMembership);
+
+ END_INTERFACE
+ } ICategoryMembershipEntryVtbl;
+
+ interface ICategoryMembershipEntry
+ {
+ CONST_VTBL struct ICategoryMembershipEntryVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define ICategoryMembershipEntry_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define ICategoryMembershipEntry_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define ICategoryMembershipEntry_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define ICategoryMembershipEntry_get_AllData(This,__MIDL_0081) \
+ (This)->lpVtbl -> get_AllData(This,__MIDL_0081)
+
+#define ICategoryMembershipEntry_get_Identity(This,__MIDL_0082) \
+ (This)->lpVtbl -> get_Identity(This,__MIDL_0082)
+
+#define ICategoryMembershipEntry_get_SubcategoryMembership(This,SubcategoryMembership) \
+ (This)->lpVtbl -> get_SubcategoryMembership(This,SubcategoryMembership)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ICategoryMembershipEntry_get_AllData_Proxy(
+ ICategoryMembershipEntry * This,
+ /* [retval][out] */ CategoryMembershipEntry **__MIDL_0081);
+
+
+void __RPC_STUB ICategoryMembershipEntry_get_AllData_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ICategoryMembershipEntry_get_Identity_Proxy(
+ ICategoryMembershipEntry * This,
+ /* [retval][out] */ IDefinitionIdentity **__MIDL_0082);
+
+
+void __RPC_STUB ICategoryMembershipEntry_get_Identity_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ICategoryMembershipEntry_get_SubcategoryMembership_Proxy(
+ ICategoryMembershipEntry * This,
+ /* [retval][out] */ ISection **SubcategoryMembership);
+
+
+void __RPC_STUB ICategoryMembershipEntry_get_SubcategoryMembership_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __ICategoryMembershipEntry_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_isolation_0290 */
+/* [local] */
+
+typedef struct _COMServerEntry
+ {
+ GUID Clsid;
+ ULONG Flags;
+ GUID ConfiguredGuid;
+ GUID ImplementedClsid;
+ GUID TypeLibrary;
+ ULONG ThreadingModel;
+ LPCWSTR RuntimeVersion;
+ LPCWSTR HostFile;
+ } COMServerEntry;
+
+typedef
+enum _COMServerEntryFieldId
+ { COMServer_Flags = 0,
+ COMServer_ConfiguredGuid = COMServer_Flags + 1,
+ COMServer_ImplementedClsid = COMServer_ConfiguredGuid + 1,
+ COMServer_TypeLibrary = COMServer_ImplementedClsid + 1,
+ COMServer_ThreadingModel = COMServer_TypeLibrary + 1,
+ COMServer_RuntimeVersion = COMServer_ThreadingModel + 1,
+ COMServer_HostFile = COMServer_RuntimeVersion + 1
+ } COMServerEntryFieldId;
+
+
+
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0290_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0290_v0_0_s_ifspec;
+
+#ifndef __ICOMServerEntry_INTERFACE_DEFINED__
+#define __ICOMServerEntry_INTERFACE_DEFINED__
+
+/* interface ICOMServerEntry */
+/* [uuid][unique][object][local] */
+
+
+EXTERN_C const IID IID_ICOMServerEntry;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("3903B11B-FBE8-477c-825F-DB828B5FD174")
+ ICOMServerEntry : public IUnknown
+ {
+ public:
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
+ /* [retval][out] */ COMServerEntry **__MIDL_0083) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Clsid(
+ /* [retval][out] */ GUID *__MIDL_0084) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Flags(
+ /* [retval][out] */ ULONG *__MIDL_0085) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ConfiguredGuid(
+ /* [retval][out] */ GUID *__MIDL_0086) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ImplementedClsid(
+ /* [retval][out] */ GUID *__MIDL_0087) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_TypeLibrary(
+ /* [retval][out] */ GUID *__MIDL_0088) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ThreadingModel(
+ /* [retval][out] */ ULONG *__MIDL_0089) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_RuntimeVersion(
+ /* [retval][out] */ LPCWSTR *__MIDL_0090) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_HostFile(
+ /* [retval][out] */ LPCWSTR *__MIDL_0091) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct ICOMServerEntryVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ ICOMServerEntry * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ ICOMServerEntry * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ ICOMServerEntry * This);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
+ ICOMServerEntry * This,
+ /* [retval][out] */ COMServerEntry **__MIDL_0083);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Clsid )(
+ ICOMServerEntry * This,
+ /* [retval][out] */ GUID *__MIDL_0084);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Flags )(
+ ICOMServerEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0085);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ConfiguredGuid )(
+ ICOMServerEntry * This,
+ /* [retval][out] */ GUID *__MIDL_0086);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ImplementedClsid )(
+ ICOMServerEntry * This,
+ /* [retval][out] */ GUID *__MIDL_0087);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_TypeLibrary )(
+ ICOMServerEntry * This,
+ /* [retval][out] */ GUID *__MIDL_0088);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ThreadingModel )(
+ ICOMServerEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0089);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_RuntimeVersion )(
+ ICOMServerEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0090);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_HostFile )(
+ ICOMServerEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0091);
+
+ END_INTERFACE
+ } ICOMServerEntryVtbl;
+
+ interface ICOMServerEntry
+ {
+ CONST_VTBL struct ICOMServerEntryVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define ICOMServerEntry_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define ICOMServerEntry_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define ICOMServerEntry_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define ICOMServerEntry_get_AllData(This,__MIDL_0083) \
+ (This)->lpVtbl -> get_AllData(This,__MIDL_0083)
+
+#define ICOMServerEntry_get_Clsid(This,__MIDL_0084) \
+ (This)->lpVtbl -> get_Clsid(This,__MIDL_0084)
+
+#define ICOMServerEntry_get_Flags(This,__MIDL_0085) \
+ (This)->lpVtbl -> get_Flags(This,__MIDL_0085)
+
+#define ICOMServerEntry_get_ConfiguredGuid(This,__MIDL_0086) \
+ (This)->lpVtbl -> get_ConfiguredGuid(This,__MIDL_0086)
+
+#define ICOMServerEntry_get_ImplementedClsid(This,__MIDL_0087) \
+ (This)->lpVtbl -> get_ImplementedClsid(This,__MIDL_0087)
+
+#define ICOMServerEntry_get_TypeLibrary(This,__MIDL_0088) \
+ (This)->lpVtbl -> get_TypeLibrary(This,__MIDL_0088)
+
+#define ICOMServerEntry_get_ThreadingModel(This,__MIDL_0089) \
+ (This)->lpVtbl -> get_ThreadingModel(This,__MIDL_0089)
+
+#define ICOMServerEntry_get_RuntimeVersion(This,__MIDL_0090) \
+ (This)->lpVtbl -> get_RuntimeVersion(This,__MIDL_0090)
+
+#define ICOMServerEntry_get_HostFile(This,__MIDL_0091) \
+ (This)->lpVtbl -> get_HostFile(This,__MIDL_0091)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ICOMServerEntry_get_AllData_Proxy(
+ ICOMServerEntry * This,
+ /* [retval][out] */ COMServerEntry **__MIDL_0083);
+
+
+void __RPC_STUB ICOMServerEntry_get_AllData_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ICOMServerEntry_get_Clsid_Proxy(
+ ICOMServerEntry * This,
+ /* [retval][out] */ GUID *__MIDL_0084);
+
+
+void __RPC_STUB ICOMServerEntry_get_Clsid_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ICOMServerEntry_get_Flags_Proxy(
+ ICOMServerEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0085);
+
+
+void __RPC_STUB ICOMServerEntry_get_Flags_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ICOMServerEntry_get_ConfiguredGuid_Proxy(
+ ICOMServerEntry * This,
+ /* [retval][out] */ GUID *__MIDL_0086);
+
+
+void __RPC_STUB ICOMServerEntry_get_ConfiguredGuid_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ICOMServerEntry_get_ImplementedClsid_Proxy(
+ ICOMServerEntry * This,
+ /* [retval][out] */ GUID *__MIDL_0087);
+
+
+void __RPC_STUB ICOMServerEntry_get_ImplementedClsid_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ICOMServerEntry_get_TypeLibrary_Proxy(
+ ICOMServerEntry * This,
+ /* [retval][out] */ GUID *__MIDL_0088);
+
+
+void __RPC_STUB ICOMServerEntry_get_TypeLibrary_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ICOMServerEntry_get_ThreadingModel_Proxy(
+ ICOMServerEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0089);
+
+
+void __RPC_STUB ICOMServerEntry_get_ThreadingModel_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ICOMServerEntry_get_RuntimeVersion_Proxy(
+ ICOMServerEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0090);
+
+
+void __RPC_STUB ICOMServerEntry_get_RuntimeVersion_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ICOMServerEntry_get_HostFile_Proxy(
+ ICOMServerEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0091);
+
+
+void __RPC_STUB ICOMServerEntry_get_HostFile_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __ICOMServerEntry_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_isolation_0291 */
+/* [local] */
+
+typedef struct _ProgIdRedirectionEntry
+ {
+ LPCWSTR ProgId;
+ GUID RedirectedGuid;
+ } ProgIdRedirectionEntry;
+
+typedef
+enum _ProgIdRedirectionEntryFieldId
+ { ProgIdRedirection_RedirectedGuid = 0
+ } ProgIdRedirectionEntryFieldId;
+
+
+
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0291_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0291_v0_0_s_ifspec;
+
+#ifndef __IProgIdRedirectionEntry_INTERFACE_DEFINED__
+#define __IProgIdRedirectionEntry_INTERFACE_DEFINED__
+
+/* interface IProgIdRedirectionEntry */
+/* [uuid][unique][object][local] */
+
+
+EXTERN_C const IID IID_IProgIdRedirectionEntry;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("54F198EC-A63A-45ea-A984-452F68D9B35B")
+ IProgIdRedirectionEntry : public IUnknown
+ {
+ public:
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
+ /* [retval][out] */ ProgIdRedirectionEntry **__MIDL_0092) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ProgId(
+ /* [retval][out] */ LPCWSTR *__MIDL_0093) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_RedirectedGuid(
+ /* [retval][out] */ GUID *__MIDL_0094) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IProgIdRedirectionEntryVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IProgIdRedirectionEntry * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IProgIdRedirectionEntry * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IProgIdRedirectionEntry * This);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
+ IProgIdRedirectionEntry * This,
+ /* [retval][out] */ ProgIdRedirectionEntry **__MIDL_0092);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ProgId )(
+ IProgIdRedirectionEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0093);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_RedirectedGuid )(
+ IProgIdRedirectionEntry * This,
+ /* [retval][out] */ GUID *__MIDL_0094);
+
+ END_INTERFACE
+ } IProgIdRedirectionEntryVtbl;
+
+ interface IProgIdRedirectionEntry
+ {
+ CONST_VTBL struct IProgIdRedirectionEntryVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IProgIdRedirectionEntry_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IProgIdRedirectionEntry_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IProgIdRedirectionEntry_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IProgIdRedirectionEntry_get_AllData(This,__MIDL_0092) \
+ (This)->lpVtbl -> get_AllData(This,__MIDL_0092)
+
+#define IProgIdRedirectionEntry_get_ProgId(This,__MIDL_0093) \
+ (This)->lpVtbl -> get_ProgId(This,__MIDL_0093)
+
+#define IProgIdRedirectionEntry_get_RedirectedGuid(This,__MIDL_0094) \
+ (This)->lpVtbl -> get_RedirectedGuid(This,__MIDL_0094)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IProgIdRedirectionEntry_get_AllData_Proxy(
+ IProgIdRedirectionEntry * This,
+ /* [retval][out] */ ProgIdRedirectionEntry **__MIDL_0092);
+
+
+void __RPC_STUB IProgIdRedirectionEntry_get_AllData_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IProgIdRedirectionEntry_get_ProgId_Proxy(
+ IProgIdRedirectionEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0093);
+
+
+void __RPC_STUB IProgIdRedirectionEntry_get_ProgId_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IProgIdRedirectionEntry_get_RedirectedGuid_Proxy(
+ IProgIdRedirectionEntry * This,
+ /* [retval][out] */ GUID *__MIDL_0094);
+
+
+void __RPC_STUB IProgIdRedirectionEntry_get_RedirectedGuid_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IProgIdRedirectionEntry_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_isolation_0292 */
+/* [local] */
+
+typedef struct _CLRSurrogateEntry
+ {
+ GUID Clsid;
+ LPCWSTR RuntimeVersion;
+ LPCWSTR ClassName;
+ } CLRSurrogateEntry;
+
+typedef
+enum _CLRSurrogateEntryFieldId
+ { CLRSurrogate_RuntimeVersion = 0,
+ CLRSurrogate_ClassName = CLRSurrogate_RuntimeVersion + 1
+ } CLRSurrogateEntryFieldId;
+
+
+
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0292_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0292_v0_0_s_ifspec;
+
+#ifndef __ICLRSurrogateEntry_INTERFACE_DEFINED__
+#define __ICLRSurrogateEntry_INTERFACE_DEFINED__
+
+/* interface ICLRSurrogateEntry */
+/* [uuid][unique][object][local] */
+
+
+EXTERN_C const IID IID_ICLRSurrogateEntry;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("1E0422A1-F0D2-44ae-914B-8A2DECCFD22B")
+ ICLRSurrogateEntry : public IUnknown
+ {
+ public:
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
+ /* [retval][out] */ CLRSurrogateEntry **__MIDL_0095) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Clsid(
+ /* [retval][out] */ GUID *__MIDL_0096) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_RuntimeVersion(
+ /* [retval][out] */ LPCWSTR *__MIDL_0097) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ClassName(
+ /* [retval][out] */ LPCWSTR *__MIDL_0098) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct ICLRSurrogateEntryVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ ICLRSurrogateEntry * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ ICLRSurrogateEntry * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ ICLRSurrogateEntry * This);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
+ ICLRSurrogateEntry * This,
+ /* [retval][out] */ CLRSurrogateEntry **__MIDL_0095);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Clsid )(
+ ICLRSurrogateEntry * This,
+ /* [retval][out] */ GUID *__MIDL_0096);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_RuntimeVersion )(
+ ICLRSurrogateEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0097);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ClassName )(
+ ICLRSurrogateEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0098);
+
+ END_INTERFACE
+ } ICLRSurrogateEntryVtbl;
+
+ interface ICLRSurrogateEntry
+ {
+ CONST_VTBL struct ICLRSurrogateEntryVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define ICLRSurrogateEntry_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define ICLRSurrogateEntry_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define ICLRSurrogateEntry_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define ICLRSurrogateEntry_get_AllData(This,__MIDL_0095) \
+ (This)->lpVtbl -> get_AllData(This,__MIDL_0095)
+
+#define ICLRSurrogateEntry_get_Clsid(This,__MIDL_0096) \
+ (This)->lpVtbl -> get_Clsid(This,__MIDL_0096)
+
+#define ICLRSurrogateEntry_get_RuntimeVersion(This,__MIDL_0097) \
+ (This)->lpVtbl -> get_RuntimeVersion(This,__MIDL_0097)
+
+#define ICLRSurrogateEntry_get_ClassName(This,__MIDL_0098) \
+ (This)->lpVtbl -> get_ClassName(This,__MIDL_0098)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ICLRSurrogateEntry_get_AllData_Proxy(
+ ICLRSurrogateEntry * This,
+ /* [retval][out] */ CLRSurrogateEntry **__MIDL_0095);
+
+
+void __RPC_STUB ICLRSurrogateEntry_get_AllData_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ICLRSurrogateEntry_get_Clsid_Proxy(
+ ICLRSurrogateEntry * This,
+ /* [retval][out] */ GUID *__MIDL_0096);
+
+
+void __RPC_STUB ICLRSurrogateEntry_get_Clsid_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ICLRSurrogateEntry_get_RuntimeVersion_Proxy(
+ ICLRSurrogateEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0097);
+
+
+void __RPC_STUB ICLRSurrogateEntry_get_RuntimeVersion_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ICLRSurrogateEntry_get_ClassName_Proxy(
+ ICLRSurrogateEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0098);
+
+
+void __RPC_STUB ICLRSurrogateEntry_get_ClassName_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __ICLRSurrogateEntry_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_isolation_0293 */
+/* [local] */
+
+typedef struct _AssemblyReferenceDependentAssemblyEntry
+ {
+ LPCWSTR Group;
+ LPCWSTR Codebase;
+ ULONGLONG Size;
+ /* [size_is] */ BYTE *HashValue;
+ ULONG HashValueSize;
+ ULONG HashAlgorithm;
+ ULONG Flags;
+ LPCWSTR ResourceFallbackCulture;
+ LPCWSTR Description;
+ LPCWSTR SupportUrl;
+ ISection *HashElements;
+ } AssemblyReferenceDependentAssemblyEntry;
+
+typedef
+enum _AssemblyReferenceDependentAssemblyEntryFieldId
+ { AssemblyReferenceDependentAssembly_Group = 0,
+ AssemblyReferenceDependentAssembly_Codebase = AssemblyReferenceDependentAssembly_Group + 1,
+ AssemblyReferenceDependentAssembly_Size = AssemblyReferenceDependentAssembly_Codebase + 1,
+ AssemblyReferenceDependentAssembly_HashValue = AssemblyReferenceDependentAssembly_Size + 1,
+ AssemblyReferenceDependentAssembly_HashValueSize = AssemblyReferenceDependentAssembly_HashValue + 1,
+ AssemblyReferenceDependentAssembly_HashAlgorithm = AssemblyReferenceDependentAssembly_HashValueSize + 1,
+ AssemblyReferenceDependentAssembly_Flags = AssemblyReferenceDependentAssembly_HashAlgorithm + 1,
+ AssemblyReferenceDependentAssembly_ResourceFallbackCulture = AssemblyReferenceDependentAssembly_Flags + 1,
+ AssemblyReferenceDependentAssembly_Description = AssemblyReferenceDependentAssembly_ResourceFallbackCulture + 1,
+ AssemblyReferenceDependentAssembly_SupportUrl = AssemblyReferenceDependentAssembly_Description + 1,
+ AssemblyReferenceDependentAssembly_HashElements = AssemblyReferenceDependentAssembly_SupportUrl + 1
+ } AssemblyReferenceDependentAssemblyEntryFieldId;
+
+
+
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0293_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0293_v0_0_s_ifspec;
+
+#ifndef __IAssemblyReferenceDependentAssemblyEntry_INTERFACE_DEFINED__
+#define __IAssemblyReferenceDependentAssemblyEntry_INTERFACE_DEFINED__
+
+/* interface IAssemblyReferenceDependentAssemblyEntry */
+/* [uuid][unique][object][local] */
+
+
+EXTERN_C const IID IID_IAssemblyReferenceDependentAssemblyEntry;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("C31FF59E-CD25-47b8-9EF3-CF4433EB97CC")
+ IAssemblyReferenceDependentAssemblyEntry : public IUnknown
+ {
+ public:
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
+ /* [retval][out] */ AssemblyReferenceDependentAssemblyEntry **__MIDL_0099) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Group(
+ /* [retval][out] */ LPCWSTR *__MIDL_0100) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Codebase(
+ /* [retval][out] */ LPCWSTR *__MIDL_0101) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Size(
+ /* [retval][out] */ ULONGLONG *__MIDL_0102) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_HashValue(
+ /* [retval][out] */ IStream **__MIDL_0103) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_HashAlgorithm(
+ /* [retval][out] */ ULONG *__MIDL_0104) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Flags(
+ /* [retval][out] */ ULONG *__MIDL_0105) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ResourceFallbackCulture(
+ /* [retval][out] */ LPCWSTR *__MIDL_0106) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Description(
+ /* [retval][out] */ LPCWSTR *__MIDL_0107) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SupportUrl(
+ /* [retval][out] */ LPCWSTR *__MIDL_0108) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_HashElements(
+ /* [retval][out] */ ISection **HashElement) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IAssemblyReferenceDependentAssemblyEntryVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IAssemblyReferenceDependentAssemblyEntry * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IAssemblyReferenceDependentAssemblyEntry * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IAssemblyReferenceDependentAssemblyEntry * This);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
+ IAssemblyReferenceDependentAssemblyEntry * This,
+ /* [retval][out] */ AssemblyReferenceDependentAssemblyEntry **__MIDL_0099);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Group )(
+ IAssemblyReferenceDependentAssemblyEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0100);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Codebase )(
+ IAssemblyReferenceDependentAssemblyEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0101);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Size )(
+ IAssemblyReferenceDependentAssemblyEntry * This,
+ /* [retval][out] */ ULONGLONG *__MIDL_0102);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_HashValue )(
+ IAssemblyReferenceDependentAssemblyEntry * This,
+ /* [retval][out] */ IStream **__MIDL_0103);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_HashAlgorithm )(
+ IAssemblyReferenceDependentAssemblyEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0104);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Flags )(
+ IAssemblyReferenceDependentAssemblyEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0105);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ResourceFallbackCulture )(
+ IAssemblyReferenceDependentAssemblyEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0106);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Description )(
+ IAssemblyReferenceDependentAssemblyEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0107);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_SupportUrl )(
+ IAssemblyReferenceDependentAssemblyEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0108);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_HashElements )(
+ IAssemblyReferenceDependentAssemblyEntry * This,
+ /* [retval][out] */ ISection **HashElement);
+
+ END_INTERFACE
+ } IAssemblyReferenceDependentAssemblyEntryVtbl;
+
+ interface IAssemblyReferenceDependentAssemblyEntry
+ {
+ CONST_VTBL struct IAssemblyReferenceDependentAssemblyEntryVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IAssemblyReferenceDependentAssemblyEntry_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IAssemblyReferenceDependentAssemblyEntry_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IAssemblyReferenceDependentAssemblyEntry_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IAssemblyReferenceDependentAssemblyEntry_get_AllData(This,__MIDL_0099) \
+ (This)->lpVtbl -> get_AllData(This,__MIDL_0099)
+
+#define IAssemblyReferenceDependentAssemblyEntry_get_Group(This,__MIDL_0100) \
+ (This)->lpVtbl -> get_Group(This,__MIDL_0100)
+
+#define IAssemblyReferenceDependentAssemblyEntry_get_Codebase(This,__MIDL_0101) \
+ (This)->lpVtbl -> get_Codebase(This,__MIDL_0101)
+
+#define IAssemblyReferenceDependentAssemblyEntry_get_Size(This,__MIDL_0102) \
+ (This)->lpVtbl -> get_Size(This,__MIDL_0102)
+
+#define IAssemblyReferenceDependentAssemblyEntry_get_HashValue(This,__MIDL_0103) \
+ (This)->lpVtbl -> get_HashValue(This,__MIDL_0103)
+
+#define IAssemblyReferenceDependentAssemblyEntry_get_HashAlgorithm(This,__MIDL_0104) \
+ (This)->lpVtbl -> get_HashAlgorithm(This,__MIDL_0104)
+
+#define IAssemblyReferenceDependentAssemblyEntry_get_Flags(This,__MIDL_0105) \
+ (This)->lpVtbl -> get_Flags(This,__MIDL_0105)
+
+#define IAssemblyReferenceDependentAssemblyEntry_get_ResourceFallbackCulture(This,__MIDL_0106) \
+ (This)->lpVtbl -> get_ResourceFallbackCulture(This,__MIDL_0106)
+
+#define IAssemblyReferenceDependentAssemblyEntry_get_Description(This,__MIDL_0107) \
+ (This)->lpVtbl -> get_Description(This,__MIDL_0107)
+
+#define IAssemblyReferenceDependentAssemblyEntry_get_SupportUrl(This,__MIDL_0108) \
+ (This)->lpVtbl -> get_SupportUrl(This,__MIDL_0108)
+
+#define IAssemblyReferenceDependentAssemblyEntry_get_HashElements(This,HashElement) \
+ (This)->lpVtbl -> get_HashElements(This,HashElement)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IAssemblyReferenceDependentAssemblyEntry_get_AllData_Proxy(
+ IAssemblyReferenceDependentAssemblyEntry * This,
+ /* [retval][out] */ AssemblyReferenceDependentAssemblyEntry **__MIDL_0099);
+
+
+void __RPC_STUB IAssemblyReferenceDependentAssemblyEntry_get_AllData_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IAssemblyReferenceDependentAssemblyEntry_get_Group_Proxy(
+ IAssemblyReferenceDependentAssemblyEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0100);
+
+
+void __RPC_STUB IAssemblyReferenceDependentAssemblyEntry_get_Group_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IAssemblyReferenceDependentAssemblyEntry_get_Codebase_Proxy(
+ IAssemblyReferenceDependentAssemblyEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0101);
+
+
+void __RPC_STUB IAssemblyReferenceDependentAssemblyEntry_get_Codebase_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IAssemblyReferenceDependentAssemblyEntry_get_Size_Proxy(
+ IAssemblyReferenceDependentAssemblyEntry * This,
+ /* [retval][out] */ ULONGLONG *__MIDL_0102);
+
+
+void __RPC_STUB IAssemblyReferenceDependentAssemblyEntry_get_Size_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IAssemblyReferenceDependentAssemblyEntry_get_HashValue_Proxy(
+ IAssemblyReferenceDependentAssemblyEntry * This,
+ /* [retval][out] */ IStream **__MIDL_0103);
+
+
+void __RPC_STUB IAssemblyReferenceDependentAssemblyEntry_get_HashValue_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IAssemblyReferenceDependentAssemblyEntry_get_HashAlgorithm_Proxy(
+ IAssemblyReferenceDependentAssemblyEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0104);
+
+
+void __RPC_STUB IAssemblyReferenceDependentAssemblyEntry_get_HashAlgorithm_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IAssemblyReferenceDependentAssemblyEntry_get_Flags_Proxy(
+ IAssemblyReferenceDependentAssemblyEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0105);
+
+
+void __RPC_STUB IAssemblyReferenceDependentAssemblyEntry_get_Flags_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IAssemblyReferenceDependentAssemblyEntry_get_ResourceFallbackCulture_Proxy(
+ IAssemblyReferenceDependentAssemblyEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0106);
+
+
+void __RPC_STUB IAssemblyReferenceDependentAssemblyEntry_get_ResourceFallbackCulture_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IAssemblyReferenceDependentAssemblyEntry_get_Description_Proxy(
+ IAssemblyReferenceDependentAssemblyEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0107);
+
+
+void __RPC_STUB IAssemblyReferenceDependentAssemblyEntry_get_Description_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IAssemblyReferenceDependentAssemblyEntry_get_SupportUrl_Proxy(
+ IAssemblyReferenceDependentAssemblyEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0108);
+
+
+void __RPC_STUB IAssemblyReferenceDependentAssemblyEntry_get_SupportUrl_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IAssemblyReferenceDependentAssemblyEntry_get_HashElements_Proxy(
+ IAssemblyReferenceDependentAssemblyEntry * This,
+ /* [retval][out] */ ISection **HashElement);
+
+
+void __RPC_STUB IAssemblyReferenceDependentAssemblyEntry_get_HashElements_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IAssemblyReferenceDependentAssemblyEntry_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_isolation_0294 */
+/* [local] */
+
+typedef struct _AssemblyReferenceEntry
+ {
+ IReferenceIdentity *ReferenceIdentity;
+ ULONG Flags;
+ AssemblyReferenceDependentAssemblyEntry DependentAssembly;
+ } AssemblyReferenceEntry;
+
+typedef
+enum _AssemblyReferenceEntryFieldId
+ { AssemblyReference_Flags = 0,
+ AssemblyReference_DependentAssembly = AssemblyReference_Flags + 1
+ } AssemblyReferenceEntryFieldId;
+
+
+
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0294_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0294_v0_0_s_ifspec;
+
+#ifndef __IAssemblyReferenceEntry_INTERFACE_DEFINED__
+#define __IAssemblyReferenceEntry_INTERFACE_DEFINED__
+
+/* interface IAssemblyReferenceEntry */
+/* [uuid][unique][object][local] */
+
+
+EXTERN_C const IID IID_IAssemblyReferenceEntry;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("FD47B733-AFBC-45e4-B7C2-BBEB1D9F766C")
+ IAssemblyReferenceEntry : public IUnknown
+ {
+ public:
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
+ /* [retval][out] */ AssemblyReferenceEntry **__MIDL_0109) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ReferenceIdentity(
+ /* [retval][out] */ IReferenceIdentity **__MIDL_0110) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Flags(
+ /* [retval][out] */ ULONG *__MIDL_0111) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_DependentAssembly(
+ /* [retval][out] */ IAssemblyReferenceDependentAssemblyEntry **__MIDL_0112) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IAssemblyReferenceEntryVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IAssemblyReferenceEntry * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IAssemblyReferenceEntry * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IAssemblyReferenceEntry * This);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
+ IAssemblyReferenceEntry * This,
+ /* [retval][out] */ AssemblyReferenceEntry **__MIDL_0109);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ReferenceIdentity )(
+ IAssemblyReferenceEntry * This,
+ /* [retval][out] */ IReferenceIdentity **__MIDL_0110);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Flags )(
+ IAssemblyReferenceEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0111);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_DependentAssembly )(
+ IAssemblyReferenceEntry * This,
+ /* [retval][out] */ IAssemblyReferenceDependentAssemblyEntry **__MIDL_0112);
+
+ END_INTERFACE
+ } IAssemblyReferenceEntryVtbl;
+
+ interface IAssemblyReferenceEntry
+ {
+ CONST_VTBL struct IAssemblyReferenceEntryVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IAssemblyReferenceEntry_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IAssemblyReferenceEntry_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IAssemblyReferenceEntry_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IAssemblyReferenceEntry_get_AllData(This,__MIDL_0109) \
+ (This)->lpVtbl -> get_AllData(This,__MIDL_0109)
+
+#define IAssemblyReferenceEntry_get_ReferenceIdentity(This,__MIDL_0110) \
+ (This)->lpVtbl -> get_ReferenceIdentity(This,__MIDL_0110)
+
+#define IAssemblyReferenceEntry_get_Flags(This,__MIDL_0111) \
+ (This)->lpVtbl -> get_Flags(This,__MIDL_0111)
+
+#define IAssemblyReferenceEntry_get_DependentAssembly(This,__MIDL_0112) \
+ (This)->lpVtbl -> get_DependentAssembly(This,__MIDL_0112)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IAssemblyReferenceEntry_get_AllData_Proxy(
+ IAssemblyReferenceEntry * This,
+ /* [retval][out] */ AssemblyReferenceEntry **__MIDL_0109);
+
+
+void __RPC_STUB IAssemblyReferenceEntry_get_AllData_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IAssemblyReferenceEntry_get_ReferenceIdentity_Proxy(
+ IAssemblyReferenceEntry * This,
+ /* [retval][out] */ IReferenceIdentity **__MIDL_0110);
+
+
+void __RPC_STUB IAssemblyReferenceEntry_get_ReferenceIdentity_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IAssemblyReferenceEntry_get_Flags_Proxy(
+ IAssemblyReferenceEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0111);
+
+
+void __RPC_STUB IAssemblyReferenceEntry_get_Flags_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IAssemblyReferenceEntry_get_DependentAssembly_Proxy(
+ IAssemblyReferenceEntry * This,
+ /* [retval][out] */ IAssemblyReferenceDependentAssemblyEntry **__MIDL_0112);
+
+
+void __RPC_STUB IAssemblyReferenceEntry_get_DependentAssembly_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IAssemblyReferenceEntry_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_isolation_0295 */
+/* [local] */
+
+typedef struct _WindowClassEntry
+ {
+ LPCWSTR ClassName;
+ LPCWSTR HostDll;
+ BOOLEAN fVersioned;
+ } WindowClassEntry;
+
+typedef
+enum _WindowClassEntryFieldId
+ { WindowClass_HostDll = 0,
+ WindowClass_fVersioned = WindowClass_HostDll + 1
+ } WindowClassEntryFieldId;
+
+
+
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0295_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0295_v0_0_s_ifspec;
+
+#ifndef __IWindowClassEntry_INTERFACE_DEFINED__
+#define __IWindowClassEntry_INTERFACE_DEFINED__
+
+/* interface IWindowClassEntry */
+/* [uuid][unique][object][local] */
+
+
+EXTERN_C const IID IID_IWindowClassEntry;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("8AD3FC86-AFD3-477a-8FD5-146C291195BA")
+ IWindowClassEntry : public IUnknown
+ {
+ public:
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
+ /* [retval][out] */ WindowClassEntry **__MIDL_0113) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ClassName(
+ /* [retval][out] */ LPCWSTR *__MIDL_0114) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_HostDll(
+ /* [retval][out] */ LPCWSTR *__MIDL_0115) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_fVersioned(
+ /* [retval][out] */ BOOLEAN *__MIDL_0116) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IWindowClassEntryVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IWindowClassEntry * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IWindowClassEntry * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IWindowClassEntry * This);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
+ IWindowClassEntry * This,
+ /* [retval][out] */ WindowClassEntry **__MIDL_0113);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ClassName )(
+ IWindowClassEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0114);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_HostDll )(
+ IWindowClassEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0115);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_fVersioned )(
+ IWindowClassEntry * This,
+ /* [retval][out] */ BOOLEAN *__MIDL_0116);
+
+ END_INTERFACE
+ } IWindowClassEntryVtbl;
+
+ interface IWindowClassEntry
+ {
+ CONST_VTBL struct IWindowClassEntryVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IWindowClassEntry_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IWindowClassEntry_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IWindowClassEntry_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IWindowClassEntry_get_AllData(This,__MIDL_0113) \
+ (This)->lpVtbl -> get_AllData(This,__MIDL_0113)
+
+#define IWindowClassEntry_get_ClassName(This,__MIDL_0114) \
+ (This)->lpVtbl -> get_ClassName(This,__MIDL_0114)
+
+#define IWindowClassEntry_get_HostDll(This,__MIDL_0115) \
+ (This)->lpVtbl -> get_HostDll(This,__MIDL_0115)
+
+#define IWindowClassEntry_get_fVersioned(This,__MIDL_0116) \
+ (This)->lpVtbl -> get_fVersioned(This,__MIDL_0116)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IWindowClassEntry_get_AllData_Proxy(
+ IWindowClassEntry * This,
+ /* [retval][out] */ WindowClassEntry **__MIDL_0113);
+
+
+void __RPC_STUB IWindowClassEntry_get_AllData_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IWindowClassEntry_get_ClassName_Proxy(
+ IWindowClassEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0114);
+
+
+void __RPC_STUB IWindowClassEntry_get_ClassName_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IWindowClassEntry_get_HostDll_Proxy(
+ IWindowClassEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0115);
+
+
+void __RPC_STUB IWindowClassEntry_get_HostDll_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IWindowClassEntry_get_fVersioned_Proxy(
+ IWindowClassEntry * This,
+ /* [retval][out] */ BOOLEAN *__MIDL_0116);
+
+
+void __RPC_STUB IWindowClassEntry_get_fVersioned_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IWindowClassEntry_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_isolation_0296 */
+/* [local] */
+
+typedef struct _ResourceTableMappingEntry
+ {
+ LPCWSTR id;
+ LPCWSTR FinalStringMapped;
+ } ResourceTableMappingEntry;
+
+typedef
+enum _ResourceTableMappingEntryFieldId
+ { ResourceTableMapping_FinalStringMapped = 0
+ } ResourceTableMappingEntryFieldId;
+
+
+
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0296_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0296_v0_0_s_ifspec;
+
+#ifndef __IResourceTableMappingEntry_INTERFACE_DEFINED__
+#define __IResourceTableMappingEntry_INTERFACE_DEFINED__
+
+/* interface IResourceTableMappingEntry */
+/* [uuid][unique][object][local] */
+
+
+EXTERN_C const IID IID_IResourceTableMappingEntry;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("70A4ECEE-B195-4c59-85BF-44B6ACA83F07")
+ IResourceTableMappingEntry : public IUnknown
+ {
+ public:
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
+ /* [retval][out] */ ResourceTableMappingEntry **__MIDL_0117) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_id(
+ /* [retval][out] */ LPCWSTR *__MIDL_0118) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_FinalStringMapped(
+ /* [retval][out] */ LPCWSTR *__MIDL_0119) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IResourceTableMappingEntryVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IResourceTableMappingEntry * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IResourceTableMappingEntry * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IResourceTableMappingEntry * This);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
+ IResourceTableMappingEntry * This,
+ /* [retval][out] */ ResourceTableMappingEntry **__MIDL_0117);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_id )(
+ IResourceTableMappingEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0118);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FinalStringMapped )(
+ IResourceTableMappingEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0119);
+
+ END_INTERFACE
+ } IResourceTableMappingEntryVtbl;
+
+ interface IResourceTableMappingEntry
+ {
+ CONST_VTBL struct IResourceTableMappingEntryVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IResourceTableMappingEntry_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IResourceTableMappingEntry_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IResourceTableMappingEntry_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IResourceTableMappingEntry_get_AllData(This,__MIDL_0117) \
+ (This)->lpVtbl -> get_AllData(This,__MIDL_0117)
+
+#define IResourceTableMappingEntry_get_id(This,__MIDL_0118) \
+ (This)->lpVtbl -> get_id(This,__MIDL_0118)
+
+#define IResourceTableMappingEntry_get_FinalStringMapped(This,__MIDL_0119) \
+ (This)->lpVtbl -> get_FinalStringMapped(This,__MIDL_0119)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IResourceTableMappingEntry_get_AllData_Proxy(
+ IResourceTableMappingEntry * This,
+ /* [retval][out] */ ResourceTableMappingEntry **__MIDL_0117);
+
+
+void __RPC_STUB IResourceTableMappingEntry_get_AllData_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IResourceTableMappingEntry_get_id_Proxy(
+ IResourceTableMappingEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0118);
+
+
+void __RPC_STUB IResourceTableMappingEntry_get_id_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IResourceTableMappingEntry_get_FinalStringMapped_Proxy(
+ IResourceTableMappingEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0119);
+
+
+void __RPC_STUB IResourceTableMappingEntry_get_FinalStringMapped_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IResourceTableMappingEntry_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_isolation_0297 */
+/* [local] */
+
+typedef struct _EntryPointEntry
+ {
+ LPCWSTR Name;
+ LPCWSTR CommandLine_File;
+ LPCWSTR CommandLine_Parameters;
+ IReferenceIdentity *Identity;
+ ULONG Flags;
+ } EntryPointEntry;
+
+typedef
+enum _EntryPointEntryFieldId
+ { EntryPoint_CommandLine_File = 0,
+ EntryPoint_CommandLine_Parameters = EntryPoint_CommandLine_File + 1,
+ EntryPoint_Identity = EntryPoint_CommandLine_Parameters + 1,
+ EntryPoint_Flags = EntryPoint_Identity + 1
+ } EntryPointEntryFieldId;
+
+
+
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0297_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0297_v0_0_s_ifspec;
+
+#ifndef __IEntryPointEntry_INTERFACE_DEFINED__
+#define __IEntryPointEntry_INTERFACE_DEFINED__
+
+/* interface IEntryPointEntry */
+/* [uuid][unique][object][local] */
+
+
+EXTERN_C const IID IID_IEntryPointEntry;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("1583EFE9-832F-4d08-B041-CAC5ACEDB948")
+ IEntryPointEntry : public IUnknown
+ {
+ public:
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
+ /* [retval][out] */ EntryPointEntry **__MIDL_0120) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Name(
+ /* [retval][out] */ LPCWSTR *__MIDL_0121) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_CommandLine_File(
+ /* [retval][out] */ LPCWSTR *__MIDL_0122) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_CommandLine_Parameters(
+ /* [retval][out] */ LPCWSTR *__MIDL_0123) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Identity(
+ /* [retval][out] */ IReferenceIdentity **__MIDL_0124) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Flags(
+ /* [retval][out] */ ULONG *__MIDL_0125) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IEntryPointEntryVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IEntryPointEntry * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IEntryPointEntry * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IEntryPointEntry * This);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
+ IEntryPointEntry * This,
+ /* [retval][out] */ EntryPointEntry **__MIDL_0120);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Name )(
+ IEntryPointEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0121);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_CommandLine_File )(
+ IEntryPointEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0122);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_CommandLine_Parameters )(
+ IEntryPointEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0123);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Identity )(
+ IEntryPointEntry * This,
+ /* [retval][out] */ IReferenceIdentity **__MIDL_0124);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Flags )(
+ IEntryPointEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0125);
+
+ END_INTERFACE
+ } IEntryPointEntryVtbl;
+
+ interface IEntryPointEntry
+ {
+ CONST_VTBL struct IEntryPointEntryVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IEntryPointEntry_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IEntryPointEntry_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IEntryPointEntry_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IEntryPointEntry_get_AllData(This,__MIDL_0120) \
+ (This)->lpVtbl -> get_AllData(This,__MIDL_0120)
+
+#define IEntryPointEntry_get_Name(This,__MIDL_0121) \
+ (This)->lpVtbl -> get_Name(This,__MIDL_0121)
+
+#define IEntryPointEntry_get_CommandLine_File(This,__MIDL_0122) \
+ (This)->lpVtbl -> get_CommandLine_File(This,__MIDL_0122)
+
+#define IEntryPointEntry_get_CommandLine_Parameters(This,__MIDL_0123) \
+ (This)->lpVtbl -> get_CommandLine_Parameters(This,__MIDL_0123)
+
+#define IEntryPointEntry_get_Identity(This,__MIDL_0124) \
+ (This)->lpVtbl -> get_Identity(This,__MIDL_0124)
+
+#define IEntryPointEntry_get_Flags(This,__MIDL_0125) \
+ (This)->lpVtbl -> get_Flags(This,__MIDL_0125)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IEntryPointEntry_get_AllData_Proxy(
+ IEntryPointEntry * This,
+ /* [retval][out] */ EntryPointEntry **__MIDL_0120);
+
+
+void __RPC_STUB IEntryPointEntry_get_AllData_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IEntryPointEntry_get_Name_Proxy(
+ IEntryPointEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0121);
+
+
+void __RPC_STUB IEntryPointEntry_get_Name_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IEntryPointEntry_get_CommandLine_File_Proxy(
+ IEntryPointEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0122);
+
+
+void __RPC_STUB IEntryPointEntry_get_CommandLine_File_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IEntryPointEntry_get_CommandLine_Parameters_Proxy(
+ IEntryPointEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0123);
+
+
+void __RPC_STUB IEntryPointEntry_get_CommandLine_Parameters_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IEntryPointEntry_get_Identity_Proxy(
+ IEntryPointEntry * This,
+ /* [retval][out] */ IReferenceIdentity **__MIDL_0124);
+
+
+void __RPC_STUB IEntryPointEntry_get_Identity_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IEntryPointEntry_get_Flags_Proxy(
+ IEntryPointEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0125);
+
+
+void __RPC_STUB IEntryPointEntry_get_Flags_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IEntryPointEntry_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_isolation_0298 */
+/* [local] */
+
+typedef struct _PermissionSetEntry
+ {
+ LPCWSTR Id;
+ LPCWSTR XmlSegment;
+ } PermissionSetEntry;
+
+typedef
+enum _PermissionSetEntryFieldId
+ { PermissionSet_XmlSegment = 0
+ } PermissionSetEntryFieldId;
+
+
+
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0298_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0298_v0_0_s_ifspec;
+
+#ifndef __IPermissionSetEntry_INTERFACE_DEFINED__
+#define __IPermissionSetEntry_INTERFACE_DEFINED__
+
+/* interface IPermissionSetEntry */
+/* [uuid][unique][object][local] */
+
+
+EXTERN_C const IID IID_IPermissionSetEntry;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("EBE5A1ED-FEBC-42c4-A9E1-E087C6E36635")
+ IPermissionSetEntry : public IUnknown
+ {
+ public:
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
+ /* [retval][out] */ PermissionSetEntry **__MIDL_0126) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Id(
+ /* [retval][out] */ LPCWSTR *__MIDL_0127) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_XmlSegment(
+ /* [retval][out] */ LPCWSTR *__MIDL_0128) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IPermissionSetEntryVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IPermissionSetEntry * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IPermissionSetEntry * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IPermissionSetEntry * This);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
+ IPermissionSetEntry * This,
+ /* [retval][out] */ PermissionSetEntry **__MIDL_0126);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Id )(
+ IPermissionSetEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0127);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_XmlSegment )(
+ IPermissionSetEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0128);
+
+ END_INTERFACE
+ } IPermissionSetEntryVtbl;
+
+ interface IPermissionSetEntry
+ {
+ CONST_VTBL struct IPermissionSetEntryVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IPermissionSetEntry_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IPermissionSetEntry_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IPermissionSetEntry_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IPermissionSetEntry_get_AllData(This,__MIDL_0126) \
+ (This)->lpVtbl -> get_AllData(This,__MIDL_0126)
+
+#define IPermissionSetEntry_get_Id(This,__MIDL_0127) \
+ (This)->lpVtbl -> get_Id(This,__MIDL_0127)
+
+#define IPermissionSetEntry_get_XmlSegment(This,__MIDL_0128) \
+ (This)->lpVtbl -> get_XmlSegment(This,__MIDL_0128)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IPermissionSetEntry_get_AllData_Proxy(
+ IPermissionSetEntry * This,
+ /* [retval][out] */ PermissionSetEntry **__MIDL_0126);
+
+
+void __RPC_STUB IPermissionSetEntry_get_AllData_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IPermissionSetEntry_get_Id_Proxy(
+ IPermissionSetEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0127);
+
+
+void __RPC_STUB IPermissionSetEntry_get_Id_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IPermissionSetEntry_get_XmlSegment_Proxy(
+ IPermissionSetEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0128);
+
+
+void __RPC_STUB IPermissionSetEntry_get_XmlSegment_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IPermissionSetEntry_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_isolation_0299 */
+/* [local] */
+
+typedef struct _AssemblyRequestEntry
+ {
+ LPCWSTR Name;
+ LPCWSTR permissionSetID;
+ } AssemblyRequestEntry;
+
+typedef
+enum _AssemblyRequestEntryFieldId
+ { AssemblyRequest_permissionSetID = 0
+ } AssemblyRequestEntryFieldId;
+
+
+
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0299_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0299_v0_0_s_ifspec;
+
+#ifndef __IAssemblyRequestEntry_INTERFACE_DEFINED__
+#define __IAssemblyRequestEntry_INTERFACE_DEFINED__
+
+/* interface IAssemblyRequestEntry */
+/* [uuid][unique][object][local] */
+
+
+EXTERN_C const IID IID_IAssemblyRequestEntry;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("2474ECB4-8EFD-4410-9F31-B3E7C4A07731")
+ IAssemblyRequestEntry : public IUnknown
+ {
+ public:
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
+ /* [retval][out] */ AssemblyRequestEntry **__MIDL_0129) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Name(
+ /* [retval][out] */ LPCWSTR *__MIDL_0130) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_permissionSetID(
+ /* [retval][out] */ LPCWSTR *__MIDL_0131) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IAssemblyRequestEntryVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IAssemblyRequestEntry * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IAssemblyRequestEntry * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IAssemblyRequestEntry * This);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
+ IAssemblyRequestEntry * This,
+ /* [retval][out] */ AssemblyRequestEntry **__MIDL_0129);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Name )(
+ IAssemblyRequestEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0130);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_permissionSetID )(
+ IAssemblyRequestEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0131);
+
+ END_INTERFACE
+ } IAssemblyRequestEntryVtbl;
+
+ interface IAssemblyRequestEntry
+ {
+ CONST_VTBL struct IAssemblyRequestEntryVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IAssemblyRequestEntry_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IAssemblyRequestEntry_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IAssemblyRequestEntry_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IAssemblyRequestEntry_get_AllData(This,__MIDL_0129) \
+ (This)->lpVtbl -> get_AllData(This,__MIDL_0129)
+
+#define IAssemblyRequestEntry_get_Name(This,__MIDL_0130) \
+ (This)->lpVtbl -> get_Name(This,__MIDL_0130)
+
+#define IAssemblyRequestEntry_get_permissionSetID(This,__MIDL_0131) \
+ (This)->lpVtbl -> get_permissionSetID(This,__MIDL_0131)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IAssemblyRequestEntry_get_AllData_Proxy(
+ IAssemblyRequestEntry * This,
+ /* [retval][out] */ AssemblyRequestEntry **__MIDL_0129);
+
+
+void __RPC_STUB IAssemblyRequestEntry_get_AllData_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IAssemblyRequestEntry_get_Name_Proxy(
+ IAssemblyRequestEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0130);
+
+
+void __RPC_STUB IAssemblyRequestEntry_get_Name_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IAssemblyRequestEntry_get_permissionSetID_Proxy(
+ IAssemblyRequestEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0131);
+
+
+void __RPC_STUB IAssemblyRequestEntry_get_permissionSetID_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IAssemblyRequestEntry_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_isolation_0300 */
+/* [local] */
+
+typedef struct _DescriptionMetadataEntry
+ {
+ LPCWSTR Publisher;
+ LPCWSTR Product;
+ LPCWSTR SupportUrl;
+ LPCWSTR IconFile;
+ LPCWSTR ErrorReportUrl;
+ LPCWSTR SuiteName;
+ } DescriptionMetadataEntry;
+
+typedef
+enum _DescriptionMetadataEntryFieldId
+ { DescriptionMetadata_Publisher = 0,
+ DescriptionMetadata_Product = DescriptionMetadata_Publisher + 1,
+ DescriptionMetadata_SupportUrl = DescriptionMetadata_Product + 1,
+ DescriptionMetadata_IconFile = DescriptionMetadata_SupportUrl + 1,
+ DescriptionMetadata_ErrorReportUrl = DescriptionMetadata_IconFile + 1,
+ DescriptionMetadata_SuiteName = DescriptionMetadata_ErrorReportUrl + 1
+ } DescriptionMetadataEntryFieldId;
+
+
+
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0300_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0300_v0_0_s_ifspec;
+
+#ifndef __IDescriptionMetadataEntry_INTERFACE_DEFINED__
+#define __IDescriptionMetadataEntry_INTERFACE_DEFINED__
+
+/* interface IDescriptionMetadataEntry */
+/* [uuid][unique][object][local] */
+
+
+EXTERN_C const IID IID_IDescriptionMetadataEntry;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("CB73147E-5FC2-4c31-B4E6-58D13DBE1A08")
+ IDescriptionMetadataEntry : public IUnknown
+ {
+ public:
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
+ /* [retval][out] */ DescriptionMetadataEntry **__MIDL_0132) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Publisher(
+ /* [retval][out] */ LPCWSTR *__MIDL_0133) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Product(
+ /* [retval][out] */ LPCWSTR *__MIDL_0134) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SupportUrl(
+ /* [retval][out] */ LPCWSTR *__MIDL_0135) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_IconFile(
+ /* [retval][out] */ LPCWSTR *__MIDL_0136) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ErrorReportUrl(
+ /* [retval][out] */ LPCWSTR *__MIDL_0137) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SuiteName(
+ /* [retval][out] */ LPCWSTR *__MIDL_0138) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IDescriptionMetadataEntryVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IDescriptionMetadataEntry * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IDescriptionMetadataEntry * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IDescriptionMetadataEntry * This);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
+ IDescriptionMetadataEntry * This,
+ /* [retval][out] */ DescriptionMetadataEntry **__MIDL_0132);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Publisher )(
+ IDescriptionMetadataEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0133);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Product )(
+ IDescriptionMetadataEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0134);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_SupportUrl )(
+ IDescriptionMetadataEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0135);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_IconFile )(
+ IDescriptionMetadataEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0136);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ErrorReportUrl )(
+ IDescriptionMetadataEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0137);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_SuiteName )(
+ IDescriptionMetadataEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0138);
+
+ END_INTERFACE
+ } IDescriptionMetadataEntryVtbl;
+
+ interface IDescriptionMetadataEntry
+ {
+ CONST_VTBL struct IDescriptionMetadataEntryVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IDescriptionMetadataEntry_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IDescriptionMetadataEntry_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IDescriptionMetadataEntry_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IDescriptionMetadataEntry_get_AllData(This,__MIDL_0132) \
+ (This)->lpVtbl -> get_AllData(This,__MIDL_0132)
+
+#define IDescriptionMetadataEntry_get_Publisher(This,__MIDL_0133) \
+ (This)->lpVtbl -> get_Publisher(This,__MIDL_0133)
+
+#define IDescriptionMetadataEntry_get_Product(This,__MIDL_0134) \
+ (This)->lpVtbl -> get_Product(This,__MIDL_0134)
+
+#define IDescriptionMetadataEntry_get_SupportUrl(This,__MIDL_0135) \
+ (This)->lpVtbl -> get_SupportUrl(This,__MIDL_0135)
+
+#define IDescriptionMetadataEntry_get_IconFile(This,__MIDL_0136) \
+ (This)->lpVtbl -> get_IconFile(This,__MIDL_0136)
+
+#define IDescriptionMetadataEntry_get_ErrorReportUrl(This,__MIDL_0137) \
+ (This)->lpVtbl -> get_ErrorReportUrl(This,__MIDL_0137)
+
+#define IDescriptionMetadataEntry_get_SuiteName(This,__MIDL_0138) \
+ (This)->lpVtbl -> get_SuiteName(This,__MIDL_0138)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IDescriptionMetadataEntry_get_AllData_Proxy(
+ IDescriptionMetadataEntry * This,
+ /* [retval][out] */ DescriptionMetadataEntry **__MIDL_0132);
+
+
+void __RPC_STUB IDescriptionMetadataEntry_get_AllData_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IDescriptionMetadataEntry_get_Publisher_Proxy(
+ IDescriptionMetadataEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0133);
+
+
+void __RPC_STUB IDescriptionMetadataEntry_get_Publisher_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IDescriptionMetadataEntry_get_Product_Proxy(
+ IDescriptionMetadataEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0134);
+
+
+void __RPC_STUB IDescriptionMetadataEntry_get_Product_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IDescriptionMetadataEntry_get_SupportUrl_Proxy(
+ IDescriptionMetadataEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0135);
+
+
+void __RPC_STUB IDescriptionMetadataEntry_get_SupportUrl_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IDescriptionMetadataEntry_get_IconFile_Proxy(
+ IDescriptionMetadataEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0136);
+
+
+void __RPC_STUB IDescriptionMetadataEntry_get_IconFile_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IDescriptionMetadataEntry_get_ErrorReportUrl_Proxy(
+ IDescriptionMetadataEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0137);
+
+
+void __RPC_STUB IDescriptionMetadataEntry_get_ErrorReportUrl_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IDescriptionMetadataEntry_get_SuiteName_Proxy(
+ IDescriptionMetadataEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0138);
+
+
+void __RPC_STUB IDescriptionMetadataEntry_get_SuiteName_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IDescriptionMetadataEntry_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_isolation_0301 */
+/* [local] */
+
+typedef struct _DeploymentMetadataEntry
+ {
+ LPCWSTR DeploymentProviderCodebase;
+ LPCWSTR MinimumRequiredVersion;
+ USHORT MaximumAge;
+ UCHAR MaximumAge_Unit;
+ ULONG DeploymentFlags;
+ } DeploymentMetadataEntry;
+
+typedef
+enum _DeploymentMetadataEntryFieldId
+ { DeploymentMetadata_DeploymentProviderCodebase = 0,
+ DeploymentMetadata_MinimumRequiredVersion = DeploymentMetadata_DeploymentProviderCodebase + 1,
+ DeploymentMetadata_MaximumAge = DeploymentMetadata_MinimumRequiredVersion + 1,
+ DeploymentMetadata_MaximumAge_Unit = DeploymentMetadata_MaximumAge + 1,
+ DeploymentMetadata_DeploymentFlags = DeploymentMetadata_MaximumAge_Unit + 1
+ } DeploymentMetadataEntryFieldId;
+
+
+
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0301_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0301_v0_0_s_ifspec;
+
+#ifndef __IDeploymentMetadataEntry_INTERFACE_DEFINED__
+#define __IDeploymentMetadataEntry_INTERFACE_DEFINED__
+
+/* interface IDeploymentMetadataEntry */
+/* [uuid][unique][object][local] */
+
+
+EXTERN_C const IID IID_IDeploymentMetadataEntry;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("CFA3F59F-334D-46bf-A5A5-5D11BB2D7EBC")
+ IDeploymentMetadataEntry : public IUnknown
+ {
+ public:
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
+ /* [retval][out] */ DeploymentMetadataEntry **__MIDL_0139) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_DeploymentProviderCodebase(
+ /* [retval][out] */ LPCWSTR *__MIDL_0140) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_MinimumRequiredVersion(
+ /* [retval][out] */ LPCWSTR *__MIDL_0141) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_MaximumAge(
+ /* [retval][out] */ USHORT *__MIDL_0142) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_MaximumAge_Unit(
+ /* [retval][out] */ UCHAR *__MIDL_0143) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_DeploymentFlags(
+ /* [retval][out] */ ULONG *__MIDL_0144) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IDeploymentMetadataEntryVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IDeploymentMetadataEntry * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IDeploymentMetadataEntry * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IDeploymentMetadataEntry * This);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
+ IDeploymentMetadataEntry * This,
+ /* [retval][out] */ DeploymentMetadataEntry **__MIDL_0139);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_DeploymentProviderCodebase )(
+ IDeploymentMetadataEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0140);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_MinimumRequiredVersion )(
+ IDeploymentMetadataEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0141);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_MaximumAge )(
+ IDeploymentMetadataEntry * This,
+ /* [retval][out] */ USHORT *__MIDL_0142);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_MaximumAge_Unit )(
+ IDeploymentMetadataEntry * This,
+ /* [retval][out] */ UCHAR *__MIDL_0143);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_DeploymentFlags )(
+ IDeploymentMetadataEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0144);
+
+ END_INTERFACE
+ } IDeploymentMetadataEntryVtbl;
+
+ interface IDeploymentMetadataEntry
+ {
+ CONST_VTBL struct IDeploymentMetadataEntryVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IDeploymentMetadataEntry_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IDeploymentMetadataEntry_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IDeploymentMetadataEntry_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IDeploymentMetadataEntry_get_AllData(This,__MIDL_0139) \
+ (This)->lpVtbl -> get_AllData(This,__MIDL_0139)
+
+#define IDeploymentMetadataEntry_get_DeploymentProviderCodebase(This,__MIDL_0140) \
+ (This)->lpVtbl -> get_DeploymentProviderCodebase(This,__MIDL_0140)
+
+#define IDeploymentMetadataEntry_get_MinimumRequiredVersion(This,__MIDL_0141) \
+ (This)->lpVtbl -> get_MinimumRequiredVersion(This,__MIDL_0141)
+
+#define IDeploymentMetadataEntry_get_MaximumAge(This,__MIDL_0142) \
+ (This)->lpVtbl -> get_MaximumAge(This,__MIDL_0142)
+
+#define IDeploymentMetadataEntry_get_MaximumAge_Unit(This,__MIDL_0143) \
+ (This)->lpVtbl -> get_MaximumAge_Unit(This,__MIDL_0143)
+
+#define IDeploymentMetadataEntry_get_DeploymentFlags(This,__MIDL_0144) \
+ (This)->lpVtbl -> get_DeploymentFlags(This,__MIDL_0144)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IDeploymentMetadataEntry_get_AllData_Proxy(
+ IDeploymentMetadataEntry * This,
+ /* [retval][out] */ DeploymentMetadataEntry **__MIDL_0139);
+
+
+void __RPC_STUB IDeploymentMetadataEntry_get_AllData_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IDeploymentMetadataEntry_get_DeploymentProviderCodebase_Proxy(
+ IDeploymentMetadataEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0140);
+
+
+void __RPC_STUB IDeploymentMetadataEntry_get_DeploymentProviderCodebase_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IDeploymentMetadataEntry_get_MinimumRequiredVersion_Proxy(
+ IDeploymentMetadataEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0141);
+
+
+void __RPC_STUB IDeploymentMetadataEntry_get_MinimumRequiredVersion_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IDeploymentMetadataEntry_get_MaximumAge_Proxy(
+ IDeploymentMetadataEntry * This,
+ /* [retval][out] */ USHORT *__MIDL_0142);
+
+
+void __RPC_STUB IDeploymentMetadataEntry_get_MaximumAge_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IDeploymentMetadataEntry_get_MaximumAge_Unit_Proxy(
+ IDeploymentMetadataEntry * This,
+ /* [retval][out] */ UCHAR *__MIDL_0143);
+
+
+void __RPC_STUB IDeploymentMetadataEntry_get_MaximumAge_Unit_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IDeploymentMetadataEntry_get_DeploymentFlags_Proxy(
+ IDeploymentMetadataEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0144);
+
+
+void __RPC_STUB IDeploymentMetadataEntry_get_DeploymentFlags_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IDeploymentMetadataEntry_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_isolation_0302 */
+/* [local] */
+
+typedef struct _DependentOSMetadataEntry
+ {
+ LPCWSTR SupportUrl;
+ LPCWSTR Description;
+ USHORT MajorVersion;
+ USHORT MinorVersion;
+ USHORT BuildNumber;
+ UCHAR ServicePackMajor;
+ UCHAR ServicePackMinor;
+ } DependentOSMetadataEntry;
+
+typedef
+enum _DependentOSMetadataEntryFieldId
+ { DependentOSMetadata_SupportUrl = 0,
+ DependentOSMetadata_Description = DependentOSMetadata_SupportUrl + 1,
+ DependentOSMetadata_MajorVersion = DependentOSMetadata_Description + 1,
+ DependentOSMetadata_MinorVersion = DependentOSMetadata_MajorVersion + 1,
+ DependentOSMetadata_BuildNumber = DependentOSMetadata_MinorVersion + 1,
+ DependentOSMetadata_ServicePackMajor = DependentOSMetadata_BuildNumber + 1,
+ DependentOSMetadata_ServicePackMinor = DependentOSMetadata_ServicePackMajor + 1
+ } DependentOSMetadataEntryFieldId;
+
+
+
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0302_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0302_v0_0_s_ifspec;
+
+#ifndef __IDependentOSMetadataEntry_INTERFACE_DEFINED__
+#define __IDependentOSMetadataEntry_INTERFACE_DEFINED__
+
+/* interface IDependentOSMetadataEntry */
+/* [uuid][unique][object][local] */
+
+
+EXTERN_C const IID IID_IDependentOSMetadataEntry;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("CF168CF4-4E8F-4d92-9D2A-60E5CA21CF85")
+ IDependentOSMetadataEntry : public IUnknown
+ {
+ public:
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
+ /* [retval][out] */ DependentOSMetadataEntry **__MIDL_0145) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SupportUrl(
+ /* [retval][out] */ LPCWSTR *__MIDL_0146) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Description(
+ /* [retval][out] */ LPCWSTR *__MIDL_0147) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_MajorVersion(
+ /* [retval][out] */ USHORT *__MIDL_0148) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_MinorVersion(
+ /* [retval][out] */ USHORT *__MIDL_0149) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_BuildNumber(
+ /* [retval][out] */ USHORT *__MIDL_0150) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ServicePackMajor(
+ /* [retval][out] */ UCHAR *__MIDL_0151) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ServicePackMinor(
+ /* [retval][out] */ UCHAR *__MIDL_0152) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IDependentOSMetadataEntryVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IDependentOSMetadataEntry * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IDependentOSMetadataEntry * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IDependentOSMetadataEntry * This);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
+ IDependentOSMetadataEntry * This,
+ /* [retval][out] */ DependentOSMetadataEntry **__MIDL_0145);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_SupportUrl )(
+ IDependentOSMetadataEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0146);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Description )(
+ IDependentOSMetadataEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0147);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_MajorVersion )(
+ IDependentOSMetadataEntry * This,
+ /* [retval][out] */ USHORT *__MIDL_0148);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_MinorVersion )(
+ IDependentOSMetadataEntry * This,
+ /* [retval][out] */ USHORT *__MIDL_0149);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_BuildNumber )(
+ IDependentOSMetadataEntry * This,
+ /* [retval][out] */ USHORT *__MIDL_0150);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ServicePackMajor )(
+ IDependentOSMetadataEntry * This,
+ /* [retval][out] */ UCHAR *__MIDL_0151);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ServicePackMinor )(
+ IDependentOSMetadataEntry * This,
+ /* [retval][out] */ UCHAR *__MIDL_0152);
+
+ END_INTERFACE
+ } IDependentOSMetadataEntryVtbl;
+
+ interface IDependentOSMetadataEntry
+ {
+ CONST_VTBL struct IDependentOSMetadataEntryVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IDependentOSMetadataEntry_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IDependentOSMetadataEntry_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IDependentOSMetadataEntry_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IDependentOSMetadataEntry_get_AllData(This,__MIDL_0145) \
+ (This)->lpVtbl -> get_AllData(This,__MIDL_0145)
+
+#define IDependentOSMetadataEntry_get_SupportUrl(This,__MIDL_0146) \
+ (This)->lpVtbl -> get_SupportUrl(This,__MIDL_0146)
+
+#define IDependentOSMetadataEntry_get_Description(This,__MIDL_0147) \
+ (This)->lpVtbl -> get_Description(This,__MIDL_0147)
+
+#define IDependentOSMetadataEntry_get_MajorVersion(This,__MIDL_0148) \
+ (This)->lpVtbl -> get_MajorVersion(This,__MIDL_0148)
+
+#define IDependentOSMetadataEntry_get_MinorVersion(This,__MIDL_0149) \
+ (This)->lpVtbl -> get_MinorVersion(This,__MIDL_0149)
+
+#define IDependentOSMetadataEntry_get_BuildNumber(This,__MIDL_0150) \
+ (This)->lpVtbl -> get_BuildNumber(This,__MIDL_0150)
+
+#define IDependentOSMetadataEntry_get_ServicePackMajor(This,__MIDL_0151) \
+ (This)->lpVtbl -> get_ServicePackMajor(This,__MIDL_0151)
+
+#define IDependentOSMetadataEntry_get_ServicePackMinor(This,__MIDL_0152) \
+ (This)->lpVtbl -> get_ServicePackMinor(This,__MIDL_0152)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IDependentOSMetadataEntry_get_AllData_Proxy(
+ IDependentOSMetadataEntry * This,
+ /* [retval][out] */ DependentOSMetadataEntry **__MIDL_0145);
+
+
+void __RPC_STUB IDependentOSMetadataEntry_get_AllData_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IDependentOSMetadataEntry_get_SupportUrl_Proxy(
+ IDependentOSMetadataEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0146);
+
+
+void __RPC_STUB IDependentOSMetadataEntry_get_SupportUrl_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IDependentOSMetadataEntry_get_Description_Proxy(
+ IDependentOSMetadataEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0147);
+
+
+void __RPC_STUB IDependentOSMetadataEntry_get_Description_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IDependentOSMetadataEntry_get_MajorVersion_Proxy(
+ IDependentOSMetadataEntry * This,
+ /* [retval][out] */ USHORT *__MIDL_0148);
+
+
+void __RPC_STUB IDependentOSMetadataEntry_get_MajorVersion_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IDependentOSMetadataEntry_get_MinorVersion_Proxy(
+ IDependentOSMetadataEntry * This,
+ /* [retval][out] */ USHORT *__MIDL_0149);
+
+
+void __RPC_STUB IDependentOSMetadataEntry_get_MinorVersion_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IDependentOSMetadataEntry_get_BuildNumber_Proxy(
+ IDependentOSMetadataEntry * This,
+ /* [retval][out] */ USHORT *__MIDL_0150);
+
+
+void __RPC_STUB IDependentOSMetadataEntry_get_BuildNumber_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IDependentOSMetadataEntry_get_ServicePackMajor_Proxy(
+ IDependentOSMetadataEntry * This,
+ /* [retval][out] */ UCHAR *__MIDL_0151);
+
+
+void __RPC_STUB IDependentOSMetadataEntry_get_ServicePackMajor_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IDependentOSMetadataEntry_get_ServicePackMinor_Proxy(
+ IDependentOSMetadataEntry * This,
+ /* [retval][out] */ UCHAR *__MIDL_0152);
+
+
+void __RPC_STUB IDependentOSMetadataEntry_get_ServicePackMinor_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IDependentOSMetadataEntry_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_isolation_0303 */
+/* [local] */
+
+typedef struct _CompatibleFrameworksMetadataEntry
+ {
+ LPCWSTR SupportUrl;
+ } CompatibleFrameworksMetadataEntry;
+
+typedef
+enum _CompatibleFrameworksMetadataEntryFieldId
+ { CompatibleFrameworksMetadata_SupportUrl = 0
+ } CompatibleFrameworksMetadataEntryFieldId;
+
+
+
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0303_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0303_v0_0_s_ifspec;
+
+#ifndef __ICompatibleFrameworksMetadataEntry_INTERFACE_DEFINED__
+#define __ICompatibleFrameworksMetadataEntry_INTERFACE_DEFINED__
+
+/* interface ICompatibleFrameworksMetadataEntry */
+/* [uuid][unique][object][local] */
+
+
+EXTERN_C const IID IID_ICompatibleFrameworksMetadataEntry;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("4A33D662-2210-463A-BE9F-FBDF1AA554E3")
+ ICompatibleFrameworksMetadataEntry : public IUnknown
+ {
+ public:
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
+ /* [retval][out] */ CompatibleFrameworksMetadataEntry **__MIDL_0153) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SupportUrl(
+ /* [retval][out] */ LPCWSTR *__MIDL_0154) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct ICompatibleFrameworksMetadataEntryVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ ICompatibleFrameworksMetadataEntry * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ ICompatibleFrameworksMetadataEntry * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ ICompatibleFrameworksMetadataEntry * This);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
+ ICompatibleFrameworksMetadataEntry * This,
+ /* [retval][out] */ CompatibleFrameworksMetadataEntry **__MIDL_0153);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_SupportUrl )(
+ ICompatibleFrameworksMetadataEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0154);
+
+ END_INTERFACE
+ } ICompatibleFrameworksMetadataEntryVtbl;
+
+ interface ICompatibleFrameworksMetadataEntry
+ {
+ CONST_VTBL struct ICompatibleFrameworksMetadataEntryVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define ICompatibleFrameworksMetadataEntry_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define ICompatibleFrameworksMetadataEntry_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define ICompatibleFrameworksMetadataEntry_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define ICompatibleFrameworksMetadataEntry_get_AllData(This,__MIDL_0153) \
+ (This)->lpVtbl -> get_AllData(This,__MIDL_0153)
+
+#define ICompatibleFrameworksMetadataEntry_get_SupportUrl(This,__MIDL_0154) \
+ (This)->lpVtbl -> get_SupportUrl(This,__MIDL_0154)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ICompatibleFrameworksMetadataEntry_get_AllData_Proxy(
+ ICompatibleFrameworksMetadataEntry * This,
+ /* [retval][out] */ CompatibleFrameworksMetadataEntry **__MIDL_0153);
+
+
+void __RPC_STUB ICompatibleFrameworksMetadataEntry_get_AllData_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ICompatibleFrameworksMetadataEntry_get_SupportUrl_Proxy(
+ ICompatibleFrameworksMetadataEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0154);
+
+
+void __RPC_STUB ICompatibleFrameworksMetadataEntry_get_SupportUrl_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __ICompatibleFrameworksMetadataEntry_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_isolation_0304 */
+/* [local] */
+
+typedef struct _MetadataSectionEntry
+ {
+ ULONG SchemaVersion;
+ ULONG ManifestFlags;
+ ULONG UsagePatterns;
+ IDefinitionIdentity *CdfIdentity;
+ LPCWSTR LocalPath;
+ ULONG HashAlgorithm;
+ /* [size_is] */ BYTE *ManifestHash;
+ ULONG ManifestHashSize;
+ LPCWSTR ContentType;
+ LPCWSTR RuntimeImageVersion;
+ /* [size_is] */ BYTE *MvidValue;
+ ULONG MvidValueSize;
+ DescriptionMetadataEntry DescriptionData;
+ DeploymentMetadataEntry DeploymentData;
+ DependentOSMetadataEntry DependentOSData;
+ LPCWSTR defaultPermissionSetID;
+ LPCWSTR RequestedExecutionLevel;
+ BOOLEAN RequestedExecutionLevelUIAccess;
+ IReferenceIdentity *ResourceTypeResourcesDependency;
+ IReferenceIdentity *ResourceTypeManifestResourcesDependency;
+ LPCWSTR KeyInfoElement;
+ CompatibleFrameworksMetadataEntry CompatibleFrameworksData;
+ } MetadataSectionEntry;
+
+typedef
+enum _MetadataSectionEntryFieldId
+ { MetadataSection_SchemaVersion = 0,
+ MetadataSection_ManifestFlags = MetadataSection_SchemaVersion + 1,
+ MetadataSection_UsagePatterns = MetadataSection_ManifestFlags + 1,
+ MetadataSection_CdfIdentity = MetadataSection_UsagePatterns + 1,
+ MetadataSection_LocalPath = MetadataSection_CdfIdentity + 1,
+ MetadataSection_HashAlgorithm = MetadataSection_LocalPath + 1,
+ MetadataSection_ManifestHash = MetadataSection_HashAlgorithm + 1,
+ MetadataSection_ManifestHashSize = MetadataSection_ManifestHash + 1,
+ MetadataSection_ContentType = MetadataSection_ManifestHashSize + 1,
+ MetadataSection_RuntimeImageVersion = MetadataSection_ContentType + 1,
+ MetadataSection_MvidValue = MetadataSection_RuntimeImageVersion + 1,
+ MetadataSection_MvidValueSize = MetadataSection_MvidValue + 1,
+ MetadataSection_DescriptionData = MetadataSection_MvidValueSize + 1,
+ MetadataSection_DeploymentData = MetadataSection_DescriptionData + 1,
+ MetadataSection_DependentOSData = MetadataSection_DeploymentData + 1,
+ MetadataSection_defaultPermissionSetID = MetadataSection_DependentOSData + 1,
+ MetadataSection_RequestedExecutionLevel = MetadataSection_defaultPermissionSetID + 1,
+ MetadataSection_RequestedExecutionLevelUIAccess = MetadataSection_RequestedExecutionLevel + 1,
+ MetadataSection_ResourceTypeResourcesDependency = MetadataSection_RequestedExecutionLevelUIAccess + 1,
+ MetadataSection_ResourceTypeManifestResourcesDependency = MetadataSection_ResourceTypeResourcesDependency + 1,
+ MetadataSection_KeyInfoElement = MetadataSection_ResourceTypeManifestResourcesDependency + 1,
+ MetadataSection_CompatibleFrameworksData = MetadataSection_KeyInfoElement + 1
+ } MetadataSectionEntryFieldId;
+
+
+
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0304_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0304_v0_0_s_ifspec;
+
+#ifndef __IMetadataSectionEntry_INTERFACE_DEFINED__
+#define __IMetadataSectionEntry_INTERFACE_DEFINED__
+
+/* interface IMetadataSectionEntry */
+/* [uuid][unique][object][local] */
+
+
+EXTERN_C const IID IID_IMetadataSectionEntry;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("AB1ED79F-943E-407d-A80B-0744E3A95B28")
+ IMetadataSectionEntry : public IUnknown
+ {
+ public:
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
+ /* [retval][out] */ MetadataSectionEntry **__MIDL_0155) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SchemaVersion(
+ /* [retval][out] */ ULONG *__MIDL_0156) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ManifestFlags(
+ /* [retval][out] */ ULONG *__MIDL_0157) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_UsagePatterns(
+ /* [retval][out] */ ULONG *__MIDL_0158) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_CdfIdentity(
+ /* [retval][out] */ IDefinitionIdentity **__MIDL_0159) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_LocalPath(
+ /* [retval][out] */ LPCWSTR *__MIDL_0160) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_HashAlgorithm(
+ /* [retval][out] */ ULONG *__MIDL_0161) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ManifestHash(
+ /* [retval][out] */ IStream **__MIDL_0162) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ContentType(
+ /* [retval][out] */ LPCWSTR *__MIDL_0163) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_RuntimeImageVersion(
+ /* [retval][out] */ LPCWSTR *__MIDL_0164) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_MvidValue(
+ /* [retval][out] */ IStream **__MIDL_0165) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_DescriptionData(
+ /* [retval][out] */ IDescriptionMetadataEntry **__MIDL_0166) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_DeploymentData(
+ /* [retval][out] */ IDeploymentMetadataEntry **__MIDL_0167) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_DependentOSData(
+ /* [retval][out] */ IDependentOSMetadataEntry **__MIDL_0168) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_defaultPermissionSetID(
+ /* [retval][out] */ LPCWSTR *__MIDL_0169) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_RequestedExecutionLevel(
+ /* [retval][out] */ LPCWSTR *__MIDL_0170) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_RequestedExecutionLevelUIAccess(
+ /* [retval][out] */ BOOLEAN *__MIDL_0171) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ResourceTypeResourcesDependency(
+ /* [retval][out] */ IReferenceIdentity **__MIDL_0172) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ResourceTypeManifestResourcesDependency(
+ /* [retval][out] */ IReferenceIdentity **__MIDL_0173) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_KeyInfoElement(
+ /* [retval][out] */ LPCWSTR *__MIDL_0174) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_CompatibleFrameworksData(
+ /* [retval][out] */ ICompatibleFrameworksMetadataEntry **__MIDL_0175) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IMetadataSectionEntryVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IMetadataSectionEntry * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IMetadataSectionEntry * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IMetadataSectionEntry * This);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
+ IMetadataSectionEntry * This,
+ /* [retval][out] */ MetadataSectionEntry **__MIDL_0155);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_SchemaVersion )(
+ IMetadataSectionEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0156);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ManifestFlags )(
+ IMetadataSectionEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0157);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_UsagePatterns )(
+ IMetadataSectionEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0158);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_CdfIdentity )(
+ IMetadataSectionEntry * This,
+ /* [retval][out] */ IDefinitionIdentity **__MIDL_0159);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_LocalPath )(
+ IMetadataSectionEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0160);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_HashAlgorithm )(
+ IMetadataSectionEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0161);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ManifestHash )(
+ IMetadataSectionEntry * This,
+ /* [retval][out] */ IStream **__MIDL_0162);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ContentType )(
+ IMetadataSectionEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0163);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_RuntimeImageVersion )(
+ IMetadataSectionEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0164);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_MvidValue )(
+ IMetadataSectionEntry * This,
+ /* [retval][out] */ IStream **__MIDL_0165);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_DescriptionData )(
+ IMetadataSectionEntry * This,
+ /* [retval][out] */ IDescriptionMetadataEntry **__MIDL_0166);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_DeploymentData )(
+ IMetadataSectionEntry * This,
+ /* [retval][out] */ IDeploymentMetadataEntry **__MIDL_0167);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_DependentOSData )(
+ IMetadataSectionEntry * This,
+ /* [retval][out] */ IDependentOSMetadataEntry **__MIDL_0168);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_defaultPermissionSetID )(
+ IMetadataSectionEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0169);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_RequestedExecutionLevel )(
+ IMetadataSectionEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0170);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_RequestedExecutionLevelUIAccess )(
+ IMetadataSectionEntry * This,
+ /* [retval][out] */ BOOLEAN *__MIDL_0171);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ResourceTypeResourcesDependency )(
+ IMetadataSectionEntry * This,
+ /* [retval][out] */ IReferenceIdentity **__MIDL_0172);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ResourceTypeManifestResourcesDependency )(
+ IMetadataSectionEntry * This,
+ /* [retval][out] */ IReferenceIdentity **__MIDL_0173);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_KeyInfoElement )(
+ IMetadataSectionEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0174);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_CompatibleFrameworksData )(
+ IMetadataSectionEntry * This,
+ /* [retval][out] */ ICompatibleFrameworksMetadataEntry **__MIDL_0175);
+
+ END_INTERFACE
+ } IMetadataSectionEntryVtbl;
+
+ interface IMetadataSectionEntry
+ {
+ CONST_VTBL struct IMetadataSectionEntryVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IMetadataSectionEntry_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IMetadataSectionEntry_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IMetadataSectionEntry_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IMetadataSectionEntry_get_AllData(This,__MIDL_0155) \
+ (This)->lpVtbl -> get_AllData(This,__MIDL_0155)
+
+#define IMetadataSectionEntry_get_SchemaVersion(This,__MIDL_0156) \
+ (This)->lpVtbl -> get_SchemaVersion(This,__MIDL_0156)
+
+#define IMetadataSectionEntry_get_ManifestFlags(This,__MIDL_0157) \
+ (This)->lpVtbl -> get_ManifestFlags(This,__MIDL_0157)
+
+#define IMetadataSectionEntry_get_UsagePatterns(This,__MIDL_0158) \
+ (This)->lpVtbl -> get_UsagePatterns(This,__MIDL_0158)
+
+#define IMetadataSectionEntry_get_CdfIdentity(This,__MIDL_0159) \
+ (This)->lpVtbl -> get_CdfIdentity(This,__MIDL_0159)
+
+#define IMetadataSectionEntry_get_LocalPath(This,__MIDL_0160) \
+ (This)->lpVtbl -> get_LocalPath(This,__MIDL_0160)
+
+#define IMetadataSectionEntry_get_HashAlgorithm(This,__MIDL_0161) \
+ (This)->lpVtbl -> get_HashAlgorithm(This,__MIDL_0161)
+
+#define IMetadataSectionEntry_get_ManifestHash(This,__MIDL_0162) \
+ (This)->lpVtbl -> get_ManifestHash(This,__MIDL_0162)
+
+#define IMetadataSectionEntry_get_ContentType(This,__MIDL_0163) \
+ (This)->lpVtbl -> get_ContentType(This,__MIDL_0163)
+
+#define IMetadataSectionEntry_get_RuntimeImageVersion(This,__MIDL_0164) \
+ (This)->lpVtbl -> get_RuntimeImageVersion(This,__MIDL_0164)
+
+#define IMetadataSectionEntry_get_MvidValue(This,__MIDL_0165) \
+ (This)->lpVtbl -> get_MvidValue(This,__MIDL_0165)
+
+#define IMetadataSectionEntry_get_DescriptionData(This,__MIDL_0166) \
+ (This)->lpVtbl -> get_DescriptionData(This,__MIDL_0166)
+
+#define IMetadataSectionEntry_get_DeploymentData(This,__MIDL_0167) \
+ (This)->lpVtbl -> get_DeploymentData(This,__MIDL_0167)
+
+#define IMetadataSectionEntry_get_DependentOSData(This,__MIDL_0168) \
+ (This)->lpVtbl -> get_DependentOSData(This,__MIDL_0168)
+
+#define IMetadataSectionEntry_get_defaultPermissionSetID(This,__MIDL_0169) \
+ (This)->lpVtbl -> get_defaultPermissionSetID(This,__MIDL_0169)
+
+#define IMetadataSectionEntry_get_RequestedExecutionLevel(This,__MIDL_0170) \
+ (This)->lpVtbl -> get_RequestedExecutionLevel(This,__MIDL_0170)
+
+#define IMetadataSectionEntry_get_RequestedExecutionLevelUIAccess(This,__MIDL_0171) \
+ (This)->lpVtbl -> get_RequestedExecutionLevelUIAccess(This,__MIDL_0171)
+
+#define IMetadataSectionEntry_get_ResourceTypeResourcesDependency(This,__MIDL_0172) \
+ (This)->lpVtbl -> get_ResourceTypeResourcesDependency(This,__MIDL_0172)
+
+#define IMetadataSectionEntry_get_ResourceTypeManifestResourcesDependency(This,__MIDL_0173) \
+ (This)->lpVtbl -> get_ResourceTypeManifestResourcesDependency(This,__MIDL_0173)
+
+#define IMetadataSectionEntry_get_KeyInfoElement(This,__MIDL_0174) \
+ (This)->lpVtbl -> get_KeyInfoElement(This,__MIDL_0174)
+
+#define IMetadataSectionEntry_get_CompatibleFrameworksData(This,__MIDL_0175) \
+ (This)->lpVtbl -> get_CompatibleFrameworksData(This,__MIDL_0175)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IMetadataSectionEntry_get_AllData_Proxy(
+ IMetadataSectionEntry * This,
+ /* [retval][out] */ MetadataSectionEntry **__MIDL_0155);
+
+
+void __RPC_STUB IMetadataSectionEntry_get_AllData_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IMetadataSectionEntry_get_SchemaVersion_Proxy(
+ IMetadataSectionEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0156);
+
+
+void __RPC_STUB IMetadataSectionEntry_get_SchemaVersion_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IMetadataSectionEntry_get_ManifestFlags_Proxy(
+ IMetadataSectionEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0157);
+
+
+void __RPC_STUB IMetadataSectionEntry_get_ManifestFlags_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IMetadataSectionEntry_get_UsagePatterns_Proxy(
+ IMetadataSectionEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0158);
+
+
+void __RPC_STUB IMetadataSectionEntry_get_UsagePatterns_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IMetadataSectionEntry_get_CdfIdentity_Proxy(
+ IMetadataSectionEntry * This,
+ /* [retval][out] */ IDefinitionIdentity **__MIDL_0159);
+
+
+void __RPC_STUB IMetadataSectionEntry_get_CdfIdentity_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IMetadataSectionEntry_get_LocalPath_Proxy(
+ IMetadataSectionEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0160);
+
+
+void __RPC_STUB IMetadataSectionEntry_get_LocalPath_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IMetadataSectionEntry_get_HashAlgorithm_Proxy(
+ IMetadataSectionEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0161);
+
+
+void __RPC_STUB IMetadataSectionEntry_get_HashAlgorithm_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IMetadataSectionEntry_get_ManifestHash_Proxy(
+ IMetadataSectionEntry * This,
+ /* [retval][out] */ IStream **__MIDL_0162);
+
+
+void __RPC_STUB IMetadataSectionEntry_get_ManifestHash_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IMetadataSectionEntry_get_ContentType_Proxy(
+ IMetadataSectionEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0163);
+
+
+void __RPC_STUB IMetadataSectionEntry_get_ContentType_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IMetadataSectionEntry_get_RuntimeImageVersion_Proxy(
+ IMetadataSectionEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0164);
+
+
+void __RPC_STUB IMetadataSectionEntry_get_RuntimeImageVersion_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IMetadataSectionEntry_get_MvidValue_Proxy(
+ IMetadataSectionEntry * This,
+ /* [retval][out] */ IStream **__MIDL_0165);
+
+
+void __RPC_STUB IMetadataSectionEntry_get_MvidValue_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IMetadataSectionEntry_get_DescriptionData_Proxy(
+ IMetadataSectionEntry * This,
+ /* [retval][out] */ IDescriptionMetadataEntry **__MIDL_0166);
+
+
+void __RPC_STUB IMetadataSectionEntry_get_DescriptionData_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IMetadataSectionEntry_get_DeploymentData_Proxy(
+ IMetadataSectionEntry * This,
+ /* [retval][out] */ IDeploymentMetadataEntry **__MIDL_0167);
+
+
+void __RPC_STUB IMetadataSectionEntry_get_DeploymentData_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IMetadataSectionEntry_get_DependentOSData_Proxy(
+ IMetadataSectionEntry * This,
+ /* [retval][out] */ IDependentOSMetadataEntry **__MIDL_0168);
+
+
+void __RPC_STUB IMetadataSectionEntry_get_DependentOSData_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IMetadataSectionEntry_get_defaultPermissionSetID_Proxy(
+ IMetadataSectionEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0169);
+
+
+void __RPC_STUB IMetadataSectionEntry_get_defaultPermissionSetID_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IMetadataSectionEntry_get_RequestedExecutionLevel_Proxy(
+ IMetadataSectionEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0170);
+
+
+void __RPC_STUB IMetadataSectionEntry_get_RequestedExecutionLevel_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IMetadataSectionEntry_get_RequestedExecutionLevelUIAccess_Proxy(
+ IMetadataSectionEntry * This,
+ /* [retval][out] */ BOOLEAN *__MIDL_0171);
+
+
+void __RPC_STUB IMetadataSectionEntry_get_RequestedExecutionLevelUIAccess_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IMetadataSectionEntry_get_ResourceTypeResourcesDependency_Proxy(
+ IMetadataSectionEntry * This,
+ /* [retval][out] */ IReferenceIdentity **__MIDL_0172);
+
+
+void __RPC_STUB IMetadataSectionEntry_get_ResourceTypeResourcesDependency_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IMetadataSectionEntry_get_ResourceTypeManifestResourcesDependency_Proxy(
+ IMetadataSectionEntry * This,
+ /* [retval][out] */ IReferenceIdentity **__MIDL_0173);
+
+
+void __RPC_STUB IMetadataSectionEntry_get_ResourceTypeManifestResourcesDependency_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IMetadataSectionEntry_get_KeyInfoElement_Proxy(
+ IMetadataSectionEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0174);
+
+
+void __RPC_STUB IMetadataSectionEntry_get_KeyInfoElement_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IMetadataSectionEntry_get_CompatibleFrameworksData_Proxy(
+ IMetadataSectionEntry * This,
+ /* [retval][out] */ ICompatibleFrameworksMetadataEntry **__MIDL_0175);
+
+
+void __RPC_STUB IMetadataSectionEntry_get_CompatibleFrameworksData_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IMetadataSectionEntry_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_isolation_0305 */
+/* [local] */
+
+typedef struct _EventEntry
+ {
+ ULONG EventID;
+ ULONG Level;
+ ULONG Version;
+ GUID Guid;
+ LPCWSTR SubTypeName;
+ ULONG SubTypeValue;
+ LPCWSTR DisplayName;
+ ULONG EventNameMicrodomIndex;
+ } EventEntry;
+
+typedef
+enum _EventEntryFieldId
+ { Event_Level = 0,
+ Event_Version = Event_Level + 1,
+ Event_Guid = Event_Version + 1,
+ Event_SubTypeName = Event_Guid + 1,
+ Event_SubTypeValue = Event_SubTypeName + 1,
+ Event_DisplayName = Event_SubTypeValue + 1,
+ Event_EventNameMicrodomIndex = Event_DisplayName + 1
+ } EventEntryFieldId;
+
+
+
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0305_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0305_v0_0_s_ifspec;
+
+#ifndef __IEventEntry_INTERFACE_DEFINED__
+#define __IEventEntry_INTERFACE_DEFINED__
+
+/* interface IEventEntry */
+/* [uuid][unique][object][local] */
+
+
+EXTERN_C const IID IID_IEventEntry;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("8AD3FC86-AFD3-477a-8FD5-146C291195BB")
+ IEventEntry : public IUnknown
+ {
+ public:
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
+ /* [retval][out] */ EventEntry **__MIDL_0176) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_EventID(
+ /* [retval][out] */ ULONG *__MIDL_0177) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Level(
+ /* [retval][out] */ ULONG *__MIDL_0178) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Version(
+ /* [retval][out] */ ULONG *__MIDL_0179) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Guid(
+ /* [retval][out] */ GUID *__MIDL_0180) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SubTypeName(
+ /* [retval][out] */ LPCWSTR *__MIDL_0181) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SubTypeValue(
+ /* [retval][out] */ ULONG *__MIDL_0182) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_DisplayName(
+ /* [retval][out] */ LPCWSTR *__MIDL_0183) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_EventNameMicrodomIndex(
+ /* [retval][out] */ ULONG *__MIDL_0184) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IEventEntryVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IEventEntry * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IEventEntry * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IEventEntry * This);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
+ IEventEntry * This,
+ /* [retval][out] */ EventEntry **__MIDL_0176);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_EventID )(
+ IEventEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0177);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Level )(
+ IEventEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0178);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Version )(
+ IEventEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0179);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Guid )(
+ IEventEntry * This,
+ /* [retval][out] */ GUID *__MIDL_0180);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_SubTypeName )(
+ IEventEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0181);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_SubTypeValue )(
+ IEventEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0182);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_DisplayName )(
+ IEventEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0183);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_EventNameMicrodomIndex )(
+ IEventEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0184);
+
+ END_INTERFACE
+ } IEventEntryVtbl;
+
+ interface IEventEntry
+ {
+ CONST_VTBL struct IEventEntryVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IEventEntry_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IEventEntry_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IEventEntry_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IEventEntry_get_AllData(This,__MIDL_0176) \
+ (This)->lpVtbl -> get_AllData(This,__MIDL_0176)
+
+#define IEventEntry_get_EventID(This,__MIDL_0177) \
+ (This)->lpVtbl -> get_EventID(This,__MIDL_0177)
+
+#define IEventEntry_get_Level(This,__MIDL_0178) \
+ (This)->lpVtbl -> get_Level(This,__MIDL_0178)
+
+#define IEventEntry_get_Version(This,__MIDL_0179) \
+ (This)->lpVtbl -> get_Version(This,__MIDL_0179)
+
+#define IEventEntry_get_Guid(This,__MIDL_0180) \
+ (This)->lpVtbl -> get_Guid(This,__MIDL_0180)
+
+#define IEventEntry_get_SubTypeName(This,__MIDL_0181) \
+ (This)->lpVtbl -> get_SubTypeName(This,__MIDL_0181)
+
+#define IEventEntry_get_SubTypeValue(This,__MIDL_0182) \
+ (This)->lpVtbl -> get_SubTypeValue(This,__MIDL_0182)
+
+#define IEventEntry_get_DisplayName(This,__MIDL_0183) \
+ (This)->lpVtbl -> get_DisplayName(This,__MIDL_0183)
+
+#define IEventEntry_get_EventNameMicrodomIndex(This,__MIDL_0184) \
+ (This)->lpVtbl -> get_EventNameMicrodomIndex(This,__MIDL_0184)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IEventEntry_get_AllData_Proxy(
+ IEventEntry * This,
+ /* [retval][out] */ EventEntry **__MIDL_0176);
+
+
+void __RPC_STUB IEventEntry_get_AllData_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IEventEntry_get_EventID_Proxy(
+ IEventEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0177);
+
+
+void __RPC_STUB IEventEntry_get_EventID_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IEventEntry_get_Level_Proxy(
+ IEventEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0178);
+
+
+void __RPC_STUB IEventEntry_get_Level_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IEventEntry_get_Version_Proxy(
+ IEventEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0179);
+
+
+void __RPC_STUB IEventEntry_get_Version_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IEventEntry_get_Guid_Proxy(
+ IEventEntry * This,
+ /* [retval][out] */ GUID *__MIDL_0180);
+
+
+void __RPC_STUB IEventEntry_get_Guid_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IEventEntry_get_SubTypeName_Proxy(
+ IEventEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0181);
+
+
+void __RPC_STUB IEventEntry_get_SubTypeName_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IEventEntry_get_SubTypeValue_Proxy(
+ IEventEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0182);
+
+
+void __RPC_STUB IEventEntry_get_SubTypeValue_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IEventEntry_get_DisplayName_Proxy(
+ IEventEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0183);
+
+
+void __RPC_STUB IEventEntry_get_DisplayName_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IEventEntry_get_EventNameMicrodomIndex_Proxy(
+ IEventEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0184);
+
+
+void __RPC_STUB IEventEntry_get_EventNameMicrodomIndex_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IEventEntry_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_isolation_0306 */
+/* [local] */
+
+typedef struct _EventMapEntry
+ {
+ LPCWSTR MapName;
+ LPCWSTR Name;
+ ULONG Value;
+ BOOLEAN IsValueMap;
+ } EventMapEntry;
+
+typedef
+enum _EventMapEntryFieldId
+ { EventMap_Name = 0,
+ EventMap_Value = EventMap_Name + 1,
+ EventMap_IsValueMap = EventMap_Value + 1
+ } EventMapEntryFieldId;
+
+
+
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0306_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0306_v0_0_s_ifspec;
+
+#ifndef __IEventMapEntry_INTERFACE_DEFINED__
+#define __IEventMapEntry_INTERFACE_DEFINED__
+
+/* interface IEventMapEntry */
+/* [uuid][unique][object][local] */
+
+
+EXTERN_C const IID IID_IEventMapEntry;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("8AD3FC86-AFD3-477a-8FD5-146C291195BC")
+ IEventMapEntry : public IUnknown
+ {
+ public:
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
+ /* [retval][out] */ EventMapEntry **__MIDL_0185) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_MapName(
+ /* [retval][out] */ LPCWSTR *__MIDL_0186) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Name(
+ /* [retval][out] */ LPCWSTR *__MIDL_0187) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Value(
+ /* [retval][out] */ ULONG *__MIDL_0188) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_IsValueMap(
+ /* [retval][out] */ BOOLEAN *__MIDL_0189) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IEventMapEntryVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IEventMapEntry * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IEventMapEntry * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IEventMapEntry * This);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
+ IEventMapEntry * This,
+ /* [retval][out] */ EventMapEntry **__MIDL_0185);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_MapName )(
+ IEventMapEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0186);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Name )(
+ IEventMapEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0187);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Value )(
+ IEventMapEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0188);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_IsValueMap )(
+ IEventMapEntry * This,
+ /* [retval][out] */ BOOLEAN *__MIDL_0189);
+
+ END_INTERFACE
+ } IEventMapEntryVtbl;
+
+ interface IEventMapEntry
+ {
+ CONST_VTBL struct IEventMapEntryVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IEventMapEntry_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IEventMapEntry_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IEventMapEntry_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IEventMapEntry_get_AllData(This,__MIDL_0185) \
+ (This)->lpVtbl -> get_AllData(This,__MIDL_0185)
+
+#define IEventMapEntry_get_MapName(This,__MIDL_0186) \
+ (This)->lpVtbl -> get_MapName(This,__MIDL_0186)
+
+#define IEventMapEntry_get_Name(This,__MIDL_0187) \
+ (This)->lpVtbl -> get_Name(This,__MIDL_0187)
+
+#define IEventMapEntry_get_Value(This,__MIDL_0188) \
+ (This)->lpVtbl -> get_Value(This,__MIDL_0188)
+
+#define IEventMapEntry_get_IsValueMap(This,__MIDL_0189) \
+ (This)->lpVtbl -> get_IsValueMap(This,__MIDL_0189)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IEventMapEntry_get_AllData_Proxy(
+ IEventMapEntry * This,
+ /* [retval][out] */ EventMapEntry **__MIDL_0185);
+
+
+void __RPC_STUB IEventMapEntry_get_AllData_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IEventMapEntry_get_MapName_Proxy(
+ IEventMapEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0186);
+
+
+void __RPC_STUB IEventMapEntry_get_MapName_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IEventMapEntry_get_Name_Proxy(
+ IEventMapEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0187);
+
+
+void __RPC_STUB IEventMapEntry_get_Name_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IEventMapEntry_get_Value_Proxy(
+ IEventMapEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0188);
+
+
+void __RPC_STUB IEventMapEntry_get_Value_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IEventMapEntry_get_IsValueMap_Proxy(
+ IEventMapEntry * This,
+ /* [retval][out] */ BOOLEAN *__MIDL_0189);
+
+
+void __RPC_STUB IEventMapEntry_get_IsValueMap_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IEventMapEntry_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_isolation_0307 */
+/* [local] */
+
+typedef struct _EventTagEntry
+ {
+ LPCWSTR TagData;
+ ULONG EventID;
+ } EventTagEntry;
+
+typedef
+enum _EventTagEntryFieldId
+ { EventTag_EventID = 0
+ } EventTagEntryFieldId;
+
+
+
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0307_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0307_v0_0_s_ifspec;
+
+#ifndef __IEventTagEntry_INTERFACE_DEFINED__
+#define __IEventTagEntry_INTERFACE_DEFINED__
+
+/* interface IEventTagEntry */
+/* [uuid][unique][object][local] */
+
+
+EXTERN_C const IID IID_IEventTagEntry;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("8AD3FC86-AFD3-477a-8FD5-146C291195BD")
+ IEventTagEntry : public IUnknown
+ {
+ public:
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
+ /* [retval][out] */ EventTagEntry **__MIDL_0190) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_TagData(
+ /* [retval][out] */ LPCWSTR *__MIDL_0191) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_EventID(
+ /* [retval][out] */ ULONG *__MIDL_0192) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IEventTagEntryVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IEventTagEntry * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IEventTagEntry * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IEventTagEntry * This);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
+ IEventTagEntry * This,
+ /* [retval][out] */ EventTagEntry **__MIDL_0190);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_TagData )(
+ IEventTagEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0191);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_EventID )(
+ IEventTagEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0192);
+
+ END_INTERFACE
+ } IEventTagEntryVtbl;
+
+ interface IEventTagEntry
+ {
+ CONST_VTBL struct IEventTagEntryVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IEventTagEntry_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IEventTagEntry_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IEventTagEntry_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IEventTagEntry_get_AllData(This,__MIDL_0190) \
+ (This)->lpVtbl -> get_AllData(This,__MIDL_0190)
+
+#define IEventTagEntry_get_TagData(This,__MIDL_0191) \
+ (This)->lpVtbl -> get_TagData(This,__MIDL_0191)
+
+#define IEventTagEntry_get_EventID(This,__MIDL_0192) \
+ (This)->lpVtbl -> get_EventID(This,__MIDL_0192)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IEventTagEntry_get_AllData_Proxy(
+ IEventTagEntry * This,
+ /* [retval][out] */ EventTagEntry **__MIDL_0190);
+
+
+void __RPC_STUB IEventTagEntry_get_AllData_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IEventTagEntry_get_TagData_Proxy(
+ IEventTagEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0191);
+
+
+void __RPC_STUB IEventTagEntry_get_TagData_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IEventTagEntry_get_EventID_Proxy(
+ IEventTagEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0192);
+
+
+void __RPC_STUB IEventTagEntry_get_EventID_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IEventTagEntry_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_isolation_0308 */
+/* [local] */
+
+typedef struct _RegistryValueEntry
+ {
+ ULONG Flags;
+ ULONG OperationHint;
+ ULONG Type;
+ LPCWSTR Value;
+ LPCWSTR BuildFilter;
+ } RegistryValueEntry;
+
+typedef
+enum _RegistryValueEntryFieldId
+ { RegistryValue_Flags = 0,
+ RegistryValue_OperationHint = RegistryValue_Flags + 1,
+ RegistryValue_Type = RegistryValue_OperationHint + 1,
+ RegistryValue_Value = RegistryValue_Type + 1,
+ RegistryValue_BuildFilter = RegistryValue_Value + 1
+ } RegistryValueEntryFieldId;
+
+
+
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0308_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0308_v0_0_s_ifspec;
+
+#ifndef __IRegistryValueEntry_INTERFACE_DEFINED__
+#define __IRegistryValueEntry_INTERFACE_DEFINED__
+
+/* interface IRegistryValueEntry */
+/* [uuid][unique][object][local] */
+
+
+EXTERN_C const IID IID_IRegistryValueEntry;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("49e1fe8d-ebb8-4593-8c4e-3e14c845b142")
+ IRegistryValueEntry : public IUnknown
+ {
+ public:
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
+ /* [retval][out] */ RegistryValueEntry **__MIDL_0193) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Flags(
+ /* [retval][out] */ ULONG *__MIDL_0194) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_OperationHint(
+ /* [retval][out] */ ULONG *__MIDL_0195) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Type(
+ /* [retval][out] */ ULONG *__MIDL_0196) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Value(
+ /* [retval][out] */ LPCWSTR *__MIDL_0197) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_BuildFilter(
+ /* [retval][out] */ LPCWSTR *__MIDL_0198) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IRegistryValueEntryVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IRegistryValueEntry * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IRegistryValueEntry * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IRegistryValueEntry * This);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
+ IRegistryValueEntry * This,
+ /* [retval][out] */ RegistryValueEntry **__MIDL_0193);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Flags )(
+ IRegistryValueEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0194);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_OperationHint )(
+ IRegistryValueEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0195);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Type )(
+ IRegistryValueEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0196);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Value )(
+ IRegistryValueEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0197);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_BuildFilter )(
+ IRegistryValueEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0198);
+
+ END_INTERFACE
+ } IRegistryValueEntryVtbl;
+
+ interface IRegistryValueEntry
+ {
+ CONST_VTBL struct IRegistryValueEntryVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IRegistryValueEntry_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IRegistryValueEntry_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IRegistryValueEntry_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IRegistryValueEntry_get_AllData(This,__MIDL_0193) \
+ (This)->lpVtbl -> get_AllData(This,__MIDL_0193)
+
+#define IRegistryValueEntry_get_Flags(This,__MIDL_0194) \
+ (This)->lpVtbl -> get_Flags(This,__MIDL_0194)
+
+#define IRegistryValueEntry_get_OperationHint(This,__MIDL_0195) \
+ (This)->lpVtbl -> get_OperationHint(This,__MIDL_0195)
+
+#define IRegistryValueEntry_get_Type(This,__MIDL_0196) \
+ (This)->lpVtbl -> get_Type(This,__MIDL_0196)
+
+#define IRegistryValueEntry_get_Value(This,__MIDL_0197) \
+ (This)->lpVtbl -> get_Value(This,__MIDL_0197)
+
+#define IRegistryValueEntry_get_BuildFilter(This,__MIDL_0198) \
+ (This)->lpVtbl -> get_BuildFilter(This,__MIDL_0198)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IRegistryValueEntry_get_AllData_Proxy(
+ IRegistryValueEntry * This,
+ /* [retval][out] */ RegistryValueEntry **__MIDL_0193);
+
+
+void __RPC_STUB IRegistryValueEntry_get_AllData_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IRegistryValueEntry_get_Flags_Proxy(
+ IRegistryValueEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0194);
+
+
+void __RPC_STUB IRegistryValueEntry_get_Flags_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IRegistryValueEntry_get_OperationHint_Proxy(
+ IRegistryValueEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0195);
+
+
+void __RPC_STUB IRegistryValueEntry_get_OperationHint_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IRegistryValueEntry_get_Type_Proxy(
+ IRegistryValueEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0196);
+
+
+void __RPC_STUB IRegistryValueEntry_get_Type_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IRegistryValueEntry_get_Value_Proxy(
+ IRegistryValueEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0197);
+
+
+void __RPC_STUB IRegistryValueEntry_get_Value_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IRegistryValueEntry_get_BuildFilter_Proxy(
+ IRegistryValueEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0198);
+
+
+void __RPC_STUB IRegistryValueEntry_get_BuildFilter_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IRegistryValueEntry_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_isolation_0309 */
+/* [local] */
+
+typedef struct _RegistryKeyEntry
+ {
+ ULONG Flags;
+ ULONG Protection;
+ LPCWSTR BuildFilter;
+ /* [size_is] */ BYTE *SecurityDescriptor;
+ ULONG SecurityDescriptorSize;
+ /* [size_is] */ BYTE *Values;
+ ULONG ValuesSize;
+ /* [size_is] */ BYTE *Keys;
+ ULONG KeysSize;
+ } RegistryKeyEntry;
+
+typedef
+enum _RegistryKeyEntryFieldId
+ { RegistryKey_Flags = 0,
+ RegistryKey_Protection = RegistryKey_Flags + 1,
+ RegistryKey_BuildFilter = RegistryKey_Protection + 1,
+ RegistryKey_SecurityDescriptor = RegistryKey_BuildFilter + 1,
+ RegistryKey_SecurityDescriptorSize = RegistryKey_SecurityDescriptor + 1,
+ RegistryKey_Values = RegistryKey_SecurityDescriptorSize + 1,
+ RegistryKey_ValuesSize = RegistryKey_Values + 1,
+ RegistryKey_Keys = RegistryKey_ValuesSize + 1,
+ RegistryKey_KeysSize = RegistryKey_Keys + 1
+ } RegistryKeyEntryFieldId;
+
+
+
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0309_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0309_v0_0_s_ifspec;
+
+#ifndef __IRegistryKeyEntry_INTERFACE_DEFINED__
+#define __IRegistryKeyEntry_INTERFACE_DEFINED__
+
+/* interface IRegistryKeyEntry */
+/* [uuid][unique][object][local] */
+
+
+EXTERN_C const IID IID_IRegistryKeyEntry;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("186685d1-6673-48c3-bc83-95859bb591df")
+ IRegistryKeyEntry : public IUnknown
+ {
+ public:
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
+ /* [retval][out] */ RegistryKeyEntry **__MIDL_0199) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Flags(
+ /* [retval][out] */ ULONG *__MIDL_0200) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Protection(
+ /* [retval][out] */ ULONG *__MIDL_0201) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_BuildFilter(
+ /* [retval][out] */ LPCWSTR *__MIDL_0202) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SecurityDescriptor(
+ /* [retval][out] */ IStream **__MIDL_0203) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Values(
+ /* [retval][out] */ IStream **__MIDL_0204) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Keys(
+ /* [retval][out] */ IStream **__MIDL_0205) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IRegistryKeyEntryVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IRegistryKeyEntry * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IRegistryKeyEntry * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IRegistryKeyEntry * This);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
+ IRegistryKeyEntry * This,
+ /* [retval][out] */ RegistryKeyEntry **__MIDL_0199);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Flags )(
+ IRegistryKeyEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0200);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Protection )(
+ IRegistryKeyEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0201);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_BuildFilter )(
+ IRegistryKeyEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0202);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_SecurityDescriptor )(
+ IRegistryKeyEntry * This,
+ /* [retval][out] */ IStream **__MIDL_0203);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Values )(
+ IRegistryKeyEntry * This,
+ /* [retval][out] */ IStream **__MIDL_0204);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Keys )(
+ IRegistryKeyEntry * This,
+ /* [retval][out] */ IStream **__MIDL_0205);
+
+ END_INTERFACE
+ } IRegistryKeyEntryVtbl;
+
+ interface IRegistryKeyEntry
+ {
+ CONST_VTBL struct IRegistryKeyEntryVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IRegistryKeyEntry_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IRegistryKeyEntry_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IRegistryKeyEntry_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IRegistryKeyEntry_get_AllData(This,__MIDL_0199) \
+ (This)->lpVtbl -> get_AllData(This,__MIDL_0199)
+
+#define IRegistryKeyEntry_get_Flags(This,__MIDL_0200) \
+ (This)->lpVtbl -> get_Flags(This,__MIDL_0200)
+
+#define IRegistryKeyEntry_get_Protection(This,__MIDL_0201) \
+ (This)->lpVtbl -> get_Protection(This,__MIDL_0201)
+
+#define IRegistryKeyEntry_get_BuildFilter(This,__MIDL_0202) \
+ (This)->lpVtbl -> get_BuildFilter(This,__MIDL_0202)
+
+#define IRegistryKeyEntry_get_SecurityDescriptor(This,__MIDL_0203) \
+ (This)->lpVtbl -> get_SecurityDescriptor(This,__MIDL_0203)
+
+#define IRegistryKeyEntry_get_Values(This,__MIDL_0204) \
+ (This)->lpVtbl -> get_Values(This,__MIDL_0204)
+
+#define IRegistryKeyEntry_get_Keys(This,__MIDL_0205) \
+ (This)->lpVtbl -> get_Keys(This,__MIDL_0205)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IRegistryKeyEntry_get_AllData_Proxy(
+ IRegistryKeyEntry * This,
+ /* [retval][out] */ RegistryKeyEntry **__MIDL_0199);
+
+
+void __RPC_STUB IRegistryKeyEntry_get_AllData_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IRegistryKeyEntry_get_Flags_Proxy(
+ IRegistryKeyEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0200);
+
+
+void __RPC_STUB IRegistryKeyEntry_get_Flags_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IRegistryKeyEntry_get_Protection_Proxy(
+ IRegistryKeyEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0201);
+
+
+void __RPC_STUB IRegistryKeyEntry_get_Protection_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IRegistryKeyEntry_get_BuildFilter_Proxy(
+ IRegistryKeyEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0202);
+
+
+void __RPC_STUB IRegistryKeyEntry_get_BuildFilter_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IRegistryKeyEntry_get_SecurityDescriptor_Proxy(
+ IRegistryKeyEntry * This,
+ /* [retval][out] */ IStream **__MIDL_0203);
+
+
+void __RPC_STUB IRegistryKeyEntry_get_SecurityDescriptor_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IRegistryKeyEntry_get_Values_Proxy(
+ IRegistryKeyEntry * This,
+ /* [retval][out] */ IStream **__MIDL_0204);
+
+
+void __RPC_STUB IRegistryKeyEntry_get_Values_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IRegistryKeyEntry_get_Keys_Proxy(
+ IRegistryKeyEntry * This,
+ /* [retval][out] */ IStream **__MIDL_0205);
+
+
+void __RPC_STUB IRegistryKeyEntry_get_Keys_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IRegistryKeyEntry_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_isolation_0310 */
+/* [local] */
+
+typedef struct _DirectoryEntry
+ {
+ ULONG Flags;
+ ULONG Protection;
+ LPCWSTR BuildFilter;
+ /* [size_is] */ BYTE *SecurityDescriptor;
+ ULONG SecurityDescriptorSize;
+ } DirectoryEntry;
+
+typedef
+enum _DirectoryEntryFieldId
+ { Directory_Flags = 0,
+ Directory_Protection = Directory_Flags + 1,
+ Directory_BuildFilter = Directory_Protection + 1,
+ Directory_SecurityDescriptor = Directory_BuildFilter + 1,
+ Directory_SecurityDescriptorSize = Directory_SecurityDescriptor + 1
+ } DirectoryEntryFieldId;
+
+
+
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0310_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0310_v0_0_s_ifspec;
+
+#ifndef __IDirectoryEntry_INTERFACE_DEFINED__
+#define __IDirectoryEntry_INTERFACE_DEFINED__
+
+/* interface IDirectoryEntry */
+/* [uuid][unique][object][local] */
+
+
+EXTERN_C const IID IID_IDirectoryEntry;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("9f27c750-7dfb-46a1-a673-52e53e2337a9")
+ IDirectoryEntry : public IUnknown
+ {
+ public:
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
+ /* [retval][out] */ DirectoryEntry **__MIDL_0206) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Flags(
+ /* [retval][out] */ ULONG *__MIDL_0207) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Protection(
+ /* [retval][out] */ ULONG *__MIDL_0208) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_BuildFilter(
+ /* [retval][out] */ LPCWSTR *__MIDL_0209) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SecurityDescriptor(
+ /* [retval][out] */ IStream **__MIDL_0210) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IDirectoryEntryVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IDirectoryEntry * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IDirectoryEntry * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IDirectoryEntry * This);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
+ IDirectoryEntry * This,
+ /* [retval][out] */ DirectoryEntry **__MIDL_0206);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Flags )(
+ IDirectoryEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0207);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Protection )(
+ IDirectoryEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0208);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_BuildFilter )(
+ IDirectoryEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0209);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_SecurityDescriptor )(
+ IDirectoryEntry * This,
+ /* [retval][out] */ IStream **__MIDL_0210);
+
+ END_INTERFACE
+ } IDirectoryEntryVtbl;
+
+ interface IDirectoryEntry
+ {
+ CONST_VTBL struct IDirectoryEntryVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IDirectoryEntry_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IDirectoryEntry_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IDirectoryEntry_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IDirectoryEntry_get_AllData(This,__MIDL_0206) \
+ (This)->lpVtbl -> get_AllData(This,__MIDL_0206)
+
+#define IDirectoryEntry_get_Flags(This,__MIDL_0207) \
+ (This)->lpVtbl -> get_Flags(This,__MIDL_0207)
+
+#define IDirectoryEntry_get_Protection(This,__MIDL_0208) \
+ (This)->lpVtbl -> get_Protection(This,__MIDL_0208)
+
+#define IDirectoryEntry_get_BuildFilter(This,__MIDL_0209) \
+ (This)->lpVtbl -> get_BuildFilter(This,__MIDL_0209)
+
+#define IDirectoryEntry_get_SecurityDescriptor(This,__MIDL_0210) \
+ (This)->lpVtbl -> get_SecurityDescriptor(This,__MIDL_0210)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IDirectoryEntry_get_AllData_Proxy(
+ IDirectoryEntry * This,
+ /* [retval][out] */ DirectoryEntry **__MIDL_0206);
+
+
+void __RPC_STUB IDirectoryEntry_get_AllData_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IDirectoryEntry_get_Flags_Proxy(
+ IDirectoryEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0207);
+
+
+void __RPC_STUB IDirectoryEntry_get_Flags_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IDirectoryEntry_get_Protection_Proxy(
+ IDirectoryEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0208);
+
+
+void __RPC_STUB IDirectoryEntry_get_Protection_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IDirectoryEntry_get_BuildFilter_Proxy(
+ IDirectoryEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0209);
+
+
+void __RPC_STUB IDirectoryEntry_get_BuildFilter_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IDirectoryEntry_get_SecurityDescriptor_Proxy(
+ IDirectoryEntry * This,
+ /* [retval][out] */ IStream **__MIDL_0210);
+
+
+void __RPC_STUB IDirectoryEntry_get_SecurityDescriptor_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IDirectoryEntry_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_isolation_0311 */
+/* [local] */
+
+typedef struct _SecurityDescriptorReferenceEntry
+ {
+ LPCWSTR Name;
+ LPCWSTR BuildFilter;
+ } SecurityDescriptorReferenceEntry;
+
+typedef
+enum _SecurityDescriptorReferenceEntryFieldId
+ { SecurityDescriptorReference_Name = 0,
+ SecurityDescriptorReference_BuildFilter = SecurityDescriptorReference_Name + 1
+ } SecurityDescriptorReferenceEntryFieldId;
+
+
+
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0311_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0311_v0_0_s_ifspec;
+
+#ifndef __ISecurityDescriptorReferenceEntry_INTERFACE_DEFINED__
+#define __ISecurityDescriptorReferenceEntry_INTERFACE_DEFINED__
+
+/* interface ISecurityDescriptorReferenceEntry */
+/* [uuid][unique][object][local] */
+
+
+EXTERN_C const IID IID_ISecurityDescriptorReferenceEntry;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("a75b74e9-2c00-4ebb-b3f9-62a670aaa07e")
+ ISecurityDescriptorReferenceEntry : public IUnknown
+ {
+ public:
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
+ /* [retval][out] */ SecurityDescriptorReferenceEntry **__MIDL_0211) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Name(
+ /* [retval][out] */ LPCWSTR *__MIDL_0212) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_BuildFilter(
+ /* [retval][out] */ LPCWSTR *__MIDL_0213) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct ISecurityDescriptorReferenceEntryVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ ISecurityDescriptorReferenceEntry * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ ISecurityDescriptorReferenceEntry * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ ISecurityDescriptorReferenceEntry * This);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
+ ISecurityDescriptorReferenceEntry * This,
+ /* [retval][out] */ SecurityDescriptorReferenceEntry **__MIDL_0211);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Name )(
+ ISecurityDescriptorReferenceEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0212);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_BuildFilter )(
+ ISecurityDescriptorReferenceEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0213);
+
+ END_INTERFACE
+ } ISecurityDescriptorReferenceEntryVtbl;
+
+ interface ISecurityDescriptorReferenceEntry
+ {
+ CONST_VTBL struct ISecurityDescriptorReferenceEntryVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define ISecurityDescriptorReferenceEntry_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define ISecurityDescriptorReferenceEntry_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define ISecurityDescriptorReferenceEntry_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define ISecurityDescriptorReferenceEntry_get_AllData(This,__MIDL_0211) \
+ (This)->lpVtbl -> get_AllData(This,__MIDL_0211)
+
+#define ISecurityDescriptorReferenceEntry_get_Name(This,__MIDL_0212) \
+ (This)->lpVtbl -> get_Name(This,__MIDL_0212)
+
+#define ISecurityDescriptorReferenceEntry_get_BuildFilter(This,__MIDL_0213) \
+ (This)->lpVtbl -> get_BuildFilter(This,__MIDL_0213)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ISecurityDescriptorReferenceEntry_get_AllData_Proxy(
+ ISecurityDescriptorReferenceEntry * This,
+ /* [retval][out] */ SecurityDescriptorReferenceEntry **__MIDL_0211);
+
+
+void __RPC_STUB ISecurityDescriptorReferenceEntry_get_AllData_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ISecurityDescriptorReferenceEntry_get_Name_Proxy(
+ ISecurityDescriptorReferenceEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0212);
+
+
+void __RPC_STUB ISecurityDescriptorReferenceEntry_get_Name_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ISecurityDescriptorReferenceEntry_get_BuildFilter_Proxy(
+ ISecurityDescriptorReferenceEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0213);
+
+
+void __RPC_STUB ISecurityDescriptorReferenceEntry_get_BuildFilter_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __ISecurityDescriptorReferenceEntry_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_isolation_0312 */
+/* [local] */
+
+typedef struct _CounterSetEntry
+ {
+ GUID CounterSetGuid;
+ GUID ProviderGuid;
+ LPCWSTR Name;
+ LPCWSTR Description;
+ BOOLEAN InstanceType;
+ } CounterSetEntry;
+
+typedef
+enum _CounterSetEntryFieldId
+ { CounterSet_ProviderGuid = 0,
+ CounterSet_Name = CounterSet_ProviderGuid + 1,
+ CounterSet_Description = CounterSet_Name + 1,
+ CounterSet_InstanceType = CounterSet_Description + 1
+ } CounterSetEntryFieldId;
+
+
+
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0312_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0312_v0_0_s_ifspec;
+
+#ifndef __ICounterSetEntry_INTERFACE_DEFINED__
+#define __ICounterSetEntry_INTERFACE_DEFINED__
+
+/* interface ICounterSetEntry */
+/* [uuid][unique][object][local] */
+
+
+EXTERN_C const IID IID_ICounterSetEntry;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("8CD3FC85-AFD3-477a-8FD5-146C291195BB")
+ ICounterSetEntry : public IUnknown
+ {
+ public:
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
+ /* [retval][out] */ CounterSetEntry **__MIDL_0214) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_CounterSetGuid(
+ /* [retval][out] */ GUID *__MIDL_0215) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ProviderGuid(
+ /* [retval][out] */ GUID *__MIDL_0216) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Name(
+ /* [retval][out] */ LPCWSTR *__MIDL_0217) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Description(
+ /* [retval][out] */ LPCWSTR *__MIDL_0218) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_InstanceType(
+ /* [retval][out] */ BOOLEAN *__MIDL_0219) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct ICounterSetEntryVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ ICounterSetEntry * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ ICounterSetEntry * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ ICounterSetEntry * This);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
+ ICounterSetEntry * This,
+ /* [retval][out] */ CounterSetEntry **__MIDL_0214);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_CounterSetGuid )(
+ ICounterSetEntry * This,
+ /* [retval][out] */ GUID *__MIDL_0215);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ProviderGuid )(
+ ICounterSetEntry * This,
+ /* [retval][out] */ GUID *__MIDL_0216);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Name )(
+ ICounterSetEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0217);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Description )(
+ ICounterSetEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0218);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_InstanceType )(
+ ICounterSetEntry * This,
+ /* [retval][out] */ BOOLEAN *__MIDL_0219);
+
+ END_INTERFACE
+ } ICounterSetEntryVtbl;
+
+ interface ICounterSetEntry
+ {
+ CONST_VTBL struct ICounterSetEntryVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define ICounterSetEntry_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define ICounterSetEntry_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define ICounterSetEntry_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define ICounterSetEntry_get_AllData(This,__MIDL_0214) \
+ (This)->lpVtbl -> get_AllData(This,__MIDL_0214)
+
+#define ICounterSetEntry_get_CounterSetGuid(This,__MIDL_0215) \
+ (This)->lpVtbl -> get_CounterSetGuid(This,__MIDL_0215)
+
+#define ICounterSetEntry_get_ProviderGuid(This,__MIDL_0216) \
+ (This)->lpVtbl -> get_ProviderGuid(This,__MIDL_0216)
+
+#define ICounterSetEntry_get_Name(This,__MIDL_0217) \
+ (This)->lpVtbl -> get_Name(This,__MIDL_0217)
+
+#define ICounterSetEntry_get_Description(This,__MIDL_0218) \
+ (This)->lpVtbl -> get_Description(This,__MIDL_0218)
+
+#define ICounterSetEntry_get_InstanceType(This,__MIDL_0219) \
+ (This)->lpVtbl -> get_InstanceType(This,__MIDL_0219)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ICounterSetEntry_get_AllData_Proxy(
+ ICounterSetEntry * This,
+ /* [retval][out] */ CounterSetEntry **__MIDL_0214);
+
+
+void __RPC_STUB ICounterSetEntry_get_AllData_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ICounterSetEntry_get_CounterSetGuid_Proxy(
+ ICounterSetEntry * This,
+ /* [retval][out] */ GUID *__MIDL_0215);
+
+
+void __RPC_STUB ICounterSetEntry_get_CounterSetGuid_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ICounterSetEntry_get_ProviderGuid_Proxy(
+ ICounterSetEntry * This,
+ /* [retval][out] */ GUID *__MIDL_0216);
+
+
+void __RPC_STUB ICounterSetEntry_get_ProviderGuid_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ICounterSetEntry_get_Name_Proxy(
+ ICounterSetEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0217);
+
+
+void __RPC_STUB ICounterSetEntry_get_Name_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ICounterSetEntry_get_Description_Proxy(
+ ICounterSetEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0218);
+
+
+void __RPC_STUB ICounterSetEntry_get_Description_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ICounterSetEntry_get_InstanceType_Proxy(
+ ICounterSetEntry * This,
+ /* [retval][out] */ BOOLEAN *__MIDL_0219);
+
+
+void __RPC_STUB ICounterSetEntry_get_InstanceType_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __ICounterSetEntry_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_isolation_0313 */
+/* [local] */
+
+typedef struct _CounterEntry
+ {
+ GUID CounterSetGuid;
+ ULONG CounterId;
+ LPCWSTR Name;
+ LPCWSTR Description;
+ ULONG CounterType;
+ ULONGLONG Attributes;
+ ULONG BaseId;
+ ULONG DefaultScale;
+ } CounterEntry;
+
+typedef
+enum _CounterEntryFieldId
+ { Counter_CounterId = 0,
+ Counter_Name = Counter_CounterId + 1,
+ Counter_Description = Counter_Name + 1,
+ Counter_CounterType = Counter_Description + 1,
+ Counter_Attributes = Counter_CounterType + 1,
+ Counter_BaseId = Counter_Attributes + 1,
+ Counter_DefaultScale = Counter_BaseId + 1
+ } CounterEntryFieldId;
+
+
+
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0313_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0313_v0_0_s_ifspec;
+
+#ifndef __ICounterEntry_INTERFACE_DEFINED__
+#define __ICounterEntry_INTERFACE_DEFINED__
+
+/* interface ICounterEntry */
+/* [uuid][unique][object][local] */
+
+
+EXTERN_C const IID IID_ICounterEntry;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("8CD3FC86-AFD3-477a-8FD5-146C291195BB")
+ ICounterEntry : public IUnknown
+ {
+ public:
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
+ /* [retval][out] */ CounterEntry **__MIDL_0220) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_CounterSetGuid(
+ /* [retval][out] */ GUID *__MIDL_0221) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_CounterId(
+ /* [retval][out] */ ULONG *__MIDL_0222) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Name(
+ /* [retval][out] */ LPCWSTR *__MIDL_0223) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Description(
+ /* [retval][out] */ LPCWSTR *__MIDL_0224) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_CounterType(
+ /* [retval][out] */ ULONG *__MIDL_0225) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Attributes(
+ /* [retval][out] */ ULONGLONG *__MIDL_0226) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_BaseId(
+ /* [retval][out] */ ULONG *__MIDL_0227) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_DefaultScale(
+ /* [retval][out] */ ULONG *__MIDL_0228) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct ICounterEntryVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ ICounterEntry * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ ICounterEntry * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ ICounterEntry * This);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
+ ICounterEntry * This,
+ /* [retval][out] */ CounterEntry **__MIDL_0220);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_CounterSetGuid )(
+ ICounterEntry * This,
+ /* [retval][out] */ GUID *__MIDL_0221);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_CounterId )(
+ ICounterEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0222);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Name )(
+ ICounterEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0223);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Description )(
+ ICounterEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0224);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_CounterType )(
+ ICounterEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0225);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Attributes )(
+ ICounterEntry * This,
+ /* [retval][out] */ ULONGLONG *__MIDL_0226);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_BaseId )(
+ ICounterEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0227);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_DefaultScale )(
+ ICounterEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0228);
+
+ END_INTERFACE
+ } ICounterEntryVtbl;
+
+ interface ICounterEntry
+ {
+ CONST_VTBL struct ICounterEntryVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define ICounterEntry_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define ICounterEntry_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define ICounterEntry_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define ICounterEntry_get_AllData(This,__MIDL_0220) \
+ (This)->lpVtbl -> get_AllData(This,__MIDL_0220)
+
+#define ICounterEntry_get_CounterSetGuid(This,__MIDL_0221) \
+ (This)->lpVtbl -> get_CounterSetGuid(This,__MIDL_0221)
+
+#define ICounterEntry_get_CounterId(This,__MIDL_0222) \
+ (This)->lpVtbl -> get_CounterId(This,__MIDL_0222)
+
+#define ICounterEntry_get_Name(This,__MIDL_0223) \
+ (This)->lpVtbl -> get_Name(This,__MIDL_0223)
+
+#define ICounterEntry_get_Description(This,__MIDL_0224) \
+ (This)->lpVtbl -> get_Description(This,__MIDL_0224)
+
+#define ICounterEntry_get_CounterType(This,__MIDL_0225) \
+ (This)->lpVtbl -> get_CounterType(This,__MIDL_0225)
+
+#define ICounterEntry_get_Attributes(This,__MIDL_0226) \
+ (This)->lpVtbl -> get_Attributes(This,__MIDL_0226)
+
+#define ICounterEntry_get_BaseId(This,__MIDL_0227) \
+ (This)->lpVtbl -> get_BaseId(This,__MIDL_0227)
+
+#define ICounterEntry_get_DefaultScale(This,__MIDL_0228) \
+ (This)->lpVtbl -> get_DefaultScale(This,__MIDL_0228)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ICounterEntry_get_AllData_Proxy(
+ ICounterEntry * This,
+ /* [retval][out] */ CounterEntry **__MIDL_0220);
+
+
+void __RPC_STUB ICounterEntry_get_AllData_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ICounterEntry_get_CounterSetGuid_Proxy(
+ ICounterEntry * This,
+ /* [retval][out] */ GUID *__MIDL_0221);
+
+
+void __RPC_STUB ICounterEntry_get_CounterSetGuid_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ICounterEntry_get_CounterId_Proxy(
+ ICounterEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0222);
+
+
+void __RPC_STUB ICounterEntry_get_CounterId_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ICounterEntry_get_Name_Proxy(
+ ICounterEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0223);
+
+
+void __RPC_STUB ICounterEntry_get_Name_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ICounterEntry_get_Description_Proxy(
+ ICounterEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0224);
+
+
+void __RPC_STUB ICounterEntry_get_Description_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ICounterEntry_get_CounterType_Proxy(
+ ICounterEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0225);
+
+
+void __RPC_STUB ICounterEntry_get_CounterType_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ICounterEntry_get_Attributes_Proxy(
+ ICounterEntry * This,
+ /* [retval][out] */ ULONGLONG *__MIDL_0226);
+
+
+void __RPC_STUB ICounterEntry_get_Attributes_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ICounterEntry_get_BaseId_Proxy(
+ ICounterEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0227);
+
+
+void __RPC_STUB ICounterEntry_get_BaseId_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ICounterEntry_get_DefaultScale_Proxy(
+ ICounterEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0228);
+
+
+void __RPC_STUB ICounterEntry_get_DefaultScale_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __ICounterEntry_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_isolation_0314 */
+/* [local] */
+
+typedef struct _CompatibleFrameworkEntry
+ {
+ ULONG index;
+ LPCWSTR TargetVersion;
+ LPCWSTR Profile;
+ LPCWSTR SupportedRuntime;
+ } CompatibleFrameworkEntry;
+
+typedef
+enum _CompatibleFrameworkEntryFieldId
+ { CompatibleFramework_TargetVersion = 0,
+ CompatibleFramework_Profile = CompatibleFramework_TargetVersion + 1,
+ CompatibleFramework_SupportedRuntime = CompatibleFramework_Profile + 1
+ } CompatibleFrameworkEntryFieldId;
+
+
+
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0314_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0314_v0_0_s_ifspec;
+
+#ifndef __ICompatibleFrameworkEntry_INTERFACE_DEFINED__
+#define __ICompatibleFrameworkEntry_INTERFACE_DEFINED__
+
+/* interface ICompatibleFrameworkEntry */
+/* [uuid][unique][object][local] */
+
+
+EXTERN_C const IID IID_ICompatibleFrameworkEntry;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("C98BFE2A-62C9-40AD-ADCE-A9037BE2BE6C")
+ ICompatibleFrameworkEntry : public IUnknown
+ {
+ public:
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
+ /* [retval][out] */ CompatibleFrameworkEntry **__MIDL_0229) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_index(
+ /* [retval][out] */ ULONG *__MIDL_0230) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_TargetVersion(
+ /* [retval][out] */ LPCWSTR *__MIDL_0231) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Profile(
+ /* [retval][out] */ LPCWSTR *__MIDL_0232) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SupportedRuntime(
+ /* [retval][out] */ LPCWSTR *__MIDL_0233) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct ICompatibleFrameworkEntryVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ ICompatibleFrameworkEntry * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ ICompatibleFrameworkEntry * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ ICompatibleFrameworkEntry * This);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
+ ICompatibleFrameworkEntry * This,
+ /* [retval][out] */ CompatibleFrameworkEntry **__MIDL_0229);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_index )(
+ ICompatibleFrameworkEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0230);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_TargetVersion )(
+ ICompatibleFrameworkEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0231);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Profile )(
+ ICompatibleFrameworkEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0232);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_SupportedRuntime )(
+ ICompatibleFrameworkEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0233);
+
+ END_INTERFACE
+ } ICompatibleFrameworkEntryVtbl;
+
+ interface ICompatibleFrameworkEntry
+ {
+ CONST_VTBL struct ICompatibleFrameworkEntryVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define ICompatibleFrameworkEntry_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define ICompatibleFrameworkEntry_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define ICompatibleFrameworkEntry_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define ICompatibleFrameworkEntry_get_AllData(This,__MIDL_0229) \
+ (This)->lpVtbl -> get_AllData(This,__MIDL_0229)
+
+#define ICompatibleFrameworkEntry_get_index(This,__MIDL_0230) \
+ (This)->lpVtbl -> get_index(This,__MIDL_0230)
+
+#define ICompatibleFrameworkEntry_get_TargetVersion(This,__MIDL_0231) \
+ (This)->lpVtbl -> get_TargetVersion(This,__MIDL_0231)
+
+#define ICompatibleFrameworkEntry_get_Profile(This,__MIDL_0232) \
+ (This)->lpVtbl -> get_Profile(This,__MIDL_0232)
+
+#define ICompatibleFrameworkEntry_get_SupportedRuntime(This,__MIDL_0233) \
+ (This)->lpVtbl -> get_SupportedRuntime(This,__MIDL_0233)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ICompatibleFrameworkEntry_get_AllData_Proxy(
+ ICompatibleFrameworkEntry * This,
+ /* [retval][out] */ CompatibleFrameworkEntry **__MIDL_0229);
+
+
+void __RPC_STUB ICompatibleFrameworkEntry_get_AllData_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ICompatibleFrameworkEntry_get_index_Proxy(
+ ICompatibleFrameworkEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0230);
+
+
+void __RPC_STUB ICompatibleFrameworkEntry_get_index_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ICompatibleFrameworkEntry_get_TargetVersion_Proxy(
+ ICompatibleFrameworkEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0231);
+
+
+void __RPC_STUB ICompatibleFrameworkEntry_get_TargetVersion_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ICompatibleFrameworkEntry_get_Profile_Proxy(
+ ICompatibleFrameworkEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0232);
+
+
+void __RPC_STUB ICompatibleFrameworkEntry_get_Profile_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE ICompatibleFrameworkEntry_get_SupportedRuntime_Proxy(
+ ICompatibleFrameworkEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0233);
+
+
+void __RPC_STUB ICompatibleFrameworkEntry_get_SupportedRuntime_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __ICompatibleFrameworkEntry_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_isolation_0315 */
+/* [local] */
+
+HRESULT FreeMuiResourceIdLookupMapEntry(
+ /* [in] */ MuiResourceIdLookupMapEntry *__MIDL_0234);
+
+HRESULT FreeMuiResourceTypeIdStringEntry(
+ /* [in] */ MuiResourceTypeIdStringEntry *__MIDL_0235);
+
+HRESULT FreeMuiResourceTypeIdIntEntry(
+ /* [in] */ MuiResourceTypeIdIntEntry *__MIDL_0236);
+
+HRESULT FreeMuiResourceMapEntry(
+ /* [in] */ MuiResourceMapEntry *__MIDL_0237);
+
+HRESULT FreeHashElementEntry(
+ /* [in] */ HashElementEntry *__MIDL_0238);
+
+HRESULT FreeFileEntry(
+ /* [in] */ FileEntry *__MIDL_0239);
+
+HRESULT FreeFileAssociationEntry(
+ /* [in] */ FileAssociationEntry *__MIDL_0240);
+
+HRESULT FreeCategoryMembershipDataEntry(
+ /* [in] */ CategoryMembershipDataEntry *__MIDL_0241);
+
+HRESULT FreeSubcategoryMembershipEntry(
+ /* [in] */ SubcategoryMembershipEntry *__MIDL_0242);
+
+HRESULT FreeCategoryMembershipEntry(
+ /* [in] */ CategoryMembershipEntry *__MIDL_0243);
+
+HRESULT FreeCOMServerEntry(
+ /* [in] */ COMServerEntry *__MIDL_0244);
+
+HRESULT FreeProgIdRedirectionEntry(
+ /* [in] */ ProgIdRedirectionEntry *__MIDL_0245);
+
+HRESULT FreeCLRSurrogateEntry(
+ /* [in] */ CLRSurrogateEntry *__MIDL_0246);
+
+HRESULT FreeAssemblyReferenceDependentAssemblyEntry(
+ /* [in] */ AssemblyReferenceDependentAssemblyEntry *__MIDL_0247);
+
+HRESULT FreeAssemblyReferenceEntry(
+ /* [in] */ AssemblyReferenceEntry *__MIDL_0248);
+
+HRESULT FreeWindowClassEntry(
+ /* [in] */ WindowClassEntry *__MIDL_0249);
+
+HRESULT FreeResourceTableMappingEntry(
+ /* [in] */ ResourceTableMappingEntry *__MIDL_0250);
+
+HRESULT FreeEntryPointEntry(
+ /* [in] */ EntryPointEntry *__MIDL_0251);
+
+HRESULT FreePermissionSetEntry(
+ /* [in] */ PermissionSetEntry *__MIDL_0252);
+
+HRESULT FreeAssemblyRequestEntry(
+ /* [in] */ AssemblyRequestEntry *__MIDL_0253);
+
+HRESULT FreeDescriptionMetadataEntry(
+ /* [in] */ DescriptionMetadataEntry *__MIDL_0254);
+
+HRESULT FreeDeploymentMetadataEntry(
+ /* [in] */ DeploymentMetadataEntry *__MIDL_0255);
+
+HRESULT FreeDependentOSMetadataEntry(
+ /* [in] */ DependentOSMetadataEntry *__MIDL_0256);
+
+HRESULT FreeCompatibleFrameworksMetadataEntry(
+ /* [in] */ CompatibleFrameworksMetadataEntry *__MIDL_0257);
+
+HRESULT FreeMetadataSectionEntry(
+ /* [in] */ MetadataSectionEntry *__MIDL_0258);
+
+HRESULT FreeEventEntry(
+ /* [in] */ EventEntry *__MIDL_0259);
+
+HRESULT FreeEventMapEntry(
+ /* [in] */ EventMapEntry *__MIDL_0260);
+
+HRESULT FreeEventTagEntry(
+ /* [in] */ EventTagEntry *__MIDL_0261);
+
+HRESULT FreeRegistryValueEntry(
+ /* [in] */ RegistryValueEntry *__MIDL_0262);
+
+HRESULT FreeRegistryKeyEntry(
+ /* [in] */ RegistryKeyEntry *__MIDL_0263);
+
+HRESULT FreeDirectoryEntry(
+ /* [in] */ DirectoryEntry *__MIDL_0264);
+
+HRESULT FreeSecurityDescriptorReferenceEntry(
+ /* [in] */ SecurityDescriptorReferenceEntry *__MIDL_0265);
+
+HRESULT FreeCounterSetEntry(
+ /* [in] */ CounterSetEntry *__MIDL_0266);
+
+HRESULT FreeCounterEntry(
+ /* [in] */ CounterEntry *__MIDL_0267);
+
+HRESULT FreeCompatibleFrameworkEntry(
+ /* [in] */ CompatibleFrameworkEntry *__MIDL_0268);
+
+typedef
+enum _ACSSECTIONID
+ { ACSSECTIONID_COMPONENTS_SECTION = 1,
+ ACSSECTIONID_MEMBER_LOOKUP_SECTION = 2,
+ ACSSECTIONID_METADATA_SECTION = 3,
+ ACSSECTIONID_STORE_COHERENCY_SECTION = 4
+ } ACSSECTIONID;
+
+
+
+
+
+
+
+
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0315_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0315_v0_0_s_ifspec;
+
+#ifndef __IACS_INTERFACE_DEFINED__
+#define __IACS_INTERFACE_DEFINED__
+
+/* interface IACS */
+/* [unique][uuid][object] */
+
+
+EXTERN_C const IID IID_IACS;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("323f59af-4ab7-45a7-9e95-630cdfacef9c")
+ IACS : public IUnknown
+ {
+ public:
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Identity(
+ /* [retval][out] */ IDefinitionAppId **__MIDL_0269) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ComponentsSection(
+ /* [retval][out] */ ISection **__MIDL_0270) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_MemberLookupSection(
+ /* [retval][out] */ ISection **__MIDL_0271) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_MetadataSection(
+ /* [retval][out] */ ISection **__MIDL_0272) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_StoreCoherencySection(
+ /* [retval][out] */ ISection **__MIDL_0273) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IACSVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IACS * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IACS * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IACS * This);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Identity )(
+ IACS * This,
+ /* [retval][out] */ IDefinitionAppId **__MIDL_0269);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ComponentsSection )(
+ IACS * This,
+ /* [retval][out] */ ISection **__MIDL_0270);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_MemberLookupSection )(
+ IACS * This,
+ /* [retval][out] */ ISection **__MIDL_0271);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_MetadataSection )(
+ IACS * This,
+ /* [retval][out] */ ISection **__MIDL_0272);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_StoreCoherencySection )(
+ IACS * This,
+ /* [retval][out] */ ISection **__MIDL_0273);
+
+ END_INTERFACE
+ } IACSVtbl;
+
+ interface IACS
+ {
+ CONST_VTBL struct IACSVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IACS_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IACS_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IACS_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IACS_get_Identity(This,__MIDL_0269) \
+ (This)->lpVtbl -> get_Identity(This,__MIDL_0269)
+
+#define IACS_get_ComponentsSection(This,__MIDL_0270) \
+ (This)->lpVtbl -> get_ComponentsSection(This,__MIDL_0270)
+
+#define IACS_get_MemberLookupSection(This,__MIDL_0271) \
+ (This)->lpVtbl -> get_MemberLookupSection(This,__MIDL_0271)
+
+#define IACS_get_MetadataSection(This,__MIDL_0272) \
+ (This)->lpVtbl -> get_MetadataSection(This,__MIDL_0272)
+
+#define IACS_get_StoreCoherencySection(This,__MIDL_0273) \
+ (This)->lpVtbl -> get_StoreCoherencySection(This,__MIDL_0273)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IACS_get_Identity_Proxy(
+ IACS * This,
+ /* [retval][out] */ IDefinitionAppId **__MIDL_0269);
+
+
+void __RPC_STUB IACS_get_Identity_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IACS_get_ComponentsSection_Proxy(
+ IACS * This,
+ /* [retval][out] */ ISection **__MIDL_0270);
+
+
+void __RPC_STUB IACS_get_ComponentsSection_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IACS_get_MemberLookupSection_Proxy(
+ IACS * This,
+ /* [retval][out] */ ISection **__MIDL_0271);
+
+
+void __RPC_STUB IACS_get_MemberLookupSection_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IACS_get_MetadataSection_Proxy(
+ IACS * This,
+ /* [retval][out] */ ISection **__MIDL_0272);
+
+
+void __RPC_STUB IACS_get_MetadataSection_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IACS_get_StoreCoherencySection_Proxy(
+ IACS * This,
+ /* [retval][out] */ ISection **__MIDL_0273);
+
+
+void __RPC_STUB IACS_get_StoreCoherencySection_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IACS_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_isolation_0317 */
+/* [local] */
+
+typedef struct _AppIdMetadataEntry
+ {
+ ULONG AppIdLength;
+ ULONG ComponentCount;
+ LPCWSTR SourceURL;
+ LPCWSTR LocalInstanceUniquifier;
+ } AppIdMetadataEntry;
+
+typedef
+enum _AppIdMetadataEntryFieldId
+ { AppIdMetadata_AppIdLength = 0,
+ AppIdMetadata_ComponentCount = AppIdMetadata_AppIdLength + 1,
+ AppIdMetadata_SourceURL = AppIdMetadata_ComponentCount + 1,
+ AppIdMetadata_LocalInstanceUniquifier = AppIdMetadata_SourceURL + 1
+ } AppIdMetadataEntryFieldId;
+
+
+
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0317_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0317_v0_0_s_ifspec;
+
+#ifndef __IAppIdMetadataEntry_INTERFACE_DEFINED__
+#define __IAppIdMetadataEntry_INTERFACE_DEFINED__
+
+/* interface IAppIdMetadataEntry */
+/* [uuid][unique][object][local] */
+
+
+EXTERN_C const IID IID_IAppIdMetadataEntry;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("c75f426f-cb59-4246-88ca-b4dcd969dd6e")
+ IAppIdMetadataEntry : public IUnknown
+ {
+ public:
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
+ /* [retval][out] */ AppIdMetadataEntry **__MIDL_0274) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AppIdLength(
+ /* [retval][out] */ ULONG *__MIDL_0275) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_ComponentCount(
+ /* [retval][out] */ ULONG *__MIDL_0276) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SourceURL(
+ /* [retval][out] */ LPCWSTR *__MIDL_0277) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_LocalInstanceUniquifier(
+ /* [retval][out] */ LPCWSTR *__MIDL_0278) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IAppIdMetadataEntryVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IAppIdMetadataEntry * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IAppIdMetadataEntry * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IAppIdMetadataEntry * This);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
+ IAppIdMetadataEntry * This,
+ /* [retval][out] */ AppIdMetadataEntry **__MIDL_0274);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AppIdLength )(
+ IAppIdMetadataEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0275);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_ComponentCount )(
+ IAppIdMetadataEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0276);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_SourceURL )(
+ IAppIdMetadataEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0277);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_LocalInstanceUniquifier )(
+ IAppIdMetadataEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0278);
+
+ END_INTERFACE
+ } IAppIdMetadataEntryVtbl;
+
+ interface IAppIdMetadataEntry
+ {
+ CONST_VTBL struct IAppIdMetadataEntryVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IAppIdMetadataEntry_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IAppIdMetadataEntry_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IAppIdMetadataEntry_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IAppIdMetadataEntry_get_AllData(This,__MIDL_0274) \
+ (This)->lpVtbl -> get_AllData(This,__MIDL_0274)
+
+#define IAppIdMetadataEntry_get_AppIdLength(This,__MIDL_0275) \
+ (This)->lpVtbl -> get_AppIdLength(This,__MIDL_0275)
+
+#define IAppIdMetadataEntry_get_ComponentCount(This,__MIDL_0276) \
+ (This)->lpVtbl -> get_ComponentCount(This,__MIDL_0276)
+
+#define IAppIdMetadataEntry_get_SourceURL(This,__MIDL_0277) \
+ (This)->lpVtbl -> get_SourceURL(This,__MIDL_0277)
+
+#define IAppIdMetadataEntry_get_LocalInstanceUniquifier(This,__MIDL_0278) \
+ (This)->lpVtbl -> get_LocalInstanceUniquifier(This,__MIDL_0278)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IAppIdMetadataEntry_get_AllData_Proxy(
+ IAppIdMetadataEntry * This,
+ /* [retval][out] */ AppIdMetadataEntry **__MIDL_0274);
+
+
+void __RPC_STUB IAppIdMetadataEntry_get_AllData_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IAppIdMetadataEntry_get_AppIdLength_Proxy(
+ IAppIdMetadataEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0275);
+
+
+void __RPC_STUB IAppIdMetadataEntry_get_AppIdLength_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IAppIdMetadataEntry_get_ComponentCount_Proxy(
+ IAppIdMetadataEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0276);
+
+
+void __RPC_STUB IAppIdMetadataEntry_get_ComponentCount_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IAppIdMetadataEntry_get_SourceURL_Proxy(
+ IAppIdMetadataEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0277);
+
+
+void __RPC_STUB IAppIdMetadataEntry_get_SourceURL_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IAppIdMetadataEntry_get_LocalInstanceUniquifier_Proxy(
+ IAppIdMetadataEntry * This,
+ /* [retval][out] */ LPCWSTR *__MIDL_0278);
+
+
+void __RPC_STUB IAppIdMetadataEntry_get_LocalInstanceUniquifier_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IAppIdMetadataEntry_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_isolation_0318 */
+/* [local] */
+
+typedef struct _MemberComponentEntry
+ {
+ IDefinitionIdentity *Identity;
+ GUID StoreId;
+ } MemberComponentEntry;
+
+typedef
+enum _MemberComponentEntryFieldId
+ { MemberComponent_Identity = 0,
+ MemberComponent_StoreId = MemberComponent_Identity + 1
+ } MemberComponentEntryFieldId;
+
+
+
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0318_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0318_v0_0_s_ifspec;
+
+#ifndef __IMemberComponentEntry_INTERFACE_DEFINED__
+#define __IMemberComponentEntry_INTERFACE_DEFINED__
+
+/* interface IMemberComponentEntry */
+/* [uuid][unique][object][local] */
+
+
+EXTERN_C const IID IID_IMemberComponentEntry;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("8f83f8cc-46a4-4347-8578-966a38e4221e")
+ IMemberComponentEntry : public IUnknown
+ {
+ public:
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
+ /* [retval][out] */ MemberComponentEntry **__MIDL_0279) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Identity(
+ /* [retval][out] */ IDefinitionIdentity **__MIDL_0280) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_StoreId(
+ /* [retval][out] */ GUID *__MIDL_0281) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IMemberComponentEntryVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IMemberComponentEntry * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IMemberComponentEntry * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IMemberComponentEntry * This);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
+ IMemberComponentEntry * This,
+ /* [retval][out] */ MemberComponentEntry **__MIDL_0279);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Identity )(
+ IMemberComponentEntry * This,
+ /* [retval][out] */ IDefinitionIdentity **__MIDL_0280);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_StoreId )(
+ IMemberComponentEntry * This,
+ /* [retval][out] */ GUID *__MIDL_0281);
+
+ END_INTERFACE
+ } IMemberComponentEntryVtbl;
+
+ interface IMemberComponentEntry
+ {
+ CONST_VTBL struct IMemberComponentEntryVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IMemberComponentEntry_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IMemberComponentEntry_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IMemberComponentEntry_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IMemberComponentEntry_get_AllData(This,__MIDL_0279) \
+ (This)->lpVtbl -> get_AllData(This,__MIDL_0279)
+
+#define IMemberComponentEntry_get_Identity(This,__MIDL_0280) \
+ (This)->lpVtbl -> get_Identity(This,__MIDL_0280)
+
+#define IMemberComponentEntry_get_StoreId(This,__MIDL_0281) \
+ (This)->lpVtbl -> get_StoreId(This,__MIDL_0281)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IMemberComponentEntry_get_AllData_Proxy(
+ IMemberComponentEntry * This,
+ /* [retval][out] */ MemberComponentEntry **__MIDL_0279);
+
+
+void __RPC_STUB IMemberComponentEntry_get_AllData_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IMemberComponentEntry_get_Identity_Proxy(
+ IMemberComponentEntry * This,
+ /* [retval][out] */ IDefinitionIdentity **__MIDL_0280);
+
+
+void __RPC_STUB IMemberComponentEntry_get_Identity_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IMemberComponentEntry_get_StoreId_Proxy(
+ IMemberComponentEntry * This,
+ /* [retval][out] */ GUID *__MIDL_0281);
+
+
+void __RPC_STUB IMemberComponentEntry_get_StoreId_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IMemberComponentEntry_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_isolation_0319 */
+/* [local] */
+
+typedef struct _MemberLookupEntry
+ {
+ ULONG Index;
+ } MemberLookupEntry;
+
+typedef
+enum _MemberLookupEntryFieldId
+ { MemberLookup_Index = 0
+ } MemberLookupEntryFieldId;
+
+
+
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0319_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0319_v0_0_s_ifspec;
+
+#ifndef __IMemberLookupEntry_INTERFACE_DEFINED__
+#define __IMemberLookupEntry_INTERFACE_DEFINED__
+
+/* interface IMemberLookupEntry */
+/* [uuid][unique][object][local] */
+
+
+EXTERN_C const IID IID_IMemberLookupEntry;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("6C128A08-8598-41ce-8CD0-9D58DEFFA50B")
+ IMemberLookupEntry : public IUnknown
+ {
+ public:
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
+ /* [retval][out] */ MemberLookupEntry **__MIDL_0282) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Index(
+ /* [retval][out] */ ULONG *__MIDL_0283) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IMemberLookupEntryVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IMemberLookupEntry * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IMemberLookupEntry * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IMemberLookupEntry * This);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
+ IMemberLookupEntry * This,
+ /* [retval][out] */ MemberLookupEntry **__MIDL_0282);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Index )(
+ IMemberLookupEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0283);
+
+ END_INTERFACE
+ } IMemberLookupEntryVtbl;
+
+ interface IMemberLookupEntry
+ {
+ CONST_VTBL struct IMemberLookupEntryVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IMemberLookupEntry_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IMemberLookupEntry_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IMemberLookupEntry_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IMemberLookupEntry_get_AllData(This,__MIDL_0282) \
+ (This)->lpVtbl -> get_AllData(This,__MIDL_0282)
+
+#define IMemberLookupEntry_get_Index(This,__MIDL_0283) \
+ (This)->lpVtbl -> get_Index(This,__MIDL_0283)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IMemberLookupEntry_get_AllData_Proxy(
+ IMemberLookupEntry * This,
+ /* [retval][out] */ MemberLookupEntry **__MIDL_0282);
+
+
+void __RPC_STUB IMemberLookupEntry_get_AllData_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IMemberLookupEntry_get_Index_Proxy(
+ IMemberLookupEntry * This,
+ /* [retval][out] */ ULONG *__MIDL_0283);
+
+
+void __RPC_STUB IMemberLookupEntry_get_Index_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IMemberLookupEntry_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_isolation_0320 */
+/* [local] */
+
+typedef struct _StoreCoherencyEntry
+ {
+ ULONGLONG CoherencyId;
+ } StoreCoherencyEntry;
+
+typedef
+enum _StoreCoherencyEntryFieldId
+ { StoreCoherency_CoherencyId = 0
+ } StoreCoherencyEntryFieldId;
+
+
+
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0320_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0320_v0_0_s_ifspec;
+
+#ifndef __IStoreCoherencyEntry_INTERFACE_DEFINED__
+#define __IStoreCoherencyEntry_INTERFACE_DEFINED__
+
+/* interface IStoreCoherencyEntry */
+/* [uuid][unique][object][local] */
+
+
+EXTERN_C const IID IID_IStoreCoherencyEntry;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("87E02E32-9979-4023-A135-FA033E84B037")
+ IStoreCoherencyEntry : public IUnknown
+ {
+ public:
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AllData(
+ /* [retval][out] */ StoreCoherencyEntry **__MIDL_0284) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_CoherencyId(
+ /* [retval][out] */ ULONGLONG *__MIDL_0285) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IStoreCoherencyEntryVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IStoreCoherencyEntry * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IStoreCoherencyEntry * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IStoreCoherencyEntry * This);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AllData )(
+ IStoreCoherencyEntry * This,
+ /* [retval][out] */ StoreCoherencyEntry **__MIDL_0284);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_CoherencyId )(
+ IStoreCoherencyEntry * This,
+ /* [retval][out] */ ULONGLONG *__MIDL_0285);
+
+ END_INTERFACE
+ } IStoreCoherencyEntryVtbl;
+
+ interface IStoreCoherencyEntry
+ {
+ CONST_VTBL struct IStoreCoherencyEntryVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IStoreCoherencyEntry_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IStoreCoherencyEntry_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IStoreCoherencyEntry_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IStoreCoherencyEntry_get_AllData(This,__MIDL_0284) \
+ (This)->lpVtbl -> get_AllData(This,__MIDL_0284)
+
+#define IStoreCoherencyEntry_get_CoherencyId(This,__MIDL_0285) \
+ (This)->lpVtbl -> get_CoherencyId(This,__MIDL_0285)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IStoreCoherencyEntry_get_AllData_Proxy(
+ IStoreCoherencyEntry * This,
+ /* [retval][out] */ StoreCoherencyEntry **__MIDL_0284);
+
+
+void __RPC_STUB IStoreCoherencyEntry_get_AllData_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IStoreCoherencyEntry_get_CoherencyId_Proxy(
+ IStoreCoherencyEntry * This,
+ /* [retval][out] */ ULONGLONG *__MIDL_0285);
+
+
+void __RPC_STUB IStoreCoherencyEntry_get_CoherencyId_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IStoreCoherencyEntry_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_isolation_0321 */
+/* [local] */
+
+HRESULT FreeAppIdMetadataEntry(
+ /* [in] */ AppIdMetadataEntry *__MIDL_0286);
+
+HRESULT FreeMemberComponentEntry(
+ /* [in] */ MemberComponentEntry *__MIDL_0287);
+
+HRESULT FreeMemberLookupEntry(
+ /* [in] */ MemberLookupEntry *__MIDL_0288);
+
+HRESULT FreeStoreCoherencyEntry(
+ /* [in] */ StoreCoherencyEntry *__MIDL_0289);
+
+typedef struct _IDENTITY_ATTRIBUTE
+ {
+ LPCWSTR pszNamespace;
+ LPCWSTR pszName;
+ LPCWSTR pszValue;
+ } IDENTITY_ATTRIBUTE;
+
+typedef struct _IDENTITY_ATTRIBUTE *PIDENTITY_ATTRIBUTE;
+
+typedef const IDENTITY_ATTRIBUTE *PCIDENTITY_ATTRIBUTE;
+
+/* [v1_enum] */
+enum _STORE_ASSEMBLY_STATUS_FLAGS
+ { STORE_ASSEMBLY_STATUS_MANIFEST_ONLY = 0x1,
+ STORE_ASSEMBLY_STATUS_PAYLOAD_RESIDENT = 0x2,
+ STORE_ASSEMBLY_STATUS_PARTIAL_INSTALL = 0x4
+ } ;
+typedef struct _STORE_ASSEMBLY
+ {
+ DWORD dwStatus;
+ IDefinitionIdentity *pIDefinitionIdentity;
+ LPCWSTR pszManifestPath;
+ ULONGLONG ullAssemblySize;
+ ULONGLONG ullChangeId;
+ } STORE_ASSEMBLY;
+
+typedef struct _STORE_ASSEMBLY *PSTORE_ASSEMBLY;
+
+typedef const STORE_ASSEMBLY *PCSTORE_ASSEMBLY;
+
+/* [v1_enum] */
+enum _STORE_ASSEMBLY_FILE_STATUS_FLAGS
+ { STORE_ASSEMBLY_FILE_STATUS_FLAG_PRESENT = 0x1
+ } ;
+typedef struct _STORE_ASSEMBLY_FILE
+ {
+ DWORD cbSize;
+ DWORD dwFlags;
+ LPCWSTR pszFileName;
+ DWORD dwFileStatusFlags;
+ } STORE_ASSEMBLY_FILE;
+
+typedef struct _STORE_ASSEMBLY_FILE *PSTORE_ASSEMBLY_FILE;
+
+typedef const STORE_ASSEMBLY_FILE *PCSTORE_ASSEMBLY_FILE;
+
+typedef struct _STORE_ASSEMBLY_INSTALLATION_REFERENCE
+ {
+ DWORD cbSize;
+ DWORD dwFlags;
+ GUID guidScheme;
+ LPCWSTR pszIdentifier;
+ LPCWSTR pszNonCanonicalData;
+ } STORE_ASSEMBLY_INSTALLATION_REFERENCE;
+
+typedef struct _STORE_ASSEMBLY_INSTALLATION_REFERENCE *PSTORE_ASSEMBLY_INSTALLATION_REFERENCE;
+
+typedef const STORE_ASSEMBLY_INSTALLATION_REFERENCE *PCSTORE_ASSEMBLY_INSTALLATION_REFERENCE;
+
+typedef struct _STORE_CATEGORY
+ {
+ IDefinitionIdentity *pIDefinitionIdentity;
+ } STORE_CATEGORY;
+
+typedef struct _STORE_CATEGORY *PSTORE_CATEGORY;
+
+typedef const STORE_CATEGORY *PCSTORE_CATEGORY;
+
+typedef struct _STORE_CATEGORY_SUBCATEGORY
+ {
+ LPCWSTR pszSubcategory;
+ } STORE_CATEGORY_SUBCATEGORY;
+
+typedef struct _STORE_CATEGORY_SUBCATEGORY *PSTORE_CATEGORY_SUBCATEGORY;
+
+typedef const STORE_CATEGORY_SUBCATEGORY *PCSTORE_CATEGORY_SUBCATEGORY;
+
+typedef struct _STORE_CATEGORY_INSTANCE
+ {
+ IDefinitionAppId *pIDefinitionAppId_Application;
+ LPCWSTR pszXMLSnippet;
+ } STORE_CATEGORY_INSTANCE;
+
+typedef struct _STORE_CATEGORY_INSTANCE *PSTORE_CATEGORY_INSTANCE;
+
+typedef const STORE_CATEGORY_INSTANCE *PCSTORE_CATEGORY_INSTANCE;
+
+typedef struct _CATEGORY
+ {
+ IDefinitionIdentity *pIDefinitionIdentity;
+ } CATEGORY;
+
+typedef struct _CATEGORY *PCATEGORY;
+
+typedef const CATEGORY *PCCATEGORY;
+
+typedef struct _CATEGORY_SUBCATEGORY
+ {
+ LPCWSTR pszSubcategory;
+ } CATEGORY_SUBCATEGORY;
+
+typedef struct _CATEGORY_SUBCATEGORY *PCATEGORY_SUBCATEGORY;
+
+typedef const CATEGORY_SUBCATEGORY *PCCATEGORY_SUBCATEGORY;
+
+typedef struct _CATEGORY_INSTANCE
+ {
+ IDefinitionAppId *pIDefinitionAppId_Application;
+ LPCWSTR pszXMLSnippet;
+ } CATEGORY_INSTANCE;
+
+typedef struct _CATEGORY_INSTANCE *PCATEGORY_INSTANCE;
+
+typedef const CATEGORY_INSTANCE *PCCATEGORY_INSTANCE;
+
+typedef struct _CREATE_APP_CONTEXT_DATA_PROCESSOR_ARCHITECTURE_FALLBACK_LIST
+ {
+ DWORD dwSize;
+ DWORD dwFlags;
+ ULONG nProcessorArchitectures;
+ /* [size_is] */ const USHORT *prgusProcessorArchitectures;
+ } CREATE_APP_CONTEXT_DATA_PROCESSOR_ARCHITECTURE_FALLBACK_LIST;
+
+typedef struct _CREATE_APP_CONTEXT_DATA_PROCESSOR_ARCHITECTURE_FALLBACK_LIST *PCREATE_APP_CONTEXT_DATA_PROCESSOR_ARCHITECTURE_FALLBACK_LIST;
+
+typedef const CREATE_APP_CONTEXT_DATA_PROCESSOR_ARCHITECTURE_FALLBACK_LIST *PCCREATE_APP_CONTEXT_DATA_PROCESSOR_ARCHITECTURE_FALLBACK_LIST;
+
+typedef /* [v1_enum] */
+enum _CREATE_APP_CONTEXT_DATA_CUSTOM_STORE_TYPE
+ { CREATE_APP_CONTEXT_DATA_CUSTOM_STORE_TYPE_INVALID = 0,
+ CREATE_APP_CONTEXT_DATA_CUSTOM_STORE_TYPE_SYSTEM_STORE = 1,
+ CREATE_APP_CONTEXT_DATA_CUSTOM_STORE_TYPE_USER_STORE = 2,
+ CREATE_APP_CONTEXT_DATA_CUSTOM_STORE_TYPE_PRIVATE_STORE = 3
+ } CREATE_APP_CONTEXT_DATA_CUSTOM_STORE_TYPE;
+
+typedef /* [v1_enum] */ enum _CREATE_APP_CONTEXT_DATA_CUSTOM_STORE_TYPE *PCREATE_APP_CONTEXT_DATA_CUSTOM_STORE_TYPE;
+
+typedef const CREATE_APP_CONTEXT_DATA_CUSTOM_STORE_TYPE *PCCREATE_APP_CONTEXT_DATA_CUSTOM_STORE_TYPE;
+
+typedef struct _CREATE_APP_CONTEXT_DATA_CUSTOM_STORE
+ {
+ DWORD dwSize;
+ DWORD dwFlags;
+ CREATE_APP_CONTEXT_DATA_CUSTOM_STORE_TYPE iType;
+ IStore *pIStore;
+ PVOID pvReservedMustBeZero;
+ } CREATE_APP_CONTEXT_DATA_CUSTOM_STORE;
+
+typedef struct _CREATE_APP_CONTEXT_DATA_CUSTOM_STORE *PCREATE_APP_CONTEXT_DATA_CUSTOM_STORE;
+
+typedef const CREATE_APP_CONTEXT_DATA_CUSTOM_STORE *PCCREATE_APP_CONTEXT_DATA_CUSTOM_STORE;
+
+typedef struct _CREATE_APP_CONTEXT_DATA_CUSTOM_STORE_LIST
+ {
+ DWORD dwSize;
+ DWORD dwFlags;
+ ULONG Count;
+ /* [size_is] */ const PCCREATE_APP_CONTEXT_DATA_CUSTOM_STORE *prgpStores;
+ } CREATE_APP_CONTEXT_DATA_CUSTOM_STORE_LIST;
+
+typedef struct _CREATE_APP_CONTEXT_DATA_CUSTOM_STORE_LIST *PCREATE_APP_CONTEXT_DATA_CUSTOM_STORE_LIST;
+
+typedef const CREATE_APP_CONTEXT_DATA_CUSTOM_STORE_LIST *PCCREATE_APP_CONTEXT_DATA_CUSTOM_STORE_LIST;
+
+typedef /* [v1_enum] */
+enum _CREATE_APP_CONTEXT_DATA_SOURCE_TYPES
+ { CREATE_APP_CONTEXT_DATA_SOURCE_TYPE_APP_DEFINITION = 1,
+ CREATE_APP_CONTEXT_DATA_SOURCE_TYPE_APP_REFERENCE = 2
+ } CREATE_APP_CONTEXT_DATA_SOURCE_TYPES;
+
+typedef /* [v1_enum] */ enum _CREATE_APP_CONTEXT_DATA_SOURCE_TYPES *PCREATE_APP_CONTEXT_DATA_SOURCE_TYPES;
+
+typedef const CREATE_APP_CONTEXT_DATA_SOURCE_TYPES *PCCREATE_APP_CONTEXT_DATA_SOURCE_TYPES;
+
+typedef struct _CREATE_APP_CONTEXT_DATA_SOURCE_APP_DEFINITION
+ {
+ DWORD dwSize;
+ DWORD dwFlags;
+ IDefinitionAppId *pIDefinitionAppId;
+ } CREATE_APP_CONTEXT_DATA_SOURCE_APP_DEFINITION;
+
+typedef struct _CREATE_APP_CONTEXT_DATA_SOURCE_APP_DEFINITION *PCREATE_APP_CONTEXT_DATA_SOURCE_APP_DEFINITION;
+
+typedef const CREATE_APP_CONTEXT_DATA_SOURCE_APP_DEFINITION *PCCREATE_APP_CONTEXT_DATA_SOURCE_APP_DEFINITION;
+
+typedef struct _CREATE_APP_CONTEXT_DATA_SOURCE_APP_REFERENCE
+ {
+ DWORD dwSize;
+ DWORD dwFlags;
+ IReferenceAppId *pIReferenceAppId;
+ } CREATE_APP_CONTEXT_DATA_SOURCE_APP_REFERENCE;
+
+typedef struct _CREATE_APP_CONTEXT_DATA_SOURCE_APP_REFERENCE *PCREATE_APP_CONTEXT_DATA_SOURCE_APP_REFERENCE;
+
+typedef const CREATE_APP_CONTEXT_DATA_SOURCE_APP_REFERENCE *PCCREATE_APP_CONTEXT_DATA_SOURCE_APP_REFERENCE;
+
+typedef /* [switch_type] */ union _CREATE_APP_CONTEXT_DATA_SOURCE_UNION
+ {
+ /* [case()] */ PCCREATE_APP_CONTEXT_DATA_SOURCE_APP_DEFINITION AppDefinition;
+ /* [case()] */ PCCREATE_APP_CONTEXT_DATA_SOURCE_APP_REFERENCE AppReference;
+ } CREATE_APP_CONTEXT_DATA_SOURCE_UNION;
+
+typedef /* [switch_type] */ union _CREATE_APP_CONTEXT_DATA_SOURCE_UNION *PCREATE_APP_CONTEXT_DATA_SOURCE_UNION;
+
+typedef const CREATE_APP_CONTEXT_DATA_SOURCE_UNION *PCCREATE_APP_CONTEXT_DATA_SOURCE_UNION;
+
+typedef struct _CREATE_APP_CONTEXT_DATA_SOURCE
+ {
+ DWORD dwSize;
+ DWORD dwFlags;
+ CREATE_APP_CONTEXT_DATA_SOURCE_TYPES iSourceType;
+ /* [switch_is] */ CREATE_APP_CONTEXT_DATA_SOURCE_UNION Data;
+ } CREATE_APP_CONTEXT_DATA_SOURCE;
+
+typedef struct _CREATE_APP_CONTEXT_DATA_SOURCE *PCREATE_APP_CONTEXT_DATA_SOURCE;
+
+typedef const CREATE_APP_CONTEXT_DATA_SOURCE *PCCREATE_APP_CONTEXT_DATA_SOURCE;
+
+/* [v1_enum] */
+enum _CREATE_APP_CONTEXT_DATA_FLAGS
+ { CREATE_APP_CONTEXT_DATA_FLAG_CUSTOM_STORE_LIST_VALID = 0x1,
+ CREATE_APP_CONTEXT_DATA_FLAG_CULTURE_FALLBACK_LIST_VALID = 0x2,
+ CREATE_APP_CONTEXT_DATA_FLAG_PROCESSOR_ARCHITECTURE_FALLBACK_LIST_VALID = 0x4,
+ CREATE_APP_CONTEXT_DATA_FLAG_PROCESSOR_ARCHITECTURE_VALID = 0x8,
+ CREATE_APP_CONTEXT_DATA_FLAG_SOURCE_VALID = 0x10,
+ CREATE_APP_CONTEXT_DATA_FLAG_IGNORE_VISIBILITY_FLAGS = 0x100000
+ } ;
+typedef struct _CREATE_APP_CONTEXT_DATA
+ {
+ DWORD dwSize;
+ DWORD dwFlags;
+ PCCREATE_APP_CONTEXT_DATA_CUSTOM_STORE_LIST pCustomStoreList;
+ PCCULTURE_FALLBACK_LIST pCultureFallbackList;
+ PCCREATE_APP_CONTEXT_DATA_PROCESSOR_ARCHITECTURE_FALLBACK_LIST pProcessorArchitectureFallbackList;
+ PCCREATE_APP_CONTEXT_DATA_SOURCE pSource;
+ USHORT usProcessorArchitecture;
+ } CREATE_APP_CONTEXT_DATA;
+
+typedef struct _CREATE_APP_CONTEXT_DATA *PCREATE_APP_CONTEXT_DATA;
+
+typedef const CREATE_APP_CONTEXT_DATA *PCCREATE_APP_CONTEXT_DATA;
+
+
+
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0321_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0321_v0_0_s_ifspec;
+
+#ifndef __IReferenceIdentity_INTERFACE_DEFINED__
+#define __IReferenceIdentity_INTERFACE_DEFINED__
+
+/* interface IReferenceIdentity */
+/* [local][unique][uuid][object] */
+
+
+EXTERN_C const IID IID_IReferenceIdentity;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("6eaf5ace-7917-4f3c-b129-e046a9704766")
+ IReferenceIdentity : public IUnknown
+ {
+ public:
+ virtual HRESULT STDMETHODCALLTYPE GetAttribute(
+ /* [unique][in] */ LPCWSTR pszNamespace,
+ /* [in] */ LPCWSTR pszName,
+ /* [retval][out] */ LPWSTR *ppszValue) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE SetAttribute(
+ /* [unique][in] */ LPCWSTR pszNamespace,
+ /* [in] */ LPCWSTR pszName,
+ /* [unique][in] */ LPCWSTR pszValue) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE EnumAttributes(
+ /* [retval][out] */ IEnumIDENTITY_ATTRIBUTE **ppIEnumIDENTITY_ATTRIBUTE) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Clone(
+ /* [in] */ SIZE_T cDeltas,
+ /* [size_is][in] */ const IDENTITY_ATTRIBUTE rgDeltas[ ],
+ /* [retval][out] */ IReferenceIdentity **ppIReferenceIdentity) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IReferenceIdentityVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IReferenceIdentity * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IReferenceIdentity * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IReferenceIdentity * This);
+
+ HRESULT ( STDMETHODCALLTYPE *GetAttribute )(
+ IReferenceIdentity * This,
+ /* [unique][in] */ LPCWSTR pszNamespace,
+ /* [in] */ LPCWSTR pszName,
+ /* [retval][out] */ LPWSTR *ppszValue);
+
+ HRESULT ( STDMETHODCALLTYPE *SetAttribute )(
+ IReferenceIdentity * This,
+ /* [unique][in] */ LPCWSTR pszNamespace,
+ /* [in] */ LPCWSTR pszName,
+ /* [unique][in] */ LPCWSTR pszValue);
+
+ HRESULT ( STDMETHODCALLTYPE *EnumAttributes )(
+ IReferenceIdentity * This,
+ /* [retval][out] */ IEnumIDENTITY_ATTRIBUTE **ppIEnumIDENTITY_ATTRIBUTE);
+
+ HRESULT ( STDMETHODCALLTYPE *Clone )(
+ IReferenceIdentity * This,
+ /* [in] */ SIZE_T cDeltas,
+ /* [size_is][in] */ const IDENTITY_ATTRIBUTE rgDeltas[ ],
+ /* [retval][out] */ IReferenceIdentity **ppIReferenceIdentity);
+
+ END_INTERFACE
+ } IReferenceIdentityVtbl;
+
+ interface IReferenceIdentity
+ {
+ CONST_VTBL struct IReferenceIdentityVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IReferenceIdentity_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IReferenceIdentity_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IReferenceIdentity_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IReferenceIdentity_GetAttribute(This,pszNamespace,pszName,ppszValue) \
+ (This)->lpVtbl -> GetAttribute(This,pszNamespace,pszName,ppszValue)
+
+#define IReferenceIdentity_SetAttribute(This,pszNamespace,pszName,pszValue) \
+ (This)->lpVtbl -> SetAttribute(This,pszNamespace,pszName,pszValue)
+
+#define IReferenceIdentity_EnumAttributes(This,ppIEnumIDENTITY_ATTRIBUTE) \
+ (This)->lpVtbl -> EnumAttributes(This,ppIEnumIDENTITY_ATTRIBUTE)
+
+#define IReferenceIdentity_Clone(This,cDeltas,rgDeltas,ppIReferenceIdentity) \
+ (This)->lpVtbl -> Clone(This,cDeltas,rgDeltas,ppIReferenceIdentity)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+HRESULT STDMETHODCALLTYPE IReferenceIdentity_GetAttribute_Proxy(
+ IReferenceIdentity * This,
+ /* [unique][in] */ LPCWSTR pszNamespace,
+ /* [in] */ LPCWSTR pszName,
+ /* [retval][out] */ LPWSTR *ppszValue);
+
+
+void __RPC_STUB IReferenceIdentity_GetAttribute_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IReferenceIdentity_SetAttribute_Proxy(
+ IReferenceIdentity * This,
+ /* [unique][in] */ LPCWSTR pszNamespace,
+ /* [in] */ LPCWSTR pszName,
+ /* [unique][in] */ LPCWSTR pszValue);
+
+
+void __RPC_STUB IReferenceIdentity_SetAttribute_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IReferenceIdentity_EnumAttributes_Proxy(
+ IReferenceIdentity * This,
+ /* [retval][out] */ IEnumIDENTITY_ATTRIBUTE **ppIEnumIDENTITY_ATTRIBUTE);
+
+
+void __RPC_STUB IReferenceIdentity_EnumAttributes_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IReferenceIdentity_Clone_Proxy(
+ IReferenceIdentity * This,
+ /* [in] */ SIZE_T cDeltas,
+ /* [size_is][in] */ const IDENTITY_ATTRIBUTE rgDeltas[ ],
+ /* [retval][out] */ IReferenceIdentity **ppIReferenceIdentity);
+
+
+void __RPC_STUB IReferenceIdentity_Clone_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IReferenceIdentity_INTERFACE_DEFINED__ */
+
+
+#ifndef __IDefinitionIdentity_INTERFACE_DEFINED__
+#define __IDefinitionIdentity_INTERFACE_DEFINED__
+
+/* interface IDefinitionIdentity */
+/* [local][unique][uuid][object] */
+
+
+EXTERN_C const IID IID_IDefinitionIdentity;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("587bf538-4d90-4a3c-9ef1-58a200a8a9e7")
+ IDefinitionIdentity : public IUnknown
+ {
+ public:
+ virtual HRESULT STDMETHODCALLTYPE GetAttribute(
+ /* [unique][in] */ LPCWSTR pszNamespace,
+ /* [in] */ LPCWSTR pszName,
+ /* [retval][out] */ LPWSTR *ppszValue) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE SetAttribute(
+ /* [unique][in] */ LPCWSTR pszNamespace,
+ /* [in] */ LPCWSTR pszName,
+ /* [unique][in] */ LPCWSTR pszValue) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE EnumAttributes(
+ /* [retval][out] */ IEnumIDENTITY_ATTRIBUTE **ppIEAIA) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Clone(
+ /* [in] */ SIZE_T cDeltas,
+ /* [size_is][in] */ const IDENTITY_ATTRIBUTE prgDeltas[ ],
+ /* [retval][out] */ IDefinitionIdentity **ppIDefinitionIdentity) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IDefinitionIdentityVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IDefinitionIdentity * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IDefinitionIdentity * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IDefinitionIdentity * This);
+
+ HRESULT ( STDMETHODCALLTYPE *GetAttribute )(
+ IDefinitionIdentity * This,
+ /* [unique][in] */ LPCWSTR pszNamespace,
+ /* [in] */ LPCWSTR pszName,
+ /* [retval][out] */ LPWSTR *ppszValue);
+
+ HRESULT ( STDMETHODCALLTYPE *SetAttribute )(
+ IDefinitionIdentity * This,
+ /* [unique][in] */ LPCWSTR pszNamespace,
+ /* [in] */ LPCWSTR pszName,
+ /* [unique][in] */ LPCWSTR pszValue);
+
+ HRESULT ( STDMETHODCALLTYPE *EnumAttributes )(
+ IDefinitionIdentity * This,
+ /* [retval][out] */ IEnumIDENTITY_ATTRIBUTE **ppIEAIA);
+
+ HRESULT ( STDMETHODCALLTYPE *Clone )(
+ IDefinitionIdentity * This,
+ /* [in] */ SIZE_T cDeltas,
+ /* [size_is][in] */ const IDENTITY_ATTRIBUTE prgDeltas[ ],
+ /* [retval][out] */ IDefinitionIdentity **ppIDefinitionIdentity);
+
+ END_INTERFACE
+ } IDefinitionIdentityVtbl;
+
+ interface IDefinitionIdentity
+ {
+ CONST_VTBL struct IDefinitionIdentityVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IDefinitionIdentity_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IDefinitionIdentity_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IDefinitionIdentity_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IDefinitionIdentity_GetAttribute(This,pszNamespace,pszName,ppszValue) \
+ (This)->lpVtbl -> GetAttribute(This,pszNamespace,pszName,ppszValue)
+
+#define IDefinitionIdentity_SetAttribute(This,pszNamespace,pszName,pszValue) \
+ (This)->lpVtbl -> SetAttribute(This,pszNamespace,pszName,pszValue)
+
+#define IDefinitionIdentity_EnumAttributes(This,ppIEAIA) \
+ (This)->lpVtbl -> EnumAttributes(This,ppIEAIA)
+
+#define IDefinitionIdentity_Clone(This,cDeltas,prgDeltas,ppIDefinitionIdentity) \
+ (This)->lpVtbl -> Clone(This,cDeltas,prgDeltas,ppIDefinitionIdentity)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+HRESULT STDMETHODCALLTYPE IDefinitionIdentity_GetAttribute_Proxy(
+ IDefinitionIdentity * This,
+ /* [unique][in] */ LPCWSTR pszNamespace,
+ /* [in] */ LPCWSTR pszName,
+ /* [retval][out] */ LPWSTR *ppszValue);
+
+
+void __RPC_STUB IDefinitionIdentity_GetAttribute_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IDefinitionIdentity_SetAttribute_Proxy(
+ IDefinitionIdentity * This,
+ /* [unique][in] */ LPCWSTR pszNamespace,
+ /* [in] */ LPCWSTR pszName,
+ /* [unique][in] */ LPCWSTR pszValue);
+
+
+void __RPC_STUB IDefinitionIdentity_SetAttribute_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IDefinitionIdentity_EnumAttributes_Proxy(
+ IDefinitionIdentity * This,
+ /* [retval][out] */ IEnumIDENTITY_ATTRIBUTE **ppIEAIA);
+
+
+void __RPC_STUB IDefinitionIdentity_EnumAttributes_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IDefinitionIdentity_Clone_Proxy(
+ IDefinitionIdentity * This,
+ /* [in] */ SIZE_T cDeltas,
+ /* [size_is][in] */ const IDENTITY_ATTRIBUTE prgDeltas[ ],
+ /* [retval][out] */ IDefinitionIdentity **ppIDefinitionIdentity);
+
+
+void __RPC_STUB IDefinitionIdentity_Clone_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IDefinitionIdentity_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_isolation_0323 */
+/* [local] */
+
+typedef struct _IDENTITY_ATTRIBUTE_BLOB
+ {
+ DWORD ofsNamespace;
+ DWORD ofsName;
+ DWORD ofsValue;
+ } IDENTITY_ATTRIBUTE_BLOB;
+
+typedef struct _IDENTITY_ATTRIBUTE_BLOB *PIDENTITY_ATTRIBUTE_BLOB;
+
+
+
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0323_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0323_v0_0_s_ifspec;
+
+#ifndef __IEnumIDENTITY_ATTRIBUTE_INTERFACE_DEFINED__
+#define __IEnumIDENTITY_ATTRIBUTE_INTERFACE_DEFINED__
+
+/* interface IEnumIDENTITY_ATTRIBUTE */
+/* [local][unique][uuid][object] */
+
+
+EXTERN_C const IID IID_IEnumIDENTITY_ATTRIBUTE;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("9cdaae75-246e-4b00-a26d-b9aec137a3eb")
+ IEnumIDENTITY_ATTRIBUTE : public IUnknown
+ {
+ public:
+ virtual HRESULT STDMETHODCALLTYPE Next(
+ /* [in] */ ULONG celt,
+ /* [length_is][size_is][out] */ IDENTITY_ATTRIBUTE rgAttributes[ ],
+ /* [optional][out] */ ULONG *pceltWritten) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE CurrentIntoBuffer(
+ /* [in] */ SIZE_T cbAvailable,
+ /* [length_is][size_is][out][in] */ BYTE pbData[ ],
+ /* [out] */ SIZE_T *pcbUsed) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Skip(
+ /* [in] */ ULONG celt) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Reset( void) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Clone(
+ /* [out] */ IEnumIDENTITY_ATTRIBUTE **ppIEnumIDENTITY_ATTRIBUTE) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IEnumIDENTITY_ATTRIBUTEVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IEnumIDENTITY_ATTRIBUTE * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IEnumIDENTITY_ATTRIBUTE * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IEnumIDENTITY_ATTRIBUTE * This);
+
+ HRESULT ( STDMETHODCALLTYPE *Next )(
+ IEnumIDENTITY_ATTRIBUTE * This,
+ /* [in] */ ULONG celt,
+ /* [length_is][size_is][out] */ IDENTITY_ATTRIBUTE rgAttributes[ ],
+ /* [optional][out] */ ULONG *pceltWritten);
+
+ HRESULT ( STDMETHODCALLTYPE *CurrentIntoBuffer )(
+ IEnumIDENTITY_ATTRIBUTE * This,
+ /* [in] */ SIZE_T cbAvailable,
+ /* [length_is][size_is][out][in] */ BYTE pbData[ ],
+ /* [out] */ SIZE_T *pcbUsed);
+
+ HRESULT ( STDMETHODCALLTYPE *Skip )(
+ IEnumIDENTITY_ATTRIBUTE * This,
+ /* [in] */ ULONG celt);
+
+ HRESULT ( STDMETHODCALLTYPE *Reset )(
+ IEnumIDENTITY_ATTRIBUTE * This);
+
+ HRESULT ( STDMETHODCALLTYPE *Clone )(
+ IEnumIDENTITY_ATTRIBUTE * This,
+ /* [out] */ IEnumIDENTITY_ATTRIBUTE **ppIEnumIDENTITY_ATTRIBUTE);
+
+ END_INTERFACE
+ } IEnumIDENTITY_ATTRIBUTEVtbl;
+
+ interface IEnumIDENTITY_ATTRIBUTE
+ {
+ CONST_VTBL struct IEnumIDENTITY_ATTRIBUTEVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IEnumIDENTITY_ATTRIBUTE_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IEnumIDENTITY_ATTRIBUTE_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IEnumIDENTITY_ATTRIBUTE_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IEnumIDENTITY_ATTRIBUTE_Next(This,celt,rgAttributes,pceltWritten) \
+ (This)->lpVtbl -> Next(This,celt,rgAttributes,pceltWritten)
+
+#define IEnumIDENTITY_ATTRIBUTE_CurrentIntoBuffer(This,cbAvailable,pbData,pcbUsed) \
+ (This)->lpVtbl -> CurrentIntoBuffer(This,cbAvailable,pbData,pcbUsed)
+
+#define IEnumIDENTITY_ATTRIBUTE_Skip(This,celt) \
+ (This)->lpVtbl -> Skip(This,celt)
+
+#define IEnumIDENTITY_ATTRIBUTE_Reset(This) \
+ (This)->lpVtbl -> Reset(This)
+
+#define IEnumIDENTITY_ATTRIBUTE_Clone(This,ppIEnumIDENTITY_ATTRIBUTE) \
+ (This)->lpVtbl -> Clone(This,ppIEnumIDENTITY_ATTRIBUTE)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+HRESULT STDMETHODCALLTYPE IEnumIDENTITY_ATTRIBUTE_Next_Proxy(
+ IEnumIDENTITY_ATTRIBUTE * This,
+ /* [in] */ ULONG celt,
+ /* [length_is][size_is][out] */ IDENTITY_ATTRIBUTE rgAttributes[ ],
+ /* [optional][out] */ ULONG *pceltWritten);
+
+
+void __RPC_STUB IEnumIDENTITY_ATTRIBUTE_Next_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IEnumIDENTITY_ATTRIBUTE_CurrentIntoBuffer_Proxy(
+ IEnumIDENTITY_ATTRIBUTE * This,
+ /* [in] */ SIZE_T cbAvailable,
+ /* [length_is][size_is][out][in] */ BYTE pbData[ ],
+ /* [out] */ SIZE_T *pcbUsed);
+
+
+void __RPC_STUB IEnumIDENTITY_ATTRIBUTE_CurrentIntoBuffer_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IEnumIDENTITY_ATTRIBUTE_Skip_Proxy(
+ IEnumIDENTITY_ATTRIBUTE * This,
+ /* [in] */ ULONG celt);
+
+
+void __RPC_STUB IEnumIDENTITY_ATTRIBUTE_Skip_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IEnumIDENTITY_ATTRIBUTE_Reset_Proxy(
+ IEnumIDENTITY_ATTRIBUTE * This);
+
+
+void __RPC_STUB IEnumIDENTITY_ATTRIBUTE_Reset_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IEnumIDENTITY_ATTRIBUTE_Clone_Proxy(
+ IEnumIDENTITY_ATTRIBUTE * This,
+ /* [out] */ IEnumIDENTITY_ATTRIBUTE **ppIEnumIDENTITY_ATTRIBUTE);
+
+
+void __RPC_STUB IEnumIDENTITY_ATTRIBUTE_Clone_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IEnumIDENTITY_ATTRIBUTE_INTERFACE_DEFINED__ */
+
+
+#ifndef __IEnumDefinitionIdentity_INTERFACE_DEFINED__
+#define __IEnumDefinitionIdentity_INTERFACE_DEFINED__
+
+/* interface IEnumDefinitionIdentity */
+/* [local][unique][uuid][object] */
+
+
+EXTERN_C const IID IID_IEnumDefinitionIdentity;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("f3549d9c-fc73-4793-9c00-1cd204254c0c")
+ IEnumDefinitionIdentity : public IUnknown
+ {
+ public:
+ virtual HRESULT STDMETHODCALLTYPE Next(
+ /* [in] */ ULONG celt,
+ /* [length_is][size_is][out] */ IDefinitionIdentity *rgpIDefinitionIdentity[ ],
+ /* [out] */ ULONG *pceltWritten) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Skip(
+ /* [in] */ ULONG celt) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Reset( void) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Clone(
+ /* [out] */ IEnumDefinitionIdentity **ppIEnumDefinitionIdentity) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IEnumDefinitionIdentityVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IEnumDefinitionIdentity * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IEnumDefinitionIdentity * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IEnumDefinitionIdentity * This);
+
+ HRESULT ( STDMETHODCALLTYPE *Next )(
+ IEnumDefinitionIdentity * This,
+ /* [in] */ ULONG celt,
+ /* [length_is][size_is][out] */ IDefinitionIdentity *rgpIDefinitionIdentity[ ],
+ /* [out] */ ULONG *pceltWritten);
+
+ HRESULT ( STDMETHODCALLTYPE *Skip )(
+ IEnumDefinitionIdentity * This,
+ /* [in] */ ULONG celt);
+
+ HRESULT ( STDMETHODCALLTYPE *Reset )(
+ IEnumDefinitionIdentity * This);
+
+ HRESULT ( STDMETHODCALLTYPE *Clone )(
+ IEnumDefinitionIdentity * This,
+ /* [out] */ IEnumDefinitionIdentity **ppIEnumDefinitionIdentity);
+
+ END_INTERFACE
+ } IEnumDefinitionIdentityVtbl;
+
+ interface IEnumDefinitionIdentity
+ {
+ CONST_VTBL struct IEnumDefinitionIdentityVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IEnumDefinitionIdentity_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IEnumDefinitionIdentity_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IEnumDefinitionIdentity_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IEnumDefinitionIdentity_Next(This,celt,rgpIDefinitionIdentity,pceltWritten) \
+ (This)->lpVtbl -> Next(This,celt,rgpIDefinitionIdentity,pceltWritten)
+
+#define IEnumDefinitionIdentity_Skip(This,celt) \
+ (This)->lpVtbl -> Skip(This,celt)
+
+#define IEnumDefinitionIdentity_Reset(This) \
+ (This)->lpVtbl -> Reset(This)
+
+#define IEnumDefinitionIdentity_Clone(This,ppIEnumDefinitionIdentity) \
+ (This)->lpVtbl -> Clone(This,ppIEnumDefinitionIdentity)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+HRESULT STDMETHODCALLTYPE IEnumDefinitionIdentity_Next_Proxy(
+ IEnumDefinitionIdentity * This,
+ /* [in] */ ULONG celt,
+ /* [length_is][size_is][out] */ IDefinitionIdentity *rgpIDefinitionIdentity[ ],
+ /* [out] */ ULONG *pceltWritten);
+
+
+void __RPC_STUB IEnumDefinitionIdentity_Next_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IEnumDefinitionIdentity_Skip_Proxy(
+ IEnumDefinitionIdentity * This,
+ /* [in] */ ULONG celt);
+
+
+void __RPC_STUB IEnumDefinitionIdentity_Skip_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IEnumDefinitionIdentity_Reset_Proxy(
+ IEnumDefinitionIdentity * This);
+
+
+void __RPC_STUB IEnumDefinitionIdentity_Reset_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IEnumDefinitionIdentity_Clone_Proxy(
+ IEnumDefinitionIdentity * This,
+ /* [out] */ IEnumDefinitionIdentity **ppIEnumDefinitionIdentity);
+
+
+void __RPC_STUB IEnumDefinitionIdentity_Clone_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IEnumDefinitionIdentity_INTERFACE_DEFINED__ */
+
+
+#ifndef __IEnumReferenceIdentity_INTERFACE_DEFINED__
+#define __IEnumReferenceIdentity_INTERFACE_DEFINED__
+
+/* interface IEnumReferenceIdentity */
+/* [local][unique][uuid][object] */
+
+
+EXTERN_C const IID IID_IEnumReferenceIdentity;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("b30352cf-23da-4577-9b3f-b4e6573be53b")
+ IEnumReferenceIdentity : public IUnknown
+ {
+ public:
+ virtual HRESULT STDMETHODCALLTYPE Next(
+ /* [in] */ ULONG celt,
+ /* [length_is][size_is][out] */ IReferenceIdentity **prgpIReferenceIdentity,
+ /* [out] */ ULONG *pceltWritten) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Skip(
+ ULONG celt) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Reset( void) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Clone(
+ IEnumReferenceIdentity **ppIEnumReferenceIdentity) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IEnumReferenceIdentityVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IEnumReferenceIdentity * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IEnumReferenceIdentity * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IEnumReferenceIdentity * This);
+
+ HRESULT ( STDMETHODCALLTYPE *Next )(
+ IEnumReferenceIdentity * This,
+ /* [in] */ ULONG celt,
+ /* [length_is][size_is][out] */ IReferenceIdentity **prgpIReferenceIdentity,
+ /* [out] */ ULONG *pceltWritten);
+
+ HRESULT ( STDMETHODCALLTYPE *Skip )(
+ IEnumReferenceIdentity * This,
+ ULONG celt);
+
+ HRESULT ( STDMETHODCALLTYPE *Reset )(
+ IEnumReferenceIdentity * This);
+
+ HRESULT ( STDMETHODCALLTYPE *Clone )(
+ IEnumReferenceIdentity * This,
+ IEnumReferenceIdentity **ppIEnumReferenceIdentity);
+
+ END_INTERFACE
+ } IEnumReferenceIdentityVtbl;
+
+ interface IEnumReferenceIdentity
+ {
+ CONST_VTBL struct IEnumReferenceIdentityVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IEnumReferenceIdentity_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IEnumReferenceIdentity_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IEnumReferenceIdentity_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IEnumReferenceIdentity_Next(This,celt,prgpIReferenceIdentity,pceltWritten) \
+ (This)->lpVtbl -> Next(This,celt,prgpIReferenceIdentity,pceltWritten)
+
+#define IEnumReferenceIdentity_Skip(This,celt) \
+ (This)->lpVtbl -> Skip(This,celt)
+
+#define IEnumReferenceIdentity_Reset(This) \
+ (This)->lpVtbl -> Reset(This)
+
+#define IEnumReferenceIdentity_Clone(This,ppIEnumReferenceIdentity) \
+ (This)->lpVtbl -> Clone(This,ppIEnumReferenceIdentity)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+HRESULT STDMETHODCALLTYPE IEnumReferenceIdentity_Next_Proxy(
+ IEnumReferenceIdentity * This,
+ /* [in] */ ULONG celt,
+ /* [length_is][size_is][out] */ IReferenceIdentity **prgpIReferenceIdentity,
+ /* [out] */ ULONG *pceltWritten);
+
+
+void __RPC_STUB IEnumReferenceIdentity_Next_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IEnumReferenceIdentity_Skip_Proxy(
+ IEnumReferenceIdentity * This,
+ ULONG celt);
+
+
+void __RPC_STUB IEnumReferenceIdentity_Skip_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IEnumReferenceIdentity_Reset_Proxy(
+ IEnumReferenceIdentity * This);
+
+
+void __RPC_STUB IEnumReferenceIdentity_Reset_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IEnumReferenceIdentity_Clone_Proxy(
+ IEnumReferenceIdentity * This,
+ IEnumReferenceIdentity **ppIEnumReferenceIdentity);
+
+
+void __RPC_STUB IEnumReferenceIdentity_Clone_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IEnumReferenceIdentity_INTERFACE_DEFINED__ */
+
+
+#ifndef __IDefinitionAppId_INTERFACE_DEFINED__
+#define __IDefinitionAppId_INTERFACE_DEFINED__
+
+/* interface IDefinitionAppId */
+/* [local][unique][uuid][object] */
+
+
+EXTERN_C const IID IID_IDefinitionAppId;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("d91e12d8-98ed-47fa-9936-39421283d59b")
+ IDefinitionAppId : public IUnknown
+ {
+ public:
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SubscriptionId(
+ /* [retval][out] */ LPWSTR *ppszSubscription) = 0;
+
+ virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_SubscriptionId(
+ /* [in] */ LPCWSTR pszSubscription) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Codebase(
+ /* [retval][out] */ LPWSTR *ppszCodebase) = 0;
+
+ virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_Codebase(
+ /* [in] */ LPCWSTR pszCodebase) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE EnumAppPath(
+ /* [out] */ IEnumDefinitionIdentity **ppIEnumDefinitionIdentity) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE SetAppPath(
+ /* [in] */ ULONG cIDefinitionIdentity,
+ /* [size_is][in] */ IDefinitionIdentity *rgIDefinitionIdentity[ ]) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IDefinitionAppIdVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IDefinitionAppId * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IDefinitionAppId * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IDefinitionAppId * This);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_SubscriptionId )(
+ IDefinitionAppId * This,
+ /* [retval][out] */ LPWSTR *ppszSubscription);
+
+ /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_SubscriptionId )(
+ IDefinitionAppId * This,
+ /* [in] */ LPCWSTR pszSubscription);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Codebase )(
+ IDefinitionAppId * This,
+ /* [retval][out] */ LPWSTR *ppszCodebase);
+
+ /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_Codebase )(
+ IDefinitionAppId * This,
+ /* [in] */ LPCWSTR pszCodebase);
+
+ HRESULT ( STDMETHODCALLTYPE *EnumAppPath )(
+ IDefinitionAppId * This,
+ /* [out] */ IEnumDefinitionIdentity **ppIEnumDefinitionIdentity);
+
+ HRESULT ( STDMETHODCALLTYPE *SetAppPath )(
+ IDefinitionAppId * This,
+ /* [in] */ ULONG cIDefinitionIdentity,
+ /* [size_is][in] */ IDefinitionIdentity *rgIDefinitionIdentity[ ]);
+
+ END_INTERFACE
+ } IDefinitionAppIdVtbl;
+
+ interface IDefinitionAppId
+ {
+ CONST_VTBL struct IDefinitionAppIdVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IDefinitionAppId_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IDefinitionAppId_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IDefinitionAppId_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IDefinitionAppId_get_SubscriptionId(This,ppszSubscription) \
+ (This)->lpVtbl -> get_SubscriptionId(This,ppszSubscription)
+
+#define IDefinitionAppId_put_SubscriptionId(This,pszSubscription) \
+ (This)->lpVtbl -> put_SubscriptionId(This,pszSubscription)
+
+#define IDefinitionAppId_get_Codebase(This,ppszCodebase) \
+ (This)->lpVtbl -> get_Codebase(This,ppszCodebase)
+
+#define IDefinitionAppId_put_Codebase(This,pszCodebase) \
+ (This)->lpVtbl -> put_Codebase(This,pszCodebase)
+
+#define IDefinitionAppId_EnumAppPath(This,ppIEnumDefinitionIdentity) \
+ (This)->lpVtbl -> EnumAppPath(This,ppIEnumDefinitionIdentity)
+
+#define IDefinitionAppId_SetAppPath(This,cIDefinitionIdentity,rgIDefinitionIdentity) \
+ (This)->lpVtbl -> SetAppPath(This,cIDefinitionIdentity,rgIDefinitionIdentity)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IDefinitionAppId_get_SubscriptionId_Proxy(
+ IDefinitionAppId * This,
+ /* [retval][out] */ LPWSTR *ppszSubscription);
+
+
+void __RPC_STUB IDefinitionAppId_get_SubscriptionId_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propput] */ HRESULT STDMETHODCALLTYPE IDefinitionAppId_put_SubscriptionId_Proxy(
+ IDefinitionAppId * This,
+ /* [in] */ LPCWSTR pszSubscription);
+
+
+void __RPC_STUB IDefinitionAppId_put_SubscriptionId_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IDefinitionAppId_get_Codebase_Proxy(
+ IDefinitionAppId * This,
+ /* [retval][out] */ LPWSTR *ppszCodebase);
+
+
+void __RPC_STUB IDefinitionAppId_get_Codebase_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propput] */ HRESULT STDMETHODCALLTYPE IDefinitionAppId_put_Codebase_Proxy(
+ IDefinitionAppId * This,
+ /* [in] */ LPCWSTR pszCodebase);
+
+
+void __RPC_STUB IDefinitionAppId_put_Codebase_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IDefinitionAppId_EnumAppPath_Proxy(
+ IDefinitionAppId * This,
+ /* [out] */ IEnumDefinitionIdentity **ppIEnumDefinitionIdentity);
+
+
+void __RPC_STUB IDefinitionAppId_EnumAppPath_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IDefinitionAppId_SetAppPath_Proxy(
+ IDefinitionAppId * This,
+ /* [in] */ ULONG cIDefinitionIdentity,
+ /* [size_is][in] */ IDefinitionIdentity *rgIDefinitionIdentity[ ]);
+
+
+void __RPC_STUB IDefinitionAppId_SetAppPath_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IDefinitionAppId_INTERFACE_DEFINED__ */
+
+
+#ifndef __IReferenceAppId_INTERFACE_DEFINED__
+#define __IReferenceAppId_INTERFACE_DEFINED__
+
+/* interface IReferenceAppId */
+/* [local][unique][uuid][object] */
+
+
+EXTERN_C const IID IID_IReferenceAppId;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("054f0bef-9e45-4363-8f5a-2f8e142d9a3b")
+ IReferenceAppId : public IUnknown
+ {
+ public:
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_SubscriptionId(
+ /* [retval][out] */ LPWSTR *ppszSubscription) = 0;
+
+ virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_SubscriptionId(
+ /* [in] */ LPCWSTR pszSubscription) = 0;
+
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_Codebase(
+ /* [retval][out] */ LPWSTR *ppszCodebase) = 0;
+
+ virtual /* [propput] */ HRESULT STDMETHODCALLTYPE put_Codebase(
+ /* [in] */ LPCWSTR pszCodebase) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE EnumAppPath(
+ /* [out] */ IEnumReferenceIdentity **ppIReferenceAppId) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IReferenceAppIdVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IReferenceAppId * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IReferenceAppId * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IReferenceAppId * This);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_SubscriptionId )(
+ IReferenceAppId * This,
+ /* [retval][out] */ LPWSTR *ppszSubscription);
+
+ /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_SubscriptionId )(
+ IReferenceAppId * This,
+ /* [in] */ LPCWSTR pszSubscription);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_Codebase )(
+ IReferenceAppId * This,
+ /* [retval][out] */ LPWSTR *ppszCodebase);
+
+ /* [propput] */ HRESULT ( STDMETHODCALLTYPE *put_Codebase )(
+ IReferenceAppId * This,
+ /* [in] */ LPCWSTR pszCodebase);
+
+ HRESULT ( STDMETHODCALLTYPE *EnumAppPath )(
+ IReferenceAppId * This,
+ /* [out] */ IEnumReferenceIdentity **ppIReferenceAppId);
+
+ END_INTERFACE
+ } IReferenceAppIdVtbl;
+
+ interface IReferenceAppId
+ {
+ CONST_VTBL struct IReferenceAppIdVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IReferenceAppId_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IReferenceAppId_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IReferenceAppId_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IReferenceAppId_get_SubscriptionId(This,ppszSubscription) \
+ (This)->lpVtbl -> get_SubscriptionId(This,ppszSubscription)
+
+#define IReferenceAppId_put_SubscriptionId(This,pszSubscription) \
+ (This)->lpVtbl -> put_SubscriptionId(This,pszSubscription)
+
+#define IReferenceAppId_get_Codebase(This,ppszCodebase) \
+ (This)->lpVtbl -> get_Codebase(This,ppszCodebase)
+
+#define IReferenceAppId_put_Codebase(This,pszCodebase) \
+ (This)->lpVtbl -> put_Codebase(This,pszCodebase)
+
+#define IReferenceAppId_EnumAppPath(This,ppIReferenceAppId) \
+ (This)->lpVtbl -> EnumAppPath(This,ppIReferenceAppId)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IReferenceAppId_get_SubscriptionId_Proxy(
+ IReferenceAppId * This,
+ /* [retval][out] */ LPWSTR *ppszSubscription);
+
+
+void __RPC_STUB IReferenceAppId_get_SubscriptionId_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propput] */ HRESULT STDMETHODCALLTYPE IReferenceAppId_put_SubscriptionId_Proxy(
+ IReferenceAppId * This,
+ /* [in] */ LPCWSTR pszSubscription);
+
+
+void __RPC_STUB IReferenceAppId_put_SubscriptionId_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IReferenceAppId_get_Codebase_Proxy(
+ IReferenceAppId * This,
+ /* [retval][out] */ LPWSTR *ppszCodebase);
+
+
+void __RPC_STUB IReferenceAppId_get_Codebase_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+/* [propput] */ HRESULT STDMETHODCALLTYPE IReferenceAppId_put_Codebase_Proxy(
+ IReferenceAppId * This,
+ /* [in] */ LPCWSTR pszCodebase);
+
+
+void __RPC_STUB IReferenceAppId_put_Codebase_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IReferenceAppId_EnumAppPath_Proxy(
+ IReferenceAppId * This,
+ /* [out] */ IEnumReferenceIdentity **ppIReferenceAppId);
+
+
+void __RPC_STUB IReferenceAppId_EnumAppPath_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IReferenceAppId_INTERFACE_DEFINED__ */
+
+
+#ifndef __IIdentityAuthority_INTERFACE_DEFINED__
+#define __IIdentityAuthority_INTERFACE_DEFINED__
+
+/* interface IIdentityAuthority */
+/* [local][unique][uuid][object] */
+
+/* [v1_enum] */
+enum _TEXT_TO_DEFINITION_IDENTITY_FLAGS
+ { TEXT_TO_DEFINITION_IDENTITY_FLAG_ALLOW_UNKNOWN_ATTRIBUTES_IN_NULL_NAMESPACE = 0x1
+ } ;
+/* [v1_enum] */
+enum _TEXT_TO_REFERENCE_IDENTITY_FLAGS
+ { TEXT_TO_REFERENCE_IDENTITY_FLAG_ALLOW_UNKNOWN_ATTRIBUTES_IN_NULL_NAMESPACE = 0x1
+ } ;
+/* [v1_enum] */
+enum _DEFINITION_IDENTITY_TO_TEXT_FLAGS
+ { DEFINITION_IDENTITY_TO_TEXT_FLAG_CANONICAL = 0x1
+ } ;
+/* [v1_enum] */
+enum _REFERENCE_IDENTITY_TO_TEXT_FLAGS
+ { REFERENCE_IDENTITY_TO_TEXT_FLAG_CANONICAL = 0x1
+ } ;
+/* [v1_enum] */
+enum _IIDENTITYAUTHORITY_DOES_DEFINITION_MATCH_REFERENCE_FLAGS
+ { IIDENTITYAUTHORITY_DOES_DEFINITION_MATCH_REFERENCE_FLAG_EXACT_MATCH_REQUIRED = 0x1
+ } ;
+/* [v1_enum] */
+enum _IIDENTITYAUTHORITY_DOES_TEXTUAL_DEFINITION_MATCH_TEXTUAL_REFERENCE_FLAGS
+ { IIDENTITYAUTHORITY_DOES_TEXTUAL_DEFINITION_MATCH_TEXTUAL_REFERENCE_FLAG_EXACT_MATCH_REQUIRED = 0x1
+ } ;
+
+EXTERN_C const IID IID_IIdentityAuthority;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("261a6983-c35d-4d0d-aa5b-7867259e77bc")
+ IIdentityAuthority : public IUnknown
+ {
+ public:
+ virtual HRESULT STDMETHODCALLTYPE TextToDefinition(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ LPCWSTR pszIdentity,
+ /* [out] */ IDefinitionIdentity **ppIDefinitionIdentity) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE TextToReference(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ LPCWSTR pszIdentity,
+ /* [out] */ IReferenceIdentity **ppIReferenceIdentity) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE DefinitionToText(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
+ /* [out] */ LPWSTR *ppszFormattedIdentity) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE DefinitionToTextBuffer(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
+ /* [in] */ ULONG cchBufferSize,
+ /* [length_is][size_is][out][in] */ WCHAR wchBuffer[ ],
+ /* [out] */ ULONG *pcchBufferRequired) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE ReferenceToText(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IReferenceIdentity *pIReferenceIdentity,
+ /* [out] */ LPWSTR *ppszFormattedIdentity) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE ReferenceToTextBuffer(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IReferenceIdentity *pIReferenceIdentity,
+ /* [in] */ ULONG cchBufferSize,
+ /* [length_is][size_is][out][in] */ WCHAR wchBuffer[ ],
+ /* [out] */ ULONG *pcchBufferRequired) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE AreDefinitionsEqual(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionIdentity *pDefinition1,
+ /* [in] */ IDefinitionIdentity *pDefinition2,
+ /* [out] */ BOOL *pfEqual) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE AreReferencesEqual(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IReferenceIdentity *pReference1,
+ /* [in] */ IReferenceIdentity *pReference2,
+ /* [out] */ BOOL *pfEqual) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE AreTextualDefinitionsEqual(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ LPCWSTR pszIdentityLeft,
+ /* [in] */ LPCWSTR pszIdentityRight,
+ /* [out] */ BOOL *pfEqual) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE AreTextualReferencesEqual(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ LPCWSTR pszIdentityLeft,
+ /* [in] */ LPCWSTR pszIdentityRight,
+ /* [out] */ BOOL *pfEqual) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE DoesDefinitionMatchReference(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
+ /* [in] */ IReferenceIdentity *pIReferenceIdentity,
+ /* [out] */ BOOL *pfMatches) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE DoesTextualDefinitionMatchTextualReference(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ LPCWSTR pszDefinition,
+ /* [in] */ LPCWSTR pszReference,
+ /* [out] */ BOOL *pfMatches) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE HashReference(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IReferenceIdentity *pIReferenceIdentity,
+ /* [out] */ ULONGLONG *pullPseudoKey) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE HashDefinition(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
+ /* [out] */ ULONGLONG *pullPseudoKey) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE GenerateDefinitionKey(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
+ /* [out] */ LPWSTR *ppszKeyForm) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE GenerateReferenceKey(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IReferenceIdentity *pIReferenceIdentity,
+ /* [out] */ LPWSTR *ppszKeyForm) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE CreateDefinition(
+ /* [retval][out] */ IDefinitionIdentity **ppNewIdentity) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE CreateReference(
+ /* [retval][out] */ IReferenceIdentity **ppNewIdentity) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IIdentityAuthorityVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IIdentityAuthority * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IIdentityAuthority * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IIdentityAuthority * This);
+
+ HRESULT ( STDMETHODCALLTYPE *TextToDefinition )(
+ IIdentityAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ LPCWSTR pszIdentity,
+ /* [out] */ IDefinitionIdentity **ppIDefinitionIdentity);
+
+ HRESULT ( STDMETHODCALLTYPE *TextToReference )(
+ IIdentityAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ LPCWSTR pszIdentity,
+ /* [out] */ IReferenceIdentity **ppIReferenceIdentity);
+
+ HRESULT ( STDMETHODCALLTYPE *DefinitionToText )(
+ IIdentityAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
+ /* [out] */ LPWSTR *ppszFormattedIdentity);
+
+ HRESULT ( STDMETHODCALLTYPE *DefinitionToTextBuffer )(
+ IIdentityAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
+ /* [in] */ ULONG cchBufferSize,
+ /* [length_is][size_is][out][in] */ WCHAR wchBuffer[ ],
+ /* [out] */ ULONG *pcchBufferRequired);
+
+ HRESULT ( STDMETHODCALLTYPE *ReferenceToText )(
+ IIdentityAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IReferenceIdentity *pIReferenceIdentity,
+ /* [out] */ LPWSTR *ppszFormattedIdentity);
+
+ HRESULT ( STDMETHODCALLTYPE *ReferenceToTextBuffer )(
+ IIdentityAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IReferenceIdentity *pIReferenceIdentity,
+ /* [in] */ ULONG cchBufferSize,
+ /* [length_is][size_is][out][in] */ WCHAR wchBuffer[ ],
+ /* [out] */ ULONG *pcchBufferRequired);
+
+ HRESULT ( STDMETHODCALLTYPE *AreDefinitionsEqual )(
+ IIdentityAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionIdentity *pDefinition1,
+ /* [in] */ IDefinitionIdentity *pDefinition2,
+ /* [out] */ BOOL *pfEqual);
+
+ HRESULT ( STDMETHODCALLTYPE *AreReferencesEqual )(
+ IIdentityAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IReferenceIdentity *pReference1,
+ /* [in] */ IReferenceIdentity *pReference2,
+ /* [out] */ BOOL *pfEqual);
+
+ HRESULT ( STDMETHODCALLTYPE *AreTextualDefinitionsEqual )(
+ IIdentityAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ LPCWSTR pszIdentityLeft,
+ /* [in] */ LPCWSTR pszIdentityRight,
+ /* [out] */ BOOL *pfEqual);
+
+ HRESULT ( STDMETHODCALLTYPE *AreTextualReferencesEqual )(
+ IIdentityAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ LPCWSTR pszIdentityLeft,
+ /* [in] */ LPCWSTR pszIdentityRight,
+ /* [out] */ BOOL *pfEqual);
+
+ HRESULT ( STDMETHODCALLTYPE *DoesDefinitionMatchReference )(
+ IIdentityAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
+ /* [in] */ IReferenceIdentity *pIReferenceIdentity,
+ /* [out] */ BOOL *pfMatches);
+
+ HRESULT ( STDMETHODCALLTYPE *DoesTextualDefinitionMatchTextualReference )(
+ IIdentityAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ LPCWSTR pszDefinition,
+ /* [in] */ LPCWSTR pszReference,
+ /* [out] */ BOOL *pfMatches);
+
+ HRESULT ( STDMETHODCALLTYPE *HashReference )(
+ IIdentityAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IReferenceIdentity *pIReferenceIdentity,
+ /* [out] */ ULONGLONG *pullPseudoKey);
+
+ HRESULT ( STDMETHODCALLTYPE *HashDefinition )(
+ IIdentityAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
+ /* [out] */ ULONGLONG *pullPseudoKey);
+
+ HRESULT ( STDMETHODCALLTYPE *GenerateDefinitionKey )(
+ IIdentityAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
+ /* [out] */ LPWSTR *ppszKeyForm);
+
+ HRESULT ( STDMETHODCALLTYPE *GenerateReferenceKey )(
+ IIdentityAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IReferenceIdentity *pIReferenceIdentity,
+ /* [out] */ LPWSTR *ppszKeyForm);
+
+ HRESULT ( STDMETHODCALLTYPE *CreateDefinition )(
+ IIdentityAuthority * This,
+ /* [retval][out] */ IDefinitionIdentity **ppNewIdentity);
+
+ HRESULT ( STDMETHODCALLTYPE *CreateReference )(
+ IIdentityAuthority * This,
+ /* [retval][out] */ IReferenceIdentity **ppNewIdentity);
+
+ END_INTERFACE
+ } IIdentityAuthorityVtbl;
+
+ interface IIdentityAuthority
+ {
+ CONST_VTBL struct IIdentityAuthorityVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IIdentityAuthority_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IIdentityAuthority_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IIdentityAuthority_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IIdentityAuthority_TextToDefinition(This,dwFlags,pszIdentity,ppIDefinitionIdentity) \
+ (This)->lpVtbl -> TextToDefinition(This,dwFlags,pszIdentity,ppIDefinitionIdentity)
+
+#define IIdentityAuthority_TextToReference(This,dwFlags,pszIdentity,ppIReferenceIdentity) \
+ (This)->lpVtbl -> TextToReference(This,dwFlags,pszIdentity,ppIReferenceIdentity)
+
+#define IIdentityAuthority_DefinitionToText(This,dwFlags,pIDefinitionIdentity,ppszFormattedIdentity) \
+ (This)->lpVtbl -> DefinitionToText(This,dwFlags,pIDefinitionIdentity,ppszFormattedIdentity)
+
+#define IIdentityAuthority_DefinitionToTextBuffer(This,dwFlags,pIDefinitionIdentity,cchBufferSize,wchBuffer,pcchBufferRequired) \
+ (This)->lpVtbl -> DefinitionToTextBuffer(This,dwFlags,pIDefinitionIdentity,cchBufferSize,wchBuffer,pcchBufferRequired)
+
+#define IIdentityAuthority_ReferenceToText(This,dwFlags,pIReferenceIdentity,ppszFormattedIdentity) \
+ (This)->lpVtbl -> ReferenceToText(This,dwFlags,pIReferenceIdentity,ppszFormattedIdentity)
+
+#define IIdentityAuthority_ReferenceToTextBuffer(This,dwFlags,pIReferenceIdentity,cchBufferSize,wchBuffer,pcchBufferRequired) \
+ (This)->lpVtbl -> ReferenceToTextBuffer(This,dwFlags,pIReferenceIdentity,cchBufferSize,wchBuffer,pcchBufferRequired)
+
+#define IIdentityAuthority_AreDefinitionsEqual(This,dwFlags,pDefinition1,pDefinition2,pfEqual) \
+ (This)->lpVtbl -> AreDefinitionsEqual(This,dwFlags,pDefinition1,pDefinition2,pfEqual)
+
+#define IIdentityAuthority_AreReferencesEqual(This,dwFlags,pReference1,pReference2,pfEqual) \
+ (This)->lpVtbl -> AreReferencesEqual(This,dwFlags,pReference1,pReference2,pfEqual)
+
+#define IIdentityAuthority_AreTextualDefinitionsEqual(This,dwFlags,pszIdentityLeft,pszIdentityRight,pfEqual) \
+ (This)->lpVtbl -> AreTextualDefinitionsEqual(This,dwFlags,pszIdentityLeft,pszIdentityRight,pfEqual)
+
+#define IIdentityAuthority_AreTextualReferencesEqual(This,dwFlags,pszIdentityLeft,pszIdentityRight,pfEqual) \
+ (This)->lpVtbl -> AreTextualReferencesEqual(This,dwFlags,pszIdentityLeft,pszIdentityRight,pfEqual)
+
+#define IIdentityAuthority_DoesDefinitionMatchReference(This,dwFlags,pIDefinitionIdentity,pIReferenceIdentity,pfMatches) \
+ (This)->lpVtbl -> DoesDefinitionMatchReference(This,dwFlags,pIDefinitionIdentity,pIReferenceIdentity,pfMatches)
+
+#define IIdentityAuthority_DoesTextualDefinitionMatchTextualReference(This,dwFlags,pszDefinition,pszReference,pfMatches) \
+ (This)->lpVtbl -> DoesTextualDefinitionMatchTextualReference(This,dwFlags,pszDefinition,pszReference,pfMatches)
+
+#define IIdentityAuthority_HashReference(This,dwFlags,pIReferenceIdentity,pullPseudoKey) \
+ (This)->lpVtbl -> HashReference(This,dwFlags,pIReferenceIdentity,pullPseudoKey)
+
+#define IIdentityAuthority_HashDefinition(This,dwFlags,pIDefinitionIdentity,pullPseudoKey) \
+ (This)->lpVtbl -> HashDefinition(This,dwFlags,pIDefinitionIdentity,pullPseudoKey)
+
+#define IIdentityAuthority_GenerateDefinitionKey(This,dwFlags,pIDefinitionIdentity,ppszKeyForm) \
+ (This)->lpVtbl -> GenerateDefinitionKey(This,dwFlags,pIDefinitionIdentity,ppszKeyForm)
+
+#define IIdentityAuthority_GenerateReferenceKey(This,dwFlags,pIReferenceIdentity,ppszKeyForm) \
+ (This)->lpVtbl -> GenerateReferenceKey(This,dwFlags,pIReferenceIdentity,ppszKeyForm)
+
+#define IIdentityAuthority_CreateDefinition(This,ppNewIdentity) \
+ (This)->lpVtbl -> CreateDefinition(This,ppNewIdentity)
+
+#define IIdentityAuthority_CreateReference(This,ppNewIdentity) \
+ (This)->lpVtbl -> CreateReference(This,ppNewIdentity)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+HRESULT STDMETHODCALLTYPE IIdentityAuthority_TextToDefinition_Proxy(
+ IIdentityAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ LPCWSTR pszIdentity,
+ /* [out] */ IDefinitionIdentity **ppIDefinitionIdentity);
+
+
+void __RPC_STUB IIdentityAuthority_TextToDefinition_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IIdentityAuthority_TextToReference_Proxy(
+ IIdentityAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ LPCWSTR pszIdentity,
+ /* [out] */ IReferenceIdentity **ppIReferenceIdentity);
+
+
+void __RPC_STUB IIdentityAuthority_TextToReference_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IIdentityAuthority_DefinitionToText_Proxy(
+ IIdentityAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
+ /* [out] */ LPWSTR *ppszFormattedIdentity);
+
+
+void __RPC_STUB IIdentityAuthority_DefinitionToText_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IIdentityAuthority_DefinitionToTextBuffer_Proxy(
+ IIdentityAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
+ /* [in] */ ULONG cchBufferSize,
+ /* [length_is][size_is][out][in] */ WCHAR wchBuffer[ ],
+ /* [out] */ ULONG *pcchBufferRequired);
+
+
+void __RPC_STUB IIdentityAuthority_DefinitionToTextBuffer_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IIdentityAuthority_ReferenceToText_Proxy(
+ IIdentityAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IReferenceIdentity *pIReferenceIdentity,
+ /* [out] */ LPWSTR *ppszFormattedIdentity);
+
+
+void __RPC_STUB IIdentityAuthority_ReferenceToText_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IIdentityAuthority_ReferenceToTextBuffer_Proxy(
+ IIdentityAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IReferenceIdentity *pIReferenceIdentity,
+ /* [in] */ ULONG cchBufferSize,
+ /* [length_is][size_is][out][in] */ WCHAR wchBuffer[ ],
+ /* [out] */ ULONG *pcchBufferRequired);
+
+
+void __RPC_STUB IIdentityAuthority_ReferenceToTextBuffer_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IIdentityAuthority_AreDefinitionsEqual_Proxy(
+ IIdentityAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionIdentity *pDefinition1,
+ /* [in] */ IDefinitionIdentity *pDefinition2,
+ /* [out] */ BOOL *pfEqual);
+
+
+void __RPC_STUB IIdentityAuthority_AreDefinitionsEqual_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IIdentityAuthority_AreReferencesEqual_Proxy(
+ IIdentityAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IReferenceIdentity *pReference1,
+ /* [in] */ IReferenceIdentity *pReference2,
+ /* [out] */ BOOL *pfEqual);
+
+
+void __RPC_STUB IIdentityAuthority_AreReferencesEqual_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IIdentityAuthority_AreTextualDefinitionsEqual_Proxy(
+ IIdentityAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ LPCWSTR pszIdentityLeft,
+ /* [in] */ LPCWSTR pszIdentityRight,
+ /* [out] */ BOOL *pfEqual);
+
+
+void __RPC_STUB IIdentityAuthority_AreTextualDefinitionsEqual_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IIdentityAuthority_AreTextualReferencesEqual_Proxy(
+ IIdentityAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ LPCWSTR pszIdentityLeft,
+ /* [in] */ LPCWSTR pszIdentityRight,
+ /* [out] */ BOOL *pfEqual);
+
+
+void __RPC_STUB IIdentityAuthority_AreTextualReferencesEqual_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IIdentityAuthority_DoesDefinitionMatchReference_Proxy(
+ IIdentityAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
+ /* [in] */ IReferenceIdentity *pIReferenceIdentity,
+ /* [out] */ BOOL *pfMatches);
+
+
+void __RPC_STUB IIdentityAuthority_DoesDefinitionMatchReference_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IIdentityAuthority_DoesTextualDefinitionMatchTextualReference_Proxy(
+ IIdentityAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ LPCWSTR pszDefinition,
+ /* [in] */ LPCWSTR pszReference,
+ /* [out] */ BOOL *pfMatches);
+
+
+void __RPC_STUB IIdentityAuthority_DoesTextualDefinitionMatchTextualReference_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IIdentityAuthority_HashReference_Proxy(
+ IIdentityAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IReferenceIdentity *pIReferenceIdentity,
+ /* [out] */ ULONGLONG *pullPseudoKey);
+
+
+void __RPC_STUB IIdentityAuthority_HashReference_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IIdentityAuthority_HashDefinition_Proxy(
+ IIdentityAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
+ /* [out] */ ULONGLONG *pullPseudoKey);
+
+
+void __RPC_STUB IIdentityAuthority_HashDefinition_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IIdentityAuthority_GenerateDefinitionKey_Proxy(
+ IIdentityAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
+ /* [out] */ LPWSTR *ppszKeyForm);
+
+
+void __RPC_STUB IIdentityAuthority_GenerateDefinitionKey_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IIdentityAuthority_GenerateReferenceKey_Proxy(
+ IIdentityAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IReferenceIdentity *pIReferenceIdentity,
+ /* [out] */ LPWSTR *ppszKeyForm);
+
+
+void __RPC_STUB IIdentityAuthority_GenerateReferenceKey_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IIdentityAuthority_CreateDefinition_Proxy(
+ IIdentityAuthority * This,
+ /* [retval][out] */ IDefinitionIdentity **ppNewIdentity);
+
+
+void __RPC_STUB IIdentityAuthority_CreateDefinition_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IIdentityAuthority_CreateReference_Proxy(
+ IIdentityAuthority * This,
+ /* [retval][out] */ IReferenceIdentity **ppNewIdentity);
+
+
+void __RPC_STUB IIdentityAuthority_CreateReference_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IIdentityAuthority_INTERFACE_DEFINED__ */
+
+
+#ifndef __IAppIdAuthority_INTERFACE_DEFINED__
+#define __IAppIdAuthority_INTERFACE_DEFINED__
+
+/* interface IAppIdAuthority */
+/* [local][unique][uuid][object] */
+
+/* [v1_enum] */
+enum IAPPIDAUTHORITY_ARE_DEFINITIONS_EQUAL_FLAGS
+ { IAPPIDAUTHORITY_ARE_DEFINITIONS_EQUAL_FLAG_IGNORE_VERSION = 0x1
+ } ;
+/* [v1_enum] */
+enum IAPPIDAUTHORITY_ARE_REFERENCES_EQUAL_FLAGS
+ { IAPPIDAUTHORITY_ARE_REFERENCES_EQUAL_FLAG_IGNORE_VERSION = 0x1
+ } ;
+
+EXTERN_C const IID IID_IAppIdAuthority;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("8c87810c-2541-4f75-b2d0-9af515488e23")
+ IAppIdAuthority : public IUnknown
+ {
+ public:
+ virtual HRESULT STDMETHODCALLTYPE TextToDefinition(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ LPCWSTR pszIdentity,
+ /* [out] */ IDefinitionAppId **ppIDefinitionAppId) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE TextToReference(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ LPCWSTR pszIdentity,
+ /* [out] */ IReferenceAppId **ppIReferenceAppId) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE DefinitionToText(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionAppId *pIDefinitionAppId,
+ /* [out] */ LPWSTR *ppszFormattedIdentity) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE ReferenceToText(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IReferenceAppId *pIReferenceAppId,
+ /* [out] */ LPWSTR *ppszFormattedIdentity) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE AreDefinitionsEqual(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionAppId *pDefinition1,
+ /* [in] */ IDefinitionAppId *pDefinition2,
+ /* [out] */ BOOL *pfAreEqual) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE AreReferencesEqual(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IReferenceAppId *pReference1,
+ /* [in] */ IReferenceAppId *pReference2,
+ /* [out] */ BOOL *pfAreEqual) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE AreTextualDefinitionsEqual(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ LPCWSTR pszAppIdLeft,
+ /* [in] */ LPCWSTR pszAppIdRight,
+ /* [out] */ BOOL *pfAreEqual) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE AreTextualReferencesEqual(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ LPCWSTR pszAppIdLeft,
+ /* [in] */ LPCWSTR pszAppIdRight,
+ /* [out] */ BOOL *pfAreEqual) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE DoesDefinitionMatchReference(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionAppId *pIDefinitionIdentity,
+ /* [in] */ IReferenceAppId *pIReferenceIdentity,
+ /* [out] */ BOOL *pfMatches) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE DoesTextualDefinitionMatchTextualReference(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ LPCWSTR pszDefinition,
+ /* [in] */ LPCWSTR pszReference,
+ /* [out] */ BOOL *pfMatches) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE HashReference(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IReferenceAppId *pIReferenceIdentity,
+ /* [out] */ ULONGLONG *pullPseudoKey) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE HashDefinition(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionAppId *pIDefinitionIdentity,
+ /* [out] */ ULONGLONG *pullPseudoKey) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE GenerateDefinitionKey(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionAppId *pIDefinitionIdentity,
+ /* [out] */ LPWSTR *ppszKeyForm) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE GenerateReferenceKey(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IReferenceAppId *pIReferenceIdentity,
+ /* [out] */ LPWSTR *ppszKeyForm) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE CreateDefinition(
+ /* [retval][out] */ IDefinitionAppId **ppNewIdentity) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE CreateReference(
+ /* [retval][out] */ IReferenceAppId **ppNewIdentity) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IAppIdAuthorityVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IAppIdAuthority * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IAppIdAuthority * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IAppIdAuthority * This);
+
+ HRESULT ( STDMETHODCALLTYPE *TextToDefinition )(
+ IAppIdAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ LPCWSTR pszIdentity,
+ /* [out] */ IDefinitionAppId **ppIDefinitionAppId);
+
+ HRESULT ( STDMETHODCALLTYPE *TextToReference )(
+ IAppIdAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ LPCWSTR pszIdentity,
+ /* [out] */ IReferenceAppId **ppIReferenceAppId);
+
+ HRESULT ( STDMETHODCALLTYPE *DefinitionToText )(
+ IAppIdAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionAppId *pIDefinitionAppId,
+ /* [out] */ LPWSTR *ppszFormattedIdentity);
+
+ HRESULT ( STDMETHODCALLTYPE *ReferenceToText )(
+ IAppIdAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IReferenceAppId *pIReferenceAppId,
+ /* [out] */ LPWSTR *ppszFormattedIdentity);
+
+ HRESULT ( STDMETHODCALLTYPE *AreDefinitionsEqual )(
+ IAppIdAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionAppId *pDefinition1,
+ /* [in] */ IDefinitionAppId *pDefinition2,
+ /* [out] */ BOOL *pfAreEqual);
+
+ HRESULT ( STDMETHODCALLTYPE *AreReferencesEqual )(
+ IAppIdAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IReferenceAppId *pReference1,
+ /* [in] */ IReferenceAppId *pReference2,
+ /* [out] */ BOOL *pfAreEqual);
+
+ HRESULT ( STDMETHODCALLTYPE *AreTextualDefinitionsEqual )(
+ IAppIdAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ LPCWSTR pszAppIdLeft,
+ /* [in] */ LPCWSTR pszAppIdRight,
+ /* [out] */ BOOL *pfAreEqual);
+
+ HRESULT ( STDMETHODCALLTYPE *AreTextualReferencesEqual )(
+ IAppIdAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ LPCWSTR pszAppIdLeft,
+ /* [in] */ LPCWSTR pszAppIdRight,
+ /* [out] */ BOOL *pfAreEqual);
+
+ HRESULT ( STDMETHODCALLTYPE *DoesDefinitionMatchReference )(
+ IAppIdAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionAppId *pIDefinitionIdentity,
+ /* [in] */ IReferenceAppId *pIReferenceIdentity,
+ /* [out] */ BOOL *pfMatches);
+
+ HRESULT ( STDMETHODCALLTYPE *DoesTextualDefinitionMatchTextualReference )(
+ IAppIdAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ LPCWSTR pszDefinition,
+ /* [in] */ LPCWSTR pszReference,
+ /* [out] */ BOOL *pfMatches);
+
+ HRESULT ( STDMETHODCALLTYPE *HashReference )(
+ IAppIdAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IReferenceAppId *pIReferenceIdentity,
+ /* [out] */ ULONGLONG *pullPseudoKey);
+
+ HRESULT ( STDMETHODCALLTYPE *HashDefinition )(
+ IAppIdAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionAppId *pIDefinitionIdentity,
+ /* [out] */ ULONGLONG *pullPseudoKey);
+
+ HRESULT ( STDMETHODCALLTYPE *GenerateDefinitionKey )(
+ IAppIdAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionAppId *pIDefinitionIdentity,
+ /* [out] */ LPWSTR *ppszKeyForm);
+
+ HRESULT ( STDMETHODCALLTYPE *GenerateReferenceKey )(
+ IAppIdAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IReferenceAppId *pIReferenceIdentity,
+ /* [out] */ LPWSTR *ppszKeyForm);
+
+ HRESULT ( STDMETHODCALLTYPE *CreateDefinition )(
+ IAppIdAuthority * This,
+ /* [retval][out] */ IDefinitionAppId **ppNewIdentity);
+
+ HRESULT ( STDMETHODCALLTYPE *CreateReference )(
+ IAppIdAuthority * This,
+ /* [retval][out] */ IReferenceAppId **ppNewIdentity);
+
+ END_INTERFACE
+ } IAppIdAuthorityVtbl;
+
+ interface IAppIdAuthority
+ {
+ CONST_VTBL struct IAppIdAuthorityVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IAppIdAuthority_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IAppIdAuthority_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IAppIdAuthority_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IAppIdAuthority_TextToDefinition(This,dwFlags,pszIdentity,ppIDefinitionAppId) \
+ (This)->lpVtbl -> TextToDefinition(This,dwFlags,pszIdentity,ppIDefinitionAppId)
+
+#define IAppIdAuthority_TextToReference(This,dwFlags,pszIdentity,ppIReferenceAppId) \
+ (This)->lpVtbl -> TextToReference(This,dwFlags,pszIdentity,ppIReferenceAppId)
+
+#define IAppIdAuthority_DefinitionToText(This,dwFlags,pIDefinitionAppId,ppszFormattedIdentity) \
+ (This)->lpVtbl -> DefinitionToText(This,dwFlags,pIDefinitionAppId,ppszFormattedIdentity)
+
+#define IAppIdAuthority_ReferenceToText(This,dwFlags,pIReferenceAppId,ppszFormattedIdentity) \
+ (This)->lpVtbl -> ReferenceToText(This,dwFlags,pIReferenceAppId,ppszFormattedIdentity)
+
+#define IAppIdAuthority_AreDefinitionsEqual(This,dwFlags,pDefinition1,pDefinition2,pfAreEqual) \
+ (This)->lpVtbl -> AreDefinitionsEqual(This,dwFlags,pDefinition1,pDefinition2,pfAreEqual)
+
+#define IAppIdAuthority_AreReferencesEqual(This,dwFlags,pReference1,pReference2,pfAreEqual) \
+ (This)->lpVtbl -> AreReferencesEqual(This,dwFlags,pReference1,pReference2,pfAreEqual)
+
+#define IAppIdAuthority_AreTextualDefinitionsEqual(This,dwFlags,pszAppIdLeft,pszAppIdRight,pfAreEqual) \
+ (This)->lpVtbl -> AreTextualDefinitionsEqual(This,dwFlags,pszAppIdLeft,pszAppIdRight,pfAreEqual)
+
+#define IAppIdAuthority_AreTextualReferencesEqual(This,dwFlags,pszAppIdLeft,pszAppIdRight,pfAreEqual) \
+ (This)->lpVtbl -> AreTextualReferencesEqual(This,dwFlags,pszAppIdLeft,pszAppIdRight,pfAreEqual)
+
+#define IAppIdAuthority_DoesDefinitionMatchReference(This,dwFlags,pIDefinitionIdentity,pIReferenceIdentity,pfMatches) \
+ (This)->lpVtbl -> DoesDefinitionMatchReference(This,dwFlags,pIDefinitionIdentity,pIReferenceIdentity,pfMatches)
+
+#define IAppIdAuthority_DoesTextualDefinitionMatchTextualReference(This,dwFlags,pszDefinition,pszReference,pfMatches) \
+ (This)->lpVtbl -> DoesTextualDefinitionMatchTextualReference(This,dwFlags,pszDefinition,pszReference,pfMatches)
+
+#define IAppIdAuthority_HashReference(This,dwFlags,pIReferenceIdentity,pullPseudoKey) \
+ (This)->lpVtbl -> HashReference(This,dwFlags,pIReferenceIdentity,pullPseudoKey)
+
+#define IAppIdAuthority_HashDefinition(This,dwFlags,pIDefinitionIdentity,pullPseudoKey) \
+ (This)->lpVtbl -> HashDefinition(This,dwFlags,pIDefinitionIdentity,pullPseudoKey)
+
+#define IAppIdAuthority_GenerateDefinitionKey(This,dwFlags,pIDefinitionIdentity,ppszKeyForm) \
+ (This)->lpVtbl -> GenerateDefinitionKey(This,dwFlags,pIDefinitionIdentity,ppszKeyForm)
+
+#define IAppIdAuthority_GenerateReferenceKey(This,dwFlags,pIReferenceIdentity,ppszKeyForm) \
+ (This)->lpVtbl -> GenerateReferenceKey(This,dwFlags,pIReferenceIdentity,ppszKeyForm)
+
+#define IAppIdAuthority_CreateDefinition(This,ppNewIdentity) \
+ (This)->lpVtbl -> CreateDefinition(This,ppNewIdentity)
+
+#define IAppIdAuthority_CreateReference(This,ppNewIdentity) \
+ (This)->lpVtbl -> CreateReference(This,ppNewIdentity)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+HRESULT STDMETHODCALLTYPE IAppIdAuthority_TextToDefinition_Proxy(
+ IAppIdAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ LPCWSTR pszIdentity,
+ /* [out] */ IDefinitionAppId **ppIDefinitionAppId);
+
+
+void __RPC_STUB IAppIdAuthority_TextToDefinition_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IAppIdAuthority_TextToReference_Proxy(
+ IAppIdAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ LPCWSTR pszIdentity,
+ /* [out] */ IReferenceAppId **ppIReferenceAppId);
+
+
+void __RPC_STUB IAppIdAuthority_TextToReference_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IAppIdAuthority_DefinitionToText_Proxy(
+ IAppIdAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionAppId *pIDefinitionAppId,
+ /* [out] */ LPWSTR *ppszFormattedIdentity);
+
+
+void __RPC_STUB IAppIdAuthority_DefinitionToText_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IAppIdAuthority_ReferenceToText_Proxy(
+ IAppIdAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IReferenceAppId *pIReferenceAppId,
+ /* [out] */ LPWSTR *ppszFormattedIdentity);
+
+
+void __RPC_STUB IAppIdAuthority_ReferenceToText_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IAppIdAuthority_AreDefinitionsEqual_Proxy(
+ IAppIdAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionAppId *pDefinition1,
+ /* [in] */ IDefinitionAppId *pDefinition2,
+ /* [out] */ BOOL *pfAreEqual);
+
+
+void __RPC_STUB IAppIdAuthority_AreDefinitionsEqual_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IAppIdAuthority_AreReferencesEqual_Proxy(
+ IAppIdAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IReferenceAppId *pReference1,
+ /* [in] */ IReferenceAppId *pReference2,
+ /* [out] */ BOOL *pfAreEqual);
+
+
+void __RPC_STUB IAppIdAuthority_AreReferencesEqual_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IAppIdAuthority_AreTextualDefinitionsEqual_Proxy(
+ IAppIdAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ LPCWSTR pszAppIdLeft,
+ /* [in] */ LPCWSTR pszAppIdRight,
+ /* [out] */ BOOL *pfAreEqual);
+
+
+void __RPC_STUB IAppIdAuthority_AreTextualDefinitionsEqual_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IAppIdAuthority_AreTextualReferencesEqual_Proxy(
+ IAppIdAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ LPCWSTR pszAppIdLeft,
+ /* [in] */ LPCWSTR pszAppIdRight,
+ /* [out] */ BOOL *pfAreEqual);
+
+
+void __RPC_STUB IAppIdAuthority_AreTextualReferencesEqual_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IAppIdAuthority_DoesDefinitionMatchReference_Proxy(
+ IAppIdAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionAppId *pIDefinitionIdentity,
+ /* [in] */ IReferenceAppId *pIReferenceIdentity,
+ /* [out] */ BOOL *pfMatches);
+
+
+void __RPC_STUB IAppIdAuthority_DoesDefinitionMatchReference_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IAppIdAuthority_DoesTextualDefinitionMatchTextualReference_Proxy(
+ IAppIdAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ LPCWSTR pszDefinition,
+ /* [in] */ LPCWSTR pszReference,
+ /* [out] */ BOOL *pfMatches);
+
+
+void __RPC_STUB IAppIdAuthority_DoesTextualDefinitionMatchTextualReference_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IAppIdAuthority_HashReference_Proxy(
+ IAppIdAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IReferenceAppId *pIReferenceIdentity,
+ /* [out] */ ULONGLONG *pullPseudoKey);
+
+
+void __RPC_STUB IAppIdAuthority_HashReference_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IAppIdAuthority_HashDefinition_Proxy(
+ IAppIdAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionAppId *pIDefinitionIdentity,
+ /* [out] */ ULONGLONG *pullPseudoKey);
+
+
+void __RPC_STUB IAppIdAuthority_HashDefinition_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IAppIdAuthority_GenerateDefinitionKey_Proxy(
+ IAppIdAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionAppId *pIDefinitionIdentity,
+ /* [out] */ LPWSTR *ppszKeyForm);
+
+
+void __RPC_STUB IAppIdAuthority_GenerateDefinitionKey_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IAppIdAuthority_GenerateReferenceKey_Proxy(
+ IAppIdAuthority * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IReferenceAppId *pIReferenceIdentity,
+ /* [out] */ LPWSTR *ppszKeyForm);
+
+
+void __RPC_STUB IAppIdAuthority_GenerateReferenceKey_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IAppIdAuthority_CreateDefinition_Proxy(
+ IAppIdAuthority * This,
+ /* [retval][out] */ IDefinitionAppId **ppNewIdentity);
+
+
+void __RPC_STUB IAppIdAuthority_CreateDefinition_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IAppIdAuthority_CreateReference_Proxy(
+ IAppIdAuthority * This,
+ /* [retval][out] */ IReferenceAppId **ppNewIdentity);
+
+
+void __RPC_STUB IAppIdAuthority_CreateReference_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IAppIdAuthority_INTERFACE_DEFINED__ */
+
+
+#ifndef __IEnumSTORE_CATEGORY_INTERFACE_DEFINED__
+#define __IEnumSTORE_CATEGORY_INTERFACE_DEFINED__
+
+/* interface IEnumSTORE_CATEGORY */
+/* [local][unique][uuid][object] */
+
+
+EXTERN_C const IID IID_IEnumSTORE_CATEGORY;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("b840a2f5-a497-4a6d-9038-cd3ec2fbd222")
+ IEnumSTORE_CATEGORY : public IUnknown
+ {
+ public:
+ virtual HRESULT STDMETHODCALLTYPE Next(
+ /* [in] */ ULONG celt,
+ /* [length_is][size_is][out] */ STORE_CATEGORY rgElements[ ],
+ /* [out] */ ULONG *pulFetched) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Skip(
+ /* [in] */ ULONG ulElements) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Reset( void) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Clone(
+ /* [out] */ IEnumSTORE_CATEGORY **ppIEnumSTORE_CATEGORY) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IEnumSTORE_CATEGORYVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IEnumSTORE_CATEGORY * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IEnumSTORE_CATEGORY * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IEnumSTORE_CATEGORY * This);
+
+ HRESULT ( STDMETHODCALLTYPE *Next )(
+ IEnumSTORE_CATEGORY * This,
+ /* [in] */ ULONG celt,
+ /* [length_is][size_is][out] */ STORE_CATEGORY rgElements[ ],
+ /* [out] */ ULONG *pulFetched);
+
+ HRESULT ( STDMETHODCALLTYPE *Skip )(
+ IEnumSTORE_CATEGORY * This,
+ /* [in] */ ULONG ulElements);
+
+ HRESULT ( STDMETHODCALLTYPE *Reset )(
+ IEnumSTORE_CATEGORY * This);
+
+ HRESULT ( STDMETHODCALLTYPE *Clone )(
+ IEnumSTORE_CATEGORY * This,
+ /* [out] */ IEnumSTORE_CATEGORY **ppIEnumSTORE_CATEGORY);
+
+ END_INTERFACE
+ } IEnumSTORE_CATEGORYVtbl;
+
+ interface IEnumSTORE_CATEGORY
+ {
+ CONST_VTBL struct IEnumSTORE_CATEGORYVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IEnumSTORE_CATEGORY_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IEnumSTORE_CATEGORY_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IEnumSTORE_CATEGORY_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IEnumSTORE_CATEGORY_Next(This,celt,rgElements,pulFetched) \
+ (This)->lpVtbl -> Next(This,celt,rgElements,pulFetched)
+
+#define IEnumSTORE_CATEGORY_Skip(This,ulElements) \
+ (This)->lpVtbl -> Skip(This,ulElements)
+
+#define IEnumSTORE_CATEGORY_Reset(This) \
+ (This)->lpVtbl -> Reset(This)
+
+#define IEnumSTORE_CATEGORY_Clone(This,ppIEnumSTORE_CATEGORY) \
+ (This)->lpVtbl -> Clone(This,ppIEnumSTORE_CATEGORY)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+HRESULT STDMETHODCALLTYPE IEnumSTORE_CATEGORY_Next_Proxy(
+ IEnumSTORE_CATEGORY * This,
+ /* [in] */ ULONG celt,
+ /* [length_is][size_is][out] */ STORE_CATEGORY rgElements[ ],
+ /* [out] */ ULONG *pulFetched);
+
+
+void __RPC_STUB IEnumSTORE_CATEGORY_Next_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IEnumSTORE_CATEGORY_Skip_Proxy(
+ IEnumSTORE_CATEGORY * This,
+ /* [in] */ ULONG ulElements);
+
+
+void __RPC_STUB IEnumSTORE_CATEGORY_Skip_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IEnumSTORE_CATEGORY_Reset_Proxy(
+ IEnumSTORE_CATEGORY * This);
+
+
+void __RPC_STUB IEnumSTORE_CATEGORY_Reset_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IEnumSTORE_CATEGORY_Clone_Proxy(
+ IEnumSTORE_CATEGORY * This,
+ /* [out] */ IEnumSTORE_CATEGORY **ppIEnumSTORE_CATEGORY);
+
+
+void __RPC_STUB IEnumSTORE_CATEGORY_Clone_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IEnumSTORE_CATEGORY_INTERFACE_DEFINED__ */
+
+
+#ifndef __IEnumSTORE_CATEGORY_SUBCATEGORY_INTERFACE_DEFINED__
+#define __IEnumSTORE_CATEGORY_SUBCATEGORY_INTERFACE_DEFINED__
+
+/* interface IEnumSTORE_CATEGORY_SUBCATEGORY */
+/* [local][unique][uuid][object] */
+
+
+EXTERN_C const IID IID_IEnumSTORE_CATEGORY_SUBCATEGORY;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("19be1967-b2fc-4dc1-9627-f3cb6305d2a7")
+ IEnumSTORE_CATEGORY_SUBCATEGORY : public IUnknown
+ {
+ public:
+ virtual HRESULT STDMETHODCALLTYPE Next(
+ /* [in] */ ULONG celt,
+ /* [length_is][size_is][out] */ STORE_CATEGORY_SUBCATEGORY rgElements[ ],
+ /* [out] */ ULONG *pulFetched) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Skip(
+ /* [in] */ ULONG ulElements) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Reset( void) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Clone(
+ /* [out] */ IEnumSTORE_CATEGORY_SUBCATEGORY **ppIEnumSTORE_CATEGORY_SUBCATEGORY) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IEnumSTORE_CATEGORY_SUBCATEGORYVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IEnumSTORE_CATEGORY_SUBCATEGORY * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IEnumSTORE_CATEGORY_SUBCATEGORY * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IEnumSTORE_CATEGORY_SUBCATEGORY * This);
+
+ HRESULT ( STDMETHODCALLTYPE *Next )(
+ IEnumSTORE_CATEGORY_SUBCATEGORY * This,
+ /* [in] */ ULONG celt,
+ /* [length_is][size_is][out] */ STORE_CATEGORY_SUBCATEGORY rgElements[ ],
+ /* [out] */ ULONG *pulFetched);
+
+ HRESULT ( STDMETHODCALLTYPE *Skip )(
+ IEnumSTORE_CATEGORY_SUBCATEGORY * This,
+ /* [in] */ ULONG ulElements);
+
+ HRESULT ( STDMETHODCALLTYPE *Reset )(
+ IEnumSTORE_CATEGORY_SUBCATEGORY * This);
+
+ HRESULT ( STDMETHODCALLTYPE *Clone )(
+ IEnumSTORE_CATEGORY_SUBCATEGORY * This,
+ /* [out] */ IEnumSTORE_CATEGORY_SUBCATEGORY **ppIEnumSTORE_CATEGORY_SUBCATEGORY);
+
+ END_INTERFACE
+ } IEnumSTORE_CATEGORY_SUBCATEGORYVtbl;
+
+ interface IEnumSTORE_CATEGORY_SUBCATEGORY
+ {
+ CONST_VTBL struct IEnumSTORE_CATEGORY_SUBCATEGORYVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IEnumSTORE_CATEGORY_SUBCATEGORY_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IEnumSTORE_CATEGORY_SUBCATEGORY_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IEnumSTORE_CATEGORY_SUBCATEGORY_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IEnumSTORE_CATEGORY_SUBCATEGORY_Next(This,celt,rgElements,pulFetched) \
+ (This)->lpVtbl -> Next(This,celt,rgElements,pulFetched)
+
+#define IEnumSTORE_CATEGORY_SUBCATEGORY_Skip(This,ulElements) \
+ (This)->lpVtbl -> Skip(This,ulElements)
+
+#define IEnumSTORE_CATEGORY_SUBCATEGORY_Reset(This) \
+ (This)->lpVtbl -> Reset(This)
+
+#define IEnumSTORE_CATEGORY_SUBCATEGORY_Clone(This,ppIEnumSTORE_CATEGORY_SUBCATEGORY) \
+ (This)->lpVtbl -> Clone(This,ppIEnumSTORE_CATEGORY_SUBCATEGORY)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+HRESULT STDMETHODCALLTYPE IEnumSTORE_CATEGORY_SUBCATEGORY_Next_Proxy(
+ IEnumSTORE_CATEGORY_SUBCATEGORY * This,
+ /* [in] */ ULONG celt,
+ /* [length_is][size_is][out] */ STORE_CATEGORY_SUBCATEGORY rgElements[ ],
+ /* [out] */ ULONG *pulFetched);
+
+
+void __RPC_STUB IEnumSTORE_CATEGORY_SUBCATEGORY_Next_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IEnumSTORE_CATEGORY_SUBCATEGORY_Skip_Proxy(
+ IEnumSTORE_CATEGORY_SUBCATEGORY * This,
+ /* [in] */ ULONG ulElements);
+
+
+void __RPC_STUB IEnumSTORE_CATEGORY_SUBCATEGORY_Skip_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IEnumSTORE_CATEGORY_SUBCATEGORY_Reset_Proxy(
+ IEnumSTORE_CATEGORY_SUBCATEGORY * This);
+
+
+void __RPC_STUB IEnumSTORE_CATEGORY_SUBCATEGORY_Reset_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IEnumSTORE_CATEGORY_SUBCATEGORY_Clone_Proxy(
+ IEnumSTORE_CATEGORY_SUBCATEGORY * This,
+ /* [out] */ IEnumSTORE_CATEGORY_SUBCATEGORY **ppIEnumSTORE_CATEGORY_SUBCATEGORY);
+
+
+void __RPC_STUB IEnumSTORE_CATEGORY_SUBCATEGORY_Clone_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IEnumSTORE_CATEGORY_SUBCATEGORY_INTERFACE_DEFINED__ */
+
+
+#ifndef __IEnumSTORE_CATEGORY_INSTANCE_INTERFACE_DEFINED__
+#define __IEnumSTORE_CATEGORY_INSTANCE_INTERFACE_DEFINED__
+
+/* interface IEnumSTORE_CATEGORY_INSTANCE */
+/* [local][unique][uuid][object] */
+
+
+EXTERN_C const IID IID_IEnumSTORE_CATEGORY_INSTANCE;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("5ba7cb30-8508-4114-8c77-262fcda4fadb")
+ IEnumSTORE_CATEGORY_INSTANCE : public IUnknown
+ {
+ public:
+ virtual HRESULT STDMETHODCALLTYPE Next(
+ /* [in] */ ULONG ulElements,
+ /* [length_is][size_is][out] */ STORE_CATEGORY_INSTANCE rgInstances[ ],
+ /* [out] */ ULONG *pulFetched) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Skip(
+ /* [in] */ ULONG ulElements) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Reset( void) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Clone(
+ /* [out] */ IEnumSTORE_CATEGORY_INSTANCE **ppIEnumSTORE_CATEGORY_INSTANCE) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IEnumSTORE_CATEGORY_INSTANCEVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IEnumSTORE_CATEGORY_INSTANCE * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IEnumSTORE_CATEGORY_INSTANCE * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IEnumSTORE_CATEGORY_INSTANCE * This);
+
+ HRESULT ( STDMETHODCALLTYPE *Next )(
+ IEnumSTORE_CATEGORY_INSTANCE * This,
+ /* [in] */ ULONG ulElements,
+ /* [length_is][size_is][out] */ STORE_CATEGORY_INSTANCE rgInstances[ ],
+ /* [out] */ ULONG *pulFetched);
+
+ HRESULT ( STDMETHODCALLTYPE *Skip )(
+ IEnumSTORE_CATEGORY_INSTANCE * This,
+ /* [in] */ ULONG ulElements);
+
+ HRESULT ( STDMETHODCALLTYPE *Reset )(
+ IEnumSTORE_CATEGORY_INSTANCE * This);
+
+ HRESULT ( STDMETHODCALLTYPE *Clone )(
+ IEnumSTORE_CATEGORY_INSTANCE * This,
+ /* [out] */ IEnumSTORE_CATEGORY_INSTANCE **ppIEnumSTORE_CATEGORY_INSTANCE);
+
+ END_INTERFACE
+ } IEnumSTORE_CATEGORY_INSTANCEVtbl;
+
+ interface IEnumSTORE_CATEGORY_INSTANCE
+ {
+ CONST_VTBL struct IEnumSTORE_CATEGORY_INSTANCEVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IEnumSTORE_CATEGORY_INSTANCE_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IEnumSTORE_CATEGORY_INSTANCE_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IEnumSTORE_CATEGORY_INSTANCE_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IEnumSTORE_CATEGORY_INSTANCE_Next(This,ulElements,rgInstances,pulFetched) \
+ (This)->lpVtbl -> Next(This,ulElements,rgInstances,pulFetched)
+
+#define IEnumSTORE_CATEGORY_INSTANCE_Skip(This,ulElements) \
+ (This)->lpVtbl -> Skip(This,ulElements)
+
+#define IEnumSTORE_CATEGORY_INSTANCE_Reset(This) \
+ (This)->lpVtbl -> Reset(This)
+
+#define IEnumSTORE_CATEGORY_INSTANCE_Clone(This,ppIEnumSTORE_CATEGORY_INSTANCE) \
+ (This)->lpVtbl -> Clone(This,ppIEnumSTORE_CATEGORY_INSTANCE)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+HRESULT STDMETHODCALLTYPE IEnumSTORE_CATEGORY_INSTANCE_Next_Proxy(
+ IEnumSTORE_CATEGORY_INSTANCE * This,
+ /* [in] */ ULONG ulElements,
+ /* [length_is][size_is][out] */ STORE_CATEGORY_INSTANCE rgInstances[ ],
+ /* [out] */ ULONG *pulFetched);
+
+
+void __RPC_STUB IEnumSTORE_CATEGORY_INSTANCE_Next_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IEnumSTORE_CATEGORY_INSTANCE_Skip_Proxy(
+ IEnumSTORE_CATEGORY_INSTANCE * This,
+ /* [in] */ ULONG ulElements);
+
+
+void __RPC_STUB IEnumSTORE_CATEGORY_INSTANCE_Skip_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IEnumSTORE_CATEGORY_INSTANCE_Reset_Proxy(
+ IEnumSTORE_CATEGORY_INSTANCE * This);
+
+
+void __RPC_STUB IEnumSTORE_CATEGORY_INSTANCE_Reset_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IEnumSTORE_CATEGORY_INSTANCE_Clone_Proxy(
+ IEnumSTORE_CATEGORY_INSTANCE * This,
+ /* [out] */ IEnumSTORE_CATEGORY_INSTANCE **ppIEnumSTORE_CATEGORY_INSTANCE);
+
+
+void __RPC_STUB IEnumSTORE_CATEGORY_INSTANCE_Clone_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IEnumSTORE_CATEGORY_INSTANCE_INTERFACE_DEFINED__ */
+
+
+#ifndef __IStore_INTERFACE_DEFINED__
+#define __IStore_INTERFACE_DEFINED__
+
+/* interface IStore */
+/* [local][unique][uuid][object] */
+
+typedef struct _STORE_SET_CANONICALIZATION_CONTEXT
+ {
+ DWORD cbSize;
+ DWORD dwFlags;
+ LPCWSTR pszBaseAddressesFilePath;
+ LPCWSTR pszExportsFilePath;
+ } STORE_SET_CANONICALIZATION_CONTEXT;
+
+typedef struct _STORE_SET_CANONICALIZATION_CONTEXT *PSTORE_SET_CANONICALIZATION_CONTEXT;
+
+typedef const STORE_SET_CANONICALIZATION_CONTEXT *PCSTORE_SET_CANONICALIZATION_CONTEXT;
+
+typedef struct _STORE_STAGE_COMPONENT
+ {
+ DWORD cbSize;
+ DWORD dwFlags;
+ IDefinitionAppId *pIApplicationIdentity;
+ IDefinitionIdentity *pIComponentIdentity;
+ LPCWSTR pszManifestSourcePath;
+ } STORE_STAGE_COMPONENT;
+
+typedef struct _STORE_STAGE_COMPONENT *PSTORE_STAGE_COMPONENT;
+
+typedef const STORE_STAGE_COMPONENT *PCSTORE_STAGE_COMPONENT;
+
+/* [v1_enum] */
+enum _STORE_STAGE_COMPONENT_DISPOSITIONS
+ { ISTORE_STAGE_COMPONENT_DISPOSITION_INSTALLED = 0x1,
+ ISTORE_STAGE_COMPONENT_DISPOSITION_REFRESHED_BITS = 0x2,
+ ISTORE_STAGE_COMPONENT_DISPOSITION_ALREADY_INSTALLED = 0x3
+ } ;
+typedef struct _STORE_STAGE_COMPONENT_FILE
+ {
+ DWORD cbSize;
+ DWORD dwFlags;
+ IDefinitionAppId *pApplication;
+ IDefinitionIdentity *pMemberComponent;
+ LPCWSTR pszComponentRelativePath;
+ LPCWSTR pszSourceFileName;
+ } STORE_STAGE_COMPONENT_FILE;
+
+typedef struct _STORE_STAGE_COMPONENT_FILE *PSTORE_STAGE_COMPONENT_FILE;
+
+typedef const STORE_STAGE_COMPONENT_FILE *PCSTORE_STAGE_COMPONENT_FILE;
+
+/* [v1_enum] */
+enum _STORE_STAGE_COMPONENT_FILE_DISPOSITIONS
+ { ISTORE_STAGE_COMPONENT_FILE_DISPOSITION_INSTALLED = 0x1,
+ ISTORE_STAGE_COMPONENT_FILE_DISPOSITION_REFRESHED_BITS = 0x2,
+ ISTORE_STAGE_COMPONENT_FILE_DISPOSITION_ALREADY_INSTALLED = 0x3
+ } ;
+/* [v1_enum] */
+enum _STORE_PIN_DEPLOYMENT_FLAGS
+ { STORE_PIN_DEPLOYMENT_FLAG_NEVER_EXPIRES = 0x1
+ } ;
+typedef struct _STORE_PIN_DEPLOYMENT
+ {
+ DWORD cbSize;
+ DWORD dwFlags;
+ IDefinitionAppId *pIApplicationIdentity;
+ ULONGLONG ExpirationTime;
+ PCSTORE_ASSEMBLY_INSTALLATION_REFERENCE pReferenceTrack;
+ } STORE_PIN_DEPLOYMENT;
+
+typedef struct _STORE_PIN_DEPLOYMENT *PSTORE_PIN_DEPLOYMENT;
+
+typedef const STORE_PIN_DEPLOYMENT *PCSTORE_PIN_DEPLOYMENT;
+
+/* [v1_enum] */
+enum _STORE_PIN_DEPLOYMENT_DISPOSITIONS
+ { ISTORE_PIN_DEPLOYMENT_DISPOSITION_PINNED = 0x1
+ } ;
+typedef struct _STORE_UNPIN_DEPLOYMENT
+ {
+ DWORD cbSize;
+ DWORD dwFlags;
+ IDefinitionAppId *pIApplicationIdentity;
+ PCSTORE_ASSEMBLY_INSTALLATION_REFERENCE pReferenceTrack;
+ } STORE_UNPIN_DEPLOYMENT;
+
+typedef struct _STORE_UNPIN_DEPLOYMENT *PSTORE_UNPIN_DEPLOYMENT;
+
+typedef const STORE_UNPIN_DEPLOYMENT *PCSTORE_UNPIN_DEPLOYMENT;
+
+/* [v1_enum] */
+enum _STORE_UNPIN_DEPLOYMENT_DISPOSITIONS
+ { ISTORE_UNPIN_DEPLOYMENT_DISPOSITION_REMOVED = 0x1
+ } ;
+/* [v1_enum] */
+enum _STORE_INSTALL_DEPLOYMENT_FLAGS
+ { STORE_INSTALL_DEPLOYMENT_FLAG_UNINSTALL_OTHERS = 0x1
+ } ;
+typedef struct _STORE_INSTALL_DEPLOYMENT
+ {
+ DWORD cbSize;
+ DWORD dwFlags;
+ IDefinitionAppId *pIApplicationIdentity;
+ PCSTORE_ASSEMBLY_INSTALLATION_REFERENCE pReferenceTrack;
+ } STORE_INSTALL_DEPLOYMENT;
+
+typedef struct _STORE_INSTALL_DEPLOYMENT *PSTORE_INSTALL_DEPLOYMENT;
+
+typedef const STORE_INSTALL_DEPLOYMENT *PCSTORE_INSTALL_DEPLOYMENT;
+
+/* [v1_enum] */
+enum _STORE_INSTALL_DEPLOYMENT_DISPOSITIONS
+ { ISTORE_INSTALL_DEPLOYMENT_DISPOSITION_ALREADY_INSTALLED = 0x1,
+ ISTORE_INSTALL_DEPLOYMENT_DISPOSITION_INSTALLED = 0x2
+ } ;
+typedef struct _STORE_UNINSTALL_DEPLOYMENT
+ {
+ DWORD cbSize;
+ DWORD dwFlags;
+ IDefinitionAppId *pIApplicationIdentity;
+ PCSTORE_ASSEMBLY_INSTALLATION_REFERENCE pReferenceTrack;
+ } STORE_UNINSTALL_DEPLOYMENT;
+
+typedef struct _STORE_UNINSTALL_DEPLOYMENT *PSTORE_UNINSTALL_DEPLOYMENT;
+
+typedef const STORE_UNINSTALL_DEPLOYMENT *PCSTORE_UNINSTALL_DEPLOYMENT;
+
+/* [v1_enum] */
+enum _STORE_UNINSTALL_DEPLOYMENT_DISPOSITIONS
+ { ISTORE_UNINSTALL_DEPLOYMENT_DISPOSITION_NOT_EXIST = 0x1,
+ ISTORE_UNINSTALL_DEPLOYMENT_DISPOSITION_UNINSTALLED = 0x2
+ } ;
+typedef struct _STORE_SET_DEPLOYMENT_METADATA_PROPERTY
+ {
+ GUID guidPropertySet;
+ LPCWSTR pszName;
+ SIZE_T nValueSize;
+ /* [length_is][size_is] */ const BYTE *prgbValue;
+ } STORE_SET_DEPLOYMENT_METADATA_PROPERTY;
+
+typedef struct _STORE_SET_DEPLOYMENT_METADATA_PROPERTY *PSTORE_SET_DEPLOYMENT_METADATA_PROPERTY;
+
+typedef const STORE_SET_DEPLOYMENT_METADATA_PROPERTY *PCSTORE_SET_DEPLOYMENT_METADATA_PROPERTY;
+
+typedef struct _STORE_SET_DEPLOYMENT_METADATA
+ {
+ DWORD cbSize;
+ DWORD dwFlags;
+ IDefinitionAppId *pDeploymentIdentity;
+ PCSTORE_ASSEMBLY_INSTALLATION_REFERENCE InstallReference;
+ SIZE_T cPropertiesToTest;
+ /* [length_is][size_is] */ const STORE_SET_DEPLOYMENT_METADATA_PROPERTY *rgPropertiesToTest;
+ SIZE_T cPropertiesToSet;
+ /* [length_is][size_is] */ const STORE_SET_DEPLOYMENT_METADATA_PROPERTY *rgPropertiesToSet;
+ } STORE_SET_DEPLOYMENT_METADATA;
+
+typedef struct _STORE_SET_DEPLOYMENT_METADATA *PSTORE_SET_DEPLOYMENT_METADATA;
+
+typedef const STORE_SET_DEPLOYMENT_METADATA *PCSTORE_SET_DEPLOYMENT_METADATA;
+
+/* [v1_enum] */
+enum _STORE_SET_DEPLOYMENT_METADATA_DISPOSITIONS
+ { ISTORE_SET_DEPLOYMENT_METADATA_DISPOSITION_SET = 0x2
+ } ;
+/* [v1_enum] */
+enum _STORE_SCAVENGE_FLAGS
+ { STORE_SCAVENGE_FLAG_DEEP_CLEAN = 0,
+ STORE_SCAVENGE_FLAG_LIGHT_ONLY = 0x1,
+ STORE_SCAVENGE_FLAG_LIMIT_SIZE = 0x2,
+ STORE_SCAVENGE_FLAG_LIMIT_TIME = 0x4,
+ STORE_SCAVENGE_FLAG_LIMIT_COUNT = 0x8
+ } ;
+typedef struct _STORE_SCAVENGE
+ {
+ DWORD cbSize;
+ DWORD dwFlags;
+ ULONGLONG SizeReclaimationLimit;
+ ULONGLONG RuntimeLimit;
+ DWORD ComponentCountLimit;
+ } STORE_SCAVENGE;
+
+typedef struct _STORE_SCAVENGE *PSTORE_SCAVENGE;
+
+typedef const STORE_SCAVENGE *PCSTORE_SCAVENGE;
+
+/* [v1_enum] */
+enum _STORE_SCAVENGE_DISPOSITIONS
+ { ISTORE_SCAVENGE_DISPOSITION_SCAVENGED = 0x1
+ } ;
+typedef /* [public][public][public][public][public][v1_enum] */
+enum __MIDL_IStore_0001
+ { STORE_TXN_OP_INVALID = 0,
+ STORE_TXN_OP_SET_CANONICALIZATION_CONTEXT = 14,
+ STORE_TXN_OP_STAGE_COMPONENT = 20,
+ STORE_TXN_OP_PIN_DEPLOYMENT = 21,
+ STORE_TXN_OP_UNPIN_DEPLOYMENT = 22,
+ STORE_TXN_OP_STAGE_COMPONENT_FILE = 23,
+ STORE_TXN_OP_INSTALL_DEPLOYMENT = 24,
+ STORE_TXN_OP_UNINSTALL_DEPLOYMENT = 25,
+ STORE_TXN_OP_SET_DEPLOYMENT_METADATA = 26,
+ STORE_TXN_OP_SCAVENGE = 27
+ } STORE_TXN_OP_TYPE;
+
+typedef /* [switch_type] */ union _STORE_TXN_OPERATION_DATA
+ {
+ /* [case()] */ PCSTORE_SET_CANONICALIZATION_CONTEXT SetCanonicalizationContext;
+ /* [case()] */ PCSTORE_STAGE_COMPONENT StageComponent;
+ /* [case()] */ PCSTORE_STAGE_COMPONENT_FILE StageComponentFile;
+ /* [case()] */ PCSTORE_PIN_DEPLOYMENT PinDeployment;
+ /* [case()] */ PCSTORE_UNPIN_DEPLOYMENT UnpinDeployment;
+ /* [case()] */ PCSTORE_INSTALL_DEPLOYMENT InstallDeployment;
+ /* [case()] */ PCSTORE_UNINSTALL_DEPLOYMENT UninstallDeployment;
+ /* [case()] */ PCSTORE_SET_DEPLOYMENT_METADATA SetDeploymentMetadata;
+ /* [case()] */ PCSTORE_SCAVENGE Scavenge;
+ } STORE_TXN_OPERATION_DATA;
+
+typedef /* [switch_type] */ union _STORE_TXN_OPERATION_DATA *PSTORE_TXN_OPERATION_DATA;
+
+C_ASSERT(sizeof(STORE_TXN_OPERATION_DATA) == sizeof(PVOID));
+typedef struct _STORE_TXN_OPERATION
+ {
+ STORE_TXN_OP_TYPE Operation;
+ /* [switch_is] */ STORE_TXN_OPERATION_DATA Data;
+ } STORE_TXN_OPERATION;
+
+typedef struct _STORE_TXN_OPERATION *PSTORE_TXN_OPERATION;
+
+typedef const STORE_TXN_OPERATION *PCSTORE_TXN_OPERATION;
+
+/* [v1_enum] */
+enum _ISTORE_BIND_REFERENCE_TO_ASSEMBLY_FLAGS
+ { ISTORE_BIND_REFERENCE_TO_ASSEMBLY_FLAG_FORCE_LIBRARY_SEMANTICS = 0x1
+ } ;
+/* [v1_enum] */
+enum _ISTORE_BIND_DEFINITIONS_DISPOSITIONS
+ { ISTORE_BIND_DEFINITIONS_DISPOSITION_STATE_UNDEFINED = 0,
+ ISTORE_BIND_DEFINITIONS_DISPOSITION_STATE_UNTOUCHED = 1,
+ ISTORE_BIND_DEFINITIONS_DISPOSITION_STATE_RESOLVED = 2,
+ ISTORE_BIND_DEFINITIONS_DISPOSITION_STATE_UNRESOLVED = 3,
+ ISTORE_BIND_DEFINITIONS_DISPOSITION_STATE_MASK = 0xffff,
+ ISTORE_BIND_DEFINITIONS_DISPOSITION_FLAG_POLICY_WAS_APPLIED = 0x10000
+ } ;
+/* [v1_enum] */
+enum _ISTORE_BINDING_RESULT_DISPOSITION_STATES
+ { ISTORE_BINDING_RESULT_DISPOSITION_STATE_UNDEFINED = 0,
+ ISTORE_BINDING_RESULT_DISPOSITION_STATE_UNTOUCHED = 1,
+ ISTORE_BINDING_RESULT_DISPOSITION_STATE_RESOLVED = 2,
+ ISTORE_BINDING_RESULT_DISPOSITION_STATE_UNRESOLVED = 3,
+ ISTORE_BINDING_RESULT_DISPOSITION_STATE_MASK = 0xffff,
+ ISTORE_BINDING_RESULT_DISPOSITION_FLAG_POLICY_WAS_APPLIED = 0x10000
+ } ;
+typedef struct _ISTORE_BINDING_RESULT
+ {
+ DWORD dwFlags;
+ ULONG ulDisposition;
+ COMPONENT_VERSION cvVersion;
+ GUID guidCacheCoherencyGuid;
+ PVOID pvReserved;
+ } ISTORE_BINDING_RESULT;
+
+typedef struct _ISTORE_BINDING_RESULT *PISTORE_BINDING_RESULT;
+
+typedef const ISTORE_BINDING_RESULT *PCISTORE_BINDING_RESULT;
+
+/* [v1_enum] */
+enum _ISTORE_ENUM_ASSEMBLIES_FLAGS
+ { ISTORE_ENUM_ASSEMBLIES_FLAG_LIMIT_TO_VISIBLE_ONLY = 0x1,
+ ISTORE_ENUM_ASSEMBLIES_FLAG_MATCH_SERVICING = 0x2,
+ ISTORE_ENUM_ASSEMBLIES_FLAG_FORCE_LIBRARY_SEMANTICS = 0x4
+ } ;
+/* [v1_enum] */
+enum _ISTORE_ENUM_FILES_FLAGS
+ { ISTORE_ENUM_FILES_FLAG_INCLUDE_INSTALLED_FILES = 0x1,
+ ISTORE_ENUM_FILES_FLAG_INCLUDE_MISSING_FILES = 0x2
+ } ;
+/* [v1_enum] */
+enum _ISTORE_ENUM_PRIVATE_FILES_FLAGS
+ { ISTORE_ENUM_PRIVATE_FILES_FLAG_INCLUDE_INSTALLED_FILES = 0x1,
+ ISTORE_ENUM_PRIVATE_FILES_FLAG_INCLUDE_MISSING_FILES = 0x2
+ } ;
+/* [v1_enum] */
+enum _ISTORE_ENUM_INSTALLER_DEPLOYMENT_METADATA
+ { ISTORE_ENUM_INSTALLER_DEPLOYMENT_METADATA_INCLUDE_FAMILIES = 0x1,
+ ISTORE_ENUM_INSTALLER_DEPLOYMENT_METADATA_INCLUDE_SPECIFICS = 0x2
+ } ;
+
+EXTERN_C const IID IID_IStore;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("a5c62f6d-5e3e-4cd9-b345-6b281d7a1d1e")
+ IStore : public IUnknown
+ {
+ public:
+ virtual HRESULT STDMETHODCALLTYPE Transact(
+ /* [in] */ SIZE_T cOperation,
+ /* [size_is][in] */ const STORE_TXN_OPERATION rgOperations[ ],
+ /* [size_is][out] */ ULONG rgDispositions[ ],
+ /* [size_is][out] */ HRESULT rgResults[ ]) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE BindReferenceToAssembly(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IReferenceIdentity *pIReferenceIdentity,
+ /* [in] */ ULONG cDeploymentsToIgnore,
+ /* [length_is][in] */ IDefinitionIdentity *rgpIDefinitionIdentity_DeploymentsToIgnore[ ],
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ IUnknown **ppAssembly) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE CalculateDelimiterOfDeploymentsBasedOnQuota(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ SIZE_T cDeployments,
+ /* [length_is][in] */ IDefinitionAppId *rgpIDefinitionAppId_Deployments[ ],
+ /* [in] */ PCSTORE_ASSEMBLY_INSTALLATION_REFERENCE pReference,
+ /* [in] */ ULONGLONG ulonglongQuote,
+ /* [out] */ SIZE_T *Delimiter,
+ /* [out] */ ULONGLONG *SizeSharedWithExternalDeployment,
+ /* [out] */ ULONGLONG *SizeConsumedByInputDeploymentArray) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE BindDefinitions(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ SIZE_T DefinitionCount,
+ /* [length_is][in] */ IDefinitionIdentity *rgpIDefinitionIdentity[ ],
+ /* [in] */ ULONG cDeploymentsToIgnore,
+ /* [length_is][in] */ IDefinitionIdentity *rgpIDefinitionIdentity_DeploymentsToIgnore[ ],
+ /* [size_is][out] */ ISTORE_BINDING_RESULT rgBindingResults[ ]) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE GetAssemblyInformation(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ IUnknown **ppManifest) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE EnumAssemblies(
+ /* [in] */ DWORD dwFlags,
+ /* [unique][in] */ IReferenceIdentity *pIReferenceIdentity_ToMatch,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ IUnknown **ppQueryResult) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE EnumFiles(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionIdentity *pDefinitionIdentity,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ IUnknown **ppQueryResult) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE EnumInstallationReferences(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionIdentity *pDefinitionIdentity,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ IUnknown **ppQueryResults) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE LockAssemblyPath(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionIdentity *pDefinitionIdentity,
+ /* [out] */ LPVOID *ppvCookie,
+ /* [out] */ LPWSTR *ppszPayloadRoot) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE ReleaseAssemblyPath(
+ /* [in] */ LPVOID pvCookie) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE QueryChangeID(
+ /* [in] */ IDefinitionIdentity *pDefinitionIdentity,
+ /* [out] */ ULONGLONG *pullChangeId) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE EnumCategories(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IReferenceIdentity *pIReferenceIdentity_ToMatch,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ IUnknown **ppIUnknown) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE EnumSubcategories(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionIdentity *pCategoryId,
+ /* [in] */ LPCWSTR pszSubcategoryPathPattern,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ IUnknown **ppIUnknown) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE EnumCategoryInstances(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionIdentity *pCategoryId,
+ /* [in] */ LPCWSTR pszSubcategoryPath,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ IUnknown **ppUnknown) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE GetDeploymentProperty(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionAppId *pDeploymentInPackage,
+ /* [in] */ PCSTORE_ASSEMBLY_INSTALLATION_REFERENCE InstallReference,
+ /* [in] */ REFCLSID PropertySet,
+ /* [in] */ LPCWSTR pcwszPropertyName,
+ /* [retval][out] */ BLOB *PropertyValue) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE LockApplicationPath(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionAppId *pIdentity,
+ /* [out] */ LPVOID *ppvCookie,
+ /* [out] */ LPWSTR *ppszPayloadRoot) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE ReleaseApplicationPath(
+ /* [in] */ LPVOID Cookie) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE EnumPrivateFiles(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionAppId *pApplicationId,
+ /* [in] */ IDefinitionIdentity *pDefinitionIdentity,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ IUnknown **ppQueryResult) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE EnumInstallerDeploymentMetadata(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ PCSTORE_ASSEMBLY_INSTALLATION_REFERENCE pReference,
+ /* [in] */ IReferenceAppId *pDeploymentFilter,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ IUnknown **ppQueryResult) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE EnumInstallerDeploymentMetadataProperties(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ PCSTORE_ASSEMBLY_INSTALLATION_REFERENCE pReference,
+ /* [in] */ IDefinitionAppId *pAppidDeployment,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ IUnknown **ppQueryResult) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IStoreVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IStore * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IStore * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IStore * This);
+
+ HRESULT ( STDMETHODCALLTYPE *Transact )(
+ IStore * This,
+ /* [in] */ SIZE_T cOperation,
+ /* [size_is][in] */ const STORE_TXN_OPERATION rgOperations[ ],
+ /* [size_is][out] */ ULONG rgDispositions[ ],
+ /* [size_is][out] */ HRESULT rgResults[ ]);
+
+ HRESULT ( STDMETHODCALLTYPE *BindReferenceToAssembly )(
+ IStore * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IReferenceIdentity *pIReferenceIdentity,
+ /* [in] */ ULONG cDeploymentsToIgnore,
+ /* [length_is][in] */ IDefinitionIdentity *rgpIDefinitionIdentity_DeploymentsToIgnore[ ],
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ IUnknown **ppAssembly);
+
+ HRESULT ( STDMETHODCALLTYPE *CalculateDelimiterOfDeploymentsBasedOnQuota )(
+ IStore * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ SIZE_T cDeployments,
+ /* [length_is][in] */ IDefinitionAppId *rgpIDefinitionAppId_Deployments[ ],
+ /* [in] */ PCSTORE_ASSEMBLY_INSTALLATION_REFERENCE pReference,
+ /* [in] */ ULONGLONG ulonglongQuote,
+ /* [out] */ SIZE_T *Delimiter,
+ /* [out] */ ULONGLONG *SizeSharedWithExternalDeployment,
+ /* [out] */ ULONGLONG *SizeConsumedByInputDeploymentArray);
+
+ HRESULT ( STDMETHODCALLTYPE *BindDefinitions )(
+ IStore * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ SIZE_T DefinitionCount,
+ /* [length_is][in] */ IDefinitionIdentity *rgpIDefinitionIdentity[ ],
+ /* [in] */ ULONG cDeploymentsToIgnore,
+ /* [length_is][in] */ IDefinitionIdentity *rgpIDefinitionIdentity_DeploymentsToIgnore[ ],
+ /* [size_is][out] */ ISTORE_BINDING_RESULT rgBindingResults[ ]);
+
+ HRESULT ( STDMETHODCALLTYPE *GetAssemblyInformation )(
+ IStore * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ IUnknown **ppManifest);
+
+ HRESULT ( STDMETHODCALLTYPE *EnumAssemblies )(
+ IStore * This,
+ /* [in] */ DWORD dwFlags,
+ /* [unique][in] */ IReferenceIdentity *pIReferenceIdentity_ToMatch,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ IUnknown **ppQueryResult);
+
+ HRESULT ( STDMETHODCALLTYPE *EnumFiles )(
+ IStore * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionIdentity *pDefinitionIdentity,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ IUnknown **ppQueryResult);
+
+ HRESULT ( STDMETHODCALLTYPE *EnumInstallationReferences )(
+ IStore * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionIdentity *pDefinitionIdentity,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ IUnknown **ppQueryResults);
+
+ HRESULT ( STDMETHODCALLTYPE *LockAssemblyPath )(
+ IStore * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionIdentity *pDefinitionIdentity,
+ /* [out] */ LPVOID *ppvCookie,
+ /* [out] */ LPWSTR *ppszPayloadRoot);
+
+ HRESULT ( STDMETHODCALLTYPE *ReleaseAssemblyPath )(
+ IStore * This,
+ /* [in] */ LPVOID pvCookie);
+
+ HRESULT ( STDMETHODCALLTYPE *QueryChangeID )(
+ IStore * This,
+ /* [in] */ IDefinitionIdentity *pDefinitionIdentity,
+ /* [out] */ ULONGLONG *pullChangeId);
+
+ HRESULT ( STDMETHODCALLTYPE *EnumCategories )(
+ IStore * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IReferenceIdentity *pIReferenceIdentity_ToMatch,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ IUnknown **ppIUnknown);
+
+ HRESULT ( STDMETHODCALLTYPE *EnumSubcategories )(
+ IStore * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionIdentity *pCategoryId,
+ /* [in] */ LPCWSTR pszSubcategoryPathPattern,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ IUnknown **ppIUnknown);
+
+ HRESULT ( STDMETHODCALLTYPE *EnumCategoryInstances )(
+ IStore * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionIdentity *pCategoryId,
+ /* [in] */ LPCWSTR pszSubcategoryPath,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ IUnknown **ppUnknown);
+
+ HRESULT ( STDMETHODCALLTYPE *GetDeploymentProperty )(
+ IStore * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionAppId *pDeploymentInPackage,
+ /* [in] */ PCSTORE_ASSEMBLY_INSTALLATION_REFERENCE InstallReference,
+ /* [in] */ REFCLSID PropertySet,
+ /* [in] */ LPCWSTR pcwszPropertyName,
+ /* [retval][out] */ BLOB *PropertyValue);
+
+ HRESULT ( STDMETHODCALLTYPE *LockApplicationPath )(
+ IStore * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionAppId *pIdentity,
+ /* [out] */ LPVOID *ppvCookie,
+ /* [out] */ LPWSTR *ppszPayloadRoot);
+
+ HRESULT ( STDMETHODCALLTYPE *ReleaseApplicationPath )(
+ IStore * This,
+ /* [in] */ LPVOID Cookie);
+
+ HRESULT ( STDMETHODCALLTYPE *EnumPrivateFiles )(
+ IStore * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionAppId *pApplicationId,
+ /* [in] */ IDefinitionIdentity *pDefinitionIdentity,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ IUnknown **ppQueryResult);
+
+ HRESULT ( STDMETHODCALLTYPE *EnumInstallerDeploymentMetadata )(
+ IStore * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ PCSTORE_ASSEMBLY_INSTALLATION_REFERENCE pReference,
+ /* [in] */ IReferenceAppId *pDeploymentFilter,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ IUnknown **ppQueryResult);
+
+ HRESULT ( STDMETHODCALLTYPE *EnumInstallerDeploymentMetadataProperties )(
+ IStore * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ PCSTORE_ASSEMBLY_INSTALLATION_REFERENCE pReference,
+ /* [in] */ IDefinitionAppId *pAppidDeployment,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ IUnknown **ppQueryResult);
+
+ END_INTERFACE
+ } IStoreVtbl;
+
+ interface IStore
+ {
+ CONST_VTBL struct IStoreVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IStore_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IStore_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IStore_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IStore_Transact(This,cOperation,rgOperations,rgDispositions,rgResults) \
+ (This)->lpVtbl -> Transact(This,cOperation,rgOperations,rgDispositions,rgResults)
+
+#define IStore_BindReferenceToAssembly(This,dwFlags,pIReferenceIdentity,cDeploymentsToIgnore,rgpIDefinitionIdentity_DeploymentsToIgnore,riid,ppAssembly) \
+ (This)->lpVtbl -> BindReferenceToAssembly(This,dwFlags,pIReferenceIdentity,cDeploymentsToIgnore,rgpIDefinitionIdentity_DeploymentsToIgnore,riid,ppAssembly)
+
+#define IStore_CalculateDelimiterOfDeploymentsBasedOnQuota(This,dwFlags,cDeployments,rgpIDefinitionAppId_Deployments,pReference,ulonglongQuote,Delimiter,SizeSharedWithExternalDeployment,SizeConsumedByInputDeploymentArray) \
+ (This)->lpVtbl -> CalculateDelimiterOfDeploymentsBasedOnQuota(This,dwFlags,cDeployments,rgpIDefinitionAppId_Deployments,pReference,ulonglongQuote,Delimiter,SizeSharedWithExternalDeployment,SizeConsumedByInputDeploymentArray)
+
+#define IStore_BindDefinitions(This,dwFlags,DefinitionCount,rgpIDefinitionIdentity,cDeploymentsToIgnore,rgpIDefinitionIdentity_DeploymentsToIgnore,rgBindingResults) \
+ (This)->lpVtbl -> BindDefinitions(This,dwFlags,DefinitionCount,rgpIDefinitionIdentity,cDeploymentsToIgnore,rgpIDefinitionIdentity_DeploymentsToIgnore,rgBindingResults)
+
+#define IStore_GetAssemblyInformation(This,dwFlags,pIDefinitionIdentity,riid,ppManifest) \
+ (This)->lpVtbl -> GetAssemblyInformation(This,dwFlags,pIDefinitionIdentity,riid,ppManifest)
+
+#define IStore_EnumAssemblies(This,dwFlags,pIReferenceIdentity_ToMatch,riid,ppQueryResult) \
+ (This)->lpVtbl -> EnumAssemblies(This,dwFlags,pIReferenceIdentity_ToMatch,riid,ppQueryResult)
+
+#define IStore_EnumFiles(This,dwFlags,pDefinitionIdentity,riid,ppQueryResult) \
+ (This)->lpVtbl -> EnumFiles(This,dwFlags,pDefinitionIdentity,riid,ppQueryResult)
+
+#define IStore_EnumInstallationReferences(This,dwFlags,pDefinitionIdentity,riid,ppQueryResults) \
+ (This)->lpVtbl -> EnumInstallationReferences(This,dwFlags,pDefinitionIdentity,riid,ppQueryResults)
+
+#define IStore_LockAssemblyPath(This,dwFlags,pDefinitionIdentity,ppvCookie,ppszPayloadRoot) \
+ (This)->lpVtbl -> LockAssemblyPath(This,dwFlags,pDefinitionIdentity,ppvCookie,ppszPayloadRoot)
+
+#define IStore_ReleaseAssemblyPath(This,pvCookie) \
+ (This)->lpVtbl -> ReleaseAssemblyPath(This,pvCookie)
+
+#define IStore_QueryChangeID(This,pDefinitionIdentity,pullChangeId) \
+ (This)->lpVtbl -> QueryChangeID(This,pDefinitionIdentity,pullChangeId)
+
+#define IStore_EnumCategories(This,dwFlags,pIReferenceIdentity_ToMatch,riid,ppIUnknown) \
+ (This)->lpVtbl -> EnumCategories(This,dwFlags,pIReferenceIdentity_ToMatch,riid,ppIUnknown)
+
+#define IStore_EnumSubcategories(This,dwFlags,pCategoryId,pszSubcategoryPathPattern,riid,ppIUnknown) \
+ (This)->lpVtbl -> EnumSubcategories(This,dwFlags,pCategoryId,pszSubcategoryPathPattern,riid,ppIUnknown)
+
+#define IStore_EnumCategoryInstances(This,dwFlags,pCategoryId,pszSubcategoryPath,riid,ppUnknown) \
+ (This)->lpVtbl -> EnumCategoryInstances(This,dwFlags,pCategoryId,pszSubcategoryPath,riid,ppUnknown)
+
+#define IStore_GetDeploymentProperty(This,dwFlags,pDeploymentInPackage,InstallReference,PropertySet,pcwszPropertyName,PropertyValue) \
+ (This)->lpVtbl -> GetDeploymentProperty(This,dwFlags,pDeploymentInPackage,InstallReference,PropertySet,pcwszPropertyName,PropertyValue)
+
+#define IStore_LockApplicationPath(This,dwFlags,pIdentity,ppvCookie,ppszPayloadRoot) \
+ (This)->lpVtbl -> LockApplicationPath(This,dwFlags,pIdentity,ppvCookie,ppszPayloadRoot)
+
+#define IStore_ReleaseApplicationPath(This,Cookie) \
+ (This)->lpVtbl -> ReleaseApplicationPath(This,Cookie)
+
+#define IStore_EnumPrivateFiles(This,dwFlags,pApplicationId,pDefinitionIdentity,riid,ppQueryResult) \
+ (This)->lpVtbl -> EnumPrivateFiles(This,dwFlags,pApplicationId,pDefinitionIdentity,riid,ppQueryResult)
+
+#define IStore_EnumInstallerDeploymentMetadata(This,dwFlags,pReference,pDeploymentFilter,riid,ppQueryResult) \
+ (This)->lpVtbl -> EnumInstallerDeploymentMetadata(This,dwFlags,pReference,pDeploymentFilter,riid,ppQueryResult)
+
+#define IStore_EnumInstallerDeploymentMetadataProperties(This,dwFlags,pReference,pAppidDeployment,riid,ppQueryResult) \
+ (This)->lpVtbl -> EnumInstallerDeploymentMetadataProperties(This,dwFlags,pReference,pAppidDeployment,riid,ppQueryResult)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+HRESULT STDMETHODCALLTYPE IStore_Transact_Proxy(
+ IStore * This,
+ /* [in] */ SIZE_T cOperation,
+ /* [size_is][in] */ const STORE_TXN_OPERATION rgOperations[ ],
+ /* [size_is][out] */ ULONG rgDispositions[ ],
+ /* [size_is][out] */ HRESULT rgResults[ ]);
+
+
+void __RPC_STUB IStore_Transact_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IStore_BindReferenceToAssembly_Proxy(
+ IStore * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IReferenceIdentity *pIReferenceIdentity,
+ /* [in] */ ULONG cDeploymentsToIgnore,
+ /* [length_is][in] */ IDefinitionIdentity *rgpIDefinitionIdentity_DeploymentsToIgnore[ ],
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ IUnknown **ppAssembly);
+
+
+void __RPC_STUB IStore_BindReferenceToAssembly_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IStore_CalculateDelimiterOfDeploymentsBasedOnQuota_Proxy(
+ IStore * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ SIZE_T cDeployments,
+ /* [length_is][in] */ IDefinitionAppId *rgpIDefinitionAppId_Deployments[ ],
+ /* [in] */ PCSTORE_ASSEMBLY_INSTALLATION_REFERENCE pReference,
+ /* [in] */ ULONGLONG ulonglongQuote,
+ /* [out] */ SIZE_T *Delimiter,
+ /* [out] */ ULONGLONG *SizeSharedWithExternalDeployment,
+ /* [out] */ ULONGLONG *SizeConsumedByInputDeploymentArray);
+
+
+void __RPC_STUB IStore_CalculateDelimiterOfDeploymentsBasedOnQuota_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IStore_BindDefinitions_Proxy(
+ IStore * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ SIZE_T DefinitionCount,
+ /* [length_is][in] */ IDefinitionIdentity *rgpIDefinitionIdentity[ ],
+ /* [in] */ ULONG cDeploymentsToIgnore,
+ /* [length_is][in] */ IDefinitionIdentity *rgpIDefinitionIdentity_DeploymentsToIgnore[ ],
+ /* [size_is][out] */ ISTORE_BINDING_RESULT rgBindingResults[ ]);
+
+
+void __RPC_STUB IStore_BindDefinitions_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IStore_GetAssemblyInformation_Proxy(
+ IStore * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ IUnknown **ppManifest);
+
+
+void __RPC_STUB IStore_GetAssemblyInformation_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IStore_EnumAssemblies_Proxy(
+ IStore * This,
+ /* [in] */ DWORD dwFlags,
+ /* [unique][in] */ IReferenceIdentity *pIReferenceIdentity_ToMatch,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ IUnknown **ppQueryResult);
+
+
+void __RPC_STUB IStore_EnumAssemblies_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IStore_EnumFiles_Proxy(
+ IStore * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionIdentity *pDefinitionIdentity,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ IUnknown **ppQueryResult);
+
+
+void __RPC_STUB IStore_EnumFiles_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IStore_EnumInstallationReferences_Proxy(
+ IStore * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionIdentity *pDefinitionIdentity,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ IUnknown **ppQueryResults);
+
+
+void __RPC_STUB IStore_EnumInstallationReferences_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IStore_LockAssemblyPath_Proxy(
+ IStore * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionIdentity *pDefinitionIdentity,
+ /* [out] */ LPVOID *ppvCookie,
+ /* [out] */ LPWSTR *ppszPayloadRoot);
+
+
+void __RPC_STUB IStore_LockAssemblyPath_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IStore_ReleaseAssemblyPath_Proxy(
+ IStore * This,
+ /* [in] */ LPVOID pvCookie);
+
+
+void __RPC_STUB IStore_ReleaseAssemblyPath_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IStore_QueryChangeID_Proxy(
+ IStore * This,
+ /* [in] */ IDefinitionIdentity *pDefinitionIdentity,
+ /* [out] */ ULONGLONG *pullChangeId);
+
+
+void __RPC_STUB IStore_QueryChangeID_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IStore_EnumCategories_Proxy(
+ IStore * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IReferenceIdentity *pIReferenceIdentity_ToMatch,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ IUnknown **ppIUnknown);
+
+
+void __RPC_STUB IStore_EnumCategories_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IStore_EnumSubcategories_Proxy(
+ IStore * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionIdentity *pCategoryId,
+ /* [in] */ LPCWSTR pszSubcategoryPathPattern,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ IUnknown **ppIUnknown);
+
+
+void __RPC_STUB IStore_EnumSubcategories_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IStore_EnumCategoryInstances_Proxy(
+ IStore * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionIdentity *pCategoryId,
+ /* [in] */ LPCWSTR pszSubcategoryPath,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ IUnknown **ppUnknown);
+
+
+void __RPC_STUB IStore_EnumCategoryInstances_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IStore_GetDeploymentProperty_Proxy(
+ IStore * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionAppId *pDeploymentInPackage,
+ /* [in] */ PCSTORE_ASSEMBLY_INSTALLATION_REFERENCE InstallReference,
+ /* [in] */ REFCLSID PropertySet,
+ /* [in] */ LPCWSTR pcwszPropertyName,
+ /* [retval][out] */ BLOB *PropertyValue);
+
+
+void __RPC_STUB IStore_GetDeploymentProperty_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IStore_LockApplicationPath_Proxy(
+ IStore * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionAppId *pIdentity,
+ /* [out] */ LPVOID *ppvCookie,
+ /* [out] */ LPWSTR *ppszPayloadRoot);
+
+
+void __RPC_STUB IStore_LockApplicationPath_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IStore_ReleaseApplicationPath_Proxy(
+ IStore * This,
+ /* [in] */ LPVOID Cookie);
+
+
+void __RPC_STUB IStore_ReleaseApplicationPath_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IStore_EnumPrivateFiles_Proxy(
+ IStore * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionAppId *pApplicationId,
+ /* [in] */ IDefinitionIdentity *pDefinitionIdentity,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ IUnknown **ppQueryResult);
+
+
+void __RPC_STUB IStore_EnumPrivateFiles_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IStore_EnumInstallerDeploymentMetadata_Proxy(
+ IStore * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ PCSTORE_ASSEMBLY_INSTALLATION_REFERENCE pReference,
+ /* [in] */ IReferenceAppId *pDeploymentFilter,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ IUnknown **ppQueryResult);
+
+
+void __RPC_STUB IStore_EnumInstallerDeploymentMetadata_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IStore_EnumInstallerDeploymentMetadataProperties_Proxy(
+ IStore * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ PCSTORE_ASSEMBLY_INSTALLATION_REFERENCE pReference,
+ /* [in] */ IDefinitionAppId *pAppidDeployment,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ IUnknown **ppQueryResult);
+
+
+void __RPC_STUB IStore_EnumInstallerDeploymentMetadataProperties_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IStore_INTERFACE_DEFINED__ */
+
+
+#ifndef __IMigrateStore_INTERFACE_DEFINED__
+#define __IMigrateStore_INTERFACE_DEFINED__
+
+/* interface IMigrateStore */
+/* [local][unique][uuid][object] */
+
+
+EXTERN_C const IID IID_IMigrateStore;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("a5c6a738-fc6a-4204-b4db-b8629b67e655")
+ IMigrateStore : public IUnknown
+ {
+ public:
+ virtual HRESULT STDMETHODCALLTYPE Migrate(
+ /* [in] */ LPVOID pvReserved) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IMigrateStoreVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IMigrateStore * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IMigrateStore * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IMigrateStore * This);
+
+ HRESULT ( STDMETHODCALLTYPE *Migrate )(
+ IMigrateStore * This,
+ /* [in] */ LPVOID pvReserved);
+
+ END_INTERFACE
+ } IMigrateStoreVtbl;
+
+ interface IMigrateStore
+ {
+ CONST_VTBL struct IMigrateStoreVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IMigrateStore_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IMigrateStore_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IMigrateStore_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IMigrateStore_Migrate(This,pvReserved) \
+ (This)->lpVtbl -> Migrate(This,pvReserved)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+HRESULT STDMETHODCALLTYPE IMigrateStore_Migrate_Proxy(
+ IMigrateStore * This,
+ /* [in] */ LPVOID pvReserved);
+
+
+void __RPC_STUB IMigrateStore_Migrate_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IMigrateStore_INTERFACE_DEFINED__ */
+
+
+#ifndef __IEnumSTORE_DEPLOYMENT_METADATA_INTERFACE_DEFINED__
+#define __IEnumSTORE_DEPLOYMENT_METADATA_INTERFACE_DEFINED__
+
+/* interface IEnumSTORE_DEPLOYMENT_METADATA */
+/* [local][unique][uuid][object] */
+
+
+EXTERN_C const IID IID_IEnumSTORE_DEPLOYMENT_METADATA;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("f9fd4090-93db-45c0-af87-624940f19cff")
+ IEnumSTORE_DEPLOYMENT_METADATA : public IUnknown
+ {
+ public:
+ virtual HRESULT STDMETHODCALLTYPE Next(
+ /* [in] */ ULONG celt,
+ /* [length_is][size_is][out] */ IDefinitionAppId *AppIds[ ],
+ /* [optional][out] */ ULONG *pceltFetched) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Skip(
+ /* [in] */ ULONG celt) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Reset( void) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Clone(
+ /* [out] */ IEnumSTORE_DEPLOYMENT_METADATA **ppEnum) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IEnumSTORE_DEPLOYMENT_METADATAVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IEnumSTORE_DEPLOYMENT_METADATA * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IEnumSTORE_DEPLOYMENT_METADATA * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IEnumSTORE_DEPLOYMENT_METADATA * This);
+
+ HRESULT ( STDMETHODCALLTYPE *Next )(
+ IEnumSTORE_DEPLOYMENT_METADATA * This,
+ /* [in] */ ULONG celt,
+ /* [length_is][size_is][out] */ IDefinitionAppId *AppIds[ ],
+ /* [optional][out] */ ULONG *pceltFetched);
+
+ HRESULT ( STDMETHODCALLTYPE *Skip )(
+ IEnumSTORE_DEPLOYMENT_METADATA * This,
+ /* [in] */ ULONG celt);
+
+ HRESULT ( STDMETHODCALLTYPE *Reset )(
+ IEnumSTORE_DEPLOYMENT_METADATA * This);
+
+ HRESULT ( STDMETHODCALLTYPE *Clone )(
+ IEnumSTORE_DEPLOYMENT_METADATA * This,
+ /* [out] */ IEnumSTORE_DEPLOYMENT_METADATA **ppEnum);
+
+ END_INTERFACE
+ } IEnumSTORE_DEPLOYMENT_METADATAVtbl;
+
+ interface IEnumSTORE_DEPLOYMENT_METADATA
+ {
+ CONST_VTBL struct IEnumSTORE_DEPLOYMENT_METADATAVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IEnumSTORE_DEPLOYMENT_METADATA_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IEnumSTORE_DEPLOYMENT_METADATA_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IEnumSTORE_DEPLOYMENT_METADATA_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IEnumSTORE_DEPLOYMENT_METADATA_Next(This,celt,AppIds,pceltFetched) \
+ (This)->lpVtbl -> Next(This,celt,AppIds,pceltFetched)
+
+#define IEnumSTORE_DEPLOYMENT_METADATA_Skip(This,celt) \
+ (This)->lpVtbl -> Skip(This,celt)
+
+#define IEnumSTORE_DEPLOYMENT_METADATA_Reset(This) \
+ (This)->lpVtbl -> Reset(This)
+
+#define IEnumSTORE_DEPLOYMENT_METADATA_Clone(This,ppEnum) \
+ (This)->lpVtbl -> Clone(This,ppEnum)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+HRESULT STDMETHODCALLTYPE IEnumSTORE_DEPLOYMENT_METADATA_Next_Proxy(
+ IEnumSTORE_DEPLOYMENT_METADATA * This,
+ /* [in] */ ULONG celt,
+ /* [length_is][size_is][out] */ IDefinitionAppId *AppIds[ ],
+ /* [optional][out] */ ULONG *pceltFetched);
+
+
+void __RPC_STUB IEnumSTORE_DEPLOYMENT_METADATA_Next_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IEnumSTORE_DEPLOYMENT_METADATA_Skip_Proxy(
+ IEnumSTORE_DEPLOYMENT_METADATA * This,
+ /* [in] */ ULONG celt);
+
+
+void __RPC_STUB IEnumSTORE_DEPLOYMENT_METADATA_Skip_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IEnumSTORE_DEPLOYMENT_METADATA_Reset_Proxy(
+ IEnumSTORE_DEPLOYMENT_METADATA * This);
+
+
+void __RPC_STUB IEnumSTORE_DEPLOYMENT_METADATA_Reset_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IEnumSTORE_DEPLOYMENT_METADATA_Clone_Proxy(
+ IEnumSTORE_DEPLOYMENT_METADATA * This,
+ /* [out] */ IEnumSTORE_DEPLOYMENT_METADATA **ppEnum);
+
+
+void __RPC_STUB IEnumSTORE_DEPLOYMENT_METADATA_Clone_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IEnumSTORE_DEPLOYMENT_METADATA_INTERFACE_DEFINED__ */
+
+
+#ifndef __IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY_INTERFACE_DEFINED__
+#define __IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY_INTERFACE_DEFINED__
+
+/* interface IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY */
+/* [local][unique][uuid][object] */
+
+typedef struct _STORE_DEPLOYMENT_METADATA_PROPERTY
+ {
+ GUID guidPropertySet;
+ LPCWSTR pszName;
+ SIZE_T cbValue;
+ /* [length_is][size_is] */ const BYTE *prgbValue;
+ } STORE_DEPLOYMENT_METADATA_PROPERTY;
+
+typedef struct _STORE_DEPLOYMENT_METADATA_PROPERTY *PSTORE_DEPLOYMENT_METADATA_PROPERTY;
+
+
+EXTERN_C const IID IID_IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("5fa4f590-a416-4b22-ac79-7c3f0d31f303")
+ IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY : public IUnknown
+ {
+ public:
+ virtual HRESULT STDMETHODCALLTYPE Next(
+ /* [in] */ ULONG celt,
+ /* [length_is][size_is][out] */ STORE_DEPLOYMENT_METADATA_PROPERTY AppIds[ ],
+ /* [optional][out] */ ULONG *pceltFetched) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Skip(
+ /* [in] */ ULONG celt) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Reset( void) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Clone(
+ /* [out] */ IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY **ppEnum) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IEnumSTORE_DEPLOYMENT_METADATA_PROPERTYVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY * This);
+
+ HRESULT ( STDMETHODCALLTYPE *Next )(
+ IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY * This,
+ /* [in] */ ULONG celt,
+ /* [length_is][size_is][out] */ STORE_DEPLOYMENT_METADATA_PROPERTY AppIds[ ],
+ /* [optional][out] */ ULONG *pceltFetched);
+
+ HRESULT ( STDMETHODCALLTYPE *Skip )(
+ IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY * This,
+ /* [in] */ ULONG celt);
+
+ HRESULT ( STDMETHODCALLTYPE *Reset )(
+ IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY * This);
+
+ HRESULT ( STDMETHODCALLTYPE *Clone )(
+ IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY * This,
+ /* [out] */ IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY **ppEnum);
+
+ END_INTERFACE
+ } IEnumSTORE_DEPLOYMENT_METADATA_PROPERTYVtbl;
+
+ interface IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY
+ {
+ CONST_VTBL struct IEnumSTORE_DEPLOYMENT_METADATA_PROPERTYVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY_Next(This,celt,AppIds,pceltFetched) \
+ (This)->lpVtbl -> Next(This,celt,AppIds,pceltFetched)
+
+#define IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY_Skip(This,celt) \
+ (This)->lpVtbl -> Skip(This,celt)
+
+#define IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY_Reset(This) \
+ (This)->lpVtbl -> Reset(This)
+
+#define IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY_Clone(This,ppEnum) \
+ (This)->lpVtbl -> Clone(This,ppEnum)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+HRESULT STDMETHODCALLTYPE IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY_Next_Proxy(
+ IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY * This,
+ /* [in] */ ULONG celt,
+ /* [length_is][size_is][out] */ STORE_DEPLOYMENT_METADATA_PROPERTY AppIds[ ],
+ /* [optional][out] */ ULONG *pceltFetched);
+
+
+void __RPC_STUB IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY_Next_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY_Skip_Proxy(
+ IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY * This,
+ /* [in] */ ULONG celt);
+
+
+void __RPC_STUB IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY_Skip_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY_Reset_Proxy(
+ IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY * This);
+
+
+void __RPC_STUB IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY_Reset_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY_Clone_Proxy(
+ IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY * This,
+ /* [out] */ IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY **ppEnum);
+
+
+void __RPC_STUB IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY_Clone_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IEnumSTORE_DEPLOYMENT_METADATA_PROPERTY_INTERFACE_DEFINED__ */
+
+
+#ifndef __IEnumSTORE_ASSEMBLY_INTERFACE_DEFINED__
+#define __IEnumSTORE_ASSEMBLY_INTERFACE_DEFINED__
+
+/* interface IEnumSTORE_ASSEMBLY */
+/* [local][unique][uuid][object] */
+
+
+EXTERN_C const IID IID_IEnumSTORE_ASSEMBLY;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("a5c637bf-6eaa-4e5f-b535-55299657e33e")
+ IEnumSTORE_ASSEMBLY : public IUnknown
+ {
+ public:
+ virtual HRESULT STDMETHODCALLTYPE Next(
+ /* [in] */ ULONG celt,
+ /* [length_is][size_is][out] */ STORE_ASSEMBLY rgelt[ ],
+ /* [optional][out] */ ULONG *pceltFetched) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Skip(
+ /* [in] */ ULONG celt) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Reset( void) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Clone(
+ /* [out] */ IEnumSTORE_ASSEMBLY **ppEnum) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IEnumSTORE_ASSEMBLYVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IEnumSTORE_ASSEMBLY * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IEnumSTORE_ASSEMBLY * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IEnumSTORE_ASSEMBLY * This);
+
+ HRESULT ( STDMETHODCALLTYPE *Next )(
+ IEnumSTORE_ASSEMBLY * This,
+ /* [in] */ ULONG celt,
+ /* [length_is][size_is][out] */ STORE_ASSEMBLY rgelt[ ],
+ /* [optional][out] */ ULONG *pceltFetched);
+
+ HRESULT ( STDMETHODCALLTYPE *Skip )(
+ IEnumSTORE_ASSEMBLY * This,
+ /* [in] */ ULONG celt);
+
+ HRESULT ( STDMETHODCALLTYPE *Reset )(
+ IEnumSTORE_ASSEMBLY * This);
+
+ HRESULT ( STDMETHODCALLTYPE *Clone )(
+ IEnumSTORE_ASSEMBLY * This,
+ /* [out] */ IEnumSTORE_ASSEMBLY **ppEnum);
+
+ END_INTERFACE
+ } IEnumSTORE_ASSEMBLYVtbl;
+
+ interface IEnumSTORE_ASSEMBLY
+ {
+ CONST_VTBL struct IEnumSTORE_ASSEMBLYVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IEnumSTORE_ASSEMBLY_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IEnumSTORE_ASSEMBLY_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IEnumSTORE_ASSEMBLY_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IEnumSTORE_ASSEMBLY_Next(This,celt,rgelt,pceltFetched) \
+ (This)->lpVtbl -> Next(This,celt,rgelt,pceltFetched)
+
+#define IEnumSTORE_ASSEMBLY_Skip(This,celt) \
+ (This)->lpVtbl -> Skip(This,celt)
+
+#define IEnumSTORE_ASSEMBLY_Reset(This) \
+ (This)->lpVtbl -> Reset(This)
+
+#define IEnumSTORE_ASSEMBLY_Clone(This,ppEnum) \
+ (This)->lpVtbl -> Clone(This,ppEnum)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+HRESULT STDMETHODCALLTYPE IEnumSTORE_ASSEMBLY_Next_Proxy(
+ IEnumSTORE_ASSEMBLY * This,
+ /* [in] */ ULONG celt,
+ /* [length_is][size_is][out] */ STORE_ASSEMBLY rgelt[ ],
+ /* [optional][out] */ ULONG *pceltFetched);
+
+
+void __RPC_STUB IEnumSTORE_ASSEMBLY_Next_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IEnumSTORE_ASSEMBLY_Skip_Proxy(
+ IEnumSTORE_ASSEMBLY * This,
+ /* [in] */ ULONG celt);
+
+
+void __RPC_STUB IEnumSTORE_ASSEMBLY_Skip_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IEnumSTORE_ASSEMBLY_Reset_Proxy(
+ IEnumSTORE_ASSEMBLY * This);
+
+
+void __RPC_STUB IEnumSTORE_ASSEMBLY_Reset_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IEnumSTORE_ASSEMBLY_Clone_Proxy(
+ IEnumSTORE_ASSEMBLY * This,
+ /* [out] */ IEnumSTORE_ASSEMBLY **ppEnum);
+
+
+void __RPC_STUB IEnumSTORE_ASSEMBLY_Clone_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IEnumSTORE_ASSEMBLY_INTERFACE_DEFINED__ */
+
+
+#ifndef __IEnumSTORE_ASSEMBLY_FILE_INTERFACE_DEFINED__
+#define __IEnumSTORE_ASSEMBLY_FILE_INTERFACE_DEFINED__
+
+/* interface IEnumSTORE_ASSEMBLY_FILE */
+/* [local][unique][uuid][object] */
+
+
+EXTERN_C const IID IID_IEnumSTORE_ASSEMBLY_FILE;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("a5c6aaa3-03e4-478d-b9f5-2e45908d5e4f")
+ IEnumSTORE_ASSEMBLY_FILE : public IUnknown
+ {
+ public:
+ virtual HRESULT STDMETHODCALLTYPE Next(
+ /* [in] */ ULONG celt,
+ /* [length_is][size_is][out] */ STORE_ASSEMBLY_FILE rgelt[ ],
+ /* [optional][out] */ ULONG *pceltFetched) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Skip(
+ /* [in] */ ULONG celt) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Reset( void) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Clone(
+ /* [out] */ IEnumSTORE_ASSEMBLY_FILE **ppEnum) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IEnumSTORE_ASSEMBLY_FILEVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IEnumSTORE_ASSEMBLY_FILE * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IEnumSTORE_ASSEMBLY_FILE * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IEnumSTORE_ASSEMBLY_FILE * This);
+
+ HRESULT ( STDMETHODCALLTYPE *Next )(
+ IEnumSTORE_ASSEMBLY_FILE * This,
+ /* [in] */ ULONG celt,
+ /* [length_is][size_is][out] */ STORE_ASSEMBLY_FILE rgelt[ ],
+ /* [optional][out] */ ULONG *pceltFetched);
+
+ HRESULT ( STDMETHODCALLTYPE *Skip )(
+ IEnumSTORE_ASSEMBLY_FILE * This,
+ /* [in] */ ULONG celt);
+
+ HRESULT ( STDMETHODCALLTYPE *Reset )(
+ IEnumSTORE_ASSEMBLY_FILE * This);
+
+ HRESULT ( STDMETHODCALLTYPE *Clone )(
+ IEnumSTORE_ASSEMBLY_FILE * This,
+ /* [out] */ IEnumSTORE_ASSEMBLY_FILE **ppEnum);
+
+ END_INTERFACE
+ } IEnumSTORE_ASSEMBLY_FILEVtbl;
+
+ interface IEnumSTORE_ASSEMBLY_FILE
+ {
+ CONST_VTBL struct IEnumSTORE_ASSEMBLY_FILEVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IEnumSTORE_ASSEMBLY_FILE_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IEnumSTORE_ASSEMBLY_FILE_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IEnumSTORE_ASSEMBLY_FILE_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IEnumSTORE_ASSEMBLY_FILE_Next(This,celt,rgelt,pceltFetched) \
+ (This)->lpVtbl -> Next(This,celt,rgelt,pceltFetched)
+
+#define IEnumSTORE_ASSEMBLY_FILE_Skip(This,celt) \
+ (This)->lpVtbl -> Skip(This,celt)
+
+#define IEnumSTORE_ASSEMBLY_FILE_Reset(This) \
+ (This)->lpVtbl -> Reset(This)
+
+#define IEnumSTORE_ASSEMBLY_FILE_Clone(This,ppEnum) \
+ (This)->lpVtbl -> Clone(This,ppEnum)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+HRESULT STDMETHODCALLTYPE IEnumSTORE_ASSEMBLY_FILE_Next_Proxy(
+ IEnumSTORE_ASSEMBLY_FILE * This,
+ /* [in] */ ULONG celt,
+ /* [length_is][size_is][out] */ STORE_ASSEMBLY_FILE rgelt[ ],
+ /* [optional][out] */ ULONG *pceltFetched);
+
+
+void __RPC_STUB IEnumSTORE_ASSEMBLY_FILE_Next_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IEnumSTORE_ASSEMBLY_FILE_Skip_Proxy(
+ IEnumSTORE_ASSEMBLY_FILE * This,
+ /* [in] */ ULONG celt);
+
+
+void __RPC_STUB IEnumSTORE_ASSEMBLY_FILE_Skip_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IEnumSTORE_ASSEMBLY_FILE_Reset_Proxy(
+ IEnumSTORE_ASSEMBLY_FILE * This);
+
+
+void __RPC_STUB IEnumSTORE_ASSEMBLY_FILE_Reset_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IEnumSTORE_ASSEMBLY_FILE_Clone_Proxy(
+ IEnumSTORE_ASSEMBLY_FILE * This,
+ /* [out] */ IEnumSTORE_ASSEMBLY_FILE **ppEnum);
+
+
+void __RPC_STUB IEnumSTORE_ASSEMBLY_FILE_Clone_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IEnumSTORE_ASSEMBLY_FILE_INTERFACE_DEFINED__ */
+
+
+#ifndef __IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE_INTERFACE_DEFINED__
+#define __IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE_INTERFACE_DEFINED__
+
+/* interface IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE */
+/* [local][unique][uuid][object] */
+
+
+EXTERN_C const IID IID_IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("d8b1aacb-5142-4abb-bcc1-e9dc9052a89e")
+ IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE : public IUnknown
+ {
+ public:
+ virtual HRESULT STDMETHODCALLTYPE Next(
+ /* [in] */ ULONG celt,
+ /* [length_is][size_is][out] */ STORE_ASSEMBLY_INSTALLATION_REFERENCE rgelt[ ],
+ /* [optional][out] */ ULONG *pceltFetched) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Skip(
+ /* [in] */ ULONG celt) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Reset( void) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Clone(
+ /* [out] */ IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE **ppIEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCEVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE * This);
+
+ HRESULT ( STDMETHODCALLTYPE *Next )(
+ IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE * This,
+ /* [in] */ ULONG celt,
+ /* [length_is][size_is][out] */ STORE_ASSEMBLY_INSTALLATION_REFERENCE rgelt[ ],
+ /* [optional][out] */ ULONG *pceltFetched);
+
+ HRESULT ( STDMETHODCALLTYPE *Skip )(
+ IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE * This,
+ /* [in] */ ULONG celt);
+
+ HRESULT ( STDMETHODCALLTYPE *Reset )(
+ IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE * This);
+
+ HRESULT ( STDMETHODCALLTYPE *Clone )(
+ IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE * This,
+ /* [out] */ IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE **ppIEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE);
+
+ END_INTERFACE
+ } IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCEVtbl;
+
+ interface IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE
+ {
+ CONST_VTBL struct IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCEVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE_Next(This,celt,rgelt,pceltFetched) \
+ (This)->lpVtbl -> Next(This,celt,rgelt,pceltFetched)
+
+#define IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE_Skip(This,celt) \
+ (This)->lpVtbl -> Skip(This,celt)
+
+#define IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE_Reset(This) \
+ (This)->lpVtbl -> Reset(This)
+
+#define IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE_Clone(This,ppIEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE) \
+ (This)->lpVtbl -> Clone(This,ppIEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+HRESULT STDMETHODCALLTYPE IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE_Next_Proxy(
+ IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE * This,
+ /* [in] */ ULONG celt,
+ /* [length_is][size_is][out] */ STORE_ASSEMBLY_INSTALLATION_REFERENCE rgelt[ ],
+ /* [optional][out] */ ULONG *pceltFetched);
+
+
+void __RPC_STUB IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE_Next_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE_Skip_Proxy(
+ IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE * This,
+ /* [in] */ ULONG celt);
+
+
+void __RPC_STUB IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE_Skip_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE_Reset_Proxy(
+ IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE * This);
+
+
+void __RPC_STUB IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE_Reset_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE_Clone_Proxy(
+ IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE * This,
+ /* [out] */ IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE **ppIEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE);
+
+
+void __RPC_STUB IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE_Clone_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IEnumSTORE_ASSEMBLY_INSTALLATION_REFERENCE_INTERFACE_DEFINED__ */
+
+
+#ifndef __IEnumCATEGORY_INTERFACE_DEFINED__
+#define __IEnumCATEGORY_INTERFACE_DEFINED__
+
+/* interface IEnumCATEGORY */
+/* [local][unique][uuid][object] */
+
+
+EXTERN_C const IID IID_IEnumCATEGORY;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("02249bf3-e0ef-4396-b8b7-8882e981175f")
+ IEnumCATEGORY : public IUnknown
+ {
+ public:
+ virtual HRESULT STDMETHODCALLTYPE Next(
+ /* [in] */ ULONG celt,
+ /* [length_is][size_is][out] */ CATEGORY rgElements[ ],
+ /* [out] */ ULONG *pulFetched) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Skip(
+ /* [in] */ ULONG ulElements) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Reset( void) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Clone(
+ /* [out] */ IEnumCATEGORY **ppIEnumCATEGORY) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IEnumCATEGORYVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IEnumCATEGORY * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IEnumCATEGORY * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IEnumCATEGORY * This);
+
+ HRESULT ( STDMETHODCALLTYPE *Next )(
+ IEnumCATEGORY * This,
+ /* [in] */ ULONG celt,
+ /* [length_is][size_is][out] */ CATEGORY rgElements[ ],
+ /* [out] */ ULONG *pulFetched);
+
+ HRESULT ( STDMETHODCALLTYPE *Skip )(
+ IEnumCATEGORY * This,
+ /* [in] */ ULONG ulElements);
+
+ HRESULT ( STDMETHODCALLTYPE *Reset )(
+ IEnumCATEGORY * This);
+
+ HRESULT ( STDMETHODCALLTYPE *Clone )(
+ IEnumCATEGORY * This,
+ /* [out] */ IEnumCATEGORY **ppIEnumCATEGORY);
+
+ END_INTERFACE
+ } IEnumCATEGORYVtbl;
+
+ interface IEnumCATEGORY
+ {
+ CONST_VTBL struct IEnumCATEGORYVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IEnumCATEGORY_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IEnumCATEGORY_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IEnumCATEGORY_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IEnumCATEGORY_Next(This,celt,rgElements,pulFetched) \
+ (This)->lpVtbl -> Next(This,celt,rgElements,pulFetched)
+
+#define IEnumCATEGORY_Skip(This,ulElements) \
+ (This)->lpVtbl -> Skip(This,ulElements)
+
+#define IEnumCATEGORY_Reset(This) \
+ (This)->lpVtbl -> Reset(This)
+
+#define IEnumCATEGORY_Clone(This,ppIEnumCATEGORY) \
+ (This)->lpVtbl -> Clone(This,ppIEnumCATEGORY)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+HRESULT STDMETHODCALLTYPE IEnumCATEGORY_Next_Proxy(
+ IEnumCATEGORY * This,
+ /* [in] */ ULONG celt,
+ /* [length_is][size_is][out] */ CATEGORY rgElements[ ],
+ /* [out] */ ULONG *pulFetched);
+
+
+void __RPC_STUB IEnumCATEGORY_Next_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IEnumCATEGORY_Skip_Proxy(
+ IEnumCATEGORY * This,
+ /* [in] */ ULONG ulElements);
+
+
+void __RPC_STUB IEnumCATEGORY_Skip_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IEnumCATEGORY_Reset_Proxy(
+ IEnumCATEGORY * This);
+
+
+void __RPC_STUB IEnumCATEGORY_Reset_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IEnumCATEGORY_Clone_Proxy(
+ IEnumCATEGORY * This,
+ /* [out] */ IEnumCATEGORY **ppIEnumCATEGORY);
+
+
+void __RPC_STUB IEnumCATEGORY_Clone_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IEnumCATEGORY_INTERFACE_DEFINED__ */
+
+
+#ifndef __IEnumCATEGORY_SUBCATEGORY_INTERFACE_DEFINED__
+#define __IEnumCATEGORY_SUBCATEGORY_INTERFACE_DEFINED__
+
+/* interface IEnumCATEGORY_SUBCATEGORY */
+/* [local][unique][uuid][object] */
+
+
+EXTERN_C const IID IID_IEnumCATEGORY_SUBCATEGORY;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("5f9fdbe5-57e1-49f6-bb9d-28c1a1503818")
+ IEnumCATEGORY_SUBCATEGORY : public IUnknown
+ {
+ public:
+ virtual HRESULT STDMETHODCALLTYPE Next(
+ /* [in] */ ULONG celt,
+ /* [length_is][size_is][out] */ CATEGORY_SUBCATEGORY rgElements[ ],
+ /* [out] */ ULONG *pulFetched) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Skip(
+ /* [in] */ ULONG ulElements) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Reset( void) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Clone(
+ /* [out] */ IEnumCATEGORY_SUBCATEGORY **ppIEnumCATEGORY_SUBCATEGORY) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IEnumCATEGORY_SUBCATEGORYVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IEnumCATEGORY_SUBCATEGORY * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IEnumCATEGORY_SUBCATEGORY * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IEnumCATEGORY_SUBCATEGORY * This);
+
+ HRESULT ( STDMETHODCALLTYPE *Next )(
+ IEnumCATEGORY_SUBCATEGORY * This,
+ /* [in] */ ULONG celt,
+ /* [length_is][size_is][out] */ CATEGORY_SUBCATEGORY rgElements[ ],
+ /* [out] */ ULONG *pulFetched);
+
+ HRESULT ( STDMETHODCALLTYPE *Skip )(
+ IEnumCATEGORY_SUBCATEGORY * This,
+ /* [in] */ ULONG ulElements);
+
+ HRESULT ( STDMETHODCALLTYPE *Reset )(
+ IEnumCATEGORY_SUBCATEGORY * This);
+
+ HRESULT ( STDMETHODCALLTYPE *Clone )(
+ IEnumCATEGORY_SUBCATEGORY * This,
+ /* [out] */ IEnumCATEGORY_SUBCATEGORY **ppIEnumCATEGORY_SUBCATEGORY);
+
+ END_INTERFACE
+ } IEnumCATEGORY_SUBCATEGORYVtbl;
+
+ interface IEnumCATEGORY_SUBCATEGORY
+ {
+ CONST_VTBL struct IEnumCATEGORY_SUBCATEGORYVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IEnumCATEGORY_SUBCATEGORY_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IEnumCATEGORY_SUBCATEGORY_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IEnumCATEGORY_SUBCATEGORY_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IEnumCATEGORY_SUBCATEGORY_Next(This,celt,rgElements,pulFetched) \
+ (This)->lpVtbl -> Next(This,celt,rgElements,pulFetched)
+
+#define IEnumCATEGORY_SUBCATEGORY_Skip(This,ulElements) \
+ (This)->lpVtbl -> Skip(This,ulElements)
+
+#define IEnumCATEGORY_SUBCATEGORY_Reset(This) \
+ (This)->lpVtbl -> Reset(This)
+
+#define IEnumCATEGORY_SUBCATEGORY_Clone(This,ppIEnumCATEGORY_SUBCATEGORY) \
+ (This)->lpVtbl -> Clone(This,ppIEnumCATEGORY_SUBCATEGORY)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+HRESULT STDMETHODCALLTYPE IEnumCATEGORY_SUBCATEGORY_Next_Proxy(
+ IEnumCATEGORY_SUBCATEGORY * This,
+ /* [in] */ ULONG celt,
+ /* [length_is][size_is][out] */ CATEGORY_SUBCATEGORY rgElements[ ],
+ /* [out] */ ULONG *pulFetched);
+
+
+void __RPC_STUB IEnumCATEGORY_SUBCATEGORY_Next_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IEnumCATEGORY_SUBCATEGORY_Skip_Proxy(
+ IEnumCATEGORY_SUBCATEGORY * This,
+ /* [in] */ ULONG ulElements);
+
+
+void __RPC_STUB IEnumCATEGORY_SUBCATEGORY_Skip_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IEnumCATEGORY_SUBCATEGORY_Reset_Proxy(
+ IEnumCATEGORY_SUBCATEGORY * This);
+
+
+void __RPC_STUB IEnumCATEGORY_SUBCATEGORY_Reset_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IEnumCATEGORY_SUBCATEGORY_Clone_Proxy(
+ IEnumCATEGORY_SUBCATEGORY * This,
+ /* [out] */ IEnumCATEGORY_SUBCATEGORY **ppIEnumCATEGORY_SUBCATEGORY);
+
+
+void __RPC_STUB IEnumCATEGORY_SUBCATEGORY_Clone_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IEnumCATEGORY_SUBCATEGORY_INTERFACE_DEFINED__ */
+
+
+#ifndef __IEnumCATEGORY_INSTANCE_INTERFACE_DEFINED__
+#define __IEnumCATEGORY_INSTANCE_INTERFACE_DEFINED__
+
+/* interface IEnumCATEGORY_INSTANCE */
+/* [local][unique][uuid][object] */
+
+
+EXTERN_C const IID IID_IEnumCATEGORY_INSTANCE;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("8d8842d8-e031-4a7e-8571-dc0b03385807")
+ IEnumCATEGORY_INSTANCE : public IUnknown
+ {
+ public:
+ virtual HRESULT STDMETHODCALLTYPE Next(
+ /* [in] */ ULONG ulElements,
+ /* [length_is][size_is][out] */ CATEGORY_INSTANCE rgInstances[ ],
+ /* [out] */ ULONG *pulFetched) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Skip(
+ /* [in] */ ULONG ulElements) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Reset( void) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Clone(
+ /* [out] */ IEnumCATEGORY_INSTANCE **ppIEnumCATEGORY_INSTANCE) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IEnumCATEGORY_INSTANCEVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IEnumCATEGORY_INSTANCE * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IEnumCATEGORY_INSTANCE * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IEnumCATEGORY_INSTANCE * This);
+
+ HRESULT ( STDMETHODCALLTYPE *Next )(
+ IEnumCATEGORY_INSTANCE * This,
+ /* [in] */ ULONG ulElements,
+ /* [length_is][size_is][out] */ CATEGORY_INSTANCE rgInstances[ ],
+ /* [out] */ ULONG *pulFetched);
+
+ HRESULT ( STDMETHODCALLTYPE *Skip )(
+ IEnumCATEGORY_INSTANCE * This,
+ /* [in] */ ULONG ulElements);
+
+ HRESULT ( STDMETHODCALLTYPE *Reset )(
+ IEnumCATEGORY_INSTANCE * This);
+
+ HRESULT ( STDMETHODCALLTYPE *Clone )(
+ IEnumCATEGORY_INSTANCE * This,
+ /* [out] */ IEnumCATEGORY_INSTANCE **ppIEnumCATEGORY_INSTANCE);
+
+ END_INTERFACE
+ } IEnumCATEGORY_INSTANCEVtbl;
+
+ interface IEnumCATEGORY_INSTANCE
+ {
+ CONST_VTBL struct IEnumCATEGORY_INSTANCEVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IEnumCATEGORY_INSTANCE_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IEnumCATEGORY_INSTANCE_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IEnumCATEGORY_INSTANCE_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IEnumCATEGORY_INSTANCE_Next(This,ulElements,rgInstances,pulFetched) \
+ (This)->lpVtbl -> Next(This,ulElements,rgInstances,pulFetched)
+
+#define IEnumCATEGORY_INSTANCE_Skip(This,ulElements) \
+ (This)->lpVtbl -> Skip(This,ulElements)
+
+#define IEnumCATEGORY_INSTANCE_Reset(This) \
+ (This)->lpVtbl -> Reset(This)
+
+#define IEnumCATEGORY_INSTANCE_Clone(This,ppIEnumCATEGORY_INSTANCE) \
+ (This)->lpVtbl -> Clone(This,ppIEnumCATEGORY_INSTANCE)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+HRESULT STDMETHODCALLTYPE IEnumCATEGORY_INSTANCE_Next_Proxy(
+ IEnumCATEGORY_INSTANCE * This,
+ /* [in] */ ULONG ulElements,
+ /* [length_is][size_is][out] */ CATEGORY_INSTANCE rgInstances[ ],
+ /* [out] */ ULONG *pulFetched);
+
+
+void __RPC_STUB IEnumCATEGORY_INSTANCE_Next_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IEnumCATEGORY_INSTANCE_Skip_Proxy(
+ IEnumCATEGORY_INSTANCE * This,
+ /* [in] */ ULONG ulElements);
+
+
+void __RPC_STUB IEnumCATEGORY_INSTANCE_Skip_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IEnumCATEGORY_INSTANCE_Reset_Proxy(
+ IEnumCATEGORY_INSTANCE * This);
+
+
+void __RPC_STUB IEnumCATEGORY_INSTANCE_Reset_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IEnumCATEGORY_INSTANCE_Clone_Proxy(
+ IEnumCATEGORY_INSTANCE * This,
+ /* [out] */ IEnumCATEGORY_INSTANCE **ppIEnumCATEGORY_INSTANCE);
+
+
+void __RPC_STUB IEnumCATEGORY_INSTANCE_Clone_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IEnumCATEGORY_INSTANCE_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_isolation_0343 */
+/* [local] */
+
+typedef /* [v1_enum] */
+enum _STATE_AXIS
+ { STATE_AXIS_INVALID = 0,
+ STATE_AXIS_USER = 1,
+ STATE_AXIS_APPLICATION = 2,
+ STATE_AXIS_COMPONENT = 3
+ } STATE_AXIS;
+
+typedef /* [v1_enum] */ enum _STATE_AXIS *PSTATE_AXIS;
+
+typedef const STATE_AXIS *PCSTATE_AXIS;
+
+typedef
+enum _STATE_COORDINATE_VALUE_USER
+ { STATE_COORDINATE_VALUE_USER_INVALID = 0,
+ STATE_COORDINATE_VALUE_USER_NEUTRAL = 1,
+ STATE_COORDINATE_VALUE_USER_LOCAL_MACHINE = 2,
+ STATE_COORDINATE_VALUE_USER_GLOBAL = 3
+ } STATE_COORDINATE_VALUE_USER;
+
+typedef
+enum _STATE_COORDINATE_VALUE_APPLICATION
+ { STATE_COORDINATE_VALUE_APPLICATION_INVALID = 0,
+ STATE_COORDINATE_VALUE_APPLICATION_NEUTRAL = 1,
+ STATE_COORDINATE_VALUE_APPLICATION_VERSION_INDEPENDENT = 2,
+ STATE_COORDINATE_VALUE_APPLICATION_VERSION_FUNCTIONALITY = 3,
+ STATE_COORDINATE_VALUE_APPLICATION_VERSIONED = 4
+ } STATE_COORDINATE_VALUE_APPLICATION;
+
+typedef enum _STATE_COORDINATE_VALUE_APPLICATION *PSTATE_COORDINATE_VALUE_APPLICATION;
+
+typedef const STATE_COORDINATE_VALUE_APPLICATION *PCSTATE_COORDINATE_VALUE_APPLICATION;
+
+typedef
+enum _STATE_COORDINATE_VALUE_COMPONENT
+ { STATE_COORDINATE_VALUE_COMPONENT_INVALID = 0,
+ STATE_COORDINATE_VALUE_COMPONENT_NEUTRAL = 1,
+ STATE_COORDINATE_VALUE_COMPONENT_VERSION_INDEPENDENT = 2,
+ STATE_COORDINATE_VALUE_COMPONENT_VERSION_FUNCTIONALITY = 3,
+ STATE_COORDINATE_VALUE_COMPONENT_VERSIONED = 4
+ } STATE_COORDINATE_VALUE_COMPONENT;
+
+typedef enum _STATE_COORDINATE_VALUE_COMPONENT *PSTATE_COORDINATE_VALUE_COMPONENT;
+
+typedef const STATE_COORDINATE_VALUE_COMPONENT *PCSTATE_COORDINATE_VALUE_COMPONENT;
+
+typedef /* [switch_type] */ union _STATE_COORDINATE_VALUE
+ {
+ /* [case()] */ STATE_COORDINATE_VALUE_USER User;
+ /* [case()] */ STATE_COORDINATE_VALUE_APPLICATION Application;
+ /* [case()] */ STATE_COORDINATE_VALUE_COMPONENT Component;
+ } STATE_COORDINATE_VALUE;
+
+typedef /* [switch_type] */ union _STATE_COORDINATE_VALUE *PSTATE_COORDINATE_VALUE;
+
+typedef const STATE_COORDINATE_VALUE *PCSTATE_COORDINATE_VALUE;
+
+typedef struct _STATE_COORDINATE
+ {
+ STATE_AXIS Axis;
+ STATE_COORDINATE_VALUE Value;
+ } STATE_COORDINATE;
+
+typedef struct _STATE_COORDINATE *PSTATE_COORDINATE;
+
+typedef const STATE_COORDINATE *PCSTATE_COORDINATE;
+
+typedef struct _STATE_COORDINATE_LIST
+ {
+ SIZE_T Count;
+ PCSTATE_COORDINATE List;
+ } STATE_COORDINATE_LIST;
+
+typedef struct _STATE_COORDINATE_LIST *PSTATE_COORDINATE_LIST;
+
+typedef const STATE_COORDINATE_LIST *PCSTATE_COORDINATE_LIST;
+
+
+
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0343_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0343_v0_0_s_ifspec;
+
+#ifndef __IManifestInformation_INTERFACE_DEFINED__
+#define __IManifestInformation_INTERFACE_DEFINED__
+
+/* interface IManifestInformation */
+/* [local][unique][uuid][object] */
+
+
+EXTERN_C const IID IID_IManifestInformation;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("81c85208-fe61-4c15-b5bb-ff5ea66baad9")
+ IManifestInformation : public IUnknown
+ {
+ public:
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_FullPath(
+ /* [retval][out] */ LPWSTR *ManifestPath) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IManifestInformationVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IManifestInformation * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IManifestInformation * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IManifestInformation * This);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_FullPath )(
+ IManifestInformation * This,
+ /* [retval][out] */ LPWSTR *ManifestPath);
+
+ END_INTERFACE
+ } IManifestInformationVtbl;
+
+ interface IManifestInformation
+ {
+ CONST_VTBL struct IManifestInformationVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IManifestInformation_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IManifestInformation_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IManifestInformation_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IManifestInformation_get_FullPath(This,ManifestPath) \
+ (This)->lpVtbl -> get_FullPath(This,ManifestPath)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IManifestInformation_get_FullPath_Proxy(
+ IManifestInformation * This,
+ /* [retval][out] */ LPWSTR *ManifestPath);
+
+
+void __RPC_STUB IManifestInformation_get_FullPath_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IManifestInformation_INTERFACE_DEFINED__ */
+
+
+#ifndef __IActContext_INTERFACE_DEFINED__
+#define __IActContext_INTERFACE_DEFINED__
+
+/* interface IActContext */
+/* [local][unique][uuid][object] */
+
+/* [v1_enum] */
+enum _IAPP_CONTEXT_REPLACE_STRING_MACROS_FLAGS
+ { IAPP_CONTEXT_REPLACE_STRING_MACROS_FLAG_NO_COMPONENT = 0x1
+ } ;
+typedef struct _IAPP_CONTEXT_PREPARE_FOR_EXECUTION_INPUTS
+ {
+ ULONG ulSize;
+ DWORD dwFlags;
+ } IAPP_CONTEXT_PREPARE_FOR_EXECUTION_INPUTS;
+
+typedef struct _IAPP_CONTEXT_PREPARE_FOR_EXECUTION_INPUTS *PIAPP_CONTEXT_PREPARE_FOR_EXECUTION_INPUTS;
+
+typedef const IAPP_CONTEXT_PREPARE_FOR_EXECUTION_INPUTS *PCIAPP_CONTEXT_PREPARE_FOR_EXECUTION_INPUTS;
+
+/* [v1_enum] */
+enum _IAPP_CONTEXT_PREPARE_FOR_EXECUTION_OUTPUTS_FLAGS
+ { IAPP_CONTEXT_PREPARE_FOR_EXECUTION_OUTPUTS_FLAG_OVERALL_DISPOSITION_VALID = 0x1
+ } ;
+typedef struct _IAPP_CONTEXT_PREPARE_FOR_EXECUTION_OUTPUTS
+ {
+ ULONG ulSize;
+ DWORD dwFlags;
+ DWORD dwOverallDisposition;
+ } IAPP_CONTEXT_PREPARE_FOR_EXECUTION_OUTPUTS;
+
+typedef struct _IAPP_CONTEXT_PREPARE_FOR_EXECUTION_OUTPUTS *PIAPP_CONTEXT_PREPARE_FOR_EXECUTION_OUTPUTS;
+
+typedef const IAPP_CONTEXT_PREPARE_FOR_EXECUTION_OUTPUTS *PCIAPP_CONTEXT_PREPARE_FOR_EXECUTION_OUTPUTS;
+
+/* [v1_enum] */
+enum _IAPP_CONTEXT_SET_APPLICATION_RUNNING_STATES
+ { IAPP_CONTEXT_SET_APPLICATION_RUNNING_STATE_UNDEFINED = 0,
+ IAPP_CONTEXT_SET_APPLICATION_RUNNING_STATE_STARTING = 1,
+ IAPP_CONTEXT_SET_APPLICATION_RUNNING_STATE_RUNNING = 2
+ } ;
+/* [v1_enum] */
+enum _IAPP_CONTEXT_SET_APPLICATION_RUNNING_STATE_DISPOSITIONS
+ { IAPP_CONTEXT_SET_APPLICATION_RUNNING_STATE_DISPOSITION_UNDEFINED = 0,
+ IAPP_CONTEXT_SET_APPLICATION_RUNNING_STATE_DISPOSITION_STARTING = 1,
+ IAPP_CONTEXT_SET_APPLICATION_RUNNING_STATE_DISPOSITION_STARTING_MIGRATED = 1 << 16,
+ IAPP_CONTEXT_SET_APPLICATION_RUNNING_STATE_DISPOSITION_RUNNING = 2,
+ IAPP_CONTEXT_SET_APPLICATION_RUNNING_STATE_DISPOSITION_RUNNING_FIRST_RUN = 1 << 17
+ } ;
+/* [v1_enum] */
+enum IAPP_CONTEXT_GET_APPLICATION_STATE_FILESYSTEM_LOCATION_FLAGS
+ { IAPP_CONTEXT_GET_APPLICATION_STATE_FILESYSTEM_LOCATION_FLAG_NO_COMPONENT = 0x1
+ } ;
+/* [v1_enum] */
+enum _IAPP_CONTEXT_FIND_COMPONENTS_BY_DEFINITION_DISPOSITION_STATES
+ { IAPP_CONTEXT_FIND_COMPONENTS_BY_DEFINITION_DISPOSITION_STATE_UNDEFINED = 0,
+ IAPP_CONTEXT_FIND_COMPONENTS_BY_DEFINITION_DISPOSITION_STATE_NOT_LOOKED_AT = 1,
+ IAPP_CONTEXT_FIND_COMPONENTS_BY_DEFINITION_DISPOSITION_STATE_FOUND = 2,
+ IAPP_CONTEXT_FIND_COMPONENTS_BY_DEFINITION_DISPOSITION_STATE_NOT_FOUND = 3
+ } ;
+/* [v1_enum] */
+enum _IAPP_CONTEXT_FIND_COMPONENTS_BY_REFERENCE_DISPOSITION_STATES
+ { IAPP_CONTEXT_FIND_COMPONENTS_BY_REFERENCE_DISPOSITION_STATE_UNDEFINED = 0,
+ IAPP_CONTEXT_FIND_COMPONENTS_BY_REFERENCE_DISPOSITION_STATE_NOT_LOOKED_AT = 1,
+ IAPP_CONTEXT_FIND_COMPONENTS_BY_REFERENCE_DISPOSITION_STATE_FOUND = 2,
+ IAPP_CONTEXT_FIND_COMPONENTS_BY_REFERENCE_DISPOSITION_STATE_NOT_FOUND = 3
+ } ;
+/* [v1_enum] */
+enum _IAPP_CONTEXT_FIND_COMPONENTS_BY_REFERENCE_FLAGS
+ { IAPP_CONTEXT_FIND_COMPONENTS_BY_REFERENCE_FLAG_REQUIRE_EXACT_MATCH = 0x1
+ } ;
+
+EXTERN_C const IID IID_IActContext;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("0af57545-a72a-4fbe-813c-8554ed7d4528")
+ IActContext : public IUnknown
+ {
+ public:
+ virtual /* [propget] */ HRESULT STDMETHODCALLTYPE get_AppId(
+ /* [retval][out] */ IDefinitionAppId **ppAppId) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE EnumCategories(
+ /* [in] */ DWORD dwFlags,
+ /* [unique][in] */ IReferenceIdentity *pReferenceIdentity_ToMatch,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ IUnknown **ppIUnknown) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE EnumSubcategories(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
+ /* [in] */ LPCWSTR pszSubcategoryPathPattern,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ IUnknown **ppIUnknown) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE EnumCategoryInstances(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionIdentity *pIDefinitionIdentity_Category,
+ /* [in] */ LPCWSTR pszSubcategoryPath,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ IUnknown **ppIUnknown) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE ReplaceMacrosInStrings(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ SIZE_T iComponentIndex,
+ /* [in] */ SIZE_T cStrings,
+ /* [size_is][in] */ const LPCWSTR rgpszSourceStrings[ ],
+ /* [size_is][out] */ LPWSTR rgpszDestinationStrings[ ],
+ /* [in] */ PCCULTURE_FALLBACK_LIST pCultureFallbackList) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE GetComponentStringTableStrings(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ SIZE_T iComponentIndex,
+ /* [in] */ SIZE_T cStrings,
+ /* [size_is][in] */ const LPCWSTR rgpszSourceStrings[ ],
+ /* [size_is][out] */ LPWSTR rgpszDestinationStrings[ ],
+ /* [in] */ PCCULTURE_FALLBACK_LIST pCultureFallbackList) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE GetApplicationProperties(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ SIZE_T cProperties,
+ /* [size_is][in] */ const LPCWSTR rgpszPropertyNames[ ],
+ /* [size_is][out] */ LPWSTR rgpszPropertyValues[ ],
+ /* [size_is][out] */ SIZE_T rgiComponentIndices[ ]) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE ApplicationBasePath(
+ /* [in] */ DWORD dwFlags,
+ /* [retval][out] */ LPWSTR *ApplicationPath) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE GetComponentManifest(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionIdentity *Component,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ IUnknown **ppIUnknown) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE GetComponentPayloadPath(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionIdentity *Component,
+ /* [retval][out] */ LPWSTR *ppwszComponentPayloadPath) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE FindReferenceInContext(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IReferenceIdentity *Reference,
+ /* [retval][out] */ IDefinitionIdentity **MatchedDefinition) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE CreateActContextFromCategoryInstance(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ PCCATEGORY_INSTANCE CategoryInstance,
+ /* [retval][out] */ IActContext **ppCreatedAppContext) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE EnumComponents(
+ /* [in] */ DWORD dwFlags,
+ /* [retval][out] */ IEnumDefinitionIdentity **ppIdentityEnum) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE PrepareForExecution(
+ /* [in] */ PCIAPP_CONTEXT_PREPARE_FOR_EXECUTION_INPUTS pInputs,
+ /* [out][in] */ PIAPP_CONTEXT_PREPARE_FOR_EXECUTION_OUTPUTS pOutputs) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE SetApplicationRunningState(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ ULONG ulState,
+ /* [retval][out] */ ULONG *Disposition) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE GetApplicationStateFilesystemLocation(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ SIZE_T iComponentIndex,
+ /* [in] */ PCSTATE_COORDINATE_LIST pCoordinateList,
+ /* [out] */ LPWSTR *ppszPath) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE FindComponentsByDefinition(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ SIZE_T cComponents,
+ /* [size_is][in] */ IDefinitionIdentity *pIDefinitionIdentities[ ],
+ /* [size_is][out] */ SIZE_T rgiComponentIndices[ ],
+ /* [size_is][out] */ ULONG rgulDispositions[ ]) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE FindComponentsByReference(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ SIZE_T cComponents,
+ /* [size_is][in] */ IReferenceIdentity *pIReferenceIdentities[ ],
+ /* [size_is][out] */ SIZE_T rgComponentIndices[ ],
+ /* [size_is][out] */ ULONG rgulDispositions[ ]) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IActContextVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IActContext * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IActContext * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IActContext * This);
+
+ /* [propget] */ HRESULT ( STDMETHODCALLTYPE *get_AppId )(
+ IActContext * This,
+ /* [retval][out] */ IDefinitionAppId **ppAppId);
+
+ HRESULT ( STDMETHODCALLTYPE *EnumCategories )(
+ IActContext * This,
+ /* [in] */ DWORD dwFlags,
+ /* [unique][in] */ IReferenceIdentity *pReferenceIdentity_ToMatch,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ IUnknown **ppIUnknown);
+
+ HRESULT ( STDMETHODCALLTYPE *EnumSubcategories )(
+ IActContext * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
+ /* [in] */ LPCWSTR pszSubcategoryPathPattern,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ IUnknown **ppIUnknown);
+
+ HRESULT ( STDMETHODCALLTYPE *EnumCategoryInstances )(
+ IActContext * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionIdentity *pIDefinitionIdentity_Category,
+ /* [in] */ LPCWSTR pszSubcategoryPath,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ IUnknown **ppIUnknown);
+
+ HRESULT ( STDMETHODCALLTYPE *ReplaceMacrosInStrings )(
+ IActContext * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ SIZE_T iComponentIndex,
+ /* [in] */ SIZE_T cStrings,
+ /* [size_is][in] */ const LPCWSTR rgpszSourceStrings[ ],
+ /* [size_is][out] */ LPWSTR rgpszDestinationStrings[ ],
+ /* [in] */ PCCULTURE_FALLBACK_LIST pCultureFallbackList);
+
+ HRESULT ( STDMETHODCALLTYPE *GetComponentStringTableStrings )(
+ IActContext * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ SIZE_T iComponentIndex,
+ /* [in] */ SIZE_T cStrings,
+ /* [size_is][in] */ const LPCWSTR rgpszSourceStrings[ ],
+ /* [size_is][out] */ LPWSTR rgpszDestinationStrings[ ],
+ /* [in] */ PCCULTURE_FALLBACK_LIST pCultureFallbackList);
+
+ HRESULT ( STDMETHODCALLTYPE *GetApplicationProperties )(
+ IActContext * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ SIZE_T cProperties,
+ /* [size_is][in] */ const LPCWSTR rgpszPropertyNames[ ],
+ /* [size_is][out] */ LPWSTR rgpszPropertyValues[ ],
+ /* [size_is][out] */ SIZE_T rgiComponentIndices[ ]);
+
+ HRESULT ( STDMETHODCALLTYPE *ApplicationBasePath )(
+ IActContext * This,
+ /* [in] */ DWORD dwFlags,
+ /* [retval][out] */ LPWSTR *ApplicationPath);
+
+ HRESULT ( STDMETHODCALLTYPE *GetComponentManifest )(
+ IActContext * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionIdentity *Component,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ IUnknown **ppIUnknown);
+
+ HRESULT ( STDMETHODCALLTYPE *GetComponentPayloadPath )(
+ IActContext * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionIdentity *Component,
+ /* [retval][out] */ LPWSTR *ppwszComponentPayloadPath);
+
+ HRESULT ( STDMETHODCALLTYPE *FindReferenceInContext )(
+ IActContext * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IReferenceIdentity *Reference,
+ /* [retval][out] */ IDefinitionIdentity **MatchedDefinition);
+
+ HRESULT ( STDMETHODCALLTYPE *CreateActContextFromCategoryInstance )(
+ IActContext * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ PCCATEGORY_INSTANCE CategoryInstance,
+ /* [retval][out] */ IActContext **ppCreatedAppContext);
+
+ HRESULT ( STDMETHODCALLTYPE *EnumComponents )(
+ IActContext * This,
+ /* [in] */ DWORD dwFlags,
+ /* [retval][out] */ IEnumDefinitionIdentity **ppIdentityEnum);
+
+ HRESULT ( STDMETHODCALLTYPE *PrepareForExecution )(
+ IActContext * This,
+ /* [in] */ PCIAPP_CONTEXT_PREPARE_FOR_EXECUTION_INPUTS pInputs,
+ /* [out][in] */ PIAPP_CONTEXT_PREPARE_FOR_EXECUTION_OUTPUTS pOutputs);
+
+ HRESULT ( STDMETHODCALLTYPE *SetApplicationRunningState )(
+ IActContext * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ ULONG ulState,
+ /* [retval][out] */ ULONG *Disposition);
+
+ HRESULT ( STDMETHODCALLTYPE *GetApplicationStateFilesystemLocation )(
+ IActContext * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ SIZE_T iComponentIndex,
+ /* [in] */ PCSTATE_COORDINATE_LIST pCoordinateList,
+ /* [out] */ LPWSTR *ppszPath);
+
+ HRESULT ( STDMETHODCALLTYPE *FindComponentsByDefinition )(
+ IActContext * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ SIZE_T cComponents,
+ /* [size_is][in] */ IDefinitionIdentity *pIDefinitionIdentities[ ],
+ /* [size_is][out] */ SIZE_T rgiComponentIndices[ ],
+ /* [size_is][out] */ ULONG rgulDispositions[ ]);
+
+ HRESULT ( STDMETHODCALLTYPE *FindComponentsByReference )(
+ IActContext * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ SIZE_T cComponents,
+ /* [size_is][in] */ IReferenceIdentity *pIReferenceIdentities[ ],
+ /* [size_is][out] */ SIZE_T rgComponentIndices[ ],
+ /* [size_is][out] */ ULONG rgulDispositions[ ]);
+
+ END_INTERFACE
+ } IActContextVtbl;
+
+ interface IActContext
+ {
+ CONST_VTBL struct IActContextVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IActContext_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IActContext_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IActContext_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IActContext_get_AppId(This,ppAppId) \
+ (This)->lpVtbl -> get_AppId(This,ppAppId)
+
+#define IActContext_EnumCategories(This,dwFlags,pReferenceIdentity_ToMatch,riid,ppIUnknown) \
+ (This)->lpVtbl -> EnumCategories(This,dwFlags,pReferenceIdentity_ToMatch,riid,ppIUnknown)
+
+#define IActContext_EnumSubcategories(This,dwFlags,pIDefinitionIdentity,pszSubcategoryPathPattern,riid,ppIUnknown) \
+ (This)->lpVtbl -> EnumSubcategories(This,dwFlags,pIDefinitionIdentity,pszSubcategoryPathPattern,riid,ppIUnknown)
+
+#define IActContext_EnumCategoryInstances(This,dwFlags,pIDefinitionIdentity_Category,pszSubcategoryPath,riid,ppIUnknown) \
+ (This)->lpVtbl -> EnumCategoryInstances(This,dwFlags,pIDefinitionIdentity_Category,pszSubcategoryPath,riid,ppIUnknown)
+
+#define IActContext_ReplaceMacrosInStrings(This,dwFlags,iComponentIndex,cStrings,rgpszSourceStrings,rgpszDestinationStrings,pCultureFallbackList) \
+ (This)->lpVtbl -> ReplaceMacrosInStrings(This,dwFlags,iComponentIndex,cStrings,rgpszSourceStrings,rgpszDestinationStrings,pCultureFallbackList)
+
+#define IActContext_GetComponentStringTableStrings(This,dwFlags,iComponentIndex,cStrings,rgpszSourceStrings,rgpszDestinationStrings,pCultureFallbackList) \
+ (This)->lpVtbl -> GetComponentStringTableStrings(This,dwFlags,iComponentIndex,cStrings,rgpszSourceStrings,rgpszDestinationStrings,pCultureFallbackList)
+
+#define IActContext_GetApplicationProperties(This,dwFlags,cProperties,rgpszPropertyNames,rgpszPropertyValues,rgiComponentIndices) \
+ (This)->lpVtbl -> GetApplicationProperties(This,dwFlags,cProperties,rgpszPropertyNames,rgpszPropertyValues,rgiComponentIndices)
+
+#define IActContext_ApplicationBasePath(This,dwFlags,ApplicationPath) \
+ (This)->lpVtbl -> ApplicationBasePath(This,dwFlags,ApplicationPath)
+
+#define IActContext_GetComponentManifest(This,dwFlags,Component,riid,ppIUnknown) \
+ (This)->lpVtbl -> GetComponentManifest(This,dwFlags,Component,riid,ppIUnknown)
+
+#define IActContext_GetComponentPayloadPath(This,dwFlags,Component,ppwszComponentPayloadPath) \
+ (This)->lpVtbl -> GetComponentPayloadPath(This,dwFlags,Component,ppwszComponentPayloadPath)
+
+#define IActContext_FindReferenceInContext(This,dwFlags,Reference,MatchedDefinition) \
+ (This)->lpVtbl -> FindReferenceInContext(This,dwFlags,Reference,MatchedDefinition)
+
+#define IActContext_CreateActContextFromCategoryInstance(This,dwFlags,CategoryInstance,ppCreatedAppContext) \
+ (This)->lpVtbl -> CreateActContextFromCategoryInstance(This,dwFlags,CategoryInstance,ppCreatedAppContext)
+
+#define IActContext_EnumComponents(This,dwFlags,ppIdentityEnum) \
+ (This)->lpVtbl -> EnumComponents(This,dwFlags,ppIdentityEnum)
+
+#define IActContext_PrepareForExecution(This,pInputs,pOutputs) \
+ (This)->lpVtbl -> PrepareForExecution(This,pInputs,pOutputs)
+
+#define IActContext_SetApplicationRunningState(This,dwFlags,ulState,Disposition) \
+ (This)->lpVtbl -> SetApplicationRunningState(This,dwFlags,ulState,Disposition)
+
+#define IActContext_GetApplicationStateFilesystemLocation(This,dwFlags,iComponentIndex,pCoordinateList,ppszPath) \
+ (This)->lpVtbl -> GetApplicationStateFilesystemLocation(This,dwFlags,iComponentIndex,pCoordinateList,ppszPath)
+
+#define IActContext_FindComponentsByDefinition(This,dwFlags,cComponents,pIDefinitionIdentities,rgiComponentIndices,rgulDispositions) \
+ (This)->lpVtbl -> FindComponentsByDefinition(This,dwFlags,cComponents,pIDefinitionIdentities,rgiComponentIndices,rgulDispositions)
+
+#define IActContext_FindComponentsByReference(This,dwFlags,cComponents,pIReferenceIdentities,rgComponentIndices,rgulDispositions) \
+ (This)->lpVtbl -> FindComponentsByReference(This,dwFlags,cComponents,pIReferenceIdentities,rgComponentIndices,rgulDispositions)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+/* [propget] */ HRESULT STDMETHODCALLTYPE IActContext_get_AppId_Proxy(
+ IActContext * This,
+ /* [retval][out] */ IDefinitionAppId **ppAppId);
+
+
+void __RPC_STUB IActContext_get_AppId_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IActContext_EnumCategories_Proxy(
+ IActContext * This,
+ /* [in] */ DWORD dwFlags,
+ /* [unique][in] */ IReferenceIdentity *pReferenceIdentity_ToMatch,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ IUnknown **ppIUnknown);
+
+
+void __RPC_STUB IActContext_EnumCategories_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IActContext_EnumSubcategories_Proxy(
+ IActContext * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionIdentity *pIDefinitionIdentity,
+ /* [in] */ LPCWSTR pszSubcategoryPathPattern,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ IUnknown **ppIUnknown);
+
+
+void __RPC_STUB IActContext_EnumSubcategories_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IActContext_EnumCategoryInstances_Proxy(
+ IActContext * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionIdentity *pIDefinitionIdentity_Category,
+ /* [in] */ LPCWSTR pszSubcategoryPath,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ IUnknown **ppIUnknown);
+
+
+void __RPC_STUB IActContext_EnumCategoryInstances_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IActContext_ReplaceMacrosInStrings_Proxy(
+ IActContext * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ SIZE_T iComponentIndex,
+ /* [in] */ SIZE_T cStrings,
+ /* [size_is][in] */ const LPCWSTR rgpszSourceStrings[ ],
+ /* [size_is][out] */ LPWSTR rgpszDestinationStrings[ ],
+ /* [in] */ PCCULTURE_FALLBACK_LIST pCultureFallbackList);
+
+
+void __RPC_STUB IActContext_ReplaceMacrosInStrings_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IActContext_GetComponentStringTableStrings_Proxy(
+ IActContext * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ SIZE_T iComponentIndex,
+ /* [in] */ SIZE_T cStrings,
+ /* [size_is][in] */ const LPCWSTR rgpszSourceStrings[ ],
+ /* [size_is][out] */ LPWSTR rgpszDestinationStrings[ ],
+ /* [in] */ PCCULTURE_FALLBACK_LIST pCultureFallbackList);
+
+
+void __RPC_STUB IActContext_GetComponentStringTableStrings_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IActContext_GetApplicationProperties_Proxy(
+ IActContext * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ SIZE_T cProperties,
+ /* [size_is][in] */ const LPCWSTR rgpszPropertyNames[ ],
+ /* [size_is][out] */ LPWSTR rgpszPropertyValues[ ],
+ /* [size_is][out] */ SIZE_T rgiComponentIndices[ ]);
+
+
+void __RPC_STUB IActContext_GetApplicationProperties_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IActContext_ApplicationBasePath_Proxy(
+ IActContext * This,
+ /* [in] */ DWORD dwFlags,
+ /* [retval][out] */ LPWSTR *ApplicationPath);
+
+
+void __RPC_STUB IActContext_ApplicationBasePath_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IActContext_GetComponentManifest_Proxy(
+ IActContext * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionIdentity *Component,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ IUnknown **ppIUnknown);
+
+
+void __RPC_STUB IActContext_GetComponentManifest_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IActContext_GetComponentPayloadPath_Proxy(
+ IActContext * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionIdentity *Component,
+ /* [retval][out] */ LPWSTR *ppwszComponentPayloadPath);
+
+
+void __RPC_STUB IActContext_GetComponentPayloadPath_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IActContext_FindReferenceInContext_Proxy(
+ IActContext * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IReferenceIdentity *Reference,
+ /* [retval][out] */ IDefinitionIdentity **MatchedDefinition);
+
+
+void __RPC_STUB IActContext_FindReferenceInContext_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IActContext_CreateActContextFromCategoryInstance_Proxy(
+ IActContext * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ PCCATEGORY_INSTANCE CategoryInstance,
+ /* [retval][out] */ IActContext **ppCreatedAppContext);
+
+
+void __RPC_STUB IActContext_CreateActContextFromCategoryInstance_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IActContext_EnumComponents_Proxy(
+ IActContext * This,
+ /* [in] */ DWORD dwFlags,
+ /* [retval][out] */ IEnumDefinitionIdentity **ppIdentityEnum);
+
+
+void __RPC_STUB IActContext_EnumComponents_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IActContext_PrepareForExecution_Proxy(
+ IActContext * This,
+ /* [in] */ PCIAPP_CONTEXT_PREPARE_FOR_EXECUTION_INPUTS pInputs,
+ /* [out][in] */ PIAPP_CONTEXT_PREPARE_FOR_EXECUTION_OUTPUTS pOutputs);
+
+
+void __RPC_STUB IActContext_PrepareForExecution_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IActContext_SetApplicationRunningState_Proxy(
+ IActContext * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ ULONG ulState,
+ /* [retval][out] */ ULONG *Disposition);
+
+
+void __RPC_STUB IActContext_SetApplicationRunningState_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IActContext_GetApplicationStateFilesystemLocation_Proxy(
+ IActContext * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ SIZE_T iComponentIndex,
+ /* [in] */ PCSTATE_COORDINATE_LIST pCoordinateList,
+ /* [out] */ LPWSTR *ppszPath);
+
+
+void __RPC_STUB IActContext_GetApplicationStateFilesystemLocation_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IActContext_FindComponentsByDefinition_Proxy(
+ IActContext * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ SIZE_T cComponents,
+ /* [size_is][in] */ IDefinitionIdentity *pIDefinitionIdentities[ ],
+ /* [size_is][out] */ SIZE_T rgiComponentIndices[ ],
+ /* [size_is][out] */ ULONG rgulDispositions[ ]);
+
+
+void __RPC_STUB IActContext_FindComponentsByDefinition_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IActContext_FindComponentsByReference_Proxy(
+ IActContext * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ SIZE_T cComponents,
+ /* [size_is][in] */ IReferenceIdentity *pIReferenceIdentities[ ],
+ /* [size_is][out] */ SIZE_T rgComponentIndices[ ],
+ /* [size_is][out] */ ULONG rgulDispositions[ ]);
+
+
+void __RPC_STUB IActContext_FindComponentsByReference_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IActContext_INTERFACE_DEFINED__ */
+
+
+#ifndef __IStateManager_INTERFACE_DEFINED__
+#define __IStateManager_INTERFACE_DEFINED__
+
+/* interface IStateManager */
+/* [local][unique][uuid][object] */
+
+/* [v1_enum] */
+enum _ISTATE_MANAGER_PREPARE_APPLICATION_STATE_INPUTS_FLAGS
+ { ISTATE_MANAGER_PREPARE_APPLICATION_STATE_INPUTS_FLAG_APPLICATION_TO_PREPARE_VALID = 0x1
+ } ;
+typedef struct _ISTATE_MANAGER_PREPARE_APPLICATION_STATE_INPUTS
+ {
+ ULONG ulSize;
+ DWORD dwFlags;
+ IActContext *pApplicationToPrepare;
+ } ISTATE_MANAGER_PREPARE_APPLICATION_STATE_INPUTS;
+
+typedef struct _ISTATE_MANAGER_PREPARE_APPLICATION_STATE_INPUTS *PISTATE_MANAGER_PREPARE_APPLICATION_STATE_INPUTS;
+
+typedef const ISTATE_MANAGER_PREPARE_APPLICATION_STATE_INPUTS *PCISTATE_MANAGER_PREPARE_APPLICATION_STATE_INPUTS;
+
+/* [v1_enum] */
+enum _ISTATE_MANAGER_PREPARE_APPLICATION_STATE_OUTPUTS_FLAGS
+ { ISTATE_MANAGER_PREPARE_APPLICATION_STATE_OUTPUTS_FLAG_OVERALL_DISPOSITION_VALID = 0x1
+ } ;
+typedef struct _ISTATE_MANAGER_PREPARE_APPLICATION_STATE_OUTPUTS
+ {
+ ULONG ulSize;
+ DWORD dwFlags;
+ DWORD dwOverallDisposition;
+ } ISTATE_MANAGER_PREPARE_APPLICATION_STATE_OUTPUTS;
+
+typedef struct _ISTATE_MANAGER_PREPARE_APPLICATION_STATE_OUTPUTS *PISTATE_MANAGER_PREPARE_APPLICATION_STATE_OUTPUTS;
+
+typedef const ISTATE_MANAGER_PREPARE_APPLICATION_STATE_OUTPUTS *PCISTATE_MANAGER_PREPARE_APPLICATION_STATE_OUTPUTS;
+
+/* [v1_enum] */
+enum _ISTATE_MANAGER_SET_APPLICATION_RUNNING_STATES
+ { ISTATE_MANAGER_SET_APPLICATION_RUNNING_STATE_UNDEFINED = 0,
+ ISTATE_MANAGER_SET_APPLICATION_RUNNING_STATE_STARTING = 1,
+ ISTATE_MANAGER_SET_APPLICATION_RUNNING_STATE_RUNNING = 2
+ } ;
+/* [v1_enum] */
+enum _ISTATE_MANAGER_SET_APPLICATION_RUNNING_STATE_DISPOSITIONS
+ { ISTATE_MANAGER_SET_APPLICATION_RUNNING_STATE_DISPOSITION_UNDEFINED = 0,
+ ISTATE_MANAGER_SET_APPLICATION_RUNNING_STATE_DISPOSITION_STARTING = 1,
+ ISTATE_MANAGER_SET_APPLICATION_RUNNING_STATE_DISPOSITION_STARTING_MIGRATED = 1 << 16,
+ ISTATE_MANAGER_SET_APPLICATION_RUNNING_STATE_DISPOSITION_RUNNING = 2,
+ ISTATE_MANAGER_SET_APPLICATION_RUNNING_STATE_DISPOSITION_RUNNING_FIRST_RUN = 1 << 17
+ } ;
+
+EXTERN_C const IID IID_IStateManager;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("07662534-750b-4ed5-9cfb-1c5bc5acfd07")
+ IStateManager : public IUnknown
+ {
+ public:
+ virtual HRESULT STDMETHODCALLTYPE PrepareApplicationState(
+ /* [in] */ PCISTATE_MANAGER_PREPARE_APPLICATION_STATE_INPUTS pInputs,
+ /* [out][in] */ PISTATE_MANAGER_PREPARE_APPLICATION_STATE_OUTPUTS pOutputs) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE SetApplicationRunningState(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IActContext *pIActContext,
+ /* [in] */ ULONG ulState,
+ /* [in] */ ULONG *pulDisposition) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE GetApplicationStateFilesystemLocation(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionAppId *pIDefinitionAppId_Application,
+ /* [in] */ IDefinitionIdentity *pIDefinitionIdentity_Component,
+ /* [in] */ PCSTATE_COORDINATE_LIST pCoordinateList,
+ /* [out] */ LPWSTR *ppszPath) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Scavenge(
+ /* [in] */ DWORD dwFlags,
+ /* [out] */ DWORD *pdwDisposition) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IStateManagerVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IStateManager * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IStateManager * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IStateManager * This);
+
+ HRESULT ( STDMETHODCALLTYPE *PrepareApplicationState )(
+ IStateManager * This,
+ /* [in] */ PCISTATE_MANAGER_PREPARE_APPLICATION_STATE_INPUTS pInputs,
+ /* [out][in] */ PISTATE_MANAGER_PREPARE_APPLICATION_STATE_OUTPUTS pOutputs);
+
+ HRESULT ( STDMETHODCALLTYPE *SetApplicationRunningState )(
+ IStateManager * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IActContext *pIActContext,
+ /* [in] */ ULONG ulState,
+ /* [in] */ ULONG *pulDisposition);
+
+ HRESULT ( STDMETHODCALLTYPE *GetApplicationStateFilesystemLocation )(
+ IStateManager * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionAppId *pIDefinitionAppId_Application,
+ /* [in] */ IDefinitionIdentity *pIDefinitionIdentity_Component,
+ /* [in] */ PCSTATE_COORDINATE_LIST pCoordinateList,
+ /* [out] */ LPWSTR *ppszPath);
+
+ HRESULT ( STDMETHODCALLTYPE *Scavenge )(
+ IStateManager * This,
+ /* [in] */ DWORD dwFlags,
+ /* [out] */ DWORD *pdwDisposition);
+
+ END_INTERFACE
+ } IStateManagerVtbl;
+
+ interface IStateManager
+ {
+ CONST_VTBL struct IStateManagerVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IStateManager_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IStateManager_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IStateManager_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IStateManager_PrepareApplicationState(This,pInputs,pOutputs) \
+ (This)->lpVtbl -> PrepareApplicationState(This,pInputs,pOutputs)
+
+#define IStateManager_SetApplicationRunningState(This,dwFlags,pIActContext,ulState,pulDisposition) \
+ (This)->lpVtbl -> SetApplicationRunningState(This,dwFlags,pIActContext,ulState,pulDisposition)
+
+#define IStateManager_GetApplicationStateFilesystemLocation(This,dwFlags,pIDefinitionAppId_Application,pIDefinitionIdentity_Component,pCoordinateList,ppszPath) \
+ (This)->lpVtbl -> GetApplicationStateFilesystemLocation(This,dwFlags,pIDefinitionAppId_Application,pIDefinitionIdentity_Component,pCoordinateList,ppszPath)
+
+#define IStateManager_Scavenge(This,dwFlags,pdwDisposition) \
+ (This)->lpVtbl -> Scavenge(This,dwFlags,pdwDisposition)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+HRESULT STDMETHODCALLTYPE IStateManager_PrepareApplicationState_Proxy(
+ IStateManager * This,
+ /* [in] */ PCISTATE_MANAGER_PREPARE_APPLICATION_STATE_INPUTS pInputs,
+ /* [out][in] */ PISTATE_MANAGER_PREPARE_APPLICATION_STATE_OUTPUTS pOutputs);
+
+
+void __RPC_STUB IStateManager_PrepareApplicationState_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IStateManager_SetApplicationRunningState_Proxy(
+ IStateManager * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IActContext *pIActContext,
+ /* [in] */ ULONG ulState,
+ /* [in] */ ULONG *pulDisposition);
+
+
+void __RPC_STUB IStateManager_SetApplicationRunningState_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IStateManager_GetApplicationStateFilesystemLocation_Proxy(
+ IStateManager * This,
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ IDefinitionAppId *pIDefinitionAppId_Application,
+ /* [in] */ IDefinitionIdentity *pIDefinitionIdentity_Component,
+ /* [in] */ PCSTATE_COORDINATE_LIST pCoordinateList,
+ /* [out] */ LPWSTR *ppszPath);
+
+
+void __RPC_STUB IStateManager_GetApplicationStateFilesystemLocation_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IStateManager_Scavenge_Proxy(
+ IStateManager * This,
+ /* [in] */ DWORD dwFlags,
+ /* [out] */ DWORD *pdwDisposition);
+
+
+void __RPC_STUB IStateManager_Scavenge_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IStateManager_INTERFACE_DEFINED__ */
+
+
+#ifndef __IManifestParseErrorCallback_INTERFACE_DEFINED__
+#define __IManifestParseErrorCallback_INTERFACE_DEFINED__
+
+/* interface IManifestParseErrorCallback */
+/* [local][unique][uuid][object] */
+
+
+EXTERN_C const IID IID_IManifestParseErrorCallback;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("ace1b703-1aac-4956-ab87-90cac8b93ce6")
+ IManifestParseErrorCallback : public IUnknown
+ {
+ public:
+ virtual HRESULT STDMETHODCALLTYPE OnError(
+ /* [in] */ ULONG nStartLine,
+ /* [in] */ ULONG nStartColumn,
+ /* [in] */ ULONG cCharacterCount,
+ /* [in] */ HRESULT hr,
+ /* [in] */ LPCWSTR pszErrorStatusHostFile,
+ /* [in] */ ULONG cParameterCount,
+ /* [size_is][in] */ LPCWSTR *prgpszParameters) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IManifestParseErrorCallbackVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE *QueryInterface )(
+ IManifestParseErrorCallback * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void **ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE *AddRef )(
+ IManifestParseErrorCallback * This);
+
+ ULONG ( STDMETHODCALLTYPE *Release )(
+ IManifestParseErrorCallback * This);
+
+ HRESULT ( STDMETHODCALLTYPE *OnError )(
+ IManifestParseErrorCallback * This,
+ /* [in] */ ULONG nStartLine,
+ /* [in] */ ULONG nStartColumn,
+ /* [in] */ ULONG cCharacterCount,
+ /* [in] */ HRESULT hr,
+ /* [in] */ LPCWSTR pszErrorStatusHostFile,
+ /* [in] */ ULONG cParameterCount,
+ /* [size_is][in] */ LPCWSTR *prgpszParameters);
+
+ END_INTERFACE
+ } IManifestParseErrorCallbackVtbl;
+
+ interface IManifestParseErrorCallback
+ {
+ CONST_VTBL struct IManifestParseErrorCallbackVtbl *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IManifestParseErrorCallback_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IManifestParseErrorCallback_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IManifestParseErrorCallback_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IManifestParseErrorCallback_OnError(This,nStartLine,nStartColumn,cCharacterCount,hr,pszErrorStatusHostFile,cParameterCount,prgpszParameters) \
+ (This)->lpVtbl -> OnError(This,nStartLine,nStartColumn,cCharacterCount,hr,pszErrorStatusHostFile,cParameterCount,prgpszParameters)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+HRESULT STDMETHODCALLTYPE IManifestParseErrorCallback_OnError_Proxy(
+ IManifestParseErrorCallback * This,
+ /* [in] */ ULONG nStartLine,
+ /* [in] */ ULONG nStartColumn,
+ /* [in] */ ULONG cCharacterCount,
+ /* [in] */ HRESULT hr,
+ /* [in] */ LPCWSTR pszErrorStatusHostFile,
+ /* [in] */ ULONG cParameterCount,
+ /* [size_is][in] */ LPCWSTR *prgpszParameters);
+
+
+void __RPC_STUB IManifestParseErrorCallback_OnError_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IManifestParseErrorCallback_INTERFACE_DEFINED__ */
+
+
+/* interface __MIDL_itf_isolation_0347 */
+/* [local] */
+
+/* [local] */ HRESULT __stdcall GetAppIdAuthority(
+ /* [out] */ IAppIdAuthority **ppIAppIdAuthority);
+
+/* [local] */ HRESULT __stdcall GetIdentityAuthority(
+ /* [out] */ IIdentityAuthority **ppIIdentityAuthority);
+
+/* [local] */ HRESULT __stdcall SetIsolationIMalloc(
+ /* [in] */ IMalloc *pIMalloc);
+
+/* [local] */ HRESULT __stdcall GetSystemStore(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ IUnknown **ppIStore);
+
+/* [local] */ HRESULT __stdcall GetUserStore(
+ /* [in] */ DWORD dwFlags,
+ /* [in] */ HANDLE hToken,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ IUnknown **ppIStore);
+
+/* [local] */ HRESULT __stdcall GetUserStateManager(
+ /* [in] */ DWORD Flags,
+ /* [in] */ HANDLE hToken,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ IUnknown **ppManager);
+
+/* [local] */ HRESULT __stdcall ParseManifest(
+ /* [in] */ LPCWSTR pszManifestPath,
+ /* [unique][in] */ IManifestParseErrorCallback *pIManifestParseErrorCallback,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ IUnknown **ppManifest);
+
+/* [local] */ HRESULT __stdcall CreateCMSFromXml(
+ /* [in] */ void *Data,
+ /* [in] */ DWORD DataSize,
+ /* [unique][in] */ IManifestParseErrorCallback *pIManifestParseErrorCallback,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ IUnknown **ppManifest);
+
+/* [local] */ HRESULT __stdcall GetCurrentActContext(
+ /* [out] */ IActContext **ppIActContext);
+
+/* [local] */ HRESULT __stdcall CreateActContext(
+ /* [in] */ PCCREATE_APP_CONTEXT_DATA Data,
+ /* [out] */ IActContext **ppIActContext);
+
+
+
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0347_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_isolation_0347_v0_0_s_ifspec;
+
+
+#ifndef __Isolation_LIBRARY_DEFINED__
+#define __Isolation_LIBRARY_DEFINED__
+
+/* library Isolation */
+/* [version][helpstring][uuid] */
+
+
+EXTERN_C const IID LIBID_Isolation;
+#endif /* __Isolation_LIBRARY_DEFINED__ */
+
+/* Additional Prototypes for ALL interfaces */
+
+unsigned long __RPC_USER BSTR_UserSize( unsigned long *, unsigned long , BSTR * );
+unsigned char * __RPC_USER BSTR_UserMarshal( unsigned long *, unsigned char *, BSTR * );
+unsigned char * __RPC_USER BSTR_UserUnmarshal(unsigned long *, unsigned char *, BSTR * );
+void __RPC_USER BSTR_UserFree( unsigned long *, BSTR * );
+
+unsigned long __RPC_USER LPSAFEARRAY_UserSize( unsigned long *, unsigned long , LPSAFEARRAY * );
+unsigned char * __RPC_USER LPSAFEARRAY_UserMarshal( unsigned long *, unsigned char *, LPSAFEARRAY * );
+unsigned char * __RPC_USER LPSAFEARRAY_UserUnmarshal(unsigned long *, unsigned char *, LPSAFEARRAY * );
+void __RPC_USER LPSAFEARRAY_UserFree( unsigned long *, LPSAFEARRAY * );
+
+/* end of Additional Prototypes */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+
diff --git a/src/inc/iterator.h b/src/inc/iterator.h
new file mode 100644
index 0000000000..98cf6185e0
--- /dev/null
+++ b/src/inc/iterator.h
@@ -0,0 +1,639 @@
+// 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.
+// ---------------------------------------------------------------------------
+// Iterator.h
+// ---------------------------------------------------------------------------
+
+// ================================================================================
+// Iterator pattern:
+//
+// This pattern is similar to the STL iterator pattern. It basically consists of
+// wrapping an "iteration variable" in an object, and providing pointer-like operators
+// on the iterator. Example usage:
+//
+// for (Iterator start = foo->Begin(), end = foo->End(); start != end; start++)
+// {
+// // use foo, start
+// }
+//
+// There are 3 levels of iterator functionality
+// 1. Enumerator (STL forward) - only go forward one at a time
+// Enumerators have the following operations:
+// operator * : access current element as ref
+// operator -> : access current element as ptr
+// operator++ : go to the next element
+// operator==, operator!= : compare to another enumerator
+//
+//
+// 2. Scanner (STL bidirectional) - backward or forward one at a time
+// Scanners have all the functionality of enumerators, plus:
+// operator-- : go backward one element
+//
+// 3. Indexer (STL random access) - skip around arbitrarily
+// Indexers have all the functionality of scanners, plus:
+// operator[] : access the element at index from iterator as ref
+// operator+= : advance iterator by index
+// operator+ : return new iterator at index from iterator
+// operator-= : rewind iterator by index
+// operator- : return new iterator at index back from iterator
+// operator <, operator <=, operator >, operator>= :
+// range comparison on two indexers
+//
+// The object being iterated should define the following methods:
+// Begin() return an iterator starting at the first element
+// End() return an iterator just past the last element
+//
+// Iterator types are normally defined as member types named "Iterator", no matter
+// what their functionality level is.
+// ================================================================================
+
+
+#ifndef ITERATOR_H_
+#define ITERATOR_H_
+
+#include "contract.h"
+
+namespace HIDDEN {
+// These prototypes are not for direct use - they are only here to illustrate the
+// iterator pattern
+
+template <typename CONTAINER, typename ELEMENT>
+class ScannerPrototype
+{
+ public:
+
+ typedef ScannerPrototype<CONTAINER, ELEMENT> Iterator;
+
+ ELEMENT &operator*();
+ ELEMENT *operator->();
+
+ Iterator &operator++();
+ Iterator operator++(int);
+ Iterator &operator--();
+ Iterator operator--(int);
+
+ bool operator==(const Iterator &i);
+ bool operator!=(const Iterator &i);
+};
+
+template <typename CONTAINER, typename ELEMENT>
+class EnumeratorPrototype
+{
+ public:
+
+ typedef EnumeratorPrototype<CONTAINER, ELEMENT> Iterator;
+
+ ELEMENT &operator*();
+ ELEMENT *operator->();
+
+ Iterator &operator++();
+ Iterator operator++(int);
+
+ bool operator==(const Iterator &i);
+ bool operator!=(const Iterator &i);
+};
+
+template <typename CONTAINER, typename ELEMENT>
+class IndexerPrototype
+{
+ public:
+ typedef IndexerPrototype<CONTAINER, ELEMENT> Iterator;
+
+ ELEMENT &operator*();
+ ELEMENT *operator->();
+ ELEMENT &operator[](int index);
+
+ Iterator &operator++();
+ Iterator operator++(int);
+ Iterator &operator--();
+ Iterator operator--(int);
+
+ Iterator &operator+=(SCOUNT_T index);
+ Iterator &operator-=(SCOUNT_T index);
+
+ Iterator operator+(SCOUNT_T index);
+ Iterator operator-(SCOUNT_T index);
+
+ SCOUNT_T operator-(Iterator &i);
+
+ bool operator==(const Iterator &i);
+ bool operator!=(const Iterator &i);
+ bool operator<(const Iterator &i);
+ bool operator<=(const Iterator &i);
+ bool operator>(const Iterator &i);
+ bool operator>=(const Iterator &i);
+};
+
+template <typename ELEMENT>
+class EnumerablePrototype
+{
+ typedef EnumeratorPrototype<EnumerablePrototype, ELEMENT> Iterator;
+
+ Iterator Begin();
+ Iterator End();
+};
+
+template <typename ELEMENT>
+class ScannablePrototype
+{
+ typedef ScannerPrototype<ScannablePrototype, ELEMENT> Iterator;
+
+ Iterator Begin();
+ Iterator End();
+};
+
+template <typename ELEMENT>
+class IndexablePrototype
+{
+ typedef IndexerPrototype<IndexablePrototype, ELEMENT> Iterator;
+
+ Iterator Begin();
+ Iterator End();
+};
+
+};
+
+// --------------------------------------------------------------------------------
+// EnumeratorBase, ScannerBase, and IndexerBase are abstract classes
+// describing basic operations for iterator functionality at the different levels.
+//
+// You
+// 1. Use the classes as a pattern (don't derive from them), and plug in your own
+// class into the Enumerator/Scanner/Indexer templates below.
+// 2. Subclass the AbstractEnumerator/AbstractScanner/AbstractIndexer classes
+// --------------------------------------------------------------------------------
+
+namespace HIDDEN
+{
+// These prototypes are not for direct use - they are only here to illustrate the
+// pattern of the BASE class for the Iterator templates
+
+template <typename ELEMENT, typename CONTAINER>
+class EnumeratorBasePrototype
+{
+ protected:
+ EnumeratorBasePrototype(CONTAINER *container, BOOL begin);
+ ELEMENT &Get() const;
+ void Next();
+ BOOL Equal(const EnumeratorBasePrototype &i) const;
+ CHECK DoCheck() const;
+};
+
+template <typename ELEMENT, typename CONTAINER>
+class ScannerBasePrototype
+{
+ protected:
+ ScannerBasePrototype(CONTAINER *container, BOOL begin);
+ ELEMENT &Get() const;
+ void Next();
+ void Previous();
+ BOOL Equal(const ScannerBasePrototype &i) const;
+ CHECK DoCheck() const;
+};
+
+template <typename ELEMENT, typename CONTAINER>
+class IndexerBasePrototype
+{
+ protected:
+ IndexerBasePrototype(CONTAINER *container, SCOUNT_T delta);
+ ELEMENT &GetAt(SCOUNT_T delta) const;
+ void Skip(SCOUNT_T delta);
+ SCOUNT_T Subtract(const IndexerBasePrototype &i) const;
+ CHECK DoCheck(SCOUNT_T delta) const;
+};
+
+};
+
+
+template <typename CONTAINER>
+class CheckedIteratorBase
+{
+ protected:
+#if defined(_DEBUG)
+ const CONTAINER *m_container;
+ int m_revision;
+#endif
+
+ CHECK CheckRevision() const
+ {
+ LIMITED_METHOD_CONTRACT;
+ SUPPORTS_DAC;
+#if defined(_DEBUG)
+ __if_exists(CONTAINER::m_revision)
+ {
+ CHECK_MSG(m_revision == m_container->m_revision,
+ "Use of Iterator after container has been modified");
+ }
+#endif
+ CHECK_OK;
+ }
+
+ CheckedIteratorBase()
+ {
+ LIMITED_METHOD_DAC_CONTRACT;
+#if defined(_DEBUG)
+ m_container = NULL;
+#endif
+ }
+
+ CheckedIteratorBase(const CONTAINER *container)
+ {
+ LIMITED_METHOD_CONTRACT;
+#if defined(_DEBUG)
+ m_container = container;
+ __if_exists(CONTAINER::m_revision)
+ {
+ m_revision = m_container->m_revision;
+ }
+#endif
+ }
+
+ void Resync(const CONTAINER *container)
+ {
+ LIMITED_METHOD_DAC_CONTRACT;
+
+#if defined(_DEBUG)
+ __if_exists(CONTAINER::m_revision)
+ {
+ m_revision = m_container->m_revision;
+ }
+#endif
+ }
+
+#if defined(_DEBUG)
+ const CONTAINER *GetContainerDebug() const
+ {
+ LIMITED_METHOD_CONTRACT;
+ return m_container;
+ }
+#endif
+
+ public:
+ CHECK Check() const
+ {
+ WRAPPER_NO_CONTRACT;
+ SUPPORTS_DAC;
+ CHECK(CheckRevision());
+ CHECK_OK;
+ }
+
+ CHECK CheckContainer(const CONTAINER *container) const
+ {
+ WRAPPER_NO_CONTRACT;
+#if defined(_DEBUG)
+ CHECK(container == m_container);
+#endif
+ CHECK_OK;
+ }
+
+};
+
+
+// --------------------------------------------------------------------------------
+// Enumerator, Scanner, and Indexer provide a template to produce an iterator
+// on an existing class with a single iteration variable.
+//
+// The template takes 3 type parameters:
+// CONTAINER - type of object being interated on
+// ELEMENT - type of iteration
+// BASE - base type of the iteration. This type must follow the pattern described
+// by the above Prototypes
+// --------------------------------------------------------------------------------
+
+template <typename ELEMENT, typename SUBTYPE>
+class Enumerator
+{
+ private:
+ const SUBTYPE *This() const
+ {
+ return (const SUBTYPE *) this;
+ }
+
+ SUBTYPE *This()
+ {
+ return (SUBTYPE *)this;
+ }
+
+ public:
+
+ Enumerator()
+ {
+ }
+
+ CHECK CheckIndex() const
+ {
+#if defined(_DEBUG)
+ CHECK(This()->DoCheck());
+#endif
+ CHECK_OK;
+ }
+
+ ELEMENT &operator*() const
+ {
+ PRECONDITION(CheckPointer(This()));
+ PRECONDITION(This()->CheckIndex());
+
+ return This()->Get();
+ }
+ ELEMENT *operator->() const
+ {
+ PRECONDITION(CheckPointer(This()));
+ PRECONDITION(This()->CheckIndex());
+
+ return &(This()->Get());
+ }
+ SUBTYPE &operator++()
+ {
+ PRECONDITION(CheckPointer(This()));
+
+ This()->Next();
+ return *This();
+ }
+ SUBTYPE operator++(int)
+ {
+ PRECONDITION(CheckPointer(This()));
+
+ SUBTYPE i = *This();
+ This()->Next();
+ return i;
+ }
+ bool operator==(const SUBTYPE &i) const
+ {
+ PRECONDITION(CheckPointer(This()));
+ PRECONDITION(i.Check());
+
+ return This()->Equal(i);
+ }
+ bool operator!=(const SUBTYPE &i) const
+ {
+ PRECONDITION(CheckPointer(This()));
+ PRECONDITION(i.Check());
+
+ return !This()->Equal(i);
+ }
+};
+
+template <typename ELEMENT, typename SUBTYPE>
+class Scanner
+{
+ private:
+ const SUBTYPE *This() const
+ {
+ return (const SUBTYPE *)this;
+ }
+
+ SUBTYPE *This()
+ {
+ return (SUBTYPE *)this;
+ }
+
+ public:
+
+ Scanner()
+ {
+ }
+
+ CHECK CheckIndex() const
+ {
+#if defined(_DEBUG)
+ CHECK(This()->DoCheck());
+#endif
+ CHECK_OK;
+ }
+
+ ELEMENT &operator*() const
+ {
+ PRECONDITION(CheckPointer(This()));
+ PRECONDITION(This()->CheckIndex());
+
+ return This()->Get();
+ }
+ ELEMENT *operator->() const
+ {
+ PRECONDITION(CheckPointer(This()));
+ PRECONDITION(This()->CheckIndex());
+
+ return &This()->Get();
+ }
+ SUBTYPE &operator++()
+ {
+ PRECONDITION(CheckPointer(This()));
+
+ This()->Next();
+ return *This();
+ }
+ SUBTYPE operator++(int)
+ {
+ PRECONDITION(CheckPointer(This()));
+
+ SUBTYPE i = *This();
+ This()->Next();
+ return i;
+ }
+ SUBTYPE &operator--()
+ {
+ PRECONDITION(CheckPointer(This()));
+
+ This()->Previous();
+ return *This();
+ }
+ SUBTYPE operator--(int)
+ {
+ PRECONDITION(CheckPointer(this));
+
+ SUBTYPE i = *This();
+ This()->Previous();
+ return i;
+ }
+ bool operator==(const SUBTYPE &i) const
+ {
+ PRECONDITION(CheckPointer(This()));
+ PRECONDITION(i.Check());
+
+ return This()->Equal(i);
+ }
+ bool operator!=(const SUBTYPE &i) const
+ {
+ PRECONDITION(CheckPointer(This()));
+ PRECONDITION(i.Check());
+
+ return !This()->Equal(i);
+ }
+};
+
+template <typename ELEMENT, typename SUBTYPE>
+class Indexer
+{
+ private:
+ const SUBTYPE *This() const
+ {
+ return (const SUBTYPE *)this;
+ }
+
+ SUBTYPE *This()
+ {
+ return (SUBTYPE *)this;
+ }
+
+ public:
+
+ Indexer()
+ {
+ LIMITED_METHOD_DAC_CONTRACT;
+ }
+
+ CHECK CheckIndex() const
+ {
+#if defined(_DEBUG)
+ CHECK(This()->DoCheck(0));
+#endif
+ CHECK_OK;
+ }
+
+ CHECK CheckIndex(int index) const
+ {
+#if defined(_DEBUG)
+ CHECK(This()->DoCheck(index));
+#endif
+ CHECK_OK;
+ }
+
+ ELEMENT &operator*() const
+ {
+ WRAPPER_NO_CONTRACT;
+ PRECONDITION(CheckPointer(This()));
+ PRECONDITION(This()->CheckIndex(0));
+
+ return *(ELEMENT*)&This()->GetAt(0);
+ }
+ ELEMENT *operator->() const
+ {
+ WRAPPER_NO_CONTRACT;
+ PRECONDITION(CheckPointer(This()));
+ PRECONDITION(This()->CheckIndex(0));
+
+ return &This()->GetAt(0);
+ }
+ ELEMENT &operator[](int index) const
+ {
+ WRAPPER_NO_CONTRACT;
+ PRECONDITION(CheckPointer(This()));
+ PRECONDITION(This()->CheckIndex(index));
+ return *(ELEMENT*)&This()->GetAt(index);
+ }
+ SUBTYPE &operator++()
+ {
+ WRAPPER_NO_CONTRACT;
+ PRECONDITION(CheckPointer(This()));
+ This()->Skip(1);
+ return *This();
+ }
+ SUBTYPE operator++(int)
+ {
+ WRAPPER_NO_CONTRACT;
+ PRECONDITION(CheckPointer(This()));
+ SUBTYPE i = *This();
+ This()->Skip(1);
+ return i;
+ }
+ SUBTYPE &operator--()
+ {
+ WRAPPER_NO_CONTRACT;
+ PRECONDITION(CheckPointer(This()));
+ This()->Skip(-1);
+ return *This();
+ }
+ SUBTYPE operator--(int)
+ {
+ WRAPPER_NO_CONTRACT;
+ PRECONDITION(CheckPointer(This()));
+ SUBTYPE i = *This();
+ This()->Skip(-1);
+ return i;
+ }
+ SUBTYPE &operator+=(SCOUNT_T index)
+ {
+ WRAPPER_NO_CONTRACT;
+ PRECONDITION(CheckPointer(This()));
+ This()->Skip(index);
+ return *This();
+ }
+ SUBTYPE operator+(SCOUNT_T index) const
+ {
+ WRAPPER_NO_CONTRACT;
+ PRECONDITION(CheckPointer(This()));
+ SUBTYPE i = *This();
+ i.Skip(index);
+ return i;
+ }
+ SUBTYPE &operator-=(SCOUNT_T index)
+ {
+ WRAPPER_NO_CONTRACT;
+ PRECONDITION(CheckPointer(This()));
+ This()->Skip(-index);
+ return *This();
+ }
+ SUBTYPE operator-(SCOUNT_T index) const
+ {
+ WRAPPER_NO_CONTRACT;
+ PRECONDITION(CheckPointer(This()));
+ SUBTYPE i = *This();
+ i.Skip(-index);
+ return i;
+ }
+ SCOUNT_T operator-(const SUBTYPE &i) const
+ {
+ WRAPPER_NO_CONTRACT;
+ PRECONDITION(CheckPointer(This()));
+ PRECONDITION(i.Check());
+
+ return This()->Subtract(i);
+ }
+ bool operator==(const SUBTYPE &i) const
+ {
+ WRAPPER_NO_CONTRACT;
+ PRECONDITION(CheckPointer(This()));
+ PRECONDITION(i.Check());
+
+ return This()->Subtract(i) == 0;
+ }
+ bool operator!=(const SUBTYPE &i) const
+ {
+ WRAPPER_NO_CONTRACT;
+ PRECONDITION(CheckPointer(This()));
+ PRECONDITION(i.Check());
+
+ return This()->Subtract(i) != 0;
+ }
+ bool operator<(const SUBTYPE &i) const
+ {
+ WRAPPER_NO_CONTRACT;
+ PRECONDITION(CheckPointer(This()));
+ PRECONDITION(i.Check());
+ return This()->Subtract(i) < 0;
+ }
+ bool operator<=(const SUBTYPE &i) const
+ {
+ WRAPPER_NO_CONTRACT;
+ PRECONDITION(CheckPointer(This()));
+ PRECONDITION(i.Check());
+ return This()->Subtract(i) <= 0;
+ }
+ bool operator>(const SUBTYPE &i) const
+ {
+ WRAPPER_NO_CONTRACT;
+ PRECONDITION(CheckPointer(This()));
+ PRECONDITION(i.Check());
+ return This()->Subtract(i) > 0;
+ }
+ bool operator>=(const SUBTYPE &i) const
+ {
+ WRAPPER_NO_CONTRACT;
+ PRECONDITION(CheckPointer(This()));
+ PRECONDITION(i.Check());
+ return This()->Subtract(i) >= 0;
+ }
+};
+
+#endif // ITERATOR_H_
diff --git a/src/inc/ivalidator.idl b/src/inc/ivalidator.idl
new file mode 100644
index 0000000000..d028d9888e
--- /dev/null
+++ b/src/inc/ivalidator.idl
@@ -0,0 +1,116 @@
+// 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.
+/* ------------------------------------------------------------------------- *
+ * Common Language Runtime Verifier / Validator Interace
+ *
+ * Purpose: IValidator is used to staticly validate COR images.
+ *
+ * Protocol:
+ *
+ * Client CoCreates CorHost.Validator,
+ * Calls Validate()
+ * [in/optional] IVEHandler for error callbacks on error
+ * [in/optional] Appdomain to use for validating assemblies
+ *
+ * On Error, Validator calls IVEHandler.VEHandler() method.
+ * (IVEHandler supplied by the client).
+ * VEHandler() could return CONTINUE / STOP ...
+ *
+ * VEHandler() can call Validator.FormatEventInfo() to get a detailed
+ * error message on any error passed to IVEHandler.
+ *
+ * ------------------------------------------------------------------------- */
+
+/* ------------------------------------------------------------------------- *
+ * Imported types
+ * ------------------------------------------------------------------------- */
+
+#ifndef DO_NO_IMPORTS
+import "ivehandler.idl";
+#endif
+
+#pragma warning(push)
+#pragma warning(disable:28718) //Unable to annotate as this is not a local interface
+
+
+
+/* ------------------------------------------------------------------------- *
+ * Forward declarations
+ * ------------------------------------------------------------------------- */
+
+interface IValidator;
+interface ILoader;
+
+
+/* ------------------------------------------------------------------------- *
+ * Flags
+ * ------------------------------------------------------------------------- */
+enum ValidatorFlags
+{
+ VALIDATOR_EXTRA_VERBOSE = 0x00000001,
+ VALIDATOR_SHOW_SOURCE_LINES = 0x00000002, // RESERVED FOR FUTURE USE
+ VALIDATOR_CHECK_ILONLY = 0x00000004,
+ VALIDATOR_CHECK_PEFORMAT_ONLY = 0x00000008,
+ VALIDATOR_NOCHECK_PEFORMAT = 0x00000010,
+ VALIDATOR_TRANSPARENT_ONLY = 0x00000020,
+};
+
+/* ------------------------------------------------------------------------- *
+ * IValidator interface
+ * ------------------------------------------------------------------------- */
+[
+ object,
+ uuid(63DF8730-DC81-4062-84A2-1FF943F59FAC),
+ pointer_default(unique)
+]
+interface IValidator : IUnknown
+{
+ HRESULT Validate(
+ [in] IVEHandler *veh,
+ [in] IUnknown *pAppDomain,
+ [in] unsigned long ulFlags,
+ [in] unsigned long ulMaxError,
+ [in] unsigned long token,
+ [in] LPWSTR fileName,
+ [in, size_is(ulSize)] BYTE *pe,
+ [in] unsigned long ulSize);
+
+ HRESULT FormatEventInfo(
+ [in] HRESULT hVECode,
+ [in] VEContext Context,
+ [in, out] LPWSTR msg,
+ [in] unsigned long ulMaxLength,
+ [in] SAFEARRAY(VARIANT) psa);
+};
+
+
+/* ------------------------------------------------------------------------- *
+ * ICLRValidator interface
+ * ------------------------------------------------------------------------- */
+[
+ object,
+ uuid(63DF8730-DC81-4062-84A2-1FF943F59FDD),
+ pointer_default(unique)
+]
+interface ICLRValidator : IUnknown
+{
+ HRESULT Validate(
+ [in] IVEHandler *veh,
+ [in] unsigned long ulAppDomainId,
+ [in] unsigned long ulFlags,
+ [in] unsigned long ulMaxError,
+ [in] unsigned long token,
+ [in] LPWSTR fileName,
+ [in, size_is(ulSize)] BYTE *pe,
+ [in] unsigned long ulSize);
+
+ HRESULT FormatEventInfo(
+ [in] HRESULT hVECode,
+ [in] VEContext Context,
+ [in, out] LPWSTR msg,
+ [in] unsigned long ulMaxLength,
+ [in] SAFEARRAY(VARIANT) psa);
+};
+#pragma warning(pop)
+
diff --git a/src/inc/ivehandler.idl b/src/inc/ivehandler.idl
new file mode 100644
index 0000000000..0c0ad2b9da
--- /dev/null
+++ b/src/inc/ivehandler.idl
@@ -0,0 +1,72 @@
+// 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.
+/* ------------------------------------------------------------------------- *
+ * Common Language Runtime Verification Event Handler Interface
+ * ------------------------------------------------------------------------- */
+
+/* ------------------------------------------------------------------------- *
+ * Imported types
+ * ------------------------------------------------------------------------- */
+
+#ifndef DO_NO_IMPORTS
+
+import "unknwn.idl";
+
+#define _VER_RAW_STRUCT_FOR_IDL_
+#include "VerError.h"
+#undef _VER_RAW_STRUCT_FOR_IDL_
+
+#endif
+
+typedef _VerError VEContext;
+
+/* ------------------------------------------------------------------------- *
+ * Forward declarations
+ * ------------------------------------------------------------------------- */
+
+interface IVEHandler;
+
+
+/* ------------------------------------------------------------------------- *
+ * Library defintion
+ * ------------------------------------------------------------------------- */
+
+[
+ uuid(856CA1B0-7DAB-11d3-ACEC-00C04F86C309),
+ version(1.0),
+ helpstring("Common Language Runtime Verification Event Handler 1.0 Type Library")
+]
+library VEHandlerLib
+{
+ importlib("STDOLE2.TLB");
+
+ [
+ uuid(856CA1B1-7DAB-11d3-ACEC-00C04F86C309)
+ ]
+ coclass VEHandlerClass
+ {
+ [default] interface IVEHandler;
+ };
+
+};
+
+/* ------------------------------------------------------------------------- *
+ * IVEHandler interface
+ * ------------------------------------------------------------------------- */
+[
+ object,
+ uuid(856CA1B2-7DAB-11d3-ACEC-00C04F86C309),
+ pointer_default(unique)
+]
+interface IVEHandler : IUnknown
+{
+ HRESULT VEHandler(
+ [in] HRESULT VECode,
+ [in] VEContext Context,
+ [in] SAFEARRAY(VARIANT) psa);
+ HRESULT SetReporterFtn(
+ [in] __int64 lFnPtr);
+
+};
+
diff --git a/src/inc/jithelpers.h b/src/inc/jithelpers.h
new file mode 100644
index 0000000000..8a719927e5
--- /dev/null
+++ b/src/inc/jithelpers.h
@@ -0,0 +1,396 @@
+// 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.
+//
+// Allow multiple inclusion.
+
+//////////////////////////////////////////////////////////////////////////////////////////////////////////
+//
+// NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE
+//
+// The JIT/EE interface is versioned. By "interface", we mean mean any and all communication between the
+// JIT and the EE. Any time a change is made to the interface, the JIT/EE interface version identifier
+// must be updated. See code:JITEEVersionIdentifier for more information.
+//
+// THIS FILE IS PART OF THE JIT-EE INTERFACE.
+//
+// NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE NOTE
+//
+//////////////////////////////////////////////////////////////////////////////////////////////////////////
+
+
+#ifndef DYNAMICJITHELPER
+//I should never try to generate an alignment stub for a dynamic helper
+#define DYNAMICJITHELPER(code,fn,sig) JITHELPER(code,fn,sig)
+#endif
+
+
+// pfnHelper is set to NULL if it is a stubbed helper.
+// It will be set in InitJITHelpers2
+
+ JITHELPER(CORINFO_HELP_UNDEF, NULL, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB)
+
+ // Arithmetic
+ JITHELPER(CORINFO_HELP_DIV, JIT_Div, CORINFO_HELP_SIG_8_STACK)
+ JITHELPER(CORINFO_HELP_MOD, JIT_Mod, CORINFO_HELP_SIG_8_STACK)
+ JITHELPER(CORINFO_HELP_UDIV, JIT_UDiv, CORINFO_HELP_SIG_8_STACK)
+ JITHELPER(CORINFO_HELP_UMOD, JIT_UMod, CORINFO_HELP_SIG_8_STACK)
+
+ // CORINFO_HELP_DBL2INT, CORINFO_HELP_DBL2UINT, and CORINFO_HELP_DBL2LONG get
+ // patched for CPUs that support SSE2 (P4 and above).
+#if !defined(_WIN64)
+ JITHELPER(CORINFO_HELP_LLSH, JIT_LLsh, CORINFO_HELP_SIG_REG_ONLY)
+ JITHELPER(CORINFO_HELP_LRSH, JIT_LRsh, CORINFO_HELP_SIG_REG_ONLY)
+ JITHELPER(CORINFO_HELP_LRSZ, JIT_LRsz, CORINFO_HELP_SIG_REG_ONLY)
+#else
+ JITHELPER(CORINFO_HELP_LLSH, NULL, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB)
+ JITHELPER(CORINFO_HELP_LRSH, NULL, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB)
+ JITHELPER(CORINFO_HELP_LRSZ, NULL, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB)
+#endif
+ JITHELPER(CORINFO_HELP_LMUL, JIT_LMul, CORINFO_HELP_SIG_16_STACK)
+ JITHELPER(CORINFO_HELP_LMUL_OVF, JIT_LMulOvf, CORINFO_HELP_SIG_16_STACK)
+ JITHELPER(CORINFO_HELP_ULMUL_OVF, JIT_ULMulOvf, CORINFO_HELP_SIG_16_STACK)
+ JITHELPER(CORINFO_HELP_LDIV, JIT_LDiv, CORINFO_HELP_SIG_16_STACK)
+ JITHELPER(CORINFO_HELP_LMOD, JIT_LMod, CORINFO_HELP_SIG_16_STACK)
+ JITHELPER(CORINFO_HELP_ULDIV, JIT_ULDiv, CORINFO_HELP_SIG_16_STACK)
+ JITHELPER(CORINFO_HELP_ULMOD, JIT_ULMod, CORINFO_HELP_SIG_16_STACK)
+ JITHELPER(CORINFO_HELP_LNG2DBL, JIT_Lng2Dbl, CORINFO_HELP_SIG_8_STACK)
+ JITHELPER(CORINFO_HELP_ULNG2DBL, JIT_ULng2Dbl, CORINFO_HELP_SIG_8_STACK)
+ DYNAMICJITHELPER(CORINFO_HELP_DBL2INT, JIT_Dbl2Lng, CORINFO_HELP_SIG_8_STACK)
+ JITHELPER(CORINFO_HELP_DBL2INT_OVF, JIT_Dbl2IntOvf, CORINFO_HELP_SIG_8_STACK)
+ DYNAMICJITHELPER(CORINFO_HELP_DBL2LNG, JIT_Dbl2Lng, CORINFO_HELP_SIG_8_STACK)
+ JITHELPER(CORINFO_HELP_DBL2LNG_OVF, JIT_Dbl2LngOvf, CORINFO_HELP_SIG_8_STACK)
+ DYNAMICJITHELPER(CORINFO_HELP_DBL2UINT, JIT_Dbl2Lng, CORINFO_HELP_SIG_8_STACK)
+ JITHELPER(CORINFO_HELP_DBL2UINT_OVF, JIT_Dbl2UIntOvf, CORINFO_HELP_SIG_8_STACK)
+ JITHELPER(CORINFO_HELP_DBL2ULNG, JIT_Dbl2ULng, CORINFO_HELP_SIG_8_STACK)
+ JITHELPER(CORINFO_HELP_DBL2ULNG_OVF, JIT_Dbl2ULngOvf, CORINFO_HELP_SIG_8_STACK)
+ JITHELPER(CORINFO_HELP_FLTREM, JIT_FltRem, CORINFO_HELP_SIG_8_STACK)
+ JITHELPER(CORINFO_HELP_DBLREM, JIT_DblRem, CORINFO_HELP_SIG_16_STACK)
+ JITHELPER(CORINFO_HELP_FLTROUND, JIT_FloatRound, CORINFO_HELP_SIG_8_STACK)
+ JITHELPER(CORINFO_HELP_DBLROUND, JIT_DoubleRound, CORINFO_HELP_SIG_16_STACK)
+
+ // Allocating a new object
+#ifdef FEATURE_REMOTING
+ JITHELPER(CORINFO_HELP_NEW_CROSSCONTEXT, JIT_NewCrossContext, CORINFO_HELP_SIG_REG_ONLY)
+#else
+ JITHELPER(CORINFO_HELP_NEW_CROSSCONTEXT, NULL, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB)
+#endif
+ JITHELPER(CORINFO_HELP_NEWFAST, JIT_New, CORINFO_HELP_SIG_REG_ONLY)
+ DYNAMICJITHELPER(CORINFO_HELP_NEWSFAST, JIT_New, CORINFO_HELP_SIG_REG_ONLY)
+ DYNAMICJITHELPER(CORINFO_HELP_NEWSFAST_ALIGN8, JIT_New, CORINFO_HELP_SIG_REG_ONLY)
+ JITHELPER(CORINFO_HELP_NEW_MDARR, JIT_NewMDArr,CORINFO_HELP_SIG_8_VA)
+#if COR_JIT_EE_VERSION > 460
+ JITHELPER(CORINFO_HELP_NEW_MDARR_NONVARARG, JIT_NewMDArrNonVarArg,CORINFO_HELP_SIG_4_STACK)
+#endif
+ JITHELPER(CORINFO_HELP_NEWARR_1_DIRECT, JIT_NewArr1,CORINFO_HELP_SIG_REG_ONLY)
+ DYNAMICJITHELPER(CORINFO_HELP_NEWARR_1_OBJ, JIT_NewArr1,CORINFO_HELP_SIG_REG_ONLY)
+ DYNAMICJITHELPER(CORINFO_HELP_NEWARR_1_VC, JIT_NewArr1,CORINFO_HELP_SIG_REG_ONLY)
+ DYNAMICJITHELPER(CORINFO_HELP_NEWARR_1_ALIGN8, JIT_NewArr1,CORINFO_HELP_SIG_REG_ONLY)
+
+ JITHELPER(CORINFO_HELP_STRCNS, JIT_StrCns, CORINFO_HELP_SIG_REG_ONLY)
+ JITHELPER(CORINFO_HELP_STRCNS_CURRENT_MODULE, NULL, CORINFO_HELP_SIG_REG_ONLY)
+
+ // Object model
+ JITHELPER(CORINFO_HELP_INITCLASS, JIT_InitClass, CORINFO_HELP_SIG_REG_ONLY)
+ JITHELPER(CORINFO_HELP_INITINSTCLASS, JIT_InitInstantiatedClass, CORINFO_HELP_SIG_REG_ONLY)
+
+ JITHELPER(CORINFO_HELP_ISINSTANCEOFINTERFACE,JIT_IsInstanceOfInterface, CORINFO_HELP_SIG_REG_ONLY)
+ JITHELPER(CORINFO_HELP_ISINSTANCEOFARRAY, JIT_IsInstanceOfArray,CORINFO_HELP_SIG_REG_ONLY)
+ JITHELPER(CORINFO_HELP_ISINSTANCEOFCLASS, JIT_IsInstanceOfClass,CORINFO_HELP_SIG_REG_ONLY)
+ JITHELPER(CORINFO_HELP_ISINSTANCEOFANY, JIT_IsInstanceOfAny,CORINFO_HELP_SIG_REG_ONLY)
+
+ JITHELPER(CORINFO_HELP_CHKCASTINTERFACE, JIT_ChkCastInterface,CORINFO_HELP_SIG_REG_ONLY)
+ JITHELPER(CORINFO_HELP_CHKCASTARRAY, JIT_ChkCastArray, CORINFO_HELP_SIG_REG_ONLY)
+ JITHELPER(CORINFO_HELP_CHKCASTCLASS, JIT_ChkCastClass, CORINFO_HELP_SIG_REG_ONLY)
+ JITHELPER(CORINFO_HELP_CHKCASTANY, JIT_ChkCastAny, CORINFO_HELP_SIG_REG_ONLY)
+
+ JITHELPER(CORINFO_HELP_CHKCASTCLASS_SPECIAL,JIT_ChkCastClassSpecial,CORINFO_HELP_SIG_REG_ONLY)
+ DYNAMICJITHELPER(CORINFO_HELP_BOX, JIT_Box, CORINFO_HELP_SIG_REG_ONLY)
+ JITHELPER(CORINFO_HELP_BOX_NULLABLE, JIT_Box, CORINFO_HELP_SIG_REG_ONLY)
+ JITHELPER(CORINFO_HELP_UNBOX, JIT_Unbox, CORINFO_HELP_SIG_REG_ONLY)
+ JITHELPER(CORINFO_HELP_UNBOX_NULLABLE, JIT_Unbox_Nullable, CORINFO_HELP_SIG_4_STACK)
+ JITHELPER(CORINFO_HELP_GETREFANY, JIT_GetRefAny, CORINFO_HELP_SIG_8_STACK)
+#if defined(_TARGET_ARM_)
+ DYNAMICJITHELPER(CORINFO_HELP_ARRADDR_ST, JIT_Stelem_Ref, CORINFO_HELP_SIG_4_STACK)
+#else
+ JITHELPER(CORINFO_HELP_ARRADDR_ST, JIT_Stelem_Ref, CORINFO_HELP_SIG_4_STACK)
+#endif // _TARGET_ARM_
+ JITHELPER(CORINFO_HELP_LDELEMA_REF, JIT_Ldelema_Ref, CORINFO_HELP_SIG_4_STACK)
+
+ // Exceptions
+ JITHELPER(CORINFO_HELP_THROW, IL_Throw, CORINFO_HELP_SIG_REG_ONLY)
+ JITHELPER(CORINFO_HELP_RETHROW, IL_Rethrow, CORINFO_HELP_SIG_REG_ONLY)
+ JITHELPER(CORINFO_HELP_USER_BREAKPOINT, JIT_UserBreakpoint, CORINFO_HELP_SIG_REG_ONLY)
+ JITHELPER(CORINFO_HELP_RNGCHKFAIL, JIT_RngChkFail, CORINFO_HELP_SIG_REG_ONLY)
+ JITHELPER(CORINFO_HELP_OVERFLOW, JIT_Overflow, CORINFO_HELP_SIG_REG_ONLY)
+ JITHELPER(CORINFO_HELP_THROWDIVZERO, JIT_ThrowDivZero, CORINFO_HELP_SIG_REG_ONLY)
+#if COR_JIT_EE_VERSION > 460
+ JITHELPER(CORINFO_HELP_THROWNULLREF, JIT_ThrowNullRef, CORINFO_HELP_SIG_REG_ONLY)
+#endif // COR_JIT_EE_VERSION
+ JITHELPER(CORINFO_HELP_INTERNALTHROW, JIT_InternalThrow, CORINFO_HELP_SIG_REG_ONLY)
+ JITHELPER(CORINFO_HELP_VERIFICATION, IL_VerificationError,CORINFO_HELP_SIG_REG_ONLY)
+ JITHELPER(CORINFO_HELP_SEC_UNMGDCODE_EXCPT, JIT_SecurityUnmanagedCodeException, CORINFO_HELP_SIG_REG_ONLY)
+ JITHELPER(CORINFO_HELP_FAIL_FAST, JIT_FailFast, CORINFO_HELP_SIG_REG_ONLY)
+ JITHELPER(CORINFO_HELP_METHOD_ACCESS_EXCEPTION,JIT_ThrowMethodAccessException, CORINFO_HELP_SIG_REG_ONLY)
+ JITHELPER(CORINFO_HELP_FIELD_ACCESS_EXCEPTION,JIT_ThrowFieldAccessException, CORINFO_HELP_SIG_REG_ONLY)
+ JITHELPER(CORINFO_HELP_CLASS_ACCESS_EXCEPTION,JIT_ThrowClassAccessException, CORINFO_HELP_SIG_REG_ONLY)
+
+#ifdef WIN64EXCEPTIONS
+ JITHELPER(CORINFO_HELP_ENDCATCH, NULL, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB)
+#else
+ JITHELPER(CORINFO_HELP_ENDCATCH, JIT_EndCatch, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB)
+#endif
+
+#ifdef _TARGET_AMD64_
+ DYNAMICJITHELPER(CORINFO_HELP_MON_ENTER, JIT_MonEnterWorker, CORINFO_HELP_SIG_REG_ONLY)
+ DYNAMICJITHELPER(CORINFO_HELP_MON_EXIT, JIT_MonExitWorker, CORINFO_HELP_SIG_REG_ONLY)
+ DYNAMICJITHELPER(CORINFO_HELP_MON_ENTER_STATIC, JIT_MonEnterStatic,CORINFO_HELP_SIG_REG_ONLY)
+ DYNAMICJITHELPER(CORINFO_HELP_MON_EXIT_STATIC, JIT_MonExitStatic,CORINFO_HELP_SIG_REG_ONLY)
+#else
+ JITHELPER(CORINFO_HELP_MON_ENTER, JIT_MonEnterWorker, CORINFO_HELP_SIG_REG_ONLY)
+ JITHELPER(CORINFO_HELP_MON_EXIT, JIT_MonExitWorker, CORINFO_HELP_SIG_REG_ONLY)
+ JITHELPER(CORINFO_HELP_MON_ENTER_STATIC, JIT_MonEnterStatic,CORINFO_HELP_SIG_REG_ONLY)
+ JITHELPER(CORINFO_HELP_MON_EXIT_STATIC, JIT_MonExitStatic,CORINFO_HELP_SIG_REG_ONLY)
+#endif
+
+ JITHELPER(CORINFO_HELP_GETCLASSFROMMETHODPARAM, JIT_GetClassFromMethodParam, CORINFO_HELP_SIG_REG_ONLY)
+ JITHELPER(CORINFO_HELP_GETSYNCFROMCLASSHANDLE, JIT_GetSyncFromClassHandle, CORINFO_HELP_SIG_REG_ONLY)
+
+ // Security callout support
+ JITHELPER(CORINFO_HELP_SECURITY_PROLOG, JIT_Security_Prolog,CORINFO_HELP_SIG_REG_ONLY)
+ JITHELPER(CORINFO_HELP_SECURITY_PROLOG_FRAMED, JIT_Security_Prolog_Framed,CORINFO_HELP_SIG_REG_ONLY)
+
+ JITHELPER(CORINFO_HELP_METHOD_ACCESS_CHECK, JIT_MethodAccessCheck,CORINFO_HELP_SIG_8_STACK)
+ JITHELPER(CORINFO_HELP_FIELD_ACCESS_CHECK, JIT_FieldAccessCheck,CORINFO_HELP_SIG_4_STACK)
+ JITHELPER(CORINFO_HELP_CLASS_ACCESS_CHECK, JIT_ClassAccessCheck,CORINFO_HELP_SIG_4_STACK)
+
+ JITHELPER(CORINFO_HELP_DELEGATE_SECURITY_CHECK, JIT_DelegateSecurityCheck,CORINFO_HELP_SIG_REG_ONLY)
+
+ // Verification runtime callout support
+ JITHELPER(CORINFO_HELP_VERIFICATION_RUNTIME_CHECK, JIT_VerificationRuntimeCheck,CORINFO_HELP_SIG_REG_ONLY)
+
+ // GC support
+ DYNAMICJITHELPER(CORINFO_HELP_STOP_FOR_GC, JIT_RareDisableHelper,CORINFO_HELP_SIG_REG_ONLY)
+#ifdef ENABLE_FAST_GCPOLL_HELPER
+ DYNAMICJITHELPER(CORINFO_HELP_POLL_GC, JIT_PollGC, CORINFO_HELP_SIG_REG_ONLY)
+#else
+ JITHELPER(CORINFO_HELP_POLL_GC, JIT_PollGC, CORINFO_HELP_SIG_REG_ONLY)
+#endif
+ JITHELPER(CORINFO_HELP_STRESS_GC, JIT_StressGC, CORINFO_HELP_SIG_REG_ONLY)
+
+ JITHELPER(CORINFO_HELP_CHECK_OBJ, JIT_CheckObj, CORINFO_HELP_SIG_REG_ONLY)
+
+ // GC Write barrier support
+ DYNAMICJITHELPER(CORINFO_HELP_ASSIGN_REF, JIT_WriteBarrier, CORINFO_HELP_SIG_NO_ALIGN_STUB)
+ DYNAMICJITHELPER(CORINFO_HELP_CHECKED_ASSIGN_REF, JIT_CheckedWriteBarrier,CORINFO_HELP_SIG_NO_ALIGN_STUB)
+ JITHELPER(CORINFO_HELP_ASSIGN_REF_ENSURE_NONHEAP, JIT_WriteBarrierEnsureNonHeapTarget,CORINFO_HELP_SIG_REG_ONLY)
+
+ DYNAMICJITHELPER(CORINFO_HELP_ASSIGN_BYREF, JIT_ByRefWriteBarrier,CORINFO_HELP_SIG_NO_ALIGN_STUB)
+
+ JITHELPER(CORINFO_HELP_ASSIGN_STRUCT, JIT_StructWriteBarrier,CORINFO_HELP_SIG_4_STACK)
+
+ // Accessing fields
+ JITHELPER(CORINFO_HELP_GETFIELD8, JIT_GetField8,CORINFO_HELP_SIG_REG_ONLY)
+ JITHELPER(CORINFO_HELP_SETFIELD8, JIT_SetField8,CORINFO_HELP_SIG_4_STACK)
+ JITHELPER(CORINFO_HELP_GETFIELD16, JIT_GetField16,CORINFO_HELP_SIG_REG_ONLY)
+ JITHELPER(CORINFO_HELP_SETFIELD16, JIT_SetField16,CORINFO_HELP_SIG_4_STACK)
+ JITHELPER(CORINFO_HELP_GETFIELD32, JIT_GetField32,CORINFO_HELP_SIG_REG_ONLY)
+ JITHELPER(CORINFO_HELP_SETFIELD32, JIT_SetField32,CORINFO_HELP_SIG_4_STACK)
+ JITHELPER(CORINFO_HELP_GETFIELD64, JIT_GetField64,CORINFO_HELP_SIG_REG_ONLY)
+ JITHELPER(CORINFO_HELP_SETFIELD64, JIT_SetField64,CORINFO_HELP_SIG_8_STACK)
+ JITHELPER(CORINFO_HELP_GETFIELDOBJ, JIT_GetFieldObj,CORINFO_HELP_SIG_REG_ONLY)
+ JITHELPER(CORINFO_HELP_SETFIELDOBJ, JIT_SetFieldObj,CORINFO_HELP_SIG_4_STACK)
+ JITHELPER(CORINFO_HELP_GETFIELDSTRUCT, JIT_GetFieldStruct,CORINFO_HELP_SIG_8_STACK)
+ JITHELPER(CORINFO_HELP_SETFIELDSTRUCT, JIT_SetFieldStruct,CORINFO_HELP_SIG_8_STACK)
+ JITHELPER(CORINFO_HELP_GETFIELDFLOAT, JIT_GetFieldFloat,CORINFO_HELP_SIG_REG_ONLY)
+ JITHELPER(CORINFO_HELP_SETFIELDFLOAT, JIT_SetFieldFloat,CORINFO_HELP_SIG_4_STACK)
+ JITHELPER(CORINFO_HELP_GETFIELDDOUBLE, JIT_GetFieldDouble,CORINFO_HELP_SIG_REG_ONLY)
+ JITHELPER(CORINFO_HELP_SETFIELDDOUBLE, JIT_SetFieldDouble,CORINFO_HELP_SIG_8_STACK)
+
+ JITHELPER(CORINFO_HELP_GETFIELDADDR, JIT_GetFieldAddr,CORINFO_HELP_SIG_REG_ONLY)
+
+#ifdef FEATURE_REMOTING
+ JITHELPER(CORINFO_HELP_GETSTATICFIELDADDR_CONTEXT, JIT_GetStaticFieldAddr_Context,CORINFO_HELP_SIG_REG_ONLY)
+#else
+ JITHELPER(CORINFO_HELP_GETSTATICFIELDADDR_CONTEXT, NULL, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB)
+#endif
+
+#if COR_JIT_EE_VERSION > 460
+#ifdef FEATURE_MIXEDMODE
+ // TLS
+ JITHELPER(CORINFO_HELP_GETSTATICFIELDADDR_TLS, JIT_GetStaticFieldAddr_Tls,CORINFO_HELP_SIG_REG_ONLY)
+#else // FEATURE_MIXEDMODE
+ JITHELPER(CORINFO_HELP_GETSTATICFIELDADDR_TLS, NULL, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB)
+#endif // FEATURE_MIXEDMODE
+#else // COR_JIT_EE_VERSION
+ JITHELPER(CORINFO_HELP_GETSTATICFIELDADDR_TLS, JIT_GetStaticFieldAddr_Tls,CORINFO_HELP_SIG_REG_ONLY)
+#endif // COR_JIT_EE_VERSION
+
+ JITHELPER(CORINFO_HELP_GETGENERICS_GCSTATIC_BASE, JIT_GetGenericsGCStaticBase,CORINFO_HELP_SIG_REG_ONLY)
+ JITHELPER(CORINFO_HELP_GETGENERICS_NONGCSTATIC_BASE, JIT_GetGenericsNonGCStaticBase,CORINFO_HELP_SIG_REG_ONLY)
+
+#ifdef _TARGET_X86_
+ DYNAMICJITHELPER(CORINFO_HELP_GETSHARED_GCSTATIC_BASE, NULL, CORINFO_HELP_SIG_REG_ONLY)
+ DYNAMICJITHELPER(CORINFO_HELP_GETSHARED_NONGCSTATIC_BASE, NULL, CORINFO_HELP_SIG_REG_ONLY)
+ DYNAMICJITHELPER(CORINFO_HELP_GETSHARED_GCSTATIC_BASE_NOCTOR, NULL, CORINFO_HELP_SIG_REG_ONLY)
+ DYNAMICJITHELPER(CORINFO_HELP_GETSHARED_NONGCSTATIC_BASE_NOCTOR,NULL, CORINFO_HELP_SIG_REG_ONLY)
+#else
+ DYNAMICJITHELPER(CORINFO_HELP_GETSHARED_GCSTATIC_BASE, JIT_GetSharedGCStaticBase, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB)
+ DYNAMICJITHELPER(CORINFO_HELP_GETSHARED_NONGCSTATIC_BASE, JIT_GetSharedNonGCStaticBase, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB)
+ DYNAMICJITHELPER(CORINFO_HELP_GETSHARED_GCSTATIC_BASE_NOCTOR, JIT_GetSharedGCStaticBaseNoCtor, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB)
+ DYNAMICJITHELPER(CORINFO_HELP_GETSHARED_NONGCSTATIC_BASE_NOCTOR,JIT_GetSharedNonGCStaticBaseNoCtor, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB)
+#endif
+ JITHELPER(CORINFO_HELP_GETSHARED_GCSTATIC_BASE_DYNAMICCLASS, JIT_GetSharedGCStaticBaseDynamicClass,CORINFO_HELP_SIG_REG_ONLY)
+ JITHELPER(CORINFO_HELP_GETSHARED_NONGCSTATIC_BASE_DYNAMICCLASS, JIT_GetSharedNonGCStaticBaseDynamicClass,CORINFO_HELP_SIG_REG_ONLY)
+ JITHELPER(CORINFO_HELP_CLASSINIT_SHARED_DYNAMICCLASS, JIT_ClassInitDynamicClass,CORINFO_HELP_SIG_REG_ONLY)
+
+ // Thread statics
+ JITHELPER(CORINFO_HELP_GETGENERICS_GCTHREADSTATIC_BASE, JIT_GetGenericsGCThreadStaticBase,CORINFO_HELP_SIG_REG_ONLY)
+ JITHELPER(CORINFO_HELP_GETGENERICS_NONGCTHREADSTATIC_BASE, JIT_GetGenericsNonGCThreadStaticBase,CORINFO_HELP_SIG_REG_ONLY)
+ JITHELPER(CORINFO_HELP_GETSHARED_GCTHREADSTATIC_BASE, JIT_GetSharedGCThreadStaticBase, CORINFO_HELP_SIG_REG_ONLY)
+ JITHELPER(CORINFO_HELP_GETSHARED_NONGCTHREADSTATIC_BASE, JIT_GetSharedNonGCThreadStaticBase, CORINFO_HELP_SIG_REG_ONLY)
+ JITHELPER(CORINFO_HELP_GETSHARED_GCTHREADSTATIC_BASE_NOCTOR, JIT_GetSharedGCThreadStaticBase, CORINFO_HELP_SIG_REG_ONLY)
+ JITHELPER(CORINFO_HELP_GETSHARED_NONGCTHREADSTATIC_BASE_NOCTOR, JIT_GetSharedNonGCThreadStaticBase, CORINFO_HELP_SIG_REG_ONLY)
+ JITHELPER(CORINFO_HELP_GETSHARED_GCTHREADSTATIC_BASE_DYNAMICCLASS, JIT_GetSharedGCThreadStaticBaseDynamicClass, CORINFO_HELP_SIG_REG_ONLY)
+ JITHELPER(CORINFO_HELP_GETSHARED_NONGCTHREADSTATIC_BASE_DYNAMICCLASS, JIT_GetSharedNonGCThreadStaticBaseDynamicClass, CORINFO_HELP_SIG_REG_ONLY)
+
+ // Debugger
+ JITHELPER(CORINFO_HELP_DBG_IS_JUST_MY_CODE, JIT_DbgIsJustMyCode,CORINFO_HELP_SIG_REG_ONLY)
+
+ /* Profiling enter/leave probe addresses */
+ DYNAMICJITHELPER(CORINFO_HELP_PROF_FCN_ENTER, JIT_ProfilerEnterLeaveTailcallStub, CORINFO_HELP_SIG_4_STACK)
+ DYNAMICJITHELPER(CORINFO_HELP_PROF_FCN_LEAVE, JIT_ProfilerEnterLeaveTailcallStub, CORINFO_HELP_SIG_4_STACK)
+ DYNAMICJITHELPER(CORINFO_HELP_PROF_FCN_TAILCALL, JIT_ProfilerEnterLeaveTailcallStub, CORINFO_HELP_SIG_4_STACK)
+
+ // Miscellaneous
+ JITHELPER(CORINFO_HELP_BBT_FCN_ENTER, JIT_LogMethodEnter,CORINFO_HELP_SIG_REG_ONLY)
+
+ JITHELPER(CORINFO_HELP_PINVOKE_CALLI, GenericPInvokeCalliHelper, CORINFO_HELP_SIG_NO_ALIGN_STUB)
+
+ JITHELPER(CORINFO_HELP_TAILCALL, JIT_TailCall, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB)
+
+ JITHELPER(CORINFO_HELP_GETCURRENTMANAGEDTHREADID, JIT_GetCurrentManagedThreadId, CORINFO_HELP_SIG_REG_ONLY)
+
+#ifdef _WIN64
+ // On Windows X64, the last argument is ignored.
+ JITHELPER(CORINFO_HELP_INIT_PINVOKE_FRAME, JIT_InitPInvokeFrame, CORINFO_HELP_SIG_REG_ONLY)
+#else
+ DYNAMICJITHELPER(CORINFO_HELP_INIT_PINVOKE_FRAME, NULL, CORINFO_HELP_SIG_REG_ONLY)
+#endif
+
+#ifdef _TARGET_X86_
+ JITHELPER(CORINFO_HELP_MEMSET, NULL, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB)
+ JITHELPER(CORINFO_HELP_MEMCPY, NULL, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB)
+#else
+ JITHELPER(CORINFO_HELP_MEMSET, JIT_MemSet, CORINFO_HELP_SIG_REG_ONLY)
+ JITHELPER(CORINFO_HELP_MEMCPY, JIT_MemCpy, CORINFO_HELP_SIG_REG_ONLY)
+#endif
+
+ // Generics
+ JITHELPER(CORINFO_HELP_RUNTIMEHANDLE_METHOD, JIT_GenericHandleMethod, CORINFO_HELP_SIG_REG_ONLY)
+ JITHELPER(CORINFO_HELP_RUNTIMEHANDLE_METHOD_LOG,JIT_GenericHandleMethodLogging, CORINFO_HELP_SIG_REG_ONLY)
+ JITHELPER(CORINFO_HELP_RUNTIMEHANDLE_CLASS, JIT_GenericHandleClass, CORINFO_HELP_SIG_REG_ONLY)
+ JITHELPER(CORINFO_HELP_RUNTIMEHANDLE_CLASS_LOG, JIT_GenericHandleClassLogging, CORINFO_HELP_SIG_REG_ONLY)
+ JITHELPER(CORINFO_HELP_TYPEHANDLE_TO_RUNTIMETYPEHANDLE_OBSOLETE, NULL, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB)
+ JITHELPER(CORINFO_HELP_METHODDESC_TO_RUNTIMEMETHODHANDLE_OBSOLETE, NULL, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB)
+ JITHELPER(CORINFO_HELP_FIELDDESC_TO_RUNTIMEFIELDHANDLE_OBSOLETE, NULL, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB)
+ JITHELPER(CORINFO_HELP_TYPEHANDLE_TO_RUNTIMETYPE, JIT_GetRuntimeType, CORINFO_HELP_SIG_REG_ONLY)
+ JITHELPER(CORINFO_HELP_TYPEHANDLE_TO_RUNTIMETYPE_MAYBENULL, JIT_GetRuntimeType_MaybeNull, CORINFO_HELP_SIG_REG_ONLY)
+ JITHELPER(CORINFO_HELP_METHODDESC_TO_STUBRUNTIMEMETHOD, JIT_GetRuntimeMethodStub,CORINFO_HELP_SIG_REG_ONLY)
+ JITHELPER(CORINFO_HELP_FIELDDESC_TO_STUBRUNTIMEFIELD, JIT_GetRuntimeFieldStub, CORINFO_HELP_SIG_REG_ONLY)
+
+ JITHELPER(CORINFO_HELP_VIRTUAL_FUNC_PTR, JIT_VirtualFunctionPointer, CORINFO_HELP_SIG_4_STACK)
+ //JITHELPER(CORINFO_HELP_VIRTUAL_FUNC_PTR_LOG,JIT_VirtualFunctionPointerLogging)
+
+ JITHELPER(CORINFO_HELP_READYTORUN_NEW, NULL, CORINFO_HELP_SIG_NO_ALIGN_STUB)
+ JITHELPER(CORINFO_HELP_READYTORUN_NEWARR_1, NULL, CORINFO_HELP_SIG_NO_ALIGN_STUB)
+ JITHELPER(CORINFO_HELP_READYTORUN_ISINSTANCEOF, NULL, CORINFO_HELP_SIG_NO_ALIGN_STUB)
+ JITHELPER(CORINFO_HELP_READYTORUN_CHKCAST, NULL, CORINFO_HELP_SIG_NO_ALIGN_STUB)
+ JITHELPER(CORINFO_HELP_READYTORUN_STATIC_BASE, NULL, CORINFO_HELP_SIG_NO_ALIGN_STUB)
+ JITHELPER(CORINFO_HELP_READYTORUN_VIRTUAL_FUNC_PTR, NULL, CORINFO_HELP_SIG_NO_ALIGN_STUB)
+#if COR_JIT_EE_VERSION > 460
+ JITHELPER(CORINFO_HELP_READYTORUN_GENERIC_HANDLE, NULL, CORINFO_HELP_SIG_NO_ALIGN_STUB)
+ JITHELPER(CORINFO_HELP_READYTORUN_DELEGATE_CTOR, NULL, CORINFO_HELP_SIG_NO_ALIGN_STUB)
+#endif // COR_JIT_EE_VERSION
+
+ JITHELPER(CORINFO_HELP_EE_PRESTUB, ThePreStub, CORINFO_HELP_SIG_NO_ALIGN_STUB)
+
+#if defined(HAS_FIXUP_PRECODE)
+ JITHELPER(CORINFO_HELP_EE_PRECODE_FIXUP, PrecodeFixupThunk, CORINFO_HELP_SIG_NO_ALIGN_STUB)
+#else
+ JITHELPER(CORINFO_HELP_EE_PRECODE_FIXUP, NULL, CORINFO_HELP_SIG_NO_ALIGN_STUB)
+#endif
+
+ JITHELPER(CORINFO_HELP_EE_PINVOKE_FIXUP, NDirectImportThunk, CORINFO_HELP_SIG_NO_ALIGN_STUB)
+
+ JITHELPER(CORINFO_HELP_EE_VSD_FIXUP, StubDispatchFixupStub, CORINFO_HELP_SIG_NO_ALIGN_STUB)
+ JITHELPER(CORINFO_HELP_EE_EXTERNAL_FIXUP, ExternalMethodFixupStub, CORINFO_HELP_SIG_NO_ALIGN_STUB)
+ JITHELPER(CORINFO_HELP_EE_VTABLE_FIXUP, VirtualMethodFixupStub, CORINFO_HELP_SIG_NO_ALIGN_STUB)
+
+#if (defined(_TARGET_X86_) || defined(_TARGET_ARM_)) && defined(FEATURE_REMOTING)
+ JITHELPER(CORINFO_HELP_EE_REMOTING_THUNK, PrecodeRemotingThunk, CORINFO_HELP_SIG_UNDEF)
+#else
+ JITHELPER(CORINFO_HELP_EE_REMOTING_THUNK, NULL, CORINFO_HELP_SIG_UNDEF)
+#endif
+
+// We do not need this to be saved in ngen images on Mac64 since the exception dispatch
+// is not done via the OS and thus, there wont be any need to know this information
+// by anyone.
+#if !defined(_TARGET_X86_)
+ JITHELPER(CORINFO_HELP_EE_PERSONALITY_ROUTINE, ProcessCLRException, CORINFO_HELP_SIG_UNDEF)
+ JITHELPER(CORINFO_HELP_EE_PERSONALITY_ROUTINE_FILTER_FUNCLET, ProcessCLRException,CORINFO_HELP_SIG_UNDEF)
+#else
+ JITHELPER(CORINFO_HELP_EE_PERSONALITY_ROUTINE, NULL, CORINFO_HELP_SIG_UNDEF)
+ JITHELPER(CORINFO_HELP_EE_PERSONALITY_ROUTINE_FILTER_FUNCLET, NULL, CORINFO_HELP_SIG_UNDEF)
+#endif
+
+#ifdef _TARGET_X86_
+ JITHELPER(CORINFO_HELP_ASSIGN_REF_EAX, JIT_WriteBarrierEAX, CORINFO_HELP_SIG_NO_ALIGN_STUB)
+ JITHELPER(CORINFO_HELP_ASSIGN_REF_EBX, JIT_WriteBarrierEBX, CORINFO_HELP_SIG_NO_ALIGN_STUB)
+ JITHELPER(CORINFO_HELP_ASSIGN_REF_ECX, JIT_WriteBarrierECX, CORINFO_HELP_SIG_NO_ALIGN_STUB)
+ JITHELPER(CORINFO_HELP_ASSIGN_REF_ESI, JIT_WriteBarrierESI, CORINFO_HELP_SIG_NO_ALIGN_STUB)
+ JITHELPER(CORINFO_HELP_ASSIGN_REF_EDI, JIT_WriteBarrierEDI, CORINFO_HELP_SIG_NO_ALIGN_STUB)
+ JITHELPER(CORINFO_HELP_ASSIGN_REF_EBP, JIT_WriteBarrierEBP, CORINFO_HELP_SIG_NO_ALIGN_STUB)
+
+ JITHELPER(CORINFO_HELP_CHECKED_ASSIGN_REF_EAX, JIT_CheckedWriteBarrierEAX, CORINFO_HELP_SIG_NO_ALIGN_STUB)
+ JITHELPER(CORINFO_HELP_CHECKED_ASSIGN_REF_EBX, JIT_CheckedWriteBarrierEBX, CORINFO_HELP_SIG_NO_ALIGN_STUB)
+ JITHELPER(CORINFO_HELP_CHECKED_ASSIGN_REF_ECX, JIT_CheckedWriteBarrierECX, CORINFO_HELP_SIG_NO_ALIGN_STUB)
+ JITHELPER(CORINFO_HELP_CHECKED_ASSIGN_REF_ESI, JIT_CheckedWriteBarrierESI, CORINFO_HELP_SIG_NO_ALIGN_STUB)
+ JITHELPER(CORINFO_HELP_CHECKED_ASSIGN_REF_EDI, JIT_CheckedWriteBarrierEDI, CORINFO_HELP_SIG_NO_ALIGN_STUB)
+ JITHELPER(CORINFO_HELP_CHECKED_ASSIGN_REF_EBP, JIT_CheckedWriteBarrierEBP, CORINFO_HELP_SIG_NO_ALIGN_STUB)
+#else
+ JITHELPER(CORINFO_HELP_ASSIGN_REF_EAX, NULL, CORINFO_HELP_SIG_UNDEF)
+ JITHELPER(CORINFO_HELP_ASSIGN_REF_EBX, NULL, CORINFO_HELP_SIG_UNDEF)
+ JITHELPER(CORINFO_HELP_ASSIGN_REF_ECX, NULL, CORINFO_HELP_SIG_UNDEF)
+ JITHELPER(CORINFO_HELP_ASSIGN_REF_ESI, NULL, CORINFO_HELP_SIG_UNDEF)
+ JITHELPER(CORINFO_HELP_ASSIGN_REF_EDI, NULL, CORINFO_HELP_SIG_UNDEF)
+ JITHELPER(CORINFO_HELP_ASSIGN_REF_EBP, NULL, CORINFO_HELP_SIG_UNDEF)
+
+ JITHELPER(CORINFO_HELP_CHECKED_ASSIGN_REF_EAX, NULL, CORINFO_HELP_SIG_UNDEF)
+ JITHELPER(CORINFO_HELP_CHECKED_ASSIGN_REF_EBX, NULL, CORINFO_HELP_SIG_UNDEF)
+ JITHELPER(CORINFO_HELP_CHECKED_ASSIGN_REF_ECX, NULL, CORINFO_HELP_SIG_UNDEF)
+ JITHELPER(CORINFO_HELP_CHECKED_ASSIGN_REF_ESI, NULL, CORINFO_HELP_SIG_UNDEF)
+ JITHELPER(CORINFO_HELP_CHECKED_ASSIGN_REF_EDI, NULL, CORINFO_HELP_SIG_UNDEF)
+ JITHELPER(CORINFO_HELP_CHECKED_ASSIGN_REF_EBP, NULL, CORINFO_HELP_SIG_UNDEF)
+#endif
+
+ JITHELPER(CORINFO_HELP_LOOP_CLONE_CHOICE_ADDR, JIT_LoopCloneChoiceAddr, CORINFO_HELP_SIG_REG_ONLY)
+ JITHELPER(CORINFO_HELP_DEBUG_LOG_LOOP_CLONING, JIT_DebugLogLoopCloning, CORINFO_HELP_SIG_REG_ONLY)
+
+#if COR_JIT_EE_VERSION > 460
+
+ JITHELPER(CORINFO_HELP_THROW_ARGUMENTEXCEPTION, JIT_ThrowArgumentException, CORINFO_HELP_SIG_REG_ONLY)
+ JITHELPER(CORINFO_HELP_THROW_ARGUMENTOUTOFRANGEEXCEPTION, JIT_ThrowArgumentOutOfRangeException, CORINFO_HELP_SIG_REG_ONLY)
+
+ JITHELPER(CORINFO_HELP_JIT_PINVOKE_BEGIN, NULL, CORINFO_HELP_SIG_UNDEF)
+ JITHELPER(CORINFO_HELP_JIT_PINVOKE_END, NULL, CORINFO_HELP_SIG_UNDEF)
+
+ JITHELPER(CORINFO_HELP_JIT_REVERSE_PINVOKE_ENTER, NULL, CORINFO_HELP_SIG_UNDEF)
+ JITHELPER(CORINFO_HELP_JIT_REVERSE_PINVOKE_EXIT, NULL, CORINFO_HELP_SIG_UNDEF)
+
+#endif // COR_JIT_EE_VERSION
+
+#undef JITHELPER
+#undef DYNAMICJITHELPER
+#undef JITHELPER
+#undef DYNAMICJITHELPER
diff --git a/src/inc/jithost.h b/src/inc/jithost.h
new file mode 100644
index 0000000000..73ad3343b5
--- /dev/null
+++ b/src/inc/jithost.h
@@ -0,0 +1,28 @@
+// 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.
+
+#ifndef __JITHOST_H__
+#define __JITHOST_H__
+
+// Common implementation of ICorJitHost that respects CLR host policies.
+class JitHost : public ICorJitHost
+{
+private:
+ static JitHost theJitHost;
+
+ JitHost() {}
+ JitHost(const JitHost& other) = delete;
+ JitHost& operator=(const JitHost& other) = delete;
+
+public:
+ virtual void* allocateMemory(size_t size, bool usePageAllocator);
+ virtual void freeMemory(void* block, bool usePageAllocator);
+ virtual int getIntConfigValue(const wchar_t* name, int defaultValue);
+ virtual const wchar_t* getStringConfigValue(const wchar_t* name);
+ virtual void freeStringConfigValue(const wchar_t* value);
+
+ static ICorJitHost* getJitHost();
+};
+
+#endif // __JITHOST_H__
diff --git a/src/inc/jitperf.h b/src/inc/jitperf.h
new file mode 100644
index 0000000000..022cfd2169
--- /dev/null
+++ b/src/inc/jitperf.h
@@ -0,0 +1,97 @@
+// 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.
+//-----------------------------------------------------------------------------
+// JitPerf.h
+// Internal interface for gathering JIT perfmormance stats. These stats are
+// logged (or displayed) in two ways. If PERF_COUNTERS are enabled the
+// perfmon etc. would display the jit stats. If ENABLE_PERF_LOG is enabled
+// and PERF_OUTPUT env var is defined then the jit stats are displayed on the
+// stdout. (The jit stats are outputted in a specific format to a file for
+// automated perf tests.)
+//
+
+//-----------------------------------------------------------------------------
+
+
+#ifndef __JITPERF_H__
+#define __JITPERF_H__
+
+#include "mscoree.h"
+#include "clrinternal.h"
+
+// ENABLE_JIT_PERF tag used to activate JIT specific profiling.
+#define ENABLE_JIT_PERF
+
+#if defined(ENABLE_JIT_PERF)
+
+extern __int64 g_JitCycles;
+extern size_t g_NonJitCycles;
+extern CRITSEC_COOKIE g_csJit;
+extern __int64 g_tlsJitCycles;
+extern int g_fJitPerfOn;
+
+extern size_t g_dwTlsx86CodeSize;
+extern size_t g_TotalILCodeSize;
+extern size_t g_Totalx86CodeSize;
+extern size_t g_TotalMethodsJitted;
+
+// Public interface to initialize jit stats data structs
+void InitJitPerf(void);
+// Public interface to deallocate datastruct and output the stats.
+void DoneJitPerfStats(void);
+
+// Start/StopNonJITPerf macros are used many times. Factor out the payload
+// into helper method to reduce code size.
+void StartNonJITPerfWorker(LARGE_INTEGER * pCycleStart);
+void StopNonJITPerfWorker(LARGE_INTEGER * pCycleStart);
+
+// Use the callee's stack frame (so START & STOP functions can share variables)
+#define START_JIT_PERF() \
+ if (g_fJitPerfOn) { \
+ ClrFlsSetValue (TlsIdx_JitPerf, (LPVOID)0); \
+ g_dwTlsx86CodeSize = 0; \
+ ClrFlsSetValue (TlsIdx_JitX86Perf, (LPVOID)g_dwTlsx86CodeSize); \
+ }
+
+
+#define STOP_JIT_PERF() \
+ if (g_fJitPerfOn) { \
+ size_t dwTlsNonJitCycles = (size_t)ClrFlsGetValue (TlsIdx_JitPerf); \
+ size_t dwx86CodeSize = (size_t)ClrFlsGetValue (TlsIdx_JitX86Perf); \
+ CRITSEC_Holder csh (g_csJit); \
+ g_JitCycles += static_cast<size_t>(CycleStop.QuadPart - CycleStart.QuadPart); \
+ g_NonJitCycles += dwTlsNonJitCycles; \
+ g_TotalILCodeSize += methodInfo.ILCodeSize; \
+ g_Totalx86CodeSize += dwx86CodeSize; \
+ g_TotalMethodsJitted ++; \
+ }
+
+#define START_NON_JIT_PERF() \
+ LARGE_INTEGER CycleStart; \
+ if(g_fJitPerfOn) { \
+ StartNonJITPerfWorker(&CycleStart); \
+ }
+
+#define STOP_NON_JIT_PERF() \
+ if(g_fJitPerfOn) { \
+ StopNonJITPerfWorker(&CycleStart); \
+ }
+
+#define JIT_PERF_UPDATE_X86_CODE_SIZE(size) \
+ if(g_fJitPerfOn) { \
+ size_t dwx86CodeSize = (size_t)ClrFlsGetValue (TlsIdx_JitX86Perf); \
+ dwx86CodeSize += (size); \
+ ClrFlsSetValue (TlsIdx_JitX86Perf, (LPVOID)dwx86CodeSize); \
+ }
+
+
+#else //ENABLE_JIT_PERF
+#define START_JIT_PERF()
+#define STOP_JIT_PERF()
+#define START_NON_JIT_PERF()
+#define STOP_NON_JIT_PERF()
+#define JIT_PERF_UPDATE_X86_CODE_SIZE(size)
+#endif //ENABLE_JIT_PERF
+
+#endif //__JITPERF_H__
diff --git a/src/inc/lazycow.h b/src/inc/lazycow.h
new file mode 100644
index 0000000000..c4605b6e0d
--- /dev/null
+++ b/src/inc/lazycow.h
@@ -0,0 +1,99 @@
+// 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.
+// --------------------------------------------------------------------------------
+// LazyCOW.h
+//
+
+//
+// Provides support for "lazy copy-on-write" pages.
+//
+// NGEN images contain a large amount of writable data. At runtime, we typically only actually write to a small portion of this data.
+// When we write to a writable page in an image, the OS must create a process-local copy of that page, so that other proceses
+// cannot see the written data. To prevent this copy from failing, the OS pre-commits space in the pagefile for all writable
+// pages when the image is loaded. Thus we get charged for every writable page, even if we only write to a few of them.
+//
+// FEATURE_LAZY_COW_PAGES enables "lazy copy-on-write." We mark the pages in the image file as read-only, and thus the OS
+// does not pre-commit pagefile for these pages. At runtime, prior to writing to any page, we update it to be writable.
+// This may fail, and thus is not appropriate for scenarios where strong reliability guarantees must be met. But for
+// devices with small memory this is still worth it.
+//
+// --------------------------------------------------------------------------------
+
+#ifndef LAZY_COW_H
+#define LAZY_COW_H
+
+#ifdef FEATURE_LAZY_COW_PAGES
+
+#ifdef _WIN64 // due to the way we track pages, we cannot currently support 64-bit.
+#error FEATURE_LAZY_COW_PAGES is only supported on 32-bit platforms.
+#endif
+
+class PEDecoder;
+
+// If hModule is a native image, establishes copy-on-write tracking for the image.
+// FreeLazyCOWPages must be called immediately before the module is unloaded.
+void AllocateLazyCOWPages(PEDecoder * pImage);
+
+// If hModule is a native image, disestablishes copy-on-write tracking for the image.
+// The image must be immediately unloaded following this call.
+void FreeLazyCOWPages(PEDecoder * pImage);
+
+bool IsInReadOnlyLazyCOWPage(void* p);
+
+
+// Forces the page(s) covered by the given address range to be made writable,
+// if they are being tracked as copy-on-write pages. Otherwise does nothing.
+// Returns false if we could not allocate the necessary memory.
+bool EnsureWritablePagesNoThrow(void* p, size_t len);
+
+// Version for executable pages
+bool EnsureWritableExecutablePagesNoThrow(void* p, size_t len);
+
+// Throwing version of EnsureWritablePagesNoThrow
+void EnsureWritablePages(void* p, size_t len);
+
+// Version for executable pages
+void EnsureWritableExecutablePages(void* p, size_t len);
+
+#else //FEATURE_LAZY_COW_PAGES
+
+inline bool EnsureWritablePagesNoThrow(void* p, size_t len)
+{
+ return true;
+}
+
+inline bool EnsureWritableExecutablePagesNoThrow(void* p, size_t len)
+{
+ return true;
+}
+
+inline void EnsureWritablePages(void* p, size_t len)
+{
+}
+
+inline void EnsureWritableExecutablePages(void* p, size_t len)
+{
+}
+
+#endif //FEATURE_LAZY_COW_PAGES
+
+// Typed version of EnsureWritable. Returns p, so this can be inserted in expressions.
+// Ignores any failure to allocate. In typical cases this means that the write will AV.
+// In the CLR that's OK; we handle the AV, try EnsureWritable(void*,size_t), and
+// fail-fast when it fails.
+template<typename T>
+inline T* EnsureWritablePages(T* p)
+{
+ EnsureWritablePages(p, sizeof(T));
+ return p;
+}
+
+template<typename T>
+inline T* EnsureWritableExecutablePages(T* p)
+{
+ EnsureWritableExecutablePages(p, sizeof(T));
+ return p;
+}
+
+#endif // LAZY_COW_H
diff --git a/src/inc/legacyactivationshim.h b/src/inc/legacyactivationshim.h
new file mode 100644
index 0000000000..4d8eaa5dd9
--- /dev/null
+++ b/src/inc/legacyactivationshim.h
@@ -0,0 +1,1382 @@
+// 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.
+//
+// LegacyActivationShim.h
+//
+// This file allows simple migration from .NET Runtime v2 Host Activation APIs
+// to the .NET Runtime v4 Host Activation APIs through simple shim functions.
+
+#ifndef __LEGACYACTIVATIONSHIM_H__
+#define __LEGACYACTIVATIONSHIM_H__
+
+#pragma warning(push)
+#pragma warning(disable:4127) // warning C4127: conditional expression is constant
+ // caused by IfHrFailRet's while(0) code.
+#pragma warning(disable:4917) // a GUID can only be associated with a class, interface or namespace
+#pragma warning(disable:4191) // 'reinterpret_cast' : unsafe conversion from 'FARPROC' to 'XXX'
+
+#ifdef _MANAGED
+// We are compiling Managed C++, switch to native code then (and store current managed/native status on the stack)
+#pragma managed(push, off)
+#endif //_MANAGED
+
+#include "mscoree.h"
+#include "metahost.h"
+
+#include "wchar.h"
+
+#include "corerror.h"
+
+// To minimize how much we perturb sources that we are included in, we make sure that
+// all macros we define/redefine are restored at the end of the header.
+#pragma push_macro("IfHrFailRet")
+#pragma push_macro("IfHrFailRetFALSE")
+#pragma push_macro("IfHrFailRetVOID")
+
+// ---IfHrFailRet------------------------------------------------------------------------------------
+#undef IfHrFailRet
+#undef IfHrFailRetFALSE
+#undef IfHrFailRetVOID
+#define IfHrFailRet(EXPR) do { hr = (EXPR); if(FAILED(hr)) { return (hr); } } while (0)
+#define IfHrFailRetFALSE(EXPR) do { HRESULT _hr_ = (EXPR); if(FAILED(_hr_)) { return false; } } while (0)
+#define IfHrFailRetVOID(EXPR) do { HRESULT _hr_ = (EXPR); if(FAILED(_hr_)) { return; } } while (0)
+
+#include "legacyactivationshimutil.h"
+
+// Use of deprecated APIs within LegacyActivationShim namespace will result in C4996 that we will
+// disable for our own use.
+#pragma warning(push)
+#pragma warning(disable:4996)
+// ---LEGACYACTIVATONSHIM NAMESPACE----------------------------------------------------------------
+namespace LegacyActivationShim
+{
+ // ---HELPERS----------------------------------------------------------------------------------
+#define GET_CLRMETAHOST(x) \
+ ICLRMetaHost *x = NULL; \
+ IfHrFailRet(Util::GetCLRMetaHost(&x))
+
+#define GET_CLRMETAHOSTPOLICY(x) \
+ ICLRMetaHostPolicy*x = NULL; \
+ IfHrFailRet(Util::GetCLRMetaHostPolicy(&x))
+
+#define GET_CLRINFO(x) \
+ ICLRRuntimeInfo *x = NULL; \
+ IfHrFailRet(Util::GetCLRRuntimeInfo(&x))
+
+#define LEGACY_API_PASS_THROUGH_STATIC(_name, _ret_type, _ret_value, _sig, _args) \
+ { \
+ hr = S_OK; \
+ _ret_value = ::_name _args; \
+ }
+
+#define LEGACY_API_PASS_THROUGH_STATIC_VOIDRET(_name, _sig, _args) \
+ { \
+ ::_name _args; \
+ }
+
+#define LEGACY_API_PASS_THROUGH_DELAYLOAD(_name, _ret_type, _ret_value, _sig, _args) \
+ { \
+ typedef _ret_type __stdcall t_FN _sig; \
+ Util::MscoreeFunctor<t_FN> FN; \
+ if (SUCCEEDED(hr = FN.Init(#_name))) { \
+ _ret_value = FN()_args; \
+ } \
+ }
+
+#define LEGACY_API_PASS_THROUGH_DELAYLOAD_VOIDRET(_name, _sig, _args) \
+ { \
+ typedef void __stdcall t_FN _sig; \
+ Util::MscoreeFunctor<t_FN> FN; \
+ if (SUCCEEDED(FN.Init(#_name))) { \
+ FN()_args; \
+ } \
+ }
+
+#ifndef LEGACY_ACTIVATION_SHIM_DELAY_LOAD
+#define CALL_LEGACY_API(_name, _sig, _args) \
+ LEGACY_API_PASS_THROUGH_STATIC(_name, HRESULT, hr, _sig, _args)
+#define CALL_LEGACY_API_VOIDRET(_name, _sig, _args) \
+ LEGACY_API_PASS_THROUGH_STATIC_VOIDRET(_name, _sig, _args)
+#else
+#define CALL_LEGACY_API(_name, _sig, _args) \
+ LEGACY_API_PASS_THROUGH_DELAYLOAD(_name, HRESULT, hr, _sig, _args)
+#define CALL_LEGACY_API_VOIDRET(_name, _sig, _args) \
+ LEGACY_API_PASS_THROUGH_DELAYLOAD_VOIDRET(_name, _sig, _args)
+#endif
+
+ // ---LEGACY SHIM FUNCTIONS--------------------------------------------------------------------
+
+ // --------------------------------------------------------------------------------------------
+ inline
+ HRESULT GetCORSystemDirectory(
+ __out_ecount(cchBuffer) LPWSTR pBuffer,
+ __in DWORD cchBuffer,
+ __out DWORD *pdwLength)
+ {
+ HRESULT hr = S_OK;
+
+ if (Util::HasNewActivationAPIs())
+ {
+ DWORD dwLengthDummy = cchBuffer;
+ if (pdwLength == NULL)
+ pdwLength = &dwLengthDummy;
+ else
+ *pdwLength = cchBuffer;
+
+ GET_CLRINFO(pInfo);
+ IfHrFailRet(pInfo->GetRuntimeDirectory(pBuffer, pdwLength));
+ }
+ else
+ {
+ CALL_LEGACY_API(GetCORSystemDirectory,
+ (LPWSTR pBuffer,
+ DWORD cchBuffer,
+ DWORD *pdwLength),
+ (pBuffer,
+ cchBuffer,
+ pdwLength));
+ }
+
+ return hr;
+ }
+
+ // --------------------------------------------------------------------------------------------
+ inline
+ HRESULT GetCORVersion(
+ __out_ecount(cchBuffer) LPWSTR pbBuffer,
+ __in DWORD cchBuffer,
+ __out DWORD *pdwLength)
+ {
+ HRESULT hr = S_OK;
+
+ if (Util::HasNewActivationAPIs())
+ {
+ DWORD dwLengthDummy = cchBuffer;
+ if (pdwLength == NULL)
+ pdwLength = &dwLengthDummy;
+ else
+ *pdwLength = cchBuffer;
+
+ GET_CLRINFO(pInfo);
+ IfHrFailRet(pInfo->GetVersionString(pbBuffer, pdwLength));
+ }
+ else
+ {
+ CALL_LEGACY_API(GetCORVersion,
+ (LPWSTR pbBuffer,
+ DWORD cchBuffer,
+ DWORD *pdwLength),
+ (pbBuffer,
+ cchBuffer,
+ pdwLength));
+
+ }
+
+ return hr;
+ }
+
+ // --------------------------------------------------------------------------------------------
+ inline
+ HRESULT GetFileVersion(
+ __in LPCWSTR szFileName,
+ __out_ecount(cchBuffer) LPWSTR szBuffer,
+ __in DWORD cchBuffer,
+ __out DWORD *pdwLength)
+ {
+ HRESULT hr = S_OK;
+
+ if (Util::HasNewActivationAPIs())
+ {
+ DWORD dwLengthDummy = cchBuffer;
+ if (pdwLength == NULL)
+ pdwLength = &dwLengthDummy;
+ else
+ *pdwLength = cchBuffer;
+
+ GET_CLRMETAHOST(pMH);
+ IfHrFailRet(pMH->GetVersionFromFile(szFileName, szBuffer, pdwLength));
+ }
+ else
+ {
+ CALL_LEGACY_API(GetFileVersion,
+ (LPCWSTR szFileName,
+ LPWSTR szBuffer,
+ DWORD cchBuffer,
+ DWORD *pdwLength),
+ (szFileName,
+ szBuffer,
+ cchBuffer,
+ pdwLength));
+ }
+
+ return hr;
+ }
+
+ // --------------------------------------------------------------------------------------------
+ inline
+ HRESULT GetCORRequiredVersion(
+ __out_ecount(cchBuffer) LPWSTR pBuffer,
+ __in DWORD cchBuffer,
+ __out DWORD *pdwLength)
+ {
+ HRESULT hr = S_OK;
+
+ if (Util::HasNewActivationAPIs())
+ {
+ DWORD dwLengthDummy = cchBuffer;
+ if (pdwLength == NULL)
+ pdwLength = &dwLengthDummy;
+ else
+ *pdwLength = cchBuffer;
+
+ IfHrFailRet(Util::GetConfigImageVersion(pBuffer, pdwLength));
+ }
+ else
+ {
+ CALL_LEGACY_API(GetCORRequiredVersion,
+ (LPWSTR pBuffer,
+ DWORD cchBuffer,
+ DWORD *pdwLength),
+ (pBuffer,
+ cchBuffer,
+ pdwLength));
+ }
+
+ return hr;
+ }
+
+ // --------------------------------------------------------------------------------------------
+ // This API is the one exception that we don't have fully equivalent functionality for
+ // in the new APIs. Specifically, we do not have the runtimeInfoFlags equivalent that
+ // allows platform differentiation. As such, we just send the call to the legacy API,
+ // which does not bind (thankfully) and so we do not cap this specific API to Whidbey.
+ inline
+ HRESULT GetRequestedRuntimeInfo(
+ __in_opt LPCWSTR pExe,
+ __in_opt LPCWSTR pwszVersion,
+ __in_opt LPCWSTR pConfigurationFile,
+ __in DWORD startupFlags,
+ __in DWORD runtimeInfoFlags,
+ __out_ecount(dwDirectory) LPWSTR pDirectory,
+ __in DWORD dwDirectory,
+ __out DWORD *pdwDirectoryLength,
+ __out_ecount(cchBuffer) LPWSTR pVersion,
+ __in DWORD cchBuffer,
+ __out DWORD *pdwLength)
+ {
+ HRESULT hr = S_OK;
+
+ CALL_LEGACY_API(GetRequestedRuntimeInfo,
+ (LPCWSTR pExe,
+ LPCWSTR pwszVersion,
+ LPCWSTR pConfigurationFile,
+ DWORD startupFlags,
+ DWORD runtimeInfoFlags,
+ LPWSTR pDirectory,
+ DWORD dwDirectory,
+ DWORD *pdwDirectoryLength,
+ LPWSTR pVersion,
+ DWORD cchBuffer,
+ DWORD *pdwLength),
+ (pExe,
+ pwszVersion,
+ pConfigurationFile,
+ startupFlags,
+ runtimeInfoFlags,
+ pDirectory,
+ dwDirectory,
+ pdwDirectoryLength,
+ pVersion,
+ cchBuffer,
+ pdwLength));
+
+ return hr;
+ }
+
+ // --------------------------------------------------------------------------------------------
+ inline
+ HRESULT GetRequestedRuntimeVersion(
+ __in LPWSTR pExe,
+ __out_ecount(cchBuffer) LPWSTR pVersion,
+ __in DWORD cchBuffer,
+ __out DWORD *pdwLength)
+ {
+ HRESULT hr = S_OK;
+
+ if (Util::HasNewActivationAPIs())
+ {
+ DWORD dwLengthDummy = cchBuffer;
+ if (pdwLength == NULL)
+ pdwLength = &dwLengthDummy;
+ else
+ *pdwLength = cchBuffer;
+
+ GET_CLRMETAHOSTPOLICY(pMHP);
+ ICLRRuntimeInfo *pInfo = NULL;
+ IfHrFailRet(pMHP->GetRequestedRuntime(
+ METAHOST_POLICY_USE_PROCESS_IMAGE_PATH,
+ pExe,
+ NULL, // config stream
+ pVersion,
+ pdwLength,
+ NULL, // image version str
+ NULL, // image version len
+ NULL,
+ IID_ICLRRuntimeInfo,
+ reinterpret_cast<LPVOID*>(&pInfo)));// ppRuntime
+ Util::ReleaseHolder<ICLRRuntimeInfo*> hInfo(pInfo);
+ }
+ else
+ {
+ CALL_LEGACY_API(GetRequestedRuntimeVersion,
+ (LPWSTR pExe,
+ LPWSTR pVersion,
+ DWORD cchBuffer,
+ DWORD *pdwLength),
+ (pExe,
+ pVersion,
+ cchBuffer,
+ pdwLength));
+ }
+
+ return hr;
+ }
+
+ // --------------------------------------------------------------------------------------------
+ inline
+ HRESULT CorBindToRuntimeHost(
+ LPCWSTR pwszVersion,
+ LPCWSTR pwszBuildFlavor,
+ LPCWSTR pwszHostConfigFile,
+ VOID* pReserved,
+ DWORD startupFlags,
+ REFCLSID rclsid,
+ REFIID riid,
+ LPVOID FAR *ppv)
+ {
+ HRESULT hr = S_OK;
+
+ if (Util::HasNewActivationAPIs())
+ {
+ IStream *pConfigStream = NULL;
+ Util::ReleaseHolder<IStream*> hConfigStream;
+ if (pwszHostConfigFile != NULL)
+ {
+ IfHrFailRet(Util::CreateIStreamFromFile(pwszHostConfigFile, &pConfigStream));
+ hConfigStream.Assign(pConfigStream);
+ }
+
+ WCHAR wszVersionLocal[512];
+ DWORD cchVersionLocal = 512;
+ if (pwszVersion != NULL)
+ wcsncpy_s(&wszVersionLocal[0], cchVersionLocal, pwszVersion, _TRUNCATE);
+
+ ICLRRuntimeInfo *pInfo = NULL;
+ IfHrFailRet(Util::GetCLRRuntimeInfo(
+ &pInfo,
+ NULL,
+ pConfigStream,
+ pwszVersion == NULL ? NULL : &wszVersionLocal[0],
+ pwszVersion == NULL ? NULL : &cchVersionLocal));
+
+ // We're intentionally ignoring the HRESULT return value, since CorBindToRuntimeEx
+ // always ignored these flags when a runtime had already been bound, and we need
+ // to emulate that behavior for when multiple calls to CorBindToRuntimeEx are made
+ // but with different startup flags (ICLRRuntimeInfo::SetDefaultStartupFlags will
+ // return E_INVALIDARG in the case that the runtime has already been started with
+ // different flags).
+ Util::AddStartupFlags(pInfo, pwszBuildFlavor, startupFlags, pwszHostConfigFile);
+
+ IfHrFailRet(pInfo->GetInterface(rclsid, riid, ppv));
+ }
+ else
+ {
+ CALL_LEGACY_API(CorBindToRuntimeHost,
+ (LPCWSTR pwszVersion,
+ LPCWSTR pwszBuildFlavor,
+ LPCWSTR pwszHostConfigFile,
+ VOID* pReserved,
+ DWORD startupFlags,
+ REFCLSID rclsid,
+ REFIID riid,
+ LPVOID FAR *ppv),
+ (pwszVersion,
+ pwszBuildFlavor,
+ pwszHostConfigFile,
+ pReserved,
+ startupFlags,
+ rclsid,
+ riid,
+ ppv));
+ }
+
+ return hr;
+ }
+
+ // --------------------------------------------------------------------------------------------
+ inline
+ HRESULT CorBindToRuntimeEx(
+ LPCWSTR pwszVersion,
+ LPCWSTR pwszBuildFlavor,
+ DWORD startupFlags,
+ REFCLSID rclsid,
+ REFIID riid,
+ LPVOID* ppv)
+ {
+ HRESULT hr = S_OK;
+
+ if (Util::HasNewActivationAPIs())
+ {
+ WCHAR wszVersionLocal[512];
+ DWORD cchVersionLocal = 512;
+ if (pwszVersion != NULL)
+ wcsncpy_s(&wszVersionLocal[0], cchVersionLocal, pwszVersion, _TRUNCATE);
+
+ ICLRRuntimeInfo *pInfo = NULL;
+ IfHrFailRet(Util::GetCLRRuntimeInfo(
+ &pInfo,
+ NULL, // exe path
+ NULL, // config stream
+ pwszVersion == NULL ? NULL : &wszVersionLocal[0],
+ pwszVersion == NULL ? NULL : &cchVersionLocal));
+
+ // We're intentionally ignoring the HRESULT return value, since CorBindToRuntimeEx
+ // always ignored these flags when a runtime had already been bound, and we need
+ // to emulate that behavior for when multiple calls to CorBindToRuntimeEx are made
+ // but with different startup flags (ICLRRuntimeInfo::SetDefaultStartupFlags will
+ // return E_INVALIDARG in the case that the runtime has already been started with
+ // different flags).
+ Util::AddStartupFlags(pInfo, pwszBuildFlavor, startupFlags, NULL);
+
+ IfHrFailRet(pInfo->GetInterface(rclsid, riid, ppv));
+ }
+ else
+ {
+ CALL_LEGACY_API(CorBindToRuntimeEx,
+ (LPCWSTR pwszVersion,
+ LPCWSTR pwszBuildFlavor,
+ DWORD startupFlags,
+ REFCLSID rclsid,
+ REFIID riid,
+ LPVOID* ppv),
+ (pwszVersion,
+ pwszBuildFlavor,
+ startupFlags,
+ rclsid,
+ riid,
+ ppv));
+ }
+
+ return hr;
+ }
+
+ // --------------------------------------------------------------------------------------------
+ inline
+ HRESULT CorBindToRuntimeByCfg(
+ IStream* pCfgStream,
+ DWORD reserved,
+ DWORD startupFlags,
+ REFCLSID rclsid,
+ REFIID riid,
+ LPVOID* ppv)
+ {
+ HRESULT hr = S_OK;
+
+ if (Util::HasNewActivationAPIs())
+ {
+ // The legacy CorBindToRuntimeByCfg picks up startup flags from both the config stream and
+ // application config file if it is present. For simplicity, we ignore the app config here.
+ ICLRRuntimeInfo *pInfo = NULL;
+ IfHrFailRet(Util::GetCLRRuntimeInfo(
+ &pInfo,
+ NULL, // exe path
+ pCfgStream));
+
+ // We're intentionally ignoring the HRESULT return value, since CorBindToRuntimeEx
+ // always ignored these flags when a runtime had already been bound, and we need
+ // to emulate that behavior for when multiple calls to CorBindToRuntimeEx are made
+ // but with different startup flags (ICLRRuntimeInfo::SetDefaultStartupFlags will
+ // return E_INVALIDARG in the case that the runtime has already been started with
+ // different flags).
+ Util::AddStartupFlags(pInfo, NULL, startupFlags, NULL);
+
+ IfHrFailRet(pInfo->GetInterface(rclsid, riid, ppv));
+ }
+ else
+ {
+ CALL_LEGACY_API(CorBindToRuntimeByCfg,
+ (IStream* pCfgStream,
+ DWORD reserved,
+ DWORD startupFlags,
+ REFCLSID rclsid,
+ REFIID riid,
+ LPVOID* ppv),
+ (pCfgStream,
+ reserved,
+ startupFlags,
+ rclsid,
+ riid,
+ ppv));
+ }
+
+ return hr;
+ }
+
+ // --------------------------------------------------------------------------------------------
+ inline
+ HRESULT CorBindToRuntime(
+ LPCWSTR pwszVersion,
+ LPCWSTR pwszBuildFlavor,
+ REFCLSID rclsid,
+ REFIID riid,
+ LPVOID* ppv)
+ {
+ HRESULT hr = S_OK;
+
+ if (Util::HasNewActivationAPIs())
+ {
+ WCHAR wszVersionLocal[512];
+ DWORD cchVersionLocal = 512;
+ if (pwszVersion != NULL)
+ wcsncpy_s(&wszVersionLocal[0], cchVersionLocal, pwszVersion, _TRUNCATE);
+
+ ICLRRuntimeInfo *pInfo = NULL;
+ IfHrFailRet(Util::GetCLRRuntimeInfo(
+ &pInfo,
+ NULL, // exe path
+ NULL, // config stream
+ pwszVersion == NULL ? NULL : &wszVersionLocal[0],
+ pwszVersion == NULL ? NULL : &cchVersionLocal));
+
+ // CorBindToRuntime has its special default flags
+ //
+ // We're intentionally ignoring the HRESULT return value, since CorBindToRuntimeEx
+ // always ignored these flags when a runtime had already been bound, and we need
+ // to emulate that behavior for when multiple calls to CorBindToRuntimeEx are made
+ // but with different startup flags (ICLRRuntimeInfo::SetDefaultStartupFlags will
+ // return E_INVALIDARG in the case that the runtime has already been started with
+ // different flags).
+ Util::AddStartupFlags(pInfo, NULL, STARTUP_LOADER_OPTIMIZATION_MULTI_DOMAIN_HOST, NULL);
+
+ IfHrFailRet(pInfo->GetInterface(rclsid, riid, ppv));
+ }
+ else
+ {
+ CALL_LEGACY_API(CorBindToRuntime,
+ (LPCWSTR pwszVersion,
+ LPCWSTR pwszBuildFlavor,
+ REFCLSID rclsid,
+ REFIID riid,
+ LPVOID* ppv),
+ (pwszVersion,
+ pwszBuildFlavor,
+ rclsid,
+ riid,
+ ppv));
+ }
+
+ return hr;
+ }
+
+ // --------------------------------------------------------------------------------------------
+ inline
+ HRESULT CorBindToCurrentRuntime(
+ LPCWSTR pwszFileName,
+ REFCLSID rclsid,
+ REFIID riid,
+ LPVOID FAR *ppv)
+ {
+ HRESULT hr = S_OK;
+
+ if (Util::HasNewActivationAPIs())
+ {
+ ICLRRuntimeInfo *pInfo = NULL;
+ IfHrFailRet(Util::GetCLRRuntimeInfo(
+ &pInfo,
+ pwszFileName));
+
+ IfHrFailRet(pInfo->GetInterface(rclsid, riid, ppv));
+ }
+ else
+ {
+ CALL_LEGACY_API(CorBindToCurrentRuntime,
+ (LPCWSTR pwszFileName,
+ REFCLSID rclsid,
+ REFIID riid,
+ LPVOID FAR *ppv),
+ (pwszFileName,
+ rclsid,
+ riid,
+ ppv));
+ }
+
+ return hr;
+ }
+
+ // --------------------------------------------------------------------------------------------
+ inline
+ HRESULT ClrCreateManagedInstance(
+ LPCWSTR pTypeName,
+ REFIID riid,
+ void **ppObject)
+ {
+ HRESULT hr = S_OK;
+
+ if (Util::HasNewActivationAPIs())
+ {
+ GET_CLRINFO(pInfo);
+ HRESULT (STDMETHODCALLTYPE *pfnClrCreateManagedInstance)(LPCWSTR typeName, REFIID riid, void ** ppv) = NULL;
+ IfHrFailRet(pInfo->GetProcAddress("ClrCreateManagedInstance", (LPVOID *)&pfnClrCreateManagedInstance));
+ IfHrFailRet(pfnClrCreateManagedInstance(pTypeName, riid, ppObject));
+ }
+ else
+ {
+ CALL_LEGACY_API(ClrCreateManagedInstance,
+ (LPCWSTR pTypeName,
+ REFIID riid,
+ void **ppObject),
+ (pTypeName,
+ riid,
+ ppObject));
+ }
+
+ return hr;
+ }
+
+ // --------------------------------------------------------------------------------------------
+ inline
+ HRESULT LoadLibraryShim(
+ LPCWSTR szDllName,
+ LPCWSTR szVersion,
+ LPVOID pvReserved,
+ HMODULE *phModDll)
+ {
+ HRESULT hr = S_OK;
+
+ if (Util::HasNewActivationAPIs())
+ {
+ Util::ReleaseHolder<ICLRRuntimeInfo*> hInfo;
+ ICLRRuntimeInfo *pInfo = NULL;
+
+ // Semantics of LoadLibraryShim is that a non-null version must match exactly.
+ if (szVersion != NULL)
+ {
+ GET_CLRMETAHOST(pMH);
+ IfHrFailRet(pMH->GetRuntime(szVersion, IID_ICLRRuntimeInfo, reinterpret_cast<LPVOID*>(&pInfo)));
+ hInfo.Assign(pInfo);
+ }
+ else
+ {
+ IfHrFailRet(Util::GetCLRRuntimeInfo(&pInfo));
+ }
+ IfHrFailRet(pInfo->LoadLibrary(szDllName, phModDll));
+ }
+ else
+ {
+ CALL_LEGACY_API(LoadLibraryShim,
+ (LPCWSTR szDllName,
+ LPCWSTR szVersion,
+ LPVOID pvReserved,
+ HMODULE *phModDll),
+ (szDllName,
+ szVersion,
+ pvReserved,
+ phModDll));
+ }
+
+ return hr;
+ }
+
+ // --------------------------------------------------------------------------------------------
+ inline
+ HRESULT CallFunctionShim(
+ LPCWSTR szDllName,
+ LPCSTR szFunctionName,
+ LPVOID lpvArgument1,
+ LPVOID lpvArgument2,
+ LPCWSTR szVersion,
+ LPVOID pvReserved)
+ {
+ HRESULT hr = S_OK;
+
+ if (Util::HasNewActivationAPIs())
+ {
+ HMODULE hMod = NULL;
+ HRESULT (__stdcall * pfn)(LPVOID,LPVOID) = NULL;
+
+ // Load library
+ IfHrFailRet(LegacyActivationShim::LoadLibraryShim(szDllName, szVersion, pvReserved, &hMod));
+
+ // NOTE: Legacy CallFunctionShim does not release HMODULE, leak to maintain compat
+ // Util::HMODULEHolder hModHolder(hMod);
+
+ // Find function.
+ pfn = (HRESULT (__stdcall *)(LPVOID,LPVOID))GetProcAddress(hMod, szFunctionName);
+ if (pfn == NULL)
+ return HRESULT_FROM_WIN32(GetLastError());
+
+ // Call it.
+ return pfn(lpvArgument1, lpvArgument2);
+ }
+ else
+ {
+ CALL_LEGACY_API(CallFunctionShim,
+ (LPCWSTR szDllName,
+ LPCSTR szFunctionName,
+ LPVOID lpvArgument1,
+ LPVOID lpvArgument2,
+ LPCWSTR szVersion,
+ LPVOID pvReserved),
+ (szDllName,
+ szFunctionName,
+ lpvArgument1,
+ lpvArgument2,
+ szVersion,
+ pvReserved));
+ }
+
+ return hr;
+ }
+
+ // --------------------------------------------------------------------------------------------
+ inline
+ HRESULT GetRealProcAddress(
+ LPCSTR pwszProcName,
+ VOID **ppv)
+ {
+ HRESULT hr = S_OK;
+
+ if (Util::HasNewActivationAPIs())
+ {
+ GET_CLRINFO(pInfo);
+ IfHrFailRet(pInfo->GetProcAddress(pwszProcName, ppv));
+ }
+ else
+ {
+ CALL_LEGACY_API(GetRealProcAddress,
+ (LPCSTR pwszProcName,
+ VOID **ppv),
+ (pwszProcName,
+ ppv));
+ }
+
+ return hr;
+ }
+
+ // --------------------------------------------------------------------------------------------
+ inline
+ void CorExitProcess(
+ int exitCode)
+ {
+#ifndef LEGACY_ACTIVATION_SHIM_DELAY_LOAD
+ ::CorExitProcess(exitCode);
+#else
+ typedef void __stdcall t_CorExitProcess(
+ int exitCode);
+
+ Util::MscoreeFunctor<t_CorExitProcess> FN;
+ if (FAILED(FN.Init("CorExitProcess")))
+ return;
+
+ FN()(exitCode);
+#endif
+ }
+
+// Define this method only if it is not yet defined as macro (see ndp\clr\src\inc\UtilCode.h).
+#ifndef LoadStringRC
+ // --------------------------------------------------------------------------------------------
+ inline
+ HRESULT LoadStringRC(
+ UINT nResourceID,
+ __out_ecount(nMax) LPWSTR szBuffer,
+ int nMax,
+ int fQuiet)
+ {
+ HRESULT hr = S_OK;
+
+ if (Util::HasNewActivationAPIs())
+ {
+ GET_CLRINFO(pInfo);
+ DWORD cchMax = static_cast<DWORD>(nMax);
+ IfHrFailRet(pInfo->LoadErrorString(nResourceID, szBuffer, &cchMax, -1));
+ }
+ else
+ {
+ CALL_LEGACY_API(LoadStringRC,
+ (UINT nResourceID,
+ LPWSTR szBuffer,
+ int nMax,
+ int fQuiet),
+ (nResourceID,
+ szBuffer,
+ nMax,
+ fQuiet));
+ }
+
+ return hr;
+ }
+#endif //LoadStringRC
+
+// Define this method only if it is not yet defined as macro (see ndp\clr\src\inc\UtilCode.h).
+#if !defined(LoadStringRCEx) && !defined(FEATURE_CORESYSTEM)
+ // --------------------------------------------------------------------------------------------
+ inline
+ HRESULT LoadStringRCEx(
+ LCID lcid,
+ UINT nResourceID,
+ __out_ecount(nMax) LPWSTR szBuffer,
+ int nMax,
+ int fQuiet,
+ int *pcwchUsed)
+ {
+ HRESULT hr = S_OK;
+
+ if (Util::HasNewActivationAPIs())
+ {
+ GET_CLRINFO(pInfo);
+ DWORD cchUsed = static_cast<DWORD>(nMax);
+ IfHrFailRet(pInfo->LoadErrorString(nResourceID, szBuffer, &cchUsed, lcid));
+ *pcwchUsed = cchUsed;
+ }
+ else
+ {
+ CALL_LEGACY_API(LoadStringRCEx,
+ (LCID lcid,
+ UINT nResourceID,
+ LPWSTR szBuffer,
+ int nMax,
+ int fQuiet,
+ int *pcwchUsed),
+ (lcid,
+ nResourceID,
+ szBuffer,
+ nMax,
+ fQuiet,
+ pcwchUsed));
+ }
+
+ return hr;
+ }
+#endif //LoadStringRCEx
+
+ // --------------------------------------------------------------------------------------------
+ inline
+ HRESULT LockClrVersion(
+ FLockClrVersionCallback hostCallback,
+ FLockClrVersionCallback *pBeginHostSetup,
+ FLockClrVersionCallback *pEndHostSetup)
+ {
+ HRESULT hr = S_OK;
+
+ CALL_LEGACY_API(LockClrVersion,
+ (FLockClrVersionCallback hostCallback,
+ FLockClrVersionCallback *pBeginHostSetup,
+ FLockClrVersionCallback *pEndHostSetup),
+ (hostCallback,
+ pBeginHostSetup,
+ pEndHostSetup));
+
+ return hr;
+ }
+
+ // --------------------------------------------------------------------------------------------
+ inline
+ HRESULT CreateDebuggingInterfaceFromVersion(
+ int nDebuggerVersion,
+ LPCWSTR szDebuggeeVersion,
+ IUnknown ** ppCordb)
+ {
+ HRESULT hr = S_OK;
+
+ CALL_LEGACY_API(CreateDebuggingInterfaceFromVersion,
+ (int nDebuggerVersion,
+ LPCWSTR szDebuggeeVersion,
+ IUnknown ** ppCordb),
+ (nDebuggerVersion,
+ szDebuggeeVersion,
+ ppCordb));
+
+ return hr;
+ }
+
+ // --------------------------------------------------------------------------------------------
+ inline
+ HRESULT GetVersionFromProcess(
+ __in HANDLE hProcess,
+ __out_ecount(cchBuffer) LPWSTR pVersion,
+ __in DWORD cchBuffer,
+ __out DWORD *pdwLength)
+ {
+ HRESULT hr = S_OK;
+
+ CALL_LEGACY_API(GetVersionFromProcess,
+ (HANDLE hProcess,
+ LPWSTR pVersion,
+ DWORD cchBuffer,
+ DWORD *pdwLength),
+ (hProcess,
+ pVersion,
+ cchBuffer,
+ pdwLength));
+
+ return hr;
+ }
+
+ // --------------------------------------------------------------------------------------------
+// CoInitializeEE is declared in cor.h, define it only if explicitly requested
+#ifdef LEGACY_ACTIVATION_SHIM_DEFINE_CoInitializeEE
+ inline
+ HRESULT CoInitializeEE(DWORD flags)
+ {
+ HRESULT hr = S_OK;
+
+ if (Util::HasNewActivationAPIs())
+ {
+ GET_CLRINFO(pInfo);
+ HRESULT (* pfnCoInitializeEE)(DWORD);
+ IfHrFailRet(pInfo->GetProcAddress("CoInitializeEE", (LPVOID *)&pfnCoInitializeEE));
+ return (*pfnCoInitializeEE)(flags);
+ }
+ else
+ {
+ CALL_LEGACY_API(CoInitializeEE,
+ (DWORD flags),
+ (flags));
+ }
+
+ return hr;
+ }
+
+ inline
+ VOID CoUninitializeEE(BOOL flags)
+ {
+ if (Util::HasNewActivationAPIs())
+ {
+ ICLRRuntimeInfo *pInfo = NULL;
+ if (FAILED(Util::GetCLRRuntimeInfo(&pInfo)))
+ return;
+
+ VOID (* pfnCoUninitializeEE)(BOOL);
+ if (FAILED(pInfo->GetProcAddress("CoUninitializeEE", (LPVOID *)&pfnCoUninitializeEE)))
+ return;
+
+ (*pfnCoUninitializeEE)(flags);
+ }
+ else
+ {
+ CALL_LEGACY_API_VOIDRET(CoUninitializeEE,
+ (BOOL flags),
+ (flags));
+ }
+ }
+
+ inline
+ HRESULT CoInitializeCor(DWORD flags)
+ {
+ HRESULT hr = S_OK;
+
+ if (Util::HasNewActivationAPIs())
+ {
+ GET_CLRINFO(pInfo);
+ HRESULT (* pfnCoInitializeCor)(DWORD);
+ IfHrFailRet(pInfo->GetProcAddress("CoInitializeCor", (LPVOID *)&pfnCoInitializeCor));
+ return (*pfnCoInitializeCor)(flags);
+ }
+ else
+ {
+ CALL_LEGACY_API(CoInitializeCor,
+ (DWORD flags),
+ (flags));
+ }
+
+ return hr;
+ }
+
+ inline
+ VOID CoUninitializeCor()
+ {
+ if (Util::HasNewActivationAPIs())
+ {
+ ICLRRuntimeInfo *pInfo = NULL;
+ if (FAILED(Util::GetCLRRuntimeInfo(&pInfo)))
+ return;
+
+ VOID (* pfnCoUninitializeCor)();
+ if (FAILED(pInfo->GetProcAddress("CoUninitializeCor", (LPVOID *)&pfnCoUninitializeCor)))
+ return;
+
+ (*pfnCoUninitializeCor)();
+ }
+ else
+ {
+ CALL_LEGACY_API_VOIDRET(CoUninitializeCor,
+ (VOID),
+ ());
+ }
+ }
+
+#endif //LEGACY_ACTIVATION_SHIM_DEFINE_CoInitializeEE
+
+ // --------------------------------------------------------------------------------------------
+// CoEEShutDownCOM is declared in cor.h, define it only if explicitly requested
+#ifdef LEGACY_ACTIVATION_SHIM_DEFINE_CoEEShutDownCOM
+ inline
+ void CoEEShutDownCOM()
+ {
+ if (Util::HasNewActivationAPIs())
+ {
+ ICLRRuntimeInfo *pInfo = NULL;
+ IfHrFailRetVOID(Util::GetCLRRuntimeInfo(&pInfo));
+ void (* pfnCoEEShutDownCOM)();
+ IfHrFailRetVOID(pInfo->GetProcAddress("CoEEShutDownCOM", (LPVOID *)&pfnCoEEShutDownCOM));
+ (*pfnCoEEShutDownCOM)();
+ }
+ else
+ {
+ CALL_LEGACY_API_VOIDRET(CoEEShutDownCOM,
+ (),
+ ());
+ }
+
+ return;
+ }
+#endif //LEGACY_ACTIVATION_SHIM_DEFINE_CoEEShutDownCOM
+
+ // ---StrongName Function Helpers--------------------------------------------------------------
+#if !defined(LEGACY_ACTIVATION_SHIM_DELAY_LOAD) && defined(__STRONG_NAME_H)
+#define LEGACY_STRONGNAME_API_PASS_THROUGH(_name, _ret_type, _ret_value, _sig, _args) \
+ LEGACY_API_PASS_THROUGH_STATIC(_name, _ret_type, _ret_value, _sig, _args)
+#define LEGACY_STRONGNAME_API_PASS_THROUGH_VOIDRET(_name, _sig, _args) \
+ LEGACY_API_PASS_THROUGH_STATIC_VOIDRET(_name, _sig, _args)
+#else //defined(LEGACY_ACTIVATION_SHIM_DELAY_LOAD) || !defined(__STRONG_NAME_H)
+#define LEGACY_STRONGNAME_API_PASS_THROUGH(_name, _ret_type, _ret_value, _sig, _args) \
+ LEGACY_API_PASS_THROUGH_DELAYLOAD(_name, _ret_type, _ret_value, _sig, _args)
+#define LEGACY_STRONGNAME_API_PASS_THROUGH_VOIDRET(_name, _sig, _args) \
+ LEGACY_API_PASS_THROUGH_DELAYLOAD_VOIDRET(_name, _sig, _args)
+#endif //defined(LEGACY_ACTIVATION_SHIM_DELAY_LOAD) || !defined(__STRONG_NAME_H)
+
+// Defines a method that just delegates a call to the right runtime, this one is for SN APIs that
+// return HRESULT.
+#define PASS_THROUGH_IMPL_HRESULT(_name, _signature, _args) \
+ inline \
+ HRESULT _name##_signature \
+ { \
+ HRESULT hr = S_OK; \
+ if (Util::HasNewActivationAPIs()) \
+ { \
+ ICLRStrongName *pSN = NULL; \
+ IfHrFailRet(Util::GetCLRStrongName(&pSN)); \
+ IfHrFailRet(pSN->_name _args); \
+ } \
+ else \
+ { \
+ LEGACY_STRONGNAME_API_PASS_THROUGH( \
+ _name, HRESULT, hr, _signature, _args); \
+ IfHrFailRet(hr); \
+ } \
+ return hr; \
+ }
+
+// Defines a method that just delegates a call to the right runtime, this one is for SN APIs that
+// return BOOL.
+#define PASS_THROUGH_IMPL_BOOLEAN(_name, _signature, _args) \
+ inline \
+ BOOL _name##_signature \
+ { \
+ HRESULT hr = S_OK; \
+ if (Util::HasNewActivationAPIs()) \
+ { \
+ ICLRStrongName *pSN = NULL; \
+ IfHrFailRetFALSE(Util::GetCLRStrongName(&pSN)); \
+ IfHrFailRetFALSE(pSN->_name _args); \
+ return TRUE; \
+ } \
+ else \
+ { \
+ BOOL fResult = TRUE; \
+ LEGACY_STRONGNAME_API_PASS_THROUGH( \
+ _name, BOOL, fResult, _signature, _args); \
+ IfHrFailRetFALSE(hr); \
+ return fResult; \
+ } \
+ }
+
+// Defines a method that just delegates a call to the right runtime, this one is for SN APIs that
+// return VOID.
+#define PASS_THROUGH_IMPL_VOID(_name, _signature, _args) \
+ inline \
+ VOID _name##_signature \
+ { \
+ HRESULT hr = S_OK; \
+ if (Util::HasNewActivationAPIs()) \
+ { \
+ ICLRStrongName *pSN = NULL; \
+ IfHrFailRetVOID(Util::GetCLRStrongName(&pSN)); \
+ IfHrFailRetVOID(pSN->_name _args); \
+ return; \
+ } \
+ else \
+ { \
+ LEGACY_STRONGNAME_API_PASS_THROUGH_VOIDRET( \
+ _name, _signature, _args); \
+ IfHrFailRetVOID(hr); \
+ return; \
+ } \
+ }
+
+ // ---StrongName functions---------------------------------------------------------------------
+
+PASS_THROUGH_IMPL_HRESULT(GetHashFromAssemblyFile,
+ (LPCSTR pszFilePath, unsigned int *piHashAlg, BYTE *pbHash, DWORD cchHash, DWORD *pchHash),
+ (pszFilePath, piHashAlg, pbHash, cchHash, pchHash));
+
+PASS_THROUGH_IMPL_HRESULT(GetHashFromAssemblyFileW,
+ (LPCWSTR pwzFilePath, unsigned int *piHashAlg, BYTE *pbHash, DWORD cchHash, DWORD *pchHash),
+ (pwzFilePath, piHashAlg, pbHash, cchHash, pchHash));
+
+PASS_THROUGH_IMPL_HRESULT(GetHashFromBlob,
+ (BYTE *pbBlob, DWORD cchBlob, unsigned int *piHashAlg, BYTE *pbHash, DWORD cchHash, DWORD *pchHash),
+ (pbBlob, cchBlob, piHashAlg, pbHash, cchHash, pchHash));
+
+PASS_THROUGH_IMPL_HRESULT(GetHashFromFile,
+ (LPCSTR pszFilePath, unsigned int *piHashAlg, BYTE *pbHash, DWORD cchHash, DWORD *pchHash),
+ (pszFilePath, piHashAlg, pbHash, cchHash, pchHash));
+
+PASS_THROUGH_IMPL_HRESULT(GetHashFromFileW,
+ (LPCWSTR pwzFilePath, unsigned int *piHashAlg, BYTE *pbHash, DWORD cchHash, DWORD *pchHash),
+ (pwzFilePath, piHashAlg, pbHash, cchHash, pchHash));
+
+PASS_THROUGH_IMPL_HRESULT(GetHashFromHandle,
+ (HANDLE hFile, unsigned int *piHashAlg, BYTE *pbHash, DWORD cchHash, DWORD *pchHash),
+ (hFile, piHashAlg, pbHash, cchHash, pchHash));
+
+PASS_THROUGH_IMPL_BOOLEAN(StrongNameCompareAssemblies,
+ (LPCWSTR pwzAssembly1, LPCWSTR pwzAssembly2, DWORD *pdwResult),
+ (pwzAssembly1, pwzAssembly2, pdwResult));
+
+PASS_THROUGH_IMPL_VOID(StrongNameFreeBuffer,
+ (BYTE *pbMemory),
+ (pbMemory));
+
+PASS_THROUGH_IMPL_BOOLEAN(StrongNameGetBlob,
+ (LPCWSTR pwzFilePath, BYTE *pbBlob, DWORD *pcbBlob),
+ (pwzFilePath, pbBlob, pcbBlob));
+
+PASS_THROUGH_IMPL_BOOLEAN(StrongNameGetBlobFromImage,
+ (BYTE *pbBase, DWORD dwLength, BYTE *pbBlob, DWORD *pcbBlob),
+ (pbBase, dwLength, pbBlob, pcbBlob));
+
+PASS_THROUGH_IMPL_BOOLEAN(StrongNameGetPublicKey,
+ (LPCWSTR pwzKeyContainer, BYTE *pbKeyBlob, ULONG cbKeyBlob, BYTE **ppbPublicKeyBlob, ULONG *pcbPublicKeyBlob),
+ (pwzKeyContainer, pbKeyBlob, cbKeyBlob, ppbPublicKeyBlob, pcbPublicKeyBlob));
+
+PASS_THROUGH_IMPL_BOOLEAN(StrongNameHashSize,
+ (ULONG ulHashAlg, DWORD *pcbSize),
+ (ulHashAlg, pcbSize));
+
+PASS_THROUGH_IMPL_BOOLEAN(StrongNameKeyDelete,
+ (LPCWSTR pwzKeyContainer),
+ (pwzKeyContainer));
+
+PASS_THROUGH_IMPL_BOOLEAN(StrongNameKeyGen,
+ (LPCWSTR pwzKeyContainer, DWORD dwFlags, BYTE **ppbKeyBlob, ULONG *pcbKeyBlob),
+ (pwzKeyContainer, dwFlags, ppbKeyBlob, pcbKeyBlob));
+
+PASS_THROUGH_IMPL_BOOLEAN(StrongNameKeyGenEx,
+ (LPCWSTR pwzKeyContainer, DWORD dwFlags, DWORD dwKeySize, BYTE **ppbKeyBlob, ULONG *pcbKeyBlob),
+ (pwzKeyContainer, dwFlags, dwKeySize, ppbKeyBlob, pcbKeyBlob));
+
+PASS_THROUGH_IMPL_BOOLEAN(StrongNameKeyInstall,
+ (LPCWSTR pwzKeyContainer, BYTE *pbKeyBlob, ULONG cbKeyBlob),
+ (pwzKeyContainer, pbKeyBlob, cbKeyBlob));
+
+PASS_THROUGH_IMPL_BOOLEAN(StrongNameSignatureGeneration,
+ (LPCWSTR pwzFilePath, LPCWSTR pwzKeyContainer, BYTE *pbKeyBlob, ULONG cbKeyBlob, BYTE **ppbSignatureBlob, ULONG *pcbSignatureBlob),
+ (pwzFilePath, pwzKeyContainer, pbKeyBlob, cbKeyBlob, ppbSignatureBlob, pcbSignatureBlob));
+
+PASS_THROUGH_IMPL_BOOLEAN(StrongNameSignatureGenerationEx,
+ (LPCWSTR wszFilePath, LPCWSTR wszKeyContainer, BYTE *pbKeyBlob, ULONG cbKeyBlob, BYTE **ppbSignatureBlob, ULONG *pcbSignatureBlob, DWORD dwFlags),
+ (wszFilePath, wszKeyContainer, pbKeyBlob, cbKeyBlob, ppbSignatureBlob, pcbSignatureBlob, dwFlags));
+
+PASS_THROUGH_IMPL_BOOLEAN(StrongNameSignatureSize,
+ (BYTE *pbPublicKeyBlob, ULONG cbPublicKeyBlob, DWORD *pcbSize),
+ (pbPublicKeyBlob, cbPublicKeyBlob, pcbSize));
+
+PASS_THROUGH_IMPL_BOOLEAN(StrongNameSignatureVerification,
+ (LPCWSTR pwzFilePath, DWORD dwInFlags, DWORD *pdwOutFlags),
+ (pwzFilePath, dwInFlags, pdwOutFlags));
+
+PASS_THROUGH_IMPL_BOOLEAN(StrongNameSignatureVerificationEx,
+ (LPCWSTR pwzFilePath, BOOLEAN fForceVerification, BOOLEAN *pfWasVerified),
+ (pwzFilePath, fForceVerification, pfWasVerified));
+
+PASS_THROUGH_IMPL_BOOLEAN(StrongNameSignatureVerificationFromImage,
+ (BYTE *pbBase, DWORD dwLength, DWORD dwInFlags, DWORD *pdwOutFlags),
+ (pbBase, dwLength, dwInFlags, pdwOutFlags));
+
+PASS_THROUGH_IMPL_BOOLEAN(StrongNameTokenFromAssembly,
+ (LPCWSTR pwzFilePath, BYTE **ppbStrongNameToken, ULONG *pcbStrongNameToken),
+ (pwzFilePath, ppbStrongNameToken, pcbStrongNameToken));
+
+PASS_THROUGH_IMPL_BOOLEAN(StrongNameTokenFromAssemblyEx,
+ (LPCWSTR pwzFilePath, BYTE **ppbStrongNameToken, ULONG *pcbStrongNameToken, BYTE **ppbPublicKeyBlob, ULONG *pcbPublicKeyBlob),
+ (pwzFilePath, ppbStrongNameToken, pcbStrongNameToken, ppbPublicKeyBlob, pcbPublicKeyBlob));
+
+PASS_THROUGH_IMPL_BOOLEAN(StrongNameTokenFromPublicKey,
+ (BYTE *pbPublicKeyBlob, ULONG cbPublicKeyBlob, BYTE **ppbStrongNameToken, ULONG *pcbStrongNameToken),
+ (pbPublicKeyBlob, cbPublicKeyBlob, ppbStrongNameToken, pcbStrongNameToken));
+
+#undef PASS_THROUGH_IMPL_HRESULT
+#undef PASS_THROUGH_IMPL_BOOLEAN
+#undef PASS_THROUGH_IMPL_VOID
+
+// Defines a method that just delegates a call to the right runtime, this one is for SN APIs that
+// return BOOLEAN.
+#define WRAP_HRESULT_IMPL_BOOLEAN(_WrapperName, _name, _signature, _args) \
+ inline \
+ HRESULT _WrapperName##_signature \
+ { \
+ HRESULT hr = S_OK; \
+ if (Util::HasNewActivationAPIs()) \
+ { \
+ ICLRStrongName *pSN = NULL; \
+ IfHrFailRet(Util::GetCLRStrongName(&pSN)); \
+ return pSN->_name _args; \
+ } \
+ else \
+ { \
+ typedef BOOL __stdcall t_FN _signature; \
+ Util::MscoreeFunctor<t_FN> FN; \
+ IfHrFailRet(FN.Init(#_name)); \
+ if ((FN() _args)) \
+ { \
+ return S_OK; \
+ } \
+ else \
+ { /*@TODO: Static bind version, if necessary*/ \
+ typedef DWORD __stdcall t_FNStrongNameErrorInfo(void); \
+ Util::MscoreeFunctor<t_FNStrongNameErrorInfo> FNStrongNameErrorInfo; \
+ IfHrFailRet(FNStrongNameErrorInfo.Init("StrongNameErrorInfo")); \
+ HRESULT hrResult = (HRESULT)FNStrongNameErrorInfo() (); \
+ if (SUCCEEDED(hrResult)) \
+ { \
+ hrResult = E_FAIL; \
+ } \
+ return hrResult; \
+ } \
+ } \
+ }
+
+WRAP_HRESULT_IMPL_BOOLEAN(StrongNameHashSize_HRESULT,
+ StrongNameHashSize,
+ (ULONG ulHashAlg, DWORD *pcbSize),
+ (ulHashAlg, pcbSize));
+
+WRAP_HRESULT_IMPL_BOOLEAN(StrongNameTokenFromPublicKey_HRESULT,
+ StrongNameTokenFromPublicKey,
+ (BYTE *pbPublicKeyBlob, ULONG cbPublicKeyBlob, BYTE **ppbStrongNameToken, ULONG *pcbStrongNameToken),
+ (pbPublicKeyBlob, cbPublicKeyBlob, ppbStrongNameToken, pcbStrongNameToken));
+
+WRAP_HRESULT_IMPL_BOOLEAN(StrongNameSignatureSize_HRESULT,
+ StrongNameSignatureSize,
+ (BYTE *pbPublicKeyBlob, ULONG cbPublicKeyBlob, DWORD *pcbSize),
+ (pbPublicKeyBlob, cbPublicKeyBlob, pcbSize));
+
+WRAP_HRESULT_IMPL_BOOLEAN(StrongNameGetPublicKey_HRESULT,
+ StrongNameGetPublicKey,
+ (LPCWSTR pwzKeyContainer, BYTE *pbKeyBlob, ULONG cbKeyBlob, BYTE **ppbPublicKeyBlob, ULONG *pcbPublicKeyBlob),
+ (pwzKeyContainer, pbKeyBlob, cbKeyBlob, ppbPublicKeyBlob, pcbPublicKeyBlob));
+
+WRAP_HRESULT_IMPL_BOOLEAN(StrongNameKeyInstall_HRESULT,
+ StrongNameKeyInstall,
+ (LPCWSTR pwzKeyContainer, BYTE *pbKeyBlob, ULONG cbKeyBlob),
+ (pwzKeyContainer, pbKeyBlob, cbKeyBlob));
+
+WRAP_HRESULT_IMPL_BOOLEAN(StrongNameSignatureGeneration_HRESULT,
+ StrongNameSignatureGeneration,
+ (LPCWSTR pwzFilePath, LPCWSTR pwzKeyContainer, BYTE *pbKeyBlob, ULONG cbKeyBlob, BYTE **ppbSignatureBlob, ULONG *pcbSignatureBlob),
+ (pwzFilePath, pwzKeyContainer, pbKeyBlob, cbKeyBlob, ppbSignatureBlob, pcbSignatureBlob));
+
+WRAP_HRESULT_IMPL_BOOLEAN(StrongNameKeyGen_HRESULT,
+ StrongNameKeyGen,
+ (LPCWSTR pwzKeyContainer, DWORD dwFlags, BYTE **ppbKeyBlob, ULONG *pcbKeyBlob),
+ (pwzKeyContainer, dwFlags, ppbKeyBlob, pcbKeyBlob));
+
+#undef WRAP_HRESULT_IMPL_BOOLEAN
+
+// Defines a method that just delegates a call to the right runtime, this one is for ICLRStrongName2
+// APIs that return BOOLEAN.
+#define WRAP_HRESULT_IMPL_BOOLEAN(_WrapperName, _name, _signature, _args) \
+ inline \
+ HRESULT _WrapperName##_signature \
+ { \
+ HRESULT hr = S_OK; \
+ if (Util::HasNewActivationAPIs()) \
+ { \
+ ICLRStrongName2 *pSN = NULL; \
+ IfHrFailRet(Util::GetCLRStrongName2(&pSN)); \
+ return pSN->_name _args; \
+ } \
+ else \
+ { \
+ return E_FAIL; \
+ } \
+ }
+
+
+WRAP_HRESULT_IMPL_BOOLEAN(StrongNameGetPublicKeyEx_HRESULT,
+ StrongNameGetPublicKeyEx,
+ (LPCWSTR pwzKeyContainer, BYTE *pbKeyBlob, ULONG cbKeyBlob, BYTE **ppbPublicKeyBlob, ULONG *pcbPublicKeyBlob, ULONG uHashAlgId, ULONG uReserved),
+ (pwzKeyContainer, pbKeyBlob, cbKeyBlob, ppbPublicKeyBlob, pcbPublicKeyBlob, uHashAlgId, uReserved));
+
+#undef WRAP_HRESULT_IMPL_BOOLEAN
+
+ inline
+ HRESULT ClrCoCreateInstance(
+ REFCLSID rclsid,
+ LPUNKNOWN pUnkOuter,
+ DWORD dwClsContext,
+ REFIID riid,
+ LPVOID * ppv)
+ {
+ HRESULT hr = S_OK;
+
+ if (Util::HasNewActivationAPIs() /*&& Util::IsCLSIDHostedByClr(rclsid)*/)
+ {
+ GET_CLRINFO(pInfo);
+ IfHrFailRet(pInfo->GetInterface(rclsid, riid, ppv));
+ }
+ else
+ {
+ IfHrFailRet(::CoCreateInstance(rclsid, pUnkOuter, dwClsContext, riid, ppv));
+ }
+
+ return hr;
+ }
+}; // namespace LegacyActivationShim
+#pragma warning(pop) // Revert C4996 status
+
+#undef LEGACY_API_PASS_THROUGH_STATIC
+#undef LEGACY_API_PASS_THROUGH_STATIC_VOIDRET
+#undef LEGACY_API_PASS_THROUGH_DELAYLOAD
+#undef LEGACY_API_PASS_THROUGH_DELAYLOAD_VOIDRET
+#undef CALL_LEGACY_API
+#undef LEGACY_STRONGNAME_API_PASS_THROUGH
+#undef LEGACY_STRONGNAME_API_PASS_THROUGH_VOIDRET
+
+#undef LEGACY_ACTIVATION_SHIM_DEFAULT_PRODUCT_VER_HELPER_L
+#undef LEGACY_ACTIVATION_SHIM_DEFAULT_PRODUCT_VER_STR_L
+
+#pragma pop_macro("IfHrFailRetVOID")
+#pragma pop_macro("IfHrFailRetFALSE")
+#pragma pop_macro("IfHrFailRet")
+
+#ifdef _MANAGED
+// We are compiling Managed C++, restore previous managed/native status from the stack
+#pragma managed(pop)
+#endif //_MANAGED
+
+#pragma warning(pop)
+
+#endif // __LEGACYACTIVATIONSHIM_H__
diff --git a/src/inc/legacyactivationshimdelayload.h b/src/inc/legacyactivationshimdelayload.h
new file mode 100644
index 0000000000..8e77ff2ce3
--- /dev/null
+++ b/src/inc/legacyactivationshimdelayload.h
@@ -0,0 +1,13 @@
+// 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.
+//
+
+#ifndef __LEGACYACTIVATIONSHIMDELAYLOAD_H__
+#define __LEGACYACTIVATIONSHIMDELAYLOAD_H__
+
+#define LEGACY_ACTIVATION_SHIM_DELAY_LOAD
+#include <legacyactivationshim.h>
+#undef LEGACY_ACTIVATION_SHIM_DELAY_LOAD
+
+#endif //__LEGACYACTIVATIONSHIMDELAYLOAD_H__
diff --git a/src/inc/legacyactivationshimutil.h b/src/inc/legacyactivationshimutil.h
new file mode 100644
index 0000000000..4e6cdf0d25
--- /dev/null
+++ b/src/inc/legacyactivationshimutil.h
@@ -0,0 +1,1116 @@
+// 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.
+//
+// LegacyActivationShim.h
+//
+// This file allows simple migration from .NET Runtime v2 Host Activation APIs
+// to the .NET Runtime v4 Host Activation APIs through simple shim functions.
+
+#ifndef __LEGACYACTIVATIONSHIMUTIL_H__
+#define __LEGACYACTIVATIONSHIMUTIL_H__
+
+// To minimize how much we perturb sources that we are included in, we make sure that
+// all macros we define/redefine are restored at the end of the header.
+#pragma push_macro("SELECTANY")
+#pragma push_macro("_TEXT_ENCODE")
+#pragma push_macro("countof")
+#pragma push_macro("UNUSED")
+
+#ifndef _MSC_VER
+#error "LegacyActivationShim.h cannot be used on non-MS compilers"
+#endif
+
+// ---SELECTANY------------------------------------------------------------------------------------
+#undef SELECTANY
+#define SELECTANY extern __declspec(selectany)
+
+// Allow users of these headers to provide custom 'LoadLibrary' implementation (e.g. WszLoadLibrary).
+// Example of usage is in ndp\clr\src\fusion\tools\viewer.
+#ifndef LEGACY_ACTIVATION_SHIM_LOAD_LIBRARY
+#define LEGACY_ACTIVATION_SHIM_LOAD_LIBRARY ::LoadLibrary
+#endif
+
+// _T macro alternative to make strings ASCII/UNICODE
+#undef _TEXT_ENCODE
+#ifdef UNICODE
+#define _TEXT_ENCODE(str) L ## str
+#else //!UNICODE
+#define _TEXT_ENCODE(str) str
+#endif //!UNICODE
+
+// countof ... number of items in an array
+#ifndef countof
+#define countof(x) (sizeof(x) / sizeof(x[0]))
+#endif countof
+
+#ifndef UNUSED
+#define UNUSED(var) ((void)(var))
+#endif //UNUSED
+
+#ifndef __LEGACYACTIVATIONSHIM_H__
+ #error Error: Include LegacyActivationShim.h or LegacyActivationShimDelayLoad.h instead of directly including LegacyActivationShimUtil.h
+#endif // __LEGACYACTIVATIONSHIM_H__
+
+// ---PLACEMENT NEW--------------------------------------------------------------------------------
+#ifndef __PLACEMENT_NEW_INLINE
+#define __PLACEMENT_NEW_INLINE
+// Inline placement new
+inline void* operator new(size_t, void *_Where)
+{ // construct array with placement at _Where
+ return (_Where);
+}
+
+// delete if placement new fails
+inline void operator delete(void *, void *)
+{
+}
+#endif __PLACEMENT_NEW_INLINE
+
+// ---LEGACYACTIVATON NAMESPACE--------------------------------------------------------------------
+namespace LegacyActivationShim
+{
+ // ---UTIL NAMESPACE---------------------------------------------------------------------------
+ namespace Util
+ {
+ // ---INTERLOCKEDCOMPAREEXCHANGEPOINTERT---------------------------------------------------
+ // Variation on InterlockedCompareExchangePointer that adds some type safety.
+ // Added 'T' to end of name because an identical name to the original function
+ // confuses GCC
+ template <typename T>
+ inline
+ T InterlockedCompareExchangePointerT(
+ T volatile* destination,
+ T exchange,
+ T comparand)
+ {
+#ifdef __UtilCode_h__
+ // Utilcode has redefined InterlockedCompareExchangePointer
+ return ::InterlockedCompareExchangeT(destination, exchange, comparand);
+#else // __UtilCode_h__
+ return reinterpret_cast<T>(InterlockedCompareExchangePointer(
+ (PVOID volatile *)(destination),
+ (PVOID)(exchange),
+ (PVOID)(comparand)));
+#endif // __UtilCode_h__ else
+ }
+
+ // ---PlacementNewDeleteHelper-------------------------------------------------------------
+ template <typename TYPE, bool IS_CLASS>
+ class PlacementNewDeleteHelper;
+
+ template <typename TYPE>
+ class PlacementNewDeleteHelper<TYPE, true>
+ {
+ public:
+ // Some environments #define New and Delete, so name these functions
+ // Construct and Destruct to keep them unique.
+ static void Construct(TYPE const & value, void *pvWhere)
+ { new (pvWhere) TYPE(value); }
+
+ static void Destruct(TYPE & value)
+ { value.~TYPE(); }
+ };
+
+ template <typename TYPE>
+ class PlacementNewDeleteHelper<TYPE, false>
+ {
+ public:
+ static void Construct(TYPE const & value, void *pvWhere)
+ { *reinterpret_cast<TYPE *>(pvWhere) = value; }
+
+ static void Destruct(TYPE &)
+ { }
+ };
+
+ // ---HOLDERBASE---------------------------------------------------------------------------
+ template <typename TYPE>
+ class HolderBase
+ {
+ public:
+ // Relies on implicit default constructor, which permits zero-init static
+ // object declaration. Do not define one.
+ // HolderBase() {}
+
+ protected:
+ char m_value[sizeof(TYPE)];
+
+ inline
+ TYPE & GetRef()
+ { return *reinterpret_cast<TYPE *>(&m_value[0]); }
+
+ inline
+ TYPE & GetPtr()
+ { return reinterpret_cast<TYPE *>(&m_value[0]); }
+
+ inline
+ void Construct(TYPE const & value)
+ { PlacementNewDeleteHelper<TYPE, __is_class(TYPE)>::Construct(value, (void *)&m_value[0]); }
+
+ inline
+ void Destruct()
+ { PlacementNewDeleteHelper<TYPE, __is_class(TYPE)>::Destruct(GetRef()); }
+ };
+
+ // ---HOLDER-------------------------------------------------------------------------------
+ template <typename TYPE, void (*ASSIGNF)(TYPE &), void (*RELEASEF)(TYPE &)>
+ class Holder : public HolderBase<TYPE>
+ {
+ protected:
+ bool m_assigned;
+ bool m_suppressed;
+
+ public:
+ inline
+ Holder() : m_assigned(false), m_suppressed(false)
+ {}
+
+ inline
+ Holder(TYPE const & value) : m_assigned(false), m_suppressed(false)
+ { Assign(value); }
+
+ inline
+ ~Holder()
+ { Release(); }
+
+ inline
+ void Assign(TYPE const & value)
+ {
+ Release();
+ Construct(value);
+ m_assigned = true;
+ (*ASSIGNF)(GetValue());
+ }
+
+ inline
+ void Release()
+ {
+ if (m_assigned)
+ {
+ if (!m_suppressed)
+ {
+ (*RELEASEF)(GetValue());
+ }
+ m_assigned = false;
+ m_suppressed = false;
+ Destruct();
+ }
+ }
+
+ inline
+ void SuppressRelease()
+ {
+ m_suppressed = m_assigned;
+ }
+
+ inline
+ TYPE & GetValue()
+ {
+ // _ASSERTE(m_assigned);
+ return GetRef();
+ }
+
+ inline
+ bool IsAssigned()
+ { return m_assigned; }
+ };
+
+ // ---ZEROINITGLOBALHOLDER-----------------------------------------------------------------
+ // This class should ONLY be used for global (file scope) variables. It relies on zero
+ // initialized data in the image. This will fail miserably for other scenarios, as the
+ // memory used for the object may not be zero-initialized, which will result in incorrect
+ // behaviour.
+ template <typename TYPE, void (*ASSIGNF)(TYPE &), void (*RELEASEF)(TYPE &)>
+ class ZeroInitGlobalHolder : public HolderBase<TYPE>
+ {
+ protected:
+ bool m_assigned;
+
+ public:
+ // Relies on implicit default constructor, which permits zero-init static
+ // field declaration. Do not define an explicit constructor.
+ // ZeroInitGlobalHolder() {}
+
+ inline
+ ~ZeroInitGlobalHolder()
+ { Release(); }
+
+ inline
+ void Assign(TYPE const & value)
+ {
+ Release();
+ Construct(value);
+ m_assigned = true;
+ (*ASSIGNF)(GetValue());
+ }
+
+ inline
+ void Release()
+ {
+ if (m_assigned)
+ {
+ (*RELEASEF)(GetValue());
+ m_assigned = false;
+ Destruct();
+ }
+ }
+
+ inline
+ TYPE & GetValue()
+ {
+ // _ASSERTE(m_assigned);
+ return GetRef();
+ }
+
+ inline
+ bool IsAssigned()
+ { return m_assigned; }
+
+ inline
+ void ClearUnsafe()
+ { m_assigned = false; }
+ };
+
+ // ---DONOTHINGHELPER----------------------------------------------------------------------
+ template <typename TYPE>
+ inline
+ void DoNothingHelper(TYPE & value)
+ { UNUSED(value); }
+
+ // ---RELEASEHELPER------------------------------------------------------------------------
+ template <typename TYPE>
+ inline
+ void ReleaseHelper(TYPE & value)
+ { value->Release(); }
+
+ // ---RELEASEHOLDER------------------------------------------------------------------------
+ template <typename TYPE>
+ class ReleaseHolder
+ : public Holder< TYPE, &DoNothingHelper<TYPE>, &ReleaseHelper<TYPE> >
+ {
+ public:
+ inline
+ ReleaseHolder(TYPE & value)
+ : Holder< TYPE, &DoNothingHelper<TYPE>, &ReleaseHelper<TYPE> >(value)
+ {}
+
+ ReleaseHolder()
+ : Holder< TYPE, &DoNothingHelper<TYPE>, &ReleaseHelper<TYPE> >()
+ {}
+ };
+
+ // ---ZEROINITGLOBALRELEASEHOLDER----------------------------------------------------------
+ template <typename TYPE>
+ class ZeroInitGlobalReleaseHolder
+ : public ZeroInitGlobalHolder< TYPE, &DoNothingHelper<TYPE>, &ReleaseHelper<TYPE> >
+ {
+ };
+
+ // ---FREELIBRARYHELPER--------------------------------------------------------------------
+ inline
+ void FreeLibraryHelper(HMODULE & hMod)
+ {
+ FreeLibrary(hMod);
+ }
+
+ // ---HMODULEHOLDER------------------------------------------------------------------------
+ class HMODULEHolder
+ : public Holder< HMODULE, &DoNothingHelper<HMODULE>, &FreeLibraryHelper >
+ {
+ public:
+ inline
+ HMODULEHolder(HMODULE value)
+ : Holder< HMODULE, &DoNothingHelper<HMODULE>, &FreeLibraryHelper >(value)
+ {}
+
+ HMODULEHolder()
+ : Holder< HMODULE, &DoNothingHelper<HMODULE>, &FreeLibraryHelper >()
+ {}
+ };
+
+ // ---ZEROINITHMODULEHOLDER----------------------------------------------------------------
+ class ZeroInitGlobalHMODULEHolder
+ : public ZeroInitGlobalHolder< HMODULE, &DoNothingHelper<HMODULE>, &FreeLibraryHelper >
+ {
+ };
+
+ // ---DELAYLOADFUNCTOR---------------------------------------------------------------------
+ // T must be a function typedef.
+ // For example, "typedef int X(short i); DelayLoadFunctor<X> pfnX;"
+ template <typename T>
+ class DelayLoadFunctor
+ {
+ private:
+ HMODULEHolder m_hModHolder;
+ T * m_proc;
+
+ public:
+ HRESULT Init(LPCTSTR wzDllName, LPCSTR szProcName)
+ {
+ // Load module
+ HMODULE hMod = LEGACY_ACTIVATION_SHIM_LOAD_LIBRARY(wzDllName);
+ if (hMod == NULL)
+ return HRESULT_FROM_WIN32(::GetLastError());
+ HMODULEHolder hModHolder(hMod);
+
+ // Load proc address
+ T * proc = reinterpret_cast<T *>(::GetProcAddress(hMod, szProcName));
+ if (proc == NULL)
+ return HRESULT_FROM_WIN32(::GetLastError());
+
+ // Store results
+ hModHolder.SuppressRelease();
+ m_hModHolder.Assign(hMod);
+ m_proc = proc;
+
+ return S_OK;
+ }
+
+ HRESULT Init(HMODULE hMod, LPCSTR szProcName)
+ {
+ // Load proc address
+ T * proc = reinterpret_cast<T *>(::GetProcAddress(hMod, szProcName));
+ if (proc == NULL)
+ return HRESULT_FROM_WIN32(::GetLastError());
+
+ // Store result
+ m_proc = proc;
+
+ // Success
+ return S_OK;
+ }
+
+ T& operator()()
+ {
+ return *m_proc;
+ }
+ };
+
+ // ---ZEROINITGLOBALSPINLOCK----------------------------------------------------------------
+ class ZeroInitGlobalSpinLock
+ {
+ private:
+ enum LOCK_STATE
+ {
+ UNLOCKED = 0,
+ LOCKED = 1
+ };
+
+ LONG volatile m_lock;
+
+ static inline void Lock(ZeroInitGlobalSpinLock*& lock)
+ {
+ while (InterlockedExchange(&lock->m_lock, LOCKED) == LOCKED)
+ {
+ ::SwitchToThread();
+ }
+ }
+
+ static inline void Unlock(ZeroInitGlobalSpinLock*& lock)
+ { InterlockedExchange(&lock->m_lock, UNLOCKED); }
+
+ public:
+ typedef LegacyActivationShim::Util::Holder<ZeroInitGlobalSpinLock*,
+ &ZeroInitGlobalSpinLock::Lock,
+ &ZeroInitGlobalSpinLock::Unlock>
+ Holder;
+ };
+
+ // ---MSCOREEDATA--------------------------------------------------------------------------
+ SELECTANY HMODULE g_hModMscoree = NULL;
+ SELECTANY ZeroInitGlobalHMODULEHolder g_hModMscoreeHolder;
+
+ // ---GETMSCOREE---------------------------------------------------------------------------
+ inline
+ HRESULT GetMSCOREE(HMODULE *pMscoree)
+ {
+ if (g_hModMscoree == NULL)
+ {
+ HMODULE hModMscoree = LEGACY_ACTIVATION_SHIM_LOAD_LIBRARY(_TEXT_ENCODE("mscoree.dll"));
+ if (hModMscoree == NULL)
+ return HRESULT_FROM_WIN32(GetLastError());
+ HMODULEHolder hModMscoreeHolder(hModMscoree);
+
+ if (LegacyActivationShim::Util::InterlockedCompareExchangePointerT<HMODULE>(
+ &g_hModMscoree, hModMscoree, NULL) == NULL)
+ {
+ g_hModMscoreeHolder.ClearUnsafe();
+ g_hModMscoreeHolder.Assign(g_hModMscoree);
+ hModMscoreeHolder.SuppressRelease();
+ }
+ }
+
+ *pMscoree = g_hModMscoree;
+ return S_OK;
+ }
+
+ // ---MSCOREEFUNCTOR-----------------------------------------------------------------------
+ template <typename T>
+ class MscoreeFunctor : public DelayLoadFunctor<T>
+ {
+ public:
+ HRESULT Init(LPCSTR szProcName)
+ {
+ HRESULT hr = S_OK;
+ HMODULE hModMscoree = NULL;
+ IfHrFailRet(GetMSCOREE(&hModMscoree));
+
+ return DelayLoadFunctor<T>::Init(hModMscoree, szProcName);
+ }
+ };
+
+ // ---CALLCLRCREATEINSTANCE------------------------------------------------------------------
+ inline
+ HRESULT CallCLRCreateInstance(
+ REFCLSID clsid,
+ REFIID riid,
+ LPVOID *ppInterface)
+ {
+ HRESULT hr = S_OK;
+ HMODULE hMscoree = NULL;
+ IfHrFailRet(GetMSCOREE(&hMscoree));
+
+ typedef HRESULT (__stdcall *CLRCreateInstance_pfn) (
+ REFCLSID clsid,
+ REFIID riid,
+ LPVOID *ppInterface);
+
+ CLRCreateInstance_pfn pfnCLRCreateInstance =
+ reinterpret_cast<CLRCreateInstance_pfn>(GetProcAddress(hMscoree, "CLRCreateInstance"));
+
+ if (pfnCLRCreateInstance == NULL)
+ return HRESULT_FROM_WIN32(GetLastError());
+
+ return (*pfnCLRCreateInstance)(
+ clsid,
+ riid,
+ ppInterface);
+ }
+
+ // ---CLRMETAHOST INTERFACE DATA-----------------------------------------------------------
+ SELECTANY ICLRMetaHost* g_pCLRMetaHost = NULL;
+ SELECTANY ZeroInitGlobalReleaseHolder<ICLRMetaHost*> g_hCLRMetaHost;
+
+ // ---GETCLRMETAHOST-----------------------------------------------------------------------
+ // NOTE: Does not AddRef returned interface pointer.
+ inline
+ HRESULT GetCLRMetaHost(
+ /*out*/ ICLRMetaHost **ppCLRMetaHost)
+ {
+ HRESULT hr = S_OK;
+
+ if (g_pCLRMetaHost == NULL)
+ {
+ ICLRMetaHost *pMetaHost = NULL;
+ IfHrFailRet(CallCLRCreateInstance(CLSID_CLRMetaHost,
+ IID_ICLRMetaHost,
+ reinterpret_cast<LPVOID *>(&pMetaHost)));
+ ReleaseHolder<ICLRMetaHost*> hMetaHost(pMetaHost);
+
+ //
+ // Great - we got an ICLRMetaHost. Now publish this to
+ // g_pCLRMetaHost in a thread-safe way.
+ //
+
+ if (LegacyActivationShim::Util::InterlockedCompareExchangePointerT<ICLRMetaHost *>(
+ &g_pCLRMetaHost, pMetaHost, NULL) == NULL)
+ {
+ // Successful publish. In this case, we also assign to the
+ // holder to ensure that the interface is released when the
+ // image is unloaded.
+ g_hCLRMetaHost.ClearUnsafe();
+ g_hCLRMetaHost.Assign(g_pCLRMetaHost);
+ hMetaHost.SuppressRelease(); // Keep it AddRef'ed for the g_hCLRMetaHost
+ }
+ }
+
+ *ppCLRMetaHost = g_pCLRMetaHost;
+
+ return hr;
+ }
+
+ // ---HasNewActivationAPIs-----------------------------------------------------------------
+ SELECTANY ULONG g_fHasNewActivationAPIs = ULONG(-1);
+
+ inline
+ bool HasNewActivationAPIs()
+ {
+ if (g_fHasNewActivationAPIs == ULONG(-1))
+ {
+ ICLRMetaHost *pMetaHost = NULL;
+ HRESULT hr = GetCLRMetaHost(&pMetaHost);
+ InterlockedCompareExchange((LONG volatile *)&g_fHasNewActivationAPIs, (LONG)(SUCCEEDED(hr)), ULONG(-1));
+ }
+
+ return g_fHasNewActivationAPIs != 0;
+ }
+
+ // ---CLRMETAHOSTPOLICY INTERFACE DATA-----------------------------------------------------
+ SELECTANY ICLRMetaHostPolicy* g_pCLRMetaHostPolicy = NULL;
+ SELECTANY ZeroInitGlobalReleaseHolder<ICLRMetaHostPolicy*> g_hCLRMetaHostPolicy;
+
+ // ---GETCLRMETAHOSTPOLICY-----------------------------------------------------------------
+ // NOTE: Does not AddRef returned interface pointer.
+ inline
+ HRESULT GetCLRMetaHostPolicy(
+ /*out*/ ICLRMetaHostPolicy **ppICLRMetaHostPolicy)
+ {
+ HRESULT hr = S_OK;
+
+ if (g_pCLRMetaHostPolicy == NULL)
+ {
+ ICLRMetaHostPolicy *pMetaHostPolicy = NULL;
+ IfHrFailRet(CallCLRCreateInstance(CLSID_CLRMetaHostPolicy,
+ IID_ICLRMetaHostPolicy,
+ reinterpret_cast<LPVOID *>(&pMetaHostPolicy)));
+ ReleaseHolder<ICLRMetaHostPolicy*> hMetaHostPolicy(pMetaHostPolicy);
+
+ //
+ // Great - we got an ICLRMetaHostPolicy. Now publish this to
+ // g_pCLRMetaHostPolicy in a thread-safe way.
+ //
+
+ if (LegacyActivationShim::Util::InterlockedCompareExchangePointerT<ICLRMetaHostPolicy*>(
+ &g_pCLRMetaHostPolicy, pMetaHostPolicy, NULL) == NULL)
+ {
+ // Successful publish. In this case, we also assign to the
+ // holder to ensure that the interface is released when the
+ // image is unloaded.
+ g_hCLRMetaHostPolicy.ClearUnsafe();
+ g_hCLRMetaHostPolicy.Assign(g_pCLRMetaHostPolicy);
+ hMetaHostPolicy.SuppressRelease();
+ }
+ }
+
+ *ppICLRMetaHostPolicy = g_pCLRMetaHostPolicy;
+
+ return hr;
+ }
+
+ // ---RUNTIMEINFO DATA---------------------------------------------------------------------
+ struct RuntimeInfo
+ {
+ ICLRRuntimeInfo *m_pRuntimeInfo;
+
+ DWORD m_cchImageVersion;
+ WCHAR m_wszImageVersion[512];
+
+ inline
+ void Init()
+ {
+ m_pRuntimeInfo = NULL;
+ m_cchImageVersion = countof(m_wszImageVersion);
+ m_wszImageVersion[0] = L'\0';
+ }
+
+ inline
+ void Release()
+ {
+ if (m_pRuntimeInfo != NULL)
+ {
+ m_pRuntimeInfo->Release();
+ m_pRuntimeInfo = NULL;
+ }
+ }
+ };
+
+ SELECTANY LONG g_runtimeInfoIsInitialized = FALSE;
+ SELECTANY RuntimeInfo g_runtimeInfo;
+ SELECTANY ZeroInitGlobalSpinLock g_runtimeInfoLock;
+ SELECTANY ZeroInitGlobalReleaseHolder<RuntimeInfo*> g_hRuntimeInfo;
+
+ // ---GETCLRRUNTIMEINFOHELPER--------------------------------------------------------------
+ // Logic:
+ // 1. Try to bind using ICLRMetaHostPolicy::GetRequestedRuntime and incoming arguments.
+ // 2. Try to bind using ICLRMetaHostPolicy::GetRequestedRuntime and "v4.0.0" and
+ // upgrade policy.
+ // 3. Try to bind to latest using GetRequestedRuntimeInfo.
+
+ inline
+ HRESULT GetCLRRuntimeInfoHelper(
+ /*out*/ ICLRRuntimeInfo **ppCLRRuntimeInfo,
+ LPCWSTR pEXE = NULL,
+ IStream *pIStream = NULL,
+ __inout_ecount_opt(*pcchVersion) LPWSTR wszVersion = NULL,
+ DWORD *pcchVersion = NULL,
+ __out_ecount_opt(*pcchImageVersion) LPWSTR wszImageVersion = NULL,
+ DWORD *pcchImageVersion = NULL)
+ {
+ HRESULT hr = S_OK;
+
+ //
+ // 1. Try policy-based binding first, which will incorporate config files and such.
+ //
+
+ ICLRMetaHostPolicy *pMetaHostPolicy = NULL;
+ IfHrFailRet(GetCLRMetaHostPolicy(&pMetaHostPolicy));
+
+ DWORD dwConfigFlags = 0;
+
+ hr = pMetaHostPolicy->GetRequestedRuntime(
+ METAHOST_POLICY_USE_PROCESS_IMAGE_PATH,
+ pEXE,
+ pIStream,
+ wszVersion,
+ pcchVersion,
+ wszImageVersion,
+ pcchImageVersion,
+ &dwConfigFlags,
+ IID_ICLRRuntimeInfo,
+ reinterpret_cast<LPVOID *>(ppCLRRuntimeInfo));
+
+ if (hr != S_OK &&
+ pEXE == NULL &&
+ pIStream == NULL &&
+ wszVersion == NULL)
+ { //
+ // 2. Try to bind using ICLRMetaHostPolicy::GetRequestedRuntime and "v4.0.0" and upgrade policy.
+ //
+
+ WCHAR _wszVersion[256]; // We can't use new in this header, so just pick an obscenely long version string length of 256
+ DWORD _cchVersion = countof(_wszVersion);
+ wcscpy_s(_wszVersion, _cchVersion, L"v4.0.0");
+ hr = pMetaHostPolicy->GetRequestedRuntime(
+ static_cast<METAHOST_POLICY_FLAGS>(METAHOST_POLICY_USE_PROCESS_IMAGE_PATH |
+ METAHOST_POLICY_APPLY_UPGRADE_POLICY),
+ pEXE,
+ pIStream, // (is NULL)
+ _wszVersion,
+ &_cchVersion,
+ wszImageVersion,
+ pcchImageVersion,
+ &dwConfigFlags,
+ IID_ICLRRuntimeInfo,
+ reinterpret_cast<LPVOID *>(ppCLRRuntimeInfo));
+ }
+
+ if (hr != S_OK &&
+ pEXE == NULL &&
+ pIStream == NULL &&
+ wszVersion == NULL)
+ { //
+ // 3. Try to bind using GetRequestedRuntimeInfo(NULL)
+ //
+
+ typedef HRESULT __stdcall GetRequestedRuntimeInfo_t(
+ LPCWSTR pExe,
+ LPCWSTR pwszVersion,
+ LPCWSTR pConfigurationFile,
+ DWORD startupFlags,
+ DWORD runtimeInfoFlags,
+ LPWSTR pDirectory,
+ DWORD dwDirectory,
+ DWORD *dwDirectoryLength,
+ LPWSTR pVersion,
+ DWORD cchBuffer,
+ DWORD* dwlength);
+
+ HMODULE hMscoree = NULL;
+ IfHrFailRet(GetMSCOREE(&hMscoree));
+
+ // We're using GetRequestedRuntimeInfo here because it is the only remaining API
+ // that will not be Whidbey-capped and will allow "bind to latest" semantics. This
+ // is cheating a bit, but should work for now. The alternative is to use
+ // ICLRMetaHost::EnumerateRuntimes to achieve the same result.
+ DelayLoadFunctor<GetRequestedRuntimeInfo_t> GetRequestedRuntimeInfoFN;
+ IfHrFailRet(GetRequestedRuntimeInfoFN.Init(hMscoree, "GetRequestedRuntimeInfo"));
+
+ WCHAR szDir_[_MAX_PATH];
+ DWORD cchDir_ = countof(szDir_);
+ WCHAR szVersion_[_MAX_PATH];
+ DWORD cchVersion_ = countof(szVersion_);
+ DWORD dwInfoFlags_ = RUNTIME_INFO_UPGRADE_VERSION
+ | RUNTIME_INFO_DONT_SHOW_ERROR_DIALOG;
+
+ IfHrFailRet(GetRequestedRuntimeInfoFN()(
+ NULL,
+ NULL,
+ NULL,
+ 0,
+ dwInfoFlags_,
+ szDir_,
+ cchDir_,
+ &cchDir_,
+ szVersion_,
+ cchVersion_,
+ &cchVersion_));
+
+ // Unable to get a version to try to load.
+ if (hr != S_OK)
+ {
+ return CLR_E_SHIM_RUNTIMELOAD;
+ }
+
+ ICLRMetaHost *pMetaHost = NULL;
+ IfHrFailRet(GetCLRMetaHost(&pMetaHost));
+
+ hr = pMetaHost->GetRuntime(szVersion_,
+ IID_ICLRRuntimeInfo,
+ reinterpret_cast<LPVOID *>(ppCLRRuntimeInfo));
+
+ if (hr != S_OK)
+ {
+ return CLR_E_SHIM_RUNTIMELOAD;
+ }
+
+ if (wszImageVersion != NULL)
+ {
+ wcsncpy_s(wszImageVersion, *pcchImageVersion, szVersion_, cchVersion_);
+ *pcchImageVersion = cchVersion_;
+ }
+ }
+
+ if (hr == S_OK &&
+ (dwConfigFlags & METAHOST_CONFIG_FLAGS_LEGACY_V2_ACTIVATION_POLICY_MASK) ==
+ METAHOST_CONFIG_FLAGS_LEGACY_V2_ACTIVATION_POLICY_TRUE)
+ { // If the config requested that the runtime be bound as the legacy runtime.
+ IfHrFailRet((*ppCLRRuntimeInfo)->BindAsLegacyV2Runtime());
+ }
+
+ return hr;
+ }
+
+ // ---GETRUNTIMEINFO-----------------------------------------------------------------------
+ inline
+ HRESULT GetRuntimeInfo(
+ /*out*/ RuntimeInfo **ppRuntimeInfo,
+ LPCWSTR pEXE = NULL,
+ IStream *pIStream = NULL,
+ __inout_ecount_opt(*pcchVersion) LPWSTR wszVersion = NULL,
+ DWORD *pcchVersion = NULL)
+ {
+ HRESULT hr = S_OK;
+
+ if (!g_runtimeInfoIsInitialized)
+ {
+ ZeroInitGlobalSpinLock::Holder lock(&g_runtimeInfoLock);
+ if (!g_runtimeInfoIsInitialized)
+ {
+ g_runtimeInfo.Init();
+
+ IfHrFailRet(GetCLRRuntimeInfoHelper(
+ &g_runtimeInfo.m_pRuntimeInfo,
+ pEXE,
+ pIStream,
+ wszVersion,
+ pcchVersion,
+ g_runtimeInfo.m_wszImageVersion,
+ &g_runtimeInfo.m_cchImageVersion));
+
+ //
+ // Initialized - now publish.
+ //
+
+ g_hRuntimeInfo.ClearUnsafe();
+ g_hRuntimeInfo.Assign(&g_runtimeInfo);
+ InterlockedExchange(&g_runtimeInfoIsInitialized, TRUE);
+ }
+ }
+
+ //
+ // Return the struct
+ //
+
+ *ppRuntimeInfo = &g_runtimeInfo;
+ return hr;
+ }
+
+ // --------BINDTOV4------------------------------------------------------------------------
+ // Used by hosted DLLs that require the use of v4 for all their
+ // LegacyActivationShim calls. Can (and should) be called from DllMain,
+ // provided the DLL has a static (non-delayload) dependency on mscoree.dll.
+ inline
+ HRESULT BindToV4()
+ {
+ HRESULT hr = E_FAIL;
+
+ if (!g_runtimeInfoIsInitialized)
+ {
+ ZeroInitGlobalSpinLock::Holder lock(&g_runtimeInfoLock);
+ if (!g_runtimeInfoIsInitialized)
+ {
+ ICLRMetaHostPolicy *pMetaHostPolicy = NULL;
+ IfHrFailRet(GetCLRMetaHostPolicy(&pMetaHostPolicy));
+
+ g_runtimeInfo.Init();
+
+ //
+ // Try to bind using ICLRMetaHostPolicy::GetRequestedRuntime and "v4.0.0" and upgrade policy.
+ //
+
+ WCHAR _wszVersion[256]; // We can't use new in this header, so just pick an obscenely long version string length of 256
+ DWORD _cchVersion = countof(_wszVersion);
+ wcscpy_s(_wszVersion, _cchVersion, L"v4.0.0");
+
+ IfHrFailRet(pMetaHostPolicy->GetRequestedRuntime(
+ METAHOST_POLICY_APPLY_UPGRADE_POLICY,
+ NULL, // image path
+ NULL, // config stream
+ _wszVersion,
+ &_cchVersion,
+ g_runtimeInfo.m_wszImageVersion,
+ &g_runtimeInfo.m_cchImageVersion,
+ NULL, // config flags
+ IID_ICLRRuntimeInfo,
+ reinterpret_cast<LPVOID *>(&g_runtimeInfo.m_pRuntimeInfo)));
+
+ //
+ // Initialized - now publish.
+ //
+
+ g_hRuntimeInfo.ClearUnsafe();
+ g_hRuntimeInfo.Assign(&g_runtimeInfo);
+ InterlockedExchange(&g_runtimeInfoIsInitialized, TRUE);
+
+ hr = S_OK;
+ }
+ }
+
+ return hr;
+ }
+
+ // ---GETCLRRUNTIMEINFO--------------------------------------------------------------------
+ inline
+ HRESULT GetCLRRuntimeInfo(
+ /*out*/ ICLRRuntimeInfo **ppCLRRuntimeInfo,
+ LPCWSTR pEXE = NULL,
+ IStream *pIStream = NULL,
+ __inout_ecount_opt(*pcchVersion) LPWSTR wszVersion = NULL,
+ DWORD *pcchVersion = NULL)
+ {
+ HRESULT hr = S_OK;
+
+ RuntimeInfo *pRuntimeInfo = NULL;
+ IfHrFailRet(GetRuntimeInfo(&pRuntimeInfo, pEXE, pIStream, wszVersion, pcchVersion));
+
+ *ppCLRRuntimeInfo = pRuntimeInfo->m_pRuntimeInfo;
+ return hr;
+ }
+
+ // ---GetConfigImageVersion----------------------------------------------------------------
+ inline
+ HRESULT GetConfigImageVersion(
+ __out_ecount(*pcchBuffer) LPWSTR wzBuffer,
+ DWORD *pcchBuffer)
+ {
+ HRESULT hr = S_OK;
+
+ RuntimeInfo *pRuntimeInfo = NULL;
+ IfHrFailRet(GetRuntimeInfo(&pRuntimeInfo));
+
+ DWORD cchBuffer = *pcchBuffer;
+ *pcchBuffer = pRuntimeInfo->m_cchImageVersion;
+
+ if (cchBuffer <= pRuntimeInfo->m_cchImageVersion)
+ {
+ wcsncpy_s(
+ wzBuffer,
+ cchBuffer,
+ pRuntimeInfo->m_wszImageVersion,
+ pRuntimeInfo->m_cchImageVersion);
+ }
+ else
+ {
+ IfHrFailRet(HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER));
+ }
+
+ return hr;
+ }
+
+ // ---ICLRSTRONGNAME INTERFACE DATA--------------------------------------------------------
+ SELECTANY ICLRStrongName* g_pCLRStrongName = NULL;
+ SELECTANY ZeroInitGlobalReleaseHolder<ICLRStrongName*> g_hCLRStrongName;
+
+ // ---GETCLRSTRONGNAME---------------------------------------------------------------------
+ // NOTE: Does not AddRef returned interface pointer.
+ inline
+ HRESULT GetCLRStrongName(
+ /*out*/ ICLRStrongName **ppCLRStrongName)
+ {
+ HRESULT hr = S_OK;
+
+ if (g_pCLRStrongName == NULL)
+ {
+ ICLRRuntimeInfo *pInfo = NULL;
+ IfHrFailRet(GetCLRRuntimeInfo(&pInfo));
+
+ ICLRStrongName *pStrongName;
+
+ IfHrFailRet(pInfo->GetInterface(
+ CLSID_CLRStrongName,
+ IID_ICLRStrongName,
+ reinterpret_cast<LPVOID *>(&pStrongName)));
+
+ //
+ // Great - we got an ICLRStrongName. Now publish this to
+ // g_pCLRStrongName in a thread-safe way.
+ //
+
+ if (LegacyActivationShim::Util::InterlockedCompareExchangePointerT<ICLRStrongName *>(
+ &g_pCLRStrongName, pStrongName, NULL) == NULL)
+ {
+ // Successful publish. In this case, we also assign to the
+ // holder to ensure that the interface is released when the
+ // image is unloaded.
+ g_hCLRStrongName.ClearUnsafe();
+ g_hCLRStrongName.Assign(g_pCLRStrongName);
+ }
+ else
+ {
+ // We were beat to the punch, don't publish this interface
+ // and make sure we use the published value for consistency.
+ pStrongName->Release();
+ }
+ }
+
+ *ppCLRStrongName = g_pCLRStrongName;
+ return hr;
+ }
+
+ // ---ICLRSTRONGNAME2 INTERFACE DATA--------------------------------------------------------
+ SELECTANY ICLRStrongName2* g_pCLRStrongName2 = NULL;
+ SELECTANY ZeroInitGlobalReleaseHolder<ICLRStrongName2*> g_hCLRStrongName2;
+
+ // ---GETCLRSTRONGNAME2---------------------------------------------------------------------
+ // NOTE: Does not AddRef returned interface pointer.
+ inline
+ HRESULT GetCLRStrongName2(
+ /*out*/ ICLRStrongName2 **ppCLRStrongName2)
+ {
+ HRESULT hr = S_OK;
+
+ if (g_pCLRStrongName2 == NULL)
+ {
+ ICLRRuntimeInfo *pInfo = NULL;
+ IfHrFailRet(GetCLRRuntimeInfo(&pInfo));
+
+ ICLRStrongName2 *pStrongName;
+
+ IfHrFailRet(pInfo->GetInterface(
+ CLSID_CLRStrongName,
+ IID_ICLRStrongName2,
+ reinterpret_cast<LPVOID *>(&pStrongName)));
+
+ //
+ // Great - we got an ICLRStrongName2. Now publish this to
+ // g_pCLRStrongName2 in a thread-safe way.
+ //
+
+ if (LegacyActivationShim::Util::InterlockedCompareExchangePointerT<ICLRStrongName2 *>(
+ &g_pCLRStrongName2, pStrongName, NULL) == NULL)
+ {
+ // Successful publish. In this case, we also assign to the
+ // holder to ensure that the interface is released when the
+ // image is unloaded.
+ g_hCLRStrongName2.ClearUnsafe();
+ g_hCLRStrongName2.Assign(g_pCLRStrongName2);
+ }
+ else
+ {
+ // We were beat to the punch, don't publish this interface
+ // and make sure we use the published value for consistency.
+ pStrongName->Release();
+ }
+ }
+
+ *ppCLRStrongName2 = g_pCLRStrongName2;
+ return hr;
+ }
+
+ // ---AddStartupFlags------------------------------------------------------------------------------
+ inline
+ HRESULT AddStartupFlags(
+ ICLRRuntimeInfo *pInfo,
+ LPCWSTR wszBuildFlavor,
+ DWORD dwStartupFlags,
+ LPCWSTR wszHostConfigFile)
+ {
+ if (wszBuildFlavor != NULL &&
+ (wszBuildFlavor[0] == L's' || wszBuildFlavor[0] == L'S') &&
+ (wszBuildFlavor[1] == L'v' || wszBuildFlavor[1] == L'V') &&
+ (wszBuildFlavor[2] == L'r' || wszBuildFlavor[2] == L'R') &&
+ wszBuildFlavor[3] == 0)
+ {
+ dwStartupFlags |= STARTUP_SERVER_GC;
+ }
+
+ HRESULT hr = S_OK;
+
+ DWORD dwEffectiveStartupFlags = 0;
+ IfHrFailRet(pInfo->GetDefaultStartupFlags(&dwEffectiveStartupFlags, NULL, NULL));
+
+ // Startup flags at this point are either default (i.e. STARTUP_CONCURRENT_GC)
+ // or have been set based on a config file. We want to clear the concurrent
+ // GC flag because we are supplying non-defaults, and combine them with the
+ // user supplied flags. Note that STARTUP_CONCURRENT_GC is never set as part
+ // of reading a config so we are not losing any information here.
+
+ dwEffectiveStartupFlags &= ~STARTUP_CONCURRENT_GC;
+ dwEffectiveStartupFlags |= dwStartupFlags;
+
+ return pInfo->SetDefaultStartupFlags(dwEffectiveStartupFlags, wszHostConfigFile);
+ }
+
+ // ------------------------------------------------------------------------------------------------
+ SELECTANY HMODULE g_hShlwapi = NULL;
+ SELECTANY ZeroInitGlobalHMODULEHolder g_hShlwapiHolder;
+
+ // ------------------------------------------------------------------------------------------------
+ inline
+ HRESULT CreateIStreamFromFile(
+ LPCWSTR wszFilePath,
+ IStream **ppIStream)
+ {
+ HRESULT hr = S_OK;
+ *ppIStream = NULL;
+
+ if (g_hShlwapi == NULL)
+ {
+ HMODULE hShlwapi = LEGACY_ACTIVATION_SHIM_LOAD_LIBRARY(_TEXT_ENCODE("shlwapi.dll"));
+ if (hShlwapi == NULL)
+ return HRESULT_FROM_WIN32(GetLastError());
+ HMODULEHolder hShlwapiHolder(hShlwapi);
+
+ if (LegacyActivationShim::Util::InterlockedCompareExchangePointerT<HMODULE>(
+ &g_hShlwapi, hShlwapi, NULL) == NULL)
+ {
+ g_hShlwapiHolder.ClearUnsafe();
+ g_hShlwapiHolder.Assign(hShlwapi);
+ hShlwapiHolder.SuppressRelease();
+ }
+ }
+
+ typedef HRESULT (__stdcall * SHCreateStreamOnFile_pfn)(
+ LPCWSTR wszFile,
+ DWORD grfMode,
+ IStream **ppstm);
+
+ SHCreateStreamOnFile_pfn pCreateStreamOnFile =
+ reinterpret_cast<SHCreateStreamOnFile_pfn>(GetProcAddress(g_hShlwapi, "SHCreateStreamOnFileW"));
+
+ if (pCreateStreamOnFile == NULL)
+ return HRESULT_FROM_WIN32(GetLastError());
+
+ //_ASSERTE(pCreateStreamOnFile != NULL);
+
+ // Create IStream
+ IStream* pStream(NULL);
+ IfHrFailRet((*pCreateStreamOnFile)(wszFilePath, 0 /*STGM_READ*/, &pStream));
+ ReleaseHolder<IStream*> hStream(pStream);
+
+ // Success, prevent release and assign IStream to out parameter
+ *ppIStream = pStream;
+ hStream.SuppressRelease();
+
+ return S_OK;
+ }
+ }; // namespace Util
+}; // namespace LegacyActivationShim
+
+#pragma pop_macro("UNUSED")
+#pragma pop_macro("countof")
+#pragma pop_macro("_TEXT_ENCODE")
+#pragma pop_macro("SELECTANY")
+
+#endif // __LEGACYACTIVATIONSHIMUTIL_H__
+
diff --git a/src/inc/livedatatarget.h b/src/inc/livedatatarget.h
new file mode 100644
index 0000000000..7282dd4be1
--- /dev/null
+++ b/src/inc/livedatatarget.h
@@ -0,0 +1,105 @@
+// 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.
+//*****************************************************************************
+//
+// Define a Data-Target for a live process.
+//
+//*****************************************************************************
+
+#ifndef _LIVEPROC_DATATARGET_H_
+#define _LIVEPROC_DATATARGET_H_
+
+// Defines the Data-Target and other public interfaces.
+// Does not include IXClrData definitions.
+#include <clrdata.h>
+
+
+//---------------------------------------------------------------------------------------
+//
+// Provides a simple legacy data-target implementation for a live, local, process.
+// Note that in arrowhead, most debuggers use ICorDebugDataTarget, and we have
+// implementations of this in MDbg.
+//
+class LiveProcDataTarget : public ICLRDataTarget
+{
+public:
+ LiveProcDataTarget(HANDLE process,
+ DWORD processId,
+ CLRDATA_ADDRESS baseAddressOfEngine = NULL);
+
+ //
+ // IUnknown.
+ //
+ // This class is intended to be kept on the stack
+ // or as a member and does not maintain a refcount.
+ //
+
+ STDMETHOD(QueryInterface)(
+ THIS_
+ IN REFIID InterfaceId,
+ OUT PVOID* Interface
+ );
+ STDMETHOD_(ULONG, AddRef)(
+ THIS
+ );
+ STDMETHOD_(ULONG, Release)(
+ THIS
+ );
+
+ //
+ // ICLRDataTarget.
+ //
+
+ virtual HRESULT STDMETHODCALLTYPE GetMachineType(
+ /* [out] */ ULONG32 *machine);
+ virtual HRESULT STDMETHODCALLTYPE GetPointerSize(
+ /* [out] */ ULONG32 *size);
+ virtual HRESULT STDMETHODCALLTYPE GetImageBase(
+ /* [string][in] */ LPCWSTR name,
+ /* [out] */ CLRDATA_ADDRESS *base);
+ virtual HRESULT STDMETHODCALLTYPE ReadVirtual(
+ /* [in] */ CLRDATA_ADDRESS address,
+ /* [length_is][size_is][out] */ PBYTE buffer,
+ /* [in] */ ULONG32 request,
+ /* [optional][out] */ ULONG32 *done);
+ virtual HRESULT STDMETHODCALLTYPE WriteVirtual(
+ /* [in] */ CLRDATA_ADDRESS address,
+ /* [size_is][in] */ PBYTE buffer,
+ /* [in] */ ULONG32 request,
+ /* [optional][out] */ ULONG32 *done);
+ virtual HRESULT STDMETHODCALLTYPE GetTLSValue(
+ /* [in] */ ULONG32 threadID,
+ /* [in] */ ULONG32 index,
+ /* [out] */ CLRDATA_ADDRESS* value);
+ virtual HRESULT STDMETHODCALLTYPE SetTLSValue(
+ /* [in] */ ULONG32 threadID,
+ /* [in] */ ULONG32 index,
+ /* [in] */ CLRDATA_ADDRESS value);
+ virtual HRESULT STDMETHODCALLTYPE GetCurrentThreadID(
+ /* [out] */ ULONG32* threadID);
+ virtual HRESULT STDMETHODCALLTYPE GetThreadContext(
+ /* [in] */ ULONG32 threadID,
+ /* [in] */ ULONG32 contextFlags,
+ /* [in] */ ULONG32 contextSize,
+ /* [out, size_is(contextSize)] */ PBYTE context);
+ virtual HRESULT STDMETHODCALLTYPE SetThreadContext(
+ /* [in] */ ULONG32 threadID,
+ /* [in] */ ULONG32 contextSize,
+ /* [in, size_is(contextSize)] */ PBYTE context);
+ virtual HRESULT STDMETHODCALLTYPE Request(
+ /* [in] */ ULONG32 reqCode,
+ /* [in] */ ULONG32 inBufferSize,
+ /* [size_is][in] */ BYTE *inBuffer,
+ /* [in] */ ULONG32 outBufferSize,
+ /* [size_is][out] */ BYTE *outBuffer);
+
+private:
+ HANDLE m_process;
+ DWORD m_processId;
+ CLRDATA_ADDRESS m_baseAddressOfEngine;
+};
+
+
+#endif // _LIVEPROC_DATATARGET_H_
+
diff --git a/src/inc/llvm/Dwarf.def b/src/inc/llvm/Dwarf.def
new file mode 100644
index 0000000000..2bc9ef8621
--- /dev/null
+++ b/src/inc/llvm/Dwarf.def
@@ -0,0 +1,393 @@
+// 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.
+
+// ==============================================================================
+// LLVM Release License
+// ==============================================================================
+// University of Illinois/NCSA
+// Open Source License
+//
+// Copyright (c) 2003-2015 University of Illinois at Urbana-Champaign.
+// All rights reserved.
+//
+// Developed by:
+//
+// LLVM Team
+//
+// University of Illinois at Urbana-Champaign
+//
+// http://llvm.org
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy of
+// this software and associated documentation files (the "Software"), to deal with
+// the Software without restriction, including without limitation the rights to
+// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+// of the Software, and to permit persons to whom the Software is furnished to do
+// so, subject to the following conditions:
+//
+// * Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimers.
+//
+// * Redistributions in binary form must reproduce the above copyright notice,
+// this list of conditions and the following disclaimers in the
+// documentation and/or other materials provided with the distribution.
+//
+// * Neither the names of the LLVM Team, University of Illinois at
+// Urbana-Champaign, nor the names of its contributors may be used to
+// endorse or promote products derived from this Software without specific
+// prior written permission.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
+// SOFTWARE.
+
+//===----------------------------------------------------------------------===//
+//
+// Macros for running through Dwarf enumerators.
+//
+//===----------------------------------------------------------------------===//
+
+// TODO: Add other DW-based macros.
+#if !(defined HANDLE_DW_TAG || defined HANDLE_DW_OP || \
+ defined HANDLE_DW_LANG || defined HANDLE_DW_ATE || \
+ defined HANDLE_DW_VIRTUALITY)
+#error "Missing macro definition of HANDLE_DW*"
+#endif
+
+#ifndef HANDLE_DW_TAG
+#define HANDLE_DW_TAG(ID, NAME)
+#endif
+
+#ifndef HANDLE_DW_OP
+#define HANDLE_DW_OP(ID, NAME)
+#endif
+
+#ifndef HANDLE_DW_LANG
+#define HANDLE_DW_LANG(ID, NAME)
+#endif
+
+#ifndef HANDLE_DW_ATE
+#define HANDLE_DW_ATE(ID, NAME)
+#endif
+
+#ifndef HANDLE_DW_VIRTUALITY
+#define HANDLE_DW_VIRTUALITY(ID, NAME)
+#endif
+
+HANDLE_DW_TAG(0x0001, array_type)
+HANDLE_DW_TAG(0x0002, class_type)
+HANDLE_DW_TAG(0x0003, entry_point)
+HANDLE_DW_TAG(0x0004, enumeration_type)
+HANDLE_DW_TAG(0x0005, formal_parameter)
+HANDLE_DW_TAG(0x0008, imported_declaration)
+HANDLE_DW_TAG(0x000a, label)
+HANDLE_DW_TAG(0x000b, lexical_block)
+HANDLE_DW_TAG(0x000d, member)
+HANDLE_DW_TAG(0x000f, pointer_type)
+HANDLE_DW_TAG(0x0010, reference_type)
+HANDLE_DW_TAG(0x0011, compile_unit)
+HANDLE_DW_TAG(0x0012, string_type)
+HANDLE_DW_TAG(0x0013, structure_type)
+HANDLE_DW_TAG(0x0015, subroutine_type)
+HANDLE_DW_TAG(0x0016, typedef)
+HANDLE_DW_TAG(0x0017, union_type)
+HANDLE_DW_TAG(0x0018, unspecified_parameters)
+HANDLE_DW_TAG(0x0019, variant)
+HANDLE_DW_TAG(0x001a, common_block)
+HANDLE_DW_TAG(0x001b, common_inclusion)
+HANDLE_DW_TAG(0x001c, inheritance)
+HANDLE_DW_TAG(0x001d, inlined_subroutine)
+HANDLE_DW_TAG(0x001e, module)
+HANDLE_DW_TAG(0x001f, ptr_to_member_type)
+HANDLE_DW_TAG(0x0020, set_type)
+HANDLE_DW_TAG(0x0021, subrange_type)
+HANDLE_DW_TAG(0x0022, with_stmt)
+HANDLE_DW_TAG(0x0023, access_declaration)
+HANDLE_DW_TAG(0x0024, base_type)
+HANDLE_DW_TAG(0x0025, catch_block)
+HANDLE_DW_TAG(0x0026, const_type)
+HANDLE_DW_TAG(0x0027, constant)
+HANDLE_DW_TAG(0x0028, enumerator)
+HANDLE_DW_TAG(0x0029, file_type)
+HANDLE_DW_TAG(0x002a, friend)
+HANDLE_DW_TAG(0x002b, namelist)
+HANDLE_DW_TAG(0x002c, namelist_item)
+HANDLE_DW_TAG(0x002d, packed_type)
+HANDLE_DW_TAG(0x002e, subprogram)
+HANDLE_DW_TAG(0x002f, template_type_parameter)
+HANDLE_DW_TAG(0x0030, template_value_parameter)
+HANDLE_DW_TAG(0x0031, thrown_type)
+HANDLE_DW_TAG(0x0032, try_block)
+HANDLE_DW_TAG(0x0033, variant_part)
+HANDLE_DW_TAG(0x0034, variable)
+HANDLE_DW_TAG(0x0035, volatile_type)
+HANDLE_DW_TAG(0x0036, dwarf_procedure)
+HANDLE_DW_TAG(0x0037, restrict_type)
+HANDLE_DW_TAG(0x0038, interface_type)
+HANDLE_DW_TAG(0x0039, namespace)
+HANDLE_DW_TAG(0x003a, imported_module)
+HANDLE_DW_TAG(0x003b, unspecified_type)
+HANDLE_DW_TAG(0x003c, partial_unit)
+HANDLE_DW_TAG(0x003d, imported_unit)
+HANDLE_DW_TAG(0x003f, condition)
+HANDLE_DW_TAG(0x0040, shared_type)
+HANDLE_DW_TAG(0x0041, type_unit)
+HANDLE_DW_TAG(0x0042, rvalue_reference_type)
+HANDLE_DW_TAG(0x0043, template_alias)
+
+// New in DWARF v5.
+HANDLE_DW_TAG(0x0044, coarray_type)
+HANDLE_DW_TAG(0x0045, generic_subrange)
+HANDLE_DW_TAG(0x0046, dynamic_type)
+
+// User-defined tags.
+HANDLE_DW_TAG(0x4081, MIPS_loop)
+HANDLE_DW_TAG(0x4101, format_label)
+HANDLE_DW_TAG(0x4102, function_template)
+HANDLE_DW_TAG(0x4103, class_template)
+HANDLE_DW_TAG(0x4106, GNU_template_template_param)
+HANDLE_DW_TAG(0x4107, GNU_template_parameter_pack)
+HANDLE_DW_TAG(0x4108, GNU_formal_parameter_pack)
+HANDLE_DW_TAG(0x4200, APPLE_property)
+HANDLE_DW_TAG(0xb000, BORLAND_property)
+HANDLE_DW_TAG(0xb001, BORLAND_Delphi_string)
+HANDLE_DW_TAG(0xb002, BORLAND_Delphi_dynamic_array)
+HANDLE_DW_TAG(0xb003, BORLAND_Delphi_set)
+HANDLE_DW_TAG(0xb004, BORLAND_Delphi_variant)
+
+HANDLE_DW_OP(0x03, addr)
+HANDLE_DW_OP(0x06, deref)
+HANDLE_DW_OP(0x08, const1u)
+HANDLE_DW_OP(0x09, const1s)
+HANDLE_DW_OP(0x0a, const2u)
+HANDLE_DW_OP(0x0b, const2s)
+HANDLE_DW_OP(0x0c, const4u)
+HANDLE_DW_OP(0x0d, const4s)
+HANDLE_DW_OP(0x0e, const8u)
+HANDLE_DW_OP(0x0f, const8s)
+HANDLE_DW_OP(0x10, constu)
+HANDLE_DW_OP(0x11, consts)
+HANDLE_DW_OP(0x12, dup)
+HANDLE_DW_OP(0x13, drop)
+HANDLE_DW_OP(0x14, over)
+HANDLE_DW_OP(0x15, pick)
+HANDLE_DW_OP(0x16, swap)
+HANDLE_DW_OP(0x17, rot)
+HANDLE_DW_OP(0x18, xderef)
+HANDLE_DW_OP(0x19, abs)
+HANDLE_DW_OP(0x1a, and)
+HANDLE_DW_OP(0x1b, div)
+HANDLE_DW_OP(0x1c, minus)
+HANDLE_DW_OP(0x1d, mod)
+HANDLE_DW_OP(0x1e, mul)
+HANDLE_DW_OP(0x1f, neg)
+HANDLE_DW_OP(0x20, not)
+HANDLE_DW_OP(0x21, or )
+HANDLE_DW_OP(0x22, plus)
+HANDLE_DW_OP(0x23, plus_uconst)
+HANDLE_DW_OP(0x24, shl)
+HANDLE_DW_OP(0x25, shr)
+HANDLE_DW_OP(0x26, shra)
+HANDLE_DW_OP(0x27, xor)
+HANDLE_DW_OP(0x2f, skip)
+HANDLE_DW_OP(0x28, bra)
+HANDLE_DW_OP(0x29, eq)
+HANDLE_DW_OP(0x2a, ge)
+HANDLE_DW_OP(0x2b, gt)
+HANDLE_DW_OP(0x2c, le)
+HANDLE_DW_OP(0x2d, lt)
+HANDLE_DW_OP(0x2e, ne)
+HANDLE_DW_OP(0x30, lit0)
+HANDLE_DW_OP(0x31, lit1)
+HANDLE_DW_OP(0x32, lit2)
+HANDLE_DW_OP(0x33, lit3)
+HANDLE_DW_OP(0x34, lit4)
+HANDLE_DW_OP(0x35, lit5)
+HANDLE_DW_OP(0x36, lit6)
+HANDLE_DW_OP(0x37, lit7)
+HANDLE_DW_OP(0x38, lit8)
+HANDLE_DW_OP(0x39, lit9)
+HANDLE_DW_OP(0x3a, lit10)
+HANDLE_DW_OP(0x3b, lit11)
+HANDLE_DW_OP(0x3c, lit12)
+HANDLE_DW_OP(0x3d, lit13)
+HANDLE_DW_OP(0x3e, lit14)
+HANDLE_DW_OP(0x3f, lit15)
+HANDLE_DW_OP(0x40, lit16)
+HANDLE_DW_OP(0x41, lit17)
+HANDLE_DW_OP(0x42, lit18)
+HANDLE_DW_OP(0x43, lit19)
+HANDLE_DW_OP(0x44, lit20)
+HANDLE_DW_OP(0x45, lit21)
+HANDLE_DW_OP(0x46, lit22)
+HANDLE_DW_OP(0x47, lit23)
+HANDLE_DW_OP(0x48, lit24)
+HANDLE_DW_OP(0x49, lit25)
+HANDLE_DW_OP(0x4a, lit26)
+HANDLE_DW_OP(0x4b, lit27)
+HANDLE_DW_OP(0x4c, lit28)
+HANDLE_DW_OP(0x4d, lit29)
+HANDLE_DW_OP(0x4e, lit30)
+HANDLE_DW_OP(0x4f, lit31)
+HANDLE_DW_OP(0x50, reg0)
+HANDLE_DW_OP(0x51, reg1)
+HANDLE_DW_OP(0x52, reg2)
+HANDLE_DW_OP(0x53, reg3)
+HANDLE_DW_OP(0x54, reg4)
+HANDLE_DW_OP(0x55, reg5)
+HANDLE_DW_OP(0x56, reg6)
+HANDLE_DW_OP(0x57, reg7)
+HANDLE_DW_OP(0x58, reg8)
+HANDLE_DW_OP(0x59, reg9)
+HANDLE_DW_OP(0x5a, reg10)
+HANDLE_DW_OP(0x5b, reg11)
+HANDLE_DW_OP(0x5c, reg12)
+HANDLE_DW_OP(0x5d, reg13)
+HANDLE_DW_OP(0x5e, reg14)
+HANDLE_DW_OP(0x5f, reg15)
+HANDLE_DW_OP(0x60, reg16)
+HANDLE_DW_OP(0x61, reg17)
+HANDLE_DW_OP(0x62, reg18)
+HANDLE_DW_OP(0x63, reg19)
+HANDLE_DW_OP(0x64, reg20)
+HANDLE_DW_OP(0x65, reg21)
+HANDLE_DW_OP(0x66, reg22)
+HANDLE_DW_OP(0x67, reg23)
+HANDLE_DW_OP(0x68, reg24)
+HANDLE_DW_OP(0x69, reg25)
+HANDLE_DW_OP(0x6a, reg26)
+HANDLE_DW_OP(0x6b, reg27)
+HANDLE_DW_OP(0x6c, reg28)
+HANDLE_DW_OP(0x6d, reg29)
+HANDLE_DW_OP(0x6e, reg30)
+HANDLE_DW_OP(0x6f, reg31)
+HANDLE_DW_OP(0x70, breg0)
+HANDLE_DW_OP(0x71, breg1)
+HANDLE_DW_OP(0x72, breg2)
+HANDLE_DW_OP(0x73, breg3)
+HANDLE_DW_OP(0x74, breg4)
+HANDLE_DW_OP(0x75, breg5)
+HANDLE_DW_OP(0x76, breg6)
+HANDLE_DW_OP(0x77, breg7)
+HANDLE_DW_OP(0x78, breg8)
+HANDLE_DW_OP(0x79, breg9)
+HANDLE_DW_OP(0x7a, breg10)
+HANDLE_DW_OP(0x7b, breg11)
+HANDLE_DW_OP(0x7c, breg12)
+HANDLE_DW_OP(0x7d, breg13)
+HANDLE_DW_OP(0x7e, breg14)
+HANDLE_DW_OP(0x7f, breg15)
+HANDLE_DW_OP(0x80, breg16)
+HANDLE_DW_OP(0x81, breg17)
+HANDLE_DW_OP(0x82, breg18)
+HANDLE_DW_OP(0x83, breg19)
+HANDLE_DW_OP(0x84, breg20)
+HANDLE_DW_OP(0x85, breg21)
+HANDLE_DW_OP(0x86, breg22)
+HANDLE_DW_OP(0x87, breg23)
+HANDLE_DW_OP(0x88, breg24)
+HANDLE_DW_OP(0x89, breg25)
+HANDLE_DW_OP(0x8a, breg26)
+HANDLE_DW_OP(0x8b, breg27)
+HANDLE_DW_OP(0x8c, breg28)
+HANDLE_DW_OP(0x8d, breg29)
+HANDLE_DW_OP(0x8e, breg30)
+HANDLE_DW_OP(0x8f, breg31)
+HANDLE_DW_OP(0x90, regx)
+HANDLE_DW_OP(0x91, fbreg)
+HANDLE_DW_OP(0x92, bregx)
+HANDLE_DW_OP(0x93, piece)
+HANDLE_DW_OP(0x94, deref_size)
+HANDLE_DW_OP(0x95, xderef_size)
+HANDLE_DW_OP(0x96, nop)
+HANDLE_DW_OP(0x97, push_object_address)
+HANDLE_DW_OP(0x98, call2)
+HANDLE_DW_OP(0x99, call4)
+HANDLE_DW_OP(0x9a, call_ref)
+HANDLE_DW_OP(0x9b, form_tls_address)
+HANDLE_DW_OP(0x9c, call_frame_cfa)
+HANDLE_DW_OP(0x9d, bit_piece)
+HANDLE_DW_OP(0x9e, implicit_value)
+HANDLE_DW_OP(0x9f, stack_value)
+
+// Extensions for GNU-style thread-local storage.
+HANDLE_DW_OP(0xe0, GNU_push_tls_address)
+
+// Extensions for Fission proposal.
+HANDLE_DW_OP(0xfb, GNU_addr_index)
+HANDLE_DW_OP(0xfc, GNU_const_index)
+
+// DWARF languages.
+HANDLE_DW_LANG(0x0001, C89)
+HANDLE_DW_LANG(0x0002, C)
+HANDLE_DW_LANG(0x0003, Ada83)
+HANDLE_DW_LANG(0x0004, C_plus_plus)
+HANDLE_DW_LANG(0x0005, Cobol74)
+HANDLE_DW_LANG(0x0006, Cobol85)
+HANDLE_DW_LANG(0x0007, Fortran77)
+HANDLE_DW_LANG(0x0008, Fortran90)
+HANDLE_DW_LANG(0x0009, Pascal83)
+HANDLE_DW_LANG(0x000a, Modula2)
+HANDLE_DW_LANG(0x000b, Java)
+HANDLE_DW_LANG(0x000c, C99)
+HANDLE_DW_LANG(0x000d, Ada95)
+HANDLE_DW_LANG(0x000e, Fortran95)
+HANDLE_DW_LANG(0x000f, PLI)
+HANDLE_DW_LANG(0x0010, ObjC)
+HANDLE_DW_LANG(0x0011, ObjC_plus_plus)
+HANDLE_DW_LANG(0x0012, UPC)
+HANDLE_DW_LANG(0x0013, D)
+
+// New in DWARF 5:
+HANDLE_DW_LANG(0x0014, Python)
+HANDLE_DW_LANG(0x0015, OpenCL)
+HANDLE_DW_LANG(0x0016, Go)
+HANDLE_DW_LANG(0x0017, Modula3)
+HANDLE_DW_LANG(0x0018, Haskell)
+HANDLE_DW_LANG(0x0019, C_plus_plus_03)
+HANDLE_DW_LANG(0x001a, C_plus_plus_11)
+HANDLE_DW_LANG(0x001b, OCaml)
+HANDLE_DW_LANG(0x001c, Rust)
+HANDLE_DW_LANG(0x001d, C11)
+HANDLE_DW_LANG(0x001e, Swift)
+HANDLE_DW_LANG(0x001f, Julia)
+HANDLE_DW_LANG(0x0020, Dylan)
+HANDLE_DW_LANG(0x0021, C_plus_plus_14)
+HANDLE_DW_LANG(0x0022, Fortran03)
+HANDLE_DW_LANG(0x0023, Fortran08)
+HANDLE_DW_LANG(0x8001, Mips_Assembler)
+HANDLE_DW_LANG(0xb000, BORLAND_Delphi)
+
+// DWARF attribute type encodings.
+HANDLE_DW_ATE(0x01, address)
+HANDLE_DW_ATE(0x02, boolean)
+HANDLE_DW_ATE(0x03, complex_float)
+HANDLE_DW_ATE(0x04, float)
+HANDLE_DW_ATE(0x05, signed)
+HANDLE_DW_ATE(0x06, signed_char)
+HANDLE_DW_ATE(0x07, unsigned)
+HANDLE_DW_ATE(0x08, unsigned_char)
+HANDLE_DW_ATE(0x09, imaginary_float)
+HANDLE_DW_ATE(0x0a, packed_decimal)
+HANDLE_DW_ATE(0x0b, numeric_string)
+HANDLE_DW_ATE(0x0c, edited)
+HANDLE_DW_ATE(0x0d, signed_fixed)
+HANDLE_DW_ATE(0x0e, unsigned_fixed)
+HANDLE_DW_ATE(0x0f, decimal_float)
+HANDLE_DW_ATE(0x10, UTF)
+
+// DWARF virtuality codes.
+HANDLE_DW_VIRTUALITY(0x00, none)
+HANDLE_DW_VIRTUALITY(0x01, virtual)
+HANDLE_DW_VIRTUALITY(0x02, pure_virtual)
+
+#undef HANDLE_DW_TAG
+#undef HANDLE_DW_OP
+#undef HANDLE_DW_LANG
+#undef HANDLE_DW_ATE
+#undef HANDLE_DW_VIRTUALITY
diff --git a/src/inc/llvm/Dwarf.h b/src/inc/llvm/Dwarf.h
new file mode 100644
index 0000000000..5fa73e931c
--- /dev/null
+++ b/src/inc/llvm/Dwarf.h
@@ -0,0 +1,711 @@
+// 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.
+
+// ==============================================================================
+// LLVM Release License
+// ==============================================================================
+// University of Illinois/NCSA
+// Open Source License
+//
+// Copyright (c) 2003-2015 University of Illinois at Urbana-Champaign.
+// All rights reserved.
+//
+// Developed by:
+//
+// LLVM Team
+//
+// University of Illinois at Urbana-Champaign
+//
+// http://llvm.org
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy of
+// this software and associated documentation files (the "Software"), to deal with
+// the Software without restriction, including without limitation the rights to
+// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+// of the Software, and to permit persons to whom the Software is furnished to do
+// so, subject to the following conditions:
+//
+// * Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimers.
+//
+// * Redistributions in binary form must reproduce the above copyright notice,
+// this list of conditions and the following disclaimers in the
+// documentation and/or other materials provided with the distribution.
+//
+// * Neither the names of the LLVM Team, University of Illinois at
+// Urbana-Champaign, nor the names of its contributors may be used to
+// endorse or promote products derived from this Software without specific
+// prior written permission.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
+// SOFTWARE.
+
+//===----------------------------------------------------------------------===//
+//
+// \file
+// \brief This file contains constants used for implementing Dwarf
+// debug support.
+//
+// For details on the Dwarf specfication see the latest DWARF Debugging
+// Information Format standard document on http://www.dwarfstd.org. This
+// file often includes support for non-released standard features.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_SUPPORT_DWARF_H
+#define LLVM_SUPPORT_DWARF_H
+
+//===----------------------------------------------------------------------===//
+// Dwarf constants as gleaned from the DWARF Debugging Information Format V.4
+// reference manual http://www.dwarfstd.org/.
+//
+
+// Do not mix the following two enumerations sets. DW_TAG_invalid changes the
+// enumeration base type.
+
+enum LLVMConstants : uint32_t {
+ // LLVM mock tags (see also llvm/Support/Dwarf.def).
+ DW_TAG_invalid = ~0U, // Tag for invalid results.
+ DW_VIRTUALITY_invalid = ~0U, // Virtuality for invalid results.
+ DW_MACINFO_invalid = ~0U, // Macinfo type for invalid results.
+
+ // Other constants.
+ DWARF_VERSION = 4, // Default dwarf version we output.
+ DW_PUBTYPES_VERSION = 2, // Section version number for .debug_pubtypes.
+ DW_PUBNAMES_VERSION = 2, // Section version number for .debug_pubnames.
+ DW_ARANGES_VERSION = 2 // Section version number for .debug_aranges.
+};
+
+// Special ID values that distinguish a CIE from a FDE in DWARF CFI.
+// Not inside an enum because a 64-bit value is needed.
+const uint32_t DW_CIE_ID = UINT32_MAX;
+const uint64_t DW64_CIE_ID = UINT64_MAX;
+
+enum Tag : uint16_t {
+#define HANDLE_DW_TAG(ID, NAME) DW_TAG_##NAME = ID,
+#include "Dwarf.def"
+ DW_TAG_lo_user = 0x4080,
+ DW_TAG_hi_user = 0xffff,
+ DW_TAG_user_base = 0x1000 // Recommended base for user tags.
+};
+
+inline bool isType(Tag T) {
+ switch (T) {
+ case DW_TAG_array_type:
+ case DW_TAG_class_type:
+ case DW_TAG_interface_type:
+ case DW_TAG_enumeration_type:
+ case DW_TAG_pointer_type:
+ case DW_TAG_reference_type:
+ case DW_TAG_rvalue_reference_type:
+ case DW_TAG_string_type:
+ case DW_TAG_structure_type:
+ case DW_TAG_subroutine_type:
+ case DW_TAG_union_type:
+ case DW_TAG_ptr_to_member_type:
+ case DW_TAG_set_type:
+ case DW_TAG_subrange_type:
+ case DW_TAG_base_type:
+ case DW_TAG_const_type:
+ case DW_TAG_file_type:
+ case DW_TAG_packed_type:
+ case DW_TAG_volatile_type:
+ case DW_TAG_typedef:
+ return true;
+ default:
+ return false;
+ }
+}
+
+enum Attribute : uint16_t {
+ // Attributes
+ DW_AT_sibling = 0x01,
+ DW_AT_location = 0x02,
+ DW_AT_name = 0x03,
+ DW_AT_ordering = 0x09,
+ DW_AT_byte_size = 0x0b,
+ DW_AT_bit_offset = 0x0c,
+ DW_AT_bit_size = 0x0d,
+ DW_AT_stmt_list = 0x10,
+ DW_AT_low_pc = 0x11,
+ DW_AT_high_pc = 0x12,
+ DW_AT_language = 0x13,
+ DW_AT_discr = 0x15,
+ DW_AT_discr_value = 0x16,
+ DW_AT_visibility = 0x17,
+ DW_AT_import = 0x18,
+ DW_AT_string_length = 0x19,
+ DW_AT_common_reference = 0x1a,
+ DW_AT_comp_dir = 0x1b,
+ DW_AT_const_value = 0x1c,
+ DW_AT_containing_type = 0x1d,
+ DW_AT_default_value = 0x1e,
+ DW_AT_inline = 0x20,
+ DW_AT_is_optional = 0x21,
+ DW_AT_lower_bound = 0x22,
+ DW_AT_producer = 0x25,
+ DW_AT_prototyped = 0x27,
+ DW_AT_return_addr = 0x2a,
+ DW_AT_start_scope = 0x2c,
+ DW_AT_bit_stride = 0x2e,
+ DW_AT_upper_bound = 0x2f,
+ DW_AT_abstract_origin = 0x31,
+ DW_AT_accessibility = 0x32,
+ DW_AT_address_class = 0x33,
+ DW_AT_artificial = 0x34,
+ DW_AT_base_types = 0x35,
+ DW_AT_calling_convention = 0x36,
+ DW_AT_count = 0x37,
+ DW_AT_data_member_location = 0x38,
+ DW_AT_decl_column = 0x39,
+ DW_AT_decl_file = 0x3a,
+ DW_AT_decl_line = 0x3b,
+ DW_AT_declaration = 0x3c,
+ DW_AT_discr_list = 0x3d,
+ DW_AT_encoding = 0x3e,
+ DW_AT_external = 0x3f,
+ DW_AT_frame_base = 0x40,
+ DW_AT_friend = 0x41,
+ DW_AT_identifier_case = 0x42,
+ DW_AT_macro_info = 0x43,
+ DW_AT_namelist_item = 0x44,
+ DW_AT_priority = 0x45,
+ DW_AT_segment = 0x46,
+ DW_AT_specification = 0x47,
+ DW_AT_static_link = 0x48,
+ DW_AT_type = 0x49,
+ DW_AT_use_location = 0x4a,
+ DW_AT_variable_parameter = 0x4b,
+ DW_AT_virtuality = 0x4c,
+ DW_AT_vtable_elem_location = 0x4d,
+ DW_AT_allocated = 0x4e,
+ DW_AT_associated = 0x4f,
+ DW_AT_data_location = 0x50,
+ DW_AT_byte_stride = 0x51,
+ DW_AT_entry_pc = 0x52,
+ DW_AT_use_UTF8 = 0x53,
+ DW_AT_extension = 0x54,
+ DW_AT_ranges = 0x55,
+ DW_AT_trampoline = 0x56,
+ DW_AT_call_column = 0x57,
+ DW_AT_call_file = 0x58,
+ DW_AT_call_line = 0x59,
+ DW_AT_description = 0x5a,
+ DW_AT_binary_scale = 0x5b,
+ DW_AT_decimal_scale = 0x5c,
+ DW_AT_small = 0x5d,
+ DW_AT_decimal_sign = 0x5e,
+ DW_AT_digit_count = 0x5f,
+ DW_AT_picture_string = 0x60,
+ DW_AT_mutable = 0x61,
+ DW_AT_threads_scaled = 0x62,
+ DW_AT_explicit = 0x63,
+ DW_AT_object_pointer = 0x64,
+ DW_AT_endianity = 0x65,
+ DW_AT_elemental = 0x66,
+ DW_AT_pure = 0x67,
+ DW_AT_recursive = 0x68,
+ DW_AT_signature = 0x69,
+ DW_AT_main_subprogram = 0x6a,
+ DW_AT_data_bit_offset = 0x6b,
+ DW_AT_const_expr = 0x6c,
+ DW_AT_enum_class = 0x6d,
+ DW_AT_linkage_name = 0x6e,
+
+ // New in DWARF 5:
+ DW_AT_string_length_bit_size = 0x6f,
+ DW_AT_string_length_byte_size = 0x70,
+ DW_AT_rank = 0x71,
+ DW_AT_str_offsets_base = 0x72,
+ DW_AT_addr_base = 0x73,
+ DW_AT_ranges_base = 0x74,
+ DW_AT_dwo_id = 0x75,
+ DW_AT_dwo_name = 0x76,
+ DW_AT_reference = 0x77,
+ DW_AT_rvalue_reference = 0x78,
+ DW_AT_macros = 0x79,
+
+ DW_AT_lo_user = 0x2000,
+ DW_AT_hi_user = 0x3fff,
+
+ DW_AT_MIPS_loop_begin = 0x2002,
+ DW_AT_MIPS_tail_loop_begin = 0x2003,
+ DW_AT_MIPS_epilog_begin = 0x2004,
+ DW_AT_MIPS_loop_unroll_factor = 0x2005,
+ DW_AT_MIPS_software_pipeline_depth = 0x2006,
+ DW_AT_MIPS_linkage_name = 0x2007,
+ DW_AT_MIPS_stride = 0x2008,
+ DW_AT_MIPS_abstract_name = 0x2009,
+ DW_AT_MIPS_clone_origin = 0x200a,
+ DW_AT_MIPS_has_inlines = 0x200b,
+ DW_AT_MIPS_stride_byte = 0x200c,
+ DW_AT_MIPS_stride_elem = 0x200d,
+ DW_AT_MIPS_ptr_dopetype = 0x200e,
+ DW_AT_MIPS_allocatable_dopetype = 0x200f,
+ DW_AT_MIPS_assumed_shape_dopetype = 0x2010,
+
+ // This one appears to have only been implemented by Open64 for
+ // fortran and may conflict with other extensions.
+ DW_AT_MIPS_assumed_size = 0x2011,
+
+ // GNU extensions
+ DW_AT_sf_names = 0x2101,
+ DW_AT_src_info = 0x2102,
+ DW_AT_mac_info = 0x2103,
+ DW_AT_src_coords = 0x2104,
+ DW_AT_body_begin = 0x2105,
+ DW_AT_body_end = 0x2106,
+ DW_AT_GNU_vector = 0x2107,
+ DW_AT_GNU_template_name = 0x2110,
+
+ DW_AT_GNU_odr_signature = 0x210f,
+ DW_AT_GNU_macros = 0x2119,
+
+ // Extensions for Fission proposal.
+ DW_AT_GNU_dwo_name = 0x2130,
+ DW_AT_GNU_dwo_id = 0x2131,
+ DW_AT_GNU_ranges_base = 0x2132,
+ DW_AT_GNU_addr_base = 0x2133,
+ DW_AT_GNU_pubnames = 0x2134,
+ DW_AT_GNU_pubtypes = 0x2135,
+ DW_AT_GNU_discriminator = 0x2136,
+
+ // Borland extensions.
+ DW_AT_BORLAND_property_read = 0x3b11,
+ DW_AT_BORLAND_property_write = 0x3b12,
+ DW_AT_BORLAND_property_implements = 0x3b13,
+ DW_AT_BORLAND_property_index = 0x3b14,
+ DW_AT_BORLAND_property_default = 0x3b15,
+ DW_AT_BORLAND_Delphi_unit = 0x3b20,
+ DW_AT_BORLAND_Delphi_class = 0x3b21,
+ DW_AT_BORLAND_Delphi_record = 0x3b22,
+ DW_AT_BORLAND_Delphi_metaclass = 0x3b23,
+ DW_AT_BORLAND_Delphi_constructor = 0x3b24,
+ DW_AT_BORLAND_Delphi_destructor = 0x3b25,
+ DW_AT_BORLAND_Delphi_anonymous_method = 0x3b26,
+ DW_AT_BORLAND_Delphi_interface = 0x3b27,
+ DW_AT_BORLAND_Delphi_ABI = 0x3b28,
+ DW_AT_BORLAND_Delphi_return = 0x3b29,
+ DW_AT_BORLAND_Delphi_frameptr = 0x3b30,
+ DW_AT_BORLAND_closure = 0x3b31,
+
+ // LLVM project extensions.
+ DW_AT_LLVM_include_path = 0x3e00,
+ DW_AT_LLVM_config_macros = 0x3e01,
+ DW_AT_LLVM_isysroot = 0x3e02,
+
+ // Apple extensions.
+ DW_AT_APPLE_optimized = 0x3fe1,
+ DW_AT_APPLE_flags = 0x3fe2,
+ DW_AT_APPLE_isa = 0x3fe3,
+ DW_AT_APPLE_block = 0x3fe4,
+ DW_AT_APPLE_major_runtime_vers = 0x3fe5,
+ DW_AT_APPLE_runtime_class = 0x3fe6,
+ DW_AT_APPLE_omit_frame_ptr = 0x3fe7,
+ DW_AT_APPLE_property_name = 0x3fe8,
+ DW_AT_APPLE_property_getter = 0x3fe9,
+ DW_AT_APPLE_property_setter = 0x3fea,
+ DW_AT_APPLE_property_attribute = 0x3feb,
+ DW_AT_APPLE_objc_complete_type = 0x3fec,
+ DW_AT_APPLE_property = 0x3fed
+};
+
+enum Form : uint16_t {
+ // Attribute form encodings
+ DW_FORM_addr = 0x01,
+ DW_FORM_block2 = 0x03,
+ DW_FORM_block4 = 0x04,
+ DW_FORM_data2 = 0x05,
+ DW_FORM_data4 = 0x06,
+ DW_FORM_data8 = 0x07,
+ DW_FORM_string = 0x08,
+ DW_FORM_block = 0x09,
+ DW_FORM_block1 = 0x0a,
+ DW_FORM_data1 = 0x0b,
+ DW_FORM_flag = 0x0c,
+ DW_FORM_sdata = 0x0d,
+ DW_FORM_strp = 0x0e,
+ DW_FORM_udata = 0x0f,
+ DW_FORM_ref_addr = 0x10,
+ DW_FORM_ref1 = 0x11,
+ DW_FORM_ref2 = 0x12,
+ DW_FORM_ref4 = 0x13,
+ DW_FORM_ref8 = 0x14,
+ DW_FORM_ref_udata = 0x15,
+ DW_FORM_indirect = 0x16,
+ DW_FORM_sec_offset = 0x17,
+ DW_FORM_exprloc = 0x18,
+ DW_FORM_flag_present = 0x19,
+ DW_FORM_ref_sig8 = 0x20,
+
+ // Extensions for Fission proposal
+ DW_FORM_GNU_addr_index = 0x1f01,
+ DW_FORM_GNU_str_index = 0x1f02,
+
+ // Alternate debug sections proposal (output of "dwz" tool).
+ DW_FORM_GNU_ref_alt = 0x1f20,
+ DW_FORM_GNU_strp_alt = 0x1f21
+};
+
+enum LocationAtom {
+#define HANDLE_DW_OP(ID, NAME) DW_OP_##NAME = ID,
+#include "Dwarf.def"
+ DW_OP_lo_user = 0xe0,
+ DW_OP_hi_user = 0xff
+};
+
+enum TypeKind {
+#define HANDLE_DW_ATE(ID, NAME) DW_ATE_##NAME = ID,
+#include "Dwarf.def"
+ DW_ATE_lo_user = 0x80,
+ DW_ATE_hi_user = 0xff
+};
+
+enum DecimalSignEncoding {
+ // Decimal sign attribute values
+ DW_DS_unsigned = 0x01,
+ DW_DS_leading_overpunch = 0x02,
+ DW_DS_trailing_overpunch = 0x03,
+ DW_DS_leading_separate = 0x04,
+ DW_DS_trailing_separate = 0x05
+};
+
+enum EndianityEncoding {
+ // Endianity attribute values
+ DW_END_default = 0x00,
+ DW_END_big = 0x01,
+ DW_END_little = 0x02,
+ DW_END_lo_user = 0x40,
+ DW_END_hi_user = 0xff
+};
+
+enum AccessAttribute {
+ // Accessibility codes
+ DW_ACCESS_public = 0x01,
+ DW_ACCESS_protected = 0x02,
+ DW_ACCESS_private = 0x03
+};
+
+enum VisibilityAttribute {
+ // Visibility codes
+ DW_VIS_local = 0x01,
+ DW_VIS_exported = 0x02,
+ DW_VIS_qualified = 0x03
+};
+
+enum VirtualityAttribute {
+#define HANDLE_DW_VIRTUALITY(ID, NAME) DW_VIRTUALITY_##NAME = ID,
+#include "Dwarf.def"
+ DW_VIRTUALITY_max = 0x02
+};
+
+enum SourceLanguage {
+#define HANDLE_DW_LANG(ID, NAME) DW_LANG_##NAME = ID,
+#include "Dwarf.def"
+ DW_LANG_lo_user = 0x8000,
+ DW_LANG_hi_user = 0xffff
+};
+
+enum CaseSensitivity {
+ // Identifier case codes
+ DW_ID_case_sensitive = 0x00,
+ DW_ID_up_case = 0x01,
+ DW_ID_down_case = 0x02,
+ DW_ID_case_insensitive = 0x03
+};
+
+enum CallingConvention {
+ // Calling convention codes
+ DW_CC_normal = 0x01,
+ DW_CC_program = 0x02,
+ DW_CC_nocall = 0x03,
+ DW_CC_lo_user = 0x40,
+ DW_CC_GNU_borland_fastcall_i386 = 0x41,
+ DW_CC_BORLAND_safecall = 0xb0,
+ DW_CC_BORLAND_stdcall = 0xb1,
+ DW_CC_BORLAND_pascal = 0xb2,
+ DW_CC_BORLAND_msfastcall = 0xb3,
+ DW_CC_BORLAND_msreturn = 0xb4,
+ DW_CC_BORLAND_thiscall = 0xb5,
+ DW_CC_BORLAND_fastcall = 0xb6,
+ DW_CC_hi_user = 0xff
+};
+
+enum InlineAttribute {
+ // Inline codes
+ DW_INL_not_inlined = 0x00,
+ DW_INL_inlined = 0x01,
+ DW_INL_declared_not_inlined = 0x02,
+ DW_INL_declared_inlined = 0x03
+};
+
+enum ArrayDimensionOrdering {
+ // Array ordering
+ DW_ORD_row_major = 0x00,
+ DW_ORD_col_major = 0x01
+};
+
+enum DiscriminantList {
+ // Discriminant descriptor values
+ DW_DSC_label = 0x00,
+ DW_DSC_range = 0x01
+};
+
+enum LineNumberOps {
+ // Line Number Standard Opcode Encodings
+ DW_LNS_extended_op = 0x00,
+ DW_LNS_copy = 0x01,
+ DW_LNS_advance_pc = 0x02,
+ DW_LNS_advance_line = 0x03,
+ DW_LNS_set_file = 0x04,
+ DW_LNS_set_column = 0x05,
+ DW_LNS_negate_stmt = 0x06,
+ DW_LNS_set_basic_block = 0x07,
+ DW_LNS_const_add_pc = 0x08,
+ DW_LNS_fixed_advance_pc = 0x09,
+ DW_LNS_set_prologue_end = 0x0a,
+ DW_LNS_set_epilogue_begin = 0x0b,
+ DW_LNS_set_isa = 0x0c
+};
+
+enum LineNumberExtendedOps {
+ // Line Number Extended Opcode Encodings
+ DW_LNE_end_sequence = 0x01,
+ DW_LNE_set_address = 0x02,
+ DW_LNE_define_file = 0x03,
+ DW_LNE_set_discriminator = 0x04,
+ DW_LNE_lo_user = 0x80,
+ DW_LNE_hi_user = 0xff
+};
+
+enum MacinfoRecordType {
+ // Macinfo Type Encodings
+ DW_MACINFO_define = 0x01,
+ DW_MACINFO_undef = 0x02,
+ DW_MACINFO_start_file = 0x03,
+ DW_MACINFO_end_file = 0x04,
+ DW_MACINFO_vendor_ext = 0xff
+};
+
+enum MacroEntryType {
+ // Macro Information Entry Type Encodings
+ DW_MACRO_define = 0x01,
+ DW_MACRO_undef = 0x02,
+ DW_MACRO_start_file = 0x03,
+ DW_MACRO_end_file = 0x04,
+ DW_MACRO_define_indirect = 0x05,
+ DW_MACRO_undef_indirect = 0x06,
+ DW_MACRO_transparent_include = 0x07,
+ DW_MACRO_define_indirect_sup = 0x08,
+ DW_MACRO_undef_indirect_sup = 0x09,
+ DW_MACRO_transparent_include_sup = 0x0a,
+ DW_MACRO_define_indirectx = 0x0b,
+ DW_MACRO_undef_indirectx = 0x0c,
+ DW_MACRO_lo_user = 0xe0,
+ DW_MACRO_hi_user = 0xff
+};
+
+enum CallFrameInfo {
+ // Call frame instruction encodings
+ DW_CFA_extended = 0x00,
+ DW_CFA_nop = 0x00,
+ DW_CFA_advance_loc = 0x40,
+ DW_CFA_offset = 0x80,
+ DW_CFA_restore = 0xc0,
+ DW_CFA_set_loc = 0x01,
+ DW_CFA_advance_loc1 = 0x02,
+ DW_CFA_advance_loc2 = 0x03,
+ DW_CFA_advance_loc4 = 0x04,
+ DW_CFA_offset_extended = 0x05,
+ DW_CFA_restore_extended = 0x06,
+ DW_CFA_undefined = 0x07,
+ DW_CFA_same_value = 0x08,
+ DW_CFA_register = 0x09,
+ DW_CFA_remember_state = 0x0a,
+ DW_CFA_restore_state = 0x0b,
+ DW_CFA_def_cfa = 0x0c,
+ DW_CFA_def_cfa_register = 0x0d,
+ DW_CFA_def_cfa_offset = 0x0e,
+ DW_CFA_def_cfa_expression = 0x0f,
+ DW_CFA_expression = 0x10,
+ DW_CFA_offset_extended_sf = 0x11,
+ DW_CFA_def_cfa_sf = 0x12,
+ DW_CFA_def_cfa_offset_sf = 0x13,
+ DW_CFA_val_offset = 0x14,
+ DW_CFA_val_offset_sf = 0x15,
+ DW_CFA_val_expression = 0x16,
+ DW_CFA_MIPS_advance_loc8 = 0x1d,
+ DW_CFA_GNU_window_save = 0x2d,
+ DW_CFA_GNU_args_size = 0x2e,
+ DW_CFA_lo_user = 0x1c,
+ DW_CFA_hi_user = 0x3f
+};
+
+enum Constants {
+ // Children flag
+ DW_CHILDREN_no = 0x00,
+ DW_CHILDREN_yes = 0x01,
+
+ DW_EH_PE_absptr = 0x00,
+ DW_EH_PE_omit = 0xff,
+ DW_EH_PE_uleb128 = 0x01,
+ DW_EH_PE_udata2 = 0x02,
+ DW_EH_PE_udata4 = 0x03,
+ DW_EH_PE_udata8 = 0x04,
+ DW_EH_PE_sleb128 = 0x09,
+ DW_EH_PE_sdata2 = 0x0A,
+ DW_EH_PE_sdata4 = 0x0B,
+ DW_EH_PE_sdata8 = 0x0C,
+ DW_EH_PE_signed = 0x08,
+ DW_EH_PE_pcrel = 0x10,
+ DW_EH_PE_textrel = 0x20,
+ DW_EH_PE_datarel = 0x30,
+ DW_EH_PE_funcrel = 0x40,
+ DW_EH_PE_aligned = 0x50,
+ DW_EH_PE_indirect = 0x80
+};
+
+// Constants for debug_loc.dwo in the DWARF5 Split Debug Info Proposal
+enum LocationListEntry : unsigned char {
+ DW_LLE_end_of_list_entry,
+ DW_LLE_base_address_selection_entry,
+ DW_LLE_start_end_entry,
+ DW_LLE_start_length_entry,
+ DW_LLE_offset_pair_entry
+};
+
+/// Contstants for the DW_APPLE_PROPERTY_attributes attribute.
+/// Keep this list in sync with clang's DeclSpec.h ObjCPropertyAttributeKind.
+enum ApplePropertyAttributes {
+ // Apple Objective-C Property Attributes
+ DW_APPLE_PROPERTY_readonly = 0x01,
+ DW_APPLE_PROPERTY_getter = 0x02,
+ DW_APPLE_PROPERTY_assign = 0x04,
+ DW_APPLE_PROPERTY_readwrite = 0x08,
+ DW_APPLE_PROPERTY_retain = 0x10,
+ DW_APPLE_PROPERTY_copy = 0x20,
+ DW_APPLE_PROPERTY_nonatomic = 0x40,
+ DW_APPLE_PROPERTY_setter = 0x80,
+ DW_APPLE_PROPERTY_atomic = 0x100,
+ DW_APPLE_PROPERTY_weak = 0x200,
+ DW_APPLE_PROPERTY_strong = 0x400,
+ DW_APPLE_PROPERTY_unsafe_unretained = 0x800
+};
+
+// Constants for the DWARF5 Accelerator Table Proposal
+enum AcceleratorTable {
+ // Data layout descriptors.
+ DW_ATOM_null = 0u, // Marker as the end of a list of atoms.
+ DW_ATOM_die_offset = 1u, // DIE offset in the debug_info section.
+ DW_ATOM_cu_offset = 2u, // Offset of the compile unit header that contains the
+ // item in question.
+ DW_ATOM_die_tag = 3u, // A tag entry.
+ DW_ATOM_type_flags = 4u, // Set of flags for a type.
+
+ // DW_ATOM_type_flags values.
+
+ // Always set for C++, only set for ObjC if this is the @implementation for a
+ // class.
+ DW_FLAG_type_implementation = 2u,
+
+ // Hash functions.
+
+ // Daniel J. Bernstein hash.
+ DW_hash_function_djb = 0u
+};
+
+// Constants for the GNU pubnames/pubtypes extensions supporting gdb index.
+enum GDBIndexEntryKind {
+ GIEK_NONE,
+ GIEK_TYPE,
+ GIEK_VARIABLE,
+ GIEK_FUNCTION,
+ GIEK_OTHER,
+ GIEK_UNUSED5,
+ GIEK_UNUSED6,
+ GIEK_UNUSED7
+};
+
+enum GDBIndexEntryLinkage {
+ GIEL_EXTERNAL,
+ GIEL_STATIC
+};
+
+/// \defgroup DwarfConstantsDumping Dwarf constants dumping functions
+///
+/// All these functions map their argument's value back to the
+/// corresponding enumerator name or return nullptr if the value isn't
+/// known.
+///
+/// @{
+const char *TagString(unsigned Tag);
+const char *ChildrenString(unsigned Children);
+const char *AttributeString(unsigned Attribute);
+const char *FormEncodingString(unsigned Encoding);
+const char *OperationEncodingString(unsigned Encoding);
+const char *AttributeEncodingString(unsigned Encoding);
+const char *DecimalSignString(unsigned Sign);
+const char *EndianityString(unsigned Endian);
+const char *AccessibilityString(unsigned Access);
+const char *VisibilityString(unsigned Visibility);
+const char *VirtualityString(unsigned Virtuality);
+const char *LanguageString(unsigned Language);
+const char *CaseString(unsigned Case);
+const char *ConventionString(unsigned Convention);
+const char *InlineCodeString(unsigned Code);
+const char *ArrayOrderString(unsigned Order);
+const char *DiscriminantString(unsigned Discriminant);
+const char *LNStandardString(unsigned Standard);
+const char *LNExtendedString(unsigned Encoding);
+const char *MacinfoString(unsigned Encoding);
+const char *CallFrameString(unsigned Encoding);
+const char *ApplePropertyString(unsigned);
+const char *AtomTypeString(unsigned Atom);
+const char *GDBIndexEntryKindString(GDBIndexEntryKind Kind);
+const char *GDBIndexEntryLinkageString(GDBIndexEntryLinkage Linkage);
+/// @}
+
+/// \brief Returns the symbolic string representing Val when used as a value
+/// for attribute Attr.
+const char *AttributeValueString(uint16_t Attr, unsigned Val);
+
+/// \brief Decsribes an entry of the various gnu_pub* debug sections.
+///
+/// The gnu_pub* kind looks like:
+///
+/// 0-3 reserved
+/// 4-6 symbol kind
+/// 7 0 == global, 1 == static
+///
+/// A gdb_index descriptor includes the above kind, shifted 24 bits up with the
+/// offset of the cu within the debug_info section stored in those 24 bits.
+struct PubIndexEntryDescriptor {
+ GDBIndexEntryKind Kind;
+ GDBIndexEntryLinkage Linkage;
+ PubIndexEntryDescriptor(GDBIndexEntryKind Kind, GDBIndexEntryLinkage Linkage)
+ : Kind(Kind), Linkage(Linkage) {}
+ /* implicit */ PubIndexEntryDescriptor(GDBIndexEntryKind Kind)
+ : Kind(Kind), Linkage(GIEL_EXTERNAL) {}
+ explicit PubIndexEntryDescriptor(uint8_t Value)
+ : Kind(static_cast<GDBIndexEntryKind>((Value & KIND_MASK) >>
+ KIND_OFFSET)),
+ Linkage(static_cast<GDBIndexEntryLinkage>((Value & LINKAGE_MASK) >>
+ LINKAGE_OFFSET)) {}
+ uint8_t toBits() { return Kind << KIND_OFFSET | Linkage << LINKAGE_OFFSET; }
+
+private:
+ enum {
+ KIND_OFFSET = 4,
+ KIND_MASK = 7 << KIND_OFFSET,
+ LINKAGE_OFFSET = 7,
+ LINKAGE_MASK = 1 << LINKAGE_OFFSET
+ };
+};
+
+#endif
diff --git a/src/inc/llvm/ELF.h b/src/inc/llvm/ELF.h
new file mode 100644
index 0000000000..76c7824208
--- /dev/null
+++ b/src/inc/llvm/ELF.h
@@ -0,0 +1,1273 @@
+// 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.
+
+// ==============================================================================
+// LLVM Release License
+// ==============================================================================
+// University of Illinois/NCSA
+// Open Source License
+//
+// Copyright (c) 2003-2015 University of Illinois at Urbana-Champaign.
+// All rights reserved.
+//
+// Developed by:
+//
+// LLVM Team
+//
+// University of Illinois at Urbana-Champaign
+//
+// http://llvm.org
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy of
+// this software and associated documentation files (the "Software"), to deal with
+// the Software without restriction, including without limitation the rights to
+// use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies
+// of the Software, and to permit persons to whom the Software is furnished to do
+// so, subject to the following conditions:
+//
+// * Redistributions of source code must retain the above copyright notice,
+// this list of conditions and the following disclaimers.
+//
+// * Redistributions in binary form must reproduce the above copyright notice,
+// this list of conditions and the following disclaimers in the
+// documentation and/or other materials provided with the distribution.
+//
+// * Neither the names of the LLVM Team, University of Illinois at
+// Urbana-Champaign, nor the names of its contributors may be used to
+// endorse or promote products derived from this Software without specific
+// prior written permission.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
+// FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// CONTRIBUTORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS WITH THE
+// SOFTWARE.
+
+//===----------------------------------------------------------------------===//
+// This header contains common, non-processor-specific data structures and
+// constants for the ELF file format.
+//
+// The details of the ELF32 bits in this file are largely based on the Tool
+// Interface Standard (TIS) Executable and Linking Format (ELF) Specification
+// Version 1.2, May 1995. The ELF64 stuff is based on ELF-64 Object File Format
+// Version 1.5, Draft 2, May 1998 as well as OpenBSD header files.
+//
+//===----------------------------------------------------------------------===//
+
+#ifndef LLVM_SUPPORT_ELF_H
+#define LLVM_SUPPORT_ELF_H
+
+typedef uint32_t Elf32_Addr; // Program address
+typedef uint32_t Elf32_Off; // File offset
+typedef uint16_t Elf32_Half;
+typedef uint32_t Elf32_Word;
+typedef int32_t Elf32_Sword;
+
+typedef uint64_t Elf64_Addr;
+typedef uint64_t Elf64_Off;
+typedef uint16_t Elf64_Half;
+typedef uint32_t Elf64_Word;
+typedef int32_t Elf64_Sword;
+typedef uint64_t Elf64_Xword;
+typedef int64_t Elf64_Sxword;
+
+// Object file magic string.
+static const char ElfMagic[] = { 0x7f, 'E', 'L', 'F', '\0' };
+
+// e_ident size and indices.
+enum {
+ EI_MAG0 = 0, // File identification index.
+ EI_MAG1 = 1, // File identification index.
+ EI_MAG2 = 2, // File identification index.
+ EI_MAG3 = 3, // File identification index.
+ EI_CLASS = 4, // File class.
+ EI_DATA = 5, // Data encoding.
+ EI_VERSION = 6, // File version.
+ EI_OSABI = 7, // OS/ABI identification.
+ EI_ABIVERSION = 8, // ABI version.
+ EI_PAD = 9, // Start of padding bytes.
+ EI_NIDENT = 16 // Number of bytes in e_ident.
+};
+
+struct Elf32_Ehdr {
+ unsigned char e_ident[EI_NIDENT]; // ELF Identification bytes
+ Elf32_Half e_type; // Type of file (see ET_* below)
+ Elf32_Half e_machine; // Required architecture for this file (see EM_*)
+ Elf32_Word e_version; // Must be equal to 1
+ Elf32_Addr e_entry; // Address to jump to in order to start program
+ Elf32_Off e_phoff; // Program header table's file offset, in bytes
+ Elf32_Off e_shoff; // Section header table's file offset, in bytes
+ Elf32_Word e_flags; // Processor-specific flags
+ Elf32_Half e_ehsize; // Size of ELF header, in bytes
+ Elf32_Half e_phentsize; // Size of an entry in the program header table
+ Elf32_Half e_phnum; // Number of entries in the program header table
+ Elf32_Half e_shentsize; // Size of an entry in the section header table
+ Elf32_Half e_shnum; // Number of entries in the section header table
+ Elf32_Half e_shstrndx; // Sect hdr table index of sect name string table
+ bool checkMagic() const {
+ return (memcmp(e_ident, ElfMagic, strlen(ElfMagic))) == 0;
+ }
+ unsigned char getFileClass() const { return e_ident[EI_CLASS]; }
+ unsigned char getDataEncoding() const { return e_ident[EI_DATA]; }
+ Elf32_Ehdr();
+};
+
+// 64-bit ELF header. Fields are the same as for ELF32, but with different
+// types (see above).
+struct Elf64_Ehdr {
+ unsigned char e_ident[EI_NIDENT];
+ Elf64_Half e_type;
+ Elf64_Half e_machine;
+ Elf64_Word e_version;
+ Elf64_Addr e_entry;
+ Elf64_Off e_phoff;
+ Elf64_Off e_shoff;
+ Elf64_Word e_flags;
+ Elf64_Half e_ehsize;
+ Elf64_Half e_phentsize;
+ Elf64_Half e_phnum;
+ Elf64_Half e_shentsize;
+ Elf64_Half e_shnum;
+ Elf64_Half e_shstrndx;
+ bool checkMagic() const {
+ return (memcmp(e_ident, ElfMagic, strlen(ElfMagic))) == 0;
+ }
+ unsigned char getFileClass() const { return e_ident[EI_CLASS]; }
+ unsigned char getDataEncoding() const { return e_ident[EI_DATA]; }
+ Elf64_Ehdr();
+};
+
+// File types
+enum {
+ ET_NONE = 0, // No file type
+ ET_REL = 1, // Relocatable file
+ ET_EXEC = 2, // Executable file
+ ET_DYN = 3, // Shared object file
+ ET_CORE = 4, // Core file
+ ET_LOPROC = 0xff00, // Beginning of processor-specific codes
+ ET_HIPROC = 0xffff // Processor-specific
+};
+
+// Versioning
+enum {
+ EV_NONE = 0,
+ EV_CURRENT = 1
+};
+
+// Machine architectures
+// See current registered ELF machine architectures at:
+// http://www.uxsglobal.com/developers/gabi/latest/ch4.eheader.html
+enum {
+ EM_NONE = 0, // No machine
+ EM_M32 = 1, // AT&T WE 32100
+ EM_SPARC = 2, // SPARC
+ EM_386 = 3, // Intel 386
+ EM_68K = 4, // Motorola 68000
+ EM_88K = 5, // Motorola 88000
+ EM_IAMCU = 6, // Intel MCU
+ EM_860 = 7, // Intel 80860
+ EM_MIPS = 8, // MIPS R3000
+ EM_S370 = 9, // IBM System/370
+ EM_MIPS_RS3_LE = 10, // MIPS RS3000 Little-endian
+ EM_PARISC = 15, // Hewlett-Packard PA-RISC
+ EM_VPP500 = 17, // Fujitsu VPP500
+ EM_SPARC32PLUS = 18, // Enhanced instruction set SPARC
+ EM_960 = 19, // Intel 80960
+ EM_PPC = 20, // PowerPC
+ EM_PPC64 = 21, // PowerPC64
+ EM_S390 = 22, // IBM System/390
+ EM_SPU = 23, // IBM SPU/SPC
+ EM_V800 = 36, // NEC V800
+ EM_FR20 = 37, // Fujitsu FR20
+ EM_RH32 = 38, // TRW RH-32
+ EM_RCE = 39, // Motorola RCE
+ EM_ARM = 40, // ARM
+ EM_ALPHA = 41, // DEC Alpha
+ EM_SH = 42, // Hitachi SH
+ EM_SPARCV9 = 43, // SPARC V9
+ EM_TRICORE = 44, // Siemens TriCore
+ EM_ARC = 45, // Argonaut RISC Core
+ EM_H8_300 = 46, // Hitachi H8/300
+ EM_H8_300H = 47, // Hitachi H8/300H
+ EM_H8S = 48, // Hitachi H8S
+ EM_H8_500 = 49, // Hitachi H8/500
+ EM_IA_64 = 50, // Intel IA-64 processor architecture
+ EM_MIPS_X = 51, // Stanford MIPS-X
+ EM_COLDFIRE = 52, // Motorola ColdFire
+ EM_68HC12 = 53, // Motorola M68HC12
+ EM_MMA = 54, // Fujitsu MMA Multimedia Accelerator
+ EM_PCP = 55, // Siemens PCP
+ EM_NCPU = 56, // Sony nCPU embedded RISC processor
+ EM_NDR1 = 57, // Denso NDR1 microprocessor
+ EM_STARCORE = 58, // Motorola Star*Core processor
+ EM_ME16 = 59, // Toyota ME16 processor
+ EM_ST100 = 60, // STMicroelectronics ST100 processor
+ EM_TINYJ = 61, // Advanced Logic Corp. TinyJ embedded processor family
+ EM_X86_64 = 62, // AMD x86-64 architecture
+ EM_PDSP = 63, // Sony DSP Processor
+ EM_PDP10 = 64, // Digital Equipment Corp. PDP-10
+ EM_PDP11 = 65, // Digital Equipment Corp. PDP-11
+ EM_FX66 = 66, // Siemens FX66 microcontroller
+ EM_ST9PLUS = 67, // STMicroelectronics ST9+ 8/16 bit microcontroller
+ EM_ST7 = 68, // STMicroelectronics ST7 8-bit microcontroller
+ EM_68HC16 = 69, // Motorola MC68HC16 Microcontroller
+ EM_68HC11 = 70, // Motorola MC68HC11 Microcontroller
+ EM_68HC08 = 71, // Motorola MC68HC08 Microcontroller
+ EM_68HC05 = 72, // Motorola MC68HC05 Microcontroller
+ EM_SVX = 73, // Silicon Graphics SVx
+ EM_ST19 = 74, // STMicroelectronics ST19 8-bit microcontroller
+ EM_VAX = 75, // Digital VAX
+ EM_CRIS = 76, // Axis Communications 32-bit embedded processor
+ EM_JAVELIN = 77, // Infineon Technologies 32-bit embedded processor
+ EM_FIREPATH = 78, // Element 14 64-bit DSP Processor
+ EM_ZSP = 79, // LSI Logic 16-bit DSP Processor
+ EM_MMIX = 80, // Donald Knuth's educational 64-bit processor
+ EM_HUANY = 81, // Harvard University machine-independent object files
+ EM_PRISM = 82, // SiTera Prism
+ EM_AVR = 83, // Atmel AVR 8-bit microcontroller
+ EM_FR30 = 84, // Fujitsu FR30
+ EM_D10V = 85, // Mitsubishi D10V
+ EM_D30V = 86, // Mitsubishi D30V
+ EM_V850 = 87, // NEC v850
+ EM_M32R = 88, // Mitsubishi M32R
+ EM_MN10300 = 89, // Matsushita MN10300
+ EM_MN10200 = 90, // Matsushita MN10200
+ EM_PJ = 91, // picoJava
+ EM_OPENRISC = 92, // OpenRISC 32-bit embedded processor
+ EM_ARC_COMPACT = 93, // ARC International ARCompact processor (old
+ // spelling/synonym: EM_ARC_A5)
+ EM_XTENSA = 94, // Tensilica Xtensa Architecture
+ EM_VIDEOCORE = 95, // Alphamosaic VideoCore processor
+ EM_TMM_GPP = 96, // Thompson Multimedia General Purpose Processor
+ EM_NS32K = 97, // National Semiconductor 32000 series
+ EM_TPC = 98, // Tenor Network TPC processor
+ EM_SNP1K = 99, // Trebia SNP 1000 processor
+ EM_ST200 = 100, // STMicroelectronics (www.st.com) ST200
+ EM_IP2K = 101, // Ubicom IP2xxx microcontroller family
+ EM_MAX = 102, // MAX Processor
+ EM_CR = 103, // National Semiconductor CompactRISC microprocessor
+ EM_F2MC16 = 104, // Fujitsu F2MC16
+ EM_MSP430 = 105, // Texas Instruments embedded microcontroller msp430
+ EM_BLACKFIN = 106, // Analog Devices Blackfin (DSP) processor
+ EM_SE_C33 = 107, // S1C33 Family of Seiko Epson processors
+ EM_SEP = 108, // Sharp embedded microprocessor
+ EM_ARCA = 109, // Arca RISC Microprocessor
+ EM_UNICORE = 110, // Microprocessor series from PKU-Unity Ltd. and MPRC
+ // of Peking University
+ EM_EXCESS = 111, // eXcess: 16/32/64-bit configurable embedded CPU
+ EM_DXP = 112, // Icera Semiconductor Inc. Deep Execution Processor
+ EM_ALTERA_NIOS2 = 113, // Altera Nios II soft-core processor
+ EM_CRX = 114, // National Semiconductor CompactRISC CRX
+ EM_XGATE = 115, // Motorola XGATE embedded processor
+ EM_C166 = 116, // Infineon C16x/XC16x processor
+ EM_M16C = 117, // Renesas M16C series microprocessors
+ EM_DSPIC30F = 118, // Microchip Technology dsPIC30F Digital Signal
+ // Controller
+ EM_CE = 119, // Freescale Communication Engine RISC core
+ EM_M32C = 120, // Renesas M32C series microprocessors
+ EM_TSK3000 = 131, // Altium TSK3000 core
+ EM_RS08 = 132, // Freescale RS08 embedded processor
+ EM_SHARC = 133, // Analog Devices SHARC family of 32-bit DSP
+ // processors
+ EM_ECOG2 = 134, // Cyan Technology eCOG2 microprocessor
+ EM_SCORE7 = 135, // Sunplus S+core7 RISC processor
+ EM_DSP24 = 136, // New Japan Radio (NJR) 24-bit DSP Processor
+ EM_VIDEOCORE3 = 137, // Broadcom VideoCore III processor
+ EM_LATTICEMICO32 = 138, // RISC processor for Lattice FPGA architecture
+ EM_SE_C17 = 139, // Seiko Epson C17 family
+ EM_TI_C6000 = 140, // The Texas Instruments TMS320C6000 DSP family
+ EM_TI_C2000 = 141, // The Texas Instruments TMS320C2000 DSP family
+ EM_TI_C5500 = 142, // The Texas Instruments TMS320C55x DSP family
+ EM_MMDSP_PLUS = 160, // STMicroelectronics 64bit VLIW Data Signal Processor
+ EM_CYPRESS_M8C = 161, // Cypress M8C microprocessor
+ EM_R32C = 162, // Renesas R32C series microprocessors
+ EM_TRIMEDIA = 163, // NXP Semiconductors TriMedia architecture family
+ EM_HEXAGON = 164, // Qualcomm Hexagon processor
+ EM_8051 = 165, // Intel 8051 and variants
+ EM_STXP7X = 166, // STMicroelectronics STxP7x family of configurable
+ // and extensible RISC processors
+ EM_NDS32 = 167, // Andes Technology compact code size embedded RISC
+ // processor family
+ EM_ECOG1 = 168, // Cyan Technology eCOG1X family
+ EM_ECOG1X = 168, // Cyan Technology eCOG1X family
+ EM_MAXQ30 = 169, // Dallas Semiconductor MAXQ30 Core Micro-controllers
+ EM_XIMO16 = 170, // New Japan Radio (NJR) 16-bit DSP Processor
+ EM_MANIK = 171, // M2000 Reconfigurable RISC Microprocessor
+ EM_CRAYNV2 = 172, // Cray Inc. NV2 vector architecture
+ EM_RX = 173, // Renesas RX family
+ EM_METAG = 174, // Imagination Technologies META processor
+ // architecture
+ EM_MCST_ELBRUS = 175, // MCST Elbrus general purpose hardware architecture
+ EM_ECOG16 = 176, // Cyan Technology eCOG16 family
+ EM_CR16 = 177, // National Semiconductor CompactRISC CR16 16-bit
+ // microprocessor
+ EM_ETPU = 178, // Freescale Extended Time Processing Unit
+ EM_SLE9X = 179, // Infineon Technologies SLE9X core
+ EM_L10M = 180, // Intel L10M
+ EM_K10M = 181, // Intel K10M
+ EM_AARCH64 = 183, // ARM AArch64
+ EM_AVR32 = 185, // Atmel Corporation 32-bit microprocessor family
+ EM_STM8 = 186, // STMicroeletronics STM8 8-bit microcontroller
+ EM_TILE64 = 187, // Tilera TILE64 multicore architecture family
+ EM_TILEPRO = 188, // Tilera TILEPro multicore architecture family
+ EM_CUDA = 190, // NVIDIA CUDA architecture
+ EM_TILEGX = 191, // Tilera TILE-Gx multicore architecture family
+ EM_CLOUDSHIELD = 192, // CloudShield architecture family
+ EM_COREA_1ST = 193, // KIPO-KAIST Core-A 1st generation processor family
+ EM_COREA_2ND = 194, // KIPO-KAIST Core-A 2nd generation processor family
+ EM_ARC_COMPACT2 = 195, // Synopsys ARCompact V2
+ EM_OPEN8 = 196, // Open8 8-bit RISC soft processor core
+ EM_RL78 = 197, // Renesas RL78 family
+ EM_VIDEOCORE5 = 198, // Broadcom VideoCore V processor
+ EM_78KOR = 199, // Renesas 78KOR family
+ EM_56800EX = 200, // Freescale 56800EX Digital Signal Controller (DSC)
+ EM_BA1 = 201, // Beyond BA1 CPU architecture
+ EM_BA2 = 202, // Beyond BA2 CPU architecture
+ EM_XCORE = 203, // XMOS xCORE processor family
+ EM_MCHP_PIC = 204, // Microchip 8-bit PIC(r) family
+ EM_INTEL205 = 205, // Reserved by Intel
+ EM_INTEL206 = 206, // Reserved by Intel
+ EM_INTEL207 = 207, // Reserved by Intel
+ EM_INTEL208 = 208, // Reserved by Intel
+ EM_INTEL209 = 209, // Reserved by Intel
+ EM_KM32 = 210, // KM211 KM32 32-bit processor
+ EM_KMX32 = 211, // KM211 KMX32 32-bit processor
+ EM_KMX16 = 212, // KM211 KMX16 16-bit processor
+ EM_KMX8 = 213, // KM211 KMX8 8-bit processor
+ EM_KVARC = 214, // KM211 KVARC processor
+ EM_CDP = 215, // Paneve CDP architecture family
+ EM_COGE = 216, // Cognitive Smart Memory Processor
+ EM_COOL = 217, // iCelero CoolEngine
+ EM_NORC = 218, // Nanoradio Optimized RISC
+ EM_CSR_KALIMBA = 219, // CSR Kalimba architecture family
+ EM_AMDGPU = 224, // AMD GPU architecture
+
+ // A request has been made to the maintainer of the official registry for
+ // such numbers for an official value for WebAssembly. As soon as one is
+ // allocated, this enum will be updated to use it.
+ EM_WEBASSEMBLY = 0x4157, // WebAssembly architecture
+};
+
+// Object file classes.
+enum {
+ ELFCLASSNONE = 0,
+ ELFCLASS32 = 1, // 32-bit object file
+ ELFCLASS64 = 2 // 64-bit object file
+};
+
+// Object file byte orderings.
+enum {
+ ELFDATANONE = 0, // Invalid data encoding.
+ ELFDATA2LSB = 1, // Little-endian object file
+ ELFDATA2MSB = 2 // Big-endian object file
+};
+
+// OS ABI identification.
+enum {
+ ELFOSABI_NONE = 0, // UNIX System V ABI
+ ELFOSABI_HPUX = 1, // HP-UX operating system
+ ELFOSABI_NETBSD = 2, // NetBSD
+ ELFOSABI_GNU = 3, // GNU/Linux
+ ELFOSABI_LINUX = 3, // Historical alias for ELFOSABI_GNU.
+ ELFOSABI_HURD = 4, // GNU/Hurd
+ ELFOSABI_SOLARIS = 6, // Solaris
+ ELFOSABI_AIX = 7, // AIX
+ ELFOSABI_IRIX = 8, // IRIX
+ ELFOSABI_FREEBSD = 9, // FreeBSD
+ ELFOSABI_TRU64 = 10, // TRU64 UNIX
+ ELFOSABI_MODESTO = 11, // Novell Modesto
+ ELFOSABI_OPENBSD = 12, // OpenBSD
+ ELFOSABI_OPENVMS = 13, // OpenVMS
+ ELFOSABI_NSK = 14, // Hewlett-Packard Non-Stop Kernel
+ ELFOSABI_AROS = 15, // AROS
+ ELFOSABI_FENIXOS = 16, // FenixOS
+ ELFOSABI_CLOUDABI = 17, // Nuxi CloudABI
+ ELFOSABI_C6000_ELFABI = 64, // Bare-metal TMS320C6000
+ ELFOSABI_AMDGPU_HSA = 64, // AMD HSA runtime
+ ELFOSABI_C6000_LINUX = 65, // Linux TMS320C6000
+ ELFOSABI_ARM = 97, // ARM
+ ELFOSABI_STANDALONE = 255 // Standalone (embedded) application
+};
+
+#define ELF_RELOC(name, value) name = value,
+
+// Specific e_flags for PPC64
+enum {
+ // e_flags bits specifying ABI:
+ // 1 for original ABI using function descriptors,
+ // 2 for revised ABI without function descriptors,
+ // 0 for unspecified or not using any features affected by the differences.
+ EF_PPC64_ABI = 3
+};
+
+// Special values for the st_other field in the symbol table entry for PPC64.
+enum {
+ STO_PPC64_LOCAL_BIT = 5,
+ STO_PPC64_LOCAL_MASK = (7 << STO_PPC64_LOCAL_BIT)
+};
+static inline int64_t
+decodePPC64LocalEntryOffset(unsigned Other) {
+ unsigned Val = (Other & STO_PPC64_LOCAL_MASK) >> STO_PPC64_LOCAL_BIT;
+ return ((1 << Val) >> 2) << 2;
+}
+static inline unsigned
+encodePPC64LocalEntryOffset(int64_t Offset) {
+ unsigned Val = (Offset >= 4 * 4
+ ? (Offset >= 8 * 4
+ ? (Offset >= 16 * 4 ? 6 : 5)
+ : 4)
+ : (Offset >= 2 * 4
+ ? 3
+ : (Offset >= 1 * 4 ? 2 : 0)));
+ return Val << STO_PPC64_LOCAL_BIT;
+}
+
+// ARM Specific e_flags
+enum : unsigned {
+ EF_ARM_SOFT_FLOAT = 0x00000200U,
+ EF_ARM_VFP_FLOAT = 0x00000400U,
+ EF_ARM_EABI_UNKNOWN = 0x00000000U,
+ EF_ARM_EABI_VER1 = 0x01000000U,
+ EF_ARM_EABI_VER2 = 0x02000000U,
+ EF_ARM_EABI_VER3 = 0x03000000U,
+ EF_ARM_EABI_VER4 = 0x04000000U,
+ EF_ARM_EABI_VER5 = 0x05000000U,
+ EF_ARM_EABIMASK = 0xFF000000U
+};
+
+// AVR specific e_flags
+enum : unsigned {
+ EF_AVR_ARCH_AVR1 = 1,
+ EF_AVR_ARCH_AVR2 = 2,
+ EF_AVR_ARCH_AVR25 = 25,
+ EF_AVR_ARCH_AVR3 = 3,
+ EF_AVR_ARCH_AVR31 = 31,
+ EF_AVR_ARCH_AVR35 = 35,
+ EF_AVR_ARCH_AVR4 = 4,
+ EF_AVR_ARCH_AVR5 = 5,
+ EF_AVR_ARCH_AVR51 = 51,
+ EF_AVR_ARCH_AVR6 = 6,
+ EF_AVR_ARCH_AVRTINY = 100,
+ EF_AVR_ARCH_XMEGA1 = 101,
+ EF_AVR_ARCH_XMEGA2 = 102,
+ EF_AVR_ARCH_XMEGA3 = 103,
+ EF_AVR_ARCH_XMEGA4 = 104,
+ EF_AVR_ARCH_XMEGA5 = 105,
+ EF_AVR_ARCH_XMEGA6 = 106,
+ EF_AVR_ARCH_XMEGA7 = 107
+};
+
+// Mips Specific e_flags
+enum : unsigned {
+ EF_MIPS_NOREORDER = 0x00000001, // Don't reorder instructions
+ EF_MIPS_PIC = 0x00000002, // Position independent code
+ EF_MIPS_CPIC = 0x00000004, // Call object with Position independent code
+ EF_MIPS_ABI2 = 0x00000020, // File uses N32 ABI
+ EF_MIPS_32BITMODE = 0x00000100, // Code compiled for a 64-bit machine
+ // in 32-bit mode
+ EF_MIPS_FP64 = 0x00000200, // Code compiled for a 32-bit machine
+ // but uses 64-bit FP registers
+ EF_MIPS_NAN2008 = 0x00000400, // Uses IEE 754-2008 NaN encoding
+
+ // ABI flags
+ EF_MIPS_ABI_O32 = 0x00001000, // This file follows the first MIPS 32 bit ABI
+ EF_MIPS_ABI_O64 = 0x00002000, // O32 ABI extended for 64-bit architecture.
+ EF_MIPS_ABI_EABI32 = 0x00003000, // EABI in 32 bit mode.
+ EF_MIPS_ABI_EABI64 = 0x00004000, // EABI in 64 bit mode.
+ EF_MIPS_ABI = 0x0000f000, // Mask for selecting EF_MIPS_ABI_ variant.
+
+ // MIPS machine variant
+ EF_MIPS_MACH_3900 = 0x00810000, // Toshiba R3900
+ EF_MIPS_MACH_4010 = 0x00820000, // LSI R4010
+ EF_MIPS_MACH_4100 = 0x00830000, // NEC VR4100
+ EF_MIPS_MACH_4650 = 0x00850000, // MIPS R4650
+ EF_MIPS_MACH_4120 = 0x00870000, // NEC VR4120
+ EF_MIPS_MACH_4111 = 0x00880000, // NEC VR4111/VR4181
+ EF_MIPS_MACH_SB1 = 0x008a0000, // Broadcom SB-1
+ EF_MIPS_MACH_OCTEON = 0x008b0000, // Cavium Networks Octeon
+ EF_MIPS_MACH_XLR = 0x008c0000, // RMI Xlr
+ EF_MIPS_MACH_OCTEON2 = 0x008d0000, // Cavium Networks Octeon2
+ EF_MIPS_MACH_OCTEON3 = 0x008e0000, // Cavium Networks Octeon3
+ EF_MIPS_MACH_5400 = 0x00910000, // NEC VR5400
+ EF_MIPS_MACH_5900 = 0x00920000, // MIPS R5900
+ EF_MIPS_MACH_5500 = 0x00980000, // NEC VR5500
+ EF_MIPS_MACH_9000 = 0x00990000, // Unknown
+ EF_MIPS_MACH_LS2E = 0x00a00000, // ST Microelectronics Loongson 2E
+ EF_MIPS_MACH_LS2F = 0x00a10000, // ST Microelectronics Loongson 2F
+ EF_MIPS_MACH_LS3A = 0x00a20000, // Loongson 3A
+ EF_MIPS_MACH = 0x00ff0000, // EF_MIPS_MACH_xxx selection mask
+
+ // ARCH_ASE
+ EF_MIPS_MICROMIPS = 0x02000000, // microMIPS
+ EF_MIPS_ARCH_ASE_M16 =
+ 0x04000000, // Has Mips-16 ISA extensions
+ EF_MIPS_ARCH_ASE_MDMX =
+ 0x08000000, // Has MDMX multimedia extensions
+ EF_MIPS_ARCH_ASE = 0x0f000000, // Mask for EF_MIPS_ARCH_ASE_xxx flags
+
+ // ARCH
+ EF_MIPS_ARCH_1 = 0x00000000, // MIPS1 instruction set
+ EF_MIPS_ARCH_2 = 0x10000000, // MIPS2 instruction set
+ EF_MIPS_ARCH_3 = 0x20000000, // MIPS3 instruction set
+ EF_MIPS_ARCH_4 = 0x30000000, // MIPS4 instruction set
+ EF_MIPS_ARCH_5 = 0x40000000, // MIPS5 instruction set
+ EF_MIPS_ARCH_32 = 0x50000000, // MIPS32 instruction set per linux not elf.h
+ EF_MIPS_ARCH_64 = 0x60000000, // MIPS64 instruction set per linux not elf.h
+ EF_MIPS_ARCH_32R2 = 0x70000000, // mips32r2, mips32r3, mips32r5
+ EF_MIPS_ARCH_64R2 = 0x80000000, // mips64r2, mips64r3, mips64r5
+ EF_MIPS_ARCH_32R6 = 0x90000000, // mips32r6
+ EF_MIPS_ARCH_64R6 = 0xa0000000, // mips64r6
+ EF_MIPS_ARCH = 0xf0000000 // Mask for applying EF_MIPS_ARCH_ variant
+};
+
+// Special values for the st_other field in the symbol table entry for MIPS.
+enum {
+ STO_MIPS_OPTIONAL = 0x04, // Symbol whose definition is optional
+ STO_MIPS_PLT = 0x08, // PLT entry related dynamic table record
+ STO_MIPS_PIC = 0x20, // PIC func in an object mixes PIC/non-PIC
+ STO_MIPS_MICROMIPS = 0x80, // MIPS Specific ISA for MicroMips
+ STO_MIPS_MIPS16 = 0xf0 // MIPS Specific ISA for Mips16
+};
+
+// .MIPS.options section descriptor kinds
+enum {
+ ODK_NULL = 0, // Undefined
+ ODK_REGINFO = 1, // Register usage information
+ ODK_EXCEPTIONS = 2, // Exception processing options
+ ODK_PAD = 3, // Section padding options
+ ODK_HWPATCH = 4, // Hardware patches applied
+ ODK_FILL = 5, // Linker fill value
+ ODK_TAGS = 6, // Space for tool identification
+ ODK_HWAND = 7, // Hardware AND patches applied
+ ODK_HWOR = 8, // Hardware OR patches applied
+ ODK_GP_GROUP = 9, // GP group to use for text/data sections
+ ODK_IDENT = 10, // ID information
+ ODK_PAGESIZE = 11 // Page size information
+};
+
+// Hexagon-specific e_flags
+enum {
+ // Object processor version flags, bits[11:0]
+ EF_HEXAGON_MACH_V2 = 0x00000001, // Hexagon V2
+ EF_HEXAGON_MACH_V3 = 0x00000002, // Hexagon V3
+ EF_HEXAGON_MACH_V4 = 0x00000003, // Hexagon V4
+ EF_HEXAGON_MACH_V5 = 0x00000004, // Hexagon V5
+ EF_HEXAGON_MACH_V55 = 0x00000005, // Hexagon V55
+ EF_HEXAGON_MACH_V60 = 0x00000060, // Hexagon V60
+
+ // Highest ISA version flags
+ EF_HEXAGON_ISA_MACH = 0x00000000, // Same as specified in bits[11:0]
+ // of e_flags
+ EF_HEXAGON_ISA_V2 = 0x00000010, // Hexagon V2 ISA
+ EF_HEXAGON_ISA_V3 = 0x00000020, // Hexagon V3 ISA
+ EF_HEXAGON_ISA_V4 = 0x00000030, // Hexagon V4 ISA
+ EF_HEXAGON_ISA_V5 = 0x00000040, // Hexagon V5 ISA
+ EF_HEXAGON_ISA_V55 = 0x00000050, // Hexagon V55 ISA
+ EF_HEXAGON_ISA_V60 = 0x00000060, // Hexagon V60 ISA
+};
+
+// Hexagon-specific section indexes for common small data
+enum {
+ SHN_HEXAGON_SCOMMON = 0xff00, // Other access sizes
+ SHN_HEXAGON_SCOMMON_1 = 0xff01, // Byte-sized access
+ SHN_HEXAGON_SCOMMON_2 = 0xff02, // Half-word-sized access
+ SHN_HEXAGON_SCOMMON_4 = 0xff03, // Word-sized access
+ SHN_HEXAGON_SCOMMON_8 = 0xff04 // Double-word-size access
+};
+
+
+#undef ELF_RELOC
+
+// Section header.
+struct Elf32_Shdr {
+ Elf32_Word sh_name; // Section name (index into string table)
+ Elf32_Word sh_type; // Section type (SHT_*)
+ Elf32_Word sh_flags; // Section flags (SHF_*)
+ Elf32_Addr sh_addr; // Address where section is to be loaded
+ Elf32_Off sh_offset; // File offset of section data, in bytes
+ Elf32_Word sh_size; // Size of section, in bytes
+ Elf32_Word sh_link; // Section type-specific header table index link
+ Elf32_Word sh_info; // Section type-specific extra information
+ Elf32_Word sh_addralign; // Section address alignment
+ Elf32_Word sh_entsize; // Size of records contained within the section
+};
+
+// Section header for ELF64 - same fields as ELF32, different types.
+struct Elf64_Shdr {
+ Elf64_Word sh_name;
+ Elf64_Word sh_type;
+ Elf64_Xword sh_flags;
+ Elf64_Addr sh_addr;
+ Elf64_Off sh_offset;
+ Elf64_Xword sh_size;
+ Elf64_Word sh_link;
+ Elf64_Word sh_info;
+ Elf64_Xword sh_addralign;
+ Elf64_Xword sh_entsize;
+};
+
+// Special section indices.
+enum {
+ SHN_UNDEF = 0, // Undefined, missing, irrelevant, or meaningless
+ SHN_LORESERVE = 0xff00, // Lowest reserved index
+ SHN_LOPROC = 0xff00, // Lowest processor-specific index
+ SHN_HIPROC = 0xff1f, // Highest processor-specific index
+ SHN_LOOS = 0xff20, // Lowest operating system-specific index
+ SHN_HIOS = 0xff3f, // Highest operating system-specific index
+ SHN_ABS = 0xfff1, // Symbol has absolute value; does not need relocation
+ SHN_COMMON = 0xfff2, // FORTRAN COMMON or C external global variables
+ SHN_XINDEX = 0xffff, // Mark that the index is >= SHN_LORESERVE
+ SHN_HIRESERVE = 0xffff // Highest reserved index
+};
+
+// Section types.
+enum : unsigned {
+ SHT_NULL = 0, // No associated section (inactive entry).
+ SHT_PROGBITS = 1, // Program-defined contents.
+ SHT_SYMTAB = 2, // Symbol table.
+ SHT_STRTAB = 3, // String table.
+ SHT_RELA = 4, // Relocation entries; explicit addends.
+ SHT_HASH = 5, // Symbol hash table.
+ SHT_DYNAMIC = 6, // Information for dynamic linking.
+ SHT_NOTE = 7, // Information about the file.
+ SHT_NOBITS = 8, // Data occupies no space in the file.
+ SHT_REL = 9, // Relocation entries; no explicit addends.
+ SHT_SHLIB = 10, // Reserved.
+ SHT_DYNSYM = 11, // Symbol table.
+ SHT_INIT_ARRAY = 14, // Pointers to initialization functions.
+ SHT_FINI_ARRAY = 15, // Pointers to termination functions.
+ SHT_PREINIT_ARRAY = 16, // Pointers to pre-init functions.
+ SHT_GROUP = 17, // Section group.
+ SHT_SYMTAB_SHNDX = 18, // Indices for SHN_XINDEX entries.
+ SHT_LOOS = 0x60000000, // Lowest operating system-specific type.
+ SHT_GNU_ATTRIBUTES= 0x6ffffff5, // Object attributes.
+ SHT_GNU_HASH = 0x6ffffff6, // GNU-style hash table.
+ SHT_GNU_verdef = 0x6ffffffd, // GNU version definitions.
+ SHT_GNU_verneed = 0x6ffffffe, // GNU version references.
+ SHT_GNU_versym = 0x6fffffff, // GNU symbol versions table.
+ SHT_HIOS = 0x6fffffff, // Highest operating system-specific type.
+ SHT_LOPROC = 0x70000000, // Lowest processor arch-specific type.
+ // Fixme: All this is duplicated in MCSectionELF. Why??
+ // Exception Index table
+ SHT_ARM_EXIDX = 0x70000001U,
+ // BPABI DLL dynamic linking pre-emption map
+ SHT_ARM_PREEMPTMAP = 0x70000002U,
+ // Object file compatibility attributes
+ SHT_ARM_ATTRIBUTES = 0x70000003U,
+ SHT_ARM_DEBUGOVERLAY = 0x70000004U,
+ SHT_ARM_OVERLAYSECTION = 0x70000005U,
+ SHT_HEX_ORDERED = 0x70000000, // Link editor is to sort the entries in
+ // this section based on their sizes
+ SHT_X86_64_UNWIND = 0x70000001, // Unwind information
+
+ SHT_MIPS_REGINFO = 0x70000006, // Register usage information
+ SHT_MIPS_OPTIONS = 0x7000000d, // General options
+ SHT_MIPS_ABIFLAGS = 0x7000002a, // ABI information.
+
+ SHT_HIPROC = 0x7fffffff, // Highest processor arch-specific type.
+ SHT_LOUSER = 0x80000000, // Lowest type reserved for applications.
+ SHT_HIUSER = 0xffffffff // Highest type reserved for applications.
+};
+
+// Section flags.
+enum : unsigned {
+ // Section data should be writable during execution.
+ SHF_WRITE = 0x1,
+
+ // Section occupies memory during program execution.
+ SHF_ALLOC = 0x2,
+
+ // Section contains executable machine instructions.
+ SHF_EXECINSTR = 0x4,
+
+ // The data in this section may be merged.
+ SHF_MERGE = 0x10,
+
+ // The data in this section is null-terminated strings.
+ SHF_STRINGS = 0x20,
+
+ // A field in this section holds a section header table index.
+ SHF_INFO_LINK = 0x40U,
+
+ // Adds special ordering requirements for link editors.
+ SHF_LINK_ORDER = 0x80U,
+
+ // This section requires special OS-specific processing to avoid incorrect
+ // behavior.
+ SHF_OS_NONCONFORMING = 0x100U,
+
+ // This section is a member of a section group.
+ SHF_GROUP = 0x200U,
+
+ // This section holds Thread-Local Storage.
+ SHF_TLS = 0x400U,
+
+ // This section is excluded from the final executable or shared library.
+ SHF_EXCLUDE = 0x80000000U,
+
+ // Start of target-specific flags.
+
+ /// XCORE_SHF_CP_SECTION - All sections with the "c" flag are grouped
+ /// together by the linker to form the constant pool and the cp register is
+ /// set to the start of the constant pool by the boot code.
+ XCORE_SHF_CP_SECTION = 0x800U,
+
+ /// XCORE_SHF_DP_SECTION - All sections with the "d" flag are grouped
+ /// together by the linker to form the data section and the dp register is
+ /// set to the start of the section by the boot code.
+ XCORE_SHF_DP_SECTION = 0x1000U,
+
+ SHF_MASKOS = 0x0ff00000,
+
+ // Bits indicating processor-specific flags.
+ SHF_MASKPROC = 0xf0000000,
+
+ // If an object file section does not have this flag set, then it may not hold
+ // more than 2GB and can be freely referred to in objects using smaller code
+ // models. Otherwise, only objects using larger code models can refer to them.
+ // For example, a medium code model object can refer to data in a section that
+ // sets this flag besides being able to refer to data in a section that does
+ // not set it; likewise, a small code model object can refer only to code in a
+ // section that does not set this flag.
+ SHF_X86_64_LARGE = 0x10000000,
+
+ // All sections with the GPREL flag are grouped into a global data area
+ // for faster accesses
+ SHF_HEX_GPREL = 0x10000000,
+
+ // Section contains text/data which may be replicated in other sections.
+ // Linker must retain only one copy.
+ SHF_MIPS_NODUPES = 0x01000000,
+
+ // Linker must generate implicit hidden weak names.
+ SHF_MIPS_NAMES = 0x02000000,
+
+ // Section data local to process.
+ SHF_MIPS_LOCAL = 0x04000000,
+
+ // Do not strip this section.
+ SHF_MIPS_NOSTRIP = 0x08000000,
+
+ // Section must be part of global data area.
+ SHF_MIPS_GPREL = 0x10000000,
+
+ // This section should be merged.
+ SHF_MIPS_MERGE = 0x20000000,
+
+ // Address size to be inferred from section entry size.
+ SHF_MIPS_ADDR = 0x40000000,
+
+ // Section data is string data by default.
+ SHF_MIPS_STRING = 0x80000000,
+
+ SHF_AMDGPU_HSA_GLOBAL = 0x00100000,
+ SHF_AMDGPU_HSA_READONLY = 0x00200000,
+ SHF_AMDGPU_HSA_CODE = 0x00400000,
+ SHF_AMDGPU_HSA_AGENT = 0x00800000
+};
+
+// Section Group Flags
+enum : unsigned {
+ GRP_COMDAT = 0x1,
+ GRP_MASKOS = 0x0ff00000,
+ GRP_MASKPROC = 0xf0000000
+};
+
+// Symbol table entries for ELF32.
+struct Elf32_Sym {
+ Elf32_Word st_name; // Symbol name (index into string table)
+ Elf32_Addr st_value; // Value or address associated with the symbol
+ Elf32_Word st_size; // Size of the symbol
+ unsigned char st_info; // Symbol's type and binding attributes
+ unsigned char st_other; // Must be zero; reserved
+ Elf32_Half st_shndx; // Which section (header table index) it's defined in
+
+ // These accessors and mutators correspond to the ELF32_ST_BIND,
+ // ELF32_ST_TYPE, and ELF32_ST_INFO macros defined in the ELF specification:
+ unsigned char getBinding() const { return st_info >> 4; }
+ unsigned char getType() const { return st_info & 0x0f; }
+ void setBinding(unsigned char b) { setBindingAndType(b, getType()); }
+ void setType(unsigned char t) { setBindingAndType(getBinding(), t); }
+ void setBindingAndType(unsigned char b, unsigned char t) {
+ st_info = (b << 4) + (t & 0x0f);
+ }
+};
+
+// Symbol table entries for ELF64.
+struct Elf64_Sym {
+ Elf64_Word st_name; // Symbol name (index into string table)
+ unsigned char st_info; // Symbol's type and binding attributes
+ unsigned char st_other; // Must be zero; reserved
+ Elf64_Half st_shndx; // Which section (header tbl index) it's defined in
+ Elf64_Addr st_value; // Value or address associated with the symbol
+ Elf64_Xword st_size; // Size of the symbol
+
+ // These accessors and mutators are identical to those defined for ELF32
+ // symbol table entries.
+ unsigned char getBinding() const { return st_info >> 4; }
+ unsigned char getType() const { return st_info & 0x0f; }
+ void setBinding(unsigned char b) { setBindingAndType(b, getType()); }
+ void setType(unsigned char t) { setBindingAndType(getBinding(), t); }
+ void setBindingAndType(unsigned char b, unsigned char t) {
+ st_info = (b << 4) + (t & 0x0f);
+ }
+};
+
+// The size (in bytes) of symbol table entries.
+enum {
+ SYMENTRY_SIZE32 = 16, // 32-bit symbol entry size
+ SYMENTRY_SIZE64 = 24 // 64-bit symbol entry size.
+};
+
+// Symbol bindings.
+enum {
+ STB_LOCAL = 0, // Local symbol, not visible outside obj file containing def
+ STB_GLOBAL = 1, // Global symbol, visible to all object files being combined
+ STB_WEAK = 2, // Weak symbol, like global but lower-precedence
+ STB_GNU_UNIQUE = 10,
+ STB_LOOS = 10, // Lowest operating system-specific binding type
+ STB_HIOS = 12, // Highest operating system-specific binding type
+ STB_LOPROC = 13, // Lowest processor-specific binding type
+ STB_HIPROC = 15 // Highest processor-specific binding type
+};
+
+// Symbol types.
+enum {
+ STT_NOTYPE = 0, // Symbol's type is not specified
+ STT_OBJECT = 1, // Symbol is a data object (variable, array, etc.)
+ STT_FUNC = 2, // Symbol is executable code (function, etc.)
+ STT_SECTION = 3, // Symbol refers to a section
+ STT_FILE = 4, // Local, absolute symbol that refers to a file
+ STT_COMMON = 5, // An uninitialized common block
+ STT_TLS = 6, // Thread local data object
+ STT_GNU_IFUNC = 10, // GNU indirect function
+ STT_LOOS = 10, // Lowest operating system-specific symbol type
+ STT_HIOS = 12, // Highest operating system-specific symbol type
+ STT_LOPROC = 13, // Lowest processor-specific symbol type
+ STT_HIPROC = 15, // Highest processor-specific symbol type
+
+ // AMDGPU symbol types
+ STT_AMDGPU_HSA_KERNEL = 10,
+ STT_AMDGPU_HSA_INDIRECT_FUNCTION = 11,
+ STT_AMDGPU_HSA_METADATA = 12
+};
+
+enum {
+ STV_DEFAULT = 0, // Visibility is specified by binding type
+ STV_INTERNAL = 1, // Defined by processor supplements
+ STV_HIDDEN = 2, // Not visible to other components
+ STV_PROTECTED = 3 // Visible in other components but not preemptable
+};
+
+// Symbol number.
+enum {
+ STN_UNDEF = 0
+};
+
+// Special relocation symbols used in the MIPS64 ELF relocation entries
+enum {
+ RSS_UNDEF = 0, // None
+ RSS_GP = 1, // Value of gp
+ RSS_GP0 = 2, // Value of gp used to create object being relocated
+ RSS_LOC = 3 // Address of location being relocated
+};
+
+// Relocation entry, without explicit addend.
+struct Elf32_Rel {
+ Elf32_Addr r_offset; // Location (file byte offset, or program virtual addr)
+ Elf32_Word r_info; // Symbol table index and type of relocation to apply
+
+ // These accessors and mutators correspond to the ELF32_R_SYM, ELF32_R_TYPE,
+ // and ELF32_R_INFO macros defined in the ELF specification:
+ Elf32_Word getSymbol() const { return (r_info >> 8); }
+ unsigned char getType() const { return (unsigned char) (r_info & 0x0ff); }
+ void setSymbol(Elf32_Word s) { setSymbolAndType(s, getType()); }
+ void setType(unsigned char t) { setSymbolAndType(getSymbol(), t); }
+ void setSymbolAndType(Elf32_Word s, unsigned char t) {
+ r_info = (s << 8) + t;
+ }
+};
+
+// Relocation entry with explicit addend.
+struct Elf32_Rela {
+ Elf32_Addr r_offset; // Location (file byte offset, or program virtual addr)
+ Elf32_Word r_info; // Symbol table index and type of relocation to apply
+ Elf32_Sword r_addend; // Compute value for relocatable field by adding this
+
+ // These accessors and mutators correspond to the ELF32_R_SYM, ELF32_R_TYPE,
+ // and ELF32_R_INFO macros defined in the ELF specification:
+ Elf32_Word getSymbol() const { return (r_info >> 8); }
+ unsigned char getType() const { return (unsigned char) (r_info & 0x0ff); }
+ void setSymbol(Elf32_Word s) { setSymbolAndType(s, getType()); }
+ void setType(unsigned char t) { setSymbolAndType(getSymbol(), t); }
+ void setSymbolAndType(Elf32_Word s, unsigned char t) {
+ r_info = (s << 8) + t;
+ }
+};
+
+// Relocation entry, without explicit addend.
+struct Elf64_Rel {
+ Elf64_Addr r_offset; // Location (file byte offset, or program virtual addr).
+ Elf64_Xword r_info; // Symbol table index and type of relocation to apply.
+
+ // These accessors and mutators correspond to the ELF64_R_SYM, ELF64_R_TYPE,
+ // and ELF64_R_INFO macros defined in the ELF specification:
+ Elf64_Word getSymbol() const { return (r_info >> 32); }
+ Elf64_Word getType() const {
+ return (Elf64_Word) (r_info & 0xffffffffL);
+ }
+ void setSymbol(Elf64_Word s) { setSymbolAndType(s, getType()); }
+ void setType(Elf64_Word t) { setSymbolAndType(getSymbol(), t); }
+ void setSymbolAndType(Elf64_Word s, Elf64_Word t) {
+ r_info = ((Elf64_Xword)s << 32) + (t&0xffffffffL);
+ }
+};
+
+// Relocation entry with explicit addend.
+struct Elf64_Rela {
+ Elf64_Addr r_offset; // Location (file byte offset, or program virtual addr).
+ Elf64_Xword r_info; // Symbol table index and type of relocation to apply.
+ Elf64_Sxword r_addend; // Compute value for relocatable field by adding this.
+
+ // These accessors and mutators correspond to the ELF64_R_SYM, ELF64_R_TYPE,
+ // and ELF64_R_INFO macros defined in the ELF specification:
+ Elf64_Word getSymbol() const { return (r_info >> 32); }
+ Elf64_Word getType() const {
+ return (Elf64_Word) (r_info & 0xffffffffL);
+ }
+ void setSymbol(Elf64_Word s) { setSymbolAndType(s, getType()); }
+ void setType(Elf64_Word t) { setSymbolAndType(getSymbol(), t); }
+ void setSymbolAndType(Elf64_Word s, Elf64_Word t) {
+ r_info = ((Elf64_Xword)s << 32) + (t&0xffffffffL);
+ }
+};
+
+// Program header for ELF32.
+struct Elf32_Phdr {
+ Elf32_Word p_type; // Type of segment
+ Elf32_Off p_offset; // File offset where segment is located, in bytes
+ Elf32_Addr p_vaddr; // Virtual address of beginning of segment
+ Elf32_Addr p_paddr; // Physical address of beginning of segment (OS-specific)
+ Elf32_Word p_filesz; // Num. of bytes in file image of segment (may be zero)
+ Elf32_Word p_memsz; // Num. of bytes in mem image of segment (may be zero)
+ Elf32_Word p_flags; // Segment flags
+ Elf32_Word p_align; // Segment alignment constraint
+};
+
+// Program header for ELF64.
+struct Elf64_Phdr {
+ Elf64_Word p_type; // Type of segment
+ Elf64_Word p_flags; // Segment flags
+ Elf64_Off p_offset; // File offset where segment is located, in bytes
+ Elf64_Addr p_vaddr; // Virtual address of beginning of segment
+ Elf64_Addr p_paddr; // Physical addr of beginning of segment (OS-specific)
+ Elf64_Xword p_filesz; // Num. of bytes in file image of segment (may be zero)
+ Elf64_Xword p_memsz; // Num. of bytes in mem image of segment (may be zero)
+ Elf64_Xword p_align; // Segment alignment constraint
+};
+
+// Segment types.
+enum {
+ PT_NULL = 0, // Unused segment.
+ PT_LOAD = 1, // Loadable segment.
+ PT_DYNAMIC = 2, // Dynamic linking information.
+ PT_INTERP = 3, // Interpreter pathname.
+ PT_NOTE = 4, // Auxiliary information.
+ PT_SHLIB = 5, // Reserved.
+ PT_PHDR = 6, // The program header table itself.
+ PT_TLS = 7, // The thread-local storage template.
+ PT_LOOS = 0x60000000, // Lowest operating system-specific pt entry type.
+ PT_HIOS = 0x6fffffff, // Highest operating system-specific pt entry type.
+ PT_LOPROC = 0x70000000, // Lowest processor-specific program hdr entry type.
+ PT_HIPROC = 0x7fffffff, // Highest processor-specific program hdr entry type.
+
+ // x86-64 program header types.
+ // These all contain stack unwind tables.
+ PT_GNU_EH_FRAME = 0x6474e550,
+ PT_SUNW_EH_FRAME = 0x6474e550,
+ PT_SUNW_UNWIND = 0x6464e550,
+
+ PT_GNU_STACK = 0x6474e551, // Indicates stack executability.
+ PT_GNU_RELRO = 0x6474e552, // Read-only after relocation.
+
+ // ARM program header types.
+ PT_ARM_ARCHEXT = 0x70000000, // Platform architecture compatibility info
+ // These all contain stack unwind tables.
+ PT_ARM_EXIDX = 0x70000001,
+ PT_ARM_UNWIND = 0x70000001,
+
+ // MIPS program header types.
+ PT_MIPS_REGINFO = 0x70000000, // Register usage information.
+ PT_MIPS_RTPROC = 0x70000001, // Runtime procedure table.
+ PT_MIPS_OPTIONS = 0x70000002, // Options segment.
+ PT_MIPS_ABIFLAGS = 0x70000003, // Abiflags segment.
+
+ // AMDGPU program header types.
+ PT_AMDGPU_HSA_LOAD_GLOBAL_PROGRAM = 0x60000000,
+ PT_AMDGPU_HSA_LOAD_GLOBAL_AGENT = 0x60000001,
+ PT_AMDGPU_HSA_LOAD_READONLY_AGENT = 0x60000002,
+ PT_AMDGPU_HSA_LOAD_CODE_AGENT = 0x60000003,
+
+ // WebAssembly program header types.
+ PT_WEBASSEMBLY_FUNCTIONS = PT_LOPROC + 0, // Function definitions.
+};
+
+// Segment flag bits.
+enum : unsigned {
+ PF_X = 1, // Execute
+ PF_W = 2, // Write
+ PF_R = 4, // Read
+ PF_MASKOS = 0x0ff00000,// Bits for operating system-specific semantics.
+ PF_MASKPROC = 0xf0000000 // Bits for processor-specific semantics.
+};
+
+// Dynamic table entry for ELF32.
+struct Elf32_Dyn
+{
+ Elf32_Sword d_tag; // Type of dynamic table entry.
+ union
+ {
+ Elf32_Word d_val; // Integer value of entry.
+ Elf32_Addr d_ptr; // Pointer value of entry.
+ } d_un;
+};
+
+// Dynamic table entry for ELF64.
+struct Elf64_Dyn
+{
+ Elf64_Sxword d_tag; // Type of dynamic table entry.
+ union
+ {
+ Elf64_Xword d_val; // Integer value of entry.
+ Elf64_Addr d_ptr; // Pointer value of entry.
+ } d_un;
+};
+
+// Dynamic table entry tags.
+enum {
+ DT_NULL = 0, // Marks end of dynamic array.
+ DT_NEEDED = 1, // String table offset of needed library.
+ DT_PLTRELSZ = 2, // Size of relocation entries in PLT.
+ DT_PLTGOT = 3, // Address associated with linkage table.
+ DT_HASH = 4, // Address of symbolic hash table.
+ DT_STRTAB = 5, // Address of dynamic string table.
+ DT_SYMTAB = 6, // Address of dynamic symbol table.
+ DT_RELA = 7, // Address of relocation table (Rela entries).
+ DT_RELASZ = 8, // Size of Rela relocation table.
+ DT_RELAENT = 9, // Size of a Rela relocation entry.
+ DT_STRSZ = 10, // Total size of the string table.
+ DT_SYMENT = 11, // Size of a symbol table entry.
+ DT_INIT = 12, // Address of initialization function.
+ DT_FINI = 13, // Address of termination function.
+ DT_SONAME = 14, // String table offset of a shared objects name.
+ DT_RPATH = 15, // String table offset of library search path.
+ DT_SYMBOLIC = 16, // Changes symbol resolution algorithm.
+ DT_REL = 17, // Address of relocation table (Rel entries).
+ DT_RELSZ = 18, // Size of Rel relocation table.
+ DT_RELENT = 19, // Size of a Rel relocation entry.
+ DT_PLTREL = 20, // Type of relocation entry used for linking.
+ DT_DEBUG = 21, // Reserved for debugger.
+ DT_TEXTREL = 22, // Relocations exist for non-writable segments.
+ DT_JMPREL = 23, // Address of relocations associated with PLT.
+ DT_BIND_NOW = 24, // Process all relocations before execution.
+ DT_INIT_ARRAY = 25, // Pointer to array of initialization functions.
+ DT_FINI_ARRAY = 26, // Pointer to array of termination functions.
+ DT_INIT_ARRAYSZ = 27, // Size of DT_INIT_ARRAY.
+ DT_FINI_ARRAYSZ = 28, // Size of DT_FINI_ARRAY.
+ DT_RUNPATH = 29, // String table offset of lib search path.
+ DT_FLAGS = 30, // Flags.
+ DT_ENCODING = 32, // Values from here to DT_LOOS follow the rules
+ // for the interpretation of the d_un union.
+
+ DT_PREINIT_ARRAY = 32, // Pointer to array of preinit functions.
+ DT_PREINIT_ARRAYSZ = 33, // Size of the DT_PREINIT_ARRAY array.
+
+ DT_LOOS = 0x60000000, // Start of environment specific tags.
+ DT_HIOS = 0x6FFFFFFF, // End of environment specific tags.
+ DT_LOPROC = 0x70000000, // Start of processor specific tags.
+ DT_HIPROC = 0x7FFFFFFF, // End of processor specific tags.
+
+ DT_GNU_HASH = 0x6FFFFEF5, // Reference to the GNU hash table.
+ DT_RELACOUNT = 0x6FFFFFF9, // ELF32_Rela count.
+ DT_RELCOUNT = 0x6FFFFFFA, // ELF32_Rel count.
+
+ DT_FLAGS_1 = 0X6FFFFFFB, // Flags_1.
+ DT_VERSYM = 0x6FFFFFF0, // The address of .gnu.version section.
+ DT_VERDEF = 0X6FFFFFFC, // The address of the version definition table.
+ DT_VERDEFNUM = 0X6FFFFFFD, // The number of entries in DT_VERDEF.
+ DT_VERNEED = 0X6FFFFFFE, // The address of the version Dependency table.
+ DT_VERNEEDNUM = 0X6FFFFFFF, // The number of entries in DT_VERNEED.
+
+ // Mips specific dynamic table entry tags.
+ DT_MIPS_RLD_VERSION = 0x70000001, // 32 bit version number for runtime
+ // linker interface.
+ DT_MIPS_TIME_STAMP = 0x70000002, // Time stamp.
+ DT_MIPS_ICHECKSUM = 0x70000003, // Checksum of external strings
+ // and common sizes.
+ DT_MIPS_IVERSION = 0x70000004, // Index of version string
+ // in string table.
+ DT_MIPS_FLAGS = 0x70000005, // 32 bits of flags.
+ DT_MIPS_BASE_ADDRESS = 0x70000006, // Base address of the segment.
+ DT_MIPS_MSYM = 0x70000007, // Address of .msym section.
+ DT_MIPS_CONFLICT = 0x70000008, // Address of .conflict section.
+ DT_MIPS_LIBLIST = 0x70000009, // Address of .liblist section.
+ DT_MIPS_LOCAL_GOTNO = 0x7000000a, // Number of local global offset
+ // table entries.
+ DT_MIPS_CONFLICTNO = 0x7000000b, // Number of entries
+ // in the .conflict section.
+ DT_MIPS_LIBLISTNO = 0x70000010, // Number of entries
+ // in the .liblist section.
+ DT_MIPS_SYMTABNO = 0x70000011, // Number of entries
+ // in the .dynsym section.
+ DT_MIPS_UNREFEXTNO = 0x70000012, // Index of first external dynamic symbol
+ // not referenced locally.
+ DT_MIPS_GOTSYM = 0x70000013, // Index of first dynamic symbol
+ // in global offset table.
+ DT_MIPS_HIPAGENO = 0x70000014, // Number of page table entries
+ // in global offset table.
+ DT_MIPS_RLD_MAP = 0x70000016, // Address of run time loader map,
+ // used for debugging.
+ DT_MIPS_DELTA_CLASS = 0x70000017, // Delta C++ class definition.
+ DT_MIPS_DELTA_CLASS_NO = 0x70000018, // Number of entries
+ // in DT_MIPS_DELTA_CLASS.
+ DT_MIPS_DELTA_INSTANCE = 0x70000019, // Delta C++ class instances.
+ DT_MIPS_DELTA_INSTANCE_NO = 0x7000001A, // Number of entries
+ // in DT_MIPS_DELTA_INSTANCE.
+ DT_MIPS_DELTA_RELOC = 0x7000001B, // Delta relocations.
+ DT_MIPS_DELTA_RELOC_NO = 0x7000001C, // Number of entries
+ // in DT_MIPS_DELTA_RELOC.
+ DT_MIPS_DELTA_SYM = 0x7000001D, // Delta symbols that Delta
+ // relocations refer to.
+ DT_MIPS_DELTA_SYM_NO = 0x7000001E, // Number of entries
+ // in DT_MIPS_DELTA_SYM.
+ DT_MIPS_DELTA_CLASSSYM = 0x70000020, // Delta symbols that hold
+ // class declarations.
+ DT_MIPS_DELTA_CLASSSYM_NO = 0x70000021, // Number of entries
+ // in DT_MIPS_DELTA_CLASSSYM.
+ DT_MIPS_CXX_FLAGS = 0x70000022, // Flags indicating information
+ // about C++ flavor.
+ DT_MIPS_PIXIE_INIT = 0x70000023, // Pixie information.
+ DT_MIPS_SYMBOL_LIB = 0x70000024, // Address of .MIPS.symlib
+ DT_MIPS_LOCALPAGE_GOTIDX = 0x70000025, // The GOT index of the first PTE
+ // for a segment
+ DT_MIPS_LOCAL_GOTIDX = 0x70000026, // The GOT index of the first PTE
+ // for a local symbol
+ DT_MIPS_HIDDEN_GOTIDX = 0x70000027, // The GOT index of the first PTE
+ // for a hidden symbol
+ DT_MIPS_PROTECTED_GOTIDX = 0x70000028, // The GOT index of the first PTE
+ // for a protected symbol
+ DT_MIPS_OPTIONS = 0x70000029, // Address of `.MIPS.options'.
+ DT_MIPS_INTERFACE = 0x7000002A, // Address of `.interface'.
+ DT_MIPS_DYNSTR_ALIGN = 0x7000002B, // Unknown.
+ DT_MIPS_INTERFACE_SIZE = 0x7000002C, // Size of the .interface section.
+ DT_MIPS_RLD_TEXT_RESOLVE_ADDR = 0x7000002D, // Size of rld_text_resolve
+ // function stored in the GOT.
+ DT_MIPS_PERF_SUFFIX = 0x7000002E, // Default suffix of DSO to be added
+ // by rld on dlopen() calls.
+ DT_MIPS_COMPACT_SIZE = 0x7000002F, // Size of compact relocation
+ // section (O32).
+ DT_MIPS_GP_VALUE = 0x70000030, // GP value for auxiliary GOTs.
+ DT_MIPS_AUX_DYNAMIC = 0x70000031, // Address of auxiliary .dynamic.
+ DT_MIPS_PLTGOT = 0x70000032, // Address of the base of the PLTGOT.
+ DT_MIPS_RWPLT = 0x70000034, // Points to the base
+ // of a writable PLT.
+ DT_MIPS_RLD_MAP_REL = 0x70000035 // Relative offset of run time loader
+ // map, used for debugging.
+};
+
+// DT_FLAGS values.
+enum {
+ DF_ORIGIN = 0x01, // The object may reference $ORIGIN.
+ DF_SYMBOLIC = 0x02, // Search the shared lib before searching the exe.
+ DF_TEXTREL = 0x04, // Relocations may modify a non-writable segment.
+ DF_BIND_NOW = 0x08, // Process all relocations on load.
+ DF_STATIC_TLS = 0x10 // Reject attempts to load dynamically.
+};
+
+// State flags selectable in the `d_un.d_val' element of the DT_FLAGS_1 entry.
+enum {
+ DF_1_NOW = 0x00000001, // Set RTLD_NOW for this object.
+ DF_1_GLOBAL = 0x00000002, // Set RTLD_GLOBAL for this object.
+ DF_1_GROUP = 0x00000004, // Set RTLD_GROUP for this object.
+ DF_1_NODELETE = 0x00000008, // Set RTLD_NODELETE for this object.
+ DF_1_LOADFLTR = 0x00000010, // Trigger filtee loading at runtime.
+ DF_1_INITFIRST = 0x00000020, // Set RTLD_INITFIRST for this object.
+ DF_1_NOOPEN = 0x00000040, // Set RTLD_NOOPEN for this object.
+ DF_1_ORIGIN = 0x00000080, // $ORIGIN must be handled.
+ DF_1_DIRECT = 0x00000100, // Direct binding enabled.
+ DF_1_TRANS = 0x00000200,
+ DF_1_INTERPOSE = 0x00000400, // Object is used to interpose.
+ DF_1_NODEFLIB = 0x00000800, // Ignore default lib search path.
+ DF_1_NODUMP = 0x00001000, // Object can't be dldump'ed.
+ DF_1_CONFALT = 0x00002000, // Configuration alternative created.
+ DF_1_ENDFILTEE = 0x00004000, // Filtee terminates filters search.
+ DF_1_DISPRELDNE = 0x00008000, // Disp reloc applied at build time.
+ DF_1_DISPRELPND = 0x00010000, // Disp reloc applied at run-time.
+ DF_1_NODIRECT = 0x00020000, // Object has no-direct binding.
+ DF_1_IGNMULDEF = 0x00040000,
+ DF_1_NOKSYMS = 0x00080000,
+ DF_1_NOHDR = 0x00100000,
+ DF_1_EDITED = 0x00200000, // Object is modified after built.
+ DF_1_NORELOC = 0x00400000,
+ DF_1_SYMINTPOSE = 0x00800000, // Object has individual interposers.
+ DF_1_GLOBAUDIT = 0x01000000, // Global auditing required.
+ DF_1_SINGLETON = 0x02000000 // Singleton symbols are used.
+};
+
+// DT_MIPS_FLAGS values.
+enum {
+ RHF_NONE = 0x00000000, // No flags.
+ RHF_QUICKSTART = 0x00000001, // Uses shortcut pointers.
+ RHF_NOTPOT = 0x00000002, // Hash size is not a power of two.
+ RHS_NO_LIBRARY_REPLACEMENT = 0x00000004, // Ignore LD_LIBRARY_PATH.
+ RHF_NO_MOVE = 0x00000008, // DSO address may not be relocated.
+ RHF_SGI_ONLY = 0x00000010, // SGI specific features.
+ RHF_GUARANTEE_INIT = 0x00000020, // Guarantee that .init will finish
+ // executing before any non-init
+ // code in DSO is called.
+ RHF_DELTA_C_PLUS_PLUS = 0x00000040, // Contains Delta C++ code.
+ RHF_GUARANTEE_START_INIT = 0x00000080, // Guarantee that .init will start
+ // executing before any non-init
+ // code in DSO is called.
+ RHF_PIXIE = 0x00000100, // Generated by pixie.
+ RHF_DEFAULT_DELAY_LOAD = 0x00000200, // Delay-load DSO by default.
+ RHF_REQUICKSTART = 0x00000400, // Object may be requickstarted
+ RHF_REQUICKSTARTED = 0x00000800, // Object has been requickstarted
+ RHF_CORD = 0x00001000, // Generated by cord.
+ RHF_NO_UNRES_UNDEF = 0x00002000, // Object contains no unresolved
+ // undef symbols.
+ RHF_RLD_ORDER_SAFE = 0x00004000 // Symbol table is in a safe order.
+};
+
+// ElfXX_VerDef structure version (GNU versioning)
+enum {
+ VER_DEF_NONE = 0,
+ VER_DEF_CURRENT = 1
+};
+
+// VerDef Flags (ElfXX_VerDef::vd_flags)
+enum {
+ VER_FLG_BASE = 0x1,
+ VER_FLG_WEAK = 0x2,
+ VER_FLG_INFO = 0x4
+};
+
+// Special constants for the version table. (SHT_GNU_versym/.gnu.version)
+enum {
+ VER_NDX_LOCAL = 0, // Unversioned local symbol
+ VER_NDX_GLOBAL = 1, // Unversioned global symbol
+ VERSYM_VERSION = 0x7fff, // Version Index mask
+ VERSYM_HIDDEN = 0x8000 // Hidden bit (non-default version)
+};
+
+// ElfXX_VerNeed structure version (GNU versioning)
+enum {
+ VER_NEED_NONE = 0,
+ VER_NEED_CURRENT = 1
+};
+
+
+#endif
diff --git a/src/inc/loaderheap.h b/src/inc/loaderheap.h
new file mode 100644
index 0000000000..7d4c48f5e8
--- /dev/null
+++ b/src/inc/loaderheap.h
@@ -0,0 +1,1085 @@
+// 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.
+//*****************************************************************************
+// LoaderHeap.h
+//
+
+//
+// Utility functions for managing memory allocations that typically do not
+// need releasing.
+//
+//*****************************************************************************
+
+
+#ifndef __LoaderHeap_h__
+#define __LoaderHeap_h__
+
+#include "utilcode.h"
+#include "ex.h"
+
+//==============================================================================
+// Interface used to back out loader heap allocations.
+//==============================================================================
+class ILoaderHeapBackout
+{
+#ifdef _DEBUG
+#define BackoutMem(pMem, dwSize) RealBackoutMem( (pMem), (dwSize), __FILE__, __LINE__, "UNKNOWN", -1 )
+#else
+#define BackoutMem(pMem, dwSize) RealBackoutMem( (pMem), (dwSize) )
+#endif
+
+public:
+ virtual void RealBackoutMem(void *pMem
+ , size_t dwSize
+#ifdef _DEBUG
+ , __in __in_z const char *szFile
+ , int lineNum
+ , __in __in_z const char *szAllocFile
+ , int allocLineNum
+#endif
+ ) = 0;
+};
+
+//==============================================================================
+// This structure packages up all the data needed to back out an AllocMem.
+// It's mainly a short term parking place to get the data from the AllocMem
+// to the AllocMemHolder while preserving the illusion that AllocMem() still
+// returns just a pointer as it did in V1.
+//==============================================================================
+struct TaggedMemAllocPtr
+{
+ // Note: For AllocAlignedMem blocks, m_pMem and m_dwRequestedSize are the actual values to pass
+ // to BackoutMem. Do not add "m_dwExtra"
+ void *m_pMem; //Pointer to AllocMem'd block (needed to pass back to BackoutMem)
+ size_t m_dwRequestedSize; //Requested allocation size (needed to pass back to BackoutMem)
+
+ ILoaderHeapBackout *m_pHeap; //The heap that alloc'd the block (needed to know who to call BackoutMem on)
+
+ //For AllocMem'd blocks, this is always 0.
+ //For AllocAlignedMem blocks, you have to add m_dwExtra to m_pMem to arrive
+ // at the actual aligned pointer.
+ size_t m_dwExtra;
+
+#ifdef _DEBUG
+ const char *m_szFile; //File that called AllocMem
+ int m_lineNum; //Line # of AllocMem callsite
+#endif
+
+//! Note: this structure is copied around using bitwise copy ("=").
+//! Don't get too fancy putting stuff in here. It's really just a temporary
+//! holding place to get stuff from RealAllocMem() to the MemAllocHolder.
+
+
+ public:
+
+ //
+ // This makes "void *ptr = pLoaderHeap->AllocMem()" work as in V1.
+ //
+ operator void*() const
+ {
+ LIMITED_METHOD_CONTRACT;
+ return (void*)(m_dwExtra + (BYTE*)m_pMem);
+ }
+
+ template < typename T >
+ T cast() const
+ {
+ LIMITED_METHOD_CONTRACT;
+ return reinterpret_cast< T >( operator void *() );
+ }
+};
+
+
+
+// # bytes to leave between allocations in debug mode
+// Set to a > 0 boundary to debug problems - I've made this zero, otherwise a 1 byte allocation becomes
+// a (1 + LOADER_HEAP_DEBUG_BOUNDARY) allocation
+#define LOADER_HEAP_DEBUG_BOUNDARY 0
+
+#define VIRTUAL_ALLOC_RESERVE_GRANULARITY (64*1024) // 0x10000 (64 KB)
+
+typedef DPTR(struct LoaderHeapBlock) PTR_LoaderHeapBlock;
+
+struct LoaderHeapBlock
+{
+ PTR_LoaderHeapBlock pNext;
+ PTR_VOID pVirtualAddress;
+ size_t dwVirtualSize;
+ BOOL m_fReleaseMemory;
+
+#ifndef DACCESS_COMPILE
+ // pVirtualMemory - the start address of the virtual memory
+ // cbVirtualMemory - the length in bytes of the virtual memory
+ // fReleaseMemory - should LoaderHeap be responsible for releasing this memory
+ void Init(void *pVirtualMemory,
+ size_t cbVirtualMemory,
+ BOOL fReleaseMemory)
+ {
+ LIMITED_METHOD_CONTRACT;
+ this->pNext = NULL;
+ this->pVirtualAddress = pVirtualMemory;
+ this->dwVirtualSize = cbVirtualMemory;
+ this->m_fReleaseMemory = fReleaseMemory;
+ }
+
+ // Just calls LoaderHeapBlock::Init
+ LoaderHeapBlock(void *pVirtualMemory,
+ size_t cbVirtualMemory,
+ BOOL fReleaseMemory)
+ {
+ WRAPPER_NO_CONTRACT;
+ Init(pVirtualMemory, cbVirtualMemory, fReleaseMemory);
+ }
+
+ LoaderHeapBlock()
+ {
+ WRAPPER_NO_CONTRACT;
+ Init(NULL, 0, FALSE);
+ }
+#else
+ // No ctors in DAC builds
+ LoaderHeapBlock() {}
+#endif
+};
+
+struct LoaderHeapFreeBlock;
+
+// Collection of methods for helping in debugging heap corruptions
+#ifdef _DEBUG
+class LoaderHeapSniffer;
+struct LoaderHeapEvent;
+#endif
+
+
+
+
+
+
+
+
+//===============================================================================
+// This is the base class for LoaderHeap and ExplicitControlLoaderHeap. Unfortunately,
+// this class has become schizophrenic. Sometimes, it's used as a simple
+// allocator that's semantically (but not perfwise!) equivalent to a blackbox
+// alloc/free heap. Othertimes, it's used by callers who are actually aware
+// of how it reserves addresses and want direct control over the range over which
+// this thing allocates. These two types of allocations are handed out
+// from two independent pools inside the heap.
+//
+// The backout strategy we use for the simple heap probably isn't
+// directly applicable to the more advanced uses.
+//
+// We don't have time to refactor this so as a second-best measure,
+// we make most of UnlockedLoaderHeap's methods protected and force everyone
+// to use it them through two public derived classes that are mutual siblings.
+//
+// The LoaderHeap is the black-box heap and has a Backout() method but none
+// of the advanced features that let you control address ranges.
+//
+// The ExplicitControlLoaderHeap exposes all the advanced features but
+// has no Backout() feature. (If someone wants a backout feature, they need
+// to design an appropriate one into this class.)
+//===============================================================================
+class UnlockedLoaderHeap
+{
+#ifdef _DEBUG
+ friend class LoaderHeapSniffer;
+#endif
+
+#ifdef DACCESS_COMPILE
+ friend class ClrDataAccess;
+#endif
+
+private:
+ // Linked list of ClrVirtualAlloc'd pages
+ PTR_LoaderHeapBlock m_pFirstBlock;
+
+ // Allocation pointer in current block
+ PTR_BYTE m_pAllocPtr;
+
+ // Points to the end of the committed region in the current block
+ PTR_BYTE m_pPtrToEndOfCommittedRegion;
+ PTR_BYTE m_pEndReservedRegion;
+
+ PTR_LoaderHeapBlock m_pCurBlock;
+
+ // When we need to ClrVirtualAlloc() MEM_RESERVE a new set of pages, number of bytes to reserve
+ DWORD m_dwReserveBlockSize;
+
+ // When we need to commit pages from our reserved list, number of bytes to commit at a time
+ DWORD m_dwCommitBlockSize;
+
+ // Range list to record memory ranges in
+ RangeList * m_pRangeList;
+
+ size_t m_dwTotalAlloc;
+
+ size_t * m_pPrivatePerfCounter_LoaderBytes;
+
+ DWORD m_flProtect;
+
+ LoaderHeapFreeBlock *m_pFirstFreeBlock;
+
+ // This is used to hold on to a block of reserved memory provided to the
+ // constructor. We do this instead of adding it as the first block because
+ // that requires comitting the first page of the reserved block, and for
+ // startup working set reasons we want to delay that as long as possible.
+ LoaderHeapBlock m_reservedBlock;
+
+public:
+
+#ifdef _DEBUG
+ enum
+ {
+ kCallTracing = 0x00000001, // Keep a permanent log of all callers
+
+ kEncounteredOOM = 0x80000000, // One time flag to record that an OOM interrupted call tracing
+ }
+ LoaderHeapDebugFlags;
+
+ DWORD m_dwDebugFlags;
+
+ LoaderHeapEvent *m_pEventList; // Linked list of events (in reverse time order)
+#endif
+
+
+
+#ifdef _DEBUG
+ size_t m_dwDebugWastedBytes;
+ static DWORD s_dwNumInstancesOfLoaderHeaps;
+#endif
+
+#ifdef _DEBUG
+ size_t DebugGetWastedBytes()
+ {
+ WRAPPER_NO_CONTRACT;
+ return m_dwDebugWastedBytes + GetBytesAvailCommittedRegion();
+ }
+#endif
+
+#ifdef _DEBUG
+ // Stubs allocated from a LoaderHeap will have unwind info registered with NT.
+ // The info must be unregistered when the heap is destroyed.
+ BOOL m_fPermitStubsWithUnwindInfo;
+ BOOL m_fStubUnwindInfoUnregistered;
+#endif
+
+public:
+ BOOL m_fExplicitControl; // Am I a LoaderHeap or an ExplicitControlLoaderHeap?
+
+#ifdef DACCESS_COMPILE
+public:
+ void EnumMemoryRegions(enum CLRDataEnumMemoryFlags flags);
+#endif
+
+public:
+ typedef void EnumPageRegionsCallback (PTR_VOID pvAllocationBase, SIZE_T cbReserved);
+ void EnumPageRegions (EnumPageRegionsCallback *pCallback);
+
+#ifndef DACCESS_COMPILE
+protected:
+ // Use this version if dwReservedRegionAddress already points to a
+ // blob of reserved memory. This will set up internal data structures,
+ // using the provided, reserved memory.
+ UnlockedLoaderHeap(DWORD dwReserveBlockSize,
+ DWORD dwCommitBlockSize,
+ const BYTE* dwReservedRegionAddress,
+ SIZE_T dwReservedRegionSize,
+ size_t *pPrivatePerfCounter_LoaderBytes = NULL,
+ RangeList *pRangeList = NULL,
+ BOOL fMakeExecutable = FALSE);
+
+ ~UnlockedLoaderHeap();
+#endif
+
+private:
+ size_t GetBytesAvailCommittedRegion();
+ size_t GetBytesAvailReservedRegion();
+
+protected:
+ // number of bytes available in region
+ size_t UnlockedGetReservedBytesFree()
+ {
+ LIMITED_METHOD_CONTRACT;
+ return m_pEndReservedRegion - m_pAllocPtr;
+ }
+
+private:
+ // Get some more committed pages - either commit some more in the current reserved region, or, if it
+ // has run out, reserve another set of pages
+ BOOL GetMoreCommittedPages(size_t dwMinSize);
+
+protected:
+ // Reserve some pages at any address
+ BOOL UnlockedReservePages(size_t dwCommitBlockSize);
+
+protected:
+ // In debug mode, allocate an extra LOADER_HEAP_DEBUG_BOUNDARY bytes and fill it with invalid data. The reason we
+ // do this is that when we're allocating vtables out of the heap, it is very easy for code to
+ // get careless, and end up reading from memory that it doesn't own - but since it will be
+ // reading some other allocation's vtable, no crash will occur. By keeping a gap between
+ // allocations, it is more likely that these errors will be encountered.
+ void *UnlockedAllocMem(size_t dwSize
+#ifdef _DEBUG
+ ,__in __in_z const char *szFile
+ ,int lineNum
+#endif
+ );
+ void *UnlockedAllocMem_NoThrow(size_t dwSize
+#ifdef _DEBUG
+ ,__in __in_z const char *szFile
+ ,int lineNum
+#endif
+ );
+
+
+
+
+
+protected:
+ // Allocates memory aligned on power-of-2 boundary.
+ //
+ // The return value is a pointer that's guaranteed to be aligned.
+ //
+ // FREEING THIS BLOCK: Underneath, the actual block allocated may
+ // be larger and start at an address prior to the one you got back.
+ // It is this adjusted size and pointer that you pass to BackoutMem.
+ // The required adjustment is passed back thru the pdwExtra pointer.
+ //
+ // Here is how to properly backout the memory:
+ //
+ // size_t dwExtra;
+ // void *pMem = UnlockedAllocAlignedMem(dwRequestedSize, alignment, &dwExtra);
+ // _ASSERTE( 0 == (pMem & (alignment - 1)) );
+ // UnlockedBackoutMem( ((BYTE*)pMem) - dExtra, dwRequestedSize + dwExtra );
+ //
+ // If you use the AllocMemHolder or AllocMemTracker, all this is taken care of
+ // behind the scenes.
+ //
+ //
+ void *UnlockedAllocAlignedMem(size_t dwRequestedSize
+ ,size_t dwAlignment
+ ,size_t *pdwExtra
+#ifdef _DEBUG
+ ,__in __in_z const char *szFile
+ ,int lineNum
+#endif
+ );
+
+ void *UnlockedAllocAlignedMem_NoThrow(size_t dwRequestedSize
+ ,size_t dwAlignment
+ ,size_t *pdwExtra
+#ifdef _DEBUG
+ ,__in __in_z const char *szFile
+ ,int lineNum
+#endif
+ );
+
+protected:
+ // This frees memory allocated by UnlockAllocMem. It's given this horrible name to emphasize
+ // that it's purpose is for error path leak prevention purposes. You shouldn't
+ // use LoaderHeap's as general-purpose alloc-free heaps.
+ void UnlockedBackoutMem(void *pMem
+ , size_t dwSize
+#ifdef _DEBUG
+ , __in __in_z const char *szFile
+ , int lineNum
+ , __in __in_z const char *szAllocFile
+ , int AllocLineNum
+#endif
+ );
+
+public:
+ // Perf Counter reports the size of the heap
+ size_t GetSize ()
+ {
+ LIMITED_METHOD_CONTRACT;
+ return m_dwTotalAlloc;
+ }
+
+ BOOL IsExecutable()
+ {
+ return (PAGE_EXECUTE_READWRITE == m_flProtect);
+ }
+
+
+public:
+#ifdef _DEBUG
+ void DumpFreeList();
+#endif
+
+public:
+// Extra CallTracing support
+#ifdef _DEBUG
+ void UnlockedClearEvents(); //Discard saved events
+ void UnlockedCompactEvents(); //Discard matching alloc/free events
+ void UnlockedPrintEvents(); //Print event list
+#endif
+
+protected:
+ void *UnlockedAllocMemForCode_NoThrow(size_t dwHeaderSize, size_t dwCodeSize, DWORD dwCodeAlignment);
+
+ void UnlockedSetReservedRegion(BYTE* dwReservedRegionAddress, SIZE_T dwReservedRegionSize, BOOL fReleaseMemory);
+};
+
+//===============================================================================
+// Create the LoaderHeap lock. It's the same lock for several different Heaps.
+//===============================================================================
+inline CRITSEC_COOKIE CreateLoaderHeapLock()
+{
+ return ClrCreateCriticalSection(CrstLoaderHeap,CrstFlags(CRST_UNSAFE_ANYMODE | CRST_DEBUGGER_THREAD));
+}
+
+//===============================================================================
+// The LoaderHeap is the black-box heap and has a Backout() method but none
+// of the advanced features that let you control address ranges.
+//===============================================================================
+typedef DPTR(class LoaderHeap) PTR_LoaderHeap;
+class LoaderHeap : public UnlockedLoaderHeap, public ILoaderHeapBackout
+{
+private:
+ CRITSEC_COOKIE m_CriticalSection;
+
+#ifndef DACCESS_COMPILE
+public:
+ LoaderHeap(DWORD dwReserveBlockSize,
+ DWORD dwCommitBlockSize,
+ size_t *pPrivatePerfCounter_LoaderBytes = NULL,
+ RangeList *pRangeList = NULL,
+ BOOL fMakeExecutable = FALSE
+ )
+ : UnlockedLoaderHeap(dwReserveBlockSize,
+ dwCommitBlockSize,
+ NULL, 0,
+ pPrivatePerfCounter_LoaderBytes,
+ pRangeList,
+ fMakeExecutable)
+ {
+ WRAPPER_NO_CONTRACT;
+ m_CriticalSection = NULL;
+ m_CriticalSection = CreateLoaderHeapLock();
+ m_fExplicitControl = FALSE;
+ }
+
+public:
+ LoaderHeap(DWORD dwReserveBlockSize,
+ DWORD dwCommitBlockSize,
+ const BYTE* dwReservedRegionAddress,
+ SIZE_T dwReservedRegionSize,
+ size_t *pPrivatePerfCounter_LoaderBytes = NULL,
+ RangeList *pRangeList = NULL,
+ BOOL fMakeExecutable = FALSE
+ )
+ : UnlockedLoaderHeap(dwReserveBlockSize,
+ dwCommitBlockSize,
+ dwReservedRegionAddress,
+ dwReservedRegionSize,
+ pPrivatePerfCounter_LoaderBytes,
+ pRangeList,
+ fMakeExecutable)
+ {
+ WRAPPER_NO_CONTRACT;
+ m_CriticalSection = NULL;
+ m_CriticalSection = CreateLoaderHeapLock();
+ m_fExplicitControl = FALSE;
+ }
+
+#endif // DACCESS_COMPILE
+
+ virtual ~LoaderHeap()
+ {
+ WRAPPER_NO_CONTRACT;
+
+#ifndef DACCESS_COMPILE
+ if (m_CriticalSection != NULL)
+ {
+ ClrDeleteCriticalSection(m_CriticalSection);
+ }
+#endif // DACCESS_COMPILE
+ }
+
+
+
+#ifdef _DEBUG
+#define AllocMem(dwSize) RealAllocMem( (dwSize), __FILE__, __LINE__ )
+#define AllocMem_NoThrow(dwSize) RealAllocMem_NoThrow( (dwSize), __FILE__, __LINE__ )
+#else
+#define AllocMem(dwSize) RealAllocMem( (dwSize) )
+#define AllocMem_NoThrow(dwSize) RealAllocMem_NoThrow( (dwSize) )
+#endif
+
+public:
+ FORCEINLINE TaggedMemAllocPtr RealAllocMem(S_SIZE_T dwSize
+#ifdef _DEBUG
+ ,__in __in_z const char *szFile
+ ,int lineNum
+#endif
+ )
+ {
+ WRAPPER_NO_CONTRACT;
+
+ if(dwSize.IsOverflow()) ThrowOutOfMemory();
+
+ return RealAllocMemUnsafe(dwSize.Value() COMMA_INDEBUG(szFile) COMMA_INDEBUG(lineNum));
+
+ }
+
+ FORCEINLINE TaggedMemAllocPtr RealAllocMem_NoThrow(S_SIZE_T dwSize
+#ifdef _DEBUG
+ ,__in __in_z const char *szFile
+ ,int lineNum
+#endif
+ )
+ {
+ WRAPPER_NO_CONTRACT;
+
+ if(dwSize.IsOverflow()) {
+ TaggedMemAllocPtr tmap;
+ tmap.m_pMem = NULL;
+ tmap.m_dwRequestedSize = dwSize.Value();
+ tmap.m_pHeap = this;
+ tmap.m_dwExtra = 0;
+#ifdef _DEBUG
+ tmap.m_szFile = szFile;
+ tmap.m_lineNum = lineNum;
+#endif
+
+ return tmap;
+ }
+
+ return RealAllocMemUnsafe_NoThrow(dwSize.Value() COMMA_INDEBUG(szFile) COMMA_INDEBUG(lineNum));
+ }
+private:
+
+ TaggedMemAllocPtr RealAllocMemUnsafe(size_t dwSize
+#ifdef _DEBUG
+ ,__in __in_z const char *szFile
+ ,int lineNum
+#endif
+ )
+ {
+ WRAPPER_NO_CONTRACT;
+
+
+ void *pResult;
+ TaggedMemAllocPtr tmap;
+
+ CRITSEC_Holder csh(m_CriticalSection);
+ pResult = UnlockedAllocMem(dwSize
+#ifdef _DEBUG
+ , szFile
+ , lineNum
+#endif
+ );
+ tmap.m_pMem = pResult;
+ tmap.m_dwRequestedSize = dwSize;
+ tmap.m_pHeap = this;
+ tmap.m_dwExtra = 0;
+#ifdef _DEBUG
+ tmap.m_szFile = szFile;
+ tmap.m_lineNum = lineNum;
+#endif
+ return tmap;
+ }
+
+ TaggedMemAllocPtr RealAllocMemUnsafe_NoThrow(size_t dwSize
+#ifdef _DEBUG
+ ,__in __in_z const char *szFile
+ ,int lineNum
+#endif
+ )
+ {
+ WRAPPER_NO_CONTRACT;
+
+ void *pResult;
+ TaggedMemAllocPtr tmap;
+
+ CRITSEC_Holder csh(m_CriticalSection);
+
+ pResult = UnlockedAllocMem_NoThrow(dwSize
+#ifdef _DEBUG
+ , szFile
+ , lineNum
+#endif
+ );
+
+ tmap.m_pMem = pResult;
+ tmap.m_dwRequestedSize = dwSize;
+ tmap.m_pHeap = this;
+ tmap.m_dwExtra = 0;
+#ifdef _DEBUG
+ tmap.m_szFile = szFile;
+ tmap.m_lineNum = lineNum;
+#endif
+
+ return tmap;
+ }
+
+
+
+#ifdef _DEBUG
+#define AllocAlignedMem(dwSize, dwAlign) RealAllocAlignedMem( (dwSize), (dwAlign), __FILE__, __LINE__)
+#define AllocAlignedMem_NoThrow(dwSize, dwAlign) RealAllocAlignedMem_NoThrow( (dwSize), (dwAlign), __FILE__, __LINE__)
+#else
+#define AllocAlignedMem(dwSize, dwAlign) RealAllocAlignedMem( (dwSize), (dwAlign) )
+#define AllocAlignedMem_NoThrow(dwSize, dwAlign) RealAllocAlignedMem_NoThrow( (dwSize), (dwAlign) )
+#endif
+
+public:
+ TaggedMemAllocPtr RealAllocAlignedMem(size_t dwRequestedSize
+ ,size_t dwAlignment
+#ifdef _DEBUG
+ ,__in __in_z const char *szFile
+ ,int lineNum
+#endif
+ )
+ {
+ WRAPPER_NO_CONTRACT;
+
+ CRITSEC_Holder csh(m_CriticalSection);
+
+
+ TaggedMemAllocPtr tmap;
+ void *pResult;
+ size_t dwExtra;
+
+ pResult = UnlockedAllocAlignedMem(dwRequestedSize
+ ,dwAlignment
+ ,&dwExtra
+#ifdef _DEBUG
+ ,szFile
+ ,lineNum
+#endif
+ );
+
+ tmap.m_pMem = (void*)(((BYTE*)pResult) - dwExtra);
+ tmap.m_dwRequestedSize = dwRequestedSize + dwExtra;
+ tmap.m_pHeap = this;
+ tmap.m_dwExtra = dwExtra;
+#ifdef _DEBUG
+ tmap.m_szFile = szFile;
+ tmap.m_lineNum = lineNum;
+#endif
+
+ return tmap;
+ }
+
+
+ TaggedMemAllocPtr RealAllocAlignedMem_NoThrow(size_t dwRequestedSize
+ ,size_t dwAlignment
+#ifdef _DEBUG
+ ,__in __in_z const char *szFile
+ ,int lineNum
+#endif
+ )
+ {
+ WRAPPER_NO_CONTRACT;
+
+ CRITSEC_Holder csh(m_CriticalSection);
+
+
+ TaggedMemAllocPtr tmap;
+ void *pResult;
+ size_t dwExtra;
+
+ pResult = UnlockedAllocAlignedMem_NoThrow(dwRequestedSize
+ ,dwAlignment
+ ,&dwExtra
+#ifdef _DEBUG
+ ,szFile
+ ,lineNum
+#endif
+ );
+
+ _ASSERTE(!(pResult == NULL && dwExtra != 0));
+
+ tmap.m_pMem = (void*)(((BYTE*)pResult) - dwExtra);
+ tmap.m_dwRequestedSize = dwRequestedSize + dwExtra;
+ tmap.m_pHeap = this;
+ tmap.m_dwExtra = dwExtra;
+#ifdef _DEBUG
+ tmap.m_szFile = szFile;
+ tmap.m_lineNum = lineNum;
+#endif
+
+ return tmap;
+ }
+
+
+public:
+ // This frees memory allocated by AllocMem. It's given this horrible name to emphasize
+ // that it's purpose is for error path leak prevention purposes. You shouldn't
+ // use LoaderHeap's as general-purpose alloc-free heaps.
+ void RealBackoutMem(void *pMem
+ , size_t dwSize
+#ifdef _DEBUG
+ , __in __in_z const char *szFile
+ , int lineNum
+ , __in __in_z const char *szAllocFile
+ , int allocLineNum
+#endif
+ )
+ {
+ WRAPPER_NO_CONTRACT;
+ CRITSEC_Holder csh(m_CriticalSection);
+ UnlockedBackoutMem(pMem
+ , dwSize
+#ifdef _DEBUG
+ , szFile
+ , lineNum
+ , szAllocFile
+ , allocLineNum
+#endif
+ );
+ }
+
+public:
+// Extra CallTracing support
+#ifdef _DEBUG
+ void ClearEvents()
+ {
+ WRAPPER_NO_CONTRACT;
+ CRITSEC_Holder csh(m_CriticalSection);
+ UnlockedClearEvents();
+ }
+
+ void CompactEvents()
+ {
+ WRAPPER_NO_CONTRACT;
+ CRITSEC_Holder csh(m_CriticalSection);
+ UnlockedCompactEvents();
+ }
+
+ void PrintEvents()
+ {
+ WRAPPER_NO_CONTRACT;
+ CRITSEC_Holder csh(m_CriticalSection);
+ UnlockedPrintEvents();
+ }
+#endif
+
+};
+
+
+
+
+
+//===============================================================================
+// The ExplicitControlLoaderHeap exposes all the advanced features but
+// has no Backout() feature. (If someone wants a backout feature, they need
+// to design an appropriate one into this class.)
+//
+// Caller is responsible for synchronization. ExplicitControlLoaderHeap is
+// not multithread safe.
+//===============================================================================
+typedef DPTR(class ExplicitControlLoaderHeap) PTR_ExplicitControlLoaderHeap;
+class ExplicitControlLoaderHeap : public UnlockedLoaderHeap
+{
+#ifndef DACCESS_COMPILE
+public:
+ ExplicitControlLoaderHeap(size_t *pPrivatePerfCounter_LoaderBytes = NULL,
+ RangeList *pRangeList = NULL,
+ BOOL fMakeExecutable = FALSE
+ )
+ : UnlockedLoaderHeap(0, 0, NULL, 0,
+ pPrivatePerfCounter_LoaderBytes,
+ pRangeList,
+ fMakeExecutable)
+ {
+ WRAPPER_NO_CONTRACT;
+ m_fExplicitControl = TRUE;
+ }
+#endif // DACCESS_COMPILE
+
+public:
+ void *RealAllocMem(size_t dwSize
+#ifdef _DEBUG
+ ,__in __in_z const char *szFile
+ ,int lineNum
+#endif
+ )
+ {
+ WRAPPER_NO_CONTRACT;
+
+ void *pResult;
+
+ pResult = UnlockedAllocMem(dwSize
+#ifdef _DEBUG
+ , szFile
+ , lineNum
+#endif
+ );
+ return pResult;
+ }
+
+ void *RealAllocMem_NoThrow(size_t dwSize
+#ifdef _DEBUG
+ ,__in __in_z const char *szFile
+ ,int lineNum
+#endif
+ )
+ {
+ WRAPPER_NO_CONTRACT;
+
+ void *pResult;
+
+ pResult = UnlockedAllocMem_NoThrow(dwSize
+#ifdef _DEBUG
+ , szFile
+ , lineNum
+#endif
+ );
+ return pResult;
+ }
+
+
+public:
+ void *AllocMemForCode_NoThrow(size_t dwHeaderSize, size_t dwCodeSize, DWORD dwCodeAlignment)
+ {
+ WRAPPER_NO_CONTRACT;
+ return UnlockedAllocMemForCode_NoThrow(dwHeaderSize, dwCodeSize, dwCodeAlignment);
+ }
+
+ void SetReservedRegion(BYTE* dwReservedRegionAddress, SIZE_T dwReservedRegionSize, BOOL fReleaseMemory)
+ {
+ WRAPPER_NO_CONTRACT;
+ return UnlockedSetReservedRegion(dwReservedRegionAddress, dwReservedRegionSize, fReleaseMemory);
+ }
+
+public:
+ // number of bytes available in region
+ size_t GetReservedBytesFree()
+ {
+ WRAPPER_NO_CONTRACT;
+ return UnlockedGetReservedBytesFree();
+ }
+};
+
+
+
+//==============================================================================
+// AllocMemHolder : Allocated memory from LoaderHeap
+//
+// Old:
+//
+// Foo* pFoo = (Foo*)pLoaderHeap->AllocMem(size);
+// pFoo->BackoutMem(pFoo, size)
+//
+//
+// New:
+//
+// {
+// AllocMemHolder<Foo> pfoo = pLoaderHeap->AllocMem();
+// } // BackoutMem on out of scope
+//
+//==============================================================================
+template <typename TYPE>
+class AllocMemHolder
+{
+ private:
+ TaggedMemAllocPtr m_value;
+ BOOL m_fAcquired;
+
+
+ //--------------------------------------------------------------------
+ // All allowed (and disallowed) ctors here.
+ //--------------------------------------------------------------------
+ public:
+ // Allow the construction "Holder h;"
+ AllocMemHolder()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_value.m_pMem = NULL;
+ m_value.m_dwRequestedSize = 0;
+ m_value.m_pHeap = 0;
+ m_value.m_dwExtra = 0;
+#ifdef _DEBUG
+ m_value.m_szFile = NULL;
+ m_value.m_lineNum = 0;
+#endif
+ m_fAcquired = FALSE;
+ }
+
+ public:
+ // Allow the construction "Holder h = pHeap->AllocMem()"
+ AllocMemHolder(const TaggedMemAllocPtr value)
+ {
+ LIMITED_METHOD_CONTRACT;
+ m_value = value;
+ m_fAcquired = TRUE;
+ }
+
+ private:
+ // Disallow "Holder holder1 = holder2"
+ AllocMemHolder(const AllocMemHolder<TYPE> &);
+
+
+ private:
+ // Disallow "Holder holder1 = void*"
+ AllocMemHolder(const LPVOID &);
+
+ //--------------------------------------------------------------------
+ // Destructor (and the whole point of AllocMemHolder)
+ //--------------------------------------------------------------------
+ public:
+ ~AllocMemHolder()
+ {
+ WRAPPER_NO_CONTRACT;
+ if (m_fAcquired && m_value.m_pMem)
+ {
+ m_value.m_pHeap->RealBackoutMem(m_value.m_pMem,
+ m_value.m_dwRequestedSize
+#ifdef _DEBUG
+ ,__FILE__
+ ,__LINE__
+ ,m_value.m_szFile
+ ,m_value.m_lineNum
+#endif
+ );
+ }
+ }
+
+
+ //--------------------------------------------------------------------
+ // All allowed (and disallowed) assignment operators here.
+ //--------------------------------------------------------------------
+ public:
+ // Reluctantly allow "AllocMemHolder h; ... h = pheap->AllocMem()"
+ void operator=(const TaggedMemAllocPtr & value)
+ {
+ WRAPPER_NO_CONTRACT;
+ // However, prevent repeated assignments as that would leak.
+ _ASSERTE(m_value.m_pMem == NULL && !m_fAcquired);
+ m_value = value;
+ m_fAcquired = TRUE;
+ }
+
+ private:
+ // Disallow "holder == holder2"
+ const AllocMemHolder<TYPE> & operator=(const AllocMemHolder<TYPE> &);
+
+ private:
+ // Disallow "holder = void*"
+ const AllocMemHolder<TYPE> & operator=(const LPVOID &);
+
+
+ //--------------------------------------------------------------------
+ // Operations on the holder itself
+ //--------------------------------------------------------------------
+ public:
+ // Call this when you're ready to take ownership away from the holder.
+ void SuppressRelease()
+ {
+ LIMITED_METHOD_CONTRACT;
+ m_fAcquired = FALSE;
+ }
+
+
+
+ //--------------------------------------------------------------------
+ // ... And the smart-pointer stuff so we can drop holders on top
+ // of former pointer variables (mostly)
+ //--------------------------------------------------------------------
+ public:
+ // Allow holder to be treated as the underlying pointer type
+ operator TYPE* ()
+ {
+ LIMITED_METHOD_CONTRACT;
+ return (TYPE*)(void*)m_value;
+ }
+
+ public:
+ // Allow holder to be treated as the underlying pointer type
+ TYPE* operator->()
+ {
+ LIMITED_METHOD_CONTRACT;
+ return (TYPE*)(void*)m_value;
+ }
+ public:
+ int operator==(TYPE* value)
+ {
+ LIMITED_METHOD_CONTRACT;
+ return ((void*)m_value) == ((void*)value);
+ }
+
+ public:
+ int operator!=(TYPE* value)
+ {
+ LIMITED_METHOD_CONTRACT;
+ return ((void*)m_value) != ((void*)value);
+ }
+
+ public:
+ int operator!() const
+ {
+ LIMITED_METHOD_CONTRACT;
+ return m_value.m_pMem == NULL;
+ }
+
+
+};
+
+
+
+// This utility helps track loaderheap allocations. Its main purpose
+// is to backout allocations in case of an exception.
+class AllocMemTracker
+{
+ public:
+ AllocMemTracker();
+ ~AllocMemTracker();
+
+ // Tells tracker to store an allocated loaderheap block.
+ //
+ // Returns the pointer address of block for convenience.
+ //
+ // Ok to call on failed loaderheap allocation (will just do nothing and propagate the OOM as apropos).
+ //
+ // If Track fails due to an OOM allocating node space, it will backout the loaderheap block before returning.
+ void *Track(TaggedMemAllocPtr tmap);
+ void *Track_NoThrow(TaggedMemAllocPtr tmap);
+
+ void SuppressRelease();
+
+ private:
+ struct AllocMemTrackerNode
+ {
+ ILoaderHeapBackout *m_pHeap;
+ void *m_pMem;
+ size_t m_dwRequestedSize;
+#ifdef _DEBUG
+ const char *m_szAllocFile;
+ int m_allocLineNum;
+#endif
+ };
+
+ enum
+ {
+ kAllocMemTrackerBlockSize =
+#ifdef _DEBUG
+ 3
+#else
+ 20
+#endif
+ };
+
+ struct AllocMemTrackerBlock
+ {
+ AllocMemTrackerBlock *m_pNext;
+ int m_nextFree;
+ AllocMemTrackerNode m_Node[kAllocMemTrackerBlockSize];
+ };
+
+
+ AllocMemTrackerBlock *m_pFirstBlock;
+ AllocMemTrackerBlock m_FirstBlock; // Stack-allocate the first block - "new" the rest.
+
+ protected:
+ BOOL m_fReleased;
+
+};
+
+#endif // __LoaderHeap_h__
+
diff --git a/src/inc/log.h b/src/inc/log.h
new file mode 100644
index 0000000000..37aab45711
--- /dev/null
+++ b/src/inc/log.h
@@ -0,0 +1,99 @@
+// 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.
+
+//
+// Logging Facility
+//
+
+
+// Logging Subsystems
+
+
+#ifndef __LOG_H__
+#define __LOG_H__
+
+
+#define DEFINE_LOG_FACILITY(logname, value) logname = value,
+
+enum {
+#include "loglf.h"
+ LF_ALWAYS = 0x80000000, // Log message irrepespective of LogFacility (if the level matches)
+ LF_ALL = 0xFFFFFFFF, // Used only to mask bits. Never use as LOG((LF_ALL, ...))
+
+ // LogFacility2: all 32-bit of LogFacility are used, need a 2nd DWORD for more facilities
+ LF2_MULTICOREJIT = 0x00000001 // Multicore JIT
+};
+
+
+#define LL_EVERYTHING 10
+#define LL_INFO1000000 9 // can be expected to generate 1,000,000 logs per small but not trival run
+#define LL_INFO100000 8 // can be expected to generate 100,000 logs per small but not trival run
+#define LL_INFO10000 7 // can be expected to generate 10,000 logs per small but not trival run
+#define LL_INFO1000 6 // can be expected to generate 1,000 logs per small but not trival run
+#define LL_INFO100 5 // can be expected to generate 100 logs per small but not trival run
+#define LL_INFO10 4 // can be expected to generate 10 logs per small but not trival run
+#define LL_WARNING 3
+#define LL_ERROR 2
+#define LL_FATALERROR 1
+#define LL_ALWAYS 0 // impossible to turn off (log level never negative)
+
+
+#define INFO5 LL_INFO10
+#define INFO4 LL_INFO100
+#define INFO3 LL_INFO1000
+#define INFO2 LL_INFO10000
+#define INFO1 LL_INFO100000
+#define WARNING 0
+#define ERROR 0
+#define FATALERROR 0
+
+#ifndef LOGGING
+
+#define LOG(x)
+#define LOG2(x)
+
+#define InitializeLogging()
+#define InitLogging()
+#define ShutdownLogging()
+#define FlushLogging()
+#define LoggingOn(facility, level) 0
+#define Logging2On(facility, level) 0
+#define EnterLogLock()
+#define LeaveLogLock()
+
+#else
+
+extern VOID InitializeLogging();
+extern VOID InitLogging();
+extern VOID ShutdownLogging();
+extern VOID FlushLogging();
+
+extern VOID LogSpew(DWORD facility, DWORD level, const char *fmt, ... );
+extern VOID LogSpewValist(DWORD facility, DWORD level, const char *fmt, va_list args);
+
+extern VOID LogSpew2(DWORD facility2, DWORD level, const char *fmt, ... );
+extern VOID LogSpew2Valist(DWORD facility2, DWORD level, const char *fmt, va_list args);
+
+extern VOID LogSpewAlwaysValist(const char *fmt, va_list args);
+extern VOID LogSpewAlways (const char *fmt, ... );
+extern VOID EnterLogLock();
+extern VOID LeaveLogLock();
+
+VOID AddLoggingFacility( DWORD facility );
+VOID SetLoggingLevel( DWORD level );
+bool LoggingEnabled();
+bool LoggingOn(DWORD facility, DWORD level);
+bool Logging2On(DWORD facility, DWORD level);
+
+#define LOG(x) do { if (LoggingEnabled()) { LogSpew x; } } while (0)
+
+#define LOG2(x) do { if (LoggingEnabled()) { LogSpew2 x; } } while (0)
+
+#endif
+
+#ifdef __cplusplus
+#include "stresslog.h" // special logging for retail code
+#endif
+
+#endif //__LOG_H__
diff --git a/src/inc/loglf.h b/src/inc/loglf.h
new file mode 100644
index 0000000000..ea121cda7c
--- /dev/null
+++ b/src/inc/loglf.h
@@ -0,0 +1,42 @@
+// 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.
+// The code in sos.DumpLog depends on the first 32 facility codes
+// being bit flags sorted in incresing order.
+
+DEFINE_LOG_FACILITY(LF_GC ,0x00000001)
+DEFINE_LOG_FACILITY(LF_GCINFO ,0x00000002)
+DEFINE_LOG_FACILITY(LF_STUBS ,0x00000004)
+DEFINE_LOG_FACILITY(LF_JIT ,0x00000008)
+DEFINE_LOG_FACILITY(LF_LOADER ,0x00000010)
+DEFINE_LOG_FACILITY(LF_METADATA ,0x00000020)
+DEFINE_LOG_FACILITY(LF_SYNC ,0x00000040)
+DEFINE_LOG_FACILITY(LF_EEMEM ,0x00000080)
+DEFINE_LOG_FACILITY(LF_GCALLOC ,0x00000100)
+DEFINE_LOG_FACILITY(LF_CORDB ,0x00000200)
+DEFINE_LOG_FACILITY(LF_CLASSLOADER ,0x00000400)
+DEFINE_LOG_FACILITY(LF_CORPROF ,0x00000800)
+DEFINE_LOG_FACILITY(LF_REMOTING ,0x00001000)
+DEFINE_LOG_FACILITY(LF_DBGALLOC ,0x00002000)
+DEFINE_LOG_FACILITY(LF_EH ,0x00004000)
+DEFINE_LOG_FACILITY(LF_ENC ,0x00008000)
+DEFINE_LOG_FACILITY(LF_ASSERT ,0x00010000)
+DEFINE_LOG_FACILITY(LF_VERIFIER ,0x00020000)
+DEFINE_LOG_FACILITY(LF_THREADPOOL ,0x00040000)
+DEFINE_LOG_FACILITY(LF_GCROOTS ,0x00080000)
+DEFINE_LOG_FACILITY(LF_INTEROP ,0x00100000)
+DEFINE_LOG_FACILITY(LF_MARSHALER ,0x00200000)
+DEFINE_LOG_FACILITY(LF_IJW ,0x00400000)
+DEFINE_LOG_FACILITY(LF_ZAP ,0x00800000)
+DEFINE_LOG_FACILITY(LF_STARTUP ,0x01000000) // Log startupa and shutdown failures
+DEFINE_LOG_FACILITY(LF_APPDOMAIN ,0x02000000)
+DEFINE_LOG_FACILITY(LF_CODESHARING ,0x04000000)
+DEFINE_LOG_FACILITY(LF_STORE ,0x08000000)
+DEFINE_LOG_FACILITY(LF_SECURITY ,0x10000000)
+DEFINE_LOG_FACILITY(LF_LOCKS ,0x20000000)
+DEFINE_LOG_FACILITY(LF_BCL ,0x40000000)
+// LF_ALWAYS 0x80000000 // make certain you don't try to use this bit for a real facility
+// LF_ALL 0xFFFFFFFF
+//
+#undef DEFINE_LOG_FACILITY
+
diff --git a/src/inc/longfilepathwrappers.h b/src/inc/longfilepathwrappers.h
new file mode 100644
index 0000000000..a847988935
--- /dev/null
+++ b/src/inc/longfilepathwrappers.h
@@ -0,0 +1,271 @@
+// 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.
+
+#ifndef _WIN_PATH_APIS_WRAPPER_
+#define _WIN_PATH_APIS_WRAPPER_
+class SString;
+
+HMODULE
+LoadLibraryExWrapper(
+ _In_ LPCWSTR lpLibFileName,
+ _Reserved_ HANDLE hFile = NULL,
+ _In_ DWORD dwFlags = 0
+ );
+
+HANDLE
+CreateFileWrapper(
+ _In_ LPCWSTR lpFileName,
+ _In_ DWORD dwDesiredAccess,
+ _In_ DWORD dwShareMode,
+ _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes,
+ _In_ DWORD dwCreationDisposition,
+ _In_ DWORD dwFlagsAndAttributes,
+ _In_opt_ HANDLE hTemplateFile
+ );
+
+BOOL
+SetFileAttributesWrapper(
+ _In_ LPCWSTR lpFileName,
+ _In_ DWORD dwFileAttributes
+ );
+
+DWORD
+GetFileAttributesWrapper(
+ _In_ LPCWSTR lpFileName
+ );
+
+BOOL
+GetFileAttributesExWrapper(
+ _In_ LPCWSTR lpFileName,
+ _In_ GET_FILEEX_INFO_LEVELS fInfoLevelId,
+ _Out_writes_bytes_(sizeof(WIN32_FILE_ATTRIBUTE_DATA)) LPVOID lpFileInformation
+ );
+BOOL
+DeleteFileWrapper(
+ _In_ LPCWSTR lpFileName
+ );
+
+HANDLE
+FindFirstFileExWrapper(
+ _In_ LPCWSTR lpFileName,
+ _In_ FINDEX_INFO_LEVELS fInfoLevelId,
+ _Out_writes_bytes_(sizeof(WIN32_FIND_DATAW)) LPVOID lpFindFileData,
+ _In_ FINDEX_SEARCH_OPS fSearchOp,
+ _Reserved_ LPVOID lpSearchFilter,
+ _In_ DWORD dwAdditionalFlags
+ );
+
+BOOL
+CopyFileWrapper(
+ _In_ LPCWSTR lpExistingFileName,
+ _In_ LPCWSTR lpNewFileName,
+ _In_ BOOL bFailIfExists
+ );
+
+#ifndef FEATURE_PAL
+BOOL
+CopyFileExWrapper(
+ _In_ LPCWSTR lpExistingFileName,
+ _In_ LPCWSTR lpNewFileName,
+ _In_opt_ LPPROGRESS_ROUTINE lpProgressRoutine,
+ _In_opt_ LPVOID lpData,
+ _When_(pbCancel != NULL, _Pre_satisfies_(*pbCancel == FALSE))
+ _Inout_opt_ LPBOOL pbCancel,
+ _In_ DWORD dwCopyFlags
+ );
+#endif //FEATURE_PAL
+
+BOOL
+MoveFileExWrapper(
+ _In_ LPCWSTR lpExistingFileName,
+ _In_opt_ LPCWSTR lpNewFileName,
+ _In_ DWORD dwFlags
+ );
+
+BOOL
+CreateDirectoryWrapper(
+ _In_ LPCWSTR lpPathName,
+ _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes
+ );
+
+BOOL
+RemoveDirectoryWrapper(
+ _In_ LPCWSTR lpPathName
+ );
+
+BOOL
+CreateHardLinkWrapper(
+ _In_ LPCWSTR lpFileName,
+ _In_ LPCWSTR lpExistingFileName,
+ _Reserved_ LPSECURITY_ATTRIBUTES lpSecurityAttributes
+ );
+
+DWORD
+SearchPathWrapper(
+ _In_opt_ LPCWSTR lpPath,
+ _In_ LPCWSTR lpFileName,
+ _In_opt_ LPCWSTR lpExtension,
+ _In_ BOOL getPath,
+ SString& lpBuffer,
+ _Out_opt_ LPWSTR * lpFilePart
+ );
+
+
+DWORD
+GetShortPathNameWrapper(
+ _In_ LPCWSTR lpszLongPath,
+ SString& lpszShortPath
+ );
+
+DWORD
+GetLongPathNameWrapper(
+ _In_ LPCWSTR lpszShortPath,
+ SString& lpszLongPath
+ );
+
+UINT GetTempFileNameWrapper(
+ _In_ LPCTSTR lpPathName,
+ _In_ LPCTSTR lpPrefixString,
+ _In_ UINT uUnique,
+ SString& lpTempFileName
+ );
+
+DWORD GetTempPathWrapper(
+ SString& lpBuffer
+ );
+
+DWORD GetCurrentDirectoryWrapper(
+ SString& lpBuffer
+ );
+
+DWORD
+GetModuleFileNameWrapper(
+ _In_opt_ HMODULE hModule,
+ SString& buffer
+ );
+
+DWORD GetEnvironmentVariableWrapper(
+ _In_opt_ LPCTSTR lpName,
+ _Out_opt_ SString& lpBuffer
+ );
+
+BOOL PAL_GetPALDirectoryWrapper(SString& pbuffer);
+
+#ifndef FEATURE_CORECLR
+//Temporarily providing direct OS Calls Till All of the Desktop CLR start using the above format
+inline DWORD
+SearchPathWrapper(
+ _In_opt_ LPCWSTR lpPath,
+ _In_ LPCWSTR lpFileName,
+ _In_opt_ LPCWSTR lpExtension,
+ _In_ BOOL getPath,
+ _Out_ LPWSTR lpBuffer,
+ _Out_opt_ LPWSTR * lpFilePart
+ )
+{
+ return SearchPathW(
+ lpPath,
+ lpFileName,
+ lpExtension,
+ getPath,
+ lpBuffer,
+ lpFilePart
+ );
+}
+
+
+inline DWORD
+GetShortPathNameWrapper(
+ _In_ LPCWSTR lpszLongPath,
+ _Out_ LPWSTR lpszShortPath,
+ _In_ DWORD cchBuffer
+ )
+{
+ return GetShortPathNameW(
+ lpszLongPath,
+ lpszShortPath,
+ cchBuffer
+ );
+}
+
+inline DWORD
+GetLongPathNameWrapper(
+ _In_ LPCWSTR lpszShortPath,
+ _Out_ LPWSTR lpszLongPath,
+ _In_ DWORD cchBuffer
+ )
+{
+ return GetLongPathNameW(
+ lpszShortPath,
+ lpszLongPath,
+ cchBuffer
+ );
+}
+
+inline UINT GetTempFileNameWrapper(
+ _In_ LPCWSTR lpPathName,
+ _In_ LPCWSTR lpPrefixString,
+ _In_ UINT uUnique,
+ _Out_ LPWSTR lpTempFileName
+ )
+{
+ return GetTempFileNameW(
+ lpPathName,
+ lpPrefixString,
+ uUnique,
+ lpTempFileName
+ );
+}
+
+inline DWORD GetTempPathWrapper(
+ _In_ DWORD nBufferLength,
+ _Out_ LPWSTR lpBuffer
+ )
+{
+ return GetTempPathW(
+ nBufferLength,
+ lpBuffer
+ );
+}
+
+inline DWORD GetCurrentDirectoryWrapper(
+ _In_ DWORD nBufferLength,
+ _Out_ LPWSTR lpBuffer
+ )
+{
+ return GetCurrentDirectoryW(
+ nBufferLength,
+ lpBuffer
+ );
+}
+
+inline DWORD
+GetModuleFileNameWrapper(
+ _In_opt_ HMODULE hModule,
+ _Out_ LPWSTR lpFilename,
+ _In_ DWORD nSize
+ )
+{
+ return GetModuleFileNameW(
+ hModule,
+ lpFilename,
+ nSize
+ );
+}
+
+inline DWORD GetEnvironmentVariableWrapper(
+ _In_opt_ LPCWSTR lpName,
+ _Out_opt_ LPWSTR lpBuffer,
+ _In_ DWORD nSize
+ )
+{
+ return GetEnvironmentVariableW(
+ lpName,
+ lpBuffer,
+ nSize
+ );
+}
+#endif //FEATURE_CORECLR
+#endif //_WIN_PATH_APIS_WRAPPER_
+
diff --git a/src/inc/marvin32.h b/src/inc/marvin32.h
new file mode 100644
index 0000000000..85b9e958ad
--- /dev/null
+++ b/src/inc/marvin32.h
@@ -0,0 +1,85 @@
+// 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.
+
+#ifndef MARVIN32_INCLUDED
+#define MARVIN32_INCLUDED
+
+
+#include "common.h"
+#include "windows.h"
+
+//
+// Pointer-const typedefs:
+//
+// These definitions are missing from the standard Windows declarations.
+// Should probably be moved to a central typedef file.
+//
+typedef const BYTE * PCBYTE;
+typedef const USHORT * PCUSHORT;
+typedef const ULONG * PCULONG;
+typedef const ULONGLONG * PCULONGLONG;
+typedef const VOID * PCVOID;
+
+
+
+//
+// MARVIN32
+//
+
+#define SYMCRYPT_MARVIN32_RESULT_SIZE (8)
+#define SYMCRYPT_MARVIN32_SEED_SIZE (8)
+#define SYMCRYPT_MARVIN32_INPUT_BLOCK_SIZE (4)
+
+// These macros only support little-endian machines with unaligned access
+#define LOAD_LSBFIRST16( p ) ( *(USHORT *)(p))
+#define LOAD_LSBFIRST32( p ) ( *(ULONG *)(p))
+#define STORE_LSBFIRST32( p, x ) ( *(ULONG *)(p) = (x) )
+
+// Disable the warning about padding the struct on amd64
+#pragma warning(push)
+#pragma warning(disable:4324)
+
+typedef struct _SYMCRYPT_MARVIN32_EXPANDED_SEED
+{
+ ULONG s[2];
+} SYMCRYPT_MARVIN32_EXPANDED_SEED, *PSYMCRYPT_MARVIN32_EXPANDED_SEED;
+
+typedef SYMCRYPT_MARVIN32_EXPANDED_SEED SYMCRYPT_MARVIN32_CHAINING_STATE, *PSYMCRYPT_MARVIN32_CHAINING_STATE;
+typedef const SYMCRYPT_MARVIN32_EXPANDED_SEED * PCSYMCRYPT_MARVIN32_EXPANDED_SEED;
+
+typedef struct _SYMCRYPT_MARVIN32_STATE
+{
+ BYTE buffer[8]; // 4 bytes of data, 4 more bytes for final padding
+ SYMCRYPT_MARVIN32_CHAINING_STATE chain; // chaining state
+ PCSYMCRYPT_MARVIN32_EXPANDED_SEED pSeed; //
+ ULONG dataLength; // length of the data processed so far, mod 2^32
+} SYMCRYPT_MARVIN32_STATE, *PSYMCRYPT_MARVIN32_STATE;
+typedef const SYMCRYPT_MARVIN32_STATE *PCSYMCRYPT_MARVIN32_STATE;
+#pragma warning(pop)
+
+//
+// Function declarations
+//
+HRESULT SymCryptMarvin32ExpandSeed(
+ __out PSYMCRYPT_MARVIN32_EXPANDED_SEED pExpandedSeed,
+ __in_ecount(cbSeed) PCBYTE pbSeed,
+ SIZE_T cbSeed);
+
+VOID SymCryptMarvin32Init(_Out_ PSYMCRYPT_MARVIN32_STATE pState,
+ _In_ PCSYMCRYPT_MARVIN32_EXPANDED_SEED pExpandedSeed);
+
+VOID SymCryptMarvin32Result(
+ _Inout_ PSYMCRYPT_MARVIN32_STATE pState,
+ _Out_ PBYTE pbResult);
+
+VOID SymCryptMarvin32Append(_Inout_ SYMCRYPT_MARVIN32_STATE * state,
+ _In_reads_bytes_(cbData) PCBYTE pbData,
+ SIZE_T cbData);
+
+VOID SymCryptMarvin32(
+ __in PCSYMCRYPT_MARVIN32_EXPANDED_SEED pExpandedSeed,
+ __in_ecount(cbData) PCBYTE pbData,
+ SIZE_T cbData,
+ __out_ecount(SYMCRYPT_MARVIN32_RESULT_SIZE) PBYTE pbResult);
+#endif // MARVIN32_INCLUDED
diff --git a/src/inc/md5.h b/src/inc/md5.h
new file mode 100644
index 0000000000..b3684718e5
--- /dev/null
+++ b/src/inc/md5.h
@@ -0,0 +1,134 @@
+// 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.
+//
+// md5.h
+//
+
+//
+// A pretty fast implementation of MD5
+//
+
+
+#ifndef __MD5_H__
+#define __MD5_H__
+
+/////////////////////////////////////////////////////////////////////////////////////
+//
+// Declaration of the central transform function
+//
+void __stdcall MD5Transform(ULONG state[4], const ULONG* data);
+
+/////////////////////////////////////////////////////////////////////////////////////
+
+#include <pshpack1.h>
+
+
+// This structure is used to return the final resulting hash.
+//
+struct MD5HASHDATA
+ {
+ union
+ {
+ BYTE rgb[16];
+ struct
+ {
+ ULONGLONG ullLow;
+ ULONGLONG ullHigh;
+ } u;
+ struct
+ {
+ ULONG u0;
+ ULONG u1;
+ ULONG u2;
+ ULONG u3;
+ } v;
+ };
+ };
+
+inline BOOL operator==(const MD5HASHDATA& me, const MD5HASHDATA& him)
+ {
+ return memcmp(&me, &him, sizeof(MD5HASHDATA)) == 0;
+ }
+
+inline BOOL operator!=(const MD5HASHDATA& me, const MD5HASHDATA& him)
+ {
+ return memcmp(&me, &him, sizeof(MD5HASHDATA)) != 0;
+ }
+
+
+// The engine that carries out the hash
+//
+class MD5
+ {
+ // These four values must be contiguous, and in this order
+ union
+ {
+ ULONG m_state[4];
+ struct
+ {
+ ULONG m_a; // state
+ ULONG m_b; // ... variables
+ ULONG m_c; // ... as found in
+ ULONG m_d; // ... RFC1321
+ } u;
+ };
+
+ BYTE m_data[64]; // where to accumulate the data as we are passed it
+ ULONGLONG m_cbitHashed; // amount of data that we've hashed
+ ULONG m_cbData; // number of bytes presently in data
+
+ BYTE m_padding[64]; // padding data, used if length data not = 0 mod 64
+
+public:
+
+ /////////////////////////////////////////////////////////////////////////////////////
+
+ void Hash(const BYTE* pbData, ULONG cbData, MD5HASHDATA* phash, BOOL fConstructed = FALSE)
+ {
+ Init(fConstructed);
+ HashMore(pbData, cbData);
+ GetHashValue(phash);
+ }
+
+ /////////////////////////////////////////////////////////////////////////////////////
+
+ void Hash(const BYTE* pbData, ULONGLONG cbData, MD5HASHDATA* phash, BOOL fConstructed = FALSE)
+ {
+ Init(fConstructed);
+
+ ULARGE_INTEGER ul;
+ ul.QuadPart = cbData;
+
+ while (ul.u.HighPart)
+ {
+ ULONG cbHash = 0xFFFFFFFF; // Hash as much as we can at once
+ HashMore(pbData, cbHash);
+ pbData += cbHash;
+ ul.QuadPart -= cbHash;
+ }
+
+ HashMore(pbData, ul.u.LowPart); // Hash whatever is left
+
+ GetHashValue(phash);
+ }
+
+ /////////////////////////////////////////////////////////////////////////////////////
+
+ void Init(BOOL fConstructed = FALSE);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+
+ void HashMore(const void* pvInput, ULONG cbInput);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+
+ void GetHashValue(MD5HASHDATA* phash);
+
+ /////////////////////////////////////////////////////////////////////////////////////
+
+ };
+
+#include <poppack.h>
+
+#endif
diff --git a/src/inc/mdcommon.h b/src/inc/mdcommon.h
new file mode 100644
index 0000000000..7aeb710aa8
--- /dev/null
+++ b/src/inc/mdcommon.h
@@ -0,0 +1,54 @@
+// 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.
+//*****************************************************************************
+// MDCommon.h
+//
+// Common header file for both MD and COMPLIB subdirectories
+//
+//*****************************************************************************
+
+#ifndef __MDCommon_h__
+#define __MDCommon_h__
+
+// File types for the database.
+enum FILETYPE
+{
+ FILETYPE_UNKNOWN, // Unknown or undefined type.
+ FILETYPE_CLB, // Native .clb file format.
+ FILETYPE_CLX, // An obsolete file format.
+ FILETYPE_NTPE, // Windows PE executable.
+ FILETYPE_NTOBJ, // .obj file format (with .clb embedded).
+ FILETYPE_TLB // Typelib format.
+};
+
+enum MAPPINGTYPE
+{
+ MTYPE_NOMAPPING, // No mapped file
+ MTYPE_FLAT, // Mapped as a flat file
+ MTYPE_IMAGE // Mapped with the SEC_IMAGE flag
+};
+
+
+#define SCHEMA_STREAM_A "#Schema"
+#define STRING_POOL_STREAM_A "#Strings"
+#define BLOB_POOL_STREAM_A "#Blob"
+#define US_BLOB_POOL_STREAM_A "#US"
+#define GUID_POOL_STREAM_A "#GUID"
+#define COMPRESSED_MODEL_STREAM_A "#~"
+#define ENC_MODEL_STREAM_A "#-"
+#define MINIMAL_MD_STREAM_A "#JTD"
+#define HOT_MODEL_STREAM_A "#!"
+
+
+#define SCHEMA_STREAM W("#Schema")
+#define STRING_POOL_STREAM W("#Strings")
+#define BLOB_POOL_STREAM W("#Blob")
+#define US_BLOB_POOL_STREAM W("#US")
+#define GUID_POOL_STREAM W("#GUID")
+#define COMPRESSED_MODEL_STREAM W("#~")
+#define ENC_MODEL_STREAM W("#-")
+#define MINIMAL_MD_STREAM W("#JTD")
+#define HOT_MODEL_STREAM W("#!")
+
+#endif // __MDCommon_h__
diff --git a/src/inc/memorypool.h b/src/inc/memorypool.h
new file mode 100644
index 0000000000..9ea524f1f2
--- /dev/null
+++ b/src/inc/memorypool.h
@@ -0,0 +1,143 @@
+// 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.
+
+
+#ifndef _MEMORYPOOL_
+#define _MEMORYPOOL_
+
+#include "daccess.h"
+#include "contract.h"
+
+//
+// A MemoryPool is an allocator for a fixed size elements.
+// Allocating and freeing elements from the pool is very cheap compared
+// to a general allocator like new. However, a MemoryPool is slightly
+// more greedy - it preallocates a bunch of elements at a time, and NEVER
+// RELEASES MEMORY FROM THE POOL ONCE IT IS ALLOCATED, (unless you call
+// FreeAllElements.)
+//
+// It also has several additional features:
+// * you can free the entire pool of objects cheaply.
+// * you can test an object to see if it's an element of the pool.
+//
+
+class MemoryPool
+{
+ public:
+
+#ifndef DACCESS_COMPILE
+ MemoryPool(SIZE_T elementSize, SIZE_T initGrowth = 20, SIZE_T initCount = 0);
+#else
+ MemoryPool() {}
+#endif
+ ~MemoryPool() DAC_EMPTY();
+
+ BOOL IsElement(void *element);
+ BOOL IsAllocatedElement(void *element);
+ void *AllocateElement();
+ void *AllocateElementNoThrow();
+ void FreeElement(void *element);
+ void FreeAllElements();
+ size_t GetSize();
+ private:
+
+ struct Element
+ {
+ Element *next;
+#if _DEBUG
+ int deadBeef;
+#endif
+ };
+
+ struct Block
+ {
+ Block *next;
+ Element *elementsEnd;
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable:4200)
+#endif
+ Element elements[0];
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif
+ };
+
+ SIZE_T m_elementSize;
+ SIZE_T m_growCount;
+ Block *m_blocks;
+ Element *m_freeList;
+
+ BOOL AddBlock(SIZE_T elementCount);
+ void DeadBeef(Element *element);
+
+ public:
+
+ //
+ // NOTE: You can currently only iterate the elements
+ // if none have been freed.
+ //
+
+ class Iterator
+ {
+ private:
+ Block *m_next;
+ BYTE *m_e, *m_eEnd;
+ BYTE *m_end;
+ SIZE_T m_size;
+
+ public:
+ Iterator(MemoryPool *pool);
+
+ BOOL Next();
+
+ void *GetElement() {LIMITED_METHOD_CONTRACT; return (void *) (m_e-m_size); }
+ };
+
+ friend class Iterator;
+};
+
+class MemoryPoolElementHolder
+{
+ protected:
+ MemoryPool* m_pool;
+ void* m_element;
+ BOOL bRelease;
+ public:
+ void SuppressRelease()
+ {
+ LIMITED_METHOD_CONTRACT;
+ _ASSERTE(bRelease);
+ bRelease=false;
+ }
+ void Release()
+ {
+ LIMITED_METHOD_CONTRACT;
+ _ASSERTE(bRelease);
+ m_pool->FreeElement(m_element);
+ bRelease=false;
+ }
+ MemoryPoolElementHolder(MemoryPool* pool, void* element)
+ {
+ LIMITED_METHOD_CONTRACT;
+ m_pool=pool;
+ m_element=element;
+ bRelease=true;
+ }
+
+ ~MemoryPoolElementHolder()
+ {
+ LIMITED_METHOD_CONTRACT;
+ if (bRelease)
+ Release();
+ }
+
+ operator void* ()
+ {
+ LIMITED_METHOD_CONTRACT;
+ return m_element;
+ }
+};
+
+#endif // _MEMORYPOOL_
diff --git a/src/inc/memoryrange.h b/src/inc/memoryrange.h
new file mode 100644
index 0000000000..d558d6b847
--- /dev/null
+++ b/src/inc/memoryrange.h
@@ -0,0 +1,98 @@
+// 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.
+//*****************************************************************************
+// MemoryRange.h
+//
+// defines the code:MemoryRange class.
+//*****************************************************************************
+
+#ifndef _memory_range_h
+#define _memory_range_h
+
+#include "daccess.h"
+
+// MemoryRange is a descriptor of a memory range. This groups (pointer + size).
+//
+// Some key qualities:
+// - simple!
+// - Not mutable
+// - blitabble descriptor which can be useful for out-of-process tools like the debugger.
+// - no ownership semantics.
+// - no manipulation, growing semantics.
+// - no memory marshalling, allocation, copying. etc.
+// - can be efficiently passed / copied / returned by value
+//
+// This class has general value as an abstraction to group pointer and size together. It also has significant
+// value to the debugger. An expected design pattern is that other mutable complex data structures (eg,
+// code:SBuffer, code:CGrowableStream) will provide an accessor to expose their underlying storage as a
+// MemoryRange to debugger. This mirrors the Debugger's code:TargetBuffer data structure, but as a
+// general-purpose VM utility versus a debugger right-side data structure.
+
+//
+class MemoryRange
+{
+public:
+ // Constructor to create a memory range around a (start address, size) pair.
+ MemoryRange() :
+ m_pStartAddress(NULL),
+ m_cbBytes(0)
+ {
+ SUPPORTS_DAC;
+ }
+
+ MemoryRange(PTR_VOID pStartAddress, SIZE_T cbBytes) :
+ m_pStartAddress(pStartAddress),
+ m_cbBytes(cbBytes)
+ {
+ SUPPORTS_DAC;
+ }
+
+ // Note: use compiler-default copy ctor and assignment operator
+
+
+
+ // Check whether a pointer is in the memory range represented by this instance.
+ BOOL IsInRange(PTR_VOID pAddress) const
+ {
+ LIMITED_METHOD_DAC_CONTRACT;
+
+ return (dac_cast<TADDR>(pAddress) - dac_cast<TADDR>(m_pStartAddress)) < m_cbBytes;
+ }
+
+ // Check whether a pointer is in the memory range represented by this instance.
+ BOOL IsInRange(TADDR pAddress) const
+ {
+ LIMITED_METHOD_DAC_CONTRACT;
+
+ return (pAddress - dac_cast<TADDR>(m_pStartAddress)) < m_cbBytes;
+ }
+
+ // Get the starting address.
+ PTR_VOID StartAddress() const
+ {
+ SUPPORTS_DAC;
+ return m_pStartAddress;
+ }
+
+ // Get the size of the range in bytes
+ SIZE_T Size() const
+ {
+ SUPPORTS_DAC;
+ return m_cbBytes;
+ }
+
+private:
+ // The start of the memory range.
+ PTR_VOID const m_pStartAddress;
+
+ // The size of the memory range in bytes.
+ // This is s SIZE_T so that it can describe any memory range in the process (for example, larger than 4gb on 64-bit machines)
+ const SIZE_T m_cbBytes;
+
+};
+
+typedef ArrayDPTR(MemoryRange) ARRAY_PTR_MemoryRange;
+
+#endif // _memory_range_h
+
diff --git a/src/inc/metadata.h b/src/inc/metadata.h
new file mode 100644
index 0000000000..8fcf493a23
--- /dev/null
+++ b/src/inc/metadata.h
@@ -0,0 +1,1557 @@
+// 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.
+//****************************************************************************
+// File: metadata.h
+//
+
+//
+// Notes:
+// Common includes for EE & metadata internal. This file contains
+// definition of CorMetaDataScope
+//****************************************************************************
+
+#ifndef _METADATA_H_
+#define _METADATA_H_
+
+#include "../md/inc/metamodelro.h"
+#include "../md/inc/liteweightstgdb.h"
+
+class UTSemReadWrite;
+
+inline int IsGlobalMethodParentTk(mdTypeDef td)
+{
+ LIMITED_METHOD_CONTRACT;
+
+ return (td == mdTypeDefNil || td == mdTokenNil);
+}
+
+typedef enum CorInternalStates
+{
+ tdNoTypes = 0x00000000,
+ tdAllAssemblies = 0x00000001,
+ tdAllTypes = 0xffffffff,
+} CorInternalStates;
+
+//
+// MetaData custom value names.
+//
+enum CorIfaceAttr
+{
+ ifDual = 0, // Interface derives from IDispatch.
+ ifVtable = 1, // Interface derives from IUnknown.
+ ifDispatch = 2, // Interface is a dispinterface.
+ ifInspectable = 3, // Interface derives from IInspectable.
+ ifLast = 4, // The last member of the enum.
+};
+
+inline BOOL IsDispatchBasedItf(CorIfaceAttr ifaceAttr)
+{
+ return (ifaceAttr == ifDual || ifaceAttr == ifDispatch);
+}
+
+enum CorClassIfaceAttr
+{
+ clsIfNone = 0, // No class interface is generated.
+ clsIfAutoDisp = 1, // A dispatch only class interface is generated.
+ clsIfAutoDual = 2, // A dual class interface is generated.
+ clsIfLast = 3, // The last member of the enum.
+};
+
+//
+// The default values for the COM interface and class interface types.
+//
+#define DEFAULT_COM_INTERFACE_TYPE ifDual
+#define DEFAULT_CLASS_INTERFACE_TYPE clsIfAutoDisp
+
+#define HANDLE_UNCOMPRESSED(func) (E_FAIL)
+#define HANDLE_UNCOMPRESSED_BOOL(func) (false)
+
+class TOKENLIST : public CDynArray<mdToken>
+{
+};
+
+
+typedef enum tagEnumType
+{
+ MDSimpleEnum = 0x0, // simple enumerator that doesn't allocate memory
+
+ // You could get this kind of enum if you perform a non-simple query (such as EnumMethodWithName).
+ //
+ MDDynamicArrayEnum = 0x2, // dynamic array that holds tokens
+
+ MDCustomEnum = 0x3, // Custom enumerator that doesnt work with the enum functions
+} EnumType;
+
+//*****************************************
+// Enumerator used by MetaDataInternal
+//*****************************************
+struct HENUMInternal
+{
+ DWORD m_tkKind; // kind of tables that the enum is holding the result
+ ULONG m_ulCount; // count of total entries holding by the enumerator
+
+ EnumType m_EnumType;
+
+ struct {
+ ULONG m_ulStart;
+ ULONG m_ulEnd;
+ ULONG m_ulCur;
+ } u;
+
+ // m_cursor will go away when we no longer support running EE with uncompressed
+ // format. WHEN WE REMOVE THIS, REMOVE ITS VESTIAGES FROM ZeroEnum as well
+ //
+ union {
+ void* m_alignpad; // The first item is m_cursor[] is a pointer
+ char m_cursor[32]; // cursor holding query result for read/write mode
+ };
+
+ // TOKENLIST daTKList; // dynamic arrays of token list
+ HENUMInternal() : m_EnumType(MDSimpleEnum) { LIMITED_METHOD_DAC_CONTRACT; }
+
+ // in-place initialization
+ static void InitDynamicArrayEnum(
+ HENUMInternal *pEnum); // HENUMInternal to be initialized
+
+ static void InitSimpleEnum(
+ DWORD tkKind, // kind of token that we are iterating
+ ULONG ridStart, // starting rid
+ ULONG ridEnd, // end rid
+ HENUMInternal *pEnum); // HENUMInternal to be initialized
+
+ // Specialized helper which should be better than always calling memset
+ inline
+ static void ZeroEnum(
+ HENUMInternal *pEnum)
+ {
+ // we use this to avoid the memset that will happen otherwise.
+ // this should be inlined in its caller. we are seeing a large
+ // number of calls to memset from MDInternalRO::EnumPermissionSetsInit
+ // on x64 which we can eliminate with this code.
+ pEnum->m_tkKind = 0;
+ pEnum->m_ulCount = 0;
+ pEnum->m_EnumType = MDSimpleEnum;
+ pEnum->u.m_ulStart = 0;
+ pEnum->u.m_ulEnd = 0;
+ pEnum->u.m_ulCur = 0;
+
+ // TODO: remove this when we remove m_cursor from the HENUMInternal structure
+ _ASSERTE(IS_ALIGNED(pEnum->m_cursor, sizeof(DWORD)));
+ _ASSERTE((sizeof(HENUMInternal) - offsetof(HENUMInternal, m_cursor)) == (8 * sizeof(DWORD)));
+
+ DWORD* pBuffer = (DWORD*)pEnum->m_cursor;
+ pBuffer[0] = 0;
+ pBuffer[1] = 0;
+ pBuffer[2] = 0;
+ pBuffer[3] = 0;
+ pBuffer[4] = 0;
+ pBuffer[5] = 0;
+ pBuffer[6] = 0;
+ pBuffer[7] = 0;
+ }
+
+ // This will only clear the content of enum and will not free the memory of enum
+ static void ClearEnum(
+ HENUMInternal *pmdEnum);
+
+ // create a HENUMInternal. This will allocate the memory
+ __checkReturn
+ static HRESULT CreateSimpleEnum(
+ DWORD tkKind, // kind of token that we are iterating
+ ULONG ridStart, // starting rid
+ ULONG ridEnd, // end rid
+ HENUMInternal **ppEnum); // return the created HENUMInternal
+
+ __checkReturn
+ static HRESULT CreateDynamicArrayEnum(
+ DWORD tkKind, // kind of token that we are iterating
+ HENUMInternal **ppEnum); // return the created HENUMInternal
+
+ // Destory Enum. This will free the memory
+ static void DestroyEnum(
+ HENUMInternal *pmdEnum);
+
+ static void DestroyEnumIfEmpty(
+ HENUMInternal **ppEnum); // reset the enumerator pointer to NULL if empty
+
+ __checkReturn
+ static HRESULT EnumWithCount(
+ HENUMInternal *pEnum, // enumerator
+ ULONG cMax, // max tokens that caller wants
+ mdToken rTokens[], // output buffer to fill the tokens
+ ULONG *pcTokens); // number of tokens fill to the buffer upon return
+
+ __checkReturn
+ static HRESULT EnumWithCount(
+ HENUMInternal *pEnum, // enumerator
+ ULONG cMax, // max tokens that caller wants
+ mdToken rTokens1[], // first output buffer to fill the tokens
+ mdToken rTokens2[], // second output buffer to fill the tokens
+ ULONG *pcTokens); // number of tokens fill to the buffer upon return
+
+ __checkReturn
+ static HRESULT AddElementToEnum(
+ HENUMInternal *pEnum, // return the created HENUMInternal
+ mdToken tk); // token to fill
+
+ //*****************************************
+ // Get next value contained in the enumerator
+ //*****************************************
+ static bool EnumNext(
+ HENUMInternal *phEnum, // [IN] the enumerator to retrieve information
+ mdToken *ptk); // [OUT] token to scope the search
+
+ __checkReturn
+ static HRESULT GetCount(
+ HENUMInternal *phEnum, // [IN] the enumerator to retrieve information
+ ULONG *pCount); // ]OUT] the index of the desired item
+
+ __checkReturn
+ static HRESULT GetElement(
+ HENUMInternal *phEnum, // [IN] the enumerator to retrieve information
+ ULONG ix, // ]IN] the index of the desired item
+ mdToken *ptk); // [OUT] token to fill
+
+};
+
+
+
+//*****************************************
+// Default Value for field, param or property. Returned by GetDefaultValue
+//*****************************************
+typedef struct _MDDefaultValue
+{
+#if BIGENDIAN
+ _MDDefaultValue(void)
+ {
+ m_bType = ELEMENT_TYPE_END;
+ }
+ ~_MDDefaultValue(void)
+ {
+ if (m_bType == ELEMENT_TYPE_STRING)
+ {
+ delete[] m_wzValue;
+ }
+ }
+#endif
+
+ // type of default value
+ BYTE m_bType; // CorElementType for the default value
+
+ // the default value
+ union
+ {
+ BOOL m_bValue; // ELEMENT_TYPE_BOOLEAN
+ CHAR m_cValue; // ELEMENT_TYPE_I1
+ BYTE m_byteValue; // ELEMENT_TYPE_UI1
+ SHORT m_sValue; // ELEMENT_TYPE_I2
+ USHORT m_usValue; // ELEMENT_TYPE_UI2
+ LONG m_lValue; // ELEMENT_TYPE_I4
+ ULONG m_ulValue; // ELEMENT_TYPE_UI4
+ LONGLONG m_llValue; // ELEMENT_TYPE_I8
+ ULONGLONG m_ullValue; // ELEMENT_TYPE_UI8
+ FLOAT m_fltValue; // ELEMENT_TYPE_R4
+ DOUBLE m_dblValue; // ELEMENT_TYPE_R8
+ LPCWSTR m_wzValue; // ELEMENT_TYPE_STRING
+ IUnknown *m_unkValue; // ELEMENT_TYPE_CLASS
+ };
+ ULONG m_cbSize; // default value size (for blob)
+
+} MDDefaultValue;
+
+
+
+//*****************************************
+// structure use to in GetAllEventAssociates and GetAllPropertyAssociates
+//*****************************************
+typedef struct
+{
+ mdMethodDef m_memberdef;
+ DWORD m_dwSemantics;
+} ASSOCIATE_RECORD;
+
+
+//
+// structure use to retrieve class layout informaiton
+//
+typedef struct
+{
+ RID m_ridFieldCur; // indexing to the field table
+ RID m_ridFieldEnd; // end index to field table
+} MD_CLASS_LAYOUT;
+
+
+// Structure for describing the Assembly MetaData.
+typedef struct
+{
+ USHORT usMajorVersion; // Major Version.
+ USHORT usMinorVersion; // Minor Version.
+ USHORT usBuildNumber; // Build Number.
+ USHORT usRevisionNumber; // Revision Number.
+ LPCSTR szLocale; // Locale.
+ DWORD *rProcessor; // Processor array.
+ ULONG ulProcessor; // [IN/OUT] Size of the processor array/Actual # of entries filled in.
+ OSINFO *rOS; // OSINFO array.
+ ULONG ulOS; // [IN/OUT]Size of the OSINFO array/Actual # of entries filled in.
+} AssemblyMetaDataInternal;
+
+
+
+// Callback definition for comparing signatures.
+// (*PSIGCOMPARE) (BYTE ScopeSignature[], DWORD ScopeSignatureLength,
+// BYTE ExternalSignature[], DWORD ExternalSignatureLength,
+// void* SignatureData);
+typedef BOOL (*PSIGCOMPARE)(PCCOR_SIGNATURE, DWORD, PCCOR_SIGNATURE, DWORD, void*);
+
+
+
+// {CE0F34ED-BBC6-11d2-941E-0000F8083460}
+EXTERN_GUID(IID_IMDInternalImport, 0xce0f34ed, 0xbbc6, 0x11d2, 0x94, 0x1e, 0x0, 0x0, 0xf8, 0x8, 0x34, 0x60);
+
+#undef INTERFACE
+#define INTERFACE IMDInternalImport
+DECLARE_INTERFACE_(IMDInternalImport, IUnknown)
+{
+ //----------------------------------------------------------------------------------------
+ // !!! READ THIS !!!
+ //
+ // New methods have to be added at the end. The order and signatures of the existing methods
+ // have to be preserved. We need to maintain a backward compatibility for this interface to
+ // allow ildasm to work on SingleCLR.
+ //
+ //----------------------------------------------------------------------------------------
+
+ //*****************************************************************************
+ // return the count of entries of a given kind in a scope
+ // For example, pass in mdtMethodDef will tell you how many MethodDef
+ // contained in a scope
+ //*****************************************************************************
+ STDMETHOD_(ULONG, GetCountWithTokenKind)(// return hresult
+ DWORD tkKind) PURE; // [IN] pass in the kind of token.
+
+ //*****************************************************************************
+ // enumerator for typedef
+ //*****************************************************************************
+ __checkReturn
+ STDMETHOD(EnumTypeDefInit)( // return hresult
+ HENUMInternal *phEnum) PURE; // [OUT] buffer to fill for enumerator data
+
+ STDMETHOD_(ULONG, EnumTypeDefGetCount)(
+ HENUMInternal *phEnum) PURE; // [IN] the enumerator to retrieve information
+
+ STDMETHOD_(void, EnumTypeDefReset)(
+ HENUMInternal *phEnum) PURE; // [IN] the enumerator to retrieve information
+
+ STDMETHOD_(bool, EnumTypeDefNext)( // return hresult
+ HENUMInternal *phEnum, // [IN] input enum
+ mdTypeDef *ptd) PURE; // [OUT] return token
+
+ STDMETHOD_(void, EnumTypeDefClose)(
+ HENUMInternal *phEnum) PURE; // [IN] the enumerator to retrieve information
+
+ //*****************************************************************************
+ // enumerator for MethodImpl
+ //*****************************************************************************
+ __checkReturn
+ STDMETHOD(EnumMethodImplInit)( // return hresult
+ mdTypeDef td, // [IN] TypeDef over which to scope the enumeration.
+ HENUMInternal *phEnumBody, // [OUT] buffer to fill for enumerator data for MethodBody tokens.
+ HENUMInternal *phEnumDecl) PURE; // [OUT] buffer to fill for enumerator data for MethodDecl tokens.
+
+ STDMETHOD_(ULONG, EnumMethodImplGetCount)(
+ HENUMInternal *phEnumBody, // [IN] MethodBody enumerator.
+ HENUMInternal *phEnumDecl) PURE; // [IN] MethodDecl enumerator.
+
+ STDMETHOD_(void, EnumMethodImplReset)(
+ HENUMInternal *phEnumBody, // [IN] MethodBody enumerator.
+ HENUMInternal *phEnumDecl) PURE; // [IN] MethodDecl enumerator.
+
+ __checkReturn
+ STDMETHOD(EnumMethodImplNext)( // return hresult (S_OK = TRUE, S_FALSE = FALSE or error code)
+ HENUMInternal *phEnumBody, // [IN] input enum for MethodBody
+ HENUMInternal *phEnumDecl, // [IN] input enum for MethodDecl
+ mdToken *ptkBody, // [OUT] return token for MethodBody
+ mdToken *ptkDecl) PURE; // [OUT] return token for MethodDecl
+
+ STDMETHOD_(void, EnumMethodImplClose)(
+ HENUMInternal *phEnumBody, // [IN] MethodBody enumerator.
+ HENUMInternal *phEnumDecl) PURE; // [IN] MethodDecl enumerator.
+
+ //*****************************************
+ // Enumerator helpers for memberdef, memberref, interfaceimp,
+ // event, property, exception, param
+ //*****************************************
+
+ __checkReturn
+ STDMETHOD(EnumGlobalFunctionsInit)( // return hresult
+ HENUMInternal *phEnum) PURE; // [OUT] buffer to fill for enumerator data
+
+ __checkReturn
+ STDMETHOD(EnumGlobalFieldsInit)( // return hresult
+ HENUMInternal *phEnum) PURE; // [OUT] buffer to fill for enumerator data
+
+ __checkReturn
+ STDMETHOD(EnumInit)( // return S_FALSE if record not found
+ DWORD tkKind, // [IN] which table to work on
+ mdToken tkParent, // [IN] token to scope the search
+ HENUMInternal *phEnum) PURE; // [OUT] the enumerator to fill
+
+ __checkReturn
+ STDMETHOD(EnumAllInit)( // return S_FALSE if record not found
+ DWORD tkKind, // [IN] which table to work on
+ HENUMInternal *phEnum) PURE; // [OUT] the enumerator to fill
+
+ STDMETHOD_(bool, EnumNext)(
+ HENUMInternal *phEnum, // [IN] the enumerator to retrieve information
+ mdToken *ptk) PURE; // [OUT] token to scope the search
+
+ STDMETHOD_(ULONG, EnumGetCount)(
+ HENUMInternal *phEnum) PURE; // [IN] the enumerator to retrieve information
+
+ STDMETHOD_(void, EnumReset)(
+ HENUMInternal *phEnum) PURE; // [IN] the enumerator to be reset
+
+ STDMETHOD_(void, EnumClose)(
+ HENUMInternal *phEnum) PURE; // [IN] the enumerator to be closed
+
+ //*****************************************
+ // Enumerator helpers for declsecurity.
+ //*****************************************
+ __checkReturn
+ STDMETHOD(EnumPermissionSetsInit)( // return S_FALSE if record not found
+ mdToken tkParent, // [IN] token to scope the search
+ CorDeclSecurity Action, // [IN] Action to scope the search
+ HENUMInternal *phEnum) PURE; // [OUT] the enumerator to fill
+
+ //*****************************************
+ // Enumerator helpers for CustomAttribute
+ //*****************************************
+ __checkReturn
+ STDMETHOD(EnumCustomAttributeByNameInit)(// return S_FALSE if record not found
+ mdToken tkParent, // [IN] token to scope the search
+ LPCSTR szName, // [IN] CustomAttribute's name to scope the search
+ HENUMInternal *phEnum) PURE; // [OUT] the enumerator to fill
+
+ //*****************************************
+ // Nagivator helper to navigate back to the parent token given a token.
+ // For example, given a memberdef token, it will return the containing typedef.
+ //
+ // the mapping is as following:
+ // ---given child type---------parent type
+ // mdMethodDef mdTypeDef
+ // mdFieldDef mdTypeDef
+ // mdInterfaceImpl mdTypeDef
+ // mdParam mdMethodDef
+ // mdProperty mdTypeDef
+ // mdEvent mdTypeDef
+ //
+ //*****************************************
+ __checkReturn
+ STDMETHOD(GetParentToken)(
+ mdToken tkChild, // [IN] given child token
+ mdToken *ptkParent) PURE; // [OUT] returning parent
+
+ //*****************************************
+ // Custom value helpers
+ //*****************************************
+ __checkReturn
+ STDMETHOD(GetCustomAttributeProps)( // S_OK or error.
+ mdCustomAttribute at, // [IN] The attribute.
+ mdToken *ptkType) PURE; // [OUT] Put attribute type here.
+
+ __checkReturn
+ STDMETHOD(GetCustomAttributeAsBlob)(
+ mdCustomAttribute cv, // [IN] given custom value token
+ void const **ppBlob, // [OUT] return the pointer to internal blob
+ ULONG *pcbSize) PURE; // [OUT] return the size of the blob
+
+ // returned void in v1.0/v1.1
+ __checkReturn
+ STDMETHOD (GetScopeProps)(
+ LPCSTR *pszName, // [OUT] scope name
+ GUID *pmvid) PURE; // [OUT] version id
+
+ // finding a particular method
+ __checkReturn
+ STDMETHOD(FindMethodDef)(
+ mdTypeDef classdef, // [IN] given typedef
+ LPCSTR szName, // [IN] member name
+ PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of CLR signature
+ ULONG cbSigBlob, // [IN] count of bytes in the signature blob
+ mdMethodDef *pmd) PURE; // [OUT] matching memberdef
+
+ // return a iSeq's param given a MethodDef
+ __checkReturn
+ STDMETHOD(FindParamOfMethod)( // S_OK or error.
+ mdMethodDef md, // [IN] The owning method of the param.
+ ULONG iSeq, // [IN] The sequence # of the param.
+ mdParamDef *pparamdef) PURE; // [OUT] Put ParamDef token here.
+
+ //*****************************************
+ //
+ // GetName* functions
+ //
+ //*****************************************
+
+ // return the name and namespace of typedef
+ __checkReturn
+ STDMETHOD(GetNameOfTypeDef)(
+ mdTypeDef classdef, // given classdef
+ LPCSTR *pszname, // return class name(unqualified)
+ LPCSTR *psznamespace) PURE; // return the name space name
+
+ __checkReturn
+ STDMETHOD(GetIsDualOfTypeDef)(
+ mdTypeDef classdef, // [IN] given classdef.
+ ULONG *pDual) PURE; // [OUT] return dual flag here.
+
+ __checkReturn
+ STDMETHOD(GetIfaceTypeOfTypeDef)(
+ mdTypeDef classdef, // [IN] given classdef.
+ ULONG *pIface) PURE; // [OUT] 0=dual, 1=vtable, 2=dispinterface
+
+ // get the name of either methoddef
+ __checkReturn
+ STDMETHOD(GetNameOfMethodDef)( // return the name of the memberdef in UTF8
+ mdMethodDef md, // given memberdef
+ LPCSTR *pszName) PURE;
+
+ __checkReturn
+ STDMETHOD(GetNameAndSigOfMethodDef)(
+ mdMethodDef methoddef, // [IN] given memberdef
+ PCCOR_SIGNATURE *ppvSigBlob, // [OUT] point to a blob value of CLR signature
+ ULONG *pcbSigBlob, // [OUT] count of bytes in the signature blob
+ LPCSTR *pszName) PURE;
+
+ // return the name of a FieldDef
+ __checkReturn
+ STDMETHOD(GetNameOfFieldDef)(
+ mdFieldDef fd, // given memberdef
+ LPCSTR *pszName) PURE;
+
+ // return the name of typeref
+ __checkReturn
+ STDMETHOD(GetNameOfTypeRef)(
+ mdTypeRef classref, // [IN] given typeref
+ LPCSTR *psznamespace, // [OUT] return typeref name
+ LPCSTR *pszname) PURE; // [OUT] return typeref namespace
+
+ // return the resolutionscope of typeref
+ __checkReturn
+ STDMETHOD(GetResolutionScopeOfTypeRef)(
+ mdTypeRef classref, // given classref
+ mdToken *ptkResolutionScope) PURE;
+
+ // Find the type token given the name.
+ __checkReturn
+ STDMETHOD(FindTypeRefByName)(
+ LPCSTR szNamespace, // [IN] Namespace for the TypeRef.
+ LPCSTR szName, // [IN] Name of the TypeRef.
+ mdToken tkResolutionScope, // [IN] Resolution Scope fo the TypeRef.
+ mdTypeRef *ptk) PURE; // [OUT] TypeRef token returned.
+
+ // return the TypeDef properties
+ // returned void in v1.0/v1.1
+ __checkReturn
+ STDMETHOD(GetTypeDefProps)(
+ mdTypeDef classdef, // given classdef
+ DWORD *pdwAttr, // return flags on class, tdPublic, tdAbstract
+ mdToken *ptkExtends) PURE; // [OUT] Put base class TypeDef/TypeRef here
+
+ // return the item's guid
+ __checkReturn
+ STDMETHOD(GetItemGuid)(
+ mdToken tkObj, // [IN] given item.
+ CLSID *pGuid) PURE; // [out[ put guid here.
+
+ // Get enclosing class of the NestedClass.
+ __checkReturn
+ STDMETHOD(GetNestedClassProps)( // S_OK or error
+ mdTypeDef tkNestedClass, // [IN] NestedClass token.
+ mdTypeDef *ptkEnclosingClass) PURE; // [OUT] EnclosingClass token.
+
+ // Get count of Nested classes given the enclosing class.
+ __checkReturn
+ STDMETHOD(GetCountNestedClasses)( // return count of Nested classes.
+ mdTypeDef tkEnclosingClass, // Enclosing class.
+ ULONG *pcNestedClassesCount) PURE;
+
+ // Return array of Nested classes given the enclosing class.
+ __checkReturn
+ STDMETHOD(GetNestedClasses)( // Return actual count.
+ mdTypeDef tkEnclosingClass, // [IN] Enclosing class.
+ mdTypeDef *rNestedClasses, // [OUT] Array of nested class tokens.
+ ULONG ulNestedClasses, // [IN] Size of array.
+ ULONG *pcNestedClasses) PURE;
+
+ // return the ModuleRef properties
+ // returned void in v1.0/v1.1
+ __checkReturn
+ STDMETHOD(GetModuleRefProps)(
+ mdModuleRef mur, // [IN] moduleref token
+ LPCSTR *pszName) PURE; // [OUT] buffer to fill with the moduleref name
+
+ //*****************************************
+ //
+ // GetSig* functions
+ //
+ //*****************************************
+ __checkReturn
+ STDMETHOD(GetSigOfMethodDef)(
+ mdMethodDef tkMethodDef, // [IN] given MethodDef
+ ULONG * pcbSigBlob, // [OUT] count of bytes in the signature blob
+ PCCOR_SIGNATURE * ppSig) PURE;
+
+ __checkReturn
+ STDMETHOD(GetSigOfFieldDef)(
+ mdFieldDef tkFieldDef, // [IN] given FieldDef
+ ULONG * pcbSigBlob, // [OUT] count of bytes in the signature blob
+ PCCOR_SIGNATURE * ppSig) PURE;
+
+ __checkReturn
+ STDMETHOD(GetSigFromToken)(
+ mdToken tk, // FieldDef, MethodDef, Signature or TypeSpec token
+ ULONG * pcbSig,
+ PCCOR_SIGNATURE * ppSig) PURE;
+
+
+
+ //*****************************************
+ // get method property
+ //*****************************************
+ __checkReturn
+ STDMETHOD(GetMethodDefProps)(
+ mdMethodDef md, // The method for which to get props.
+ DWORD *pdwFlags) PURE;
+
+ //*****************************************
+ // return method implementation informaiton, like RVA and implflags
+ //*****************************************
+ // returned void in v1.0/v1.1
+ __checkReturn
+ STDMETHOD(GetMethodImplProps)(
+ mdToken tk, // [IN] MethodDef
+ ULONG *pulCodeRVA, // [OUT] CodeRVA
+ DWORD *pdwImplFlags) PURE; // [OUT] Impl. Flags
+
+ //*****************************************
+ // return method implementation informaiton, like RVA and implflags
+ //*****************************************
+ __checkReturn
+ STDMETHOD(GetFieldRVA)(
+ mdFieldDef fd, // [IN] fielddef
+ ULONG *pulCodeRVA) PURE; // [OUT] CodeRVA
+
+ //*****************************************
+ // get field property
+ //*****************************************
+ __checkReturn
+ STDMETHOD(GetFieldDefProps)(
+ mdFieldDef fd, // [IN] given fielddef
+ DWORD *pdwFlags) PURE; // [OUT] return fdPublic, fdPrive, etc flags
+
+ //*****************************************************************************
+ // return default value of a token(could be paramdef, fielddef, or property
+ //*****************************************************************************
+ __checkReturn
+ STDMETHOD(GetDefaultValue)(
+ mdToken tk, // [IN] given FieldDef, ParamDef, or Property
+ MDDefaultValue *pDefaultValue) PURE;// [OUT] default value to fill
+
+
+ //*****************************************
+ // get dispid of a MethodDef or a FieldDef
+ //*****************************************
+ __checkReturn
+ STDMETHOD(GetDispIdOfMemberDef)( // return hresult
+ mdToken tk, // [IN] given methoddef or fielddef
+ ULONG *pDispid) PURE; // [OUT] Put the dispid here.
+
+ //*****************************************
+ // return TypeRef/TypeDef given an InterfaceImpl token
+ //*****************************************
+ __checkReturn
+ STDMETHOD(GetTypeOfInterfaceImpl)( // return the TypeRef/typedef token for the interfaceimpl
+ mdInterfaceImpl iiImpl, // given a interfaceimpl
+ mdToken *ptkType) PURE;
+
+ //*****************************************
+ // look up function for TypeDef
+ //*****************************************
+ __checkReturn
+ STDMETHOD(FindTypeDef)(
+ LPCSTR szNamespace, // [IN] Namespace for the TypeDef.
+ LPCSTR szName, // [IN] Name of the TypeDef.
+ mdToken tkEnclosingClass, // [IN] TypeRef/TypeDef Token for the enclosing class.
+ mdTypeDef *ptypedef) PURE; // [IN] return typedef
+
+ //*****************************************
+ // return name and sig of a memberref
+ //*****************************************
+ __checkReturn
+ STDMETHOD(GetNameAndSigOfMemberRef)( // return name here
+ mdMemberRef memberref, // given memberref
+ PCCOR_SIGNATURE *ppvSigBlob, // [OUT] point to a blob value of CLR signature
+ ULONG *pcbSigBlob, // [OUT] count of bytes in the signature blob
+ LPCSTR *pszName) PURE;
+
+ //*****************************************************************************
+ // Given memberref, return the parent. It can be TypeRef, ModuleRef, MethodDef
+ //*****************************************************************************
+ __checkReturn
+ STDMETHOD(GetParentOfMemberRef)(
+ mdMemberRef memberref, // given memberref
+ mdToken *ptkParent) PURE; // return the parent token
+
+ __checkReturn
+ STDMETHOD(GetParamDefProps)(
+ mdParamDef paramdef, // given a paramdef
+ USHORT *pusSequence, // [OUT] slot number for this parameter
+ DWORD *pdwAttr, // [OUT] flags
+ LPCSTR *pszName) PURE; // [OUT] return the name of the parameter
+
+ __checkReturn
+ STDMETHOD(GetPropertyInfoForMethodDef)( // Result.
+ mdMethodDef md, // [IN] memberdef
+ mdProperty *ppd, // [OUT] put property token here
+ LPCSTR *pName, // [OUT] put pointer to name here
+ ULONG *pSemantic) PURE; // [OUT] put semantic here
+
+ //*****************************************
+ // class layout/sequence information
+ //*****************************************
+ __checkReturn
+ STDMETHOD(GetClassPackSize)( // return error if class doesn't have packsize
+ mdTypeDef td, // [IN] give typedef
+ ULONG *pdwPackSize) PURE; // [OUT] 1, 2, 4, 8, or 16
+
+ __checkReturn
+ STDMETHOD(GetClassTotalSize)( // return error if class doesn't have total size info
+ mdTypeDef td, // [IN] give typedef
+ ULONG *pdwClassSize) PURE; // [OUT] return the total size of the class
+
+ __checkReturn
+ STDMETHOD(GetClassLayoutInit)(
+ mdTypeDef td, // [IN] give typedef
+ MD_CLASS_LAYOUT *pLayout) PURE; // [OUT] set up the status of query here
+
+ __checkReturn
+ STDMETHOD(GetClassLayoutNext)(
+ MD_CLASS_LAYOUT *pLayout, // [IN|OUT] set up the status of query here
+ mdFieldDef *pfd, // [OUT] return the fielddef
+ ULONG *pulOffset) PURE; // [OUT] return the offset/ulSequence associate with it
+
+ //*****************************************
+ // marshal information of a field
+ //*****************************************
+ __checkReturn
+ STDMETHOD(GetFieldMarshal)( // return error if no native type associate with the token
+ mdFieldDef fd, // [IN] given fielddef
+ PCCOR_SIGNATURE *pSigNativeType, // [OUT] the native type signature
+ ULONG *pcbNativeType) PURE; // [OUT] the count of bytes of *ppvNativeType
+
+
+ //*****************************************
+ // property APIs
+ //*****************************************
+ // find a property by name
+ __checkReturn
+ STDMETHOD(FindProperty)(
+ mdTypeDef td, // [IN] given a typdef
+ LPCSTR szPropName, // [IN] property name
+ mdProperty *pProp) PURE; // [OUT] return property token
+
+ // returned void in v1.0/v1.1
+ __checkReturn
+ STDMETHOD(GetPropertyProps)(
+ mdProperty prop, // [IN] property token
+ LPCSTR *szProperty, // [OUT] property name
+ DWORD *pdwPropFlags, // [OUT] property flags.
+ PCCOR_SIGNATURE *ppvSig, // [OUT] property type. pointing to meta data internal blob
+ ULONG *pcbSig) PURE; // [OUT] count of bytes in *ppvSig
+
+ //**********************************
+ // Event APIs
+ //**********************************
+ __checkReturn
+ STDMETHOD(FindEvent)(
+ mdTypeDef td, // [IN] given a typdef
+ LPCSTR szEventName, // [IN] event name
+ mdEvent *pEvent) PURE; // [OUT] return event token
+
+ // returned void in v1.0/v1.1
+ __checkReturn
+ STDMETHOD(GetEventProps)(
+ mdEvent ev, // [IN] event token
+ LPCSTR *pszEvent, // [OUT] Event name
+ DWORD *pdwEventFlags, // [OUT] Event flags.
+ mdToken *ptkEventType) PURE; // [OUT] EventType class
+
+
+ //**********************************
+ // find a particular associate of a property or an event
+ //**********************************
+ __checkReturn
+ STDMETHOD(FindAssociate)(
+ mdToken evprop, // [IN] given a property or event token
+ DWORD associate, // [IN] given a associate semantics(setter, getter, testdefault, reset, AddOn, RemoveOn, Fire)
+ mdMethodDef *pmd) PURE; // [OUT] return method def token
+
+ // Note, void function in v1.0/v1.1
+ __checkReturn
+ STDMETHOD(EnumAssociateInit)(
+ mdToken evprop, // [IN] given a property or an event token
+ HENUMInternal *phEnum) PURE; // [OUT] cursor to hold the query result
+
+ // returned void in v1.0/v1.1
+ __checkReturn
+ STDMETHOD(GetAllAssociates)(
+ HENUMInternal *phEnum, // [IN] query result form GetPropertyAssociateCounts
+ ASSOCIATE_RECORD *pAssociateRec, // [OUT] struct to fill for output
+ ULONG cAssociateRec) PURE; // [IN] size of the buffer
+
+
+ //**********************************
+ // Get info about a PermissionSet.
+ //**********************************
+ // returned void in v1.0/v1.1
+ __checkReturn
+ STDMETHOD(GetPermissionSetProps)(
+ mdPermission pm, // [IN] the permission token.
+ DWORD *pdwAction, // [OUT] CorDeclSecurity.
+ void const **ppvPermission, // [OUT] permission blob.
+ ULONG *pcbPermission) PURE; // [OUT] count of bytes of pvPermission.
+
+ //****************************************
+ // Get the String given the String token.
+ // Returns a pointer to the string, or NULL in case of error.
+ //****************************************
+ __checkReturn
+ STDMETHOD(GetUserString)(
+ mdString stk, // [IN] the string token.
+ ULONG *pchString, // [OUT] count of characters in the string.
+ BOOL *pbIs80Plus, // [OUT] specifies where there are extended characters >= 0x80.
+ LPCWSTR *pwszUserString) PURE;
+
+ //*****************************************************************************
+ // p-invoke APIs.
+ //*****************************************************************************
+ __checkReturn
+ STDMETHOD(GetPinvokeMap)(
+ mdToken tk, // [IN] FieldDef, MethodDef.
+ DWORD *pdwMappingFlags, // [OUT] Flags used for mapping.
+ LPCSTR *pszImportName, // [OUT] Import name.
+ mdModuleRef *pmrImportDLL) PURE; // [OUT] ModuleRef token for the target DLL.
+
+ //*****************************************************************************
+ // helpers to convert a text signature to a com format
+ //*****************************************************************************
+ __checkReturn
+ STDMETHOD(ConvertTextSigToComSig)( // Return hresult.
+ BOOL fCreateTrIfNotFound, // [IN] create typeref if not found
+ LPCSTR pSignature, // [IN] class file format signature
+ CQuickBytes *pqbNewSig, // [OUT] place holder for CLR signature
+ ULONG *pcbCount) PURE; // [OUT] the result size of signature
+
+ //*****************************************************************************
+ // Assembly MetaData APIs.
+ //*****************************************************************************
+ // returned void in v1.0/v1.1
+ __checkReturn
+ STDMETHOD(GetAssemblyProps)(
+ mdAssembly mda, // [IN] The Assembly for which to get the properties.
+ const void **ppbPublicKey, // [OUT] Pointer to the public key.
+ ULONG *pcbPublicKey, // [OUT] Count of bytes in the public key.
+ ULONG *pulHashAlgId, // [OUT] Hash Algorithm.
+ LPCSTR *pszName, // [OUT] Buffer to fill with name.
+ AssemblyMetaDataInternal *pMetaData,// [OUT] Assembly MetaData.
+ DWORD *pdwAssemblyFlags) PURE;// [OUT] Flags.
+
+ // returned void in v1.0/v1.1
+ __checkReturn
+ STDMETHOD(GetAssemblyRefProps)(
+ mdAssemblyRef mdar, // [IN] The AssemblyRef for which to get the properties.
+ const void **ppbPublicKeyOrToken, // [OUT] Pointer to the public key or token.
+ ULONG *pcbPublicKeyOrToken, // [OUT] Count of bytes in the public key or token.
+ LPCSTR *pszName, // [OUT] Buffer to fill with name.
+ AssemblyMetaDataInternal *pMetaData,// [OUT] Assembly MetaData.
+ const void **ppbHashValue, // [OUT] Hash blob.
+ ULONG *pcbHashValue, // [OUT] Count of bytes in the hash blob.
+ DWORD *pdwAssemblyRefFlags) PURE; // [OUT] Flags.
+
+ // returned void in v1.0/v1.1
+ __checkReturn
+ STDMETHOD(GetFileProps)(
+ mdFile mdf, // [IN] The File for which to get the properties.
+ LPCSTR *pszName, // [OUT] Buffer to fill with name.
+ const void **ppbHashValue, // [OUT] Pointer to the Hash Value Blob.
+ ULONG *pcbHashValue, // [OUT] Count of bytes in the Hash Value Blob.
+ DWORD *pdwFileFlags) PURE; // [OUT] Flags.
+
+ // returned void in v1.0/v1.1
+ __checkReturn
+ STDMETHOD(GetExportedTypeProps)(
+ mdExportedType mdct, // [IN] The ExportedType for which to get the properties.
+ LPCSTR *pszNamespace, // [OUT] Namespace.
+ LPCSTR *pszName, // [OUT] Name.
+ mdToken *ptkImplementation, // [OUT] mdFile or mdAssemblyRef that provides the ExportedType.
+ mdTypeDef *ptkTypeDef, // [OUT] TypeDef token within the file.
+ DWORD *pdwExportedTypeFlags) PURE; // [OUT] Flags.
+
+ // returned void in v1.0/v1.1
+ __checkReturn
+ STDMETHOD(GetManifestResourceProps)(
+ mdManifestResource mdmr, // [IN] The ManifestResource for which to get the properties.
+ LPCSTR *pszName, // [OUT] Buffer to fill with name.
+ mdToken *ptkImplementation, // [OUT] mdFile or mdAssemblyRef that provides the ExportedType.
+ DWORD *pdwOffset, // [OUT] Offset to the beginning of the resource within the file.
+ DWORD *pdwResourceFlags) PURE;// [OUT] Flags.
+
+ __checkReturn
+ STDMETHOD(FindExportedTypeByName)( // S_OK or error
+ LPCSTR szNamespace, // [IN] Namespace of the ExportedType.
+ LPCSTR szName, // [IN] Name of the ExportedType.
+ mdExportedType tkEnclosingType, // [IN] ExportedType for the enclosing class.
+ mdExportedType *pmct) PURE; // [OUT] Put ExportedType token here.
+
+ __checkReturn
+ STDMETHOD(FindManifestResourceByName)( // S_OK or error
+ LPCSTR szName, // [IN] Name of the ManifestResource.
+ mdManifestResource *pmmr) PURE; // [OUT] Put ManifestResource token here.
+
+ __checkReturn
+ STDMETHOD(GetAssemblyFromScope)( // S_OK or error
+ mdAssembly *ptkAssembly) PURE; // [OUT] Put token here.
+
+ __checkReturn
+ STDMETHOD(GetCustomAttributeByName)( // S_OK or error
+ mdToken tkObj, // [IN] Object with Custom Attribute.
+ LPCUTF8 szName, // [IN] Name of desired Custom Attribute.
+ const void **ppData, // [OUT] Put pointer to data here.
+ ULONG *pcbData) PURE; // [OUT] Put size of data here.
+
+ // Note: The return type of this method was void in v1
+ __checkReturn
+ STDMETHOD(GetTypeSpecFromToken)( // S_OK or error.
+ mdTypeSpec typespec, // [IN] Signature token.
+ PCCOR_SIGNATURE *ppvSig, // [OUT] return pointer to token.
+ ULONG *pcbSig) PURE; // [OUT] return size of signature.
+
+ __checkReturn
+ STDMETHOD(SetUserContextData)( // S_OK or E_NOTIMPL
+ IUnknown *pIUnk) PURE; // The user context.
+
+ __checkReturn
+ STDMETHOD_(BOOL, IsValidToken)( // True or False.
+ mdToken tk) PURE; // [IN] Given token.
+
+ __checkReturn
+ STDMETHOD(TranslateSigWithScope)(
+ IMDInternalImport *pAssemImport, // [IN] import assembly scope.
+ const void *pbHashValue, // [IN] hash value for the import assembly.
+ ULONG cbHashValue, // [IN] count of bytes in the hash value.
+ PCCOR_SIGNATURE pbSigBlob, // [IN] signature in the importing scope
+ ULONG cbSigBlob, // [IN] count of bytes of signature
+ IMetaDataAssemblyEmit *pAssemEmit, // [IN] assembly emit scope.
+ IMetaDataEmit *emit, // [IN] emit interface
+ CQuickBytes *pqkSigEmit, // [OUT] buffer to hold translated signature
+ ULONG *pcbSig) PURE; // [OUT] count of bytes in the translated signature
+
+ STDMETHOD_(IMetaModelCommon*, GetMetaModelCommon)( // Return MetaModelCommon interface.
+ ) PURE;
+
+ STDMETHOD_(IUnknown *, GetCachedPublicInterface)(BOOL fWithLock) PURE; // return the cached public interface
+ __checkReturn
+ STDMETHOD(SetCachedPublicInterface)(IUnknown *pUnk) PURE; // no return value
+ STDMETHOD_(UTSemReadWrite*, GetReaderWriterLock)() PURE; // return the reader writer lock
+ __checkReturn
+ STDMETHOD(SetReaderWriterLock)(UTSemReadWrite * pSem) PURE;
+
+ STDMETHOD_(mdModule, GetModuleFromScope)() PURE; // [OUT] Put mdModule token here.
+
+
+ //-----------------------------------------------------------------
+ // Additional custom methods
+
+ // finding a particular method
+ __checkReturn
+ STDMETHOD(FindMethodDefUsingCompare)(
+ mdTypeDef classdef, // [IN] given typedef
+ LPCSTR szName, // [IN] member name
+ PCCOR_SIGNATURE pvSigBlob, // [IN] point to a blob value of CLR signature
+ ULONG cbSigBlob, // [IN] count of bytes in the signature blob
+ PSIGCOMPARE pSignatureCompare, // [IN] Routine to compare signatures
+ void* pSignatureArgs, // [IN] Additional info to supply the compare function
+ mdMethodDef *pmd) PURE; // [OUT] matching memberdef
+
+ // Additional v2 methods.
+
+ //*****************************************
+ // return a field offset for a given field
+ //*****************************************
+ __checkReturn
+ STDMETHOD(GetFieldOffset)(
+ mdFieldDef fd, // [IN] fielddef
+ ULONG *pulOffset) PURE; // [OUT] FieldOffset
+
+ __checkReturn
+ STDMETHOD(GetMethodSpecProps)(
+ mdMethodSpec ms, // [IN] The method instantiation
+ mdToken *tkParent, // [OUT] MethodDef or MemberRef
+ PCCOR_SIGNATURE *ppvSigBlob, // [OUT] point to the blob value of meta data
+ ULONG *pcbSigBlob) PURE; // [OUT] actual size of signature blob
+
+ __checkReturn
+ STDMETHOD(GetTableInfoWithIndex)(
+ ULONG index, // [IN] pass in the table index
+ void **pTable, // [OUT] pointer to table at index
+ void **pTableSize) PURE; // [OUT] size of table at index
+
+ __checkReturn
+ STDMETHOD(ApplyEditAndContinue)(
+ void *pDeltaMD, // [IN] the delta metadata
+ ULONG cbDeltaMD, // [IN] length of pData
+ IMDInternalImport **ppv) PURE; // [OUT] the resulting metadata interface
+
+ //**********************************
+ // Generics APIs
+ //**********************************
+ __checkReturn
+ STDMETHOD(GetGenericParamProps)( // S_OK or error.
+ mdGenericParam rd, // [IN] The type parameter
+ ULONG* pulSequence, // [OUT] Parameter sequence number
+ DWORD* pdwAttr, // [OUT] Type parameter flags (for future use)
+ mdToken *ptOwner, // [OUT] The owner (TypeDef or MethodDef)
+ DWORD *reserved, // [OUT] The kind (TypeDef/Ref/Spec, for future use)
+ LPCSTR *szName) PURE; // [OUT] The name
+
+ __checkReturn
+ STDMETHOD(GetGenericParamConstraintProps)( // S_OK or error.
+ mdGenericParamConstraint rd, // [IN] The constraint token
+ mdGenericParam *ptGenericParam, // [OUT] GenericParam that is constrained
+ mdToken *ptkConstraintType) PURE; // [OUT] TypeDef/Ref/Spec constraint
+
+ //*****************************************************************************
+ // This function gets the "built for" version of a metadata scope.
+ // NOTE: if the scope has never been saved, it will not have a built-for
+ // version, and an empty string will be returned.
+ //*****************************************************************************
+ __checkReturn
+ STDMETHOD(GetVersionString)( // S_OK or error.
+ LPCSTR *pVer) PURE; // [OUT] Put version string here.
+
+
+ __checkReturn
+ STDMETHOD(SafeAndSlowEnumCustomAttributeByNameInit)(// return S_FALSE if record not found
+ mdToken tkParent, // [IN] token to scope the search
+ LPCSTR szName, // [IN] CustomAttribute's name to scope the search
+ HENUMInternal *phEnum) PURE; // [OUT] The enumerator
+
+ __checkReturn
+ STDMETHOD(SafeAndSlowEnumCustomAttributeByNameNext)(// return S_FALSE if record not found
+ mdToken tkParent, // [IN] token to scope the search
+ LPCSTR szName, // [IN] CustomAttribute's name to scope the search
+ HENUMInternal *phEnum, // [IN] The enumerator
+ mdCustomAttribute *mdAttribute) PURE; // [OUT] The custom attribute that was found
+
+
+ __checkReturn
+ STDMETHOD(GetTypeDefRefTokenInTypeSpec)(// return S_FALSE if enclosing type does not have a token
+ mdTypeSpec tkTypeSpec, // [IN] TypeSpec token to look at
+ mdToken *tkEnclosedToken) PURE; // [OUT] The enclosed type token
+
+#define MD_STREAM_VER_1X 0x10000
+#define MD_STREAM_VER_2_B1 0x10001
+#define MD_STREAM_VER_2 0x20000
+ STDMETHOD_(DWORD, GetMetadataStreamVersion)() PURE; //returns DWORD with major version of
+ // MD stream in senior word and minor version--in junior word
+
+ __checkReturn
+ STDMETHOD(GetNameOfCustomAttribute)(// S_OK or error
+ mdCustomAttribute mdAttribute, // [IN] The Custom Attribute
+ LPCUTF8 *pszNamespace, // [OUT] Namespace of Custom Attribute.
+ LPCUTF8 *pszName) PURE; // [OUT] Name of Custom Attribute.
+
+ STDMETHOD(SetOptimizeAccessForSpeed)(// S_OK or error
+ BOOL fOptSpeed) PURE;
+
+ STDMETHOD(SetVerifiedByTrustedSource)(// S_OK or error
+ BOOL fVerified) PURE;
+
+ STDMETHOD(GetRvaOffsetData)(
+ DWORD *pFirstMethodRvaOffset, // [OUT] Offset (from start of metadata) to the first RVA field in MethodDef table.
+ DWORD *pMethodDefRecordSize, // [OUT] Size of each record in MethodDef table.
+ DWORD *pMethodDefCount, // [OUT] Number of records in MethodDef table.
+ DWORD *pFirstFieldRvaOffset, // [OUT] Offset (from start of metadata) to the first RVA field in FieldRVA table.
+ DWORD *pFieldRvaRecordSize, // [OUT] Size of each record in FieldRVA table.
+ DWORD *pFieldRvaCount // [OUT] Number of records in FieldRVA table.
+ ) PURE;
+
+ //----------------------------------------------------------------------------------------
+ // !!! READ THIS !!!
+ //
+ // New methods have to be added at the end. The order and signatures of the existing methods
+ // have to be preserved. We need to maintain a backward compatibility for this interface to
+ // allow ildasm to work on SingleCLR.
+ //
+ //----------------------------------------------------------------------------------------
+
+}; // IMDInternalImport
+
+
+// {E03D7730-D7E3-11d2-8C0D-00C04FF7431A}
+EXTERN_GUID(IID_IMDInternalImportENC, 0xe03d7730, 0xd7e3, 0x11d2, 0x8c, 0xd, 0x0, 0xc0, 0x4f, 0xf7, 0x43, 0x1a);
+
+#undef INTERFACE
+#define INTERFACE IMDInternalImportENC
+DECLARE_INTERFACE_(IMDInternalImportENC, IMDInternalImport)
+{
+private:
+ using IMDInternalImport::ApplyEditAndContinue;
+public:
+ // ENC only methods here.
+ STDMETHOD(ApplyEditAndContinue)( // S_OK or error.
+ MDInternalRW *pDelta) PURE; // Interface to MD with the ENC delta.
+
+ STDMETHOD(EnumDeltaTokensInit)( // return hresult
+ HENUMInternal *phEnum) PURE; // [OUT] buffer to fill for enumerator data
+
+}; // IMDInternalImportENC
+
+// {F102C526-38CB-49ed-9B5F-498816AE36E0}
+EXTERN_GUID(IID_IMDInternalEmit, 0xf102c526, 0x38cb, 0x49ed, 0x9b, 0x5f, 0x49, 0x88, 0x16, 0xae, 0x36, 0xe0);
+
+#undef INTERFACE
+#define INTERFACE IMDInternalEmit
+DECLARE_INTERFACE_(IMDInternalEmit, IUnknown)
+{
+ STDMETHOD(ChangeMvid)( // S_OK or error.
+ REFGUID newMvid) PURE; // GUID to use as the MVID
+
+ STDMETHOD(SetMDUpdateMode)(
+ ULONG updateMode, ULONG *pPreviousUpdateMode) PURE;
+
+}; // IMDInternalEmit
+
+#ifdef FEATURE_METADATA_CUSTOM_DATA_SOURCE
+
+struct IMDCustomDataSource;
+
+#include "../md/inc/metamodel.h"
+
+// {CC0C8F7A-A00B-493D-80B6-CE0C92491670}
+EXTERN_GUID(IID_IMDCustomDataSource, 0xcc0c8f7a, 0xa00b, 0x493d, 0x80, 0xb6, 0xce, 0xc, 0x92, 0x49, 0x16, 0x70);
+
+#undef INTERFACE
+#define INTERFACE IMDCustomDataSource
+DECLARE_INTERFACE_(IMDCustomDataSource, IUnknown)
+{
+ STDMETHOD(GetSchema)(CMiniMdSchema* pSchema) PURE;
+ STDMETHOD(GetTableDef)(ULONG32 tableIndex, CMiniTableDef* pTableDef) PURE;
+ STDMETHOD(GetBlobHeap)(MetaData::DataBlob* pBlobHeapData) PURE;
+ STDMETHOD(GetGuidHeap)(MetaData::DataBlob* pGuidHeapData) PURE;
+ STDMETHOD(GetStringHeap)(MetaData::DataBlob* pStringHeapData) PURE;
+ STDMETHOD(GetUserStringHeap)(MetaData::DataBlob* pUserStringHeapData) PURE;
+ STDMETHOD(GetTableRecords)(ULONG32 tableIndex, MetaData::DataBlob* pTableRecordData) PURE;
+ STDMETHOD(GetTableSortable)(ULONG32 tableIndex, BOOL* pSortable) PURE;
+ STDMETHOD(GetStorageSignature)(MetaData::DataBlob* pStorageSignature) PURE;
+
+}; // IMDCustomDataSource
+
+// {503F79FB-7AAE-4364-BDA6-8E235D173AEC}
+EXTERN_GUID(IID_IMetaDataDispenserCustom,
+ 0x503f79fb, 0x7aae, 0x4364, 0xbd, 0xa6, 0x8e, 0x23, 0x5d, 0x17, 0x3a, 0xec);
+
+#undef INTERFACE
+#define INTERFACE IMetaDataDispenserCustom
+DECLARE_INTERFACE_(IMetaDataDispenserCustom, IUnknown)
+{
+ STDMETHOD(OpenScopeOnCustomDataSource)( // Return code.
+ IMDCustomDataSource *pCustomSource, // [in] The scope to open.
+ DWORD dwOpenFlags, // [in] Open mode flags.
+ REFIID riid, // [in] The interface desired.
+ IUnknown **ppIUnk) PURE; // [out] Return interface on success.
+
+}; // IMetaDataDispenserCustom
+
+#endif // FEATURE_METADATA_CUSTOM_DATA_SOURCE
+
+#ifdef FEATURE_METADATA_DEBUGGEE_DATA_SOURCE
+struct ICorDebugDataTarget;
+HRESULT CreateRemoteMDInternalRWSource(TADDR mdInternalRWRemoteAddress, ICorDebugDataTarget* pDataTarget, DWORD defines, DWORD dataStructureVersion, IMDCustomDataSource** ppDataSource);
+#endif
+
+#ifdef __HOLDER_H_
+
+void DECLSPEC_NORETURN ThrowHR(HRESULT hr);
+
+// This wrapper class ensures that the HENUMInternal is EnumTypeDefClose'd no matter how the scope is exited.
+class HENUMTypeDefInternalHolder
+{
+public:
+ FORCEINLINE HENUMTypeDefInternalHolder(IMDInternalImport *pInternalImport)
+ {
+ WRAPPER_NO_CONTRACT;
+
+ m_pInternalImport = pInternalImport;
+ m_fAcquired = FALSE;
+ }
+
+ FORCEINLINE VOID EnumTypeDefInit()
+ {
+ CONTRACTL {
+ THROWS;
+ } CONTRACTL_END;
+
+ _ASSERTE(!m_fAcquired);
+ HRESULT hr = m_pInternalImport->EnumTypeDefInit(&m_hEnum);
+ if (FAILED(hr))
+ {
+ ThrowHR(hr);
+ }
+ m_fAcquired = TRUE;
+
+ }
+
+ FORCEINLINE HRESULT EnumTypeDefInitNoThrow()
+ {
+ WRAPPER_NO_CONTRACT;
+
+ _ASSERTE(!m_fAcquired);
+ HRESULT hr = m_pInternalImport->EnumTypeDefInit(&m_hEnum);
+ if (FAILED(hr))
+ {
+ return hr;
+ }
+ m_fAcquired = TRUE;
+
+ return hr;
+ }
+
+ FORCEINLINE ~HENUMTypeDefInternalHolder()
+ {
+ WRAPPER_NO_CONTRACT;
+
+ if (m_fAcquired)
+ {
+ m_pInternalImport->EnumTypeDefClose(&m_hEnum);
+ }
+ }
+
+ FORCEINLINE HENUMInternal* operator& ()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ _ASSERTE(m_fAcquired);
+ return &m_hEnum;
+ }
+
+private:
+ FORCEINLINE HENUMTypeDefInternalHolder(const HENUMTypeDefInternalHolder &)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ _ASSERTE(!"Don't try to assign this class.");
+ }
+
+private:
+ IMDInternalImport *m_pInternalImport;
+ HENUMInternal m_hEnum;
+ BOOL m_fAcquired;
+};
+
+
+// This wrapper class ensures that the HENUMInternal is EnumClose'd no matter how the scope is exited.
+class HENUMInternalHolder
+{
+public:
+ FORCEINLINE HENUMInternalHolder(IMDInternalImport *pInternalImport)
+ {
+ WRAPPER_NO_CONTRACT;
+
+ m_pInternalImport = pInternalImport;
+ m_fAcquired = FALSE;
+ }
+
+ FORCEINLINE BOOL EnumPermissionSetsInit(mdToken tkToken, CorDeclSecurity action)
+ {
+ CONTRACTL {
+ THROWS;
+ } CONTRACTL_END;
+
+ _ASSERTE(!m_fAcquired);
+ HRESULT hr = m_pInternalImport->EnumPermissionSetsInit(tkToken, action, &m_hEnum);
+
+ if (hr == CLDB_E_RECORD_NOTFOUND)
+ return FALSE;
+
+ if (FAILED(hr) )
+ {
+ ThrowHR(hr);
+ }
+
+ m_fAcquired = TRUE;
+
+ return TRUE;
+ }
+
+ FORCEINLINE VOID EnumGlobalFunctionsInit()
+ {
+ CONTRACTL {
+ THROWS;
+ } CONTRACTL_END;
+
+ _ASSERTE(!m_fAcquired);
+ HRESULT hr = m_pInternalImport->EnumGlobalFunctionsInit(&m_hEnum);
+ if (FAILED(hr))
+ {
+ ThrowHR(hr);
+ }
+ m_fAcquired = TRUE;
+
+ }
+
+
+ FORCEINLINE VOID EnumGlobalFieldsInit()
+ {
+ CONTRACTL {
+ THROWS;
+ } CONTRACTL_END;
+
+ _ASSERTE(!m_fAcquired);
+ HRESULT hr = m_pInternalImport->EnumGlobalFieldsInit(&m_hEnum);
+ if (FAILED(hr))
+ {
+ ThrowHR(hr);
+ }
+ m_fAcquired = TRUE;
+
+ }
+
+ FORCEINLINE VOID EnumTypeDefInit()
+ {
+ CONTRACTL {
+ THROWS;
+ } CONTRACTL_END;
+
+ _ASSERTE(!m_fAcquired);
+ HRESULT hr = m_pInternalImport->EnumTypeDefInit(&m_hEnum);
+ if (FAILED(hr))
+ {
+ ThrowHR(hr);
+ }
+ m_fAcquired = TRUE;
+ }
+
+ FORCEINLINE VOID EnumAssociateInit(mdToken tkParent) // [IN] token to scope the search
+ {
+ CONTRACTL {
+ THROWS;
+ } CONTRACTL_END;
+
+ _ASSERTE(!m_fAcquired);
+ IfFailThrow(m_pInternalImport->EnumAssociateInit(tkParent, &m_hEnum));
+ m_fAcquired = TRUE;
+ }
+
+ FORCEINLINE VOID EnumInit(DWORD tkKind, // [IN] which table to work on
+ mdToken tkParent // [IN] token to scope the search
+ )
+ {
+ CONTRACTL {
+ THROWS;
+ } CONTRACTL_END;
+
+ HRESULT hr = EnumInitNoThrow(tkKind, tkParent);
+ if (FAILED(hr))
+ {
+ ThrowHR(hr);
+ }
+ }
+
+ __checkReturn
+ FORCEINLINE HRESULT EnumInitNoThrow(DWORD tkKind, // [IN] which table to work on
+ mdToken tkParent // [IN] token to scope the search
+ )
+ {
+ CONTRACTL {
+ NOTHROW;
+ } CONTRACTL_END;
+
+ _ASSERTE(!m_fAcquired);
+ HRESULT hr = m_pInternalImport->EnumInit(tkKind, tkParent, &m_hEnum);
+ if (SUCCEEDED(hr))
+ {
+ m_fAcquired = TRUE;
+ }
+ return hr;
+ }
+
+ FORCEINLINE VOID EnumAllInit(DWORD tkKind // [IN] which table to work on
+ )
+ {
+ CONTRACTL {
+ THROWS;
+ } CONTRACTL_END;
+
+ _ASSERTE(!m_fAcquired);
+ HRESULT hr = m_pInternalImport->EnumAllInit(tkKind, &m_hEnum);
+ if (FAILED(hr))
+ {
+ ThrowHR(hr);
+ }
+ m_fAcquired = TRUE;
+
+ }
+
+ FORCEINLINE ULONG EnumGetCount()
+ {
+ CONTRACTL {
+ NOTHROW;
+ GC_NOTRIGGER;
+ CONSISTENCY_CHECK(m_fAcquired);
+ } CONTRACTL_END;
+
+ return m_pInternalImport->EnumGetCount(&m_hEnum);
+ }
+
+ FORCEINLINE bool EnumNext(mdToken * pTok)
+ {
+ CONTRACTL {
+ NOTHROW;
+ GC_NOTRIGGER;
+ CONSISTENCY_CHECK(m_fAcquired);
+ } CONTRACTL_END;
+
+ return m_pInternalImport->EnumNext(&m_hEnum, pTok);
+ }
+
+ FORCEINLINE void EnumReset()
+ {
+ CONTRACTL {
+ NOTHROW;
+ GC_NOTRIGGER;
+ CONSISTENCY_CHECK(m_fAcquired);
+ } CONTRACTL_END;
+
+ return m_pInternalImport->EnumReset(&m_hEnum);
+ }
+
+ FORCEINLINE ~HENUMInternalHolder()
+ {
+ WRAPPER_NO_CONTRACT;
+
+ if (m_fAcquired)
+ {
+ // Ignore the error
+ (void)m_pInternalImport->EnumClose(&m_hEnum);
+ }
+ }
+
+ FORCEINLINE HENUMInternal* operator& ()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ _ASSERTE(m_fAcquired);
+ return &m_hEnum;
+ }
+
+private:
+ FORCEINLINE HENUMInternalHolder(const HENUMInternalHolder &)
+ {
+ WRAPPER_NO_CONTRACT;
+
+ _ASSERTE(!"Don't try to assign this class.");
+ }
+
+
+protected:
+ IMDInternalImport *m_pInternalImport;
+ HENUMInternal m_hEnum;
+ BOOL m_fAcquired;
+};
+
+class HENUMInternalMethodImplHolder : protected HENUMInternalHolder
+{
+ public:
+ FORCEINLINE HENUMInternalMethodImplHolder(IMDInternalImport *pInternalImport)
+ : HENUMInternalHolder(pInternalImport)
+ {
+ WRAPPER_NO_CONTRACT;
+ }
+
+ FORCEINLINE ~HENUMInternalMethodImplHolder()
+ {
+ WRAPPER_NO_CONTRACT;
+
+ if (m_fAcquired)
+ {
+ // Ignore the error
+ (void)m_pInternalImport->EnumClose(&m_hEnum2);
+ }
+ }
+
+ FORCEINLINE void EnumMethodImplInit(mdToken tkParent // [IN] token to scope the search
+ )
+ {
+ CONTRACTL {
+ THROWS;
+ } CONTRACTL_END;
+
+ HRESULT hr = EnumMethodImplInitNoThrow(tkParent);
+ if (FAILED(hr))
+ {
+ ThrowHR(hr);
+ }
+ }
+
+ __checkReturn
+ FORCEINLINE HRESULT EnumMethodImplInitNoThrow(mdToken tkParent // [IN] token to scope the search
+ )
+ {
+ CONTRACTL {
+ NOTHROW;
+ } CONTRACTL_END;
+
+ _ASSERTE(!m_fAcquired);
+ HRESULT hr = m_pInternalImport->EnumMethodImplInit(tkParent, &m_hEnum, &m_hEnum2);
+ if (SUCCEEDED(hr))
+ {
+ m_fAcquired = TRUE;
+ }
+ return hr;
+ }
+
+ __checkReturn
+ FORCEINLINE HRESULT EnumMethodImplNext(
+ mdToken *ptkImpl,
+ mdToken *ptkDecl)
+ {
+ CONTRACTL {
+ NOTHROW;
+ GC_NOTRIGGER;
+ CONSISTENCY_CHECK(m_fAcquired);
+ } CONTRACTL_END;
+
+ return m_pInternalImport->EnumMethodImplNext(&m_hEnum, &m_hEnum2, ptkImpl, ptkDecl);
+ }
+
+ FORCEINLINE ULONG EnumMethodImplGetCount()
+ {
+ CONTRACTL {
+ NOTHROW;
+ GC_NOTRIGGER;
+ CONSISTENCY_CHECK(m_fAcquired);
+ } CONTRACTL_END;
+
+ return m_pInternalImport->EnumMethodImplGetCount(&m_hEnum, &m_hEnum2);
+ }
+
+ protected:
+ HENUMInternal m_hEnum2;
+};
+
+#endif //__HOLDER_H_
+
+#endif // _METADATA_H_
diff --git a/src/inc/metadataexports.h b/src/inc/metadataexports.h
new file mode 100644
index 0000000000..159af69fb3
--- /dev/null
+++ b/src/inc/metadataexports.h
@@ -0,0 +1,57 @@
+// 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.
+//*****************************************************************************
+// MDCommon.h
+//
+
+//
+// Header for functions exported by metadata. These are consumed 2 ways:
+// 1. Mscoree provides public exports that plumb to some of these functions to invoke these dynamically.
+// 2. Standalone metadata (statically linked)
+//
+//*****************************************************************************
+
+
+#ifndef _METADATA_EXPORTS_
+#define _METADATA_EXPORTS_
+
+
+
+// General creation function for ClassFactory semantics.
+STDAPI MetaDataDllGetClassObject(REFCLSID rclsid, REFIID riid, void ** ppv);
+
+// Specific creation function to get IMetaDataDispenser(Ex) interface.
+HRESULT InternalCreateMetaDataDispenser(REFIID riid, void ** pMetaDataDispenserOut);
+
+STDAPI GetMDInternalInterface(
+ LPVOID pData,
+ ULONG cbData,
+ DWORD flags, // [IN] MDInternal_OpenForRead or MDInternal_OpenForENC
+ REFIID riid, // [in] The interface desired.
+ void **ppIUnk); // [out] Return interface on success.
+
+STDAPI GetMDInternalInterfaceFromPublic(
+ IUnknown *pIUnkPublic, // [IN] Given scope.
+ REFIID riid, // [in] The interface desired.
+ void **ppIUnkInternal); // [out] Return interface on success.
+
+STDAPI GetMDPublicInterfaceFromInternal(
+ void *pIUnkPublic, // [IN] Given scope.
+ REFIID riid, // [in] The interface desired.
+ void **ppIUnkInternal); // [out] Return interface on success.
+
+STDAPI MDReOpenMetaDataWithMemory(
+ void *pImport, // [IN] Given scope. public interfaces
+ LPCVOID pData, // [in] Location of scope data.
+ ULONG cbData); // [in] Size of the data pointed to by pData.
+
+STDAPI MDReOpenMetaDataWithMemoryEx(
+ void *pImport, // [IN] Given scope. public interfaces
+ LPCVOID pData, // [in] Location of scope data.
+ ULONG cbData, // [in] Size of the data pointed to by pData.
+ DWORD dwReOpenFlags); // [in] ReOpen flags
+
+
+
+#endif // _METADATA_EXPORTS_
diff --git a/src/inc/metadatatracker.h b/src/inc/metadatatracker.h
new file mode 100644
index 0000000000..93ecaab983
--- /dev/null
+++ b/src/inc/metadatatracker.h
@@ -0,0 +1,367 @@
+// 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.
+
+#ifndef _METADATATRACKER_H_
+#define _METADATATRACKER_H_
+
+#if defined(FEATURE_PREJIT) && (!defined(FEATURE_CORECLR) || defined(FEATURE_WINDOWSPHONE))
+
+#define METADATATRACKER_DATA 1
+#if !defined(DACCESS_COMPILE)
+#define METADATATRACKER_ENABLED 1
+#endif
+
+#endif
+
+#if METADATATRACKER_ENABLED
+
+#define METADATATRACKER_ONLY(s) (s)
+
+#include "winbase.h"
+#include "winwrap.h"
+#include "holder.h"
+#include "contract.h"
+#include <limits.h>
+#include <wchar.h>
+#include <stdio.h>
+#include "stdmacros.h"
+
+#include "metamodelpub.h"
+
+#define NUM_MD_SECTIONS (TBL_COUNT + MDPoolCount)
+
+#define STRING_POOL (TBL_COUNT + MDPoolStrings)
+#define GUID_POOL (TBL_COUNT + MDPoolGuids)
+#define BLOB_POOL (TBL_COUNT + MDPoolBlobs)
+#define USERSTRING_POOL (TBL_COUNT + MDPoolUSBlobs)
+
+class MetaDataTracker
+{
+ LPWSTR m_ModuleName;
+ BYTE *m_MetadataBase;
+ SIZE_T m_MetadataSize;
+ MetaDataTracker *m_next;
+
+ BYTE *m_mdSections[NUM_MD_SECTIONS];
+ SIZE_T m_mdSectionSize[NUM_MD_SECTIONS];
+ SIZE_T m_mdSectionRowSize[NUM_MD_SECTIONS];
+ BOOL m_bActivated;
+
+ static BOOL s_bEnabled;
+
+ static MetaDataTracker *m_MDTrackers;
+
+public:
+ // callback into IBCLogger.cpp. Done this crummy way because we can't include IBCLogger.h here nor link
+ // to IBCLogger.cpp
+ static void (*s_IBCLogMetaDataAccess)(const void *addr);
+ static void (*s_IBCLogMetaDataSearch)(const void *result);
+
+ MetaDataTracker(BYTE *baseAddress, DWORD mdSize, LPCWSTR modName)
+ {
+ CONTRACTL
+ {
+ CONSTRUCTOR_CHECK;
+ THROWS;
+ GC_NOTRIGGER;
+ INJECT_FAULT(ThrowOutOfMemory());
+ SO_INTOLERANT;
+ }
+ CONTRACTL_END;
+
+ m_ModuleName = NULL;
+
+ DWORD len = (DWORD)wcslen(modName);
+ _ASSERTE(len + 1 != 0); // Prevent Overflow
+ m_ModuleName = new wchar_t[len + 1];
+ NewArrayHolder<wchar_t> moduleNameHolder(m_ModuleName);
+ wcscpy_s((wchar_t *)m_ModuleName, len + 1, (wchar_t *)modName);
+
+ m_MetadataBase = baseAddress;
+ m_MetadataSize = mdSize;
+
+ m_next = m_MDTrackers;
+ m_MDTrackers = this;
+
+ memset (m_mdSections, 0, NUM_MD_SECTIONS*sizeof(BYTE*));
+ memset (m_mdSectionSize, 0, NUM_MD_SECTIONS*sizeof(SIZE_T));
+
+ moduleNameHolder.SuppressRelease();
+ }
+
+ ~MetaDataTracker()
+ {
+ CONTRACTL
+ {
+ DESTRUCTOR_CHECK;
+ NOTHROW;
+ GC_NOTRIGGER;
+ FORBID_FAULT;
+ SO_INTOLERANT;
+ }
+ CONTRACTL_END;
+
+ // Surely if we are dying, we are being deactivated as well
+ Deactivate();
+
+ if (m_ModuleName)
+ delete m_ModuleName;
+
+ // Remove this tracker from the global list of trackers
+
+ MetaDataTracker *mdMod = m_MDTrackers;
+
+ _ASSERTE (mdMod && "Trying to delete metadata tracker where none exist");
+
+ // If ours is the first tracker
+ if (mdMod == this)
+ {
+ m_MDTrackers = mdMod->m_next;
+ mdMod->m_next = NULL;
+ }
+ else
+ {
+ // Now traverse thru the list and maintain the prev ptr.
+ MetaDataTracker *mdModPrev = mdMod;
+ mdMod = mdMod->m_next;
+ while(mdMod)
+ {
+ if (mdMod == this)
+ {
+ mdModPrev->m_next = mdMod->m_next;
+ mdMod->m_next = NULL;
+ break;
+ }
+ mdModPrev = mdMod;
+ mdMod = mdMod->m_next;
+ }
+ }
+ }
+
+ static void Enable()
+ { LIMITED_METHOD_CONTRACT;
+ s_bEnabled = TRUE;
+ }
+
+ static void Disable()
+ { LIMITED_METHOD_CONTRACT;
+ s_bEnabled = FALSE;
+ }
+
+ static BOOL Enabled()
+ { LIMITED_METHOD_CONTRACT;
+ return s_bEnabled;
+ }
+
+ static void NoteSection(DWORD secNum, void *address, size_t size, size_t rowSize)
+ {
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_GC_NOTRIGGER;
+ STATIC_CONTRACT_SO_NOT_MAINLINE;
+
+ if (!Enabled())
+ return;
+
+ MetaDataTracker *mdMod = m_MDTrackers;
+ while( mdMod)
+ {
+ if (mdMod->NoteSectionInModule(secNum, address, size, rowSize))
+ return;
+
+ mdMod = mdMod->m_next;
+ }
+ }
+
+ // With logging disabled this quickly returns the address that was passed in
+ // this allows us to inline a smaller amount of code at callsites.
+ __forceinline static void* NoteAccess(void *address)
+ {
+ WRAPPER_NO_CONTRACT;
+
+ if (!Enabled())
+ return address;
+
+ return NoteAccessWorker(address);
+ }
+
+ __declspec(noinline) static void* NoteAccessWorker(void *address)
+ {
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_GC_NOTRIGGER;
+ STATIC_CONTRACT_SO_NOT_MAINLINE;
+
+ if (s_IBCLogMetaDataAccess != NULL)
+ s_IBCLogMetaDataAccess(address);
+
+ return address;
+ }
+
+ // See the comment above CMiniMdRW::GetHotMetadataTokensSearchAware
+ __forceinline static void NoteSearch(void *result)
+ {
+ WRAPPER_NO_CONTRACT;
+
+ if (!Enabled())
+ return;
+
+ NoteSearchWorker(result);
+ }
+
+ __declspec(noinline) static void NoteSearchWorker(void *result)
+ {
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_GC_NOTRIGGER;
+ STATIC_CONTRACT_SO_NOT_MAINLINE;
+
+ if (s_IBCLogMetaDataSearch != NULL && result != NULL)
+ s_IBCLogMetaDataSearch(result);
+ }
+
+ static MetaDataTracker * FindTracker(BYTE *_MDBaseAddress)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ if (!Enabled())
+ return NULL;
+
+ MetaDataTracker *mdMod = m_MDTrackers;
+ while( mdMod)
+ {
+ if (mdMod->m_MetadataBase == _MDBaseAddress)
+ return mdMod;
+
+ mdMod = mdMod->m_next;
+ }
+
+ return NULL;
+ }
+
+ void Activate()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_bActivated = TRUE;
+ }
+
+ void Deactivate()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_bActivated = FALSE;
+ }
+
+ BOOL IsActivated()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ return m_bActivated;
+ }
+
+ static MetaDataTracker *GetOrCreateMetaDataTracker (BYTE *baseAddress, DWORD mdSize, LPCWSTR modName)
+ {
+ CONTRACT(MetaDataTracker *)
+ {
+ THROWS;
+ GC_NOTRIGGER;
+ INJECT_FAULT(ThrowOutOfMemory());
+ POSTCONDITION(CheckPointer(RETVAL, NULL_OK));
+ SO_INTOLERANT;
+ }
+ CONTRACT_END;
+
+ MetaDataTracker *pTracker = NULL;
+
+ if (MetaDataTracker::Enabled())
+ {
+ pTracker = MetaDataTracker::FindTracker(baseAddress);
+ if (!pTracker)
+ {
+ FAULT_NOT_FATAL(); // It's ok - an OOM here is nonfatal
+ pTracker = new MetaDataTracker(baseAddress, mdSize, modName);
+ }
+ pTracker->Activate();
+ }
+
+ RETURN pTracker;
+ }
+
+ // Map a metadata address to a token for the purposes of the IBCLogger
+ static mdToken MapAddrToToken(const void *addr)
+ {
+ WRAPPER_NO_CONTRACT;
+
+ mdToken token = 0;
+ for (MetaDataTracker *mdMod = m_MDTrackers; mdMod; mdMod = mdMod->m_next)
+ {
+ token = mdMod->MapAddrToTokenInModule(addr);
+ if (token != 0)
+ break;
+ }
+ return token;
+ }
+
+
+private:
+
+ // ***************************************************************************
+ // Helper functions
+ // ***************************************************************************
+
+ BOOL NoteSectionInModule(DWORD secNum, void *address, size_t size, size_t rowSize)
+ {
+ WRAPPER_NO_CONTRACT;
+
+ PREFAST_ASSUME(secNum < NUM_MD_SECTIONS);
+
+ if (address < m_MetadataBase || address >= (m_MetadataBase + m_MetadataSize))
+ return FALSE;
+
+ // This address range belongs to us but the tracker is not activated.
+ if (!IsActivated())
+ {
+ // _ASSERTE (!"Metadata Tracker not active but trying to access metadata");
+ return TRUE;
+ }
+
+ m_mdSections[secNum] = (BYTE *)address;
+ m_mdSectionSize[secNum] = size;
+ m_mdSectionRowSize[secNum] = rowSize;
+
+ return TRUE;
+ }
+
+ // Map a metadata address to a fake token for the purposes of the IBCLogger
+ mdToken MapAddrToTokenInModule(const void *addr)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ if (!IsActivated())
+ return 0;
+
+ BYTE *address = (BYTE *)addr;
+
+ if (address < m_MetadataBase || address >= (m_MetadataBase + m_MetadataSize))
+ return 0;
+
+ for (DWORD secNum = 0; secNum < NUM_MD_SECTIONS; secNum++)
+ {
+ if ((address >= m_mdSections[secNum]) && (address < m_mdSections[secNum] + m_mdSectionSize[secNum]))
+ {
+ DWORD rid = (DWORD)((address - m_mdSections[secNum])/m_mdSectionRowSize[secNum]);
+ if (secNum < TBL_COUNT)
+ rid++;
+ return TokenFromRid(rid, (secNum<<24));
+ }
+ }
+ return 0;
+ }
+};
+
+#else // METADATATRACKER_ENABLED
+
+#define METADATATRACKER_ONLY(s)
+
+#endif // METADATATRACKER_ENABLED
+
+#endif // _METADATATRACKER_H_
diff --git a/src/inc/metahost.idl b/src/inc/metahost.idl
new file mode 100644
index 0000000000..ac889e2594
--- /dev/null
+++ b/src/inc/metahost.idl
@@ -0,0 +1,1097 @@
+// 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.
+
+/**************************************************************************************
+ ** Motivation for redesigning the shim APIs: **
+ ** - old APIs assume that there is only one runtime in the process **
+ ** - old APIs are redundant (multiple ways for achieving the same effect) **
+ ** - old APIs are flat and difficult to version (*Ex variants etc.) **
+ ** - old APIs mix together totally different concepts - choosing a runtime vs. **
+ ** activating the runtime vs. performing an operation on the activated runtime **
+ ** - old APIs are poorly named (incosistent use of the Cor* prefix etc.) **
+ ** - all in all there's a lot of legacy behavior in the old APIs that it makes **
+ ** sense to start from scratch **
+ ** **
+ ** Design goals: **
+ ** - clear separation between the no-policy base part and the policy-decision- **
+ ** making part **
+ ** - easy to extend with additional functionality by introducing new versions of **
+ ** the interfaces (interface types are not hardcoded in method signatures) **
+ ** - functions performing clearly defined steps rather than poorly documented **
+ ** heavy-weight black boxes **
+ **************************************************************************************/
+
+/**************************************************************************************
+ ** Interfaces described in this IDL file follow the "Nano-COM" model. Basically **
+ ** lifetime management (AddRef/Release) and encapsulation (implicit context) are **
+ ** used from COM. There are no COM types (BSTR, SAFEARRAY, VARIANT), apartment **
+ ** models, aggregation, or registry activation (CoCreateInstance). **
+ **************************************************************************************/
+
+
+import "unknwn.idl";
+import "oaidl.idl";
+import "ocidl.idl";
+
+import "mscoree.idl";
+
+cpp_quote("#include <winapifamily.h>")
+cpp_quote("#if WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)")
+
+/**************************************************************************************
+ ** This should be the only flat public API exposed from mscoree going forward. **
+ ** The returned interface is likely to be implemented in a separate versioned DLL **
+ ** (mscorhst.dll living in the versioned directory for instance). Acceptable values **
+ ** for riid in v4.0 are IID_ICLRMetaHost, IID_ICLRMetaHostPolicy and **
+ ** IID_ICLRDebugging. **
+ **************************************************************************************/
+cpp_quote("STDAPI CLRCreateInstance(REFCLSID clsid, REFIID riid, /*iid_is(riid)*/ LPVOID *ppInterface);")
+
+// CLSID CLRStrongName : uuid(B79B0ACD-F5CD-409b-B5A5-A16244610B92)
+cpp_quote("EXTERN_GUID(CLSID_CLRStrongName, 0xB79B0ACD, 0xF5CD, 0x409b, 0xB5, 0xA5, 0xA1, 0x62, 0x44, 0x61, 0x0B, 0x92);")
+
+// IID ICLRMetaHost : uuid(D332DB9E-B9B3-4125-8207-A14884F53216)
+cpp_quote("EXTERN_GUID(IID_ICLRMetaHost, 0xD332DB9E, 0xB9B3, 0x4125, 0x82, 0x07, 0xA1, 0x48, 0x84, 0xF5, 0x32, 0x16);")
+
+// CLSID_CLRMetaHost : uuid(9280188D-0E8E-4867-B30C-7FA83884E8DE)
+cpp_quote("EXTERN_GUID(CLSID_CLRMetaHost, 0x9280188d, 0xe8e, 0x4867, 0xb3, 0xc, 0x7f, 0xa8, 0x38, 0x84, 0xe8, 0xde);")
+
+// IID ICLRMetaHostPolicy : uuid(E2190695-77B2-492e-8E14-C4B3A7FDD593)
+cpp_quote("EXTERN_GUID(IID_ICLRMetaHostPolicy, 0xE2190695, 0x77B2, 0x492e, 0x8E, 0x14, 0xC4, 0xB3, 0xA7, 0xFD, 0xD5, 0x93);")
+
+// CLSID_CLRMetaHostPolicy : uuid(2EBCD49A-1B47-4a61-B13A-4A03701E594B)
+cpp_quote("EXTERN_GUID(CLSID_CLRMetaHostPolicy, 0x2ebcd49a, 0x1b47, 0x4a61, 0xb1, 0x3a, 0x4a, 0x3, 0x70, 0x1e, 0x59, 0x4b);")
+
+// IID ICLRDebugging : uuid(D28F3C5A-9634-4206-A509-477552EEFB10)
+cpp_quote("EXTERN_GUID(IID_ICLRDebugging, 0xd28f3c5a, 0x9634, 0x4206, 0xa5, 0x9, 0x47, 0x75, 0x52, 0xee, 0xfb, 0x10);")
+
+// CLSID_CLRDebugging : uuid(BACC578D-FBDD-48a4-969F-02D932B74634)
+cpp_quote("EXTERN_GUID(CLSID_CLRDebugging, 0xbacc578d, 0xfbdd, 0x48a4, 0x96, 0x9f, 0x2, 0xd9, 0x32, 0xb7, 0x46, 0x34);")
+
+// IID ICLRRuntimeInfo : uuid(BD39D1D2-BA2F-486a-89B0-B4B0CB466891)
+cpp_quote("EXTERN_GUID(IID_ICLRRuntimeInfo, 0xBD39D1D2, 0xBA2F, 0x486a, 0x89, 0xB0, 0xB4, 0xB0, 0xCB, 0x46, 0x68, 0x91);")
+
+// IID ICLRStrongName : uuid(9FD93CCF-3280-4391-B3A9-96E1CDE77C8D)
+cpp_quote("EXTERN_GUID(IID_ICLRStrongName, 0x9FD93CCF, 0x3280, 0x4391, 0xB3, 0xA9, 0x96, 0xE1, 0xCD, 0xE7, 0x7C, 0x8D);")
+
+// IID ICLRStrongName2 : uuid(C22ED5C5-4B59-4975-90EB-85EA55C0069B)
+cpp_quote("EXTERN_GUID(IID_ICLRStrongName2, 0xC22ED5C5, 0x4B59, 0x4975, 0x90, 0xEB, 0x85, 0xEA, 0x55, 0xC0, 0x06, 0x9B);")
+
+// IID ICLRStrongName3 : uuid(22c7089b-bbd3-414a-b698-210f263f1fed)
+cpp_quote("EXTERN_GUID(IID_ICLRStrongName3, 0x22c7089b, 0xbbd3, 0x414a, 0xb6, 0x98, 0x21, 0x0f, 0x26, 0x3f, 0x1f, 0xed);")
+
+// CLSID for legacy debugging interface : uuid(DF8395B5-A4BA-450b-A77C-A9A47762C520}
+cpp_quote("EXTERN_GUID(CLSID_CLRDebuggingLegacy, 0xDF8395B5, 0xA4BA, 0x450b, 0xA7, 0x7C, 0xA9, 0xA4, 0x77, 0x62, 0xC5, 0x20);")
+
+// CLSID CLRProfiling interface : uuid{BD097ED8-733E-43fe-8ED7-A95FF9A8448C}
+cpp_quote("EXTERN_GUID(CLSID_CLRProfiling, 0xbd097ed8, 0x733e, 0x43fe, 0x8e, 0xd7, 0xa9, 0x5f, 0xf9, 0xa8, 0x44, 0x8c);")
+
+// IID ICLRProfiling interface : uuid{B349ABE3-B56F-4689-BFCD-76BF39D888EA}
+cpp_quote("EXTERN_GUID(IID_ICLRProfiling, 0xb349abe3, 0xb56f, 0x4689, 0xbf, 0xcd, 0x76, 0xbf, 0x39, 0xd8, 0x88, 0xea);")
+
+// IID ICLRDebuggingLibraryProvider interface : uuid{3151C08D-4D09-4f9b-8838-2880BF18FE51}
+cpp_quote("EXTERN_GUID(IID_ICLRDebuggingLibraryProvider, 0x3151c08d, 0x4d09, 0x4f9b, 0x88, 0x38, 0x28, 0x80, 0xbf, 0x18, 0xfe, 0x51);")
+
+typedef HRESULT(__stdcall * CLRCreateInstanceFnPtr)(
+ REFCLSID clsid,
+ REFIID riid,
+ LPVOID *ppInterface);
+
+typedef HRESULT(__stdcall * CreateInterfaceFnPtr)(
+ REFCLSID clsid,
+ REFIID riid,
+ LPVOID *ppInterface);
+
+// For use in ICLRMetaHost::RequestRuntimeLoadedNotification
+interface ICLRRuntimeInfo;
+
+typedef HRESULT (__stdcall *CallbackThreadSetFnPtr)();
+typedef HRESULT (__stdcall *CallbackThreadUnsetFnPtr)();
+
+typedef void (__stdcall *RuntimeLoadedCallbackFnPtr)(
+ ICLRRuntimeInfo *pRuntimeInfo,
+ CallbackThreadSetFnPtr pfnCallbackThreadSet,
+ CallbackThreadUnsetFnPtr pfnCallbackThreadUnset);
+
+/**************************************************************************************
+ ** ICLRMetaHost **
+ ** Activated using mscoree!CLRCreateInstance. Does not do any policy decisions, get **
+ ** ICLRMetaHostPolicy if you need that. **
+ **************************************************************************************/
+[
+ uuid(D332DB9E-B9B3-4125-8207-A14884F53216),
+ version(1.0),
+ helpstring("CLR meta hosting interface"),
+ local
+]
+interface ICLRMetaHost : IUnknown
+{
+ /**********************************************************************************
+ ** Returns installed runtime with the specific version. Fails if not found. **
+ ** NULL or any other wildcard is not accepted as pwzVersion **
+ ** Supersedes: CorBindToRuntimeEx with STARTUP_LOADER_SAFEMODE **
+ **********************************************************************************/
+ HRESULT GetRuntime(
+ [in] LPCWSTR pwzVersion,
+ [in] REFIID riid, // IID_ICLRRuntimeInfo
+ [out, iid_is(riid), retval] LPVOID *ppRuntime);
+
+ /**********************************************************************************
+ ** Returns runtime version burned into a file's metadata. **
+ ** Supersedes: GetFileVersion **
+ **********************************************************************************/
+ HRESULT GetVersionFromFile(
+ [in] LPCWSTR pwzFilePath,
+ [out, size_is(*pcchBuffer), annotation("_Out_writes_all_(*pcchBuffer)")]
+ LPWSTR pwzBuffer,
+ [in, out] DWORD *pcchBuffer);
+
+ /**********************************************************************************
+ ** Returns an enumerator of runtimes installed on the machine. **
+ ** Supersedes: (none) **
+ **********************************************************************************/
+ HRESULT EnumerateInstalledRuntimes(
+ [out, retval] IEnumUnknown **ppEnumerator);
+
+ /**********************************************************************************
+ ** Provides an enumerator of runtimes loaded into the given process. **
+ ** Supersedes: GetVersionFromProcess **
+ **********************************************************************************/
+ HRESULT EnumerateLoadedRuntimes(
+ [in] HANDLE hndProcess,
+ [out, retval] IEnumUnknown **ppEnumerator);
+
+ /**********************************************************************************
+ ** Provides a callback when a new runtime version has just been loaded, but not **
+ ** started. **
+ ** **
+ ** The callback works in the following way: **
+ ** - the callback is invoked only when a runtime is loaded for the first time **
+ ** - the callback will not be invoked for reentrant loads of the same runtime **
+ ** - the callback will be for reentrant loads of other runtimes **
+ ** - it is guaranteed that no other thread may load the runtime until the **
+ ** callback returns; any thread that does so blocks until this time. **
+ ** - for non-reentrant multi-threaded runtime loads, callbacks are serialized **
+ ** - if the host intends to load (or cause to be loaded) another runtime in a **
+ ** reentrant fashion, or intends to perform any operations on the runtime **
+ ** corresponding to the callback instance, the pfnCallbackThreadSet and **
+ ** pfnCallbackThreadUnset arguments provided in the callback must be used **
+ ** in the following way: **
+ ** - pfnCallbackThreadSet must be called by the thread that might cause a **
+ ** runtime load before such a load is attempted **
+ ** - pfnCallbackThreadUnset must be called when the thread will no longer **
+ ** cause such a runtime load (and before returning from the initial **
+ ** callback) **
+ ** - pfnCallbackThreadSet and pfnCallbackThreadUnset are non-reentrant. **
+ ** **
+ ** pCallbackFunction: This function is invoked when a new runtime has just **
+ ** been loaded. A value of NULL results in a failure **
+ ** return value of E_POINTER. **
+ ** **
+ ** Supersedes: LockClrVersion **
+ **********************************************************************************/
+ HRESULT RequestRuntimeLoadedNotification(
+ [in] RuntimeLoadedCallbackFnPtr pCallbackFunction);
+
+ /**********************************************************************************
+ ** Returns interface representing the runtime to which the legacy activation **
+ ** policy has been bound (for example, by a useLegacyV2RuntimeActivationPolicy **
+ ** config entry or by a call to ICLRRuntimeInfo::BindAsLegacyV2Runtime). **
+ **********************************************************************************/
+ HRESULT QueryLegacyV2RuntimeBinding(
+ [in] REFIID riid,
+ [out, iid_is(riid), retval] LPVOID *ppUnk);
+
+ /**********************************************************************************
+ ** Shuts down the current process. **
+ ** Supersedes: CorExitProcess **
+ **********************************************************************************/
+ HRESULT ExitProcess(
+ [in] INT32 iExitCode);
+} // interface ICLRMetaHost
+
+typedef enum
+{
+ /**********************************************************************************
+ ** Functions will not take into account runtimes already loaded into the **
+ ** process (thus guaranteed to give the same answer regardless of load order). **
+ **********************************************************************************/
+ METAHOST_POLICY_HIGHCOMPAT = 0x00000000,
+
+ /**********************************************************************************
+ ** 0x00000000 - 0x00000004 reserved for future policies. **
+ **********************************************************************************/
+
+ /**********************************************************************************
+ ** Applies upgrade policy when an exact match is not found. **
+ **********************************************************************************/
+ METAHOST_POLICY_APPLY_UPGRADE_POLICY = 0x00000008,
+
+ /**********************************************************************************
+ ** Binds as if the provided information were being use in a new process. This **
+ ** allows a host to determine what runtime an EXE will bind to when launched. **
+ **********************************************************************************/
+ METAHOST_POLICY_EMULATE_EXE_LAUNCH = 0x00000010,
+
+ /**********************************************************************************
+ ** Produces an error dialog if GetRequestedRuntime is unable to find a runtime **
+ ** compatible with the input parameters. This error dialog can take the form **
+ ** of a dialog box that takes a user to an fwlink, or as a Windows feature **
+ ** dialog asking if the user would like to enable the appropriate feature (when **
+ ** available, this dialog is preferred over the fwlink dialog). **
+ **********************************************************************************/
+ METAHOST_POLICY_SHOW_ERROR_DIALOG = 0x00000020,
+
+ /**********************************************************************************
+ ** By default, GetRequestedRuntime will not fall back to the process image path **
+ ** (typically the EXE that was used to launch the process) when determining the **
+ ** runtime to bind to. Specify this flag to have GetRequestedRuntime implicitly **
+ ** use the process image (and any corresponding configuration file) as **
+ ** additional input to the binding process. **
+ **********************************************************************************/
+ METAHOST_POLICY_USE_PROCESS_IMAGE_PATH = 0x00000040,
+
+ /**********************************************************************************
+ ** By default, we will not check whether the appropriate SKU is installed **
+ ** unless SKU is specified in the config file entry. **
+ ** Setting this flag forces the check when no information is available in the **
+ ** config file, allowing applications without config files to fail gracefully **
+ ** on smaller SKUs than the default install of .NET **
+ **********************************************************************************/
+ METAHOST_POLICY_ENSURE_SKU_SUPPORTED = 0x00000080,
+
+ /**********************************************************************************
+ ** By default, we ignore METAHOST_POLICY_SHOW_ERROR_DIALOG if **
+ ** SEM_FAILCRITICALERRORS is set **
+ ** This flag tell us that a silent failure would be so undesirable that **
+ ** the METAHOST_POLICY_SHOW_ERROR_DIALOG should be honored, even if for some **
+ ** reason (e.g. inheritance from another process) SEM_FAILCRITICALERRORS is set **
+ **********************************************************************************/
+ METAHOST_POLICY_IGNORE_ERROR_MODE = 0x00001000,
+
+}
+METAHOST_POLICY_FLAGS;
+
+/**************************************************************************************
+ ** This enum describes the possible flags returned in GetRequestedRuntinme's **
+ ** pdwConfigFlags out parameter.
+ **************************************************************************************/
+typedef enum
+{
+ /**********************************************************************************
+ ** If a config file is used during GetRequestedRuntime's binding process, these **
+ ** values indicate whether or not the startup tag has the **
+ ** useLegacyV2RuntimeActivationPolicy attribute set, and if so to what value. **
+ **********************************************************************************/
+
+ // Indicates presence and value of useLegacyV2RuntimeActivationPolicy <startup> attr
+ METAHOST_CONFIG_FLAGS_LEGACY_V2_ACTIVATION_POLICY_UNSET = 0x00000000,
+ METAHOST_CONFIG_FLAGS_LEGACY_V2_ACTIVATION_POLICY_TRUE = 0x00000001,
+ METAHOST_CONFIG_FLAGS_LEGACY_V2_ACTIVATION_POLICY_FALSE = 0x00000002,
+ METAHOST_CONFIG_FLAGS_LEGACY_V2_ACTIVATION_POLICY_MASK = 0x00000003,
+}
+METAHOST_CONFIG_FLAGS;
+
+/**************************************************************************************
+ ** ICLRMetaHostPolicy **
+ ** Activated using mscoree!CLRCreateInstance. Implements a policy for determining **
+ ** a runtime based on various inputs (metadata, config stream, ...). **
+ **************************************************************************************/
+[
+ uuid(E2190695-77B2-492e-8E14-C4B3A7FDD593),
+ version(1.0),
+ helpstring("CLR meta hosting policy"),
+ local
+]
+interface ICLRMetaHostPolicy : IUnknown
+{
+ /**********************************************************************************
+ ** Returns requested runtime version and runtime (not necessarily of that **
+ ** version) based on a managed binary, version, and config file. **
+ ** The return value is S_OK if a compatible runtime was found and S_FALSE if **
+ ** not. *ppRuntime will be NULL in the latter case. **
+ ** Supersedes: GetRequestedRuntimeInfo, GetRequestedRuntimeVersion, **
+ ** CorBindToRuntimeHost, CorBindToRuntimeByCfg, **
+ ** GetCORRequiredVersion **
+ **********************************************************************************/
+ HRESULT GetRequestedRuntime(
+ [in] METAHOST_POLICY_FLAGS dwPolicyFlags,
+ [in] LPCWSTR pwzBinary, // optional
+ [in] IStream *pCfgStream, // optional
+ [in, out, size_is(*pcchVersion), annotation("_Inout_updates_all_opt_(*pcchVersion)")]
+ LPWSTR pwzVersion, // optional
+ [in, out] DWORD *pcchVersion,
+ [out, size_is(*pcchImageVersion), annotation("_Out_writes_all_opt_(*pcchImageVersion)")]
+ LPWSTR pwzImageVersion, // image version to be used by compilers
+ [in, out] DWORD *pcchImageVersion,
+ [out] DWORD *pdwConfigFlags,
+ [in] REFIID riid, // IID_ICLRRuntimeInfo
+ [out, iid_is(riid), retval] LPVOID *ppRuntime);
+} // interface ICLRMetaHostPolicy
+
+/***************************************************************************************
+ ** ICLRProfiling **
+ ** Activated using mscoree!CLRCreateInstance. Export AttachProfiler API to profilers **
+ ***************************************************************************************/
+[
+ uuid(B349ABE3-B56F-4689-BFCD-76BF39D888EA),
+ version(1.0),
+ helpstring("CLR profiling interface for MetaHost interface"),
+ local
+]
+interface ICLRProfiling : IUnknown
+{
+ HRESULT AttachProfiler(
+ [in] DWORD dwProfileeProcessID,
+ [in] DWORD dwMillisecondsMax, // optional
+ [in] const CLSID * pClsidProfiler,
+ [in] LPCWSTR wszProfilerPath, // optional
+ [in, size_is(cbClientData)] void * pvClientData, // optional
+ [in] UINT cbClientData); // optional
+}
+
+/*************************************************************************************
+ ** This structure defines the version of a CLR for debugging purposes. **
+ ** The wStructVersion field allows for future revisions to this structure to be **
+ ** made. Currently it must be set to 0. The remaining fields represent the **
+ ** typical major.minor.build.revision product version information. **
+ *************************************************************************************/
+typedef struct _CLR_DEBUGGING_VERSION
+{
+ WORD wStructVersion;
+ WORD wMajor;
+ WORD wMinor;
+ WORD wBuild;
+ WORD wRevision;
+}
+CLR_DEBUGGING_VERSION;
+
+typedef enum
+{
+ /**********************************************************************************
+ ** This runtime has a non-catchup managed debug event to send **
+ ** Catchup events include process, app domain, assembly, module, and thread **
+ ** creation notifications that bring the debugger up to the current state after **
+ ** attaching. Non-catchup events are everything else. **
+ **********************************************************************************/
+ CLR_DEBUGGING_MANAGED_EVENT_PENDING = 1,
+
+ /**********************************************************************************
+ ** The managed event that is pending is a Debugger.Launch request **
+ **********************************************************************************/
+ CLR_DEBUGGING_MANAGED_EVENT_DEBUGGER_LAUNCH = 2,
+}
+CLR_DEBUGGING_PROCESS_FLAGS;
+
+ /**************************************************************************************
+ ** ICLRDebuggingLibraryProvider **
+ ** Implemented by API user **
+ ** This interface allows the debugger to provide modules which are needed for **
+ ** debugging a particular CLR such as mscordbi and mscordacwks. The module handles **
+ ** need to remain valid until a call to ICLRDebugging::CanUnloadNow indicates they **
+ ** may be freed, at which point it is the caller's responsibility to free the **
+ ** handles. **
+ **************************************************************************************/
+[
+ uuid(3151C08D-4D09-4f9b-8838-2880BF18FE51),
+ version(1.0),
+ helpstring("CLR debugging LibraryProvider callback interface"),
+ local
+]
+interface ICLRDebuggingLibraryProvider : IUnknown
+{
+ /**********************************************************************************
+ ** The goal of this method is to allow the debugger to provide a handle to a **
+ ** module which is needed for debugging. The debugger may use any available means**
+ ** to locate and/or procure the module. See the security note below for important**
+ ** information about implementing this method securely. **
+ ** Arguments: **
+ ** pwzFileName - The name of the module being requested **
+ ** dwTimeStamp - The date time stamp stored in the COFF file header of PE files **
+ ** dwSizeOfImage - The SizeOfImage field stored in the COFF optional file header **
+ ** of PE files **
+ ** phModule - Set this to the handle to the requested module on success. On **
+ ** failure leave it untouched. See security note below! **
+ ** **
+ ** Return value - S_OK if the module was provided, or any other convenient **
+ ** error HRESULT if the module could not be provided **
+ ** **
+ ** **
+ ** !!!!!!!!!!!!!! **
+ ** SECURITY NOTE: Anything the caller would not be willing to execute itself, it **
+ ** should not provide to the this API call **
+ ***********************************************************************************/
+ HRESULT ProvideLibrary(
+ [in] const WCHAR* pwszFileName,
+ [in] DWORD dwTimestamp,
+ [in] DWORD dwSizeOfImage,
+ [out] HMODULE* phModule);
+}
+
+/**************************************************************************************
+ ** ICLRDebugging **
+ ** Activated using mscoree!CLRCreateInstance. **
+ **************************************************************************************/
+[
+ uuid(D28F3C5A-9634-4206-A509-477552EEFB10),
+ version(1.0),
+ helpstring("CLR debugging interface for MetaHost interface"),
+ local
+]
+interface ICLRDebugging : IUnknown
+{
+ /**********************************************************************************
+ ** Get the ICorDebugProcess and other information corresponding to a clr module **
+ ** loaded in the process **
+ ** Arguments: **
+ ** moduleBaseAddress - The base address of a module in the target process. **
+ ** COR_E_NOT_CLR will be returned if the indicated module is **
+ ** not a clr. **
+ ** pDataTarget - A data target abstraction which allows the managed **
+ ** debugger to inspect process state. It must implement **
+ ** at least ICorDebugDataTarget. **
+ ** pLibraryProvider - A library provider callback interface that allows version **
+ ** specific debugging libraries to be located and loaded on **
+ ** demand. This parameter is only required if ppProcess or **
+ ** pFlags is non-NULL. **
+ ** pMaxDebuggerSupportedVersion - The version of the CLR this debugger is **
+ ** designed to support. The debugger should specify the **
+ ** major and minor versions from the newest CLR version this **
+ ** debugger supports. The function may still succeed with **
+ ** a newer version of the CLR than this if the CLR **
+ ** determines that it should be compatible. The build and **
+ ** revision values are currently ignored. **
+ ** riidProcess - The interface ID of the desired ICorDebugProcess **
+ ** interface. Currently the only legal values are **
+ ** IID_CORDEBUGPROCESS3, IID_CORDEBUGPROCESS2, and **
+ ** IID_CORDEBUGPROCESS. **
+ ** ppProcess - Returns a pointer to a COM interface identified by **
+ ** riidProcess. Future versions of the runtime may implement **
+ ** other interfaces. **
+ ** pwszVersion - On input this is either null, or points to a **
+ ** CLR_DEBUGGING_VERSION structure. The wStructVersion field **
+ ** must be initialized to 0. On output the structure will be **
+ ** filled in with the CLR version information. **
+ ** pFlags - Informational flags about the specified runtime, see **
+ ** CLR_DEBUGGING_PROCESS_FLAGS for a description of the **
+ ** flags. **
+ ** **
+ ** The return value is S_OK if succeeded or: **
+ ** E_POINTER if pDataTarget is NULL **
+ ** CORDBG_E_LIBRARY_PROVIDER_ERROR if the ICLRDebuggingLibraryProvider callback**
+ ** returns an error or does not provide a valid**
+ ** handle **
+ ** CORDBG_E_MISSING_DATA_TARGET_INTERFACE if the pDataTarget argument does not**
+ ** implement the required data target **
+ ** interfaces for this version of the runtime. **
+ ** CORDBG_E_NOT_CLR if the indicated module is not a clr. It is **
+ ** possible that modules which do represent a **
+ ** CLR will not be detected if memory has been **
+ ** corrupted, is not available, or the CLR is **
+ ** of a newer version than the shim. **
+ ** CORDBG_E_UNSUPPORTED_DEBUGGING_MODEL if this runtime version does not **
+ ** support this debugging model. Currently v4 **
+ ** supports this model and no previous version **
+ ** does. The pVersion output argument will **
+ ** still be set to the correct value after **
+ ** receiving this error. **
+ ** CORDBG_E_UNSUPPORTED_FORWARD_COMPAT if the version of the CLR is not **
+ ** compatible with the version this debugger **
+ ** claims to support. The pVersion output **
+ ** argument will still be set to the correct **
+ ** value after receiving this error. **
+ ** E_NO_INTERFACE if the riidProcess interface is not **
+ ** available. **
+ ** CORDBG_E_UNSUPPORTED_VERSION_STRUCT if the version struct does not have a **
+ ** recognized value for wStructVersion. The **
+ ** only accepted value at this time is 0. **
+ ** Any other convenient HRESULT error, depending on the execution. **
+ **********************************************************************************/
+ HRESULT OpenVirtualProcess(
+ [in] ULONG64 moduleBaseAddress,
+ [in] IUnknown * pDataTarget,
+ [in] ICLRDebuggingLibraryProvider * pLibraryProvider,
+ [in] CLR_DEBUGGING_VERSION * pMaxDebuggerSupportedVersion,
+ [in] REFIID riidProcess,
+ [out, iid_is(riidProcess)] IUnknown ** ppProcess,
+ [in, out] CLR_DEBUGGING_VERSION * pVersion,
+ [out] CLR_DEBUGGING_PROCESS_FLAGS * pdwFlags);
+
+ /**********************************************************************************
+ ** Determines if a library provided via an ICLRDebuggingLibraryProvider is still **
+ ** in use. Functionally this checks to see if all instances of ICorDebug* **
+ ** interfaces have been released and no thread is currently within a call to **
+ ** OpenVirtualProcess. **
+ ** Arguments: **
+ ** hModule - A module handle previously provided by the **
+ ** ICLRDebuggingLibraryProvider used in OpenVirtualProcess **
+ ** Returns: **
+ ** S_OK if the module can be unloaded now **
+ ** S_FALSE if the module is still in use **
+ ** Any other error HRESULT if a failure occurs **
+ ** **
+ ** Notes: As of the V4.0 implementation unloading is still not fully supported **
+ ** and all calls to this method will return S_FALSE. **
+ **********************************************************************************/
+ HRESULT CanUnloadNow(HMODULE hModule);
+} // interface ICLRDebugging
+
+/**************************************************************************************
+ ** ICLRRuntimeInfo **
+ ** Represents a runtime - installed on the machine and/or loaded into a process. **
+ ** Includes functionality for obtaining various properties and for loading the **
+ ** runtime into the current process. The same installed runtime can be loaded **
+ ** multiple times in the same process (may not be supported in Dev10). **
+ **************************************************************************************/
+[
+ uuid(BD39D1D2-BA2F-486a-89B0-B4B0CB466891),
+ version(1.0),
+ helpstring("CLR runtime instance"),
+ local
+]
+interface ICLRRuntimeInfo : IUnknown
+{
+ // Methods that query information:
+
+ /**********************************************************************************
+ ** Returns the version of this runtime in the usual v-prefixed dotted form. **
+ ** Supersedes: GetRequestedRuntimeInfo, GetRequestedRuntimeVersion, **
+ ** GetCORVersion **
+ **********************************************************************************/
+ HRESULT GetVersionString(
+ [out, size_is(*pcchBuffer), annotation("_Out_writes_all_opt_(*pcchBuffer)")]
+ LPWSTR pwzBuffer,
+ [in, out] DWORD *pcchBuffer);
+
+ /**********************************************************************************
+ ** Returns the directory where this runtime is installed. **
+ ** Supersedes: GetCORSystemDirectory **
+ **********************************************************************************/
+ HRESULT GetRuntimeDirectory(
+ [out, size_is(*pcchBuffer), annotation("_Out_writes_all_(*pcchBuffer)")]
+ LPWSTR pwzBuffer,
+ [in, out] DWORD *pcchBuffer);
+
+ /**********************************************************************************
+ ** Returns TRUE if this runtime is loaded into the specified process. **
+ ** Supersedes: GetCORSystemDirectory **
+ **********************************************************************************/
+ HRESULT IsLoaded(
+ [in] HANDLE hndProcess,
+ [out, retval] BOOL *pbLoaded);
+
+ // Methods that may load the runtime:
+
+ /**********************************************************************************
+ ** Translates an HRESULT value into an error message. Use iLocaleID -1 for the **
+ ** default culture of the current thread. **
+ ** Supersedes: LoadStringRC, LoadStringRCEx **
+ **********************************************************************************/
+ HRESULT LoadErrorString(
+ [in] UINT iResourceID,
+ [out, size_is(*pcchBuffer), annotation("_Out_writes_all_(*pcchBuffer)")]
+ LPWSTR pwzBuffer,
+ [in, out] DWORD *pcchBuffer,
+ [in, lcid] LONG iLocaleID);
+
+ /**********************************************************************************
+ ** Loads a library located alongside this runtime. **
+ ** Supersedes: LoadLibraryShim **
+ **********************************************************************************/
+ HRESULT LoadLibrary(
+ [in] LPCWSTR pwzDllName,
+ [out, retval] HMODULE *phndModule);
+
+ /**********************************************************************************
+ ** Gets the address of the specified function exported from this runtime. **
+ ** It should NOT be documented what module the function lives in. We may want **
+ ** to implement some forwarding policy here. The reason for exposing **
+ ** GetProcAddress are functions like mscorwks!GetCLRIdentityManager. **
+ ** Supersedes: GetRealProcAddress **
+ **********************************************************************************/
+ HRESULT GetProcAddress(
+ [in] LPCSTR pszProcName,
+ [out, retval] LPVOID *ppProc);
+
+ /**********************************************************************************
+ ** Loads the runtime into the current process and returns an interface through **
+ ** which runtime functionality is provided. **
+ ** **
+ ** Supported CLSIDs/IIDs: **
+ ** CLSID_CorMetaDataDispenser IID_IMetaDataDispenser,IID_IMetaDataDispenserEx **
+ ** CLSID_CorMetaDataDispenserRuntime dtto **
+ ** CLSID_CorRuntimeHost IID_ICorRuntimeHost **
+ ** CLSID_CLRRuntimeHost IID_ICLRRuntimeHost **
+ ** CLSID_TypeNameFactory IID_ITypeNameFactory **
+ ** CLSID_CLRStrongName IID_ICLRStrongName **
+ ** CLSID_CLRDebuggingLegacy IID_ICorDebug **
+ ** CLSID_CLRProfiling IID_ICLRProfiling **
+ ** **
+ ** Supersedes: CorBindTo* and others **
+ **********************************************************************************/
+ HRESULT GetInterface(
+ [in] REFCLSID rclsid,
+ [in] REFIID riid,
+ [out, iid_is(riid), retval] LPVOID *ppUnk);
+
+ // Does not load runtime
+
+ /**********************************************************************************
+ ** Returns TRUE if this runtime could be loaded into the current process. Note **
+ ** that this method is side-effect free, and thus does not represent a **
+ ** commitment to be able to load this runtime if it sets *pbLoadable to be TRUE.**
+ ** Supersedes: none **
+ **********************************************************************************/
+ HRESULT IsLoadable(
+ [out, retval] BOOL *pbLoadable);
+
+ /**********************************************************************************
+ ** Sets startup flags and host config file that will be used at startup. **
+ ** Supersedes: The startupFlags parameter in CorBindToRuntimeEx/Host **
+ **********************************************************************************/
+ HRESULT SetDefaultStartupFlags(
+ [in] DWORD dwStartupFlags,
+ [in] LPCWSTR pwzHostConfigFile);
+
+ /**********************************************************************************
+ ** Gets startup flags and host config file that will be used at startup. **
+ ** Supersedes: GetStartupFlags, GetHostConfigurationFile **
+ **********************************************************************************/
+ HRESULT GetDefaultStartupFlags(
+ [out] DWORD *pdwStartupFlags,
+ [out, size_is(*pcchHostConfigFile), annotation("_Out_writes_all_opt_(*pcchHostConfigFile)")]
+ LPWSTR pwzHostConfigFile,
+ [in, out] DWORD *pcchHostConfigFile);
+
+ /**********************************************************************************
+ ** If not already bound (for example, with a useLegacyV2RuntimeActivationPolicy **
+ ** config setting), binds this runtime for all legacy V2 activation policy **
+ ** decisions. If a different runtime was already bound to the legacy V2 **
+ ** activation policy, returns CLR_E_SHIM_LEGACYRUNTIMEALREADYBOUND. If this **
+ ** runtime was already bound as the legacy V2 activation policy runtime, **
+ ** returns S_OK. **
+ **********************************************************************************/
+ HRESULT BindAsLegacyV2Runtime();
+
+ /**********************************************************************************
+ ** Returns TRUE if the runtime has been started, i.e. Start() has been called. **
+ ** If it has been started, its STARTUP_FLAGS are returned. **
+ ** **
+ ** IMPORTANT: This method is valid only for v4+ runtimes. This method will **
+ ** return E_NOTIMPL for all pre-v4 runtimes. **
+ **********************************************************************************/
+ HRESULT IsStarted(
+ [out] BOOL *pbStarted,
+ [out] DWORD *pdwStartupFlags);
+};
+
+/**************************************************************************************
+ ** ICLRStrongName **
+ ** These are the strong name APIs exposed by mscoree refactored into an interface. **
+ ** The only change is the omission of StrongNameErrorInfo and having all methods **
+ ** return the COM standard HRESULT. TODO (low-pri): **
+ ** ideas what could be done here - we have an opportunity to make breaking changes, **
+ ** cleanup etc.
+ **************************************************************************************/
+[
+ uuid(9FD93CCF-3280-4391-B3A9-96E1CDE77C8D),
+ version(1.0),
+ helpstring("CLR strong name interface"),
+ local
+]
+interface ICLRStrongName : IUnknown
+{
+ /**********************************************************************************
+ ** Gets a hash of the specified assembly file, using the specified hash **
+ ** algorithm. **
+ ** Supersedes: GetHashFromAssemblyFile **
+ **********************************************************************************/
+ HRESULT GetHashFromAssemblyFile(
+ [in] LPCSTR pszFilePath,
+ [in, out] unsigned int *piHashAlg,
+ [out, size_is(cchHash), length_is(*pchHash)] BYTE *pbHash,
+ [in] DWORD cchHash,
+ [out] DWORD *pchHash);
+
+ /**********************************************************************************
+ ** Gets a hash of the specified assembly file, using the specified hash **
+ ** algorithm (Unicode version). **
+ ** Supersedes: GetHashFromAssemblyFileW **
+ **********************************************************************************/
+ HRESULT GetHashFromAssemblyFileW(
+ [in] LPCWSTR pwzFilePath,
+ [in, out] unsigned int *piHashAlg,
+ [out, size_is(cchHash), length_is(*pchHash)] BYTE *pbHash,
+ [in] DWORD cchHash,
+ [out] DWORD *pchHash);
+
+ /**********************************************************************************
+ ** Gets a hash of the assembly at the specified memory address, using the **
+ ** specified hash algorithm. **
+ ** Supersedes: GetHashFromBlob **
+ **********************************************************************************/
+ HRESULT GetHashFromBlob(
+ [in] BYTE *pbBlob,
+ [in] DWORD cchBlob,
+ [in, out] unsigned int *piHashAlg,
+ [out, size_is(cchHash), length_is(*pchHash)] BYTE *pbHash,
+ [in] DWORD cchHash,
+ [out] DWORD *pchHash);
+
+ /**********************************************************************************
+ ** Generates a hash over the contents of the specified file. **
+ ** Supersedes: GetHashFromFile **
+ **********************************************************************************/
+ HRESULT GetHashFromFile(
+ [in] LPCSTR pszFilePath,
+ [in, out] unsigned int *piHashAlg,
+ [out, size_is(cchHash), length_is(*pchHash)] BYTE *pbHash,
+ [in] DWORD cchHash,
+ [out] DWORD *pchHash);
+
+ /**********************************************************************************
+ ** Generates a hash over the contents of the specified file (Unicode version). **
+ ** Supersedes: GetHashFromFileW **
+ **********************************************************************************/
+ HRESULT GetHashFromFileW(
+ [in] LPCWSTR pwzFilePath,
+ [in, out] unsigned int *piHashAlg,
+ [out, size_is(cchHash), length_is(*pchHash)] BYTE *pbHash,
+ [in] DWORD cchHash,
+ [out] DWORD *pchHash);
+
+ /**********************************************************************************
+ ** Generates a hash over the contents of the file with the specified file **
+ ** handle, using the specified hash algorithm. **
+ ** Supersedes: GetHashFromHandle **
+ **********************************************************************************/
+ HRESULT GetHashFromHandle(
+ [in] HANDLE hFile,
+ [in, out] unsigned int *piHashAlg,
+ [out, size_is(cchHash), length_is(*pchHash)] BYTE *pbHash,
+ [in] DWORD cchHash,
+ [out] DWORD *pchHash);
+
+ /**********************************************************************************
+ ** Determines whether two assemblies differ only by their strong name **
+ ** signatures. **
+ ** Supersedes: StrongNameCompareAssemblies **
+ **********************************************************************************/
+ HRESULT StrongNameCompareAssemblies(
+ [in] LPCWSTR pwzAssembly1,
+ [in] LPCWSTR pwzAssembly2,
+ [out, retval] DWORD *pdwResult);
+
+ /**********************************************************************************
+ ** Frees memory that was allocated with a previous call to a strong name **
+ ** function such as StrongNameGetPublicKey, StrongNameTokenFromPublicKey, or **
+ ** StrongNameSignatureGeneration. **
+ ** Supersedes: StrongNameFreeBuffer **
+ **********************************************************************************/
+ HRESULT StrongNameFreeBuffer(
+ [in] BYTE *pbMemory);
+
+ /**********************************************************************************
+ ** Fills the specified buffer with the binary representation of the executable. **
+ ** Supersedes: StrongNameGetBlob **
+ **********************************************************************************/
+ HRESULT StrongNameGetBlob(
+ [in] LPCWSTR pwzFilePath,
+ [in, out, size_is(*pcbBlob), length_is(*pcbBlob)] BYTE *pbBlob,
+ [in, out] DWORD *pcbBlob);
+
+ /**********************************************************************************
+ ** Gets a binary representation of the assembly image at the specified memory **
+ ** address. **
+ ** Supersedes: StrongNameGetBlobFromImage **
+ **********************************************************************************/
+ HRESULT StrongNameGetBlobFromImage(
+ [in, size_is(dwLength)] BYTE *pbBase,
+ [in] DWORD dwLength,
+ [out, size_is(*pcbBlob), length_is(*pcbBlob)] BYTE *pbBlob,
+ [in, out] DWORD *pcbBlob);
+
+ /**********************************************************************************
+ ** Gets the public key from a private/public key pair. **
+ ** Supersedes: StrongNameGetPublicKey **
+ **********************************************************************************/
+ HRESULT StrongNameGetPublicKey(
+ [in] LPCWSTR pwzKeyContainer,
+ [in] BYTE *pbKeyBlob,
+ [in] ULONG cbKeyBlob,
+ [out] BYTE **ppbPublicKeyBlob,
+ [out] ULONG *pcbPublicKeyBlob);
+
+ /**********************************************************************************
+ ** Gets the buffer size required for a hash, using the specified hash **
+ ** algorithm. **
+ ** Supersedes: StrongNameHashSize **
+ **********************************************************************************/
+ HRESULT StrongNameHashSize(
+ [in] ULONG ulHashAlg,
+ [out, retval] DWORD *pcbSize);
+
+ /**********************************************************************************
+ ** Deletes the specified key container. **
+ ** Supersedes: StrongNameKeyDelete **
+ **********************************************************************************/
+ HRESULT StrongNameKeyDelete(
+ [in] LPCWSTR pwzKeyContainer);
+
+ /**********************************************************************************
+ ** Creates a new public/private key pair for strong name use. **
+ ** Supersedes: StrongNameKeyGen **
+ **********************************************************************************/
+ HRESULT StrongNameKeyGen(
+ [in] LPCWSTR pwzKeyContainer,
+ [in] DWORD dwFlags,
+ [out] BYTE **ppbKeyBlob,
+ [out] ULONG *pcbKeyBlob);
+
+ /**********************************************************************************
+ ** Generates a new public/private key pair with the specified key size, for **
+ ** strong name use. **
+ ** Supersedes: StrongNameKeyGenEx **
+ **********************************************************************************/
+ HRESULT StrongNameKeyGenEx(
+ [in] LPCWSTR pwzKeyContainer,
+ [in] DWORD dwFlags,
+ [in] DWORD dwKeySize,
+ [out] BYTE **ppbKeyBlob,
+ [out] ULONG *pcbKeyBlob);
+
+ /**********************************************************************************
+ ** Imports a public/private key pair into a container. **
+ ** Supersedes: StrongNameKeyInstall **
+ **********************************************************************************/
+ HRESULT StrongNameKeyInstall(
+ [in] LPCWSTR pwzKeyContainer,
+ [in] BYTE *pbKeyBlob,
+ [in] ULONG cbKeyBlob);
+
+ /**********************************************************************************
+ ** Generates a strong name signature for the specified assembly. **
+ ** Supersedes: StrongNameSignatureGeneration **
+ **********************************************************************************/
+ HRESULT StrongNameSignatureGeneration(
+ [in] LPCWSTR pwzFilePath,
+ [in] LPCWSTR pwzKeyContainer,
+ [in] BYTE *pbKeyBlob,
+ [in] ULONG cbKeyBlob,
+ [out] BYTE **ppbSignatureBlob,
+ [out] ULONG *pcbSignatureBlob);
+
+ /**********************************************************************************
+ ** Generates a strong name signature for the specified assembly, according to **
+ ** the specified flags. **
+ ** Supersedes: StrongNameSignatureGenerationEx **
+ **********************************************************************************/
+ HRESULT StrongNameSignatureGenerationEx(
+ [in] LPCWSTR wszFilePath,
+ [in] LPCWSTR wszKeyContainer,
+ [in] BYTE *pbKeyBlob,
+ [in] ULONG cbKeyBlob,
+ [out] BYTE **ppbSignatureBlob,
+ [out] ULONG *pcbSignatureBlob,
+ [in] DWORD dwFlags);
+
+ /**********************************************************************************
+ ** Returns the size of the strong name signature. **
+ ** Supersedes: StrongNameSignatureSize **
+ **********************************************************************************/
+ HRESULT StrongNameSignatureSize(
+ [in] BYTE *pbPublicKeyBlob,
+ [in] ULONG cbPublicKeyBlob,
+ [in] DWORD *pcbSize);
+
+ /**********************************************************************************
+ ** Gets a value indicating whether the assembly manifest at the supplied path **
+ ** contains a strong name signature, which is verified according to the **
+ ** specified flags. **
+ ** Supersedes: StrongNameSignatureVerification **
+ **********************************************************************************/
+ HRESULT StrongNameSignatureVerification(
+ [in] LPCWSTR pwzFilePath,
+ [in] DWORD dwInFlags,
+ [out, retval] DWORD *pdwOutFlags);
+
+ /**********************************************************************************
+ ** Gets a value indicating whether the assembly manifest at the supplied path **
+ ** contains a strong name signature. **
+ ** Supersedes: StrongNameSignatureVerificationEx **
+ **********************************************************************************/
+ HRESULT StrongNameSignatureVerificationEx(
+ [in] LPCWSTR pwzFilePath,
+ [in] BOOLEAN fForceVerification,
+ [out, retval] BOOLEAN *pfWasVerified);
+
+ /**********************************************************************************
+ ** Verifies that an assembly that has already been mapped to memory is valid **
+ ** for the associated public key. **
+ ** Supersedes: StrongNameSignatureVerificationFromImage **
+ **********************************************************************************/
+ HRESULT StrongNameSignatureVerificationFromImage(
+ [in] BYTE *pbBase,
+ [in] DWORD dwLength,
+ [in] DWORD dwInFlags,
+ [out, retval] DWORD *pdwOutFlags);
+
+ /**********************************************************************************
+ ** Creates a strong name token from the specified assembly file. **
+ ** Supersedes: StrongNameTokenFromAssembly **
+ **********************************************************************************/
+ HRESULT StrongNameTokenFromAssembly(
+ [in] LPCWSTR pwzFilePath,
+ [out] BYTE **ppbStrongNameToken,
+ [out] ULONG *pcbStrongNameToken);
+
+ /**********************************************************************************
+ ** Creates a strong name token from the specified assembly file, and returns **
+ ** the public key that the token represents. **
+ ** Supersedes: StrongNameTokenFromAssemblyEx **
+ **********************************************************************************/
+ HRESULT StrongNameTokenFromAssemblyEx(
+ [in] LPCWSTR pwzFilePath,
+ [out] BYTE **ppbStrongNameToken,
+ [out] ULONG *pcbStrongNameToken,
+ [out] BYTE **ppbPublicKeyBlob,
+ [out] ULONG *pcbPublicKeyBlob);
+ /**********************************************************************************
+ ** Gets a token representing a public key. A strong name token is the shortened **
+ ** form of a public key. **
+ ** Supersedes: StrongNameTokenFromPublicKey **
+ **********************************************************************************/
+ HRESULT StrongNameTokenFromPublicKey(
+ [in] BYTE *pbPublicKeyBlob,
+ [in] ULONG cbPublicKeyBlob,
+ [out] BYTE **ppbStrongNameToken,
+ [out] ULONG *pcbStrongNameToken);
+}; // interface ICLRStrongName
+
+/**************************************************************************************
+ ** ICLRStrongName2 **
+ ** Strongname Api's **
+ **************************************************************************************/
+[
+ uuid(C22ED5C5-4B59-4975-90EB-85EA55C0069B),
+ version(1.0),
+ helpstring("CLR strong name interface 2"),
+ local
+]
+interface ICLRStrongName2 : IUnknown
+{
+ /**********************************************************************************
+ ** Gets the public key from a private/public key pair, specifying a hash **
+ ** algorithm and a signature algorithm. **
+ **********************************************************************************/
+ HRESULT StrongNameGetPublicKeyEx(
+ [in] LPCWSTR pwzKeyContainer,
+ [in] BYTE *pbKeyBlob,
+ [in] ULONG cbKeyBlob,
+ [out] BYTE **ppbPublicKeyBlob,
+ [out] ULONG *pcbPublicKeyBlob,
+ [in] ULONG uHashAlgId, // specify algorithm, or set to 0 for default
+ [in] ULONG uReserved); // reserved for future use, always set to 0
+
+ /**********************************************************************************
+ ** Verify the signature of a strongly named assembly, providing a mapping from **
+ ** the ECMA key to a real key **
+ **********************************************************************************/
+ HRESULT StrongNameSignatureVerificationEx2(
+ [in] LPCWSTR wszFilePath,
+ [in] BOOLEAN fForceVerification,
+ [in] BYTE *pbEcmaPublicKey,
+ [in] DWORD cbEcmaPublicKey,
+ [out] BOOLEAN *pfWasVerified);
+}; // interface ICLRStrongName2
+
+/*************************************************************************************
+** ICLRStrongName3 **
+** StrongName digest signing APIs **
+**************************************************************************************/
+[
+ uuid(22c7089b-bbd3-414a-b698-210f263f1fed),
+ version(1.0),
+ helpstring("CLR strong name digest signing interface"),
+ local
+]
+interface ICLRStrongName3 : IUnknown
+{
+ // Generate the digest of an input assembly, which can be signed with StrongNameDigestSign
+ HRESULT StrongNameDigestGenerate(
+ [in] LPCWSTR wszFilePath,
+ [out] BYTE** ppbDigestBlob,
+ [out] ULONG* pcbDigestBlob,
+ [in] DWORD dwFlags);
+
+ // Sign an the digest of an assembly calculated by StrongNameDigestGenerate
+ HRESULT StrongNameDigestSign(
+ [in] LPCWSTR wszKeyContainer,
+ [in, size_is(cbKeyBlob)] BYTE* pbKeyBlob,
+ [in] ULONG cbKeyBlob,
+ [in, size_is(cbDigestBlob)] BYTE* pbDigestBlob,
+ [in] ULONG cbDigestBlob,
+ [in] DWORD hashAlgId,
+ [out] BYTE** ppbSignatureBlob,
+ [out] ULONG* pcbSignatureBlob,
+ [in] DWORD dwFlags);
+
+ // Embed a digest signature generated with StrongNameDigestSign into an assembly
+ HRESULT StrongNameDigestEmbed(
+ [in] LPCWSTR wszFilePath,
+ [in, size_is(cbSignatureBlob)] BYTE* pbSignatureBlob,
+ [in] ULONG cbSignatureBlob);
+};
+
+[
+ uuid(5288DA6A-A8D3-43a1-8365-37DB0E7D5943),
+ version(1.0),
+]
+library CLRMetaHost
+{
+ interface ICLRMetaHost;
+ interface ICLRMetaHostPolicy;
+ interface ICLRProfiling;
+ interface ICLRDebuggingLibraryProvider;
+ interface ICLRDebugging;
+ interface ICLRRuntimeInfo;
+ interface ICLRStrongName;
+
+ // Scenario: EXE activation
+ // 1. ICLRMetaHostPolicy::GetRequestedRuntime
+ // 2. ICLRRuntimeInfo::GetProcAddress("ExeMain")
+ // 3. ExeMain() - TODO: Add a hosting API to execute an EXE?
+
+ // Scenario: COM activation
+ // 1. <get version info from registry>
+ // 2. ICLRMetaHostPolicy::GetRequestedRuntime
+ // 3. ICLRRuntimeInfo::GetInterface(IID_ICLRRuntimeHost)
+ // 4. ICLRRuntimeHost::Start
+ // 5. ICLRRuntimeInfo::GetProcAddress("ClrCreateManagedInstance")
+ // 6. pClrCreateManagedInstance()
+
+ // Scenario: Hosting with custom policy
+ // 1. ICLRMetaHost::GetFileVersion
+ // 2. ICLRMetaHost::EnumerateInstalledRuntimes
+ // 3. ICLRRuntimeInfo::IsLoaded/IsStarted
+ // ...
+
+ // Scenario: Debugger attach for v1.0 to v4 using v2 lookalike interface
+ // ICLRMetaHost::EnumerateLoadedRuntimes
+ // ICLRRuntimeInfo::GetInterface(CLSID_CLRDebuggingLegacy, IID_ICorDebug)
+
+ // Scenario: Profiler attach for v4
+ // ICLRMetaHost::EnumerateLoadedRuntimes
+ // ICLRRuntimeInfo::GetInterface(CLSID_CLRProfiling, IID_ICLRProfiling)
+
+ // Scenario: An installer needs to modify configuration of supported runtimes
+ // 1. ICLRMetaHost::EnumerateInstalledRuntimes
+ // 2. ICLRRuntimeInfo::GetVersionString
+ // 3. <policy>
+ // 4. ICLRRuntimeInfo::GetRuntimeDirectory
+ // 5. <modify the config file under the runtime dir>
+
+}; // library CLRMetaHost
+
+cpp_quote("#endif // WINAPI_FAMILY_PARTITION(WINAPI_PARTITION_DESKTOP)")
diff --git a/src/inc/metahost_mktlb.rc b/src/inc/metahost_mktlb.rc
new file mode 100644
index 0000000000..a8a60ee1b2
--- /dev/null
+++ b/src/inc/metahost_mktlb.rc
@@ -0,0 +1,11 @@
+// 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.
+
+#define FX_VER_FILEDESCRIPTION_STR "Microsoft .NET Runtime Metahosting Interfaces\0"
+#define FX_VER_INTERNALNAME_STR METAHOST.IDL
+
+#include <fxver.h>
+#include <fxver.rc>
+
+1 typelib REAL_METAHOST_TLB_FILE
diff --git a/src/inc/metahostpriv.idl b/src/inc/metahostpriv.idl
new file mode 100644
index 0000000000..6d833b3a68
--- /dev/null
+++ b/src/inc/metahostpriv.idl
@@ -0,0 +1,212 @@
+// 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.
+
+/**************************************************************************************
+ ** NOTE: This file should be removed before 4.0 RTM. Specifically, when we decide **
+ ** that enough time has elapsed that there should be no binaries left depending on **
+ ** this old interface version.
+ **************************************************************************************/
+
+import "metahost.idl";
+
+// IID ICLRMetaHostCompat1 : uuid(D332DB9E-B9B3-4125-8207-A14884F53215)
+cpp_quote("EXTERN_GUID(IID_ICLRMetaHostCompat1, 0xD332DB9E, 0xB9B3, 0x4125, 0x82, 0x07, 0xA1, 0x48, 0x84, 0xF5, 0x32, 0x15);")
+
+// IID ICLRMetaHostPolicyCompat1 : uuid(E2190695-77B2-492e-8E14-C4B3A7FDD592)
+cpp_quote("EXTERN_GUID(IID_ICLRMetaHostPolicyCompat1, 0xE2190695, 0x77B2, 0x492e, 0x8E, 0x14, 0xC4, 0xB3, 0xA7, 0xFD, 0xD5, 0x92);")
+
+// IID ICLRRuntimeHost3 : uuid(F4A7AE38-3213-4057-85FC-3DA54AFD0CFC)
+cpp_quote("EXTERN_GUID(IID_ICLRRuntimeHost3, 0xF4A7AE38, 0x3213, 0x4057, 0x85, 0xFC, 0x3D, 0xA5, 0x4A, 0xFD, 0x0C, 0xFC);")
+
+[
+ uuid(D332DB9E-B9B3-4125-8207-A14884F53215),
+ version(1.0),
+ helpstring("CLR meta hosting interface"),
+ local
+]
+interface ICLRMetaHostCompat1 : IUnknown
+{
+ /**********************************************************************************
+ ** Returns installed runtime with the specific version. Fails if not found. **
+ ** NULL or any other wildcard is not accepted as pwzVersion **
+ ** Supersedes: CorBindToRuntimeEx with STARTUP_LOADER_SAFEMODE **
+
+
+ **********************************************************************************/
+ HRESULT GetRuntime(
+ [in] LPCWSTR pwzVersion,
+ [in] REFIID riid, // IID_ICLRRuntimeInfo
+ [out, iid_is(riid), retval] LPVOID *ppRuntime);
+
+ /**********************************************************************************
+ ** Returns runtime version burned into a file's metadata. **
+ ** Supersedes: GetFileVersion **
+ **********************************************************************************/
+ HRESULT GetVersionFromFile(
+ [in] LPCWSTR pwzFilePath,
+ [out, size_is(*pcchBuffer), annotation("__out_ecount_full(*pcchBuffer)")]
+ LPWSTR pwzBuffer,
+ [in, out] DWORD *pcchBuffer);
+
+ /**********************************************************************************
+ ** Returns an enumerator of runtimes installed on the machine. **
+ ** Supersedes: (none) **
+ **********************************************************************************/
+ HRESULT EnumerateInstalledRuntimes(
+ [out, retval] IEnumUnknown **ppEnumerator);
+
+ /**********************************************************************************
+ ** Provides an enumerator of runtimes loaded into the given process. **
+ ** Supersedes: GetVersionFromProcess **
+
+ **********************************************************************************/
+ HRESULT EnumerateLoadedRuntimes(
+ [in] HANDLE hndProcess,
+ [out, retval] IEnumUnknown **ppEnumerator);
+
+ /**********************************************************************************
+ ** Provides a callback when a new runtime version has just been loaded, but not **
+ ** started. **
+ ** **
+ ** The callback works in the following way: **
+ ** - the callback is invoked only when a runtime is loaded for the first time **
+ ** - the callback will not be invoked for reentrant loads of the same runtime **
+ ** - the callback will be for reentrant loads of other runtimes **
+ ** - it is guaranteed that no other thread may load the runtime until the **
+ ** callback returns; any thread that does so blocks until this time. **
+ ** - for non-reentrant multi-threaded runtime loads, callbacks are serialized **
+ ** - if the host intends to load (or cause to be loaded) another runtime in a **
+ ** reentrant fashion, or intends to perform any operations on the runtime **
+ ** corresponding to the callback instance, the pfnCallbackThreadSet and **
+ ** pfnCallbackThreadUnset arguments provided in the callback must be used **
+ ** in the following way: **
+ ** - pfnCallbackThreadSet must be called by the thread that might cause a **
+ ** runtime load before such a load is attempted **
+ ** - pfnCallbackThreadUnset must be called when the thread will no longer **
+ ** cause such a runtime load (and before returning from the initial **
+ ** callback) **
+ ** - pfnCallbackThreadSet and pfnCallbackThreadUnset are non-reentrant. **
+ ** **
+ ** pCallbackFunction: This function is invoked when a new runtime has just **
+ ** been loaded. A value of NULL results in a failure **
+ ** return value of E_POINTER. **
+ ** **
+ ** Supersedes: LockClrVersion **
+ **********************************************************************************/
+ HRESULT RequestRuntimeLoadedNotification(
+ [in] RuntimeLoadedCallbackFnPtr pCallbackFunction);
+
+ /**********************************************************************************
+ ** Provides a mechanism to set the process wide config file settings. **
+ ** Supersedes: none **
+ **********************************************************************************/
+ HRESULT SetProcessConfig(
+ [in] IStream * pstmConfig);
+} // interface ICLRMetaHost
+
+
+/**************************************************************************************
+ ** ICLRMetaHostPolicyCompat1 **
+ ** Activated using mscoree!CreateInterface. Implements a policy for determining **
+ ** a runtime based on various inputs (metadata, config stream, ...). **
+ **************************************************************************************/
+[
+ uuid(E2190695-77B2-492e-8E14-C4B3A7FDD592),
+ version(1.0),
+ helpstring("CLR meta hosting policy"),
+ local
+]
+interface ICLRMetaHostPolicyCompat1 : IUnknown
+{
+ /**********************************************************************************
+ ** Returns requested runtime version and runtime (not necessarily of that **
+ ** version) based on a managed binary, version, and config file. **
+ ** The return value is S_OK if a compatible runtime was found and S_FALSE if **
+ ** not. *ppRuntime will be NULL in the latter case. **
+ ** Supersedes: GetRequestedRuntimeInfo, GetRequestedRuntimeVersion, **
+ ** CorBindToRuntimeHost, CorBindToRuntimeByCfg, **
+ ** GetCORRequiredVersion **
+ **********************************************************************************/
+ HRESULT GetRequestedRuntime(
+ [in] METAHOST_POLICY_FLAGS dwPolicyFlags,
+ [in] LPCWSTR pwzBinary, // optional
+ [in] IStream *pCfgStream, // optional
+ [in, out, size_is(*pcchVersion), annotation("__inout_ecount_full(*pcchVersion)")]
+ LPWSTR pwzVersion, // optional
+ [in, out] DWORD *pcchVersion,
+ [out, size_is(*pcchImageVersion), annotation("__out_ecount_full(*pcchImageVersion)")]
+ LPWSTR pwzImageVersion, // image version to be used by compilers
+ [in, out] DWORD *pcchImageVersion,
+ [in] REFIID riid, // IID_ICLRRuntimeInfo
+ [out, iid_is(riid), retval] LPVOID *ppRuntime);
+} // interface ICLRMetaHostPolicy
+
+/**************************************************************************************
+ ** ICLRRuntimeHost3 **
+ ** This is the functionality that moved from being flat APIs (loading the latest **
+ ** runtime) to something that is runtime-specific and requires the runtime to be **
+ ** loaded.
+ **************************************************************************************/
+[
+ uuid(F4A7AE38-3213-4057-85FC-3DA54AFD0CFC),
+ version(1.0),
+ helpstring("CLR hosting interface for V4.0"),
+ local
+]
+interface ICLRRuntimeHost3 : ICLRRuntimeHost
+{
+ /**********************************************************************************
+ ** Creates an instance of the type specified by a fully qualified name. **
+ ** Returns a CCW wrapping the managed object. This method is intended to be **
+ ** used primarily by the COM host. TODO: Specify the AppDomain? **
+ **
+ ** Supersedes: ClrCreateManagedInstance **
+ **********************************************************************************/
+ HRESULT CreateManagedObject(
+ [in] LPCWSTR pwzTypeName,
+ [in] REFIID riid,
+ [out, iid_is(riid), retval] LPVOID *ppObject);
+
+ /**********************************************************************************
+ ** Releases all cached RCWs. **
+ ** Supersedes: CoEEShutDownCOM **
+ **********************************************************************************/
+ HRESULT ShutdownCOMInterop();
+
+ /**********************************************************************************
+ ** Shuts down the current process. **
+ ** Supersedes: CorExitProcess **
+ **********************************************************************************/
+ HRESULT ExitProcess(
+ [in] INT32 iExitCode);
+
+ /**********************************************************************************
+ ** Returns TRUE if the runtime has been started, i.e. Start() has been called. **
+ ** If it has been started, its STARTUP_FLAGS are returned. **
+ ** Supersedes: (none) **
+ **********************************************************************************/
+ HRESULT IsStarted(
+ [out] BOOL *pbStarted,
+ [out] DWORD *pdwStartupFlags);
+
+ /**********************************************************************************
+ ** Starts the runtime with the given STARTUP_FLAGS and host config file. **
+ ** Supersedes: ICLRRuntimeHost::Start **
+ **********************************************************************************/
+ HRESULT StartWithFlags(
+ [in] DWORD dwStartupFlags,
+ [in] LPCWSTR pwzHostConfigFile);
+}; // interface ICLRRuntimeHost3
+
+[
+ uuid(5288DA6A-A8D3-43a1-8365-37DB0E7D5944),
+ version(1.0),
+]
+library CLRMetaHostCompat
+{
+ interface ICLRMetaHostCompat1;
+ interface ICLRMetaHostPolicyCompat1;
+ interface ICLRRuntimeHost3;
+};
+
diff --git a/src/inc/metamodelpub.h b/src/inc/metamodelpub.h
new file mode 100644
index 0000000000..ba68ae0c30
--- /dev/null
+++ b/src/inc/metamodelpub.h
@@ -0,0 +1,1672 @@
+// 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.
+//*****************************************************************************
+// MetaModelPub.h -- header file for Common Language Runtime metadata.
+//
+
+//
+//*****************************************************************************
+
+#ifndef _METAMODELPUB_H_
+#define _METAMODELPUB_H_
+
+#if _MSC_VER >= 1100
+# pragma once
+#endif
+
+#include <cor.h>
+#include <stgpool.h>
+
+#ifndef lengthof
+# define lengthof(x) (sizeof(x)/sizeof((x)[0]))
+#endif
+
+template<class T> inline T Align4(T p)
+{
+ LIMITED_METHOD_CONTRACT;
+
+ INT_PTR i = (INT_PTR)p;
+ i = (i+(3)) & ~3;
+ return (T)i;
+}
+
+typedef ULONG RID;
+
+// check if a rid is valid or not
+#define InvalidRid(rid) ((rid) == 0)
+
+#ifndef METADATA_FIELDS_PROTECTION
+#define METADATA_FIELDS_PROTECTION public
+#endif
+
+//*****************************************************************************
+// Record definitions. Records have some combination of fixed size fields and
+// variable sized fields (actually, constant across a database, but variable
+// between databases).
+//
+// In this section we define record definitions which include the fixed size
+// fields and an enumeration of the variable sized fields.
+//
+// Naming is as follows:
+// Given some table "Xyz":
+// class XyzRec { public:
+// SOMETYPE m_SomeField;
+// // rest of the fixed fields.
+// enum { COL_Xyz_SomeOtherField,
+// // rest of the fields, enumerated.
+// COL_Xyz_COUNT };
+// };
+//
+// The important features are the class name (XyzRec), the enumerations
+// (COL_Xyz_FieldName), and the enumeration count (COL_Xyz_COUNT).
+//
+// THESE NAMING CONVENTIONS ARE CARVED IN STONE! DON'T TRY TO BE CREATIVE!
+//
+//*****************************************************************************
+// Have the compiler generate two byte alignment. Be careful to manually lay
+// out the fields for proper alignment. The alignment for variable-sized
+// fields will be computed at save time.
+#include <pshpack2.h>
+
+// Non-sparse tables.
+class ModuleRec
+{
+METADATA_FIELDS_PROTECTION:
+ USHORT m_Generation; // ENC generation.
+public:
+ enum {
+ COL_Generation,
+
+ COL_Name,
+ COL_Mvid,
+ COL_EncId,
+ COL_EncBaseId,
+ COL_COUNT,
+ COL_KEY
+ };
+ USHORT GetGeneration()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ return GET_UNALIGNED_VAL16(&m_Generation);
+ }
+ void SetGeneration(USHORT Generation)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_Generation = VAL16(Generation);
+ }
+};
+
+class TypeRefRec
+{
+public:
+ enum {
+ COL_ResolutionScope, // mdModuleRef or mdAssemblyRef.
+ COL_Name,
+ COL_Namespace,
+ COL_COUNT,
+ COL_KEY
+ };
+};
+
+class TypeDefRec
+{
+METADATA_FIELDS_PROTECTION:
+ ULONG m_Flags; // Flags for this TypeDef
+public:
+ enum {
+ COL_Flags,
+
+ COL_Name, // offset into string pool.
+ COL_Namespace,
+ COL_Extends, // coded token to typedef/typeref.
+ COL_FieldList, // rid of first field.
+ COL_MethodList, // rid of first method.
+ COL_COUNT,
+ COL_KEY
+ };
+ ULONG GetFlags()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ return GET_UNALIGNED_VAL32(&m_Flags);
+ }
+ void SetFlags(ULONG Flags)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_Flags = VAL32(Flags);
+ }
+ void AddFlags(ULONG Flags)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_Flags |= VAL32(Flags);
+ }
+ void RemoveFlags(ULONG Flags)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_Flags &= ~VAL32(Flags);
+ }
+
+};
+
+class FieldPtrRec
+{
+public:
+ enum {
+ COL_Field,
+ COL_COUNT,
+ COL_KEY
+ };
+};
+
+class FieldRec
+{
+METADATA_FIELDS_PROTECTION:
+ USHORT m_Flags; // Flags for the field.
+public:
+ enum {
+ COL_Flags,
+
+ COL_Name,
+ COL_Signature,
+ COL_COUNT,
+ COL_KEY
+ };
+ USHORT GetFlags()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ return GET_UNALIGNED_VAL16(&m_Flags);
+ }
+ void SetFlags(ULONG Flags)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_Flags = (USHORT)VAL16(Flags);
+ }
+ void AddFlags(ULONG Flags)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_Flags |= (USHORT)VAL16(Flags);
+ }
+ void RemoveFlags(ULONG Flags)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_Flags &= (USHORT)~VAL16(Flags);
+ }
+
+
+};
+
+class MethodPtrRec
+{
+public:
+ enum {
+ COL_Method,
+ COL_COUNT,
+ COL_KEY
+ };
+};
+
+class MethodRec
+{
+METADATA_FIELDS_PROTECTION:
+ ULONG m_RVA; // RVA of the Method.
+ USHORT m_ImplFlags; // Descr flags of the Method.
+ USHORT m_Flags; // Flags for the Method.
+public:
+ enum {
+ COL_RVA,
+ COL_ImplFlags,
+ COL_Flags,
+
+ COL_Name,
+ COL_Signature,
+ COL_ParamList, // Rid of first param.
+ COL_COUNT,
+ COL_KEY
+ };
+
+ void Copy(MethodRec *pFrom)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_RVA = pFrom->m_RVA;
+ m_ImplFlags = pFrom->m_ImplFlags;
+ m_Flags = pFrom->m_Flags;
+ }
+
+ ULONG GetRVA()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ return GET_UNALIGNED_VAL32(&m_RVA);
+ }
+ void SetRVA(ULONG RVA)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_RVA = VAL32(RVA);
+ }
+
+ USHORT GetImplFlags()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ return GET_UNALIGNED_VAL16(&m_ImplFlags);
+ }
+ void SetImplFlags(USHORT ImplFlags)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_ImplFlags = VAL16(ImplFlags);
+ }
+ void AddImplFlags(USHORT ImplFlags)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_ImplFlags |= VAL16(ImplFlags);
+ }
+ void RemoveImplFlags(USHORT ImplFlags)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_ImplFlags &= ~VAL16(ImplFlags);
+ }
+
+
+ USHORT GetFlags()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ return GET_UNALIGNED_VAL16(&m_Flags);
+ }
+ void SetFlags(ULONG Flags)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_Flags = (USHORT)VAL16(Flags);
+ }
+ void AddFlags(ULONG Flags)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_Flags |= (USHORT)VAL16(Flags);
+ }
+ void RemoveFlags(ULONG Flags)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_Flags &= (USHORT)~VAL16(Flags);
+ }
+};
+
+class ParamPtrRec
+{
+public:
+ enum {
+ COL_Param,
+ COL_COUNT,
+ COL_KEY
+ };
+};
+
+class ParamRec
+{
+METADATA_FIELDS_PROTECTION:
+ USHORT m_Flags; // Flags for this Param.
+ USHORT m_Sequence; // Sequence # of param. 0 - return value.
+public:
+ enum {
+ COL_Flags,
+ COL_Sequence,
+
+ COL_Name, // Name of the param.
+ COL_COUNT,
+ COL_KEY
+ };
+
+ void Copy(ParamRec *pFrom)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_Flags = pFrom->m_Flags;
+ m_Sequence = pFrom->m_Sequence;
+ }
+
+ USHORT GetFlags()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ return GET_UNALIGNED_VAL16(&m_Flags);
+ }
+ void SetFlags(ULONG Flags)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_Flags = (USHORT)VAL16(Flags);
+ }
+ void AddFlags(ULONG Flags)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_Flags |= (USHORT)VAL16(Flags);
+ }
+ void RemoveFlags(ULONG Flags)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_Flags &= (USHORT)~VAL16(Flags);
+ }
+
+ USHORT GetSequence()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ return GET_UNALIGNED_VAL16(&m_Sequence);
+ }
+ void SetSequence(USHORT Sequence)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_Sequence = VAL16(Sequence);
+ }
+
+};
+
+class InterfaceImplRec
+{
+public:
+ enum {
+ COL_Class, // Rid of class' TypeDef.
+ COL_Interface, // Coded rid of implemented interface.
+ COL_COUNT,
+ COL_KEY = COL_Class
+ };
+};
+
+class MemberRefRec
+{
+public:
+ enum {
+ COL_Class, // Rid of TypeDef.
+ COL_Name,
+ COL_Signature,
+ COL_COUNT,
+ COL_KEY
+ };
+};
+
+class StandAloneSigRec
+{
+public:
+ enum {
+ COL_Signature,
+ COL_COUNT,
+ COL_KEY
+ };
+};
+
+// Sparse tables. These contain modifiers for tables above.
+class ConstantRec
+{
+METADATA_FIELDS_PROTECTION:
+ BYTE m_Type; // Type of the constant.
+ BYTE m_PAD1;
+public:
+ enum {
+ COL_Type,
+
+ COL_Parent, // Coded rid of object (param, field).
+ COL_Value, // Index into blob pool.
+ COL_COUNT,
+ COL_KEY = COL_Parent
+ };
+ BYTE GetType()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ return m_Type;
+ }
+ void SetType(BYTE Type)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_Type = Type;
+ }
+};
+
+class CustomAttributeRec
+{
+public:
+ enum {
+ COL_Parent, // Coded rid of any object.
+ COL_Type, // TypeDef or TypeRef.
+ COL_Value, // Blob.
+ COL_COUNT,
+ COL_KEY = COL_Parent
+ };
+};
+
+class FieldMarshalRec
+{
+public:
+ enum {
+ COL_Parent, // Coded rid of field or param.
+ COL_NativeType,
+ COL_COUNT,
+ COL_KEY = COL_Parent
+ };
+};
+
+class DeclSecurityRec
+{
+METADATA_FIELDS_PROTECTION:
+ USHORT m_Action;
+public:
+ enum {
+ COL_Action,
+
+ COL_Parent,
+ COL_PermissionSet,
+ COL_COUNT,
+ COL_KEY = COL_Parent
+ };
+
+ void Copy(DeclSecurityRec *pFrom)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_Action = pFrom->m_Action;
+ }
+ USHORT GetAction()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ return GET_UNALIGNED_VAL16(&m_Action);
+ }
+ void SetAction(USHORT Action)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_Action = VAL16(Action);
+ }
+};
+
+
+class ClassLayoutRec
+{
+METADATA_FIELDS_PROTECTION:
+ USHORT m_PackingSize;
+ ULONG m_ClassSize;
+public:
+ enum {
+ COL_PackingSize,
+ COL_ClassSize,
+
+ COL_Parent, // Rid of TypeDef.
+ COL_COUNT,
+ COL_KEY = COL_Parent
+ };
+
+ void Copy(ClassLayoutRec *pFrom)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_PackingSize = pFrom->m_PackingSize;
+ m_ClassSize = pFrom->m_ClassSize;
+ }
+ USHORT GetPackingSize()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ return GET_UNALIGNED_VAL16(&m_PackingSize);
+ }
+ void SetPackingSize(USHORT PackingSize)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_PackingSize = VAL16(PackingSize);
+ }
+
+ ULONG GetClassSize()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ return GET_UNALIGNED_VAL32(&m_ClassSize);
+ }
+ void SetClassSize(ULONG ClassSize)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_ClassSize = VAL32(ClassSize);
+ }
+};
+
+class FieldLayoutRec
+{
+METADATA_FIELDS_PROTECTION:
+ ULONG m_OffSet;
+public:
+ enum {
+ COL_OffSet,
+
+ COL_Field,
+ COL_COUNT,
+ COL_KEY = COL_Field
+ };
+
+ void Copy(FieldLayoutRec *pFrom)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_OffSet = pFrom->m_OffSet;
+ }
+ ULONG GetOffSet()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ return GET_UNALIGNED_VAL32(&m_OffSet);
+ }
+ void SetOffSet(ULONG Offset)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_OffSet = VAL32(Offset);
+ }
+};
+
+class EventMapRec
+{
+public:
+ enum {
+ COL_Parent,
+ COL_EventList, // rid of first event.
+ COL_COUNT,
+ COL_KEY
+ };
+};
+
+class EventPtrRec
+{
+public:
+ enum {
+ COL_Event,
+ COL_COUNT,
+ COL_KEY
+ };
+};
+
+class EventRec
+{
+METADATA_FIELDS_PROTECTION:
+ USHORT m_EventFlags;
+public:
+ enum {
+ COL_EventFlags,
+
+ COL_Name,
+ COL_EventType,
+ COL_COUNT,
+ COL_KEY
+ };
+ USHORT GetEventFlags()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ return GET_UNALIGNED_VAL16(&m_EventFlags);
+ }
+ void SetEventFlags(USHORT EventFlags)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_EventFlags = VAL16(EventFlags);
+ }
+ void AddEventFlags(USHORT EventFlags)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_EventFlags |= VAL16(EventFlags);
+ }
+};
+
+class PropertyMapRec
+{
+public:
+ enum {
+ COL_Parent,
+ COL_PropertyList, // rid of first property.
+ COL_COUNT,
+ COL_KEY
+ };
+};
+
+class PropertyPtrRec
+{
+public:
+ enum {
+ COL_Property,
+ COL_COUNT,
+ COL_KEY
+ };
+};
+
+class PropertyRec
+{
+METADATA_FIELDS_PROTECTION:
+ USHORT m_PropFlags;
+public:
+ enum {
+ COL_PropFlags,
+
+ COL_Name,
+ COL_Type,
+ COL_COUNT,
+ COL_KEY
+ };
+ USHORT GetPropFlags()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ return GET_UNALIGNED_VAL16(&m_PropFlags);
+ }
+ void SetPropFlags(USHORT PropFlags)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_PropFlags = VAL16(PropFlags);
+ }
+ void AddPropFlags(USHORT PropFlags)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_PropFlags |= VAL16(PropFlags);
+ }
+};
+
+class MethodSemanticsRec
+{
+METADATA_FIELDS_PROTECTION:
+ USHORT m_Semantic;
+public:
+ enum {
+ COL_Semantic,
+
+ COL_Method,
+ COL_Association,
+ COL_COUNT,
+ COL_KEY = COL_Association
+ };
+ USHORT GetSemantic()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ return GET_UNALIGNED_VAL16(&m_Semantic);
+ }
+ void SetSemantic(USHORT Semantic)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_Semantic = VAL16(Semantic);
+ }
+};
+
+class MethodImplRec
+{
+public:
+ enum {
+ COL_Class, // TypeDef where the MethodBody lives.
+ COL_MethodBody, // MethodDef or MemberRef.
+ COL_MethodDeclaration, // MethodDef or MemberRef.
+ COL_COUNT,
+ COL_KEY = COL_Class
+ };
+};
+
+class ModuleRefRec
+{
+public:
+ enum {
+ COL_Name,
+ COL_COUNT,
+ COL_KEY
+ };
+};
+
+class TypeSpecRec
+{
+public:
+ enum {
+ COL_Signature,
+ COL_COUNT,
+ COL_KEY
+ };
+};
+
+class ImplMapRec
+{
+METADATA_FIELDS_PROTECTION:
+ USHORT m_MappingFlags;
+public:
+ enum {
+ COL_MappingFlags,
+
+ COL_MemberForwarded, // mdField or mdMethod.
+ COL_ImportName,
+ COL_ImportScope, // mdModuleRef.
+ COL_COUNT,
+ COL_KEY = COL_MemberForwarded
+ };
+ USHORT GetMappingFlags()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ return GET_UNALIGNED_VAL16(&m_MappingFlags);
+ }
+ void SetMappingFlags(USHORT MappingFlags)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_MappingFlags = VAL16(MappingFlags);
+ }
+
+};
+
+class FieldRVARec
+{
+METADATA_FIELDS_PROTECTION:
+ ULONG m_RVA;
+public:
+ enum{
+ COL_RVA,
+
+ COL_Field,
+ COL_COUNT,
+ COL_KEY = COL_Field
+ };
+
+ void Copy(FieldRVARec *pFrom)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_RVA = pFrom->m_RVA;
+ }
+ ULONG GetRVA()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ return GET_UNALIGNED_VAL32(&m_RVA);
+ }
+ void SetRVA(ULONG RVA)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_RVA = VAL32(RVA);
+ }
+};
+
+class ENCLogRec
+{
+METADATA_FIELDS_PROTECTION:
+ ULONG m_Token; // Token, or like a token, but with (ixTbl|0x80) instead of token type.
+ ULONG m_FuncCode; // Function code describing the nature of ENC change.
+public:
+ enum {
+ COL_Token,
+ COL_FuncCode,
+ COL_COUNT,
+ COL_KEY
+ };
+ ULONG GetToken()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ return GET_UNALIGNED_VAL32(&m_Token);
+ }
+ void SetToken(ULONG Token)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_Token = VAL32(Token);
+ }
+
+ ULONG GetFuncCode()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ return GET_UNALIGNED_VAL32(&m_FuncCode);
+ }
+ void SetFuncCode(ULONG FuncCode)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_FuncCode = VAL32(FuncCode);
+ }
+};
+
+class ENCMapRec
+{
+METADATA_FIELDS_PROTECTION:
+ ULONG m_Token; // Token, or like a token, but with (ixTbl|0x80) instead of token type.
+public:
+ enum {
+ COL_Token,
+ COL_COUNT,
+ COL_KEY
+ };
+ ULONG GetToken()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ return GET_UNALIGNED_VAL32(&m_Token);
+ }
+ void SetToken(ULONG Token)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_Token = VAL32(Token);
+ }
+};
+
+// Assembly tables.
+
+class AssemblyRec
+{
+METADATA_FIELDS_PROTECTION:
+ ULONG m_HashAlgId;
+ USHORT m_MajorVersion;
+ USHORT m_MinorVersion;
+ USHORT m_BuildNumber;
+ USHORT m_RevisionNumber;
+ ULONG m_Flags;
+public:
+ enum {
+ COL_HashAlgId,
+ COL_MajorVersion,
+ COL_MinorVersion,
+ COL_BuildNumber,
+ COL_RevisionNumber,
+ COL_Flags,
+
+ COL_PublicKey, // Public key identifying the publisher
+ COL_Name,
+ COL_Locale,
+ COL_COUNT,
+ COL_KEY
+ };
+
+ void Copy(AssemblyRec *pFrom)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_HashAlgId = pFrom->m_HashAlgId;
+ m_MajorVersion = pFrom->m_MajorVersion;
+ m_MinorVersion = pFrom->m_MinorVersion;
+ m_BuildNumber = pFrom->m_BuildNumber;
+ m_RevisionNumber = pFrom->m_RevisionNumber;
+ m_Flags = pFrom->m_Flags;
+ }
+
+ ULONG GetHashAlgId()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ return GET_UNALIGNED_VAL32(&m_HashAlgId);
+ }
+ void SetHashAlgId (ULONG HashAlgId)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_HashAlgId = VAL32(HashAlgId);
+ }
+
+ USHORT GetMajorVersion()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ return GET_UNALIGNED_VAL16(&m_MajorVersion);
+ }
+ void SetMajorVersion (USHORT MajorVersion)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_MajorVersion = VAL16(MajorVersion);
+ }
+
+ USHORT GetMinorVersion()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ return GET_UNALIGNED_VAL16(&m_MinorVersion);
+ }
+ void SetMinorVersion (USHORT MinorVersion)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_MinorVersion = VAL16(MinorVersion);
+ }
+
+ USHORT GetBuildNumber()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ return GET_UNALIGNED_VAL16(&m_BuildNumber);
+ }
+ void SetBuildNumber (USHORT BuildNumber)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_BuildNumber = VAL16(BuildNumber);
+ }
+
+ USHORT GetRevisionNumber()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ return GET_UNALIGNED_VAL16(&m_RevisionNumber);
+ }
+ void SetRevisionNumber (USHORT RevisionNumber)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_RevisionNumber = VAL16(RevisionNumber);
+ }
+
+ ULONG GetFlags()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ return GET_UNALIGNED_VAL32(&m_Flags);
+ }
+ void SetFlags (ULONG Flags)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_Flags = VAL32(Flags);
+ }
+
+};
+
+class AssemblyProcessorRec
+{
+METADATA_FIELDS_PROTECTION:
+ ULONG m_Processor;
+public:
+ enum {
+ COL_Processor,
+
+ COL_COUNT,
+ COL_KEY
+ };
+ ULONG GetProcessor()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ return GET_UNALIGNED_VAL32(&m_Processor);
+ }
+ void SetProcessor(ULONG Processor)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_Processor = VAL32(Processor);
+ }
+};
+
+class AssemblyOSRec
+{
+METADATA_FIELDS_PROTECTION:
+ ULONG m_OSPlatformId;
+ ULONG m_OSMajorVersion;
+ ULONG m_OSMinorVersion;
+public:
+ enum {
+ COL_OSPlatformId,
+ COL_OSMajorVersion,
+ COL_OSMinorVersion,
+
+ COL_COUNT,
+ COL_KEY
+ };
+ ULONG GetOSPlatformId()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ return GET_UNALIGNED_VAL32(&m_OSPlatformId);
+ }
+ void SetOSPlatformId(ULONG OSPlatformId)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_OSPlatformId = VAL32(OSPlatformId);
+ }
+
+ ULONG GetOSMajorVersion()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ return GET_UNALIGNED_VAL32(&m_OSMajorVersion);
+ }
+ void SetOSMajorVersion(ULONG OSMajorVersion)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_OSMajorVersion = VAL32(OSMajorVersion);
+ }
+
+ ULONG GetOSMinorVersion()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ return GET_UNALIGNED_VAL32(&m_OSMinorVersion);
+ }
+ void SetOSMinorVersion(ULONG OSMinorVersion)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_OSMinorVersion = VAL32(OSMinorVersion);
+ }
+
+};
+
+class AssemblyRefRec
+{
+METADATA_FIELDS_PROTECTION:
+ USHORT m_MajorVersion;
+ USHORT m_MinorVersion;
+ USHORT m_BuildNumber;
+ USHORT m_RevisionNumber;
+ ULONG m_Flags;
+public:
+ enum {
+ COL_MajorVersion,
+ COL_MinorVersion,
+ COL_BuildNumber,
+ COL_RevisionNumber,
+ COL_Flags,
+
+ COL_PublicKeyOrToken, // The public key or token identifying the publisher of the Assembly.
+ COL_Name,
+ COL_Locale,
+ COL_HashValue,
+ COL_COUNT,
+ COL_KEY
+ };
+ void Copy(AssemblyRefRec *pFrom)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_MajorVersion = pFrom->m_MajorVersion;
+ m_MinorVersion = pFrom->m_MinorVersion;
+ m_BuildNumber = pFrom->m_BuildNumber;
+ m_RevisionNumber = pFrom->m_RevisionNumber;
+ m_Flags = pFrom->m_Flags;
+ }
+ USHORT GetMajorVersion()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ return GET_UNALIGNED_VAL16(&m_MajorVersion);
+ }
+ void SetMajorVersion(USHORT MajorVersion)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_MajorVersion = VAL16(MajorVersion);
+ }
+
+ USHORT GetMinorVersion()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ return GET_UNALIGNED_VAL16(&m_MinorVersion);
+ }
+ void SetMinorVersion(USHORT MinorVersion)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_MinorVersion = VAL16(MinorVersion);
+ }
+
+ USHORT GetBuildNumber()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ return GET_UNALIGNED_VAL16(&m_BuildNumber);
+ }
+ void SetBuildNumber(USHORT BuildNumber)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_BuildNumber = VAL16(BuildNumber);
+ }
+
+ USHORT GetRevisionNumber()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ return GET_UNALIGNED_VAL16(&m_RevisionNumber);
+ }
+ void SetRevisionNumber(USHORT RevisionNumber)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_RevisionNumber = RevisionNumber;
+ }
+
+ ULONG GetFlags()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ return GET_UNALIGNED_VAL32(&m_Flags);
+ }
+ void SetFlags(ULONG Flags)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_Flags = VAL32(Flags);
+ }
+
+};
+
+class AssemblyRefProcessorRec
+{
+METADATA_FIELDS_PROTECTION:
+ ULONG m_Processor;
+public:
+ enum {
+ COL_Processor,
+
+ COL_AssemblyRef, // mdtAssemblyRef
+ COL_COUNT,
+ COL_KEY
+ };
+ ULONG GetProcessor()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ return GET_UNALIGNED_VAL32(&m_Processor);
+ }
+ void SetProcessor(ULONG Processor)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_Processor = VAL32(Processor);
+ }
+};
+
+class AssemblyRefOSRec
+{
+METADATA_FIELDS_PROTECTION:
+ ULONG m_OSPlatformId;
+ ULONG m_OSMajorVersion;
+ ULONG m_OSMinorVersion;
+public:
+ enum {
+ COL_OSPlatformId,
+ COL_OSMajorVersion,
+ COL_OSMinorVersion,
+
+ COL_AssemblyRef, // mdtAssemblyRef.
+ COL_COUNT,
+ COL_KEY
+ };
+ ULONG GetOSPlatformId()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ return GET_UNALIGNED_VAL32(&m_OSPlatformId);
+ }
+ void SetOSPlatformId(ULONG OSPlatformId)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_OSPlatformId = VAL32(OSPlatformId);
+ }
+
+ ULONG GetOSMajorVersion()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ return GET_UNALIGNED_VAL32(&m_OSMajorVersion);
+ }
+ void SetOSMajorVersion(ULONG OSMajorVersion)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_OSMajorVersion = VAL32(OSMajorVersion);
+ }
+
+ ULONG GetOSMinorVersion()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ return GET_UNALIGNED_VAL32(&m_OSMinorVersion);
+ }
+ void SetOSMinorVersion(ULONG OSMinorVersion)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_OSMinorVersion = VAL32(OSMinorVersion);
+ }
+};
+
+class FileRec
+{
+METADATA_FIELDS_PROTECTION:
+ ULONG m_Flags;
+public:
+ enum {
+ COL_Flags,
+
+ COL_Name,
+ COL_HashValue,
+ COL_COUNT,
+ COL_KEY
+ };
+ void Copy(FileRec *pFrom)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_Flags = pFrom->m_Flags;
+ }
+ ULONG GetFlags()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ return GET_UNALIGNED_VAL32(&m_Flags);
+ }
+ void SetFlags(ULONG Flags)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_Flags = VAL32(Flags);
+ }
+};
+
+class ExportedTypeRec
+{
+METADATA_FIELDS_PROTECTION:
+ ULONG m_Flags;
+ ULONG m_TypeDefId;
+public:
+ enum {
+ COL_Flags,
+ COL_TypeDefId,
+
+ COL_TypeName,
+ COL_TypeNamespace,
+ COL_Implementation, // mdFile or mdAssemblyRef.
+ COL_COUNT,
+ COL_KEY
+ };
+ void Copy(ExportedTypeRec *pFrom)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_Flags = pFrom->m_Flags;
+ m_TypeDefId = pFrom->m_TypeDefId;
+ }
+ ULONG GetFlags()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ return GET_UNALIGNED_VAL32(&m_Flags);
+ }
+ void SetFlags(ULONG Flags)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_Flags = VAL32(Flags);
+ }
+
+ ULONG GetTypeDefId()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ return GET_UNALIGNED_VAL32(&m_TypeDefId);
+ }
+ void SetTypeDefId(ULONG TypeDefId)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_TypeDefId = VAL32(TypeDefId);
+ }
+};
+
+class ManifestResourceRec
+{
+METADATA_FIELDS_PROTECTION:
+ ULONG m_Offset;
+ ULONG m_Flags;
+public:
+ enum {
+ COL_Offset,
+ COL_Flags,
+
+ COL_Name,
+ COL_Implementation, // mdFile or mdAssemblyRef.
+ COL_COUNT,
+ COL_KEY
+ };
+ void Copy(ManifestResourceRec *pFrom)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_Flags = pFrom->m_Flags;
+ m_Offset = pFrom->m_Offset;
+ }
+
+ ULONG GetOffset()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ return GET_UNALIGNED_VAL32(&m_Offset);
+ }
+ void SetOffset(ULONG Offset)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_Offset = VAL32(Offset);
+ }
+
+ ULONG GetFlags()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ return GET_UNALIGNED_VAL32(&m_Flags);
+ }
+ void SetFlags(ULONG Flags)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_Flags = VAL32(Flags);
+ }
+
+};
+
+// End Assembly Tables.
+
+class NestedClassRec
+{
+public:
+ enum {
+ COL_NestedClass,
+ COL_EnclosingClass,
+ COL_COUNT,
+ COL_KEY = COL_NestedClass
+ };
+};
+
+// Generics
+
+
+class GenericParamRec
+{
+METADATA_FIELDS_PROTECTION:
+ USHORT m_Number; // index; zero = first var
+ USHORT m_Flags; // index; zero = first var
+public:
+ enum {
+
+ COL_Number, // index; zero = first var
+ COL_Flags, // flags, for future use
+ COL_Owner, // typeDef/methodDef
+ COL_Name, // Purely descriptive, not used for binding purposes
+ COL_COUNT,
+ COL_KEY = COL_Owner
+ };
+
+ USHORT GetNumber()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ return GET_UNALIGNED_VAL16(&m_Number);
+ }
+ void SetNumber(USHORT Number)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_Number = VAL16(Number);
+ }
+
+ USHORT GetFlags()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ return GET_UNALIGNED_VAL16(&m_Flags);
+ }
+ void SetFlags(USHORT Flags)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_Flags = VAL16(Flags);
+ }
+};
+
+// @todo: this definition is for reading the old (and wrong) GenericParamRec from a
+// Beta1 assembly.
+class GenericParamV1_1Rec
+{
+METADATA_FIELDS_PROTECTION:
+ USHORT m_Number; // index; zero = first var
+ USHORT m_Flags; // index; zero = first var
+public:
+ enum {
+
+ COL_Number, // index; zero = first var
+ COL_Flags, // flags, for future use
+ COL_Owner, // typeDef/methodDef
+ COL_Name, // Purely descriptive, not used for binding purposes
+ COL_Kind, // typeDef/Ref/Spec, reserved for future use
+ COL_COUNT,
+ COL_KEY = COL_Owner
+ };
+
+ USHORT GetNumber()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ return GET_UNALIGNED_VAL16(&m_Number);
+ }
+ void SetNumber(USHORT Number)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_Number = VAL16(Number);
+ }
+
+ USHORT GetFlags()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ return GET_UNALIGNED_VAL16(&m_Flags);
+ }
+ void SetFlags(USHORT Flags)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_Flags = VAL16(Flags);
+ }
+};
+
+class MethodSpecRec
+{
+public:
+ enum {
+ COL_Method, // methodDef/memberRef
+ COL_Instantiation, // signature
+ COL_COUNT,
+ COL_KEY
+ };
+};
+
+
+class GenericParamConstraintRec
+{
+public:
+ enum {
+
+ COL_Owner, // GenericParam
+ COL_Constraint, // typeDef/Ref/Spec
+ COL_COUNT,
+ COL_KEY = COL_Owner
+ };
+};
+
+#include <poppack.h>
+
+// List of MiniMd tables.
+
+#define MiniMdTables() \
+ MiniMdTable(Module) \
+ MiniMdTable(TypeRef) \
+ MiniMdTable(TypeDef) \
+ MiniMdTable(FieldPtr) \
+ MiniMdTable(Field) \
+ MiniMdTable(MethodPtr) \
+ MiniMdTable(Method) \
+ MiniMdTable(ParamPtr) \
+ MiniMdTable(Param) \
+ MiniMdTable(InterfaceImpl) \
+ MiniMdTable(MemberRef) \
+ MiniMdTable(Constant) \
+ MiniMdTable(CustomAttribute)\
+ MiniMdTable(FieldMarshal) \
+ MiniMdTable(DeclSecurity) \
+ MiniMdTable(ClassLayout) \
+ MiniMdTable(FieldLayout) \
+ MiniMdTable(StandAloneSig) \
+ MiniMdTable(EventMap) \
+ MiniMdTable(EventPtr) \
+ MiniMdTable(Event) \
+ MiniMdTable(PropertyMap) \
+ MiniMdTable(PropertyPtr) \
+ MiniMdTable(Property) \
+ MiniMdTable(MethodSemantics)\
+ MiniMdTable(MethodImpl) \
+ MiniMdTable(ModuleRef) \
+ MiniMdTable(TypeSpec) \
+ MiniMdTable(ImplMap) \
+ MiniMdTable(FieldRVA) \
+ MiniMdTable(ENCLog) \
+ MiniMdTable(ENCMap) \
+ MiniMdTable(Assembly) \
+ MiniMdTable(AssemblyProcessor) \
+ MiniMdTable(AssemblyOS) \
+ MiniMdTable(AssemblyRef) \
+ MiniMdTable(AssemblyRefProcessor) \
+ MiniMdTable(AssemblyRefOS) \
+ MiniMdTable(File) \
+ MiniMdTable(ExportedType) \
+ MiniMdTable(ManifestResource) \
+ MiniMdTable(NestedClass) \
+ MiniMdTable(GenericParam) \
+ MiniMdTable(MethodSpec) \
+ MiniMdTable(GenericParamConstraint) \
+
+#undef MiniMdTable
+#define MiniMdTable(x) TBL_##x,
+enum {
+ MiniMdTables()
+ TBL_COUNT, // Highest table.
+ TBL_COUNT_V1 = TBL_NestedClass + 1, // Highest table in v1.0 database
+ TBL_COUNT_V2 = TBL_GenericParamConstraint + 1 // Highest in v2.0 database
+};
+#undef MiniMdTable
+
+// List of MiniMd coded token types.
+#define MiniMdCodedTokens() \
+ MiniMdCodedToken(TypeDefOrRef) \
+ MiniMdCodedToken(HasConstant) \
+ MiniMdCodedToken(HasCustomAttribute) \
+ MiniMdCodedToken(HasFieldMarshal) \
+ MiniMdCodedToken(HasDeclSecurity) \
+ MiniMdCodedToken(MemberRefParent) \
+ MiniMdCodedToken(HasSemantic) \
+ MiniMdCodedToken(MethodDefOrRef) \
+ MiniMdCodedToken(MemberForwarded) \
+ MiniMdCodedToken(Implementation) \
+ MiniMdCodedToken(CustomAttributeType) \
+ MiniMdCodedToken(ResolutionScope) \
+ MiniMdCodedToken(TypeOrMethodDef) \
+
+#undef MiniMdCodedToken
+#define MiniMdCodedToken(x) CDTKN_##x,
+enum {
+ MiniMdCodedTokens()
+ CDTKN_COUNT
+};
+#undef MiniMdCodedToken
+
+//*****************************************************************************
+// Meta-meta data. Constant across all MiniMds.
+//*****************************************************************************
+#ifndef _META_DATA_META_CONSTANTS_DEFINED
+#define _META_DATA_META_CONSTANTS_DEFINED
+const unsigned int iRidMax = 63;
+const unsigned int iCodedToken = 64; // base of coded tokens.
+const unsigned int iCodedTokenMax = 95;
+const unsigned int iSHORT = 96; // fixed types.
+const unsigned int iUSHORT = 97;
+const unsigned int iLONG = 98;
+const unsigned int iULONG = 99;
+const unsigned int iBYTE = 100;
+const unsigned int iSTRING = 101; // pool types.
+const unsigned int iGUID = 102;
+const unsigned int iBLOB = 103;
+
+inline int IsRidType(ULONG ix) {LIMITED_METHOD_CONTRACT; return ix <= iRidMax; }
+inline int IsCodedTokenType(ULONG ix) {LIMITED_METHOD_CONTRACT; return (ix >= iCodedToken) && (ix <= iCodedTokenMax); }
+inline int IsRidOrToken(ULONG ix) {LIMITED_METHOD_CONTRACT; return ix <= iCodedTokenMax; }
+inline int IsHeapType(ULONG ix) {LIMITED_METHOD_CONTRACT; return ix >= iSTRING; }
+inline int IsFixedType(ULONG ix) {LIMITED_METHOD_CONTRACT; return (ix < iSTRING) && (ix > iCodedTokenMax); }
+#endif
+
+
+enum MDPools {
+ MDPoolStrings, // Id for the string pool.
+ MDPoolGuids, // ...the GUID pool.
+ MDPoolBlobs, // ...the blob pool.
+ MDPoolUSBlobs, // ...the user string pool.
+
+ MDPoolCount, // Count of pools, for array sizing.
+}; // enum MDPools
+
+
+struct CCodedTokenDef
+{
+ ULONG m_cTokens; // Count of tokens.
+ const mdToken *m_pTokens; // Array of tokens.
+ const char *m_pName; // Name of the coded-token type.
+};
+
+struct CMiniColDef
+{
+ BYTE m_Type; // Type of the column.
+ BYTE m_oColumn; // Offset of the column.
+ BYTE m_cbColumn; // Size of the column.
+};
+
+struct CMiniTableDef
+{
+ CMiniColDef *m_pColDefs; // Array of field defs.
+ BYTE m_cCols; // Count of columns in the table.
+ BYTE m_iKey; // Column which is the key, if any.
+ USHORT m_cbRec; // Size of the records.
+};
+struct CMiniTableDefEx
+{
+ CMiniTableDef m_Def; // Table definition.
+ const char * const *m_pColNames; // Array of column names.
+ const char *m_pName; // Name of the table.
+};
+
+#endif // _METAMODELPUB_H_
+// eof ------------------------------------------------------------------------
diff --git a/src/inc/mpl/type_list b/src/inc/mpl/type_list
new file mode 100644
index 0000000000..9073c5e8d0
--- /dev/null
+++ b/src/inc/mpl/type_list
@@ -0,0 +1,76 @@
+// 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.
+
+//
+// Used in template metaprogramming, type lists consist of a series of
+// Scheme-like nodes that contain a Head type and a Tail type. The head
+// type is usually a non-list type, but compound lists are possible.
+//
+// Type lists are always terminated with a tail type of mpl::null_type.
+//
+
+#ifndef __type_list__
+#define __type_list__
+
+namespace mpl // 'mpl' => 'meta-programming library'
+{
+ // Used as terminator in type_lists.
+ class null_type {};
+
+ // The core type. See file comment for details.
+ template <class T, class U>
+ struct type_list
+ {
+ typedef T head;
+ typedef U tail;
+ };
+
+ template <class TList, size_t IDX>
+ struct type_at;
+
+ template <class head, class tail, size_t IDX>
+ struct type_at<type_list<head, tail>, IDX>
+ { typedef typename type_at<tail, IDX-1>::type type; };
+
+ template <class head, class tail>
+ struct type_at<type_list<head, tail>, 0>
+ { typedef head type; };
+
+ // Helper struct to create a type_list chain from a list of arguments.
+ template
+ <
+ typename T1 = null_type, typename T2 = null_type, typename T3 = null_type,
+ typename T4 = null_type, typename T5 = null_type, typename T6 = null_type,
+ typename T7 = null_type, typename T8 = null_type, typename T9 = null_type,
+ typename T10 = null_type, typename T11 = null_type, typename T12 = null_type,
+ typename T13 = null_type, typename T14 = null_type, typename T15 = null_type,
+ typename T16 = null_type, typename T17 = null_type, typename T18 = null_type
+ >
+ struct make_type_list
+ {
+ private:
+ // recurse on the tail elements
+ typedef typename make_type_list<T2, T3, T4, T5, T6, T7, T8, T9, T10,
+ T11, T12, T13, T14, T15, T16, T17, T18>::type tail;
+
+ public:
+ // combine head with computed tail
+ typedef type_list<T1, tail> type;
+ };
+
+ template<>
+ struct make_type_list
+ <
+ null_type, null_type, null_type, null_type, null_type, null_type,
+ null_type, null_type, null_type, null_type, null_type, null_type,
+ null_type, null_type, null_type, null_type, null_type, null_type
+ >
+ {
+ public:
+ typedef null_type type;
+ };
+}
+
+#endif // __type_list__
+
diff --git a/src/inc/mscorcfg.h b/src/inc/mscorcfg.h
new file mode 100644
index 0000000000..c90cfe8b0a
--- /dev/null
+++ b/src/inc/mscorcfg.h
@@ -0,0 +1,34 @@
+// 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.
+
+/*****************************************************************************
+ ** **
+ ** Cor.h - general header for the Runtime. **
+ ** **
+ *****************************************************************************/
+
+
+#ifndef _MSCORCFG_H_
+#define _MSCORCFG_H_
+#include <ole2.h> // Definitions of OLE types.
+#include <xmlparser.h>
+#include <specstrings.h>
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+// -----------------------------------------------------------------------
+// Returns an XMLParsr object. This can be used to parse any XML file.
+STDAPI GetXMLElementAttribute(LPCWSTR pwszAttributeName, __out_ecount(cchBuffer) LPWSTR pbuffer, DWORD cchBuffer, DWORD* dwLen);
+STDAPI GetXMLElement(LPCWSTR wszFileName, LPCWSTR pwszTag);
+
+STDAPI GetXMLObject(IXMLParser **ppv);
+STDAPI CreateConfigStream(LPCWSTR pszFileName, IStream** ppStream);
+
+#ifdef __cplusplus
+}
+#endif // __cplusplus
+
+#endif
diff --git a/src/inc/mscoree_mktlb.rc b/src/inc/mscoree_mktlb.rc
new file mode 100644
index 0000000000..e46fef6f5a
--- /dev/null
+++ b/src/inc/mscoree_mktlb.rc
@@ -0,0 +1,12 @@
+// 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.
+
+#define FX_VER_FILEDESCRIPTION_STR "Microsoft .NET Runtime CLR Loading and Configuration Interfaces\0"
+#define FX_VER_INTERNALNAME_STR MSCOREE.DLL
+#define FX_VFT VFT_DLL
+
+#include <fxver.h>
+#include <fxver.rc>
+
+1 typelib REAL_TLB_FILE
diff --git a/src/inc/mscoree_tlb.idl b/src/inc/mscoree_tlb.idl
new file mode 100644
index 0000000000..838e2cc34e
--- /dev/null
+++ b/src/inc/mscoree_tlb.idl
@@ -0,0 +1,15 @@
+// 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.
+
+
+/**************************************************************************************
+ ** **
+ ** Mscoree_tlb.idl - mscoree.idl + internal intefaces from mscorsvc.dll **
+ ** Used for making mscoree.tlb **
+ ** **
+ **************************************************************************************/
+
+#define INCLUDE_SVC_IDL
+#include "mscoree.idl"
+
diff --git a/src/inc/mscoreepriv.h b/src/inc/mscoreepriv.h
new file mode 100644
index 0000000000..df07612010
--- /dev/null
+++ b/src/inc/mscoreepriv.h
@@ -0,0 +1,21 @@
+// 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.
+//
+
+#ifndef __MSCOREEPRIV_H__
+#define __MSCOREEPRIV_H__
+
+
+typedef enum
+{
+ RUNTIME_INFO_CONSIDER_POST_2_0 = 0x80, // consider v4.0+ versions
+ RUNTIME_INFO_EMULATE_EXE_LAUNCH = 0x100, // Binds as if the provided information were being use in a new process
+ RUNTIME_INFO_APPEND_FORCE_PERFORMANCE_COUNTER_UNIQUE_SHARED_MEMORY_READS_SETTING_TO_VERSION // appends either !0 (false), !1 (true) or !2 (unset) depending on the value of forcePerformanceCounterUniqueSharedMemoryReads in the runtime section of the config
+ = 0x200,
+} RUNTIME_INFO_FLAGS_FOR_SHARED_COMPONENTS;
+
+
+
+#endif //__MSCOREEPRIV_H__
+
diff --git a/src/inc/mscorpesxswrapper.h b/src/inc/mscorpesxswrapper.h
new file mode 100644
index 0000000000..52656f6711
--- /dev/null
+++ b/src/inc/mscorpesxswrapper.h
@@ -0,0 +1,125 @@
+// 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.
+//
+// File: MscorpeSxSWrapper.h
+//
+
+//
+// This file defines a wrapper for SxS version of mscorpe.dll (dynamically loaded via shim).
+//
+
+#pragma once
+
+#include "utilcode.h"
+
+#include "iceefilegen.h"
+
+//
+// Wrapper for calls into mscorpehost.dll (SxS version of mscorpe.dll).
+// Template parameter will load the DLL as it is required in the context.
+//
+// Note that _LoadMscorpeDll method can be called more than once and in parallel from more threads if race
+// happens.
+//
+template <HRESULT (* _LoadMscorpeDll)(HMODULE * phModule)>
+class MscorpeSxSWrapper
+{
+private:
+ // mscorpehost.dll module, if not NULL, entry points are already initialized
+ static Volatile<HMODULE> s_hModule;
+ // mscorpehost.dll entry points
+ static Volatile<PFN_CreateICeeFileGen> s_pfnCreateICeeFileGen;
+ static Volatile<PFN_DestroyICeeFileGen> s_pfnDestroyICeeFileGen;
+
+ // Loads the DLL and sets all statics
+ static HRESULT Init();
+
+public:
+
+ // Wrapper of file:ICeeFileGen.cpp#CreateICeeFileGen from mscorpehost.dll
+ static HRESULT CreateICeeFileGen(ICeeFileGen ** ppCeeFileGen)
+ {
+ HRESULT hr = S_OK;
+ IfFailGo(Init());
+ hr = s_pfnCreateICeeFileGen(ppCeeFileGen);
+ ErrExit:
+ return hr;
+ }
+
+ // Wrapper of file:ICeeFileGen.cpp#DestroyICeeFileGen from mscorpehost.dll
+ static HRESULT DestroyICeeFileGen(ICeeFileGen ** ppCeeFileGen)
+ {
+ HRESULT hr = S_OK;
+ IfFailGo(Init());
+ hr = s_pfnDestroyICeeFileGen(ppCeeFileGen);
+ ErrExit:
+ return hr;
+ }
+
+#ifdef _DEBUG
+ // Returns TRUE if the DLL has been already loaded
+ static BOOL Debug_IsLoaded()
+ {
+ return (s_hModule != (HMODULE)NULL);
+ }
+#endif //_DEBUG
+}; // class MscorpeSxS
+
+template <HRESULT (* _LoadMscorpeDll)(HMODULE * phModule)>
+// code:MscorpeSxS statics initialization
+Volatile<HMODULE> MscorpeSxSWrapper<_LoadMscorpeDll>::s_hModule = NULL;
+
+template <HRESULT (* _LoadMscorpeDll)(HMODULE * phModule)>
+Volatile<PFN_CreateICeeFileGen> MscorpeSxSWrapper<_LoadMscorpeDll>::s_pfnCreateICeeFileGen = NULL;
+
+template <HRESULT (* _LoadMscorpeDll)(HMODULE * phModule)>
+Volatile<PFN_DestroyICeeFileGen> MscorpeSxSWrapper<_LoadMscorpeDll>::s_pfnDestroyICeeFileGen = NULL;
+
+// Loads the DLL and sets all statics
+//static
+template <HRESULT (* _LoadMscorpeDll)(HMODULE * phModule)>
+HRESULT
+MscorpeSxSWrapper<_LoadMscorpeDll>::Init()
+{
+ HRESULT hr = S_OK;
+
+ if (s_hModule != (HMODULE)NULL)
+ {
+ return S_OK;
+ }
+
+ // Local mscorpehost.dll module
+ HMODULE hModule = NULL;
+ // Local mscorpehost.dll entry points
+ PFN_CreateICeeFileGen pfnCreateICeeFileGen = NULL;
+ PFN_DestroyICeeFileGen pfnDestroyICeeFileGen = NULL;
+
+ // Load mscorpehost.dll and initialize it
+ IfFailGo(_LoadMscorpeDll(&hModule));
+ _ASSERTE(hModule != NULL);
+
+ pfnCreateICeeFileGen = (PFN_CreateICeeFileGen)GetProcAddress(hModule, "CreateICeeFileGen");
+ if (pfnCreateICeeFileGen == NULL)
+ {
+ IfFailGo(COR_E_EXECUTIONENGINE);
+ }
+
+ pfnDestroyICeeFileGen = (PFN_DestroyICeeFileGen)GetProcAddress(hModule, "DestroyICeeFileGen");
+ if (pfnDestroyICeeFileGen == NULL)
+ {
+ IfFailGo(COR_E_EXECUTIONENGINE);
+ }
+
+ErrExit:
+ if (SUCCEEDED(hr))
+ {
+ // First publish mscorpehost.dll entry points
+ s_pfnCreateICeeFileGen = pfnCreateICeeFileGen;
+ s_pfnDestroyICeeFileGen = pfnDestroyICeeFileGen;
+ // Then we can publish/initialize the mscorpehost.dll module
+ s_hModule = hModule;
+ }
+
+ return hr;
+} // MscorpeSxSWrapper::Init
diff --git a/src/inc/mscorsvc.idl b/src/inc/mscorsvc.idl
new file mode 100644
index 0000000000..48eada4f6f
--- /dev/null
+++ b/src/inc/mscorsvc.idl
@@ -0,0 +1,683 @@
+// 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.
+/* -------------------------------------------------------------------------- *
+ * Microsoft .Net Framework Service
+ * -------------------------------------------------------------------------- */
+
+#ifndef IN_MSCOREE
+cpp_quote("#if 0") // So that the outputted header file doesn't cause redefines
+
+import "unknwn.idl";
+
+cpp_quote("#endif")
+
+// CLSID_CorSvcWorker
+cpp_quote("EXTERN_GUID(CLSID_CorSvcWorker, 0x8ed1a844, 0x32a7, 0x4a67, 0xba, 0x62, 0xf8, 0xd5, 0xaf, 0xdf, 0xf4, 0x60);")
+
+// CLSID_CorSvcBindToWorker
+cpp_quote("EXTERN_GUID(CLSID_CorSvcBindToWorker, 0x9f74fb09, 0x4221, 0x40b4, 0xae, 0x21, 0xae, 0xb6, 0xdf, 0xf2, 0x99, 0x4e);")
+
+#pragma midl_echo("STDAPI CorGetSvc(IUnknown **pIUnknown);")
+
+[
+ uuid(d69cca64-16f7-485c-8cf1-67063e44f0c3),
+ version(2.0),
+ helpstring("Common Language Runtime Execution Engine 2.0 Library")
+]
+library mscorsvc
+{
+ importlib("stdole32.tlb");
+
+#endif // IN_MSCOREE
+
+
+ //*****************************************************************************
+ // ICorSvcDependencies is used to enumerate the dependencies of an
+ // IL image. It is used by the native image service.
+ //*****************************************************************************[
+
+ [
+ object,
+ oleautomation,
+ uuid(ddb34005-9ba3-4025-9554-f00a2df5dbf5),
+ pointer_default(unique),
+ ]
+ interface ICorSvcDependencies : IUnknown
+ {
+ HRESULT GetAssemblyDependencies(
+ [in] BSTR pAssemblyName,
+ [out] SAFEARRAY(BSTR) *pDependencies,
+ [out] DWORD *assemblyNGenSetting,
+ [out] BSTR *pNativeImageIdentity,
+ [out] BSTR *pAssemblyDisplayName,
+ [out] SAFEARRAY(DWORD) *pDependencyLoadSetting,
+ [out] SAFEARRAY(DWORD) *pDependencyNGenSetting
+ );
+ }
+
+ //*****************************************************************************
+ // ICorSvcWorker contains methods for generating native images and enumerating
+ // their dependencies.
+ //*****************************************************************************[
+
+ typedef enum
+ {
+ ScenarioDefault = 0x00000000, // No special scenario flags
+ ScenarioAll = 0x00000001, // All scenarios (used to indicate all configurations)
+ ScenarioDebug = 0x00000002, // Unoptimized debuggable code
+ ScenarioProfile = 0x00000008, // Used for profiling (enter/leave notifications)
+ ScenarioTuningDataCollection = 0x00000010, // Used to gather IBC data
+ ScenarioLegacy = 0x00000020, // Follow hard dependencies only
+
+ ScenarioNgenLastRetry = 0x00010000, // Ngen failed last time and this a final retry
+ ScenarioAutoNGen = 0x00100000, // This is an Auto NGen request
+ ScenarioRepositoryOnly = 0x00200000, // Install from repository only, no real NGen
+ } OptimizationScenario;
+
+ typedef enum
+ {
+ ScenarioEmitFixups = 0x00010000, // Emit fixups for Vulcan
+ ScenarioProfileInfo = 0x00020000 // Generate a PE section with profile ranges data
+ } PrivateOptimizationScenario;
+
+ typedef struct _SvcWorkerPriority
+ {
+ DWORD dwPriorityClass;
+ } SvcWorkerPriority;
+
+ [
+ object,
+ oleautomation,
+ uuid(d1047bc2-67c0-400c-a94c-e64446a67fbe),
+ pointer_default(unique),
+ ]
+ interface ICorSvcWorker : IUnknown
+ {
+ HRESULT SetPriority(
+ [in] SvcWorkerPriority priority
+ );
+
+ HRESULT OptimizeAssembly(
+ [in] BSTR pAssemblyName,
+ [in] BSTR pApplicationName,
+ [in] OptimizationScenario scenario,
+ [in] SAFEARRAY(BSTR) loadAlwaysList,
+ [in] SAFEARRAY(BSTR) loadSometimesList,
+ [in] SAFEARRAY(BSTR) loadNeverList,
+ [out] BSTR *pNativeImageIdentity
+ );
+
+ HRESULT DeleteNativeImage(
+ [in] BSTR pAssemblyName,
+ [in] BSTR pNativeImage
+ );
+
+ HRESULT DisplayNativeImages(
+ [in] BSTR pAssemblyName
+ );
+
+ HRESULT GetCorSvcDependencies(
+ [in] BSTR pApplicationName,
+ [in] OptimizationScenario scenario,
+ [out] ICorSvcDependencies **pCorSvcDependencies
+ );
+
+ HRESULT Stop(
+ );
+ }
+
+ [
+ object,
+ oleautomation,
+ uuid(f3358a7d-0061-4776-880e-a2f21b9ef93e),
+ pointer_default(unique),
+ ]
+ interface ICorSvcWorker2 : ICorSvcWorker {
+ // Create a PDB for the NGEN image that was generated for pAssemblyName
+ // when compiled with the given appbase and scenario.
+ HRESULT CreatePdb([in] BSTR pAssemblyName,
+ [in] BSTR pAppBaseOrConfig,
+ [in] OptimizationScenario scenario,
+ [in] BSTR pNativeImagePath,
+ [in] BSTR pPdbPath);
+ };
+
+ [
+ object,
+ oleautomation,
+ uuid(DC516615-47BE-477e-8B55-C5ABE0D76B8F),
+ pointer_default(unique),
+ ]
+ interface ICorSvcWorker3 : ICorSvcWorker2 {
+ // Create a PDB for the NGEN image that was generated for pAssemblyName
+ // when compiled with the given appbase and scenario. Optionally include
+ // source lines information in the geneated PDB
+ HRESULT CreatePdb2([in] BSTR pAssemblyName,
+ [in] BSTR pAppBaseOrConfig,
+ [in] OptimizationScenario scenario,
+ [in] BSTR pNativeImagePath,
+ [in] BSTR pPdbPath,
+ [in] BOOL pdbLines,
+ [in] BSTR managedPdbSearchPath);
+ };
+
+ //*****************************************************************************
+ // ICorSvcSetPrivateAttributes sets private attributes that are used just for
+ // the initial compilation
+ //*****************************************************************************[
+
+ typedef enum
+ {
+ DbgTypePdb = 0x00000001, // Generate a pdb for the NGen image
+ } NGenPrivateAttributesFlags;
+
+ typedef struct _NGenPrivateAttributes
+ {
+ DWORD Flags;
+ DWORD ZapStats;
+ BSTR DbgDir;
+ } NGenPrivateAttributes;
+
+ [
+ object,
+ oleautomation,
+ uuid(b18e0b40-c089-4350-8328-066c668bccc2),
+ pointer_default(unique),
+ ]
+ interface ICorSvcSetPrivateAttributes : IUnknown
+ {
+ HRESULT SetNGenPrivateAttributes(
+ [in] NGenPrivateAttributes ngenPrivateAttributes
+ );
+
+ }
+
+ //*****************************************************************************
+ // ICorSvcRepository controls native images repository
+ //*****************************************************************************[
+
+ typedef enum
+ {
+ RepositoryDefault = 0x0, // default settings
+ MoveFromRepository = 0x1, // move the native images from repository
+ CopyToRepository = 0x2, // copy the generated native images to repository
+ IgnoreRepository = 0x4, // Do not use the repository
+ } RepositoryFlags;
+
+ [
+ object,
+ oleautomation,
+ uuid(d5346658-b5fd-4353-9647-07ad4783d5a0),
+ pointer_default(unique),
+ ]
+ interface ICorSvcRepository : IUnknown
+ {
+ HRESULT SetRepository(
+ [in] BSTR pRepositoryDir,
+ [in] RepositoryFlags repositoryFlags
+ );
+
+ }
+
+#ifdef FEATURE_APPX
+ //*****************************************************************************
+ // ICorSvcAppX contains AppX-related method
+ //*****************************************************************************[
+
+ [
+ object,
+ uuid(5c814791-559e-4f7f-83ce-184a4ccbae24),
+ pointer_default(unique),
+ ]
+ interface ICorSvcAppX : IUnknown
+ {
+ HRESULT SetPackage([in] BSTR pPackageFullName);
+
+ HRESULT SetLocalAppDataDirectory([in] BSTR pLocalAppDataDirectory);
+ }
+#endif
+
+ //*****************************************************************************
+ // ICorSvcLogger is used to log various messages to the service process
+ //*****************************************************************************[
+
+ typedef enum CorSvcLogLevel
+ {
+ LogLevel_Error,
+ LogLevel_Warning,
+ LogLevel_Success,
+ LogLevel_Info
+ } CorSvcLogLevel;
+
+ [
+ object,
+ oleautomation,
+ uuid(d189ff1a-e266-4f13-9637-4b9522279ffc),
+ pointer_default(unique),
+ ]
+ interface ICorSvcLogger : IUnknown
+ {
+ HRESULT Log(
+ [in] CorSvcLogLevel logLevel,
+ [in] BSTR message
+ );
+ }
+
+ //*****************************************************************************
+ // ICorSvcPooledWorker is used to determine whether a worker process can be
+ // reused
+ //*****************************************************************************[
+
+ [
+ object,
+ oleautomation,
+ uuid(0631e7e2-6046-4fde-8b6d-a09b64fda6f3),
+ pointer_default(unique),
+ ]
+ interface ICorSvcPooledWorker : IUnknown
+ {
+ HRESULT CanReuseProcess(
+ [in] OptimizationScenario scenario,
+ [in] ICorSvcLogger *pCorSvcLogger,
+ [out] BOOL *pCanContinue
+ );
+ }
+
+
+ //*****************************************************************************
+ // ICorSvcBindToWorker is used to bind to a specific runtime version.
+ //*****************************************************************************[
+
+
+ [
+ object,
+ oleautomation,
+ uuid(5c6fb596-4828-4ed5-b9dd-293dad736fb5),
+ pointer_default(unique),
+ ]
+ interface ICorSvcBindToWorker : IUnknown
+ {
+ HRESULT BindToRuntimeWorker(
+ [in] BSTR pRuntimeVersion,
+ [in] DWORD ParentProcessID,
+ [in] BSTR pInterruptEventName,
+ [in] ICorSvcLogger *pCorSvcLogger,
+ [out] ICorSvcWorker **pCorSvcWorker
+ );
+ }
+
+#ifndef IN_MSCOREE
+}
+
+typedef enum
+{
+ Service_NoAction = -1 ,
+ Service_Start = 0x0, // start service
+ Service_Stop = 0x1, // Stop service
+ Service_Pause = 0x2, // pause service
+ Service_Continue = 0x3, // continue a paused service
+ Service_Interrogate = 0x4, // continue a paused service
+ Service_StartPaused = 0x5, // pause service. start and pause if it's stopped
+} ControlServiceAction;
+
+// Haven't seen a better way of doing this. Everybody seems to be duplicating
+// into IDLs (for example wtypes.idl)
+typedef struct _COR_SERVICE_STATUS
+{
+ WCHAR sServiceName[64];
+ DWORD dwServiceType;
+ DWORD dwCurrentState;
+ DWORD dwControlsAccepted;
+ DWORD dwWin32ExitCode;
+ DWORD dwServiceSpecificExitCode;
+ DWORD dwCheckPoint;
+ DWORD dwWaitHint;
+} COR_SERVICE_STATUS, *LPCOR_SERVICE_STATUS;
+
+/* -------------------------------------------------------------------------- *
+ * ICorSvc is implemented by the service dispatcher and contains APIs
+ * for installing/uninstalling/starting/stopping the native image service,
+ * as well as marshaling logic that provides the ICorOptSvcManager interface.
+ * -------------------------------------------------------------------------- */
+typedef struct _ServiceOptions
+{
+ BOOL RunAsWindowsService;
+ BOOL RunAsPrivateRuntime;
+ BOOL StartPaused;
+} ServiceOptions;
+
+
+[
+ object,
+ uuid(3eef5ff0-3680-4f20-8a8f-9051aca66b22),
+ pointer_default(unique),
+]
+interface ICorSvc : IUnknown
+{
+ HRESULT GetServiceManagerInterface(
+ [in] IUnknown **pIUnknown
+ );
+
+ HRESULT InstallService(
+ );
+
+ HRESULT UninstallService(
+ );
+
+ HRESULT ControlService(
+ [in] ControlServiceAction Action,
+ [out] LPCOR_SERVICE_STATUS lpServiceStatus
+ );
+
+ HRESULT RunService(
+ [in] ServiceOptions options
+ );
+}
+
+[
+ object,
+ uuid(01c10030-6c81-4671-bd51-14b184c673b2),
+ pointer_default(unique),
+]
+interface ICompileProgressNotification : IUnknown
+{
+ // Notify the installer that compilation has started, and give it an
+ // estimation of how long it will take.
+ HRESULT CompileStarted(
+ [in] DWORD cAssembliesToCompile,
+ [in] DWORD cTimeEstimate
+ );
+
+ // Notify the installer that one more assembly has been compiled. The
+ // installer can return E_ABORT from ProgressNotification if it wants to
+ // abort the compilation.
+ HRESULT ProgressNotification(
+ [in] DWORD cAssembly,
+ [in] BSTR pAssemblyName,
+ [in] BOOL isStartNotification, // if TRUE: we're starting to compile, if FALSE, we finished
+ [in] HRESULT hrResult,
+ [in] BSTR errorExplanation,
+ [in] DWORD cTimeRemainingEstimate
+ );
+
+
+}
+
+/*
+ * Ndp v4 interface that provides a threadID in notification messages
+ */
+[
+ object,
+ uuid(98E5BDE2-E9A0-4ADE-9CB2-6CD06FDB1A85),
+ pointer_default(unique),
+]
+interface ICompileProgressNotification2 : IUnknown
+{
+ // Notify the installer that compilation has started, and give it an
+ // estimation of how long it will take.
+ HRESULT CompileStarted(
+ [in] DWORD cAssembliesToCompile,
+ [in] DWORD cTimeEstimate,
+ [in] DWORD threadID
+ );
+
+ // Notify the installer that one more assembly has been compiled. The
+ // installer can return E_ABORT from ProgressNotification if it wants to
+ // abort the compilation.
+ HRESULT ProgressNotification(
+ [in] DWORD cAssembly,
+ [in] BSTR pAssemblyName,
+ [in] BOOL isStartNotification, // if TRUE: we're starting to compile, if FALSE, we finished
+ [in] HRESULT hrResult,
+ [in] BSTR errorExplanation,
+ [in] DWORD cTimeRemainingEstimate,
+ [in] DWORD threadID
+ );
+
+
+}
+
+typedef enum
+{
+ DefaultOptimizeFlags = 0x0, // default settings
+ TolerateCompilationFailures = 0x1, // continue after encoutering compilation failures
+ OptimizeNGenQueueOnly = 0x2 // only take work items from the NGen Queue
+} OptimizeFlags;
+
+
+[
+ object,
+ uuid(0523feee-eb0e-4857-b2aa-db787521d077),
+ pointer_default(unique),
+]
+interface ICorSvcInstaller : IUnknown
+{
+ HRESULT Install(
+ [in] BSTR path
+ );
+
+ HRESULT Uninstall(
+ [in] BSTR path
+ );
+
+ HRESULT Optimize(
+ [in] ICompileProgressNotification *pCompileProgressNotification,
+ [in] OptimizeFlags optimizeFlags
+ );
+
+ HRESULT SetLogger(
+ [in] ICorSvcLogger *pCorSvcLogger
+ );
+}
+
+typedef enum
+{
+ DefaultFlags = 0x0, // default settings
+ AllowPartialNames = 0x1, // input path allows partial names
+ KeepPriority = 0x2, // keep priority after ngen completes
+ NoRoot = 0x4, // Do not persist NGen root (automatically initiated NGen)
+} GeneralFlags;
+
+typedef enum
+{
+ Priority_None = -1,
+ Priority_0 = 0x0, // NGen offline queue. Do not use for anything else
+ Priority_1 = 0x1,
+ Priority_2 = 0x2,
+ Priority_3 = 0x3, // If you add or remove priorities, update Priority_Lowest
+
+ Priority_Default = Priority_3,
+ Priority_Lowest = Priority_3,
+ Priority_LowestAggressive = Priority_2, // The lowest priority for which assemblies are compiled aggressively
+ Priority_Highest = Priority_0,
+ Priority_Highest_Root = Priority_1,
+ Priority_Lowest_Root = Priority_3
+} PriorityLevel;
+
+
+/* -------------------------------------------------------------------------- *
+ * ICorSvcAdvancedInstaller is implemented by the service manager and
+ * used by installers with custom install requirements
+ * such as special scenarios or hosting requirements).
+ * -------------------------------------------------------------------------- */
+
+[
+ object,
+ uuid(0871fb80-3ea0-47cc-9b51-d92e2aee75db),
+ pointer_default(unique),
+]
+interface ICorSvcAdvancedInstaller : IUnknown
+{
+ HRESULT Install(
+ [in] BSTR path,
+ [in] OptimizationScenario optScenario,
+ [in] BSTR config,
+ [in] GeneralFlags generalFlags,
+ [in] PriorityLevel priorityLevel
+ );
+
+ HRESULT Uninstall(
+ [in] BSTR path,
+ [in] OptimizationScenario optScenario,
+ [in] BSTR config,
+ [in] GeneralFlags generalFlags
+ );
+}
+
+
+/* -------------------------------------------------------------------------- *
+ * ICorSvcOptimizer is implemented by the service manager and is called
+ * by installers and other tools to repair the native image caches.
+ * -------------------------------------------------------------------------- */
+
+typedef enum
+{
+ UpdateDefault = 0x0, // no hints about the scope of the update
+ Force = 0x1, // force generation of new native images
+ PostReboot = 0x2 // Update must happen after reboot
+} UpdateFlags;
+
+
+[
+ object,
+ uuid(94af0ec4-c10d-45d4-a625-d68d1b02a396),
+ pointer_default(unique),
+]
+interface ICorSvcOptimizer : IUnknown
+{
+ // Optimize the native image for a given application or assembly (will regenerate
+ // native images that are out of date)
+ HRESULT Update(
+ [in] BSTR path,
+ [in] UpdateFlags updateFlags,
+ [in] GeneralFlags generalFlags
+ );
+
+ HRESULT Display(
+ [in] BSTR path,
+ [in] GeneralFlags generalFlags
+ );
+
+ HRESULT ScheduleWork(
+ [in] PriorityLevel priorityLevel
+ );
+}
+
+[
+ object,
+ uuid(ee3b09c2-0110-4b6e-a73f-a3d6562f98ab),
+ pointer_default(unique)
+]
+interface ICorSvcOptimizer2 : ICorSvcOptimizer {
+ // generate a PDB for the given native image
+ HRESULT CreatePdb([in] BSTR nativeImagePath, [in] BSTR pdbPath);
+}
+
+[
+ object,
+ uuid(6EED164F-61EE-4a07-ABE8-670F92B4B7A9),
+ pointer_default(unique)
+]
+interface ICorSvcOptimizer3 : ICorSvcOptimizer2 {
+ // generate a PDB for the given native image, optionally including source lines info
+ HRESULT CreatePdb2([in] BSTR nativeImagePath, [in] BSTR pdbPath, [in] BOOL pdbLines, [in] BSTR managedPdbSearchPath);
+}
+
+typedef enum
+{
+ NewWorkAvailable = 0x0, // Notify the service that there is new work to do.
+ ClientWorkStart = 0x1, // Notify the service that there is client starting to do work.
+ ClientWorkDone = 0x2, // Notify the service that the client is done doing work.
+ UpdatePostReboot = 0x3, // Notify the service that it should do an 'ngen update' after reboot
+ NewWorkAvailableWithDelay = 0x4, // Like NewWorkAvailable, but service should wait a while before working
+} ServiceNotification;
+
+
+/* -------------------------------------------------------------------------- *
+ * ICorSvcManager is implemented by the service manager and used by
+ * the service controller in balancing the need to generate native images
+ * with the desire to not interfere with the usage of the computer.
+ * -------------------------------------------------------------------------- */
+[
+ object,
+ uuid(8f416a48-d663-4a7e-9732-fbca3fc46ea8),
+ pointer_default(unique),
+]
+interface ICorSvcManager : IUnknown
+{
+ // Schedule work only for selected priority level
+ HRESULT ScheduleWorkForSinglePriorityLevel(
+ [in] PriorityLevel priorityLevel,
+ [in] BSTR pInterruptEventName,
+ [out] BOOL* pWorkScheduled
+ );
+
+ // Do scheduled work
+ HRESULT Optimize(
+ [in] DWORD dwWorkerPriorityClass,
+ [in] ICompileProgressNotification *pCompileProgressNotification,
+ [in] BSTR pInterruptEventName
+ );
+
+ // Notify the service of new work
+ HRESULT NotifyService(ServiceNotification notification);
+
+ HRESULT IsWorkAvailable ([in] PriorityLevel priorityLevel,
+ [out] BOOL* pWorkAvailable);
+
+ HRESULT Update(
+ [in] UpdateFlags updateFlags,
+ [in] BSTR pInterruptEventName
+ );
+
+ HRESULT SetSvcLogger(
+ [in] ICorSvcLogger *pCorSvcLogger
+ );
+}
+
+[
+ object,
+ uuid(29626056-8031-441b-affa-7a82480058b3),
+ pointer_default(unique),
+]
+interface ICorSvcManager2 : IUnknown
+{
+ HRESULT SetRuntimeVersion(BSTR version);
+
+ HRESULT SetPackageMoniker(BSTR moniker);
+
+ HRESULT SetLocalAppData(BSTR directory);
+}
+
+[
+ object,
+ uuid(35e5d609-ec3d-4fc2-9ba2-5f99e42ff42f),
+ pointer_default(unique),
+]
+interface ICorSvcSetLegacyServiceBehavior : IUnknown
+{
+ HRESULT SetLegacyServiceBehavior();
+}
+
+[
+ object,
+ uuid(115466A4-7005-4CA3-971F-01F0A2C8EF09),
+ pointer_default(unique),
+]
+interface ICorSvcSetTaskBootTriggerState : IUnknown
+{
+ HRESULT SetTaskBootTriggerState(BOOL bEnabled);
+}
+
+[
+ object,
+ uuid(261DD1E3-F07E-4B8D-B54E-F26889413626),
+ pointer_default(unique),
+]
+interface ICorSvcSetTaskDelayStartTriggerState : IUnknown
+{
+ HRESULT SetTaskDelayStartTriggerState(BOOL bEnabled);
+}
+
+#endif // IN_MSCOREE
diff --git a/src/inc/mscoruef.idl b/src/inc/mscoruef.idl
new file mode 100644
index 0000000000..4ed554f544
--- /dev/null
+++ b/src/inc/mscoruef.idl
@@ -0,0 +1,117 @@
+// 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.
+//
+
+//
+/**************************************************************************************
+ ** **
+ ** Mscoruef.idl - interface definitions for internal UEF chain management. **
+ ** **
+ **************************************************************************************/
+
+//
+// Interface descriptions
+//
+import "unknwn.idl";
+
+cpp_quote("#ifdef FEATURE_UEF_CHAINMANAGER")
+
+// IID IUEFManager : uuid(F4D25DF3-E9B3-439c-8B2B-C814E36F9404)
+cpp_quote("EXTERN_GUID(IID_IUEFManager, 0xf4d25df3, 0xe9b3, 0x439c, 0x8b, 0x2b, 0xc8, 0x14, 0xe3, 0x6f, 0x94, 0x4);")
+
+// IID IWatsonSxSManager :uuid(A269593A-51E2-46bf-B914-8DCC5C39B5A5)
+cpp_quote("EXTERN_GUID(IID_IWatsonSxSManager, 0xa269593a, 0x51e2, 0x46bf, 0xb9, 0x14, 0x8d, 0xcc, 0x5c, 0x39, 0xb5, 0xa5);")
+
+cpp_quote("#ifdef __midl")
+
+#define EXCEPTION_MAXIMUM_PARAMETERS 15
+
+typedef struct _EXCEPTION_RECORD {
+ DWORD ExceptionCode;
+ DWORD ExceptionFlags;
+ struct _EXCEPTION_RECORD *ExceptionRecord;
+ PVOID ExceptionAddress;
+ DWORD NumberParameters;
+ ULONG_PTR ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
+} EXCEPTION_RECORD, *PEXCEPTION_RECORD;
+
+typedef struct _EXCEPTION_POINTERS {
+ PEXCEPTION_RECORD ExceptionRecord;
+ PVOID ContextRecord; // not using PCONTEXT here to avoid pulling extra definitions into this file
+} EXCEPTION_POINTERS, *PEXCEPTION_POINTERS, *LPEXCEPTION_POINTERS;
+
+typedef LONG (__stdcall *PTOP_LEVEL_EXCEPTION_FILTER)(
+ struct _EXCEPTION_POINTERS * pExceptionPointers);
+
+typedef PTOP_LEVEL_EXCEPTION_FILTER LPTOP_LEVEL_EXCEPTION_FILTER;
+
+cpp_quote("#endif // __midl")
+
+typedef BOOL (__stdcall * IsExceptionFromManagedCodeFnPtr)(EXCEPTION_RECORD * pExceptionRecord);
+
+//*****************************************************************************
+// Interface for Watson SxS management to the VM.
+//*****************************************************************************
+[
+ uuid(A269593A-51E2-46bf-B914-8DCC5C39B5A5),
+ helpstring("CLR Watson SxS Management Interface"),
+ pointer_default(unique),
+ local
+]
+interface IWatsonSxSManager : IUnknown
+{
+ // Used to register an exception claiming callback
+ BOOL RegisterExceptionClaimingCallback(
+ [in] IsExceptionFromManagedCodeFnPtr pCallback);
+
+ // Used to unregister an exception claiming callback
+ BOOL UnregisterExceptionClaimingCallback(
+ [in] IsExceptionFromManagedCodeFnPtr pCallback);
+
+ // Used to determine if the exception pointed by pExceptionRecord was thrown by a registered runtime
+ BOOL IsExceptionClaimed(
+ [in] EXCEPTION_RECORD * pExceptionRecord);
+
+ // Used to check if Watson has been triggered
+ BOOL HasWatsonBeenTriggered(void);
+
+ // Used to bestow the permission to report Watson to only one of its callers
+ BOOL IsCurrentRuntimeAllowedToReportWatson(void);
+
+ // Used to wait for the Watson SxS completion event
+ BOOL WaitForWatsonSxSCompletionEvent(void);
+
+ // Used to signal Watson SxS completion event
+ BOOL SignalWatsonSxSCompletionEvent(void);
+};
+
+//*****************************************************************************
+// Interface for UEF chain management to the VM.
+//*****************************************************************************
+[
+ uuid(F4D25DF3-E9B3-439c-8B2B-C814E36F9404),
+ helpstring("CLR UEF Chain Management Interface"),
+ pointer_default(unique),
+ local
+]
+interface IUEFManager : IUnknown
+{
+ // Used to register the function to be invoked upon unhandled exception
+ // notification from the OS
+ BOOL AddUnhandledExceptionFilter(
+ [in] LPTOP_LEVEL_EXCEPTION_FILTER uefCallbackFunc,
+ [in] BOOL firstHandler);
+
+ // Used to unregister a previously registered UEF callback
+ BOOL RemoveUnhandledExceptionFilter(
+ [in] LPTOP_LEVEL_EXCEPTION_FILTER uefCallbackFunc);
+
+ // Used to explicitly invoke the registered UEF callbacks
+ LONG InvokeUEFCallbacks(LPEXCEPTION_POINTERS pExceptionInfo);
+
+ // Used to return the WatsonSxSManager singleton instance
+ IWatsonSxSManager * GetWastonSxSManagerInstance(void);
+};
+
+cpp_quote("#endif // FEATURE_UEF_CHAINMANAGER")
diff --git a/src/inc/msodw.h b/src/inc/msodw.h
new file mode 100644
index 0000000000..d0745d2551
--- /dev/null
+++ b/src/inc/msodw.h
@@ -0,0 +1,585 @@
+// 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.
+#pragma once
+
+/****************************************************************************
+ This files contains the handshake structure with which apps will launch
+ Watson.
+****************************************************************************/
+
+#ifndef MSODW_H
+#define MSODW_H
+#pragma pack(push, msodw_h)
+#pragma pack(4)
+
+#define DW_TIMEOUT_VALUE 20000
+#define DW_MUTEX_TIMEOUT DW_TIMEOUT_VALUE / 2
+#define DW_NOTIFY_TIMEOUT 120000 // 2 minutes
+
+#define DW_CURRENT_VERSION 0x00020000
+
+#define DW_MAX_ASSERT_CCH 1024
+#define DW_MAX_PATH 260
+#define DW_APPNAME_LENGTH 56
+#define DW_MAX_ERROR_CWC 260 // must be at least max_path
+#define DW_MAX_REGSUBPATH 200
+#define DW_MAX_CALLSTACK 16
+#define DW_MAX_EVENTSOURCE DW_MAX_PATH
+#define DW_MAX_PIDREGKEY DW_MAX_PATH
+#define DW_MAX_BUCKETPARAM_CWC 255
+#define DW_MAX_USERDOCS_CWC 1024
+
+// return values for DW process
+#define DW_RETVAL_SUCCESS 0
+#define DW_RETVAL_FAILURE 1
+#define DW_RETVAL_DEBUG 16
+
+#define DW_ALLMODULES L"*\0"
+#define DW_NOTAG 0
+
+// this is added to the command line of the restarted app if fDweTagCommandLine is set
+#define DW_CMDLINE_TAG "Watson=1"
+
+// The following are the fields that can be specified in a manifest file to
+// launch DW in a file based reporting mode.
+// The following are required UI fields.
+#define DW_MANIFEST_GENERAL_APPNAME L"General_AppName="
+#define DW_MANIFEST_MAIN_INTRO_BOLD L"Main_Intro_Bold="
+#define DW_MANIFEST_QUEUED_EVENTDESCRIPTION L"Queued_EventDescription=" // this will only be shown if the report is queued
+
+// The following are required reporting fields.
+#define DW_MANIFEST_LCID L"UI LCID="
+#define DW_MANIFEST_VERSION L"Version=" // set this to DW_CURRENT_VERSION defined in this file
+
+// There are two ways to specify your bucket parameters.
+// The first is to fill in as many of these as you need,
+// and let DW construct URLs and UNC paths for you.
+#define DW_MANIFEST_EVENTTYPE L"EventType="
+#define DW_MANIFEST_P1 L"P1="
+#define DW_MANIFEST_P2 L"P2="
+#define DW_MANIFEST_P3 L"P3="
+#define DW_MANIFEST_P4 L"P4="
+#define DW_MANIFEST_P5 L"P5="
+#define DW_MANIFEST_P6 L"P6="
+#define DW_MANIFEST_P7 L"P7="
+#define DW_MANIFEST_P8 L"P8="
+#define DW_MANIFEST_P9 L"P9="
+#define DW_MANIFEST_P10 L"P10="
+
+// Alternatively, you can spell it all out for us.
+#define DW_MANIFEST_URL1 L"Stage1URL="
+#define DW_MANIFEST_URL2 L"Stage2URL="
+#define DW_MANIFEST_ERRORSUBPATH L"ErrorSubPath="
+
+// The following are optional; DW has default behavior for all of these.
+// These are UI fields (see UserInterfaceBlock for documentation if not listed below)
+#define DW_MANIFEST_GENERAL_REPORTEE L"General_Reportee="
+
+#define DW_MANIFEST_MAIN_CAPTION L"Main_Caption="
+#define DW_MANIFEST_MAIN_ICONFILE L"Main_IconFile=" // otherwise, no icon
+#define DW_MANIFEST_MAIN_INTRO_REG L"Main_Intro_Reg=" // otherwise DAL collapses space
+#define DW_MANIFEST_MAIN_CHECKBOX L"Main_CheckBox="
+#define DW_MANIFEST_MAIN_PLEA_BOLD L"Main_Plea_Bold="
+#define DW_MANIFEST_MAIN_PLEA_REG L"Main_Plea_Reg=" // otherwise DAL collapses space
+#define DW_MANIFEST_MAIN_DETAILSLINK L"Main_DetailsLink="
+#define DW_MANIFEST_MAIN_REPORTBTN L"Main_ReportBtn="
+#define DW_MANIFEST_MAIN_NOREPORTBTN L"Main_NoReportBtn="
+#define DW_MANIFEST_MAIN_ALWAYSREPORTBTN L"Main_AlwaysReportBtn="
+#define DW_MANIFEST_MAIN_QUEUEBTN L"Main_QueueBtn="
+#define DW_MANIFEST_MAIN_NOQUEUEBTN L"Main_NoQueueBtn="
+#define DW_MANIFEST_MAIN_QUEUETEXT L"Main_QueueText="
+#define DW_MANIFEST_MAIN_FEEDBACKLINK L"Main_FeedbackLink="
+
+#define DW_MANIFEST_DETAILS_CAPTION L"Details_Caption="
+#define DW_MANIFEST_DETAILS_PRE_HEADER L"Details_Pre_Header="
+#define DW_MANIFEST_DETAILS_PRE_BODY L"Details_Pre_Body="
+#define DW_MANIFEST_DETAILS_SIG_HEADER L"Details_Sig_Header="
+#define DW_MANIFEST_DETAILS_SIG_BODY L"Details_Sig_Body="
+#define DW_MANIFEST_DETAILS_POST_HEADER L"Details_Post_Header="
+#define DW_MANIFEST_DETAILS_POST_BODY L"Details_Post_Body=" // pretty similar to exception mode, but calls out DigPid too.
+#define DW_MANIFEST_DETAILS_TECHLINK L"Details_TechLink="
+#define DW_MANIFEST_DETAILS_DCPLINK L"Details_DCPLink="
+
+#define DW_MANIFEST_TECH_CAPTION L"Tech_Caption="
+#define DW_MANIFEST_TECH_FILES_HEADER L"Tech_Files_Header="
+
+#define DW_MANIFEST_TRANSFER_CAPTION L"Transfer_Caption="
+#define DW_MANIFEST_TRANSFER_1CHECK L"Transfer_1check="
+#define DW_MANIFEST_TRANSFER_2CHECK L"Transfer_2check="
+#define DW_MANIFEST_TRANSFER_3CHECK L"Transfer_3check="
+#define DW_MANIFEST_TRANSFER_STATUS_INPROGRESS L"Transfer_Status_InProgress="
+#define DW_MANIFEST_TRANSFER_STATUS_DONE L"Transfer_Status_Done="
+#define DW_MANIFEST_TRANSFER_CHECKBOX L"Transfer_Checkbox="
+
+#define DW_MANIFEST_SECONDLEVEL_CAPTION L"SecondLevel_Caption="
+#define DW_MANIFEST_SECONDLEVEL_PRE L"SecondLevel_Pre="
+#define DW_MANIFEST_SECONDLEVEL_POST L"SecondLevel_Post="
+
+#define DW_MANIFEST_FINAL_CAPTION L"Final_Caption="
+#define DW_MANIFEST_FINAL_TEXT L"Final_Text="
+#define DW_MANIFEST_FINAL_TEXT_USERCANCEL L"Final_Text_UserCancel="
+#define DW_MANIFEST_FINAL_LINK L"Final_Link="
+#define DW_MANIFEST_FINAL_LINK_SURVEY L"Final_Link_Survey="
+
+#define DW_MANIFEST_STANDBY_CAPTION L"Standby_Caption="
+#define DW_MANIFEST_STANDBY_BODY L"Standby_Body="
+
+// These are reporting fields.
+#define DW_MANIFEST_RFLAGS L"ReportingFlags="
+#define DW_MANIFEST_UFLAGS L"UIFlags="
+#define DW_MANIFEST_LFLAGS L"LoggingFlags="
+#define DW_MANIFEST_MFLAGS L"MiscFlags="
+#define DW_MANIFEST_BRAND L"Brand="
+#define DW_MANIFEST_EVENTSOURCE L"EventLogSource="
+#define DW_MANIFEST_EVENTID L"EventID="
+#define DW_MANIFEST_DIGPIDPATH L"DigPidRegPath="
+#define DW_MANIFEST_CHECKBOX_REGKEY L"CheckBoxRegKey="
+#define DW_MANIFEST_CUSTOM_QUERY_STRING_ELEMENTS L"CustomQueryStringElements="
+
+// DW expects at least one of these to be set.
+#define DW_MANIFEST_DELETABLEFILES L"FilesToDelete="
+#define DW_MANIFEST_NONDELETABLEFILES L"FilesToKeep="
+
+// These may be optionally set, and will be used on second-level data requests.
+#define DW_MANIFEST_USERFILES L"UserDocs="
+#define DW_MANIFEST_HEAP L"Heap="
+
+
+#define DW_X(X) L##X
+#define DW_Y(X) DW_X(X)
+
+// Seperator for file lists (Manifest DataFiles and Exception Additional Files)
+#define DW_FILESEPA '|'
+#define DW_FILESEP DW_Y(DW_FILESEPA)
+
+#define DW_OMIT_SECTION L"NIL"
+#define DW_APPNAME_TOKEN L"%General_AppName%"
+#define DW_REPORTEE_TOKEN L"%General_Reportee%"
+
+// the following is required for queued information file only
+#define DW_QR_VERSION L"QueueVer="
+#define DW_QR_DATE L"Date="
+#define DW_QR_TIME L"Time="
+#define DW_QR_REPORTSIZE L"ReportSize="
+#define DW_QR_BYTES L"Bytes="
+#define DW_QR_KILOBYTES L"Kilobytes="
+#define DW_QR_MEGABYTES L"Megabytes="
+#define DW_QR_MOREINFO L"MoreInfo="
+#define DW_QR_BP0 L"BP0="
+#define DW_QR_BP1 L"BP1="
+#define DW_QR_BP2 L"BP2="
+#define DW_QR_BP3 L"BP3="
+#define DW_QR_BP4 L"BP4="
+#define DW_QR_BP5 L"BP5="
+#define DW_QR_BP6 L"BP6="
+#define DW_QR_BP7 L"BP7="
+#define DW_QR_BP8 L"BP8="
+#define DW_QR_BP9 L"BP9="
+#define DW_QR_BP10 L"BP10="
+#define DW_QR_CBP L"CBP="
+#define DW_QR_DWVER0 L"DWVer0="
+#define DW_QR_DWVER1 L"DWVer1="
+#define DW_QR_DWVER2 L"DWVer2="
+#define DW_QR_DWVER3 L"DWVer3="
+#define DW_QR_MODE L"QueueMode="
+
+
+// shared reg values between DW and DW COM EXE
+#define DEFAULT_SUBPATH L"Microsoft\\PCHealth\\ErrorReporting\\DW"
+#define QUEUE_REG_SUBPATH L"Software\\" DEFAULT_SUBPATH
+#define QUEUE_REG_OKTOREPORT_VALUE L"OkToReportFromTheseQueues"
+#define WATSON_INSTALLED_REG_SUBPATH QUEUE_REG_SUBPATH L"\\Installed"
+#define WATSON_INSTALLED_REG_SUBPATH_IA64 L"Software\\Wow6432Node\\"DEFAULT_SUBPATH L"\\Installed"
+#define WATSON_INSTALLED_REG_VAL L"DW0200" // keep in sync with %MSI%\src\sdl\shared\watson.sreg
+#define WATSON_INSTALLED_REG_VAL_IA64 L"DW0201" // keep in sync with %MSI%\src\sdl\shared\watson.sreg
+
+// names for the Watson exes
+#define DW_EXEA "dw20.exe"
+#define DW_EXE DW_Y(DW_EXEA)
+#define DW_COM_EXEA "dwtrig20.exe"
+#define DW_COM_EXE DW_Y(DW_COM_EXEA)
+
+// the following option is used to exec DW to set the trigger for queued reporting
+// ie Run 'dw20 -k <queue number>'
+#define OPTSQRTA 'k' // queued reporting trigger
+#define OPTSQRT DW_Y(OPTSQRTA)
+
+// the following option is used to exec DW in queued reporting mode
+// ie Run 'dw20 -q <queue types to report from>'
+#define OPTQRMA 'q' // queued reporting mode
+#define OPTQRM DW_Y(OPTQRMA)
+
+// the following option is used to exec the DW COM EXE to trigger queued reporting after a delay time
+// ie Run 'dwtrig20 -t'
+#define OPTQRTA 't' // queued reporting trigger
+#define OPTQRT DW_Y(OPTQRTA)
+
+// the following option is used to exec the DW COM EXE to trigger queued reporting immediately
+// ie Run 'dwtrig20 -f <queue types to report from>'
+#define OPTQRFA 'f' // force queued reporting
+#define OPTQRF DW_Y(OPTQRFA)
+
+#define C_QUEUE_TYPES 3
+
+enum // EQueueTypes
+{
+ dwqueueMin = 0x00000001,
+
+ // all the queues types
+ // these must be consecutive
+ // (valid range for queue types is 0x00000001 - 0x00008000, 16 total)
+ dwqueueRegular = 0x00000001,
+ dwqueueSignOff = 0x00000002,
+ dwqueueHeadless = 0x00000004,
+ // next valid queue type: 0x00000008
+
+ // the maximum dwqueueMax is 0x00008000
+ dwqueueMax = 0x00000004,
+
+ // triggering flags (valid range for triggers is 0x00010000 - 0x08000000, 12 total)
+ dwtriggerAtLogon = 0x00010000,
+ dwtriggerAtConnectionMade = 0x00020000,
+
+ // special flags (valid range for special flags is 0x1000000 - 0x80000000, 4 total)
+ dwqueueAnyAdmin = 0x10000000, // Admin queue
+
+ // flag combinations
+ dwqueueTypes = 0x00000007, // Regular | SignOff | Headless
+};
+
+enum // EQueuedReportingDialogResults
+{
+ qrdrCancel = 0x00000001,
+ qrdrLater = 0x00000002,
+ qrdrDone = 0x00000004,
+};
+
+
+#ifdef DEBUG
+enum // AssertActionCodes
+{
+ DwAssertActionFail = 0,
+ DwAssertActionDebug,
+ DwAssertActionIgnore,
+ DwAssertActionAlwaysIgnore,
+ DwAssertActionIgnoreAll,
+ DwAssertActionQuit,
+};
+#endif
+
+// Caller is the app that has experienced an exception and launches DW
+
+enum // ECrashTimeDialogStates // msoctds
+{
+ msoctdsNull = 0x00000000,
+ msoctdsQuit = 0x00000001,
+ msoctdsRestart = 0x00000002,
+ msoctdsRecover = 0x00000004,
+ msoctdsUnused = 0x00000008,
+ msoctdsDebug = 0x00000010,
+};
+
+#define MSODWRECOVERQUIT (msoctdsRecover | msoctdsQuit)
+#define MSODWRESTARTQUIT (msoctdsRestart | msoctdsQuit)
+#define MSODWRESPONSES (msoctdsQuit | msoctdsRestart | msoctdsRecover)
+
+// THIS IS PHASED OUT -- DON'T USE
+enum // EMsoCrashHandlerFlags // msochf
+{
+ msochfNull = 0x00000000,
+ msochfCheckboxOff = 0x00000001,
+
+ msochfUnused = msoctdsUnused, // THESE MUST BE THE SAME 0x8
+ msochfCanRecoverDocuments = msoctdsRecover, // 0x4
+
+ msochfObsoleteCanDebug = 0x00010001, // not used anymore
+ msochfCannotSneakyDebug = 0x00010002, // The "hidden" debug feature won't work
+ msochfDefaultDontReport = 0x00010004,
+ msochReportingDisabled = 0x00010008, // User cannot change default reporting choice
+};
+
+
+//
+enum // EMsoCrashHandlerResults // msochr
+{
+ msochrNotHandled = msoctdsNull,
+ msochrUnused = msoctdsUnused,
+ msochrDebug = msoctdsDebug,
+ msochrRecoverDocuments = msoctdsRecover,
+ msochrRestart = msoctdsRestart,
+ msochrQuit = msoctdsQuit,
+};
+
+enum // EDwReportingFlags
+{
+ fDwrDeleteFiles = 0x00000001, // delete "files to delete" after use (plus heap, minidump, manifest).
+ fDwrIgnoreHKCU = 0x00000002, // Only look at HKLM. If you do not set this, we will look at both HKCU and HKLM.
+ fDwrForceOfflineMode = 0x00000008, // DW will force the report to be queued
+ fDwrForceToAdminQueue = 0x00000004 | fDwrForceOfflineMode, // DW will force the report to be queued on the Admin queue
+ fDwrDenyOfflineMode = 0x00000010, // DW will not allow report to be queued
+ fDwrNoHeapCollection = 0x00000020, // DW will not gather the heap.
+ fDwrNoSecondLevelCollection = 0x00000040 | fDwrNoHeapCollection, // DW will not send any second level data, including the heap
+ fDwrNeverUpload = 0x00000080, // don't report
+ fDwrDontPromptIfCantReport = 0x00000100, // DW will not show any UI if we're not going to report.
+ fDwrNoDefaultCabLimit = 0x00000200, // DW under CER won't use 5 as the fallback but unlimited instead (policy still overrides)
+};
+
+enum // EDwUIFlags
+{
+ fDwuNoEventUI = 0x00000001, // DW will always try to send headless, regardless of DWAllowHeadless
+ // Having no UI reporting from the queue means that there is no UI at the time of the event
+ fDwuNoQueueUI = 0x00000002 | fDwuNoEventUI, // DW will put the report in the headless queue with no UI
+ fDwuShowFeedbackLink = 0x00000004, // Show the "Why should I report" link.
+ fDwuUseIE = 0x00000008, // always launch w/ IE
+
+ // DO NOT use this flag. It doesn't work. Instead customize by using the UserInterfaceBlock.
+ fDwuUseLitePlea = 0x00000010, // DW won't suggest product change in report plea
+
+ fDwuManifestDebug = 0x00000020, // DW will provide a debug button in manifest mode
+ fDwuDenySuspend = 0x00000040, // DW will keep powersave mode from suspending it, until transfer is complete.
+};
+
+enum // EDwLoggingFlags
+{
+ fDwlNoParameterLog = 0x00000001, // DW won't log the initial parameters
+ fDwlNoBucketLog = 0x00000002, // DW won't log the bucket ID and the bucket parameters
+ fDwlResponseLog = 0x00000004, // log the resolved response, including extra args, to the event log with event 1010.
+};
+
+enum // EDwExceptionModeFlags
+{
+ fDweCheckSig = 0x00000001, // checks the signatures of the App/Mod list
+ fDweTagCommandLine = 0x00000002, // adds DW_CMDLINE_TAG to command line when restarting apps.
+ fDweDefaultQuit = 0x00000004, // In exception mode, DW will default the restart/recover box to off. Doesn't affect regkey-based checkboxes.
+ fDweKeepMinidump = 0x00000008, // Don't delete the minidump when we're done using it.
+ fDweIgnoreAeDebug = 0x00000010, // Don't check AeDebug to determine whether or not to show the Debug button.
+ fDweGatherHeapAsMdmp = 0x00000020, // Use the minidump API to gather the heap, rather than the minimal version we build directly
+ fDweReleaseBeforeCabbing = 0x00000040, // Release the thread doing the dump and cab the files in the background.
+};
+
+enum // EDwMiscFlags
+{
+ fDwmOfficeDigPID = 0x00000001, // use custom internal code to figure out what SKU of Office is installed
+ fDwmOfficeSQMReporting = 0x00000002, // DW should collect SQM data and save it for Office to upload (if QMEnabled reg key is set).
+ fDwmContainsOnlyAnonymousData = 0x00000003, // DW does nothing with this flag, but the LH shim will recognize it. It should be used in rare
+ // circumstances when the silent report is known to contain NO PII.
+};
+
+
+typedef struct _AssertBlock
+{
+ // for Assert communication
+ DWORD dwTag; // [in] AssertTag
+ char szAssert[DW_MAX_ASSERT_CCH]; // [in] Sz from the assert
+ int AssertActionCode; // [out] action code to take
+
+ DWORD cdwCallstack; // The number of actual callstack entries
+ DWORD rgdwCallstack[DW_MAX_CALLSTACK]; // Callstack
+
+} AssertBlock;
+
+typedef struct _UserInterfaceBlock
+{
+ // THIS ITEM IS REQUIRED. We do not go find your executable name to use instead.
+ WCHAR wzGeneral_AppName[DW_APPNAME_LENGTH];
+
+ // everything below this point is optional
+ WCHAR wzGeneral_Reportee[DW_APPNAME_LENGTH]; // on whose behalf we request the report; otherwise "Microsoft"
+
+ WCHAR wzMain_Caption[DW_MAX_ERROR_CWC]; // otherwise <General_AppName>
+ WCHAR wzMain_IconFile[DW_MAX_PATH]; // otherwise pulled from executable
+ WCHAR wzMain_Intro_Bold[DW_MAX_ERROR_CWC]; // otherwise "<General_AppName> has encountered a problem and needs to close. We are sorry for the inconvenience."
+ WCHAR wzMain_Intro_Reg[DW_MAX_ERROR_CWC]; // various defaults, usually "Please tell <General_Reportee> about this problem"
+ WCHAR wzMain_Checkbox[DW_MAX_ERROR_CWC]; // otherwise "Don't show me this again"
+ WCHAR wzMain_Plea_Bold[DW_MAX_ERROR_CWC]; // otherwise "Please tell <General_Reportee> about this problem" ("NIL" means skip whole string)
+ WCHAR wzMain_Plea_Reg[DW_MAX_ERROR_CWC]; // otherwise "We have created an error report that you can send to help us improve <General_AppName>. We will treat this report as confidential and anonymous."
+ WCHAR wzMain_DetailsLink[DW_MAX_ERROR_CWC]; // otherwise "See what data this error report contains."
+ WCHAR wzMain_ReportBtn[DW_APPNAME_LENGTH]; // otherwise "&Send Error Report"
+ WCHAR wzMain_NoReportBtn[DW_APPNAME_LENGTH]; // otherwise "&Don't Send"
+ WCHAR wzMain_AlwaysReportBtn[DW_APPNAME_LENGTH];// otherwise "&Send Error Report"
+ WCHAR wzMain_QueueBtn[DW_APPNAME_LENGTH]; // otherwise "&Send Report Later"
+ WCHAR wzMain_NoQueueBtn[DW_APPNAME_LENGTH]; // otherwise "&Don't Report"
+ WCHAR wzMain_QueueText[DW_MAX_ERROR_CWC]; // otherwise "You cannot send this error report now because you are not connected...."
+ WCHAR wzMain_FeedbackLink[DW_MAX_ERROR_CWC]; // otherwise "Why should I report to %General_Reportee%?"
+
+ WCHAR wzDetails_Caption[DW_MAX_ERROR_CWC]; // otherwise <General_AppName>
+ WCHAR wzDetails_Pre_Header[DW_MAX_ERROR_CWC]; // otherwise "Error Details"
+ WCHAR wzDetails_Pre_Body[DW_MAX_ERROR_CWC]; // otherwise "foo" ("NIL" means delete whole Pre section)
+ WCHAR wzDetails_Sig_Header[DW_MAX_ERROR_CWC]; // otherwise "Error Signature"
+ WCHAR wzDetails_Sig_Body[DW_MAX_ERROR_CWC]; // otherwise constructed by DW from bucket params from stage 2 URL ("NIL" means delete whole Sig section)
+ WCHAR wzDetails_Post_Header[DW_MAX_ERROR_CWC]; // otherwise "Reporting Details"
+ WCHAR wzDetails_Post_Body[DW_MAX_ERROR_CWC]; // otherwise "This error report includes:..." ("NIL" means delete whole Post section)
+ WCHAR wzDetails_TechLink[DW_MAX_ERROR_CWC]; // otherwise "View the contents of this error report"
+ WCHAR wzDetails_DCPLink[DW_MAX_ERROR_CWC]; // otherwise "Read our Data Collection Policy"
+
+ WCHAR wzTech_Caption[DW_MAX_ERROR_CWC]; // otherwise "Error Report Contents"
+ WCHAR wzTech_MDump_Header[DW_MAX_ERROR_CWC]; // otherwise "The following information about your process will be reported...."
+ WCHAR wzTech_Files_Header[DW_MAX_ERROR_CWC]; // otherwise "The following files will be included in this error report."
+
+ WCHAR wzTransfer_Caption[DW_MAX_ERROR_CWC]; // otherwise "Error Reporting"
+ WCHAR wzTransfer_1Check[DW_MAX_ERROR_CWC]; // otherwise "Preparing error report"
+ WCHAR wzTransfer_2Check[DW_MAX_ERROR_CWC]; // otherwise "Connecting to server"
+ WCHAR wzTransfer_3Check[DW_MAX_ERROR_CWC]; // otherwise "Checking for the status of this problem"
+ WCHAR wzTransfer_Status_InProgress[DW_MAX_ERROR_CWC]; // otherwise "Transferring report..."
+ WCHAR wzTransfer_Status_Done[DW_MAX_ERROR_CWC]; // otherwise "Reporting Completed. Thank you!"
+ WCHAR wzTransfer_Checkbox[DW_MAX_ERROR_CWC]; // otherwise "Close When Done"
+
+ WCHAR wzSecondLevel_Caption[DW_MAX_ERROR_CWC]; // otherwise "More Information"
+ WCHAR wzSecondLevel_Pre[DW_MAX_ERROR_CWC]; // otherwise "In order to correctly diagnose this problem the following information...."
+ WCHAR wzSecondLevel_Post[DW_MAX_ERROR_CWC]; // otherwise "Please click "Cancel" if you do not wish to share this information" (May also contain "Your files may contain sensitive information")
+
+ WCHAR wzFinal_Caption[DW_MAX_ERROR_CWC]; // otherwise "Reporting"
+ WCHAR wzFinal_Text[DW_MAX_ERROR_CWC]; // otherwise "Thank you for taking the time to report this problem."
+ WCHAR wzFinal_Text_UserCancel[DW_MAX_ERROR_CWC]; // otherwise "Reporting stopped on user cancel."
+ WCHAR wzFinal_Link[DW_MAX_ERROR_CWC]; // otherwise "Get more information about preventing this problem in the future."
+ WCHAR wzFinal_Link_Survey[DW_MAX_ERROR_CWC]; // otherwise "Provide additional information about this problem via a short questionnaire."
+
+ WCHAR wzStandby_Caption[DW_MAX_ERROR_CWC]; // otherwise "Power Management"
+ WCHAR wzStandby_Body[DW_MAX_ERROR_CWC]; // otherwise "Windows cannot go on standby because <General_AppName> has experienced..."
+
+ WCHAR wzDialup_Caption[DW_MAX_ERROR_CWC]; // otherwise "Active Internet Connection Required"
+ WCHAR wzDialup_Body[DW_MAX_ERROR_CWC]; // otherwise "In order to report this problem, you must connect to the Internet. Please start your connection before continuing."
+
+ WCHAR wzHangup_Caption[DW_MAX_ERROR_CWC]; // otherwise "Finished Reporting"
+ WCHAR wzHangup_Body[DW_MAX_ERROR_CWC]; // otherwise "Reporting has finished. You may close your Internet connection now."
+ WCHAR wzHangup_Body_UserCancel[DW_MAX_ERROR_CWC]; // otherwise "Reporting has been cancelled. You may close your Internet connection now."
+
+ WCHAR wzQueued_EventDescription[DW_MAX_ERROR_CWC]; // otherwise "Application Error"
+
+} UserInterfaceBlock;
+
+
+typedef struct _CustomMinidumpBlock
+{
+ BOOL fCustomMinidump;
+ DWORD dwMinidumpType;
+ BOOL fOnlyThisThread;
+ DWORD dwThisThreadFlags;
+ DWORD dwOtherThreadFlags;
+ DWORD dwThisThreadExFlags;
+ DWORD dwOtherThreadExFlags;
+ DWORD dwPreferredModuleFlags;
+ DWORD dwOtherModuleFlags;
+} CustomMinidumpBlock;
+
+typedef struct _GenericModeBlock
+{
+ BOOL fInited;
+ WCHAR wzEventTypeName[DW_MAX_BUCKETPARAM_CWC];
+ WCHAR wzP1[DW_MAX_BUCKETPARAM_CWC];
+ WCHAR wzP2[DW_MAX_BUCKETPARAM_CWC];
+ WCHAR wzP3[DW_MAX_BUCKETPARAM_CWC];
+ WCHAR wzP4[DW_MAX_BUCKETPARAM_CWC];
+ WCHAR wzP5[DW_MAX_BUCKETPARAM_CWC];
+ WCHAR wzP6[DW_MAX_BUCKETPARAM_CWC];
+ WCHAR wzP7[DW_MAX_BUCKETPARAM_CWC];
+ WCHAR wzP8[DW_MAX_BUCKETPARAM_CWC];
+ WCHAR wzP9[DW_MAX_BUCKETPARAM_CWC];
+ WCHAR wzP10[DW_MAX_BUCKETPARAM_CWC];
+} GenericModeBlock;
+
+
+typedef struct _DWSharedMem20
+{
+ DWORD dwSize; // should be set to size of DWSharedMem
+ DWORD dwVersion; // callers should set this to DWCurrentVersion as in this header
+
+ DWORD pid; // Process Id of caller
+ DWORD tid; // Id of excepting thread
+ DWORD_PTR eip; // EIP of the excepting instruction
+ PEXCEPTION_POINTERS pep; // Exception pointers given to the callee's
+ // exception handler
+ HANDLE hEventDone; // event DW signals when done
+ // caller will also signal this if it things
+ // DW has hung and restarts itself
+ HANDLE hEventNotifyDone; // App sets when it's done w/ notifcation phase
+ HANDLE hEventAlive; // heartbeat event DW signals per EVENT_TIMEOUT
+ HANDLE hMutex; // to protect the signaling of EventDone
+ HANDLE hProc; // handle to the calling process
+
+ DWORD bfDWRFlags; // controls caller-specific behaviors wrt REPORTING
+ DWORD bfDWUFlags; // controls caller-specific behaviors wrt UI
+ DWORD bfDWLFlags; // controls caller-specific behaviors wrt LOGGING
+ DWORD bfDWEFlags; // controls caller-specific behaviors wrt EXCEPTION MODE SPECIFICS
+ DWORD bfDWMFlags; // controls caller-specific behaviors wrt MISCELLANEOUS THINGS
+
+ LCID lcidUI; // will try this UI langauge if non-zero
+ // next DW will use the system LCID,
+ // and if it can't find an intl dll for that,
+ // will fall back on US English (1033)
+
+ DWORD bfmsoctdsOffer; // bitfield of user choices to offer
+ // note that you must specify two of:
+ // Quit, Restart, Recover, Ignore
+ // The Debug choice is independent
+ DWORD bfmsoctdsNotify; // bitfield of user choices for which the
+ // app wants control back instead of simply being
+ // terminated by DW. The app will then be
+ // responsible for pinging DW (if desired) with
+ // hEventAlive and for notify DW it's ok to
+ // terminate the app w/ hEventDone
+
+ DWORD bfmsoctdsLetRun; // bitfield of user choices for which the
+ // app wants control back instead of being
+ // terminated by DW. DW can then safely ignore
+ // the app and exit.
+
+ WCHAR wzEventLogSource[DW_MAX_EVENTSOURCE]; // Set this as your source if you want to log events.
+
+ WCHAR wzModuleFileName[DW_MAX_PATH]; // The result of GetModuleFileName(NULL)
+
+ char szPIDRegKey[DW_MAX_PIDREGKEY]; // name of the key that holds the PID
+ // can be used by the Server for
+ // spoof-detection
+ char szBrand[DW_APPNAME_LENGTH]; // passed as a param to Privacy Policy link
+ char szCustomQueryStringElements[DW_MAX_PATH]; // passsed as param to Privacy Policy Link and Response Link
+
+ char szCheckBoxRegKey[DW_MAX_PATH]; // If we get a key, we should show the
+ // "Never send reports for this type of event" checkbox.
+ // That string can be overridden in the UIB.
+
+ WCHAR wzDotDataDlls[DW_MAX_PATH]; // contains the list of DLLs, terminated
+ // by '\0' characters, that DW will
+ // collect the .data sections into the
+ // full minidump version
+ // e.g. "mso9.dll\0outllib.dll\0"
+
+ WCHAR wzFilesToDelete[1024]; // File list, seperated by DW_FILESEP
+ // each of these files gets added to the
+ // cab at upload time
+ // These are files that we will delete
+ // if fDwrDeleteFiles is sent.
+
+ WCHAR wzFilesToKeep[1024]; // File list, seperated by DW_FILESEP
+ // each of these files gets added to the
+ // cab at upload time
+ // These are files that we will NOT delete
+ // if fDwrDeleteFiles is sent.
+
+ WCHAR wzUserDocs[DW_MAX_USERDOCS_CWC]; // File list, seperated by DW_FILESEP
+ // each of these files gets added to the
+ // cab at upload time IFF we get a second-level request for them.
+ // These are files that we will NOT delete
+ // if fDwrDeleteFiles is sent.
+
+ UserInterfaceBlock uib; // encapsulates UI override data. You must set the appname in here.
+ AssertBlock ab; // encapsulates assert-tag data
+ GenericModeBlock gmb; // encapsulates custom bucket parameters for generic mode
+ CustomMinidumpBlock cmb; // encapsulates customization info for minidump gathering
+
+ // OUTPARAMS
+ DWORD msoctdsResult; // result from crash-time dialog
+ BOOL fReportProblem; // did user approve reporting?
+ WCHAR wzMinidumpLocation[DW_MAX_PATH]; // when fDweKeepMinidump is set, we write its name here.
+ // it is available for access once hEventDone is signaled.
+
+ // DYNAMIC INPARAMS used during recovery conversation for DW's UI
+ int iPingCurrent; // current count for the recovery progress bar
+ int iPingEnd; // index for the end of the recovery progress bar
+
+} DWSharedMem20, DWSharedMem;
+
+
+#pragma pack(pop, msodw_h)
+#endif // MSODW_H
diff --git a/src/inc/msodwwrap.h b/src/inc/msodwwrap.h
new file mode 100644
index 0000000000..28c7247502
--- /dev/null
+++ b/src/inc/msodwwrap.h
@@ -0,0 +1,11 @@
+// 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.
+#ifndef __msodwwrap_h__
+#define __msodwwrap_h__
+
+#ifndef MSODW_H
+#include "msodw.h"
+#endif // MSODW_H
+
+#endif // __msodwwrap_h__
diff --git a/src/inc/nativevaraccessors.h b/src/inc/nativevaraccessors.h
new file mode 100644
index 0000000000..b3ee7bba0b
--- /dev/null
+++ b/src/inc/nativevaraccessors.h
@@ -0,0 +1,48 @@
+// 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.
+//*****************************************************************************
+// The following are used to read and write data given NativeVarInfo
+// for primitive types. Don't use these for VALUECLASSes.
+//*****************************************************************************
+
+
+#ifndef _NATIVE_VAR_ACCESSORS_H_
+#define _NATIVE_VAR_ACCESSORS_H_
+
+#include "corjit.h"
+
+bool operator ==(const ICorDebugInfo::VarLoc &varLoc1,
+ const ICorDebugInfo::VarLoc &varLoc2);
+
+#define MAX_NATIVE_VAR_LOCS 2
+
+SIZE_T GetRegOffsInCONTEXT(ICorDebugInfo::RegNum regNum);
+
+struct NativeVarLocation
+{
+ ULONG64 addr;
+ TADDR size;
+ bool contextReg;
+};
+
+ULONG NativeVarLocations(const ICorDebugInfo::VarLoc & varLoc,
+ PT_CONTEXT pCtx,
+ ULONG numLocs,
+ NativeVarLocation* locs);
+
+SIZE_T *NativeVarStackAddr(const ICorDebugInfo::VarLoc & varLoc,
+ PT_CONTEXT pCtx);
+
+bool GetNativeVarVal(const ICorDebugInfo::VarLoc & varLoc,
+ PT_CONTEXT pCtx,
+ SIZE_T * pVal1,
+ SIZE_T * pVal2
+ WIN64_ARG(SIZE_T cbSize));
+
+bool SetNativeVarVal(const ICorDebugInfo::VarLoc & varLoc,
+ PT_CONTEXT pCtx,
+ SIZE_T val1,
+ SIZE_T val2
+ WIN64_ARG(SIZE_T cbSize));
+#endif // #ifndef _NATIVE_VAR_ACCESSORS_H_
diff --git a/src/inc/new.hpp b/src/inc/new.hpp
new file mode 100644
index 0000000000..3e6644d184
--- /dev/null
+++ b/src/inc/new.hpp
@@ -0,0 +1,27 @@
+// 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.
+//
+
+//
+
+#ifndef __new__hpp
+#define __new__hpp
+
+#if defined(_MSC_VER) && _MSC_VER < 1900
+#define NOEXCEPT
+#else
+#define NOEXCEPT noexcept
+#endif
+
+struct NoThrow { int x; };
+extern const NoThrow nothrow;
+
+void * __cdecl operator new(size_t n, const NoThrow&) NOEXCEPT;
+void * __cdecl operator new[](size_t n, const NoThrow&) NOEXCEPT;
+
+#ifdef _DEBUG
+void DisableThrowCheck();
+#endif
+
+#endif
diff --git a/src/inc/newapis.h b/src/inc/newapis.h
new file mode 100644
index 0000000000..dfe77a5000
--- /dev/null
+++ b/src/inc/newapis.h
@@ -0,0 +1,352 @@
+// 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.
+////////////////////////////////////////////////////////////////////////////
+//
+// File: newapis.h
+//
+
+
+//
+// Purpose: functions that need to be emulated on downlevel platforms.
+//
+////////////////////////////////////////////////////////////////////////////
+
+#ifndef MUI_LANGUAGE_NAME
+#define MUI_LANGUAGE_NAME 0
+#endif
+
+#ifndef CALINFO_ENUMPROCEXEX
+typedef BOOL (CALLBACK* CALINFO_ENUMPROCEXEX)(LPWSTR, CALID, LPWSTR, LPARAM);
+#endif
+
+#ifndef DATEFMT_ENUMPROCEXEX
+typedef BOOL (CALLBACK* DATEFMT_ENUMPROCEXEX)(LPWSTR, CALID, LPARAM);
+#endif
+
+#ifndef TIMEFMT_ENUMPROCEX
+typedef BOOL (CALLBACK* TIMEFMT_ENUMPROCEX)(LPWSTR, LPARAM);
+#endif
+
+#ifndef LOCALE_ENUMPROCEX
+typedef BOOL (CALLBACK* LOCALE_ENUMPROCEX)(LPWSTR, DWORD, LPARAM);
+#endif
+
+#if !defined(LPNLSVERSIONINFOEX)
+#define LPNLSVERSIONINFOEX LPNLSVERSIONINFO
+#endif
+
+#ifndef COMPARE_OPTIONS_ORDINAL
+#define COMPARE_OPTIONS_ORDINAL 0x40000000
+#endif
+
+#ifndef LINGUISTIC_IGNORECASE
+#define LINGUISTIC_IGNORECASE 0x00000010 // linguistically appropriate 'ignore case'
+#endif
+
+#ifndef FIND_STARTSWITH
+#define FIND_STARTSWITH 0x00100000 // see if value is at the beginning of source
+#endif
+
+#ifndef FIND_ENDSWITH
+#define FIND_ENDSWITH 0x00200000 // see if value is at the end of source
+#endif
+
+#ifndef FIND_FROMSTART
+#define FIND_FROMSTART 0x00400000 // look for value in source, starting at the beginning
+#endif
+
+#ifndef FIND_FROMEND
+#define FIND_FROMEND 0x00800000 // look for value in source, starting at the end
+#endif
+
+#ifndef NORM_LINGUISTIC_CASING
+#define NORM_LINGUISTIC_CASING 0x08000000 // use linguistic rules for casing
+#endif
+
+#ifndef LCMAP_LINGUISTIC_CASING
+#define LCMAP_LINGUISTIC_CASING 0x01000000 // use linguistic rules for casing
+#endif
+
+#ifndef LCMAP_TITLECASE
+#define LCMAP_TITLECASE 0x00000300 // Title Case Letters
+#endif
+
+#ifndef LCMAP_SORTHANDLE
+#define LCMAP_SORTHANDLE 0x20000000
+#endif
+
+#ifndef LCMAP_HASH
+#define LCMAP_HASH 0x00040000
+#endif
+
+#ifndef LOCALE_ALL
+#define LOCALE_ALL 0 // enumerate all named based locales
+#endif // LOCALE_ALL
+
+#ifndef LOCALE_WINDOWS
+#define LOCALE_WINDOWS 0x00000001 // shipped locales and/or replacements for them
+#endif // LOCALE_WINDOWS
+
+#ifndef LOCALE_SUPPLEMENTAL
+#define LOCALE_SUPPLEMENTAL 0x00000002 // supplemental locales only
+#endif // LOCALE_SUPPLEMENTAL
+
+#ifndef LOCALE_ALTERNATE_SORTS
+#define LOCALE_ALTERNATE_SORTS 0x00000004 // alternate sort locales
+#endif // LOCALE_ALTERNATE_SORTS
+
+#ifndef LOCALE_NEUTRALDATA
+#define LOCALE_NEUTRALDATA 0x00000010 // Locales that are "neutral" (language only, region data is default)
+#endif // LOCALE_NEUTRALDATA
+
+#ifndef LOCALE_SPECIFICDATA
+#define LOCALE_SPECIFICDATA 0x00000020 // Locales that contain language and region data
+#endif // LOCALE_SPECIFICDATA
+
+#ifndef LOCALE_INEUTRAL
+#define LOCALE_INEUTRAL 0x00000071 // Returns 0 for specific cultures, 1 for neutral cultures.
+#endif // LOCALE_INEUTRAL
+
+#ifndef LOCALE_SSORTLOCALE
+#define LOCALE_SSORTLOCALE 0x0000007b // Name of locale to use for sorting/collation/casing behavior.
+#endif // LOCALE_SSORTLOCALE
+
+#ifndef LOCALE_RETURN_NUMBER
+#define LOCALE_RETURN_NUMBER 0x20000000 // return number instead of string
+#endif // LOCALE_RETURN_NUMBER
+
+#ifndef LOCALE_ALLOW_NEUTRAL_NAMES
+#define LOCALE_ALLOW_NEUTRAL_NAMES 0x08000000 //Flag to allow returning neutral names/lcids for name conversion
+#endif // LOCALE_ALLOW_NEUTRAL_NAMES
+
+#ifndef LOCALE_SNAME
+#define LOCALE_SNAME 0x0000005c
+#endif
+
+#define FIND_NLS_STRING_FLAGS_NEGATION (~(FIND_STARTSWITH | FIND_ENDSWITH | FIND_FROMSTART | FIND_FROMEND))
+#define CASING_BITS (NORM_LINGUISTIC_CASING | LINGUISTIC_IGNORECASE | NORM_IGNORECASE)
+
+
+#ifndef __out_xcount_opt
+#define __out_xcount_opt(var)
+#endif
+
+ // TODO: NLS Arrowhead -This isn't really right, custom locales could start with en- and have different sort behavior
+ // IS_FAST_COMPARE_LOCALE is used to do the fast ordinal index of when having string of Lower Ansi codepoints
+ // that less than 0x80. There are some locales that we cannot do optimization with, like Turkish and Azeri
+ // because of Turkish I problem and Humgerian because of lower Ansi compressions.
+#define IS_FAST_COMPARE_LOCALE(loc) \
+ (wcsncmp(loc,W("tr-"),3)!=0 && wcsncmp(loc,W("az-"),3)!=0 && wcsncmp(loc,W("hu-"),3)!=0)
+
+#define TURKISH_LOCALE_NAME W("tr-TR")
+#define AZERBAIJAN_LOCALE_NAME W("az-Latn-AZ")
+#define TURKISH_SORTING_LOCALE_NAME W("tr-TR_turkic")
+#define AZERBAIJAN_SORTING_LOCALE_NAME W("az-Latn-AZ_turkic")
+
+#define MUI_MERGE_SYSTEM_FALLBACK 0x10
+#define MUI_MERGE_USER_FALLBACK 0x20
+
+
+namespace NewApis
+{
+#if defined(FEATURE_CORESYSTEM)
+ __inline bool IsWindows7Platform()
+ {
+ return true;
+ }
+
+ __inline bool IsVistaPlatform()
+ {
+ return false;
+ }
+
+ __inline BOOL IsZhTwSku()
+ {
+ return false;
+ }
+
+#else
+ // Return true if we're on Windows 7 or up (ie: if we have neutral native support and sorting knows about versions)
+ __inline bool IsWindows7Platform()
+ {
+ static int isRunningOnWindows7 = -1; // -1 notinitialized, 0 not running on Windows 7, other value means running on Windows 7
+
+ if (isRunningOnWindows7 == -1)
+ {
+ OSVERSIONINFOEX sVer;
+ ZeroMemory(&sVer, sizeof(OSVERSIONINFOEX));
+ sVer.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
+ sVer.dwMajorVersion = 6;
+ sVer.dwMinorVersion = 1;
+ sVer.dwPlatformId = VER_PLATFORM_WIN32_NT;
+
+ DWORDLONG dwlConditionMask = 0;
+ VER_SET_CONDITION(dwlConditionMask, CLR_VER_MAJORVERSION, VER_GREATER_EQUAL);
+ VER_SET_CONDITION(dwlConditionMask, CLR_VER_MINORVERSION, VER_GREATER_EQUAL);
+ VER_SET_CONDITION(dwlConditionMask, CLR_VER_PLATFORMID, VER_EQUAL);
+
+ if(VerifyVersionInfo(&sVer, CLR_VER_MAJORVERSION|CLR_VER_MINORVERSION|CLR_VER_PLATFORMID, dwlConditionMask))
+ {
+ isRunningOnWindows7 = 1;
+ }
+ else
+ {
+ isRunningOnWindows7 = 0;
+ }
+ }
+
+ return isRunningOnWindows7 == 1;
+ }
+
+ //
+ // IsVistaPlatform return true if running on Vista and false if running on pre or post Vista
+ //
+ __inline BOOL IsVistaPlatform()
+ {
+ static int isRunningOnVista = -1; // -1 notinitialized, 0 not running on Vista, other value meanse running on Vista
+
+ if (isRunningOnVista == -1)
+ {
+ OSVERSIONINFOEX sVer;
+ ZeroMemory(&sVer, sizeof(OSVERSIONINFOEX));
+ sVer.dwOSVersionInfoSize = sizeof(OSVERSIONINFOEX);
+ sVer.dwMajorVersion = 6;
+ sVer.dwMinorVersion = 0;
+ sVer.dwPlatformId = VER_PLATFORM_WIN32_NT;
+
+ DWORDLONG dwlConditionMask = 0;
+ VER_SET_CONDITION(dwlConditionMask, CLR_VER_MAJORVERSION, VER_EQUAL);
+ VER_SET_CONDITION(dwlConditionMask, CLR_VER_MINORVERSION, VER_EQUAL);
+ VER_SET_CONDITION(dwlConditionMask, CLR_VER_PLATFORMID, VER_EQUAL);
+
+ if(VerifyVersionInfo(&sVer, CLR_VER_MAJORVERSION|CLR_VER_MINORVERSION|CLR_VER_PLATFORMID, dwlConditionMask))
+ {
+ isRunningOnVista = 1;
+ }
+ else
+ {
+ isRunningOnVista = 0;
+ }
+ }
+
+ return isRunningOnVista == 1;
+ }
+
+
+ __inline BOOL IsZhTwSku()
+ {
+ const INT32 LANGID_ZH_TW = 0x0404;
+ LPCWSTR DEFAULT_REGION_NAME_0404 = W("\x53f0\x7063");
+
+ if(::GetSystemDefaultUILanguage() == LANGID_ZH_TW)
+ {
+ WCHAR wszBuffer[32];
+ int result = ::GetLocaleInfoW(LANGID_ZH_TW, LOCALE_SNATIVECTRYNAME, wszBuffer, 32);
+ if (result)
+ {
+ if (wcsncmp(wszBuffer, DEFAULT_REGION_NAME_0404, 3) != 0)
+ {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+#endif // FEATURE_CORESYSTEM
+
+ __inline BOOL NotLeakingFrameworkOnlyCultures(__in LPCWSTR lpLocaleName)
+ {
+ return wcscmp(lpLocaleName, W("zh-CHS")) != 0
+ && wcscmp(lpLocaleName, W("zh-CHT")) != 0;
+ }
+
+ // System/user defaults
+ __success(return == TRUE) BOOL
+ GetUserPreferredUILanguages (__in DWORD dwFlags, __out PULONG pulNumLanguages, __out_ecount_opt(*pcchLanguagesBuffer) PWSTR pwszLanguagesBuffer, __in PULONG pcchLanguagesBuffer);
+
+ __success(return > 0) int
+ GetSystemDefaultLocaleName(__out_ecount(cchLocaleName) LPWSTR lpLocaleName, __in int cchLocaleName);
+
+ __success(return != 0) int
+ GetUserDefaultLocaleName(__out_ecount(cchLocaleName) LPWSTR lpLocaleName, __in int cchLocaleName);
+
+ // Comparison functions (ala CompareInfo)
+ int CompareStringEx(__in LPCWSTR lpLocaleName, __in DWORD dwCmpFlags, __in_ecount(cchCount1) LPCWSTR lpString1, __in int cchCount1, __in_ecount(cchCount2) LPCWSTR lpString2,
+ __in int cchCount2, __in_opt LPNLSVERSIONINFO lpVersionInformation, __in_opt LPVOID lpReserved, __in_opt LPARAM lParam );
+
+ int CompareStringOrdinal(__in_ecount(cchCount1) LPCWSTR lpString1, __in int cchCount1, __in_ecount(cchCount2) LPCWSTR lpString2, __in int cchCount2, __in BOOL bIgnoreCase);
+
+ int LCMapStringEx (__in LPCWSTR lpLocaleName, __in DWORD dwMapFlags, __in_ecount(cchSrc) LPCWSTR lpSrcStr, __in int cchSrc,
+ __out_xcount_opt(cchDest) LPWSTR lpDestStr, __in int cchDest, __in_opt LPNLSVERSIONINFO lpVersionInformation, __in_opt LPVOID lpReserved, __in_opt LPARAM lParam );
+
+ LPWSTR GetLingusticLocaleName(__in LPWSTR pLocaleName, __in DWORD dwFlags);
+
+ int IndexOfString(__in LPCWSTR lpLocaleName,
+ __in_ecount(cchCount1) LPCWSTR pString1, // String to search in
+ __in int cchCount1, // length of pString1
+ __in_ecount(cchCount2) LPCWSTR pString2, // String we're looking for
+ __in int cchCount2, // length of pString2
+ __in DWORD dwFlags, // search flags
+ __in BOOL startWith);
+
+ int LastIndexOfString(__in LPCWSTR lpLocaleName,
+ __in_ecount(cchCount1) LPCWSTR pString1, // String to search in
+ __in int cchCount1, // length of pString1
+ __in_ecount(cchCount2) LPCWSTR pString2, // String we're looking for
+ __in int cchCount2, // length of pString2
+ __in DWORD dwFlags,
+ __in BOOL endWith);
+
+ int FindNLSStringEx(__in LPCWSTR lpLocaleName,
+ __in DWORD dwFindNLSStringFlags,
+ __in_ecount(cchSource) LPCWSTR lpStringSource,
+ __in int cchSource,
+ __in_ecount(cchValue) LPCWSTR lpStringValue,
+ __in int cchValue,
+ __out_opt LPINT pcchFound,
+ __in_opt LPNLSVERSIONINFO lpVersionInformation,
+ __in_opt LPVOID lpReserved,
+ __in_opt LPARAM lParam);
+
+ BOOL IsNLSDefinedString(__in NLS_FUNCTION Function, __in DWORD dwFlags, __in_opt LPNLSVERSIONINFOEX lpVersionInfo, __in LPCWSTR lpString, __in int cchStr );
+
+ // Calendar and locale information
+ __success(return != 0) int
+ GetCalendarInfoEx(__in LPCWSTR lpLocaleName, __in CALID Calendar, __in_opt LPCWSTR pReserved, __in CALTYPE CalType, __out_ecount_opt(cchData) LPWSTR lpCalData, __in int cchData, __out_opt LPDWORD lpValue );
+
+ __success(return != 0) int
+ GetLocaleInfoEx (__in LPCWSTR lpLocaleName, __in LCTYPE LCType, __out_ecount_opt(cchData) LPWSTR lpLCData, __in int cchData);
+
+ __success(return != 0) int
+ GetDateFormatEx(__in LPCWSTR lpLocaleName, __in DWORD dwFlags, __in_opt CONST SYSTEMTIME* lpDate, __in_opt LPCWSTR lpFormat,
+ __out_ecount(cchDate) LPWSTR lpDateStr, __in int cchDate, __in_opt LPCWSTR lpCalendar);
+
+ // Enumeration functions
+ __success(return != 0) BOOL
+ EnumDateFormatsExEx (DATEFMT_ENUMPROCEXEX lpDateFmtEnumProcExEx, LPCWSTR lpLocaleName, DWORD dwFlags, LPARAM lParam);
+ __success(return != 0)
+ BOOL EnumTimeFormatsEx(TIMEFMT_ENUMPROCEX lpTimeFmtEnumProcEx, LPCWSTR lpLocaleName, DWORD dwFlags, LPARAM lParam);
+ __success(return != 0)
+ BOOL EnumCalendarInfoExEx(CALINFO_ENUMPROCEXEX pCalInfoEnumProcExEx, LPCWSTR lpLocaleName, CALID Calendar, CALTYPE CalType, LPARAM lParam);
+
+ int LCIDToLocaleName(__in LCID Locale, __out_ecount_opt(cchName) LPWSTR lpName, __in int cchName, __in DWORD dwFlags);
+ LCID LocaleNameToLCID(__in LPCWSTR lpName , __in DWORD dwFlags);
+
+ int ResolveLocaleName(__in LPCWSTR lpNameToResolve, __in_ecount_opt(cchLocaleName) LPWSTR lpLocaleName, __in int cchLocaleName);
+
+ __success(return == TRUE) BOOL
+ GetThreadPreferredUILanguages(__in DWORD dwFlags,
+ __out PULONG pulNumLanguages,
+ __out_ecount_opt(*pcchLanguagesBuffer) PWSTR pwszLanguagesBuffer,
+ __inout PULONG pcchLanguagesBuffer);
+
+ BOOL WINAPI EnumSystemLocalesEx(__in LOCALE_ENUMPROCEX lpLocaleEnumProc,
+ __in DWORD dwFlags,
+ __in LPARAM lParam,
+ __in_opt LPVOID lpReserved);
+
+};
+
+
+
diff --git a/src/inc/ngen.h b/src/inc/ngen.h
new file mode 100644
index 0000000000..fa0b9829d4
--- /dev/null
+++ b/src/inc/ngen.h
@@ -0,0 +1,153 @@
+// 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.
+//
+// This file is the interface to NGen (*N*ative code *G*eneration),
+// which compiles IL modules to machine code ahead-of-time.
+// This avoids the need for JIT compiling the code at program startup.
+//
+
+
+#ifndef _NGEN_H_
+#define _NGEN_H_
+
+#include "mscorsvc.h"
+
+// Log size default of 10 MB.
+#define DEFAULT_SERVICE_LOG_SIZE (10 * 1024 * 1024)
+// NGEN.log is smaller 1MB
+#define DEFAULT_MACHINE_WIDE_LOG_SIZE (1 * 1024 * 1024)
+// User specific log is yet smaller 200KB
+#define DEFAULT_USER_WIDE_LOG_SIZE (200 * 1024)
+// Log size default of 100 KB. This should be big enough to hold some log info from roughly 100
+// ngen events. (Roughly 200KB of space including secondary log file.)
+#define DEFAULT_APPLOCAL_WIDE_LOG_SIZE (100*1024)
+
+#define NGEN_LOG_HEADER_TEXT W("To learn about increasing the verbosity of the NGen log files please see http://go.microsoft.com/fwlink/?linkid=210113\r\n")
+
+// supported debug info types
+enum DebugType
+{
+ DT_NIL,
+ DT_PDB
+};
+
+//
+// IMPORTANT * IMPORTANT * IMPORTANT * IMPORTANT * IMPORTANT * IMPORTANT
+//
+// This structure cannot have any fields removed from it!!!
+//
+// IMPORTANT * IMPORTANT * IMPORTANT * IMPORTANT * IMPORTANT * IMPORTANT
+//
+// NGening a module invokes the runtime against which the module was built.
+// Thus this structure needs to be backwards-compatible.
+//
+// If additional options need to be added to this structure,
+// add them to the end of the structure and make sure you update
+// logic throughout the runtime to look at a different size in the dwSize
+// field. This is how we'll 'version' this structure.
+//
+// If you are adding a code-generation flag (like debug or prof), use
+// fInstrument as a template (but be sure to add your new flag as the
+// last element in the struct).
+
+typedef struct _NGenOptions
+{
+ DWORD dwSize; // Size of the structure. Used to version the structure
+
+ // V1
+
+ bool fDebug; // Generate debuggable code and debug information
+ bool fDebugOpt; // Generate debugging information, but optimized code
+ bool fProf; // Generate instrumented code for profiling (call graphs)
+
+ bool fSilent; // Dont spew text output
+ LPCWSTR lpszExecutableFileName; // Name of the module to ngen
+
+ // V2 (Whidbey)
+
+ bool fInstrument; // Generate instrumented code for basic-block profiling
+
+ // No longer supported
+ bool fWholeProgram; // Do cross function optimizations (whole program)
+
+ // No longer supported
+ bool fProfInfo; // Embed working set profiling data into the image
+
+ LPCWSTR lpszRepositoryDir; // Directory for repository of native images
+ RepositoryFlags repositoryFlags;
+
+ // No longer supported
+ DebugType dtRequested; // the requested debug type
+ LPCWSTR lpszDebugDir; // the name of the output debug dir for the above
+
+ // No longer supported
+ bool fNoInstall; // Creates stand alone ngen-images that can be installed in the NIC later
+
+ // No longer supported
+ bool fEmitFixups; // Support for Vulcan
+ bool fFatHeaders;
+
+ // Diagnostic flags
+ bool fVerbose; // print verbose descriptions of native images
+ unsigned uStats; // image stats mask
+
+#define LAST_WHIDBEY_NGENOPTION uStats
+
+ // V4
+ bool fNgenLastRetry; // Ngen has previously failed and this is the last retry
+
+ // V4.5
+ bool fAutoNGen; // This is an automatically generated NGen request
+
+ // Blue
+ bool fRepositoryOnly;// Install from repository only, no real NGen
+
+} NGenOptions;
+
+// Function pointer types that we use to dynamically bind to the appropriate runtime version
+extern "C" typedef HRESULT STDAPICALLTYPE
+ NGenCreateZapperAPI(
+ HANDLE* hZapper,
+ NGenOptions *options);
+typedef NGenCreateZapperAPI *PNGenCreateZapper;
+
+extern "C" typedef HRESULT STDAPICALLTYPE
+ NGenTryEnumerateFusionCacheAPI(
+ HANDLE hZapper,
+ LPCWSTR assemblyName,
+ bool fPrint,
+ bool fDelete);
+typedef NGenTryEnumerateFusionCacheAPI *PNGenTryEnumerateFusionCache;
+
+// The return type should really be HRESULT.
+// However, it is BOOL for backwards-compatibility
+extern "C" typedef BOOL STDAPICALLTYPE
+ NGenCompileAPI(
+ HANDLE hZapper,
+ LPCWSTR path);
+typedef NGenCompileAPI *PNGenCompile;
+
+extern "C" typedef HRESULT STDAPICALLTYPE
+ NGenFreeZapperAPI(
+ HANDLE hZapper);
+typedef NGenFreeZapperAPI *PNGenFreeZapper;
+
+class ILocalServerLifetime
+{
+public:
+ virtual void AddRefServerProcess() = 0;
+ virtual void ReleaseServerProcess() = 0;
+};
+
+struct ICorSvcLogger;
+
+extern "C" typedef HRESULT STDAPICALLTYPE
+ NGenCreateNGenWorkerAPI(
+ ICorSvcWorker **pCorSvcWorker,
+ ILocalServerLifetime *pLocalServerLifetime,
+ ICorSvcLogger *pCorSvcLogger
+ );
+typedef NGenCreateNGenWorkerAPI *PNGenCreateNGenWorker;
+
+#endif
diff --git a/src/inc/ngenparser.inl b/src/inc/ngenparser.inl
new file mode 100644
index 0000000000..cbe552cc18
--- /dev/null
+++ b/src/inc/ngenparser.inl
@@ -0,0 +1,1087 @@
+// 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.
+//*****************************************************************************
+// ngenparser.inl -- A parser for NGen commands
+//
+//*****************************************************************************
+
+// statics
+//
+
+namespace
+{
+ wchar_t const * FIXUPS_STAT_OPTION = W("fixups");
+ wchar_t const * CALLS_STAT_OPTION = W("calls");
+ wchar_t const * ATTRIB_STAT_OPTION = W("attributed");
+ wchar_t const * ALL_STAT_OPTION = W("all");
+}
+
+BOOL IsExe(const WCHAR *path)
+{
+ StackSString s(path);
+ SString::Iterator i;
+
+ if (s.GetCount() > 4)
+ {
+ i = s.End() - 4;
+ return s.MatchCaseInsensitive(i, SL(W(".exe")));
+ }
+ return false;
+}
+
+BOOL IsDll(const WCHAR *path)
+{
+ StackSString s(path);
+ SString::Iterator i;
+
+ if (s.GetCount() > 4)
+ {
+ i = s.End() - 4;
+ return s.MatchCaseInsensitive(i, SL(W(".dll")));
+ }
+ return false;
+}
+
+BOOL IsWinMD(const WCHAR *path)
+{
+ StackSString s(path);
+ SString::Iterator i;
+
+ if (s.GetCount() > 6)
+ {
+ i = s.End() - 6;
+ return s.MatchCaseInsensitive(i, SL(W(".winmd")));
+ }
+ return false;
+}
+
+BOOL IsExeOrDllOrWinMD(const WCHAR *path)
+{
+ return (IsExe(path) || IsDll(path) || IsWinMD(path));
+}
+
+
+void CanonicalizePathAux(const WCHAR *path, SString &s, BOOL bForceFileFound)
+{
+ const int FULLPATH_BUFFER_SIZE = MAX_PATH+1;
+ WCHAR * pwszFileName = NULL;
+ WCHAR wszFullPath[FULLPATH_BUFFER_SIZE];
+
+ DWORD nRet = WszGetFullPathName(path,
+ FULLPATH_BUFFER_SIZE,
+ wszFullPath,
+ &pwszFileName);
+
+ if (nRet != 0 && nRet <= FULLPATH_BUFFER_SIZE) {
+ // GetFullPathName merges the name of the current drive and directory with the specified
+ // file name to determine the full path and file name of the specified file.
+ // This function does not verify that the resulting path and file name are valid or that
+ // they see an existing file on the associated volume.
+
+ // Now let's verify that we do have a file pointed by the fullpath we just constructed.
+
+ DWORD attributes = WszGetFileAttributes(wszFullPath);
+ if (attributes != INVALID_FILE_ATTRIBUTES) {
+ // Found the file, return the path.
+ s.Set(wszFullPath);
+ return;
+ }
+ }
+
+ if (bForceFileFound) {
+ StackSString ssMsg(W("Error: The specified file or directory \""));
+ ssMsg.Append(path);
+ ssMsg.Append(W("\" is invalid."));
+
+ ThrowHR(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), ssMsg);
+ }
+ else {
+ s.Set(path); // return the input path.
+ }
+}
+
+void CanonicalizePath(const WCHAR *path, SString &s, BOOL bForceFileFound)
+{
+ //Instead of checking to see if it's a dll or exe, actually check to see if the file exists. Otherwise
+ //you can have a file that doesn't end in dll or exe stay as a relative path and then assert in fusion.
+ DWORD attributes = WszGetFileAttributes(path);
+
+ //Never treat a name ending in ".exe" or ".dll" as a strong name. This handles typos in filenames.
+ //Otherwise if you do install /queue on a filename and mistype it you only get the error on eqi/idle.
+ if ((attributes == INVALID_FILE_ATTRIBUTES || ((attributes & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY)) && !IsExeOrDllOrWinMD(path))
+ {
+ s.Set(path); // return the input path.
+ }
+ else
+ {
+ CanonicalizePathAux(path, s, bForceFileFound);
+ }
+}
+
+struct NewCommandLineOptions
+{
+ enum NGenAction
+ {
+ Action_Install,
+ Action_Uninstall,
+ Action_Update,
+ Action_Display,
+ Action_Finish,
+ Action_Queue,
+ Action_CreatePdb,
+ Action_RemoveTaskBootTrigger,
+ Action_RemoveTaskDelayStartTrigger,
+ };
+
+ NGenAction ngenAction;
+ BSTRHolder BSTRassemblyName;
+ OptimizationScenario optScenario;
+ UpdateFlags updateFlags;
+ GeneralFlags generalFlags;
+ BSTRHolder BSTRconfig;
+ BSTRHolder BSTRRepositoryDir;
+ RepositoryFlags repositoryFlags;
+ BSTRHolder BSTRRuntimeVersion;
+ BSTRHolder BSTRPackageMoniker;
+ BSTRHolder BSTRLocalAppData;
+
+ NGenPrivateAttributesClass ngenPrivateAttributes;
+
+ BOOL defer;
+ BOOL delay;
+ BOOL deferAlwaysOK;
+ BOOL noLogo;
+ BOOL legacyServiceBehavior;
+
+ CorSvcLogLevel logLevel;
+ PriorityLevel priority;
+ ControlServiceAction serviceAction;
+
+ BSTRHolder nativeImagePath;
+ BSTRHolder pdbPath;
+ BOOL pdbLines;
+ BSTRHolder managedPdbSearchPath;
+
+ NewCommandLineOptions() :
+ optScenario(ScenarioDefault),
+ updateFlags(UpdateDefault),
+ defer(FALSE),
+ delay(FALSE),
+ deferAlwaysOK(FALSE),
+ priority(Priority_Default),
+ noLogo(FALSE),
+ generalFlags(AllowPartialNames),
+ repositoryFlags(RepositoryDefault),
+ logLevel(LogLevel_Success),
+ serviceAction(Service_NoAction),
+ legacyServiceBehavior(FALSE),
+ pdbLines(FALSE)
+ {
+ }
+};
+
+
+
+//****************************************************************************
+
+
+// The INGenParserCallback is an abstract class that tell the NGen parser how to
+// handle output-related issues.
+class INGenParserCallback
+{
+public:
+ virtual void Output(const SString& str) = 0;
+ virtual void PrintLogo() = 0;
+ virtual void PrintUsage() = 0;
+ virtual void SetLoggingToFile(BOOL) = 0;
+};
+
+// The NGen parser is a class that parses and executes NGen commands. The two primary methods are
+// ParseNewCommandLine which parses NGen commands, and ProcessNewCommandLineOptions which executes
+// the NGen command. The user of the parser class is free to modify the parse output (NewCommandLineOptions)
+// before passing it to ProcessNewCommandLineOptions.
+class NGenParser
+{
+public:
+
+ NGenParser(INGenParserCallback *parserCallback)
+ {
+ this->parserCallback = parserCallback;
+ }
+
+ bool ParseNewCommandLine(int argc, LPCWSTR argv[], NewCommandLineOptions &opt)
+ {
+ return ParseNewCommandLineHelper(argc, argv, opt);
+ }
+
+ void ProcessNewCommandLineOptions(NewCommandLineOptions &opt,
+ ICorSvc *pCorSvc,
+ ICompileProgressNotification *pCompileProgressNotification,
+ ICorSvcLogger *pCorSvcLogger)
+ {
+ ProcessNewCommandLineOptionsHelper(opt, pCorSvc, pCompileProgressNotification, pCorSvcLogger);
+ }
+
+private:
+
+ void SetLoggingToFile(BOOL fLoggingToFile)
+ {
+ parserCallback->SetLoggingToFile(fLoggingToFile);
+ }
+
+ void PrintLogoHelper()
+ {
+ parserCallback->PrintLogo();
+ }
+
+ void PrintUsageHelper()
+ {
+ parserCallback->PrintUsage();
+ }
+
+ void Output(const SString& str)
+ {
+ parserCallback->Output(str);
+ }
+
+ void Output(LPCSTR str)
+ {
+ Output(SString(SString::Ascii, str));
+ }
+
+ void Output(LPCWSTR str)
+ {
+ Output(SString(str));
+ }
+
+ void Outputf(__in_z LPWSTR szFormat, ...)
+ {
+ StackSString formatted;
+
+ va_list args;
+ va_start(args, szFormat);
+ formatted.VPrintf(szFormat, args);
+ va_end(args);
+
+ Output(formatted);
+ }
+
+private:
+
+ LPCSTR ServiceStatusString(DWORD dwState)
+ {
+ switch (dwState)
+ {
+ case SERVICE_CONTINUE_PENDING: return "The .NET Runtime Optimization Service continue is pending.\n";
+ case SERVICE_PAUSE_PENDING: return "The .NET Runtime Optimization Service pause is pending.\n";
+ case SERVICE_PAUSED: return "The .NET Runtime Optimization Service is started and paused.\n";
+ case SERVICE_RUNNING: return "The .NET Runtime Optimization Service is running.\n";
+ case SERVICE_START_PENDING: return "The .NET Runtime Optimization Service is starting.\n";
+ case SERVICE_STOP_PENDING: return "The .NET Runtime Optimization Service is stopping.\n";
+ case SERVICE_STOPPED: return "The .NET Runtime Optimization Service is stopped.\n";
+ }
+
+ return "Unknown state";
+ }
+
+ bool IsScenario(LPCWSTR arg, OptimizationScenario *optScenario)
+ {
+ DWORD *pScenario = (DWORD *) optScenario;
+
+ if ((arg[0] == W('-')) || (arg[0] == W('/')))
+ {
+ arg++;
+
+ if (SString::_wcsicmp(arg, W("Debug")) == 0)
+ {
+ *pScenario |= ScenarioDebug;
+ }
+ else if (SString::_wcsicmp(arg, W("Profile")) == 0)
+ {
+ *pScenario |= ScenarioProfile;
+ }
+ else if (SString::_wcsicmp(arg, W("Tuning")) == 0)
+ {
+ *pScenario |= ScenarioTuningDataCollection;
+ }
+ else if (SString::_wcsicmp(arg, W("NoDependencies")) == 0)
+ {
+ *pScenario |= ScenarioLegacy;
+ }
+ else
+ {
+ return false;
+ }
+
+ return true;
+ }
+
+ return false;
+ }
+
+ bool IsCommandLineOption(LPCWSTR arg, NewCommandLineOptions &options)
+ {
+ if (options.ngenAction == NewCommandLineOptions::Action_Finish)
+ {
+ if (arg[0] == W('0')) { options.priority = Priority_0; return true;}
+ if (arg[0] == W('1')) { options.priority = Priority_1; return true;}
+ if (arg[0] == W('2')) { options.priority = Priority_2; return true;}
+ if (arg[0] == W('3')) { options.priority = Priority_3; return true;}
+ }
+
+ if (options.ngenAction == NewCommandLineOptions::Action_CreatePdb)
+ {
+ if (options.nativeImagePath == NULL) {
+
+ options.nativeImagePath.Assign(::SysAllocString(arg));
+ return true;
+
+ } else if (options.pdbPath == NULL) {
+
+ options.pdbPath.Assign(::SysAllocString(arg));
+ return true;
+
+ } else if (options.pdbLines && (options.managedPdbSearchPath == NULL)) {
+
+ options.managedPdbSearchPath.Assign(::SysAllocString(arg));
+ return true;
+ }
+ }
+
+ if (options.ngenAction == NewCommandLineOptions::Action_Queue)
+ {
+ if (SString::_wcsicmp(arg, W("scmstart")) == 0)
+ {
+ options.serviceAction = Service_Start;
+ return true;
+ }
+ else if (SString::_wcsicmp(arg, W("scmpause")) == 0)
+ {
+ options.serviceAction = Service_Pause;
+ return true;
+ }
+ else if (SString::_wcsicmp(arg, W("scmstop")) == 0)
+ {
+ options.serviceAction = Service_Stop;
+ return true;
+ }
+ else if (SString::_wcsicmp(arg, W("scmcontinue")) == 0)
+ {
+ options.serviceAction = Service_Continue;
+ return true;
+ }
+ else if (SString::_wcsicmp(arg, W("scmstatus")) == 0)
+ {
+ options.serviceAction = Service_Interrogate;
+ return true;
+ }
+ else if (SString::_wcsicmp(arg, W("pause")) == 0)
+ {
+ options.serviceAction = Service_StartPaused;
+ return true;
+ }
+ else if (SString::_wcsicmp(arg, W("continue")) == 0)
+ {
+ options.serviceAction = Service_Continue;
+ return true;
+ }
+ else if (SString::_wcsicmp(arg, W("status")) == 0)
+ {
+ options.serviceAction = Service_Interrogate;
+ return true;
+ }
+ }
+
+ if ((arg[0] == W('-')) || (arg[0] == W('/')))
+ {
+ arg++;
+
+ if (SString::_wcsicmp(arg, W("Silent")) == 0)
+ {
+ options.logLevel = LogLevel_Warning;
+ } else if (SString::_wcsicmp(arg, W("Verbose")) == 0)
+ {
+ options.logLevel = LogLevel_Info;
+ } else if ((options.ngenAction == NewCommandLineOptions::Action_Update) && (SString::_wcsicmp(arg, W("Force")) == 0)) {
+ options.updateFlags = (UpdateFlags)(options.updateFlags | Force);
+ }
+ else if ((options.ngenAction == NewCommandLineOptions::Action_Update) && (_wcsicmp(arg, W("Postreboot")) == 0))
+ {
+ options.priority = Priority_Default;
+ options.updateFlags = (UpdateFlags)(options.updateFlags | PostReboot);
+ }
+ else if ( (options.ngenAction == NewCommandLineOptions::Action_Install ||
+ options.ngenAction == NewCommandLineOptions::Action_Update) &&
+ SString::_wcsicmp(arg, W("Queue")) == 0)
+ {
+ options.defer = TRUE;
+ options.priority = Priority_Default;
+ } else if (options.ngenAction == NewCommandLineOptions::Action_Install &&
+ SString::_wcsicmp(arg, W("Queue:1")) == 0)
+ {
+ options.defer = TRUE;
+ options.priority = Priority_1;
+ } else if (options.ngenAction == NewCommandLineOptions::Action_Install &&
+ SString::_wcsicmp(arg, W("Queue:2")) == 0)
+ {
+ options.defer = TRUE;
+ options.priority = Priority_2;
+ } else if (options.ngenAction == NewCommandLineOptions::Action_Install &&
+ SString::_wcsicmp(arg, W("Queue:3")) == 0)
+ {
+ options.defer = TRUE;
+ options.priority = Priority_3;
+ } else if (options.ngenAction == NewCommandLineOptions::Action_Update &&
+ SString::_wcsicmp(arg, W("Delay")) == 0)
+ {
+ options.delay = TRUE;
+ } else if (options.ngenAction == NewCommandLineOptions::Action_Install &&
+ SString::_wcsicmp(arg, W("NetfxPri1")) == 0)
+ {
+ options.generalFlags = (GeneralFlags)(options.generalFlags | KeepPriority);
+ } else if ((options.ngenAction == NewCommandLineOptions::Action_CreatePdb) &&
+ SString::_wcsicmp(arg, W("lines")) == 0)
+ {
+ options.pdbLines = TRUE;
+ } else if (SString::_wcsicmp(arg, W("NoLogo")) == 0)
+ {
+ options.noLogo = TRUE;
+ } else if (SString::_wcsicmp(arg, W("NoRoot")) == 0)
+ {
+ options.generalFlags = (GeneralFlags)(options.generalFlags | NoRoot);
+ } else if (SString::_wcsicmp(arg, W("LegacyServiceBehavior")) == 0)
+ {
+ options.legacyServiceBehavior = TRUE;
+ } else
+ {
+ // See if the input is one of:
+ // /ExeConfig:<exe>
+ // /AppBase:<dir>
+ // /MoveFromRepository:<dir>
+ // /CopyFromRepository:<dir>
+ // /CopyToRepository:<dir>
+ // /Stats:<stats>
+ // /Version:<runtime version>
+ // /Package:<package moniker>
+ // /LocalAppData:<local app data directory>
+ StackSString ssArg(arg);
+ StackSString ssExeConfig(W("ExeConfig:"));
+ StackSString ssAppBase(W("AppBase:"));
+ StackSString ssMoveFromRepository(W("MoveFromRepository:"));
+ StackSString ssCopyFromRepository(W("CopyFromRepository:"));
+ StackSString ssCopyToRepository(W("CopyToRepository:"));
+ StackSString ssVersion(W("Version:"));
+ StackSString ssPackage(W("Package:"));
+ StackSString ssLocalAppData(W("LocalAppData:"));
+ StackSString ssStats(W("Stats"));
+ StackSString ssStatsWithOption(ssStats); ssStatsWithOption += W(':');
+
+ if (ssArg.MatchCaseInsensitive(ssArg.Begin(), ssExeConfig))
+ {
+ if (IsNgenOffline())
+ {
+ ThrowHR(E_INVALIDARG, SL(W("Error: Cannot use /ExeConfig with the Ngen Offline feature.")));
+ }
+
+ if (!options.BSTRconfig.IsNull()) {
+ PrintLogoHelper();
+ ThrowHR(E_INVALIDARG, SL(W("Error: Cannot specify both /ExeConfig and /AppBase")));
+ }
+
+ ssArg.Delete(ssArg.Begin(), ssExeConfig.GetCount());
+
+ if (!IsExe(ssArg.GetUnicode())) {
+ PrintLogoHelper();
+ ThrowHR(E_INVALIDARG, SL(W("Error: /ExeConfig specified without an executable")));
+ }
+
+ StackSString ss;
+ EX_TRY
+ {
+ CanonicalizePath(ssArg.GetUnicode(), ss, TRUE);
+ }
+ EX_CATCH
+ {
+ PrintLogoHelper();
+ EX_RETHROW;
+ }
+ EX_END_CATCH(SwallowAllExceptions)
+
+ options.BSTRconfig.Assign(::SysAllocString(ss.GetUnicode()));
+ return true;
+ }
+ else if (ssArg.MatchCaseInsensitive(ssArg.Begin(), ssAppBase))
+ {
+ if (IsNgenOffline())
+ {
+ ThrowHR(E_INVALIDARG, SL(W("Error: Cannot use /AppBase with the Ngen Offline feature.")));
+ }
+
+ if (!options.BSTRconfig.IsNull()) {
+ PrintLogoHelper();
+ ThrowHR(E_INVALIDARG, SL(W("Error: Cannot specify both /ExeConfig and /AppBase")));
+ }
+
+ ssArg.Delete(ssArg.Begin(), ssAppBase.GetCount());
+
+ StackSString ss;
+
+ EX_TRY
+ {
+ CanonicalizePathAux(ssArg.GetUnicode(), ss, TRUE);
+ }
+ EX_CATCH
+ {
+ PrintLogoHelper();
+ EX_RETHROW;
+ }
+ EX_END_CATCH(SwallowAllExceptions)
+
+ DWORD attributes = WszGetFileAttributes(ss.GetUnicode());
+ if ((attributes == INVALID_FILE_ATTRIBUTES) ||
+ ((attributes & FILE_ATTRIBUTE_DIRECTORY) != FILE_ATTRIBUTE_DIRECTORY)) {
+ PrintLogoHelper();
+ ThrowHR(E_INVALIDARG, SL(W("Error: /AppBase specified without a valid directory")));
+ }
+
+ options.BSTRconfig.Assign(::SysAllocString(ss.GetUnicode()));
+ return true;
+ }
+ else if (ssArg.MatchCaseInsensitive(ssArg.Begin(), ssMoveFromRepository))
+ {
+ if (options.BSTRRepositoryDir != NULL)
+ ThrowHR(E_INVALIDARG, SL(W("Error: Cannot specify multiple repository options")));
+
+ StackSString ssFullPath;
+ CanonicalizePathAux(ssArg.GetUnicode() + ssMoveFromRepository.GetCount(), ssFullPath, FALSE);
+ options.BSTRRepositoryDir = ::SysAllocString(ssFullPath.GetUnicode());
+ options.repositoryFlags = (RepositoryFlags)(options.repositoryFlags | MoveFromRepository);
+ return true;
+ }
+ else if (ssArg.MatchCaseInsensitive(ssArg.Begin(), ssCopyFromRepository))
+ {
+ if (options.BSTRRepositoryDir != NULL)
+ ThrowHR(E_INVALIDARG, SL(W("Error: Cannot specify multiple repository options")));
+
+ StackSString ssFullPath;
+ CanonicalizePathAux(ssArg.GetUnicode() + ssCopyFromRepository.GetCount(), ssFullPath, FALSE);
+ options.BSTRRepositoryDir = ::SysAllocString(ssFullPath.GetUnicode());
+ return true;
+ }
+ else if (ssArg.MatchCaseInsensitive(ssArg.Begin(), ssCopyToRepository))
+ {
+ if (options.BSTRRepositoryDir != NULL)
+ ThrowHR(E_INVALIDARG, SL(W("Error: Cannot specify multiple repository options")));
+
+ StackSString ssFullPath;
+ CanonicalizePathAux(ssArg.GetUnicode() + ssCopyToRepository.GetCount(), ssFullPath, TRUE);
+ options.BSTRRepositoryDir = ::SysAllocString(ssFullPath.GetUnicode());
+ options.repositoryFlags = (RepositoryFlags)(options.repositoryFlags | CopyToRepository);
+
+ if (options.ngenAction == NewCommandLineOptions::Action_Update)
+ options.updateFlags = (UpdateFlags)(options.updateFlags | Force);
+
+ return true;
+ }
+ else if (ssArg.MatchCaseInsensitive(ssArg.Begin(), ssVersion))
+ {
+ if (options.BSTRRuntimeVersion != NULL)
+ ThrowHR(E_INVALIDARG, SL(W("Error: Cannot specify multiple runtime versions")));
+
+ ssArg.Delete(ssArg.Begin(), ssVersion.GetCount());
+ options.BSTRRuntimeVersion = ::SysAllocString(ssArg.GetUnicode());
+
+ return true;
+ }
+ else if (ssArg.MatchCaseInsensitive(ssArg.Begin(), ssPackage))
+ {
+ if (options.BSTRPackageMoniker != NULL)
+ ThrowHR(E_INVALIDARG, SL(W("Error: Cannot specify multiple package monikers")));
+
+ ssArg.Delete(ssArg.Begin(), ssPackage.GetCount());
+ options.BSTRPackageMoniker = ::SysAllocString(ssArg.GetUnicode());
+
+ return true;
+ }
+ else if (ssArg.MatchCaseInsensitive(ssArg.Begin(), ssLocalAppData))
+ {
+ if (options.BSTRLocalAppData != NULL)
+ ThrowHR(E_INVALIDARG, SL(W("Error: Cannot specify multiple localappdata directories")));
+
+ ssArg.Delete(ssArg.Begin(), ssLocalAppData.GetCount());
+ options.BSTRLocalAppData = ::SysAllocString(ssArg.GetUnicode());
+
+ return true;
+ }
+ else if (ssArg.EqualsCaseInsensitive(ssStats))
+ {
+ options.ngenPrivateAttributes.ZapStats = ZapperOptions::DEFAULT_STATS;
+ return true;
+ }
+ else if (ssArg.MatchCaseInsensitive(ssArg.Begin(), ssStatsWithOption))
+ {
+ ssArg.Delete(ssArg.Begin(), ssStatsWithOption.GetCount());
+
+ if (ssArg.EqualsCaseInsensitive(FIXUPS_STAT_OPTION))
+ {
+ options.ngenPrivateAttributes.ZapStats = ZapperOptions::FIXUP_STATS;
+ }
+ else if (ssArg.EqualsCaseInsensitive(CALLS_STAT_OPTION))
+ {
+ options.ngenPrivateAttributes.ZapStats = ZapperOptions::CALL_STATS;
+ }
+ else if (ssArg.EqualsCaseInsensitive(ATTRIB_STAT_OPTION))
+ {
+ options.ngenPrivateAttributes.ZapStats = ZapperOptions::ATTRIB_STATS;
+ }
+ else if (ssArg.EqualsCaseInsensitive(ALL_STAT_OPTION))
+ {
+ options.ngenPrivateAttributes.ZapStats = ZapperOptions::ALL_STATS;
+ }
+ else
+ {
+ // We have an option of the form "/Stats:<int>"
+ int statsVal = _wtoi(ssArg.GetUnicode());
+ if (statsVal == 0) {
+ PrintLogoHelper();
+ ThrowHR(E_INVALIDARG, SL(W("Error: Unrecognized option used for /Stats:<option>")));
+ }
+ options.ngenPrivateAttributes.ZapStats = statsVal;
+ }
+
+ return true;
+ }
+
+ return false;
+ }
+
+ return true;
+ }
+
+ return false;
+ }
+
+ bool ParseNewCommandLineHelper(int argc, LPCWSTR argv[], NewCommandLineOptions &opt)
+ {
+ if (argc < 1) return false;
+
+ // Determine the action
+ LPCWSTR action = argv[0];
+ argc--;
+ argv++;
+
+ if (SString::_wcsicmp(action, W("install")) == 0)
+ opt.ngenAction = NewCommandLineOptions::Action_Install;
+ else if (SString::_wcsicmp(action, W("uninstall")) == 0)
+ {
+ opt.ngenAction = NewCommandLineOptions::Action_Uninstall;
+ opt.optScenario = ScenarioAll;
+ }
+ else if (SString::_wcsicmp(action, W("update")) == 0)
+ opt.ngenAction = NewCommandLineOptions::Action_Update;
+ else if (SString::_wcsicmp(action, W("display")) == 0)
+ {
+ opt.ngenAction = NewCommandLineOptions::Action_Display;
+ }
+ else if ((SString::_wcsicmp(action, W("executeQueuedItems")) == 0) ||
+ (SString::_wcsicmp(action, W("eqi")) == 0))
+ {
+ opt.ngenAction = NewCommandLineOptions::Action_Finish;
+ opt.priority = Priority_Lowest;
+ }
+ else if (SString::_wcsicmp(action, W("queue")) == 0)
+ {
+ opt.ngenAction = NewCommandLineOptions::Action_Queue;
+ }
+ else if (SString::_wcsicmp(action, W("createpdb")) == 0)
+ {
+ opt.ngenAction = NewCommandLineOptions::Action_CreatePdb;
+ }
+ else if (SString::_wcsicmp(action, W("removetaskboottrigger")) == 0)
+ {
+ opt.ngenAction = NewCommandLineOptions::Action_RemoveTaskBootTrigger;
+ }
+ else if (SString::_wcsicmp(action, W("removetaskdelaystarttrigger")) == 0)
+ {
+ opt.ngenAction = NewCommandLineOptions::Action_RemoveTaskDelayStartTrigger;
+ }
+ else return false;
+
+ // Look for optional args before the assembly path
+
+ while (argc > 0)
+ {
+ LPCWSTR arg = argv[0];
+
+ if (!IsScenario(arg, &opt.optScenario) &&
+ !IsCommandLineOption(arg, opt))
+ {
+ break;
+ }
+
+ argc--;
+ argv++;
+ }
+
+ // Determine the assembly path. If the argument starts with / or -, then it must be
+ // an ngen option, otherwise assume its an assembly name
+ if ((opt.ngenAction == NewCommandLineOptions::Action_Install) ||
+ (opt.ngenAction == NewCommandLineOptions::Action_Uninstall) ||
+ (opt.ngenAction == NewCommandLineOptions::Action_Display))
+ {
+ if (argc < 1) return true;
+ StackSString assemblyName;
+ if ((argv[0][0] != W('-')) && (argv[0][0] != W('/')))
+ {
+ BOOL bForceFileFound = (opt.ngenAction == NewCommandLineOptions::Action_Install ||
+ opt.ngenAction == NewCommandLineOptions::Action_Display);
+ CanonicalizePath(argv[0], assemblyName, bForceFileFound);
+ if (IsNgenOffline() && IsExeOrDllOrWinMD(assemblyName.GetUnicode()))
+ {
+ ThrowHR(HRESULT_FROM_WIN32(ERROR_BAD_ARGUMENTS),
+ SL(W("Error: Only strong-named assemblies are allowed with offline ngen")));
+ }
+ opt.BSTRassemblyName.Assign(::SysAllocString(assemblyName.GetUnicode()));
+ argc--;
+ argv++;
+ }
+ }
+
+ // Parse the optional arguments
+ while (argc > 0)
+ {
+ LPCWSTR arg = argv[0];
+ argc--;
+ argv++;
+
+ if (!IsScenario(arg, &opt.optScenario) &&
+ !IsCommandLineOption(arg, opt))
+ {
+ PrintLogoHelper();
+ StackSString s;
+ s.Printf(W("Error: Unrecognized option %s\n"), arg);
+ PrintUsageHelper();
+ ThrowHR(E_INVALIDARG, s);
+ }
+ }
+
+ // If uninstall command line specifies a scenario, remove the ScenarioAll flag
+ if (opt.ngenAction == NewCommandLineOptions::Action_Uninstall)
+ {
+ if (opt.optScenario != ScenarioAll)
+ *((DWORD *) &opt.optScenario) &= ~ScenarioAll;
+ }
+
+ return true;
+ }
+
+ void ProcessNewCommandLineOptionsHelper(NewCommandLineOptions &opt,
+ ICorSvc *pCorSvc,
+ ICompileProgressNotification *pCompileProgressNotification,
+ ICorSvcLogger *pCorSvcLogger)
+ {
+ HRESULT hr;
+
+ if (CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_NGENUseService) == 0)
+ {
+ opt.defer = FALSE;
+ }
+
+ ReleaseHolder<IUnknown> pIUnknownServiceManager;
+ IfFailThrow(pCorSvc->GetServiceManagerInterface(&pIUnknownServiceManager));
+ ReleaseHolder<ICorSvcInstaller> pCorSvcInstaller;
+ IfFailThrow(pIUnknownServiceManager->QueryInterface(IID_ICorSvcInstaller, &pCorSvcInstaller));
+ pCorSvcInstaller->SetLogger(pCorSvcLogger);
+
+ ReleaseHolder<ICorSvcAdvancedInstaller> pCorSvcAdvancedInstaller;
+ ReleaseHolder<ICorSvcOptimizer> pCorSvcOptimizer;
+ ReleaseHolder<ICorSvcOptimizer3> pCorSvcOptimizer3;
+ ReleaseHolder<ICorSvcManager> pCorSvcManager;
+ ReleaseHolder<ICorSvcManager2> pCorSvcManager2;
+
+ if (!opt.noLogo && opt.logLevel >= LogLevel_Success)
+ PrintLogoHelper();
+
+ if (CLRConfig::GetConfigValue(CLRConfig::EXTERNAL_ZapDisable) != 0 &&
+ opt.ngenAction != NewCommandLineOptions::Action_Display)
+ {
+ Output(W("Warning: ZapDisable is turned on.\n"));
+ }
+
+ if ((opt.generalFlags & NoRoot) != 0)
+ {
+ if (opt.defer)
+ {
+ ThrowHR(HRESULT_FROM_WIN32(ERROR_BAD_ARGUMENTS), SL(W("Error: Cannot use /NoRoot with /Queue.")));
+ }
+ if ((opt.ngenAction != NewCommandLineOptions::Action_Install) &&
+ (opt.ngenAction != NewCommandLineOptions::Action_Uninstall) &&
+ (opt.ngenAction != NewCommandLineOptions::Action_CreatePdb))
+ {
+ ThrowHR(HRESULT_FROM_WIN32(ERROR_BAD_ARGUMENTS), SL(W("Error: /NoRoot can only be used with Install or Uninstall or CreatePDB commands.")));
+ }
+ if (opt.ngenAction == NewCommandLineOptions::Action_Uninstall && (opt.optScenario != ScenarioAll || opt.BSTRconfig != NULL))
+ {
+ ThrowHR(HRESULT_FROM_WIN32(ERROR_BAD_ARGUMENTS), SL(W("Error: Scenario, /ExeConfig or /AppBase not allowed with Uninstall /NoRoot command.")));
+ }
+ }
+
+ if ((opt.BSTRPackageMoniker == NULL) != (opt.BSTRLocalAppData == NULL))
+ {
+ ThrowHR(HRESULT_FROM_WIN32(ERROR_BAD_ARGUMENTS), SL(W("Error: If either /Package or /LocalAppData is specified, then BOTH must be specified.")));
+ }
+
+ if (opt.BSTRPackageMoniker != NULL)
+ {
+ if ((opt.generalFlags & NoRoot) == 0)
+ {
+ ThrowHR(HRESULT_FROM_WIN32(ERROR_BAD_ARGUMENTS), SL(W("Error: Cannot use /Package without /NoRoot.")));
+ }
+ if (opt.ngenAction == NewCommandLineOptions::Action_Install && (opt.optScenario & ScenarioLegacy) == 0)
+ {
+ ThrowHR(HRESULT_FROM_WIN32(ERROR_BAD_ARGUMENTS), SL(W("Error: Install /Package requires /NoDependencies.")));
+ }
+ }
+
+ if (opt.BSTRRuntimeVersion != NULL || opt.BSTRPackageMoniker != NULL || opt.BSTRLocalAppData != NULL)
+ {
+ // We could have made /Version and /Package working with all commands, but for simplicity we currently only
+ // support install, uninstall, and createpdb.
+ if ((opt.ngenAction != NewCommandLineOptions::Action_Install) &&
+ (opt.ngenAction != NewCommandLineOptions::Action_Uninstall) &&
+ (opt.ngenAction != NewCommandLineOptions::Action_CreatePdb))
+ {
+ ThrowHR(HRESULT_FROM_WIN32(ERROR_BAD_ARGUMENTS), SL(W("Error: /Version, /LocalAppData and /Package can only be used with Install or Uninstall or CreatePDB commands.")));
+ }
+ }
+
+ ReleaseHolder<ICorSvcRepository> pCorSvcRepository;
+ IfFailThrow(pCorSvcInstaller->QueryInterface(IID_ICorSvcRepository, &pCorSvcRepository));
+ IfFailThrow(pCorSvcRepository->SetRepository(opt.BSTRRepositoryDir, opt.repositoryFlags));
+
+ ReleaseHolder<ICorSvcSetPrivateAttributes> pCorSvcSetPrivateAttributes;
+ IfFailThrow(pCorSvcInstaller->QueryInterface(IID_ICorSvcSetPrivateAttributes, &pCorSvcSetPrivateAttributes));
+ IfFailThrow(pCorSvcSetPrivateAttributes->SetNGenPrivateAttributes(opt.ngenPrivateAttributes));
+
+ if (opt.BSTRRuntimeVersion != NULL)
+ {
+ if (pCorSvcManager2 == NULL)
+ {
+ IfFailThrow(pCorSvcInstaller->QueryInterface(IID_ICorSvcManager2, &pCorSvcManager2));
+ }
+ IfFailThrow(pCorSvcManager2->SetRuntimeVersion(opt.BSTRRuntimeVersion));
+ }
+
+ if (opt.BSTRPackageMoniker != NULL)
+ {
+ if (pCorSvcManager2 == NULL)
+ {
+ IfFailThrow(pCorSvcInstaller->QueryInterface(IID_ICorSvcManager2, &pCorSvcManager2));
+ }
+ IfFailThrow(pCorSvcManager2->SetPackageMoniker(opt.BSTRPackageMoniker));
+ }
+
+ if (opt.BSTRLocalAppData != NULL)
+ {
+ if (pCorSvcManager2 == NULL)
+ {
+ IfFailThrow(pCorSvcInstaller->QueryInterface(IID_ICorSvcManager2, &pCorSvcManager2));
+ }
+ IfFailThrow(pCorSvcManager2->SetLocalAppData(opt.BSTRLocalAppData));
+ }
+
+ if (opt.legacyServiceBehavior)
+ {
+ ReleaseHolder<ICorSvcSetLegacyServiceBehavior> pCorSvcSetLegacyServiceBehavior;
+ IfFailThrow(pCorSvcInstaller->QueryInterface(IID_ICorSvcSetLegacyServiceBehavior, &pCorSvcSetLegacyServiceBehavior));
+ IfFailThrow(pCorSvcSetLegacyServiceBehavior->SetLegacyServiceBehavior());
+ }
+
+ StackSString assemblyName(opt.BSTRassemblyName);
+
+ switch(opt.ngenAction)
+ {
+ case NewCommandLineOptions::Action_Install:
+ if (opt.BSTRassemblyName.IsNull() || assemblyName.IsEmpty()) {
+ ThrowHR(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
+ SL(W("Error: You must specify an assembly to install.")));
+ }
+ if ((opt.generalFlags & KeepPriority) != 0 && (!opt.defer || opt.priority != Priority_1))
+ ThrowHR(HRESULT_FROM_WIN32(ERROR_BAD_ARGUMENTS),
+ SL(W("Error: Cannot use /NetfxPri1 without /Queue:1.")));
+ IfFailThrow(pCorSvcInstaller->QueryInterface(IID_ICorSvcAdvancedInstaller, &pCorSvcAdvancedInstaller));
+ IfFailThrow(pCorSvcInstaller->QueryInterface(IID_ICorSvcManager, &pCorSvcManager));
+ IfFailThrow(pCorSvcAdvancedInstaller->Install(opt.BSTRassemblyName, opt.optScenario,
+ opt.BSTRconfig, opt.generalFlags, opt.priority));
+ if (opt.defer)
+ {
+ IfFailThrow(pCorSvcManager->NotifyService(NewWorkAvailable));
+ }
+ else
+ {
+ IfFailThrow(pCorSvcInstaller->Optimize(pCompileProgressNotification, DefaultOptimizeFlags));
+ }
+ break;
+
+ case NewCommandLineOptions::Action_Uninstall:
+ if (opt.BSTRassemblyName.IsNull() || assemblyName.IsEmpty()) {
+ ThrowHR(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND),
+ SL(W("Error: You must specify an assembly to uninstall.")));
+ }
+
+ if (opt.defer && !opt.deferAlwaysOK)
+ ThrowHR(HRESULT_FROM_WIN32(ERROR_BAD_ARGUMENTS),
+ SL(W("Error: Cannot queue an uninstall action")));
+
+ IfFailThrow(pCorSvcInstaller->QueryInterface(IID_ICorSvcManager, &pCorSvcManager));
+ IfFailThrow(pCorSvcInstaller->QueryInterface(IID_ICorSvcAdvancedInstaller, &pCorSvcAdvancedInstaller));
+ hr = pCorSvcAdvancedInstaller->Uninstall(opt.BSTRassemblyName, opt.optScenario, opt.BSTRconfig, opt.generalFlags);
+ if (hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND))
+ ThrowHR(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), SL(W("Error: The specified assembly is not installed.")));
+ IfFailThrow(hr);
+ if (opt.defer)
+ {
+ IfFailThrow(pCorSvcManager->NotifyService(NewWorkAvailable));
+ }
+ else
+ {
+ IfFailThrow(pCorSvcInstaller->Optimize(pCompileProgressNotification, DefaultOptimizeFlags));
+ }
+ break;
+
+ case NewCommandLineOptions::Action_Update:
+ IfFailThrow(pCorSvcInstaller->QueryInterface(IID_ICorSvcOptimizer, &pCorSvcOptimizer));
+ IfFailThrow(pCorSvcInstaller->QueryInterface(IID_ICorSvcManager, &pCorSvcManager));
+
+ _ASSERTE(opt.priority == Priority_Default);
+
+ if ((opt.updateFlags & PostReboot) && !opt.defer)
+ {
+ ThrowHR(HRESULT_FROM_WIN32(ERROR_BAD_ARGUMENTS),
+ SL(W("Error: /postreboot requires the use of /queue option.")));
+ }
+
+ if (opt.delay && !opt.defer)
+ {
+ ThrowHR(HRESULT_FROM_WIN32(ERROR_BAD_ARGUMENTS),
+ SL(W("Error: /delay requires the use of /queue option.")));
+ }
+
+ if (opt.BSTRassemblyName != NULL)
+ {
+ ThrowHR(HRESULT_FROM_WIN32(ERROR_BAD_ARGUMENTS),
+ SL(W("Error: Cannot specify an assembly name to update")));
+ }
+
+ hr = pCorSvcOptimizer->Update(opt.BSTRassemblyName, opt.updateFlags, opt.generalFlags);
+ if (hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND))
+ {
+ ThrowHR(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), SL(W("Error: The specified assembly is not installed.")));
+ }
+ else
+ {
+ IfFailThrow(hr);
+ }
+
+ if (opt.defer)
+ {
+ IfFailThrow(pCorSvcManager->NotifyService(opt.delay ? NewWorkAvailableWithDelay : NewWorkAvailable));
+ }
+ else
+ {
+ IfFailThrow(pCorSvcInstaller->Optimize(pCompileProgressNotification, TolerateCompilationFailures));
+ }
+ break;
+
+ case NewCommandLineOptions::Action_Display:
+ IfFailThrow(pCorSvcInstaller->QueryInterface(IID_ICorSvcOptimizer, &pCorSvcOptimizer));
+ SetLoggingToFile(FALSE);
+ hr = pCorSvcOptimizer->Display(opt.BSTRassemblyName, opt.generalFlags);
+ SetLoggingToFile(TRUE);
+ if (hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND))
+ ThrowHR(HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND), SL(W("Error: The specified assembly is not installed.")));
+ IfFailThrow(hr);
+ break;
+
+ case NewCommandLineOptions::Action_Finish:
+
+ if (opt.defer)
+ ThrowHR(HRESULT_FROM_WIN32(ERROR_BAD_ARGUMENTS),
+ SL(W("Error: Cannot queue an ExecuteQueuedItems action")));
+
+ IfFailThrow(pCorSvcInstaller->QueryInterface(IID_ICorSvcOptimizer, &pCorSvcOptimizer));
+
+ // NGen Queue work needs to be completed before ScheduleWork is called for the other priorities
+ IfFailThrow(pCorSvcOptimizer->ScheduleWork(Priority_0));
+ IfFailThrow(pCorSvcInstaller->Optimize(pCompileProgressNotification, (OptimizeFlags) (TolerateCompilationFailures | OptimizeNGenQueueOnly)));
+
+ // Now do the rest of it.
+ IfFailThrow(pCorSvcOptimizer->ScheduleWork(opt.priority));
+ IfFailThrow(pCorSvcInstaller->Optimize(pCompileProgressNotification, TolerateCompilationFailures));
+
+
+ break;
+ case NewCommandLineOptions::Action_Queue:
+ {
+ Output("\n");
+
+ if (IsNgenOffline())
+ {
+ ThrowHR(HRESULT_FROM_WIN32(ERROR_BAD_ARGUMENTS),
+ SL(W("Error: Cannot interact with the service when using the offline ngen feature")));
+ }
+
+ if (opt.serviceAction == Service_NoAction)
+ {
+ ThrowHR(HRESULT_FROM_WIN32(ERROR_BAD_ARGUMENTS),
+ SL(W("Error: queue action must be pause|continue|status")));
+ }
+
+ COR_SERVICE_STATUS status;
+ IfFailThrow(pCorSvc->ControlService(opt.serviceAction, &status));
+
+ if (opt.serviceAction == Service_Interrogate)
+ {
+ Output("Service name is: "); Output(status.sServiceName); Output("\n");
+ }
+
+ Output(ServiceStatusString(status.dwCurrentState));
+
+ break;
+ }
+
+ case NewCommandLineOptions::Action_CreatePdb: {
+ if (opt.nativeImagePath == NULL || opt.pdbPath == NULL)
+ ThrowHR(HRESULT_FROM_WIN32(ERROR_BAD_ARGUMENTS),
+ SL(W("Error: insufficient number of arguments to createpdb")));
+
+ IfFailThrow(pIUnknownServiceManager->QueryInterface(IID_ICorSvcOptimizer3, &pCorSvcOptimizer3));
+ IfFailThrow(pCorSvcOptimizer3->CreatePdb2(opt.nativeImagePath, opt.pdbPath, opt.pdbLines, opt.managedPdbSearchPath));
+ break;
+ }
+ case NewCommandLineOptions::Action_RemoveTaskBootTrigger: {
+
+ ReleaseHolder<ICorSvcSetTaskBootTriggerState> pCorSvcSetTaskBootTriggerState;
+ IfFailThrow(pCorSvcInstaller->QueryInterface(IID_ICorSvcSetTaskBootTriggerState, &pCorSvcSetTaskBootTriggerState));
+ IfFailThrow(pCorSvcSetTaskBootTriggerState->SetTaskBootTriggerState(FALSE));
+ Output("Task boot trigger removed\n");
+ break;
+ }
+ case NewCommandLineOptions::Action_RemoveTaskDelayStartTrigger:
+ {
+ ReleaseHolder<ICorSvcSetTaskDelayStartTriggerState> pCorSvcSetTaskDelayStartTriggerState;
+ IfFailThrow(pCorSvcInstaller->QueryInterface(IID_ICorSvcSetTaskDelayStartTriggerState, &pCorSvcSetTaskDelayStartTriggerState));
+ IfFailThrow(pCorSvcSetTaskDelayStartTriggerState->SetTaskDelayStartTriggerState(FALSE));
+ Output("Task delay start trigger removed\n");
+ break;
+ }
+ default:
+ ThrowHR(E_UNEXPECTED);
+ }
+ }
+
+private:
+ INGenParserCallback *parserCallback;
+};
+
diff --git a/src/inc/nibblemapmacros.h b/src/inc/nibblemapmacros.h
new file mode 100644
index 0000000000..42ea90a2b6
--- /dev/null
+++ b/src/inc/nibblemapmacros.h
@@ -0,0 +1,56 @@
+// 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.
+
+#ifndef NIBBLEMAPMACROS_H_
+#define NIBBLEMAPMACROS_H_
+
+///////////////////////////////////////////////////////////////////////
+//// some mmgr stuff for JIT, especially for jit code blocks
+///////////////////////////////////////////////////////////////////////
+//
+// In order to quickly find the start of a jit code block
+// we keep track of all those positions via a map.
+// Each entry in this map represents 32 byte (a bucket) of the code heap.
+// We make the assumption that no two code-blocks can start in
+// the same 32byte bucket;
+// Additionally we assume that every code header is DWORD aligned.
+// Because we cannot guarantee that jitblocks always start at
+// multiples of 32 bytes we cannot use a simple bitmap; instead we
+// use a nibble (4 bit) per bucket and encode the offset of the header
+// inside the bucket (in DWORDS). In order to make initialization
+// easier we add one to the real offset, a nibble-value of zero
+// means that there is no header start in the resp. bucket.
+// In order to speed up "backwards scanning" we start numbering
+// nibbles inside a DWORD from the highest bits (28..31). Because
+// of that we can scan backwards inside the DWORD with right shifts.
+
+#if defined(_WIN64)
+// TODO: bump up the windows CODE_ALIGN to 16 and iron out any nibble map bugs that exist.
+// TODO: there is something wrong with USE_INDIRECT_CODEHEADER with CODE_ALIGN=16
+# define CODE_ALIGN 4
+# define LOG2_CODE_ALIGN 2
+#else
+# define CODE_ALIGN sizeof(DWORD) // 4 byte boundry
+# define LOG2_CODE_ALIGN 2
+#endif
+#define NIBBLE_MASK 0xf
+#define NIBBLE_SIZE 4 // 4 bits
+#define LOG2_NIBBLE_SIZE 2
+#define NIBBLES_PER_DWORD ((8*sizeof(DWORD)) >> LOG2_NIBBLE_SIZE) // 8 (4-bit) nibbles per dword
+#define NIBBLES_PER_DWORD_MASK (NIBBLES_PER_DWORD - 1) // 7
+#define LOG2_NIBBLES_PER_DWORD 3
+#define BYTES_PER_BUCKET (NIBBLES_PER_DWORD * CODE_ALIGN) // 32 bytes per bucket
+#define LOG2_BYTES_PER_BUCKET (LOG2_CODE_ALIGN + LOG2_NIBBLES_PER_DWORD) // 5 bits per bucket
+#define MASK_BYTES_PER_BUCKET (BYTES_PER_BUCKET - 1) // 31
+#define HIGHEST_NIBBLE_BIT (32 - NIBBLE_SIZE) // 28 (i.e 32 - 4)
+#define HIGHEST_NIBBLE_MASK (NIBBLE_MASK << HIGHEST_NIBBLE_BIT) // 0xf0000000
+
+#define ADDR2POS(x) ((x) >> LOG2_BYTES_PER_BUCKET)
+#define ADDR2OFFS(x) (DWORD) ((((x) & MASK_BYTES_PER_BUCKET) >> LOG2_CODE_ALIGN) + 1)
+#define POSOFF2ADDR(pos, of) (size_t) (((pos) << LOG2_BYTES_PER_BUCKET) + (((of) - 1) << LOG2_CODE_ALIGN))
+#define HEAP2MAPSIZE(x) (((x) / (BYTES_PER_BUCKET * NIBBLES_PER_DWORD)) * CODE_ALIGN)
+#define POS2SHIFTCOUNT(x) (DWORD) (HIGHEST_NIBBLE_BIT - (((x) & NIBBLES_PER_DWORD_MASK) << LOG2_NIBBLE_SIZE))
+#define POS2MASK(x) (DWORD) ~(HIGHEST_NIBBLE_MASK >> (((x) & NIBBLES_PER_DWORD_MASK) << LOG2_NIBBLE_SIZE))
+
+#endif // NIBBLEMAPMACROS_H_
diff --git a/src/inc/nibblestream.h b/src/inc/nibblestream.h
new file mode 100644
index 0000000000..1b92bd06ed
--- /dev/null
+++ b/src/inc/nibblestream.h
@@ -0,0 +1,300 @@
+// 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.
+// NibbleStream reader and writer.
+
+
+#ifndef _NIBBLESTREAM_H_
+#define _NIBBLESTREAM_H_
+
+#include "contract.h"
+#include "sigbuilder.h"
+
+typedef BYTE NIBBLE;
+
+//-----------------------------------------------------------------------------
+// Helpers for compression routines.
+//-----------------------------------------------------------------------------
+// This class allows variable-length compression of DWORDs.
+//
+// A value can be stored using one or more nibbles. 3 bits of a nibble are used
+// to store 3 bits of the value, and the top bit indicates if the following nibble
+// contains rest of the value. If the top bit is not set, then this
+// nibble is the last part of the value.
+// The higher bits of the value are written out first, and the lowest 3 bits
+// are written out last.
+//
+// In the encoded stream of bytes, the lower nibble of a byte is used before
+// the high nibble.
+//
+// A binary value ABCDEFGHI (where A is the highest bit) is encoded as
+// the follow two bytes : 1DEF1ABC XXXX0GHI
+//
+// Examples :
+// 0 => X0
+// 1 => X1
+//
+// 7 => X7
+// 8 => 09
+// 9 => 19
+//
+// 0x3F (63) => 7F
+// 0x40 (64) => F9 X0
+// 0x41 (65) => F9 X1
+//
+// 0x1FF (511) => FF X7
+// 0x200 (512) => 89 08
+// 0x201 (513) => 89 18
+
+class NibbleWriter
+{
+public:
+ NibbleWriter()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_fPending = false;
+ }
+
+ void Flush()
+ {
+ if (m_fPending)
+ m_SigBuilder.AppendByte(m_PendingNibble);
+ }
+
+ PVOID GetBlob(DWORD * pdwLength)
+ {
+ return m_SigBuilder.GetSignature(pdwLength);
+ }
+
+ DWORD GetBlobLength()
+ {
+ return m_SigBuilder.GetSignatureLength();
+ }
+
+//.............................................................................
+// Writer methods
+//.............................................................................
+
+
+ // Write a single nibble to the stream.
+ void WriteNibble(NIBBLE i)
+ {
+ CONTRACTL
+ {
+ THROWS;
+ GC_NOTRIGGER;
+ }
+ CONTRACTL_END;
+
+ _ASSERTE(i <= 0xF);
+
+ if (m_fPending)
+ {
+ // Use the high nibble after the low nibble is used
+ m_SigBuilder.AppendByte(m_PendingNibble | (i << 4));
+ m_fPending = false;
+ }
+ else
+ {
+ // Use the low nibble first
+ m_PendingNibble = i;
+ m_fPending = true;
+ }
+ }
+
+ // Write an unsigned int via variable length nibble encoding.
+ // We use the bit scheme:
+ // 0ABC (if 0 <= dw <= 0x7)
+ // 1ABC 0DEF (if 0 <= dw <= 0x7f)
+ // 1ABC 1DEF 0GHI (if 0 <= dw <= 0x7FF)
+ // etc..
+
+ void WriteEncodedU32(DWORD dw)
+ {
+ CONTRACTL
+ {
+ THROWS;
+ GC_NOTRIGGER;
+ }
+ CONTRACTL_END;
+
+ // Fast path for common small inputs
+ if (dw <= 63)
+ {
+ if (dw > 7)
+ {
+ WriteNibble((NIBBLE) ((dw >> 3) | 8));
+ }
+
+ WriteNibble((NIBBLE) (dw & 7));
+ return;
+ }
+
+ // Note we must write this out with the low terminating nibble (0ABC) last b/c the
+ // reader gets nibbles in the same order we write them.
+ int i = 0;
+ while ((dw >> i) > 7)
+ {
+ i+= 3;
+ }
+ while(i > 0)
+ {
+ WriteNibble((NIBBLE) ((dw >> i) & 0x7) | 0x8);
+ i -= 3;
+ }
+ WriteNibble((NIBBLE) dw & 0x7);
+ }
+
+ // Write a signed 32 bit value.
+ void WriteEncodedI32(int x)
+ {
+ CONTRACTL
+ {
+ THROWS;
+ GC_NOTRIGGER;
+ }
+ CONTRACTL_END;
+
+ DWORD dw = (x < 0) ? (((-x) << 1) + 1) : (x << 1);
+ WriteEncodedU32(dw);
+ };
+
+protected:
+ NIBBLE m_PendingNibble; // Pending value, not yet written out.
+ bool m_fPending;
+
+ // SigBuilder is a convenient helper class for writing out small blobs
+ SigBuilder m_SigBuilder;
+};
+
+//-----------------------------------------------------------------------------
+
+class NibbleReader
+{
+public:
+ NibbleReader(PTR_BYTE pBuffer, size_t size)
+ {
+ LIMITED_METHOD_CONTRACT;
+ SUPPORTS_DAC;
+ _ASSERTE(pBuffer != NULL);
+
+ m_pBuffer = pBuffer;
+ m_cBytes = size;
+ m_cNibble = 0;
+ }
+
+ // Get the index of the next Byte.
+ // This tells us how many bytes (rounding up to whole bytes) have been read.
+ // This is can be used to extract raw byte data that may be embedded on a byte boundary in the nibble stream.
+ size_t GetNextByteIndex()
+ {
+ LIMITED_METHOD_CONTRACT;
+ SUPPORTS_DAC;
+
+ return (m_cNibble + 1) / 2;
+ }
+
+ NIBBLE ReadNibble()
+ {
+ CONTRACTL
+ {
+ THROWS;
+ GC_NOTRIGGER;
+ SUPPORTS_DAC;
+ }
+ CONTRACTL_END;
+
+ NIBBLE i = 0;
+ // Bufer should have been allocated large enough to hold data.
+ if (!(m_cNibble / 2 < m_cBytes))
+ {
+ // We should never get here in a normal retail scenario.
+ // We could wind up here if somebody provided us invalid data (maybe by corrupting an ngenned image).
+ EX_THROW(HRException, (E_INVALIDARG));
+ }
+
+ BYTE p = m_pBuffer[m_cNibble / 2];
+ if ((m_cNibble & 1) == 0)
+ {
+ // Read the low nibble first
+ i = (NIBBLE) (p & 0xF);
+ }
+ else
+ {
+ // Read the high nibble after the low nibble has been read
+ i = (NIBBLE) (p >> 4) & 0xF;
+ }
+ m_cNibble++;
+
+ return i;
+ }
+
+ // Read an unsigned int that was encoded via variable length nibble encoding
+ // from NibbleWriter::WriteEncodedU32.
+ DWORD ReadEncodedU32()
+ {
+ CONTRACTL
+ {
+ THROWS;
+ GC_NOTRIGGER;
+ SUPPORTS_DAC;
+ }
+ CONTRACTL_END;
+
+ DWORD dw =0;
+
+#if defined(_DEBUG) || defined(DACCESS_COMPILE)
+ int dwCount = 0;
+#endif
+
+ // The encoding is variably lengthed, with the high-bit of every nibble indicating whether
+ // there is another nibble in the value. Each nibble contributes 3 bits to the value.
+ NIBBLE n;
+ do
+ {
+#if defined(_DEBUG) || defined(DACCESS_COMPILE)
+ // If we've already read 11 nibbles (with 3 bits of usable data each), then we
+ // should be done reading a 32-bit integer.
+ // Avoid working with corrupted data and potentially long loops by failing
+ if(dwCount > 11)
+ {
+ _ASSERTE_MSG(false, "Corrupt nibble stream - value exceeded 32-bits in size");
+#ifdef DACCESS_COMPILE
+ DacError(CORDBG_E_TARGET_INCONSISTENT);
+#endif
+ }
+ dwCount++;
+#endif
+
+ n = ReadNibble();
+ dw = (dw << 3) + (n & 0x7);
+ } while((n & 0x8) > 0);
+
+ return dw;
+ }
+
+ int ReadEncodedI32()
+ {
+ CONTRACTL
+ {
+ THROWS;
+ GC_NOTRIGGER;
+ SUPPORTS_DAC;
+ }
+ CONTRACTL_END;
+
+ DWORD dw = ReadEncodedU32();
+ int x = dw >> 1;
+ return (dw & 1) ? (-x) : (x);
+ }
+
+protected:
+ PTR_BYTE m_pBuffer;
+ size_t m_cBytes; // size of buffer.
+ size_t m_cNibble; // Which nibble are we at?
+};
+
+
+
+#endif // _NIBBLESTREAM_H_
diff --git a/src/inc/nsutilpriv.h b/src/inc/nsutilpriv.h
new file mode 100644
index 0000000000..ede064c6f8
--- /dev/null
+++ b/src/inc/nsutilpriv.h
@@ -0,0 +1,266 @@
+// 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.
+//*****************************************************************************
+// NSUtilPriv.h
+//
+// Helpers for converting namespace separators.
+//
+//*****************************************************************************
+
+#ifndef __NSUTILPRIV_H__
+#define __NSUTILPRIV_H__
+
+template <class T> class CQuickArray;
+class SString;
+
+struct ns
+{
+
+//*****************************************************************************
+// Determine how many chars large a fully qualified name would be given the
+// two parts of the name. The return value includes room for every character
+// in both names, as well as room for the separator and a final terminator.
+//*****************************************************************************
+static
+int GetFullLength( // Number of chars in full name.
+ const WCHAR *szNameSpace, // Namspace for value.
+ const WCHAR *szName); // Name of value.
+
+static
+int GetFullLength( // Number of chars in full name.
+ LPCUTF8 szNameSpace, // Namspace for value.
+ LPCUTF8 szName); // Name of value.
+
+//*****************************************************************************
+// Scan the given string to see if the name contains any invalid characters
+// that are not allowed.
+//*****************************************************************************
+static
+int IsValidName( // true if valid, false invalid.
+ const WCHAR *szName); // Name to parse.
+
+static
+int IsValidName( // true if valid, false invalid.
+ LPCUTF8 szName); // Name to parse.
+
+
+//*****************************************************************************
+// Scan the string from the rear looking for the first valid separator. If
+// found, return a pointer to it. Else return null. This code is smart enough
+// to skip over special sequences, such as:
+// a.b..ctor
+// ^
+// |
+// The ".ctor" is considered one token.
+//*****************************************************************************
+static
+WCHAR *FindSep( // Pointer to separator or null.
+ const WCHAR *szPath); // The path to look in.
+
+static
+LPUTF8 FindSep( // Pointer to separator or null.
+ LPCUTF8 szPath); // The path to look in.
+
+
+//*****************************************************************************
+// Take a path and find the last separator (nsFindSep), and then replace the
+// separator with a '\0' and return a pointer to the name. So for example:
+// a.b.c
+// becomes two strings "a.b" and "c" and the return value points to "c".
+//*****************************************************************************
+static
+WCHAR *SplitInline( // Pointer to name portion.
+ __inout __inout_z WCHAR *szPath); // The path to split.
+
+static
+LPUTF8 SplitInline( // Pointer to name portion.
+ __inout __inout_z LPUTF8 szPath); // The path to split.
+
+static
+void SplitInline(
+ __inout __inout_z LPWSTR szPath, // Path to split.
+ LPCWSTR &szNameSpace, // Return pointer to namespace.
+ LPCWSTR &szName); // Return pointer to name.
+
+static
+void SplitInline(
+ __inout __inout_z LPUTF8 szPath, // Path to split.
+ LPCUTF8 &szNameSpace, // Return pointer to namespace.
+ LPCUTF8 &szName); // Return pointer to name.
+
+
+//*****************************************************************************
+// Split the last parsable element from the end of the string as the name,
+// the first part as the namespace.
+//*****************************************************************************
+static
+int SplitPath( // true ok, false trunction.
+ const WCHAR *szPath, // Path to split.
+ __out_ecount_opt (cchNameSpace) WCHAR *szNameSpace, // Output for namespace value.
+ int cchNameSpace, // Max chars for output.
+ __out_ecount_opt (cchName) WCHAR *szName, // Output for name.
+ int cchName); // Max chars for output.
+
+static
+int SplitPath( // true ok, false trunction.
+ LPCUTF8 szPath, // Path to split.
+ __out_ecount_opt (cchNameSpace) LPUTF8 szNameSpace, // Output for namespace value.
+ int cchNameSpace, // Max chars for output.
+ __out_ecount_opt (cchName) LPUTF8 szName, // Output for name.
+ int cchName); // Max chars for output.
+
+
+//*****************************************************************************
+// Take two values and put them together in a fully qualified path using the
+// correct separator.
+//*****************************************************************************
+static
+int MakePath( // true ok, false truncation.
+ __out_ecount(cchChars) WCHAR *szOut, // output path for name.
+ int cchChars, // max chars for output path.
+ const WCHAR *szNameSpace, // Namespace.
+ const WCHAR *szName); // Name.
+
+static
+int MakePath( // true ok, false truncation.
+ __out_ecount(cchChars) LPUTF8 szOut, // output path for name.
+ int cchChars, // max chars for output path.
+ LPCUTF8 szNameSpace, // Namespace.
+ LPCUTF8 szName); // Name.
+
+static
+int MakePath( // true ok, false truncation.
+ __out_ecount(cchChars) WCHAR *szOut, // output path for name.
+ int cchChars, // max chars for output path.
+ LPCUTF8 szNameSpace, // Namespace.
+ LPCUTF8 szName); // Name.
+
+static
+int MakePath( // true ok, false out of memory
+ CQuickBytes &qb, // Where to put results.
+ LPCUTF8 szNameSpace, // Namespace for name.
+ LPCUTF8 szName); // Final part of name.
+
+static
+int MakePath( // true ok, false out of memory
+ CQuickArray<WCHAR> &qa, // Where to put results.
+ LPCUTF8 szNameSpace, // Namespace for name.
+ LPCUTF8 szName); // Final part of name.
+
+static
+int MakePath( // true ok, false out of memory
+ CQuickBytes &qb, // Where to put results.
+ const WCHAR *szNameSpace, // Namespace for name.
+ const WCHAR *szName); // Final part of name.
+
+static
+void MakePath( // throws on out of memory
+ SString &ssBuf, // Where to put results.
+ const SString &ssNameSpace, // Namespace for name.
+ const SString &ssName); // Final part of name.
+
+//*****************************************************************************
+// Concatinate type names to assembly names
+//*****************************************************************************
+static
+bool MakeAssemblyQualifiedName( // true if ok, false if out of memory
+ CQuickBytes &qb, // location to put result
+ const WCHAR *szTypeName, // Type name
+ const WCHAR *szAssemblyName); // Assembly Name
+
+static
+bool MakeAssemblyQualifiedName( // true ok, false truncation
+ __out_ecount (dwBuffer) WCHAR* pBuffer, // Buffer to recieve the results
+ int dwBuffer, // Number of characters total in buffer
+ const WCHAR *szTypeName, // Namespace for name.
+ int dwTypeName, // Number of characters (not including null)
+ const WCHAR *szAssemblyName, // Final part of name.
+ int dwAssemblyName); // Number of characters (not including null)
+
+static
+int MakeNestedTypeName( // true ok, false out of memory
+ CQuickBytes &qb, // Where to put results.
+ LPCUTF8 szEnclosingName, // Full name for enclosing type
+ LPCUTF8 szNestedName); // Full name for nested type
+
+static
+int MakeNestedTypeName( // true ok, false truncation.
+ __out_ecount (cchChars) LPUTF8 szOut, // output path for name.
+ int cchChars, // max chars for output path.
+ LPCUTF8 szEnclosingName, // Full name for enclosing type
+ LPCUTF8 szNestedName); // Full name for nested type
+
+static
+void MakeNestedTypeName( // throws on out of memory
+ SString &ssBuf, // output path for name.
+ const SString &ssEnclosingName, // Full name for enclosing type
+ const SString &ssNestedName); // Full name for nested type
+}; // struct ns
+
+#ifndef NAMESPACE_SEPARATOR_CHAR
+#define NAMESPACE_SEPARATOR_CHAR '.'
+#define NAMESPACE_SEPARATOR_WCHAR W('.')
+#define NAMESPACE_SEPARATOR_STR "."
+#define NAMESPACE_SEPARATOR_WSTR W(".")
+#define NAMESPACE_SEPARATOR_LEN 1
+#define ASSEMBLY_SEPARATOR_CHAR ','
+#define ASSEMBLY_SEPARATOR_WCHAR W(',')
+#define ASSEMBLY_SEPARATOR_STR ", "
+#define ASSEMBLY_SEPARATOR_WSTR W(", ")
+#define ASSEMBLY_SEPARATOR_LEN 2
+#define BACKSLASH_CHAR '\\'
+#define BACKSLASH_WCHAR W('\\')
+#define NESTED_SEPARATOR_CHAR '+'
+#define NESTED_SEPARATOR_WCHAR W('+')
+#define NESTED_SEPARATOR_STR "+"
+#define NESTED_SEPARATOR_WSTR W("+")
+#endif
+
+#define EMPTY_STR ""
+#define EMPTY_WSTR W("")
+
+#define MAKE_FULL_PATH_ON_STACK_UTF8(toptr, pnamespace, pname) \
+{ \
+ int __i##toptr = ns::GetFullLength(pnamespace, pname); \
+ toptr = (char *) alloca(__i##toptr); \
+ ns::MakePath(toptr, __i##toptr, pnamespace, pname); \
+}
+
+#define MAKE_FULL_PATH_ON_STACK_UNICODE(toptr, pnamespace, pname) \
+{ \
+ int __i##toptr = ns::GetFullLength(pnamespace, pname); \
+ toptr = (WCHAR *) alloca(__i##toptr * sizeof(WCHAR)); \
+ ns::MakePath(toptr, __i##toptr, pnamespace, pname); \
+}
+
+#define MAKE_FULLY_QUALIFIED_NAME(pszFullyQualifiedName, pszNameSpace, pszName) MAKE_FULL_PATH_ON_STACK_UTF8(pszFullyQualifiedName, pszNameSpace, pszName)
+
+#define MAKE_FULLY_QUALIFIED_MEMBER_NAME(ptr, pszNameSpace, pszClassName, pszMemberName, pszSig) \
+{ \
+ int __i##ptr = ns::GetFullLength(pszNameSpace, pszClassName); \
+ __i##ptr += (pszMemberName ? (int) strlen(pszMemberName) : 0); \
+ __i##ptr += (NAMESPACE_SEPARATOR_LEN * 2); \
+ __i##ptr += (pszSig ? (int) strlen(pszSig) : 0); \
+ ptr = (LPUTF8) alloca(__i##ptr); \
+ ns::MakePath(ptr, __i##ptr, pszNameSpace, pszClassName); \
+ if (pszMemberName) { \
+ strcat_s(ptr, __i##ptr, NAMESPACE_SEPARATOR_STR); \
+ strcat_s(ptr, __i##ptr, pszMemberName); \
+ } \
+ if (pszSig) { \
+ if (! pszMemberName) \
+ strcat_s(ptr, __i##ptr, NAMESPACE_SEPARATOR_STR); \
+ strcat_s(ptr, __i##ptr, pszSig); \
+ } \
+}
+
+#ifdef _PREFAST_
+// need to eliminate the expansion of MAKE_FULLY_QUALIFIED_MEMBER_NAME in prefast
+// builds to prevent it complaining about the potential for NULLs to strlen and strcat
+#undef MAKE_FULLY_QUALIFIED_MEMBER_NAME
+// need to set ptr=NULL so we don't get a build error because ptr isn't inited in a couple cases
+#define MAKE_FULLY_QUALIFIED_MEMBER_NAME(ptr, pszNameSpace, pszClassName, pszMemberName, pszSig) ptr=NULL;
+#endif
+
+#endif
diff --git a/src/inc/obj/i386/dummy b/src/inc/obj/i386/dummy
new file mode 100644
index 0000000000..4d6a3b44f4
--- /dev/null
+++ b/src/inc/obj/i386/dummy
@@ -0,0 +1 @@
+ECHO is on.
diff --git a/src/inc/opcode.def b/src/inc/opcode.def
new file mode 100644
index 0000000000..9d495c2895
--- /dev/null
+++ b/src/inc/opcode.def
@@ -0,0 +1,359 @@
+// 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.
+
+/*****************************************************************************
+ ** **
+ ** Opcode.def - COM+ Intrinsic Opcodes and Macros. **
+ ** **
+ ** This is the master table from which all opcode lists **
+ ** are derived. New instructions must be added to this **
+ ** table and generators run to produce the lookup tables **
+ ** used by the interpreter loop. **
+ ** **
+ ** Stack Behaviour is describing the number of 4 byte **
+ ** slots pushed and Poped. **
+ ** **
+ *****************************************************************************/
+
+
+#ifndef __OPCODE_DEF_
+#define __OPCODE_DEF_
+
+#define MOOT 0x00 // Marks unused second byte when encoding single
+#define STP1 0xFE // Prefix code 1 for Standard Map
+#define REFPRE 0xFF // Prefix for Reference Code Encoding
+#define RESERVED_PREFIX_START 0xF7
+
+#endif
+
+// If the first byte of the standard encoding is 0xFF, then
+// the second byte can be used as 1 byte encoding. Otherwise l b b
+// the encoding is two bytes. e y y
+// n t t
+// g e e
+// (unused) t
+// Canonical Name String Name Stack Behaviour Operand Params Opcode Kind h 1 2 Control Flow
+// -------------------------------------------------------------------------------------------------------------------------------------------------------
+OPDEF(CEE_NOP, "nop", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0x00, NEXT)
+OPDEF(CEE_BREAK, "break", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0x01, BREAK)
+OPDEF(CEE_LDARG_0, "ldarg.0", Pop0, Push1, InlineNone, IMacro, 1, 0xFF, 0x02, NEXT)
+OPDEF(CEE_LDARG_1, "ldarg.1", Pop0, Push1, InlineNone, IMacro, 1, 0xFF, 0x03, NEXT)
+OPDEF(CEE_LDARG_2, "ldarg.2", Pop0, Push1, InlineNone, IMacro, 1, 0xFF, 0x04, NEXT)
+OPDEF(CEE_LDARG_3, "ldarg.3", Pop0, Push1, InlineNone, IMacro, 1, 0xFF, 0x05, NEXT)
+OPDEF(CEE_LDLOC_0, "ldloc.0", Pop0, Push1, InlineNone, IMacro, 1, 0xFF, 0x06, NEXT)
+OPDEF(CEE_LDLOC_1, "ldloc.1", Pop0, Push1, InlineNone, IMacro, 1, 0xFF, 0x07, NEXT)
+OPDEF(CEE_LDLOC_2, "ldloc.2", Pop0, Push1, InlineNone, IMacro, 1, 0xFF, 0x08, NEXT)
+OPDEF(CEE_LDLOC_3, "ldloc.3", Pop0, Push1, InlineNone, IMacro, 1, 0xFF, 0x09, NEXT)
+OPDEF(CEE_STLOC_0, "stloc.0", Pop1, Push0, InlineNone, IMacro, 1, 0xFF, 0x0A, NEXT)
+OPDEF(CEE_STLOC_1, "stloc.1", Pop1, Push0, InlineNone, IMacro, 1, 0xFF, 0x0B, NEXT)
+OPDEF(CEE_STLOC_2, "stloc.2", Pop1, Push0, InlineNone, IMacro, 1, 0xFF, 0x0C, NEXT)
+OPDEF(CEE_STLOC_3, "stloc.3", Pop1, Push0, InlineNone, IMacro, 1, 0xFF, 0x0D, NEXT)
+OPDEF(CEE_LDARG_S, "ldarg.s", Pop0, Push1, ShortInlineVar, IMacro, 1, 0xFF, 0x0E, NEXT)
+OPDEF(CEE_LDARGA_S, "ldarga.s", Pop0, PushI, ShortInlineVar, IMacro, 1, 0xFF, 0x0F, NEXT)
+OPDEF(CEE_STARG_S, "starg.s", Pop1, Push0, ShortInlineVar, IMacro, 1, 0xFF, 0x10, NEXT)
+OPDEF(CEE_LDLOC_S, "ldloc.s", Pop0, Push1, ShortInlineVar, IMacro, 1, 0xFF, 0x11, NEXT)
+OPDEF(CEE_LDLOCA_S, "ldloca.s", Pop0, PushI, ShortInlineVar, IMacro, 1, 0xFF, 0x12, NEXT)
+OPDEF(CEE_STLOC_S, "stloc.s", Pop1, Push0, ShortInlineVar, IMacro, 1, 0xFF, 0x13, NEXT)
+OPDEF(CEE_LDNULL, "ldnull", Pop0, PushRef, InlineNone, IPrimitive, 1, 0xFF, 0x14, NEXT)
+OPDEF(CEE_LDC_I4_M1, "ldc.i4.m1", Pop0, PushI, InlineNone, IMacro, 1, 0xFF, 0x15, NEXT)
+OPDEF(CEE_LDC_I4_0, "ldc.i4.0", Pop0, PushI, InlineNone, IMacro, 1, 0xFF, 0x16, NEXT)
+OPDEF(CEE_LDC_I4_1, "ldc.i4.1", Pop0, PushI, InlineNone, IMacro, 1, 0xFF, 0x17, NEXT)
+OPDEF(CEE_LDC_I4_2, "ldc.i4.2", Pop0, PushI, InlineNone, IMacro, 1, 0xFF, 0x18, NEXT)
+OPDEF(CEE_LDC_I4_3, "ldc.i4.3", Pop0, PushI, InlineNone, IMacro, 1, 0xFF, 0x19, NEXT)
+OPDEF(CEE_LDC_I4_4, "ldc.i4.4", Pop0, PushI, InlineNone, IMacro, 1, 0xFF, 0x1A, NEXT)
+OPDEF(CEE_LDC_I4_5, "ldc.i4.5", Pop0, PushI, InlineNone, IMacro, 1, 0xFF, 0x1B, NEXT)
+OPDEF(CEE_LDC_I4_6, "ldc.i4.6", Pop0, PushI, InlineNone, IMacro, 1, 0xFF, 0x1C, NEXT)
+OPDEF(CEE_LDC_I4_7, "ldc.i4.7", Pop0, PushI, InlineNone, IMacro, 1, 0xFF, 0x1D, NEXT)
+OPDEF(CEE_LDC_I4_8, "ldc.i4.8", Pop0, PushI, InlineNone, IMacro, 1, 0xFF, 0x1E, NEXT)
+OPDEF(CEE_LDC_I4_S, "ldc.i4.s", Pop0, PushI, ShortInlineI, IMacro, 1, 0xFF, 0x1F, NEXT)
+OPDEF(CEE_LDC_I4, "ldc.i4", Pop0, PushI, InlineI, IPrimitive, 1, 0xFF, 0x20, NEXT)
+OPDEF(CEE_LDC_I8, "ldc.i8", Pop0, PushI8, InlineI8, IPrimitive, 1, 0xFF, 0x21, NEXT)
+OPDEF(CEE_LDC_R4, "ldc.r4", Pop0, PushR4, ShortInlineR, IPrimitive, 1, 0xFF, 0x22, NEXT)
+OPDEF(CEE_LDC_R8, "ldc.r8", Pop0, PushR8, InlineR, IPrimitive, 1, 0xFF, 0x23, NEXT)
+OPDEF(CEE_UNUSED49, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0x24, NEXT)
+OPDEF(CEE_DUP, "dup", Pop1, Push1+Push1, InlineNone, IPrimitive, 1, 0xFF, 0x25, NEXT)
+OPDEF(CEE_POP, "pop", Pop1, Push0, InlineNone, IPrimitive, 1, 0xFF, 0x26, NEXT)
+OPDEF(CEE_JMP, "jmp", Pop0, Push0, InlineMethod, IPrimitive, 1, 0xFF, 0x27, CALL)
+OPDEF(CEE_CALL, "call", VarPop, VarPush, InlineMethod, IPrimitive, 1, 0xFF, 0x28, CALL)
+OPDEF(CEE_CALLI, "calli", VarPop, VarPush, InlineSig, IPrimitive, 1, 0xFF, 0x29, CALL)
+OPDEF(CEE_RET, "ret", VarPop, Push0, InlineNone, IPrimitive, 1, 0xFF, 0x2A, RETURN)
+OPDEF(CEE_BR_S, "br.s", Pop0, Push0, ShortInlineBrTarget,IMacro, 1, 0xFF, 0x2B, BRANCH)
+OPDEF(CEE_BRFALSE_S, "brfalse.s", PopI, Push0, ShortInlineBrTarget,IMacro, 1, 0xFF, 0x2C, COND_BRANCH)
+OPDEF(CEE_BRTRUE_S, "brtrue.s", PopI, Push0, ShortInlineBrTarget,IMacro, 1, 0xFF, 0x2D, COND_BRANCH)
+OPDEF(CEE_BEQ_S, "beq.s", Pop1+Pop1, Push0, ShortInlineBrTarget,IMacro, 1, 0xFF, 0x2E, COND_BRANCH)
+OPDEF(CEE_BGE_S, "bge.s", Pop1+Pop1, Push0, ShortInlineBrTarget,IMacro, 1, 0xFF, 0x2F, COND_BRANCH)
+OPDEF(CEE_BGT_S, "bgt.s", Pop1+Pop1, Push0, ShortInlineBrTarget,IMacro, 1, 0xFF, 0x30, COND_BRANCH)
+OPDEF(CEE_BLE_S, "ble.s", Pop1+Pop1, Push0, ShortInlineBrTarget,IMacro, 1, 0xFF, 0x31, COND_BRANCH)
+OPDEF(CEE_BLT_S, "blt.s", Pop1+Pop1, Push0, ShortInlineBrTarget,IMacro, 1, 0xFF, 0x32, COND_BRANCH)
+OPDEF(CEE_BNE_UN_S, "bne.un.s", Pop1+Pop1, Push0, ShortInlineBrTarget,IMacro, 1, 0xFF, 0x33, COND_BRANCH)
+OPDEF(CEE_BGE_UN_S, "bge.un.s", Pop1+Pop1, Push0, ShortInlineBrTarget,IMacro, 1, 0xFF, 0x34, COND_BRANCH)
+OPDEF(CEE_BGT_UN_S, "bgt.un.s", Pop1+Pop1, Push0, ShortInlineBrTarget,IMacro, 1, 0xFF, 0x35, COND_BRANCH)
+OPDEF(CEE_BLE_UN_S, "ble.un.s", Pop1+Pop1, Push0, ShortInlineBrTarget,IMacro, 1, 0xFF, 0x36, COND_BRANCH)
+OPDEF(CEE_BLT_UN_S, "blt.un.s", Pop1+Pop1, Push0, ShortInlineBrTarget,IMacro, 1, 0xFF, 0x37, COND_BRANCH)
+OPDEF(CEE_BR, "br", Pop0, Push0, InlineBrTarget, IPrimitive, 1, 0xFF, 0x38, BRANCH)
+OPDEF(CEE_BRFALSE, "brfalse", PopI, Push0, InlineBrTarget, IPrimitive, 1, 0xFF, 0x39, COND_BRANCH)
+OPDEF(CEE_BRTRUE, "brtrue", PopI, Push0, InlineBrTarget, IPrimitive, 1, 0xFF, 0x3A, COND_BRANCH)
+OPDEF(CEE_BEQ, "beq", Pop1+Pop1, Push0, InlineBrTarget, IMacro, 1, 0xFF, 0x3B, COND_BRANCH)
+OPDEF(CEE_BGE, "bge", Pop1+Pop1, Push0, InlineBrTarget, IMacro, 1, 0xFF, 0x3C, COND_BRANCH)
+OPDEF(CEE_BGT, "bgt", Pop1+Pop1, Push0, InlineBrTarget, IMacro, 1, 0xFF, 0x3D, COND_BRANCH)
+OPDEF(CEE_BLE, "ble", Pop1+Pop1, Push0, InlineBrTarget, IMacro, 1, 0xFF, 0x3E, COND_BRANCH)
+OPDEF(CEE_BLT, "blt", Pop1+Pop1, Push0, InlineBrTarget, IMacro, 1, 0xFF, 0x3F, COND_BRANCH)
+OPDEF(CEE_BNE_UN, "bne.un", Pop1+Pop1, Push0, InlineBrTarget, IMacro, 1, 0xFF, 0x40, COND_BRANCH)
+OPDEF(CEE_BGE_UN, "bge.un", Pop1+Pop1, Push0, InlineBrTarget, IMacro, 1, 0xFF, 0x41, COND_BRANCH)
+OPDEF(CEE_BGT_UN, "bgt.un", Pop1+Pop1, Push0, InlineBrTarget, IMacro, 1, 0xFF, 0x42, COND_BRANCH)
+OPDEF(CEE_BLE_UN, "ble.un", Pop1+Pop1, Push0, InlineBrTarget, IMacro, 1, 0xFF, 0x43, COND_BRANCH)
+OPDEF(CEE_BLT_UN, "blt.un", Pop1+Pop1, Push0, InlineBrTarget, IMacro, 1, 0xFF, 0x44, COND_BRANCH)
+OPDEF(CEE_SWITCH, "switch", PopI, Push0, InlineSwitch, IPrimitive, 1, 0xFF, 0x45, COND_BRANCH)
+OPDEF(CEE_LDIND_I1, "ldind.i1", PopI, PushI, InlineNone, IPrimitive, 1, 0xFF, 0x46, NEXT)
+OPDEF(CEE_LDIND_U1, "ldind.u1", PopI, PushI, InlineNone, IPrimitive, 1, 0xFF, 0x47, NEXT)
+OPDEF(CEE_LDIND_I2, "ldind.i2", PopI, PushI, InlineNone, IPrimitive, 1, 0xFF, 0x48, NEXT)
+OPDEF(CEE_LDIND_U2, "ldind.u2", PopI, PushI, InlineNone, IPrimitive, 1, 0xFF, 0x49, NEXT)
+OPDEF(CEE_LDIND_I4, "ldind.i4", PopI, PushI, InlineNone, IPrimitive, 1, 0xFF, 0x4A, NEXT)
+OPDEF(CEE_LDIND_U4, "ldind.u4", PopI, PushI, InlineNone, IPrimitive, 1, 0xFF, 0x4B, NEXT)
+OPDEF(CEE_LDIND_I8, "ldind.i8", PopI, PushI8, InlineNone, IPrimitive, 1, 0xFF, 0x4C, NEXT)
+OPDEF(CEE_LDIND_I, "ldind.i", PopI, PushI, InlineNone, IPrimitive, 1, 0xFF, 0x4D, NEXT)
+OPDEF(CEE_LDIND_R4, "ldind.r4", PopI, PushR4, InlineNone, IPrimitive, 1, 0xFF, 0x4E, NEXT)
+OPDEF(CEE_LDIND_R8, "ldind.r8", PopI, PushR8, InlineNone, IPrimitive, 1, 0xFF, 0x4F, NEXT)
+OPDEF(CEE_LDIND_REF, "ldind.ref", PopI, PushRef, InlineNone, IPrimitive, 1, 0xFF, 0x50, NEXT)
+OPDEF(CEE_STIND_REF, "stind.ref", PopI+PopI, Push0, InlineNone, IPrimitive, 1, 0xFF, 0x51, NEXT)
+OPDEF(CEE_STIND_I1, "stind.i1", PopI+PopI, Push0, InlineNone, IPrimitive, 1, 0xFF, 0x52, NEXT)
+OPDEF(CEE_STIND_I2, "stind.i2", PopI+PopI, Push0, InlineNone, IPrimitive, 1, 0xFF, 0x53, NEXT)
+OPDEF(CEE_STIND_I4, "stind.i4", PopI+PopI, Push0, InlineNone, IPrimitive, 1, 0xFF, 0x54, NEXT)
+OPDEF(CEE_STIND_I8, "stind.i8", PopI+PopI8, Push0, InlineNone, IPrimitive, 1, 0xFF, 0x55, NEXT)
+OPDEF(CEE_STIND_R4, "stind.r4", PopI+PopR4, Push0, InlineNone, IPrimitive, 1, 0xFF, 0x56, NEXT)
+OPDEF(CEE_STIND_R8, "stind.r8", PopI+PopR8, Push0, InlineNone, IPrimitive, 1, 0xFF, 0x57, NEXT)
+OPDEF(CEE_ADD, "add", Pop1+Pop1, Push1, InlineNone, IPrimitive, 1, 0xFF, 0x58, NEXT)
+OPDEF(CEE_SUB, "sub", Pop1+Pop1, Push1, InlineNone, IPrimitive, 1, 0xFF, 0x59, NEXT)
+OPDEF(CEE_MUL, "mul", Pop1+Pop1, Push1, InlineNone, IPrimitive, 1, 0xFF, 0x5A, NEXT)
+OPDEF(CEE_DIV, "div", Pop1+Pop1, Push1, InlineNone, IPrimitive, 1, 0xFF, 0x5B, NEXT)
+OPDEF(CEE_DIV_UN, "div.un", Pop1+Pop1, Push1, InlineNone, IPrimitive, 1, 0xFF, 0x5C, NEXT)
+OPDEF(CEE_REM, "rem", Pop1+Pop1, Push1, InlineNone, IPrimitive, 1, 0xFF, 0x5D, NEXT)
+OPDEF(CEE_REM_UN, "rem.un", Pop1+Pop1, Push1, InlineNone, IPrimitive, 1, 0xFF, 0x5E, NEXT)
+OPDEF(CEE_AND, "and", Pop1+Pop1, Push1, InlineNone, IPrimitive, 1, 0xFF, 0x5F, NEXT)
+OPDEF(CEE_OR, "or", Pop1+Pop1, Push1, InlineNone, IPrimitive, 1, 0xFF, 0x60, NEXT)
+OPDEF(CEE_XOR, "xor", Pop1+Pop1, Push1, InlineNone, IPrimitive, 1, 0xFF, 0x61, NEXT)
+OPDEF(CEE_SHL, "shl", Pop1+Pop1, Push1, InlineNone, IPrimitive, 1, 0xFF, 0x62, NEXT)
+OPDEF(CEE_SHR, "shr", Pop1+Pop1, Push1, InlineNone, IPrimitive, 1, 0xFF, 0x63, NEXT)
+OPDEF(CEE_SHR_UN, "shr.un", Pop1+Pop1, Push1, InlineNone, IPrimitive, 1, 0xFF, 0x64, NEXT)
+OPDEF(CEE_NEG, "neg", Pop1, Push1, InlineNone, IPrimitive, 1, 0xFF, 0x65, NEXT)
+OPDEF(CEE_NOT, "not", Pop1, Push1, InlineNone, IPrimitive, 1, 0xFF, 0x66, NEXT)
+OPDEF(CEE_CONV_I1, "conv.i1", Pop1, PushI, InlineNone, IPrimitive, 1, 0xFF, 0x67, NEXT)
+OPDEF(CEE_CONV_I2, "conv.i2", Pop1, PushI, InlineNone, IPrimitive, 1, 0xFF, 0x68, NEXT)
+OPDEF(CEE_CONV_I4, "conv.i4", Pop1, PushI, InlineNone, IPrimitive, 1, 0xFF, 0x69, NEXT)
+OPDEF(CEE_CONV_I8, "conv.i8", Pop1, PushI8, InlineNone, IPrimitive, 1, 0xFF, 0x6A, NEXT)
+OPDEF(CEE_CONV_R4, "conv.r4", Pop1, PushR4, InlineNone, IPrimitive, 1, 0xFF, 0x6B, NEXT)
+OPDEF(CEE_CONV_R8, "conv.r8", Pop1, PushR8, InlineNone, IPrimitive, 1, 0xFF, 0x6C, NEXT)
+OPDEF(CEE_CONV_U4, "conv.u4", Pop1, PushI, InlineNone, IPrimitive, 1, 0xFF, 0x6D, NEXT)
+OPDEF(CEE_CONV_U8, "conv.u8", Pop1, PushI8, InlineNone, IPrimitive, 1, 0xFF, 0x6E, NEXT)
+OPDEF(CEE_CALLVIRT, "callvirt", VarPop, VarPush, InlineMethod, IObjModel, 1, 0xFF, 0x6F, CALL)
+OPDEF(CEE_CPOBJ, "cpobj", PopI+PopI, Push0, InlineType, IObjModel, 1, 0xFF, 0x70, NEXT)
+OPDEF(CEE_LDOBJ, "ldobj", PopI, Push1, InlineType, IObjModel, 1, 0xFF, 0x71, NEXT)
+OPDEF(CEE_LDSTR, "ldstr", Pop0, PushRef, InlineString, IObjModel, 1, 0xFF, 0x72, NEXT)
+OPDEF(CEE_NEWOBJ, "newobj", VarPop, PushRef, InlineMethod, IObjModel, 1, 0xFF, 0x73, CALL)
+OPDEF(CEE_CASTCLASS, "castclass", PopRef, PushRef, InlineType, IObjModel, 1, 0xFF, 0x74, NEXT)
+OPDEF(CEE_ISINST, "isinst", PopRef, PushI, InlineType, IObjModel, 1, 0xFF, 0x75, NEXT)
+OPDEF(CEE_CONV_R_UN, "conv.r.un", Pop1, PushR8, InlineNone, IPrimitive, 1, 0xFF, 0x76, NEXT)
+OPDEF(CEE_UNUSED58, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0x77, NEXT)
+OPDEF(CEE_UNUSED1, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0x78, NEXT)
+OPDEF(CEE_UNBOX, "unbox", PopRef, PushI, InlineType, IPrimitive, 1, 0xFF, 0x79, NEXT)
+OPDEF(CEE_THROW, "throw", PopRef, Push0, InlineNone, IObjModel, 1, 0xFF, 0x7A, THROW)
+OPDEF(CEE_LDFLD, "ldfld", PopRef, Push1, InlineField, IObjModel, 1, 0xFF, 0x7B, NEXT)
+OPDEF(CEE_LDFLDA, "ldflda", PopRef, PushI, InlineField, IObjModel, 1, 0xFF, 0x7C, NEXT)
+OPDEF(CEE_STFLD, "stfld", PopRef+Pop1, Push0, InlineField, IObjModel, 1, 0xFF, 0x7D, NEXT)
+OPDEF(CEE_LDSFLD, "ldsfld", Pop0, Push1, InlineField, IObjModel, 1, 0xFF, 0x7E, NEXT)
+OPDEF(CEE_LDSFLDA, "ldsflda", Pop0, PushI, InlineField, IObjModel, 1, 0xFF, 0x7F, NEXT)
+OPDEF(CEE_STSFLD, "stsfld", Pop1, Push0, InlineField, IObjModel, 1, 0xFF, 0x80, NEXT)
+OPDEF(CEE_STOBJ, "stobj", PopI+Pop1, Push0, InlineType, IPrimitive, 1, 0xFF, 0x81, NEXT)
+OPDEF(CEE_CONV_OVF_I1_UN, "conv.ovf.i1.un", Pop1, PushI, InlineNone, IPrimitive, 1, 0xFF, 0x82, NEXT)
+OPDEF(CEE_CONV_OVF_I2_UN, "conv.ovf.i2.un", Pop1, PushI, InlineNone, IPrimitive, 1, 0xFF, 0x83, NEXT)
+OPDEF(CEE_CONV_OVF_I4_UN, "conv.ovf.i4.un", Pop1, PushI, InlineNone, IPrimitive, 1, 0xFF, 0x84, NEXT)
+OPDEF(CEE_CONV_OVF_I8_UN, "conv.ovf.i8.un", Pop1, PushI8, InlineNone, IPrimitive, 1, 0xFF, 0x85, NEXT)
+OPDEF(CEE_CONV_OVF_U1_UN, "conv.ovf.u1.un", Pop1, PushI, InlineNone, IPrimitive, 1, 0xFF, 0x86, NEXT)
+OPDEF(CEE_CONV_OVF_U2_UN, "conv.ovf.u2.un", Pop1, PushI, InlineNone, IPrimitive, 1, 0xFF, 0x87, NEXT)
+OPDEF(CEE_CONV_OVF_U4_UN, "conv.ovf.u4.un", Pop1, PushI, InlineNone, IPrimitive, 1, 0xFF, 0x88, NEXT)
+OPDEF(CEE_CONV_OVF_U8_UN, "conv.ovf.u8.un", Pop1, PushI8, InlineNone, IPrimitive, 1, 0xFF, 0x89, NEXT)
+OPDEF(CEE_CONV_OVF_I_UN, "conv.ovf.i.un", Pop1, PushI, InlineNone, IPrimitive, 1, 0xFF, 0x8A, NEXT)
+OPDEF(CEE_CONV_OVF_U_UN, "conv.ovf.u.un", Pop1, PushI, InlineNone, IPrimitive, 1, 0xFF, 0x8B, NEXT)
+OPDEF(CEE_BOX, "box", Pop1, PushRef, InlineType, IPrimitive, 1, 0xFF, 0x8C, NEXT)
+OPDEF(CEE_NEWARR, "newarr", PopI, PushRef, InlineType, IObjModel, 1, 0xFF, 0x8D, NEXT)
+OPDEF(CEE_LDLEN, "ldlen", PopRef, PushI, InlineNone, IObjModel, 1, 0xFF, 0x8E, NEXT)
+OPDEF(CEE_LDELEMA, "ldelema", PopRef+PopI, PushI, InlineType, IObjModel, 1, 0xFF, 0x8F, NEXT)
+OPDEF(CEE_LDELEM_I1, "ldelem.i1", PopRef+PopI, PushI, InlineNone, IObjModel, 1, 0xFF, 0x90, NEXT)
+OPDEF(CEE_LDELEM_U1, "ldelem.u1", PopRef+PopI, PushI, InlineNone, IObjModel, 1, 0xFF, 0x91, NEXT)
+OPDEF(CEE_LDELEM_I2, "ldelem.i2", PopRef+PopI, PushI, InlineNone, IObjModel, 1, 0xFF, 0x92, NEXT)
+OPDEF(CEE_LDELEM_U2, "ldelem.u2", PopRef+PopI, PushI, InlineNone, IObjModel, 1, 0xFF, 0x93, NEXT)
+OPDEF(CEE_LDELEM_I4, "ldelem.i4", PopRef+PopI, PushI, InlineNone, IObjModel, 1, 0xFF, 0x94, NEXT)
+OPDEF(CEE_LDELEM_U4, "ldelem.u4", PopRef+PopI, PushI, InlineNone, IObjModel, 1, 0xFF, 0x95, NEXT)
+OPDEF(CEE_LDELEM_I8, "ldelem.i8", PopRef+PopI, PushI8, InlineNone, IObjModel, 1, 0xFF, 0x96, NEXT)
+OPDEF(CEE_LDELEM_I, "ldelem.i", PopRef+PopI, PushI, InlineNone, IObjModel, 1, 0xFF, 0x97, NEXT)
+OPDEF(CEE_LDELEM_R4, "ldelem.r4", PopRef+PopI, PushR4, InlineNone, IObjModel, 1, 0xFF, 0x98, NEXT)
+OPDEF(CEE_LDELEM_R8, "ldelem.r8", PopRef+PopI, PushR8, InlineNone, IObjModel, 1, 0xFF, 0x99, NEXT)
+OPDEF(CEE_LDELEM_REF, "ldelem.ref", PopRef+PopI, PushRef, InlineNone, IObjModel, 1, 0xFF, 0x9A, NEXT)
+OPDEF(CEE_STELEM_I, "stelem.i", PopRef+PopI+PopI, Push0, InlineNone, IObjModel, 1, 0xFF, 0x9B, NEXT)
+OPDEF(CEE_STELEM_I1, "stelem.i1", PopRef+PopI+PopI, Push0, InlineNone, IObjModel, 1, 0xFF, 0x9C, NEXT)
+OPDEF(CEE_STELEM_I2, "stelem.i2", PopRef+PopI+PopI, Push0, InlineNone, IObjModel, 1, 0xFF, 0x9D, NEXT)
+OPDEF(CEE_STELEM_I4, "stelem.i4", PopRef+PopI+PopI, Push0, InlineNone, IObjModel, 1, 0xFF, 0x9E, NEXT)
+OPDEF(CEE_STELEM_I8, "stelem.i8", PopRef+PopI+PopI8, Push0, InlineNone, IObjModel, 1, 0xFF, 0x9F, NEXT)
+OPDEF(CEE_STELEM_R4, "stelem.r4", PopRef+PopI+PopR4, Push0, InlineNone, IObjModel, 1, 0xFF, 0xA0, NEXT)
+OPDEF(CEE_STELEM_R8, "stelem.r8", PopRef+PopI+PopR8, Push0, InlineNone, IObjModel, 1, 0xFF, 0xA1, NEXT)
+OPDEF(CEE_STELEM_REF, "stelem.ref", PopRef+PopI+PopRef, Push0, InlineNone, IObjModel, 1, 0xFF, 0xA2, NEXT)
+OPDEF(CEE_LDELEM, "ldelem", PopRef+PopI, Push1, InlineType, IObjModel, 1, 0xFF, 0xA3, NEXT)
+OPDEF(CEE_STELEM, "stelem", PopRef+PopI+Pop1, Push0, InlineType, IObjModel, 1, 0xFF, 0xA4, NEXT)
+OPDEF(CEE_UNBOX_ANY, "unbox.any", PopRef, Push1, InlineType, IObjModel, 1, 0xFF, 0xA5, NEXT)
+OPDEF(CEE_UNUSED5, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xA6, NEXT)
+OPDEF(CEE_UNUSED6, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xA7, NEXT)
+OPDEF(CEE_UNUSED7, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xA8, NEXT)
+OPDEF(CEE_UNUSED8, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xA9, NEXT)
+OPDEF(CEE_UNUSED9, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xAA, NEXT)
+OPDEF(CEE_UNUSED10, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xAB, NEXT)
+OPDEF(CEE_UNUSED11, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xAC, NEXT)
+OPDEF(CEE_UNUSED12, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xAD, NEXT)
+OPDEF(CEE_UNUSED13, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xAE, NEXT)
+OPDEF(CEE_UNUSED14, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xAF, NEXT)
+OPDEF(CEE_UNUSED15, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xB0, NEXT)
+OPDEF(CEE_UNUSED16, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xB1, NEXT)
+OPDEF(CEE_UNUSED17, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xB2, NEXT)
+OPDEF(CEE_CONV_OVF_I1, "conv.ovf.i1", Pop1, PushI, InlineNone, IPrimitive, 1, 0xFF, 0xB3, NEXT)
+OPDEF(CEE_CONV_OVF_U1, "conv.ovf.u1", Pop1, PushI, InlineNone, IPrimitive, 1, 0xFF, 0xB4, NEXT)
+OPDEF(CEE_CONV_OVF_I2, "conv.ovf.i2", Pop1, PushI, InlineNone, IPrimitive, 1, 0xFF, 0xB5, NEXT)
+OPDEF(CEE_CONV_OVF_U2, "conv.ovf.u2", Pop1, PushI, InlineNone, IPrimitive, 1, 0xFF, 0xB6, NEXT)
+OPDEF(CEE_CONV_OVF_I4, "conv.ovf.i4", Pop1, PushI, InlineNone, IPrimitive, 1, 0xFF, 0xB7, NEXT)
+OPDEF(CEE_CONV_OVF_U4, "conv.ovf.u4", Pop1, PushI, InlineNone, IPrimitive, 1, 0xFF, 0xB8, NEXT)
+OPDEF(CEE_CONV_OVF_I8, "conv.ovf.i8", Pop1, PushI8, InlineNone, IPrimitive, 1, 0xFF, 0xB9, NEXT)
+OPDEF(CEE_CONV_OVF_U8, "conv.ovf.u8", Pop1, PushI8, InlineNone, IPrimitive, 1, 0xFF, 0xBA, NEXT)
+OPDEF(CEE_UNUSED50, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xBB, NEXT)
+OPDEF(CEE_UNUSED18, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xBC, NEXT)
+OPDEF(CEE_UNUSED19, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xBD, NEXT)
+OPDEF(CEE_UNUSED20, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xBE, NEXT)
+OPDEF(CEE_UNUSED21, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xBF, NEXT)
+OPDEF(CEE_UNUSED22, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xC0, NEXT)
+OPDEF(CEE_UNUSED23, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xC1, NEXT)
+OPDEF(CEE_REFANYVAL, "refanyval", Pop1, PushI, InlineType, IPrimitive, 1, 0xFF, 0xC2, NEXT)
+OPDEF(CEE_CKFINITE, "ckfinite", Pop1, PushR8, InlineNone, IPrimitive, 1, 0xFF, 0xC3, NEXT)
+OPDEF(CEE_UNUSED24, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xC4, NEXT)
+OPDEF(CEE_UNUSED25, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xC5, NEXT)
+OPDEF(CEE_MKREFANY, "mkrefany", PopI, Push1, InlineType, IPrimitive, 1, 0xFF, 0xC6, NEXT)
+OPDEF(CEE_UNUSED59, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xC7, NEXT)
+OPDEF(CEE_UNUSED60, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xC8, NEXT)
+OPDEF(CEE_UNUSED61, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xC9, NEXT)
+OPDEF(CEE_UNUSED62, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xCA, NEXT)
+OPDEF(CEE_UNUSED63, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xCB, NEXT)
+OPDEF(CEE_UNUSED64, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xCC, NEXT)
+OPDEF(CEE_UNUSED65, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xCD, NEXT)
+OPDEF(CEE_UNUSED66, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xCE, NEXT)
+OPDEF(CEE_UNUSED67, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xCF, NEXT)
+OPDEF(CEE_LDTOKEN, "ldtoken", Pop0, PushI, InlineTok, IPrimitive, 1, 0xFF, 0xD0, NEXT)
+OPDEF(CEE_CONV_U2, "conv.u2", Pop1, PushI, InlineNone, IPrimitive, 1, 0xFF, 0xD1, NEXT)
+OPDEF(CEE_CONV_U1, "conv.u1", Pop1, PushI, InlineNone, IPrimitive, 1, 0xFF, 0xD2, NEXT)
+OPDEF(CEE_CONV_I, "conv.i", Pop1, PushI, InlineNone, IPrimitive, 1, 0xFF, 0xD3, NEXT)
+OPDEF(CEE_CONV_OVF_I, "conv.ovf.i", Pop1, PushI, InlineNone, IPrimitive, 1, 0xFF, 0xD4, NEXT)
+OPDEF(CEE_CONV_OVF_U, "conv.ovf.u", Pop1, PushI, InlineNone, IPrimitive, 1, 0xFF, 0xD5, NEXT)
+OPDEF(CEE_ADD_OVF, "add.ovf", Pop1+Pop1, Push1, InlineNone, IPrimitive, 1, 0xFF, 0xD6, NEXT)
+OPDEF(CEE_ADD_OVF_UN, "add.ovf.un", Pop1+Pop1, Push1, InlineNone, IPrimitive, 1, 0xFF, 0xD7, NEXT)
+OPDEF(CEE_MUL_OVF, "mul.ovf", Pop1+Pop1, Push1, InlineNone, IPrimitive, 1, 0xFF, 0xD8, NEXT)
+OPDEF(CEE_MUL_OVF_UN, "mul.ovf.un", Pop1+Pop1, Push1, InlineNone, IPrimitive, 1, 0xFF, 0xD9, NEXT)
+OPDEF(CEE_SUB_OVF, "sub.ovf", Pop1+Pop1, Push1, InlineNone, IPrimitive, 1, 0xFF, 0xDA, NEXT)
+OPDEF(CEE_SUB_OVF_UN, "sub.ovf.un", Pop1+Pop1, Push1, InlineNone, IPrimitive, 1, 0xFF, 0xDB, NEXT)
+OPDEF(CEE_ENDFINALLY, "endfinally", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xDC, RETURN)
+OPDEF(CEE_LEAVE, "leave", Pop0, Push0, InlineBrTarget, IPrimitive, 1, 0xFF, 0xDD, BRANCH)
+OPDEF(CEE_LEAVE_S, "leave.s", Pop0, Push0, ShortInlineBrTarget,IPrimitive, 1, 0xFF, 0xDE, BRANCH)
+OPDEF(CEE_STIND_I, "stind.i", PopI+PopI, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xDF, NEXT)
+OPDEF(CEE_CONV_U, "conv.u", Pop1, PushI, InlineNone, IPrimitive, 1, 0xFF, 0xE0, NEXT)
+OPDEF(CEE_UNUSED26, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xE1, NEXT)
+OPDEF(CEE_UNUSED27, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xE2, NEXT)
+OPDEF(CEE_UNUSED28, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xE3, NEXT)
+OPDEF(CEE_UNUSED29, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xE4, NEXT)
+OPDEF(CEE_UNUSED30, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xE5, NEXT)
+OPDEF(CEE_UNUSED31, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xE6, NEXT)
+OPDEF(CEE_UNUSED32, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xE7, NEXT)
+OPDEF(CEE_UNUSED33, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xE8, NEXT)
+OPDEF(CEE_UNUSED34, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xE9, NEXT)
+OPDEF(CEE_UNUSED35, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xEA, NEXT)
+OPDEF(CEE_UNUSED36, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xEB, NEXT)
+OPDEF(CEE_UNUSED37, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xEC, NEXT)
+OPDEF(CEE_UNUSED38, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xED, NEXT)
+OPDEF(CEE_UNUSED39, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xEE, NEXT)
+OPDEF(CEE_UNUSED40, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xEF, NEXT)
+OPDEF(CEE_UNUSED41, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xF0, NEXT)
+OPDEF(CEE_UNUSED42, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xF1, NEXT)
+OPDEF(CEE_UNUSED43, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xF2, NEXT)
+OPDEF(CEE_UNUSED44, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xF3, NEXT)
+OPDEF(CEE_UNUSED45, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xF4, NEXT)
+OPDEF(CEE_UNUSED46, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xF5, NEXT)
+OPDEF(CEE_UNUSED47, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xF6, NEXT)
+OPDEF(CEE_UNUSED48, "unused", Pop0, Push0, InlineNone, IPrimitive, 1, 0xFF, 0xF7, NEXT)
+OPDEF(CEE_PREFIX7, "prefix7", Pop0, Push0, InlineNone, IInternal, 1, 0xFF, 0xF8, META)
+OPDEF(CEE_PREFIX6, "prefix6", Pop0, Push0, InlineNone, IInternal, 1, 0xFF, 0xF9, META)
+OPDEF(CEE_PREFIX5, "prefix5", Pop0, Push0, InlineNone, IInternal, 1, 0xFF, 0xFA, META)
+OPDEF(CEE_PREFIX4, "prefix4", Pop0, Push0, InlineNone, IInternal, 1, 0xFF, 0xFB, META)
+OPDEF(CEE_PREFIX3, "prefix3", Pop0, Push0, InlineNone, IInternal, 1, 0xFF, 0xFC, META)
+OPDEF(CEE_PREFIX2, "prefix2", Pop0, Push0, InlineNone, IInternal, 1, 0xFF, 0xFD, META)
+OPDEF(CEE_PREFIX1, "prefix1", Pop0, Push0, InlineNone, IInternal, 1, 0xFF, 0xFE, META)
+OPDEF(CEE_PREFIXREF, "prefixref", Pop0, Push0, InlineNone, IInternal, 1, 0xFF, 0xFF, META)
+
+OPDEF(CEE_ARGLIST, "arglist", Pop0, PushI, InlineNone, IPrimitive, 2, 0xFE, 0x00, NEXT)
+OPDEF(CEE_CEQ, "ceq", Pop1+Pop1, PushI, InlineNone, IPrimitive, 2, 0xFE, 0x01, NEXT)
+OPDEF(CEE_CGT, "cgt", Pop1+Pop1, PushI, InlineNone, IPrimitive, 2, 0xFE, 0x02, NEXT)
+OPDEF(CEE_CGT_UN, "cgt.un", Pop1+Pop1, PushI, InlineNone, IPrimitive, 2, 0xFE, 0x03, NEXT)
+OPDEF(CEE_CLT, "clt", Pop1+Pop1, PushI, InlineNone, IPrimitive, 2, 0xFE, 0x04, NEXT)
+OPDEF(CEE_CLT_UN, "clt.un", Pop1+Pop1, PushI, InlineNone, IPrimitive, 2, 0xFE, 0x05, NEXT)
+OPDEF(CEE_LDFTN, "ldftn", Pop0, PushI, InlineMethod, IPrimitive, 2, 0xFE, 0x06, NEXT)
+OPDEF(CEE_LDVIRTFTN, "ldvirtftn", PopRef, PushI, InlineMethod, IPrimitive, 2, 0xFE, 0x07, NEXT)
+OPDEF(CEE_UNUSED56, "unused", Pop0, Push0, InlineNone, IPrimitive, 2, 0xFE, 0x08, NEXT)
+OPDEF(CEE_LDARG, "ldarg", Pop0, Push1, InlineVar, IPrimitive, 2, 0xFE, 0x09, NEXT)
+OPDEF(CEE_LDARGA, "ldarga", Pop0, PushI, InlineVar, IPrimitive, 2, 0xFE, 0x0A, NEXT)
+OPDEF(CEE_STARG, "starg", Pop1, Push0, InlineVar, IPrimitive, 2, 0xFE, 0x0B, NEXT)
+OPDEF(CEE_LDLOC, "ldloc", Pop0, Push1, InlineVar, IPrimitive, 2, 0xFE, 0x0C, NEXT)
+OPDEF(CEE_LDLOCA, "ldloca", Pop0, PushI, InlineVar, IPrimitive, 2, 0xFE, 0x0D, NEXT)
+OPDEF(CEE_STLOC, "stloc", Pop1, Push0, InlineVar, IPrimitive, 2, 0xFE, 0x0E, NEXT)
+OPDEF(CEE_LOCALLOC, "localloc", PopI, PushI, InlineNone, IPrimitive, 2, 0xFE, 0x0F, NEXT)
+OPDEF(CEE_UNUSED57, "unused", Pop0, Push0, InlineNone, IPrimitive, 2, 0xFE, 0x10, NEXT)
+OPDEF(CEE_ENDFILTER, "endfilter", PopI, Push0, InlineNone, IPrimitive, 2, 0xFE, 0x11, RETURN)
+OPDEF(CEE_UNALIGNED, "unaligned.", Pop0, Push0, ShortInlineI, IPrefix, 2, 0xFE, 0x12, META)
+OPDEF(CEE_VOLATILE, "volatile.", Pop0, Push0, InlineNone, IPrefix, 2, 0xFE, 0x13, META)
+OPDEF(CEE_TAILCALL, "tail.", Pop0, Push0, InlineNone, IPrefix, 2, 0xFE, 0x14, META)
+OPDEF(CEE_INITOBJ, "initobj", PopI, Push0, InlineType, IObjModel, 2, 0xFE, 0x15, NEXT)
+OPDEF(CEE_CONSTRAINED, "constrained.", Pop0, Push0, InlineType, IPrefix, 2, 0xFE, 0x16, META)
+OPDEF(CEE_CPBLK, "cpblk", PopI+PopI+PopI, Push0, InlineNone, IPrimitive, 2, 0xFE, 0x17, NEXT)
+OPDEF(CEE_INITBLK, "initblk", PopI+PopI+PopI, Push0, InlineNone, IPrimitive, 2, 0xFE, 0x18, NEXT)
+OPDEF(CEE_UNUSED69, "unused", Pop0, Push0, InlineNone, IPrimitive, 2, 0xFE, 0x19, NEXT)
+OPDEF(CEE_RETHROW, "rethrow", Pop0, Push0, InlineNone, IObjModel, 2, 0xFE, 0x1A, THROW)
+OPDEF(CEE_UNUSED51, "unused", Pop0, Push0, InlineNone, IPrimitive, 2, 0xFE, 0x1B, NEXT)
+OPDEF(CEE_SIZEOF, "sizeof", Pop0, PushI, InlineType, IPrimitive, 2, 0xFE, 0x1C, NEXT)
+OPDEF(CEE_REFANYTYPE, "refanytype", Pop1, PushI, InlineNone, IPrimitive, 2, 0xFE, 0x1D, NEXT)
+OPDEF(CEE_READONLY, "readonly.", Pop0, Push0, InlineNone, IPrefix, 2, 0xFE, 0x1E, META)
+OPDEF(CEE_UNUSED53, "unused", Pop0, Push0, InlineNone, IPrimitive, 2, 0xFE, 0x1F, NEXT)
+OPDEF(CEE_UNUSED54, "unused", Pop0, Push0, InlineNone, IPrimitive, 2, 0xFE, 0x20, NEXT)
+OPDEF(CEE_UNUSED55, "unused", Pop0, Push0, InlineNone, IPrimitive, 2, 0xFE, 0x21, NEXT)
+OPDEF(CEE_UNUSED70, "unused", Pop0, Push0, InlineNone, IPrimitive, 2, 0xFE, 0x22, NEXT)
+
+// These are not real opcodes, but they are handy internally in the EE
+
+OPDEF(CEE_ILLEGAL, "illegal", Pop0, Push0, InlineNone, IInternal, 0, MOOT, MOOT, META)
+OPDEF(CEE_MACRO_END, "endmac", Pop0, Push0, InlineNone, IInternal, 0, MOOT, MOOT, META)
+OPDEF(CEE_CODE_LABEL, "codelabel", Pop0, Push0, InlineNone, IInternal, 0, MOOT, MOOT, META)
+
+#ifndef OPALIAS
+#define _OPALIAS_DEFINED_
+#define OPALIAS(canonicalName, stringName, realOpcode)
+#endif
+
+OPALIAS(CEE_BRNULL, "brnull", CEE_BRFALSE)
+OPALIAS(CEE_BRNULL_S, "brnull.s", CEE_BRFALSE_S)
+OPALIAS(CEE_BRZERO, "brzero", CEE_BRFALSE)
+OPALIAS(CEE_BRZERO_S, "brzero.s", CEE_BRFALSE_S)
+OPALIAS(CEE_BRINST, "brinst", CEE_BRTRUE)
+OPALIAS(CEE_BRINST_S, "brinst.s", CEE_BRTRUE_S)
+OPALIAS(CEE_LDIND_U8, "ldind.u8", CEE_LDIND_I8)
+OPALIAS(CEE_LDELEM_U8, "ldelem.u8", CEE_LDELEM_I8)
+OPALIAS(CEE_LDELEM_ANY, "ldelem.any", CEE_LDELEM)
+OPALIAS(CEE_STELEM_ANY, "stelem.any", CEE_STELEM)
+OPALIAS(CEE_LDC_I4_M1x, "ldc.i4.M1", CEE_LDC_I4_M1)
+OPALIAS(CEE_ENDFAULT, "endfault", CEE_ENDFINALLY)
+
+#ifdef _OPALIAS_DEFINED_
+#undef OPALIAS
+#undef _OPALIAS_DEFINED_
+#endif
+
diff --git a/src/inc/openum.h b/src/inc/openum.h
new file mode 100644
index 0000000000..f71e411ddc
--- /dev/null
+++ b/src/inc/openum.h
@@ -0,0 +1,51 @@
+// 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.
+
+#ifndef __openum_h__
+#define __openum_h__
+
+
+typedef enum opcode_t
+{
+#define OPDEF(c,s,pop,push,args,type,l,s1,s2,ctrl) c,
+#include "opcode.def"
+#undef OPDEF
+ CEE_COUNT, /* number of instructions and macros pre-defined */
+} OPCODE;
+
+
+typedef enum opcode_format_t
+{
+ InlineNone = 0, // no inline args
+ InlineVar = 1, // local variable (U2 (U1 if Short on))
+ InlineI = 2, // an signed integer (I4 (I1 if Short on))
+ InlineR = 3, // a real number (R8 (R4 if Short on))
+ InlineBrTarget = 4, // branch target (I4 (I1 if Short on))
+ InlineI8 = 5,
+ InlineMethod = 6, // method token (U4)
+ InlineField = 7, // field token (U4)
+ InlineType = 8, // type token (U4)
+ InlineString = 9, // string TOKEN (U4)
+ InlineSig = 10, // signature tok (U4)
+ InlineRVA = 11, // ldptr token (U4)
+ InlineTok = 12, // a meta-data token of unknown type (U4)
+ InlineSwitch = 13, // count (U4), pcrel1 (U4) .... pcrelN (U4)
+ InlinePhi = 14, // count (U1), var1 (U2) ... varN (U2)
+
+ // WATCH OUT we are close to the limit here, if you add
+ // more enumerations you need to change ShortIline definition below
+
+ // The extended enumeration also encodes the size in the IL stream
+ ShortInline = 16, // if this bit is set, the format is the 'short' format
+ PrimaryMask = (ShortInline-1), // mask these off to get primary enumeration above
+ ShortInlineVar = (ShortInline + InlineVar),
+ ShortInlineI = (ShortInline + InlineI),
+ ShortInlineR = (ShortInline + InlineR),
+ ShortInlineBrTarget = (ShortInline + InlineBrTarget),
+ InlineOpcode = (ShortInline + InlineNone), // This is only used internally. It means the 'opcode' is two byte instead of 1
+} OPCODE_FORMAT;
+
+#endif /* __openum_h__ */
+
+
diff --git a/src/inc/opinfo.h b/src/inc/opinfo.h
new file mode 100644
index 0000000000..d98c006ecd
--- /dev/null
+++ b/src/inc/opinfo.h
@@ -0,0 +1,83 @@
+// 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.
+
+
+/***************************************************************************/
+/* OpInfo.h */
+/***************************************************************************/
+
+/* contains OpInfo, a wrapper that allows you to get useful information
+ about IL opcodes, and how to decode them */
+
+/***************************************************************************/
+
+#ifndef OpInfo_h
+#define OpInfo_h
+
+#include "openum.h"
+
+ // Decribes the flow of control properties of the instruction
+enum OpFlow {
+ FLOW_META, // not a real instuction
+ FLOW_CALL, // a call instruction
+ FLOW_BRANCH, // unconditional branch, does not fall through
+ FLOW_COND_BRANCH, // may fall through
+ FLOW_PHI,
+ FLOW_THROW,
+ FLOW_BREAK,
+ FLOW_RETURN,
+ FLOW_NEXT, // flows into next instruction (none of the above)
+};
+
+ // These are all the possible arguments for the instruction
+/****************************************************************************/
+union OpArgsVal {
+ __int32 i;
+ __int64 i8;
+ double r;
+ struct {
+ unsigned count;
+ int* targets; // targets are pcrelative displacements (little-endian)
+ } switch_;
+ struct {
+ unsigned count;
+ unsigned short* vars;
+ } phi;
+};
+
+/***************************************************************************/
+
+ // OpInfo parses a il instrution into an opcode, and a arg and updates the IP
+class OpInfo {
+public:
+ OpInfo() { data = 0; }
+ OpInfo(OPCODE opCode) { _ASSERTE(opCode < CEE_COUNT); data = &table[opCode]; }
+
+ // fetch instruction at 'instrPtr, fills in 'args' returns pointer
+ // to next instruction
+ const unsigned char* fetch(const unsigned char* instrPtr, OpArgsVal* args);
+
+ const char* getName() { return(data->name); }
+ OPCODE_FORMAT getArgsInfo() { return(OPCODE_FORMAT(data->format & PrimaryMask)); }
+ OpFlow getFlow() { return(data->flow); }
+ OPCODE getOpcode() { return((OPCODE) (data-table)); }
+ int getNumPop() { return(data->numPop); }
+ int getNumPush() { return(data->numPush); }
+
+private:
+ struct OpInfoData {
+ const char* name;
+ OPCODE_FORMAT format : 8;
+ OpFlow flow : 8;
+ int numPop : 3; // < 0 means depends on instr args
+ int numPush : 3; // < 0 means depends on instr args
+ OPCODE opcode : 10; // This is the same as the index into the table
+ };
+
+ static OpInfoData table[];
+private:
+ OpInfoData* data;
+};
+
+#endif
diff --git a/src/inc/optdefault.h b/src/inc/optdefault.h
new file mode 100644
index 0000000000..dd0bd44c04
--- /dev/null
+++ b/src/inc/optdefault.h
@@ -0,0 +1,12 @@
+// 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.
+
+//
+// Revert optimizations back to default
+//
+#undef FPO_ON
+
+#ifdef _MSC_VER
+#pragma optimize("",on)
+#endif
diff --git a/src/inc/optsmallperfcritical.h b/src/inc/optsmallperfcritical.h
new file mode 100644
index 0000000000..68c80884e3
--- /dev/null
+++ b/src/inc/optsmallperfcritical.h
@@ -0,0 +1,21 @@
+// 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.
+
+//
+// Set optimizations settings for small performance critical methods
+//
+
+#ifdef FPO_ON
+#error Recursive use of FPO_ON not supported
+#endif
+
+#define FPO_ON 1
+
+
+#if defined(_MSC_VER) && !defined(_DEBUG)
+ #pragma optimize("t", on) // optimize for speed
+ #if !defined(_AMD64_) // 'y' isn't an option on amd64
+ #pragma optimize("y", on) // omit frame pointer
+ #endif // !defined(_TARGET_AMD64_)
+#endif
diff --git a/src/inc/ostype.h b/src/inc/ostype.h
new file mode 100644
index 0000000000..c18d05a5f6
--- /dev/null
+++ b/src/inc/ostype.h
@@ -0,0 +1,176 @@
+// 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 "staticcontract.h"
+
+#ifndef WRAPPER_NO_CONTRACT
+#define WRAPPER_NO_CONTRACT ANNOTATION_WRAPPER
+#endif
+
+#ifndef LIMITED_METHOD_CONTRACT
+#define LIMITED_METHOD_CONTRACT ANNOTATION_FN_LEAF
+#endif
+
+//*****************************************************************************
+// Enum to track which version of the OS we are running
+// Note that NT5 (Win2k) is the minimum supported platform. Any code using
+// utilcode (which includes the CLR's execution engine) will fail to start
+// on a pre-Win2k platform. This is enforced by InitRunningOnVersionStatus.
+//
+// Note: The value is used for data mining from links clicked by user in shim dialog - see code:FWLinkTemplateFromTextID
+// Please do not modify existing values, adding new ones is fine.
+//*****************************************************************************
+typedef enum {
+ RUNNING_ON_STATUS_UNINITED = 0,
+ RUNNING_ON_WINNT5 = 1,
+ RUNNING_ON_WINXP = 2,
+ RUNNING_ON_WIN2003 = 3, // _WIN64 can assume that all OSes that we're running on will be WIN2003+
+ RUNNING_ON_VISTA = 4,
+ RUNNING_ON_WIN7 = 5,
+ RUNNING_ON_WIN8 = 6
+} RunningOnStatusEnum;
+
+extern RunningOnStatusEnum gRunningOnStatus;
+extern BOOL gExInfoAvailable;
+extern BOOL gExInfoIsServer;
+
+void InitRunningOnVersionStatus();
+
+#if defined(FEATURE_COMINTEROP) && !defined(FEATURE_CORESYSTEM)
+typedef enum
+{
+ WINRT_STATUS_UNINITED = 0,
+ WINRT_STATUS_UNSUPPORTED,
+ WINRT_STATUS_SUPPORTED
+}
+WinRTStatusEnum;
+
+extern WinRTStatusEnum gWinRTStatus;
+
+void InitWinRTStatus();
+#endif // FEATURE_COMINTEROP && !FEATURE_CORESYSTEM
+
+//*****************************************************************************
+//
+// List of currently supported platforms:
+//
+// Win2000 - not supported
+// WinXP - not supported
+// Win2k3 - not supported
+// Vista - desktop, CoreCLR
+// Win7 - desktop, CoreCLR
+// Win8 - desktop, CoreCLR on CoreSystem, ARM
+//
+//*****************************************************************************
+
+//*****************************************************************************
+// Returns true if you are running on Windows 7 or newer.
+//*****************************************************************************
+inline BOOL RunningOnWin7()
+{
+ WRAPPER_NO_CONTRACT;
+#if defined(_ARM_) || defined(FEATURE_CORESYSTEM)
+ return TRUE;
+#else
+ if (gRunningOnStatus == RUNNING_ON_STATUS_UNINITED)
+ {
+ InitRunningOnVersionStatus();
+ }
+
+ return (gRunningOnStatus >= RUNNING_ON_WIN7) ? TRUE : FALSE;
+#endif
+}
+
+//*****************************************************************************
+// Returns true if you are running on Windows 8 or newer.
+//*****************************************************************************
+inline BOOL RunningOnWin8()
+{
+ WRAPPER_NO_CONTRACT;
+#if defined(_ARM_) || defined(CROSSGEN_COMPILE)
+ return TRUE;
+#else
+ if (gRunningOnStatus == RUNNING_ON_STATUS_UNINITED)
+ {
+ InitRunningOnVersionStatus();
+ }
+
+ return (gRunningOnStatus >= RUNNING_ON_WIN8) ? TRUE : FALSE;
+#endif
+}
+
+//*****************************************************************************
+// Returns true if extra information is available
+//*****************************************************************************
+inline BOOL ExOSInfoAvailable()
+{
+ WRAPPER_NO_CONTRACT;
+ if (gRunningOnStatus == RUNNING_ON_STATUS_UNINITED)
+ {
+ InitRunningOnVersionStatus();
+ }
+
+ return gExInfoAvailable;
+}
+
+//*****************************************************************************
+// Returns true if we're running on a server OS. Requires ExOSInfoAvailable()
+// to be TRUE
+//*****************************************************************************
+inline BOOL ExOSInfoRunningOnServer()
+{
+ WRAPPER_NO_CONTRACT;
+ /*
+ @TODO: _ASSERTE not available here...
+ _ASSERTE(ExOSInfoAvailable() &&
+ "You should only call this after making sure ExOSInfoAvailable() returned TRUE");
+ */
+ if (gRunningOnStatus == RUNNING_ON_STATUS_UNINITED)
+ {
+ InitRunningOnVersionStatus();
+ }
+
+ return gExInfoIsServer;
+}
+
+#ifdef FEATURE_COMINTEROP
+
+#ifdef FEATURE_CORESYSTEM
+
+inline BOOL WinRTSupported()
+{
+ return RunningOnWin8();
+}
+#else
+inline BOOL WinRTSupported()
+{
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_GC_NOTRIGGER;
+ STATIC_CONTRACT_CANNOT_TAKE_LOCK;
+ STATIC_CONTRACT_SO_TOLERANT;
+
+#ifdef CROSSGEN_COMPILE
+ return TRUE;
+#endif
+
+ if (gWinRTStatus == WINRT_STATUS_UNINITED)
+ {
+ InitWinRTStatus();
+ }
+
+ return gWinRTStatus == WINRT_STATUS_SUPPORTED;
+}
+#endif // FEATURE_CORESYSTEM
+
+#endif // FEATURE_COMINTEROP
+
+#ifdef _WIN64
+inline BOOL RunningInWow64()
+{
+ return FALSE;
+}
+#else
+BOOL RunningInWow64();
+#endif
diff --git a/src/inc/outstring.h b/src/inc/outstring.h
new file mode 100644
index 0000000000..5cf0236350
--- /dev/null
+++ b/src/inc/outstring.h
@@ -0,0 +1,157 @@
+// 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.
+
+
+/*****************************************************************/
+/* OutString.h */
+/*****************************************************************/
+/* A simple, lightweight, character output stream, with very few
+ external dependancies (like sprintf ... ) */
+
+/*
+ Date : 2/1/99 */
+/*****************************************************************/
+
+#ifndef _OutString_h
+#define _OutString_h 1
+
+#include "utilcode.h" // for overloaded new
+#include <string.h> // for strlen, strcpy
+
+/*****************************************************************/
+ // a light weight character 'output' stream
+class OutString {
+public:
+ enum FormatFlags { // used to control printing of numbers
+ none = 0,
+ put0x = 1, // put leading 0x on hexidecimal
+ zeroFill = 2, // zero fill (instead of space fill)
+ };
+
+ OutString() : start(0), end(0), cur(0) {}
+
+ OutString(unsigned initialAlloc) {
+ cur = start = new char[initialAlloc+1]; // for null termination
+ end = &start[initialAlloc];
+ }
+
+ ~OutString() { delete start; }
+
+ // shortcut for printing decimal
+ OutString& operator<<(int i) { return(dec(i)); }
+
+ OutString& operator<<(double d);
+
+ // FIX make this really unsigned
+ OutString& operator<<(unsigned i) { return(dec(i)); }
+
+ // prints out the hexidecimal representation
+ OutString& dec(int i, size_t minWidth = 0);
+
+ // prints out the hexidecimal representation
+ OutString& hex(unsigned i, int minWidth = 0, unsigned flags = none);
+
+ OutString& hex(unsigned __int64 i, int minWidth = 0, unsigned flags = none);
+
+ OutString& hex(int i, int minWidth = 0, unsigned flags = none) {
+ return hex(unsigned(i), minWidth, flags);
+ }
+
+ OutString& hex(__int64 i, int minWidth = 0, unsigned flags = none) {
+ return hex((unsigned __int64) i, minWidth, flags);
+ }
+
+ // print out 'count' instances of the character 'c'
+ OutString& pad(size_t count, char c);
+
+ OutString& operator<<(char c) {
+ if (cur >= end)
+ Realloc(1);
+ *cur++ = c;
+ _ASSERTE(start <= cur && cur <= end);
+ return(*this);
+ }
+
+ OutString& operator<<(const wchar_t* str) {
+ size_t len = wcslen(str);
+ if (cur+len > end)
+ Realloc(len);
+ while(str != 0)
+ *cur++ = (char) *str++;
+ _ASSERTE(start <= cur && cur <= end);
+ return(*this);
+ }
+
+ OutString& prepend(const char c) {
+ char buff[2]; buff[0] = c; buff[1] = 0;
+ return(prepend(buff));
+ }
+
+ OutString& prepend(const char* str) {
+ size_t len = strlen(str);
+ if (cur+len > end)
+ Realloc(len);
+ memmove(start+len, start, cur-start);
+ memcpy(start, str, len);
+ cur = cur + len;
+ _ASSERTE(start <= cur && cur <= end);
+ return(*this);
+ }
+
+ OutString& operator=(const OutString& str) {
+ clear();
+ *this << str;
+ return(*this);
+ }
+
+ OutString& operator<<(const OutString& str) {
+ write(str.start, str.cur-str.start);
+ return(*this);
+ }
+
+ OutString& operator<<(const char* str) {
+ write(str, strlen(str));
+ return(*this);
+ }
+
+ void write(const char* str, size_t len) {
+ if (cur+len > end)
+ Realloc(len);
+ memcpy(cur, str, len);
+ cur = cur + len;
+ _ASSERTE(start <= cur && cur <= end);
+ }
+
+ void swap(OutString& str) {
+ char* tmp = start;
+ start = str.start;
+ str.start = tmp;
+ tmp = end;
+ end = str.end;
+ str.end = tmp;
+ tmp = cur;
+ cur = str.cur;
+ str.cur = tmp;
+ _ASSERTE(start <= cur && cur <= end);
+ }
+
+ void clear() { cur = start; }
+ size_t length() const { return(cur-start); }
+
+ // return the null terminated string, OutString keeps ownership
+ const char* val() const { *cur = 0; return(start); }
+
+ // grab string (caller must now delete) OutString is cleared
+ char* grab() { char* ret = start; *cur = 0; end = cur = start = 0; return(ret); }
+
+private:
+ void Realloc(size_t neededSpace);
+
+ char *start; // start of the buffer
+ char *end; // points at the last place null terminator can go
+ char *cur; // points at a null terminator
+};
+
+#endif // _OutString_h
+
diff --git a/src/inc/palclr.h b/src/inc/palclr.h
new file mode 100644
index 0000000000..85c802f65b
--- /dev/null
+++ b/src/inc/palclr.h
@@ -0,0 +1,624 @@
+// 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.
+// ===========================================================================
+// File: palclr.h
+//
+// Various macros and constants that are necessary to make the CLR portable.
+//
+
+// ===========================================================================
+
+
+#if !defined(FEATURE_PAL)
+
+#ifndef __PALCLR_H__
+#define __PALCLR_H__
+
+// This macro is used to standardize the wide character string literals between UNIX and Windows.
+// Unix L"" is UTF32, and on windows it's UTF16. Because of built-in assumptions on the size
+// of string literals, it's important to match behaviour between Unix and Windows. Unix will be defined
+// as u"" (char16_t)
+#ifdef PLATFORM_UNIX
+#define W(str) u##str
+#else // PLATFORM_UNIX
+#define W(str) L##str
+#endif // PLATFORM_UNIX
+
+#include <windef.h>
+
+#if !defined(_DEBUG_IMPL) && defined(_DEBUG) && !defined(DACCESS_COMPILE)
+#define _DEBUG_IMPL 1
+#endif
+
+//
+// CPP_ASSERT() can be used within a class definition, to perform a
+// compile-time assertion involving private names within the class.
+//
+// MS compiler doesn't allow redefinition of the typedef within a template.
+// gcc doesn't allow redefinition of the typedef within a class, though
+// it does at file scope.
+#define CPP_ASSERT(n, e) typedef char __C_ASSERT__##n[(e) ? 1 : -1];
+
+
+// PORTABILITY_ASSERT and PORTABILITY_WARNING macros are meant to be used to
+// mark places in the code that needs attention for portability. The usual
+// usage pattern is:
+//
+// int get_scratch_register() {
+// #if defined(_TARGET_X86_)
+// return eax;
+// #elif defined(_TARGET_AMD64_)
+// return rax;
+// #elif defined(_TARGET_ARM_)
+// return r0;
+// #else
+// PORTABILITY_ASSERT("scratch register");
+// return 0;
+// #endif
+// }
+//
+// PORTABILITY_ASSERT is meant to be used inside functions/methods. It can
+// introduce compile-time and/or run-time errors.
+// PORTABILITY_WARNING is meant to be used outside functions/methods. It can
+// introduce compile-time errors or warnings only.
+//
+// People starting new ports will first define these to just cause run-time
+// errors. Once they fix all the places that need attention for portability,
+// they can define PORTABILITY_ASSERT and PORTABILITY_WARNING to cause
+// compile-time errors to make sure that they haven't missed anything.
+//
+// If it is reasonably possible all codepaths containing PORTABILITY_ASSERT
+// should be compilable (e.g. functions should return NULL or something if
+// they are expected to return a value).
+//
+// The message in these two macros should not contain any keywords like TODO
+// or NYI. It should be just the brief description of the problem.
+
+#if defined(_TARGET_X86_)
+// Finished ports - compile-time errors
+#define PORTABILITY_WARNING(message) NEED_TO_PORT_THIS_ONE(NEED_TO_PORT_THIS_ONE)
+#define PORTABILITY_ASSERT(message) NEED_TO_PORT_THIS_ONE(NEED_TO_PORT_THIS_ONE)
+#else
+// Ports in progress - run-time asserts only
+#define PORTABILITY_WARNING(message)
+#define PORTABILITY_ASSERT(message) _ASSERTE(false && message)
+#endif
+
+#define DIRECTORY_SEPARATOR_CHAR_A '\\'
+#define DIRECTORY_SEPARATOR_STR_A "\\"
+#define DIRECTORY_SEPARATOR_CHAR_W W('\\')
+#define DIRECTORY_SEPARATOR_STR_W W("\\")
+
+#define PATH_SEPARATOR_CHAR_W W(';')
+#define PATH_SEPARATOR_STR_W W(";")
+
+#define VOLUME_SEPARATOR_CHAR_W W(':')
+
+// PAL Macros
+// Not all compilers support fully anonymous aggregate types, so the
+// PAL provides names for those types. To allow existing definitions of
+// those types to continue to work, we provide macros that should be
+// used to reference fields within those types.
+
+#ifndef DECIMAL_SCALE
+#define DECIMAL_SCALE(dec) ((dec).scale)
+#endif
+
+#ifndef DECIMAL_SIGN
+#define DECIMAL_SIGN(dec) ((dec).sign)
+#endif
+
+#ifndef DECIMAL_SIGNSCALE
+#define DECIMAL_SIGNSCALE(dec) ((dec).signscale)
+#endif
+
+#ifndef DECIMAL_LO32
+#define DECIMAL_LO32(dec) ((dec).Lo32)
+#endif
+
+#ifndef DECIMAL_MID32
+#define DECIMAL_MID32(dec) ((dec).Mid32)
+#endif
+
+#ifndef DECIMAL_HI32
+#define DECIMAL_HI32(dec) ((dec).Hi32)
+#endif
+
+#ifndef DECIMAL_LO64_GET
+#define DECIMAL_LO64_GET(dec) ((dec).Lo64)
+#endif
+
+#ifndef DECIMAL_LO64_SET
+#define DECIMAL_LO64_SET(dec,value) {(dec).Lo64 = value; }
+#endif
+
+#ifndef IMAGE_RELOC_FIELD
+#define IMAGE_RELOC_FIELD(img, f) ((img).f)
+#endif
+
+#ifndef IMAGE_IMPORT_DESC_FIELD
+#define IMAGE_IMPORT_DESC_FIELD(img, f) ((img).f)
+#endif
+
+//Remove these "unanonymous" unions from newer builds for now. Confirm that they were never needed when we
+//bring back Rotor.
+#define IMAGE_RDE_ID(img) ((img)->Id)
+#ifndef IMAGE_RDE_ID
+#define IMAGE_RDE_ID(img) ((img)->Id)
+#endif
+
+#define IMAGE_RDE_NAME(img) ((img)->Name)
+#ifndef IMAGE_RDE_NAME
+#define IMAGE_RDE_NAME(img) ((img)->Name)
+#endif
+
+#define IMAGE_RDE_OFFSET(img) ((img)->OffsetToData)
+#ifndef IMAGE_RDE_OFFSET
+#define IMAGE_RDE_OFFSET(img) ((img)->OffsetToData)
+#endif
+
+#ifndef IMAGE_RDE_NAME_FIELD
+#define IMAGE_RDE_NAME_FIELD(img, f) ((img)->f)
+#endif
+
+#define IMAGE_RDE_OFFSET_FIELD(img, f) ((img)->f)
+#ifndef IMAGE_RDE_OFFSET_FIELD
+#define IMAGE_RDE_OFFSET_FIELD(img, f) ((img)->f)
+#endif
+
+#ifndef IMAGE_FE64_FIELD
+#define IMAGE_FE64_FIELD(img, f) ((img).f)
+#endif
+
+#ifndef IMPORT_OBJ_HEADER_FIELD
+#define IMPORT_OBJ_HEADER_FIELD(obj, f) ((obj).f)
+#endif
+
+#ifndef IMAGE_COR20_HEADER_FIELD
+#define IMAGE_COR20_HEADER_FIELD(obj, f) ((obj).f)
+#endif
+
+
+// PAL Numbers
+// Used to ensure cross-compiler compatibility when declaring large
+// integer constants. 64-bit integer constants should be wrapped in the
+// declarations listed here.
+//
+// Each of the #defines here is wrapped to avoid conflicts with rotor_pal.h.
+
+#if defined(_MSC_VER)
+
+// MSVC's way of declaring large integer constants
+// If you define these in one step, without the _HELPER macros, you
+// get extra whitespace when composing these with other concatenating macros.
+#ifndef I64
+#define I64_HELPER(x) x ## i64
+#define I64(x) I64_HELPER(x)
+#endif
+
+#ifndef UI64
+#define UI64_HELPER(x) x ## ui64
+#define UI64(x) UI64_HELPER(x)
+#endif
+
+#else
+
+// GCC's way of declaring large integer constants
+// If you define these in one step, without the _HELPER macros, you
+// get extra whitespace when composing these with other concatenating macros.
+#ifndef I64
+#define I64_HELPER(x) x ## LL
+#define I64(x) I64_HELPER(x)
+#endif
+
+#ifndef UI64
+#define UI64_HELPER(x) x ## ULL
+#define UI64(x) UI64_HELPER(x)
+#endif
+
+#endif
+
+
+// PAL SEH
+// Macros for portable exception handling. The Win32 SEH is emulated using
+// these macros and setjmp/longjmp on Unix
+//
+// Usage notes:
+//
+// - The filter has to be a function taking two parameters:
+// LONG MyFilter(PEXCEPTION_POINTERS *pExceptionInfo, PVOID pv)
+//
+// - It is not possible to directly use the local variables in the filter.
+// All the local information that the filter has to need to know about should
+// be passed through pv parameter
+//
+// - Do not use goto to jump out of the PAL_TRY block
+// (jumping out of the try block is not a good idea even on Win32, because of
+// it causes stack unwind)
+//
+// - It is not possible to directly use the local variables in the try block.
+// All the local information that the filter has to need to know about should
+// be passed through pv parameter
+//
+//
+// Simple examples:
+//
+// struct Param { ... local variables used in try block and filter ... } param;
+// PAL_TRY(Param *, pParam, &param) { // read as: Param *pParam = &param;
+// ....
+// } PAL_FINALLY {
+// ....
+// }
+// PAL_ENDTRY
+//
+//
+// struct Param { ... local variables used in try block and filter ... } param;
+// PAL_TRY(Param *, pParam, &param) {
+// ....
+// } PAL_EXCEPT(EXCEPTION_EXECUTE_HANDLER) {
+// ....
+// }
+// PAL_ENDTRY
+//
+//
+// LONG MyFilter(PEXCEPTION_POINTERS *pExceptionInfo, PVOID pv)
+// {
+// ...
+// }
+// PAL_TRY(void *, unused, NULL) {
+// ....
+// } PAL_EXCEPT_FILTER(MyFilter) {
+// ....
+// }
+// PAL_ENDTRY
+//
+//
+// Complex example:
+//
+// struct MyParams
+// {
+// ...
+// } params;
+//
+// PAL_TRY(MyParams *, pMyParamsOuter, &params) {
+// PAL_TRY(MyParams *, pMyParamsInnter, pMyParamsOuter) {
+// ...
+// if (error) goto Done;
+// ...
+// Done: ;
+// } PAL_EXCEPT_FILTER(OtherFilter) {
+// ...
+// }
+// PAL_ENDTRY
+// }
+// PAL_FINALLY {
+// }
+// PAL_ENDTRY
+//
+
+#include "staticcontract.h"
+
+#define HardwareExceptionHolder
+
+// Note: PAL_SEH_RESTORE_GUARD_PAGE is only ever defined in clrex.h, so we only restore guard pages automatically
+// when these macros are used from within the VM.
+#define PAL_SEH_RESTORE_GUARD_PAGE
+
+#define PAL_TRY_NAKED \
+ { \
+ bool __exHandled; __exHandled = false; \
+ DWORD __exCode; __exCode = 0; \
+ SCAN_EHMARKER(); \
+ __try \
+ { \
+ SCAN_EHMARKER_TRY();
+
+#define PAL_EXCEPT_NAKED(Disposition) \
+ } \
+ __except(__exCode = GetExceptionCode(), Disposition) \
+ { \
+ __exHandled = true; \
+ SCAN_EHMARKER_CATCH(); \
+ PAL_SEH_RESTORE_GUARD_PAGE
+
+#define PAL_EXCEPT_FILTER_NAKED(pfnFilter, param) \
+ } \
+ __except(__exCode = GetExceptionCode(), \
+ pfnFilter(GetExceptionInformation(), param)) \
+ { \
+ __exHandled = true; \
+ SCAN_EHMARKER_CATCH(); \
+ PAL_SEH_RESTORE_GUARD_PAGE
+
+#define PAL_FINALLY_NAKED \
+ } \
+ __finally \
+ { \
+
+#define PAL_ENDTRY_NAKED \
+ } \
+ PAL_ENDTRY_NAKED_DBG \
+ } \
+
+
+#if defined(_DEBUG) && !defined(DACCESS_COMPILE)
+//
+// In debug mode, compile the try body as a method of a local class.
+// This way, the compiler will check that the body is not directly
+// accessing any local variables and arguments.
+//
+#define PAL_TRY(__ParamType, __paramDef, __paramRef) \
+{ \
+ __ParamType __param = __paramRef; \
+ __ParamType __paramToPassToFilter = __paramRef; \
+ class __Body \
+ { \
+ public: \
+ static void Run(__ParamType __paramDef) \
+ { \
+ PAL_TRY_HANDLER_DBG_BEGIN
+
+// PAL_TRY implementation that abstracts usage of COMPILER_INSTANCE*, which is used by
+// JIT64. On Windows, we dont need to do anything special as we dont have nested classes/methods
+// as on PAL.
+#define PAL_TRY_CI(__ParamType, __paramDef, __paramRef) \
+{ \
+ struct __HandlerData { \
+ __ParamType __param; \
+ COMPILER_INSTANCE *__ciPtr; \
+ }; \
+ __HandlerData handlerData; \
+ handlerData.__param = __paramRef; \
+ handlerData.__ciPtr = ciPtr; \
+ __HandlerData* __param = &handlerData; \
+ __ParamType __paramToPassToFilter = __paramRef; \
+ class __Body \
+ { \
+ public: \
+ static void Run(__HandlerData* __pHandlerData) \
+ { \
+ PAL_TRY_HANDLER_DBG_BEGIN \
+ COMPILER_INSTANCE *ciPtr = __pHandlerData->__ciPtr; \
+ __ParamType __paramDef = __pHandlerData->__param;
+
+
+#define PAL_TRY_FOR_DLLMAIN(__ParamType, __paramDef, __paramRef, __reason) \
+{ \
+ __ParamType __param = __paramRef; \
+ __ParamType __paramToPassToFilter = __paramRef; \
+ class __Body \
+ { \
+ public: \
+ static void Run(__ParamType __paramDef) \
+ { \
+ PAL_TRY_HANDLER_DBG_BEGIN_DLLMAIN(__reason)
+
+#define PAL_EXCEPT(Disposition) \
+ PAL_TRY_HANDLER_DBG_END \
+ } \
+ }; \
+ PAL_TRY_NAKED \
+ __Body::Run(__param); \
+ PAL_EXCEPT_NAKED(Disposition)
+
+#define PAL_EXCEPT_FILTER(pfnFilter) \
+ PAL_TRY_HANDLER_DBG_END \
+ } \
+ }; \
+ PAL_TRY_NAKED \
+ __Body::Run(__param); \
+ PAL_EXCEPT_FILTER_NAKED(pfnFilter, __paramToPassToFilter)
+
+#define PAL_FINALLY \
+ PAL_TRY_HANDLER_DBG_END \
+ } \
+ }; \
+ PAL_TRY_NAKED \
+ __Body::Run(__param); \
+ PAL_FINALLY_NAKED
+
+#define PAL_ENDTRY \
+ PAL_ENDTRY_NAKED \
+}
+
+#else // _DEBUG
+
+#define PAL_TRY(__ParamType, __paramDef, __paramRef) \
+{ \
+ __ParamType __param = __paramRef; \
+ __ParamType __paramDef = __param; \
+ PAL_TRY_NAKED \
+ PAL_TRY_HANDLER_DBG_BEGIN
+
+// PAL_TRY implementation that abstracts usage of COMPILER_INSTANCE*, which is used by
+// JIT64. On Windows, we dont need to do anything special as we dont have nested classes/methods
+// as on PAL.
+#define PAL_TRY_CI(__ParamType, __paramDef, __paramRef) PAL_TRY(__ParamType, __paramDef, __paramRef)
+
+#define PAL_TRY_FOR_DLLMAIN(__ParamType, __paramDef, __paramRef, __reason) \
+{ \
+ __ParamType __param = __paramRef; \
+ __ParamType __paramDef; __paramDef = __param; \
+ PAL_TRY_NAKED \
+ PAL_TRY_HANDLER_DBG_BEGIN_DLLMAIN(__reason)
+
+#define PAL_EXCEPT(Disposition) \
+ PAL_TRY_HANDLER_DBG_END \
+ PAL_EXCEPT_NAKED(Disposition)
+
+#define PAL_EXCEPT_FILTER(pfnFilter) \
+ PAL_TRY_HANDLER_DBG_END \
+ PAL_EXCEPT_FILTER_NAKED(pfnFilter, __param)
+
+#define PAL_FINALLY \
+ PAL_TRY_HANDLER_DBG_END \
+ PAL_FINALLY_NAKED
+
+#define PAL_ENDTRY \
+ PAL_ENDTRY_NAKED \
+ }
+
+#endif // _DEBUG
+
+// Executes the handler if the specified exception code matches
+// the one in the exception. Otherwise, returns EXCEPTION_CONTINUE_SEARCH.
+#define PAL_EXCEPT_IF_EXCEPTION_CODE(dwExceptionCode) PAL_EXCEPT((GetExceptionCode() == dwExceptionCode)?EXCEPTION_EXECUTE_HANDLER:EXCEPTION_CONTINUE_SEARCH)
+
+#define PAL_CPP_TRY try
+#define PAL_CPP_ENDTRY
+#define PAL_CPP_THROW(type, obj) do { SCAN_THROW_MARKER; throw obj; } while (false)
+#define PAL_CPP_RETHROW do { SCAN_THROW_MARKER; throw; } while (false)
+#define PAL_CPP_CATCH_DERIVED(type, obj) catch (type * obj)
+#define PAL_CPP_CATCH_ALL catch (...)
+#define PAL_CPP_CATCH_EXCEPTION_NOARG catch (Exception *)
+
+
+// SELECTANY macro is intended to prevent duplication of static const
+// arrays declared in .h files in binary modules.
+// The problem is that const variables have static internal linkage
+// in C++. That means that if a const variable is declared in a .h file
+// the compiler will emit it into every translation unit that uses that .h file.
+// That will cause duplication of the data when those translation units
+// are linked into a binary module.
+// SELECTANY declares a variable as extern to give it external linkage
+// and it provides __declspec(selectany) to instruct the linker to merge
+// duplicate external const static data copies into one.
+//
+#if defined(SOURCE_FORMATTING)
+#define SELECTANY extern
+#else
+#define SELECTANY extern __declspec(selectany)
+#endif
+#if defined(SOURCE_FORMATTING)
+#define __annotation(x)
+#endif
+
+
+#if defined(_DEBUG_IMPL) && !defined(JIT_BUILD) && !defined(JIT64_BUILD) && !defined(CROSS_COMPILE) && !defined(_TARGET_ARM_) // @ARMTODO: no contracts for speed
+#define PAL_TRY_HANDLER_DBG_BEGIN \
+ BOOL ___oldOkayToThrowValue = FALSE; \
+ SO_INFRASTRUCTURE_CODE(BOOL ___oldSOTolerantState = FALSE;) \
+ ClrDebugState *___pState = ::GetClrDebugState(); \
+ __try \
+ { \
+ ___oldOkayToThrowValue = ___pState->IsOkToThrow(); \
+ SO_INFRASTRUCTURE_CODE(___oldSOTolerantState = ___pState->IsSOTolerant();) \
+ ___pState->SetOkToThrow(); \
+ PAL_ENTER_THROWS_REGION;
+
+// Special version that avoids touching the debug state after doing work in a DllMain for process or thread detach.
+#define PAL_TRY_HANDLER_DBG_BEGIN_DLLMAIN(_reason) \
+ BOOL ___oldOkayToThrowValue = FALSE; \
+ SO_INFRASTRUCTURE_CODE(BOOL ___oldSOTolerantState = FALSE;) \
+ ClrDebugState *___pState = NULL; \
+ if (_reason != DLL_PROCESS_ATTACH) \
+ ___pState = CheckClrDebugState(); \
+ __try \
+ { \
+ if (___pState) \
+ { \
+ ___oldOkayToThrowValue = ___pState->IsOkToThrow(); \
+ SO_INFRASTRUCTURE_CODE(___oldSOTolerantState = ___pState->IsSOTolerant();) \
+ ___pState->SetOkToThrow(); \
+ } \
+ if ((_reason == DLL_PROCESS_DETACH) || (_reason == DLL_THREAD_DETACH)) \
+ { \
+ ___pState = NULL; \
+ } \
+ PAL_ENTER_THROWS_REGION;
+
+#define PAL_TRY_HANDLER_DBG_END \
+ PAL_LEAVE_THROWS_REGION \
+ } \
+ __finally \
+ { \
+ if (___pState != NULL) \
+ { \
+ _ASSERTE(___pState == CheckClrDebugState()); \
+ ___pState->SetOkToThrow( ___oldOkayToThrowValue ); \
+ SO_INFRASTRUCTURE_CODE(___pState->SetSOTolerance( ___oldSOTolerantState );) \
+ } \
+ }
+
+#define PAL_ENDTRY_NAKED_DBG \
+ if (__exHandled) \
+ { \
+ RESTORE_SO_TOLERANCE_STATE; \
+ } \
+
+#else
+#define PAL_TRY_HANDLER_DBG_BEGIN ANNOTATION_TRY_BEGIN;
+#define PAL_TRY_HANDLER_DBG_BEGIN_DLLMAIN(_reason) ANNOTATION_TRY_BEGIN;
+#define PAL_TRY_HANDLER_DBG_END ANNOTATION_TRY_END;
+#define PAL_ENDTRY_NAKED_DBG
+#endif // defined(ENABLE_CONTRACTS_IMPL) && !defined(JIT64_BUILD)
+
+
+#if !BIGENDIAN
+// For little-endian machines, do nothing
+#define VAL16(x) x
+#define VAL32(x) x
+#define VAL64(x) x
+#define SwapString(x)
+#define SwapStringLength(x, y)
+#define SwapGuid(x)
+#endif // !BIGENDIAN
+
+#ifdef _MSC_VER
+// Get Unaligned values from a potentially unaligned object
+#define GET_UNALIGNED_16(_pObject) (*(UINT16 UNALIGNED *)(_pObject))
+#define GET_UNALIGNED_32(_pObject) (*(UINT32 UNALIGNED *)(_pObject))
+#define GET_UNALIGNED_64(_pObject) (*(UINT64 UNALIGNED *)(_pObject))
+
+// Set Value on an potentially unaligned object
+#define SET_UNALIGNED_16(_pObject, _Value) (*(UNALIGNED UINT16 *)(_pObject)) = (UINT16)(_Value)
+#define SET_UNALIGNED_32(_pObject, _Value) (*(UNALIGNED UINT32 *)(_pObject)) = (UINT32)(_Value)
+#define SET_UNALIGNED_64(_pObject, _Value) (*(UNALIGNED UINT64 *)(_pObject)) = (UINT64)(_Value)
+
+// Get Unaligned values from a potentially unaligned object and swap the value
+#define GET_UNALIGNED_VAL16(_pObject) VAL16(GET_UNALIGNED_16(_pObject))
+#define GET_UNALIGNED_VAL32(_pObject) VAL32(GET_UNALIGNED_32(_pObject))
+#define GET_UNALIGNED_VAL64(_pObject) VAL64(GET_UNALIGNED_64(_pObject))
+
+// Set a swap Value on an potentially unaligned object
+#define SET_UNALIGNED_VAL16(_pObject, _Value) SET_UNALIGNED_16(_pObject, VAL16((UINT16)_Value))
+#define SET_UNALIGNED_VAL32(_pObject, _Value) SET_UNALIGNED_32(_pObject, VAL32((UINT32)_Value))
+#define SET_UNALIGNED_VAL64(_pObject, _Value) SET_UNALIGNED_64(_pObject, VAL64((UINT64)_Value))
+#endif
+
+#ifdef _WIN64
+#define VALPTR(x) VAL64(x)
+#define GET_UNALIGNED_PTR(x) GET_UNALIGNED_64(x)
+#define GET_UNALIGNED_VALPTR(x) GET_UNALIGNED_VAL64(x)
+#define SET_UNALIGNED_PTR(p,x) SET_UNALIGNED_64(p,x)
+#define SET_UNALIGNED_VALPTR(p,x) SET_UNALIGNED_VAL64(p,x)
+#else
+#define VALPTR(x) VAL32(x)
+#define GET_UNALIGNED_PTR(x) GET_UNALIGNED_32(x)
+#define GET_UNALIGNED_VALPTR(x) GET_UNALIGNED_VAL32(x)
+#define SET_UNALIGNED_PTR(p,x) SET_UNALIGNED_32(p,x)
+#define SET_UNALIGNED_VALPTR(p,x) SET_UNALIGNED_VAL32(p,x)
+#endif
+
+#define MAKEDLLNAME_W(name) name W(".dll")
+#define MAKEDLLNAME_A(name) name ".dll"
+
+#ifdef UNICODE
+#define MAKEDLLNAME(x) MAKEDLLNAME_W(x)
+#else
+#define MAKEDLLNAME(x) MAKEDLLNAME_A(x)
+#endif
+
+#if !defined(MAX_LONGPATH)
+#define MAX_LONGPATH 260 /* max. length of full pathname */
+#endif
+#if !defined(MAX_PATH_FNAME)
+#define MAX_PATH_FNAME MAX_PATH /* max. length of full pathname */
+#endif
+
+#endif // __PALCLR_H__
+
+#include "palclr_win.h"
+
+#endif // !defined(FEATURE_PAL)
diff --git a/src/inc/palclr_win.h b/src/inc/palclr_win.h
new file mode 100644
index 0000000000..18edc6c8f5
--- /dev/null
+++ b/src/inc/palclr_win.h
@@ -0,0 +1,206 @@
+// 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.
+// ===========================================================================
+// File: palclr.h
+//
+// Various macros and constants that are necessary to make the CLR portable.
+//
+
+// ===========================================================================
+
+#ifndef __PALCLR_WIN_H__
+#define __PALCLR_WIN_H__
+
+// PAL SEH
+// Macros for portable exception handling. The Win32 SEH is emulated using
+// these macros and setjmp/longjmp on Unix
+//
+// Usage notes:
+//
+// - The filter has to be a function taking two parameters:
+// LONG MyFilter(PEXCEPTION_POINTERS *pExceptionInfo, PVOID pv)
+//
+// - It is not possible to directly use the local variables in the filter.
+// All the local information that the filter has to need to know about should
+// be passed through pv parameter
+//
+// - Do not use goto to jump out of the PAL_TRY block
+// (jumping out of the try block is not a good idea even on Win32, because of
+// it causes stack unwind)
+//
+//
+// Simple examples:
+//
+// PAL_TRY {
+// ....
+// } WIN_PAL_FINALLY {
+// ....
+// }
+// WIN_PAL_ENDTRY
+//
+//
+// PAL_TRY {
+// ....
+// } WIN_PAL_EXCEPT(EXCEPTION_EXECUTE_HANDLER) {
+// ....
+// }
+// WIN_PAL_ENDTRY
+//
+//
+// LONG MyFilter(PEXCEPTION_POINTERS *pExceptionInfo, PVOID pv)
+// {
+// ...
+// }
+// PAL_TRY {
+// ....
+// } WIN_PAL_EXCEPT_FILTER(MyFilter, NULL) {
+// ....
+// }
+// WIN_PAL_ENDTRY
+//
+//
+// Complex example:
+//
+// struct MyParams
+// {
+// ...
+// } params;
+//
+// PAL_TRY {
+// PAL_TRY {
+// ...
+// if (error) goto Done;
+// ...
+// Done: ;
+// } WIN_PAL_EXCEPT_FILTER(OtherFilter, &params) {
+// ...
+// }
+// WIN_PAL_ENDTRY
+// }
+// WIN_PAL_FINALLY {
+// }
+// WIN_PAL_ENDTRY
+//
+
+#if !defined(FEATURE_CORECLR)
+
+#include "staticcontract.h"
+
+#define WIN_PAL_TRY_NAKED \
+ { \
+ bool __exHandled; __exHandled = false; \
+ DWORD __exCode; __exCode = 0; \
+ __try \
+ {
+
+#define WIN_PAL_TRY \
+ { \
+ WIN_PAL_TRY_NAKED \
+ WIN_PAL_TRY_HANDLER_DBG_BEGIN
+
+#define WIN_PAL_TRY_FOR_DLLMAIN(_reason) \
+ { \
+ WIN_PAL_TRY_NAKED \
+ WIN_PAL_TRY_HANDLER_DBG_BEGIN_DLLMAIN(_reason)
+
+// Note: PAL_SEH_RESTORE_GUARD_PAGE is only ever defined in clrex.h, so we only restore guard pages automatically
+// when these macros are used from within the VM.
+#define WIN_PAL_SEH_RESTORE_GUARD_PAGE PAL_SEH_RESTORE_GUARD_PAGE
+
+#define WIN_PAL_EXCEPT_NAKED(Disposition) \
+ } __except(__exCode = GetExceptionCode(), Disposition) { \
+ __exHandled = true; \
+ WIN_PAL_SEH_RESTORE_GUARD_PAGE
+
+#define WIN_PAL_EXCEPT(Disposition) \
+ WIN_PAL_TRY_HANDLER_DBG_END \
+ WIN_PAL_EXCEPT_NAKED(Disposition)
+
+#define WIN_PAL_EXCEPT_FILTER_NAKED(pfnFilter, pvFilterParameter) \
+ } __except(__exCode = GetExceptionCode(), pfnFilter(GetExceptionInformation(), pvFilterParameter)) { \
+ __exHandled = true; \
+ WIN_PAL_SEH_RESTORE_GUARD_PAGE
+
+#define WIN_PAL_EXCEPT_FILTER(pfnFilter, pvFilterParameter) \
+ WIN_PAL_TRY_HANDLER_DBG_END \
+ WIN_PAL_EXCEPT_FILTER_NAKED(pfnFilter, pvFilterParameter)
+
+#define WIN_PAL_FINALLY_NAKED \
+ } __finally { \
+
+#define WIN_PAL_FINALLY \
+ WIN_PAL_TRY_HANDLER_DBG_END \
+ WIN_PAL_FINALLY_NAKED
+
+#define WIN_PAL_ENDTRY_NAKED \
+ } \
+ } \
+
+#define WIN_PAL_ENDTRY \
+ } \
+ WIN_PAL_ENDTRY_NAKED_DBG \
+ } \
+ }
+
+#endif // !PAL_WIN_SEH
+
+
+#if defined(_DEBUG_IMPL) && !defined(JIT_BUILD) && !defined(JIT64_BUILD) && !defined(_ARM_) // @ARMTODO
+#define WIN_PAL_TRY_HANDLER_DBG_BEGIN \
+ BOOL ___oldOkayToThrowValue = FALSE; \
+ BOOL ___oldSOTolerantState = FALSE; \
+ ClrDebugState *___pState = GetClrDebugState(); \
+ __try \
+ { \
+ ___oldOkayToThrowValue = ___pState->IsOkToThrow(); \
+ ___oldSOTolerantState = ___pState->IsSOTolerant(); \
+ ___pState->SetOkToThrow(TRUE); \
+ ANNOTATION_TRY_BEGIN;
+
+// Special version that avoids touching the debug state after doing work in a DllMain for process or thread detach.
+#define WIN_PAL_TRY_HANDLER_DBG_BEGIN_DLLMAIN(_reason) \
+ BOOL ___oldOkayToThrowValue = FALSE; \
+ BOOL ___oldSOTolerantState = FALSE; \
+ ClrDebugState *___pState = CheckClrDebugState(); \
+ __try \
+ { \
+ if (___pState) \
+ { \
+ ___oldOkayToThrowValue = ___pState->IsOkToThrow(); \
+ ___oldSOTolerantState = ___pState->IsSOTolerant(); \
+ ___pState->SetOkToThrow(TRUE); \
+ } \
+ if ((_reason == DLL_PROCESS_DETACH) || (_reason == DLL_THREAD_DETACH)) \
+ { \
+ ___pState = NULL; \
+ } \
+ ANNOTATION_TRY_BEGIN;
+
+#define WIN_PAL_TRY_HANDLER_DBG_END \
+ ANNOTATION_TRY_END; \
+ } \
+ __finally \
+ { \
+ if (___pState != NULL) \
+ { \
+ _ASSERTE(___pState == CheckClrDebugState()); \
+ ___pState->SetOkToThrow(___oldOkayToThrowValue); \
+ ___pState->SetSOTolerance(___oldSOTolerantState); \
+ } \
+ }
+
+#define WIN_PAL_ENDTRY_NAKED_DBG \
+ if (__exHandled) \
+ { \
+ RESTORE_SO_TOLERANCE_STATE; \
+ } \
+
+#else
+#define WIN_PAL_TRY_HANDLER_DBG_BEGIN ANNOTATION_TRY_BEGIN;
+#define WIN_PAL_TRY_HANDLER_DBG_BEGIN_DLLMAIN(_reason) ANNOTATION_TRY_BEGIN;
+#define WIN_PAL_TRY_HANDLER_DBG_END ANNOTATION_TRY_END;
+#define WIN_PAL_ENDTRY_NAKED_DBG
+#endif // defined(ENABLE_CONTRACTS_IMPL) && !defined(JIT64_BUILD)
+
+#endif // __PALCLR_WIN_H__
diff --git a/src/inc/pedecoder.h b/src/inc/pedecoder.h
new file mode 100644
index 0000000000..d5bae87bb7
--- /dev/null
+++ b/src/inc/pedecoder.h
@@ -0,0 +1,478 @@
+// 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.
+// --------------------------------------------------------------------------------
+// PEDecoder.h
+//
+
+// --------------------------------------------------------------------------------
+
+// --------------------------------------------------------------------------------
+// PEDecoder - Utility class for reading and verifying PE files.
+//
+// Note that the Check step is optional if you are willing to trust the
+// integrity of the image.
+// (Or at any rate can be factored into an initial verification step.)
+//
+// Functions which access the memory of the PE file take a "flat" flag - this
+// indicates whether the PE images data has been loaded flat the way it resides in the file,
+// or if the sections have been mapped into memory at the proper base addresses.
+//
+// Finally, some functions take an optional "size" argument, which can be used for
+// range verification. This is an optional parameter, but if you omit it be sure
+// you verify the size in some other way.
+// --------------------------------------------------------------------------------
+
+
+#ifndef PEDECODER_H_
+#define PEDECODER_H_
+
+// --------------------------------------------------------------------------------
+// Required headers
+// --------------------------------------------------------------------------------
+
+#include "windows.h"
+#include "clrtypes.h"
+#include "check.h"
+#include "contract.h"
+#include "cor.h"
+#include "corhdr.h"
+
+#ifdef FEATURE_PREJIT
+#include "corcompile.h"
+#else // FEATURE_PREJIT
+typedef DPTR(struct COR_ILMETHOD) PTR_COR_ILMETHOD;
+struct CORCOMPILE_HEADER { int dummy_field; };
+typedef DPTR(struct CORCOMPILE_HEADER) PTR_CORCOMPILE_HEADER;
+#define CORCOMPILE_IS_POINTER_TAGGED(fixup) (false)
+#endif // FEATURE_PREJIT
+
+#include "readytorun.h"
+typedef DPTR(struct READYTORUN_HEADER) PTR_READYTORUN_HEADER;
+
+typedef DPTR(IMAGE_COR20_HEADER) PTR_IMAGE_COR20_HEADER;
+
+// --------------------------------------------------------------------------------
+// Forward declared types
+// --------------------------------------------------------------------------------
+
+class Module;
+
+// --------------------------------------------------------------------------------
+// RVA definition
+// --------------------------------------------------------------------------------
+
+// Needs to be DWORD to avoid conflict with <imagehlp.h>
+typedef DWORD RVA;
+
+#ifdef _MSC_VER
+// Wrapper to suppress ambigous overload problems with MSVC.
+inline CHECK CheckOverflow(RVA value1, COUNT_T value2)
+{
+ WRAPPER_NO_CONTRACT;
+ CHECK(CheckOverflow((UINT32) value1, (UINT32) value2));
+ CHECK_OK;
+}
+#endif // _MSC_VER
+
+// --------------------------------------------------------------------------------
+// IMAGE_FILE_MACHINE_NATIVE
+// --------------------------------------------------------------------------------
+
+#if defined(_TARGET_X86_)
+#define IMAGE_FILE_MACHINE_NATIVE IMAGE_FILE_MACHINE_I386
+#elif defined(_TARGET_AMD64_)
+#define IMAGE_FILE_MACHINE_NATIVE IMAGE_FILE_MACHINE_AMD64
+#elif defined(_TARGET_ARM_)
+#define IMAGE_FILE_MACHINE_NATIVE IMAGE_FILE_MACHINE_ARMNT
+#elif defined(_TARGET_ARM64_)
+#define IMAGE_FILE_MACHINE_NATIVE IMAGE_FILE_MACHINE_ARM64
+#else
+#error "port me"
+#endif
+
+// Machine code for native images
+#if defined(__APPLE__)
+#define IMAGE_FILE_MACHINE_NATIVE_OS_OVERRIDE 0x4644
+#elif defined(__FreeBSD__)
+#define IMAGE_FILE_MACHINE_NATIVE_OS_OVERRIDE 0xADC4
+#elif defined(__linux__)
+#define IMAGE_FILE_MACHINE_NATIVE_OS_OVERRIDE 0x7B79
+#elif defined(__NetBSD__)
+#define IMAGE_FILE_MACHINE_NATIVE_OS_OVERRIDE 0x1993
+#else
+#define IMAGE_FILE_MACHINE_NATIVE_OS_OVERRIDE 0
+#endif
+
+#define IMAGE_FILE_MACHINE_NATIVE_NI (IMAGE_FILE_MACHINE_NATIVE ^ IMAGE_FILE_MACHINE_NATIVE_OS_OVERRIDE)
+
+// --------------------------------------------------------------------------------
+// Types
+// --------------------------------------------------------------------------------
+
+typedef DPTR(class PEDecoder) PTR_PEDecoder;
+
+class PEDecoder
+{
+ public:
+
+ // ------------------------------------------------------------
+ // Public API
+ // ------------------------------------------------------------
+
+ // Access functions are divided into 3 categories:
+ // Has - check if the element is present
+ // Check - Do consistency checks on the element (requires Has).
+ // This step is optional if you are willing to trust the integrity of the
+ // image. (It is asserted in a checked build.)
+ // Get - Access the element (requires Has and Check)
+
+ PEDecoder();
+ PEDecoder(void *flatBase, COUNT_T size); // flatBase is the raw disk layout data (using MapViewOfFile)
+ PEDecoder(PTR_VOID mappedBase, bool relocated = FALSE); // mappedBase is the mapped/expanded file (using LoadLibrary)
+
+ void Init(void *flatBase, COUNT_T size);
+ HRESULT Init(void *mappedBase, bool relocated = FALSE);
+ void Reset(); //make sure you don't have a thread race
+
+ PTR_VOID GetBase() const; // Currently loaded base, as opposed to GetPreferredBase()
+ BOOL IsMapped() const;
+ BOOL IsRelocated() const;
+ BOOL IsFlat() const;
+ BOOL HasContents() const;
+ COUNT_T GetSize() const; // size of file on disk, as opposed to GetVirtualSize()
+
+ // High level image checks:
+
+ CHECK CheckFormat() const; // Check whatever is present
+ CHECK CheckNTFormat() const; // Check a PE file image
+ CHECK CheckCORFormat() const; // Check a COR image (IL or native)
+ CHECK CheckILFormat() const; // Check a managed image
+ CHECK CheckILOnlyFormat() const; // Check an IL only image
+ CHECK CheckNativeFormat() const; // Check a native image
+
+ // NT header access
+
+ BOOL HasNTHeaders() const;
+ CHECK CheckNTHeaders() const;
+
+ IMAGE_NT_HEADERS32 *GetNTHeaders32() const;
+ IMAGE_NT_HEADERS64 *GetNTHeaders64() const;
+ BOOL Has32BitNTHeaders() const;
+
+ const void *GetHeaders(COUNT_T *pSize = NULL) const;
+
+ BOOL IsDll() const;
+ BOOL HasBaseRelocations() const;
+ const void *GetPreferredBase() const; // OptionalHeaders.ImageBase
+ COUNT_T GetVirtualSize() const; // OptionalHeaders.SizeOfImage - size of mapped/expanded image in memory
+ WORD GetSubsystem() const;
+ WORD GetDllCharacteristics() const;
+ DWORD GetTimeDateStamp() const;
+ DWORD GetCheckSum() const;
+ WORD GetMachine() const;
+ WORD GetCharacteristics() const;
+ DWORD GetFileAlignment() const;
+ DWORD GetSectionAlignment() const;
+ SIZE_T GetSizeOfStackReserve() const;
+ SIZE_T GetSizeOfStackCommit() const;
+ SIZE_T GetSizeOfHeapReserve() const;
+ SIZE_T GetSizeOfHeapCommit() const;
+ UINT32 GetLoaderFlags() const;
+ UINT32 GetWin32VersionValue() const;
+ COUNT_T GetNumberOfRvaAndSizes() const;
+ COUNT_T GetNumberOfSections() const;
+ IMAGE_SECTION_HEADER *FindFirstSection() const;
+ IMAGE_SECTION_HEADER *FindSection(LPCSTR sectionName) const;
+
+ DWORD GetImageIdentity() const;
+
+ // Directory entry access
+
+ BOOL HasDirectoryEntry(int entry) const;
+ CHECK CheckDirectoryEntry(int entry, int forbiddenFlags = 0, IsNullOK ok = NULL_NOT_OK) const;
+ IMAGE_DATA_DIRECTORY *GetDirectoryEntry(int entry) const;
+ TADDR GetDirectoryEntryData(int entry, COUNT_T *pSize = NULL) const;
+
+ // IMAGE_DATA_DIRECTORY access
+
+ CHECK CheckDirectory(IMAGE_DATA_DIRECTORY *pDir, int forbiddenFlags = 0, IsNullOK ok = NULL_NOT_OK) const;
+ TADDR GetDirectoryData(IMAGE_DATA_DIRECTORY *pDir) const;
+ TADDR GetDirectoryData(IMAGE_DATA_DIRECTORY *pDir, COUNT_T *pSize) const;
+
+ // Basic RVA access
+
+ CHECK CheckRva(RVA rva, IsNullOK ok = NULL_NOT_OK) const;
+ CHECK CheckRva(RVA rva, COUNT_T size, int forbiddenFlags=0, IsNullOK ok = NULL_NOT_OK) const;
+ TADDR GetRvaData(RVA rva, IsNullOK ok = NULL_NOT_OK) const;
+ // Called with ok=NULL_OK only for mapped fields (RVA statics)
+
+ CHECK CheckData(const void *data, IsNullOK ok = NULL_NOT_OK) const;
+ CHECK CheckData(const void *data, COUNT_T size, IsNullOK ok = NULL_NOT_OK) const;
+ RVA GetDataRva(const TADDR data) const;
+ BOOL PointerInPE(PTR_CVOID data) const;
+
+ // Flat mapping utilities - using PointerToRawData instead of (Relative)VirtualAddress
+ CHECK CheckOffset(COUNT_T fileOffset, IsNullOK ok = NULL_NOT_OK) const;
+ CHECK CheckOffset(COUNT_T fileOffset, COUNT_T size, IsNullOK ok = NULL_NOT_OK) const;
+ TADDR GetOffsetData(COUNT_T fileOffset, IsNullOK ok = NULL_NOT_OK) const;
+ // Called with ok=NULL_OK only for mapped fields (RVA statics)
+
+ // Mapping between RVA and file offsets
+ COUNT_T RvaToOffset(RVA rva) const;
+ RVA OffsetToRva(COUNT_T fileOffset) const;
+
+ // Base intra-image pointer access
+ // (These are for pointers retrieved out of the PE image)
+
+ CHECK CheckInternalAddress(SIZE_T address, IsNullOK ok = NULL_NOT_OK) const;
+ CHECK CheckInternalAddress(SIZE_T address, COUNT_T size, IsNullOK ok = NULL_NOT_OK) const;
+ TADDR GetInternalAddressData(SIZE_T address) const;
+
+ // CLR loader IL Image verification - these checks apply to IL_ONLY images.
+
+ BOOL IsILOnly() const;
+ CHECK CheckILOnly() const;
+
+ void LayoutILOnly(void *base, BOOL allowFullPE = FALSE) const;
+
+ // Strong name & hashing support
+
+ BOOL HasStrongNameSignature() const;
+ CHECK CheckStrongNameSignature() const;
+ PTR_CVOID GetStrongNameSignature(COUNT_T *pSize = NULL) const;
+
+ // CorHeader flag support
+
+ // IsStrongNameSigned indicates whether the signature has been filled in.
+ // (otherwise if it has a signature it is delay signed.)
+ BOOL IsStrongNameSigned() const; // TRUE if the COMIMAGE_FLAGS_STRONGNAMESIGNED flag is set
+
+ // TLS
+
+ BOOL HasTls() const;
+ CHECK CheckTls() const;
+ PTR_VOID GetTlsRange(COUNT_T *pSize = NULL) const;
+ UINT32 GetTlsIndex() const;
+
+#ifndef FEATURE_PAL
+ // Win32 resources
+ void *GetWin32Resource(LPCWSTR lpName, LPCWSTR lpType, COUNT_T *pSize = NULL) const;
+#endif // FEATURE_PAL
+
+ // COR header fields
+
+ BOOL HasCorHeader() const;
+ CHECK CheckCorHeader() const;
+ IMAGE_COR20_HEADER *GetCorHeader() const;
+
+ PTR_CVOID GetMetadata(COUNT_T *pSize = NULL) const;
+
+ const void *GetResources(COUNT_T *pSize = NULL) const;
+ CHECK CheckResource(COUNT_T offset) const;
+ const void *GetResource(COUNT_T offset, COUNT_T *pSize = NULL) const;
+
+ BOOL HasManagedEntryPoint() const;
+ ULONG GetEntryPointToken() const;
+ IMAGE_COR_VTABLEFIXUP *GetVTableFixups(COUNT_T *pCount = NULL) const;
+
+ // Native header access
+ BOOL HasNativeHeader() const;
+ CHECK CheckNativeHeader() const;
+ CORCOMPILE_HEADER *GetNativeHeader() const;
+ BOOL IsNativeMachineFormat() const;
+ BOOL IsI386() const;
+
+ void GetPEKindAndMachine(DWORD * pdwPEKind, DWORD *pdwMachine); // Returns CorPEKind flags
+ BOOL IsPlatformNeutral(); // Returns TRUE for IL-only platform neutral images
+
+ //
+ // Verifies that the IL is within the bounds of the image.
+ //
+ CHECK CheckILMethod(RVA rva);
+
+ //
+ // Compute size of IL blob. Assumes that the IL is within the bounds of the image - make sure
+ // to call CheckILMethod before calling this method.
+ //
+ static SIZE_T ComputeILMethodSize(TADDR pIL);
+
+ // Debug directory access, returns NULL if no such entry
+ PTR_IMAGE_DEBUG_DIRECTORY GetDebugDirectoryEntry(UINT index) const;
+
+#ifdef FEATURE_PREJIT
+ CHECK CheckNativeHeaderVersion() const;
+
+ // ManagedNative fields
+ CORCOMPILE_CODE_MANAGER_ENTRY *GetNativeCodeManagerTable() const;
+ CORCOMPILE_EE_INFO_TABLE *GetNativeEEInfoTable() const;
+ void *GetNativeHelperTable(COUNT_T *pSize = NULL) const;
+ CORCOMPILE_VERSION_INFO *GetNativeVersionInfo() const;
+ CORCOMPILE_VERSION_INFO *GetNativeVersionInfoMaybeNull(bool skipCheckNativeHeader = false) const;
+ BOOL HasNativeDebugMap() const;
+ TADDR GetNativeDebugMap(COUNT_T *pSize = NULL) const;
+ Module *GetPersistedModuleImage(COUNT_T *pSize = NULL) const;
+ PCODE GetNativeHotCode(COUNT_T * pSize = NULL) const;
+ PCODE GetNativeCode(COUNT_T * pSize = NULL) const;
+ PCODE GetNativeColdCode(COUNT_T * pSize = NULL) const;
+
+ CORCOMPILE_METHOD_PROFILE_LIST *GetNativeProfileDataList(COUNT_T *pSize = NULL) const;
+ PTR_CVOID GetNativeManifestMetadata(COUNT_T *pSize = NULL) const;
+ const void *GetNativePreferredBase() const;
+ BOOL GetNativeILHasSecurityDirectory() const;
+ BOOL GetNativeILIsIbcOptimized() const;
+ BOOL GetNativeILHasReadyToRunHeader() const;
+ BOOL IsNativeILILOnly() const;
+ BOOL IsNativeILDll() const;
+ void GetNativeILPEKindAndMachine(DWORD* pdwKind, DWORD* pdwMachine) const;
+ CORCOMPILE_DEPENDENCY * GetNativeDependencies(COUNT_T *pCount = NULL) const;
+
+ COUNT_T GetNativeImportTableCount() const;
+ CORCOMPILE_IMPORT_TABLE_ENTRY *GetNativeImportFromIndex(COUNT_T index) const;
+ CHECK CheckNativeImportFromIndex(COUNT_T index) const;
+
+ PTR_CORCOMPILE_IMPORT_SECTION GetNativeImportSections(COUNT_T *pCount = NULL) const;
+ PTR_CORCOMPILE_IMPORT_SECTION GetNativeImportSectionFromIndex(COUNT_T index) const;
+ PTR_CORCOMPILE_IMPORT_SECTION GetNativeImportSectionForRVA(RVA rva) const;
+
+ TADDR GetStubsTable(COUNT_T *pSize = NULL) const;
+ TADDR GetVirtualSectionsTable(COUNT_T *pSize = NULL) const;
+#endif // FEATURE_PREJIT
+
+ BOOL HasReadyToRunHeader() const;
+ READYTORUN_HEADER *GetReadyToRunHeader() const;
+
+ void GetEXEStackSizes(SIZE_T *PE_SizeOfStackReserve, SIZE_T *PE_SizeOfStackCommit) const;
+
+ CHECK CheckWillCreateGuardPage() const;
+
+ // Native DLLMain Entrypoint
+ BOOL HasNativeEntryPoint() const;
+ void *GetNativeEntryPoint() const;
+
+#ifdef _DEBUG
+ // Stress mode for relocations
+ static BOOL GetForceRelocs();
+ static BOOL ForceRelocForDLL(LPCWSTR lpFileName);
+#endif
+
+#ifdef DACCESS_COMPILE
+ void EnumMemoryRegions(CLRDataEnumMemoryFlags flags, bool enumThis);
+#endif
+
+ protected:
+
+ // ------------------------------------------------------------
+ // Protected API for subclass use
+ // ------------------------------------------------------------
+
+ // Checking utilites
+ static CHECK CheckBounds(RVA rangeBase, COUNT_T rangeSize, RVA rva);
+ static CHECK CheckBounds(RVA rangeBase, COUNT_T rangeSize, RVA rva, COUNT_T size);
+
+ static CHECK CheckBounds(const void *rangeBase, COUNT_T rangeSize, const void *pointer);
+ static CHECK CheckBounds(PTR_CVOID rangeBase, COUNT_T rangeSize, PTR_CVOID pointer, COUNT_T size);
+
+ protected:
+
+ // Flat mapping utilities - using PointerToRawData instead of (Relative)VirtualAddress
+ IMAGE_SECTION_HEADER *RvaToSection(RVA rva) const;
+ IMAGE_SECTION_HEADER *OffsetToSection(COUNT_T fileOffset) const;
+
+ void SetRelocated();
+
+ private:
+
+ // ------------------------------------------------------------
+ // Internal functions
+ // ------------------------------------------------------------
+
+ enum METADATA_SECTION_TYPE
+ {
+ METADATA_SECTION_FULL,
+#ifdef FEATURE_PREJIT
+ METADATA_SECTION_MANIFEST
+#endif
+ };
+
+ IMAGE_DATA_DIRECTORY *GetMetaDataHelper(METADATA_SECTION_TYPE type) const;
+
+ static PTR_IMAGE_SECTION_HEADER FindFirstSection(IMAGE_NT_HEADERS * pNTHeaders);
+
+ IMAGE_NT_HEADERS *FindNTHeaders() const;
+ IMAGE_COR20_HEADER *FindCorHeader() const;
+ CORCOMPILE_HEADER *FindNativeHeader() const;
+ READYTORUN_HEADER *FindReadyToRunHeader() const;
+
+ // Flat mapping utilities
+ RVA InternalAddressToRva(SIZE_T address) const;
+
+ // NT header subchecks
+ CHECK CheckSection(COUNT_T previousAddressEnd, COUNT_T addressStart, COUNT_T addressSize,
+ COUNT_T previousOffsetEnd, COUNT_T offsetStart, COUNT_T offsetSize) const;
+
+ // Pure managed subchecks
+ CHECK CheckILOnlyImportDlls() const;
+ CHECK CheckILOnlyImportByNameTable(RVA rva) const;
+ CHECK CheckILOnlyBaseRelocations() const;
+ CHECK CheckILOnlyEntryPoint() const;
+
+ // ------------------------------------------------------------
+ // Instance members
+ // ------------------------------------------------------------
+
+ enum
+ {
+ FLAG_MAPPED = 0x01, // the file is mapped/hydrated (vs. the raw disk layout)
+ FLAG_CONTENTS = 0x02, // the file has contents
+ FLAG_RELOCATED = 0x04, // relocs have been applied
+ FLAG_NT_CHECKED = 0x10,
+ FLAG_COR_CHECKED = 0x20,
+ FLAG_IL_ONLY_CHECKED = 0x40,
+ FLAG_NATIVE_CHECKED = 0x80,
+
+ FLAG_HAS_NO_READYTORUN_HEADER = 0x100,
+ };
+
+ TADDR m_base;
+ COUNT_T m_size; // size of file on disk, as opposed to OptionalHeaders.SizeOfImage
+ ULONG m_flags;
+
+ PTR_IMAGE_NT_HEADERS m_pNTHeaders;
+ PTR_IMAGE_COR20_HEADER m_pCorHeader;
+ PTR_CORCOMPILE_HEADER m_pNativeHeader;
+ PTR_READYTORUN_HEADER m_pReadyToRunHeader;
+};
+
+//
+// MethodSectionIterator class is used to iterate hot (or) cold method section in an ngen image.
+// It can also iterate nibble maps generated by the JIT in a regular HeapList.
+//
+class MethodSectionIterator
+{
+ private:
+ PTR_DWORD m_codeTableStart;
+ PTR_DWORD m_codeTable;
+ PTR_DWORD m_codeTableEnd;
+
+ BYTE *m_code;
+
+ DWORD m_dword;
+ DWORD m_index;
+
+ BYTE *m_current;
+
+ public:
+
+ //If code is a target pointer, then GetMethodCode and FindMethodCode return
+ //target pointers. codeTable may be a pointer of either type, since it is
+ //converted internally into a host pointer.
+ MethodSectionIterator(const void *code, SIZE_T codeSize,
+ const void *codeTable, SIZE_T codeTableSize);
+ BOOL Next();
+ BYTE *GetMethodCode() { return m_current; } // Get the start of method code of the current method in the iterator
+};
+
+#include "pedecoder.inl"
+
+#endif // PEDECODER_H_
diff --git a/src/inc/pedecoder.inl b/src/inc/pedecoder.inl
new file mode 100644
index 0000000000..b75c4959f9
--- /dev/null
+++ b/src/inc/pedecoder.inl
@@ -0,0 +1,1429 @@
+// 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.
+// --------------------------------------------------------------------------------
+// PEDecoder.inl
+//
+
+// --------------------------------------------------------------------------------
+
+#ifndef _PEDECODER_INL_
+#define _PEDECODER_INL_
+
+#include "pedecoder.h"
+#include "ex.h"
+
+#ifndef DACCESS_COMPILE
+
+inline PEDecoder::PEDecoder()
+ : m_base(0),
+ m_size(0),
+ m_flags(0),
+ m_pNTHeaders(nullptr),
+ m_pCorHeader(nullptr),
+ m_pNativeHeader(nullptr),
+ m_pReadyToRunHeader(nullptr)
+{
+ CONTRACTL
+ {
+ CONSTRUCTOR_CHECK;
+ NOTHROW;
+ CANNOT_TAKE_LOCK;
+ GC_NOTRIGGER;
+ }
+ CONTRACTL_END;
+}
+#else
+inline PEDecoder::PEDecoder()
+{
+ LIMITED_METHOD_CONTRACT;
+}
+#endif // #ifndef DACCESS_COMPILE
+
+inline PTR_VOID PEDecoder::GetBase() const
+{
+ LIMITED_METHOD_CONTRACT;
+ SUPPORTS_DAC;
+
+ return PTR_VOID(m_base);
+}
+
+inline BOOL PEDecoder::IsMapped() const
+{
+ LIMITED_METHOD_CONTRACT;
+ SUPPORTS_DAC;
+
+ return (m_flags & FLAG_MAPPED) != 0;
+}
+
+inline BOOL PEDecoder::IsRelocated() const
+{
+ LIMITED_METHOD_CONTRACT;
+
+ return (m_flags & FLAG_RELOCATED) != 0;
+}
+
+inline void PEDecoder::SetRelocated()
+{
+ m_flags |= FLAG_RELOCATED;
+}
+
+inline BOOL PEDecoder::IsFlat() const
+{
+ LIMITED_METHOD_CONTRACT;
+
+ return HasContents() && !IsMapped();
+}
+
+inline BOOL PEDecoder::HasContents() const
+{
+ LIMITED_METHOD_CONTRACT;
+ SUPPORTS_DAC;
+
+ return (m_flags & FLAG_CONTENTS) != 0;
+}
+
+inline COUNT_T PEDecoder::GetSize() const
+{
+ LIMITED_METHOD_DAC_CONTRACT;
+
+ return m_size;
+}
+
+inline PEDecoder::PEDecoder(PTR_VOID mappedBase, bool fixedUp /*= FALSE*/)
+ : m_base(dac_cast<TADDR>(mappedBase)),
+ m_size(0),
+ m_flags(FLAG_MAPPED | FLAG_CONTENTS | FLAG_NT_CHECKED | (fixedUp ? FLAG_RELOCATED : 0)),
+ m_pNTHeaders(nullptr),
+ m_pCorHeader(nullptr),
+ m_pNativeHeader(nullptr),
+ m_pReadyToRunHeader(nullptr)
+{
+ CONTRACTL
+ {
+ CONSTRUCTOR_CHECK;
+ PRECONDITION(CheckPointer(mappedBase));
+ PRECONDITION(CheckAligned(mappedBase, OS_PAGE_SIZE));
+ PRECONDITION(PEDecoder(mappedBase,fixedUp).CheckNTHeaders());
+ THROWS;
+ GC_NOTRIGGER;
+ SO_TOLERANT;
+ SUPPORTS_DAC;
+ }
+ CONTRACTL_END;
+
+ // Temporarily set the size to 2 pages, so we can get the headers.
+ m_size = OS_PAGE_SIZE*2;
+
+ m_pNTHeaders = PTR_IMAGE_NT_HEADERS(FindNTHeaders());
+ if (!m_pNTHeaders)
+ ThrowHR(COR_E_BADIMAGEFORMAT);
+
+ m_size = VAL32(m_pNTHeaders->OptionalHeader.SizeOfImage);
+}
+
+#ifndef DACCESS_COMPILE
+
+//REM
+//what's the right way to do this?
+//we want to use some against TADDR, but also want to do
+//some against what's just in the current process.
+//m_base is a TADDR in DAC all the time, though.
+//Have to implement separate fn to do the lookup??
+inline PEDecoder::PEDecoder(void *flatBase, COUNT_T size)
+ : m_base((TADDR)flatBase),
+ m_size(size),
+ m_flags(FLAG_CONTENTS),
+ m_pNTHeaders(NULL),
+ m_pCorHeader(NULL),
+ m_pNativeHeader(NULL),
+ m_pReadyToRunHeader(NULL)
+{
+ CONTRACTL
+ {
+ CONSTRUCTOR_CHECK;
+ PRECONDITION(CheckPointer(flatBase));
+ NOTHROW;
+ GC_NOTRIGGER;
+ CANNOT_TAKE_LOCK;
+ }
+ CONTRACTL_END;
+}
+
+inline void PEDecoder::Init(void *flatBase, COUNT_T size)
+{
+ CONTRACTL
+ {
+ INSTANCE_CHECK;
+ PRECONDITION((size == 0) || CheckPointer(flatBase));
+ PRECONDITION(!HasContents());
+ NOTHROW;
+ GC_NOTRIGGER;
+ }
+ CONTRACTL_END;
+
+ m_base = (TADDR)flatBase;
+ m_size = size;
+ m_flags = FLAG_CONTENTS;
+}
+
+
+
+inline HRESULT PEDecoder::Init(void *mappedBase, bool fixedUp /*= FALSE*/)
+{
+ CONTRACTL
+ {
+ INSTANCE_CHECK;
+ NOTHROW;
+ GC_NOTRIGGER;
+ PRECONDITION(CheckPointer(mappedBase));
+ PRECONDITION(CheckAligned(mappedBase, OS_PAGE_SIZE));
+ PRECONDITION(!HasContents());
+ }
+ CONTRACTL_END;
+
+ m_base = (TADDR)mappedBase;
+ m_flags = FLAG_MAPPED | FLAG_CONTENTS;
+ if (fixedUp)
+ m_flags |= FLAG_RELOCATED;
+
+ // Temporarily set the size to 2 pages, so we can get the headers.
+ m_size = OS_PAGE_SIZE*2;
+
+ m_pNTHeaders = FindNTHeaders();
+ if (!m_pNTHeaders)
+ return COR_E_BADIMAGEFORMAT;
+
+ m_size = VAL32(m_pNTHeaders->OptionalHeader.SizeOfImage);
+ return S_OK;
+}
+
+inline void PEDecoder::Reset()
+{
+ CONTRACTL
+ {
+ INSTANCE_CHECK;
+ NOTHROW;
+ GC_NOTRIGGER;
+ }
+ CONTRACTL_END;
+ m_base=NULL;
+ m_flags=NULL;
+ m_size=NULL;
+ m_pNTHeaders=NULL;
+ m_pCorHeader=NULL;
+ m_pNativeHeader=NULL;
+ m_pReadyToRunHeader=NULL;
+}
+#endif // #ifndef DACCESS_COMPILE
+
+
+inline IMAGE_NT_HEADERS32 *PEDecoder::GetNTHeaders32() const
+{
+ WRAPPER_NO_CONTRACT;
+ SUPPORTS_DAC;
+ return dac_cast<PTR_IMAGE_NT_HEADERS32>(FindNTHeaders());
+}
+
+inline IMAGE_NT_HEADERS64 *PEDecoder::GetNTHeaders64() const
+{
+ WRAPPER_NO_CONTRACT;
+ SUPPORTS_DAC;
+ return dac_cast<PTR_IMAGE_NT_HEADERS64>(FindNTHeaders());
+}
+
+inline BOOL PEDecoder::Has32BitNTHeaders() const
+{
+ CONTRACTL
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(HasNTHeaders());
+ NOTHROW;
+ GC_NOTRIGGER;
+ SO_TOLERANT;
+ SUPPORTS_DAC;
+ CANNOT_TAKE_LOCK;
+ SUPPORTS_DAC;
+ }
+ CONTRACTL_END;
+
+ return (FindNTHeaders()->OptionalHeader.Magic == VAL16(IMAGE_NT_OPTIONAL_HDR32_MAGIC));
+}
+
+inline const void *PEDecoder::GetHeaders(COUNT_T *pSize) const
+{
+ CONTRACT(const void *)
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(CheckNTHeaders());
+ NOTHROW;
+ GC_NOTRIGGER;
+ POSTCONDITION(CheckPointer(RETVAL));
+ }
+ CONTRACT_END;
+
+ //even though some data in OptionalHeader is different for 32 and 64, this field is the same
+ if (pSize != NULL)
+ *pSize = VAL32(FindNTHeaders()->OptionalHeader.SizeOfHeaders);
+
+ RETURN (const void *) m_base;
+}
+
+inline BOOL PEDecoder::IsDll() const
+{
+ CONTRACTL
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(CheckNTHeaders());
+ NOTHROW;
+ GC_NOTRIGGER;
+ SUPPORTS_DAC;
+ }
+ CONTRACTL_END;
+
+ return ((FindNTHeaders()->FileHeader.Characteristics & VAL16(IMAGE_FILE_DLL)) != 0);
+}
+
+inline BOOL PEDecoder::HasBaseRelocations() const
+{
+ CONTRACTL
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(CheckNTHeaders());
+ NOTHROW;
+ GC_NOTRIGGER;
+ }
+ CONTRACTL_END;
+
+ return ((FindNTHeaders()->FileHeader.Characteristics & VAL16(IMAGE_FILE_RELOCS_STRIPPED)) == 0);
+}
+
+inline const void *PEDecoder::GetPreferredBase() const
+{
+ CONTRACT(const void *)
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(CheckNTHeaders());
+ NOTHROW;
+ GC_NOTRIGGER;
+ SO_TOLERANT;
+ POSTCONDITION(CheckPointer(RETVAL, NULL_OK));
+ }
+ CONTRACT_END;
+
+ if (Has32BitNTHeaders())
+ RETURN (const void *) (SIZE_T) VAL32(GetNTHeaders32()->OptionalHeader.ImageBase);
+ else
+ RETURN (const void *) (SIZE_T) VAL64(GetNTHeaders64()->OptionalHeader.ImageBase);
+}
+
+inline COUNT_T PEDecoder::GetVirtualSize() const
+{
+ CONTRACTL
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(CheckNTHeaders());
+ NOTHROW;
+ GC_NOTRIGGER;
+ SUPPORTS_DAC;
+ SO_TOLERANT;
+ }
+ CONTRACTL_END;
+
+ //even though some data in OptionalHeader is different for 32 and 64, this field is the same
+ return VAL32(FindNTHeaders()->OptionalHeader.SizeOfImage);
+}
+
+inline WORD PEDecoder::GetSubsystem() const
+{
+ CONTRACTL
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(CheckNTHeaders());
+ NOTHROW;
+ GC_NOTRIGGER;
+ SUPPORTS_DAC;
+ SO_TOLERANT;
+ }
+ CONTRACTL_END;
+
+ //even though some data in OptionalHeader is different for 32 and 64, this field is the same
+ return VAL16(FindNTHeaders()->OptionalHeader.Subsystem);
+}
+
+inline WORD PEDecoder::GetDllCharacteristics() const
+{
+ CONTRACTL
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(CheckNTHeaders());
+ NOTHROW;
+ GC_NOTRIGGER;
+ SO_TOLERANT;
+ }
+ CONTRACTL_END;
+
+ //even though some data in OptionalHeader is different for 32 and 64, this field is the same
+ return VAL16(FindNTHeaders()->OptionalHeader.DllCharacteristics);
+}
+
+inline DWORD PEDecoder::GetTimeDateStamp() const
+{
+ CONTRACTL
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(CheckNTHeaders());
+ NOTHROW;
+ GC_NOTRIGGER;
+ }
+ CONTRACTL_END;
+
+ return VAL32(FindNTHeaders()->FileHeader.TimeDateStamp);
+}
+
+inline DWORD PEDecoder::GetCheckSum() const
+{
+ CONTRACTL
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(CheckNTHeaders());
+ NOTHROW;
+ GC_NOTRIGGER;
+ }
+ CONTRACTL_END;
+
+ //even though some data in OptionalHeader is different for 32 and 64, this field is the same
+ return VAL32(FindNTHeaders()->OptionalHeader.CheckSum);
+}
+
+inline DWORD PEDecoder::GetFileAlignment() const
+{
+ CONTRACTL
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(CheckNTHeaders());
+ NOTHROW;
+ GC_NOTRIGGER;
+ }
+ CONTRACTL_END;
+
+ //even though some data in OptionalHeader is different for 32 and 64, this field is the same
+ return VAL32(FindNTHeaders()->OptionalHeader.FileAlignment);
+}
+
+inline DWORD PEDecoder::GetSectionAlignment() const
+{
+ CONTRACTL
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(CheckNTHeaders());
+ NOTHROW;
+ GC_NOTRIGGER;
+ }
+ CONTRACTL_END;
+
+ //even though some data in OptionalHeader is different for 32 and 64, this field is the same
+ return VAL32(FindNTHeaders()->OptionalHeader.SectionAlignment);
+}
+
+inline WORD PEDecoder::GetMachine() const
+{
+ CONTRACTL
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(CheckNTHeaders());
+ NOTHROW;
+ GC_NOTRIGGER;
+ }
+ CONTRACTL_END;
+
+ return VAL16(FindNTHeaders()->FileHeader.Machine);
+}
+
+inline WORD PEDecoder::GetCharacteristics() const
+{
+ CONTRACTL
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(CheckNTHeaders());
+ NOTHROW;
+ GC_NOTRIGGER;
+ }
+ CONTRACTL_END;
+
+ return VAL16(FindNTHeaders()->FileHeader.Characteristics);
+}
+
+inline SIZE_T PEDecoder::GetSizeOfStackReserve() const
+{
+ CONTRACTL
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(CheckNTHeaders());
+ NOTHROW;
+ GC_NOTRIGGER;
+ }
+ CONTRACTL_END;
+
+ if (Has32BitNTHeaders())
+ return (SIZE_T) VAL32(GetNTHeaders32()->OptionalHeader.SizeOfStackReserve);
+ else
+ return (SIZE_T) VAL64(GetNTHeaders64()->OptionalHeader.SizeOfStackReserve);
+}
+
+
+inline SIZE_T PEDecoder::GetSizeOfStackCommit() const
+{
+ CONTRACTL
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(CheckNTHeaders());
+ NOTHROW;
+ GC_NOTRIGGER;
+ }
+ CONTRACTL_END;
+
+ if (Has32BitNTHeaders())
+ return (SIZE_T) VAL32(GetNTHeaders32()->OptionalHeader.SizeOfStackCommit);
+ else
+ return (SIZE_T) VAL64(GetNTHeaders64()->OptionalHeader.SizeOfStackCommit);
+}
+
+
+inline SIZE_T PEDecoder::GetSizeOfHeapReserve() const
+{
+ CONTRACTL
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(CheckNTHeaders());
+ NOTHROW;
+ GC_NOTRIGGER;
+ }
+ CONTRACTL_END;
+
+ if (Has32BitNTHeaders())
+ return (SIZE_T) VAL32(GetNTHeaders32()->OptionalHeader.SizeOfHeapReserve);
+ else
+ return (SIZE_T) VAL64(GetNTHeaders64()->OptionalHeader.SizeOfHeapReserve);
+}
+
+
+inline SIZE_T PEDecoder::GetSizeOfHeapCommit() const
+{
+ CONTRACTL
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(CheckNTHeaders());
+ NOTHROW;
+ GC_NOTRIGGER;
+ }
+ CONTRACTL_END;
+
+ if (Has32BitNTHeaders())
+ return (SIZE_T) VAL32(GetNTHeaders32()->OptionalHeader.SizeOfHeapCommit);
+ else
+ return (SIZE_T) VAL64(GetNTHeaders64()->OptionalHeader.SizeOfHeapCommit);
+}
+
+inline UINT32 PEDecoder::GetLoaderFlags() const
+{
+ CONTRACTL
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(CheckNTHeaders());
+ NOTHROW;
+ GC_NOTRIGGER;
+ }
+ CONTRACTL_END;
+
+ if (Has32BitNTHeaders())
+ return VAL32(GetNTHeaders32()->OptionalHeader.LoaderFlags);
+ else
+ return VAL32(GetNTHeaders64()->OptionalHeader.LoaderFlags);
+}
+
+inline UINT32 PEDecoder::GetWin32VersionValue() const
+{
+ CONTRACTL
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(CheckNTHeaders());
+ NOTHROW;
+ GC_NOTRIGGER;
+ }
+ CONTRACTL_END;
+
+ if (Has32BitNTHeaders())
+ return VAL32(GetNTHeaders32()->OptionalHeader.Win32VersionValue);
+ else
+ return VAL32(GetNTHeaders64()->OptionalHeader.Win32VersionValue);
+}
+
+inline COUNT_T PEDecoder::GetNumberOfRvaAndSizes() const
+{
+ CONTRACTL
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(CheckNTHeaders());
+ NOTHROW;
+ GC_NOTRIGGER;
+ }
+ CONTRACTL_END;
+
+ if (Has32BitNTHeaders())
+ return VAL32(GetNTHeaders32()->OptionalHeader.NumberOfRvaAndSizes);
+ else
+ return VAL32(GetNTHeaders64()->OptionalHeader.NumberOfRvaAndSizes);
+}
+
+inline BOOL PEDecoder::HasDirectoryEntry(int entry) const
+{
+ CONTRACTL
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(CheckNTHeaders());
+ NOTHROW;
+ GC_NOTRIGGER;
+ SUPPORTS_DAC;
+ SO_TOLERANT;
+ }
+ CONTRACTL_END;
+
+ if (Has32BitNTHeaders())
+ return (GetNTHeaders32()->OptionalHeader.DataDirectory[entry].VirtualAddress != 0);
+ else
+ return (GetNTHeaders64()->OptionalHeader.DataDirectory[entry].VirtualAddress != 0);
+}
+
+inline IMAGE_DATA_DIRECTORY *PEDecoder::GetDirectoryEntry(int entry) const
+{
+ CONTRACT(IMAGE_DATA_DIRECTORY *)
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(CheckNTHeaders());
+ NOTHROW;
+ GC_NOTRIGGER;
+ POSTCONDITION(CheckPointer(RETVAL));
+ SO_TOLERANT;
+ CANNOT_TAKE_LOCK;
+ SUPPORTS_DAC;
+ }
+ CONTRACT_END;
+
+ if (Has32BitNTHeaders())
+ RETURN dac_cast<PTR_IMAGE_DATA_DIRECTORY>(
+ dac_cast<TADDR>(GetNTHeaders32()) +
+ offsetof(IMAGE_NT_HEADERS32, OptionalHeader.DataDirectory) +
+ entry * sizeof(IMAGE_DATA_DIRECTORY));
+ else
+ RETURN dac_cast<PTR_IMAGE_DATA_DIRECTORY>(
+ dac_cast<TADDR>(GetNTHeaders64()) +
+ offsetof(IMAGE_NT_HEADERS64, OptionalHeader.DataDirectory) +
+ entry * sizeof(IMAGE_DATA_DIRECTORY));
+}
+
+inline TADDR PEDecoder::GetDirectoryEntryData(int entry, COUNT_T *pSize) const
+{
+ CONTRACT(TADDR)
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(CheckNTHeaders());
+ PRECONDITION(CheckDirectoryEntry(entry, 0, NULL_OK));
+ PRECONDITION(CheckPointer(pSize, NULL_OK));
+ NOTHROW;
+ GC_NOTRIGGER;
+ POSTCONDITION(CheckPointer((void *)RETVAL, NULL_OK));
+ SO_TOLERANT;
+ CANNOT_TAKE_LOCK;
+ SUPPORTS_DAC;
+ }
+ CONTRACT_END;
+
+ IMAGE_DATA_DIRECTORY *pDir = GetDirectoryEntry(entry);
+
+ if (pSize != NULL)
+ *pSize = VAL32(pDir->Size);
+
+ RETURN GetDirectoryData(pDir);
+}
+
+inline TADDR PEDecoder::GetDirectoryData(IMAGE_DATA_DIRECTORY *pDir) const
+{
+ CONTRACT(TADDR)
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(CheckNTHeaders());
+ PRECONDITION(CheckDirectory(pDir, 0, NULL_OK));
+ NOTHROW;
+ GC_NOTRIGGER;
+ SO_TOLERANT;
+ SUPPORTS_DAC;
+ POSTCONDITION(CheckPointer((void *)RETVAL, NULL_OK));
+ CANNOT_TAKE_LOCK;
+ }
+ CONTRACT_END;
+
+ RETURN GetRvaData(VAL32(pDir->VirtualAddress));
+}
+
+inline TADDR PEDecoder::GetDirectoryData(IMAGE_DATA_DIRECTORY *pDir, COUNT_T *pSize) const
+{
+ CONTRACT(TADDR)
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(CheckNTHeaders());
+ PRECONDITION(CheckDirectory(pDir, 0, NULL_OK));
+ PRECONDITION(CheckPointer(pSize));
+ NOTHROW;
+ GC_NOTRIGGER;
+ SO_TOLERANT;
+ SUPPORTS_DAC;
+ POSTCONDITION(CheckPointer((void *)RETVAL, NULL_OK));
+ CANNOT_TAKE_LOCK;
+ }
+ CONTRACT_END;
+
+ *pSize = VAL32(pDir->Size);
+
+ RETURN GetRvaData(VAL32(pDir->VirtualAddress));
+}
+
+inline TADDR PEDecoder::GetInternalAddressData(SIZE_T address) const
+{
+ CONTRACT(TADDR)
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(CheckNTHeaders());
+ PRECONDITION(CheckInternalAddress(address, NULL_OK));
+ NOTHROW;
+ GC_NOTRIGGER;
+ POSTCONDITION(CheckPointer((void *)RETVAL));
+ SO_TOLERANT;
+ }
+ CONTRACT_END;
+
+ RETURN GetRvaData(InternalAddressToRva(address));
+}
+
+inline BOOL PEDecoder::HasCorHeader() const
+{
+ CONTRACTL
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(CheckNTHeaders());
+ NOTHROW;
+ SUPPORTS_DAC;
+ GC_NOTRIGGER;
+ SO_TOLERANT;
+ }
+ CONTRACTL_END;
+
+ return HasDirectoryEntry(IMAGE_DIRECTORY_ENTRY_COMHEADER);
+}
+
+inline BOOL PEDecoder::IsILOnly() const
+{
+ CONTRACTL
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(HasCorHeader());
+ NOTHROW;
+ GC_NOTRIGGER;
+ SO_TOLERANT;
+ SUPPORTS_DAC;
+ }
+ CONTRACTL_END;
+
+ // Pretend that ready-to-run images are IL-only
+ return((GetCorHeader()->Flags & VAL32(COMIMAGE_FLAGS_ILONLY)) != 0) || HasReadyToRunHeader();
+}
+
+inline COUNT_T PEDecoder::RvaToOffset(RVA rva) const
+{
+ CONTRACTL
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(CheckNTHeaders());
+ PRECONDITION(CheckRva(rva,NULL_OK));
+ NOTHROW;
+ CANNOT_TAKE_LOCK;
+ GC_NOTRIGGER;
+ SUPPORTS_DAC;
+ }
+ CONTRACTL_END;
+ if(rva > 0)
+ {
+ IMAGE_SECTION_HEADER *section = RvaToSection(rva);
+ if (section == NULL)
+ return rva;
+
+ return rva - VAL32(section->VirtualAddress) + VAL32(section->PointerToRawData);
+ }
+ else return 0;
+}
+
+inline RVA PEDecoder::OffsetToRva(COUNT_T fileOffset) const
+{
+ CONTRACTL
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(CheckNTHeaders());
+ PRECONDITION(CheckOffset(fileOffset,NULL_OK));
+ NOTHROW;
+ GC_NOTRIGGER;
+ SUPPORTS_DAC;
+ }
+ CONTRACTL_END;
+ if(fileOffset > 0)
+ {
+ IMAGE_SECTION_HEADER *section = OffsetToSection(fileOffset);
+ PREFIX_ASSUME (section!=NULL); //TODO: actually it is possible that it si null we need to rethink how we handle this cases and do better there
+
+ return fileOffset - VAL32(section->PointerToRawData) + VAL32(section->VirtualAddress);
+ }
+ else return 0;
+}
+
+
+inline BOOL PEDecoder::IsStrongNameSigned() const
+{
+ CONTRACTL
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(HasCorHeader());
+ NOTHROW;
+ GC_NOTRIGGER;
+ SUPPORTS_DAC;
+ SO_TOLERANT;
+ }
+ CONTRACTL_END;
+
+ return ((GetCorHeader()->Flags & VAL32(COMIMAGE_FLAGS_STRONGNAMESIGNED)) != 0);
+}
+
+
+inline BOOL PEDecoder::HasStrongNameSignature() const
+{
+ CONTRACTL
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(HasCorHeader());
+ NOTHROW;
+ GC_NOTRIGGER;
+ SUPPORTS_DAC;
+ SO_TOLERANT;
+ }
+ CONTRACTL_END;
+
+ return (GetCorHeader()->StrongNameSignature.VirtualAddress != 0);
+}
+
+inline CHECK PEDecoder::CheckStrongNameSignature() const
+{
+ CONTRACT_CHECK
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(CheckNTHeaders());
+ PRECONDITION(HasCorHeader());
+ PRECONDITION(HasStrongNameSignature());
+ NOTHROW;
+ GC_NOTRIGGER;
+ }
+ CONTRACT_CHECK_END;
+
+ return CheckDirectory(&GetCorHeader()->StrongNameSignature, IMAGE_SCN_MEM_WRITE, NULL_OK);
+}
+
+inline PTR_CVOID PEDecoder::GetStrongNameSignature(COUNT_T *pSize) const
+{
+ CONTRACT(PTR_CVOID)
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(HasCorHeader());
+ PRECONDITION(HasStrongNameSignature());
+ PRECONDITION(CheckStrongNameSignature());
+ PRECONDITION(CheckPointer(pSize, NULL_OK));
+ NOTHROW;
+ GC_NOTRIGGER;
+ POSTCONDITION(CheckPointer(RETVAL));
+ }
+ CONTRACT_END;
+
+ IMAGE_DATA_DIRECTORY *pDir = &GetCorHeader()->StrongNameSignature;
+
+ if (pSize != NULL)
+ *pSize = VAL32(pDir->Size);
+
+ RETURN dac_cast<PTR_CVOID>(GetDirectoryData(pDir));
+}
+
+inline BOOL PEDecoder::HasTls() const
+{
+ CONTRACTL
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(CheckNTHeaders());
+ NOTHROW;
+ GC_NOTRIGGER;
+ SO_TOLERANT;
+ }
+ CONTRACTL_END;
+
+ return HasDirectoryEntry(IMAGE_DIRECTORY_ENTRY_TLS);
+}
+
+inline CHECK PEDecoder::CheckTls() const
+{
+ CONTRACT_CHECK
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(CheckNTHeaders());
+ NOTHROW;
+ GC_NOTRIGGER;
+ SO_TOLERANT;
+ }
+ CONTRACT_CHECK_END;
+
+ CHECK(CheckDirectoryEntry(IMAGE_DIRECTORY_ENTRY_TLS, 0, NULL_OK));
+
+ IMAGE_TLS_DIRECTORY *pTlsHeader = (IMAGE_TLS_DIRECTORY *) GetDirectoryEntryData(IMAGE_DIRECTORY_ENTRY_TLS);
+
+ CHECK(CheckUnderflow(VALPTR(pTlsHeader->EndAddressOfRawData), VALPTR(pTlsHeader->StartAddressOfRawData)));
+ CHECK(VALPTR(pTlsHeader->EndAddressOfRawData) - VALPTR(pTlsHeader->StartAddressOfRawData) <= COUNT_T_MAX);
+
+ CHECK(CheckInternalAddress(VALPTR(pTlsHeader->StartAddressOfRawData),
+ (COUNT_T) (VALPTR(pTlsHeader->EndAddressOfRawData) - VALPTR(pTlsHeader->StartAddressOfRawData))));
+
+ CHECK_OK;
+}
+
+inline PTR_VOID PEDecoder::GetTlsRange(COUNT_T * pSize) const
+{
+ CONTRACT(void *)
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(CheckNTHeaders());
+ PRECONDITION(HasTls());
+ PRECONDITION(CheckTls());
+ NOTHROW;
+ GC_NOTRIGGER;
+ POSTCONDITION(CheckPointer(RETVAL));
+ }
+ CONTRACT_END;
+
+ IMAGE_TLS_DIRECTORY *pTlsHeader =
+ PTR_IMAGE_TLS_DIRECTORY(GetDirectoryEntryData(IMAGE_DIRECTORY_ENTRY_TLS));
+
+ if (pSize != 0)
+ *pSize = (COUNT_T) (VALPTR(pTlsHeader->EndAddressOfRawData) - VALPTR(pTlsHeader->StartAddressOfRawData));
+ PREFIX_ASSUME (pTlsHeader!=NULL);
+ RETURN PTR_VOID(GetInternalAddressData(pTlsHeader->StartAddressOfRawData));
+}
+
+inline UINT32 PEDecoder::GetTlsIndex() const
+{
+ CONTRACTL
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(CheckNTHeaders());
+ PRECONDITION(HasTls());
+ PRECONDITION(CheckTls());
+ NOTHROW;
+ GC_NOTRIGGER;
+ }
+ CONTRACTL_END;
+
+ IMAGE_TLS_DIRECTORY *pTlsHeader = (IMAGE_TLS_DIRECTORY *) GetDirectoryEntryData(IMAGE_DIRECTORY_ENTRY_TLS);
+
+ return (UINT32)*PTR_UINT32(GetInternalAddressData((SIZE_T)VALPTR(pTlsHeader->AddressOfIndex)));
+}
+
+inline IMAGE_COR20_HEADER *PEDecoder::GetCorHeader() const
+{
+ CONTRACT(IMAGE_COR20_HEADER *)
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(CheckNTHeaders());
+ PRECONDITION(HasCorHeader());
+ NOTHROW;
+ GC_NOTRIGGER;
+ SO_TOLERANT;
+ POSTCONDITION(CheckPointer(RETVAL));
+ CANNOT_TAKE_LOCK;
+ SUPPORTS_DAC;
+ }
+ CONTRACT_END;
+
+ if (m_pCorHeader == NULL)
+ const_cast<PEDecoder *>(this)->m_pCorHeader =
+ dac_cast<PTR_IMAGE_COR20_HEADER>(FindCorHeader());
+
+ RETURN m_pCorHeader;
+}
+
+inline BOOL PEDecoder::IsNativeMachineFormat() const
+{
+ if (!HasContents() || !HasNTHeaders() )
+ return FALSE;
+ _ASSERTE(m_pNTHeaders);
+ WORD expectedFormat = HasCorHeader() && (HasNativeHeader() || HasReadyToRunHeader()) ?
+ IMAGE_FILE_MACHINE_NATIVE_NI :
+ IMAGE_FILE_MACHINE_NATIVE;
+ //do not call GetNTHeaders as we do not want to bother with PE32->PE32+ conversion
+ return m_pNTHeaders->FileHeader.Machine==expectedFormat;
+}
+
+inline BOOL PEDecoder::IsI386() const
+{
+ if (!HasContents() || !HasNTHeaders() )
+ return FALSE;
+ _ASSERTE(m_pNTHeaders);
+ //do not call GetNTHeaders as we do not want to bother with PE32->PE32+ conversion
+ return m_pNTHeaders->FileHeader.Machine==IMAGE_FILE_MACHINE_I386;
+}
+
+inline CORCOMPILE_HEADER *PEDecoder::GetNativeHeader() const
+{
+ CONTRACT(CORCOMPILE_HEADER *)
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(CheckNTHeaders());
+ PRECONDITION(HasCorHeader());
+ PRECONDITION(HasNativeHeader());
+ NOTHROW;
+ GC_NOTRIGGER;
+ POSTCONDITION(CheckPointer(RETVAL));
+ SO_TOLERANT;
+ SUPPORTS_DAC;
+ CANNOT_TAKE_LOCK;
+ SO_TOLERANT;
+ }
+ CONTRACT_END;
+
+ if (m_pNativeHeader == NULL)
+ const_cast<PEDecoder *>(this)->m_pNativeHeader =
+ dac_cast<PTR_CORCOMPILE_HEADER>(FindNativeHeader());
+
+ RETURN m_pNativeHeader;
+}
+
+#ifdef FEATURE_PREJIT
+inline const void * PEDecoder::GetNativePreferredBase() const
+{
+ CONTRACTL
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(CheckNativeHeader());
+ NOTHROW;
+ GC_NOTRIGGER;
+ }
+ CONTRACTL_END;
+
+ PREFIX_ASSUME (GetNativeHeader()!=NULL);
+ return (const void *) GetNativeHeader()->ImageBase;
+}
+
+inline BOOL PEDecoder::GetNativeILHasSecurityDirectory() const
+{
+ CONTRACTL
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(CheckNativeHeader());
+ NOTHROW;
+ GC_NOTRIGGER;
+ }
+ CONTRACTL_END;
+
+ PREFIX_ASSUME (GetNativeHeader()!=NULL);
+ return (GetNativeHeader()->Flags & CORCOMPILE_HEADER_HAS_SECURITY_DIRECTORY) != 0;
+}
+
+inline BOOL PEDecoder::GetNativeILIsIbcOptimized() const
+{
+ CONTRACTL
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(CheckNativeHeader());
+ NOTHROW;
+ GC_NOTRIGGER;
+ }
+ CONTRACTL_END;
+
+ PREFIX_ASSUME (GetNativeHeader()!=NULL);
+ return (GetNativeHeader()->Flags & CORCOMPILE_HEADER_IS_IBC_OPTIMIZED) != 0;
+}
+
+inline BOOL PEDecoder::GetNativeILHasReadyToRunHeader() const
+{
+ CONTRACTL
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(CheckNativeHeader());
+ NOTHROW;
+ GC_NOTRIGGER;
+ }
+ CONTRACTL_END;
+
+ PREFIX_ASSUME (GetNativeHeader()!=NULL);
+ return (GetNativeHeader()->Flags & CORCOMPILE_HEADER_IS_READY_TO_RUN) != 0;
+}
+
+inline BOOL PEDecoder::IsNativeILILOnly() const
+{
+ CONTRACTL
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(CheckNativeHeader());
+ NOTHROW;
+ GC_NOTRIGGER;
+ SO_TOLERANT;
+ CANNOT_TAKE_LOCK;
+ SUPPORTS_DAC;
+ }
+ CONTRACTL_END;
+
+ PREFIX_ASSUME (GetNativeHeader()!=NULL);
+ return((GetNativeHeader()->COR20Flags & VAL32(COMIMAGE_FLAGS_ILONLY)) != 0);
+}
+
+inline BOOL PEDecoder::IsNativeILDll() const
+{
+ CONTRACTL
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(CheckNativeHeader());
+ NOTHROW;
+ GC_NOTRIGGER;
+ }
+ CONTRACTL_END;
+
+ PREFIX_ASSUME (GetNativeHeader()!=NULL);
+ return((GetNativeHeader()->Characteristics & VAL16(IMAGE_FILE_DLL)) != 0);
+}
+
+
+inline void PEDecoder::GetNativeILPEKindAndMachine(DWORD* pdwKind, DWORD* pdwMachine) const
+{
+ CONTRACTL
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(CheckNativeHeader());
+ NOTHROW;
+ GC_NOTRIGGER;
+ }
+ CONTRACTL_END;
+
+ CORCOMPILE_HEADER * pNativeHeader = GetNativeHeader();
+ PREFIX_ASSUME (pNativeHeader!=NULL);
+
+ if (pdwKind != NULL)
+ *pdwKind = pNativeHeader->PEKind;
+ if (pdwMachine != NULL)
+ *pdwMachine = pNativeHeader->Machine;
+}
+
+inline CORCOMPILE_DEPENDENCY * PEDecoder::GetNativeDependencies(COUNT_T *pCount) const
+{
+ CONTRACTL
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(CheckNativeHeader());
+ NOTHROW;
+ GC_NOTRIGGER;
+ }
+ CONTRACTL_END;
+
+ IMAGE_DATA_DIRECTORY *pDir = &GetNativeHeader()->Dependencies;
+
+ if (pCount != NULL)
+ *pCount = VAL32(pDir->Size)/sizeof(CORCOMPILE_DEPENDENCY);
+
+ return (CORCOMPILE_DEPENDENCY *) GetDirectoryData(pDir);
+}
+
+#endif // FEATURE_PREJIT
+
+// static
+inline PTR_IMAGE_SECTION_HEADER PEDecoder::FindFirstSection(IMAGE_NT_HEADERS * pNTHeaders)
+{
+ LIMITED_METHOD_CONTRACT;
+ SUPPORTS_DAC;
+
+ return dac_cast<PTR_IMAGE_SECTION_HEADER>(
+ dac_cast<TADDR>(pNTHeaders) +
+ FIELD_OFFSET(IMAGE_NT_HEADERS, OptionalHeader) +
+ VAL16(pNTHeaders->FileHeader.SizeOfOptionalHeader));
+}
+
+inline COUNT_T PEDecoder::GetNumberOfSections() const
+{
+ CONTRACTL
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(CheckNTHeaders());
+ NOTHROW;
+ GC_NOTRIGGER;
+ SUPPORTS_DAC;
+ }
+ CONTRACTL_END;
+
+ return VAL16(FindNTHeaders()->FileHeader.NumberOfSections);
+}
+
+
+inline DWORD PEDecoder::GetImageIdentity() const
+{
+ WRAPPER_NO_CONTRACT;
+ return GetTimeDateStamp() ^ GetCheckSum() ^ DWORD( GetVirtualSize() );
+}
+
+
+inline IMAGE_SECTION_HEADER *PEDecoder::FindFirstSection() const
+{
+ CONTRACT(IMAGE_SECTION_HEADER *)
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(CheckNTHeaders());
+ NOTHROW;
+ GC_NOTRIGGER;
+ POSTCONDITION(CheckPointer(RETVAL));
+ SUPPORTS_DAC;
+ }
+ CONTRACT_END;
+
+ RETURN FindFirstSection(FindNTHeaders());
+}
+
+inline IMAGE_NT_HEADERS *PEDecoder::FindNTHeaders() const
+{
+ CONTRACT(IMAGE_NT_HEADERS *)
+ {
+ INSTANCE_CHECK;
+ NOTHROW;
+ GC_NOTRIGGER;
+ POSTCONDITION(CheckPointer(RETVAL));
+ SO_TOLERANT;
+ CANNOT_TAKE_LOCK;
+ SUPPORTS_DAC;
+ }
+ CONTRACT_END;
+
+ RETURN PTR_IMAGE_NT_HEADERS(m_base + VAL32(PTR_IMAGE_DOS_HEADER(m_base)->e_lfanew));
+}
+
+inline IMAGE_COR20_HEADER *PEDecoder::FindCorHeader() const
+{
+ CONTRACT(IMAGE_COR20_HEADER *)
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(HasCorHeader());
+ NOTHROW;
+ GC_NOTRIGGER;
+ POSTCONDITION(CheckPointer(RETVAL));
+ CANNOT_TAKE_LOCK;
+ SO_TOLERANT;
+ SUPPORTS_DAC;
+ }
+ CONTRACT_END;
+
+ const IMAGE_COR20_HEADER * pCor=PTR_IMAGE_COR20_HEADER(GetDirectoryEntryData(IMAGE_DIRECTORY_ENTRY_COMHEADER));
+ RETURN ((IMAGE_COR20_HEADER*)pCor);
+}
+
+inline CORCOMPILE_HEADER *PEDecoder::FindNativeHeader() const
+{
+ CONTRACT(CORCOMPILE_HEADER *)
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(HasNativeHeader());
+ NOTHROW;
+ GC_NOTRIGGER;
+ POSTCONDITION(CheckPointer(RETVAL));
+ SO_TOLERANT;
+ CANNOT_TAKE_LOCK;
+ SUPPORTS_DAC;
+ }
+ CONTRACT_END;
+
+ RETURN PTR_CORCOMPILE_HEADER(GetDirectoryData(&GetCorHeader()->ManagedNativeHeader));
+}
+
+inline CHECK PEDecoder::CheckBounds(RVA rangeBase, COUNT_T rangeSize, RVA rva)
+{
+ WRAPPER_NO_CONTRACT;
+ SUPPORTS_DAC;
+ CHECK(CheckOverflow(rangeBase, rangeSize));
+ CHECK(rva >= rangeBase);
+ CHECK(rva <= rangeBase + rangeSize);
+ CHECK_OK;
+}
+
+inline CHECK PEDecoder::CheckBounds(RVA rangeBase, COUNT_T rangeSize, RVA rva, COUNT_T size)
+{
+ WRAPPER_NO_CONTRACT;
+ SUPPORTS_DAC;
+ CHECK(CheckOverflow(rangeBase, rangeSize));
+ CHECK(CheckOverflow(rva, size));
+ CHECK(rva >= rangeBase);
+ CHECK(rva + size <= rangeBase + rangeSize);
+ CHECK_OK;
+}
+
+inline CHECK PEDecoder::CheckBounds(const void *rangeBase, COUNT_T rangeSize, const void *pointer)
+{
+ WRAPPER_NO_CONTRACT;
+ SUPPORTS_DAC;
+ CHECK(CheckOverflow(dac_cast<PTR_CVOID>(rangeBase), rangeSize));
+ CHECK(dac_cast<TADDR>(pointer) >= dac_cast<TADDR>(rangeBase));
+ CHECK(dac_cast<TADDR>(pointer) <= dac_cast<TADDR>(rangeBase) + rangeSize);
+ CHECK_OK;
+}
+
+inline CHECK PEDecoder::CheckBounds(PTR_CVOID rangeBase, COUNT_T rangeSize, PTR_CVOID pointer, COUNT_T size)
+{
+ WRAPPER_NO_CONTRACT;
+ SUPPORTS_DAC;
+ CHECK(CheckOverflow(rangeBase, rangeSize));
+ CHECK(CheckOverflow(pointer, size));
+ CHECK(dac_cast<TADDR>(pointer) >= dac_cast<TADDR>(rangeBase));
+ CHECK(dac_cast<TADDR>(pointer) + size <= dac_cast<TADDR>(rangeBase) + rangeSize);
+ CHECK_OK;
+}
+
+inline void PEDecoder::GetPEKindAndMachine(DWORD * pdwPEKind, DWORD *pdwMachine)
+{
+ CONTRACTL
+ {
+ NOTHROW;
+ GC_NOTRIGGER;
+ }
+ CONTRACTL_END;
+
+ DWORD dwKind=0,dwMachine=0;
+ if(HasContents() && HasNTHeaders())
+ {
+ dwMachine = GetMachine();
+
+ BOOL fIsPE32Plus = !Has32BitNTHeaders();
+
+ if (fIsPE32Plus)
+ dwKind |= (DWORD)pe32Plus;
+
+ if (HasCorHeader())
+ {
+ IMAGE_COR20_HEADER * pCorHdr = GetCorHeader();
+ if(pCorHdr != NULL)
+ {
+ DWORD dwCorFlags = pCorHdr->Flags;
+
+ if (dwCorFlags & VAL32(COMIMAGE_FLAGS_ILONLY))
+ {
+ dwKind |= (DWORD)peILonly;
+#ifdef _WIN64
+ // compensate for shim promotion of PE32/ILONLY headers to PE32+ on WIN64
+ if (fIsPE32Plus && (GetMachine() == IMAGE_FILE_MACHINE_I386))
+ dwKind &= ~((DWORD)pe32Plus);
+#endif
+ }
+
+ if (COR_IS_32BIT_REQUIRED(dwCorFlags))
+ dwKind |= (DWORD)pe32BitRequired;
+ else if (COR_IS_32BIT_PREFERRED(dwCorFlags))
+ dwKind |= (DWORD)pe32BitPreferred;
+
+ // compensate for MC++ peculiarity
+ if(dwKind == 0)
+ dwKind = (DWORD)pe32BitRequired;
+ }
+ else
+ {
+ dwKind |= (DWORD)pe32Unmanaged;
+ }
+
+ if (HasReadyToRunHeader())
+ {
+ if (dwMachine == IMAGE_FILE_MACHINE_NATIVE_NI)
+ {
+ // Supply the original machine type to the assembly binder
+ dwMachine = IMAGE_FILE_MACHINE_NATIVE;
+ }
+
+ if ((GetReadyToRunHeader()->Flags & READYTORUN_FLAG_PLATFORM_NEUTRAL_SOURCE) != 0)
+ {
+ // Supply the original PEKind/Machine to the assembly binder to make the full assembly name look like the original
+ dwKind = peILonly;
+ dwMachine = IMAGE_FILE_MACHINE_I386;
+ }
+ }
+ }
+ else
+ {
+ dwKind |= (DWORD)pe32Unmanaged;
+ }
+ }
+
+ *pdwPEKind = dwKind;
+ *pdwMachine = dwMachine;
+}
+
+inline BOOL PEDecoder::IsPlatformNeutral()
+{
+ CONTRACTL
+ {
+ NOTHROW;
+ GC_NOTRIGGER;
+ }
+ CONTRACTL_END;
+
+ DWORD dwKind, dwMachine;
+ GetPEKindAndMachine(&dwKind, &dwMachine);
+ return ((dwKind & (peILonly | pe32Plus | pe32BitRequired)) == peILonly) && (dwMachine == IMAGE_FILE_MACHINE_I386);
+}
+
+inline BOOL PEDecoder::HasReadyToRunHeader() const
+{
+ CONTRACTL
+ {
+ INSTANCE_CHECK;
+ NOTHROW;
+ GC_NOTRIGGER;
+ CANNOT_TAKE_LOCK;
+ SO_TOLERANT;
+ SUPPORTS_DAC;
+ }
+ CONTRACTL_END;
+
+ if (m_flags & FLAG_HAS_NO_READYTORUN_HEADER)
+ return FALSE;
+
+ if (m_pReadyToRunHeader != NULL)
+ return TRUE;
+
+ return FindReadyToRunHeader() != NULL;
+}
+
+inline READYTORUN_HEADER * PEDecoder::GetReadyToRunHeader() const
+{
+ CONTRACT(READYTORUN_HEADER *)
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(CheckNTHeaders());
+ PRECONDITION(HasCorHeader());
+ PRECONDITION(HasReadyToRunHeader());
+ NOTHROW;
+ GC_NOTRIGGER;
+ POSTCONDITION(CheckPointer(RETVAL));
+ SO_TOLERANT;
+ SUPPORTS_DAC;
+ CANNOT_TAKE_LOCK;
+ SO_TOLERANT;
+ }
+ CONTRACT_END;
+
+ if (m_pReadyToRunHeader != NULL)
+ RETURN m_pReadyToRunHeader;
+
+ RETURN FindReadyToRunHeader();
+}
+
+#endif // _PEDECODER_INL_
diff --git a/src/inc/peinformation.h b/src/inc/peinformation.h
new file mode 100644
index 0000000000..f24d7bcdcb
--- /dev/null
+++ b/src/inc/peinformation.h
@@ -0,0 +1,75 @@
+// 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.
+// --------------------------------------------------------------------------------
+// PEInformation.h
+//
+
+// --------------------------------------------------------------------------------
+
+#ifndef PEINFORMATION_H
+#define PEINFORMATION_H
+
+#ifndef PEKIND_ENUM_DEFINED
+#define PEKIND_ENUM_DEFINED
+// This must match the definition of pekind in fusion.idl
+typedef enum _tagPEKIND
+{
+ peNone = 0x00000000,
+ peMSIL = 0x00000001,
+ peI386 = 0x00000002,
+ peIA64 = 0x00000003,
+ peAMD64 = 0x00000004,
+ peARM = 0x00000005,
+ peARM64 = 0x00000006,
+ peInvalid = 0xffffffff
+} PEKIND;
+
+#endif
+
+
+inline bool IsPE64(PEKIND x)
+{
+ return ( (x == peIA64) || (x == peAMD64) );
+}
+
+inline bool IsPE32(PEKIND x)
+{
+ return ( (x == peI386) || (x == peARM) );
+}
+
+inline bool IsPEMSIL(PEKIND x)
+{
+ return ( (x == peMSIL) );
+}
+
+#ifdef _WIN64
+inline bool IsProcess32() { return false; }
+#else
+inline bool IsProcess32() { return true; }
+#endif
+
+#if defined(_TARGET_X86_)
+inline PEKIND TargetNativePEKIND() { return peI386; }
+#elif defined(_TARGET_AMD64_)
+inline PEKIND TargetNativePEKIND() { return peAMD64; }
+#elif defined(_TARGET_ARM_)
+inline PEKIND TargetNativePEKIND() { return peARM; }
+#elif defined(_TARGET_ARM64_)
+inline PEKIND TargetNativePEKIND() { return peARM64; }
+#else
+#error Need to define valid TargetNativePEKIND()
+#endif
+
+STDAPI RuntimeIsValidAssemblyOnThisPlatform_CheckProcessorArchitecture(PEKIND processorArchitecture, BOOL bForInstall);
+
+//*****************************************************************************
+// Intreprets CLRPeKind and dwImageType to get PeKind as per the CLRBitness
+// API, CLRPeKind and dwImageType can be recoved from GetPEKind() if you
+// have the metadata, or retrieved directly from the headers as per the
+// implementation in shim.cpp:_CorValidateImage.
+//*****************************************************************************
+HRESULT TranslatePEToArchitectureType(CorPEKind CLRPeKind, DWORD dwImageType, PEKIND * PeKind);
+HRESULT TranslatePEToArchitectureType(CorPEKind CLRPeKind, DWORD dwImageType, DWORD dwAssemblyFlags, PEKIND * PeKind);
+
+#endif // PEINFORMATION_H
diff --git a/src/inc/perfcounterdefs.h b/src/inc/perfcounterdefs.h
new file mode 100644
index 0000000000..83fe7b1d5b
--- /dev/null
+++ b/src/inc/perfcounterdefs.h
@@ -0,0 +1,495 @@
+// 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.
+//-----------------------------------------------------------------------------
+// PerfCounterDefs.h
+//
+// Internal Interface for CLR to use Performance counters
+//-----------------------------------------------------------------------------
+
+
+#ifndef _PerfCounterDefs_h_
+#define _PerfCounterDefs_h_
+
+#include "contract.h"
+
+//-----------------------------------------------------------------------------
+// PerfCounters are only enabled if ENABLE_PERF_COUNTERS is defined.
+// If we know we want them (such as in the impl or perfmon, then define this
+// in before we include this header, else define this from the sources file.
+//
+// Note that some platforms don't use perfcounters, so to avoid a build
+// break, you must wrap PerfCounter code (such as instrumenting in either
+// #ifdef or use the COUNTER_ONLY(x) macro (defined below)
+//
+
+//-----------------------------------------------------------------------------
+// Name of global IPC block
+#define SHARED_PERF_IPC_NAME W("SharedPerfIPCBlock")
+
+
+//-----------------------------------------------------------------------------
+// Attributes for the IPC block
+//-----------------------------------------------------------------------------
+const int PERF_ATTR_ON = 0x0001; // Are we even updating any counters?
+const int PERF_ATTR_GLOBAL = 0x0002; // Is this a global or private block?
+
+
+
+
+
+//.............................................................................
+// Tri Counter. Support for the common trio of counters (Total, Current, and
+// Instantaneous). This compiles to the same thing if we had them all separate,
+// but it's a lot cleaner this way.
+//.............................................................................
+struct TRICOUNT
+{
+ DWORD Cur; // Current, has +, -
+ DWORD Total; // Total, has only +
+ inline void operator++(int) {
+ LIMITED_METHOD_CONTRACT;
+ Cur ++; Total ++;
+ }
+ inline void operator--(int) {
+ LIMITED_METHOD_CONTRACT;
+ Cur --;
+ }
+ inline void operator+=(int delta) {
+ LIMITED_METHOD_CONTRACT;
+ Cur += delta; Total += delta;
+ }
+ inline void operator-=(int delta) {
+ LIMITED_METHOD_CONTRACT;
+ Cur -= delta;
+ }
+ inline void operator=(int delta) {
+ LIMITED_METHOD_CONTRACT;
+ Cur = delta;
+ Total = delta;
+ }
+ inline void operator+=(TRICOUNT delta) {
+ LIMITED_METHOD_CONTRACT;
+ Cur += delta.Cur; Total += delta.Total;
+ }
+
+};
+
+//.............................................................................
+// Interlocked Tri Counter. Support for the common trio of counters (Total, Current,
+// and Instantaneous). This compiles to the same thing if we had them all separate,
+// but it's a lot cleaner this way.
+//.............................................................................
+struct TRICOUNT_IL
+{
+ DWORD Cur; // Current, has +, -
+ DWORD Total; // Total, has only +
+ inline void operator++(int) {
+ LIMITED_METHOD_CONTRACT;
+ InterlockedIncrement((LPLONG)&Cur); InterlockedIncrement((LPLONG)&Total);
+ }
+ inline void operator--(int) {
+ LIMITED_METHOD_CONTRACT;
+ InterlockedDecrement((LPLONG)&Cur);
+ }
+ inline void operator+=(int delta) {
+ LIMITED_METHOD_CONTRACT;
+ while (TRUE)
+ {
+ LONG old_Cur = Cur;
+ if (InterlockedCompareExchange((LPLONG)&Cur, Cur+delta, old_Cur) == old_Cur)
+ break;
+ }
+ while (TRUE)
+ {
+ LONG old_Total = Total;
+ if (InterlockedCompareExchange((LPLONG)&Total, Total+delta, old_Total) == old_Total)
+ break;
+ }
+ }
+ inline void operator-=(int delta) {
+ LIMITED_METHOD_CONTRACT;
+ while (TRUE)
+ {
+ LONG old_Cur = Cur;
+ if (InterlockedCompareExchange((LPLONG)&Cur, Cur-delta, old_Cur) == old_Cur)
+ break;
+ }
+ }
+ inline void operator=(int delta) {
+ LIMITED_METHOD_CONTRACT;
+ while (TRUE)
+ {
+ LONG old_Cur = Cur;
+ if (InterlockedCompareExchange((LPLONG)&Cur, delta, old_Cur) == old_Cur)
+ break;
+ }
+
+ while (TRUE)
+ {
+ LONG old_Total = Total;
+ if (InterlockedCompareExchange((LPLONG)&Total, delta, old_Total) == old_Total)
+ break;
+ }
+ }
+ inline void operator+=(TRICOUNT_IL delta) {
+ LIMITED_METHOD_CONTRACT;
+ while (TRUE)
+ {
+ LONG old_Cur = Cur;
+ if (InterlockedCompareExchange((LPLONG)&Cur, Cur+delta.Cur, old_Cur) == old_Cur)
+ break;
+ }
+ while (TRUE)
+ {
+ LONG old_Total = Total;
+ if (InterlockedCompareExchange((LPLONG)&Total, Total+delta.Total, old_Total) == old_Total)
+ break;
+ }
+ }
+
+};
+
+
+//.............................................................................
+// Dual Counter. Support for the (Total and Instantaneous (rate)). Helpful in cases
+// where the current value is always same as the total value. ie. the counter is never
+// decremented.
+// This compiles to the same thing if we had them separate, but it's a lot cleaner
+// this way.
+//.............................................................................
+struct DUALCOUNT
+{
+ DWORD Total;
+ inline void operator++(int) {
+ LIMITED_METHOD_CONTRACT;
+ Total ++;
+ }
+
+ inline void operator+=(int delta) {
+ LIMITED_METHOD_CONTRACT;
+ Total += delta;
+ }
+
+ inline void operator+=(DUALCOUNT delta) {
+ LIMITED_METHOD_CONTRACT;
+ Total += delta.Total;
+ }
+
+
+};
+
+//-----------------------------------------------------------------------------
+// Format for the Perf Counter IPC Block
+// IPC block is broken up into sections. This marks it easier to marshall
+// into different perfmon objects
+//
+//.............................................................................
+// Naming convention (by prefix):
+// c - Raw count of something.
+// cb- count of bytes
+// time - time value.
+// depth - stack depth
+//-----------------------------------------------------------------------------
+
+const int MAX_TRACKED_GENS = 3; // number of generations we track
+
+//
+// Perf_GC_Wow64 mimics in a 64 bit process, the layout of Perf_GC in a 32 bit process
+// It does this by replacing all size_t by DWORD
+//
+// *** Keep contents of Perf_GC_Wow64 and Perf_GC in sync ***
+
+struct Perf_GC_Wow64
+{
+public:
+ DWORD cGenCollections[MAX_TRACKED_GENS];// count of collects per gen
+ DWORD cbPromotedMem[MAX_TRACKED_GENS-1]; // count of promoted memory
+ DWORD cbPromotedFinalizationMem; // count of memory promoted due to finalization
+ DWORD cProcessID; // process ID
+ DWORD cGenHeapSize[MAX_TRACKED_GENS]; // size of heaps per gen
+ DWORD cTotalCommittedBytes; // total number of committed bytes.
+ DWORD cTotalReservedBytes; // bytes reserved via VirtualAlloc
+ DWORD cLrgObjSize; // size of Large Object Heap
+ DWORD cSurviveFinalize; // count of instances surviving from finalizing
+ DWORD cHandles; // count of GC handles
+ DWORD cbAlloc; // bytes allocated
+ DWORD cbLargeAlloc; // bytes allocated for Large Objects
+ DWORD cInducedGCs; // number of explicit GCs
+ DWORD timeInGC; // Time in GC
+ DWORD timeInGCBase; // must follow time in GC counter
+
+ DWORD cPinnedObj; // # of Pinned Objects
+ DWORD cSinkBlocks; // # of sink blocks
+};
+
+// *** Keep contents of Perf_GC_Wow64 and Perf_GC in sync ***
+#ifndef _WIN64
+#include <pshpack4.h>
+#endif //#ifndef _WIN64
+struct Perf_GC
+{
+public:
+ size_t cGenCollections[MAX_TRACKED_GENS];// count of collects per gen
+ size_t cbPromotedMem[MAX_TRACKED_GENS-1]; // count of promoted memory
+ size_t cbPromotedFinalizationMem; // count of memory promoted due to finalization
+ size_t cProcessID; // process ID
+ size_t cGenHeapSize[MAX_TRACKED_GENS]; // size of heaps per gen
+ size_t cTotalCommittedBytes; // total number of committed bytes.
+ size_t cTotalReservedBytes; // bytes reserved via VirtualAlloc
+ size_t cLrgObjSize; // size of Large Object Heap
+ size_t cSurviveFinalize; // count of instances surviving from finalizing
+ size_t cHandles; // count of GC handles
+ size_t cbAlloc; // bytes allocated
+ size_t cbLargeAlloc; // bytes allocated for Large Objects
+ size_t cInducedGCs; // number of explicit GCs
+ DWORD timeInGC; // Time in GC
+ DWORD timeInGCBase; // must follow time in GC counter
+
+ size_t cPinnedObj; // # of Pinned Objects
+ size_t cSinkBlocks; // # of sink blocks
+
+ Perf_GC();
+ Perf_GC(Perf_GC_Wow64& copyFrom);
+};
+#ifndef _WIN64
+#include <poppack.h>
+#endif //#ifndef _WIN64
+
+//
+// Perf_Loading_Wow64 mimics in a 64 bit process, the layout of Perf_Loading
+// in a 32 bit process. It does this by replacing all size_t by DWORD
+//
+// *** Keep contents of Perf_Loading_Wow64 and Perf_Loading in sync ***
+struct Perf_Loading_Wow64
+{
+// Loading
+public:
+ TRICOUNT cClassesLoaded;
+ TRICOUNT_IL cAppDomains; // Current # of AppDomains
+ TRICOUNT cAssemblies; // Current # of Assemblies.
+ UNALIGNED LONGLONG timeLoading; // % time loading
+ DWORD cAsmSearchLen; // Avg search length for assemblies
+ DUALCOUNT cLoadFailures; // Classes Failed to load
+ DWORD cbLoaderHeapSize; // Total size of heap used by the loader
+ DUALCOUNT cAppDomainsUnloaded; // Rate at which app domains are unloaded
+};
+
+// *** Keep contents of Perf_Loading_Wow64 and Perf_Loading in sync ***
+#ifndef _WIN64
+#include <pshpack4.h>
+#endif //#ifndef _WIN64
+struct Perf_Loading
+{
+// Loading
+public:
+ TRICOUNT cClassesLoaded;
+ TRICOUNT_IL cAppDomains; // Current # of AppDomains
+ TRICOUNT cAssemblies; // Current # of Assemblies.
+ UNALIGNED LONGLONG timeLoading; // % time loading
+ DWORD cAsmSearchLen; // Avg search length for assemblies
+ DUALCOUNT cLoadFailures; // Classes Failed to load
+ size_t cbLoaderHeapSize; // Total size of heap used by the loader
+ DUALCOUNT cAppDomainsUnloaded; // Rate at which app domains are unloaded
+
+ Perf_Loading();
+ Perf_Loading(Perf_Loading_Wow64& copyFrom);
+};
+#ifndef _WIN64
+#include <poppack.h>
+#endif //#ifndef _WIN64
+
+#ifndef _WIN64
+#include <pshpack4.h>
+#endif //#ifndef _WIN64
+struct Perf_Jit
+{
+// Jitting
+ DWORD cMethodsJitted; // number of methods jitted
+ TRICOUNT cbILJitted; // IL jitted stats
+// DUALCOUNT cbPitched; // Total bytes pitched
+ DWORD cJitFailures; // # of standard Jit failures
+ DWORD timeInJit; // Time in JIT since last sample
+ DWORD timeInJitBase; // Time in JIT base counter
+};
+#ifndef _WIN64
+#include <poppack.h>
+#endif //#ifndef _WIN64
+
+#ifndef _WIN64
+#include <pshpack4.h>
+#endif //#ifndef _WIN64
+struct Perf_Excep
+{
+// Exceptions
+ DUALCOUNT cThrown; // Number of Exceptions thrown
+ DWORD cFiltersExecuted; // Number of Filters executed
+ DWORD cFinallysExecuted; // Number of Finallys executed
+ DWORD cThrowToCatchStackDepth; // Delta from throw to catch site on stack
+};
+#ifndef _WIN64
+#include <poppack.h>
+#endif //#ifndef _WIN64
+
+#ifndef _WIN64
+#include <pshpack4.h>
+#endif //#ifndef _WIN64
+struct Perf_Interop
+{
+// Interop
+ DWORD cCCW; // Number of CCWs
+ DWORD cStubs; // Number of stubs
+ DWORD cMarshalling; // # of time marshalling args and return values.
+ DWORD cTLBImports; // Number of tlbs we import
+ DWORD cTLBExports; // Number of tlbs we export
+};
+#ifndef _WIN64
+#include <poppack.h>
+#endif //#ifndef _WIN64
+
+#ifndef _WIN64
+#include <pshpack4.h>
+#endif //#ifndef _WIN64
+struct Perf_LocksAndThreads
+{
+// Locks
+ DUALCOUNT cContention; // # of times in AwareLock::EnterEpilogue()
+ TRICOUNT cQueueLength; // Lenght of queue
+// Threads
+ DWORD cCurrentThreadsLogical; // Number (created - destroyed) of logical threads
+ DWORD cCurrentThreadsPhysical; // Number (created - destroyed) of OS threads
+ TRICOUNT cRecognizedThreads; // # of Threads execute in runtime's control
+};
+#ifndef _WIN64
+#include <poppack.h>
+#endif //#ifndef _WIN64
+
+
+// IMPORTANT!!!!!!!: The first two fields in the struct have to be together
+// and be the first two fields in the struct. The managed code in ChannelServices.cs
+// depends on this.
+#ifndef _WIN64
+#include <pshpack4.h>
+#endif //#ifndef _WIN64
+struct Perf_Contexts
+{
+// Contexts & Remoting
+ DUALCOUNT cRemoteCalls; // # of remote calls
+ DWORD cChannels; // Number of current channels
+ DWORD cProxies; // Number of context proxies.
+ DWORD cClasses; // # of Context-bound classes
+ DWORD cObjAlloc; // # of context bound objects allocated
+ DWORD cContexts; // The current number of contexts.
+};
+#ifndef _WIN64
+#include <poppack.h>
+#endif //#ifndef _WIN64
+
+//
+// Perf_Security_Wow64 mimics in a 64 bit process, the layout of Perf_Security
+// in a 32 bit process. It does this by packing all members on 4 byte boundary
+// ("timeAuthorize" field which is 8 bytes in size, will get 8 byte aligned
+// on 64 bit by default)
+//
+// *** Keep contents of Perf_Security_Wow64 and Perf_Security in sync ***
+#include <pshpack4.h>
+struct Perf_Security_Wow64
+{
+// Security
+public:
+ DWORD cTotalRTChecks; // Total runtime checks
+ UNALIGNED LONGLONG timeAuthorize; // % time authenticating
+ DWORD cLinkChecks; // link time checks
+ DWORD timeRTchecks; // % time in Runtime checks
+ DWORD timeRTchecksBase; // % time in Runtime checks base counter
+ DWORD stackWalkDepth; // depth of stack for security checks
+};
+#include <poppack.h>
+
+#ifndef _WIN64
+#include <pshpack4.h>
+#endif //#ifndef _WIN64
+struct Perf_Security
+{
+// Security
+public:
+ DWORD cTotalRTChecks; // Total runtime checks
+ UNALIGNED LONGLONG timeAuthorize; // % time authenticating
+ DWORD cLinkChecks; // link time checks
+ DWORD timeRTchecks; // % time in Runtime checks
+ DWORD timeRTchecksBase; // % time in Runtime checks base counter
+ DWORD stackWalkDepth; // depth of stack for security checks
+
+ Perf_Security();
+ Perf_Security(Perf_Security_Wow64& copyFrom);
+};
+#ifndef _WIN64
+#include <poppack.h>
+#endif //#ifndef _WIN64
+
+
+//
+// PerfCounterWow64IPCControlBlock mimics in a 64 bit process, the layout of
+// PerfCounterIPCControlBlock in a 32 bit process.
+//
+// *** Keep contents of PerfCounterWow64IPCControlBlock and PerfCounterIPCControlBlock in sync ***
+#include <pshpack4.h>
+struct PerfCounterWow64IPCControlBlock
+{
+public:
+// Versioning info
+ WORD m_cBytes; // size of this entire block
+ WORD m_wAttrs; // attributes for this block
+
+// Counter Sections
+ Perf_GC_Wow64 m_GC;
+ Perf_Contexts m_Context;
+ Perf_Interop m_Interop;
+ Perf_Loading_Wow64 m_Loading;
+ Perf_Excep m_Excep;
+ Perf_LocksAndThreads m_LocksAndThreads;
+ Perf_Jit m_Jit;
+ Perf_Security_Wow64 m_Security;
+};
+#include <poppack.h>
+
+// Note: PerfMonDll marshalls data out of here by copying a continous block of memory.
+// We can still add new members to the subsections above, but if we change their
+// placement in the structure below, we may break PerfMon's marshalling
+
+// *** Keep contents of PerfCounterWow64IPCControlBlock and PerfCounterIPCControlBlock in sync ***
+#ifndef _WIN64
+#include <pshpack4.h>
+#endif //#ifndef _WIN64
+struct PerfCounterIPCControlBlock
+{
+public:
+// Versioning info
+ WORD m_cBytes; // size of this entire block
+ WORD m_wAttrs; // attributes for this block
+
+// Counter Sections
+ Perf_GC m_GC;
+ Perf_Contexts m_Context;
+ Perf_Interop m_Interop;
+ Perf_Loading m_Loading;
+ Perf_Excep m_Excep;
+ Perf_LocksAndThreads m_LocksAndThreads;
+ Perf_Jit m_Jit;
+ Perf_Security m_Security;
+
+ PerfCounterIPCControlBlock();
+ PerfCounterIPCControlBlock(PerfCounterWow64IPCControlBlock& copyFrom);
+};
+
+#ifndef _WIN64
+#include <poppack.h>
+#endif //#ifndef _WIN64
+
+//
+// Inline definitions
+//
+
+#include "perfcounterdefs.inl"
+
+#endif // _PerfCounterDefs_h_
diff --git a/src/inc/perfcounterdefs.inl b/src/inc/perfcounterdefs.inl
new file mode 100644
index 0000000000..ab8f73d6d8
--- /dev/null
+++ b/src/inc/perfcounterdefs.inl
@@ -0,0 +1,89 @@
+// 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.
+//-----------------------------------------------------------------------------
+// PerfCounterDefs.inl
+//
+// Internal Interface for CLR to use Performance counters
+//-----------------------------------------------------------------------------
+
+#ifndef _PerfCounterDefs_inl_
+#define _PerfCounterDefs_inl_
+
+#include "perfcounterdefs.h"
+
+inline Perf_GC::Perf_GC() {}
+
+inline Perf_GC::Perf_GC(Perf_GC_Wow64& copyFrom)
+{
+ for (int index = 0; index < MAX_TRACKED_GENS; index++)
+ {
+ cGenCollections[index] = (size_t)copyFrom.cGenCollections[index];
+ cGenHeapSize[index] = (size_t)copyFrom.cGenHeapSize[index];
+ }
+ for (int index = 0; index < MAX_TRACKED_GENS - 1; index++)
+ {
+ cbPromotedMem[index] = (size_t)copyFrom.cbPromotedMem[index];
+ }
+
+ cbPromotedFinalizationMem = (size_t) copyFrom.cbPromotedFinalizationMem;
+ cProcessID = (size_t) copyFrom.cProcessID;
+ cTotalCommittedBytes = (size_t) copyFrom.cTotalCommittedBytes;
+ cTotalReservedBytes = (size_t) copyFrom.cTotalReservedBytes;
+ cLrgObjSize = (size_t) copyFrom.cLrgObjSize;
+ cSurviveFinalize = (size_t) copyFrom.cSurviveFinalize;
+ cHandles = (size_t) copyFrom.cHandles;
+ cbAlloc = (size_t) copyFrom.cbAlloc;
+ cbLargeAlloc = (size_t) copyFrom.cbLargeAlloc;
+ cInducedGCs = (size_t) copyFrom.cInducedGCs;
+ timeInGC = copyFrom.timeInGC;
+ timeInGCBase = copyFrom.timeInGCBase;
+ cPinnedObj = (size_t) copyFrom.cPinnedObj;
+ cSinkBlocks = (size_t) copyFrom.cSinkBlocks;
+}
+
+inline Perf_Loading::Perf_Loading() {}
+
+inline Perf_Loading::Perf_Loading(Perf_Loading_Wow64& copyFrom)
+: cClassesLoaded(copyFrom.cClassesLoaded),
+ cAppDomains(copyFrom.cAppDomains),
+ cAssemblies(copyFrom.cAssemblies),
+ timeLoading(copyFrom.timeLoading),
+ cAsmSearchLen(copyFrom.cAsmSearchLen),
+ cLoadFailures (copyFrom.cLoadFailures),
+ cbLoaderHeapSize ((size_t) copyFrom.cbLoaderHeapSize),
+ cAppDomainsUnloaded (copyFrom.cAppDomainsUnloaded)
+{
+}
+
+inline Perf_Security::Perf_Security() {};
+
+inline Perf_Security::Perf_Security(Perf_Security_Wow64& copyFrom)
+: cTotalRTChecks(copyFrom.cTotalRTChecks),
+ timeAuthorize(0), // Unused "reserved" field
+ cLinkChecks(copyFrom.cLinkChecks),
+ timeRTchecks(copyFrom.timeRTchecks),
+ timeRTchecksBase(copyFrom.timeRTchecksBase),
+ stackWalkDepth (copyFrom.stackWalkDepth)
+{
+}
+
+inline PerfCounterIPCControlBlock::PerfCounterIPCControlBlock() {}
+
+inline PerfCounterIPCControlBlock::PerfCounterIPCControlBlock(PerfCounterWow64IPCControlBlock& copyFrom)
+: m_cBytes (copyFrom.m_cBytes),
+ m_wAttrs (copyFrom.m_wAttrs),
+ m_GC (copyFrom.m_GC),
+ m_Context (copyFrom.m_Context),
+ m_Interop (copyFrom.m_Interop),
+ m_Loading (copyFrom.m_Loading),
+ m_Excep (copyFrom.m_Excep),
+ m_LocksAndThreads (copyFrom.m_LocksAndThreads),
+ m_Jit (copyFrom.m_Jit),
+ m_Security (copyFrom.m_Security)
+{
+ _ASSERTE((size_t)m_cBytes == sizeof(PerfCounterWow64IPCControlBlock));
+}
+
+#endif // _PerfCounterDefs_inl_
+
diff --git a/src/inc/perfcounters.h b/src/inc/perfcounters.h
new file mode 100644
index 0000000000..a27b58da0c
--- /dev/null
+++ b/src/inc/perfcounters.h
@@ -0,0 +1,124 @@
+// 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.
+//-----------------------------------------------------------------------------
+// PerfCounters.h
+//
+// Internal Interface for CLR to use Performance counters
+//-----------------------------------------------------------------------------
+
+
+#ifndef _PerfCounters_h_
+#define _PerfCounters_h_
+
+#include "perfcounterdefs.h"
+
+#ifdef ENABLE_PERF_COUNTERS
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+// This code section active iff we're using Perf Counters
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+//-----------------------------------------------------------------------------
+// PerfCounter class serves as namespace with data protection.
+// Enforce this by making constructor private
+//-----------------------------------------------------------------------------
+class PerfCounters
+{
+private:
+ PerfCounters();
+
+public:
+ static HRESULT Init();
+ static void Terminate();
+
+ static PerfCounterIPCControlBlock * GetPrivatePerfCounterPtr();
+
+private:
+ static HANDLE m_hPrivateMapPerf;
+
+ static PerfCounterIPCControlBlock * m_pPrivatePerf;
+
+ static BOOL m_fInit;
+
+// Set pointers to garbage so they're never null.
+ static PerfCounterIPCControlBlock m_garbage;
+
+ friend PerfCounterIPCControlBlock & GetPerfCounters();
+};
+
+//-----------------------------------------------------------------------------
+// Utility functions
+//-----------------------------------------------------------------------------
+
+//-----------------------------------------------------------------------------
+// Get the perf counters specific to our process
+//-----------------------------------------------------------------------------
+inline PerfCounterIPCControlBlock & GetPerfCounters()
+{
+ LIMITED_METHOD_CONTRACT;
+
+ return *PerfCounters::m_pPrivatePerf;
+}
+
+inline PerfCounterIPCControlBlock *PerfCounters::GetPrivatePerfCounterPtr()
+{
+ LIMITED_METHOD_CONTRACT;
+
+ return m_pPrivatePerf;
+};
+
+extern "C" Perf_Contexts * STDMETHODCALLTYPE GetPrivateContextsPerfCounters();
+
+#define COUNTER_ONLY(x) x
+
+#define PERF_COUNTER_NUM_OF_ITERATIONS 10
+
+#if defined(_X86_) && defined(_MSC_VER)
+
+inline UINT64 GetCycleCount_UINT64()
+{
+ LIMITED_METHOD_CONTRACT;
+ return __rdtsc();
+}
+
+#else // defined(_X86_) && defined(_MSC_VER)
+inline UINT64 GetCycleCount_UINT64()
+{
+ LIMITED_METHOD_CONTRACT;
+
+ LARGE_INTEGER qwTmp;
+ QueryPerformanceCounter(&qwTmp);
+ return qwTmp.QuadPart;
+}
+#endif // defined(_X86_) && defined(_MSC_VER)
+
+#define PERF_COUNTER_TIMER_PRECISION UINT64
+#define GET_CYCLE_COUNT GetCycleCount_UINT64
+
+#define PERF_COUNTER_TIMER_START() \
+PERF_COUNTER_TIMER_PRECISION _startPerfCounterTimer = GET_CYCLE_COUNT();
+
+#define PERF_COUNTER_TIMER_STOP(global) \
+global = (GET_CYCLE_COUNT() - _startPerfCounterTimer);
+
+
+
+
+#else // ENABLE_PERF_COUNTERS
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+// This code section active iff we're NOT using Perf Counters
+// Note, not even a class definition, so all usages of PerfCounters in client
+// should be in #ifdef or COUNTER_ONLY().
+//-----------------------------------------------------------------------------
+//-----------------------------------------------------------------------------
+
+#define COUNTER_ONLY(x)
+
+
+#endif // ENABLE_PERF_COUNTERS
+
+
+#endif // _PerfCounters_h_
diff --git a/src/inc/perflog.h b/src/inc/perflog.h
new file mode 100644
index 0000000000..84578d36a8
--- /dev/null
+++ b/src/inc/perflog.h
@@ -0,0 +1,142 @@
+// 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.
+//-----------------------------------------------------------------------------
+// PerfLog.h
+
+// Internal interface for logging perfromance data. Currently, two types of logging
+// formats are supported, Pretty print for stdout and perf automation friendly
+// format.
+// The logging code is compiled in for retail builds but logs are generated only if
+// PERF_OUTPUT environment variable is set. (This can be changed to a registry entry
+// if we want perf logs on CE or other platforms that don't supprt env vars.))
+//-----------------------------------------------------------------------------
+
+#include "contract.h"
+
+#ifndef _PERFLOG_H_
+#define _PERFLOG_H_
+
+#if !defined(_WIN64) && !defined(DACCESS_COMPILE)
+#define ENABLE_PERF_LOG
+#else
+#undef ENABLE_PERF_LOG
+#endif
+
+// Also disable Perf logging code if there's a explicite define to do so in SOURCES
+// file or another hdr file. This provides one point where all perf log related baggage
+// can be avoided in the build.
+#if defined(DISABLE_PERF_LOG)
+#undef ENABLE_PERF_LOG
+#endif
+
+
+//-----------------------------------------------------------------------------
+// PERFLOG is the public interface that should be used from EE source to log perf data.
+// If
+#if !defined (ENABLE_PERF_LOG)
+#define PERFLOG(x)
+#else
+#define PERFLOG(x) do {if (PerfLog::PerfLoggingEnabled()) PerfLog::Log x;} while (0)
+#endif
+
+//=============================================================================
+// ALL THE PERF LOG CODE IS COMPILED ONLY IF THE ENABLE_PERF_LOG WAS DEFINED.
+#if defined (ENABLE_PERF_LOG)
+//=============================================================================
+//-----------------------------------------------------------------------------
+// Static allocation of logging related memory, avoid dynamic allocation to
+// skew perf numbers.
+#define PRINT_STR_LEN 256 // Temp work space
+#define MAX_CHARS_UNIT 20
+#define MAX_CHARS_DIRECTION 6
+
+//-----------------------------------------------------------------------------
+// ENUM of units for all kinds of perf data the we might get. Grow this as needed.
+// **keep in sync *** with the array of strings defined in PerfLog.cpp
+typedef enum
+{
+ COUNT = 0,
+ SECONDS,
+ BYTES,
+ KBYTES,
+ KBYTES_PER_SEC,
+ CYCLES,
+ MAX_UNITS_OF_MEASURE
+} UnitOfMeasure;
+
+//-----------------------------------------------------------------------------
+// Widechar strings representing the above units. *** Keep in sync *** with the
+// array defined in PerfLog.cpp
+extern const wchar_t * const wszUnitOfMeasureDescr[MAX_UNITS_OF_MEASURE];
+
+//-----------------------------------------------------------------------------
+// Widechar strings representing the "direction" property of above units.
+// *** Keep in sync *** with the array defined in PerfLog.cpp
+// "Direction" property is false if an increase in the value of the counter indicates
+// a degrade.
+// "Direction" property is true if an increase in the value of the counter indicates
+// an improvement.
+extern const wchar_t * const wszIDirection[MAX_UNITS_OF_MEASURE];
+
+//-----------------------------------------------------------------------------
+// Namespace for perf log. Don't create perf log objects (private ctor).
+class PerfLog
+{
+public:
+
+ // Called during EEStartup
+ static void PerfLogInitialize();
+
+ // Called during EEShutdown
+ static void PerfLogDone();
+
+ // Perf logging is enabled if the env var PERF_LOG is set.
+ static int PerfLoggingEnabled () { LIMITED_METHOD_CONTRACT; return m_fLogPerfData; }
+
+ // Perf automation format is desired.
+ static bool PerfAutomationFormat () { LIMITED_METHOD_CONTRACT; return m_perfAutomationFormat; }
+
+ // CSV format is desired.
+ static bool CommaSeparatedFormat () { LIMITED_METHOD_CONTRACT; return m_commaSeparatedFormat; }
+
+ // Overloaded member functions to print different data types. Grow as needed.
+ // wszName is the name of thet perf counter, val is the perf counter value,
+ static void Log(__in_z wchar_t const *wszName, UINT val, UnitOfMeasure unit, __in_opt const wchar_t *wszDescr = 0);
+ static void Log(__in_z wchar_t const *wszName, UINT64 val, UnitOfMeasure unit, __in_opt const wchar_t *wszDescr = 0);
+ static void Log(__in_z wchar_t const *wszName, double val, UnitOfMeasure unit, __in_opt const wchar_t *wszDescr = 0);
+
+private:
+ PerfLog();
+ ~PerfLog();
+
+ // Helper routine to hide some details of the perf automation
+ static void OutToPerfFile(__in_z const wchar_t *wszName, UnitOfMeasure unit, __in_opt const wchar_t *wszDescr = 0);
+
+ // Helper routine to hide some details of output to stdout
+ static void OutToStdout(__in_z const wchar_t *wszName, UnitOfMeasure unit, __in_opt const wchar_t *wszDescr = 0);
+
+ // Perf log initialized ?
+ static bool m_perfLogInit;
+
+ // Output in perf automation format ?
+ static bool m_perfAutomationFormat;
+
+ // Output in csv format ?
+ static bool m_commaSeparatedFormat;
+
+ // Temp storage to convert wide char to multibyte for file IO.
+ static wchar_t m_wszOutStr_1[PRINT_STR_LEN];
+ static DWORD m_dwWriteByte;
+
+ // State of the env var PERF_OUTPUT
+ static int m_fLogPerfData;
+
+ // Open handle of the file which is used by the perf auotmation. (Currently
+ // its at C:\PerfData.data
+ static HANDLE m_hPerfLogFileHandle;
+};
+
+#endif // ENABLE_PERF_LOG
+
+#endif //_PERFLOG_H_
diff --git a/src/inc/pesectionman.h b/src/inc/pesectionman.h
new file mode 100644
index 0000000000..f031ca34bf
--- /dev/null
+++ b/src/inc/pesectionman.h
@@ -0,0 +1,213 @@
+// 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.
+// Section Manager for portable executables
+// Common to both Memory Only and Static (EXE making) code
+
+
+#ifndef PESectionMan_H
+#define PESectionMan_H
+
+#include "windef.h"
+
+#include "ceegen.h"
+#include "blobfetcher.h"
+
+class PESection;
+struct PESectionReloc;
+
+struct _IMAGE_SECTION_HEADER;
+
+class PESectionMan
+{
+public:
+
+ virtual ~PESectionMan() {}
+
+ HRESULT Init();
+ HRESULT Cleanup();
+
+ // Finds section with given name, or creates a new one
+ HRESULT getSectionCreate(
+ const char *name,
+ unsigned flags, // IMAGE_SCN_* flags. eg. IMAGE_SCN_CNT_INITIALIZED_DATA
+ PESection **section);
+
+ // Since we allocate, we must delete (Bug in VC, see knowledge base Q122675)
+ void sectionDestroy(PESection **section);
+
+ // Apply all the relocs for in memory conversion
+ HRESULT applyRelocs(CeeGenTokenMapper *pTokenMapper);
+
+ HRESULT cloneInstance(PESectionMan *destination);
+
+protected:
+
+ // Finds section with given name. returns 0 if not found
+ virtual PESection *getSection(const char *name);
+
+ // Create a new section
+ virtual HRESULT newSection(
+ const char *name,
+ PESection **section,
+ unsigned flags = sdNone,
+ unsigned estSize = 0x10000,
+ unsigned estRelocs = 1);
+
+ // Keep proctected & no accessors, so that derived class PEWriter
+ // is the ONLY one with access
+
+ PESection **sectStart;
+ PESection **sectCur;
+ PESection **sectEnd;
+}; // class PESectionMan
+
+/***************************************************************
+ * This represents a section of a ICeeFileGen. Multiple sections
+ * can be created with pointers to one another. These will
+ * automatically get fixed up when the ICeeFileGen is "baked".
+ *
+ * It is implemented using CBlobFetcher as a list of blobs.
+ * Thus it can grow arbitrarily. At the same time, it can appear
+ * as a flat consecutive piece of memory which can be indexed into
+ * using offsets.
+ */
+
+class PESection : public CeeSectionImpl {
+ public:
+ // bytes in this section at present
+ unsigned dataLen();
+
+ // Apply all the relocs for in memory conversion
+ HRESULT applyRelocs(CeeGenTokenMapper *pTokenMapper);
+
+ // get a block to write on (use instead of write to avoid copy)
+ char* getBlock(unsigned len, unsigned align=1);
+
+ // writes 'val' (which is offset into section 'relativeTo')
+ // and adds a relocation fixup for that section
+ void writeSectReloc(unsigned val, CeeSection& relativeTo,
+ CeeSectionRelocType reloc = srRelocHighLow,
+ CeeSectionRelocExtra *extra=0);
+
+ // Indicates that the DWORD at 'offset' in the current section should
+ // have the base of section 'relativeTo' added to it
+ HRESULT addSectReloc(unsigned offset, CeeSection& relativeTo,
+ CeeSectionRelocType reloc = srRelocHighLow,
+ CeeSectionRelocExtra *extra=0);
+
+ // If relativeTo is NULL, it is treated as a base reloc.
+ // ie. the value only needs to be fixed at load time if the module gets rebased.
+ HRESULT addSectReloc(unsigned offset, PESection *relativeTo,
+ CeeSectionRelocType reloc = srRelocHighLow,
+ CeeSectionRelocExtra *extra=0);
+
+ // Add a base reloc for the given offset in the current section
+ HRESULT addBaseReloc(unsigned offset, CeeSectionRelocType reloc = srRelocHighLow,
+ CeeSectionRelocExtra *extra = 0);
+
+ // section name
+ unsigned char *name() {
+ LIMITED_METHOD_CONTRACT;
+ return (unsigned char *) m_name;
+ }
+
+ // section flags
+ unsigned flags() {
+ LIMITED_METHOD_CONTRACT;
+ return m_flags;
+ }
+
+ // virtual base
+ unsigned getBaseRVA() {
+ LIMITED_METHOD_CONTRACT;
+ return m_baseRVA;
+ }
+
+ // return the dir entry for this section
+ int getDirEntry() {
+ LIMITED_METHOD_CONTRACT;
+ return dirEntry;
+ }
+ // this section will be directory entry 'num'
+ HRESULT directoryEntry(unsigned num);
+
+ // Indexes offset as if this were an array
+ // Returns a pointer into the correct blob
+ virtual char * computePointer(unsigned offset) const;
+
+ // Checks to see if pointer is in section
+ virtual BOOL containsPointer(__in char *ptr) const;
+
+ // Given a pointer pointing into this section,
+ // computes an offset as if this were an array
+ virtual unsigned computeOffset(__in char *ptr) const;
+
+ // Make 'destination' a copy of the current PESection
+ HRESULT cloneInstance(PESection *destination);
+
+ // Cause the section to allocate memory in smaller chunks
+ void SetInitialGrowth(unsigned growth);
+
+ virtual ~PESection();
+private:
+
+ // purposely not defined,
+ PESection();
+
+ // purposely not defined,
+ PESection(const PESection&);
+
+ // purposely not defined,
+ PESection& operator=(const PESection& x);
+
+ // this dir entry points to this section
+ int dirEntry;
+
+protected:
+ friend class PEWriter;
+ friend class PEWriterSection;
+ friend class PESectionMan;
+
+ PESection(const char* name, unsigned flags,
+ unsigned estSize, unsigned estRelocs);
+
+ // Blob fetcher handles getBlock() and fetching binary chunks.
+ CBlobFetcher m_blobFetcher;
+
+ PESectionReloc* m_relocStart;
+ PESectionReloc* m_relocCur;
+ PESectionReloc* m_relocEnd;
+
+ // These will be set while baking (finalizing) the file
+ unsigned m_baseRVA; // RVA into the file of this section.
+ unsigned m_filePos; // Start offset into the file (treated as a data image)
+ unsigned m_filePad; // Padding added to the end of the section for alignment
+
+ char m_name[8+6]; // extra room for digits
+ unsigned m_flags;
+
+ struct _IMAGE_SECTION_HEADER* m_header; // Corresponding header. Assigned after link()
+};
+
+/***************************************************************/
+/* implementation section */
+
+inline HRESULT PESection::directoryEntry(unsigned num) {
+ WRAPPER_NO_CONTRACT;
+ TESTANDRETURN(num < 16, E_INVALIDARG);
+ dirEntry = num;
+ return S_OK;
+}
+
+// This remembers the location where a reloc needs to be applied.
+// It is relative to the contents of a PESection
+
+struct PESectionReloc {
+ CeeSectionRelocType type; // type of reloc
+ unsigned offset; // offset within the current PESection where the reloc is to be applied
+ CeeSectionRelocExtra extra;
+ PESection* section; // target PESection. NULL implies that the target is a fixed address outside the module
+};
+
+#endif // #define PESectionMan_H
diff --git a/src/inc/posterror.h b/src/inc/posterror.h
new file mode 100644
index 0000000000..816d14e096
--- /dev/null
+++ b/src/inc/posterror.h
@@ -0,0 +1,50 @@
+// 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.
+//*****************************************************************************
+// UtilCode.h
+//
+// Utility functions implemented in UtilCode.lib.
+//
+
+//*****************************************************************************
+
+#ifndef __PostError_h__
+#define __PostError_h__
+
+#include "switches.h"
+
+//*****************************************************************************
+// This function will post an error for the client. If the LOWORD(hrRpt) can
+// be found as a valid error message, then it is loaded and formatted with
+// the arguments passed in. If it cannot be found, then the error is checked
+// against FormatMessage to see if it is a system error. System errors are
+// not formatted so no add'l parameters are required. If any errors in this
+// process occur, hrRpt is returned for the client with no error posted.
+//*****************************************************************************
+extern "C"
+HRESULT __cdecl PostError( // Returned error.
+ HRESULT hrRpt, // Reported error.
+ ...); // Error arguments.
+
+extern "C"
+HRESULT __cdecl PostErrorVA( // Returned error.
+ HRESULT hrRpt, // Reported error.
+ va_list marker); // Error arguments.
+
+//*****************************************************************************
+// This function formats an error message, but doesn't fill the IErrorInfo.
+//*****************************************************************************
+HRESULT __cdecl FormatRuntimeErrorVa(
+ __out_ecount(cchMsg) WCHAR *rcMsg, // Buffer into which to format.
+ ULONG cchMsg, // Size of buffer, characters.
+ HRESULT hrRpt, // The HR to report.
+ va_list marker); // Optional args.
+
+HRESULT __cdecl FormatRuntimeError(
+ __out_ecount(cchMsg) WCHAR *rcMsg, // Buffer into which to format.
+ ULONG cchMsg, // Size of buffer, characters.
+ HRESULT hrRpt, // The HR to report.
+ ...); // Optional args.
+
+#endif // __PostError_h__
diff --git a/src/inc/predeftlsslot.h b/src/inc/predeftlsslot.h
new file mode 100644
index 0000000000..fd56780b08
--- /dev/null
+++ b/src/inc/predeftlsslot.h
@@ -0,0 +1,84 @@
+// 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.
+
+
+
+#ifndef __PREDEFTLSSLOT_H__
+#define __PREDEFTLSSLOT_H__
+
+
+// And here are the predefined slots for accessing TLS from various DLLs of the CLR.
+// Note that we want to support combinations of Debug and Retail DLLs for testing
+// purposes, so we burn the slots into the retail EE even if a debug CLR dll needs
+// them.
+enum PredefinedTlsSlots
+{
+ TlsIdx_StrongName,
+ TlsIdx_JitPerf,
+ TlsIdx_JitX86Perf,
+ TlsIdx_JitLogEnv,
+ TlsIdx_IceCap,
+ TlsIdx_StressLog,
+ TlsIdx_StackProbe,
+ TlsIdx_Check,
+ TlsIdx_ForbidGCLoaderUseCount,
+ TlsIdx_ClrDebugState, // Pointer to ClrDebugState* structure
+ TlsIdx_StressThread,
+
+ // Add more indices here.
+ TlsIdx_ThreadType, // bit flags to indicate special thread's type
+ TlsIdx_CantStopCount, // Can't-stop counter for any thread
+ TlsIdx_OwnedCrstsChain, // slot to store the Crsts owned by this thread
+ TlsIdx_AppDomainAgilePendingTable,
+ TlsIdx_CantAllocCount, //Can't allocate memory on heap in this thread
+ TlsIdx_AssertDlgStatus, // Whether the thread is displaying an assert dialog
+
+ // A transient thread value that indicates this thread is currently walking its stack
+ // or the stack of another thread. This value is useful to help short-circuit
+ // some problematic checks in the loader, guarantee that types & assemblies
+ // encountered during the walk must already be loaded, and provide information to control
+ // assembly loading behavior during stack walks.
+ //
+ // This value is set around the main portions of the stack walk (as those portions may
+ // enter the type & assembly loaders). This is also explicitly cleared while the
+ // walking thread calls the stackwalker callback or needs to execute managed code, as
+ // such calls may execute arbitrary code unrelated to the actual stack walking, and
+ // may never return, in the case of exception stackwalk callbacks.
+ TlsIdx_StackWalkerWalkingThread, // Thread* that the stack walker is currently walking.
+
+ // Save the last exception info. Sometimes we need this info in our EX_CATCH, such as for SO.
+ // It will be better if VC can supply this in catch(...) block.
+ // !!! These data may become stale. Use it only inside exception handling code.
+ // !!! Please access these fields through GetCurrentExceptionPointers which validates the data to some level.
+ TlsIdx_EXCEPTION_CODE,
+ TlsIdx_PEXCEPTION_RECORD,
+ TlsIdx_PCONTEXT,
+
+ TlsIdx_SOIntolerantTransitionHandler, // The thread is entering SO intolerant code. This one is used by
+ // Thread::IsSOIntolerant to decide the SO mode of the thread.
+ MAX_PREDEFINED_TLS_SLOT
+};
+
+enum TlsThreadTypeFlag // flag used for thread type in Tls data
+{
+ ThreadType_GC = 0x00000001,
+ ThreadType_Timer = 0x00000002,
+ ThreadType_Gate = 0x00000004,
+ ThreadType_DbgHelper = 0x00000008,
+ ThreadType_Shutdown = 0x00000010,
+ ThreadType_DynamicSuspendEE = 0x00000020,
+ ThreadType_Finalizer = 0x00000040,
+ ThreadType_ADUnloadHelper = 0x00000200,
+ ThreadType_ShutdownHelper = 0x00000400,
+ ThreadType_Threadpool_IOCompletion = 0x00000800,
+ ThreadType_Threadpool_Worker = 0x00001000,
+ ThreadType_Wait = 0x00002000,
+ ThreadType_ProfAPI_Attach = 0x00004000,
+ ThreadType_ProfAPI_Detach = 0x00008000,
+ ThreadType_ETWRundownThread = 0x00010000,
+ ThreadType_GenericInstantiationCompare= 0x00020000, // Used to indicate that the thread is determining if a generic instantiation in an ngen image matches a lookup.
+};
+
+#endif
+
diff --git a/src/inc/prettyprintsig.h b/src/inc/prettyprintsig.h
new file mode 100644
index 0000000000..adab46ee0f
--- /dev/null
+++ b/src/inc/prettyprintsig.h
@@ -0,0 +1,91 @@
+// 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.
+
+//*****************************************************************************
+// This code supports formatting a method and it's signature in a friendly
+// and consistent format.
+//
+//*****************************************************************************
+
+#ifndef __PrettyPrintSig_h__
+#define __PrettyPrintSig_h__
+
+#include <cor.h>
+
+class CQuickBytes;
+
+//
+// The return value is either NULL or a null-terminated ASCII string
+//
+
+//---------------------------------------------------------------------------------------
+//
+// Prints a signature in a human readable format.
+// No one should use this function. This exists strictly for backwards compatibility with external formats.
+//
+// Arguments:
+// sigPtr - Method/field sig to convert
+// sigLen - length of sig
+// name - the name of the method for this sig. Can be L""
+// scratch - scratch buffer to use
+// pIMDI - Import api to use.
+//
+// Return Value:
+// The formatted string.
+//
+// Assumptions:
+// None
+//
+// Notes:
+// Dev's SHOULD NOT create new callers to this function. Use
+// code:PrettyPrintSig in formatype.h instead. This function exists for
+// legacy support in the CLR. There are places that depend on the format
+// of this string.
+//
+
+LPCWSTR PrettyPrintSigLegacy(
+ PCCOR_SIGNATURE sigPtr, // Method/field sig to convert
+ unsigned sigLen, // length of sig
+ LPCWSTR name, // the name of the method for this sig. Can be L""
+ CQuickBytes *scratch, // scratch buffer to use
+ IMetaDataImport *pIMDI); // Import api to use.
+
+struct IMDInternalImport;
+
+//---------------------------------------------------------------------------------------
+//
+// Prints a signature in a human readable format.
+// No one should use this function. This exists strictly for backwards compatibility with external formats.
+//
+// Arguments:
+// sigPtr - Method/field sig to convert
+// sigLen - length of sig
+// name - the name of the method for this sig. Can be L""
+// out - The buffer in which to write the pretty printed string.
+// pIMDI - Import api to use.
+//
+// Return Value:
+// An HRESULT and the formatted string is in out as a unicode string.
+//
+// Assumptions:
+// None
+//
+// Notes:
+// Dev's SHOULD NOT create new callers to this function. Use
+// code:PrettyPrintSig in formattype.h instead. This function exists for
+// legacy support in the CLR. There are places that depend on the format
+// of this string.
+//
+HRESULT PrettyPrintSigInternalLegacy( // S_OK or error.
+ PCCOR_SIGNATURE sigPtr, // sig to convert,
+ unsigned sigLen, // length of sig
+ LPCSTR name, // can be "", the name of the method for this sig
+ CQuickBytes *out, // where to put the pretty printed string
+ IMDInternalImport *pIMDI); // Import api to use.
+
+//
+// On success, the null-terminated ASCII string is in "out.Ptr()"
+//
+
+#endif // __PrettyPrintSig_h__
diff --git a/src/inc/profilepriv.h b/src/inc/profilepriv.h
new file mode 100644
index 0000000000..f74818c731
--- /dev/null
+++ b/src/inc/profilepriv.h
@@ -0,0 +1,156 @@
+// 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.
+//
+// ProfilePriv.h
+//
+
+//
+// Structures, etc. used by the Profiling API and throughout the EE
+//
+
+// ======================================================================================
+
+#ifndef _ProfilePriv_h_
+#define _ProfilePriv_h_
+
+
+// Forward declarations
+class EEToProfInterfaceImpl;
+class Object;
+struct ScanContext;
+
+#if defined (PROFILING_SUPPORTED_DATA) || defined(PROFILING_SUPPORTED)
+#ifndef PROFILING_SUPPORTED_DATA
+#define PROFILING_SUPPORTED_DATA 1
+#endif // PROFILING_SUPPORTED_DATA
+
+#include "corprof.h"
+
+//---------------------------------------------------------------------------------------
+// Enumerates the various init states of profiling.
+//
+// *** NOTE: The order is important here, as some of the status checks (e.g.,
+// CORProfilerPresentOrInitializing) use ">" with these enum values. ***
+
+enum ProfilerStatus
+{
+ kProfStatusNone = 0, // No profiler running.
+ kProfStatusDetaching = 1, // Prof was running, is now detaching, but still loaded
+ kProfStatusInitializingForStartupLoad = 2, // Prof ready for (or in) its Initialize callback
+ kProfStatusInitializingForAttachLoad = 3, // Prof ready for (or in) its InitializeForAttach callback
+ kProfStatusActive = 4, // Prof completed initialization and is actively running
+};
+
+class CurrentProfilerStatus
+{
+private:
+ // Why volatile?
+ // See code:ProfilingAPIUtility::InitializeProfiling#LoadUnloadCallbackSynchronization
+ Volatile<ProfilerStatus> m_profStatus;
+
+public:
+ void Init();
+ ProfilerStatus Get();
+ void Set(ProfilerStatus profStatus);
+};
+
+// ---------------------------------------------------------------------------------------
+// Global struct that lets the EE see the load status of the profiler, and provides a
+// pointer (pProfInterface) through which profiler calls can be made
+//
+// When you are adding new session, please refer to
+// code:ProfControlBlock::ResetPerSessionStatus#ProfileResetSessionStatus for more details.
+struct ProfControlBlock
+{
+ // **** IMPORTANT!! ****
+ // All uses of pProfInterface must be properly synchronized to avoid the profiler
+ // from detaching while the EE attempts to call into it. The recommended way to do
+ // this is to use the (lockless) BEGIN_PIN_PROFILER / END_PIN_PROFILER macros. See
+ // code:BEGIN_PIN_PROFILER for instructions. For full details on how the
+ // synchronization works, see
+ // code:ProfilingAPIUtility::InitializeProfiling#LoadUnloadCallbackSynchronization
+ VolatilePtr<EEToProfInterfaceImpl> pProfInterface;
+ // **** IMPORTANT!! ****
+
+ DWORD dwEventMask; // Original low event mask bits
+ DWORD dwEventMaskHigh; // New high event mask bits
+ CurrentProfilerStatus curProfStatus;
+ BOOL fGCInProgress;
+ BOOL fBaseSystemClassesLoaded;
+
+#ifdef PROF_TEST_ONLY_FORCE_ELT_DATA
+ // #TestOnlyELT This implements a test-only (and debug-only) hook that allows a test
+ // profiler to ensure enter/leave/tailcall is enabled on startup even though no
+ // profiler is loaded on startup. This allows an attach profiler to use ELT to build
+ // shadow stacks for the sole purpose of verifying OTHER areas of the profiling API
+ // (e.g., stack walking). When this BOOL is TRUE, the JIT will insert calls to the
+ // slow-path profiling API enter/leave/tailcall hooks, which will forward the call to
+ // a profiler if one is loaded (and do nothing otherwise).
+ //
+ // See code:AreCallbackStateFlagsSet#P2CLRRestrictionsOverview for general information
+ // on how the test hooks lift restrictions normally in place for the Info functions.
+ BOOL fTestOnlyForceEnterLeave;
+#endif
+
+#ifdef PROF_TEST_ONLY_FORCE_OBJECT_ALLOCATED_DATA
+ // #TestOnlyObjectAllocated This implements a test-only (and debug-only) hook that allows
+ // a test profiler to ensure ObjectAllocated callback is enabled on startup even though no
+ // profiler is loaded on startup. This allows an attach profiler to use ObjectAllocated
+ // callback for the sole purpose of verifying OTHER GC areas of the profiling API
+ // (e.g., constructing a object graph). When this BOOL is TRUE, the JIT will use special
+ // version of new allocators that issue object allocation notifications, which will forward
+ // the notifications to a profiler if one is loaded (and do nothing otherwise).
+ //
+ // See code:AreCallbackStateFlagsSet#P2CLRRestrictionsOverview for general information
+ // on how the test hooks lift restrictions normally in place for the Info functions.
+ BOOL fTestOnlyForceObjectAllocated;
+#endif
+
+#ifdef _DEBUG
+ // Test-only, debug-only code to allow attaching profilers to call ICorProfilerInfo inteface,
+ // which would otherwise be disallowed for attaching profilers
+ BOOL fTestOnlyEnableICorProfilerInfo;
+#endif // _DEBUG
+
+ // Whether we've turned off concurrent GC during attach
+ BOOL fConcurrentGCDisabledForAttach;
+
+ void Init();
+ void ResetPerSessionStatus();
+};
+
+
+GVAL_DECL(ProfControlBlock, g_profControlBlock);
+
+// Provides definitions of the CORProfilerTrack* functions that test whether a profiler
+// is active and responding to various callbacks
+#include "profilepriv.inl"
+
+//---------------------------------------------------------------
+// Bit flags used to track profiler callback execution state, such as which
+// ICorProfilerCallback method we're currently executing. These help us enforce the
+// invariants of which calls a profiler is allowed to make at given times. These flags
+// are stored in Thread::m_profilerCallbackState.
+//
+// For now, we ensure:
+// * Only asynchronous-safe calls are made asynchronously (i.e., are made from
+// outside of profiler callbacks).
+// * GC_TRIGGERS info methods are not called from GC_NOTRIGGER callbacks
+//
+// Later, we may choose to enforce even more refined call trees and add more flags.
+#define COR_PRF_CALLBACKSTATE_INCALLBACK 0x1
+#define COR_PRF_CALLBACKSTATE_IN_TRIGGERS_SCOPE 0x2
+#define COR_PRF_CALLBACKSTATE_FORCEGC_WAS_CALLED 0x4
+//
+//---------------------------------------------------------------
+
+#endif // defined(PROFILING_SUPPORTED_DATA) || defined(PROFILING_SUPPORTED)
+
+// This is the helper callback that the gc uses when walking the heap.
+BOOL HeapWalkHelper(Object* pBO, void* pv);
+void ScanRootsHelper(Object* pObj, Object** ppRoot, ScanContext *pSC, uint32_t dwUnused);
+BOOL AllocByClassHelper(Object* pBO, void* pv);
+
+#endif // _ProfilePriv_h_
+
diff --git a/src/inc/profilepriv.inl b/src/inc/profilepriv.inl
new file mode 100644
index 0000000000..e7c82074be
--- /dev/null
+++ b/src/inc/profilepriv.inl
@@ -0,0 +1,826 @@
+// 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.
+//
+// ProfilePriv.inl
+//
+
+//
+// Inlined functions used by the Profiling API and throughout the EE. Most notably are
+// the CORProfilerTrack* functions that test whether a profiler is active and responding
+// to various callbacks
+//
+
+// ======================================================================================
+#ifndef _ProfilePriv_inl_
+#define _ProfilePriv_inl_
+
+#include "eetoprofinterfaceimpl.h"
+#ifdef PROFILING_SUPPORTED
+#include "profilinghelper.h"
+BOOL CORProfilerBypassSecurityChecks();
+#endif // PROFILING_SUPPORTED
+
+//---------------------------------------------------------------------------------------
+// CurrentProfilerStatus
+//---------------------------------------------------------------------------------------
+
+inline void CurrentProfilerStatus::Init()
+{
+ LIMITED_METHOD_CONTRACT;
+ m_profStatus = kProfStatusNone;
+}
+
+inline ProfilerStatus CurrentProfilerStatus::Get()
+{
+ LIMITED_METHOD_DAC_CONTRACT;
+ return m_profStatus;
+}
+
+//---------------------------------------------------------------------------------------
+// ProfControlBlock
+//---------------------------------------------------------------------------------------
+
+inline void ProfControlBlock::Init()
+{
+ CONTRACTL
+ {
+ NOTHROW;
+ GC_NOTRIGGER;
+ CANNOT_TAKE_LOCK;
+ }
+ CONTRACTL_END;
+
+ curProfStatus.Init();
+
+ fGCInProgress = FALSE;
+ fBaseSystemClassesLoaded = FALSE;
+#ifdef PROF_TEST_ONLY_FORCE_ELT
+ fTestOnlyForceEnterLeave = FALSE;
+#endif
+
+#ifdef PROF_TEST_ONLY_FORCE_OBJECT_ALLOCATED
+ fTestOnlyForceObjectAllocated = FALSE;
+#endif
+
+#ifdef _DEBUG
+ fTestOnlyEnableICorProfilerInfo = FALSE;
+#endif // _DEBUG
+
+ fConcurrentGCDisabledForAttach = FALSE;
+
+ ResetPerSessionStatus();
+}
+
+// Reset those variables that is only for the current attach session
+inline void ProfControlBlock::ResetPerSessionStatus()
+{
+ LIMITED_METHOD_CONTRACT;
+
+ pProfInterface = NULL;
+ dwEventMask = COR_PRF_MONITOR_NONE;
+ dwEventMaskHigh = COR_PRF_HIGH_MONITOR_NONE;
+}
+
+//---------------------------------------------------------------------------------------
+// Inlined helpers used throughout the runtime to check for the profiler's load status
+// and what features it enabled callbacks for.
+//---------------------------------------------------------------------------------------
+
+
+// CORProfilerPresent() returns whether or not a CLR Profiler is actively loaded
+// (meaning it's initialized and ready to receive callbacks).
+inline BOOL CORProfilerPresent()
+{
+ LIMITED_METHOD_DAC_CONTRACT;
+
+ return ((&g_profControlBlock)->curProfStatus.Get() == kProfStatusActive);
+}
+
+// These return whether a CLR Profiler is actively loaded AND has requested the
+// specified callback or functionality
+
+inline BOOL CORProfilerFunctionIDMapperEnabled()
+{
+ CONTRACTL
+ {
+ NOTHROW;
+ GC_NOTRIGGER;
+ CANNOT_TAKE_LOCK;
+ SO_NOT_MAINLINE;
+ }
+ CONTRACTL_END;
+
+ return (CORProfilerPresent() &&
+ (
+ ((&g_profControlBlock)->pProfInterface->GetFunctionIDMapper() != NULL) ||
+ ((&g_profControlBlock)->pProfInterface->GetFunctionIDMapper2() != NULL)
+ ));
+}
+
+inline BOOL CORProfilerTrackJITInfo()
+{
+ CONTRACTL
+ {
+ NOTHROW;
+ GC_NOTRIGGER;
+ CANNOT_TAKE_LOCK;
+ SO_NOT_MAINLINE;
+ }
+ CONTRACTL_END;
+
+ return (CORProfilerPresent() &&
+ ((&g_profControlBlock)->dwEventMask & COR_PRF_MONITOR_JIT_COMPILATION));
+}
+
+inline BOOL CORProfilerTrackCacheSearches()
+{
+ CONTRACTL
+ {
+ NOTHROW;
+ GC_NOTRIGGER;
+ CANNOT_TAKE_LOCK;
+ SO_NOT_MAINLINE;
+ }
+ CONTRACTL_END;
+
+ return (CORProfilerPresent() &&
+ ((&g_profControlBlock)->dwEventMask & COR_PRF_MONITOR_CACHE_SEARCHES));
+}
+
+inline BOOL CORProfilerTrackModuleLoads()
+{
+ CONTRACTL
+ {
+ NOTHROW;
+ GC_NOTRIGGER;
+ CANNOT_TAKE_LOCK;
+ SO_NOT_MAINLINE;
+ }
+ CONTRACTL_END;
+
+ return (CORProfilerPresent() &&
+ ((&g_profControlBlock)->dwEventMask & COR_PRF_MONITOR_MODULE_LOADS));
+}
+
+inline BOOL CORProfilerTrackAssemblyLoads()
+{
+ CONTRACTL
+ {
+ NOTHROW;
+ GC_NOTRIGGER;
+ CANNOT_TAKE_LOCK;
+ SO_NOT_MAINLINE;
+ }
+ CONTRACTL_END;
+
+ return (CORProfilerPresent() &&
+ ((&g_profControlBlock)->dwEventMask & COR_PRF_MONITOR_ASSEMBLY_LOADS));
+}
+
+inline BOOL CORProfilerTrackAppDomainLoads()
+{
+ CONTRACTL
+ {
+ NOTHROW;
+ GC_NOTRIGGER;
+ CANNOT_TAKE_LOCK;
+ SO_NOT_MAINLINE;
+ }
+ CONTRACTL_END;
+
+ return (CORProfilerPresent() &&
+ ((&g_profControlBlock)->dwEventMask & COR_PRF_MONITOR_APPDOMAIN_LOADS));
+}
+
+inline BOOL CORProfilerTrackThreads()
+{
+ CONTRACTL
+ {
+ NOTHROW;
+ GC_NOTRIGGER;
+ CANNOT_TAKE_LOCK;
+ SO_NOT_MAINLINE;
+ }
+ CONTRACTL_END;
+
+ return (CORProfilerPresent() &&
+ ((&g_profControlBlock)->dwEventMask & COR_PRF_MONITOR_THREADS));
+}
+
+inline BOOL CORProfilerTrackClasses()
+{
+ CONTRACTL
+ {
+ NOTHROW;
+ GC_NOTRIGGER;
+ CANNOT_TAKE_LOCK;
+ SO_NOT_MAINLINE;
+ }
+ CONTRACTL_END;
+
+ return (CORProfilerPresent() &&
+ ((&g_profControlBlock)->dwEventMask & COR_PRF_MONITOR_CLASS_LOADS));
+}
+
+inline BOOL CORProfilerTrackGC()
+{
+ CONTRACTL
+ {
+ NOTHROW;
+ GC_NOTRIGGER;
+ CANNOT_TAKE_LOCK;
+ SO_NOT_MAINLINE;
+ }
+ CONTRACTL_END;
+
+ return (CORProfilerPresent() &&
+ ((&g_profControlBlock)->dwEventMask & COR_PRF_MONITOR_GC));
+}
+
+inline BOOL CORProfilerTrackAllocationsEnabled()
+{
+ CONTRACTL
+ {
+ NOTHROW;
+ GC_NOTRIGGER;
+ CANNOT_TAKE_LOCK;
+ SO_NOT_MAINLINE;
+ }
+ CONTRACTL_END;
+
+ return
+ (
+#ifdef PROF_TEST_ONLY_FORCE_OBJECT_ALLOCATED
+ (&g_profControlBlock)->fTestOnlyForceObjectAllocated ||
+#endif
+ (CORProfilerPresent() &&
+ ((&g_profControlBlock)->dwEventMask & COR_PRF_ENABLE_OBJECT_ALLOCATED))
+ );
+}
+
+inline BOOL CORProfilerTrackAllocations()
+{
+ CONTRACTL
+ {
+ NOTHROW;
+ GC_NOTRIGGER;
+ CANNOT_TAKE_LOCK;
+ SO_NOT_MAINLINE;
+ }
+ CONTRACTL_END;
+
+ return
+ (CORProfilerTrackAllocationsEnabled() &&
+ ((&g_profControlBlock)->dwEventMask & COR_PRF_MONITOR_OBJECT_ALLOCATED));
+}
+
+inline BOOL CORProfilerEnableRejit()
+{
+ CONTRACTL
+ {
+ NOTHROW;
+ GC_NOTRIGGER;
+ CANNOT_TAKE_LOCK;
+ SO_NOT_MAINLINE;
+ }
+ CONTRACTL_END;
+
+ return (CORProfilerPresent() &&
+ ((&g_profControlBlock)->dwEventMask & COR_PRF_ENABLE_REJIT));
+}
+
+inline BOOL CORProfilerTrackExceptions()
+{
+ CONTRACTL
+ {
+ NOTHROW;
+ GC_NOTRIGGER;
+ CANNOT_TAKE_LOCK;
+ SO_NOT_MAINLINE;
+ }
+ CONTRACTL_END;
+
+ return (CORProfilerPresent() &&
+ ((&g_profControlBlock)->dwEventMask & COR_PRF_MONITOR_EXCEPTIONS));
+}
+
+inline BOOL CORProfilerTrackCLRExceptions()
+{
+ CONTRACTL
+ {
+ NOTHROW;
+ GC_NOTRIGGER;
+ CANNOT_TAKE_LOCK;
+ SO_NOT_MAINLINE;
+ }
+ CONTRACTL_END;
+
+ return (CORProfilerPresent() &&
+ ((&g_profControlBlock)->dwEventMask & COR_PRF_MONITOR_CLR_EXCEPTIONS));
+}
+
+inline BOOL CORProfilerTrackTransitions()
+{
+ CONTRACTL
+ {
+ NOTHROW;
+ GC_NOTRIGGER;
+ CANNOT_TAKE_LOCK;
+ SO_NOT_MAINLINE;
+ }
+ CONTRACTL_END;
+
+ return (CORProfilerPresent() &&
+ ((&g_profControlBlock)->dwEventMask & COR_PRF_MONITOR_CODE_TRANSITIONS));
+}
+
+inline BOOL CORProfilerTrackEnterLeave()
+{
+ CONTRACTL
+ {
+ NOTHROW;
+ GC_NOTRIGGER;
+ CANNOT_TAKE_LOCK;
+ SO_NOT_MAINLINE;
+ }
+ CONTRACTL_END;
+
+#ifdef PROF_TEST_ONLY_FORCE_ELT
+ if ((&g_profControlBlock)->fTestOnlyForceEnterLeave)
+ return TRUE;
+#endif // PROF_TEST_ONLY_FORCE_ELT
+
+ return (CORProfilerPresent() &&
+ ((&g_profControlBlock)->dwEventMask & COR_PRF_MONITOR_ENTERLEAVE));
+}
+
+inline BOOL CORProfilerTrackCCW()
+{
+ CONTRACTL
+ {
+ NOTHROW;
+ GC_NOTRIGGER;
+ CANNOT_TAKE_LOCK;
+ SO_NOT_MAINLINE;
+ }
+ CONTRACTL_END;
+
+ return (CORProfilerPresent() &&
+ ((&g_profControlBlock)->dwEventMask & COR_PRF_MONITOR_CCW));
+}
+
+inline BOOL CORProfilerTrackRemoting()
+{
+ CONTRACTL
+ {
+ NOTHROW;
+ GC_NOTRIGGER;
+ CANNOT_TAKE_LOCK;
+ SO_NOT_MAINLINE;
+ }
+ CONTRACTL_END;
+
+ return (CORProfilerPresent() &&
+ ((&g_profControlBlock)->dwEventMask & COR_PRF_MONITOR_REMOTING));
+}
+
+inline BOOL CORProfilerTrackRemotingCookie()
+{
+ CONTRACTL
+ {
+ NOTHROW;
+ GC_NOTRIGGER;
+ CANNOT_TAKE_LOCK;
+ SO_NOT_MAINLINE;
+ }
+ CONTRACTL_END;
+
+ return
+ (CORProfilerPresent() &&
+ (((&g_profControlBlock)->dwEventMask & COR_PRF_MONITOR_REMOTING_COOKIE)
+ == COR_PRF_MONITOR_REMOTING_COOKIE));
+}
+
+inline BOOL CORProfilerTrackRemotingAsync()
+{
+ CONTRACTL
+ {
+ NOTHROW;
+ GC_NOTRIGGER;
+ CANNOT_TAKE_LOCK;
+ SO_NOT_MAINLINE;
+ }
+ CONTRACTL_END;
+
+ return
+ (CORProfilerPresent() &&
+ (((&g_profControlBlock)->dwEventMask & COR_PRF_MONITOR_REMOTING_ASYNC)
+ == COR_PRF_MONITOR_REMOTING_ASYNC));
+}
+
+inline BOOL CORProfilerTrackSuspends()
+{
+ CONTRACTL
+ {
+ NOTHROW;
+ GC_NOTRIGGER;
+ CANNOT_TAKE_LOCK;
+ SO_NOT_MAINLINE;
+ }
+ CONTRACTL_END;
+
+ return (CORProfilerPresent() &&
+ ((&g_profControlBlock)->dwEventMask & COR_PRF_MONITOR_SUSPENDS));
+}
+
+inline BOOL CORProfilerDisableInlining()
+{
+ CONTRACTL
+ {
+ NOTHROW;
+ GC_NOTRIGGER;
+ CANNOT_TAKE_LOCK;
+ SO_NOT_MAINLINE;
+ }
+ CONTRACTL_END;
+
+ return (CORProfilerPresent() &&
+ ((&g_profControlBlock)->dwEventMask & COR_PRF_DISABLE_INLINING));
+}
+
+inline BOOL CORProfilerJITMapEnabled()
+{
+ CONTRACTL
+ {
+ NOTHROW;
+ GC_NOTRIGGER;
+ CANNOT_TAKE_LOCK;
+ SO_NOT_MAINLINE;
+ }
+ CONTRACTL_END;
+
+ return (CORProfilerPresent() &&
+ ((&g_profControlBlock)->dwEventMask & COR_PRF_ENABLE_JIT_MAPS));
+}
+
+inline BOOL CORProfilerDisableOptimizations()
+{
+ CONTRACTL
+ {
+ NOTHROW;
+ GC_NOTRIGGER;
+ CANNOT_TAKE_LOCK;
+ SO_NOT_MAINLINE;
+ SUPPORTS_DAC;
+ }
+ CONTRACTL_END;
+
+ return (CORProfilerPresent() &&
+ ((&g_profControlBlock)->dwEventMask & COR_PRF_DISABLE_OPTIMIZATIONS));
+}
+
+inline BOOL CORProfilerUseProfileImages()
+{
+ CONTRACTL
+ {
+ NOTHROW;
+ GC_NOTRIGGER;
+ CANNOT_TAKE_LOCK;
+ SO_NOT_MAINLINE;
+ }
+ CONTRACTL_END;
+
+#ifdef PROF_TEST_ONLY_FORCE_ELT
+ if ((&g_profControlBlock)->fTestOnlyForceEnterLeave)
+ return TRUE;
+#endif // PROF_TEST_ONLY_FORCE_ELT
+
+ if (!CORProfilerPresent())
+ return FALSE;
+
+ if (((&g_profControlBlock)->dwEventMask &
+ COR_PRF_REQUIRE_PROFILE_IMAGE) == 0)
+ return FALSE;
+
+ return TRUE;
+}
+
+inline BOOL CORProfilerDisableAllNGenImages()
+{
+ LIMITED_METHOD_DAC_CONTRACT;
+
+ return (CORProfilerPresent() &&
+ ((&g_profControlBlock)->dwEventMask & COR_PRF_DISABLE_ALL_NGEN_IMAGES));
+}
+
+inline BOOL CORProfilerTrackConditionalWeakTableElements()
+{
+ LIMITED_METHOD_DAC_CONTRACT;
+
+ return CORProfilerTrackGC() && (&g_profControlBlock)->pProfInterface->IsCallback5Supported();
+}
+
+// CORProfilerPresentOrInitializing() returns nonzero iff a CLR Profiler is actively
+// loaded and ready to receive callbacks OR a CLR Profiler has loaded just enough that it
+// is ready to receive (or is currently executing inside) its Initialize() callback.
+// Typically, you'll want to use code:CORProfilerPresent instead of this. But there is
+// some internal profiling API code that wants to test for event flags for a profiler
+// that may still be initializing, and this function is appropriate for that code.
+inline BOOL CORProfilerPresentOrInitializing()
+{
+ LIMITED_METHOD_DAC_CONTRACT;
+ return ((&g_profControlBlock)->curProfStatus.Get() > kProfStatusDetaching);
+}
+
+// These return whether a CLR Profiler has requested the specified functionality.
+//
+// Note that, unlike the above functions, a profiler that's not done loading (and is
+// still somewhere in the initialization phase) still counts. This is only safe because
+// these functions are not used to determine whether to issue a callback. These functions
+// are used primarily during the initialization path to choose between slow / fast-path
+// ELT hooks (and later on as part of asserts).
+
+inline BOOL CORProfilerELT3SlowPathEnabled()
+{
+ CONTRACTL
+ {
+ NOTHROW;
+ GC_NOTRIGGER;
+ CANNOT_TAKE_LOCK;
+ SO_NOT_MAINLINE;
+ }
+ CONTRACTL_END;
+
+ return (CORProfilerPresentOrInitializing() &&
+ ((&g_profControlBlock)->dwEventMask & (COR_PRF_ENABLE_FUNCTION_ARGS | COR_PRF_ENABLE_FUNCTION_RETVAL | COR_PRF_ENABLE_FRAME_INFO)));
+}
+
+inline BOOL CORProfilerELT3SlowPathEnterEnabled()
+{
+ CONTRACTL
+ {
+ NOTHROW;
+ GC_NOTRIGGER;
+ CANNOT_TAKE_LOCK;
+ SO_NOT_MAINLINE;
+ }
+ CONTRACTL_END;
+
+ return (CORProfilerPresentOrInitializing() &&
+ ((&g_profControlBlock)->dwEventMask & (COR_PRF_ENABLE_FUNCTION_ARGS | COR_PRF_ENABLE_FRAME_INFO)));
+}
+
+inline BOOL CORProfilerELT3SlowPathLeaveEnabled()
+{
+ CONTRACTL
+ {
+ NOTHROW;
+ GC_NOTRIGGER;
+ CANNOT_TAKE_LOCK;
+ SO_NOT_MAINLINE;
+ }
+ CONTRACTL_END;
+
+ return (CORProfilerPresentOrInitializing() &&
+ ((&g_profControlBlock)->dwEventMask & (COR_PRF_ENABLE_FUNCTION_RETVAL | COR_PRF_ENABLE_FRAME_INFO)));
+}
+
+inline BOOL CORProfilerELT3SlowPathTailcallEnabled()
+{
+ CONTRACTL
+ {
+ NOTHROW;
+ GC_NOTRIGGER;
+ CANNOT_TAKE_LOCK;
+ SO_NOT_MAINLINE;
+ }
+ CONTRACTL_END;
+
+ return (CORProfilerPresentOrInitializing() &&
+ ((&g_profControlBlock)->dwEventMask & (COR_PRF_ENABLE_FRAME_INFO)));
+}
+
+inline BOOL CORProfilerELT2FastPathEnterEnabled()
+{
+ CONTRACTL
+ {
+ NOTHROW;
+ GC_NOTRIGGER;
+ CANNOT_TAKE_LOCK;
+ SO_NOT_MAINLINE;
+ }
+ CONTRACTL_END;
+
+ return (CORProfilerPresentOrInitializing() &&
+ (!((&g_profControlBlock)->dwEventMask & (COR_PRF_ENABLE_STACK_SNAPSHOT | COR_PRF_ENABLE_FUNCTION_ARGS | COR_PRF_ENABLE_FRAME_INFO))));
+}
+
+inline BOOL CORProfilerELT2FastPathLeaveEnabled()
+{
+ CONTRACTL
+ {
+ NOTHROW;
+ GC_NOTRIGGER;
+ CANNOT_TAKE_LOCK;
+ SO_NOT_MAINLINE;
+ }
+ CONTRACTL_END;
+
+ return (CORProfilerPresentOrInitializing() &&
+ (!((&g_profControlBlock)->dwEventMask & (COR_PRF_ENABLE_STACK_SNAPSHOT | COR_PRF_ENABLE_FUNCTION_RETVAL | COR_PRF_ENABLE_FRAME_INFO))));
+}
+
+inline BOOL CORProfilerELT2FastPathTailcallEnabled()
+{
+ CONTRACTL
+ {
+ NOTHROW;
+ GC_NOTRIGGER;
+ CANNOT_TAKE_LOCK;
+ SO_NOT_MAINLINE;
+ }
+ CONTRACTL_END;
+
+ return (CORProfilerPresentOrInitializing() &&
+ (!((&g_profControlBlock)->dwEventMask & (COR_PRF_ENABLE_STACK_SNAPSHOT | COR_PRF_ENABLE_FRAME_INFO))));
+}
+
+inline BOOL CORProfilerFunctionArgsEnabled()
+{
+ CONTRACTL
+ {
+ NOTHROW;
+ GC_NOTRIGGER;
+ CANNOT_TAKE_LOCK;
+ SO_NOT_MAINLINE;
+ }
+ CONTRACTL_END;
+
+ return (CORProfilerPresentOrInitializing() &&
+ ((&g_profControlBlock)->dwEventMask & COR_PRF_ENABLE_FUNCTION_ARGS));
+}
+
+inline BOOL CORProfilerFunctionReturnValueEnabled()
+{
+ CONTRACTL
+ {
+ NOTHROW;
+ GC_NOTRIGGER;
+ CANNOT_TAKE_LOCK;
+ SO_NOT_MAINLINE;
+ }
+ CONTRACTL_END;
+
+ return (CORProfilerPresentOrInitializing() &&
+ ((&g_profControlBlock)->dwEventMask & COR_PRF_ENABLE_FUNCTION_RETVAL));
+}
+
+inline BOOL CORProfilerFrameInfoEnabled()
+{
+ CONTRACTL
+ {
+ NOTHROW;
+ GC_NOTRIGGER;
+ CANNOT_TAKE_LOCK;
+ SO_NOT_MAINLINE;
+ }
+ CONTRACTL_END;
+
+ return (CORProfilerPresentOrInitializing() &&
+ ((&g_profControlBlock)->dwEventMask & COR_PRF_ENABLE_FRAME_INFO));
+}
+
+inline BOOL CORProfilerStackSnapshotEnabled()
+{
+ CONTRACTL
+ {
+ NOTHROW;
+ GC_NOTRIGGER;
+ CANNOT_TAKE_LOCK;
+ SO_NOT_MAINLINE;
+ }
+ CONTRACTL_END;
+
+ return (CORProfilerPresentOrInitializing() &&
+ ((&g_profControlBlock)->dwEventMask & COR_PRF_ENABLE_STACK_SNAPSHOT));
+}
+
+inline BOOL CORProfilerAddsAssemblyReferences()
+{
+ CONTRACTL
+ {
+ NOTHROW;
+ GC_NOTRIGGER;
+ CANNOT_TAKE_LOCK;
+ SO_NOT_MAINLINE;
+ }
+ CONTRACTL_END;
+
+ return (CORProfilerPresent() &&
+ ((&g_profControlBlock)->dwEventMaskHigh & COR_PRF_HIGH_ADD_ASSEMBLY_REFERENCES));
+}
+
+inline BOOL CORProfilerInMemorySymbolsUpdatesEnabled()
+{
+ CONTRACTL
+ {
+ NOTHROW;
+ GC_NOTRIGGER;
+ CANNOT_TAKE_LOCK;
+ SO_NOT_MAINLINE;
+ }
+ CONTRACTL_END;
+
+ return (CORProfilerPresent() &&
+ ((&g_profControlBlock)->dwEventMaskHigh & COR_PRF_HIGH_IN_MEMORY_SYMBOLS_UPDATED));
+}
+
+#if defined(PROFILING_SUPPORTED) && !defined(CROSSGEN_COMPILE)
+
+#if defined(FEATURE_PROFAPI_ATTACH_DETACH)
+
+//---------------------------------------------------------------------------------------
+// When EE calls into the profiler, an EvacuationCounterHolder object is instantiated on
+// the stack to increment the evacuation counter inside the EE Thread. Upon returning to
+// EE, this EvacuationCounterHolder object when being destroyed decreases the evacuation
+// counter by one.
+//
+// Do not use this object directly. Use BEGIN_PIN_PROFILER / END_PIN_PROFILER defined
+// below.
+//
+// See code:ProfilingAPIUtility::InitializeProfiling#LoadUnloadCallbackSynchronization.
+//
+typedef Wrapper<Thread *, ProfilingAPIUtility::IncEvacuationCounter, ProfilingAPIUtility::DecEvacuationCounter,
+ (UINT_PTR)0, CompareDefault<Thread *>, HSV_NoValidation> EvacuationCounterHolder;
+
+
+//---------------------------------------------------------------------------------------
+// These macros must be placed around any access to g_profControlBlock.pProfInterface by
+// the EE. Example:
+// {
+// BEGIN_PIN_PROFILER(CORProfilerTrackAppDomainLoads());
+// g_profControlBlock.pProfInterface->AppDomainCreationStarted(MyAppDomainID);
+// END_PIN_PROFILER();
+// }
+// The parameter to the BEGIN_PIN_PROFILER is the condition you want to check for, to
+// determine whether the profiler is loaded and requesting the callback you're about to
+// issue. Typically, this will be a call to one of the inline functions in
+// profilepriv.inl. If the condition is true, the macro will increment an evacuation
+// counter that effectively pins the profiler, recheck the condition, and (if still
+// true), execute whatever code you place inside the BEGIN/END_PIN_PROFILER block. If
+// your condition is more complex than a simple profiler status check, then place the
+// profiler status check as parameter to the macro, and add a separate if inside the
+// block. Example:
+//
+// {
+// BEGIN_PIN_PROFILER(CORProfilerTrackTransitions());
+// if (!pNSL->pMD->IsQCall())
+// {
+// g_profControlBlock.pProfInterface->
+// ManagedToUnmanagedTransition((FunctionID) pNSL->pMD,
+// COR_PRF_TRANSITION_CALL);
+// }
+// END_PIN_PROFILER();
+// }
+//
+// This ensures that the extra condition check (in this case "if
+// (!pNSL->pMD->IsQCall())") is only evaluated if the profiler is loaded. That way, we're
+// not executing extra, unnecessary instructions when no profiler is present.
+//
+// See code:ProfilingAPIUtility::InitializeProfiling#LoadUnloadCallbackSynchronization
+// for more details about how the synchronization works.
+#define BEGIN_PIN_PROFILER(condition) \
+ /* Do a cheap check of the condition (dirty-read) */ \
+ if (condition) \
+ { \
+ EvacuationCounterHolder __evacuationCounter(GetThreadNULLOk()); \
+ /* Now that the evacuation counter is incremented, the condition re-check */ \
+ /* below is a clean read. There's no MemoryBarrier() here, but that's ok */ \
+ /* as writes to the profiler status force a FlushStoreBuffers(). */ \
+ if (condition) \
+ {
+#define END_PIN_PROFILER() } }
+
+#else // FEATURE_PROFAPI_ATTACH_DETACH
+
+// For builds that include profiling but not attach / detach (e.g., Silverlight 2), the
+// *PIN_PROFILER macros should just check the condition without using the evacuation
+// counters.
+
+#define BEGIN_PIN_PROFILER(condition) if (condition) {
+#define END_PIN_PROFILER() }
+
+#endif // FEATURE_PROFAPI_ATTACH_DETACH
+
+#else // PROFILING_SUPPORTED && !CROSSGEN_COMPILE
+
+// Profiling feature not supported
+
+#define BEGIN_PIN_PROFILER(condition) if (false) {
+#define END_PIN_PROFILER() }
+
+#endif // PROFILING_SUPPORTED && !CROSSGEN_COMPILE
+
+#endif // _ProfilePriv_inl_
+
diff --git a/src/inc/quirksapi.h b/src/inc/quirksapi.h
new file mode 100644
index 0000000000..9927f16833
--- /dev/null
+++ b/src/inc/quirksapi.h
@@ -0,0 +1,37 @@
+// 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.
+
+//*****************************************************************************
+// QuirksApi.h
+//
+
+//
+// definitions required for querying windows quirk DB
+//*****************************************************************************
+
+#ifndef _QUIRKSAPI_H_
+#define _QUIRKSAPI_H_
+
+
+#define QUIRKSAPI_DLL W("api-ms-win-core-quirks-l1-1-0.dll")
+
+typedef struct _CPT_QUIRK_DATA {
+ DWORD Size;
+ DWORD Id;
+ WCHAR Name[128];
+ WCHAR CommandLine[128];
+} CPT_QUIRK_DATA, *PCPT_QUIRK_DATA;
+
+
+
+typedef bool (STDMETHODCALLTYPE * PFN_CptQuirkIsEnabled3)(
+ PCWSTR QuirkName,
+ DWORD ComponentVersion);
+
+typedef HRESULT (STDMETHODCALLTYPE * PFN_CptQuirkGetData2)(
+ PCWSTR QuirkName,
+ PCPT_QUIRK_DATA QuirkData);
+
+#endif // _QUIRKSAPI_H_
+
diff --git a/src/inc/random.h b/src/inc/random.h
new file mode 100644
index 0000000000..cbf2d21c4e
--- /dev/null
+++ b/src/inc/random.h
@@ -0,0 +1,279 @@
+// 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.
+//
+// random.h
+//
+
+//
+// Defines a random number generator, initially from the System.Random code in the BCL. If you notice any problems,
+// please compare to the implementation in src\mscorlib\src\system\random.cs.
+//
+// Main advantages over rand() are:
+//
+// 1) It generates better random numbers
+// 2) It can have multiple instantiations with different seeds
+// 3) It behaves the same regardless of whether we build with VC++ or GCC
+//
+// If you are working in the VM, we have a convenience method: code:GetRandomInt. This usess a thread-local
+// Random instance if a Thread object is available, and otherwise falls back to a global instance
+// with a spin-lock.
+//
+
+#ifndef _CLRRANDOM_H_
+#define _CLRRANDOM_H_
+
+#include <math.h>
+
+//
+// Forbid the use of srand()/rand(), as these are globally shared facilities and our use of them would
+// interfere with native user code in the same process. This override is not compatible with stl headers.
+//
+#if !defined(DO_NOT_DISABLE_RAND) && !defined(USE_STL)
+
+#ifdef srand
+#undef srand
+#endif
+#define srand Do_not_use_srand
+
+#ifdef rand
+#undef rand
+#endif
+#define rand Do_not_use_rand
+
+#endif //!DO_NOT_DISABLE_RAND && !USE_STL
+
+
+class CLRRandom
+{
+private:
+ //
+ // Private Constants
+ //
+ static const int MBIG = INT_MAX;
+ static const int MSEED = 161803398;
+ static const int MZ = 0;
+
+
+ //
+ // Member Variables
+ //
+ int inext;
+ int inextp;
+ int SeedArray[56];
+
+ bool initialized;
+
+public:
+ //
+ // Constructors
+ //
+
+ CLRRandom()
+ {
+ LIMITED_METHOD_CONTRACT;
+ initialized = false;
+ }
+
+ void Init()
+ {
+ LIMITED_METHOD_CONTRACT;
+ LARGE_INTEGER time;
+ if (!QueryPerformanceCounter(&time))
+ time.QuadPart = GetTickCount();
+ Init((int)time.u.LowPart ^ GetCurrentThreadId() ^ GetCurrentProcessId());
+ }
+
+ void Init(int Seed)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ int ii;
+ int mj, mk;
+
+ //Initialize our Seed array.
+ mj = MSEED - abs(Seed);
+ SeedArray[55]=mj;
+ mk=1;
+ for (int i=1; i<55; i++) { //Apparently the range [1..55] is special (Knuth) and so we're wasting the 0'th position.
+ ii = (21*i)%55;
+ SeedArray[ii]=mk;
+ mk = mj - mk;
+ if (mk<0) mk+=MBIG;
+ mj=SeedArray[ii];
+ }
+ for (int k=1; k<5; k++) {
+ for (int i=1; i<56; i++) {
+ SeedArray[i] -= SeedArray[1+(i+30)%55];
+ if (SeedArray[i]<0) SeedArray[i]+=MBIG;
+ }
+ }
+ inext=0;
+ inextp = 21;
+ Seed = 1;
+
+ initialized = true;
+ }
+
+ bool IsInitialized()
+ {
+ LIMITED_METHOD_CONTRACT;
+ return initialized;
+ }
+
+private:
+ //
+ // Package Private Methods
+ //
+
+ /*====================================Sample====================================
+ **Action: Return a new random number [0..1) and reSeed the Seed array.
+ **Returns: A double [0..1)
+ **Arguments: None
+ **Exceptions: None
+ ==============================================================================*/
+ double Sample()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ //Including this division at the end gives us significantly improved
+ //random number distribution.
+ return (InternalSample()*(1.0/MBIG));
+ }
+
+ int InternalSample()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ int retVal;
+ int locINext = inext;
+ int locINextp = inextp;
+
+ if (++locINext >=56) locINext=1;
+ if (++locINextp>= 56) locINextp = 1;
+
+ retVal = SeedArray[locINext]-SeedArray[locINextp];
+
+ if (retVal == MBIG) retVal--;
+ if (retVal<0) retVal+=MBIG;
+
+ SeedArray[locINext]=retVal;
+
+ inext = locINext;
+ inextp = locINextp;
+
+ return retVal;
+ }
+
+ double GetSampleForLargeRange()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ // The distribution of double value returned by Sample
+ // is not distributed well enough for a large range.
+ // If we use Sample for a range [Int32.MinValue..Int32.MaxValue)
+ // We will end up getting even numbers only.
+
+ int result = InternalSample();
+ // Note we can't use addition here. The distribution will be bad if we do that.
+ bool negative = (InternalSample()%2 == 0) ? true : false; // decide the sign based on second sample
+ if( negative) {
+ result = -result;
+ }
+ double d = result;
+ d += (INT_MAX - 1); // get a number in range [0 .. 2 * Int32MaxValue - 1)
+ d /= 2*(unsigned int)INT_MAX - 1 ;
+ return d;
+ }
+
+public:
+ //
+ // Public Instance Methods
+ //
+
+
+ /*=====================================Next=====================================
+ **Returns: An int [0..Int32.MaxValue)
+ **Arguments: None
+ **Exceptions: None.
+ ==============================================================================*/
+ int Next()
+ {
+ LIMITED_METHOD_CONTRACT;
+ _ASSERTE(initialized);
+ return InternalSample();
+ }
+
+
+ /*=====================================Next=====================================
+ **Returns: An int [minvalue..maxvalue)
+ **Arguments: minValue -- the least legal value for the Random number.
+ ** maxValue -- One greater than the greatest legal return value.
+ **Exceptions: None.
+ ==============================================================================*/
+ int Next(int minValue, int maxValue)
+ {
+ LIMITED_METHOD_CONTRACT;
+ _ASSERTE(initialized);
+ _ASSERTE(minValue < maxValue);
+
+ LONGLONG range = (LONGLONG)maxValue-minValue;
+ double result;
+
+ if( range <= (LONGLONG)INT_MAX)
+ result = (Sample() * range) + minValue;
+ else
+ result = (GetSampleForLargeRange() * range) + minValue;
+
+ _ASSERTE(result >= minValue && result < maxValue);
+ return (int)result;
+ }
+
+
+ /*=====================================Next=====================================
+ **Returns: An int [0..maxValue)
+ **Arguments: maxValue -- One more than the greatest legal return value.
+ **Exceptions: None.
+ ==============================================================================*/
+ int Next(int maxValue)
+ {
+ LIMITED_METHOD_CONTRACT;
+ _ASSERTE(initialized);
+ double result = Sample()*maxValue;
+ _ASSERTE(result >= 0 && result < maxValue);
+ return (int)result;
+ }
+
+
+ /*=====================================Next=====================================
+ **Returns: A double [0..1)
+ **Arguments: None
+ **Exceptions: None
+ ==============================================================================*/
+ double NextDouble()
+ {
+ LIMITED_METHOD_CONTRACT;
+ _ASSERTE(initialized);
+ double result = Sample();
+ _ASSERTE(result >= 0 && result < 1);
+ return result;
+ }
+
+
+ /*==================================NextBytes===================================
+ **Action: Fills the byte array with random bytes [0..0x7f]. The entire array is filled.
+ **Returns:Void
+ **Arguments: buffer -- the array to be filled.
+ **Exceptions: None
+ ==============================================================================*/
+ void NextBytes(__out_ecount(length) BYTE buffer[], int length)
+ {
+ LIMITED_METHOD_CONTRACT;
+ _ASSERTE(initialized);
+ for (int i=0; i<length; i++) {
+ buffer[i]=(BYTE)(InternalSample()%(256));
+ }
+ }
+};
+
+#endif //_CLRRANDOM_H_
diff --git a/src/inc/rangetree.h b/src/inc/rangetree.h
new file mode 100644
index 0000000000..7124d21055
--- /dev/null
+++ b/src/inc/rangetree.h
@@ -0,0 +1,141 @@
+// 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.
+
+
+#ifndef _RANGETREE_
+#define _RANGETREE_
+
+#include "utilcode.h"
+#include "memorypool.h"
+
+//
+// A RangeTree is a self-balancing binary tree of non-overlapping
+// ranges [start-end), which provides log N operation time for
+// lookup, insertion, and deletion of nodes.
+//
+// The tree is always balanced in the sense that the left and right
+// sides of a node have the same amount of address space allocated to
+// them - (for worst case data, the nodes of the tree might actually
+// not be balanced).
+//
+// This address-space balancing means that if all the ranges cover a
+// contiguous range of memory, and if lookup occur uniformly throughout
+// the overall range covered, the tree provides optimal lookup
+// structure.
+//
+// Another interesting property is that the same set of
+// ranges always produces the same tree layout, regardless of
+// the order the nodes are added in.
+//
+// Each node represents a range of the address space (in binary)
+// from m0...0 to m1...1, where m is any number of 31 bits or
+// less.
+//
+// Each node has 3 components:
+// * a range
+// * a 0-child,
+// * a 1-child
+//
+// The range is the numeric range [start,end),
+// represented by the node. A range is always assigned to the
+// widest possible node (i.e. most bits in m) possible. Thus the
+// bits of start and end share the same prefix string m, and
+// differ in the next bit after m: the start bound will have a 0
+// and the end bound will have a 1 in that position.
+//
+// Note that any other range which is represented by the same node
+// must necessarily intersect the node. Thus, if no overlaps are
+// possible, each node can only contain a single range. (To help
+// see why this must be, it helps to realize that the node
+// represents the transition from m01...1 to m10...0, which any
+// range represented by this node must contain.)
+//
+// All range nodes represented by the form m0... are contained in
+// the 0-child subtree, and all nodes represented by the form
+// m1... are contained in the 1-child subtree. Either child can
+// of course be null.
+//
+
+class RangeTree
+{
+ public:
+
+ //
+ // Imbed the RangeTreeNode structure in your data structure
+ // in order to place it into a RangeTree.
+ //
+
+ struct Node
+ {
+ friend class RangeTree;
+
+ private:
+ // start & end (exclusive) of range
+ SIZE_T start;
+ SIZE_T end;
+ // mask of high-order bits which are the same in start & end
+ SIZE_T mask;
+ // We could steal a bit from mask or children[] for isIntermediate
+ BOOL isIntermediate;
+#ifdef _DEBUG
+ // ordinal of when this node was created
+ DWORD ordinal;
+#endif
+
+ Node *children[2];
+
+ void Init (SIZE_T rangeStart, SIZE_T rangeEnd
+ DEBUGARG(DWORD ord));
+
+ Node** Child(SIZE_T address)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ return &children[ ! ! (address & ((~mask>>1)+1))];
+ }
+
+ public:
+ BOOL IsIntermediate() { return isIntermediate; }
+ void IsIntermediate(BOOL value) { isIntermediate = value; }
+ SIZE_T GetStart() { return start; }
+ SIZE_T GetEnd() { return end; }
+ };
+
+ friend struct Node;
+
+ RangeTree();
+
+ Node *Lookup(SIZE_T address) const;
+ Node *LookupEndInclusive(SIZE_T nonStartingAddress);
+ BOOL Overlaps(SIZE_T start, SIZE_T end);
+ HRESULT AddNode(Node *addNode, SIZE_T start, SIZE_T end);
+ HRESULT RemoveNode(Node *removeNode);
+ void RemoveRange(SIZE_T start, SIZE_T end);
+
+ typedef void (*IterationCallback)(Node *next, void *context);
+
+ void Iterate(IterationCallback pCallback, void *context = NULL);
+ void IterateRange(SIZE_T start, SIZE_T end, IterationCallback pCallback, void *context = NULL);
+
+ private:
+
+ Node * m_root;
+ MemoryPool m_pool;
+#ifdef _DEBUG
+ DWORD m_nodeCount;
+#endif
+
+ Node *AddIntermediateNode(Node *node0, Node *node1);
+ Node *AllocateIntermediate();
+ void FreeIntermediate(Node *node);
+
+ void IterateNode(Node *node, IterationCallback pCallback, void *context);
+ void IterateRangeNode(Node *node, SIZE_T start, SIZE_T end, SIZE_T mask, IterationCallback pCallback, void *context);
+ BOOL OverlapsNode(Node *node, SIZE_T start, SIZE_T end, SIZE_T mask);
+ void RemoveRangeNode(Node **nodePtr, SIZE_T start, SIZE_T end, SIZE_T mask);
+
+ static SIZE_T GetRangeCommonMask(SIZE_T start, SIZE_T end);
+};
+
+#endif // _RANGETREE_
diff --git a/src/inc/readytorun.h b/src/inc/readytorun.h
new file mode 100644
index 0000000000..9204862e17
--- /dev/null
+++ b/src/inc/readytorun.h
@@ -0,0 +1,333 @@
+// 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.
+
+//
+// readytorun.h
+//
+
+//
+// Contains definitions for the Ready to Run file format
+//
+
+#ifndef __READYTORUN_H__
+#define __READYTORUN_H__
+
+#define READYTORUN_SIGNATURE 0x00525452 // 'RTR'
+
+#define READYTORUN_MAJOR_VERSION 0x0002
+#define READYTORUN_MINOR_VERSION 0x0000
+
+struct READYTORUN_HEADER
+{
+ DWORD Signature; // READYTORUN_SIGNATURE
+ USHORT MajorVersion; // READYTORUN_VERSION_XXX
+ USHORT MinorVersion;
+
+ DWORD Flags; // READYTORUN_FLAG_XXX
+
+ DWORD NumberOfSections;
+
+ // Array of sections follows. The array entries are sorted by Type
+ // READYTORUN_SECTION Sections[];
+};
+
+struct READYTORUN_SECTION
+{
+ DWORD Type; // READYTORUN_SECTION_XXX
+ IMAGE_DATA_DIRECTORY Section;
+};
+
+enum ReadyToRunFlag
+{
+ // Set if the original IL assembly was platform-neutral
+ READYTORUN_FLAG_PLATFORM_NEUTRAL_SOURCE = 0x00000001,
+ READYTORUN_FLAG_SKIP_TYPE_VALIDATION = 0x00000002,
+};
+
+enum ReadyToRunSectionType
+{
+ READYTORUN_SECTION_COMPILER_IDENTIFIER = 100,
+ READYTORUN_SECTION_IMPORT_SECTIONS = 101,
+ READYTORUN_SECTION_RUNTIME_FUNCTIONS = 102,
+ READYTORUN_SECTION_METHODDEF_ENTRYPOINTS = 103,
+ READYTORUN_SECTION_EXCEPTION_INFO = 104,
+ READYTORUN_SECTION_DEBUG_INFO = 105,
+ READYTORUN_SECTION_DELAYLOAD_METHODCALL_THUNKS = 106,
+ // 107 used by an older format of READYTORUN_SECTION_AVAILABLE_TYPES
+ READYTORUN_SECTION_AVAILABLE_TYPES = 108,
+ READYTORUN_SECTION_INSTANCE_METHOD_ENTRYPOINTS = 109,
+};
+
+//
+// READYTORUN_IMPORT_SECTION describes image range with references to code or runtime data structures
+//
+// There is number of different types of these ranges: eagerly initialized at image load vs. lazily initialized at method entry
+// vs. lazily initialized on first use; handles vs. code pointers, etc.
+//
+struct READYTORUN_IMPORT_SECTION
+{
+ IMAGE_DATA_DIRECTORY Section; // Section containing values to be fixed up
+ USHORT Flags; // One or more of ReadyToRunImportSectionFlags
+ BYTE Type; // One of ReadyToRunImportSectionType
+ BYTE EntrySize;
+ DWORD Signatures; // RVA of optional signature descriptors
+ DWORD AuxiliaryData; // RVA of optional auxiliary data (typically GC info)
+};
+
+enum ReadyToRunImportSectionType
+{
+ READYTORUN_IMPORT_SECTION_TYPE_UNKNOWN = 0,
+};
+
+enum ReadyToRunImportSectionFlags
+{
+ READYTORUN_IMPORT_SECTION_FLAGS_EAGER = 0x0001,
+};
+
+//
+// Constants for method and field encoding
+//
+
+enum ReadyToRunMethodSigFlags
+{
+ READYTORUN_METHOD_SIG_UnboxingStub = 0x01,
+ READYTORUN_METHOD_SIG_InstantiatingStub = 0x02,
+ READYTORUN_METHOD_SIG_MethodInstantiation = 0x04,
+ READYTORUN_METHOD_SIG_SlotInsteadOfToken = 0x08,
+ READYTORUN_METHOD_SIG_MemberRefToken = 0x10,
+ READYTORUN_METHOD_SIG_Constrained = 0x20,
+ READYTORUN_METHOD_SIG_OwnerType = 0x40,
+};
+
+enum ReadyToRunFieldSigFlags
+{
+ READYTORUN_FIELD_SIG_IndexInsteadOfToken = 0x08,
+ READYTORUN_FIELD_SIG_MemberRefToken = 0x10,
+ READYTORUN_FIELD_SIG_OwnerType = 0x40,
+};
+
+enum ReadyToRunTypeLayoutFlags
+{
+ READYTORUN_LAYOUT_HFA = 0x01,
+ READYTORUN_LAYOUT_Alignment = 0x02,
+ READYTORUN_LAYOUT_Alignment_Native = 0x04,
+ READYTORUN_LAYOUT_GCLayout = 0x08,
+ READYTORUN_LAYOUT_GCLayout_Empty = 0x10,
+};
+
+//
+// Constants for fixup signature encoding
+//
+
+enum ReadyToRunFixupKind
+{
+ READYTORUN_FIXUP_ThisObjDictionaryLookup = 0x07,
+ READYTORUN_FIXUP_TypeDictionaryLookup = 0x08,
+ READYTORUN_FIXUP_MethodDictionaryLookup = 0x09,
+
+ READYTORUN_FIXUP_TypeHandle = 0x10,
+ READYTORUN_FIXUP_MethodHandle = 0x11,
+ READYTORUN_FIXUP_FieldHandle = 0x12,
+
+ READYTORUN_FIXUP_MethodEntry = 0x13, /* For calling a method entry point */
+ READYTORUN_FIXUP_MethodEntry_DefToken = 0x14, /* Smaller version of MethodEntry - method is def token */
+ READYTORUN_FIXUP_MethodEntry_RefToken = 0x15, /* Smaller version of MethodEntry - method is ref token */
+
+ READYTORUN_FIXUP_VirtualEntry = 0x16, /* For invoking a virtual method */
+ READYTORUN_FIXUP_VirtualEntry_DefToken = 0x17, /* Smaller version of VirtualEntry - method is def token */
+ READYTORUN_FIXUP_VirtualEntry_RefToken = 0x18, /* Smaller version of VirtualEntry - method is ref token */
+ READYTORUN_FIXUP_VirtualEntry_Slot = 0x19, /* Smaller version of VirtualEntry - type & slot */
+
+ READYTORUN_FIXUP_Helper = 0x1A, /* Helper */
+ READYTORUN_FIXUP_StringHandle = 0x1B, /* String handle */
+
+ READYTORUN_FIXUP_NewObject = 0x1C, /* Dynamically created new helper */
+ READYTORUN_FIXUP_NewArray = 0x1D,
+
+ READYTORUN_FIXUP_IsInstanceOf = 0x1E, /* Dynamically created casting helper */
+ READYTORUN_FIXUP_ChkCast = 0x1F,
+
+ READYTORUN_FIXUP_FieldAddress = 0x20, /* For accessing a cross-module static fields */
+ READYTORUN_FIXUP_CctorTrigger = 0x21, /* Static constructor trigger */
+
+ READYTORUN_FIXUP_StaticBaseNonGC = 0x22, /* Dynamically created static base helpers */
+ READYTORUN_FIXUP_StaticBaseGC = 0x23,
+ READYTORUN_FIXUP_ThreadStaticBaseNonGC = 0x24,
+ READYTORUN_FIXUP_ThreadStaticBaseGC = 0x25,
+
+ READYTORUN_FIXUP_FieldBaseOffset = 0x26, /* Field base offset */
+ READYTORUN_FIXUP_FieldOffset = 0x27, /* Field offset */
+
+ READYTORUN_FIXUP_TypeDictionary = 0x28,
+ READYTORUN_FIXUP_MethodDictionary = 0x29,
+
+ READYTORUN_FIXUP_Check_TypeLayout = 0x2A, /* size, alignment, HFA, reference map */
+ READYTORUN_FIXUP_Check_FieldOffset = 0x2B,
+
+ READYTORUN_FIXUP_DelegateCtor = 0x2C, /* optimized delegate ctor */
+ READYTORUN_FIXUP_DeclaringTypeHandle = 0x2D,
+};
+
+//
+// Intrinsics and helpers
+//
+
+enum ReadyToRunHelper
+{
+ READYTORUN_HELPER_Invalid = 0x00,
+
+ // Not a real helper - handle to current module passed to delay load helpers.
+ READYTORUN_HELPER_Module = 0x01,
+ READYTORUN_HELPER_GSCookie = 0x02,
+
+ //
+ // Delay load helpers
+ //
+
+ // All delay load helpers use custom calling convention:
+ // - scratch register - address of indirection cell. 0 = address is inferred from callsite.
+ // - stack - section index, module handle
+ READYTORUN_HELPER_DelayLoad_MethodCall = 0x08,
+
+ READYTORUN_HELPER_DelayLoad_Helper = 0x10,
+ READYTORUN_HELPER_DelayLoad_Helper_Obj = 0x11,
+ READYTORUN_HELPER_DelayLoad_Helper_ObjObj = 0x12,
+
+ // JIT helpers
+
+ // Exception handling helpers
+ READYTORUN_HELPER_Throw = 0x20,
+ READYTORUN_HELPER_Rethrow = 0x21,
+ READYTORUN_HELPER_Overflow = 0x22,
+ READYTORUN_HELPER_RngChkFail = 0x23,
+ READYTORUN_HELPER_FailFast = 0x24,
+ READYTORUN_HELPER_ThrowNullRef = 0x25,
+ READYTORUN_HELPER_ThrowDivZero = 0x26,
+
+ // Write barriers
+ READYTORUN_HELPER_WriteBarrier = 0x30,
+ READYTORUN_HELPER_CheckedWriteBarrier = 0x31,
+ READYTORUN_HELPER_ByRefWriteBarrier = 0x32,
+
+ // Array helpers
+ READYTORUN_HELPER_Stelem_Ref = 0x38,
+ READYTORUN_HELPER_Ldelema_Ref = 0x39,
+
+ READYTORUN_HELPER_MemSet = 0x40,
+ READYTORUN_HELPER_MemCpy = 0x41,
+
+ // Get string handle lazily
+ READYTORUN_HELPER_GetString = 0x50,
+
+ // Reflection helpers
+ READYTORUN_HELPER_GetRuntimeTypeHandle = 0x54,
+ READYTORUN_HELPER_GetRuntimeMethodHandle = 0x55,
+ READYTORUN_HELPER_GetRuntimeFieldHandle = 0x56,
+
+ READYTORUN_HELPER_Box = 0x58,
+ READYTORUN_HELPER_Box_Nullable = 0x59,
+ READYTORUN_HELPER_Unbox = 0x5A,
+ READYTORUN_HELPER_Unbox_Nullable = 0x5B,
+ READYTORUN_HELPER_NewMultiDimArr = 0x5C,
+ READYTORUN_HELPER_NewMultiDimArr_NonVarArg = 0x5D,
+
+ // Helpers used with generic handle lookup cases
+ READYTORUN_HELPER_NewObject = 0x60,
+ READYTORUN_HELPER_NewArray = 0x61,
+ READYTORUN_HELPER_CheckCastAny = 0x62,
+ READYTORUN_HELPER_CheckInstanceAny = 0x63,
+ READYTORUN_HELPER_GenericGcStaticBase = 0x64,
+ READYTORUN_HELPER_GenericNonGcStaticBase = 0x65,
+ READYTORUN_HELPER_GenericGcTlsBase = 0x66,
+ READYTORUN_HELPER_GenericNonGcTlsBase = 0x67,
+ READYTORUN_HELPER_VirtualFuncPtr = 0x68,
+
+ // Long mul/div/shift ops
+ READYTORUN_HELPER_LMul = 0xC0,
+ READYTORUN_HELPER_LMulOfv = 0xC1,
+ READYTORUN_HELPER_ULMulOvf = 0xC2,
+ READYTORUN_HELPER_LDiv = 0xC3,
+ READYTORUN_HELPER_LMod = 0xC4,
+ READYTORUN_HELPER_ULDiv = 0xC5,
+ READYTORUN_HELPER_ULMod = 0xC6,
+ READYTORUN_HELPER_LLsh = 0xC7,
+ READYTORUN_HELPER_LRsh = 0xC8,
+ READYTORUN_HELPER_LRsz = 0xC9,
+ READYTORUN_HELPER_Lng2Dbl = 0xCA,
+ READYTORUN_HELPER_ULng2Dbl = 0xCB,
+
+ // 32-bit division helpers
+ READYTORUN_HELPER_Div = 0xCC,
+ READYTORUN_HELPER_Mod = 0xCD,
+ READYTORUN_HELPER_UDiv = 0xCE,
+ READYTORUN_HELPER_UMod = 0xCF,
+
+ // Floating point conversions
+ READYTORUN_HELPER_Dbl2Int = 0xD0,
+ READYTORUN_HELPER_Dbl2IntOvf = 0xD1,
+ READYTORUN_HELPER_Dbl2Lng = 0xD2,
+ READYTORUN_HELPER_Dbl2LngOvf = 0xD3,
+ READYTORUN_HELPER_Dbl2UInt = 0xD4,
+ READYTORUN_HELPER_Dbl2UIntOvf = 0xD5,
+ READYTORUN_HELPER_Dbl2ULng = 0xD6,
+ READYTORUN_HELPER_Dbl2ULngOvf = 0xD7,
+
+ // Floating point ops
+ READYTORUN_HELPER_DblRem = 0xE0,
+ READYTORUN_HELPER_FltRem = 0xE1,
+ READYTORUN_HELPER_DblRound = 0xE2,
+ READYTORUN_HELPER_FltRound = 0xE3,
+
+#ifndef _TARGET_X86_
+ // Personality rountines
+ READYTORUN_HELPER_PersonalityRoutine = 0xF0,
+ READYTORUN_HELPER_PersonalityRoutineFilterFunclet = 0xF1,
+#endif
+
+ //
+ // Deprecated/legacy
+ //
+
+ // JIT32 x86-specific write barriers
+ READYTORUN_HELPER_WriteBarrier_EAX = 0x100,
+ READYTORUN_HELPER_WriteBarrier_EBX = 0x101,
+ READYTORUN_HELPER_WriteBarrier_ECX = 0x102,
+ READYTORUN_HELPER_WriteBarrier_ESI = 0x103,
+ READYTORUN_HELPER_WriteBarrier_EDI = 0x104,
+ READYTORUN_HELPER_WriteBarrier_EBP = 0x105,
+ READYTORUN_HELPER_CheckedWriteBarrier_EAX = 0x106,
+ READYTORUN_HELPER_CheckedWriteBarrier_EBX = 0x107,
+ READYTORUN_HELPER_CheckedWriteBarrier_ECX = 0x108,
+ READYTORUN_HELPER_CheckedWriteBarrier_ESI = 0x109,
+ READYTORUN_HELPER_CheckedWriteBarrier_EDI = 0x10A,
+ READYTORUN_HELPER_CheckedWriteBarrier_EBP = 0x10B,
+
+ // JIT32 x86-specific exception handling
+ READYTORUN_HELPER_EndCatch = 0x110,
+};
+
+//
+// Exception info
+//
+
+struct READYTORUN_EXCEPTION_LOOKUP_TABLE_ENTRY
+{
+ DWORD MethodStart;
+ DWORD ExceptionInfo;
+};
+
+struct READYTORUN_EXCEPTION_CLAUSE
+{
+ CorExceptionFlag Flags;
+ DWORD TryStartPC;
+ DWORD TryEndPC;
+ DWORD HandlerStartPC;
+ DWORD HandlerEndPC;
+ union {
+ mdToken ClassToken;
+ DWORD FilterOffset;
+ };
+};
+
+#endif // __READYTORUN_H__
diff --git a/src/inc/readytorunhelpers.h b/src/inc/readytorunhelpers.h
new file mode 100644
index 0000000000..4524e1ae84
--- /dev/null
+++ b/src/inc/readytorunhelpers.h
@@ -0,0 +1,113 @@
+// 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.
+
+//
+// ReadyToRunHelpers.h
+//
+
+//
+// Mapping between regular JIT helpers and ready to run helpers
+//
+
+#ifndef OPTIMIZEFORSPEED
+#define OPTIMIZEFORSPEED
+#endif
+
+HELPER(READYTORUN_HELPER_Throw, CORINFO_HELP_THROW, OPTIMIZEFORSIZE)
+HELPER(READYTORUN_HELPER_Rethrow, CORINFO_HELP_RETHROW, OPTIMIZEFORSIZE)
+HELPER(READYTORUN_HELPER_Overflow, CORINFO_HELP_OVERFLOW, OPTIMIZEFORSIZE)
+HELPER(READYTORUN_HELPER_RngChkFail, CORINFO_HELP_RNGCHKFAIL, OPTIMIZEFORSIZE)
+HELPER(READYTORUN_HELPER_FailFast, CORINFO_HELP_FAIL_FAST, OPTIMIZEFORSIZE)
+HELPER(READYTORUN_HELPER_ThrowNullRef, CORINFO_HELP_THROWNULLREF, OPTIMIZEFORSIZE)
+HELPER(READYTORUN_HELPER_ThrowDivZero, CORINFO_HELP_THROWDIVZERO, OPTIMIZEFORSIZE)
+
+HELPER(READYTORUN_HELPER_WriteBarrier, CORINFO_HELP_ASSIGN_REF, )
+HELPER(READYTORUN_HELPER_CheckedWriteBarrier, CORINFO_HELP_CHECKED_ASSIGN_REF, )
+HELPER(READYTORUN_HELPER_ByRefWriteBarrier, CORINFO_HELP_ASSIGN_BYREF, )
+
+HELPER(READYTORUN_HELPER_Stelem_Ref, CORINFO_HELP_ARRADDR_ST, )
+HELPER(READYTORUN_HELPER_Ldelema_Ref, CORINFO_HELP_LDELEMA_REF, )
+
+HELPER(READYTORUN_HELPER_MemSet, CORINFO_HELP_MEMSET, )
+HELPER(READYTORUN_HELPER_MemCpy, CORINFO_HELP_MEMCPY, )
+
+HELPER(READYTORUN_HELPER_GetRuntimeTypeHandle, CORINFO_HELP_TYPEHANDLE_TO_RUNTIMETYPE, )
+HELPER(READYTORUN_HELPER_GetRuntimeMethodHandle, CORINFO_HELP_METHODDESC_TO_STUBRUNTIMEMETHOD, )
+HELPER(READYTORUN_HELPER_GetRuntimeFieldHandle, CORINFO_HELP_FIELDDESC_TO_STUBRUNTIMEFIELD, )
+
+HELPER(READYTORUN_HELPER_Box, CORINFO_HELP_BOX, )
+HELPER(READYTORUN_HELPER_Box_Nullable, CORINFO_HELP_BOX_NULLABLE, )
+HELPER(READYTORUN_HELPER_Unbox, CORINFO_HELP_UNBOX, )
+HELPER(READYTORUN_HELPER_Unbox_Nullable, CORINFO_HELP_UNBOX_NULLABLE, )
+HELPER(READYTORUN_HELPER_NewMultiDimArr, CORINFO_HELP_NEW_MDARR, )
+HELPER(READYTORUN_HELPER_NewMultiDimArr_NonVarArg, CORINFO_HELP_NEW_MDARR_NONVARARG, )
+
+HELPER(READYTORUN_HELPER_NewObject, CORINFO_HELP_NEWFAST, )
+HELPER(READYTORUN_HELPER_NewArray, CORINFO_HELP_NEWARR_1_DIRECT, )
+HELPER(READYTORUN_HELPER_CheckCastAny, CORINFO_HELP_CHKCASTANY, )
+HELPER(READYTORUN_HELPER_CheckInstanceAny, CORINFO_HELP_ISINSTANCEOFANY, )
+
+HELPER(READYTORUN_HELPER_GenericGcStaticBase, CORINFO_HELP_GETGENERICS_GCSTATIC_BASE, )
+HELPER(READYTORUN_HELPER_GenericNonGcStaticBase, CORINFO_HELP_GETGENERICS_NONGCSTATIC_BASE, )
+HELPER(READYTORUN_HELPER_GenericGcTlsBase, CORINFO_HELP_GETGENERICS_GCTHREADSTATIC_BASE, )
+HELPER(READYTORUN_HELPER_GenericNonGcTlsBase, CORINFO_HELP_GETGENERICS_NONGCTHREADSTATIC_BASE,)
+
+HELPER(READYTORUN_HELPER_VirtualFuncPtr, CORINFO_HELP_VIRTUAL_FUNC_PTR, )
+
+HELPER(READYTORUN_HELPER_LMul, CORINFO_HELP_LMUL, )
+HELPER(READYTORUN_HELPER_LMulOfv, CORINFO_HELP_LMUL_OVF, )
+HELPER(READYTORUN_HELPER_ULMulOvf, CORINFO_HELP_ULMUL_OVF, )
+HELPER(READYTORUN_HELPER_LDiv, CORINFO_HELP_LDIV, )
+HELPER(READYTORUN_HELPER_LMod, CORINFO_HELP_LMOD, )
+HELPER(READYTORUN_HELPER_ULDiv, CORINFO_HELP_ULDIV, )
+HELPER(READYTORUN_HELPER_ULMod, CORINFO_HELP_ULMOD, )
+HELPER(READYTORUN_HELPER_LLsh, CORINFO_HELP_LLSH, )
+HELPER(READYTORUN_HELPER_LRsh, CORINFO_HELP_LRSH, )
+HELPER(READYTORUN_HELPER_LRsz, CORINFO_HELP_LRSZ, )
+HELPER(READYTORUN_HELPER_Lng2Dbl, CORINFO_HELP_LNG2DBL, )
+HELPER(READYTORUN_HELPER_ULng2Dbl, CORINFO_HELP_ULNG2DBL, )
+
+HELPER(READYTORUN_HELPER_Div, CORINFO_HELP_DIV, )
+HELPER(READYTORUN_HELPER_Mod, CORINFO_HELP_MOD, )
+HELPER(READYTORUN_HELPER_UDiv, CORINFO_HELP_UDIV, )
+HELPER(READYTORUN_HELPER_UMod, CORINFO_HELP_UMOD, )
+
+HELPER(READYTORUN_HELPER_Dbl2Int, CORINFO_HELP_DBL2INT, )
+HELPER(READYTORUN_HELPER_Dbl2IntOvf, CORINFO_HELP_DBL2INT_OVF, )
+HELPER(READYTORUN_HELPER_Dbl2Lng, CORINFO_HELP_DBL2LNG, )
+HELPER(READYTORUN_HELPER_Dbl2LngOvf, CORINFO_HELP_DBL2LNG_OVF, )
+HELPER(READYTORUN_HELPER_Dbl2UInt, CORINFO_HELP_DBL2UINT, )
+HELPER(READYTORUN_HELPER_Dbl2UIntOvf, CORINFO_HELP_DBL2UINT_OVF, )
+HELPER(READYTORUN_HELPER_Dbl2ULng, CORINFO_HELP_DBL2ULNG, )
+HELPER(READYTORUN_HELPER_Dbl2ULngOvf, CORINFO_HELP_DBL2ULNG_OVF, )
+
+HELPER(READYTORUN_HELPER_DblRem, CORINFO_HELP_FLTREM, )
+HELPER(READYTORUN_HELPER_FltRem, CORINFO_HELP_DBLREM, )
+HELPER(READYTORUN_HELPER_DblRound, CORINFO_HELP_FLTROUND, )
+HELPER(READYTORUN_HELPER_FltRound, CORINFO_HELP_DBLROUND, )
+
+#ifndef _TARGET_X86_
+HELPER(READYTORUN_HELPER_PersonalityRoutine, CORINFO_HELP_EE_PERSONALITY_ROUTINE, OPTIMIZEFORSIZE)
+HELPER(READYTORUN_HELPER_PersonalityRoutineFilterFunclet, CORINFO_HELP_EE_PERSONALITY_ROUTINE_FILTER_FUNCLET, OPTIMIZEFORSIZE)
+#endif
+
+#ifdef _TARGET_X86_
+HELPER(READYTORUN_HELPER_WriteBarrier_EAX, CORINFO_HELP_ASSIGN_REF_EAX, )
+HELPER(READYTORUN_HELPER_WriteBarrier_EBX, CORINFO_HELP_ASSIGN_REF_EBX, )
+HELPER(READYTORUN_HELPER_WriteBarrier_ECX, CORINFO_HELP_ASSIGN_REF_ECX, )
+HELPER(READYTORUN_HELPER_WriteBarrier_ESI, CORINFO_HELP_ASSIGN_REF_ESI, )
+HELPER(READYTORUN_HELPER_WriteBarrier_EDI, CORINFO_HELP_ASSIGN_REF_EDI, )
+HELPER(READYTORUN_HELPER_WriteBarrier_EBP, CORINFO_HELP_ASSIGN_REF_EBP, )
+HELPER(READYTORUN_HELPER_CheckedWriteBarrier_EAX, CORINFO_HELP_CHECKED_ASSIGN_REF_EAX, )
+HELPER(READYTORUN_HELPER_CheckedWriteBarrier_EBX, CORINFO_HELP_CHECKED_ASSIGN_REF_EBX, )
+HELPER(READYTORUN_HELPER_CheckedWriteBarrier_ECX, CORINFO_HELP_CHECKED_ASSIGN_REF_ECX, )
+HELPER(READYTORUN_HELPER_CheckedWriteBarrier_ESI, CORINFO_HELP_CHECKED_ASSIGN_REF_ESI, )
+HELPER(READYTORUN_HELPER_CheckedWriteBarrier_EDI, CORINFO_HELP_CHECKED_ASSIGN_REF_EDI, )
+HELPER(READYTORUN_HELPER_CheckedWriteBarrier_EBP, CORINFO_HELP_CHECKED_ASSIGN_REF_EBP, )
+
+HELPER(READYTORUN_HELPER_EndCatch, CORINFO_HELP_ENDCATCH, OPTIMIZEFORSIZE)
+#endif
+
+#undef HELPER
+#undef OPTIMIZEFORSPEED
diff --git a/src/inc/regdisp.h b/src/inc/regdisp.h
new file mode 100644
index 0000000000..09a6a38f62
--- /dev/null
+++ b/src/inc/regdisp.h
@@ -0,0 +1,584 @@
+// 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.
+
+#ifndef __REGDISP_H
+#define __REGDISP_H
+
+
+#ifdef DEBUG_REGDISPLAY
+class Thread;
+#endif // DEBUG_REGDISPLAY
+
+
+#if defined(_TARGET_X86_)
+
+struct REGDISPLAY {
+ PCONTEXT pContext; // points to current Context; either
+ // returned by GetContext or provided
+ // at exception time.
+
+ // TODO: Unify with pCurrentContext / pCallerContext used on 64-bit
+ PCONTEXT pContextForUnwind; // scratch context for unwinding
+ // used to preserve context saved in the frame that
+ // could be otherwise wiped by the unwinding
+
+ DWORD * pEdi;
+ DWORD * pEsi;
+ DWORD * pEbx;
+ DWORD * pEdx;
+ DWORD * pEcx;
+ DWORD * pEax;
+
+ DWORD * pEbp;
+ DWORD Esp; // (Esp) Stack Pointer
+ PCODE ControlPC;
+ TADDR PCTAddr;
+
+};
+
+inline TADDR GetRegdisplaySP(REGDISPLAY *display) {
+ LIMITED_METHOD_DAC_CONTRACT;
+
+ return (TADDR)display->Esp;
+}
+
+inline void SetRegdisplaySP(REGDISPLAY *display, LPVOID sp ) {
+ LIMITED_METHOD_DAC_CONTRACT;
+
+ (display->Esp) = (DWORD)(size_t)sp;
+}
+
+inline TADDR GetRegdisplayFP(REGDISPLAY *display) {
+ LIMITED_METHOD_DAC_CONTRACT;
+
+ return (TADDR)*(display->pEbp);
+}
+
+inline LPVOID GetRegdisplayFPAddress(REGDISPLAY *display) {
+ LIMITED_METHOD_CONTRACT;
+
+ return (LPVOID)display->pEbp;
+}
+
+inline PCODE GetControlPC(REGDISPLAY *display) {
+ LIMITED_METHOD_DAC_CONTRACT;
+
+ return display->ControlPC;
+}
+
+// This function tells us if the given stack pointer is in one of the frames of the functions called by the given frame
+inline BOOL IsInCalleesFrames(REGDISPLAY *display, LPVOID stackPointer) {
+ LIMITED_METHOD_CONTRACT;
+
+ return (TADDR)stackPointer < display->PCTAddr;
+}
+inline TADDR GetRegdisplayStackMark(REGDISPLAY *display) {
+ LIMITED_METHOD_DAC_CONTRACT;
+
+ return display->PCTAddr;
+}
+
+#elif defined(_WIN64)
+
+#if defined(_TARGET_ARM64_)
+typedef struct _Arm64VolatileContextPointer
+{
+ union {
+ struct {
+ PDWORD64 X0;
+ PDWORD64 X1;
+ PDWORD64 X2;
+ PDWORD64 X3;
+ PDWORD64 X4;
+ PDWORD64 X5;
+ PDWORD64 X6;
+ PDWORD64 X7;
+ PDWORD64 X8;
+ PDWORD64 X9;
+ PDWORD64 X10;
+ PDWORD64 X11;
+ PDWORD64 X12;
+ PDWORD64 X13;
+ PDWORD64 X14;
+ PDWORD64 X15;
+ PDWORD64 X16;
+ PDWORD64 X17;
+ //X18 is reserved by OS, in userspace it represents TEB
+ };
+ PDWORD64 X[18];
+ };
+} Arm64VolatileContextPointer;
+#endif //_TARGET_ARM64_
+struct REGDISPLAY {
+ PT_CONTEXT pContext; // This is the context of the active call frame. This
+ // will be used to resume execution, so do not use trash it!
+ // But DO update any static registers here.
+
+ PT_CONTEXT pCurrentContext; // [trashed] points to current Context of stackwalk
+ PT_CONTEXT pCallerContext; // [trashed] points to the Context of the caller during stackwalk -- used for GC crawls
+
+ size_t ControlPC;
+
+ size_t SP;
+
+ T_KNONVOLATILE_CONTEXT_POINTERS *pCurrentContextPointers; // [trashed] points to current context pointers of stackwalk
+ T_KNONVOLATILE_CONTEXT_POINTERS *pCallerContextPointers; // [trashed] points to the context pointers of the caller during stackwalk -- used for GC crawls
+#ifdef _TARGET_ARM64_
+ Arm64VolatileContextPointer volatileCurrContextPointers;
+#endif
+
+ BOOL IsCallerContextValid; // TRUE if pCallerContext really contains the caller's context
+ BOOL IsCallerSPValid; // Don't add usage of this field. This is only temporary.
+
+ T_CONTEXT ctxOne; // used by stackwalk
+ T_CONTEXT ctxTwo; // used by stackwalk
+
+ T_KNONVOLATILE_CONTEXT_POINTERS ctxPtrsOne; // used by stackwalk
+ T_KNONVOLATILE_CONTEXT_POINTERS ctxPtrsTwo; // used by stackwalk
+
+#ifdef DEBUG_REGDISPLAY
+ Thread *_pThread;
+#endif // DEBUG_REGDISPLAY
+};
+
+inline TADDR GetRegdisplaySP(REGDISPLAY *display) {
+ LIMITED_METHOD_DAC_CONTRACT;
+ return (TADDR)display->SP;
+}
+
+inline TADDR GetRegdisplayFP(REGDISPLAY *display) {
+ LIMITED_METHOD_CONTRACT;
+ return NULL;
+}
+
+inline TADDR GetRegdisplayFPAddress(REGDISPLAY *display) {
+ LIMITED_METHOD_CONTRACT;
+ return NULL;
+}
+
+inline PCODE GetControlPC(REGDISPLAY *display) {
+ LIMITED_METHOD_DAC_CONTRACT;
+ return (PCODE)(display->ControlPC);
+}
+
+#ifdef DEBUG_REGDISPLAY
+void CheckRegDisplaySP (REGDISPLAY *pRD);
+#endif // DEBUG_REGDISPLAY
+
+inline void SyncRegDisplayToCurrentContext(REGDISPLAY* pRD)
+{
+ LIMITED_METHOD_CONTRACT;
+
+ pRD->SP = (INT_PTR)GetSP(pRD->pCurrentContext);
+
+#ifdef DEBUG_REGDISPLAY
+ CheckRegDisplaySP(pRD);
+#endif // DEBUG_REGDISPLAY
+
+ pRD->ControlPC = INT_PTR(GetIP(pRD->pCurrentContext));
+}
+
+// This function tells us if the given stack pointer is in one of the frames of the functions called by the given frame
+inline BOOL IsInCalleesFrames(REGDISPLAY *display, LPVOID stackPointer)
+{
+ LIMITED_METHOD_CONTRACT;
+ return stackPointer < ((LPVOID)(display->SP));
+}
+
+inline TADDR GetRegdisplayStackMark(REGDISPLAY *display)
+{
+#if defined(_TARGET_AMD64_)
+ // On AMD64, the MemoryStackFp value is the current sp (i.e. the sp value when calling another method).
+ _ASSERTE(GetRegdisplaySP(display) == GetSP(display->pCurrentContext));
+ return GetRegdisplaySP(display);
+
+#elif defined(_TARGET_ARM64_)
+
+ _ASSERTE(display->IsCallerContextValid);
+ return GetSP(display->pCallerContext);
+
+#else // _TARGET_AMD64_
+ PORTABILITY_ASSERT("GetRegdisplayStackMark NYI for this platform (Regdisp.h)");
+ return NULL;
+#endif // _TARGET_AMD64_
+}
+
+// This needs to be implemented for platforms that have funclets.
+inline LPVOID GetRegdisplayReturnValue(REGDISPLAY *display)
+{
+ LIMITED_METHOD_CONTRACT;
+
+#if defined(_TARGET_AMD64_)
+ return (LPVOID)display->pCurrentContext->Rax;
+#elif defined(_TARGET_ARM64_)
+ return (LPVOID)display->pCurrentContext->X0;
+#else
+ PORTABILITY_ASSERT("GetRegdisplayReturnValue NYI for this platform (Regdisp.h)");
+ return NULL;
+#endif
+}
+
+#elif defined(_TARGET_ARM_)
+
+// ResumableFrame is pushed on the stack before
+// starting the GC. registers r0-r3 in ResumableFrame can
+// contain roots which might need to be updated if they are
+// relocated. On Stack walking the addresses of the registers in the
+// resumable Frame are passed to GC using pCurrentContextPointers
+// member in _REGDISPLAY. However On ARM KNONVOLATILE_CONTEXT_POINTERS
+// does not contain pointers for volatile registers. Therefore creating
+// this structure to store pointers to volatile registers and adding an object
+// as member in _REGDISPLAY
+typedef struct _ArmVolatileContextPointer
+{
+ PDWORD R0;
+ PDWORD R1;
+ PDWORD R2;
+ PDWORD R3;
+ PDWORD R12;
+} ArmVolatileContextPointer;
+
+struct REGDISPLAY {
+ PT_CONTEXT pContext; // points to current Context; either
+ // returned by GetContext or provided
+ // at exception time.
+
+ PT_CONTEXT pCurrentContext; // [trashed] points to current Context of stackwalk
+ PT_CONTEXT pCallerContext; // [trashed] points to the Context of the caller during stackwalk -- used for GC crawls
+
+ T_KNONVOLATILE_CONTEXT_POINTERS ctxPtrsOne; // used by stackwalk
+ T_KNONVOLATILE_CONTEXT_POINTERS ctxPtrsTwo; // used by stackwalk
+
+ PT_KNONVOLATILE_CONTEXT_POINTERS pCurrentContextPointers;
+ PT_KNONVOLATILE_CONTEXT_POINTERS pCallerContextPointers;
+ ArmVolatileContextPointer volatileCurrContextPointers;
+
+ BOOL IsCallerContextValid; // TRUE if pCallerContext really contains the caller's context
+ BOOL IsCallerSPValid; // Don't add usage of this field. This is only temporary.
+
+ DWORD SP;
+ DWORD ControlPC;
+ DWORD * pPC; // processor neutral name
+
+ T_CONTEXT ctxOne; // used by stackwalk
+ T_CONTEXT ctxTwo; // used in ExceptionTracker::InitializeCrawlFrame
+
+ REGDISPLAY()
+ {
+ // Initialize regdisplay
+ memset(this, 0, sizeof(REGDISPLAY));
+
+ // Setup the pointer to ControlPC field
+ pPC = &ControlPC;
+ }
+
+#ifdef DEBUG_REGDISPLAY
+ Thread *_pThread;
+#endif // DEBUG_REGDISPLAY
+
+};
+
+#ifdef DEBUG_REGDISPLAY
+void CheckRegDisplaySP (REGDISPLAY *pRD);
+#endif // DEBUG_REGDISPLAY
+
+inline TADDR GetRegdisplaySP(REGDISPLAY *display) {
+ LIMITED_METHOD_DAC_CONTRACT;
+ return (TADDR)(size_t)display->SP;
+}
+
+inline PCODE GetControlPC(REGDISPLAY *display) {
+ LIMITED_METHOD_DAC_CONTRACT;
+ return (PCODE)(display->ControlPC);
+}
+
+
+// This function tells us if the given stack pointer is in one of the frames of the functions called by the given frame
+inline BOOL IsInCalleesFrames(REGDISPLAY *display, LPVOID stackPointer) {
+ LIMITED_METHOD_CONTRACT;
+ return stackPointer < ((LPVOID)(TADDR)(display->SP));
+}
+
+inline TADDR GetRegdisplayStackMark(REGDISPLAY *display) {
+ LIMITED_METHOD_CONTRACT;
+ // ARM uses the establisher frame as the marker
+ _ASSERTE(display->IsCallerContextValid);
+ return GetSP(display->pCallerContext);
+}
+
+inline void SyncRegDisplayToCurrentContext(REGDISPLAY* pRD)
+{
+ LIMITED_METHOD_CONTRACT;
+ pRD->SP = (DWORD)GetSP(pRD->pCurrentContext);
+ pRD->ControlPC = (DWORD)GetIP(pRD->pCurrentContext);
+}
+
+// This needs to be implemented for platforms that have funclets.
+inline LPVOID GetRegdisplayReturnValue(REGDISPLAY *display)
+{
+ LIMITED_METHOD_CONTRACT;
+
+ return (LPVOID)display->pCurrentContext->R0;
+}
+
+#else // none of the above processors
+
+PORTABILITY_WARNING("RegDisplay functions are not implemented on this platform.")
+
+struct REGDISPLAY {
+ PCONTEXT pContext; // points to current Context
+ size_t SP;
+ size_t * FramePtr;
+ SLOT * pPC;
+};
+
+inline PCODE GetControlPC(REGDISPLAY *display) {
+ LIMITED_METHOD_CONTRACT;
+ return (PCODE) NULL;
+}
+
+inline LPVOID GetRegdisplaySP(REGDISPLAY *display) {
+ LIMITED_METHOD_DAC_CONTRACT;
+ return (LPVOID)display->SP;
+}
+
+inline TADDR GetRegdisplayFP(REGDISPLAY *display) {
+ LIMITED_METHOD_CONTRACT;
+ return (TADDR)*(display->FramePtr);
+}
+
+inline BOOL IsInCalleesFrames(REGDISPLAY *display, LPVOID stackPointer) {
+ LIMITED_METHOD_CONTRACT;
+ return FALSE;
+}
+inline LPVOID GetRegdisplayStackMark(REGDISPLAY *display) {
+ LIMITED_METHOD_CONTRACT;
+ return (LPVOID)display->SP;
+}
+
+#endif
+
+typedef REGDISPLAY *PREGDISPLAY;
+
+
+inline void FillRegDisplay(const PREGDISPLAY pRD, PT_CONTEXT pctx, PT_CONTEXT pCallerCtx = NULL)
+{
+ WRAPPER_NO_CONTRACT;
+
+ SUPPORTS_DAC;
+
+#ifdef _TARGET_X86_
+ pRD->pContext = pctx;
+ pRD->pContextForUnwind = NULL;
+ pRD->pEdi = &(pctx->Edi);
+ pRD->pEsi = &(pctx->Esi);
+ pRD->pEbx = &(pctx->Ebx);
+ pRD->pEbp = &(pctx->Ebp);
+ pRD->pEax = &(pctx->Eax);
+ pRD->pEcx = &(pctx->Ecx);
+ pRD->pEdx = &(pctx->Edx);
+ pRD->Esp = pctx->Esp;
+ pRD->ControlPC = (PCODE)(pctx->Eip);
+ pRD->PCTAddr = (UINT_PTR)&(pctx->Eip);
+#elif defined(_WIN64)
+ pRD->pContext = pctx;
+#ifdef _TARGET_AMD64_
+ for (int i = 0; i < 16; i++)
+ {
+ *(&pRD->ctxPtrsOne.Rax + i) = (&pctx->Rax + i);
+ }
+#elif defined(_TARGET_ARM64_)
+ for (int i = 0; i < 12; i++)
+ {
+ *(&pRD->ctxPtrsOne.X19 + i) = (&pctx->X19 + i);
+ }
+#endif // _TARGET_AMD64_
+
+ pRD->pCurrentContextPointers = &pRD->ctxPtrsOne;
+ pRD->pCallerContextPointers = &pRD->ctxPtrsTwo;
+
+ pRD->pCurrentContext = &(pRD->ctxOne);
+ pRD->pCallerContext = &(pRD->ctxTwo);
+
+ // copy the active context to initialize our stackwalk
+ *(pRD->pCurrentContext) = *(pctx);
+
+ // copy the caller context as well if it's specified
+ if (pCallerCtx == NULL)
+ {
+ pRD->IsCallerContextValid = FALSE;
+ pRD->IsCallerSPValid = FALSE; // Don't add usage of this field. This is only temporary.
+ }
+ else
+ {
+ *(pRD->pCallerContext) = *(pCallerCtx);
+ pRD->IsCallerContextValid = TRUE;
+ pRD->IsCallerSPValid = TRUE; // Don't add usage of this field. This is only temporary.
+ }
+
+#ifdef DEBUG_REGDISPLAY
+ pRD->_pThread = NULL;
+#endif // DEBUG_REGDISPLAY
+
+ SyncRegDisplayToCurrentContext(pRD);
+#elif defined(_TARGET_ARM_)
+ pRD->pContext = pctx;
+
+ // Copy over the nonvolatile integer registers (R4-R11)
+ for (int i = 0; i < 8; i++)
+ {
+ *(&pRD->ctxPtrsOne.R4 + i) = (&pctx->R4 + i);
+ }
+
+ pRD->ctxPtrsOne.Lr = &pctx->Lr;
+
+ // Setup the references
+ pRD->pCurrentContextPointers = &pRD->ctxPtrsOne;
+ pRD->pCallerContextPointers = &pRD->ctxPtrsTwo;
+
+ pRD->pCurrentContext = &(pRD->ctxOne);
+ pRD->pCallerContext = &(pRD->ctxTwo);
+
+ // copy the active context to initialize our stackwalk
+ *(pRD->pCurrentContext) = *(pctx);
+
+ // copy the caller context as well if it's specified
+ if (pCallerCtx == NULL)
+ {
+ pRD->IsCallerContextValid = FALSE;
+ pRD->IsCallerSPValid = FALSE; // Don't add usage of this field. This is only temporary.
+ }
+ else
+ {
+ *(pRD->pCallerContext) = *(pCallerCtx);
+ pRD->IsCallerContextValid = TRUE;
+ pRD->IsCallerSPValid = TRUE; // Don't add usage of this field. This is only temporary.
+ }
+
+ pRD->pPC = &pRD->pCurrentContext->Pc;
+
+#ifdef DEBUG_REGDISPLAY
+ pRD->_pThread = NULL;
+#endif // DEBUG_REGDISPLAY
+
+ // This will setup the PC and SP
+ SyncRegDisplayToCurrentContext(pRD);
+#else
+ PORTABILITY_ASSERT("@NYI Platform - InitRegDisplay (Threads.cpp)");
+#endif
+}
+
+// Initialize a new REGDISPLAY/CONTEXT pair from an existing valid REGDISPLAY.
+inline void CopyRegDisplay(const PREGDISPLAY pInRD, PREGDISPLAY pOutRD, T_CONTEXT *pOutCtx)
+{
+ WRAPPER_NO_CONTRACT;
+
+ // The general strategy is to extract the register state from the input REGDISPLAY
+ // into the new CONTEXT then simply call FillRegDisplay.
+
+ T_CONTEXT* pOutCallerCtx = NULL;
+
+#ifdef _TARGET_X86_
+ if (pInRD->pEdi != NULL) {pOutCtx->Edi = *pInRD->pEdi;} else {pInRD->pEdi = NULL;}
+ if (pInRD->pEsi != NULL) {pOutCtx->Esi = *pInRD->pEsi;} else {pInRD->pEsi = NULL;}
+ if (pInRD->pEbx != NULL) {pOutCtx->Ebx = *pInRD->pEbx;} else {pInRD->pEbx = NULL;}
+ if (pInRD->pEbp != NULL) {pOutCtx->Ebp = *pInRD->pEbp;} else {pInRD->pEbp = NULL;}
+ if (pInRD->pEax != NULL) {pOutCtx->Eax = *pInRD->pEax;} else {pInRD->pEax = NULL;}
+ if (pInRD->pEcx != NULL) {pOutCtx->Ecx = *pInRD->pEcx;} else {pInRD->pEcx = NULL;}
+ if (pInRD->pEdx != NULL) {pOutCtx->Edx = *pInRD->pEdx;} else {pInRD->pEdx = NULL;}
+ pOutCtx->Esp = pInRD->Esp;
+ pOutCtx->Eip = pInRD->ControlPC;
+#else
+ *pOutCtx = *(pInRD->pCurrentContext);
+ if (pInRD->IsCallerContextValid)
+ {
+ pOutCallerCtx = pInRD->pCallerContext;
+ }
+#endif
+
+ if (pOutRD)
+ FillRegDisplay(pOutRD, pOutCtx, pOutCallerCtx);
+}
+
+// Get address of a register in a CONTEXT given the reg number. For X86,
+// the reg number is the R/M number from ModR/M byte or base in SIB byte
+inline size_t * getRegAddr (unsigned regNum, PTR_CONTEXT regs)
+{
+#ifdef _TARGET_X86_
+ switch (regNum)
+ {
+ case 0:
+ return (size_t *)&regs->Eax;
+ break;
+ case 1:
+ return (size_t *)&regs->Ecx;
+ break;
+ case 2:
+ return (size_t *)&regs->Edx;
+ break;
+ case 3:
+ return (size_t *)&regs->Ebx;
+ break;
+ case 4:
+ return (size_t *)&regs->Esp;
+ break;
+ case 5:
+ return (size_t *)&regs->Ebp;
+ break;
+ case 6:
+ return (size_t *)&regs->Esi;
+ break;
+ case 7:
+ return (size_t *)&regs->Edi;
+ break;
+ default:
+ _ASSERTE (!"unknown regNum");
+ }
+#elif defined(_TARGET_AMD64_)
+ _ASSERTE(regNum < 16);
+ return &regs->Rax + regNum;
+#elif defined(_TARGET_ARM_)
+ _ASSERTE(regNum < 16);
+ return (size_t *)&regs->R0 + regNum;
+#elif defined(_TARGET_ARM64_)
+ _ASSERTE(regNum < 31);
+ return (size_t *)&regs->X0 + regNum;
+#else
+ _ASSERTE(!"@TODO Port - getRegAddr (Regdisp.h)");
+#endif
+ return(0);
+}
+
+//---------------------------------------------------------------------------------------
+//
+// This is just a simpler helper function to convert a REGDISPLAY to a CONTEXT.
+//
+// Arguments:
+// pRegDisp - the REGDISPLAY to be converted
+// pContext - the buffer for storing the converted CONTEXT
+//
+inline void UpdateContextFromRegDisp(PREGDISPLAY pRegDisp, PT_CONTEXT pContext)
+{
+ _ASSERTE((pRegDisp != NULL) && (pContext != NULL));
+
+#if defined(_TARGET_X86_)
+ pContext->ContextFlags = (CONTEXT_INTEGER | CONTEXT_CONTROL);
+ pContext->Edi = *pRegDisp->pEdi;
+ pContext->Esi = *pRegDisp->pEsi;
+ pContext->Ebx = *pRegDisp->pEbx;
+ pContext->Ebp = *pRegDisp->pEbp;
+ pContext->Eax = *pRegDisp->pEax;
+ pContext->Ecx = *pRegDisp->pEcx;
+ pContext->Edx = *pRegDisp->pEdx;
+ pContext->Esp = pRegDisp->Esp;
+ pContext->Eip = pRegDisp->ControlPC;
+#else
+ *pContext = *pRegDisp->pCurrentContext;
+#endif
+}
+
+
+#endif // __REGDISP_H
+
+
diff --git a/src/inc/regex_base.h b/src/inc/regex_base.h
new file mode 100644
index 0000000000..28097b2e27
--- /dev/null
+++ b/src/inc/regex_base.h
@@ -0,0 +1,973 @@
+// 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.
+//
+// Provides basic interpreted regular expression matching. This is meant as a debugging tool,
+// and if regular expressions become necessary in a non-debug scenario great care should be
+// used to ensure that performance is not impaired, and a more thorough review of this could
+// would also be a good thing. This file does not include any concrete instantiations but
+// instead provides the basic building blocks. Some concrete instantiations can be found in
+// regex_util.h.
+//
+// NOTE: See code:clr::regex::RegExBase (below) for description of supported regex language.
+//
+// NOTE: we had to forego standard options such as tr1::regex
+// (http://en.wikipedia.org/wiki/Technical_Report_1#Regular_Expressions) and Microsoft's
+// internal GRETA regular expressions (http://toolbox/sites/987/default.aspx) because they
+// both rely heavily on the STL, which can not currently be used within the CLR.
+//
+// NOTE: If this becomes non-debug-only, then read the comment on WCHARItemTraits for what
+// what needs fixing.
+//
+
+//
+
+#ifndef _REGEX_BASE_H_
+#define _REGEX_BASE_H_
+
+// Forward declare namespace so that it is not debug-only (even if currently there is nothing
+// but debug-only code in the namespace). This enables a "using namespace clr;" line in a
+// header file without having to worry about whether or not it's in a debug-only block.
+namespace clr {}
+
+#ifdef _DEBUG
+
+#include "utilcode.h" // for string hash functions
+#include "sstring.h"
+
+namespace clr {
+namespace regex {
+
+// Implementation details. Code contained in any "imp" namespace should never be directly used
+// by clients of RegEx.
+namespace imp {
+
+ //===================================================================================================
+ // Helper for clr::regex::RegExBase. See class definition for clr::regex::RegExBase below for more
+ // information.
+
+ template <typename ITEM_TRAITS, typename GROUP_CONTAINER>
+ class RegExBaseHelper : protected ITEM_TRAITS
+ {
+ public:
+ typedef typename ITEM_TRAITS::RegexIterator RegexIterator;
+ typedef typename ITEM_TRAITS::InputIterator InputIterator;
+
+ typedef typename ITEM_TRAITS::MatchFlags MatchFlags;
+ static const MatchFlags DefaultMatchFlags = ITEM_TRAITS::DefaultMatchFlags;
+
+ // Arguments:
+ // regex : marks the start of the regular expression string.
+ // regexEnd : marks the end of the regular expression string.
+ // input : marks the start of the input string against which regex will be matched.
+ // inputEnd : marks the end of the input string.
+ // groups : recipient of regular expression groups.
+ //
+ // Returns true if the regular expression was successfully matched against the input string;
+ // otherwise false.
+
+ RegExBaseHelper(const RegexIterator& regex,
+ const RegexIterator& regexEnd,
+ const InputIterator& input,
+ const InputIterator& inputEnd,
+ GROUP_CONTAINER& groups,
+ const MatchFlags flags = DefaultMatchFlags);
+
+ // The main entrypoint to RegExBaseHelper, Match will attempt to match the regular expression
+ // defined by [regex,regexEnd) against the input defined by [input,inputEnd).
+ bool Match()
+ { WRAPPER_NO_CONTRACT; return DoMatch(m_regex, m_input); }
+
+ protected:
+ typedef typename ITEM_TRAITS::Item Item;
+ typedef typename ITEM_TRAITS::ItemType ItemType;
+
+ // Try to match regex at any point within input, starting with the first character and moving
+ // along one at a time until a match is found or the end of the input is encountered, whichever
+ // comes first.
+ bool DoMatch(
+ const RegexIterator& regex,
+ InputIterator input);
+
+ // Try to match regex starting exactly at input.
+ bool DoMatchHere(
+ const RegexIterator& regex,
+ const InputIterator& input);
+
+ // The function returns true if a match is found consisting of zero or more items c followed by a
+ // successful match of regex on the remaining input; otherwise false is returned. This is a
+ // conservative match, so it starts with trying to match zero items followed by regex,
+ // and will then try to match one item followed by regex.
+ bool DoMatchStar(
+ const Item& c,
+ const RegexIterator& regex,
+ InputIterator input);
+
+ // The function returns true if a match is found consisting of zero or more items c followed by a
+ // successful match of regex on the remaining input; otherwise false is returned. This is a
+ // greedy match, so it starts with trying to match as many items as it can followed by regex,
+ // and on failure will try again with one less items matched.
+ bool DoMatchStarEagerly(
+ const Item& c,
+ const RegexIterator& regex,
+ InputIterator input);
+
+ // Convenience method.
+ Item GetItem(
+ const RegexIterator &regex)
+ { WRAPPER_NO_CONTRACT; return ITEM_TRAITS::GetItem(regex, m_regexEnd, m_flags); }
+
+ // Convenience method.
+ bool MatchItem(
+ const Item& c,
+ const InputIterator& input)
+ { WRAPPER_NO_CONTRACT; return ITEM_TRAITS::MatchItem(c, input, m_inputEnd, m_flags); }
+
+ // Declared as protected to prevent direct instantiation.
+ RegExBaseHelper()
+ {}
+
+ RegexIterator m_regex;
+ RegexIterator m_regexEnd;
+ InputIterator m_input;
+ InputIterator m_inputEnd;
+ GROUP_CONTAINER& m_groups;
+ MatchFlags m_flags;
+ };
+
+ //---------------------------------------------------------------------------------------------------
+ // This method simply stores the end iterators for the regular expression and the input strings, as
+ // well as the group collection object and flags, and forwards the call to DoMatch.
+
+ template <typename ITEM_TRAITS, typename GROUP_CONTAINER>
+ RegExBaseHelper<ITEM_TRAITS, GROUP_CONTAINER>::RegExBaseHelper(
+ const RegexIterator& regex,
+ const RegexIterator& regexEnd,
+ const InputIterator& input,
+ const InputIterator& inputEnd,
+ GROUP_CONTAINER& groups,
+ const MatchFlags flags)
+ : m_regex(regex),
+ m_regexEnd(regexEnd),
+ m_input(input),
+ m_inputEnd(inputEnd),
+ m_groups(groups),
+ m_flags(flags)
+ { WRAPPER_NO_CONTRACT; }
+
+ //---------------------------------------------------------------------------------------------------
+ // This method checks if the regular expression starts with a caret, indicating that any match must
+ // be anchored at the start of the input string. If such a caret exists, one match attempt is made
+ // on the input starting with the first character and the result is returned. If the regex does not
+ // start with a caret, the method attempts to match against the input string, starting at the first
+ // character and moving one character over for each successive attempt, until a match is found or
+ // the end of the input is encountered, whichever comes first.
+
+ template <typename ITEM_TRAITS, typename GROUP_CONTAINER>
+ inline bool
+ RegExBaseHelper<ITEM_TRAITS, GROUP_CONTAINER>::DoMatch(
+ const RegexIterator& regex,
+ InputIterator input)
+ {
+ WRAPPER_NO_CONTRACT;
+
+ if (GetItem(regex).GetType() == ITEM_TRAITS::CARET)
+ { // Match must occur from the beginning of the line
+ m_groups.OpenGroup(input, m_inputEnd);
+ bool res = DoMatchHere(regex+1, input);
+ if (!res)
+ m_groups.CancelGroup();
+ return res;
+ }
+ else
+ { // Match can happen anywhere in the string
+ do
+ { // Attempt to match against each substring [x,inputEnd) for x = 0...inputEnd
+
+ // Begin the group that contains the entire match.
+ m_groups.OpenGroup(input, m_inputEnd);
+
+ if (DoMatchHere(regex, input))
+ { // Success. Note that the entire match group is closed elsewhere on a
+ // successful match.
+ return true;
+ }
+
+ // On failure, cancel the group so that it can be reopened on the new substring
+ m_groups.CancelGroup();
+ } while (input++ != m_inputEnd);
+ }
+
+ // No successful match found.
+ return false;
+ }
+
+ //-------------------------------------------------------------------------------------------------------
+ // This is the main loop, which handles grouping constructs, repetition directives (*, *?, +, +?), and
+ // EOL matches ($), delegating all character matching to ITEM_TRAITS::MatchItem
+ // The general algorithm is:
+ // 1. Get the next item.
+ // 2. If the item is a DOLLAR type, check to see if we're at the end of the retular expression and
+ // the input string, and if so return success.
+ // 3. If the item is a grouping construct, open or close the appropriate group and continue matching.
+ // On failure, roll back the grouping change so that subsequent attemts will have correct state.
+ // 4. Check to see if the item following the current is a repetition directive, and if so take the
+ // appropriate action.
+ // 5. Otherwise defer to ITEM_TRAITS::MatchItem and if successful continue to match the remaining
+ // regular expression and input string; otherwise return failure.
+
+ template <typename ITEM_TRAITS, typename GROUP_CONTAINER>
+ inline bool
+ RegExBaseHelper<ITEM_TRAITS, GROUP_CONTAINER>::DoMatchHere(
+ const RegexIterator& regex,
+ const InputIterator& input)
+ {
+ WRAPPER_NO_CONTRACT;
+
+ if (regex == m_regexEnd)
+ { // Reached the end of the regular expression without ever returning false,
+ // implying a successful match. Close the overall match group and return.
+ m_groups.CloseGroup(input);
+ return true;
+ }
+
+ Item c0 = GetItem(regex);
+ if (c0.GetType() == ITEM_TRAITS::DOLLAR && (c0.GetNext() == m_regexEnd))
+ { // Matches EOL if a '$' is encountered at the end of the input.
+ m_groups.CloseGroup(input);
+ // Success only if we're actually at the end of the input string.
+ return input == m_inputEnd;
+ }
+ if (c0.GetType() == ITEM_TRAITS::PAREN_OPEN)
+ { // Encountered an open parenthesis ('('); open a new grouping.
+ m_groups.OpenGroup(input, m_inputEnd);
+ bool res = DoMatchHere(c0.GetNext(), input);
+ if (!res)
+ { // If a match fails, there could be further attempts (such as if
+ // there is an active repetition matching frame beneath us), so
+ // need to cancel the group we just opened so that the grouping
+ // structure remains consistent.
+ m_groups.CancelGroup();
+ }
+ return res;
+ }
+ if (c0.GetType() == ITEM_TRAITS::PAREN_CLOSE)
+ { // Close the most recent open grouping.
+ COUNT_T i = m_groups.CloseGroup(input);
+ bool res = DoMatchHere(c0.GetNext(), input);
+ if (!res)
+ { // For the same reasons as the need to cancel an opened group
+ // explained above, we need to reopen the closed group if a
+ // match fails.
+ m_groups.ReopenGroup(i, m_inputEnd);
+ }
+ return res;
+ }
+
+ if (c0.GetNext() != m_regexEnd)
+ { // If there is another item in the regex string following the current one, get
+ // it to see if it is a repetition matching directive.
+ Item c1 = GetItem(c0.GetNext());
+ if (c1.GetType() == ITEM_TRAITS::STAR)
+ { // '*' matching directive encountered
+ if (c1.GetNext() != m_regexEnd)
+ {
+ Item c2 = GetItem(c1.GetNext());
+ if (c2.GetType() == ITEM_TRAITS::QUESTION_MARK)
+ { // conservative matching semantics requested
+ return DoMatchStar(c0, c2.GetNext(), input);
+ }
+ }
+ // Eager matching
+ return DoMatchStarEagerly(c0, c1.GetNext(), input);
+ }
+ if (c1.GetType() == ITEM_TRAITS::PLUS)
+ { // '+' matching directive encountered.
+ if (c1.GetNext() != m_regexEnd)
+ {
+ Item c2 = GetItem(c1.GetNext());
+ if (c2.GetType() == ITEM_TRAITS::QUESTION_MARK)
+ { // conservative matching semantics requested
+ return MatchItem(c0, input) && DoMatchStar(c0, c2.GetNext(), input+1);
+ }
+ }
+ // Eager matching
+ return MatchItem(c0, input) && DoMatchStarEagerly(c0, c1.GetNext(), input+1);
+ }
+ if (c1.GetType() == ITEM_TRAITS::QUESTION_MARK)
+ { // '?' matching directive encountered
+ return (MatchItem(c0, input) && DoMatchHere(c1.GetNext(), input+1)) || DoMatchHere(c1.GetNext(), input);
+ }
+ }
+
+ // No special matching semantics encountered, delegate the matching to ITEM_TRAITS::MatchItem
+ return MatchItem(c0, input) && DoMatchHere(c0.GetNext(), input+1);
+ }
+
+ //-------------------------------------------------------------------------------------------------------
+ // Conservative '*' repetition matching. This attempts to match zero items c followed by a match of
+ // regex. If this fails, attempt to match one item c followed by a match of regex. Repeat until item c
+ // does not match or a successful match is found.
+
+ template <typename ITEM_TRAITS, typename GROUP_CONTAINER>
+ inline bool
+ RegExBaseHelper<ITEM_TRAITS, GROUP_CONTAINER>::DoMatchStar(
+ const Item& c,
+ const RegexIterator& regex,
+ InputIterator input)
+ {
+ WRAPPER_NO_CONTRACT;
+ CONSISTENCY_CHECK(input != m_inputEnd);
+
+ do {
+ if (DoMatchHere(regex, input))
+ { // A successful match is found!
+ return true;
+ }
+ // No successful match, so try to match one more item and then attempt to match regex on the
+ // remaining input.
+ } while (input != m_inputEnd && MatchItem(c, input++));
+ return false;
+ }
+
+ //-------------------------------------------------------------------------------------------------------
+ // Similar to DoMatchStar above, except this algorithm matches as many items c as possible first followed
+ // by regex on the remaining input, and on failure tries again with a match against one less item c
+ // followed by regex on the remaining input, and repeats until there are no items c remaining to match
+ // and the zero item match followed by a match of regex on the entire remaining input fails. If any of
+ // the match attempts succeed, return success.
+
+ template <typename ITEM_TRAITS, typename GROUP_CONTAINER>
+ inline bool
+ RegExBaseHelper<ITEM_TRAITS, GROUP_CONTAINER>::DoMatchStarEagerly(
+ const Item& c,
+ const RegexIterator& regex,
+ InputIterator input)
+ {
+ WRAPPER_NO_CONTRACT;
+
+ // Make sure we keep a hold of how far back we can unwind.
+ InputIterator inputOrig = input;
+
+ // First, determine the maximum number of matches against item c.
+ while (input != m_inputEnd && MatchItem(c, input))
+ {
+ ++input;
+ }
+
+ do
+ { // Work backwards from the maximum number of matches of item c until a match is found
+ // or until we have backed right up to the starting value of input (saved in inputOrig),
+ // at which time we admit failure.
+ if (DoMatchHere(regex, input))
+ return true;
+ } while (inputOrig != input--);
+ return false;
+ }
+
+} // namespace imp
+
+//=======================================================================================================
+// Represents a matched group using iterators to denote the string contained by [Begin(),End()).
+
+template<typename INPUT_ITERATOR>
+class Group
+{
+public:
+ typedef INPUT_ITERATOR InputIterator;
+
+ //
+ // Functions for accessing group properties
+ //
+
+ // Returns the iterator indicating the start of the group
+ const InputIterator& Begin() const
+ { LIMITED_METHOD_CONTRACT; return m_begin; }
+
+ // Returns the iterator indicating the first non-member of the group
+ const InputIterator& End() const
+ { LIMITED_METHOD_CONTRACT; return m_end; }
+
+ // It is possible that m_end - m_begin could be greater than the maximum of COUNT_T. m_end and
+ // m_begin are the end and start of a string, so is entirely unlikely to overflow a COUNT_T.
+ // Conbined with the fact that this is debug-only code, opting not to replace all COUNT_T
+ // uses with SIZE_T.
+ COUNT_T Length() const
+ { WRAPPER_NO_CONTRACT; return static_cast<COUNT_T>(m_end - m_begin); }
+
+ //
+ // Functions used by RegExBaseHelper to create grouping constructs.
+ //
+
+ Group()
+ : m_isClosed(false), m_begin(), m_end()
+ { WRAPPER_NO_CONTRACT; }
+
+ Group(const InputIterator& start, const InputIterator& end, bool isClosed = false)
+ : m_isClosed(isClosed), m_begin(start), m_end(end)
+ { WRAPPER_NO_CONTRACT; }
+
+ void SetBegin(const InputIterator& start)
+ { WRAPPER_NO_CONTRACT; m_begin = start; }
+
+ void SetEnd(const InputIterator& end)
+ { WRAPPER_NO_CONTRACT; m_end = end; }
+
+ bool IsClosed() const
+ { LIMITED_METHOD_CONTRACT; return m_isClosed; }
+
+ void SetIsClosed(bool isClosed)
+ { WRAPPER_NO_CONTRACT; m_isClosed = isClosed; }
+
+protected:
+ bool m_isClosed;
+ InputIterator m_begin;
+ InputIterator m_end;
+};
+
+//=======================================================================================================
+// Represents a generic container of groups, defaulting to using Group<INPUT_ITERATOR> as its element
+// type. This container satisfies the method requrements of RegExBase. When a match is successful, the
+// match groups may be accessed using the index operator or the iterators definin the matched groups
+// [Begin(), End()).
+
+template <typename INPUT_ITERATOR, typename GROUP_TYPE = Group<INPUT_ITERATOR> >
+class GroupContainer
+{
+public:
+ typedef typename SArray<GROUP_TYPE>::Iterator Iterator;
+
+ //
+ // Functions for enumerating groups
+ //
+
+ GROUP_TYPE & operator[](COUNT_T idx)
+ {
+ WRAPPER_NO_CONTRACT;
+ CONSISTENCY_CHECK(((COUNT_T)(COUNT_T)idx) == idx);
+ return m_array[idx];
+ }
+
+ // Returns an iterator to the first matched group (which is always the string for the
+ // entire successfully matched string. Specific groups start at Begin()+1 and continue
+ // to End()-1.
+ Iterator Begin()
+ { WRAPPER_NO_CONTRACT; return m_array.Begin(); }
+
+ // Returns the first invalid iterator value.
+ Iterator End()
+ { WRAPPER_NO_CONTRACT; return m_array.End(); }
+
+ //
+ COUNT_T Count() const
+ { WRAPPER_NO_CONTRACT; return m_array.GetCount(); }
+
+ //
+ // Functions used by RegExBaseHelper to create grouping constructs.
+ //
+
+ // Note: OpenGroup takes an end iterator so that the group will have a valid (if possibly
+ // incorrect) endpoint in the case that the regular expression has unbalanced grouping
+ // parentheses.
+ void OpenGroup(const INPUT_ITERATOR& start, const INPUT_ITERATOR& end)
+ { WRAPPER_NO_CONTRACT; m_array.Append(GROUP_TYPE(start, end, false)); }
+
+ COUNT_T CloseGroup(const INPUT_ITERATOR& end);
+
+ void ReopenGroup(COUNT_T i, const INPUT_ITERATOR& end);
+
+ void CancelGroup()
+ { WRAPPER_NO_CONTRACT; m_array.Delete(m_array.End() - 1); }
+
+private:
+ SArray<GROUP_TYPE> m_array;
+};
+
+//-------------------------------------------------------------------------------------------------------
+// Works backwards from the most recently created group looking for an open group to close. Returns
+// the index of the group that was closed, which is used in the event that a group needs to be
+// reopened.
+
+template <typename INPUT_ITERATOR, typename GROUP_TYPE>
+COUNT_T
+GroupContainer<INPUT_ITERATOR, GROUP_TYPE>::CloseGroup(
+ const INPUT_ITERATOR& end)
+{
+ WRAPPER_NO_CONTRACT;
+
+ for (COUNT_T i = (COUNT_T)Count(); i > 0; --i)
+ {
+ if (!m_array[i-1].IsClosed())
+ {
+ m_array[i-1].SetEnd(end);
+ m_array[i-1].SetIsClosed(true);
+ return i-1;
+ }
+ }
+
+ _ASSERTE(!"Unmatched grouping constructs!");
+ return 0;
+}
+
+//-------------------------------------------------------------------------------------------------------
+// Reopen a group at the given index, using 'end' to overwrite the current end.
+
+template <typename INPUT_ITERATOR, typename GROUP_TYPE>
+void
+GroupContainer<INPUT_ITERATOR, GROUP_TYPE>::ReopenGroup(
+ COUNT_T i,
+ const INPUT_ITERATOR& end)
+{
+ WRAPPER_NO_CONTRACT;
+ CONSISTENCY_CHECK(i > 0 && i < Count());
+
+ if (i > 0 && i < Count())
+ {
+ m_array[i].SetEnd(end);
+ m_array[i].SetIsClosed(false);
+ }
+}
+
+//=======================================================================================================
+// Empty group container that satisfies the method requirements of RegExBase but has empty bodies. This
+// allows for non-allocating matches when grouping is not required.
+
+template <typename INPUT_ITERATOR>
+class NullGroupContainer
+{
+public:
+ void OpenGroup(INPUT_ITERATOR, INPUT_ITERATOR) {}
+ COUNT_T CloseGroup(INPUT_ITERATOR) { return 0; }
+ void ReopenGroup(COUNT_T, INPUT_ITERATOR) {}
+ void CancelGroup() {}
+};
+
+//=======================================================================================================
+// This mini-implementation of regular expression matching supports the
+// following constructs:
+// ^ matches the beginning of the input string
+// $ matches the end of the input string
+// * matches zero or more occurrences of the previous item eagerly
+// *? matches zero or more occurrences of the previous item conservatively
+// + matches 1 or more occurrences of the previous item eagerly
+// +? matches 1 or more occurrences of the previous item conservatively
+// ? matches 0 or 1 occurences of the previous item
+// ( starts a grouping
+// ) ends a grouping
+//
+// IMPORTANT: These are just anchoring and grouping constructs. See the definition for ItemTraitsBase
+// below for information on the default character classes that are supported. (The intent of
+// this separation is to allow customization of the character classes where required.)
+
+// ITEM_TRAITS provides traits for individual tokens in a regular expression, as well as a mechanism for
+// matching said individual components with the target string. RegexBase derives from ITEM_TRAITS in a
+// protected fashion, and is responsible for providing the following:
+// 1. "RegexIterator" typedef
+// Used as an iterator into the regular expression, and used as arguments to indicate the start
+// and the end of the regular expression string.
+// 2. "InputIterator" typedef
+// Used as an iterator into the input string, and used as arguments to indicate the start
+// and the end of the input string.
+// (NOTE: RegexIterator and InputIterator are often typedef'ed to be the same thing.)
+// 3. "Item" typedef.
+// This will be used with methods GetItem and MatchItem (see below). Item must
+// define the the following methods:
+// ItemType GetType() : returns the type of the item. See below for explanation of ItemType
+// const RegexIterator& GetNext() : iterator pointing to the start of the next item.
+// 4. "MatchFlags" typedef, and "static const DefaultMatchFlags" value.
+// Provided for calls to "Match" and "Matches", and passed on to calls "GetItem" and "MatchItem".
+// 5. enum ItemType
+// Defines the following minimum values:
+// DOT
+// CARET
+// DOLLAR
+// STAR
+// QUESTION_MARK
+// PLUS
+// PAREN_OPEN
+// PAREN_CLOSE
+// ItemType may include more values, and may even choose to ignore the above enum types, all of
+// which must be recognized by GetItem and MatchItem (see below).
+// 6. static Item GetItem(const RegexIterator& regex,
+// const RegexIterator& regexEnd,
+// const MatchFlags& flags)
+// This method takes a regular expression iterator and returns the next regular expression
+// element (Item) pointed to by the iterator.
+// 7. static bool MatchItem(const Item& c,
+// const InputIterator& input,
+// const InputIterator& inputEnd,
+// const MatchFlags &flags)
+
+// GROUP_CONTAINER provides functionality for keeping track of regular expression groups. This is a generic
+// argument to Match, and the type of the object must support the following methods:
+// 1. void OpenGroup(const InputIterator& start, const InputIterator& end);
+// Called when a PAREN_OPEN item is encountered.
+// 2. COUNT_T CloseGroup(const InputIterator& end);
+// Called when a PAREN_CLOSE item is encountered. Returns the index of the group that was closed.
+// 3. void ReopenGroup(COUNT_T i, const InputIterator& end);
+// Called when a match following a call to CloseGroup fails, essentially requesting a rollback
+// of the call to CloseGroup.
+// 4. void CancelGroup();
+// Called when a match following a call to OpenGroup fails, essentially requesting a rollback
+// of the call to OpenGroup.
+
+template <typename ITEM_TRAITS>
+class RegExBase : public ITEM_TRAITS
+{
+public:
+ typedef typename ITEM_TRAITS::RegexIterator RegexIterator;
+ typedef typename ITEM_TRAITS::InputIterator InputIterator;
+
+ // This is a convenience typedef that allows a caller to easily declare a grouping container
+ // to be passed to a call to Match. An example would be (see regex_util.h for a definition of
+ // SStringRegEx):
+ //
+ // SString input(SL"Simmons");
+ // SStringRegEx::GroupingContainer container;
+ // if (SStringRegEx::Match(SL"(Sim+on)", input, container)) {
+ // printf("%S", container[1].GetSString(input).GetUnicode());
+ // }
+ //
+ typedef GroupContainer<InputIterator, Group<InputIterator> > GroupingContainer;
+
+ // Pulls down the typedef for MatchFlags and initialized a static representing the default flags.
+ typedef typename ITEM_TRAITS::MatchFlags MatchFlags;
+ static const MatchFlags DefaultMatchFlags = ITEM_TRAITS::DefaultMatchFlags;
+
+ template <typename GROUP_CONTAINER>
+ static bool Match(RegexIterator regex,
+ RegexIterator regexEnd,
+ InputIterator input,
+ InputIterator inputEnd,
+ GROUP_CONTAINER& groups,
+ MatchFlags flags = DefaultMatchFlags)
+ {
+ imp::RegExBaseHelper<ITEM_TRAITS, GROUP_CONTAINER>
+ re(regex, regexEnd, input, inputEnd, groups, flags);
+ return re.Match();
+ }
+
+ static bool Matches(RegexIterator regex,
+ RegexIterator regexEnd,
+ InputIterator input,
+ InputIterator inputEnd,
+ MatchFlags flags = DefaultMatchFlags)
+ {
+ NullGroupContainer<InputIterator> ngc;
+ return Match(regex, regexEnd, input, inputEnd, ngc, flags);
+ }
+};
+
+//=======================================================================================================
+// In addition to requirements specified on RegExBase, StandardItemTraits provides the following
+// additinal regular expression item types.
+// c matches any literal character c
+// . matches any single character
+// \d any literal digit character
+// \w any alpha character
+// \s any whitespace character
+//
+// Child types of ItemTraitsBase must implement GetItem and MatchItem (see below for full
+// signature requirements). Current child type implementations permit a backslash ('\') to escape
+// special characters ('.', '$', '*', etc.) and allow them to be interpreted as literal characters.
+//
+// This type describes a particular behaviour, but must be subtyped for the particular target character
+// needed, and GetItem and MatchItem must be implemented.
+//
+
+template <typename ITERATOR_TYPE, typename CHAR_TYPE>
+class ItemTraitsBase
+{
+public:
+ typedef ITERATOR_TYPE RegexIterator;
+ typedef ITERATOR_TYPE InputIterator;
+
+ enum MatchFlags
+ {
+ MF_NONE = 0x00,
+ MF_CASE_INSENSITIVE = 0x01 // Match character literals as case insensitive.
+ };
+
+ static const MatchFlags DefaultMatchFlags = MF_NONE;
+
+protected:
+ ItemTraitsBase()
+ {}
+
+ enum ItemType
+ {
+ // REQUIRED, as described in RegExBase
+ CARET,
+ DOLLAR,
+ STAR,
+ QUESTION_MARK,
+ PLUS,
+ PAREN_OPEN,
+ PAREN_CLOSE,
+ // ADDITIONAL
+ DOT, // any literal character
+ DIGIT, // any digit
+ ALPHA, // any alpha character, upper or lower case
+ WHITESPACE, // any whitespace character
+ NON_WHITESPACE, // any non-whitespace character
+ CHARACTER, // a specific literal character
+ };
+
+ class Item
+ {
+ public:
+ Item(ItemType type, CHAR_TYPE val, const RegexIterator& next)
+ : m_type(type), m_val(val), m_next(next)
+ { WRAPPER_NO_CONTRACT; }
+
+ Item(ItemType type, const RegexIterator& next)
+ : m_type(type), m_val(0), m_next(next)
+ { WRAPPER_NO_CONTRACT; }
+
+ ItemType GetType() const
+ { LIMITED_METHOD_CONTRACT; return m_type; }
+
+ const RegexIterator& GetNext() const
+ { LIMITED_METHOD_CONTRACT; return m_next; }
+
+ CHAR_TYPE GetValue() const
+ { LIMITED_METHOD_CONTRACT; return m_val; }
+
+ protected:
+ ItemType m_type;
+ CHAR_TYPE m_val;
+ RegexIterator m_next;
+ };
+
+ // All deriving types must add the following methods:
+ // static Item GetItem(const RegexIterator& regex, const RegexIterator& regexEnd);
+ // static bool MatchItem(const Item& c, const InputIterator& input, const InputIterator& inputEnd);
+};
+
+//=======================================================================================================
+// Implements ItemTraitsBase, provides matching for UNICODE characters.
+//
+// !!!IMPORTANT!!!
+// This is not a complete unicode implementation - only the equivalent of ASCII alpha characters are
+// consider to be part of the alpha set, and this is also the only set on which case insensitive
+// operations will correctly work. If RegEx is moved out of DEBUG ONLY, then this will have to be fixed
+// to properly address these issues.
+// !!!IMPORTANT!!!
+
+template <typename ITERATOR_TYPE>
+class WCHARItemTraits : public ItemTraitsBase<ITERATOR_TYPE, WCHAR>
+{
+public:
+ typedef ItemTraitsBase<ITERATOR_TYPE, WCHAR> PARENT_TYPE;
+ typedef typename PARENT_TYPE::RegexIterator RegexIterator;
+ typedef typename PARENT_TYPE::InputIterator InputIterator;
+ typedef typename PARENT_TYPE::Item Item;
+ typedef typename PARENT_TYPE::MatchFlags MatchFlags;
+
+ static Item GetItem(const RegexIterator& regex, const RegexIterator& regexEnd, MatchFlags flags);
+ static bool MatchItem(const Item& c, const InputIterator& input, const InputIterator& inputEnd, MatchFlags flags);
+
+protected:
+ WCHARItemTraits()
+ {}
+
+private:
+ static inline bool IS_UPPER_A_TO_Z(WCHAR x)
+ { WRAPPER_NO_CONTRACT; return (((x) >= W('A')) && ((x) <= W('Z'))); }
+
+ static inline bool IS_LOWER_A_TO_Z(WCHAR x)
+ { WRAPPER_NO_CONTRACT; return (((x) >= W('a')) && ((x) <= W('z'))); }
+
+ static inline WCHAR UPCASE(WCHAR x)
+ { WRAPPER_NO_CONTRACT; return (IS_LOWER_A_TO_Z(x) ? ((x) - W('a') + W('A')) : (x)); }
+
+ static inline WCHAR DOWNCASE(WCHAR x)
+ { WRAPPER_NO_CONTRACT; return (IS_UPPER_A_TO_Z(x) ? ((x) - W('A') + W('a')) : (x)); }
+
+ static bool MatchCharacter(WCHAR c1, WCHAR c2, MatchFlags flags)
+ { WRAPPER_NO_CONTRACT; return (flags & PARENT_TYPE::MF_CASE_INSENSITIVE) ? (DOWNCASE(c1) == DOWNCASE(c2)) : (c1 == c2); }
+};
+
+//-------------------------------------------------------------------------------------------------------
+// Reads the next item from regex, recognizing special characters outlined in ItemTraitsBase.
+
+template <typename ITERATOR_TYPE>
+typename WCHARItemTraits<ITERATOR_TYPE>::Item
+WCHARItemTraits<ITERATOR_TYPE>::GetItem(
+ const RegexIterator& regex,
+ const RegexIterator& regexEnd,
+ MatchFlags flags)
+{
+ WRAPPER_NO_CONTRACT;
+
+ if (*regex == W('\\'))
+ {
+ const RegexIterator regexNext = regex+1;
+ if (regexNext == regexEnd)
+ return Item(PARENT_TYPE::CHARACTER, W('\\'), regexNext);
+ if (*regexNext == W('d'))
+ return Item(PARENT_TYPE::DIGIT, regexNext+1);
+ if (*regexNext == W('w'))
+ return Item(PARENT_TYPE::ALPHA, regexNext+1);
+ if (*regexNext == W('s'))
+ return Item(PARENT_TYPE::WHITESPACE, regexNext+1);
+ if (*regexNext == W('S'))
+ return Item(PARENT_TYPE::NON_WHITESPACE, regexNext+1);
+ return Item(PARENT_TYPE::CHARACTER, *regexNext, regexNext+1);
+ }
+ else if (*regex == W('.'))
+ return Item(PARENT_TYPE::DOT, W('.'), regex+1);
+ else if (*regex == W('^'))
+ return Item(PARENT_TYPE::CARET, W('^'), regex+1);
+ else if (*regex == W('$'))
+ return Item(PARENT_TYPE::DOLLAR, W('$'), regex+1);
+ else if (*regex == W('*'))
+ return Item(PARENT_TYPE::STAR, W('*'), regex+1);
+ else if (*regex == W('?'))
+ return Item(PARENT_TYPE::QUESTION_MARK, W('?'), regex+1);
+ else if (*regex == W('+'))
+ return Item(PARENT_TYPE::PLUS, W('+'), regex+1);
+ else if (*regex == W('('))
+ return Item(PARENT_TYPE::PAREN_OPEN, W('('), regex+1);
+ else if (*regex == W(')'))
+ return Item(PARENT_TYPE::PAREN_CLOSE, W(')'), regex+1);
+ else
+ return Item(PARENT_TYPE::CHARACTER, *regex, regex + 1);
+}
+
+//-------------------------------------------------------------------------------------------------------
+// Returns true if the next character point to by input matches the character class described by c.
+
+template <typename ITERATOR_TYPE>
+bool
+WCHARItemTraits<ITERATOR_TYPE>::MatchItem(
+ const Item& c,
+ const InputIterator& input,
+ const InputIterator& inputEnd,
+ MatchFlags flags)
+{
+ WRAPPER_NO_CONTRACT;
+
+ if (c.GetType() == PARENT_TYPE::DIGIT)
+ return *input >= W('0') && *input <= W('9');
+ else if (c.GetType() == PARENT_TYPE::ALPHA)
+ return (*input >= W('a') && *input <= W('z')) || (*input >= W('A') && *input <= W('Z'));
+ else if (c.GetType() == PARENT_TYPE::WHITESPACE)
+ return *input == W(' ') || *input == W('\t');
+ else if (c.GetType() == PARENT_TYPE::NON_WHITESPACE)
+ return !(*input == W(' ') || *input == W('\t'));
+ else
+ return c.GetType() == PARENT_TYPE::DOT || MatchCharacter(c.GetValue(), *input, flags);
+}
+
+//=======================================================================================================
+// Implements ItemTraitsBase, provides matching for ASCII (*not* UTF8) characters.
+
+template <typename ITERATOR_TYPE>
+class CHARItemTraits : public ItemTraitsBase<ITERATOR_TYPE, CHAR>
+{
+public:
+ typedef ItemTraitsBase<ITERATOR_TYPE, CHAR> PARENT_TYPE;
+ typedef typename PARENT_TYPE::RegexIterator RegexIterator;
+ typedef typename PARENT_TYPE::InputIterator InputIterator;
+ typedef typename PARENT_TYPE::Item Item;
+ typedef typename PARENT_TYPE::MatchFlags MatchFlags;
+
+ static Item GetItem(const RegexIterator& regex, const RegexIterator& regexEnd, MatchFlags flags);
+ static bool MatchItem(const Item& c, const InputIterator& input, const InputIterator& inputEnd, MatchFlags flags);
+
+protected:
+ CHARItemTraits()
+ {}
+
+private:
+ static inline bool IS_UPPER_A_TO_Z(CHAR x)
+ { WRAPPER_NO_CONTRACT; return (((x) >= 'A') && ((x) <= 'Z')); }
+
+ static inline bool IS_LOWER_A_TO_Z(CHAR x)
+ { WRAPPER_NO_CONTRACT; return (((x) >= 'a') && ((x) <= 'z')); }
+
+ static inline CHAR UPCASE(CHAR x)
+ { WRAPPER_NO_CONTRACT; return (IS_LOWER_A_TO_Z(x) ? ((x) - 'a' + 'A') : (x)); }
+
+ static inline CHAR DOWNCASE(CHAR x)
+ { WRAPPER_NO_CONTRACT; return (IS_UPPER_A_TO_Z(x) ? ((x) - 'A' + 'a') : (x)); }
+
+ static bool MatchCharacter(CHAR c1, CHAR c2, MatchFlags flags)
+ { WRAPPER_NO_CONTRACT; return (flags & PARENT_TYPE::MF_CASE_INSENSITIVE) ? (DOWNCASE(c1) == DOWNCASE(c2)) : (c1 == c2); }
+};
+
+//-------------------------------------------------------------------------------------------------------
+// Reads the next item from regex, recognizing special characters outlined in ItemTraitsBase.
+
+template <typename ITERATOR_TYPE>
+typename CHARItemTraits<ITERATOR_TYPE>::Item
+CHARItemTraits<ITERATOR_TYPE>::GetItem(
+ const RegexIterator& regex,
+ const RegexIterator& regexEnd,
+ MatchFlags flags)
+{
+ WRAPPER_NO_CONTRACT;
+
+ if (*regex == '\\')
+ {
+ const RegexIterator regexNext = regex+1;
+ if (regexNext == regexEnd)
+ return Item(PARENT_TYPE::CHARACTER, W('\\'), regexNext);
+ if (*regexNext == 'd')
+ return Item(PARENT_TYPE::DIGIT, regexNext+1);
+ if (*regexNext == 'w')
+ return Item(PARENT_TYPE::ALPHA, regexNext+1);
+ if (*regexNext == 's')
+ return Item(PARENT_TYPE::WHITESPACE, regexNext+1);
+ return Item(PARENT_TYPE::CHARACTER, *regexNext, regexNext+1);
+ }
+ else if (*regex == '.')
+ return Item(PARENT_TYPE::DOT, '.', regex+1);
+ else if (*regex == '^')
+ return Item(PARENT_TYPE::CARET, '^', regex+1);
+ else if (*regex == '$')
+ return Item(PARENT_TYPE::DOLLAR, '$', regex+1);
+ else if (*regex == '*')
+ return Item(PARENT_TYPE::STAR, '*', regex+1);
+ else if (*regex == '?')
+ return Item(PARENT_TYPE::QUESTION_MARK, '?', regex+1);
+ else if (*regex == '+')
+ return Item(PARENT_TYPE::PLUS, '+', regex+1);
+ else if (*regex == '(')
+ return Item(PARENT_TYPE::PAREN_OPEN, '(', regex+1);
+ else if (*regex == ')')
+ return Item(PARENT_TYPE::PAREN_CLOSE, ')', regex+1);
+ else
+ return Item(PARENT_TYPE::CHARACTER, *regex, regex + 1);
+}
+
+//-------------------------------------------------------------------------------------------------------
+// Returns true if the next character point to by input matches the character class described by c.
+
+template <typename ITERATOR_TYPE>
+bool
+CHARItemTraits<ITERATOR_TYPE>::MatchItem(
+ const Item& c,
+ const InputIterator& input,
+ const InputIterator& inputEnd,
+ MatchFlags flags)
+{
+ WRAPPER_NO_CONTRACT;
+
+ if (c.GetType() == PARENT_TYPE::DIGIT)
+ return *input >= W('0') && *input <= W('9');
+ else if (c.GetType() == PARENT_TYPE::ALPHA)
+ return (*input >= W('a') && *input <= W('z')) || (*input >= W('A') && *input <= W('Z'));
+ else if (c.GetType() == PARENT_TYPE::WHITESPACE)
+ return *input == W(' ') || *input == W('\t');
+ else
+ return c.GetType() == PARENT_TYPE::DOT || MatchCharacter(c.GetValue(), *input, flags);
+}
+
+} /* namespace regex */
+} /* namespace clr */
+
+#endif // _DEBUG
+
+#endif // _REGEX_BASE_H_
diff --git a/src/inc/regex_util.h b/src/inc/regex_util.h
new file mode 100644
index 0000000000..438c8b133a
--- /dev/null
+++ b/src/inc/regex_util.h
@@ -0,0 +1,209 @@
+// 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.
+
+// See regex_base.h for more information.
+//
+// This header creates some concrete instantiations of RegExBase for commonly used scenarios. In
+// particular, basic regular expression matching base on the regular expression language described in
+// clr::regex::ItemTraitsBase (found in regex_base.h) is instantiated for use with SString, ASCII and
+// UNICODE strings (clr::regex::SStringRegex, clr::regex::WSTRRegEx, and clr::regex::STRRegEx
+// respectively). Each type definition includes an example of its use.
+//
+
+//
+
+#ifndef _REGEX_UTIL_H_
+#define _REGEX_UTIL_H_
+
+#ifndef MODE_ANY
+#define MODE_ANY
+#endif
+
+#include "regex_base.h"
+
+#ifdef _DEBUG
+
+namespace clr
+{
+namespace regex
+{
+
+//=======================================================================================================
+// Derives from Group to provide two additional convenience methods (GetSString variants).
+
+class SStringGroup : public Group<SString::CIterator>
+{
+public:
+ SStringGroup()
+ : Group<SString::CIterator>()
+ { WRAPPER_NO_CONTRACT; }
+
+ SStringGroup(const InputIterator& _start, const InputIterator& _end, bool _isClosed = false)
+ : Group<SString::CIterator>(_start, _end, _isClosed)
+ { WRAPPER_NO_CONTRACT; }
+
+ // Since SStrings constructed from ranges require the original source string, this is a required
+ // input argument. Returns the input substring that matches the corresponding grouping.
+ SString GetSString(const SString& src)
+ { WRAPPER_NO_CONTRACT; return SString(src, Begin(), End()); }
+
+ // Since SStrings constructed from ranges require the original source string, this is a required
+ // input argument. This version takes a target SString as a buffer, and also returns this buffer
+ // as a reference. Returns the input substring that matches the corresponding grouping.
+ SString& GetSString(const SString& src, SString& tgt)
+ { WRAPPER_NO_CONTRACT; tgt.Set(src, Begin(), End()); return tgt; }
+};
+
+//=======================================================================================================
+typedef WCHARItemTraits<SString::CIterator> SStringItemTraits;
+
+//=======================================================================================================
+// Regular expression matching with SStrings.
+//
+// Here is an example of how to use SStringRegEx with grouping enabled.
+//
+// using namespace clr::regex;
+// SString input(SL"Simmons"); // usually this is derived from some variable source
+// SStringRegEx::GroupingContainer container;
+// if (SStringRegEx::Match(SL"(Sim+on)", input, container)) {
+// printf("%S", container[1].GetSString(input).GetUnicode());
+// }
+//
+// This sample should result in "Simmon" being printed.
+
+
+class SStringRegEx : public RegExBase<SStringItemTraits>
+{
+ typedef RegExBase<SStringItemTraits> PARENT_TYPE;
+
+public:
+ using PARENT_TYPE::Match;
+ using PARENT_TYPE::Matches;
+
+ typedef PARENT_TYPE::InputIterator InputIterator;
+
+ typedef GroupContainer<InputIterator, SStringGroup > GroupingContainer;
+
+ static bool Match(
+ const SString& regex,
+ const SString& input,
+ GroupingContainer& groups,
+ MatchFlags flags = DefaultMatchFlags)
+ {
+ WRAPPER_NO_CONTRACT;
+ return Match(regex.Begin(), regex.End(), input.Begin(), input.End(), groups, flags);
+ }
+
+ static bool Matches(
+ const SString& regex,
+ const SString& input,
+ MatchFlags flags = DefaultMatchFlags)
+ {
+ WRAPPER_NO_CONTRACT;
+ return Matches(regex.Begin(), regex.End(), input.Begin(), input.End(), flags);
+ }
+
+};
+
+//=======================================================================================================
+// Regular expression matching with UNICODE strings.
+//
+// Here is an example of how to use WSTRRegEx to match against a null-terminated string without grouping.
+//
+// using namespace clr::regex;
+// LPCWSTR input = L"Simmons";
+// if (WSTRRegEx::Matches(L"Sim+on", input))
+// printf("Match succeeded");
+// else
+// printf("Match failed");
+//
+// This sample should result in "Match succeeded" being printed.
+
+class WSTRRegEx : public RegExBase<WCHARItemTraits<LPCWSTR> >
+{
+ typedef RegExBase<WCHARItemTraits<LPCWSTR> > PARENT_TYPE;
+
+public:
+ using PARENT_TYPE::Match;
+ using PARENT_TYPE::Matches;
+
+ static bool Match(
+ LPCWSTR regex,
+ LPCWSTR input,
+ GroupingContainer& groups,
+ MatchFlags flags = DefaultMatchFlags)
+ {
+ WRAPPER_NO_CONTRACT;
+ return Match(regex, regex + wcslen(regex), input, input + wcslen(input), groups, flags);
+ }
+
+ static bool Matches(
+ LPCWSTR regex,
+ LPCWSTR input,
+ MatchFlags flags = DefaultMatchFlags)
+ {
+ CONTRACTL {
+ NOTHROW;
+ GC_NOTRIGGER;
+ MODE_ANY;
+ } CONTRACTL_END;
+
+ return Matches(regex, regex + wcslen(regex), input, input + wcslen(input), flags);
+ }
+};
+
+//=======================================================================================================
+// Regular expression matching with ASCII strings.
+//
+// Here is an example of how to use STRRegEx to match against a substring based on begin and end range
+// pointers, with grouping disabled and case insensitivity enabled.
+//
+// using namespace clr::regex;
+// LPCSTR input = "123Simmons456";
+// if (STRRegEx::Matches("Sim+on", input+3, input+10, STRRegEx::MF_CASE_INSENSITIVE))
+// printf("Match succeeded");
+// else
+// printf("Match failed");
+//
+// This sample should result in "Match succeeded" being printed.
+
+class STRRegEx : public RegExBase<CHARItemTraits<LPCSTR> >
+{
+ typedef RegExBase<CHARItemTraits<LPCSTR> > PARENT_TYPE;
+
+public:
+ using PARENT_TYPE::Match;
+ using PARENT_TYPE::Matches;
+
+ static bool Match(
+ LPCSTR regex,
+ LPCSTR input,
+ GroupingContainer& groups,
+ MatchFlags flags = DefaultMatchFlags)
+ {
+ WRAPPER_NO_CONTRACT;
+ return Match(regex, regex + strlen(regex), input, input + strlen(input), groups, flags);
+ }
+
+ static bool Matches(
+ LPCSTR regex,
+ LPCSTR input,
+ MatchFlags flags = DefaultMatchFlags)
+ {
+ CONTRACTL {
+ NOTHROW;
+ GC_NOTRIGGER;
+ MODE_ANY;
+ } CONTRACTL_END;
+
+ return Matches(regex, regex + strlen(regex), input, input + strlen(input), flags);
+ }
+};
+
+} // namespace regex
+} // namespace clr
+
+#endif // _DEBUG
+
+#endif // _REGEX_UTIL_H_
diff --git a/src/inc/registrywrapper.h b/src/inc/registrywrapper.h
new file mode 100644
index 0000000000..bd6afe190b
--- /dev/null
+++ b/src/inc/registrywrapper.h
@@ -0,0 +1,48 @@
+// 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.
+//*****************************************************************************
+// File: registrywrapper.h
+//
+// Wrapper around Win32 Registry Functions allowing redirection of .Net
+// Framework root registry location
+//
+//*****************************************************************************
+#ifndef __REGISTRYWRAPPER_H
+#define __REGISTRYWRAPPER_H
+
+#if !defined(FEATURE_UTILCODE_NO_DEPENDENCIES) && !defined(FEATURE_CORECLR)
+
+// Registry API wrappers
+
+LONG ClrRegCreateKeyEx(
+ HKEY hKey,
+ LPCWSTR lpSubKey,
+ DWORD Reserved,
+ __in_opt LPWSTR lpClass,
+ DWORD dwOptions,
+ REGSAM samDesired,
+ LPSECURITY_ATTRIBUTES lpSecurityAttributes,
+ PHKEY phkResult,
+ LPDWORD lpdwDisposition
+ );
+
+LONG ClrRegOpenKeyEx(
+ HKEY hKey,
+ LPCWSTR lpSubKey,
+ DWORD ulOptions,
+ REGSAM samDesired,
+ PHKEY phkResult
+ );
+
+bool IsNgenOffline();
+
+#else
+
+#define ClrRegCreateKeyEx RegCreateKeyExW
+#define ClrRegOpenKeyEx RegOpenKeyExW
+#define IsNgenOffline() false
+
+#endif
+
+#endif // __REGISTRYWRAPPER_H
diff --git a/src/inc/safemath.h b/src/inc/safemath.h
new file mode 100644
index 0000000000..073c998548
--- /dev/null
+++ b/src/inc/safemath.h
@@ -0,0 +1,872 @@
+// 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.
+// ---------------------------------------------------------------------------
+// safemath.h
+//
+// overflow checking infrastructure
+// ---------------------------------------------------------------------------
+
+
+#ifndef SAFEMATH_H_
+#define SAFEMATH_H_
+
+// This file is included from several places outside the CLR, so we can't
+// pull in files like DebugMacros.h. However, we assume that the standard
+// clrtypes (UINT32 etc.) are defined.
+#include "debugmacrosext.h"
+
+#ifndef _ASSERTE_SAFEMATH
+#ifdef _ASSERTE
+// Use _ASSERTE if we have it (should always be the case in the CLR)
+#define _ASSERTE_SAFEMATH _ASSERTE
+#else
+// Otherwise (eg. we're being used from a tool like SOS) there isn't much
+// we can rely on that is both available everywhere and rotor-safe. In
+// several other tools we just take the recourse of disabling asserts,
+// we'll do the same here.
+// Ideally we'd have a collection of common utilities available evererywhere.
+#define _ASSERTE_SAFEMATH(a)
+#endif
+#endif
+
+#include "static_assert.h"
+
+#ifdef PAL_STDCPP_COMPAT
+#include <type_traits>
+#else
+#include "clr_std/type_traits"
+#endif
+
+//==================================================================
+// Semantics: if val can be represented as the exact same value
+// when cast to Dst type, then FitsIn<Dst>(val) will return true;
+// otherwise FitsIn returns false.
+//
+// Dst and Src must both be integral types.
+//
+// It's important to note that most of the conditionals in this
+// function are based on static type information and as such will
+// be optimized away. In particular, the case where the signs are
+// identical will result in no code branches.
+
+#ifdef _PREFAST_
+#pragma warning(push)
+#pragma warning(disable:6326) // PREfast warning: Potential comparison of a constant with another constant
+#endif // _PREFAST_
+
+template <typename Dst, typename Src>
+inline bool FitsIn(Src val)
+{
+#ifdef _MSC_VER
+ static_assert_no_msg(!__is_class(Dst));
+ static_assert_no_msg(!__is_class(Src));
+#endif
+
+ if (std::is_signed<Src>::value == std::is_signed<Dst>::value)
+ { // Src and Dst are equally signed
+ if (sizeof(Src) <= sizeof(Dst))
+ { // No truncation is possible
+ return true;
+ }
+ else
+ { // Truncation is possible, requiring runtime check
+ return val == (Src)((Dst)val);
+ }
+ }
+ else if (std::is_signed<Src>::value)
+ { // Src is signed, Dst is unsigned
+#ifdef __GNUC__
+ // Workaround for GCC warning: "comparison is always
+ // false due to limited range of data type."
+ if (!(val == 0 || val > 0))
+#else
+ if (val < 0)
+#endif
+ { // A negative number cannot be represented by an unsigned type
+ return false;
+ }
+ else
+ {
+ if (sizeof(Src) <= sizeof(Dst))
+ { // No truncation is possible
+ return true;
+ }
+ else
+ { // Truncation is possible, requiring runtime check
+ return val == (Src)((Dst)val);
+ }
+ }
+ }
+ else
+ { // Src is unsigned, Dst is signed
+ if (sizeof(Src) < sizeof(Dst))
+ { // No truncation is possible. Note that Src is strictly
+ // smaller than Dst.
+ return true;
+ }
+ else
+ { // Truncation is possible, requiring runtime check
+#ifdef __GNUC__
+ // Workaround for GCC warning: "comparison is always
+ // true due to limited range of data type." If in fact
+ // Dst were unsigned we'd never execute this code
+ // anyway.
+ return ((Dst)val > 0 || (Dst)val == 0) &&
+#else
+ return ((Dst)val >= 0) &&
+#endif
+ (val == (Src)((Dst)val));
+ }
+ }
+}
+
+// Requires that Dst is an integral type, and that DstMin and DstMax are the
+// minimum and maximum values of that type, respectively. Returns "true" iff
+// "val" can be represented in the range [DstMin..DstMax] (allowing loss of precision, but
+// not truncation).
+template <INT64 DstMin, UINT64 DstMax>
+inline bool FloatFitsInIntType(float val)
+{
+ float DstMinF = static_cast<float>(DstMin);
+ float DstMaxF = static_cast<float>(DstMax);
+ return DstMinF <= val && val <= DstMaxF;
+}
+
+template <INT64 DstMin, UINT64 DstMax>
+inline bool DoubleFitsInIntType(double val)
+{
+ double DstMinD = static_cast<double>(DstMin);
+ double DstMaxD = static_cast<double>(DstMax);
+ return DstMinD <= val && val <= DstMaxD;
+}
+
+#ifdef _PREFAST_
+#pragma warning(pop)
+#endif //_PREFAST_
+
+#define ovadd_lt(a, b, rhs) (((a) + (b) < (rhs) ) && ((a) + (b) >= (a)))
+#define ovadd_le(a, b, rhs) (((a) + (b) <= (rhs) ) && ((a) + (b) >= (a)))
+#define ovadd_gt(a, b, rhs) (((a) + (b) > (rhs) ) || ((a) + (b) < (a)))
+#define ovadd_ge(a, b, rhs) (((a) + (b) >= (rhs) ) || ((a) + (b) < (a)))
+
+#define ovadd3_gt(a, b, c, rhs) (((a) + (b) + (c) > (rhs)) || ((a) + (b) < (a)) || ((a) + (b) + (c) < (c)))
+
+
+ //-----------------------------------------------------------------------------
+//
+// Liberally lifted from the Office example on MSDN and modified.
+// http://msdn.microsoft.com/library/en-us/dncode/html/secure01142004.asp
+//
+// Modified to track an overflow bit instead of throwing exceptions. In most
+// cases the Visual C++ optimizer (Whidbey beta1 - v14.00.40607) is able to
+// optimize the bool away completely.
+// Note that using a sentinal value (IntMax for example) to represent overflow
+// actually results in poorer code-gen.
+//
+// This has also been simplified significantly to remove functionality we
+// don't currently want (division, implicit conversions, many additional operators etc.)
+//
+// Example:
+// unsafe: UINT32 bufSize = headerSize + elementCount * sizeof(void*);
+// becomes:
+// S_UINT32 bufSize = S_UINT32(headerSize) + S_UINT32(elementCount) *
+// S_UINT32( sizeof(void*) );
+// if( bufSize.IsOverflow() ) { <overflow-error> }
+// else { use bufSize.Value() }
+// or:
+// UINT32 tmp, bufSize;
+// if( !ClrSafeInt<UINT32>::multiply( elementCount, sizeof(void*), tmp ) ||
+// !ClrSafeInt<UINT32>::addition( tmp, headerSize, bufSize ) )
+// { <overflow-error> }
+// else { use bufSize }
+//
+//-----------------------------------------------------------------------------
+// TODO: Any way to prevent unintended instantiations? This is only designed to
+// work with unsigned integral types (signed types will work but we probably
+// don't need signed support).
+template<typename T> class ClrSafeInt
+{
+public:
+ // Default constructor - 0 value by default
+ ClrSafeInt() :
+ m_value(0),
+ m_overflow(false)
+ COMMA_INDEBUG( m_checkedOverflow( false ) )
+ {
+ }
+
+ // Value constructor
+ // This is explicit because otherwise it would be harder to
+ // differentiate between checked and unchecked usage of an operator.
+ // I.e. si + x + y vs. si + ( x + y )
+ //
+ // Set the m_checkedOverflow bit to true since this is being initialized
+ // with a constant value and we know that it is valid. A scenario in
+ // which this is useful is when an overflow causes a fallback value to
+ // be used:
+ // if (val.IsOverflow())
+ // val = ClrSafeInt<T>(some_value);
+ explicit ClrSafeInt( T v ) :
+ m_value(v),
+ m_overflow(false)
+ COMMA_INDEBUG( m_checkedOverflow( true ) )
+ {
+ }
+
+ template <typename U>
+ explicit ClrSafeInt(U u) :
+ m_value(0),
+ m_overflow(false)
+ COMMA_INDEBUG( m_checkedOverflow( false ) )
+ {
+ if (!FitsIn<T>(u))
+ {
+ m_overflow = true;
+ }
+ else
+ {
+ m_value = (T)u;
+ }
+ }
+
+ template <typename U>
+ ClrSafeInt(ClrSafeInt<U> u) :
+ m_value(0),
+ m_overflow(false)
+ COMMA_INDEBUG( m_checkedOverflow( false ) )
+ {
+ if (u.IsOverflow() || !FitsIn<T>(u.Value()))
+ {
+ m_overflow = true;
+ }
+ else
+ {
+ m_value = (T)u.Value();
+ }
+ }
+
+ // Note: compiler-generated copy constructor and assignment operator
+ // are correct for our purposes.
+
+ // Note: The MS compiler will sometimes silently perform value-destroying
+ // conversions when calling the operators below.
+ // Eg. "ClrSafeInt<unsigned> s(0); s += int(-1);" will result in s
+ // having the value 0xffffffff without generating a compile-time warning.
+ // Narrowing conversions are generally level 4 warnings so may or may not
+ // be visible.
+ //
+ // In the original SafeInt class, all operators have an
+ // additional overload that takes an arbitrary type U and then safe
+ // conversions are performed (resulting in overflow whenever the value
+ // cannot be preserved).
+ // We could do the same thing, but currently don't because:
+ // - we don't believe there are common cases where this would result in a
+ // security hole.
+ // - the extra complexity isn't worth the benefits
+ // - it would prevent compiler warnings in the cases we do get warnings for.
+
+
+ // true if there has been an overflow leading up to the creation of this
+ // value, false otherwise.
+ // Note that in debug builds we track whether our client called this,
+ // so we should not be calling this method ourselves from within this class.
+ inline bool IsOverflow() const
+ {
+ INDEBUG( m_checkedOverflow = true; )
+ return m_overflow;
+ }
+
+ // Get the value of this integer.
+ // Must only be called when IsOverflow()==false. If this is called
+ // on overflow we'll assert in Debug and return 0 in release.
+ inline T Value() const
+ {
+ _ASSERTE_SAFEMATH( m_checkedOverflow ); // Ensure our caller first checked the overflow bit
+ _ASSERTE_SAFEMATH( !m_overflow );
+ return m_value;
+ }
+
+ // force the value into the overflow state.
+ inline void SetOverflow()
+ {
+ INDEBUG( this->m_checkedOverflow = false; )
+ this->m_overflow = true;
+ // incase someone manages to call Value in release mode - should be optimized out
+ this->m_value = 0;
+ }
+
+
+ //
+ // OPERATORS
+ //
+
+ // Addition and multiplication. Only permitted when both sides are explicitly
+ // wrapped inside of a ClrSafeInt and when the types match exactly.
+ // If we permitted a RHS of type 'T', then there would be differences
+ // in correctness between mathematically equivalent expressions such as
+ // "si + x + y" and "si + ( x + y )". Unfortunately, not permitting this
+ // makes expressions involving constants tedius and ugly since the constants
+ // must be wrapped in ClrSafeInt instances. If we become confident that
+ // our tools (PreFast) will catch all integer overflows, then we can probably
+ // safely add this.
+ inline ClrSafeInt<T> operator +(ClrSafeInt<T> rhs) const
+ {
+ ClrSafeInt<T> result; // value is initialized to 0
+ if( this->m_overflow ||
+ rhs.m_overflow ||
+ !addition( this->m_value, rhs.m_value, result.m_value ) )
+ {
+ result.m_overflow = true;
+ }
+
+ return result;
+ }
+
+ inline ClrSafeInt<T> operator -(ClrSafeInt<T> rhs) const
+ {
+ ClrSafeInt<T> result; // value is initialized to 0
+ if( this->m_overflow ||
+ rhs.m_overflow ||
+ !subtraction( this->m_value, rhs.m_value, result.m_value ) )
+ {
+ result.m_overflow = true;
+ }
+
+ return result;
+ }
+
+ inline ClrSafeInt<T> operator *(ClrSafeInt<T> rhs) const
+ {
+ ClrSafeInt<T> result; // value is initialized to 0
+ if( this->m_overflow ||
+ rhs.m_overflow ||
+ !multiply( this->m_value, rhs.m_value, result.m_value ) )
+ {
+ result.m_overflow = true;
+ }
+
+ return result;
+ }
+
+ // Accumulation operators
+ // Here it's ok to have versions that take a value of type 'T', however we still
+ // don't allow any mixed-type operations.
+ inline ClrSafeInt<T>& operator +=(ClrSafeInt<T> rhs)
+ {
+ INDEBUG( this->m_checkedOverflow = false; )
+ if( this->m_overflow ||
+ rhs.m_overflow ||
+ !ClrSafeInt<T>::addition( this->m_value, rhs.m_value, this->m_value ) )
+ {
+ this->SetOverflow();
+ }
+ return *this;
+ }
+
+ inline ClrSafeInt<T>& operator +=(T rhs)
+ {
+ INDEBUG( this->m_checkedOverflow = false; )
+ if( this->m_overflow ||
+ !ClrSafeInt<T>::addition( this->m_value, rhs, this->m_value ) )
+ {
+ this->SetOverflow();
+ }
+ return *this;
+ }
+
+ inline ClrSafeInt<T>& operator *=(ClrSafeInt<T> rhs)
+ {
+ INDEBUG( this->m_checkedOverflow = false; )
+ if( this->m_overflow ||
+ rhs.m_overflow ||
+ !ClrSafeInt<T>::multiply( this->m_value, rhs.m_value, this->m_value ) )
+ {
+ this->SetOverflow();
+ }
+ return *this;
+ }
+
+ inline ClrSafeInt<T>& operator *=(T rhs)
+ {
+ INDEBUG( this->m_checkedOverflow = false; )
+ if( this->m_overflow ||
+ !ClrSafeInt<T>::multiply( this->m_value, rhs, this->m_value ) )
+ {
+ this->SetOverflow();
+ }
+
+ return *this;
+ }
+
+ //
+ // STATIC HELPER METHODS
+ //these compile down to something as efficient as macros and allow run-time testing
+ //of type by the developer
+ //
+
+ template <typename U> static bool IsSigned(U)
+ {
+ return std::is_signed<U>::value;
+ }
+
+ static bool IsSigned()
+ {
+ return std::is_signed<T>::value;
+ }
+
+ static bool IsMixedSign(T lhs, T rhs)
+ {
+ return ((lhs ^ rhs) < 0);
+ }
+
+ static unsigned char BitCount(){return (sizeof(T)*8);}
+
+ static bool Is64Bit(){return sizeof(T) == 8;}
+ static bool Is32Bit(){return sizeof(T) == 4;}
+ static bool Is16Bit(){return sizeof(T) == 2;}
+ static bool Is8Bit(){return sizeof(T) == 1;}
+
+ //both of the following should optimize away
+ static T MaxInt()
+ {
+ if(IsSigned())
+ {
+ return (T)~((T)1 << (BitCount()-1));
+ }
+ //else
+ return (T)(~(T)0);
+ }
+
+ static T MinInt()
+ {
+ if(IsSigned())
+ {
+ return (T)((T)1 << (BitCount()-1));
+ }
+ else
+ {
+ return ((T)0);
+ }
+ }
+
+ // Align a value up to the nearest boundary, which must be a power of 2
+ inline void AlignUp( T alignment )
+ {
+ _ASSERTE_SAFEMATH( IsPowerOf2( alignment ) );
+ *this += (alignment - 1);
+ if( !this->m_overflow )
+ {
+ m_value &= ~(alignment - 1);
+ }
+ }
+
+ //
+ // Arithmetic implementation functions
+ //
+
+ //note - this looks complex, but most of the conditionals
+ //are constant and optimize away
+ //for example, a signed 64-bit check collapses to:
+/*
+ if(lhs == 0 || rhs == 0)
+ return 0;
+
+ if(MaxInt()/+lhs < +rhs)
+ {
+ //overflow
+ throw SafeIntException(ERROR_ARITHMETIC_OVERFLOW);
+ }
+ //ok
+ return lhs * rhs;
+
+ Which ought to inline nicely
+*/
+ // Returns true if safe, false for overflow.
+ static bool multiply(T lhs, T rhs, T &result)
+ {
+ if(Is64Bit())
+ {
+ //fast track this one - and avoid DIV_0 below
+ if(lhs == 0 || rhs == 0)
+ {
+ result = 0;
+ return true;
+ }
+
+ //we're 64 bit - slow, but the only way to do it
+ if(IsSigned())
+ {
+ if(!IsMixedSign(lhs, rhs))
+ {
+ //both positive or both negative
+ //result will be positive, check for lhs * rhs > MaxInt
+ if(lhs > 0)
+ {
+ //both positive
+ if(MaxInt()/lhs < rhs)
+ {
+ //overflow
+ return false;
+ }
+ }
+ else
+ {
+ //both negative
+
+ //comparison gets tricky unless we force it to positive
+ //EXCEPT that -MinInt is undefined - can't be done
+ //And MinInt always has a greater magnitude than MaxInt
+ if(lhs == MinInt() || rhs == MinInt())
+ {
+ //overflow
+ return false;
+ }
+
+#ifdef _MSC_VER
+#pragma warning( disable : 4146 ) // unary minus applied to unsigned is still unsigned
+#endif
+ if(MaxInt()/(-lhs) < (-rhs) )
+ {
+ //overflow
+ return false;
+ }
+#ifdef _MSC_VER
+#pragma warning( default : 4146 )
+#endif
+ }
+ }
+ else
+ {
+ //mixed sign - this case is difficult
+ //test case is lhs * rhs < MinInt => overflow
+ //if lhs < 0 (implies rhs > 0),
+ //lhs < MinInt/rhs is the correct test
+ //else if lhs > 0
+ //rhs < MinInt/lhs is the correct test
+ //avoid dividing MinInt by a negative number,
+ //because MinInt/-1 is a corner case
+
+ if(lhs < 0)
+ {
+ if(lhs < MinInt()/rhs)
+ {
+ //overflow
+ return false;
+ }
+ }
+ else
+ {
+ if(rhs < MinInt()/lhs)
+ {
+ //overflow
+ return false;
+ }
+ }
+ }
+
+ //ok
+ result = lhs * rhs;
+ return true;
+ }
+ else
+ {
+ //unsigned, easy case
+ if(MaxInt()/lhs < rhs)
+ {
+ //overflow
+ return false;
+ }
+ //ok
+ result = lhs * rhs;
+ return true;
+ }
+ }
+ else if(Is32Bit())
+ {
+ //we're 32-bit
+ if(IsSigned())
+ {
+ INT64 tmp = (INT64)lhs * (INT64)rhs;
+
+ //upper 33 bits must be the same
+ //most common case is likely that both are positive - test first
+ if( (tmp & 0xffffffff80000000LL) == 0 ||
+ (tmp & 0xffffffff80000000LL) == 0xffffffff80000000LL)
+ {
+ //this is OK
+ result = (T)tmp;
+ return true;
+ }
+
+ //overflow
+ return false;
+
+ }
+ else
+ {
+ UINT64 tmp = (UINT64)lhs * (UINT64)rhs;
+ if (tmp & 0xffffffff00000000ULL) //overflow
+ {
+ //overflow
+ return false;
+ }
+ result = (T)tmp;
+ return true;
+ }
+ }
+ else if(Is16Bit())
+ {
+ //16-bit
+ if(IsSigned())
+ {
+ INT32 tmp = (INT32)lhs * (INT32)rhs;
+ //upper 17 bits must be the same
+ //most common case is likely that both are positive - test first
+ if( (tmp & 0xffff8000) == 0 || (tmp & 0xffff8000) == 0xffff8000)
+ {
+ //this is OK
+ result = (T)tmp;
+ return true;
+ }
+
+ //overflow
+ return false;
+ }
+ else
+ {
+ UINT32 tmp = (UINT32)lhs * (UINT32)rhs;
+ if (tmp & 0xffff0000) //overflow
+ {
+ return false;
+ }
+ result = (T)tmp;
+ return true;
+ }
+ }
+ else //8-bit
+ {
+ _ASSERTE_SAFEMATH(Is8Bit());
+
+ if(IsSigned())
+ {
+ INT16 tmp = (INT16)lhs * (INT16)rhs;
+ //upper 9 bits must be the same
+ //most common case is likely that both are positive - test first
+ if( (tmp & 0xff80) == 0 || (tmp & 0xff80) == 0xff80)
+ {
+ //this is OK
+ result = (T)tmp;
+ return true;
+ }
+
+ //overflow
+ return false;
+ }
+ else
+ {
+ UINT16 tmp = ((UINT16)lhs) * ((UINT16)rhs);
+
+ if (tmp & 0xff00) //overflow
+ {
+ return false;
+ }
+ result = (T)tmp;
+ return true;
+ }
+ }
+ }
+
+ // Returns true if safe, false on overflow
+ static inline bool addition(T lhs, T rhs, T &result)
+ {
+ if(IsSigned())
+ {
+ //test for +/- combo
+ if(!IsMixedSign(lhs, rhs))
+ {
+ //either two negatives, or 2 positives
+#ifdef __GNUC__
+ // Workaround for GCC warning: "comparison is always
+ // false due to limited range of data type."
+ if (!(rhs == 0 || rhs > 0))
+#else
+ if(rhs < 0)
+#endif // __GNUC__ else
+ {
+ //two negatives
+ if(lhs < (T)(MinInt() - rhs)) //remember rhs < 0
+ {
+ return false;
+ }
+ //ok
+ }
+ else
+ {
+ //two positives
+ if((T)(MaxInt() - lhs) < rhs)
+ {
+ return false;
+ }
+ //OK
+ }
+ }
+ //else overflow not possible
+ result = lhs + rhs;
+ return true;
+ }
+ else //unsigned
+ {
+ if((T)(MaxInt() - lhs) < rhs)
+ {
+ return false;
+
+ }
+ result = lhs + rhs;
+ return true;
+ }
+ }
+
+ // Returns true if safe, false on overflow
+ static inline bool subtraction(T lhs, T rhs, T& result)
+ {
+ T tmp = lhs - rhs;
+
+ if(IsSigned())
+ {
+ if(IsMixedSign(lhs, rhs)) //test for +/- combo
+ {
+ //mixed positive and negative
+ //two cases - +X - -Y => X + Y - check for overflow against MaxInt()
+ // -X - +Y - check for overflow against MinInt()
+
+ if(lhs >= 0) //first case
+ {
+ //test is X - -Y > MaxInt()
+ //equivalent to X > MaxInt() - |Y|
+ //Y == MinInt() creates special case
+ //Even 0 - MinInt() can't be done
+ //note that the special case collapses into the general case, due to the fact
+ //MaxInt() - MinInt() == -1, and lhs is non-negative
+ //OR tmp should be GTE lhs
+
+ // old test - leave in for clarity
+ //if(lhs > (T)(MaxInt() + rhs)) //remember that rhs is negative
+ if(tmp < lhs)
+ {
+ return false;
+ }
+ //fall through to return value
+ }
+ else
+ {
+ //second case
+ //test is -X - Y < MinInt()
+ //or -X < MinInt() + Y
+ //we do not have the same issues because abs(MinInt()) > MaxInt()
+ //tmp should be LTE lhs
+
+ //if(lhs < (T)(MinInt() + rhs)) // old test - leave in for clarity
+ if(tmp > lhs)
+ {
+ return false;
+ }
+ //fall through to return value
+ }
+ }
+ // else
+ //both negative, or both positive
+ //no possible overflow
+ result = tmp;
+ return true;
+ }
+ else
+ {
+ //easy unsigned case
+ if(lhs < rhs)
+ {
+ return false;
+ }
+ result = tmp;
+ return true;
+ }
+ }
+
+private:
+ // Private helper functions
+ // Note that's it occasionally handy to call the arithmetic implementation
+ // functions above so we leave them public, even though we almost always use
+ // the operators instead.
+
+ // True if the specified value is a power of two.
+ static inline bool IsPowerOf2( T x )
+ {
+ // find the smallest power of 2 >= x
+ T testPow = 1;
+ while( testPow < x )
+ {
+ testPow = testPow << 1; // advance to next power of 2
+ if( testPow <= 0 )
+ {
+ return false; // overflow
+ }
+ }
+
+ return( testPow == x );
+ }
+
+ //
+ // Instance data
+ //
+
+ // The integer value this instance represents, or 0 if overflow.
+ T m_value;
+
+ // True if overflow has been reached. Once this is set, it cannot be cleared.
+ bool m_overflow;
+
+ // In debug builds we verify that our caller checked the overflow bit before
+ // accessing the value. This flag is cleared on initialization, and whenever
+ // m_value or m_overflow changes, and set only when IsOverflow
+ // is called.
+ INDEBUG( mutable bool m_checkedOverflow; )
+};
+
+// Allows creation of a ClrSafeInt corresponding to the type of the argument.
+template <typename T>
+ClrSafeInt<T> AsClrSafeInt(T t)
+{
+ return ClrSafeInt<T>(t);
+}
+
+template <typename T>
+ClrSafeInt<T> AsClrSafeInt(ClrSafeInt<T> t)
+{
+ return t;
+}
+
+// Convenience safe-integer types. Currently these are the only types
+// we are using ClrSafeInt with. We may want to add others.
+// These type names are based on our standardized names in clrtypes.h
+typedef ClrSafeInt<UINT8> S_UINT8;
+typedef ClrSafeInt<UINT16> S_UINT16;
+//typedef ClrSafeInt<UINT32> S_UINT32;
+#define S_UINT32 ClrSafeInt<UINT32>
+typedef ClrSafeInt<UINT64> S_UINT64;
+typedef ClrSafeInt<SIZE_T> S_SIZE_T;
+
+// Note: we can get bogus /Wp64 compiler warnings when S_SIZE_T is used.
+// This is due to VSWhidbey 138322 which the C++ folks have said they can't
+// currently fix. We can work around the problem by using this macro to force
+// a no-op cast on 32-bit MSVC platforms. It's not yet clear why we need to
+// use this in some places (specifically, rotor lkgvc builds) and not others.
+// We also make the error less likely by using a #define instead of a
+// typedef for S_UINT32 above since that means we're less likely to instantiate
+// ClrSafeInt<UINT32> AND ClrSafeInt<SIZE_T> in the same compliation unit.
+#if defined(_TARGET_X86_) && defined( _MSC_VER )
+#define S_SIZE_T_WP64BUG(v) S_SIZE_T( static_cast<UINT32>( v ) )
+#else
+#define S_SIZE_T_WP64BUG(v) S_SIZE_T( v )
+#endif
+
+ #endif // SAFEMATH_H_
diff --git a/src/inc/safewrap.h b/src/inc/safewrap.h
new file mode 100644
index 0000000000..f489999f68
--- /dev/null
+++ b/src/inc/safewrap.h
@@ -0,0 +1,171 @@
+// 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.
+//*****************************************************************************
+// SafeWrap.h
+//
+
+//
+// This file contains wrapper functions for Win32 API's that take SStrings
+// and use CLR-safe holders.
+//*****************************************************************************
+
+
+/*
+ Guidelines for SafeWrapper APIs:
+Most of these are 'common-sense', plus a few arbitrary decisions thrown in for
+consistency's sake.
+
+- THROWING: Throw on oom, but return all other failure codes.
+ The rationale here is that SString operations already throw, so to make these APIs
+ non-throwing would require an extra EX_TRY/EX_CATCH. Most callees will want to throw
+ on OOM anyways. So making these APIs non-throwing would mean an extra try/catch in
+ the caller + an extra check at the callee. We can eliminate that overhead and just make
+ it throwing.
+
+ Return non-oom failure codes because callees actually freqeuntly expect an API to fail.
+ For example, the callee will have special handling for file-not-found.
+
+ For convenience, you could add a no-throwing wrapper version of the API:
+ ClrGetEnvironmentVariable <-- default throws on oom.
+ ClrGetEnvironmentVariableNoThrow <-- never throws.
+
+- NAMING: Prefix the name with 'Clr', just like we do for win32 APIs going through hosting.
+
+- DON'T FORGET CONTRACTS: Most of these APIs will likely be Throws/GC_Notrigger.
+ Also use PRECONDITIONs + POSTCONDITIONS when possible.
+
+- SIGNATURES: Keep the method signture as close the the original win32 API as possible.
+ - Preserve the return type + value. (except allow it to throw on oom). If the return value
+ should be a holder, then use that as an out-parameter at the end of the argument list.
+ We don't want to return holders because that will cause the dtors to be called.
+ - For input strings use 'const SString &' instead of 'LPCWSTR'.
+ - Change ('out' string, length) pairs to 'SString &' (this is the convention the rest of the CLR uses for SStrings)
+ - Use Holders where appropriate.
+ - Preserve other parameters.
+
+- USE SSTRINGS TO AVOID BUFFER OVERRUN ISSUES: Repeated here for emphasis. Use SStrings when
+ applicable to make it very easy to verify the code does not have buffer overruns.
+ This will also simplify callsites from having to figure out the length of the output string.
+
+- USE YOUR BEST JUDGEMENT: The primary goal of these API wrappers is to embrace 'security-safe' practices.
+ Certainly take any additional steps to that goal. For example, it may make sense to eliminate
+ corner case inputs for a given API or to break a single confusing API up into several discrete and
+ move obvious APIs.
+
+*/
+#ifndef _safewrap_h_
+#define _safewrap_h_
+
+#include "holder.h"
+
+class SString;
+bool ClrGetEnvironmentVariable(LPCSTR szEnvVarName, SString & value);
+bool ClrGetEnvironmentVariableNoThrow(LPCSTR szEnvVarName, SString & value);
+void ClrGetModuleFileName(HMODULE hModule, SString & value);
+bool ClrGetModuleFileNameNoThrow(HMODULE hModule, SString & value);
+
+void ClrGetCurrentDirectory(SString & value);
+bool ClrGetCurrentDirectoryNoThrow(SString & value);
+
+
+/* --------------------------------------------------------------------------- *
+ * Simple wrapper around WszFindFirstFile/WszFindNextFile
+ * --------------------------------------------------------------------------- */
+class ClrDirectoryEnumerator
+{
+ WIN32_FIND_DATAW data;
+ FindHandleHolder dirHandle;
+ BOOL fFindNext; // Skip FindNextFile first time around
+
+public:
+ ClrDirectoryEnumerator(LPCWSTR pBaseDirectory, LPCWSTR pMask = W("*"));
+ bool Next();
+
+ LPCWSTR GetFileName()
+ {
+ return data.cFileName;
+ }
+
+ DWORD GetFileAttributes()
+ {
+ return data.dwFileAttributes;
+ }
+
+ void Close()
+ {
+ dirHandle.Clear();
+ }
+};
+
+// Read a REG_SZ (null-terminated string) value from the registry. Throws.
+void ClrRegReadString(HKEY hKey, const SString & szValueName, SString & value);
+
+/* --------------------------------------------------------------------------- *
+ * Simple wrapper around RegisterEventSource/ReportEvent/DeregisterEventSource
+ * --------------------------------------------------------------------------- */
+// Returns ERROR_SUCCESS if succeessful in reporting to event log, or
+// Windows error code to indicate the specific error.
+DWORD ClrReportEvent(
+ LPCWSTR pEventSource,
+ WORD wType,
+ WORD wCategory,
+ DWORD dwEventID,
+ PSID lpUserSid,
+ WORD wNumStrings,
+ LPCWSTR *lpStrings,
+ DWORD dwDataSize = 0,
+ LPVOID lpRawData = NULL);
+
+DWORD ClrReportEvent(
+ LPCWSTR pEventSource,
+ WORD wType,
+ WORD wCategory,
+ DWORD dwEventID,
+ PSID lpUserSid,
+ LPCWSTR pMessage);
+
+//*****************************************************************************
+// This provides a wrapper around GetFileSize() that forces it to fail
+// if the file is >4g and pdwHigh is NULL. Other than that, it acts like
+// the genuine GetFileSize().
+//
+//
+//*****************************************************************************
+DWORD inline SafeGetFileSize(HANDLE hFile, DWORD *pdwHigh)
+{
+ if (pdwHigh != NULL)
+ {
+ return ::GetFileSize(hFile, pdwHigh);
+ }
+ else
+ {
+ DWORD hi;
+ DWORD lo = ::GetFileSize(hFile, &hi);
+ if (lo == 0xffffffff && GetLastError() != NO_ERROR)
+ {
+ return lo;
+ }
+ // api succeeded. is the file too large?
+ if (hi != 0)
+ {
+ // there isn't really a good error to set here...
+ SetLastError(ERROR_NOT_ENOUGH_MEMORY);
+ return 0xffffffff;
+ }
+
+ if (lo == 0xffffffff)
+ {
+ // note that a success return of (hi=0,lo=0xffffffff) will be
+ // treated as an error by the caller. Again, that's part of the
+ // price of being a slacker and not handling the high dword.
+ // We'll set a lasterror for him to pick up.
+ SetLastError(ERROR_NOT_ENOUGH_MEMORY);
+ }
+
+ return lo;
+ }
+
+}
+
+#endif // _safewrap_h_
diff --git a/src/inc/sarray.h b/src/inc/sarray.h
new file mode 100644
index 0000000000..ac361cf401
--- /dev/null
+++ b/src/inc/sarray.h
@@ -0,0 +1,229 @@
+// 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.
+// --------------------------------------------------------------------------------
+// SArray.h
+// --------------------------------------------------------------------------------
+
+
+#ifndef _SARRAY_H_
+#define _SARRAY_H_
+
+#include "sbuffer.h"
+
+// --------------------------------------------------------------------------------
+// SArray is a typed array wrapper around an SBuffer. It manages individual
+// constructors and destructors of array elements if avaiable, as well as providing
+// typed access.
+// --------------------------------------------------------------------------------
+
+template <typename ELEMENT, BOOL BITWISE_COPY = TRUE>
+class SArray
+{
+ private:
+
+ SBuffer m_buffer;
+
+ static COUNT_T VerifySizeRange(ELEMENT * begin, ELEMENT * end);
+
+ public:
+
+ class Iterator;
+ friend class Iterator;
+
+ SArray();
+ SArray(COUNT_T count);
+ SArray(ELEMENT * begin, ELEMENT * end);
+ ~SArray();
+
+ void Clear();
+ void Set(const SArray<ELEMENT, BITWISE_COPY> &array);
+
+ COUNT_T GetCount() const;
+ BOOL IsEmpty() const;
+
+ void SetCount(COUNT_T count);
+
+ COUNT_T GetAllocation() const;
+
+ void Preallocate(int count) const;
+ void Trim() const;
+
+ void Copy(const Iterator &to, const Iterator &from, COUNT_T size);
+ void Move(const Iterator &to, const Iterator &from, COUNT_T size);
+
+ void Copy(const Iterator &i, const ELEMENT *source, COUNT_T size);
+ void Copy(void *dest, const Iterator &i, COUNT_T size);
+
+ Iterator Append()
+ {
+ WRAPPER_NO_CONTRACT;
+
+ COUNT_T count = GetCount();
+ if ( GetAllocation() == count )
+ Preallocate( 2 * count );
+
+ Iterator i = End();
+ Insert(i);
+ return i;
+ }
+
+ void Append(ELEMENT elem)
+ {
+ WRAPPER_NO_CONTRACT;
+ *Append() = elem;
+ }
+
+ ELEMENT AppendEx(ELEMENT elem)
+ {
+ WRAPPER_NO_CONTRACT;
+
+ *Append() = elem;
+ return elem;
+ }
+
+ void Insert(const Iterator &i);
+ void Delete(const Iterator &i);
+
+ void Insert(const Iterator &i, COUNT_T count);
+ void Delete(const Iterator &i, COUNT_T count);
+
+ void Replace(const Iterator &i, COUNT_T deleteCount, COUNT_T insertCount);
+
+ ELEMENT *OpenRawBuffer(COUNT_T maxElementCount);
+ ELEMENT *OpenRawBuffer();
+ void CloseRawBuffer(COUNT_T actualElementCount);
+ void CloseRawBuffer();
+
+ Iterator Begin()
+ {
+ WRAPPER_NO_CONTRACT;
+ return Iterator(this, 0);
+ }
+
+ Iterator End()
+ {
+ WRAPPER_NO_CONTRACT;
+ return Iterator(this, GetCount());
+ }
+
+ Iterator operator+(COUNT_T index)
+ {
+ return Iterator(this, index);
+ }
+
+ ELEMENT & operator[] (int index);
+ const ELEMENT & operator[] (int index) const;
+
+ ELEMENT & operator[] (COUNT_T index);
+ const ELEMENT & operator[] (COUNT_T index) const;
+
+ protected:
+ SArray(void *prealloc, COUNT_T size);
+
+ public:
+
+ class Iterator : public CheckedIteratorBase<SArray<ELEMENT, BITWISE_COPY> >,
+ public Indexer<ELEMENT, Iterator>
+ {
+ friend class SArray;
+ friend class Indexer<ELEMENT, Iterator>;
+
+ SBuffer::Iterator m_i;
+
+ public:
+
+ Iterator(SArray *array, SCOUNT_T index)
+ : CheckedIteratorBase<SArray<ELEMENT, BITWISE_COPY> >(array)
+ {
+ WRAPPER_NO_CONTRACT;
+ m_i = array->m_buffer.Begin() + index*sizeof(ELEMENT);
+ }
+
+ protected:
+
+ ELEMENT &GetAt(SCOUNT_T delta) const
+ {
+ LIMITED_METHOD_CONTRACT;
+ return * (ELEMENT *) &m_i[delta*sizeof(ELEMENT)];
+ }
+
+ void Skip(SCOUNT_T delta)
+ {
+ LIMITED_METHOD_CONTRACT;
+ m_i += delta*sizeof(ELEMENT);
+ }
+
+ COUNT_T Subtract(const Iterator &i) const
+ {
+ LIMITED_METHOD_CONTRACT;
+ return (m_i - i.m_i)/sizeof(ELEMENT);
+ }
+
+ CHECK DoCheck(SCOUNT_T delta) const
+ {
+ WRAPPER_NO_CONTRACT;
+ return m_i.CheckIndex(delta*sizeof(ELEMENT));
+ }
+
+ public:
+
+ CHECK Check() const
+ {
+ WRAPPER_NO_CONTRACT;
+ return m_i.Check();
+ }
+ };
+
+ ELEMENT *GetElements() const;
+
+ private:
+
+ //--------------------------------------------------------------------
+ // Routines for managing the buffer content.
+ //--------------------------------------------------------------------
+
+ void ConstructBuffer(const Iterator &i, COUNT_T size);
+ void CopyConstructBuffer(const Iterator &i, COUNT_T size, const ELEMENT *from);
+ void DestructBuffer(const Iterator &i, COUNT_T size);
+};
+
+// ================================================================================
+// InlineSArray : Tempate for an SArray with preallocated element space
+// ================================================================================
+
+template <typename ELEMENT, COUNT_T SIZE, BOOL BITWISE_COPY = TRUE>
+class InlineSArray : public SArray<ELEMENT, BITWISE_COPY>
+{
+ private:
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable:4200) // zero sized array
+#pragma warning(disable:4324) // don't complain if DECLSPEC_ALIGN actually pads
+ DECLSPEC_ALIGN(BUFFER_ALIGNMENT) BYTE m_prealloc[SIZE*sizeof(ELEMENT)];
+#pragma warning(pop)
+#else
+ // use UINT64 to get maximum alignment of the memory
+ UINT64 m_prealloc[ALIGN(SIZE*sizeof(ELEMENT),sizeof(UINT64))/sizeof(UINT64)];
+#endif // _MSC_VER
+
+ public:
+ InlineSArray();
+};
+
+// ================================================================================
+// StackSArray : SArray with relatively large preallocated buffer for stack use
+// ================================================================================
+
+template <typename ELEMENT, BOOL BITWISE_COPY = TRUE>
+class StackSArray : public InlineSArray<ELEMENT, STACK_ALLOC/sizeof(ELEMENT), BITWISE_COPY>
+{
+};
+
+// ================================================================================
+// Inline definitions
+// ================================================================================
+
+#include "sarray.inl"
+
+#endif // _SARRAY_H_
diff --git a/src/inc/sarray.inl b/src/inc/sarray.inl
new file mode 100644
index 0000000000..d7e396c9ba
--- /dev/null
+++ b/src/inc/sarray.inl
@@ -0,0 +1,377 @@
+// 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.
+// --------------------------------------------------------------------------------
+// SArray.inl
+// --------------------------------------------------------------------------------
+
+#ifndef _SARRAY_INL_
+#define _SARRAY_INL_
+
+#include "sarray.h"
+
+template <typename ELEMENT, BOOL BITWISE_COPY>
+inline SArray<ELEMENT, BITWISE_COPY>::SArray()
+ : m_buffer()
+{
+ LIMITED_METHOD_CONTRACT;
+}
+
+template <typename ELEMENT, BOOL BITWISE_COPY>
+inline SArray<ELEMENT, BITWISE_COPY>::SArray(COUNT_T count)
+ : m_buffer(count * sizeof(ELEMENT))
+{
+ WRAPPER_NO_CONTRACT;
+ ConstructBuffer(Begin(), count);
+}
+
+template <typename ELEMENT, BOOL BITWISE_COPY>
+inline COUNT_T SArray<ELEMENT, BITWISE_COPY>::VerifySizeRange(ELEMENT * begin, ELEMENT *end)
+{
+ WRAPPER_NO_CONTRACT;
+
+ if (end < begin)
+ ThrowHR(COR_E_OVERFLOW);
+
+ SIZE_T bufferSize = (end - begin) * sizeof(ELEMENT);
+ if (!FitsIn<COUNT_T>(bufferSize))
+ ThrowHR(COR_E_OVERFLOW);
+
+ return static_cast<COUNT_T>(bufferSize);
+}
+
+template <typename ELEMENT, BOOL BITWISE_COPY>
+inline SArray<ELEMENT, BITWISE_COPY>::SArray(ELEMENT * begin, ELEMENT * end)
+ : m_buffer(VerifySizeRange(begin, end))
+{
+ WRAPPER_NO_CONTRACT;
+
+ CopyConstructBuffer(Begin(), static_cast<COUNT_T>(end - begin), begin);
+}
+
+template <typename ELEMENT, BOOL BITWISE_COPY>
+inline SArray<ELEMENT, BITWISE_COPY>::SArray(void *prealloc, COUNT_T count)
+ : m_buffer(SBuffer::Prealloc, prealloc, count*sizeof(ELEMENT))
+{
+ LIMITED_METHOD_CONTRACT;
+}
+
+template <typename ELEMENT, BOOL BITWISE_COPY>
+SArray<ELEMENT, BITWISE_COPY>::~SArray()
+{
+ CONTRACTL
+ {
+ NOTHROW;
+ SO_TOLERANT;
+ GC_NOTRIGGER;
+ }
+ CONTRACTL_END;
+
+ // Cannot call Clear because DestructBuffer has THROWS in its contract
+ if (!BITWISE_COPY)
+ {
+ COUNT_T elementCount = GetCount();
+ for (COUNT_T i = 0; i < elementCount; i++)
+ {
+ (&((*this)[i]))->~ELEMENT();
+ }
+ }
+}
+
+template <typename ELEMENT, BOOL BITWISE_COPY>
+inline void SArray<ELEMENT, BITWISE_COPY>::Clear()
+{
+ WRAPPER_NO_CONTRACT;
+ DestructBuffer(Begin(), GetCount());
+ m_buffer.Clear();
+}
+
+template <typename ELEMENT, BOOL BITWISE_COPY>
+inline ELEMENT* SArray<ELEMENT, BITWISE_COPY>::OpenRawBuffer(COUNT_T elementCount)
+{
+ WRAPPER_NO_CONTRACT;
+ return (ELEMENT*)m_buffer.OpenRawBuffer(elementCount * sizeof(ELEMENT));
+}
+
+template <typename ELEMENT, BOOL BITWISE_COPY>
+inline ELEMENT* SArray<ELEMENT, BITWISE_COPY>::OpenRawBuffer()
+{
+ WRAPPER_NO_CONTRACT;
+ return (ELEMENT*)m_buffer.OpenRawBuffer(GetCount() * sizeof(ELEMENT));
+}
+
+template <typename ELEMENT, BOOL BITWISE_COPY>
+inline void SArray<ELEMENT, BITWISE_COPY>::CloseRawBuffer(COUNT_T finalElementCount)
+{
+ WRAPPER_NO_CONTRACT;
+ m_buffer.CloseRawBuffer(finalElementCount * sizeof(ELEMENT));
+}
+
+template <typename ELEMENT, BOOL BITWISE_COPY>
+inline void SArray<ELEMENT, BITWISE_COPY>::CloseRawBuffer()
+{
+ WRAPPER_NO_CONTRACT;
+ m_buffer.CloseRawBuffer();
+}
+
+template <typename ELEMENT, BOOL BITWISE_COPY>
+inline void SArray<ELEMENT, BITWISE_COPY>::Set(const SArray<ELEMENT, BITWISE_COPY> &array)
+{
+ WRAPPER_NO_CONTRACT;
+ if (BITWISE_COPY)
+ {
+ m_buffer.Set(array.m_buffer);
+ }
+ else
+ {
+ DestructBuffer(Begin(), GetCount());
+ m_buffer.SetSize(0);
+ m_buffer.SetSize(array.m_buffer.GetSize());
+ CopyConstructBuffer(Begin(), GetCount(), array.GetElements());
+ }
+}
+
+template <typename ELEMENT, BOOL BITWISE_COPY>
+inline COUNT_T SArray<ELEMENT, BITWISE_COPY>::GetCount() const
+{
+ WRAPPER_NO_CONTRACT;
+ return m_buffer.GetSize()/sizeof(ELEMENT);
+}
+
+template <typename ELEMENT, BOOL BITWISE_COPY>
+inline BOOL SArray<ELEMENT, BITWISE_COPY>::IsEmpty() const
+{
+ WRAPPER_NO_CONTRACT;
+ return GetCount() == 0;
+}
+
+template <typename ELEMENT, BOOL BITWISE_COPY>
+inline void SArray<ELEMENT, BITWISE_COPY>::SetCount(COUNT_T count)
+{
+ WRAPPER_NO_CONTRACT;
+ COUNT_T oldCount = GetCount();
+ if (count > oldCount)
+ ConstructBuffer(Begin() + oldCount, count - oldCount);
+
+ m_buffer.SetSize(count*sizeof(ELEMENT));
+
+ if (oldCount > count)
+ DestructBuffer(Begin() + count, oldCount - count);
+}
+
+template <typename ELEMENT, BOOL BITWISE_COPY>
+inline COUNT_T SArray<ELEMENT, BITWISE_COPY>::GetAllocation() const
+{
+ WRAPPER_NO_CONTRACT;
+ return m_buffer.GetAllocation() / sizeof(ELEMENT);
+}
+
+template <typename ELEMENT, BOOL BITWISE_COPY>
+inline void SArray<ELEMENT, BITWISE_COPY>::Preallocate(int count) const
+{
+ WRAPPER_NO_CONTRACT;
+ m_buffer.Preallocate(count * sizeof(ELEMENT));
+}
+
+template <typename ELEMENT, BOOL BITWISE_COPY>
+inline void SArray<ELEMENT, BITWISE_COPY>::Trim() const
+{
+ WRAPPER_NO_CONTRACT;
+ m_buffer.Trim();
+}
+
+template <typename ELEMENT, BOOL BITWISE_COPY>
+inline void SArray<ELEMENT, BITWISE_COPY>::Copy(const Iterator &to, const Iterator &from, COUNT_T size)
+{
+ WRAPPER_NO_CONTRACT;
+ // @todo: destruction/construction semantics are broken on overlapping copies
+
+ DestructBuffer(to, size);
+
+ CopyConstructBuffer(to, size, from);
+}
+
+template <typename ELEMENT, BOOL BITWISE_COPY>
+inline void SArray<ELEMENT, BITWISE_COPY>::Move(const Iterator &to, const Iterator &from, COUNT_T size)
+{
+ // @todo: destruction/construction semantics are broken on overlapping moves
+
+ DestructBuffer(to, size);
+
+ m_buffer.Move(to, from, size*sizeof(ELEMENT));
+
+ ConstructBuffer(from, size);
+}
+
+template <typename ELEMENT, BOOL BITWISE_COPY>
+inline void SArray<ELEMENT, BITWISE_COPY>::Copy(const Iterator &i, const ELEMENT *source, COUNT_T size)
+{
+ WRAPPER_NO_CONTRACT;
+ DestructBuffer(i, size);
+
+ CopyConstructBuffer(i, size, source);
+}
+
+template <typename ELEMENT, BOOL BITWISE_COPY>
+inline void SArray<ELEMENT, BITWISE_COPY>::Copy(void *dest, const Iterator &i, COUNT_T size)
+{
+ WRAPPER_NO_CONTRACT;
+ // @todo: destruction/construction semantics are unclear
+
+ m_buffer.Copy(dest, i.m_i, size*sizeof(ELEMENT));
+}
+
+template <typename ELEMENT, BOOL BITWISE_COPY>
+inline void SArray<ELEMENT, BITWISE_COPY>::Insert(const Iterator &i)
+{
+ WRAPPER_NO_CONTRACT;
+ Replace(i, 0, 1);
+}
+
+template <typename ELEMENT, BOOL BITWISE_COPY>
+inline void SArray<ELEMENT, BITWISE_COPY>::Delete(const Iterator &i)
+{
+ WRAPPER_NO_CONTRACT;
+ Replace(i, 1, 0);
+}
+
+template <typename ELEMENT, BOOL BITWISE_COPY>
+inline void SArray<ELEMENT, BITWISE_COPY>::Insert(const Iterator &i, COUNT_T count)
+{
+ WRAPPER_NO_CONTRACT;
+ Replace(i, 0, count);
+}
+
+template <typename ELEMENT, BOOL BITWISE_COPY>
+inline void SArray<ELEMENT, BITWISE_COPY>::Delete(const Iterator &i, COUNT_T count)
+{
+ Delete(i, 0, count);
+}
+
+template <typename ELEMENT, BOOL BITWISE_COPY>
+inline void SArray<ELEMENT, BITWISE_COPY>:: Replace(const Iterator &i, COUNT_T deleteCount, COUNT_T insertCount)
+{
+ WRAPPER_NO_CONTRACT;
+ DestructBuffer(i, deleteCount);
+
+ m_buffer.Replace(i.m_i, deleteCount*sizeof(ELEMENT), insertCount*sizeof(ELEMENT));
+
+ ConstructBuffer(i, insertCount);
+}
+
+template <typename ELEMENT, BOOL BITWISE_COPY>
+inline ELEMENT &SArray<ELEMENT, BITWISE_COPY>::operator[](int index)
+{
+ WRAPPER_NO_CONTRACT;
+ return *(GetElements() + index);
+}
+
+template <typename ELEMENT, BOOL BITWISE_COPY>
+inline const ELEMENT &SArray<ELEMENT, BITWISE_COPY>::operator[](int index) const
+{
+ WRAPPER_NO_CONTRACT;
+ return *(GetElements() + index);
+}
+
+template <typename ELEMENT, BOOL BITWISE_COPY>
+inline ELEMENT &SArray<ELEMENT, BITWISE_COPY>::operator[](COUNT_T index)
+{
+ WRAPPER_NO_CONTRACT;
+ return *(GetElements() + index);
+}
+
+template <typename ELEMENT, BOOL BITWISE_COPY>
+inline const ELEMENT &SArray<ELEMENT, BITWISE_COPY>::operator[](COUNT_T index) const
+{
+ return *(GetElements() + index);
+}
+
+template <typename ELEMENT, BOOL BITWISE_COPY>
+inline ELEMENT *SArray<ELEMENT, BITWISE_COPY>::GetElements() const
+{
+ LIMITED_METHOD_CONTRACT;
+ return (ELEMENT *) (const BYTE *) m_buffer;
+}
+
+template <typename ELEMENT, BOOL BITWISE_COPY>
+inline void SArray<ELEMENT, BITWISE_COPY>::ConstructBuffer(const Iterator &i, COUNT_T size)
+{
+ CONTRACTL
+ {
+ THROWS;
+ GC_NOTRIGGER;
+ }
+ CONTRACTL_END;
+
+ if (!BITWISE_COPY)
+ {
+ ELEMENT *start = GetElements() + (i - Begin());
+ ELEMENT *end = start + size;
+
+ while (start < end)
+ {
+ new (start) ELEMENT();
+ start++;
+ }
+ }
+}
+
+template <typename ELEMENT, BOOL BITWISE_COPY>
+inline void SArray<ELEMENT, BITWISE_COPY>::CopyConstructBuffer(const Iterator &i, COUNT_T size, const ELEMENT *from)
+{
+ ptrdiff_t start_offset = i - Begin();
+ ELEMENT *p = (ELEMENT *) m_buffer.OpenRawBuffer(m_buffer.GetSize()) + start_offset;
+
+ if (BITWISE_COPY)
+ {
+ memmove(p, from, size * sizeof(ELEMENT));
+ }
+ else
+ {
+ ELEMENT *start = (ELEMENT *) p;
+ ELEMENT *end = (ELEMENT *) (p + size);
+
+ while (start < end)
+ {
+ new (start) ELEMENT(*from);
+
+ start++;
+ from++;
+ }
+ }
+
+ m_buffer.CloseRawBuffer();
+}
+
+template <typename ELEMENT, BOOL BITWISE_COPY>
+inline void SArray<ELEMENT, BITWISE_COPY>::DestructBuffer(const Iterator &i, COUNT_T size)
+{
+ CONTRACTL
+ {
+ THROWS;
+ GC_NOTRIGGER;
+ }
+ CONTRACTL_END;
+
+ if (!BITWISE_COPY)
+ {
+ ELEMENT *start = GetElements() + (i - Begin());
+ ELEMENT *end = start + size;
+
+ while (start < end)
+ {
+ start->ELEMENT::~ELEMENT();
+
+ start++;
+ }
+ }
+}
+
+template <typename ELEMENT, COUNT_T SIZE, BOOL BITWISE_COPY>
+inline InlineSArray<ELEMENT, SIZE, BITWISE_COPY>::InlineSArray()
+ : SArray<ELEMENT, BITWISE_COPY>((void*)m_prealloc, SIZE)
+{
+ LIMITED_METHOD_CONTRACT;
+}
+
+#endif // _SARRAY_INL_
diff --git a/src/inc/sbuffer.h b/src/inc/sbuffer.h
new file mode 100644
index 0000000000..e56322ac88
--- /dev/null
+++ b/src/inc/sbuffer.h
@@ -0,0 +1,575 @@
+// 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.
+// --------------------------------------------------------------------------------
+// SBuffer.h (Safe Buffer)
+//
+
+// --------------------------------------------------------------------------------
+
+// --------------------------------------------------------------------------------
+// SBuffer is a relatively safe way to manipulate a dynamically
+// allocated data buffer. An SBuffer is conceptually a simple array
+// of bytes. It maintains both a conceptual size and an actual allocated size.
+//
+// SBuffer provides safe access to the data buffer by providing rich high
+// level functionality (like insertion, deleteion, copying, comparison, and
+// iteration) without exposing direct pointers to its buffers.
+//
+// For interoperability, SBuffers can expose their buffers - either as readonly
+// by BYTE * or void * cases, or as writable by the OpenRawBuffer/CloseRawBuffer
+// entry points. Use of these should be limited wherever possible though; as there
+// is always a possibilility of buffer overrun.
+//
+// To mimimize heap allocations, the InlineSBuffer template will preallocate a fixed
+// size buffer inline with the SBuffer object itself. It will use this buffer unless
+// it needs a bigger one, in which case it transparently moves on to using the heap.
+// The StackSBuffer class instatiates the InlineSBuffer with a standard heuristic
+// stack preallocation size.
+//
+// SBuffer is "subclassable" to add content typeing to the buffer. See SArray and
+// SString for examples.
+// --------------------------------------------------------------------------------
+
+
+#ifndef _SBUFFER_H_
+#define _SBUFFER_H_
+
+#include "clrtypes.h"
+#include "iterator.h"
+#include "check.h"
+#include "daccess.h"
+#include "memoryrange.h"
+
+// ================================================================================
+// Macros for computing padding
+// ================================================================================
+
+#define ALIGNMENT(size) \
+ (( (size^(size-1)) >> 1) +1)
+
+#define ALIGN(size, align) \
+ (((size)+((align)-1)) & ~((align)-1))
+
+#define PAD(size, align) \
+ (ALIGN((size), (align)) - (size))
+
+// ================================================================================
+// SBuffer : base class for safe buffers
+// ================================================================================
+
+typedef DPTR(class SBuffer) PTR_SBuffer;
+
+class SBuffer
+{
+ public:
+ //--------------------------------------------------------------------
+ // Flags and constants
+ //--------------------------------------------------------------------
+
+ enum ImmutableFlag
+ {
+ Immutable
+ };
+
+ enum PreallocFlag
+ {
+ Prealloc
+ };
+
+ //--------------------------------------------------------------------
+ // Types
+ //--------------------------------------------------------------------
+
+ public:
+ class CIterator;
+ friend class CIterator;
+
+ class Iterator;
+ friend class Iterator;
+
+ //--------------------------------------------------------------------
+ // Initializers and constructors
+ //--------------------------------------------------------------------
+
+ public:
+ // Constructors
+ SBuffer();
+ SBuffer(COUNT_T size);
+ SBuffer(const BYTE *buffer, COUNT_T size);
+ explicit SBuffer(const SBuffer &buffer);
+
+ // Immutable constructor should ONLY be used if buffer will
+ // NEVER BE FREED OR MODIFIED. PERIOD. .
+ SBuffer(ImmutableFlag immutable, const BYTE *buffer, COUNT_T size);
+
+ // Prealloc should be allocated inline with SBuffer - it must have the same
+ // lifetime as SBuffer's memory.
+ SBuffer(PreallocFlag prealloc, void *buffer, COUNT_T size);
+
+ ~SBuffer();
+
+ void Clear();
+
+ void Set(const SBuffer &buffer);
+ void Set(const BYTE *buffer, COUNT_T size);
+ void SetImmutable(const BYTE *buffer, COUNT_T size);
+
+ //--------------------------------------------------------------------
+ // Buffer size routines. A buffer has an externally visible size, but
+ // it also has an internal allocation size which may be larger.
+ //--------------------------------------------------------------------
+
+ // Get and set size of buffer. Note that the actual size of the
+ // internally allocated memory block may be bigger.
+ COUNT_T GetSize() const;
+ void SetSize(COUNT_T count);
+
+ // Grow size of buffer to maximum amount without reallocating.
+ void MaximizeSize();
+
+ //--------------------------------------------------------------------
+ // Buffer allocation routines
+ //--------------------------------------------------------------------
+
+ // Return the current available allocation space of the buffer.
+ COUNT_T GetAllocation() const;
+
+ // Preallocate some memory you expect to use. This can prevent
+ // multiple reallocations. Note this does not change the visible
+ // size of the buffer.
+ void Preallocate(COUNT_T allocation) const;
+
+ // Shrink memory usage of buffer to minimal amount. Note that
+ // this does not change the visible size of the buffer.
+ void Trim() const;
+
+ //--------------------------------------------------------------------
+ // Content manipulation routines
+ //--------------------------------------------------------------------
+
+ void Zero();
+ void Fill(BYTE value);
+ void Fill(const Iterator &to, BYTE value, COUNT_T size);
+
+ // Internal copy. "Copy" leaves from range as is; "Move"
+ // leaves from range in uninitialized state.
+ // (This distinction is more important when using from a
+ // typed wrapper than in the base SBuffer class.)
+ //
+ // NOTE: Copy vs Move is NOT based on whether ranges overlap
+ // or not. Ranges may overlap in either case.
+ //
+ // Note that both Iterators must be on THIS buffer.
+ void Copy(const Iterator &to, const CIterator &from, COUNT_T size);
+ void Move(const Iterator &to, const CIterator &from, COUNT_T size);
+
+ // External copy.
+ void Copy(const Iterator &i, const SBuffer &source);
+ void Copy(const Iterator &i, const void *source, COUNT_T size);
+ void Copy(void *dest, const CIterator &i, COUNT_T size);
+
+ // Insert bytes at the given iterator location.
+ void Insert(const Iterator &i, const SBuffer &source);
+ void Insert(const Iterator &i, COUNT_T size);
+
+ // Delete bytes at the given iterator location
+ void Delete(const Iterator &i, COUNT_T size);
+
+ // Replace bytes at the given iterator location
+ void Replace(const Iterator &i, COUNT_T deleteSize, const SBuffer &insert);
+ void Replace(const Iterator &i, COUNT_T deleteSize, COUNT_T insertSize);
+
+ // Compare entire buffer; return -1, 0, 1
+ int Compare(const SBuffer &compare) const;
+ int Compare(const BYTE *match, COUNT_T size) const;
+
+ // Compare entire buffer; return TRUE or FALSE
+ BOOL Equals(const SBuffer &compare) const;
+ BOOL Equals(const BYTE *match, COUNT_T size) const;
+
+ // Match portion of this buffer to given bytes; return TRUE or FALSE
+ BOOL Match(const CIterator &i, const SBuffer &match) const;
+ BOOL Match(const CIterator &i, const BYTE *match, COUNT_T size) const;
+
+ //--------------------------------------------------------------------
+ // Iterators
+ //
+ // Note that any iterator returned is not
+ // valid after any operation which may resize the buffer, unless
+ // the operation was performed on that particular iterator.
+ //--------------------------------------------------------------------
+
+ CIterator Begin() const;
+ CIterator End() const;
+
+ Iterator Begin();
+ Iterator End();
+
+ BYTE & operator[] (int index);
+ const BYTE & operator[] (int index) const;
+
+ //--------------------------------------------------------------------
+ // Raw buffer access
+ //
+ // Accessing a raw buffer via pointer is inherently more dangerous than
+ // other uses of this API, and should be avoided if at all possible.
+ // It is primarily provided for compatibility with existing APIs.
+ //
+ // Note that any buffer pointer returned is not
+ // valid after any operation which may resize the buffer.
+ //--------------------------------------------------------------------
+
+ // Casting operators return the existing buffer as
+ // a raw const pointer. Note that the pointer is valid only
+ // until the buffer is modified via an API.
+ operator const void *() const;
+ operator const BYTE *() const;
+
+ // To write directly to the SString's underlying buffer:
+ // 1) Call OpenRawBuffer() and pass it the count of bytes
+ // you need.
+ // 2) That returns a pointer to the raw buffer which you can write to.
+ // 3) When you are done writing to the pointer, call CloseBuffer()
+ // and pass it the count of bytes you actually wrote.
+ // The pointer from step 1 is now invalid.
+
+ // example usage:
+ // void GetInfo(SBuffer &buf)
+ // {
+ // BYTE *p = buf.OpenRawBuffer(3);
+ // OSGetSomeInfo(p, 3);
+ // buf.CloseRawBuffer();
+ // }
+
+ // You should open the buffer, write the data, and immediately close it.
+ // No sbuffer operations are valid while the buffer is opened.
+ //
+ // In a debug build, Open/Close will do lots of little checks to make sure
+ // you don't buffer overflow while it's opened. In a retail build, this
+ // is a very streamlined action.
+
+ // Open the raw buffer for writing count bytes
+ BYTE *OpenRawBuffer(COUNT_T maxCount);
+
+ // Call after OpenRawBuffer().
+
+ // Provide the count of bytes actually used. This will make sure the
+ // SBuffer's size is correct.
+ void CloseRawBuffer(COUNT_T actualCount);
+
+ // Close the buffer. Assumes that we completely filled the buffer
+ // that OpenRawBuffer() gave back.
+ void CloseRawBuffer();
+
+ //--------------------------------------------------------------------
+ // Check routines. These are typically used internally, but may be
+ // called externally if desired.
+ //--------------------------------------------------------------------
+
+ CHECK CheckBufferClosed() const;
+ static CHECK CheckSize(COUNT_T size);
+ static CHECK CheckAllocation(COUNT_T allocation);
+ CHECK CheckIteratorRange(const CIterator &i) const;
+ CHECK CheckIteratorRange(const CIterator &i, COUNT_T size) const;
+
+ CHECK Check() const;
+ CHECK Invariant() const;
+ CHECK InternalInvariant() const;
+
+ protected:
+
+ //--------------------------------------------------------------------
+ // Internal helper routines
+ //--------------------------------------------------------------------
+
+ // Preserve = preserve contents while reallocating
+ typedef enum
+ {
+ DONT_PRESERVE = 0,
+ PRESERVE = 1,
+ } Preserve;
+
+ void Resize(COUNT_T size, Preserve preserve = PRESERVE);
+ void ResizePadded(COUNT_T size, Preserve preserve = PRESERVE);
+ void TweakSize(COUNT_T size);
+ void ReallocateBuffer(COUNT_T allocation, Preserve preserve);
+ void EnsureMutable() const;
+
+ //--------------------------------------------------------------------
+ // We define some extra flags and fields for subclasses (these are specifically
+ // designed for SString, but use otherwise if desired.)
+ //--------------------------------------------------------------------
+
+ BOOL IsFlag1() const;
+ void SetFlag1();
+ void ClearFlag1();
+
+ BOOL IsFlag2() const;
+ void SetFlag2();
+ void ClearFlag2();
+
+ BOOL IsFlag3() const;
+ void SetFlag3();
+ void ClearFlag3();
+
+ INT GetRepresentationField() const;
+ void SetRepresentationField(int value);
+
+ protected:
+
+ //--------------------------------------------------------------------
+ // Flag access
+ //--------------------------------------------------------------------
+
+ BOOL IsAllocated() const;
+ void SetAllocated();
+ void ClearAllocated();
+
+ BOOL IsImmutable() const;
+ void SetImmutable();
+ void ClearImmutable();
+
+#if _DEBUG
+ BOOL IsOpened() const;
+ void SetOpened();
+ void ClearOpened();
+#endif
+
+ //--------------------------------------------------------------------
+ // Buffer management routines
+ //--------------------------------------------------------------------
+
+ // Allocate and free a memory buffer
+ BYTE *NewBuffer(COUNT_T allocation);
+ void DeleteBuffer(BYTE *buffer, COUNT_T allocation);
+
+ // Use existing buffer
+ BYTE *UseBuffer(BYTE *buffer, COUNT_T *allocation);
+
+ CHECK CheckBuffer(const BYTE* buffer, COUNT_T allocation) const;
+
+ // Manipulates contents of the buffer via the plugins below, but
+ // adds some debugging checks. Should always call through here rather
+ // than directly calling the extensibility points.
+ void DebugMoveBuffer(__out_bcount(size) BYTE *to, BYTE *from, COUNT_T size);
+ void DebugCopyConstructBuffer(__out_bcount(size) BYTE *to, const BYTE *from, COUNT_T size);
+ void DebugConstructBuffer(BYTE *buffer, COUNT_T size);
+ void DebugDestructBuffer(BYTE *buffer, COUNT_T size);
+
+ void DebugStompUnusedBuffer(BYTE *buffer, COUNT_T size);
+#ifdef _DEBUG
+ static BOOL EnsureGarbageCharOnly(const BYTE *buffer, COUNT_T size);
+#endif
+ CHECK CheckUnusedBuffer(const BYTE *buffer, COUNT_T size) const;
+
+#ifdef DACCESS_COMPILE
+public:
+
+ // Expose the raw Target address of the buffer to DAC.
+ // This does not do any marshalling. This can be useful if the caller wants to allocate the buffer on
+ // its own heap so that it can survive Flush calls.
+ MemoryRange DacGetRawBuffer() const
+ {
+ SUPPORTS_DAC;
+ PTR_VOID p = dac_cast<PTR_VOID>((TADDR) m_buffer);
+ return MemoryRange(p, GetSize());
+ }
+
+protected:
+
+ // Return a host copy of the buffer, allocated on the DAC heap (and thus invalidated at the next call to Flush).
+ void* DacGetRawContent(void) const
+ {
+ SUPPORTS_DAC;
+
+ // SBuffers are used in DAC in two ways - buffers in the host, and marshalled buffers from the target.
+ // This is a problem - we can't reason about the address space of the buffer statically, and instead rely on
+ // the dynamic usage (i.e. the methods are basically bifurcated into those you can use on host instances,
+ // and those you can use on marshalled copies).
+ // Ideally we'll have two versions of the SBuffer code - one that's marshalled (normal DACization) and one
+ // that isn't (host-only utility). This is the "dual-mode DAC problem".
+ // But this only affects a couple classes, and so for now we'll ignore the problem - causing a bunch of DacCop
+ // violations.
+ DACCOP_IGNORE(CastBetweenAddressSpaces, "SBuffer has the dual-mode DAC problem");
+ DACCOP_IGNORE(FieldAccess, "SBuffer has the dual-mode DAC problem");
+ TADDR bufAddr = (TADDR)m_buffer;
+
+ return DacInstantiateTypeByAddress(bufAddr, m_size, true);
+ }
+
+ void EnumMemoryRegions(CLRDataEnumMemoryFlags flags) const
+ {
+ SUPPORTS_DAC;
+
+ if (flags != CLRDATA_ENUM_MEM_TRIAGE)
+ {
+ DacEnumMemoryRegion((TADDR)m_buffer, m_size);
+ }
+ }
+#endif
+
+ //----------------------------------------------------------------------------
+ // Iterator base class
+ //----------------------------------------------------------------------------
+
+ friend class CheckedIteratorBase<SBuffer>;
+
+ class Index : public CheckedIteratorBase<SBuffer>
+ {
+ friend class SBuffer;
+
+ friend class CIterator;
+ friend class Indexer<const BYTE, CIterator>;
+
+ friend class Iterator;
+ friend class Indexer<BYTE, Iterator>;
+
+ protected:
+ BYTE* m_ptr;
+
+ Index();
+ Index(SBuffer *container, SCOUNT_T index);
+ BYTE &GetAt(SCOUNT_T delta) const;
+ void Skip(SCOUNT_T delta);
+ SCOUNT_T Subtract(const Index &i) const;
+
+ CHECK DoCheck(SCOUNT_T delta) const;
+
+ void Resync(const SBuffer *container, BYTE *value) const;
+ };
+
+ public:
+
+ class CIterator : public Index, public Indexer<const BYTE, CIterator>
+ {
+ friend class SBuffer;
+
+ public:
+ CIterator()
+ {
+ }
+
+ CIterator(const SBuffer *buffer, int index)
+ : Index(const_cast<SBuffer*>(buffer), index)
+ {
+ }
+ };
+
+ class Iterator : public Index, public Indexer<BYTE, Iterator>
+ {
+ friend class SBuffer;
+
+ public:
+ operator const CIterator &() const
+ {
+ return *(const CIterator *)this;
+ }
+
+ operator CIterator &()
+ {
+ return *(CIterator *)this;
+ }
+
+ Iterator()
+ {
+ }
+
+ Iterator(SBuffer *buffer, int index)
+ : Index(buffer, index)
+ {
+ }
+
+ };
+
+
+ //----------------------------------------------------------------------------
+ // Member and data declarations
+ //----------------------------------------------------------------------------
+
+ private:
+ enum
+ {
+ REPRESENTATION_MASK = 0x07,
+ ALLOCATED = 0x08,
+ IMMUTABLE = 0x10,
+ OPENED = 0x20,
+ FLAG1 = 0x40,
+ FLAG2 = 0x80,
+ FLAG3 = 0x100,
+ };
+
+ COUNT_T m_size; // externally visible size
+ COUNT_T m_allocation; // actual allocated size
+ UINT32 m_flags; // @todo: steal flags from sizes
+
+ protected:
+ union {
+ BYTE *m_buffer;
+ wchar_t *m_asStr; // For debugging, view as a unicode string
+ };
+
+#if _DEBUG
+ protected:
+ // We will update the "revision" of the buffer every time it is potentially reallocation,
+ // so we can tell when iterators are no longer valid.
+ int m_revision;
+#endif
+};
+
+// ================================================================================
+// InlineSBuffer : Tlempate for an SBuffer with preallocated buffer space
+// ================================================================================
+
+#define BUFFER_ALIGNMENT 4
+
+template <COUNT_T size>
+class InlineSBuffer : public SBuffer
+{
+ private:
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable:4200) // zero sized array
+#pragma warning(disable:4324) // don't complain if DECLSPEC_ALIGN actually pads
+ DECLSPEC_ALIGN(BUFFER_ALIGNMENT) BYTE m_prealloc[size];
+#pragma warning(pop)
+#else
+ // use UINT64 to get maximum alignment of the memory
+ UINT64 m_prealloc[ALIGN(size,sizeof(UINT64))/sizeof(UINT64)];
+#endif // _MSC_VER
+
+ public:
+ InlineSBuffer()
+ : SBuffer(Prealloc, (BYTE*)m_prealloc, size)
+ {
+ WRAPPER_NO_CONTRACT;
+ }
+};
+
+
+// a 1K sized buffer filled with $ that we'll use in debug builds for verification
+#define GARBAGE_FILL_DWORD 0x24242424 // $$$$
+#define GARBAGE_FILL_BUFFER_ITEMS 16
+#define GARBAGE_FILL_BUFFER_SIZE GARBAGE_FILL_BUFFER_ITEMS*sizeof(DWORD)
+// ================================================================================
+// StackSBuffer : SBuffer with relatively large preallocated buffer for stack use
+// ================================================================================
+
+#define STACK_ALLOC 256
+
+typedef InlineSBuffer<STACK_ALLOC> StackSBuffer;
+
+// ================================================================================
+// Inline definitions
+// ================================================================================
+
+/// a wrapper for templates and such, that use "==".
+/// more expensive than a typical "==", though
+inline BOOL operator == (const SBuffer& b1,const SBuffer& b2)
+{
+ return b1.Equals(b2);
+};
+
+#include <sbuffer.inl>
+
+#endif // _SBUFFER_H_
diff --git a/src/inc/sbuffer.inl b/src/inc/sbuffer.inl
new file mode 100644
index 0000000000..96be7a5665
--- /dev/null
+++ b/src/inc/sbuffer.inl
@@ -0,0 +1,1711 @@
+// 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.
+
+//
+
+#ifndef _SBUFFER_INL_
+#define _SBUFFER_INL_
+
+#include "sbuffer.h"
+
+#if defined(_MSC_VER)
+#pragma inline_depth (20)
+#endif
+
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable:4702) // Disable bogus unreachable code warning
+#endif // _MSC_VER
+
+inline SBuffer::SBuffer(PreallocFlag flag, void *buffer, COUNT_T size)
+ : m_size(0),
+ m_allocation(NULL),
+ m_flags(0),
+ m_buffer(NULL)
+{
+ CONTRACT_VOID
+ {
+ CONSTRUCTOR_CHECK;
+ PRECONDITION(CheckPointer(buffer));
+ PRECONDITION(CheckSize(size));
+ NOTHROW;
+ GC_NOTRIGGER;
+ SUPPORTS_DAC_HOST_ONLY;
+ }
+ CONTRACT_END;
+
+ m_buffer = UseBuffer((BYTE *) buffer, &size);
+ m_allocation = size;
+
+#ifdef _DEBUG
+ m_revision = 0;
+#endif
+
+ RETURN;
+}
+
+inline SBuffer::SBuffer()
+ : m_size(0),
+ m_allocation(0),
+ m_flags(0),
+ m_buffer(NULL)
+{
+ CONTRACT_VOID
+ {
+ CONSTRUCTOR_CHECK;
+ NOTHROW;
+ GC_NOTRIGGER;
+ }
+ CONTRACT_END;
+
+#ifdef _DEBUG
+ m_revision = 0;
+#endif
+
+ RETURN;
+}
+
+inline SBuffer::SBuffer(COUNT_T size)
+ : m_size(0),
+ m_allocation(0),
+ m_flags(0),
+ m_buffer(NULL)
+{
+ CONTRACT_VOID
+ {;
+ CONSTRUCTOR_CHECK;
+ PRECONDITION(CheckSize(size));
+ THROWS;
+ GC_NOTRIGGER;
+ }
+ CONTRACT_END;
+
+ Resize(size);
+
+#ifdef _DEBUG
+ m_revision = 0;
+#endif
+
+ RETURN;
+}
+
+inline SBuffer::SBuffer(const SBuffer &buffer)
+ : m_size(0),
+ m_allocation(0),
+ m_flags(0),
+ m_buffer(NULL)
+{
+ CONTRACT_VOID
+ {
+ CONSTRUCTOR_CHECK;
+ PRECONDITION(buffer.Check());
+ POSTCONDITION(Equals(buffer));
+ THROWS;
+ GC_NOTRIGGER;
+ }
+ CONTRACT_END;
+
+ Set(buffer);
+
+#ifdef _DEBUG
+ m_revision = 0;
+#endif
+
+ RETURN;
+}
+
+inline SBuffer::SBuffer(const BYTE *buffer, COUNT_T size)
+ : m_size(0),
+ m_allocation(0),
+ m_flags(0),
+ m_buffer(NULL)
+{
+ CONTRACT_VOID
+ {
+ CONSTRUCTOR_CHECK;
+ PRECONDITION(CheckPointer(buffer));
+ PRECONDITION(CheckSize(size));
+ POSTCONDITION(Equals(buffer, size));
+ THROWS;
+ GC_NOTRIGGER;
+ }
+ CONTRACT_END;
+
+ Set(buffer, size);
+
+#ifdef _DEBUG
+ m_revision = 0;
+#endif
+
+ RETURN;
+}
+
+
+inline SBuffer::SBuffer(ImmutableFlag immutable, const BYTE *buffer, COUNT_T size)
+ : m_size(size),
+ m_allocation(size),
+ m_flags(IMMUTABLE),
+ m_buffer(const_cast<BYTE*>(buffer))
+{
+ CONTRACT_VOID
+ {
+ CONSTRUCTOR_CHECK;
+ PRECONDITION(CheckPointer(buffer));
+ PRECONDITION(CheckSize(size));
+ POSTCONDITION(Equals(buffer, size));
+ NOTHROW;
+ GC_NOTRIGGER;
+ SO_TOLERANT;
+ SUPPORTS_DAC_HOST_ONLY;
+ }
+ CONTRACT_END;
+
+#ifdef _DEBUG
+ m_revision = 0;
+#endif
+
+ RETURN;
+}
+
+inline SBuffer::~SBuffer()
+{
+ CONTRACT_VOID
+ {
+ NOTHROW;
+ DESTRUCTOR_CHECK;
+ SO_TOLERANT;
+ GC_NOTRIGGER;
+ SO_TOLERANT;
+ SUPPORTS_DAC_HOST_ONLY;
+ }
+ CONTRACT_END;
+ VALIDATE_BACKOUT_STACK_CONSUMPTION;
+
+ if (IsAllocated())
+ {
+ DeleteBuffer(m_buffer, m_allocation);
+ }
+
+ RETURN;
+}
+
+inline void SBuffer::Set(const SBuffer &buffer)
+{
+ CONTRACT_VOID
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(buffer.Check());
+ POSTCONDITION(Equals(buffer));
+ THROWS;
+ GC_NOTRIGGER;
+ SUPPORTS_DAC_HOST_ONLY;
+ }
+ CONTRACT_END;
+
+ if (buffer.IsImmutable()
+ && (IsImmutable() || m_allocation < buffer.GetSize()))
+ {
+ // Share immutable block rather than reallocate and copy
+ // (Note that we prefer to copy to our buffer if we
+ // don't have to reallocate it.)
+
+ if (IsAllocated())
+ DeleteBuffer(m_buffer, m_allocation);
+
+ m_size = buffer.m_size;
+ m_allocation = buffer.m_allocation;
+ m_buffer = buffer.m_buffer;
+ m_flags = buffer.m_flags;
+
+#if _DEBUG
+ // Increment our revision to invalidate iterators
+ m_revision++;
+#endif
+
+ }
+ else
+ {
+ Resize(buffer.m_size, DONT_PRESERVE);
+ EnsureMutable();
+
+ // PreFix seems to think it can choose m_allocation==0 and buffer.m_size > 0 here.
+ // From the code for Resize and EnsureMutable, this is clearly impossible.
+ PREFIX_ASSUME( (this->m_buffer != NULL) || (buffer.m_size == 0) );
+
+ MoveMemory(m_buffer, buffer.m_buffer, buffer.m_size);
+ }
+
+ RETURN;
+}
+
+inline void SBuffer::Set(const BYTE *buffer, COUNT_T size)
+{
+ CONTRACT_VOID
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(CheckPointer(buffer, size == 0 ? NULL_OK : NULL_NOT_OK));
+ PRECONDITION(CheckSize(size));
+ POSTCONDITION(Equals(buffer, size));
+ THROWS;
+ GC_NOTRIGGER;
+ }
+ CONTRACT_END;
+
+ Resize(size);
+ EnsureMutable();
+
+ // PreFix seems to think it can choose m_allocation==0 and size > 0 here.
+ // From the code for Resize, this is clearly impossible.
+ PREFIX_ASSUME( (this->m_buffer != NULL) || (size == 0) );
+
+ MoveMemory(m_buffer, buffer, size);
+
+ RETURN;
+}
+
+inline void SBuffer::SetImmutable(const BYTE *buffer, COUNT_T size)
+{
+ CONTRACT_VOID
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(CheckPointer(buffer, size == 0 ? NULL_OK : NULL_NOT_OK));
+ PRECONDITION(CheckSize(size));
+ POSTCONDITION(Equals(buffer, size));
+ NOTHROW;
+ GC_NOTRIGGER;
+ SUPPORTS_DAC_HOST_ONLY;
+
+ }
+ CONTRACT_END;
+
+ SBuffer temp(Immutable, buffer, size);
+
+ {
+ // This can't really throw
+ CONTRACT_VIOLATION(ThrowsViolation);
+ Set(temp);
+ }
+
+ RETURN;
+}
+
+inline COUNT_T SBuffer::GetSize() const
+{
+ LIMITED_METHOD_CONTRACT;
+ SUPPORTS_DAC;
+
+ return m_size;
+}
+
+inline void SBuffer::SetSize(COUNT_T size)
+{
+ CONTRACT_VOID
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(CheckSize(size));
+ THROWS;
+ GC_NOTRIGGER;
+ }
+ CONTRACT_END;
+
+ Resize(size);
+
+ RETURN;
+}
+
+inline void SBuffer::MaximizeSize()
+{
+ CONTRACT_VOID
+ {
+ INSTANCE_CHECK;
+ THROWS;
+ GC_NOTRIGGER;
+ }
+ CONTRACT_END;
+
+ if (!IsImmutable())
+ Resize(m_allocation);
+
+ RETURN;
+}
+
+inline COUNT_T SBuffer::GetAllocation() const
+{
+ CONTRACT(COUNT_T)
+ {
+ INSTANCE_CHECK;
+ NOTHROW;
+ GC_NOTRIGGER;
+ SO_TOLERANT;
+ SUPPORTS_DAC;
+ }
+ CONTRACT_END;
+
+ RETURN m_allocation;
+}
+
+inline void SBuffer::Preallocate(COUNT_T allocation) const
+{
+ CONTRACT_VOID
+ {
+ if (allocation) THROWS; else NOTHROW;
+ INSTANCE_CHECK;
+ PRECONDITION(CheckAllocation(allocation));
+ THROWS;
+ GC_NOTRIGGER;
+ SUPPORTS_DAC_HOST_ONLY;
+ }
+ CONTRACT_END;
+
+ if (allocation > m_allocation)
+ const_cast<SBuffer *>(this)->ReallocateBuffer(allocation, PRESERVE);
+
+ RETURN;
+}
+
+inline void SBuffer::Trim() const
+{
+ CONTRACT_VOID
+ {
+ INSTANCE_CHECK;
+ THROWS;
+ GC_NOTRIGGER;
+ }
+ CONTRACT_END;
+
+ if (!IsImmutable())
+ const_cast<SBuffer *>(this)->ReallocateBuffer(m_size, PRESERVE);
+
+ RETURN;
+}
+
+inline void SBuffer::Zero()
+{
+ CONTRACT_VOID
+ {
+ INSTANCE_CHECK;
+ NOTHROW;
+ GC_NOTRIGGER;
+ }
+ CONTRACT_END;
+
+ ZeroMemory(m_buffer, m_size);
+
+ RETURN;
+}
+
+inline void SBuffer::Fill(BYTE value)
+{
+ CONTRACT_VOID
+ {
+ INSTANCE_CHECK;
+ NOTHROW;
+ GC_NOTRIGGER;
+ }
+ CONTRACT_END;
+
+ memset(m_buffer, value, m_size);
+
+ RETURN;
+}
+
+inline void SBuffer::Fill(const Iterator &i, BYTE value, COUNT_T size)
+{
+ CONTRACT_VOID
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(CheckIteratorRange(i, size));
+ NOTHROW;
+ GC_NOTRIGGER;
+ }
+ CONTRACT_END;
+
+ memset(i.m_ptr, value, size);
+
+ RETURN;
+}
+
+inline void SBuffer::Copy(const Iterator &to, const CIterator &from, COUNT_T size)
+{
+ CONTRACT_VOID
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(CheckIteratorRange(to, size));
+ PRECONDITION(CheckIteratorRange(from, size));
+ NOTHROW;
+ GC_NOTRIGGER;
+ }
+ CONTRACT_END;
+
+ DebugDestructBuffer(to.m_ptr, size);
+
+ DebugCopyConstructBuffer(to.m_ptr, from.m_ptr, size);
+
+ RETURN;
+}
+
+inline void SBuffer::Move(const Iterator &to, const CIterator &from, COUNT_T size)
+{
+ CONTRACT_VOID
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(CheckIteratorRange(to, size));
+ PRECONDITION(CheckIteratorRange(from, size));
+ NOTHROW;
+ GC_NOTRIGGER;
+ }
+ CONTRACT_END;
+
+ DebugDestructBuffer(to.m_ptr, size);
+
+ DebugMoveBuffer(to.m_ptr, from.m_ptr, size);
+
+ DebugConstructBuffer(from.m_ptr, size);
+
+ RETURN;
+}
+
+inline void SBuffer::Copy(const Iterator &i, const SBuffer &source)
+{
+ CONTRACT_VOID
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(CheckIteratorRange(i, source.GetSize()));
+ PRECONDITION(source.Check());
+ NOTHROW;
+ GC_NOTRIGGER;
+ }
+ CONTRACT_END;
+
+ DebugDestructBuffer(i.m_ptr, source.m_size);
+
+ DebugCopyConstructBuffer(i.m_ptr, source.m_buffer, source.m_size);
+
+ RETURN;
+}
+
+inline void SBuffer::Copy(const Iterator &i, const void *source, COUNT_T size)
+{
+ CONTRACT_VOID
+ {
+ PRECONDITION(CheckPointer(this));
+ PRECONDITION(CheckSize(size));
+ PRECONDITION(CheckIteratorRange(i, size));
+ PRECONDITION(CheckPointer(source, size == 0 ? NULL_OK : NULL_NOT_OK));
+ NOTHROW;
+ GC_NOTRIGGER;
+ SUPPORTS_DAC;
+ }
+ CONTRACT_END;
+
+ DebugDestructBuffer(i.m_ptr, size);
+
+ DebugCopyConstructBuffer(i.m_ptr, (const BYTE *) source, size);
+
+ RETURN;
+}
+
+inline void SBuffer::Copy(void *dest, const CIterator &i, COUNT_T size)
+{
+ CONTRACT_VOID
+ {
+ PRECONDITION(CheckPointer(this));
+ PRECONDITION(CheckSize(size));
+ PRECONDITION(CheckIteratorRange(i, size));
+ PRECONDITION(CheckPointer(dest, size == 0 ? NULL_OK : NULL_NOT_OK));
+ NOTHROW;
+ GC_NOTRIGGER;
+ }
+ CONTRACT_END;
+
+ memcpy(dest, i.m_ptr, size);
+
+ RETURN;
+}
+
+inline void SBuffer::Insert(const Iterator &i, const SBuffer &source)
+{
+ CONTRACT_VOID
+ {
+ INSTANCE_CHECK;
+ THROWS;
+ PRECONDITION(CheckIteratorRange(i,0));
+ GC_NOTRIGGER;
+ }
+ CONTRACT_END;
+
+ Replace(i, 0, source.GetSize());
+ Copy(i, source, source.GetSize());
+
+ RETURN;
+}
+
+inline void SBuffer::Insert(const Iterator &i, COUNT_T size)
+{
+ CONTRACT_VOID
+ {
+ INSTANCE_CHECK;
+ THROWS;
+ PRECONDITION(CheckIteratorRange(i,0));
+ GC_NOTRIGGER;
+ }
+ CONTRACT_END;
+
+ Replace(i, 0, size);
+
+ RETURN;
+}
+
+inline void SBuffer::Clear()
+{
+ CONTRACT_VOID
+ {
+ INSTANCE_CHECK;
+ THROWS;
+ GC_NOTRIGGER;
+ }
+ CONTRACT_END;
+
+ Delete(Begin(), GetSize());
+
+ RETURN;
+}
+
+inline void SBuffer::Delete(const Iterator &i, COUNT_T size)
+{
+ CONTRACT_VOID
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(CheckIteratorRange(i, size));
+ THROWS;
+ GC_NOTRIGGER;
+ }
+ CONTRACT_END;
+
+ Replace(i, size, 0);
+
+ RETURN;
+}
+
+inline void SBuffer::Replace(const Iterator &i, COUNT_T deleteSize, const SBuffer &insert)
+{
+ CONTRACT_VOID
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(CheckIteratorRange(i, deleteSize));
+ THROWS;
+ GC_NOTRIGGER;
+ }
+ CONTRACT_END;
+
+ Replace(i, deleteSize, insert.GetSize());
+ Copy(i, insert, insert.GetSize());
+
+ RETURN;
+}
+
+inline int SBuffer::Compare(const SBuffer &compare) const
+{
+ CONTRACT(int)
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(compare.Check());
+ POSTCONDITION(RETVAL == -1 || RETVAL == 0 || RETVAL == 1);
+ NOTHROW;
+ GC_NOTRIGGER;
+ }
+ CONTRACT_END;
+
+ RETURN Compare(compare.m_buffer, compare.m_size);
+}
+
+inline int SBuffer::Compare(const BYTE *compare, COUNT_T size) const
+{
+ CONTRACT(int)
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(CheckPointer(compare));
+ PRECONDITION(CheckSize(size));
+ POSTCONDITION(RETVAL == -1 || RETVAL == 0 || RETVAL == 1);
+ NOTHROW;
+ GC_NOTRIGGER;
+ }
+ CONTRACT_END;
+
+ COUNT_T smaller;
+ int equals;
+ int result;
+
+ if (m_size < size)
+ {
+ smaller = m_size;
+ equals = -1;
+ }
+ else if (m_size > size)
+ {
+ smaller = size;
+ equals = 1;
+ }
+ else
+ {
+ smaller = size;
+ equals = 0;
+ }
+
+ result = memcmp(m_buffer, compare, size);
+
+ if (result == 0)
+ RETURN equals;
+ else
+ RETURN result;
+}
+
+inline BOOL SBuffer::Equals(const SBuffer &compare) const
+{
+ CONTRACT(int)
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(compare.Check());
+ NOTHROW;
+ GC_NOTRIGGER;
+ SO_TOLERANT;
+ }
+ CONTRACT_END;
+
+ RETURN Equals(compare.m_buffer, compare.m_size);
+}
+
+inline BOOL SBuffer::Equals(const BYTE *compare, COUNT_T size) const
+{
+ CONTRACT(int)
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(CheckPointer(compare));
+ PRECONDITION(CheckSize(size));
+ NOTHROW;
+ GC_NOTRIGGER;
+ SO_TOLERANT;
+ }
+ CONTRACT_END;
+
+ if (m_size != size)
+ RETURN FALSE;
+ else
+ RETURN (memcmp(m_buffer, compare, size) == 0);
+}
+
+inline BOOL SBuffer::Match(const CIterator &i, const SBuffer &match) const
+{
+ CONTRACT(int)
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(CheckIteratorRange(i));
+ PRECONDITION(match.Check());
+ NOTHROW;
+ GC_NOTRIGGER;
+ }
+ CONTRACT_END;
+
+ RETURN Match(i, match.m_buffer, match.m_size);
+}
+
+inline BOOL SBuffer::Match(const CIterator &i, const BYTE *match, COUNT_T size) const
+{
+ CONTRACT(int)
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(CheckIteratorRange(i));
+ PRECONDITION(CheckPointer(match));
+ PRECONDITION(CheckSize(size));
+ NOTHROW;
+ GC_NOTRIGGER;
+ }
+ CONTRACT_END;
+
+ COUNT_T remaining = (COUNT_T) (m_buffer + m_size - i.m_ptr);
+
+ if (remaining < size)
+ RETURN FALSE;
+
+ RETURN (memcmp(i.m_ptr, match, size) == 0);
+}
+
+//----------------------------------------------------------------------------
+// EnsureMutable
+// Ensures that the buffer is mutable
+//----------------------------------------------------------------------------
+inline void SBuffer::EnsureMutable() const
+{
+ CONTRACT_VOID
+ {
+ PRECONDITION(CheckPointer(this));
+ PRECONDITION(CheckBufferClosed());
+ THROWS;
+ GC_NOTRIGGER;
+ SUPPORTS_DAC_HOST_ONLY;
+ }
+ CONTRACT_END;
+
+ if (IsImmutable())
+ const_cast<SBuffer *>(this)->ReallocateBuffer(m_allocation, PRESERVE);
+
+ RETURN;
+}
+
+//----------------------------------------------------------------------------
+// Resize
+// Change the visible size of the buffer; realloc if necessary
+//----------------------------------------------------------------------------
+FORCEINLINE void SBuffer::Resize(COUNT_T size, Preserve preserve)
+{
+ CONTRACT_VOID
+ {
+ PRECONDITION(CheckPointer(this));
+ PRECONDITION(CheckSize(size));
+ POSTCONDITION(GetSize() == size);
+ POSTCONDITION(m_allocation >= GetSize());
+ POSTCONDITION(CheckInvariant(*this));
+ if (size > 0) THROWS; else NOTHROW;
+ GC_NOTRIGGER;
+ SUPPORTS_DAC_HOST_ONLY;
+ }
+ CONTRACT_END;
+
+#ifdef _DEBUG
+ // Change our revision
+ m_revision++;
+#endif
+
+ SCOUNT_T delta = size - m_size;
+
+ if (delta < 0)
+ DebugDestructBuffer(m_buffer + size, -delta);
+
+ // Only actually allocate if we are growing
+ if (size > m_allocation)
+ ReallocateBuffer(size, preserve);
+
+ if (delta > 0)
+ DebugConstructBuffer(m_buffer + m_size, delta);
+
+ m_size = size;
+
+ RETURN;
+}
+
+//----------------------------------------------------------------------------
+// ResizePadded
+// Change the visible size of the buffer; realloc if necessary
+// add extra space to minimize further growth
+//----------------------------------------------------------------------------
+inline void SBuffer::ResizePadded(COUNT_T size, Preserve preserve)
+{
+ CONTRACT_VOID
+ {
+ PRECONDITION(CheckPointer(this));
+ PRECONDITION(CheckSize(size));
+ POSTCONDITION(GetSize() == size);
+ POSTCONDITION(m_allocation >= GetSize());
+ POSTCONDITION(CheckInvariant(*this));
+ if (size > 0) THROWS; else NOTHROW;
+ GC_NOTRIGGER;
+ SUPPORTS_DAC_HOST_ONLY;
+ }
+ CONTRACT_END;
+
+#ifdef _DEBUG
+ // Change our revision
+ m_revision++;
+#endif
+
+ SCOUNT_T delta = size - m_size;
+
+ if (delta < 0)
+ DebugDestructBuffer(m_buffer + size, -delta);
+
+ // Only actually allocate if we are growing
+ if (size > m_allocation)
+ {
+ COUNT_T padded = (size*3)/2;
+
+ ReallocateBuffer(padded, preserve);
+ }
+
+ if (delta > 0)
+ DebugConstructBuffer(m_buffer + m_size, delta);
+
+ m_size = size;
+
+ RETURN;
+}
+
+//----------------------------------------------------------------------------
+// TweakSize
+// An optimized form of Resize, which can only adjust the size within the
+// currently allocated range, and never reallocates
+//----------------------------------------------------------------------------
+inline void SBuffer::TweakSize(COUNT_T size)
+{
+ CONTRACT_VOID
+ {
+ PRECONDITION(CheckPointer(this));
+ PRECONDITION(CheckSize(size));
+ PRECONDITION(size <= GetAllocation());
+ POSTCONDITION(GetSize() == size);
+ POSTCONDITION(CheckInvariant(*this));
+ NOTHROW;
+ SO_TOLERANT;
+ GC_NOTRIGGER;
+ SUPPORTS_DAC_HOST_ONLY;
+ }
+ CONTRACT_END;
+
+#ifdef _DEBUG
+ // Change our revision
+ m_revision++;
+#endif
+
+ SCOUNT_T delta = size - m_size;
+
+ if (delta < 0)
+ DebugDestructBuffer(m_buffer + size, -delta);
+ else
+ DebugConstructBuffer(m_buffer + m_size, delta);
+
+ m_size = size;
+
+ RETURN;
+}
+
+//-----------------------------------------------------------------------------
+// SBuffer allocates all memory via NewBuffer & DeleteBuffer members.
+// If SBUFFER_CANARY_CHECKS is defined, NewBuffer will place Canaries at the start
+// and end of the buffer to detect overflows.
+//-----------------------------------------------------------------------------
+
+#ifdef _DEBUG
+#define SBUFFER_CANARY_CHECKS 1
+#endif
+
+#ifdef SBUFFER_CANARY_CHECKS
+
+// The value we place at the start/end of the buffer,
+static const UINT64 SBUFFER_CANARY_VALUE = UI64(0xD00BED00BED00BAA);
+
+// Expose the quantity of padding needed when providing a prealloced
+// buffer. This is an unrolled version of the actualAllocation calculated
+// below for use as a constant value for InlineSString<X> to use. It is
+// padded with one additional sizeof(SBUFFER_CANARY_VALUE) to account for
+// possible alignment problems issues (pre- and post-padding).
+#define SBUFFER_PADDED_SIZE(desiredUsefulSize) \
+ ((((SIZE_T)(desiredUsefulSize) + sizeof(SBUFFER_CANARY_VALUE) - 1) & \
+ ~(sizeof(SBUFFER_CANARY_VALUE)-1)) + 3 * sizeof(SBUFFER_CANARY_VALUE))
+
+#else // SBUFFER_CANARY_CHECKS
+
+#define SBUFFER_PADDED_SIZE(desiredUsefulSize) (desiredUsefulSize)
+
+#endif // SBUFFER_CANARY_CHECKS else
+
+// Must match expected guaranteed alignment of new []
+#ifdef ALIGN_ACCESS
+static const int SBUFFER_ALIGNMENT = ALIGN_ACCESS;
+#else
+// This is only 4 bytes on win98 and below
+static const int SBUFFER_ALIGNMENT = 4;
+#endif
+
+//----------------------------------------------------------------------------
+// Allocate memory, use canaries.
+//----------------------------------------------------------------------------
+inline BYTE *SBuffer::NewBuffer(COUNT_T allocation)
+{
+ CONTRACT(BYTE*)
+ {
+ PRECONDITION(CheckSize(allocation));
+ PRECONDITION(allocation > 0);
+ POSTCONDITION(CheckPointer(RETVAL));
+ THROWS;
+ GC_NOTRIGGER;
+ SUPPORTS_DAC_HOST_ONLY;
+ }
+ CONTRACT_END;
+
+#ifdef SBUFFER_CANARY_CHECKS
+
+ COUNT_T alignPadding = AlignmentPad(allocation, sizeof(SBUFFER_CANARY_VALUE));
+ COUNT_T actualAllocation= sizeof(SBUFFER_CANARY_VALUE) + allocation + alignPadding + sizeof(SBUFFER_CANARY_VALUE);
+ BYTE *raw = new BYTE [actualAllocation];
+
+ *(UINT64*) raw = SBUFFER_CANARY_VALUE;
+ *(UINT64*) (raw + sizeof(SBUFFER_CANARY_VALUE) + allocation + alignPadding) = SBUFFER_CANARY_VALUE;
+
+ BYTE *buffer = raw + sizeof(SBUFFER_CANARY_VALUE);
+
+#else
+
+ BYTE *buffer = new BYTE [allocation];
+
+#endif
+
+ DebugStompUnusedBuffer(buffer, allocation);
+
+ CONSISTENCY_CHECK(CheckBuffer(buffer, allocation));
+
+ RETURN buffer;
+}
+
+//----------------------------------------------------------------------------
+// Use existing memory, use canaries.
+//----------------------------------------------------------------------------
+inline BYTE *SBuffer::UseBuffer(BYTE *buffer, COUNT_T *allocation)
+{
+ CONTRACT(BYTE*)
+ {
+ NOTHROW;
+ GC_NOTRIGGER;
+ CANNOT_TAKE_LOCK;
+ SUPPORTS_DAC_HOST_ONLY;
+ PRECONDITION(CheckPointer(buffer));
+ PRECONDITION(CheckSize(*allocation));
+// POSTCONDITION(CheckPointer(RETVAL));
+ POSTCONDITION(CheckSize(*allocation));
+ }
+ CONTRACT_END;
+
+#ifdef SBUFFER_CANARY_CHECKS
+
+ COUNT_T prepad = AlignmentPad((SIZE_T) buffer, sizeof(SBUFFER_CANARY_VALUE));
+ COUNT_T postpad = AlignmentTrim((SIZE_T) buffer+*allocation, sizeof(SBUFFER_CANARY_VALUE));
+
+ SCOUNT_T usableAllocation = *allocation - prepad - sizeof(SBUFFER_CANARY_VALUE) - sizeof(SBUFFER_CANARY_VALUE) - postpad;
+ if (usableAllocation <= 0)
+ {
+ buffer = NULL;
+ *allocation = 0;
+ }
+ else
+ {
+ BYTE *result = buffer + prepad + sizeof(SBUFFER_CANARY_VALUE);
+
+ *(UINT64*) (buffer + prepad) = SBUFFER_CANARY_VALUE;
+ *(UINT64*) (buffer + prepad + sizeof(SBUFFER_CANARY_VALUE) + usableAllocation) = SBUFFER_CANARY_VALUE;
+
+ buffer = result;
+ *allocation = usableAllocation;
+ }
+
+#endif
+
+ DebugStompUnusedBuffer(buffer, *allocation);
+
+ CONSISTENCY_CHECK(CheckBuffer(buffer, *allocation));
+
+ RETURN buffer;
+}
+
+//----------------------------------------------------------------------------
+// Free memory allocated by NewHelper
+//----------------------------------------------------------------------------
+inline void SBuffer::DeleteBuffer(BYTE *buffer, COUNT_T allocation)
+{
+ CONTRACT_VOID
+ {
+ PRECONDITION(CheckSize(allocation));
+ POSTCONDITION(CheckPointer(buffer));
+ SO_TOLERANT;
+ NOTHROW;
+ GC_NOTRIGGER;
+ SO_TOLERANT;
+ SUPPORTS_DAC_HOST_ONLY;
+ }
+ CONTRACT_END;
+ VALIDATE_BACKOUT_STACK_CONSUMPTION;
+
+ CONSISTENCY_CHECK(CheckBuffer(buffer, allocation));
+
+#ifdef SBUFFER_CANARY_CHECKS
+
+ delete [] (buffer - sizeof(SBUFFER_CANARY_VALUE));
+
+#else
+
+ delete [] buffer;
+
+#endif
+
+ RETURN;
+}
+
+//----------------------------------------------------------------------------
+// Check the buffer at the given address. The memory must have been a pointer
+// returned by NewHelper.
+//----------------------------------------------------------------------------
+inline CHECK SBuffer::CheckBuffer(const BYTE *buffer, COUNT_T allocation) const
+{
+ CONTRACT_CHECK
+ {
+ NOTHROW;
+ GC_NOTRIGGER;
+ SO_TOLERANT;
+ CANNOT_TAKE_LOCK;
+ PRECONDITION(CheckPointer(buffer));
+ }
+ CONTRACT_CHECK_END;
+
+ if (allocation > 0)
+ {
+#ifdef SBUFFER_CANARY_CHECKS
+ const BYTE *raw = buffer - sizeof(SBUFFER_CANARY_VALUE);
+
+ COUNT_T alignPadding = ((allocation + (sizeof(SBUFFER_CANARY_VALUE) - 1)) & ~((sizeof(SBUFFER_CANARY_VALUE) - 1))) - allocation;
+
+ CHECK_MSG(*(UINT64*) raw == SBUFFER_CANARY_VALUE, "SBuffer underflow");
+ CHECK_MSG(*(UINT64*) (raw + sizeof(SBUFFER_CANARY_VALUE) + allocation + alignPadding) == SBUFFER_CANARY_VALUE, "SBuffer overflow");
+
+#endif
+
+ CHECK_MSG((((SIZE_T)buffer) & (SBUFFER_ALIGNMENT-1)) == 0, "SBuffer not properly aligned");
+ }
+
+ CHECK_OK;
+}
+
+
+inline BYTE *SBuffer::OpenRawBuffer(COUNT_T size)
+{
+ CONTRACT(BYTE*)
+ {
+#if _DEBUG
+ PRECONDITION_MSG(!IsOpened(), "Can't nest calls to OpenBuffer()");
+#endif
+ PRECONDITION(CheckSize(size));
+ POSTCONDITION(GetSize() == size);
+ THROWS;
+ GC_NOTRIGGER;
+ }
+ CONTRACT_END;
+
+ Resize(size);
+ EnsureMutable();
+
+#if _DEBUG
+ SetOpened();
+#endif
+
+ RETURN m_buffer;
+}
+
+//----------------------------------------------------------------------------
+// Close an open buffer. Assumes that we wrote exactly number of characters
+// we requested in OpenBuffer.
+//----------------------------------------------------------------------------
+inline void SBuffer::CloseRawBuffer()
+{
+ CONTRACT_VOID
+ {
+#if _DEBUG
+ PRECONDITION(IsOpened());
+#endif
+ THROWS;
+ GC_NOTRIGGER;
+ }
+ CONTRACT_END;
+
+ CloseRawBuffer(m_size);
+
+ RETURN;
+}
+
+//----------------------------------------------------------------------------
+// CloseBuffer() tells the SBuffer that we're done using the unsafe buffer.
+// finalSize is the count of bytes actually used (so we can set m_count).
+// This is important if we request a buffer larger than what we actually
+// used.
+//----------------------------------------------------------------------------
+inline void SBuffer::CloseRawBuffer(COUNT_T finalSize)
+{
+ CONTRACT_VOID
+ {
+#if _DEBUG
+ PRECONDITION_MSG(IsOpened(), "Can only CloseRawBuffer() after a call to OpenRawBuffer()");
+#endif
+ PRECONDITION(CheckSize(finalSize));
+ PRECONDITION_MSG(finalSize <= GetSize(), "Can't use more characters than requested via OpenRawBuffer()");
+ THROWS;
+ GC_NOTRIGGER;
+ }
+ CONTRACT_END;
+
+#if _DEBUG
+ ClearOpened();
+#endif
+
+ TweakSize(finalSize);
+
+ CONSISTENCY_CHECK(CheckBuffer(m_buffer, m_allocation));
+
+ RETURN;
+}
+
+inline SBuffer::operator const void *() const
+{
+ LIMITED_METHOD_CONTRACT;
+
+ return (void *) m_buffer;
+}
+
+inline SBuffer::operator const BYTE *() const
+{
+ LIMITED_METHOD_DAC_CONTRACT;
+
+ return m_buffer;
+}
+
+inline BYTE &SBuffer::operator[](int index)
+{
+ LIMITED_METHOD_CONTRACT;
+
+ return m_buffer[index];
+}
+
+inline const BYTE &SBuffer::operator[](int index) const
+{
+ LIMITED_METHOD_CONTRACT;
+
+ return m_buffer[index];
+}
+
+inline SBuffer::Iterator SBuffer::Begin()
+{
+ CONTRACT(SBuffer::Iterator)
+ {
+ INSTANCE_CHECK;
+ THROWS;
+ GC_NOTRIGGER;
+ SUPPORTS_DAC_HOST_ONLY;
+ }
+ CONTRACT_END;
+
+ // This is a bit unfortunate to have to do here, but it's our
+ // last opportunity before possibly doing a *i= with the iterator
+ EnsureMutable();
+
+ RETURN Iterator(this, 0);
+}
+
+inline SBuffer::Iterator SBuffer::End()
+{
+ CONTRACT(SBuffer::Iterator)
+ {
+ INSTANCE_CHECK;
+ THROWS;
+ GC_NOTRIGGER;
+ }
+ CONTRACT_END;
+
+ // This is a bit unfortunate to have to do here, but it's our
+ // last opportunity before possibly doing a *i= with the iterator
+ EnsureMutable();
+
+ RETURN Iterator(this, m_size);
+}
+
+inline SBuffer::CIterator SBuffer::Begin() const
+{
+ CONTRACT(SBuffer::CIterator)
+ {
+ INSTANCE_CHECK;
+ NOTHROW;
+ GC_NOTRIGGER;
+ }
+ CONTRACT_END;
+
+ RETURN SBuffer::CIterator(this, 0);
+}
+
+inline SBuffer::CIterator SBuffer::End() const
+{
+ CONTRACT(SBuffer::CIterator)
+ {
+ INSTANCE_CHECK;
+ NOTHROW;
+ GC_NOTRIGGER;
+ }
+ CONTRACT_END;
+
+ RETURN CIterator(const_cast<SBuffer*>(this), m_size);
+}
+
+inline BOOL SBuffer::IsAllocated() const
+{
+ LIMITED_METHOD_DAC_CONTRACT;
+
+ return (m_flags & ALLOCATED) != 0;
+}
+
+inline void SBuffer::SetAllocated()
+{
+ LIMITED_METHOD_CONTRACT;
+ SUPPORTS_DAC_HOST_ONLY;
+
+ m_flags |= ALLOCATED;
+}
+
+inline void SBuffer::ClearAllocated()
+{
+ LIMITED_METHOD_CONTRACT;
+ SUPPORTS_DAC_HOST_ONLY;
+
+ m_flags &= ~ALLOCATED;
+}
+
+inline BOOL SBuffer::IsImmutable() const
+{
+ LIMITED_METHOD_DAC_CONTRACT;
+
+ return (m_flags & IMMUTABLE) != 0;
+}
+
+inline void SBuffer::SetImmutable()
+{
+ LIMITED_METHOD_CONTRACT;
+ SUPPORTS_DAC_HOST_ONLY;
+
+ m_flags |= IMMUTABLE;
+}
+
+inline void SBuffer::ClearImmutable()
+{
+ LIMITED_METHOD_CONTRACT;
+ SUPPORTS_DAC_HOST_ONLY;
+
+ m_flags &= ~IMMUTABLE;
+}
+
+inline BOOL SBuffer::IsFlag1() const
+{
+ LIMITED_METHOD_DAC_CONTRACT;
+
+ return (m_flags & FLAG1) != 0;
+}
+
+inline void SBuffer::SetFlag1()
+{
+ LIMITED_METHOD_DAC_CONTRACT;
+
+ m_flags |= FLAG1;
+}
+
+inline void SBuffer::ClearFlag1()
+{
+ LIMITED_METHOD_CONTRACT;
+
+ m_flags &= ~FLAG1;
+}
+
+inline BOOL SBuffer::IsFlag2() const
+{
+ LIMITED_METHOD_CONTRACT;
+
+ return (m_flags & FLAG2) != 0;
+}
+
+inline void SBuffer::SetFlag2()
+{
+ LIMITED_METHOD_CONTRACT;
+
+ m_flags |= FLAG2;
+}
+
+inline void SBuffer::ClearFlag2()
+{
+ LIMITED_METHOD_CONTRACT;
+
+ m_flags &= ~FLAG2;
+}
+
+inline BOOL SBuffer::IsFlag3() const
+{
+ LIMITED_METHOD_DAC_CONTRACT;
+
+ return (m_flags & FLAG3) != 0;
+}
+
+inline void SBuffer::SetFlag3()
+{
+ LIMITED_METHOD_CONTRACT;
+
+ m_flags |= FLAG3;
+}
+
+inline void SBuffer::ClearFlag3()
+{
+ LIMITED_METHOD_DAC_CONTRACT;
+
+ m_flags &= ~FLAG3;
+}
+
+inline int SBuffer::GetRepresentationField() const
+{
+ LIMITED_METHOD_CONTRACT;
+ SUPPORTS_DAC;
+
+ return (m_flags & REPRESENTATION_MASK);
+}
+
+inline void SBuffer::SetRepresentationField(int value)
+{
+ CONTRACT_VOID
+ {
+ PRECONDITION((value & ~REPRESENTATION_MASK) == 0);
+ NOTHROW;
+ GC_NOTRIGGER;
+ SO_TOLERANT;
+ SUPPORTS_DAC_HOST_ONLY;
+ }
+ CONTRACT_END;
+
+ m_flags &= ~REPRESENTATION_MASK;
+ m_flags |= value;
+
+ RETURN;
+}
+
+#if _DEBUG
+inline BOOL SBuffer::IsOpened() const
+{
+ LIMITED_METHOD_CONTRACT;
+
+ return (m_flags & OPENED) != 0;
+}
+
+inline void SBuffer::SetOpened()
+{
+ LIMITED_METHOD_CONTRACT;
+
+ m_flags |= OPENED;
+}
+
+inline void SBuffer::ClearOpened()
+{
+ LIMITED_METHOD_CONTRACT;
+
+ m_flags &= ~OPENED;
+}
+#endif
+
+inline void SBuffer::DebugMoveBuffer(__out_bcount(size) BYTE *to, BYTE *from, COUNT_T size)
+{
+ CONTRACT_VOID
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(CheckPointer(to, size == 0 ? NULL_OK : NULL_NOT_OK));
+ PRECONDITION(CheckPointer(from, size == 0 ? NULL_OK : NULL_NOT_OK));
+ PRECONDITION(CheckSize(size));
+ NOTHROW;
+ GC_NOTRIGGER;
+ SUPPORTS_DAC_HOST_ONLY;
+ }
+ CONTRACT_END;
+
+ if (size == 0) // special case
+ RETURN;
+
+ // Handle overlapping ranges
+ if (to > from && to < from + size)
+ CONSISTENCY_CHECK(CheckUnusedBuffer(from + size, (COUNT_T) (to - from)));
+ else if (to < from && to + size > from)
+ CONSISTENCY_CHECK(CheckUnusedBuffer(to, (COUNT_T) (from - to)));
+ else
+ CONSISTENCY_CHECK(CheckUnusedBuffer(to, size));
+
+ memmove(to, from, size);
+
+ // Handle overlapping ranges
+ if (to > from && to < from + size)
+ DebugStompUnusedBuffer(from, (COUNT_T) (to - from));
+ else if (to < from && to + size > from)
+ DebugStompUnusedBuffer(to + size, (COUNT_T) (from - to));
+ else
+ DebugStompUnusedBuffer(from, size);
+
+ RETURN;
+}
+
+inline void SBuffer::DebugCopyConstructBuffer(__out_bcount(size) BYTE *to, const BYTE *from, COUNT_T size)
+{
+ CONTRACT_VOID
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(CheckPointer(to, size == 0 ? NULL_OK : NULL_NOT_OK));
+ PRECONDITION(CheckPointer(from, size == 0 ? NULL_OK : NULL_NOT_OK));
+ PRECONDITION(CheckSize(size));
+ NOTHROW;
+ GC_NOTRIGGER;
+ SUPPORTS_DAC_HOST_ONLY;
+ }
+ CONTRACT_END;
+
+ if (size != 0) {
+ CONSISTENCY_CHECK(CheckUnusedBuffer(to, size));
+ memmove(to, from, size);
+ }
+
+ RETURN;
+}
+
+inline void SBuffer::DebugConstructBuffer(BYTE *buffer, COUNT_T size)
+{
+ CONTRACT_VOID
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(CheckPointer(buffer, size == 0 ? NULL_OK : NULL_NOT_OK));
+ PRECONDITION(CheckSize(size));
+ NOTHROW;
+ GC_NOTRIGGER;
+ SUPPORTS_DAC;
+ DEBUG_ONLY;
+ }
+ CONTRACT_END;
+
+ if (size != 0) {
+ CONSISTENCY_CHECK(CheckUnusedBuffer(buffer, size));
+ }
+
+ RETURN;
+}
+
+inline void SBuffer::DebugDestructBuffer(BYTE *buffer, COUNT_T size)
+{
+ CONTRACT_VOID
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(CheckPointer(buffer, size == 0 ? NULL_OK : NULL_NOT_OK));
+ PRECONDITION(CheckSize(size));
+ NOTHROW;
+ GC_NOTRIGGER;
+ DEBUG_ONLY;
+ SUPPORTS_DAC_HOST_ONLY;
+ }
+ CONTRACT_END;
+
+ if (size != 0)
+ {
+ DebugStompUnusedBuffer(buffer, size);
+ }
+
+ RETURN;
+}
+
+static const BYTE GARBAGE_FILL_CHARACTER = '$';
+
+extern const DWORD g_garbageFillBuffer[];
+
+inline void SBuffer::DebugStompUnusedBuffer(BYTE *buffer, COUNT_T size)
+{
+ CONTRACT_VOID
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(CheckPointer(buffer, size == 0 ? NULL_OK : NULL_NOT_OK));
+ PRECONDITION(CheckSize(size));
+ NOTHROW;
+ GC_NOTRIGGER;
+ CANNOT_TAKE_LOCK;
+ DEBUG_ONLY;
+ SUPPORTS_DAC_HOST_ONLY;
+ }
+ CONTRACT_END;
+
+#if _DEBUG
+ if (!IsImmutable()
+ || buffer < m_buffer || buffer > m_buffer + m_allocation) // Allocating a new buffer
+ {
+ // Whack the memory
+ if (size > GARBAGE_FILL_BUFFER_SIZE) size = GARBAGE_FILL_BUFFER_SIZE;
+ memset(buffer, GARBAGE_FILL_CHARACTER, size);
+ }
+#endif
+
+ RETURN;
+}
+
+#if _DEBUG
+inline BOOL SBuffer::EnsureGarbageCharOnly(const BYTE *buffer, COUNT_T size)
+{
+ LIMITED_METHOD_CONTRACT;
+ BOOL bRet = TRUE;
+ if (size > GARBAGE_FILL_BUFFER_SIZE)
+ {
+ size = GARBAGE_FILL_BUFFER_SIZE;
+ }
+ if (bRet && size > 0)
+ {
+ bRet &= (memcmp(buffer, g_garbageFillBuffer, size) == 0);
+ }
+ return bRet;
+}
+#endif
+
+inline CHECK SBuffer::CheckUnusedBuffer(const BYTE *buffer, COUNT_T size) const
+{
+ WRAPPER_NO_CONTRACT;
+ // This check is too expensive.
+#if 0 // _DEBUG
+ if (!IsImmutable()
+ || buffer < m_buffer || buffer > m_buffer + m_allocation) // Allocating a new buffer
+ {
+ if (!SBuffer::EnsureGarbageCharOnly(buffer, size))
+ {
+ CHECK_FAIL("Overwrite of unused buffer region found");
+ }
+ }
+#endif
+ CHECK_OK;
+}
+
+inline CHECK SBuffer::Check() const
+{
+ WRAPPER_NO_CONTRACT;
+ CHECK(CheckBufferClosed());
+ CHECK_OK;
+}
+
+inline CHECK SBuffer::Invariant() const
+{
+ LIMITED_METHOD_CONTRACT;
+
+ CHECK_OK;
+}
+
+inline CHECK SBuffer::InternalInvariant() const
+{
+ WRAPPER_NO_CONTRACT;
+ CHECK(m_size <= m_allocation);
+
+ CHECK(CheckUnusedBuffer(m_buffer + m_size, m_allocation - m_size));
+
+ if (IsAllocated())
+ CHECK(CheckBuffer(m_buffer, m_allocation));
+
+ CHECK_OK;
+}
+
+inline CHECK SBuffer::CheckBufferClosed() const
+{
+ WRAPPER_NO_CONTRACT;
+#if _DEBUG
+ CHECK_MSG(!IsOpened(), "Cannot use buffer API while raw open is in progress");
+#endif
+ CHECK_OK;
+}
+
+inline CHECK SBuffer::CheckSize(COUNT_T size)
+{
+ LIMITED_METHOD_CONTRACT;
+ // !todo: add any range checking here
+ CHECK_OK;
+}
+
+inline CHECK SBuffer::CheckAllocation(COUNT_T size)
+{
+ LIMITED_METHOD_CONTRACT;
+
+ // !todo: add any range checking here
+ CHECK_OK;
+}
+
+inline CHECK SBuffer::CheckIteratorRange(const CIterator &i) const
+{
+ WRAPPER_NO_CONTRACT;
+ CHECK(i.Check());
+ CHECK(i.CheckContainer(this));
+ CHECK(i >= Begin());
+ CHECK(i < End());
+ CHECK_OK;
+}
+
+inline CHECK SBuffer::CheckIteratorRange(const CIterator &i, COUNT_T size) const
+{
+ WRAPPER_NO_CONTRACT;
+ CHECK(i.Check());
+ CHECK(i.CheckContainer(this));
+ CHECK(i >= Begin());
+ CHECK(i + size <= End());
+ CHECK_OK;
+}
+
+inline SBuffer::Index::Index()
+{
+ LIMITED_METHOD_DAC_CONTRACT;
+
+ m_ptr = NULL;
+}
+
+inline SBuffer::Index::Index(SBuffer *container, SCOUNT_T index)
+ : CheckedIteratorBase<SBuffer>(container)
+{
+ LIMITED_METHOD_CONTRACT;
+ SUPPORTS_DAC_HOST_ONLY;
+
+ m_ptr = container->m_buffer + index;
+}
+
+inline BYTE &SBuffer::Index::GetAt(SCOUNT_T delta) const
+{
+ LIMITED_METHOD_DAC_CONTRACT;
+
+ return m_ptr[delta];
+}
+
+inline void SBuffer::Index::Skip(SCOUNT_T delta)
+{
+ LIMITED_METHOD_CONTRACT;
+ SUPPORTS_DAC_HOST_ONLY;
+
+ m_ptr += delta;
+}
+
+inline SCOUNT_T SBuffer::Index::Subtract(const Index &i) const
+{
+ LIMITED_METHOD_CONTRACT;
+ SUPPORTS_DAC_HOST_ONLY;
+
+ return (SCOUNT_T) (m_ptr - i.m_ptr);
+}
+
+inline CHECK SBuffer::Index::DoCheck(SCOUNT_T delta) const
+{
+ WRAPPER_NO_CONTRACT;
+#if _DEBUG
+ CHECK(m_ptr + delta >= GetContainerDebug()->m_buffer);
+ CHECK(m_ptr + delta < GetContainerDebug()->m_buffer + GetContainerDebug()->m_size);
+#endif
+ CHECK_OK;
+}
+
+inline void SBuffer::Index::Resync(const SBuffer *buffer, BYTE *value) const
+{
+ CONTRACT_VOID
+ {
+ // INSTANCE_CHECK - Iterator is out of sync with its object now by definition
+ POSTCONDITION(CheckPointer(this));
+ PRECONDITION(CheckPointer(buffer));
+ NOTHROW;
+ GC_NOTRIGGER;
+ SUPPORTS_DAC_HOST_ONLY;
+ }
+ CONTRACT_END;
+
+ const_cast<Index*>(this)->CheckedIteratorBase<SBuffer>::Resync(const_cast<SBuffer*>(buffer));
+ const_cast<Index*>(this)->m_ptr = value;
+
+ RETURN;
+}
+
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif // _MSC_VER
+
+#endif // _SBUFFER_INL_
diff --git a/src/inc/securityutil.h b/src/inc/securityutil.h
new file mode 100644
index 0000000000..2278495bc5
--- /dev/null
+++ b/src/inc/securityutil.h
@@ -0,0 +1,53 @@
+// 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.
+
+
+#ifndef SECURITYUTIL_H
+#define SECURITYUTIL_H
+
+#include "winnt.h"
+
+// Security utility class. This is currently used by the debugger right-side and dbgshim to figure out the
+// SECURITY_ATTRIBUTES to use on various IPC objects (named events, etc.).
+// This is pretty debugger specific, and so perhaps doesn't actually belong in utilcode (that's just the most
+// convenient way to share it between mscordbi and dbgshim.dll). This is also a pretty big mess. All of
+// this ACL craziness is already gone in Arrowhead, so it's not a high priority to clean this up.
+class SecurityUtil
+{
+public:
+
+ //
+ // This will generate ACL containing the current process and
+ // an allowed ACE on the target process of the given pid.
+ //
+ // Host should free returned *ppACL by calling FreeACL
+ //
+ static HRESULT GetACLOfPid(DWORD pid, PACL *ppACL);
+
+ static void FreeACL(PACL pACL);
+
+ static HRESULT GetMandatoryLabelFromProcess(HANDLE hProcess, LPBYTE * ppbLabel);
+ static DWORD * GetIntegrityLevelFromMandatorySID(PSID psidIntegrityLevelLabel);
+
+ // instance functions. SecurityUtil is used to minimized memory allocation when converting
+ // pACL to SECURITY_ATTRIBUTES
+ // The needed memory to hold SECURITY_ATTRIBUTES and SECURITY_DESCRIPTOR are embedded
+ // in the SecurityUtil instance.
+ //
+ SecurityUtil(PACL pACL);
+ ~SecurityUtil();
+ HRESULT Init();
+ HRESULT Init(HANDLE pid);
+ HRESULT GetSA(SECURITY_ATTRIBUTES **PPSA);
+private:
+ HRESULT SetSecurityDescriptorMandatoryLabel(PSID psidIntegrityLevelLabel);
+ SECURITY_ATTRIBUTES m_SA;
+ SECURITY_DESCRIPTOR m_SD;
+ PACL m_pACL;
+ // Saved by SetSecurityDescriptorMandatoryLabel so that the memory can be deleted properly
+ PACL m_pSacl;
+ bool m_fInitialized;
+};
+
+#endif // !SECURITYUTIL_H
diff --git a/src/inc/securitywrapper.h b/src/inc/securitywrapper.h
new file mode 100644
index 0000000000..a14d90a922
--- /dev/null
+++ b/src/inc/securitywrapper.h
@@ -0,0 +1,111 @@
+// 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.
+//*****************************************************************************
+// File: SecurityWrapper.h
+//
+// Wrapper around Win32 Security functions
+//
+//*****************************************************************************
+
+
+#ifndef _SECURITY_WRAPPER_H
+#define _SECURITY_WRAPPER_H
+
+// This file should not even be included on Rotor.
+
+//-----------------------------------------------------------------------------
+// Wrapper around a PSID.
+// This class does not own the memory.
+//-----------------------------------------------------------------------------
+class Sid
+{
+public:
+ // Initial the Sid wrapper around an existing SID.
+ Sid(PSID pSid);
+ static bool Equals(const Sid & a, const Sid & b) { return Equals(a.m_pSid, b.m_pSid); }
+ static bool Equals(const Sid & a, PSID b) { return Equals(a.m_pSid, b); }
+ static bool Equals(PSID a, const Sid & b) { return Equals(a, b.m_pSid); }
+ static bool Equals(PSID a, PSID b);
+
+ PSID RawSid() { return m_pSid; }
+protected:
+ // Pointer to Sid buffer. We don't owner the data.
+ PSID m_pSid;
+};
+
+//-----------------------------------------------------------------------------
+// Wrapper around a PSID with buffer.
+//-----------------------------------------------------------------------------
+class SidBuffer
+{
+public:
+ SidBuffer();
+ ~SidBuffer();
+
+ // Get the underlying sid
+ Sid GetSid();
+
+ // Do we not have a sid? This will be true if init fails.
+ bool IsNull() { return m_pBuffer == NULL; }
+
+ // Go to definitions to see detailed comments
+ HRESULT InitFromProcessNoThrow(DWORD pid);
+ void InitFromProcess(DWORD pid); // throws
+ HRESULT InitFromProcessUserNoThrow(DWORD pid);
+ void InitFromProcessUser(DWORD pid); // throws
+ HRESULT InitFromProcessAppContainerSidNoThrow(DWORD pid);
+
+protected:
+ BYTE * m_pBuffer;
+};
+
+#ifndef FEATURE_PAL
+
+//-----------------------------------------------------------------------------
+// Access Control List.
+//-----------------------------------------------------------------------------
+class Dacl
+{
+public:
+ Dacl(PACL pAcl);
+
+ SIZE_T GetAceCount();
+ ACE_HEADER * GetAce(SIZE_T dwAceIndex);
+protected:
+ PACL m_acl;
+};
+
+//-----------------------------------------------------------------------------
+// Represent a win32 SECURITY_DESCRIPTOR object.
+// (Note there's a "SecurityDescriptor" class in the VM for managed goo,
+// so we prefix this with "Win32" to avoid a naming collision.)
+//-----------------------------------------------------------------------------
+class Win32SecurityDescriptor
+{
+public:
+ Win32SecurityDescriptor();
+ ~Win32SecurityDescriptor();
+
+ HRESULT InitFromHandleNoThrow(HANDLE h);
+ void InitFromHandle(HANDLE h); // throws
+
+ // Gets the owner SID from this SecurityDescriptor.
+ HRESULT GetOwnerNoThrow( PSID* ppSid );
+ Sid GetOwner(); // throws
+ Dacl GetDacl(); // throws
+
+protected:
+ PSECURITY_DESCRIPTOR m_pDesc;
+};
+
+#endif // FEATURE_PAL
+
+//-----------------------------------------------------------------------------
+// Check if the handle owner belongs to either the process specified by the pid
+// or the current process. This lets us know if the handle is spoofed.
+//-----------------------------------------------------------------------------
+bool IsHandleSpoofed(HANDLE handle, DWORD pid);
+
+
+#endif // _SECURITY_WRAPPER_H
diff --git a/src/inc/shash.h b/src/inc/shash.h
new file mode 100644
index 0000000000..cece2dd345
--- /dev/null
+++ b/src/inc/shash.h
@@ -0,0 +1,1105 @@
+// 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.
+
+
+#ifndef _SHASH_H_
+#define _SHASH_H_
+
+#include "utilcode.h" // for string hash functions
+#include "clrtypes.h"
+#include "check.h"
+#include "iterator.h"
+
+// SHash is a templated closed chaining hash table of pointers. It provides
+// for multiple entries under the same key, and also for deleting elements.
+
+// Synchronization:
+// Synchronization requirements depend on use. There are several properties to take into account:
+//
+// - Lookups may be asynchronous with each other
+// - Lookups must be exclusive with Add operations
+// (@todo: this can be remedied by delaying destruction of old tables during reallocation, e.g. during GC)
+// - Remove operations may be asynchronous with Lookup/Add, unless elements are also deallocated. (In which
+// case full synchronization is required)
+
+// Common "gotchas":
+// - The Add method never replaces an element. The new element will be added even if an element with the same
+// key is already present. If you don't want this, use AddOrReplace.
+// - You need special sentinel values for the element to represent Null and Deleted. 0 and -1 are the default
+// choices but you will need something else if elements can legally have any of these two values.
+// - Deriving directly from the general purpose classes (such as SHash itself) requires implementing a
+// TRAITS class which can be daunting. Consider using one of the specialized classes (e.g. WStringSHash) first.
+
+// A SHash is templated by a class of TRAITS. These traits define the various specifics of the
+// particular hash table.
+// The required traits are:
+//
+// element_t Type of elements in the hash table. These elements are stored
+// by value in the hash table. Elements must look more or less
+// like primitives - they must support assignment relatively
+// efficiently. There are 2 required sentinel values:
+// Null and Deleted (described below). (Note that element_t is
+// very commonly a pointer type.)
+//
+// The key must be derivable from the element; if your
+// table's keys are independent of the stored values, element_t
+// should be a key/value pair.
+//
+// key_t Type of the lookup key. The key is used for identity
+// comparison between elements, and also as a key for lookup.
+// This is also used by value and should support
+// efficient assignment.
+//
+// count_t integral type for counts. Typically inherited by default
+// Traits (COUNT_T).
+//
+// static key_t GetKey(const element_t &e) Get key from element. Should be stable for a given e.
+// static BOOL Equals(key_t k1, key_t k2) Compare 2 keys for equality. Again, should be stable.
+// static count_t Hash(key_t k) Compute hash from a key. For efficient operation, the hashes
+// for a set of elements should have random uniform distribution.
+//
+// static const bool s_NoThrow TRUE if GetKey, Equals, and hash are NOTHROW functions.
+// Affects the THROWS clauses of several SHash functions.
+// (Note that the Null- and Deleted-related functions below
+// are not affected by this and must always be NOTHROW.)
+//
+// static element_t Null() Return the Null sentinal value. May be inherited from
+// default traits if it can be assigned from 0.
+// static element_t Deleted() Return the Deleted sentinal value. May be inherited from the
+// default traits if it can be assigned from -1.
+// static const bool IsNull(const ELEMENT &e) Compare element with Null sentinal value. May be inherited from
+// default traits if it can be assigned from 0.
+// static const bool IsDeleted(const ELEMENT &e) Compare element with Deleted sentinal value. May be inherited from the
+// default traits if it can be assigned from -1.
+//
+// static void OnDestructPerEntryCleanupAction(ELEMENT& e) Called on every element when in hashtable destructor.
+// s_DestructPerEntryCleanupAction must be set to true if implemented.
+//
+// s_growth_factor_numerator
+// s_growth_factor_denominator Factor to grow allocation (numerator/denominator).
+// Typically inherited from default traits (3/2)
+//
+// s_density_factor_numerator
+// s_density_factor_denominator Maxium occupied density of table before growth
+// occurs (num/denom). Typically inherited (3/4).
+//
+// s_minimum_allocation Minimum table allocation count (size on first growth.) It is
+// probably preferable to call Reallocate on initialization rather
+// than override his from the default traits. (7)
+//
+// s_supports_remove Set to false for a slightly faster implementation that does not
+// support deletes. There is a downside to the s_supports_remove flag,
+// in that there may be more copies of the template instantiated through
+// the system as different variants are used.
+//
+// s_DestructPerEntryCleanupAction Set to true if OnDestructPerEntryCleanupAction has non-empty implementation.
+//
+// DefaultHashTraits provides defaults for seldomly customized values in traits classes.
+
+template < typename ELEMENT >
+class DefaultSHashTraits
+{
+ public:
+ typedef COUNT_T count_t;
+ typedef ELEMENT element_t;
+ typedef DPTR(element_t) PTR_element_t; // by default SHash is DAC-aware. For RS
+ // only SHash use NonDacAwareSHashTraits
+ // (which typedefs element_t* PTR_element_t)
+
+ static const COUNT_T s_growth_factor_numerator = 3;
+ static const COUNT_T s_growth_factor_denominator = 2;
+
+ static const COUNT_T s_density_factor_numerator = 3;
+ static const COUNT_T s_density_factor_denominator = 4;
+
+ static const COUNT_T s_minimum_allocation = 7;
+
+ static const bool s_supports_remove = true;
+
+ static const ELEMENT Null() { return (const ELEMENT) 0; }
+ static const ELEMENT Deleted() { return (const ELEMENT) -1; }
+ static bool IsNull(const ELEMENT &e) { return e == (const ELEMENT) 0; }
+ static bool IsDeleted(const ELEMENT &e) { return e == (const ELEMENT) -1; }
+
+ static inline void OnDestructPerEntryCleanupAction(const ELEMENT& e) { /* Do nothing */ }
+ static const bool s_DestructPerEntryCleanupAction = false;
+
+ static const bool s_NoThrow = true;
+
+ // No defaults - must specify:
+ //
+ // typedef key_t;
+ // static key_t GetKey(const element_t &i);
+ // static BOOL Equals(key_t k1, key_t k2);
+ // static count_t Hash(key_t k);
+};
+
+// Hash table class definition
+
+template <typename TRAITS>
+class SHash : public TRAITS
+ , private noncopyable
+{
+ friend class VerifyLayoutsMD; // verifies class layout doesn't accidentally change
+
+ public:
+ // explicitly declare local typedefs for these traits types, otherwise
+ // the compiler may get confused
+ typedef typename TRAITS::element_t element_t;
+ typedef typename TRAITS::PTR_element_t PTR_element_t;
+ typedef typename TRAITS::key_t key_t;
+ typedef typename TRAITS::count_t count_t;
+
+ class Index;
+ friend class Index;
+ class Iterator;
+
+ class KeyIndex;
+ friend class KeyIndex;
+ class KeyIterator;
+
+ // Constructor/destructor. SHash tables always start out empty, with no
+ // allocation overhead. Call Reallocate to prime with an initial size if
+ // desired.
+
+ SHash();
+
+ ~SHash();
+
+ // Lookup an element in the table by key. Returns NULL if no element in the table
+ // has the given key. Note that multiple entries for the same key may be stored -
+ // this will return the first element added. Use KeyIterator to find all elements
+ // with a given key.
+
+ element_t Lookup(key_t key) const;
+
+ // Pointer-based flavor of Lookup (allows efficient access to tables of structures)
+
+ const element_t* LookupPtr(key_t key) const;
+
+ // Add an element to the hash table. This will never replace an element; multiple
+ // elements may be stored with the same key.
+
+ void Add(const element_t &element);
+
+ // Add a new element to the hash table, if no element with the same key is already
+ // there. Otherwise, it will replace the existing element. This has the effect of
+ // updating an element rather than adding a duplicate.
+ void AddOrReplace(const element_t & element);
+
+ // Remove the first element matching the key from the hash table.
+
+ void Remove(key_t key);
+
+ // Remove the specific element.
+
+ void Remove(Iterator& i);
+ void Remove(KeyIterator& i);
+
+ // Pointer-based flavor of Remove (allows efficient access to tables of structures)
+
+ void RemovePtr(element_t * element);
+
+ // Remove all elements in the hashtable
+
+ void RemoveAll();
+
+ // Begin and End pointers for iteration over entire table.
+
+ Iterator Begin() const;
+ Iterator End() const;
+
+ // Begin and End pointers for iteration over all elements with a given key.
+
+ KeyIterator Begin(key_t key) const;
+ KeyIterator End(key_t key) const;
+
+ // Return the number of elements currently stored in the table
+
+ count_t GetCount() const;
+
+ // Resizes a hash table for growth. The new size is computed based
+ // on the current population, growth factor, and maximum density factor.
+
+ void Grow();
+
+ // Reallocates a hash table to a specific size. The size must be big enough
+ // to hold all elements in the table appropriately.
+ //
+ // Note that the actual table size must always be a prime number; the number
+ // passed in will be upward adjusted if necessary.
+
+ void Reallocate(count_t newTableSize);
+
+ // Makes a call on the Functor for each element in the hash table, passing
+ // the element as an argument. Functor is expected to look like this:
+ //
+ // class Functor
+ // {
+ // public:
+ // void operator() (element_t &element) { ... }
+ // }
+
+ template<typename Functor> void ForEach(Functor &functor);
+
+ private:
+
+ // See if it is OK to grow the hash table by one element. If not, reallocate
+ // the hash table.
+ BOOL CheckGrowth();
+
+ // See if it is OK to grow the hash table by one element. If not, allocate new
+ // hash table and return it together with its size *pcNewSize (used by code:AddPhases).
+ // Returns NULL if there already is space for one element.
+ element_t * CheckGrowth_OnlyAllocateNewTable(count_t * pcNewSize);
+
+ // Allocates new resized hash table for growth. Does not update the hash table on the object.
+ // The new size is computed based on the current population, growth factor, and maximum density factor.
+ element_t * Grow_OnlyAllocateNewTable(count_t * pcNewSize);
+
+ // Utility function to allocate new table (does not copy the values into it yet). Returns the size of new table in
+ // *pcNewTableSize (finds next prime).
+ // Phase 1 of code:Reallocate - it is split to support code:AddPhases.
+ element_t * AllocateNewTable(count_t requestedSize, count_t * pcNewTableSize);
+
+ // Utility function to replace old table with newly allocated table (as allocated by
+ // code:AllocateNewTable). Copies all 'old' values into the new table first.
+ // Returns the old table. Caller is expected to delete it (via code:DeleteOldTable).
+ // Phase 2 of code:Reallocate - it is split to support code:AddPhases.
+ element_t * ReplaceTable(element_t * newTable, count_t newTableSize);
+
+ // Utility function to delete old table (as returned by code:ReplaceTable).
+ // Phase 3 of code:Reallocate - it is split to support code:AddPhases.
+ void DeleteOldTable(element_t * oldTable);
+
+ // Utility function that does not call code:CheckGrowth.
+ // Add an element to the hash table. This will never replace an element; multiple
+ // elements may be stored with the same key.
+ void Add_GrowthChecked(const element_t & element);
+
+ // Utility function to add a new element to the hash table. Note that
+ // it is perfectly fine for the element to be a duplicate - if so it
+ // is added an additional time. Returns TRUE if a new empty spot was used;
+ // FALSE if an existing deleted slot.
+ static BOOL Add(element_t *table, count_t tableSize, const element_t &element);
+
+ // Utility function to add a new element to the hash table, if no element with the same key
+ // is already there. Otherwise, it will replace the existing element. This has the effect of
+ // updating an element rather than adding a duplicate.
+ void AddOrReplace(element_t *table, count_t tableSize, const element_t &element);
+
+ // Utility function to find the first element with the given key in
+ // the hash table.
+
+ static const element_t* Lookup(PTR_element_t table, count_t tableSize, key_t key);
+
+ // Utility function to remove the first element with the given key
+ // in the hash table.
+
+ void Remove(element_t *table, count_t tableSize, key_t key);
+
+ // Utility function to remove the specific element.
+
+ void RemoveElement(element_t *table, count_t tableSize, element_t *element);
+
+ // Index for whole table iterator. This is also the base for the keyed iterator.
+
+ public:
+
+ class Index
+#ifdef _DEBUG
+ // CheckedIteratorBase is a no-op in RET builds. having it as an empty base-class
+ // causes differences in the sizeof(SHash::Iterator) in DAC vs. non-DAC builds.
+ // avoid the issue by not specifying it as a base class in RET builds
+ : public CheckedIteratorBase< SHash<TRAITS> >
+#endif
+ {
+ friend class SHash;
+ friend class Iterator;
+ friend class Enumerator<const element_t, Iterator>;
+
+ // The methods implementation has to be here for portability
+ // Some compilers won't compile the separate implementation in shash.inl
+ protected:
+
+ PTR_element_t m_table;
+ count_t m_tableSize;
+ count_t m_index;
+
+ Index(const SHash *hash, BOOL begin)
+ : m_table(hash->m_table),
+ m_tableSize(hash->m_tableSize),
+ m_index(begin ? 0 : m_tableSize)
+ {
+ LIMITED_METHOD_CONTRACT;
+ }
+
+ const element_t &Get() const
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ return m_table[m_index];
+ }
+
+ void First()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ if (m_index < m_tableSize)
+ if (TRAITS::IsNull(m_table[m_index]) || TRAITS::IsDeleted(m_table[m_index]))
+ Next();
+ }
+
+ void Next()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ if (m_index >= m_tableSize)
+ return;
+
+ for (;;)
+ {
+ m_index++;
+ if (m_index >= m_tableSize)
+ break;
+ if (!TRAITS::IsNull(m_table[m_index]) && !TRAITS::IsDeleted(m_table[m_index]))
+ break;
+ }
+ }
+
+ bool Equal(const Index &i) const
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ return i.m_index == m_index;
+ }
+
+ CHECK DoCheck() const
+ {
+ CHECK_OK;
+ }
+ };
+
+ class Iterator : public Index, public Enumerator<const element_t, Iterator>
+ {
+ friend class SHash;
+
+ public:
+ Iterator(const SHash *hash, BOOL begin)
+ : Index(hash, begin)
+ {
+ }
+ };
+
+ // Index for iterating elements with a given key.
+ //
+ // Note that the m_index field
+ // is artificially bumped to m_tableSize when the end of iteration is reached.
+ // This allows a canonical End iterator to be used.
+
+ class KeyIndex : public Index
+ {
+ friend class SHash;
+ friend class KeyIterator;
+ friend class Enumerator<const element_t, KeyIterator>;
+
+ // The methods implementation has to be here for portability
+ // Some compilers won't compile the separate implementation in shash.inl
+ protected:
+ key_t m_key;
+ count_t m_increment;
+
+ KeyIndex(const SHash *hash, BOOL begin)
+ : Index(hash, begin),
+ m_increment(0)
+ {
+ LIMITED_METHOD_CONTRACT;
+ }
+
+ void SetKey(key_t key)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ if (Index::m_tableSize > 0)
+ {
+ m_key = key;
+ count_t hash = TRAITS::Hash(key);
+
+ this->m_index = hash % this->m_tableSize;
+ m_increment = (hash % (this->m_tableSize-1)) + 1;
+
+ // Find first valid element
+ if (TRAITS::IsNull(this->m_table[this->m_index]))
+ this->m_index = this->m_tableSize;
+ else if (TRAITS::IsDeleted(this->m_table[this->m_index])
+ || !TRAITS::Equals(m_key, TRAITS::GetKey(this->m_table[this->m_index])))
+ Next();
+ }
+ }
+
+ void Next()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ while (TRUE)
+ {
+ this->m_index += m_increment;
+ if (this->m_index >= this->m_tableSize)
+ this->m_index -= this->m_tableSize;
+
+ if (TRAITS::IsNull(this->m_table[this->m_index]))
+ {
+ this->m_index = this->m_tableSize;
+ break;
+ }
+
+ if (!TRAITS::IsDeleted(this->m_table[this->m_index])
+ && TRAITS::Equals(m_key, TRAITS::GetKey(this->m_table[this->m_index])))
+ {
+ break;
+ }
+ }
+ }
+ };
+
+ class KeyIterator : public KeyIndex, public Enumerator<const element_t, KeyIterator>
+ {
+ friend class SHash;
+
+ public:
+
+ operator Iterator &()
+ {
+ return *(Iterator*)this;
+ }
+
+ operator const Iterator &()
+ {
+ return *(const Iterator*)this;
+ }
+
+ KeyIterator(const SHash *hash, BOOL begin)
+ : KeyIndex(hash, begin)
+ {
+ }
+ };
+
+ // Wrapper and holder for adding an element to the hash table. Useful for Add operations that have to happen
+ // under a rare lock that does not allow call out into host.
+ // There are 3 phases:
+ // 1. code:PreallocateForAdd ... Can allocate memory (calls into host).
+ // 2. code:Add ... Adds one element (does NOT call into host).
+ // or code:AddNothing_PublishPreallocatedTable ... Publishes the pre-allocated memory from step #1 (if any).
+ // 3. code:DeleteOldTable (or destructor) ... Can delete the old memory (calls into host).
+ // Example:
+ // CrstHolder lockAdd(&crstLockForAdd); // Serialize all Add operations.
+ // HostAssemblyMap::AddPhases addCall;
+ // addCall.PreallocateForAdd(&shash); // 1. Allocates memory for one Add call (if needed). addCall serves as holder for the allocated memory.
+ // {
+ // // We cannot call out into host from ForbidSuspend region (i.e. no allocations/deallocations).
+ // ForbidSuspendThreadHolder suspend; // Required by the 'special' read-lock
+ // {
+ // CrstHolder lock(&crstLock);
+ // if (some_condition)
+ // { // 2a. Add item. This may replace SHash inner table with the one pre-allocated in step 1.
+ // addCall.Add(shashItem);
+ // }
+ // else
+ // { // 2b. Skip adding item. This may replace SHash inner table with the one pre-allocated in step 1.
+ // addCall.AddNothing_PublishPreallocatedTable();
+ // }
+ // }
+ // }
+ // addCall.DeleteOldTable(); // 3. Cleanup old table memory from shash (if it was replaced by pre-allocated table in step 2).
+ // // Note: addCall destructor would take care of deleting the memory as well.
+ class AddPhases
+ {
+ public:
+ AddPhases();
+ ~AddPhases();
+
+ // Prepares object for one call to code:Add. Pre-allocates new table memory if needed, does not publish
+ // the table yet (it is kept ready only in this holder for call to code:Add).
+ // Calls out into host.
+ void PreallocateForAdd(SHash * pHash);
+
+ // Add an element to the hash table. This will never replace an element; multiple elements may be stored
+ // with the same key.
+ // Will use/publish pre-allocated memory from code:PreallocateForAdd.
+ // Does not call out into host.
+ // Only one Add* method can be called once per object! (Create a new object for each call)
+ void Add(const element_t & element);
+
+ // Element will not be added to the hash table.
+ // Will use/publish pre-allocated memory from code:PreallocateForAdd.
+ // Does not call out into host.
+ // Only one Add* method can be called once per object! (Create a new object for each call)
+ void AddNothing_PublishPreallocatedTable();
+
+ // Deletes old table if it was replaced by call to code:Add or code:AddNothing_PublishPreallocatedTable.
+ // Calls out into host.
+ void DeleteOldTable();
+
+ private:
+ SHash * m_pHash;
+ element_t * m_newTable;
+ count_t m_newTableSize;
+ element_t * m_oldTable;
+
+ #ifdef _DEBUG
+ PTR_element_t dbg_m_table;
+ count_t dbg_m_tableSize;
+ count_t dbg_m_tableCount;
+ count_t dbg_m_tableOccupied;
+ count_t dbg_m_tableMax;
+ BOOL dbg_m_fAddCalled;
+ #endif //_DEBUG
+ }; // class SHash::AddPhases
+
+ // Adds an entry to the hash table according to the guidelines above for
+ // avoiding a callout to the host while the read lock is held.
+ // Returns true if elem was added to the map, otherwise false.
+ // When elem was not added (false is returned), and if ppStoredElem is non-null,
+ // then it is set to point to the value in the map.
+ template <typename LockHolderT,
+ typename AddLockHolderT,
+ typename LockT,
+ typename AddLockT>
+ bool CheckAddInPhases(
+ element_t const & elem,
+ LockT & lock,
+ AddLockT & addLock,
+ IUnknown * addRefObject = nullptr);
+
+ private:
+
+ // Test for prime number.
+ static BOOL IsPrime(COUNT_T number);
+
+ // Find the next prime number >= the given value.
+
+ static COUNT_T NextPrime(COUNT_T number);
+
+ // Instance members
+
+ PTR_element_t m_table; // pointer to table
+ count_t m_tableSize; // allocated size of table
+ count_t m_tableCount; // number of elements in table
+ count_t m_tableOccupied; // number, includes deleted slots
+ count_t m_tableMax; // maximum occupied count before reallocating
+}; // class SHash
+
+// disables support for DAC marshaling. Useful for defining right-side only SHashes
+template <typename PARENT>
+class NonDacAwareSHashTraits : public PARENT
+{
+public:
+ typedef typename PARENT::element_t element_t;
+ typedef element_t * PTR_element_t;
+};
+
+// disables support for removing elements - produces slightly faster implementation
+
+template <typename PARENT>
+class NoRemoveSHashTraits : public PARENT
+{
+public:
+ // explicitly declare local typedefs for these traits types, otherwise
+ // the compiler may get confused
+ typedef typename PARENT::element_t element_t;
+ typedef typename PARENT::count_t count_t;
+
+ static const bool s_supports_remove = false;
+ static const element_t Deleted() { UNREACHABLE(); }
+ static bool IsDeleted(const element_t &e) { LIMITED_METHOD_DAC_CONTRACT; return false; }
+};
+
+// PtrHashTraits is a template to provides useful defaults for pointer hash tables
+// It relies on methods GetKey and Hash defined on ELEMENT
+
+template <typename ELEMENT, typename KEY>
+class PtrSHashTraits : public DefaultSHashTraits<ELEMENT *>
+{
+ public:
+
+ // explicitly declare local typedefs for these traits types, otherwise
+ // the compiler may get confused
+ typedef DefaultSHashTraits<ELEMENT *> PARENT;
+ typedef typename PARENT::element_t element_t;
+ typedef typename PARENT::count_t count_t;
+
+ typedef KEY key_t;
+
+ static key_t GetKey(const element_t &e)
+ {
+ WRAPPER_NO_CONTRACT;
+ return e->GetKey();
+ }
+ static BOOL Equals(key_t k1, key_t k2)
+ {
+ LIMITED_METHOD_CONTRACT;
+ return k1 == k2;
+ }
+ static count_t Hash(key_t k)
+ {
+ WRAPPER_NO_CONTRACT;
+ return ELEMENT::Hash(k);
+ }
+};
+
+template <typename ELEMENT, typename KEY>
+class PtrSHash : public SHash< PtrSHashTraits<ELEMENT, KEY> >
+{
+};
+
+template <typename ELEMENT, typename KEY>
+class PtrSHashWithCleanupTraits
+ : public PtrSHashTraits<ELEMENT, KEY>
+{
+public:
+ void OnDestructPerEntryCleanupAction(ELEMENT * elem)
+ {
+ delete elem;
+ }
+ static const bool s_DestructPerEntryCleanupAction = true;
+};
+
+// a class that automatically deletes data referenced by the pointers (so effectively it takes ownership of the data)
+// since I was too lazy to implement Remove() APIs properly, removing entries is disallowed
+template <typename ELEMENT, typename KEY>
+class PtrSHashWithCleanup : public SHash< NoRemoveSHashTraits< PtrSHashWithCleanupTraits<ELEMENT, KEY> > >
+{
+};
+
+// Provides case-sensitive comparison and hashing functionality through static
+// and functor object methods. Can be instantiated with CHAR or WCHAR.
+template <typename CharT>
+struct CaseSensitiveStringCompareHash
+{
+private:
+ typedef CharT const * str_t;
+
+ static size_t _strcmp(CHAR const *left, CHAR const *right)
+ {
+ return ::strcmp(left, right);
+ }
+
+ static size_t _strcmp(WCHAR const *left, WCHAR const *right)
+ {
+ return ::wcscmp(left, right);
+ }
+
+ static size_t _hash(CHAR const *str)
+ {
+ return HashStringA(str);
+ }
+
+ static size_t _hash(WCHAR const *str)
+ {
+ return HashString(str);
+ }
+
+public:
+ static size_t compare(str_t left, str_t right)
+ {
+ return _strcmp(left, right);
+ }
+
+ size_t operator()(str_t left, str_t right)
+ {
+ return compare(left, right);
+ }
+
+ static size_t hash(str_t str)
+ {
+ return _hash(str);
+ }
+
+ size_t operator()(str_t str)
+ {
+ return hash(str);
+ }
+};
+
+// Provides case-insensitive comparison and hashing functionality through static
+// and functor object methods. Can be instantiated with CHAR or WCHAR.
+template <typename CharT>
+struct CaseInsensitiveStringCompareHash
+{
+private:
+ typedef CharT const * str_t;
+
+ static size_t _strcmp(str_t left, str_t right)
+ {
+ return ::SString::_tstricmp(left, right);
+ }
+
+ static size_t _hash(CHAR const *str)
+ {
+ return HashiStringA(str);
+ }
+
+ static size_t _hash(WCHAR const *str)
+ {
+ return HashiString(str);
+ }
+
+public:
+ static size_t compare(str_t left, str_t right)
+ {
+ return _strcmp(left, right);
+ }
+
+ size_t operator()(str_t left, str_t right)
+ {
+ return compare(left, right);
+ }
+
+ static size_t hash(str_t str)
+ {
+ return _hash(str);
+ }
+
+ size_t operator()(str_t str)
+ {
+ return hash(str);
+ }
+};
+
+// StringSHashTraits is a traits class useful for string-keyed
+// pointer hash tables.
+
+template <typename ElementT, typename CharT, typename ComparerT = CaseSensitiveStringCompareHash<CharT> >
+class StringSHashTraits : public PtrSHashTraits<ElementT, CharT const *>
+{
+public:
+ // explicitly declare local typedefs for these traits types, otherwise
+ // the compiler may get confused
+ typedef PtrSHashTraits<ElementT, CharT const *> PARENT;
+ typedef typename PARENT::element_t element_t;
+ typedef typename PARENT::key_t key_t;
+ typedef typename PARENT::count_t count_t;
+
+ static BOOL Equals(key_t k1, key_t k2)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ if (k1 == NULL && k2 == NULL)
+ return TRUE;
+ if (k1 == NULL || k2 == NULL)
+ return FALSE;
+ return ComparerT::compare(k1, k2) == 0;
+ }
+ static count_t Hash(key_t k)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ if (k == NULL)
+ return 0;
+ else
+ return (count_t)ComparerT::hash(k);
+ }
+};
+
+template <typename COMINTERFACE, typename CharT> // Could use IUnknown but would rather take advantage of C++ type checking
+struct StringHashElement
+{
+ const CharT *GetKey()
+ {
+ return String;
+ }
+
+ COMINTERFACE *Object;
+ CharT *String;
+};
+
+template <typename COMINTERFACE, typename CharT, typename ComparerT = CaseSensitiveStringCompareHash<CharT> >
+class StringHashWithCleanupTraits : public StringSHashTraits<StringHashElement<COMINTERFACE, CharT>, CharT, ComparerT>
+{
+public:
+ void OnDestructPerEntryCleanupAction(StringHashElement<COMINTERFACE, CharT> * e)
+ {
+ if (e->String != NULL)
+ {
+ delete[] e->String;
+ }
+
+ if (e->Object != NULL)
+ {
+ e->Object->Release();
+ }
+ }
+ static const bool s_DestructPerEntryCleanupAction = true;
+};
+
+template <typename COMINTERFACE, typename CharT, typename ComparerT = CaseSensitiveStringCompareHash<CharT> >
+class StringSHashWithCleanup : public SHash< StringHashWithCleanupTraits<COMINTERFACE, CharT, ComparerT> >
+{
+};
+
+template <typename ELEMENT>
+class StringSHash : public SHash< StringSHashTraits<ELEMENT, CHAR> >
+{
+};
+
+template <typename ELEMENT>
+class WStringSHash : public SHash< StringSHashTraits<ELEMENT, WCHAR> >
+{
+};
+
+template <typename ELEMENT>
+class SStringSHashTraits : public PtrSHashTraits<ELEMENT, SString>
+{
+ public:
+ typedef PtrSHashTraits<ELEMENT, SString> PARENT;
+ typedef typename PARENT::element_t element_t;
+ typedef typename PARENT::key_t key_t;
+ typedef typename PARENT::count_t count_t;
+
+ static const bool s_NoThrow = false;
+
+ static BOOL Equals(const key_t &k1, const key_t &k2)
+ {
+ WRAPPER_NO_CONTRACT;
+ return k1.Equals(k2);
+ }
+ static count_t Hash(const key_t &k)
+ {
+ WRAPPER_NO_CONTRACT;
+ return k.Hash();
+ }
+};
+
+template <typename ELEMENT>
+class SStringSHash : public SHash< SStringSHashTraits<ELEMENT> >
+{
+};
+
+template <typename ELEMENT>
+class SetSHashTraits : public DefaultSHashTraits<ELEMENT>
+{
+public:
+ // explicitly declare local typedefs for these traits types, otherwise
+ // the compiler may get confused
+ typedef typename DefaultSHashTraits<ELEMENT>::element_t element_t;
+ typedef typename DefaultSHashTraits<ELEMENT>::count_t count_t;
+
+ typedef ELEMENT key_t;
+
+ static key_t GetKey(element_t e)
+ {
+ LIMITED_METHOD_CONTRACT;
+ return e;
+ }
+ static BOOL Equals(key_t k1, key_t k2)
+ {
+ LIMITED_METHOD_CONTRACT;
+ return k1 == k2;
+ }
+ static count_t Hash(key_t k)
+ {
+ LIMITED_METHOD_CONTRACT;
+ return (count_t)(size_t)k;
+ }
+};
+
+template <typename ELEMENT, typename TRAITS = NoRemoveSHashTraits< SetSHashTraits <ELEMENT> > >
+class SetSHash : public SHash< TRAITS >
+{
+ typedef SHash<TRAITS> PARENT;
+
+public:
+ BOOL Contains(ELEMENT key) const
+ {
+ return PARENT::LookupPtr(key) != NULL;
+ }
+};
+
+template <typename ELEMENT>
+class PtrSetSHashTraits : public SetSHashTraits<ELEMENT>
+{
+ public:
+
+ // explicitly declare local typedefs for these traits types, otherwise
+ // the compiler may get confused
+ typedef SetSHashTraits<ELEMENT> PARENT;
+ typedef typename PARENT::element_t element_t;
+ typedef typename PARENT::key_t key_t;
+ typedef typename PARENT::count_t count_t;
+
+ static count_t Hash(key_t k)
+ {
+ WRAPPER_NO_CONTRACT;
+ return (count_t)(size_t)k >> 2;
+ }
+};
+
+template <typename PARENT_TRAITS>
+class DeleteElementsOnDestructSHashTraits : public PARENT_TRAITS
+{
+public:
+ static inline void OnDestructPerEntryCleanupAction(typename PARENT_TRAITS::element_t e)
+ {
+ delete e;
+ }
+ static const bool s_DestructPerEntryCleanupAction = true;
+};
+
+#if !defined(CC_JIT) // workaround: Key is redefined in JIT64
+
+template <typename KEY, typename VALUE>
+class KeyValuePair {
+ KEY key;
+ VALUE value;
+
+public:
+ KeyValuePair()
+ {
+ }
+
+ KeyValuePair(const KEY& k, const VALUE& v)
+ : key(k), value(v)
+ {
+ }
+
+ KEY const & Key() const
+ {
+ LIMITED_METHOD_CONTRACT;
+ return key;
+ }
+
+ VALUE const & Value() const
+ {
+ LIMITED_METHOD_CONTRACT;
+ return value;
+ }
+};
+
+template <typename KEY, typename VALUE>
+class MapSHashTraits : public DefaultSHashTraits< KeyValuePair<KEY,VALUE> >
+{
+public:
+ // explicitly declare local typedefs for these traits types, otherwise
+ // the compiler may get confused
+ typedef typename DefaultSHashTraits< KeyValuePair<KEY,VALUE> >::element_t element_t;
+ typedef typename DefaultSHashTraits< KeyValuePair<KEY,VALUE> >::count_t count_t;
+
+ typedef KEY key_t;
+
+ static key_t GetKey(element_t e)
+ {
+ LIMITED_METHOD_CONTRACT;
+ return e.Key();
+ }
+ static BOOL Equals(key_t k1, key_t k2)
+ {
+ LIMITED_METHOD_CONTRACT;
+ return k1 == k2;
+ }
+ static count_t Hash(key_t k)
+ {
+ LIMITED_METHOD_CONTRACT;
+ return (count_t)(size_t)k;
+ }
+
+ static const element_t Null() { LIMITED_METHOD_CONTRACT; return element_t(KEY(),VALUE()); }
+ static const element_t Deleted() { LIMITED_METHOD_CONTRACT; return element_t(KEY(-1), VALUE()); }
+ static bool IsNull(const element_t &e) { LIMITED_METHOD_CONTRACT; return e.Key() == KEY(); }
+ static bool IsDeleted(const element_t &e) { return e.Key() == KEY(-1); }
+};
+
+template <typename KEY, typename VALUE, typename TRAITS = NoRemoveSHashTraits< MapSHashTraits <KEY, VALUE> > >
+class MapSHash : public SHash< TRAITS >
+{
+ typedef SHash< TRAITS > PARENT;
+
+public:
+ void Add(KEY key, VALUE value)
+ {
+ CONTRACTL
+ {
+ THROWS;
+ GC_NOTRIGGER;
+ PRECONDITION(key != (KEY)0);
+ }
+ CONTRACTL_END;
+
+ PARENT::Add(KeyValuePair<KEY,VALUE>(key, value));
+ }
+
+ BOOL Lookup(KEY key, VALUE* pValue) const
+ {
+ CONTRACTL
+ {
+ NOTHROW;
+ GC_NOTRIGGER;
+ PRECONDITION(key != (KEY)0);
+ }
+ CONTRACTL_END;
+
+ const KeyValuePair<KEY,VALUE> *pRet = PARENT::LookupPtr(key);
+ if (pRet == NULL)
+ return FALSE;
+
+ *pValue = pRet->Value();
+ return TRUE;
+ }
+};
+
+template <typename KEY, typename VALUE>
+class MapSHashWithRemove : public SHash< MapSHashTraits <KEY, VALUE> >
+{
+ typedef SHash< MapSHashTraits <KEY, VALUE> > PARENT;
+
+public:
+ void Add(KEY key, VALUE value)
+ {
+ CONTRACTL
+ {
+ THROWS;
+ GC_NOTRIGGER;
+ PRECONDITION(key != (KEY)0 && key != (KEY)-1);
+ }
+ CONTRACTL_END;
+
+ PARENT::Add(KeyValuePair<KEY,VALUE>(key, value));
+ }
+
+ BOOL Lookup(KEY key, VALUE* pValue) const
+ {
+ CONTRACTL
+ {
+ NOTHROW;
+ GC_NOTRIGGER;
+ PRECONDITION(key != (KEY)0 && key != (KEY)-1);
+ }
+ CONTRACTL_END;
+
+ const KeyValuePair<KEY,VALUE> *pRet = PARENT::LookupPtr(key);
+ if (pRet == NULL)
+ return FALSE;
+
+ *pValue = pRet->Value();
+ return TRUE;
+ }
+
+ void Remove(KEY key)
+ {
+ CONTRACTL
+ {
+ NOTHROW;
+ GC_NOTRIGGER;
+ PRECONDITION(key != (KEY)0 && key != (KEY)-1);
+ }
+ CONTRACTL_END;
+
+ PARENT::Remove(key);
+ }
+};
+
+#endif // CC_JIT
+
+#include "shash.inl"
+
+#endif // _SHASH_H_
diff --git a/src/inc/shash.inl b/src/inc/shash.inl
new file mode 100644
index 0000000000..72affb45ba
--- /dev/null
+++ b/src/inc/shash.inl
@@ -0,0 +1,935 @@
+// 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.
+
+#ifndef _SHASH_INL_
+#define _SHASH_INL_
+
+// Many SHash functions do not throw on their own, but may propagate an exception
+// from Hash, Equals, or GetKey.
+#define NOTHROW_UNLESS_TRAITS_THROWS if (TRAITS::s_NoThrow) NOTHROW; else THROWS
+
+void DECLSPEC_NORETURN ThrowOutOfMemory();
+
+template <typename TRAITS>
+SHash<TRAITS>::SHash()
+ : m_table(nullptr),
+ m_tableSize(0),
+ m_tableCount(0),
+ m_tableOccupied(0),
+ m_tableMax(0)
+{
+ LIMITED_METHOD_CONTRACT;
+
+#ifndef __GNUC__ // these crash GCC
+ static_assert_no_msg(s_growth_factor_numerator > s_growth_factor_denominator);
+ static_assert_no_msg(s_density_factor_numerator < s_density_factor_denominator);
+#endif
+}
+
+template <typename TRAITS>
+SHash<TRAITS>::~SHash()
+{
+ LIMITED_METHOD_CONTRACT;
+
+ if (TRAITS::s_DestructPerEntryCleanupAction)
+ {
+ for (Iterator i = Begin(); i != End(); i++)
+ {
+ TRAITS::OnDestructPerEntryCleanupAction(*i);
+ }
+ }
+
+ delete [] m_table;
+}
+
+template <typename TRAITS>
+typename SHash<TRAITS>::count_t SHash<TRAITS>::GetCount() const
+{
+ LIMITED_METHOD_CONTRACT;
+
+ return m_tableCount;
+}
+
+template <typename TRAITS>
+typename SHash<TRAITS>::element_t SHash<TRAITS>::Lookup(key_t key) const
+{
+ CONTRACT(element_t)
+ {
+ NOTHROW_UNLESS_TRAITS_THROWS;
+ GC_NOTRIGGER;
+ INSTANCE_CHECK;
+ POSTCONDITION(TRAITS::IsNull(RETVAL) || TRAITS::Equals(key, TRAITS::GetKey(RETVAL)));
+ SUPPORTS_DAC_WRAPPER;
+ }
+ CONTRACT_END;
+
+ const element_t *pRet = Lookup(m_table, m_tableSize, key);
+ RETURN ((pRet != NULL) ? (*pRet) : TRAITS::Null());
+}
+
+template <typename TRAITS>
+const typename SHash<TRAITS>::element_t * SHash<TRAITS>::LookupPtr(key_t key) const
+{
+ CONTRACT(const element_t *)
+ {
+ NOTHROW_UNLESS_TRAITS_THROWS;
+ GC_NOTRIGGER;
+ INSTANCE_CHECK;
+ POSTCONDITION(RETVAL == NULL || TRAITS::Equals(key, TRAITS::GetKey(*RETVAL)));
+ }
+ CONTRACT_END;
+
+ RETURN Lookup(m_table, m_tableSize, key);
+}
+
+template <typename TRAITS>
+void SHash<TRAITS>::Add(const element_t & element)
+{
+ CONTRACT_VOID
+ {
+ THROWS;
+ GC_NOTRIGGER;
+ INSTANCE_CHECK;
+ POSTCONDITION(TRAITS::Equals(TRAITS::GetKey(element), TRAITS::GetKey(*LookupPtr(TRAITS::GetKey(element)))));
+ }
+ CONTRACT_END;
+
+ CheckGrowth();
+
+ Add_GrowthChecked(element);
+
+ RETURN;
+}
+
+template <typename TRAITS>
+void SHash<TRAITS>::Add_GrowthChecked(const element_t & element)
+{
+ CONTRACT_VOID
+ {
+ NOTHROW_UNLESS_TRAITS_THROWS;
+ GC_NOTRIGGER;
+ INSTANCE_CHECK;
+ POSTCONDITION(TRAITS::Equals(TRAITS::GetKey(element), TRAITS::GetKey(*LookupPtr(TRAITS::GetKey(element)))));
+ }
+ CONTRACT_END;
+
+ if (Add(m_table, m_tableSize, element))
+ m_tableOccupied++;
+ m_tableCount++;
+
+ RETURN;
+}
+
+template <typename TRAITS>
+void SHash<TRAITS>::AddOrReplace(const element_t &element)
+{
+ CONTRACT_VOID
+ {
+ THROWS;
+ GC_NOTRIGGER;
+ INSTANCE_CHECK;
+ static_assert(!TRAITS::s_supports_remove, "SHash::AddOrReplace is not implemented for SHash with support for remove operations.");
+ POSTCONDITION(TRAITS::Equals(TRAITS::GetKey(element), TRAITS::GetKey(*LookupPtr(TRAITS::GetKey(element)))));
+ }
+ CONTRACT_END;
+
+ CheckGrowth();
+
+ AddOrReplace(m_table, m_tableSize, element);
+
+ RETURN;
+}
+
+template <typename TRAITS>
+void SHash<TRAITS>::Remove(key_t key)
+{
+ CONTRACT_VOID
+ {
+ NOTHROW_UNLESS_TRAITS_THROWS;
+ GC_NOTRIGGER;
+ INSTANCE_CHECK;
+ static_assert(TRAITS::s_supports_remove, "This SHash does not support remove operations.");
+ PRECONDITION(!(TRAITS::IsNull(Lookup(key))));
+ }
+ CONTRACT_END;
+
+ Remove(m_table, m_tableSize, key);
+
+ RETURN;
+}
+
+template <typename TRAITS>
+void SHash<TRAITS>::Remove(Iterator& i)
+{
+ CONTRACT_VOID
+ {
+ NOTHROW;
+ GC_NOTRIGGER;
+ INSTANCE_CHECK;
+ static_assert(TRAITS::s_supports_remove, "This SHash does not support remove operations.");
+ PRECONDITION(!(TRAITS::IsNull(*i)));
+ PRECONDITION(!(TRAITS::IsDeleted(*i)));
+ }
+ CONTRACT_END;
+
+ RemoveElement(m_table, m_tableSize, (element_t*)&(*i));
+
+ RETURN;
+}
+
+template <typename TRAITS>
+void SHash<TRAITS>::Remove(KeyIterator& i)
+{
+ CONTRACT_VOID
+ {
+ NOTHROW;
+ GC_NOTRIGGER;
+ INSTANCE_CHECK;
+ static_assert(TRAITS::s_supports_remove, "This SHash does not support remove operations.");
+ PRECONDITION(!(TRAITS::IsNull(*i)));
+ PRECONDITION(!(TRAITS::IsDeleted(*i)));
+ }
+ CONTRACT_END;
+
+ RemoveElement(m_table, m_tableSize, (element_t*)&(*i));
+
+ RETURN;
+}
+
+template <typename TRAITS>
+void SHash<TRAITS>::RemovePtr(element_t * p)
+{
+ CONTRACT_VOID
+ {
+ NOTHROW;
+ GC_NOTRIGGER;
+ INSTANCE_CHECK;
+ static_assert(TRAITS::s_supports_remove, "This SHash does not support remove operations.");
+ PRECONDITION(!(TRAITS::IsNull(*p)));
+ PRECONDITION(!(TRAITS::IsDeleted(*p)));
+ }
+ CONTRACT_END;
+
+ RemoveElement(m_table, m_tableSize, p);
+
+ RETURN;
+}
+
+template <typename TRAITS>
+void SHash<TRAITS>::RemoveAll()
+{
+ CONTRACT_VOID
+ {
+ NOTHROW;
+ GC_NOTRIGGER;
+ INSTANCE_CHECK;
+ }
+ CONTRACT_END;
+
+ delete [] m_table;
+
+ m_table = NULL;
+ m_tableSize = 0;
+ m_tableCount = 0;
+ m_tableOccupied = 0;
+ m_tableMax = 0;
+
+ RETURN;
+}
+
+template <typename TRAITS>
+typename SHash<TRAITS>::Iterator SHash<TRAITS>::Begin() const
+{
+ LIMITED_METHOD_CONTRACT;
+
+ Iterator i(this, TRUE);
+ i.First();
+ return i;
+}
+
+template <typename TRAITS>
+typename SHash<TRAITS>::Iterator SHash<TRAITS>::End() const
+{
+ LIMITED_METHOD_CONTRACT;
+
+ return Iterator(this, FALSE);
+}
+
+template <typename TRAITS>
+typename SHash<TRAITS>::KeyIterator SHash<TRAITS>::Begin(key_t key) const
+{
+ LIMITED_METHOD_CONTRACT;
+
+ KeyIterator k(this, TRUE);
+ k.SetKey(key);
+ return k;
+}
+
+template <typename TRAITS>
+typename SHash<TRAITS>::KeyIterator SHash<TRAITS>::End(key_t key) const
+{
+ LIMITED_METHOD_CONTRACT;
+
+ return KeyIterator(this, FALSE);
+}
+
+template <typename TRAITS>
+BOOL SHash<TRAITS>::CheckGrowth()
+{
+ CONTRACT(BOOL)
+ {
+ THROWS;
+ GC_NOTRIGGER;
+ INSTANCE_CHECK;
+ }
+ CONTRACT_END;
+
+ if (m_tableOccupied == m_tableMax)
+ {
+ Grow();
+ RETURN TRUE;
+ }
+
+ RETURN FALSE;
+}
+
+template <typename TRAITS>
+typename SHash<TRAITS>::element_t *
+SHash<TRAITS>::CheckGrowth_OnlyAllocateNewTable(count_t * pcNewSize)
+{
+ CONTRACT(element_t *)
+ {
+ THROWS;
+ GC_NOTRIGGER;
+ INSTANCE_CHECK;
+ }
+ CONTRACT_END;
+
+ if (m_tableOccupied == m_tableMax)
+ {
+ RETURN Grow_OnlyAllocateNewTable(pcNewSize);
+ }
+
+ RETURN NULL;
+}
+
+template <typename TRAITS>
+void SHash<TRAITS>::Grow()
+{
+ CONTRACT_VOID
+ {
+ THROWS;
+ GC_NOTRIGGER;
+ INSTANCE_CHECK;
+ }
+ CONTRACT_END;
+
+ count_t newSize;
+ element_t * newTable = Grow_OnlyAllocateNewTable(&newSize);
+ element_t * oldTable = ReplaceTable(newTable, newSize);
+ DeleteOldTable(oldTable);
+
+ RETURN;
+}
+
+template <typename TRAITS>
+typename SHash<TRAITS>::element_t *
+SHash<TRAITS>::Grow_OnlyAllocateNewTable(count_t * pcNewSize)
+{
+ CONTRACT(element_t *)
+ {
+ THROWS;
+ GC_NOTRIGGER;
+ INSTANCE_CHECK;
+ }
+ CONTRACT_END;
+
+ count_t newSize = (count_t) (m_tableCount
+ * TRAITS::s_growth_factor_numerator / TRAITS::s_growth_factor_denominator
+ * TRAITS::s_density_factor_denominator / TRAITS::s_density_factor_numerator);
+ if (newSize < TRAITS::s_minimum_allocation)
+ newSize = TRAITS::s_minimum_allocation;
+
+ // handle potential overflow
+ if (newSize < m_tableCount)
+ ThrowOutOfMemory();
+
+ RETURN AllocateNewTable(newSize, pcNewSize);
+}
+
+template <typename TRAITS>
+void SHash<TRAITS>::Reallocate(count_t requestedSize)
+{
+ CONTRACT_VOID
+ {
+ THROWS;
+ GC_NOTRIGGER;
+ INSTANCE_CHECK;
+ }
+ CONTRACT_END;
+
+ count_t newTableSize;
+ element_t * newTable = AllocateNewTable(requestedSize, &newTableSize);
+ element_t * oldTable = ReplaceTable(newTable, newTableSize);
+ DeleteOldTable(oldTable);
+
+ RETURN;
+}
+
+template <typename TRAITS>
+template <typename Functor>
+void SHash<TRAITS>::ForEach(Functor &functor)
+{
+ WRAPPER_NO_CONTRACT; // LIMITED_METHOD_CONTRACT + Functor
+
+ for (count_t i = 0; i < m_tableSize; i++)
+ {
+ element_t element = m_table[i];
+ if (!TRAITS::IsNull(element) && !TRAITS::IsDeleted(element))
+ {
+ functor(element);
+ }
+ }
+}
+
+template <typename TRAITS>
+typename SHash<TRAITS>::element_t *
+SHash<TRAITS>::AllocateNewTable(count_t requestedSize, count_t * pcNewTableSize)
+{
+ CONTRACT(element_t *)
+ {
+ THROWS;
+ GC_NOTRIGGER;
+ INSTANCE_CHECK;
+ PRECONDITION(requestedSize >=
+ (count_t) (GetCount() * s_density_factor_denominator / s_density_factor_numerator));
+ }
+ CONTRACT_END;
+
+ // Allocation size must be a prime number. This is necessary so that hashes uniformly
+ // distribute to all indices, and so that chaining will visit all indices in the hash table.
+ *pcNewTableSize = NextPrime(requestedSize);
+
+ element_t * newTable = new element_t [*pcNewTableSize];
+
+ element_t * p = newTable;
+ element_t * pEnd = newTable + *pcNewTableSize;
+ while (p < pEnd)
+ {
+ *p = TRAITS::Null();
+ p++;
+ }
+
+ RETURN newTable;
+}
+
+template <typename TRAITS>
+typename SHash<TRAITS>::element_t *
+SHash<TRAITS>::ReplaceTable(element_t * newTable, count_t newTableSize)
+{
+ CONTRACT(element_t *)
+ {
+ NOTHROW_UNLESS_TRAITS_THROWS;
+ GC_NOTRIGGER;
+ INSTANCE_CHECK;
+ PRECONDITION(newTableSize >=
+ (count_t) (GetCount() * s_density_factor_denominator / s_density_factor_numerator));
+ }
+ CONTRACT_END;
+
+ element_t * oldTable = m_table;
+
+ // Move all entries over to new table.
+ for (Iterator i = Begin(), end = End(); i != end; i++)
+ {
+ const element_t & cur = (*i);
+ if (!TRAITS::IsNull(cur) && !TRAITS::IsDeleted(cur))
+ Add(newTable, newTableSize, cur);
+ }
+
+ m_table = PTR_element_t(newTable);
+ m_tableSize = newTableSize;
+ m_tableMax = (count_t) (newTableSize * TRAITS::s_density_factor_numerator / TRAITS::s_density_factor_denominator);
+ m_tableOccupied = m_tableCount;
+
+ RETURN oldTable;
+}
+
+template <typename TRAITS>
+void
+SHash<TRAITS>::DeleteOldTable(element_t * oldTable)
+{
+ CONTRACT_VOID
+ {
+ NOTHROW;
+ GC_NOTRIGGER;
+ }
+ CONTRACT_END;
+
+ // @todo:
+ // We might want to try to delay this cleanup to allow asynchronous readers
+ if (oldTable != NULL)
+ delete [] oldTable;
+
+ RETURN;
+}
+
+template <typename TRAITS>
+const typename SHash<TRAITS>::element_t * SHash<TRAITS>::Lookup(PTR_element_t table, count_t tableSize, key_t key)
+{
+ CONTRACT(const element_t *)
+ {
+ NOTHROW_UNLESS_TRAITS_THROWS;
+ GC_NOTRIGGER;
+ POSTCONDITION(RETVAL == NULL || TRAITS::Equals(key, TRAITS::GetKey(*RETVAL)));
+ SUPPORTS_DAC_WRAPPER; // supports DAC only if the traits class does
+ }
+ CONTRACT_END;
+
+ if (tableSize == 0)
+ RETURN NULL;
+
+ count_t hash = TRAITS::Hash(key);
+ count_t index = hash % tableSize;
+ count_t increment = 0; // delay computation
+
+ while (TRUE)
+ {
+ element_t& current = table[index];
+
+ if (TRAITS::IsNull(current))
+ RETURN NULL;
+
+ if (!TRAITS::IsDeleted(current)
+ && TRAITS::Equals(key, TRAITS::GetKey(current)))
+ {
+ RETURN &current;
+ }
+
+ if (increment == 0)
+ increment = (hash % (tableSize-1)) + 1;
+
+ index += increment;
+ if (index >= tableSize)
+ index -= tableSize;
+ }
+}
+
+template <typename TRAITS>
+BOOL SHash<TRAITS>::Add(element_t * table, count_t tableSize, const element_t & element)
+{
+ CONTRACT(BOOL)
+ {
+ NOTHROW_UNLESS_TRAITS_THROWS;
+ GC_NOTRIGGER;
+ POSTCONDITION(TRAITS::Equals(TRAITS::GetKey(element), TRAITS::GetKey(*Lookup(table, tableSize, TRAITS::GetKey(element)))));
+ }
+ CONTRACT_END;
+
+ key_t key = TRAITS::GetKey(element);
+
+ count_t hash = TRAITS::Hash(key);
+ count_t index = hash % tableSize;
+ count_t increment = 0; // delay computation
+
+ while (TRUE)
+ {
+ element_t & current = table[index];
+
+ if (TRAITS::IsNull(current))
+ {
+ table[index] = element;
+ RETURN TRUE;
+ }
+
+ if (TRAITS::IsDeleted(current))
+ {
+ table[index] = element;
+ RETURN FALSE;
+ }
+
+ if (increment == 0)
+ increment = (hash % (tableSize-1)) + 1;
+
+ index += increment;
+ if (index >= tableSize)
+ index -= tableSize;
+ }
+}
+
+template <typename TRAITS>
+void SHash<TRAITS>::AddOrReplace(element_t *table, count_t tableSize, const element_t &element)
+{
+ CONTRACT_VOID
+ {
+ NOTHROW_UNLESS_TRAITS_THROWS;
+ GC_NOTRIGGER;
+ static_assert(!TRAITS::s_supports_remove, "SHash::AddOrReplace is not implemented for SHash with support for remove operations.");
+ POSTCONDITION(TRAITS::Equals(TRAITS::GetKey(element), TRAITS::GetKey(*Lookup(table, tableSize, TRAITS::GetKey(element)))));
+ }
+ CONTRACT_END;
+
+ key_t key = TRAITS::GetKey(element);
+
+ count_t hash = TRAITS::Hash(key);
+ count_t index = hash % tableSize;
+ count_t increment = 0; // delay computation
+
+ while (TRUE)
+ {
+ element_t& current = table[index];
+ _ASSERTE(!TRAITS::IsDeleted(current));
+
+ if (TRAITS::IsNull(current))
+ {
+ table[index] = element;
+ m_tableCount++;
+ m_tableOccupied++;
+ RETURN;
+ }
+ else if (TRAITS::Equals(key, TRAITS::GetKey(current)))
+ {
+ table[index] = element;
+ RETURN;
+ }
+
+ if (increment == 0)
+ increment = (hash % (tableSize-1)) + 1;
+
+ index += increment;
+ if (index >= tableSize)
+ index -= tableSize;
+ }
+}
+
+template <typename TRAITS>
+void SHash<TRAITS>::Remove(element_t *table, count_t tableSize, key_t key)
+{
+ CONTRACT_VOID
+ {
+ NOTHROW_UNLESS_TRAITS_THROWS;
+ GC_NOTRIGGER;
+ static_assert(TRAITS::s_supports_remove, "This SHash does not support remove operations.");
+ PRECONDITION(Lookup(table, tableSize, key) != NULL);
+ }
+ CONTRACT_END;
+
+ count_t hash = TRAITS::Hash(key);
+ count_t index = hash % tableSize;
+ count_t increment = 0; // delay computation
+
+ while (TRUE)
+ {
+ element_t& current = table[index];
+
+ if (TRAITS::IsNull(current))
+ RETURN;
+
+ if (!TRAITS::IsDeleted(current)
+ && TRAITS::Equals(key, TRAITS::GetKey(current)))
+ {
+ table[index] = TRAITS::Deleted();
+ m_tableCount--;
+ RETURN;
+ }
+
+ if (increment == 0)
+ increment = (hash % (tableSize-1)) + 1;
+
+ index += increment;
+ if (index >= tableSize)
+ index -= tableSize;
+ }
+}
+
+template <typename TRAITS>
+void SHash<TRAITS>::RemoveElement(element_t *table, count_t tableSize, element_t *element)
+{
+ CONTRACT_VOID
+ {
+ NOTHROW;
+ GC_NOTRIGGER;
+ static_assert(TRAITS::s_supports_remove, "This SHash does not support remove operations.");
+ PRECONDITION(table <= element && element < table + tableSize);
+ PRECONDITION(!TRAITS::IsNull(*element) && !TRAITS::IsDeleted(*element));
+ }
+ CONTRACT_END;
+
+ *element = TRAITS::Deleted();
+ m_tableCount--;
+ RETURN;
+}
+
+template <typename TRAITS>
+BOOL SHash<TRAITS>::IsPrime(COUNT_T number)
+{
+ CONTRACT(BOOL)
+ {
+ NOTHROW;
+ GC_NOTRIGGER;
+ }
+ CONTRACT_END;
+
+ // This is a very low-tech check for primality, which doesn't scale very well.
+ // There are more efficient tests if this proves to be burdensome for larger
+ // tables.
+
+ if ((number & 1) == 0)
+ RETURN FALSE;
+
+ COUNT_T factor = 3;
+ while (factor * factor <= number)
+ {
+ if ((number % factor) == 0)
+ RETURN FALSE;
+ factor += 2;
+ }
+
+ RETURN TRUE;
+}
+
+// allow coexistence with simplerhash.inl
+#ifndef _HASH_PRIMES_DEFINED
+#define _HASH_PRIMES_DEFINED
+
+namespace
+{
+ const COUNT_T g_shash_primes[] = {
+ 11,17,23,29,37,47,59,71,89,107,131,163,197,239,293,353,431,521,631,761,919,
+ 1103,1327,1597,1931,2333,2801,3371,4049,4861,5839,7013,8419,10103,12143,14591,
+ 17519,21023,25229,30293,36353,43627,52361,62851,75431,90523, 108631, 130363,
+ 156437, 187751, 225307, 270371, 324449, 389357, 467237, 560689, 672827, 807403,
+ 968897, 1162687, 1395263, 1674319, 2009191, 2411033, 2893249, 3471899, 4166287,
+ 4999559, 5999471, 7199369 };
+}
+
+#endif //_HASH_PRIMES_DEFINED
+
+template <typename TRAITS>
+COUNT_T SHash<TRAITS>::NextPrime(COUNT_T number)
+{
+ CONTRACT(COUNT_T)
+ {
+ NOTHROW;
+ GC_NOTRIGGER;
+ POSTCONDITION(IsPrime(RETVAL));
+ }
+ CONTRACT_END;
+
+ for (int i = 0; i < (int) (sizeof(g_shash_primes) / sizeof(g_shash_primes[0])); i++) {
+ if (g_shash_primes[i] >= number)
+ RETURN g_shash_primes[i];
+ }
+
+ if ((number&1) == 0)
+ number++;
+
+ while (number != 1) {
+ if (IsPrime(number))
+ RETURN number;
+ number +=2;
+ }
+
+ // overflow
+ ThrowOutOfMemory();
+}
+
+template <typename TRAITS>
+SHash<TRAITS>::AddPhases::AddPhases()
+{
+ LIMITED_METHOD_CONTRACT;
+
+ m_pHash = NULL;
+ m_newTable = NULL;
+ m_newTableSize = 0;
+ m_oldTable = NULL;
+
+ INDEBUG(dbg_m_fAddCalled = FALSE;)
+}
+
+template <typename TRAITS>
+SHash<TRAITS>::AddPhases::~AddPhases()
+{
+ LIMITED_METHOD_CONTRACT;
+
+ if (m_newTable != NULL)
+ { // The new table was not applied to the hash yet
+ _ASSERTE((m_pHash != NULL) && (m_newTableSize != 0) && (m_oldTable == NULL));
+
+ delete [] m_newTable;
+ }
+ DeleteOldTable();
+}
+
+template <typename TRAITS>
+void SHash<TRAITS>::AddPhases::PreallocateForAdd(SHash * pHash)
+{
+ CONTRACT_VOID
+ {
+ THROWS;
+ GC_NOTRIGGER;
+ }
+ CONTRACT_END;
+
+ _ASSERTE((m_pHash == NULL) && (m_newTable == NULL) && (m_newTableSize == 0) && (m_oldTable == NULL));
+
+ m_pHash = pHash;
+ // May return NULL if the allocation was not needed
+ m_newTable = m_pHash->CheckGrowth_OnlyAllocateNewTable(&m_newTableSize);
+
+#ifdef _DEBUG
+ dbg_m_table = pHash->m_table;
+ dbg_m_tableSize = pHash->m_tableSize;
+ dbg_m_tableCount = pHash->m_tableCount;
+ dbg_m_tableOccupied = pHash->m_tableOccupied;
+ dbg_m_tableMax = pHash->m_tableMax;
+#endif //_DEBUG
+
+ RETURN;
+}
+
+template <typename TRAITS>
+void SHash<TRAITS>::AddPhases::Add(const element_t & element)
+{
+ CONTRACT_VOID
+ {
+ NOTHROW_UNLESS_TRAITS_THROWS;
+ GC_NOTRIGGER;
+ }
+ CONTRACT_END;
+
+ _ASSERTE((m_pHash != NULL) && (m_oldTable == NULL));
+ // Add can be called only once on this object
+ _ASSERTE(!dbg_m_fAddCalled);
+
+ // Check that the hash table didn't change since call to code:PreallocateForAdd
+ _ASSERTE(dbg_m_table == m_pHash->m_table);
+ _ASSERTE(dbg_m_tableSize == m_pHash->m_tableSize);
+ _ASSERTE(dbg_m_tableCount >= m_pHash->m_tableCount); // Remove operation might have removed elements
+ _ASSERTE(dbg_m_tableOccupied == m_pHash->m_tableOccupied);
+ _ASSERTE(dbg_m_tableMax == m_pHash->m_tableMax);
+
+ if (m_newTable != NULL)
+ { // We have pre-allocated table from code:PreallocateForAdd, use it.
+ _ASSERTE(m_newTableSize != 0);
+
+ // May return NULL if there was not table allocated yet
+ m_oldTable = m_pHash->ReplaceTable(m_newTable, m_newTableSize);
+
+ m_newTable = NULL;
+ m_newTableSize = 0;
+ }
+ // We know that we have enough space, direcly add the element
+ m_pHash->Add_GrowthChecked(element);
+
+ INDEBUG(dbg_m_fAddCalled = TRUE;)
+
+ RETURN;
+}
+
+template <typename TRAITS>
+void SHash<TRAITS>::AddPhases::AddNothing_PublishPreallocatedTable()
+{
+ CONTRACT_VOID
+ {
+ NOTHROW_UNLESS_TRAITS_THROWS;
+ GC_NOTRIGGER;
+ }
+ CONTRACT_END;
+
+ _ASSERTE((m_pHash != NULL) && (m_oldTable == NULL));
+ // Add can be called only once on this object
+ _ASSERTE(!dbg_m_fAddCalled);
+
+ // Check that the hash table didn't change since call to code:PreallocateForAdd
+ _ASSERTE(dbg_m_table == m_pHash->m_table);
+ _ASSERTE(dbg_m_tableSize == m_pHash->m_tableSize);
+ _ASSERTE(dbg_m_tableCount >= m_pHash->m_tableCount); // Remove operation might have removed elements
+ _ASSERTE(dbg_m_tableOccupied == m_pHash->m_tableOccupied);
+ _ASSERTE(dbg_m_tableMax == m_pHash->m_tableMax);
+
+ if (m_newTable != NULL)
+ { // We have pre-allocated table from code:PreallocateForAdd, use it.
+ _ASSERTE(m_newTableSize != 0);
+
+ // May return NULL if there was not table allocated yet
+ m_oldTable = m_pHash->ReplaceTable(m_newTable, m_newTableSize);
+
+ m_newTable = NULL;
+ m_newTableSize = 0;
+ }
+
+ INDEBUG(dbg_m_fAddCalled = TRUE;)
+
+ RETURN;
+}
+
+template <typename TRAITS>
+void SHash<TRAITS>::AddPhases::DeleteOldTable()
+{
+ LIMITED_METHOD_CONTRACT;
+
+ if (m_oldTable != NULL)
+ {
+ _ASSERTE((m_pHash != NULL) && (m_newTable == NULL) && (m_newTableSize == 0));
+
+ delete [] m_oldTable;
+ m_oldTable = NULL;
+ }
+}
+
+template <typename TRAITS>
+template <typename LockHolderT,
+ typename AddLockHolderT,
+ typename LockT,
+ typename AddLockT>
+bool SHash<TRAITS>::CheckAddInPhases(
+ element_t const & elem,
+ LockT & lock,
+ AddLockT & addLock,
+ IUnknown * addRefObject)
+{
+ CONTRACTL
+ {
+ THROWS;
+ GC_NOTRIGGER;
+ INSTANCE_CHECK;
+ }
+ CONTRACTL_END;
+
+ AddLockHolderT hAddLock(&addLock);
+ AddPhases addCall;
+
+ // 1. Preallocate one element
+ addCall.PreallocateForAdd(this);
+ {
+ // 2. Take the reader lock. Host callouts now forbidden.
+ LockHolderT hLock(&lock);
+
+ element_t const * pEntry = LookupPtr(TRAITS::GetKey(elem));
+ if (pEntry != nullptr)
+ {
+ // 3a. Use the newly allocated table (if any) to avoid later redundant allocation.
+ addCall.AddNothing_PublishPreallocatedTable();
+ return false;
+ }
+ else
+ {
+ // 3b. Add the element to the hash table.
+ addCall.Add(elem);
+
+ if (addRefObject != nullptr)
+ {
+ clr::SafeAddRef(addRefObject);
+ }
+
+ return true;
+ }
+ }
+
+ // 4. addCall's destructor will take care of any required cleanup.
+}
+
+
+#endif // _SHASH_INL_
diff --git a/src/inc/shim/locationinfo.h b/src/inc/shim/locationinfo.h
new file mode 100644
index 0000000000..d6a1b6d0b4
--- /dev/null
+++ b/src/inc/shim/locationinfo.h
@@ -0,0 +1,42 @@
+// 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.
+//
+// locationinfo.h
+//
+// Enum describing different types of locations for coreCLR
+//
+// Note: must be platform independent
+//
+// ======================================================================================
+
+
+#ifndef LOCATIONINFO_H
+#define LOCATIONINFO_H
+
+
+// in order of preference, smaller is better
+enum LocationInfo
+{
+ Loc_System=1,
+ Loc_Machine=2,
+ Loc_User=3,
+ Loc_Network=4,
+ Loc_Undefined =0xffff
+};
+
+// Returns the more preferred of two locations
+//
+// Assumptions: LocationInfo is defined in a manner that a smaller value is better
+//
+// Input:
+// locations to compare
+//
+// Output:
+// the preferred location
+inline LocationInfo BetterLocation(LocationInfo l1, LocationInfo l2)
+{
+ return l1<l2?l1:l2;
+};
+
+#endif // LOCATIONINFO_H
diff --git a/src/inc/shim/runtimeselector.h b/src/inc/shim/runtimeselector.h
new file mode 100644
index 0000000000..168aee9aa8
--- /dev/null
+++ b/src/inc/shim/runtimeselector.h
@@ -0,0 +1,55 @@
+// 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.
+//
+// runtimeselector.h
+//
+// Class that select the best runtime
+//
+// Note: very similar to ShimSelector but is so simple that adding a common template parent class is not worth it
+//
+// Note: must be platform independent
+//
+// ======================================================================================
+
+
+#ifndef RUNTIMESELECTOR_H
+#define RUNTIMESELECTOR_H
+
+// does not currently need to add anything to VersionAndLocationInfo
+#include "versionandlocationinfo.h"
+typedef VersionAndLocationInfo RuntimeInfo;
+
+class RuntimeSelector
+{
+protected:
+ VersionInfo m_RequestedVersion; // requested version
+ RuntimeInfo m_Best; // the best option so far
+ bool m_bHasSomething; // has any data
+public:
+ //constructor
+ RuntimeSelector();
+
+ // whether the given info compatible with the request
+ bool IsAcceptable(const RuntimeInfo& runtimeInfo) const;
+
+ // add runtime info
+ HRESULT Add(const RuntimeInfo& runtimeInfo);
+
+ // set the version requested
+ void SetRequestedVersion(const VersionInfo& version);
+
+ // get the best found
+ RuntimeInfo GetBest();
+
+ // has any useful data
+ bool HasUsefulRuntimeInfo();
+
+ // is 1st better than 2nd
+ static bool IsBetter(const RuntimeInfo& ri1, const RuntimeInfo& ri2);
+};
+
+#include "runtimeselector.inl"
+
+#endif // RUNTIMESELECTOR_H
+
diff --git a/src/inc/shim/runtimeselector.inl b/src/inc/shim/runtimeselector.inl
new file mode 100644
index 0000000000..5b73a69d94
--- /dev/null
+++ b/src/inc/shim/runtimeselector.inl
@@ -0,0 +1,105 @@
+// 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.
+//
+// runtimeselector.inl
+//
+// implementation that select the best runtime
+//
+// Note: must be platform independent
+//
+// ======================================================================================
+
+// Constructor
+//
+// Simply marks the fact that no data is set
+inline RuntimeSelector::RuntimeSelector()
+{
+ m_bHasSomething=false;
+}
+
+// Sets the runtime version requested
+//
+// Input:
+// version - version to set
+inline void RuntimeSelector::SetRequestedVersion(const VersionInfo& version)
+{
+ m_RequestedVersion=version;
+};
+
+
+// Returns whether the given runtime can be used
+//
+// Input:
+// runtimeInfo - the runtime info
+//
+// Output:
+// return value - true: can be used, false: cannot be used
+inline bool RuntimeSelector::IsAcceptable(const RuntimeInfo& runtimeInfo) const
+{
+ return ( m_RequestedVersion.Major() == runtimeInfo.Version().Major() &&
+ m_RequestedVersion.Minor() == runtimeInfo.Version().Minor());
+}
+
+
+// Returns add the given runtime to the potentially used runtimes list
+//
+// Input:
+// runtimeInfo - the runtime info
+//
+// Output:
+// return value - S_OK added, S_FALSE not added (not a failure) or a failure code
+inline HRESULT RuntimeSelector::Add(const RuntimeInfo& runtimeInfo)
+{
+ HRESULT hr = S_FALSE;
+ if(!IsAcceptable(runtimeInfo))
+ return S_FALSE;
+
+ if(!m_bHasSomething || IsBetter(runtimeInfo,m_Best))
+ {
+ m_Best=runtimeInfo;
+ hr=S_OK;
+ }
+
+ m_bHasSomething=true;
+ return hr;
+};
+
+// Returns add the best runtime of the options given (see Add)
+//
+// Output:
+// return value - the best option
+inline RuntimeInfo RuntimeSelector::GetBest()
+{
+ return m_Best;
+};
+
+// Returns whether we have any usable choices
+//
+// Output:
+// return value - true if the has something usable
+inline bool RuntimeSelector::HasUsefulRuntimeInfo()
+{
+ return m_bHasSomething;
+};
+
+// Compares two given options
+//
+// Input:
+// ri1, ri2 - runtimes to compare
+//
+// Output:
+// return value - true if ri1 is better than ri2
+inline bool RuntimeSelector::IsBetter(const RuntimeInfo& ri1, const RuntimeInfo& ri2)
+{
+ switch(ri1.Version().Compare(ri2.Version()))
+ {
+ case -1: return false;
+ case 1: return true;
+ default:
+ return (BetterLocation(ri1.Location(),ri2.Location())==ri1.Location());
+ }
+};
+
+
+
diff --git a/src/inc/shim/shimselector.h b/src/inc/shim/shimselector.h
new file mode 100644
index 0000000000..0eaafd64dd
--- /dev/null
+++ b/src/inc/shim/shimselector.h
@@ -0,0 +1,55 @@
+// 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.
+//
+// shimselector.h
+//
+// Class that select the best runtime
+//
+// Note: very similar to RuntimeSelector but is so simple that adding a common template parent class is not worth it
+//
+// Note: must be platform independent
+//
+// ======================================================================================
+
+#ifndef SHIMSELECTOR_H
+#define SHIMSELECTOR_H
+
+// does not currently need to add anything to VersionAndLocationInfo
+#include "versionandlocationinfo.h"
+typedef VersionAndLocationInfo ShimInfo;
+
+class ShimSelector
+{
+protected:
+ VersionInfo m_Baseline; // base line to compare against
+ ShimInfo m_Best; // best found so far
+ bool m_bHasSomething; // has any data
+public:
+
+ //constructor
+ ShimSelector();
+
+ // whether the given info is better than the base line
+ bool IsAcceptable(const ShimInfo& shimInfo) const;
+
+ // add shim info
+ HRESULT Add(const ShimInfo& shimInfo);
+
+ //set the base line
+ void SetBaseline(const VersionInfo& version);
+
+ // get the best found
+ ShimInfo GetBest();
+
+ // has any useful data
+ bool HasUsefulShimInfo();
+
+ // is 1st better than 2nd
+ static bool IsBetter(const ShimInfo& ri1, const ShimInfo& ri2);
+};
+
+
+#include "shimselector.inl"
+
+#endif // SHIMSELECTOR_H
diff --git a/src/inc/shim/shimselector.inl b/src/inc/shim/shimselector.inl
new file mode 100644
index 0000000000..2fd3b14d3e
--- /dev/null
+++ b/src/inc/shim/shimselector.inl
@@ -0,0 +1,104 @@
+// 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.
+//
+// shimselector.inl
+//
+// implementation that select the best shim
+//
+// Note: must be platform independent
+//
+// ======================================================================================
+
+
+
+// Constructor
+//
+// Simply marks the fact that no data is set
+inline ShimSelector::ShimSelector()
+{
+ m_bHasSomething=false;
+}
+
+// Sets the base line to compare against
+//
+// Input:
+// version - the version info
+inline void ShimSelector::SetBaseline(const VersionInfo& version)
+{
+ m_Baseline=version;
+}
+
+// Checks whether the shim is better that the base (the current one)
+//
+// Input:
+// shimInfo - the shim info
+//
+// Output:
+// return value - true: better, false: worse or the same
+inline bool ShimSelector::IsAcceptable(const ShimInfo& shimInfo) const
+{
+ return ( m_Baseline.Compare(shimInfo.Version()) < 0 );
+}
+
+// Returns add the given shim to the potentially used shim list
+//
+// Input:
+// shimInfo - the shim info
+//
+// Output:
+// return value - S_OK added, S_FALSE not added (not a failure) or a failure code
+inline HRESULT ShimSelector::Add(const ShimInfo& shimInfo)
+{
+ HRESULT hr = S_FALSE;
+ if(!IsAcceptable(shimInfo))
+ return S_FALSE;
+
+ if(!m_bHasSomething || IsBetter(shimInfo,m_Best))
+ {
+ m_Best=shimInfo;
+ hr=S_OK;
+ }
+
+ m_bHasSomething=true;
+ return hr;
+};
+
+// Returns add the best shim of the options given (see Add)
+//
+// Output:
+// return value - the best option
+inline ShimInfo ShimSelector::GetBest()
+{
+ return m_Best;
+};
+
+// Returns whether we have any usable choices
+//
+// Output:
+// return value - true if the has something usable
+inline bool ShimSelector::HasUsefulShimInfo()
+{
+ return m_bHasSomething;
+};
+
+// Compares two given options
+//
+// Input:
+// si1, si2 - shims to compare
+//
+// Output:
+// return value - true if si1 is better than si2
+inline bool ShimSelector::IsBetter(const ShimInfo& si1, const ShimInfo& si2)
+{
+ switch(si1.Version().Compare(si2.Version()))
+ {
+ case -1: return false;
+ case 1: return true;
+ default:
+ return (BetterLocation(si1.Location(),si2.Location())==si1.Location());
+ }
+};
+
+
+
diff --git a/src/inc/shim/versionandlocationinfo.h b/src/inc/shim/versionandlocationinfo.h
new file mode 100644
index 0000000000..38be7f2c98
--- /dev/null
+++ b/src/inc/shim/versionandlocationinfo.h
@@ -0,0 +1,36 @@
+// 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.
+//
+// versionandlocationinfo.h
+//
+// a simple struct encapsulating version# and location code
+//
+// Note: must be platform independent
+//
+// ======================================================================================
+
+
+#ifndef VERSIONANDLOCATIONINFO_H
+#define VERSIONANDLOCATIONINFO_H
+
+#include "versioninfo.h"
+#include "locationinfo.h"
+
+struct VersionAndLocationInfo
+{
+protected:
+ VersionInfo m_Version;
+ LocationInfo m_Location;
+public:
+ VersionAndLocationInfo();
+ VersionAndLocationInfo(const VersionInfo& version, const LocationInfo location);
+ VersionInfo Version() const;
+ LocationInfo Location() const ;
+};
+
+
+#include "versionandlocationinfo.inl"
+
+#endif // VERSIONANDLOCATIONINFO_H
+
diff --git a/src/inc/shim/versionandlocationinfo.inl b/src/inc/shim/versionandlocationinfo.inl
new file mode 100644
index 0000000000..37c0d98c92
--- /dev/null
+++ b/src/inc/shim/versionandlocationinfo.inl
@@ -0,0 +1,35 @@
+// 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.
+//
+// versionandlocationinfo.inl
+//
+// simple accessors for the struct encapsulating version# and location code
+//
+// Note: must be platform independent
+//
+// ======================================================================================
+
+
+inline VersionAndLocationInfo::VersionAndLocationInfo():
+ m_Version(0,0,0,0),
+ m_Location(Loc_Undefined)
+{
+};
+
+inline VersionAndLocationInfo::VersionAndLocationInfo(const VersionInfo& version, const LocationInfo location):
+ m_Version(version),
+ m_Location(location)
+{
+};
+
+inline VersionInfo VersionAndLocationInfo::Version() const
+{
+ return m_Version;
+};
+
+inline LocationInfo VersionAndLocationInfo::Location() const
+{
+ return m_Location;
+};
+
diff --git a/src/inc/shim/versioninfo.h b/src/inc/shim/versioninfo.h
new file mode 100644
index 0000000000..f3f3b8a719
--- /dev/null
+++ b/src/inc/shim/versioninfo.h
@@ -0,0 +1,46 @@
+// 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.
+//
+// versioninfo.h
+//
+// representation of version#
+//
+// Note: must be platform independent
+//
+// ======================================================================================
+
+#ifndef VERSIONINFO_H
+#define VERSIONINFO_H
+
+
+struct VersionInfo
+{
+protected:
+ unsigned short m_wMajor;
+ unsigned short m_wMinor;
+ unsigned short m_wBuild;
+ unsigned short m_wRevision;
+public:
+ VersionInfo();
+ VersionInfo( const unsigned short major,
+ const unsigned short minor,
+ const unsigned short build,
+ const unsigned short revision
+ );
+ unsigned short Major() const;
+ unsigned short Minor() const;
+ unsigned short Build() const;
+ unsigned short Revision() const;
+
+ // 1 if "this" is bigger, -1 if "this' is smaller
+ int Compare(const VersionInfo& version) const;
+
+ // on success returns count of numbers read (<=4), otherwise -1
+ static int Parse( LPCTSTR szString,
+ VersionInfo* result);
+};
+
+#include "versioninfo.inl"
+
+#endif
diff --git a/src/inc/shim/versioninfo.inl b/src/inc/shim/versioninfo.inl
new file mode 100644
index 0000000000..f2f6b110c0
--- /dev/null
+++ b/src/inc/shim/versioninfo.inl
@@ -0,0 +1,170 @@
+// 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.
+//
+// versioninfo.inl
+//
+// representation of version#
+//
+// Note: must be platform independent
+//
+// ======================================================================================
+
+
+// default cctor
+inline VersionInfo::VersionInfo()
+{
+ m_wMajor=0;
+ m_wMinor=0;
+ m_wBuild=0;
+ m_wRevision=0;
+}
+
+// constructor
+inline VersionInfo::VersionInfo( unsigned short major,
+ unsigned short minor,
+ unsigned short build,
+ unsigned short revision
+ )
+{
+ m_wMajor=major;
+ m_wMinor=minor;
+ m_wBuild=build;
+ m_wRevision=revision;
+}
+
+// field accessor
+inline unsigned short VersionInfo::Major() const
+{
+ return m_wMajor;
+};
+
+// field accessor
+inline unsigned short VersionInfo::Minor() const
+{
+ return m_wMinor;
+};
+
+// field accessor
+inline unsigned short VersionInfo::Build() const
+{
+ return m_wBuild;
+};
+
+// field accessor
+inline unsigned short VersionInfo::Revision() const
+{
+ return m_wRevision;
+};
+
+// Compares against the given version
+//
+// Input:
+// version - the version info
+//
+// Output:
+// return value:
+// -1 given version is newer
+// 1 given version is older
+// 0 given version is the same
+inline int VersionInfo::Compare(const VersionInfo& version) const
+{
+ if (Major() > version.Major())
+ return 1;
+ if (Major() < version.Major())
+ return -1;
+ if (Minor() > version.Minor())
+ return 1;
+ if (Minor() < version.Minor())
+ return -1;
+ if (Build() > version.Build())
+ return 1;
+ if (Build() < version.Build())
+ return -1;
+ if (Revision() > version.Revision())
+ return 1;
+ if (Revision() < version.Revision())
+ return -1;
+ return 0;
+}
+
+
+// Parses the given string into VersionInfo
+//
+// Input:
+// szString - the string to parse, "x.x.x.x"
+//
+// Output:
+// return value: count of fields parsed (<=4) or -1 if an error
+inline int VersionInfo::Parse(LPCTSTR szString, VersionInfo* result)
+{
+ // sscanf is nice but we need an exact format match and no 0s
+ size_t iLen = _tcslen(szString);
+
+ unsigned short wVersion[4] = {0};
+ int iVerIdx = 0;
+ unsigned int dwCurrentValue = 0;
+ bool bFirstChar = true;
+
+ for (size_t i=0; i<= iLen; i++)
+ {
+ if(szString[i] == _T('\0'))
+ {
+ if(!bFirstChar)
+ wVersion[iVerIdx++] = (unsigned short)(dwCurrentValue & 0xffff);
+ break;
+ }
+ else
+ if (szString[i] == _T('.') )
+ {
+ if(bFirstChar)
+ return -1;
+
+ // fill in
+ wVersion[iVerIdx++] = (unsigned short)(dwCurrentValue & 0xffff);
+
+ //check for extra characters
+ if (iVerIdx > sizeof(wVersion)/sizeof(wVersion[0]))
+ {
+ if (szString[i+1] == _T('\0'))
+ break;
+ else
+ return -1;
+ }
+
+ //reset
+ dwCurrentValue=0;
+ bFirstChar=true;
+ continue;
+ }
+ else
+ if (szString[i] < _T('0'))
+ {
+ return -1;
+ }
+ else
+ if (szString[i] > _T('9'))
+ {
+ return -1;
+ }
+ else
+ if (szString[i] == _T('0') && bFirstChar && szString[i+1]!= _T('.') && szString[i+1]!= _T('\0') )
+ {
+ return -1;
+ }
+
+ // the character is a digit
+ dwCurrentValue=dwCurrentValue*10+szString[i]-_T('0');
+ if(dwCurrentValue > 0xffff)
+ return -1;
+
+ bFirstChar=false;
+
+ }
+
+ //successfully parsed
+ *result = VersionInfo(wVersion[0], wVersion[1], wVersion[2], wVersion[3]);
+ return iVerIdx;
+
+}
+
diff --git a/src/inc/shimload.h b/src/inc/shimload.h
new file mode 100644
index 0000000000..9a6ab7de6f
--- /dev/null
+++ b/src/inc/shimload.h
@@ -0,0 +1,38 @@
+// 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.
+
+/*============================================================
+**
+** Header: ShimLoad.hpp
+**
+** Purpose: Delay load hook used to images to bind to
+** dll's shim shipped with the EE
+**
+**
+===========================================================*/
+#ifndef _SHIMLOAD_H
+#define _SHIMLOAD_H
+
+#ifndef FEATURE_CORECLR
+#include <delayimp.h>
+
+extern FARPROC __stdcall ShimDelayLoadHook(unsigned dliNotify, // What event has occurred, dli* flag.
+ DelayLoadInfo *pdli); // Description of the event.
+
+//and one for safe mode
+extern FARPROC __stdcall ShimSafeModeDelayLoadHook(unsigned dliNotify, // What event has occurred, dli* flag.
+ DelayLoadInfo *pdli); // Description of the event.
+
+#endif
+
+//*****************************************************************************
+// Sets/Gets the directory based on the location of the module. This routine
+// is called at COR setup time. Set is called during EEStartup and by the
+// MetaData dispenser.
+//*****************************************************************************
+HRESULT SetInternalSystemDirectory();
+HRESULT GetInternalSystemDirectory(__out_ecount_opt(*pdwLength) LPWSTR buffer, __inout DWORD* pdwLength);
+
+#endif
+
diff --git a/src/inc/sigbuilder.h b/src/inc/sigbuilder.h
new file mode 100644
index 0000000000..6d7cbf27ba
--- /dev/null
+++ b/src/inc/sigbuilder.h
@@ -0,0 +1,79 @@
+// 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.
+
+
+#ifndef _SIGBUILDER_H_
+#define _SIGBUILDER_H_
+
+#include "contract.h"
+
+//
+// Simple signature builder
+//
+
+class SigBuilder
+{
+ PBYTE m_pBuffer;
+ DWORD m_dwLength;
+ DWORD m_dwAllocation;
+
+ // Preallocate space for small signatures
+ BYTE m_prealloc[64];
+
+ // Grow the buffer to get at least cbMin of free space
+ void Grow(SIZE_T cbMin);
+
+ // Ensure that the buffer has at least cbMin of free space
+ FORCEINLINE void Ensure(SIZE_T cb)
+ {
+ if (m_dwAllocation - m_dwLength < cb)
+ Grow(cb);
+ }
+
+public:
+ SigBuilder()
+ : m_pBuffer(m_prealloc), m_dwLength(0), m_dwAllocation(sizeof(m_prealloc))
+ {
+ LIMITED_METHOD_CONTRACT;
+ }
+
+ ~SigBuilder();
+
+ SigBuilder(DWORD cbPreallocationSize);
+
+ PVOID GetSignature(DWORD * pdwLength)
+ {
+ LIMITED_METHOD_CONTRACT;
+ *pdwLength = m_dwLength;
+ return m_pBuffer;
+ }
+
+ DWORD GetSignatureLength()
+ {
+ LIMITED_METHOD_CONTRACT;
+ return m_dwLength;
+ }
+
+ void AppendByte(BYTE b);
+
+ void AppendData(ULONG data);
+
+ void AppendElementType(CorElementType etype)
+ {
+ WRAPPER_NO_CONTRACT;
+ AppendByte(static_cast<BYTE>(etype));
+ }
+
+ void AppendToken(mdToken tk);
+
+ void AppendPointer(void * ptr)
+ {
+ WRAPPER_NO_CONTRACT;
+ AppendBlob(&ptr, sizeof(ptr));
+ }
+
+ void AppendBlob(const PVOID pBlob, SIZE_T cbBlob);
+};
+
+#endif // _SIGBUILDER_H_
diff --git a/src/inc/sigparser.h b/src/inc/sigparser.h
new file mode 100644
index 0000000000..2c8cf8b165
--- /dev/null
+++ b/src/inc/sigparser.h
@@ -0,0 +1,985 @@
+// 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.
+//
+// sigparser.h
+//
+
+//
+
+#ifndef _H_SIGPARSER
+#define _H_SIGPARSER
+
+#include "utilcode.h"
+#include "corhdr.h"
+#include "corinfo.h"
+#include "corpriv.h"
+
+//---------------------------------------------------------------------------------------
+// These macros define how arguments are mapped to the stack in the managed calling convention.
+// We assume to be walking a method's signature left-to-right, in the virtual calling convention.
+// See MethodDesc::Call for details on this virtual calling convention.
+// These macros tell us whether the arguments we see as we proceed with the signature walk are mapped
+// to increasing or decreasing stack addresses. This is valid only for arguments that go on the stack.
+//---------------------------------------------------------------------------------------
+#if defined(_TARGET_X86_)
+#define STACK_GROWS_DOWN_ON_ARGS_WALK
+#else
+#define STACK_GROWS_UP_ON_ARGS_WALK
+#endif
+
+
+//------------------------------------------------------------------------
+// Encapsulates how compressed integers and typeref tokens are encoded into
+// a bytestream.
+//
+// As you use this class please understand the implicit normalizations
+// on the CorElementType's returned by the various methods, especially
+// for variable types (e.g. !0 in generic signatures), string types
+// (i.e. E_T_STRING), object types (E_T_OBJECT), constructed types
+// (e.g. List<int>) and enums.
+//------------------------------------------------------------------------
+class SigParser
+{
+ protected:
+ // This type is performance critical - do not add fields to it.
+ // (If you must, check for managed types that may use a SigParser or SigPointer inline, like ArgIterator.)
+ PCCOR_SIGNATURE m_ptr;
+ DWORD m_dwLen;
+
+ //------------------------------------------------------------------------
+ // Skips specified number of bytes WITHOUT VALIDATION. Only to be used
+ // when it is known that it won't overflow the signature buffer.
+ //------------------------------------------------------------------------
+ FORCEINLINE void SkipBytes(ULONG cb)
+ {
+ SUPPORTS_DAC;
+ _ASSERT(cb <= m_dwLen);
+ m_ptr += cb;
+ m_dwLen -= cb;
+ }
+
+ public:
+ //------------------------------------------------------------------------
+ // Constructor.
+ //------------------------------------------------------------------------
+ SigParser() {
+ LIMITED_METHOD_DAC_CONTRACT;
+ m_ptr = NULL;
+ m_dwLen = 0;
+ }
+
+ SigParser(const SigParser &sig);
+
+ //------------------------------------------------------------------------
+ // Initialize
+ //------------------------------------------------------------------------
+ FORCEINLINE SigParser(PCCOR_SIGNATURE ptr)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_ptr = ptr;
+ // We don't know the size of the signature, so we'll say it's "big enough"
+ m_dwLen = 0xffffffff;
+ }
+
+ FORCEINLINE SigParser(PCCOR_SIGNATURE ptr, DWORD len)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_ptr = ptr;
+ m_dwLen = len;
+ }
+
+ inline void SetSig(PCCOR_SIGNATURE ptr)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_ptr = ptr;
+ // We don't know the size of the signature, so we'll say it's "big enough"
+ m_dwLen = 0xffffffff;
+ }
+
+ inline void SetSig(PCCOR_SIGNATURE ptr, DWORD len)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_ptr = ptr;
+ m_dwLen = len;
+ }
+
+
+ inline BOOL IsNull() const
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ return (m_ptr == NULL);
+ }
+
+ // Returns represented signature as pointer and size.
+ void
+ GetSignature(
+ PCCOR_SIGNATURE * pSig,
+ DWORD * pcbSigSize)
+ {
+ *pSig = m_ptr;
+ *pcbSigSize = m_dwLen;
+ }
+
+
+ //=========================================================================
+ // The RAW interface for reading signatures. You see exactly the signature,
+ // apart from custom modifiers which for historical reasons tend to get eaten.
+ //
+ // DO NOT USE THESE METHODS UNLESS YOU'RE TOTALLY SURE YOU WANT
+ // THE RAW signature. You nearly always want GetElemTypeClosed() or
+ // PeekElemTypeClosed() or one of the MetaSig functions. See the notes above.
+ // These functions will return E_T_INTERNAL, E_T_VAR, E_T_MVAR and such
+ // so the caller must be able to deal with those
+ //=========================================================================
+
+ //------------------------------------------------------------------------
+ // Remove one compressed integer (using CorSigUncompressData) from
+ // the head of the stream and return it.
+ //------------------------------------------------------------------------
+ __checkReturn
+ FORCEINLINE HRESULT GetData(ULONG* data)
+ {
+ WRAPPER_NO_CONTRACT;
+ SUPPORTS_DAC;
+
+ ULONG sizeOfData = 0;
+ ULONG tempData;
+
+ if (data == NULL)
+ data = &tempData;
+
+ HRESULT hr = CorSigUncompressData(m_ptr, m_dwLen, data, &sizeOfData);
+
+ if (SUCCEEDED(hr))
+ {
+ SkipBytes(sizeOfData);
+ }
+
+ return hr;
+ }
+
+
+ //-------------------------------------------------------------------------
+ // Remove one byte and return it.
+ //-------------------------------------------------------------------------
+ __checkReturn
+ FORCEINLINE HRESULT GetByte(BYTE *data)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ if (m_dwLen > 0)
+ {
+ if (data != NULL)
+ *data = *m_ptr;
+
+ SkipBytes(1);
+
+ return S_OK;
+ }
+
+ if (data != NULL)
+ *data = 0;
+ return META_E_BAD_SIGNATURE;
+ }
+
+ //-------------------------------------------------------------------------
+ // Peek at value of one byte and return it.
+ //-------------------------------------------------------------------------
+ __checkReturn
+ FORCEINLINE HRESULT PeekByte(BYTE *data)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ if (m_dwLen > 0)
+ {
+ if (data != NULL)
+ *data = *m_ptr;
+
+ return S_OK;
+ }
+
+ if (data != NULL)
+ *data = 0;
+ return META_E_BAD_SIGNATURE;
+ }
+
+ //-------------------------------------------------------------------------
+ // The element type as defined in CorElementType. No normalization for
+ // generics (E_T_VAR, E_T_MVAR,..) or dynamic methods (E_T_INTERNAL occurs)
+ //-------------------------------------------------------------------------
+ __checkReturn
+ HRESULT GetElemTypeSlow(CorElementType * etype)
+ {
+ WRAPPER_NO_CONTRACT;
+ SUPPORTS_DAC;
+
+ CorElementType tmpEType;
+
+ if (etype == NULL)
+ etype = &tmpEType;
+
+ SigParser sigTemp(*this);
+
+ HRESULT hr = sigTemp.SkipCustomModifiers();
+
+ if (SUCCEEDED(hr))
+ {
+ BYTE bElemType = 0;
+ hr = sigTemp.GetByte(&bElemType);
+ *etype = (CorElementType)bElemType;
+
+ if (SUCCEEDED(hr))
+ {
+ *this = sigTemp;
+ return S_OK;
+ }
+ }
+
+ *etype = ELEMENT_TYPE_END;
+
+ return META_E_BAD_SIGNATURE;
+ }
+
+ // Inlined version
+ __checkReturn
+ FORCEINLINE HRESULT GetElemType(CorElementType * etype)
+ {
+ WRAPPER_NO_CONTRACT;
+ SUPPORTS_DAC;
+
+ if (m_dwLen > 0)
+ {
+ CorElementType typ = (CorElementType) * m_ptr;
+
+ if (typ < ELEMENT_TYPE_CMOD_REQD) // fast path with no modifiers: single byte
+ {
+ if (etype != NULL)
+ {
+ * etype = typ;
+ }
+
+ SkipBytes(1);
+
+ return S_OK;
+ }
+ }
+
+ // Slower/normal path
+ return GetElemTypeSlow(etype);
+ }
+
+ // Note: Calling convention is always one byte, not four bytes
+ __checkReturn
+ HRESULT GetCallingConvInfo(ULONG * data)
+ {
+ WRAPPER_NO_CONTRACT;
+ SUPPORTS_DAC;
+
+ ULONG tmpData;
+
+ if (data == NULL)
+ data = &tmpData;
+
+ HRESULT hr = CorSigUncompressCallingConv(m_ptr, m_dwLen, data);
+ if (SUCCEEDED(hr))
+ {
+ SkipBytes(1);
+ }
+
+ return hr;
+ }
+
+ __checkReturn
+ HRESULT GetCallingConv(ULONG* data) // @REVISIT_TODO: Calling convention is one byte, not four.
+ {
+ WRAPPER_NO_CONTRACT;
+ ULONG info;
+ HRESULT hr = GetCallingConvInfo(&info);
+
+ if (SUCCEEDED(hr) && data != NULL)
+ {
+ *data = IMAGE_CEE_CS_CALLCONV_MASK & info;
+ }
+
+ return hr;
+ }
+
+ //------------------------------------------------------------------------
+ // Non-destructive read of compressed integer.
+ //------------------------------------------------------------------------
+ __checkReturn
+ HRESULT PeekData(ULONG *data) const
+ {
+ WRAPPER_NO_CONTRACT;
+ _ASSERTE(data != NULL);
+
+ ULONG sizeOfData = 0;
+ return CorSigUncompressData(m_ptr, m_dwLen, data, &sizeOfData);
+ }
+
+
+ //------------------------------------------------------------------------
+ // Non-destructive read of element type.
+ //
+ // This routine makes it look as if the String type is encoded
+ // via ELEMENT_TYPE_CLASS followed by a token for the String class,
+ // rather than the ELEMENT_TYPE_STRING. This is partially to avoid
+ // rewriting client code which depended on this behavior previously.
+ // But it also seems like the right thing to do generally.
+ // No normalization for generics (E_T_VAR, E_T_MVAR,..) or
+ // dynamic methods (E_T_INTERNAL occurs)
+ //------------------------------------------------------------------------
+ __checkReturn
+ HRESULT PeekElemTypeSlow(CorElementType *etype) const
+ {
+ WRAPPER_NO_CONTRACT;
+ SUPPORTS_DAC;
+
+ _ASSERTE(etype != NULL);
+
+ SigParser sigTemp(*this);
+ HRESULT hr = sigTemp.GetElemType(etype);
+ if (SUCCEEDED(hr) && (*etype == ELEMENT_TYPE_STRING || *etype == ELEMENT_TYPE_OBJECT))
+ *etype = ELEMENT_TYPE_CLASS;
+
+ return hr;
+ }
+
+ // inline version
+ __checkReturn
+ FORCEINLINE HRESULT PeekElemType(CorElementType *etype) const
+ {
+ WRAPPER_NO_CONTRACT;
+ SUPPORTS_DAC;
+
+ _ASSERTE(etype != NULL);
+
+ if (m_dwLen > 0)
+ {
+ CorElementType typ = (CorElementType) * m_ptr;
+
+ if (typ < ELEMENT_TYPE_CMOD_REQD) // fast path with no modifiers: single byte
+ {
+ if ((typ == ELEMENT_TYPE_STRING) || (typ == ELEMENT_TYPE_OBJECT))
+ {
+ *etype = ELEMENT_TYPE_CLASS;
+ }
+ else
+ {
+ *etype = typ;
+ }
+
+ return S_OK;
+ }
+ }
+
+ return PeekElemTypeSlow(etype);
+ }
+
+ //-------------------------------------------------------------------------
+ // Returns the raw size of the type next in the signature, or returns
+ // E_INVALIDARG for base types that have variables sizes.
+ //-------------------------------------------------------------------------
+ __checkReturn
+ HRESULT PeekElemTypeSize(ULONG *pSize)
+ {
+ WRAPPER_NO_CONTRACT;
+ HRESULT hr = S_OK;
+
+ DWORD dwSize = 0;
+
+ if (pSize == NULL)
+ {
+ pSize = &dwSize;
+ }
+
+ SigParser sigTemp(*this);
+
+ hr = sigTemp.SkipAnyVASentinel();
+
+ if (FAILED(hr))
+ {
+ return hr;
+ }
+
+ *pSize = 0;
+
+ BYTE bElementType = 0;
+ hr = sigTemp.GetByte(&bElementType);
+
+ if (FAILED(hr))
+ {
+ return hr;
+ }
+
+ switch (bElementType)
+ {
+ case ELEMENT_TYPE_I8:
+ case ELEMENT_TYPE_U8:
+ case ELEMENT_TYPE_R8:
+ #ifdef _WIN64
+ case ELEMENT_TYPE_I:
+ case ELEMENT_TYPE_U:
+ #endif // WIN64
+
+ *pSize = 8;
+ break;
+
+ case ELEMENT_TYPE_I4:
+ case ELEMENT_TYPE_U4:
+ case ELEMENT_TYPE_R4:
+ #ifndef _WIN64
+ case ELEMENT_TYPE_I:
+ case ELEMENT_TYPE_U:
+ #endif // _WIN64
+
+ *pSize = 4;
+ break;
+
+ case ELEMENT_TYPE_I2:
+ case ELEMENT_TYPE_U2:
+ case ELEMENT_TYPE_CHAR:
+ *pSize = 2;
+ break;
+
+ case ELEMENT_TYPE_I1:
+ case ELEMENT_TYPE_U1:
+ case ELEMENT_TYPE_BOOLEAN:
+ *pSize = 1;
+ break;
+
+ case ELEMENT_TYPE_STRING:
+ case ELEMENT_TYPE_PTR:
+ case ELEMENT_TYPE_BYREF:
+ case ELEMENT_TYPE_CLASS:
+ case ELEMENT_TYPE_OBJECT:
+ case ELEMENT_TYPE_FNPTR:
+ case ELEMENT_TYPE_TYPEDBYREF:
+ case ELEMENT_TYPE_ARRAY:
+ case ELEMENT_TYPE_SZARRAY:
+ *pSize = sizeof(void *);
+ break;
+
+ case ELEMENT_TYPE_VOID:
+ break;
+
+ case ELEMENT_TYPE_END:
+ case ELEMENT_TYPE_CMOD_REQD:
+ case ELEMENT_TYPE_CMOD_OPT:
+ _ASSERTE(!"Asked for the size of an element that doesn't have a size!");
+ return E_INVALIDARG;
+
+ case ELEMENT_TYPE_VALUETYPE:
+ _ASSERTE(!"Asked for the size of an element that doesn't have a size!");
+ return E_INVALIDARG;
+
+ default:
+
+ _ASSERTE( !"CorSigGetElementTypeSize given invalid signature to size!" );
+ return META_E_BAD_SIGNATURE;
+ }
+
+ return hr;
+ }
+
+ //------------------------------------------------------------------------
+ // Is this at the Sentinal (the ... in a varargs signature) that marks
+ // the begining of varguments that are not decared at the target
+
+ bool AtSentinel() const
+ {
+ if (m_dwLen > 0)
+ return *m_ptr == ELEMENT_TYPE_SENTINEL;
+ else
+ return false;
+ }
+
+ //------------------------------------------------------------------------
+ // Removes a compressed metadata token and returns it.
+ // WARNING: dynamic methods do not have tokens so this api is completely
+ // broken in that case. Make sure you call this function if
+ // you are absolutely sure E_T_INTERNAL was not in the sig
+ //------------------------------------------------------------------------
+ __checkReturn
+ FORCEINLINE
+ HRESULT GetToken(mdToken * token)
+ {
+ WRAPPER_NO_CONTRACT;
+ DWORD dwLen;
+ mdToken tempToken;
+
+ if (token == NULL)
+ token = &tempToken;
+
+ HRESULT hr = CorSigUncompressToken(m_ptr, m_dwLen, token, &dwLen);
+
+ if (SUCCEEDED(hr))
+ {
+ SkipBytes(dwLen);
+ }
+
+ return hr;
+ }
+
+ //------------------------------------------------------------------------
+ // Removes a pointer value and returns it. Used for ELEMENT_TYPE_INTERNAL.
+ __checkReturn
+ FORCEINLINE
+ HRESULT GetPointer(void ** pPtr)
+ {
+ WRAPPER_NO_CONTRACT;
+
+ if (m_dwLen < sizeof(void *))
+ { // Not enough data to read a pointer
+ if (pPtr != NULL)
+ {
+ *pPtr = NULL;
+ }
+ return META_E_BAD_SIGNATURE;
+ }
+ if (pPtr != NULL)
+ {
+ *pPtr = *(void * UNALIGNED *)m_ptr;
+ }
+ SkipBytes(sizeof(void *));
+
+ return S_OK;
+ }
+
+ //------------------------------------------------------------------------
+ // Tests if two SigParsers point to the same location in the stream.
+ //------------------------------------------------------------------------
+ FORCEINLINE BOOL Equals(SigParser sp) const
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ return m_ptr == sp.m_ptr;
+ }
+
+ __checkReturn
+ HRESULT SkipCustomModifiers()
+ {
+ WRAPPER_NO_CONTRACT;
+ SUPPORTS_DAC;
+
+ HRESULT hr = S_OK;
+
+ SigParser sigTemp(*this);
+
+ hr = sigTemp.SkipAnyVASentinel();
+
+ if (FAILED(hr))
+ {
+ return hr;
+ }
+
+ BYTE bElementType = 0;
+
+ hr = sigTemp.PeekByte(&bElementType);
+ if (FAILED(hr))
+ return hr;
+
+ while ((ELEMENT_TYPE_CMOD_REQD == bElementType) ||
+ (ELEMENT_TYPE_CMOD_OPT == bElementType))
+ {
+ sigTemp.SkipBytes(1);
+
+ mdToken token;
+
+ hr = sigTemp.GetToken(&token);
+
+ if (FAILED(hr))
+ return hr;
+
+ hr = sigTemp.PeekByte(&bElementType);
+ if (FAILED(hr))
+ return hr;
+ }
+
+ // Following custom modifiers must be an element type value which is less than ELEMENT_TYPE_MAX, or one of the other element types
+ // that we support while parsing various signatures
+ if (bElementType >= ELEMENT_TYPE_MAX)
+ {
+ switch (bElementType)
+ {
+ case ELEMENT_TYPE_VAR_ZAPSIG:
+ case ELEMENT_TYPE_NATIVE_ARRAY_TEMPLATE_ZAPSIG:
+ case ELEMENT_TYPE_NATIVE_VALUETYPE_ZAPSIG:
+ case ELEMENT_TYPE_CANON_ZAPSIG:
+ case ELEMENT_TYPE_MODULE_ZAPSIG:
+ case ELEMENT_TYPE_PINNED:
+ break;
+ default:
+ return META_E_BAD_SIGNATURE;
+ }
+ }
+
+ *this = sigTemp;
+ return hr;
+ }// SkipCustomModifiers
+
+ __checkReturn
+ HRESULT SkipFunkyAndCustomModifiers()
+ {
+ WRAPPER_NO_CONTRACT;
+ SUPPORTS_DAC;
+
+ SigParser sigTemp(*this);
+ HRESULT hr = S_OK;
+ hr = sigTemp.SkipAnyVASentinel();
+
+ if (FAILED(hr))
+ {
+ return hr;
+ }
+
+ BYTE bElementType = 0;
+
+ hr = sigTemp.PeekByte(&bElementType);
+ if (FAILED(hr))
+ return hr;
+
+ while (ELEMENT_TYPE_CMOD_REQD == bElementType ||
+ ELEMENT_TYPE_CMOD_OPT == bElementType ||
+ ELEMENT_TYPE_MODIFIER == bElementType ||
+ ELEMENT_TYPE_PINNED == bElementType)
+ {
+ sigTemp.SkipBytes(1);
+
+ mdToken token;
+
+ hr = sigTemp.GetToken(&token);
+
+ if (FAILED(hr))
+ return hr;
+
+ hr = sigTemp.PeekByte(&bElementType);
+ if (FAILED(hr))
+ return hr;
+ }
+
+ // Following custom modifiers must be an element type value which is less than ELEMENT_TYPE_MAX, or one of the other element types
+ // that we support while parsing various signatures
+ if (bElementType >= ELEMENT_TYPE_MAX)
+ {
+ switch (bElementType)
+ {
+ case ELEMENT_TYPE_NATIVE_ARRAY_TEMPLATE_ZAPSIG:
+ case ELEMENT_TYPE_NATIVE_VALUETYPE_ZAPSIG:
+ case ELEMENT_TYPE_CANON_ZAPSIG:
+ case ELEMENT_TYPE_MODULE_ZAPSIG:
+ case ELEMENT_TYPE_PINNED:
+ break;
+ default:
+ return META_E_BAD_SIGNATURE;
+ }
+ }
+
+ *this = sigTemp;
+ return hr;
+ }// SkipFunkyAndCustomModifiers
+
+
+ __checkReturn
+ HRESULT SkipAnyVASentinel()
+ {
+ WRAPPER_NO_CONTRACT;
+
+ HRESULT hr = S_OK;
+ BYTE bElementType = 0;
+
+ hr = PeekByte(&bElementType);
+ if (FAILED(hr))
+ return hr;
+
+ if (bElementType == ELEMENT_TYPE_SENTINEL)
+ {
+ SkipBytes(1);
+ }
+
+ return hr;
+ }// SkipAnyVASentinel
+
+ //------------------------------------------------------------------------
+ // Assumes that the SigParser points to the start of an element type
+ // (i.e. function parameter, function return type or field type.)
+ // Advances the pointer to the first data after the element type.
+ //------------------------------------------------------------------------
+ __checkReturn
+ HRESULT SkipExactlyOne();
+
+ //------------------------------------------------------------------------
+ // Skip only the method header of the signature, not the signature of
+ // the arguments.
+ //------------------------------------------------------------------------
+ __checkReturn
+ HRESULT SkipMethodHeaderSignature(ULONG *pcArgs);
+
+ //------------------------------------------------------------------------
+ // Skip a sub signature (as immediately follows an ELEMENT_TYPE_FNPTR).
+ //------------------------------------------------------------------------
+ __checkReturn
+ HRESULT SkipSignature();
+
+public:
+
+ //------------------------------------------------------------------------
+ // Return pointer
+ // PLEASE DON'T USE THIS.
+ //
+ // Return the internal pointer. It's hard to resist, but please try
+ // not to use this. Certainly don't use it if there's any chance of the
+ // signature containing generic type variables.
+ //
+ // It's currently only used for working on the
+ // signatures stored in TypeSpec tokens (we should add a new abstraction,
+ // i.e. on MetaSig for this) and a couple of places to do with COM
+ // and native interop signature parsing.
+ // <REVISIT_TODO>We should try to get rid of these uses as well. </REVISIT_TODO>
+ //------------------------------------------------------------------------
+ PCCOR_SIGNATURE GetPtr() const
+ {
+ LIMITED_METHOD_DAC_CONTRACT;
+ return m_ptr;
+ }
+
+}; // class SigParser
+
+//------------------------------------------------------------------------
+FORCEINLINE
+SigParser::SigParser(
+ const SigParser &sig)
+ : m_ptr(sig.m_ptr), m_dwLen(sig.m_dwLen)
+{
+ LIMITED_METHOD_DAC_CONTRACT;
+}
+
+/*****************************************************************/
+/* CorTypeInfo is a single global table that you can hang information
+ about ELEMENT_TYPE_* */
+
+class CorTypeInfo
+{
+protected:
+ struct CorTypeInfoEntry
+ {
+ LPCUTF8 nameSpace;
+ LPCUTF8 className;
+ CorElementType type : 8;
+ unsigned size : 8;
+ CorInfoGCType gcType : 3;
+ unsigned isArray : 1;
+ unsigned isPrim : 1;
+ unsigned isFloat : 1;
+ unsigned isModifier : 1;
+ unsigned isGenVar : 1;
+ // 1 more byte here to use for 32-bit
+ };
+
+protected:
+ FORCEINLINE static const CorTypeInfoEntry &GetTypeInfo(CorElementType type)
+ {
+ CONTRACTL
+ {
+ THROWS;
+ GC_NOTRIGGER;
+ SUPPORTS_DAC;
+#ifdef MODE_ANY
+ MODE_ANY;
+#endif
+ }
+ CONTRACTL_END;
+
+ if (type >= (CorElementType)_countof(info))
+ {
+ ThrowHR(COR_E_BADIMAGEFORMAT);
+ }
+ return info[type];
+ }
+ FORCEINLINE static const CorTypeInfoEntry &GetTypeInfo_NoThrow(CorElementType type)
+ {
+ LIMITED_METHOD_DAC_CONTRACT;
+
+ if (type >= (CorElementType)_countof(info))
+ {
+ return info[ELEMENT_TYPE_END];
+ }
+ return info[type];
+ }
+
+public:
+
+ FORCEINLINE static LPCUTF8 GetName(CorElementType type)
+ {
+ WRAPPER_NO_CONTRACT;
+
+ return GetTypeInfo(type).className;
+ }
+
+ FORCEINLINE static LPCUTF8 GetNamespace(CorElementType type)
+ {
+ WRAPPER_NO_CONTRACT;
+
+ return GetTypeInfo(type).nameSpace;
+ }
+
+ static void CheckConsistency()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ for (int i = 0; i < (int)_countof(info); i++)
+ {
+ _ASSERTE(info[i].type == i);
+ }
+ }
+
+ FORCEINLINE static CorInfoGCType GetGCType(CorElementType type)
+ {
+ WRAPPER_NO_CONTRACT;
+
+ return GetTypeInfo(type).gcType;
+ }
+ FORCEINLINE static CorInfoGCType GetGCType_NoThrow(CorElementType type)
+ {
+ LIMITED_METHOD_DAC_CONTRACT;
+
+ return GetTypeInfo_NoThrow(type).gcType;
+ }
+
+ static BOOL IsObjRef(CorElementType type)
+ {
+ WRAPPER_NO_CONTRACT;
+ SUPPORTS_DAC;
+
+ return (GetGCType(type) == TYPE_GC_REF);
+ }
+ static BOOL IsObjRef_NoThrow(CorElementType type)
+ {
+ WRAPPER_NO_CONTRACT;
+ SUPPORTS_DAC;
+
+ return (GetGCType_NoThrow(type) == TYPE_GC_REF);
+ }
+
+ FORCEINLINE static BOOL IsGenericVariable(CorElementType type)
+ {
+ WRAPPER_NO_CONTRACT;
+
+ return GetTypeInfo(type).isGenVar;
+ }
+ FORCEINLINE static BOOL IsGenericVariable_NoThrow(CorElementType type)
+ {
+ WRAPPER_NO_CONTRACT;
+
+ return GetTypeInfo_NoThrow(type).isGenVar;
+ }
+
+ FORCEINLINE static BOOL IsArray(CorElementType type)
+ {
+ WRAPPER_NO_CONTRACT;
+
+ return GetTypeInfo(type).isArray;
+ }
+ FORCEINLINE static BOOL IsArray_NoThrow(CorElementType type)
+ {
+ WRAPPER_NO_CONTRACT;
+
+ return GetTypeInfo_NoThrow(type).isArray;
+ }
+
+ FORCEINLINE static BOOL IsFloat(CorElementType type)
+ {
+ WRAPPER_NO_CONTRACT;
+
+ return GetTypeInfo(type).isFloat;
+ }
+ FORCEINLINE static BOOL IsFloat_NoThrow(CorElementType type)
+ {
+ WRAPPER_NO_CONTRACT;
+
+ return GetTypeInfo_NoThrow(type).isFloat;
+ }
+
+ FORCEINLINE static BOOL IsModifier(CorElementType type)
+ {
+ WRAPPER_NO_CONTRACT;
+
+ return GetTypeInfo(type).isModifier;
+ }
+ FORCEINLINE static BOOL IsModifier_NoThrow(CorElementType type)
+ {
+ WRAPPER_NO_CONTRACT;
+
+ return GetTypeInfo_NoThrow(type).isModifier;
+ }
+
+ FORCEINLINE static BOOL IsPrimitiveType(CorElementType type)
+ {
+ WRAPPER_NO_CONTRACT;
+
+ return GetTypeInfo(type).isPrim;
+ }
+ FORCEINLINE static BOOL IsPrimitiveType_NoThrow(CorElementType type)
+ {
+ WRAPPER_NO_CONTRACT;
+
+ return GetTypeInfo_NoThrow(type).isPrim;
+ }
+
+ FORCEINLINE static unsigned Size(CorElementType type)
+ {
+ WRAPPER_NO_CONTRACT;
+
+ return GetTypeInfo(type).size;
+ }
+ FORCEINLINE static unsigned Size_NoThrow(CorElementType type)
+ {
+ WRAPPER_NO_CONTRACT;
+
+ return GetTypeInfo_NoThrow(type).size;
+ }
+
+ static CorElementType FindPrimitiveType(LPCUTF8 name);
+
+protected:
+ static const CorTypeInfoEntry info[ELEMENT_TYPE_MAX];
+
+}; // class CorTypeInfo
+
+
+// Returns the address of the payload inside the stackelem
+inline void* StackElemEndianessFixup(void* pStackElem, UINT cbSize) {
+ LIMITED_METHOD_CONTRACT;
+
+ BYTE *pRetVal = (BYTE*)pStackElem;
+
+#if BIGENDIAN
+ switch (cbSize)
+ {
+ case 1:
+ pRetVal += sizeof(void*)-1;
+ break;
+ case 2:
+ pRetVal += sizeof(void*)-2;
+ break;
+#ifdef _WIN64
+ case 4:
+ pRetVal += sizeof(void*)-4;
+ break;
+#endif
+ default:
+ // nothing to do
+ break;
+ }
+#endif
+
+ return pRetVal;
+}
+
+#endif /* _H_SIGINFOBASE */
diff --git a/src/inc/simplerhash.h b/src/inc/simplerhash.h
new file mode 100644
index 0000000000..eb0f80d013
--- /dev/null
+++ b/src/inc/simplerhash.h
@@ -0,0 +1,423 @@
+// 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.
+
+#ifndef _SIMPLERHASHTABLE_H_
+#define _SIMPLERHASHTABLE_H_
+
+#include "iallocator.h"
+
+// SimplerHashTable implements a mapping from a Key type to a Value type,
+// via a hash table.
+
+// Synchronization is the responsibility of the caller: if a
+// SimplerHash is used in a multithreaded context, the table should be
+// associated with a lock.
+
+// SimplerHashTable actually takes four template arguments: Key,
+// KeyFuncs, Value, and Behavior. We don't assume that Key has hash or equality
+// functions specific names; rather, we assume that KeyFuncs has
+// statics methods
+// int GetHashCode(Key)
+// and
+// bool Equals(Key, Key)
+// and use those. An
+// instantiator can thus make a small "adaptor class" to invoke
+// existing instance method hash and/or equality functions. If the
+// implementor of a candidate Key class K understands this convention,
+// these static methods can be implemented by K, so that K can be used
+// as the actual arguments for the both Key and KeyTrait classes.
+//
+// The "Behavior" argument provides the following static members:
+//
+// s_growth_factor_numerator
+// s_growth_factor_denominator Factor to grow allocation (numerator/denominator).
+// Typically inherited from default traits (3/2)
+//
+// s_density_factor_numerator
+// s_density_factor_denominator Maxium occupied density of table before growth
+// occurs (num/denom). Typically inherited (3/4).
+//
+// s_minimum_allocation Minimum table allocation count (size on first growth.) It is
+// probably preferable to call Reallocate on initialization rather
+// than override his from the default traits. (7)
+//
+// NoMemory() Called when the hash table is unable to grow due to potential
+// overflow or the lack of a sufficiently large prime.
+
+void DECLSPEC_NORETURN ThrowOutOfMemory();
+
+class DefaultSimplerHashBehavior
+{
+public:
+ static const unsigned s_growth_factor_numerator = 3;
+ static const unsigned s_growth_factor_denominator = 2;
+
+ static const unsigned s_density_factor_numerator = 3;
+ static const unsigned s_density_factor_denominator = 4;
+
+ static const unsigned s_minimum_allocation = 7;
+
+ inline static void DECLSPEC_NORETURN NoMemory()
+ {
+ ::ThrowOutOfMemory();
+ }
+};
+
+// Stores info about primes, including the magic number and shift amount needed
+// to implement a divide without using the divide instruction
+class PrimeInfo
+{
+public:
+ PrimeInfo() : prime(0), magic(0), shift(0) {}
+ PrimeInfo(unsigned p, unsigned m, unsigned s) : prime(p), magic(m), shift(s) {}
+ unsigned prime;
+ unsigned magic;
+ unsigned shift;
+};
+
+
+// Hash table class definition
+
+template <typename Key, typename KeyFuncs, typename Value, typename Behavior>
+class SimplerHashTable
+{
+public:
+ // Forward declaration.
+ class KeyIterator;
+
+ // Constructor/destructor. SHash tables always start out empty, with no
+ // allocation overhead. Call Reallocate to prime with an initial size if
+ // desired. Pass NULL as the IAllocator* if you want to use DefaultAllocator
+ // (basically, operator new/delete).
+
+ SimplerHashTable(IAllocator* alloc);
+ ~SimplerHashTable();
+
+ // operators new/delete when an IAllocator is to be used.
+ void * operator new(size_t sz, IAllocator * alloc);
+ void * operator new[](size_t sz, IAllocator * alloc);
+ void operator delete(void * p, IAllocator * alloc);
+ void operator delete[](void * p, IAllocator * alloc);
+
+ // If the table contains a mapping for "key", returns "true" and
+ // sets "*pVal" to the value to which "key" maps. Otherwise,
+ // returns false, and does not modify "*pVal".
+ bool Lookup(Key k, Value* pVal = NULL) const;
+
+ Value *LookupPointer(Key k) const;
+
+ // Causes the table to map "key" to "val". Returns "true" if
+ // "key" had already been mapped by the table, "false" otherwise.
+ bool Set(Key k, Value val);
+
+ // Ensures that "key" is not mapped to a value by the "table."
+ // Returns "true" iff it had been mapped.
+ bool Remove(Key k);
+
+ // Remove all mappings in the table.
+ void RemoveAll();
+
+ // Begin and End pointers for iteration over entire table.
+ KeyIterator Begin() const;
+ KeyIterator End() const;
+
+ // Return the number of elements currently stored in the table
+ unsigned GetCount() const;
+
+private:
+ // Forward declaration of the linked-list node class.
+ struct Node;
+
+ unsigned GetIndexForKey(Key k) const;
+
+ // If the table has a mapping for "k", return the node containing
+ // that mapping, else "NULL".
+ Node* FindNode(Key k) const;
+
+ // Resizes a hash table for growth. The new size is computed based
+ // on the current population, growth factor, and maximum density factor.
+ void Grow();
+
+ // See if it is OK to grow the hash table by one element. If not, reallocate
+ // the hash table.
+ void CheckGrowth();
+
+public:
+ // Reallocates a hash table to a specific size. The size must be big enough
+ // to hold all elements in the table appropriately.
+ //
+ // Note that the actual table size must always be a prime number; the number
+ // passed in will be upward adjusted if necessary.
+ void Reallocate(unsigned newTableSize);
+
+ // For iteration, we use a pattern similar to the STL "forward
+ // iterator" pattern. It basically consists of wrapping an
+ // "iteration variable" in an object, and providing pointer-like
+ // operators on the iterator. Example usage:
+ //
+ // for (SimplerHashTable::KeyIterator iter = foo->Begin(), end = foo->End(); !iter.Equal(end); iter++)
+ // {
+ // // use foo, iter.
+ // }
+ // iter.Get() will yield (a reference to) the
+ // current key. It will assert the equivalent of "iter != end."
+ class KeyIterator
+ {
+ private:
+ friend class SimplerHashTable;
+
+ // The method implementations have to be here for portability.
+ // Some compilers won't compile the separate implementation in shash.inl
+
+ Node** m_table;
+ Node* m_node;
+ unsigned m_tableSize;
+ unsigned m_index;
+
+ public:
+ KeyIterator(const SimplerHashTable *hash, BOOL begin)
+ : m_table(hash->m_table),
+ m_node(NULL),
+ m_tableSize(hash->m_tableSizeInfo.prime),
+ m_index(begin ? 0 : m_tableSize)
+ {
+ if (begin && hash->m_tableCount > 0)
+ {
+ assert(m_table != NULL);
+ while (m_index < m_tableSize && m_table[m_index] == NULL)
+ m_index++;
+
+ if (m_index >= m_tableSize)
+ {
+ return;
+ }
+ else
+ {
+ m_node = m_table[m_index];
+ }
+ assert(m_node != NULL);
+ }
+ }
+
+ const Key& Get() const
+ {
+ assert(m_node != NULL);
+
+ return m_node->m_key;
+ }
+
+ const Value& GetValue() const
+ {
+ assert(m_node != NULL);
+
+ return m_node->m_val;
+ }
+
+ void SetValue(const Value & value) const
+ {
+ assert(m_node != NULL);
+
+ m_node->m_val = value;
+ }
+
+ void Next()
+ {
+ if (m_node != NULL)
+ {
+ m_node = m_node->m_next;
+ if (m_node != NULL)
+ {
+ return;
+ }
+
+ // Otherwise...
+ m_index++;
+ }
+ while (m_index < m_tableSize && m_table[m_index] == NULL)
+ m_index++;
+
+ if (m_index >= m_tableSize)
+ {
+ m_node = NULL;
+ return;
+ }
+ else
+ {
+ m_node = m_table[m_index];
+ }
+ assert(m_node != NULL);
+ }
+
+ bool Equal(const KeyIterator &i) const
+ {
+ return i.m_node == m_node;
+ }
+
+ void operator++() {
+ Next();
+ }
+
+ void operator++(int) {
+ Next();
+ }
+ };
+
+ // HashTableRef only exists to support operator[]
+ // operator[] returns a HashTableRef which enables operator[] to support reading and writing
+ // in a normal array, it just returns a ref an actual element, which is not possible here.
+ class HashTableRef
+ {
+ public:
+ // this is really the getter for the array.
+ operator Value()
+ {
+
+ Value result;
+ table->Lookup(key, &result);
+ return result;
+ }
+
+ void operator =(const Value v)
+ {
+ table->Set(key, v);
+ }
+
+ friend class SimplerHashTable;
+
+ protected:
+ HashTableRef(SimplerHashTable *t, Key k)
+ {
+ table = t;
+ key = k;
+ }
+
+ SimplerHashTable *table;
+ Key key;
+ };
+
+ Value &operator[](Key k) const
+ {
+ Value* p = LookupPointer(k);
+ assert(p);
+ return *p;
+ }
+
+ private:
+ // Find the next prime number >= the given value.
+ static PrimeInfo NextPrime(unsigned number);
+
+ // Instance members
+ IAllocator* m_alloc; // IAllocator to use in this
+ // table.
+ // The node type.
+ struct Node {
+ Node* m_next; // Assume that the alignment requirement of Key and Value are no greater than Node*, so put m_next to avoid unnecessary padding.
+ Key m_key;
+ Value m_val;
+
+ Node(Key k, Value v, Node* next) : m_next(next), m_key(k), m_val(v) {}
+
+ void* operator new(size_t sz, IAllocator* alloc)
+ {
+ return alloc->Alloc(sz);
+ }
+
+ void operator delete(void* p, IAllocator* alloc)
+ {
+ alloc->Free(p);
+ }
+ };
+
+ Node** m_table; // pointer to table
+ PrimeInfo m_tableSizeInfo; // size of table (a prime) and information about it
+ unsigned m_tableCount; // number of elements in table
+ unsigned m_tableMax; // maximum occupied count
+};
+
+#include "simplerhash.inl"
+
+// A few simple KeyFuncs types...
+
+// Base class for types whose equality function is the same as their "==".
+template<typename T>
+struct KeyFuncsDefEquals
+{
+ static bool Equals(const T& x, const T& y)
+ {
+ return x == y;
+ }
+};
+
+template<typename T>
+struct PtrKeyFuncs: public KeyFuncsDefEquals<const T*>
+{
+public:
+ static unsigned GetHashCode(const T* ptr)
+ {
+ // Hmm. Maybe (unsigned) ought to be "ssize_t" -- or this ought to be ifdef'd by size.
+ return static_cast<unsigned>(reinterpret_cast<uintptr_t>(ptr));
+ }
+};
+
+template<typename T> // Must be coercable to "unsigned" with no loss of information.
+struct SmallPrimitiveKeyFuncs: public KeyFuncsDefEquals<T>
+{
+ static unsigned GetHashCode(const T& val)
+ {
+ return static_cast<unsigned>(val);
+ }
+};
+
+template<typename T> // Assumed to be of size sizeof(UINT64).
+struct LargePrimitiveKeyFuncs: public KeyFuncsDefEquals<T>
+{
+ static unsigned GetHashCode(const T val)
+ {
+ // A static cast when T is a float or a double converts the value (i.e. 0.25 converts to 0)
+ //
+ // Instead we want to use all of the bits of a float to create the hash value
+ // So we cast the address of val to a pointer to an equivalent sized unsigned int
+ // This allows us to read the actual bit representation of a float type
+ //
+ // We can't read beyond the end of val, so we use sizeof(T) to determine
+ // exactly how many bytes to read
+ //
+ if (sizeof(T) == 8)
+ {
+ // cast &val to (UINT64 *) then deref to get the bits
+ UINT64 asUINT64 = *(reinterpret_cast<const UINT64 *>(&val));
+
+ // Get the upper and lower 32-bit values from the 64-bit value
+ UINT32 upper32 = static_cast<UINT32> (asUINT64 >> 32);
+ UINT32 lower32 = static_cast<UINT32> (asUINT64 & 0xFFFFFFFF);
+
+ // Exclusive-Or the upper32 and the lower32 values
+ return static_cast<unsigned>(upper32 ^ lower32);
+
+ }
+ else if (sizeof(T) == 4)
+ {
+ // cast &val to (UINT32 *) then deref to get the bits
+ UINT32 asUINT32 = *(reinterpret_cast<const UINT32 *>(&val));
+
+ // Just return the 32-bit value
+ return static_cast<unsigned>(asUINT32);
+ }
+ else if ((sizeof(T) == 2) || (sizeof(T) == 1))
+ {
+ // For small sizes we must have an integer type
+ // so we can just use the static_cast.
+ //
+ return static_cast<unsigned>(val);
+ }
+ else
+ {
+ // Only support Hashing for types that are 8,4,2 or 1 bytes in size
+ assert(!"Unsupported size");
+ return static_cast<unsigned>(val); // compile-time error here when we have a illegal size
+ }
+ }
+};
+
+#endif // _SIMPLERHASHTABLE_H_
diff --git a/src/inc/simplerhash.inl b/src/inc/simplerhash.inl
new file mode 100644
index 0000000000..dc72acba26
--- /dev/null
+++ b/src/inc/simplerhash.inl
@@ -0,0 +1,350 @@
+// 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.
+
+#ifndef _SIMPLERHASHTABLE_INL_
+#define _SIMPLERHASHTABLE_INL_
+
+// To implement magic-number divide with a 32-bit magic number,
+// multiply by the magic number, take the top 64 bits, and shift that
+// by the amount given in the table.
+
+inline
+unsigned magicNumberDivide(unsigned numerator, const PrimeInfo &p)
+{
+ unsigned __int64 num = numerator;
+ unsigned __int64 mag = p.magic;
+ unsigned __int64 product = (num * mag) >> (32 + p.shift);
+ return (unsigned) product;
+}
+
+inline
+unsigned magicNumberRem(unsigned numerator, const PrimeInfo &p)
+{
+ unsigned div = magicNumberDivide(numerator, p);
+ unsigned result = numerator - (div * p.prime);
+ assert(result == numerator % p.prime);
+ return result;
+}
+
+template <typename Key, typename KeyFuncs, typename Value, typename Behavior>
+SimplerHashTable<Key,KeyFuncs,Value,Behavior>::SimplerHashTable(IAllocator* alloc)
+ : m_alloc(alloc),
+ m_table(NULL),
+ m_tableSizeInfo(),
+ m_tableCount(0),
+ m_tableMax(0)
+{
+ assert(m_alloc != nullptr);
+
+#ifndef __GNUC__ // these crash GCC
+ static_assert_no_msg(Behavior::s_growth_factor_numerator > Behavior::s_growth_factor_denominator);
+ static_assert_no_msg(Behavior::s_density_factor_numerator < Behavior::s_density_factor_denominator);
+#endif
+}
+
+template <typename Key, typename KeyFuncs, typename Value, typename Behavior>
+SimplerHashTable<Key,KeyFuncs,Value,Behavior>::~SimplerHashTable()
+{
+ RemoveAll();
+}
+
+template <typename Key, typename KeyFuncs, typename Value, typename Behavior>
+void * SimplerHashTable<Key,KeyFuncs,Value,Behavior>::operator new(size_t sz, IAllocator * alloc)
+{
+ return alloc->Alloc(sz);
+}
+
+template <typename Key, typename KeyFuncs, typename Value, typename Behavior>
+void * SimplerHashTable<Key,KeyFuncs,Value,Behavior>::operator new[](size_t sz, IAllocator * alloc)
+{
+ return alloc->Alloc(sz);
+}
+
+template <typename Key, typename KeyFuncs, typename Value, typename Behavior>
+void SimplerHashTable<Key,KeyFuncs,Value,Behavior>::operator delete(void * p, IAllocator * alloc)
+{
+ alloc->Free(p);
+}
+
+template <typename Key, typename KeyFuncs, typename Value, typename Behavior>
+void SimplerHashTable<Key,KeyFuncs,Value,Behavior>::operator delete[](void * p, IAllocator * alloc)
+{
+ alloc->Free(p);
+}
+
+template <typename Key, typename KeyFuncs, typename Value, typename Behavior>
+unsigned SimplerHashTable<Key,KeyFuncs,Value,Behavior>::GetCount() const
+{
+ return m_tableCount;
+}
+
+template <typename Key, typename KeyFuncs, typename Value, typename Behavior>
+bool SimplerHashTable<Key,KeyFuncs,Value,Behavior>::Lookup(Key key, Value* pVal) const
+{
+ Node* pN = FindNode(key);
+
+ if (pN != NULL)
+ {
+ if (pVal != NULL)
+ {
+ *pVal = pN->m_val;
+ }
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+template <typename Key, typename KeyFuncs, typename Value, typename Behavior>
+Value *SimplerHashTable<Key,KeyFuncs,Value,Behavior>::LookupPointer(Key key) const
+{
+ Node* pN = FindNode(key);
+
+ if (pN != NULL)
+ return &(pN->m_val);
+ else
+ return NULL;
+}
+
+template <typename Key, typename KeyFuncs, typename Value, typename Behavior>
+typename SimplerHashTable<Key,KeyFuncs,Value,Behavior>::Node*
+SimplerHashTable<Key,KeyFuncs,Value,Behavior>::FindNode(Key k) const
+{
+ if (m_tableSizeInfo.prime == 0)
+ return NULL;
+
+ unsigned index = GetIndexForKey(k);
+
+ Node* pN = m_table[index];
+ if (pN == NULL)
+ return NULL;
+
+ // Otherwise...
+ while (pN != NULL && !KeyFuncs::Equals(k, pN->m_key))
+ pN = pN->m_next;
+
+ assert(pN == NULL || KeyFuncs::Equals(k, pN->m_key));
+
+ // If pN != NULL, it's the node for the key, else the key isn't mapped.
+ return pN;
+}
+
+template <typename Key, typename KeyFuncs, typename Value, typename Behavior>
+unsigned SimplerHashTable<Key,KeyFuncs,Value,Behavior>::GetIndexForKey(Key k) const
+{
+ unsigned hash = KeyFuncs::GetHashCode(k);
+
+ unsigned index = magicNumberRem(hash, m_tableSizeInfo);
+
+ return index;
+}
+
+template <typename Key, typename KeyFuncs, typename Value, typename Behavior>
+bool SimplerHashTable<Key,KeyFuncs,Value,Behavior>::Set(Key k, Value v)
+{
+ CheckGrowth();
+
+ assert(m_tableSizeInfo.prime != 0);
+
+ unsigned index = GetIndexForKey(k);
+
+ Node* pN = m_table[index];
+ while (pN != NULL && !KeyFuncs::Equals(k, pN->m_key))
+ {
+ pN = pN->m_next;
+ }
+ if (pN != NULL)
+ {
+ pN->m_val = v;
+ return true;
+ }
+ else
+ {
+ Node* pNewNode = new (m_alloc) Node(k, v, m_table[index]);
+ m_table[index] = pNewNode;
+ m_tableCount++;
+ return false;
+ }
+}
+
+template <typename Key, typename KeyFuncs, typename Value, typename Behavior>
+bool SimplerHashTable<Key,KeyFuncs,Value,Behavior>::Remove(Key k)
+{
+ unsigned index = GetIndexForKey(k);
+
+ Node* pN = m_table[index];
+ Node** ppN = &m_table[index];
+ while (pN != NULL && !KeyFuncs::Equals(k, pN->m_key))
+ {
+ ppN = &pN->m_next;
+ pN = pN->m_next;
+ }
+ if (pN != NULL)
+ {
+ *ppN = pN->m_next;
+ m_tableCount--;
+ Node::operator delete(pN, m_alloc);
+ return true;
+ }
+ else
+ {
+ return false;
+ }
+}
+
+template <typename Key, typename KeyFuncs, typename Value, typename Behavior>
+void SimplerHashTable<Key,KeyFuncs,Value,Behavior>::RemoveAll()
+{
+ for (unsigned i = 0; i < m_tableSizeInfo.prime; i++)
+ {
+ for (Node* pN = m_table[i]; pN != NULL; )
+ {
+ Node* pNext = pN->m_next;
+ Node::operator delete(pN, m_alloc);
+ pN = pNext;
+ }
+ }
+ m_alloc->Free(m_table);
+
+ m_table = NULL;
+ m_tableSizeInfo = PrimeInfo();
+ m_tableCount = 0;
+ m_tableMax = 0;
+
+ return;
+}
+
+template <typename Key, typename KeyFuncs, typename Value, typename Behavior>
+typename SimplerHashTable<Key,KeyFuncs,Value,Behavior>::KeyIterator SimplerHashTable<Key,KeyFuncs,Value,Behavior>::Begin() const
+{
+ KeyIterator i(this, TRUE);
+ return i;
+}
+
+template <typename Key, typename KeyFuncs, typename Value, typename Behavior>
+typename SimplerHashTable<Key,KeyFuncs,Value,Behavior>::KeyIterator SimplerHashTable<Key,KeyFuncs,Value,Behavior>::End() const
+{
+ return KeyIterator(this, FALSE);
+}
+
+template <typename Key, typename KeyFuncs, typename Value, typename Behavior>
+void SimplerHashTable<Key,KeyFuncs,Value,Behavior>::CheckGrowth()
+{
+ if (m_tableCount == m_tableMax)
+ {
+ Grow();
+ }
+}
+
+template <typename Key, typename KeyFuncs, typename Value, typename Behavior>
+void SimplerHashTable<Key,KeyFuncs,Value,Behavior>::Grow()
+{
+ unsigned newSize = (unsigned) (m_tableCount
+ * Behavior::s_growth_factor_numerator / Behavior::s_growth_factor_denominator
+ * Behavior::s_density_factor_denominator / Behavior::s_density_factor_numerator);
+ if (newSize < Behavior::s_minimum_allocation)
+ newSize = Behavior::s_minimum_allocation;
+
+ // handle potential overflow
+ if (newSize < m_tableCount)
+ Behavior::NoMemory();
+
+ Reallocate(newSize);
+}
+
+template <typename Key, typename KeyFuncs, typename Value, typename Behavior>
+void SimplerHashTable<Key,KeyFuncs,Value,Behavior>::Reallocate(unsigned newTableSize)
+{
+ assert(newTableSize >= (GetCount() * Behavior::s_density_factor_denominator / Behavior::s_density_factor_numerator));
+
+ // Allocation size must be a prime number. This is necessary so that hashes uniformly
+ // distribute to all indices, and so that chaining will visit all indices in the hash table.
+ PrimeInfo newPrime = NextPrime(newTableSize);
+ newTableSize = newPrime.prime;
+
+ Node** newTable = (Node**)m_alloc->ArrayAlloc(newTableSize, sizeof(Node*));
+
+ for (unsigned i = 0; i < newTableSize; i++) {
+ newTable[i] = NULL;
+ }
+
+ // Move all entries over to new table (re-using the Node structures.)
+
+ for (unsigned i = 0; i < m_tableSizeInfo.prime; i++)
+ {
+ Node* pN = m_table[i];
+ while (pN != NULL)
+ {
+ Node* pNext = pN->m_next;
+
+ unsigned newIndex = magicNumberRem(KeyFuncs::GetHashCode(pN->m_key), newPrime);
+ pN->m_next = newTable[newIndex];
+ newTable[newIndex] = pN;
+
+ pN = pNext;
+ }
+ }
+
+ // @todo:
+ // We might want to try to delay this cleanup to allow asynchronous readers
+ if (m_table != NULL)
+ m_alloc->Free(m_table);
+
+ m_table = newTable;
+ m_tableSizeInfo = newPrime;
+ m_tableMax = (unsigned) (newTableSize * Behavior::s_density_factor_numerator / Behavior::s_density_factor_denominator);
+}
+
+// Table of primes and their magic-number-divide constant.
+// For more info see the book "Hacker's Delight" chapter 10.9 "Unsigned Division by Divisors >= 1"
+// These were selected by looking for primes, each roughly twice as big as the next, having
+// 32-bit magic numbers, (because the algorithm for using 33-bit magic numbers is slightly slower).
+//
+
+SELECTANY const PrimeInfo primeInfo[] =
+{
+ PrimeInfo(9, 0x38e38e39, 1),
+ PrimeInfo(23, 0xb21642c9, 4),
+ PrimeInfo(59, 0x22b63cbf, 3),
+ PrimeInfo(131, 0xfa232cf3, 7),
+ PrimeInfo(239, 0x891ac73b, 7),
+ PrimeInfo(433, 0x975a751, 4),
+ PrimeInfo(761, 0x561e46a5, 8),
+ PrimeInfo(1399, 0xbb612aa3, 10),
+ PrimeInfo(2473, 0x6a009f01, 10),
+ PrimeInfo(4327, 0xf2555049, 12),
+ PrimeInfo(7499, 0x45ea155f, 11),
+ PrimeInfo(12973, 0x1434f6d3, 10),
+ PrimeInfo(22433, 0x2ebe18db, 12),
+ PrimeInfo(46559, 0xb42bebd5, 15),
+ PrimeInfo(96581, 0xadb61b1b, 16),
+ PrimeInfo(200341, 0x29df2461, 15),
+ PrimeInfo(415517, 0xa181c46d, 18),
+ PrimeInfo(861719, 0x4de0bde5, 18),
+ PrimeInfo(1787021, 0x9636c46f, 20),
+ PrimeInfo(3705617, 0x4870adc1, 20),
+ PrimeInfo(7684087, 0x8bbc5b83, 22),
+ PrimeInfo(15933877, 0x86c65361, 23),
+ PrimeInfo(33040633, 0x40fec79b, 23),
+ PrimeInfo(68513161, 0x7d605cd1, 25),
+ PrimeInfo(142069021, 0xf1da390b, 27),
+ PrimeInfo(294594427, 0x74a2507d, 27),
+ PrimeInfo(733045421, 0x5dbec447, 28),
+};
+
+template <typename Key, typename KeyFuncs, typename Value, typename Behavior>
+PrimeInfo SimplerHashTable<Key,KeyFuncs,Value,Behavior>::NextPrime(unsigned number)
+{
+ for (int i = 0; i < (int) (sizeof(primeInfo) / sizeof(primeInfo[0])); i++) {
+ if (primeInfo[i].prime >= number)
+ return primeInfo[i];
+ }
+
+ // overflow
+ Behavior::NoMemory();
+}
+
+#endif // _SIMPLERHASHTABLE_INL_
diff --git a/src/inc/slist.h b/src/inc/slist.h
new file mode 100644
index 0000000000..2b81f9ba90
--- /dev/null
+++ b/src/inc/slist.h
@@ -0,0 +1,387 @@
+// 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.
+//-----------------------------------------------------------------------------
+// @File: slist.h
+//
+
+//
+// @commn: Bunch of utility classes
+//
+// HISTORY:
+// 02/03/98: created helper classes
+// SLink, link node for singly linked list, every class that is intrusively
+// linked should have a data member of this type
+// SList, template linked list class, contains only inline
+// methods for fast list operations, with proper type checking
+//
+// see below for futher info. on how to use these template classes
+//
+//-----------------------------------------------------------------------------
+
+//#ifndef _H_UTIL
+//#error I am a part of util.hpp Please don't include me alone !
+//#endif
+
+
+#ifndef _H_SLIST_
+#define _H_SLIST_
+
+//------------------------------------------------------------------
+// struct SLink, to use a singly linked list
+// have a data member m_Link of type SLink in your class
+// and instantiate the template SList class
+//--------------------------------------------------------------------
+
+struct SLink;
+typedef DPTR(struct SLink) PTR_SLink;
+
+struct SLink
+{
+ PTR_SLink m_pNext;
+ SLink()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_pNext = NULL;
+ }
+
+ void InsertAfter(SLink* pLinkToInsert)
+ {
+ LIMITED_METHOD_CONTRACT;
+ PRECONDITION_MSG(NULL == pLinkToInsert->m_pNext, "This method does not support inserting lists");
+
+ PTR_SLink pTemp = m_pNext;
+
+ m_pNext = PTR_SLink(pLinkToInsert);
+ pLinkToInsert->m_pNext = pTemp;
+ }
+
+ // find pLink within the list starting at pHead
+ // if found remove the link from the list and return the link
+ // otherwise return NULL
+ static SLink* FindAndRemove(SLink *pHead, SLink* pLink, SLink ** ppPrior)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ _ASSERTE(pHead != NULL);
+ _ASSERTE(pLink != NULL);
+
+ SLink* pFreeLink = NULL;
+ *ppPrior = NULL;
+
+ while (pHead->m_pNext != NULL)
+ {
+ if (pHead->m_pNext == pLink)
+ {
+ pFreeLink = pLink;
+ pHead->m_pNext = pLink->m_pNext;
+ *ppPrior = pHead;
+ break;
+ }
+ pHead = pHead->m_pNext;
+ }
+
+ return pFreeLink;
+ }
+};
+
+//------------------------------------------------------------------
+// class SList. Intrusive singly linked list.
+//
+// To use SList with the default instantiation, your class should
+// define a data member of type SLink and named 'm_Link'. To use a
+// different field name, you need to provide an explicit LinkPtr
+// template argument. For example:
+// 'SList<MyClass, false, MyClass*, &MyClass::m_FieldName>'
+//
+// SList has two different behaviours depending on boolean
+// fHead variable,
+//
+// if fHead is true, then the list allows only InsertHead operations
+// if fHead is false, then the list allows only InsertTail operations
+// the code is optimized to perform these operations
+// all methods are inline, and conditional compiled based on template
+// argument 'fHead'
+// so there is no actual code size increase
+//--------------------------------------------------------------
+template <class T, bool fHead = false, typename __PTR = T*, SLink T::*LinkPtr = &T::m_Link>
+class SList
+{
+public:
+ // typedef used by the Queue class below
+ typedef T ENTRY_TYPE;
+
+protected:
+
+ // used as sentinel
+ SLink m_link; // slink.m_pNext == Null
+ PTR_SLink m_pHead;
+ PTR_SLink m_pTail;
+
+ // get the list node within the object
+ static SLink* GetLink (T* pLink)
+ {
+ LIMITED_METHOD_DAC_CONTRACT;
+ return &(pLink->*LinkPtr);
+ }
+
+ // move to the beginning of the object given the pointer within the object
+ static T* GetObject (SLink* pLink)
+ {
+ LIMITED_METHOD_DAC_CONTRACT;
+ if (pLink == NULL)
+ {
+ return NULL;
+ }
+ else
+ {
+#ifdef __GNUC__
+ // GCC defines offsetof to be __builtin_offsetof, which doesn't use the
+ // old-school memory model trick to determine offset.
+ const UINT_PTR offset = (((UINT_PTR)&(((T *)0x1000)->*LinkPtr))-0x1000);
+ return (T*)__PTR(dac_cast<TADDR>(pLink) - offset);
+#else
+ return (T*)__PTR(dac_cast<TADDR>(pLink) - offsetof(T, *LinkPtr));
+#endif // __GNUC__
+ }
+ }
+
+public:
+
+ SList()
+ {
+ WRAPPER_NO_CONTRACT;
+#ifndef DACCESS_COMPILE
+ Init();
+#endif // !defined(DACCESS_COMPILE)
+ }
+
+ void Init()
+ {
+ LIMITED_METHOD_CONTRACT;
+ m_pHead = &m_link;
+ // NOTE :: fHead variable is template argument
+ // the following code is a compiled in, only if the fHead flag
+ // is set to false,
+ if (!fHead)
+ {
+ m_pTail = &m_link;
+ }
+ }
+
+ bool IsEmpty()
+ {
+ LIMITED_METHOD_CONTRACT;
+ return m_pHead->m_pNext == NULL;
+ }
+
+#ifndef DACCESS_COMPILE
+
+ void InsertTail(T *pObj)
+ {
+ LIMITED_METHOD_CONTRACT;
+ // NOTE : conditional compilation on fHead template variable
+ if (!fHead)
+ {
+ _ASSERTE(pObj != NULL);
+ SLink *pLink = GetLink(pObj);
+
+ m_pTail->m_pNext = pLink;
+ m_pTail = pLink;
+ }
+ else
+ {// you instantiated this class asking only for InsertHead operations
+ _ASSERTE(0);
+ }
+ }
+
+ void InsertHead(T *pObj)
+ {
+ LIMITED_METHOD_CONTRACT;
+ // NOTE : conditional compilation on fHead template variable
+ if (fHead)
+ {
+ _ASSERTE(pObj != NULL);
+ SLink *pLink = GetLink(pObj);
+
+ pLink->m_pNext = m_pHead->m_pNext;
+ m_pHead->m_pNext = pLink;
+ }
+ else
+ {// you instantiated this class asking only for InsertTail operations
+ _ASSERTE(0);
+ }
+ }
+
+ T* RemoveHead()
+ {
+ LIMITED_METHOD_CONTRACT;
+ SLink* pLink = m_pHead->m_pNext;
+ if (pLink != NULL)
+ {
+ m_pHead->m_pNext = pLink->m_pNext;
+ }
+ // conditionally compiled, if the instantiated class
+ // uses Insert Tail operations
+ if (!fHead)
+ {
+ if(m_pTail == pLink)
+ {
+ m_pTail = m_pHead;
+ }
+ }
+
+ return GetObject(pLink);
+ }
+
+#endif // !DACCESS_COMPILE
+
+ T* GetHead()
+ {
+ WRAPPER_NO_CONTRACT;
+ return GetObject(m_pHead->m_pNext);
+ }
+
+ T* GetTail()
+ {
+ WRAPPER_NO_CONTRACT;
+
+ // conditional compile
+ if (fHead)
+ { // you instantiated this class asking only for InsertHead operations
+ // you need to walk the list yourself to find the tail
+ _ASSERTE(0);
+ }
+ return (m_pHead != m_pTail) ? GetObject(m_pTail) : NULL;
+ }
+
+ static T *GetNext(T *pObj)
+ {
+ WRAPPER_NO_CONTRACT;
+
+ _ASSERTE(pObj != NULL);
+ return GetObject(GetLink(pObj)->m_pNext);
+ }
+
+ T* FindAndRemove(T *pObj)
+ {
+ WRAPPER_NO_CONTRACT;
+
+ _ASSERTE(pObj != NULL);
+
+ SLink *prior;
+ SLink *ret = SLink::FindAndRemove(m_pHead, GetLink(pObj), &prior);
+
+ if (ret == m_pTail)
+ m_pTail = prior;
+
+ return GetObject(ret);
+ }
+
+ class Iterator
+ {
+ friend class SList;
+
+ public:
+ Iterator & operator++()
+ { _ASSERTE(m_cur != NULL); m_cur = SList::GetNext(m_cur); return *this; }
+
+ Iterator operator++(int)
+ { Iterator it(m_cur); ++(*this); return it; }
+
+ bool operator==(Iterator const & other) const
+ {
+ return m_cur == other.m_cur ||
+ (m_cur != NULL && other.m_cur != NULL && *m_cur == *other.m_cur);
+ }
+
+ bool operator!=(Iterator const & other) const
+ { return !(*this == other); }
+
+ T & operator*()
+ { _ASSERTE(m_cur != NULL); return *m_cur; }
+
+ T * operator->() const
+ { return m_cur; }
+
+ private:
+ Iterator(SList * pList)
+ : m_cur(pList->GetHead())
+ { }
+
+ Iterator(T* pObj)
+ : m_cur(pObj)
+ { }
+
+ Iterator()
+ : m_cur(NULL)
+ { }
+
+ T* m_cur;
+ };
+
+ Iterator begin()
+ { return Iterator(GetHead()); }
+
+ Iterator end()
+ { return Iterator(); }
+};
+
+template <typename ElemT>
+struct SListElem
+{
+ SLink m_Link;
+ ElemT m_Value;
+
+ operator ElemT const &() const
+ { return m_Value; }
+
+ operator ElemT &()
+ { return m_Value; }
+
+ ElemT const & operator*() const
+ { return m_Value; }
+
+ ElemT & operator*()
+ { return m_Value; }
+
+ ElemT const & GetValue() const
+ { return m_Value; }
+
+ ElemT & GetValue()
+ { return m_Value; }
+
+ SListElem()
+ : m_Link()
+ , m_Value()
+ { }
+
+ template <typename T1>
+ SListElem(T1&& val)
+ : m_Link()
+ , m_Value(std::forward<T1>(val))
+ { }
+
+ template <typename T1, typename T2>
+ SListElem(T1&& val1, T2&& val2)
+ : m_Link()
+ , m_Value(std::forward<T1>(val1), std::forward<T2>(val2))
+ { }
+
+ template <typename T1, typename T2, typename T3>
+ SListElem(T1&& val1, T2&& val2, T3&& val3)
+ : m_Link()
+ , m_Value(std::forward<T1>(val1), std::forward<T2>(val2), std::forward<T3>(val3))
+ { }
+
+ template <typename T1, typename T2, typename T3, typename T4>
+ SListElem(T1&& val1, T2&& val2, T3&& val3, T4&& val4)
+ : m_Link()
+ , m_Value(std::forward<T1>(val1), std::forward<T2>(val2), std::forward<T3>(val3), std::forward<T4>(val4))
+ { }
+};
+
+#endif // _H_SLIST_
+
+// End of file: list.h
diff --git a/src/inc/sortversioning.h b/src/inc/sortversioning.h
new file mode 100644
index 0000000000..7bc01c67f2
--- /dev/null
+++ b/src/inc/sortversioning.h
@@ -0,0 +1,207 @@
+// 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.
+////////////////////////////////////////////////////////////////////////////
+//
+// File: SortVersioning.h
+//
+
+
+// Purpose: Provides access of the sort versioning functionality on
+// downlevel (pre-Win7) machines.
+//
+////////////////////////////////////////////////////////////////////////////
+
+namespace SortVersioning
+{
+ // Helpers for the sorting library
+ typedef struct sorting_handle SORTHANDLE, *PSORTHANDLE;
+
+ typedef PSORTHANDLE (*SORTGETHANDLE) (
+ __in LPCWSTR lpLocaleName,
+ __in_opt CONST NLSVERSIONINFO * lpVersionInformation,
+ __in_opt DWORD dwFlags );
+
+ typedef void (*SORTCLOSEHANDLE) (
+ __in PSORTHANDLE pSortHandle );
+
+ typedef int (*SORTGETSORTKEY) (
+ __in PSORTHANDLE pSortHandle,
+ __in DWORD dwFlags,
+ __in_ecount(cchSrc) LPCWSTR pSrc,
+ __in int cchSrc,
+ __out_bcount_opt(cbDest) LPBYTE pDest,
+ __in int cbDest,
+ __reserved LPVOID lpReserved,
+ __reserved LPARAM lParam);
+
+ typedef int (*SORTCHANGECASE) (
+ __in PSORTHANDLE pSortHandle,
+ __in DWORD dwFlags,
+ __in_ecount(cchSrc) LPCWSTR pSrc,
+ __in int cchSrc,
+ __out_ecount_opt(cchDest) LPWSTR pDest,
+ __in int cchDest,
+ __reserved LPVOID lpReserved,
+ __reserved LPARAM lParam);
+
+ typedef int (*SORTCOMPARESTRING) (
+ __in PSORTHANDLE pSortHandle,
+ __in DWORD dwCmpFlags,
+ __in LPCWSTR lpString1,
+ __in int cchCount1,
+ __in LPCWSTR lpString2,
+ __in int cchCount2,
+ __reserved LPVOID lpReserved,
+ __reserved LPARAM lParam);
+
+ typedef int (*SORTFINDSTRING) (
+ __in PSORTHANDLE pSortHandle,
+ __in DWORD dwFindNLSStringFlags,
+ __in_ecount(cchSource) LPCWSTR lpStringSource,
+ __in int cchSource,
+ __in_ecount(cchValue) LPCWSTR lpStringValue,
+ __in int cchValue,
+ __out_opt LPINT pcchFound,
+ __reserved LPVOID lpReserved,
+ __reserved LPARAM lParam);
+
+ typedef BOOL (*SORTISDEFINEDSTRING) (
+ __in PSORTHANDLE pSortHandle,
+ __in NLS_FUNCTION Function,
+ __in DWORD dwFlags,
+ __in_ecount(cchStr) LPCWSTR lpString,
+ __in INT cchStr);
+
+ typedef int (*SORTGETHASHCODE) (
+ __in PSORTHANDLE pSortHandle,
+ __in DWORD dwFlags,
+ __in_ecount(cchSrc) LPCWSTR pSrc,
+ __in int cchSrc,
+ __reserved LPVOID lpReserved,
+ __reserved LPARAM lParam);
+
+#define SORT_NAME_SIZE 85
+
+ // NOTE: This needs to stay in sync with the sorting dll's handle declaration
+ typedef struct sorting_handle
+ {
+ DWORD dwSHVersion; // Sort handle version
+ struct sorting_handle *pNext; // next for when it gets stuck in a hash table
+ __nullterminated WCHAR sortName[SORT_NAME_SIZE]; // Name of this sort
+ DWORD dwDefinedVersion; // Defined Version # for this node
+ DWORD dwNLSVersion; // NLS Version # for this node
+ SORTGETSORTKEY pSortGetSortKey; // Pointer to GetSortKey function
+ SORTCHANGECASE pSortChangeCase; // Pointer to ChangeCase function
+ SORTCOMPARESTRING pSortCompareString; // Pointer to CompareString function
+ SORTFINDSTRING pSortFindString; // Pointer to FindString function
+ SORTISDEFINEDSTRING pSortIsDefinedString; // Pointer to IsDefinedString function
+ SORTGETHASHCODE pSortGetHashCode; // Pointer to GetHashCode function (v2)
+ } SORTHANDLE, *PSORTHANDLE; // Pointer to our sort handle
+
+ BOOL IsAvailableVersion(__in_opt CONST NLSVERSIONINFO * pVersion);
+
+ DWORD SortNLSVersion();
+
+ SORTGETHANDLE GetSortGetHandle(__in DWORD dwVersion);
+
+ PSORTHANDLE GetSortHandle(__in LPCWSTR lpLocaleName, __in_opt CONST NLSVERSIONINFO * pVersion);
+
+ int SortCompareString(__in LPCWSTR lpLocaleName,
+ __in DWORD dwCmpFlags,
+ __in_ecount(cchCount1) LPCWSTR lpString1,
+ __in int cchCount1,
+ __in_ecount(cchCount2) LPCWSTR lpString2,
+ __in int cchCount2,
+ __in_opt CONST NLSVERSIONINFO * lpVersionInformation,
+ __reserved LPVOID lpReserved,
+ __reserved LPARAM lParam );
+ __success(return != 0) int WINAPI SortDllCompareString(
+ __in PSORTHANDLE pSort,
+ __in DWORD dwCmpFlags,
+ __in_ecount(cchCount1) LPCWSTR lpString1,
+ __in int cchCount1,
+ __in_ecount(cchCount2) LPCWSTR lpString2,
+ __in int cchCount2,
+ __in_opt LPVOID lpReserved,
+ __in_opt LPARAM lParam);
+
+ __success(return != 0) int
+ LCMapStringEx (__in LPCWSTR lpLocaleName,
+ __in DWORD dwMapFlags,
+ __in_ecount(cchSrc) LPCWSTR lpSrcStr,
+ __in int cchSrc,
+ __out_ecount_opt(cchDest) LPWSTR lpDestStr, // really this should be __out_awcount_opt(dwMapFlags & LCMAP_SORTKEY, cchDest)
+ __in int cchDest,
+ __in_opt CONST NLSVERSIONINFO * lpVersionInformation,
+ __reserved LPVOID lpReserved,
+ __reserved LPARAM lParam );
+
+ __success(return != 0) int SortDllChangeCase(
+ __in PSORTHANDLE pSort,
+ __in DWORD dwFlags,
+ __in_ecount(cchSrc) LPCWSTR pSrc,
+ __in int cchSrc,
+ __out_ecount_opt(cchDest) LPWSTR pDest,
+ __in int cchDest,
+ __in_opt LPVOID lpReserved,
+ __in_opt LPARAM lParam );
+
+ __success(return != 0) int SortDllGetSortKey(
+ __in PSORTHANDLE pSort,
+ __in DWORD dwFlags,
+ __in_ecount(cchSrc) LPCWSTR pSrc,
+ __in int cchSrc,
+ __out_bcount_opt(cbDest) LPBYTE pDest,
+ __in int cbDest,
+ __in_opt LPVOID lpReserved,
+ __in_opt LPARAM lParam );
+
+ int SortFindString(__in LPCWSTR lpLocaleName,
+ __in DWORD dwFindNLSStringFlags,
+ __in_ecount(cchSource) LPCWSTR lpStringSource,
+ __in int cchSource,
+ __in_ecount(cchValue) LPCWSTR lpStringValue,
+ __in int cchValue,
+ __out_opt LPINT pcchFound,
+ __in_opt CONST NLSVERSIONINFO * lpVersionInformation,
+ __reserved LPVOID lpReserved,
+ __reserved LPARAM lParam);
+
+ __success(return != 0) int SortDllFindString(
+ __in PSORTHANDLE pSort,
+ __in DWORD dwFindNLSStringFlags,
+ __in_ecount(cchSource) LPCWSTR lpStringSource,
+ __in int cchSource,
+ __in_ecount(cchValue) LPCWSTR lpStringValue,
+ __in int cchValue,
+ __out_opt LPINT pcchFound,
+ __in_opt LPVOID lpReserved,
+ __in_opt LPARAM lParam);
+
+ BOOL SortIsDefinedString(__in NLS_FUNCTION Function,
+ __in DWORD dwFlags,
+ __in_opt CONST NLSVERSIONINFOEX * lpVersionInfo,
+ __in LPCWSTR lpString,
+ __in int cchStr );
+
+ BOOL SortGetNLSVersion(__in PSORTHANDLE pSort,
+ __in NLS_FUNCTION Function,
+ __inout NLSVERSIONINFO * lpVersionInformation );
+
+ BOOL WINAPI SortDllIsDefinedString(
+ __in PSORTHANDLE pSort,
+ __in NLS_FUNCTION Function,
+ __in DWORD dwFlags,
+ __in_ecount(cchStr) LPCWSTR lpString,
+ __in INT cchStr);
+
+ __success(return != 0) int SortDllGetHashCode(
+ __in PSORTHANDLE pSort,
+ __in DWORD dwFlags,
+ __in_ecount(cchSrc) LPCWSTR pSrc,
+ __in int cchSrc,
+ __in_opt LPVOID lpReserved,
+ __in_opt LPARAM lParam );
+
+}
diff --git a/src/inc/sospriv.idl b/src/inc/sospriv.idl
new file mode 100644
index 0000000000..1f9028c8e1
--- /dev/null
+++ b/src/inc/sospriv.idl
@@ -0,0 +1,359 @@
+// 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.
+/*****************************************************************************
+ ** **
+ ** sospriv.idl - The private interface that SOS uses to query the runtime **
+ ** for internal data. **
+ ** **
+ *****************************************************************************/
+import "unknwn.idl";
+
+import "xclrdata.idl";
+
+struct DacpSyncBlockCleanupData;
+struct DacpThreadStoreData;
+struct DacpAppDomainStoreData;
+struct DacpAppDomainData;
+struct DacpAssemblyData;
+struct DacpThreadData;
+struct DacpMethodDescData;
+struct DacpCodeHeaderData;
+struct DacpThreadpoolData;
+struct DacpObjectData;
+struct DacpWorkRequestData;
+struct DacpMethodTableData;
+struct DacpWorkRequestData;
+struct DacpModuleData;
+struct DacpGcHeapData;
+struct DacpJitManagerInfo;
+struct DacpHeapSegmentData;
+struct DacpDomainLocalModuleData;
+struct DacpDomainLocalModuleData;
+struct DACEHInfo;
+struct DacpRCWData;
+struct DacpAllocData;
+struct DacpGenerationAllocData;
+struct DacpExceptionObjectData;
+cpp_quote("#if 0")
+typedef ULONG64 CLRDATA_ADDRESS;
+typedef int CONTEXT;
+typedef int T_CONTEXT;
+typedef int mdToken;
+typedef unsigned int size_t;
+typedef int ModuleMapType;
+typedef int VCSHeapType;
+cpp_quote("#endif")
+
+
+cpp_quote("typedef enum ModuleMapType { TYPEDEFTOMETHODTABLE, TYPEREFTOMETHODTABLE };")
+cpp_quote("typedef enum VCSHeapType {IndcellHeap, LookupHeap, ResolveHeap, DispatchHeap, CacheEntryHeap};")
+
+typedef void (*MODULEMAPTRAVERSE)(UINT index, CLRDATA_ADDRESS methodTable,LPVOID token);
+typedef void (*VISITHEAP)(CLRDATA_ADDRESS blockData,size_t blockSize,BOOL blockIsCurrentBlock);
+
+typedef BOOL (*VISITRCWFORCLEANUP)(CLRDATA_ADDRESS RCW,CLRDATA_ADDRESS Context,CLRDATA_ADDRESS Thread,
+ BOOL bIsFreeThreaded, LPVOID token);
+typedef BOOL (*DUMPEHINFO)(UINT clauseIndex,UINT totalClauses, struct DACEHInfo *pEHInfo,LPVOID token);
+
+cpp_quote("#ifndef _SOS_HandleData")
+cpp_quote("#define _SOS_HandleData")
+
+typedef struct _SOSHandleData
+{
+ CLRDATA_ADDRESS AppDomain;
+ CLRDATA_ADDRESS Handle;
+ CLRDATA_ADDRESS Secondary;
+ unsigned int Type;
+ BOOL StrongReference;
+
+ // For RefCounted Handles
+ unsigned int RefCount;
+ unsigned int JupiterRefCount;
+ BOOL IsPegged;
+} SOSHandleData;
+
+cpp_quote("#endif //HandleData")
+
+[
+ object,
+ local,
+ uuid(286CA186-E763-4F61-9760-487D43AE4341)
+]
+interface ISOSEnum : IUnknown
+{
+ HRESULT Skip([in] unsigned int count);
+ HRESULT Reset();
+ HRESULT GetCount([out] unsigned int *pCount);
+}
+
+
+[
+ object,
+ local,
+ uuid(3E269830-4A2B-4301-8EE2-D6805B29B2FA)
+]
+interface ISOSHandleEnum : ISOSEnum
+{
+ HRESULT Next([in] unsigned int count,
+ [out, size_is(count), length_is(*pNeeded)] SOSHandleData handles[],
+ [out] unsigned int *pNeeded);
+}
+
+cpp_quote("#ifndef _SOS_StackReference_")
+cpp_quote("#define _SOS_StackReference_")
+
+typedef enum SOSStackSourceType
+{
+ SOS_StackSourceIP, // Instuction pointer in managed code
+ SOS_StackSourceFrame, // clr!Frame
+} SOSStackSourceType;
+
+typedef enum SOSRefFlags
+{
+ SOSRefInterior = 1,
+ SOSRefPinned = 2
+} SOSRefFlags;
+
+typedef struct _SOS_StackRefData
+{
+ BOOL HasRegisterInformation;
+ int Register;
+ int Offset;
+ CLRDATA_ADDRESS Address;
+ CLRDATA_ADDRESS Object;
+ unsigned int Flags;
+
+ SOSStackSourceType SourceType;
+ CLRDATA_ADDRESS Source;
+ CLRDATA_ADDRESS StackPointer;
+} SOSStackRefData;
+
+/* Informs the user that we were unable to process the given clr!Frame or
+ * managed frame.
+ */
+typedef struct _SOS_StackRefError
+{
+ SOSStackSourceType SourceType;
+ CLRDATA_ADDRESS Source;
+ CLRDATA_ADDRESS StackPointer;
+} SOSStackRefError;
+
+cpp_quote("#endif // _SOS_StackReference_")
+
+[
+ object,
+ local,
+ uuid(774F4E1B-FB7B-491B-976D-A8130FE355E9)
+]
+interface ISOSStackRefErrorEnum : ISOSEnum
+{
+ HRESULT Next([in] unsigned int count,
+ [out, size_is(count), length_is(*pFetched)] SOSStackRefError ref[],
+ [out] unsigned int *pFetched);
+}
+
+[
+ object,
+ local,
+ uuid(8FA642BD-9F10-4799-9AA3-512AE78C77EE)
+]
+interface ISOSStackRefEnum : ISOSEnum
+{
+ HRESULT Next([in] unsigned int count,
+ [out, size_is(count), length_is(*pFetched)] SOSStackRefData ref[],
+ [out] unsigned int *pFetched);
+
+
+ /* Reports all frames which we could not enumerate gc references for.
+ */
+ HRESULT EnumerateErrors([out] ISOSStackRefErrorEnum **ppEnum);
+}
+
+
+[
+ object,
+ local,
+ uuid(436f00f2-b42a-4b9f-870c-e73db66ae930)
+]
+interface ISOSDacInterface : IUnknown
+{
+ // ThreadStore
+ HRESULT GetThreadStoreData(struct DacpThreadStoreData *data);
+
+ // AppDomains
+ HRESULT GetAppDomainStoreData(struct DacpAppDomainStoreData *data);
+ HRESULT GetAppDomainList(unsigned int count, CLRDATA_ADDRESS values[], unsigned int *pNeeded);
+ HRESULT GetAppDomainData(CLRDATA_ADDRESS addr, struct DacpAppDomainData *data);
+ HRESULT GetAppDomainName(CLRDATA_ADDRESS addr, unsigned int count, WCHAR *name, unsigned int *pNeeded);
+ HRESULT GetDomainFromContext(CLRDATA_ADDRESS context, CLRDATA_ADDRESS *domain);
+
+ // Assemblies
+ HRESULT GetAssemblyList(CLRDATA_ADDRESS appDomain, int count, CLRDATA_ADDRESS values[], int *pNeeded);
+ HRESULT GetAssemblyData(CLRDATA_ADDRESS baseDomainPtr, CLRDATA_ADDRESS assembly, struct DacpAssemblyData *data);
+ HRESULT GetAssemblyName(CLRDATA_ADDRESS assembly, unsigned int count, WCHAR *name, unsigned int *pNeeded);
+
+ // Modules
+ HRESULT GetModule(CLRDATA_ADDRESS addr, IXCLRDataModule **mod);
+ HRESULT GetModuleData(CLRDATA_ADDRESS moduleAddr, struct DacpModuleData *data);
+ HRESULT TraverseModuleMap(ModuleMapType mmt, CLRDATA_ADDRESS moduleAddr, MODULEMAPTRAVERSE pCallback, LPVOID token);
+ HRESULT GetAssemblyModuleList(CLRDATA_ADDRESS assembly, unsigned int count, CLRDATA_ADDRESS modules[], unsigned int *pNeeded);
+ HRESULT GetILForModule(CLRDATA_ADDRESS moduleAddr, DWORD rva, CLRDATA_ADDRESS *il);
+
+ // Threads
+ HRESULT GetThreadData(CLRDATA_ADDRESS thread, struct DacpThreadData *data);
+ HRESULT GetThreadFromThinlockID(UINT thinLockId, CLRDATA_ADDRESS *pThread);
+ HRESULT GetStackLimits(CLRDATA_ADDRESS threadPtr, CLRDATA_ADDRESS *lower, CLRDATA_ADDRESS *upper, CLRDATA_ADDRESS *fp);
+
+ // MethodDescs
+ HRESULT GetMethodDescData(CLRDATA_ADDRESS methodDesc, CLRDATA_ADDRESS ip, struct DacpMethodDescData *data, ULONG cRevertedRejitVersions, struct DacpReJitData * rgRevertedRejitData, ULONG * pcNeededRevertedRejitData);
+ HRESULT GetMethodDescPtrFromIP(CLRDATA_ADDRESS ip, CLRDATA_ADDRESS * ppMD);
+ HRESULT GetMethodDescName(CLRDATA_ADDRESS methodDesc, unsigned int count, WCHAR *name, unsigned int *pNeeded);
+ HRESULT GetMethodDescPtrFromFrame(CLRDATA_ADDRESS frameAddr, CLRDATA_ADDRESS * ppMD);
+ HRESULT GetMethodDescFromToken(CLRDATA_ADDRESS moduleAddr, mdToken token, CLRDATA_ADDRESS *methodDesc);
+ HRESULT GetMethodDescTransparencyData(CLRDATA_ADDRESS methodDesc, struct DacpMethodDescTransparencyData *data);
+
+ // JIT Data
+ HRESULT GetCodeHeaderData(CLRDATA_ADDRESS ip, struct DacpCodeHeaderData *data);
+ HRESULT GetJitManagerList(unsigned int count, struct DacpJitManagerInfo *managers, unsigned int *pNeeded);
+ HRESULT GetJitHelperFunctionName(CLRDATA_ADDRESS ip, unsigned int count, char *name, unsigned int *pNeeded);
+ HRESULT GetJumpThunkTarget(T_CONTEXT *ctx, CLRDATA_ADDRESS *targetIP, CLRDATA_ADDRESS *targetMD);
+
+ // ThreadPool
+ HRESULT GetThreadpoolData(struct DacpThreadpoolData *data);
+ HRESULT GetWorkRequestData(CLRDATA_ADDRESS addrWorkRequest, struct DacpWorkRequestData *data);
+ HRESULT GetHillClimbingLogEntry(CLRDATA_ADDRESS addr, struct DacpHillClimbingLogEntry *data);
+
+ // Objects
+ HRESULT GetObjectData(CLRDATA_ADDRESS objAddr, struct DacpObjectData *data);
+ HRESULT GetObjectStringData(CLRDATA_ADDRESS obj, unsigned int count, WCHAR *stringData, unsigned int *pNeeded);
+ HRESULT GetObjectClassName(CLRDATA_ADDRESS obj, unsigned int count, WCHAR *className, unsigned int *pNeeded);
+
+ // MethodTable
+ HRESULT GetMethodTableName(CLRDATA_ADDRESS mt, unsigned int count, WCHAR *mtName, unsigned int *pNeeded);
+ HRESULT GetMethodTableData(CLRDATA_ADDRESS mt, struct DacpMethodTableData *data);
+ HRESULT GetMethodTableSlot(CLRDATA_ADDRESS mt, unsigned int slot, CLRDATA_ADDRESS *value);
+ HRESULT GetMethodTableFieldData(CLRDATA_ADDRESS mt, struct DacpMethodTableFieldData *data);
+ HRESULT GetMethodTableTransparencyData(CLRDATA_ADDRESS mt, struct DacpMethodTableTransparencyData *data);
+
+ // EEClass
+ HRESULT GetMethodTableForEEClass(CLRDATA_ADDRESS eeClass, CLRDATA_ADDRESS *value);
+
+ // FieldDesc
+ HRESULT GetFieldDescData(CLRDATA_ADDRESS fieldDesc, struct DacpFieldDescData *data);
+
+ // Frames
+ HRESULT GetFrameName(CLRDATA_ADDRESS vtable, unsigned int count, WCHAR *frameName, unsigned int *pNeeded);
+
+
+ // PEFiles
+ HRESULT GetPEFileBase(CLRDATA_ADDRESS addr, CLRDATA_ADDRESS *base);
+ HRESULT GetPEFileName(CLRDATA_ADDRESS addr, unsigned int count, WCHAR *fileName, unsigned int *pNeeded);
+
+ // GC
+ HRESULT GetGCHeapData(struct DacpGcHeapData *data);
+ HRESULT GetGCHeapList(unsigned int count, CLRDATA_ADDRESS heaps[], unsigned int *pNeeded); // svr only
+ HRESULT GetGCHeapDetails(CLRDATA_ADDRESS heap, struct DacpGcHeapDetails *details); // wks only
+ HRESULT GetGCHeapStaticData(struct DacpGcHeapDetails *data);
+ HRESULT GetHeapSegmentData(CLRDATA_ADDRESS seg, struct DacpHeapSegmentData *data);
+ HRESULT GetOOMData(CLRDATA_ADDRESS oomAddr, struct DacpOomData *data);
+ HRESULT GetOOMStaticData(struct DacpOomData *data);
+ HRESULT GetHeapAnalyzeData(CLRDATA_ADDRESS addr, struct DacpGcHeapAnalyzeData *data);
+ HRESULT GetHeapAnalyzeStaticData(struct DacpGcHeapAnalyzeData *data);
+
+ // DomainLocal
+ HRESULT GetDomainLocalModuleData(CLRDATA_ADDRESS addr, struct DacpDomainLocalModuleData *data);
+ HRESULT GetDomainLocalModuleDataFromAppDomain(CLRDATA_ADDRESS appDomainAddr, int moduleID, struct DacpDomainLocalModuleData *data);
+ HRESULT GetDomainLocalModuleDataFromModule(CLRDATA_ADDRESS moduleAddr, struct DacpDomainLocalModuleData *data);
+
+ // ThreadLocal
+ HRESULT GetThreadLocalModuleData(CLRDATA_ADDRESS thread, unsigned int index, struct DacpThreadLocalModuleData *data);
+
+ // SyncBlock
+ HRESULT GetSyncBlockData(unsigned int number, struct DacpSyncBlockData *data);
+ HRESULT GetSyncBlockCleanupData(CLRDATA_ADDRESS addr, struct DacpSyncBlockCleanupData *data);
+
+ // Handles
+ HRESULT GetHandleEnum(ISOSHandleEnum **ppHandleEnum);
+ HRESULT GetHandleEnumForTypes(unsigned int types[], unsigned int count, ISOSHandleEnum **ppHandleEnum);
+ HRESULT GetHandleEnumForGC(unsigned int gen, ISOSHandleEnum **ppHandleEnum);
+
+ // EH
+ HRESULT TraverseEHInfo(CLRDATA_ADDRESS ip, DUMPEHINFO pCallback, LPVOID token);
+ HRESULT GetNestedExceptionData(CLRDATA_ADDRESS exception, CLRDATA_ADDRESS *exceptionObject, CLRDATA_ADDRESS *nextNestedException);
+
+ // StressLog
+ HRESULT GetStressLogAddress(CLRDATA_ADDRESS *stressLog);
+
+ // Heaps
+ HRESULT TraverseLoaderHeap(CLRDATA_ADDRESS loaderHeapAddr, VISITHEAP pCallback);
+ HRESULT GetCodeHeapList(CLRDATA_ADDRESS jitManager, unsigned int count, struct DacpJitCodeHeapInfo *codeHeaps, unsigned int *pNeeded);
+ HRESULT TraverseVirtCallStubHeap(CLRDATA_ADDRESS pAppDomain, VCSHeapType heaptype, VISITHEAP pCallback);
+
+ // Other
+ HRESULT GetUsefulGlobals(struct DacpUsefulGlobalsData *data);
+ HRESULT GetClrWatsonBuckets(CLRDATA_ADDRESS thread, void *pGenericModeBlock);
+ HRESULT GetTLSIndex(ULONG *pIndex);
+ HRESULT GetDacModuleHandle(HMODULE *phModule);
+
+ // COM
+ HRESULT GetRCWData(CLRDATA_ADDRESS addr, struct DacpRCWData *data);
+ HRESULT GetRCWInterfaces(CLRDATA_ADDRESS rcw, unsigned int count, struct DacpCOMInterfacePointerData *interfaces, unsigned int *pNeeded);
+ HRESULT GetCCWData(CLRDATA_ADDRESS ccw, struct DacpCCWData *data);
+ HRESULT GetCCWInterfaces(CLRDATA_ADDRESS ccw, unsigned int count, struct DacpCOMInterfacePointerData *interfaces, unsigned int *pNeeded);
+ HRESULT TraverseRCWCleanupList(CLRDATA_ADDRESS cleanupListPtr, VISITRCWFORCLEANUP pCallback, LPVOID token);
+
+ // GC Reference Functions
+
+ /* GetStackReferences
+ * Enumerates all references on a given callstack.
+ */
+ HRESULT GetStackReferences([in] DWORD osThreadID, [out] ISOSStackRefEnum **ppEnum);
+ HRESULT GetRegisterName([in] int regName, [in] unsigned int count, [out] WCHAR *buffer, [out] unsigned int *pNeeded);
+
+ HRESULT GetThreadAllocData(CLRDATA_ADDRESS thread, struct DacpAllocData *data);
+ HRESULT GetHeapAllocData(unsigned int count, struct DacpGenerationAllocData *data, unsigned int *pNeeded);
+
+ // For BindingDisplay plugin
+ HRESULT GetFailedAssemblyList(CLRDATA_ADDRESS appDomain, int count, CLRDATA_ADDRESS values[], unsigned int *pNeeded);
+ HRESULT GetPrivateBinPaths(CLRDATA_ADDRESS appDomain, int count, WCHAR *paths, unsigned int *pNeeded);
+ HRESULT GetAssemblyLocation(CLRDATA_ADDRESS assembly, int count, WCHAR *location, unsigned int *pNeeded);
+ HRESULT GetAppDomainConfigFile(CLRDATA_ADDRESS appDomain, int count, WCHAR *configFile, unsigned int *pNeeded);
+ HRESULT GetApplicationBase(CLRDATA_ADDRESS appDomain, int count, WCHAR *base, unsigned int *pNeeded);
+ HRESULT GetFailedAssemblyData(CLRDATA_ADDRESS assembly, unsigned int *pContext, HRESULT *pResult);
+ HRESULT GetFailedAssemblyLocation(CLRDATA_ADDRESS assesmbly, unsigned int count, WCHAR *location, unsigned int *pNeeded);
+ HRESULT GetFailedAssemblyDisplayName(CLRDATA_ADDRESS assembly, unsigned int count, WCHAR *name, unsigned int *pNeeded);
+};
+
+[
+ object,
+ local,
+ uuid(A16026EC-96F4-40BA-87FB-5575986FB7AF)
+]
+interface ISOSDacInterface2 : IUnknown
+{
+ HRESULT GetObjectExceptionData(CLRDATA_ADDRESS objAddr, struct DacpExceptionObjectData *data);
+ HRESULT IsRCWDCOMProxy(CLRDATA_ADDRESS rcwAddr, BOOL* isDCOMProxy);
+};
+
+[
+ object,
+ local,
+ uuid(B08C5CDC-FD8A-49C5-AB38-5FEEF35235B4)
+]
+interface ISOSDacInterface3 : IUnknown
+{
+ HRESULT GetGCInterestingInfoData(CLRDATA_ADDRESS interestingInfoAddr, struct DacpGCInterestingInfoData *data);
+ HRESULT GetGCInterestingInfoStaticData(struct DacpGCInterestingInfoData *data);
+ HRESULT GetGCGlobalMechanisms(size_t* globalMechanisms);
+};
+
+[
+ object,
+ local,
+ uuid(74B9D34C-A612-4B07-93DD-5462178FCE11)
+]
+interface ISOSDacInterface4 : IUnknown
+{
+ HRESULT GetClrNotification(CLRDATA_ADDRESS arguments[], int count, int *pNeeded);
+}; \ No newline at end of file
diff --git a/src/inc/sstring.h b/src/inc/sstring.h
new file mode 100644
index 0000000000..bfbaa81429
--- /dev/null
+++ b/src/inc/sstring.h
@@ -0,0 +1,1084 @@
+// 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.
+// ---------------------------------------------------------------------------
+// SString.h (Safe String)
+//
+
+// ---------------------------------------------------------------------------
+
+// ------------------------------------------------------------------------------------------
+// SString is the "standard" string representation for the EE. Its has two purposes.
+// (1) it provides an easy-to-use, relatively efficient, string class for APIs to standardize
+// on.
+// (2) it completely encapsulates all "unsafe" string operations - that is, string operations
+// which yield possible buffer overrun bugs. Typesafe use of this API should help guarantee
+// safety.
+//
+// A SString is conceptually unicode, although the internal conversion might be delayed as long as possible
+// Basically it's up to the implementation whether conversion takes place immediately or is delayed, and if
+// delayed, what operations trigger the conversion.
+//
+// Note that anywhere you express a "position" in a string, it is in terms of the Unicode representation of the
+// string.
+//
+// If you need a direct non-unicode representation, you will have to provide a fresh SString which can
+// recieve a conversion operation if necessary.
+//
+// The alternate encodings available are:
+// 1. ASCII - string consisting entirely of ASCII (7 bit) characters. This is the only 1 byte encoding
+// guaranteed to be fixed width. Such a string is also a valid instance of all the other 1 byte string
+// representations, and we take advantage of this fact.
+// 2. UTF-8 - standard multibyte unicode encoding.
+// 3. ANSI - Potentially multibyte encoding using the ANSI page determined by GetACP().
+//
+// @todo: Note that we could also provide support for several other cases (but currently do not.)
+// - Page specified by GetOEMCP() (OEM page)
+// - Arbitrary page support
+//
+// @todo: argument & overflow/underflow checking needs to be added
+// ------------------------------------------------------------------------------------------
+
+
+#ifndef _SSTRING_H_
+#define _SSTRING_H_
+
+#include "utilcode.h"
+#include "sbuffer.h"
+
+// ==========================================================================================
+// Documentational typedefs: use these to indicate specific representations of 8 bit strings:
+// ==========================================================================================
+
+// Note that LPCSTR means ASCII (7-bit) only!
+
+typedef CHAR ASCII;
+typedef ASCII *LPASCII;
+typedef const ASCII *LPCASCII;
+
+typedef CHAR ANSI;
+typedef ANSI *LPANSI;
+typedef const ANSI *LPCANSI;
+
+typedef CHAR UTF8;
+typedef UTF8 *LPUTF8;
+typedef const UTF8 *LPCUTF8;
+
+// ==========================================================================================
+// SString is the base class for safe strings.
+// ==========================================================================================
+
+
+typedef DPTR(class SString) PTR_SString;
+class SString : private SBuffer
+{
+ friend struct _DacGlobals;
+
+private:
+ enum Representation
+ {
+ // Note: bits are meaningful: xVS V == Variable? S == Single byte width?
+ REPRESENTATION_EMPTY = 0x00, // 000
+ REPRESENTATION_UNICODE = 0x04, // 100
+ REPRESENTATION_ASCII = 0x01, // 001
+ REPRESENTATION_UTF8 = 0x03, // 011
+ REPRESENTATION_ANSI = 0x07, // 111
+
+ REPRESENTATION_VARIABLE_MASK = 0x02,
+ REPRESENTATION_SINGLE_MASK = 0x01,
+ REPRESENTATION_MASK = 0x07,
+ };
+
+ // Minimum guess for Printf buffer size
+ const static COUNT_T MINIMUM_GUESS = 20;
+
+
+#ifdef _DEBUG
+ // Used to have a public ctor of this form - made it too easy to lose
+ // utf8 info by accident. Now you have to specify the representation type
+ // explicitly - this privator ctor prevents reinsertion of this ctor.
+ explicit SString(const ASCII *)
+ {
+ _ASSERTE(!"Don't call this.");
+ }
+#endif
+
+ protected:
+ class Index;
+ class UIndex;
+
+ friend class Index;
+ friend class UIndex;
+
+ public:
+
+ // UIterator is character-level assignable.
+ class UIterator;
+
+ // CIterators/Iterator'string must be modified by SString APIs.
+ class CIterator;
+ class Iterator;
+
+ // Tokens for constructor overloads
+ enum tagUTF8Literal { Utf8Literal };
+ enum tagLiteral { Literal };
+ enum tagUTF8 { Utf8 };
+ enum tagANSI { Ansi };
+ enum tagASCII {Ascii };
+#ifdef SSTRING_CONSOLECODEPAGE
+ enum tagCONSOLE { Console };
+#endif
+
+ static void Startup();
+ static CHECK CheckStartup();
+
+ static const SString &Empty();
+
+ SString();
+
+ explicit SString(const SString &s);
+
+ SString(const SString &s1, const SString &s2);
+ SString(const SString &s1, const SString &s2, const SString &s3);
+ SString(const SString &s1, const SString &s2, const SString &s3, const SString &s4);
+ SString(const SString &s, const CIterator &i, COUNT_T length);
+ SString(const SString &s, const CIterator &start, const CIterator &end);
+ SString(const WCHAR *string);
+ SString(const WCHAR *string, COUNT_T count);
+ SString(enum tagASCII dummyTag, const ASCII *string);
+ SString(enum tagASCII dummyTag, const ASCII *string, COUNT_T count);
+ SString(enum tagUTF8 dummytag, const UTF8 *string);
+ SString(enum tagUTF8 dummytag, const UTF8 *string, COUNT_T count);
+ SString(enum tagANSI dummytag, const ANSI *string);
+ SString(enum tagANSI dummytag, const ANSI *string, COUNT_T count);
+#ifdef SSTRING_CONSOLECODEPAGE
+ SString(enum tagCONSOLE dummytag, const CONSOLE *string);
+ SString(enum tagCONSOLE dummytag, const CONSOLE *string, COUNT_T count);
+#endif
+ SString(WCHAR character);
+
+ // NOTE: Literals MUST be read-only never-freed strings.
+ SString(enum tagLiteral dummytag, const CHAR *literal);
+ SString(enum tagUTF8Literal dummytag, const UTF8 *literal);
+ SString(enum tagLiteral dummytag, const WCHAR *literal);
+ SString(enum tagLiteral dummytag, const WCHAR *literal, COUNT_T count);
+
+ // Set this string to the concatenation of s1,s2,s3,s4
+ void Set(const SString &s);
+ void Set(const SString &s1, const SString &s2);
+ void Set(const SString &s1, const SString &s2, const SString &s3);
+ void Set(const SString &s1, const SString &s2, const SString &s3, const SString &s4);
+
+ // Set this string to the substring of s, starting at i, of length characters.
+ void Set(const SString &s, const CIterator &i, COUNT_T length);
+
+ // Set this string to the substring of s, starting at start and ending at end (exclusive)
+ void Set(const SString &s, const CIterator &start, const CIterator &end);
+
+ // Set this string to a copy of the given string
+ void Set(const WCHAR *string);
+ void SetASCII(const ASCII *string);
+ void SetUTF8(const UTF8 *string);
+ void SetANSI(const ANSI *string);
+#ifdef SSTRING_CONSOLECODEPAGE
+ void SetConsole(const CONSOLE *string);
+#endif
+
+ // Set this string to a copy of the first count chars of the given string
+ void Set(const WCHAR *string, COUNT_T count);
+
+ // Set this string to a prellocated copy of a given string.
+ // The caller is the owner of the bufffer and has to coordinate its lifetime.
+ void SetPreallocated(const WCHAR *string, COUNT_T count);
+
+ void SetASCII(const ASCII *string, COUNT_T count);
+
+ void SetUTF8(const UTF8 *string, COUNT_T count);
+ void SetANSI(const ANSI *string, COUNT_T count);
+#ifdef SSTRING_CONSOLECODEPAGE
+ void SetConsole(const CONSOLE *string, COUNT_T count);
+#endif
+
+ // Set this string to the unicode character
+ void Set(WCHAR character);
+
+ // Set this string to the UTF8 character
+ void SetUTF8(CHAR character);
+
+ // This this string to the given literal. We share the mem and don't make a copy.
+ void SetLiteral(const CHAR *literal);
+ void SetLiteral(const WCHAR *literal);
+
+ // ------------------------------------------------------------------
+ // Public operations
+ // ------------------------------------------------------------------
+
+ // Normalizes the string representation to unicode. This can be used to
+ // make basic read-only operations non-failing.
+ void Normalize() const;
+
+ // Return the number of characters in the string (excluding the terminating NULL).
+ COUNT_T GetCount() const;
+ BOOL IsEmpty() const;
+
+ // Return whether a single byte string has all characters which fit in the ASCII set.
+ // (Note that this will return FALSE if the string has been converted to unicode for any
+ // reason.)
+ BOOL IsASCII() const;
+
+ // !!!!!!!!!!!!!! WARNING about case insensitive operations !!!!!!!!!!!!!!!
+ //
+ // THIS IS NOT SUPPORTED FULLY ON WIN9x
+ // SString case-insensitive comparison is based off LCMapString,
+ // which does not work on characters outside the current OS code page.
+ //
+ // Case insensitive code in SString is primarily targeted at
+ // supporting path comparisons, which is supported correctly on 9x,
+ // since file system names are limited to the OS code page.
+ //
+ // !!!!!!!!!!!!!! WARNING about case insensitive operations !!!!!!!!!!!!!!!
+
+ // Compute a content-based hash value
+ ULONG Hash() const;
+ ULONG HashCaseInsensitive() const;
+ ULONG HashCaseInsensitive(LocaleID locale) const;
+
+ // Do a string comparison. Return 0 if the strings
+ // have the same value, -1 if this is "less than" s, or 1 if
+ // this is "greater than" s.
+ int Compare(const SString &s) const;
+ int CompareCaseInsensitive(const SString &s) const; // invariant locale
+ int CompareCaseInsensitive(const SString &s, LocaleID locale) const;
+
+ // Do a case sensitive string comparison. Return TRUE if the strings
+ // have the same value FALSE if not.
+ BOOL Equals(const SString &s) const;
+ BOOL EqualsCaseInsensitive(const SString &s) const; // invariant locale
+ BOOL EqualsCaseInsensitive(const SString &s, LocaleID locale) const;
+
+ // Match s to a portion of the string starting at the position.
+ // Return TRUE if the strings have the same value
+ // (regardless of representation), FALSE if not.
+ BOOL Match(const CIterator &i, const SString &s) const;
+ BOOL MatchCaseInsensitive(const CIterator &i, const SString &s) const; // invariant locale
+ BOOL MatchCaseInsensitive(const CIterator &i, const SString &s, LocaleID locale) const;
+
+ BOOL Match(const CIterator &i, WCHAR c) const;
+ BOOL MatchCaseInsensitive(const CIterator &i, WCHAR c) const; // invariant locale
+ BOOL MatchCaseInsensitive(const CIterator &i, WCHAR c, LocaleID locale) const;
+
+ // Like match, but advances the iterator past the match
+ // if successful
+ BOOL Skip(CIterator &i, const SString &s) const;
+ BOOL Skip(CIterator &i, WCHAR c) const;
+
+ // Start searching for a match of the given string, starting at
+ // the given iterator point.
+ // If a match exists, move the iterator to point to the nearest
+ // occurence of s in the string and return TRUE.
+ // If no match exists, return FALSE and leave the iterator unchanged.
+ BOOL Find(CIterator &i, const SString &s) const;
+ BOOL Find(CIterator &i, const WCHAR *s) const;
+ BOOL FindASCII(CIterator &i, const ASCII *s) const;
+ BOOL FindUTF8(CIterator &i, const UTF8 *s) const;
+ BOOL Find(CIterator &i, WCHAR c) const;
+
+ BOOL FindBack(CIterator &i, const SString &s) const;
+ BOOL FindBack(CIterator &i, const WCHAR *s) const;
+ BOOL FindBackASCII(CIterator &i, const ASCII *s) const;
+ BOOL FindBackUTF8(CIterator &i, const UTF8 *s) const;
+ BOOL FindBack(CIterator &i, WCHAR c) const;
+
+ // Returns TRUE if this string begins with the contents of s
+ BOOL BeginsWith(const SString &s) const;
+ BOOL BeginsWithCaseInsensitive(const SString &s) const; // invariant locale
+ BOOL BeginsWithCaseInsensitive(const SString &s, LocaleID locale) const;
+
+ // Returns TRUE if this string ends with the contents of s
+ BOOL EndsWith(const SString &s) const;
+ BOOL EndsWithCaseInsensitive(const SString &s) const; // invariant locale
+ BOOL EndsWithCaseInsensitive(const SString &s, LocaleID locale) const;
+
+ // Sets this string to an empty string "".
+ void Clear();
+
+ // Truncate the string to the iterator position
+ void Truncate(const Iterator &i);
+
+ // Append s to the end of this string.
+ void Append(const SString &s);
+ void Append(const WCHAR *s);
+ void AppendASCII(const CHAR *s);
+ void AppendUTF8(const CHAR *s);
+
+ // Append char c to the end of this string.
+ void Append(const WCHAR c);
+ void AppendUTF8(const CHAR c);
+
+ // Insert s into this string at the 'position'th character.
+ void Insert(const Iterator &i, const SString &s);
+ void Insert(const Iterator &i, const WCHAR *s);
+ void InsertASCII(const Iterator &i, const CHAR *s);
+ void InsertUTF8(const Iterator &i, const CHAR *s);
+
+ // Delete substring position + length
+ void Delete(const Iterator &i, COUNT_T length);
+
+ // Replace character at i with c
+ void Replace(const Iterator &i, WCHAR c);
+
+ // Replace substring at (i,i+length) with s
+ void Replace(const Iterator &i, COUNT_T length, const SString &s);
+
+ // Make sure that string buffer has room to grow
+ void Preallocate(COUNT_T characters) const;
+
+ // Shrink buffer size as much as possible (reallocate if necessary.)
+ void Trim() const;
+
+ // ------------------------------------------------------------------
+ // Iterators:
+ // ------------------------------------------------------------------
+
+ // SString splits iterators into two categories.
+ //
+ // CIterator and Iterator are cheap to create, but allow only read-only
+ // access to the string.
+ //
+ // UIterator forces a unicode conversion, but allows
+ // assignment to individual string characters. They are also a bit more
+ // efficient once created.
+
+ // ------------------------------------------------------------------
+ // UIterator:
+ // ------------------------------------------------------------------
+
+ protected:
+
+ class UIndex : public SBuffer::Index
+ {
+ friend class SString;
+ friend class Indexer<WCHAR, UIterator>;
+
+ protected:
+
+ UIndex();
+ UIndex(SString *string, SCOUNT_T index);
+ WCHAR &GetAt(SCOUNT_T delta) const;
+ void Skip(SCOUNT_T delta);
+ SCOUNT_T Subtract(const UIndex &i) const;
+ CHECK DoCheck(SCOUNT_T delta) const;
+
+ WCHAR *GetUnicode() const;
+ };
+
+ public:
+
+ class UIterator : public UIndex, public Indexer<WCHAR, UIterator>
+ {
+ friend class SString;
+
+ public:
+ UIterator()
+ {
+ }
+
+ UIterator(SString *string, int index)
+ : UIndex(string, index)
+ {
+ }
+ };
+
+ UIterator BeginUnicode();
+ UIterator EndUnicode();
+
+ // For CIterator & Iterator, we try our best to iterate the string without
+ // modifying it. (Currently, we do require an ASCII or Unicode string
+ // for simple WCHAR retrival, but you could imagine being more flexible
+ // going forward - perhaps even supporting iterating multibyte encodings
+ // directly.)
+ //
+ // Because of the runtime-changable nature of the string, CIterators
+ // require an extra member to record the character size. They also
+ // are unable to properly implement GetAt as required by the template
+ // (since there may not be a direct WCHAR pointer), so they provide
+ // further customization in a subclass.
+ //
+ // Normally the user expects to cast Iterators to CIterators transparently, so
+ // we provide a constructor on CIterator to support this.
+
+ protected:
+
+ class Index : public SBuffer::Index
+ {
+ friend class SString;
+
+ friend class Indexer<const WCHAR, CIterator>;
+ friend class Indexer<WCHAR, Iterator>;
+
+ protected:
+ int m_characterSizeShift;
+
+ Index();
+ Index(SString *string, SCOUNT_T index);
+ BYTE &GetAt(SCOUNT_T delta) const;
+ void Skip(SCOUNT_T delta);
+ SCOUNT_T Subtract(const Index &i) const;
+ CHECK DoCheck(SCOUNT_T delta) const;
+
+ void Resync(const SString *string, BYTE *ptr) const;
+
+ const WCHAR *GetUnicode() const;
+ const CHAR *GetASCII() const;
+
+ public:
+ // Note these should supercede the Indexer versions
+ // since this class comes first in the inheritence list
+ WCHAR operator*() const;
+ void operator->() const;
+ WCHAR operator[](int index) const;
+ };
+
+ public:
+
+ class CIterator : public Index, public Indexer<const WCHAR, CIterator>
+ {
+ friend class SString;
+
+ public:
+ const Iterator &ConstCast() const
+ {
+ return *(const Iterator *)this;
+ }
+
+ Iterator &ConstCast()
+ {
+ return *(Iterator *)this;
+ }
+
+ operator const SBuffer::CIterator &() const
+ {
+ return *(const SBuffer::CIterator *)this;
+ }
+
+ operator SBuffer::CIterator &()
+ {
+ return *(SBuffer::CIterator *)this;
+ }
+
+ CIterator()
+ {
+ }
+
+ CIterator(const SString *string, int index)
+ : Index(const_cast<SString *>(string), index)
+ {
+ }
+
+ // explicitly resolve these for gcc
+ WCHAR operator*() const { return Index::operator*(); }
+ void operator->() const { Index::operator->(); }
+ WCHAR operator[](int index) const { return Index::operator[](index); }
+ };
+
+ class Iterator : public Index, public Indexer<WCHAR, Iterator>
+ {
+ friend class SString;
+
+ public:
+ operator const CIterator &() const
+ {
+ return *(const CIterator *)this;
+ }
+
+ operator CIterator &()
+ {
+ return *(CIterator *)this;
+ }
+
+ operator const SBuffer::Iterator &() const
+ {
+ return *(const SBuffer::Iterator *)this;
+ }
+
+ operator SBuffer::Iterator &()
+ {
+ return *(SBuffer::Iterator *)this;
+ }
+
+ Iterator()
+ {
+ }
+
+ Iterator(SString *string, int index)
+ : Index(string, index)
+ {
+ SUPPORTS_DAC;
+ }
+
+ // explicitly resolve these for gcc
+ WCHAR operator*() const { return Index::operator*(); }
+ void operator->() const { Index::operator->(); }
+ WCHAR operator[](int index) const { return Index::operator[](index); }
+ };
+
+ CIterator Begin() const;
+ CIterator End() const;
+
+ Iterator Begin();
+ Iterator End();
+
+ // ------------------------------------------------------------------
+ // Conversion:
+ // ------------------------------------------------------------------
+
+ // Get a const pointer to the string in the current representation.
+ // This pointer can not be cached because it will become invalid if
+ // the SString changes representation or reallocates its buffer.
+
+ // You can always get a unicode string. This will force a conversion
+ // if necessary.
+ const WCHAR *GetUnicode() const;
+ const WCHAR *GetUnicode(const CIterator &i) const;
+
+ void LowerCase();
+ void UpperCase();
+
+ // Helper function to convert string in-place to lower-case (no allocation overhead for SString instance)
+ static void LowerCase(__inout_z LPWSTR wszString);
+
+ // These routines will use the given scratch string if necessary
+ // to perform a conversion to the desired representation
+
+ // Use a local declaration of InlineScratchBuffer or StackScratchBuffer for parameters of
+ // AbstractScratchBuffer.
+ class AbstractScratchBuffer;
+
+ // These routines will use the given scratch buffer if necessary
+ // to perform a conversion to the desired representation. Note that
+ // the lifetime of the pointer return is limited by BOTH the
+ // scratch string and the source (this) string.
+ //
+ // Typical usage:
+ //
+ // SString *s = ...;
+ // {
+ // StackScratchBuffer buffer;
+ // const UTF8 *utf8 = s->GetUTF8(buffer);
+ // CallFoo(utf8);
+ // }
+ // // No more pointers to returned buffer allowed.
+
+ const UTF8 *GetUTF8(AbstractScratchBuffer &scratch) const;
+ const UTF8 *GetUTF8(AbstractScratchBuffer &scratch, COUNT_T *pcbUtf8) const;
+ const ANSI *GetANSI(AbstractScratchBuffer &scratch) const;
+#ifdef SSTRING_CONSOLECODEPAGE
+ const CONSOLE *GetConsole(AbstractScratchBuffer &scratch) const;
+#endif
+
+ // Used when the representation is known, throws if the representation doesn't match
+ const UTF8 *GetUTF8NoConvert() const;
+
+ // Converts/copies into the given output string
+ void ConvertToUnicode(SString &dest) const;
+ void ConvertToANSI(SString &dest) const;
+ COUNT_T ConvertToUTF8(SString &dest) const;
+#ifdef SSTRING_CONSOLECODEPAGE
+ void ConvertToConsole(SString &dest) const;
+#endif
+
+ //-------------------------------------------------------------------
+ // Accessing the string contents directly
+ //-------------------------------------------------------------------
+
+ // To write directly to the SString's underlying buffer:
+ // 1) Call OpenXXXBuffer() and pass it the count of characters
+ // you need. (Not including the null-terminator).
+ // 2) That returns a pointer to the raw buffer which you can write to.
+ // 3) When you are done writing to the pointer, call CloseBuffer()
+ // and pass it the count of characters you actually wrote (not including
+ // the null). The pointer from step 1 is now invalid.
+
+ // example usage:
+ // void GetName(SString & str) {
+ // char * p = str.OpenANSIBuffer(3);
+ // strcpy(p, "Cat");
+ // str.CloseBuffer();
+ // }
+
+ // Regarding the null-terminator:
+ // 1) Note that we wrote 4 characters (3 + a null). That's ok. OpenBuffer
+ // allocates 1 extra byte for the null.
+ // 2) If we only wrote 3 characters and no null, that's ok too. CloseBuffer()
+ // will add a null-terminator.
+
+ // You should open the buffer, write the data, and immediately close it.
+ // No sstring operations are valid while the buffer is opened.
+ //
+ // In a debug build, Open/Close will do lots of little checks to make sure
+ // you don't buffer overflow while it's opened. In a retail build, this
+ // is a very streamlined action.
+
+
+ // Open the raw buffer for writing countChars characters (not including the null).
+ WCHAR *OpenUnicodeBuffer(COUNT_T maxCharCount);
+ UTF8 *OpenUTF8Buffer(COUNT_T maxSingleCharCount);
+ ANSI *OpenANSIBuffer(COUNT_T maxSingleCharCount);
+
+ //Returns the unicode string, the caller is reponsible for lifetime of the string
+ WCHAR *GetCopyOfUnicodeString();
+
+ // Get the max size that can be passed to OpenUnicodeBuffer without causing allocations.
+ COUNT_T GetUnicodeAllocation();
+
+ // Call after OpenXXXBuffer().
+
+ // Provide the count of characters actually used (not including the
+ // null terminator). This will make sure the SString's size is correct
+ // and that we have a null-terminator.
+ void CloseBuffer(COUNT_T finalCount);
+
+ // Close the buffer. Assumes that we completely filled the buffer
+ // that OpenBuffer() gave back. If we didn't write all the characters,
+ // call CloseBuffer(int) instead.
+ void CloseBuffer();
+
+#ifdef DACCESS_COMPILE
+ // DAC access to string functions.
+ // Note that other accessors above are not DAC-safe and will return TARGET pointers into
+ // the string instead of copying the string over to the host.
+ // @dbgtodo dac support: Prevent usage of such DAC-unsafe SString APIs in DAC code
+
+ // Instantiate a copy of the raw buffer in the host and return a pointer to it
+ void * DacGetRawContent() const;
+
+ // Instantiate a copy of the raw buffer in the host. Requires that the underlying
+ // representation is already unicode.
+ const WCHAR * DacGetRawUnicode() const;
+
+ // Copy the string from the target into the provided buffer, converting to unicode if necessary
+ bool DacGetUnicode(COUNT_T bufChars,
+ __out_z __inout_ecount(bufChars) WCHAR * buffer,
+ COUNT_T * needChars) const;
+
+ void EnumMemoryRegions(CLRDataEnumMemoryFlags flags) const
+ {
+ SUPPORTS_DAC;
+ SBuffer::EnumMemoryRegions(flags);
+ }
+#endif
+
+ //---------------------------------------------------------------------
+ // Utilities
+ //---------------------------------------------------------------------
+
+ // WARNING: The MBCS version of printf function are factory for globalization
+ // issues when used to format Unicode strings (%S). The Unicode versions are
+ // preffered in this case.
+ void Printf(const CHAR *format, ...);
+ void VPrintf(const CHAR *format, va_list args);
+
+ void Printf(const WCHAR *format, ...);
+ void PPrintf(const WCHAR *format, ...);
+ void VPrintf(const WCHAR *format, va_list args);
+
+ void PVPrintf(const WCHAR *format, va_list args);
+
+ void AppendPrintf(const CHAR *format, ...);
+ void AppendVPrintf(const CHAR *format, va_list args);
+
+ void AppendPrintf(const WCHAR *format, ...);
+ void AppendVPrintf(const WCHAR *format, va_list args);
+
+ BOOL LoadResource(CCompRC::ResourceCategory eCategory, int resourceID);
+ HRESULT LoadResourceAndReturnHR(CCompRC::ResourceCategory eCategory, int resourceID);
+ HRESULT LoadResourceAndReturnHR(CCompRC* pResourceDLL, CCompRC::ResourceCategory eCategory, int resourceID);
+ BOOL FormatMessage(DWORD dwFlags, LPCVOID lpSource, DWORD dwMessageId, DWORD dwLanguageId,
+ const SString &arg1 = Empty(), const SString &arg2 = Empty(),
+ const SString &arg3 = Empty(), const SString &arg4 = Empty(),
+ const SString &arg5 = Empty(), const SString &arg6 = Empty(),
+ const SString &arg7 = Empty(), const SString &arg8 = Empty(),
+ const SString &arg9 = Empty(), const SString &arg10 = Empty());
+
+#if 1
+ // @todo - get rid of this and move it outside of SString
+ void MakeFullNamespacePath(const SString &nameSpace, const SString &name);
+#endif
+
+ //--------------------------------------------------------------------
+ // Operators
+ //--------------------------------------------------------------------
+
+ operator const WCHAR * () const { WRAPPER_NO_CONTRACT; return GetUnicode(); }
+
+ WCHAR operator[](int index) { WRAPPER_NO_CONTRACT; return Begin()[index]; }
+ WCHAR operator[](int index) const { WRAPPER_NO_CONTRACT; return Begin()[index]; }
+
+ SString &operator= (const SString &s) { WRAPPER_NO_CONTRACT; Set(s); return *this; }
+ SString &operator+= (const SString &s) { WRAPPER_NO_CONTRACT; Append(s); return *this; }
+
+ // -------------------------------------------------------------------
+ // Check functions
+ // -------------------------------------------------------------------
+
+ CHECK CheckIteratorRange(const CIterator &i) const;
+ CHECK CheckIteratorRange(const CIterator &i, COUNT_T length) const;
+ CHECK CheckEmpty() const;
+
+ static CHECK CheckCount(COUNT_T count);
+ static CHECK CheckRepresentation(int representation);
+
+#if CHECK_INVARIANTS
+ static CHECK CheckASCIIString(const ASCII *string);
+ static CHECK CheckASCIIString(const ASCII *string, COUNT_T count);
+
+ CHECK Check() const;
+ CHECK Invariant() const;
+ CHECK InternalInvariant() const;
+#endif // CHECK_INVARIANTS
+
+ // Helpers for CRT function equivalance.
+ static int __cdecl _stricmp(const CHAR *buffer1, const CHAR *buffer2);
+ static int __cdecl _strnicmp(const CHAR *buffer1, const CHAR *buffer2, COUNT_T count);
+
+ static int __cdecl _wcsicmp(const WCHAR *buffer1, const WCHAR *buffer2);
+ static int __cdecl _wcsnicmp(const WCHAR *buffer1, const WCHAR *buffer2, COUNT_T count);
+
+ // C++ convenience overloads
+ static int _tstricmp(const CHAR *buffer1, const CHAR *buffer2);
+ static int _tstricmp(const WCHAR *buffer1, const WCHAR *buffer2);
+
+ static int _tstrnicmp(const CHAR *buffer1, const CHAR *buffer2, COUNT_T count);
+ static int _tstrnicmp(const WCHAR *buffer1, const WCHAR *buffer2, COUNT_T count);
+
+ // -------------------------------------------------------------------
+ // Internal routines
+ // -------------------------------------------------------------------
+
+
+ protected:
+ // Use this via InlineSString<X>
+ SString(void *buffer, COUNT_T size);
+
+ private:
+ static int CaseCompareHelperA(const CHAR *buffer1, const CHAR *buffer2, COUNT_T count, LocaleID lcid, BOOL stopOnNull, BOOL stopOnCount);
+ static int CaseCompareHelper(const WCHAR *buffer1, const WCHAR *buffer2, COUNT_T count, LocaleID lcid, BOOL stopOnNull, BOOL stopOnCount);
+
+ // Internal helpers:
+
+ static const BYTE s_EmptyBuffer[2];
+
+ static UINT s_ACP;
+ SVAL_DECL(BOOL, s_IsANSIMultibyte);
+
+#ifdef SSTRING_CONSOLECODEPAGE
+ static UINT s_ConsoleCP;
+ static BOOL s_IsConsoleMultibyte;
+#endif
+
+ const static LocaleID s_defaultLCID;
+
+ SPTR_DECL(SString,s_Empty);
+
+ COUNT_T GetRawCount() const;
+
+ // Get buffer as appropriate string rep
+ ASCII *GetRawASCII() const;
+ UTF8 *GetRawUTF8() const;
+ ANSI *GetRawANSI() const;
+ WCHAR *GetRawUnicode() const;
+#ifdef SSTRING_CONSOLECODEPAGE
+ CONSOLE *GetRawConsole() const;
+#endif
+
+ void InitEmpty();
+
+ Representation GetRepresentation() const;
+ void SetRepresentation(Representation representation);
+ BOOL IsRepresentation(Representation representation) const;
+ BOOL IsFixedSize() const;
+ BOOL IsIteratable() const;
+ BOOL IsSingleByte() const;
+
+ int GetCharacterSizeShift() const;
+
+ COUNT_T SizeToCount(COUNT_T size) const;
+ COUNT_T CountToSize(COUNT_T count) const;
+
+ COUNT_T GetBufferSizeInCharIncludeNullChar() const;
+
+ BOOL IsLiteral() const;
+ BOOL IsAllocated() const;
+ BOOL IsBufferOpen() const;
+ BOOL IsASCIIScanned() const;
+ void SetASCIIScanned() const;
+ void SetNormalized() const;
+ BOOL IsNormalized() const;
+ void ClearNormalized() const;
+
+ void EnsureWritable() const;
+ void ConvertToFixed() const;
+ void ConvertToIteratable() const;
+
+ void ConvertASCIIToUnicode(SString &dest) const;
+ void ConvertToUnicode() const;
+ void ConvertToUnicode(const CIterator &i) const;
+
+ const SString &GetCompatibleString(const SString &s, SString &scratch) const;
+ const SString &GetCompatibleString(const SString &s, SString &scratch, const CIterator &i) const;
+ BOOL ScanASCII() const;
+ void NullTerminate();
+
+ void Resize(COUNT_T count, Representation representation,
+ Preserve preserve = DONT_PRESERVE);
+
+ void OpenBuffer(Representation representation, COUNT_T countChars);
+};
+
+// ===========================================================================
+// InlineSString is used for stack allocation of strings, or when the string contents
+// are expected or known to be small. Note that it still supports expandability via
+// heap allocation if necessary.
+// ===========================================================================
+
+template <COUNT_T MEMSIZE>
+class InlineSString : public SString
+{
+private:
+ BYTE m_inline[SBUFFER_PADDED_SIZE(MEMSIZE)];
+
+public:
+ FORCEINLINE InlineSString()
+ : SString(m_inline, SBUFFER_PADDED_SIZE(MEMSIZE))
+ {
+ WRAPPER_NO_CONTRACT;
+ }
+
+ FORCEINLINE InlineSString(const SString &s)
+ : SString(m_inline, SBUFFER_PADDED_SIZE(MEMSIZE))
+ {
+ WRAPPER_NO_CONTRACT;
+ Set(s);
+ }
+
+ FORCEINLINE InlineSString(const SString &s1, const SString &s2)
+ : SString(m_inline, SBUFFER_PADDED_SIZE(MEMSIZE))
+ {
+ WRAPPER_NO_CONTRACT;
+ Set(s1, s2);
+ }
+
+ FORCEINLINE InlineSString(const SString &s1, const SString &s2, const SString &s3)
+ : SString(m_inline, SBUFFER_PADDED_SIZE(MEMSIZE))
+ {
+ WRAPPER_NO_CONTRACT;
+ Set(s1, s2, s3);
+ }
+
+ FORCEINLINE InlineSString(const SString &s1, const SString &s2, const SString &s3, const SString &s4)
+ : SString(m_inline, SBUFFER_PADDED_SIZE(MEMSIZE))
+ {
+ WRAPPER_NO_CONTRACT;
+ Set(s1, s2, s3, s4);
+ }
+
+ FORCEINLINE InlineSString(const SString &s, const CIterator &start, const CIterator &end)
+ : SString(m_inline, SBUFFER_PADDED_SIZE(MEMSIZE))
+ {
+ WRAPPER_NO_CONTRACT;
+ Set(s, start, end);
+ }
+
+ FORCEINLINE InlineSString(const SString &s, const CIterator &i, COUNT_T length)
+ : SString(m_inline, SBUFFER_PADDED_SIZE(MEMSIZE))
+ {
+ WRAPPER_NO_CONTRACT;
+ Set(s, i, length);
+ }
+
+ FORCEINLINE InlineSString(const WCHAR *string)
+ : SString(m_inline, SBUFFER_PADDED_SIZE(MEMSIZE))
+ {
+ WRAPPER_NO_CONTRACT;
+ Set(string);
+ }
+
+ FORCEINLINE InlineSString(const WCHAR *string, COUNT_T count)
+ : SString(m_inline, SBUFFER_PADDED_SIZE(MEMSIZE))
+ {
+ WRAPPER_NO_CONTRACT;
+ Set(string, count);
+ }
+
+ FORCEINLINE InlineSString(enum tagASCII, const CHAR *string)
+ : SString(m_inline, SBUFFER_PADDED_SIZE(MEMSIZE))
+ {
+ WRAPPER_NO_CONTRACT;
+ SetASCII(string);
+ }
+
+ FORCEINLINE InlineSString(enum tagASCII, const CHAR *string, COUNT_T count)
+ : SString(m_inline, SBUFFER_PADDED_SIZE(MEMSIZE))
+ {
+ WRAPPER_NO_CONTRACT;
+ SetASCII(string, count);
+ }
+
+ FORCEINLINE InlineSString(tagUTF8 dummytag, const UTF8 *string)
+ : SString(m_inline, SBUFFER_PADDED_SIZE(MEMSIZE))
+ {
+ WRAPPER_NO_CONTRACT;
+ SetUTF8(string);
+ }
+
+ FORCEINLINE InlineSString(tagUTF8 dummytag, const UTF8 *string, COUNT_T count)
+ : SString(m_inline, SBUFFER_PADDED_SIZE(MEMSIZE))
+ {
+ WRAPPER_NO_CONTRACT;
+ SetUTF8(string, count);
+ }
+
+ FORCEINLINE InlineSString(enum tagANSI dummytag, const ANSI *string)
+ : SString(m_inline, SBUFFER_PADDED_SIZE(MEMSIZE))
+ {
+ WRAPPER_NO_CONTRACT;
+ SetANSI(string);
+ }
+
+ FORCEINLINE InlineSString(enum tagANSI dummytag, const ANSI *string, COUNT_T count)
+ : SString(m_inline, SBUFFER_PADDED_SIZE(MEMSIZE))
+ {
+ WRAPPER_NO_CONTRACT;
+ SetANSI(string, count);
+ }
+
+#ifdef SSTRING_CONSOLECODEPAGE
+ FORCEINLINE InlineSString(enum tagCONSOLE dummytag, const CONSOLE *string)
+ : SString(m_inline, SBUFFER_PADDED_SIZE(MEMSIZE))
+ {
+ WRAPPER_NO_CONTRACT;
+ SetCONSOLE(string);
+ }
+
+ FORCEINLINE InlineSString(enum tagCONSOLE dummytag, const CONSOLE *string, COUNT_T count)
+ : SString(m_inline, SBUFFER_PADDED_SIZE(MEMSIZE))
+ {
+ WRAPPER_NO_CONTRACT;
+ SetCONSOLE(string, count);
+ }
+#endif
+
+ FORCEINLINE InlineSString(WCHAR character)
+ : SString(m_inline, SBUFFER_PADDED_SIZE(MEMSIZE))
+ {
+ WRAPPER_NO_CONTRACT;
+ Set(character);
+ }
+
+ FORCEINLINE InlineSString(tagUTF8 dummytag, const UTF8 character)
+ : SString(m_inline, SBUFFER_PADDED_SIZE(MEMSIZE))
+ {
+ WRAPPER_NO_CONTRACT;
+ SetUTF8(character);
+ }
+
+ FORCEINLINE InlineSString<MEMSIZE> &operator= (const SString &s)
+ {
+ WRAPPER_NO_CONTRACT;
+ Set(s);
+ return *this;
+ }
+
+ FORCEINLINE InlineSString<MEMSIZE> &operator= (const InlineSString<MEMSIZE> &s)
+ {
+ WRAPPER_NO_CONTRACT;
+ Set(s);
+ return *this;
+ }
+};
+
+// ================================================================================
+// StackSString is a lot like CQuickBytes. Use it to create an SString object
+// using some stack space as a preallocated buffer.
+// ================================================================================
+
+typedef InlineSString<512> StackSString;
+
+// This is a smaller version for when it is known that the string that's going to
+// be needed is small and it's preferable not to take up the stack space.
+typedef InlineSString<32> SmallStackSString;
+
+// To be used specifically for path strings.
+#ifdef _DEBUG
+// This is a smaller version for debug builds to exercise the buffer allocation path
+typedef InlineSString<32> PathString;
+typedef InlineSString<2 * 32> LongPathString;
+#else
+// Set it to the current MAX_PATH
+typedef InlineSString<260> PathString;
+typedef InlineSString<2 * 260> LongPathString;
+#endif
+
+// ================================================================================
+// Quick macro to create an SString around a literal string.
+// usage:
+// s = SL("My literal String");
+// ================================================================================
+
+#define SL(_literal) SString(SString::Literal, _literal)
+
+// ================================================================================
+// ScratchBuffer classes are used by the GetXXX() routines to allocate scratch space in.
+// ================================================================================
+
+class SString::AbstractScratchBuffer : private SString
+{
+ protected:
+ // Do not use this class directly - use
+ // ScratchBuffer or StackScratchBuffer.
+ AbstractScratchBuffer(void *buffer, COUNT_T size);
+};
+
+template <COUNT_T MEMSIZE>
+class ScratchBuffer : public SString::AbstractScratchBuffer
+{
+ private:
+ BYTE m_inline[MEMSIZE];
+
+ public:
+ ScratchBuffer()
+ : AbstractScratchBuffer((void *)m_inline, MEMSIZE)
+ {
+ WRAPPER_NO_CONTRACT;
+ }
+};
+
+typedef ScratchBuffer<256> StackScratchBuffer;
+
+// ================================================================================
+// Special contract definition - THROWS_UNLESS_NORMALIZED
+// this is used for operations which might fail for generalized strings but
+// not if the string has already been converted to unicode. Rather than just
+// setting this on all conversions to unicode, we only set it when explicitly
+// asked. This should expose more potential problems.
+// ================================================================================
+
+#define THROWS_UNLESS_NORMALIZED \
+ if (IsNormalized()) NOTHROW; else THROWS
+
+#define THROWS_UNLESS_BOTH_NORMALIZED(s) \
+ if (IsNormalized() && s.IsNormalized()) NOTHROW; else THROWS
+
+#define FAULTS_UNLESS_NORMALIZED(stmt) \
+ if (IsNormalized()) FORBID_FAULT; else INJECT_FAULT(stmt)
+
+#define FAULTS_UNLESS_BOTH_NORMALIZED(s, stmt) \
+ if (IsNormalized() && s.IsNormalized()) FORBID_FAULT; else INJECT_FAULT(stmt)
+
+// ================================================================================
+// Inline definitions
+// ================================================================================
+
+#include <sstring.inl>
+
+#endif // _SSTRING_H_
diff --git a/src/inc/sstring.inl b/src/inc/sstring.inl
new file mode 100644
index 0000000000..88139ad0cc
--- /dev/null
+++ b/src/inc/sstring.inl
@@ -0,0 +1,2279 @@
+// 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.
+
+//
+
+#ifndef _SSTRING_INL_
+#define _SSTRING_INL_
+
+#include "sstring.h"
+
+#if defined(_MSC_VER)
+#pragma inline_depth (20)
+#endif
+
+#ifdef _MSC_VER
+#pragma warning(push)
+#pragma warning(disable:4702) // Disable bogus unreachable code warning
+#endif // _MSC_VER
+
+//#define SSTRING_EXTRA_CHECKS
+#ifdef SSTRING_EXTRA_CHECKS
+#define SS_CONTRACT CONTRACT
+#define SS_CONTRACT_VOID CONTRACT_VOID
+#define SS_CONTRACT_END CONTRACT_END
+#define SS_RETURN RETURN
+#define SS_CONSTRUCTOR_CHECK CONSTRUCTOR_CHECK
+#define SS_PRECONDITION PRECONDITION
+#define SS_POSTCONDITION POSTCONDITION
+
+#else //SSTRING_EXTRA_CHECKS
+
+#define SS_CONTRACT(x) CONTRACTL
+#define SS_CONTRACT_VOID CONTRACTL
+#define SS_CONTRACT_END CONTRACTL_END
+#define SS_RETURN return
+#define SS_CONSTRUCTOR_CHECK
+#define SS_PRECONDITION(x)
+#define SS_POSTCONDITION(x)
+//Do I need this instance check at all?
+
+#endif
+
+
+// ---------------------------------------------------------------------------
+// Inline implementations. Pay no attention to that man behind the curtain.
+// ---------------------------------------------------------------------------
+
+//----------------------------------------------------------------------------
+// Default constructor. Sets the string to the empty string.
+//----------------------------------------------------------------------------
+inline SString::SString()
+ : SBuffer(Immutable, s_EmptyBuffer, sizeof(s_EmptyBuffer))
+{
+#ifdef SSTRING_EXTRA_CHECKS
+ CONTRACT_VOID
+ {
+ CONSTRUCTOR_CHECK;
+ POSTCONDITION(IsEmpty());
+ NOTHROW;
+ SO_TOLERANT;
+ GC_NOTRIGGER;
+ }
+ CONTRACT_END;
+
+ RETURN;
+#else
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_SO_TOLERANT;
+ STATIC_CONTRACT_GC_NOTRIGGER;
+ STATIC_CONTRACT_SUPPORTS_DAC_HOST_ONLY;
+#endif
+}
+
+inline SString::SString(void *buffer, COUNT_T size)
+ : SBuffer(Prealloc, buffer, size)
+{
+ SS_CONTRACT_VOID
+ {
+ SS_CONSTRUCTOR_CHECK;
+ PRECONDITION(CheckPointer(buffer));
+ PRECONDITION(CheckSize(size));
+ SS_POSTCONDITION(IsEmpty());
+ NOTHROW;
+ GC_NOTRIGGER;
+ SUPPORTS_DAC_HOST_ONLY;
+ }
+ SS_CONTRACT_END;
+
+ if (size < sizeof(WCHAR))
+ {
+ // Ignore the useless buffer
+ SetImmutable(s_EmptyBuffer, sizeof(s_EmptyBuffer));
+ }
+ else
+ {
+ SBuffer::TweakSize(sizeof(WCHAR));
+ GetRawUnicode()[0] = 0;
+ }
+
+ SS_RETURN;
+}
+
+inline SString::SString(const SString &s)
+ : SBuffer(Immutable, s_EmptyBuffer, sizeof(s_EmptyBuffer))
+{
+ SS_CONTRACT_VOID
+ {
+ SS_CONSTRUCTOR_CHECK;
+ PRECONDITION(s.Check());
+ SS_POSTCONDITION(Equals(s));
+ THROWS;
+ GC_NOTRIGGER;
+ }
+ SS_CONTRACT_END;
+
+ Set(s);
+
+ SS_RETURN;
+}
+
+inline SString::SString(const SString &s1, const SString &s2)
+ : SBuffer(Immutable, s_EmptyBuffer, sizeof(s_EmptyBuffer))
+{
+ SS_CONTRACT_VOID
+ {
+ SS_CONSTRUCTOR_CHECK;
+ PRECONDITION(s1.Check());
+ PRECONDITION(s2.Check());
+ THROWS;
+ GC_NOTRIGGER;
+ }
+ SS_CONTRACT_END;
+
+ Set(s1, s2);
+
+ SS_RETURN;
+}
+
+inline SString::SString(const SString &s1, const SString &s2, const SString &s3)
+ : SBuffer(Immutable, s_EmptyBuffer, sizeof(s_EmptyBuffer))
+{
+ SS_CONTRACT_VOID
+ {
+ SS_CONSTRUCTOR_CHECK;
+ PRECONDITION(s1.Check());
+ PRECONDITION(s2.Check());
+ PRECONDITION(s3.Check());
+ THROWS;
+ GC_NOTRIGGER;
+ }
+ SS_CONTRACT_END;
+
+ Set(s1, s2, s3);
+
+ SS_RETURN;
+}
+
+inline SString::SString(const SString &s1, const SString &s2, const SString &s3, const SString &s4)
+ : SBuffer(Immutable, s_EmptyBuffer, sizeof(s_EmptyBuffer))
+{
+ SS_CONTRACT_VOID
+ {
+ SS_CONSTRUCTOR_CHECK;
+ PRECONDITION(s1.Check());
+ PRECONDITION(s2.Check());
+ PRECONDITION(s3.Check());
+ PRECONDITION(s4.Check());
+ THROWS;
+ }
+ SS_CONTRACT_END;
+
+ Set(s1, s2, s3, s4);
+
+ SS_RETURN;
+}
+
+inline SString::SString(const SString &s, const CIterator &i, COUNT_T count)
+ : SBuffer(Immutable, s_EmptyBuffer, sizeof(s_EmptyBuffer))
+{
+ SS_CONTRACT_VOID
+ {
+ SS_CONSTRUCTOR_CHECK;
+ PRECONDITION(s.Check());
+ PRECONDITION(i.Check());
+ PRECONDITION(CheckCount(count));
+ SS_POSTCONDITION(s.Match(i, *this));
+ SS_POSTCONDITION(GetRawCount() == count);
+ THROWS;
+ GC_NOTRIGGER;
+ }
+ SS_CONTRACT_END;
+
+ Set(s, i, count);
+
+ SS_RETURN;
+}
+
+inline SString::SString(const SString &s, const CIterator &start, const CIterator &end)
+ : SBuffer(Immutable, s_EmptyBuffer, sizeof(s_EmptyBuffer))
+{
+ SS_CONTRACT_VOID
+ {
+ SS_CONSTRUCTOR_CHECK;
+ PRECONDITION(s.Check());
+ PRECONDITION(start.Check());
+ PRECONDITION(s.CheckIteratorRange(start));
+ PRECONDITION(end.Check());
+ PRECONDITION(s.CheckIteratorRange(end));
+ PRECONDITION(start <= end);
+ SS_POSTCONDITION(s.Match(start, *this));
+ SS_POSTCONDITION(GetRawCount() == (COUNT_T) (end - start));
+ THROWS;
+ GC_NOTRIGGER;
+ }
+ SS_CONTRACT_END;
+
+ Set(s, start, end);
+
+ SS_RETURN;
+}
+
+inline SString::SString(const WCHAR *string)
+ : SBuffer(Immutable, s_EmptyBuffer, sizeof(s_EmptyBuffer))
+{
+ SS_CONTRACT_VOID
+ {
+ SS_CONSTRUCTOR_CHECK;
+ PRECONDITION(CheckPointer(string, NULL_OK));
+ THROWS;
+ GC_NOTRIGGER;
+ }
+ SS_CONTRACT_END;
+
+ Set(string);
+
+ SS_RETURN;
+}
+
+inline SString::SString(const WCHAR *string, COUNT_T count)
+ : SBuffer(Immutable, s_EmptyBuffer, sizeof(s_EmptyBuffer))
+{
+ SS_CONTRACT_VOID
+ {
+ SS_CONSTRUCTOR_CHECK;
+ PRECONDITION(CheckPointer(string, NULL_OK));
+ PRECONDITION(CheckCount(count));
+ THROWS;
+ GC_NOTRIGGER;
+ }
+ SS_CONTRACT_END;
+
+ Set(string, count);
+
+ SS_RETURN;
+}
+
+inline SString::SString(enum tagASCII, const ASCII *string)
+ : SBuffer(Immutable, s_EmptyBuffer, sizeof(s_EmptyBuffer))
+{
+ SS_CONTRACT_VOID
+ {
+ SS_CONSTRUCTOR_CHECK;
+ PRECONDITION(CheckPointer(string, NULL_OK));
+ PRECONDITION(CheckASCIIString(string));
+ THROWS;
+ GC_NOTRIGGER;
+ }
+ SS_CONTRACT_END;
+
+ SetASCII(string);
+
+ SS_RETURN;
+}
+
+inline SString::SString(enum tagASCII, const ASCII *string, COUNT_T count)
+ : SBuffer(Immutable, s_EmptyBuffer, sizeof(s_EmptyBuffer))
+{
+ SS_CONTRACT_VOID
+ {
+ SS_CONSTRUCTOR_CHECK;
+ PRECONDITION(CheckPointer(string, NULL_OK));
+ PRECONDITION(CheckASCIIString(string, count));
+ PRECONDITION(CheckCount(count));
+ THROWS;
+ GC_NOTRIGGER;
+ }
+ SS_CONTRACT_END;
+
+ SetASCII(string, count);
+
+ SS_RETURN;
+}
+
+inline SString::SString(tagUTF8 dummytag, const UTF8 *string)
+ : SBuffer(Immutable, s_EmptyBuffer, sizeof(s_EmptyBuffer))
+{
+ SS_CONTRACT_VOID
+ {
+ SS_CONSTRUCTOR_CHECK;
+ // !!! Check for illegal UTF8 encoding?
+ PRECONDITION(CheckPointer(string, NULL_OK));
+ THROWS;
+ GC_NOTRIGGER;
+ SUPPORTS_DAC;
+ }
+ SS_CONTRACT_END;
+
+ SetUTF8(string);
+
+ SS_RETURN;
+}
+
+inline SString::SString(tagUTF8 dummytag, const UTF8 *string, COUNT_T count)
+ : SBuffer(Immutable, s_EmptyBuffer, sizeof(s_EmptyBuffer))
+{
+ SS_CONTRACT_VOID
+ {
+ SS_CONSTRUCTOR_CHECK;
+ // !!! Check for illegal UTF8 encoding?
+ PRECONDITION(CheckPointer(string, NULL_OK));
+ PRECONDITION(CheckCount(count));
+ THROWS;
+ GC_NOTRIGGER;
+ }
+ SS_CONTRACT_END;
+
+ SetUTF8(string, count);
+
+ SS_RETURN;
+}
+
+inline SString::SString(tagANSI dummytag, const ANSI *string)
+ : SBuffer(Immutable, s_EmptyBuffer, sizeof(s_EmptyBuffer))
+{
+ SS_CONTRACT_VOID
+ {
+ SS_CONSTRUCTOR_CHECK;
+ PRECONDITION(CheckPointer(string, NULL_OK));
+ THROWS;
+ GC_NOTRIGGER;
+ }
+ SS_CONTRACT_END;
+
+ SetANSI(string);
+
+ SS_RETURN;
+}
+
+inline SString::SString(tagANSI dummytag, const ANSI *string, COUNT_T count)
+ : SBuffer(Immutable, s_EmptyBuffer, sizeof(s_EmptyBuffer))
+{
+ SS_CONTRACT_VOID
+ {
+ SS_CONSTRUCTOR_CHECK;
+ PRECONDITION(CheckPointer(string, NULL_OK));
+ PRECONDITION(CheckCount(count));
+ THROWS;
+ GC_NOTRIGGER;
+ }
+ SS_CONTRACT_END;
+
+ SetANSI(string, count);
+
+ SS_RETURN;
+}
+
+inline SString::SString(WCHAR character)
+ : SBuffer(Immutable, s_EmptyBuffer, sizeof(s_EmptyBuffer))
+{
+ SS_CONTRACT_VOID
+ {
+ SS_CONSTRUCTOR_CHECK;
+ THROWS;
+ GC_NOTRIGGER;
+ }
+ SS_CONTRACT_END;
+
+ Set(character);
+
+ SS_RETURN;
+}
+
+inline SString::SString(tagLiteral dummytag, const ASCII *literal)
+ : SBuffer(Immutable, (const BYTE *) literal, (COUNT_T) (strlen(literal)+1)*sizeof(CHAR))
+{
+ SS_CONTRACT_VOID
+ {
+ SS_CONSTRUCTOR_CHECK;
+ PRECONDITION(CheckPointer(literal));
+ PRECONDITION(CheckASCIIString(literal));
+ NOTHROW;
+ GC_NOTRIGGER;
+ SUPPORTS_DAC_HOST_ONLY;
+ }
+ SS_CONTRACT_END;
+
+ SetRepresentation(REPRESENTATION_ASCII);
+
+ SS_RETURN;
+}
+
+inline SString::SString(tagUTF8Literal dummytag, const UTF8 *literal)
+ : SBuffer(Immutable, (const BYTE *) literal, (COUNT_T) (strlen(literal)+1)*sizeof(CHAR))
+{
+ SS_CONTRACT_VOID
+ {
+ SS_CONSTRUCTOR_CHECK;
+ PRECONDITION(CheckPointer(literal));
+ NOTHROW;
+ GC_NOTRIGGER;
+ }
+ SS_CONTRACT_END;
+
+ SetRepresentation(REPRESENTATION_UTF8);
+
+ SS_RETURN;
+}
+
+inline SString::SString(tagLiteral dummytag, const WCHAR *literal)
+ : SBuffer(Immutable, (const BYTE *) literal, (COUNT_T) (wcslen(literal)+1)*sizeof(WCHAR))
+{
+ SS_CONTRACT_VOID
+ {
+ SS_CONSTRUCTOR_CHECK;
+ PRECONDITION(CheckPointer(literal));
+ NOTHROW;
+ GC_NOTRIGGER;
+ }
+ SS_CONTRACT_END;
+
+ SetRepresentation(REPRESENTATION_UNICODE);
+ SetNormalized();
+
+ SS_RETURN;
+}
+
+inline SString::SString(tagLiteral dummytag, const WCHAR *literal, COUNT_T count)
+ : SBuffer(Immutable, (const BYTE *) literal, (count + 1) * sizeof(WCHAR))
+{
+ SS_CONTRACT_VOID
+ {
+ SS_CONSTRUCTOR_CHECK;
+ PRECONDITION(CheckPointer(literal));
+ NOTHROW;
+ GC_NOTRIGGER;
+ }
+ SS_CONTRACT_END;
+
+ SetRepresentation(REPRESENTATION_UNICODE);
+ SetNormalized();
+
+ SS_RETURN;
+}
+
+//-----------------------------------------------------------------------------
+// Set this string to s
+// s - source string
+//-----------------------------------------------------------------------------
+inline void SString::Set(const SString &s)
+{
+ SS_CONTRACT_VOID
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(s.Check());
+ SS_POSTCONDITION(Equals(s));
+ THROWS;
+ GC_NOTRIGGER;
+ SUPPORTS_DAC;
+ }
+ SS_CONTRACT_END;
+
+ SBuffer::Set(s);
+ SetRepresentation(s.GetRepresentation());
+ ClearNormalized();
+
+ SS_RETURN;
+}
+
+//-----------------------------------------------------------------------------
+// Set this string to concatenation of s1 and s2
+//-----------------------------------------------------------------------------
+inline void SString::Set(const SString &s1, const SString &s2)
+{
+ SS_CONTRACT_VOID
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(s1.Check());
+ PRECONDITION(s2.Check());
+ THROWS;
+ GC_NOTRIGGER;
+ }
+ SS_CONTRACT_END;
+
+ Preallocate(s1.GetCount() + s2.GetCount());
+
+ Set(s1);
+ Append(s2);
+
+ SS_RETURN;
+}
+
+//-----------------------------------------------------------------------------
+// Set this string to concatenation of s1, s2, and s3
+//-----------------------------------------------------------------------------
+inline void SString::Set(const SString &s1, const SString &s2, const SString &s3)
+{
+ SS_CONTRACT_VOID
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(s1.Check());
+ PRECONDITION(s2.Check());
+ PRECONDITION(s3.Check());
+ THROWS;
+ GC_NOTRIGGER;
+ }
+ SS_CONTRACT_END;
+
+ Preallocate(s1.GetCount() + s2.GetCount() + s3.GetCount());
+
+ Set(s1);
+ Append(s2);
+ Append(s3);
+
+ SS_RETURN;
+}
+
+//-----------------------------------------------------------------------------
+// Set this string to concatenation of s1, s2, s3, and s4
+//-----------------------------------------------------------------------------
+inline void SString::Set(const SString &s1, const SString &s2, const SString &s3, const SString &s4)
+{
+ SS_CONTRACT_VOID
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(s1.Check());
+ PRECONDITION(s2.Check());
+ PRECONDITION(s3.Check());
+ PRECONDITION(s4.Check());
+ THROWS;
+ GC_NOTRIGGER;
+ }
+ SS_CONTRACT_END;
+
+ Preallocate(s1.GetCount() + s2.GetCount() + s3.GetCount() + s4.GetCount());
+
+ Set(s1);
+ Append(s2);
+ Append(s3);
+ Append(s4);
+
+ SS_RETURN;
+}
+
+//-----------------------------------------------------------------------------
+// Set this string to the substring from s.
+// s - the source string
+// start - the character to start at
+// length - number of characters to copy from s.
+//-----------------------------------------------------------------------------
+inline void SString::Set(const SString &s, const CIterator &i, COUNT_T count)
+{
+ SS_CONTRACT_VOID
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(s.Check());
+ PRECONDITION(i.Check());
+ PRECONDITION(CheckCount(count));
+ SS_POSTCONDITION(s.Match(i, *this));
+ SS_POSTCONDITION(GetRawCount() == count);
+ THROWS;
+ GC_NOTRIGGER;
+ }
+ SS_CONTRACT_END;
+
+ // @todo: detect case where we can reuse literal?
+ Resize(count, s.GetRepresentation());
+ SBuffer::Copy(SBuffer::Begin(), i.m_ptr, count<<i.m_characterSizeShift);
+ NullTerminate();
+
+ SS_RETURN;
+}
+
+//-----------------------------------------------------------------------------
+// Set this string to the substring from s.
+// s - the source string
+// start - the position to start
+// end - the position to end (exclusive)
+//-----------------------------------------------------------------------------
+inline void SString::Set(const SString &s, const CIterator &start, const CIterator &end)
+{
+ SS_CONTRACT_VOID
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(s.Check());
+ PRECONDITION(start.Check());
+ PRECONDITION(s.CheckIteratorRange(start));
+ PRECONDITION(end.Check());
+ PRECONDITION(s.CheckIteratorRange(end));
+ PRECONDITION(end >= start);
+ SS_POSTCONDITION(s.Match(start, *this));
+ SS_POSTCONDITION(GetRawCount() == (COUNT_T) (end - start));
+ THROWS;
+ GC_NOTRIGGER;
+ }
+ SS_CONTRACT_END;
+
+ Set(s, start, end - start);
+
+ SS_RETURN;
+}
+
+// Return a global empty string
+inline const SString &SString::Empty()
+{
+#ifdef SSTRING_EXTRA_CHECKS
+ CONTRACTL
+ {
+ // POSTCONDITION(RETVAL.IsEmpty());
+ PRECONDITION(CheckStartup());
+ NOTHROW;
+ GC_NOTRIGGER;
+ CANNOT_TAKE_LOCK;
+ SO_TOLERANT;
+ SUPPORTS_DAC;
+ }
+ CONTRACTL_END;
+#else
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_GC_NOTRIGGER;
+ STATIC_CONTRACT_CANNOT_TAKE_LOCK;
+ STATIC_CONTRACT_SO_TOLERANT;
+ STATIC_CONTRACT_SUPPORTS_DAC;
+#endif
+
+ _ASSERTE(s_Empty != NULL); // Did you call SString::Startup()?
+ return *s_Empty;
+}
+
+// Get a const pointer to the internal buffer as a unicode string.
+inline const WCHAR *SString::GetUnicode() const
+{
+ SS_CONTRACT(const WCHAR *)
+ {
+ GC_NOTRIGGER;
+ PRECONDITION(CheckPointer(this));
+ SS_POSTCONDITION(CheckPointer(RETVAL));
+ if (IsRepresentation(REPRESENTATION_UNICODE)) NOTHROW; else THROWS;
+ GC_NOTRIGGER;
+ SUPPORTS_DAC;
+ }
+ SS_CONTRACT_END;
+
+ if (this == NULL)
+ SS_RETURN NULL;
+
+ ConvertToUnicode();
+
+ SS_RETURN GetRawUnicode();
+}
+
+// Normalize the string to unicode. This will make many operations nonfailing.
+inline void SString::Normalize() const
+{
+ SS_CONTRACT_VOID
+ {
+ INSTANCE_CHECK;
+ SS_POSTCONDITION(IsNormalized());
+ THROWS_UNLESS_NORMALIZED;
+ GC_NOTRIGGER;
+ }
+ SS_CONTRACT_END;
+
+ ConvertToUnicode();
+ SetNormalized();
+
+ SS_RETURN;
+}
+
+// Get a const pointer to the internal buffer as a unicode string.
+inline const WCHAR *SString::GetUnicode(const CIterator &i) const
+{
+ SS_CONTRACT(const WCHAR *)
+ {
+ INSTANCE_CHECK;
+ PRECONDITION(CheckIteratorRange(i));
+ THROWS_UNLESS_NORMALIZED;
+ GC_NOTRIGGER;
+ }
+ SS_CONTRACT_END;
+
+ PRECONDITION(CheckPointer(this));
+
+ ConvertToUnicode(i);
+
+ SS_RETURN i.GetUnicode();
+}
+
+// Append s to the end of this string.
+inline void SString::Append(const SString &s)
+{
+ SS_CONTRACT_VOID
+ {
+ GC_NOTRIGGER;
+ PRECONDITION(CheckPointer(this));
+ PRECONDITION(s.Check());
+ THROWS;
+ SUPPORTS_DAC_HOST_ONLY;
+ }
+ SS_CONTRACT_END;
+
+ Insert(End(), s);
+
+ SS_RETURN;
+}
+
+inline void SString::Append(const WCHAR *string)
+{
+ SS_CONTRACT_VOID
+ {
+ GC_NOTRIGGER;
+ PRECONDITION(CheckPointer(this));
+ PRECONDITION(CheckPointer(string));
+ THROWS;
+ SUPPORTS_DAC_HOST_ONLY;
+ }
+ SS_CONTRACT_END;
+
+ // Wrap the string in temporary SString without copying it
+ SString s(SString::Literal, string);
+ s.ClearImmutable();
+ Append(s);
+
+ SS_RETURN;
+}
+
+inline void SString::AppendASCII(const CHAR *string)
+{
+ SS_CONTRACT_VOID
+ {
+ GC_NOTRIGGER;
+ PRECONDITION(CheckPointer(this));
+ PRECONDITION(CheckPointer(string));
+ THROWS;
+ }
+ SS_CONTRACT_END;
+
+ StackSString s(SString::Ascii, string);
+ Append(s);
+
+ SS_RETURN;
+}
+
+inline void SString::AppendUTF8(const CHAR *string)
+{
+ SS_CONTRACT_VOID
+ {
+ GC_NOTRIGGER;
+ PRECONDITION(CheckPointer(this));
+ PRECONDITION(CheckPointer(string));
+ THROWS;
+ }
+ SS_CONTRACT_END;
+
+ StackSString s(SString::Utf8, string);
+ Append(s);
+
+ SS_RETURN;
+}
+
+inline void SString::Append(const WCHAR c)
+{
+ SS_CONTRACT_VOID
+ {
+ GC_NOTRIGGER;
+ PRECONDITION(CheckPointer(this));
+ THROWS;
+ }
+ SS_CONTRACT_END;
+
+ InlineSString<2 * sizeof(c)> s(c);
+ Append(s);
+
+ SS_RETURN;
+}
+
+inline void SString::AppendUTF8(const CHAR c)
+{
+ SS_CONTRACT_VOID
+ {
+ GC_NOTRIGGER;
+ PRECONDITION(CheckPointer(this));
+ THROWS;
+ SUPPORTS_DAC_HOST_ONLY;
+ }
+ SS_CONTRACT_END;
+
+ InlineSString<2 * sizeof(c)> s(SString::Utf8, c);
+ Append(s);
+
+ SS_RETURN;
+}
+
+// Turn this on to test that these if you are testing common scenarios dealing with
+// ASCII strings that do not touch the cases where this family of function differs
+// in behavior for expected reasons.
+//#define VERIFY_CRT_EQUIVALNCE 1
+
+// Helpers for CRT function equivalance.
+/* static */
+inline int __cdecl SString::_stricmp(const CHAR *buffer1, const CHAR *buffer2) {
+ WRAPPER_NO_CONTRACT;
+ int returnValue = CaseCompareHelperA(buffer1, buffer2, 0, s_defaultLCID, TRUE, FALSE);
+#ifdef VERIFY_CRT_EQUIVALNCE
+ _ASSERTE((returnValue == 0) == (::_stricmp(buffer1, buffer2) == 0));
+#endif
+ return returnValue;
+
+}
+
+/* static */
+inline int __cdecl SString::_strnicmp(const CHAR *buffer1, const CHAR *buffer2, COUNT_T count) {
+ WRAPPER_NO_CONTRACT;
+ int returnValue = CaseCompareHelperA(buffer1, buffer2, count, s_defaultLCID, TRUE, TRUE);
+#ifdef VERIFY_CRT_EQUIVALNCE
+ _ASSERTE((returnValue == 0) == (::_strnicmp(buffer1, buffer2, count) == 0));
+#endif
+ return returnValue;
+}
+
+/* static */
+inline int __cdecl SString::_wcsicmp(const WCHAR *buffer1, const WCHAR *buffer2) {
+ WRAPPER_NO_CONTRACT;
+ int returnValue = CaseCompareHelper(buffer1, buffer2, 0, s_defaultLCID, TRUE, FALSE);
+#ifdef VERIFY_CRT_EQUIVALNCE
+ _ASSERTE((returnValue == 0) == (::_wcsicmp(buffer1, buffer2) == 0));
+#endif
+ return returnValue;
+
+}
+
+/* static */
+inline int __cdecl SString::_wcsnicmp(const WCHAR *buffer1, const WCHAR *buffer2, COUNT_T count) {
+ WRAPPER_NO_CONTRACT;
+ int returnValue = CaseCompareHelper(buffer1, buffer2, count, s_defaultLCID, TRUE, TRUE);
+#ifdef VERIFY_CRT_EQUIVALNCE
+ _ASSERTE((returnValue == 0) == (::_wcsnicmp(buffer1, buffer2, count) == 0));
+#endif
+ return returnValue;
+}
+
+inline int SString::_tstricmp(const CHAR *buffer1, const CHAR *buffer2)
+{
+ return _stricmp(buffer1, buffer2);
+}
+
+inline int SString::_tstricmp(const WCHAR *buffer1, const WCHAR *buffer2)
+{
+ return _wcsicmp(buffer1, buffer2);
+}
+
+inline int SString::_tstrnicmp(const CHAR *buffer1, const CHAR *buffer2, COUNT_T count)
+{
+ return _strnicmp(buffer1, buffer2, count);
+}
+
+inline int SString::_tstrnicmp(const WCHAR *buffer1, const WCHAR *buffer2, COUNT_T count)
+{
+ return _wcsnicmp(buffer1, buffer2, count);
+}
+
+inline ULONG SString::HashCaseInsensitive() const
+{
+ WRAPPER_NO_CONTRACT;
+ return HashCaseInsensitive(s_defaultLCID);
+}
+
+inline int SString::CompareCaseInsensitive(const SString &s) const
+{
+ WRAPPER_NO_CONTRACT;
+ return CompareCaseInsensitive(s, s_defaultLCID);
+}
+
+inline BOOL SString::EqualsCaseInsensitive(const SString &s) const
+{
+ WRAPPER_NO_CONTRACT;
+ return EqualsCaseInsensitive(s, s_defaultLCID);
+}
+
+inline BOOL SString::MatchCaseInsensitive(const CIterator &i, const SString &s) const
+{
+ WRAPPER_NO_CONTRACT;
+ return MatchCaseInsensitive(i, s, s_defaultLCID);
+}
+
+inline BOOL SString::MatchCaseInsensitive(const CIterator &i, WCHAR c) const
+{
+ WRAPPER_NO_CONTRACT;
+ return MatchCaseInsensitive(i, c, s_defaultLCID);
+}
+
+inline BOOL SString::Match(const CIterator &i, WCHAR c) const
+{
+ SS_CONTRACT(BOOL)
+ {
+ GC_NOTRIGGER;
+ INSTANCE_CHECK;
+ PRECONDITION(CheckIteratorRange(i));
+ NOTHROW;
+ }
+ SS_CONTRACT_END;
+
+ // End() will not throw here
+ CONTRACT_VIOLATION(ThrowsViolation);
+ SS_RETURN (i < End() && i[0] == c);
+}
+
+inline BOOL SString::Skip(CIterator &i, const SString &s) const
+{
+ SS_CONTRACT(BOOL)
+ {
+ GC_NOTRIGGER;
+ INSTANCE_CHECK;
+ PRECONDITION(CheckIteratorRange(i));
+ PRECONDITION(s.Check());
+ THROWS_UNLESS_BOTH_NORMALIZED(s);
+ }
+ SS_CONTRACT_END;
+
+ if (Match(i, s))
+ {
+ i += s.GetRawCount();
+ SS_RETURN TRUE;
+ }
+ else
+ SS_RETURN FALSE;
+}
+
+inline BOOL SString::Skip(CIterator &i, WCHAR c) const
+{
+ SS_CONTRACT(BOOL)
+ {
+ GC_NOTRIGGER;
+ INSTANCE_CHECK;
+ PRECONDITION(CheckIteratorRange(i));
+ NOTHROW;
+ }
+ SS_CONTRACT_END;
+
+ if (Match(i, c))
+ {
+ i++;
+ SS_RETURN TRUE;
+ }
+ else
+ SS_RETURN FALSE;
+}
+
+// Find string within this string. Return TRUE and update iterator if found
+inline BOOL SString::Find(CIterator &i, const WCHAR *string) const
+{
+ SS_CONTRACT(BOOL)
+ {
+ GC_NOTRIGGER;
+ PRECONDITION(CheckPointer(this));
+ PRECONDITION(CheckIteratorRange(i));
+ PRECONDITION(CheckPointer(string));
+ SS_POSTCONDITION(RETVAL == Match(i, SString(string)));
+ THROWS;
+ }
+ SS_CONTRACT_END;
+
+ StackSString s(string);
+ SS_RETURN Find(i, s);
+}
+
+inline BOOL SString::FindASCII(CIterator &i, const CHAR *string) const
+{
+ SS_CONTRACT(BOOL)
+ {
+ GC_NOTRIGGER;
+ PRECONDITION(CheckPointer(this));
+ PRECONDITION(CheckIteratorRange(i));
+ PRECONDITION(CheckPointer(string));
+ SS_POSTCONDITION(RETVAL == Match(i, SString(SString::Ascii, string)));
+ THROWS;
+ }
+ SS_CONTRACT_END;
+
+ StackSString s(SString::Ascii, string);
+ SS_RETURN Find(i, s);
+}
+
+inline BOOL SString::FindUTF8(CIterator &i, const CHAR *string) const
+{
+ SS_CONTRACT(BOOL)
+ {
+ GC_NOTRIGGER;
+ PRECONDITION(CheckPointer(this));
+ PRECONDITION(CheckIteratorRange(i));
+ PRECONDITION(CheckPointer(string));
+ SS_POSTCONDITION(RETVAL == Match(i, SString(SString::Ascii, string)));
+ THROWS;
+ }
+ SS_CONTRACT_END;
+
+ StackSString s(SString::Utf8, string);
+ SS_RETURN Find(i, s);
+}
+
+inline BOOL SString::FindBack(CIterator &i, const WCHAR *string) const
+{
+ SS_CONTRACT(BOOL)
+ {
+ GC_NOTRIGGER;
+ PRECONDITION(CheckPointer(this));
+ PRECONDITION(CheckIteratorRange(i));
+ PRECONDITION(CheckPointer(string));
+ SS_POSTCONDITION(RETVAL == Match(i, SString(string)));
+ THROWS;
+ }
+ SS_CONTRACT_END;
+
+ StackSString s(string);
+ SS_RETURN FindBack(i, s);
+}
+
+inline BOOL SString::FindBackASCII(CIterator &i, const CHAR *string) const
+{
+ SS_CONTRACT(BOOL)
+ {
+ GC_NOTRIGGER;
+ PRECONDITION(CheckPointer(this));
+ PRECONDITION(CheckIteratorRange(i));
+ PRECONDITION(CheckPointer(string));
+ SS_POSTCONDITION(RETVAL == Match(i, SString(SString::Ascii, string)));
+ THROWS;
+ }
+ SS_CONTRACT_END;
+
+ StackSString s(SString::Ascii, string);
+ SS_RETURN FindBack(i, s);
+}
+
+inline BOOL SString::FindBackUTF8(CIterator &i, const CHAR *string) const
+{
+ SS_CONTRACT(BOOL)
+ {
+ GC_NOTRIGGER;
+ PRECONDITION(CheckPointer(this));
+ PRECONDITION(CheckIteratorRange(i));
+ PRECONDITION(CheckPointer(string));
+ SS_POSTCONDITION(RETVAL == Match(i, SString(SString::Ascii, string)));
+ THROWS;
+ }
+ SS_CONTRACT_END;
+
+ StackSString s(SString::Utf8, string);
+ SS_RETURN FindBack(i, s);
+}
+
+// Insert string at iterator position
+inline void SString::Insert(const Iterator &i, const SString &s)
+{
+ SS_CONTRACT_VOID
+ {
+ GC_NOTRIGGER;
+ PRECONDITION(CheckPointer(this));
+ PRECONDITION(CheckIteratorRange(i));
+ PRECONDITION(s.Check());
+ THROWS;
+ SUPPORTS_DAC_HOST_ONLY;
+ }
+ SS_CONTRACT_END;
+
+ Replace(i, 0, s);
+
+ SS_RETURN;
+}
+
+inline void SString::Insert(const Iterator &i, const WCHAR *string)
+{
+ SS_CONTRACT_VOID
+ {
+ GC_NOTRIGGER;
+ PRECONDITION(CheckPointer(this));
+ PRECONDITION(CheckIteratorRange(i));
+ PRECONDITION(CheckPointer(string));
+ THROWS;
+ }
+ SS_CONTRACT_END;
+
+ StackSString s(string);
+ Replace(i, 0, s);
+
+ SS_RETURN;
+}
+
+inline void SString::InsertASCII(const Iterator &i, const CHAR *string)
+{
+ SS_CONTRACT_VOID
+ {
+ GC_NOTRIGGER;
+ PRECONDITION(CheckPointer(this));
+ PRECONDITION(CheckIteratorRange(i));
+ PRECONDITION(CheckPointer(string));
+ THROWS;
+ }
+ SS_CONTRACT_END;
+
+ StackSString s(SString::Ascii, string);
+ Replace(i, 0, s);
+
+ SS_RETURN;
+}
+
+inline void SString::InsertUTF8(const Iterator &i, const CHAR *string)
+{
+ SS_CONTRACT_VOID
+ {
+ GC_NOTRIGGER;
+ PRECONDITION(CheckPointer(this));
+ PRECONDITION(CheckIteratorRange(i));
+ PRECONDITION(CheckPointer(string));
+ THROWS;
+ }
+ SS_CONTRACT_END;
+
+ StackSString s(SString::Utf8, string);
+ Replace(i, 0, s);
+
+ SS_RETURN;
+}
+
+// Delete string at iterator position
+inline void SString::Delete(const Iterator &i, COUNT_T length)
+{
+ SS_CONTRACT_VOID
+ {
+ GC_NOTRIGGER;
+ PRECONDITION(CheckPointer(this));
+ PRECONDITION(CheckIteratorRange(i, length));
+ THROWS;
+ SUPPORTS_DAC_HOST_ONLY;
+ }
+ SS_CONTRACT_END;
+
+ Replace(i, length, Empty());
+
+ SS_RETURN;
+}
+
+// Preallocate some space for the string buffer
+inline void SString::Preallocate(COUNT_T characters) const
+{
+ WRAPPER_NO_CONTRACT;
+
+ // Assume unicode since we may get converted
+ SBuffer::Preallocate(characters * sizeof(WCHAR));
+}
+
+// Trim unused space from the buffer
+inline void SString::Trim() const
+{
+ WRAPPER_NO_CONTRACT;
+
+ if (GetRawCount() == 0)
+ {
+ // Share the global empty string buffer.
+ const_cast<SString *>(this)->SBuffer::SetImmutable(s_EmptyBuffer, sizeof(s_EmptyBuffer));
+ }
+ else
+ {
+ SBuffer::Trim();
+ }
+}
+
+// RETURN true if the string is empty.
+inline BOOL SString::IsEmpty() const
+{
+ SS_CONTRACT(BOOL)
+ {
+ GC_NOTRIGGER;
+ PRECONDITION(CheckPointer(this));
+ NOTHROW;
+ SO_TOLERANT;
+ SUPPORTS_DAC;
+ }
+ SS_CONTRACT_END;
+
+ SS_RETURN (GetRawCount() == 0);
+}
+
+// RETURN true if the string rep is ASCII.
+inline BOOL SString::IsASCII() const
+{
+ SS_CONTRACT(BOOL)
+ {
+ GC_NOTRIGGER;
+ PRECONDITION(CheckPointer(this));
+ NOTHROW;
+ SO_TOLERANT;
+ }
+ SS_CONTRACT_END;
+
+ SS_RETURN IsRepresentation(REPRESENTATION_ASCII);
+}
+
+// Get the number of characters in the string (excluding the terminating NULL)
+inline COUNT_T SString::GetCount() const
+{
+ SS_CONTRACT(COUNT_T)
+ {
+ GC_NOTRIGGER;
+ PRECONDITION(CheckPointer(this));
+ SS_POSTCONDITION(CheckCount(RETVAL));
+ THROWS_UNLESS_NORMALIZED;
+ SUPPORTS_DAC;
+ }
+ SS_CONTRACT_END;
+
+ ConvertToFixed();
+
+ SS_RETURN SizeToCount(GetSize());
+}
+
+// Private helpers:
+// Return the current size of the string (even if it is multibyte)
+inline COUNT_T SString::GetRawCount() const
+{
+ WRAPPER_NO_CONTRACT;
+
+ return SizeToCount(GetSize());
+}
+
+// Private helpers:
+// get string contents as a particular character set:
+
+inline ASCII *SString::GetRawASCII() const
+{
+ LIMITED_METHOD_DAC_CONTRACT;
+
+ return (ASCII *) m_buffer;
+}
+
+inline UTF8 *SString::GetRawUTF8() const
+{
+ LIMITED_METHOD_DAC_CONTRACT;
+
+ return (UTF8 *) m_buffer;
+}
+
+inline ANSI *SString::GetRawANSI() const
+{
+ LIMITED_METHOD_DAC_CONTRACT;
+
+ return (ANSI *) m_buffer;
+}
+
+inline WCHAR *SString::GetRawUnicode() const
+{
+ LIMITED_METHOD_CONTRACT;
+ SUPPORTS_DAC_HOST_ONLY;
+
+ return (WCHAR *)m_buffer;
+}
+
+// Private helper:
+// get the representation (ansi, unicode, utf8)
+inline SString::Representation SString::GetRepresentation() const
+{
+ WRAPPER_NO_CONTRACT;
+
+ return (Representation) SBuffer::GetRepresentationField();
+}
+
+// Private helper.
+// Set the representation.
+inline void SString::SetRepresentation(SString::Representation representation)
+{
+#ifdef SSTRING_EXTRA_CHECKS
+ CONTRACT_VOID
+ {
+ GC_NOTRIGGER;
+ NOTHROW;
+ PRECONDITION(CheckPointer(this));
+ PRECONDITION(CheckRepresentation(representation));
+ POSTCONDITION(GetRepresentation() == representation);
+ }
+ CONTRACT_END;
+#else //SSTRING_EXTRA_CHECKS
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_GC_NOTRIGGER;
+ STATIC_CONTRACT_SUPPORTS_DAC_HOST_ONLY;
+#endif //SSTRING_EXTRA_CHECKS
+
+ SBuffer::SetRepresentationField((int) representation);
+
+ SS_RETURN;
+}
+
+// Private helper:
+// Get the amount to shift the byte size to get a character count
+inline int SString::GetCharacterSizeShift() const
+{
+ WRAPPER_NO_CONTRACT;
+
+ // Note that the flag is backwards; we want the default
+ // value to match the default representation (empty)
+ return (GetRepresentation()&REPRESENTATION_SINGLE_MASK) == 0;
+}
+
+//----------------------------------------------------------------------------
+// Private helper.
+// We know the buffer should be m_count characters. Place a null terminator
+// in the buffer to make our internal string null-terminated at that length.
+//----------------------------------------------------------------------------
+FORCEINLINE void SString::NullTerminate()
+{
+ SUPPORTS_DAC_HOST_ONLY;
+#ifdef SSTRING_EXTRA_CHECKS
+ CONTRACT_VOID
+ {
+ POSTCONDITION(CheckPointer(this));
+ NOTHROW;
+ GC_NOTRIGGER;
+ }
+ CONTRACT_END;
+#else //SSTRING_EXTRA_CHECKS
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_GC_NOTRIGGER;
+#endif //SSTRING_EXTRA_CHECKS
+
+ BYTE *end = m_buffer + GetSize();
+
+ if (GetRepresentation()&REPRESENTATION_SINGLE_MASK)
+ {
+ ((CHAR *)end)[-1] = 0;
+ }
+ else
+ {
+ ((WCHAR *)end)[-1] = 0;
+ }
+
+ SS_RETURN;
+}
+
+//----------------------------------------------------------------------------
+// private helper
+// Return true if the string is a literal.
+// A literal string has immutable memory.
+//----------------------------------------------------------------------------
+inline BOOL SString::IsLiteral() const
+{
+ WRAPPER_NO_CONTRACT;
+
+ return SBuffer::IsImmutable() && (m_buffer != s_EmptyBuffer);
+}
+
+//----------------------------------------------------------------------------
+// private helper:
+// RETURN true if the string allocated (and should delete) its buffer.
+// IsAllocated() will RETURN false for Literal strings and
+// stack-based strings (the buffer is on the stack)
+//----------------------------------------------------------------------------
+inline BOOL SString::IsAllocated() const
+{
+ WRAPPER_NO_CONTRACT;
+
+ return SBuffer::IsAllocated();
+}
+
+//----------------------------------------------------------------------------
+// Return true after we call OpenBuffer(), but before we close it.
+// All SString operations are illegal while the buffer is open.
+//----------------------------------------------------------------------------
+#if _DEBUG
+inline BOOL SString::IsBufferOpen() const
+{
+ WRAPPER_NO_CONTRACT;
+
+ return SBuffer::IsOpened();
+}
+#endif
+
+//----------------------------------------------------------------------------
+// Return true if we've scanned the string to see if it is in the ASCII subset.
+//----------------------------------------------------------------------------
+inline BOOL SString::IsASCIIScanned() const
+{
+ WRAPPER_NO_CONTRACT;
+ SUPPORTS_DAC;
+
+ return SBuffer::IsFlag1();
+}
+
+//----------------------------------------------------------------------------
+// Set that we've scanned the string to see if it is in the ASCII subset.
+//----------------------------------------------------------------------------
+inline void SString::SetASCIIScanned() const
+{
+ WRAPPER_NO_CONTRACT;
+ SUPPORTS_DAC_HOST_ONLY;
+
+ const_cast<SString *>(this)->SBuffer::SetFlag1();
+}
+
+//----------------------------------------------------------------------------
+// Return true if we've normalized the string to unicode
+//----------------------------------------------------------------------------
+inline BOOL SString::IsNormalized() const
+{
+ WRAPPER_NO_CONTRACT;
+ SUPPORTS_DAC;
+
+ return SBuffer::IsFlag3();
+}
+
+//----------------------------------------------------------------------------
+// Set that we've normalized the string to unicode
+//----------------------------------------------------------------------------
+inline void SString::SetNormalized() const
+{
+ WRAPPER_NO_CONTRACT;
+
+ const_cast<SString *>(this)->SBuffer::SetFlag3();
+}
+
+//----------------------------------------------------------------------------
+// Clear normalization
+//----------------------------------------------------------------------------
+inline void SString::ClearNormalized() const
+{
+ WRAPPER_NO_CONTRACT;
+ SUPPORTS_DAC_HOST_ONLY;
+
+ const_cast<SString *>(this)->SBuffer::ClearFlag3();
+}
+
+//----------------------------------------------------------------------------
+// Private helper.
+// Check to see if the string representation has single byte size
+//----------------------------------------------------------------------------
+inline BOOL SString::IsSingleByte() const
+{
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_GC_NOTRIGGER;
+
+ return ((GetRepresentation()&REPRESENTATION_SINGLE_MASK) != 0);
+}
+
+//----------------------------------------------------------------------------
+// Private helper.
+// Check to see if the string representation has fixed size characters
+//----------------------------------------------------------------------------
+inline BOOL SString::IsFixedSize() const
+{
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_GC_NOTRIGGER;
+ STATIC_CONTRACT_SUPPORTS_DAC;
+
+ if (GetRepresentation()&REPRESENTATION_VARIABLE_MASK)
+ return ((GetRepresentation() == REPRESENTATION_ANSI) && !s_IsANSIMultibyte);
+ else
+ return TRUE;
+}
+
+//----------------------------------------------------------------------------
+// Private helper.
+// Check to see if the string representation is appropriate for iteration
+//----------------------------------------------------------------------------
+inline BOOL SString::IsIteratable() const
+{
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_GC_NOTRIGGER;
+ STATIC_CONTRACT_SUPPORTS_DAC;
+
+ // Note that in many cases ANSI may be fixed width. However we
+ // currently still do not allow iterating on them, because we would have to
+ // do character-by-character conversion on a character dereference (which must
+ // go to unicode) . We may want to adjust this going forward to
+ // depending on perf in the non-ASCII but fixed width ANSI case.
+
+ return ((GetRepresentation()&REPRESENTATION_VARIABLE_MASK) == 0);
+}
+
+//----------------------------------------------------------------------------
+// Private helper
+// Return the size of the given string in bytes
+// in the given representation.
+// count does not include the null-terminator, but the RETURN value does.
+//----------------------------------------------------------------------------
+inline COUNT_T SString::CountToSize(COUNT_T count) const
+{
+ SS_CONTRACT(COUNT_T)
+ {
+ GC_NOTRIGGER;
+ PRECONDITION(CheckCount(count));
+ SS_POSTCONDITION(SizeToCount(RETVAL) == count);
+ NOTHROW;
+ SUPPORTS_DAC;
+ }
+ SS_CONTRACT_END;
+
+ SS_RETURN (count+1) << GetCharacterSizeShift();
+}
+
+//----------------------------------------------------------------------------
+// Private helper.
+// Return the maxmimum count of characters that could fit in a buffer of
+// 'size' bytes in the given representation.
+// 'size' includes the null terminator, but the RETURN value does not.
+//----------------------------------------------------------------------------
+inline COUNT_T SString::SizeToCount(COUNT_T size) const
+{
+ SS_CONTRACT(COUNT_T)
+ {
+ GC_NOTRIGGER;
+ PRECONDITION(CheckSize(size));
+ SS_POSTCONDITION(CountToSize(RETVAL) == size);
+ NOTHROW;
+ SO_TOLERANT;
+ SUPPORTS_DAC;
+ }
+ SS_CONTRACT_END;
+
+ SS_RETURN (size >> GetCharacterSizeShift()) - 1;
+}
+
+//----------------------------------------------------------------------------
+// Private helper.
+// Return the maxmimum count of characters that could fit in the current
+// buffer including NULL terminator.
+//----------------------------------------------------------------------------
+inline COUNT_T SString::GetBufferSizeInCharIncludeNullChar() const
+{
+ STATIC_CONTRACT_GC_NOTRIGGER;
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_SO_TOLERANT;
+ STATIC_CONTRACT_SUPPORTS_DAC;
+
+ return (GetSize() >> GetCharacterSizeShift());
+}
+
+
+
+//----------------------------------------------------------------------------
+// Assert helper
+// Asser that the iterator is within the given string.
+//----------------------------------------------------------------------------
+inline CHECK SString::CheckIteratorRange(const CIterator &i) const
+{
+ CANNOT_HAVE_CONTRACT;
+ CHECK(i >= Begin());
+ CHECK(i <= End()); // Note that it's OK to look at the terminating null
+ CHECK_OK;
+}
+
+//----------------------------------------------------------------------------
+// Assert helper
+// Asser that the iterator is within the given string.
+//----------------------------------------------------------------------------
+inline CHECK SString::CheckIteratorRange(const CIterator &i, COUNT_T length) const
+{
+ CANNOT_HAVE_CONTRACT;
+ CHECK(i >= Begin());
+ CHECK(i + length <= End()); // Note that it's OK to look at the terminating null
+ CHECK_OK;
+}
+
+//----------------------------------------------------------------------------
+// Assert that the string is empty
+//----------------------------------------------------------------------------
+inline CHECK SString::CheckEmpty() const
+{
+ CANNOT_HAVE_CONTRACT;
+ CHECK(IsEmpty());
+ CHECK_OK;
+}
+
+//----------------------------------------------------------------------------
+// Check the range of a count
+//----------------------------------------------------------------------------
+inline CHECK SString::CheckCount(COUNT_T count)
+{
+ CANNOT_HAVE_CONTRACT;
+ CHECK(CheckSize(count*sizeof(WCHAR)));
+ CHECK_OK;
+}
+
+//----------------------------------------------------------------------------
+// Check the representation field
+//----------------------------------------------------------------------------
+inline CHECK SString::CheckRepresentation(int representation)
+{
+ CANNOT_HAVE_CONTRACT;
+#ifdef SSTRING_CONSOLECODEPAGE
+ CHECK(representation == REPRESENTATION_EMPTY
+ || representation == REPRESENTATION_UNICODE
+ || representation == REPRESENTATION_ASCII
+ || representation == REPRESENTATION_UTF8
+ || representation == REPRESENTATION_ANSI
+ || representation == REPRESENTATION_CONSOLE);
+#else
+ CHECK(representation == REPRESENTATION_EMPTY
+ || representation == REPRESENTATION_UNICODE
+ || representation == REPRESENTATION_ASCII
+ || representation == REPRESENTATION_UTF8
+ || representation == REPRESENTATION_ANSI);
+#endif
+ CHECK((representation & REPRESENTATION_MASK) == representation);
+
+ CHECK_OK;
+}
+
+#if CHECK_INVARIANTS
+//----------------------------------------------------------------------------
+// Assert helper. Check that the string only uses the ASCII subset of
+// codes.
+//----------------------------------------------------------------------------
+inline CHECK SString::CheckASCIIString(const CHAR *string)
+{
+ CANNOT_HAVE_CONTRACT;
+ if (string != NULL)
+ CHECK(CheckASCIIString(string, (int) strlen(string)));
+ CHECK_OK;
+}
+
+inline CHECK SString::CheckASCIIString(const CHAR *string, COUNT_T count)
+{
+ CANNOT_HAVE_CONTRACT;
+#if _DEBUG
+ const CHAR *sEnd = string + count;
+ while (string < sEnd)
+ {
+ CHECK_MSG((*string & 0x80) == 0x00, "Found non-ASCII character in string.");
+ string++;
+ }
+#endif
+ CHECK_OK;
+}
+
+//----------------------------------------------------------------------------
+// Check routine and invariants.
+//----------------------------------------------------------------------------
+
+inline CHECK SString::Check() const
+{
+ CANNOT_HAVE_CONTRACT;
+ CHECK(SBuffer::Check());
+ CHECK_OK;
+}
+
+inline CHECK SString::Invariant() const
+{
+ CANNOT_HAVE_CONTRACT;
+ CHECK(SBuffer::Invariant());
+ CHECK_OK;
+}
+
+inline CHECK SString::InternalInvariant() const
+{
+ CANNOT_HAVE_CONTRACT;
+ CHECK(SBuffer::InternalInvariant());
+ CHECK(SBuffer::GetSize() >= 2);
+ if (IsNormalized())
+ CHECK(IsRepresentation(REPRESENTATION_UNICODE));
+ CHECK_OK;
+}
+#endif // CHECK_INVARIANTS
+
+//----------------------------------------------------------------------------
+// Return a writeable buffer that can store 'countChars'+1 unicode characters.
+// Call CloseBuffer when done.
+//----------------------------------------------------------------------------
+inline WCHAR *SString::OpenUnicodeBuffer(COUNT_T countChars)
+{
+ SS_CONTRACT(WCHAR*)
+ {
+ GC_NOTRIGGER;
+ PRECONDITION(CheckPointer(this));
+ PRECONDITION(CheckCount(countChars));
+#if _DEBUG
+ SS_POSTCONDITION(IsBufferOpen());
+#endif
+ SS_POSTCONDITION(GetRawCount() == countChars);
+ SS_POSTCONDITION(GetRepresentation() == REPRESENTATION_UNICODE || countChars == 0);
+ SS_POSTCONDITION(CheckPointer(RETVAL));
+ THROWS;
+ }
+ SS_CONTRACT_END;
+
+ OpenBuffer(REPRESENTATION_UNICODE, countChars);
+ SS_RETURN GetRawUnicode();
+}
+
+//----------------------------------------------------------------------------
+// Return a copy of the underlying buffer, the caller is responsible for managing
+// the returned memory
+//----------------------------------------------------------------------------
+inline WCHAR *SString::GetCopyOfUnicodeString()
+{
+ SS_CONTRACT(WCHAR*)
+ {
+ GC_NOTRIGGER;
+ PRECONDITION(CheckPointer(this));
+ SS_POSTCONDITION(CheckPointer(buffer));
+ THROWS;
+ }
+ SS_CONTRACT_END;
+ NewArrayHolder<WCHAR> buffer = NULL;
+
+ buffer = new WCHAR[GetCount() +1];
+ wcscpy_s(buffer, GetCount() + 1, GetUnicode());
+
+ SS_RETURN buffer.Extract();
+}
+
+//----------------------------------------------------------------------------
+// Return a writeable buffer that can store 'countChars'+1 ansi characters.
+// Call CloseBuffer when done.
+//----------------------------------------------------------------------------
+inline ANSI *SString::OpenANSIBuffer(COUNT_T countChars)
+{
+ SS_CONTRACT(ANSI*)
+ {
+ GC_NOTRIGGER;
+ PRECONDITION(CheckPointer(this));
+ PRECONDITION(CheckCount(countChars));
+#if _DEBUG
+ SS_POSTCONDITION(IsBufferOpen());
+#endif
+ SS_POSTCONDITION(GetRawCount() == countChars);
+ SS_POSTCONDITION(GetRepresentation() == REPRESENTATION_ANSI || countChars == 0);
+ SS_POSTCONDITION(CheckPointer(RETVAL));
+ THROWS;
+ }
+ SS_CONTRACT_END;
+
+ OpenBuffer(REPRESENTATION_ANSI, countChars);
+ SS_RETURN GetRawANSI();
+}
+
+//----------------------------------------------------------------------------
+// Return a writeable buffer that can store 'countChars'+1 ansi characters.
+// Call CloseBuffer when done.
+//----------------------------------------------------------------------------
+inline UTF8 *SString::OpenUTF8Buffer(COUNT_T countBytes)
+{
+ SS_CONTRACT(UTF8*)
+ {
+ GC_NOTRIGGER;
+ PRECONDITION(CheckPointer(this));
+ PRECONDITION(CheckCount(countBytes));
+#if _DEBUG
+ SS_POSTCONDITION(IsBufferOpen());
+#endif
+ SS_POSTCONDITION(GetRawCount() == countBytes);
+ SS_POSTCONDITION(GetRepresentation() == REPRESENTATION_UTF8 || countBytes == 0);
+ SS_POSTCONDITION(CheckPointer(RETVAL));
+ THROWS;
+ }
+ SS_CONTRACT_END;
+
+ OpenBuffer(REPRESENTATION_UTF8, countBytes);
+ SS_RETURN GetRawUTF8();
+}
+
+//----------------------------------------------------------------------------
+// Private helper to open a raw buffer.
+// Called by public functions to open the buffer in the specific
+// representation.
+// While the buffer is opened, all other operations are illegal. Call
+// CloseBuffer() when done.
+//----------------------------------------------------------------------------
+inline void SString::OpenBuffer(SString::Representation representation, COUNT_T countChars)
+{
+#ifdef SSTRING_EXTRA_CHECKS
+ CONTRACT_VOID
+ {
+ GC_NOTRIGGER;
+ PRECONDITION(CheckPointer(this));
+ PRECONDITION_MSG(!IsBufferOpen(), "Can't nest calls to OpenBuffer()");
+ PRECONDITION(CheckRepresentation(representation));
+ PRECONDITION(CheckSize(countChars));
+#if _DEBUG
+ POSTCONDITION(IsBufferOpen());
+#endif
+ POSTCONDITION(GetRawCount() == countChars);
+ POSTCONDITION(GetRepresentation() == representation || countChars == 0);
+ THROWS;
+ }
+ CONTRACT_END;
+#else
+ STATIC_CONTRACT_GC_NOTRIGGER;
+ STATIC_CONTRACT_THROWS;
+#endif
+
+ Resize(countChars, representation);
+
+ SBuffer::OpenRawBuffer(CountToSize(countChars));
+
+ SS_RETURN;
+}
+
+//----------------------------------------------------------------------------
+// Get the max size that can be passed to OpenUnicodeBuffer without causing
+// allocations.
+//----------------------------------------------------------------------------
+inline COUNT_T SString::GetUnicodeAllocation()
+{
+ CONTRACTL
+ {
+ INSTANCE_CHECK;
+ NOTHROW;
+ GC_NOTRIGGER;
+ }
+ CONTRACTL_END;
+
+ COUNT_T allocation = GetAllocation();
+ return ( (allocation > sizeof(WCHAR))
+ ? (allocation - sizeof(WCHAR)) / sizeof(WCHAR) : 0 );
+}
+
+//----------------------------------------------------------------------------
+// Close an open buffer. Assumes that we wrote exactly number of characters
+// we requested in OpenBuffer.
+//----------------------------------------------------------------------------
+inline void SString::CloseBuffer()
+{
+ SS_CONTRACT_VOID
+ {
+ GC_NOTRIGGER;
+#if _DEBUG
+ PRECONDITION_MSG(IsBufferOpen(), "Can only CloseBuffer() after a call to OpenBuffer()");
+#endif
+ SS_POSTCONDITION(CheckPointer(this));
+ THROWS;
+ }
+ SS_CONTRACT_END;
+
+ SBuffer::CloseRawBuffer();
+ NullTerminate();
+
+ SS_RETURN;
+}
+
+//----------------------------------------------------------------------------
+// CloseBuffer() tells the SString that we're done using the unsafe buffer.
+// countChars is the count of characters actually used (so we can set m_count).
+// This is important if we request a buffer larger than what we actually
+// used.
+//----------------------------------------------------------------------------
+inline void SString::CloseBuffer(COUNT_T finalCount)
+{
+ SS_CONTRACT_VOID
+ {
+ GC_NOTRIGGER;
+#if _DEBUG
+ PRECONDITION_MSG(IsBufferOpen(), "Can only CloseBuffer() after a call to OpenBuffer()");
+#endif
+ PRECONDITION(CheckSize(finalCount));
+ SS_POSTCONDITION(CheckPointer(this));
+ SS_POSTCONDITION(GetRawCount() == finalCount);
+ THROWS;
+ }
+ SS_CONTRACT_END;
+
+ SBuffer::CloseRawBuffer(CountToSize(finalCount));
+ NullTerminate();
+
+ SS_RETURN;
+}
+
+//----------------------------------------------------------------------------
+// EnsureWritable
+// Ensures that the buffer is writable
+//----------------------------------------------------------------------------
+inline void SString::EnsureWritable() const
+{
+#ifdef SSTRING_EXTRA_CHECKS
+ CONTRACT_VOID
+ {
+ GC_NOTRIGGER;
+ PRECONDITION(CheckPointer(this));
+ POSTCONDITION(!IsLiteral());
+ THROWS;
+ }
+ CONTRACT_END;
+#else //SSTRING_EXTRA_CHECKS
+ STATIC_CONTRACT_GC_NOTRIGGER;
+ STATIC_CONTRACT_THROWS;
+#endif //SSTRING_EXTRA_CHECKS
+
+ if (IsLiteral())
+ const_cast<SString *>(this)->Resize(GetRawCount(), GetRepresentation(), PRESERVE);
+
+ SS_RETURN;
+}
+
+//-----------------------------------------------------------------------------
+// Convert the internal representation to be a fixed size
+//-----------------------------------------------------------------------------
+inline void SString::ConvertToFixed() const
+{
+ SS_CONTRACT_VOID
+ {
+ GC_NOTRIGGER;
+ SS_PRECONDITION(CheckPointer(this));
+ SS_POSTCONDITION(IsFixedSize());
+ THROWS_UNLESS_NORMALIZED;
+ SUPPORTS_DAC;
+ }
+ SS_CONTRACT_END;
+
+ // If we're already fixed size, great.
+ if (IsFixedSize())
+ SS_RETURN;
+
+ // See if we can coerce it to ASCII.
+ if (ScanASCII())
+ SS_RETURN;
+
+ // Convert to unicode then.
+ ConvertToUnicode();
+
+ SS_RETURN;
+}
+
+//-----------------------------------------------------------------------------
+// Convert the internal representation to be an iteratable one (current
+// requirements here are that it be trivially convertable to unicode chars.)
+//-----------------------------------------------------------------------------
+inline void SString::ConvertToIteratable() const
+{
+ SS_CONTRACT_VOID
+ {
+ GC_NOTRIGGER;
+ SS_PRECONDITION(CheckPointer(this));
+ SS_POSTCONDITION(IsIteratable());
+ THROWS_UNLESS_NORMALIZED;
+ SUPPORTS_DAC;
+ }
+ SS_CONTRACT_END;
+
+ // If we're already iteratable, great.
+ if (IsIteratable())
+ SS_RETURN;
+
+ // See if we can coerce it to ASCII.
+ if (ScanASCII())
+ SS_RETURN;
+
+ // Convert to unicode then.
+ ConvertToUnicode();
+
+ SS_RETURN;
+}
+
+//-----------------------------------------------------------------------------
+// Create iterators on the string.
+//-----------------------------------------------------------------------------
+
+inline SString::UIterator SString::BeginUnicode()
+{
+ SS_CONTRACT(SString::UIterator)
+ {
+ GC_NOTRIGGER;
+ PRECONDITION(CheckPointer(this));
+ SS_POSTCONDITION(CheckValue(RETVAL));
+ THROWS;
+ }
+ SS_CONTRACT_END;
+
+ ConvertToUnicode();
+ EnsureWritable();
+
+ SS_RETURN UIterator(this, 0);
+}
+
+inline SString::UIterator SString::EndUnicode()
+{
+ SS_CONTRACT(SString::UIterator)
+ {
+ GC_NOTRIGGER;
+ PRECONDITION(CheckPointer(this));
+ SS_POSTCONDITION(CheckValue(RETVAL));
+ THROWS;
+ }
+ SS_CONTRACT_END;
+
+ ConvertToUnicode();
+ EnsureWritable();
+
+ SS_RETURN UIterator(this, GetCount());
+}
+
+//-----------------------------------------------------------------------------
+// Create CIterators on the string.
+//-----------------------------------------------------------------------------
+
+FORCEINLINE SString::CIterator SString::Begin() const
+{
+ SS_CONTRACT(SString::CIterator)
+ {
+ GC_NOTRIGGER;
+ PRECONDITION(CheckPointer(this));
+ SS_POSTCONDITION(CheckValue(RETVAL));
+ THROWS_UNLESS_NORMALIZED;
+ }
+ SS_CONTRACT_END;
+
+ ConvertToIteratable();
+
+ SS_RETURN CIterator(this, 0);
+}
+
+FORCEINLINE SString::CIterator SString::End() const
+{
+ SS_CONTRACT(SString::CIterator)
+ {
+ GC_NOTRIGGER;
+ PRECONDITION(CheckPointer(this));
+ SS_POSTCONDITION(CheckValue(RETVAL));
+ THROWS_UNLESS_NORMALIZED;
+ }
+ SS_CONTRACT_END;
+
+ ConvertToIteratable();
+
+ SS_RETURN CIterator(this, GetCount());
+}
+
+//-----------------------------------------------------------------------------
+// Create Iterators on the string.
+//-----------------------------------------------------------------------------
+
+FORCEINLINE SString::Iterator SString::Begin()
+{
+ SS_CONTRACT(SString::Iterator)
+ {
+ GC_NOTRIGGER;
+ PRECONDITION(CheckPointer(this));
+ SS_POSTCONDITION(CheckValue(RETVAL));
+ THROWS; // EnsureMutable always throws
+ SUPPORTS_DAC;
+ }
+ SS_CONTRACT_END;
+
+ ConvertToIteratable();
+ EnsureMutable();
+
+ SS_RETURN Iterator(this, 0);
+}
+
+FORCEINLINE SString::Iterator SString::End()
+{
+ SS_CONTRACT(SString::Iterator)
+ {
+ GC_NOTRIGGER;
+ PRECONDITION(CheckPointer(this));
+ SS_POSTCONDITION(CheckValue(RETVAL));
+ THROWS; // EnsureMutable always Throws
+ SUPPORTS_DAC;
+ }
+ SS_CONTRACT_END;
+
+ ConvertToIteratable();
+ EnsureMutable();
+
+ SS_RETURN Iterator(this, GetCount());
+}
+
+//-----------------------------------------------------------------------------
+// CIterator support routines
+//-----------------------------------------------------------------------------
+
+inline SString::Index::Index()
+{
+ LIMITED_METHOD_CONTRACT;
+}
+
+inline SString::Index::Index(SString *string, SCOUNT_T index)
+ : SBuffer::Index(string, index<<string->GetCharacterSizeShift())
+{
+ SS_CONTRACT_VOID
+ {
+ GC_NOTRIGGER;
+ PRECONDITION(CheckPointer(string));
+ PRECONDITION(string->IsIteratable());
+ PRECONDITION(DoCheck(0));
+ SS_POSTCONDITION(CheckPointer(this));
+ // POSTCONDITION(Subtract(string->Begin()) == index); contract violation - fix later
+ NOTHROW;
+ CANNOT_TAKE_LOCK;
+ SUPPORTS_DAC;
+ }
+ SS_CONTRACT_END;
+
+ m_characterSizeShift = string->GetCharacterSizeShift();
+
+ SS_RETURN;
+}
+
+inline BYTE &SString::Index::GetAt(SCOUNT_T delta) const
+{
+ LIMITED_METHOD_DAC_CONTRACT;
+
+ return m_ptr[delta<<m_characterSizeShift];
+}
+
+inline void SString::Index::Skip(SCOUNT_T delta)
+{
+ LIMITED_METHOD_DAC_CONTRACT;
+
+ m_ptr += (delta<<m_characterSizeShift);
+}
+
+inline SCOUNT_T SString::Index::Subtract(const Index &i) const
+{
+ LIMITED_METHOD_DAC_CONTRACT;
+
+ return (SCOUNT_T) ((m_ptr - i.m_ptr)>>m_characterSizeShift);
+}
+
+inline CHECK SString::Index::DoCheck(SCOUNT_T delta) const
+{
+ CANNOT_HAVE_CONTRACT;
+#if _DEBUG
+ const SString *string = (const SString *) GetContainerDebug();
+
+ CHECK(m_ptr + (delta<<m_characterSizeShift) >= string->m_buffer);
+ CHECK(m_ptr + (delta<<m_characterSizeShift) < string->m_buffer + string->GetSize());
+#endif
+ CHECK_OK;
+}
+
+inline void SString::Index::Resync(const SString *string, BYTE *ptr) const
+{
+ WRAPPER_NO_CONTRACT;
+ SUPPORTS_DAC;
+
+ SBuffer::Index::Resync(string, ptr);
+
+ const_cast<SString::Index*>(this)->m_characterSizeShift = string->GetCharacterSizeShift();
+}
+
+
+inline const WCHAR *SString::Index::GetUnicode() const
+{
+ LIMITED_METHOD_CONTRACT;
+
+ return (const WCHAR *) m_ptr;
+}
+
+inline const CHAR *SString::Index::GetASCII() const
+{
+ LIMITED_METHOD_CONTRACT;
+
+ return (const CHAR *) m_ptr;
+}
+
+inline WCHAR SString::Index::operator*() const
+{
+ WRAPPER_NO_CONTRACT;
+ SUPPORTS_DAC;
+
+ if (m_characterSizeShift == 0)
+ return *(CHAR*)&GetAt(0);
+ else
+ return *(WCHAR*)&GetAt(0);
+}
+
+inline void SString::Index::operator->() const
+{
+ LIMITED_METHOD_CONTRACT;
+}
+
+inline WCHAR SString::Index::operator[](int index) const
+{
+ WRAPPER_NO_CONTRACT;
+
+ if (m_characterSizeShift == 0)
+ return *(CHAR*)&GetAt(index);
+ else
+ return *(WCHAR*)&GetAt(index);
+}
+
+//-----------------------------------------------------------------------------
+// Iterator support routines
+//-----------------------------------------------------------------------------
+
+inline SString::UIndex::UIndex()
+{
+ LIMITED_METHOD_CONTRACT;
+}
+
+inline SString::UIndex::UIndex(SString *string, SCOUNT_T index)
+ : SBuffer::Index(string, index*sizeof(WCHAR))
+{
+ SS_CONTRACT_VOID
+ {
+ GC_NOTRIGGER;
+ PRECONDITION(CheckPointer(string));
+ PRECONDITION(string->IsRepresentation(REPRESENTATION_UNICODE));
+ PRECONDITION(DoCheck(0));
+ SS_POSTCONDITION(CheckPointer(this));
+ NOTHROW;
+ CANNOT_TAKE_LOCK;
+ }
+ SS_CONTRACT_END;
+
+ SS_RETURN;
+}
+
+inline WCHAR &SString::UIndex::GetAt(SCOUNT_T delta) const
+{
+ LIMITED_METHOD_CONTRACT;
+
+ return ((WCHAR*)m_ptr)[delta];
+}
+
+inline void SString::UIndex::Skip(SCOUNT_T delta)
+{
+ LIMITED_METHOD_CONTRACT;
+
+ m_ptr += delta * sizeof(WCHAR);
+}
+
+inline SCOUNT_T SString::UIndex::Subtract(const UIndex &i) const
+{
+ WRAPPER_NO_CONTRACT;
+
+ return (SCOUNT_T) (GetUnicode() - i.GetUnicode());
+}
+
+inline CHECK SString::UIndex::DoCheck(SCOUNT_T delta) const
+{
+ CANNOT_HAVE_CONTRACT;
+#if _DEBUG
+ const SString *string = (const SString *) GetContainerDebug();
+
+ CHECK(GetUnicode() + delta >= string->GetRawUnicode());
+ CHECK(GetUnicode() + delta <= string->GetRawUnicode() + string->GetCount());
+#endif
+
+ CHECK_OK;
+}
+
+inline WCHAR *SString::UIndex::GetUnicode() const
+{
+ LIMITED_METHOD_CONTRACT;
+
+ return (WCHAR*) m_ptr;
+}
+
+//-----------------------------------------------------------------------------
+// Opaque scratch buffer class routines
+//-----------------------------------------------------------------------------
+inline SString::AbstractScratchBuffer::AbstractScratchBuffer(void *buffer, COUNT_T size)
+ : SString(buffer, size)
+{
+ SS_CONTRACT_VOID
+ {
+ GC_NOTRIGGER;
+ PRECONDITION(CheckPointer(buffer));
+ PRECONDITION(CheckCount(size));
+ NOTHROW;
+ }
+ SS_CONTRACT_END;
+
+ SS_RETURN;
+}
+
+#ifdef _MSC_VER
+#pragma warning(pop)
+#endif // _MSC_VER
+
+#endif // _SSTRING_INL_
diff --git a/src/inc/stack.h b/src/inc/stack.h
new file mode 100644
index 0000000000..589f8f7766
--- /dev/null
+++ b/src/inc/stack.h
@@ -0,0 +1,87 @@
+// 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.
+//-----------------------------------------------------------------------------
+
+//-----------------------------------------------------------------------------
+// This is a generic growable stack of T.
+
+#ifndef GENERIC_STACK_H
+#define GENERIC_STACK_H 1
+
+#include <math.h>
+
+template<typename T>
+class Stack
+{
+ T* m_elems;
+ unsigned m_elemsSize;
+ unsigned m_elemsCount;
+
+ static const unsigned InitSize = 8;
+
+ void GrowForPush()
+ {
+ if (m_elemsCount == m_elemsSize)
+ {
+ m_elemsSize = max(InitSize, 2*m_elemsSize);
+ T* newElems = new T[m_elemsSize];
+ if (m_elemsCount != 0)
+ {
+ _ASSERTE(m_elems != NULL);
+ for (unsigned k = 0; k < m_elemsCount; k++) newElems[k] = m_elems[k];
+ delete[] m_elems;
+ }
+ m_elems = newElems;
+ }
+ }
+
+ public:
+ Stack(unsigned sz = 0) : m_elems(NULL), m_elemsSize(sz), m_elemsCount(0)
+ {
+ if (sz > 0)
+ {
+ m_elems = new T[sz];
+ }
+ }
+
+ ~Stack()
+ {
+ if (m_elems != NULL) delete[] m_elems;
+ }
+
+ void Push(T t)
+ {
+ GrowForPush();
+ m_elems[m_elemsCount] = t;
+ m_elemsCount++;
+ }
+
+ bool IsEmpty()
+ {
+ return m_elemsCount == 0;
+ }
+
+ T Pop()
+ {
+ _ASSERTE(m_elemsCount > 0);
+ m_elemsCount--;
+ return m_elems[m_elemsCount];
+ }
+
+ T Peek()
+ {
+ _ASSERTE(m_elemsCount > 0);
+ return m_elems[m_elemsCount-1];
+ }
+
+ // Caller should take care to only side-effect the return reference if he/she is *sure*
+ // that the stack will not be popped in the interim!
+ T& PeekRef()
+ {
+ _ASSERTE(m_elemsCount > 0);
+ return m_elems[m_elemsCount-1];
+ }
+};
+
+#endif // GENERIC_STACK_H
diff --git a/src/inc/stackframe.h b/src/inc/stackframe.h
new file mode 100644
index 0000000000..11977e9273
--- /dev/null
+++ b/src/inc/stackframe.h
@@ -0,0 +1,130 @@
+// 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.
+
+#ifndef __STACKFRAME_H
+#define __STACKFRAME_H
+
+#include "regdisp.h"
+
+
+struct StackFrame
+{
+ const static UINT_PTR maxVal = (UINT_PTR)(INT_PTR)-1;
+ StackFrame() : SP(NULL)
+ {
+ }
+
+ StackFrame(UINT_PTR sp)
+ {
+ SP = sp;
+ }
+
+ void Clear()
+ {
+ SP = NULL;
+ }
+
+ void SetMaxVal()
+ {
+ SP = maxVal;
+ }
+
+ bool IsNull()
+ {
+ return (SP == NULL);
+ }
+
+ bool IsMaxVal()
+ {
+ return (SP == maxVal);
+ }
+
+ bool operator==(StackFrame sf)
+ {
+ return (SP == sf.SP);
+ }
+
+ bool operator!=(StackFrame sf)
+ {
+ return (SP != sf.SP);
+ }
+
+ bool operator<(StackFrame sf)
+ {
+ return (SP < sf.SP);
+ }
+
+ bool operator<=(StackFrame sf)
+ {
+ return (SP <= sf.SP);
+ }
+
+ bool operator>(StackFrame sf)
+ {
+ return (SP > sf.SP);
+ }
+
+ bool operator>=(StackFrame sf)
+ {
+ return (SP >= sf.SP);
+ }
+
+ static inline StackFrame FromEstablisherFrame(UINT_PTR EstablisherFrame)
+ {
+ return StackFrame(EstablisherFrame);
+ }
+
+ static inline StackFrame FromRegDisplay(REGDISPLAY* pRD)
+ {
+ return StackFrame(GetRegdisplaySP(pRD));
+ }
+
+ UINT_PTR SP;
+};
+
+
+//---------------------------------------------------------------------------------------
+//
+// On WIN64, all the stack range tracking done by the Exception Handling (EH) subsystem is based on the
+// establisher frame given by the OS. On IA64, the establisher frame is the caller SP and the current BSP.
+// On X64, it is the initial SP before any dynamic stack allocation, i.e. it is the SP when a function exits
+// the prolog. The EH subsystem uses the same format.
+//
+// The stackwalker needs to get information from the EH subsystem in order to skip funclets. Unfortunately,
+// stackwalking is based on the current SP, i.e. the SP when the control flow leaves a function via a
+// function call. Thus, for stack frames with dynamic stack allocations on X64, the SP values used by the
+// stackwalker and the EH subsystem don't match.
+//
+// To work around this problem, we need to somehow bridge the different SP values. We do so by using the
+// caller SP instead of the current SP for comparisons during a stackwalk on X64. Creating a new type
+// explicitly spells out the important distinction that this is NOT in the same format as the
+// OS establisher frame.
+//
+// Notes:
+// In the long term, we should look at merging the two SP formats and have one consistent abstraction.
+//
+
+struct CallerStackFrame : StackFrame
+{
+ CallerStackFrame() : StackFrame()
+ {
+ }
+
+ CallerStackFrame(UINT_PTR sp) : StackFrame(sp)
+ {
+ }
+
+ static inline CallerStackFrame FromRegDisplay(REGDISPLAY* pRD)
+ {
+#if defined(_TARGET_AMD64_) || defined(_TARGET_ARM_) || defined(_TARGET_ARM64_)
+ _ASSERTE(pRD->IsCallerSPValid || pRD->IsCallerContextValid);
+ return CallerStackFrame(GetSP(pRD->pCallerContext));
+#else // !_TARGET_AMD64_ && !_TARGET_ARM_ && !_TARGET_ARM64_
+ _ASSERTE(!"CallerStackFrame::FromRegDisplay() - NYI on this platform");
+ return CallerStackFrame();
+#endif // !_TARGET_AMD64_ && !_TARGET_ARM_ && !_TARGET_ARM64_
+ }
+};
+
+#endif // __STACKFRAME_H
diff --git a/src/inc/stacktrace.h b/src/inc/stacktrace.h
new file mode 100644
index 0000000000..83646c85ef
--- /dev/null
+++ b/src/inc/stacktrace.h
@@ -0,0 +1,91 @@
+// 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.
+//-----------------------------------------------------------------------------
+
+//-----------------------------------------------------------------------------
+
+#ifndef __STACK_TRACE_H__
+#define __STACK_TRACE_H__
+
+HINSTANCE LoadImageHlp();
+HINSTANCE LoadDbgHelp();
+
+#include <specstrings.h>
+
+//
+//--- Constants ---------------------------------------------------------------
+//
+
+#define cchMaxAssertModuleLen 60
+#define cchMaxAssertSymbolLen 257
+#define cfrMaxAssertStackLevels 20
+#define cchMaxAssertExprLen 257
+
+#ifdef _WIN64
+
+#define cchMaxAssertStackLevelStringLen \
+ ((3 * 8) + cchMaxAssertModuleLen + cchMaxAssertSymbolLen + 13)
+ // 3 addresses of at most 8 char, module, symbol, and the extra chars:
+ // 0x<address>: <module>! <symbol> + 0x<offset>\n
+ //FMT_ADDR_BARE is defined as "%08x`%08x" on Win64, and as
+ //"%08x" on 32 bit platforms. Hence the difference in the definitions.
+
+#else
+
+#define cchMaxAssertStackLevelStringLen \
+ ((2 * 8) + cchMaxAssertModuleLen + cchMaxAssertSymbolLen + 12)
+ // 2 addresses of at most 8 char, module, symbol, and the extra chars:
+ // 0x<address>: <module>! <symbol> + 0x<offset>\n
+
+#endif
+
+//
+//--- Prototypes --------------------------------------------------------------
+//
+
+/****************************************************************************
+* MagicDeinit *
+*-------------*
+* Description:
+* Cleans up for the symbol loading code. Should be called before
+* exiting in order to free the dynamically loaded imagehlp.dll
+******************************************************************** robch */
+void MagicDeinit(void);
+
+/****************************************************************************
+* GetStringFromStackLevels *
+*--------------------------*
+* Description:
+* Retrieves a string from the stack frame. If more than one frame, they
+* are separated by newlines. Each fram appears in this format:
+*
+* 0x<address>: <module>! <symbol> + 0x<offset>
+******************************************************************** robch */
+void GetStringFromStackLevels(UINT ifrStart, UINT cfrTotal, __out_ecount(cchMaxAssertStackLevelStringLen * cfrTotal) CHAR *pszString, struct _CONTEXT * pContext = NULL);
+
+/****************************************************************************
+* GetStringFromAddr *
+*-------------------*
+* Description:
+* Builds a string from an address in the format:
+*
+* 0x<address>: <module>! <symbol> + 0x<offset>
+******************************************************************** robch */
+void GetStringFromAddr(DWORD_PTR dwAddr, __out_ecount(cchMaxAssertStackLevelStringLen) LPSTR szString);
+
+#if defined(_TARGET_X86_) && defined(FEATURE_CORECLR)
+/****************************************************************************
+* ClrCaptureContext *
+*-------------------*
+* Description:
+* Exactly the contents of RtlCaptureContext for Win7 - Win2K doesn't
+* support this, so we need it for CoreCLR 4, if we require Win2K support
+****************************************************************************/
+extern "C" void __stdcall ClrCaptureContext(__out PCONTEXT ctx);
+#else // _TARGET_X86_ && FEATURE_CORECLR
+#define ClrCaptureContext RtlCaptureContext
+#endif // _X86 && FEATURE_CORECLR else
+
+
+#endif
diff --git a/src/inc/static_assert.h b/src/inc/static_assert.h
new file mode 100644
index 0000000000..e635d70f9e
--- /dev/null
+++ b/src/inc/static_assert.h
@@ -0,0 +1,28 @@
+// 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.
+// ---------------------------------------------------------------------------
+// static_assert.h
+//
+// Static assertion infrastructure
+// ---------------------------------------------------------------------------
+
+//--------------------------------------------------------------------------------
+// static_assert represents a check which should be made at compile time. It
+// can only be done on a constant expression.
+//--------------------------------------------------------------------------------
+
+#ifndef __STATIC_ASSERT_H__
+#define __STATIC_ASSERT_H__
+
+// static_assert( cond, msg ) is now a compiler-supported intrinsic in Dev10 C++ compiler.
+// Replaces previous uses of STATIC_ASSERT_MSG and COMPILE_TIME_ASSERT_MSG.
+
+// Replaces previous uses of CPP_ASSERT
+#define static_assert_n( n, cond ) static_assert( cond, #cond )
+
+// Replaces previous uses of C_ASSERT and COMPILE_TIME_ASSERT
+#define static_assert_no_msg( cond ) static_assert( cond, #cond )
+
+#endif // __STATIC_ASSERT_H__
+
diff --git a/src/inc/staticcontract.h b/src/inc/staticcontract.h
new file mode 100644
index 0000000000..09e765c3d3
--- /dev/null
+++ b/src/inc/staticcontract.h
@@ -0,0 +1,408 @@
+// 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.
+// ---------------------------------------------------------------------------
+// StaticContract.h
+// ---------------------------------------------------------------------------
+
+
+#ifndef __STATIC_CONTRACT_H_
+#define __STATIC_CONTRACT_H_
+
+// Make sure we have the WCHAR defines available.
+#include "palclr.h"
+
+#define SCAN_WIDEN2(x) L ## x
+#define SCAN_WIDEN(x) SCAN_WIDEN2(x)
+
+//
+// PDB annotations for the static contract analysis tool. These are seperated
+// from Contract.h to allow their inclusion in any part of the system.
+//
+
+#if defined(_DEBUG) && defined(_TARGET_X86_)
+#define METHOD_CANNOT_BE_FOLDED_DEBUG \
+ static int _noFold = 0; \
+ _noFold++;
+#else
+#define METHOD_CANNOT_BE_FOLDED_DEBUG
+#endif
+
+#ifdef _TARGET_X86_
+
+//
+// currently, only x86 has a static contract analysis tool, so let's not
+// bloat the PDBs of all the other architectures too..
+//
+#define ANNOTATION_TRY_BEGIN __annotation(W("TRY_BEGIN"))
+#define ANNOTATION_TRY_END __annotation(W("TRY_END"))
+#define ANNOTATION_HANDLER_BEGIN __annotation(W("HANDLER_BEGIN"))
+#define ANNOTATION_HANDLER_END __annotation(W("HANDLER_END"))
+#define ANNOTATION_NOTHROW __annotation(W("NOTHROW"))
+#define ANNOTATION_CANNOT_TAKE_LOCK __annotation(W("CANNOT_TAKE_LOCK"))
+#define ANNOTATION_WRAPPER __annotation(W("WRAPPER"))
+#define ANNOTATION_FAULT __annotation(W("FAULT"))
+#define ANNOTATION_FORBID_FAULT __annotation(W("FORBID_FAULT"))
+#define ANNOTATION_COOPERATIVE __annotation(W("MODE_COOPERATIVE"))
+#define ANNOTATION_MODE_COOPERATIVE __annotation(W("MODE_PREEMPTIVE"))
+#define ANNOTATION_MODE_ANY __annotation(W("MODE_ANY"))
+#define ANNOTATION_GC_TRIGGERS __annotation(W("GC_TRIGGERS"))
+#define ANNOTATION_IGNORE_THROW __annotation(W("THROWS"), W("NOTHROW"), W("CONDITIONAL_EXEMPT"))
+#define ANNOTATION_IGNORE_LOCK __annotation(W("CAN_TAKE_LOCK"), W("CANNOT_TAKE_LOCK"), W("CONDITIONAL_EXEMPT"))
+#define ANNOTATION_IGNORE_FAULT __annotation(W("FAULT"), W("FORBID_FAULT"), W("CONDITIONAL_EXEMPT"))
+#define ANNOTATION_IGNORE_TRIGGER __annotation(W("GC_TRIGGERS"), W("GC_NOTRIGGER"), W("CONDITIONAL_EXEMPT"))
+#define ANNOTATION_IGNORE_SO __annotation(W("SO_TOLERANT"), W("SO_INTOLERANT"), W("CONDITIONAL_EXEMPT"))
+#define ANNOTATION_VIOLATION(violationmask) __annotation(W("VIOLATION(") L#violationmask W(")"))
+#define ANNOTATION_UNCHECKED(thecheck) __annotation(W("UNCHECKED(") L#thecheck W(")"))
+
+#define ANNOTATION_MARK_BLOCK_ANNOTATION __annotation(W("MARK"))
+#define ANNOTATION_USE_BLOCK_ANNOTATION __annotation(W("USE"))
+#define ANNOTATION_END_USE_BLOCK_ANNOTATION __annotation(W("END_USE"))
+
+// here is the plan:
+//
+// a special holder which implements a violation
+//
+
+#define ANNOTATION_FN_SPECIAL_HOLDER_BEGIN __annotation(W("SPECIAL_HOLDER_BEGIN ") SCAN_WIDEN(__FUNCTION__))
+#define ANNOTATION_SPECIAL_HOLDER_END __annotation(W("SPECIAL_HOLDER_END"))
+#define ANNOTATION_SPECIAL_HOLDER_CALLER_NEEDS_DYNAMIC_CONTRACT __annotation(W("SPECIAL_HOLDER_DYNAMIC"))
+
+#define ANNOTATION_SO_PROBE_BEGIN(probeAmount) __annotation(W("SO_PROBE_BEGIN(") L#probeAmount W(")"))
+#define ANNOTATION_SO_PROBE_END __annotation(W("SO_PROBE_END"))
+
+//
+// these annotations are all function-name qualified
+//
+#define ANNOTATION_FN_LEAF __annotation(W("LEAF ") SCAN_WIDEN(__FUNCTION__))
+#define ANNOTATION_FN_WRAPPER __annotation(W("WRAPPER ") SCAN_WIDEN(__FUNCTION__))
+#define ANNOTATION_FN_THROWS __annotation(W("THROWS ") SCAN_WIDEN(__FUNCTION__))
+#define ANNOTATION_FN_NOTHROW __annotation(W("NOTHROW ") SCAN_WIDEN(__FUNCTION__))
+#define ANNOTATION_FN_CAN_TAKE_LOCK __annotation(W("CAN_TAKE_LOCK ") SCAN_WIDEN(__FUNCTION__))
+#define ANNOTATION_FN_CANNOT_TAKE_LOCK __annotation(W("CANNOT_TAKE_LOCK ") SCAN_WIDEN(__FUNCTION__))
+#define ANNOTATION_FN_FAULT __annotation(W("FAULT ") SCAN_WIDEN(__FUNCTION__))
+#define ANNOTATION_FN_FORBID_FAULT __annotation(W("FORBID_FAULT ") SCAN_WIDEN(__FUNCTION__))
+#define ANNOTATION_FN_GC_TRIGGERS __annotation(W("GC_TRIGGERS ") SCAN_WIDEN(__FUNCTION__))
+#define ANNOTATION_FN_GC_NOTRIGGER __annotation(W("GC_NOTRIGGER ") SCAN_WIDEN(__FUNCTION__))
+#define ANNOTATION_FN_SO_TOLERANT __annotation(W("SO_TOLERANT ") SCAN_WIDEN(__FUNCTION__))
+#define ANNOTATION_FN_SO_INTOLERANT __annotation(W("SO_INTOLERANT ") SCAN_WIDEN(__FUNCTION__))
+#define ANNOTATION_FN_SO_NOT_MAINLINE __annotation(W("SO_NOT_MAINLINE ") SCAN_WIDEN(__FUNCTION__))
+#define ANNOTATION_FN_MODE_COOPERATIVE __annotation(W("MODE_COOPERATIVE ") SCAN_WIDEN(__FUNCTION__))
+#define ANNOTATION_FN_MODE_PREEMPTIVE __annotation(W("MODE_PREEMPTIVE ") SCAN_WIDEN(__FUNCTION__))
+#define ANNOTATION_FN_MODE_ANY __annotation(W("MODE_ANY ") SCAN_WIDEN(__FUNCTION__))
+#define ANNOTATION_FN_HOST_NOCALLS __annotation(W("HOST_NOCALLS ") SCAN_WIDEN(__FUNCTION__))
+#define ANNOTATION_FN_HOST_CALLS __annotation(W("HOST_CALLS ") SCAN_WIDEN(__FUNCTION__))
+
+#define ANNOTATION_ENTRY_POINT __annotation(W("SO_EP ") SCAN_WIDEN(__FUNCTION__))
+
+
+// for DacCop
+#define ANNOTATION_SUPPORTS_DAC __annotation(W("SUPPORTS_DAC"))
+#define ANNOTATION_SUPPORTS_DAC_HOST_ONLY __annotation(W("SUPPORTS_DAC_HOST_ONLY"))
+
+#ifdef _DEBUG
+// @todo : put correct annotation in and fixup the static analysis tool
+// This is used to flag debug-only functions that we want to ignore in our static analysis
+#define ANNOTATION_DEBUG_ONLY __annotation(W("DBG_ONLY"))
+
+#endif
+
+#else // _TARGET_X86_
+
+#define ANNOTATION_TRY_BEGIN { }
+#define ANNOTATION_TRY_END { }
+#define ANNOTATION_HANDLER_BEGIN { }
+#define ANNOTATION_HANDLER_END { }
+#define ANNOTATION_NOTHROW { }
+#define ANNOTATION_CANNOT_TAKE_LOCK { }
+#define ANNOTATION_WRAPPER { }
+#define ANNOTATION_FAULT { }
+#define ANNOTATION_FORBID_FAULT { }
+#define ANNOTATION_COOPERATIVE { }
+#define ANNOTATION_MODE_COOPERATIVE { }
+#define ANNOTATION_MODE_ANY { }
+#define ANNOTATION_GC_TRIGGERS { }
+#define ANNOTATION_IGNORE_THROW { }
+#define ANNOTATION_IGNORE_LOCK { }
+#define ANNOTATION_IGNORE_FAULT { }
+#define ANNOTATION_IGNORE_TRIGGER { }
+#define ANNOTATION_IGNORE_SO { }
+#define ANNOTATION_VIOLATION(violationmask) { }
+#define ANNOTATION_UNCHECKED(thecheck) { }
+
+#define ANNOTATION_TRY_MARKER { }
+#define ANNOTATION_CATCH_MARKER { }
+
+#define ANNOTATION_FN_HOST_NOCALLS { }
+#define ANNOTATION_FN_HOST_CALLS { }
+
+#define ANNOTATION_FN_SPECIAL_HOLDER_BEGIN { }
+#define ANNOTATION_SPECIAL_HOLDER_END { }
+#define ANNOTATION_SPECIAL_HOLDER_CALLER_NEEDS_DYNAMIC_CONTRACT { }
+
+#define ANNOTATION_FN_LEAF { }
+#define ANNOTATION_FN_WRAPPER { }
+#define ANNOTATION_FN_THROWS { }
+#define ANNOTATION_FN_NOTHROW { }
+#define ANNOTATION_FN_CAN_TAKE_LOCK { }
+#define ANNOTATION_FN_CANNOT_TAKE_LOCK { }
+#define ANNOTATION_FN_FAULT { }
+#define ANNOTATION_FN_FORBID_FAULT { }
+#define ANNOTATION_FN_GC_TRIGGERS { }
+#define ANNOTATION_FN_GC_NOTRIGGER { }
+#define ANNOTATION_FN_SO_TOLERANT { }
+#define ANNOTATION_FN_SO_INTOLERANT { }
+#define ANNOTATION_FN_SO_NOT_MAINLINE { }
+#define ANNOTATION_FN_MODE_COOPERATIVE { }
+#define ANNOTATION_FN_MODE_PREEMPTIVE { }
+#define ANNOTATION_FN_MODE_ANY { }
+#define ANNOTATION_FN_HOST_NOCALLS { }
+#define ANNOTATION_FN_HOST_CALLS { }
+
+#define ANNOTATION_SUPPORTS_DAC { }
+#define ANNOTATION_SUPPORTS_DAC_HOST_ONLY { }
+
+#define ANNOTATION_SO_PROBE_BEGIN(probeAmount) { }
+#define ANNOTATION_SO_PROBE_END { }
+
+#define ANNOTATION_SO_TOLERANT { }
+#define ANNOTATION_SO_INTOLERANT { }
+#define ANNOTATION_SO_NOT_MAINLINE { }
+#define ANNOTATION_SO_NOT_MAINLINE_BEGIN { }
+#define ANNOTATION_SO_NOT_MAINLINE_END { }
+#define ANNOTATION_ENTRY_POINT { }
+#ifdef _DEBUG
+#define ANNOTATION_DEBUG_ONLY { }
+#endif
+
+#endif // _TARGET_X86_
+
+#define STATIC_CONTRACT_THROWS ANNOTATION_FN_THROWS
+#define STATIC_CONTRACT_NOTHROW ANNOTATION_FN_NOTHROW
+#define STATIC_CONTRACT_CAN_TAKE_LOCK ANNOTATION_FN_CAN_TAKE_LOCK
+#define STATIC_CONTRACT_CANNOT_TAKE_LOCK ANNOTATION_FN_CANNOT_TAKE_LOCK
+#define STATIC_CONTRACT_FAULT ANNOTATION_FN_FAULT
+#define STATIC_CONTRACT_FORBID_FAULT ANNOTATION_FN_FORBID_FAULT
+#define STATIC_CONTRACT_GC_TRIGGERS ANNOTATION_FN_GC_TRIGGERS
+#define STATIC_CONTRACT_GC_NOTRIGGER ANNOTATION_FN_GC_NOTRIGGER
+#define STATIC_CONTRACT_HOST_NOCALLS ANNOTATION_FN_HOST_NOCALLS
+#define STATIC_CONTRACT_HOST_CALLS ANNOTATION_FN_HOST_CALLS
+
+#define STATIC_CONTRACT_SUPPORTS_DAC ANNOTATION_SUPPORTS_DAC
+#define STATIC_CONTRACT_SUPPORTS_DAC_HOST_ONLY ANNOTATION_SUPPORTS_DAC_HOST_ONLY
+
+#define STATIC_CONTRACT_MODE_COOPERATIVE ANNOTATION_FN_MODE_COOPERATIVE
+#define STATIC_CONTRACT_MODE_PREEMPTIVE ANNOTATION_FN_MODE_PREEMPTIVE
+#define STATIC_CONTRACT_MODE_ANY ANNOTATION_FN_MODE_ANY
+#define STATIC_CONTRACT_LEAF ANNOTATION_FN_LEAF
+#define STATIC_CONTRACT_LIMITED_METHOD ANNOTATION_FN_LEAF
+#define STATIC_CONTRACT_WRAPPER ANNOTATION_FN_WRAPPER
+
+#ifdef FEATURE_STACK_PROBE // Static SO contracts only required when SO Infrastructure code is present
+#define STATIC_CONTRACT_SO_INTOLERANT ANNOTATION_FN_SO_INTOLERANT
+#define STATIC_CONTRACT_SO_TOLERANT ANNOTATION_FN_SO_TOLERANT
+#define STATIC_CONTRACT_SO_NOT_MAINLINE ANNOTATION_FN_SO_NOT_MAINLINE
+
+#define STATIC_CONTRACT_ENTRY_POINT ANNOTATION_ENTRY_POINT; ANNOTATION_FN_SO_TOLERANT
+#else // FEATURE_STACK_PROBE
+#define STATIC_CONTRACT_SO_INTOLERANT
+#define STATIC_CONTRACT_SO_TOLERANT
+#define STATIC_CONTRACT_SO_NOT_MAINLINE
+#define STATIC_CONTRACT_ENTRY_POINT
+#endif // FEATURE_STACK_PROBE
+
+#ifdef _DEBUG
+#define STATIC_CONTRACT_DEBUG_ONLY \
+ ANNOTATION_DEBUG_ONLY; \
+ STATIC_CONTRACT_CANNOT_TAKE_LOCK; \
+ ANNOTATION_VIOLATION(TakesLockViolation); \
+ ANNOTATION_FN_SO_NOT_MAINLINE;
+#else
+#define STATIC_CONTRACT_DEBUG_ONLY
+#endif
+
+#define STATIC_CONTRACT_VIOLATION(mask) \
+ ANNOTATION_VIOLATION(mask)
+
+#define SCAN_SCOPE_BEGIN \
+ METHOD_CANNOT_BE_FOLDED_DEBUG; \
+ ANNOTATION_FN_SPECIAL_HOLDER_BEGIN;
+
+#define SCAN_SCOPE_END \
+ METHOD_CANNOT_BE_FOLDED_DEBUG; \
+ ANNOTATION_SPECIAL_HOLDER_END;
+
+namespace StaticContract
+{
+ struct ScanThrowMarkerStandard
+ {
+ __declspec(noinline) ScanThrowMarkerStandard()
+ {
+ METHOD_CANNOT_BE_FOLDED_DEBUG;
+ STATIC_CONTRACT_THROWS;
+ STATIC_CONTRACT_GC_NOTRIGGER;
+ STATIC_CONTRACT_SO_TOLERANT;
+ }
+
+ static void used()
+ {
+ }
+ };
+
+ struct ScanThrowMarkerTerminal
+ {
+ __declspec(noinline) ScanThrowMarkerTerminal()
+ {
+ METHOD_CANNOT_BE_FOLDED_DEBUG;
+ }
+
+ static void used()
+ {
+ }
+ };
+
+ struct ScanThrowMarkerIgnore
+ {
+ __declspec(noinline) ScanThrowMarkerIgnore()
+ {
+ METHOD_CANNOT_BE_FOLDED_DEBUG;
+ }
+
+ static void used()
+ {
+ }
+ };
+}
+typedef StaticContract::ScanThrowMarkerStandard ScanThrowMarker;
+
+// This is used to annotate code as throwing a terminal exception, and should
+// be used immediately before the throw so that infer that it can be inferred
+// that the block in which this annotation appears throws unconditionally.
+#define SCAN_THROW_MARKER do { ScanThrowMarker __throw_marker; } while (0)
+
+#define SCAN_IGNORE_THROW_MARKER \
+ typedef StaticContract::ScanThrowMarkerIgnore ScanThrowMarker; if (0) ScanThrowMarker::used();
+
+// Terminal exceptions are asynchronous and cannot be included in THROWS contract
+// analysis. As such, this uses typedef to reassign the ScanThrowMarker to a
+// non-annotating struct so that SCAN does not see the block as throwing.
+#define STATIC_CONTRACT_THROWS_TERMINAL \
+ typedef StaticContract::ScanThrowMarkerTerminal ScanThrowMarker; if (0) ScanThrowMarker::used();
+
+#if defined(_DEBUG) && !defined(DACCESS_COMPILE) && defined(FEATURE_STACK_PROBE) && !defined(_TARGET_ARM_) // @ARMTODO
+extern void EnsureSOIntolerantOK(const char *szFunction, const char *szFile, int lineNum);
+
+extern BOOL (*g_fpShouldValidateSOToleranceOnThisThread)();
+
+// @todo Is there any checks we can do here?
+#define ENSURE_SHOULD_NOT_PROBE_FOR_SO
+
+#define CHECK_IF_SO_INTOLERANT_OK \
+ EnsureSOIntolerantOK(__FUNCTION__, __FILE__, __LINE__);
+
+// Even if we can't have a full-blown contract, we can at least check
+// if its ok to run an SO-Intolerant function.
+#undef STATIC_CONTRACT_SO_INTOLERANT
+#define STATIC_CONTRACT_SO_INTOLERANT \
+ ANNOTATION_FN_SO_INTOLERANT; \
+ CHECK_IF_SO_INTOLERANT_OK;
+
+#undef STATIC_CONTRACT_SO_NOT_MAINLINE
+#define STATIC_CONTRACT_SO_NOT_MAINLINE \
+ ENSURE_SHOULD_NOT_PROBE_FOR_SO \
+ ANNOTATION_FN_SO_NOT_MAINLINE
+
+#else
+#define EnsureSOIntolerantOK(x,y,z)
+
+#endif
+
+
+#ifdef _MSC_VER
+#define SCAN_IGNORE_THROW typedef StaticContract::ScanThrowMarkerIgnore ScanThrowMarker; ANNOTATION_IGNORE_THROW
+#define SCAN_IGNORE_LOCK ANNOTATION_IGNORE_LOCK
+#define SCAN_IGNORE_FAULT ANNOTATION_IGNORE_FAULT
+#define SCAN_IGNORE_TRIGGER ANNOTATION_IGNORE_TRIGGER
+#define SCAN_IGNORE_SO ANNOTATION_IGNORE_SO
+#else
+#define SCAN_IGNORE_THROW
+#define SCAN_IGNORE_LOCK
+#define SCAN_IGNORE_FAULT
+#define SCAN_IGNORE_TRIGGER
+#define SCAN_IGNORE_SO
+#endif
+
+
+// we use BlockMarker's only for SCAN
+#if defined(_DEBUG) && defined(_TARGET_X86_) && !defined(DACCESS_COMPILE)
+
+template <UINT COUNT>
+class BlockMarker
+{
+public:
+ __declspec(noinline) void MarkBlock()
+ {
+ ANNOTATION_MARK_BLOCK_ANNOTATION;
+ METHOD_CANNOT_BE_FOLDED_DEBUG;
+ return;
+ }
+
+ __declspec(noinline) void UseMarkedBlockAnnotation()
+ {
+ ANNOTATION_USE_BLOCK_ANNOTATION;
+ METHOD_CANNOT_BE_FOLDED_DEBUG;
+ return;
+ }
+
+ __declspec(noinline) void EndUseMarkedBlockAnnotation()
+ {
+ ANNOTATION_END_USE_BLOCK_ANNOTATION;
+ METHOD_CANNOT_BE_FOLDED_DEBUG;
+ return;
+ }
+};
+
+#define SCAN_BLOCKMARKER() BlockMarker<__COUNTER__> __blockMarker_onlyOneAllowedPerScope
+#define SCAN_BLOCKMARKER_MARK() __blockMarker_onlyOneAllowedPerScope.MarkBlock()
+#define SCAN_BLOCKMARKER_USE() __blockMarker_onlyOneAllowedPerScope.UseMarkedBlockAnnotation()
+#define SCAN_BLOCKMARKER_END_USE() __blockMarker_onlyOneAllowedPerScope.EndUseMarkedBlockAnnotation()
+
+#define SCAN_BLOCKMARKER_N(num) BlockMarker<__COUNTER__> __blockMarker_onlyOneAllowedPerScope##num
+#define SCAN_BLOCKMARKER_MARK_N(num) __blockMarker_onlyOneAllowedPerScope##num.MarkBlock()
+#define SCAN_BLOCKMARKER_USE_N(num) __blockMarker_onlyOneAllowedPerScope##num.UseMarkedBlockAnnotation()
+#define SCAN_BLOCKMARKER_END_USE_N(num) __blockMarker_onlyOneAllowedPerScope##num.EndUseMarkedBlockAnnotation()
+
+#define SCAN_EHMARKER() BlockMarker<__COUNTER__> __marker_onlyOneAllowedPerScope
+#define SCAN_EHMARKER_TRY() __annotation(W("SCOPE(BLOCK);SCAN_TRY_BEGIN")); __marker_onlyOneAllowedPerScope.MarkBlock()
+#define SCAN_EHMARKER_END_TRY() __annotation(W("SCOPE(BLOCK);SCAN_TRY_END"))
+#define SCAN_EHMARKER_CATCH() __marker_onlyOneAllowedPerScope.UseMarkedBlockAnnotation()
+#define SCAN_EHMARKER_END_CATCH() __marker_onlyOneAllowedPerScope.EndUseMarkedBlockAnnotation()
+
+#else
+
+#define SCAN_BLOCKMARKER()
+#define SCAN_BLOCKMARKER_MARK()
+#define SCAN_BLOCKMARKER_USE()
+#define SCAN_BLOCKMARKER_END_USE()
+
+#define SCAN_BLOCKMARKER_N(num)
+#define SCAN_BLOCKMARKER_MARK_N(num)
+#define SCAN_BLOCKMARKER_USE_N(num)
+#define SCAN_BLOCKMARKER_END_USE_N(num)
+
+#define SCAN_EHMARKER()
+#define SCAN_EHMARKER_TRY()
+#define SCAN_EHMARKER_END_TRY()
+#define SCAN_EHMARKER_CATCH()
+#define SCAN_EHMARKER_END_CATCH()
+
+#endif
+
+
+//
+// @todo remove this... if there really are cases where a function just shouldn't have a contract, then perhaps
+// we can add a more descriptive name for it...
+//
+#define CANNOT_HAVE_CONTRACT __annotation(W("NO_CONTRACT"))
+
+#endif // __STATIC_CONTRACT_H_
diff --git a/src/inc/stdmacros.h b/src/inc/stdmacros.h
new file mode 100644
index 0000000000..ab77a2cd91
--- /dev/null
+++ b/src/inc/stdmacros.h
@@ -0,0 +1,356 @@
+// 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.
+
+//
+
+//
+// common.h - precompiled headers include for the COM+ Execution Engine
+//
+
+//
+// Make sure _ASSERTE is defined before including this header file
+// Other than that, please keep this header self-contained so that it can be included in
+// all dlls
+//
+
+
+#ifndef _stdmacros_h_
+#define _stdmacros_h_
+
+#include "specstrings.h"
+#include "contract.h"
+
+#ifndef _ASSERTE
+#error Please define _ASSERTE before including StdMacros.h
+#endif
+
+#ifdef _DEBUG
+#define DEBUG_ARG(x) , x
+#define DEBUG_ARG1(x) x
+#else
+#define DEBUG_ARG(x)
+#define DEBUG_ARG1(x)
+#endif
+
+#ifdef DACCESS_COMPILE
+#define DAC_ARG(x) , x
+#else
+#define DAC_ARG(x)
+#endif
+
+
+/********************************************/
+/* Portability macros */
+/********************************************/
+
+#ifdef _TARGET_AMD64_
+#define AMD64_FIRST_ARG(x) x ,
+#define AMD64_ARG(x) , x
+#define AMD64_ONLY(x) x
+#define NOT_AMD64(x)
+#define NOT_AMD64_ARG(x)
+#else
+#define AMD64_FIRST_ARG(x)
+#define AMD64_ARG(x)
+#define AMD64_ONLY(x)
+#define NOT_AMD64(x) x
+#define NOT_AMD64_ARG(x) , x
+#endif
+
+#ifdef _TARGET_X86_
+#define X86_FIRST_ARG(x) x ,
+#define X86_ARG(x) , x
+#define X86_ONLY(x) x
+#define NOT_X86(x)
+#define NOT_X86_ARG(x)
+#else
+#define X86_FIRST_ARG(x)
+#define X86_ARG(x)
+#define X86_ONLY(x)
+#define NOT_X86(x) x
+#define NOT_X86_ARG(x) , x
+#endif
+
+#ifdef _WIN64
+#define WIN64_ARG(x) , x
+#define WIN64_ONLY(x) x
+#define NOT_WIN64(x)
+#define NOT_WIN64_ARG(x)
+#else
+#define WIN64_ARG(x)
+#define WIN64_ONLY(x)
+#define NOT_WIN64(x) x
+#define NOT_WIN64_ARG(x) , x
+#endif // _WIN64
+
+#ifdef _TARGET_ARM_
+#define ARM_FIRST_ARG(x) x ,
+#define ARM_ARG(x) , x
+#define ARM_ONLY(x) x
+#define NOT_ARM(x)
+#define NOT_ARM_ARG(x)
+#else
+#define ARM_FIRST_ARG(x)
+#define ARM_ARG(x)
+#define ARM_ONLY(x)
+#define NOT_ARM(x) x
+#define NOT_ARM_ARG(x) , x
+#endif
+
+#ifdef _TARGET_ARM64_
+#define ARM64_FIRST_ARG(x) x ,
+#define ARM64_ARG(x) , x
+#define ARM64_ONLY(x) x
+#define NOT_ARM64(x)
+#define NOT_ARM64_ARG(x)
+#else
+#define ARM64_FIRST_ARG(x)
+#define ARM64_ARG(x)
+#define ARM64_ONLY(x)
+#define NOT_ARM64(x) x
+#define NOT_ARM64_ARG(x) , x
+#endif
+
+#ifdef _WIN64
+ #define LOG2_PTRSIZE 3
+ #define INVALID_POINTER_CC 0xcccccccccccccccc
+ #define INVALID_POINTER_CD 0xcdcdcdcdcdcdcdcd
+ #define FMT_ADDR " %08x`%08x "
+ #define LFMT_ADDR W(" %08x`%08x ")
+ #define DBG_ADDR(ptr) (((UINT_PTR) (ptr)) >> 32), (((UINT_PTR) (ptr)) & 0xffffffff)
+#else // _WIN64
+ #define LOG2_PTRSIZE 2
+ #define INVALID_POINTER_CC 0xcccccccc
+ #define INVALID_POINTER_CD 0xcdcdcdcd
+ #define FMT_ADDR " %08x "
+ #define LFMT_ADDR W(" %08x ")
+ #define DBG_ADDR(ptr) ((UINT_PTR)(ptr))
+#endif // _WIN64
+
+#ifdef _TARGET_ARM_
+ #define ALIGN_ACCESS ((1<<LOG2_PTRSIZE)-1)
+#endif
+
+
+#ifndef ALLOC_ALIGN_CONSTANT
+#define ALLOC_ALIGN_CONSTANT ((1<<LOG2_PTRSIZE)-1)
+#endif
+
+
+inline void *GetTopMemoryAddress(void)
+{
+ WRAPPER_NO_CONTRACT;
+
+ static void *result; // = NULL;
+ if( NULL == result )
+ {
+ SYSTEM_INFO sysInfo;
+ GetSystemInfo( &sysInfo );
+ result = sysInfo.lpMaximumApplicationAddress;
+ }
+ return result;
+}
+inline void *GetBotMemoryAddress(void)
+{
+ WRAPPER_NO_CONTRACT;
+
+ static void *result; // = NULL;
+ if( NULL == result )
+ {
+ SYSTEM_INFO sysInfo;
+ GetSystemInfo( &sysInfo );
+ result = sysInfo.lpMinimumApplicationAddress;
+ }
+ return result;
+}
+
+#define TOP_MEMORY (GetTopMemoryAddress())
+#define BOT_MEMORY (GetBotMemoryAddress())
+
+
+//
+// This macro returns val rounded up as necessary to be a multiple of alignment; alignment must be a power of 2
+//
+inline size_t ALIGN_UP( size_t val, size_t alignment )
+{
+ LIMITED_METHOD_DAC_CONTRACT;
+
+ // alignment must be a power of 2 for this implementation to work (need modulo otherwise)
+ _ASSERTE( 0 == (alignment & (alignment - 1)) );
+ size_t result = (val + (alignment - 1)) & ~(alignment - 1);
+ _ASSERTE( result >= val ); // check for overflow
+ return result;
+}
+inline void* ALIGN_UP( void* val, size_t alignment )
+{
+ WRAPPER_NO_CONTRACT;
+
+ return (void*) ALIGN_UP( (size_t)val, alignment );
+}
+inline uint8_t* ALIGN_UP( uint8_t* val, size_t alignment )
+{
+ WRAPPER_NO_CONTRACT;
+
+ return (uint8_t*) ALIGN_UP( (size_t)val, alignment );
+}
+
+inline size_t ALIGN_DOWN( size_t val, size_t alignment )
+{
+ LIMITED_METHOD_CONTRACT;
+
+ // alignment must be a power of 2 for this implementation to work (need modulo otherwise)
+ _ASSERTE( 0 == (alignment & (alignment - 1)) );
+ size_t result = val & ~(alignment - 1);
+ return result;
+}
+inline void* ALIGN_DOWN( void* val, size_t alignment )
+{
+ WRAPPER_NO_CONTRACT;
+ return (void*) ALIGN_DOWN( (size_t)val, alignment );
+}
+inline uint8_t* ALIGN_DOWN( uint8_t* val, size_t alignment )
+{
+ WRAPPER_NO_CONTRACT;
+ return (uint8_t*) ALIGN_DOWN( (size_t)val, alignment );
+}
+
+inline BOOL IS_ALIGNED( size_t val, size_t alignment )
+{
+ LIMITED_METHOD_CONTRACT;
+ SUPPORTS_DAC;
+
+ // alignment must be a power of 2 for this implementation to work (need modulo otherwise)
+ _ASSERTE( 0 == (alignment & (alignment - 1)) );
+ return 0 == (val & (alignment - 1));
+}
+inline BOOL IS_ALIGNED( const void* val, size_t alignment )
+{
+ WRAPPER_NO_CONTRACT;
+ return IS_ALIGNED( (size_t) val, alignment );
+}
+
+// Rounds a ULONG up to the nearest power of two number.
+inline ULONG RoundUpToPower2(ULONG x)
+{
+ if (x == 0) return 1;
+
+ x = x - 1;
+ x = x | (x >> 1);
+ x = x | (x >> 2);
+ x = x | (x >> 4);
+ x = x | (x >> 8);
+ x = x | (x >> 16);
+ return x + 1;
+}
+
+#ifdef ALIGN_ACCESS
+
+// NOTE: pSrc is evaluated three times!!!
+#define MAYBE_UNALIGNED_READ(pSrc, bits) (IS_ALIGNED((size_t)(pSrc), sizeof(UINT##bits)) ? \
+ (*(UINT##bits*) (pSrc)) : \
+ (GET_UNALIGNED_##bits(pSrc)) )
+
+#define MAYBE_UNALIGNED_WRITE(pDst, bits, expr) do { if (IS_ALIGNED((size_t)(pDst), sizeof(UINT##bits))) \
+ *(UINT##bits*)(pDst) = (UINT##bits)(expr); else \
+ SET_UNALIGNED_##bits(pDst, (UINT##bits)(expr)); } while (0)
+
+// these are necessary for MAYBE_UNALIGNED_XXX to work with UINT_PTR
+#define GET_UNALIGNED__PTR(x) GET_UNALIGNED_PTR(x)
+#define SET_UNALIGNED__PTR(p,x) SET_UNALIGNED_PTR(p,x)
+
+#else // ALIGN_ACCESS
+#define MAYBE_UNALIGNED_READ(pSrc, bits) (*(UINT##bits*)(pSrc))
+#define MAYBE_UNALIGNED_WRITE(pDst, bits, expr) do { *(UINT##bits*)(pDst) = (UINT##bits)(expr); } while(0)
+#endif // ALIGN_ACCESS
+
+//
+// define some useful macros for logging object
+//
+
+#define FMT_OBJECT "object" FMT_ADDR
+#define FMT_HANDLE "handle" FMT_ADDR
+#define FMT_CLASS "%s"
+#define FMT_REG "r%d "
+#define FMT_STK "sp%s0x%02x "
+#define FMT_PIPTR "%s%s pointer "
+
+
+#define DBG_GET_CLASS_NAME(pMT) \
+ (pMT)->GetClass()->GetDebugClassName()
+
+#define DBG_CLASS_NAME_MT(pMT) \
+ (DBG_GET_CLASS_NAME(pMT) == NULL) ? "<null-class>" : DBG_GET_CLASS_NAME(pMT)
+
+#define DBG_GET_MT_FROM_OBJ(obj) \
+ (MethodTable*)((size_t)((Object*) (obj))->GetGCSafeMethodTable())
+
+#define DBG_CLASS_NAME_OBJ(obj) \
+ ((obj) == NULL) ? "null" : DBG_CLASS_NAME_MT(DBG_GET_MT_FROM_OBJ(obj))
+
+#define DBG_CLASS_NAME_IPTR2(obj,iptr) \
+ ((iptr) != 0) ? "" : DBG_CLASS_NAME_MT(DBG_GET_MT_FROM_OBJ(obj))
+
+#define DBG_CLASS_NAME_IPTR(obj,iptr) \
+ ((obj) == NULL) ? "null" : DBG_CLASS_NAME_IPTR2(obj,iptr)
+
+#define DBG_STK(off) \
+ (off >= 0) ? "+" : "-", \
+ (off >= 0) ? off : -off
+
+#define DBG_PIN_NAME(pin) \
+ (pin) ? "pinned " : ""
+
+#define DBG_IPTR_NAME(iptr) \
+ (iptr) ? "interior" : "base"
+
+#define LOG_HANDLE_OBJECT_CLASS(str1, hnd, str2, obj) \
+ str1 FMT_HANDLE str2 FMT_OBJECT FMT_CLASS "\n", \
+ DBG_ADDR(hnd), DBG_ADDR(obj), DBG_CLASS_NAME_OBJ(obj)
+
+#define LOG_OBJECT_CLASS(obj) \
+ FMT_OBJECT FMT_CLASS "\n", \
+ DBG_ADDR(obj), DBG_CLASS_NAME_OBJ(obj)
+
+#define LOG_PIPTR_OBJECT_CLASS(obj, pin, iptr) \
+ FMT_PIPTR FMT_ADDR FMT_CLASS "\n", \
+ DBG_PIN_NAME(pin), DBG_IPTR_NAME(iptr), \
+ DBG_ADDR(obj), DBG_CLASS_NAME_IPTR(obj,iptr)
+
+#define LOG_HANDLE_OBJECT(str1, hnd, str2, obj) \
+ str1 FMT_HANDLE str2 FMT_OBJECT "\n", \
+ DBG_ADDR(hnd), DBG_ADDR(obj)
+
+#define LOG_PIPTR_OBJECT(obj, pin, iptr) \
+ FMT_PIPTR FMT_ADDR "\n", \
+ DBG_PIN_NAME(pin), DBG_IPTR_NAME(iptr), \
+ DBG_ADDR(obj)
+
+#define UNIQUE_LABEL_DEF(a,x) a##x
+#define UNIQUE_LABEL_DEF_X(a,x) UNIQUE_LABEL_DEF(a,x)
+#ifdef _MSC_VER
+#define UNIQUE_LABEL(a) UNIQUE_LABEL_DEF_X(_unique_label_##a##_, __COUNTER__)
+#else
+#define UNIQUE_LABEL(a) UNIQUE_LABEL_DEF_X(_unique_label_##a##_, __LINE__)
+#endif
+
+
+#ifndef _countof
+#define _countof(_array) (sizeof(_array)/sizeof(_array[0]))
+#endif
+
+
+// This is temporary. LKG should provide these macros and we should then
+// remove STRUNCATE and _TRUNCATE from here.
+
+/* error codes */
+#if !defined(STRUNCATE)
+#define STRUNCATE 80
+#endif
+
+/* _TRUNCATE */
+#if !defined(_TRUNCATE)
+#define _TRUNCATE ((size_t)-1)
+#endif
+
+#endif //_stdmacros_h_
diff --git a/src/inc/stgpool.h b/src/inc/stgpool.h
new file mode 100644
index 0000000000..9eef70742e
--- /dev/null
+++ b/src/inc/stgpool.h
@@ -0,0 +1,1515 @@
+// 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.
+//*****************************************************************************
+// StgPool.h
+//
+
+//
+// Pools are used to reduce the amount of data actually required in the database.
+// This allows for duplicate string and binary values to be folded into one
+// copy shared by the rest of the database. Strings are tracked in a hash
+// table when insert/changing data to find duplicates quickly. The strings
+// are then persisted consecutively in a stream in the database format.
+//
+//*****************************************************************************
+
+#ifndef __StgPool_h__
+#define __StgPool_h__
+
+#ifdef _MSC_VER
+#pragma warning (disable : 4355) // warning C4355: 'this' : used in base member initializer list
+#endif
+
+#include "stgpooli.h" // Internal helpers.
+#include "corerror.h" // Error codes.
+#include "metadatatracker.h"
+#include "metamodelpub.h"
+#include "ex.h"
+#include "sarray.h"
+#include "memoryrange.h"
+#include "../md/hotdata/hotheap.h"
+
+#include "../md/debug_metadata.h"
+
+//*****************************************************************************
+// NOTE:
+// One limitation with the pools, we have no way to removing strings from
+// the pool. To remove, you need to know the ref count on the string, and
+// need the ability to compact the pool and reset all references.
+//*****************************************************************************
+
+//********** Constants ********************************************************
+const int DFT_STRING_HEAP_SIZE = 1024;
+const int DFT_GUID_HEAP_SIZE = 32;
+const int DFT_BLOB_HEAP_SIZE = 1024;
+const int DFT_VARIANT_HEAP_SIZE = 512;
+const int DFT_CODE_HEAP_SIZE = 8192;
+
+
+
+// Forwards.
+class StgStringPool;
+class StgBlobPool;
+class StgCodePool;
+class CorProfileData;
+
+// Perform binary search on index table.
+//
+class RIDBinarySearch : public CBinarySearch<UINT32>
+{
+public:
+ RIDBinarySearch(const UINT32 *pBase, int iCount) : CBinarySearch<UINT32>(pBase, iCount)
+ {
+ LIMITED_METHOD_CONTRACT;
+ } // RIDBinarySearch::RIDBinarySearch
+
+ int Compare(UINT32 const *pFirst, UINT32 const *pSecond)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ if (*pFirst < *pSecond)
+ return -1;
+
+ if (*pFirst > *pSecond)
+ return 1;
+
+ return 0;
+ } // RIDBinarySearch::Compare
+
+}; // class RIDBinarySearch
+
+//*****************************************************************************
+// This class provides common definitions for heap segments. It is both the
+// base class for the heap, and the class for heap extensions (additional
+// memory that must be allocated to grow the heap).
+//*****************************************************************************
+class StgPoolSeg
+{
+ friend class VerifyLayoutsMD;
+public:
+ StgPoolSeg() :
+ m_pSegData((BYTE*)m_zeros),
+ m_pNextSeg(NULL),
+ m_cbSegSize(0),
+ m_cbSegNext(0)
+ {LIMITED_METHOD_CONTRACT; }
+ ~StgPoolSeg()
+ { LIMITED_METHOD_CONTRACT; _ASSERTE(m_pSegData == m_zeros);_ASSERTE(m_pNextSeg == NULL); }
+protected:
+ BYTE *m_pSegData; // Pointer to the data.
+ StgPoolSeg *m_pNextSeg; // Pointer to next segment, or NULL.
+ // Size of the segment buffer. If this is last segment (code:m_pNextSeg is NULL), then it's the
+ // allocation size. If this is not the last segment, then this is shrinked to segment data size
+ // (code:m_cbSegNext).
+ ULONG m_cbSegSize;
+ ULONG m_cbSegNext; // Offset of next available byte in segment.
+ // Segment relative.
+
+ friend class StgPool;
+ friend class StgStringPool;
+ friend class StgGuidPool;
+ friend class StgBlobPool;
+ friend class RecordPool;
+
+public:
+ const BYTE *GetSegData() const { LIMITED_METHOD_CONTRACT; return m_pSegData; }
+ const StgPoolSeg* GetNextSeg() const { LIMITED_METHOD_CONTRACT; return m_pNextSeg; }
+ // Returns size of the segment. It can be bigger than the size of represented data by this segment if
+ // this is the last segment.
+ ULONG GetSegSize() const { LIMITED_METHOD_CONTRACT; return m_cbSegSize; }
+ // Returns size of represented data in this segment.
+ ULONG GetDataSize() const { LIMITED_METHOD_CONTRACT; return m_cbSegNext; }
+
+ static const BYTE m_zeros[64]; // array of zeros for "0" indices.
+ // The size should be at least maximum of all MD table record sizes
+ // (MD\Runtime\MDColumnDescriptors.cpp) which is currently 28 B.
+}; // class StgPoolSeg
+
+namespace MetaData
+{
+ // Forward declarations
+ class StringHeapRO;
+ class StringHeapRW;
+ class BlobHeapRO;
+}; // namespace MetaData
+
+//
+//
+// StgPoolReadOnly
+//
+//
+//*****************************************************************************
+// This is the read only StgPool class
+//*****************************************************************************
+class StgPoolReadOnly : public StgPoolSeg
+{
+friend class CBlobPoolHash;
+friend class MetaData::StringHeapRO;
+friend class MetaData::StringHeapRW;
+friend class MetaData::BlobHeapRO;
+friend class VerifyLayoutsMD;
+
+public:
+ StgPoolReadOnly()
+ { LIMITED_METHOD_CONTRACT; };
+
+ ~StgPoolReadOnly();
+
+
+//*****************************************************************************
+// Init the pool from existing data.
+//*****************************************************************************
+ __checkReturn
+ HRESULT InitOnMemReadOnly( // Return code.
+ void *pData, // Predefined data.
+ ULONG iSize); // Size of data.
+
+//*****************************************************************************
+// Prepare to shut down or reinitialize.
+//*****************************************************************************
+ virtual void Uninit();
+
+//*****************************************************************************
+// Return the size of the pool.
+//*****************************************************************************
+ virtual UINT32 GetPoolSize() const
+ { LIMITED_METHOD_CONTRACT; return m_cbSegSize; }
+
+//*****************************************************************************
+// Indicate if heap is empty.
+//*****************************************************************************
+ virtual int IsEmpty() // true if empty.
+ { LIMITED_METHOD_CONTRACT; _ASSERTE(!"This implementation should never be called!!!"); return FALSE; }
+
+//*****************************************************************************
+// true if the heap is read only.
+//*****************************************************************************
+ virtual int IsReadOnly() { LIMITED_METHOD_CONTRACT; return true ;};
+
+//*****************************************************************************
+// Is the given cookie a valid offset, index, etc?
+//*****************************************************************************
+ virtual int IsValidCookie(UINT32 nCookie)
+ { WRAPPER_NO_CONTRACT; return (IsValidOffset(nCookie)); }
+
+
+#ifdef _PREFAST_
+#pragma warning(push)
+#pragma warning(disable:6387) // Suppress PREFast warning: '*pszString' might be '0': this does not adhere to the specification for the function
+ // *pszString may be NULL only if method fails, but warning 6387 doesn't respect __success(SUCCEEDED(return)) which is part of HRESULT definition
+#endif
+//*****************************************************************************
+// Return a pointer to a null terminated string given an offset previously
+// handed out by AddString or FindString.
+//*****************************************************************************
+ __checkReturn
+ inline HRESULT GetString(
+ UINT32 nIndex,
+ __deref_out LPCSTR *pszString)
+ {
+ HRESULT hr;
+
+ // Size of the data in the heap will be ignored, because we have verified during creation of the string
+ // heap (code:Initialize) and when adding new strings (e.g. code:AddString,
+ // code:AddTemporaryStringBuffer), that the heap is null-terminated, therefore we don't have to check it
+ // for each string in the heap
+ MetaData::DataBlob stringData;
+
+ // Get data from the heap (clears stringData on error)
+ IfFailGo(GetData(
+ nIndex,
+ &stringData));
+ _ASSERTE(hr == S_OK);
+ // Raw data are always at least 1 byte long, otherwise it would be invalid offset and hr != S_OK
+ PREFAST_ASSUME(stringData.GetDataPointer() != NULL);
+ // Fills output string
+ *pszString = reinterpret_cast<LPSTR>(stringData.GetDataPointer());
+ //_ASSERTE(stringData.GetSize() > strlen(*pszString));
+
+ return hr;
+ ErrExit:
+ // Clears output string on error
+ *pszString = NULL;
+
+ return hr;
+ }
+#ifdef _PREFAST_
+#pragma warning(pop)
+#endif
+
+//*****************************************************************************
+// Convert a string to UNICODE into the caller's buffer.
+//*****************************************************************************
+ __checkReturn
+ virtual HRESULT GetStringW( // Return code.
+ ULONG iOffset, // Offset of string in pool.
+ __out_ecount(cchBuffer) LPWSTR szOut, // Output buffer for string.
+ int cchBuffer); // Size of output buffer.
+
+//*****************************************************************************
+// Copy a GUID into the caller's buffer.
+//*****************************************************************************
+ __checkReturn
+ HRESULT GetGuid(
+ UINT32 nIndex, // 1-based index of Guid in pool.
+ GUID UNALIGNED **ppGuid) // Output buffer for Guid.
+ {
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_FORBID_FAULT;
+
+ HRESULT hr;
+ MetaData::DataBlob heapData;
+
+ if (nIndex == 0)
+ {
+ *ppGuid = (GUID *)m_zeros;
+ return S_OK;
+ }
+
+ S_UINT32 nOffset = S_UINT32(nIndex - 1) * S_UINT32(sizeof(GUID));
+ if (nOffset.IsOverflow() || !IsValidOffset(nOffset.Value()))
+ {
+ Debug_ReportError("Invalid index passed - integer overflow.");
+ IfFailGo(CLDB_E_INDEX_NOTFOUND);
+ }
+ if (FAILED(GetData(nOffset.Value(), &heapData)))
+ {
+ if (nOffset.Value() == 0)
+ {
+ Debug_ReportError("Invalid index 0 passed.");
+ IfFailGo(CLDB_E_INDEX_NOTFOUND);
+ }
+ Debug_ReportInternalError("Invalid index passed.");
+ IfFailGo(CLDB_E_INTERNALERROR);
+ }
+ _ASSERTE(heapData.GetSize() >= sizeof(GUID));
+
+ *ppGuid = (GUID UNALIGNED *)heapData.GetDataPointer();
+ return S_OK;
+
+ ErrExit:
+ *ppGuid = (GUID *)m_zeros;
+ return hr;
+ } // StgPoolReadOnly::GetGuid
+
+//*****************************************************************************
+// Return a pointer to a null terminated blob given an offset previously
+// handed out by Addblob or Findblob.
+//*****************************************************************************
+ __checkReturn
+ virtual HRESULT GetBlob(
+ UINT32 nOffset, // Offset of blob in pool.
+ MetaData::DataBlob *pData);
+
+#ifdef FEATURE_PREJIT
+ // Initialize hot data structures.
+ // Method can be called multiple time, e.g. to disable usage of hot data structures in certain scenarios
+ // (see code:CMiniMd::DisableHotDataUsage).
+ void InitHotData(MetaData::HotHeap hotHeap)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+// @todo: Triton workaround: FEATURE_METADATA_STANDALNE_WINRT_RO is supposed to disable FEATURE_PREJIT - remove this #ifdef once we figure out how to get that working in the CoreClr build.
+#if !(defined(FEATURE_UTILCODE_NO_DEPENDENCIES) || defined(FEATURE_METADATA_STANDALNE_WINRT_RO))
+ m_HotHeap = hotHeap;
+#else
+ _ASSERTE(!"InitHotData(): Not supposed to exist in RoMetaData.dll");
+#endif //!(defined(FEATURE_UTILCODE_NO_DEPENDENCIES) || defined(FEATURE_METADATA_STANDALNE_WINRT_RO))
+ }
+#endif //FEATURE_PREJIT
+
+protected:
+
+//*****************************************************************************
+// Check whether a given offset is valid in the pool.
+//*****************************************************************************
+ virtual int IsValidOffset(UINT32 nOffset)
+ {LIMITED_METHOD_CONTRACT; return (nOffset == 0) || ((m_pSegData != m_zeros) && (nOffset < m_cbSegSize)); }
+
+//*****************************************************************************
+// Get a pointer to an offset within the heap. Inline for base segment,
+// helper for extension segments.
+//*****************************************************************************
+ __checkReturn
+ FORCEINLINE HRESULT GetDataReadOnly(UINT32 nOffset, __inout MetaData::DataBlob *pData)
+ {
+ LIMITED_METHOD_CONTRACT;
+ _ASSERTE(IsReadOnly());
+
+ // If off the end of the heap, return the 'nul' item from the beginning.
+ if (nOffset >= m_cbSegSize)
+ {
+ Debug_ReportError("Invalid offset passed.");
+ pData->Clear();
+ return CLDB_E_INDEX_NOTFOUND;
+ }
+
+// @todo: Triton workaround: FEATURE_METADATA_STANDALNE_WINRT_RO is supposed to disable FEATURE_PREJIT - remove this #if once we figure out how to get that working in the CoreClr build.
+#if !(defined(FEATURE_UTILCODE_NO_DEPENDENCIES) || defined(FEATURE_METADATA_STANDALNE_WINRT_RO))
+#ifdef FEATURE_PREJIT
+ // try hot data first
+ if (!m_HotHeap.IsEmpty())
+ {
+ HRESULT hr = m_HotHeap.GetData(nOffset, pData);
+ if ((hr == S_OK) || FAILED(hr))
+ {
+ return hr;
+ }
+ _ASSERTE(hr == S_FALSE);
+ }
+#endif //FEATURE_PREJIT
+#endif //!(defined(FEATURE_UTILCODE_NO_DEPENDENCIES) || defined(FEATURE_METADATA_STANDALNE_WINRT_RO))
+
+
+ pData->Init(m_pSegData + nOffset, m_cbSegSize - nOffset);
+
+ METADATATRACKER_ONLY(MetaDataTracker::NoteAccess((void *)pData->GetDataPointer()));
+
+ return S_OK;
+ } // StgPoolReadOnly::GetDataReadOnly
+
+//*****************************************************************************
+// Get a pointer to an offset within the heap. Inline for base segment,
+// helper for extension segments.
+//*****************************************************************************
+ __checkReturn
+ virtual HRESULT GetData(UINT32 nOffset, __inout MetaData::DataBlob *pData)
+ {
+ WRAPPER_NO_CONTRACT;
+ return GetDataReadOnly(nOffset, pData);
+ } // StgPoolReadOnly::GetData
+
+private:
+// @todo: Triton workaround: FEATURE_METADATA_STANDALNE_WINRT_RO is supposed to disable FEATURE_PREJIT - remove this #if once we figure out how to get that working in the CoreClr build.
+#if !(defined(FEATURE_UTILCODE_NO_DEPENDENCIES) || defined(FEATURE_METADATA_STANDALNE_WINRT_RO))
+ // hot pool data
+ MetaData::HotHeap m_HotHeap;
+#endif //!(defined(FEATURE_UTILCODE_NO_DEPENDENCIES) || defined(FEATURE_METADATA_STANDALNE_WINRT_RO))
+
+}; // class StgPoolReadOnly
+
+//
+//
+// StgBlobPoolReadOnly
+//
+//
+//*****************************************************************************
+// This is the read only StgBlobPool class
+//*****************************************************************************
+class StgBlobPoolReadOnly : public StgPoolReadOnly
+{
+public:
+//*****************************************************************************
+// Return a pointer to a null terminated blob given an offset
+//*****************************************************************************
+ __checkReturn
+ virtual HRESULT GetBlob(
+ UINT32 nOffset, // Offset of blob in pool.
+ MetaData::DataBlob *pData);
+
+protected:
+
+//*****************************************************************************
+// Check whether a given offset is valid in the pool.
+//*****************************************************************************
+ virtual int IsValidOffset(UINT32 nOffset)
+ {
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_FORBID_FAULT;
+
+ MetaData::DataBlob data;
+ return (StgBlobPoolReadOnly::GetBlob(nOffset, &data) == S_OK);
+ }
+
+}; // class StgBlobPoolReadOnly
+
+//
+//
+// StgPool
+//
+//
+
+//*****************************************************************************
+// This base class provides common pool management code, such as allocation
+// of dynamic memory.
+//*****************************************************************************
+class StgPool : public StgPoolReadOnly
+{
+friend class StgStringPool;
+friend class StgBlobPool;
+friend class RecordPool;
+friend class CBlobPoolHash;
+friend class VerifyLayoutsMD;
+
+public:
+ StgPool(ULONG ulGrowInc=512, UINT32 nAlignment=4) :
+ m_ulGrowInc(ulGrowInc),
+ m_pCurSeg(this),
+ m_cbCurSegOffset(0),
+ m_bFree(true),
+ m_bReadOnly(false),
+ m_nVariableAlignmentMask(nAlignment-1),
+ m_cbStartOffsetOfEdit(0),
+ m_fValidOffsetOfEdit(0)
+ { LIMITED_METHOD_CONTRACT; }
+
+ virtual ~StgPool();
+
+protected:
+ HRESULT Align(UINT32 nValue, UINT32 *pnAlignedValue) const
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ *pnAlignedValue = (nValue + m_nVariableAlignmentMask) & ~m_nVariableAlignmentMask;
+ if (*pnAlignedValue < nValue)
+ {
+ return COR_E_OVERFLOW;
+ }
+ return S_OK;
+ }
+
+public:
+//*****************************************************************************
+// Init the pool for use. This is called for the create empty case.
+//*****************************************************************************
+ __checkReturn
+ virtual HRESULT InitNew( // Return code.
+ ULONG cbSize=0, // Estimated size.
+ ULONG cItems=0); // Estimated item count.
+
+//*****************************************************************************
+// Init the pool from existing data.
+//*****************************************************************************
+ __checkReturn
+ virtual HRESULT InitOnMem( // Return code.
+ void *pData, // Predefined data.
+ ULONG iSize, // Size of data.
+ int bReadOnly); // true if append is forbidden.
+
+//*****************************************************************************
+// Called when the pool must stop accessing memory passed to InitOnMem().
+//*****************************************************************************
+ __checkReturn
+ virtual HRESULT TakeOwnershipOfInitMem();
+
+//*****************************************************************************
+// Clear out this pool. Cannot use until you call InitNew.
+//*****************************************************************************
+ virtual void Uninit();
+
+//*****************************************************************************
+// Called to copy the pool to writable memory, reset the r/o bit.
+//*****************************************************************************
+ __checkReturn
+ virtual HRESULT ConvertToRW();
+
+//*****************************************************************************
+// Turn hashing off or on. Implemented as required in subclass.
+//*****************************************************************************
+ __checkReturn
+ virtual HRESULT SetHash(int bHash);
+
+//*****************************************************************************
+// Allocate memory if we don't have any, or grow what we have. If successful,
+// then at least iRequired bytes will be allocated.
+//*****************************************************************************
+ bool Grow( // true if successful.
+ ULONG iRequired); // Min required bytes to allocate.
+
+//*****************************************************************************
+// Add a segment to the chain of segments.
+//*****************************************************************************
+ __checkReturn
+ virtual HRESULT AddSegment( // S_OK or error.
+ const void *pData, // The data.
+ ULONG cbData, // Size of the data.
+ bool bCopy); // If true, make a copy of the data.
+
+//*****************************************************************************
+// Trim any empty final segment.
+//*****************************************************************************
+ void Trim(); //
+
+//*****************************************************************************
+// Return the size in bytes of the persistent version of this pool. If
+// PersistToStream were the next call, the amount of bytes written to pIStream
+// has to be same as the return value from this function.
+//*****************************************************************************
+ __checkReturn
+ virtual HRESULT GetSaveSize(
+ UINT32 *pcbSaveSize) const
+ {
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_FORBID_FAULT;
+
+ _ASSERTE(pcbSaveSize != NULL);
+ // Size is offset of last seg + size of last seg.
+ UINT32 cbSize = m_pCurSeg->m_cbSegNext + m_cbCurSegOffset;
+
+ if (FAILED(Align(cbSize, pcbSaveSize)))
+ {
+ *pcbSaveSize = 0;
+ Debug_ReportInternalError("Aligned size of string heap overflows - we should prevent creating such heaps.");
+ return CLDB_E_INTERNALERROR;
+ }
+ return S_OK;
+ }
+
+//*****************************************************************************
+// Return the size in bytes of the edits contained in the persistent version of this pool.
+//*****************************************************************************
+ __checkReturn
+ HRESULT GetEditSaveSize(
+ UINT32 *pcbSaveSize) const // Return save size of this pool.
+ {
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_FORBID_FAULT;
+
+ _ASSERTE(pcbSaveSize != NULL);
+ UINT32 cbSize = 0;
+
+ if (HaveEdits())
+ {
+ // Size is offset of last seg + size of last seg.
+
+ // An offset of zero in the pool will give us a zero length blob. The first
+ // "real" user string is at offset 1. Wherever this delta gets applied, it will
+ // already have this zero length blob. Let's make sure we don't sent it another one.
+#ifdef _DEBUG
+ MetaData::DataBlob debug_data;
+ HRESULT hr = const_cast<StgPool *>(this)->GetData(0, &debug_data);
+ _ASSERTE(hr == S_OK);
+ _ASSERTE(debug_data.ContainsData(1));
+ _ASSERTE(*(debug_data.GetDataPointer()) == 0);
+#endif //_DEBUG
+ UINT32 nOffsetOfEdit = GetOffsetOfEdit();
+
+ if (nOffsetOfEdit == 0)
+ nOffsetOfEdit = 1;
+
+ cbSize = m_pCurSeg->m_cbSegNext + m_cbCurSegOffset - nOffsetOfEdit;
+ }
+
+ if (FAILED(Align(cbSize, pcbSaveSize)))
+ {
+ *pcbSaveSize = 0;
+ Debug_ReportInternalError("Aligned size of string heap overflows - we should prevent creating such heaps.");
+ return CLDB_E_INTERNALERROR;
+ }
+ return S_OK;
+ } // StgPool::GetEditSaveSize
+
+//*****************************************************************************
+// The entire pool is written to the given stream. The stream is aligned
+// to a 4 byte boundary.
+//*****************************************************************************
+ __checkReturn
+ virtual HRESULT PersistToStream( // Return code.
+ IStream *pIStream) // The stream to write to.
+ DAC_UNEXPECTED();
+
+//*****************************************************************************
+// A portion of the pool is written to the stream. Must not be optimized.
+//*****************************************************************************
+ __checkReturn
+ virtual HRESULT PersistPartialToStream( // Return code.
+ IStream *pIStream, // The stream to write to.
+ ULONG iOffset); // Starting byte.
+
+//*****************************************************************************
+// Get the size of the data block obtained from the pool.
+// Needed for generic persisting of data blocks.
+// Override in concrete pool classes to return the correct size.
+//*****************************************************************************
+ virtual ULONG GetSizeOfData( void const * data )
+ {
+ LIMITED_METHOD_CONTRACT;
+ return 0;
+ }
+
+//*****************************************************************************
+// Return the size of the pool.
+//*****************************************************************************
+ virtual UINT32 GetPoolSize() const
+ {LIMITED_METHOD_CONTRACT; return m_pCurSeg->m_cbSegNext + m_cbCurSegOffset; }
+
+//*****************************************************************************
+// Indicate if heap is empty.
+//*****************************************************************************
+ virtual int IsEmpty() // true if empty.
+ {LIMITED_METHOD_CONTRACT; return (m_pSegData == m_zeros); }
+
+//*****************************************************************************
+// true if the heap is read only.
+//*****************************************************************************
+ int IsReadOnly()
+ {LIMITED_METHOD_CONTRACT; return (m_bReadOnly == false); }
+
+//*****************************************************************************
+// Is the given cookie a valid offset, index, etc?
+//*****************************************************************************
+ virtual int IsValidCookie(UINT32 nCookie)
+ { WRAPPER_NO_CONTRACT; return (IsValidOffset(nCookie)); }
+
+//*****************************************************************************
+// Get a pointer to an offset within the heap. Inline for base segment,
+// helper for extension segments.
+//*****************************************************************************
+ __checkReturn
+ FORCEINLINE HRESULT GetData(UINT32 nOffset, MetaData::DataBlob *pData)
+ {
+ WRAPPER_NO_CONTRACT;
+ if (nOffset < m_cbSegNext)
+ {
+ pData->Init(m_pSegData + nOffset, m_cbSegNext - nOffset);
+ return S_OK;
+ }
+ else
+ {
+ return GetData_i(nOffset, pData);
+ }
+ } // StgPool::GetData
+
+ // Copies data from pSourcePool starting at index nStartSourceIndex.
+ __checkReturn
+ HRESULT CopyPool(
+ UINT32 nStartSourceIndex,
+ const StgPool *pSourcePool);
+
+//*****************************************************************************
+// Copies data from the pool into a buffer. It will correctly walk the different
+// segments for the copy
+//*****************************************************************************
+private:
+ __checkReturn
+ HRESULT CopyData(
+ UINT32 nOffset,
+ BYTE *pBuffer,
+ UINT32 cbBuffer,
+ UINT32 *pcbWritten) const;
+
+public:
+//*****************************************************************************
+// Helpers for dump utilities.
+//*****************************************************************************
+ UINT32 GetRawSize() const
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ // Size is offset of last seg + size of last seg.
+ return m_pCurSeg->m_cbSegNext + m_cbCurSegOffset;
+ }
+
+ BOOL HaveEdits() const {LIMITED_METHOD_CONTRACT; return m_fValidOffsetOfEdit;}
+ UINT32 GetOffsetOfEdit() const {LIMITED_METHOD_CONTRACT; return m_cbStartOffsetOfEdit;}
+ void ResetOffsetOfEdit() {LIMITED_METHOD_CONTRACT; m_fValidOffsetOfEdit=FALSE;}
+
+protected:
+
+//*****************************************************************************
+// Check whether a given offset is valid in the pool.
+//*****************************************************************************
+ virtual int IsValidOffset(UINT32 nOffset)
+ { WRAPPER_NO_CONTRACT; return (nOffset == 0) || ((m_pSegData != m_zeros) && (nOffset < GetNextOffset())); }
+
+ // Following virtual because a) this header included outside the project, and
+ // non-virtual function call (in non-expanded inline function!!) generates
+ // an external def, which causes linkage errors.
+ __checkReturn
+ virtual HRESULT GetData_i(UINT32 nOffset, MetaData::DataBlob *pData);
+
+ // Get pointer to next location to which to write.
+ BYTE *GetNextLocation()
+ {LIMITED_METHOD_CONTRACT; return (m_pCurSeg->m_pSegData + m_pCurSeg->m_cbSegNext); }
+
+ // Get pool-relative offset of next location to which to write.
+ ULONG GetNextOffset()
+ {LIMITED_METHOD_CONTRACT; return (m_cbCurSegOffset + m_pCurSeg->m_cbSegNext); }
+
+ // Get count of bytes available in tail segment of pool.
+ ULONG GetCbSegAvailable()
+ {LIMITED_METHOD_CONTRACT; return (m_pCurSeg->m_cbSegSize - m_pCurSeg->m_cbSegNext); }
+
+ // Allocate space from the segment.
+
+ void SegAllocate(ULONG cb)
+ {
+ LIMITED_METHOD_CONTRACT;
+ _ASSERTE(cb <= GetCbSegAvailable());
+
+ if (!m_fValidOffsetOfEdit)
+ {
+ m_cbStartOffsetOfEdit = GetNextOffset();
+ m_fValidOffsetOfEdit = TRUE;
+ }
+
+ m_pCurSeg->m_cbSegNext += cb;
+ }// SegAllocate
+
+
+
+ ULONG m_ulGrowInc; // How many bytes at a time.
+ StgPoolSeg *m_pCurSeg; // Current seg for append -- end of chain.
+ ULONG m_cbCurSegOffset; // Base offset of current seg.
+
+ unsigned m_bFree : 1; // True if we should free base data.
+ // Extension data is always freed.
+ unsigned m_bReadOnly : 1; // True if we shouldn't append.
+
+ UINT32 m_nVariableAlignmentMask; // Alignment mask (variable 0, 1 or 3).
+ UINT32 m_cbStartOffsetOfEdit; // Place in the pool where edits started
+ BOOL m_fValidOffsetOfEdit; // Is the pool edit offset valid
+
+};
+
+
+//
+//
+// StgStringPool
+//
+//
+
+
+
+//*****************************************************************************
+// This string pool class collects user strings into a big consecutive heap.
+// Internally it manages this data in a hash table at run time to help throw
+// out duplicates. The list of strings is kept in memory while adding, and
+// finally flushed to a stream at the caller's request.
+//*****************************************************************************
+class StgStringPool : public StgPool
+{
+ friend class VerifyLayoutsMD;
+public:
+ StgStringPool() :
+ StgPool(DFT_STRING_HEAP_SIZE),
+ m_Hash(this),
+ m_bHash(true)
+ {
+ LIMITED_METHOD_CONTRACT;
+ // force some code in debug.
+ _ASSERTE(m_bHash);
+ }
+
+//*****************************************************************************
+// Create a new, empty string pool.
+//*****************************************************************************
+ __checkReturn
+ HRESULT InitNew( // Return code.
+ ULONG cbSize=0, // Estimated size.
+ ULONG cItems=0); // Estimated item count.
+
+//*****************************************************************************
+// Load a string heap from persisted memory. If a copy of the data is made
+// (so that it may be updated), then a new hash table is generated which can
+// be used to elminate duplicates with new strings.
+//*****************************************************************************
+ __checkReturn
+ HRESULT InitOnMem( // Return code.
+ void *pData, // Predefined data.
+ ULONG iSize, // Size of data.
+ int bReadOnly); // true if append is forbidden.
+
+//*****************************************************************************
+// Clears the hash table then calls the base class.
+//*****************************************************************************
+ void Uninit();
+
+//*****************************************************************************
+// Turn hashing off or on. If you turn hashing on, then any existing data is
+// thrown away and all data is rehashed during this call.
+//*****************************************************************************
+ __checkReturn
+ virtual HRESULT SetHash(int bHash);
+
+//*****************************************************************************
+// The string will be added to the pool. The offset of the string in the pool
+// is returned in *piOffset. If the string is already in the pool, then the
+// offset will be to the existing copy of the string.
+//
+// The first version essentially adds a zero-terminated sequence of bytes
+// to the pool. MBCS pairs will not be converted to the appropriate UTF8
+// sequence. The second version converts from Unicode.
+//*****************************************************************************
+ __checkReturn
+ HRESULT AddString(
+ LPCSTR szString, // The string to add to pool.
+ UINT32 *pnOffset); // Return offset of string here.
+
+ __checkReturn
+ HRESULT AddStringW(
+ LPCWSTR szString, // The string to add to pool.
+ UINT32 *pnOffset); // Return offset of string here.
+
+//*****************************************************************************
+// Look for the string and return its offset if found.
+//*****************************************************************************
+ __checkReturn
+ HRESULT FindString( // S_OK, S_FALSE.
+ LPCSTR szString, // The string to find in pool.
+ ULONG *piOffset) // Return offset of string here.
+ {
+ WRAPPER_NO_CONTRACT;
+
+ STRINGHASH *pHash; // Hash item for lookup.
+ if ((pHash = m_Hash.Find(szString)) == 0)
+ return (S_FALSE);
+ *piOffset = pHash->iOffset;
+ return (S_OK);
+ }
+
+//*****************************************************************************
+// How many objects are there in the pool? If the count is 0, you don't need
+// to persist anything at all to disk.
+//*****************************************************************************
+ int Count()
+ {
+ WRAPPER_NO_CONTRACT;
+ _ASSERTE(m_bHash);
+ return (m_Hash.Count()); }
+
+//*****************************************************************************
+// String heap is considered empty if the only thing it has is the initial
+// empty string, or if after organization, there are no strings.
+//*****************************************************************************
+ int IsEmpty() // true if empty.
+ {
+ WRAPPER_NO_CONTRACT;
+
+ return (GetNextOffset() <= 1);
+ }
+
+//*****************************************************************************
+// Return the size in bytes of the persistent version of this pool. If
+// PersistToStream were the next call, the amount of bytes written to pIStream
+// has to be same as the return value from this function.
+//*****************************************************************************
+ __checkReturn
+ virtual HRESULT GetSaveSize(
+ UINT32 *pcbSaveSize) const
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ _ASSERTE(pcbSaveSize != NULL);
+
+ // Size is offset of last seg + size of last seg.
+ S_UINT32 cbSize = S_UINT32(m_pCurSeg->m_cbSegNext + m_cbCurSegOffset);
+
+ cbSize.AlignUp(4);
+
+ if (cbSize.IsOverflow())
+ {
+ *pcbSaveSize = 0;
+ Debug_ReportInternalError("Aligned size of string heap overflows - we should prevent creating such heaps.");
+ return CLDB_E_INTERNALERROR;
+ }
+ *pcbSaveSize = cbSize.Value();
+ return S_OK;
+ }
+
+//*****************************************************************************
+// Get the size of the string obtained from the pool.
+// Needed for generic persisting of data blocks.
+//*****************************************************************************
+ virtual ULONG GetSizeOfData( void const * data )
+ {
+ LIMITED_METHOD_CONTRACT;
+ return ULONG( strlen( reinterpret_cast< LPCSTR >( data ) ) + 1 ); // using strlen since the string is UTF8
+ }
+
+private:
+ __checkReturn
+ HRESULT RehashStrings();
+
+private:
+ CStringPoolHash m_Hash; // Hash table for lookups.
+ int m_bHash; // true to keep hash table.
+}; // class StgStringPool
+
+//
+//
+// StgGuidPool
+//
+//
+
+//*****************************************************************************
+// This Guid pool class collects user Guids into a big consecutive heap.
+// Internally it manages this data in a hash table at run time to help throw
+// out duplicates. The list of Guids is kept in memory while adding, and
+// finally flushed to a stream at the caller's request.
+//*****************************************************************************
+class StgGuidPool : public StgPool
+{
+ friend class VerifyLayoutsMD;
+public:
+ StgGuidPool() :
+ StgPool(DFT_GUID_HEAP_SIZE),
+ m_Hash(this),
+ m_bHash(true)
+ { LIMITED_METHOD_CONTRACT; }
+
+//*****************************************************************************
+// Init the pool for use. This is called for the create empty case.
+//*****************************************************************************
+ __checkReturn
+ HRESULT InitNew( // Return code.
+ ULONG cbSize=0, // Estimated size.
+ ULONG cItems=0); // Estimated item count.
+
+//*****************************************************************************
+// Load a Guid heap from persisted memory. If a copy of the data is made
+// (so that it may be updated), then a new hash table is generated which can
+// be used to elminate duplicates with new Guids.
+//*****************************************************************************
+ __checkReturn
+ HRESULT InitOnMem( // Return code.
+ void *pData, // Predefined data.
+ ULONG iSize, // Size of data.
+ int bReadOnly); // true if append is forbidden.
+
+//*****************************************************************************
+// Clears the hash table then calls the base class.
+//*****************************************************************************
+ void Uninit();
+
+//*****************************************************************************
+// Add a segment to the chain of segments.
+//*****************************************************************************
+ __checkReturn
+ virtual HRESULT AddSegment( // S_OK or error.
+ const void *pData, // The data.
+ ULONG cbData, // Size of the data.
+ bool bCopy); // If true, make a copy of the data.
+
+//*****************************************************************************
+// Turn hashing off or on. If you turn hashing on, then any existing data is
+// thrown away and all data is rehashed during this call.
+//*****************************************************************************
+ __checkReturn
+ virtual HRESULT SetHash(int bHash);
+
+//*****************************************************************************
+// The Guid will be added to the pool. The index of the Guid in the pool
+// is returned in *piIndex. If the Guid is already in the pool, then the
+// index will be to the existing copy of the Guid.
+//*****************************************************************************
+ __checkReturn
+ HRESULT AddGuid(
+ const GUID *pGuid, // The Guid to add to pool.
+ UINT32 *pnIndex); // Return index of Guid here.
+
+//*****************************************************************************
+// Get the size of the GUID obtained from the pool.
+// Needed for generic persisting of data blocks.
+//*****************************************************************************
+ virtual ULONG GetSizeOfData( void const * data )
+ {
+ LIMITED_METHOD_CONTRACT;
+ return sizeof( GUID );
+ }
+
+//*****************************************************************************
+// How many objects are there in the pool? If the count is 0, you don't need
+// to persist anything at all to disk.
+//*****************************************************************************
+ int Count()
+ {
+ WRAPPER_NO_CONTRACT;
+ _ASSERTE(m_bHash);
+ return (m_Hash.Count()); }
+
+//*****************************************************************************
+// Indicate if heap is empty. This has to be based on the size of the data
+// we are keeping. If you open in r/o mode on memory, there is no hash
+// table.
+//*****************************************************************************
+ virtual int IsEmpty() // true if empty.
+ {
+ WRAPPER_NO_CONTRACT;
+
+ return (GetNextOffset() == 0);
+ }
+
+//*****************************************************************************
+// Is the index valid for the GUID?
+//*****************************************************************************
+ virtual int IsValidCookie(UINT32 nCookie)
+ { WRAPPER_NO_CONTRACT; return ((nCookie == 0) || IsValidOffset((nCookie - 1) * sizeof(GUID))); }
+
+//*****************************************************************************
+// Return the size of the heap.
+//*****************************************************************************
+ ULONG GetNextIndex()
+ { LIMITED_METHOD_CONTRACT; return (GetNextOffset() / sizeof(GUID)); }
+
+//*****************************************************************************
+// Return the size in bytes of the persistent version of this pool. If
+// PersistToStream were the next call, the amount of bytes written to pIStream
+// has to be same as the return value from this function.
+//*****************************************************************************
+ __checkReturn
+ virtual HRESULT GetSaveSize(
+ UINT32 *pcbSaveSize) const
+ {
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_FORBID_FAULT;
+
+ _ASSERTE(pcbSaveSize != NULL);
+
+ // Size is offset of last seg + size of last seg.
+ *pcbSaveSize = m_pCurSeg->m_cbSegNext + m_cbCurSegOffset;
+
+ // Should be aligned.
+ _ASSERTE(*pcbSaveSize == ALIGN4BYTE(*pcbSaveSize));
+ return S_OK;
+ }
+
+private:
+
+ __checkReturn
+ HRESULT RehashGuids();
+
+
+private:
+ CGuidPoolHash m_Hash; // Hash table for lookups.
+ int m_bHash; // true to keep hash table.
+}; // class StgGuidPool
+
+//
+//
+// StgBlobPool
+//
+//
+
+//*****************************************************************************
+// Just like the string pool, this pool manages a list of items, throws out
+// duplicates using a hash table, and can be persisted to a stream. The only
+// difference is that instead of saving null terminated strings, this code
+// manages binary values of up to 64K in size. Any data you have larger than
+// this should be stored someplace else with a pointer in the record to the
+// external source.
+//*****************************************************************************
+class StgBlobPool : public StgPool
+{
+ friend class VerifyLayoutsMD;
+
+ using StgPool::InitNew;
+ using StgPool::InitOnMem;
+
+public:
+ StgBlobPool(ULONG ulGrowInc=DFT_BLOB_HEAP_SIZE) :
+ StgPool(ulGrowInc),
+ m_Hash(this)
+ { LIMITED_METHOD_CONTRACT; }
+
+//*****************************************************************************
+// Init the pool for use. This is called for the create empty case.
+//*****************************************************************************
+ __checkReturn
+ HRESULT InitNew( // Return code.
+ ULONG cbSize=0, // Estimated size.
+ ULONG cItems=0, // Estimated item count.
+ BOOL fAddEmptryItem=TRUE); // Should we add an empty item at offset 0
+
+//*****************************************************************************
+// Init the blob pool for use. This is called for both create and read case.
+// If there is existing data and bCopyData is true, then the data is rehashed
+// to eliminate dupes in future adds.
+//*****************************************************************************
+ __checkReturn
+ HRESULT InitOnMem( // Return code.
+ void *pData, // Predefined data.
+ ULONG iSize, // Size of data.
+ int bReadOnly); // true if append is forbidden.
+
+//*****************************************************************************
+// Clears the hash table then calls the base class.
+//*****************************************************************************
+ void Uninit();
+
+//*****************************************************************************
+// The blob will be added to the pool. The offset of the blob in the pool
+// is returned in *piOffset. If the blob is already in the pool, then the
+// offset will be to the existing copy of the blob.
+//*****************************************************************************
+ __checkReturn
+ HRESULT AddBlob(
+ const MetaData::DataBlob *pData,
+ UINT32 *pnOffset);
+
+//*****************************************************************************
+// Return a pointer to a null terminated blob given an offset previously
+// handed out by Addblob or Findblob.
+//*****************************************************************************
+ __checkReturn
+ virtual HRESULT GetBlob(
+ UINT32 nOffset, // Offset of blob in pool.
+ MetaData::DataBlob *pData);
+
+ __checkReturn
+ HRESULT GetBlobWithSizePrefix(
+ UINT32 nOffset, // Offset of blob in pool.
+ MetaData::DataBlob *pData);
+
+//*****************************************************************************
+// Turn hashing off or on. If you turn hashing on, then any existing data is
+// thrown away and all data is rehashed during this call.
+//*****************************************************************************
+ __checkReturn
+ virtual HRESULT SetHash(int bHash);
+
+//*****************************************************************************
+// Get the size of the blob obtained from the pool.
+// Needed for generic persisting of data blocks.
+//*****************************************************************************
+ virtual ULONG GetSizeOfData( void const * data )
+ {
+ WRAPPER_NO_CONTRACT;
+
+ void const * blobdata = 0;
+ ULONG blobsize = CPackedLen::GetLength( data, & blobdata ); // the size is encoded at the beginning of the block
+ return blobsize + static_cast< ULONG >( reinterpret_cast< BYTE const * >( blobdata ) - reinterpret_cast< BYTE const * >( data ) );
+ }
+
+//*****************************************************************************
+// How many objects are there in the pool? If the count is 0, you don't need
+// to persist anything at all to disk.
+//*****************************************************************************
+ int Count()
+ { WRAPPER_NO_CONTRACT; return (m_Hash.Count()); }
+
+//*****************************************************************************
+// String heap is considered empty if the only thing it has is the initial
+// empty string, or if after organization, there are no strings.
+//*****************************************************************************
+ virtual int IsEmpty() // true if empty.
+ {
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_FORBID_FAULT;
+
+ return (GetNextOffset() <= 1);
+ }
+
+//*****************************************************************************
+// Return the size in bytes of the persistent version of this pool. If
+// PersistToStream were the next call, the amount of bytes written to pIStream
+// has to be same as the return value from this function.
+//*****************************************************************************
+ __checkReturn
+ virtual HRESULT GetSaveSize(
+ UINT32 *pcbSaveSize) const
+ {
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_FORBID_FAULT;
+
+ return StgPool::GetSaveSize(pcbSaveSize);
+ }
+
+protected:
+
+//*****************************************************************************
+// Check whether a given offset is valid in the pool.
+//*****************************************************************************
+ virtual int IsValidOffset(UINT32 nOffset)
+ {
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_FORBID_FAULT;
+
+ MetaData::DataBlob data;
+ return (StgBlobPool::GetBlob(nOffset, &data) == S_OK);
+ }
+
+private:
+ __checkReturn
+ HRESULT RehashBlobs();
+
+ CBlobPoolHash m_Hash; // Hash table for lookups.
+}; // class StgBlobPool
+
+#ifdef _MSC_VER
+#pragma warning (default : 4355)
+#endif
+
+//*****************************************************************************
+// Unfortunately the CreateStreamOnHGlobal is a little too smart in that
+// it gets its size from GlobalSize. This means that even if you give it the
+// memory for the stream, it has to be globally allocated. We don't want this
+// because we have the stream read only in the middle of a memory mapped file.
+// CreateStreamOnMemory and the corresponding, internal only stream object solves
+// that problem.
+//*****************************************************************************
+class CInMemoryStream : public IStream
+{
+public:
+ CInMemoryStream() :
+ m_pMem(0),
+ m_cbSize(0),
+ m_cbCurrent(0),
+ m_cRef(1),
+ m_dataCopy(NULL)
+ { LIMITED_METHOD_CONTRACT; }
+
+ virtual ~CInMemoryStream() {}
+
+ void InitNew(
+ void *pMem,
+ ULONG cbSize)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_pMem = pMem;
+ m_cbSize = cbSize;
+ m_cbCurrent = 0;
+ }
+
+ ULONG STDMETHODCALLTYPE AddRef() {
+ LIMITED_METHOD_CONTRACT;
+ return InterlockedIncrement(&m_cRef);
+ }
+
+
+ ULONG STDMETHODCALLTYPE Release();
+
+ __checkReturn
+ HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, PVOID *ppOut);
+
+ __checkReturn
+ HRESULT STDMETHODCALLTYPE Read(void *pv, ULONG cb, ULONG *pcbRead);
+
+ __checkReturn
+ HRESULT STDMETHODCALLTYPE Write(const void *pv, ULONG cb, ULONG *pcbWritten);
+
+ __checkReturn
+ HRESULT STDMETHODCALLTYPE Seek(LARGE_INTEGER dlibMove,DWORD dwOrigin, ULARGE_INTEGER *plibNewPosition);
+
+ __checkReturn
+ HRESULT STDMETHODCALLTYPE SetSize(ULARGE_INTEGER libNewSize)
+ {
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_FAULT; //E_OUTOFMEMORY;
+
+ return (BadError(E_NOTIMPL));
+ }
+
+ __checkReturn
+ HRESULT STDMETHODCALLTYPE CopyTo(
+ IStream *pstm,
+ ULARGE_INTEGER cb,
+ ULARGE_INTEGER *pcbRead,
+ ULARGE_INTEGER *pcbWritten);
+
+ __checkReturn
+ HRESULT STDMETHODCALLTYPE Commit(
+ DWORD grfCommitFlags)
+ {
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_FAULT; //E_OUTOFMEMORY;
+
+ return (BadError(E_NOTIMPL));
+ }
+
+ __checkReturn
+ HRESULT STDMETHODCALLTYPE Revert()
+ {
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_FAULT; //E_OUTOFMEMORY;
+
+ return (BadError(E_NOTIMPL));
+ }
+
+ __checkReturn
+ HRESULT STDMETHODCALLTYPE LockRegion(
+ ULARGE_INTEGER libOffset,
+ ULARGE_INTEGER cb,
+ DWORD dwLockType)
+ {
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_FAULT; //E_OUTOFMEMORY;
+
+ return (BadError(E_NOTIMPL));
+ }
+
+ __checkReturn
+ HRESULT STDMETHODCALLTYPE UnlockRegion(
+ ULARGE_INTEGER libOffset,
+ ULARGE_INTEGER cb,
+ DWORD dwLockType)
+ {
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_FAULT; //E_OUTOFMEMORY;
+
+ return (BadError(E_NOTIMPL));
+ }
+
+ __checkReturn
+ HRESULT STDMETHODCALLTYPE Stat(
+ STATSTG *pstatstg,
+ DWORD grfStatFlag)
+ {
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_FAULT; //E_OUTOFMEMORY;
+
+ pstatstg->cbSize.QuadPart = m_cbSize;
+ return (S_OK);
+ }
+
+ __checkReturn
+ HRESULT STDMETHODCALLTYPE Clone(
+ IStream **ppstm)
+ {
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_FAULT; //E_OUTOFMEMORY;
+
+ return (BadError(E_NOTIMPL));
+ }
+
+ __checkReturn
+ static HRESULT CreateStreamOnMemory( // Return code.
+ void *pMem, // Memory to create stream on.
+ ULONG cbSize, // Size of data.
+ IStream **ppIStream, // Return stream object here.
+ BOOL fDeleteMemoryOnRelease = FALSE
+ );
+
+ __checkReturn
+ static HRESULT CreateStreamOnMemoryCopy(
+ void *pMem,
+ ULONG cbSize,
+ IStream **ppIStream);
+
+private:
+ void *m_pMem; // Memory for the read.
+ ULONG m_cbSize; // Size of the memory.
+ ULONG m_cbCurrent; // Current offset.
+ LONG m_cRef; // Ref count.
+ BYTE *m_dataCopy; // Optional copy of the data.
+}; // class CInMemoryStream
+
+//*****************************************************************************
+// CGrowableStream is a simple IStream implementation that grows as
+// its written to. All the memory is contigious, so read access is
+// fast. A grow does a realloc, so be aware of that if you're going to
+// use this.
+//*****************************************************************************
+
+// DPTR instead of VPTR because we don't actually call any of the virtuals.
+typedef DPTR(class CGrowableStream) PTR_CGrowableStream;
+
+class CGrowableStream : public IStream
+{
+public:
+ //Constructs a new GrowableStream
+ // multiplicativeGrowthRate - when the stream grows it will be at least this
+ // multiple of its old size. Values greater than 1 ensure O(N) amortized
+ // performance growing the stream to size N, 1 ensures O(N^2) amortized perf
+ // but gives the tightest memory usage. Valid range is [1.0, 2.0].
+ // additiveGrowthRate - when the stream grows it will increase in size by at least
+ // this number of bytes. Larger numbers cause fewer re-allocations at the cost of
+ // increased memory usage.
+ CGrowableStream(float multiplicativeGrowthRate = 2.0, DWORD additiveGrowthRate = 4096);
+
+#ifndef DACCESS_COMPILE
+ virtual ~CGrowableStream();
+#endif
+
+ // Expose the total raw buffer.
+ // This can be used by DAC to get the raw contents.
+ // This becomes potentiallyinvalid on the next call on the class, because the underlying storage can be
+ // reallocated.
+ MemoryRange GetRawBuffer() const
+ {
+ SUPPORTS_DAC;
+ PTR_VOID p = m_swBuffer;
+ return MemoryRange(p, m_dwBufferSize);
+ }
+
+private:
+ // Raw pointer to buffer. This may change as the buffer grows and gets reallocated.
+ PTR_BYTE m_swBuffer;
+
+ // Total size of the buffer in bytes.
+ DWORD m_dwBufferSize;
+
+ // Current index in the buffer. This can be moved around by Seek.
+ DWORD m_dwBufferIndex;
+
+ // Logical length of the stream
+ DWORD m_dwStreamLength;
+
+ // Reference count
+ LONG m_cRef;
+
+ // growth rate parameters determine new stream size when it must grow
+ float m_multiplicativeGrowthRate;
+ int m_additiveGrowthRate;
+
+ // Ensures the stream is physically and logically at least newLogicalSize
+ // in size
+ HRESULT EnsureCapacity(DWORD newLogicalSize);
+
+ // IStream methods
+public:
+
+#ifndef DACCESS_COMPILE
+ ULONG STDMETHODCALLTYPE AddRef() {
+ LIMITED_METHOD_CONTRACT;
+ return InterlockedIncrement(&m_cRef);
+ }
+
+
+ ULONG STDMETHODCALLTYPE Release();
+
+ __checkReturn
+ HRESULT STDMETHODCALLTYPE QueryInterface(REFIID riid, PVOID *ppOut);
+
+ STDMETHOD(Read)(
+ void * pv,
+ ULONG cb,
+ ULONG * pcbRead);
+
+ STDMETHOD(Write)(
+ const void * pv,
+ ULONG cb,
+ ULONG * pcbWritten);
+
+ STDMETHOD(Seek)(
+ LARGE_INTEGER dlibMove,
+ DWORD dwOrigin,
+ ULARGE_INTEGER * plibNewPosition);
+
+ STDMETHOD(SetSize)(ULARGE_INTEGER libNewSize);
+
+ STDMETHOD(CopyTo)(
+ IStream * pstm,
+ ULARGE_INTEGER cb,
+ ULARGE_INTEGER * pcbRead,
+ ULARGE_INTEGER * pcbWritten) { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_FAULT; return E_NOTIMPL; }
+
+ STDMETHOD(Commit)(
+ DWORD grfCommitFlags) { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_FAULT; return NOERROR; }
+
+ STDMETHOD(Revert)( void) {STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_FAULT; return E_NOTIMPL; }
+
+ STDMETHOD(LockRegion)(
+ ULARGE_INTEGER libOffset,
+ ULARGE_INTEGER cb,
+ DWORD dwLockType) { STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_FAULT; return E_NOTIMPL; }
+
+ STDMETHOD(UnlockRegion)(
+ ULARGE_INTEGER libOffset,
+ ULARGE_INTEGER cb,
+ DWORD dwLockType) {STATIC_CONTRACT_NOTHROW; STATIC_CONTRACT_FAULT; return E_NOTIMPL; }
+
+ STDMETHOD(Stat)(
+ STATSTG * pstatstg,
+ DWORD grfStatFlag);
+
+ // Make a deep copy of the stream into a new CGrowableStream instance
+ STDMETHOD(Clone)(
+ IStream ** ppstm);
+
+#endif // DACCESS_COMPILE
+}; // class CGrowableStream
+
+#endif // __StgPool_h__
diff --git a/src/inc/stgpooli.h b/src/inc/stgpooli.h
new file mode 100644
index 0000000000..a29fa01e75
--- /dev/null
+++ b/src/inc/stgpooli.h
@@ -0,0 +1,256 @@
+// 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.
+//*****************************************************************************
+// StgPooli.h
+//
+
+//
+// This is helper code for the string and blob pools. It is here because it is
+// secondary to the pooling interface and reduces clutter in the main file.
+//
+//*****************************************************************************
+
+#ifndef __StgPooli_h__
+#define __StgPooli_h__
+
+#include "utilcode.h" // Base hashing code.
+
+
+
+//
+//
+// CPackedLen
+//
+//
+
+//*****************************************************************************
+// Helper class to pack and unpack lengths.
+//*****************************************************************************
+struct CPackedLen
+{
+ enum {MAX_LEN = 0x1fffffff};
+ static int Size(ULONG len)
+ {
+ LIMITED_METHOD_CONTRACT;
+ // Smallest.
+ if (len <= 0x7F)
+ return 1;
+ // Medium.
+ if (len <= 0x3FFF)
+ return 2;
+ // Large (too large?).
+ _ASSERTE(len <= MAX_LEN);
+ return 4;
+ }
+
+ // Get a pointer to the data, and store the length.
+ static void const *GetData(void const *pData, ULONG *pLength);
+
+ // Get the length value encoded at *pData. Update ppData to point past data.
+ static ULONG GetLength(void const *pData, void const **ppData=0);
+
+ // Get the length value encoded at *pData, and the size of that encoded value.
+ static ULONG GetLength(void const *pData, int *pSizeOfLength);
+
+ // Pack a length at *pData; return a pointer to the next byte.
+ static void* PutLength(void *pData, ULONG len);
+
+ // This is used for just getting an encoded length, and verifies that
+ // there is no buffer or integer overflow.
+ static HRESULT SafeGetLength( // S_OK, or error
+ void const *pDataSource, // First byte of length.
+ void const *pDataSourceEnd, // End of valid source data memory
+ ULONG *pLength, // Encoded value
+ void const **ppDataNext); // Pointer immediately following encoded length
+
+ static HRESULT SafeGetLength( // S_OK, or error
+ BYTE const *pDataSource, // First byte of length.
+ BYTE const *pDataSourceEnd, // End of valid source data memory
+ ULONG *pLength, // Encoded value
+ BYTE const **ppDataNext) // Pointer immediately following encoded length
+ {
+ return SafeGetLength(
+ reinterpret_cast<void const *>(pDataSource),
+ reinterpret_cast<void const *>(pDataSourceEnd),
+ pLength,
+ reinterpret_cast<void const **>(ppDataNext));
+ }
+
+ // This performs the same tasks as GetLength above in addition to checking
+ // that the value in *pcbData does not extend *ppData beyond pDataSourceEnd
+ // and does not cause an integer overflow.
+ static HRESULT SafeGetData(
+ void const *pDataSource, // First byte of length.
+ void const *pDataSourceEnd, // End of valid source data memory
+ ULONG *pcbData, // Length of data
+ void const **ppData); // Start of data
+
+ static HRESULT SafeGetData(
+ BYTE const *pDataSource, // First byte of length.
+ BYTE const *pDataSourceEnd, // End of valid source data memory
+ ULONG *pcbData, // Length of data
+ BYTE const **ppData) // Start of data
+ {
+ return SafeGetData(
+ reinterpret_cast<void const *>(pDataSource),
+ reinterpret_cast<void const *>(pDataSourceEnd),
+ pcbData,
+ reinterpret_cast<void const **>(ppData));
+ }
+
+ // This is the same as GetData above except it takes a byte count instead
+ // of pointer to determine the source data length.
+ static HRESULT SafeGetData( // S_OK, or error
+ void const *pDataSource, // First byte of data
+ ULONG cbDataSource, // Count of valid bytes in data source
+ ULONG *pcbData, // Length of data
+ void const **ppData); // Start of data
+
+ static HRESULT SafeGetData(
+ BYTE const *pDataSource, // First byte of length.
+ ULONG cbDataSource, // Count of valid bytes in data source
+ ULONG *pcbData, // Length of data
+ BYTE const **ppData) // Start of data
+ {
+ return SafeGetData(
+ reinterpret_cast<void const *>(pDataSource),
+ cbDataSource,
+ pcbData,
+ reinterpret_cast<void const **>(ppData));
+ }
+};
+
+
+class StgPoolReadOnly;
+
+//*****************************************************************************
+// This hash class will handle strings inside of a chunk of the pool.
+//*****************************************************************************
+struct STRINGHASH : HASHLINK
+{
+ ULONG iOffset; // Offset of this item.
+};
+
+class CStringPoolHash : public CChainedHash<STRINGHASH>
+{
+ friend class VerifyLayoutsMD;
+public:
+ CStringPoolHash(StgPoolReadOnly *pool) : m_Pool(pool)
+ {
+ LIMITED_METHOD_CONTRACT;
+ }
+
+ virtual bool InUse(STRINGHASH *pItem)
+ {
+ LIMITED_METHOD_CONTRACT;
+ return (pItem->iOffset != 0xffffffff);
+ }
+
+ virtual void SetFree(STRINGHASH *pItem)
+ {
+ LIMITED_METHOD_CONTRACT;
+ pItem->iOffset = 0xffffffff;
+ }
+
+ virtual ULONG Hash(const void *pData)
+ {
+ WRAPPER_NO_CONTRACT;
+ return (HashStringA(reinterpret_cast<LPCSTR>(pData)));
+ }
+
+ virtual int Cmp(const void *pData, void *pItem);
+
+private:
+ StgPoolReadOnly *m_Pool; // String pool which this hashes.
+};
+
+
+//*****************************************************************************
+// This version is for byte streams with a 2 byte WORD giving the length of
+// the data.
+//*****************************************************************************
+typedef STRINGHASH BLOBHASH;
+
+class CBlobPoolHash : public CChainedHash<STRINGHASH>
+{
+ friend class VerifyLayoutsMD;
+public:
+ CBlobPoolHash(StgPoolReadOnly *pool) : m_Pool(pool)
+ {
+ LIMITED_METHOD_CONTRACT;
+ }
+
+ virtual bool InUse(BLOBHASH *pItem)
+ {
+ LIMITED_METHOD_CONTRACT;
+ return (pItem->iOffset != 0xffffffff);
+ }
+
+ virtual void SetFree(BLOBHASH *pItem)
+ {
+ LIMITED_METHOD_CONTRACT;
+ pItem->iOffset = 0xffffffff;
+ }
+
+ virtual ULONG Hash(const void *pData)
+ {
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_GC_NOTRIGGER;
+ STATIC_CONTRACT_FORBID_FAULT;
+
+ ULONG ulSize;
+ ulSize = CPackedLen::GetLength(pData);
+ ulSize += CPackedLen::Size(ulSize);
+ return (HashBytes(reinterpret_cast<BYTE const *>(pData), ulSize));
+ }
+
+ virtual int Cmp(const void *pData, void *pItem);
+
+private:
+ StgPoolReadOnly *m_Pool; // Blob pool which this hashes.
+};
+
+//*****************************************************************************
+// This hash class will handle guids inside of a chunk of the pool.
+//*****************************************************************************
+struct GUIDHASH : HASHLINK
+{
+ ULONG iIndex; // Index of this item.
+};
+
+class CGuidPoolHash : public CChainedHash<GUIDHASH>
+{
+ friend class VerifyLayoutsMD;
+public:
+ CGuidPoolHash(StgPoolReadOnly *pool) : m_Pool(pool)
+ {
+ LIMITED_METHOD_CONTRACT;
+ }
+
+ virtual bool InUse(GUIDHASH *pItem)
+ {
+ LIMITED_METHOD_CONTRACT;
+ return (pItem->iIndex != 0xffffffff);
+ }
+
+ virtual void SetFree(GUIDHASH *pItem)
+ {
+ LIMITED_METHOD_CONTRACT;
+ pItem->iIndex = 0xffffffff;
+ }
+
+ virtual ULONG Hash(const void *pData)
+ {
+ WRAPPER_NO_CONTRACT;
+ return (HashBytes(reinterpret_cast<BYTE const *>(pData), sizeof(GUID)));
+ }
+
+ virtual int Cmp(const void *pData, void *pItem);
+
+private:
+ StgPoolReadOnly *m_Pool; // The GUID pool which this hashes.
+};
+
+
+#endif // __StgPooli_h__
diff --git a/src/inc/stresslog.h b/src/inc/stresslog.h
new file mode 100644
index 0000000000..86dee130c4
--- /dev/null
+++ b/src/inc/stresslog.h
@@ -0,0 +1,841 @@
+// 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.
+
+
+/*************************************************************************************/
+/* StressLog.h */
+/*************************************************************************************/
+
+/* StressLog is a binary, memory based circular queue of logging messages. It is
+ intended to be used in retail builds during stress runs (activated
+ by registry key), so to help find bugs that only turn up during stress runs.
+
+ It is meant to have very low overhead and can not cause deadlocks, etc. It is
+ however thread safe */
+
+/* The log has a very simple structure, and it meant to be dumped from a NTSD
+ extention (eg. strike). There is no memory allocation system calls etc to purtub things */
+
+/* see the tools/strike/stressdump.cpp for the dumper utility that parses this log */
+
+/*************************************************************************************/
+
+#ifndef StressLog_h
+#define StressLog_h 1
+
+#include "log.h"
+
+#if defined(STRESS_LOG) && !defined(FEATURE_NO_STRESSLOG)
+#include "holder.h"
+#include "staticcontract.h"
+#include "mscoree.h"
+#include "clrinternal.h"
+#ifdef STRESS_LOG_READONLY
+#include <stddef.h> // offsetof
+#else //STRESS_LOG_READONLY
+#include "clrhost.h"
+#endif //STRESS_LOG_READONLY
+
+#ifndef _ASSERTE
+#define _ASSERTE(expr)
+#endif
+
+/* The STRESS_LOG* macros work like printf. In fact the use printf in their implementation
+ so all printf format specifications work. In addition the Stress log dumper knows
+ about certain suffixes for the %p format specification (normally used to print a pointer)
+
+ %pM // The pointer is a MethodDesc
+ %pT // The pointer is a type (MethodTable)
+ %pV // The pointer is a C++ Vtable pointer (useful for distinguishing different types of frames
+ %pK // The pointer is a code address (used for stack track)
+*/
+
+/* STRESS_LOG_VA was added to allow sendign GC trace output to the stress log. msg must be enclosed
+ in ()'s and contain a format string followed by 0 - 4 arguments. The arguments must be numbers or
+ string literals. LogMsgOL is overloaded so that all of the possible sets of parameters are covered.
+ This was done becasue GC Trace uses dprintf which dosen't contain info on how many arguments are
+ getting passed in and using va_args would require parsing the format string during the GC
+*/
+#define STRESS_LOG_VA(msg) do { \
+ if (StressLog::LogOn(LF_GC, LL_ALWAYS)) \
+ StressLog::LogMsgOL msg; \
+ LogSpewAlways msg; \
+ } while(0)
+
+#define STRESS_LOG0(facility, level, msg) do { \
+ if (StressLog::LogOn(facility, level)) \
+ StressLog::LogMsg(level, facility, 0, msg); \
+ LOG((facility, level, msg)); \
+ } while(0)
+
+#define STRESS_LOG1(facility, level, msg, data1) do { \
+ if (StressLog::LogOn(facility, level)) \
+ StressLog::LogMsg(level, facility, 1, msg, (void*)(size_t)(data1));\
+ LOG((facility, level, msg, data1)); \
+ } while(0)
+
+#define STRESS_LOG2(facility, level, msg, data1, data2) do { \
+ if (StressLog::LogOn(facility, level)) \
+ StressLog::LogMsg(level, facility, 2, msg, \
+ (void*)(size_t)(data1), (void*)(size_t)(data2)); \
+ LOG((facility, level, msg, data1, data2)); \
+ } while(0)
+
+#define STRESS_LOG2_CHECK_EE_STARTED(facility, level, msg, data1, data2) do { \
+ if (g_fEEStarted) \
+ STRESS_LOG2(facility, level, msg, data1, data2); \
+ else \
+ LOG((facility, level, msg, data1, data2)); \
+ } while(0)
+
+#define STRESS_LOG3(facility, level, msg, data1, data2, data3) do { \
+ if (StressLog::LogOn(facility, level)) \
+ StressLog::LogMsg(level, facility, 3, msg, \
+ (void*)(size_t)(data1),(void*)(size_t)(data2),(void*)(size_t)(data3)); \
+ LOG((facility, level, msg, data1, data2, data3)); \
+ } while(0)
+
+#define STRESS_LOG4(facility, level, msg, data1, data2, data3, data4) do { \
+ if (StressLog::LogOn(facility, level)) \
+ StressLog::LogMsg(level, facility, 4, msg, (void*)(size_t)(data1), \
+ (void*)(size_t)(data2),(void*)(size_t)(data3),(void*)(size_t)(data4)); \
+ LOG((facility, level, msg, data1, data2, data3, data4)); \
+ } while(0)
+
+#define STRESS_LOG5(facility, level, msg, data1, data2, data3, data4, data5) do { \
+ if (StressLog::LogOn(facility, level)) \
+ StressLog::LogMsg(level, facility, 5, msg, (void*)(size_t)(data1), \
+ (void*)(size_t)(data2),(void*)(size_t)(data3),(void*)(size_t)(data4), \
+ (void*)(size_t)(data5)); \
+ LOG((facility, level, msg, data1, data2, data3, data4, data5)); \
+ } while(0)
+
+#define STRESS_LOG6(facility, level, msg, data1, data2, data3, data4, data5, data6) do { \
+ if (StressLog::LogOn(facility, level)) \
+ StressLog::LogMsg(level, facility, 6, msg, (void*)(size_t)(data1), \
+ (void*)(size_t)(data2),(void*)(size_t)(data3),(void*)(size_t)(data4), \
+ (void*)(size_t)(data5), (void*)(size_t)(data6)); \
+ LOG((facility, level, msg, data1, data2, data3, data4, data5, data6)); \
+ } while(0)
+
+#define STRESS_LOG7(facility, level, msg, data1, data2, data3, data4, data5, data6, data7) do { \
+ if (StressLog::LogOn(facility, level)) \
+ StressLog::LogMsg(level, facility, 7, msg, (void*)(size_t)(data1), \
+ (void*)(size_t)(data2),(void*)(size_t)(data3),(void*)(size_t)(data4), \
+ (void*)(size_t)(data5), (void*)(size_t)(data6), (void*)(size_t)(data7)); \
+ LOG((facility, level, msg, data1, data2, data3, data4, data5, data6, data7)); \
+ } while(0)
+
+#define STRESS_LOG_COND0(facility, level, msg) do { \
+ if (StressLog::LogOn(facility, level) && (cond)) \
+ StressLog::LogMsg(level, facility, 0, msg); \
+ LOG((facility, level, msg)); \
+ } while(0)
+
+#define STRESS_LOG_COND1(facility, level, cond, msg, data1) do { \
+ if (StressLog::LogOn(facility, level) && (cond)) \
+ StressLog::LogMsg(level, facility, 1, msg, (void*)(size_t)(data1)); \
+ LOG((facility, level, msg, data1)); \
+ } while(0)
+
+#define STRESS_LOG_COND2(facility, level, cond, msg, data1, data2) do { \
+ if (StressLog::LogOn(facility, level) && (cond)) \
+ StressLog::LogMsg(level, facility, 2, msg, \
+ (void*)(size_t)(data1), (void*)(size_t)(data2)); \
+ LOG((facility, level, msg, data1, data2)); \
+ } while(0)
+
+#define STRESS_LOG_COND3(facility, level, cond, msg, data1, data2, data3) do { \
+ if (StressLog::LogOn(facility, level) && (cond)) \
+ StressLog::LogMsg(level, facility, 3, msg, \
+ (void*)(size_t)(data1),(void*)(size_t)(data2),(void*)(size_t)(data3)); \
+ LOG((facility, level, msg, data1, data2, data3)); \
+ } while(0)
+
+#define STRESS_LOG_COND4(facility, level, cond, msg, data1, data2, data3, data4) do { \
+ if (StressLog::LogOn(facility, level) && (cond)) \
+ StressLog::LogMsg(level, facility, 4, msg, (void*)(size_t)(data1), \
+ (void*)(size_t)(data2),(void*)(size_t)(data3),(void*)(size_t)(data4)); \
+ LOG((facility, level, msg, data1, data2, data3, data4)); \
+ } while(0)
+
+#define STRESS_LOG_COND5(facility, level, cond, msg, data1, data2, data3, data4, data5) do { \
+ if (StressLog::LogOn(facility, level) && (cond)) \
+ StressLog::LogMsg(level, facility, 5, msg, (void*)(size_t)(data1), \
+ (void*)(size_t)(data2),(void*)(size_t)(data3),(void*)(size_t)(data4), \
+ (void*)(size_t)(data5)); \
+ LOG((facility, level, msg, data1, data2, data3, data4, data5)); \
+ } while(0)
+
+#define STRESS_LOG_COND6(facility, level, cond, msg, data1, data2, data3, data4, data5, data6) do { \
+ if (StressLog::LogOn(facility, level) && (cond)) \
+ StressLog::LogMsg(level, facility, 6, msg, (void*)(size_t)(data1), \
+ (void*)(size_t)(data2),(void*)(size_t)(data3),(void*)(size_t)(data4), \
+ (void*)(size_t)(data5), (void*)(size_t)(data6)); \
+ LOG((facility, level, msg, data1, data2, data3, data4, data5, data6)); \
+ } while(0)
+
+#define STRESS_LOG_COND7(facility, level, cond, msg, data1, data2, data3, data4, data5, data6, data7) do { \
+ if (StressLog::LogOn(facility, level) && (cond)) \
+ StressLog::LogMsg(level, facility, 7, msg, (void*)(size_t)(data1), \
+ (void*)(size_t)(data2),(void*)(size_t)(data3),(void*)(size_t)(data4), \
+ (void*)(size_t)(data5), (void*)(size_t)(data6), (void*)(size_t)(data7)); \
+ LOG((facility, level, msg, data1, data2, data3, data4, data5, data6, data7)); \
+ } while(0)
+
+#define STRESS_LOG_RESERVE_MEM(numChunks) do { \
+ if (StressLog::StressLogOn(LF_ALL, LL_ALWAYS)) \
+ {StressLog::ReserveStressLogChunks (numChunks);} \
+ } while(0)
+// !!! WARNING !!!
+// !!! DO NOT ADD STRESS_LOG8, as the stress log infrastructure supports a maximum of 7 arguments
+// !!! WARNING !!!
+
+#define STRESS_LOG_PLUG_MOVE(plug_start, plug_end, plug_delta) do { \
+ if (StressLog::LogOn(LF_GC, LL_INFO1000)) \
+ StressLog::LogMsg(LL_INFO1000, LF_GC, 3, ThreadStressLog::gcPlugMoveMsg(), \
+ (void*)(size_t)(plug_start), (void*)(size_t)(plug_end), (void*)(size_t)(plug_delta)); \
+ LOG((LF_GC, LL_INFO10000, ThreadStressLog::gcPlugMoveMsg(), (plug_start), (plug_end), (plug_delta))); \
+ } while(0)
+
+#define STRESS_LOG_ROOT_PROMOTE(root_addr, objPtr, methodTable) do { \
+ if (StressLog::LogOn(LF_GC|LF_GCROOTS, LL_INFO1000)) \
+ StressLog::LogMsg(LL_INFO1000, LF_GC|LF_GCROOTS, 3, ThreadStressLog::gcRootPromoteMsg(), \
+ (void*)(size_t)(root_addr), (void*)(size_t)(objPtr), (void*)(size_t)(methodTable)); \
+ LOG((LF_GC|LF_GCROOTS, LL_INFO1000000, ThreadStressLog::gcRootPromoteMsg(), (root_addr), (objPtr), (methodTable))); \
+ } while(0)
+
+#define STRESS_LOG_ROOT_RELOCATE(root_addr, old_value, new_value, methodTable) do { \
+ if (StressLog::LogOn(LF_GC|LF_GCROOTS, LL_INFO1000) && ((size_t)(old_value) != (size_t)(new_value))) \
+ StressLog::LogMsg(LL_INFO1000, LF_GC|LF_GCROOTS, 4, ThreadStressLog::gcRootMsg(), \
+ (void*)(size_t)(root_addr), (void*)(size_t)(old_value), \
+ (void*)(size_t)(new_value), (void*)(size_t)(methodTable)); \
+ LOG((LF_GC|LF_GCROOTS, LL_INFO10000, ThreadStressLog::gcRootMsg(), (root_addr), (old_value), (new_value), (methodTable))); \
+ } while(0)
+
+#define STRESS_LOG_GC_START(gcCount, Gen, collectClasses) do { \
+ if (StressLog::LogOn(LF_GCROOTS|LF_GC|LF_GCALLOC, LL_INFO10)) \
+ StressLog::LogMsg(LL_INFO10, LF_GCROOTS|LF_GC|LF_GCALLOC, 3, ThreadStressLog::gcStartMsg(), \
+ (void*)(size_t)(gcCount), (void*)(size_t)(Gen), (void*)(size_t)(collectClasses)); \
+ LOG((LF_GCROOTS|LF_GC|LF_GCALLOC, LL_INFO10, ThreadStressLog::gcStartMsg(), (gcCount), (Gen), (collectClasses))); \
+ } while(0)
+
+#define STRESS_LOG_GC_END(gcCount, Gen, collectClasses) do { \
+ if (StressLog::LogOn(LF_GCROOTS|LF_GC|LF_GCALLOC, LL_INFO10)) \
+ StressLog::LogMsg(LL_INFO10, LF_GCROOTS|LF_GC|LF_GCALLOC, 3, ThreadStressLog::gcEndMsg(), \
+ (void*)(size_t)(gcCount), (void*)(size_t)(Gen), (void*)(size_t)(collectClasses), 0); \
+ LOG((LF_GCROOTS|LF_GC|LF_GCALLOC, LL_INFO10, ThreadStressLog::gcEndMsg(), (gcCount), (Gen), (collectClasses))); \
+ } while(0)
+
+#if defined(_DEBUG)
+#define MAX_CALL_STACK_TRACE 20
+#define STRESS_LOG_OOM_STACK(size) do { \
+ CantAllocHolder caHolder; \
+ if (StressLog::LogOn(LF_EEMEM, LL_ALWAYS)) \
+ { \
+ StressLog::LogMsgOL("OOM on alloc of size %x \n", (void*)(size_t)(size)); \
+ StressLog::LogCallStack ("OOM"); \
+ } \
+ } while(0)
+#define STRESS_LOG_GC_STACK do { \
+ if (StressLog::LogOn(LF_GC |LF_GCINFO, LL_ALWAYS)) \
+ { \
+ StressLog::LogMsgOL("GC is triggered \n"); \
+ StressLog::LogCallStack ("GC"); \
+ } \
+ } while(0)
+
+#else //!_DEBUG
+#define STRESS_LOG_OOM_STACK(size)
+#define STRESS_LOG_GC_STACK
+#endif //_DEBUG
+
+class ThreadStressLog;
+
+/*************************************************************************************/
+/* a log is a circular queue of messages */
+
+class StressLog {
+public:
+ static void Initialize(unsigned facilities, unsigned level, unsigned maxBytesPerThread,
+ unsigned maxBytesTotal, HMODULE hMod);
+ static void Terminate(BOOL fProcessDetach=FALSE);
+ static void ThreadDetach(ThreadStressLog *msgs); // call at DllMain THREAD_DETACH if you want to recycle thread logs
+ static int NewChunk ()
+ {
+ return InterlockedIncrement (&theLog.totalChunk);
+ }
+ static int ChunkDeleted ()
+ {
+ return InterlockedDecrement (&theLog.totalChunk);
+ }
+
+ //the result is not 100% accurate. If multiple threads call this funciton at the same time,
+ //we could allow the total size be bigger than required. But the memory won't grow forever
+ //and this is not critical so we don't try to fix the race
+ static BOOL AllowNewChunk (LONG numChunksInCurThread);
+
+ //preallocate Stress log chunks for current thread. The memory we could preallocate is still
+ //bounded by per thread size limit and total size limit. If chunksToReserve is 0, we will try to
+ //preallocate up to per thread size limit
+ static BOOL ReserveStressLogChunks (unsigned chunksToReserve);
+
+ // used by out of process debugger to dump the stress log to 'fileName'
+ // IDebugDataSpaces is the NTSD execution callback for getting process memory.
+ // This function is defined in the tools\strike\stressLogDump.cpp file
+ static HRESULT Dump(ULONG64 logAddr, const char* fileName, struct IDebugDataSpaces* memCallBack);
+
+ static BOOL StressLogOn(unsigned facility, unsigned level);
+ static BOOL ETWLogOn(unsigned facility, unsigned level);
+ static BOOL LogOn(unsigned facility, unsigned level);
+
+// private:
+ unsigned facilitiesToLog; // Bitvector of facilities to log (see loglf.h)
+ unsigned levelToLog; // log level (see log.h)
+ unsigned MaxSizePerThread; // maximum number of bytes each thread should have before wrapping
+ unsigned MaxSizeTotal; //maximum memory allowed for stress log
+ Volatile<LONG> totalChunk; //current number of total chunks allocated
+ Volatile<ThreadStressLog*> logs; // the list of logs for every thread.
+ Volatile<unsigned> TLSslot; // Each thread gets a log this is used to fetch each threads log
+ Volatile<LONG> deadCount; // count of dead threads in the log
+ CRITSEC_COOKIE lock; // lock
+ unsigned __int64 tickFrequency; // number of ticks per second
+ unsigned __int64 startTimeStamp; // start time from when tick counter started
+ FILETIME startTime; // time the application started
+ SIZE_T moduleOffset; // Used to compute format strings.
+
+// private:
+ static void Enter(CRITSEC_COOKIE dummy = NULL);
+ static void Leave(CRITSEC_COOKIE dummy = NULL);
+ static ThreadStressLog* CreateThreadStressLog();
+ static ThreadStressLog* CreateThreadStressLogHelper();
+
+ static BOOL InlinedStressLogOn(unsigned facility, unsigned level);
+ static BOOL InlinedETWLogOn(unsigned facility, unsigned level);
+
+ static void LogMsg(unsigned level, unsigned facility, int cArgs, const char* format, ... );
+
+// Support functions for STRESS_LOG_VA
+// We disable the warning "conversion from 'type' to 'type' of greater size" since everything will
+// end up on the stack, and LogMsg will know the size of the variable based on the format string.
+#ifdef _MSC_VER
+#pragma warning( push )
+#pragma warning( disable : 4312 )
+#endif
+ static void LogMsgOL(const char* format)
+ { LogMsg(LL_ALWAYS, LF_GC, 0, format); }
+
+ template < typename T1 >
+ static void LogMsgOL(const char* format, T1 data1)
+ {
+ static_assert_no_msg(sizeof(T1) <= sizeof(void*));
+ LogMsg(LL_ALWAYS, LF_GC, 1, format, (void*)(size_t)data1);
+ }
+
+ template < typename T1, typename T2 >
+ static void LogMsgOL(const char* format, T1 data1, T2 data2)
+ {
+ static_assert_no_msg(sizeof(T1) <= sizeof(void*) && sizeof(T2) <= sizeof(void*));
+ LogMsg(LL_ALWAYS, LF_GC, 2, format, (void*)(size_t)data1, (void*)(size_t)data2);
+ }
+
+ template < typename T1, typename T2, typename T3 >
+ static void LogMsgOL(const char* format, T1 data1, T2 data2, T3 data3)
+ {
+ static_assert_no_msg(sizeof(T1) <= sizeof(void*) && sizeof(T2) <= sizeof(void*) && sizeof(T3) <= sizeof(void*));
+ LogMsg(LL_ALWAYS, LF_GC, 3, format, (void*)(size_t)data1, (void*)(size_t)data2, (void*)(size_t)data3);
+ }
+
+ template < typename T1, typename T2, typename T3, typename T4 >
+ static void LogMsgOL(const char* format, T1 data1, T2 data2, T3 data3, T4 data4)
+ {
+ static_assert_no_msg(sizeof(T1) <= sizeof(void*) && sizeof(T2) <= sizeof(void*) && sizeof(T3) <= sizeof(void*) && sizeof(T4) <= sizeof(void*));
+ LogMsg(LL_ALWAYS, LF_GC, 4, format, (void*)(size_t)data1, (void*)(size_t)data2, (void*)(size_t)data3, (void*)(size_t)data4);
+ }
+
+ template < typename T1, typename T2, typename T3, typename T4, typename T5 >
+ static void LogMsgOL(const char* format, T1 data1, T2 data2, T3 data3, T4 data4, T5 data5)
+ {
+ static_assert_no_msg(sizeof(T1) <= sizeof(void*) && sizeof(T2) <= sizeof(void*) && sizeof(T3) <= sizeof(void*) && sizeof(T4) <= sizeof(void*) && sizeof(T5) <= sizeof(void*));
+ LogMsg(LL_ALWAYS, LF_GC, 5, format, (void*)(size_t)data1, (void*)(size_t)data2, (void*)(size_t)data3, (void*)(size_t)data4, (void*)(size_t)data5);
+ }
+
+ template < typename T1, typename T2, typename T3, typename T4, typename T5, typename T6 >
+ static void LogMsgOL(const char* format, T1 data1, T2 data2, T3 data3, T4 data4, T5 data5, T6 data6)
+ {
+ static_assert_no_msg(sizeof(T1) <= sizeof(void*) && sizeof(T2) <= sizeof(void*) && sizeof(T3) <= sizeof(void*) && sizeof(T4) <= sizeof(void*) && sizeof(T5) <= sizeof(void*) && sizeof(T6) <= sizeof(void*));
+ LogMsg(LL_ALWAYS, LF_GC, 6, format, (void*)(size_t)data1, (void*)(size_t)data2, (void*)(size_t)data3, (void*)(size_t)data4, (void*)(size_t)data5, (void*)(size_t)data6);
+ }
+
+ template < typename T1, typename T2, typename T3, typename T4, typename T5, typename T6, typename T7 >
+ static void LogMsgOL(const char* format, T1 data1, T2 data2, T3 data3, T4 data4, T5 data5, T6 data6, T7 data7)
+ {
+ static_assert_no_msg(sizeof(T1) <= sizeof(void*) && sizeof(T2) <= sizeof(void*) && sizeof(T3) <= sizeof(void*) && sizeof(T4) <= sizeof(void*) && sizeof(T5) <= sizeof(void*) && sizeof(T6) <= sizeof(void*) && sizeof(T7) <= sizeof(void*));
+ LogMsg(LL_ALWAYS, LF_GC, 7, format, (void*)(size_t)data1, (void*)(size_t)data2, (void*)(size_t)data3, (void*)(size_t)data4, (void*)(size_t)data5, (void*)(size_t)data6, (void*)(size_t)data7);
+ }
+
+#ifdef _MSC_VER
+#pragma warning( pop )
+#endif
+
+// We can only log the stacktrace on DEBUG builds!
+#ifdef _DEBUG
+typedef USHORT
+(__stdcall *PFNRtlCaptureStackBackTrace)(
+ IN ULONG FramesToSkip,
+ IN ULONG FramesToCapture,
+ OUT PVOID * BackTrace,
+ OUT PULONG BackTraceHash);
+
+ PFNRtlCaptureStackBackTrace RtlCaptureStackBackTrace;
+
+ static void LogCallStack(const char *const callTag);
+#endif //_DEBUG
+
+// private: // static variables
+ static StressLog theLog; // We only have one log, and this is it
+};
+
+typedef Holder<CRITSEC_COOKIE, StressLog::Enter, StressLog::Leave, NULL, CompareDefault<CRITSEC_COOKIE>, HSV_NoValidation> StressLogLockHolder;
+
+#if defined(DACCESS_COMPILE)
+inline BOOL StressLog::LogOn(unsigned facility, unsigned level)
+{
+ STATIC_CONTRACT_LEAF;
+ STATIC_CONTRACT_SUPPORTS_DAC;
+
+ // StressLog isn't dacized, and besides we don't want to log to it in DAC builds.
+ return FALSE;
+}
+#endif
+
+/*************************************************************************************/
+/* private classes */
+
+#if defined(_MSC_VER)
+#pragma warning(disable:4200 4201) // don't warn about 0 sized array below or unnamed structures
+#endif
+
+// The order of fields is important. Keep the prefix length as the first field.
+// And make sure the timeStamp field is naturally alligned, so we don't waste
+// space on 32-bit platforms
+struct StressMsg {
+ union {
+ struct {
+ DWORD_PTR numberOfArgs : 3; // at most 7 arguments
+ DWORD_PTR formatOffset : 29; // offset of string in mscorwks
+ };
+ DWORD_PTR fmtOffsCArgs; // for optimized access
+ };
+ DWORD_PTR facility; // facility used to log the entry
+ unsigned __int64 timeStamp; // time when mssg was logged
+ void* args[0]; // size given by numberOfArgs
+
+ static const size_t maxArgCnt = 7;
+ static const size_t maxOffset = 0x20000000;
+ static size_t maxMsgSize ()
+ { return sizeof(StressMsg) + maxArgCnt*sizeof(void*); }
+
+ friend class ThreadStressLog;
+ friend class StressLog;
+};
+#ifdef _WIN64
+#define STRESSLOG_CHUNK_SIZE (32 * 1024)
+#else //_WIN64
+#define STRESSLOG_CHUNK_SIZE (16 * 1024)
+#endif //_WIN64
+#define GC_STRESSLOG_MULTIPLY 5
+
+// a chunk of memory for stress log
+struct StressLogChunk
+{
+ StressLogChunk * prev;
+ StressLogChunk * next;
+ char buf[STRESSLOG_CHUNK_SIZE];
+ DWORD dwSig1;
+ DWORD dwSig2;
+
+#if !defined(STRESS_LOG_READONLY)
+ static HANDLE s_LogChunkHeap;
+
+ void * operator new (size_t) throw()
+ {
+ if (IsInCantAllocStressLogRegion ())
+ {
+ return NULL;
+ }
+
+ _ASSERTE (s_LogChunkHeap != NULL);
+ //no need to zero memory because we could handle garbage contents
+ return ClrHeapAlloc (s_LogChunkHeap, 0, S_SIZE_T(sizeof (StressLogChunk)));
+ }
+
+ void operator delete (void * chunk)
+ {
+ _ASSERTE (s_LogChunkHeap != NULL);
+ ClrHeapFree (s_LogChunkHeap, 0, chunk);
+ }
+#endif //!STRESS_LOG_READONLY
+
+ StressLogChunk (StressLogChunk * p = NULL, StressLogChunk * n = NULL)
+ :prev (p), next (n), dwSig1 (0xCFCFCFCF), dwSig2 (0xCFCFCFCF)
+ {}
+
+ char * StartPtr ()
+ {
+ return buf;
+ }
+
+ char * EndPtr ()
+ {
+ return buf + STRESSLOG_CHUNK_SIZE;
+ }
+
+ BOOL IsValid () const
+ {
+ return dwSig1 == 0xCFCFCFCF && dwSig2 == 0xCFCFCFCF;
+ }
+};
+
+// This class implements a circular stack of variable sized elements
+// .The buffer between startPtr-endPtr is used in a circular manner
+// to store instances of the variable-sized struct StressMsg.
+// The StressMsg are always aligned to endPtr, while the space
+// left between startPtr and the last element is 0-padded.
+// .curPtr points to the most recently written log message
+// .readPtr points to the next log message to be dumped
+// .hasWrapped is TRUE while dumping the log, if we had wrapped
+// past the endPtr marker, back to startPtr
+// The AdvanceRead/AdvanceWrite operations simply update the
+// readPtr / curPtr fields. thecaller is responsible for reading/writing
+// to the corresponding field
+class ThreadStressLog {
+ ThreadStressLog* next; // we keep a linked list of these
+ unsigned threadId; // the id for the thread using this buffer
+ BOOL isDead; // Is this thread dead
+ StressMsg* curPtr; // where packets are being put on the queue
+ StressMsg* readPtr; // where we are reading off the queue (used during dumping)
+ BOOL readHasWrapped; // set when read ptr has passed chunListTail
+ BOOL writeHasWrapped; // set when write ptr has passed chunListHead
+ StressLogChunk * chunkListHead; //head of a list of stress log chunks
+ StressLogChunk * chunkListTail; //tail of a list of stress log chunks
+ StressLogChunk * curReadChunk; //the stress log chunk we are currently reading
+ StressLogChunk * curWriteChunk; //the stress log chunk we are currently writing
+ LONG chunkListLength; // how many stress log chunks are in this stress log
+
+#ifdef STRESS_LOG_READONLY
+ FORCEINLINE StressMsg* AdvanceRead();
+#endif //STRESS_LOG_READONLY
+ FORCEINLINE StressMsg* AdvanceWrite(int cArgs);
+
+#ifdef STRESS_LOG_READONLY
+ inline StressMsg* AdvReadPastBoundary();
+#endif //STRESS_LOG_READONLY
+ inline StressMsg* AdvWritePastBoundary(int cArgs);
+
+#ifdef STRESS_LOG_READONLY
+ ThreadStressLog* FindLatestThreadLog() const;
+#endif //STRESS_LOG_READONLY
+ friend class StressLog;
+
+#ifndef STRESS_LOG_READONLY
+ FORCEINLINE BOOL GrowChunkList ()
+ {
+ _ASSERTE (chunkListLength >= 1);
+ if (!StressLog::AllowNewChunk (chunkListLength))
+ {
+ return FALSE;
+ }
+ StressLogChunk * newChunk = new StressLogChunk (chunkListTail, chunkListHead);
+ if (newChunk == NULL)
+ {
+ return FALSE;
+ }
+ StressLog::NewChunk ();
+ chunkListLength++;
+ chunkListHead->prev = newChunk;
+ chunkListTail->next = newChunk;
+ chunkListHead = newChunk;
+
+ return TRUE;
+ }
+#endif //!STRESS_LOG_READONLY
+
+public:
+#ifndef STRESS_LOG_READONLY
+ ThreadStressLog ()
+ {
+ chunkListHead = chunkListTail = curWriteChunk = NULL;
+ StressLogChunk * newChunk =new StressLogChunk;
+ //OOM or in cantalloc region
+ if (newChunk == NULL)
+ {
+ return;
+ }
+ StressLog::NewChunk ();
+
+ newChunk->prev = newChunk;
+ newChunk->next = newChunk;
+
+ chunkListHead = chunkListTail = newChunk;
+
+ next = NULL;
+ threadId = 0;
+ isDead = TRUE;
+ curPtr = NULL;
+ readPtr = NULL;
+ writeHasWrapped = FALSE;
+ curReadChunk = NULL;
+ curWriteChunk = NULL;
+ chunkListLength = 1;
+ }
+
+#endif //!STRESS_LOG_READONLY
+ ~ThreadStressLog ()
+ {
+ //no thing to do if the list is empty (failed to initialize)
+ if (chunkListHead == NULL)
+ {
+ return;
+ }
+#ifndef STRESS_LOG_READONLY
+ _ASSERTE (chunkListLength >= 1 && chunkListLength <= StressLog::theLog.totalChunk);
+#endif //!STRESS_LOG_READONLY
+ StressLogChunk * chunk = chunkListHead;
+
+ do
+ {
+ StressLogChunk * tmp = chunk;
+ chunk = chunk->next;
+ delete tmp;
+#ifndef STRESS_LOG_READONLY
+ StressLog::ChunkDeleted ();
+#endif //!STRESS_LOG_READONLY
+ } while (chunk != chunkListHead);
+ }
+
+ void Activate ()
+ {
+#ifndef STRESS_LOG_READONLY
+ //there is no need to zero buffers because we could handle garbage contents
+ threadId = GetCurrentThreadId ();
+ isDead = FALSE;
+ curWriteChunk = chunkListTail;
+ curPtr = (StressMsg *)curWriteChunk->EndPtr ();
+ writeHasWrapped = FALSE;
+#else //STRESS_LOG_READONLY
+ curReadChunk = curWriteChunk;
+ readPtr = curPtr;
+ readHasWrapped = FALSE;
+ // the last written log, if it wrapped around may have partially overwritten
+ // a previous record. Update curPtr to reflect the last safe beginning of a record,
+ // but curPtr shouldn't wrap around, otherwise it'll break our assumptions about stress
+ // log
+ curPtr = (StressMsg*)((char*)curPtr - StressMsg::maxMsgSize());
+ if (curPtr < (StressMsg*)curWriteChunk->StartPtr())
+ {
+ curPtr = (StressMsg *)curWriteChunk->StartPtr();
+ }
+ //corner case: the log is empty
+ if (readPtr == (StressMsg *)curReadChunk->EndPtr ())
+ {
+ AdvReadPastBoundary();
+ }
+#endif //!STRESS_LOG_READONLY
+ }
+
+ BOOL IsValid () const
+ {
+ return chunkListHead != NULL && (!curWriteChunk || curWriteChunk->IsValid ());
+ }
+
+#ifdef STRESS_LOG_READONLY
+ // Called while dumping. Returns true after all messages in log were dumped
+ FORCEINLINE BOOL CompletedDump ()
+ {
+ return readPtr->timeStamp == 0
+ //if read has passed end of list but write has not passed head of list yet, we are done
+ //if write has also wrapped, we are at the end if read pointer passed write pointer
+ || (readHasWrapped &&
+ (!writeHasWrapped || (curReadChunk == curWriteChunk && readPtr >= curPtr)));
+ }
+#endif //STRESS_LOG_READONLY
+
+ static const char* gcStartMsg()
+ {
+ STATIC_CONTRACT_LEAF;
+ return "{ =========== BEGINGC %d, (requested generation = %lu, collect_classes = %lu) ==========\n";
+ }
+
+ static const char* gcEndMsg()
+ {
+ STATIC_CONTRACT_LEAF;
+ return "========== ENDGC %d (gen = %lu, collect_classes = %lu) ===========}\n";
+ }
+
+ static const char* gcRootMsg()
+ {
+ STATIC_CONTRACT_LEAF;
+ return " GC Root %p RELOCATED %p -> %p MT = %pT\n";
+ }
+
+ static const char* gcRootPromoteMsg()
+ {
+ STATIC_CONTRACT_LEAF;
+ return " GCHeap::Promote: Promote GC Root *%p = %p MT = %pT\n";
+ }
+
+ static const char* gcPlugMoveMsg()
+ {
+ STATIC_CONTRACT_LEAF;
+ return "GC_HEAP RELOCATING Objects in heap within range [%p %p) by -0x%x bytes\n";
+ }
+
+ static const char* TaskSwitchMsg()
+ {
+ STATIC_CONTRACT_LEAF;
+ return "StressLog TaskSwitch Marker\n";
+ }
+
+ void LogMsg ( DWORD_PTR facility, int cArgs, const char* format, ... )
+ {
+ va_list Args;
+ va_start(Args, format);
+ LogMsg (facility, cArgs, format, Args);
+ va_end(Args);
+ }
+ void LogMsg ( DWORD_PTR facility, int cArgs, const char* format, va_list Args);
+#ifdef STRESS_LOG_READONLY
+ static size_t OffsetOfNext () {return offsetof (ThreadStressLog, next);}
+ static size_t OffsetOfListHead () {return offsetof (ThreadStressLog, chunkListHead);}
+#endif //STRESS_LOG_READONLY
+};
+
+#ifdef STRESS_LOG_READONLY
+/*********************************************************************************/
+// Called when dumping the log (by StressLog::Dump())
+// Updates readPtr to point to next stress messaage to be dumped
+// For convenience it returns the new value of readPtr
+inline StressMsg* ThreadStressLog::AdvanceRead() {
+ STATIC_CONTRACT_LEAF;
+ // advance the marker
+ readPtr = (StressMsg*)((char*)readPtr + sizeof(StressMsg) + readPtr->numberOfArgs*sizeof(void*));
+ // wrap around if we need to
+ if (readPtr >= (StressMsg *)curReadChunk->EndPtr ())
+ {
+ AdvReadPastBoundary();
+ }
+ return readPtr;
+}
+
+// It's the factored-out slow codepath for AdvanceRead() and
+// is only called by AdvanceRead().
+// Updates readPtr to and returns the first stress message >= startPtr
+inline StressMsg* ThreadStressLog::AdvReadPastBoundary() {
+ STATIC_CONTRACT_LEAF;
+ //if we pass boundary of tail list, we need to set has Wrapped
+ if (curReadChunk == chunkListTail)
+ {
+ readHasWrapped = TRUE;
+ //If write has not wrapped, we know the contents from list head to
+ //cur pointer is garbage, we don't need to read them
+ if (!writeHasWrapped)
+ {
+ return readPtr;
+ }
+ }
+ curReadChunk = curReadChunk->next;
+ void** p = (void**)curReadChunk->StartPtr();
+ while (*p == NULL && (size_t)(p-(void**)curReadChunk->StartPtr ()) < (StressMsg::maxMsgSize()/sizeof(void*)))
+ {
+ ++p;
+ }
+ // if we failed to find a valid start of a StressMsg fallback to startPtr (since timeStamp==0)
+ if (*p == NULL)
+ {
+ p = (void**) curReadChunk->StartPtr ();
+ }
+ readPtr = (StressMsg*)p;
+
+ return readPtr;
+}
+#endif //STRESS_LOG_READONLY
+/*********************************************************************************/
+// Called at runtime when writing the log (by StressLog::LogMsg())
+// Updates curPtr to point to the next spot in the log where we can write
+// a stress message with cArgs arguments
+// For convenience it returns a pointer to the empty slot where we can
+// write the next stress message.
+// cArgs is the number of arguments in the message to be written.
+inline StressMsg* ThreadStressLog::AdvanceWrite(int cArgs) {
+ STATIC_CONTRACT_LEAF;
+ // _ASSERTE(cArgs <= StressMsg::maxArgCnt);
+ // advance the marker
+ StressMsg* p = (StressMsg*)((char*)curPtr - sizeof(StressMsg) - cArgs*sizeof(void*));
+
+ //past start of current chunk
+ //wrap around if we need to
+ if (p < (StressMsg*)curWriteChunk->StartPtr ())
+ {
+ curPtr = AdvWritePastBoundary(cArgs);
+ }
+ else
+ {
+ curPtr = p;
+ }
+
+ return curPtr;
+}
+
+// It's the factored-out slow codepath for AdvanceWrite() and
+// is only called by AdvanceWrite().
+// Returns the stress message flushed against endPtr
+// In addition it writes NULLs b/w the startPtr and curPtr
+inline StressMsg* ThreadStressLog::AdvWritePastBoundary(int cArgs) {
+ STATIC_CONTRACT_WRAPPER;
+#ifndef STRESS_LOG_READONLY
+ //zeroed out remaining buffer
+ memset (curWriteChunk->StartPtr (), 0, (BYTE *)curPtr - (BYTE *)curWriteChunk->StartPtr ());
+
+ //if we are already at head of the list, try to grow the list
+ if (curWriteChunk == chunkListHead)
+ {
+ GrowChunkList ();
+ }
+#endif //!STRESS_LOG_READONLY
+
+ curWriteChunk = curWriteChunk->prev;
+#ifndef STRESS_LOG_READONLY
+ if (curWriteChunk == chunkListTail)
+ {
+ writeHasWrapped = TRUE;
+ }
+#endif //STRESS_LOG_READONLY
+ curPtr = (StressMsg*)((char*)curWriteChunk->EndPtr () - sizeof(StressMsg) - cArgs * sizeof(void*));
+ return curPtr;
+}
+
+#else // STRESS_LOG
+
+#define STRESS_LOG_VA(msg) do { } while(0)
+#define STRESS_LOG0(facility, level, msg) do { } while(0)
+#define STRESS_LOG1(facility, level, msg, data1) do { } while(0)
+#define STRESS_LOG2(facility, level, msg, data1, data2) do { } while(0)
+#define STRESS_LOG2_CHECK_EE_STARTED(facility, level, msg, data1, data2)do { } while(0)
+#define STRESS_LOG3(facility, level, msg, data1, data2, data3) do { } while(0)
+#define STRESS_LOG4(facility, level, msg, data1, data2, data3, data4) do { } while(0)
+#define STRESS_LOG5(facility, level, msg, data1, data2, data3, data4, data5) do { } while(0)
+#define STRESS_LOG6(facility, level, msg, data1, data2, data3, data4, data5, data6) do { } while(0)
+#define STRESS_LOG7(facility, level, msg, data1, data2, data3, data4, data5, data6, data7) do { } while(0)
+#define STRESS_LOG_PLUG_MOVE(plug_start, plug_end, plug_delta) do { } while(0)
+#define STRESS_LOG_ROOT_PROMOTE(root_addr, objPtr, methodTable) do { } while(0)
+#define STRESS_LOG_ROOT_RELOCATE(root_addr, old_value, new_value, methodTable) do { } while(0)
+#define STRESS_LOG_GC_START(gcCount, Gen, collectClasses) do { } while(0)
+#define STRESS_LOG_GC_END(gcCount, Gen, collectClasses) do { } while(0)
+#define STRESS_LOG_OOM_STACK(size) do { } while(0)
+#define STRESS_LOG_GC_STACK(size) do { } while(0)
+#define STRESS_LOG_RESERVE_MEM(numChunks) do {} while (0)
+#endif // STRESS_LOG
+
+#endif // StressLog_h
diff --git a/src/inc/stringarraylist.h b/src/inc/stringarraylist.h
new file mode 100644
index 0000000000..10401ac31b
--- /dev/null
+++ b/src/inc/stringarraylist.h
@@ -0,0 +1,31 @@
+// 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.
+
+#ifndef STRINGARRAYLIST_H_
+#define STRINGARRAYLIST_H_
+
+
+//
+// StringArrayList is a simple class which is used to contain a growable
+// list of Strings, stored in chunks. Based on top of ArrayList
+#include "arraylist.h"
+
+
+class StringArrayList
+{
+ ArrayList m_Elements;
+public:
+ DWORD GetCount() const;
+ SString& operator[] (DWORD idx) const;
+ SString& Get (DWORD idx) const;
+#ifndef DACCESS_COMPILE
+ void Append(const SString& string);
+ void AppendIfNotThere(const SString& string);
+#endif
+ ~StringArrayList();
+};
+
+
+#include "stringarraylist.inl"
+#endif
diff --git a/src/inc/stringarraylist.inl b/src/inc/stringarraylist.inl
new file mode 100644
index 0000000000..73ca405537
--- /dev/null
+++ b/src/inc/stringarraylist.inl
@@ -0,0 +1,76 @@
+// 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 "ex.h"
+
+inline SString& StringArrayList::operator[] (DWORD idx) const
+{
+ WRAPPER_NO_CONTRACT;
+ return Get(idx);
+}
+
+inline SString& StringArrayList::Get (DWORD idx) const
+{
+ WRAPPER_NO_CONTRACT;
+ PTR_SString ppRet=(PTR_SString)m_Elements.Get(idx);
+ return *ppRet;
+}
+
+inline DWORD StringArrayList::GetCount() const
+{
+ WRAPPER_NO_CONTRACT;
+ return m_Elements.GetCount();
+}
+
+#ifndef DACCESS_COMPILE
+inline void StringArrayList::Append(const SString& string)
+{
+ CONTRACTL
+ {
+ THROWS;
+ GC_NOTRIGGER;
+ }
+ CONTRACTL_END;
+ NewHolder<SString> pAdd=new SString(string);
+ pAdd->Normalize();
+ IfFailThrow(m_Elements.Append(pAdd));
+ pAdd.SuppressRelease();
+}
+
+inline void StringArrayList::AppendIfNotThere(const SString& string)
+{
+ CONTRACTL
+ {
+ THROWS;
+ GC_NOTRIGGER;
+ }
+ CONTRACTL_END;
+ for (DWORD i=0;i<GetCount();i++)
+ {
+ if(Get(i).Equals(string))
+ return;
+ }
+ Append(string);
+}
+
+#endif
+
+
+inline StringArrayList::~StringArrayList()
+{
+ CONTRACTL
+ {
+ DESTRUCTOR_CHECK;
+ NOTHROW;
+ GC_NOTRIGGER;
+ }
+ CONTRACTL_END;
+#ifndef DACCESS_COMPILE
+ for (DWORD i=0;i< GetCount() ;i++)
+ {
+ delete (SString*)m_Elements.Get(i);
+ }
+#endif
+}
+
diff --git a/src/inc/strongname.h b/src/inc/strongname.h
new file mode 100644
index 0000000000..9773f90956
--- /dev/null
+++ b/src/inc/strongname.h
@@ -0,0 +1,9 @@
+// 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.
+
+// The VM statically links StrongName APIs so we can suppress the warning.
+
+#define USE_DEPRECATED_CLR_API_WITHOUT_WARNING
+#include "../strongname/inc/strongname.h"
+#undef USE_DEPRECATED_CLR_API_WITHOUT_WARNING
diff --git a/src/inc/switches.h b/src/inc/switches.h
new file mode 100644
index 0000000000..f52f24bc67
--- /dev/null
+++ b/src/inc/switches.h
@@ -0,0 +1,268 @@
+// 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.
+//
+// switches.h switch configuration of common runtime features
+//
+
+
+#ifndef CROSSGEN_COMPILE
+#define STRESS_HEAP
+#endif
+
+#if !defined(CROSSGEN_COMPILE) && !defined(FEATURE_CORECLR)
+#define STRESS_THREAD
+#endif
+
+#define VERIFY_HEAP
+
+#define GC_CONFIG_DRIVEN
+
+// define this to test data safety for the DAC. See code:DataTest::TestDataSafety.
+#define TEST_DATA_CONSISTENCY
+
+#if !defined(STRESS_LOG) && !defined(FEATURE_UTILCODE_NO_DEPENDENCIES)
+#define STRESS_LOG
+#endif
+
+#if defined(_DEBUG) && !defined(DACCESS_COMPILE) && !defined(CROSSGEN_COMPILE)
+#define USE_CHECKED_OBJECTREFS
+#endif
+
+#define FAT_DISPATCH_TOKENS
+
+#define FEATURE_SHARE_GENERIC_CODE
+
+#if defined(_DEBUG) && !defined(DACCESS_COMPILE)
+ #define LOGGING
+#endif
+
+#if !defined(_TARGET_X86_)
+#define WIN64EXCEPTIONS
+#endif
+
+#if !defined(FEATURE_UTILCODE_NO_DEPENDENCIES)
+// Failpoint support
+#if defined(_DEBUG) && !defined(DACCESS_COMPILE) && !defined(FEATURE_PAL)
+#define FAILPOINTS_ENABLED
+#endif
+#endif //!defined(FEATURE_UTILCODE_NO_DEPENDENCIES)
+
+#if 0
+ #define APPDOMAIN_STATE
+ #define BREAK_ON_UNLOAD
+ #define AD_LOG_MEMORY
+ #define AD_NO_UNLOAD
+ #define AD_SNAPSHOT
+ #define BREAK_META_ACCESS
+ #define AD_BREAK_ON_CANNOT_UNLOAD
+ #define BREAK_ON_CLSLOAD
+
+ // Enable to track details of EESuspension
+ #define TIME_SUSPEND
+#endif // 0
+
+#ifndef DACCESS_COMPILE
+// Enabled to track GC statistics
+#define GC_STATS
+#endif
+
+#if !defined(FEATURE_CORECLR)
+#define EMIT_FIXUPS
+#endif
+
+#if defined(_DEBUG) && !defined(DACCESS_COMPILE) && (defined(_TARGET_X86_) || defined(_TARGET_AMD64_))
+// On x86/x64 Windows debug builds, respect the COMPlus_EnforceEEThreadNotRequiredContracts
+// runtime switch. See code:InitThreadManager and code:GetThreadGenericFullCheck
+#define ENABLE_GET_THREAD_GENERIC_FULL_CHECK
+#endif
+
+#if defined(_TARGET_X86_) || defined(_TARGET_ARM_)
+ #define PAGE_SIZE 0x1000
+ #define USE_UPPER_ADDRESS 0
+
+#elif defined(_TARGET_AMD64_) || defined(_TARGET_ARM64_)
+ #define PAGE_SIZE 0x1000
+ #define UPPER_ADDRESS_MAPPING_FACTOR 2
+ #define CLR_UPPER_ADDRESS_MIN 0x64400000000
+ #define CODEHEAP_START_ADDRESS 0x64480000000
+ #define CLR_UPPER_ADDRESS_MAX 0x644FC000000
+
+#if !defined(FEATURE_PAL)
+ #define USE_UPPER_ADDRESS 1
+#else
+ #define USE_UPPER_ADDRESS 0
+#endif // !FEATURE_PAL
+
+#else
+ #error Please add a new #elif clause and define all portability macros for the new platform
+#endif
+
+#ifndef OS_PAGE_SIZE
+#define OS_PAGE_SIZE PAGE_SIZE
+#endif
+
+#if defined(_WIN64)
+#define JIT_IS_ALIGNED
+#endif
+
+// ALLOW_SXS_JIT enables AltJit support for JIT-ing, via COMPlus_AltJit / COMPlus_AltJitName.
+// ALLOW_SXS_JIT_NGEN enables AltJit support for NGEN, via COMPlus_AltJitNgen / COMPlus_AltJitName.
+// Note that if ALLOW_SXS_JIT_NGEN is defined, then ALLOW_SXS_JIT must be defined.
+#define ALLOW_SXS_JIT
+#if defined(ALLOW_SXS_JIT)
+#define ALLOW_SXS_JIT_NGEN
+#endif // ALLOW_SXS_JIT
+
+#if defined(FEATURE_CORECLR)
+//master switch for gc suspension not based on hijacking
+#define FEATURE_ENABLE_GCPOLL
+#endif //FEATURE_CORECLR
+
+#if defined(FEATURE_ENABLE_GCPOLL) && defined(_TARGET_X86_)
+//this enables a fast version of the GC Poll helper instead of the default portable one.
+#define ENABLE_FAST_GCPOLL_HELPER
+#endif // defined(FEATURE_ENABLE_GCPOLL) && defined(_TARGET_X86_)
+
+#if !defined(FEATURE_PAL)
+// PLATFORM_SUPPORTS_THREADSUSPEND is defined for platforms where it is safe to call
+// SuspendThread. This API is dangerous on non-Windows platforms, as it can lead to
+// deadlocks, due to low level OS resources that the PAL is not aware of, or due to
+// the fact that PAL-unaware code in the process may hold onto some OS resources.
+#define PLATFORM_SUPPORTS_SAFE_THREADSUSPEND
+#endif // !FEATURE_PAL
+
+#if !defined(PLATFORM_SUPPORTS_SAFE_THREADSUSPEND) && !defined(FEATURE_ENABLE_GCPOLL)
+#error "Platform must support either safe thread suspension or GC polling"
+#endif
+
+#if defined(STRESS_HEAP) && defined(_DEBUG) && defined(FEATURE_HIJACK)
+#define HAVE_GCCOVER
+#endif
+
+#ifdef FEATURE_CORECLR
+//Turns on a startup delay to allow simulation of slower and faster startup times.
+#define ENABLE_STARTUP_DELAY
+#endif
+
+
+#ifndef ALLOW_LOCAL_WORKER
+#define ALLOW_LOCAL_WORKER
+#endif
+
+
+#ifdef _DEBUG
+
+//hurray DAC makes everything more fun - you can't have defines that control whether
+//or not data members are visible which differ between DAC and non-DAC builds.
+//All of the _DATA defines match DAC and non-DAC, the other defines here are off in the DAC.
+#if defined(PROFILING_SUPPORTED_DATA) || defined(PROFILING_SUPPORTED)
+// See code:ProfControlBlock#TestOnlyELT.
+#define PROF_TEST_ONLY_FORCE_ELT_DATA
+// See code:ProfControlBlock#TestOnlyObjectAllocated.
+#define PROF_TEST_ONLY_FORCE_OBJECT_ALLOCATED_DATA
+#endif // PROFILING_SUPPORTED_DATA || PROFILING_SUPPORTED
+
+#if defined(PROFILING_SUPPORTED)
+// See code:ProfControlBlock#TestOnlyELT.
+#define PROF_TEST_ONLY_FORCE_ELT
+// See code:ProfControlBlock#TestOnlyObjectAllocated.
+#define PROF_TEST_ONLY_FORCE_OBJECT_ALLOCATED
+#endif // PROFILING_SUPPORTED
+
+#endif // _DEBUG
+
+
+
+#if defined(PROFILING_SUPPORTED)
+// On desktop CLR builds, the profiling API uses the event log for end-user-friendly
+// diagnostic messages. CoreCLR on Windows ouputs debug strings for diagnostic messages.
+// Rotor builds have no access to event log message resources, though, so they simply
+// display popup dialogs for now.
+#define FEATURE_PROFAPI_EVENT_LOGGING
+#endif // defined(PROFILING_SUPPORTED)
+
+// Windows desktop supports the profiling API attach / detach feature.
+// This will eventually be supported on coreclr as well.
+#if defined(PROFILING_SUPPORTED) && !defined(FEATURE_CORECLR)
+#define FEATURE_PROFAPI_ATTACH_DETACH
+#endif
+
+// Windows desktop DAC builds need to see some of the data used in the profiling API
+// attach / detach feature, particularly Thread::m_dwProfilerEvacuationCounter
+#if defined(PROFILING_SUPPORTED_DATA) && !defined(FEATURE_CORECLR)
+#define DATA_PROFAPI_ATTACH_DETACH
+#endif
+
+// MUST NEVER CHECK IN WITH THIS ENABLED.
+// This is just for convenience in doing performance investigations in a checked-out enlistment.
+// #define FEATURE_ENABLE_NO_RANGE_CHECKS
+
+#ifndef FEATURE_CORECLR
+// This controls whether a compilation-timing feature that relies on Windows APIs, if available, else direct
+// hardware instructions (rdtsc), for accessing high-resolution hardware timers is enabled. This is disabled
+// in Silverlight (just to avoid thinking about whether the extra code space is worthwhile).
+#define FEATURE_JIT_TIMER
+#endif // FEATURE_CORECLR
+
+// This feature in RyuJIT supersedes the FEATURE_JIT_TIMER. In addition to supporting the time log file, this
+// feature also supports using COMPlus_JitTimeLogCsv=a.csv, which will dump method-level and phase-level timing
+// statistics. Also see comments on FEATURE_JIT_TIMER.
+#define FEATURE_JIT_METHOD_PERF
+
+
+#ifndef FEATURE_USE_ASM_GC_WRITE_BARRIERS
+// If we're not using assembly write barriers, then this turns on a performance measurement
+// mode that gathers and prints statistics about # of GC write barriers invokes.
+// #define FEATURE_COUNT_GC_WRITE_BARRIERS
+#endif
+
+// Enables a mode in which GC is completely conservative in stacks and registers: all stack slots and registers
+// are treated as potential pinned interior pointers. When enabled, the runtime flag COMPLUS_GCCONSERVATIVE
+// determines dynamically whether GC is conservative. Note that appdomain unload, LCG and unloadable assemblies
+// do not work reliably with conservative GC.
+#ifdef FEATURE_CORECLR
+#define FEATURE_CONSERVATIVE_GC 1
+#endif
+
+#if (defined(_TARGET_ARM_) && !defined(ARM_SOFTFP)) || defined(_TARGET_ARM64_)
+#define FEATURE_HFA
+#endif
+
+// ARM requires that 64-bit primitive types are aligned at 64-bit boundaries for interlocked-like operations.
+// Additionally the platform ABI requires these types and composite type containing them to be similarly
+// aligned when passed as arguments.
+#ifdef _TARGET_ARM_
+#define FEATURE_64BIT_ALIGNMENT
+#endif
+
+// Prefer double alignment for structs and arrays with doubles. Put arrays of doubles more agressively
+// into large object heap for performance because large object heap is 8 byte aligned
+#if !defined(FEATURE_64BIT_ALIGNMENT) && !defined(_WIN64)
+#define FEATURE_DOUBLE_ALIGNMENT_HINT
+#endif
+
+#if defined(FEATURE_CORESYSTEM)
+#define FEATURE_MINIMETADATA_IN_TRIAGEDUMPS
+#endif // defined(FEATURE_CORESYSTEM)
+
+#if defined(FEATURE_PREJIT) && defined(FEATURE_CORECLR) && defined(FEATURE_CORESYSTEM)
+// Desktop CLR allows profilers and debuggers to opt out of loading NGENd images, and to
+// JIT everything instead. "FEATURE_TREAT_NI_AS_MSIL_DURING_DIAGNOSTICS" is roughly the
+// equivalent for Apollo, where MSIL images may not be available at all.
+// FEATURE_TREAT_NI_AS_MSIL_DURING_DIAGNOSTICS allows profilers or debuggers to state
+// they don't want to use pregenerated code, and to instead load the NGENd image but
+// treat it as if it were MSIL by ignoring the prejitted code and prebaked structures,
+// and instead to JIT and load types at run-time.
+#define FEATURE_TREAT_NI_AS_MSIL_DURING_DIAGNOSTICS
+#endif
+
+// If defined, support interpretation.
+#if !defined(CROSSGEN_COMPILE)
+
+#if defined(ALLOW_SXS_JIT) && !defined(FEATURE_PAL)
+#define FEATURE_STACK_SAMPLING
+#endif // defined (ALLOW_SXS_JIT)
+
+#endif // !defined(CROSSGEN_COMPILE)
+
diff --git a/src/inc/sxshelpers.h b/src/inc/sxshelpers.h
new file mode 100644
index 0000000000..199c1d4f44
--- /dev/null
+++ b/src/inc/sxshelpers.h
@@ -0,0 +1,141 @@
+// 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.
+//****************************************************************************
+//
+// SxSHelpers.h
+//
+// Some helping classes and methods for SxS in mscoree and mscorwks/mscorsvr
+//
+
+//****************************************************************************
+
+
+#ifndef SXSHELPERS_H_
+#define SXSHELPERS_H_
+
+#define V1_VERSION_NUM W("v1.0.3705")
+
+// This string is the magic string located in the registry which determines that a key is actually
+// a version.
+//
+// For example:
+//
+// HCR/clsid/xxxx-xx-xx-xx/InprocServer32/1.0.3705.0
+// /1.0.3705.125
+//
+// If this SBSVERSIONVALUE is set as a ValueName in these
+// version keys, then we're saying that there is an implementation of the object
+// for that version of the runtime.
+//
+// i.e., if 1.0.3705.0 has the value name of SBSVERSIONVALUE, then 1.0.3705.0 implements
+// this class id.
+#define SBSVERSIONVALUE W("ImplementedInThisVersion")
+
+// Find the runtime version from registry for rclsid
+// If succeeded, *ppwzRuntimeVersion will have the runtime version
+// corresponding to the highest version
+// If failed, *ppwzRuntimeVersion will be NULL
+//
+// Note: If succeeded, this function will allocate memory for
+// *ppwzRuntimeVersion. It if the caller's repsonsibility to
+// release that memory
+HRESULT FindRuntimeVersionFromRegistry(
+ REFCLSID rclsid,
+ __deref_out_z LPWSTR *ppwzRuntimeVersion,
+ __deref_out_opt LPWSTR *ppwzSupportedVersions);
+
+// Find assembly info from registry for rclsid
+// If succeeded, *ppwzClassName, *ppwzAssemblyString, *ppwzCodeBase
+// will have their value corresponding to the highest version
+// If failed, they will be set to NULL
+// Note: If succeeded, this function will allocate memory for
+// *ppwzClassName, *ppwzAssemblyString and *ppwzCodeBase.
+// Caller is responsible to release them.
+//
+HRESULT FindShimInfoFromRegistry(
+ REFCLSID rclsid,
+ BOOL bLoadRecord,
+ WORD wHighestRuntimeMajorVersion,
+ WORD wHighestRuntimeMinorVersion,
+ __deref_out_z LPWSTR *ppwzClassName,
+ __deref_out_z LPWSTR *ppwzAssemblyString,
+ __deref_out_z LPWSTR *ppwzCodeBase);
+
+// Find assembly info from Win32 activattion context for rclsid
+// If succeeded, *ppwzRuntimeVersion, *ppwzClassName, *ppwzAssemblyString,
+// will have their value corresponding to the highest version
+// If failed, they will be set to NULL
+// Note: If succeeded, this function will allocate memory for
+// *ppwzClassName, *ppwzAssemblyString and *ppwzCodeBase.
+// Caller is responsible to release them.
+// Also notice codebase is not supported in Win32 case.
+//
+HRESULT FindShimInfoFromWin32(
+ REFCLSID rclsid,
+ BOOL bLoadRecord,
+ __deref_opt_out_opt LPWSTR *ppwzRuntimeVersion,
+ __deref_opt_out_opt LPWSTR *ppwszSupportedRuntimeVersions,
+ __deref_opt_out_opt LPWSTR *ppwzClassName,
+ __deref_opt_out_opt LPWSTR *ppwzAssemblyString,
+ BOOL *pfRegFreePIA);
+
+// Get information from the Win32 fusion about the config file and the application base.
+HRESULT GetConfigFileFromWin32Manifest(__out_ecount_part(dwBuffer, *pSize) WCHAR* buffer, SIZE_T dwBuffer, SIZE_T* pSize);
+HRESULT GetApplicationPathFromWin32Manifest(__out_ecount_part(dwBuffer, *pSize) WCHAR* buffer, SIZE_T dwBuffer, SIZE_T* pSize);
+
+
+//****************************************************************************
+// AssemblyVersion
+//
+// class to handle assembly version
+// Since only functions in this file will use it,
+// we declare it in the cpp file so other people won't use it.
+//
+//****************************************************************************
+class AssemblyVersion
+{
+ public:
+ // constructors
+ inline AssemblyVersion();
+
+ inline AssemblyVersion(AssemblyVersion& version);
+
+ // Init
+ HRESULT Init(__in_z LPCWSTR pwzVersion, BOOL bStartsWithV);
+ inline HRESULT Init(WORD major, WORD minor, WORD build, WORD revision);
+
+ // Mofifiers.
+ inline void SetBuild(WORD build);
+ inline void SetRevision(WORD revision);
+
+ // assign operator
+ inline AssemblyVersion& operator=(const AssemblyVersion& version);
+
+ // Comparison operator
+ friend BOOL operator==(const AssemblyVersion& version1,
+ const AssemblyVersion& version2);
+ friend BOOL operator>=(const AssemblyVersion& version1,
+ const AssemblyVersion& version2);
+
+ private:
+
+ // pwzVersion must have format of "a.b.c.d",
+ // where a,b,c,d are all numbers
+ HRESULT ValidateVersion(LPCWSTR pwzVersion);
+
+ private:
+ WORD _major;
+ WORD _minor;
+ WORD _build;
+ WORD _revision;
+};
+extern BOOL operator==(const AssemblyVersion& version1,
+ const AssemblyVersion& version2);
+
+extern BOOL operator>=(const AssemblyVersion& version1,
+ const AssemblyVersion& version2);
+inline BOOL operator<(const AssemblyVersion& version1,
+ const AssemblyVersion& version2);
+#include <sxshelpers.inl>
+#endif // SXSHELPERS_H_
diff --git a/src/inc/sxshelpers.inl b/src/inc/sxshelpers.inl
new file mode 100644
index 0000000000..3e42051aa9
--- /dev/null
+++ b/src/inc/sxshelpers.inl
@@ -0,0 +1,76 @@
+// 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.
+
+#ifndef _SXSHELPERS_INL_
+#define _SXSHELPERS_INL_
+
+AssemblyVersion::AssemblyVersion()
+:_major(0)
+,_minor(0)
+,_build(0)
+,_revision(0)
+{
+ LIMITED_METHOD_CONTRACT;
+
+}
+
+AssemblyVersion::AssemblyVersion(AssemblyVersion& version)
+{
+ LIMITED_METHOD_CONTRACT;
+
+ _major = version._major;
+ _minor = version._minor;
+ _build = version._build;
+ _revision = version._revision;
+}
+
+HRESULT AssemblyVersion::Init(WORD major, WORD minor, WORD build, WORD revision)
+{
+ LIMITED_METHOD_CONTRACT;
+
+ _major = major;
+ _minor = minor;
+ _build = build;
+ _revision = revision;
+
+ return S_OK;
+}
+
+
+void AssemblyVersion::SetBuild(WORD build)
+{
+ LIMITED_METHOD_CONTRACT;
+
+ _build = build;
+}
+
+void AssemblyVersion::SetRevision(WORD revision)
+{
+ LIMITED_METHOD_CONTRACT;
+
+ _revision = revision;
+}
+
+AssemblyVersion& AssemblyVersion::operator=(const AssemblyVersion& version)
+{
+ LIMITED_METHOD_CONTRACT;
+
+ _major = version._major;
+ _minor = version._minor;
+ _build = version._build;
+ _revision = version._revision;
+
+ return *this;
+}
+
+BOOL operator<(const AssemblyVersion& version1,
+ const AssemblyVersion& version2)
+{
+ WRAPPER_NO_CONTRACT;
+
+ return !operator>=(version1, version2);
+}
+
+
+#endif /* _SXSHELPERS_INL_ */
diff --git a/src/inc/testhook.h b/src/inc/testhook.h
new file mode 100644
index 0000000000..ba2435d3e7
--- /dev/null
+++ b/src/inc/testhook.h
@@ -0,0 +1,159 @@
+// 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.
+
+
+//
+
+#ifndef CLR_TESTHOOK_H
+#define CLR_TESTHOOK_H
+
+// {CCB32DA2-2544-4195-8552-AC1986A83C73}
+static const GUID IID_ICLRTestHook =
+{ 0xccb32da2, 0x2544, 0x4195, { 0x85, 0x52, 0xac, 0x19, 0x86, 0xa8, 0x3c, 0x73 } };
+static const GUID IID_ICLRTestHook2 =
+{ 0xccb32da2, 0x2544, 0x4195, { 0x85, 0x52, 0xac, 0x19, 0x86, 0xa8, 0x3c, 0x83 } };
+static const GUID IID_ICLRTestHook3 =
+{ 0xccb32da2, 0x2544, 0x4195, { 0x85, 0x52, 0xac, 0x19, 0x86, 0xa8, 0x3c, 0x84 } };
+static const GUID IID_ICLRTestHookManager =
+{ 0xccb32da2, 0x2544, 0x4195, { 0x85, 0x52, 0xac, 0x19, 0x86, 0xa8, 0x3c, 0x74 } };
+
+enum
+{
+ ADUF_ASYNCHRONOUS, //no wait
+ ADUF_NORMAL, //wait, might be kicked out
+ ADUF_FORCEFULLGC, //same as normal, but does full gc
+};
+
+enum
+{
+ RTS_INITIALIZED,
+ RTS_DEFAULTADREADY,
+ RTS_CALLINGENTRYPOINT
+};
+
+enum
+{
+ IM_FLAT=1,
+ IM_IMAGEMAP=2,
+ IM_FIXEDUP=4,
+ IM_LOADLIBRARY=0xc //always fixed up
+};
+
+class ICLRTestHook : public IUnknown
+{
+public:
+ STDMETHOD(AppDomainStageChanged)(DWORD adid,DWORD oldstage,DWORD newstage)=0;
+ STDMETHOD(NextFileLoadLevel)(DWORD adid, LPVOID domainfile,DWORD newlevel)=0;
+ STDMETHOD(CompletingFileLoadLevel)(DWORD adid, LPVOID domainfile,DWORD newlevel)=0;
+ STDMETHOD(CompletedFileLoadLevel)(DWORD adid, LPVOID domainfile,DWORD newlevel)=0;
+ STDMETHOD(EnteringAppDomain)(DWORD id)=0;
+ STDMETHOD(EnteredAppDomain)(DWORD id)=0;
+ STDMETHOD(LeavingAppDomain)(DWORD id)=0;
+ STDMETHOD(LeftAppDomain)(DWORD id)=0;
+ STDMETHOD(UnwindingThreads)(DWORD id) = 0;
+ STDMETHOD(UnwoundThreads)(DWORD id) = 0;
+ STDMETHOD(AppDomainCanBeUnloaded)(DWORD id, BOOL bUnsafePoint)=0;
+ STDMETHOD(AppDomainDestroyed)(DWORD id)=0;
+ STDMETHOD(RuntimeStarted)(DWORD code)=0;
+};
+
+class ICLRTestHook2 : public ICLRTestHook
+{
+public:
+ STDMETHOD(ImageMapped(LPCWSTR wszPath, LPCVOID pBaseAddress,DWORD flags))=0;
+};
+
+class ICLRTestHook3 : public ICLRTestHook2
+{
+public:
+ STDMETHOD(CompletedNativeImageBind)(LPVOID pFile,LPCUTF8 simpleName, BOOL hasNativeImage)=0;
+ STDMETHOD(AboutToLockImage)(LPCWSTR wszPath, BOOL bIsCompilationProcess)=0;
+ STDMETHOD(StartingNativeImageBind)(LPCWSTR wszAsmName, BOOL bIsCompilationProcess)=0;
+};
+
+class ICLRTestHookManager
+{
+public:
+ STDMETHOD(AddTestHook)(ICLRTestHook* hook)=0;
+ STDMETHOD(EnableSlowPath) (BOOL bEnable) =0;
+ STDMETHOD(UnloadAppDomain)(DWORD adid,DWORD flags)=0;
+ STDMETHOD_(VOID,DoApproriateWait)( int cObjs, HANDLE *pObjs, INT32 iTimeout, BOOL bWaitAll, int* res)=0;
+ STDMETHOD(GC)(int generation)=0;
+ STDMETHOD(GetSimpleName)(LPVOID domainfile,LPCUTF8* name)=0;
+ STDMETHOD_(INT_PTR,GetCurrentThreadType)(VOID)=0; //see clrhost.h
+ STDMETHOD_(INT_PTR,GetCurrentThreadLockCount) (VOID) =0;
+ STDMETHOD_(BOOL,IsPreemptiveGC)(VOID) =0;
+ STDMETHOD_(BOOL,ThreadCanBeAborted) (VOID) = 0;
+};
+
+class ICLRTestHookManager2 : public ICLRTestHookManager
+{
+public:
+ STDMETHOD(HasNativeImage)(LPVOID domainfile,BOOL* pHasNativeImage) = 0;
+};
+
+//sample implementation
+class CLRTestHook : public ICLRTestHook3
+{
+private:
+ LONG m_cRef;
+public:
+ CLRTestHook()
+ {
+ m_cRef=0;
+ }
+ virtual ~CLRTestHook() {}
+ STDMETHOD(AppDomainStageChanged)(DWORD adid,DWORD oldstage,DWORD newstage){ return S_OK;};
+ STDMETHOD(NextFileLoadLevel)(DWORD adid, LPVOID domainfile,DWORD newlevel){ return S_OK;};
+ STDMETHOD(CompletingFileLoadLevel)(DWORD adid, LPVOID domainfile,DWORD newlevel){ return S_OK;};
+ STDMETHOD(CompletedFileLoadLevel)(DWORD adid, LPVOID domainfile,DWORD newlevel){ return S_OK;};
+ STDMETHOD(EnteringAppDomain)(DWORD id){ return S_OK;};
+ STDMETHOD(EnteredAppDomain)(DWORD id){ return S_OK;};
+ STDMETHOD(LeavingAppDomain)(DWORD id){ return S_OK;};
+ STDMETHOD(LeftAppDomain)(DWORD id){ return S_OK;};
+ STDMETHOD(UnwindingThreads)(DWORD id) {return S_OK;};
+ STDMETHOD(UnwoundThreads)(DWORD id) {return S_OK;};
+ STDMETHOD(AppDomainCanBeUnloaded)(DWORD id, BOOL bUnsafePoint){ return S_OK;};
+ STDMETHOD(AppDomainDestroyed)(DWORD id){ return S_OK;};
+ STDMETHOD(RuntimeStarted)(DWORD code){ return S_OK;};
+ STDMETHOD(ImageMapped(LPCWSTR wszPath, LPCVOID pBaseAddress,DWORD flags)){return S_OK;};
+ STDMETHOD(CompletedNativeImageBind)(LPVOID pFile,LPCUTF8 simpleName, BOOL hasNativeImage){return S_OK;};
+ STDMETHOD(AboutToLockImage)(LPCWSTR wszPath, BOOL bIsCompilationProcess){return S_OK;};
+ STDMETHOD(StartingNativeImageBind)(LPCWSTR wszAsmName, BOOL bIsCompilationProcess){return S_OK;};
+ STDMETHOD_(ULONG,AddRef)()
+ {
+ return InterlockedIncrement(&m_cRef);
+ };
+ STDMETHOD_(ULONG,Release)()
+ {
+ ULONG ulRef = InterlockedDecrement(&m_cRef);
+ if (!ulRef)
+ delete this;
+ return ulRef;
+ };
+ STDMETHOD(QueryInterface)(REFIID riid, void** ppv)
+ {
+ if (!ppv)
+ return E_POINTER;
+
+ if ( IsEqualIID(riid, IID_IUnknown)
+ || IsEqualIID(riid, IID_ICLRTestHook)
+ || IsEqualIID(riid, IID_ICLRTestHook2)
+ || IsEqualIID(riid, IID_ICLRTestHook3))
+ {
+ AddRef();
+ *ppv = static_cast<ICLRTestHook3*>(this);
+ return S_OK;
+ }
+ else
+ {
+ *ppv = NULL;
+ return E_NOINTERFACE;
+ }
+ };
+};
+
+typedef void CALLBACK CLRTESTHOOKPROC(ICLRTestHookManager*);
+
+#endif
diff --git a/src/inc/tlbimpexp.idl b/src/inc/tlbimpexp.idl
new file mode 100644
index 0000000000..b7b117495b
--- /dev/null
+++ b/src/inc/tlbimpexp.idl
@@ -0,0 +1,72 @@
+// 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.
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+// .Net Developer Platform TypeLib importer/exporter event notification
+// interface definitions.
+//
+// NOTE: This IDL must remain synchronized with the definitions in
+// BCL/System/Runtime/InteropServices/ITypeLibConverter.cs.
+//++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
+
+[
+ uuid(20BC1825-06F0-11d2-8CF4-00A0C9B0A063),
+ version(1.0)
+]
+library TlbImpLib
+{
+ importlib("stdole32.tlb") ;
+
+ typedef [uuid(F82895D2-1338-36A8-9A89-F9B0AFBE7801)]
+ enum {
+ NOTIF_TYPECONVERTED = 0,
+ NOTIF_CONVERTWARNING = 1,
+ ERROR_REFTOINVALIDTYPELIB = 2
+ } ImporterEventKind;
+
+ [
+ odl,
+ uuid(F1C3BF76-C3E4-11D3-88E7-00902754C43A),
+ oleautomation
+ ]
+ interface ITypeLibImporterNotifySink : IUnknown {
+ HRESULT _stdcall ReportEvent(
+ [in] ImporterEventKind EventKind,
+ [in] long EventCode,
+ [in] BSTR EventMsg);
+ HRESULT _stdcall ResolveRef(
+ [in] IUnknown* Typelib,
+ [out, retval] IUnknown** pRetVal);
+ };
+
+ [
+ odl,
+ uuid(F1C3BF77-C3E4-11D3-88E7-00902754C43A),
+ oleautomation
+ ]
+ interface ITypeLibExporterNotifySink : IUnknown {
+ HRESULT _stdcall ReportEvent(
+ [in] ImporterEventKind EventKind,
+ [in] long EventCode,
+ [in] BSTR EventMsg);
+ HRESULT _stdcall ResolveRef(
+ [in] IUnknown* Asm,
+ [out, retval] IUnknown** pRetVal);
+ };
+
+ [
+ odl,
+ uuid(FA1F3615-ACB9-486d-9EAC-1BEF87E36B09),
+ oleautomation
+ ]
+ interface ITypeLibExporterNameProvider : IUnknown {
+ HRESULT _stdcall GetNames (
+ [out, retval] SAFEARRAY(BSTR) *Names);
+ };
+
+
+
+};
+
+
+
diff --git a/src/inc/tlbutils.h b/src/inc/tlbutils.h
new file mode 100644
index 0000000000..54a274587c
--- /dev/null
+++ b/src/inc/tlbutils.h
@@ -0,0 +1,52 @@
+// 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.
+
+//
+// Utilities used to help manipulating typelibs
+//
+
+
+#ifndef _TLBUTILS_H
+#define _TLBUTILS_H
+
+#ifndef FEATURE_COMINTEROP_TLB_SUPPORT
+#error FEATURE_COMINTEROP_TLB_SUPPORT is required for this file
+#endif // FEATURE_COMINTEROP_TLB_SUPPORT
+
+#include "windows.h"
+#include "utilcode.h"
+
+struct StdConvertibleItfInfo
+{
+ LPUTF8 m_strMngTypeName;
+ GUID * m_pNativeTypeIID;
+ LPUTF8 m_strCustomMarshalerTypeName;
+ LPUTF8 m_strCookie;
+};
+
+// This method returns the custom marshaler info to convert the native interface
+// to its managed equivalent. Or null if the interface is not a standard convertible interface.
+const StdConvertibleItfInfo *GetConvertionInfoFromNativeIID(REFGUID rGuidNativeItf);
+
+// This function determines the namespace name for a TypeLib.
+HRESULT GetNamespaceNameForTypeLib( // S_OK or error.
+ ITypeLib *pITLB, // [IN] The TypeLib.
+ BSTR *pwzNamespace); // [OUT] Put the namespace name here.
+
+// This function determines the namespace.name for a TypeInfo. If no namespace
+// is provided, it is retrieved from the containing library.
+HRESULT GetManagedNameForTypeInfo( // S_OK or error.
+ ITypeInfo *pITI, // [IN] The TypeInfo.
+ LPCWSTR wzNamespace, // [IN, OPTIONAL] Default namespace name.
+ LPCWSTR wzAsmName, // [IN, OPTIONAL] Assembly name.
+ BSTR *pwzName); // [OUT] Put the name here.
+
+#endif // _TLBUTILS_H
+
+
+
+
+
+
+
diff --git a/src/inc/tls.h b/src/inc/tls.h
new file mode 100644
index 0000000000..55f74892bb
--- /dev/null
+++ b/src/inc/tls.h
@@ -0,0 +1,78 @@
+// 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.
+// TLS.H -
+//
+
+//
+// Encapsulates TLS access for maximum performance.
+//
+
+
+
+#ifndef __tls_h__
+#define __tls_h__
+
+#ifdef FEATURE_IMPLICIT_TLS
+#ifdef _WIN64
+#ifndef _DEBUG
+#define OFFSETOF__TLS__tls_ThreadLocalInfo 0x10
+#else // _DEBUG
+#define OFFSETOF__TLS__tls_ThreadLocalInfo 0x08
+#endif // _DEBUG
+#else // _WIN64
+#define OFFSETOF__TLS__tls_ThreadLocalInfo 0x04
+#endif // _WIN64
+
+#define OFFSETOF__TLS__tls_CurrentThread (OFFSETOF__TLS__tls_ThreadLocalInfo+0x0)
+#define OFFSETOF__TLS__tls_EETlsData (OFFSETOF__TLS__tls_CurrentThread+2*sizeof(void*))
+
+
+#ifdef _TARGET_WIN64_
+#define WINNT_OFFSETOF__TEB__ThreadLocalStoragePointer 0x58
+#else
+#define WINNT_OFFSETOF__TEB__ThreadLocalStoragePointer 0x2c
+#endif
+
+#endif // FEATURE_IMPLICIT_TLS
+
+// Pointer to a function that retrieves the TLS data for a specific index.
+typedef LPVOID (*POPTIMIZEDTLSGETTER)();
+
+//---------------------------------------------------------------------------
+// Creates a platform-optimized version of TlsGetValue compiled
+// for a particular index. Can return NULL - the caller should substitute
+// a non-optimized getter in this case.
+//---------------------------------------------------------------------------
+POPTIMIZEDTLSGETTER MakeOptimizedTlsGetter(DWORD tlsIndex, LPVOID pBuffer = NULL, SIZE_T cbBuffer = 0, POPTIMIZEDTLSGETTER pGenericImpl = NULL, BOOL fForceGeneric = FALSE);
+
+
+//---------------------------------------------------------------------------
+// Frees a function created by MakeOptimizedTlsGetter().
+//---------------------------------------------------------------------------
+VOID FreeOptimizedTlsGetter(POPTIMIZEDTLSGETTER pOptimizedTlsGetter);
+
+
+
+//---------------------------------------------------------------------------
+// For ASM stub generators that want to inline Thread access for efficiency,
+// the Thread manager uses these constants to define how to access the Thread.
+//---------------------------------------------------------------------------
+enum TLSACCESSMODE {
+ TLSACCESS_GENERIC = 1, // Make no platform assumptions: use the API
+ // TLS
+ TLSACCESS_WNT = 2, // WinNT-style TLS
+ TLSACCESS_WNT_HIGH = 3, // WinNT5-style TLS, slot > TLS_MINIMUM_AVAILABLE
+};
+
+
+//---------------------------------------------------------------------------
+// WinNT store the TLS in different places relative to the
+// fs:[0]. This api reveals which. Can also return TLSACCESS_GENERIC if
+// no info is available about the Thread location (you have to use the TlsGetValue
+// api.) This is intended for use by stub generators that want to inline TLS
+// access.
+//---------------------------------------------------------------------------
+TLSACCESSMODE GetTLSAccessMode(DWORD tlsIndex);
+
+#endif // __tls_h__
diff --git a/src/inc/unsafe.h b/src/inc/unsafe.h
new file mode 100644
index 0000000000..ba4a166fb1
--- /dev/null
+++ b/src/inc/unsafe.h
@@ -0,0 +1,102 @@
+// 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.
+
+
+
+
+#ifndef __UNSAFE_H__
+#define __UNSAFE_H__
+
+// should we just check proper inclusion?
+#include <winwrap.h>
+
+#include "staticcontract.h"
+
+inline VOID UnsafeEnterCriticalSection(LPCRITICAL_SECTION lpCriticalSection)
+{
+ STATIC_CONTRACT_LEAF;
+ EnterCriticalSection(lpCriticalSection);
+}
+
+inline VOID UnsafeLeaveCriticalSection(LPCRITICAL_SECTION lpCriticalSection)
+{
+ STATIC_CONTRACT_LEAF;
+ LeaveCriticalSection(lpCriticalSection);
+}
+
+inline BOOL UnsafeTryEnterCriticalSection(LPCRITICAL_SECTION lpCriticalSection)
+{
+ STATIC_CONTRACT_LEAF;
+ return TryEnterCriticalSection(lpCriticalSection);
+}
+
+inline VOID UnsafeInitializeCriticalSection(LPCRITICAL_SECTION lpCriticalSection)
+{
+ STATIC_CONTRACT_LEAF;
+ InitializeCriticalSection(lpCriticalSection);
+}
+
+inline VOID UnsafeDeleteCriticalSection(LPCRITICAL_SECTION lpCriticalSection)
+{
+ STATIC_CONTRACT_LEAF;
+ DeleteCriticalSection(lpCriticalSection);
+}
+
+inline HANDLE UnsafeCreateEvent(LPSECURITY_ATTRIBUTES lpEventAttributes, BOOL bManualReset, BOOL bInitialState, LPCWSTR lpName)
+{
+ STATIC_CONTRACT_WRAPPER;
+ return WszCreateEvent(lpEventAttributes, bManualReset, bInitialState, lpName);
+}
+
+inline BOOL UnsafeSetEvent(HANDLE hEvent)
+{
+ STATIC_CONTRACT_LEAF;
+ return SetEvent(hEvent);
+}
+
+inline BOOL UnsafeResetEvent(HANDLE hEvent)
+{
+ STATIC_CONTRACT_LEAF;
+ return ResetEvent(hEvent);
+}
+
+inline HANDLE UnsafeCreateSemaphore(LPSECURITY_ATTRIBUTES lpSemaphoreAttributes, LONG lInitialCount, LONG lMaximumCount, LPCWSTR lpName)
+{
+ STATIC_CONTRACT_WRAPPER;
+ return WszCreateSemaphore(lpSemaphoreAttributes, lInitialCount, lMaximumCount, lpName);
+}
+
+inline BOOL UnsafeReleaseSemaphore(HANDLE hSemaphore, LONG lReleaseCount, LPLONG lpPreviousCount)
+{
+ STATIC_CONTRACT_LEAF;
+ return ReleaseSemaphore(hSemaphore, lReleaseCount, lpPreviousCount);
+}
+
+inline LPVOID UnsafeTlsGetValue(DWORD dwTlsIndex)
+{
+ STATIC_CONTRACT_LEAF;
+ return TlsGetValue(dwTlsIndex);
+}
+
+inline BOOL UnsafeTlsSetValue(DWORD dwTlsIndex, LPVOID lpTlsValue)
+{
+ STATIC_CONTRACT_LEAF;
+ return TlsSetValue(dwTlsIndex, lpTlsValue);
+}
+
+inline DWORD UnsafeTlsAlloc(void)
+{
+ STATIC_CONTRACT_LEAF;
+ return TlsAlloc();
+}
+
+inline BOOL UnsafeTlsFree(DWORD dwTlsIndex)
+{
+ STATIC_CONTRACT_LEAF;
+ return TlsFree(dwTlsIndex);
+}
+
+#endif
+
+
diff --git a/src/inc/utilcode.h b/src/inc/utilcode.h
new file mode 100644
index 0000000000..c519e8b872
--- /dev/null
+++ b/src/inc/utilcode.h
@@ -0,0 +1,5753 @@
+// 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.
+//*****************************************************************************
+// UtilCode.h
+//
+// Utility functions implemented in UtilCode.lib.
+//
+//*****************************************************************************
+
+#ifndef __UtilCode_h__
+#define __UtilCode_h__
+
+#include "crtwrap.h"
+#include "winwrap.h"
+#include <wchar.h>
+#include <stdio.h>
+#include <malloc.h>
+#include <ole2.h>
+#include <oleauto.h>
+#include <limits.h>
+#include "clrtypes.h"
+#include "safewrap.h"
+#include "volatile.h"
+#include <daccess.h>
+#include "clrhost.h"
+#include "debugmacros.h"
+#include "corhlprpriv.h"
+#include "winnls.h"
+#include "check.h"
+#include "safemath.h"
+#include "new.hpp"
+
+#ifdef PAL_STDCPP_COMPAT
+#include <type_traits>
+#else
+#include "clr_std/type_traits"
+#endif
+
+#include "contract.h"
+#include "entrypoints.h"
+
+#include "clrnt.h"
+
+// Values for the names of Watson
+const WCHAR kWatsonName1[] = W("drwatson");
+const WCHAR kWatsonName2[] = W("drwtsn32");
+
+#include "random.h"
+
+#define WINDOWS_KERNEL32_DLLNAME_A "kernel32"
+#define WINDOWS_KERNEL32_DLLNAME_W W("kernel32")
+
+#if defined(FEATURE_CORECLR)
+#define CoreLibName_W W("System.Private.CoreLib")
+#define CoreLibName_IL_W W("System.Private.CoreLib.dll")
+#define CoreLibName_NI_W W("System.Private.CoreLib.ni.dll")
+#define CoreLibName_TLB_W W("System.Private.CoreLib.tlb")
+#define CoreLibName_A "System.Private.CoreLib"
+#define CoreLibName_IL_A "System.Private.CoreLib.dll"
+#define CoreLibName_NI_A "System.Private.CoreLib.ni.dll"
+#define CoreLibName_TLB_A "System.Private.CoreLib.tlb"
+#define CoreLibNameLen 22
+#define CoreLibSatelliteName_A "System.Private.CoreLib.resources"
+#define CoreLibSatelliteNameLen 32
+#define LegacyCoreLibName_A "mscorlib"
+#else // !defined(FEATURE_CORECLR)
+#define CoreLibName_W W("mscorlib")
+#define CoreLibName_IL_W W("mscorlib.dll")
+#define CoreLibName_NI_W W("mscorlib.ni.dll")
+#define CoreLibName_TLB_W W("mscorlib.tlb")
+#define CoreLibName_A "mscorlib"
+#define CoreLibName_IL_A "mscorlib.dll"
+#define CoreLibName_NI_A "mscorlib.ni.dll"
+#define CoreLibName_TLB_A "mscorlib.tlb"
+#define CoreLibNameLen 8
+#define CoreLibSatelliteName_A "mscorlib.resources"
+#define CoreLibSatelliteNameLen 18
+#define LegacyCoreLibName_A "mscorlib"
+#endif // defined(FEATURE_CORECLR)
+
+class StringArrayList;
+
+#if !defined(_DEBUG_IMPL) && defined(_DEBUG) && !defined(DACCESS_COMPILE)
+#define _DEBUG_IMPL 1
+#endif
+
+#ifdef _TARGET_ARM_
+
+// Under ARM we generate code only with Thumb encoding. In order to ensure we execute such code in the correct
+// mode we must ensure the low-order bit is set in any code address we'll call as a sub-routine. In C++ this
+// is handled automatically for us by the compiler. When generating and working with code generated
+// dynamically we have to be careful to set or mask-out this bit as appropriate.
+#ifndef THUMB_CODE
+#define THUMB_CODE 1
+#endif
+
+// Given a WORD extract the bitfield [lowbit, highbit] (i.e. BitExtract(0xffff, 15, 0) == 0xffff).
+inline WORD BitExtract(WORD wValue, DWORD highbit, DWORD lowbit)
+{
+ _ASSERTE((highbit < 16) && (lowbit < 16) && (highbit >= lowbit));
+ return (wValue >> lowbit) & ((1 << ((highbit - lowbit) + 1)) - 1);
+}
+
+// Determine whether an ARM Thumb mode instruction is 32-bit or 16-bit based on the first WORD of the
+// instruction.
+inline bool Is32BitInstruction(WORD opcode)
+{
+ return BitExtract(opcode, 15, 11) >= 0x1d;
+}
+
+template <typename ResultType, typename SourceType>
+inline ResultType DataPointerToThumbCode(SourceType pCode)
+{
+ return (ResultType)(((UINT_PTR)pCode) | THUMB_CODE);
+}
+
+template <typename ResultType, typename SourceType>
+inline ResultType ThumbCodeToDataPointer(SourceType pCode)
+{
+ return (ResultType)(((UINT_PTR)pCode) & ~THUMB_CODE);
+}
+
+#endif // _TARGET_ARM_
+
+// Convert from a PCODE to the corresponding PINSTR. On many architectures this will be the identity function;
+// on ARM, this will mask off the THUMB bit.
+inline TADDR PCODEToPINSTR(PCODE pc)
+{
+#ifdef _TARGET_ARM_
+ return ThumbCodeToDataPointer<TADDR,PCODE>(pc);
+#else
+ return dac_cast<PCODE>(pc);
+#endif
+}
+
+typedef LPCSTR LPCUTF8;
+typedef LPSTR LPUTF8;
+
+#include "nsutilpriv.h"
+
+#include "stdmacros.h"
+
+/*
+// This is for WinCE
+#ifdef VERIFY
+#undef VERIFY
+#endif
+
+#ifdef _ASSERTE
+#undef _ASSERTE
+#endif
+*/
+
+//********** Macros. **********************************************************
+#ifndef FORCEINLINE
+ #if _MSC_VER < 1200
+ #define FORCEINLINE inline
+ #else
+ #define FORCEINLINE __forceinline
+ #endif
+#endif
+
+#ifndef DEBUG_NOINLINE
+#if defined(_DEBUG)
+#define DEBUG_NOINLINE __declspec(noinline)
+#else
+#define DEBUG_NOINLINE
+#endif
+#endif
+
+#ifndef DBG_NOINLINE_X86__RET_INLINE
+#if defined(_DEBUG) && defined(_TARGET_X86_)
+// this exists to make scan work on x86.
+#define DBG_NOINLINE_X86__RET_INLINE __declspec(noinline)
+#else
+#define DBG_NOINLINE_X86__RET_INLINE FORCEINLINE
+#endif
+#endif
+
+#include <stddef.h> // for offsetof
+
+#ifndef NumItems
+// Number of elements in a fixed-size array
+#define NumItems(s) (sizeof(s) / sizeof(s[0]))
+#endif
+
+#ifndef StrLen
+// Number of characters in a string literal. Excludes terminating NULL.
+#define StrLen(str) (NumItems(str) - 1)
+#endif
+
+
+#define IS_DIGIT(ch) ((ch >= W('0')) && (ch <= W('9')))
+#define DIGIT_TO_INT(ch) (ch - W('0'))
+#define INT_TO_DIGIT(i) ((WCHAR)(W('0') + i))
+
+#define IS_HEXDIGIT(ch) (((ch >= W('a')) && (ch <= W('f'))) || \
+ ((ch >= W('A')) && (ch <= W('F'))))
+#define HEXDIGIT_TO_INT(ch) ((towlower(ch) - W('a')) + 10)
+#define INT_TO_HEXDIGIT(i) ((WCHAR)(W('a') + (i - 10)))
+
+
+// Helper will 4 byte align a value, rounding up.
+#define ALIGN4BYTE(val) (((val) + 3) & ~0x3)
+
+#ifdef _DEBUG
+#define DEBUGARG(x) , x
+#else
+#define DEBUGARG(x)
+#endif
+
+#ifndef sizeofmember
+// Returns the size of a class or struct member.
+#define sizeofmember(c,m) (sizeof(((c*)0)->m))
+#endif
+
+//=--------------------------------------------------------------------------=
+// Prefast helpers.
+//
+
+#include "safemath.h"
+
+
+//=--------------------------------------------------------------------------=
+// string helpers.
+
+//
+// given and ANSI String, copy it into a wide buffer.
+// be careful about scoping when using this macro!
+//
+// how to use the below two macros:
+//
+// ...
+// LPSTR pszA;
+// pszA = MyGetAnsiStringRoutine();
+// MAKE_WIDEPTR_FROMANSI(pwsz, pszA);
+// MyUseWideStringRoutine(pwsz);
+// ...
+//
+// similarily for MAKE_ANSIPTR_FROMWIDE. note that the first param does not
+// have to be declared, and no clean up must be done.
+//
+
+// We'll define an upper limit that allows multiplication by 4 (the max
+// bytes/char in UTF-8) but still remains positive, and allows some room for pad.
+// Under normal circumstances, we should never get anywhere near this limit.
+#define MAKE_MAX_LENGTH 0x1fffff00
+
+#ifndef MAKE_TOOLONGACTION
+#define MAKE_TOOLONGACTION ThrowHR(COR_E_OVERFLOW)
+#endif
+
+#ifndef MAKE_TRANSLATIONFAILED
+#define MAKE_TRANSLATIONFAILED ThrowWin32(ERROR_NO_UNICODE_TRANSLATION)
+#endif
+
+// This version throws on conversion errors (ie, no best fit character
+// mapping to characters that look similar, and no use of the default char
+// ('?') when printing out unrepresentable characters. Use this method for
+// most development in the EE, especially anything like metadata or class
+// names. See the BESTFIT version if you're printing out info to the console.
+#define MAKE_MULTIBYTE_FROMWIDE(ptrname, widestr, codepage) \
+ int __l##ptrname = (int)wcslen(widestr); \
+ if (__l##ptrname > MAKE_MAX_LENGTH) \
+ MAKE_TOOLONGACTION; \
+ __l##ptrname = (int)((__l##ptrname + 1) * 2 * sizeof(char)); \
+ CQuickBytes __CQuickBytes##ptrname; \
+ __CQuickBytes##ptrname.AllocThrows(__l##ptrname); \
+ BOOL __b##ptrname; \
+ DWORD __cBytes##ptrname = WszWideCharToMultiByte(codepage, WC_NO_BEST_FIT_CHARS, widestr, -1, (LPSTR)__CQuickBytes##ptrname.Ptr(), __l##ptrname, NULL, &__b##ptrname); \
+ if (__b##ptrname || (__cBytes##ptrname == 0 && (widestr[0] != W('\0')))) { \
+ MAKE_TRANSLATIONFAILED; \
+ } \
+ LPSTR ptrname = (LPSTR)__CQuickBytes##ptrname.Ptr()
+
+// This version does best fit character mapping and also allows the use
+// of the default char ('?') for any Unicode character that isn't
+// representable. This is reasonable for writing to the console, but
+// shouldn't be used for most string conversions.
+#define MAKE_MULTIBYTE_FROMWIDE_BESTFIT(ptrname, widestr, codepage) \
+ int __l##ptrname = (int)wcslen(widestr); \
+ if (__l##ptrname > MAKE_MAX_LENGTH) \
+ MAKE_TOOLONGACTION; \
+ __l##ptrname = (int)((__l##ptrname + 1) * 2 * sizeof(char)); \
+ CQuickBytes __CQuickBytes##ptrname; \
+ __CQuickBytes##ptrname.AllocThrows(__l##ptrname); \
+ DWORD __cBytes##ptrname = WszWideCharToMultiByte(codepage, 0, widestr, -1, (LPSTR)__CQuickBytes##ptrname.Ptr(), __l##ptrname, NULL, NULL); \
+ if (__cBytes##ptrname == 0 && __l##ptrname != 0) { \
+ MAKE_TRANSLATIONFAILED; \
+ } \
+ LPSTR ptrname = (LPSTR)__CQuickBytes##ptrname.Ptr()
+
+// Use for anything critical other than output to console, where weird
+// character mappings are unacceptable.
+#define MAKE_ANSIPTR_FROMWIDE(ptrname, widestr) MAKE_MULTIBYTE_FROMWIDE(ptrname, widestr, CP_ACP)
+
+// Use for output to the console.
+#define MAKE_ANSIPTR_FROMWIDE_BESTFIT(ptrname, widestr) MAKE_MULTIBYTE_FROMWIDE_BESTFIT(ptrname, widestr, CP_ACP)
+
+#define MAKE_WIDEPTR_FROMANSI(ptrname, ansistr) \
+ CQuickBytes __qb##ptrname; \
+ int __l##ptrname; \
+ __l##ptrname = WszMultiByteToWideChar(CP_ACP, 0, ansistr, -1, 0, 0); \
+ if (__l##ptrname > MAKE_MAX_LENGTH) \
+ MAKE_TOOLONGACTION; \
+ LPWSTR ptrname = (LPWSTR) __qb##ptrname.AllocThrows((__l##ptrname+1)*sizeof(WCHAR)); \
+ if (WszMultiByteToWideChar(CP_ACP, MB_ERR_INVALID_CHARS, ansistr, -1, ptrname, __l##ptrname) == 0) { \
+ MAKE_TRANSLATIONFAILED; \
+ }
+
+#define MAKE_WIDEPTR_FROMANSI_NOTHROW(ptrname, ansistr) \
+ CQuickBytes __qb##ptrname; \
+ LPWSTR ptrname = 0; \
+ int __l##ptrname; \
+ __l##ptrname = WszMultiByteToWideChar(CP_ACP, 0, ansistr, -1, 0, 0); \
+ if (__l##ptrname <= MAKE_MAX_LENGTH) { \
+ ptrname = (LPWSTR) __qb##ptrname.AllocNoThrow((__l##ptrname+1)*sizeof(WCHAR)); \
+ if (ptrname) { \
+ if (WszMultiByteToWideChar(CP_ACP, MB_ERR_INVALID_CHARS, ansistr, -1, ptrname, __l##ptrname) != 0) { \
+ ptrname[__l##ptrname] = 0; \
+ } else { \
+ ptrname = 0; \
+ } \
+ } \
+ }
+
+#define MAKE_UTF8PTR_FROMWIDE(ptrname, widestr) CQuickBytes _##ptrname; _##ptrname.ConvertUnicode_Utf8(widestr); LPSTR ptrname = (LPSTR) _##ptrname.Ptr();
+
+#define MAKE_UTF8PTR_FROMWIDE_NOTHROW(ptrname, widestr) \
+ CQuickBytes __qb##ptrname; \
+ int __l##ptrname = (int)wcslen(widestr); \
+ LPUTF8 ptrname = 0; \
+ if (__l##ptrname <= MAKE_MAX_LENGTH) { \
+ __l##ptrname = (int)((__l##ptrname + 1) * 2 * sizeof(char)); \
+ ptrname = (LPUTF8) __qb##ptrname.AllocNoThrow(__l##ptrname); \
+ } \
+ if (ptrname) { \
+ INT32 __lresult##ptrname=WszWideCharToMultiByte(CP_UTF8, 0, widestr, -1, ptrname, __l##ptrname-1, NULL, NULL); \
+ DWORD __dwCaptureLastError##ptrname = ::GetLastError(); \
+ if ((__lresult##ptrname==0) && (((LPCWSTR)widestr)[0] != W('\0'))) { \
+ if (__dwCaptureLastError##ptrname==ERROR_INSUFFICIENT_BUFFER) { \
+ INT32 __lsize##ptrname=WszWideCharToMultiByte(CP_UTF8, 0, widestr, -1, NULL, 0, NULL, NULL); \
+ ptrname = (LPSTR) __qb##ptrname .AllocNoThrow(__lsize##ptrname); \
+ if (ptrname) { \
+ if (WszWideCharToMultiByte(CP_UTF8, 0, widestr, -1, ptrname, __lsize##ptrname, NULL, NULL) != 0) { \
+ ptrname[__l##ptrname] = 0; \
+ } else { \
+ ptrname = 0; \
+ } \
+ } \
+ } \
+ else { \
+ ptrname = 0; \
+ } \
+ } \
+ } \
+
+#define MAKE_WIDEPTR_FROMUTF8N(ptrname, utf8str, n8chrs) \
+ CQuickBytes __qb##ptrname; \
+ int __l##ptrname; \
+ __l##ptrname = WszMultiByteToWideChar(CP_UTF8, 0, utf8str, n8chrs, 0, 0); \
+ if (__l##ptrname > MAKE_MAX_LENGTH) \
+ MAKE_TOOLONGACTION; \
+ LPWSTR ptrname = (LPWSTR) __qb##ptrname .AllocThrows((__l##ptrname+1)*sizeof(WCHAR)); \
+ if (0==WszMultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, utf8str, n8chrs, ptrname, __l##ptrname)) { \
+ MAKE_TRANSLATIONFAILED; \
+ } \
+ ptrname[__l##ptrname] = 0;
+
+
+#define MAKE_WIDEPTR_FROMUTF8(ptrname, utf8str) CQuickBytes _##ptrname; _##ptrname.ConvertUtf8_Unicode(utf8str); LPCWSTR ptrname = (LPCWSTR) _##ptrname.Ptr();
+
+
+#define MAKE_WIDEPTR_FROMUTF8N_NOTHROW(ptrname, utf8str, n8chrs) \
+ CQuickBytes __qb##ptrname; \
+ int __l##ptrname; \
+ LPWSTR ptrname = 0; \
+ __l##ptrname = WszMultiByteToWideChar(CP_UTF8, 0, utf8str, n8chrs, 0, 0); \
+ if (__l##ptrname <= MAKE_MAX_LENGTH) { \
+ ptrname = (LPWSTR) __qb##ptrname.AllocNoThrow((__l##ptrname+1)*sizeof(WCHAR)); \
+ if (ptrname) { \
+ if (WszMultiByteToWideChar(CP_UTF8, MB_ERR_INVALID_CHARS, utf8str, n8chrs, ptrname, __l##ptrname) != 0) { \
+ ptrname[__l##ptrname] = 0; \
+ } else { \
+ ptrname = 0; \
+ } \
+ } \
+ }
+
+#define MAKE_WIDEPTR_FROMUTF8_NOTHROW(ptrname, utf8str) MAKE_WIDEPTR_FROMUTF8N_NOTHROW(ptrname, utf8str, -1)
+
+// This method takes the number of characters
+#define MAKE_MULTIBYTE_FROMWIDEN(ptrname, widestr, _nCharacters, _pCnt, codepage) \
+ CQuickBytes __qb##ptrname; \
+ int __l##ptrname; \
+ __l##ptrname = WszWideCharToMultiByte(codepage, WC_NO_BEST_FIT_CHARS, widestr, _nCharacters, NULL, 0, NULL, NULL); \
+ if (__l##ptrname > MAKE_MAX_LENGTH) \
+ MAKE_TOOLONGACTION; \
+ ptrname = (LPUTF8) __qb##ptrname .AllocThrows(__l##ptrname+1); \
+ BOOL __b##ptrname; \
+ DWORD _pCnt = WszWideCharToMultiByte(codepage, WC_NO_BEST_FIT_CHARS, widestr, _nCharacters, ptrname, __l##ptrname, NULL, &__b##ptrname); \
+ if (__b##ptrname || (_pCnt == 0 && _nCharacters > 0)) { \
+ MAKE_TRANSLATIONFAILED; \
+ } \
+ ptrname[__l##ptrname] = 0;
+
+#define MAKE_MULTIBYTE_FROMWIDEN_BESTFIT(ptrname, widestr, _nCharacters, _pCnt, codepage) \
+ CQuickBytes __qb##ptrname; \
+ int __l##ptrname; \
+ __l##ptrname = WszWideCharToMultiByte(codepage, 0, widestr, _nCharacters, NULL, 0, NULL, NULL); \
+ if (__l##ptrname > MAKE_MAX_LENGTH) \
+ MAKE_TOOLONGACTION; \
+ ptrname = (LPUTF8) __qb##ptrname .AllocThrows(__l##ptrname+1); \
+ DWORD _pCnt = WszWideCharToMultiByte(codepage, 0, widestr, _nCharacters, ptrname, __l##ptrname, NULL, NULL); \
+ if (_pCnt == 0 && _nCharacters > 0) { \
+ MAKE_TRANSLATIONFAILED; \
+ } \
+ ptrname[__l##ptrname] = 0;
+
+#define MAKE_ANSIPTR_FROMWIDEN(ptrname, widestr, _nCharacters, _pCnt) \
+ MAKE_MULTIBYTE_FROMWIDEN(ptrname, widestr, _nCharacters, _pCnt, CP_ACP)
+
+
+inline
+LPWSTR DuplicateString(
+ LPCWSTR wszString,
+ size_t cchString)
+{
+ STATIC_CONTRACT_NOTHROW;
+
+ LPWSTR wszDup = NULL;
+ if (wszString != NULL)
+ {
+ wszDup = new (nothrow) WCHAR[cchString + 1];
+ if (wszDup != NULL)
+ {
+ wcscpy_s(wszDup, cchString + 1, wszString);
+ }
+ }
+ return wszDup;
+}
+
+inline
+LPWSTR DuplicateString(
+ LPCWSTR wszString)
+{
+ STATIC_CONTRACT_NOTHROW;
+
+ if (wszString != NULL)
+ {
+ return DuplicateString(wszString, wcslen(wszString));
+ }
+ else
+ {
+ return NULL;
+ }
+}
+
+void DECLSPEC_NORETURN ThrowOutOfMemory();
+
+inline
+LPWSTR DuplicateStringThrowing(
+ LPCWSTR wszString,
+ size_t cchString)
+{
+ STATIC_CONTRACT_THROWS;
+
+ if (wszString == NULL)
+ return NULL;
+
+ LPWSTR wszDup = DuplicateString(wszString, cchString);
+ if (wszDup == NULL)
+ ThrowOutOfMemory();
+
+ return wszDup;
+}
+
+inline
+LPWSTR DuplicateStringThrowing(
+ LPCWSTR wszString)
+{
+ STATIC_CONTRACT_THROWS;
+
+ if (wszString == NULL)
+ return NULL;
+
+ LPWSTR wszDup = DuplicateString(wszString);
+ if (wszDup == NULL)
+ ThrowOutOfMemory();
+
+ return wszDup;
+}
+
+
+//*****************************************************************************
+// Placement new is used to new and object at an exact location. The pointer
+// is simply returned to the caller without actually using the heap. The
+// advantage here is that you cause the ctor() code for the object to be run.
+// This is ideal for heaps of C++ objects that need to get init'd multiple times.
+// Example:
+// void *pMem = GetMemFromSomePlace();
+// Foo *p = new (pMem) Foo;
+// DoSomething(p);
+// p->~Foo();
+//*****************************************************************************
+#ifndef __PLACEMENT_NEW_INLINE
+#define __PLACEMENT_NEW_INLINE
+inline void *__cdecl operator new(size_t, void *_P)
+{
+ LIMITED_METHOD_DAC_CONTRACT;
+
+ return (_P);
+}
+#endif // __PLACEMENT_NEW_INLINE
+
+
+/********************************************************************************/
+/* portability helpers */
+#ifdef _WIN64
+#define IN_WIN64(x) x
+#define IN_WIN32(x)
+#else
+#define IN_WIN64(x)
+#define IN_WIN32(x) x
+#endif
+
+void * __cdecl
+operator new(size_t n);
+
+_Ret_bytecap_(n) void * __cdecl
+operator new[](size_t n);
+
+void __cdecl
+operator delete(void *p) NOEXCEPT;
+
+void __cdecl
+operator delete[](void *p) NOEXCEPT;
+
+#ifdef _DEBUG_IMPL
+HRESULT _OutOfMemory(LPCSTR szFile, int iLine);
+#define OutOfMemory() _OutOfMemory(__FILE__, __LINE__)
+#else
+inline HRESULT OutOfMemory()
+{
+ LIMITED_METHOD_CONTRACT;
+ return (E_OUTOFMEMORY);
+}
+#endif
+
+//*****************************************************************************
+// Handle accessing localizable resource strings
+//*****************************************************************************
+// NOTE: Should use locale names as much as possible. LCIDs don't support
+// custom cultures on Vista+.
+// TODO: This should always use the names
+#ifdef FEATURE_USE_LCID
+typedef LCID LocaleID;
+typedef LCID LocaleIDValue;
+#else
+typedef LPCWSTR LocaleID;
+typedef WCHAR LocaleIDValue[LOCALE_NAME_MAX_LENGTH];
+#endif
+
+// Notes about the culture callbacks:
+// - The language we're operating in can change at *runtime*!
+// - A process may operate in *multiple* languages.
+// (ex: Each thread may have it's own language)
+// - If we don't care what language we're in (or have no way of knowing),
+// then return a 0-length name and UICULTUREID_DONTCARE for the culture ID.
+// - GetCultureName() and the GetCultureId() must be in sync (refer to the
+// same language).
+// - We have two functions separate functions for better performance.
+// - The name is used to resolve a directory for MsCorRC.dll.
+// - The id is used as a key to map to a dll hinstance.
+
+// Callback to obtain both the culture name and the culture's parent culture name
+typedef HRESULT (*FPGETTHREADUICULTURENAMES)(__inout StringArrayList* pCultureNames);
+#ifdef FEATURE_USE_LCID
+// Callback to return the culture ID.
+const LCID UICULTUREID_DONTCARE = (LCID)-1;
+#else
+const LPCWSTR UICULTUREID_DONTCARE = NULL;
+#endif
+
+typedef int (*FPGETTHREADUICULTUREID)(LocaleIDValue*);
+
+HMODULE CLRLoadLibrary(LPCWSTR lpLibFileName);
+
+HMODULE CLRLoadLibraryEx(LPCWSTR lpLibFileName, HANDLE hFile, DWORD dwFlags);
+
+BOOL CLRFreeLibrary(HMODULE hModule);
+
+// Prevent people from using LoadStringRC & LoadStringRCEx from inside the product since it
+// causes issues with having the wrong version picked up inside the shim.
+#define LoadStringRC __error("From inside the CLR, use UtilLoadStringRC; LoadStringRC is only meant to be exported.")
+#define LoadStringRCEx __error("From inside the CLR, use UtilLoadStringRCEx; LoadStringRC is only meant to be exported.")
+
+// Load a string using the resources for the current module.
+STDAPI UtilLoadStringRC(UINT iResouceID, __out_ecount (iMax) LPWSTR szBuffer, int iMax, int bQuiet=FALSE);
+
+#if defined(ENABLE_DOWNLEVEL_FOR_NLS) || defined(FEATURE_USE_LCID)
+STDAPI UtilLoadStringRCEx(LCID lcid, UINT iResourceID, __out_ecount (iMax) LPWSTR szBuffer, int iMax, int bQuiet, int *pcwchUsed);
+#endif
+
+// Specify callbacks so that UtilLoadStringRC can find out which language we're in.
+// If no callbacks specified (or both parameters are NULL), we default to the
+// resource dll in the root (which is probably english).
+void SetResourceCultureCallbacks(
+ FPGETTHREADUICULTURENAMES fpGetThreadUICultureNames,
+ FPGETTHREADUICULTUREID fpGetThreadUICultureId
+);
+
+void GetResourceCultureCallbacks(
+ FPGETTHREADUICULTURENAMES* fpGetThreadUICultureNames,
+ FPGETTHREADUICULTUREID* fpGetThreadUICultureId
+);
+
+#if !defined(DACCESS_COMPILE)
+// Get the MUI ID, on downlevel platforms where MUI is not supported it
+// returns the default system ID.
+extern int GetMUILanguageID(LocaleIDValue* pResult);
+extern HRESULT GetMUILanguageNames(__inout StringArrayList* pCultureNames);
+
+#endif // !defined(DACCESS_COMPILE)
+
+//*****************************************************************************
+// Use this class by privately deriving from noncopyable to disallow copying of
+// your class.
+//*****************************************************************************
+class noncopyable
+{
+protected:
+ noncopyable()
+ {}
+ ~noncopyable()
+ {}
+
+private:
+ noncopyable(const noncopyable&);
+ const noncopyable& operator=(const noncopyable&);
+};
+
+//*****************************************************************************
+// Must associate each handle to an instance of a resource dll with the int
+// that it represents
+//*****************************************************************************
+typedef HINSTANCE HRESOURCEDLL;
+
+
+class CCulturedHInstance
+{
+ LocaleIDValue m_LangId;
+ HRESOURCEDLL m_hInst;
+ BOOL m_fMissing;
+
+public:
+ CCulturedHInstance()
+ {
+ LIMITED_METHOD_CONTRACT;
+ m_hInst = NULL;
+ m_fMissing = FALSE;
+ }
+
+ BOOL HasID(LocaleID id)
+ {
+ _ASSERTE(m_hInst != NULL || m_fMissing);
+ if (id == UICULTUREID_DONTCARE)
+ return FALSE;
+
+#ifdef FEATURE_USE_LCID
+ return id == m_LangId;
+#else
+ return wcscmp(id, m_LangId) == 0;
+#endif
+ }
+
+ HRESOURCEDLL GetLibraryHandle()
+ {
+ return m_hInst;
+ }
+
+ BOOL IsSet()
+ {
+ return m_hInst != NULL;
+ }
+
+ BOOL IsMissing()
+ {
+ return m_fMissing;
+ }
+
+ void SetMissing(LocaleID id)
+ {
+ _ASSERTE(m_hInst == NULL);
+ SetId(id);
+ m_fMissing = TRUE;
+ }
+
+ void Set(LocaleID id, HRESOURCEDLL hInst)
+ {
+ _ASSERTE(m_hInst == NULL);
+ _ASSERTE(m_fMissing == FALSE);
+ SetId(id);
+ m_hInst = hInst;
+ }
+ private:
+ void SetId(LocaleID id)
+ {
+#ifdef FEATURE_USE_LCID
+ m_LangId = id;
+#else
+ if (id != UICULTUREID_DONTCARE)
+ {
+ wcsncpy_s(m_LangId, NumItems(m_LangId), id, NumItems(m_LangId));
+ m_LangId[NumItems(m_LangId)-1] = W('\0');
+ }
+ else
+ {
+ m_LangId[0] = W('\0');
+ }
+#endif
+ }
+ };
+
+#ifndef DACCESS_COMPILE
+void AddThreadPreferredUILanguages(StringArrayList* pArray);
+#endif
+//*****************************************************************************
+// CCompRC manages string Resource access for COM+. This includes loading
+// the MsCorRC.dll for resources as well allowing each thread to use a
+// a different localized version.
+//*****************************************************************************
+class CCompRC
+{
+public:
+
+ enum ResourceCategory
+ {
+ // must be present
+ Required,
+
+ // present in Desktop CLR and Core CLR + debug pack, an error
+ // If missing, get a generic error message instead
+ Error,
+
+ // present in Desktop CLR and Core CLR + debug pack, normal operation (e.g tracing)
+ // if missing, get a generic "resource not found" message instead
+ Debugging,
+
+ // present in Desktop CLR, optional for CoreCLR
+ DesktopCLR,
+
+ // might not be present, non essential
+ Optional
+ };
+
+ CCompRC()
+ {
+ // This constructor will be fired up on startup. Make sure it doesn't
+ // do anything besides zero-out out values.
+ m_bUseFallback = FALSE;
+
+ m_fpGetThreadUICultureId = NULL;
+ m_fpGetThreadUICultureNames = NULL;
+
+
+ m_pHash = NULL;
+ m_nHashSize = 0;
+ m_csMap = NULL;
+ m_pResourceFile = NULL;
+#ifdef FEATURE_PAL
+ m_pResourceDomain = NULL;
+#endif // FEATURE_PAL
+
+ }// CCompRC
+
+ HRESULT Init(LPCWSTR pResourceFile, BOOL bUseFallback = FALSE);
+ void Destroy();
+
+ BOOL ShouldUseFallback()
+ {
+ LIMITED_METHOD_CONTRACT;
+ return m_bUseFallback;
+ };
+
+ static void SetIsMscoree() {s_bIsMscoree = TRUE;}
+
+ HRESULT LoadString(ResourceCategory eCategory, UINT iResourceID, __out_ecount (iMax) LPWSTR szBuffer, int iMax , int *pcwchUsed=NULL);
+ HRESULT LoadString(ResourceCategory eCategory, LocaleID langId, UINT iResourceID, __out_ecount (iMax) LPWSTR szBuffer, int iMax, int *pcwchUsed);
+
+ void SetResourceCultureCallbacks(
+ FPGETTHREADUICULTURENAMES fpGetThreadUICultureNames,
+ FPGETTHREADUICULTUREID fpGetThreadUICultureId
+ );
+
+ void GetResourceCultureCallbacks(
+ FPGETTHREADUICULTURENAMES* fpGetThreadUICultureNames,
+ FPGETTHREADUICULTUREID* fpGetThreadUICultureId
+ );
+
+ HRESULT LoadMUILibrary(HRESOURCEDLL * pHInst);
+
+ // Get the default resource location (mscorrc.dll for desktop, mscorrc.debug.dll for CoreCLR)
+ static CCompRC* GetDefaultResourceDll();
+#ifdef FEATURE_CORECLR
+ // Get the generic messages dll (Silverlight only, mscorrc.dll)
+ static CCompRC* GetFallbackResourceDll();
+#endif
+ static void ShutdownDefaultResourceDll();
+ static void GetDefaultCallbacks(
+ FPGETTHREADUICULTURENAMES* fpGetThreadUICultureNames,
+ FPGETTHREADUICULTUREID* fpGetThreadUICultureId)
+ {
+ WRAPPER_NO_CONTRACT;
+ m_DefaultResourceDll.GetResourceCultureCallbacks(
+ fpGetThreadUICultureNames,
+ fpGetThreadUICultureId);
+ }
+
+ static void SetDefaultCallbacks(
+ FPGETTHREADUICULTURENAMES fpGetThreadUICultureNames,
+ FPGETTHREADUICULTUREID fpGetThreadUICultureId)
+ {
+ WRAPPER_NO_CONTRACT;
+ // Either both are NULL or neither are NULL
+ _ASSERTE((fpGetThreadUICultureNames != NULL) ==
+ (fpGetThreadUICultureId != NULL));
+
+ m_DefaultResourceDll.SetResourceCultureCallbacks(
+ fpGetThreadUICultureNames,
+ fpGetThreadUICultureId);
+
+#ifdef FEATURE_CORECLR
+ m_FallbackResourceDll.SetResourceCultureCallbacks(
+ fpGetThreadUICultureNames,
+ fpGetThreadUICultureId);
+
+#endif
+ }
+
+#ifdef USE_FORMATMESSAGE_WRAPPER
+
+DWORD
+PALAPI
+static
+FormatMessage(
+ IN DWORD dwFlags,
+ IN LPCVOID lpSource,
+ IN DWORD dwMessageId,
+ IN DWORD dwLanguageId,
+ OUT LPWSTR lpBuffer,
+ IN DWORD nSize,
+ IN va_list *Arguments);
+#endif // USE_FORMATMESSAGE_WRAPPER
+
+
+private:
+ HRESULT GetLibrary(LocaleID langId, HRESOURCEDLL* phInst);
+#ifndef DACCESS_COMPILE
+ HRESULT LoadLibraryHelper(HRESOURCEDLL *pHInst,
+ SString& rcPath);
+ HRESULT LoadLibraryThrows(HRESOURCEDLL * pHInst);
+ HRESULT LoadLibrary(HRESOURCEDLL * pHInst);
+ HRESULT LoadResourceFile(HRESOURCEDLL * pHInst, LPCWSTR lpFileName);
+#endif
+
+ // We do not have global constructors any more
+ static LONG m_dwDefaultInitialized;
+ static CCompRC m_DefaultResourceDll;
+ static LPCWSTR m_pDefaultResource;
+
+#ifdef FEATURE_CORECLR
+ // fallback resources if debug pack is not installed
+ static LONG m_dwFallbackInitialized;
+ static CCompRC m_FallbackResourceDll;
+ static LPCWSTR m_pFallbackResource;
+#endif
+
+ // We must map between a thread's int and a dll instance.
+ // Since we only expect 1 language almost all of the time, we'll special case
+ // that and then use a variable size map for everything else.
+ CCulturedHInstance m_Primary;
+ CCulturedHInstance * m_pHash;
+ int m_nHashSize;
+
+ CRITSEC_COOKIE m_csMap;
+
+ LPCWSTR m_pResourceFile;
+#ifdef FEATURE_PAL
+ // Resource domain is an ANSI string identifying a native resources file
+ static LPCSTR m_pDefaultResourceDomain;
+ static LPCSTR m_pFallbackResourceDomain;
+ LPCSTR m_pResourceDomain;
+#endif // FEATURE_PAL
+
+ // Main accessors for hash
+ HRESOURCEDLL LookupNode(LocaleID langId, BOOL &fMissing);
+ HRESULT AddMapNode(LocaleID langId, HRESOURCEDLL hInst, BOOL fMissing = FALSE);
+
+ FPGETTHREADUICULTUREID m_fpGetThreadUICultureId;
+ FPGETTHREADUICULTURENAMES m_fpGetThreadUICultureNames;
+
+ BOOL m_bUseFallback;
+ static BOOL s_bIsMscoree;
+};
+
+HRESULT UtilLoadResourceString(CCompRC::ResourceCategory eCategory, UINT iResouceID, __out_ecount (iMax) LPWSTR szBuffer, int iMax);
+
+
+int UtilMessageBox(
+ HWND hWnd, // Handle to Owner Window
+ UINT uText, // Resource Identifier for Text message
+ UINT uCaption, // Resource Identifier for Caption
+ UINT uType, // Style of MessageBox
+ BOOL displayForNonInteractive, // Display even if the process is running non interactive
+ BOOL ShowFileNameInTitle, // Flag to show FileName in Caption
+ ...); // Additional Arguments
+
+int UtilMessageBoxNonLocalized(
+ HWND hWnd, // Handle to Owner Window
+ LPCWSTR lpText, // Resource Identifier for Text message
+ LPCWSTR lpTitle, // Resource Identifier for Caption
+ UINT uType, // Style of MessageBox
+ BOOL displayForNonInteractive, // Display even if the process is running non interactive
+ BOOL ShowFileNameInTitle, // Flag to show FileName in Caption
+ ...); // Additional Arguments
+
+int UtilMessageBoxVA(
+ HWND hWnd, // Handle to Owner Window
+ UINT uText, // Resource Identifier for Text message
+ UINT uCaption, // Resource Identifier for Caption
+ UINT uType, // Style of MessageBox
+ BOOL displayForNonInteractive, // Display even if the process is running non interactive
+ BOOL ShowFileNameInTitle, // Flag to show FileName in Caption
+ va_list args); // Additional Arguments
+
+int UtilMessageBoxNonLocalizedVA(
+ HWND hWnd, // Handle to Owner Window
+ LPCWSTR lpText, // Text message
+ LPCWSTR lpCaption, // Caption
+ UINT uType, // Style of MessageBox
+ BOOL displayForNonInteractive, // Display even if the process is running non interactive
+ BOOL ShowFileNameInTitle, // Flag to show FileName in Caption
+ BOOL * pInputFromUser, // To distinguish between user pressing abort vs. assuming abort.
+ va_list args); // Additional Arguments
+
+int UtilMessageBoxNonLocalizedVA(
+ HWND hWnd, // Handle to Owner Window
+ LPCWSTR lpText, // Text message
+ LPCWSTR lpCaption, // Caption
+ LPCWSTR lpDetails, // Details that may be shown in a collapsed extended area of the dialog (Vista or higher).
+ UINT uType, // Style of MessageBox
+ BOOL displayForNonInteractive, // Display even if the process is running non interactive
+ BOOL ShowFileNameInTitle, // Flag to show FileName in Caption
+ BOOL * pInputFromUser, // To distinguish between user pressing abort vs. assuming abort.
+ va_list args); // Additional Arguments
+
+int UtilMessageBoxCatastrophic(
+ UINT uText, // Text for MessageBox
+ UINT uTitle, // Title for MessageBox
+ UINT uType, // Style of MessageBox
+ BOOL ShowFileNameInTitle, // Flag to show FileName in Caption
+ ...);
+
+int UtilMessageBoxCatastrophicNonLocalized(
+ LPCWSTR lpText, // Text for MessageBox
+ LPCWSTR lpTitle, // Title for MessageBox
+ UINT uType, // Style of MessageBox
+ BOOL ShowFileNameInTitle, // Flag to show FileName in Caption
+ ...);
+
+int UtilMessageBoxCatastrophicVA(
+ UINT uText, // Text for MessageBox
+ UINT uTitle, // Title for MessageBox
+ UINT uType, // Style of MessageBox
+ BOOL ShowFileNameInTitle, // Flag to show FileName in Caption
+ va_list args); // Additional Arguments
+
+int UtilMessageBoxCatastrophicNonLocalizedVA(
+ LPCWSTR lpText, // Text for MessageBox
+ LPCWSTR lpTitle, // Title for MessageBox
+ UINT uType, // Style of MessageBox
+ BOOL ShowFileNameInTitle, // Flag to show FileName in Caption
+ va_list args); // Additional Arguments
+
+
+// The HRESULT_FROM_WIN32 macro evaluates its arguments three times.
+// <TODO>TODO: All HRESULT_FROM_WIN32(GetLastError()) should be replaced by calls to
+// this helper function avoid code bloat</TODO>
+inline HRESULT HRESULT_FROM_GetLastError()
+{
+ WRAPPER_NO_CONTRACT;
+ DWORD dw = GetLastError();
+ // Make sure we return a failure
+ if (dw == ERROR_SUCCESS)
+ {
+ _ASSERTE(!"We were expecting to get an error code, but a success code is being returned. Check this code path for Everett!");
+ return E_FAIL;
+ }
+ else
+ return HRESULT_FROM_WIN32(dw);
+}
+
+inline HRESULT HRESULT_FROM_GetLastErrorNA()
+{
+ WRAPPER_NO_CONTRACT;
+ DWORD dw = GetLastError();
+ // Make sure we return a failure
+ if (dw == ERROR_SUCCESS)
+ return E_FAIL;
+ else
+ return HRESULT_FROM_WIN32(dw);
+}
+
+inline HRESULT BadError(HRESULT hr)
+{
+ LIMITED_METHOD_CONTRACT;
+ _ASSERTE(!"Serious Error");
+ return (hr);
+}
+
+#define TESTANDRETURN(test, hrVal) \
+{ \
+ int ___test = (int)(test); \
+ if (! ___test) \
+ return hrVal; \
+}
+
+#define TESTANDRETURNPOINTER(pointer) \
+ TESTANDRETURN(pointer!=NULL, E_POINTER)
+
+#define TESTANDRETURNMEMORY(pointer) \
+ TESTANDRETURN(pointer!=NULL, E_OUTOFMEMORY)
+
+#define TESTANDRETURNHR(hr) \
+ TESTANDRETURN(SUCCEEDED(hr), hr)
+
+#define TESTANDRETURNARG(argtest) \
+ TESTANDRETURN(argtest, E_INVALIDARG)
+
+// Quick validity check for HANDLEs that are returned by Win32 APIs that
+// use INVALID_HANDLE_VALUE instead of NULL to indicate an error
+inline BOOL IsValidHandle(HANDLE h)
+{
+ LIMITED_METHOD_CONTRACT;
+ return ((h != NULL) && (h != INVALID_HANDLE_VALUE));
+}
+
+// Count the bits in a value in order iBits time.
+inline int CountBits(int iNum)
+{
+ LIMITED_METHOD_CONTRACT;
+ int iBits;
+ for (iBits=0; iNum; iBits++)
+ iNum = iNum & (iNum - 1);
+ return (iBits);
+}
+
+#include "bitposition.h"
+
+// Used to remove trailing zeros from Decimal types.
+// NOTE: Assumes hi32 bits are empty (used for conversions from Cy->Dec)
+inline HRESULT DecimalCanonicalize(DECIMAL* dec)
+{
+ WRAPPER_NO_CONTRACT;
+
+ // Clear the VARENUM field
+ (*(USHORT*)dec) = 0;
+
+ // Remove trailing zeros:
+ DECIMAL temp;
+ DECIMAL templast;
+ temp = templast = *dec;
+
+ // Ensure the hi 32 bits are empty (should be if we came from a currency)
+ if ((DECIMAL_HI32(temp) != 0) || (DECIMAL_SCALE(temp) > 4))
+ return DISP_E_OVERFLOW;
+
+ // Return immediately if dec represents a zero.
+ if (DECIMAL_LO32(temp) == 0 && DECIMAL_MID32(temp) == 0)
+ return S_OK;
+
+ // Compare to the original to see if we've
+ // lost non-zero digits (and make sure we don't overflow the scale BYTE)
+
+#ifdef _PREFAST_
+#pragma warning(push)
+#pragma warning(disable:6219) // "Suppress PREFast warning about Implicit cast between semantically different integer types"
+#endif
+ while ((DECIMAL_SCALE(temp) <= 4) && (VARCMP_EQ == VarDecCmp(dec, &temp)))
+ {
+
+#ifdef _PREFAST_
+#pragma warning(pop)
+#endif
+ templast = temp;
+
+ // Remove the last digit and normalize. Ignore temp.Hi32
+ // as Currency values will have a max of 64 bits of data.
+ DECIMAL_SCALE(temp)--;
+ UINT64 temp64 = (((UINT64) DECIMAL_MID32(temp)) << 32) + DECIMAL_LO32(temp);
+ temp64 /= 10;
+
+ DECIMAL_MID32(temp) = (ULONG)(temp64 >> 32);
+ DECIMAL_LO32(temp) = (ULONG)temp64;
+ }
+ *dec = templast;
+
+ return S_OK;
+}
+
+//*****************************************************************************
+//
+// Paths functions. Use these instead of the CRT.
+//
+//*****************************************************************************
+// secure version! Specify the size of the each buffer in count of elements
+void SplitPath(register const WCHAR *path,
+ __inout_z __inout_ecount_opt(driveSizeInWords) WCHAR *drive, int driveSizeInWords,
+ __inout_z __inout_ecount_opt(dirSizeInWords) WCHAR *dir, int dirSizeInWords,
+ __inout_z __inout_ecount_opt(fnameSizeInWords) WCHAR *fname, size_t fnameSizeInWords,
+ __inout_z __inout_ecount_opt(extSizeInWords) WCHAR *ext, size_t extSizeInWords);
+
+//*******************************************************************************
+// A much more sensible version that just points to each section of the string.
+//*******************************************************************************
+void SplitPathInterior(
+ __in LPCWSTR wszPath,
+ __out_opt LPCWSTR *pwszDrive, __out_opt size_t *pcchDrive,
+ __out_opt LPCWSTR *pwszDir, __out_opt size_t *pcchDir,
+ __out_opt LPCWSTR *pwszFileName, __out_opt size_t *pcchFileName,
+ __out_opt LPCWSTR *pwszExt, __out_opt size_t *pcchExt);
+
+#ifndef FEATURE_CORECLR
+void MakePath(__out_ecount (MAX_LONGPATH) register WCHAR *path,
+ __in LPCWSTR drive,
+ __in LPCWSTR dir,
+ __in LPCWSTR fname,
+ __in LPCWSTR ext);
+#endif
+
+void MakePath(__out CQuickWSTR &path,
+ __in LPCWSTR drive,
+ __in LPCWSTR dir,
+ __in LPCWSTR fname,
+ __in LPCWSTR ext);
+
+WCHAR * FullPath(__out_ecount (maxlen) WCHAR *UserBuf, const WCHAR *path, size_t maxlen);
+
+//*****************************************************************************
+//
+// SString version of the path functions.
+//
+//*****************************************************************************
+void SplitPath(__in SString const &path,
+ __inout_opt SString *drive,
+ __inout_opt SString *dir,
+ __inout_opt SString *fname,
+ __inout_opt SString *ext);
+
+#if !defined(NO_CLRCONFIG)
+
+//*****************************************************************************
+//
+// **** REGUTIL - Static helper functions for reading/writing to Windows registry.
+//
+//*****************************************************************************
+
+
+class REGUTIL
+{
+public:
+//*****************************************************************************
+
+ enum CORConfigLevel
+ {
+ COR_CONFIG_ENV = 0x01,
+ COR_CONFIG_USER = 0x02,
+ COR_CONFIG_MACHINE = 0x04,
+ COR_CONFIG_FUSION = 0x08,
+
+ COR_CONFIG_REGISTRY = (COR_CONFIG_USER|COR_CONFIG_MACHINE|COR_CONFIG_FUSION),
+ COR_CONFIG_ALL = (COR_CONFIG_ENV|COR_CONFIG_USER|COR_CONFIG_MACHINE),
+ };
+
+ //
+ // NOTE: The following function is deprecated; use the CLRConfig class instead.
+ // To access a configuration value through CLRConfig, add an entry in file:../inc/CLRConfigValues.h.
+ //
+ static DWORD GetConfigDWORD_DontUse_(
+ LPCWSTR name,
+ DWORD defValue,
+ CORConfigLevel level = COR_CONFIG_ALL,
+ BOOL fPrependCOMPLUS = TRUE);
+
+ //
+ // NOTE: The following function is deprecated; use the CLRConfig class instead.
+ // To access a configuration value through CLRConfig, add an entry in file:../inc/CLRConfigValues.h.
+ //
+ static HRESULT GetConfigDWORD_DontUse_(
+ LPCWSTR name,
+ DWORD defValue,
+ __out DWORD * result,
+ CORConfigLevel level = COR_CONFIG_ALL,
+ BOOL fPrependCOMPLUS = TRUE);
+
+ static ULONGLONG GetConfigULONGLONG_DontUse_(
+ LPCWSTR name,
+ ULONGLONG defValue,
+ CORConfigLevel level = COR_CONFIG_ALL,
+ BOOL fPrependCOMPLUS = TRUE);
+
+ //
+ // NOTE: The following function is deprecated; use the CLRConfig class instead.
+ // To access a configuration value through CLRConfig, add an entry in file:../inc/CLRConfigValues.h.
+ //
+ static DWORD GetConfigFlag_DontUse_(
+ LPCWSTR name,
+ DWORD bitToSet,
+ BOOL defValue = FALSE);
+
+ //
+ // NOTE: The following function is deprecated; use the CLRConfig class instead.
+ // To access a configuration value through CLRConfig, add an entry in file:../inc/CLRConfigValues.h.
+ //
+ static LPWSTR GetConfigString_DontUse_(
+ LPCWSTR name,
+ BOOL fPrependCOMPLUS = TRUE,
+ CORConfigLevel level = COR_CONFIG_ALL,
+ BOOL fUsePerfCache = TRUE);
+
+ static void FreeConfigString(__in __in_z LPWSTR name);
+
+#ifdef FEATURE_CORECLR
+private:
+#endif //FEATURE_CORECLR
+ static LPWSTR EnvGetString(LPCWSTR name, BOOL fPrependCOMPLUS);
+#ifdef FEATURE_CORECLR
+public:
+#endif //FEATURE_CORECLR
+
+ static BOOL UseRegistry();
+
+private:
+//*****************************************************************************
+// Get either a DWORD or ULONGLONG. Always puts the result in a ULONGLONG that
+// you can safely cast to a DWORD if fGetDWORD is TRUE.
+//*****************************************************************************
+ static HRESULT GetConfigInteger(
+ LPCWSTR name,
+ ULONGLONG defValue,
+ __out ULONGLONG * result,
+ BOOL fGetDWORD = TRUE,
+ CORConfigLevel level = COR_CONFIG_ALL,
+ BOOL fPrependCOMPLUS = TRUE);
+public:
+
+#ifndef FEATURE_CORECLR
+ static void AllowRegistryUse(BOOL fAllowUse);
+
+
+//*****************************************************************************
+// Open's the given key and returns the value desired. If the key or value is
+// not found, then the default is returned.
+//*****************************************************************************
+ static long GetLong( // Return value from registry or default.
+ LPCTSTR szName, // Name of value to get.
+ long iDefault, // Default value to return if not found.
+ LPCTSTR szKey=NULL, // Name of key, NULL==default.
+ HKEY hKey=HKEY_LOCAL_MACHINE);// What key to work on.
+
+//*****************************************************************************
+// Open's the given key and returns the value desired. If the key or value is
+// not found, then the default is returned.
+//*****************************************************************************
+ static long SetLong( // Return value from registry or default.
+ LPCTSTR szName, // Name of value to get.
+ long iValue, // Value to set.
+ LPCTSTR szKey=NULL, // Name of key, NULL==default.
+ HKEY hKey=HKEY_LOCAL_MACHINE);// What key to work on.
+
+//*****************************************************************************
+// Open's the given key and returns the value desired. If the key or value is
+// not found, then it's created
+//*****************************************************************************
+ static long SetOrCreateLong( // Return value from registry or default.
+ LPCTSTR szName, // Name of value to get.
+ long iValue, // Value to set.
+ LPCTSTR szKey=NULL, // Name of key, NULL==default.
+ HKEY hKey=HKEY_LOCAL_MACHINE);// What key to work on.
+
+
+
+//*****************************************************************************
+// Set an entry in the registry of the form:
+// HKEY_CLASSES_ROOT\szKey\szSubkey = szValue. If szSubkey or szValue are
+// NULL, omit them from the above expression.
+//*****************************************************************************
+ static BOOL SetKeyAndValue( // TRUE or FALSE.
+ LPCTSTR szKey, // Name of the reg key to set.
+ LPCTSTR szSubkey, // Optional subkey of szKey.
+ LPCTSTR szValue); // Optional value for szKey\szSubkey.
+
+//*****************************************************************************
+// Delete an entry in the registry of the form:
+// HKEY_CLASSES_ROOT\szKey\szSubkey.
+//*****************************************************************************
+ static LONG DeleteKey( // TRUE or FALSE.
+ LPCTSTR szKey, // Name of the reg key to set.
+ LPCTSTR szSubkey); // Subkey of szKey.
+
+//*****************************************************************************
+// Open the key, create a new keyword and value pair under it.
+//*****************************************************************************
+ static BOOL SetRegValue( // Return status.
+ LPCTSTR szKeyName, // Name of full key.
+ LPCTSTR szKeyword, // Name of keyword.
+ LPCTSTR szValue); // Value of keyword.
+
+//*****************************************************************************
+// Does standard registration of a CoClass with a progid.
+//*****************************************************************************
+ static HRESULT RegisterCOMClass( // Return code.
+ REFCLSID rclsid, // Class ID.
+ LPCTSTR szDesc, // Description of the class.
+ LPCTSTR szProgIDPrefix, // Prefix for progid.
+ int iVersion, // Version # for progid.
+ LPCTSTR szClassProgID, // Class progid.
+ LPCTSTR szThreadingModel, // What threading model to use.
+ LPCTSTR szModule, // Path to class.
+ HINSTANCE hInst, // Handle to module being registered
+ LPCTSTR szAssemblyName, // Optional assembly name
+ LPCTSTR szVersion, // Optional Runtime Version (directry containing runtime)
+ BOOL fExternal, // flag - External to mscoree.
+ BOOL fRelativePath); // flag - Relative path in szModule
+
+//*****************************************************************************
+// Unregister the basic information in the system registry for a given object
+// class.
+//*****************************************************************************
+ static HRESULT UnregisterCOMClass( // Return code.
+ REFCLSID rclsid, // Class ID we are registering.
+ LPCTSTR szProgIDPrefix, // Prefix for progid.
+ int iVersion, // Version # for progid.
+ LPCTSTR szClassProgID, // Class progid.
+ BOOL fExternal); // flag - External to mscoree.
+
+//*****************************************************************************
+// Does standard registration of a CoClass with a progid.
+// NOTE: This is the non-side-by-side execution version.
+//*****************************************************************************
+ static HRESULT RegisterCOMClass( // Return code.
+ REFCLSID rclsid, // Class ID.
+ LPCTSTR szDesc, // Description of the class.
+ LPCTSTR szProgIDPrefix, // Prefix for progid.
+ int iVersion, // Version # for progid.
+ LPCTSTR szClassProgID, // Class progid.
+ LPCTSTR szThreadingModel, // What threading model to use.
+ LPCTSTR szModule, // Path to class.
+ BOOL bInprocServer = true); // Whether we register the server as inproc or local
+
+//*****************************************************************************
+// Unregister the basic information in the system registry for a given object
+// class.
+// NOTE: This is the non-side-by-side execution version.
+//*****************************************************************************
+ static HRESULT UnregisterCOMClass( // Return code.
+ REFCLSID rclsid, // Class ID we are registering.
+ LPCTSTR szProgIDPrefix, // Prefix for progid.
+ int iVersion, // Version # for progid.
+ LPCTSTR szClassProgID); // Class progid.
+
+//*****************************************************************************
+// Register a type library.
+//*****************************************************************************
+ static HRESULT RegisterTypeLib( // Return code.
+ REFGUID rtlbid, // TypeLib ID we are registering.
+ int iVersion, // Typelib version.
+ LPCTSTR szDesc, // TypeLib description.
+ LPCTSTR szModule); // Path to the typelib.
+
+//*****************************************************************************
+// Remove the registry keys for a type library.
+//*****************************************************************************
+ static HRESULT UnregisterTypeLib( // Return code.
+ REFGUID rtlbid, // TypeLib ID we are registering.
+ int iVersion); // Typelib version.
+
+#endif //#ifndef FEATURE_CORECLR
+
+//*****************************************************************************
+// (Optional) Initialize the config registry cache
+// (see ConfigCacheValueNameSeenPerhaps, below.)
+//*****************************************************************************
+ static void InitOptionalConfigCache();
+
+private:
+
+#ifndef FEATURE_CORECLR
+
+//*****************************************************************************
+// Register the basics for a in proc server.
+//*****************************************************************************
+ static HRESULT RegisterClassBase( // Return code.
+ REFCLSID rclsid, // Class ID we are registering.
+ LPCTSTR szDesc, // Class description.
+ LPCTSTR szProgID, // Class prog ID.
+ LPCTSTR szIndepProgID, // Class version independant prog ID.
+ __out_ecount (cchOutCLSID) LPTSTR szOutCLSID, // CLSID formatted in character form.
+ DWORD cchOutCLSID); // Out CLS ID buffer size in characters
+
+
+//*****************************************************************************
+// Delete the basic settings for an inproc server.
+//*****************************************************************************
+ static HRESULT UnregisterClassBase( // Return code.
+ REFCLSID rclsid, // Class ID we are registering.
+ LPCTSTR szProgID, // Class prog ID.
+ LPCTSTR szIndepProgID, // Class version independant prog ID.
+ __out_ecount (cchOutCLSID) LPTSTR szOutCLSID, // Return formatted class ID here.
+ DWORD cchOutCLSID); // Out CLS ID buffer size in characters
+
+#endif //#ifndef FEATURE_CORECLR
+
+//*****************************************************************************
+// Return TRUE if the registry value name might have been seen in the registry
+// at startup;
+// return FALSE if the value was definitely not seen at startup.
+//
+// Perf Optimization for VSWhidbey:113373.
+//*****************************************************************************
+ static BOOL RegCacheValueNameSeenPerhaps(
+ LPCWSTR name);
+//*****************************************************************************
+// Return TRUE if the environment variable name might have been seen at startup;
+// return FALSE if the value was definitely not seen at startup.
+//*****************************************************************************
+ static BOOL EnvCacheValueNameSeenPerhaps(
+ LPCWSTR name);
+
+ static BOOL s_fUseRegCache; // Enable registry cache; if FALSE, CCVNSP
+ // always returns TRUE.
+ static BOOL s_fUseEnvCache; // Enable env cache.
+
+ static BOOL s_fUseRegistry; // Allow lookups in the registry
+
+ // Open the .NetFramework keys once and cache the handles
+ static HKEY s_hMachineFrameworkKey;
+ static HKEY s_hUserFrameworkKey;
+};
+
+// need this here because CLRConfig depends on REGUTIL, and ConfigStringHolder depends on CLRConfig
+#include "clrconfig.h"
+
+//-----------------------------------------------------------------------------
+// Wrapper for configuration strings.
+// This serves as a holder to call FreeConfigString.
+class ConfigStringHolder
+{
+public:
+ ConfigStringHolder() { m_wszString = NULL; }
+ ~ConfigStringHolder()
+ {
+ Clear();
+ }
+
+ //
+ // NOTE: The following function is deprecated; use the CLRConfig class instead.
+ // To access a configuration value through CLRConfig, add an entry in file:../inc/CLRConfigValues.h.
+ //
+ void Init_DontUse_(LPCWSTR wszName)
+ {
+ Clear();
+ m_wszString = REGUTIL::GetConfigString_DontUse_(wszName);
+ }
+
+ // Free resources.
+ void Clear()
+ {
+ if (m_wszString != NULL)
+ {
+ REGUTIL::FreeConfigString(m_wszString);
+ m_wszString = NULL;
+ }
+ }
+
+ // Get the string value. NULL if not set.
+ LPCWSTR Value()
+ {
+ return m_wszString;
+ }
+
+private:
+ LPWSTR m_wszString;
+};
+
+#endif // defined(NO_CLRCONFIG)
+
+#include "ostype.h"
+
+#define CLRGetTickCount64() GetTickCount64()
+
+//
+// Use this function to initialize the s_CodeAllocHint
+// during startup. base is runtime .dll base address,
+// size is runtime .dll virtual size.
+//
+void InitCodeAllocHint(SIZE_T base, SIZE_T size, int randomPageOffset);
+
+
+//
+// Use this function to reset the s_CodeAllocHint
+// after unloading an AppDomain
+//
+void ResetCodeAllocHint();
+
+//
+// Returns TRUE if p is located in near clr.dll that allows us
+// to use rel32 IP-relative addressing modes.
+//
+BOOL IsPreferredExecutableRange(void * p);
+
+//
+// Allocate free memory that will be used for executable code
+// Handles the special requirements that we have on 64-bit platforms
+// where we want the executable memory to be located near mscorwks
+//
+BYTE * ClrVirtualAllocExecutable(SIZE_T dwSize,
+ DWORD flAllocationType,
+ DWORD flProtect);
+
+//
+// Allocate free memory within the range [pMinAddr..pMaxAddr] using
+// ClrVirtualQuery to find free memory and ClrVirtualAlloc to allocate it.
+//
+BYTE * ClrVirtualAllocWithinRange(const BYTE *pMinAddr,
+ const BYTE *pMaxAddr,
+ SIZE_T dwSize,
+ DWORD flAllocationType,
+ DWORD flProtect);
+
+//
+// Allocate free memory with specific alignment
+//
+LPVOID ClrVirtualAllocAligned(LPVOID lpAddress, SIZE_T dwSize, DWORD flAllocationType, DWORD flProtect, SIZE_T alignment);
+
+//******************************************************************************
+// Returns the number of processors that a process has been configured to run on
+//******************************************************************************
+class NumaNodeInfo
+{
+private:
+ static BOOL m_enableGCNumaAware;
+ static BOOL InitNumaNodeInfoAPI();
+
+public:
+ static BOOL CanEnableGCNumaAware();
+ static void InitNumaNodeInfo();
+
+#if !defined(FEATURE_REDHAWK)&& !defined(FEATURE_PAL)
+private: // apis types
+
+ //GetNumaHighestNodeNumber()
+ typedef BOOL
+ (WINAPI *PGNHNN)(PULONG);
+ //VirtualAllocExNuma()
+ typedef LPVOID
+ (WINAPI *PVAExN)(HANDLE,LPVOID,SIZE_T,DWORD,DWORD,DWORD);
+
+ // api pfns and members
+ static PGNHNN m_pGetNumaHighestNodeNumber;
+ static PVAExN m_pVirtualAllocExNuma;
+
+public: // functions
+
+ static LPVOID VirtualAllocExNuma(HANDLE hProc, LPVOID lpAddr, SIZE_T size,
+ DWORD allocType, DWORD prot, DWORD node);
+
+private:
+ //GetNumaProcessorNodeEx()
+ typedef BOOL
+ (WINAPI *PGNPNEx)(PPROCESSOR_NUMBER, PUSHORT);
+ static PGNPNEx m_pGetNumaProcessorNodeEx;
+
+public:
+ static BOOL GetNumaProcessorNodeEx(PPROCESSOR_NUMBER proc_no, PUSHORT node_no);
+#endif
+};
+
+struct CPU_Group_Info
+{
+ WORD nr_active; // at most 64
+ WORD reserved[1];
+ WORD begin;
+ WORD end;
+ DWORD_PTR active_mask;
+ DWORD groupWeight;
+ DWORD activeThreadWeight;
+};
+
+class CPUGroupInfo
+{
+private:
+ static LONG m_initialization;
+ static WORD m_nGroups;
+ static WORD m_nProcessors;
+ static BOOL m_enableGCCPUGroups;
+ static BOOL m_threadUseAllCpuGroups;
+ static WORD m_initialGroup;
+ static CPU_Group_Info *m_CPUGroupInfoArray;
+
+ static BOOL InitCPUGroupInfoAPI();
+ static BOOL InitCPUGroupInfoArray();
+ static BOOL InitCPUGroupInfoRange();
+ static void InitCPUGroupInfo();
+ static BOOL IsInitialized();
+
+public:
+ static void EnsureInitialized();
+ static BOOL CanEnableGCCPUGroups();
+ static BOOL CanEnableThreadUseAllCpuGroups();
+ static WORD GetNumActiveProcessors();
+ static void GetGroupForProcessor(WORD processor_number,
+ WORD *group_number, WORD *group_processor_number);
+ static DWORD CalculateCurrentProcessorNumber();
+ //static void PopulateCPUUsageArray(void * infoBuffer, ULONG infoSize);
+
+#if !defined(FEATURE_REDHAWK) && !defined(FEATURE_PAL)
+private:
+ //GetLogicalProcessorInforomationEx()
+ typedef BOOL
+ (WINAPI *PGLPIEx)(DWORD, SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX *, PDWORD);
+ //SetThreadGroupAffinity()
+ typedef BOOL
+ (WINAPI *PSTGA)(HANDLE, GROUP_AFFINITY *, GROUP_AFFINITY *);
+ //GetThreadGroupAffinity()
+ typedef BOOL
+ (WINAPI *PGTGA)(HANDLE, GROUP_AFFINITY *);
+ //GetCurrentProcessorNumberEx()
+ typedef void
+ (WINAPI *PGCPNEx)(PROCESSOR_NUMBER *);
+ //GetSystemTimes()
+ typedef BOOL
+ (WINAPI *PGST)(FILETIME *, FILETIME *, FILETIME *);
+ //NtQuerySystemInformationEx()
+ //typedef int
+ //(WINAPI *PNTQSIEx)(SYSTEM_INFORMATION_CLASS, PULONG, ULONG, PVOID, ULONG, PULONG);
+ static PGLPIEx m_pGetLogicalProcessorInformationEx;
+ static PSTGA m_pSetThreadGroupAffinity;
+ static PGTGA m_pGetThreadGroupAffinity;
+ static PGCPNEx m_pGetCurrentProcessorNumberEx;
+ static PGST m_pGetSystemTimes;
+ //static PNTQSIEx m_pNtQuerySystemInformationEx;
+
+public:
+ static BOOL GetLogicalProcessorInformationEx(DWORD relationship,
+ SYSTEM_LOGICAL_PROCESSOR_INFORMATION_EX *slpiex, PDWORD count);
+ static BOOL SetThreadGroupAffinity(HANDLE h,
+ GROUP_AFFINITY *groupAffinity, GROUP_AFFINITY *previousGroupAffinity);
+ static BOOL GetThreadGroupAffinity(HANDLE h, GROUP_AFFINITY *groupAffinity);
+ static BOOL GetSystemTimes(FILETIME *idleTime, FILETIME *kernelTime, FILETIME *userTime);
+ static void ChooseCPUGroupAffinity(GROUP_AFFINITY *gf);
+ static void ClearCPUGroupAffinity(GROUP_AFFINITY *gf);
+#endif
+};
+
+int GetCurrentProcessCpuCount();
+DWORD_PTR GetCurrentProcessCpuMask();
+
+//*****************************************************************************
+// Return != 0 if the bit at the specified index in the array is on and 0 if
+// it is off.
+//*****************************************************************************
+inline int GetBit(PTR_BYTE pcBits,int iBit)
+{
+ LIMITED_METHOD_CONTRACT;
+ return (pcBits[iBit>>3] & (1 << (iBit & 0x7)));
+}
+
+#ifdef DACCESS_COMPILE
+inline int GetBit(BYTE const * pcBits,int iBit)
+{
+ WRAPPER_NO_CONTRACT;
+ return GetBit(dac_cast<PTR_BYTE>(pcBits), iBit);
+}
+#endif
+
+//*****************************************************************************
+// Set the state of the bit at the specified index based on the value of bOn.
+//*****************************************************************************
+inline void SetBit(PTR_BYTE pcBits,int iBit,int bOn)
+{
+ LIMITED_METHOD_CONTRACT;
+ if (bOn)
+ pcBits[iBit>>3] |= (1 << (iBit & 0x7));
+ else
+ pcBits[iBit>>3] &= ~(1 << (iBit & 0x7));
+}
+
+#ifdef DACCESS_COMPILE
+inline void SetBit(BYTE * pcBits,int iBit,int bOn)
+{
+ WRAPPER_NO_CONTRACT;
+ SetBit(dac_cast<PTR_BYTE>(pcBits), iBit, bOn);
+}
+#endif
+
+template<typename T>
+class SimpleListNode
+{
+public:
+ SimpleListNode<T>(const T& _t)
+ {
+ data = _t;
+ next = 0;
+ }
+
+ T data;
+ SimpleListNode<T>* next;
+};
+
+template<typename T>
+class SimpleList
+{
+public:
+ typedef SimpleListNode<T> NodeType;
+
+ SimpleList<T>()
+ {
+ head = NULL;
+ }
+
+ void LinkHead(NodeType* pNode)
+ {
+ pNode->next = head;
+ head = pNode;
+ }
+
+ NodeType* UnlinkHead()
+ {
+ NodeType* ret = head;
+
+ if (head)
+ {
+ head = head->next;
+ }
+ return ret;
+ }
+
+ NodeType* Head()
+ {
+ return head;
+ }
+
+protected:
+
+ NodeType* head;
+};
+
+
+template < typename T, typename U >
+struct Pair
+{
+public:
+ typedef Pair< T, U > this_type;
+ typedef T first_type;
+ typedef U second_type;
+
+ Pair()
+ {}
+
+ Pair( T const & t, U const & u )
+ : m_first( t )
+ , m_second( u )
+ { SUPPORTS_DAC; }
+
+ Pair( this_type const & obj )
+ : m_first( obj.m_first )
+ , m_second( obj.m_second )
+ {}
+
+ this_type & operator=( this_type const & obj )
+ {
+ m_first = obj.m_first;
+ m_second = obj.m_second;
+ return *this;
+ }
+
+ T & First()
+ {
+ return m_first;
+ }
+
+ T const & First() const
+ {
+ return m_first;
+ }
+
+ U & Second()
+ {
+ return m_second;
+ }
+
+ U const & Second() const
+ {
+ return m_second;
+ }
+
+ bool operator==(const Pair& rhs) const
+ {
+ return ((this->First() == rhs.First()) &&
+ (this->Second() == rhs.Second()));
+ }
+
+ bool operator!=(const Pair& rhs) const
+ {
+ return !(*this == rhs);
+ }
+
+private:
+ first_type m_first;
+ second_type m_second;
+};
+
+
+template < typename T, typename U >
+Pair< T, U > MakePair( T const & t, U const & u )
+{
+ SUPPORTS_DAC;
+ return Pair< T, U >( t, u );
+}
+
+
+//*****************************************************************************
+// This class implements a dynamic array of structures for which the order of
+// the elements is unimportant. This means that any item placed in the list
+// may be swapped to any other location in the list at any time. If the order
+// of the items you place in the array is important, then use the CStructArray
+// class.
+//*****************************************************************************
+
+template <class T,
+ int iGrowInc,
+ class ALLOCATOR>
+class CUnorderedArrayWithAllocator
+{
+ int m_iCount; // # of elements used in the list.
+ int m_iSize; // # of elements allocated in the list.
+public:
+#ifndef DACCESS_COMPILE
+ T *m_pTable; // Pointer to the list of elements.
+#else
+ TADDR m_pTable; // Pointer to the list of elements.
+#endif
+
+public:
+
+#ifndef DACCESS_COMPILE
+
+ CUnorderedArrayWithAllocator() :
+ m_iCount(0),
+ m_iSize(0),
+ m_pTable(NULL)
+ {
+ LIMITED_METHOD_CONTRACT;
+ }
+ ~CUnorderedArrayWithAllocator()
+ {
+ LIMITED_METHOD_CONTRACT;
+ // Free the chunk of memory.
+ if (m_pTable != NULL)
+ ALLOCATOR::Free(this, m_pTable);
+ }
+
+ void Clear()
+ {
+ WRAPPER_NO_CONTRACT;
+ m_iCount = 0;
+ if (m_iSize > iGrowInc)
+ {
+ T* tmp = ALLOCATOR::AllocNoThrow(this, iGrowInc);
+ if (tmp) {
+ ALLOCATOR::Free(this, m_pTable);
+ m_pTable = tmp;
+ m_iSize = iGrowInc;
+ }
+ }
+ }
+
+ void Clear(int iFirst, int iCount)
+ {
+ WRAPPER_NO_CONTRACT;
+ int iSize;
+
+ if (iFirst + iCount < m_iCount)
+ memmove(&m_pTable[iFirst], &m_pTable[iFirst + iCount], sizeof(T) * (m_iCount - (iFirst + iCount)));
+
+ m_iCount -= iCount;
+
+ iSize = ((m_iCount / iGrowInc) * iGrowInc) + ((m_iCount % iGrowInc != 0) ? iGrowInc : 0);
+ if (m_iSize > iGrowInc && iSize < m_iSize)
+ {
+ T *tmp = ALLOCATOR::AllocNoThrow(this, iSize);
+ if (tmp) {
+ memcpy (tmp, m_pTable, iSize * sizeof(T));
+ delete [] m_pTable;
+ m_pTable = tmp;
+ m_iSize = iSize;
+ }
+ }
+ _ASSERTE(m_iCount <= m_iSize);
+ }
+
+ T *Table()
+ {
+ LIMITED_METHOD_CONTRACT;
+ return (m_pTable);
+ }
+
+ T *Append()
+ {
+ CONTRACTL {
+ NOTHROW;
+ } CONTRACTL_END;
+
+ // The array should grow, if we can't fit one more element into the array.
+ if (m_iSize <= m_iCount && GrowNoThrow() == NULL)
+ return (NULL);
+ return (&m_pTable[m_iCount++]);
+ }
+
+ T *AppendThrowing()
+ {
+ CONTRACTL {
+ THROWS;
+ } CONTRACTL_END;
+
+ // The array should grow, if we can't fit one more element into the array.
+ if (m_iSize <= m_iCount)
+ Grow();
+ return (&m_pTable[m_iCount++]);
+ }
+
+ void Delete(const T &Entry)
+ {
+ LIMITED_METHOD_CONTRACT;
+ --m_iCount;
+ for (int i=0; i <= m_iCount; ++i)
+ if (m_pTable[i] == Entry)
+ {
+ m_pTable[i] = m_pTable[m_iCount];
+ return;
+ }
+
+ // Just in case we didn't find it.
+ ++m_iCount;
+ }
+
+ void DeleteByIndex(int i)
+ {
+ LIMITED_METHOD_CONTRACT;
+ --m_iCount;
+ m_pTable[i] = m_pTable[m_iCount];
+ }
+
+ void Swap(int i,int j)
+ {
+ LIMITED_METHOD_CONTRACT;
+ T tmp;
+
+ if (i == j)
+ return;
+ tmp = m_pTable[i];
+ m_pTable[i] = m_pTable[j];
+ m_pTable[j] = tmp;
+ }
+
+#else
+
+ TADDR Table()
+ {
+ LIMITED_METHOD_CONTRACT;
+ SUPPORTS_DAC;
+ return (m_pTable);
+ }
+
+ void EnumMemoryRegions(void)
+ {
+ SUPPORTS_DAC;
+ DacEnumMemoryRegion(m_pTable, m_iCount * sizeof(T));
+ }
+
+#endif // #ifndef DACCESS_COMPILE
+
+ USHORT Count()
+ {
+ LIMITED_METHOD_CONTRACT;
+ SUPPORTS_DAC;
+ _ASSERTE(FitsIn<USHORT>(m_iCount));
+ return static_cast<USHORT>(m_iCount);
+ }
+
+private:
+ T *Grow();
+ T *GrowNoThrow();
+};
+
+
+#ifndef DACCESS_COMPILE
+
+//*****************************************************************************
+// Increase the size of the array.
+//*****************************************************************************
+template <class T,
+ int iGrowInc,
+ class ALLOCATOR>
+T *CUnorderedArrayWithAllocator<T,iGrowInc,ALLOCATOR>::GrowNoThrow() // NULL if can't grow.
+{
+ WRAPPER_NO_CONTRACT;
+ T *pTemp;
+
+ // try to allocate memory for reallocation.
+ if ((pTemp = ALLOCATOR::AllocNoThrow(this, m_iSize+iGrowInc)) == NULL)
+ return (NULL);
+ memcpy (pTemp, m_pTable, m_iSize*sizeof(T));
+ ALLOCATOR::Free(this, m_pTable);
+ m_pTable = pTemp;
+ m_iSize += iGrowInc;
+ _ASSERTE(m_iSize > 0);
+ return (pTemp);
+}
+
+template <class T,
+ int iGrowInc,
+ class ALLOCATOR>
+T *CUnorderedArrayWithAllocator<T,iGrowInc,ALLOCATOR>::Grow() // exception if can't grow.
+{
+ WRAPPER_NO_CONTRACT;
+ T *pTemp;
+
+ // try to allocate memory for reallocation.
+ pTemp = ALLOCATOR::AllocThrowing(this, m_iSize+iGrowInc);
+ memcpy (pTemp, m_pTable, m_iSize*sizeof(T));
+ ALLOCATOR::Free(this, m_pTable);
+ m_pTable = pTemp;
+ m_iSize += iGrowInc;
+ _ASSERTE(m_iSize > 0);
+ return (pTemp);
+}
+
+#endif // #ifndef DACCESS_COMPILE
+
+
+template <class T>
+class CUnorderedArray__Allocator
+{
+public:
+
+ static T *AllocThrowing (void*, int nElements)
+ {
+ return new T[nElements];
+ }
+
+ static T *AllocNoThrow (void*, int nElements)
+ {
+ return new (nothrow) T[nElements];
+ }
+
+ static void Free (void*, T *pTable)
+ {
+ delete [] pTable;
+ }
+};
+
+
+template <class T,int iGrowInc>
+class CUnorderedArray : public CUnorderedArrayWithAllocator<T, iGrowInc, CUnorderedArray__Allocator<T> >
+{
+public:
+
+ CUnorderedArray ()
+ {
+ LIMITED_METHOD_CONTRACT;
+ }
+};
+
+
+//Used by the debugger. Included here in hopes somebody else might, too
+typedef CUnorderedArray<SIZE_T, 17> SIZE_T_UNORDERED_ARRAY;
+
+
+//*****************************************************************************
+// This class implements a dynamic array of structures for which the insert
+// order is important. Inserts will slide all elements after the location
+// down, deletes slide all values over the deleted item. If the order of the
+// items in the array is unimportant to you, then CUnorderedArray may provide
+// the same feature set at lower cost.
+//*****************************************************************************
+class CStructArray
+{
+ BYTE *m_pList; // Pointer to the list of elements.
+ int m_iCount; // # of elements used in the list.
+ int m_iSize; // # of elements allocated in the list.
+ int m_iGrowInc; // Growth increment.
+ short m_iElemSize; // Size of an array element.
+ bool m_bFree; // true if data is automatically maintained.
+
+public:
+ CStructArray(short iElemSize, short iGrowInc = 1) :
+ m_pList(NULL),
+ m_iCount(0),
+ m_iSize(0),
+ m_iGrowInc(iGrowInc),
+ m_iElemSize(iElemSize),
+ m_bFree(true)
+ {
+ LIMITED_METHOD_CONTRACT;
+ }
+ ~CStructArray()
+ {
+ WRAPPER_NO_CONTRACT;
+ Clear();
+ }
+
+ void *Insert(int iIndex);
+ void *InsertThrowing(int iIndex);
+ void *Append();
+ void *AppendThrowing();
+ int AllocateBlock(int iCount);
+ void AllocateBlockThrowing(int iCount);
+ void Delete(int iIndex);
+ void *Ptr()
+ {
+ LIMITED_METHOD_CONTRACT;
+ return (m_pList);
+ }
+ void *Get(int iIndex)
+ {
+ WRAPPER_NO_CONTRACT;
+ _ASSERTE(iIndex < m_iCount);
+ return ((void *) ((size_t) Ptr() + (iIndex * m_iElemSize)));
+ }
+ int Size()
+ {
+ LIMITED_METHOD_CONTRACT;
+ return (m_iCount * m_iElemSize);
+ }
+ int Count()
+ {
+ LIMITED_METHOD_CONTRACT;
+ return (m_iCount);
+ }
+ void Clear();
+ void ClearCount()
+ {
+ LIMITED_METHOD_CONTRACT;
+ m_iCount = 0;
+ }
+
+ void InitOnMem(short iElemSize, void *pList, int iCount, int iSize, int iGrowInc=1)
+ {
+ LIMITED_METHOD_CONTRACT;
+ m_iElemSize = iElemSize;
+ m_iGrowInc = (short) iGrowInc;
+ m_pList = (BYTE*)pList;
+ m_iCount = iCount;
+ m_iSize = iSize;
+ m_bFree = false;
+ }
+
+private:
+ void Grow(int iCount);
+};
+
+
+//*****************************************************************************
+// This template simplifies access to a CStructArray by removing void * and
+// adding some operator overloads.
+//*****************************************************************************
+template <class T>
+class CDynArray : public CStructArray
+{
+public:
+ CDynArray(short iGrowInc=16) :
+ CStructArray(sizeof(T), iGrowInc)
+ {
+ LIMITED_METHOD_CONTRACT;
+ }
+
+ T *Insert(int iIndex)
+ {
+ WRAPPER_NO_CONTRACT;
+ return ((T *)CStructArray::Insert((int)iIndex));
+ }
+
+ T *InsertThrowing(int iIndex)
+ {
+ WRAPPER_NO_CONTRACT;
+ return ((T *)CStructArray::InsertThrowing((int)iIndex));
+ }
+
+ T *Append()
+ {
+ WRAPPER_NO_CONTRACT;
+ return ((T *)CStructArray::Append());
+ }
+
+ T *AppendThrowing()
+ {
+ WRAPPER_NO_CONTRACT;
+ return ((T *)CStructArray::AppendThrowing());
+ }
+
+ T *Ptr()
+ {
+ WRAPPER_NO_CONTRACT;
+ return ((T *)CStructArray::Ptr());
+ }
+
+ T *Get(int iIndex)
+ {
+ WRAPPER_NO_CONTRACT;
+ return (Ptr() + iIndex);
+ }
+ T &operator[](int iIndex)
+ {
+ WRAPPER_NO_CONTRACT;
+ return (*(Ptr() + iIndex));
+ }
+ int ItemIndex(T *p)
+ {
+ WRAPPER_NO_CONTRACT;
+ return (((int)(LONG_PTR)p - (int)(LONG_PTR)Ptr()) / sizeof(T));
+ }
+ void Move(int iFrom, int iTo)
+ {
+ WRAPPER_NO_CONTRACT;
+ T tmp;
+
+ _ASSERTE(iFrom >= 0 && iFrom < Count() &&
+ iTo >= 0 && iTo < Count());
+
+ tmp = *(Ptr() + iFrom);
+ if (iTo > iFrom)
+ memmove(Ptr() + iFrom, Ptr() + iFrom + 1, (iTo - iFrom) * sizeof(T));
+ else
+ memmove(Ptr() + iTo + 1, Ptr() + iTo, (iFrom - iTo) * sizeof(T));
+ *(Ptr() + iTo) = tmp;
+ }
+};
+
+// Some common arrays.
+typedef CDynArray<int> INTARRAY;
+typedef CDynArray<short> SHORTARRAY;
+typedef CDynArray<int> LONGARRAY;
+typedef CDynArray<USHORT> USHORTARRAY;
+typedef CDynArray<ULONG> ULONGARRAY;
+typedef CDynArray<BYTE> BYTEARRAY;
+typedef CDynArray<mdToken> TOKENARRAY;
+
+template <class T> class CStackArray : public CStructArray
+{
+public:
+ CStackArray(short iGrowInc=4) :
+ CStructArray(sizeof(T), iGrowInc),
+ m_curPos(0)
+ {
+ LIMITED_METHOD_CONTRACT;
+ }
+
+ void Push(T p)
+ {
+ WRAPPER_NO_CONTRACT;
+ // We should only inc m_curPos after we grow the array.
+ T *pT = (T *)CStructArray::InsertThrowing(m_curPos);
+ m_curPos ++;
+ *pT = p;
+ }
+
+ T * Pop()
+ {
+ WRAPPER_NO_CONTRACT;
+ T * retPtr;
+
+ _ASSERTE(m_curPos > 0);
+
+ retPtr = (T *)CStructArray::Get(m_curPos-1);
+ CStructArray::Delete(m_curPos--);
+
+ return (retPtr);
+ }
+
+ int Count()
+ {
+ LIMITED_METHOD_CONTRACT;
+ return(m_curPos);
+ }
+
+private:
+ int m_curPos;
+};
+
+
+//*****************************************************************************
+// This template manages a list of free entries by their 0 based offset. By
+// making it a template, you can use whatever size free chain will match your
+// maximum count of items. -1 is reserved.
+//*****************************************************************************
+template <class T> class TFreeList
+{
+public:
+ void Init(
+ T *rgList,
+ int iCount)
+ {
+ LIMITED_METHOD_CONTRACT;
+ // Save off values.
+ m_rgList = rgList;
+ m_iCount = iCount;
+ m_iNext = 0;
+
+ // Init free list.
+ int i;
+ for (i=0; i<iCount - 1; i++)
+ m_rgList[i] = i + 1;
+ m_rgList[i] = (T) -1;
+ }
+
+ T GetFreeEntry() // Index of free item, or -1.
+ {
+ LIMITED_METHOD_CONTRACT;
+ T iNext;
+
+ if (m_iNext == (T) -1)
+ return (-1);
+
+ iNext = m_iNext;
+ m_iNext = m_rgList[m_iNext];
+ return (iNext);
+ }
+
+ void DelFreeEntry(T iEntry)
+ {
+ LIMITED_METHOD_CONTRACT;
+ _ASSERTE(iEntry < m_iCount);
+ m_rgList[iEntry] = m_iNext;
+ m_iNext = iEntry;
+ }
+
+ // This function can only be used when it is guaranteed that the free
+ // array is contigous, for example, right after creation to quickly
+ // get a range of items from the heap.
+ void ReserveRange(int iCount)
+ {
+ LIMITED_METHOD_CONTRACT;
+ _ASSERTE(iCount < m_iCount);
+ _ASSERTE(m_iNext == 0);
+ m_iNext = iCount;
+ }
+
+private:
+ T *m_rgList; // List of free info.
+ int m_iCount; // How many entries to manage.
+ T m_iNext; // Next item to get.
+};
+
+
+//*****************************************************************************
+//*****************************************************************************
+template <class T> class CQuickSort
+{
+protected:
+ T *m_pBase; // Base of array to sort.
+private:
+ SSIZE_T m_iCount; // How many items in array.
+ SSIZE_T m_iElemSize; // Size of one element.
+public:
+ CQuickSort(
+ T *pBase, // Address of first element.
+ SSIZE_T iCount) : // How many there are.
+ m_pBase(pBase),
+ m_iCount(iCount),
+ m_iElemSize(sizeof(T))
+ {
+ LIMITED_METHOD_DAC_CONTRACT;
+ }
+
+//*****************************************************************************
+// Call to sort the array.
+//*****************************************************************************
+ inline void Sort()
+ {
+ WRAPPER_NO_CONTRACT;
+ SortRange(0, m_iCount - 1);
+ }
+
+protected:
+//*****************************************************************************
+// Override this function to do the comparison.
+//*****************************************************************************
+ virtual FORCEINLINE int Compare( // -1, 0, or 1
+ T *psFirst, // First item to compare.
+ T *psSecond) // Second item to compare.
+ {
+ LIMITED_METHOD_DAC_CONTRACT;
+ return (memcmp(psFirst, psSecond, sizeof(T)));
+// return (::Compare(*psFirst, *psSecond));
+ }
+
+ virtual FORCEINLINE void Swap(
+ SSIZE_T iFirst,
+ SSIZE_T iSecond)
+ {
+ LIMITED_METHOD_DAC_CONTRACT;
+ if (iFirst == iSecond) return;
+ T sTemp( m_pBase[iFirst] );
+ m_pBase[iFirst] = m_pBase[iSecond];
+ m_pBase[iSecond] = sTemp;
+ }
+
+private:
+ inline void SortRange(
+ SSIZE_T iLeft,
+ SSIZE_T iRight)
+ {
+ WRAPPER_NO_CONTRACT;
+ SSIZE_T iLast;
+ SSIZE_T i; // loop variable.
+
+ for (;;)
+ {
+ // if less than two elements you're done.
+ if (iLeft >= iRight)
+ return;
+
+ // ASSERT that we now have valid indicies. This is statically provable
+ // since this private function is only called with valid indicies,
+ // and iLeft and iRight only converge towards eachother. However,
+ // PreFast can't detect this because it doesn't know about our callers.
+ COMPILER_ASSUME(iLeft >= 0 && iLeft < m_iCount);
+ COMPILER_ASSUME(iRight >= 0 && iRight < m_iCount);
+
+ // The mid-element is the pivot, move it to the left.
+ Swap(iLeft, (iLeft + iRight) / 2);
+ iLast = iLeft;
+
+ // move everything that is smaller than the pivot to the left.
+ for (i = iLeft + 1; i <= iRight; i++)
+ {
+ if (Compare(&m_pBase[i], &m_pBase[iLeft]) < 0)
+ {
+ Swap(i, ++iLast);
+ }
+ }
+
+ // Put the pivot to the point where it is in between smaller and larger elements.
+ Swap(iLeft, iLast);
+
+ // Sort each partition.
+ SSIZE_T iLeftLast = iLast - 1;
+ SSIZE_T iRightFirst = iLast + 1;
+ if (iLeftLast - iLeft < iRight - iRightFirst)
+ { // Left partition is smaller, sort it recursively
+ SortRange(iLeft, iLeftLast);
+ // Tail call to sort the right (bigger) partition
+ iLeft = iRightFirst;
+ //iRight = iRight;
+ continue;
+ }
+ else
+ { // Right partition is smaller, sort it recursively
+ SortRange(iRightFirst, iRight);
+ // Tail call to sort the left (bigger) partition
+ //iLeft = iLeft;
+ iRight = iLeftLast;
+ continue;
+ }
+ }
+ }
+};
+
+//*****************************************************************************
+// Faster and simpler version of the binary search below.
+//*****************************************************************************
+template <class T>
+const T * BinarySearch(const T * pBase, int iCount, const T & find)
+{
+ WRAPPER_NO_CONTRACT;
+
+ int iFirst = 0;
+ int iLast = iCount - 1;
+
+ // It is faster to use linear search once we get down to a small number of elements.
+ while (iLast - iFirst > 10)
+ {
+ int iMid = (iLast + iFirst) / 2;
+
+ if (find < pBase[iMid])
+ iLast = iMid - 1;
+ else
+ iFirst = iMid;
+ }
+
+ for (int i = iFirst; i <= iLast; i++)
+ {
+ if (find == pBase[i])
+ return &pBase[i];
+
+ if (find < pBase[i])
+ break;
+ }
+
+ return NULL;
+}
+
+//*****************************************************************************
+// This template encapsulates a binary search algorithm on the given type
+// of data.
+//*****************************************************************************
+template <class T> class CBinarySearch
+{
+private:
+ const T *m_pBase; // Base of array to sort.
+ int m_iCount; // How many items in array.
+
+public:
+ CBinarySearch(
+ const T *pBase, // Address of first element.
+ int iCount) : // Value to find.
+ m_pBase(pBase),
+ m_iCount(iCount)
+ {
+ LIMITED_METHOD_CONTRACT;
+ }
+
+//*****************************************************************************
+// Searches for the item passed to ctor.
+//*****************************************************************************
+ const T *Find( // Pointer to found item in array.
+ const T *psFind, // The key to find.
+ int *piInsert = NULL) // Index to insert at.
+ {
+ WRAPPER_NO_CONTRACT;
+ int iMid, iFirst, iLast; // Loop control.
+ int iCmp; // Comparison.
+
+ iFirst = 0;
+ iLast = m_iCount - 1;
+ while (iFirst <= iLast)
+ {
+ iMid = (iLast + iFirst) / 2;
+ iCmp = Compare(psFind, &m_pBase[iMid]);
+ if (iCmp == 0)
+ {
+ if (piInsert != NULL)
+ *piInsert = iMid;
+ return (&m_pBase[iMid]);
+ }
+ else if (iCmp < 0)
+ iLast = iMid - 1;
+ else
+ iFirst = iMid + 1;
+ }
+ if (piInsert != NULL)
+ *piInsert = iFirst;
+ return (NULL);
+ }
+
+//*****************************************************************************
+// Override this function to do the comparison if a comparison operator is
+// not valid for your data type (such as a struct).
+//*****************************************************************************
+ virtual int Compare( // -1, 0, or 1
+ const T *psFirst, // Key you are looking for.
+ const T *psSecond) // Item to compare to.
+ {
+ LIMITED_METHOD_CONTRACT;
+ return (memcmp(psFirst, psSecond, sizeof(T)));
+// return (::Compare(*psFirst, *psSecond));
+ }
+};
+
+//*****************************************************************************
+// The information that the hash table implementation stores at the beginning
+// of every record that can be but in the hash table.
+//*****************************************************************************
+typedef DPTR(struct HASHENTRY) PTR_HASHENTRY;
+struct HASHENTRY
+{
+ ULONG iPrev; // Previous bucket in the chain.
+ ULONG iNext; // Next bucket in the chain.
+};
+
+typedef DPTR(struct FREEHASHENTRY) PTR_FREEHASHENTRY;
+struct FREEHASHENTRY : HASHENTRY
+{
+ ULONG iFree;
+};
+
+//*****************************************************************************
+// Used by the FindFirst/FindNextEntry functions. These api's allow you to
+// do a sequential scan of all entries.
+//*****************************************************************************
+struct HASHFIND
+{
+ ULONG iBucket; // The next bucket to look in.
+ ULONG iNext;
+};
+
+
+//*****************************************************************************
+// IMPORTANT: This data structure is deprecated, please do not add any new uses.
+// The hashtable implementation that should be used instead is code:SHash.
+// If code:SHash does not work for you, talk to mailto:clrdeag.
+//*****************************************************************************
+// This is a class that implements a chain and bucket hash table.
+//
+// The data is actually supplied as an array of structures by the user of this class.
+// This allows the buckets to use small indices to point to the chain, instead of pointers.
+//
+// Each entry in the array contains a HASHENTRY structure immediately
+// followed by the key used to hash the structure.
+//
+// The HASHENTRY part of every structure is used to implement the chain of
+// entries in a single bucket.
+//
+// This implementation does not support rehashing the buckets if the table grows
+// to big.
+// @TODO: Fix this by adding an abstract function Hash() which must be implemented
+// by all clients.
+//
+//*****************************************************************************
+class CHashTable
+{
+ friend class DebuggerRCThread; //RCthread actually needs access to
+ //fields of derrived class DebuggerPatchTable
+
+protected:
+ TADDR m_pcEntries; // Pointer to the array of structs.
+ ULONG m_iEntrySize; // Size of the structs.
+
+ ULONG m_iBuckets; // # of chains we are hashing into.
+ PTR_ULONG m_piBuckets; // Ptr to the array of bucket chains.
+
+ INDEBUG(unsigned m_maxSearch;) // For evaluating perf characteristics
+
+ HASHENTRY *EntryPtr(ULONG iEntry)
+ {
+ LIMITED_METHOD_DAC_CONTRACT;
+ return (PTR_HASHENTRY(m_pcEntries + (iEntry * m_iEntrySize)));
+ }
+
+ ULONG ItemIndex(HASHENTRY *p)
+ {
+ SUPPORTS_DAC;
+ LIMITED_METHOD_CONTRACT;
+ return (ULONG)((dac_cast<TADDR>(p) - m_pcEntries) / m_iEntrySize);
+ }
+
+
+public:
+
+ CHashTable(
+ ULONG iBuckets) : // # of chains we are hashing into.
+ m_pcEntries((TADDR)NULL),
+ m_iBuckets(iBuckets)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_piBuckets = NULL;
+
+ INDEBUG(m_maxSearch = 0;)
+ }
+
+ CHashTable() : // # of chains we are hashing into.
+ m_pcEntries((TADDR)NULL),
+ m_iBuckets(5)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_piBuckets = NULL;
+
+ INDEBUG(m_maxSearch = 0;)
+ }
+
+#ifndef DACCESS_COMPILE
+
+ ~CHashTable()
+ {
+ LIMITED_METHOD_CONTRACT;
+ if (m_piBuckets != NULL)
+ {
+ delete [] m_piBuckets;
+ m_piBuckets = NULL;
+ }
+ }
+
+//*****************************************************************************
+// This is the second part of construction where we do all of the work that
+// can fail. We also take the array of structs here because the calling class
+// presumably needs to allocate it in its NewInit.
+//*****************************************************************************
+ HRESULT NewInit( // Return status.
+ BYTE *pcEntries, // Array of structs we are managing.
+ ULONG iEntrySize); // Size of the entries.
+
+//*****************************************************************************
+// This can be called to change the pointer to the table that the hash table
+// is managing. You might call this if (for example) you realloc the size
+// of the table and its pointer is different.
+//*****************************************************************************
+ void SetTable(
+ BYTE *pcEntries) // Array of structs we are managing.
+ {
+ LIMITED_METHOD_CONTRACT;
+ m_pcEntries = (TADDR)pcEntries;
+ }
+
+//*****************************************************************************
+// Clear the hash table as if there were nothing in it.
+//*****************************************************************************
+ void Clear()
+ {
+ LIMITED_METHOD_CONTRACT;
+ _ASSERTE(m_piBuckets != NULL);
+ memset(m_piBuckets, 0xff, m_iBuckets * sizeof(ULONG));
+ }
+
+//*****************************************************************************
+// Add the struct at the specified index in m_pcEntries to the hash chains.
+//*****************************************************************************
+ BYTE *Add( // New entry.
+ ULONG iHash, // Hash value of entry to add.
+ ULONG iIndex); // Index of struct in m_pcEntries.
+
+//*****************************************************************************
+// Delete the struct at the specified index in m_pcEntries from the hash chains.
+//*****************************************************************************
+ void Delete(
+ ULONG iHash, // Hash value of entry to delete.
+ ULONG iIndex); // Index of struct in m_pcEntries.
+
+ void Delete(
+ ULONG iHash, // Hash value of entry to delete.
+ HASHENTRY *psEntry); // The struct to delete.
+
+//*****************************************************************************
+// The item at the specified index has been moved, update the previous and
+// next item.
+//*****************************************************************************
+ void Move(
+ ULONG iHash, // Hash value for the item.
+ ULONG iNew); // New location.
+
+#endif // #ifndef DACCESS_COMPILE
+
+//*****************************************************************************
+// Return a boolean indicating whether or not this hash table has been inited.
+//*****************************************************************************
+ int IsInited()
+ {
+ LIMITED_METHOD_CONTRACT;
+ return (m_piBuckets != NULL);
+ }
+
+//*****************************************************************************
+// Search the hash table for an entry with the specified key value.
+//*****************************************************************************
+ BYTE *Find( // Index of struct in m_pcEntries.
+ ULONG iHash, // Hash value of the item.
+ SIZE_T key); // The key to match.
+
+//*****************************************************************************
+// Search the hash table for the next entry with the specified key value.
+//*****************************************************************************
+ ULONG FindNext( // Index of struct in m_pcEntries.
+ SIZE_T key, // The key to match.
+ ULONG iIndex); // Index of previous match.
+
+//*****************************************************************************
+// Returns the first entry in the first hash bucket and inits the search
+// struct. Use the FindNextEntry function to continue walking the list. The
+// return order is not gauranteed.
+//*****************************************************************************
+ BYTE *FindFirstEntry( // First entry found, or 0.
+ HASHFIND *psSrch) // Search object.
+ {
+ WRAPPER_NO_CONTRACT;
+ if (m_piBuckets == 0)
+ return (0);
+ psSrch->iBucket = 1;
+ psSrch->iNext = m_piBuckets[0];
+ return (FindNextEntry(psSrch));
+ }
+
+//*****************************************************************************
+// Returns the next entry in the list.
+//*****************************************************************************
+ BYTE *FindNextEntry( // The next entry, or0 for end of list.
+ HASHFIND *psSrch); // Search object.
+
+#ifdef DACCESS_COMPILE
+ void EnumMemoryRegions(CLRDataEnumMemoryFlags flags,
+ ULONG numEntries);
+#endif
+
+protected:
+ virtual BOOL Cmp(SIZE_T key1, const HASHENTRY * pc2) = 0;
+};
+
+
+class CNewData
+{
+public:
+ static BYTE *Alloc(int iSize, int iMaxSize)
+ {
+ WRAPPER_NO_CONTRACT;
+ return (new BYTE[iSize]);
+ }
+ static void Free(BYTE *pPtr, int iSize)
+ {
+ LIMITED_METHOD_CONTRACT;
+ delete [] pPtr;
+ }
+ static BYTE *Grow(BYTE *&pPtr, int iCurSize)
+ {
+ WRAPPER_NO_CONTRACT;
+ BYTE *p;
+ S_SIZE_T newSize = S_SIZE_T(iCurSize) + S_SIZE_T(GrowSize(iCurSize));
+ //check for overflow
+ if(newSize.IsOverflow())
+ p = NULL;
+ else
+ p = new (nothrow) BYTE[newSize.Value()];
+ if (p == 0) return (0);
+ memcpy (p, pPtr, iCurSize);
+ delete [] pPtr;
+ pPtr = p;
+ return pPtr;
+ }
+ static void Clean(BYTE * pData, int iSize)
+ {
+ }
+ static int RoundSize(int iSize)
+ {
+ LIMITED_METHOD_CONTRACT;
+ return (iSize);
+ }
+ static int GrowSize(int iCurSize)
+ {
+ LIMITED_METHOD_CONTRACT;
+ int newSize = (3 * iCurSize) / 2;
+ return (newSize < 256) ? 256 : newSize;
+ }
+};
+
+class CNewDataNoThrow
+{
+public:
+ static BYTE *Alloc(int iSize, int iMaxSize)
+ {
+ WRAPPER_NO_CONTRACT;
+ return (new (nothrow) BYTE[iSize]);
+ }
+ static void Free(BYTE *pPtr, int iSize)
+ {
+ LIMITED_METHOD_CONTRACT;
+ delete [] pPtr;
+ }
+ static BYTE *Grow(BYTE *&pPtr, int iCurSize)
+ {
+ WRAPPER_NO_CONTRACT;
+ BYTE *p;
+ S_SIZE_T newSize = S_SIZE_T(iCurSize) + S_SIZE_T(GrowSize(iCurSize));
+ //check for overflow
+ if(newSize.IsOverflow())
+ p = NULL;
+ else
+ p = new (nothrow) BYTE[newSize.Value()];
+ if (p == 0) return (0);
+ memcpy (p, pPtr, iCurSize);
+ delete [] pPtr;
+ pPtr = p;
+ return pPtr;
+ }
+ static void Clean(BYTE * pData, int iSize)
+ {
+ }
+ static int RoundSize(int iSize)
+ {
+ LIMITED_METHOD_CONTRACT;
+ return (iSize);
+ }
+ static int GrowSize(int iCurSize)
+ {
+ LIMITED_METHOD_CONTRACT;
+ int newSize = (3 * iCurSize) / 2;
+ return (newSize < 256) ? 256 : newSize;
+ }
+};
+
+
+//*****************************************************************************
+// IMPORTANT: This data structure is deprecated, please do not add any new uses.
+// The hashtable implementation that should be used instead is code:SHash.
+// If code:SHash does not work for you, talk to mailto:clrdeag.
+//*****************************************************************************
+// CHashTable expects the data to be in a single array - this is provided by
+// CHashTableAndData.
+// The array is allocated using the MemMgr type. CNewData and
+// CNewDataNoThrow can be used for this.
+//*****************************************************************************
+template <class MemMgr>
+class CHashTableAndData : public CHashTable
+{
+public:
+ ULONG m_iFree; // Index into m_pcEntries[] of next available slot
+ ULONG m_iEntries; // size of m_pcEntries[]
+
+public:
+
+ CHashTableAndData() :
+ CHashTable()
+ {
+ LIMITED_METHOD_CONTRACT;
+ }
+
+ CHashTableAndData(
+ ULONG iBuckets) : // # of chains we are hashing into.
+ CHashTable(iBuckets)
+ {
+ LIMITED_METHOD_CONTRACT;
+ }
+
+#ifndef DACCESS_COMPILE
+
+ ~CHashTableAndData()
+ {
+ WRAPPER_NO_CONTRACT;
+ if (m_pcEntries != NULL)
+ MemMgr::Free((BYTE*)m_pcEntries, MemMgr::RoundSize(m_iEntries * m_iEntrySize));
+ }
+
+//*****************************************************************************
+// This is the second part of construction where we do all of the work that
+// can fail. We also take the array of structs here because the calling class
+// presumably needs to allocate it in its NewInit.
+//*****************************************************************************
+ HRESULT NewInit( // Return status.
+ ULONG iEntries, // # of entries.
+ ULONG iEntrySize, // Size of the entries.
+ int iMaxSize); // Max size of data.
+
+//*****************************************************************************
+// Clear the hash table as if there were nothing in it.
+//*****************************************************************************
+ void Clear()
+ {
+ WRAPPER_NO_CONTRACT;
+ m_iFree = 0;
+ InitFreeChain(0, m_iEntries);
+ CHashTable::Clear();
+ }
+
+//*****************************************************************************
+// Grabs a slot for the new entry to be added.
+// The caller should fill in the non-HASHENTRY part of the returned slot
+//*****************************************************************************
+ BYTE *Add(
+ ULONG iHash) // Hash value of entry to add.
+ {
+ WRAPPER_NO_CONTRACT;
+ FREEHASHENTRY *psEntry;
+
+ // Make the table bigger if necessary.
+ if (m_iFree == UINT32_MAX && !Grow())
+ return (NULL);
+
+ // Add the first entry from the free list to the hash chain.
+ psEntry = (FREEHASHENTRY *) CHashTable::Add(iHash, m_iFree);
+ m_iFree = psEntry->iFree;
+
+ // If we're recycling memory, give our memory-allocator a chance to re-init it.
+
+ // Each entry is prefixed with a header - we don't want to trash that.
+ SIZE_T cbHeader = sizeof(FREEHASHENTRY);
+ MemMgr::Clean((BYTE*) psEntry + cbHeader, (int) (m_iEntrySize - cbHeader));
+
+ return ((BYTE *) psEntry);
+ }
+
+//*****************************************************************************
+// Delete the struct at the specified index in m_pcEntries from the hash chains.
+//*****************************************************************************
+ void Delete(
+ ULONG iHash, // Hash value of entry to delete.
+ ULONG iIndex) // Index of struct in m_pcEntries.
+ {
+ WRAPPER_NO_CONTRACT;
+ CHashTable::Delete(iHash, iIndex);
+ ((FREEHASHENTRY *) EntryPtr(iIndex))->iFree = m_iFree;
+ m_iFree = iIndex;
+ }
+
+ void Delete(
+ ULONG iHash, // Hash value of entry to delete.
+ HASHENTRY *psEntry) // The struct to delete.
+ {
+ WRAPPER_NO_CONTRACT;
+ CHashTable::Delete(iHash, psEntry);
+ ((FREEHASHENTRY *) psEntry)->iFree = m_iFree;
+ m_iFree = ItemIndex(psEntry);
+ }
+
+#endif // #ifndef DACCESS_COMPILE
+
+ // This is a sad legacy workaround. The debugger's patch table (implemented as this
+ // class) is shared across process. We publish the runtime offsets of
+ // some key fields. Since those fields are private, we have to provide
+ // accessors here. So if you're not using these functions, don't start.
+ // We can hopefully remove them.
+ // Note that we can't just make RCThread a friend of this class (we tried
+ // originally) because the inheritence chain has a private modifier,
+ // so DebuggerPatchTable::m_pcEntries is illegal.
+ static SIZE_T helper_GetOffsetOfEntries()
+ {
+ LIMITED_METHOD_CONTRACT;
+ return offsetof(CHashTableAndData, m_pcEntries);
+ }
+
+ static SIZE_T helper_GetOffsetOfCount()
+ {
+ LIMITED_METHOD_CONTRACT;
+ return offsetof(CHashTableAndData, m_iEntries);
+ }
+
+#ifdef DACCESS_COMPILE
+ void EnumMemoryRegions(CLRDataEnumMemoryFlags flags)
+ {
+ SUPPORTS_DAC;
+ CHashTable::EnumMemoryRegions(flags, m_iEntries);
+ }
+#endif
+
+private:
+ void InitFreeChain(ULONG iStart,ULONG iEnd);
+ int Grow();
+};
+
+#ifndef DACCESS_COMPILE
+
+//*****************************************************************************
+// This is the second part of construction where we do all of the work that
+// can fail. We also take the array of structs here because the calling class
+// presumably needs to allocate it in its NewInit.
+//*****************************************************************************
+template<class MemMgr>
+HRESULT CHashTableAndData<MemMgr>::NewInit(// Return status.
+ ULONG iEntries, // # of entries.
+ ULONG iEntrySize, // Size of the entries.
+ int iMaxSize) // Max size of data.
+{
+ WRAPPER_NO_CONTRACT;
+ BYTE *pcEntries;
+ HRESULT hr;
+
+
+ // note that this function can throw because it depends on the <M>::Alloc
+
+ // Allocate the memory for the entries.
+ if ((pcEntries = MemMgr::Alloc(MemMgr::RoundSize(iEntries * iEntrySize),
+ MemMgr::RoundSize(iMaxSize))) == 0)
+ return (E_OUTOFMEMORY);
+ m_iEntries = iEntries;
+
+ // Init the base table.
+ if (FAILED(hr = CHashTable::NewInit(pcEntries, iEntrySize)))
+ MemMgr::Free(pcEntries, MemMgr::RoundSize(iEntries * iEntrySize));
+ else
+ {
+ // Init the free chain.
+ m_iFree = 0;
+ InitFreeChain(0, iEntries);
+ }
+ return (hr);
+}
+
+//*****************************************************************************
+// Initialize a range of records such that they are linked together to be put
+// on the free chain.
+//*****************************************************************************
+template<class MemMgr>
+void CHashTableAndData<MemMgr>::InitFreeChain(
+ ULONG iStart, // Index to start initializing.
+ ULONG iEnd) // Index to stop initializing
+{
+ LIMITED_METHOD_CONTRACT;
+ BYTE* pcPtr;
+ _ASSERTE(iEnd > iStart);
+
+ pcPtr = (BYTE*)m_pcEntries + iStart * m_iEntrySize;
+ for (++iStart; iStart < iEnd; ++iStart)
+ {
+ ((FREEHASHENTRY *) pcPtr)->iFree = iStart;
+ pcPtr += m_iEntrySize;
+ }
+ ((FREEHASHENTRY *) pcPtr)->iFree = UINT32_MAX;
+}
+
+//*****************************************************************************
+// Attempt to increase the amount of space available for the record heap.
+//*****************************************************************************
+template<class MemMgr>
+int CHashTableAndData<MemMgr>::Grow() // 1 if successful, 0 if not.
+{
+ WRAPPER_NO_CONTRACT;
+ int iCurSize; // Current size in bytes.
+ int iEntries; // New # of entries.
+
+ _ASSERTE(m_pcEntries != NULL);
+ _ASSERTE(m_iFree == UINT32_MAX);
+
+ // Compute the current size and new # of entries.
+ S_UINT32 iTotEntrySize = S_UINT32(m_iEntries) * S_UINT32(m_iEntrySize);
+ if( iTotEntrySize.IsOverflow() )
+ {
+ _ASSERTE( !"CHashTableAndData overflow!" );
+ return (0);
+ }
+ iCurSize = MemMgr::RoundSize( iTotEntrySize.Value() );
+ iEntries = (iCurSize + MemMgr::GrowSize(iCurSize)) / m_iEntrySize;
+
+ if ( (iEntries < 0) || ((ULONG)iEntries <= m_iEntries) )
+ {
+ _ASSERTE( !"CHashTableAndData overflow!" );
+ return (0);
+ }
+
+ // Try to expand the array.
+ if (MemMgr::Grow(*(BYTE**)&m_pcEntries, iCurSize) == 0)
+ return (0);
+
+ // Init the newly allocated space.
+ InitFreeChain(m_iEntries, iEntries);
+ m_iFree = m_iEntries;
+ m_iEntries = iEntries;
+ return (1);
+}
+
+#endif // #ifndef DACCESS_COMPILE
+
+//*****************************************************************************
+//*****************************************************************************
+
+inline COUNT_T HashCOUNT_T(COUNT_T currentHash, COUNT_T data)
+{
+ LIMITED_METHOD_DAC_CONTRACT;
+ return ((currentHash << 5) + currentHash) ^ data;
+}
+
+inline COUNT_T HashPtr(COUNT_T currentHash, PTR_VOID ptr)
+{
+ WRAPPER_NO_CONTRACT;
+ SUPPORTS_DAC;
+ return HashCOUNT_T(currentHash, COUNT_T(SIZE_T(dac_cast<TADDR>(ptr))));
+}
+
+inline DWORD HashThreeToOne(DWORD a, DWORD b, DWORD c)
+{
+ LIMITED_METHOD_DAC_CONTRACT;
+
+ /*
+ lookup3.c, by Bob Jenkins, May 2006, Public Domain.
+
+ These are functions for producing 32-bit hashes for hash table lookup.
+ hashword(), hashlittle(), hashlittle2(), hashbig(), mix(), and final()
+ are externally useful functions. Routines to test the hash are included
+ if SELF_TEST is defined. You can use this free for any purpose. It's in
+ the public domain. It has no warranty.
+ */
+
+ #define rot32(x,k) (((x)<<(k)) | ((x)>>(32-(k))))
+ c ^= b; c -= rot32(b,14);
+ a ^= c; a -= rot32(c,11);
+ b ^= a; b -= rot32(a,25);
+ c ^= b; c -= rot32(b,16);
+ a ^= c; a -= rot32(c,4);
+ b ^= a; b -= rot32(a,14);
+ c ^= b; c -= rot32(b,24);
+
+ return c;
+}
+
+inline ULONG HashBytes(BYTE const *pbData, size_t iSize)
+{
+ LIMITED_METHOD_CONTRACT;
+ ULONG hash = 5381;
+
+ BYTE const *pbDataEnd = pbData + iSize;
+
+ for (/**/ ; pbData < pbDataEnd; pbData++)
+ {
+ hash = ((hash << 5) + hash) ^ *pbData;
+ }
+ return hash;
+}
+
+// Helper function for hashing a string char by char.
+inline ULONG HashStringA(LPCSTR szStr)
+{
+ LIMITED_METHOD_CONTRACT;
+ ULONG hash = 5381;
+ int c;
+
+ while ((c = *szStr) != 0)
+ {
+ hash = ((hash << 5) + hash) ^ c;
+ ++szStr;
+ }
+ return hash;
+}
+
+inline ULONG HashString(LPCWSTR szStr)
+{
+ LIMITED_METHOD_CONTRACT;
+ ULONG hash = 5381;
+ int c;
+
+ while ((c = *szStr) != 0)
+ {
+ hash = ((hash << 5) + hash) ^ c;
+ ++szStr;
+ }
+ return hash;
+}
+
+inline ULONG HashStringN(LPCWSTR szStr, SIZE_T cchStr)
+{
+ LIMITED_METHOD_CONTRACT;
+ ULONG hash = 5381;
+
+ // hash the string two characters at a time
+ ULONG *ptr = (ULONG *)szStr;
+
+ // we assume that szStr is null-terminated
+ _ASSERTE(cchStr <= wcslen(szStr));
+ SIZE_T cDwordCount = (cchStr + 1) / 2;
+
+ for (SIZE_T i = 0; i < cDwordCount; i++)
+ {
+ hash = ((hash << 5) + hash) ^ ptr[i];
+ }
+
+ return hash;
+}
+
+// Case-insensitive string hash function.
+inline ULONG HashiStringA(LPCSTR szStr)
+{
+ LIMITED_METHOD_CONTRACT;
+ ULONG hash = 5381;
+ while (*szStr != 0)
+ {
+ hash = ((hash << 5) + hash) ^ toupper(*szStr);
+ szStr++;
+ }
+ return hash;
+}
+
+// Case-insensitive string hash function.
+inline ULONG HashiString(LPCWSTR szStr)
+{
+ LIMITED_METHOD_CONTRACT;
+ ULONG hash = 5381;
+ while (*szStr != 0)
+ {
+ hash = ((hash << 5) + hash) ^ towupper(*szStr);
+ szStr++;
+ }
+ return hash;
+}
+
+// Case-insensitive string hash function.
+inline ULONG HashiStringN(LPCWSTR szStr, DWORD count)
+{
+ LIMITED_METHOD_CONTRACT;
+ ULONG hash = 5381;
+ while (*szStr != 0 && count--)
+ {
+ hash = ((hash << 5) + hash) ^ towupper(*szStr);
+ szStr++;
+ }
+ return hash;
+}
+
+// Case-insensitive string hash function when all of the
+// characters in the string are known to be below 0x80.
+// Knowing this is much more efficient than calling
+// towupper above.
+inline ULONG HashiStringKnownLower80(LPCWSTR szStr) {
+ LIMITED_METHOD_CONTRACT;
+ ULONG hash = 5381;
+ int c;
+ int mask = ~0x20;
+ while ((c = *szStr)!=0) {
+ //If we have a lowercase character, ANDing off 0x20
+ //(mask) will make it an uppercase character.
+ if (c>='a' && c<='z') {
+ c&=mask;
+ }
+ hash = ((hash << 5) + hash) ^ c;
+ ++szStr;
+ }
+ return hash;
+}
+
+inline ULONG HashiStringNKnownLower80(LPCWSTR szStr, DWORD count) {
+ LIMITED_METHOD_CONTRACT;
+ ULONG hash = 5381;
+ int c;
+ int mask = ~0x20;
+ while ((c = *szStr) !=0 && count--) {
+ //If we have a lowercase character, ANDing off 0x20
+ //(mask) will make it an uppercase character.
+ if (c>='a' && c<='z') {
+ c&=mask;
+ }
+ hash = ((hash << 5) + hash) ^ c;
+ ++szStr;
+ }
+ return hash;
+}
+
+//*****************************************************************************
+// IMPORTANT: This data structure is deprecated, please do not add any new uses.
+// The hashtable implementation that should be used instead is code:SHash.
+// If code:SHash does not work for you, talk to mailto:clrdeag.
+//*****************************************************************************
+// This class implements a closed hashing table. Values are hashed to a bucket,
+// and if that bucket is full already, then the value is placed in the next
+// free bucket starting after the desired target (with wrap around). If the
+// table becomes 75% full, it is grown and rehashed to reduce lookups. This
+// class is best used in a reltively small lookup table where hashing is
+// not going to cause many collisions. By not having the collision chain
+// logic, a lot of memory is saved.
+//
+// The user of the template is required to supply several methods which decide
+// how each element can be marked as free, deleted, or used. It would have
+// been possible to write this with more internal logic, but that would require
+// either (a) more overhead to add status on top of elements, or (b) hard
+// coded types like one for strings, one for ints, etc... This gives you the
+// flexibility of adding logic to your type.
+//*****************************************************************************
+class CClosedHashBase
+{
+ BYTE *EntryPtr(int iEntry)
+ {
+ LIMITED_METHOD_CONTRACT;
+ return (m_rgData + (iEntry * m_iEntrySize));
+ }
+
+ BYTE *EntryPtr(int iEntry, BYTE *rgData)
+ {
+ LIMITED_METHOD_CONTRACT;
+ return (rgData + (iEntry * m_iEntrySize));
+ }
+
+public:
+ enum ELEMENTSTATUS
+ {
+ FREE, // Item is not in use right now.
+ DELETED, // Item is deleted.
+ USED // Item is in use.
+ };
+
+ CClosedHashBase(
+ int iBuckets, // How many buckets should we start with.
+ int iEntrySize, // Size of an entry.
+ bool bPerfect) : // true if bucket size will hash with no collisions.
+ m_bPerfect(bPerfect),
+ m_iBuckets(iBuckets),
+ m_iEntrySize(iEntrySize),
+ m_iCount(0),
+ m_iCollisions(0),
+ m_rgData(0)
+ {
+ LIMITED_METHOD_CONTRACT;
+ m_iSize = iBuckets + 7;
+ }
+
+ ~CClosedHashBase()
+ {
+ WRAPPER_NO_CONTRACT;
+ Clear();
+ }
+
+ virtual void Clear()
+ {
+ LIMITED_METHOD_CONTRACT;
+ delete [] m_rgData;
+ m_iCount = 0;
+ m_iCollisions = 0;
+ m_rgData = 0;
+ }
+
+//*****************************************************************************
+// Accessors for getting at the underlying data. Be careful to use Count()
+// only when you want the number of buckets actually used.
+//*****************************************************************************
+
+ int Count()
+ {
+ LIMITED_METHOD_CONTRACT;
+ return (m_iCount);
+ }
+
+ int Collisions()
+ {
+ LIMITED_METHOD_CONTRACT;
+ return (m_iCollisions);
+ }
+
+ int Buckets()
+ {
+ LIMITED_METHOD_CONTRACT;
+ return (m_iBuckets);
+ }
+
+ void SetBuckets(int iBuckets, bool bPerfect=false)
+ {
+ LIMITED_METHOD_CONTRACT;
+ _ASSERTE(m_rgData == 0);
+ m_iBuckets = iBuckets;
+ m_iSize = m_iBuckets + 7;
+ m_bPerfect = bPerfect;
+ }
+
+ BYTE *Data()
+ {
+ LIMITED_METHOD_CONTRACT;
+ return (m_rgData);
+ }
+
+//*****************************************************************************
+// Add a new item to hash table given the key value. If this new entry
+// exceeds maximum size, then the table will grow and be re-hashed, which
+// may cause a memory error.
+//*****************************************************************************
+ BYTE *Add( // New item to fill out on success.
+ void *pData) // The value to hash on.
+ {
+ WRAPPER_NO_CONTRACT;
+ // If we haven't allocated any memory, or it is too small, fix it.
+ if (!m_rgData || ((m_iCount + 1) > (m_iSize * 3 / 4) && !m_bPerfect))
+ {
+ if (!ReHash())
+ return (0);
+ }
+
+ return (DoAdd(pData, m_rgData, m_iBuckets, m_iSize, m_iCollisions, m_iCount));
+ }
+
+//*****************************************************************************
+// Delete the given value. This will simply mark the entry as deleted (in
+// order to keep the collision chain intact). There is an optimization that
+// consecutive deleted entries leading up to a free entry are themselves freed
+// to reduce collisions later on.
+//*****************************************************************************
+ void Delete(
+ void *pData); // Key value to delete.
+
+
+//*****************************************************************************
+// Callback function passed to DeleteLoop.
+//*****************************************************************************
+ typedef BOOL (* DELETELOOPFUNC)( // Delete current item?
+ BYTE *pEntry, // Bucket entry to evaluate
+ void *pCustomizer); // User-defined value
+
+//*****************************************************************************
+// Iterates over all active values, passing each one to pDeleteLoopFunc.
+// If pDeleteLoopFunc returns TRUE, the entry is deleted. This is safer
+// and faster than using FindNext() and Delete().
+//*****************************************************************************
+ void DeleteLoop(
+ DELETELOOPFUNC pDeleteLoopFunc, // Decides whether to delete item
+ void *pCustomizer); // Extra value passed to deletefunc.
+
+
+//*****************************************************************************
+// Lookup a key value and return a pointer to the element if found.
+//*****************************************************************************
+ BYTE *Find( // The item if found, 0 if not.
+ void *pData); // The key to lookup.
+
+//*****************************************************************************
+// Look for an item in the table. If it isn't found, then create a new one and
+// return that.
+//*****************************************************************************
+ BYTE *FindOrAdd( // The item if found, 0 if not.
+ void *pData, // The key to lookup.
+ bool &bNew); // true if created.
+
+//*****************************************************************************
+// The following functions are used to traverse each used entry. This code
+// will skip over deleted and free entries freeing the caller up from such
+// logic.
+//*****************************************************************************
+ BYTE *GetFirst() // The first entry, 0 if none.
+ {
+ WRAPPER_NO_CONTRACT;
+ int i; // Loop control.
+
+ // If we've never allocated the table there can't be any to get.
+ if (m_rgData == 0)
+ return (0);
+
+ // Find the first one.
+ for (i=0; i<m_iSize; i++)
+ {
+ if (Status(EntryPtr(i)) != FREE && Status(EntryPtr(i)) != DELETED)
+ return (EntryPtr(i));
+ }
+ return (0);
+ }
+
+ BYTE *GetNext(BYTE *Prev) // The next entry, 0 if done.
+ {
+ WRAPPER_NO_CONTRACT;
+ int i; // Loop control.
+
+ for (i = (int)(((size_t) Prev - (size_t) &m_rgData[0]) / m_iEntrySize) + 1; i<m_iSize; i++)
+ {
+ if (Status(EntryPtr(i)) != FREE && Status(EntryPtr(i)) != DELETED)
+ return (EntryPtr(i));
+ }
+ return (0);
+ }
+
+private:
+//*****************************************************************************
+// Hash is called with a pointer to an element in the table. You must override
+// this method and provide a hash algorithm for your element type.
+//*****************************************************************************
+ virtual unsigned int Hash( // The key value.
+ void const *pData)=0; // Raw data to hash.
+
+//*****************************************************************************
+// Compare is used in the typical memcmp way, 0 is eqaulity, -1/1 indicate
+// direction of miscompare. In this system everything is always equal or not.
+//*****************************************************************************
+ virtual unsigned int Compare( // 0, -1, or 1.
+ void const *pData, // Raw key data on lookup.
+ BYTE *pElement)=0; // The element to compare data against.
+
+//*****************************************************************************
+// Return true if the element is free to be used.
+//*****************************************************************************
+ virtual ELEMENTSTATUS Status( // The status of the entry.
+ BYTE *pElement)=0; // The element to check.
+
+//*****************************************************************************
+// Sets the status of the given element.
+//*****************************************************************************
+ virtual void SetStatus(
+ BYTE *pElement, // The element to set status for.
+ ELEMENTSTATUS eStatus)=0; // New status.
+
+//*****************************************************************************
+// Returns the internal key value for an element.
+//*****************************************************************************
+ virtual void *GetKey( // The data to hash on.
+ BYTE *pElement)=0; // The element to return data ptr for.
+
+//*****************************************************************************
+// This helper actually does the add for you.
+//*****************************************************************************
+ BYTE *DoAdd(void *pData, BYTE *rgData, int &iBuckets, int iSize,
+ int &iCollisions, int &iCount);
+
+//*****************************************************************************
+// This function is called either to init the table in the first place, or
+// to rehash the table if we ran out of room.
+//*****************************************************************************
+ bool ReHash(); // true if successful.
+
+//*****************************************************************************
+// Walk each item in the table and mark it free.
+//*****************************************************************************
+ void InitFree(BYTE *ptr, int iSize)
+ {
+ WRAPPER_NO_CONTRACT;
+ int i;
+ for (i=0; i<iSize; i++, ptr += m_iEntrySize)
+ SetStatus(ptr, FREE);
+ }
+
+private:
+ bool m_bPerfect; // true if the table size guarantees
+ // no collisions.
+ int m_iBuckets; // How many buckets do we have.
+ int m_iEntrySize; // Size of an entry.
+ int m_iSize; // How many elements can we have.
+ int m_iCount; // How many items cannot be used (NON free, i.e. USED+DELETED).
+ int m_iCollisions; // How many have we had.
+ BYTE *m_rgData; // Data element list.
+};
+
+//*****************************************************************************
+// IMPORTANT: This data structure is deprecated, please do not add any new uses.
+// The hashtable implementation that should be used instead is code:SHash.
+// If code:SHash does not work for you, talk to mailto:clrdeag.
+//*****************************************************************************
+template <class T> class CClosedHash : public CClosedHashBase
+{
+public:
+ CClosedHash(
+ int iBuckets, // How many buckets should we start with.
+ bool bPerfect=false) : // true if bucket size will hash with no collisions.
+ CClosedHashBase(iBuckets, sizeof(T), bPerfect)
+ {
+ WRAPPER_NO_CONTRACT;
+ }
+
+ T &operator[](int iIndex)
+ {
+ WRAPPER_NO_CONTRACT;
+ return ((T &) *(Data() + (iIndex * sizeof(T))));
+ }
+
+
+//*****************************************************************************
+// Add a new item to hash table given the key value. If this new entry
+// exceeds maximum size, then the table will grow and be re-hashed, which
+// may cause a memory error.
+//*****************************************************************************
+ T *Add( // New item to fill out on success.
+ void *pData) // The value to hash on.
+ {
+ WRAPPER_NO_CONTRACT;
+ return ((T *) CClosedHashBase::Add(pData));
+ }
+
+//*****************************************************************************
+// Lookup a key value and return a pointer to the element if found.
+//*****************************************************************************
+ T *Find( // The item if found, 0 if not.
+ void *pData) // The key to lookup.
+ {
+ WRAPPER_NO_CONTRACT;
+ return ((T *) CClosedHashBase::Find(pData));
+ }
+
+//*****************************************************************************
+// Look for an item in the table. If it isn't found, then create a new one and
+// return that.
+//*****************************************************************************
+ T *FindOrAdd( // The item if found, 0 if not.
+ void *pData, // The key to lookup.
+ bool &bNew) // true if created.
+ {
+ WRAPPER_NO_CONTRACT;
+ return ((T *) CClosedHashBase::FindOrAdd(pData, bNew));
+ }
+
+
+//*****************************************************************************
+// The following functions are used to traverse each used entry. This code
+// will skip over deleted and free entries freeing the caller up from such
+// logic.
+//*****************************************************************************
+ T *GetFirst() // The first entry, 0 if none.
+ {
+ WRAPPER_NO_CONTRACT;
+ return ((T *) CClosedHashBase::GetFirst());
+ }
+
+ T *GetNext(T *Prev) // The next entry, 0 if done.
+ {
+ WRAPPER_NO_CONTRACT;
+ return ((T *) CClosedHashBase::GetNext((BYTE *) Prev));
+ }
+};
+
+
+//*****************************************************************************
+// IMPORTANT: This data structure is deprecated, please do not add any new uses.
+// The hashtable implementation that should be used instead is code:SHash.
+// If code:SHash does not work for you, talk to mailto:clrdeag.
+//*****************************************************************************
+// Closed hash with typed parameters. The derived class is the second
+// parameter to the template. The derived class must implement:
+// unsigned long Hash(const T *pData);
+// unsigned long Compare(const T *p1, T *p2);
+// ELEMENTSTATUS Status(T *pEntry);
+// void SetStatus(T *pEntry, ELEMENTSTATUS s);
+// void* GetKey(T *pEntry);
+//*****************************************************************************
+template<class T, class H>class CClosedHashEx : public CClosedHash<T>
+{
+public:
+ CClosedHashEx(
+ int iBuckets, // How many buckets should we start with.
+ bool bPerfect=false) : // true if bucket size will hash with no collisions.
+ CClosedHash<T> (iBuckets, bPerfect)
+ {
+ WRAPPER_NO_CONTRACT;
+ }
+
+ unsigned int Hash(const void *pData)
+ {
+ WRAPPER_NO_CONTRACT;
+ return static_cast<H*>(this)->Hash((const T*)pData);
+ }
+
+ unsigned int Compare(const void *p1, BYTE *p2)
+ {
+ WRAPPER_NO_CONTRACT;
+ return static_cast<H*>(this)->Compare((const T*)p1, (T*)p2);
+ }
+
+ typename CClosedHash<T>::ELEMENTSTATUS Status(BYTE *p)
+ {
+ WRAPPER_NO_CONTRACT;
+ return static_cast<H*>(this)->Status((T*)p);
+ }
+
+ void SetStatus(BYTE *p, typename CClosedHash<T>::ELEMENTSTATUS s)
+ {
+ WRAPPER_NO_CONTRACT;
+ static_cast<H*>(this)->SetStatus((T*)p, s);
+ }
+
+ void* GetKey(BYTE *p)
+ {
+ WRAPPER_NO_CONTRACT;
+ return static_cast<H*>(this)->GetKey((T*)p);
+ }
+};
+
+
+//*****************************************************************************
+// IMPORTANT: This data structure is deprecated, please do not add any new uses.
+// The hashtable implementation that should be used instead is code:SHash.
+// If code:SHash does not work for you, talk to mailto:clrdeag.
+//*****************************************************************************
+// This template is another form of a closed hash table. It handles collisions
+// through a linked chain. To use it, derive your hashed item from HASHLINK
+// and implement the virtual functions required. 1.5 * ibuckets will be
+// allocated, with the extra .5 used for collisions. If you add to the point
+// where no free nodes are available, the entire table is grown to make room.
+// The advantage to this system is that collisions are always directly known,
+// there either is one or there isn't.
+//*****************************************************************************
+struct HASHLINK
+{
+ ULONG iNext; // Offset for next entry.
+};
+
+template <class T> class CChainedHash
+{
+ friend class VerifyLayoutsMD;
+public:
+ CChainedHash(int iBuckets=32) :
+ m_rgData(0),
+ m_iBuckets(iBuckets),
+ m_iCount(0),
+ m_iMaxChain(0),
+ m_iFree(0)
+ {
+ LIMITED_METHOD_CONTRACT;
+ m_iSize = iBuckets + (iBuckets / 2);
+ }
+
+ ~CChainedHash()
+ {
+ LIMITED_METHOD_CONTRACT;
+ if (m_rgData)
+ delete [] m_rgData;
+ }
+
+ void SetBuckets(int iBuckets)
+ {
+ LIMITED_METHOD_CONTRACT;
+ _ASSERTE(m_rgData == 0);
+ // if iBuckets==0, then we'll allocate a zero size array and AV on dereference.
+ _ASSERTE(iBuckets > 0);
+ m_iBuckets = iBuckets;
+ m_iSize = iBuckets + (iBuckets / 2);
+ }
+
+ T *Add(void const *pData)
+ {
+ WRAPPER_NO_CONTRACT;
+ ULONG iHash;
+ int iBucket;
+ T *pItem;
+
+ // Build the list if required.
+ if (m_rgData == 0 || m_iFree == 0xffffffff)
+ {
+ if (!ReHash())
+ return (0);
+ }
+
+ // Hash the item and pick a bucket.
+ iHash = Hash(pData);
+ iBucket = iHash % m_iBuckets;
+
+ // Use the bucket if it is free.
+ if (InUse(&m_rgData[iBucket]) == false)
+ {
+ pItem = &m_rgData[iBucket];
+ pItem->iNext = 0xffffffff;
+ }
+ // Else take one off of the free list for use.
+ else
+ {
+ ULONG iEntry;
+
+ // Pull an item from the free list.
+ iEntry = m_iFree;
+ pItem = &m_rgData[m_iFree];
+ m_iFree = pItem->iNext;
+
+ // Link the new node in after the bucket.
+ pItem->iNext = m_rgData[iBucket].iNext;
+ m_rgData[iBucket].iNext = iEntry;
+ }
+ ++m_iCount;
+ return (pItem);
+ }
+
+ T *Find(void const *pData, bool bAddIfNew=false)
+ {
+ WRAPPER_NO_CONTRACT;
+ ULONG iHash;
+ int iBucket;
+ T *pItem;
+
+ // Check states for lookup.
+ if (m_rgData == 0)
+ {
+ // If we won't be adding, then we are through.
+ if (bAddIfNew == false)
+ return (0);
+
+ // Otherwise, create the table.
+ if (!ReHash())
+ return (0);
+ }
+
+ // Hash the item and pick a bucket.
+ iHash = Hash(pData);
+ iBucket = iHash % m_iBuckets;
+
+ // If it isn't in use, then there it wasn't found.
+ if (!InUse(&m_rgData[iBucket]))
+ {
+ if (bAddIfNew == false)
+ pItem = 0;
+ else
+ {
+ pItem = &m_rgData[iBucket];
+ pItem->iNext = 0xffffffff;
+ ++m_iCount;
+ }
+ }
+ // Scan the list for the one we want.
+ else
+ {
+ ULONG iChain = 0;
+ for (pItem=(T *) &m_rgData[iBucket]; pItem; pItem=GetNext(pItem))
+ {
+ if (Cmp(pData, pItem) == 0)
+ break;
+ ++iChain;
+ }
+
+ if (!pItem && bAddIfNew)
+ {
+ ULONG iEntry;
+
+ // Record maximum chain length.
+ if (iChain > m_iMaxChain)
+ m_iMaxChain = iChain;
+
+ // Now need more room.
+ if (m_iFree == 0xffffffff)
+ {
+ if (!ReHash())
+ return (0);
+ }
+
+ // Pull an item from the free list.
+ iEntry = m_iFree;
+ pItem = &m_rgData[m_iFree];
+ m_iFree = pItem->iNext;
+
+ // Link the new node in after the bucket.
+ pItem->iNext = m_rgData[iBucket].iNext;
+ m_rgData[iBucket].iNext = iEntry;
+ ++m_iCount;
+ }
+ }
+ return (pItem);
+ }
+
+ int Count()
+ {
+ LIMITED_METHOD_CONTRACT;
+ return (m_iCount);
+ }
+
+ int Buckets()
+ {
+ LIMITED_METHOD_CONTRACT;
+ return (m_iBuckets);
+ }
+
+ ULONG MaxChainLength()
+ {
+ LIMITED_METHOD_CONTRACT;
+ return (m_iMaxChain);
+ }
+
+ virtual void Clear()
+ {
+ LIMITED_METHOD_CONTRACT;
+ // Free up the memory.
+ if (m_rgData)
+ {
+ delete [] m_rgData;
+ m_rgData = 0;
+ }
+
+ m_rgData = 0;
+ m_iFree = 0;
+ m_iCount = 0;
+ m_iMaxChain = 0;
+ }
+
+ virtual bool InUse(T *pItem)=0;
+ virtual void SetFree(T *pItem)=0;
+ virtual ULONG Hash(void const *pData)=0;
+ virtual int Cmp(void const *pData, void *pItem)=0;
+private:
+ inline T *GetNext(T *pItem)
+ {
+ LIMITED_METHOD_CONTRACT;
+ if (pItem->iNext != 0xffffffff)
+ return ((T *) &m_rgData[pItem->iNext]);
+ return (0);
+ }
+
+ bool ReHash()
+ {
+ WRAPPER_NO_CONTRACT;
+ T *rgTemp;
+ int iNewSize;
+
+ // If this is a first time allocation, then just malloc it.
+ if (!m_rgData)
+ {
+ if ((m_rgData = new (nothrow) T[m_iSize]) == 0)
+ return (false);
+
+ int i;
+ for (i=0; i<m_iSize; i++)
+ SetFree(&m_rgData[i]);
+
+ m_iFree = m_iBuckets;
+ for (i=m_iBuckets; i<m_iSize; i++)
+ ((T *) &m_rgData[i])->iNext = i + 1;
+ ((T *) &m_rgData[m_iSize - 1])->iNext = 0xffffffff;
+ return (true);
+ }
+
+ // Otherwise we need more room on the free chain, so allocate some.
+ iNewSize = m_iSize + (m_iSize / 2);
+
+ // Allocate/realloc memory.
+ if ((rgTemp = new (nothrow) T[iNewSize]) == 0)
+ return (false);
+
+ memcpy (rgTemp,m_rgData,m_iSize*sizeof(T));
+ delete [] m_rgData;
+
+ // Init new entries, save the new free chain, and reset internals.
+ m_iFree = m_iSize;
+ for (int i=m_iFree; i<iNewSize; i++)
+ {
+ SetFree(&rgTemp[i]);
+ ((T *) &rgTemp[i])->iNext = i + 1;
+ }
+ ((T *) &rgTemp[iNewSize - 1])->iNext = 0xffffffff;
+
+ m_rgData = rgTemp;
+ m_iSize = iNewSize;
+ return (true);
+ }
+
+private:
+ T *m_rgData; // Data to store items in.
+ int m_iBuckets; // How many buckets we want.
+ int m_iSize; // How many are allocated.
+ int m_iCount; // How many are we using.
+ ULONG m_iMaxChain; // Max chain length.
+ ULONG m_iFree; // Free chain.
+};
+
+
+//*****************************************************************************
+//
+//********** String helper functions.
+//
+//*****************************************************************************
+
+//*****************************************************************************
+// Checks if string length exceeds the specified limit
+//*****************************************************************************
+inline BOOL IsStrLongerThan(__in __in_z char* pstr, unsigned N)
+{
+ LIMITED_METHOD_CONTRACT;
+ unsigned i = 0;
+ if(pstr)
+ {
+ for(i=0; (i < N)&&(pstr[i]); i++);
+ }
+ return (i >= N);
+}
+
+
+//*****************************************************************************
+// Class to parse a list of simple assembly names and then find a match
+//*****************************************************************************
+
+class AssemblyNamesList
+{
+ struct AssemblyName
+ {
+ LPUTF8 m_assemblyName;
+ AssemblyName *m_next; // Next name
+ };
+
+ AssemblyName *m_pNames; // List of names
+
+public:
+
+ bool IsInList(LPCUTF8 assemblyName);
+
+ bool IsEmpty()
+ {
+ LIMITED_METHOD_CONTRACT;
+ return m_pNames == 0;
+ }
+
+ AssemblyNamesList(__in LPWSTR list);
+ ~AssemblyNamesList();
+};
+
+//*****************************************************************************
+// Class to parse a list of method names and then find a match
+//*****************************************************************************
+
+struct CORINFO_SIG_INFO;
+
+class MethodNamesListBase
+{
+ struct MethodName
+ {
+ LPUTF8 methodName; // NULL means wildcard
+ LPUTF8 className; // NULL means wildcard
+ int numArgs; // number of args for the method, -1 is wildcard
+ MethodName *next; // Next name
+ };
+
+ MethodName *pNames; // List of names
+
+ bool IsInList(LPCUTF8 methodName, LPCUTF8 className, int numArgs);
+
+public:
+ void Init()
+ {
+ LIMITED_METHOD_CONTRACT;
+ pNames = 0;
+ }
+
+ void Init(__in __in_z LPWSTR list)
+ {
+ WRAPPER_NO_CONTRACT;
+ pNames = 0;
+ Insert(list);
+ }
+
+ void Destroy();
+
+ void Insert(__in __in_z LPWSTR list);
+
+ bool IsInList(LPCUTF8 methodName, LPCUTF8 className, PCCOR_SIGNATURE sig = NULL);
+ bool IsInList(LPCUTF8 methodName, LPCUTF8 className, CORINFO_SIG_INFO* pSigInfo);
+ bool IsEmpty()
+ {
+ LIMITED_METHOD_CONTRACT;
+ return pNames == 0;
+ }
+};
+
+class MethodNamesList : public MethodNamesListBase
+{
+public:
+ MethodNamesList()
+ {
+ WRAPPER_NO_CONTRACT;
+ Init();
+ }
+
+ MethodNamesList(__in LPWSTR list)
+ {
+ WRAPPER_NO_CONTRACT;
+ Init(list);
+ }
+
+ ~MethodNamesList()
+ {
+ WRAPPER_NO_CONTRACT;
+ Destroy();
+ }
+};
+
+#if !defined(NO_CLRCONFIG)
+
+/**************************************************************************/
+/* simple wrappers around the REGUTIL and MethodNameList routines that make
+ the lookup lazy */
+
+/* to be used as static variable - no constructor/destructor, assumes zero
+ initialized memory */
+
+class ConfigDWORD
+{
+public:
+ //
+ // NOTE: The following function is deprecated; use the CLRConfig class instead.
+ // To access a configuration value through CLRConfig, add an entry in file:../inc/CLRConfigValues.h.
+ //
+ inline DWORD val_DontUse_(__in __in_z LPCWSTR keyName, DWORD defaultVal=0)
+ {
+ WRAPPER_NO_CONTRACT;
+ // make sure that the memory was zero initialized
+ _ASSERTE(m_inited == 0 || m_inited == 1);
+
+ if (!m_inited) init_DontUse_(keyName, defaultVal);
+ return m_value;
+ }
+ inline DWORD val(const CLRConfig::ConfigDWORDInfo & info)
+ {
+ WRAPPER_NO_CONTRACT;
+ // make sure that the memory was zero initialized
+ _ASSERTE(m_inited == 0 || m_inited == 1);
+
+ if (!m_inited) init(info);
+ return m_value;
+ }
+
+private:
+ void init_DontUse_(__in __in_z LPCWSTR keyName, DWORD defaultVal=0);
+ void init(const CLRConfig::ConfigDWORDInfo & info);
+
+private:
+ DWORD m_value;
+ BYTE m_inited;
+};
+
+/**************************************************************************/
+class ConfigString
+{
+public:
+ inline LPWSTR val(const CLRConfig::ConfigStringInfo & info)
+ {
+ WRAPPER_NO_CONTRACT;
+ // make sure that the memory was zero initialized
+ _ASSERTE(m_inited == 0 || m_inited == 1);
+
+ if (!m_inited) init(info);
+ return m_value;
+ }
+
+ bool isInitialized()
+ {
+ WRAPPER_NO_CONTRACT;
+
+ // make sure that the memory was zero initialized
+ _ASSERTE(m_inited == 0 || m_inited == 1);
+
+ return m_inited == 1;
+ }
+
+private:
+ void init(const CLRConfig::ConfigStringInfo & info);
+
+private:
+ LPWSTR m_value;
+ BYTE m_inited;
+};
+
+/**************************************************************************/
+class ConfigMethodSet
+{
+public:
+ bool isEmpty()
+ {
+ WRAPPER_NO_CONTRACT;
+ _ASSERTE(m_inited == 1);
+ return m_list.IsEmpty();
+ }
+
+ bool contains(LPCUTF8 methodName, LPCUTF8 className, PCCOR_SIGNATURE sig = NULL);
+ bool contains(LPCUTF8 methodName, LPCUTF8 className, CORINFO_SIG_INFO* pSigInfo);
+
+ inline void ensureInit(const CLRConfig::ConfigStringInfo & info)
+ {
+ WRAPPER_NO_CONTRACT;
+ // make sure that the memory was zero initialized
+ _ASSERTE(m_inited == 0 || m_inited == 1);
+
+ if (!m_inited) init(info);
+ }
+
+private:
+ void init(const CLRConfig::ConfigStringInfo & info);
+
+private:
+ MethodNamesListBase m_list;
+
+ BYTE m_inited;
+};
+
+#endif // !defined(NO_CLRCONFIG)
+
+//*****************************************************************************
+// Convert a pointer to a string into a GUID.
+//*****************************************************************************
+HRESULT LPCSTRToGuid( // Return status.
+ LPCSTR szGuid, // String to convert.
+ GUID *psGuid); // Buffer for converted GUID.
+
+//*****************************************************************************
+// Convert a GUID into a pointer to a string
+//*****************************************************************************
+int GuidToLPWSTR( // Return status.
+ GUID Guid, // [IN] The GUID to convert.
+ __out_ecount (cchGuid) LPWSTR szGuid, // [OUT] String into which the GUID is stored
+ DWORD cchGuid); // [IN] Size in wide chars of szGuid
+
+//*****************************************************************************
+// Parse a Wide char string into a GUID
+//*****************************************************************************
+BOOL LPWSTRToGuid(
+ GUID * Guid, // [OUT] The GUID to fill in
+ __in_ecount(cchGuid) LPCWSTR szGuid, // [IN] String to parse
+ DWORD cchGuid); // [IN] Count in wchars in string
+
+typedef VPTR(class RangeList) PTR_RangeList;
+
+class RangeList
+{
+ public:
+ VPTR_BASE_CONCRETE_VTABLE_CLASS(RangeList)
+
+#ifndef DACCESS_COMPILE
+ RangeList();
+ ~RangeList();
+#else
+ RangeList()
+ {
+ LIMITED_METHOD_CONTRACT;
+ }
+#endif
+
+ // Wrappers to make the virtual calls DAC-safe.
+ BOOL AddRange(const BYTE *start, const BYTE *end, void *id)
+ {
+ return this->AddRangeWorker(start, end, id);
+ }
+
+ void RemoveRanges(void *id, const BYTE *start = NULL, const BYTE *end = NULL)
+ {
+ return this->RemoveRangesWorker(id, start, end);
+ }
+
+ BOOL IsInRange(TADDR address, TADDR *pID = NULL)
+ {
+ SUPPORTS_DAC;
+
+ return this->IsInRangeWorker(address, pID);
+ }
+
+#ifndef DACCESS_COMPILE
+
+ // You can overload these two for synchronization (as LockedRangeList does)
+ virtual BOOL AddRangeWorker(const BYTE *start, const BYTE *end, void *id);
+ // If both "start" and "end" are NULL, then this method deletes all ranges with
+ // the given id (i.e. the original behaviour). Otherwise, it ignores the given
+ // id and deletes all ranges falling in the region [start, end).
+ virtual void RemoveRangesWorker(void *id, const BYTE *start = NULL, const BYTE *end = NULL);
+#else
+ virtual BOOL AddRangeWorker(const BYTE *start, const BYTE *end, void *id)
+ {
+ return TRUE;
+ }
+ virtual void RemoveRangesWorker(void *id, const BYTE *start = NULL, const BYTE *end = NULL) { }
+#endif // !DACCESS_COMPILE
+
+ virtual BOOL IsInRangeWorker(TADDR address, TADDR *pID = NULL);
+
+#ifdef DACCESS_COMPILE
+ void EnumMemoryRegions(enum CLRDataEnumMemoryFlags flags);
+#endif
+
+ enum
+ {
+ RANGE_COUNT = 10
+ };
+
+
+ private:
+ struct Range
+ {
+ TADDR start;
+ TADDR end;
+ TADDR id;
+ };
+
+ struct RangeListBlock
+ {
+ Range ranges[RANGE_COUNT];
+ DPTR(RangeListBlock) next;
+
+#ifdef DACCESS_COMPILE
+ void EnumMemoryRegions(enum CLRDataEnumMemoryFlags flags);
+#endif
+
+ };
+
+ void InitBlock(RangeListBlock *block);
+
+ RangeListBlock m_starterBlock;
+ DPTR(RangeListBlock) m_firstEmptyBlock;
+ TADDR m_firstEmptyRange;
+};
+
+
+//
+// A private function to do the equavilent of a CoCreateInstance in
+// cases where we can't make the real call. Use this when, for
+// instance, you need to create a symbol reader in the Runtime but
+// we're not CoInitialized. Obviously, this is only good for COM
+// objects for which CoCreateInstance is just a glorified
+// find-and-load-me operation.
+//
+
+HRESULT FakeCoCreateInstanceEx(REFCLSID rclsid,
+ LPCWSTR wszDllPath,
+ REFIID riid,
+ void ** ppv,
+ HMODULE * phmodDll);
+
+// Provided for backward compatibility and for code that doesn't need the HMODULE of the
+// DLL that was loaded to create the COM object. See comment at implementation of
+// code:FakeCoCreateInstanceEx for more details.
+inline HRESULT FakeCoCreateInstance(REFCLSID rclsid,
+ REFIID riid,
+ void ** ppv)
+{
+ CONTRACTL
+ {
+ NOTHROW;
+ }
+ CONTRACTL_END;
+
+ return FakeCoCreateInstanceEx(rclsid, NULL, riid, ppv, NULL);
+};
+
+HRESULT FakeCoCallDllGetClassObject(REFCLSID rclsid,
+ LPCWSTR wszDllPath,
+ REFIID riid,
+ void ** ppv,
+ HMODULE * phmodDll);
+
+//*****************************************************************************
+// Gets the directory based on the location of the module. This routine
+// is called at COR setup time. Set is called during EEStartup and by the
+// MetaData dispenser.
+//*****************************************************************************
+HRESULT GetInternalSystemDirectory(__out_ecount_part_opt(*pdwLength,*pdwLength) LPWSTR buffer, __inout DWORD* pdwLength);
+LPCWSTR GetInternalSystemDirectory(__out_opt DWORD * pdwLength = NULL);
+
+//*****************************************************************************
+// This function validates the given Method/Field/Standalone signature. (util.cpp)
+//*****************************************************************************
+struct IMDInternalImport;
+HRESULT validateTokenSig(
+ mdToken tk, // [IN] Token whose signature needs to be validated.
+ PCCOR_SIGNATURE pbSig, // [IN] Signature.
+ ULONG cbSig, // [IN] Size in bytes of the signature.
+ DWORD dwFlags, // [IN] Method flags.
+ IMDInternalImport* pImport); // [IN] Internal MD Import interface ptr
+
+//*****************************************************************************
+// Determine the version number of the runtime that was used to build the
+// specified image. The pMetadata pointer passed in is the pointer to the
+// metadata contained in the image.
+//*****************************************************************************
+HRESULT GetImageRuntimeVersionString(PVOID pMetaData, LPCSTR* pString);
+void AdjustImageRuntimeVersion (SString* pVersion);
+
+//*****************************************************************************
+// The registry keys and values that contain the information regarding
+// the default registered unmanaged debugger.
+//*****************************************************************************
+SELECTANY const WCHAR kDebugApplicationsPoliciesKey[] = W("SOFTWARE\\Policies\\Microsoft\\Windows\\Windows Error Reporting\\DebugApplications");
+SELECTANY const WCHAR kDebugApplicationsKey[] = W("SOFTWARE\\Microsoft\\Windows\\Windows Error Reporting\\DebugApplications");
+
+SELECTANY const WCHAR kUnmanagedDebuggerKey[] = W("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug");
+SELECTANY const WCHAR kUnmanagedDebuggerValue[] = W("Debugger");
+SELECTANY const WCHAR kUnmanagedDebuggerAutoValue[] = W("Auto");
+SELECTANY const WCHAR kUnmanagedDebuggerAutoExclusionListKey[] = W("SOFTWARE\\Microsoft\\Windows NT\\CurrentVersion\\AeDebug\\AutoExclusionList");
+
+BOOL GetRegistryLongValue(HKEY hKeyParent, // Parent key.
+ LPCWSTR szKey, // Key name to look at.
+ LPCWSTR szName, // Name of value to get.
+ long *pValue, // Put value here, if found.
+ BOOL fReadNonVirtualizedKey); // Whether to read 64-bit hive on WOW64
+
+HRESULT GetCurrentModuleFileName(SString& pBuffer);
+
+//*****************************************************************************
+// Retrieve information regarding what registered default debugger
+//*****************************************************************************
+void GetDebuggerSettingInfo(SString &debuggerKeyValue, BOOL *pfAuto);
+HRESULT GetDebuggerSettingInfoWorker(__out_ecount_part_opt(*pcchDebuggerString, *pcchDebuggerString) LPWSTR wszDebuggerString, DWORD * pcchDebuggerString, BOOL * pfAuto);
+
+void TrimWhiteSpace(__inout_ecount(*pcch) LPCWSTR *pwsz, __inout LPDWORD pcch);
+
+
+//*****************************************************************************
+// Convert a UTF8 string to Unicode, into a CQuickArray<WCHAR>.
+//*****************************************************************************
+HRESULT Utf2Quick(
+ LPCUTF8 pStr, // The string to convert.
+ CQuickArray<WCHAR> &rStr, // The QuickArray<WCHAR> to convert it into.
+ int iCurLen); // Inital characters in the array to leave (default 0).
+
+//*****************************************************************************
+// Extract the movl 64-bit unsigned immediate from an IA64 bundle
+// (Format X2)
+//*****************************************************************************
+UINT64 GetIA64Imm64(UINT64 * pBundle);
+UINT64 GetIA64Imm64(UINT64 qword0, UINT64 qword1);
+
+//*****************************************************************************
+// Deposit the movl 64-bit unsigned immediate into an IA64 bundle
+// (Format X2)
+//*****************************************************************************
+void PutIA64Imm64(UINT64 * pBundle, UINT64 imm64);
+
+//*****************************************************************************
+// Extract the IP-Relative signed 25-bit immediate from an IA64 bundle
+// (Formats B1, B2 or B3)
+// Note that due to branch target alignment requirements
+// the lowest four bits in the result will always be zero.
+//*****************************************************************************
+INT32 GetIA64Rel25(UINT64 * pBundle, UINT32 slot);
+INT32 GetIA64Rel25(UINT64 qword0, UINT64 qword1, UINT32 slot);
+
+//*****************************************************************************
+// Deposit the IP-Relative signed 25-bit immediate into an IA64 bundle
+// (Formats B1, B2 or B3)
+// Note that due to branch target alignment requirements
+// the lowest four bits are required to be zero.
+//*****************************************************************************
+void PutIA64Rel25(UINT64 * pBundle, UINT32 slot, INT32 imm25);
+
+//*****************************************************************************
+// Extract the IP-Relative signed 64-bit immediate from an IA64 bundle
+// (Formats X3 or X4)
+//*****************************************************************************
+INT64 GetIA64Rel64(UINT64 * pBundle);
+INT64 GetIA64Rel64(UINT64 qword0, UINT64 qword1);
+
+//*****************************************************************************
+// Deposit the IP-Relative signed 64-bit immediate into a IA64 bundle
+// (Formats X3 or X4)
+//*****************************************************************************
+void PutIA64Rel64(UINT64 * pBundle, INT64 imm64);
+
+//*****************************************************************************
+// Extract the 32-bit immediate from movw/movt Thumb2 sequence
+//*****************************************************************************
+UINT32 GetThumb2Mov32(UINT16 * p);
+
+//*****************************************************************************
+// Deposit the 32-bit immediate into movw/movt Thumb2 sequence
+//*****************************************************************************
+void PutThumb2Mov32(UINT16 * p, UINT32 imm32);
+
+//*****************************************************************************
+// Extract the 24-bit rel offset from bl instruction
+//*****************************************************************************
+INT32 GetThumb2BlRel24(UINT16 * p);
+
+//*****************************************************************************
+// Extract the 24-bit rel offset from bl instruction
+//*****************************************************************************
+void PutThumb2BlRel24(UINT16 * p, INT32 imm24);
+
+//*****************************************************************************
+// Extract the PC-Relative offset from a b or bl instruction
+//*****************************************************************************
+INT32 GetArm64Rel28(UINT32 * pCode);
+
+//*****************************************************************************
+// Extract the PC-Relative page address from an adrp instruction
+//*****************************************************************************
+INT32 GetArm64Rel21(UINT32 * pCode);
+
+//*****************************************************************************
+// Extract the page offset from an add instruction
+//*****************************************************************************
+INT32 GetArm64Rel12(UINT32 * pCode);
+
+//*****************************************************************************
+// Deposit the PC-Relative offset 'imm28' into a b or bl instruction
+//*****************************************************************************
+void PutArm64Rel28(UINT32 * pCode, INT32 imm28);
+
+//*****************************************************************************
+// Deposit the PC-Relative page address 'imm21' into an adrp instruction
+//*****************************************************************************
+void PutArm64Rel21(UINT32 * pCode, INT32 imm21);
+
+//*****************************************************************************
+// Deposit the page offset 'imm12' into an add instruction
+//*****************************************************************************
+void PutArm64Rel12(UINT32 * pCode, INT32 imm12);
+
+//*****************************************************************************
+// Returns whether the offset fits into bl instruction
+//*****************************************************************************
+inline bool FitsInThumb2BlRel24(INT32 imm24)
+{
+ return ((imm24 << 7) >> 7) == imm24;
+}
+
+//*****************************************************************************
+// Returns whether the offset fits into an Arm64 b or bl instruction
+//*****************************************************************************
+inline bool FitsInRel28(INT32 val32)
+{
+ return (val32 >= -0x08000000) && (val32 < 0x08000000);
+}
+
+//*****************************************************************************
+// Returns whether the offset fits into an Arm64 adrp instruction
+//*****************************************************************************
+inline bool FitsInRel21(INT32 val32)
+{
+ return (val32 >= 0) && (val32 <= 0x001FFFFF);
+}
+
+//*****************************************************************************
+// Returns whether the offset fits into an Arm64 add instruction
+//*****************************************************************************
+inline bool FitsInRel12(INT32 val32)
+{
+ return (val32 >= 0) && (val32 <= 0x00000FFF);
+}
+
+//*****************************************************************************
+// Returns whether the offset fits into an Arm64 b or bl instruction
+//*****************************************************************************
+inline bool FitsInRel28(INT64 val64)
+{
+ return (val64 >= -0x08000000LL) && (val64 < 0x08000000LL);
+}
+
+//*****************************************************************************
+// Splits a command line into argc/argv lists, using the VC7 parsing rules.
+// This functions interface mimics the CommandLineToArgvW api.
+// If function fails, returns NULL.
+// If function suceeds, call delete [] on return pointer when done.
+//*****************************************************************************
+LPWSTR *SegmentCommandLine(LPCWSTR lpCmdLine, DWORD *pNumArgs);
+
+//
+// TEB access can be dangerous when using fibers because a fiber may
+// run on multiple threads. If the TEB pointer is retrieved and saved
+// and then a fiber is moved to a different thread, when it accesses
+// the saved TEB pointer, it will be looking at the TEB state for a
+// different fiber.
+//
+// These accessors serve the purpose of retrieving information from the
+// TEB in a manner that ensures that the current fiber will not switch
+// threads while the access is occuring.
+//
+class ClrTeb
+{
+public:
+#if defined(FEATURE_PAL)
+
+ // returns pointer that uniquely identifies the fiber
+ static void* GetFiberPtrId()
+ {
+ LIMITED_METHOD_CONTRACT;
+ // not fiber for FEATURE_PAL - use the regular thread ID
+ return (void *)(size_t)GetCurrentThreadId();
+ }
+
+ static void* InvalidFiberPtrId()
+ {
+ return NULL;
+ }
+
+ static void* GetStackBase()
+ {
+ return PAL_GetStackBase();
+ }
+
+ static void* GetStackLimit()
+ {
+ return PAL_GetStackLimit();
+ }
+
+#else // !FEATURE_PAL
+
+ // returns pointer that uniquely identifies the fiber
+ static void* GetFiberPtrId()
+ {
+ LIMITED_METHOD_CONTRACT;
+ // stackbase is the unique fiber identifier
+ return NtCurrentTeb()->NtTib.StackBase;
+ }
+
+ static void* GetStackBase()
+ {
+ LIMITED_METHOD_CONTRACT;
+ return NtCurrentTeb()->NtTib.StackBase;
+ }
+
+ static void* GetStackLimit()
+ {
+ LIMITED_METHOD_CONTRACT;
+ return NtCurrentTeb()->NtTib.StackLimit;
+ }
+
+ // Please don't start to use this method unless you absolutely have to.
+ // The reason why this is added is for WIN64 to support LEGACY PE-style TLS
+ // variables. On X86 it is supported by the JIT compilers themselves. On
+ // WIN64 we build more logic into the JIT helper for accessing fields.
+ static void* GetLegacyThreadLocalStoragePointer()
+ {
+ LIMITED_METHOD_CONTRACT;
+ return NtCurrentTeb()->ThreadLocalStoragePointer;
+ }
+
+ static void* GetOleReservedPtr()
+ {
+ LIMITED_METHOD_CONTRACT;
+ return NtCurrentTeb()->ReservedForOle;
+ }
+
+ static void* GetProcessEnvironmentBlock()
+ {
+ LIMITED_METHOD_CONTRACT;
+ return NtCurrentTeb()->ProcessEnvironmentBlock;
+ }
+
+#ifndef FEATURE_CORECLR
+ static void* GetFiberDataPtr()
+ {
+ LIMITED_METHOD_CONTRACT;
+ return ClrTeb::IsCurrentThreadAFiber()? GetCurrentFiber() : NULL;
+ }
+
+ static BOOL IsCurrentThreadAFiber()
+ {
+ return IsThreadAFiber();
+ }
+#endif
+
+ static void* InvalidFiberPtrId()
+ {
+ return (void*) 1;
+ }
+#endif // !FEATURE_PAL
+};
+
+#if !defined(DACCESS_COMPILE)
+
+// check if current thread is a GC thread (concurrent or server)
+inline BOOL IsGCSpecialThread ()
+{
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_GC_NOTRIGGER;
+ STATIC_CONTRACT_MODE_ANY;
+ STATIC_CONTRACT_CANNOT_TAKE_LOCK;
+
+ return !!(((size_t)ClrFlsGetValue (TlsIdx_ThreadType)) & ThreadType_GC);
+}
+
+// check if current thread is a Gate thread
+inline BOOL IsGateSpecialThread ()
+{
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_GC_NOTRIGGER;
+ STATIC_CONTRACT_MODE_ANY;
+
+ return !!(((size_t)ClrFlsGetValue (TlsIdx_ThreadType)) & ThreadType_Gate);
+}
+
+// check if current thread is a Timer thread
+inline BOOL IsTimerSpecialThread ()
+{
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_GC_NOTRIGGER;
+ STATIC_CONTRACT_MODE_ANY;
+
+ return !!(((size_t)ClrFlsGetValue (TlsIdx_ThreadType)) & ThreadType_Timer);
+}
+
+// check if current thread is a debugger helper thread
+inline BOOL IsDbgHelperSpecialThread ()
+{
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_GC_NOTRIGGER;
+ STATIC_CONTRACT_MODE_ANY;
+
+ return !!(((size_t)ClrFlsGetValue (TlsIdx_ThreadType)) & ThreadType_DbgHelper);
+}
+
+// check if current thread is a debugger helper thread
+inline BOOL IsETWRundownSpecialThread ()
+{
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_GC_NOTRIGGER;
+ STATIC_CONTRACT_MODE_ANY;
+
+ return !!(((size_t)ClrFlsGetValue (TlsIdx_ThreadType)) & ThreadType_ETWRundownThread);
+}
+
+// check if current thread is a generic instantiation lookup compare thread
+inline BOOL IsGenericInstantiationLookupCompareThread ()
+{
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_GC_NOTRIGGER;
+ STATIC_CONTRACT_MODE_ANY;
+
+ return !!(((size_t)ClrFlsGetValue (TlsIdx_ThreadType)) & ThreadType_GenericInstantiationCompare);
+}
+
+// check if current thread is a thread which is performing shutdown
+inline BOOL IsShutdownSpecialThread ()
+{
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_GC_NOTRIGGER;
+ STATIC_CONTRACT_MODE_ANY;
+
+ return !!(((size_t)ClrFlsGetValue (TlsIdx_ThreadType)) & ThreadType_Shutdown);
+}
+
+inline BOOL IsThreadPoolIOCompletionSpecialThread ()
+{
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_GC_NOTRIGGER;
+ STATIC_CONTRACT_MODE_ANY;
+
+ return !!(((size_t)ClrFlsGetValue (TlsIdx_ThreadType)) & ThreadType_Threadpool_IOCompletion);
+}
+
+inline BOOL IsThreadPoolWorkerSpecialThread ()
+{
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_GC_NOTRIGGER;
+ STATIC_CONTRACT_MODE_ANY;
+
+ return !!(((size_t)ClrFlsGetValue (TlsIdx_ThreadType)) & ThreadType_Threadpool_Worker);
+}
+
+inline BOOL IsWaitSpecialThread ()
+{
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_GC_NOTRIGGER;
+ STATIC_CONTRACT_MODE_ANY;
+
+ return !!(((size_t)ClrFlsGetValue (TlsIdx_ThreadType)) & ThreadType_Wait);
+}
+
+// check if current thread is a thread which is performing shutdown
+inline BOOL IsSuspendEEThread ()
+{
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_GC_NOTRIGGER;
+ STATIC_CONTRACT_MODE_ANY;
+
+ return !!(((size_t)ClrFlsGetValue (TlsIdx_ThreadType)) & ThreadType_DynamicSuspendEE);
+}
+
+inline BOOL IsFinalizerThread ()
+{
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_GC_NOTRIGGER;
+ STATIC_CONTRACT_MODE_ANY;
+
+ return !!(((size_t)ClrFlsGetValue (TlsIdx_ThreadType)) & ThreadType_Finalizer);
+}
+
+inline BOOL IsADUnloadHelperThread ()
+{
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_GC_NOTRIGGER;
+ STATIC_CONTRACT_MODE_ANY;
+
+ return !!(((size_t)ClrFlsGetValue (TlsIdx_ThreadType)) & ThreadType_ADUnloadHelper);
+}
+
+inline BOOL IsShutdownHelperThread ()
+{
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_GC_NOTRIGGER;
+ STATIC_CONTRACT_MODE_ANY;
+
+ return !!(((size_t)ClrFlsGetValue (TlsIdx_ThreadType)) & ThreadType_ShutdownHelper);
+}
+
+inline BOOL IsProfilerAttachThread ()
+{
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_GC_NOTRIGGER;
+ STATIC_CONTRACT_MODE_ANY;
+
+ return !!(((size_t)ClrFlsGetValue (TlsIdx_ThreadType)) & ThreadType_ProfAPI_Attach);
+}
+
+// set specical type for current thread
+inline void ClrFlsSetThreadType (TlsThreadTypeFlag flag)
+{
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_GC_NOTRIGGER;
+ STATIC_CONTRACT_MODE_ANY;
+ STATIC_CONTRACT_SO_TOLERANT;
+
+ ClrFlsSetValue (TlsIdx_ThreadType, (LPVOID)(((size_t)ClrFlsGetValue (TlsIdx_ThreadType)) |flag));
+}
+
+// clear specical type for current thread
+inline void ClrFlsClearThreadType (TlsThreadTypeFlag flag)
+{
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_GC_NOTRIGGER;
+ STATIC_CONTRACT_MODE_ANY;
+
+ ClrFlsSetValue (TlsIdx_ThreadType, (LPVOID)(((size_t)ClrFlsGetValue (TlsIdx_ThreadType)) & ~flag));
+}
+
+#endif //!DACCESS_COMPILE
+
+#ifdef DACCESS_COMPILE
+#define SET_THREAD_TYPE_STACKWALKER(pThread)
+#define CLEAR_THREAD_TYPE_STACKWALKER()
+#else // DACCESS_COMPILE
+#define SET_THREAD_TYPE_STACKWALKER(pThread) ClrFlsSetValue(TlsIdx_StackWalkerWalkingThread, pThread)
+#define CLEAR_THREAD_TYPE_STACKWALKER() ClrFlsSetValue(TlsIdx_StackWalkerWalkingThread, NULL)
+#endif // DACCESS_COMPILE
+
+inline BOOL IsStackWalkerThread()
+{
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_GC_NOTRIGGER;
+ STATIC_CONTRACT_MODE_ANY;
+ STATIC_CONTRACT_CANNOT_TAKE_LOCK;
+
+#if defined(DACCESS_COMPILE)
+ return FALSE;
+#else
+ return ClrFlsGetValue (TlsIdx_StackWalkerWalkingThread) != NULL;
+#endif
+}
+
+inline BOOL IsGCThread ()
+{
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_GC_NOTRIGGER;
+ STATIC_CONTRACT_MODE_ANY;
+ STATIC_CONTRACT_SUPPORTS_DAC;
+ STATIC_CONTRACT_SO_TOLERANT;
+
+#if !defined(DACCESS_COMPILE)
+ return IsGCSpecialThread () || IsSuspendEEThread ();
+#else
+ return FALSE;
+#endif
+}
+
+class ClrFlsThreadTypeSwitch
+{
+public:
+ ClrFlsThreadTypeSwitch (TlsThreadTypeFlag flag)
+ {
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_GC_NOTRIGGER;
+ STATIC_CONTRACT_MODE_ANY;
+
+#ifndef DACCESS_COMPILE
+ m_flag = flag;
+ m_fPreviouslySet = (((size_t)ClrFlsGetValue (TlsIdx_ThreadType)) & flag);
+
+ // In debug builds, remember the full group of flags that were set at the time
+ // the constructor was called. This will be used in ASSERTs in the destructor
+ INDEBUG(m_nPreviousFlagGroup = (size_t)ClrFlsGetValue (TlsIdx_ThreadType));
+
+ if (!m_fPreviouslySet)
+ {
+ ClrFlsSetThreadType(flag);
+ }
+#endif // DACCESS_COMPILE
+ }
+
+ ~ClrFlsThreadTypeSwitch ()
+ {
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_GC_NOTRIGGER;
+ STATIC_CONTRACT_MODE_ANY;
+
+#ifndef DACCESS_COMPILE
+ // This holder should only be used to set (and thus restore) ONE thread type flag
+ // at a time. If more than that one flag was modified since this holder was
+ // instantiated, then this holder still restores only the flag it knows about. To
+ // prevent confusion, assert if some other flag was modified, so the user doesn't
+ // expect the holder to restore the entire original set of flags.
+ //
+ // The expression below says that the only difference between the previous flag
+ // group and the current flag group should be m_flag (or no difference at all, if
+ // m_flag's state didn't actually change).
+ _ASSERTE(((m_nPreviousFlagGroup ^ (size_t) ClrFlsGetValue(TlsIdx_ThreadType)) | (size_t) m_flag) == (size_t) m_flag);
+
+ if (m_fPreviouslySet)
+ {
+ ClrFlsSetThreadType(m_flag);
+ }
+ else
+ {
+ ClrFlsClearThreadType(m_flag);
+ }
+#endif // DACCESS_COMPILE
+ }
+
+private:
+ TlsThreadTypeFlag m_flag;
+ BOOL m_fPreviouslySet;
+ INDEBUG(size_t m_nPreviousFlagGroup);
+};
+
+class ClrFlsValueSwitch
+{
+public:
+ ClrFlsValueSwitch (PredefinedTlsSlots slot, PVOID value)
+ {
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_GC_NOTRIGGER;
+ STATIC_CONTRACT_MODE_ANY;
+
+#ifndef DACCESS_COMPILE
+ m_slot = slot;
+ m_PreviousValue = ClrFlsGetValue(slot);
+ ClrFlsSetValue(slot, value);
+#endif // DACCESS_COMPILE
+ }
+
+ ~ClrFlsValueSwitch ()
+ {
+ STATIC_CONTRACT_NOTHROW;
+ STATIC_CONTRACT_GC_NOTRIGGER;
+ STATIC_CONTRACT_MODE_ANY;
+
+#ifndef DACCESS_COMPILE
+ ClrFlsSetValue(m_slot, m_PreviousValue);
+#endif // DACCESS_COMPILE
+ }
+
+private:
+ PVOID m_PreviousValue;
+ PredefinedTlsSlots m_slot;
+};
+
+//*********************************************************************************
+
+// When we're hosted, operations called by the host (such as Thread::YieldTask)
+// may not cause calls back into the host, as the host needs not be reentrant.
+// Use the following holder for code in which calls into the host are forbidden.
+// (If a call into the host is attempted nevertheless, an assert will fire.)
+
+class ForbidCallsIntoHostOnThisThread
+{
+private:
+ static Volatile<PVOID> s_pvOwningFiber;
+
+ FORCEINLINE static BOOL Enter(BOOL)
+ {
+ WRAPPER_NO_CONTRACT;
+ return InterlockedCompareExchangePointer(
+ &s_pvOwningFiber, ClrTeb::GetFiberPtrId(), NULL) == NULL;
+ }
+
+ FORCEINLINE static void Leave(BOOL)
+ {
+ LIMITED_METHOD_CONTRACT;
+ s_pvOwningFiber = NULL;
+ }
+
+public:
+ typedef ConditionalStateHolder<BOOL, ForbidCallsIntoHostOnThisThread::Enter, ForbidCallsIntoHostOnThisThread::Leave> Holder;
+
+ FORCEINLINE static BOOL CanThisThreadCallIntoHost()
+ {
+ WRAPPER_NO_CONTRACT;
+ return s_pvOwningFiber != ClrTeb::GetFiberPtrId();
+ }
+};
+
+typedef ForbidCallsIntoHostOnThisThread::Holder ForbidCallsIntoHostOnThisThreadHolder;
+
+FORCEINLINE BOOL CanThisThreadCallIntoHost()
+{
+ WRAPPER_NO_CONTRACT;
+ return ForbidCallsIntoHostOnThisThread::CanThisThreadCallIntoHost();
+}
+
+//*********************************************************************************
+
+#include "contract.inl"
+
+namespace util
+{
+ // compare adapters
+ //
+
+ template < typename T >
+ struct less
+ {
+ bool operator()( T const & first, T const & second ) const
+ {
+ return first < second;
+ }
+ };
+
+ template < typename T >
+ struct greater
+ {
+ bool operator()( T const & first, T const & second ) const
+ {
+ return first > second;
+ }
+ };
+
+
+ // sort adapters
+ //
+
+ template< typename Iter, typename Pred >
+ void sort( Iter begin, Iter end, Pred pred );
+
+ template< typename T, typename Pred >
+ void sort( T * begin, T * end, Pred pred )
+ {
+ struct sort_helper : CQuickSort< T >
+ {
+ sort_helper( T * begin, T * end, Pred pred )
+ : CQuickSort< T >( begin, end - begin )
+ , m_pred( pred )
+ {}
+
+ virtual int Compare( T * first, T * second )
+ {
+ return m_pred( *first, *second ) ? -1
+ : ( m_pred( *second, *first ) ? 1 : 0 );
+ }
+
+ Pred m_pred;
+ };
+
+ sort_helper sort_obj( begin, end, pred );
+ sort_obj.Sort();
+ }
+
+
+ template < typename Iter >
+ void sort( Iter begin, Iter end );
+
+ template < typename T >
+ void sort( T * begin, T * end )
+ {
+ util::sort( begin, end, util::less< T >() );
+ }
+
+
+ // binary search adapters
+ //
+
+ template < typename Iter, typename T, typename Pred >
+ Iter lower_bound( Iter begin, Iter end, T const & val, Pred pred );
+
+ template < typename T, typename Pred >
+ T * lower_bound( T * begin, T * end, T const & val, Pred pred )
+ {
+ for (; begin != end; )
+ {
+ T * mid = begin + ( end - begin ) / 2;
+ if ( pred( *mid, val ) )
+ begin = ++mid;
+ else
+ end = mid;
+ }
+
+ return begin;
+ }
+
+
+ template < typename Iter, typename T >
+ Iter lower_bound( Iter begin, Iter end, T const & val );
+
+ template < typename T >
+ T * lower_bound( T * begin, T * end, T const & val )
+ {
+ return util::lower_bound( begin, end, val, util::less< T >() );
+ }
+}
+
+
+/* ------------------------------------------------------------------------ *
+ * Overloaded operators for the executable heap
+ * ------------------------------------------------------------------------ */
+
+#ifndef FEATURE_PAL
+
+struct CExecutable { int x; };
+extern const CExecutable executable;
+
+void * __cdecl operator new(size_t n, const CExecutable&);
+void * __cdecl operator new[](size_t n, const CExecutable&);
+void * __cdecl operator new(size_t n, const CExecutable&, const NoThrow&);
+void * __cdecl operator new[](size_t n, const CExecutable&, const NoThrow&);
+
+
+//
+// Executable heap delete to match the executable heap new above.
+//
+template<class T> void DeleteExecutable(T *p)
+{
+ if (p != NULL)
+ {
+ p->T::~T();
+
+ ClrHeapFree(ClrGetProcessExecutableHeap(), 0, p);
+ }
+}
+
+#endif // FEATURE_PAL
+
+INDEBUG(BOOL DbgIsExecutable(LPVOID lpMem, SIZE_T length);)
+
+class HighCharHelper {
+public:
+ static inline BOOL IsHighChar(int c) {
+ return (BOOL)HighCharTable[c];
+ }
+
+private:
+ static const BYTE HighCharTable[];
+};
+
+
+BOOL ThreadWillCreateGuardPage(SIZE_T sizeReservedStack, SIZE_T sizeCommitedStack);
+
+FORCEINLINE void HolderSysFreeString(BSTR str) { CONTRACT_VIOLATION(ThrowsViolation); SysFreeString(str); }
+
+typedef Wrapper<BSTR, DoNothing, HolderSysFreeString> BSTRHolder;
+
+BOOL FileExists(LPCWSTR filename);
+
+#ifndef FEATURE_CORECLR
+class FileLockHolder
+{
+public:
+ FileLockHolder();
+ ~FileLockHolder();
+
+ virtual void Acquire(LPCWSTR lockName, HANDLE hInterrupt = 0, BOOL* pInterrupted = NULL);
+ HRESULT AcquireNoThrow(LPCWSTR lockName, HANDLE hInterrupt = 0, BOOL* pInterrupted = NULL);
+
+ static BOOL IsTaken(LPCWSTR lockName);
+ void Release();
+private:
+ HANDLE _hLock;
+};
+#endif // FEATURE_CORECLR
+
+// a class for general x.x version info
+class MajorMinorVersionInfo
+{
+protected:
+ WORD version[2];
+ BOOL bInitialized;
+public:
+ //cctors
+ MajorMinorVersionInfo()
+ {
+ LIMITED_METHOD_CONTRACT;
+ bInitialized = FALSE;
+ ZeroMemory(version,sizeof(version));
+ };
+
+ MajorMinorVersionInfo(WORD wMajor, WORD wMinor)
+ {
+ WRAPPER_NO_CONTRACT;
+ Init(wMajor,wMinor);
+ };
+
+ // getters
+ BOOL IsInitialized() const
+ {
+ LIMITED_METHOD_CONTRACT;
+ return bInitialized;
+ };
+
+ WORD Major() const
+ {
+ LIMITED_METHOD_CONTRACT;
+ return version[0];
+ };
+
+ WORD Minor() const
+ {
+ LIMITED_METHOD_CONTRACT;
+ return version[1];
+ };
+
+ // setters
+ void Init(WORD wMajor, WORD wMinor)
+ {
+ LIMITED_METHOD_CONTRACT;
+ version[0]=wMajor;
+ version[1]=wMinor;
+ bInitialized=TRUE;
+ };
+};
+
+// CLR runtime version info in Major/Minor form
+class RUNTIMEVERSIONINFO : public MajorMinorVersionInfo
+{
+ static RUNTIMEVERSIONINFO notDefined;
+public:
+ // cctors
+ RUNTIMEVERSIONINFO() {};
+
+ RUNTIMEVERSIONINFO(WORD wMajor, WORD wMinor) :
+ MajorMinorVersionInfo(wMajor,wMinor){};
+
+ // CLR version specific helpers
+ BOOL IsPreWhidbey() const
+ {
+ WRAPPER_NO_CONTRACT;
+ return (Major() == 1) && (Minor() <= 1);
+ }
+
+ static const RUNTIMEVERSIONINFO& NotApplicable()
+ {
+ LIMITED_METHOD_CONTRACT;
+ return notDefined;
+ }
+};
+
+
+// HMODULE_TGT represents a handle to a module in the target process. In non-DAC builds this is identical
+// to HMODULE (HINSTANCE), which is the base address of the module. In DAC builds this must be a target address,
+// and so is represented by TADDR.
+
+#ifdef DACCESS_COMPILE
+typedef TADDR HMODULE_TGT;
+#else
+typedef HMODULE HMODULE_TGT;
+#endif
+
+BOOL IsIPInModule(HMODULE_TGT hModule, PCODE ip);
+
+//----------------------------------------------------------------------------------------
+// The runtime invokes InitUtilcode() in its dllmain and passes along all of the critical
+// callback pointers. For the desktop CLR, all DLLs loaded by the runtime must also call
+// InitUtilcode with the same callbacks as the runtime used. To achieve this, the runtime
+// calls a special initialization routine exposed by the loaded module with the callbacks,
+// which in turn calls InitUtilcode.
+//
+// This structure collects all of the critical callback info passed in InitUtilcode().
+// Note that one of them is GetCLRFunction() which is itself a gofer for many other
+// callbacks. If a callback fetch be safely deferred until we have TLS and stack probe
+// functionality running, it should be added to that function rather than this structure.
+// Things like IEE are here because that callback has to be set up before GetCLRFunction()
+// can be safely called.
+//----------------------------------------------------------------------------------------
+struct CoreClrCallbacks
+{
+ typedef IExecutionEngine* (__stdcall * pfnIEE_t)();
+ typedef HRESULT (__stdcall * pfnGetCORSystemDirectory_t)(SString& pbuffer);
+ typedef void* (__stdcall * pfnGetCLRFunction_t)(LPCSTR functionName);
+
+ HINSTANCE m_hmodCoreCLR;
+ pfnIEE_t m_pfnIEE;
+ pfnGetCORSystemDirectory_t m_pfnGetCORSystemDirectory;
+ pfnGetCLRFunction_t m_pfnGetCLRFunction;
+};
+
+#if defined(FEATURE_CORECLR) || !defined(SELF_NO_HOST) || defined(DACCESS_COMPILE)
+
+// For DAC, we include this functionality only when EH SxS is enabled.
+
+//----------------------------------------------------------------------------------------
+// CoreCLR must invoke this before CRT initialization to ensure utilcode has all the callback
+// pointers it needs.
+//----------------------------------------------------------------------------------------
+VOID InitUtilcode(const CoreClrCallbacks &cccallbacks);
+CoreClrCallbacks const & GetClrCallbacks();
+
+//----------------------------------------------------------------------------------------
+// Stuff below is for utilcode.lib eyes only.
+//----------------------------------------------------------------------------------------
+
+// Stores callback pointers provided by InitUtilcode().
+extern CoreClrCallbacks g_CoreClrCallbacks;
+
+// Throws up a helpful dialog if InitUtilcode() wasn't called.
+#ifdef _DEBUG
+void OnUninitializedCoreClrCallbacks();
+#define VALIDATECORECLRCALLBACKS() if (g_CoreClrCallbacks.m_hmodCoreCLR == NULL) OnUninitializedCoreClrCallbacks()
+#else //_DEBUG
+#define VALIDATECORECLRCALLBACKS()
+#endif //_DEBUG
+
+#endif // defined(FEATURE_CORECLR) || !defined(SELF_NO_HOST) || defined(DACCESS_COMPILE)
+
+#ifdef FEATURE_CORRUPTING_EXCEPTIONS
+
+// Corrupting Exception limited support for outside the VM folder
+BOOL IsProcessCorruptedStateException(DWORD dwExceptionCode, BOOL fCheckForSO = TRUE);
+
+#endif // FEATURE_CORRUPTING_EXCEPTIONS
+
+
+BOOL IsV2RuntimeLoaded(void);
+
+namespace UtilCode
+{
+ // These are type-safe versions of Interlocked[Compare]Exchange
+ // They avoid invoking struct cast operations via reinterpreting
+ // the struct's address as a LONG* or LONGLONG* and dereferencing it.
+ //
+ // If we had a global ::operator & (unary), we would love to use that
+ // to ensure we were not also accidentally getting a structs's provided
+ // operator &. TODO: probe with a static_assert?
+
+ template <typename T, int SIZE = sizeof(T)>
+ struct InterlockedCompareExchangeHelper;
+
+ template <typename T>
+ struct InterlockedCompareExchangeHelper<T, sizeof(LONG)>
+ {
+ static inline T InterlockedExchange(
+ T volatile * target,
+ T value)
+ {
+ static_assert_no_msg(sizeof(T) == sizeof(LONG));
+ LONG res = ::InterlockedExchange(
+ reinterpret_cast<LONG volatile *>(target),
+ *reinterpret_cast<LONG *>(/*::operator*/&(value)));
+ return *reinterpret_cast<T*>(&res);
+ }
+
+ static inline T InterlockedCompareExchange(
+ T volatile * destination,
+ T exchange,
+ T comparand)
+ {
+ static_assert_no_msg(sizeof(T) == sizeof(LONG));
+ LONG res = ::InterlockedCompareExchange(
+ reinterpret_cast<LONG volatile *>(destination),
+ *reinterpret_cast<LONG*>(/*::operator*/&(exchange)),
+ *reinterpret_cast<LONG*>(/*::operator*/&(comparand)));
+ return *reinterpret_cast<T*>(&res);
+ }
+ };
+
+ template <typename T>
+ struct InterlockedCompareExchangeHelper<T, sizeof(LONGLONG)>
+ {
+ static inline T InterlockedExchange(
+ T volatile * target,
+ T value)
+ {
+ static_assert_no_msg(sizeof(T) == sizeof(LONGLONG));
+ LONGLONG res = ::InterlockedExchange64(
+ reinterpret_cast<LONGLONG volatile *>(target),
+ *reinterpret_cast<LONGLONG *>(/*::operator*/&(value)));
+ return *reinterpret_cast<T*>(&res);
+ }
+
+ static inline T InterlockedCompareExchange(
+ T volatile * destination,
+ T exchange,
+ T comparand)
+ {
+ static_assert_no_msg(sizeof(T) == sizeof(LONGLONG));
+ LONGLONG res = ::InterlockedCompareExchange64(
+ reinterpret_cast<LONGLONG volatile *>(destination),
+ *reinterpret_cast<LONGLONG*>(/*::operator*/&(exchange)),
+ *reinterpret_cast<LONGLONG*>(/*::operator*/&(comparand)));
+ return *reinterpret_cast<T*>(&res);
+ }
+ };
+}
+
+template <typename T>
+inline T InterlockedExchangeT(
+ T volatile * target,
+ T value)
+{
+ return ::UtilCode::InterlockedCompareExchangeHelper<T>::InterlockedExchange(
+ target, value);
+}
+
+template <typename T>
+inline T InterlockedCompareExchangeT(
+ T volatile * destination,
+ T exchange,
+ T comparand)
+{
+ return ::UtilCode::InterlockedCompareExchangeHelper<T>::InterlockedCompareExchange(
+ destination, exchange, comparand);
+}
+
+// Pointer variants for Interlocked[Compare]ExchangePointer
+// If the underlying type is a const type, we have to remove its constness
+// since Interlocked[Compare]ExchangePointer doesn't take const void * arguments.
+template <typename T>
+inline T* InterlockedExchangeT(
+ T* volatile * target,
+ T* value)
+{
+ //STATIC_ASSERT(value == 0);
+ typedef typename std::remove_const<T>::type * non_const_ptr_t;
+ return reinterpret_cast<T*>(InterlockedExchangePointer(
+ reinterpret_cast<PVOID volatile *>(const_cast<non_const_ptr_t volatile *>(target)),
+ reinterpret_cast<PVOID>(const_cast<non_const_ptr_t>(value))));
+}
+
+template <typename T>
+inline T* InterlockedCompareExchangeT(
+ T* volatile * destination,
+ T* exchange,
+ T* comparand)
+{
+ //STATIC_ASSERT(exchange == 0);
+ typedef typename std::remove_const<T>::type * non_const_ptr_t;
+ return reinterpret_cast<T*>(InterlockedCompareExchangePointer(
+ reinterpret_cast<PVOID volatile *>(const_cast<non_const_ptr_t volatile *>(destination)),
+ reinterpret_cast<PVOID>(const_cast<non_const_ptr_t>(exchange)),
+ reinterpret_cast<PVOID>(const_cast<non_const_ptr_t>(comparand))));
+}
+
+// NULL pointer variants of the above to avoid having to cast NULL
+// to the appropriate pointer type.
+template <typename T>
+inline T* InterlockedExchangeT(
+ T* volatile * target,
+ int value) // When NULL is provided as argument.
+{
+ //STATIC_ASSERT(value == 0);
+ return InterlockedExchangeT(target, reinterpret_cast<T*>(value));
+}
+
+template <typename T>
+inline T* InterlockedCompareExchangeT(
+ T* volatile * destination,
+ int exchange, // When NULL is provided as argument.
+ T* comparand)
+{
+ //STATIC_ASSERT(exchange == 0);
+ return InterlockedCompareExchangeT(destination, reinterpret_cast<T*>(exchange), comparand);
+}
+
+template <typename T>
+inline T* InterlockedCompareExchangeT(
+ T* volatile * destination,
+ T* exchange,
+ int comparand) // When NULL is provided as argument.
+{
+ //STATIC_ASSERT(comparand == 0);
+ return InterlockedCompareExchangeT(destination, exchange, reinterpret_cast<T*>(comparand));
+}
+
+// NULL pointer variants of the above to avoid having to cast NULL
+// to the appropriate pointer type.
+template <typename T>
+inline T* InterlockedExchangeT(
+ T* volatile * target,
+ std::nullptr_t value) // When nullptr is provided as argument.
+{
+ //STATIC_ASSERT(value == 0);
+ return InterlockedExchangeT(target, reinterpret_cast<T*>(value));
+}
+
+template <typename T>
+inline T* InterlockedCompareExchangeT(
+ T* volatile * destination,
+ std::nullptr_t exchange, // When nullptr is provided as argument.
+ T* comparand)
+{
+ //STATIC_ASSERT(exchange == 0);
+ return InterlockedCompareExchangeT(destination, reinterpret_cast<T*>(exchange), comparand);
+}
+
+template <typename T>
+inline T* InterlockedCompareExchangeT(
+ T* volatile * destination,
+ T* exchange,
+ std::nullptr_t comparand) // When nullptr is provided as argument.
+{
+ //STATIC_ASSERT(comparand == 0);
+ return InterlockedCompareExchangeT(destination, exchange, reinterpret_cast<T*>(comparand));
+}
+
+#undef InterlockedExchangePointer
+#define InterlockedExchangePointer Use_InterlockedExchangeT
+#undef InterlockedCompareExchangePointer
+#define InterlockedCompareExchangePointer Use_InterlockedCompareExchangeT
+
+// Returns the directory for HMODULE. So, if HMODULE was for "C:\Dir1\Dir2\Filename.DLL",
+// then this would return "C:\Dir1\Dir2\" (note the trailing backslash).
+HRESULT GetHModuleDirectory(HMODULE hMod, SString& wszPath);
+HRESULT CopySystemDirectory(const SString& pPathString, SString& pbuffer);
+
+HMODULE LoadLocalizedResourceDLLForSDK(_In_z_ LPCWSTR wzResourceDllName, _In_opt_z_ LPCWSTR modulePath=NULL, bool trySelf=true);
+// This is a slight variation that can be used for anything else
+typedef void* (__cdecl *LocalizedFileHandler)(LPCWSTR);
+void* FindLocalizedFile(_In_z_ LPCWSTR wzResourceDllName, LocalizedFileHandler lfh, _In_opt_z_ LPCWSTR modulePath=NULL);
+
+BOOL IsClrHostedLegacyComObject(REFCLSID rclsid);
+
+
+#if !defined(FEATURE_CORECLR) && !defined(CROSSGEN_COMPILE)
+
+// No utilcode code should use the global LoadLibraryShim anymore. UtilCode::LoadLibraryShim will do
+// the right thing based on whether the hosted or non-hosted utilcode is linked to. Using the global
+// LoadLibraryShim will result in a deprecated use warning.
+
+#ifdef SELF_NO_HOST
+#define LEGACY_ACTIVATION_SHIM_LOAD_LIBRARY WszLoadLibrary
+#include "legacyactivationshim.h"
+#include "mscoreepriv.h"
+
+namespace UtilCode
+{
+ inline HRESULT LoadLibraryShim(LPCWSTR szDllName, LPCWSTR szVersion, LPVOID pvReserved, HMODULE *phModDll)
+ {
+ return LegacyActivationShim::LoadLibraryShim(szDllName, szVersion, pvReserved, phModDll);
+ }
+};
+#else // SELF_NO_HOST
+namespace UtilCode
+{
+ // Hosted environment
+ HRESULT LoadLibraryShim(LPCWSTR szDllName, LPCWSTR szVersion, LPVOID pvReserved, HMODULE *phModDll);
+};
+#endif // SELF_NO_HOST
+
+#endif // !FEATURE_CORECLR && !CROSSGEN_COMPILE
+
+
+// Helper to support termination due to heap corruption
+// It's not supported on Win2K, so we have to manually delay load it
+void EnableTerminationOnHeapCorruption();
+
+
+#if !defined(FEATURE_CORECLR)
+// On success, sets pwszProcessExePath (required) to full path to process EXE.
+HRESULT GetProcessExePath(LPCWSTR *pwszProcessExePath);
+#endif
+
+namespace Clr { namespace Util
+{
+ // This api returns a pointer to a null-terminated string that contains the local appdata directory
+ // or it returns NULL in the case that the directory could not be found. The return value from this function
+ // is not actually checked for existence.
+ HRESULT GetLocalAppDataDirectory(LPCWSTR *ppwzLocalAppDataDirectory);
+ HRESULT SetLocalAppDataDirectory(LPCWSTR pwzLocalAppDataDirectory);
+
+namespace Reg
+{
+ HRESULT ReadStringValue(HKEY hKey, LPCWSTR wszSubKey, LPCWSTR wszName, SString & ssValue);
+ __success(return == S_OK)
+ HRESULT ReadStringValue(HKEY hKey, LPCWSTR wszSubKey, LPCWSTR wszName, __deref_out __deref_out_z LPWSTR* pwszValue);
+}
+
+#ifdef FEATURE_COMINTEROP
+namespace Com
+{
+ HRESULT FindServerUsingCLSID(REFCLSID rclsid, SString & ssServerName);
+ HRESULT FindServerUsingCLSID(REFCLSID rclsid, __deref_out __deref_out_z LPWSTR* pwszServerName);
+ HRESULT FindInprocServer32UsingCLSID(REFCLSID rclsid, SString & ssInprocServer32Name);
+ HRESULT FindInprocServer32UsingCLSID(REFCLSID rclsid, __deref_out __deref_out_z LPWSTR* pwszInprocServer32Name);
+ BOOL IsMscoreeInprocServer32(const SString & ssInprocServer32Name);
+ BOOL CLSIDHasMscoreeAsInprocServer32(REFCLSID rclsid);
+}
+#endif // FEATURE_COMINTEROP
+
+namespace Win32
+{
+ static const WCHAR LONG_FILENAME_PREFIX_W[] = W("\\\\?\\");
+ static const CHAR LONG_FILENAME_PREFIX_A[] = "\\\\?\\";
+
+ void GetModuleFileName(
+ HMODULE hModule,
+ SString & ssFileName,
+ bool fAllowLongFileNames = false);
+
+ __success(return == S_OK)
+ HRESULT GetModuleFileName(
+ HMODULE hModule,
+ __deref_out_z LPWSTR * pwszFileName,
+ bool fAllowLongFileNames = false);
+
+ void GetFullPathName(
+ SString const & ssFileName,
+ SString & ssPathName,
+ DWORD * pdwFilePartIdx,
+ bool fAllowLongFileNames = false);
+}
+
+}}
+
+#if defined(FEATURE_APPX) && !defined(DACCESS_COMPILE)
+ // Forward declaration of AppX::IsAppXProcess
+ namespace AppX { bool IsAppXProcess(); }
+
+ // LOAD_WITH_ALTERED_SEARCH_PATH is unsupported in AppX processes.
+ inline DWORD GetLoadWithAlteredSearchPathFlag()
+ {
+ WRAPPER_NO_CONTRACT;
+ return AppX::IsAppXProcess() ? 0 : LOAD_WITH_ALTERED_SEARCH_PATH;
+ }
+#else // FEATURE_APPX && !DACCESS_COMPILE
+ // LOAD_WITH_ALTERED_SEARCH_PATH can be used unconditionally.
+ inline DWORD GetLoadWithAlteredSearchPathFlag()
+ {
+ LIMITED_METHOD_CONTRACT;
+ #ifdef LOAD_WITH_ALTERED_SEARCH_PATH
+ return LOAD_WITH_ALTERED_SEARCH_PATH;
+ #else
+ return 0;
+ #endif
+ }
+#endif // FEATURE_APPX && !DACCESS_COMPILE
+
+// clr::SafeAddRef and clr::SafeRelease helpers.
+namespace clr
+{
+ //=================================================================================================================
+ template <typename ItfT>
+ static inline
+ typename std::enable_if< std::is_pointer<ItfT>::value, ItfT >::type
+ SafeAddRef(ItfT pItf)
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ if (pItf != nullptr)
+ {
+ pItf->AddRef();
+ }
+ return pItf;
+ }
+
+ //=================================================================================================================
+ template <typename ItfT>
+ typename std::enable_if< std::is_pointer<ItfT>::value && std::is_reference<ItfT>::value, ULONG >::type
+ SafeRelease(ItfT pItf)
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ ULONG res = 0;
+ if (pItf != nullptr)
+ {
+ res = pItf->Release();
+ pItf = nullptr;
+ }
+ return res;
+ }
+
+ //=================================================================================================================
+ template <typename ItfT>
+ typename std::enable_if< std::is_pointer<ItfT>::value && !std::is_reference<ItfT>::value, ULONG >::type
+ SafeRelease(ItfT pItf)
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ ULONG res = 0;
+ if (pItf != nullptr)
+ {
+ res = pItf->Release();
+ }
+ return res;
+ }
+}
+
+// clr::SafeDelete
+namespace clr
+{
+ //=================================================================================================================
+ template <typename PtrT>
+ static inline
+ typename std::enable_if< std::is_pointer<PtrT>::value, PtrT >::type
+ SafeDelete(PtrT & ptr)
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ if (ptr != nullptr)
+ {
+ delete ptr;
+ ptr = nullptr;
+ }
+ }
+}
+
+// ======================================================================================
+// Spinning support (used by VM and by MetaData via file:..\Utilcode\UTSem.cpp)
+
+struct SpinConstants
+{
+ DWORD dwInitialDuration;
+ DWORD dwMaximumDuration;
+ DWORD dwBackoffFactor;
+ DWORD dwRepetitions;
+};
+
+extern SpinConstants g_SpinConstants;
+
+// ======================================================================================
+
+#endif // __UtilCode_h__
diff --git a/src/inc/utsem.h b/src/inc/utsem.h
new file mode 100644
index 0000000000..91036db898
--- /dev/null
+++ b/src/inc/utsem.h
@@ -0,0 +1,63 @@
+// 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.
+
+
+/* ----------------------------------------------------------------------------
+
+---------------------------------------------------------------------------- */
+#ifndef __UTSEM_H__
+#define __UTSEM_H__
+
+
+// -------------------------------------------------------------
+// INCLUDES
+// -------------------------------------------------------------
+#include "utilcode.h"
+
+/* ----------------------------------------------------------------------------
+@class UTSemReadWrite
+
+ An instance of class UTSemReadWrite provides multi-read XOR single-write
+ (a.k.a. shared vs. exclusive) lock capabilities, with protection against
+ writer starvation.
+
+ A thread MUST NOT call any of the Lock methods if it already holds a Lock.
+ (Doing so may result in a deadlock.)
+
+
+---------------------------------------------------------------------------- */
+class UTSemReadWrite
+{
+public:
+ UTSemReadWrite(); // Constructor
+ ~UTSemReadWrite(); // Destructor
+
+ HRESULT Init();
+
+ HRESULT LockRead(); // Lock the object for reading
+ HRESULT LockWrite(); // Lock the object for writing
+ void UnlockRead(); // Unlock the object for reading
+ void UnlockWrite(); // Unlock the object for writing
+
+#ifdef _DEBUG
+ BOOL Debug_IsLockedForRead();
+ BOOL Debug_IsLockedForWrite();
+#endif //_DEBUG
+
+private:
+ Semaphore * GetReadWaiterSemaphore()
+ {
+ return m_pReadWaiterSemaphore;
+ }
+ Event * GetWriteWaiterEvent()
+ {
+ return m_pWriteWaiterEvent;
+ }
+
+ Volatile<ULONG> m_dwFlag; // internal state, see implementation
+ Semaphore * m_pReadWaiterSemaphore; // semaphore for awakening read waiters
+ Event * m_pWriteWaiterEvent; // event for awakening write waiters
+}; // class UTSemReadWrite
+
+#endif // __UTSEM_H__
diff --git a/src/inc/vererror.h b/src/inc/vererror.h
new file mode 100644
index 0000000000..2299b8e087
--- /dev/null
+++ b/src/inc/vererror.h
@@ -0,0 +1,137 @@
+// 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.
+
+/**************************************************************************************
+ ** **
+ ** Vererror.h - definitions of data structures, needed to report verifier errors. **
+ ** **
+ **************************************************************************************/
+
+#ifndef __VERERROR_h__
+#define __VERERROR_h__
+
+#ifndef _VER_RAW_STRUCT_FOR_IDL_
+#ifndef _JIT64_PEV_
+#include "corhdr.h"
+#include "openum.h"
+#include "corerror.h"
+#endif // !_JIT64_PEV_
+
+// Set these flags if the error info fields are valid.
+
+#define VER_ERR_FATAL 0x80000000L // Cannot Continue
+#define VER_ERR_OFFSET 0x00000001L
+#define VER_ERR_OPCODE 0x00000002L
+#define VER_ERR_OPERAND 0x00000004L
+#define VER_ERR_TOKEN 0x00000008L
+#define VER_ERR_EXCEP_NUM_1 0x00000010L
+#define VER_ERR_EXCEP_NUM_2 0x00000020L
+#define VER_ERR_STACK_SLOT 0x00000040L
+#define VER_ERR_ITEM_1 0x00000080L
+#define VER_ERR_ITEM_2 0x00000100L
+#define VER_ERR_ITEM_F 0x00000200L
+#define VER_ERR_ITEM_E 0x00000400L
+#define VER_ERR_TYPE_1 0x00000800L
+#define VER_ERR_TYPE_2 0x00001000L
+#define VER_ERR_TYPE_F 0x00002000L
+#define VER_ERR_TYPE_E 0x00004000L
+#define VER_ERR_ADDL_MSG 0x00008000L
+
+#define VER_ERR_SIG_MASK 0x07000000L // Enum
+#define VER_ERR_METHOD_SIG 0x01000000L
+#define VER_ERR_LOCAL_SIG 0x02000000L
+#define VER_ERR_FIELD_SIG 0x03000000L
+#define VER_ERR_CALL_SIG 0x04000000L
+
+#define VER_ERR_OPCODE_OFFSET (VER_ERR_OPCODE|VER_ERR_OFFSET)
+
+#define VER_ERR_LOCAL_VAR VER_ERR_LOCAL_SIG
+#define VER_ERR_ARGUMENT VER_ERR_METHOD_SIG
+
+#define VER_ERR_ARG_RET 0xFFFFFFFEL // The Argument # is return
+#define VER_ERR_NO_ARG 0xFFFFFFFFL // Argument # is not valid
+#define VER_ERR_NO_LOC VER_ERR_NO_ARG // Local # is not valid
+
+typedef struct
+{
+ DWORD dwFlags; // BYREF / BOXED etc.. see veritem.hpp
+ void* pv; // TypeHandle / MethodDesc * etc.
+} _VerItem;
+
+// This structure is used to fully define a verification error.
+// Verification error codes are found in CorError.h
+// The error resource strings are found in src/dlls/mscorrc/mscor.rc
+
+typedef struct VerErrorStruct
+{
+ DWORD dwFlags; // VER_ERR_XXX
+
+ union {
+#ifndef _JIT64_PEV_
+ OPCODE opcode;
+#endif // !_JIT64_PEV_
+ unsigned long padding1; // to match with idl generated struct size
+ };
+
+ union {
+ DWORD dwOffset; // #of bytes from start of method
+ long uOffset; // for backward compat with Metadata validator
+ };
+
+ union {
+ mdToken token;
+ mdToken Token; // for backward compat with metadata validator
+ BYTE bCallConv;
+ CorElementType elem;
+ DWORD dwStackSlot; // positon in the Stack
+ unsigned long padding2; // to match with idl generated struct size
+ };
+
+ union {
+ _VerItem sItem1;
+ _VerItem sItemFound;
+ WCHAR* wszType1;
+ WCHAR* wszTypeFound;
+ DWORD dwException1; // Exception Record #
+ DWORD dwVarNumber; // Variable #
+ DWORD dwArgNumber; // Argument #
+ DWORD dwOperand; // Operand for the opcode
+ WCHAR* wszAdditionalMessage; // message from getlasterror
+ };
+
+ union {
+ _VerItem sItem2;
+ _VerItem sItemExpected;
+ WCHAR* wszType2;
+ WCHAR* wszTypeExpected;
+ DWORD dwException2; // Exception Record #
+ };
+
+} VerError;
+
+#else
+
+// Assert that sizeof(_VerError) == sizeof(VerError) in Verifier.cpp
+typedef struct tag_VerError
+{
+ unsigned long flags; // DWORD
+ unsigned long opcode; // OPCODE, padded to ulong
+ unsigned long uOffset; // DWORD
+ unsigned long Token; // mdToken
+ unsigned long item1_flags; // _VerItem.DWORD
+ int *item1_data; // _VerItem.PVOID
+ unsigned long item2_flags; // _VerItem.DWORD
+ int *item2_data; // _VerItem.PVOID
+} _VerError;
+#endif
+
+#endif // __VERERROR_h__
+
+
+
+
+
+
+
+
diff --git a/src/inc/volatile.h b/src/inc/volatile.h
new file mode 100644
index 0000000000..c295f98696
--- /dev/null
+++ b/src/inc/volatile.h
@@ -0,0 +1,514 @@
+// 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.
+//
+// Volatile.h
+//
+
+//
+// Defines the Volatile<T> type, which provides uniform volatile-ness on
+// Visual C++ and GNU C++.
+//
+// Visual C++ treats accesses to volatile variables as follows: no read or write
+// can be removed by the compiler, no global memory access can be moved backwards past
+// a volatile read, and no global memory access can be moved forward past a volatile
+// write.
+//
+// The GCC volatile semantic is straight out of the C standard: the compiler is not
+// allowed to remove accesses to volatile variables, and it is not allowed to reorder
+// volatile accesses relative to other volatile accesses. It is allowed to freely
+// reorder non-volatile accesses relative to volatile accesses.
+//
+// We have lots of code that assumes that ordering of non-volatile accesses will be
+// constrained relative to volatile accesses. For example, this pattern appears all
+// over the place:
+//
+// static volatile int lock = 0;
+//
+// while (InterlockedCompareExchange(&lock, 0, 1))
+// {
+// //spin
+// }
+//
+// //read and write variables protected by the lock
+//
+// lock = 0;
+//
+// This depends on the reads and writes in the critical section not moving past the
+// final statement, which releases the lock. If this should happen, then you have an
+// unintended race.
+//
+// The solution is to ban the use of the "volatile" keyword, and instead define our
+// own type Volatile<T>, which acts like a variable of type T except that accesses to
+// the variable are always given VC++'s volatile semantics.
+//
+// (NOTE: The code above is not intended to be an example of how a spinlock should be
+// implemented; it has many flaws, and should not be used. This code is intended only
+// to illustrate where we might get into trouble with GCC's volatile semantics.)
+//
+// @TODO: many of the variables marked volatile in the CLR do not actually need to be
+// volatile. For example, if a variable is just always passed to Interlocked functions
+// (such as a refcount variable), there is no need for it to be volatile. A future
+// cleanup task should be to examine each volatile variable and make them non-volatile
+// if possible.
+//
+// @TODO: link to a "Memory Models for CLR Devs" doc here (this doc does not yet exist).
+//
+
+#ifndef _VOLATILE_H_
+#define _VOLATILE_H_
+
+#include "staticcontract.h"
+
+//
+// This code is extremely compiler- and CPU-specific, and will need to be altered to
+// support new compilers and/or CPUs. Here we enforce that we can only compile using
+// VC++, or GCC on x86 or AMD64.
+//
+#if !defined(_MSC_VER) && !defined(__GNUC__)
+#error The Volatile type is currently only defined for Visual C++ and GNU C++
+#endif
+
+#if defined(__GNUC__) && !defined(_X86_) && !defined(_AMD64_) && !defined(_ARM_) && !defined(_ARM64_)
+#error The Volatile type is currently only defined for GCC when targeting x86, AMD64, ARM or ARM64 CPUs
+#endif
+
+#if defined(__GNUC__)
+#if defined(_ARM_) || defined(_ARM64_)
+// This is functionally equivalent to the MemoryBarrier() macro used on ARM on Windows.
+#define VOLATILE_MEMORY_BARRIER() asm volatile ("dmb sy" : : : "memory")
+#else
+//
+// For GCC, we prevent reordering by the compiler by inserting the following after a volatile
+// load (to prevent subsequent operations from moving before the read), and before a volatile
+// write (to prevent prior operations from moving past the write). We don't need to do anything
+// special to prevent CPU reorderings, because the x86 and AMD64 architectures are already
+// sufficiently constrained for our purposes. If we ever need to run on weaker CPU architectures
+// (such as PowerPC), then we will need to do more work.
+//
+// Please do not use this macro outside of this file. It is subject to change or removal without
+// notice.
+//
+#define VOLATILE_MEMORY_BARRIER() asm volatile ("" : : : "memory")
+#endif // _ARM_ || _ARM64_
+#elif (defined(_ARM_) || defined(_ARM64_)) && _ISO_VOLATILE
+// ARM & ARM64 have a very weak memory model and very few tools to control that model. We're forced to perform a full
+// memory barrier to preserve the volatile semantics. Technically this is only necessary on MP systems but we
+// currently don't have a cheap way to determine the number of CPUs from this header file. Revisit this if it
+// turns out to be a performance issue for the uni-proc case.
+#define VOLATILE_MEMORY_BARRIER() MemoryBarrier()
+#else
+//
+// On VC++, reorderings at the compiler and machine level are prevented by the use of the
+// "volatile" keyword in VolatileLoad and VolatileStore. This should work on any CPU architecture
+// targeted by VC++ with /iso_volatile-.
+//
+#define VOLATILE_MEMORY_BARRIER()
+#endif // __GNUC__
+
+//
+// VolatileLoad loads a T from a pointer to T. It is guaranteed that this load will not be optimized
+// away by the compiler, and that any operation that occurs after this load, in program order, will
+// not be moved before this load. In general it is not guaranteed that the load will be atomic, though
+// this is the case for most aligned scalar data types. If you need atomic loads or stores, you need
+// to consult the compiler and CPU manuals to find which circumstances allow atomicity.
+//
+template<typename T>
+inline
+T VolatileLoad(T const * pt)
+{
+ STATIC_CONTRACT_SUPPORTS_DAC_HOST_ONLY;
+
+#ifndef DACCESS_COMPILE
+ T val = *(T volatile const *)pt;
+ VOLATILE_MEMORY_BARRIER();
+#else
+ T val = *pt;
+#endif
+ return val;
+}
+
+template<typename T>
+inline
+T VolatileLoadWithoutBarrier(T const * pt)
+{
+ STATIC_CONTRACT_SUPPORTS_DAC_HOST_ONLY;
+
+#ifndef DACCESS_COMPILE
+ T val = *(T volatile const *)pt;
+#else
+ T val = *pt;
+#endif
+ return val;
+}
+
+template <typename T> class Volatile;
+
+template<typename T>
+inline
+T VolatileLoad(Volatile<T> const * pt)
+{
+ STATIC_CONTRACT_SUPPORTS_DAC;
+ return pt->Load();
+}
+
+//
+// VolatileStore stores a T into the target of a pointer to T. Is is guaranteed that this store will
+// not be optimized away by the compiler, and that any operation that occurs before this store, in program
+// order, will not be moved after this store. In general, it is not guaranteed that the store will be
+// atomic, though this is the case for most aligned scalar data types. If you need atomic loads or stores,
+// you need to consult the compiler and CPU manuals to find which circumstances allow atomicity.
+//
+template<typename T>
+inline
+void VolatileStore(T* pt, T val)
+{
+ STATIC_CONTRACT_SUPPORTS_DAC_HOST_ONLY;
+
+#ifndef DACCESS_COMPILE
+ VOLATILE_MEMORY_BARRIER();
+ *(T volatile *)pt = val;
+#else
+ *pt = val;
+#endif
+}
+
+template<typename T>
+inline
+void VolatileStoreWithoutBarrier(T* pt, T val)
+{
+ STATIC_CONTRACT_SUPPORTS_DAC_HOST_ONLY;
+
+#ifndef DACCESS_COMPILE
+ *(T volatile *)pt = val;
+#else
+ *pt = val;
+#endif
+}
+
+//
+// Volatile<T> implements accesses with our volatile semantics over a variable of type T.
+// Wherever you would have used a "volatile Foo" or, equivalently, "Foo volatile", use Volatile<Foo>
+// instead. If Foo is a pointer type, use VolatilePtr.
+//
+// Note that there are still some things that don't work with a Volatile<T>,
+// that would have worked with a "volatile T". For example, you can't cast a Volatile<int> to a float.
+// You must instead cast to an int, then to a float. Or you can call Load on the Volatile<int>, and
+// cast the result to a float. In general, calling Load or Store explicitly will work around
+// any problems that can't be solved by operator overloading.
+//
+// @TODO: it's not clear that we actually *want* any operator overloading here. It's in here primarily
+// to ease the task of converting all of the old uses of the volatile keyword, but in the long
+// run it's probably better if users of this class are forced to call Load() and Store() explicitly.
+// This would make it much more clear where the memory barriers are, and which operations are actually
+// being performed, but it will have to wait for another cleanup effort.
+//
+template <typename T>
+class Volatile
+{
+private:
+ //
+ // The data which we are treating as volatile
+ //
+ T m_val;
+
+public:
+ //
+ // Default constructor. Results in an unitialized value!
+ //
+ inline Volatile()
+ {
+ STATIC_CONTRACT_SUPPORTS_DAC;
+ }
+
+ //
+ // Allow initialization of Volatile<T> from a T
+ //
+ inline Volatile(const T& val)
+ {
+ STATIC_CONTRACT_SUPPORTS_DAC;
+ ((volatile T &)m_val) = val;
+ }
+
+ //
+ // Copy constructor
+ //
+ inline Volatile(const Volatile<T>& other)
+ {
+ STATIC_CONTRACT_SUPPORTS_DAC;
+ ((volatile T &)m_val) = other.Load();
+ }
+
+ //
+ // Loads the value of the volatile variable. See code:VolatileLoad for the semantics of this operation.
+ //
+ inline T Load() const
+ {
+ STATIC_CONTRACT_SUPPORTS_DAC;
+ return VolatileLoad(&m_val);
+ }
+
+ //
+ // Loads the value of the volatile variable atomically without erecting the memory barrier.
+ //
+ inline T LoadWithoutBarrier() const
+ {
+ STATIC_CONTRACT_SUPPORTS_DAC;
+ return ((volatile T &)m_val);
+ }
+
+ //
+ // Stores a new value to the volatile variable. See code:VolatileStore for the semantics of this
+ // operation.
+ //
+ inline void Store(const T& val)
+ {
+ STATIC_CONTRACT_SUPPORTS_DAC;
+ VolatileStore(&m_val, val);
+ }
+
+
+ //
+ // Stores a new value to the volatile variable atomically without erecting the memory barrier.
+ //
+ inline void StoreWithoutBarrier(const T& val) const
+ {
+ STATIC_CONTRACT_SUPPORTS_DAC;
+ ((volatile T &)m_val) = val;
+ }
+
+
+ //
+ // Gets a pointer to the volatile variable. This is dangerous, as it permits the variable to be
+ // accessed without using Load and Store, but it is necessary for passing Volatile<T> to APIs like
+ // InterlockedIncrement.
+ //
+ inline volatile T* GetPointer() { return (volatile T*)&m_val; }
+
+
+ //
+ // Gets the raw value of the variable. This is dangerous, as it permits the variable to be
+ // accessed without using Load and Store
+ //
+ inline T& RawValue() { return m_val; }
+
+ //
+ // Allow casts from Volatile<T> to T. Note that this allows implicit casts, so you can
+ // pass a Volatile<T> directly to a method that expects a T.
+ //
+ inline operator T() const
+ {
+ STATIC_CONTRACT_SUPPORTS_DAC;
+ return this->Load();
+ }
+
+ //
+ // Assignment from T
+ //
+ inline Volatile<T>& operator=(T val) {Store(val); return *this;}
+
+ //
+ // Get the address of the volatile variable. This is dangerous, as it allows the value of the
+ // volatile variable to be accessed directly, without going through Load and Store, but it is
+ // necessary for passing Volatile<T> to APIs like InterlockedIncrement. Note that we are returning
+ // a pointer to a volatile T here, so we cannot accidentally pass this pointer to an API that
+ // expects a normal pointer.
+ //
+ inline T volatile * operator&() {return this->GetPointer();}
+ inline T volatile const * operator&() const {return this->GetPointer();}
+
+ //
+ // Comparison operators
+ //
+ template<typename TOther>
+ inline bool operator==(const TOther& other) const {return this->Load() == other;}
+
+ template<typename TOther>
+ inline bool operator!=(const TOther& other) const {return this->Load() != other;}
+
+ //
+ // Miscellaneous operators. Add more as necessary.
+ //
+ inline Volatile<T>& operator+=(T val) {Store(this->Load() + val); return *this;}
+ inline Volatile<T>& operator-=(T val) {Store(this->Load() - val); return *this;}
+ inline Volatile<T>& operator|=(T val) {Store(this->Load() | val); return *this;}
+ inline Volatile<T>& operator&=(T val) {Store(this->Load() & val); return *this;}
+ inline bool operator!() const { STATIC_CONTRACT_SUPPORTS_DAC; return !this->Load();}
+
+ //
+ // Prefix increment
+ //
+ inline Volatile& operator++() {this->Store(this->Load()+1); return *this;}
+
+ //
+ // Postfix increment
+ //
+ inline T operator++(int) {T val = this->Load(); this->Store(val+1); return val;}
+
+ //
+ // Prefix decrement
+ //
+ inline Volatile& operator--() {this->Store(this->Load()-1); return *this;}
+
+ //
+ // Postfix decrement
+ //
+ inline T operator--(int) {T val = this->Load(); this->Store(val-1); return val;}
+};
+
+//
+// A VolatilePtr builds on Volatile<T> by adding operators appropriate to pointers.
+// Wherever you would have used "Foo * volatile", use "VolatilePtr<Foo>" instead.
+//
+// VolatilePtr also allows the substution of other types for the underlying pointer. This
+// allows you to wrap a VolatilePtr around a custom type that looks like a pointer. For example,
+// if what you want is a "volatile DPTR<Foo>", use "VolatilePtr<Foo, DPTR<Foo>>".
+//
+template <typename T, typename P = T*>
+class VolatilePtr : public Volatile<P>
+{
+public:
+ //
+ // Default constructor. Results in an uninitialized pointer!
+ //
+ inline VolatilePtr()
+ {
+ STATIC_CONTRACT_SUPPORTS_DAC;
+ }
+
+ //
+ // Allow assignment from the pointer type.
+ //
+ inline VolatilePtr(P val) : Volatile<P>(val)
+ {
+ STATIC_CONTRACT_SUPPORTS_DAC;
+ }
+
+ //
+ // Copy constructor
+ //
+ inline VolatilePtr(const VolatilePtr& other) : Volatile<P>(other)
+ {
+ STATIC_CONTRACT_SUPPORTS_DAC;
+ }
+
+ //
+ // Cast to the pointer type
+ //
+ inline operator P() const
+ {
+ STATIC_CONTRACT_SUPPORTS_DAC;
+ return (P)this->Load();
+ }
+
+ //
+ // Member access
+ //
+ inline P operator->() const
+ {
+ STATIC_CONTRACT_SUPPORTS_DAC;
+ return (P)this->Load();
+ }
+
+ //
+ // Dereference the pointer
+ //
+ inline T& operator*() const
+ {
+ STATIC_CONTRACT_SUPPORTS_DAC;
+ return *(P)this->Load();
+ }
+
+ //
+ // Access the pointer as an array
+ //
+ template <typename TIndex>
+ inline T& operator[](TIndex index)
+ {
+ STATIC_CONTRACT_SUPPORTS_DAC;
+ return ((P)this->Load())[index];
+ }
+};
+
+
+//
+// Warning: workaround
+//
+// At the bottom of this file, we are going to #define the "volatile" keyword such that it is illegal
+// to use it. Unfortunately, VC++ uses the volatile keyword in stddef.h, in the definition of "offsetof".
+// GCC does not use volatile in its definition.
+//
+// To get around this, we include stddef.h here (even if we're on GCC, for consistency). We then need
+// to redefine offsetof such that it does not use volatile, if we're building with VC++.
+//
+#include <stddef.h>
+#ifdef _MSC_VER
+#undef offsetof
+#ifdef _WIN64
+#define offsetof(s,m) (size_t)( (ptrdiff_t)&reinterpret_cast<const char&>((((s *)0)->m)) )
+#else
+#define offsetof(s,m) (size_t)&reinterpret_cast<const char&>((((s *)0)->m))
+#endif //_WIN64
+
+// These also use volatile, so we'll include them here.
+//#include <intrin.h>
+//#include <memory>
+
+#endif //_MSC_VER
+
+//
+// From here on out, we ban the use of the "volatile" keyword. If you found this while trying to define
+// a volatile variable, go to the top of this file and start reading.
+//
+#ifdef volatile
+#undef volatile
+#endif
+// ***** Temporarily removing this to unblock integration with new VC++ bits
+//#define volatile (DoNotUseVolatileKeyword) volatile
+
+// The substitution for volatile above is defined in such a way that we can still explicitly access the
+// volatile keyword without error using the macros below. Use with care.
+//#define REMOVE_DONOTUSE_ERROR(x)
+//#define RAW_KEYWORD(x) REMOVE_DONOTUSE_ERROR x
+#define RAW_KEYWORD(x) x
+
+#ifdef DACCESS_COMPILE
+// No need to use volatile in DAC builds - DAC is single-threaded and the target
+// process is suspended.
+#define VOLATILE(T) T
+#else
+
+// Disable use of Volatile<T> for GC/HandleTable code except on platforms where it's absolutely necessary.
+#if defined(_MSC_VER) && !defined(_ARM_)
+#define VOLATILE(T) T RAW_KEYWORD(volatile)
+#else
+#define VOLATILE(T) Volatile<T>
+#endif
+
+#endif // DACCESS_COMPILE
+
+// VolatilePtr-specific clr::SafeAddRef and clr::SafeRelease
+namespace clr
+{
+ template < typename ItfT, typename PtrT > inline
+ #ifdef __checkReturn // Volatile.h is used in corunix headers, which don't define/nullify SAL.
+ __checkReturn
+ #endif
+ VolatilePtr<ItfT, PtrT>&
+ SafeAddRef(VolatilePtr<ItfT, PtrT>& pItf)
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ SafeAddRef(pItf.Load());
+ return pItf;
+ }
+
+ template < typename ItfT, typename PtrT > inline
+ ULONG
+ SafeRelease(VolatilePtr<ItfT, PtrT>& pItf)
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ return SafeRelease(pItf.Load());
+ }
+}
+
+#endif //_VOLATILE_H_
diff --git a/src/inc/vptr_list.h b/src/inc/vptr_list.h
new file mode 100644
index 0000000000..bac0c1165e
--- /dev/null
+++ b/src/inc/vptr_list.h
@@ -0,0 +1,156 @@
+// 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.
+
+// Any class with a vtable that needs to be instantiated
+// during debugging data access must be listed here.
+
+VPTR_CLASS(Thread)
+
+VPTR_CLASS(EEJitManager)
+
+#ifdef FEATURE_PREJIT
+VPTR_CLASS(NativeImageJitManager)
+#endif // FEATURE_PREJIT
+#ifdef FEATURE_READYTORUN
+VPTR_CLASS(ReadyToRunJitManager)
+#endif
+VPTR_CLASS(EECodeManager)
+
+VPTR_CLASS(RangeList)
+VPTR_CLASS(LockedRangeList)
+
+#ifdef EnC_SUPPORTED
+VPTR_CLASS(EditAndContinueModule)
+#endif
+VPTR_CLASS(Module)
+VPTR_CLASS(ReflectionModule)
+
+VPTR_CLASS(AppDomain)
+#ifndef FEATURE_CORECLR // FEATURE_NATIVE_IMAGE_GENERATION
+VPTR_MULTI_CLASS(CompilationDomain, AppDomain)
+#endif
+VPTR_CLASS(SharedDomain)
+VPTR_CLASS(SystemDomain)
+
+VPTR_CLASS(DomainAssembly)
+#ifdef FEATURE_MULTIMODULE_ASSEMBLIES
+VPTR_CLASS(DomainModule)
+#endif
+#ifdef FEATURE_REMOTING
+#ifdef _TARGET_AMD64_ // HAS_REMOTING_PRECODE
+VPTR_CLASS(CNonVirtualThunkMgr)
+#endif
+VPTR_CLASS(CVirtualThunkMgr)
+#endif
+VPTR_CLASS(PrecodeStubManager)
+VPTR_CLASS(StubLinkStubManager)
+VPTR_CLASS(ThePreStubManager)
+VPTR_CLASS(ThunkHeapStubManager)
+VPTR_CLASS(VirtualCallStubManager)
+VPTR_CLASS(VirtualCallStubManagerManager)
+VPTR_CLASS(JumpStubStubManager)
+VPTR_CLASS(RangeSectionStubManager)
+VPTR_CLASS(ILStubManager)
+VPTR_CLASS(InteropDispatchStubManager)
+VPTR_CLASS(DelegateInvokeStubManager)
+VPTR_CLASS(TailCallStubManager)
+VPTR_CLASS(PEFile)
+VPTR_CLASS(PEAssembly)
+#ifdef FEATURE_MULTIMODULE_ASSEMBLIES
+VPTR_CLASS(PEModule)
+#endif
+VPTR_CLASS(PEImageLayout)
+VPTR_CLASS(RawImageLayout)
+VPTR_CLASS(ConvertedImageLayout)
+VPTR_CLASS(MappedImageLayout)
+#if !defined(CROSSGEN_COMPILE) && !defined(FEATURE_PAL)
+VPTR_CLASS(LoadedImageLayout)
+#endif // !CROSSGEN_COMPILE && !FEATURE_PAL
+VPTR_CLASS(FlatImageLayout)
+#ifdef FEATURE_FUSION
+VPTR_CLASS(StreamImageLayout)
+#endif
+#ifdef FEATURE_COMINTEROP
+VPTR_CLASS(ComMethodFrame)
+VPTR_CLASS(ComPlusMethodFrame)
+VPTR_CLASS(ComPrestubMethodFrame)
+#endif // FEATURE_COMINTEROP
+VPTR_CLASS(ContextTransitionFrame)
+#ifdef FEATURE_REMOTING
+VPTR_CLASS(GCSafeCollectionFrame)
+VPTR_CLASS(GCSafeObjectTable)
+VPTR_CLASS(GCSafeObjectHashTable)
+#endif
+#ifdef FEATURE_INTERPRETER
+VPTR_CLASS(InterpreterFrame)
+#endif // FEATURE_INTERPRETER
+VPTR_CLASS(DebuggerClassInitMarkFrame)
+VPTR_CLASS(DebuggerSecurityCodeMarkFrame)
+VPTR_CLASS(DebuggerExitFrame)
+VPTR_CLASS(DebuggerU2MCatchHandlerFrame)
+VPTR_CLASS(FaultingExceptionFrame)
+VPTR_CLASS(FuncEvalFrame)
+VPTR_CLASS(GCFrame)
+VPTR_CLASS(HelperMethodFrame)
+VPTR_CLASS(HelperMethodFrame_1OBJ)
+VPTR_CLASS(HelperMethodFrame_2OBJ)
+VPTR_CLASS(HelperMethodFrame_PROTECTOBJ)
+#ifdef FEATURE_HIJACK
+VPTR_CLASS(HijackFrame)
+#endif
+VPTR_CLASS(InlinedCallFrame)
+#if defined(FEATURE_INCLUDE_ALL_INTERFACES) && defined(_TARGET_X86_)
+VPTR_CLASS(LeaveRuntimeFrame)
+VPTR_CLASS(ReverseEnterRuntimeFrame)
+#endif
+VPTR_CLASS(SecureDelegateFrame)
+VPTR_CLASS(SecurityContextFrame)
+VPTR_CLASS(MulticastFrame)
+VPTR_CLASS(PInvokeCalliFrame)
+VPTR_CLASS(PrestubMethodFrame)
+VPTR_CLASS(ProtectByRefsFrame)
+VPTR_CLASS(ProtectValueClassFrame)
+#ifdef FEATURE_HIJACK
+VPTR_CLASS(ResumableFrame)
+VPTR_CLASS(RedirectedThreadFrame)
+#endif
+VPTR_CLASS(StubDispatchFrame)
+VPTR_CLASS(ExternalMethodFrame)
+#ifdef FEATURE_READYTORUN
+VPTR_CLASS(DynamicHelperFrame)
+#endif
+#if !defined(_TARGET_X86_)
+VPTR_CLASS(StubHelperFrame)
+#endif
+#ifdef FEATURE_REMOTING
+VPTR_CLASS(TPMethodFrame)
+#endif
+#if defined(_TARGET_X86_)
+VPTR_CLASS(UMThkCallFrame)
+#endif
+VPTR_CLASS(TailCallFrame)
+VPTR_CLASS(ExceptionFilterFrame)
+
+#ifdef _DEBUG
+VPTR_CLASS(AssumeByrefFromJITStack)
+#endif
+
+#ifdef DEBUGGING_SUPPORTED
+VPTR_CLASS(Debugger)
+VPTR_CLASS(EEDbgInterfaceImpl)
+#endif // DEBUGGING_SUPPORTED
+
+VPTR_CLASS(DebuggerController)
+VPTR_CLASS(DebuggerMethodInfoTable)
+VPTR_CLASS(DebuggerPatchTable)
+
+VPTR_CLASS(LoaderCodeHeap)
+VPTR_CLASS(HostCodeHeap)
+
+VPTR_CLASS(GlobalLoaderAllocator)
+VPTR_CLASS(AppDomainLoaderAllocator)
+VPTR_CLASS(AssemblyLoaderAllocator)
+
+VPTR_CLASS(AssemblySecurityDescriptor)
+VPTR_CLASS(ApplicationSecurityDescriptor)
diff --git a/src/inc/warningcontrol.h b/src/inc/warningcontrol.h
new file mode 100644
index 0000000000..c0e21b90a7
--- /dev/null
+++ b/src/inc/warningcontrol.h
@@ -0,0 +1,86 @@
+// 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.
+//
+// warningcontrol.h
+//
+// Header file to globally control the warning settings for the entire Viper build.
+// You do not need to explicitly include this file; rather, it gets included
+// on the command line with a /FI (force include) directive. This is controlled
+// in sources.vip.
+//
+// KEEP THIS LIST SORTED!
+//
+
+#if defined(_MSC_VER)
+#pragma warning(disable :4001) // "nonstandard extension 'single line comment' was used"
+#pragma warning(error :4007) // 'main' : must be __cdecl
+#pragma warning(disable :4010) // "single-line comment contains line-continuation character"
+#pragma warning(error :4013) // 'function' undefined - assuming extern returning int
+#pragma warning(disable :4022) // "'%s' : pointer mismatch for actual parameter %d"
+#pragma warning(disable :4047) // "'%$L' : '%$T' differs in levels of indirection from '%$T'"
+#pragma warning(disable :4053) // "one void operand for '?:'"
+#pragma warning(disable :4056) // "overflow in floating-point constant arithmetic"
+#pragma warning(disable :4061) // "enumerate '%$S' in switch of enum '%$S' is not explicitly handled by a case label"
+#pragma warning(error :4071) // no function prototype given
+#pragma warning(error :4072) // no function prototype given (fastcall)
+#pragma warning(3 :4092) // sizeof returns 'unsigned long'
+#pragma warning(disable :4100) // "'%$S' : unreferenced formal parameter"
+#pragma warning(disable :4101) // "'%$S' : unreferenced local variable"
+//#pragma warning(error :4102) // "'%$S' : unreferenced label"
+#pragma warning(3 :4121) // structure is sensitive to alignment
+#pragma warning(disable :4127) // "conditional expression is constant"
+#pragma warning(3 :4125) // decimal digit in octal sequence
+#pragma warning(3 :4130) // logical operation on address of string constant
+#pragma warning(3 :4132) // const object should be initialized
+#pragma warning(error :4171) // no function prototype given (old style)
+#pragma warning(4 :4177) // pragma data_seg s/b at global scope
+#pragma warning(disable :4201) // "nonstandard extension used : nameless struct/union"
+#pragma warning(disable :4204) // "nonstandard extension used : non-constant aggregate initializer"
+#pragma warning(4 :4206) // Source File is empty
+#pragma warning(3 :4212) // function declaration used ellipsis
+#pragma warning(error :4259) // pure virtual function was not defined
+#pragma warning(disable :4291) // delete not defined for new, c++ exception may cause leak
+#pragma warning(disable :4302) // truncation from '%$S' to '%$S'
+#pragma warning(disable :4311) // pointer truncation from '%$S' to '%$S'
+#pragma warning(disable :4312) // '<function-style-cast>' : conversion from '%$S' to '%$S' of greater size
+#pragma warning(disable :4334) // result of 32-bit shift implicitly converted to 64 bits
+#pragma warning(disable :4345) // behavior change: an object of POD type constructed with an initializer of the form () will be default-initialized
+#pragma warning(disable :4430) // missing type specifier: C++ doesn't support default-int
+#pragma warning(disable :4477) // format string '%$S' requires an argument of type '%$S', but variadic argument %d has type '%$S'
+#pragma warning(3 :4509) // "nonstandard extension used: '%$S' uses SEH and '%$S' has destructor"
+ //
+ // But beware of doing a return from inside such a try block:
+ //
+ // int foo()
+ // {
+ // ClassWithDestructor c;
+ // __try {
+ // return 0;
+ // } __finally {
+ // printf("in finally");
+ // }
+ //
+ // as (it's a bug) the return value gets toasted. So DON'T casually
+ // dismiss this warning if you're compiling w/o CXX EH turned on (the default).
+
+#pragma warning(3 :4530) // C++ exception handler used, but unwind semantics are not enabled. Specify -GX
+#pragma warning(error :4551) // Function call missing argument list
+
+#pragma warning(error :4700) // Local used w/o being initialized
+#pragma warning(disable :4706) // assignment within conditional expression
+#pragma warning(error :4806) // unsafe operation involving type 'bool'
+#pragma warning(disable :4995) // '_OLD_IOSTREAMS_ARE_DEPRECATED': name was marked as #pragma deprecated
+
+#if defined(_DEBUG) && (!defined(_MSC_FULL_VER) || (_MSC_FULL_VER <= 181040116))
+// The CLR header file check.h, macro CHECK_MSG_EX, can create unreachable code if the LEAVE_DEBUG_ONLY_CODE
+// macro is not empty (such as it is defined in contract.h) and the _RESULT macro expands to "return".
+// Checked-in compilers used by the TFS-based desktop build (e.g., version 18.10.40116.8) started reporting
+// unreachable code warnings when debugholder.h was changed to no longer #define "return" to something relatively
+// complex. However, newer compilers, such as Visual Studio 2015, used to build the CLR from the open source
+// GitHub repo, still do not report this warning. We don't want to disable this warning for open source build,
+// which will use a newer compiler. Hence, only disable it for older compilers.
+#pragma warning(disable :4702) // unreachable code
+#endif
+
+#endif // defined(_MSC_VER)
diff --git a/src/inc/win64unwind.h b/src/inc/win64unwind.h
new file mode 100644
index 0000000000..196052aca9
--- /dev/null
+++ b/src/inc/win64unwind.h
@@ -0,0 +1,117 @@
+// 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.
+
+#ifndef _WIN64UNWIND_H_
+#define _WIN64UNWIND_H_
+
+//
+// Define AMD64 exception handling structures and function prototypes.
+//
+// Define unwind operation codes.
+//
+
+typedef enum _UNWIND_OP_CODES {
+ UWOP_PUSH_NONVOL = 0,
+ UWOP_ALLOC_LARGE,
+ UWOP_ALLOC_SMALL,
+ UWOP_SET_FPREG,
+ UWOP_SAVE_NONVOL,
+ UWOP_SAVE_NONVOL_FAR,
+ UWOP_EPILOG,
+ UWOP_SPARE_CODE,
+ UWOP_SAVE_XMM128,
+ UWOP_SAVE_XMM128_FAR,
+ UWOP_PUSH_MACHFRAME,
+
+#ifdef PLATFORM_UNIX
+ // UWOP_SET_FPREG_LARGE is a CLR Unix-only extension to the Windows AMD64 unwind codes.
+ // It is not part of the standard Windows AMD64 unwind codes specification.
+ // UWOP_SET_FPREG allows for a maximum of a 240 byte offset between RSP and the
+ // frame pointer, when the frame pointer is established. UWOP_SET_FPREG_LARGE
+ // has a 32-bit range scaled by 16. When UWOP_SET_FPREG_LARGE is used,
+ // UNWIND_INFO.FrameRegister must be set to the frame pointer register, and
+ // UNWIND_INFO.FrameOffset must be set to 15 (its maximum value). UWOP_SET_FPREG_LARGE
+ // is followed by two UNWIND_CODEs that are combined to form a 32-bit offset (the same
+ // as UWOP_SAVE_NONVOL_FAR). This offset is then scaled by 16. The result must be less
+ // than 2^32 (that is, the top 4 bits of the unscaled 32-bit number must be zero). This
+ // result is used as the frame pointer register offset from RSP at the time the frame pointer
+ // is established. Either UWOP_SET_FPREG or UWOP_SET_FPREG_LARGE can be used, but not both.
+
+ UWOP_SET_FPREG_LARGE,
+#endif // PLATFORM_UNIX
+} UNWIND_OP_CODES, *PUNWIND_OP_CODES;
+
+static const UCHAR UnwindOpExtraSlotTable[] = {
+ 0, // UWOP_PUSH_NONVOL
+ 1, // UWOP_ALLOC_LARGE (or 3, special cased in lookup code)
+ 0, // UWOP_ALLOC_SMALL
+ 0, // UWOP_SET_FPREG
+ 1, // UWOP_SAVE_NONVOL
+ 2, // UWOP_SAVE_NONVOL_FAR
+ 1, // UWOP_EPILOG
+ 2, // UWOP_SPARE_CODE // previously 64-bit UWOP_SAVE_XMM_FAR
+ 1, // UWOP_SAVE_XMM128
+ 2, // UWOP_SAVE_XMM128_FAR
+ 0, // UWOP_PUSH_MACHFRAME
+
+#ifdef PLATFORM_UNIX
+ 2, // UWOP_SET_FPREG_LARGE
+#endif // PLATFORM_UNIX
+};
+
+//
+// Define unwind code structure.
+//
+
+typedef union _UNWIND_CODE {
+ struct {
+ UCHAR CodeOffset;
+ UCHAR UnwindOp : 4;
+ UCHAR OpInfo : 4;
+ };
+
+ struct {
+ UCHAR OffsetLow;
+ UCHAR UnwindOp : 4;
+ UCHAR OffsetHigh : 4;
+ } EpilogueCode;
+
+ USHORT FrameOffset;
+} UNWIND_CODE, *PUNWIND_CODE;
+
+//
+// Define unwind information flags.
+//
+
+#define UNW_FLAG_NHANDLER 0x0
+#define UNW_FLAG_EHANDLER 0x1
+#define UNW_FLAG_UHANDLER 0x2
+#define UNW_FLAG_CHAININFO 0x4
+
+typedef struct _UNWIND_INFO {
+ UCHAR Version : 3;
+ UCHAR Flags : 5;
+ UCHAR SizeOfProlog;
+ UCHAR CountOfUnwindCodes;
+ UCHAR FrameRegister : 4;
+ UCHAR FrameOffset : 4;
+ UNWIND_CODE UnwindCode[1];
+
+//
+// The unwind codes are followed by an optional DWORD aligned field that
+// contains the exception handler address or the address of chained unwind
+// information. If an exception handler address is specified, then it is
+// followed by the language specified exception handler data.
+//
+// union {
+// ULONG ExceptionHandler;
+// ULONG FunctionEntry;
+// };
+//
+// ULONG ExceptionData[];
+//
+
+} UNWIND_INFO, *PUNWIND_INFO;
+
+#endif // _WIN64UNWIND_H_
diff --git a/src/inc/winrt/ntassert.h b/src/inc/winrt/ntassert.h
new file mode 100644
index 0000000000..33a90a1ab1
--- /dev/null
+++ b/src/inc/winrt/ntassert.h
@@ -0,0 +1,210 @@
+// 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.
+
+/*++
+
+Module Name:
+
+ ntassert.h
+
+Abstract:
+
+ Defines DbgRaiseAssertionFailure, and the NT_ASSERT and NT_VERIFY macros.
+
+ Note that normally platform-specific definitions like
+ DbgRaiseAssertionFailure would go to platform-specific subheaders (nti386_x,
+ etc.), they are placed here instead for convenience.
+
+--*/
+
+#pragma once
+
+// begin_wdm begin_winnt begin_ntminiport
+
+#ifdef __cplusplus
+extern "C" {
+#endif
+
+//
+// Assert exception.
+//
+
+#if !defined(_DBGRAISEASSERTIONFAILURE_) && !defined(RC_INVOKED) && !defined(MIDL_PASS)
+
+#define _DBGRAISEASSERTIONFAILURE_
+
+#if defined(_PREFAST_)
+
+__analysis_noreturn
+FORCEINLINE
+VOID
+DbgRaiseAssertionFailure (
+ VOID
+ );
+
+#endif
+
+#if defined(_AMD64_)
+
+#if defined(_M_AMD64)
+
+VOID
+__int2c (
+ VOID
+ );
+
+#pragma intrinsic(__int2c)
+
+#if !defined(_PREFAST_)
+
+#define DbgRaiseAssertionFailure() __int2c()
+
+#endif // !defined(_PREFAST_)
+
+#endif // defined(_M_AMD64)
+
+#elif defined(_X86_)
+
+#if defined(_M_IX86)
+
+#if _MSC_FULL_VER >= 140030222
+
+VOID
+__int2c (
+ VOID
+ );
+
+#pragma intrinsic(__int2c)
+
+#if !defined(_PREFAST_)
+
+#define DbgRaiseAssertionFailure() __int2c()
+
+#endif // !defined(_PREFAST_)
+
+#else // _MSC_FULL_VER >= 140030222
+
+#pragma warning( push )
+#pragma warning( disable : 4793 )
+
+#if !defined(_PREFAST_)
+
+__analysis_noreturn
+FORCEINLINE
+VOID
+DbgRaiseAssertionFailure (
+ VOID
+ )
+
+{
+ __asm int 0x2c
+}
+
+#endif // !defined(_PREFAST_)
+
+#pragma warning( pop )
+
+#endif // _MSC_FULL_VER >= 140030222
+
+#endif // defined(_M_IX86)
+
+#elif defined(_IA64_)
+
+#if defined(_M_IA64)
+
+void
+__break(
+ _In_ int StIIM
+ );
+
+#pragma intrinsic (__break)
+
+#define BREAK_DEBUG_BASE 0x080000
+#define ASSERT_BREAKPOINT (BREAK_DEBUG_BASE+3) // Cause a STATUS_ASSERTION_FAILURE exception to be raised.
+
+#if !defined(_PREFAST_)
+
+#define DbgRaiseAssertionFailure() __break(ASSERT_BREAKPOINT)
+
+#endif // !defined(_PREFAST_)
+
+#endif // defined(_M_IA64)
+
+#elif defined(_ARM_)
+
+#if defined(_M_ARM)
+
+VOID
+__emit(
+ const unsigned __int32 opcode
+ );
+
+#pragma intrinsic(__emit)
+
+#if !defined(_PREFAST_)
+
+#define DbgRaiseAssertionFailure() __emit(0xdefc) // THUMB_ASSERT
+
+#endif // !defined(_PREFAST_)
+
+#endif // defined(_M_ARM)
+
+#endif // _AMD64_, _X86_, _IA64_, _ARM_
+#endif // !defined(_DBGRAISEASSERTIONFAILURE_) && !defined(RC_INVOKED) && !defined(MIDL_PASS)
+
+#ifdef __cplusplus
+}
+#endif
+
+// end_wdm end_winnt end_ntminiport
+
+// begin_wdm begin_ntminiport
+
+#if _MSC_VER >= 1300
+#if DBG
+
+#define NT_ASSERT(_exp) \
+ ((!(_exp)) ? \
+ (__annotation(L"Debug", L"AssertFail", L#_exp), \
+ DbgRaiseAssertionFailure(), FALSE) : \
+ TRUE)
+
+#define NT_ASSERTMSG(_msg, _exp) \
+ ((!(_exp)) ? \
+ (__annotation(L"Debug", L"AssertFail", L##_msg), \
+ DbgRaiseAssertionFailure(), FALSE) : \
+ TRUE)
+
+#define NT_ASSERTMSGW(_msg, _exp) \
+ ((!(_exp)) ? \
+ (__annotation(L"Debug", L"AssertFail", _msg), \
+ DbgRaiseAssertionFailure(), FALSE) : \
+ TRUE)
+
+#define NT_VERIFY NT_ASSERT
+#define NT_VERIFYMSG NT_ASSERTMSG
+#define NT_VERIFYMSGW NT_ASSERTMSGW
+
+#else // DBG
+
+#define NT_ASSERT(_exp) ((void) 0)
+#define NT_ASSERTMSG(_msg, _exp) ((void) 0)
+#define NT_ASSERTMSGW(_msg, _exp) ((void) 0)
+
+#define NT_VERIFY(_exp) ((_exp) ? TRUE : FALSE)
+#define NT_VERIFYMSG(_msg, _exp ) ((_exp) ? TRUE : FALSE)
+#define NT_VERIFYMSGW(_msg, _exp) ((_exp) ? TRUE : FALSE)
+
+#endif // DBG
+#endif // _MSC_VER >= 1300
+
+// end_wdm end_ntminiport
+
+#define WIN_ASSERT NT_ASSERT
+#define WIN_ASSERTMSG NT_ASSERTMSG
+#define WIN_ASSERTMSGW NT_ASSERTMSGW
+#define WIN_VERIFY NT_VERIFY
+#define WIN_VERIFYMSG NT_ASSERTMSG
+#define WIN_VERIFYMSGW NT_ASSERTMSGW
+
diff --git a/src/inc/winrt/paraminstanceapi.h b/src/inc/winrt/paraminstanceapi.h
new file mode 100644
index 0000000000..062c7f3d08
--- /dev/null
+++ b/src/inc/winrt/paraminstanceapi.h
@@ -0,0 +1,1749 @@
+// 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.
+
+/***************************************************************
+
+*
+* Portions of this header fall under the following
+* copyrights and/or licenses:
+*
+* rfc4122 and supporting functions
+* * Algorithm from RFC 4122 - A Universally Unique IDentifier (UUID) URN Namespace
+* * By Paul J. Leach, Michael Mealling and Rich Sals, July 2005.
+* *
+* * This function is adapted from the routines in the document
+* * uuid_create_sha1_from_name and format_uuid_v3or5
+* *
+* *
+* * Copyright (c) 1990- 1993, 1996 Open Software Foundation, Inc.
+* * Copyright (c) 1989 by Hewlett-Packard Company, Palo Alto, Ca. &
+* * Digital Equipment Corporation, Maynard, Mass.
+* * Copyright (c) 1998 Microsoft.
+* * To anyone who acknowledges that this file is provided "AS IS"
+* * without any express or implied warranty: permission to use, copy,
+* * modify, and distribute this file for any purpose is hereby
+* * granted without fee, provided that the above copyright notices and
+* * this notice appears in all source code copies, and that none of
+* * the names of Open Software Foundation, Inc., Hewlett-Packard
+* * Company, Microsoft, or Digital Equipment Corporation be used in
+* * advertising or publicity pertaining to distribution of the software
+* * without specific, written prior permission. Neither Open Software
+* * Foundation, Inc., Hewlett-Packard Company, Microsoft, nor Digital
+* * Equipment Corporation makes any representations about the
+* * suitability of this software for any purpose.
+* *
+*/
+
+#ifdef _MSC_VER
+#pragma once
+#endif /* _MSC_VER */
+
+#ifndef WINRT_PARAMINSTANCEAPI_H
+#define WINRT_PARAMINSTANCEAPI_H
+
+#ifdef __cplusplus
+
+#ifdef _MSC_VER
+#pragma warning( push )
+#pragma warning( disable : 4180 ) // qualifier applied to function type has no meaning; ignored
+#endif
+
+#include <wtypes.h>
+#include <ntassert.h>
+#include <sal.h>
+#include <stdlib.h>
+#include <string.h>
+#include <objbase.h>
+#include <limits.h>
+
+//#ifdef _MSC_VER
+//#include <new.h>
+//#else
+//#include <new>
+//#endif
+
+#ifndef WINRT_PARAMINSTANCE_NOCRYPT_SHA1
+#include <bcrypt.h>
+#endif
+
+#ifdef _MSC_VER
+#pragma push_macro("CHKHR")
+#pragma push_macro("CHKNT")
+#endif
+
+namespace Ro { namespace detail {
+
+ //
+ // Debugging aide. Set breakpoint on _FailedHR
+ // to see HRESULT propagation.
+ //
+ #ifdef DEBUG
+ inline HRESULT __declspec(noinline) _FailedHR(HRESULT hr) { static HRESULT _hr = hr; return hr; }
+ #else
+ inline HRESULT _FailedHR(HRESULT hr) { return hr; }
+ #endif
+}}
+
+#undef CHKHR
+//
+// Call HRESULT returning code and propagate any errors.
+// Note: only use in code that is exception-safe / uses RAII.
+//
+#define CHKHR(expr) \
+ { HRESULT _zzhr; \
+ _zzhr = expr; \
+ if (FAILED(_zzhr)) return Ro::detail::_FailedHR(_zzhr); }
+
+#undef CHKNT
+//
+// Call NTSTATUS returning code and propagate any errors, as HRESULTs.
+// Note:
+// - only use in code that is exception-safe / uses RAII / RRID.
+// - HRESULT_FROM_NT does safely convert STATUS_SUCCESS into
+// a SUCCEEDED hr.
+//
+#define CHKNT(expr) \
+ CHKHR( HRESULT_FROM_NT( expr ) )
+
+namespace Ro { namespace detail {
+
+ //
+ // Runtime check for an invariant. This check executes in release builds.
+ //
+
+ inline HRESULT Verify(bool invariant, HRESULT defaultHr = E_UNEXPECTED)
+ {
+ if (!invariant)
+ {
+ CHKHR(defaultHr);
+ }
+ return S_OK;
+ }
+}}
+
+
+extern "C" {
+
+
+// sha1 adaptor
+// create hash instance
+
+HRESULT _RoSha1Create(
+ __out void** handle);
+
+
+// sha1 adaptor
+// append more data to the input stream
+
+HRESULT _RoSha1AppendData(
+ __in void* handle,
+ __in size_t numBytes,
+ __in_bcount(numBytes) const void* data);
+
+
+// sha1 adaptor
+// return the first 16 bytes of SHA1 hash
+
+HRESULT _RoSha1Finish(
+ __in void* handle,
+ __out BYTE (*hashValue)[20]);
+
+
+// sha1 adaptor
+// free this instance
+
+void _RoSha1Release(__in void* handle);
+
+}
+
+struct IRoSimpleMetaDataBuilder;
+struct IRoMetaDataLocator;
+
+// The 'detail' namespace includes implementation details that
+// are subject to change without notice.
+namespace Ro { namespace detail
+{
+ struct SimpleMetaDataBuffer;
+}}
+
+
+//
+// Purpose:
+// Given a parameterized type instance name and metadata,
+// computes the IID for that instance.
+//
+// Parameters:
+//
+// nameElementCount
+// number of elements in nameElements
+// nameElements
+// a parsed WinRt type name, as would be returned by RoParseTypeName.
+// Eg: ["W.F.C.IVector`1", "N1.N2.IFoo"]
+// metaDataLocator
+// A callback to use for resolving metadata.
+//
+// An implementation could, for example, forward all calls
+// to RoGetMetaData, then passing the results to
+// RoWriteImporterToPushSimpleMetaData. As RoGetMetadata does
+// not cache results, such an implementation would be inefficient.
+// A better implementation will cache the results to RoGetMetaData,
+// as appropriate.
+//
+// The Locator helper function can be used to wrap a lambda
+// expression, or function pointer. eg:
+// RoGetParameterizedTypeInstanceIID(
+// ...,
+// Locate([&](PCWSTR* name, IRoSimpleMetaDataBuilder& push){...}),
+// ...);
+// iid
+// out param. Returns the iid for the parameterized type specified
+// by nameElements
+// extra
+// out param. returns a handle that holds extra information about the
+// IID result, for diagnostic purposes. If this handle is not desired,
+// provide nullptr instead.
+//
+// Notes:
+// - This function is stateless. IRoMetaDataLocator will not be preserved
+// between calls.
+// - This function does not perform deep semantic analysis. For instance,
+// if IRoSimpleMetaDataBuilder specifies that a struct contains an interface pointer,
+// this API will return success, even though such metadata is semantically
+// invalid. The value of the IID returned is unspecified in such cases.
+// - This function does introduce reentrancy. Its implementation
+// of IRoSimpleMetaDataBuilder may make reentrant calls to IRoMetaDataLocator.
+// - If a call to IRoSimpleMetaDataBuilder fails, this function will return that
+// failure code.
+//
+
+
+DECLARE_HANDLE(ROPARAMIIDHANDLE);
+
+inline HRESULT RoGetParameterizedTypeInstanceIID(
+ UINT32 nameElementCount,
+ __in_ecount(nameElementCount) PCWSTR* nameElements,
+ __in const IRoMetaDataLocator& metaDataLocator,
+ __out GUID* iid,
+ __deref_opt_out ROPARAMIIDHANDLE* pExtra = nullptr);
+
+// Frees the 'extra' handle allocated
+// by RoGetParameterizedTypeInstanceIID
+inline void RoFreeParameterizedTypeExtra(__in ROPARAMIIDHANDLE extra);
+
+// Fetches the TypeSignature used to compute the IID by the last
+// call to RoGetParameterizedTypeInstanceIID on this extra handle.
+// The string contains ASCII code only, and the string is valid
+// until RoFreeParameterizedTypeExtra is called on the extra pointer.
+inline PCSTR RoParameterizedTypeExtraGetTypeSignature(__in ROPARAMIIDHANDLE extra);
+
+namespace Ro { namespace detail
+{
+
+ // private type used in helper function
+
+ template <typename Fn>
+ struct _Locator;
+}} // namespace Ro::detail
+
+namespace Ro
+{
+
+ // helper function to create IRoMetaDataLocator from lambda expression
+
+ template <typename Fn>
+ Ro::detail::_Locator<Fn> Locator(const Fn& fn);
+} // namespace Ro
+
+
+//
+// Purpose:
+// Destination for IRoMetaDataLocator::Locate to write parsed metadata to.
+// 'Locate' should set the appropriate Windows Runtime metadata information gleaned
+// from Windows Runtime metadata file, or other appropriate source.
+//
+// Notes:
+// - Methods for base types and COM interfaces (eg, Int32 and IInspectable
+// respectively) are not needed -- RoGetParameterizedTypeInstanceIID already
+// knows the WinRT base type names, so will not invoke IMetDataLocator
+// to discover them.
+// - This is not a COM interface. It does not derive from IUnknown.
+//
+
+struct IRoSimpleMetaDataBuilder
+{
+
+ // Notes:
+ // IInspectable and other non-WinRT interfaces are not permissible.
+ // Not for use with parameterized type instances. See SetParameterizedInterface
+
+ STDMETHOD(SetWinRtInterface)(
+ GUID iid) = 0;
+
+
+ // Notes:
+ // Not for use with parameterized type instances. See SetParameterizedDelegate
+
+ STDMETHOD(SetDelegate)(
+ GUID iid) = 0;
+
+
+ // Notes:
+ // Call this method when an interface group has a default interface
+ // that is a non-parametric type.
+
+ STDMETHOD(SetInterfaceGroupSimpleDefault)(
+ PCWSTR name,
+ PCWSTR defaultInterfaceName,
+ __in_opt const GUID* defaultInterfaceIID) = 0;
+
+
+ // Notes:
+ // Call this method when an interface group has a parameterized
+ // interface as its default interface.
+
+ STDMETHOD(SetInterfaceGroupParameterizedDefault)(
+ PCWSTR name,
+ UINT32 elementCount,
+ __in_ecount(elementCount) PCWSTR* defaultInterfaceNameElements) = 0;
+
+ STDMETHOD(SetRuntimeClassSimpleDefault)(
+ PCWSTR name,
+ PCWSTR defaultInterfaceName,
+ __in_opt const GUID* defaultInterfaceIID) = 0;
+
+ STDMETHOD(SetRuntimeClassParameterizedDefault)(
+ PCWSTR name,
+ UINT32 elementCount,
+ __in_ecount(elementCount) PCWSTR* defaultInterfaceNameElements) = 0;
+
+ STDMETHOD(SetStruct)(
+ PCWSTR name,
+ UINT32 numFields,
+ __in_ecount(numFields) PCWSTR* fieldTypeNames) = 0;
+
+ STDMETHOD(SetEnum)(
+ PCWSTR name,
+ PCWSTR baseType) = 0;
+
+
+ // Notes:
+ // This is only for the 'non-instantiated' parameterized interface itself -
+ // instances are handled by RoGetParameterizedTypeInstanceIID, and the
+ // caller need not parse them.
+
+ STDMETHOD(SetParameterizedInterface)(
+ GUID piid,
+ UINT32 numArgs) = 0;
+
+ STDMETHOD(SetParameterizedDelegate)(
+ GUID piid,
+ UINT32 numArgs) = 0;
+};
+
+
+//
+// Purpose:
+// Callback for resolving metadata.
+//
+
+struct IRoMetaDataLocator
+{
+
+ //
+ // Parameters:
+ // nameElement
+ // a metadata typeref name to resolve.
+ // Eg: "N1.N2.IFoo", or "W.F.C.IVector`1".
+ // pushMetaData
+ // data sink for providing information about the
+ // type information for nameElement
+ //
+
+ STDMETHOD(Locate)(
+ PCWSTR nameElement,
+ __in IRoSimpleMetaDataBuilder& metaDataDestination
+ ) const = 0;
+};
+
+namespace Ro { namespace detail {
+
+
+ //
+ // helper function, moves range of elements
+ //
+
+ template <typename T>
+ void _VecMoveRange(
+ __in_ecount(size) T* dst,
+ __in_ecount(size) T* src,
+ size_t size)
+ {
+ for (size_t i = 0; i != size; ++i)
+ {
+ dst[i] = static_cast<T&&>(src[i]);
+ }
+ }
+
+ //
+ // specializations to move strings more efficiently
+ //
+
+ inline void _VecMoveRange(
+ __in_ecount(size) char* dst,
+ __in_ecount(size) char* src,
+ size_t size)
+ {
+ errno_t err = memcpy_s(dst, size*sizeof(*dst), src, size*sizeof(*dst));
+ NT_ASSERT(!err);
+ (void)err;
+ }
+ inline void _VecMoveRange(
+ __in_ecount(size) wchar_t* dst,
+ __in_ecount(size) wchar_t* src,
+ size_t size)
+ {
+ errno_t err = memcpy_s(dst, size*sizeof(*dst), src, size*sizeof(*dst));
+ NT_ASSERT(!err);
+ (void)err;
+ }
+
+
+ //
+ // helper function, moves range of elements
+ //
+
+ template <typename T>
+ void _VecCopyRange(
+ __in_ecount(size) T* dst,
+ __in_ecount(size) const T* src,
+ size_t size)
+ {
+ for (size_t i = 0; i != _size; ++i)
+ {
+ dst[i] = src[i];
+ }
+ }
+
+ //
+ // specializations to move strings more efficiently
+ //
+
+ inline void _VecCopyRange(
+ __in_ecount(size) char* dst,
+ __in_ecount(size) const char* src,
+ size_t size)
+ {
+ errno_t err = memcpy_s(dst, size*sizeof(*dst), const_cast<char*>(src), size*sizeof(*dst));
+ NT_ASSERT(!err);
+ (void)err;
+ }
+ inline void _VecCopyRange(
+ __in_ecount(size) wchar_t* dst,
+ __in_ecount(size) const wchar_t* src,
+ size_t size)
+ {
+ errno_t err = memcpy_s(dst, size*sizeof(*dst), const_cast<wchar_t*>(src), size*sizeof(*dst));
+ NT_ASSERT(!err);
+ (void)err;
+ }
+
+ //
+ // Single-owner smart pointer for arrays
+ //
+
+ template <class T>
+ struct ArrayHolder
+ {
+ ArrayHolder() : _value(NULL)
+ {
+ }
+ T* Value() const
+ {
+ return _value;
+ }
+ T*& Value()
+ {
+ return _value;
+ }
+ T* Detach()
+ {
+ T* tmp = _value;
+ _value = NULL;
+ return tmp;
+ }
+ ~ArrayHolder()
+ {
+ delete[] _value;
+ }
+
+ private:
+ T* _value;
+ };
+
+ //
+ // Single-owner smart pointer for object pointer
+ //
+
+ template <class T>
+ struct ElementHolder
+ {
+ ElementHolder() : _value(NULL)
+ {
+ }
+ T* operator->() const
+ {
+ return _value;
+ }
+ T* Value() const
+ {
+ return _value;
+ }
+ T*& Value()
+ {
+ return _value;
+ }
+ T* Detach()
+ {
+ T* tmp = _value;
+ _value = NULL;
+ return tmp;
+ }
+ ~ElementHolder()
+ {
+ delete _value;
+ }
+
+ private:
+ T* _value;
+ };
+
+
+
+ //
+ // simple vector, with small vector optimization
+ // T - must be default constructable and movable.
+ // const input overload of AppendN requires copyable.
+ // FixedBufSize - number of bytes to use for small array
+ // optimization, to avoid heap allocation in case of
+ // small vectors. Defaults to at least one element,
+ // otherwise the largest value such that <= 64 bytes
+ // are used.
+ //
+
+ template <
+ typename T,
+ size_t FixedBufSize = 0
+ >
+ class Vec
+ {
+ private:
+ static const size_t _fixedBufSize =
+ FixedBufSize/sizeof(T)
+ ? FixedBufSize/sizeof(T)
+ : (((64/sizeof(T)) > 0) ? (64/sizeof(T))
+ : 1);
+ public:
+ Vec() :
+ _size(0),
+ _cap(_countof(_fixedBuf)),
+ _buf(_fixedBuf)
+ {
+ }
+
+
+ // Appends an element, or a default value if one
+ // it not specified. If called with an rvalue,
+ // it uses move assignment instead of copy.
+
+ HRESULT Append(T value = T())
+ {
+ if (_cap - _size < 1)
+ {
+ CHKHR(_Grow());
+ }
+ _buf[_size] = static_cast<T&&>(value);
+ ++_size;
+
+ return S_OK;
+ }
+
+ // Moves elements (move assignment) into array.
+
+ HRESULT MoveN(__in_ecount(n) T* values, size_t n)
+ {
+ if (_cap - _size < n)
+ {
+ CHKHR(_Grow(n - (_cap - _size)));
+ }
+ _VecMoveRange(_buf + _size, values, n);
+ _size += n;
+
+ return S_OK;
+ }
+
+
+ // Appends elements. Does not invoke move assignment.
+
+ HRESULT AppendN(__in_ecount(n) const T* values, size_t n)
+ {
+ if (_cap - _size < n)
+ {
+ CHKHR(_Grow(n - (_cap - _size)));
+ }
+ _VecCopyRange(_buf + _size, values, n);
+ _size += n;
+
+ return S_OK;
+ }
+
+ HRESULT Pop()
+ {
+ CHKHR(Verify( _size > 0 ));
+ --_size;
+ return S_OK;
+ }
+
+ HRESULT Resize(size_t newSize)
+ {
+ if (_cap < newSize)
+ {
+ CHKHR(_Grow(newSize - _cap));
+ }
+ _size = newSize;
+ return S_OK;
+ }
+
+ size_t Size() const
+ {
+ return _size;
+ }
+
+ T& operator[](size_t index)
+ {
+ NT_ASSERT(index < _size);
+ return _buf[index];
+ }
+
+ T& Last()
+ {
+ return (*this)[_size-1];
+ }
+
+ ~Vec()
+ {
+ if (_buf != _fixedBuf)
+ {
+ delete[] _buf;
+ }
+ }
+
+ private:
+
+ //
+ // growth factor (does not check for overflow) -- returns amount to grow by
+ //
+
+ static size_t _GrowthIncrement(size_t n)
+ {
+ return n / 2;
+ }
+
+ HRESULT _Grow(size_t byAtLeast = 4)
+ {
+ size_t increase = _GrowthIncrement(_cap);
+ if (increase < byAtLeast)
+ {
+ increase = byAtLeast;
+ }
+ size_t newCap = _cap + increase;
+ if (newCap <= _cap)
+ {
+ CHKHR(E_OUTOFMEMORY);
+ }
+ ArrayHolder<T> newBuf;
+
+ void* p = (newBuf.Value() = new (std::nothrow) T[newCap]);
+ if (!p)
+ {
+ CHKHR(E_OUTOFMEMORY);
+ }
+
+ _VecMoveRange( newBuf.Value(), _buf, _size );
+
+ if (_buf != _fixedBuf)
+ {
+ delete _buf;
+ }
+ _buf = newBuf.Detach();
+ _cap = newCap;
+
+ return S_OK;
+ }
+
+ size_t _size;
+ size_t _cap;
+ T* _buf;
+ T _fixedBuf[_fixedBufSize];
+ };
+
+ struct SimpleMetaDataBuilder : IRoSimpleMetaDataBuilder
+ {
+ public:
+ SimpleMetaDataBuilder(SimpleMetaDataBuffer& buffer, const IRoMetaDataLocator& locator)
+ : _buffer(&buffer), _locator(&locator), _invoked(false)
+ {
+ }
+ IFACEMETHOD(SetWinRtInterface)(GUID iid);
+ IFACEMETHOD(SetDelegate)(GUID iid);
+ IFACEMETHOD(SetInterfaceGroupSimpleDefault)(PCWSTR name, PCWSTR defaultInterfaceName, __in_opt const GUID *defaultInterfaceIID);
+ IFACEMETHOD(SetInterfaceGroupParameterizedDefault)(PCWSTR name, UINT32 elementCount, __in_ecount(elementCount) PCWSTR *defaultInterfaceNameElements);
+ IFACEMETHOD(SetRuntimeClassSimpleDefault)(PCWSTR name, PCWSTR defaultInterfaceName, __in_opt const GUID *defaultInterfaceIID);
+ IFACEMETHOD(SetRuntimeClassParameterizedDefault)(PCWSTR name, UINT32 elementCount, __in_ecount(elementCount) PCWSTR *defaultInterfaceNameElements);
+ IFACEMETHOD(SetStruct)(PCWSTR name, UINT32 numFields, __in_ecount(numFields) PCWSTR *fieldTypeNames);
+ IFACEMETHOD(SetEnum)(PCWSTR name, PCWSTR baseType);
+ IFACEMETHOD(SetParameterizedInterface)(GUID piid, UINT32 numArgs);
+ IFACEMETHOD(SetParameterizedDelegate)(GUID piid, UINT32 numArgs);
+
+
+ // Runs the locating process for a parameterized type.
+ // Notes:
+ // _buffer->_nestingLevel is used to determine the number of
+ // arguments left to consume for nested parameterized types.
+
+ HRESULT SendArguments(UINT32 nameElementCount, __in_ecount(nameElementCount) PCWSTR *nameElements);
+
+ private:
+
+
+ // Writes the type signature for the type 'name'
+ // Notes:
+ // - If a builtin type, writes the type directly.
+ // - Otherwise, uses the IRoMetaDataLocator to
+ // write the type signature into _buffer
+ // - As the sole function to call
+ // IRoMetaDataLocator, it also performs the check
+ // on recursion depth bounds.
+
+ HRESULT _WriteType(PCWSTR name);
+
+
+ // The tail portion of IG and RC formats is the same. This
+ // function implements the shared portion of that format.
+
+ HRESULT _CommonInterfaceGroupSimple(PCWSTR name, PCWSTR defaultInterfaceName, __in_opt const GUID *defaultInterfaceIID);
+
+
+ // Called at the beginning of every 'Set' method. Set must only be called once.
+
+ HRESULT _OnSet();
+
+
+ // Called at the end of every 'Set' method, only if successful.
+
+ void _Completed();
+
+ static char _AsciiLower(char ch)
+ {
+ if ('A' <= ch && ch <= 'Z')
+ {
+ return ch + ('a' - 'A');
+ }
+ else
+ {
+ return ch;
+ }
+ }
+
+
+ // Writes a guid into the type signature being built, in lower case.
+
+ HRESULT _WriteGuid(const GUID& iid);
+ HRESULT _WriteString(PCSTR str);
+ HRESULT _WriteChar(char c);
+ HRESULT _WriteWideString(PCWSTR str);
+
+ SimpleMetaDataBuilder();
+ SimpleMetaDataBuilder(const SimpleMetaDataBuilder&);
+ void operator=(const SimpleMetaDataBuilder&);
+
+ SimpleMetaDataBuffer* _buffer;
+ const IRoMetaDataLocator* _locator;
+ bool _invoked;
+ };
+
+
+ // If the type string describes a built-in type, modifies
+ // this instance to use builtin type table entry instead of name.
+
+ inline bool _IsBuiltin(__in PCWSTR name, __out PCSTR * typeSignature)
+ {
+ *typeSignature = nullptr;
+
+ struct BuiltinEntry { PCWSTR name; PCSTR typeSignature; };
+ static const BuiltinEntry entries[] = {
+
+ { L"UInt8", "u1" },
+ { L"Int16", "i2" },
+ { L"UInt16", "u2" },
+ { L"Int32", "i4" },
+ { L"UInt32", "u4" },
+ { L"Int64", "i8" },
+ { L"UInt64", "u8" },
+ { L"Single", "f4" },
+ { L"Double", "f8" },
+ { L"Boolean", "b1" },
+ { L"Char16", "c2" },
+ { L"String", "string" },
+ { L"Guid", "g16" },
+ { L"Object", "cinterface(IInspectable)" },
+ };
+ for (const BuiltinEntry* tip = entries;
+ tip != &entries[_countof(entries)];
+ ++tip)
+ {
+ if (wcscmp(tip->name, name) == 0)
+ {
+ *typeSignature = tip->typeSignature;
+ return true;
+ }
+ }
+
+ // if not found, assume is a normal type name
+
+ return false;
+ }
+
+
+ // Linked list (stack allocated) of type resolution calls,
+ // used to detect if an InterfaceGroup/RuntimeClass type
+ // signature depends on itself. In that case, we use "*"
+ // in the type signature instead of recurring further.
+
+ struct ResolutionPathEntry
+ {
+ ResolutionPathEntry* _next;
+ PCWSTR _typeName;
+
+ ResolutionPathEntry(PCWSTR typeName)
+ : _next(nullptr)
+ , _typeName(typeName)
+ {
+ }
+ };
+
+ inline void Push(ResolutionPathEntry*& top, ResolutionPathEntry* item)
+ {
+ item->_next = top;
+ top = item;
+ }
+ inline HRESULT Pop(ResolutionPathEntry*& top)
+ {
+ if (!top)
+ {
+ return E_UNEXPECTED;
+ }
+ top = top->_next;
+ return S_OK;
+ }
+
+
+ // Holds metadata state that is shared between RoGetParamInstanceIID and SimpleMetaDataBuilder
+
+ struct SimpleMetaDataBuffer
+ {
+ SimpleMetaDataBuffer()
+ {
+ Clear();
+ }
+
+ // reset all tables
+ void Clear()
+ {
+ _recursionDepth = 0;
+ _topLevelTypes = 0;
+ _resolutionPath = nullptr;
+ _outputStream.Resize(0);
+ }
+
+ static const size_t _maxTypeName = 256;
+
+
+ // Estimate of 'reasonable' level of Interface Group / Runtime
+ // Class / Parameterized Type nesting.
+
+ static const size_t _maxRecursionDepth = 64;
+
+ Vec<char, _maxTypeName> _outputStream;
+ ResolutionPathEntry* _resolutionPath;
+
+
+ // RAII object, places an item on the resolution path, and pops it on destruction
+
+ class ResolutionPathGuard
+ {
+ private:
+ ResolutionPathEntry _entry;
+ SimpleMetaDataBuffer* _buffer;
+
+ public:
+ ResolutionPathGuard(PCWSTR typeName, SimpleMetaDataBuffer* buffer)
+ : _buffer(buffer)
+ , _entry(typeName)
+ {
+ Push(buffer->_resolutionPath, &_entry);
+ }
+ ~ResolutionPathGuard()
+ {
+ HRESULT hr = Pop(_buffer->_resolutionPath);
+ NT_ASSERT(SUCCEEDED(hr));
+ (void)hr;
+ }
+ };
+
+
+ // Searches the resolution path for 'name' returning true if exists
+
+ bool ExistsCycle(PCWSTR typeName)
+ {
+ for (auto pTip = _resolutionPath; pTip; pTip = pTip->_next)
+ {
+ if (wcscmp(typeName, pTip->_typeName) == 0)
+ {
+ return true;
+ }
+ }
+ return false;
+ }
+
+
+ // Indicates the nesting level of compound types, used
+ // to properly balance parenthesis on parameterized types,
+ // and used to bound recursion depth.
+ //
+ // - Pinterfaces
+ // : push 'numArgs' on to _nestingLevel
+ // - A compound type that doesn't know number of arguments
+ // eg, RoGetParameterizedInstanceIID arguments, or
+ // SetIG..Parameterized
+ // : will 0) note nesting level
+ // 1) iterate calling Locate on the compound arguments.
+ // 2) the above should cause exactly one push of _nestingLevel
+ // 3) reduce nesting level back to original nesting level,
+ // inserting the difference in closing parens
+ // - Compound types that do know number of arguments (eg SetStruct)
+ // : will 1) increase nesting level by 1
+ // 2) iterate calling Locate on arguments
+ // 3) decrease nesting level again
+ //
+ //
+
+ Vec<size_t> _nestedArgs;
+
+ // topLevelTypes should be incremented once, by the initial
+ // parameterized type, then never again.
+
+ size_t _topLevelTypes;
+ size_t _recursionDepth;
+ };
+}} // namespace Ro::detail
+
+namespace Ro { namespace detail
+{
+ template <typename Fn>
+ struct _Locator : IRoMetaDataLocator
+ {
+ Fn _fn;
+
+ _Locator(const Fn& fn)
+ : _fn(fn)
+ {
+ }
+
+ IFACEMETHOD(Locate)(
+ PCWSTR name,
+ IRoSimpleMetaDataBuilder& pushMetaData) const
+ {
+ return _fn(name, pushMetaData);
+ }
+ };
+}} // namespace Ro::detail
+
+namespace Ro
+{
+ template <typename Fn>
+ Ro::detail::_Locator<Fn> Locator(const Fn& fn)
+ {
+ return Ro::detail::_Locator<Fn>(fn);
+ }
+}
+
+namespace Ro { namespace detail
+{
+
+ // Figure out if we're compiling for a big- or little-endian machine.
+
+ inline bool BigEndian()
+ {
+ unsigned long n = 0xff000000L;
+
+ return 0 != *reinterpret_cast<unsigned char *>(&n);
+ }
+
+
+ // HostToNetworkLong converts a 32-bit long to network byte order
+
+ inline ULONG HostToNetworkLong(ULONG hostlong)
+ {
+ if (BigEndian())
+ return hostlong;
+ else
+ return ( (hostlong >> 24) & 0x000000FFL) |
+ ( (hostlong >> 8) & 0x0000FF00L) |
+ ( (hostlong << 8) & 0x00FF0000L) |
+ ( (hostlong << 24) & 0xFF000000L);
+ }
+
+
+ // HostToNetworkLong converts a 16-bit short to network byte order
+
+ inline USHORT HostToNetworkShort(USHORT hostshort)
+ {
+ if (BigEndian())
+ return hostshort;
+ else
+ return ((hostshort >> 8) & 0x00FF) | ((hostshort << 8) & 0xFF00);
+ }
+
+
+ // NetworkToHostLong converts a 32-bit long to local host byte order
+
+ inline ULONG NetworkToHostLong(ULONG netlong)
+ {
+ if (BigEndian())
+ return netlong;
+ else
+ return ( (netlong >> 24) & 0x000000FFL) |
+ ( (netlong >> 8) & 0x0000FF00L) |
+ ( (netlong << 8) & 0x00FF0000L) |
+ ( (netlong << 24) & 0xFF000000L);
+ }
+
+
+ // NetworkToHostShort converts a 16-bit short to local host byte order
+
+ inline USHORT NetworkToHostShort(USHORT netshort)
+ {
+ if (BigEndian())
+ return netshort;
+ else
+ return ((netshort >> 8) & 0x00FF) | ((netshort << 8) & 0xFF00);
+ }
+
+
+ // smart pointer for Sha1 handle
+
+ struct Sha1Holder
+ {
+ Sha1Holder() : _handle(nullptr)
+ {
+ }
+ void*& Value()
+ {
+ return _handle;
+ }
+ ~Sha1Holder()
+ {
+ if (_handle)
+ {
+ _RoSha1Release(_handle);
+ }
+ }
+ private:
+ void* _handle;
+ };
+
+
+
+ //
+ // Computes the rfc4122 v5 UUID from GUID,name pair.
+ //
+ // Notes:
+ // - see copyright at beginning of file.
+ //
+
+ inline HRESULT
+ GuidFromName(
+ __in const GUID& guidNamespace,
+ __in_bcount(dwcbSize) const void* pbName,
+ __in DWORD dwcbSize,
+ __out GUID* pGuid)
+ {
+ Sha1Holder sha1;
+
+ CHKHR( _RoSha1Create(&sha1.Value()) );
+ {
+ GUID networkOrderGuidNamespace = guidNamespace;
+
+ // Put name space ID in network byte order so it hashes the same
+ // no matter what endian machine we're on
+
+ if (!BigEndian())
+ {
+ networkOrderGuidNamespace.Data1 = HostToNetworkLong (networkOrderGuidNamespace.Data1);
+ networkOrderGuidNamespace.Data2 = HostToNetworkShort(networkOrderGuidNamespace.Data2);
+ networkOrderGuidNamespace.Data3 = HostToNetworkShort(networkOrderGuidNamespace.Data3);
+ }
+ CHKHR( _RoSha1AppendData(sha1.Value(), sizeof(networkOrderGuidNamespace), reinterpret_cast<BYTE*>(&networkOrderGuidNamespace)) );
+ }
+ CHKHR( _RoSha1AppendData(sha1.Value(), dwcbSize, pbName) );
+
+ {
+ BYTE sha1Result[20];
+ CHKHR( _RoSha1Finish(sha1.Value(), &sha1Result) );
+
+ errno_t err = memcpy_s(pGuid, sizeof(GUID), &sha1Result[0], sizeof(GUID));
+ CHKHR(Verify( 0 == err ));
+
+
+ // Restore the byte order
+
+ if (!BigEndian())
+ {
+ pGuid->Data1 = NetworkToHostLong (pGuid->Data1);
+ pGuid->Data2 = NetworkToHostShort(pGuid->Data2);
+ pGuid->Data3 = NetworkToHostShort(pGuid->Data3);
+ }
+
+
+ // set version number
+ // 1: clear version number nibble
+ // 2: set version 5 = name-based SHA1
+
+ pGuid->Data3 &= 0x0FFF;
+ pGuid->Data3 |= (5 << 12);
+
+
+ // set variant field by clearing variant bits.
+
+ pGuid->Data4[0] &= 0x3F;
+ pGuid->Data4[0] |= 0x80;
+ }
+ return S_OK;
+ }
+}} // namespace Ro::detail
+
+inline HRESULT RoGetParameterizedTypeInstanceIID(
+ UINT32 nameElementCount,
+ __in_ecount(nameElementCount) PCWSTR* nameElements,
+ __in const IRoMetaDataLocator& metaDataLocator,
+ __out GUID* iid,
+ __deref_opt_out ROPARAMIIDHANDLE* pExtra)
+{
+ using namespace Ro::detail;
+ memset(iid, 0, sizeof(*iid));
+
+ SimpleMetaDataBuffer reserveBuffer;
+ SimpleMetaDataBuffer *pBuffer = &reserveBuffer;
+
+ // if user wishes to hold on to the result value,
+ // dynamically allocate this buffer.
+ if (pExtra)
+ {
+ pBuffer = new (std::nothrow) SimpleMetaDataBuffer;
+ *pExtra = static_cast<ROPARAMIIDHANDLE>(static_cast<void*>(pBuffer));
+ }
+ SimpleMetaDataBuffer& buffer = *pBuffer;
+ SimpleMetaDataBuilder builder(*pBuffer, metaDataLocator);
+
+ // send initial arguments
+ CHKHR(builder.SendArguments(nameElementCount, nameElements));
+
+ // verify that precisely one type was resolved, to completion.
+ CHKHR(Verify(buffer._topLevelTypes == 1
+ && buffer._nestedArgs.Size() == 0,
+ E_INVALIDARG));
+
+ // compute type signature hash
+ static const GUID guidPinterfaceNamespace
+ = { 0x11f47ad5, 0x7b73, 0x42c0, { 0xab, 0xae, 0x87, 0x8b, 0x1e, 0x16, 0xad, 0xee }};
+
+ CHKHR(Ro::detail::Verify( buffer._outputStream.Size() <= DWORD(-1) ));
+
+ // null terminate
+ CHKHR( buffer._outputStream.Append('\0') );
+
+
+ //
+ // Unit test logging, to verify proper signatures
+ //
+ #ifdef UNITTEST_TRACE
+ {
+ CHKHR( UNITTEST_TRACE("type signature", &buffer._outputStream[0]) );
+ }
+ #endif
+
+
+ CHKHR( GuidFromName(guidPinterfaceNamespace,
+ &buffer._outputStream[0],
+ DWORD(buffer._outputStream.Size() - 1), // does not include terminator
+ iid) );
+ return S_OK;
+}
+
+inline void RoFreeParameterizedTypeExtra(__in ROPARAMIIDHANDLE extra)
+{
+ using namespace Ro::detail;
+ delete static_cast<SimpleMetaDataBuffer*>(static_cast<void*>(extra));
+}
+inline PCSTR RoParameterizedTypeExtraGetTypeSignature(__in ROPARAMIIDHANDLE extra)
+{
+ using namespace Ro::detail;
+ SimpleMetaDataBuffer* pBuffer = static_cast<SimpleMetaDataBuffer*>(static_cast<void*>(extra));
+
+ return &pBuffer->_outputStream[0];
+}
+
+namespace Ro { namespace detail
+{
+
+ inline HRESULT SimpleMetaDataBuilder::_WriteType(PCWSTR name)
+ {
+ PCSTR builtInName = nullptr;
+ SimpleMetaDataBuilder builder(*_buffer, *_locator);
+
+ if (_IsBuiltin(name, &builtInName))
+ {
+ CHKHR(builder._OnSet());
+ CHKHR(builder._WriteString(builtInName));
+ builder._Completed();
+ }
+ else
+ {
+ size_t newDepth = ++_buffer->_recursionDepth;
+ size_t pinterfaceNesting = _buffer->_nestedArgs.Size();
+ if (newDepth + pinterfaceNesting > _buffer->_maxRecursionDepth)
+ {
+
+ // Terminate recursion; bounds call stack consumption
+
+ CHKHR(E_UNEXPECTED);
+ }
+ CHKHR(_locator->Locate(name, builder));
+
+ // Note, buffers aren't reusable, so it's fine that we don't
+ // unwind this value on return. Also note, we do not unwind
+ // this value if the user provides inconsistent data either
+ // (eg, if they provide only 1 argument to a 2 parameter
+ // parameterized type).
+
+ --_buffer->_recursionDepth;
+ }
+ return S_OK;
+ }
+
+ inline HRESULT SimpleMetaDataBuilder::_OnSet()
+ {
+ if (_invoked)
+ {
+ CHKHR(E_INVALIDARG);
+ }
+ _invoked = true;
+
+
+ // Reduce the number of arguments left for this compound type.
+
+ if(_buffer->_nestedArgs.Size() > 0)
+ {
+ --(_buffer->_nestedArgs.Last());
+ }
+ else
+ {
+
+ // Increase number of top level types in signature
+ // string. (should never exceed one)
+
+ ++_buffer->_topLevelTypes;
+ }
+
+ return S_OK;
+ }
+
+ inline void SimpleMetaDataBuilder::_Completed()
+ {
+ }
+ inline HRESULT SimpleMetaDataBuilder::SendArguments(UINT32 nameElementCount, __in_ecount(nameElementCount) PCWSTR *nameElements)
+ {
+ CHKHR(Verify(nameElementCount > 0));
+
+ CHKHR(Verify(_buffer->_nestedArgs.Size() <= UINT32(-1)));
+ UINT32 previousLevel = UINT32(_buffer->_nestedArgs.Size());
+
+ for (UINT32 i = 0; i < nameElementCount; ++i)
+ {
+ CHKHR(_WriteType(nameElements[i]));
+
+
+ // Close any nested parameterized types that are complete
+
+ while (_buffer->_nestedArgs.Size() > previousLevel
+ && _buffer->_nestedArgs.Last() == 0)
+ {
+ CHKHR(_buffer->_nestedArgs.Pop());
+ CHKHR(_WriteChar(')'));
+ }
+
+ // insert separator between parameterized type arguments
+
+ CHKHR(_WriteChar(';'));
+ }
+
+ // remove final separator
+
+ CHKHR(_buffer->_outputStream.Pop());
+
+
+ // Verify that all the arguments were consumed.
+
+ CHKHR(Verify(_buffer->_nestedArgs.Size() == previousLevel,
+ E_INVALIDARG));
+ return S_OK;
+ }
+
+ inline HRESULT SimpleMetaDataBuilder::_WriteGuid(const GUID& iid)
+ {
+ static const size_t guidStringLength = _countof("{11223344-1122-1122-1122-334455667788}") - 1;
+ WCHAR tmpString[guidStringLength+1];
+
+ int numWritten = StringFromGUID2(iid, tmpString, guidStringLength + 1);
+ CHKHR(Verify( numWritten == guidStringLength + 1 ));
+ NT_ASSERT( numWritten == guidStringLength + 1 );
+
+ size_t offset = _buffer->_outputStream.Size();
+ CHKHR(Verify( offset + guidStringLength > offset ))
+ CHKHR( _buffer->_outputStream.Resize(offset + guidStringLength) );
+ char* writePtr = &_buffer->_outputStream[offset];
+
+
+ // All characters are ascii. Just truncate.
+
+ for(size_t i = 0; i < guidStringLength; ++i)
+ {
+ writePtr[i] = _AsciiLower(char(tmpString[i]));
+ }
+ return S_OK;
+ }
+ inline HRESULT SimpleMetaDataBuilder::_WriteString(PCSTR str)
+ {
+ CHKHR( _buffer->_outputStream.AppendN(str, strlen(str)) );
+ return S_OK;
+ }
+ inline HRESULT SimpleMetaDataBuilder::_WriteChar(char c)
+ {
+ CHKHR( _buffer->_outputStream.Append(c) );
+ return S_OK;
+ }
+ inline HRESULT SimpleMetaDataBuilder::_WriteWideString(PCWSTR str)
+ {
+ size_t len = wcslen(str);
+ size_t offset = _buffer->_outputStream.Size();
+ int written;
+
+
+ // provision enough space for conversion to take place
+
+ size_t provision = len + 1;
+ for(;;)
+ {
+ CHKHR( _buffer->_outputStream.Resize(offset+provision));
+ char* writePtr = &_buffer->_outputStream[offset];
+
+ CHKHR(Verify(len <= INT_MAX));
+ CHKHR(Verify(provision <= INT_MAX));
+
+ written = WideCharToMultiByte(
+ CP_UTF8,
+ 0,
+ str,
+ int(len),
+ writePtr,
+ int(provision),
+ nullptr,
+ nullptr
+ );
+
+ if (written > 0)
+ {
+ break;
+ }
+ else if (GetLastError() != ERROR_INSUFFICIENT_BUFFER)
+ {
+ CHKHR(HRESULT_FROM_WIN32(GetLastError()));
+ }
+ else
+ {
+ provision *= 2;
+ CHKHR(Verify( offset + provision > offset ));
+ }
+ }
+
+ // reduce size to reflect number of characters actually written.
+ // Note that since we specified string length, no null terminator
+ // was injected, so we don't have to remove it.
+
+ CHKHR( _buffer->_outputStream.Resize(offset+written) );
+
+ return S_OK;
+ }
+
+ inline __override HRESULT STDMETHODCALLTYPE SimpleMetaDataBuilder::SetWinRtInterface(
+ GUID iid)
+ {
+ CHKHR(_OnSet());
+
+ CHKHR(_WriteGuid(iid));
+
+ _Completed();
+ return S_OK;
+ }
+
+ inline __override HRESULT STDMETHODCALLTYPE SimpleMetaDataBuilder::SetDelegate(
+ GUID iid)
+ {
+ CHKHR(_OnSet());
+
+ CHKHR(_WriteString("delegate("));
+ CHKHR(_WriteGuid(iid));
+ CHKHR(_WriteChar(')'));
+
+ _Completed();
+ return S_OK;
+ }
+
+ inline HRESULT SimpleMetaDataBuilder::_CommonInterfaceGroupSimple(
+ PCWSTR name,
+ PCWSTR defaultInterfaceName,
+ __in_opt const GUID * defaultInterfaceIID)
+ {
+ CHKHR(_WriteWideString(name));
+ CHKHR(_WriteChar(';'));
+
+
+ // InterfaceGroups and RuntimeClasses take one nested argument
+
+ CHKHR(_buffer->_nestedArgs.Append(1));
+ if (!defaultInterfaceIID)
+ {
+ CHKHR(_WriteType(defaultInterfaceName));
+ }
+ else
+ {
+
+ // complete the type signature immediately; no nested
+ // call needed to resolve the interface.
+
+ SimpleMetaDataBuilder builder(*_buffer, *_locator);
+ CHKHR(builder.SetWinRtInterface(*defaultInterfaceIID))
+ }
+ CHKHR(_WriteChar(')'));
+ CHKHR(_buffer->_nestedArgs.Pop());
+ return S_OK;
+ }
+
+ inline __override HRESULT STDMETHODCALLTYPE SimpleMetaDataBuilder::SetInterfaceGroupSimpleDefault(
+ PCWSTR name,
+ PCWSTR defaultInterfaceName,
+ __in_opt const GUID* defaultInterfaceIID)
+ {
+ CHKHR(_OnSet());
+
+ CHKHR(_WriteString("ig("));
+ CHKHR(_CommonInterfaceGroupSimple(name, defaultInterfaceName, defaultInterfaceIID));
+
+ _Completed();
+ return S_OK;
+ }
+
+
+ inline __override HRESULT STDMETHODCALLTYPE SimpleMetaDataBuilder::SetInterfaceGroupParameterizedDefault(
+ PCWSTR name,
+ UINT32 elementCount,
+ __in_ecount(elementCount) PCWSTR* defaultInterfaceNameElements)
+ {
+ CHKHR(_OnSet());
+
+
+ // If an interface group or runtime class has a compound type as its default, and that
+ // type directly or indirectly refers to itself, the second occurrence instead used '*'
+ // to signal that the default interface has already been specified earlier up the call
+ // stack. This prevents unbounded recursion.
+
+ if (_buffer->ExistsCycle(name))
+ {
+ CHKHR( _WriteString("ig(") );
+ CHKHR( _WriteWideString(name) );
+ CHKHR( _WriteString(";*)") );
+ }
+ else
+ {
+ SimpleMetaDataBuffer::ResolutionPathGuard guard(name, _buffer);
+
+ CHKHR( _WriteString("ig(") );
+ CHKHR( _WriteWideString(name) );
+ CHKHR( _WriteChar(';') );
+
+
+ // InterfaceGroups and RuntimeClasses take one nested argument
+
+ CHKHR( _buffer->_nestedArgs.Append(1) );
+ CHKHR( SendArguments(elementCount, defaultInterfaceNameElements) );
+ CHKHR( _buffer->_nestedArgs.Pop() );
+ CHKHR( _WriteChar(')') );;
+
+ }
+ _Completed();
+ return S_OK;
+ }
+
+ inline __override HRESULT STDMETHODCALLTYPE SimpleMetaDataBuilder::SetRuntimeClassSimpleDefault(
+ PCWSTR name,
+ PCWSTR defaultInterfaceName,
+ __in_opt const GUID* defaultInterfaceIID)
+ {
+ CHKHR(_OnSet());
+
+ CHKHR(_WriteString("rc("));
+ CHKHR(_CommonInterfaceGroupSimple(name, defaultInterfaceName, defaultInterfaceIID));
+
+ _Completed();
+ return S_OK;
+ }
+
+
+ inline __override HRESULT STDMETHODCALLTYPE SimpleMetaDataBuilder::SetRuntimeClassParameterizedDefault(
+ PCWSTR name,
+ UINT32 elementCount,
+ __in_ecount(elementCount) PCWSTR* defaultInterfaceNameElements)
+ {
+ CHKHR(_OnSet());
+
+ if (_buffer->ExistsCycle(name))
+ {
+ CHKHR(_WriteString("rc("));
+ CHKHR(_WriteWideString(name));
+ CHKHR(_WriteString(";*)"));
+ }
+ else
+ {
+ SimpleMetaDataBuffer::ResolutionPathGuard guard(name, _buffer);
+
+ CHKHR(_WriteString("rc("));
+ CHKHR(_WriteWideString(name));
+ CHKHR(_WriteChar(';'));
+
+
+ // InterfaceGroups and RuntimeClasses take one nested argument
+
+ CHKHR(_buffer->_nestedArgs.Append(1));
+ CHKHR(SendArguments(elementCount, defaultInterfaceNameElements));
+ CHKHR(_buffer->_nestedArgs.Pop());
+
+ CHKHR(_WriteChar(')'));
+ }
+ _Completed();
+ return S_OK;
+ }
+
+ inline __override HRESULT STDMETHODCALLTYPE SimpleMetaDataBuilder::SetStruct(
+ PCWSTR name,
+ UINT32 numFields,
+ __in_ecount(numFields) PCWSTR* fieldTypeNames)
+ {
+ CHKHR(_OnSet());
+ CHKHR(_WriteString("struct("));
+ CHKHR(_WriteWideString(name));
+ CHKHR(_WriteChar(';'));
+
+ CHKHR(_buffer->_nestedArgs.Append(1));
+ CHKHR(SendArguments(numFields, fieldTypeNames));
+ CHKHR(_buffer->_nestedArgs.Pop());
+
+ CHKHR(_WriteChar(')'));
+
+ _Completed();
+ return S_OK;
+ }
+
+ inline __override HRESULT STDMETHODCALLTYPE SimpleMetaDataBuilder::SetEnum(
+ PCWSTR name,
+ PCWSTR baseType)
+ {
+ CHKHR(_OnSet());
+
+ CHKHR(_WriteString("enum("));
+ CHKHR(_WriteWideString(name));
+ CHKHR(_WriteChar(';'));
+ CHKHR(_buffer->_nestedArgs.Append(1));
+ CHKHR(_WriteType(baseType));
+ CHKHR(_buffer->_nestedArgs.Pop());
+ CHKHR(_WriteChar(')'));
+
+ _Completed();
+ return S_OK;
+ }
+
+ inline __override HRESULT STDMETHODCALLTYPE SimpleMetaDataBuilder::SetParameterizedInterface(
+ GUID piid,
+ UINT32 numArgs)
+ {
+ CHKHR(_OnSet());
+
+ CHKHR(_WriteString("pinterface("));
+ CHKHR(_WriteGuid(piid));
+
+
+ // Note the number of arguments. The SendArguments
+ // function will append the ')' after that number of
+ // arguments are consumed.
+
+ CHKHR(_buffer->_nestedArgs.Append(numArgs));
+
+ _Completed();
+ return S_OK;
+ }
+
+ inline __override HRESULT STDMETHODCALLTYPE SimpleMetaDataBuilder::SetParameterizedDelegate(
+ GUID piid,
+ UINT32 numArgs)
+ {
+
+ // Parameterized interfaces and parameterized delegates use the same signature scheme.
+
+ return SetParameterizedInterface(piid, numArgs);
+ }
+
+}} // namespace Ro::detail
+
+#ifndef WINRT_PARAMINSTANCE_NOCRYPT_SHA1
+
+namespace Ro { namespace detail {
+
+ class Sha1
+ {
+ public:
+ Sha1()
+ : _hAlg(nullptr)
+ , _hHash(nullptr)
+ {
+ }
+
+ HRESULT Initialize()
+ {
+ DWORD dwcb;
+ DWORD dwcbResult;
+
+ CHKNT(BCryptOpenAlgorithmProvider(&_hAlg, BCRYPT_SHA1_ALGORITHM, MS_PRIMITIVE_PROVIDER, 0));
+
+ CHKNT(BCryptGetProperty(_hAlg, BCRYPT_OBJECT_LENGTH, reinterpret_cast<PBYTE>(&dwcb), sizeof(dwcb), &dwcbResult, 0));
+
+ _ahBuf.Value() = new (std::nothrow) BYTE[dwcb];
+ if (nullptr == _ahBuf.Value())
+ {
+ CHKHR( E_OUTOFMEMORY );
+ }
+
+ CHKNT(BCryptCreateHash(_hAlg, &_hHash, _ahBuf.Value(), dwcb, NULL, 0, 0));
+ return S_OK;
+ }
+ HRESULT AppendData(size_t numBytes, __in_bcount(numBytes) const void* bytes)
+ {
+ CHKHR(Verify(numBytes <= DWORD(-1)));
+ CHKNT(BCryptHashData(_hHash, reinterpret_cast<UCHAR*>(const_cast<void*>(bytes)), DWORD(numBytes), 0));
+ return S_OK;;
+ }
+ HRESULT GetResult(__out BYTE (*hashValue)[20])
+ {
+
+ // Sha1 hash result is fixed size, at 20 bytes.
+
+ CHKNT(BCryptFinishHash(_hHash, reinterpret_cast<PUCHAR>(&hashValue[0]), _countof(*hashValue), 0));
+ return S_OK;
+ }
+ ~Sha1()
+ {
+ if (_hHash)
+ {
+ BCryptDestroyHash(_hHash);
+ }
+ if (_hAlg)
+ {
+ BCryptCloseAlgorithmProvider(_hAlg, 0);
+ }
+ }
+ private:
+
+ ArrayHolder<BYTE> _ahBuf;
+ BCRYPT_ALG_HANDLE _hAlg;
+ BCRYPT_HASH_HANDLE _hHash;
+ };
+}} // namespace Ro::detail
+
+extern "C"
+{
+
+inline HRESULT _RoSha1Create(
+ __out void** handle)
+{
+ *handle = nullptr;
+
+ Ro::detail::ElementHolder<Ro::detail::Sha1> sha1Instance;
+ sha1Instance.Value() = new (std::nothrow) Ro::detail::Sha1;
+ if (!sha1Instance.Value())
+ {
+ CHKHR(E_OUTOFMEMORY);
+ }
+ CHKHR(sha1Instance->Initialize());
+
+ *handle = sha1Instance.Detach();
+ return S_OK;
+}
+
+
+inline HRESULT _RoSha1AppendData(
+ __in void* handle,
+ __in size_t numBytes,
+ __in_bcount(numBytes) const void* data)
+{
+ Ro::detail::Sha1* sha1Instance = static_cast<Ro::detail::Sha1*>(handle);
+ CHKHR(sha1Instance->AppendData(numBytes, data));
+ return S_OK;
+}
+
+
+inline HRESULT _RoSha1Finish(
+ __in void* handle,
+ __out BYTE (*hashValue)[20])
+{
+ Ro::detail::Sha1* sha1Instance = static_cast<Ro::detail::Sha1*>(handle);
+ CHKHR(sha1Instance->GetResult(hashValue));
+ return S_OK;
+}
+
+inline void _RoSha1Release(__in void* handle)
+{
+ Ro::detail::Sha1* sha1Instance = static_cast<Ro::detail::Sha1*>(handle);
+ delete sha1Instance;
+}
+
+}
+
+#endif /* ifdef WINRT_PARAMINSTANCE_NOCRYPT_SHA1 */
+
+#ifdef _MSC_VER
+#pragma pop_macro("CHKNT")
+#pragma pop_macro("CHKHR")
+#pragma warning( pop )
+#endif
+
+#endif /* ifdef __cplusplus */
+#endif /* ifndef WINRT_PARAMINSTANCEAPI_H */
diff --git a/src/inc/winrt/windowsruntime.h b/src/inc/winrt/windowsruntime.h
new file mode 100644
index 0000000000..766b94ab9c
--- /dev/null
+++ b/src/inc/winrt/windowsruntime.h
@@ -0,0 +1,65 @@
+// 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.
+
+#ifndef WindowsRuntime_h
+#define WindowsRuntime_h
+
+#include <roapi.h>
+#include <windowsstring.h>
+#include "holder.h"
+
+#ifdef FEATURE_LEAVE_RUNTIME_HOLDER
+ #define HR_LEAVE_RUNTIME_HOLDER(X) \
+ GCX_PREEMP(); \
+ LeaveRuntimeHolderNoThrow lrh(X); \
+ if (FAILED(lrh.GetHR())) \
+ { \
+ return lrh.GetHR(); \
+ }
+#else
+ #define HR_LEAVE_RUNTIME_HOLDER(X) (void *)0;
+#endif
+
+#ifndef IID_INS_ARGS
+ #define IID_INS_ARGS(ppType) __uuidof(**(ppType)), IID_INS_ARGS_Helper(ppType)
+#endif
+
+HRESULT StringCchLength(
+ __in LPCWSTR wz,
+ __out UINT32 *pcch);
+
+#ifndef CROSSGEN_COMPILE
+namespace clr
+{
+ namespace winrt
+ {
+ using ABI::Windows::Foundation::GetActivationFactory;
+
+ template <typename ItfT> inline
+ HRESULT GetActivationFactory(
+ __in WinRtStringRef const & wzActivatableClassId,
+ __deref_out ItfT** ppItf)
+ {
+ LIMITED_METHOD_CONTRACT;
+ HR_LEAVE_RUNTIME_HOLDER(::RoGetActivationFactory);
+ return GetActivationFactory(wzActivatableClassId.Get(), ppItf);
+ }
+
+ template <typename ItfT>
+ HRESULT GetActivationFactory(
+ __in WinRtStringRef const & wzActivatableClassId,
+ __in typename ReleaseHolder<ItfT>& hItf)
+ {
+ LIMITED_METHOD_CONTRACT;
+ HR_LEAVE_RUNTIME_HOLDER(::RoGetActivationFactory);
+ return GetActivationFactory(wzActivatableClassId.Get(), (ItfT**)&hItf);
+ }
+ } // namespace winrt
+} // namespace clr
+#endif //CROSSGEN_COMPILE
+#undef HR_LEAVE_RUNTIME_HOLDER
+
+#endif // WindowsRuntime_h
+
+
diff --git a/src/inc/winrt/windowsstring.h b/src/inc/winrt/windowsstring.h
new file mode 100644
index 0000000000..aa18eb6f49
--- /dev/null
+++ b/src/inc/winrt/windowsstring.h
@@ -0,0 +1,774 @@
+// 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.
+//
+//
+
+#pragma once
+
+#ifndef WindowsString_h
+#define WindowsString_h
+
+#include <tchar.h> // Required by strsafe.h
+#include <intsafe.h> // For SizeTToUInt32
+#include <strsafe.h> // For StringCchLengthW.
+#include <winstring.h> // The Windows SDK header file for HSTRING and HSTRING_HEADER.
+
+//---------------------------------------------------------------------------------------------------------------------------
+// Forward declarations
+void DECLSPEC_NORETURN ThrowHR(HRESULT hr);
+
+//---------------------------------------------------------------------------------------------------------------------------
+namespace clr
+{
+ namespace winrt
+ {
+ //-------------------------------------------------------------------------------------------------------------------
+ // The internal Windows Runtime String wrapper class which doesn't throw exception when a failure occurs
+ // Note String class doesn't provide copy constructor and copy assigment. This is because the *fast* string duplicate
+ // can fail, which makes the copy constructor unusable in contexts where exceptions are not expected because it would
+ // need to throw on failure. However, a move constructor and move assignment are provided. These require a String &&
+ // argument, which prevents a *fast* string from being moved (StringReference can be cast to const String&, but not
+ // String&&).
+ class String
+ {
+ public:
+ String() throw() : _hstring(nullptr)
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ }
+
+ // Move Constructor
+ String(__inout String&& other) throw()
+ : _hstring(other._hstring)
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ other._hstring = nullptr;
+ }
+
+ // Move assignment
+ String & operator = (__inout String&& other) throw()
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ Release();
+ _hstring = other._hstring;
+ other._hstring = nullptr;
+ return *this;
+ }
+
+ // Initialize this string from a source string. A copy is made in this call.
+ // The str parameter doesn't need to be null terminated, and it may have embedded NUL characters.
+ HRESULT Initialize(_In_reads_opt_(length) const wchar_t *str, UINT32 length) throw()
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ HSTRING local;
+ HRESULT hr = WindowsCreateString(str, length, &local);
+ return FreeAndAssignOnSuccess(hr, local, &_hstring);
+ }
+
+ // Initialize this string from a source string. A copy is made in this call. The input string must have a terminating NULL.
+ HRESULT Initialize(__in PCWSTR str) throw()
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ HRESULT hr = S_OK;
+
+ if (nullptr == str)
+ { // HSTRING functions promote null string pointers to the empty string, so we should too.
+ str = L"";
+ }
+
+ size_t length = 0;
+ if (SUCCEEDED(hr))
+ {
+ hr = StringCchLengthW(str, STRSAFE_MAX_CCH, &length);
+ }
+
+ HSTRING local = nullptr;
+ if (SUCCEEDED(hr))
+ {
+ hr = WindowsCreateString(str, static_cast<UINT32>(length), &local);
+ }
+
+ return FreeAndAssignOnSuccess(hr, local, &_hstring);
+ }
+
+ // Initialize this string from an HSTRING. A copy is made in this call.
+ HRESULT Initialize(const HSTRING& other) throw()
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ HSTRING local;
+ HRESULT hr = WindowsDuplicateString(other, &local);
+ return FreeAndAssignOnSuccess(hr, local, &_hstring);
+ }
+
+ ~String() throw()
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ if (_hstring)
+ {
+ WindowsDeleteString(_hstring);
+ }
+ }
+
+ // Release the current HSTRING object and reset the member variable to empty
+ void Release() throw()
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ if (_hstring)
+ {
+ WindowsDeleteString(_hstring);
+ _hstring = nullptr;
+ }
+ }
+
+ // Detach the current HSTRING
+ void Detach(__out HSTRING *phstring) throw()
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ *phstring = _hstring;
+ _hstring = nullptr;
+ }
+
+ // Duplicate from another String.
+ HRESULT Duplicate(__in const String& other) throw()
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ HSTRING local;
+ HRESULT hr = WindowsDuplicateString(other, &local);
+ return FreeAndAssignOnSuccess(hr, local, &_hstring);
+ }
+
+ // Copy/duplicate into a bare HSTRING
+ HRESULT CopyTo(__out HSTRING *phstring) const throw()
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ return WindowsDuplicateString(this->_hstring, phstring);
+ }
+
+ // HSTRING operator
+ operator const HSTRING&() const throw()
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ return _hstring;
+ }
+
+ // Explicit conversion to HSTRING
+ HSTRING Get() const throw()
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ return _hstring;
+ }
+
+ // Retrieve the address of the held hstring
+ HSTRING* Address()
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ return &_hstring;
+ }
+
+ // Return the address of the internal HSTRING so that the caller can overwrite it,
+ // trusting that the caller will not leak the previously held value
+ HSTRING* GetAddressOf()
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ return &_hstring;
+ }
+
+ // Return the address of the internal HSTRING so that the caller can overwrite it,
+ // but release the previous HSTRING to prevent a leak
+ HSTRING* ReleaseAndGetAddressOf()
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ if (_hstring != nullptr)
+ {
+ WindowsDeleteString(_hstring);
+ _hstring = nullptr;
+ }
+ return &_hstring;
+ }
+
+ // Allow the wrapper to assign a new HSTRING to this wrapper, releasing the old HSTRING
+ void Attach(__in_opt HSTRING string)
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ WindowsDeleteString(_hstring);
+ _hstring = string;
+ }
+
+ // Data Access
+ UINT32 length() const throw()
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ return WindowsGetStringLen(_hstring);
+ }
+
+ // The size() function is an alias for length(), included to parallel stl conventions.
+ // The length() function is preferred.
+ UINT32 size() const throw()
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ return length();
+ }
+
+ BOOL IsEmpty() const throw()
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ return WindowsIsStringEmpty(_hstring);
+ }
+
+ BOOL HasEmbeddedNull() const throw()
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ BOOL answer;
+ // Not capturing HRESULT
+ WindowsStringHasEmbeddedNull(_hstring, &answer);
+ return answer;
+ }
+
+ LPCWSTR GetRawBuffer(__out_opt UINT32 *length = nullptr) const throw()
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ return WindowsGetStringRawBuffer(_hstring, length);
+ }
+
+ HRESULT GetLpcwstr(__deref_out LPCWSTR *ppsz) const throw()
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ if (HasEmbeddedNull())
+ {
+ *ppsz = nullptr;
+ return E_INVALIDARG;
+ }
+ *ppsz = WindowsGetStringRawBuffer(_hstring, nullptr);
+ return S_OK;
+ }
+
+ // CompareOrdinal
+ INT32 CompareOrdinal(const String& other) const throw()
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ INT32 result = 0;
+
+ // Ignore the HRESULT from the following call.
+ WindowsCompareStringOrdinal(_hstring, other, &result);
+
+ return result;
+ }
+
+ // Concatenation
+ HRESULT Concat(const String& string, __out String& newString) const throw()
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ HSTRING local;
+ HRESULT hr = WindowsConcatString(_hstring, string, &local);
+ return FreeAndAssignOnSuccess(hr, local, &newString._hstring);
+ }
+
+ // Trim
+ HRESULT TrimStart(const String& trimString, __out String& newString) const throw()
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ HSTRING local;
+ HRESULT hr = WindowsTrimStringStart(_hstring, trimString, &local);
+ return FreeAndAssignOnSuccess(hr, local, &newString._hstring);
+ }
+
+ HRESULT TrimEnd(const String& trimString, __out String& newString) const throw()
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ HSTRING local;
+ HRESULT hr = WindowsTrimStringEnd(_hstring, trimString, &local);
+ return FreeAndAssignOnSuccess(hr, local, &newString._hstring);
+ }
+
+ // Substring
+ HRESULT Substring(UINT32 startIndex, __out String& newString) const throw()
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ HSTRING local;
+ HRESULT hr = WindowsSubstring(_hstring, startIndex, &local);
+ return FreeAndAssignOnSuccess(hr, local, &newString._hstring);
+ }
+
+ HRESULT Substring(UINT32 startIndex, UINT32 length, __out String& newString) const throw()
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ HSTRING local;
+ HRESULT hr = WindowsSubstringWithSpecifiedLength(_hstring, startIndex, length, &local);
+ return FreeAndAssignOnSuccess(hr, local, &newString._hstring);
+ }
+
+ // Replace
+ HRESULT Replace(const String& stringReplaced, const String& stringReplaceWith, __out String& newString) const throw()
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ HSTRING local;
+ HRESULT hr = WindowsReplaceString(_hstring, stringReplaced, stringReplaceWith, &local);
+ return FreeAndAssignOnSuccess(hr, local, &newString._hstring);
+ }
+
+ private:
+
+ // No Copy Constructor
+ String(const String& other);
+
+ // No Copy assignment because if it can fail
+ String & operator = (const String& other);
+
+ //
+ // helper function, always returns the passed in HRESULT
+ //
+ // if the HRESULT indicates success, frees any previous *target string,
+ // and over-writes it with newValue
+ //
+ // if the HRESULT indicates failure, does nothing
+ //
+ static HRESULT FreeAndAssignOnSuccess(HRESULT hr, HSTRING newValue, __inout HSTRING *target)
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ if (SUCCEEDED(hr))
+ {
+ // InterlockedExchangePointer wouldn't have much value, unless we also modified
+ // all readers of *target to insert a ReadBarrier.
+ HSTRING oldValue = *target;
+ *target = newValue;
+ WindowsDeleteString(oldValue);
+ }
+ return hr;
+ }
+
+ HSTRING _hstring;
+ };
+
+ static_assert(sizeof(String[2]) == sizeof(HSTRING[2]), "clr::winrt::String must be same size as HSTRING!");
+
+ //-------------------------------------------------------------------------------------------------------------------
+ // String Comparison Operators
+ inline
+ bool operator == (const String& left, const String& right) throw()
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ INT32 result = 0;
+ // Ignore the HRESULT from the following call.
+ WindowsCompareStringOrdinal(left, right, &result);
+
+ return 0 == result;
+ }
+
+ inline
+ bool operator != (const String& left, const String& right) throw()
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ INT32 result = 0;
+ // Ignore the HRESULT from the following call.
+ WindowsCompareStringOrdinal(left, right, &result);
+
+ return 0 != result;
+ }
+
+ inline
+ bool operator < (const String& left, const String& right) throw()
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ INT32 result = 0;
+ // Ignore the HRESULT from the following call.
+ WindowsCompareStringOrdinal(left, right, &result);
+
+ return -1 == result;
+ }
+
+ inline
+ bool operator <= (const String& left, const String& right) throw()
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ INT32 result = 0;
+ // Ignore the HRESULT from the following call.
+ WindowsCompareStringOrdinal(left, right, &result);
+
+ return -1 == result || 0 == result;
+ }
+
+ inline
+ bool operator > (const String& left, const String& right) throw()
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ INT32 result = 0;
+ // Ignore the HRESULT from the following call.
+ WindowsCompareStringOrdinal(left, right, &result);
+
+ return 1 == result;
+ }
+
+ inline
+ bool operator >= (const String& left, const String& right) throw()
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ INT32 result = 0;
+ // Ignore the HRESULT from the following call.
+ WindowsCompareStringOrdinal(left, right, &result);
+
+ return 1 == result || 0 == result;
+ }
+
+
+ //-------------------------------------------------------------------------------------------------------------------
+ // The internal Windows Runtime String wrapper class for passing a reference of an existing string buffer.
+ // This class is allocated on stack.
+ class StringReference
+ {
+ public:
+
+ // Constructor which takes an existing string buffer and its length as the parameters.
+ // It fills an HSTRING_HEADER struct with the parameter.
+ //
+ // Warning: The caller must ensure the lifetime of the buffer outlives this
+ // object as it does not make a copy of the wide string memory.
+ StringReference(__in_opt PCWSTR stringRef, UINT32 length) throw()
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ HRESULT hr = WindowsCreateStringReference(stringRef, length, &_header, &_hstring);
+
+ // Failfast if internal developers try to create a reference to a non-NUL terminated string
+ if (FAILED(hr))
+ {
+ RaiseException(static_cast<DWORD>(STATUS_INVALID_PARAMETER), EXCEPTION_NONCONTINUABLE, 0, nullptr);
+ }
+ }
+
+ // Constructor for use with string literals.
+ // It fills an HSTRING_HEADER struct with the parameter.
+ template <UINT32 N>
+ StringReference(__in WCHAR const (&stringRef)[N]) throw()
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+
+ HRESULT hr = WindowsCreateStringReference(stringRef, N - 1 /* remove terminating NUL from length */, &_header, &_hstring);
+
+ // Failfast if internal developers try to create a reference to a non-NUL terminated string. This constructor
+ // should only be used with string literals, but someone could mistakenly use this with a local WCHAR array and
+ // forget to NUL-terminate it.
+ if (FAILED(hr))
+ {
+ RaiseException(static_cast<DWORD>(STATUS_INVALID_PARAMETER), EXCEPTION_NONCONTINUABLE, 0, nullptr);
+ }
+ }
+
+ // Contructor which takes an HSTRING as the parameter. The new StringReference will not create a new copy of the original HSTRING.
+ //
+ // Warning: The caller must ensure the lifetime of the hstring argument outlives this
+ // object as it does not make a copy.
+ explicit StringReference(const HSTRING& hstring) throw()
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ // Create the StringReference without using the _header member, but instead with whatever header is used in hstring so that we
+ // prevent copying when Duplicate() is called on this object. There is no addref, nor decrement in the destructor, since we
+ // don't know or care if it's refcounted or truly a stack allocated reference.
+ _hstring = hstring;
+ }
+
+ // const String& operator
+ operator const String&() const throw()
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ return _AsString();
+ }
+
+ // const HSTRING& operator
+ operator const HSTRING&() const throw()
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ return _hstring;
+ }
+
+ // Explicit conversion to HSTRING
+ HSTRING Get() const throw()
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ return _hstring;
+ }
+
+ // CompareOrdinal
+ INT32 CompareOrdinal(const String& other) const throw()
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ return _AsString().CompareOrdinal(other);
+ }
+
+ // Data Access
+ UINT32 length() const throw()
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ return _AsString().length();
+ }
+
+ UINT32 size() const throw()
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ return _AsString().size();
+ }
+
+ BOOL IsEmpty() const throw()
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ return _AsString().IsEmpty();
+ }
+
+ BOOL HasEmbeddedNull() const throw()
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ return _AsString().HasEmbeddedNull();
+ }
+
+ LPCWSTR GetRawBuffer(__out_opt UINT32 *length) const throw()
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ return _AsString().GetRawBuffer(length);
+ }
+
+ HRESULT GetLpcwstr(__deref_out LPCWSTR *ppsz) const throw()
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ return _AsString().GetLpcwstr(ppsz);
+ }
+
+ HRESULT CopyTo(__out HSTRING *phstring) const throw()
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ return WindowsDuplicateString(this->_hstring, phstring);
+ }
+
+ // Concatenation
+ HRESULT Concat(const String& otherString, __out String& newString) const throw()
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ return _AsString().Concat(otherString, newString);
+ }
+
+ // Trim
+ HRESULT TrimStart(const String& trimString, __out String& newString) const throw()
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ return _AsString().TrimStart(trimString, newString);
+ }
+
+ HRESULT TrimEnd(const String& trimString, __out String& newString) const throw()
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ return _AsString().TrimEnd(trimString, newString);
+ }
+
+ // Substring
+ HRESULT Substring(UINT32 startIndex, __out String& newString) const throw()
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ return _AsString().Substring(startIndex, newString);
+ }
+
+ HRESULT Substring(UINT32 startIndex, UINT32 length, __out String& newString) const throw()
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ return _AsString().Substring(startIndex, length, newString);
+ }
+
+ // Replace
+ HRESULT Replace(const String& stringReplaced, const String& stringReplaceWith, __out String& newString) const throw()
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ return _AsString().Replace(stringReplaced, stringReplaceWith, newString);
+ }
+
+ private:
+ // No Copy Constructor
+ StringReference(const String& other);
+
+ // No non-const WCHAR array constructor
+ template <UINT32 N>
+ StringReference(__in WCHAR (&stringRef)[N]);
+
+ // No Copy assigment
+ const StringReference & operator = (const String& other);
+
+ // No new operator
+ static void * operator new(size_t size);
+
+ // No delete operator
+ static void operator delete(void *p, size_t size);
+
+ // const String& operator
+ const String& _AsString() const throw()
+ {
+ STATIC_CONTRACT_LIMITED_METHOD;
+ return reinterpret_cast<const String&>(_hstring);
+ }
+
+ HSTRING _hstring;
+ HSTRING_HEADER _header;
+ };
+ } // namespace winrt
+} // namespace clr
+
+typedef clr::winrt::String WinRtString;
+typedef clr::winrt::StringReference WinRtStringRef;
+
+// ==========================================================
+// WinRT-specific DuplicateString variations.
+
+LPWSTR DuplicateString(
+ LPCWSTR wszString,
+ size_t cchString);
+
+LPWSTR DuplicateStringThrowing(
+ LPCWSTR wszString,
+ size_t cchString);
+
+inline
+LPWSTR DuplicateString(WinRtString const & str)
+{
+ STATIC_CONTRACT_NOTHROW;
+ UINT32 cchStr;
+ LPCWSTR wzStr = str.GetRawBuffer(&cchStr);
+ return DuplicateString(wzStr, cchStr);
+}
+
+inline
+LPWSTR DuplicateStringThrowing(WinRtString const & str)
+{
+ STATIC_CONTRACT_THROWS;
+ UINT32 cchStr;
+ LPCWSTR wzStr = str.GetRawBuffer(&cchStr);
+ return DuplicateStringThrowing(wzStr, cchStr);
+}
+
+inline
+LPWSTR DuplicateString(HSTRING const & hStr)
+{
+ STATIC_CONTRACT_NOTHROW;
+ WinRtStringRef str(hStr);
+ UINT32 cchStr;
+ LPCWSTR wzStr = str.GetRawBuffer(&cchStr);
+ return DuplicateString(wzStr, cchStr);
+}
+
+inline
+LPWSTR DuplicateStringThrowing(HSTRING const & hStr)
+{
+ STATIC_CONTRACT_THROWS;
+ WinRtStringRef str(hStr);
+ UINT32 cchStr;
+ LPCWSTR wzStr = str.GetRawBuffer(&cchStr);
+ return DuplicateStringThrowing(wzStr, cchStr);
+}
+
+// ==========================================================
+// Convenience overloads of StringCchLength
+
+// A convenience overload that assumes cchMax is STRSAFE_MAX_CCH.
+inline
+HRESULT StringCchLength(
+ __in LPCWSTR wz,
+ __out size_t *pcch)
+{
+ // To align with HSTRING functionality (which always promotes null
+ // string pointers to the empty string), this wrapper also promotes
+ // null string pointers to empty string before forwarding to Windows'
+ // implementation. Don't skip the call to StringCchLength for null
+ // pointers because we want to continue to align with the return value
+ // when passed a null length out parameter.
+ return StringCchLengthW(wz == nullptr ? L"" : wz, size_t(STRSAFE_MAX_CCH), pcch);
+}
+
+#ifdef _WIN64
+ // A UINT32-specific overload with built-in overflow check.
+ inline
+ HRESULT StringCchLength(
+ __in LPCWSTR wz,
+ __out UINT32 *pcch)
+ {
+ if (pcch == nullptr)
+ return E_INVALIDARG;
+
+ size_t cch;
+ HRESULT hr = StringCchLength(wz, &cch);
+ if (FAILED(hr))
+ return hr;
+
+ return SizeTToUInt32(cch, pcch);
+ }
+#endif // _WIN64
+
+#ifndef DACCESS_COMPILE
+ //=====================================================================================================================
+ // Holder of CoTaskMem-allocated array of HSTRING (helper class for WinRT binders - e.g. code:CLRPrivBinderWinRT::GetFileNameListForNamespace).
+ class CoTaskMemHSTRINGArrayHolder
+ {
+ public:
+ CoTaskMemHSTRINGArrayHolder()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ m_cValues = 0;
+ m_rgValues = nullptr;
+ }
+ ~CoTaskMemHSTRINGArrayHolder()
+ {
+ LIMITED_METHOD_CONTRACT;
+ Destroy();
+ }
+
+ // Destroys current array and holds new array rgValues of size cValues.
+ void Init(HSTRING * rgValues, DWORD cValues)
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ Destroy();
+ _ASSERTE(m_cValues == 0);
+
+ _ASSERTE(((cValues == 0) && (rgValues == nullptr)) ||
+ ((cValues > 0) && (rgValues != nullptr)));
+
+ m_rgValues = rgValues;
+ m_cValues = cValues;
+ }
+
+ HSTRING GetAt(DWORD index) const
+ {
+ LIMITED_METHOD_CONTRACT;
+ return m_rgValues[index];
+ }
+
+ DWORD GetCount()
+ {
+ LIMITED_METHOD_CONTRACT;
+ return m_cValues;
+ }
+
+ private:
+ void Destroy()
+ {
+ LIMITED_METHOD_CONTRACT;
+
+ for (DWORD i = 0; i < m_cValues; i++)
+ {
+ if (m_rgValues[i] != nullptr)
+ {
+ WindowsDeleteString(m_rgValues[i]);
+ }
+ }
+ m_cValues = 0;
+
+ if (m_rgValues != nullptr)
+ {
+ CoTaskMemFree(m_rgValues);
+ m_rgValues = nullptr;
+ }
+ }
+
+ private:
+ DWORD m_cValues;
+ HSTRING * m_rgValues;
+ }; // class CoTaskMemHSTRINGArrayHolder
+#endif //!DACCESS_COMPILE
+
+
+#endif // WindowsString_h
+
diff --git a/src/inc/winrtprojectedtypes.h b/src/inc/winrtprojectedtypes.h
new file mode 100644
index 0000000000..503e0305df
--- /dev/null
+++ b/src/inc/winrtprojectedtypes.h
@@ -0,0 +1,271 @@
+// 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.
+
+//
+// This header defines the list of types that are redirected in the CLR projection of WinRT.
+//
+
+//
+// The DEFINE_PROJECTED_TYPE macro takes the following parameters:
+// * An ASCII string representing the namespace in winmd which contains the type being projected from
+// * An ASCII string representing the name in winmd of the type being projected from
+// * An ASCII string representing the namespace in .NET which contains the type being projected to
+// * An ASCII string representing the name in .NET of the type being projected to
+// * A symbol which is used to represent the assembly the .NET type is defined in
+// * A symbol which is used to represent the contract assembly the .NET type is defined in
+// * A symbol which is used to represent the WinRT type
+// * A symbol which is used to represent the .NET type
+// * A symbol which indicates what kind of type this is (struct, runtimeclassclass, etc)
+
+//
+// Optionally, the DEFINE_PROJECTED_RUNTIMECLASS, DEFINE_PROJECTED_STRUCT, DEFINE_PROJECTED_ENUM, DEFINE_PROJECTED_PINTERFACE,
+// DEFINE_PROJECTED_INTERFACE, and DEFINE_PROJECTED_ATTRIBUTE macros can be defined by the consumer of this header file, in
+// order to get extra information about the projected types.
+//
+// Note that the input to these macros is in terms of the original winmd - so HResult is a DEFINE_PROJECTED_STRUCT even though it
+// projects to the class Exception. If you are adding a projection where the WinRT and CLR views differ upon if the type is a
+// value type or not, you'll need to update the signature rewriting code in md\winmd\adapter.cpp as well as the export code in
+// toolbox\winmdexp\projectedtypes.cspp.
+//
+// If these extra macros are not defined, then the DEFINE_PROJECTED_TYPE macro is used to register the type
+//
+// Additionally, the DEFINE_HIDDEN_WINRT_TYPE macro can be defined by the consumer of this file to get information about WinRT
+// types that are not projected but should be hidden from the developer, for instance because they are not intended to be used
+// by 3rd party components.
+//
+//
+
+// DEFINE_PROJECTED_RUNTIMECLASS adds the following parameters:
+// * A ASCII string representing the namespace qualified default interface name
+// * The IID of the default interface
+#ifndef DEFINE_PROJECTED_RUNTIMECLASS
+#define DEFINE_PROJECTED_RUNTIMECLASS(szWinRTNamespace, szWinRTName, szClrNamespace, szClrName, nClrAssemblyIndex, nContractAsmIdx, WinRTRedirectedTypeIndex, ClrRedirectedTypeIndex, szDefaultInterfaceName, DefaultInterfaceIID) \
+ DEFINE_PROJECTED_TYPE(szWinRTNamespace, szWinRTName, szClrNamespace, szClrName, nClrAssemblyIndex, nContractAsmIdx, WinRTRedirectedTypeIndex, ClrRedirectedTypeIndex, Runtimeclass)
+#define __LOCAL_DEFINE_PROJECTED_RUNTIMECLASS
+#endif // !DEFINE_PROJECTED_RUNTIMECLASS
+
+// DEFINE_PROJECTED_STRUCT adds the following parameters:
+// * An array of Unicode strings representing the types of those fields
+//
+// Note that if a field is of a non-primitive type, it must be represented in WinRTGuidGenerator::MetaDataLocator::Locate
+#ifndef DEFINE_PROJECTED_STRUCT
+#define DEFINE_PROJECTED_STRUCT(szWinRTNamespace, szWinRTName, szClrNamespace, szClrName, nClrAssemblyIndex, nContractAsmIdx, WinRTRedirectedTypeIndex, ClrRedirectedTypeIndex, fieldSizes) \
+ DEFINE_PROJECTED_TYPE(szWinRTNamespace, szWinRTName, szClrNamespace, szClrName, nClrAssemblyIndex, nContractAsmIdx, WinRTRedirectedTypeIndex, ClrRedirectedTypeIndex, Struct)
+#define __LOCAL_DEFINE_PROJECTED_STRUCT
+#endif // !DEFINE_PROJECTED_STRUCT
+
+#ifndef DEFINE_PROJECTED_JUPITER_STRUCT
+#define DEFINE_PROJECTED_JUPITER_STRUCT(szWinRTNamespace, szWinRTName, szClrNamespace, szClrName, nClrAssemblyIndex, nContractAsmIdx, WinRTRedirectedTypeIndex, ClrRedirectedTypeIndex, fieldSizes) \
+ DEFINE_PROJECTED_TYPE(szWinRTNamespace, szWinRTName, szClrNamespace, szClrName, nClrAssemblyIndex, nContractAsmIdx, WinRTRedirectedTypeIndex, ClrRedirectedTypeIndex, Struct)
+#define __LOCAL_DEFINE_PROJECTED_JUPITER_STRUCT
+#endif // !DEFINE_PROJECTED_JUPITER_STRUCT
+
+#ifndef STRUCT_FIELDS
+#define STRUCT_FIELDS(...) __VA_ARGS__
+#endif // !STRUCT_FIELDS
+
+// DEFINE_PROJECTED_ENUM adds the following parameters:
+// * An ASCII string defining the size of the backing field of the enumeration
+#ifndef DEFINE_PROJECTED_ENUM
+#define DEFINE_PROJECTED_ENUM(szWinRTNamespace, szWinRTName, szClrNamespace, szClrName, nClrAssemblyIndex, nContractAsmIdx, WinRTRedirectedTypeIndex, ClrRedirectedTypeIndex, szBackingFieldSize) \
+ DEFINE_PROJECTED_TYPE(szWinRTNamespace, szWinRTName, szClrNamespace, szClrName, nClrAssemblyIndex, nContractAsmIdx, WinRTRedirectedTypeIndex, ClrRedirectedTypeIndex, Enum)
+#define __LOCAL_DEFINE_PROJECTED_ENUM
+#endif // !DEFINE_PROJECTED_ENUM
+
+// DEFINE_PROJECTED_INTERFACE adds the following extra parameters:
+// * The IID of the interface
+#ifndef DEFINE_PROJECTED_INTERFACE
+#define DEFINE_PROJECTED_INTERFACE(szWinRTNamespace, szWinRTName, szClrNamespace, szClrName, nClrAssemblyIndex, nContractAsmIdx, WinRTRedirectedTypeIndex, ClrRedirectedTypeIndex, PIID) \
+ DEFINE_PROJECTED_TYPE(szWinRTNamespace, szWinRTName, szClrNamespace, szClrName, nClrAssemblyIndex, nContractAsmIdx, WinRTRedirectedTypeIndex, ClrRedirectedTypeIndex, Interface)
+#define __LOCAL_DEFINE_PROJECTED_INTERFACE
+#endif // !DEFINE_PROJECTED_INTERFACE
+
+// DEFINE_PROJECTED_PINTERFACE adds the following extra parameters:
+// * The number of generic type parameters on the interface
+// * The PIID of the interface
+#ifndef DEFINE_PROJECTED_PINTERFACE
+#define DEFINE_PROJECTED_PINTERFACE(szWinRTNamespace, szWinRTName, szClrNamespace, szClrName, nClrAssemblyIndex, nContractAsmIdx, WinRTRedirectedTypeIndex, ClrRedirectedTypeIndex, GenericTypeParameterCount, PIID) \
+ DEFINE_PROJECTED_TYPE(szWinRTNamespace, szWinRTName, szClrNamespace, szClrName, nClrAssemblyIndex, nContractAsmIdx, WinRTRedirectedTypeIndex, ClrRedirectedTypeIndex, PInterface)
+#define __LOCAL_DEFINE_PROJECTED_PINTERFACE
+#endif // !DEFINE_PROJECTED_PINTERFACE
+
+// DEFINE_PROJECTED_DELEGATE adds the following extra parameters:
+// * The IID of the delegate
+#ifndef DEFINE_PROJECTED_DELEGATE
+#define DEFINE_PROJECTED_DELEGATE(szWinRTNamespace, szWinRTName, szClrNamespace, szClrName, nClrAssemblyIndex, nContractAsmIdx, WinRTRedirectedTypeIndex, ClrRedirectedTypeIndex, PIID) \
+ DEFINE_PROJECTED_TYPE(szWinRTNamespace, szWinRTName, szClrNamespace, szClrName, nClrAssemblyIndex, nContractAsmIdx, WinRTRedirectedTypeIndex, ClrRedirectedTypeIndex, Delegate)
+#define __LOCAL_DEFINE_PROJECTED_DELEGATE
+#endif // !DEFINE_PROJECTED_DELEGATE
+
+// DEFINE_PROJECTED_PDELEGATE adds the following extra parameters:
+// * The number of generic type parameters on the interface
+// * The PIID of the delegate
+#ifndef DEFINE_PROJECTED_PDELEGATE
+#define DEFINE_PROJECTED_PDELEGATE(szWinRTNamespace, szWinRTName, szClrNamespace, szClrName, nClrAssemblyIndex, nContractAsmIdx, WinRTRedirectedTypeIndex, ClrRedirectedTypeIndex, GenericTypeParameterCount, PIID) \
+ DEFINE_PROJECTED_TYPE(szWinRTNamespace, szWinRTName, szClrNamespace, szClrName, nClrAssemblyIndex, nContractAsmIdx, WinRTRedirectedTypeIndex, ClrRedirectedTypeIndex, PDelegate)
+#define __LOCAL_DEFINE_PROJECTED_PDELEGATE
+#endif // !DEFINE_PROJECTED_PDELEGATE
+
+#ifndef PIID
+#define PIID(...) { __VA_ARGS__ }
+#endif // !PIID
+
+// DEFINE_PROJECTED_ATTRIBUTE adds no additional parameters
+#ifndef DEFINE_PROJECTED_ATTRIBUTE
+#define DEFINE_PROJECTED_ATTRIBUTE(szWinRTNamespace, szWinRTName, szClrNamespace, szClrName, nClrAssemblyIndex, nContractAsmIdx, WinRTRedirectedTypeIndex, ClrRedirectedTypeIndex) \
+ DEFINE_PROJECTED_TYPE(szWinRTNamespace, szWinRTName, szClrNamespace, szClrName, nClrAssemblyIndex, nContractAsmIdx, WinRTRedirectedTypeIndex, ClrRedirectedTypeIndex, Attribute)
+#define __LOCAL_DEFINE_PROJECTED_ATTRIBUTE
+#endif // !DEFINE_PROJECTED_ATTRIBUTE
+
+#ifndef DEFINE_HIDDEN_WINRT_TYPE
+#define DEFINE_HIDDEN_WINRT_TYPE(szWinRTNamespace, szWinRTName)
+#define __LOCAL_DEFINE_HIDDEN_WINRT_TYPE
+#endif // !DEFINE_HIDDEN_WINRT_TYPE
+
+// szWinRTNamespace szWinRTName szClrNamespace szClrName nClrAssemblyIndex nContractAsmIdx WinRTRedirectedTypeIndex ClrRedirectedTypeIndex Extra parameters
+// ---------------- ----------- -------------- --------- ----------------- --------------- --------------------- ---------------------- ----------------
+DEFINE_PROJECTED_ATTRIBUTE ("Windows.Foundation.Metadata", "AttributeUsageAttribute", "System", "AttributeUsageAttribute", Mscorlib, SystemRuntime, Windows_Foundation_Metadata_AttributeUsageAttribute, System_AttributeUsage)
+DEFINE_PROJECTED_ENUM ("Windows.Foundation.Metadata", "AttributeTargets", "System", "AttributeTargets", Mscorlib, SystemRuntime, Windows_Foundation_Metadata_AttributeTargets, System_AttributeTargets, "Int32")
+
+DEFINE_PROJECTED_STRUCT ("Windows.UI", "Color", "Windows.UI", "Color", SystemRuntimeWindowsRuntime, SystemRuntimeWindowsRuntime, Windows_UI_Color, System_Windows_Color, STRUCT_FIELDS(W("UInt8"), W("UInt8"), W("UInt8"), W("UInt8")))
+
+DEFINE_PROJECTED_STRUCT ("Windows.Foundation", "DateTime", "System", "DateTimeOffset", Mscorlib, SystemRuntime, Windows_Foundation_DateTime, System_DateTimeOffset, STRUCT_FIELDS(W("Int64")))
+DEFINE_PROJECTED_PDELEGATE ("Windows.Foundation", "EventHandler`1", "System", "EventHandler`1", Mscorlib, SystemRuntime, Windows_Foundation_EventHandlerGeneric, System_EventHandlerGeneric, 1, PIID(0x9de1c535, 0x6ae1, 0x11e0, {0x84, 0xe1, 0x18, 0xa9, 0x05, 0xbc, 0xc5, 0x3f}))
+DEFINE_PROJECTED_STRUCT ("Windows.Foundation", "EventRegistrationToken", "System.Runtime.InteropServices.WindowsRuntime", "EventRegistrationToken", Mscorlib, SystemRuntimeInteropServicesWindowsRuntime, Windows_Foundation_EventRegistrationToken, System_Runtime_InteropServices_WindowsRuntime_EventRegistrationToken, STRUCT_FIELDS(W("Int64")))
+DEFINE_PROJECTED_STRUCT ("Windows.Foundation", "HResult", "System", "Exception", Mscorlib, SystemRuntime, Windows_Foundation_HResult, System_Exception, STRUCT_FIELDS(W("Int32")))
+DEFINE_PROJECTED_PINTERFACE ("Windows.Foundation", "IReference`1", "System", "Nullable`1", Mscorlib, SystemRuntime, Windows_Foundation_IReference, System_Nullable, 1, PIID(0x61c17706, 0x2d65, 0x11e0, {0x9a, 0xe8, 0xd4, 0x85, 0x64, 0x01, 0x54, 0x72}))
+DEFINE_PROJECTED_STRUCT ("Windows.Foundation", "Point", "Windows.Foundation", "Point", SystemRuntimeWindowsRuntime, SystemRuntimeWindowsRuntime, Windows_Foundation_Point, Windows_Foundation_Point_clr, STRUCT_FIELDS(W("Single"), W("Single")))
+DEFINE_PROJECTED_STRUCT ("Windows.Foundation", "Rect", "Windows.Foundation", "Rect", SystemRuntimeWindowsRuntime, SystemRuntimeWindowsRuntime, Windows_Foundation_Rect, Windows_Foundation_Rect_clr, STRUCT_FIELDS(W("Single"), W("Single"), W("Single"), W("Single")))
+DEFINE_PROJECTED_STRUCT ("Windows.Foundation", "Size", "Windows.Foundation", "Size", SystemRuntimeWindowsRuntime, SystemRuntimeWindowsRuntime, Windows_Foundation_Size, Windows_Foundation_Size_clr, STRUCT_FIELDS(W("Single"), W("Single")))
+DEFINE_PROJECTED_STRUCT ("Windows.Foundation", "TimeSpan", "System", "TimeSpan", Mscorlib, SystemRuntime, Windows_Foundation_TimeSpan, System_TimeSpan, STRUCT_FIELDS(W("Int64")))
+DEFINE_PROJECTED_RUNTIMECLASS("Windows.Foundation", "Uri", "System", "Uri", SystemRuntime, SystemRuntime, Windows_Foundation_Uri, System_Uri, "Windows.Foundation.IUriRuntimeClass", __uuidof(ABI::Windows::Foundation::IUriRuntimeClass))
+
+DEFINE_PROJECTED_INTERFACE ("Windows.Foundation", "IClosable", "System", "IDisposable", Mscorlib, SystemRuntime, Windows_Foundation_IClosable, System_IDisposable, PIID(0x30d5a829, 0x7fa4, 0x4026, {0x83, 0xbb, 0xd7, 0x5b, 0xae, 0x4e, 0xa9, 0x9e}))
+
+DEFINE_PROJECTED_PINTERFACE ("Windows.Foundation.Collections", "IIterable`1", "System.Collections.Generic", "IEnumerable`1", Mscorlib, SystemRuntime, Windows_Foundation_Collections_IIterable, System_Collections_Generic_IEnumerable, 1, PIID(0xfaa585ea, 0x6214, 0x4217, {0xaf, 0xda, 0x7f, 0x46, 0xde, 0x58, 0x69, 0xb3}))
+DEFINE_PROJECTED_PINTERFACE ("Windows.Foundation.Collections", "IVector`1", "System.Collections.Generic", "IList`1", Mscorlib, SystemRuntime, Windows_Foundation_Collections_IVector, System_Collections_Generic_IList, 1, PIID(0x913337e9, 0x11a1, 0x4345, {0xa3, 0xa2, 0x4e, 0x7f, 0x95, 0x6e, 0x22, 0x2d}))
+DEFINE_PROJECTED_PINTERFACE ("Windows.Foundation.Collections", "IVectorView`1", "System.Collections.Generic", "IReadOnlyList`1", Mscorlib, SystemRuntime, Windows_Foundation_Collections_IVectorView, System_Collections_Generic_IReadOnlyList, 1, PIID(0xbbe1fa4c, 0xb0e3, 0x4583, {0xba, 0xef, 0x1f, 0x1b, 0x2e, 0x48, 0x3e, 0x56}))
+DEFINE_PROJECTED_PINTERFACE ("Windows.Foundation.Collections", "IMap`2", "System.Collections.Generic", "IDictionary`2", Mscorlib, SystemRuntime, Windows_Foundation_Collections_IMap, System_Collections_Generic_IDictionary, 2, PIID(0x3c2925fe, 0x8519, 0x45c1, {0xaa, 0x79, 0x19, 0x7b, 0x67, 0x18, 0xc1, 0xc1}))
+DEFINE_PROJECTED_PINTERFACE ("Windows.Foundation.Collections", "IMapView`2", "System.Collections.Generic", "IReadOnlyDictionary`2", Mscorlib, SystemRuntime, Windows_Foundation_Collections_IMapView, System_Collections_Generic_IReadOnlyDictionary, 2, PIID(0xe480ce40, 0xa338, 0x4ada, {0xad, 0xcf, 0x27, 0x22, 0x72, 0xe4, 0x8c, 0xb9}))
+DEFINE_PROJECTED_PINTERFACE ("Windows.Foundation.Collections", "IKeyValuePair`2", "System.Collections.Generic", "KeyValuePair`2", Mscorlib, SystemRuntime, Windows_Foundation_Collections_IKeyValuePair, System_Collections_Generic_KeyValuePair, 2, PIID(0x02b51929, 0xc1c4, 0x4a7e, {0x89, 0x40, 0x03, 0x12, 0xb5, 0xc1, 0x85, 0x00}))
+
+DEFINE_PROJECTED_INTERFACE ("Windows.UI.Xaml.Input", "ICommand", "System.Windows.Input", "ICommand", SystemObjectModel, SystemObjectModel, Windows_UI_Xaml_Input_ICommand, System_Windows_Input_ICommand, PIID(0xE5AF3542, 0xCA67, 0x4081, {0x99, 0x5B, 0x70, 0x9D, 0xD1, 0x37, 0x92, 0xDF}))
+
+DEFINE_PROJECTED_INTERFACE ("Windows.UI.Xaml.Interop", "IBindableIterable", "System.Collections", "IEnumerable", Mscorlib, SystemRuntime, Windows_UI_Xaml_Interop_IBindableIterable, System_Collections_IEnumerable, PIID(0x036d2c08, 0xdf29, 0x41af, {0x8a, 0xa2, 0xd7, 0x74, 0xbe, 0x62, 0xba, 0x6f}))
+DEFINE_PROJECTED_INTERFACE ("Windows.UI.Xaml.Interop", "IBindableVector", "System.Collections", "IList", Mscorlib, SystemRuntime, Windows_UI_Xaml_Interop_IBindableVector, System_Collections_IList, PIID(0x393de7de, 0x6fd0, 0x4c0d, {0xbb, 0x71, 0x47, 0x24, 0x4a, 0x11, 0x3e, 0x93}))
+
+DEFINE_PROJECTED_INTERFACE ("Windows.UI.Xaml.Interop", "INotifyCollectionChanged", "System.Collections.Specialized", "INotifyCollectionChanged", SystemObjectModel, SystemObjectModel, Windows_UI_Xaml_Interop_INotifyCollectionChanged, System_Collections_Specialized_INotifyCollectionChanged, PIID(0x28b167d5, 0x1a31, 0x465b, {0x9b, 0x25, 0xd5, 0xc3, 0xae, 0x68, 0x6c, 0x40}))
+DEFINE_PROJECTED_DELEGATE ("Windows.UI.Xaml.Interop", "NotifyCollectionChangedEventHandler", "System.Collections.Specialized", "NotifyCollectionChangedEventHandler", SystemObjectModel, SystemObjectModel, Windows_UI_Xaml_Interop_NotifyCollectionChangedEventHandler, System_Collections_Specialized_NotifyCollectionChangedEventHandler, PIID(0xca10b37c, 0xf382, 0x4591, {0x85, 0x57, 0x5e, 0x24, 0x96, 0x52, 0x79, 0xb0}))
+DEFINE_PROJECTED_RUNTIMECLASS("Windows.UI.Xaml.Interop", "NotifyCollectionChangedEventArgs", "System.Collections.Specialized", "NotifyCollectionChangedEventArgs", SystemObjectModel, SystemObjectModel, Windows_UI_Xaml_Interop_NotifyCollectionChangedEventArgs, System_Collections_Specialized_NotifyCollectionChangedEventArgs, "Windows.UI.Xaml.Interop.INotifyCollectionChangedEventArgs", PIID(0x4cf68d33, 0xe3f2, 0x4964, {0xb8, 0x5e, 0x94, 0x5b, 0x4f, 0x7e, 0x2f, 0x21}))
+DEFINE_PROJECTED_ENUM ("Windows.UI.Xaml.Interop", "NotifyCollectionChangedAction", "System.Collections.Specialized", "NotifyCollectionChangedAction", SystemObjectModel, SystemObjectModel, Windows_UI_Xaml_Interop_NotifyCollectionChangedAction, System_Collections_Specialized_NotifyCollectionChangedAction, "Int32")
+
+DEFINE_PROJECTED_INTERFACE ("Windows.UI.Xaml.Data", "INotifyPropertyChanged", "System.ComponentModel", "INotifyPropertyChanged", SystemObjectModel, SystemObjectModel, Windows_UI_Xaml_Data_INotifyPropertyChanged, System_ComponentModel_INotifyPropertyChanged, PIID(0xcf75d69c, 0xf2f4, 0x486b, {0xb3, 0x02, 0xbb, 0x4c, 0x09, 0xba, 0xeb, 0xfa}))
+DEFINE_PROJECTED_DELEGATE ("Windows.UI.Xaml.Data", "PropertyChangedEventHandler", "System.ComponentModel", "PropertyChangedEventHandler", SystemObjectModel, SystemObjectModel, Windows_UI_Xaml_Data_PropertyChangedEventHandler, System_ComponentModel_PropertyChangedEventHandler, PIID(0x50f19c16, 0x0a22, 0x4d8e, {0xa0, 0x89, 0x1e, 0xa9, 0x95, 0x16, 0x57, 0xd2}))
+DEFINE_PROJECTED_RUNTIMECLASS("Windows.UI.Xaml.Data", "PropertyChangedEventArgs", "System.ComponentModel", "PropertyChangedEventArgs", SystemObjectModel, SystemObjectModel, Windows_UI_Xaml_Data_PropertyChangedEventArgs, System_ComponentModel_PropertyChangedEventArgs, "Windows.UI.Xaml.Data.IPropertyChangedEventArgs", PIID(0x4f33a9a0, 0x5cf4, 0x47a4, {0xb1, 0x6f, 0xd7, 0xfa, 0xaf, 0x17, 0x45, 0x7e}))
+
+DEFINE_PROJECTED_JUPITER_STRUCT("Windows.UI.Xaml", "CornerRadius", "Windows.UI.Xaml", "CornerRadius", SystemRuntimeWindowsRuntimeUIXaml, SystemRuntimeWindowsRuntimeUIXaml, Windows_UI_Xaml_CornerRadius, Windows_UI_Xaml_CornerRadius_clr, STRUCT_FIELDS(W("Double"), W("Double"), W("Double"), W("Double")))
+DEFINE_PROJECTED_JUPITER_STRUCT("Windows.UI.Xaml", "Duration", "Windows.UI.Xaml", "Duration", SystemRuntimeWindowsRuntimeUIXaml, SystemRuntimeWindowsRuntimeUIXaml, Windows_UI_Xaml_Duration, Windows_UI_Xaml_Duration_clr, STRUCT_FIELDS(W("Windows.Foundation.TimeSpan"), W("Windows.UI.Xaml.DurationType")))
+DEFINE_PROJECTED_ENUM ("Windows.UI.Xaml", "DurationType", "Windows.UI.Xaml", "DurationType", SystemRuntimeWindowsRuntimeUIXaml, SystemRuntimeWindowsRuntimeUIXaml, Windows_UI_Xaml_DurationType, Windows_UI_Xaml_DurationType_clr, "Int32")
+DEFINE_PROJECTED_JUPITER_STRUCT("Windows.UI.Xaml", "GridLength", "Windows.UI.Xaml", "GridLength", SystemRuntimeWindowsRuntimeUIXaml, SystemRuntimeWindowsRuntimeUIXaml, Windows_UI_Xaml_GridLength, Windows_UI_Xaml_GridLength_clr, STRUCT_FIELDS(W("Double"), W("Windows.UI.Xaml.GridUnitType")))
+DEFINE_PROJECTED_ENUM ("Windows.UI.Xaml", "GridUnitType", "Windows.UI.Xaml", "GridUnitType", SystemRuntimeWindowsRuntimeUIXaml, SystemRuntimeWindowsRuntimeUIXaml, Windows_UI_Xaml_GridUnitType, Windows_UI_Xaml_GridUnitType_clr, "Int32")
+DEFINE_PROJECTED_JUPITER_STRUCT("Windows.UI.Xaml", "Thickness", "Windows.UI.Xaml", "Thickness", SystemRuntimeWindowsRuntimeUIXaml, SystemRuntimeWindowsRuntimeUIXaml, Windows_UI_Xaml_Thickness, Windows_UI_Xaml_Thickness_clr, STRUCT_FIELDS(W("Double"), W("Double"), W("Double"), W("Double")))
+
+DEFINE_PROJECTED_JUPITER_STRUCT("Windows.UI.Xaml.Interop", "TypeName", "System", "Type", Mscorlib, SystemRuntime, Windows_UI_Xaml_Interop_TypeName, System_Type, STRUCT_FIELDS(W("String"), W("Windows.UI.Xaml.Interop.TypeKind")))
+
+DEFINE_PROJECTED_JUPITER_STRUCT("Windows.UI.Xaml.Controls.Primitives", "GeneratorPosition", "Windows.UI.Xaml.Controls.Primitives", "GeneratorPosition", SystemRuntimeWindowsRuntimeUIXaml, SystemRuntimeWindowsRuntimeUIXaml, Windows_UI_Xaml_Controls_Primitives_GeneratorPosition, Windows_UI_Xaml_Controls_Primitives_GeneratorPosition_clr, STRUCT_FIELDS(W("Int32"), W("Int32")))
+
+DEFINE_PROJECTED_JUPITER_STRUCT("Windows.UI.Xaml.Media", "Matrix", "Windows.UI.Xaml.Media", "Matrix", SystemRuntimeWindowsRuntimeUIXaml, SystemRuntimeWindowsRuntimeUIXaml, Windows_UI_Xaml_Media_Matrix, Windows_UI_Xaml_Media_Matrix_clr, STRUCT_FIELDS(W("Double"), W("Double"), W("Double"), W("Double"), W("Double"), W("Double")))
+
+DEFINE_PROJECTED_JUPITER_STRUCT("Windows.UI.Xaml.Media.Animation", "KeyTime", "Windows.UI.Xaml.Media.Animation", "KeyTime", SystemRuntimeWindowsRuntimeUIXaml, SystemRuntimeWindowsRuntimeUIXaml, Windows_UI_Xaml_Media_Animation_KeyTime, Windows_UI_Xaml_Media_Animation_KeyTime_clr, STRUCT_FIELDS(W("Windows.Foundation.TimeSpan")))
+DEFINE_PROJECTED_JUPITER_STRUCT("Windows.UI.Xaml.Media.Animation", "RepeatBehavior", "Windows.UI.Xaml.Media.Animation", "RepeatBehavior", SystemRuntimeWindowsRuntimeUIXaml, SystemRuntimeWindowsRuntimeUIXaml, Windows_UI_Xaml_Media_Animation_RepeatBehavior, Windows_UI_Xaml_Media_Animation_RepeatBehavior_clr, STRUCT_FIELDS(W("Double"), W("Windows.Foundation.TimeSpan"), W("Windows.UI.Xaml.Media.Animation.RepeatBehaviorType")))
+DEFINE_PROJECTED_ENUM ("Windows.UI.Xaml.Media.Animation", "RepeatBehaviorType", "Windows.UI.Xaml.Media.Animation", "RepeatBehaviorType", SystemRuntimeWindowsRuntimeUIXaml, SystemRuntimeWindowsRuntimeUIXaml, Windows_UI_Xaml_Media_Animation_RepeatBehaviorType, Windows_UI_Xaml_Media_Animation_RepeatBehaviorType_clr, "Int32")
+
+DEFINE_PROJECTED_JUPITER_STRUCT("Windows.UI.Xaml.Media.Media3D", "Matrix3D", "Windows.UI.Xaml.Media.Media3D", "Matrix3D", SystemRuntimeWindowsRuntimeUIXaml, SystemRuntimeWindowsRuntimeUIXaml, Windows_UI_Xaml_Media_Media3D_Matrix3D, Windows_UI_Xaml_Media_Media3D_Matrix3D_clr, STRUCT_FIELDS(W("Double"), W("Double"), W("Double"), W("Double"), W("Double"), W("Double"), W("Double"), W("Double"), W("Double"), W("Double"), W("Double"), W("Double"), W("Double"), W("Double"), W("Double"), W("Double")))
+
+DEFINE_PROJECTED_STRUCT ("Windows.Foundation.Numerics", "Vector2", "System.Numerics", "Vector2", SystemNumericsVectors, SystemNumericsVectors, Windows_Foundation_Numerics_Vector2, System_Numerics_Vector2, STRUCT_FIELDS(L"Single", L"Single"))
+DEFINE_PROJECTED_STRUCT ("Windows.Foundation.Numerics", "Vector3", "System.Numerics", "Vector3", SystemNumericsVectors, SystemNumericsVectors, Windows_Foundation_Numerics_Vector3, System_Numerics_Vector3, STRUCT_FIELDS(L"Single", L"Single", L"Single"))
+DEFINE_PROJECTED_STRUCT ("Windows.Foundation.Numerics", "Vector4", "System.Numerics", "Vector4", SystemNumericsVectors, SystemNumericsVectors, Windows_Foundation_Numerics_Vector4, System_Numerics_Vector4, STRUCT_FIELDS(L"Single", L"Single", L"Single", L"Single"))
+DEFINE_PROJECTED_STRUCT ("Windows.Foundation.Numerics", "Matrix3x2", "System.Numerics", "Matrix3x2", SystemNumericsVectors, SystemNumericsVectors, Windows_Foundation_Numerics_Matrix3x2, System_Numerics_Matrix3x2, STRUCT_FIELDS(L"Single", L"Single", L"Single", L"Single", L"Single", L"Single"))
+DEFINE_PROJECTED_STRUCT ("Windows.Foundation.Numerics", "Matrix4x4", "System.Numerics", "Matrix4x4", SystemNumericsVectors, SystemNumericsVectors, Windows_Foundation_Numerics_Matrix4x4, System_Numerics_Matrix4x4, STRUCT_FIELDS(L"Single", L"Single", L"Single", L"Single", L"Single", L"Single", L"Single", L"Single", L"Single", L"Single", L"Single", L"Single", L"Single", L"Single", L"Single", L"Single"))
+DEFINE_PROJECTED_STRUCT ("Windows.Foundation.Numerics", "Plane", "System.Numerics", "Plane", SystemNumericsVectors, SystemNumericsVectors, Windows_Foundation_Numerics_Plane, System_Numerics_Plane, STRUCT_FIELDS(L"Windows.Foundation.Numerics.Vector3", L"Single"))
+DEFINE_PROJECTED_STRUCT ("Windows.Foundation.Numerics", "Quaternion", "System.Numerics", "Quaternion", SystemNumericsVectors, SystemNumericsVectors, Windows_Foundation_Numerics_Quaternion, System_Numerics_Quaternion, STRUCT_FIELDS(L"Single", L"Single", L"Single", L"Single"))
+
+#ifdef DEFINE_PROJECTED_ATTRIBUTETARGETS_VALUE
+
+// Windows.Foundation.Metadata.AttributeTarget and System.AttributeTarget enum
+// define different bits for everything (@todo: Be nice to change that before we ship.)
+//
+// This table encapsulates the correspondence. NOTE: Some rows in the CLR column store a 0
+// to indicate that the CLR has no corresponding bit for the WinRT value.
+//
+// WinRT CLR
+DEFINE_PROJECTED_ATTRIBUTETARGETS_VALUE(0x00000001, 0x00001000) // AttributeTargets.Delegate
+DEFINE_PROJECTED_ATTRIBUTETARGETS_VALUE(0x00000002, 0x00000010) // AttributeTargets.Enum
+DEFINE_PROJECTED_ATTRIBUTETARGETS_VALUE(0x00000004, 0x00000200) // AttributeTargets.Event
+DEFINE_PROJECTED_ATTRIBUTETARGETS_VALUE(0x00000008, 0x00000100) // AttributeTargets.Field
+DEFINE_PROJECTED_ATTRIBUTETARGETS_VALUE(0x00000010, 0x00000400) // AttributeTargets.Interface
+DEFINE_PROJECTED_ATTRIBUTETARGETS_VALUE(0x00000020, 0x00000000) // AttributeTargets.InterfaceGroup (no equivalent in CLR)
+DEFINE_PROJECTED_ATTRIBUTETARGETS_VALUE(0x00000040, 0x00000040) // AttributeTargets.Method
+DEFINE_PROJECTED_ATTRIBUTETARGETS_VALUE(0x00000080, 0x00000800) // AttributeTargets.Parameter
+DEFINE_PROJECTED_ATTRIBUTETARGETS_VALUE(0x00000100, 0x00000080) // AttributeTargets.Property
+DEFINE_PROJECTED_ATTRIBUTETARGETS_VALUE(0x00000200, 0x00000004) // AttributeTargets.RuntimeClass <--> Class
+DEFINE_PROJECTED_ATTRIBUTETARGETS_VALUE(0x00000400, 0x00000008) // AttributeTargets.Struct
+DEFINE_PROJECTED_ATTRIBUTETARGETS_VALUE(0x00000800, 0x00000000) // AttributeTargets.InterfaceImpl (no equivalent in CLR)
+
+#endif // #ifdef DEFINE_PROJECTED_ATTRIBUTETARGETS_VALUES
+
+
+DEFINE_HIDDEN_WINRT_TYPE("Windows.Foundation.Metadata", "GCPressureAttribute")
+DEFINE_HIDDEN_WINRT_TYPE("Windows.Foundation.Metadata", "GCPressureAmount")
+
+DEFINE_HIDDEN_WINRT_TYPE("Windows.Foundation", "IPropertyValue")
+DEFINE_HIDDEN_WINRT_TYPE("Windows.Foundation", "IReferenceArray`1")
+
+
+#ifdef __LOCAL_DEFINE_PROJECTED_RUNTIMECLASS
+#undef DEFINE_PROJECTED_RUNTIMECLASS
+#endif // __LOCAL_DEFINE_PROJECTED_RUNTIMECLASS
+
+#ifdef __LOCAL_DEFINE_PROJECTED_STRUCT
+#undef DEFINE_PROJECTED_STRUCT
+#endif // __LOCAL_DEFINE_PROJECTED_STRUCT
+
+#ifdef __LOCAL_DEFINE_PROJECTED_JUPITER_STRUCT
+#undef DEFINE_PROJECTED_JUPITER_STRUCT
+#endif // __LOCAL_DEFINE_PROJECTED_JUPITER_STRUCT
+
+#ifdef __LOCAL_DEFINE_PROJECTED_ENUM
+#undef DEFINE_PROJECTED_ENUM
+#endif // __LOCAL_DEFINE_PROJECTED_ENUM
+
+#ifdef __LOCAL_DEFINE_PROJECTED_INTERFACE
+#undef DEFINE_PROJECTED_INTERFACE
+#endif // __LOCAL_DEFINE_PROJECTED_INTERFACE
+
+#ifdef __LOCAL_DEFINE_PROJECTED_PINTERFACE
+#undef DEFINE_PROJECTED_PINTERFACE
+#endif // __LOCAL_DEFINE_PROJECTED_PINTERFACE
+
+#ifdef __LOCAL_DEFINE_PROJECTED_DELEGATE
+#undef DEFINE_PROJECTED_DELEGATE
+#endif // __LOCAL_DEFINE_PROJECTED_DELEGATE
+
+#ifdef __LOCAL_DEFINE_PROJECTED_PDELEGATE
+#undef DEFINE_PROJECTED_PDELEGATE
+#endif // __LOCAL_DEFINE_PROJECTED_PDELEGATE
+
+#ifdef __LOCAL_DEFINE_PROJECTED_ATTRIBUTE
+#undef DEFINE_PROJECTED_ATTRIBUTE
+#endif // __LOCAL_DEFINE_PROJECTED_ATTRIBUTE
+
+#ifdef __LOCAL_DEFINE_HIDDEN_WINRT_TYPE
+#undef DEFINE_HIDDEN_WINRT_TYPE
+#endif // __LOCAL_DEFINE_HIDDEN_WINRT_TYPE
+
+#undef JUPITER_PROJECTION_NS
+#undef JUPITER_PROJECTION_CONTROLS_PRIMITIVES_NS
+#undef JUPITER_PROJECTION_MEDIA_NS
+#undef JUPITER_PROJECTION_MEDIA_ANIMATION_NS
+#undef JUPITER_PROJECTION_MEDIA_3D_NS
+#undef JUPITER_FOUNDATION_PROJECTION_NS
diff --git a/src/inc/winsqmevents.h b/src/inc/winsqmevents.h
new file mode 100644
index 0000000000..2394c84a8a
--- /dev/null
+++ b/src/inc/winsqmevents.h
@@ -0,0 +1,84 @@
+// 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.
+
+//**********************************************************************`
+//* This is an include file generated by Message Compiler. *`
+//* *`
+
+//**********************************************************************`
+#pragma once
+//+
+// Provider Microsoft-Windows-CEIP Event Count 7
+//+
+EXTERN_C __declspec(selectany) const GUID S_Microsoft_Windows_CEIP = {0xa402fe09, 0xda6e, 0x45f2, {0x82, 0xaf, 0x3c, 0xb3, 0x71, 0x70, 0xee, 0x0c}};
+
+//
+// Event Descriptors
+//
+#define WSQMCONS_CONSOLIDATION_SUCCESS 0x400003EDL
+#define WSQMCONS_CONSOLIDATION_ERROR 0xC00003EEL
+#define WSQMCONS_UPLOAD_SUCCESS 0x400003EFL
+#define WSQMCONS_UPLOAD_ERROR 0xC00003F0L
+#define WSQMCONS_NOTIFY_SUCCESS 0x400003F1L
+#define WSQMCONS_NOTIFY_ERROR 0xC00003F2L
+#define WSQMCONS_MANIFEST_DOWNLOAD 0xC00003F3L
+//+
+// Provider Microsoft-Windows-SQM-Events Event Count 26
+//+
+EXTERN_C __declspec(selectany) const GUID Microsoft_Windows_SQM_Provider = {0xa97524f6, 0x064c, 0x4c4e, {0xb7, 0x4b, 0x1a, 0xcc, 0x87, 0xc3, 0x70, 0x0d}};
+
+//
+// Event Descriptors
+//
+EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR Microsoft_Windows_SQM_Provider_EVENT_0x3_0_0_4_0_0_8000000000000 = {0x3, 0x0, 0x0, 0x4, 0x0, 0x0, 0x8000000000000};
+#define Microsoft_Windows_SQM_Provider_EVENT_0x3_0_0_4_0_0_8000000000000_value 0x3
+EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR Microsoft_Windows_SQM_Provider_EVENT_0x4_0_0_4_0_0_8000000000000 = {0x4, 0x0, 0x0, 0x4, 0x0, 0x0, 0x8000000000000};
+#define Microsoft_Windows_SQM_Provider_EVENT_0x4_0_0_4_0_0_8000000000000_value 0x4
+EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR SQM_SET_DWORD_V0 = {0x5, 0x0, 0x0, 0x4, 0x0, 0x0, 0x8000000000000};
+#define SQM_SET_DWORD_V0_value 0x5
+EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR SQM_INCREMENT_DWORD_V0 = {0x6, 0x0, 0x0, 0x4, 0x2, 0x0, 0x8000000000000};
+#define SQM_INCREMENT_DWORD_V0_value 0x6
+EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR SQM_ADDTOAVERAGE_DWORD_V0 = {0x7, 0x0, 0x0, 0x4, 0x0, 0x0, 0x8000000000000};
+#define SQM_ADDTOAVERAGE_DWORD_V0_value 0x7
+EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR SQM_SETIFMAX_DWORD_V0 = {0x8, 0x0, 0x0, 0x4, 0x0, 0x0, 0x8000000000000};
+#define SQM_SETIFMAX_DWORD_V0_value 0x8
+EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR SQM_SETIFMIN_DWORD_V0 = {0x9, 0x0, 0x0, 0x4, 0x0, 0x0, 0x8000000000000};
+#define SQM_SETIFMIN_DWORD_V0_value 0x9
+EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR Microsoft_Windows_SQM_Provider_EVENT_0xb_0_0_4_0_0_8000000000000 = {0xb, 0x0, 0x0, 0x4, 0x0, 0x0, 0x8000000000000};
+#define Microsoft_Windows_SQM_Provider_EVENT_0xb_0_0_4_0_0_8000000000000_value 0xb
+EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR SQM_INIT = {0x1, 0x0, 0x0, 0x4, 0x1, 0x0, 0x8000000000000};
+#define SQM_INIT_value 0x1
+EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR SQM_CLEANUP = {0x2, 0x0, 0x0, 0x4, 0x2, 0x0, 0x8000000000000};
+#define SQM_CLEANUP_value 0x2
+EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR SQM_START_SESSION = {0x3, 0x1, 0x0, 0x4, 0x0, 0x0, 0x8000000000000};
+#define SQM_START_SESSION_value 0x3
+EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR SQM_END_SESSION = {0x4, 0x1, 0x0, 0x4, 0x0, 0x0, 0x8000000000000};
+#define SQM_END_SESSION_value 0x4
+EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR SQM_SET_DWORD = {0x5, 0x1, 0x0, 0x4, 0x0, 0x0, 0x8000000000000};
+#define SQM_SET_DWORD_value 0x5
+EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR SQM_INCREMENT_DWORD = {0x6, 0x1, 0x0, 0x4, 0x2, 0x0, 0x8000000000000};
+#define SQM_INCREMENT_DWORD_value 0x6
+EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR SQM_ADDTOAVERAGE_DWORD = {0x7, 0x1, 0x0, 0x4, 0x0, 0x0, 0x8000000000000};
+#define SQM_ADDTOAVERAGE_DWORD_value 0x7
+EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR SQM_SETIFMAX_DWORD = {0x8, 0x1, 0x0, 0x4, 0x0, 0x0, 0x8000000000000};
+#define SQM_SETIFMAX_DWORD_value 0x8
+EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR SQM_SETIFMIN_DWORD = {0x9, 0x1, 0x0, 0x4, 0x0, 0x0, 0x8000000000000};
+#define SQM_SETIFMIN_DWORD_value 0x9
+EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR SQM_SET_STRING = {0xa, 0x1, 0x0, 0x4, 0x0, 0x0, 0x8000000000000};
+#define SQM_SET_STRING_value 0xa
+EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR SQM_ADD_LEGACYSTREAMROW = {0xb, 0x1, 0x0, 0x4, 0x0, 0x0, 0x8000000000000};
+#define SQM_ADD_LEGACYSTREAMROW_value 0xb
+EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR SQM_LOGON_USER = {0xc, 0x0, 0x0, 0x4, 0x0, 0x0, 0x8000000000000};
+#define SQM_LOGON_USER_value 0xc
+EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR SQM_LOGOFF_USER = {0xd, 0x0, 0x0, 0x4, 0x0, 0x0, 0x8000000000000};
+#define SQM_LOGOFF_USER_value 0xd
+EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR SQM_OPTIN_NOTIFICATION_SHOWN = {0xe, 0x0, 0x0, 0x4, 0x0, 0x0, 0x8000000000000};
+#define SQM_OPTIN_NOTIFICATION_SHOWN_value 0xe
+EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR SQM_OPTIN_NOTIFICATION_RESPONSE = {0xf, 0x0, 0x0, 0x4, 0x0, 0x0, 0x8000000000000};
+#define SQM_OPTIN_NOTIFICATION_RESPONSE_value 0xf
+EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR SQM_SET_DWORD64 = {0x10, 0x0, 0x0, 0x4, 0x0, 0x0, 0x8000000000000};
+#define SQM_SET_DWORD64_value 0x10
+EXTERN_C __declspec(selectany) const EVENT_DESCRIPTOR SQM_ADD_STREAMROW = {0x11, 0x0, 0x0, 0x4, 0x0, 0x0, 0x8000000000000};
+#define SQM_ADD_STREAMROW_value 0x11
+#define MSG_event_CEIP_EVENT_SOURCE 0x90000001L
diff --git a/src/inc/winwrap.h b/src/inc/winwrap.h
new file mode 100644
index 0000000000..91a71b700b
--- /dev/null
+++ b/src/inc/winwrap.h
@@ -0,0 +1,1038 @@
+// 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.
+//*****************************************************************************
+// WinWrap.h
+//
+// This file contains wrapper functions for Win32 API's that take strings.
+//
+// The Common Language Runtime internally uses UNICODE as the internal state
+// and string format. This file will undef the mapping macros so that one
+// cannot mistakingly call a method that isn't going to work. Instead, you
+// have to call the correct wrapper API.
+//
+//*****************************************************************************
+
+#ifndef __WIN_WRAP_H__
+#define __WIN_WRAP_H__
+
+//********** Macros. **********************************************************
+#if !defined(WIN32_LEAN_AND_MEAN)
+#define WIN32_LEAN_AND_MEAN
+#endif
+#if !defined(WIN32_LEAN_AND_MEAN)
+#define INC_OLE2
+#endif
+
+#ifdef _WIN64
+#define HIWORD64(p) ((ULONG_PTR)(p) >> 16)
+#else
+#define HIWORD64 HIWORD
+#endif
+
+#define SAFEDELARRAY(p) if ((p) != NULL) { delete [] p; (p) = NULL; }
+
+//
+// WinCE uniformly uses cdecl calling convention on x86. __stdcall is defined as __cdecl in SDK.
+// STDCALL macro is meant to be used where we have hard dependency on __stdcall calling convention
+// - the unification with __cdecl does not apply to STDCALL.
+//
+#define STDCALL _stdcall
+
+//********** Includes. ********************************************************
+
+#include <crtwrap.h>
+#include <windows.h>
+#include <wincrypt.h>
+#include <specstrings.h>
+
+#include "registrywrapper.h"
+#include "longfilepathwrappers.h"
+
+#if defined(_PREFAST_) || defined(SOURCE_FORMATTING)
+//
+// For PREFAST we don't want the C_ASSERT to be expanded since it always
+// involves the comparison of two constants which causes PREfast warning 326
+//
+#undef C_ASSERT
+#define C_ASSERT(expr)
+#endif
+
+#include "palclr.h"
+
+#if !defined(__TODO_PORT_TO_WRAPPERS__)
+//*****************************************************************************
+// Undefine all of the windows wrappers so you can't use them.
+//*****************************************************************************
+
+// wincrypt.h
+#undef CryptAcquireContext
+#undef CryptGetDefaultProvider
+#undef CryptSignHash
+#undef CryptVerifySignature
+
+// winbase.h
+#undef GetBinaryType
+#undef GetShortPathName
+#undef GetLongPathName
+#undef GetEnvironmentStrings
+#undef FreeEnvironmentStrings
+#undef FormatMessage
+#undef CreateMailslot
+#undef EncryptFile
+#undef DecryptFile
+#undef OpenRaw
+#undef QueryRecoveryAgents
+#undef lstrcmp
+#undef lstrcmpi
+#undef lstrcpyn
+#undef lstrcpy
+#undef lstrcat
+#undef lstrlen
+#undef CreateMutex
+#undef OpenMutex
+#undef CreateEvent
+#undef OpenEvent
+#undef CreateSemaphore
+#undef OpenSemaphore
+#undef CreateWaitableTimer
+#undef OpenWaitableTimer
+#undef CreateFileMapping
+#undef OpenFileMapping
+#undef GetLogicalDriveStrings
+#undef LoadLibrary
+#undef LoadLibraryEx
+#undef GetModuleFileName
+#undef GetModuleHandle
+#undef GetModuleHandleEx
+#undef CreateProcess
+#undef FatalAppExit
+#undef GetStartupInfo
+#undef GetCommandLine
+#undef GetEnvironmentVariable
+#undef SetEnvironmentVariable
+#undef ExpandEnvironmentStrings
+#undef OutputDebugString
+#undef FindResource
+#undef FindResourceEx
+#undef EnumResourceTypes
+#undef EnumResourceNames
+#undef EnumResourceLanguages
+#undef BeginUpdateResource
+#undef UpdateResource
+#undef EndUpdateResource
+#undef GlobalAddAtom
+#undef GlobalFindAtom
+#undef GlobalGetAtomName
+#undef AddAtom
+#undef FindAtom
+#undef GetAtomName
+#undef GetProfileInt
+#undef GetProfileString
+#undef WriteProfileString
+#undef GetProfileSection
+#undef WriteProfileSection
+#undef GetPrivateProfileInt
+#undef GetPrivateProfileString
+#undef WritePrivateProfileString
+#undef GetPrivateProfileSection
+#undef WritePrivateProfileSection
+#undef GetPrivateProfileSectionNames
+#undef GetPrivateProfileStruct
+#undef WritePrivateProfileStruct
+#undef GetDriveType
+#undef GetSystemDirectory
+#undef GetTempPath
+#undef GetTempFileName
+#undef GetWindowsDirectory
+#undef SetCurrentDirectory
+#undef GetCurrentDirectory
+#undef GetDiskFreeSpace
+#undef GetDiskFreeSpaceEx
+#undef CreateDirectory
+#undef CreateDirectoryEx
+#undef RemoveDirectory
+#undef GetFullPathName
+#undef DefineDosDevice
+#undef QueryDosDevice
+#undef CreateFile
+#undef SetFileAttributes
+#undef GetFileAttributes
+#undef GetFileAttributesEx
+#undef GetCompressedFileSize
+#undef DeleteFile
+#undef FindFirstFileEx
+#undef FindFirstFile
+#undef FindNextFile
+#undef SearchPath
+#undef CopyFile
+#undef CopyFileEx
+#undef MoveFile
+#undef MoveFileEx
+#undef MoveFileWithProgress
+#undef CreateSymbolicLink
+#undef QuerySymbolicLink
+#undef CreateHardLink
+#undef CreateNamedPipe
+#undef GetNamedPipeHandleState
+#undef CallNamedPipe
+#undef WaitNamedPipe
+#undef SetVolumeLabel
+#undef GetVolumeInformation
+#undef ClearEventLog
+#undef BackupEventLog
+#undef OpenEventLog
+#undef RegisterEventSource
+#undef OpenBackupEventLog
+#undef ReadEventLog
+#undef ReportEvent
+#undef AccessCheckAndAuditAlarm
+#undef AccessCheckByTypeAndAuditAlarm
+#undef AccessCheckByTypeResultListAndAuditAlarm
+#undef ObjectOpenAuditAlarm
+#undef ObjectPrivilegeAuditAlarm
+#undef ObjectCloseAuditAlarm
+#undef ObjectDeleteAuditAlarm
+#undef PrivilegedServiceAuditAlarm
+#undef SetFileSecurity
+#undef GetFileSecurity
+#undef FindFirstChangeNotification
+#undef IsBadStringPtr
+#undef LookupAccountSid
+#undef LookupAccountName
+#undef LookupPrivilegeValue
+#undef LookupPrivilegeName
+#undef LookupPrivilegeDisplayName
+#undef BuildCommDCB
+#undef BuildCommDCBAndTimeouts
+#undef CommConfigDialog
+#undef GetDefaultCommConfig
+#undef SetDefaultCommConfig
+#undef GetComputerName
+#undef SetComputerName
+#undef GetUserName
+#undef LogonUser
+#undef CreateProcessAsUser
+#undef GetCurrentHwProfile
+#undef GetVersionEx
+#undef CreateJobObject
+#undef OpenJobObject
+#undef SetDllDirectory
+
+// winuser.h
+#undef MAKEINTRESOURCE
+#undef wvsprintf
+#undef wsprintf
+#undef LoadKeyboardLayout
+#undef GetKeyboardLayoutName
+#undef CreateDesktop
+#undef OpenDesktop
+#undef EnumDesktops
+#undef CreateWindowStation
+#undef OpenWindowStation
+#undef EnumWindowStations
+#undef GetUserObjectInformation
+#undef SetUserObjectInformation
+#undef RegisterWindowMessage
+#undef SIZEZOOMSHOW
+#undef WS_TILEDWINDOW
+#undef GetMessage
+#undef DispatchMessage
+#undef PeekMessage
+
+#undef SendMessage
+#undef SendMessageTimeout
+#undef SendNotifyMessage
+#undef SendMessageCallback
+#undef BroadcastSystemMessage
+#undef RegisterDeviceNotification
+#undef PostMessage
+#undef PostThreadMessage
+#undef PostAppMessage
+#undef DefWindowProc
+#undef CallWindowProc
+#undef RegisterClass
+#undef UnregisterClass
+#undef GetClassInfo
+#undef RegisterClassEx
+#undef GetClassInfoEx
+#undef CreateWindowEx
+#undef CreateWindow
+#undef CreateDialogParam
+#undef CreateDialogIndirectParam
+#undef CreateDialog
+#undef CreateDialogIndirect
+#undef DialogBoxParam
+#undef DialogBoxIndirectParam
+#undef DialogBox
+#undef DialogBoxIndirect
+#undef SetDlgItemText
+#undef GetDlgItemText
+#undef SendDlgItemMessage
+#undef DefDlgProc
+#undef CallMsgFilter
+#undef RegisterClipboardFormat
+#undef GetClipboardFormatName
+#undef CharToOem
+#undef OemToChar
+#undef CharToOemBuff
+#undef OemToCharBuff
+#undef CharUpper
+#undef CharUpperBuff
+#undef CharLower
+#undef CharLowerBuff
+#undef CharNext
+#undef IsCharAlpha
+#undef IsCharAlphaNumeric
+#undef IsCharUpper
+#undef IsCharLower
+#undef GetKeyNameText
+#undef VkKeyScan
+#undef VkKeyScanEx
+#undef MapVirtualKey
+#undef MapVirtualKeyEx
+#undef LoadAccelerators
+#undef CreateAcceleratorTable
+#undef CopyAcceleratorTable
+#undef TranslateAccelerator
+#undef LoadMenu
+#undef LoadMenuIndirect
+#undef ChangeMenu
+#undef GetMenuString
+#undef InsertMenu
+#undef AppendMenu
+#undef ModifyMenu
+#undef InsertMenuItem
+#undef GetMenuItemInfo
+#undef SetMenuItemInfo
+#undef DrawText
+#undef DrawTextEx
+#undef GrayString
+#undef DrawState
+#undef TabbedTextOut
+#undef GetTabbedTextExtent
+#undef SetProp
+#undef GetProp
+#undef RemoveProp
+#undef EnumPropsEx
+#undef EnumProps
+#undef SetWindowText
+#undef GetWindowText
+#undef GetWindowTextLength
+#undef MessageBox
+#undef MessageBoxEx
+#undef MessageBoxIndirect
+#undef COLOR_3DSHADOW
+#undef GetWindowLong
+#undef SetWindowLong
+#undef GetClassLong
+#undef SetClassLong
+#undef FindWindow
+#undef FindWindowEx
+#undef GetClassName
+#undef SetWindowsHook
+#undef SetWindowsHook
+#undef SetWindowsHookEx
+#undef MFT_OWNERDRAW
+#undef LoadBitmap
+#undef LoadCursor
+#undef LoadCursorFromFile
+#undef LoadIcon
+#undef LoadImage
+#undef LoadString
+#undef IsDialogMessage
+#undef DlgDirList
+#undef DlgDirSelectEx
+#undef DlgDirListComboBox
+#undef DlgDirSelectComboBoxEx
+#undef DefFrameProc
+#undef DefMDIChildProc
+#undef CreateMDIWindow
+#undef WinHelp
+#undef ChangeDisplaySettings
+#undef ChangeDisplaySettingsEx
+#undef EnumDisplaySettings
+#undef EnumDisplayDevices
+#undef SystemParametersInfo
+#undef GetMonitorInfo
+#undef GetWindowModuleFileName
+#undef RealGetWindowClass
+#undef GetAltTabInfo
+#undef GetCalendarInfo
+#undef GetDateFormat
+#undef GetTimeFormat
+#undef LCMapString
+
+// winnetwk.h
+#undef WNetGetConnection
+
+// Win32 Fusion API's
+#undef QueryActCtxW
+
+#endif // !defined(__TODO_PORT_TO_WRAPPERS__)
+
+//
+// NT supports the wide entry points. So we redefine the wrappers right back
+// to the *W entry points as macros. This way no client code needs a wrapper on NT.
+//
+
+// wincrypt.h
+#define WszCryptAcquireContext CryptAcquireContextW
+#define WszCryptGetDefaultProvider CryptGetDefaultProviderW
+#define WszCryptSignHash CryptSignHashW
+#define WszCryptVerifySignature CryptVerifySignatureW
+
+// winbase.h
+#define WszGetEnvironmentStrings GetEnvironmentStringsW
+#define WszFreeEnvironmentStrings FreeEnvironmentStringsW
+#ifndef USE_FORMATMESSAGE_WRAPPER
+#define WszFormatMessage FormatMessageW
+#else
+#define WszFormatMessage CCompRC::FormatMessage
+#endif
+#define WszCreateMailslot CreateMailslotW
+#define WszOpenRaw OpenRawW
+#define WszQueryRecoveryAgents QueryRecoveryAgentsW
+#define Wszlstrcmp lstrcmpW
+#define Wszlstrcmpi lstrcmpiW
+#define Wszlstrcpy lstrcpyW
+#define Wszlstrcat lstrcatW
+#define WszCreateMutex CreateMutexW
+#define WszOpenMutex OpenMutexW
+#define WszCreateEvent CreateEventW
+#define WszOpenEvent OpenEventW
+#define WszCreateWaitableTimer CreateWaitableTimerW
+#define WszOpenWaitableTimer OpenWaitableTimerW
+#define WszCreateFileMapping CreateFileMappingW
+#define WszOpenFileMapping OpenFileMappingW
+#define WszGetLogicalDriveStrings GetLogicalDriveStringsW
+#define WszGetModuleHandle GetModuleHandleW
+#define WszGetModuleHandleEx GetModuleHandleExW
+#define WszFatalAppExit FatalAppExitW
+#define WszGetStartupInfo GetStartupInfoW
+#define WszGetCommandLine GetCommandLineW
+#define WszSetEnvironmentVariable SetEnvironmentVariableW
+#define WszExpandEnvironmentStrings ExpandEnvironmentStringsW
+#define WszOutputDebugString OutputDebugStringW
+#define WszFindResource FindResourceW
+#define WszFindResourceEx FindResourceExW
+#define WszEnumResourceTypes EnumResourceTypesW
+#define WszEnumResourceNames EnumResourceNamesW
+#define WszEnumResourceLanguages EnumResourceLanguagesW
+#define WszBeginUpdateResource BeginUpdateResourceW
+#define WszUpdateResource UpdateResourceW
+#define WszEndUpdateResource EndUpdateResourceW
+#define WszGlobalAddAtom GlobalAddAtomW
+#define WszGlobalFindAtom GlobalFindAtomW
+#define WszGlobalGetAtomName GlobalGetAtomNameW
+#define WszAddAtom AddAtomW
+#define WszFindAtom FindAtomW
+#define WszGetAtomName GetAtomNameW
+#define WszGetProfileInt GetProfileIntW
+#define WszGetProfileString GetProfileStringW
+#define WszWriteProfileString WriteProfileStringW
+#define WszGetProfileSection GetProfileSectionW
+#define WszWriteProfileSection WriteProfileSectionW
+#define WszGetPrivateProfileInt GetPrivateProfileIntW
+#define WszGetPrivateProfileString GetPrivateProfileStringW
+#define WszWritePrivateProfileString WritePrivateProfileStringW
+#define WszGetPrivateProfileSection GetPrivateProfileSectionW
+#define WszWritePrivateProfileSection WritePrivateProfileSectionW
+#define WszGetPrivateProfileSectionNames GetPrivateProfileSectionNamesW
+#define WszGetPrivateProfileStruct GetPrivateProfileStructW
+#define WszWritePrivateProfileStruct WritePrivateProfileStructW
+#define WszGetDriveType GetDriveTypeW
+#define WszGetSystemDirectory GetSystemDirectoryW
+#define WszGetWindowsDirectory GetWindowsDirectoryW
+#define WszGetDiskFreeSpace GetDiskFreeSpaceW
+#define WszGetDiskFreeSpaceEx GetDiskFreeSpaceExW
+#define WszDefineDosDevice DefineDosDeviceW
+#define WszQueryDosDevice QueryDosDeviceW
+#define WszQuerySymbolicLink QuerySymbolicLinkW
+#define WszCreateNamedPipe CreateNamedPipeW
+#define WszGetNamedPipeHandleState GetNamedPipeHandleStateW
+#define WszCallNamedPipe CallNamedPipeW
+#define WszWaitNamedPipe WaitNamedPipeW
+#define WszSetVolumeLabel SetVolumeLabelW
+#define WszGetVolumeInformation GetVolumeInformationW
+#define WszClearEventLog ClearEventLogW
+#define WszBackupEventLog BackupEventLogW
+#define WszOpenEventLog OpenEventLogW
+#define WszRegisterEventSource RegisterEventSourceW
+#define WszOpenBackupEventLog OpenBackupEventLogW
+#define WszReadEventLog ReadEventLogW
+#define WszReportEvent ReportEventW
+#define WszAccessCheckAndAuditAlarm AccessCheckAndAuditAlarmW
+#define WszAccessCheckByTypeAndAuditAlarm AccessCheckByTypeAndAuditAlarmW
+#define WszAccessCheckByTypeResultListAndAuditAlarm AccessCheckByTypeResultListAndAuditAlarmW
+#define WszObjectOpenAuditAlarm ObjectOpenAuditAlarmW
+#define WszObjectPrivilegeAuditAlarm ObjectPrivilegeAuditAlarmW
+#define WszObjectCloseAuditAlarm ObjectCloseAuditAlarmW
+#define WszObjectDeleteAuditAlarm ObjectDeleteAuditAlarmW
+#define WszPrivilegedServiceAuditAlarm PrivilegedServiceAuditAlarmW
+#define WszIsBadStringPtr __DO_NOT_USE__WszIsBadStringPtr__
+#if !defined(FEATURE_CORESYSTEM) || defined(CROSSGEN_COMPILE)
+#define WszLookupAccountSid LookupAccountSidW
+#endif
+#define WszLookupAccountName LookupAccountNameW
+#define WszLookupPrivilegeValue LookupPrivilegeValueW
+#define WszLookupPrivilegeName LookupPrivilegeNameW
+#define WszLookupPrivilegeDisplayName LookupPrivilegeDisplayNameW
+#define WszBuildCommDCB BuildCommDCBW
+#define WszBuildCommDCBAndTimeouts BuildCommDCBAndTimeoutsW
+#define WszCommConfigDialog CommConfigDialogW
+#define WszGetDefaultCommConfig GetDefaultCommConfigW
+#define WszSetDefaultCommConfig SetDefaultCommConfigW
+#define WszGetComputerName GetComputerNameW
+#define WszSetComputerName SetComputerNameW
+#define WszGetUserName GetUserNameW
+#define WszLogonUser LogonUserW
+#define WszCreateProcessAsUser CreateProcessAsUserW
+#define WszGetCurrentHwProfile GetCurrentHwProfileW
+#define WszGetVersionEx GetVersionExW
+#define WszCreateJobObject CreateJobObjectW
+#define WszOpenJobObject OpenJobObjectW
+
+// winuser.h
+#define WszMAKEINTRESOURCE MAKEINTRESOURCEW
+#define Wszwvsprintf wvsprintfW
+#define WszLoadKeyboardLayout LoadKeyboardLayoutW
+#define WszGetKeyboardLayoutName GetKeyboardLayoutNameW
+#define WszCreateDesktop CreateDesktopW
+#define WszOpenDesktop OpenDesktopW
+#define WszEnumDesktops EnumDesktopsW
+#define WszCreateWindowStation CreateWindowStationW
+#define WszOpenWindowStation OpenWindowStationW
+#define WszEnumWindowStations EnumWindowStationsW
+#define WszGetUserObjectInformation GetUserObjectInformationW
+#define WszSetUserObjectInformation SetUserObjectInformationW
+#define WszRegisterWindowMessage RegisterWindowMessageW
+#define WszSIZEZOOMSHOW SIZEZOOMSHOWW
+#define WszWS_TILEDWINDOW WS_TILEDWINDOWW
+#define WszGetMessage GetMessageW
+#define WszDispatchMessage DispatchMessageW
+#define WszPostMessage PostMessageW
+#define WszPeekMessage PeekMessageW
+#define WszSendMessage SendMessageW
+#define WszSendMessageTimeout SendMessageTimeoutW
+#define WszSendNotifyMessage SendNotifyMessageW
+#define WszSendMessageCallback SendMessageCallbackW
+#define WszBroadcastSystemMessage BroadcastSystemMessageW
+#define WszRegisterDeviceNotification RegisterDeviceNotificationW
+#define WszPostMessage PostMessageW
+#define WszPostThreadMessage PostThreadMessageW
+#define WszPostAppMessage PostAppMessageW
+#define WszDefWindowProc DefWindowProcW
+#define WszCallWindowProc CallWindowProcW
+#define WszRegisterClass RegisterClassW
+#define WszUnregisterClass UnregisterClassW
+#define WszGetClassInfo GetClassInfoW
+#define WszRegisterClassEx RegisterClassExW
+#define WszGetClassInfoEx GetClassInfoExW
+#define WszCreateWindowEx CreateWindowExW
+#define WszCreateWindow CreateWindowW
+#define WszCreateDialogParam CreateDialogParamW
+#define WszCreateDialogIndirectParam CreateDialogIndirectParamW
+#define WszCreateDialog CreateDialogW
+#define WszCreateDialogIndirect CreateDialogIndirectW
+#define WszDialogBoxParam DialogBoxParamW
+#define WszDialogBoxIndirectParam DialogBoxIndirectParamW
+#define WszDialogBox DialogBoxW
+#define WszDialogBoxIndirect DialogBoxIndirectW
+#define WszSetDlgItemText SetDlgItemTextW
+#define WszGetDlgItemText GetDlgItemTextW
+#define WszSendDlgItemMessage SendDlgItemMessageW
+#define WszDefDlgProc DefDlgProcW
+#define WszCallMsgFilter CallMsgFilterW
+#define WszRegisterClipboardFormat RegisterClipboardFormatW
+#define WszGetClipboardFormatName GetClipboardFormatNameW
+#define WszCharToOem CharToOemW
+#define WszOemToChar OemToCharW
+#define WszCharToOemBuff CharToOemBuffW
+#define WszOemToCharBuff OemToCharBuffW
+#define WszCharUpper CharUpperW
+#define WszCharUpperBuff CharUpperBuffW
+#define WszCharLower CharLowerW
+#define WszCharLowerBuff CharLowerBuffW
+#define WszCharNext CharNextW
+#define WszIsCharAlpha IsCharAlphaW
+#define WszIsCharAlphaNumeric IsCharAlphaNumericW
+#define WszIsCharUpper IsCharUpperW
+#define WszIsCharLower IsCharLowerW
+#define WszGetKeyNameText GetKeyNameTextW
+#define WszVkKeyScan VkKeyScanW
+#define WszVkKeyScanEx VkKeyScanExW
+#define WszMapVirtualKey MapVirtualKeyW
+#define WszMapVirtualKeyEx MapVirtualKeyExW
+#define WszLoadAccelerators LoadAcceleratorsW
+#define WszCreateAcceleratorTable CreateAcceleratorTableW
+#define WszCopyAcceleratorTable CopyAcceleratorTableW
+#define WszTranslateAccelerator TranslateAcceleratorW
+#define WszLoadMenu LoadMenuW
+#define WszLoadMenuIndirect LoadMenuIndirectW
+#define WszChangeMenu ChangeMenuW
+#define WszGetMenuString GetMenuStringW
+#define WszInsertMenu InsertMenuW
+#define WszAppendMenu AppendMenuW
+#define WszModifyMenu ModifyMenuW
+#define WszInsertMenuItem InsertMenuItemW
+#define WszGetMenuItemInfo GetMenuItemInfoW
+#define WszSetMenuItemInfo SetMenuItemInfoW
+#define WszDrawText DrawTextW
+#define WszDrawTextEx DrawTextExW
+#define WszGrayString GrayStringW
+#define WszDrawState DrawStateW
+#define WszTabbedTextOut TabbedTextOutW
+#define WszGetTabbedTextExtent GetTabbedTextExtentW
+#define WszSetProp SetPropW
+#define WszGetProp GetPropW
+#define WszRemoveProp RemovePropW
+#define WszEnumPropsEx EnumPropsExW
+#define WszEnumProps EnumPropsW
+#define WszSetWindowText SetWindowTextW
+#define WszGetWindowText GetWindowTextW
+#define WszGetWindowTextLength GetWindowTextLengthW
+#define WszMessageBox LateboundMessageBoxW
+#define WszMessageBoxEx MessageBoxExW
+#define WszMessageBoxIndirect MessageBoxIndirectW
+#define WszGetWindowLong GetWindowLongW
+#define WszSetWindowLong SetWindowLongW
+#define WszSetWindowLongPtr SetWindowLongPtrW
+#define WszGetWindowLongPtr GetWindowLongPtrW
+#define WszGetClassLong GetClassLongW
+#define WszSetClassLong SetClassLongW
+#define WszFindWindow FindWindowW
+#define WszFindWindowEx FindWindowExW
+#define WszGetClassName GetClassNameW
+#define WszSetWindowsHook SetWindowsHookW
+#define WszSetWindowsHook SetWindowsHookW
+#define WszSetWindowsHookEx SetWindowsHookExW
+#define WszLoadBitmap LoadBitmapW
+#define WszLoadCursor LoadCursorW
+#define WszLoadCursorFromFile LoadCursorFromFileW
+#define WszLoadIcon LoadIconW
+#define WszLoadImage LoadImageW
+#define WszLoadString LoadStringW
+#define WszIsDialogMessage IsDialogMessageW
+#define WszDlgDirList DlgDirListW
+#define WszDlgDirSelectEx DlgDirSelectExW
+#define WszDlgDirListComboBox DlgDirListComboBoxW
+#define WszDlgDirSelectComboBoxEx DlgDirSelectComboBoxExW
+#define WszDefFrameProc DefFrameProcW
+#define WszDefMDIChildProc DefMDIChildProcW
+#define WszCreateMDIWindow CreateMDIWindowW
+#define WszWinHelp WinHelpW
+#define WszChangeDisplaySettings ChangeDisplaySettingsW
+#define WszChangeDisplaySettingsEx ChangeDisplaySettingsExW
+#define WszEnumDisplaySettings EnumDisplaySettingsW
+#define WszEnumDisplayDevices EnumDisplayDevicesW
+#define WszSystemParametersInfo SystemParametersInfoW
+#define WszGetMonitorInfo GetMonitorInfoW
+#define WszGetWindowModuleFileName GetWindowModuleFileNameW
+#define WszRealGetWindowClass RealGetWindowClassW
+#define WszGetAltTabInfo GetAltTabInfoW
+#define WszRegOpenKeyEx ClrRegOpenKeyEx
+#define WszRegOpenKey(hKey, wszSubKey, phkRes) ClrRegOpenKeyEx(hKey, wszSubKey, 0, KEY_ALL_ACCESS, phkRes)
+#define WszRegQueryValue RegQueryValueW
+#define WszRegQueryValueEx RegQueryValueExW
+#define WszRegQueryValueExTrue RegQueryValueExW
+#define WszRegQueryStringValueEx RegQueryValueExW
+
+#ifndef FEATURE_CORECLR
+#define WszRegDeleteKey RegDeleteKeyW
+#define WszRegCreateKeyEx ClrRegCreateKeyEx
+#define WszRegSetValueEx RegSetValueExW
+#define WszRegDeleteValue RegDeleteValueW
+#define WszRegLoadKey RegLoadKeyW
+#define WszRegUnLoadKey RegUnLoadKeyW
+#define WszRegRestoreKey RegRestoreKeyW
+#define WszRegReplaceKey RegReplaceKeyW
+#endif //#ifndef FEATURE_CORECLR
+
+#define WszRegQueryInfoKey RegQueryInfoKeyW
+#define WszRegEnumValue RegEnumValueW
+#define WszRegEnumKeyEx RegEnumKeyExW
+#define WszGetCalendarInfo GetCalendarInfoW
+#define WszGetDateFormat GetDateFormatW
+#define WszGetTimeFormat GetTimeFormatW
+#define WszLCMapString LCMapStringW
+#define WszMultiByteToWideChar MultiByteToWideChar
+#define WszWideCharToMultiByte WideCharToMultiByte
+#define WszCreateSemaphore CreateSemaphoreW
+#define WszQueryActCtxW QueryActCtxW
+
+// winnetwk.h
+#define WszWNetGetConnection WNetGetConnectionW
+
+#ifdef FEATURE_CORESYSTEM
+
+// CoreSystem has CreateSemaphoreExW but not CreateSemaphoreW.
+#undef WszCreateSemaphore
+#define WszCreateSemaphore(_secattr, _count, _maxcount, _name) CreateSemaphoreExW((_secattr), (_count), (_maxcount), (_name), 0, SEMAPHORE_ALL_ACCESS)
+
+// Same deal as above for GetFileVersionInfo/GetFileVersionInfoSize.
+#undef GetFileVersionInfo
+#define GetFileVersionInfo(_filename, _handle, _len, _data) GetFileVersionInfoEx(0, (_filename), (_handle), (_len), (_data))
+#undef GetFileVersionInfoSize
+#define GetFileVersionInfoSize(_filename, _handle) GetFileVersionInfoSizeEx(0, (_filename), (_handle))
+
+#endif // FEATURE_CORESYSTEM
+
+#ifndef _T
+#define _T(str) W(str)
+#endif
+
+// on win98 and higher
+#define Wszlstrlen lstrlenW
+#define Wszlstrcpy lstrcpyW
+#define Wszlstrcat lstrcatW
+
+//File and Directory Functions which need special handling for LongFile Names
+//Note only the functions which are currently used are defined
+#define WszLoadLibrary LoadLibraryExWrapper
+#define WszLoadLibraryEx LoadLibraryExWrapper
+#define WszCreateFile CreateFileWrapper
+#define WszSetFileAttributes SetFileAttributesWrapper
+#define WszGetFileAttributes GetFileAttributesWrapper
+#define WszGetFileAttributesEx GetFileAttributesExWrapper
+#define WszDeleteFile DeleteFileWrapper
+#define WszFindFirstFileEx FindFirstFileExWrapper
+#define WszFindNextFile FindNextFileW
+#define WszCopyFile CopyFileWrapper
+#define WszCopyFileEx CopyFileExWrapper
+#define WszMoveFileEx MoveFileExWrapper
+#define WszMoveFile(lpExistingFileName, lpNewFileName) WszMoveFileEx(lpExistingFileName, lpNewFileName, 0)
+#define WszCreateDirectory CreateDirectoryWrapper
+#define WszRemoveDirectory RemoveDirectoryWrapper
+#define WszCreateHardLink CreateHardLinkWrapper
+
+//Can not use extended syntax
+#define WszGetFullPathName GetFullPathNameW
+
+//Long Files will not work on these till redstone
+#define WszGetCurrentDirectory GetCurrentDirectoryWrapper
+#define WszGetTempFileName GetTempFileNameWrapper
+#define WszGetTempPath GetTempPathWrapper
+
+//APIS which have a buffer as an out parameter
+#define WszGetEnvironmentVariable GetEnvironmentVariableWrapper
+#define WszSearchPath SearchPathWrapper
+#define WszGetShortPathName GetShortPathNameWrapper
+#define WszGetLongPathName GetLongPathNameWrapper
+#define WszGetModuleFileName GetModuleFileNameWrapper
+
+//NOTE: IF the following API's are enabled ensure that they can work with LongFile Names
+//See the usage and implementation of above API's
+//
+//#define WszGetCompressedFileSize GetCompressedFileSizeW
+//#define WszMoveFileWithProgress MoveFileWithProgressW
+//#define WszEncryptFile EncryptFileW
+//#define WszDecryptFile DecryptFileW
+//#define WszSetFileSecurity SetFileSecurityW
+//#define WszGetFileSecurity GetFileSecurityW
+//#define WszFindFirstChangeNotification FindFirstChangeNotificationW
+//#define WszSetDllDirectory SetDllDirectoryW
+//#define WszSetCurrentDirectory SetCurrentDirectoryW
+//#define WszCreateDirectoryEx CreateDirectoryExW
+//#define WszCreateSymbolicLink CreateSymbolicLinkW
+//#define WszGetBinaryType GetBinaryTypeWrapper //Coresys does not seem to have this API
+
+#if FEATURE_PAL
+#define WszFindFirstFile FindFirstFileW
+#else
+#define WszFindFirstFile(_lpFileName_, _lpFindData_) FindFirstFileExWrapper(_lpFileName_, FindExInfoStandard, _lpFindData_, FindExSearchNameMatch, NULL, 0)
+#endif //FEATURE_PAL
+//*****************************************************************************
+// Prototypes for API's.
+//*****************************************************************************
+
+extern DWORD g_dwMaxDBCSCharByteSize;
+
+void EnsureCharSetInfoInitialized();
+
+inline DWORD GetMaxDBCSCharByteSize()
+{
+ // contract.h not visible here
+ __annotation(W("WRAPPER ") W("GetMaxDBCSCharByteSize"));
+#ifndef FEATURE_PAL
+ EnsureCharSetInfoInitialized();
+
+ _ASSERTE(g_dwMaxDBCSCharByteSize != 0);
+ return (g_dwMaxDBCSCharByteSize);
+#else // FEATURE_PAL
+ return 3;
+#endif // FEATURE_PAL
+}
+
+#ifndef FEATURE_PAL
+BOOL RunningInteractive();
+#else // !FEATURE_PAL
+#define RunningInteractive() FALSE
+#endif // !FEATURE_PAL
+
+// Determines if the process is running as Local System or as a service. Note that this function uses the
+// process' identity and not the thread's (if the thread is impersonating).
+//
+// If the function succeeds, it returns ERROR_SUCCESS, else it returns the error code returned by GetLastError()
+DWORD RunningAsLocalSystemOrService(OUT BOOL& fIsLocalSystemOrService);
+
+#ifndef Wsz_mbstowcs
+#define Wsz_mbstowcs(szOut, szIn, iSize) WszMultiByteToWideChar(CP_ACP, 0, szIn, -1, szOut, iSize)
+#endif
+
+#ifndef Wsz_wcstombs
+#define Wsz_wcstombs(szOut, szIn, iSize) WszWideCharToMultiByte(CP_ACP, 0, szIn, -1, szOut, iSize, 0, 0)
+#endif
+
+// For all platforms:
+
+BOOL
+WszCreateProcess(
+ LPCWSTR lpApplicationName,
+ LPCWSTR lpCommandLine,
+ LPSECURITY_ATTRIBUTES lpProcessAttributes,
+ LPSECURITY_ATTRIBUTES lpThreadAttributes,
+ BOOL bInheritHandles,
+ DWORD dwCreationFlags,
+ LPVOID lpEnvironment,
+ LPCWSTR lpCurrentDirectory,
+ LPSTARTUPINFOW lpStartupInfo,
+ LPPROCESS_INFORMATION lpProcessInformation
+ );
+
+DWORD
+WszGetWorkingSet(
+ VOID
+ );
+
+SIZE_T WszGetPagefileUsage();
+DWORD WszGetProcessHandleCount();
+
+#if defined(_X86_) && defined(_MSC_VER)
+
+//
+// Windows SDK does not use intrinsics on x86. Redefine the interlocked operations to use intrinsics.
+//
+
+#include "intrin.h"
+
+#define InterlockedIncrement _InterlockedIncrement
+#define InterlockedDecrement _InterlockedDecrement
+#define InterlockedExchange _InterlockedExchange
+#define InterlockedCompareExchange _InterlockedCompareExchange
+#define InterlockedExchangeAdd _InterlockedExchangeAdd
+#define InterlockedCompareExchange64 _InterlockedCompareExchange64
+#define InterlockedAnd _InterlockedAnd
+#define InterlockedOr _InterlockedOr
+
+//
+// There is no _InterlockedCompareExchangePointer intrinsic in VC++ for x86.
+// winbase.h #defines InterlockedCompareExchangePointer as __InlineInterlockedCompareExchangePointer,
+// which calls the Win32 InterlockedCompareExchange, not the intrinsic _InterlockedCompareExchange.
+// We want the intrinsic, so we #undef the Windows version of this API, and define our own.
+//
+#ifdef InterlockedCompareExchangePointer
+#undef InterlockedCompareExchangePointer
+#endif
+
+FORCEINLINE
+PVOID
+InterlockedCompareExchangePointer (
+ __inout PVOID volatile *Destination,
+ __in_opt PVOID ExChange,
+ __in_opt PVOID Comperand
+ )
+{
+ return((PVOID)(LONG_PTR)_InterlockedCompareExchange((LONG volatile *)Destination, (LONG)(LONG_PTR)ExChange, (LONG)(LONG_PTR)Comperand));
+}
+
+#endif // _X86_ && _MSC_VER
+
+#if defined(_ARM_) & !defined(FEATURE_PAL)
+//
+// InterlockedCompareExchangeAcquire/InterlockedCompareExchangeRelease is not mapped in SDK to the correct intrinsics. Remove once
+// the SDK definition is fixed (OS Bug #516255)
+//
+#undef InterlockedCompareExchangeAcquire
+#define InterlockedCompareExchangeAcquire _InterlockedCompareExchange_acq
+#undef InterlockedCompareExchangeRelease
+#define InterlockedCompareExchangeRelease _InterlockedCompareExchange_rel
+#endif
+
+#if defined(_X86_) & !defined(InterlockedIncrement64)
+
+// Interlockedxxx64 that do not have intrinsics are only supported on Windows Server 2003
+// or higher for X86 so define our own portable implementation
+
+#undef InterlockedIncrement64
+#define InterlockedIncrement64 __InterlockedIncrement64
+#undef InterlockedDecrement64
+#define InterlockedDecrement64 __InterlockedDecrement64
+#undef InterlockedExchange64
+#define InterlockedExchange64 __InterlockedExchange64
+#undef InterlockedExchangeAdd64
+#define InterlockedExchangeAdd64 __InterlockedExchangeAdd64
+
+__forceinline LONGLONG __InterlockedIncrement64(LONGLONG volatile *Addend)
+{
+ LONGLONG Old;
+
+ do {
+ Old = *Addend;
+ } while (InterlockedCompareExchange64(Addend,
+ Old + 1,
+ Old) != Old);
+
+ return Old + 1;
+}
+
+__forceinline LONGLONG __InterlockedDecrement64(LONGLONG volatile *Addend)
+{
+ LONGLONG Old;
+
+ do {
+ Old = *Addend;
+ } while (InterlockedCompareExchange64(Addend,
+ Old - 1,
+ Old) != Old);
+
+ return Old - 1;
+}
+
+__forceinline LONGLONG __InterlockedExchange64(LONGLONG volatile * Target, LONGLONG Value)
+{
+ LONGLONG Old;
+
+ do {
+ Old = *Target;
+ } while (InterlockedCompareExchange64(Target,
+ Value,
+ Old) != Old);
+
+ return Old;
+}
+
+__forceinline LONGLONG __InterlockedExchangeAdd64(LONGLONG volatile * Addend, LONGLONG Value)
+{
+ LONGLONG Old;
+
+ do {
+ Old = *Addend;
+ } while (InterlockedCompareExchange64(Addend,
+ Old + Value,
+ Old) != Old);
+
+ return Old;
+}
+
+#endif // _X86_
+
+//
+// RtlVerifyVersionInfo() type mask bits
+// Making our copy of type mask bits as the original
+// macro name are redefined in public\internal\NDP\inc\product_version.h
+//
+//
+#define CLR_VER_MINORVERSION 0x0000001
+#define CLR_VER_MAJORVERSION 0x0000002
+#define CLR_VER_BUILDNUMBER 0x0000004
+#define CLR_VER_PLATFORMID 0x0000008
+#define CLR_VER_SERVICEPACKMINOR 0x0000010
+#define CLR_VER_SERVICEPACKMAJOR 0x0000020
+#define CLR_VER_SUITENAME 0x0000040
+#define CLR_VER_PRODUCT_TYPE 0x0000080
+
+BOOL GetOSVersion(LPOSVERSIONINFOW osVer);
+
+// Output printf-style formatted text to the debugger if it's present or stdout otherwise.
+inline void DbgWPrintf(const LPCWSTR wszFormat, ...)
+{
+ WCHAR wszBuffer[4096];
+
+ va_list args;
+ va_start(args, wszFormat);
+
+ _vsnwprintf_s(wszBuffer, sizeof(wszBuffer) / sizeof(WCHAR), _TRUNCATE, wszFormat, args);
+
+ va_end(args);
+
+ if (IsDebuggerPresent())
+ {
+ OutputDebugStringW(wszBuffer);
+ }
+ else
+ {
+ fwprintf(stdout, W("%s"), wszBuffer);
+ fflush(stdout);
+ }
+}
+
+typedef int (*MessageBoxWFnPtr)(HWND hWnd,
+ LPCWSTR lpText,
+ LPCWSTR lpCaption,
+ UINT uType);
+
+inline int LateboundMessageBoxW(HWND hWnd,
+ LPCWSTR lpText,
+ LPCWSTR lpCaption,
+ UINT uType)
+{
+#ifndef FEATURE_PAL
+ // User32 should exist on all systems where displaying a message box makes sense.
+ HMODULE hGuiExtModule = WszLoadLibrary(W("user32"));
+ if (hGuiExtModule)
+ {
+ int result = IDCANCEL;
+ MessageBoxWFnPtr fnptr = (MessageBoxWFnPtr)GetProcAddress(hGuiExtModule, "MessageBoxW");
+ if (fnptr)
+ result = fnptr(hWnd, lpText, lpCaption, uType);
+
+ FreeLibrary(hGuiExtModule);
+ return result;
+ }
+#endif // !FEATURE_PAL
+
+ // No luck. Output the caption and text to the debugger if present or stdout otherwise.
+ if (lpText == NULL)
+ lpText = W("<null>");
+ if (lpCaption == NULL)
+ lpCaption = W("<null>");
+ DbgWPrintf(W("**** MessageBox invoked, title '%s' ****\n"), lpCaption);
+ DbgWPrintf(W(" %s\n"), lpText);
+ DbgWPrintf(W("********\n"));
+ DbgWPrintf(W("\n"));
+
+ // Indicate to the caller that message box was not actually displayed
+ SetLastError(ERROR_NOT_SUPPORTED);
+ return 0;
+}
+
+inline int LateboundMessageBoxA(HWND hWnd,
+ LPCSTR lpText,
+ LPCSTR lpCaption,
+ UINT uType)
+{
+ if (lpText == NULL)
+ lpText = "<null>";
+ if (lpCaption == NULL)
+ lpCaption = "<null>";
+
+ SIZE_T cchText = strlen(lpText) + 1;
+ LPWSTR wszText = (LPWSTR)_alloca(cchText * sizeof(WCHAR));
+ swprintf_s(wszText, cchText, W("%S"), lpText);
+
+ SIZE_T cchCaption = strlen(lpCaption) + 1;
+ LPWSTR wszCaption = (LPWSTR)_alloca(cchCaption * sizeof(WCHAR));
+ swprintf_s(wszCaption, cchCaption, W("%S"), lpCaption);
+
+ return LateboundMessageBoxW(hWnd, wszText, wszCaption, uType);
+}
+
+#if defined(FEATURE_CORESYSTEM) && !defined(CROSSGEN_COMPILE)
+
+#define MessageBoxW LateboundMessageBoxW
+#define MessageBoxA LateboundMessageBoxA
+
+#endif // FEATURE_CORESYSTEM
+
+#endif // __WIN_WRAP_H__
diff --git a/src/inc/xclrdata.idl b/src/inc/xclrdata.idl
new file mode 100644
index 0000000000..952aea4378
--- /dev/null
+++ b/src/inc/xclrdata.idl
@@ -0,0 +1,2538 @@
+// 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.
+/*****************************************************************************
+ ** **
+ ** clrdata.idl - Common Language Runtime data access interfaces for **
+ ** clients needing to access runtime state from outside **
+ ** runtime, such as out-of-process debuggers. **
+ ** **
+ ** The access interface defines two different types of code running: **
+ ** The host is the user of the access interface. **
+ ** The target is the target of the access. **
+ ** **
+ ** The host and target can be have different instruction sets, **
+ ** pointer sizes, runtime versions and so on. **
+ ** **
+ *****************************************************************************/
+
+import "clrdata.idl";
+
+cpp_quote("#if 0")
+
+typedef UINT32 mdToken;
+typedef mdToken mdTypeDef;
+typedef mdToken mdMethodDef;
+typedef mdToken mdFieldDef;
+
+typedef ULONG CorElementType;
+
+#define EXCEPTION_MAXIMUM_PARAMETERS 15 // maximum number of exception parameters
+
+// The following definition is pasted in from winnt.h, which doesn't
+// import cleanly as a whole.
+typedef struct _EXCEPTION_RECORD64 {
+ DWORD ExceptionCode;
+ DWORD ExceptionFlags;
+ DWORD64 ExceptionRecord;
+ DWORD64 ExceptionAddress;
+ DWORD NumberParameters;
+ DWORD __unusedAlignment;
+ DWORD64 ExceptionInformation[EXCEPTION_MAXIMUM_PARAMETERS];
+} EXCEPTION_RECORD64, *PEXCEPTION_RECORD64;
+
+cpp_quote("#endif")
+
+/* ------------------------------------------------------------------------- *
+ * Forward declarations.
+ * ------------------------------------------------------------------------- */
+
+/*
+ * The following interfaces (with an "IX" prefix instead of the conventional
+ * "I") are works in progress. They will change at least once before Whidbey
+ * ships.
+ */
+
+#pragma warning(push)
+#pragma warning(disable:28718) //Unable to annotate as this is not a local interface
+
+interface IXCLRDataProcess;
+interface IXCLRDataAppDomain;
+interface IXCLRDataAssembly;
+interface IXCLRDataModule;
+interface IXCLRDataModule2;
+
+interface IXCLRDataTypeDefinition;
+interface IXCLRDataTypeInstance;
+interface IXCLRDataMethodDefinition;
+interface IXCLRDataMethodInstance;
+
+interface IXCLRDataTask;
+interface IXCLRDataStackWalk;
+interface IXCLRDataFrame;
+interface IXCLRDataFrame2;
+
+interface IXCLRDataExceptionState;
+interface IXCLRDataExceptionNotification;
+
+interface IXCLRDataValue;
+
+interface IXCLRDataTarget3;
+
+interface IXCLRDataDisplay;
+
+#pragma warning(pop)
+
+typedef struct
+{
+ CLRDATA_ADDRESS startAddress;
+ CLRDATA_ADDRESS endAddress;
+} CLRDATA_ADDRESS_RANGE;
+
+/*
+ * Many enumerators are based on an opaque state bundle.
+ */
+typedef ULONG64 CLRDATA_ENUM;
+
+/*
+ * Exception code used for notifications in this interface.
+ */
+cpp_quote("#define CLRDATA_NOTIFY_EXCEPTION 0xe0444143")
+
+/*
+ * General requests shared by two or more interfaces.
+ */
+
+typedef enum
+{
+ CLRDATA_REQUEST_REVISION = 0xe0000000,
+} CLRDataGeneralRequest;
+
+/*
+ * The following three sets of flags share
+ * many common definitions are so are
+ * grouped into a block.
+ */
+
+typedef enum
+{
+ CLRDATA_TYPE_DEFAULT = 0x00000000,
+
+ // Identify particular kinds of types. These flags
+ // are shared between type, field and value.
+ CLRDATA_TYPE_IS_PRIMITIVE = 0x00000001,
+ CLRDATA_TYPE_IS_VALUE_TYPE = 0x00000002,
+ CLRDATA_TYPE_IS_STRING = 0x00000004,
+ CLRDATA_TYPE_IS_ARRAY = 0x00000008,
+ CLRDATA_TYPE_IS_REFERENCE = 0x00000010,
+ CLRDATA_TYPE_IS_POINTER = 0x00000020,
+ CLRDATA_TYPE_IS_ENUM = 0x00000040,
+
+ // Alias for all field kinds.
+ CLRDATA_TYPE_ALL_KINDS = 0x7f,
+} CLRDataTypeFlag;
+
+typedef enum
+{
+ CLRDATA_FIELD_DEFAULT = 0x00000000,
+
+ // Identify particular kinds of types. These flags
+ // are shared between type, field and value.
+ CLRDATA_FIELD_IS_PRIMITIVE = CLRDATA_TYPE_IS_PRIMITIVE,
+ CLRDATA_FIELD_IS_VALUE_TYPE = CLRDATA_TYPE_IS_VALUE_TYPE,
+ CLRDATA_FIELD_IS_STRING = CLRDATA_TYPE_IS_STRING,
+ CLRDATA_FIELD_IS_ARRAY = CLRDATA_TYPE_IS_ARRAY,
+ CLRDATA_FIELD_IS_REFERENCE = CLRDATA_TYPE_IS_REFERENCE,
+ CLRDATA_FIELD_IS_POINTER = CLRDATA_TYPE_IS_POINTER,
+ CLRDATA_FIELD_IS_ENUM = CLRDATA_TYPE_IS_ENUM,
+
+ // Alias for all field kinds.
+ CLRDATA_FIELD_ALL_KINDS = CLRDATA_TYPE_ALL_KINDS,
+
+ // Identify field properties. These flags are
+ // shared between field and value.
+ CLRDATA_FIELD_IS_INHERITED = 0x00000080,
+ CLRDATA_FIELD_IS_LITERAL = 0x00000100,
+
+ // Identify field storage location. These flags are
+ // shared between field and value.
+ CLRDATA_FIELD_FROM_INSTANCE = 0x00000200,
+ CLRDATA_FIELD_FROM_TASK_LOCAL = 0x00000400,
+ CLRDATA_FIELD_FROM_STATIC = 0x00000800,
+
+ // Alias for all types of field locations.
+ CLRDATA_FIELD_ALL_LOCATIONS = 0x00000e00,
+ // Alias for all fields from all locations.
+ CLRDATA_FIELD_ALL_FIELDS = 0x00000eff,
+} CLRDataFieldFlag;
+
+typedef enum
+{
+ CLRDATA_VALUE_DEFAULT = 0x00000000,
+
+ // Identify particular kinds of types. These flags
+ // are shared between type, field and value.
+ CLRDATA_VALUE_IS_PRIMITIVE = CLRDATA_TYPE_IS_PRIMITIVE,
+ CLRDATA_VALUE_IS_VALUE_TYPE = CLRDATA_TYPE_IS_VALUE_TYPE,
+ CLRDATA_VALUE_IS_STRING = CLRDATA_TYPE_IS_STRING,
+ CLRDATA_VALUE_IS_ARRAY = CLRDATA_TYPE_IS_ARRAY,
+ CLRDATA_VALUE_IS_REFERENCE = CLRDATA_TYPE_IS_REFERENCE,
+ CLRDATA_VALUE_IS_POINTER = CLRDATA_TYPE_IS_POINTER,
+ CLRDATA_VALUE_IS_ENUM = CLRDATA_TYPE_IS_ENUM,
+
+ // Alias for all value kinds.
+ CLRDATA_VALUE_ALL_KINDS = CLRDATA_TYPE_ALL_KINDS,
+
+ // Identify field properties. These flags are
+ // shared between field and value.
+ CLRDATA_VALUE_IS_INHERITED = CLRDATA_FIELD_IS_INHERITED,
+ CLRDATA_VALUE_IS_LITERAL = CLRDATA_FIELD_IS_LITERAL,
+
+ // Identify field storage location. These flags are
+ // shared between field and value.
+ CLRDATA_VALUE_FROM_INSTANCE = CLRDATA_FIELD_FROM_INSTANCE,
+ CLRDATA_VALUE_FROM_TASK_LOCAL = CLRDATA_FIELD_FROM_TASK_LOCAL,
+ CLRDATA_VALUE_FROM_STATIC = CLRDATA_FIELD_FROM_STATIC,
+
+ // Alias for all types of field locations.
+ CLRDATA_VALUE_ALL_LOCATIONS = CLRDATA_FIELD_ALL_LOCATIONS,
+ // Alias for all fields from all locations.
+ CLRDATA_VALUE_ALL_FIELDS = CLRDATA_FIELD_ALL_FIELDS,
+
+ // Identify whether the value is a boxed object.
+ CLRDATA_VALUE_IS_BOXED = 0x00001000,
+} CLRDataValueFlag;
+
+[
+ object,
+ local,
+ uuid(59d9b5e1-4a6f-4531-84c3-51d12da22fd4),
+ pointer_default(unique)
+]
+interface IXCLRDataTarget3 : ICLRDataTarget2
+{
+ /*
+ * Ask the target to recover metadata for
+ * an image. May not succeed.
+ */
+ HRESULT GetMetaData([in] LPCWSTR imagePath,
+ [in] ULONG32 imageTimestamp,
+ [in] ULONG32 imageSize,
+ [in] GUID* mvid,
+ [in] ULONG32 mdRva,
+ [in] ULONG32 flags,
+ [in] ULONG32 bufferSize,
+ [out, size_is(bufferSize), length_is(*dataSize)]
+ BYTE* buffer,
+ [out] ULONG32* dataSize);
+};
+
+/*
+ * Flags used for *ByName methods.
+ */
+typedef enum
+{
+ CLRDATA_BYNAME_CASE_SENSITIVE = 0x00000000,
+ CLRDATA_BYNAME_CASE_INSENSITIVE = 0x00000001,
+} CLRDataByNameFlag;
+
+/*
+ * Flags used in GetName methods.
+ */
+typedef enum
+{
+ CLRDATA_GETNAME_DEFAULT = 0x00000000,
+ CLRDATA_GETNAME_NO_NAMESPACES = 0x00000001,
+ CLRDATA_GETNAME_NO_PARAMETERS = 0x00000002,
+} CLRDataGetNameFlag;
+
+typedef enum
+{
+ CLRDATA_PROCESS_DEFAULT = 0x00000000,
+ CLRDATA_PROCESS_IN_GC = 0x00000001,
+} CLRDataProcessFlag;
+
+typedef enum
+{
+ CLRDATA_ADDRESS_UNRECOGNIZED,
+ CLRDATA_ADDRESS_MANAGED_METHOD,
+ CLRDATA_ADDRESS_RUNTIME_MANAGED_CODE,
+ CLRDATA_ADDRESS_RUNTIME_UNMANAGED_CODE,
+ CLRDATA_ADDRESS_GC_DATA,
+ CLRDATA_ADDRESS_RUNTIME_MANAGED_STUB,
+ CLRDATA_ADDRESS_RUNTIME_UNMANAGED_STUB,
+} CLRDataAddressType;
+
+typedef enum
+{
+ CLRDATA_NOTIFY_ON_MODULE_LOAD = 0x00000001,
+ CLRDATA_NOTIFY_ON_MODULE_UNLOAD = 0x00000002,
+ CLRDATA_NOTIFY_ON_EXCEPTION = 0x00000004,
+ CLRDATA_NOTIFY_ON_EXCEPTION_CATCH_ENTER = 0x00000008,
+} CLRDataOtherNotifyFlag;
+
+/*
+ * Data buffer and flags for follow-stub data.
+ */
+
+typedef struct
+{
+ ULONG64 Data[8];
+} CLRDATA_FOLLOW_STUB_BUFFER;
+
+typedef enum
+{
+ CLRDATA_FOLLOW_STUB_DEFAULT = 0x00000000,
+} CLRDataFollowStubInFlag;
+
+typedef enum
+{
+ CLRDATA_FOLLOW_STUB_INTERMEDIATE = 0x00000000,
+ CLRDATA_FOLLOW_STUB_EXIT = 0x00000001,
+} CLRDataFollowStubOutFlag;
+
+typedef enum
+{
+ CLRNATIVEIMAGE_PE_INFO = 0x00000001,
+ CLRNATIVEIMAGE_COR_INFO = 0x00000002,
+ CLRNATIVEIMAGE_FIXUP_TABLES = 0x00000004,
+ CLRNATIVEIMAGE_FIXUP_HISTOGRAM = 0x00000008,
+ CLRNATIVEIMAGE_MODULE = 0x00000010,
+ CLRNATIVEIMAGE_METHODS = 0x00000020,
+ CLRNATIVEIMAGE_DISASSEMBLE_CODE = 0x00000040,
+ CLRNATIVEIMAGE_IL = 0x00000080,
+ CLRNATIVEIMAGE_METHODTABLES = 0x00000100,
+ CLRNATIVEIMAGE_NATIVE_INFO = 0x00000200,
+ CLRNATIVEIMAGE_MODULE_TABLES = 0x00000400,
+ CLRNATIVEIMAGE_FROZEN_SEGMENT = 0x00000800,
+ CLRNATIVEIMAGE_PE_FILE = 0x00001000,
+ CLRNATIVEIMAGE_GC_INFO = 0x00002000,
+ CLRNATIVEIMAGE_EECLASSES = 0x00004000,
+ CLRNATIVEIMAGE_NATIVE_TABLES = 0x00008000,
+ CLRNATIVEIMAGE_PRECODES = 0x00010000,
+ CLRNATIVEIMAGE_TYPEDESCS = 0x00020000,
+ CLRNATIVEIMAGE_VERBOSE_TYPES = 0x00040000,
+ CLRNATIVEIMAGE_METHODDESCS = 0x00080000,
+ CLRNATIVEIMAGE_METADATA = 0x00100000,
+ CLRNATIVEIMAGE_DISABLE_NAMES = 0x00200000,
+ CLRNATIVEIMAGE_DISABLE_REBASING = 0x00400000,
+ CLRNATIVEIMAGE_SLIM_MODULE_TBLS = 0x00800000,
+ CLRNATIVEIMAGE_RESOURCES = 0x01000000,
+ CLRNATIVEIMAGE_FILE_OFFSET = 0x02000000,
+ CLRNATIVEIMAGE_DEBUG_TRACE = 0x04000000,
+ CLRNATIVEIMAGE_RELOCATIONS = 0x08000000,
+ CLRNATIVEIMAGE_FIXUP_THUNKS = 0x10000000,
+ CLRNATIVEIMAGE_DEBUG_COVERAGE = 0x80000000
+} CLRNativeImageDumpOptions;
+cpp_quote("#ifdef __cplusplus")
+cpp_quote("inline CLRNativeImageDumpOptions operator|=(CLRNativeImageDumpOptions& lhs, CLRNativeImageDumpOptions rhs) { return (lhs = (CLRNativeImageDumpOptions)( ((unsigned)lhs) | ((unsigned)rhs) )); }")
+cpp_quote("#endif")
+typedef enum
+{
+ CLRDATAHINT_DISPLAY_HINTS_NONE = 0,
+ //array hints 0x000000ff
+ CLRDATAHINT_DISPLAY_ARRAY_AS_TABLE = 0x00000001,
+ CLRDATAHINT_DISPLAY_ARRAY_AS_ARRAY = 0x00000002,
+ CLRDATAHINT_DISPLAY_ARRAY_AS_ARRAY_IDX = 0x00000003, //print idx as field 1
+ CLRDATAHINT_DISPLAY_ARRAY_AS_MAP = 0x00000004,
+ CLRDATAHINT_DISPLAY_ARRAY_HINT_MASK = 0x000000ff,
+
+ //structure hints
+ CLRDATAHINT_DISPLAY_STRUCT_AS_TABLE = 0x00000100,
+ CLRDATAHINT_DISPLAY_STRUCT_HINT_MASK = 0x0000ff00,
+
+ //separate fields with tabs
+ CLRDATAHINT_DISPLAY_SEP_TAB = 0x00000000,
+ //separate fields with spaces
+ CLRDATAHINT_DISPLAY_SEP_SPACE = 0x01000000,
+ //separate first field by a tab, and all other fields with spaces
+ CLRDATAHINT_DISPLAY_SEP_TAB_SPACE = 0x02000000,
+ CLRDATAHINT_DISPLAY_SEP_MASK = 0xff000000,
+} CLRDataDisplayHints;
+
+#pragma warning(push)
+#pragma warning(disable:28718) /* suppress warning for interface IXCLRDataProcess */
+
+/*
+ * This interface supports the loading of dependencies and processing of PE
+ * files for the NativeImageDumper.
+ */
+[
+ object,
+ local,
+ uuid(E5F3039D-2C0C-4230-A69E-12AF1C3E563C)
+]
+interface IXCLRLibrarySupport : IUnknown
+{
+ //loads a dependency. It can fail if the image needs to be relocated.
+ HRESULT LoadHardboundDependency(const WCHAR * name, REFGUID mvid,
+ [out]SIZE_T *loadedBase);
+ HRESULT LoadSoftboundDependency(const WCHAR * name,
+ const BYTE * assemblymetadataBinding,
+ const BYTE * hash, ULONG hashLength,
+ [out]SIZE_T *loadedBase);
+};
+
+interface IXCLRDisassemblySupport;
+typedef SIZE_T (__stdcall *CDSTranslateAddrCB)(IXCLRDisassemblySupport *, CLRDATA_ADDRESS, wchar_t *, SIZE_T, DWORDLONG *);
+typedef SIZE_T (__stdcall *CDSTranslateFixupCB)(IXCLRDisassemblySupport *, CLRDATA_ADDRESS, SIZE_T, wchar_t *, SIZE_T, DWORDLONG *);
+typedef SIZE_T (__stdcall *CDSTranslateConstCB)(IXCLRDisassemblySupport *, DWORD, wchar_t *, SIZE_T);
+typedef SIZE_T (__stdcall *CDSTranslateRegrelCB)(IXCLRDisassemblySupport *, unsigned rega, CLRDATA_ADDRESS, wchar_t *, SIZE_T, DWORD *);
+
+[
+ object,
+ local,
+ uuid(1F0F7134-D3F3-47DE-8E9B-C2FD358A2936)
+]
+interface IXCLRDisassemblySupport : IUnknown
+{
+ HRESULT SetTranslateAddrCallback([in] CDSTranslateAddrCB cb);
+ HRESULT PvClientSet([in] void * pv);
+
+ SIZE_T CbDisassemble(CLRDATA_ADDRESS, const void *, SIZE_T);
+ SIZE_T Cinstruction();
+ BOOL FSelectInstruction(SIZE_T);
+ SIZE_T CchFormatInstr(wchar_t *, SIZE_T);
+ void *PvClient();
+ HRESULT SetTranslateFixupCallback([in]CDSTranslateFixupCB cb);
+ HRESULT SetTranslateConstCallback([in]CDSTranslateConstCB cb);
+ HRESULT SetTranslateRegrelCallback([in]CDSTranslateRegrelCB cb);
+ BOOL TargetIsAddress();
+};
+
+/*
+ * This interface is passed to CLRDataCreateInstance::DumpNativeImage. It
+ * handles display of the logical data in the ngen image.
+ */
+[
+ object,
+ local,
+ uuid(A3C1704A-4559-4a67-8D28-E8F4FE3B3F62)
+]
+interface IXCLRDataDisplay : IUnknown
+{
+ HRESULT ErrorPrintF(const char * const fmt, ...);
+ HRESULT NativeImageDimensions(SIZE_T base, SIZE_T size, DWORD sectionAlign);
+ HRESULT Section(const char * const name, SIZE_T rva, SIZE_T size);
+ HRESULT GetDumpOptions([out] CLRNativeImageDumpOptions * pOptions);
+
+ //Start and end the document
+ HRESULT StartDocument();
+ HRESULT EndDocument();
+
+ //XML-Constructs that do not map to actual fields or structures
+
+ //A category is a top level section of the ngen output. For example,
+ //"Sections", "Directories", "CLR Info", etc.
+ HRESULT StartCategory(const char * const name);
+ HRESULT EndCategory();
+
+ //starts an element containing either xml text or other elements. Only
+ //used within arrays and lists. Otherwise use StartVStructure.
+ HRESULT StartElement(const char * const name);
+ HRESULT EndElement();
+ //like a Structure, but without a name and size. Used within categories
+ //and structures.
+ HRESULT StartVStructure(const char * const name );
+ HRESULT StartVStructureWithOffset( const char * const name,
+ unsigned fieldOffset,
+ unsigned fieldSize );
+ HRESULT EndVStructure();
+
+ //An element that contains xml text.
+ HRESULT StartTextElement(const char * const name);
+ HRESULT EndTextElement();
+ HRESULT WriteXmlText(const char * const fmt, ...);
+ HRESULT WriteXmlTextBlock(const char * const fmt, ...);
+
+ HRESULT WriteEmptyElement(const char * const element);
+
+
+ //produces <element>ptr</element>
+ HRESULT WriteElementPointer(const char * const element, SIZE_T ptr);
+ HRESULT WriteElementPointerAnnotated(const char * const element, SIZE_T ptr,
+ const WCHAR * const annotation );
+ //produces <element base="base" size="size"/>
+ HRESULT WriteElementAddress(const char * const element, SIZE_T base, SIZE_T size);
+ HRESULT WriteElementAddressNamed(const char * const element, const char * const name,
+ SIZE_T base, SIZE_T size);
+ HRESULT WriteElementAddressNamedW(const char * const element, const WCHAR * const name,
+ SIZE_T base, SIZE_T size);
+ HRESULT WriteElementString(const char * const element, const char * const data);
+ HRESULT WriteElementStringW(const char * const element, const WCHAR * const data);
+ HRESULT WriteElementInt(const char * const element, int value);
+ HRESULT WriteElementUInt(const char * const element, DWORD value);
+ HRESULT WriteElementEnumerated(const char * const element, DWORD value,
+ const WCHAR * const mnemonic);
+ //writes <element>value</element> if value != suppressIfEqual.
+ //in text mode the whole element is suppressed (and a "" is appended if
+ //inside an array or list.
+ HRESULT WriteElementIntWithSuppress( const char * const element, int value,
+ int suppressIfEqual );
+ //For text, it produces "(element)" or "" instead of "true" or "false".
+ HRESULT WriteElementFlag(const char * const element, BOOL flag);
+
+ //if countPrefix is not Null, displays a total at the end in text mode.
+ //Arrays have headings in both text and xml. Lists are "repeated elements"
+ HRESULT StartArray( const char * const name, const WCHAR * const fmt);
+ HRESULT EndArray( const char * const countPrefix );
+ HRESULT StartList( const WCHAR * const fmt );
+ HRESULT EndList();
+
+ //XML-Constructs that represent real C++ Data structure
+ HRESULT StartArrayWithOffset( const char * const name, unsigned fieldOffset,
+ unsigned fieldSize, const WCHAR * const fmt );
+#if 0
+
+ //writes <element>value</element> if value != suppressIfEqual.
+ //in text mode the whole element is suppressed (and a "" is appended if
+ //inside an array or list.
+ HRESULT WriteFieldIntWithSuppress( const char * const element, unsigned offset,
+ int value, int suppressIfEqual );
+#endif
+
+ HRESULT WriteFieldString(const char * const element, unsigned fieldOffset,
+ unsigned fieldSize, const char * const data);
+ HRESULT WriteFieldStringW(const char * const element, unsigned fieldOffset,
+ unsigned fieldSize, const WCHAR * const data);
+ //produces <element>ptr</element>
+ HRESULT WriteFieldPointer(const char * const element, unsigned fieldOffset,
+ unsigned fieldSize, SIZE_T ptr);
+ //produces <element>ptr+size</element>
+ HRESULT WriteFieldPointerWithSize(const char * const element,
+ unsigned fieldOffset, unsigned fieldSize,
+ SIZE_T ptr, SIZE_T size);
+ HRESULT WriteFieldInt(const char * const element, unsigned fieldOffset,
+ unsigned fieldSize, int value);
+ HRESULT WriteFieldUInt(const char * const element, unsigned fieldOffset,
+ unsigned fieldSize, DWORD value);
+ HRESULT WriteFieldEnumerated(const char * const element, unsigned fieldOffset,
+ unsigned fieldSize, DWORD value,
+ const WCHAR * const mnemonic);
+ HRESULT WriteFieldEmpty(const char * const element, unsigned fieldOffset,
+ unsigned fieldSize);
+ HRESULT WriteFieldFlag(const char * const element, unsigned fieldOffset,
+ unsigned fieldSize, BOOL flag);
+ HRESULT WriteFieldPointerAnnotated(const char * const element,
+ unsigned fieldOffset, unsigned fieldSize,
+ SIZE_T ptr, const WCHAR * const annotation);
+
+ //produces <element base="base" size="size"/>
+ HRESULT WriteFieldAddress(const char * const element, unsigned fieldOffset,
+ unsigned fieldSize, SIZE_T base, SIZE_T size);
+ //For text, it produces "(element)" or "" instead of "true" or "false".
+#if 0
+ HRESULT WriteFieldFlag(const char * const element, unsigned offset, BOOL flag);
+ HRESULT WriteFieldInt(const char * const element, unsigned offset, int value);
+ HRESULT WriteFieldUInt(const char * const element, unsigned offset, DWORD value);
+
+
+ HRESULT WriteFieldEnumerated(const char * const element, unsigned offset,
+ DWORD value, const WCHAR * const mnemonic);
+#endif
+ //structures are like categories and elements, but they have a base and
+ //size.
+ HRESULT StartStructure( const char * const name, SIZE_T ptr, SIZE_T size );
+ HRESULT StartStructureWithNegSpace( const char * const name, SIZE_T ptr,
+ SIZE_T startPtr, SIZE_T totalSize );
+ HRESULT StartStructureWithOffset( const char * const name, unsigned fieldOffset,
+ unsigned fieldSize, SIZE_T ptr,
+ SIZE_T size );
+ HRESULT EndStructure();
+#if 0
+ //produces <element>ptr+size</element>
+ HRESULT WriteElementPointerWithSize(const char * const element, SIZE_T ptr,
+ SIZE_T size);
+ HRESULT WriteElementInt(const char * const element, int value);
+
+
+ HRESULT WriteFixupDescription(SIZE_T ptr, DWORD tagged, SIZE_T handle,
+ const char * const name );
+
+
+ //structures are like categories and elements, but they have a base and
+ //size.
+ HRESULT StartStructure( const char * const name, SIZE_T ptr, SIZE_T size );
+ HRESULT EndStructure();
+
+#endif
+};
+
+/*
+ * Interface representing the process itself. Can be obtained via
+ * CLRDataCreateInstance.
+ */
+[
+ object,
+ local,
+ uuid(5c552ab6-fc09-4cb3-8e36-22fa03c798b7)
+]
+interface IXCLRDataProcess : IUnknown
+{
+ /*
+ * Flush any cached data for this process. All ICLR* interfaces obtained
+ * for this process will become invalid with this call.
+ */
+ HRESULT Flush();
+
+ /*
+ * Begin enumeration of tasks.
+ * Returns S_FALSE if the enumeration is empty.
+ */
+ HRESULT StartEnumTasks([out] CLRDATA_ENUM* handle);
+
+ /*
+ * Get the next entry in the enumeration.
+ * Returns S_FALSE if there isn't a next entry.
+ */
+ HRESULT EnumTask([in, out] CLRDATA_ENUM* handle,
+ [out] IXCLRDataTask** task);
+
+ /*
+ * Release the enumerator.
+ */
+ HRESULT EndEnumTasks([in] CLRDATA_ENUM handle);
+
+ /*
+ * Get the managed task running on the given OS thread ID
+ */
+ HRESULT GetTaskByOSThreadID([in] ULONG32 osThreadID,
+ [out] IXCLRDataTask** task);
+
+ /*
+ * Get the managed task corresponding to the given task ID.
+ */
+ HRESULT GetTaskByUniqueID([in] ULONG64 taskID,
+ [out] IXCLRDataTask** task);
+
+ /*
+ * Get state flags, defined in CLRDataProcessFlag.
+ */
+ HRESULT GetFlags([out] ULONG32* flags);
+
+ /*
+ * Determine whether the given interface represents
+ * the same target state.
+ */
+ HRESULT IsSameObject([in] IXCLRDataProcess* process);
+
+ /*
+ * Get the managed object representing the process.
+ */
+ HRESULT GetManagedObject([out] IXCLRDataValue** value);
+
+ /*
+ * Mark the process so that it attempts to reach the
+ * desired execution state the next time it executes.
+ */
+ HRESULT GetDesiredExecutionState([out] ULONG32* state);
+ HRESULT SetDesiredExecutionState([in] ULONG32 state);
+
+ /*
+ * Return an indicator of the type of data referred
+ * to by the given address.
+ */
+ HRESULT GetAddressType([in] CLRDATA_ADDRESS address,
+ [out] CLRDataAddressType* type);
+
+ /*
+ * Get a name for the given address if
+ * the address refers to non-managed-method information.
+ * Method names can be retrieved by using GetMethodInstanceByAddress
+ * and GetName on the method instance.
+ *
+ * Returns S_FALSE if the buffer is not large enough for the name,
+ * and sets nameLen to be the buffer length needed.
+ */
+ HRESULT GetRuntimeNameByAddress([in] CLRDATA_ADDRESS address,
+ [in] ULONG32 flags,
+ [in] ULONG32 bufLen,
+ [out] ULONG32 *nameLen,
+ [out, size_is(bufLen)] WCHAR nameBuf[],
+ [out] CLRDATA_ADDRESS* displacement);
+
+ /*
+ * App domain enumeration.
+ */
+ HRESULT StartEnumAppDomains([out] CLRDATA_ENUM* handle);
+ HRESULT EnumAppDomain([in, out] CLRDATA_ENUM* handle,
+ [out] IXCLRDataAppDomain** appDomain);
+ HRESULT EndEnumAppDomains([in] CLRDATA_ENUM handle);
+
+ /*
+ * Find an app domain by its unique ID.
+ */
+ HRESULT GetAppDomainByUniqueID([in] ULONG64 id,
+ [out] IXCLRDataAppDomain** appDomain);
+
+ /*
+ * Assembly enumeration.
+ */
+ HRESULT StartEnumAssemblies([out] CLRDATA_ENUM* handle);
+ HRESULT EnumAssembly([in, out] CLRDATA_ENUM* handle,
+ [out] IXCLRDataAssembly **assembly);
+ HRESULT EndEnumAssemblies([in] CLRDATA_ENUM handle);
+
+ /*
+ * Module enumeration.
+ */
+ HRESULT StartEnumModules([out] CLRDATA_ENUM* handle);
+ HRESULT EnumModule([in, out] CLRDATA_ENUM* handle,
+ [out] IXCLRDataModule **mod);
+ HRESULT EndEnumModules([in] CLRDATA_ENUM handle);
+
+ /*
+ * Look up a module by address.
+ */
+ HRESULT GetModuleByAddress([in] CLRDATA_ADDRESS address,
+ [out] IXCLRDataModule** mod);
+
+ /*
+ * Look up method instances by native code address.
+ */
+ HRESULT StartEnumMethodInstancesByAddress([in] CLRDATA_ADDRESS address,
+ [in] IXCLRDataAppDomain* appDomain,
+ [out] CLRDATA_ENUM* handle);
+ HRESULT EnumMethodInstanceByAddress([in] CLRDATA_ENUM* handle,
+ [out] IXCLRDataMethodInstance** method);
+ HRESULT EndEnumMethodInstancesByAddress([in] CLRDATA_ENUM handle);
+
+ /*
+ * Look up the name and value of a piece of data by its address.
+ */
+ HRESULT GetDataByAddress([in] CLRDATA_ADDRESS address,
+ [in] ULONG32 flags,
+ [in] IXCLRDataAppDomain* appDomain,
+ [in] IXCLRDataTask* tlsTask,
+ [in] ULONG32 bufLen,
+ [out] ULONG32 *nameLen,
+ [out, size_is(bufLen)] WCHAR nameBuf[],
+ [out] IXCLRDataValue** value,
+ [out] CLRDATA_ADDRESS* displacement);
+
+ /*
+ * Get managed state, if any, for the given system exception.
+ * OBSOLETE, DO NOT USE.
+ */
+ HRESULT GetExceptionStateByExceptionRecord([in] EXCEPTION_RECORD64* record,
+ [out] IXCLRDataExceptionState **exState);
+
+ /*
+ * Translate a system exception record into
+ * a particular kind of notification if possible.
+ */
+ HRESULT TranslateExceptionRecordToNotification([in] EXCEPTION_RECORD64* record,
+ [in] IXCLRDataExceptionNotification* notify);
+
+ HRESULT Request([in] ULONG32 reqCode,
+ [in] ULONG32 inBufferSize,
+ [in, size_is(inBufferSize)] BYTE* inBuffer,
+ [in] ULONG32 outBufferSize,
+ [out, size_is(outBufferSize)] BYTE* outBuffer);
+
+ /*
+ * Create a simple value based on the given
+ * type and address information.
+ */
+ HRESULT CreateMemoryValue([in] IXCLRDataAppDomain* appDomain,
+ [in] IXCLRDataTask* tlsTask,
+ [in] IXCLRDataTypeInstance* type,
+ [in] CLRDATA_ADDRESS addr,
+ [out] IXCLRDataValue** value);
+
+ /*
+ * Update all existing notifications for a module.
+ * If module is NULL all modules are affected.
+ */
+ HRESULT SetAllTypeNotifications(IXCLRDataModule* mod,
+ ULONG32 flags);
+ HRESULT SetAllCodeNotifications(IXCLRDataModule* mod,
+ ULONG32 flags);
+
+ /*
+ * Request notification when a type is
+ * loaded or unloaded.
+ * If mods is NULL singleMod is used as
+ * the module for all tokens.
+ * If flags is NULL singleFlags is used as
+ * the flags for all tokens.
+ */
+ HRESULT GetTypeNotifications([in] ULONG32 numTokens,
+ [in, size_is(numTokens)]
+ IXCLRDataModule* mods[],
+ [in] IXCLRDataModule* singleMod,
+ [in, size_is(numTokens)] mdTypeDef tokens[],
+ [out, size_is(numTokens)] ULONG32 flags[]);
+ HRESULT SetTypeNotifications([in] ULONG32 numTokens,
+ [in, size_is(numTokens)]
+ IXCLRDataModule* mods[],
+ [in] IXCLRDataModule* singleMod,
+ [in, size_is(numTokens)] mdTypeDef tokens[],
+ [in, size_is(numTokens)] ULONG32 flags[],
+ [in] ULONG32 singleFlags);
+
+ /*
+ * Request notification when code is generated or
+ * discarded for a method.
+ * If mods is NULL singleMod is used as
+ * the module for all tokens.
+ * If flags is NULL singleFlags is used as
+ * the flags for all tokens.
+ */
+ HRESULT GetCodeNotifications([in] ULONG32 numTokens,
+ [in, size_is(numTokens)]
+ IXCLRDataModule* mods[],
+ [in] IXCLRDataModule* singleMod,
+ [in, size_is(numTokens)] mdMethodDef tokens[],
+ [out, size_is(numTokens)] ULONG32 flags[]);
+ HRESULT SetCodeNotifications([in] ULONG32 numTokens,
+ [in, size_is(numTokens)]
+ IXCLRDataModule* mods[],
+ [in] IXCLRDataModule* singleMod,
+ [in, size_is(numTokens)] mdMethodDef tokens[],
+ [in, size_is(numTokens)] ULONG32 flags[],
+ [in] ULONG32 singleFlags);
+
+ /*
+ * Control notifications other than code and
+ * type notifications.
+ */
+ HRESULT GetOtherNotificationFlags([out] ULONG32* flags);
+ HRESULT SetOtherNotificationFlags([in] ULONG32 flags);
+
+ /*
+ * Look up method definitions by IL code address.
+ */
+ HRESULT StartEnumMethodDefinitionsByAddress([in] CLRDATA_ADDRESS address,
+ [out] CLRDATA_ENUM* handle);
+ HRESULT EnumMethodDefinitionByAddress([in] CLRDATA_ENUM* handle,
+ [out] IXCLRDataMethodDefinition** method);
+ HRESULT EndEnumMethodDefinitionsByAddress([in] CLRDATA_ENUM handle);
+
+ /*
+ * Given an address which is a CLR stub
+ * (and potentially state from a previous follow)
+ * determine the next execution address at which
+ * to check whether the stub has been exited.
+ * OBSOLETE: Use FollowStub2.
+ */
+ HRESULT FollowStub([in] ULONG32 inFlags,
+ [in] CLRDATA_ADDRESS inAddr,
+ [in] CLRDATA_FOLLOW_STUB_BUFFER* inBuffer,
+ [out] CLRDATA_ADDRESS* outAddr,
+ [out] CLRDATA_FOLLOW_STUB_BUFFER* outBuffer,
+ [out] ULONG32* outFlags);
+
+ /* Requires revision 7. */
+ HRESULT FollowStub2([in] IXCLRDataTask* task,
+ [in] ULONG32 inFlags,
+ [in] CLRDATA_ADDRESS inAddr,
+ [in] CLRDATA_FOLLOW_STUB_BUFFER* inBuffer,
+ [out] CLRDATA_ADDRESS* outAddr,
+ [out] CLRDATA_FOLLOW_STUB_BUFFER* outBuffer,
+ [out] ULONG32* outFlags);
+ HRESULT DumpNativeImage([in] CLRDATA_ADDRESS loadedBase,
+ [in] LPCWSTR name,
+ [in] IXCLRDataDisplay* display,
+ [in] IXCLRLibrarySupport* libSupport,
+ [in] IXCLRDisassemblySupport* dis);
+}
+#pragma warning(pop)
+
+/*
+ * Types used in IXCLRDataProcess2 and IXCLRDataExceptionNotification3
+ */
+
+typedef enum
+{
+ GC_MARK_END = 1,
+ GC_EVENT_TYPE_MAX,
+} GcEvt_t;
+
+typedef struct
+{
+ GcEvt_t typ;
+
+ [switch_is(typ)]
+ union
+ {
+ [case(GC_MARK_END)]
+ int condemnedGeneration;
+ };
+} GcEvtArgs;
+
+
+[
+ object,
+ local,
+ uuid(5c552ab6-fc09-4cb3-8e36-22fa03c798b8)
+]
+interface IXCLRDataProcess2 : IXCLRDataProcess
+{
+ /*
+ * Request notification when a GC is triggered.
+ * GcEvtArgs specifies exactly which GC events
+ * are of interest.
+ */
+ /*
+ * On entry gcEvtArgs is a mask, specifying all events of
+ * interest, in accordance with GcNotification::IsMatch
+ * On exit it represents the first entry matching the input.
+ */
+ HRESULT GetGcNotification([in, out] GcEvtArgs* gcEvtArgs);
+ HRESULT SetGcNotification([in] GcEvtArgs gcEvtArgs);
+}
+
+typedef enum
+{
+ CLRDATA_DOMAIN_DEFAULT = 0x00000000,
+} CLRDataAppDomainFlag;
+
+#pragma warning(push)
+#pragma warning(disable:28718) /* suppress warning 28718 for interface IXCLRDataAppDomain */
+[
+ object,
+ local,
+ uuid(7CA04601-C702-4670-A63C-FA44F7DA7BD5)
+]
+interface IXCLRDataAppDomain : IUnknown
+{
+ /*
+ * Get the process that contains this app domain.
+ */
+ HRESULT GetProcess([out] IXCLRDataProcess** process);
+
+ /*
+ * Get the app domain's name.
+ */
+ HRESULT GetName([in] ULONG32 bufLen,
+ [out] ULONG32 *nameLen,
+ [out, size_is(bufLen)] WCHAR name[]);
+
+ /*
+ * Get a unique, stable identifier for this object.
+ */
+ HRESULT GetUniqueID([out] ULONG64* id);
+
+ /*
+ * Get state flags, defined in CLRDataAppDomainFlag.
+ */
+ HRESULT GetFlags([out] ULONG32* flags);
+
+ /*
+ * Determine whether the given interface represents
+ * the same target state.
+ */
+ HRESULT IsSameObject([in] IXCLRDataAppDomain* appDomain);
+
+ /*
+ * Get the managed object representing the app domain.
+ */
+ HRESULT GetManagedObject([out] IXCLRDataValue** value);
+
+ HRESULT Request([in] ULONG32 reqCode,
+ [in] ULONG32 inBufferSize,
+ [in, size_is(inBufferSize)] BYTE* inBuffer,
+ [in] ULONG32 outBufferSize,
+ [out, size_is(outBufferSize)] BYTE* outBuffer);
+}
+#pragma warning(pop)
+
+typedef enum
+{
+ CLRDATA_ASSEMBLY_DEFAULT = 0x00000000,
+} CLRDataAssemblyFlag;
+
+#pragma warning(push)
+#pragma warning(disable:28718)
+[
+ object,
+ local,
+ uuid(2FA17588-43C2-46ab-9B51-C8F01E39C9AC)
+]
+interface IXCLRDataAssembly : IUnknown
+{
+ /*
+ * Enumerate modules in the assembly.
+ */
+ HRESULT StartEnumModules([out] CLRDATA_ENUM* handle);
+ HRESULT EnumModule([in, out] CLRDATA_ENUM* handle,
+ [out] IXCLRDataModule **mod);
+ HRESULT EndEnumModules([in] CLRDATA_ENUM handle);
+
+ /*
+ * Get the assembly's base name.
+ */
+ HRESULT GetName([in] ULONG32 bufLen,
+ [out] ULONG32 *nameLen,
+ [out, size_is(bufLen)] WCHAR name[]);
+
+ /*
+ * Get the full path and filename for the assembly,
+ * if there is one.
+ */
+ HRESULT GetFileName([in] ULONG32 bufLen,
+ [out] ULONG32 *nameLen,
+ [out, size_is(bufLen)] WCHAR name[]);
+
+ /*
+ * Get state flags, defined in CLRDataAssemblyFlag.
+ */
+ HRESULT GetFlags([out] ULONG32* flags);
+
+ /*
+ * Determine whether the given interface represents
+ * the same target state.
+ */
+ HRESULT IsSameObject([in] IXCLRDataAssembly* assembly);
+
+ HRESULT Request([in] ULONG32 reqCode,
+ [in] ULONG32 inBufferSize,
+ [in, size_is(inBufferSize)] BYTE* inBuffer,
+ [in] ULONG32 outBufferSize,
+ [out, size_is(outBufferSize)] BYTE* outBuffer);
+
+ /*
+ * Enumerate the app domains using this assembly.
+ */
+ HRESULT StartEnumAppDomains([out] CLRDATA_ENUM* handle);
+ HRESULT EnumAppDomain([in, out] CLRDATA_ENUM* handle,
+ [out] IXCLRDataAppDomain** appDomain);
+ HRESULT EndEnumAppDomains([in] CLRDATA_ENUM handle);
+
+ /*
+ * Get the metadata display name for the assembly.
+ * Requires revision 2.
+ */
+ HRESULT GetDisplayName([in] ULONG32 bufLen,
+ [out] ULONG32 *nameLen,
+ [out, size_is(bufLen)] WCHAR name[]);
+}
+#pragma warning(pop)
+
+typedef enum
+{
+ CLRDATA_MODULE_DEFAULT = 0x00000000,
+ CLRDATA_MODULE_IS_DYNAMIC = 0x00000001,
+ CLRDATA_MODULE_IS_MEMORY_STREAM = 0x00000002,
+} CLRDataModuleFlag;
+
+typedef enum
+{
+ CLRDATA_MODULE_PE_FILE,
+ CLRDATA_MODULE_PREJIT_FILE,
+ CLRDATA_MODULE_MEMORY_STREAM,
+ CLRDATA_MODULE_OTHER
+} CLRDataModuleExtentType;
+
+typedef struct
+{
+ CLRDATA_ADDRESS base;
+ ULONG32 length;
+ CLRDataModuleExtentType type;
+} CLRDATA_MODULE_EXTENT;
+
+typedef enum
+{
+ CLRDATA_TYPENOTIFY_NONE = 0x00000000,
+ CLRDATA_TYPENOTIFY_LOADED = 0x00000001,
+ CLRDATA_TYPENOTIFY_UNLOADED = 0x00000002,
+} CLRDataTypeNotification;
+
+typedef enum
+{
+ CLRDATA_METHNOTIFY_NONE = 0x00000000,
+ CLRDATA_METHNOTIFY_GENERATED = 0x00000001,
+ CLRDATA_METHNOTIFY_DISCARDED = 0x00000002,
+} CLRDataMethodCodeNotification;
+
+#pragma warning(push)
+#pragma warning(disable:28718)
+/*
+ * Represents a loaded module.
+ *
+ * Can be QI'd for a metadata interface or a symbol-store interface.
+ */
+[
+ object,
+ local,
+ uuid(88E32849-0A0A-4cb0-9022-7CD2E9E139E2)
+]
+interface IXCLRDataModule : IUnknown
+{
+ /*
+ * Enumerate assemblies this module is part of.
+ * Module-to-assembly is an enumeration as a
+ * shared module might be part of more than one assembly.
+ */
+ HRESULT StartEnumAssemblies([out] CLRDATA_ENUM* handle);
+ HRESULT EnumAssembly([in, out] CLRDATA_ENUM* handle,
+ [out] IXCLRDataAssembly **assembly);
+ HRESULT EndEnumAssemblies([in] CLRDATA_ENUM handle);
+
+ /*
+ * Enumerate types in this module.
+ */
+ HRESULT StartEnumTypeDefinitions([out] CLRDATA_ENUM* handle);
+ HRESULT EnumTypeDefinition([in, out] CLRDATA_ENUM* handle,
+ [out] IXCLRDataTypeDefinition **typeDefinition);
+ HRESULT EndEnumTypeDefinitions([in] CLRDATA_ENUM handle);
+
+ HRESULT StartEnumTypeInstances([in] IXCLRDataAppDomain* appDomain,
+ [out] CLRDATA_ENUM* handle);
+ HRESULT EnumTypeInstance([in, out] CLRDATA_ENUM* handle,
+ [out] IXCLRDataTypeInstance **typeInstance);
+ HRESULT EndEnumTypeInstances([in] CLRDATA_ENUM handle);
+
+ /*
+ * Look up types by name.
+ */
+ HRESULT StartEnumTypeDefinitionsByName([in] LPCWSTR name,
+ [in] ULONG32 flags,
+ [out] CLRDATA_ENUM* handle);
+ HRESULT EnumTypeDefinitionByName([in,out] CLRDATA_ENUM* handle,
+ [out] IXCLRDataTypeDefinition** type);
+ HRESULT EndEnumTypeDefinitionsByName([in] CLRDATA_ENUM handle);
+
+ HRESULT StartEnumTypeInstancesByName([in] LPCWSTR name,
+ [in] ULONG32 flags,
+ [in] IXCLRDataAppDomain* appDomain,
+ [out] CLRDATA_ENUM* handle);
+ HRESULT EnumTypeInstanceByName([in,out] CLRDATA_ENUM* handle,
+ [out] IXCLRDataTypeInstance** type);
+ HRESULT EndEnumTypeInstancesByName([in] CLRDATA_ENUM handle);
+
+ /*
+ * Get a type definition by metadata token.
+ */
+ HRESULT GetTypeDefinitionByToken([in] mdTypeDef token,
+ [out] IXCLRDataTypeDefinition** typeDefinition);
+
+ /*
+ * Look up methods by name.
+ */
+ HRESULT StartEnumMethodDefinitionsByName([in] LPCWSTR name,
+ [in] ULONG32 flags,
+ [out] CLRDATA_ENUM* handle);
+ HRESULT EnumMethodDefinitionByName([in,out] CLRDATA_ENUM* handle,
+ [out] IXCLRDataMethodDefinition** method);
+ HRESULT EndEnumMethodDefinitionsByName([in] CLRDATA_ENUM handle);
+
+ HRESULT StartEnumMethodInstancesByName([in] LPCWSTR name,
+ [in] ULONG32 flags,
+ [in] IXCLRDataAppDomain* appDomain,
+ [out] CLRDATA_ENUM* handle);
+ HRESULT EnumMethodInstanceByName([in,out] CLRDATA_ENUM* handle,
+ [out] IXCLRDataMethodInstance** method);
+ HRESULT EndEnumMethodInstancesByName([in] CLRDATA_ENUM handle);
+
+ /*
+ * Get a method definition by metadata token.
+ */
+ HRESULT GetMethodDefinitionByToken([in] mdMethodDef token,
+ [out] IXCLRDataMethodDefinition** methodDefinition);
+
+ /*
+ * Look up pieces of data by name.
+ */
+ HRESULT StartEnumDataByName([in] LPCWSTR name,
+ [in] ULONG32 flags,
+ [in] IXCLRDataAppDomain* appDomain,
+ [in] IXCLRDataTask* tlsTask,
+ [out] CLRDATA_ENUM* handle);
+ HRESULT EnumDataByName([in,out] CLRDATA_ENUM* handle,
+ [out] IXCLRDataValue** value);
+ HRESULT EndEnumDataByName([in] CLRDATA_ENUM handle);
+
+ /*
+ * Get the module's base name.
+ */
+ HRESULT GetName([in] ULONG32 bufLen,
+ [out] ULONG32 *nameLen,
+ [out, size_is(bufLen)] WCHAR name[]);
+
+ /*
+ * Get the full path and filename for the module,
+ * if there is one.
+ */
+ HRESULT GetFileName([in] ULONG32 bufLen,
+ [out] ULONG32 *nameLen,
+ [out, size_is(bufLen)] WCHAR name[]);
+
+ /*
+ * Get state flags, defined in CLRDataModuleFlag.
+ */
+ HRESULT GetFlags([out] ULONG32* flags);
+
+ /*
+ * Determine whether the given interface represents
+ * the same target state.
+ */
+ HRESULT IsSameObject([in] IXCLRDataModule* mod);
+
+ /*
+ * Get the memory regions associated with this module.
+ */
+ HRESULT StartEnumExtents([out] CLRDATA_ENUM* handle);
+ HRESULT EnumExtent([in, out] CLRDATA_ENUM* handle,
+ [out] CLRDATA_MODULE_EXTENT* extent);
+ HRESULT EndEnumExtents([in] CLRDATA_ENUM handle);
+
+ HRESULT Request([in] ULONG32 reqCode,
+ [in] ULONG32 inBufferSize,
+ [in, size_is(inBufferSize)] BYTE* inBuffer,
+ [in] ULONG32 outBufferSize,
+ [out, size_is(outBufferSize)] BYTE* outBuffer);
+
+ /*
+ * Enumerate the app domains using this module.
+ */
+ HRESULT StartEnumAppDomains([out] CLRDATA_ENUM* handle);
+ HRESULT EnumAppDomain([in, out] CLRDATA_ENUM* handle,
+ [out] IXCLRDataAppDomain** appDomain);
+ HRESULT EndEnumAppDomains([in] CLRDATA_ENUM handle);
+
+ /*
+ * Get the module's version ID.
+ * Requires revision 3.
+ */
+ HRESULT GetVersionId([out] GUID* vid);
+}
+#pragma warning(pop)
+
+
+/*
+ * Represents additional APIs for a loaded module.
+ *
+ */
+[
+ object,
+ local,
+ uuid(34625881-7EB3-4524-817B-8DB9D064C760)
+]
+interface IXCLRDataModule2 : IUnknown
+{
+ /*
+ * SetJITCompilerFlags sets the flags that control the JIT compiler. If the set of flags is invalid,
+ * the function will fail. This function can only be called from within the LoadModule callback
+ * for the given module.
+ */
+ HRESULT SetJITCompilerFlags( [in] DWORD dwFlags );
+}
+
+#pragma warning(push)
+#pragma warning(disable:28718) /* suppress warning 28718 for interface IXCLRDataTypeDefinition */
+[
+ object,
+ local,
+ uuid(4675666C-C275-45b8-9F6C-AB165D5C1E09)
+]
+interface IXCLRDataTypeDefinition : IUnknown
+{
+ /*
+ * Get the module this type is part of.
+ */
+ HRESULT GetModule([out] IXCLRDataModule **mod);
+
+ /*
+ * Enumerate the methods for this type.
+ */
+ HRESULT StartEnumMethodDefinitions([out] CLRDATA_ENUM* handle);
+ HRESULT EnumMethodDefinition([in, out] CLRDATA_ENUM* handle,
+ [out] IXCLRDataMethodDefinition **methodDefinition);
+ HRESULT EndEnumMethodDefinitions([in] CLRDATA_ENUM handle);
+
+ /*
+ * Look up methods by name.
+ */
+ HRESULT StartEnumMethodDefinitionsByName([in] LPCWSTR name,
+ [in] ULONG32 flags,
+ [out] CLRDATA_ENUM* handle);
+ HRESULT EnumMethodDefinitionByName([in,out] CLRDATA_ENUM* handle,
+ [out] IXCLRDataMethodDefinition** method);
+ HRESULT EndEnumMethodDefinitionsByName([in] CLRDATA_ENUM handle);
+
+ /*
+ * Get a method definition by metadata token.
+ */
+ HRESULT GetMethodDefinitionByToken([in] mdMethodDef token,
+ [out] IXCLRDataMethodDefinition** methodDefinition);
+
+ /*
+ * Enumerate instances of this definition.
+ */
+ HRESULT StartEnumInstances([in] IXCLRDataAppDomain* appDomain,
+ [out] CLRDATA_ENUM* handle);
+ HRESULT EnumInstance([in, out] CLRDATA_ENUM* handle,
+ [out] IXCLRDataTypeInstance **instance);
+ HRESULT EndEnumInstances([in] CLRDATA_ENUM handle);
+
+ /*
+ * Get the namespace-qualified name for this type definition.
+ */
+ HRESULT GetName([in] ULONG32 flags,
+ [in] ULONG32 bufLen,
+ [out] ULONG32 *nameLen,
+ [out, size_is(bufLen)] WCHAR nameBuf[]);
+
+ /*
+ * Get the metadata token and scope.
+ */
+ HRESULT GetTokenAndScope([out] mdTypeDef* token,
+ [out] IXCLRDataModule **mod);
+
+ /*
+ * Get standard element type.
+ */
+ HRESULT GetCorElementType([out] CorElementType* type);
+
+ /*
+ * Get state flags, defined in CLRDataTypeFlag.
+ */
+ HRESULT GetFlags([out] ULONG32* flags);
+
+ /*
+ * Determine whether the given interface represents
+ * the same target state.
+ */
+ HRESULT IsSameObject([in] IXCLRDataTypeDefinition* type);
+
+ HRESULT Request([in] ULONG32 reqCode,
+ [in] ULONG32 inBufferSize,
+ [in, size_is(inBufferSize)] BYTE* inBuffer,
+ [in] ULONG32 outBufferSize,
+ [out, size_is(outBufferSize)] BYTE* outBuffer);
+
+ /*
+ * If this is an array type, return the number
+ * of dimensions in the array.
+ */
+ HRESULT GetArrayRank([out] ULONG32* rank);
+
+ /*
+ * Get the base type of this type, if any.
+ */
+ HRESULT GetBase([out] IXCLRDataTypeDefinition** base);
+
+ /*
+ * Get the number of fields in the type.
+ */
+ HRESULT GetNumFields([in] ULONG32 flags,
+ [out] ULONG32* numFields);
+
+ /*
+ * Enumerate the fields for this type.
+ * OBSOLETE: Use EnumField2.
+ */
+ HRESULT StartEnumFields([in] ULONG32 flags,
+ [out] CLRDATA_ENUM* handle);
+ HRESULT EnumField([in, out] CLRDATA_ENUM* handle,
+ [in] ULONG32 nameBufLen,
+ [out] ULONG32* nameLen,
+ [out, size_is(nameBufLen)] WCHAR nameBuf[],
+ [out] IXCLRDataTypeDefinition** type,
+ [out] ULONG32* flags,
+ [out] mdFieldDef* token);
+ HRESULT EndEnumFields([in] CLRDATA_ENUM handle);
+
+ HRESULT StartEnumFieldsByName([in] LPCWSTR name,
+ [in] ULONG32 nameFlags,
+ [in] ULONG32 fieldFlags,
+ [out] CLRDATA_ENUM* handle);
+ HRESULT EnumFieldByName([in, out] CLRDATA_ENUM* handle,
+ [out] IXCLRDataTypeDefinition** type,
+ [out] ULONG32* flags,
+ [out] mdFieldDef* token);
+ HRESULT EndEnumFieldsByName([in] CLRDATA_ENUM handle);
+
+ /*
+ * Look up information for a specific field by token.
+ */
+ HRESULT GetFieldByToken([in] mdFieldDef token,
+ [in] ULONG32 nameBufLen,
+ [out] ULONG32* nameLen,
+ [out, size_is(nameBufLen)] WCHAR nameBuf[],
+ [out] IXCLRDataTypeDefinition** type,
+ [out] ULONG32* flags);
+
+ /*
+ * Request notification when the given type is
+ * loaded or unloaded.
+ */
+ HRESULT GetTypeNotification([out] ULONG32* flags);
+ HRESULT SetTypeNotification([in] ULONG32 flags);
+
+ HRESULT EnumField2([in, out] CLRDATA_ENUM* handle,
+ [in] ULONG32 nameBufLen,
+ [out] ULONG32* nameLen,
+ [out, size_is(nameBufLen)] WCHAR nameBuf[],
+ [out] IXCLRDataTypeDefinition** type,
+ [out] ULONG32* flags,
+ [out] IXCLRDataModule** tokenScope,
+ [out] mdFieldDef* token);
+ HRESULT EnumFieldByName2([in, out] CLRDATA_ENUM* handle,
+ [out] IXCLRDataTypeDefinition** type,
+ [out] ULONG32* flags,
+ [out] IXCLRDataModule** tokenScope,
+ [out] mdFieldDef* token);
+ HRESULT GetFieldByToken2([in] IXCLRDataModule* tokenScope,
+ [in] mdFieldDef token,
+ [in] ULONG32 nameBufLen,
+ [out] ULONG32* nameLen,
+ [out, size_is(nameBufLen)] WCHAR nameBuf[],
+ [out] IXCLRDataTypeDefinition** type,
+ [out] ULONG32* flags);
+}
+#pragma warning(pop)
+
+#pragma warning(push)
+#pragma warning(disable:28718)
+[
+ object,
+ local,
+ uuid(4D078D91-9CB3-4b0d-97AC-28C8A5A82597)
+]
+interface IXCLRDataTypeInstance : IUnknown
+{
+ /*
+ * Enumerate method instances within this type.
+ */
+ HRESULT StartEnumMethodInstances([out] CLRDATA_ENUM* handle);
+ HRESULT EnumMethodInstance([in, out] CLRDATA_ENUM* handle,
+ [out] IXCLRDataMethodInstance** methodInstance);
+ HRESULT EndEnumMethodInstances([in] CLRDATA_ENUM handle);
+
+ /*
+ * Look up method instances by name.
+ */
+ HRESULT StartEnumMethodInstancesByName([in] LPCWSTR name,
+ [in] ULONG32 flags,
+ [out] CLRDATA_ENUM* handle);
+ HRESULT EnumMethodInstanceByName([in,out] CLRDATA_ENUM* handle,
+ [out] IXCLRDataMethodInstance** method);
+ HRESULT EndEnumMethodInstancesByName([in] CLRDATA_ENUM handle);
+
+ /*
+ * Get the number of static fields in the type.
+ * OBSOLETE: Use GetNumStaticFields2.
+ */
+ HRESULT GetNumStaticFields([out] ULONG32* numFields);
+
+ /*
+ * Get one static field of the type.
+ *
+ * Because static field ordering is not fixed, can also return name
+ * information and/or the metadata token, if the caller passes
+ * in appropriate values.
+ * OBSOLETE: Use EnumStaticField.
+ */
+ HRESULT GetStaticFieldByIndex([in] ULONG32 index,
+ [in] IXCLRDataTask* tlsTask,
+ [out] IXCLRDataValue **field,
+ [in] ULONG32 bufLen,
+ [out] ULONG32 *nameLen,
+ [out, size_is(bufLen)] WCHAR nameBuf[],
+ [out] mdFieldDef* token);
+
+ /*
+ * Look up fields by name.
+ * OBSOLETE: Use EnumStaticFieldByName2.
+ */
+ HRESULT StartEnumStaticFieldsByName([in] LPCWSTR name,
+ [in] ULONG32 flags,
+ [in] IXCLRDataTask* tlsTask,
+ [out] CLRDATA_ENUM* handle);
+ HRESULT EnumStaticFieldByName([in,out] CLRDATA_ENUM* handle,
+ [out] IXCLRDataValue** value);
+ HRESULT EndEnumStaticFieldsByName([in] CLRDATA_ENUM handle);
+
+ /*
+ * Enumerate this type's parameterization.
+ */
+ HRESULT GetNumTypeArguments([out] ULONG32* numTypeArgs);
+ HRESULT GetTypeArgumentByIndex([in] ULONG32 index,
+ [out] IXCLRDataTypeInstance** typeArg);
+
+ /*
+ * Get the fully qualified name for this type instance.
+ */
+ HRESULT GetName([in] ULONG32 flags,
+ [in] ULONG32 bufLen,
+ [out] ULONG32 *nameLen,
+ [out, size_is(bufLen)] WCHAR nameBuf[]);
+
+ /*
+ * Get the module for this type instance.
+ */
+ HRESULT GetModule([out] IXCLRDataModule **mod);
+
+ /*
+ * Get the definition matching this instance.
+ */
+ HRESULT GetDefinition([out] IXCLRDataTypeDefinition **typeDefinition);
+
+ /*
+ * Get state flags, defined in CLRDataTypeFlag.
+ */
+ HRESULT GetFlags([out] ULONG32* flags);
+
+ /*
+ * Determine whether the given interface represents
+ * the same target state.
+ */
+ HRESULT IsSameObject([in] IXCLRDataTypeInstance* type);
+
+ HRESULT Request([in] ULONG32 reqCode,
+ [in] ULONG32 inBufferSize,
+ [in, size_is(inBufferSize)] BYTE* inBuffer,
+ [in] ULONG32 outBufferSize,
+ [out, size_is(outBufferSize)] BYTE* outBuffer);
+
+ /*
+ * Get the number of static fields in the type.
+ */
+ HRESULT GetNumStaticFields2([in] ULONG32 flags,
+ [out] ULONG32* numFields);
+
+ /*
+ * Enumerate values for the static fields of this type.
+ */
+ HRESULT StartEnumStaticFields([in] ULONG32 flags,
+ [in] IXCLRDataTask* tlsTask,
+ [out] CLRDATA_ENUM* handle);
+ HRESULT EnumStaticField([in,out] CLRDATA_ENUM* handle,
+ [out] IXCLRDataValue** value);
+ HRESULT EndEnumStaticFields([in] CLRDATA_ENUM handle);
+
+ HRESULT StartEnumStaticFieldsByName2([in] LPCWSTR name,
+ [in] ULONG32 nameFlags,
+ [in] ULONG32 fieldFlags,
+ [in] IXCLRDataTask* tlsTask,
+ [out] CLRDATA_ENUM* handle);
+ HRESULT EnumStaticFieldByName2([in,out] CLRDATA_ENUM* handle,
+ [out] IXCLRDataValue** value);
+ HRESULT EndEnumStaticFieldsByName2([in] CLRDATA_ENUM handle);
+
+ /*
+ * Retrieve a static field by field metadata token.
+ */
+ HRESULT GetStaticFieldByToken([in] mdFieldDef token,
+ [in] IXCLRDataTask* tlsTask,
+ [out] IXCLRDataValue **field,
+ [in] ULONG32 bufLen,
+ [out] ULONG32 *nameLen,
+ [out, size_is(bufLen)] WCHAR nameBuf[]);
+
+ /*
+ * Get the base type of this type, if any.
+ */
+ HRESULT GetBase([out] IXCLRDataTypeInstance** base);
+
+ HRESULT EnumStaticField2([in,out] CLRDATA_ENUM* handle,
+ [out] IXCLRDataValue** value,
+ [in] ULONG32 bufLen,
+ [out] ULONG32 *nameLen,
+ [out, size_is(bufLen)] WCHAR nameBuf[],
+ [out] IXCLRDataModule** tokenScope,
+ [out] mdFieldDef* token);
+ HRESULT EnumStaticFieldByName3([in,out] CLRDATA_ENUM* handle,
+ [out] IXCLRDataValue** value,
+ [out] IXCLRDataModule** tokenScope,
+ [out] mdFieldDef* token);
+ HRESULT GetStaticFieldByToken2([in] IXCLRDataModule* tokenScope,
+ [in] mdFieldDef token,
+ [in] IXCLRDataTask* tlsTask,
+ [out] IXCLRDataValue **field,
+ [in] ULONG32 bufLen,
+ [out] ULONG32 *nameLen,
+ [out, size_is(bufLen)] WCHAR nameBuf[]);
+}
+#pragma warning(pop)
+
+typedef enum
+{
+ CLRDATA_SOURCE_TYPE_INVALID = 0x00, // To indicate that nothing else applies
+} CLRDataSourceType;
+
+/*
+ * Special IL offset values for special regions.
+ */
+typedef enum
+{
+ CLRDATA_IL_OFFSET_NO_MAPPING = -1,
+ CLRDATA_IL_OFFSET_PROLOG = -2,
+ CLRDATA_IL_OFFSET_EPILOG = -3
+} CLRDATA_IL_OFFSET_MARKER;
+
+typedef struct
+{
+ ULONG32 ilOffset;
+ CLRDATA_ADDRESS startAddress;
+ CLRDATA_ADDRESS endAddress;
+ CLRDataSourceType type;
+} CLRDATA_IL_ADDRESS_MAP;
+
+typedef enum
+{
+ CLRDATA_METHOD_DEFAULT = 0x00000000,
+
+ // Method has a 'this' pointer.
+ CLRDATA_METHOD_HAS_THIS = 0x00000001,
+} CLRDataMethodFlag;
+
+typedef enum
+{
+ CLRDATA_METHDEF_IL
+} CLRDataMethodDefinitionExtentType;
+
+typedef struct
+{
+ CLRDATA_ADDRESS startAddress;
+ CLRDATA_ADDRESS endAddress;
+ ULONG32 enCVersion;
+ CLRDataMethodDefinitionExtentType type;
+} CLRDATA_METHDEF_EXTENT;
+
+#pragma warning(push)
+#pragma warning(disable:28718) /* suppress warning 28718 for interface IXCLRDataMethodDefinition */
+[
+ object,
+ local,
+ uuid(AAF60008-FB2C-420b-8FB1-42D244A54A97)
+]
+interface IXCLRDataMethodDefinition : IUnknown
+{
+ /*
+ * Get the type this method is part of.
+ */
+ HRESULT GetTypeDefinition([out] IXCLRDataTypeDefinition **typeDefinition);
+
+ /*
+ * Enumerate instances of this definition.
+ */
+ HRESULT StartEnumInstances([in] IXCLRDataAppDomain* appDomain,
+ [out] CLRDATA_ENUM* handle);
+ HRESULT EnumInstance([in, out] CLRDATA_ENUM* handle,
+ [out] IXCLRDataMethodInstance **instance);
+ HRESULT EndEnumInstances([in] CLRDATA_ENUM handle);
+
+ /*
+ * Get the method's name.
+ */
+ HRESULT GetName([in] ULONG32 flags,
+ [in] ULONG32 bufLen,
+ [out] ULONG32 *nameLen,
+ [out, size_is(bufLen)] WCHAR name[]);
+
+ /*
+ * Get the metadata token and scope.
+ */
+ HRESULT GetTokenAndScope([out] mdMethodDef* token,
+ [out] IXCLRDataModule **mod);
+
+ /*
+ * Get state flags, defined in CLRDataMethodFlag.
+ */
+ HRESULT GetFlags([out] ULONG32* flags);
+
+ /*
+ * Determine whether the given interface represents
+ * the same target state.
+ */
+ HRESULT IsSameObject([in] IXCLRDataMethodDefinition* method);
+
+ /*
+ * Get the latest EnC version of this method.
+ */
+ HRESULT GetLatestEnCVersion([out] ULONG32* version);
+
+ /*
+ * Get the IL code regions associated with this method.
+ */
+ HRESULT StartEnumExtents([out] CLRDATA_ENUM* handle);
+ HRESULT EnumExtent([in, out] CLRDATA_ENUM* handle,
+ [out] CLRDATA_METHDEF_EXTENT* extent);
+ HRESULT EndEnumExtents([in] CLRDATA_ENUM handle);
+
+ /*
+ * Request notification when code is generated or
+ * discarded for the method.
+ */
+ HRESULT GetCodeNotification([out] ULONG32* flags);
+ HRESULT SetCodeNotification([in] ULONG32 flags);
+
+ HRESULT Request([in] ULONG32 reqCode,
+ [in] ULONG32 inBufferSize,
+ [in, size_is(inBufferSize)] BYTE* inBuffer,
+ [in] ULONG32 outBufferSize,
+ [out, size_is(outBufferSize)] BYTE* outBuffer);
+
+ /*
+ * Gets the most representative start address of
+ * the native code for this method.
+ * A method may have multiple entry points, so this
+ * address is not guaranteed to be hit by all entries.
+ * Requires revision 1.
+ */
+ HRESULT GetRepresentativeEntryAddress([out] CLRDATA_ADDRESS* addr);
+
+ HRESULT HasClassOrMethodInstantiation([out] BOOL* bGeneric);
+}
+#pragma warning(pop)
+
+#pragma warning(push)
+#pragma warning(disable:28718) /* suppress warning 28718 for interface IXCLRDataMethodInstance */
+[
+ object,
+ local,
+ uuid(ECD73800-22CA-4b0d-AB55-E9BA7E6318A5)
+]
+interface IXCLRDataMethodInstance : IUnknown
+{
+ /*
+ * Get the type instance for this method.
+ */
+ HRESULT GetTypeInstance([out] IXCLRDataTypeInstance **typeInstance);
+
+ /*
+ * Get the definition that matches this instance.
+ */
+ HRESULT GetDefinition([out] IXCLRDataMethodDefinition **methodDefinition);
+
+ /*
+ * Get the metadata token and scope.
+ */
+ HRESULT GetTokenAndScope([out] mdMethodDef* token,
+ [out] IXCLRDataModule **mod);
+
+ /*
+ * Get the fully qualified name for this method instance.
+ */
+ HRESULT GetName([in] ULONG32 flags,
+ [in] ULONG32 bufLen,
+ [out] ULONG32 *nameLen,
+ [out, size_is(bufLen)] WCHAR nameBuf[]);
+
+ /*
+ * Get state flags, defined in CLRDataMethodFlag.
+ */
+ HRESULT GetFlags([out] ULONG32* flags);
+
+ /*
+ * Determine whether the given interface represents
+ * the same target state.
+ */
+ HRESULT IsSameObject([in] IXCLRDataMethodInstance* method);
+
+ /*
+ * Get the EnC version of this instance.
+ */
+ HRESULT GetEnCVersion([out] ULONG32* version);
+
+ /*
+ * Enumerate this method's parameterization.
+ */
+ HRESULT GetNumTypeArguments([out] ULONG32* numTypeArgs);
+ HRESULT GetTypeArgumentByIndex([in] ULONG32 index,
+ [out] IXCLRDataTypeInstance** typeArg);
+
+ /*
+ * Access the IL <-> address mapping information.
+ */
+ HRESULT GetILOffsetsByAddress([in] CLRDATA_ADDRESS address,
+ [in] ULONG32 offsetsLen,
+ [out] ULONG32 *offsetsNeeded,
+ [out, size_is(offsetsLen)]
+ ULONG32 ilOffsets[]);
+ HRESULT GetAddressRangesByILOffset([in] ULONG32 ilOffset,
+ [in] ULONG32 rangesLen,
+ [out] ULONG32 *rangesNeeded,
+ [out, size_is(rangesLen)]
+ CLRDATA_ADDRESS_RANGE addressRanges[]);
+ HRESULT GetILAddressMap([in] ULONG32 mapLen,
+ [out] ULONG32 *mapNeeded,
+ [out, size_is(mapLen)]
+ CLRDATA_IL_ADDRESS_MAP maps[]);
+
+ /*
+ * Get the native code regions associated with this method.
+ */
+ HRESULT StartEnumExtents([out] CLRDATA_ENUM* handle);
+ HRESULT EnumExtent([in, out] CLRDATA_ENUM* handle,
+ [out] CLRDATA_ADDRESS_RANGE* extent);
+ HRESULT EndEnumExtents([in] CLRDATA_ENUM handle);
+
+ HRESULT Request([in] ULONG32 reqCode,
+ [in] ULONG32 inBufferSize,
+ [in, size_is(inBufferSize)] BYTE* inBuffer,
+ [in] ULONG32 outBufferSize,
+ [out, size_is(outBufferSize)] BYTE* outBuffer);
+
+ /*
+ * Gets the most representative start address of
+ * the native code for this method.
+ * A method may have multiple entry points, so this
+ * address is not guaranteed to be hit by all entries.
+ * Requires revision 1.
+ */
+ HRESULT GetRepresentativeEntryAddress([out] CLRDATA_ADDRESS* addr);
+}
+#pragma warning(pop)
+
+typedef enum
+{
+ CLRDATA_TASK_DEFAULT = 0x00000000,
+ CLRDATA_TASK_WAITING_FOR_GC = 0x00000001,
+} CLRDataTaskFlag;
+
+#pragma warning(push)
+#pragma warning(disable:28718) /* suppress warning 28718 for interface IXCLRDataMethodInstance */
+/*
+ * Interface representing a task (thread or fiber) in the process.
+ */
+[
+ object,
+ local,
+ uuid(A5B0BEEA-EC62-4618-8012-A24FFC23934C)
+]
+interface IXCLRDataTask : IUnknown
+{
+ /*
+ * Get the process for this task.
+ */
+ HRESULT GetProcess([out] IXCLRDataProcess** process);
+
+ /*
+ * Get the application domain that the task is
+ * currently running in. This can change over time.
+ */
+ HRESULT GetCurrentAppDomain([out] IXCLRDataAppDomain **appDomain);
+
+ /*
+ * Get a unique, stable identifier for this task.
+ */
+ HRESULT GetUniqueID([out] ULONG64* id);
+
+ /*
+ * Get state flags, defined in CLRDataTaskFlag.
+ */
+ HRESULT GetFlags([out] ULONG32* flags);
+
+ /*
+ * Determine whether the given interface represents
+ * the same target state.
+ */
+ HRESULT IsSameObject([in] IXCLRDataTask* task);
+
+ /*
+ * Get the managed object representing the task.
+ */
+ HRESULT GetManagedObject([out] IXCLRDataValue** value);
+
+ /*
+ * Mark the task so that it attempts to reach the
+ * given execution state the next time it executes.
+ */
+ HRESULT GetDesiredExecutionState([out] ULONG32* state);
+ HRESULT SetDesiredExecutionState([in] ULONG32 state);
+
+ /*
+ * Create a stack walker to walk this task's stack. The
+ * flags parameter takes a bitfield of values from the
+ * CLRDataSimpleFrameType enum.
+ */
+ HRESULT CreateStackWalk([in] ULONG32 flags,
+ [out] IXCLRDataStackWalk** stackWalk);
+
+ /*
+ * Get the current OS thread ID for this task. If this task is on a fiber,
+ * the ID may change over time.
+ */
+ HRESULT GetOSThreadID([out] ULONG32* id);
+
+ /*
+ * Get the current context for this task, controlled by the given flags.
+ * Returns S_FALSE if the size is not large enough.
+ */
+ HRESULT GetContext([in] ULONG32 contextFlags,
+ [in] ULONG32 contextBufSize,
+ [out] ULONG32* contextSize,
+ [out, size_is(contextBufSize)] BYTE contextBuf[]);
+
+ /*
+ * Destructively set the current context for this task.
+ */
+ HRESULT SetContext([in] ULONG32 contextSize,
+ [in, size_is(contextSize)] BYTE context[]);
+
+ /*
+ * Get the current exception state for the
+ * task, if any. This may be the first element
+ * in a list of exception states if there are
+ * nested exceptions.
+ */
+ HRESULT GetCurrentExceptionState([out] IXCLRDataExceptionState **exception);
+
+ HRESULT Request([in] ULONG32 reqCode,
+ [in] ULONG32 inBufferSize,
+ [in, size_is(inBufferSize)] BYTE* inBuffer,
+ [in] ULONG32 outBufferSize,
+ [out, size_is(outBufferSize)] BYTE* outBuffer);
+
+ /*
+ * Get the task's name if it has one.
+ * Requires revision 1.
+ */
+ HRESULT GetName([in] ULONG32 bufLen,
+ [out] ULONG32 *nameLen,
+ [out, size_is(bufLen)] WCHAR name[]);
+
+ /*
+ * Get the last exception state for the
+ * task, if any. If an exception is currently
+ * being processed the last exception state may
+ * be the same as the current exception state.
+ * Requires revision 2.
+ */
+ HRESULT GetLastExceptionState([out] IXCLRDataExceptionState **exception);
+}
+#pragma warning(pop)
+
+typedef enum
+{
+ /* Frame not recognized */
+ CLRDATA_SIMPFRAME_UNRECOGNIZED = 0x1,
+
+ /* Frame corresponds to a managed method */
+ CLRDATA_SIMPFRAME_MANAGED_METHOD = 0x2,
+
+ /* Frame corresponds to runtime-controlled managed code */
+ CLRDATA_SIMPFRAME_RUNTIME_MANAGED_CODE = 0x4,
+
+ /* Frame corresponds to runtime-controlled unmanaged code */
+ CLRDATA_SIMPFRAME_RUNTIME_UNMANAGED_CODE = 0x8
+} CLRDataSimpleFrameType;
+
+typedef enum
+{
+ /* These are tentative values...they will likely change as
+ * implementation progresses. */
+ CLRDATA_DETFRAME_UNRECOGNIZED,
+ CLRDATA_DETFRAME_UNKNOWN_STUB,
+ CLRDATA_DETFRAME_CLASS_INIT,
+ CLRDATA_DETFRAME_EXCEPTION_FILTER,
+ CLRDATA_DETFRAME_SECURITY,
+ CLRDATA_DETFRAME_CONTEXT_POLICY,
+ CLRDATA_DETFRAME_INTERCEPTION,
+ CLRDATA_DETFRAME_PROCESS_START,
+ CLRDATA_DETFRAME_THREAD_START,
+ CLRDATA_DETFRAME_TRANSITION_TO_MANAGED,
+ CLRDATA_DETFRAME_TRANSITION_TO_UNMANAGED,
+ CLRDATA_DETFRAME_COM_INTEROP_STUB,
+ CLRDATA_DETFRAME_DEBUGGER_EVAL,
+ CLRDATA_DETFRAME_CONTEXT_SWITCH,
+ CLRDATA_DETFRAME_FUNC_EVAL,
+ CLRDATA_DETFRAME_FINALLY
+ /* There will be others */
+} CLRDataDetailedFrameType;
+
+/*
+ * StackWalk requests.
+ */
+
+typedef enum
+{
+ CLRDATA_STACK_WALK_REQUEST_SET_FIRST_FRAME = 0xe1000000,
+} CLRDataStackWalkRequest;
+
+/*
+ * SetContext flags.
+ */
+
+typedef enum
+{
+ /* Context being set is the result of stack unwinding. */
+ CLRDATA_STACK_SET_UNWIND_CONTEXT = 0x00000000,
+ /* Context being set is the "current" context. */
+ CLRDATA_STACK_SET_CURRENT_CONTEXT = 0x00000001,
+} CLRDataStackSetContextFlag;
+
+/*
+ * Stack-walker interface.
+ */
+[
+ object,
+ local,
+ uuid(E59D8D22-ADA7-49a2-89B5-A415AFCFC95F)
+]
+interface IXCLRDataStackWalk : IUnknown
+{
+ /*
+ * Get the current context of this stack walk.
+ * This is the original context with any unwinding
+ * applied to it. As unwinding may only restore
+ * a subset of the registers, such as only non-volatile
+ * registers, the context may not exactly match the
+ * register state at the time of the actual call.
+ */
+ HRESULT GetContext([in] ULONG32 contextFlags,
+ [in] ULONG32 contextBufSize,
+ [out] ULONG32* contextSize,
+ [out, size_is(contextBufSize)] BYTE contextBuf[]);
+
+ /*
+ * Change the current context of this stack walk, allowing the
+ * debugger to move it to an arbitrary context. Does not actually
+ * alter the current context of the thread whose stack is being walked.
+ * OBSOLETE: Use SetContext2.
+ */
+ HRESULT SetContext([in] ULONG32 contextSize,
+ [in, size_is(contextSize)] BYTE context[]);
+
+ /*
+ * Attempt to advance the stack walk to the next frame that
+ * matches the stack walk's filter. If the current frame type is
+ * CLRDATA_UNRECOGNIZED_FRAME, Next() will be unable to
+ * advance. (The debugger will have to walk the unrecognized frame
+ * itself, reset the walk's context, and try again.)
+ *
+ * Upon creation, the stack walk is positioned "before" the first
+ * frame on the stack. Debuggers must call Next() to advance to
+ * the first frame before any other functions will work. The
+ * function will output S_FALSE when there are no more frames that
+ * meet its filter criteria.
+ */
+ HRESULT Next();
+
+ /*
+ * Return the number of bytes skipped by the last call to Next().
+ * If Next() moved to the very next frame, outputs 0.
+ *
+ * Note that calling GetStackSizeSkipped() after any function other
+ * than Next() has no meaning.
+ */
+ HRESULT GetStackSizeSkipped([out] ULONG64* stackSizeSkipped);
+
+ /*
+ * Return information about the type of the current frame
+ */
+ HRESULT GetFrameType([out] CLRDataSimpleFrameType* simpleType,
+ [out] CLRDataDetailedFrameType* detailedType);
+
+ /*
+ * Return the current frame, if it is recognized.
+ */
+ HRESULT GetFrame([out] IXCLRDataFrame** frame);
+
+ HRESULT Request([in] ULONG32 reqCode,
+ [in] ULONG32 inBufferSize,
+ [in, size_is(inBufferSize)] BYTE* inBuffer,
+ [in] ULONG32 outBufferSize,
+ [out, size_is(outBufferSize)] BYTE* outBuffer);
+
+ /*
+ * Change the current context of this stack walk, allowing the
+ * debugger to move it to an arbitrary context. Does not actually
+ * alter the current context of the thread whose stack is being walked.
+ */
+ HRESULT SetContext2([in] ULONG32 flags,
+ [in] ULONG32 contextSize,
+ [in, size_is(contextSize)] BYTE context[]);
+}
+
+#pragma warning(push)
+#pragma warning(disable:28718) /* suppress warning 28718 for interface IXCLRDataFrame */
+[
+ object,
+ local,
+ uuid(271498C2-4085-4766-BC3A-7F8ED188A173)
+]
+interface IXCLRDataFrame : IUnknown
+{
+ /*
+ * Return information about the type of this frame.
+ */
+ HRESULT GetFrameType([out] CLRDataSimpleFrameType* simpleType,
+ [out] CLRDataDetailedFrameType* detailedType);
+
+ /*
+ * Get the stack walk context as of this frame.
+ * This is the original context with any unwinding
+ * applied to it. As unwinding may only restore
+ * a subset of the registers, such as only non-volatile
+ * registers, the context may not exactly match the
+ * register state at the time of the actual call.
+ */
+ HRESULT GetContext([in] ULONG32 contextFlags,
+ [in] ULONG32 contextBufSize,
+ [out] ULONG32* contextSize,
+ [out, size_is(contextBufSize)] BYTE contextBuf[]);
+
+ /*
+ * Return the app domain of this frame
+ */
+ HRESULT GetAppDomain([out] IXCLRDataAppDomain** appDomain);
+
+ /*
+ * Return the number of arguments on the stack.
+ */
+ HRESULT GetNumArguments([out] ULONG32* numArgs);
+
+ /*
+ * Return an argument by (0-based) index.
+ * The name parameter is filled in if name information is availble.
+ */
+ HRESULT GetArgumentByIndex([in] ULONG32 index,
+ [out] IXCLRDataValue** arg,
+ [in] ULONG32 bufLen,
+ [out] ULONG32 *nameLen,
+ [out, size_is(bufLen)] WCHAR name[]);
+
+ /*
+ * Return the number of local variables on the stack.
+ */
+ HRESULT GetNumLocalVariables([out] ULONG32* numLocals);
+
+ /*
+ * Return a local variable by (0-based) index.
+ * The name parameter is filled in if name information is availble.
+ */
+ HRESULT GetLocalVariableByIndex([in] ULONG32 index,
+ [out] IXCLRDataValue** localVariable,
+ [in] ULONG32 bufLen,
+ [out] ULONG32 *nameLen,
+ [out, size_is(bufLen)] WCHAR name[]);
+
+ /*
+ * Get a name for the frame's current instruction pointer.
+ * This is either a method's name or a runtime code name.
+ *
+ * Returns S_FALSE if the buffer is not large enough for the name,
+ * and sets nameLen to be the buffer length needed.
+ */
+ HRESULT GetCodeName([in] ULONG32 flags,
+ [in] ULONG32 bufLen,
+ [out] ULONG32 *nameLen,
+ [out, size_is(bufLen)] WCHAR nameBuf[]);
+
+ /*
+ * Gets the method instance corresponding to this frame.
+ */
+ HRESULT GetMethodInstance([out] IXCLRDataMethodInstance** method);
+
+ HRESULT Request([in] ULONG32 reqCode,
+ [in] ULONG32 inBufferSize,
+ [in, size_is(inBufferSize)] BYTE* inBuffer,
+ [in] ULONG32 outBufferSize,
+ [out, size_is(outBufferSize)] BYTE* outBuffer);
+
+ /*
+ * Enumerate the full parameterization of the frame's
+ * type and method.
+ */
+ HRESULT GetNumTypeArguments([out] ULONG32* numTypeArgs);
+ HRESULT GetTypeArgumentByIndex([in] ULONG32 index,
+ [out] IXCLRDataTypeInstance** typeArg);
+}
+#pragma warning(pop)
+
+[
+ object,
+ local,
+ uuid(1C4D9A4B-702D-4CF6-B290-1DB6F43050D0)
+]
+interface IXCLRDataFrame2 : IUnknown
+{
+ /*
+ * Retun generic token if available.
+ */
+ HRESULT GetExactGenericArgsToken([out] IXCLRDataValue** genericToken);
+}
+
+typedef enum
+{
+ CLRDATA_EXCEPTION_DEFAULT = 0x00000000,
+
+ // Exception is occurring during processing
+ // of other exception states.
+ CLRDATA_EXCEPTION_NESTED = 0x00000001,
+
+ // Exception state is not completely available.
+ // This can happen when the state is no longer
+ // active or before a state is fully initialized.
+ CLRDATA_EXCEPTION_PARTIAL = 0x00000002,
+} CLRDataExceptionStateFlag;
+
+typedef enum
+{
+ CLRDATA_EXBASE_EXCEPTION,
+ CLRDATA_EXBASE_OUT_OF_MEMORY,
+ CLRDATA_EXBASE_INVALID_ARGUMENT,
+} CLRDataBaseExceptionType;
+
+typedef enum
+{
+ CLRDATA_EXSAME_SECOND_CHANCE = 0x00000000,
+ CLRDATA_EXSAME_FIRST_CHANCE = 0x00000001,
+} CLRDataExceptionSameFlag;
+
+#pragma warning(push)
+#pragma warning(disable:28718) /* suppress warning 28718 for inteface IXCLRDataExceptionState */
+[
+ object,
+ local,
+ uuid(75DA9E4C-BD33-43C8-8F5C-96E8A5241F57)
+]
+interface IXCLRDataExceptionState : IUnknown
+{
+ /*
+ * Get state flags, defined in CLRDataExceptionStateFlag.
+ */
+ HRESULT GetFlags([out] ULONG32* flags);
+
+ /*
+ * For nested exceptions, get the exception that
+ * was being handled when this exception occurred.
+ */
+ HRESULT GetPrevious([out] IXCLRDataExceptionState** exState);
+
+ /*
+ * Get the managed object representing the exception.
+ */
+ HRESULT GetManagedObject([out] IXCLRDataValue** value);
+
+ /*
+ * Get the standard base type of the exception.
+ */
+ HRESULT GetBaseType([out] CLRDataBaseExceptionType* type);
+
+ /*
+ * Get exception information.
+ */
+ HRESULT GetCode([out] ULONG32* code);
+ HRESULT GetString([in] ULONG32 bufLen,
+ [out] ULONG32 *strLen,
+ [out, size_is(bufLen)] WCHAR str[]);
+
+ HRESULT Request([in] ULONG32 reqCode,
+ [in] ULONG32 inBufferSize,
+ [in, size_is(inBufferSize)] BYTE* inBuffer,
+ [in] ULONG32 outBufferSize,
+ [out, size_is(outBufferSize)] BYTE* outBuffer);
+
+ /*
+ * Determine whether the given interface represents
+ * the same exception state.
+ * OBSOLETE: Use IsSameState2.
+ * Requires revision 1.
+ */
+ HRESULT IsSameState([in] EXCEPTION_RECORD64* exRecord,
+ [in] ULONG32 contextSize,
+ [in, size_is(contextSize)] BYTE cxRecord[]);
+
+ /*
+ * Determine whether the given interface represents
+ * the same exception state.
+ * Requires revision 2.
+ */
+ HRESULT IsSameState2([in] ULONG32 flags,
+ [in] EXCEPTION_RECORD64* exRecord,
+ [in] ULONG32 contextSize,
+ [in, size_is(contextSize)] BYTE cxRecord[]);
+
+ /*
+ * Gets the task this exception state is associated with.
+ * Requires revision 2.
+ */
+ HRESULT GetTask([out] IXCLRDataTask** task);
+}
+#pragma warning(pop)
+
+typedef enum
+{
+ CLRDATA_VLOC_MEMORY = 0x00000000,
+ CLRDATA_VLOC_REGISTER = 0x00000001,
+} ClrDataValueLocationFlag;
+
+#pragma warning(push)
+#pragma warning(disable:28718) /* suppress warning 28718 for interface IXCLRDataValue */
+/*
+ * Object inspection interface.
+ */
+[
+ object,
+ local,
+ uuid(96EC93C7-1000-4e93-8991-98D8766E6666)
+]
+interface IXCLRDataValue : IUnknown
+{
+ /*
+ * Get state flags, defined in CLRDataValueFlag.
+ */
+ HRESULT GetFlags([out] ULONG32* flags);
+
+ /*
+ * Get the address of the object.
+ * Fails unless the object is a single contiguous
+ * piece of data in memory.
+ * OBSOLETE: Use GetLocation instead.
+ */
+ HRESULT GetAddress([out] CLRDATA_ADDRESS* address);
+
+ /*
+ * Return the size (in bytes) of the object.
+ */
+ HRESULT GetSize([out] ULONG64* size);
+
+ /*
+ * Copy between an object and a buffer.
+ * Returns S_FALSE if the buffer was not at least as large
+ * as the object.
+ */
+ HRESULT GetBytes([in] ULONG32 bufLen,
+ [out] ULONG32 *dataSize,
+ [out, size_is(bufLen)] BYTE buffer[]);
+ HRESULT SetBytes([in] ULONG32 bufLen,
+ [out] ULONG32 *dataSize,
+ [in, size_is(bufLen)] BYTE buffer[]);
+
+ /*
+ * Get the type of the object
+ */
+ HRESULT GetType([out] IXCLRDataTypeInstance **typeInstance);
+
+ /*
+ * Get the number of fields in the object.
+ * OBSOLETE: Use GetNumFields2.
+ */
+ HRESULT GetNumFields([out] ULONG32 *numFields);
+
+ /*
+ * Gets one field of the object.
+ *
+ * Because field ordering is not fixed, can also return name
+ * information and/or the metadata token, if the caller passes in
+ * appropriate values.
+ * OBSOLETE: Use EnumField.
+ */
+ HRESULT GetFieldByIndex([in] ULONG32 index,
+ [out] IXCLRDataValue **field,
+ [in] ULONG32 bufLen,
+ [out] ULONG32 *nameLen,
+ [out, size_is(bufLen)] WCHAR nameBuf[],
+ [out] mdFieldDef* token);
+
+ HRESULT Request([in] ULONG32 reqCode,
+ [in] ULONG32 inBufferSize,
+ [in, size_is(inBufferSize)] BYTE* inBuffer,
+ [in] ULONG32 outBufferSize,
+ [out, size_is(outBufferSize)] BYTE* outBuffer);
+
+ /*
+ * Get the number of fields in the value.
+ * If a type is passed in only fields defined
+ * by that type are enumerated.
+ */
+ HRESULT GetNumFields2([in] ULONG32 flags,
+ [in] IXCLRDataTypeInstance* fromType,
+ [out] ULONG32* numFields);
+
+ /*
+ * Enumerate the fields for this value.
+ * If a type is passed in only fields defined
+ * by that type are enumerated.
+ */
+ HRESULT StartEnumFields([in] ULONG32 flags,
+ [in] IXCLRDataTypeInstance* fromType,
+ [out] CLRDATA_ENUM* handle);
+ HRESULT EnumField([in, out] CLRDATA_ENUM* handle,
+ [out] IXCLRDataValue** field,
+ [in] ULONG32 nameBufLen,
+ [out] ULONG32* nameLen,
+ [out, size_is(nameBufLen)] WCHAR nameBuf[],
+ [out] mdFieldDef* token);
+ HRESULT EndEnumFields([in] CLRDATA_ENUM handle);
+
+ HRESULT StartEnumFieldsByName([in] LPCWSTR name,
+ [in] ULONG32 nameFlags,
+ [in] ULONG32 fieldFlags,
+ [in] IXCLRDataTypeInstance* fromType,
+ [out] CLRDATA_ENUM* handle);
+ HRESULT EnumFieldByName([in, out] CLRDATA_ENUM* handle,
+ [out] IXCLRDataValue** field,
+ [out] mdFieldDef* token);
+ HRESULT EndEnumFieldsByName([in] CLRDATA_ENUM handle);
+
+ /*
+ * Retrieve a field by field metadata token.
+ */
+ HRESULT GetFieldByToken([in] mdFieldDef token,
+ [out] IXCLRDataValue **field,
+ [in] ULONG32 bufLen,
+ [out] ULONG32 *nameLen,
+ [out, size_is(bufLen)] WCHAR nameBuf[]);
+
+ /*
+ * Get the value implicitly associated with this value.
+ * For pointers or reference values this is the value
+ * pointed/referred to.
+ * For boxed values this is the contained value.
+ * For other values there is no associated value.
+ */
+ HRESULT GetAssociatedValue([out] IXCLRDataValue** assocValue);
+
+ /*
+ * Get the type implicitly associated with this value.
+ * For pointers or reference types this is the type
+ * pointed/referred to.
+ * For boxed values this is the type of the contained value.
+ * For arrays this is the element type.
+ * For other values there is no associated type.
+ */
+ HRESULT GetAssociatedType([out] IXCLRDataTypeInstance** assocType);
+
+ /*
+ * String methods that only work for string data values.
+ */
+
+ /*
+ * Return the length and contents of the string.
+ */
+ HRESULT GetString([in] ULONG32 bufLen,
+ [out] ULONG32 *strLen,
+ [out, size_is(bufLen)] WCHAR str[]);
+
+ /*
+ * Array methods that only work for array data values.
+ */
+
+ /*
+ * Return the definition of the array.
+ */
+ HRESULT GetArrayProperties([out] ULONG32 *rank,
+ [out] ULONG32 *totalElements,
+ [in] ULONG32 numDim,
+ [out, size_is(numDim)] ULONG32 dims[],
+ [in] ULONG32 numBases,
+ [out, size_is(numBases)] LONG32 bases[]);
+
+ /*
+ * Return a value representing the given element in the array.
+ */
+ HRESULT GetArrayElement([in] ULONG32 numInd,
+ [in, size_is(numInd)] LONG32 indices[],
+ [out] IXCLRDataValue **value);
+
+ HRESULT EnumField2([in, out] CLRDATA_ENUM* handle,
+ [out] IXCLRDataValue** field,
+ [in] ULONG32 nameBufLen,
+ [out] ULONG32* nameLen,
+ [out, size_is(nameBufLen)] WCHAR nameBuf[],
+ [out] IXCLRDataModule** tokenScope,
+ [out] mdFieldDef* token);
+ HRESULT EnumFieldByName2([in, out] CLRDATA_ENUM* handle,
+ [out] IXCLRDataValue** field,
+ [out] IXCLRDataModule** tokenScope,
+ [out] mdFieldDef* token);
+ HRESULT GetFieldByToken2([in] IXCLRDataModule* tokenScope,
+ [in] mdFieldDef token,
+ [out] IXCLRDataValue **field,
+ [in] ULONG32 bufLen,
+ [out] ULONG32 *nameLen,
+ [out, size_is(bufLen)] WCHAR nameBuf[]);
+
+ /*
+ * Returns the locations the value's
+ * data is spread across.
+ * Placeholder values, such as values for variables
+ * which are dead, may not have any locations.
+ * Memory locations return the memory address in arg.
+ * Register locations do not return an indication
+ * of which register.
+ * Requires revision 3.
+ */
+ HRESULT GetNumLocations([out] ULONG32* numLocs);
+ HRESULT GetLocationByIndex([in] ULONG32 loc,
+ [out] ULONG32* flags,
+ [out] CLRDATA_ADDRESS* arg);
+}
+#pragma warning(pop)
+
+[
+ object,
+ local,
+ uuid(2D95A079-42A1-4837-818F-0B97D7048E0E)
+]
+interface IXCLRDataExceptionNotification : IUnknown
+{
+ /*
+ * New code was generated or discarded for a method.
+ */
+ HRESULT OnCodeGenerated([in] IXCLRDataMethodInstance* method);
+ HRESULT OnCodeDiscarded([in] IXCLRDataMethodInstance* method);
+
+ /*
+ * The process or task reached the desired execution state.
+ */
+ HRESULT OnProcessExecution([in] ULONG32 state);
+ HRESULT OnTaskExecution([in] IXCLRDataTask* task,
+ [in] ULONG32 state);
+
+ /*
+ * The given module was loaded or unloaded.
+ */
+ HRESULT OnModuleLoaded([in] IXCLRDataModule* mod);
+ HRESULT OnModuleUnloaded([in] IXCLRDataModule* mod);
+
+ /*
+ * The given type was loaded or unloaded.
+ */
+ HRESULT OnTypeLoaded([in] IXCLRDataTypeInstance* typeInst);
+ HRESULT OnTypeUnloaded([in] IXCLRDataTypeInstance* typeInst);
+}
+
+[
+ object,
+ local,
+ uuid(31201a94-4337-49b7-aef7-0c755054091f)
+]
+interface IXCLRDataExceptionNotification2 : IXCLRDataExceptionNotification
+{
+ /*
+ * The given app domain was loaded or unloaded.
+ */
+ HRESULT OnAppDomainLoaded([in] IXCLRDataAppDomain* domain);
+ HRESULT OnAppDomainUnloaded([in] IXCLRDataAppDomain* domain);
+
+ /*
+ * A managed exception has been raised.
+ */
+ HRESULT OnException([in] IXCLRDataExceptionState* exception);
+}
+
+[
+ object,
+ local,
+ uuid(31201a94-4337-49b7-aef7-0c7550540920)
+]
+interface IXCLRDataExceptionNotification3 : IXCLRDataExceptionNotification2
+{
+ /*
+ * The specified GC event was triggered. The GC event is passed in an
+ * opaque structure, whose structure is given by buffSize
+ */
+ HRESULT OnGcEvent([in] GcEvtArgs gcEvtArgs);
+}
+
+[
+ object,
+ local,
+ uuid(C25E926E-5F09-4AA2-BBAD-B7FC7F10CFD7)
+]
+interface IXCLRDataExceptionNotification4 : IXCLRDataExceptionNotification3
+{
+ /*
+ * A managed catch clause is about to be executed
+ */
+ HRESULT ExceptionCatcherEnter([in] IXCLRDataMethodInstance* catchingMethod, DWORD catcherNativeOffset);
+}
diff --git a/src/inc/xcordebug.idl b/src/inc/xcordebug.idl
new file mode 100644
index 0000000000..646c2069ea
--- /dev/null
+++ b/src/inc/xcordebug.idl
@@ -0,0 +1,85 @@
+// 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.
+/*****************************************************************************
+ ** **
+ ** XCordebug.idl - Experimental (undocumented) Debugging interfaces. **
+ ** **
+ *****************************************************************************/
+
+
+/* ------------------------------------------------------------------------- *
+ * Imported types
+ * ------------------------------------------------------------------------- */
+
+import "cordebug.idl";
+
+
+
+
+// @dbgtodo : proper API docs here.
+// - include failure semantics of Filter. What does failure mean?
+//
+/* Comments to add to ICorDebugDataTarget docs:
+ * Whenever the target process changes, the debugger client must
+ * call ICorDebugProcess4::ProcessStateChanged before issuing any other
+ * ICorDebug API calls.
+*/
+[
+ object,
+ local,
+ uuid(E930C679-78AF-4953-8AB7-B0AABF0F9F80),
+ pointer_default(unique)
+]
+interface ICorDebugProcess4 : IUnknown
+{
+ /*
+ * Process native debug events.
+ */
+ HRESULT Filter(
+ [in, length_is(countBytes), size_is(countBytes)] const BYTE pRecord[],
+ [in] DWORD countBytes,
+ [in] CorDebugRecordFormat format,
+ [in] DWORD dwFlags,
+ [in] DWORD dwThreadId,
+ [in] ICorDebugManagedCallback * pCallback,
+ [in, out] CORDB_CONTINUE_STATUS * pContinueStatus);
+
+ /*
+ * Debugger calls this to notify ICorDebug that the process is running.
+ *
+ * Notes:
+ * ProcessStateChanged(PROCESS_RUNNING) has similar semantics to ICorDebugProcess::Continue();
+ */
+ HRESULT ProcessStateChanged([in] CorDebugStateChange eChange);
+
+};
+
+#ifdef FEATURE_LEGACYNETCF_DBG_HOST_CONTROL
+
+/* A private API for use on Windows phone to invoke CLR hosting
+ * callbacks on IHostNetCFDebugControlManager. This allows the
+ * host's UI thread to be suspended and resumed on demand.
+ *
+ * This API should not be used for anything other than the
+ * Windows Phone scenario, it should never be made public,
+ * and as soon as we support mixed-mode debugging it should
+ * be retired by removing the interface and failing any
+ * QueryInterface call for it.
+*/
+[
+ object,
+ local,
+ uuid(34B27FB0-A318-450D-A0DD-11B70B21F41D),
+ pointer_default(unique)
+]
+interface ICorDebugLegacyNetCFHostCallbackInvoker_PrivateWindowsPhoneOnly : IUnknown
+{
+ // Invokes IHostNetCFDebugControlManager::NotifyPause() on the debuggee's host
+ HRESULT InvokePauseCallback();
+
+ // Invokes IHostNetCFDebugControlManager::NotifyResume() on the debuggee's host
+ HRESULT InvokeResumeCallback();
+};
+
+#endif \ No newline at end of file
diff --git a/src/inc/xmlparser.h b/src/inc/xmlparser.h
new file mode 100644
index 0000000000..70bf380e58
--- /dev/null
+++ b/src/inc/xmlparser.h
@@ -0,0 +1,1385 @@
+// 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.
+
+
+#ifdef _MSC_VER
+#pragma warning( disable: 4049 ) /* more than 64k source lines */
+#endif
+
+/* this ALWAYS GENERATED file contains the definitions for the interfaces */
+
+
+ /* File created by MIDL compiler version 6.00.0328 */
+/* Compiler settings for xmlparser.idl:
+ Oicf (OptLev=i2), W1, Zp8, env=Win32 (32b run)
+ protocol : dce , ms_ext, c_ext
+ error checks: allocation ref bounds_check enum stub_data
+ VC __declspec() decoration level:
+ __declspec(uuid()), __declspec(selectany), __declspec(novtable)
+ DECLSPEC_UUID(), MIDL_INTERFACE()
+*/
+//@@MIDL_FILE_HEADING( )
+
+
+/* verify that the <rpcndr.h> version is high enough to compile this file*/
+#ifndef __REQUIRED_RPCNDR_H_VERSION__
+#define __REQUIRED_RPCNDR_H_VERSION__ 440
+#endif
+
+#include "rpc.h"
+#include "rpcndr.h"
+
+#ifndef __xmlparser_h__
+#define __xmlparser_h__
+
+#if defined(_MSC_VER) && (_MSC_VER >= 1020)
+#pragma once
+#endif
+
+/* Forward Declarations */
+
+#ifndef __IXMLNodeSource_FWD_DEFINED__
+#define __IXMLNodeSource_FWD_DEFINED__
+typedef interface IXMLNodeSource IXMLNodeSource;
+#endif /* __IXMLNodeSource_FWD_DEFINED__ */
+
+
+#ifndef __IXMLParser_FWD_DEFINED__
+#define __IXMLParser_FWD_DEFINED__
+typedef interface IXMLParser IXMLParser;
+#endif /* __IXMLParser_FWD_DEFINED__ */
+
+
+#ifndef __IXMLNodeFactory_FWD_DEFINED__
+#define __IXMLNodeFactory_FWD_DEFINED__
+typedef interface IXMLNodeFactory IXMLNodeFactory;
+#endif /* __IXMLNodeFactory_FWD_DEFINED__ */
+
+
+#ifndef __XMLParser_FWD_DEFINED__
+#define __XMLParser_FWD_DEFINED__
+
+#ifdef __cplusplus
+typedef class XMLParser XMLParser;
+#else
+typedef struct XMLParser XMLParser;
+#endif /* __cplusplus */
+
+#endif /* __XMLParser_FWD_DEFINED__ */
+
+
+/* header files for imported files */
+#include "unknwn.h"
+#include "objidl.h"
+#include "oaidl.h"
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+void __RPC_FAR * __RPC_USER MIDL_user_allocate(size_t);
+void __RPC_USER MIDL_user_free( void __RPC_FAR * );
+
+/* interface __MIDL_itf_xmlparser_0000 */
+/* [local] */
+
+typedef /* [public] */
+enum __MIDL___MIDL_itf_xmlparser_0000_0001
+ { XML_ELEMENT = 1,
+ XML_ATTRIBUTE = XML_ELEMENT + 1,
+ XML_PI = XML_ATTRIBUTE + 1,
+ XML_XMLDECL = XML_PI + 1,
+ XML_DOCTYPE = XML_XMLDECL + 1,
+ XML_DTDATTRIBUTE = XML_DOCTYPE + 1,
+ XML_ENTITYDECL = XML_DTDATTRIBUTE + 1,
+ XML_ELEMENTDECL = XML_ENTITYDECL + 1,
+ XML_ATTLISTDECL = XML_ELEMENTDECL + 1,
+ XML_NOTATION = XML_ATTLISTDECL + 1,
+ XML_GROUP = XML_NOTATION + 1,
+ XML_INCLUDESECT = XML_GROUP + 1,
+ XML_PCDATA = XML_INCLUDESECT + 1,
+ XML_CDATA = XML_PCDATA + 1,
+ XML_IGNORESECT = XML_CDATA + 1,
+ XML_COMMENT = XML_IGNORESECT + 1,
+ XML_ENTITYREF = XML_COMMENT + 1,
+ XML_WHITESPACE = XML_ENTITYREF + 1,
+ XML_NAME = XML_WHITESPACE + 1,
+ XML_NMTOKEN = XML_NAME + 1,
+ XML_STRING = XML_NMTOKEN + 1,
+ XML_PEREF = XML_STRING + 1,
+ XML_MODEL = XML_PEREF + 1,
+ XML_ATTDEF = XML_MODEL + 1,
+ XML_ATTTYPE = XML_ATTDEF + 1,
+ XML_ATTPRESENCE = XML_ATTTYPE + 1,
+ XML_DTDSUBSET = XML_ATTPRESENCE + 1,
+ XML_LASTNODETYPE = XML_DTDSUBSET + 1
+ } XML_NODE_TYPE;
+
+typedef /* [public] */
+enum __MIDL___MIDL_itf_xmlparser_0000_0002
+ { XML_VERSION = XML_LASTNODETYPE,
+ XML_ENCODING = XML_VERSION + 1,
+ XML_STANDALONE = XML_ENCODING + 1,
+ XML_NS = XML_STANDALONE + 1,
+ XML_XMLSPACE = XML_NS + 1,
+ XML_XMLLANG = XML_XMLSPACE + 1,
+ XML_SYSTEM = XML_XMLLANG + 1,
+ XML_PUBLIC = XML_SYSTEM + 1,
+ XML_NDATA = XML_PUBLIC + 1,
+ XML_AT_CDATA = XML_NDATA + 1,
+ XML_AT_ID = XML_AT_CDATA + 1,
+ XML_AT_IDREF = XML_AT_ID + 1,
+ XML_AT_IDREFS = XML_AT_IDREF + 1,
+ XML_AT_ENTITY = XML_AT_IDREFS + 1,
+ XML_AT_ENTITIES = XML_AT_ENTITY + 1,
+ XML_AT_NMTOKEN = XML_AT_ENTITIES + 1,
+ XML_AT_NMTOKENS = XML_AT_NMTOKEN + 1,
+ XML_AT_NOTATION = XML_AT_NMTOKENS + 1,
+ XML_AT_REQUIRED = XML_AT_NOTATION + 1,
+ XML_AT_IMPLIED = XML_AT_REQUIRED + 1,
+ XML_AT_FIXED = XML_AT_IMPLIED + 1,
+ XML_PENTITYDECL = XML_AT_FIXED + 1,
+ XML_EMPTY = XML_PENTITYDECL + 1,
+ XML_ANY = XML_EMPTY + 1,
+ XML_MIXED = XML_ANY + 1,
+ XML_SEQUENCE = XML_MIXED + 1,
+ XML_CHOICE = XML_SEQUENCE + 1,
+ XML_STAR = XML_CHOICE + 1,
+ XML_PLUS = XML_STAR + 1,
+ XML_QUESTIONMARK = XML_PLUS + 1,
+ XML_LASTSUBNODETYPE = XML_QUESTIONMARK + 1
+ } XML_NODE_SUBTYPE;
+
+typedef /* [public] */
+enum __MIDL___MIDL_itf_xmlparser_0000_0003
+ { XML_E_PARSEERRORBASE = 0xc00ce500L,
+ XML_E_ENDOFINPUT = XML_E_PARSEERRORBASE,
+ XML_E_MISSINGEQUALS = XML_E_ENDOFINPUT + 1,
+ XML_E_MISSINGQUOTE = XML_E_MISSINGEQUALS + 1,
+ XML_E_COMMENTSYNTAX = XML_E_MISSINGQUOTE + 1,
+ XML_E_BADSTARTNAMECHAR = XML_E_COMMENTSYNTAX + 1,
+ XML_E_BADNAMECHAR = XML_E_BADSTARTNAMECHAR + 1,
+ XML_E_BADCHARINSTRING = XML_E_BADNAMECHAR + 1,
+ XML_E_XMLDECLSYNTAX = XML_E_BADCHARINSTRING + 1,
+ XML_E_BADCHARDATA = XML_E_XMLDECLSYNTAX + 1,
+ XML_E_MISSINGWHITESPACE = XML_E_BADCHARDATA + 1,
+ XML_E_EXPECTINGTAGEND = XML_E_MISSINGWHITESPACE + 1,
+ XML_E_BADCHARINDTD = XML_E_EXPECTINGTAGEND + 1,
+ XML_E_BADCHARINDECL = XML_E_BADCHARINDTD + 1,
+ XML_E_MISSINGSEMICOLON = XML_E_BADCHARINDECL + 1,
+ XML_E_BADCHARINENTREF = XML_E_MISSINGSEMICOLON + 1,
+ XML_E_UNBALANCEDPAREN = XML_E_BADCHARINENTREF + 1,
+ XML_E_EXPECTINGOPENBRACKET = XML_E_UNBALANCEDPAREN + 1,
+ XML_E_BADENDCONDSECT = XML_E_EXPECTINGOPENBRACKET + 1,
+ XML_E_INTERNALERROR = XML_E_BADENDCONDSECT + 1,
+ XML_E_UNEXPECTED_WHITESPACE = XML_E_INTERNALERROR + 1,
+ XML_E_INCOMPLETE_ENCODING = XML_E_UNEXPECTED_WHITESPACE + 1,
+ XML_E_BADCHARINMIXEDMODEL = XML_E_INCOMPLETE_ENCODING + 1,
+ XML_E_MISSING_STAR = XML_E_BADCHARINMIXEDMODEL + 1,
+ XML_E_BADCHARINMODEL = XML_E_MISSING_STAR + 1,
+ XML_E_MISSING_PAREN = XML_E_BADCHARINMODEL + 1,
+ XML_E_BADCHARINENUMERATION = XML_E_MISSING_PAREN + 1,
+ XML_E_PIDECLSYNTAX = XML_E_BADCHARINENUMERATION + 1,
+ XML_E_EXPECTINGCLOSEQUOTE = XML_E_PIDECLSYNTAX + 1,
+ XML_E_MULTIPLE_COLONS = XML_E_EXPECTINGCLOSEQUOTE + 1,
+ XML_E_INVALID_DECIMAL = XML_E_MULTIPLE_COLONS + 1,
+ XML_E_INVALID_HEXIDECIMAL = XML_E_INVALID_DECIMAL + 1,
+ XML_E_INVALID_UNICODE = XML_E_INVALID_HEXIDECIMAL + 1,
+ XML_E_WHITESPACEORQUESTIONMARK = XML_E_INVALID_UNICODE + 1,
+ XML_E_TOKEN_ERROR = XML_E_PARSEERRORBASE + 0x50,
+ XML_E_SUSPENDED = XML_E_TOKEN_ERROR,
+ XML_E_STOPPED = XML_E_SUSPENDED + 1,
+ XML_E_UNEXPECTEDENDTAG = XML_E_STOPPED + 1,
+ XML_E_UNCLOSEDTAG = XML_E_UNEXPECTEDENDTAG + 1,
+ XML_E_DUPLICATEATTRIBUTE = XML_E_UNCLOSEDTAG + 1,
+ XML_E_MULTIPLEROOTS = XML_E_DUPLICATEATTRIBUTE + 1,
+ XML_E_INVALIDATROOTLEVEL = XML_E_MULTIPLEROOTS + 1,
+ XML_E_BADXMLDECL = XML_E_INVALIDATROOTLEVEL + 1,
+ XML_E_MISSINGROOT = XML_E_BADXMLDECL + 1,
+ XML_E_UNEXPECTEDEOF = XML_E_MISSINGROOT + 1,
+ XML_E_BADPEREFINSUBSET = XML_E_UNEXPECTEDEOF + 1,
+ XML_E_PE_NESTING = XML_E_BADPEREFINSUBSET + 1,
+ XML_E_INVALID_CDATACLOSINGTAG = XML_E_PE_NESTING + 1,
+ XML_E_UNCLOSEDPI = XML_E_INVALID_CDATACLOSINGTAG + 1,
+ XML_E_UNCLOSEDSTARTTAG = XML_E_UNCLOSEDPI + 1,
+ XML_E_UNCLOSEDENDTAG = XML_E_UNCLOSEDSTARTTAG + 1,
+ XML_E_UNCLOSEDSTRING = XML_E_UNCLOSEDENDTAG + 1,
+ XML_E_UNCLOSEDCOMMENT = XML_E_UNCLOSEDSTRING + 1,
+ XML_E_UNCLOSEDDECL = XML_E_UNCLOSEDCOMMENT + 1,
+ XML_E_UNCLOSEDMARKUPDECL = XML_E_UNCLOSEDDECL + 1,
+ XML_E_UNCLOSEDCDATA = XML_E_UNCLOSEDMARKUPDECL + 1,
+ XML_E_BADDECLNAME = XML_E_UNCLOSEDCDATA + 1,
+ XML_E_BADEXTERNALID = XML_E_BADDECLNAME + 1,
+ XML_E_BADELEMENTINDTD = XML_E_BADEXTERNALID + 1,
+ XML_E_RESERVEDNAMESPACE = XML_E_BADELEMENTINDTD + 1,
+ XML_E_EXPECTING_VERSION = XML_E_RESERVEDNAMESPACE + 1,
+ XML_E_EXPECTING_ENCODING = XML_E_EXPECTING_VERSION + 1,
+ XML_E_EXPECTING_NAME = XML_E_EXPECTING_ENCODING + 1,
+ XML_E_UNEXPECTED_ATTRIBUTE = XML_E_EXPECTING_NAME + 1,
+ XML_E_ENDTAGMISMATCH = XML_E_UNEXPECTED_ATTRIBUTE + 1,
+ XML_E_INVALIDENCODING = XML_E_ENDTAGMISMATCH + 1,
+ XML_E_INVALIDSWITCH = XML_E_INVALIDENCODING + 1,
+ XML_E_EXPECTING_NDATA = XML_E_INVALIDSWITCH + 1,
+ XML_E_INVALID_MODEL = XML_E_EXPECTING_NDATA + 1,
+ XML_E_INVALID_TYPE = XML_E_INVALID_MODEL + 1,
+ XML_E_INVALIDXMLSPACE = XML_E_INVALID_TYPE + 1,
+ XML_E_MULTI_ATTR_VALUE = XML_E_INVALIDXMLSPACE + 1,
+ XML_E_INVALID_PRESENCE = XML_E_MULTI_ATTR_VALUE + 1,
+ XML_E_BADXMLCASE = XML_E_INVALID_PRESENCE + 1,
+ XML_E_CONDSECTINSUBSET = XML_E_BADXMLCASE + 1,
+ XML_E_CDATAINVALID = XML_E_CONDSECTINSUBSET + 1,
+ XML_E_INVALID_STANDALONE = XML_E_CDATAINVALID + 1,
+ XML_E_UNEXPECTED_STANDALONE = XML_E_INVALID_STANDALONE + 1,
+ XML_E_DOCTYPE_IN_DTD = XML_E_UNEXPECTED_STANDALONE + 1,
+ XML_E_MISSING_ENTITY = XML_E_DOCTYPE_IN_DTD + 1,
+ XML_E_ENTITYREF_INNAME = XML_E_MISSING_ENTITY + 1,
+ XML_E_DOCTYPE_OUTSIDE_PROLOG = XML_E_ENTITYREF_INNAME + 1,
+ XML_E_INVALID_VERSION = XML_E_DOCTYPE_OUTSIDE_PROLOG + 1,
+ XML_E_DTDELEMENT_OUTSIDE_DTD = XML_E_INVALID_VERSION + 1,
+ XML_E_DUPLICATEDOCTYPE = XML_E_DTDELEMENT_OUTSIDE_DTD + 1,
+ XML_E_RESOURCE = XML_E_DUPLICATEDOCTYPE + 1,
+ XML_E_LASTERROR = XML_E_RESOURCE + 1
+ } XML_ERROR_CODE;
+
+typedef /* [public] */
+enum __MIDL___MIDL_itf_xmlparser_0000_0004
+ { XMLPARSER_IDLE = 0,
+ XMLPARSER_WAITING = XMLPARSER_IDLE + 1,
+ XMLPARSER_BUSY = XMLPARSER_WAITING + 1,
+ XMLPARSER_ERROR = XMLPARSER_BUSY + 1,
+ XMLPARSER_STOPPED = XMLPARSER_ERROR + 1,
+ XMLPARSER_SUSPENDED = XMLPARSER_STOPPED + 1
+ } XML_PARSER_STATE;
+
+typedef /* [public] */
+enum __MIDL___MIDL_itf_xmlparser_0000_0005
+ { XMLFLAG_FLOATINGAMP = 1,
+ XMLFLAG_SHORTENDTAGS = 2,
+ XMLFLAG_CASEINSENSITIVE = 4,
+ XMLFLAG_NONAMESPACES = 8,
+ XMLFLAG_NOWHITESPACE = 16,
+ XMLFLAG_IE4QUIRKS = 32,
+ XMLFLAG_NODTDNODES = 64,
+ XMLFLAG_IE4COMPATIBILITY = 255
+ } XML_PARSER_FLAGS;
+
+typedef /* [public][public] */
+enum __MIDL___MIDL_itf_xmlparser_0000_0006
+ { XMLNF_STARTDOCUMENT = 0,
+ XMLNF_STARTDTD = XMLNF_STARTDOCUMENT + 1,
+ XMLNF_ENDDTD = XMLNF_STARTDTD + 1,
+ XMLNF_STARTDTDSUBSET = XMLNF_ENDDTD + 1,
+ XMLNF_ENDDTDSUBSET = XMLNF_STARTDTDSUBSET + 1,
+ XMLNF_ENDPROLOG = XMLNF_ENDDTDSUBSET + 1,
+ XMLNF_STARTENTITY = XMLNF_ENDPROLOG + 1,
+ XMLNF_ENDENTITY = XMLNF_STARTENTITY + 1,
+ XMLNF_ENDDOCUMENT = XMLNF_ENDENTITY + 1,
+ XMLNF_DATAAVAILABLE = XMLNF_ENDDOCUMENT + 1,
+ XMLNF_LASTEVENT = XMLNF_DATAAVAILABLE
+ } XML_NODEFACTORY_EVENT;
+
+typedef struct _XML_NODE_INFO
+ {
+ DWORD dwSize;
+ DWORD dwType;
+ DWORD dwSubType;
+ BOOL fTerminal;
+ const WCHAR __RPC_FAR *pwcText;
+ ULONG ulLen;
+ ULONG ulNsPrefixLen;
+ PVOID pNode;
+ PVOID pReserved;
+ } XML_NODE_INFO;
+
+
+
+extern RPC_IF_HANDLE __MIDL_itf_xmlparser_0000_v0_0_c_ifspec;
+extern RPC_IF_HANDLE __MIDL_itf_xmlparser_0000_v0_0_s_ifspec;
+
+
+#ifndef __XMLPSR_LIBRARY_DEFINED__
+#define __XMLPSR_LIBRARY_DEFINED__
+
+/* library XMLPSR */
+/* [version][lcid][helpstring][uuid] */
+
+
+EXTERN_C const IID LIBID_XMLPSR;
+
+#ifndef __IXMLNodeSource_INTERFACE_DEFINED__
+#define __IXMLNodeSource_INTERFACE_DEFINED__
+
+/* interface IXMLNodeSource */
+/* [unique][helpstring][uuid][local][object] */
+
+
+EXTERN_C const IID IID_IXMLNodeSource;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("d242361d-51a0-11d2-9caf-0060b0ec3d39")
+ IXMLNodeSource : public IUnknown
+ {
+ public:
+ virtual HRESULT STDMETHODCALLTYPE SetFactory(
+ /* [in] */ IXMLNodeFactory __RPC_FAR *pNodeFactory) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE GetFactory(
+ /* [out] */ IXMLNodeFactory __RPC_FAR *__RPC_FAR *ppNodeFactory) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Abort(
+ /* [in] */ BSTR bstrErrorInfo) = 0;
+
+ virtual ULONG STDMETHODCALLTYPE GetLineNumber( void) = 0;
+
+ virtual ULONG STDMETHODCALLTYPE GetLinePosition( void) = 0;
+
+ virtual ULONG STDMETHODCALLTYPE GetAbsolutePosition( void) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE GetLineBuffer(
+ /* [out] */ const WCHAR __RPC_FAR *__RPC_FAR *ppwcBuf,
+ /* [out] */ ULONG __RPC_FAR *pulLen,
+ /* [out] */ ULONG __RPC_FAR *pulStartPos) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE GetLastError( void) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE GetErrorInfo(
+ /* [out] */ BSTR __RPC_FAR *pbstrErrorInfo) = 0;
+
+ virtual ULONG STDMETHODCALLTYPE GetFlags( void) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE GetURL(
+ /* [out] */ const WCHAR __RPC_FAR *__RPC_FAR *ppwcBuf) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IXMLNodeSourceVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )(
+ IXMLNodeSource __RPC_FAR * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )(
+ IXMLNodeSource __RPC_FAR * This);
+
+ ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )(
+ IXMLNodeSource __RPC_FAR * This);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetFactory )(
+ IXMLNodeSource __RPC_FAR * This,
+ /* [in] */ IXMLNodeFactory __RPC_FAR *pNodeFactory);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetFactory )(
+ IXMLNodeSource __RPC_FAR * This,
+ /* [out] */ IXMLNodeFactory __RPC_FAR *__RPC_FAR *ppNodeFactory);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Abort )(
+ IXMLNodeSource __RPC_FAR * This,
+ /* [in] */ BSTR bstrErrorInfo);
+
+ ULONG ( STDMETHODCALLTYPE __RPC_FAR *GetLineNumber )(
+ IXMLNodeSource __RPC_FAR * This);
+
+ ULONG ( STDMETHODCALLTYPE __RPC_FAR *GetLinePosition )(
+ IXMLNodeSource __RPC_FAR * This);
+
+ ULONG ( STDMETHODCALLTYPE __RPC_FAR *GetAbsolutePosition )(
+ IXMLNodeSource __RPC_FAR * This);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetLineBuffer )(
+ IXMLNodeSource __RPC_FAR * This,
+ /* [out] */ const WCHAR __RPC_FAR *__RPC_FAR *ppwcBuf,
+ /* [out] */ ULONG __RPC_FAR *pulLen,
+ /* [out] */ ULONG __RPC_FAR *pulStartPos);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetLastError )(
+ IXMLNodeSource __RPC_FAR * This);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetErrorInfo )(
+ IXMLNodeSource __RPC_FAR * This,
+ /* [out] */ BSTR __RPC_FAR *pbstrErrorInfo);
+
+ ULONG ( STDMETHODCALLTYPE __RPC_FAR *GetFlags )(
+ IXMLNodeSource __RPC_FAR * This);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetURL )(
+ IXMLNodeSource __RPC_FAR * This,
+ /* [out] */ const WCHAR __RPC_FAR *__RPC_FAR *ppwcBuf);
+
+ END_INTERFACE
+ } IXMLNodeSourceVtbl;
+
+ interface IXMLNodeSource
+ {
+ CONST_VTBL struct IXMLNodeSourceVtbl __RPC_FAR *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IXMLNodeSource_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IXMLNodeSource_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IXMLNodeSource_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IXMLNodeSource_SetFactory(This,pNodeFactory) \
+ (This)->lpVtbl -> SetFactory(This,pNodeFactory)
+
+#define IXMLNodeSource_GetFactory(This,ppNodeFactory) \
+ (This)->lpVtbl -> GetFactory(This,ppNodeFactory)
+
+#define IXMLNodeSource_Abort(This,bstrErrorInfo) \
+ (This)->lpVtbl -> Abort(This,bstrErrorInfo)
+
+#define IXMLNodeSource_GetLineNumber(This) \
+ (This)->lpVtbl -> GetLineNumber(This)
+
+#define IXMLNodeSource_GetLinePosition(This) \
+ (This)->lpVtbl -> GetLinePosition(This)
+
+#define IXMLNodeSource_GetAbsolutePosition(This) \
+ (This)->lpVtbl -> GetAbsolutePosition(This)
+
+#define IXMLNodeSource_GetLineBuffer(This,ppwcBuf,pulLen,pulStartPos) \
+ (This)->lpVtbl -> GetLineBuffer(This,ppwcBuf,pulLen,pulStartPos)
+
+#define IXMLNodeSource_GetLastError(This) \
+ (This)->lpVtbl -> GetLastError(This)
+
+#define IXMLNodeSource_GetErrorInfo(This,pbstrErrorInfo) \
+ (This)->lpVtbl -> GetErrorInfo(This,pbstrErrorInfo)
+
+#define IXMLNodeSource_GetFlags(This) \
+ (This)->lpVtbl -> GetFlags(This)
+
+#define IXMLNodeSource_GetURL(This,ppwcBuf) \
+ (This)->lpVtbl -> GetURL(This,ppwcBuf)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+HRESULT STDMETHODCALLTYPE IXMLNodeSource_SetFactory_Proxy(
+ IXMLNodeSource __RPC_FAR * This,
+ /* [in] */ IXMLNodeFactory __RPC_FAR *pNodeFactory);
+
+
+void __RPC_STUB IXMLNodeSource_SetFactory_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IXMLNodeSource_GetFactory_Proxy(
+ IXMLNodeSource __RPC_FAR * This,
+ /* [out] */ IXMLNodeFactory __RPC_FAR *__RPC_FAR *ppNodeFactory);
+
+
+void __RPC_STUB IXMLNodeSource_GetFactory_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IXMLNodeSource_Abort_Proxy(
+ IXMLNodeSource __RPC_FAR * This,
+ /* [in] */ BSTR bstrErrorInfo);
+
+
+void __RPC_STUB IXMLNodeSource_Abort_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+ULONG STDMETHODCALLTYPE IXMLNodeSource_GetLineNumber_Proxy(
+ IXMLNodeSource __RPC_FAR * This);
+
+
+void __RPC_STUB IXMLNodeSource_GetLineNumber_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+ULONG STDMETHODCALLTYPE IXMLNodeSource_GetLinePosition_Proxy(
+ IXMLNodeSource __RPC_FAR * This);
+
+
+void __RPC_STUB IXMLNodeSource_GetLinePosition_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+ULONG STDMETHODCALLTYPE IXMLNodeSource_GetAbsolutePosition_Proxy(
+ IXMLNodeSource __RPC_FAR * This);
+
+
+void __RPC_STUB IXMLNodeSource_GetAbsolutePosition_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IXMLNodeSource_GetLineBuffer_Proxy(
+ IXMLNodeSource __RPC_FAR * This,
+ /* [out] */ const WCHAR __RPC_FAR *__RPC_FAR *ppwcBuf,
+ /* [out] */ ULONG __RPC_FAR *pulLen,
+ /* [out] */ ULONG __RPC_FAR *pulStartPos);
+
+
+void __RPC_STUB IXMLNodeSource_GetLineBuffer_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IXMLNodeSource_GetLastError_Proxy(
+ IXMLNodeSource __RPC_FAR * This);
+
+
+void __RPC_STUB IXMLNodeSource_GetLastError_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IXMLNodeSource_GetErrorInfo_Proxy(
+ IXMLNodeSource __RPC_FAR * This,
+ /* [out] */ BSTR __RPC_FAR *pbstrErrorInfo);
+
+
+void __RPC_STUB IXMLNodeSource_GetErrorInfo_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+ULONG STDMETHODCALLTYPE IXMLNodeSource_GetFlags_Proxy(
+ IXMLNodeSource __RPC_FAR * This);
+
+
+void __RPC_STUB IXMLNodeSource_GetFlags_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IXMLNodeSource_GetURL_Proxy(
+ IXMLNodeSource __RPC_FAR * This,
+ /* [out] */ const WCHAR __RPC_FAR *__RPC_FAR *ppwcBuf);
+
+
+void __RPC_STUB IXMLNodeSource_GetURL_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IXMLNodeSource_INTERFACE_DEFINED__ */
+
+
+#ifndef __IXMLParser_INTERFACE_DEFINED__
+#define __IXMLParser_INTERFACE_DEFINED__
+
+/* interface IXMLParser */
+/* [unique][helpstring][uuid][local][object] */
+
+
+EXTERN_C const IID IID_IXMLParser;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("d242361e-51a0-11d2-9caf-0060b0ec3d39")
+ IXMLParser : public IXMLNodeSource
+ {
+ public:
+ virtual HRESULT STDMETHODCALLTYPE SetURL(
+ /* [in] */ const WCHAR __RPC_FAR *pszBaseUrl,
+ /* [in] */ const WCHAR __RPC_FAR *pszRelativeUrl,
+ /* [in] */ BOOL fAsync) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Load(
+ /* [in] */ BOOL fFullyAvailable,
+ /* [in] */ IMoniker __RPC_FAR *pimkName,
+ /* [in] */ LPBC pibc,
+ /* [in] */ DWORD grfMode) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE SetInput(
+ /* [in] */ IUnknown __RPC_FAR *pStm) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE PushData(
+ /* [in] */ const char __RPC_FAR *pData,
+ /* [in] */ ULONG ulChars,
+ /* [in] */ BOOL fLastBuffer) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE LoadDTD(
+ /* [in] */ const WCHAR __RPC_FAR *pszBaseUrl,
+ /* [in] */ const WCHAR __RPC_FAR *pszRelativeUrl) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE LoadEntity(
+ /* [in] */ const WCHAR __RPC_FAR *pszBaseUrl,
+ /* [in] */ const WCHAR __RPC_FAR *pszRelativeUrl,
+ /* [in] */ BOOL fpe) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE ParseEntity(
+ /* [in] */ const WCHAR __RPC_FAR *pwcText,
+ /* [in] */ ULONG ulLen,
+ /* [in] */ BOOL fpe) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE ExpandEntity(
+ /* [in] */ const WCHAR __RPC_FAR *pwcText,
+ /* [in] */ ULONG ulLen) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE SetRoot(
+ /* [in] */ PVOID pRoot) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE GetRoot(
+ /* [in] */ PVOID __RPC_FAR *ppRoot) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Run(
+ /* [in] */ long lChars) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE GetParserState( void) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Suspend( void) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Reset( void) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE SetFlags(
+ /* [in] */ ULONG iFlags) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE SetSecureBaseURL(
+ /* [in] */ const WCHAR __RPC_FAR *pszBaseUrl) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE GetSecureBaseURL(
+ /* [out] */ const WCHAR __RPC_FAR *__RPC_FAR *ppwcBuf) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IXMLParserVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )(
+ IXMLParser __RPC_FAR * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )(
+ IXMLParser __RPC_FAR * This);
+
+ ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )(
+ IXMLParser __RPC_FAR * This);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetFactory )(
+ IXMLParser __RPC_FAR * This,
+ /* [in] */ IXMLNodeFactory __RPC_FAR *pNodeFactory);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetFactory )(
+ IXMLParser __RPC_FAR * This,
+ /* [out] */ IXMLNodeFactory __RPC_FAR *__RPC_FAR *ppNodeFactory);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Abort )(
+ IXMLParser __RPC_FAR * This,
+ /* [in] */ BSTR bstrErrorInfo);
+
+ ULONG ( STDMETHODCALLTYPE __RPC_FAR *GetLineNumber )(
+ IXMLParser __RPC_FAR * This);
+
+ ULONG ( STDMETHODCALLTYPE __RPC_FAR *GetLinePosition )(
+ IXMLParser __RPC_FAR * This);
+
+ ULONG ( STDMETHODCALLTYPE __RPC_FAR *GetAbsolutePosition )(
+ IXMLParser __RPC_FAR * This);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetLineBuffer )(
+ IXMLParser __RPC_FAR * This,
+ /* [out] */ const WCHAR __RPC_FAR *__RPC_FAR *ppwcBuf,
+ /* [out] */ ULONG __RPC_FAR *pulLen,
+ /* [out] */ ULONG __RPC_FAR *pulStartPos);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetLastError )(
+ IXMLParser __RPC_FAR * This);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetErrorInfo )(
+ IXMLParser __RPC_FAR * This,
+ /* [out] */ BSTR __RPC_FAR *pbstrErrorInfo);
+
+ ULONG ( STDMETHODCALLTYPE __RPC_FAR *GetFlags )(
+ IXMLParser __RPC_FAR * This);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetURL )(
+ IXMLParser __RPC_FAR * This,
+ /* [out] */ const WCHAR __RPC_FAR *__RPC_FAR *ppwcBuf);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetURL )(
+ IXMLParser __RPC_FAR * This,
+ /* [in] */ const WCHAR __RPC_FAR *pszBaseUrl,
+ /* [in] */ const WCHAR __RPC_FAR *pszRelativeUrl,
+ /* [in] */ BOOL fAsync);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Load )(
+ IXMLParser __RPC_FAR * This,
+ /* [in] */ BOOL fFullyAvailable,
+ /* [in] */ IMoniker __RPC_FAR *pimkName,
+ /* [in] */ LPBC pibc,
+ /* [in] */ DWORD grfMode);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetInput )(
+ IXMLParser __RPC_FAR * This,
+ /* [in] */ IUnknown __RPC_FAR *pStm);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *PushData )(
+ IXMLParser __RPC_FAR * This,
+ /* [in] */ const char __RPC_FAR *pData,
+ /* [in] */ ULONG ulChars,
+ /* [in] */ BOOL fLastBuffer);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *LoadDTD )(
+ IXMLParser __RPC_FAR * This,
+ /* [in] */ const WCHAR __RPC_FAR *pszBaseUrl,
+ /* [in] */ const WCHAR __RPC_FAR *pszRelativeUrl);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *LoadEntity )(
+ IXMLParser __RPC_FAR * This,
+ /* [in] */ const WCHAR __RPC_FAR *pszBaseUrl,
+ /* [in] */ const WCHAR __RPC_FAR *pszRelativeUrl,
+ /* [in] */ BOOL fpe);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *ParseEntity )(
+ IXMLParser __RPC_FAR * This,
+ /* [in] */ const WCHAR __RPC_FAR *pwcText,
+ /* [in] */ ULONG ulLen,
+ /* [in] */ BOOL fpe);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *ExpandEntity )(
+ IXMLParser __RPC_FAR * This,
+ /* [in] */ const WCHAR __RPC_FAR *pwcText,
+ /* [in] */ ULONG ulLen);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetRoot )(
+ IXMLParser __RPC_FAR * This,
+ /* [in] */ PVOID pRoot);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetRoot )(
+ IXMLParser __RPC_FAR * This,
+ /* [in] */ PVOID __RPC_FAR *ppRoot);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Run )(
+ IXMLParser __RPC_FAR * This,
+ /* [in] */ long lChars);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetParserState )(
+ IXMLParser __RPC_FAR * This);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Suspend )(
+ IXMLParser __RPC_FAR * This);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Reset )(
+ IXMLParser __RPC_FAR * This);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetFlags )(
+ IXMLParser __RPC_FAR * This,
+ /* [in] */ ULONG iFlags);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *SetSecureBaseURL )(
+ IXMLParser __RPC_FAR * This,
+ /* [in] */ const WCHAR __RPC_FAR *pszBaseUrl);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *GetSecureBaseURL )(
+ IXMLParser __RPC_FAR * This,
+ /* [out] */ const WCHAR __RPC_FAR *__RPC_FAR *ppwcBuf);
+
+ END_INTERFACE
+ } IXMLParserVtbl;
+
+ interface IXMLParser
+ {
+ CONST_VTBL struct IXMLParserVtbl __RPC_FAR *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IXMLParser_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IXMLParser_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IXMLParser_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IXMLParser_SetFactory(This,pNodeFactory) \
+ (This)->lpVtbl -> SetFactory(This,pNodeFactory)
+
+#define IXMLParser_GetFactory(This,ppNodeFactory) \
+ (This)->lpVtbl -> GetFactory(This,ppNodeFactory)
+
+#define IXMLParser_Abort(This,bstrErrorInfo) \
+ (This)->lpVtbl -> Abort(This,bstrErrorInfo)
+
+#define IXMLParser_GetLineNumber(This) \
+ (This)->lpVtbl -> GetLineNumber(This)
+
+#define IXMLParser_GetLinePosition(This) \
+ (This)->lpVtbl -> GetLinePosition(This)
+
+#define IXMLParser_GetAbsolutePosition(This) \
+ (This)->lpVtbl -> GetAbsolutePosition(This)
+
+#define IXMLParser_GetLineBuffer(This,ppwcBuf,pulLen,pulStartPos) \
+ (This)->lpVtbl -> GetLineBuffer(This,ppwcBuf,pulLen,pulStartPos)
+
+#define IXMLParser_GetLastError(This) \
+ (This)->lpVtbl -> GetLastError(This)
+
+#define IXMLParser_GetErrorInfo(This,pbstrErrorInfo) \
+ (This)->lpVtbl -> GetErrorInfo(This,pbstrErrorInfo)
+
+#define IXMLParser_GetFlags(This) \
+ (This)->lpVtbl -> GetFlags(This)
+
+#define IXMLParser_GetURL(This,ppwcBuf) \
+ (This)->lpVtbl -> GetURL(This,ppwcBuf)
+
+
+#define IXMLParser_SetURL(This,pszBaseUrl,pszRelativeUrl,fAsync) \
+ (This)->lpVtbl -> SetURL(This,pszBaseUrl,pszRelativeUrl,fAsync)
+
+#define IXMLParser_Load(This,fFullyAvailable,pimkName,pibc,grfMode) \
+ (This)->lpVtbl -> Load(This,fFullyAvailable,pimkName,pibc,grfMode)
+
+#define IXMLParser_SetInput(This,pStm) \
+ (This)->lpVtbl -> SetInput(This,pStm)
+
+#define IXMLParser_PushData(This,pData,ulChars,fLastBuffer) \
+ (This)->lpVtbl -> PushData(This,pData,ulChars,fLastBuffer)
+
+#define IXMLParser_LoadDTD(This,pszBaseUrl,pszRelativeUrl) \
+ (This)->lpVtbl -> LoadDTD(This,pszBaseUrl,pszRelativeUrl)
+
+#define IXMLParser_LoadEntity(This,pszBaseUrl,pszRelativeUrl,fpe) \
+ (This)->lpVtbl -> LoadEntity(This,pszBaseUrl,pszRelativeUrl,fpe)
+
+#define IXMLParser_ParseEntity(This,pwcText,ulLen,fpe) \
+ (This)->lpVtbl -> ParseEntity(This,pwcText,ulLen,fpe)
+
+#define IXMLParser_ExpandEntity(This,pwcText,ulLen) \
+ (This)->lpVtbl -> ExpandEntity(This,pwcText,ulLen)
+
+#define IXMLParser_SetRoot(This,pRoot) \
+ (This)->lpVtbl -> SetRoot(This,pRoot)
+
+#define IXMLParser_GetRoot(This,ppRoot) \
+ (This)->lpVtbl -> GetRoot(This,ppRoot)
+
+#define IXMLParser_Run(This,lChars) \
+ (This)->lpVtbl -> Run(This,lChars)
+
+#define IXMLParser_GetParserState(This) \
+ (This)->lpVtbl -> GetParserState(This)
+
+#define IXMLParser_Suspend(This) \
+ (This)->lpVtbl -> Suspend(This)
+
+#define IXMLParser_Reset(This) \
+ (This)->lpVtbl -> Reset(This)
+
+#define IXMLParser_SetFlags(This,iFlags) \
+ (This)->lpVtbl -> SetFlags(This,iFlags)
+
+#define IXMLParser_SetSecureBaseURL(This,pszBaseUrl) \
+ (This)->lpVtbl -> SetSecureBaseURL(This,pszBaseUrl)
+
+#define IXMLParser_GetSecureBaseURL(This,ppwcBuf) \
+ (This)->lpVtbl -> GetSecureBaseURL(This,ppwcBuf)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+HRESULT STDMETHODCALLTYPE IXMLParser_SetURL_Proxy(
+ IXMLParser __RPC_FAR * This,
+ /* [in] */ const WCHAR __RPC_FAR *pszBaseUrl,
+ /* [in] */ const WCHAR __RPC_FAR *pszRelativeUrl,
+ /* [in] */ BOOL fAsync);
+
+
+void __RPC_STUB IXMLParser_SetURL_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IXMLParser_Load_Proxy(
+ IXMLParser __RPC_FAR * This,
+ /* [in] */ BOOL fFullyAvailable,
+ /* [in] */ IMoniker __RPC_FAR *pimkName,
+ /* [in] */ LPBC pibc,
+ /* [in] */ DWORD grfMode);
+
+
+void __RPC_STUB IXMLParser_Load_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IXMLParser_SetInput_Proxy(
+ IXMLParser __RPC_FAR * This,
+ /* [in] */ IUnknown __RPC_FAR *pStm);
+
+
+void __RPC_STUB IXMLParser_SetInput_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IXMLParser_PushData_Proxy(
+ IXMLParser __RPC_FAR * This,
+ /* [in] */ const char __RPC_FAR *pData,
+ /* [in] */ ULONG ulChars,
+ /* [in] */ BOOL fLastBuffer);
+
+
+void __RPC_STUB IXMLParser_PushData_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IXMLParser_LoadDTD_Proxy(
+ IXMLParser __RPC_FAR * This,
+ /* [in] */ const WCHAR __RPC_FAR *pszBaseUrl,
+ /* [in] */ const WCHAR __RPC_FAR *pszRelativeUrl);
+
+
+void __RPC_STUB IXMLParser_LoadDTD_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IXMLParser_LoadEntity_Proxy(
+ IXMLParser __RPC_FAR * This,
+ /* [in] */ const WCHAR __RPC_FAR *pszBaseUrl,
+ /* [in] */ const WCHAR __RPC_FAR *pszRelativeUrl,
+ /* [in] */ BOOL fpe);
+
+
+void __RPC_STUB IXMLParser_LoadEntity_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IXMLParser_ParseEntity_Proxy(
+ IXMLParser __RPC_FAR * This,
+ /* [in] */ const WCHAR __RPC_FAR *pwcText,
+ /* [in] */ ULONG ulLen,
+ /* [in] */ BOOL fpe);
+
+
+void __RPC_STUB IXMLParser_ParseEntity_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IXMLParser_ExpandEntity_Proxy(
+ IXMLParser __RPC_FAR * This,
+ /* [in] */ const WCHAR __RPC_FAR *pwcText,
+ /* [in] */ ULONG ulLen);
+
+
+void __RPC_STUB IXMLParser_ExpandEntity_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IXMLParser_SetRoot_Proxy(
+ IXMLParser __RPC_FAR * This,
+ /* [in] */ PVOID pRoot);
+
+
+void __RPC_STUB IXMLParser_SetRoot_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IXMLParser_GetRoot_Proxy(
+ IXMLParser __RPC_FAR * This,
+ /* [in] */ PVOID __RPC_FAR *ppRoot);
+
+
+void __RPC_STUB IXMLParser_GetRoot_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IXMLParser_Run_Proxy(
+ IXMLParser __RPC_FAR * This,
+ /* [in] */ long lChars);
+
+
+void __RPC_STUB IXMLParser_Run_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IXMLParser_GetParserState_Proxy(
+ IXMLParser __RPC_FAR * This);
+
+
+void __RPC_STUB IXMLParser_GetParserState_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IXMLParser_Suspend_Proxy(
+ IXMLParser __RPC_FAR * This);
+
+
+void __RPC_STUB IXMLParser_Suspend_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IXMLParser_Reset_Proxy(
+ IXMLParser __RPC_FAR * This);
+
+
+void __RPC_STUB IXMLParser_Reset_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IXMLParser_SetFlags_Proxy(
+ IXMLParser __RPC_FAR * This,
+ /* [in] */ ULONG iFlags);
+
+
+void __RPC_STUB IXMLParser_SetFlags_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IXMLParser_SetSecureBaseURL_Proxy(
+ IXMLParser __RPC_FAR * This,
+ /* [in] */ const WCHAR __RPC_FAR *pszBaseUrl);
+
+
+void __RPC_STUB IXMLParser_SetSecureBaseURL_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IXMLParser_GetSecureBaseURL_Proxy(
+ IXMLParser __RPC_FAR * This,
+ /* [out] */ const WCHAR __RPC_FAR *__RPC_FAR *ppwcBuf);
+
+
+void __RPC_STUB IXMLParser_GetSecureBaseURL_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IXMLParser_INTERFACE_DEFINED__ */
+
+
+#ifndef __IXMLNodeFactory_INTERFACE_DEFINED__
+#define __IXMLNodeFactory_INTERFACE_DEFINED__
+
+/* interface IXMLNodeFactory */
+/* [unique][helpstring][uuid][local][object] */
+
+
+EXTERN_C const IID IID_IXMLNodeFactory;
+
+#if defined(__cplusplus) && !defined(CINTERFACE)
+
+ MIDL_INTERFACE("d242361f-51a0-11d2-9caf-0060b0ec3d39")
+ IXMLNodeFactory : public IUnknown
+ {
+ public:
+ virtual HRESULT STDMETHODCALLTYPE NotifyEvent(
+ /* [in] */ IXMLNodeSource __RPC_FAR *pSource,
+ /* [in] */ XML_NODEFACTORY_EVENT iEvt) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE BeginChildren(
+ /* [in] */ IXMLNodeSource __RPC_FAR *pSource,
+ /* [in] */ XML_NODE_INFO __RPC_FAR *pNodeInfo) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE EndChildren(
+ /* [in] */ IXMLNodeSource __RPC_FAR *pSource,
+ /* [in] */ BOOL fEmpty,
+ /* [in] */ XML_NODE_INFO __RPC_FAR *pNodeInfo) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE Error(
+ /* [in] */ IXMLNodeSource __RPC_FAR *pSource,
+ /* [in] */ HRESULT hrErrorCode,
+ /* [in] */ USHORT cNumRecs,
+ /* [in] */ XML_NODE_INFO __RPC_FAR *__RPC_FAR *apNodeInfo) = 0;
+
+ virtual HRESULT STDMETHODCALLTYPE CreateNode(
+ /* [in] */ IXMLNodeSource __RPC_FAR *pSource,
+ /* [in] */ PVOID pNodeParent,
+ /* [in] */ USHORT cNumRecs,
+ /* [in] */ XML_NODE_INFO __RPC_FAR *__RPC_FAR *apNodeInfo) = 0;
+
+ };
+
+#else /* C style interface */
+
+ typedef struct IXMLNodeFactoryVtbl
+ {
+ BEGIN_INTERFACE
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *QueryInterface )(
+ IXMLNodeFactory __RPC_FAR * This,
+ /* [in] */ REFIID riid,
+ /* [iid_is][out] */ void __RPC_FAR *__RPC_FAR *ppvObject);
+
+ ULONG ( STDMETHODCALLTYPE __RPC_FAR *AddRef )(
+ IXMLNodeFactory __RPC_FAR * This);
+
+ ULONG ( STDMETHODCALLTYPE __RPC_FAR *Release )(
+ IXMLNodeFactory __RPC_FAR * This);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *NotifyEvent )(
+ IXMLNodeFactory __RPC_FAR * This,
+ /* [in] */ IXMLNodeSource __RPC_FAR *pSource,
+ /* [in] */ XML_NODEFACTORY_EVENT iEvt);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *BeginChildren )(
+ IXMLNodeFactory __RPC_FAR * This,
+ /* [in] */ IXMLNodeSource __RPC_FAR *pSource,
+ /* [in] */ XML_NODE_INFO __RPC_FAR *pNodeInfo);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *EndChildren )(
+ IXMLNodeFactory __RPC_FAR * This,
+ /* [in] */ IXMLNodeSource __RPC_FAR *pSource,
+ /* [in] */ BOOL fEmpty,
+ /* [in] */ XML_NODE_INFO __RPC_FAR *pNodeInfo);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *Error )(
+ IXMLNodeFactory __RPC_FAR * This,
+ /* [in] */ IXMLNodeSource __RPC_FAR *pSource,
+ /* [in] */ HRESULT hrErrorCode,
+ /* [in] */ USHORT cNumRecs,
+ /* [in] */ XML_NODE_INFO __RPC_FAR *__RPC_FAR *apNodeInfo);
+
+ HRESULT ( STDMETHODCALLTYPE __RPC_FAR *CreateNode )(
+ IXMLNodeFactory __RPC_FAR * This,
+ /* [in] */ IXMLNodeSource __RPC_FAR *pSource,
+ /* [in] */ PVOID pNodeParent,
+ /* [in] */ USHORT cNumRecs,
+ /* [in] */ XML_NODE_INFO __RPC_FAR *__RPC_FAR *apNodeInfo);
+
+ END_INTERFACE
+ } IXMLNodeFactoryVtbl;
+
+ interface IXMLNodeFactory
+ {
+ CONST_VTBL struct IXMLNodeFactoryVtbl __RPC_FAR *lpVtbl;
+ };
+
+
+
+#ifdef COBJMACROS
+
+
+#define IXMLNodeFactory_QueryInterface(This,riid,ppvObject) \
+ (This)->lpVtbl -> QueryInterface(This,riid,ppvObject)
+
+#define IXMLNodeFactory_AddRef(This) \
+ (This)->lpVtbl -> AddRef(This)
+
+#define IXMLNodeFactory_Release(This) \
+ (This)->lpVtbl -> Release(This)
+
+
+#define IXMLNodeFactory_NotifyEvent(This,pSource,iEvt) \
+ (This)->lpVtbl -> NotifyEvent(This,pSource,iEvt)
+
+#define IXMLNodeFactory_BeginChildren(This,pSource,pNodeInfo) \
+ (This)->lpVtbl -> BeginChildren(This,pSource,pNodeInfo)
+
+#define IXMLNodeFactory_EndChildren(This,pSource,fEmpty,pNodeInfo) \
+ (This)->lpVtbl -> EndChildren(This,pSource,fEmpty,pNodeInfo)
+
+#define IXMLNodeFactory_Error(This,pSource,hrErrorCode,cNumRecs,apNodeInfo) \
+ (This)->lpVtbl -> Error(This,pSource,hrErrorCode,cNumRecs,apNodeInfo)
+
+#define IXMLNodeFactory_CreateNode(This,pSource,pNodeParent,cNumRecs,apNodeInfo) \
+ (This)->lpVtbl -> CreateNode(This,pSource,pNodeParent,cNumRecs,apNodeInfo)
+
+#endif /* COBJMACROS */
+
+
+#endif /* C style interface */
+
+
+
+HRESULT STDMETHODCALLTYPE IXMLNodeFactory_NotifyEvent_Proxy(
+ IXMLNodeFactory __RPC_FAR * This,
+ /* [in] */ IXMLNodeSource __RPC_FAR *pSource,
+ /* [in] */ XML_NODEFACTORY_EVENT iEvt);
+
+
+void __RPC_STUB IXMLNodeFactory_NotifyEvent_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IXMLNodeFactory_BeginChildren_Proxy(
+ IXMLNodeFactory __RPC_FAR * This,
+ /* [in] */ IXMLNodeSource __RPC_FAR *pSource,
+ /* [in] */ XML_NODE_INFO __RPC_FAR *pNodeInfo);
+
+
+void __RPC_STUB IXMLNodeFactory_BeginChildren_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IXMLNodeFactory_EndChildren_Proxy(
+ IXMLNodeFactory __RPC_FAR * This,
+ /* [in] */ IXMLNodeSource __RPC_FAR *pSource,
+ /* [in] */ BOOL fEmpty,
+ /* [in] */ XML_NODE_INFO __RPC_FAR *pNodeInfo);
+
+
+void __RPC_STUB IXMLNodeFactory_EndChildren_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IXMLNodeFactory_Error_Proxy(
+ IXMLNodeFactory __RPC_FAR * This,
+ /* [in] */ IXMLNodeSource __RPC_FAR *pSource,
+ /* [in] */ HRESULT hrErrorCode,
+ /* [in] */ USHORT cNumRecs,
+ /* [in] */ XML_NODE_INFO __RPC_FAR *__RPC_FAR *apNodeInfo);
+
+
+void __RPC_STUB IXMLNodeFactory_Error_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+HRESULT STDMETHODCALLTYPE IXMLNodeFactory_CreateNode_Proxy(
+ IXMLNodeFactory __RPC_FAR * This,
+ /* [in] */ IXMLNodeSource __RPC_FAR *pSource,
+ /* [in] */ PVOID pNodeParent,
+ /* [in] */ USHORT cNumRecs,
+ /* [in] */ XML_NODE_INFO __RPC_FAR *__RPC_FAR *apNodeInfo);
+
+
+void __RPC_STUB IXMLNodeFactory_CreateNode_Stub(
+ IRpcStubBuffer *This,
+ IRpcChannelBuffer *_pRpcChannelBuffer,
+ PRPC_MESSAGE _pRpcMessage,
+ DWORD *_pdwStubPhase);
+
+
+
+#endif /* __IXMLNodeFactory_INTERFACE_DEFINED__ */
+
+
+EXTERN_C const CLSID CLSID_XMLParser;
+
+#ifdef __cplusplus
+
+class DECLSPEC_UUID("d2423620-51a0-11d2-9caf-0060b0ec3d39")
+XMLParser;
+#endif
+#endif /* __XMLPSR_LIBRARY_DEFINED__ */
+
+/* Additional Prototypes for ALL interfaces */
+
+/* end of Additional Prototypes */
+
+#ifdef __cplusplus
+}
+#endif
+
+#endif
+
+
diff --git a/src/inc/xmlparser_i.c b/src/inc/xmlparser_i.c
new file mode 100644
index 0000000000..33927f651f
--- /dev/null
+++ b/src/inc/xmlparser_i.c
@@ -0,0 +1,86 @@
+// 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.
+
+/* This was a created file from a newer version of xmlparser.idl than
+ what made xmlparser.h in ndp/clr/src/inc, and then with extra
+ GUIDs expurgated. */
+
+/* this ALWAYS GENERATED file contains the IIDs and CLSIDs */
+
+/* link this file in with the server and any clients */
+
+
+ /* File created by MIDL compiler version 8.00.0571 */
+/* @@MIDL_FILE_HEADING( ) */
+
+#ifdef _MSC_VER
+#pragma warning( disable: 4049 ) /* more than 64k source lines */
+#endif
+
+
+#ifdef __cplusplus
+extern "C"{
+#endif
+
+
+#include <rpc.h>
+#include <rpcndr.h>
+
+#ifdef _MIDL_USE_GUIDDEF_
+
+#ifndef INITGUID
+#define INITGUID
+#include <guiddef.h>
+#undef INITGUID
+#else
+#include <guiddef.h>
+#endif
+
+#define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \
+ DEFINE_GUID(name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8)
+
+#else // !_MIDL_USE_GUIDDEF_
+
+#ifndef __IID_DEFINED__
+#define __IID_DEFINED__
+
+typedef struct _IID
+{
+ unsigned long x;
+ unsigned short s1;
+ unsigned short s2;
+ unsigned char c[8];
+} IID;
+
+#endif // __IID_DEFINED__
+
+#ifndef CLSID_DEFINED
+#define CLSID_DEFINED
+typedef IID CLSID;
+#endif // CLSID_DEFINED
+
+#define MIDL_DEFINE_GUID(type,name,l,w1,w2,b1,b2,b3,b4,b5,b6,b7,b8) \
+ const type name = {l,w1,w2,{b1,b2,b3,b4,b5,b6,b7,b8}}
+
+#endif // !_MIDL_USE_GUIDDEF_
+
+MIDL_DEFINE_GUID(IID, LIBID_XMLPSR,0xd242361c,0x51a0,0x11d2,0x9c,0xaf,0x00,0x60,0xb0,0xec,0x3d,0x39);
+
+
+MIDL_DEFINE_GUID(IID, IID_IXMLNodeSource,0xd242361d,0x51a0,0x11d2,0x9c,0xaf,0x00,0x60,0xb0,0xec,0x3d,0x39);
+
+
+MIDL_DEFINE_GUID(IID, IID_IXMLParser,0xd242361e,0x51a0,0x11d2,0x9c,0xaf,0x00,0x60,0xb0,0xec,0x3d,0x39);
+
+
+MIDL_DEFINE_GUID(IID, IID_IXMLNodeFactory,0xd242361f,0x51a0,0x11d2,0x9c,0xaf,0x00,0x60,0xb0,0xec,0x3d,0x39);
+
+#undef MIDL_DEFINE_GUID
+
+#ifdef __cplusplus
+}
+#endif
+
+
+
diff --git a/src/inc/zapper.h b/src/inc/zapper.h
new file mode 100644
index 0000000000..2fa94373fa
--- /dev/null
+++ b/src/inc/zapper.h
@@ -0,0 +1,581 @@
+// 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.
+
+#ifndef ZAPPER_H_
+#define ZAPPER_H_
+
+#include <winwrap.h>
+#include <windows.h>
+#include <stdlib.h>
+#include <objbase.h>
+#include <stddef.h>
+#include <float.h>
+#include <limits.h>
+
+#include "sarray.h"
+#include "sstring.h"
+#include "shash.h"
+#include "utilcode.h"
+#include "corjit.h"
+#ifdef FEATURE_FUSION
+#include "binderngen.h"
+#endif
+#include "corcompile.h"
+#include "corhlprpriv.h"
+#include "ngen.h"
+#include "corbbtprof.h"
+#include "pedecoder.h"
+#include "mscorsvc.h"
+#include "holderinst.h"
+#include "corpriv.h"
+
+// For side by side issues, it's best to use the exported API calls to generate a
+// Zapper Object instead of creating one on your own.
+
+STDAPI NGenCreateNGenWorker(ICorSvcWorker **pCorSvcWorker, ILocalServerLifetime *pLocalServerLifetime, ICorSvcLogger *pCorSvcLogger);
+STDAPI NGenCreateZapper(HANDLE* hZapper, NGenOptions* opt);
+STDAPI NGenFreeZapper(HANDLE hZapper);
+STDAPI NGenTryEnumerateFusionCache(HANDLE hZapper, LPCWSTR assemblyName, bool fPrint, bool fDelete);
+STDAPI_(BOOL) NGenCompile(HANDLE hZapper, LPCWSTR path);
+
+
+/* --------------------------------------------------------------------------- *
+ * Zapper classes
+ * --------------------------------------------------------------------------- */
+
+class ZapperOptions;
+class ZapperAttributionStats;
+class ZapImage;
+class ZapInfo;
+
+typedef enum CorZapLogLevel
+{
+ CORZAP_LOGLEVEL_ERROR,
+ CORZAP_LOGLEVEL_WARNING,
+ CORZAP_LOGLEVEL_SUCCESS,
+ CORZAP_LOGLEVEL_INFO,
+} CorZapLogLevel;
+
+class Zapper
+{
+ friend class ZapImage;
+ friend class ZapInfo;
+ friend class ZapILMetaData;
+
+ private:
+
+ //
+ // Interfaces
+ //
+
+ ICorDynamicInfo *m_pEEJitInfo;
+ ICorCompileInfo *m_pEECompileInfo;
+ ICorJitCompiler *m_pJitCompiler;
+ IMetaDataDispenserEx *m_pMetaDataDispenser;
+ HMODULE m_hJitLib;
+#ifdef _TARGET_AMD64_
+ HMODULE m_hJitLegacy;
+#endif
+
+#ifdef ALLOW_SXS_JIT_NGEN
+ ICorJitCompiler *m_alternateJit;
+ HMODULE m_hAltJITCompiler;
+#endif // ALLOW_SXS_JIT_NGEN
+
+ //
+ // Options
+ //
+
+ ZapperOptions * m_pOpt;
+ BOOL m_fFreeZapperOptions;
+
+ SString m_exeName; // If an EXE is specified
+
+ bool m_fromDllHost;
+
+ //
+ // Current assembly info
+ //
+
+ ICorCompilationDomain *m_pDomain;
+ CORINFO_ASSEMBLY_HANDLE m_hAssembly;
+ IMDInternalImport *m_pAssemblyImport;
+
+ SString m_outputPath; // Temp folder for creating the output file
+
+ IMetaDataAssemblyEmit *m_pAssemblyEmit;
+ IMetaDataAssemblyEmit *CreateAssemblyEmitter();
+
+ //
+ //
+ // Status info
+ //
+
+ BOOL m_failed;
+ CorInfoRegionKind m_currentRegionKind;
+
+#if defined(FEATURE_CORECLR) || defined(CROSSGEN_COMPILE)
+ SString m_platformAssembliesPaths;
+ SString m_trustedPlatformAssemblies;
+ SString m_platformResourceRoots;
+ SString m_appPaths;
+ SString m_appNiPaths;
+ SString m_platformWinmdPaths;
+#endif // FEATURE_CORECLR || CROSSGEN_COMPILE
+
+#if defined(FEATURE_CORECLR) && !defined(FEATURE_MERGE_JIT_AND_ENGINE)
+ SString m_CLRJITPath;
+ bool m_fDontLoadJit;
+#endif // defined(FEATURE_CORECLR) && !defined(FEATURE_MERGE_JIT_AND_ENGINE)
+#if defined(FEATURE_CORECLR) && !defined(NO_NGENPDB)
+ SString m_DiasymreaderPath;
+#endif // defined(FEATURE_CORECLR) && !defined(NO_NGENPDB)
+ bool m_fForceFullTrust;
+
+ SString m_outputFilename;
+
+ public:
+
+ struct assemblyDependencies
+ {
+ struct DependencyEntry
+ {
+ BSTR bstr;
+ LoadHintEnum loadHint;
+ NGenHintEnum ngenHint;
+ };
+
+ SArray<DependencyEntry> dependencyArray;
+ NGenHintEnum ngenHint;
+ SString displayName;
+
+ assemblyDependencies()
+ {
+ Initialize();
+ ngenHint = NGenDefault;
+ }
+
+ ~assemblyDependencies()
+ {
+ Cleanup();
+ }
+
+ void Reinitialize()
+ {
+ Cleanup();
+ Initialize();
+ }
+
+ void SetNGenHint(NGenHintEnum ngenHint)
+ {
+ this->ngenHint = ngenHint;
+ }
+
+ NGenHintEnum GetNGenHint()
+ {
+ return ngenHint;
+ }
+
+ void SetDisplayName(const WCHAR *pStr)
+ {
+ displayName.Set(pStr);
+ }
+
+ const WCHAR *GetDisplayName()
+ {
+ return displayName.GetUnicode();
+ }
+
+ void Append(const WCHAR *pStr, LoadHintEnum loadHint = LoadDefault, NGenHintEnum ngenHint = NGenDefault)
+ {
+ // Don't append string if it's a duplicate
+ for (COUNT_T i = 0; i < dependencyArray.GetCount(); i++)
+ {
+ if (wcscmp(dependencyArray[i].bstr, pStr) == 0)
+ return;
+ }
+
+ BSTRHolder bstr(::SysAllocString(pStr));
+ DependencyEntry dependencyEntry;
+ dependencyEntry.bstr = bstr.GetValue();
+ dependencyEntry.loadHint = loadHint;
+ dependencyEntry.ngenHint = ngenHint;
+
+ dependencyArray.Append(dependencyEntry);
+ bstr.SuppressRelease();
+ }
+
+ SAFEARRAY *GetSAFEARRAY()
+ {
+ SafeArrayHolder pDependencies(SafeArrayCreateVector(VT_BSTR, 0, dependencyArray.GetCount()));
+ if (pDependencies.GetValue() == NULL) ThrowLastError();
+
+ for (COUNT_T i = 0; i < dependencyArray.GetCount(); i++)
+ {
+ LONG indices[1];
+ indices[0] = (LONG) i;
+ IfFailThrow(SafeArrayPutElement(pDependencies, indices, this->dependencyArray[i].bstr));
+ }
+
+ pDependencies.SuppressRelease();
+ return pDependencies.GetValue();
+ }
+
+ SAFEARRAY *GetLoadHintSAFEARRAY()
+ {
+ SafeArrayHolder pSettings(SafeArrayCreateVector(VT_UI4, 0, dependencyArray.GetCount()));
+ if (pSettings.GetValue() == NULL) ThrowLastError();
+
+ for (COUNT_T i = 0; i < dependencyArray.GetCount(); i++)
+ {
+ LONG indices[1];
+ indices[0] = (LONG) i;
+ IfFailThrow(SafeArrayPutElement(pSettings, indices, &this->dependencyArray[i].loadHint));
+ }
+
+ pSettings.SuppressRelease();
+ return pSettings.GetValue();
+ }
+
+ SAFEARRAY *GetNGenHintSAFEARRAY()
+ {
+ SafeArrayHolder pSettings(SafeArrayCreateVector(VT_UI4, 0, dependencyArray.GetCount()));
+ if (pSettings.GetValue() == NULL) ThrowLastError();
+
+ for (COUNT_T i = 0; i < dependencyArray.GetCount(); i++)
+ {
+ LONG indices[1];
+ indices[0] = (LONG) i;
+ IfFailThrow(SafeArrayPutElement(pSettings, indices, &this->dependencyArray[i].ngenHint));
+ }
+
+ pSettings.SuppressRelease();
+ return pSettings.GetValue();
+ }
+
+ private:
+ void Initialize()
+ {
+ dependencyArray.SetCount(0);
+ // Should we reinitialize ngenHint to the default value as well?
+ }
+
+ void Cleanup()
+ {
+ for (COUNT_T i = 0; i < dependencyArray.GetCount(); i++)
+ {
+ ::SysFreeString(dependencyArray[i].bstr);
+ }
+ }
+ } m_assemblyDependencies;
+
+#ifndef FEATURE_CORECLR // No load lists on CoreCLR
+ struct loadLists
+ {
+ loadLists() :
+ m_loadAlwaysList(NULL),
+ m_loadSometimesList(NULL),
+ m_loadNeverList(NULL)
+ {
+ }
+
+ SAFEARRAY *m_loadAlwaysList;
+ SAFEARRAY *m_loadSometimesList;
+ SAFEARRAY *m_loadNeverList;
+
+ void SetLoadLists(SAFEARRAY *loadAlwaysList, SAFEARRAY *loadSometimesList, SAFEARRAY *loadNeverList)
+ {
+ m_loadAlwaysList = loadAlwaysList;
+ m_loadSometimesList = loadSometimesList;
+ m_loadNeverList = loadNeverList;
+ }
+
+ } m_loadLists;
+
+ void SetLoadLists(SAFEARRAY *loadAlwaysList, SAFEARRAY *loadSometimesList, SAFEARRAY *loadNeverList)
+ {
+ m_loadLists.SetLoadLists(loadAlwaysList, loadSometimesList, loadNeverList);
+ }
+
+ void SetAssemblyHardBindList()
+ {
+ SAFEARRAY *loadAlwaysList = m_loadLists.m_loadAlwaysList;
+ if (loadAlwaysList == NULL)
+ {
+ return;
+ }
+
+ LONG ubound = 0;
+ IfFailThrow(SafeArrayGetUBound(loadAlwaysList, 1, &ubound));
+
+ BSTR *pArrBstr = NULL;
+ IfFailThrow(SafeArrayAccessData(loadAlwaysList, reinterpret_cast<void **>(&pArrBstr)));
+
+ EX_TRY
+ {
+ _ASSERTE((ubound + 1) >= 0);
+ m_pEECompileInfo->SetAssemblyHardBindList(reinterpret_cast<LPWSTR *>(pArrBstr), ubound + 1);
+ }
+ EX_CATCH
+ {
+ // If something went wrong, try to unlock the OLE array
+ // Do not verify the outcome, as we can do nothing about it
+ SafeArrayUnaccessData(loadAlwaysList);
+ EX_RETHROW;
+ }
+ EX_END_CATCH_UNREACHABLE;
+
+ IfFailThrow(SafeArrayUnaccessData(loadAlwaysList));
+ }
+#endif // !FEATURE_CORECLR
+
+ public:
+
+ Zapper(ZapperOptions *pOpt);
+ Zapper(NGenOptions *pOpt, bool fromDllHost = false);
+
+ void Init(ZapperOptions *pOpt, bool fFreeZapperOptions= false);
+
+ static Zapper *NewZapper(NGenOptions *pOpt, bool fromDllHost = false)
+ {
+ CONTRACTL
+ {
+ THROWS;
+ GC_NOTRIGGER;
+ }
+ CONTRACTL_END;
+ return new Zapper(pOpt, fromDllHost);
+ }
+
+ ~Zapper();
+
+ // The arguments control which native image of mscorlib to use.
+ // This matters for hardbinding.
+ void InitEE(BOOL fForceDebug, BOOL fForceProfile, BOOL fForceInstrument);
+ void LoadAndInitializeJITForNgen(LPCWSTR pwzJitName, OUT HINSTANCE* phJit, OUT ICorJitCompiler** ppICorJitCompiler);
+
+#ifdef FEATURE_FUSION
+ HRESULT TryEnumerateFusionCache(LPCWSTR assemblyName, bool fPrint, bool fDelete);
+ int EnumerateFusionCache(LPCWSTR assemblyName, bool fPrint, bool fDelete,
+ CORCOMPILE_NGEN_SIGNATURE * pNativeImageSig = NULL);
+ void PrintFusionCacheEntry(CorSvcLogLevel logLevel, IAssemblyName *pZapAssemblyName);
+ void DeleteFusionCacheEntry(IAssemblyName *pZapAssemblyName);
+ void DeleteFusionCacheEntry(LPCWSTR assemblyName, CORCOMPILE_NGEN_SIGNATURE *pNativeImageSig);
+
+ void PrintDependencies(
+ IMetaDataAssemblyImport * pAssemblyImport,
+ CORCOMPILE_DEPENDENCY * pDependencies,
+ COUNT_T cDependencies,
+ SString &s);
+ BOOL VerifyDependencies(
+ IMDInternalImport * pAssemblyImport,
+ CORCOMPILE_DEPENDENCY * pDependencies,
+ COUNT_T cDependencies);
+
+ void PrintAssemblyVersionInfo(IAssemblyName *pZapAssemblyName, SString &s);
+
+ IAssemblyName *GetAssemblyFusionName(IMetaDataAssemblyImport *pImport);
+ IAssemblyName *GetAssemblyRefFusionName(IMetaDataAssemblyImport *pImport,
+ mdAssemblyRef ar);
+#endif //FEATURE_FUSION
+
+ BOOL IsAssembly(LPCWSTR path);
+
+ void CreateDependenciesLookupDomain();
+ void ComputeDependencies(LPCWSTR pAssemblyName, CORCOMPILE_NGEN_SIGNATURE * pNativeImageSig);
+ void ComputeAssemblyDependencies(CORINFO_ASSEMBLY_HANDLE hAssembly);
+
+ void CreatePdb(BSTR pAssemblyPathOrName, BSTR pNativeImagePath, BSTR pPdbPath, BOOL pdbLines, BSTR pManagedPdbSearchPath);
+ void CreatePdbInCurrentDomain(BSTR pAssemblyPathOrName, BSTR pNativeImagePath, BSTR pPdbPath, BOOL pdbLines, BSTR pManagedPdbSearchPath);
+
+ void DefineOutputAssembly(SString& strAssemblyName, ULONG * pHashAlgId);
+
+ HRESULT Compile(LPCWSTR path, CORCOMPILE_NGEN_SIGNATURE * pNativeImageSig = NULL);
+ void DontUseProfileData();
+ bool HasProfileData();
+
+ void CompileAssembly(CORCOMPILE_NGEN_SIGNATURE * pNativeImageSig);
+ ZapImage * CompileModule(CORINFO_MODULE_HANDLE hModule,
+ IMetaDataAssemblyEmit *pEmit);
+#ifdef FEATURE_MULTIMODULE_ASSEMBLIES
+ void CompileNonManifestModules(ULONG hashAlgId, SArray<HANDLE> &hFiles);
+ static void * GetMapViewOfFile(
+ HANDLE hFile,
+ DWORD * pdwFileLen);
+ static void ComputeHashValue(HANDLE hFile, int hashAlg,
+ BYTE **ppHashValue, DWORD *cbHashValue);
+#endif // FEATURE_MULTIMODULE_ASSEMBLIES
+ void InstallCompiledAssembly(LPCWSTR szAssemblyName, LPCWSTR szNativeImagePath, HANDLE hFile, SArray<HANDLE> &hFiles);
+
+ HRESULT GetExceptionHR();
+
+ void Success(LPCWSTR format, ...);
+ void Error(LPCWSTR format, ...);
+ void Warning(LPCWSTR format, ...);
+ void Info(LPCWSTR format, ...);
+ void Print(CorZapLogLevel level, LPCWSTR format, ...);
+ void Print(CorZapLogLevel level, LPCWSTR format, va_list args);
+ void PrintErrorMessage(CorZapLogLevel level, Exception *ex);
+ void PrintErrorMessage(CorZapLogLevel level, HRESULT hr);
+ void ReportEventNGEN(WORD wType, DWORD dwEventID, LPCWSTR format, ...);
+
+ BOOL CheckAssemblyUpToDate(CORINFO_ASSEMBLY_HANDLE hAssembly, CORCOMPILE_NGEN_SIGNATURE * pNativeImageSig);
+ BOOL TryToInstallFromRepository(CORINFO_ASSEMBLY_HANDLE hAssembly, CORCOMPILE_NGEN_SIGNATURE * pNativeImageSig);
+ BOOL TryToInstallFromRepositoryDir(SString &strNativeImageDir,
+ SString &strSimpleName,
+ CORCOMPILE_NGEN_SIGNATURE *pNativeImageSig,
+ BOOL *pfHitMismatchedVersion,
+ BOOL *pfHitMismatchedDependencies,
+ BOOL useHardLink = FALSE);
+ void CopyAndInstallFromRepository(LPCWSTR lpszNativeImageDir,
+ LPCWSTR lpszNativeImageName,
+ CORCOMPILE_NGEN_SIGNATURE * pNativeImageSig,
+ BOOL useHardLink = FALSE);
+ void InstallFromRepository(LPCWSTR lpszNativeImage,
+ CORCOMPILE_NGEN_SIGNATURE * pNativeImageSig);
+
+ void CopyDirectory(LPCWSTR srcPath, LPCWSTR dstPath);
+ void CleanDirectory(LPCWSTR path);
+ void TryCleanDirectory(LPCWSTR path);
+ static void TryCleanDirectory(Zapper * pZapper);
+
+ void GetOutputFolder();
+
+#if defined(FEATURE_CORECLR) || defined(CROSSGEN_COMPILE)
+ void SetPlatformAssembliesPaths(LPCWSTR pwzPlatformAssembliesPaths);
+ void SetTrustedPlatformAssemblies(LPCWSTR pwzTrustedPlatformAssemblies);
+ void SetPlatformResourceRoots(LPCWSTR pwzPlatformResourceRoots);
+ void SetAppPaths(LPCWSTR pwzAppPaths);
+ void SetAppNiPaths(LPCWSTR pwzAppNiPaths);
+ void SetPlatformWinmdPaths(LPCWSTR pwzPlatformWinmdPaths);
+ void SetForceFullTrust(bool val);
+#endif // FEATURE_CORECLR || CROSSGEN_COMPILE
+
+#if defined(FEATURE_CORECLR) && !defined(FEATURE_MERGE_JIT_AND_ENGINE)
+ void SetCLRJITPath(LPCWSTR pwszCLRJITPath);
+ void SetDontLoadJit();
+#endif // defined(FEATURE_CORECLR) && !defined(FEATURE_MERGE_JIT_AND_ENGINE)
+
+#if defined(FEATURE_CORECLR) && !defined(NO_NGENPDB)
+ void SetDiasymreaderPath(LPCWSTR pwzDiasymreaderPath);
+#endif // defined(FEATURE_CORECLR) && !defined(NO_NGENPDB)
+
+ void SetOutputFilename(LPCWSTR pwszOutputFilename);
+ SString GetOutputFileName();
+
+ void SetLegacyMode();
+
+ private:
+
+ void DestroyDomain();
+ void CleanupAssembly();
+
+ void CreateCompilationDomain();
+ void SetContextInfo(LPCWSTR assemblyName = NULL);
+
+ void InitializeCompilerFlags(CORCOMPILE_VERSION_INFO * pVersionInfo);
+
+ // DomainCallback is subclassed by each method that would like to compile in a given domain
+ class DomainCallback
+ {
+ public:
+ virtual void doCallback() = NULL;
+ };
+
+ static HRESULT __stdcall GenericDomainCallback(LPVOID pvArgs);
+ void InvokeDomainCallback(DomainCallback *callback);
+
+ void CompileInCurrentDomain(__in LPCWSTR path, CORCOMPILE_NGEN_SIGNATURE * pNativeImageSig);
+ void ComputeDependenciesInCurrentDomain(LPCWSTR pAssemblyName, CORCOMPILE_NGEN_SIGNATURE * pNativeImageSig);
+ void CreateDependenciesLookupDomainInCurrentDomain();
+
+ void HangWorker(LPCWSTR hangKey, LPCWSTR insideHangKey);
+};
+
+class ZapperOptions
+{
+ public:
+ enum StatOptions
+ {
+ NO_STATS = 0,
+ DEFAULT_STATS = 1,
+ FIXUP_STATS = DEFAULT_STATS << 1,
+ CALL_STATS = FIXUP_STATS << 1,
+ ATTRIB_STATS = CALL_STATS << 1,
+ ALL_STATS = ~NO_STATS,
+ };
+
+ LPWSTR m_zapSet; // Add to zap string. Use to get a private scope of ngen images, for debugging/testing
+
+ LPCWSTR m_repositoryDir; // Directory with prebuilt native images
+ RepositoryFlags m_repositoryFlags; // Copy the native images back to NativeImagesDir
+
+ bool m_autodebug; // Use the debug setting specified by the IL module
+
+ MethodNamesList* m_onlyMethods; // only methods to process
+ MethodNamesList* m_excludeMethods; // excluded these methods
+ mdToken m_onlyOneMethod; // only compile method with matching token
+
+ bool m_silent; // Dont spew any text output
+ bool m_verbose; // Spew extra text ouput
+ bool m_ignoreErrors; // Continue in the face of errors
+ unsigned m_statOptions; // print statisitcs on number of methods, size of code ...
+ bool m_ngenProfileImage; // ngening with "/prof"
+
+ // Which optimizations should be done
+ bool m_ignoreProfileData; // Don't use profile data
+ bool m_noProcedureSplitting; // Don't do procedure splitting
+
+ bool m_fHasAnyProfileData; // true if we successfully loaded and used
+ // any profile data when compiling this assembly
+
+ bool m_fPartialNGen; // Generate partial NGen images using IBC data
+
+ bool m_fPartialNGenSet; // m_fPartialNGen has been set through the environment
+
+ bool m_fAutoNGen; // This is an automatic NGen request
+
+ bool m_fRepositoryOnly; // Install from repository only, no real NGen
+
+ bool m_fNGenLastRetry; // This is retry of the compilation
+
+ unsigned m_compilerFlags;
+
+ bool m_legacyMode; // true if the zapper was invoked using legacy mode
+
+#ifdef FEATURE_CORECLR
+ bool m_fNoMetaData; // Do not copy metadata and IL to native image
+#endif
+
+ ZapperOptions();
+ ~ZapperOptions();
+};
+
+struct NGenPrivateAttributesClass : public NGenPrivateAttributes
+{
+ NGenPrivateAttributesClass()
+ {
+ Flags = 0;
+ ZapStats = 0;
+ DbgDir = NULL;
+ }
+
+private:
+ // Make sure that copies of this object aren't inadvertently created
+ NGenPrivateAttributesClass(const NGenPrivateAttributesClass &init);
+ const NGenPrivateAttributesClass &operator =(const NGenPrivateAttributesClass &rhs);
+
+public:
+ ~NGenPrivateAttributesClass()
+ {
+ if (DbgDir)
+ {
+ ::SysFreeString(DbgDir);
+ DbgDir = NULL;
+ }
+ }
+};
+
+#endif // ZAPPER_H_
+