summaryrefslogtreecommitdiff
path: root/src/mscorlib/src
diff options
context:
space:
mode:
authorJiyoung Yun <jy910.yun@samsung.com>2016-11-23 10:09:09 (GMT)
committerJiyoung Yun <jy910.yun@samsung.com>2016-11-23 10:09:09 (GMT)
commit4b4aad7217d3292650e77eec2cf4c198ea9c3b4b (patch)
tree98110734c91668dfdbb126fcc0e15ddbd93738ca /src/mscorlib/src
parentfa45f57ed55137c75ac870356a1b8f76c84b229c (diff)
downloadcoreclr-4b4aad7217d3292650e77eec2cf4c198ea9c3b4b.zip
coreclr-4b4aad7217d3292650e77eec2cf4c198ea9c3b4b.tar.gz
coreclr-4b4aad7217d3292650e77eec2cf4c198ea9c3b4b.tar.bz2
Imported Upstream version 1.1.0upstream/1.1.0
Diffstat (limited to 'src/mscorlib/src')
-rw-r--r--src/mscorlib/src/GlobalSuppressions.cs105
-rw-r--r--src/mscorlib/src/Internal/Runtime/Augments/EnvironmentAugments.cs21
-rw-r--r--src/mscorlib/src/Microsoft/Win32/OAVariantLib.cs134
-rw-r--r--src/mscorlib/src/Microsoft/Win32/Registry.cs174
-rw-r--r--src/mscorlib/src/Microsoft/Win32/RegistryKey.cs2166
-rw-r--r--src/mscorlib/src/Microsoft/Win32/RegistryOptions.cs25
-rw-r--r--src/mscorlib/src/Microsoft/Win32/RegistryValueKind.cs20
-rw-r--r--src/mscorlib/src/Microsoft/Win32/RegistryView.cs19
-rw-r--r--src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeFileHandle.cs43
-rw-r--r--src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeFileMappingHandle.cs43
-rw-r--r--src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeFindHandle.cs35
-rw-r--r--src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeLibraryHandle.cs29
-rw-r--r--src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeLocalAllocHandle.cs29
-rw-r--r--src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeRegistryHandle.cs41
-rw-r--r--src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeViewOfFileHandle.cs50
-rw-r--r--src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeWaitHandle.cs47
-rw-r--r--src/mscorlib/src/Microsoft/Win32/SafeHandles/Win32SafeHandles.cs112
-rw-r--r--src/mscorlib/src/Microsoft/Win32/UnsafeNativeMethods.cs282
-rw-r--r--src/mscorlib/src/Microsoft/Win32/Win32Native.cs2455
-rw-r--r--src/mscorlib/src/System.Private.CoreLib.txt3495
-rw-r--r--src/mscorlib/src/System/AccessViolationException.cs51
-rw-r--r--src/mscorlib/src/System/Action.cs78
-rw-r--r--src/mscorlib/src/System/Activator.cs688
-rw-r--r--src/mscorlib/src/System/AggregateException.cs497
-rw-r--r--src/mscorlib/src/System/AppContext/AppContext.cs189
-rw-r--r--src/mscorlib/src/System/AppContext/AppContextDefaultValues.CoreClrOverrides.cs21
-rw-r--r--src/mscorlib/src/System/AppContext/AppContextDefaultValues.Defaults.Central.cs33
-rw-r--r--src/mscorlib/src/System/AppContext/AppContextDefaultValues.Defaults.cs71
-rw-r--r--src/mscorlib/src/System/AppContext/AppContextDefaultValues.cs164
-rw-r--r--src/mscorlib/src/System/AppContext/AppContextSwitches.cs110
-rw-r--r--src/mscorlib/src/System/AppDomain.cs4681
-rw-r--r--src/mscorlib/src/System/AppDomainAttributes.cs48
-rw-r--r--src/mscorlib/src/System/AppDomainManager.cs220
-rw-r--r--src/mscorlib/src/System/AppDomainSetup.cs1444
-rw-r--r--src/mscorlib/src/System/AppDomainUnloadedException.cs43
-rw-r--r--src/mscorlib/src/System/ApplicationException.cs56
-rw-r--r--src/mscorlib/src/System/ApplicationId.cs141
-rw-r--r--src/mscorlib/src/System/ArgIterator.cs148
-rw-r--r--src/mscorlib/src/System/ArgumentException.cs95
-rw-r--r--src/mscorlib/src/System/ArgumentNullException.cs55
-rw-r--r--src/mscorlib/src/System/ArgumentOutOfRangeException.cs106
-rw-r--r--src/mscorlib/src/System/ArithmeticException.cs52
-rw-r--r--src/mscorlib/src/System/Array.cs2858
-rw-r--r--src/mscorlib/src/System/ArraySegment.cs342
-rw-r--r--src/mscorlib/src/System/ArrayTypeMismatchException.cs52
-rw-r--r--src/mscorlib/src/System/AsyncCallback.cs17
-rw-r--r--src/mscorlib/src/System/Attribute.cs975
-rw-r--r--src/mscorlib/src/System/AttributeTargets.cs40
-rw-r--r--src/mscorlib/src/System/AttributeUsageAttribute.cs57
-rw-r--r--src/mscorlib/src/System/BCLDebug.cs442
-rw-r--r--src/mscorlib/src/System/BadImageFormatException.cs158
-rw-r--r--src/mscorlib/src/System/BitConverter.cs451
-rw-r--r--src/mscorlib/src/System/Boolean.cs305
-rw-r--r--src/mscorlib/src/System/Buffer.cs645
-rw-r--r--src/mscorlib/src/System/Byte.cs253
-rw-r--r--src/mscorlib/src/System/CLRConfig.cs36
-rw-r--r--src/mscorlib/src/System/CLSCompliantAttribute.cs34
-rw-r--r--src/mscorlib/src/System/CannotUnloadAppDomainException.cs49
-rw-r--r--src/mscorlib/src/System/CfgParser.cs574
-rw-r--r--src/mscorlib/src/System/Char.cs1001
-rw-r--r--src/mscorlib/src/System/CharEnumerator.cs75
-rw-r--r--src/mscorlib/src/System/Collections/ArrayList.cs2635
-rw-r--r--src/mscorlib/src/System/Collections/BitArray.cs524
-rw-r--r--src/mscorlib/src/System/Collections/CollectionBase.cs215
-rw-r--r--src/mscorlib/src/System/Collections/Comparer.cs98
-rw-r--r--src/mscorlib/src/System/Collections/CompatibleComparer.cs67
-rw-r--r--src/mscorlib/src/System/Collections/Concurrent/ConcurrentDictionary.cs2095
-rw-r--r--src/mscorlib/src/System/Collections/Concurrent/ConcurrentQueue.cs960
-rw-r--r--src/mscorlib/src/System/Collections/Concurrent/ConcurrentStack.cs840
-rw-r--r--src/mscorlib/src/System/Collections/Concurrent/IProducerConsumerCollection.cs116
-rw-r--r--src/mscorlib/src/System/Collections/Concurrent/OrderablePartitioner.cs281
-rw-r--r--src/mscorlib/src/System/Collections/Concurrent/Partitioner.cs102
-rw-r--r--src/mscorlib/src/System/Collections/Concurrent/PartitionerStatic.cs1733
-rw-r--r--src/mscorlib/src/System/Collections/DictionaryEntry.cs55
-rw-r--r--src/mscorlib/src/System/Collections/EmptyReadOnlyDictionaryInternal.cs194
-rw-r--r--src/mscorlib/src/System/Collections/Generic/ArraySortHelper.cs1558
-rw-r--r--src/mscorlib/src/System/Collections/Generic/Comparer.cs325
-rw-r--r--src/mscorlib/src/System/Collections/Generic/DebugView.cs129
-rw-r--r--src/mscorlib/src/System/Collections/Generic/Dictionary.cs1187
-rw-r--r--src/mscorlib/src/System/Collections/Generic/EqualityComparer.cs621
-rw-r--r--src/mscorlib/src/System/Collections/Generic/ICollection.cs52
-rw-r--r--src/mscorlib/src/System/Collections/Generic/IComparer.cs30
-rw-r--r--src/mscorlib/src/System/Collections/Generic/IDictionary.cs58
-rw-r--r--src/mscorlib/src/System/Collections/Generic/IEnumerable.cs38
-rw-r--r--src/mscorlib/src/System/Collections/Generic/IEnumerator.cs35
-rw-r--r--src/mscorlib/src/System/Collections/Generic/IEqualityComparer.cs19
-rw-r--r--src/mscorlib/src/System/Collections/Generic/IList.cs54
-rw-r--r--src/mscorlib/src/System/Collections/Generic/IReadOnlyCollection.cs34
-rw-r--r--src/mscorlib/src/System/Collections/Generic/IReadOnlyDictionary.cs29
-rw-r--r--src/mscorlib/src/System/Collections/Generic/IReadOnlyList.cs34
-rw-r--r--src/mscorlib/src/System/Collections/Generic/KeyNotFoundException.cs45
-rw-r--r--src/mscorlib/src/System/Collections/Generic/KeyValuePair.cs56
-rw-r--r--src/mscorlib/src/System/Collections/Generic/List.cs1120
-rw-r--r--src/mscorlib/src/System/Collections/Hashtable.cs1847
-rw-r--r--src/mscorlib/src/System/Collections/ICollection.cs81
-rw-r--r--src/mscorlib/src/System/Collections/IComparer.cs32
-rw-r--r--src/mscorlib/src/System/Collections/IDictionary.cs69
-rw-r--r--src/mscorlib/src/System/Collections/IDictionaryEnumerator.cs79
-rw-r--r--src/mscorlib/src/System/Collections/IEnumerable.cs34
-rw-r--r--src/mscorlib/src/System/Collections/IEnumerator.cs53
-rw-r--r--src/mscorlib/src/System/Collections/IEqualityComparer.cs27
-rw-r--r--src/mscorlib/src/System/Collections/IHashCodeProvider.cs30
-rw-r--r--src/mscorlib/src/System/Collections/IList.cs71
-rw-r--r--src/mscorlib/src/System/Collections/IStructuralComparable.cs11
-rw-r--r--src/mscorlib/src/System/Collections/IStructuralEquatable.cs10
-rw-r--r--src/mscorlib/src/System/Collections/KeyValuePairs.cs40
-rw-r--r--src/mscorlib/src/System/Collections/ListDictionaryInternal.cs429
-rw-r--r--src/mscorlib/src/System/Collections/ObjectModel/Collection.cs328
-rw-r--r--src/mscorlib/src/System/Collections/ObjectModel/KeyedCollection.cs245
-rw-r--r--src/mscorlib/src/System/Collections/ObjectModel/ReadOnlyCollection.cs232
-rw-r--r--src/mscorlib/src/System/Collections/ObjectModel/ReadOnlyDictionary.cs625
-rw-r--r--src/mscorlib/src/System/Collections/SortedList.cs1011
-rw-r--r--src/mscorlib/src/System/Collections/Stack.cs380
-rw-r--r--src/mscorlib/src/System/Collections/StructuralComparisons.cs89
-rw-r--r--src/mscorlib/src/System/CompatibilitySwitches.cs130
-rw-r--r--src/mscorlib/src/System/Configuration/Assemblies/AssemblyHash.cs74
-rw-r--r--src/mscorlib/src/System/Configuration/Assemblies/AssemblyHashAlgorithm.cs32
-rw-r--r--src/mscorlib/src/System/Configuration/Assemblies/AssemblyVersionCompatibility.cs24
-rw-r--r--src/mscorlib/src/System/ContextBoundObject.cs24
-rw-r--r--src/mscorlib/src/System/ContextMarshalException.cs45
-rw-r--r--src/mscorlib/src/System/ContextStaticAttribute.cs32
-rw-r--r--src/mscorlib/src/System/Convert.cs2718
-rw-r--r--src/mscorlib/src/System/Currency.cs61
-rw-r--r--src/mscorlib/src/System/CurrentTimeZone.cs310
-rw-r--r--src/mscorlib/src/System/DBNull.cs122
-rw-r--r--src/mscorlib/src/System/DataMisalignedException.cs45
-rw-r--r--src/mscorlib/src/System/DateTime.cs1379
-rw-r--r--src/mscorlib/src/System/DateTimeKind.cs19
-rw-r--r--src/mscorlib/src/System/DateTimeOffset.cs831
-rw-r--r--src/mscorlib/src/System/DayOfWeek.cs26
-rw-r--r--src/mscorlib/src/System/Decimal.cs1244
-rw-r--r--src/mscorlib/src/System/DefaultBinder.cs1168
-rw-r--r--src/mscorlib/src/System/Delegate.cs754
-rw-r--r--src/mscorlib/src/System/DelegateSerializationHolder.cs299
-rw-r--r--src/mscorlib/src/System/Diagnostics/Assert.cs114
-rw-r--r--src/mscorlib/src/System/Diagnostics/AssertFilter.cs46
-rw-r--r--src/mscorlib/src/System/Diagnostics/AssertFilters.cs24
-rw-r--r--src/mscorlib/src/System/Diagnostics/CodeAnalysis/SuppressMessageAttribute.cs76
-rw-r--r--src/mscorlib/src/System/Diagnostics/ConditionalAttribute.cs26
-rw-r--r--src/mscorlib/src/System/Diagnostics/Contracts/Contracts.cs1017
-rw-r--r--src/mscorlib/src/System/Diagnostics/Contracts/ContractsBCL.cs521
-rw-r--r--src/mscorlib/src/System/Diagnostics/Debugger.cs195
-rw-r--r--src/mscorlib/src/System/Diagnostics/DebuggerAttributes.cs378
-rw-r--r--src/mscorlib/src/System/Diagnostics/EditAndContinueHelper.cs27
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/ActivityTracker.cs670
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/EventActivityOptions.cs39
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/EventCounter.cs436
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/EventDescriptor.cs193
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/EventProvider.cs1220
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/EventSource.cs6962
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/EventSourceException.cs53
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/EventSource_CoreCLR.cs224
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/FrameworkEventSource.cs620
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/StubEnvironment.cs373
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/ArrayTypeInfo.cs63
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/ConcurrentSet.cs127
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/ConcurrentSetItem.cs25
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/DataCollector.cs319
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/EmptyStruct.cs17
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/EnumHelper.cs30
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/EnumerableTypeInfo.cs64
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/EventDataAttribute.cs146
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/EventFieldAttribute.cs76
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/EventFieldFormat.cs130
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/EventIgnoreAttribute.cs25
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/EventPayload.cs154
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/EventSourceActivity.cs321
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/EventSourceOptions.cs130
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/FieldMetadata.cs231
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/InvokeTypeInfo.cs96
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/NameInfo.cs79
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/PropertyAnalysis.cs39
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/PropertyValue.cs251
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/SimpleEventTypes.cs39
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/SimpleTypeInfos.cs296
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/Statics.cs727
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/TraceLoggingDataCollector.cs105
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/TraceLoggingDataType.cs349
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/TraceLoggingEventSource.cs902
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/TraceLoggingEventTraits.cs28
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/TraceLoggingEventTypes.cs262
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/TraceLoggingMetadataCollector.cs370
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/TraceLoggingTypeInfo.cs209
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/TraceLogging/TypeAnalysis.cs103
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/Winmeta.cs196
-rw-r--r--src/mscorlib/src/System/Diagnostics/Eventing/XplatEventLogger.cs164
-rw-r--r--src/mscorlib/src/System/Diagnostics/ICustomDebuggerNotification.cs21
-rw-r--r--src/mscorlib/src/System/Diagnostics/LogSwitch.cs142
-rw-r--r--src/mscorlib/src/System/Diagnostics/LoggingLevels.cs45
-rw-r--r--src/mscorlib/src/System/Diagnostics/Stackframe.cs348
-rw-r--r--src/mscorlib/src/System/Diagnostics/Stacktrace.cs770
-rw-r--r--src/mscorlib/src/System/Diagnostics/SymbolStore/ISymBinder.cs42
-rw-r--r--src/mscorlib/src/System/Diagnostics/SymbolStore/ISymDocument.cs48
-rw-r--r--src/mscorlib/src/System/Diagnostics/SymbolStore/ISymDocumentWriter.cs31
-rw-r--r--src/mscorlib/src/System/Diagnostics/SymbolStore/ISymMethod.cs86
-rw-r--r--src/mscorlib/src/System/Diagnostics/SymbolStore/ISymNamespace.cs30
-rw-r--r--src/mscorlib/src/System/Diagnostics/SymbolStore/ISymReader.cs68
-rw-r--r--src/mscorlib/src/System/Diagnostics/SymbolStore/ISymScope.cs47
-rw-r--r--src/mscorlib/src/System/Diagnostics/SymbolStore/ISymVariable.cs41
-rw-r--r--src/mscorlib/src/System/Diagnostics/SymbolStore/ISymWriter.cs218
-rw-r--r--src/mscorlib/src/System/Diagnostics/SymbolStore/SymAddressKind.cs52
-rw-r--r--src/mscorlib/src/System/Diagnostics/SymbolStore/SymDocumentType.cs24
-rw-r--r--src/mscorlib/src/System/Diagnostics/SymbolStore/SymLanguageType.cs42
-rw-r--r--src/mscorlib/src/System/Diagnostics/SymbolStore/SymLanguageVendor.cs23
-rw-r--r--src/mscorlib/src/System/Diagnostics/SymbolStore/Token.cs51
-rw-r--r--src/mscorlib/src/System/Diagnostics/log.cs251
-rw-r--r--src/mscorlib/src/System/DivideByZeroException.cs39
-rw-r--r--src/mscorlib/src/System/DllNotFoundException.cs40
-rw-r--r--src/mscorlib/src/System/Double.cs367
-rw-r--r--src/mscorlib/src/System/DuplicateWaitObjectException.cs63
-rw-r--r--src/mscorlib/src/System/Empty.cs37
-rw-r--r--src/mscorlib/src/System/EntryPointNotFoundException.cs42
-rw-r--r--src/mscorlib/src/System/Enum.cs1265
-rw-r--r--src/mscorlib/src/System/Environment.cs1768
-rw-r--r--src/mscorlib/src/System/EventArgs.cs18
-rw-r--r--src/mscorlib/src/System/EventHandler.cs13
-rw-r--r--src/mscorlib/src/System/Exception.cs1006
-rw-r--r--src/mscorlib/src/System/ExecutionEngineException.cs44
-rw-r--r--src/mscorlib/src/System/FieldAccessException.cs39
-rw-r--r--src/mscorlib/src/System/FlagsAttribute.cs23
-rw-r--r--src/mscorlib/src/System/FormatException.cs39
-rw-r--r--src/mscorlib/src/System/FormattableString.cs81
-rw-r--r--src/mscorlib/src/System/GC.cs641
-rw-r--r--src/mscorlib/src/System/Globalization/BidiCategory.cs39
-rw-r--r--src/mscorlib/src/System/Globalization/Calendar.cs861
-rw-r--r--src/mscorlib/src/System/Globalization/CalendarAlgorithmType.cs20
-rw-r--r--src/mscorlib/src/System/Globalization/CalendarData.cs455
-rw-r--r--src/mscorlib/src/System/Globalization/CalendarWeekRule.cs20
-rw-r--r--src/mscorlib/src/System/Globalization/CalendricalCalculationsHelper.cs413
-rw-r--r--src/mscorlib/src/System/Globalization/CharUnicodeInfo.cs522
-rw-r--r--src/mscorlib/src/System/Globalization/ChineseLunisolarCalendar.cs401
-rw-r--r--src/mscorlib/src/System/Globalization/CompareInfo.cs1359
-rw-r--r--src/mscorlib/src/System/Globalization/CultureData.cs3354
-rw-r--r--src/mscorlib/src/System/Globalization/CultureInfo.cs2023
-rw-r--r--src/mscorlib/src/System/Globalization/CultureNotFoundException.cs131
-rw-r--r--src/mscorlib/src/System/Globalization/CultureTypes.cs31
-rw-r--r--src/mscorlib/src/System/Globalization/DateTimeFormat.cs1054
-rw-r--r--src/mscorlib/src/System/Globalization/DateTimeFormatInfo.cs2936
-rw-r--r--src/mscorlib/src/System/Globalization/DateTimeFormatInfoScanner.cs750
-rw-r--r--src/mscorlib/src/System/Globalization/DateTimeParse.cs5069
-rw-r--r--src/mscorlib/src/System/Globalization/DateTimeStyles.cs50
-rw-r--r--src/mscorlib/src/System/Globalization/DaylightTime.cs49
-rw-r--r--src/mscorlib/src/System/Globalization/DigitShapes.cs22
-rw-r--r--src/mscorlib/src/System/Globalization/EastAsianLunisolarCalendar.cs644
-rw-r--r--src/mscorlib/src/System/Globalization/EncodingDataItem.Unix.cs69
-rw-r--r--src/mscorlib/src/System/Globalization/EncodingDataItem.cs115
-rw-r--r--src/mscorlib/src/System/Globalization/EncodingTable.Unix.cs178
-rw-r--r--src/mscorlib/src/System/Globalization/EncodingTable.cs250
-rw-r--r--src/mscorlib/src/System/Globalization/GlobalizationAssembly.cs63
-rw-r--r--src/mscorlib/src/System/Globalization/GregorianCalendar.cs627
-rw-r--r--src/mscorlib/src/System/Globalization/GregorianCalendarHelper.cs633
-rw-r--r--src/mscorlib/src/System/Globalization/GregorianCalendarTypes.cs18
-rw-r--r--src/mscorlib/src/System/Globalization/HebrewCalendar.cs1084
-rw-r--r--src/mscorlib/src/System/Globalization/HebrewNumber.cs402
-rw-r--r--src/mscorlib/src/System/Globalization/HijriCalendar.cs723
-rw-r--r--src/mscorlib/src/System/Globalization/IdnMapping.cs1189
-rw-r--r--src/mscorlib/src/System/Globalization/JapaneseCalendar.cs594
-rw-r--r--src/mscorlib/src/System/Globalization/JapaneseLunisolarCalendar.cs293
-rw-r--r--src/mscorlib/src/System/Globalization/JulianCalendar.cs441
-rw-r--r--src/mscorlib/src/System/Globalization/KoreanCalendar.cs265
-rw-r--r--src/mscorlib/src/System/Globalization/KoreanLunisolarCalendar.cs1334
-rw-r--r--src/mscorlib/src/System/Globalization/NumberFormatInfo.cs842
-rw-r--r--src/mscorlib/src/System/Globalization/NumberStyles.cs67
-rw-r--r--src/mscorlib/src/System/Globalization/PersianCalendar.cs577
-rw-r--r--src/mscorlib/src/System/Globalization/RegionInfo.cs629
-rw-r--r--src/mscorlib/src/System/Globalization/SortKey.cs208
-rw-r--r--src/mscorlib/src/System/Globalization/SortVersion.cs102
-rw-r--r--src/mscorlib/src/System/Globalization/StringInfo.cs361
-rw-r--r--src/mscorlib/src/System/Globalization/Tables/charinfo.nlpbin0 -> 36992 bytes
-rw-r--r--src/mscorlib/src/System/Globalization/TaiwanCalendar.cs262
-rw-r--r--src/mscorlib/src/System/Globalization/TaiwanLunisolarCalendar.cs330
-rw-r--r--src/mscorlib/src/System/Globalization/TextElementEnumerator.cs155
-rw-r--r--src/mscorlib/src/System/Globalization/TextInfo.cs1004
-rw-r--r--src/mscorlib/src/System/Globalization/ThaiBuddhistCalendar.cs225
-rw-r--r--src/mscorlib/src/System/Globalization/TimeSpanFormat.cs474
-rw-r--r--src/mscorlib/src/System/Globalization/TimeSpanParse.cs1557
-rw-r--r--src/mscorlib/src/System/Globalization/TimeSpanStyles.cs12
-rw-r--r--src/mscorlib/src/System/Globalization/UmAlQuraCalendar.cs849
-rw-r--r--src/mscorlib/src/System/Globalization/UnicodeCategory.cs79
-rw-r--r--src/mscorlib/src/System/Guid.cs1299
-rw-r--r--src/mscorlib/src/System/IAppDomain.cs268
-rw-r--r--src/mscorlib/src/System/IAppDomainPauseManager.cs100
-rw-r--r--src/mscorlib/src/System/IAppDomainSetup.cs84
-rw-r--r--src/mscorlib/src/System/IAsyncResult.cs32
-rw-r--r--src/mscorlib/src/System/ICloneable.cs29
-rw-r--r--src/mscorlib/src/System/IComparable.cs39
-rw-r--r--src/mscorlib/src/System/IConvertible.cs67
-rw-r--r--src/mscorlib/src/System/ICustomFormatter.cs25
-rw-r--r--src/mscorlib/src/System/IDisposable.cs58
-rw-r--r--src/mscorlib/src/System/IEquatable.cs14
-rw-r--r--src/mscorlib/src/System/IFormatProvider.cs23
-rw-r--r--src/mscorlib/src/System/IFormattable.cs16
-rw-r--r--src/mscorlib/src/System/IO/BinaryReader.cs601
-rw-r--r--src/mscorlib/src/System/IO/BinaryWriter.cs427
-rw-r--r--src/mscorlib/src/System/IO/BufferedStream.cs1320
-rw-r--r--src/mscorlib/src/System/IO/Directory.cs1389
-rw-r--r--src/mscorlib/src/System/IO/DirectoryInfo.cs672
-rw-r--r--src/mscorlib/src/System/IO/DirectoryNotFoundException.cs46
-rw-r--r--src/mscorlib/src/System/IO/DriveInfo.cs281
-rw-r--r--src/mscorlib/src/System/IO/DriveNotFoundException.cs40
-rw-r--r--src/mscorlib/src/System/IO/EndOfStreamException.cs43
-rw-r--r--src/mscorlib/src/System/IO/File.cs1255
-rw-r--r--src/mscorlib/src/System/IO/FileAccess.cs42
-rw-r--r--src/mscorlib/src/System/IO/FileAttributes.cs51
-rw-r--r--src/mscorlib/src/System/IO/FileInfo.cs431
-rw-r--r--src/mscorlib/src/System/IO/FileLoadException.cs191
-rw-r--r--src/mscorlib/src/System/IO/FileMode.cs54
-rw-r--r--src/mscorlib/src/System/IO/FileNotFoundException.cs170
-rw-r--r--src/mscorlib/src/System/IO/FileOptions.cs47
-rw-r--r--src/mscorlib/src/System/IO/FileSecurityState.cs133
-rw-r--r--src/mscorlib/src/System/IO/FileSecurityStateAccess.cs32
-rw-r--r--src/mscorlib/src/System/IO/FileShare.cs60
-rw-r--r--src/mscorlib/src/System/IO/FileStream.cs2695
-rw-r--r--src/mscorlib/src/System/IO/FileSystemEnumerable.cs852
-rw-r--r--src/mscorlib/src/System/IO/FileSystemInfo.cs361
-rw-r--r--src/mscorlib/src/System/IO/IOException.cs68
-rw-r--r--src/mscorlib/src/System/IO/LongPathHelper.cs521
-rw-r--r--src/mscorlib/src/System/IO/MemoryStream.cs646
-rw-r--r--src/mscorlib/src/System/IO/Path.cs1435
-rw-r--r--src/mscorlib/src/System/IO/PathHelper.cs448
-rw-r--r--src/mscorlib/src/System/IO/PathInternal.cs806
-rw-r--r--src/mscorlib/src/System/IO/PathTooLongException.cs44
-rw-r--r--src/mscorlib/src/System/IO/PinnedBufferMemoryStream.cs73
-rw-r--r--src/mscorlib/src/System/IO/ReadLinesIterator.cs102
-rw-r--r--src/mscorlib/src/System/IO/SearchOption.cs36
-rw-r--r--src/mscorlib/src/System/IO/SeekOrigin.cs32
-rw-r--r--src/mscorlib/src/System/IO/Stream.cs1304
-rw-r--r--src/mscorlib/src/System/IO/StreamReader.cs1293
-rw-r--r--src/mscorlib/src/System/IO/StreamWriter.cs866
-rw-r--r--src/mscorlib/src/System/IO/StringReader.cs187
-rw-r--r--src/mscorlib/src/System/IO/StringWriter.cs196
-rw-r--r--src/mscorlib/src/System/IO/TextReader.cs413
-rw-r--r--src/mscorlib/src/System/IO/TextWriter.cs915
-rw-r--r--src/mscorlib/src/System/IO/UnmanagedMemoryAccessor.cs1176
-rw-r--r--src/mscorlib/src/System/IO/UnmanagedMemoryStream.cs712
-rw-r--r--src/mscorlib/src/System/IO/UnmanagedMemoryStreamWrapper.cs197
-rw-r--r--src/mscorlib/src/System/IO/__DebugOutputTextWriter.cs76
-rw-r--r--src/mscorlib/src/System/IO/__Error.cs232
-rw-r--r--src/mscorlib/src/System/IO/__HResults.cs28
-rw-r--r--src/mscorlib/src/System/IObservable.cs24
-rw-r--r--src/mscorlib/src/System/IObserver.cs27
-rw-r--r--src/mscorlib/src/System/IProgress.cs26
-rw-r--r--src/mscorlib/src/System/IServiceObjectProvider.cs16
-rw-r--r--src/mscorlib/src/System/IndexOutOfRangeException.cs40
-rw-r--r--src/mscorlib/src/System/InsufficientExecutionStackException.cs47
-rw-r--r--src/mscorlib/src/System/InsufficientMemoryException.cs45
-rw-r--r--src/mscorlib/src/System/Int16.cs267
-rw-r--r--src/mscorlib/src/System/Int32.cs239
-rw-r--r--src/mscorlib/src/System/Int64.cs218
-rw-r--r--src/mscorlib/src/System/IntPtr.cs303
-rw-r--r--src/mscorlib/src/System/Internal.cs377
-rw-r--r--src/mscorlib/src/System/InvalidCastException.cs45
-rw-r--r--src/mscorlib/src/System/InvalidOperationException.cs41
-rw-r--r--src/mscorlib/src/System/InvalidProgramException.cs41
-rw-r--r--src/mscorlib/src/System/InvalidTimeZoneException.cs26
-rw-r--r--src/mscorlib/src/System/Lazy.cs517
-rw-r--r--src/mscorlib/src/System/LowLevelConsole.cs50
-rw-r--r--src/mscorlib/src/System/MarshalByRefObject.cs262
-rw-r--r--src/mscorlib/src/System/Math.cs594
-rw-r--r--src/mscorlib/src/System/MemberAccessException.cs48
-rw-r--r--src/mscorlib/src/System/MethodAccessException.cs39
-rw-r--r--src/mscorlib/src/System/MidpointRounding.cs13
-rw-r--r--src/mscorlib/src/System/MissingFieldException.cs73
-rw-r--r--src/mscorlib/src/System/MissingMemberException.cs105
-rw-r--r--src/mscorlib/src/System/MissingMethodException.cs75
-rw-r--r--src/mscorlib/src/System/MulticastDelegate.cs754
-rw-r--r--src/mscorlib/src/System/MulticastNotSupportedException.cs37
-rw-r--r--src/mscorlib/src/System/NonSerializedAttribute.cs36
-rw-r--r--src/mscorlib/src/System/NotFiniteNumberException.cs70
-rw-r--r--src/mscorlib/src/System/NotImplementedException.cs40
-rw-r--r--src/mscorlib/src/System/NotSupportedException.cs41
-rw-r--r--src/mscorlib/src/System/NullReferenceException.cs40
-rw-r--r--src/mscorlib/src/System/Nullable.cs158
-rw-r--r--src/mscorlib/src/System/Number.cs1215
-rw-r--r--src/mscorlib/src/System/Object.cs255
-rw-r--r--src/mscorlib/src/System/ObjectDisposedException.cs74
-rw-r--r--src/mscorlib/src/System/ObsoleteAttribute.cs60
-rw-r--r--src/mscorlib/src/System/OleAutBinder.cs113
-rw-r--r--src/mscorlib/src/System/OperatingSystem.cs157
-rw-r--r--src/mscorlib/src/System/OperationCanceledException.cs70
-rw-r--r--src/mscorlib/src/System/OutOfMemoryException.cs40
-rw-r--r--src/mscorlib/src/System/OverflowException.cs42
-rw-r--r--src/mscorlib/src/System/ParamArrayAttribute.cs22
-rw-r--r--src/mscorlib/src/System/ParamsArray.cs81
-rw-r--r--src/mscorlib/src/System/ParseNumbers.cs74
-rw-r--r--src/mscorlib/src/System/PlatformID.cs28
-rw-r--r--src/mscorlib/src/System/PlatformNotSupportedException.cs42
-rw-r--r--src/mscorlib/src/System/Progress.cs119
-rw-r--r--src/mscorlib/src/System/Random.cs214
-rw-r--r--src/mscorlib/src/System/RankException.cs42
-rw-r--r--src/mscorlib/src/System/Reflection/AmbiguousMatchException.cs42
-rw-r--r--src/mscorlib/src/System/Reflection/Assembly.cs3013
-rw-r--r--src/mscorlib/src/System/Reflection/AssemblyAttributes.cs406
-rw-r--r--src/mscorlib/src/System/Reflection/AssemblyName.cs539
-rw-r--r--src/mscorlib/src/System/Reflection/AssemblyNameFlags.cs56
-rw-r--r--src/mscorlib/src/System/Reflection/AssemblyNameProxy.cs28
-rw-r--r--src/mscorlib/src/System/Reflection/Associates.cs212
-rw-r--r--src/mscorlib/src/System/Reflection/Binder.cs51
-rw-r--r--src/mscorlib/src/System/Reflection/BindingFlags.cs64
-rw-r--r--src/mscorlib/src/System/Reflection/CallingConventions.cs29
-rw-r--r--src/mscorlib/src/System/Reflection/ComInterfaces.cs673
-rw-r--r--src/mscorlib/src/System/Reflection/ConstructorInfo.cs781
-rw-r--r--src/mscorlib/src/System/Reflection/CustomAttribute.cs2527
-rw-r--r--src/mscorlib/src/System/Reflection/CustomAttributeExtensions.cs174
-rw-r--r--src/mscorlib/src/System/Reflection/CustomAttributeFormatException.cs38
-rw-r--r--src/mscorlib/src/System/Reflection/DefaultMemberAttribute.cs40
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/AQNBuilder.cs208
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/AssemblyBuilder.cs2245
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/AssemblyBuilderAccess.cs29
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/AssemblyBuilderData.cs583
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/ComInterfaces.cs288
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/ConstructorBuilder.cs335
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/CustomAttributeBuilder.cs582
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/DynamicILGenerator.cs1329
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/DynamicMethod.cs1039
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/EnumBuilder.cs448
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/EventBuilder.cs174
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/EventToken.cs69
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/FieldBuilder.cs281
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/FieldToken.cs86
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/FlowControl.cs37
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/GenericTypeParameterBuilder.cs248
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/ILGenerator.cs2012
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/ISymWrapperCore.cs828
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/Label.cs74
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/LocalBuilder.cs151
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/MethodBuilder.cs1610
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/MethodBuilderInstantiation.cs142
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/MethodToken.cs65
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/ModuleBuilder.cs2422
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/ModuleBuilderData.cs104
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/OpCodes.cs2552
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/Opcode.cs312
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/OpcodeType.cs35
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/OperandType.cs47
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/PEFileKinds.cs17
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/ParameterBuilder.cs172
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/ParameterToken.cs73
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/PropertyBuilder.cs306
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/PropertyToken.cs70
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/SignatureHelper.cs1019
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/SignatureToken.cs68
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/StackBehaviour.cs54
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/StringToken.cs79
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/SymbolMethod.cs184
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/SymbolType.cs606
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/TypeBuilder.cs2620
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/TypeBuilderInstantiation.cs276
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/TypeToken.cs74
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/UnmanagedMarshal.cs184
-rw-r--r--src/mscorlib/src/System/Reflection/Emit/XXXOnTypeBuilderInstantiation.cs331
-rw-r--r--src/mscorlib/src/System/Reflection/EventAttributes.cs30
-rw-r--r--src/mscorlib/src/System/Reflection/EventInfo.cs443
-rw-r--r--src/mscorlib/src/System/Reflection/FieldAttributes.cs43
-rw-r--r--src/mscorlib/src/System/Reflection/FieldInfo.cs955
-rw-r--r--src/mscorlib/src/System/Reflection/GenericParameterAttributes.cs22
-rw-r--r--src/mscorlib/src/System/Reflection/ICustomAttributeProvider.cs34
-rw-r--r--src/mscorlib/src/System/Reflection/IReflect.cs117
-rw-r--r--src/mscorlib/src/System/Reflection/IReflectableType.cs20
-rw-r--r--src/mscorlib/src/System/Reflection/InterfaceMapping.cs27
-rw-r--r--src/mscorlib/src/System/Reflection/IntrospectionExtensions.cs35
-rw-r--r--src/mscorlib/src/System/Reflection/InvalidFilterCriteriaException.cs44
-rw-r--r--src/mscorlib/src/System/Reflection/LoaderAllocator.cs86
-rw-r--r--src/mscorlib/src/System/Reflection/ManifestResourceInfo.cs67
-rw-r--r--src/mscorlib/src/System/Reflection/MdConstant.cs169
-rw-r--r--src/mscorlib/src/System/Reflection/MdImport.cs736
-rw-r--r--src/mscorlib/src/System/Reflection/MemberFilter.cs19
-rw-r--r--src/mscorlib/src/System/Reflection/MemberInfo.cs148
-rw-r--r--src/mscorlib/src/System/Reflection/MemberInfoSerializationHolder.cs287
-rw-r--r--src/mscorlib/src/System/Reflection/MemberTypes.cs34
-rw-r--r--src/mscorlib/src/System/Reflection/Metadata/AssemblyExtensions.cs47
-rw-r--r--src/mscorlib/src/System/Reflection/MethodAttributes.cs56
-rw-r--r--src/mscorlib/src/System/Reflection/MethodBase.cs402
-rw-r--r--src/mscorlib/src/System/Reflection/MethodBody.cs169
-rw-r--r--src/mscorlib/src/System/Reflection/MethodImplAttributes.cs45
-rw-r--r--src/mscorlib/src/System/Reflection/MethodInfo.cs1061
-rw-r--r--src/mscorlib/src/System/Reflection/Missing.cs38
-rw-r--r--src/mscorlib/src/System/Reflection/Module.cs1230
-rw-r--r--src/mscorlib/src/System/Reflection/ObfuscateAssemblyAttribute.cs46
-rw-r--r--src/mscorlib/src/System/Reflection/ObfuscationAttribute.cs75
-rw-r--r--src/mscorlib/src/System/Reflection/ParameterAttributes.cs36
-rw-r--r--src/mscorlib/src/System/Reflection/ParameterInfo.cs795
-rw-r--r--src/mscorlib/src/System/Reflection/ParameterModifier.cs46
-rw-r--r--src/mscorlib/src/System/Reflection/Pointer.cs82
-rw-r--r--src/mscorlib/src/System/Reflection/PropertyAttributes.cs33
-rw-r--r--src/mscorlib/src/System/Reflection/PropertyInfo.cs657
-rw-r--r--src/mscorlib/src/System/Reflection/ReflectionContext.cs36
-rw-r--r--src/mscorlib/src/System/Reflection/ReflectionTypeLoadException.cs80
-rw-r--r--src/mscorlib/src/System/Reflection/ResourceAttributes.cs24
-rw-r--r--src/mscorlib/src/System/Reflection/RuntimeReflectionExtensions.cs88
-rw-r--r--src/mscorlib/src/System/Reflection/StrongNameKeyPair.cs194
-rw-r--r--src/mscorlib/src/System/Reflection/TargetException.cs42
-rw-r--r--src/mscorlib/src/System/Reflection/TargetInvocationException.cs51
-rw-r--r--src/mscorlib/src/System/Reflection/TargetParameterCountException.cs45
-rw-r--r--src/mscorlib/src/System/Reflection/TypeAttributes.cs66
-rw-r--r--src/mscorlib/src/System/Reflection/TypeDelegator.cs263
-rw-r--r--src/mscorlib/src/System/Reflection/TypeFilter.cs19
-rw-r--r--src/mscorlib/src/System/Reflection/TypeInfo.cs195
-rw-r--r--src/mscorlib/src/System/Reflection/__Filters.cs67
-rw-r--r--src/mscorlib/src/System/ResId.cs93
-rw-r--r--src/mscorlib/src/System/Resources/FileBasedResourceGroveler.cs175
-rw-r--r--src/mscorlib/src/System/Resources/IResourceGroveler.cs32
-rw-r--r--src/mscorlib/src/System/Resources/IResourceReader.cs31
-rw-r--r--src/mscorlib/src/System/Resources/IResourceWriter.cs45
-rw-r--r--src/mscorlib/src/System/Resources/LooselyLinkedResourceReference.cs86
-rw-r--r--src/mscorlib/src/System/Resources/ManifestBasedResourceGroveler.cs677
-rw-r--r--src/mscorlib/src/System/Resources/MissingManifestResourceException.cs42
-rw-r--r--src/mscorlib/src/System/Resources/MissingSatelliteAssemblyException.cs56
-rw-r--r--src/mscorlib/src/System/Resources/NeutralResourcesLanguageAttribute.cs65
-rw-r--r--src/mscorlib/src/System/Resources/ResourceFallbackManager.cs278
-rw-r--r--src/mscorlib/src/System/Resources/ResourceManager.cs1679
-rw-r--r--src/mscorlib/src/System/Resources/ResourceReader.cs1424
-rw-r--r--src/mscorlib/src/System/Resources/ResourceSet.cs332
-rw-r--r--src/mscorlib/src/System/Resources/ResourceTypeCode.cs57
-rw-r--r--src/mscorlib/src/System/Resources/RuntimeResourceSet.cs435
-rw-r--r--src/mscorlib/src/System/Resources/SatelliteContractVersionAttribute.cs39
-rw-r--r--src/mscorlib/src/System/Resources/UltimateResourceFallbackLocation.cs29
-rw-r--r--src/mscorlib/src/System/Resources/__FastResourceComparer.cs141
-rw-r--r--src/mscorlib/src/System/Resources/__HResults.cs23
-rw-r--r--src/mscorlib/src/System/RtType.cs5862
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/AccessedThroughPropertyAttribute.cs31
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/AssemblyAttributesGoHere.cs43
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/AssemblySettingAttributes.cs94
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/AsyncMethodBuilder.cs1187
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/AsyncStateMachineAttribute.cs18
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/CallerFilePathAttribute.cs17
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/CallerLineNumberAttribute.cs17
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/CallerMemberNameAttribute.cs17
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/CallingConvention.cs30
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/CompilationRelaxations.cs52
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/CompilerGeneratedAttribute.cs16
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/CompilerGlobalScopeAttribute.cs27
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/CompilerMarshalOverride.cs23
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/ConditionalWeakTable.cs795
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/CustomConstantAttribute.cs31
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/DateTimeConstantAttribute.cs48
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/DecimalConstantAttribute.cs98
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/DecoratedNameAttribute.cs18
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/DisablePrivateReflectionAttribute.cs18
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/DiscardableAttribute.cs19
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/ExtensionAttribute.cs13
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/FixedAddressValueTypeAttribute.cs14
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/FixedBufferAttribute.cs43
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/FormattableStringFactory.cs58
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/HasCopySemanticsAttribute.cs14
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/IAsyncStateMachine.cs27
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/ICastable.cs82
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/IDispatchConstantAttribute.cs26
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/INotifyCompletion.cs40
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/IUnknownConstantAttribute.cs27
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/IndexerNameAttribute.cs17
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/InternalsVisibleToAttribute.cs58
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/IsBoxed.cs11
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/IsByValue.cs11
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/IsConst.cs11
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/IsCopyConstructed.cs11
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/IsExplicitlyDereferenced.cs22
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/IsImplicitlyDereferenced.cs22
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/IsJitIntrinsic.cs12
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/IsLong.cs18
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/IsPinned.cs11
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/IsSignUnspecifiedByte.cs16
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/IsUdtReturn.cs11
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/IsVolatile.cs13
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/IteratorStateMachineAttribute.cs18
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/MethodImplAttribute.cs77
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/NativeCppClassAttribute.cs16
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/ReferenceAssemblyAttribute.cs39
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/RequiredAttributeAttribute.cs26
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/RuntimeCompatibilityAttribute.cs48
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/RuntimeHelpers.cs248
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/RuntimeWrappedException.cs52
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/ScopelessEnumAttribute.cs14
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/SpecialNameAttribute.cs27
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/StateMachineAttribute.cs20
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/SuppressIldasmAttribute.cs19
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/SuppressMergeCheckAttribute.cs23
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/TaskAwaiter.cs531
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/TypeDependencyAttribute.cs29
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/TypeForwardedFromAttribute.cs35
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/TypeForwardedToAttribute.cs47
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/UnsafeValueTypeAttribute.cs14
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/YieldAwaitable.cs168
-rw-r--r--src/mscorlib/src/System/Runtime/CompilerServices/jithelpers.cs224
-rw-r--r--src/mscorlib/src/System/Runtime/ExceptionServices/CorruptingExceptionCommon.cs31
-rw-r--r--src/mscorlib/src/System/Runtime/ExceptionServices/ExceptionServicesCommon.cs135
-rw-r--r--src/mscorlib/src/System/Runtime/GcSettings.cs101
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/ArrayWithOffset.cs76
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/Attributes.cs1138
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/BStrWrapper.cs52
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/COMException.cs90
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/CallingConvention.cs22
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/CharSet.cs24
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/ComEventsHelper.cs202
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/ComEventsInfo.cs92
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/ComEventsMethod.cs246
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/ComEventsSink.cs286
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/ComMemberType.cs19
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/ComTypes/IBindCtx.cs45
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/ComTypes/IConnectionPoint.cs29
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/ComTypes/IConnectionPointContainer.cs26
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/ComTypes/IEnumConnectionPoints.cs30
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/ComTypes/IEnumConnections.cs39
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/ComTypes/IEnumMoniker.cs30
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/ComTypes/IEnumString.cs30
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/ComTypes/IEnumVARIANT.cs34
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/ComTypes/IEnumerable.cs28
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/ComTypes/IEnumerator.cs34
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/ComTypes/IExpando.cs31
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/ComTypes/IMoniker.cs61
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/ComTypes/IPersistFile.cs34
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/ComTypes/IReflect.cs79
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/ComTypes/IRunningObjectTable.cs34
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/ComTypes/IStream.cs55
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/ComTypes/ITypeComp.cs49
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/ComTypes/ITypeInfo.cs335
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/ComTypes/ITypeInfo2.cs62
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/ComTypes/ITypeLib.cs68
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/ComTypes/ITypeLib2.cs42
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/CriticalHandle.cs275
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/CurrencyWrapper.cs44
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/DispatchWrapper.cs51
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/ErrorWrapper.cs54
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/Expando/IExpando.cs39
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/ExtensibleClassFactory.cs41
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/ExternalException.cs80
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/GCHandleCookieTable.cs219
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/GcHandle.cs330
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/HandleRef.cs50
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/ICustomAdapter.cs23
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/ICustomFactory.cs17
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/ICustomMarshaler.cs31
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/ICustomQueryInterface.cs39
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/IException.cs84
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/IRegistrationServices.cs56
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/ITypeLibConverter.cs146
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/InvalidComObjectException.cs40
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/InvalidOleVariantTypeException.cs39
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/LayoutKind.cs18
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/Marshal.cs2806
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/MarshalDirectiveException.cs40
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/NativeBuffer.cs175
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/NativeCallableAttribute.cs28
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/NativeMethods.cs65
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/NonPortable.cs209
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/ObjectCreationDelegate.cs24
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/PInvokeMap.cs48
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/RegistrationServices.cs1087
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/RuntimeEnvironment.cs165
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/SEHException.cs54
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/SafeArrayRankMismatchException.cs41
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/SafeArrayTypeMismatchException.cs42
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/SafeBuffer.cs415
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/SafeHandle.cs317
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/SafeHeapHandle.cs115
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/StringBuffer.cs402
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/TCEAdapterGen/EventItfInfo.cs53
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/TCEAdapterGen/EventProviderWriter.cs773
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/TCEAdapterGen/EventSinkHelperWriter.cs297
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/TCEAdapterGen/NameSpaceExtractor.cs21
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/TCEAdapterGen/TCEAdapterGenerator.cs141
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/TypeLibConverter.cs595
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/UCOMIBindCtx.cs46
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/UCOMIConnectionPoint.cs30
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/UCOMIConnectionPointContainer.cs27
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/UCOMIEnumConnectionPoints.cs32
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/UCOMIEnumConnections.cs42
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/UCOMIEnumMoniker.cs33
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/UCOMIEnumString.cs32
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/UCOMIEnumVARIANT.cs35
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/UCOMIEnumerable.cs30
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/UCOMIEnumerator.cs32
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/UCOMIExpando.cs33
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/UCOMIMoniker.cs60
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/UCOMIPersistFile.cs36
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/UCOMIReflect.cs79
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/UCOMIRunningObjectTable.cs32
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/UCOMIStream.cs57
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/UCOMITypeComp.cs52
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/UCOMITypeInfo.cs330
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/UCOMITypeLib.cs71
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/UnknownWrapper.cs37
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/Variant.cs659
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/VariantWrapper.cs37
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/Attributes.cs123
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/BindableVectorToCollectionAdapter.cs108
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/BindableVectorToListAdapter.cs241
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/CLRIKeyValuePairImpl.cs66
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/CLRIPropertyValueImpl.cs555
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/CLRIReferenceImpl.cs406
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/ConstantSplittableMap.cs288
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/CustomPropertyImpl.cs138
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/DictionaryKeyCollection.cs124
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/DictionaryToMapAdapter.cs118
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/DictionaryValueCollection.cs131
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/EnumeratorToIteratorAdapter.cs168
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/EventRegistrationToken.cs53
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/EventRegistrationTokenTable.cs255
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IActivationFactory.cs19
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IClosable.cs57
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/ICustomProperty.cs52
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/ICustomPropertyProvider.cs553
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IIterable.cs32
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IIterator.cs54
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IMap.cs59
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IMapViewToIReadOnlyDictionaryAdapter.cs324
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IPropertyValue.cs171
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IReadOnlyDictionaryToIMapViewAdapter.cs88
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IReadOnlyListToIVectorViewAdapter.cs141
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IReference.cs29
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IRestrictedErrorInfo.cs26
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IVector.cs113
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IVectorViewToIReadOnlyListAdapter.cs84
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/IteratorToEnumeratorAdapter.cs210
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/ListToBindableVectorAdapter.cs188
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/ListToBindableVectorViewAdapter.cs94
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/ListToVectorAdapter.cs255
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/ManagedActivationFactory.cs76
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/MapToCollectionAdapter.cs192
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/MapToDictionaryAdapter.cs183
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/MapViewToReadOnlyCollectionAdapter.cs68
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/NativeMethods.cs65
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/PropertyValue.cs64
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/RuntimeClass.cs122
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/VectorToCollectionAdapter.cs127
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/VectorToListAdapter.cs170
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/VectorViewToReadOnlyCollectionAdapter.cs47
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/WindowsFoundationEventHandler.cs15
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/WindowsRuntimeBufferHelper.cs41
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/WindowsRuntimeMarshal.cs1335
-rw-r--r--src/mscorlib/src/System/Runtime/InteropServices/WindowsRuntime/WindowsRuntimeMetadata.cs216
-rw-r--r--src/mscorlib/src/System/Runtime/Loader/AssemblyLoadContext.cs481
-rw-r--r--src/mscorlib/src/System/Runtime/MemoryFailPoint.cs488
-rw-r--r--src/mscorlib/src/System/Runtime/ProfileOptimization.cs54
-rw-r--r--src/mscorlib/src/System/Runtime/Reliability/CriticalFinalizerObject.cs44
-rw-r--r--src/mscorlib/src/System/Runtime/Reliability/PrePrepareMethodAttribute.cs32
-rw-r--r--src/mscorlib/src/System/Runtime/Reliability/ReliabilityContractAttribute.cs67
-rw-r--r--src/mscorlib/src/System/Runtime/Remoting/ObjectHandle.cs81
-rw-r--r--src/mscorlib/src/System/Runtime/Serialization/FormatterConverter.cs167
-rw-r--r--src/mscorlib/src/System/Runtime/Serialization/FormatterServices.cs590
-rw-r--r--src/mscorlib/src/System/Runtime/Serialization/IDeserializationCallback.cs23
-rw-r--r--src/mscorlib/src/System/Runtime/Serialization/IFormatter.cs41
-rw-r--r--src/mscorlib/src/System/Runtime/Serialization/IFormatterConverter.cs40
-rw-r--r--src/mscorlib/src/System/Runtime/Serialization/IObjectReference.cs30
-rw-r--r--src/mscorlib/src/System/Runtime/Serialization/ISerializable.cs33
-rw-r--r--src/mscorlib/src/System/Runtime/Serialization/ISerializationSurrogate.cs36
-rw-r--r--src/mscorlib/src/System/Runtime/Serialization/ISurrogateSelector.cs37
-rw-r--r--src/mscorlib/src/System/Runtime/Serialization/MemberHolder.cs51
-rw-r--r--src/mscorlib/src/System/Runtime/Serialization/SerializationAttributes.cs64
-rw-r--r--src/mscorlib/src/System/Runtime/Serialization/SerializationBinder.cs29
-rw-r--r--src/mscorlib/src/System/Runtime/Serialization/SerializationException.cs45
-rw-r--r--src/mscorlib/src/System/Runtime/Serialization/SerializationFieldInfo.cs166
-rw-r--r--src/mscorlib/src/System/Runtime/Serialization/SerializationInfo.cs798
-rw-r--r--src/mscorlib/src/System/Runtime/Serialization/SerializationInfoEnumerator.cs146
-rw-r--r--src/mscorlib/src/System/Runtime/Serialization/StreamingContext.cs74
-rw-r--r--src/mscorlib/src/System/Runtime/Versioning/BinaryCompatibility.cs485
-rw-r--r--src/mscorlib/src/System/Runtime/Versioning/CompatibilitySwitch.cs61
-rw-r--r--src/mscorlib/src/System/Runtime/Versioning/ComponentGuaranteesAttribute.cs44
-rw-r--r--src/mscorlib/src/System/Runtime/Versioning/NonVersionableAttribute.cs33
-rw-r--r--src/mscorlib/src/System/Runtime/Versioning/ResourceAttributes.cs237
-rw-r--r--src/mscorlib/src/System/Runtime/Versioning/TargetFrameworkAttribute.cs45
-rw-r--r--src/mscorlib/src/System/Runtime/Versioning/TargetFrameworkId.cs28
-rw-r--r--src/mscorlib/src/System/RuntimeArgumentHandle.cs24
-rw-r--r--src/mscorlib/src/System/RuntimeHandles.cs2101
-rw-r--r--src/mscorlib/src/System/SByte.cs274
-rw-r--r--src/mscorlib/src/System/Security/AccessControl/Enums.cs81
-rw-r--r--src/mscorlib/src/System/Security/Attributes.cs209
-rw-r--r--src/mscorlib/src/System/Security/BuiltInPermissionSets.cs342
-rw-r--r--src/mscorlib/src/System/Security/CodeAccessPermission.cs284
-rw-r--r--src/mscorlib/src/System/Security/CodeAccessSecurityEngine.cs842
-rw-r--r--src/mscorlib/src/System/Security/FrameSecurityDescriptor.cs564
-rw-r--r--src/mscorlib/src/System/Security/HostProtectionException.cs136
-rw-r--r--src/mscorlib/src/System/Security/HostSecurityManager.cs215
-rw-r--r--src/mscorlib/src/System/Security/IEvidenceFactory.cs20
-rw-r--r--src/mscorlib/src/System/Security/IPermission.cs84
-rw-r--r--src/mscorlib/src/System/Security/ISecurityEncodable.cs29
-rw-r--r--src/mscorlib/src/System/Security/ISecurityPolicyEncodable.cs28
-rw-r--r--src/mscorlib/src/System/Security/IStackWalk.cs23
-rw-r--r--src/mscorlib/src/System/Security/NamedPermissionSet.cs269
-rw-r--r--src/mscorlib/src/System/Security/PermissionListSet.cs554
-rw-r--r--src/mscorlib/src/System/Security/PermissionSet.cs2641
-rw-r--r--src/mscorlib/src/System/Security/PermissionSetEnumerator.cs103
-rw-r--r--src/mscorlib/src/System/Security/PermissionSetTriple.cs282
-rw-r--r--src/mscorlib/src/System/Security/PermissionToken.cs563
-rw-r--r--src/mscorlib/src/System/Security/Permissions/EnvironmentPermission.cs405
-rw-r--r--src/mscorlib/src/System/Security/Permissions/FileDialogPermission.cs189
-rw-r--r--src/mscorlib/src/System/Security/Permissions/FileIOPermission.cs1478
-rw-r--r--src/mscorlib/src/System/Security/Permissions/GACIdentityPermission.cs119
-rw-r--r--src/mscorlib/src/System/Security/Permissions/HostProtectionPermission.cs299
-rw-r--r--src/mscorlib/src/System/Security/Permissions/IBuiltInPermission.cs63
-rw-r--r--src/mscorlib/src/System/Security/Permissions/IUnrestrictedPermission.cs13
-rw-r--r--src/mscorlib/src/System/Security/Permissions/IsolatedStorageFilePermission.cs176
-rw-r--r--src/mscorlib/src/System/Security/Permissions/IsolatedStoragePermission.cs274
-rw-r--r--src/mscorlib/src/System/Security/Permissions/PermissionAttributes.cs1176
-rw-r--r--src/mscorlib/src/System/Security/Permissions/PermissionState.cs21
-rw-r--r--src/mscorlib/src/System/Security/Permissions/ReflectionPermission.cs313
-rw-r--r--src/mscorlib/src/System/Security/Permissions/RegistryPermission.cs494
-rw-r--r--src/mscorlib/src/System/Security/Permissions/SecurityPermission.cs362
-rw-r--r--src/mscorlib/src/System/Security/Permissions/SiteIdentityPermission.cs359
-rw-r--r--src/mscorlib/src/System/Security/Permissions/StrongNameIdentityPermission.cs487
-rw-r--r--src/mscorlib/src/System/Security/Permissions/StrongNamePublicKeyBlob.cs94
-rw-r--r--src/mscorlib/src/System/Security/Permissions/UIPermission.cs371
-rw-r--r--src/mscorlib/src/System/Security/Permissions/URLIdentityPermission.cs391
-rw-r--r--src/mscorlib/src/System/Security/Permissions/ZoneIdentityPermission.cs309
-rw-r--r--src/mscorlib/src/System/Security/Permissions/keycontainerpermission.cs688
-rw-r--r--src/mscorlib/src/System/Security/Policy/ApplicationTrust.cs689
-rw-r--r--src/mscorlib/src/System/Security/Policy/Evidence.cs1903
-rw-r--r--src/mscorlib/src/System/Security/Policy/EvidenceBase.cs193
-rw-r--r--src/mscorlib/src/System/Security/Policy/EvidenceTypeDescriptor.cs160
-rw-r--r--src/mscorlib/src/System/Security/Policy/IDelayEvaluatedEvidence.cs35
-rw-r--r--src/mscorlib/src/System/Security/Policy/IIdentityPermissionFactory.cs20
-rw-r--r--src/mscorlib/src/System/Security/Policy/IRuntimeEvidenceFactory.cs36
-rw-r--r--src/mscorlib/src/System/Security/Policy/PolicyException.cs50
-rw-r--r--src/mscorlib/src/System/Security/Policy/PolicyStatement.cs540
-rw-r--r--src/mscorlib/src/System/Security/Policy/Site.cs128
-rw-r--r--src/mscorlib/src/System/Security/Policy/StrongName.cs222
-rw-r--r--src/mscorlib/src/System/Security/Policy/URL.cs119
-rw-r--r--src/mscorlib/src/System/Security/Policy/Zone.cs151
-rw-r--r--src/mscorlib/src/System/Security/Principal/IIdentity.cs29
-rw-r--r--src/mscorlib/src/System/Security/Principal/IPrincipal.cs26
-rw-r--r--src/mscorlib/src/System/Security/Principal/TokenImpersonationLevel.cs20
-rw-r--r--src/mscorlib/src/System/Security/SafeSecurityHandles.cs164
-rw-r--r--src/mscorlib/src/System/Security/SecurityContext.cs702
-rw-r--r--src/mscorlib/src/System/Security/SecurityElement.cs929
-rw-r--r--src/mscorlib/src/System/Security/SecurityException.cs667
-rw-r--r--src/mscorlib/src/System/Security/SecurityManager.cs671
-rw-r--r--src/mscorlib/src/System/Security/SecurityRuntime.cs299
-rw-r--r--src/mscorlib/src/System/Security/SecurityState.cs34
-rw-r--r--src/mscorlib/src/System/Security/SecurityZone.cs29
-rw-r--r--src/mscorlib/src/System/Security/Util/Config.cs131
-rw-r--r--src/mscorlib/src/System/Security/Util/Hex.cs126
-rw-r--r--src/mscorlib/src/System/Security/Util/StringExpressionSet.cs777
-rw-r--r--src/mscorlib/src/System/Security/Util/TokenBasedSet.cs467
-rw-r--r--src/mscorlib/src/System/Security/Util/TokenBasedSetEnumerator.cs36
-rw-r--r--src/mscorlib/src/System/Security/Util/URLString.cs1366
-rw-r--r--src/mscorlib/src/System/Security/Util/XMLUtil.cs695
-rw-r--r--src/mscorlib/src/System/Security/Util/sitestring.cs289
-rw-r--r--src/mscorlib/src/System/Security/VerificationException.cs33
-rw-r--r--src/mscorlib/src/System/Security/securestring.cs750
-rw-r--r--src/mscorlib/src/System/SerializableAttribute.cs34
-rw-r--r--src/mscorlib/src/System/SharedStatics.cs148
-rw-r--r--src/mscorlib/src/System/Single.cs337
-rw-r--r--src/mscorlib/src/System/StackOverflowException.cs40
-rw-r--r--src/mscorlib/src/System/String.Comparison.cs1160
-rw-r--r--src/mscorlib/src/System/String.Manipulation.cs1596
-rw-r--r--src/mscorlib/src/System/String.Searching.cs358
-rw-r--r--src/mscorlib/src/System/String.cs891
-rw-r--r--src/mscorlib/src/System/StringComparer.cs440
-rw-r--r--src/mscorlib/src/System/StringComparison.cs28
-rw-r--r--src/mscorlib/src/System/StringFreezingAttribute.cs25
-rw-r--r--src/mscorlib/src/System/StringSplitOptions.cs16
-rw-r--r--src/mscorlib/src/System/StubHelpers.cs1957
-rw-r--r--src/mscorlib/src/System/SystemException.cs31
-rw-r--r--src/mscorlib/src/System/Text/ASCIIEncoding.cs773
-rw-r--r--src/mscorlib/src/System/Text/BaseCodePageEncoding.cs350
-rw-r--r--src/mscorlib/src/System/Text/CodePageEncoding.cs139
-rw-r--r--src/mscorlib/src/System/Text/DBCSCodePageEncoding.cs1206
-rw-r--r--src/mscorlib/src/System/Text/Decoder.cs349
-rw-r--r--src/mscorlib/src/System/Text/DecoderBestFitFallback.cs247
-rw-r--r--src/mscorlib/src/System/Text/DecoderExceptionFallback.cs155
-rw-r--r--src/mscorlib/src/System/Text/DecoderFallback.cs284
-rw-r--r--src/mscorlib/src/System/Text/DecoderNLS.cs298
-rw-r--r--src/mscorlib/src/System/Text/DecoderReplacementFallback.cs209
-rw-r--r--src/mscorlib/src/System/Text/EUCJPEncoding.cs186
-rw-r--r--src/mscorlib/src/System/Text/Encoder.cs342
-rw-r--r--src/mscorlib/src/System/Text/EncoderBestFitFallback.cs247
-rw-r--r--src/mscorlib/src/System/Text/EncoderExceptionFallback.cs203
-rw-r--r--src/mscorlib/src/System/Text/EncoderFallback.cs236
-rw-r--r--src/mscorlib/src/System/Text/EncoderNLS.cs296
-rw-r--r--src/mscorlib/src/System/Text/EncoderReplacementFallback.cs233
-rw-r--r--src/mscorlib/src/System/Text/Encoding.cs2152
-rw-r--r--src/mscorlib/src/System/Text/EncodingForwarder.cs339
-rw-r--r--src/mscorlib/src/System/Text/EncodingInfo.cs74
-rw-r--r--src/mscorlib/src/System/Text/EncodingNLS.cs130
-rw-r--r--src/mscorlib/src/System/Text/EncodingProvider.cs137
-rw-r--r--src/mscorlib/src/System/Text/GB18030Encoding.cs1377
-rw-r--r--src/mscorlib/src/System/Text/ISCIIEncoding.cs2625
-rw-r--r--src/mscorlib/src/System/Text/ISO2022Encoding.cs1995
-rw-r--r--src/mscorlib/src/System/Text/Latin1Encoding.cs917
-rw-r--r--src/mscorlib/src/System/Text/MLangCodePageEncoding.cs177
-rw-r--r--src/mscorlib/src/System/Text/Normalization.cs350
-rw-r--r--src/mscorlib/src/System/Text/SBCSCodePageEncoding.cs1020
-rw-r--r--src/mscorlib/src/System/Text/StringBuilder.cs2217
-rw-r--r--src/mscorlib/src/System/Text/StringBuilderCache.cs83
-rw-r--r--src/mscorlib/src/System/Text/SurrogateEncoder.cs58
-rw-r--r--src/mscorlib/src/System/Text/UTF32Encoding.cs1010
-rw-r--r--src/mscorlib/src/System/Text/UTF7Encoding.cs901
-rw-r--r--src/mscorlib/src/System/Text/UTF8Encoding.cs2307
-rw-r--r--src/mscorlib/src/System/Text/UnicodeEncoding.cs1842
-rw-r--r--src/mscorlib/src/System/ThreadAttributes.cs32
-rw-r--r--src/mscorlib/src/System/ThreadStaticAttribute.cs28
-rw-r--r--src/mscorlib/src/System/Threading/AbandonedMutexException.cs85
-rw-r--r--src/mscorlib/src/System/Threading/ApartmentState.cs28
-rw-r--r--src/mscorlib/src/System/Threading/AsyncLocal.cs116
-rw-r--r--src/mscorlib/src/System/Threading/AutoResetEvent.cs27
-rw-r--r--src/mscorlib/src/System/Threading/CancellationToken.cs499
-rw-r--r--src/mscorlib/src/System/Threading/CancellationTokenRegistration.cs161
-rw-r--r--src/mscorlib/src/System/Threading/CancellationTokenSource.cs1269
-rw-r--r--src/mscorlib/src/System/Threading/CountdownEvent.cs592
-rw-r--r--src/mscorlib/src/System/Threading/EventResetMode.cs26
-rw-r--r--src/mscorlib/src/System/Threading/EventWaitHandle.cs297
-rw-r--r--src/mscorlib/src/System/Threading/ExecutionContext.cs1398
-rw-r--r--src/mscorlib/src/System/Threading/IObjectHandle.cs31
-rw-r--r--src/mscorlib/src/System/Threading/Interlocked.cs233
-rw-r--r--src/mscorlib/src/System/Threading/LazyInitializer.cs265
-rw-r--r--src/mscorlib/src/System/Threading/LockCookie.cs57
-rw-r--r--src/mscorlib/src/System/Threading/LockRecursionException.cs34
-rw-r--r--src/mscorlib/src/System/Threading/ManualResetEvent.cs27
-rw-r--r--src/mscorlib/src/System/Threading/ManualResetEventSlim.cs813
-rw-r--r--src/mscorlib/src/System/Threading/Monitor.cs256
-rw-r--r--src/mscorlib/src/System/Threading/Mutex.cs488
-rw-r--r--src/mscorlib/src/System/Threading/Overlapped.cs423
-rw-r--r--src/mscorlib/src/System/Threading/ParameterizedThreadStart.cs24
-rw-r--r--src/mscorlib/src/System/Threading/ReaderWriterLock.cs306
-rw-r--r--src/mscorlib/src/System/Threading/Semaphore.cs201
-rw-r--r--src/mscorlib/src/System/Threading/SemaphoreFullException.cs30
-rw-r--r--src/mscorlib/src/System/Threading/SemaphoreSlim.cs930
-rw-r--r--src/mscorlib/src/System/Threading/SendOrPostCallback.cs16
-rw-r--r--src/mscorlib/src/System/Threading/SpinLock.cs750
-rw-r--r--src/mscorlib/src/System/Threading/SpinWait.cs369
-rw-r--r--src/mscorlib/src/System/Threading/SynchronizationContext.cs320
-rw-r--r--src/mscorlib/src/System/Threading/SynchronizationLockException.cs44
-rw-r--r--src/mscorlib/src/System/Threading/Tasks/AsyncCausalityTracer.cs295
-rw-r--r--src/mscorlib/src/System/Threading/Tasks/BeginEndAwaitableAdapter.cs157
-rw-r--r--src/mscorlib/src/System/Threading/Tasks/ConcurrentExclusiveSchedulerPair.cs795
-rw-r--r--src/mscorlib/src/System/Threading/Tasks/FutureFactory.cs2303
-rw-r--r--src/mscorlib/src/System/Threading/Tasks/IAsyncCausalityTracerStatics.cs101
-rw-r--r--src/mscorlib/src/System/Threading/Tasks/Parallel.cs3594
-rw-r--r--src/mscorlib/src/System/Threading/Tasks/ParallelLoopState.cs642
-rw-r--r--src/mscorlib/src/System/Threading/Tasks/ParallelRangeManager.cs278
-rw-r--r--src/mscorlib/src/System/Threading/Tasks/ProducerConsumerQueues.cs553
-rw-r--r--src/mscorlib/src/System/Threading/Tasks/TPLETWProvider.cs763
-rw-r--r--src/mscorlib/src/System/Threading/Tasks/Task.cs7344
-rw-r--r--src/mscorlib/src/System/Threading/Tasks/TaskCanceledException.cs93
-rw-r--r--src/mscorlib/src/System/Threading/Tasks/TaskCompletionSource.cs370
-rw-r--r--src/mscorlib/src/System/Threading/Tasks/TaskContinuation.cs867
-rw-r--r--src/mscorlib/src/System/Threading/Tasks/TaskExceptionHolder.cs424
-rw-r--r--src/mscorlib/src/System/Threading/Tasks/TaskFactory.cs3206
-rw-r--r--src/mscorlib/src/System/Threading/Tasks/TaskScheduler.cs757
-rw-r--r--src/mscorlib/src/System/Threading/Tasks/TaskSchedulerException.cs81
-rw-r--r--src/mscorlib/src/System/Threading/Tasks/TaskToApm.cs189
-rw-r--r--src/mscorlib/src/System/Threading/Tasks/ThreadPoolTaskScheduler.cs139
-rw-r--r--src/mscorlib/src/System/Threading/Tasks/future.cs1667
-rw-r--r--src/mscorlib/src/System/Threading/Thread.cs1756
-rw-r--r--src/mscorlib/src/System/Threading/ThreadAbortException.cs46
-rw-r--r--src/mscorlib/src/System/Threading/ThreadInterruptedException.cs41
-rw-r--r--src/mscorlib/src/System/Threading/ThreadLocal.cs815
-rw-r--r--src/mscorlib/src/System/Threading/ThreadPool.cs1954
-rw-r--r--src/mscorlib/src/System/Threading/ThreadPriority.cs32
-rw-r--r--src/mscorlib/src/System/Threading/ThreadStart.cs25
-rw-r--r--src/mscorlib/src/System/Threading/ThreadStartException.cs37
-rw-r--r--src/mscorlib/src/System/Threading/ThreadState.cs36
-rw-r--r--src/mscorlib/src/System/Threading/ThreadStateException.cs41
-rw-r--r--src/mscorlib/src/System/Threading/Timeout.cs21
-rw-r--r--src/mscorlib/src/System/Threading/Timer.cs954
-rw-r--r--src/mscorlib/src/System/Threading/Volatile.cs441
-rw-r--r--src/mscorlib/src/System/Threading/WaitHandle.cs617
-rw-r--r--src/mscorlib/src/System/Threading/WaitHandleCannotBeOpenedException.cs40
-rw-r--r--src/mscorlib/src/System/Threading/WaitHandleExtensions.cs46
-rw-r--r--src/mscorlib/src/System/ThrowHelper.cs347
-rw-r--r--src/mscorlib/src/System/TimeSpan.cs445
-rw-r--r--src/mscorlib/src/System/TimeZone.cs249
-rw-r--r--src/mscorlib/src/System/TimeZoneInfo.cs5761
-rw-r--r--src/mscorlib/src/System/TimeZoneNotFoundException.cs26
-rw-r--r--src/mscorlib/src/System/TimeoutException.cs45
-rw-r--r--src/mscorlib/src/System/Tuple.cs959
-rw-r--r--src/mscorlib/src/System/Type.cs1845
-rw-r--r--src/mscorlib/src/System/TypeAccessException.cs40
-rw-r--r--src/mscorlib/src/System/TypeCode.cs48
-rw-r--r--src/mscorlib/src/System/TypeInitializationException.cs66
-rw-r--r--src/mscorlib/src/System/TypeLoadException.cs143
-rw-r--r--src/mscorlib/src/System/TypeNameParser.cs365
-rw-r--r--src/mscorlib/src/System/TypeUnloadedException.cs43
-rw-r--r--src/mscorlib/src/System/TypedReference.cs133
-rw-r--r--src/mscorlib/src/System/UInt16.cs241
-rw-r--r--src/mscorlib/src/System/UInt32.cs223
-rw-r--r--src/mscorlib/src/System/UInt64.cs218
-rw-r--r--src/mscorlib/src/System/UIntPtr.cs249
-rw-r--r--src/mscorlib/src/System/UnSafeCharBuffer.cs57
-rw-r--r--src/mscorlib/src/System/UnauthorizedAccessException.cs43
-rw-r--r--src/mscorlib/src/System/UnhandledExceptionEventArgs.cs29
-rw-r--r--src/mscorlib/src/System/UnhandledExceptionEventHandler.cs14
-rw-r--r--src/mscorlib/src/System/UnitySerializationHolder.cs359
-rw-r--r--src/mscorlib/src/System/ValueType.cs93
-rw-r--r--src/mscorlib/src/System/Variant.cs681
-rw-r--r--src/mscorlib/src/System/Version.cs504
-rw-r--r--src/mscorlib/src/System/Void.cs18
-rw-r--r--src/mscorlib/src/System/WeakReference.cs125
-rw-r--r--src/mscorlib/src/System/WeakReferenceOfT.cs121
-rw-r--r--src/mscorlib/src/System/XmlIgnoreMemberAttribute.cs21
-rw-r--r--src/mscorlib/src/System/_LocalDataStore.cs244
-rw-r--r--src/mscorlib/src/System/_LocalDataStoreMgr.cs339
-rw-r--r--src/mscorlib/src/System/__ComObject.cs206
-rw-r--r--src/mscorlib/src/System/__Filters.cs155
-rw-r--r--src/mscorlib/src/System/__HResults.cs129
-rw-r--r--src/mscorlib/src/System/cominterfaces.cs68
-rw-r--r--src/mscorlib/src/System/mda.cs88
-rw-r--r--src/mscorlib/src/mscorlib.Friends.cs27
-rw-r--r--src/mscorlib/src/mscorlib.txt3494
999 files changed, 362238 insertions, 0 deletions
diff --git a/src/mscorlib/src/GlobalSuppressions.cs b/src/mscorlib/src/GlobalSuppressions.cs
new file mode 100644
index 0000000..f1006dc
--- /dev/null
+++ b/src/mscorlib/src/GlobalSuppressions.cs
@@ -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.
+using System.Diagnostics.CodeAnalysis;
+
+[module: SuppressMessage("Microsoft.Security","CA2111:PointersShouldNotBeVisible", Scope="member", Target="System.Runtime.InteropServices.BINDPTR.#lpfuncdesc", Justification="matell: We already shipped this and it would be a breaking change to fix it")]
+[module: SuppressMessage("Microsoft.Security","CA2111:PointersShouldNotBeVisible", Scope="member", Target="System.Runtime.InteropServices.BINDPTR.#lptcomp", Justification="matell: We already shipped this and it would be a breaking change to fix it")]
+[module: SuppressMessage("Microsoft.Security","CA2111:PointersShouldNotBeVisible", Scope="member", Target="System.Runtime.InteropServices.BINDPTR.#lpvardesc", Justification="matell: We already shipped this and it would be a breaking change to fix it")]
+[module: SuppressMessage("Microsoft.Security","CA2111:PointersShouldNotBeVisible", Scope="member", Target="System.Runtime.InteropServices.CriticalHandle.#handle", Justification="matell: We already shipped this and it would be a breaking change to fix it")]
+[module: SuppressMessage("Microsoft.Security","CA2111:PointersShouldNotBeVisible", Scope="member", Target="System.Runtime.InteropServices.DISPPARAMS.#rgdispidNamedArgs", Justification="matell: We already shipped this and it would be a breaking change to fix it")]
+[module: SuppressMessage("Microsoft.Security","CA2111:PointersShouldNotBeVisible", Scope="member", Target="System.Runtime.InteropServices.DISPPARAMS.#rgvarg", Justification="matell: We already shipped this and it would be a breaking change to fix it")]
+[module: SuppressMessage("Microsoft.Security","CA2111:PointersShouldNotBeVisible", Scope="member", Target="System.Runtime.InteropServices.EXCEPINFO.#pfnDeferredFillIn", Justification="matell: We already shipped this and it would be a breaking change to fix it")]
+[module: SuppressMessage("Microsoft.Security","CA2111:PointersShouldNotBeVisible", Scope="member", Target="System.Runtime.InteropServices.EXCEPINFO.#pvReserved", Justification="matell: We already shipped this and it would be a breaking change to fix it")]
+[module: SuppressMessage("Microsoft.Security","CA2111:PointersShouldNotBeVisible", Scope="member", Target="System.Runtime.InteropServices.FUNCDESC.#lprgelemdescParam", Justification="matell: We already shipped this and it would be a breaking change to fix it")]
+[module: SuppressMessage("Microsoft.Security","CA2111:PointersShouldNotBeVisible", Scope="member", Target="System.Runtime.InteropServices.FUNCDESC.#lprgscode", Justification="matell: We already shipped this and it would be a breaking change to fix it")]
+[module: SuppressMessage("Microsoft.Security","CA2111:PointersShouldNotBeVisible", Scope="member", Target="System.Runtime.InteropServices.PARAMDESC.#lpVarValue", Justification="matell: We already shipped this and it would be a breaking change to fix it")]
+[module: SuppressMessage("Microsoft.Security","CA2111:PointersShouldNotBeVisible", Scope="member", Target="System.Runtime.InteropServices.SafeHandle.#handle", Justification="matell: We already shipped this and it would be a breaking change to fix it")]
+[module: SuppressMessage("Microsoft.Security","CA2111:PointersShouldNotBeVisible", Scope="member", Target="System.Runtime.InteropServices.TYPEATTR.#lpstrSchema", Justification="matell: We already shipped this and it would be a breaking change to fix it")]
+[module: SuppressMessage("Microsoft.Security","CA2111:PointersShouldNotBeVisible", Scope="member", Target="System.Runtime.InteropServices.TYPEDESC.#lpValue", Justification="matell: We already shipped this and it would be a breaking change to fix it")]
+[module: SuppressMessage("Microsoft.Security","CA2111:PointersShouldNotBeVisible", Scope="member", Target="System.Runtime.InteropServices.VARDESC+DESCUNION.#lpvarValue", Justification="matell: We already shipped this and it would be a breaking change to fix it")]
+[module: SuppressMessage("Microsoft.Security","CA2111:PointersShouldNotBeVisible", Scope="member", Target="System.Runtime.InteropServices.ComTypes.BINDPTR.#lpfuncdesc", Justification="matell: We already shipped this and it would be a breaking change to fix it")]
+[module: SuppressMessage("Microsoft.Security","CA2111:PointersShouldNotBeVisible", Scope="member", Target="System.Runtime.InteropServices.ComTypes.BINDPTR.#lptcomp", Justification="matell: We already shipped this and it would be a breaking change to fix it")]
+[module: SuppressMessage("Microsoft.Security","CA2111:PointersShouldNotBeVisible", Scope="member", Target="System.Runtime.InteropServices.ComTypes.BINDPTR.#lpvardesc", Justification="matell: We already shipped this and it would be a breaking change to fix it")]
+[module: SuppressMessage("Microsoft.Security","CA2111:PointersShouldNotBeVisible", Scope="member", Target="System.Runtime.InteropServices.ComTypes.DISPPARAMS.#rgdispidNamedArgs", Justification="matell: We already shipped this and it would be a breaking change to fix it")]
+[module: SuppressMessage("Microsoft.Security","CA2111:PointersShouldNotBeVisible", Scope="member", Target="System.Runtime.InteropServices.ComTypes.DISPPARAMS.#rgvarg", Justification="matell: We already shipped this and it would be a breaking change to fix it")]
+[module: SuppressMessage("Microsoft.Security","CA2111:PointersShouldNotBeVisible", Scope="member", Target="System.Runtime.InteropServices.ComTypes.EXCEPINFO.#pfnDeferredFillIn", Justification="matell: We already shipped this and it would be a breaking change to fix it")]
+[module: SuppressMessage("Microsoft.Security","CA2111:PointersShouldNotBeVisible", Scope="member", Target="System.Runtime.InteropServices.ComTypes.EXCEPINFO.#pvReserved", Justification="matell: We already shipped this and it would be a breaking change to fix it")]
+[module: SuppressMessage("Microsoft.Security","CA2111:PointersShouldNotBeVisible", Scope="member", Target="System.Runtime.InteropServices.ComTypes.FUNCDESC.#lprgelemdescParam", Justification="matell: We already shipped this and it would be a breaking change to fix it")]
+[module: SuppressMessage("Microsoft.Security","CA2111:PointersShouldNotBeVisible", Scope="member", Target="System.Runtime.InteropServices.ComTypes.FUNCDESC.#lprgscode", Justification="matell: We already shipped this and it would be a breaking change to fix it")]
+[module: SuppressMessage("Microsoft.Security","CA2111:PointersShouldNotBeVisible", Scope="member", Target="System.Runtime.InteropServices.ComTypes.IDLDESC.#dwReserved", Justification="matell: We already shipped this and it would be a breaking change to fix it")]
+[module: SuppressMessage("Microsoft.Security","CA2111:PointersShouldNotBeVisible", Scope="member", Target="System.Runtime.InteropServices.ComTypes.PARAMDESC.#lpVarValue", Justification="matell: We already shipped this and it would be a breaking change to fix it")]
+[module: SuppressMessage("Microsoft.Security","CA2111:PointersShouldNotBeVisible", Scope="member", Target="System.Runtime.InteropServices.ComTypes.TYPEATTR.#lpstrSchema", Justification="matell: We already shipped this and it would be a breaking change to fix it")]
+[module: SuppressMessage("Microsoft.Security","CA2111:PointersShouldNotBeVisible", Scope="member", Target="System.Runtime.InteropServices.ComTypes.TYPEDESC.#lpValue", Justification="matell: We already shipped this and it would be a breaking change to fix it")]
+[module: SuppressMessage("Microsoft.Security","CA2111:PointersShouldNotBeVisible", Scope="member", Target="System.Runtime.InteropServices.ComTypes.VARDESC+DESCUNION.#lpvarValue", Justification="matell: We already shipped this and it would be a breaking change to fix it")]
+[module: SuppressMessage("Microsoft.Security","CA2111:PointersShouldNotBeVisible", Scope="member", Target="System.Threading.NativeOverlapped.#EventHandle", Justification="matell: We already shipped this and it would be a breaking change to fix it")]
+[module: SuppressMessage("Microsoft.Security","CA2111:PointersShouldNotBeVisible", Scope="member", Target="System.Threading.NativeOverlapped.#InternalHigh", Justification="matell: We already shipped this and it would be a breaking change to fix it")]
+[module: SuppressMessage("Microsoft.Security","CA2111:PointersShouldNotBeVisible", Scope="member", Target="System.Threading.NativeOverlapped.#InternalLow", Justification="matell: We already shipped this and it would be a breaking change to fix it")]
+[module: SuppressMessage("Microsoft.Security","CA2105:ArrayFieldsShouldNotBeReadOnly", Scope="member", Target="System.IO.Path.#InvalidPathChars", Justification="matell: We already shipped this and it would be a breaking change to fix it")]
+[module: SuppressMessage("Microsoft.Security","CA2105:ArrayFieldsShouldNotBeReadOnly", Scope="member", Target="System.Type.#EmptyTypes", Justification="matell: We already shipped this and it would be a breaking change to fix it")]
+[module: SuppressMessage("Microsoft.Security","CA2104:DoNotDeclareReadOnlyMutableReferenceTypes", Scope="member", Target="System.IO.BinaryWriter.#Null", Justification="matell: Underlying type is actually immutable")]
+[module: SuppressMessage("Microsoft.Security","CA2104:DoNotDeclareReadOnlyMutableReferenceTypes", Scope="member", Target="System.IO.Stream.#Null", Justification="matell: Underlying type is actually immutable")]
+[module: SuppressMessage("Microsoft.Security","CA2104:DoNotDeclareReadOnlyMutableReferenceTypes", Scope="member", Target="System.IO.StreamReader.#Null", Justification="matell: Underlying type is actually immutable")]
+[module: SuppressMessage("Microsoft.Security","CA2104:DoNotDeclareReadOnlyMutableReferenceTypes", Scope="member", Target="System.IO.StreamWriter.#Null", Justification="matell: Underlying type is actually Immutable")]
+[module: SuppressMessage("Microsoft.Security","CA2104:DoNotDeclareReadOnlyMutableReferenceTypes", Scope="member", Target="System.IO.TextReader.#Null", Justification="matell: Underlying type is actually immutable")]
+[module: SuppressMessage("Microsoft.Security","CA2104:DoNotDeclareReadOnlyMutableReferenceTypes", Scope="member", Target="System.IO.TextWriter.#Null", Justification="matell: Underlying type is actually immutable")]
+[module: SuppressMessage("Microsoft.Cryptographic.Standard","CA5354:SHA1CannotBeUsed", Scope="member", Target="System.Diagnostics.Tracing.EventSource.#GenerateGuidFromName(System.String)", Justification="matell: Existing code that needs to interop with other components using SHA-1")]
+[module: SuppressMessage("Microsoft.Cryptographic.Standard","CA5354:SHA1CannotBeUsed", Scope="member", Target="System.IO.IsolatedStorage.IsolatedStorage.#GetHash(System.IO.Stream)", Justification="matell: Existing code that needs to interop with other components using SHA-1")]
+[module: SuppressMessage("Microsoft.Cryptographic.Standard","CA5354:SHA1CannotBeUsed", Scope="member", Target="System.IO.IsolatedStorage.IsolatedStorageFile.#GetStrongHashSuitableForObjectName(System.String)", Justification="matell: Existing code that needs to interop with other components using SHA-1")]
+[module: SuppressMessage("Microsoft.Cryptographic.Standard","CA5354:SHA1CannotBeUsed", Scope="member", Target="System.Security.Policy.HashMembershipCondition.#ParseHashAlgorithm()", Justification="matell: Existing code that needs to interop with other components using SHA-1")]
+[module: SuppressMessage("Microsoft.Cryptographic.Standard","CA5354:SHA1CannotBeUsed", Scope="member", Target="System.Security.Policy.HashMembershipCondition.#.ctor(System.Runtime.Serialization.SerializationInfo,System.Runtime.Serialization.StreamingContext)", Justification="matell: Existing code that needs to interop with other components using SHA-1")]
+[module: SuppressMessage("Microsoft.Cryptographic.Standard","CA5351:DESCannotBeUsed", Scope="member", Target="System.Security.Cryptography.DES.#Create()", Justification="matell: By design. Needed for implementation of security algorithms")]
+[module: SuppressMessage("Microsoft.Cryptographic.Standard","CA5351:DESCannotBeUsed", Scope="member", Target="System.Security.Cryptography.DES.#IsSemiWeakKey(System.Byte[])", Justification="matell: By design. Needed for implementation of security algorithms")]
+[module: SuppressMessage("Microsoft.Cryptographic.Standard","CA5351:DESCannotBeUsed", Scope="member", Target="System.Security.Cryptography.DES.#IsWeakKey(System.Byte[])", Justification="matell: By design. Needed for implementation of security algorithms")]
+[module: SuppressMessage("Microsoft.Cryptographic.Standard","CA5351:DESCannotBeUsed", Scope="member", Target="System.Security.Cryptography.DES.#get_Key()", Justification="matell: By design. Needed for implementation of security algorithms")]
+[module: SuppressMessage("Microsoft.Cryptographic.Standard","CA5351:DESCannotBeUsed", Scope="member", Target="System.Security.Cryptography.DES.#set_Key(System.Byte[])", Justification="matell: By design. Needed for implementation of security algorithms")]
+[module: SuppressMessage("Microsoft.Cryptographic.Standard","CA5351:DESCannotBeUsed", Scope="member", Target="System.Security.Cryptography.DESCryptoServiceProvider.#.ctor()", Justification="matell: By design. Needed for implementation of security algorithms")]
+[module: SuppressMessage("Microsoft.Cryptographic.Standard","CA5351:DESCannotBeUsed", Scope="member", Target="System.Security.Cryptography.DESCryptoServiceProvider.#CreateDecryptor(System.Byte[],System.Byte[])", Justification="matell: By design. Needed for implementation of security algorithms")]
+[module: SuppressMessage("Microsoft.Cryptographic.Standard","CA5351:DESCannotBeUsed", Scope="member", Target="System.Security.Cryptography.DESCryptoServiceProvider.#CreateEncryptor(System.Byte[],System.Byte[])", Justification="matell: By design. Needed for implementation of security algorithms")]
+[module: SuppressMessage("Microsoft.Cryptographic.Standard","CA5351:DESCannotBeUsed", Scope="member", Target="System.Security.Cryptography.DESCryptoServiceProvider.#GenerateKey()", Justification="matell: By design. Needed for implementation of security algorithms")]
+[module: SuppressMessage("Microsoft.Cryptographic.Standard","CA5354:SHA1CannotBeUsed", Scope="member", Target="System.Security.Cryptography.DSACryptoServiceProvider.#.ctor(System.Int32,System.Security.Cryptography.CspParameters)", Justification="matell: By design. Needed for implementation of security algorithms")]
+[module: SuppressMessage("Microsoft.Cryptographic.Standard","CA5356:DSACannotBeUsed", Scope="member", Target="System.Security.Cryptography.DSASignatureFormatter.#CreateSignature(System.Byte[])", Justification="matell: By design. Needed for implementation of security algorithms")]
+[module: SuppressMessage("Microsoft.Cryptographic.Standard","CA5350:MD5CannotBeUsed", Scope="member", Target="System.Security.Cryptography.HMACMD5.#.ctor()", Justification="matell: By design. Needed for implementation of security algorithms")]
+[module: SuppressMessage("Microsoft.Cryptographic.Standard","CA5350:MD5CannotBeUsed", Scope="member", Target="System.Security.Cryptography.HMACMD5.#.ctor(System.Byte[])", Justification="matell: By design. Needed for implementation of security algorithms")]
+[module: SuppressMessage("Microsoft.Cryptographic.Standard","CA5355:RIPEMD160IsNotRecommended", Scope="member", Target="System.Security.Cryptography.HMACRIPEMD160.#.ctor()", Justification="matell: By design. Needed for implementation of security algorithms")]
+[module: SuppressMessage("Microsoft.Cryptographic.Standard","CA5355:RIPEMD160IsNotRecommended", Scope="member", Target="System.Security.Cryptography.HMACRIPEMD160.#.ctor(System.Byte[])", Justification="matell: By design. Needed for implementation of security algorithms")]
+[module: SuppressMessage("Microsoft.Cryptographic.Standard","CA5354:SHA1CannotBeUsed", Scope="member", Target="System.Security.Cryptography.HMACSHA1.#.ctor(System.Byte[],System.Boolean)", Justification="matell: By design. Needed for implementation of security algorithms")]
+[module: SuppressMessage("Microsoft.Cryptographic.Standard","CA5353:TripleDESCannotBeUsed", Scope="member", Target="System.Security.Cryptography.MACTripleDES.#.ctor()", Justification="matell: By design. Needed for implementation of security algorithms")]
+[module: SuppressMessage("Microsoft.Cryptographic.Standard","CA5353:TripleDESCannotBeUsed", Scope="member", Target="System.Security.Cryptography.MACTripleDES.#.ctor(System.String,System.Byte[])", Justification="matell: By design. Needed for implementation of security algorithms")]
+[module: SuppressMessage("Microsoft.Cryptographic.Standard","CA5350:MD5CannotBeUsed", Scope="member", Target="System.Security.Cryptography.MD5.#Create()", Justification="matell: By design. Needed for implementation of security algorithms")]
+[module: SuppressMessage("Microsoft.Cryptographic.Standard","CA5350:MD5CannotBeUsed", Scope="member", Target="System.Security.Cryptography.MD5CryptoServiceProvider.#.ctor()", Justification="matell: By design. Needed for implementation of security algorithms")]
+[module: SuppressMessage("Microsoft.Cryptographic.Standard","CA5352:RC2CannotBeUsed", Scope="member", Target="System.Security.Cryptography.RC2.#Create()", Justification="matell: By design. Needed for implementation of security algorithms")]
+[module: SuppressMessage("Microsoft.Cryptographic.Standard","CA5352:RC2CannotBeUsed", Scope="member", Target="System.Security.Cryptography.RC2CryptoServiceProvider.#.ctor()", Justification="matell: By design. Needed for implementation of security algorithms")]
+[module: SuppressMessage("Microsoft.Cryptographic.Standard","CA5352:RC2CannotBeUsed", Scope="member", Target="System.Security.Cryptography.RC2CryptoServiceProvider.#CreateDecryptor(System.Byte[],System.Byte[])", Justification="matell: By design. Needed for implementation of security algorithms")]
+[module: SuppressMessage("Microsoft.Cryptographic.Standard","CA5352:RC2CannotBeUsed", Scope="member", Target="System.Security.Cryptography.RC2CryptoServiceProvider.#CreateEncryptor(System.Byte[],System.Byte[])", Justification="matell: By design. Needed for implementation of security algorithms")]
+[module: SuppressMessage("Microsoft.Cryptographic.Standard","CA5355:RIPEMD160IsNotRecommended", Scope="member", Target="System.Security.Cryptography.RIPEMD160.#Create()", Justification="matell: By design. Needed for implementation of security algorithms")]
+[module: SuppressMessage("Microsoft.Cryptographic.Standard","CA5355:RIPEMD160IsNotRecommended", Scope="member", Target="System.Security.Cryptography.RIPEMD160Managed.#.ctor()", Justification="matell: By design. Needed for implementation of security algorithms")]
+[module: SuppressMessage("Microsoft.Cryptographic.Standard","CA5355:RIPEMD160IsNotRecommended", Scope="member", Target="System.Security.Cryptography.RIPEMD160Managed.#HashCore(System.Byte[],System.Int32,System.Int32)", Justification="matell: By design. Needed for implementation of security algorithms")]
+[module: SuppressMessage("Microsoft.Cryptographic.Standard","CA5355:RIPEMD160IsNotRecommended", Scope="member", Target="System.Security.Cryptography.RIPEMD160Managed.#HashFinal()", Justification="matell: By design. Needed for implementation of security algorithms")]
+[module: SuppressMessage("Microsoft.Cryptographic.Standard","CA5355:RIPEMD160IsNotRecommended", Scope="member", Target="System.Security.Cryptography.RIPEMD160Managed.#Initialize()", Justification="matell: By design. Needed for implementation of security algorithms")]
+[module: SuppressMessage("Microsoft.Cryptographic.Standard","CA5355:RIPEMD160IsNotRecommended", Scope="member", Target="System.Security.Cryptography.RIPEMD160Managed.#MDTransform(System.UInt32*,System.UInt32*,System.Byte*)", Justification="matell: By design. Needed for implementation of security algorithms")]
+[module: SuppressMessage("Microsoft.Cryptographic.Standard","CA5355:RIPEMD160IsNotRecommended", Scope="member", Target="System.Security.Cryptography.RIPEMD160Managed.#_EndHash()", Justification="matell: By design. Needed for implementation of security algorithms")]
+[module: SuppressMessage("Microsoft.Cryptographic.Standard","CA5355:RIPEMD160IsNotRecommended", Scope="member", Target="System.Security.Cryptography.RIPEMD160Managed.#_HashData(System.Byte[],System.Int32,System.Int32)", Justification="matell: By design. Needed for implementation of security algorithms")]
+[module: SuppressMessage("Microsoft.Cryptographic.Standard","CA5354:SHA1CannotBeUsed", Scope="member", Target="System.Security.Cryptography.RSAOAEPKeyExchangeDeformatter.#DecryptKeyExchange(System.Byte[])", Justification="matell: By design. Needed for implementation of security algorithms")]
+[module: SuppressMessage("Microsoft.Cryptographic.Standard","CA5354:SHA1CannotBeUsed", Scope="member", Target="System.Security.Cryptography.RSAOAEPKeyExchangeFormatter.#CreateKeyExchange(System.Byte[])", Justification="matell: By design. Needed for implementation of security algorithms")]
+[module: SuppressMessage("Microsoft.Cryptographic.Standard","CA5357:RijndaelCannotBeUsed", Scope="member", Target="System.Security.Cryptography.Rijndael.#Create()", Justification="matell: By design. Needed for implementation of security algorithms")]
+[module: SuppressMessage("Microsoft.Cryptographic.Standard","CA5357:RijndaelCannotBeUsed", Scope="member", Target="System.Security.Cryptography.RijndaelManaged.#.ctor()", Justification="matell: By design. Needed for implementation of security algorithms")]
+[module: SuppressMessage("Microsoft.Cryptographic.Standard","CA5357:RijndaelCannotBeUsed", Scope="member", Target="System.Security.Cryptography.RijndaelManaged.#CreateDecryptor(System.Byte[],System.Byte[])", Justification="matell: By design. Needed for implementation of security algorithms")]
+[module: SuppressMessage("Microsoft.Cryptographic.Standard","CA5357:RijndaelCannotBeUsed", Scope="member", Target="System.Security.Cryptography.RijndaelManaged.#CreateEncryptor(System.Byte[],System.Byte[])", Justification="matell: By design. Needed for implementation of security algorithms")]
+[module: SuppressMessage("Microsoft.Cryptographic.Standard","CA5354:SHA1CannotBeUsed", Scope="member", Target="System.Security.Cryptography.SHA1.#Create()", Justification="matell: By design. Needed for implementation of security algorithms")]
+[module: SuppressMessage("Microsoft.Cryptographic.Standard","CA5354:SHA1CannotBeUsed", Scope="member", Target="System.Security.Cryptography.SHA1CryptoServiceProvider.#.ctor()", Justification="matell: By design. Needed for implementation of security algorithms")]
+[module: SuppressMessage("Microsoft.Cryptographic.Standard","CA5354:SHA1CannotBeUsed", Scope="member", Target="System.Security.Cryptography.SHA1Managed.#.ctor()", Justification="matell: By design. Needed for implementation of security algorithms")]
+[module: SuppressMessage("Microsoft.Cryptographic.Standard","CA5354:SHA1CannotBeUsed", Scope="member", Target="System.Security.Cryptography.SHA1Managed.#HashCore(System.Byte[],System.Int32,System.Int32)", Justification="matell: By design. Needed for implementation of security algorithms")]
+[module: SuppressMessage("Microsoft.Cryptographic.Standard","CA5354:SHA1CannotBeUsed", Scope="member", Target="System.Security.Cryptography.SHA1Managed.#HashFinal()", Justification="matell: By design. Needed for implementation of security algorithms")]
+[module: SuppressMessage("Microsoft.Cryptographic.Standard","CA5354:SHA1CannotBeUsed", Scope="member", Target="System.Security.Cryptography.SHA1Managed.#Initialize()", Justification="matell: By design. Needed for implementation of security algorithms")]
+[module: SuppressMessage("Microsoft.Cryptographic.Standard","CA5354:SHA1CannotBeUsed", Scope="member", Target="System.Security.Cryptography.SHA1Managed.#SHATransform(System.UInt32*,System.UInt32*,System.Byte*)", Justification="matell: By design. Needed for implementation of security algorithms")]
+[module: SuppressMessage("Microsoft.Cryptographic.Standard","CA5354:SHA1CannotBeUsed", Scope="member", Target="System.Security.Cryptography.SHA1Managed.#_EndHash()", Justification="matell: By design. Needed for implementation of security algorithms")]
+[module: SuppressMessage("Microsoft.Cryptographic.Standard","CA5354:SHA1CannotBeUsed", Scope="member", Target="System.Security.Cryptography.SHA1Managed.#_HashData(System.Byte[],System.Int32,System.Int32)", Justification="matell: By design. Needed for implementation of security algorithms")]
+[module: SuppressMessage("Microsoft.Cryptographic.Standard","CA5353:TripleDESCannotBeUsed", Scope="member", Target="System.Security.Cryptography.TripleDES.#Create()", Justification="matell: By design. Needed for implementation of security algorithms")]
+[module: SuppressMessage("Microsoft.Cryptographic.Standard","CA5353:TripleDESCannotBeUsed", Scope="member", Target="System.Security.Cryptography.TripleDES.#IsWeakKey(System.Byte[])", Justification="matell: By design. Needed for implementation of security algorithms")]
+[module: SuppressMessage("Microsoft.Cryptographic.Standard","CA5353:TripleDESCannotBeUsed", Scope="member", Target="System.Security.Cryptography.TripleDES.#get_Key()", Justification="matell: By design. Needed for implementation of security algorithms")]
+[module: SuppressMessage("Microsoft.Cryptographic.Standard","CA5353:TripleDESCannotBeUsed", Scope="member", Target="System.Security.Cryptography.TripleDES.#set_Key(System.Byte[])", Justification="matell: By design. Needed for implementation of security algorithms")]
+[module: SuppressMessage("Microsoft.Cryptographic.Standard","CA5353:TripleDESCannotBeUsed", Scope="member", Target="System.Security.Cryptography.TripleDESCryptoServiceProvider.#.ctor()", Justification="matell: By design. Needed for implementation of security algorithms")]
+[module: SuppressMessage("Microsoft.Cryptographic.Standard","CA5353:TripleDESCannotBeUsed", Scope="member", Target="System.Security.Cryptography.TripleDESCryptoServiceProvider.#CreateDecryptor(System.Byte[],System.Byte[])", Justification="matell: By design. Needed for implementation of security algorithms")]
+[module: SuppressMessage("Microsoft.Cryptographic.Standard","CA5353:TripleDESCannotBeUsed", Scope="member", Target="System.Security.Cryptography.TripleDESCryptoServiceProvider.#CreateEncryptor(System.Byte[],System.Byte[])", Justification="matell: By design. Needed for implementation of security algorithms")]
+[module: SuppressMessage("Microsoft.Cryptographic.Standard","CA5353:TripleDESCannotBeUsed", Scope="member", Target="System.Security.Cryptography.TripleDESCryptoServiceProvider.#GenerateKey()", Justification="matell: By design. Needed for implementation of security algorithms")]
diff --git a/src/mscorlib/src/Internal/Runtime/Augments/EnvironmentAugments.cs b/src/mscorlib/src/Internal/Runtime/Augments/EnvironmentAugments.cs
new file mode 100644
index 0000000..2810468
--- /dev/null
+++ b/src/mscorlib/src/Internal/Runtime/Augments/EnvironmentAugments.cs
@@ -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.
+
+using System;
+
+namespace Internal.Runtime.Augments
+{
+ /// <summary>For internal use only. Exposes runtime functionality to the Environments implementation in corefx.</summary>
+ public static class EnvironmentAugments
+ {
+ public static int CurrentManagedThreadId => Environment.CurrentManagedThreadId;
+ public static void Exit(int exitCode) => Environment.Exit(exitCode);
+ public static int ExitCode { get { return Environment.ExitCode; } set { Environment.ExitCode = value; } }
+ public static void FailFast(string message, Exception error) => Environment.FailFast(message, error);
+ public static string[] GetCommandLineArgs() => Environment.GetCommandLineArgs();
+ public static bool HasShutdownStarted => Environment.HasShutdownStarted;
+ public static string StackTrace => Environment.StackTrace;
+ public static int TickCount => Environment.TickCount;
+ }
+}
diff --git a/src/mscorlib/src/Microsoft/Win32/OAVariantLib.cs b/src/mscorlib/src/Microsoft/Win32/OAVariantLib.cs
new file mode 100644
index 0000000..118c69b
--- /dev/null
+++ b/src/mscorlib/src/Microsoft/Win32/OAVariantLib.cs
@@ -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.
+
+/*============================================================
+**
+**
+**
+** Purpose: This class only exists to provide support for
+** implenting IDispatch on managed objects. It is
+** used to provide OleAut style coercion rules.
+**
+**
+===========================================================*/
+namespace Microsoft.Win32 {
+
+ using System;
+ using System.Diagnostics.Contracts;
+ using System.Reflection;
+ using System.Runtime.CompilerServices;
+ using System.Runtime.Versioning;
+ using CultureInfo = System.Globalization.CultureInfo;
+
+ internal static class OAVariantLib
+ {
+ #region Constants
+
+ // Constants for VariantChangeType from OleAuto.h
+ public const int NoValueProp = 0x01;
+ public const int AlphaBool = 0x02;
+ public const int NoUserOverride = 0x04;
+ public const int CalendarHijri = 0x08;
+ public const int LocalBool = 0x10;
+
+ internal static readonly Type [] ClassTypes = {
+ typeof(Empty),
+ typeof(void),
+ typeof(Boolean),
+ typeof(Char),
+ typeof(SByte),
+ typeof(Byte),
+ typeof(Int16),
+ typeof(UInt16),
+ typeof(Int32),
+ typeof(UInt32),
+ typeof(Int64),
+ typeof(UInt64),
+ typeof(Single),
+ typeof(Double),
+ typeof(String),
+ typeof(void),
+ typeof(DateTime),
+ typeof(TimeSpan),
+ typeof(Object),
+ typeof(Decimal),
+ null, // Enums - what do we do here?
+ typeof(Missing),
+ typeof(DBNull),
+ };
+
+ // Keep these numbers in sync w/ the above array.
+ private const int CV_OBJECT=0x12;
+
+ #endregion
+
+
+ #region Internal Methods
+
+ /**
+ * Changes a Variant from one type to another, calling the OLE
+ * Automation VariantChangeTypeEx routine. Note the legal types here are
+ * restricted to the subset of what can be legally found in a VB
+ * Variant and the types that CLR supports explicitly in the
+ * CLR Variant class.
+ */
+ [System.Security.SecurityCritical] // auto-generated
+ internal static Variant ChangeType(Variant source, Type targetClass, short options, CultureInfo culture)
+ {
+ if (targetClass == null)
+ throw new ArgumentNullException("targetClass");
+ if (culture == null)
+ throw new ArgumentNullException("culture");
+ Variant result = new Variant ();
+ ChangeTypeEx(ref result, ref source,
+#if FEATURE_USE_LCID
+ culture.LCID,
+#else
+ // @CORESYSTODO: what does CoreSystem expect for this argument?
+ 0,
+#endif
+ targetClass.TypeHandle.Value, GetCVTypeFromClass(targetClass), options);
+ return result;
+ }
+
+ #endregion
+
+
+ #region Private Helpers
+
+ private static int GetCVTypeFromClass(Type ctype)
+ {
+ Contract.Requires(ctype != null);
+#if _DEBUG
+ BCLDebug.Assert(ClassTypes[CV_OBJECT] == typeof(Object), "OAVariantLib::ClassTypes[CV_OBJECT] == Object.class");
+#endif
+
+ int cvtype=-1;
+ for (int i=0; i<ClassTypes.Length; i++) {
+ if (ctype.Equals(ClassTypes[i])) {
+ cvtype=i;
+ break;
+ }
+ }
+
+ // OleAut Binder works better if unrecognized
+ // types were changed to Object. So don't throw here.
+ if (cvtype == -1)
+ cvtype = CV_OBJECT;
+
+ return cvtype;
+ }
+
+ #endregion
+
+
+ #region Private FCalls
+
+ [System.Security.SecurityCritical] // auto-generated
+ [MethodImplAttribute(MethodImplOptions.InternalCall)]
+ private static extern void ChangeTypeEx(ref Variant result, ref Variant source, int lcid, IntPtr typeHandle, int cvType, short flags);
+
+ #endregion
+ }
+}
diff --git a/src/mscorlib/src/Microsoft/Win32/Registry.cs b/src/mscorlib/src/Microsoft/Win32/Registry.cs
new file mode 100644
index 0000000..4faf29d
--- /dev/null
+++ b/src/mscorlib/src/Microsoft/Win32/Registry.cs
@@ -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.
+
+
+namespace Microsoft.Win32 {
+ using System;
+ using System.Runtime.InteropServices;
+ using System.Runtime.Versioning;
+
+ /**
+ * Registry encapsulation. Contains members representing all top level system
+ * keys.
+ *
+ * @security(checkClassLinking=on)
+ */
+ //This class contains only static members and does not need to be serializable.
+ [ComVisible(true)]
+ public static class Registry {
+ [System.Security.SecuritySafeCritical] // auto-generated
+ static Registry()
+ {
+ }
+
+ /**
+ * Current User Key.
+ *
+ * This key should be used as the root for all user specific settings.
+ */
+ public static readonly RegistryKey CurrentUser = RegistryKey.GetBaseKey(RegistryKey.HKEY_CURRENT_USER);
+
+ /**
+ * Local Machine Key.
+ *
+ * This key should be used as the root for all machine specific settings.
+ */
+ public static readonly RegistryKey LocalMachine = RegistryKey.GetBaseKey(RegistryKey.HKEY_LOCAL_MACHINE);
+
+ /**
+ * Classes Root Key.
+ *
+ * This is the root key of class information.
+ */
+ public static readonly RegistryKey ClassesRoot = RegistryKey.GetBaseKey(RegistryKey.HKEY_CLASSES_ROOT);
+
+ /**
+ * Users Root Key.
+ *
+ * This is the root of users.
+ */
+ public static readonly RegistryKey Users = RegistryKey.GetBaseKey(RegistryKey.HKEY_USERS);
+
+ /**
+ * Performance Root Key.
+ *
+ * This is where dynamic performance data is stored on NT.
+ */
+ public static readonly RegistryKey PerformanceData = RegistryKey.GetBaseKey(RegistryKey.HKEY_PERFORMANCE_DATA);
+
+ /**
+ * Current Config Root Key.
+ *
+ * This is where current configuration information is stored.
+ */
+ public static readonly RegistryKey CurrentConfig = RegistryKey.GetBaseKey(RegistryKey.HKEY_CURRENT_CONFIG);
+
+#if !FEATURE_CORECLR
+ /**
+ * Dynamic Data Root Key.
+ *
+ * LEGACY: This is where dynamic performance data is stored on Win9X.
+ * This does not exist on NT.
+ */
+ [Obsolete("The DynData registry key only works on Win9x, which is no longer supported by the CLR. On NT-based operating systems, use the PerformanceData registry key instead.")]
+ public static readonly RegistryKey DynData = RegistryKey.GetBaseKey(RegistryKey.HKEY_DYN_DATA);
+#endif
+
+ //
+ // Following function will parse a keyName and returns the basekey for it.
+ // It will also store the subkey name in the out parameter.
+ // If the keyName is not valid, we will throw ArgumentException.
+ // The return value shouldn't be null.
+ //
+ [System.Security.SecurityCritical] // auto-generated
+ private static RegistryKey GetBaseKeyFromKeyName(string keyName, out string subKeyName) {
+ if( keyName == null) {
+ throw new ArgumentNullException("keyName");
+ }
+
+ string basekeyName;
+ int i = keyName.IndexOf('\\');
+ if( i != -1) {
+ basekeyName = keyName.Substring(0, i).ToUpper(System.Globalization.CultureInfo.InvariantCulture);
+ }
+ else {
+ basekeyName = keyName.ToUpper(System.Globalization.CultureInfo.InvariantCulture);
+ }
+ RegistryKey basekey = null;
+
+ switch(basekeyName) {
+ case "HKEY_CURRENT_USER":
+ basekey = Registry.CurrentUser;
+ break;
+ case "HKEY_LOCAL_MACHINE":
+ basekey = Registry.LocalMachine;
+ break;
+ case "HKEY_CLASSES_ROOT":
+ basekey = Registry.ClassesRoot;
+ break;
+ case "HKEY_USERS":
+ basekey = Registry.Users;
+ break;
+ case "HKEY_PERFORMANCE_DATA":
+ basekey = Registry.PerformanceData;
+ break;
+ case "HKEY_CURRENT_CONFIG":
+ basekey = Registry.CurrentConfig;
+ break;
+#if !FEATURE_CORECLR
+ case "HKEY_DYN_DATA":
+ basekey = RegistryKey.GetBaseKey(RegistryKey.HKEY_DYN_DATA);
+ break;
+#endif
+ default:
+ throw new ArgumentException(Environment.GetResourceString("Arg_RegInvalidKeyName", "keyName"));
+ }
+ if( i == -1 || i == keyName.Length) {
+ subKeyName = string.Empty;
+ }
+ else {
+ subKeyName = keyName.Substring(i + 1, keyName.Length - i - 1);
+ }
+ return basekey;
+ }
+
+ [System.Security.SecuritySafeCritical] // auto-generated
+ public static object GetValue(string keyName, string valueName, object defaultValue ) {
+ string subKeyName;
+ RegistryKey basekey = GetBaseKeyFromKeyName(keyName, out subKeyName);
+ BCLDebug.Assert(basekey != null, "basekey can't be null.");
+ RegistryKey key = basekey.OpenSubKey(subKeyName);
+ if(key == null) { // if the key doesn't exist, do nothing
+ return null;
+ }
+ try {
+ return key.GetValue(valueName, defaultValue);
+ }
+ finally {
+ key.Close();
+ }
+ }
+
+ public static void SetValue(string keyName, string valueName, object value ) {
+ SetValue(keyName, valueName, value, RegistryValueKind.Unknown);
+ }
+
+ [System.Security.SecuritySafeCritical] // auto-generated
+ public static void SetValue(string keyName, string valueName, object value, RegistryValueKind valueKind ) {
+ string subKeyName;
+ RegistryKey basekey = GetBaseKeyFromKeyName(keyName, out subKeyName);
+ BCLDebug.Assert(basekey != null, "basekey can't be null!");
+ RegistryKey key = basekey.CreateSubKey(subKeyName);
+ BCLDebug.Assert(key != null, "An exception should be thrown if failed!");
+ try {
+ key.SetValue(valueName, value, valueKind);
+ }
+ finally {
+ key.Close();
+ }
+ }
+ }
+}
+
+
diff --git a/src/mscorlib/src/Microsoft/Win32/RegistryKey.cs b/src/mscorlib/src/Microsoft/Win32/RegistryKey.cs
new file mode 100644
index 0000000..dcf31dc
--- /dev/null
+++ b/src/mscorlib/src/Microsoft/Win32/RegistryKey.cs
@@ -0,0 +1,2166 @@
+// Licensed to the .NET Foundation under one or more 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 on transaction support:
+ Eventually we will want to add support for NT's transactions to our
+ RegistryKey API's (possibly Whidbey M3?). When we do this, here's
+ the list of API's we need to make transaction-aware:
+
+ RegCreateKeyEx
+ RegDeleteKey
+ RegDeleteValue
+ RegEnumKeyEx
+ RegEnumValue
+ RegOpenKeyEx
+ RegQueryInfoKey
+ RegQueryValueEx
+ RegSetValueEx
+
+ We can ignore RegConnectRegistry (remote registry access doesn't yet have
+ transaction support) and RegFlushKey. RegCloseKey doesn't require any
+ additional work. .
+ */
+
+/*
+ Note on ACL support:
+ The key thing to note about ACL's is you set them on a kernel object like a
+ registry key, then the ACL only gets checked when you construct handles to
+ them. So if you set an ACL to deny read access to yourself, you'll still be
+ able to read with that handle, but not with new handles.
+
+ Another peculiarity is a Terminal Server app compatibility workaround. The OS
+ will second guess your attempt to open a handle sometimes. If a certain
+ combination of Terminal Server app compat registry keys are set, then the
+ OS will try to reopen your handle with lesser permissions if you couldn't
+ open it in the specified mode. So on some machines, we will see handles that
+ may not be able to read or write to a registry key. It's very strange. But
+ the real test of these handles is attempting to read or set a value in an
+ affected registry key.
+
+ For reference, at least two registry keys must be set to particular values
+ for this behavior:
+ HKLM\SOFTWARE\Microsoft\Windows NT\CurrentVersion\Terminal Server\RegistryExtensionFlags, the least significant bit must be 1.
+ HKLM\SYSTEM\CurrentControlSet\Control\TerminalServer\TSAppCompat must be 1
+ There might possibly be an interaction with yet a third registry key as well.
+
+*/
+
+
+namespace Microsoft.Win32 {
+
+ using System;
+ using System.Collections;
+ using System.Collections.Generic;
+ using System.Security;
+#if FEATURE_MACL
+ using System.Security.AccessControl;
+#endif
+ using System.Security.Permissions;
+ using System.Text;
+ using System.Threading;
+ using System.IO;
+ using System.Runtime.Remoting;
+ using System.Runtime.InteropServices;
+ using Microsoft.Win32.SafeHandles;
+ using System.Runtime.Versioning;
+ using System.Globalization;
+ using System.Diagnostics.Contracts;
+ using System.Diagnostics.CodeAnalysis;
+
+ /**
+ * Registry hive values. Useful only for GetRemoteBaseKey
+ */
+ [Serializable]
+[System.Runtime.InteropServices.ComVisible(true)]
+ public enum RegistryHive
+ {
+ ClassesRoot = unchecked((int)0x80000000),
+ CurrentUser = unchecked((int)0x80000001),
+ LocalMachine = unchecked((int)0x80000002),
+ Users = unchecked((int)0x80000003),
+ PerformanceData = unchecked((int)0x80000004),
+ CurrentConfig = unchecked((int)0x80000005),
+#if !FEATURE_CORECLR
+ DynData = unchecked((int)0x80000006),
+#endif
+ }
+
+ /**
+ * Registry encapsulation. To get an instance of a RegistryKey use the
+ * Registry class's static members then call OpenSubKey.
+ *
+ * @see Registry
+ * @security(checkDllCalls=off)
+ * @security(checkClassLinking=on)
+ */
+#if FEATURE_REMOTING
+ [ComVisible(true)]
+ public sealed class RegistryKey : MarshalByRefObject, IDisposable
+#else
+ [ComVisible(true)]
+ public sealed class RegistryKey : IDisposable
+#endif
+ {
+
+ // We could use const here, if C# supported ELEMENT_TYPE_I fully.
+ internal static readonly IntPtr HKEY_CLASSES_ROOT = new IntPtr(unchecked((int)0x80000000));
+ internal static readonly IntPtr HKEY_CURRENT_USER = new IntPtr(unchecked((int)0x80000001));
+ internal static readonly IntPtr HKEY_LOCAL_MACHINE = new IntPtr(unchecked((int)0x80000002));
+ internal static readonly IntPtr HKEY_USERS = new IntPtr(unchecked((int)0x80000003));
+ internal static readonly IntPtr HKEY_PERFORMANCE_DATA = new IntPtr(unchecked((int)0x80000004));
+ internal static readonly IntPtr HKEY_CURRENT_CONFIG = new IntPtr(unchecked((int)0x80000005));
+#if !FEATURE_CORECLR
+ internal static readonly IntPtr HKEY_DYN_DATA = new IntPtr(unchecked((int)0x80000006));
+#endif
+
+ // Dirty indicates that we have munged data that should be potentially
+ // written to disk.
+ //
+ private const int STATE_DIRTY = 0x0001;
+
+ // SystemKey indicates that this is a "SYSTEMKEY" and shouldn't be "opened"
+ // or "closed".
+ //
+ private const int STATE_SYSTEMKEY = 0x0002;
+
+ // Access
+ //
+ private const int STATE_WRITEACCESS = 0x0004;
+
+ // Indicates if this key is for HKEY_PERFORMANCE_DATA
+ private const int STATE_PERF_DATA = 0x0008;
+
+ // Names of keys. This array must be in the same order as the HKEY values listed above.
+ //
+ private static readonly String[] hkeyNames = new String[] {
+ "HKEY_CLASSES_ROOT",
+ "HKEY_CURRENT_USER",
+ "HKEY_LOCAL_MACHINE",
+ "HKEY_USERS",
+ "HKEY_PERFORMANCE_DATA",
+ "HKEY_CURRENT_CONFIG",
+#if !FEATURE_CORECLR
+ "HKEY_DYN_DATA"
+#endif
+ };
+
+ // MSDN defines the following limits for registry key names & values:
+ // Key Name: 255 characters
+ // Value name: 16,383 Unicode characters
+ // Value: either 1 MB or current available memory, depending on registry format.
+ private const int MaxKeyLength = 255;
+ private const int MaxValueLength = 16383;
+
+ [System.Security.SecurityCritical] // auto-generated
+ private volatile SafeRegistryHandle hkey = null;
+ private volatile int state = 0;
+ private volatile String keyName;
+ private volatile bool remoteKey = false;
+ private volatile RegistryKeyPermissionCheck checkMode;
+ private volatile RegistryView regView = RegistryView.Default;
+
+ /**
+ * RegistryInternalCheck values. Useful only for CheckPermission
+ */
+ private enum RegistryInternalCheck {
+ CheckSubKeyWritePermission = 0,
+ CheckSubKeyReadPermission = 1,
+ CheckSubKeyCreatePermission = 2,
+ CheckSubTreeReadPermission = 3,
+ CheckSubTreeWritePermission = 4,
+ CheckSubTreeReadWritePermission = 5,
+ CheckValueWritePermission = 6,
+ CheckValueCreatePermission = 7,
+ CheckValueReadPermission = 8,
+ CheckKeyReadPermission = 9,
+ CheckSubTreePermission = 10,
+ CheckOpenSubKeyWithWritablePermission = 11,
+ CheckOpenSubKeyPermission = 12
+ };
+
+
+ /**
+ * Creates a RegistryKey.
+ *
+ * This key is bound to hkey, if writable is <b>false</b> then no write operations
+ * will be allowed.
+ */
+ [System.Security.SecurityCritical] // auto-generated
+ private RegistryKey(SafeRegistryHandle hkey, bool writable, RegistryView view)
+ : this(hkey, writable, false, false, false, view) {
+ }
+
+
+ /**
+ * Creates a RegistryKey.
+ *
+ * This key is bound to hkey, if writable is <b>false</b> then no write operations
+ * will be allowed. If systemkey is set then the hkey won't be released
+ * when the object is GC'ed.
+ * The remoteKey flag when set to true indicates that we are dealing with registry entries
+ * on a remote machine and requires the program making these calls to have full trust.
+ */
+ [System.Security.SecurityCritical] // auto-generated
+ private RegistryKey(SafeRegistryHandle hkey, bool writable, bool systemkey, bool remoteKey, bool isPerfData, RegistryView view) {
+ this.hkey = hkey;
+ this.keyName = "";
+ this.remoteKey = remoteKey;
+ this.regView = view;
+ if (systemkey) {
+ this.state |= STATE_SYSTEMKEY;
+ }
+ if (writable) {
+ this.state |= STATE_WRITEACCESS;
+ }
+ if (isPerfData)
+ this.state |= STATE_PERF_DATA;
+ ValidateKeyView(view);
+ }
+
+ /**
+ * Closes this key, flushes it to disk if the contents have been modified.
+ */
+ public void Close() {
+ Dispose(true);
+ }
+
+ [System.Security.SecuritySafeCritical] // auto-generated
+ private void Dispose(bool disposing) {
+ if (hkey != null) {
+
+ if (!IsSystemKey()) {
+ try {
+ hkey.Dispose();
+ }
+ catch (IOException){
+ // we don't really care if the handle is invalid at this point
+ }
+ finally
+ {
+ hkey = null;
+ }
+ }
+ else if (disposing && IsPerfDataKey()) {
+ // System keys should never be closed. However, we want to call RegCloseKey
+ // on HKEY_PERFORMANCE_DATA when called from PerformanceCounter.CloseSharedResources
+ // (i.e. when disposing is true) so that we release the PERFLIB cache and cause it
+ // to be refreshed (by re-reading the registry) when accessed subsequently.
+ // This is the only way we can see the just installed perf counter.
+ // NOTE: since HKEY_PERFORMANCE_DATA is process wide, there is inherent race condition in closing
+ // the key asynchronously. While Vista is smart enough to rebuild the PERFLIB resources
+ // in this situation the down level OSes are not. We have a small window between
+ // the dispose below and usage elsewhere (other threads). This is By Design.
+ // This is less of an issue when OS > NT5 (i.e Vista & higher), we can close the perfkey
+ // (to release & refresh PERFLIB resources) and the OS will rebuild PERFLIB as necessary.
+ SafeRegistryHandle.RegCloseKey(RegistryKey.HKEY_PERFORMANCE_DATA);
+ }
+ }
+ }
+
+ [System.Security.SecuritySafeCritical] // auto-generated
+ public void Flush() {
+ if (hkey != null) {
+ if (IsDirty()) {
+ Win32Native.RegFlushKey(hkey);
+ }
+ }
+ }
+
+#if FEATURE_CORECLR
+ void IDisposable.Dispose()
+#else
+ public void Dispose()
+#endif
+ {
+ Dispose(true);
+ }
+
+ /**
+ * Creates a new subkey, or opens an existing one.
+ *
+ * @param subkey Name or path to subkey to create or open.
+ *
+ * @return the subkey, or <b>null</b> if the operation failed.
+ */
+ [SuppressMessage("Microsoft.Concurrency", "CA8001", Justification = "Reviewed for thread safety")]
+ public RegistryKey CreateSubKey(String subkey) {
+ return CreateSubKey(subkey, checkMode);
+ }
+
+ [ComVisible(false)]
+ public RegistryKey CreateSubKey(String subkey, RegistryKeyPermissionCheck permissionCheck)
+ {
+ return CreateSubKeyInternal(subkey, permissionCheck, null, RegistryOptions.None);
+ }
+
+ [ComVisible(false)]
+ public RegistryKey CreateSubKey(String subkey, RegistryKeyPermissionCheck permissionCheck, RegistryOptions options)
+ {
+ return CreateSubKeyInternal(subkey, permissionCheck, null, options);
+ }
+
+ [ComVisible(false)]
+ public RegistryKey CreateSubKey(String subkey, bool writable)
+ {
+ return CreateSubKeyInternal(subkey, writable ? RegistryKeyPermissionCheck.ReadWriteSubTree : RegistryKeyPermissionCheck.ReadSubTree, null, RegistryOptions.None);
+ }
+
+ [ComVisible(false)]
+ public RegistryKey CreateSubKey(String subkey, bool writable, RegistryOptions options)
+ {
+ return CreateSubKeyInternal(subkey, writable ? RegistryKeyPermissionCheck.ReadWriteSubTree : RegistryKeyPermissionCheck.ReadSubTree, null, options);
+ }
+
+
+#if FEATURE_MACL
+ [ComVisible(false)]
+ public unsafe RegistryKey CreateSubKey(String subkey, RegistryKeyPermissionCheck permissionCheck, RegistrySecurity registrySecurity)
+ {
+ return CreateSubKeyInternal(subkey, permissionCheck, registrySecurity, RegistryOptions.None);
+ }
+
+ [ComVisible(false)]
+ public unsafe RegistryKey CreateSubKey(String subkey, RegistryKeyPermissionCheck permissionCheck, RegistryOptions registryOptions, RegistrySecurity registrySecurity)
+ {
+ return CreateSubKeyInternal(subkey, permissionCheck, registrySecurity, registryOptions);
+ }
+#endif
+
+ [System.Security.SecuritySafeCritical] // auto-generated
+ [ComVisible(false)]
+ private unsafe RegistryKey CreateSubKeyInternal(String subkey, RegistryKeyPermissionCheck permissionCheck, object registrySecurityObj, RegistryOptions registryOptions)
+ {
+ ValidateKeyOptions(registryOptions);
+ ValidateKeyName(subkey);
+ ValidateKeyMode(permissionCheck);
+ EnsureWriteable();
+ subkey = FixupName(subkey); // Fixup multiple slashes to a single slash
+
+ // only keys opened under read mode is not writable
+ if (!remoteKey) {
+ RegistryKey key = InternalOpenSubKey(subkey, (permissionCheck != RegistryKeyPermissionCheck.ReadSubTree));
+ if (key != null) { // Key already exits
+ CheckPermission(RegistryInternalCheck.CheckSubKeyWritePermission, subkey, false, RegistryKeyPermissionCheck.Default);
+ CheckPermission(RegistryInternalCheck.CheckSubTreePermission, subkey, false, permissionCheck);
+ key.checkMode = permissionCheck;
+ return key;
+ }
+ }
+
+ CheckPermission(RegistryInternalCheck.CheckSubKeyCreatePermission, subkey, false, RegistryKeyPermissionCheck.Default);
+
+ Win32Native.SECURITY_ATTRIBUTES secAttrs = null;
+#if FEATURE_MACL
+ RegistrySecurity registrySecurity = (RegistrySecurity)registrySecurityObj;
+ // For ACL's, get the security descriptor from the RegistrySecurity.
+ if (registrySecurity != null) {
+ secAttrs = new Win32Native.SECURITY_ATTRIBUTES();
+ secAttrs.nLength = (int)Marshal.SizeOf(secAttrs);
+
+ byte[] sd = registrySecurity.GetSecurityDescriptorBinaryForm();
+ // We allocate memory on the stack to improve the speed.
+ // So this part of code can't be refactored into a method.
+ byte* pSecDescriptor = stackalloc byte[sd.Length];
+ Buffer.Memcpy(pSecDescriptor, 0, sd, 0, sd.Length);
+ secAttrs.pSecurityDescriptor = pSecDescriptor;
+ }
+#endif
+ int disposition = 0;
+
+ // By default, the new key will be writable.
+ SafeRegistryHandle result = null;
+ int ret = Win32Native.RegCreateKeyEx(hkey,
+ subkey,
+ 0,
+ null,
+ (int)registryOptions /* specifies if the key is volatile */,
+ GetRegistryKeyAccess(permissionCheck != RegistryKeyPermissionCheck.ReadSubTree) | (int)regView,
+ secAttrs,
+ out result,
+ out disposition);
+
+ if (ret == 0 && !result.IsInvalid) {
+ RegistryKey key = new RegistryKey(result, (permissionCheck != RegistryKeyPermissionCheck.ReadSubTree), false, remoteKey, false, regView);
+ CheckPermission(RegistryInternalCheck.CheckSubTreePermission, subkey, false, permissionCheck);
+ key.checkMode = permissionCheck;
+
+ if (subkey.Length == 0)
+ key.keyName = keyName;
+ else
+ key.keyName = keyName + "\\" + subkey;
+ return key;
+ }
+ else if (ret != 0) // syscall failed, ret is an error code.
+ Win32Error(ret, keyName + "\\" + subkey); // Access denied?
+
+ BCLDebug.Assert(false, "Unexpected code path in RegistryKey::CreateSubKey");
+ return null;
+ }
+
+ /**
+ * Deletes the specified subkey. Will throw an exception if the subkey has
+ * subkeys. To delete a tree of subkeys use, DeleteSubKeyTree.
+ *
+ * @param subkey SubKey to delete.
+ *
+ * @exception InvalidOperationException thrown if the subkey has child subkeys.
+ */
+ public void DeleteSubKey(String subkey) {
+ DeleteSubKey(subkey, true);
+ }
+
+ [System.Security.SecuritySafeCritical] // auto-generated
+ public void DeleteSubKey(String subkey, bool throwOnMissingSubKey) {
+ ValidateKeyName(subkey);
+ EnsureWriteable();
+ subkey = FixupName(subkey); // Fixup multiple slashes to a single slash
+ CheckPermission(RegistryInternalCheck.CheckSubKeyWritePermission, subkey, false, RegistryKeyPermissionCheck.Default);
+
+ // Open the key we are deleting and check for children. Be sure to
+ // explicitly call close to avoid keeping an extra HKEY open.
+ //
+ RegistryKey key = InternalOpenSubKey(subkey,false);
+ if (key != null) {
+ try {
+ if (key.InternalSubKeyCount() > 0) {
+ ThrowHelper.ThrowInvalidOperationException(ExceptionResource.InvalidOperation_RegRemoveSubKey);
+ }
+ }
+ finally {
+ key.Close();
+ }
+
+ int ret;
+
+ try {
+ ret = Win32Native.RegDeleteKeyEx(hkey, subkey, (int)regView, 0);
+ }
+ catch (EntryPointNotFoundException) {
+ ret = Win32Native.RegDeleteKey(hkey, subkey);
+ }
+
+ if (ret!=0) {
+ if (ret == Win32Native.ERROR_FILE_NOT_FOUND) {
+ if (throwOnMissingSubKey)
+ ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_RegSubKeyAbsent);
+ }
+ else
+ Win32Error(ret, null);
+ }
+ }
+ else { // there is no key which also means there is no subkey
+ if (throwOnMissingSubKey)
+ ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_RegSubKeyAbsent);
+ }
+ }
+
+ /**
+ * Recursively deletes a subkey and any child subkeys.
+ *
+ * @param subkey SubKey to delete.
+ */
+ public void DeleteSubKeyTree(String subkey) {
+ DeleteSubKeyTree(subkey, true /*throwOnMissingSubKey*/);
+ }
+
+ [System.Security.SecuritySafeCritical] // auto-generated
+ [ComVisible(false)]
+ public void DeleteSubKeyTree(String subkey, Boolean throwOnMissingSubKey) {
+ ValidateKeyName(subkey);
+
+ // Security concern: Deleting a hive's "" subkey would delete all
+ // of that hive's contents. Don't allow "".
+ if (subkey.Length==0 && IsSystemKey()) {
+ ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_RegKeyDelHive);
+ }
+
+ EnsureWriteable();
+
+ subkey = FixupName(subkey); // Fixup multiple slashes to a single slash
+ CheckPermission(RegistryInternalCheck.CheckSubTreeWritePermission, subkey, false, RegistryKeyPermissionCheck.Default);
+
+ RegistryKey key = InternalOpenSubKey(subkey, true);
+ if (key != null) {
+ try {
+ if (key.InternalSubKeyCount() > 0) {
+ String[] keys = key.InternalGetSubKeyNames();
+
+ for (int i=0; i<keys.Length; i++) {
+ key.DeleteSubKeyTreeInternal(keys[i]);
+ }
+ }
+ }
+ finally {
+ key.Close();
+ }
+
+ int ret;
+ try {
+ ret = Win32Native.RegDeleteKeyEx(hkey, subkey, (int)regView, 0);
+ }
+ catch (EntryPointNotFoundException) {
+ ret = Win32Native.RegDeleteKey(hkey, subkey);
+ }
+
+ if (ret!=0) Win32Error(ret, null);
+ }
+ else if(throwOnMissingSubKey) {
+ ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_RegSubKeyAbsent);
+ }
+ }
+
+ // An internal version which does no security checks or argument checking. Skipping the
+ // security checks should give us a slight perf gain on large trees.
+ [System.Security.SecurityCritical] // auto-generated
+ private void DeleteSubKeyTreeInternal(string subkey) {
+ RegistryKey key = InternalOpenSubKey(subkey, true);
+ if (key != null) {
+ try {
+ if (key.InternalSubKeyCount() > 0) {
+ String[] keys = key.InternalGetSubKeyNames();
+
+ for (int i=0; i<keys.Length; i++) {
+ key.DeleteSubKeyTreeInternal(keys[i]);
+ }
+ }
+ }
+ finally {
+ key.Close();
+ }
+
+ int ret;
+ try {
+ ret = Win32Native.RegDeleteKeyEx(hkey, subkey, (int)regView, 0);
+ }
+ catch (EntryPointNotFoundException) {
+ ret = Win32Native.RegDeleteKey(hkey, subkey);
+ }
+ if (ret!=0) Win32Error(ret, null);
+ }
+ else {
+ ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_RegSubKeyAbsent);
+ }
+ }
+
+ /**
+ * Deletes the specified value from this key.
+ *
+ * @param name Name of value to delete.
+ */
+ public void DeleteValue(String name) {
+ DeleteValue(name, true);
+ }
+
+ [System.Security.SecuritySafeCritical] // auto-generated
+ public void DeleteValue(String name, bool throwOnMissingValue) {
+ EnsureWriteable();
+ CheckPermission(RegistryInternalCheck.CheckValueWritePermission, name, false, RegistryKeyPermissionCheck.Default);
+ int errorCode = Win32Native.RegDeleteValue(hkey, name);
+
+ //
+ // From windows 2003 server, if the name is too long we will get error code ERROR_FILENAME_EXCED_RANGE
+ // This still means the name doesn't exist. We need to be consistent with previous OS.
+ //
+ if (errorCode == Win32Native.ERROR_FILE_NOT_FOUND || errorCode == Win32Native.ERROR_FILENAME_EXCED_RANGE) {
+ if (throwOnMissingValue) {
+ ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_RegSubKeyValueAbsent);
+ }
+ // Otherwise, just return giving no indication to the user.
+ // (For compatibility)
+ }
+ // We really should throw an exception here if errorCode was bad,
+ // but we can't for compatibility reasons.
+ BCLDebug.Correctness(errorCode == 0, "RegDeleteValue failed. Here's your error code: "+errorCode);
+ }
+
+ /**
+ * Retrieves a new RegistryKey that represents the requested key. Valid
+ * values are:
+ *
+ * HKEY_CLASSES_ROOT,
+ * HKEY_CURRENT_USER,
+ * HKEY_LOCAL_MACHINE,
+ * HKEY_USERS,
+ * HKEY_PERFORMANCE_DATA,
+ * HKEY_CURRENT_CONFIG,
+ * HKEY_DYN_DATA.
+ *
+ * @param hKey HKEY_* to open.
+ *
+ * @return the RegistryKey requested.
+ */
+ [System.Security.SecurityCritical] // auto-generated
+ internal static RegistryKey GetBaseKey(IntPtr hKey) {
+ return GetBaseKey(hKey, RegistryView.Default);
+ }
+
+ [System.Security.SecurityCritical] // auto-generated
+ internal static RegistryKey GetBaseKey(IntPtr hKey, RegistryView view) {
+
+ int index = ((int)hKey) & 0x0FFFFFFF;
+ BCLDebug.Assert(index >= 0 && index < hkeyNames.Length, "index is out of range!");
+ BCLDebug.Assert((((int)hKey) & 0xFFFFFFF0) == 0x80000000, "Invalid hkey value!");
+
+ bool isPerf = hKey == HKEY_PERFORMANCE_DATA;
+ // only mark the SafeHandle as ownsHandle if the key is HKEY_PERFORMANCE_DATA.
+ SafeRegistryHandle srh = new SafeRegistryHandle(hKey, isPerf);
+
+ RegistryKey key = new RegistryKey(srh, true, true,false, isPerf, view);
+ key.checkMode = RegistryKeyPermissionCheck.Default;
+ key.keyName = hkeyNames[index];
+ return key;
+ }
+
+
+ [System.Security.SecuritySafeCritical] // auto-generated
+ [ComVisible(false)]
+ public static RegistryKey OpenBaseKey(RegistryHive hKey, RegistryView view) {
+ ValidateKeyView(view);
+ CheckUnmanagedCodePermission();
+ return GetBaseKey((IntPtr)((int)hKey), view);
+ }
+
+ /**
+ * Retrieves a new RegistryKey that represents the requested key on a foreign
+ * machine. Valid values for hKey are members of the RegistryHive enum, or
+ * Win32 integers such as:
+ *
+ * HKEY_CLASSES_ROOT,
+ * HKEY_CURRENT_USER,
+ * HKEY_LOCAL_MACHINE,
+ * HKEY_USERS,
+ * HKEY_PERFORMANCE_DATA,
+ * HKEY_CURRENT_CONFIG,
+ * HKEY_DYN_DATA.
+ *
+ * @param hKey HKEY_* to open.
+ * @param machineName the machine to connect to
+ *
+ * @return the RegistryKey requested.
+ */
+ public static RegistryKey OpenRemoteBaseKey(RegistryHive hKey, String machineName) {
+ return OpenRemoteBaseKey(hKey, machineName, RegistryView.Default);
+ }
+
+ [System.Security.SecuritySafeCritical] // auto-generated
+ [ComVisible(false)]
+ public static RegistryKey OpenRemoteBaseKey(RegistryHive hKey, String machineName, RegistryView view) {
+ if (machineName==null)
+ throw new ArgumentNullException("machineName");
+ int index = (int)hKey & 0x0FFFFFFF;
+ if (index < 0 || index >= hkeyNames.Length || ((int)hKey & 0xFFFFFFF0) != 0x80000000) {
+ throw new ArgumentException(Environment.GetResourceString("Arg_RegKeyOutOfRange"));
+ }
+ ValidateKeyView(view);
+
+ CheckUnmanagedCodePermission();
+ // connect to the specified remote registry
+ SafeRegistryHandle foreignHKey = null;
+ int ret = Win32Native.RegConnectRegistry(machineName, new SafeRegistryHandle(new IntPtr((int)hKey), false), out foreignHKey);
+
+ if (ret == Win32Native.ERROR_DLL_INIT_FAILED)
+ // return value indicates an error occurred
+ throw new ArgumentException(Environment.GetResourceString("Arg_DllInitFailure"));
+
+ if (ret != 0)
+ Win32ErrorStatic(ret, null);
+
+ if (foreignHKey.IsInvalid)
+ // return value indicates an error occurred
+ throw new ArgumentException(Environment.GetResourceString("Arg_RegKeyNoRemoteConnect", machineName));
+
+ RegistryKey key = new RegistryKey(foreignHKey, true, false, true, ((IntPtr) hKey) == HKEY_PERFORMANCE_DATA, view);
+ key.checkMode = RegistryKeyPermissionCheck.Default;
+ key.keyName = hkeyNames[index];
+ return key;
+ }
+
+ /**
+ * Retrieves a subkey. If readonly is <b>true</b>, then the subkey is opened with
+ * read-only access.
+ *
+ * @param name Name or path of subkey to open.
+ * @param readonly Set to <b>true</b> if you only need readonly access.
+ *
+ * @return the Subkey requested, or <b>null</b> if the operation failed.
+ */
+ #if FEATURE_CORECLR
+ [System.Security.SecurityCritical] // auto-generated
+ #else
+ [System.Security.SecuritySafeCritical]
+ #endif
+ public RegistryKey OpenSubKey(string name, bool writable ) {
+ ValidateKeyName(name);
+ EnsureNotDisposed();
+ name = FixupName(name); // Fixup multiple slashes to a single slash
+
+ CheckPermission(RegistryInternalCheck.CheckOpenSubKeyWithWritablePermission, name, writable, RegistryKeyPermissionCheck.Default);
+ SafeRegistryHandle result = null;
+ int ret = Win32Native.RegOpenKeyEx(hkey,
+ name,
+ 0,
+ GetRegistryKeyAccess(writable) | (int)regView,
+ out result);
+
+ if (ret == 0 && !result.IsInvalid) {
+ RegistryKey key = new RegistryKey(result, writable, false, remoteKey, false, regView);
+ key.checkMode = GetSubKeyPermissonCheck(writable);
+ key.keyName = keyName + "\\" + name;
+ return key;
+ }
+
+ // Return null if we didn't find the key.
+ if (ret == Win32Native.ERROR_ACCESS_DENIED || ret == Win32Native.ERROR_BAD_IMPERSONATION_LEVEL) {
+ // We need to throw SecurityException here for compatibility reasons,
+ // although UnauthorizedAccessException will make more sense.
+ ThrowHelper.ThrowSecurityException(ExceptionResource.Security_RegistryPermission);
+ }
+
+ return null;
+ }
+
+#if FEATURE_MACL
+
+ [System.Security.SecuritySafeCritical] // auto-generated
+ [ComVisible(false)]
+ public RegistryKey OpenSubKey(String name, RegistryKeyPermissionCheck permissionCheck) {
+ ValidateKeyMode(permissionCheck);
+ return InternalOpenSubKey(name, permissionCheck, GetRegistryKeyAccess(permissionCheck));
+ }
+
+ [System.Security.SecuritySafeCritical]
+ [ComVisible(false)]
+ public RegistryKey OpenSubKey(String name, RegistryRights rights)
+ {
+ return InternalOpenSubKey(name, this.checkMode, (int)rights);
+ }
+
+ [System.Security.SecuritySafeCritical] // auto-generated
+ [ComVisible(false)]
+ public RegistryKey OpenSubKey(String name, RegistryKeyPermissionCheck permissionCheck, RegistryRights rights) {
+ return InternalOpenSubKey(name, permissionCheck, (int)rights);
+ }
+
+ [System.Security.SecurityCritical] // auto-generated
+ private RegistryKey InternalOpenSubKey(String name, RegistryKeyPermissionCheck permissionCheck, int rights) {
+ ValidateKeyName(name);
+ ValidateKeyMode(permissionCheck);
+
+ ValidateKeyRights(rights);
+
+ EnsureNotDisposed();
+ name = FixupName(name); // Fixup multiple slashes to a single slash
+
+ CheckPermission(RegistryInternalCheck.CheckOpenSubKeyPermission, name, false, permissionCheck);
+ CheckPermission(RegistryInternalCheck.CheckSubTreePermission, name, false, permissionCheck);
+ SafeRegistryHandle result = null;
+ int ret = Win32Native.RegOpenKeyEx(hkey, name, 0, (rights | (int)regView), out result);
+ if (ret == 0 && !result.IsInvalid) {
+ RegistryKey key = new RegistryKey(result, (permissionCheck == RegistryKeyPermissionCheck.ReadWriteSubTree), false, remoteKey, false, regView);
+ key.keyName = keyName + "\\" + name;
+ key.checkMode = permissionCheck;
+ return key;
+ }
+
+ // Return null if we didn't find the key.
+ if (ret == Win32Native.ERROR_ACCESS_DENIED || ret == Win32Native.ERROR_BAD_IMPERSONATION_LEVEL) {
+ // We need to throw SecurityException here for compatiblity reason,
+ // although UnauthorizedAccessException will make more sense.
+ ThrowHelper.ThrowSecurityException(ExceptionResource.Security_RegistryPermission);
+ }
+
+ return null;
+ }
+#endif
+
+ // This required no security checks. This is to get around the Deleting SubKeys which only require
+ // write permission. They call OpenSubKey which required read. Now instead call this function w/o security checks
+ [System.Security.SecurityCritical] // auto-generated
+ internal RegistryKey InternalOpenSubKey(String name, bool writable) {
+ ValidateKeyName(name);
+ EnsureNotDisposed();
+
+ SafeRegistryHandle result = null;
+ int ret = Win32Native.RegOpenKeyEx(hkey,
+ name,
+ 0,
+ GetRegistryKeyAccess(writable) | (int)regView,
+ out result);
+
+ if (ret == 0 && !result.IsInvalid) {
+ RegistryKey key = new RegistryKey(result, writable, false, remoteKey, false, regView);
+ key.keyName = keyName + "\\" + name;
+ return key;
+ }
+ return null;
+ }
+
+ /**
+ * Returns a subkey with read only permissions.
+ *
+ * @param name Name or path of subkey to open.
+ *
+ * @return the Subkey requested, or <b>null</b> if the operation failed.
+ */
+#if FEATURE_CORECLR
+ [System.Security.SecurityCritical]
+#endif
+ public RegistryKey OpenSubKey(String name) {
+ return OpenSubKey(name, false);
+ }
+
+ /**
+ * Retrieves the count of subkeys.
+ *
+ * @return a count of subkeys.
+ */
+ public int SubKeyCount {
+ [System.Security.SecuritySafeCritical] // auto-generated
+ get {
+ CheckPermission(RegistryInternalCheck.CheckKeyReadPermission, null, false, RegistryKeyPermissionCheck.Default);
+ return InternalSubKeyCount();
+ }
+ }
+
+ [ComVisible(false)]
+ public RegistryView View {
+ [System.Security.SecuritySafeCritical]
+ get {
+ EnsureNotDisposed();
+ return regView;
+ }
+ }
+
+#if !FEATURE_CORECLR
+ [ComVisible(false)]
+ public SafeRegistryHandle Handle {
+ [System.Security.SecurityCritical]
+ [SecurityPermissionAttribute(SecurityAction.Demand, Flags = SecurityPermissionFlag.UnmanagedCode)]
+ get {
+ EnsureNotDisposed();
+ int ret = Win32Native.ERROR_INVALID_HANDLE;
+ if (IsSystemKey()) {
+ IntPtr baseKey = (IntPtr)0;
+ switch (keyName) {
+ case "HKEY_CLASSES_ROOT":
+ baseKey = HKEY_CLASSES_ROOT;
+ break;
+ case "HKEY_CURRENT_USER":
+ baseKey = HKEY_CURRENT_USER;
+ break;
+ case "HKEY_LOCAL_MACHINE":
+ baseKey = HKEY_LOCAL_MACHINE;
+ break;
+ case "HKEY_USERS":
+ baseKey = HKEY_USERS;
+ break;
+ case "HKEY_PERFORMANCE_DATA":
+ baseKey = HKEY_PERFORMANCE_DATA;
+ break;
+ case "HKEY_CURRENT_CONFIG":
+ baseKey = HKEY_CURRENT_CONFIG;
+ break;
+ case "HKEY_DYN_DATA":
+ baseKey = HKEY_DYN_DATA;
+ break;
+ default:
+ Win32Error(ret, null);
+ break;
+ }
+ // open the base key so that RegistryKey.Handle will return a valid handle
+ SafeRegistryHandle result;
+ ret = Win32Native.RegOpenKeyEx(baseKey,
+ null,
+ 0,
+ GetRegistryKeyAccess(IsWritable()) | (int)regView,
+ out result);
+
+ if (ret == 0 && !result.IsInvalid) {
+ return result;
+ }
+ else {
+ Win32Error(ret, null);
+ }
+ }
+ else {
+ return hkey;
+ }
+ throw new IOException(Win32Native.GetMessage(ret), ret);
+ }
+ }
+
+ [System.Security.SecurityCritical]
+ [ComVisible(false)]
+ [SecurityPermissionAttribute(SecurityAction.Demand, Flags = SecurityPermissionFlag.UnmanagedCode)]
+ public static RegistryKey FromHandle(SafeRegistryHandle handle) {
+ return FromHandle(handle, RegistryView.Default);
+ }
+
+ [System.Security.SecurityCritical]
+ [ComVisible(false)]
+ [SecurityPermissionAttribute(SecurityAction.Demand, Flags = SecurityPermissionFlag.UnmanagedCode)]
+ public static RegistryKey FromHandle(SafeRegistryHandle handle, RegistryView view) {
+ if (handle == null) throw new ArgumentNullException("handle");
+ ValidateKeyView(view);
+
+ return new RegistryKey(handle, true /* isWritable */, view);
+ }
+#endif
+
+ [System.Security.SecurityCritical] // auto-generated
+ internal int InternalSubKeyCount() {
+ EnsureNotDisposed();
+
+ int subkeys = 0;
+ int junk = 0;
+ int ret = Win32Native.RegQueryInfoKey(hkey,
+ null,
+ null,
+ IntPtr.Zero,
+ ref subkeys, // subkeys
+ null,
+ null,
+ ref junk, // values
+ null,
+ null,
+ null,
+ null);
+
+ if (ret != 0)
+ Win32Error(ret, null);
+ return subkeys;
+ }
+
+ /**
+ * Retrieves an array of strings containing all the subkey names.
+ *
+ * @return all subkey names.
+ */
+ #if FEATURE_CORECLR
+ [System.Security.SecurityCritical] // auto-generated
+ #else
+ [System.Security.SecuritySafeCritical]
+ #endif
+ public String[] GetSubKeyNames() {
+ CheckPermission(RegistryInternalCheck.CheckKeyReadPermission, null, false, RegistryKeyPermissionCheck.Default);
+ return InternalGetSubKeyNames();
+ }
+
+ [System.Security.SecurityCritical] // auto-generated
+ internal unsafe String[] InternalGetSubKeyNames() {
+ EnsureNotDisposed();
+ int subkeys = InternalSubKeyCount();
+ String[] names = new String[subkeys]; // Returns 0-length array if empty.
+
+ if (subkeys > 0) {
+ char[] name = new char[MaxKeyLength + 1];
+
+ int namelen;
+
+ fixed (char *namePtr = &name[0])
+ {
+ for (int i=0; i<subkeys; i++) {
+ namelen = name.Length; // Don't remove this. The API's doesn't work if this is not properly initialised.
+ int ret = Win32Native.RegEnumKeyEx(hkey,
+ i,
+ namePtr,
+ ref namelen,
+ null,
+ null,
+ null,
+ null);
+ if (ret != 0)
+ Win32Error(ret, null);
+ names[i] = new String(namePtr);
+ }
+ }
+ }
+
+ return names;
+ }
+
+ /**
+ * Retrieves the count of values.
+ *
+ * @return a count of values.
+ */
+ public int ValueCount {
+ [System.Security.SecuritySafeCritical] // auto-generated
+ get {
+ CheckPermission(RegistryInternalCheck.CheckKeyReadPermission, null, false, RegistryKeyPermissionCheck.Default);
+ return InternalValueCount();
+ }
+ }
+
+ [System.Security.SecurityCritical] // auto-generated
+ internal int InternalValueCount() {
+ EnsureNotDisposed();
+ int values = 0;
+ int junk = 0;
+ int ret = Win32Native.RegQueryInfoKey(hkey,
+ null,
+ null,
+ IntPtr.Zero,
+ ref junk, // subkeys
+ null,
+ null,
+ ref values, // values
+ null,
+ null,
+ null,
+ null);
+ if (ret != 0)
+ Win32Error(ret, null);
+ return values;
+ }
+
+ /**
+ * Retrieves an array of strings containing all the value names.
+ *
+ * @return all value names.
+ */
+ [System.Security.SecuritySafeCritical] // auto-generated
+ public unsafe String[] GetValueNames() {
+ CheckPermission(RegistryInternalCheck.CheckKeyReadPermission, null, false, RegistryKeyPermissionCheck.Default);
+ EnsureNotDisposed();
+
+ int values = InternalValueCount();
+ String[] names = new String[values];
+
+ if (values > 0) {
+ char[] name = new char[MaxValueLength + 1];
+ int namelen;
+
+ fixed (char *namePtr = &name[0])
+ {
+ for (int i=0; i<values; i++) {
+ namelen = name.Length;
+
+ int ret = Win32Native.RegEnumValue(hkey,
+ i,
+ namePtr,
+ ref namelen,
+ IntPtr.Zero,
+ null,
+ null,
+ null);
+
+ if (ret != 0) {
+ // ignore ERROR_MORE_DATA if we're querying HKEY_PERFORMANCE_DATA
+ if (!(IsPerfDataKey() && ret == Win32Native.ERROR_MORE_DATA))
+ Win32Error(ret, null);
+ }
+
+ names[i] = new String(namePtr);
+ }
+ }
+ }
+
+ return names;
+ }
+
+ /**
+ * Retrieves the specified value. <b>null</b> is returned if the value
+ * doesn't exist.
+ *
+ * Note that <var>name</var> can be null or "", at which point the
+ * unnamed or default value of this Registry key is returned, if any.
+ *
+ * @param name Name of value to retrieve.
+ *
+ * @return the data associated with the value.
+ */
+ [System.Security.SecuritySafeCritical] // auto-generated
+ public Object GetValue(String name) {
+ CheckPermission(RegistryInternalCheck.CheckValueReadPermission, name, false, RegistryKeyPermissionCheck.Default);
+ return InternalGetValue(name, null, false, true);
+ }
+
+ /**
+ * Retrieves the specified value. <i>defaultValue</i> is returned if the value doesn't exist.
+ *
+ * Note that <var>name</var> can be null or "", at which point the
+ * unnamed or default value of this Registry key is returned, if any.
+ * The default values for RegistryKeys are OS-dependent. NT doesn't
+ * have them by default, but they can exist and be of any type. On
+ * Win95, the default value is always an empty key of type REG_SZ.
+ * Win98 supports default values of any type, but defaults to REG_SZ.
+ *
+ * @param name Name of value to retrieve.
+ * @param defaultValue Value to return if <i>name</i> doesn't exist.
+ *
+ * @return the data associated with the value.
+ */
+ #if FEATURE_CORECLR
+ [System.Security.SecurityCritical] // auto-generated
+ #else
+ [System.Security.SecuritySafeCritical]
+ #endif
+ public Object GetValue(String name, Object defaultValue) {
+ CheckPermission(RegistryInternalCheck.CheckValueReadPermission, name, false, RegistryKeyPermissionCheck.Default);
+ return InternalGetValue(name, defaultValue, false, true);
+ }
+
+ #if FEATURE_CORECLR
+ [System.Security.SecurityCritical] // auto-generated
+ #else
+ [System.Security.SecuritySafeCritical]
+ #endif
+ [ComVisible(false)]
+ public Object GetValue(String name, Object defaultValue, RegistryValueOptions options) {
+ if( options < RegistryValueOptions.None || options > RegistryValueOptions.DoNotExpandEnvironmentNames) {
+ throw new ArgumentException(Environment.GetResourceString("Arg_EnumIllegalVal", (int)options), "options");
+ }
+ bool doNotExpand = (options == RegistryValueOptions.DoNotExpandEnvironmentNames);
+ CheckPermission(RegistryInternalCheck.CheckValueReadPermission, name, false, RegistryKeyPermissionCheck.Default);
+ return InternalGetValue(name, defaultValue, doNotExpand, true);
+ }
+
+ [System.Security.SecurityCritical] // auto-generated
+ internal Object InternalGetValue(String name, Object defaultValue, bool doNotExpand, bool checkSecurity) {
+ if (checkSecurity) {
+ // Name can be null! It's the most common use of RegQueryValueEx
+ EnsureNotDisposed();
+ }
+
+ Object data = defaultValue;
+ int type = 0;
+ int datasize = 0;
+
+ int ret = Win32Native.RegQueryValueEx(hkey, name, null, ref type, (byte[])null, ref datasize);
+
+ if (ret != 0) {
+ if (IsPerfDataKey()) {
+ int size = 65000;
+ int sizeInput = size;
+
+ int r;
+ byte[] blob = new byte[size];
+ while (Win32Native.ERROR_MORE_DATA == (r = Win32Native.RegQueryValueEx(hkey, name, null, ref type, blob, ref sizeInput))) {
+ if (size == Int32.MaxValue) {
+ // ERROR_MORE_DATA was returned however we cannot increase the buffer size beyond Int32.MaxValue
+ Win32Error(r, name);
+ }
+ else if (size > (Int32.MaxValue / 2)) {
+ // at this point in the loop "size * 2" would cause an overflow
+ size = Int32.MaxValue;
+ }
+ else {
+ size *= 2;
+ }
+ sizeInput = size;
+ blob = new byte[size];
+ }
+ if (r != 0)
+ Win32Error(r, name);
+ return blob;
+ }
+ else {
+ // For stuff like ERROR_FILE_NOT_FOUND, we want to return null (data).
+ // Some OS's returned ERROR_MORE_DATA even in success cases, so we
+ // want to continue on through the function.
+ if (ret != Win32Native.ERROR_MORE_DATA)
+ return data;
+ }
+ }
+
+ if (datasize < 0) {
+ // unexpected code path
+ BCLDebug.Assert(false, "[InternalGetValue] RegQueryValue returned ERROR_SUCCESS but gave a negative datasize");
+ datasize = 0;
+ }
+
+
+ switch (type) {
+ case Win32Native.REG_NONE:
+ case Win32Native.REG_DWORD_BIG_ENDIAN:
+ case Win32Native.REG_BINARY: {
+ byte[] blob = new byte[datasize];
+ ret = Win32Native.RegQueryValueEx(hkey, name, null, ref type, blob, ref datasize);
+ data = blob;
+ }
+ break;
+ case Win32Native.REG_QWORD:
+ { // also REG_QWORD_LITTLE_ENDIAN
+ if (datasize > 8) {
+ // prevent an AV in the edge case that datasize is larger than sizeof(long)
+ goto case Win32Native.REG_BINARY;
+ }
+ long blob = 0;
+ BCLDebug.Assert(datasize==8, "datasize==8");
+ // Here, datasize must be 8 when calling this
+ ret = Win32Native.RegQueryValueEx(hkey, name, null, ref type, ref blob, ref datasize);
+
+ data = blob;
+ }
+ break;
+ case Win32Native.REG_DWORD:
+ { // also REG_DWORD_LITTLE_ENDIAN
+ if (datasize > 4) {
+ // prevent an AV in the edge case that datasize is larger than sizeof(int)
+ goto case Win32Native.REG_QWORD;
+ }
+ int blob = 0;
+ BCLDebug.Assert(datasize==4, "datasize==4");
+ // Here, datasize must be four when calling this
+ ret = Win32Native.RegQueryValueEx(hkey, name, null, ref type, ref blob, ref datasize);
+
+ data = blob;
+ }
+ break;
+
+ case Win32Native.REG_SZ:
+ {
+ if (datasize % 2 == 1) {
+ // handle the case where the registry contains an odd-byte length (corrupt data?)
+ try {
+ datasize = checked(datasize + 1);
+ }
+ catch (OverflowException e) {
+ throw new IOException(Environment.GetResourceString("Arg_RegGetOverflowBug"), e);
+ }
+ }
+ char[] blob = new char[datasize/2];
+
+ ret = Win32Native.RegQueryValueEx(hkey, name, null, ref type, blob, ref datasize);
+ if (blob.Length > 0 && blob[blob.Length - 1] == (char)0) {
+ data = new String(blob, 0, blob.Length - 1);
+ }
+ else {
+ // in the very unlikely case the data is missing null termination,
+ // pass in the whole char[] to prevent truncating a character
+ data = new String(blob);
+ }
+ }
+ break;
+
+ case Win32Native.REG_EXPAND_SZ:
+ {
+ if (datasize % 2 == 1) {
+ // handle the case where the registry contains an odd-byte length (corrupt data?)
+ try {
+ datasize = checked(datasize + 1);
+ }
+ catch (OverflowException e) {
+ throw new IOException(Environment.GetResourceString("Arg_RegGetOverflowBug"), e);
+ }
+ }
+ char[] blob = new char[datasize/2];
+
+ ret = Win32Native.RegQueryValueEx(hkey, name, null, ref type, blob, ref datasize);
+
+ if (blob.Length > 0 && blob[blob.Length - 1] == (char)0) {
+ data = new String(blob, 0, blob.Length - 1);
+ }
+ else {
+ // in the very unlikely case the data is missing null termination,
+ // pass in the whole char[] to prevent truncating a character
+ data = new String(blob);
+ }
+
+ if (!doNotExpand)
+ data = Environment.ExpandEnvironmentVariables((String)data);
+ }
+ break;
+ case Win32Native.REG_MULTI_SZ:
+ {
+ if (datasize % 2 == 1) {
+ // handle the case where the registry contains an odd-byte length (corrupt data?)
+ try {
+ datasize = checked(datasize + 1);
+ }
+ catch (OverflowException e) {
+ throw new IOException(Environment.GetResourceString("Arg_RegGetOverflowBug"), e);
+ }
+ }
+ char[] blob = new char[datasize/2];
+
+ ret = Win32Native.RegQueryValueEx(hkey, name, null, ref type, blob, ref datasize);
+
+ // make sure the string is null terminated before processing the data
+ if (blob.Length > 0 && blob[blob.Length - 1] != (char)0) {
+ try {
+ char[] newBlob = new char[checked(blob.Length + 1)];
+ for (int i = 0; i < blob.Length; i++) {
+ newBlob[i] = blob[i];
+ }
+ newBlob[newBlob.Length - 1] = (char)0;
+ blob = newBlob;
+ }
+ catch (OverflowException e) {
+ throw new IOException(Environment.GetResourceString("Arg_RegGetOverflowBug"), e);
+ }
+ blob[blob.Length - 1] = (char)0;
+ }
+
+
+ IList<String> strings = new List<String>();
+ int cur = 0;
+ int len = blob.Length;
+
+ while (ret == 0 && cur < len) {
+ int nextNull = cur;
+ while (nextNull < len && blob[nextNull] != (char)0) {
+ nextNull++;
+ }
+
+ if (nextNull < len) {
+ BCLDebug.Assert(blob[nextNull] == (char)0, "blob[nextNull] should be 0");
+ if (nextNull-cur > 0) {
+ strings.Add(new String(blob, cur, nextNull-cur));
+ }
+ else {
+ // we found an empty string. But if we're at the end of the data,
+ // it's just the extra null terminator.
+ if (nextNull != len-1)
+ strings.Add(String.Empty);
+ }
+ }
+ else {
+ strings.Add(new String(blob, cur, len-cur));
+ }
+ cur = nextNull+1;
+ }
+
+ data = new String[strings.Count];
+ strings.CopyTo((String[])data, 0);
+ }
+ break;
+ case Win32Native.REG_LINK:
+ default:
+ break;
+ }
+
+ return data;
+ }
+
+
+ [System.Security.SecuritySafeCritical] // auto-generated
+ [ComVisible(false)]
+ public RegistryValueKind GetValueKind(string name) {
+ CheckPermission(RegistryInternalCheck.CheckValueReadPermission, name, false, RegistryKeyPermissionCheck.Default);
+ EnsureNotDisposed();
+
+ int type = 0;
+ int datasize = 0;
+ int ret = Win32Native.RegQueryValueEx(hkey, name, null, ref type, (byte[])null, ref datasize);
+ if (ret != 0)
+ Win32Error(ret, null);
+ if (type == Win32Native.REG_NONE)
+ return RegistryValueKind.None;
+ else if (!Enum.IsDefined(typeof(RegistryValueKind), type))
+ return RegistryValueKind.Unknown;
+ else
+ return (RegistryValueKind) type;
+ }
+
+ /**
+ * Retrieves the current state of the dirty property.
+ *
+ * A key is marked as dirty if any operation has occurred that modifies the
+ * contents of the key.
+ *
+ * @return <b>true</b> if the key has been modified.
+ */
+ private bool IsDirty() {
+ return (this.state & STATE_DIRTY) != 0;
+ }
+
+ private bool IsSystemKey() {
+ return (this.state & STATE_SYSTEMKEY) != 0;
+ }
+
+ private bool IsWritable() {
+ return (this.state & STATE_WRITEACCESS) != 0;
+ }
+
+ private bool IsPerfDataKey() {
+ return (this.state & STATE_PERF_DATA) != 0;
+ }
+
+ public String Name {
+ [System.Security.SecuritySafeCritical] // auto-generated
+ get {
+ EnsureNotDisposed();
+ return keyName;
+ }
+ }
+
+ private void SetDirty() {
+ this.state |= STATE_DIRTY;
+ }
+
+ /**
+ * Sets the specified value.
+ *
+ * @param name Name of value to store data in.
+ * @param value Data to store.
+ */
+ public void SetValue(String name, Object value) {
+ SetValue(name, value, RegistryValueKind.Unknown);
+ }
+
+ [System.Security.SecuritySafeCritical] //auto-generated
+ [ComVisible(false)]
+ public unsafe void SetValue(String name, Object value, RegistryValueKind valueKind) {
+ if (value==null)
+ ThrowHelper.ThrowArgumentNullException(ExceptionArgument.value);
+
+ if (name != null && name.Length > MaxValueLength) {
+ throw new ArgumentException(Environment.GetResourceString("Arg_RegValStrLenBug"));
+ }
+
+ if (!Enum.IsDefined(typeof(RegistryValueKind), valueKind))
+ throw new ArgumentException(Environment.GetResourceString("Arg_RegBadKeyKind"), "valueKind");
+
+ EnsureWriteable();
+
+ if (!remoteKey && ContainsRegistryValue(name)) { // Existing key
+ CheckPermission(RegistryInternalCheck.CheckValueWritePermission, name, false, RegistryKeyPermissionCheck.Default);
+ }
+ else { // Creating a new value
+ CheckPermission(RegistryInternalCheck.CheckValueCreatePermission, name, false, RegistryKeyPermissionCheck.Default);
+ }
+
+ if (valueKind == RegistryValueKind.Unknown) {
+ // this is to maintain compatibility with the old way of autodetecting the type.
+ // SetValue(string, object) will come through this codepath.
+ valueKind = CalculateValueKind(value);
+ }
+
+ int ret = 0;
+ try {
+ switch (valueKind) {
+ case RegistryValueKind.ExpandString:
+ case RegistryValueKind.String:
+ {
+ String data = value.ToString();
+ ret = Win32Native.RegSetValueEx(hkey,
+ name,
+ 0,
+ valueKind,
+ data,
+ checked(data.Length * 2 + 2));
+ break;
+ }
+
+ case RegistryValueKind.MultiString:
+ {
+ // Other thread might modify the input array after we calculate the buffer length.
+ // Make a copy of the input array to be safe.
+ string[] dataStrings = (string[])(((string[])value).Clone());
+ int sizeInBytes = 0;
+
+ // First determine the size of the array
+ //
+ for (int i=0; i<dataStrings.Length; i++) {
+ if (dataStrings[i] == null) {
+ ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_RegSetStrArrNull);
+ }
+ sizeInBytes = checked(sizeInBytes + (dataStrings[i].Length+1) * 2);
+ }
+ sizeInBytes = checked(sizeInBytes + 2);
+
+ byte[] basePtr = new byte[sizeInBytes];
+ fixed(byte* b = basePtr) {
+ IntPtr currentPtr = new IntPtr( (void *) b);
+
+ // Write out the strings...
+ //
+ for (int i=0; i<dataStrings.Length; i++) {
+ // Assumes that the Strings are always null terminated.
+ String.InternalCopy(dataStrings[i],currentPtr,(checked(dataStrings[i].Length*2)));
+ currentPtr = new IntPtr((long)currentPtr + (checked(dataStrings[i].Length*2)));
+ *(char*)(currentPtr.ToPointer()) = '\0';
+ currentPtr = new IntPtr((long)currentPtr + 2);
+ }
+
+ *(char*)(currentPtr.ToPointer()) = '\0';
+ currentPtr = new IntPtr((long)currentPtr + 2);
+
+ ret = Win32Native.RegSetValueEx(hkey,
+ name,
+ 0,
+ RegistryValueKind.MultiString,
+ basePtr,
+ sizeInBytes);
+ }
+ break;
+ }
+
+ case RegistryValueKind.None:
+ case RegistryValueKind.Binary:
+ byte[] dataBytes = (byte[]) value;
+ ret = Win32Native.RegSetValueEx(hkey,
+ name,
+ 0,
+ (valueKind == RegistryValueKind.None ? Win32Native.REG_NONE: RegistryValueKind.Binary),
+ dataBytes,
+ dataBytes.Length);
+ break;
+
+ case RegistryValueKind.DWord:
+ {
+ // We need to use Convert here because we could have a boxed type cannot be
+ // unboxed and cast at the same time. I.e. ((int)(object)(short) 5) will fail.
+ int data = Convert.ToInt32(value, System.Globalization.CultureInfo.InvariantCulture);
+
+ ret = Win32Native.RegSetValueEx(hkey,
+ name,
+ 0,
+ RegistryValueKind.DWord,
+ ref data,
+ 4);
+ break;
+ }
+
+ case RegistryValueKind.QWord:
+ {
+ long data = Convert.ToInt64(value, System.Globalization.CultureInfo.InvariantCulture);
+
+ ret = Win32Native.RegSetValueEx(hkey,
+ name,
+ 0,
+ RegistryValueKind.QWord,
+ ref data,
+ 8);
+ break;
+ }
+ }
+ }
+ catch (OverflowException) {
+ ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_RegSetMismatchedKind);
+ }
+ catch (InvalidOperationException) {
+ ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_RegSetMismatchedKind);
+ }
+ catch (FormatException) {
+ ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_RegSetMismatchedKind);
+ }
+ catch (InvalidCastException) {
+ ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_RegSetMismatchedKind);
+ }
+
+ if (ret == 0) {
+ SetDirty();
+ }
+ else
+ Win32Error(ret, null);
+
+ }
+
+ private RegistryValueKind CalculateValueKind(Object value) {
+ // This logic matches what used to be in SetValue(string name, object value) in the v1.0 and v1.1 days.
+ // Even though we could add detection for an int64 in here, we want to maintain compatibility with the
+ // old behavior.
+ if (value is Int32)
+ return RegistryValueKind.DWord;
+ else if (value is Array) {
+ if (value is byte[])
+ return RegistryValueKind.Binary;
+ else if (value is String[])
+ return RegistryValueKind.MultiString;
+ else
+ throw new ArgumentException(Environment.GetResourceString("Arg_RegSetBadArrType", value.GetType().Name));
+ }
+ else
+ return RegistryValueKind.String;
+ }
+
+ /**
+ * Retrieves a string representation of this key.
+ *
+ * @return a string representing the key.
+ */
+ [System.Security.SecuritySafeCritical] // auto-generated
+ public override String ToString() {
+ EnsureNotDisposed();
+ return keyName;
+ }
+
+#if FEATURE_MACL
+ public RegistrySecurity GetAccessControl() {
+ return GetAccessControl(AccessControlSections.Access | AccessControlSections.Owner | AccessControlSections.Group);
+ }
+
+ [System.Security.SecuritySafeCritical] // auto-generated
+ public RegistrySecurity GetAccessControl(AccessControlSections includeSections) {
+ EnsureNotDisposed();
+ return new RegistrySecurity(hkey, keyName, includeSections);
+ }
+
+ [System.Security.SecuritySafeCritical] // auto-generated
+ public void SetAccessControl(RegistrySecurity registrySecurity) {
+ EnsureWriteable();
+ if (registrySecurity == null)
+ throw new ArgumentNullException("registrySecurity");
+
+ registrySecurity.Persist(hkey, keyName);
+ }
+#endif
+
+ /**
+ * After calling GetLastWin32Error(), it clears the last error field,
+ * so you must save the HResult and pass it to this method. This method
+ * will determine the appropriate exception to throw dependent on your
+ * error, and depending on the error, insert a string into the message
+ * gotten from the ResourceManager.
+ */
+ [System.Security.SecuritySafeCritical] // auto-generated
+ internal void Win32Error(int errorCode, String str) {
+ switch (errorCode) {
+ case Win32Native.ERROR_ACCESS_DENIED:
+ if (str != null)
+ throw new UnauthorizedAccessException(Environment.GetResourceString("UnauthorizedAccess_RegistryKeyGeneric_Key", str));
+ else
+ throw new UnauthorizedAccessException();
+
+ case Win32Native.ERROR_INVALID_HANDLE:
+ /**
+ * For normal RegistryKey instances we dispose the SafeRegHandle and throw IOException.
+ * However, for HKEY_PERFORMANCE_DATA (on a local or remote machine) we avoid disposing the
+ * SafeRegHandle and only throw the IOException. This is to workaround reentrancy issues
+ * in PerformanceCounter.NextValue() where the API could throw {NullReference, ObjectDisposed, ArgumentNull}Exception
+ * on reentrant calls because of this error code path in RegistryKey
+ *
+ * Normally we'd make our caller synchronize access to a shared RegistryKey instead of doing something like this,
+ * however we shipped PerformanceCounter.NextValue() un-synchronized in v2.0RTM and customers have taken a dependency on
+ * this behavior (being able to simultaneously query multiple remote-machine counters on multiple threads, instead of
+ * having serialized access).
+ */
+ if (!IsPerfDataKey()) {
+ this.hkey.SetHandleAsInvalid();
+ this.hkey = null;
+ }
+ goto default;
+
+ case Win32Native.ERROR_FILE_NOT_FOUND:
+ throw new IOException(Environment.GetResourceString("Arg_RegKeyNotFound"), errorCode);
+
+ default:
+ throw new IOException(Win32Native.GetMessage(errorCode), errorCode);
+ }
+ }
+
+ [SecuritySafeCritical]
+ internal static void Win32ErrorStatic(int errorCode, String str) {
+ switch (errorCode) {
+ case Win32Native.ERROR_ACCESS_DENIED:
+ if (str != null)
+ throw new UnauthorizedAccessException(Environment.GetResourceString("UnauthorizedAccess_RegistryKeyGeneric_Key", str));
+ else
+ throw new UnauthorizedAccessException();
+
+ default:
+ throw new IOException(Win32Native.GetMessage(errorCode), errorCode);
+ }
+ }
+
+ internal static String FixupName(String name)
+ {
+ BCLDebug.Assert(name!=null,"[FixupName]name!=null");
+ if (name.IndexOf('\\') == -1)
+ return name;
+
+ StringBuilder sb = new StringBuilder(name);
+ FixupPath(sb);
+ int temp = sb.Length - 1;
+ if (temp >= 0 && sb[temp] == '\\') // Remove trailing slash
+ sb.Length = temp;
+ return sb.ToString();
+ }
+
+
+ private static void FixupPath(StringBuilder path)
+ {
+ Contract.Requires(path != null);
+ int length = path.Length;
+ bool fixup = false;
+ char markerChar = (char)0xFFFF;
+
+ int i = 1;
+ while (i < length - 1)
+ {
+ if (path[i] == '\\')
+ {
+ i++;
+ while (i < length)
+ {
+ if (path[i] == '\\')
+ {
+ path[i] = markerChar;
+ i++;
+ fixup = true;
+ }
+ else
+ break;
+ }
+
+ }
+ i++;
+ }
+
+ if (fixup)
+ {
+ i = 0;
+ int j = 0;
+ while (i < length)
+ {
+ if(path[i] == markerChar)
+ {
+ i++;
+ continue;
+ }
+ path[j] = path[i];
+ i++;
+ j++;
+ }
+ path.Length += j - i;
+ }
+
+ }
+
+ //
+ // Read/Write/Create SubKey Permission
+ //
+ private void GetSubKeyReadPermission(string subkeyName, out RegistryPermissionAccess access, out string path) {
+ access = RegistryPermissionAccess.Read;
+ path = keyName + "\\" + subkeyName + "\\.";
+ }
+ private void GetSubKeyWritePermission(string subkeyName, out RegistryPermissionAccess access, out string path) {
+ // If we want to open a subkey of a read-only key as writeable, we need to do the check.
+ access = RegistryPermissionAccess.Write;
+ path = keyName + "\\" + subkeyName + "\\.";
+ }
+ private void GetSubKeyCreatePermission(string subkeyName, out RegistryPermissionAccess access, out string path) {
+ access = RegistryPermissionAccess.Create;
+ path = keyName + "\\" + subkeyName + "\\.";
+ }
+
+ //
+ // Read/Write/ReadWrite SubTree Permission
+ //
+ private void GetSubTreeReadPermission(string subkeyName, out RegistryPermissionAccess access, out string path) {
+ access = RegistryPermissionAccess.Read;
+ path = keyName + "\\" + subkeyName + "\\";
+ }
+ private void GetSubTreeWritePermission(string subkeyName, out RegistryPermissionAccess access, out string path) {
+ access = RegistryPermissionAccess.Write;
+ path = keyName + "\\" + subkeyName + "\\";
+ }
+ private void GetSubTreeReadWritePermission(string subkeyName, out RegistryPermissionAccess access, out string path) {
+ access = RegistryPermissionAccess.Write | RegistryPermissionAccess.Read;
+ path = keyName + "\\" + subkeyName;
+ }
+
+ //
+ // Read/Write/Create Value Permission
+ //
+ private void GetValueReadPermission(string valueName, out RegistryPermissionAccess access, out string path) {
+ access = RegistryPermissionAccess.Read;
+ path = keyName+"\\"+valueName;
+ }
+ private void GetValueWritePermission(string valueName, out RegistryPermissionAccess access, out string path) {
+ access = RegistryPermissionAccess.Write;
+ path = keyName+"\\"+valueName;
+ }
+ private void GetValueCreatePermission(string valueName, out RegistryPermissionAccess access, out string path) {
+ access = RegistryPermissionAccess.Create;
+ path = keyName+"\\"+valueName;
+ }
+
+ // Read Key Permission
+ private void GetKeyReadPermission(out RegistryPermissionAccess access, out string path) {
+ access = RegistryPermissionAccess.Read;
+ path = keyName + "\\.";
+ }
+
+ [System.Security.SecurityCritical] // auto-generated
+ private void CheckPermission(RegistryInternalCheck check, string item, bool subKeyWritable, RegistryKeyPermissionCheck subKeyCheck) {
+ bool demand = false;
+ RegistryPermissionAccess access = RegistryPermissionAccess.NoAccess;
+ string path = null;
+
+#if !FEATURE_CORECLR
+ if (CodeAccessSecurityEngine.QuickCheckForAllDemands()) {
+ return; // full trust fast path
+ }
+#endif // !FEATURE_CORECLR
+
+ switch (check) {
+ //
+ // Read/Write/Create SubKey Permission
+ //
+ case RegistryInternalCheck.CheckSubKeyReadPermission:
+ if (remoteKey) {
+ CheckUnmanagedCodePermission();
+ }
+ else {
+ BCLDebug.Assert(checkMode == RegistryKeyPermissionCheck.Default, "Should be called from a key opened under default mode only!");
+ BCLDebug.Assert(subKeyWritable == false, "subKeyWritable should be false (unused)");
+ BCLDebug.Assert(subKeyCheck == RegistryKeyPermissionCheck.Default, "subKeyCheck should be Default (unused)");
+ demand = true;
+ GetSubKeyReadPermission(item, out access, out path);
+ }
+ break;
+ case RegistryInternalCheck.CheckSubKeyWritePermission:
+ if (remoteKey) {
+ CheckUnmanagedCodePermission();
+ }
+ else {
+ BCLDebug.Assert(checkMode != RegistryKeyPermissionCheck.ReadSubTree, "We shouldn't allow creating sub key under read-only key!");
+ BCLDebug.Assert(subKeyWritable == false, "subKeyWritable should be false (unused)");
+ BCLDebug.Assert(subKeyCheck == RegistryKeyPermissionCheck.Default, "subKeyCheck should be Default (unused)");
+ if( checkMode == RegistryKeyPermissionCheck.Default) {
+ demand = true;
+ GetSubKeyWritePermission(item, out access, out path);
+ }
+ }
+ break;
+ case RegistryInternalCheck.CheckSubKeyCreatePermission:
+ if (remoteKey) {
+ CheckUnmanagedCodePermission();
+ }
+ else {
+ BCLDebug.Assert(checkMode != RegistryKeyPermissionCheck.ReadSubTree, "We shouldn't allow creating sub key under read-only key!");
+ BCLDebug.Assert(subKeyWritable == false, "subKeyWritable should be false (unused)");
+ BCLDebug.Assert(subKeyCheck == RegistryKeyPermissionCheck.Default, "subKeyCheck should be Default (unused)");
+ if( checkMode == RegistryKeyPermissionCheck.Default) {
+ demand = true;
+ GetSubKeyCreatePermission(item, out access, out path);
+ }
+ }
+ break;
+ //
+ // Read/Write/ReadWrite SubTree Permission
+ //
+ case RegistryInternalCheck.CheckSubTreeReadPermission:
+ if (remoteKey) {
+ CheckUnmanagedCodePermission();
+ }
+ else {
+ BCLDebug.Assert(subKeyWritable == false, "subKeyWritable should be false (unused)");
+ BCLDebug.Assert(subKeyCheck == RegistryKeyPermissionCheck.Default, "subKeyCheck should be Default (unused)");
+ if( checkMode == RegistryKeyPermissionCheck.Default) {
+ demand = true;
+ GetSubTreeReadPermission(item, out access, out path);
+ }
+ }
+ break;
+ case RegistryInternalCheck.CheckSubTreeWritePermission:
+ if (remoteKey) {
+ CheckUnmanagedCodePermission();
+ }
+ else {
+ BCLDebug.Assert(checkMode != RegistryKeyPermissionCheck.ReadSubTree, "We shouldn't allow writing value to read-only key!");
+ BCLDebug.Assert(subKeyWritable == false, "subKeyWritable should be false (unused)");
+ BCLDebug.Assert(subKeyCheck == RegistryKeyPermissionCheck.Default, "subKeyCheck should be Default (unused)");
+ if( checkMode == RegistryKeyPermissionCheck.Default) {
+ demand = true;
+ GetSubTreeWritePermission(item, out access, out path);
+ }
+ }
+ break;
+ case RegistryInternalCheck.CheckSubTreeReadWritePermission:
+ if (remoteKey) {
+ CheckUnmanagedCodePermission();
+ }
+ else {
+ BCLDebug.Assert(subKeyWritable == false, "subKeyWritable should be false (unused)");
+ BCLDebug.Assert(subKeyCheck == RegistryKeyPermissionCheck.Default, "subKeyCheck should be Default (unused)");
+ // If we want to open a subkey of a read-only key as writeable, we need to do the check.
+ demand = true;
+ GetSubTreeReadWritePermission(item, out access, out path);
+ }
+ break;
+ //
+ // Read/Write/Create Value Permission
+ //
+ case RegistryInternalCheck.CheckValueReadPermission:
+ ///*** no remoteKey check ***///
+ BCLDebug.Assert(subKeyWritable == false, "subKeyWritable should be false (unused)");
+ BCLDebug.Assert(subKeyCheck == RegistryKeyPermissionCheck.Default, "subKeyCheck should be Default (unused)");
+ if( checkMode == RegistryKeyPermissionCheck.Default) {
+ // only need to check for default mode (dynamice check)
+ demand = true;
+ GetValueReadPermission(item, out access, out path);
+ }
+ break;
+ case RegistryInternalCheck.CheckValueWritePermission:
+ if (remoteKey) {
+ CheckUnmanagedCodePermission();
+ }
+ else {
+ BCLDebug.Assert(checkMode != RegistryKeyPermissionCheck.ReadSubTree, "We shouldn't allow writing value to read-only key!");
+ BCLDebug.Assert(subKeyWritable == false, "subKeyWritable should be false (unused)");
+ BCLDebug.Assert(subKeyCheck == RegistryKeyPermissionCheck.Default, "subKeyCheck should be Default (unused)");
+ // skip the security check if the key is opened under write mode
+ if( checkMode == RegistryKeyPermissionCheck.Default) {
+ demand = true;
+ GetValueWritePermission(item, out access, out path);
+ }
+ }
+ break;
+ case RegistryInternalCheck.CheckValueCreatePermission:
+ if (remoteKey) {
+ CheckUnmanagedCodePermission();
+ }
+ else {
+ BCLDebug.Assert(checkMode != RegistryKeyPermissionCheck.ReadSubTree, "We shouldn't allow creating value under read-only key!");
+ BCLDebug.Assert(subKeyWritable == false, "subKeyWritable should be false (unused)");
+ BCLDebug.Assert(subKeyCheck == RegistryKeyPermissionCheck.Default, "subKeyCheck should be Default (unused)");
+ // skip the security check if the key is opened under write mode
+ if( checkMode == RegistryKeyPermissionCheck.Default) {
+ demand = true;
+ GetValueCreatePermission(item, out access, out path);
+ }
+ }
+ break;
+ //
+ // CheckKeyReadPermission
+ //
+ case RegistryInternalCheck.CheckKeyReadPermission:
+ ///*** no remoteKey check ***///
+ if( checkMode == RegistryKeyPermissionCheck.Default) {
+ BCLDebug.Assert(item == null, "CheckKeyReadPermission should never have a non-null item parameter!");
+ BCLDebug.Assert(subKeyWritable == false, "subKeyWritable should be false (unused)");
+ BCLDebug.Assert(subKeyCheck == RegistryKeyPermissionCheck.Default, "subKeyCheck should be Default (unused)");
+
+ // only need to check for default mode (dynamice check)
+ demand = true;
+ GetKeyReadPermission(out access, out path);
+ }
+ break;
+ //
+ // CheckSubTreePermission
+ //
+ case RegistryInternalCheck.CheckSubTreePermission:
+ BCLDebug.Assert(subKeyWritable == false, "subKeyWritable should be false (unused)");
+ if( subKeyCheck == RegistryKeyPermissionCheck.ReadSubTree) {
+ if( checkMode == RegistryKeyPermissionCheck.Default) {
+ if( remoteKey) {
+ CheckUnmanagedCodePermission();
+ }
+ else {
+ demand = true;
+ GetSubTreeReadPermission(item, out access, out path);
+ }
+ }
+ }
+ else if(subKeyCheck == RegistryKeyPermissionCheck.ReadWriteSubTree) {
+ if( checkMode != RegistryKeyPermissionCheck.ReadWriteSubTree) {
+ if( remoteKey) {
+ CheckUnmanagedCodePermission();
+ }
+ else {
+ demand = true;
+ GetSubTreeReadWritePermission(item, out access, out path);
+ }
+ }
+ }
+ break;
+
+ //
+ // CheckOpenSubKeyWithWritablePermission uses the 'subKeyWritable' parameter
+ //
+ case RegistryInternalCheck.CheckOpenSubKeyWithWritablePermission:
+ BCLDebug.Assert(subKeyCheck == RegistryKeyPermissionCheck.Default, "subKeyCheck should be Default (unused)");
+ // If the parent key is not opened under default mode, we have access already.
+ // If the parent key is opened under default mode, we need to check for permission.
+ if(checkMode == RegistryKeyPermissionCheck.Default) {
+ if( remoteKey) {
+ CheckUnmanagedCodePermission();
+ }
+ else {
+ demand = true;
+ GetSubKeyReadPermission(item, out access, out path);
+ }
+ break;
+ }
+ if( subKeyWritable && (checkMode == RegistryKeyPermissionCheck.ReadSubTree)) {
+ if( remoteKey) {
+ CheckUnmanagedCodePermission();
+ }
+ else {
+ demand = true;
+ GetSubTreeReadWritePermission(item, out access, out path);
+ }
+ break;
+ }
+ break;
+
+ //
+ // CheckOpenSubKeyPermission uses the 'subKeyCheck' parameter
+ //
+ case RegistryInternalCheck.CheckOpenSubKeyPermission:
+ BCLDebug.Assert(subKeyWritable == false, "subKeyWritable should be false (unused)");
+ if(subKeyCheck == RegistryKeyPermissionCheck.Default) {
+ if( checkMode == RegistryKeyPermissionCheck.Default) {
+ if(remoteKey) {
+ CheckUnmanagedCodePermission();
+ }
+ else {
+ demand = true;
+ GetSubKeyReadPermission(item, out access, out path);
+ }
+ }
+ }
+ break;
+
+ default:
+ BCLDebug.Assert(false, "CheckPermission default switch case should never be hit!");
+ break;
+ }
+
+ if (demand) {
+ new RegistryPermission(access, path).Demand();
+ }
+ }
+
+ [System.Security.SecurityCritical] // auto-generated
+ static private void CheckUnmanagedCodePermission() {
+#pragma warning disable 618
+ new SecurityPermission(SecurityPermissionFlag.UnmanagedCode).Demand();
+#pragma warning restore 618
+ }
+
+ [System.Security.SecurityCritical] // auto-generated
+ private bool ContainsRegistryValue(string name) {
+ int type = 0;
+ int datasize = 0;
+ int retval = Win32Native.RegQueryValueEx(hkey, name, null, ref type, (byte[])null, ref datasize);
+ return retval == 0;
+ }
+
+ [System.Security.SecurityCritical] // auto-generated
+ private void EnsureNotDisposed(){
+ if (hkey == null) {
+ ThrowHelper.ThrowObjectDisposedException(keyName, ExceptionResource.ObjectDisposed_RegKeyClosed);
+ }
+ }
+
+ [System.Security.SecurityCritical] // auto-generated
+ private void EnsureWriteable() {
+ EnsureNotDisposed();
+ if (!IsWritable()) {
+ ThrowHelper.ThrowUnauthorizedAccessException(ExceptionResource.UnauthorizedAccess_RegistryNoWrite);
+ }
+ }
+
+ static int GetRegistryKeyAccess(bool isWritable) {
+ int winAccess;
+ if (!isWritable) {
+ winAccess = Win32Native.KEY_READ;
+ }
+ else {
+ winAccess = Win32Native.KEY_READ | Win32Native.KEY_WRITE;
+ }
+
+ return winAccess;
+ }
+
+ static int GetRegistryKeyAccess(RegistryKeyPermissionCheck mode) {
+ int winAccess = 0;
+ switch(mode) {
+ case RegistryKeyPermissionCheck.ReadSubTree:
+ case RegistryKeyPermissionCheck.Default:
+ winAccess = Win32Native.KEY_READ;
+ break;
+
+ case RegistryKeyPermissionCheck.ReadWriteSubTree:
+ winAccess = Win32Native.KEY_READ| Win32Native.KEY_WRITE;
+ break;
+
+ default:
+ BCLDebug.Assert(false, "unexpected code path");
+ break;
+ }
+
+ return winAccess;
+ }
+
+ private RegistryKeyPermissionCheck GetSubKeyPermissonCheck(bool subkeyWritable) {
+ if( checkMode == RegistryKeyPermissionCheck.Default) {
+ return checkMode;
+ }
+
+ if(subkeyWritable) {
+ return RegistryKeyPermissionCheck.ReadWriteSubTree;
+ }
+ else {
+ return RegistryKeyPermissionCheck.ReadSubTree;
+ }
+ }
+
+ static private void ValidateKeyName(string name) {
+ Contract.Ensures(name != null);
+ if (name == null) {
+ ThrowHelper.ThrowArgumentNullException(ExceptionArgument.name);
+ }
+
+ int nextSlash = name.IndexOf("\\", StringComparison.OrdinalIgnoreCase);
+ int current = 0;
+ while (nextSlash != -1) {
+ if ((nextSlash - current) > MaxKeyLength)
+ ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_RegKeyStrLenBug);
+
+ current = nextSlash + 1;
+ nextSlash = name.IndexOf("\\", current, StringComparison.OrdinalIgnoreCase);
+ }
+
+ if ((name.Length - current) > MaxKeyLength)
+ ThrowHelper.ThrowArgumentException(ExceptionResource.Arg_RegKeyStrLenBug);
+
+ }
+
+ static private void ValidateKeyMode(RegistryKeyPermissionCheck mode) {
+ if( mode < RegistryKeyPermissionCheck.Default || mode > RegistryKeyPermissionCheck.ReadWriteSubTree) {
+ ThrowHelper.ThrowArgumentException(ExceptionResource.Argument_InvalidRegistryKeyPermissionCheck, ExceptionArgument.mode);
+ }
+ }
+
+ static private void ValidateKeyOptions(RegistryOptions options) {
+ if (options < RegistryOptions.None || options > RegistryOptions.Volatile) {
+ ThrowHelper.ThrowArgumentException(ExceptionResource.Argument_InvalidRegistryOptionsCheck, ExceptionArgument.options);
+ }
+ }
+
+ static private void ValidateKeyView(RegistryView view) {
+ if (view != RegistryView.Default && view != RegistryView.Registry32 && view != RegistryView.Registry64) {
+ ThrowHelper.ThrowArgumentException(ExceptionResource.Argument_InvalidRegistryViewCheck, ExceptionArgument.view);
+ }
+ }
+
+
+#if FEATURE_MACL
+ static private void ValidateKeyRights(int rights) {
+ if(0 != (rights & ~((int)RegistryRights.FullControl))) {
+ // We need to throw SecurityException here for compatiblity reason,
+ // although UnauthorizedAccessException will make more sense.
+ ThrowHelper.ThrowSecurityException(ExceptionResource.Security_RegistryPermission);
+ }
+ }
+#endif
+ // Win32 constants for error handling
+ private const int FORMAT_MESSAGE_IGNORE_INSERTS = 0x00000200;
+ private const int FORMAT_MESSAGE_FROM_SYSTEM = 0x00001000;
+ private const int FORMAT_MESSAGE_ARGUMENT_ARRAY = 0x00002000;
+ }
+
+ [Flags]
+ public enum RegistryValueOptions {
+ None = 0,
+ DoNotExpandEnvironmentNames = 1
+ }
+
+ // the name for this API is meant to mimic FileMode, which has similar values
+
+ public enum RegistryKeyPermissionCheck {
+ Default = 0,
+ ReadSubTree = 1,
+ ReadWriteSubTree = 2
+ }
+}
diff --git a/src/mscorlib/src/Microsoft/Win32/RegistryOptions.cs b/src/mscorlib/src/Microsoft/Win32/RegistryOptions.cs
new file mode 100644
index 0000000..4d5e3aa
--- /dev/null
+++ b/src/mscorlib/src/Microsoft/Win32/RegistryOptions.cs
@@ -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.
+
+//
+//
+//
+// Implements Microsoft.Win32.RegistryOptions
+//
+// ======================================================================================
+namespace Microsoft.Win32 {
+ using System;
+
+ [Flags]
+ public enum RegistryOptions {
+ None = Win32Native.REG_OPTION_NON_VOLATILE, // 0x0000
+ Volatile = Win32Native.REG_OPTION_VOLATILE, // 0x0001
+///
+/// Consider exposing more options in a future release. Users can access this
+/// functionality by calling [RegistryKey].Handle and pinvoking
+///
+/// CreateLink = Win32Native.REG_OPTION_CREATE_LINK, // 0x0002
+/// BackupRestore = Win32Native.REG_OPTION_BACKUP_RESTORE,// 0x0004
+ };
+}
diff --git a/src/mscorlib/src/Microsoft/Win32/RegistryValueKind.cs b/src/mscorlib/src/Microsoft/Win32/RegistryValueKind.cs
new file mode 100644
index 0000000..c88d5f9
--- /dev/null
+++ b/src/mscorlib/src/Microsoft/Win32/RegistryValueKind.cs
@@ -0,0 +1,20 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+
+namespace Microsoft.Win32 {
+[System.Runtime.InteropServices.ComVisible(true)]
+ public enum RegistryValueKind {
+ String = Win32Native.REG_SZ,
+ ExpandString = Win32Native.REG_EXPAND_SZ,
+ Binary = Win32Native.REG_BINARY,
+ DWord = Win32Native.REG_DWORD,
+ MultiString = Win32Native.REG_MULTI_SZ,
+ QWord = Win32Native.REG_QWORD,
+ Unknown = 0, // REG_NONE is defined as zero but BCL
+ [System.Runtime.InteropServices.ComVisible(false)]
+ None = unchecked((int)0xFFFFFFFF), // mistakingly overrode this value.
+ } // Now instead of using Win32Native.REG_NONE we use "-1" and play games internally.
+}
+
diff --git a/src/mscorlib/src/Microsoft/Win32/RegistryView.cs b/src/mscorlib/src/Microsoft/Win32/RegistryView.cs
new file mode 100644
index 0000000..7fbc2b3
--- /dev/null
+++ b/src/mscorlib/src/Microsoft/Win32/RegistryView.cs
@@ -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.
+
+//
+//
+//
+// Implements Microsoft.Win32.RegistryView
+//
+// ======================================================================================
+namespace Microsoft.Win32 {
+ using System;
+
+ public enum RegistryView {
+ Default = 0, // 0x0000 operate on the default registry view
+ Registry64 = Win32Native.KEY_WOW64_64KEY, // 0x0100 operate on the 64-bit registry view
+ Registry32 = Win32Native.KEY_WOW64_32KEY, // 0x0200 operate on the 32-bit registry view
+ };
+}
diff --git a/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeFileHandle.cs b/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeFileHandle.cs
new file mode 100644
index 0000000..ab06347
--- /dev/null
+++ b/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeFileHandle.cs
@@ -0,0 +1,43 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/*============================================================
+**
+**
+**
+** A wrapper for file handles
+**
+**
+===========================================================*/
+
+using System;
+using System.Security;
+using System.Security.Permissions;
+using System.Runtime.InteropServices;
+using System.Runtime.CompilerServices;
+using System.Runtime.ConstrainedExecution;
+using System.Runtime.Versioning;
+using Microsoft.Win32;
+
+namespace Microsoft.Win32.SafeHandles {
+
+ [System.Security.SecurityCritical] // auto-generated_required
+ public sealed class SafeFileHandle: SafeHandleZeroOrMinusOneIsInvalid {
+
+ private SafeFileHandle() : base(true)
+ {
+ }
+
+ public SafeFileHandle(IntPtr preexistingHandle, bool ownsHandle) : base(ownsHandle) {
+ SetHandle(preexistingHandle);
+ }
+
+ [System.Security.SecurityCritical]
+ override protected bool ReleaseHandle()
+ {
+ return Win32Native.CloseHandle(handle);
+ }
+ }
+}
+
diff --git a/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeFileMappingHandle.cs b/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeFileMappingHandle.cs
new file mode 100644
index 0000000..5e1b510
--- /dev/null
+++ b/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeFileMappingHandle.cs
@@ -0,0 +1,43 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/*============================================================
+**
+**
+**
+** A wrapper for file handles
+**
+**
+===========================================================*/
+using System;
+using System.Security;
+using System.Security.Permissions;
+using System.Runtime.InteropServices;
+using System.Runtime.CompilerServices;
+using System.Runtime.ConstrainedExecution;
+using System.Runtime.Versioning;
+
+namespace Microsoft.Win32.SafeHandles
+{
+ [System.Security.SecurityCritical] // auto-generated
+ internal sealed class SafeFileMappingHandle : SafeHandleZeroOrMinusOneIsInvalid
+ {
+ [System.Security.SecurityCritical] // auto-generated_required
+ internal SafeFileMappingHandle() : base(true) {}
+
+ // 0 is an Invalid Handle
+ [System.Security.SecurityCritical] // auto-generated_required
+ internal SafeFileMappingHandle(IntPtr handle, bool ownsHandle) : base (ownsHandle)
+ {
+ SetHandle(handle);
+ }
+
+ [System.Security.SecurityCritical]
+ override protected bool ReleaseHandle()
+ {
+ return Win32Native.CloseHandle(handle);
+ }
+ }
+}
+
diff --git a/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeFindHandle.cs b/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeFindHandle.cs
new file mode 100644
index 0000000..b24535f
--- /dev/null
+++ b/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeFindHandle.cs
@@ -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.
+
+/*============================================================
+**
+**
+**
+** A wrapper for find handles
+**
+**
+===========================================================*/
+
+using System;
+using System.Security;
+using System.Security.Permissions;
+using System.Runtime.InteropServices;
+using System.Runtime.CompilerServices;
+using System.Runtime.ConstrainedExecution;
+using Microsoft.Win32;
+
+namespace Microsoft.Win32.SafeHandles {
+ [System.Security.SecurityCritical] // auto-generated
+ internal sealed class SafeFindHandle : SafeHandleZeroOrMinusOneIsInvalid
+ {
+ [System.Security.SecurityCritical] // auto-generated_required
+ internal SafeFindHandle() : base(true) {}
+
+ [System.Security.SecurityCritical]
+ override protected bool ReleaseHandle()
+ {
+ return Win32Native.FindClose(handle);
+ }
+ }
+}
diff --git a/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeLibraryHandle.cs b/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeLibraryHandle.cs
new file mode 100644
index 0000000..d2ea42b
--- /dev/null
+++ b/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeLibraryHandle.cs
@@ -0,0 +1,29 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Microsoft.Win32 {
+ using Microsoft.Win32;
+ using Microsoft.Win32.SafeHandles;
+ using System;
+ using System.Runtime.CompilerServices;
+ using System.Runtime.ConstrainedExecution;
+ using System.Runtime.InteropServices;
+ using System.Runtime.Serialization;
+ using System.Runtime.Versioning;
+ using System.Security;
+ using System.Security.Permissions;
+ using System.Text;
+
+ [System.Security.SecurityCritical] // auto-generated
+ [HostProtectionAttribute(MayLeakOnAbort = true)]
+ sealed internal class SafeLibraryHandle : SafeHandleZeroOrMinusOneIsInvalid {
+ internal SafeLibraryHandle() : base(true) {}
+
+ [System.Security.SecurityCritical]
+ override protected bool ReleaseHandle()
+ {
+ return UnsafeNativeMethods.FreeLibrary(handle);
+ }
+ }
+}
diff --git a/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeLocalAllocHandle.cs b/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeLocalAllocHandle.cs
new file mode 100644
index 0000000..3eea2b9
--- /dev/null
+++ b/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeLocalAllocHandle.cs
@@ -0,0 +1,29 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+namespace Microsoft.Win32.SafeHandles {
+ using System;
+ using System.Runtime.CompilerServices;
+ using System.Runtime.InteropServices;
+ using System.Runtime.ConstrainedExecution;
+
+ [System.Security.SecurityCritical] // auto-generated
+ internal sealed class SafeLocalAllocHandle : SafeBuffer {
+ private SafeLocalAllocHandle () : base(true) {}
+
+ // 0 is an Invalid Handle
+ internal SafeLocalAllocHandle (IntPtr handle) : base (true) {
+ SetHandle(handle);
+ }
+
+ internal static SafeLocalAllocHandle InvalidHandle {
+ get { return new SafeLocalAllocHandle(IntPtr.Zero); }
+ }
+
+ [System.Security.SecurityCritical]
+ override protected bool ReleaseHandle()
+ {
+ return Win32Native.LocalFree(handle) == IntPtr.Zero;
+ }
+ }
+}
diff --git a/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeRegistryHandle.cs b/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeRegistryHandle.cs
new file mode 100644
index 0000000..d0e3f04
--- /dev/null
+++ b/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeRegistryHandle.cs
@@ -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.
+
+//
+//
+//
+// Implements Microsoft.Win32.SafeHandles.SafeRegistryHandle
+//
+// ======================================================================================
+namespace Microsoft.Win32.SafeHandles {
+ using System;
+ using System.Security;
+ using System.Security.Permissions;
+ using System.Runtime.InteropServices;
+ using System.Runtime.CompilerServices;
+ using System.Runtime.ConstrainedExecution;
+ using System.Runtime.Versioning;
+
+ [System.Security.SecurityCritical]
+ public sealed class SafeRegistryHandle : SafeHandleZeroOrMinusOneIsInvalid {
+ [System.Security.SecurityCritical]
+ internal SafeRegistryHandle() : base(true) {}
+
+ [System.Security.SecurityCritical]
+ public SafeRegistryHandle(IntPtr preexistingHandle, bool ownsHandle) : base(ownsHandle) {
+ SetHandle(preexistingHandle);
+ }
+
+ [System.Security.SecurityCritical]
+ override protected bool ReleaseHandle() {
+ return (RegCloseKey(handle) == Win32Native.ERROR_SUCCESS);
+ }
+
+ [DllImport(Win32Native.ADVAPI32)]
+ [SuppressUnmanagedCodeSecurity]
+ [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
+ internal static extern int RegCloseKey(IntPtr hKey);
+ }
+}
+
diff --git a/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeViewOfFileHandle.cs b/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeViewOfFileHandle.cs
new file mode 100644
index 0000000..01ec4d2
--- /dev/null
+++ b/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeViewOfFileHandle.cs
@@ -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.
+
+/*============================================================
+**
+**
+**
+** A wrapper for file handles
+**
+**
+===========================================================*/
+using System;
+using System.Security;
+using System.Security.Permissions;
+using System.Runtime.InteropServices;
+using System.Runtime.CompilerServices;
+using System.Runtime.ConstrainedExecution;
+using System.Runtime.Versioning;
+using Microsoft.Win32;
+using Microsoft.Win32.SafeHandles;
+
+namespace Microsoft.Win32.SafeHandles
+{
+ [System.Security.SecurityCritical] // auto-generated
+ internal sealed class SafeViewOfFileHandle : SafeHandleZeroOrMinusOneIsInvalid
+ {
+ [System.Security.SecurityCritical] // auto-generated_required
+ internal SafeViewOfFileHandle() : base(true) {}
+
+ // 0 is an Invalid Handle
+ [System.Security.SecurityCritical] // auto-generated_required
+ internal SafeViewOfFileHandle(IntPtr handle, bool ownsHandle) : base (ownsHandle) {
+ SetHandle(handle);
+ }
+
+ [System.Security.SecurityCritical]
+ override protected bool ReleaseHandle()
+ {
+ if (Win32Native.UnmapViewOfFile(handle))
+ {
+ handle = IntPtr.Zero;
+ return true;
+ }
+
+ return false;
+ }
+ }
+}
+
diff --git a/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeWaitHandle.cs b/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeWaitHandle.cs
new file mode 100644
index 0000000..fa24c96
--- /dev/null
+++ b/src/mscorlib/src/Microsoft/Win32/SafeHandles/SafeWaitHandle.cs
@@ -0,0 +1,47 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/*============================================================
+**
+**
+**
+** A wrapper for Win32 events (mutexes, auto reset events, and
+** manual reset events). Used by WaitHandle.
+**
+**
+===========================================================*/
+
+using System;
+using System.Security;
+using System.Security.Permissions;
+using System.Runtime.InteropServices;
+using System.Runtime.CompilerServices;
+using System.Runtime.ConstrainedExecution;
+using System.Runtime.Versioning;
+using Microsoft.Win32;
+using System.Threading;
+
+namespace Microsoft.Win32.SafeHandles {
+
+ [System.Security.SecurityCritical] // auto-generated_required
+ public sealed class SafeWaitHandle : SafeHandleZeroOrMinusOneIsInvalid
+ {
+ // Called by P/Invoke marshaler
+ private SafeWaitHandle() : base(true)
+ {
+ }
+
+ [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
+ public SafeWaitHandle(IntPtr existingHandle, bool ownsHandle) : base(ownsHandle)
+ {
+ SetHandle(existingHandle);
+ }
+
+ [System.Security.SecurityCritical]
+ override protected bool ReleaseHandle()
+ {
+ return Win32Native.CloseHandle(handle);
+ }
+ }
+}
diff --git a/src/mscorlib/src/Microsoft/Win32/SafeHandles/Win32SafeHandles.cs b/src/mscorlib/src/Microsoft/Win32/SafeHandles/Win32SafeHandles.cs
new file mode 100644
index 0000000..58e0d7a
--- /dev/null
+++ b/src/mscorlib/src/Microsoft/Win32/SafeHandles/Win32SafeHandles.cs
@@ -0,0 +1,112 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+//
+// Abstract derivations of SafeHandle designed to provide the common
+// functionality supporting Win32 handles. More specifically, they describe how
+// an invalid handle looks (for instance, some handles use -1 as an invalid
+// handle value, others use 0).
+//
+// Further derivations of these classes can specialise this even further (e.g.
+// file or registry handles).
+//
+//
+
+namespace Microsoft.Win32.SafeHandles
+{
+ using System;
+ using System.Runtime.InteropServices;
+ using System.Runtime.CompilerServices;
+ using System.Security.Permissions;
+ using System.Runtime.ConstrainedExecution;
+
+ // Class of safe handle which uses 0 or -1 as an invalid handle.
+ [System.Security.SecurityCritical] // auto-generated_required
+#if !FEATURE_CORECLR
+ [SecurityPermission(SecurityAction.InheritanceDemand, UnmanagedCode=true)]
+#endif
+ public abstract class SafeHandleZeroOrMinusOneIsInvalid : SafeHandle
+ {
+ [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
+ protected SafeHandleZeroOrMinusOneIsInvalid(bool ownsHandle) : base(IntPtr.Zero, ownsHandle)
+ {
+ }
+
+#if FEATURE_CORECLR
+ // A default constructor is needed to satisfy CoreCLR inheritence rules. It should not be called at runtime
+ protected SafeHandleZeroOrMinusOneIsInvalid()
+ {
+ throw new NotImplementedException();
+ }
+#endif // FEATURE_CORECLR
+
+ public override bool IsInvalid {
+ [System.Security.SecurityCritical]
+ get { return handle.IsNull() || handle == new IntPtr(-1); }
+ }
+ }
+
+ // Class of safe handle which uses only -1 as an invalid handle.
+ [System.Security.SecurityCritical] // auto-generated_required
+#if !FEATURE_CORECLR
+ [SecurityPermission(SecurityAction.InheritanceDemand, UnmanagedCode=true)]
+#endif
+ public abstract class SafeHandleMinusOneIsInvalid : SafeHandle
+ {
+ [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
+ protected SafeHandleMinusOneIsInvalid(bool ownsHandle) : base(new IntPtr(-1), ownsHandle)
+ {
+ }
+
+#if FEATURE_CORECLR
+ // A default constructor is needed to satisfy CoreCLR inheritence rules. It should not be called at runtime
+ protected SafeHandleMinusOneIsInvalid()
+ {
+ throw new NotImplementedException();
+ }
+#endif // FEATURE_CORECLR
+
+ public override bool IsInvalid {
+ [System.Security.SecurityCritical]
+ get { return handle == new IntPtr(-1); }
+ }
+ }
+
+ // Class of critical handle which uses 0 or -1 as an invalid handle.
+ [System.Security.SecurityCritical] // auto-generated_required
+#if !FEATURE_CORECLR
+ [SecurityPermission(SecurityAction.InheritanceDemand, UnmanagedCode=true)]
+#endif
+ public abstract class CriticalHandleZeroOrMinusOneIsInvalid : CriticalHandle
+ {
+ [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
+ protected CriticalHandleZeroOrMinusOneIsInvalid() : base(IntPtr.Zero)
+ {
+ }
+
+ public override bool IsInvalid {
+ [System.Security.SecurityCritical]
+ get { return handle.IsNull() || handle == new IntPtr(-1); }
+ }
+ }
+
+ // Class of critical handle which uses only -1 as an invalid handle.
+ [System.Security.SecurityCritical] // auto-generated_required
+#if !FEATURE_CORECLR
+ [SecurityPermission(SecurityAction.InheritanceDemand, UnmanagedCode=true)]
+#endif
+ public abstract class CriticalHandleMinusOneIsInvalid : CriticalHandle
+ {
+ [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
+ protected CriticalHandleMinusOneIsInvalid() : base(new IntPtr(-1))
+ {
+ }
+
+ public override bool IsInvalid {
+ [System.Security.SecurityCritical]
+ get { return handle == new IntPtr(-1); }
+ }
+ }
+
+}
diff --git a/src/mscorlib/src/Microsoft/Win32/UnsafeNativeMethods.cs b/src/mscorlib/src/Microsoft/Win32/UnsafeNativeMethods.cs
new file mode 100644
index 0000000..9da9811
--- /dev/null
+++ b/src/mscorlib/src/Microsoft/Win32/UnsafeNativeMethods.cs
@@ -0,0 +1,282 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+namespace Microsoft.Win32 {
+ using Microsoft.Win32;
+ using Microsoft.Win32.SafeHandles;
+ using System;
+ using System.Runtime.CompilerServices;
+ using System.Runtime.ConstrainedExecution;
+ using System.Runtime.InteropServices;
+ using System.Runtime.Serialization;
+ using System.Runtime.Versioning;
+ using System.Security;
+ using System.Security.Permissions;
+ using System.Text;
+ using System.Diagnostics.Tracing;
+
+ [System.Security.SecurityCritical] // auto-generated
+ [SuppressUnmanagedCodeSecurityAttribute()]
+ internal static class UnsafeNativeMethods {
+
+ [DllImport(Win32Native.KERNEL32, EntryPoint="GetTimeZoneInformation", SetLastError = true, ExactSpelling = true)]
+ internal static extern int GetTimeZoneInformation(out Win32Native.TimeZoneInformation lpTimeZoneInformation);
+
+ [DllImport(Win32Native.KERNEL32, EntryPoint="GetDynamicTimeZoneInformation", SetLastError = true, ExactSpelling = true)]
+ internal static extern int GetDynamicTimeZoneInformation(out Win32Native.DynamicTimeZoneInformation lpDynamicTimeZoneInformation);
+
+ //
+ // BOOL GetFileMUIPath(
+ // DWORD dwFlags,
+ // PCWSTR pcwszFilePath,
+ // PWSTR pwszLanguage,
+ // PULONG pcchLanguage,
+ // PWSTR pwszFileMUIPath,
+ // PULONG pcchFileMUIPath,
+ // PULONGLONG pululEnumerator
+ // );
+ //
+ [DllImport(Win32Native.KERNEL32, EntryPoint="GetFileMUIPath", SetLastError = true, ExactSpelling = true)]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ internal static extern bool GetFileMUIPath(
+ int flags,
+ [MarshalAs(UnmanagedType.LPWStr)]
+ String filePath,
+ [MarshalAs(UnmanagedType.LPWStr)]
+ StringBuilder language,
+ ref int languageLength,
+ [Out, MarshalAs(UnmanagedType.LPWStr)]
+ StringBuilder fileMuiPath,
+ ref int fileMuiPathLength,
+ ref Int64 enumerator);
+
+
+ [DllImport(Win32Native.USER32, EntryPoint="LoadStringW", SetLastError=true, CharSet=CharSet.Unicode, ExactSpelling=true, CallingConvention=CallingConvention.StdCall)]
+ internal static extern int LoadString(SafeLibraryHandle handle, int id, [Out] StringBuilder buffer, int bufferLength);
+
+ [DllImport(Win32Native.KERNEL32, CharSet=System.Runtime.InteropServices.CharSet.Unicode, SetLastError=true)]
+ internal static extern SafeLibraryHandle LoadLibraryEx(string libFilename, IntPtr reserved, int flags);
+
+ [DllImport(Win32Native.KERNEL32, CharSet=System.Runtime.InteropServices.CharSet.Unicode)]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
+ internal static extern bool FreeLibrary(IntPtr hModule);
+
+
+ [SecurityCritical]
+ [SuppressUnmanagedCodeSecurityAttribute()]
+ internal static unsafe class ManifestEtw
+ {
+ //
+ // Constants error coded returned by ETW APIs
+ //
+
+ // The event size is larger than the allowed maximum (64k - header).
+ internal const int ERROR_ARITHMETIC_OVERFLOW = 534;
+
+ // Occurs when filled buffers are trying to flush to disk,
+ // but disk IOs are not happening fast enough.
+ // This happens when the disk is slow and event traffic is heavy.
+ // Eventually, there are no more free (empty) buffers and the event is dropped.
+ internal const int ERROR_NOT_ENOUGH_MEMORY = 8;
+
+ internal const int ERROR_MORE_DATA = 0xEA;
+ internal const int ERROR_NOT_SUPPORTED = 50;
+ internal const int ERROR_INVALID_PARAMETER = 0x57;
+
+ //
+ // ETW Methods
+ //
+
+ internal const int EVENT_CONTROL_CODE_DISABLE_PROVIDER = 0;
+ internal const int EVENT_CONTROL_CODE_ENABLE_PROVIDER = 1;
+ internal const int EVENT_CONTROL_CODE_CAPTURE_STATE = 2;
+
+ //
+ // Callback
+ //
+ [SecurityCritical]
+ internal unsafe delegate void EtwEnableCallback(
+ [In] ref Guid sourceId,
+ [In] int isEnabled,
+ [In] byte level,
+ [In] long matchAnyKeywords,
+ [In] long matchAllKeywords,
+ [In] EVENT_FILTER_DESCRIPTOR* filterData,
+ [In] void* callbackContext
+ );
+
+ //
+ // Registration APIs
+ //
+ [SecurityCritical]
+ [DllImport(Win32Native.ADVAPI32, ExactSpelling = true, EntryPoint = "EventRegister", CharSet = System.Runtime.InteropServices.CharSet.Unicode)]
+ internal static extern unsafe uint EventRegister(
+ [In] ref Guid providerId,
+ [In]EtwEnableCallback enableCallback,
+ [In]void* callbackContext,
+ [In][Out]ref long registrationHandle
+ );
+
+ //
+ [SecurityCritical]
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage")]
+ [DllImport(Win32Native.ADVAPI32, ExactSpelling = true, EntryPoint = "EventUnregister", CharSet = System.Runtime.InteropServices.CharSet.Unicode)]
+ internal static extern uint EventUnregister([In] long registrationHandle);
+
+ //
+ // Writing (Publishing/Logging) APIs
+ //
+ //
+ [SecurityCritical]
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage")]
+ [DllImport(Win32Native.ADVAPI32, ExactSpelling = true, EntryPoint = "EventWrite", CharSet = System.Runtime.InteropServices.CharSet.Unicode)]
+ internal static extern unsafe int EventWrite(
+ [In] long registrationHandle,
+ [In] ref EventDescriptor eventDescriptor,
+ [In] int userDataCount,
+ [In] EventProvider.EventData* userData
+ );
+
+ [SecurityCritical]
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage")]
+ [DllImport(Win32Native.ADVAPI32, ExactSpelling = true, EntryPoint = "EventWriteString", CharSet = System.Runtime.InteropServices.CharSet.Unicode)]
+ internal static extern unsafe int EventWriteString(
+ [In] long registrationHandle,
+ [In] byte level,
+ [In] long keyword,
+ [In] string msg
+ );
+
+ [StructLayout(LayoutKind.Sequential)]
+ unsafe internal struct EVENT_FILTER_DESCRIPTOR
+ {
+ public long Ptr;
+ public int Size;
+ public int Type;
+ };
+
+ /// <summary>
+ /// Call the ETW native API EventWriteTransfer and checks for invalid argument error.
+ /// The implementation of EventWriteTransfer on some older OSes (Windows 2008) does not accept null relatedActivityId.
+ /// So, for these cases we will retry the call with an empty Guid.
+ /// </summary>
+ internal static int EventWriteTransferWrapper(long registrationHandle,
+ ref EventDescriptor eventDescriptor,
+ Guid* activityId,
+ Guid* relatedActivityId,
+ int userDataCount,
+ EventProvider.EventData* userData)
+ {
+ int HResult = EventWriteTransfer(registrationHandle, ref eventDescriptor, activityId, relatedActivityId, userDataCount, userData);
+ if (HResult == ERROR_INVALID_PARAMETER && relatedActivityId == null)
+ {
+ Guid emptyGuid = Guid.Empty;
+ HResult = EventWriteTransfer(registrationHandle, ref eventDescriptor, activityId, &emptyGuid, userDataCount, userData);
+ }
+
+ return HResult;
+ }
+
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage")]
+ [DllImport(Win32Native.ADVAPI32, ExactSpelling = true, EntryPoint = "EventWriteTransfer", CharSet = System.Runtime.InteropServices.CharSet.Unicode)]
+ [SuppressUnmanagedCodeSecurityAttribute] // Don't do security checks
+ private static extern int EventWriteTransfer(
+ [In] long registrationHandle,
+ [In] ref EventDescriptor eventDescriptor,
+ [In] Guid* activityId,
+ [In] Guid* relatedActivityId,
+ [In] int userDataCount,
+ [In] EventProvider.EventData* userData
+ );
+
+ internal enum ActivityControl : uint
+ {
+ EVENT_ACTIVITY_CTRL_GET_ID = 1,
+ EVENT_ACTIVITY_CTRL_SET_ID = 2,
+ EVENT_ACTIVITY_CTRL_CREATE_ID = 3,
+ EVENT_ACTIVITY_CTRL_GET_SET_ID = 4,
+ EVENT_ACTIVITY_CTRL_CREATE_SET_ID = 5
+ };
+
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage")]
+ [DllImport(Win32Native.ADVAPI32, ExactSpelling = true, EntryPoint = "EventActivityIdControl", CharSet = System.Runtime.InteropServices.CharSet.Unicode)]
+ [SuppressUnmanagedCodeSecurityAttribute] // Don't do security checks
+ internal static extern int EventActivityIdControl([In] ActivityControl ControlCode, [In][Out] ref Guid ActivityId);
+
+ internal enum EVENT_INFO_CLASS
+ {
+ BinaryTrackInfo,
+ SetEnableAllKeywords,
+ SetTraits,
+ }
+
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage")]
+ [DllImport(Win32Native.ADVAPI32, ExactSpelling = true, EntryPoint = "EventSetInformation", CharSet = System.Runtime.InteropServices.CharSet.Unicode)]
+ [SuppressUnmanagedCodeSecurityAttribute] // Don't do security checks
+ internal static extern int EventSetInformation(
+ [In] long registrationHandle,
+ [In] EVENT_INFO_CLASS informationClass,
+ [In] void* eventInformation,
+ [In] int informationLength);
+
+ // Support for EnumerateTraceGuidsEx
+ internal enum TRACE_QUERY_INFO_CLASS
+ {
+ TraceGuidQueryList,
+ TraceGuidQueryInfo,
+ TraceGuidQueryProcess,
+ TraceStackTracingInfo,
+ MaxTraceSetInfoClass
+ };
+
+ internal struct TRACE_GUID_INFO
+ {
+ public int InstanceCount;
+ public int Reserved;
+ };
+
+ internal struct TRACE_PROVIDER_INSTANCE_INFO
+ {
+ public int NextOffset;
+ public int EnableCount;
+ public int Pid;
+ public int Flags;
+ };
+
+ internal struct TRACE_ENABLE_INFO
+ {
+ public int IsEnabled;
+ public byte Level;
+ public byte Reserved1;
+ public ushort LoggerId;
+ public int EnableProperty;
+ public int Reserved2;
+ public long MatchAnyKeyword;
+ public long MatchAllKeyword;
+ };
+
+ [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Security", "CA2118:ReviewSuppressUnmanagedCodeSecurityUsage")]
+ [DllImport(Win32Native.ADVAPI32, ExactSpelling = true, EntryPoint = "EnumerateTraceGuidsEx", CharSet = System.Runtime.InteropServices.CharSet.Unicode)]
+ [SuppressUnmanagedCodeSecurityAttribute] // Don't do security checks
+ internal static extern int EnumerateTraceGuidsEx(
+ TRACE_QUERY_INFO_CLASS TraceQueryInfoClass,
+ void* InBuffer,
+ int InBufferSize,
+ void* OutBuffer,
+ int OutBufferSize,
+ ref int ReturnLength);
+
+ }
+#if FEATURE_COMINTEROP
+ [SecurityCritical]
+ [DllImport("combase.dll", PreserveSig = true)]
+ internal static extern int RoGetActivationFactory(
+ [MarshalAs(UnmanagedType.HString)] string activatableClassId,
+ [In] ref Guid iid,
+ [Out,MarshalAs(UnmanagedType.IInspectable)] out Object factory);
+#endif
+
+ }
+}
diff --git a/src/mscorlib/src/Microsoft/Win32/Win32Native.cs b/src/mscorlib/src/Microsoft/Win32/Win32Native.cs
new file mode 100644
index 0000000..ebe53f4
--- /dev/null
+++ b/src/mscorlib/src/Microsoft/Win32/Win32Native.cs
@@ -0,0 +1,2455 @@
+// Licensed to the .NET Foundation under one or more agreements.
+// The .NET Foundation licenses this file to you under the MIT license.
+// See the LICENSE file in the project root for more information.
+
+/*============================================================
+**
+**
+**
+** Purpose: The CLR wrapper for all Win32 as well as
+** ROTOR-style Unix PAL, etc. native operations
+**
+**
+===========================================================*/
+/**
+ * Notes to PInvoke users: Getting the syntax exactly correct is crucial, and
+ * more than a little confusing. Here's some guidelines.
+ *
+ * For handles, you should use a SafeHandle subclass specific to your handle
+ * type. For files, we have the following set of interesting definitions:
+ *
+ * [DllImport(KERNEL32, SetLastError=true, CharSet=CharSet.Auto, BestFitMapping=false)]
+ * private static extern SafeFileHandle CreateFile(...);
+ *
+ * [DllImport(KERNEL32, SetLastError=true)]
+ * unsafe internal static extern int ReadFile(SafeFileHandle handle, ...);
+ *
+ * [DllImport(KERNEL32, SetLastError=true)]
+ * internal static extern bool CloseHandle(IntPtr handle);
+ *
+ * P/Invoke will create the SafeFileHandle instance for you and assign the
+ * return value from CreateFile into the handle atomically. When we call
+ * ReadFile, P/Invoke will increment a ref count, make the call, then decrement
+ * it (preventing handle recycling vulnerabilities). Then SafeFileHandle's
+ * ReleaseHandle method will call CloseHandle, passing in the handle field
+ * as an IntPtr.
+ *
+ * If for some reason you cannot use a SafeHandle subclass for your handles,
+ * then use IntPtr as the handle type (or possibly HandleRef - understand when
+ * to use GC.KeepAlive). If your code will run in SQL Server (or any other
+ * long-running process that can't be recycled easily), use a constrained
+ * execution region to prevent thread aborts while allocating your
+ * handle, and consider making your handle wrapper subclass
+ * CriticalFinalizerObject to ensure you can free the handle. As you can
+ * probably guess, SafeHandle will save you a lot of headaches if your code
+ * needs to be robust to thread aborts and OOM.
+ *
+ *
+ * If you have a method that takes a native struct, you have two options for
+ * declaring that struct. You can make it a value type ('struct' in CSharp),
+ * or a reference type ('class'). This choice doesn't seem very interesting,
+ * but your function prototype must use different syntax depending on your
+ * choice. For example, if your native method is prototyped as such:
+ *
+ * bool GetVersionEx(OSVERSIONINFO & lposvi);
+ *
+ *
+ * you must use EITHER THIS OR THE NEXT syntax:
+ *
+ * [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)]
+ * internal struct OSVERSIONINFO { ... }
+ *
+ * [DllImport(KERNEL32, CharSet=CharSet.Auto)]
+ * internal static extern bool GetVersionEx(ref OSVERSIONINFO lposvi);
+ *
+ * OR:
+ *
+ * [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)]
+ * internal class OSVERSIONINFO { ... }
+ *
+ * [DllImport(KERNEL32, CharSet=CharSet.Auto)]
+ * internal static extern bool GetVersionEx([In, Out] OSVERSIONINFO lposvi);
+ *
+ * Note that classes require being marked as [In, Out] while value types must
+ * be passed as ref parameters.
+ *
+ * Also note the CharSet.Auto on GetVersionEx - while it does not take a String
+ * as a parameter, the OSVERSIONINFO contains an embedded array of TCHARs, so
+ * the size of the struct varies on different platforms, and there's a
+ * GetVersionExA & a GetVersionExW. Also, the OSVERSIONINFO struct has a sizeof
+ * field so the OS can ensure you've passed in the correctly-sized copy of an
+ * OSVERSIONINFO. You must explicitly set this using Marshal.SizeOf(Object);
+ *
+ * For security reasons, if you're making a P/Invoke method to a Win32 method
+ * that takes an ANSI String and that String is the name of some resource you've
+ * done a security check on (such as a file name), you want to disable best fit
+ * mapping in WideCharToMultiByte. Do this by setting BestFitMapping=false
+ * in your DllImportAttribute.
+ */
+
+namespace Microsoft.Win32 {
+ using System;
+ using System.Security;
+#if FEATURE_IMPERSONATION
+ using System.Security.Principal;
+#endif
+ using System.Text;
+ using System.Configuration.Assemblies;
+ using System.Runtime.Remoting;
+ using System.Runtime.InteropServices;
+ using System.Threading;
+ using Microsoft.Win32.SafeHandles;
+ using System.Runtime.CompilerServices;
+ using System.Runtime.ConstrainedExecution;
+ using System.Runtime.Versioning;
+
+ using BOOL = System.Int32;
+ using DWORD = System.UInt32;
+ using ULONG = System.UInt32;
+
+ /**
+ * Win32 encapsulation for MSCORLIB.
+ */
+ // Remove the default demands for all P/Invoke methods with this
+ // global declaration on the class.
+
+ [System.Security.SecurityCritical]
+ [SuppressUnmanagedCodeSecurityAttribute()]
+ internal static class Win32Native {
+
+ internal const int KEY_QUERY_VALUE = 0x0001;
+ internal const int KEY_SET_VALUE = 0x0002;
+ internal const int KEY_CREATE_SUB_KEY = 0x0004;
+ internal const int KEY_ENUMERATE_SUB_KEYS = 0x0008;
+ internal const int KEY_NOTIFY = 0x0010;
+ internal const int KEY_CREATE_LINK = 0x0020;
+ internal const int KEY_READ =((STANDARD_RIGHTS_READ |
+ KEY_QUERY_VALUE |
+ KEY_ENUMERATE_SUB_KEYS |
+ KEY_NOTIFY)
+ &
+ (~SYNCHRONIZE));
+
+ internal const int KEY_WRITE =((STANDARD_RIGHTS_WRITE |
+ KEY_SET_VALUE |
+ KEY_CREATE_SUB_KEY)
+ &
+ (~SYNCHRONIZE));
+ internal const int KEY_WOW64_64KEY = 0x0100; //
+ internal const int KEY_WOW64_32KEY = 0x0200; //
+ internal const int REG_OPTION_NON_VOLATILE= 0x0000; // (default) keys are persisted beyond reboot/unload
+ internal const int REG_OPTION_VOLATILE = 0x0001; // All keys created by the function are volatile
+ internal const int REG_OPTION_CREATE_LINK = 0x0002; // They key is a symbolic link
+ internal const int REG_OPTION_BACKUP_RESTORE = 0x0004; // Use SE_BACKUP_NAME process special privileges
+ internal const int REG_NONE = 0; // No value type
+ internal const int REG_SZ = 1; // Unicode nul terminated string
+ internal const int REG_EXPAND_SZ = 2; // Unicode nul terminated string
+ // (with environment variable references)
+ internal const int REG_BINARY = 3; // Free form binary
+ internal const int REG_DWORD = 4; // 32-bit number
+ internal const int REG_DWORD_LITTLE_ENDIAN = 4; // 32-bit number (same as REG_DWORD)
+ internal const int REG_DWORD_BIG_ENDIAN = 5; // 32-bit number
+ internal const int REG_LINK = 6; // Symbolic Link (unicode)
+ internal const int REG_MULTI_SZ = 7; // Multiple Unicode strings
+ internal const int REG_RESOURCE_LIST = 8; // Resource list in the resource map
+ internal const int REG_FULL_RESOURCE_DESCRIPTOR = 9; // Resource list in the hardware description
+ internal const int REG_RESOURCE_REQUIREMENTS_LIST = 10;
+ internal const int REG_QWORD = 11; // 64-bit number
+
+ internal const int HWND_BROADCAST = 0xffff;
+ internal const int WM_SETTINGCHANGE = 0x001A;
+
+ // CryptProtectMemory and CryptUnprotectMemory.
+ internal const uint CRYPTPROTECTMEMORY_BLOCK_SIZE = 16;
+ internal const uint CRYPTPROTECTMEMORY_SAME_PROCESS = 0x00;
+ internal const uint CRYPTPROTECTMEMORY_CROSS_PROCESS = 0x01;
+ internal const uint CRYPTPROTECTMEMORY_SAME_LOGON = 0x02;
+
+ // Security Quality of Service flags
+ internal const int SECURITY_ANONYMOUS = ((int)SECURITY_IMPERSONATION_LEVEL.Anonymous << 16);
+ internal const int SECURITY_SQOS_PRESENT = 0x00100000;
+
+ // Access Control library.
+ internal const string MICROSOFT_KERBEROS_NAME = "Kerberos";
+ internal const uint ANONYMOUS_LOGON_LUID = 0x3e6;
+
+ internal const int SECURITY_ANONYMOUS_LOGON_RID = 0x00000007;
+ internal const int SECURITY_AUTHENTICATED_USER_RID = 0x0000000B;
+ internal const int SECURITY_LOCAL_SYSTEM_RID = 0x00000012;
+ internal const int SECURITY_BUILTIN_DOMAIN_RID = 0x00000020;
+
+ internal const uint SE_PRIVILEGE_DISABLED = 0x00000000;
+ internal const uint SE_PRIVILEGE_ENABLED_BY_DEFAULT = 0x00000001;
+ internal const uint SE_PRIVILEGE_ENABLED = 0x00000002;
+ internal const uint SE_PRIVILEGE_USED_FOR_ACCESS = 0x80000000;
+
+ internal const uint SE_GROUP_MANDATORY = 0x00000001;
+ internal const uint SE_GROUP_ENABLED_BY_DEFAULT = 0x00000002;
+ internal const uint SE_GROUP_ENABLED = 0x00000004;
+ internal const uint SE_GROUP_OWNER = 0x00000008;
+ internal const uint SE_GROUP_USE_FOR_DENY_ONLY = 0x00000010;
+ internal const uint SE_GROUP_LOGON_ID = 0xC0000000;
+ internal const uint SE_GROUP_RESOURCE = 0x20000000;
+
+ internal const uint DUPLICATE_CLOSE_SOURCE = 0x00000001;
+ internal const uint DUPLICATE_SAME_ACCESS = 0x00000002;
+ internal const uint DUPLICATE_SAME_ATTRIBUTES = 0x00000004;
+
+ // TimeZone
+ internal const int TIME_ZONE_ID_INVALID = -1;
+ internal const int TIME_ZONE_ID_UNKNOWN = 0;
+ internal const int TIME_ZONE_ID_STANDARD = 1;
+ internal const int TIME_ZONE_ID_DAYLIGHT = 2;
+ internal const int MAX_PATH = 260;
+
+ internal const int MUI_LANGUAGE_ID = 0x4;
+ internal const int MUI_LANGUAGE_NAME = 0x8;
+ internal const int MUI_PREFERRED_UI_LANGUAGES = 0x10;
+ internal const int MUI_INSTALLED_LANGUAGES = 0x20;
+ internal const int MUI_ALL_LANGUAGES = 0x40;
+ internal const int MUI_LANG_NEUTRAL_PE_FILE = 0x100;
+ internal const int MUI_NON_LANG_NEUTRAL_FILE = 0x200;
+
+ internal const int LOAD_LIBRARY_AS_DATAFILE = 0x00000002;
+ internal const int LOAD_STRING_MAX_LENGTH = 500;
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct SystemTime {
+ [MarshalAs(UnmanagedType.U2)]
+ public short Year;
+ [MarshalAs(UnmanagedType.U2)]
+ public short Month;
+ [MarshalAs(UnmanagedType.U2)]
+ public short DayOfWeek;
+ [MarshalAs(UnmanagedType.U2)]
+ public short Day;
+ [MarshalAs(UnmanagedType.U2)]
+ public short Hour;
+ [MarshalAs(UnmanagedType.U2)]
+ public short Minute;
+ [MarshalAs(UnmanagedType.U2)]
+ public short Second;
+ [MarshalAs(UnmanagedType.U2)]
+ public short Milliseconds;
+ }
+
+ [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
+ internal struct TimeZoneInformation {
+ [MarshalAs(UnmanagedType.I4)]
+ public Int32 Bias;
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
+ public string StandardName;
+ public SystemTime StandardDate;
+ [MarshalAs(UnmanagedType.I4)]
+ public Int32 StandardBias;
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
+ public string DaylightName;
+ public SystemTime DaylightDate;
+ [MarshalAs(UnmanagedType.I4)]
+ public Int32 DaylightBias;
+
+ public TimeZoneInformation(Win32Native.DynamicTimeZoneInformation dtzi) {
+ Bias = dtzi.Bias;
+ StandardName = dtzi.StandardName;
+ StandardDate = dtzi.StandardDate;
+ StandardBias = dtzi.StandardBias;
+ DaylightName = dtzi.DaylightName;
+ DaylightDate = dtzi.DaylightDate;
+ DaylightBias = dtzi.DaylightBias;
+ }
+ }
+
+
+ [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
+ internal struct DynamicTimeZoneInformation {
+ [MarshalAs(UnmanagedType.I4)]
+ public Int32 Bias;
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
+ public string StandardName;
+ public SystemTime StandardDate;
+ [MarshalAs(UnmanagedType.I4)]
+ public Int32 StandardBias;
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 32)]
+ public string DaylightName;
+ public SystemTime DaylightDate;
+ [MarshalAs(UnmanagedType.I4)]
+ public Int32 DaylightBias;
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 128)]
+ public string TimeZoneKeyName;
+ [MarshalAs(UnmanagedType.Bool)]
+ public bool DynamicDaylightTimeDisabled;
+ }
+
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct RegistryTimeZoneInformation {
+ [MarshalAs(UnmanagedType.I4)]
+ public Int32 Bias;
+ [MarshalAs(UnmanagedType.I4)]
+ public Int32 StandardBias;
+ [MarshalAs(UnmanagedType.I4)]
+ public Int32 DaylightBias;
+ public SystemTime StandardDate;
+ public SystemTime DaylightDate;
+
+ public RegistryTimeZoneInformation(Win32Native.TimeZoneInformation tzi) {
+ Bias = tzi.Bias;
+ StandardDate = tzi.StandardDate;
+ StandardBias = tzi.StandardBias;
+ DaylightDate = tzi.DaylightDate;
+ DaylightBias = tzi.DaylightBias;
+ }
+
+ public RegistryTimeZoneInformation(Byte[] bytes) {
+ //
+ // typedef struct _REG_TZI_FORMAT {
+ // [00-03] LONG Bias;
+ // [04-07] LONG StandardBias;
+ // [08-11] LONG DaylightBias;
+ // [12-27] SYSTEMTIME StandardDate;
+ // [12-13] WORD wYear;
+ // [14-15] WORD wMonth;
+ // [16-17] WORD wDayOfWeek;
+ // [18-19] WORD wDay;
+ // [20-21] WORD wHour;
+ // [22-23] WORD wMinute;
+ // [24-25] WORD wSecond;
+ // [26-27] WORD wMilliseconds;
+ // [28-43] SYSTEMTIME DaylightDate;
+ // [28-29] WORD wYear;
+ // [30-31] WORD wMonth;
+ // [32-33] WORD wDayOfWeek;
+ // [34-35] WORD wDay;
+ // [36-37] WORD wHour;
+ // [38-39] WORD wMinute;
+ // [40-41] WORD wSecond;
+ // [42-43] WORD wMilliseconds;
+ // } REG_TZI_FORMAT;
+ //
+ if (bytes == null || bytes.Length != 44) {
+ throw new ArgumentException(Environment.GetResourceString("Argument_InvalidREG_TZI_FORMAT"), "bytes");
+ }
+ Bias = BitConverter.ToInt32(bytes, 0);
+ StandardBias = BitConverter.ToInt32(bytes, 4);
+ DaylightBias = BitConverter.ToInt32(bytes, 8);
+
+ StandardDate.Year = BitConverter.ToInt16(bytes, 12);
+ StandardDate.Month = BitConverter.ToInt16(bytes, 14);
+ StandardDate.DayOfWeek = BitConverter.ToInt16(bytes, 16);
+ StandardDate.Day = BitConverter.ToInt16(bytes, 18);
+ StandardDate.Hour = BitConverter.ToInt16(bytes, 20);
+ StandardDate.Minute = BitConverter.ToInt16(bytes, 22);
+ StandardDate.Second = BitConverter.ToInt16(bytes, 24);
+ StandardDate.Milliseconds = BitConverter.ToInt16(bytes, 26);
+
+ DaylightDate.Year = BitConverter.ToInt16(bytes, 28);
+ DaylightDate.Month = BitConverter.ToInt16(bytes, 30);
+ DaylightDate.DayOfWeek = BitConverter.ToInt16(bytes, 32);
+ DaylightDate.Day = BitConverter.ToInt16(bytes, 34);
+ DaylightDate.Hour = BitConverter.ToInt16(bytes, 36);
+ DaylightDate.Minute = BitConverter.ToInt16(bytes, 38);
+ DaylightDate.Second = BitConverter.ToInt16(bytes, 40);
+ DaylightDate.Milliseconds = BitConverter.ToInt16(bytes, 42);
+ }
+ }
+
+ // end of TimeZone
+
+
+ // Win32 ACL-related constants:
+ internal const int READ_CONTROL = 0x00020000;
+ internal const int SYNCHRONIZE = 0x00100000;
+
+ internal const int STANDARD_RIGHTS_READ = READ_CONTROL;
+ internal const int STANDARD_RIGHTS_WRITE = READ_CONTROL;
+
+ // STANDARD_RIGHTS_REQUIRED (0x000F0000L)
+ // SEMAPHORE_ALL_ACCESS (STANDARD_RIGHTS_REQUIRED|SYNCHRONIZE|0x3)
+
+ // SEMAPHORE and Event both use 0x0002
+ // MUTEX uses 0x001 (MUTANT_QUERY_STATE)
+
+ // Note that you may need to specify the SYNCHRONIZE bit as well
+ // to be able to open a synchronization primitive.
+ internal const int SEMAPHORE_MODIFY_STATE = 0x00000002;
+ internal const int EVENT_MODIFY_STATE = 0x00000002;
+ internal const int MUTEX_MODIFY_STATE = 0x00000001;
+ internal const int MUTEX_ALL_ACCESS = 0x001F0001;
+
+
+ internal const int LMEM_FIXED = 0x0000;
+ internal const int LMEM_ZEROINIT = 0x0040;
+ internal const int LPTR = (LMEM_FIXED | LMEM_ZEROINIT);
+
+ [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)]
+ internal class OSVERSIONINFO {
+ internal OSVERSIONINFO() {
+ OSVersionInfoSize = (int)Marshal.SizeOf(this);
+ }
+
+ // The OSVersionInfoSize field must be set to Marshal.SizeOf(this)
+ internal int OSVersionInfoSize = 0;
+ internal int MajorVersion = 0;
+ internal int MinorVersion = 0;
+ internal int BuildNumber = 0;
+ internal int PlatformId = 0;
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst=128)]
+ internal String CSDVersion = null;
+ }
+
+ [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)]
+ internal class OSVERSIONINFOEX {
+
+ public OSVERSIONINFOEX() {
+ OSVersionInfoSize = (int)Marshal.SizeOf(this);
+ }
+
+ // The OSVersionInfoSize field must be set to Marshal.SizeOf(this)
+ internal int OSVersionInfoSize = 0;
+ internal int MajorVersion = 0;
+ internal int MinorVersion = 0;
+ internal int BuildNumber = 0;
+ internal int PlatformId = 0;
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst=128)]
+ internal string CSDVersion = null;
+ internal ushort ServicePackMajor = 0;
+ internal ushort ServicePackMinor = 0;
+ internal short SuiteMask = 0;
+ internal byte ProductType = 0;
+ internal byte Reserved = 0;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct SYSTEM_INFO {
+ internal int dwOemId; // This is a union of a DWORD and a struct containing 2 WORDs.
+ internal int dwPageSize;
+ internal IntPtr lpMinimumApplicationAddress;
+ internal IntPtr lpMaximumApplicationAddress;
+ internal IntPtr dwActiveProcessorMask;
+ internal int dwNumberOfProcessors;
+ internal int dwProcessorType;
+ internal int dwAllocationGranularity;
+ internal short wProcessorLevel;
+ internal short wProcessorRevision;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal class SECURITY_ATTRIBUTES {
+ internal int nLength = 0;
+ // don't remove null, or this field will disappear in bcl.small
+ internal unsafe byte * pSecurityDescriptor = null;
+ internal int bInheritHandle = 0;
+ }
+
+ [Serializable]
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct WIN32_FILE_ATTRIBUTE_DATA {
+ internal int fileAttributes;
+ internal uint ftCreationTimeLow;
+ internal uint ftCreationTimeHigh;
+ internal uint ftLastAccessTimeLow;
+ internal uint ftLastAccessTimeHigh;
+ internal uint ftLastWriteTimeLow;
+ internal uint ftLastWriteTimeHigh;
+ internal int fileSizeHigh;
+ internal int fileSizeLow;
+
+ [System.Security.SecurityCritical]
+ internal void PopulateFrom(WIN32_FIND_DATA findData) {
+ // Copy the information to data
+ fileAttributes = findData.dwFileAttributes;
+ ftCreationTimeLow = findData.ftCreationTime_dwLowDateTime;
+ ftCreationTimeHigh = findData.ftCreationTime_dwHighDateTime;
+ ftLastAccessTimeLow = findData.ftLastAccessTime_dwLowDateTime;
+ ftLastAccessTimeHigh = findData.ftLastAccessTime_dwHighDateTime;
+ ftLastWriteTimeLow = findData.ftLastWriteTime_dwLowDateTime;
+ ftLastWriteTimeHigh = findData.ftLastWriteTime_dwHighDateTime;
+ fileSizeHigh = findData.nFileSizeHigh;
+ fileSizeLow = findData.nFileSizeLow;
+ }
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct FILE_TIME {
+ public FILE_TIME(long fileTime) {
+ ftTimeLow = (uint) fileTime;
+ ftTimeHigh = (uint) (fileTime >> 32);
+ }
+
+ public long ToTicks() {
+ return ((long) ftTimeHigh << 32) + ftTimeLow;
+ }
+
+ internal uint ftTimeLow;
+ internal uint ftTimeHigh;
+ }
+
+ [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode)]
+ internal struct KERB_S4U_LOGON {
+ internal uint MessageType;
+ internal uint Flags;
+ internal UNICODE_INTPTR_STRING ClientUpn; // REQUIRED: UPN for client
+ internal UNICODE_INTPTR_STRING ClientRealm; // Optional: Client Realm, if known
+ }
+
+ [StructLayoutAttribute(LayoutKind.Sequential)]
+ internal struct LSA_OBJECT_ATTRIBUTES {
+ internal int Length;
+ internal IntPtr RootDirectory;
+ internal IntPtr ObjectName;
+ internal int Attributes;
+ internal IntPtr SecurityDescriptor;
+ internal IntPtr SecurityQualityOfService;
+ }
+
+ [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode)]
+ internal struct UNICODE_STRING {
+ internal ushort Length;
+ internal ushort MaximumLength;
+ [MarshalAs(UnmanagedType.LPWStr)] internal string Buffer;
+ }
+
+ [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode)]
+ internal struct UNICODE_INTPTR_STRING {
+ /// <remarks>
+ /// Note - this constructor extracts the raw pointer from the safe handle, so any
+ /// strings created with this version of the constructor will be unsafe to use after the buffer
+ /// has been freed.
+ /// </remarks>
+ [System.Security.SecurityCritical] // auto-generated
+ internal UNICODE_INTPTR_STRING (int stringBytes, SafeLocalAllocHandle buffer) {
+ BCLDebug.Assert(buffer == null || (stringBytes >= 0 && (ulong)stringBytes <= buffer.ByteLength),
+ "buffer == null || (stringBytes >= 0 && stringBytes <= buffer.ByteLength)");
+
+ this.Length = (ushort) stringBytes;
+ this.MaxLength = (ushort) buffer.ByteLength;
+
+ // Marshaling with a SafePointer does not work correctly, so unfortunately we need to extract
+ // the raw handle here.
+ this.Buffer = buffer.DangerousGetHandle();
+ }
+
+ /// <remarks>
+ /// This constructor should be used for constructing UNICODE_STRING structures with pointers
+ /// into a block of memory managed by a SafeHandle or the GC. It shouldn't be used to own
+ /// any memory on its own.
+ /// </remarks>
+ internal UNICODE_INTPTR_STRING(int stringBytes, IntPtr buffer) {
+ BCLDebug.Assert((stringBytes == 0 && buffer == IntPtr.Zero) || (stringBytes > 0 && stringBytes <= UInt16.MaxValue && buffer != IntPtr.Zero),
+ "(stringBytes == 0 && buffer == IntPtr.Zero) || (stringBytes > 0 && stringBytes <= UInt16.MaxValue && buffer != IntPtr.Zero)");
+
+ this.Length = (ushort)stringBytes;
+ this.MaxLength = (ushort)stringBytes;
+ this.Buffer = buffer;
+ }
+
+ internal ushort Length;
+ internal ushort MaxLength;
+ internal IntPtr Buffer;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct LSA_TRANSLATED_NAME {
+ internal int Use;
+ internal UNICODE_INTPTR_STRING Name;
+ internal int DomainIndex;
+ }
+
+ [StructLayoutAttribute(LayoutKind.Sequential)]
+ internal struct LSA_TRANSLATED_SID {
+ internal int Use;
+ internal uint Rid;
+ internal int DomainIndex;
+ }
+
+ [StructLayoutAttribute(LayoutKind.Sequential)]
+ internal struct LSA_TRANSLATED_SID2 {
+ internal int Use;
+ internal IntPtr Sid;
+ internal int DomainIndex;
+ uint Flags;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct LSA_TRUST_INFORMATION {
+ internal UNICODE_INTPTR_STRING Name;
+ internal IntPtr Sid;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct LSA_REFERENCED_DOMAIN_LIST {
+ internal int Entries;
+ internal IntPtr Domains;
+ }
+
+ [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode)]
+ internal struct LUID {
+ internal uint LowPart;
+ internal uint HighPart;
+ }
+
+ [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode)]
+ internal struct LUID_AND_ATTRIBUTES {
+ internal LUID Luid;
+ internal uint Attributes;
+ }
+
+ [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode)]
+ internal struct QUOTA_LIMITS {
+ internal IntPtr PagedPoolLimit;
+ internal IntPtr NonPagedPoolLimit;
+ internal IntPtr MinimumWorkingSetSize;
+ internal IntPtr MaximumWorkingSetSize;
+ internal IntPtr PagefileLimit;
+ internal IntPtr TimeLimit;
+ }
+
+ [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode)]
+ internal struct SECURITY_LOGON_SESSION_DATA {
+ internal uint Size;
+ internal LUID LogonId;
+ internal UNICODE_INTPTR_STRING UserName;
+ internal UNICODE_INTPTR_STRING LogonDomain;
+ internal UNICODE_INTPTR_STRING AuthenticationPackage;
+ internal uint LogonType;
+ internal uint Session;
+ internal IntPtr Sid;
+ internal long LogonTime;
+ }
+
+ [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode)]
+ internal struct SID_AND_ATTRIBUTES {
+ internal IntPtr Sid;
+ internal uint Attributes;
+ internal static readonly long SizeOf = (long)Marshal.SizeOf(typeof(SID_AND_ATTRIBUTES));
+ }
+
+ [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode)]
+ internal struct TOKEN_GROUPS {
+ internal uint GroupCount;
+ internal SID_AND_ATTRIBUTES Groups; // SID_AND_ATTRIBUTES Groups[ANYSIZE_ARRAY];
+ }
+
+ [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
+ internal struct TOKEN_PRIMARY_GROUP
+ {
+ internal IntPtr PrimaryGroup;
+ }
+
+ [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode)]
+ internal struct TOKEN_PRIVILEGE {
+ internal uint PrivilegeCount;
+ internal LUID_AND_ATTRIBUTES Privilege;
+ }
+
+ [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode)]
+ internal struct TOKEN_SOURCE {
+ private const int TOKEN_SOURCE_LENGTH = 8;
+
+ [MarshalAs(UnmanagedType.ByValArray, SizeConst=TOKEN_SOURCE_LENGTH)]
+ internal char[] Name;
+ internal LUID SourceIdentifier;
+ }
+
+ [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode)]
+ internal struct TOKEN_STATISTICS {
+ internal LUID TokenId;
+ internal LUID AuthenticationId;
+ internal long ExpirationTime;
+ internal uint TokenType;
+ internal uint ImpersonationLevel;
+ internal uint DynamicCharged;
+ internal uint DynamicAvailable;
+ internal uint GroupCount;
+ internal uint PrivilegeCount;
+ internal LUID ModifiedId;
+ }
+
+ [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Unicode)]
+ internal struct TOKEN_USER {
+ internal SID_AND_ATTRIBUTES User;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct MEMORYSTATUSEX {
+ // The length field must be set to the size of this data structure.
+ internal int length;
+ internal int memoryLoad;
+ internal ulong totalPhys;
+ internal ulong availPhys;
+ internal ulong totalPageFile;
+ internal ulong availPageFile;
+ internal ulong totalVirtual;
+ internal ulong availVirtual;
+ internal ulong availExtendedVirtual;
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal unsafe struct MEMORY_BASIC_INFORMATION {
+ internal void* BaseAddress;
+ internal void* AllocationBase;
+ internal uint AllocationProtect;
+ internal UIntPtr RegionSize;
+ internal uint State;
+ internal uint Protect;
+ internal uint Type;
+ }
+
+#if !FEATURE_PAL
+ internal const String KERNEL32 = "kernel32.dll";
+ internal const String USER32 = "user32.dll";
+ internal const String OLE32 = "ole32.dll";
+ internal const String OLEAUT32 = "oleaut32.dll";
+ internal const String NTDLL = "ntdll.dll";
+#else //FEATURE_PAL
+ internal const String KERNEL32 = "libcoreclr";
+ internal const String USER32 = "libcoreclr";
+ internal const String OLE32 = "libcoreclr";
+ internal const String OLEAUT32 = "libcoreclr";
+ internal const String NTDLL = "libcoreclr";
+#endif //FEATURE_PAL
+ internal const String ADVAPI32 = "advapi32.dll";
+ internal const String SHELL32 = "shell32.dll";
+ internal const String SHIM = "mscoree.dll";
+ internal const String CRYPT32 = "crypt32.dll";
+ internal const String SECUR32 = "secur32.dll";
+#if FEATURE_MAIN_CLR_MODULE_USES_CORE_NAME
+ internal const String MSCORWKS = "coreclr.dll";
+#else //FEATURE_MAIN_CLR_MODULE_USES_CORE_NAME
+ internal const String MSCORWKS = "clr.dll";
+#endif //FEATURE_MAIN_CLR_MODULE_USES_CORE_NAME
+
+ // From WinBase.h
+ internal const int SEM_FAILCRITICALERRORS = 1;
+
+ [DllImport(KERNEL32, SetLastError=true)]
+ internal static extern void GetSystemInfo(ref SYSTEM_INFO lpSystemInfo);
+
+ [DllImport(KERNEL32, CharSet=CharSet.Auto, BestFitMapping=true)]
+ internal static extern int FormatMessage(int dwFlags, IntPtr lpSource,
+ int dwMessageId, int dwLanguageId, [Out]StringBuilder lpBuffer,
+ int nSize, IntPtr va_list_arguments);
+
+ // Gets an error message for a Win32 error code.
+ internal static String GetMessage(int errorCode) {
+ StringBuilder sb = StringBuilderCache.Acquire(512);
+ int result = Win32Native.FormatMessage(FORMAT_MESSAGE_IGNORE_INSERTS |
+ FORMAT_MESSAGE_FROM_SYSTEM | FORMAT_MESSAGE_ARGUMENT_ARRAY,
+ IntPtr.Zero, errorCode, 0, sb, sb.Capacity, IntPtr.Zero);
+ if (result != 0) {
+ // result is the # of characters copied to the StringBuilder.
+ return StringBuilderCache.GetStringAndRelease(sb);
+ }
+ else {
+ StringBuilderCache.Release(sb);
+ return Environment.GetResourceString("UnknownError_Num", errorCode);
+ }
+ }
+
+ [DllImport(KERNEL32, EntryPoint="LocalAlloc")]
+ [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
+ internal static extern IntPtr LocalAlloc_NoSafeHandle(int uFlags, UIntPtr sizetdwBytes);
+
+ [DllImport(KERNEL32, CharSet=CharSet.Auto, SetLastError=true)]
+ internal static extern
+ SafeLocalAllocHandle LocalAlloc(
+ [In] int uFlags,
+ [In] UIntPtr sizetdwBytes);
+
+ [DllImport(KERNEL32, SetLastError=true)]
+ [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
+ internal static extern IntPtr LocalFree(IntPtr handle);
+
+ // MSDN says the length is a SIZE_T.
+ [DllImport(NTDLL, EntryPoint = "RtlZeroMemory")]
+ [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
+ internal static extern void ZeroMemory(IntPtr address, UIntPtr length);
+
+ internal static bool GlobalMemoryStatusEx(ref MEMORYSTATUSEX buffer)
+ {
+ buffer.length = Marshal.SizeOf(typeof(MEMORYSTATUSEX));
+ return GlobalMemoryStatusExNative(ref buffer);
+ }
+
+ [DllImport(KERNEL32, SetLastError=true, EntryPoint="GlobalMemoryStatusEx")]
+ private static extern bool GlobalMemoryStatusExNative([In, Out] ref MEMORYSTATUSEX buffer);
+
+ [DllImport(KERNEL32, SetLastError=true)]
+ unsafe internal static extern UIntPtr VirtualQuery(void* address, ref MEMORY_BASIC_INFORMATION buffer, UIntPtr sizeOfBuffer);
+
+ // VirtualAlloc should generally be avoided, but is needed in
+ // the MemoryFailPoint implementation (within a CER) to increase the
+ // size of the page file, ignoring any host memory allocators.
+ [DllImport(KERNEL32, SetLastError=true)]
+ [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
+ unsafe internal static extern void * VirtualAlloc(void* address, UIntPtr numBytes, int commitOrReserve, int pageProtectionMode);
+
+ [DllImport(KERNEL32, SetLastError=true)]
+ [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
+ unsafe internal static extern bool VirtualFree(void* address, UIntPtr numBytes, int pageFreeMode);
+
+
+
+ // Note - do NOT use this to call methods. Use P/Invoke, which will
+ // do much better things w.r.t. marshaling, pinning memory, security
+ // stuff, better interactions with thread aborts, etc. This is used
+ // solely by DoesWin32MethodExist for avoiding try/catch EntryPointNotFoundException
+ // in scenarios where an OS Version check is insufficient
+ [DllImport(KERNEL32, CharSet=CharSet.Ansi, BestFitMapping=false, SetLastError=true, ExactSpelling=true)]
+ private static extern IntPtr GetProcAddress(IntPtr hModule, String methodName);
+
+ [DllImport(KERNEL32, CharSet=CharSet.Auto, BestFitMapping=false, SetLastError=true)]
+ [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
+ private static extern IntPtr GetModuleHandle(String moduleName);
+
+ [System.Security.SecurityCritical] // auto-generated
+ internal static bool DoesWin32MethodExist(String moduleName, String methodName)
+ {
+ // GetModuleHandle does not increment the module's ref count, so we don't need to call FreeLibrary.
+ IntPtr hModule = Win32Native.GetModuleHandle(moduleName);
+ if (hModule == IntPtr.Zero) {
+ BCLDebug.Assert(hModule != IntPtr.Zero, "GetModuleHandle failed. Dll isn't loaded?");
+ return false;
+ }
+ IntPtr functionPointer = Win32Native.GetProcAddress(hModule, methodName);
+ return (functionPointer != IntPtr.Zero);
+ }
+
+ // There is no need to call CloseProcess or to use a SafeHandle if you get the handle
+ // using GetCurrentProcess as it returns a pseudohandle
+ [DllImport(KERNEL32, SetLastError = true, CallingConvention = CallingConvention.Winapi)]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ internal static extern bool IsWow64Process(
+ [In]
+ IntPtr hSourceProcessHandle,
+ [Out, MarshalAs(UnmanagedType.Bool)]
+ out bool isWow64);
+
+ [DllImport(KERNEL32, CharSet=CharSet.Auto, BestFitMapping=false)]
+ internal static extern uint GetTempPath(int bufferLen, [Out]StringBuilder buffer);
+
+ [DllImport(KERNEL32, CharSet=CharSet.Ansi, ExactSpelling=true, EntryPoint="lstrlenA")]
+ internal static extern int lstrlenA(IntPtr ptr);
+
+ [DllImport(KERNEL32, CharSet=CharSet.Unicode, ExactSpelling=true, EntryPoint="lstrlenW")]
+ internal static extern int lstrlenW(IntPtr ptr);
+
+ [DllImport(Win32Native.OLEAUT32, CharSet = CharSet.Unicode)]
+ [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
+ internal static extern IntPtr SysAllocStringLen(String src, int len); // BSTR
+
+ [DllImport(Win32Native.OLEAUT32)]
+ [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
+ internal static extern uint SysStringLen(IntPtr bstr);
+
+ [DllImport(Win32Native.OLEAUT32)]
+ [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
+ internal static extern void SysFreeString(IntPtr bstr);
+
+#if FEATURE_COMINTEROP
+ [DllImport(Win32Native.OLEAUT32)]
+ [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
+ internal static extern IntPtr SysAllocStringByteLen(byte[] str, uint len); // BSTR
+
+ [DllImport(Win32Native.OLEAUT32)]
+ [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
+ internal static extern uint SysStringByteLen(IntPtr bstr);
+
+#if FEATURE_LEGACYSURFACE
+ [DllImport(Win32Native.OLEAUT32)]
+ [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
+ internal static extern uint SysStringLen(SafeBSTRHandle bstr);
+#endif
+
+#endif
+
+ [DllImport(KERNEL32)]
+ internal static extern int GetACP();
+
+ [DllImport(KERNEL32, SetLastError=true)]
+ internal static extern bool SetEvent(SafeWaitHandle handle);
+
+ [DllImport(KERNEL32, SetLastError=true)]
+ internal static extern bool ResetEvent(SafeWaitHandle handle);
+
+ [DllImport(KERNEL32, SetLastError=true, CharSet=CharSet.Auto, BestFitMapping=false)]
+ internal static extern SafeWaitHandle CreateEvent(SECURITY_ATTRIBUTES lpSecurityAttributes, bool isManualReset, bool initialState, String name);
+
+ [DllImport(KERNEL32, SetLastError=true, CharSet=CharSet.Auto, BestFitMapping=false)]
+ internal static extern SafeWaitHandle OpenEvent(/* DWORD */ int desiredAccess, bool inheritHandle, String name);
+
+ [DllImport(KERNEL32, SetLastError=true, CharSet=CharSet.Auto, BestFitMapping=false)]
+ [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
+ internal static extern SafeWaitHandle CreateMutex(SECURITY_ATTRIBUTES lpSecurityAttributes, bool initialOwner, String name);
+
+ [DllImport(KERNEL32, SetLastError=true, CharSet=CharSet.Auto, BestFitMapping=false)]
+ internal static extern SafeWaitHandle OpenMutex(/* DWORD */ int desiredAccess, bool inheritHandle, String name);
+
+ [DllImport(KERNEL32, SetLastError=true)]
+ [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
+ internal static extern bool ReleaseMutex(SafeWaitHandle handle);
+
+ [DllImport(KERNEL32, SetLastError = true, CharSet = CharSet.Auto, BestFitMapping = false)]
+ internal unsafe static extern int GetFullPathName(char* path, int numBufferChars, char* buffer, IntPtr mustBeZero);
+
+ [DllImport(KERNEL32, SetLastError=true, CharSet=CharSet.Auto, BestFitMapping=false)]
+ internal unsafe static extern int GetFullPathName(String path, int numBufferChars, [Out]StringBuilder buffer, IntPtr mustBeZero);
+
+ [DllImport(KERNEL32, SetLastError = true, CharSet = CharSet.Auto, BestFitMapping = false)]
+ internal unsafe static extern int GetLongPathName(char* path, char* longPathBuffer, int bufferLength);
+
+ [DllImport(KERNEL32, SetLastError = true, ExactSpelling = true)]
+ internal unsafe static extern uint GetFullPathNameW(char* path, uint numBufferChars, SafeHandle buffer, IntPtr mustBeZero);
+
+ [DllImport(KERNEL32, SetLastError = true, CharSet = CharSet.Auto, BestFitMapping = false)]
+ internal static extern int GetLongPathName(String path, [Out]StringBuilder longPathBuffer, int bufferLength);
+
+ [DllImport(KERNEL32, SetLastError = true, ExactSpelling = true)]
+ internal static extern uint GetLongPathNameW(SafeHandle lpszShortPath, SafeHandle lpszLongPath, uint cchBuffer);
+
+ [DllImport(KERNEL32, SetLastError = true, CharSet = CharSet.Unicode, ExactSpelling = true)]
+ internal static extern uint GetLongPathNameW(string lpszShortPath, SafeHandle lpszLongPath, uint cchBuffer);
+
+ // Disallow access to all non-file devices from methods that take
+ // a String. This disallows DOS devices like "con:", "com1:",
+ // "lpt1:", etc. Use this to avoid security problems, like allowing
+ // a web client asking a server for "http://server/com1.aspx" and
+ // then causing a worker process to hang.
+ [System.Security.SecurityCritical] // auto-generated
+ internal static SafeFileHandle SafeCreateFile(String lpFileName,
+ int dwDesiredAccess, System.IO.FileShare dwShareMode,
+ SECURITY_ATTRIBUTES securityAttrs, System.IO.FileMode dwCreationDisposition,
+ int dwFlagsAndAttributes, IntPtr hTemplateFile)
+ {
+ SafeFileHandle handle = CreateFile( lpFileName, dwDesiredAccess, dwShareMode,
+ securityAttrs, dwCreationDisposition,
+ dwFlagsAndAttributes, hTemplateFile );
+
+ if (!handle.IsInvalid)
+ {
+ int fileType = Win32Native.GetFileType(handle);
+ if (fileType != Win32Native.FILE_TYPE_DISK) {
+ handle.Dispose();
+ throw new NotSupportedException(Environment.GetResourceString("NotSupported_FileStreamOnNonFiles"));
+ }
+ }
+
+ return handle;
+ }
+
+ [System.Security.SecurityCritical] // auto-generated
+ internal static SafeFileHandle UnsafeCreateFile(String lpFileName,
+ int dwDesiredAccess, System.IO.FileShare dwShareMode,
+ SECURITY_ATTRIBUTES securityAttrs, System.IO.FileMode dwCreationDisposition,
+ int dwFlagsAndAttributes, IntPtr hTemplateFile)
+ {
+ SafeFileHandle handle = CreateFile( lpFileName, dwDesiredAccess, dwShareMode,
+ securityAttrs, dwCreationDisposition,
+ dwFlagsAndAttributes, hTemplateFile );
+
+ return handle;
+ }
+
+ // Do not use these directly, use the safe or unsafe versions above.
+ // The safe version does not support devices (aka if will only open
+ // files on disk), while the unsafe version give you the full semantic
+ // of the native version.
+ [DllImport(KERNEL32, SetLastError=true, CharSet=CharSet.Auto, BestFitMapping=false)]
+ private static extern SafeFileHandle CreateFile(String lpFileName,
+ int dwDesiredAccess, System.IO.FileShare dwShareMode,
+ SECURITY_ATTRIBUTES securityAttrs, System.IO.FileMode dwCreationDisposition,
+ int dwFlagsAndAttributes, IntPtr hTemplateFile);
+
+ [DllImport(KERNEL32, SetLastError=true, CharSet=CharSet.Auto, BestFitMapping=false)]
+ internal static extern SafeFileMappingHandle CreateFileMapping(SafeFileHandle hFile, IntPtr lpAttributes, uint fProtect, uint dwMaximumSizeHigh, uint dwMaximumSizeLow, String lpName);
+
+ [DllImport(KERNEL32, SetLastError=true, ExactSpelling=true)]
+ internal static extern IntPtr MapViewOfFile(
+ SafeFileMappingHandle handle, uint dwDesiredAccess, uint dwFileOffsetHigh, uint dwFileOffsetLow, UIntPtr dwNumerOfBytesToMap);
+
+ [DllImport(KERNEL32, ExactSpelling=true)]
+ [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
+ internal static extern bool UnmapViewOfFile(IntPtr lpBaseAddress );
+
+ [DllImport(KERNEL32, SetLastError=true)]
+ [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
+ internal static extern bool CloseHandle(IntPtr handle);
+
+ [DllImport(KERNEL32)]
+ internal static extern int GetFileType(SafeFileHandle handle);
+
+ [DllImport(KERNEL32, SetLastError=true)]
+ internal static extern bool SetEndOfFile(SafeFileHandle hFile);
+
+ [DllImport(KERNEL32, SetLastError = true)]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ internal static extern bool FlushFileBuffers(SafeFileHandle hFile);
+
+ [DllImport(KERNEL32, SetLastError=true, EntryPoint="SetFilePointer")]
+ private unsafe static extern int SetFilePointerWin32(SafeFileHandle handle, int lo, int * hi, int origin);
+
+ [System.Security.SecurityCritical] // auto-generated
+ internal unsafe static long SetFilePointer(SafeFileHandle handle, long offset, System.IO.SeekOrigin origin, out int hr) {
+ hr = 0;
+ int lo = (int) offset;
+ int hi = (int) (offset >> 32);
+ lo = SetFilePointerWin32(handle, lo, &hi, (int) origin);
+
+ if (lo == -1 && ((hr = Marshal.GetLastWin32Error()) != 0))
+ return -1;
+ return (long) (((ulong) ((uint) hi)) << 32) | ((uint) lo);
+ }
+
+ // Note there are two different ReadFile prototypes - this is to use
+ // the type system to force you to not trip across a "feature" in
+ // Win32's async IO support. You can't do the following three things
+ // simultaneously: overlapped IO, free the memory for the overlapped
+ // struct in a callback (or an EndRead method called by that callback),
+ // and pass in an address for the numBytesRead parameter.
+
+ [DllImport(KERNEL32, SetLastError=true)]
+ unsafe internal static extern int ReadFile(SafeFileHandle handle, byte* bytes, int numBytesToRead, IntPtr numBytesRead_mustBeZero, NativeOverlapped* overlapped);
+
+ [DllImport(KERNEL32, SetLastError=true)]
+ unsafe internal static extern int ReadFile(SafeFileHandle handle, byte* bytes, int numBytesToRead, out int numBytesRead, IntPtr mustBeZero);
+
+ // Note there are two different WriteFile prototypes - this is to use
+ // the type system to force you to not trip across a "feature" in
+ // Win32's async IO support. You can't do the following three things
+ // simultaneously: overlapped IO, free the memory for the overlapped
+ // struct in a callback (or an EndWrite method called by that callback),
+ // and pass in an address for the numBytesRead parameter.
+
+ [DllImport(KERNEL32, SetLastError=true)]
+ internal static unsafe extern int WriteFile(SafeFileHandle handle, byte* bytes, int numBytesToWrite, IntPtr numBytesWritten_mustBeZero, NativeOverlapped* lpOverlapped);
+
+ [DllImport(KERNEL32, SetLastError=true)]
+ internal static unsafe extern int WriteFile(SafeFileHandle handle, byte* bytes, int numBytesToWrite, out int numBytesWritten, IntPtr mustBeZero);
+
+ // This is only available on Vista or higher
+ [DllImport(KERNEL32, SetLastError=true)]
+ internal static unsafe extern bool CancelIoEx(SafeFileHandle handle, NativeOverlapped* lpOverlapped);
+
+ // NOTE: The out parameters are PULARGE_INTEGERs and may require
+ // some byte munging magic.
+ [DllImport(KERNEL32, CharSet=CharSet.Auto, SetLastError=true, BestFitMapping=false)]
+ internal static extern bool GetDiskFreeSpaceEx(String drive, out long freeBytesForUser, out long totalBytes, out long freeBytes);
+
+ [DllImport(KERNEL32, CharSet=CharSet.Auto, SetLastError=true, BestFitMapping=false)]
+ internal static extern int GetDriveType(String drive);
+
+ [DllImport(KERNEL32, CharSet=CharSet.Auto, SetLastError=true, BestFitMapping=false)]
+ internal static extern bool GetVolumeInformation(String drive, [Out]StringBuilder volumeName, int volumeNameBufLen, out int volSerialNumber, out int maxFileNameLen, out int fileSystemFlags, [Out]StringBuilder fileSystemName, int fileSystemNameBufLen);
+
+ [DllImport(KERNEL32, CharSet=CharSet.Auto, SetLastError=true, BestFitMapping=false)]
+ internal static extern bool SetVolumeLabel(String driveLetter, String volumeName);
+
+ // The following 4 methods are used by Microsoft.WlcProfile
+ [DllImport(KERNEL32)]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ internal static extern bool QueryPerformanceCounter(out long value);
+
+ [DllImport(KERNEL32)]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ internal static extern bool QueryPerformanceFrequency(out long value);
+
+ [DllImport(KERNEL32, SetLastError = true, CharSet = CharSet.Auto, BestFitMapping = false)]
+ internal static extern SafeWaitHandle CreateSemaphore(SECURITY_ATTRIBUTES lpSecurityAttributes, int initialCount, int maximumCount, String name);
+
+ [DllImport(KERNEL32, SetLastError = true)]
+ [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ internal static extern bool ReleaseSemaphore(SafeWaitHandle handle, int releaseCount, out int previousCount);
+
+ [DllImport(KERNEL32, SetLastError = true, CharSet = CharSet.Auto, BestFitMapping = false)]
+ internal static extern SafeWaitHandle OpenSemaphore(/* DWORD */ int desiredAccess, bool inheritHandle, String name);
+
+ // Will be in winnls.h
+ internal const int FIND_STARTSWITH = 0x00100000; // see if value is at the beginning of source
+ internal const int FIND_ENDSWITH = 0x00200000; // see if value is at the end of source
+ internal const int FIND_FROMSTART = 0x00400000; // look for value in source, starting at the beginning
+ internal const int FIND_FROMEND = 0x00800000; // look for value in source, starting at the end
+
+#if !FEATURE_CORECLR
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct NlsVersionInfoEx
+ {
+ internal int dwNLSVersionInfoSize;
+ internal int dwNLSVersion;
+ internal int dwDefinedVersion;
+ internal int dwEffectiveId;
+ internal Guid guidCustomVersion;
+ }
+#endif
+
+ [DllImport(KERNEL32, CharSet=CharSet.Auto, SetLastError=true, BestFitMapping=false)]
+ internal static extern int GetWindowsDirectory([Out]StringBuilder sb, int length);
+
+ [DllImport(KERNEL32, CharSet=CharSet.Auto, SetLastError=true, BestFitMapping=false)]
+ internal static extern int GetSystemDirectory([Out]StringBuilder sb, int length);
+
+ [DllImport(KERNEL32, SetLastError=true)]
+ internal unsafe static extern bool SetFileTime(SafeFileHandle hFile, FILE_TIME* creationTime,
+ FILE_TIME* lastAccessTime, FILE_TIME* lastWriteTime);
+
+ [DllImport(KERNEL32, SetLastError=true)]
+ internal static extern int GetFileSize(SafeFileHandle hFile, out int highSize);
+
+ [DllImport(KERNEL32, SetLastError=true)]
+ internal static extern bool LockFile(SafeFileHandle handle, int offsetLow, int offsetHigh, int countLow, int countHigh);
+
+ [DllImport(KERNEL32, SetLastError=true)]
+ internal static extern bool UnlockFile(SafeFileHandle handle, int offsetLow, int offsetHigh, int countLow, int countHigh);
+
+ internal static readonly IntPtr INVALID_HANDLE_VALUE = new IntPtr(-1); // WinBase.h
+
+ // Note, these are #defines used to extract handles, and are NOT handles.
+ internal const int STD_INPUT_HANDLE = -10;
+ internal const int STD_OUTPUT_HANDLE = -11;
+ internal const int STD_ERROR_HANDLE = -12;
+
+ [DllImport(KERNEL32, SetLastError=true)]
+ internal static extern IntPtr GetStdHandle(int nStdHandle); // param is NOT a handle, but it returns one!
+
+ // From wincon.h
+ internal const int CTRL_C_EVENT = 0;
+ internal const int CTRL_BREAK_EVENT = 1;
+ internal const int CTRL_CLOSE_EVENT = 2;
+ internal const int CTRL_LOGOFF_EVENT = 5;
+ internal const int CTRL_SHUTDOWN_EVENT = 6;
+ internal const short KEY_EVENT = 1;
+
+ // From WinBase.h
+ internal const int FILE_TYPE_DISK = 0x0001;
+ internal const int FILE_TYPE_CHAR = 0x0002;
+ internal const int FILE_TYPE_PIPE = 0x0003;
+
+ internal const int REPLACEFILE_WRITE_THROUGH = 0x1;
+ internal const int REPLACEFILE_IGNORE_MERGE_ERRORS = 0x2;
+
+ private const int FORMAT_MESSAGE_IGNORE_INSERTS = 0x00000200;
+ private const int FORMAT_MESSAGE_FROM_SYSTEM = 0x00001000;
+ private const int FORMAT_MESSAGE_ARGUMENT_ARRAY = 0x00002000;
+
+ internal const uint FILE_MAP_WRITE = 0x0002;
+ internal const uint FILE_MAP_READ = 0x0004;
+
+ // Constants from WinNT.h
+ internal const int FILE_ATTRIBUTE_READONLY = 0x00000001;
+ internal const int FILE_ATTRIBUTE_DIRECTORY = 0x00000010;
+ internal const int FILE_ATTRIBUTE_REPARSE_POINT = 0x00000400;
+
+ internal const int IO_REPARSE_TAG_MOUNT_POINT = unchecked((int)0xA0000003);
+
+ internal const int PAGE_READWRITE = 0x04;
+
+ internal const int MEM_COMMIT = 0x1000;
+ internal const int MEM_RESERVE = 0x2000;
+ internal const int MEM_RELEASE = 0x8000;
+ internal const int MEM_FREE = 0x10000;
+
+ // Error codes from WinError.h
+ internal const int ERROR_SUCCESS = 0x0;
+ internal const int ERROR_INVALID_FUNCTION = 0x1;
+ internal const int ERROR_FILE_NOT_FOUND = 0x2;
+ internal const int ERROR_PATH_NOT_FOUND = 0x3;
+ internal const int ERROR_ACCESS_DENIED = 0x5;
+ internal const int ERROR_INVALID_HANDLE = 0x6;
+ internal const int ERROR_NOT_ENOUGH_MEMORY = 0x8;
+ internal const int ERROR_INVALID_DATA = 0xd;
+ internal const int ERROR_INVALID_DRIVE = 0xf;
+ internal const int ERROR_NO_MORE_FILES = 0x12;
+ internal const int ERROR_NOT_READY = 0x15;
+ internal const int ERROR_BAD_LENGTH = 0x18;
+ internal const int ERROR_SHARING_VIOLATION = 0x20;
+ internal const int ERROR_NOT_SUPPORTED = 0x32;
+ internal const int ERROR_FILE_EXISTS = 0x50;
+ internal const int ERROR_INVALID_PARAMETER = 0x57;
+ internal const int ERROR_BROKEN_PIPE = 0x6D;
+ internal const int ERROR_CALL_NOT_IMPLEMENTED = 0x78;
+ internal const int ERROR_INSUFFICIENT_BUFFER = 0x7A;
+ internal const int ERROR_INVALID_NAME = 0x7B;
+ internal const int ERROR_BAD_PATHNAME = 0xA1;
+ internal const int ERROR_ALREADY_EXISTS = 0xB7;
+ internal const int ERROR_ENVVAR_NOT_FOUND = 0xCB;
+ internal const int ERROR_FILENAME_EXCED_RANGE = 0xCE; // filename too long.
+ internal const int ERROR_NO_DATA = 0xE8;
+ internal const int ERROR_PIPE_NOT_CONNECTED = 0xE9;
+ internal const int ERROR_MORE_DATA = 0xEA;
+ internal const int ERROR_DIRECTORY = 0x10B;
+ internal const int ERROR_OPERATION_ABORTED = 0x3E3; // 995; For IO Cancellation
+ internal const int ERROR_NOT_FOUND = 0x490; // 1168; For IO Cancellation
+ internal const int ERROR_NO_TOKEN = 0x3f0;
+ internal const int ERROR_DLL_INIT_FAILED = 0x45A;
+ internal const int ERROR_NON_ACCOUNT_SID = 0x4E9;
+ internal const int ERROR_NOT_ALL_ASSIGNED = 0x514;
+ internal const int ERROR_UNKNOWN_REVISION = 0x519;
+ internal const int ERROR_INVALID_OWNER = 0x51B;
+ internal const int ERROR_INVALID_PRIMARY_GROUP = 0x51C;
+ internal const int ERROR_NO_SUCH_PRIVILEGE = 0x521;
+ internal const int ERROR_PRIVILEGE_NOT_HELD = 0x522;
+ internal const int ERROR_NONE_MAPPED = 0x534;
+ internal const int ERROR_INVALID_ACL = 0x538;
+ internal const int ERROR_INVALID_SID = 0x539;
+ internal const int ERROR_INVALID_SECURITY_DESCR = 0x53A;
+ internal const int ERROR_BAD_IMPERSONATION_LEVEL = 0x542;
+ internal const int ERROR_CANT_OPEN_ANONYMOUS = 0x543;
+ internal const int ERROR_NO_SECURITY_ON_OBJECT = 0x546;
+ internal const int ERROR_TRUSTED_RELATIONSHIP_FAILURE = 0x6FD;
+
+ // Error codes from ntstatus.h
+ internal const uint STATUS_SUCCESS = 0x00000000;
+ internal const uint STATUS_SOME_NOT_MAPPED = 0x00000107;
+ internal const uint STATUS_NO_MEMORY = 0xC0000017;
+ internal const uint STATUS_OBJECT_NAME_NOT_FOUND = 0xC0000034;
+ internal const uint STATUS_NONE_MAPPED = 0xC0000073;
+ internal const uint STATUS_INSUFFICIENT_RESOURCES = 0xC000009A;
+ internal const uint STATUS_ACCESS_DENIED = 0xC0000022;
+
+ internal const int INVALID_FILE_SIZE = -1;
+
+ // From WinStatus.h
+ internal const int STATUS_ACCOUNT_RESTRICTION = unchecked((int) 0xC000006E);
+
+ // Use this to translate error codes like the above into HRESULTs like
+ // 0x80070006 for ERROR_INVALID_HANDLE
+ internal static int MakeHRFromErrorCode(int errorCode)
+ {
+ BCLDebug.Assert((0xFFFF0000 & errorCode) == 0, "This is an HRESULT, not an error code!");
+ return unchecked(((int)0x80070000) | errorCode);
+ }
+
+ // Win32 Structs in N/Direct style
+ [Serializable]
+ [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)]
+ [BestFitMapping(false)]
+ internal class WIN32_FIND_DATA {
+ internal int dwFileAttributes = 0;
+ // ftCreationTime was a by-value FILETIME structure
+ internal uint ftCreationTime_dwLowDateTime = 0 ;
+ internal uint ftCreationTime_dwHighDateTime = 0;
+ // ftLastAccessTime was a by-value FILETIME structure
+ internal uint ftLastAccessTime_dwLowDateTime = 0;
+ internal uint ftLastAccessTime_dwHighDateTime = 0;
+ // ftLastWriteTime was a by-value FILETIME structure
+ internal uint ftLastWriteTime_dwLowDateTime = 0;
+ internal uint ftLastWriteTime_dwHighDateTime = 0;
+ internal int nFileSizeHigh = 0;
+ internal int nFileSizeLow = 0;
+ // If the file attributes' reparse point flag is set, then
+ // dwReserved0 is the file tag (aka reparse tag) for the
+ // reparse point. Use this to figure out whether something is
+ // a volume mount point or a symbolic link.
+ internal int dwReserved0 = 0;
+ internal int dwReserved1 = 0;
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst=260)]
+ internal String cFileName = null;
+ [MarshalAs(UnmanagedType.ByValTStr, SizeConst=14)]
+ internal String cAlternateFileName = null;
+ }
+
+#if FEATURE_CORESYSTEM
+ [DllImport(KERNEL32, SetLastError=true, CharSet=CharSet.Auto, BestFitMapping=false)]
+ private static extern bool CopyFileEx(String src,
+ String dst,
+ IntPtr progressRoutine,
+ IntPtr progressData,
+ ref uint cancel,
+ uint flags);
+
+ internal static bool CopyFile(String src, String dst, bool failIfExists)
+ {
+ uint cancel = 0;
+ return CopyFileEx(src, dst, IntPtr.Zero, IntPtr.Zero, ref cancel, failIfExists ? 1U : 0U);
+ }
+#else // FEATURE_CORESYSTEM
+ [DllImport(KERNEL32, SetLastError=true, CharSet=CharSet.Auto, BestFitMapping=false)]
+ internal static extern bool CopyFile(
+ String src, String dst, bool failIfExists);
+#endif // FEATURE_CORESYSTEM
+
+ [DllImport(KERNEL32, SetLastError=true, CharSet=CharSet.Auto, BestFitMapping=false)]
+ internal static extern bool CreateDirectory(
+ String path, SECURITY_ATTRIBUTES lpSecurityAttributes);
+
+ [DllImport(KERNEL32, SetLastError=true, CharSet=CharSet.Auto, BestFitMapping=false)]
+ internal static extern bool DeleteFile(String path);
+
+ [DllImport(KERNEL32, SetLastError=true, CharSet=CharSet.Auto, BestFitMapping=false)]
+ internal static extern bool ReplaceFile(String replacedFileName, String replacementFileName, String backupFileName, int dwReplaceFlags, IntPtr lpExclude, IntPtr lpReserved);
+
+ [DllImport(ADVAPI32, SetLastError=true, CharSet=CharSet.Auto, BestFitMapping=false)]
+ internal static extern bool DecryptFile(String path, int reservedMustBeZero);
+
+ [DllImport(ADVAPI32, SetLastError=true, CharSet=CharSet.Auto, BestFitMapping=false)]
+ internal static extern bool EncryptFile(String path);
+
+ [DllImport(KERNEL32, SetLastError=true, CharSet=CharSet.Auto, BestFitMapping=false)]
+ internal static extern SafeFindHandle FindFirstFile(String fileName, [In, Out] Win32Native.WIN32_FIND_DATA data);
+
+ [DllImport(KERNEL32, SetLastError=true, CharSet=CharSet.Auto, BestFitMapping=false)]
+ internal static extern bool FindNextFile(
+ SafeFindHandle hndFindFile,
+ [In, Out, MarshalAs(UnmanagedType.LPStruct)]
+ WIN32_FIND_DATA lpFindFileData);
+
+ [DllImport(KERNEL32)]
+ [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
+ internal static extern bool FindClose(IntPtr handle);
+
+ [DllImport(KERNEL32, SetLastError=true, CharSet=CharSet.Auto, BestFitMapping=false)]
+ internal static extern int GetCurrentDirectory(
+ int nBufferLength,
+ [Out]StringBuilder lpBuffer);
+
+ [DllImport(KERNEL32, SetLastError = true, ExactSpelling = true)]
+ internal static extern uint GetCurrentDirectoryW(uint nBufferLength, SafeHandle lpBuffer);
+
+ [DllImport(KERNEL32, SetLastError=true, CharSet=CharSet.Auto, BestFitMapping=false)]
+ internal static extern bool GetFileAttributesEx(String name, int fileInfoLevel, ref WIN32_FILE_ATTRIBUTE_DATA lpFileInformation);
+
+ [DllImport(KERNEL32, SetLastError=true, CharSet=CharSet.Auto, BestFitMapping=false)]
+ internal static extern bool SetFileAttributes(String name, int attr);
+
+ [DllImport(KERNEL32, SetLastError=true)]
+ internal static extern int GetLogicalDrives();
+
+ [DllImport(KERNEL32, CharSet=CharSet.Auto, SetLastError=true, BestFitMapping=false)]
+ internal static extern uint GetTempFileName(String tmpPath, String prefix, uint uniqueIdOrZero, [Out]StringBuilder tmpFileName);
+
+#if FEATURE_CORESYSTEM
+ [DllImport(KERNEL32, SetLastError=true, CharSet=CharSet.Auto, BestFitMapping=false)]
+ private static extern bool MoveFileEx(String src, String dst, uint flags);
+
+ internal static bool MoveFile(String src, String dst)
+ {
+ return MoveFileEx(src, dst, 2 /* MOVEFILE_COPY_ALLOWED */);
+ }
+#else // FEATURE_CORESYSTEM
+ [DllImport(KERNEL32, SetLastError=true, CharSet=CharSet.Auto, BestFitMapping=false)]
+ internal static extern bool MoveFile(String src, String dst);
+#endif // FEATURE_CORESYSTEM
+
+ [DllImport(KERNEL32, SetLastError=true, CharSet=CharSet.Auto, BestFitMapping=false)]
+ internal static extern bool DeleteVolumeMountPoint(String mountPoint);
+
+ [DllImport(KERNEL32, SetLastError=true, CharSet=CharSet.Auto, BestFitMapping=false)]
+ internal static extern bool RemoveDirectory(String path);
+
+ [DllImport(KERNEL32, SetLastError=true, CharSet=CharSet.Auto, BestFitMapping=false)]
+ internal static extern bool SetCurrentDirectory(String path);
+
+ [DllImport(KERNEL32, SetLastError=false, EntryPoint="SetErrorMode", ExactSpelling=true)]
+ private static extern int SetErrorMode_VistaAndOlder(int newMode);
+
+ [DllImport(KERNEL32, SetLastError=true, EntryPoint="SetThreadErrorMode")]
+ private static extern bool SetErrorMode_Win7AndNewer(int newMode, out int oldMode);
+
+ // RTM versions of Win7 and Windows Server 2008 R2
+ private static readonly Version ThreadErrorModeMinOsVersion = new Version(6, 1, 7600);
+
+ // this method uses the thread-safe version of SetErrorMode on Windows 7 / Windows Server 2008 R2 operating systems.
+ internal static int SetErrorMode(int newMode)
+ {
+#if !FEATURE_CORESYSTEM // ARMSTUB
+ if (Environment.OSVersion.Version >= ThreadErrorModeMinOsVersion)
+ {
+ int oldMode;
+ SetErrorMode_Win7AndNewer(newMode, out oldMode);
+ return oldMode;
+ }
+#endif
+ return SetErrorMode_VistaAndOlder(newMode);
+ }
+
+ internal const int LCID_SUPPORTED = 0x00000002; // supported locale ids
+
+ [DllImport(KERNEL32)]
+ internal static extern unsafe int WideCharToMultiByte(uint cp, uint flags, char* pwzSource, int cchSource, byte* pbDestBuffer, int cbDestBuffer, IntPtr null1, IntPtr null2);
+
+ // A Win32 HandlerRoutine
+ internal delegate bool ConsoleCtrlHandlerRoutine(int controlType);
+
+ [DllImport(KERNEL32, SetLastError=true)]
+ [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
+ internal static extern bool SetConsoleCtrlHandler(ConsoleCtrlHandlerRoutine handler, bool addOrRemove);
+
+ [DllImport(KERNEL32, CharSet=CharSet.Auto, SetLastError=true, BestFitMapping=false)]
+ internal static extern bool SetEnvironmentVariable(string lpName, string lpValue);
+
+ [DllImport(KERNEL32, CharSet=CharSet.Auto, SetLastError=true, BestFitMapping=false)]
+ internal static extern int GetEnvironmentVariable(string lpName, [Out]StringBuilder lpValue, int size);
+
+ [DllImport(KERNEL32, CharSet=CharSet.Unicode)]
+ internal static unsafe extern char * GetEnvironmentStrings();
+
+ [DllImport(KERNEL32, CharSet=CharSet.Unicode)]
+ internal static unsafe extern bool FreeEnvironmentStrings(char * pStrings);
+
+ [DllImport(KERNEL32, CharSet=CharSet.Auto, SetLastError=true)]
+ internal static extern uint GetCurrentProcessId();
+
+ [DllImport(ADVAPI32, CharSet=CharSet.Auto)]
+ internal static extern bool GetUserName([Out]StringBuilder lpBuffer, ref int nSize);
+
+ [DllImport(KERNEL32, CharSet=CharSet.Auto, BestFitMapping=false)]
+ internal extern static int GetComputerName([Out]StringBuilder nameBuffer, ref int bufferSize);
+
+ [DllImport(OLE32)]
+ internal extern static int CoCreateGuid(out Guid guid);
+
+ [DllImport(OLE32)]
+ internal static extern IntPtr CoTaskMemAlloc(UIntPtr cb);
+
+ [DllImport(OLE32)]
+ internal static extern void CoTaskMemFree(IntPtr ptr);
+
+ [DllImport(OLE32)]
+ internal static extern IntPtr CoTaskMemRealloc(IntPtr pv, UIntPtr cb);
+
+ [StructLayoutAttribute(LayoutKind.Sequential)]
+ internal struct COORD
+ {
+ internal short X;
+ internal short Y;
+ }
+
+ [StructLayoutAttribute(LayoutKind.Sequential)]
+ internal struct SMALL_RECT
+ {
+ internal short Left;
+ internal short Top;
+ internal short Right;
+ internal short Bottom;
+ }
+
+ [StructLayoutAttribute(LayoutKind.Sequential)]
+ internal struct CONSOLE_SCREEN_BUFFER_INFO
+ {
+ internal COORD dwSize;
+ internal COORD dwCursorPosition;
+ internal short wAttributes;
+ internal SMALL_RECT srWindow;
+ internal COORD dwMaximumWindowSize;
+ }
+
+ [StructLayoutAttribute(LayoutKind.Sequential)]
+ internal struct CONSOLE_CURSOR_INFO
+ {
+ internal int dwSize;
+ internal bool bVisible;
+ }
+
+ // Win32's KEY_EVENT_RECORD
+ [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)]
+ internal struct KeyEventRecord
+ {
+ internal bool keyDown;
+ internal short repeatCount;
+ internal short virtualKeyCode;
+ internal short virtualScanCode;
+ internal char uChar; // Union between WCHAR and ASCII char
+ internal int controlKeyState;
+ }
+
+ // Really, this is a union of KeyEventRecords and other types.
+ [StructLayout(LayoutKind.Sequential, CharSet=CharSet.Auto)]
+ internal struct InputRecord
+ {
+ internal short eventType;
+ internal KeyEventRecord keyEvent;
+ // This struct is a union! Word alighment should take care of padding!
+ }
+
+[Serializable]
+ [Flags]
+ internal enum Color : short
+ {
+ Black = 0,
+ ForegroundBlue = 0x1,
+ ForegroundGreen = 0x2,
+ ForegroundRed = 0x4,
+ ForegroundYellow = 0x6,
+ ForegroundIntensity = 0x8,
+ BackgroundBlue = 0x10,
+ BackgroundGreen = 0x20,
+ BackgroundRed = 0x40,
+ BackgroundYellow = 0x60,
+ BackgroundIntensity = 0x80,
+
+ ForegroundMask = 0xf,
+ BackgroundMask = 0xf0,
+ ColorMask = 0xff
+ }
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal struct CHAR_INFO
+ {
+ ushort charData; // Union between WCHAR and ASCII char
+ short attributes;
+ }
+
+ internal const int ENABLE_PROCESSED_INPUT = 0x0001;
+ internal const int ENABLE_LINE_INPUT = 0x0002;
+ internal const int ENABLE_ECHO_INPUT = 0x0004;
+
+ [DllImport(KERNEL32, SetLastError=true)]
+ internal static extern bool SetConsoleMode(IntPtr hConsoleHandle, int mode);
+
+ [DllImport(KERNEL32, SetLastError=true)]
+ internal static extern bool GetConsoleMode(IntPtr hConsoleHandle, out int mode);
+
+ [DllImport(KERNEL32, SetLastError=true)]
+ internal static extern bool Beep(int frequency, int duration);
+
+ [DllImport(KERNEL32, SetLastError=true)]
+ internal static extern bool GetConsoleScreenBufferInfo(IntPtr hConsoleOutput,
+ out CONSOLE_SCREEN_BUFFER_INFO lpConsoleScreenBufferInfo);
+
+ [DllImport(KERNEL32, SetLastError=true)]
+ internal static extern bool SetConsoleScreenBufferSize(IntPtr hConsoleOutput, COORD size);
+
+ [DllImport(KERNEL32, SetLastError=true)]
+ internal static extern COORD GetLargestConsoleWindowSize(IntPtr hConsoleOutput);
+
+ [DllImport(KERNEL32, CharSet=CharSet.Auto, SetLastError=true)]
+ internal static extern bool FillConsoleOutputCharacter(IntPtr hConsoleOutput,
+ char character, int nLength, COORD dwWriteCoord, out int pNumCharsWritten);
+
+ [DllImport(KERNEL32, SetLastError=true)]
+ internal static extern bool FillConsoleOutputAttribute(IntPtr hConsoleOutput,
+ short wColorAttribute, int numCells, COORD startCoord, out int pNumBytesWritten);
+
+ [DllImport(KERNEL32, SetLastError=true)]
+ internal static unsafe extern bool SetConsoleWindowInfo(IntPtr hConsoleOutput,
+ bool absolute, SMALL_RECT* consoleWindow);
+
+ [DllImport(KERNEL32, SetLastError=true)]
+ internal static extern bool SetConsoleTextAttribute(IntPtr hConsoleOutput, short attributes);
+
+ [DllImport(KERNEL32, SetLastError=true)]
+ internal static extern bool SetConsoleCursorPosition(IntPtr hConsoleOutput,
+ COORD cursorPosition);
+
+ [DllImport(KERNEL32, SetLastError=true)]
+ internal static extern bool GetConsoleCursorInfo(IntPtr hConsoleOutput,
+ out CONSOLE_CURSOR_INFO cci);
+
+ [DllImport(KERNEL32, SetLastError=true)]
+ internal static extern bool SetConsoleCursorInfo(IntPtr hConsoleOutput,
+ ref CONSOLE_CURSOR_INFO cci);
+
+ [DllImport(KERNEL32, CharSet=CharSet.Auto, SetLastError=true, BestFitMapping=true)]
+ internal static extern bool SetConsoleTitle(String title);
+
+ [DllImport(KERNEL32, CharSet=CharSet.Auto, SetLastError=true)]
+ internal static extern bool ReadConsoleInput(IntPtr hConsoleInput, out InputRecord buffer, int numInputRecords_UseOne, out int numEventsRead);
+
+ [DllImport(KERNEL32, CharSet=CharSet.Auto, SetLastError=true)]
+ internal static extern bool PeekConsoleInput(IntPtr hConsoleInput, out InputRecord buffer, int numInputRecords_UseOne, out int numEventsRead);
+
+ [DllImport(KERNEL32, SetLastError=true)]
+ internal static unsafe extern bool ReadConsoleOutput(IntPtr hConsoleOutput, CHAR_INFO* pBuffer, COORD bufferSize, COORD bufferCoord, ref SMALL_RECT readRegion);
+
+ [DllImport(KERNEL32, CharSet=CharSet.Unicode, SetLastError=true)]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ internal static unsafe extern bool ReadConsoleW(SafeFileHandle hConsoleInput, Byte* lpBuffer, Int32 nNumberOfCharsToRead, out Int32 lpNumberOfCharsRead, IntPtr pInputControl);
+
+ [DllImport(KERNEL32, SetLastError=true)]
+ internal static unsafe extern bool WriteConsoleOutput(IntPtr hConsoleOutput, CHAR_INFO* buffer, COORD bufferSize, COORD bufferCoord, ref SMALL_RECT writeRegion);
+
+ [DllImport(KERNEL32, CharSet=CharSet.Unicode, SetLastError=true)]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ internal static unsafe extern bool WriteConsoleW(SafeFileHandle hConsoleOutput, Byte* lpBuffer, Int32 nNumberOfCharsToWrite, out Int32 lpNumberOfCharsWritten, IntPtr lpReservedMustBeNull);
+
+ [DllImport(USER32)] // Appears to always succeed
+ internal static extern short GetKeyState(int virtualKeyCode);
+
+ [DllImport(KERNEL32, SetLastError=false)]
+ internal static extern uint GetConsoleCP();
+
+ [DllImport(KERNEL32, SetLastError=true)]
+ internal static extern bool SetConsoleCP(uint codePage);
+
+ [DllImport(KERNEL32, SetLastError=false)]
+ internal static extern uint GetConsoleOutputCP();
+
+ [DllImport(KERNEL32, SetLastError=true)]
+ internal static extern bool SetConsoleOutputCP(uint codePage);
+
+#if FEATURE_WIN32_REGISTRY
+ [DllImport(ADVAPI32, CharSet=CharSet.Auto, BestFitMapping=false)]
+ internal static extern int RegConnectRegistry(String machineName,
+ SafeRegistryHandle key, out SafeRegistryHandle result);
+
+ // Note: RegCreateKeyEx won't set the last error on failure - it returns
+ // an error code if it fails.
+ [DllImport(ADVAPI32, CharSet=CharSet.Auto, BestFitMapping=false)]
+ internal static extern int RegCreateKeyEx(SafeRegistryHandle hKey, String lpSubKey,
+ int Reserved, String lpClass, int dwOptions,
+ int samDesired, SECURITY_ATTRIBUTES lpSecurityAttributes,
+ out SafeRegistryHandle hkResult, out int lpdwDisposition);
+
+ [DllImport(ADVAPI32, CharSet=CharSet.Auto, BestFitMapping=false)]
+ internal static extern int RegDeleteKey(SafeRegistryHandle hKey, String lpSubKey);
+
+ [DllImport(ADVAPI32, CharSet=CharSet.Auto, BestFitMapping=false)]
+ internal static extern int RegDeleteKeyEx(SafeRegistryHandle hKey, String lpSubKey,
+ int samDesired, int Reserved);
+
+ [DllImport(ADVAPI32, CharSet=CharSet.Auto, BestFitMapping=false)]
+ internal static extern int RegDeleteValue(SafeRegistryHandle hKey, String lpValueName);
+
+ [DllImport(ADVAPI32, CharSet=CharSet.Auto, BestFitMapping=false)]
+ internal unsafe static extern int RegEnumKeyEx(SafeRegistryHandle hKey, int dwIndex,
+ char *lpName, ref int lpcbName, int[] lpReserved,
+ [Out]StringBuilder lpClass, int[] lpcbClass,
+ long[] lpftLastWriteTime);
+
+ [DllImport(ADVAPI32, CharSet=CharSet.Auto, BestFitMapping=false)]
+ internal unsafe static extern int RegEnumValue(SafeRegistryHandle hKey, int dwIndex,
+ char *lpValueName, ref int lpcbValueName,
+ IntPtr lpReserved_MustBeZero, int[] lpType, byte[] lpData,
+ int[] lpcbData);
+
+
+ [DllImport(ADVAPI32)]
+ internal static extern int RegFlushKey(SafeRegistryHandle hKey);
+
+ [DllImport(ADVAPI32, CharSet=CharSet.Auto, BestFitMapping=false)]
+ internal static extern int RegOpenKeyEx(SafeRegistryHandle hKey, String lpSubKey,
+ int ulOptions, int samDesired, out SafeRegistryHandle hkResult);
+
+ [DllImport(ADVAPI32, CharSet=CharSet.Auto, BestFitMapping=false)]
+ internal static extern int RegOpenKeyEx(IntPtr hKey, String lpSubKey,
+ int ulOptions, int samDesired, out SafeRegistryHandle hkResult);
+
+ [DllImport(ADVAPI32, CharSet=CharSet.Auto, BestFitMapping=false)]
+ internal static extern int RegQueryInfoKey(SafeRegistryHandle hKey, [Out]StringBuilder lpClass,
+ int[] lpcbClass, IntPtr lpReserved_MustBeZero, ref int lpcSubKeys,
+ int[] lpcbMaxSubKeyLen, int[] lpcbMaxClassLen,
+ ref int lpcValues, int[] lpcbMaxValueNameLen,
+ int[] lpcbMaxValueLen, int[] lpcbSecurityDescriptor,
+ int[] lpftLastWriteTime);
+
+ [DllImport(ADVAPI32, CharSet=CharSet.Auto, BestFitMapping=false)]
+ internal static extern int RegQueryValueEx(SafeRegistryHandle hKey, String lpValueName,
+ int[] lpReserved, ref int lpType, [Out] byte[] lpData,
+ ref int lpcbData);
+
+ [DllImport(ADVAPI32, CharSet=CharSet.Auto, BestFitMapping=false)]
+ internal static extern int RegQueryValueEx(SafeRegistryHandle hKey, String lpValueName,
+ int[] lpReserved, ref int lpType, ref int lpData,
+ ref int lpcbData);
+
+ [DllImport(ADVAPI32, CharSet=CharSet.Auto, BestFitMapping=false)]
+ internal static extern int RegQueryValueEx(SafeRegistryHandle hKey, String lpValueName,
+ int[] lpReserved, ref int lpType, ref long lpData,
+ ref int lpcbData);
+
+ [DllImport(ADVAPI32, CharSet=CharSet.Auto, BestFitMapping=false)]
+ internal static extern int RegQueryValueEx(SafeRegistryHandle hKey, String lpValueName,
+ int[] lpReserved, ref int lpType, [Out] char[] lpData,
+ ref int lpcbData);
+
+ [DllImport(ADVAPI32, CharSet=CharSet.Auto, BestFitMapping=false)]
+ internal static extern int RegQueryValueEx(SafeRegistryHandle hKey, String lpValueName,
+ int[] lpReserved, ref int lpType, [Out]StringBuilder lpData,
+ ref int lpcbData);
+
+ [DllImport(ADVAPI32, CharSet=CharSet.Auto, BestFitMapping=false)]
+ internal static extern int RegSetValueEx(SafeRegistryHandle hKey, String lpValueName,
+ int Reserved, RegistryValueKind dwType, byte[] lpData, int cbData);
+
+ [DllImport(ADVAPI32, CharSet=CharSet.Auto, BestFitMapping=false)]
+ internal static extern int RegSetValueEx(SafeRegistryHandle hKey, String lpValueName,
+ int Reserved, RegistryValueKind dwType, ref int lpData, int cbData);
+
+ [DllImport(ADVAPI32, CharSet=CharSet.Auto, BestFitMapping=false)]
+ internal static extern int RegSetValueEx(SafeRegistryHandle hKey, String lpValueName,
+ int Reserved, RegistryValueKind dwType, ref long lpData, int cbData);
+
+ [DllImport(ADVAPI32, CharSet=CharSet.Auto, BestFitMapping=false)]
+ internal static extern int RegSetValueEx(SafeRegistryHandle hKey, String lpValueName,
+ int Reserved, RegistryValueKind dwType, String lpData, int cbData);
+#endif // FEATURE_WIN32_REGISTRY
+
+ [DllImport(KERNEL32, CharSet=CharSet.Auto, SetLastError=true, BestFitMapping=false)]
+ internal static extern int ExpandEnvironmentStrings(String lpSrc, [Out]StringBuilder lpDst, int nSize);
+
+ [DllImport(KERNEL32)]
+ internal static extern IntPtr LocalReAlloc(IntPtr handle, IntPtr sizetcbBytes, int uFlags);
+
+ internal const int SHGFP_TYPE_CURRENT = 0; // the current (user) folder path setting
+ internal const int UOI_FLAGS = 1;
+ internal const int WSF_VISIBLE = 1;
+
+ // .NET Framework 4.0 and newer - all versions of windows ||| \public\sdk\inc\shlobj.h
+ internal const int CSIDL_FLAG_CREATE = 0x8000; // force folder creation in SHGetFolderPath
+ internal const int CSIDL_FLAG_DONT_VERIFY = 0x4000; // return an unverified folder path
+ internal const int CSIDL_ADMINTOOLS = 0x0030; // <user name>\Start Menu\Programs\Administrative Tools
+ internal const int CSIDL_CDBURN_AREA = 0x003b; // USERPROFILE\Local Settings\Application Data\Microsoft\CD Burning
+ internal const int CSIDL_COMMON_ADMINTOOLS = 0x002f; // All Users\Start Menu\Programs\Administrative Tools
+ internal const int CSIDL_COMMON_DOCUMENTS = 0x002e; // All Users\Documents
+ internal const int CSIDL_COMMON_MUSIC = 0x0035; // All Users\My Music
+ internal const int CSIDL_COMMON_OEM_LINKS = 0x003a; // Links to All Users OEM specific apps
+ internal const int CSIDL_COMMON_PICTURES = 0x0036; // All Users\My Pictures
+ internal const int CSIDL_COMMON_STARTMENU = 0x0016; // All Users\Start Menu
+ internal const int CSIDL_COMMON_PROGRAMS = 0X0017; // All Users\Start Menu\Programs
+ internal const int CSIDL_COMMON_STARTUP = 0x0018; // All Users\Startup
+ internal const int CSIDL_COMMON_DESKTOPDIRECTORY = 0x0019; // All Users\Desktop
+ internal const int CSIDL_COMMON_TEMPLATES = 0x002d; // All Users\Templates
+ internal const int CSIDL_COMMON_VIDEO = 0x0037; // All Users\My Video
+ internal const int CSIDL_FONTS = 0x0014; // windows\fonts
+ internal const int CSIDL_MYVIDEO = 0x000e; // "My Videos" folder
+ internal const int CSIDL_NETHOOD = 0x0013; // %APPDATA%\Microsoft\Windows\Network Shortcuts
+ internal const int CSIDL_PRINTHOOD = 0x001b; // %APPDATA%\Microsoft\Windows\Printer Shortcuts
+ internal const int CSIDL_PROFILE = 0x0028; // %USERPROFILE% (%SystemDrive%\Users\%USERNAME%)
+ internal const int CSIDL_PROGRAM_FILES_COMMONX86 = 0x002c; // x86 Program Files\Common on RISC
+ internal const int CSIDL_PROGRAM_FILESX86 = 0x002a; // x86 C:\Program Files on RISC
+ internal const int CSIDL_RESOURCES = 0x0038; // %windir%\Resources
+ internal const int CSIDL_RESOURCES_LOCALIZED = 0x0039; // %windir%\resources\0409 (code page)
+ internal const int CSIDL_SYSTEMX86 = 0x0029; // %windir%\system32
+ internal const int CSIDL_WINDOWS = 0x0024; // GetWindowsDirectory()
+
+ // .NET Framework 3.5 and earlier - all versions of windows
+ internal const int CSIDL_APPDATA = 0x001a;
+ internal const int CSIDL_COMMON_APPDATA = 0x0023;
+ internal const int CSIDL_LOCAL_APPDATA = 0x001c;
+ internal const int CSIDL_COOKIES = 0x0021;
+ internal const int CSIDL_FAVORITES = 0x0006;
+ internal const int CSIDL_HISTORY = 0x0022;
+ internal const int CSIDL_INTERNET_CACHE = 0x0020;
+ internal const int CSIDL_PROGRAMS = 0x0002;
+ internal const int CSIDL_RECENT = 0x0008;
+ internal const int CSIDL_SENDTO = 0x0009;
+ internal const int CSIDL_STARTMENU = 0x000b;
+ internal const int CSIDL_STARTUP = 0x0007;
+ internal const int CSIDL_SYSTEM = 0x0025;
+ internal const int CSIDL_TEMPLATES = 0x0015;
+ internal const int CSIDL_DESKTOPDIRECTORY = 0x0010;
+ internal const int CSIDL_PERSONAL = 0x0005;
+ internal const int CSIDL_PROGRAM_FILES = 0x0026;
+ internal const int CSIDL_PROGRAM_FILES_COMMON = 0x002b;
+ internal const int CSIDL_DESKTOP = 0x0000;
+ internal const int CSIDL_DRIVES = 0x0011;
+ internal const int CSIDL_MYMUSIC = 0x000d;
+ internal const int CSIDL_MYPICTURES = 0x0027;
+
+ [DllImport(SHELL32, CharSet=CharSet.Auto, BestFitMapping=false)]
+ internal static extern int SHGetFolderPath(IntPtr hwndOwner, int nFolder, IntPtr hToken, int dwFlags, [Out]StringBuilder lpszPath);
+
+ internal const int NameSamCompatible = 2;
+
+ [DllImport(SECUR32, CharSet=CharSet.Unicode, SetLastError=true)]
+ // Win32 return type is BOOLEAN (which is 1 byte and not BOOL which is 4bytes)
+ internal static extern byte GetUserNameEx(int format, [Out]StringBuilder domainName, ref uint domainNameLen);
+
+ [DllImport(ADVAPI32, CharSet=CharSet.Auto, SetLastError=true, BestFitMapping=false)]
+ internal static extern bool LookupAccountName(string machineName, string accountName, byte[] sid,
+ ref int sidLen, [Out]StringBuilder domainName, ref uint domainNameLen, out int peUse);
+
+ // Note: This returns a handle, but it shouldn't be closed. The Avalon
+ // team says CloseWindowStation would ignore this handle. So there
+ // isn't a lot of value to switching to SafeHandle here.
+ [DllImport(USER32, ExactSpelling=true)]
+ internal static extern IntPtr GetProcessWindowStation();
+
+ [DllImport(USER32, SetLastError=true)]
+ internal static extern bool GetUserObjectInformation(IntPtr hObj, int nIndex,
+ [MarshalAs(UnmanagedType.LPStruct)] USEROBJECTFLAGS pvBuffer, int nLength, ref int lpnLengthNeeded);
+
+ [DllImport(USER32, SetLastError=true, BestFitMapping=false)]
+ internal static extern IntPtr SendMessageTimeout(IntPtr hWnd, int Msg, IntPtr wParam, String lParam, uint fuFlags, uint uTimeout, IntPtr lpdwResult);
+
+ [StructLayout(LayoutKind.Sequential)]
+ internal class USEROBJECTFLAGS {
+ internal int fInherit = 0;
+ internal int fReserved = 0;
+ internal int dwFlags = 0;
+ }
+
+ //
+ // DPAPI
+ //
+
+#if FEATURE_LEGACYSURFACE
+ //
+ // RtlEncryptMemory and RtlDecryptMemory are declared in the internal header file crypt.h.
+ // They were also recently declared in the public header file ntsecapi.h (in the Platform SDK as well as the current build of Server 2003).
+ // We use them instead of CryptProtectMemory and CryptUnprotectMemory because
+ // they are available in both WinXP and in Windows Server 2003.
+ //
+
+ [DllImport(Win32Native.ADVAPI32, CharSet=CharSet.Unicode, SetLastError=true)]
+ [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
+ internal static extern
+ int SystemFunction040 (
+ [In,Out] SafeBSTRHandle pDataIn,
+ [In] uint cbDataIn, // multiple of RTL_ENCRYPT_MEMORY_SIZE
+ [In] uint dwFlags);
+
+ [DllImport(Win32Native.ADVAPI32, CharSet=CharSet.Unicode, SetLastError=true)]
+ internal static extern
+ int SystemFunction041 (
+ [In,Out] SafeBSTRHandle pDataIn,
+ [In] uint cbDataIn, // multiple of RTL_ENCRYPT_MEMORY_SIZE
+ [In] uint dwFlags);
+#endif // FEATURE_LEGACYSURFACE
+
+#if FEATURE_CORECLR
+ [DllImport(NTDLL, CharSet=CharSet.Unicode, SetLastError=true)]
+ internal static extern
+ int RtlNtStatusToDosError (
+ [In] int status);
+#else
+ // identical to RtlNtStatusToDosError, but we are in ask mode for desktop CLR
+ [DllImport(ADVAPI32, CharSet = CharSet.Unicode, SetLastError = true)]
+ internal static extern
+ int LsaNtStatusToWinError (
+ [In] int status);
+#endif
+ // Get the current FIPS policy setting on Vista and above
+ [DllImport("bcrypt.dll")]
+ internal static extern uint BCryptGetFipsAlgorithmMode(
+ [MarshalAs(UnmanagedType.U1), Out]out bool pfEnabled);
+
+ //
+ // Managed ACLs
+ //
+
+ [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
+ [DllImport(ADVAPI32, CharSet=CharSet.Unicode, SetLastError=true)]
+ internal static extern
+ bool AdjustTokenPrivileges (
+ [In] SafeAccessTokenHandle TokenHandle,
+ [In] bool DisableAllPrivileges,
+ [In] ref TOKEN_PRIVILEGE NewState,
+ [In] uint BufferLength,
+ [In,Out] ref TOKEN_PRIVILEGE PreviousState,
+ [In,Out] ref uint ReturnLength);
+
+ [DllImport(ADVAPI32, CharSet=CharSet.Unicode, SetLastError=true)]
+ internal static extern
+ bool AllocateLocallyUniqueId(
+ [In,Out] ref LUID Luid);
+
+ [DllImport(ADVAPI32, CharSet=CharSet.Unicode, SetLastError=true)]
+ internal static extern
+ bool CheckTokenMembership(
+ [In] SafeAccessTokenHandle TokenHandle,
+ [In] byte[] SidToCheck,
+ [In,Out] ref bool IsMember);
+
+ [DllImport(
+ ADVAPI32,
+ EntryPoint="ConvertSecurityDescriptorToStringSecurityDescriptorW",
+ CallingConvention=CallingConvention.Winapi,
+ SetLastError=true,
+ ExactSpelling=true,
+ CharSet=CharSet.Unicode)]
+ internal static extern BOOL ConvertSdToStringSd(
+ byte[] securityDescriptor,
+ /* DWORD */ uint requestedRevision,
+ ULONG securityInformation,
+ out IntPtr resultString,
+ ref ULONG resultStringLength );
+
+ [DllImport(
+ ADVAPI32,
+ EntryPoint="ConvertStringSecurityDescriptorToSecurityDescriptorW",
+ CallingConvention=CallingConvention.Winapi,
+ SetLastError=true,
+ ExactSpelling=true,
+ CharSet=CharSet.Unicode)]
+ internal static extern BOOL ConvertStringSdToSd(
+ string stringSd,
+ /* DWORD */ uint stringSdRevision,
+ out IntPtr resultSd,
+ ref ULONG resultSdLength );
+
+ [DllImport(
+ ADVAPI32,
+ EntryPoint="ConvertStringSidToSidW",
+ CallingConvention=CallingConvention.Winapi,
+ SetLastError=true,
+ ExactSpelling=true,
+ CharSet=CharSet.Unicode)]
+ internal static extern BOOL ConvertStringSidToSid(
+ string stringSid,
+ out IntPtr ByteArray
+ );
+
+ [DllImport(
+ ADVAPI32,
+ EntryPoint = "ConvertSidToStringSidW",
+ CallingConvention = CallingConvention.Winapi,
+ SetLastError = true,
+ ExactSpelling = true,
+ CharSet = CharSet.Unicode)]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ internal static extern bool ConvertSidToStringSid(
+ IntPtr Sid,
+ ref IntPtr StringSid
+ );
+
+
+ [DllImport(
+ ADVAPI32,
+ EntryPoint="CreateWellKnownSid",
+ CallingConvention=CallingConvention.Winapi,
+ SetLastError=true,
+ ExactSpelling=true,
+ CharSet=CharSet.Unicode)]
+ internal static extern BOOL CreateWellKnownSid(
+ int sidType,
+ byte[] domainSid,
+ [Out] byte[] resultSid,
+ ref /*DWORD*/ uint resultSidLength );
+
+ [DllImport(KERNEL32, CharSet=CharSet.Auto, SetLastError=true)]
+ internal static extern
+ bool DuplicateHandle (
+ [In] IntPtr hSourceProcessHandle,
+ [In] IntPtr hSourceHandle,
+ [In] IntPtr hTargetProcessHandle,
+ [In,Out] ref SafeAccessTokenHandle lpTargetHandle,
+ [In] uint dwDesiredAccess,
+ [In] bool bInheritHandle,
+ [In] uint dwOptions);
+
+ [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
+ [DllImport(KERNEL32, CharSet=CharSet.Auto, SetLastError=true)]
+ internal static extern
+ bool DuplicateHandle (
+ [In] IntPtr hSourceProcessHandle,
+ [In] SafeAccessTokenHandle hSourceHandle,
+ [In] IntPtr hTargetProcessHandle,
+ [In,Out] ref SafeAccessTokenHandle lpTargetHandle,
+ [In] uint dwDesiredAccess,
+ [In] bool bInheritHandle,
+ [In] uint dwOptions);
+
+#if FEATURE_IMPERSONATION
+ [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
+ [DllImport(ADVAPI32, CharSet=CharSet.Auto, SetLastError=true)]
+ internal static extern
+ bool DuplicateTokenEx (
+ [In] SafeAccessTokenHandle ExistingTokenHandle,
+ [In] TokenAccessLevels DesiredAccess,
+ [In] IntPtr TokenAttributes,
+ [In] SECURITY_IMPERSONATION_LEVEL ImpersonationLevel,
+ [In] System.Security.Principal.TokenType TokenType,
+ [In,Out] ref SafeAccessTokenHandle DuplicateTokenHandle );
+
+ [DllImport(ADVAPI32, CharSet=CharSet.Auto, SetLastError=true)]
+ internal static extern
+ bool DuplicateTokenEx (
+ [In] SafeAccessTokenHandle hExistingToken,
+ [In] uint dwDesiredAccess,
+ [In] IntPtr lpTokenAttributes, // LPSECURITY_ATTRIBUTES
+ [In] uint ImpersonationLevel,
+ [In] uint TokenType,
+ [In,Out] ref SafeAccessTokenHandle phNewToken);
+#endif
+ [DllImport(
+ ADVAPI32,
+ EntryPoint="EqualDomainSid",
+ CallingConvention=CallingConvention.Winapi,
+ SetLastError=true,
+ ExactSpelling=true,
+ CharSet=CharSet.Unicode)]
+ internal static extern BOOL IsEqualDomainSid(
+ byte[] sid1,
+ byte[] sid2,
+ out bool result);
+
+ [DllImport(KERNEL32, CharSet=CharSet.Auto, SetLastError=true)]
+ internal static extern IntPtr GetCurrentProcess();
+
+ [DllImport(KERNEL32, CharSet = CharSet.Auto, SetLastError = true)]
+ internal static extern IntPtr GetCurrentThread();
+
+ [DllImport(
+ ADVAPI32,
+ EntryPoint="GetSecurityDescriptorLength",
+ CallingConvention=CallingConvention.Winapi,
+ SetLastError=true,
+ ExactSpelling=true,
+ CharSet=CharSet.Unicode)]
+ internal static extern /*DWORD*/ uint GetSecurityDescriptorLength(
+ IntPtr byteArray );
+
+ [DllImport(
+ ADVAPI32,
+ EntryPoint="GetSecurityInfo",
+ CallingConvention=CallingConvention.Winapi,
+ SetLastError=true,
+ ExactSpelling=true,
+ CharSet=CharSet.Unicode)]
+ internal static extern /*DWORD*/ uint GetSecurityInfoByHandle(
+ SafeHandle handle,
+ /*DWORD*/ uint objectType,
+ /*DWORD*/ uint securityInformation,
+ out IntPtr sidOwner,
+ out IntPtr sidGroup,
+ out IntPtr dacl,
+ out IntPtr sacl,
+ out IntPtr securityDescriptor );
+
+ [DllImport(
+ ADVAPI32,
+ EntryPoint="GetNamedSecurityInfoW",
+ CallingConvention=CallingConvention.Winapi,
+ SetLastError=true,
+ ExactSpelling=true,
+ CharSet=CharSet.Unicode)]
+ internal static extern /*DWORD*/ uint GetSecurityInfoByName(
+ string name,
+ /*DWORD*/ uint objectType,
+ /*DWORD*/ uint securityInformation,
+ out IntPtr sidOwner,
+ out IntPtr sidGroup,
+ out IntPtr dacl,
+ out IntPtr sacl,
+ out IntPtr securityDescriptor );
+
+ [DllImport(ADVAPI32, CharSet=CharSet.Auto, SetLastError=true)]
+ internal static extern
+ bool GetTokenInformation (
+ [In] IntPtr TokenHandle,
+ [In] uint TokenInformationClass,
+ [In] SafeLocalAllocHandle TokenInformation,
+ [In] uint TokenInformationLength,
+ [Out] out uint ReturnLength);
+
+ [DllImport(ADVAPI32, CharSet=CharSet.Auto, SetLastError=true)]
+ internal static extern
+ bool GetTokenInformation (
+ [In] SafeAccessTokenHandle TokenHandle,
+ [In] uint TokenInformationClass,
+ [In] SafeLocalAllocHandle TokenInformation,
+ [In] uint TokenInformationLength,
+ [Out] out uint ReturnLength);
+
+ [DllImport(
+ ADVAPI32,
+ EntryPoint="GetWindowsAccountDomainSid",
+ CallingConvention=CallingConvention.Winapi,
+ SetLastError=true,
+ ExactSpelling=true,
+ CharSet=CharSet.Unicode)]
+ internal static extern BOOL GetWindowsAccountDomainSid(
+ byte[] sid,
+ [Out] byte[] resultSid,
+ ref /*DWORD*/ uint resultSidLength );
+
+ internal enum SECURITY_IMPERSONATION_LEVEL
+ {
+ Anonymous = 0,
+ Identification = 1,
+ Impersonation = 2,
+ Delegation = 3,
+ }
+
+ // Structures and definitions for Claims that are being introduced in Win8
+ // inside the NTTOken - see winnt.h. They will be surfaced through WindowsIdentity.Claims
+
+ // CLAIM_SECURITY_ATTRIBUTE_TYPE_INVALID -> 0x00
+ internal const int CLAIM_SECURITY_ATTRIBUTE_TYPE_INVALID = 0;
+
+ // CLAIM_SECURITY_ATTRIBUTE_TYPE_INT64 -> 0x01
+ internal const int CLAIM_SECURITY_ATTRIBUTE_TYPE_INT64 = 1;
+
+ // CLAIM_SECURITY_ATTRIBUTE_TYPE_UINT64 -> 0x02
+ internal const int CLAIM_SECURITY_ATTRIBUTE_TYPE_UINT64 = 2;
+
+ // CLAIM_SECURITY_ATTRIBUTE_TYPE_STRING -> 0x03
+ internal const int CLAIM_SECURITY_ATTRIBUTE_TYPE_STRING = 3;
+
+ // CLAIM_SECURITY_ATTRIBUTE_TYPE_FQBN -> 0x04
+ internal const int CLAIM_SECURITY_ATTRIBUTE_TYPE_FQBN = 4;
+
+ // CLAIM_SECURITY_ATTRIBUTE_TYPE_SID -> 0x05
+ internal const int CLAIM_SECURITY_ATTRIBUTE_TYPE_SID = 5;
+
+ // CLAIM_SECURITY_ATTRIBUTE_TYPE_BOOLEAN -> 0x06
+ internal const int CLAIM_SECURITY_ATTRIBUTE_TYPE_BOOLEAN = 6;
+
+ // CLAIM_SECURITY_ATTRIBUTE_TYPE_OCTET_STRING -> 0x10
+ internal const int CLAIM_SECURITY_ATTRIBUTE_TYPE_OCTET_STRING = 16;
+
+ // CLAIM_SECURITY_ATTRIBUTE_NON_INHERITABLE -> 0x0001
+ internal const int CLAIM_SECURITY_ATTRIBUTE_NON_INHERITABLE = 1;
+
+ // CLAIM_SECURITY_ATTRIBUTE_VALUE_CASE_SENSITIVE -> 0x0002
+ internal const int CLAIM_SECURITY_ATTRIBUTE_VALUE_CASE_SENSITIVE = 2;
+
+ // CLAIM_SECURITY_ATTRIBUTE_USE_FOR_DENY_ONLY -> 0x0004
+ internal const int CLAIM_SECURITY_ATTRIBUTE_USE_FOR_DENY_ONLY = 4;
+
+ // CLAIM_SECURITY_ATTRIBUTE_DISABLED_BY_DEFAULT -> 0x0008
+ internal const int CLAIM_SECURITY_ATTRIBUTE_DISABLED_BY_DEFAULT = 8;
+
+ // CLAIM_SECURITY_ATTRIBUTE_DISABLED -> 0x0010
+ internal const int CLAIM_SECURITY_ATTRIBUTE_DISABLED = 16;
+
+ // CLAIM_SECURITY_ATTRIBUTE_MANDATORY -> 0x0020
+ internal const int CLAIM_SECURITY_ATTRIBUTE_MANDATORY = 32;
+
+ internal const int CLAIM_SECURITY_ATTRIBUTE_VALID_FLAGS =
+ CLAIM_SECURITY_ATTRIBUTE_NON_INHERITABLE
+ | CLAIM_SECURITY_ATTRIBUTE_VALUE_CASE_SENSITIVE
+ | CLAIM_SECURITY_ATTRIBUTE_USE_FOR_DENY_ONLY
+ | CLAIM_SECURITY_ATTRIBUTE_DISABLED_BY_DEFAULT
+ | CLAIM_SECURITY_ATTRIBUTE_DISABLED
+ | CLAIM_SECURITY_ATTRIBUTE_MANDATORY;
+
+
+ [StructLayoutAttribute( LayoutKind.Explicit )]
+ internal struct CLAIM_SECURITY_ATTRIBUTE_INFORMATION_V1
+ {
+ // defined as union in CLAIM_SECURITY_ATTRIBUTES_INFORMATION
+ [FieldOffsetAttribute( 0 )]
+ public IntPtr pAttributeV1;
+ }
+
+ [StructLayoutAttribute( LayoutKind.Sequential )]
+ internal struct CLAIM_SECURITY_ATTRIBUTES_INFORMATION
+ {
+ /// WORD->unsigned short
+ public ushort Version;
+
+ /// WORD->unsigned short
+ public ushort Reserved;
+
+ /// DWORD->unsigned int
+ public uint AttributeCount;
+
+ /// CLAIM_SECURITY_ATTRIBUTE_V1
+ public CLAIM_SECURITY_ATTRIBUTE_INFORMATION_V1 Attribute;
+ }
+
+ //
+ // Fully-qualified binary name.
+ //
+ [StructLayoutAttribute( LayoutKind.Sequential, CharSet = CharSet.Unicode )]
+ internal struct CLAIM_SECURITY_ATTRIBUTE_FQBN_VALUE
+ {
+ // DWORD64->unsigned __int64
+ public ulong Version;
+
+ // PWSTR->WCHAR*
+ [MarshalAsAttribute( UnmanagedType.LPWStr )]
+ public string Name;
+ }
+
+ [StructLayoutAttribute( LayoutKind.Sequential, CharSet = CharSet.Unicode )]
+ internal struct CLAIM_SECURITY_ATTRIBUTE_OCTET_STRING_VALUE
+ {
+ /// PVOID->void*
+ public IntPtr pValue;
+
+ /// DWORD->unsigned int
+ public uint ValueLength;
+ }
+
+ [StructLayoutAttribute( LayoutKind.Explicit, CharSet = CharSet.Unicode )]
+ internal struct CLAIM_VALUES_ATTRIBUTE_V1
+ {
+ // PLONG64->__int64*
+ [FieldOffsetAttribute( 0 )]
+ public IntPtr pInt64;
+
+ // PDWORD64->unsigned __int64*
+ [FieldOffsetAttribute( 0 )]
+ public IntPtr pUint64;
+
+ // PWSTR*
+ [FieldOffsetAttribute( 0 )]
+ public IntPtr ppString;
+
+ // PCLAIM_SECURITY_ATTRIBUTE_FQBN_VALUE->_CLAIM_SECURITY_ATTRIBUTE_FQBN_VALUE*
+ [FieldOffsetAttribute( 0 )]
+ public IntPtr pFqbn;
+
+ // PCLAIM_SECURITY_ATTRIBUTE_OCTET_STRING_VALUE->_CLAIM_SECURITY_ATTRIBUTE_OCTET_STRING_VALUE*
+ [FieldOffsetAttribute( 0 )]
+ public IntPtr pOctetString;
+ }
+
+ [StructLayoutAttribute( LayoutKind.Sequential, CharSet = CharSet.Unicode )]
+ internal struct CLAIM_SECURITY_ATTRIBUTE_V1
+ {
+ // PWSTR->WCHAR*
+ [MarshalAsAttribute( UnmanagedType.LPWStr )]
+ public string Name;
+
+ // WORD->unsigned short
+ public ushort ValueType;
+
+ // WORD->unsigned short
+ public ushort Reserved;
+
+ // DWORD->unsigned int
+ public uint Flags;
+
+ // DWORD->unsigned int
+ public uint ValueCount;
+
+ // struct CLAIM_VALUES - a union of 4 possible values
+ public CLAIM_VALUES_ATTRIBUTE_V1 Values;
+ }
+
+ [DllImport(
+ ADVAPI32,
+ EntryPoint="IsWellKnownSid",
+ CallingConvention=CallingConvention.Winapi,
+ SetLastError=true,
+ ExactSpelling=true,
+ CharSet=CharSet.Unicode)]
+ internal static extern BOOL IsWellKnownSid(
+ byte[] sid,
+ int type );
+
+ [DllImport(
+ ADVAPI32,
+ EntryPoint="LsaOpenPolicy",
+ CallingConvention=CallingConvention.Winapi,
+ SetLastError=true,
+ ExactSpelling=true,
+ CharSet=CharSet.Unicode)]
+ internal static extern /*DWORD*/ uint LsaOpenPolicy(
+ string systemName,
+ ref LSA_OBJECT_ATTRIBUTES attributes,
+ int accessMask,
+ out SafeLsaPolicyHandle handle
+ );
+
+ [ReliabilityContract(Consistency.WillNotCorruptState, Cer.MayFail)]
+ [DllImport(
+ ADVAPI32,
+ EntryPoint="LookupPrivilegeValueW",
+ CharSet=CharSet.Auto,
+ SetLastError=true,
+ ExactSpelling=true,
+ BestFitMapping=false)]
+ internal static extern
+ bool LookupPrivilegeValue (
+ [In] string lpSystemName,
+ [In] string lpName,
+ [In,Out] ref LUID Luid);
+
+ [DllImport(
+ ADVAPI32,
+ EntryPoint="LsaLookupSids",
+ CallingConvention=CallingConvention.Winapi,
+ SetLastError=true,
+ ExactSpelling=true,
+ CharSet=CharSet.Unicode)]
+ internal static extern /*DWORD*/ uint LsaLookupSids(
+ SafeLsaPolicyHandle handle,
+ int count,
+ IntPtr[] sids,
+ ref SafeLsaMemoryHandle referencedDomains,
+ ref SafeLsaMemoryHandle names
+ );
+
+ [DllImport(ADVAPI32, SetLastError=true)]
+ [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
+ internal static extern int LsaFreeMemory( IntPtr handle );
+
+ [DllImport(
+ ADVAPI32,
+ EntryPoint="LsaLookupNames",
+ CallingConvention=CallingConvention.Winapi,
+ SetLastError=true,
+ ExactSpelling=true,
+ CharSet=CharSet.Unicode)]
+ internal static extern /*DWORD*/ uint LsaLookupNames(
+ SafeLsaPolicyHandle handle,
+ int count,
+ UNICODE_STRING[] names,
+ ref SafeLsaMemoryHandle referencedDomains,
+ ref SafeLsaMemoryHandle sids
+ );
+
+ [DllImport(
+ ADVAPI32,
+ EntryPoint="LsaLookupNames2",
+ CallingConvention=CallingConvention.Winapi,
+ SetLastError=true,
+ ExactSpelling=true,
+ CharSet=CharSet.Unicode)]
+ internal static extern /*DWORD*/ uint LsaLookupNames2(
+ SafeLsaPolicyHandle handle,
+ int flags,
+ int count,
+ UNICODE_STRING[] names,
+ ref SafeLsaMemoryHandle referencedDomains,
+ ref SafeLsaMemoryHandle sids
+ );
+
+ [DllImport(SECUR32, CharSet=CharSet.Auto, SetLastError=true)]
+ internal static extern
+ int LsaConnectUntrusted (
+ [In,Out] ref SafeLsaLogonProcessHandle LsaHandle);
+
+ [DllImport(SECUR32, CharSet=CharSet.Auto, SetLastError=true)]
+ internal static extern
+ int LsaGetLogonSessionData (
+ [In] ref LUID LogonId,
+ [In,Out] ref SafeLsaReturnBufferHandle ppLogonSessionData);
+
+ [DllImport(SECUR32, CharSet=CharSet.Auto, SetLastError=true)]
+ internal static extern
+ int LsaLogonUser (
+ [In] SafeLsaLogonProcessHandle LsaHandle,
+ [In] ref UNICODE_INTPTR_STRING OriginName,
+ [In] uint LogonType,
+ [In] uint AuthenticationPackage,
+ [In] IntPtr AuthenticationInformation,
+ [In] uint AuthenticationInformationLength,
+ [In] IntPtr LocalGroups,
+ [In] ref TOKEN_SOURCE SourceContext,
+ [In,Out] ref SafeLsaReturnBufferHandle ProfileBuffer,
+ [In,Out] ref uint ProfileBufferLength,
+ [In,Out] ref LUID LogonId,
+ [In,Out] ref SafeAccessTokenHandle Token,
+ [In,Out] ref QUOTA_LIMITS Quotas,
+ [In,Out] ref int SubStatus);
+
+ [DllImport(SECUR32, CharSet=CharSet.Auto, SetLastError=true)]
+ internal static extern
+ int LsaLookupAuthenticationPackage (
+ [In] SafeLsaLogonProcessHandle LsaHandle,
+ [In] ref UNICODE_INTPTR_STRING PackageName,
+ [In,Out] ref uint AuthenticationPackage);
+
+ [DllImport(SECUR32, CharSet=CharSet.Auto, SetLastError=true)]
+ internal static extern
+ int LsaRegisterLogonProcess (
+ [In] ref UNICODE_INTPTR_STRING LogonProcessName,
+ [In,Out] ref SafeLsaLogonProcessHandle LsaHandle,
+ [In,Out] ref IntPtr SecurityMode);
+
+ [DllImport(SECUR32, SetLastError=true)]
+ [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
+ internal static extern int LsaDeregisterLogonProcess(IntPtr handle);
+
+ [DllImport(ADVAPI32, SetLastError=true)]
+ [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
+ internal static extern int LsaClose( IntPtr handle );
+
+ [DllImport(SECUR32, SetLastError=true)]
+ [ReliabilityContract(Consistency.WillNotCorruptState, Cer.Success)]
+ internal static extern int LsaFreeReturnBuffer(IntPtr handle);
+
+#if FEATURE_IMPERSONATION
+ [DllImport (ADVAPI32, CharSet=CharSet.Unicode, SetLastError=true)]
+ internal static extern
+ bool OpenProcessToken (
+ [In] IntPtr ProcessToken,
+ [In] TokenAccessLevels DesiredAccess,
+ [Out] out SafeAccessTokenHandle TokenHandle);
+#endif
+
+ [DllImport(
+ ADVAPI32,
+ EntryPoint="SetNamedSecurityInfoW",
+ CallingConvention=CallingConvention.Winapi,
+ SetLastError=true,
+ ExactSpelling=true,
+ CharSet=CharSet.Unicode)]
+ internal static extern /*DWORD*/ uint SetSecurityInfoByName(
+ string name,
+ /*DWORD*/ uint objectType,
+ /*DWORD*/ uint securityInformation,
+ byte[] owner,
+ byte[] group,
+ byte[] dacl,
+ byte[] sacl );
+
+ [DllImport(
+ ADVAPI32,
+ EntryPoint="SetSecurityInfo",
+ CallingConvention=CallingConvention.Winapi,
+ SetLastError=true,
+ ExactSpelling=true,
+ CharSet=CharSet.Unicode)]
+ internal static extern /*DWORD*/ uint SetSecurityInfoByHandle(
+ SafeHandle handle,
+ /*DWORD*/ uint objectType,
+ /*DWORD*/ uint securityInformation,
+ byte[] owner,
+ byte[] group,
+ byte[] dacl,
+ byte[] sacl );
+
+ // Fusion APIs
+#if FEATURE_FUSION
+ [DllImport(MSCORWKS, CharSet=CharSet.Unicode)]
+ internal static extern int CreateAssemblyNameObject(out IAssemblyName ppEnum, String szAssemblyName, uint dwFlags, IntPtr pvReserved);
+
+ [DllImport(MSCORWKS, CharSet=CharSet.Auto)]
+ internal static extern int CreateAssemblyEnum(out IAssemblyEnum ppEnum, IApplicationContext pAppCtx, IAssemblyName pName, uint dwFlags, IntPtr pvReserved);
+#endif // FEATURE_FUSION
+
+#if FEATURE_CORECLR
+ [DllImport(KERNEL32, CharSet=CharSet.Unicode)]
+ [SuppressUnmanagedCodeSecurityAttribute()]
+ internal unsafe static extern int WideCharToMultiByte(
+ int CodePage,
+ UInt32 dwFlags,
+ char* lpWideCharStr,
+ int cchWideChar,
+ byte* lpMultiByteStr,
+ int cchMultiByte,
+ char* lpDefaultChar,
+ bool* lpUsedDefaultChar);
+
+ [DllImport(KERNEL32, CharSet=CharSet.Unicode)]
+ [SuppressUnmanagedCodeSecurityAttribute()]
+ internal unsafe static extern int MultiByteToWideChar(
+ int CodePage,
+ UInt32 dwFlags,
+ byte* lpMultiByteStr,
+ int cchMultiByte,
+ char* lpWideCharStr,
+ int cchWideChar);
+#endif // FEATURE_CORECLR
+
+ [DllImport(KERNEL32, SetLastError = true)]
+ [return: MarshalAs(UnmanagedType.Bool)]
+ internal extern static bool QueryUnbiasedInterruptTime(out ulong UnbiasedTime);
+
+#if FEATURE_CORECLR
+#if FEATURE_PAL
+ [DllImport(KERNEL32, EntryPoint = "PAL_Random")]
+ internal extern static bool Random(bool bStrong,
+ [Out, MarshalAs(UnmanagedType.LPArray)] byte[] buffer, int length);
+#else
+ private const int BCRYPT_USE_SYSTEM_PREFERRED_RNG = 0x00000002;
+
+ [DllImport("BCrypt.dll", CharSet = CharSet.Unicode)]
+ private static extern uint BCryptGenRandom(IntPtr hAlgorithm, [In, Out] byte[] pbBuffer, int cbBuffer, int dwFlags);
+
+ internal static void Random(bool bStrong, byte[] buffer, int length)
+ {
+ uint status = BCryptGenRandom(IntPtr.Zero, buffer, length, BCRYPT_USE_SYSTEM_PREFERRED_RNG);
+ if (status != STATUS_SUCCESS)
+ {
+ if (status == STATUS_NO_MEMORY)
+ {
+ throw new OutOfMemoryException();
+ }
+ else
+ {
+ throw new InvalidOperationException();
+ }
+ }
+ }
+#endif
+#endif
+ }
+}
diff --git a/src/mscorlib/src/System.Private.CoreLib.txt b/src/mscorlib/src/System.Private.CoreLib.txt
new file mode 100644
index 0000000..0369344
--- /dev/null
+++ b/src/mscorlib/src/System.Private.CoreLib.txt
@@ -0,0 +1,3495 @@
+; Licensed to the .NET Foundation under one or more agreements.
+; The .NET Foundation licenses this file to you under the MIT license.
+; See the LICENSE file in the project root for more information.
+
+; These are the managed resources for mscorlib.dll.
+; See those first three bytes in the file? This is in UTF-8. Leave the
+; Unicode byte order mark (U+FEFF) written in UTF-8 at the start of this file.
+
+; For resource info, see the ResourceManager documentation and the ResGen tool,
+; which is a managed app using ResourceWriter.
+; ResGen now supports limited preprocessing of txt files, you can use
+; #if SYMBOL and #if !SYMBOL to control what sets of resources are included in
+; the resulting resources.
+
+; The naming scheme is: [Namespace.] ExceptionName _ Reason
+; We'll suppress "System." where possible.
+; Examples:
+; Argument_Null
+; Reflection.TargetInvokation_someReason
+
+; Usage Notes:
+; * Keep exceptions in alphabetical order by package
+; * A single space may exist on either side of the equal sign.
+; * Follow the naming conventions.
+; * Any lines starting with a '#' or ';' are ignored
+; * Equal signs aren't legal characters for keys, but may occur in values.
+; * Correctly punctuate all sentences. Most resources should end in a period.
+; Remember, your mother will probably read some of these messages.
+; * You may use " (quote), \n and \t. Use \\ for a single '\' character.
+; * String inserts work. i.e., BadNumber_File = Wrong number in file "{0}".
+
+; Real words, used by code like Environment.StackTrace
+#if INCLUDE_RUNTIME
+Word_At = at
+StackTrace_InFileLineNumber = in {0}:line {1}
+UnknownError_Num = Unknown error "{0}".
+AllocatedFrom = Allocated from:
+
+; Note this one is special, used as a divider between stack traces!
+Exception_EndOfInnerExceptionStack = --- End of inner exception stack trace ---
+Exception_WasThrown = Exception of type '{0}' was thrown.
+
+; The following are used in the implementation of ExceptionDispatchInfo
+Exception_EndStackTraceFromPreviousThrow = --- End of stack trace from previous location where exception was thrown ---
+
+Arg_ParamName_Name = Parameter name: {0}
+ArgumentOutOfRange_ActualValue = Actual value was {0}.
+
+NoDebugResources = [{0}]\r\nArguments: {1}\r\nDebugging resource strings are unavailable. Often the key and arguments provide sufficient information to diagnose the problem. See http://go.microsoft.com/fwlink/?linkid=106663&Version={2}&File={3}&Key={4}
+#endif // INCLUDE_RUNTIME
+
+#if !FEATURE_CORECLR
+UnknownError = Unknown error.
+#endif // !FEATURE_CORECLR
+
+#if INCLUDE_DEBUG
+
+; For code contracts
+AssumptionFailed = Assumption failed.
+AssumptionFailed_Cnd = Assumption failed: {0}
+AssertionFailed = Assertion failed.
+AssertionFailed_Cnd = Assertion failed: {0}
+PreconditionFailed = Precondition failed.
+PreconditionFailed_Cnd = Precondition failed: {0}
+PostconditionFailed = Postcondition failed.
+PostconditionFailed_Cnd = Postcondition failed: {0}
+PostconditionOnExceptionFailed = Postcondition failed after throwing an exception.
+PostconditionOnExceptionFailed_Cnd = Postcondition failed after throwing an exception: {0}
+InvariantFailed = Invariant failed.
+InvariantFailed_Cnd = Invariant failed: {0}
+MustUseCCRewrite = An assembly (probably "{1}") must be rewritten using the code contracts binary rewriter (CCRewrite) because it is calling Contract.{0} and the CONTRACTS_FULL symbol is defined. Remove any explicit definitions of the CONTRACTS_FULL symbol from your project and rebuild. CCRewrite can be downloaded from http://go.microsoft.com/fwlink/?LinkID=169180. \r\nAfter the rewriter is installed, it can be enabled in Visual Studio from the project's Properties page on the Code Contracts pane. Ensure that "Perform Runtime Contract Checking" is enabled, which will define CONTRACTS_FULL.
+
+; Access Control
+#if FEATURE_MACL
+AccessControl_MustSpecifyContainerAcl = The named parameter must be a container ACL.
+AccessControl_MustSpecifyLeafObjectAcl = The named parameter must be a non-container ACL.
+AccessControl_AclTooLong = Length of the access control list exceed the allowed maximum.
+AccessControl_MustSpecifyDirectoryObjectAcl = The named parameter must be a directory-object ACL.
+AccessControl_MustSpecifyNonDirectoryObjectAcl = The named parameter must be a non-directory-object ACL.
+AccessControl_InvalidSecurityDescriptorRevision = Security descriptor with revision other than '1' are not legal.
+AccessControl_InvalidSecurityDescriptorSelfRelativeForm = Security descriptor must be in the self-relative form.
+AccessControl_NoAssociatedSecurity = Unable to perform a security operation on an object that has no associated security. This can happen when trying to get an ACL of an anonymous kernel object.
+AccessControl_InvalidHandle = The supplied handle is invalid. This can happen when trying to set an ACL on an anonymous kernel object.
+AccessControl_UnexpectedError = Method failed with unexpected error code {0}.
+AccessControl_InvalidSidInSDDLString = The SDDL string contains an invalid sid or a sid that cannot be translated.
+AccessControl_InvalidOwner = The security identifier is not allowed to be the owner of this object.
+AccessControl_InvalidGroup = The security identifier is not allowed to be the primary group of this object.
+AccessControl_InvalidAccessRuleType = The access rule is not the correct type.
+AccessControl_InvalidAuditRuleType = The audit rule is not the correct type.
+#endif // FEATURE_MACL
+
+; Identity Reference Library
+#if FEATURE_IDENTITY_REFERENCE
+IdentityReference_IdentityNotMapped = Some or all identity references could not be translated.
+IdentityReference_MustBeIdentityReference = The targetType parameter must be of IdentityReference type.
+IdentityReference_AccountNameTooLong = Account name is too long.
+IdentityReference_DomainNameTooLong = Domain name is too long.
+IdentityReference_InvalidNumberOfSubauthorities = The number of sub-authorities must not exceed {0}.
+IdentityReference_IdentifierAuthorityTooLarge = The size of the identifier authority must not exceed 6 bytes.
+IdentityReference_InvalidSidRevision = SIDs with revision other than '1' are not supported.
+IdentityReference_CannotCreateLogonIdsSid = Well-known SIDs of type LogonIdsSid cannot be created.
+IdentityReference_DomainSidRequired = The domainSid parameter must be specified for creating well-known SID of type {0}.
+IdentityReference_NotAWindowsDomain = The domainSid parameter is not a valid Windows domain SID.
+#endif // FEATURE_IDENTITY_REFERENCE
+
+; AccessException
+Acc_CreateGeneric = Cannot create a type for which Type.ContainsGenericParameters is true.
+Acc_CreateAbst = Cannot create an abstract class.
+Acc_CreateInterface = Cannot create an instance of an interface.
+Acc_NotClassInit = Type initializer was not callable.
+Acc_CreateGenericEx = Cannot create an instance of {0} because Type.ContainsGenericParameters is true.
+Acc_CreateArgIterator = Cannot dynamically create an instance of ArgIterator.
+Acc_CreateAbstEx = Cannot create an instance of {0} because it is an abstract class.
+Acc_CreateInterfaceEx = Cannot create an instance of {0} because it is an interface.
+Acc_CreateVoid = Cannot dynamically create an instance of System.Void.
+Acc_ReadOnly = Cannot set a constant field.
+Acc_RvaStatic = SkipVerification permission is needed to modify an image-based (RVA) static field.
+Access_Void = Cannot create an instance of void.
+
+; ArgumentException
+Arg_TypedReference_Null = The TypedReference must be initialized.
+Argument_AddingDuplicate__ = Item has already been added. Key in dictionary: '{0}' Key being added: '{1}'
+Argument_AddingDuplicate = An item with the same key has already been added.
+#if FEATURE_CORECLR
+Argument_AddingDuplicateWithKey = An item with the same key has already been added. Key: {0}
+#endif // FEATURE_CORECLR
+Argument_MethodDeclaringTypeGenericLcg = Method '{0}' has a generic declaring type '{1}'. Explicitly provide the declaring type to GetTokenFor.
+Argument_MethodDeclaringTypeGeneric = Cannot resolve method {0} because the declaring type of the method handle {1} is generic. Explicitly provide the declaring type to GetMethodFromHandle.
+Argument_FieldDeclaringTypeGeneric = Cannot resolve field {0} because the declaring type of the field handle {1} is generic. Explicitly provide the declaring type to GetFieldFromHandle.
+Argument_ApplicationTrustShouldHaveIdentity = An ApplicationTrust must have an application identity before it can be persisted.
+Argument_ConversionOverflow = Conversion buffer overflow.
+Argument_CodepageNotSupported = {0} is not a supported code page.
+Argument_CultureNotSupported = Culture is not supported.
+Argument_CultureInvalidIdentifier = {0} is an invalid culture identifier.
+Argument_OneOfCulturesNotSupported = Culture name {0} or {1} is not supported.
+Argument_CultureIetfNotSupported = Culture IETF Name {0} is not a recognized IETF name.
+Argument_CultureIsNeutral = Culture ID {0} (0x{0:X4}) is a neutral culture; a region cannot be created from it.
+Argument_InvalidNeutralRegionName = The region name {0} should not correspond to neutral culture; a specific culture name is required.
+Argument_InvalidGenericInstArray = Generic arguments must be provided for each generic parameter and each generic argument must be a RuntimeType.
+Argument_GenericArgsCount = The number of generic arguments provided doesn't equal the arity of the generic type definition.
+Argument_CultureInvalidFormat = Culture '{0}' is a neutral culture. It cannot be used in formatting and parsing and therefore cannot be set as the thread's current culture.
+Argument_CompareOptionOrdinal = CompareOption.Ordinal cannot be used with other options.
+Argument_CustomCultureCannotBePassedByNumber = Customized cultures cannot be passed by LCID, only by name.
+Argument_EncodingConversionOverflowChars = The output char buffer is too small to contain the decoded characters, encoding '{0}' fallback '{1}'.
+Argument_EncodingConversionOverflowBytes = The output byte buffer is too small to contain the encoded data, encoding '{0}' fallback '{1}'.
+Argument_EncoderFallbackNotEmpty = Must complete Convert() operation or call Encoder.Reset() before calling GetBytes() or GetByteCount(). Encoder '{0}' fallback '{1}'.
+Argument_EmptyFileName = Empty file name is not legal.
+Argument_EmptyPath = Empty path name is not legal.
+Argument_EmptyName = Empty name is not legal.
+Argument_ImplementIComparable = At least one object must implement IComparable.
+Argument_InvalidType = The type of arguments passed into generic comparer methods is invalid.
+Argument_InvalidTypeForCA=Cannot build type parameter for custom attribute with a type that does not support the AssemblyQualifiedName property. The type instance supplied was of type '{0}'.
+Argument_IllegalEnvVarName = Environment variable name cannot contain equal character.
+Argument_IllegalAppId = Application identity does not have same number of components as manifest paths.
+Argument_IllegalAppBase = The application base specified is not valid.
+Argument_UnableToParseManifest = Unexpected error while parsing the specified manifest.
+Argument_IllegalAppIdMismatch = Application identity does not match identities in manifests.
+Argument_InvalidAppId = Invalid identity: no deployment or application identity specified.
+Argument_InvalidGenericArg = The generic type parameter was not valid
+Argument_InvalidArrayLength = Length of the array must be {0}.
+Argument_InvalidArrayType = Target array type is not compatible with the type of items in the collection.
+Argument_InvalidAppendMode = Append access can be requested only in write-only mode.
+Argument_InvalidEnumValue = The value '{0}' is not valid for this usage of the type {1}.
+Argument_EnumIsNotIntOrShort = The underlying type of enum argument must be Int32 or Int16.
+Argument_InvalidEnum = The Enum type should contain one and only one instance field.
+Argument_InvalidKeyStore = '{0}' is not a valid KeyStore name.
+Argument_InvalidFileMode&AccessCombo = Combining FileMode: {0} with FileAccess: {1} is invalid.
+Argument_InvalidFileMode&RightsCombo = Combining FileMode: {0} with FileSystemRights: {1} is invalid.
+Argument_InvalidFileModeTruncate&RightsCombo = Combining FileMode: {0} with FileSystemRights: {1} is invalid. FileMode.Truncate is valid only when used with FileSystemRights.Write.
+Argument_InvalidFlag = Value of flags is invalid.
+Argument_InvalidAnyFlag = No flags can be set.
+Argument_InvalidHandle = The handle is invalid.
+Argument_InvalidRegistryKeyPermissionCheck = The specified RegistryKeyPermissionCheck value is invalid.
+Argument_InvalidRegistryOptionsCheck = The specified RegistryOptions value is invalid.
+Argument_InvalidRegistryViewCheck = The specified RegistryView value is invalid.
+Argument_InvalidSubPath = The directory specified, '{0}', is not a subdirectory of '{1}'.
+Argument_NoRegionInvariantCulture = There is no region associated with the Invariant Culture (Culture ID: 0x7F).
+Argument_ResultCalendarRange = The result is out of the supported range for this calendar. The result should be between {0} (Gregorian date) and {1} (Gregorian date), inclusive.
+Argument_ResultIslamicCalendarRange = The date is out of the supported range for the Islamic calendar. The date should be greater than July 18th, 622 AD (Gregorian date).
+Argument_NeverValidGenericArgument = The type '{0}' may not be used as a type argument.
+Argument_NotEnoughGenArguments = The type or method has {1} generic parameter(s), but {0} generic argument(s) were provided. A generic argument must be provided for each generic parameter.
+Argument_NullFullTrustAssembly = A null StrongName was found in the full trust assembly list.
+Argument_GenConstraintViolation = GenericArguments[{0}], '{1}', on '{2}' violates the constraint of type '{3}'.
+Argument_InvalidToken = Token {0:x} is not valid in the scope of module {1}.
+Argument_InvalidTypeToken = Token {0:x} is not a valid Type token.
+Argument_ResolveType = Token {0:x} is not a valid Type token in the scope of module {1}.
+Argument_ResolveMethod = Token {0:x} is not a valid MethodBase token in the scope of module {1}.
+Argument_ResolveField = Token {0:x} is not a valid FieldInfo token in the scope of module {1}.
+Argument_ResolveMember = Token {0:x} is not a valid MemberInfo token in the scope of module {1}.
+Argument_ResolveString = Token {0:x} is not a valid string token in the scope of module {1}.
+Argument_ResolveModuleType = Token {0} resolves to the special module type representing this module.
+Argument_ResolveMethodHandle = Type handle '{0}' and method handle with declaring type '{1}' are incompatible. Get RuntimeMethodHandle and declaring RuntimeTypeHandle off the same MethodBase.
+Argument_ResolveFieldHandle = Type handle '{0}' and field handle with declaring type '{1}' are incompatible. Get RuntimeFieldHandle and declaring RuntimeTypeHandle off the same FieldInfo.
+Argument_ResourceScopeWrongDirection = Resource type in the ResourceScope enum is going from a more restrictive resource type to a more general one. From: "{0}" To: "{1}"
+Argument_BadResourceScopeTypeBits = Unknown value for the ResourceScope: {0} Too many resource type bits may be set.
+Argument_BadResourceScopeVisibilityBits = Unknown value for the ResourceScope: {0} Too many resource visibility bits may be set.
+Argument_WaitHandleNameTooLong = The name can be no more than {0} characters in length.
+Argument_EnumTypeDoesNotMatch = The argument type, '{0}', is not the same as the enum type '{1}'.
+InvalidOperation_MethodBuilderBaked = The signature of the MethodBuilder can no longer be modified because an operation on the MethodBuilder caused the methodDef token to be created. For example, a call to SetCustomAttribute requires the methodDef token to emit the CustomAttribute token.
+InvalidOperation_GenericParametersAlreadySet = The generic parameters are already defined on this MethodBuilder.
+Arg_AccessException = Cannot access member.
+Arg_AppDomainUnloadedException = Attempted to access an unloaded AppDomain.
+Arg_ApplicationException = Error in the application.
+Arg_ArgumentOutOfRangeException = Specified argument was out of the range of valid values.
+Arg_ArithmeticException = Overflow or underflow in the arithmetic operation.
+Arg_ArrayLengthsDiffer = Array lengths must be the same.
+Arg_ArrayPlusOffTooSmall = Destination array is not long enough to copy all the items in the collection. Check array index and length.
+Arg_ArrayTypeMismatchException = Attempted to access an element as a type incompatible with the array.
+Arg_BadImageFormatException = Format of the executable (.exe) or library (.dll) is invalid.
+Argument_BadImageFormatExceptionResolve = A BadImageFormatException has been thrown while parsing the signature. This is likely due to lack of a generic context. Ensure genericTypeArguments and genericMethodArguments are provided and contain enough context.
+Arg_BufferTooSmall = Not enough space available in the buffer.
+Arg_CATypeResolutionFailed = Failed to resolve type from string "{0}" which was embedded in custom attribute blob.
+Arg_CannotHaveNegativeValue = String cannot contain a minus sign if the base is not 10.
+Arg_CannotUnloadAppDomainException = Attempt to unload the AppDomain failed.
+Arg_CannotMixComparisonInfrastructure = The usage of IKeyComparer and IHashCodeProvider/IComparer interfaces cannot be mixed; use one or the other.
+Arg_ContextMarshalException = Attempted to marshal an object across a context boundary.
+Arg_DataMisalignedException = A datatype misalignment was detected in a load or store instruction.
+Arg_DevicesNotSupported = FileStream will not open Win32 devices such as disk partitions and tape drives. Avoid use of "\\\\.\\" in the path.
+Arg_DuplicateWaitObjectException = Duplicate objects in argument.
+Arg_EntryPointNotFoundException = Entry point was not found.
+Arg_DllNotFoundException = Dll was not found.
+Arg_ExecutionEngineException = Internal error in the runtime.
+Arg_FieldAccessException = Attempted to access a field that is not accessible by the caller.
+Arg_FileIsDirectory_Name = The target file "{0}" is a directory, not a file.
+Arg_FormatException = One of the identified items was in an invalid format.
+Arg_IndexOutOfRangeException = Index was outside the bounds of the array.
+Arg_InsufficientExecutionStackException = 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.
+Arg_InvalidCastException = Specified cast is not valid.
+Arg_InvalidOperationException = Operation is not valid due to the current state of the object.
+Arg_CorruptedCustomCultureFile = The file of the custom culture {0} is corrupt. Try to unregister this culture.
+Arg_InvokeMember = InvokeMember can be used only for COM objects.
+Arg_InvalidNeutralResourcesLanguage_Asm_Culture = The NeutralResourcesLanguageAttribute on the assembly "{0}" specifies an invalid culture name: "{1}".
+Arg_InvalidNeutralResourcesLanguage_FallbackLoc = The NeutralResourcesLanguageAttribute specifies an invalid or unrecognized ultimate resource fallback location: "{0}".
+Arg_InvalidSatelliteContract_Asm_Ver = Satellite contract version attribute on the assembly '{0}' specifies an invalid version: {1}.
+Arg_MethodAccessException = Attempt to access the method failed.
+Arg_MethodAccessException_WithMethodName = Attempt to access the method "{0}" on type "{1}" failed.
+Arg_MethodAccessException_WithCaller = Attempt by security transparent method '{0}' to access security critical method '{1}' failed.
+Arg_MissingFieldException = Attempted to access a non-existing field.
+Arg_MissingMemberException = Attempted to access a missing member.
+Arg_MissingMethodException = Attempted to access a missing method.
+Arg_MulticastNotSupportedException = Attempted to add multiple callbacks to a delegate that does not support multicast.
+Arg_NotFiniteNumberException = Number encountered was not a finite quantity.
+Arg_NotSupportedException = Specified method is not supported.
+Arg_UnboundGenParam = Late bound operations cannot be performed on types or methods for which ContainsGenericParameters is true.
+Arg_UnboundGenField = Late bound operations cannot be performed on fields with types for which Type.ContainsGenericParameters is true.
+Arg_NotGenericParameter = Method may only be called on a Type for which Type.IsGenericParameter is true.
+Arg_GenericParameter = Method must be called on a Type for which Type.IsGenericParameter is false.
+Arg_NotGenericTypeDefinition = {0} is not a GenericTypeDefinition. MakeGenericType may only be called on a type for which Type.IsGenericTypeDefinition is true.
+Arg_NotGenericMethodDefinition = {0} is not a GenericMethodDefinition. MakeGenericMethod may only be called on a method for which MethodBase.IsGenericMethodDefinition is true.
+Arg_BadLiteralFormat = Encountered an invalid type for a default value.
+Arg_MissingActivationArguments = The AppDomainSetup must specify the activation arguments for this call.
+Argument_BadParameterTypeForCAB = Cannot emit a CustomAttribute with argument of type {0}.
+Argument_InvalidMemberForNamedArgument = The member must be either a field or a property.
+Argument_InvalidTypeName = The name of the type is invalid.
+
+; Note - don't change the NullReferenceException default message. This was
+; negotiated carefully with the VB team to avoid saying "null" or "nothing".
+Arg_NullReferenceException = Object reference not set to an instance of an object.
+
+Arg_AccessViolationException = Attempted to read or write protected memory. This is often an indication that other memory is corrupt.
+Arg_OverflowException = Arithmetic operation resulted in an overflow.
+Arg_PathGlobalRoot = Paths that begin with \\\\?\\GlobalRoot are internal to the kernel and should not be opened by managed applications.
+Arg_PathIllegal = The path is not of a legal form.
+Arg_PathIllegalUNC = The UNC path should be of the form \\\\server\\share.
+Arg_RankException = Attempted to operate on an array with the incorrect number of dimensions.
+Arg_RankMultiDimNotSupported = Only single dimensional arrays are supported for the requested action.
+Arg_NonZeroLowerBound = The lower bound of target array must be zero.
+Arg_RegSubKeyValueAbsent = No value exists with that name.
+Arg_ResourceFileUnsupportedVersion = The ResourceReader class does not know how to read this version of .resources files. Expected version: {0} This file: {1}
+Arg_ResourceNameNotExist = The specified resource name "{0}" does not exist in the resource file.
+Arg_SecurityException = Security error.
+Arg_SerializationException = Serialization error.
+Arg_StackOverflowException = Operation caused a stack overflow.
+Arg_SurrogatesNotAllowedAsSingleChar = Unicode surrogate characters must be written out as pairs together in the same call, not individually. Consider passing in a character array instead.
+Arg_SynchronizationLockException = Object synchronization method was called from an unsynchronized block of code.
+Arg_RWLockRestoreException = ReaderWriterLock.RestoreLock was called without releasing all locks acquired since the call to ReleaseLock.
+Arg_SystemException = System error.
+Arg_TimeoutException = The operation has timed out.
+Arg_UnauthorizedAccessException = Attempted to perform an unauthorized operation.
+Arg_ArgumentException = Value does not fall within the expected range.
+Arg_DirectoryNotFoundException = Attempted to access a path that is not on the disk.
+Arg_DriveNotFoundException = Attempted to access a drive that is not available.
+Arg_EndOfStreamException = Attempted to read past the end of the stream.
+Arg_HexStyleNotSupported = The number style AllowHexSpecifier is not supported on floating point data types.
+Arg_IOException = I/O error occurred.
+Arg_InvalidHexStyle = With the AllowHexSpecifier bit set in the enum bit field, the only other valid bits that can be combined into the enum value must be a subset of those in HexNumber.
+Arg_KeyNotFound = The given key was not present in the dictionary.
+Argument_InvalidNumberStyles = An undefined NumberStyles value is being used.
+Argument_InvalidDateTimeStyles = An undefined DateTimeStyles value is being used.
+Argument_InvalidTimeSpanStyles = An undefined TimeSpanStyles value is being used.
+Argument_DateTimeOffsetInvalidDateTimeStyles = The DateTimeStyles value 'NoCurrentDateDefault' is not allowed when parsing DateTimeOffset.
+Argument_NativeResourceAlreadyDefined = Native resource has already been defined.
+Argument_BadObjRef = Invalid ObjRef provided to '{0}'.
+Argument_InvalidCultureName = Culture name '{0}' is not supported.
+Argument_NameTooLong = The name '{0}' is too long to be a Culture or Region name, which is limited to {1} characters.
+Argument_NameContainsInvalidCharacters = The name '{0}' contains characters that are not valid for a Culture or Region.
+Argument_InvalidRegionName = Region name '{0}' is not supported.
+Argument_CannotCreateTypedReference = Cannot use function evaluation to create a TypedReference object.
+Arg_ArrayZeroError = Array must not be of length zero.
+Arg_BogusIComparer = Unable to sort because the IComparer.Compare() method returns inconsistent results. Either a value does not compare equal to itself, or one value repeatedly compared to another value yields different results. IComparer: '{0}'.
+Arg_CreatInstAccess = Cannot specify both CreateInstance and another access type.
+Arg_CryptographyException = Error occurred during a cryptographic operation.
+Arg_DateTimeRange = Combination of arguments to the DateTime constructor is out of the legal range.
+Arg_DecBitCtor = Decimal byte array constructor requires an array of length four containing valid decimal bytes.
+Arg_DlgtTargMeth = Cannot bind to the target method because its signature or security transparency is not compatible with that of the delegate type.
+Arg_DlgtTypeMis = Delegates must be of the same type.
+Arg_DlgtNullInst = Delegate to an instance method cannot have null 'this'.
+Arg_DllInitFailure = One machine may not have remote administration enabled, or both machines may not be running the remote registry service.
+Arg_EmptyArray = Array may not be empty.
+Arg_EmptyOrNullArray = Array may not be empty or null.
+Arg_EmptyCollection = Collection must not be empty.
+Arg_EmptyOrNullString = String may not be empty or null.
+Argument_ItemNotExist = The specified item does not exist in this KeyedCollection.
+Argument_EncodingNotSupported = '{0}' is not a supported encoding name. For information on defining a custom encoding, see the documentation for the Encoding.RegisterProvider method.
+Argument_FallbackBufferNotEmpty = Cannot change fallback when buffer is not empty. Previous Convert() call left data in the fallback buffer.
+Argument_InvalidCodePageConversionIndex = Unable to translate Unicode character \\u{0:X4} at index {1} to specified code page.
+Argument_InvalidCodePageBytesIndex = Unable to translate bytes {0} at index {1} from specified code page to Unicode.
+Argument_RecursiveFallback = Recursive fallback not allowed for character \\u{0:X4}.
+Argument_RecursiveFallbackBytes = Recursive fallback not allowed for bytes {0}.
+Arg_EnumAndObjectMustBeSameType = Object must be the same type as the enum. The type passed in was '{0}'; the enum type was '{1}'.
+Arg_EnumIllegalVal = Illegal enum value: {0}.
+Arg_EnumNotSingleFlag = Must set exactly one flag.
+Arg_EnumAtLeastOneFlag = Must set at least one flag.
+Arg_EnumUnderlyingTypeAndObjectMustBeSameType = Enum underlying type and the object must be same type or object must be a String. Type passed in was '{0}'; the enum underlying type was '{1}'.
+Arg_EnumFormatUnderlyingTypeAndObjectMustBeSameType = Enum underlying type and the object must be same type or object. Type passed in was '{0}'; the enum underlying type was '{1}'.
+Arg_EnumMustHaveUnderlyingValueField = All enums must have an underlying value__ field.
+Arg_COMAccess = Must specify property Set or Get or method call for a COM Object.
+Arg_COMPropSetPut = Only one of the following binding flags can be set: BindingFlags.SetProperty, BindingFlags.PutDispProperty, BindingFlags.PutRefDispProperty.
+Arg_FldSetGet = Cannot specify both Get and Set on a field.
+Arg_PropSetGet = Cannot specify both Get and Set on a property.
+Arg_CannotBeNaN = TimeSpan does not accept floating point Not-a-Number values.
+Arg_FldGetPropSet = Cannot specify both GetField and SetProperty.
+Arg_FldSetPropGet = Cannot specify both SetField and GetProperty.
+Arg_FldSetInvoke = Cannot specify Set on a Field and Invoke on a method.
+Arg_FldGetArgErr = No arguments can be provided to Get a field value.
+Arg_FldSetArgErr = Only the field value can be specified to set a field value.
+Arg_GetMethNotFnd = Property Get method was not found.
+Arg_GuidArrayCtor = Byte array for GUID must be exactly {0} bytes long.
+Arg_HandleNotAsync = Handle does not support asynchronous operations. The parameters to the FileStream constructor may need to be changed to indicate that the handle was opened synchronously (that is, it was not opened for overlapped I/O).
+Arg_HandleNotSync = Handle does not support synchronous operations. The parameters to the FileStream constructor may need to be changed to indicate that the handle was opened asynchronously (that is, it was opened explicitly for overlapped I/O).
+Arg_HTCapacityOverflow = Hashtable's capacity overflowed and went negative. Check load factor, capacity and the current size of the table.
+Arg_IndexMustBeInt = All indexes must be of type Int32.
+Arg_InvalidConsoleColor = The ConsoleColor enum value was not defined on that enum. Please use a defined color from the enum.
+Arg_InvalidFileAttrs = Invalid File or Directory attributes value.
+Arg_InvalidHandle = Invalid handle.
+Arg_InvalidTypeInSignature = The signature Type array contains some invalid type (i.e. null, void)
+Arg_InvalidTypeInRetType = The return Type contains some invalid type (i.e. null, ByRef)
+Arg_EHClauseNotFilter = This ExceptionHandlingClause is not a filter.
+Arg_EHClauseNotClause = This ExceptionHandlingClause is not a clause.
+Arg_ReflectionOnlyCA = It is illegal to reflect on the custom attributes of a Type loaded via ReflectionOnlyGetType (see Assembly.ReflectionOnly) -- use CustomAttributeData instead.
+Arg_ReflectionOnlyInvoke = It is illegal to invoke a method on a Type loaded via ReflectionOnlyGetType.
+Arg_ReflectionOnlyField = It is illegal to get or set the value on a field on a Type loaded via ReflectionOnlyGetType.
+Arg_MemberInfoNullModule = The Module object containing the member cannot be null.
+Arg_ParameterInfoNullMember = The MemberInfo object defining the parameter cannot be null.
+Arg_ParameterInfoNullModule = The Module object containing the parameter cannot be null.
+Arg_AssemblyNullModule = The manifest module of the assembly cannot be null.
+Arg_LongerThanSrcArray = Source array was not long enough. Check srcIndex and length, and the array's lower bounds.
+Arg_LongerThanDestArray = Destination array was not long enough. Check destIndex and length, and the array's lower bounds.
+Arg_LowerBoundsMustMatch = The arrays' lower bounds must be identical.
+Arg_MustBeBoolean = Object must be of type Boolean.
+Arg_MustBeByte = Object must be of type Byte.
+Arg_MustBeChar = Object must be of type Char.
+Arg_MustBeDateTime = Object must be of type DateTime.
+Arg_MustBeDateTimeOffset = Object must be of type DateTimeOffset.
+Arg_MustBeDecimal = Object must be of type Decimal.
+Arg_MustBeDelegate = Type must derive from Delegate.
+Arg_MustBeDouble = Object must be of type Double.
+Arg_MustBeDriveLetterOrRootDir = Object must be a root directory ("C:\\") or a drive letter ("C").
+Arg_MustBeEnum = Type provided must be an Enum.
+Arg_MustBeEnumBaseTypeOrEnum = The value passed in must be an enum base or an underlying type for an enum, such as an Int32.
+Arg_MustBeGuid = Object must be of type GUID.
+Arg_MustBeIdentityReferenceType = Type must be an IdentityReference, such as NTAccount or SecurityIdentifier.
+Arg_MustBeInterface = Type passed must be an interface.
+Arg_MustBeInt16 = Object must be of type Int16.
+Arg_MustBeInt32 = Object must be of type Int32.
+Arg_MustBeInt64 = Object must be of type Int64.
+Arg_MustBePrimArray = Object must be an array of primitives.
+Arg_MustBePointer = Type must be a Pointer.
+Arg_MustBeStatic = Method must be a static method.
+Arg_MustBeString = Object must be of type String.
+Arg_MustBeStringPtrNotAtom = The pointer passed in as a String must not be in the bottom 64K of the process's address space.
+Arg_MustBeSByte = Object must be of type SByte.
+Arg_MustBeSingle = Object must be of type Single.
+Arg_MustBeTimeSpan = Object must be of type TimeSpan.
+Arg_MustBeType = Type must be a type provided by the runtime.
+Arg_MustBeUInt16 = Object must be of type UInt16.
+Arg_MustBeUInt32 = Object must be of type UInt32.
+Arg_MustBeUInt64 = Object must be of type UInt64.
+Arg_MustBeVersion = Object must be of type Version.
+Arg_MustBeTrue = Argument must be true.
+Arg_MustAllBeRuntimeType = At least one type argument is not a runtime type.
+Arg_NamedParamNull = Named parameter value must not be null.
+Arg_NamedParamTooBig = Named parameter array cannot be bigger than argument array.
+Arg_Need1DArray = Array was not a one-dimensional array.
+Arg_Need2DArray = Array was not a two-dimensional array.
+Arg_Need3DArray = Array was not a three-dimensional array.
+Arg_NeedAtLeast1Rank = Must provide at least one rank.
+Arg_NoDefCTor = No parameterless constructor defined for this object.
+Arg_BitArrayTypeUnsupported = Only supported array types for CopyTo on BitArrays are Boolean[], Int32[] and Byte[].
+Arg_DivideByZero = Attempted to divide by zero.
+Arg_NoAccessSpec = Must specify binding flags describing the invoke operation required (BindingFlags.InvokeMethod CreateInstance GetField SetField GetProperty SetProperty).
+Arg_NoStaticVirtual = Method cannot be both static and virtual.
+Arg_NotFoundIFace = Interface not found.
+Arg_ObjObjEx = Object of type '{0}' cannot be converted to type '{1}'.
+Arg_ObjObj = Object type cannot be converted to target type.
+Arg_FieldDeclTarget = Field '{0}' defined on type '{1}' is not a field on the target object which is of type '{2}'.
+Arg_OleAutDateInvalid = Not a legal OleAut date.
+Arg_OleAutDateScale = OleAut date did not convert to a DateTime correctly.
+Arg_PlatformNotSupported = Operation is not supported on this platform.
+Arg_PlatformSecureString = SecureString is only supported on Windows 2000 SP3 and higher platforms.
+Arg_ParmCnt = Parameter count mismatch.
+Arg_ParmArraySize = Must specify one or more parameters.
+Arg_Path2IsRooted = Second path fragment must not be a drive or UNC name.
+Arg_PathIsVolume = Path must not be a drive.
+Arg_PrimWiden = Cannot widen from source type to target type either because the source type is a not a primitive type or the conversion cannot be accomplished.
+Arg_NullIndex = Arrays indexes must be set to an object instance.
+Arg_VarMissNull = Missing parameter does not have a default value.
+Arg_PropSetInvoke = Cannot specify Set on a property and Invoke on a method.
+Arg_PropNotFound = Could not find the specified property.
+Arg_RankIndices = Indices length does not match the array rank.
+Arg_RanksAndBounds = Number of lengths and lowerBounds must match.
+Arg_RegSubKeyAbsent = Cannot delete a subkey tree because the subkey does not exist.
+Arg_RemoveArgNotFound = Cannot remove the specified item because it was not found in the specified Collection.
+Arg_RegKeyDelHive = Cannot delete a registry hive's subtree.
+Arg_RegKeyNoRemoteConnect = No remote connection to '{0}' while trying to read the registry.
+Arg_RegKeyOutOfRange = Registry HKEY was out of the legal range.
+Arg_RegKeyNotFound = The specified registry key does not exist.
+Arg_RegKeyStrLenBug = Registry key names should not be greater than 255 characters.
+Arg_RegValStrLenBug = Registry value names should not be greater than 16,383 characters.
+Arg_RegBadKeyKind = The specified RegistryValueKind is an invalid value.
+Arg_RegGetOverflowBug = RegistryKey.GetValue does not allow a String that has a length greater than Int32.MaxValue.
+Arg_RegSetMismatchedKind = The type of the value object did not match the specified RegistryValueKind or the object could not be properly converted.
+Arg_RegSetBadArrType = RegistryKey.SetValue does not support arrays of type '{0}'. Only Byte[] and String[] are supported.
+Arg_RegSetStrArrNull = RegistryKey.SetValue does not allow a String[] that contains a null String reference.
+Arg_RegInvalidKeyName = Registry key name must start with a valid base key name.
+Arg_ResMgrNotResSet = Type parameter must refer to a subclass of ResourceSet.
+Arg_SetMethNotFnd = Property set method not found.
+Arg_TypeRefPrimitve = TypedReferences cannot be redefined as primitives.
+Arg_UnknownTypeCode = Unknown TypeCode value.
+Arg_VersionString = Version string portion was too short or too long.
+Arg_NoITypeInfo = Specified TypeInfo was invalid because it did not support the ITypeInfo interface.
+Arg_NoITypeLib = Specified TypeLib was invalid because it did not support the ITypeLib interface.
+Arg_NoImporterCallback = Specified type library importer callback was invalid because it did not support the ITypeLibImporterNotifySink interface.
+Arg_ImporterLoadFailure = The type library importer encountered an error during type verification. Try importing without class members.
+Arg_InvalidBase = Invalid Base.
+Arg_EnumValueNotFound = Requested value '{0}' was not found.
+Arg_EnumLitValueNotFound = Literal value was not found.
+Arg_MustContainEnumInfo = Must specify valid information for parsing in the string.
+Arg_InvalidSearchPattern = Search pattern cannot contain ".." to move up directories and can be contained only internally in file/directory names, as in "a..b".
+Arg_NegativeArgCount = Argument count must not be negative.
+Arg_InvalidAccessEntry = Specified access entry is invalid because it is unrestricted. The global flags should be specified instead.
+Arg_InvalidFileName = Specified file name was invalid.
+Arg_InvalidFileExtension = Specified file extension was not a valid extension.
+Arg_COMException = Error HRESULT E_FAIL has been returned from a call to a COM component.
+Arg_ExternalException = External component has thrown an exception.
+Arg_InvalidComObjectException = Attempt has been made to use a COM object that does not have a backing class factory.
+Arg_InvalidOleVariantTypeException = Specified OLE variant was invalid.
+Arg_MarshalDirectiveException = Marshaling directives are invalid.
+Arg_MarshalAsAnyRestriction = AsAny cannot be used on return types, ByRef parameters, ArrayWithOffset, or parameters passed from unmanaged to managed.
+Arg_NDirectBadObject = No PInvoke conversion exists for value passed to Object-typed parameter.
+Arg_SafeArrayTypeMismatchException = Specified array was not of the expected type.
+Arg_VTableCallsNotSupportedException = Attempted to make an early bound call on a COM dispatch-only interface.
+Arg_SafeArrayRankMismatchException = Specified array was not of the expected rank.
+Arg_AmbiguousMatchException = Ambiguous match found.
+Arg_CustomAttributeFormatException = Binary format of the specified custom attribute was invalid.
+Arg_InvalidFilterCriteriaException = Specified filter criteria was invalid.
+Arg_TypeLoadNullStr = A null or zero length string does not represent a valid Type.
+Arg_TargetInvocationException = Exception has been thrown by the target of an invocation.
+Arg_TargetParameterCountException = Number of parameters specified does not match the expected number.
+Arg_TypeAccessException = Attempt to access the type failed.
+Arg_TypeLoadException = Failure has occurred while loading a type.
+Arg_TypeUnloadedException = Type had been unloaded.
+Arg_ThreadStateException = Thread was in an invalid state for the operation being executed.
+Arg_ThreadStartException = Thread failed to start.
+Arg_WrongAsyncResult = IAsyncResult object did not come from the corresponding async method on this type.
+Arg_WrongType = The value "{0}" is not of type "{1}" and cannot be used in this generic collection.
+Argument_InvalidArgumentForComparison = Type of argument is not compatible with the generic comparer.
+Argument_ALSInvalidCapacity = Specified capacity must not be less than the current capacity.
+Argument_ALSInvalidSlot = Specified slot number was invalid.
+Argument_IdnIllegalName = Decoded string is not a valid IDN name.
+Argument_IdnBadBidi = Left to right characters may not be mixed with right to left characters in IDN labels.
+Argument_IdnBadLabelSize = IDN labels must be between 1 and 63 characters long.
+Argument_IdnBadNameSize = IDN names must be between 1 and {0} characters long.
+Argument_IdnBadPunycode = Invalid IDN encoded string.
+Argument_IdnBadStd3 = Label contains character '{0}' not allowed with UseStd3AsciiRules
+Arg_InvalidANSIString = The ANSI string passed in could not be converted from the default ANSI code page to Unicode.
+Arg_InvalidUTF8String = The UTF8 string passed in could not be converted to Unicode.
+Argument_InvalidCharSequence = Invalid Unicode code point found at index {0}.
+Argument_InvalidCharSequenceNoIndex = String contains invalid Unicode code points.
+Argument_InvalidCalendar = Not a valid calendar for the given culture.
+Argument_InvalidNormalizationForm = Invalid or unsupported normalization form.
+Argument_InvalidPathChars = Illegal characters in path.
+Argument_InvalidOffLen = Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection.
+Argument_InvalidSeekOrigin = Invalid seek origin.
+Argument_SeekOverflow = The specified seek offset '{0}' would result in a negative Stream position.
+Argument_InvalidUnity = Invalid Unity type.
+Argument_LongEnvVarName = Environment variable name cannot contain 1024 or more characters.
+Argument_LongEnvVarValue = Environment variable name or value is too long.
+Argument_StringFirstCharIsZero = The first char in the string is the null character.
+Argument_OnlyMscorlib = Only mscorlib's assembly is valid.
+Argument_PathEmpty = Path cannot be the empty string or all whitespace.
+Argument_PathFormatNotSupported = The given path's format is not supported.
+Argument_PathUriFormatNotSupported = URI formats are not supported.
+Argument_TypeNameTooLong = Type name was too long. The fully qualified type name must be less than 1,024 characters.
+Argument_StreamNotReadable = Stream was not readable.
+Argument_StreamNotWritable = Stream was not writable.
+Argument_InvalidNumberOfMembers = MemberData contains an invalid number of members.
+Argument_InvalidValue = Value was invalid.
+Argument_InvalidKey = Key was invalid.
+Argument_MinMaxValue = '{0}' cannot be greater than {1}.
+Argument_InvalidGroupSize = Every element in the value array should be between one and nine, except for the last element, which can be zero.
+Argument_MustHaveAttributeBaseClass = Type passed in must be derived from System.Attribute or System.Attribute itself.
+Argument_NoUninitializedStrings = Uninitialized Strings cannot be created.
+Argument_UnequalMembers = Supplied MemberInfo does not match the expected type.
+Argument_BadFormatSpecifier = Format specifier was invalid.
+Argument_InvalidHighSurrogate = Found a high surrogate char without a following low surrogate at index: {0}. The input may not be in this encoding, or may not contain valid Unicode (UTF-16) characters.
+Argument_InvalidLowSurrogate = Found a low surrogate char without a preceding high surrogate at index: {0}. The input may not be in this encoding, or may not contain valid Unicode (UTF-16) characters.
+Argument_UnmatchingSymScope = Non-matching symbol scope.
+Argument_NotInExceptionBlock = Not currently in an exception block.
+Argument_BadExceptionCodeGen = Incorrect code generation for exception block.
+Argument_NotExceptionType = Does not extend Exception.
+Argument_DuplicateResourceName = Duplicate resource name within an assembly.
+Argument_BadPersistableModuleInTransientAssembly = Cannot have a persistable module in a transient assembly.
+Argument_InvalidPermissionState = Invalid permission state.
+Argument_UnrestrictedIdentityPermission = Identity permissions cannot be unrestricted.
+Argument_WrongType = Operation on type '{0}' attempted with target of incorrect type.
+Argument_IllegalZone = Illegal security permission zone specified.
+Argument_HasToBeArrayClass = Must be an array type.
+Argument_InvalidDirectory = Invalid directory, '{0}'.
+Argument_DataLengthDifferent = Parameters 'members' and 'data' must have the same length.
+Argument_SigIsFinalized = Completed signature cannot be modified.
+Argument_ArraysInvalid = Array or pointer types are not valid.
+Argument_GenericsInvalid = Generic types are not valid.
+Argument_LargeInteger = Integer or token was too large to be encoded.
+Argument_BadSigFormat = Incorrect signature format.
+Argument_UnmatchedMethodForLocal = Local passed in does not belong to this ILGenerator.
+Argument_DuplicateName = Tried to add NamedPermissionSet with non-unique name.
+Argument_InvalidXMLElement = Invalid XML. Missing required tag <{0}> for type '{1}'.
+Argument_InvalidXMLMissingAttr = Invalid XML. Missing required attribute '{0}'.
+Argument_CannotGetTypeTokenForByRef = Cannot get TypeToken for a ByRef type.
+Argument_NotASimpleNativeType = The UnmanagedType passed to DefineUnmanagedMarshal is not a simple type. None of the following values may be used: UnmanagedType.ByValTStr, UnmanagedType.SafeArray, UnmanagedType.ByValArray, UnmanagedType.LPArray, UnmanagedType.CustomMarshaler.
+Argument_NotACustomMarshaler = Not a custom marshal.
+Argument_NoUnmanagedElementCount = Unmanaged marshal does not have ElementCount.
+Argument_NoNestedMarshal = Only LPArray or SafeArray has nested unmanaged marshal.
+Argument_InvalidXML = Invalid Xml.
+Argument_NoUnderlyingCCW = The object has no underlying COM data associated with it.
+Argument_BadFieldType = Bad field type in defining field.
+Argument_InvalidXMLBadVersion = Invalid Xml - can only parse elements of version one.
+Argument_NotAPermissionElement = 'elem' was not a permission element.
+Argument_NPMSInvalidName = Name can be neither null nor empty.
+Argument_InvalidElementTag = Invalid element tag '{0}'.
+Argument_InvalidElementText = Invalid element text '{0}'.
+Argument_InvalidElementName = Invalid element name '{0}'.
+Argument_InvalidElementValue = Invalid element value '{0}'.
+Argument_AttributeNamesMustBeUnique = Attribute names must be unique.
+#if FEATURE_CAS_POLICY
+Argument_UninitializedCertificate = Uninitialized certificate object.
+Argument_MembershipConditionElement = Element must be a <IMembershipCondition> element.
+Argument_ReservedNPMS = Cannot remove or modify reserved permissions set '{0}'.
+Argument_NPMSInUse = Permission set '{0}' was in use and could not be deleted.
+Argument_StrongNameGetPublicKey = Unable to obtain public key for StrongNameKeyPair.
+Argument_SiteCannotBeNull = Site name must be specified.
+Argument_BlobCannotBeNull = Public key must be specified.
+Argument_ZoneCannotBeNull = Zone must be specified.
+Argument_UrlCannotBeNull = URL must be specified.
+Argument_NoNPMS = Unable to find a permission set with the provided name.
+Argument_FailedCodeGroup = Failed to create a code group of type '{0}'.
+Argument_CodeGroupChildrenMustBeCodeGroups = All objects in the input list must have a parent type of 'CodeGroup'.
+#endif // FEATURE_CAS_POLICY
+#if FEATURE_IMPERSONATION
+Argument_InvalidPrivilegeName = Privilege '{0}' is not valid on this system.
+Argument_TokenZero = Token cannot be zero.
+Argument_InvalidImpersonationToken = Invalid token for impersonation - it cannot be duplicated.
+Argument_ImpersonateUser = Unable to impersonate user.
+#endif // FEATURE_IMPERSONATION
+Argument_InvalidHexFormat = Improperly formatted hex string.
+Argument_InvalidSite = Invalid site.
+Argument_InterfaceMap = 'this' type cannot be an interface itself.
+Argument_ArrayGetInterfaceMap = Interface maps for generic interfaces on arrays cannot be retrieved.
+Argument_InvalidName = Invalid name.
+Argument_InvalidDirectoryOnUrl = Invalid directory on URL.
+Argument_InvalidUrl = Invalid URL.
+Argument_InvalidKindOfTypeForCA = This type cannot be represented as a custom attribute.
+Argument_MustSupplyContainer = When supplying a FieldInfo for fixing up a nested type, a valid ID for that containing object must also be supplied.
+Argument_MustSupplyParent = When supplying the ID of a containing object, the FieldInfo that identifies the current field within that object must also be supplied.
+Argument_NoClass = Element does not specify a class.
+Argument_WrongElementType = '{0}' element required.
+Argument_UnableToGeneratePermissionSet = Unable to generate permission set; input XML may be malformed.
+Argument_NoEra = No Era was supplied.
+Argument_AssemblyAlreadyFullTrust = Assembly was already fully trusted.
+Argument_AssemblyNotFullTrust = Assembly was not fully trusted.
+Argument_AssemblyWinMD = Assembly must not be a Windows Runtime assembly.
+Argument_MemberAndArray = Cannot supply both a MemberInfo and an Array to indicate the parent of a value type.
+Argument_ObjNotComObject = The object's type must be __ComObject or derived from __ComObject.
+Argument_ObjIsWinRTObject = The object's type must not be a Windows Runtime type.
+Argument_TypeNotComObject = The type must be __ComObject or be derived from __ComObject.
+Argument_TypeIsWinRTType = The type must not be a Windows Runtime type.
+Argument_CantCallSecObjFunc = Cannot evaluate a security function.
+Argument_StructMustNotBeValueClass = The structure must not be a value class.
+Argument_NoSpecificCulture = Please select a specific culture, such as zh-CN, zh-HK, zh-TW, zh-MO, zh-SG.
+Argument_InvalidResourceCultureName = The given culture name '{0}' cannot be used to locate a resource file. Resource filenames must consist of only letters, numbers, hyphens or underscores.
+Argument_InvalidParamInfo = Invalid type for ParameterInfo member in Attribute class.
+Argument_EmptyDecString = Decimal separator cannot be the empty string.
+Argument_OffsetOfFieldNotFound = Field passed in is not a marshaled member of the type '{0}'.
+Argument_EmptyStrongName = StrongName cannot have an empty string for the assembly name.
+Argument_NotSerializable = Argument passed in is not serializable.
+Argument_EmptyApplicationName = ApplicationId cannot have an empty string for the name.
+Argument_NoDomainManager = The domain manager specified by the host could not be instantiated.
+Argument_NoMain = Main entry point not defined.
+Argument_InvalidDateTimeKind = Invalid DateTimeKind value.
+Argument_ConflictingDateTimeStyles = The DateTimeStyles values AssumeLocal and AssumeUniversal cannot be used together.
+Argument_ConflictingDateTimeRoundtripStyles = The DateTimeStyles value RoundtripKind cannot be used with the values AssumeLocal, AssumeUniversal or AdjustToUniversal.
+Argument_InvalidDigitSubstitution = The DigitSubstitution property must be of a valid member of the DigitShapes enumeration. Valid entries include Context, NativeNational or None.
+Argument_InvalidNativeDigitCount = The NativeDigits array must contain exactly ten members.
+Argument_InvalidNativeDigitValue = Each member of the NativeDigits array must be a single text element (one or more UTF16 code points) with a Unicode Nd (Number, Decimal Digit) property indicating it is a digit.
+ArgumentException_InvalidAceBinaryForm = The binary form of an ACE object is invalid.
+ArgumentException_InvalidAclBinaryForm = The binary form of an ACL object is invalid.
+ArgumentException_InvalidSDSddlForm = The SDDL form of a security descriptor object is invalid.
+Argument_InvalidSafeHandle = The SafeHandle is invalid.
+Argument_CannotPrepareAbstract = Abstract methods cannot be prepared.
+Argument_ArrayTooLarge = The input array length must not exceed Int32.MaxValue / {0}. Otherwise BitArray.Length would exceed Int32.MaxValue.
+Argument_RelativeUrlMembershipCondition = UrlMembershipCondition requires an absolute URL.
+Argument_EmptyWaithandleArray = Waithandle array may not be empty.
+Argument_InvalidSafeBufferOffLen = Offset and length were greater than the size of the SafeBuffer.
+Argument_NotEnoughBytesToRead = There are not enough bytes remaining in the accessor to read at this position.
+Argument_NotEnoughBytesToWrite = There are not enough bytes remaining in the accessor to write at this position.
+Argument_OffsetAndLengthOutOfBounds = Offset and length were out of bounds for the array or count is greater than the number of elements from index to the end of the source collection.
+Argument_OffsetAndCapacityOutOfBounds = Offset and capacity were greater than the size of the view.
+Argument_UnmanagedMemAccessorWrapAround = The UnmanagedMemoryAccessor capacity and offset would wrap around the high end of the address space.
+Argument_UnrecognizedLoaderOptimization = Unrecognized LOADER_OPTIMIZATION property value. Supported values may include "SingleDomain", "MultiDomain", "MultiDomainHost", and "NotSpecified".
+ArgumentException_NotAllCustomSortingFuncsDefined = Implementations of all the NLS functions must be provided.
+ArgumentException_MinSortingVersion = The runtime does not support a version of "{0}" less than {1}.
+
+;
+; =====================================================
+; Reflection Emit resource strings
+Arugment_EmitMixedContext1 = Type '{0}' was loaded in the ReflectionOnly context but the AssemblyBuilder was not created as AssemblyBuilderAccess.ReflectionOnly.
+Arugment_EmitMixedContext2 = Type '{0}' was not loaded in the ReflectionOnly context but the AssemblyBuilder was created as AssemblyBuilderAccess.ReflectionOnly.
+Argument_BadSizeForData = Data size must be > 0 and < 0x3f0000
+Argument_InvalidLabel = Invalid Label.
+Argument_RedefinedLabel = Label multiply defined.
+Argument_UnclosedExceptionBlock = The IL Generator cannot be used while there are unclosed exceptions.
+Argument_MissingDefaultConstructor = was missing default constructor.
+Argument_TooManyFinallyClause = Exception blocks may have at most one finally clause.
+Argument_NotInTheSameModuleBuilder = The argument passed in was not from the same ModuleBuilder.
+Argument_BadCurrentLocalVariable = Bad current local variable for setting symbol information.
+Argument_DuplicateModuleName = Duplicate dynamic module name within an assembly.
+Argument_DuplicateTypeName = Duplicate type name within an assembly.
+Argument_InvalidAssemblyName = Assembly names may not begin with whitespace or contain the characters '/', or '\\' or ':'.
+Argument_InvalidGenericInstantiation = The given generic instantiation was invalid.
+Argument_DuplicatedFileName = Duplicate file names.
+Argument_GlobalFunctionHasToBeStatic = Global members must be static.
+Argument_BadPInvokeOnInterface = PInvoke methods cannot exist on interfaces.
+Argument_BadPInvokeMethod = PInvoke methods must be static and native and cannot be abstract.
+Argument_MethodRedefined = Method has been already defined.
+Argument_BadTypeAttrAbstractNFinal = Bad type attributes. A type cannot be both abstract and final.
+Argument_BadTypeAttrNestedVisibilityOnNonNestedType = Bad type attributes. Nested visibility flag set on a non-nested type.
+Argument_BadTypeAttrNonNestedVisibilityNestedType = Bad type attributes. Non-nested visibility flag set on a nested type.
+Argument_BadTypeAttrInvalidLayout = Bad type attributes. Invalid layout attribute specified.
+Argument_BadTypeAttrReservedBitsSet = Bad type attributes. Reserved bits set on the type.
+Argument_BadFieldSig = Field signatures do not have return types.
+Argument_ShouldOnlySetVisibilityFlags = Should only set visibility flags when creating EnumBuilder.
+Argument_BadNestedTypeFlags = Visibility of interfaces must be one of the following: NestedAssembly, NestedFamANDAssem, NestedFamily, NestedFamORAssem, NestedPrivate or NestedPublic.
+Argument_ShouldNotSpecifyExceptionType = Should not specify exception type for catch clause for filter block.
+Argument_BadLabel = Bad label in ILGenerator.
+Argument_BadLabelContent = Bad label content in ILGenerator.
+Argument_EmitWriteLineType = EmitWriteLine does not support this field or local type.
+Argument_ConstantNull = Null is not a valid constant value for this type.
+Argument_ConstantDoesntMatch = Constant does not match the defined type.
+Argument_ConstantNotSupported = {0} is not a supported constant type.
+Argument_BadConstructor = Cannot have private or static constructor.
+Argument_BadConstructorCallConv = Constructor must have standard calling convention.
+Argument_BadPropertyForConstructorBuilder = Property must be on the same type of the given ConstructorInfo.
+Argument_NotAWritableProperty = Not a writable property.
+Argument_BadFieldForConstructorBuilder = Field must be on the same type of the given ConstructorInfo.
+Argument_BadAttributeOnInterfaceMethod = Interface method must be abstract and virtual.
+ArgumentException_BadMethodImplBody = MethodOverride's body must be from this type.
+Argument_BadParameterCountsForConstructor = Parameter count does not match passed in argument value count.
+Argument_BadParameterTypeForConstructor = Passed in argument value at index {0} does not match the parameter type.
+Argument_BadTypeInCustomAttribute = An invalid type was used as a custom attribute constructor argument, field or property.
+Argument_DateTimeBadBinaryData = The binary data must result in a DateTime with ticks between DateTime.MinValue.Ticks and DateTime.MaxValue.Ticks.
+Argument_VerStringTooLong = The unmanaged Version information is too large to persist.
+Argument_UnknownUnmanagedCallConv = Unknown unmanaged calling convention for function signature.
+Argument_BadConstantValue = Bad default value.
+Argument_IllegalName = Illegal name.
+Argument_cvtres_NotFound = Cannot find cvtres.exe
+Argument_BadCAForUnmngRSC = Bad '{0}' while generating unmanaged resource information.
+Argument_MustBeInterfaceMethod = The MemberInfo must be an interface method.
+Argument_CORDBBadVarArgCallConv = Cannot evaluate a VarArgs function.
+Argument_CORDBBadMethod = Cannot find the method on the object instance.
+Argument_InvalidOpCodeOnDynamicMethod = Ldtoken, Ldftn and Ldvirtftn OpCodes cannot target DynamicMethods.
+Argument_InvalidTypeForDynamicMethod = Invalid type owner for DynamicMethod.
+Argument_NeedGenericMethodDefinition = Method must represent a generic method definition on a generic type definition.
+Argument_MethodNeedGenericDeclaringType = The specified method cannot be dynamic or global and must be declared on a generic type definition.
+Argument_ConstructorNeedGenericDeclaringType = The specified constructor must be declared on a generic type definition.
+Argument_FieldNeedGenericDeclaringType = The specified field must be declared on a generic type definition.
+Argument_InvalidMethodDeclaringType = The specified method must be declared on the generic type definition of the specified type.
+Argument_InvalidConstructorDeclaringType = The specified constructor must be declared on the generic type definition of the specified type.
+Argument_InvalidFieldDeclaringType = The specified field must be declared on the generic type definition of the specified type.
+Argument_NeedNonGenericType = The specified Type must not be a generic type definition.
+Argument_MustBeTypeBuilder = 'type' must contain a TypeBuilder as a generic argument.
+Argument_CannotSetParentToInterface = Cannot set parent to an interface.
+Argument_MismatchedArrays = Two arrays, {0} and {1}, must be of the same size.
+Argument_NeedNonGenericObject = The specified object must not be an instance of a generic type.
+Argument_NeedStructWithNoRefs = The specified Type must be a struct containing no references.
+Argument_NotMethodCallOpcode = The specified opcode cannot be passed to EmitCall.
+
+; =====================================================
+;
+Argument_ModuleAlreadyLoaded = The specified module has already been loaded.
+Argument_MustHaveLayoutOrBeBlittable = The specified structure must be blittable or have layout information.
+Argument_NotSimpleFileName = The filename must not include a path specification.
+Argument_TypeMustBeVisibleFromCom = The specified type must be visible from COM.
+Argument_TypeMustBeComCreatable = The type must be creatable from COM.
+Argument_TypeMustNotBeComImport = The type must not be imported from COM.
+Argument_PolicyFileDoesNotExist = The requested policy file does not exist.
+Argument_NonNullObjAndCtx = Either obj or ctx must be null.
+Argument_NoModuleFileExtension = Module file name '{0}' must have file extension.
+Argument_TypeDoesNotContainMethod = Type does not contain the given method.
+Argument_StringZeroLength = String cannot be of zero length.
+Argument_MustBeString = String is too long or has invalid contents.
+Argument_AbsolutePathRequired = Absolute path information is required.
+Argument_ManifestFileDoesNotExist = The specified manifest file does not exist.
+Argument_MustBeRuntimeType = Type must be a runtime Type object.
+Argument_TypeNotValid = The Type object is not valid.
+Argument_MustBeRuntimeMethodInfo = MethodInfo must be a runtime MethodInfo object.
+Argument_MustBeRuntimeFieldInfo = FieldInfo must be a runtime FieldInfo object.
+Argument_InvalidFieldInfo = The FieldInfo object is not valid.
+Argument_InvalidConstructorInfo = The ConstructorInfo object is not valid.
+Argument_MustBeRuntimeAssembly = Assembly must be a runtime Assembly object.
+Argument_MustBeRuntimeModule = Module must be a runtime Module object.
+Argument_MustBeRuntimeParameterInfo = ParameterInfo must be a runtime ParameterInfo object.
+Argument_InvalidParameterInfo = The ParameterInfo object is not valid.
+Argument_MustBeRuntimeReflectionObject = The object must be a runtime Reflection object.
+Argument_InvalidMarshalByRefObject = The MarshalByRefObject is not valid.
+Argument_TypedReferenceInvalidField = Field in TypedReferences cannot be static or init only.
+Argument_HandleLeak = Cannot pass a GCHandle across AppDomains.
+Argument_ArgumentZero = Argument cannot be zero.
+Argument_ImproperType = Improper types in collection.
+Argument_NotAMembershipCondition = The type does not implement IMembershipCondition
+Argument_NotAPermissionType = The type does not implement IPermission
+Argument_NotACodeGroupType = The type does not inherit from CodeGroup
+Argument_NotATP = Type must be a TransparentProxy
+Argument_AlreadyACCW = The object already has a CCW associated with it.
+Argument_OffsetLocalMismatch = The UTC Offset of the local dateTime parameter does not match the offset argument.
+Argument_OffsetUtcMismatch = The UTC Offset for Utc DateTime instances must be 0.
+Argument_UTCOutOfRange = The UTC time represented when the offset is applied must be between year 0 and 10,000.
+Argument_OffsetOutOfRange = Offset must be within plus or minus 14 hours.
+Argument_OffsetPrecision = Offset must be specified in whole minutes.
+Argument_FlagNotSupported = One or more flags are not supported.
+Argument_MustBeFalse = Argument must be initialized to false
+Argument_ToExclusiveLessThanFromExclusive = fromInclusive must be less than or equal to toExclusive.
+Argument_FrameworkNameTooShort=FrameworkName cannot have less than two components or more than three components.
+Argument_FrameworkNameInvalid=FrameworkName is invalid.
+Argument_FrameworkNameMissingVersion=FrameworkName version component is missing.
+#if FEATURE_COMINTEROP
+Argument_TypeNotActivatableViaWindowsRuntime = Type '{0}' does not have an activation factory because it is not activatable by Windows Runtime.
+Argument_WinRTSystemRuntimeType = Cannot marshal type '{0}' to Windows Runtime. Only 'System.RuntimeType' is supported.
+Argument_Unexpected_TypeSource = Unexpected TypeKind when marshaling Windows.Foundation.TypeName.
+#endif // FEATURE_COMINTEROP
+
+; ArgumentNullException
+ArgumentNull_Array = Array cannot be null.
+ArgumentNull_ArrayValue = Found a null value within an array.
+ArgumentNull_ArrayElement = At least one element in the specified array was null.
+ArgumentNull_Assembly = Assembly cannot be null.
+ArgumentNull_AssemblyName = AssemblyName cannot be null.
+ArgumentNull_AssemblyNameName = AssemblyName.Name cannot be null or an empty string.
+ArgumentNull_Buffer = Buffer cannot be null.
+ArgumentNull_Collection = Collection cannot be null.
+ArgumentNull_CultureInfo = CultureInfo cannot be null.
+ArgumentNull_Dictionary = Dictionary cannot be null.
+ArgumentNull_FileName = File name cannot be null.
+ArgumentNull_Key = Key cannot be null.
+ArgumentNull_Graph = Object Graph cannot be null.
+ArgumentNull_Path = Path cannot be null.
+ArgumentNull_Stream = Stream cannot be null.
+ArgumentNull_String = String reference not set to an instance of a String.
+ArgumentNull_Type = Type cannot be null.
+ArgumentNull_Obj = Object cannot be null.
+ArgumentNull_GUID = GUID cannot be null.
+ArgumentNull_NullMember = Member at position {0} was null.
+ArgumentNull_Generic = Value cannot be null.
+ArgumentNull_WithParamName = Parameter '{0}' cannot be null.
+ArgumentNull_Child = Cannot have a null child.
+ArgumentNull_SafeHandle = SafeHandle cannot be null.
+ArgumentNull_CriticalHandle = CriticalHandle cannot be null.
+ArgumentNull_TypedRefType = Type in TypedReference cannot be null.
+ArgumentNull_ApplicationTrust = The application trust cannot be null.
+ArgumentNull_TypeRequiredByResourceScope = The type parameter cannot be null when scoping the resource's visibility to Private or Assembly.
+ArgumentNull_Waithandles = The waitHandles parameter cannot be null.
+
+; ArgumentOutOfRangeException
+ArgumentOutOfRange_AddressSpace = The number of bytes cannot exceed the virtual address space on a 32 bit machine.
+ArgumentOutOfRange_ArrayLB = Number was less than the array's lower bound in the first dimension.
+ArgumentOutOfRange_ArrayLBAndLength = Higher indices will exceed Int32.MaxValue because of large lower bound and/or length.
+ArgumentOutOfRange_ArrayLength = The length of the array must be between {0} and {1}, inclusive.
+ArgumentOutOfRange_ArrayLengthMultiple = The length of the array must be a multiple of {0}.
+ArgumentOutOfRange_ArrayListInsert = Insertion index was out of range. Must be non-negative and less than or equal to size.
+ArgumentOutOfRange_ArrayTooSmall = Destination array is not long enough to copy all the required data. Check array length and offset.
+ArgumentOutOfRange_BeepFrequency = Console.Beep's frequency must be between {0} and {1}.
+ArgumentOutOfRange_BiggerThanCollection = Larger than collection size.
+ArgumentOutOfRange_Bounds_Lower_Upper = Argument must be between {0} and {1}.
+ArgumentOutOfRange_Count = Count must be positive and count must refer to a location within the string/array/collection.
+ArgumentOutOfRange_CalendarRange = Specified time is not supported in this calendar. It should be between {0} (Gregorian date) and {1} (Gregorian date), inclusive.
+ArgumentOutOfRange_ConsoleBufferBoundaries = The value must be greater than or equal to zero and less than the console's buffer size in that dimension.
+ArgumentOutOfRange_ConsoleBufferLessThanWindowSize = The console buffer size must not be less than the current size and position of the console window, nor greater than or equal to Int16.MaxValue.
+ArgumentOutOfRange_ConsoleWindowBufferSize = The new console window size would force the console buffer size to be too large.
+ArgumentOutOfRange_ConsoleTitleTooLong = The console title is too long.
+ArgumentOutOfRange_ConsoleWindowPos = The window position must be set such that the current window size fits within the console's buffer, and the numbers must not be negative.
+ArgumentOutOfRange_ConsoleWindowSize_Size = The value must be less than the console's current maximum window size of {0} in that dimension. Note that this value depends on screen resolution and the console font.
+ArgumentOutOfRange_ConsoleKey = Console key values must be between 0 and 255.
+ArgumentOutOfRange_CursorSize = The cursor size is invalid. It must be a percentage between 1 and 100.
+ArgumentOutOfRange_BadYearMonthDay = Year, Month, and Day parameters describe an un-representable DateTime.
+ArgumentOutOfRange_BadHourMinuteSecond = Hour, Minute, and Second parameters describe an un-representable DateTime.
+ArgumentOutOfRange_DateArithmetic = The added or subtracted value results in an un-representable DateTime.
+ArgumentOutOfRange_DateTimeBadMonths = Months value must be between +/-120000.
+ArgumentOutOfRange_DateTimeBadYears = Years value must be between +/-10000.
+ArgumentOutOfRange_DateTimeBadTicks = Ticks must be between DateTime.MinValue.Ticks and DateTime.MaxValue.Ticks.
+ArgumentOutOfRange_Day = Day must be between 1 and {0} for month {1}.
+ArgumentOutOfRange_DecimalRound = Decimal can only round to between 0 and 28 digits of precision.
+ArgumentOutOfRange_DecimalScale = Decimal's scale value must be between 0 and 28, inclusive.
+ArgumentOutOfRange_Era = Time value was out of era range.
+ArgumentOutOfRange_Enum = Enum value was out of legal range.
+ArgumentOutOfRange_FileLengthTooBig = Specified file length was too large for the file system.
+ArgumentOutOfRange_FileTimeInvalid = Not a valid Win32 FileTime.
+ArgumentOutOfRange_GetByteCountOverflow = Too many characters. The resulting number of bytes is larger than what can be returned as an int.
+ArgumentOutOfRange_GetCharCountOverflow = Too many bytes. The resulting number of chars is larger than what can be returned as an int.
+ArgumentOutOfRange_HashtableLoadFactor = Load factor needs to be between 0.1 and 1.0.
+ArgumentOutOfRange_HugeArrayNotSupported = Arrays larger than 2GB are not supported.
+ArgumentOutOfRange_InvalidHighSurrogate = A valid high surrogate character is between 0xd800 and 0xdbff, inclusive.
+ArgumentOutOfRange_InvalidLowSurrogate = A valid low surrogate character is between 0xdc00 and 0xdfff, inclusive.
+ArgumentOutOfRange_InvalidEraValue = Era value was not valid.
+ArgumentOutOfRange_InvalidUserDefinedAceType = User-defined ACEs must not have a well-known ACE type.
+ArgumentOutOfRange_InvalidUTF32 = A valid UTF32 value is between 0x000000 and 0x10ffff, inclusive, and should not include surrogate codepoint values (0x00d800 ~ 0x00dfff).
+ArgumentOutOfRange_Index = Index was out of range. Must be non-negative and less than the size of the collection.
+ArgumentOutOfRange_IndexString = Index was out of range. Must be non-negative and less than the length of the string.
+ArgumentOutOfRange_StreamLength = Stream length must be non-negative and less than 2^31 - 1 - origin.
+ArgumentOutOfRange_LessEqualToIntegerMaxVal = Argument must be less than or equal to 2^31 - 1 milliseconds.
+ArgumentOutOfRange_Month = Month must be between one and twelve.
+ArgumentOutOfRange_MustBeNonNegInt32 = Value must be non-negative and less than or equal to Int32.MaxValue.
+ArgumentOutOfRange_NeedNonNegNum = Non-negative number required.
+ArgumentOutOfRange_NeedNonNegOrNegative1 = Number must be either non-negative and less than or equal to Int32.MaxValue or -1.
+ArgumentOutOfRange_NeedPosNum = Positive number required.
+ArgumentOutOfRange_NegativeCapacity = Capacity must be positive.
+ArgumentOutOfRange_NegativeCount = Count cannot be less than zero.
+ArgumentOutOfRange_NegativeLength = Length cannot be less than zero.
+ArgumentOutOfRange_NegFileSize = Length must be non-negative.
+ArgumentOutOfRange_ObjectID = objectID cannot be less than or equal to zero.
+ArgumentOutOfRange_SmallCapacity = capacity was less than the current size.
+ArgumentOutOfRange_QueueGrowFactor = Queue grow factor must be between {0} and {1}.
+ArgumentOutOfRange_RoundingDigits = Rounding digits must be between 0 and 15, inclusive.
+ArgumentOutOfRange_StartIndex = StartIndex cannot be less than zero.
+ArgumentOutOfRange_MustBePositive = '{0}' must be greater than zero.
+ArgumentOutOfRange_MustBeNonNegNum = '{0}' must be non-negative.
+ArgumentOutOfRange_LengthGreaterThanCapacity = The length cannot be greater than the capacity.
+ArgumentOutOfRange_ListInsert = Index must be within the bounds of the List.
+ArgumentOutOfRange_StartIndexLessThanLength = startIndex must be less than length of string.