├── .gitignore
├── .gitmodules
├── .travis.yml
├── .vsts-ci
├── ci.yml
├── misc-analysis.yml
├── releaseBuild.yml
└── templates
│ ├── build.yml
│ ├── compliance.yml
│ └── test.yml
├── LICENSE
├── README.md
├── Solutions
├── .gitignore
└── VS15_amd64
│ ├── Microsoft.Management.Infrastructure.Tests
│ ├── Microsoft.Management.Infrastructure.Tests.csproj
│ └── packages.config
│ └── Microsoft.Management.Infrastructure
│ ├── Microsoft.Management.Infrastructure.csproj
│ └── Microsoft.Management.Infrastructure.sln
├── build.sh
├── global.json
├── nuget.config
├── packages
└── System.Security.SecureString.4.0.0-rc1.nupkg
├── signing
└── visualstudiopublic.snk
├── src
├── Microsoft.Management.Infrastructure
│ ├── AssemblyInfo.cs
│ ├── CimClass.cs
│ ├── CimConverter.cs
│ ├── CimException.cs
│ ├── CimFlags.cs
│ ├── CimInstance.cs
│ ├── CimMethodDeclaration.cs
│ ├── CimMethodParameter.cs
│ ├── CimMethodParameterDeclaration.cs
│ ├── CimMethodParametersCollection.cs
│ ├── CimMethodResult.cs
│ ├── CimMethodResultBase.cs
│ ├── CimMethodStreamedResult.cs
│ ├── CimProperty.cs
│ ├── CimPropertyDeclaration.cs
│ ├── CimQualifier.cs
│ ├── CimSession.cs
│ ├── CimSubscriptionResult.cs
│ ├── CimSystemProperties.cs
│ ├── CimType.cs
│ ├── Generic
│ │ ├── CimAsyncCollection.cs
│ │ ├── CimAsyncResult.cs
│ │ ├── CimAsyncStatus.cs
│ │ ├── CimKeyedCollection.cs
│ │ └── CimReadOnlyKeyedCollection.cs
│ ├── Internal
│ │ ├── CimApplication.cs
│ │ ├── CimOperationCallbackProcessingContext.cs
│ │ ├── ClassHandleExtensionMethods.cs
│ │ ├── Data
│ │ │ ├── CimClassPropertiesCollection.cs
│ │ │ ├── CimClassPropertyOfClass.cs
│ │ │ ├── CimClassQualifierCollection.cs
│ │ │ ├── CimMethodDeclarationCollection.cs
│ │ │ ├── CimMethodDeclarationOfClass.cs
│ │ │ ├── CimMethodParameterBackedByCimProperty.cs
│ │ │ ├── CimMethodParameterDeclarationCollection.cs
│ │ │ ├── CimMethodParameterDeclarationOfMethod.cs
│ │ │ ├── CimMethodParameterQualifierCollection.cs
│ │ │ ├── CimMethodParameterQualifierOfMethod.cs
│ │ │ ├── CimMethodQualifierCollection.cs
│ │ │ ├── CimMethodQualifierOfMethod.cs
│ │ │ ├── CimPropertiesCollection.cs
│ │ │ ├── CimPropertyOfInstance.cs
│ │ │ ├── CimPropertyQualifierCollection.cs
│ │ │ ├── CimPropertyStandalone.cs
│ │ │ ├── CimQualifierOfClass.cs
│ │ │ └── CimQualifierOfProperty.cs
│ │ ├── Helpers.cs
│ │ ├── InstanceHandleExtensionMethods.cs
│ │ ├── MiFlagsExtensionMethods.cs
│ │ ├── MiTypeExtensionMethods.cs
│ │ ├── NativeErrorCodeExtensionMethods.cs
│ │ ├── Operations
│ │ │ ├── CancellationMode.cs
│ │ │ ├── CimAsyncCallbacksReceiverBase.cs
│ │ │ ├── CimAsyncCancellationDisposable.cs
│ │ │ ├── CimAsyncClassObservable.cs
│ │ │ ├── CimAsyncClassObserverProxy.cs
│ │ │ ├── CimAsyncDelegatedObservable.cs
│ │ │ ├── CimAsyncIndicationObservable.cs
│ │ │ ├── CimAsyncIndicationObserverProxy.cs
│ │ │ ├── CimAsyncInstanceObservable.cs
│ │ │ ├── CimAsyncInstanceObserverProxy.cs
│ │ │ ├── CimAsyncMethodResultObservable.cs
│ │ │ ├── CimAsyncMethodResultObserverProxy.cs
│ │ │ ├── CimAsyncObservableBase.cs
│ │ │ ├── CimAsyncObserverProxyBase.cs
│ │ │ ├── CimOperation.cs
│ │ │ ├── CimSyncClassEnumerable.cs
│ │ │ ├── CimSyncClassEnumerator.cs
│ │ │ ├── CimSyncEnumerableBase.cs
│ │ │ ├── CimSyncEnumeratorBase.cs
│ │ │ ├── CimSyncIndicationEnumerable.cs
│ │ │ ├── CimSyncIndicationEnumerator.cs
│ │ │ ├── CimSyncInstanceEnumerable.cs
│ │ │ ├── CimSyncInstanceEnumerator.cs
│ │ │ ├── ConvertingObservable.cs
│ │ │ └── EmptyDisposable.cs
│ │ ├── SanityHelpers.cs
│ │ └── ValueHelpers.cs
│ ├── Microsoft.Management.Infrastructure.csproj
│ ├── Native
│ │ ├── Enumerations
│ │ │ ├── MI_AuthType.cs
│ │ │ ├── MI_CallbackMode.cs
│ │ │ ├── MI_CancellationReason.cs
│ │ │ ├── MI_DestinationOptionsFlags.cs
│ │ │ ├── MI_Flags.cs
│ │ │ ├── MI_ImpersonationType.cs
│ │ │ ├── MI_ModuleFlags.cs
│ │ │ ├── MI_OperationCallback_ResponseType.cs
│ │ │ ├── MI_OperationFlags.cs
│ │ │ ├── MI_OperationOptionsFlags.cs
│ │ │ ├── MI_PacketEncoding.cs
│ │ │ ├── MI_PromptType.cs
│ │ │ ├── MI_Protocol.cs
│ │ │ ├── MI_ProxyType.cs
│ │ │ ├── MI_Result.cs
│ │ │ ├── MI_SerializationFormat.cs
│ │ │ ├── MI_SerializerFlags.cs
│ │ │ ├── MI_SubscriptionDeliveryType.cs
│ │ │ ├── MI_Transport.cs
│ │ │ ├── MI_Type.cs
│ │ │ └── MI_WriteMessageChannel.cs
│ │ ├── MI_Application.cs
│ │ ├── MI_Class.cs
│ │ ├── MI_ClassDecl.cs
│ │ ├── MI_Deserializer.cs
│ │ ├── MI_DestinationOptions.cs
│ │ ├── MI_FunctionTableCache.cs
│ │ ├── MI_Instance.cs
│ │ ├── MI_NativeObject.cs
│ │ ├── MI_NativeObjectWithFT.cs
│ │ ├── MI_Operation.cs
│ │ ├── MI_OperationOptions.cs
│ │ ├── MI_ParameterSet.cs
│ │ ├── MI_PlatformSpecific.cs
│ │ ├── MI_PropertyDecl.cs
│ │ ├── MI_QualifierDecl.cs
│ │ ├── MI_QualifierSet.cs
│ │ ├── MI_SerializationFTHelpers.cs
│ │ ├── MI_Serializer.cs
│ │ ├── MI_Session.cs
│ │ ├── MI_SubscriptionDeliveryOptions.cs
│ │ ├── NativeCimCredential.cs
│ │ ├── NativeMethods.cs
│ │ └── Structures
│ │ │ ├── MI_Array.cs
│ │ │ ├── MI_Datetime.cs
│ │ │ ├── MI_DeserializerCallbacks.cs
│ │ │ ├── MI_ExtendedArray.cs
│ │ │ ├── MI_Interval.cs
│ │ │ ├── MI_OperationCallbacks.cs
│ │ │ ├── MI_SessionCreationCallbacks.cs
│ │ │ ├── MI_String.cs
│ │ │ ├── MI_Timestamp.cs
│ │ │ ├── MI_UserCredentials.cs
│ │ │ └── MI_Value.cs
│ ├── NativeErrorCode.cs
│ ├── Options
│ │ ├── CimCredential.cs
│ │ ├── CimSemantics.cs
│ │ ├── CimSessionOptions.cs
│ │ ├── DComSessionOptions.cs
│ │ ├── Internal
│ │ │ ├── CimOperationFlags.cs
│ │ │ ├── CimOperationOptions.cs
│ │ │ ├── CimSubscriptionDeliveryOptions.cs
│ │ │ ├── ImpersonationType.cs
│ │ │ ├── PacketEncoding.cs
│ │ │ └── ProxyType.cs
│ │ └── WSManSessionOptions.cs
│ ├── Serialization
│ │ ├── CimDeserializer.cs
│ │ ├── CimMofDeserializer.cs
│ │ ├── CimMofSerializer.cs
│ │ ├── CimSerializer.cs
│ │ └── MofDeserializerSchemaValidationOption.cs
│ └── Strings.Designer.cs
└── signing
│ ├── map.json
│ └── visualstudiopublic.snk
├── test.sh
└── test
└── Microsoft.Management.Infrastructure.Tests
├── AssemblyInfo.cs
├── CimInstanceTests.cs
├── Helpers
├── Assert.cs
├── Helpers.cs
├── MIAssert.cs
├── TDDFact.cs
├── TestMIProperty.cs
├── WindowsAssert.cs
└── WindowsFact.cs
├── InternalTests
└── CimApplicationTests.cs
├── Microsoft.Management.Infrastructure.Tests.csproj
├── NativeTests
├── .SlowTests.cs.swp
├── Fixtures
│ ├── ApplicationFixture.cs
│ ├── SessionFixture.cs
│ └── StaticFixtures.cs
├── MIValueTests.cs
├── MOFDeserializerTests.cs
├── MOFSerializerTests.cs
├── NativeDeserializerTestsBase.cs
├── NativeSerializerTestsBase.cs
├── NativeTestsBase.cs
├── SanityTests.cs
├── SessionTests.cs
├── SlowTests.cs
├── TestData
│ ├── AllTypesClass.cs
│ └── SerializationTestData.cs
├── XMLDeserializerTests.cs
└── XMLSerializerTests.cs
├── SerializationTests
└── CimMofDeserializerTests.cs
├── UnitTests
├── CimClassTest.cs
├── CimInstanceTest.cs
├── CimMofDeserializerTest.cs
├── CimSessionTest.cs
└── TestData
│ ├── dmtftypes.mof
│ ├── dscinstance.mof
│ ├── dscschema.mof
│ ├── mintinstance.mof
│ └── mintschema.mof
└── project.json
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "src/omi"]
2 | path = src/omi
3 | url = git@github.com:PowerShell/omi.git
4 | branch = master
5 |
--------------------------------------------------------------------------------
/.travis.yml:
--------------------------------------------------------------------------------
1 | language: cpp
2 | sudo: required
3 | dist: trusty
4 | git:
5 | submodules: false
6 | before_install:
7 | - git config --global url.git@github.com:.insteadOf https://github.com/
8 | - git submodule update --init
9 | - sudo apt-get install -y -qq curl make g++ cmake libc6 libgcc1 libstdc++6 libcurl3 libgssapi-krb5-2 libicu52 liblldb-3.6 liblttng-ust0 libssl1.0.0 libunwind8 libuuid1 zlib1g clang-3.5
10 | - curl -s "https://raw.githubusercontent.com/dotnet/cli/rel/1.0.0/scripts/obtain/dotnet-install.sh" -o dotnet-install.sh
11 | - bash ./dotnet-install.sh -c rel-1.0.0 -v latest
12 | script:
13 | - ./build.sh
14 | - ./test.sh
15 |
--------------------------------------------------------------------------------
/.vsts-ci/ci.yml:
--------------------------------------------------------------------------------
1 | name: MMI-$(Build.BuildId)
2 | trigger:
3 | branches:
4 | include:
5 | - master
6 | - release*
7 | pr:
8 | branches:
9 | include:
10 | - master
11 | - release*
12 |
13 | pool:
14 | vmImage: 'ubuntu-latest'
15 |
16 | steps:
17 | - template: templates/build.yml
18 |
19 | - template: templates/test.yml
20 |
--------------------------------------------------------------------------------
/.vsts-ci/misc-analysis.yml:
--------------------------------------------------------------------------------
1 | name: MMI-$(Build.BuildId)
2 | trigger:
3 | branches:
4 | include:
5 | - master
6 | - release*
7 | pr:
8 | branches:
9 | include:
10 | - master
11 | - release*
12 |
13 | jobs:
14 | - job: credscan
15 | displayName: 'Secret Scan'
16 | pool: 'Hosted VS2017'
17 |
18 | steps:
19 | - task: securedevelopmentteam.vss-secure-development-tools.build-task-credscan.CredScan@2
20 | displayName: 'Scan for secrets'
21 | inputs:
22 | debugMode: false
23 |
24 | - task: securedevelopmentteam.vss-secure-development-tools.build-task-publishsecurityanalysislogs.PublishSecurityAnalysisLogs@2
25 | displayName: 'Publish Secret Scan Logs to Build Artifacts'
26 | continueOnError: true
27 |
28 | - task: securedevelopmentteam.vss-secure-development-tools.build-task-postanalysis.PostAnalysis@1
29 | displayName: 'Check for failures'
30 | inputs:
31 | CredScan: true
32 | ToolLogsNotFoundAction: Error
33 |
34 |
35 |
--------------------------------------------------------------------------------
/.vsts-ci/releaseBuild.yml:
--------------------------------------------------------------------------------
1 | name: MMI-$(Build.BuildId)
2 | trigger:
3 | branches:
4 | include:
5 | - master
6 | - release*
7 | pr:
8 | branches:
9 | include:
10 | - master
11 | - release*
12 |
13 | jobs:
14 |
15 | - job: build_MMI
16 | displayName: Build MMI
17 | pool:
18 | vmImage: 'ubuntu-latest'
19 | steps:
20 | - template: templates/build.yml
21 |
22 | - template: templates/compliance.yml
23 | parameters:
24 | parentJob: build_MMI
25 |
--------------------------------------------------------------------------------
/.vsts-ci/templates/build.yml:
--------------------------------------------------------------------------------
1 | steps:
2 | - checkout: self
3 |
4 | - bash: sudo apt-get install libpam0g-dev libssl-dev libcurl4-openssl-dev
5 | displayName: 'apt-get dependencies'
6 |
7 | - bash: ./build.sh
8 | displayName: 'Build MMI'
9 |
10 | - task: PublishBuildArtifacts@1
11 | inputs:
12 | artifactName: 'release'
13 | pathToPublish: src/Microsoft.Management.Infrastructure/bin/Microsoft.Management.Infrastructure.dll
14 |
15 | - task: PublishBuildArtifacts@1
16 | inputs:
17 | artifactName: 'release'
18 | pathToPublish: src/Microsoft.Management.Infrastructure/bin/Microsoft.Management.Infrastructure.pdb
19 |
--------------------------------------------------------------------------------
/.vsts-ci/templates/compliance.yml:
--------------------------------------------------------------------------------
1 | parameters:
2 | parentJob: build
3 |
4 | jobs:
5 | - job: compliance
6 | displayName: Compliance for MMI
7 | pool:
8 | name: Package ES CodeHub Lab E
9 | dependsOn:
10 | ${{ parameters.parentJob }}
11 |
12 | steps:
13 | - task: DownloadBuildArtifacts@0
14 | displayName: 'Download artifacts'
15 | inputs:
16 | buildType: current
17 | downloadType: single
18 | artifactName: release
19 | downloadPath: '$(System.ArtifactsDirectory)'
20 |
21 | - task: securedevelopmentteam.vss-secure-development-tools.build-task-antimalware.AntiMalware@3
22 | displayName: 'Run Defender Scan'
23 |
24 | - task: securedevelopmentteam.vss-secure-development-tools.build-task-credscan.CredScan@2
25 | displayName: 'Run CredScan'
26 | inputs:
27 | debugMode: false
28 | continueOnError: true
29 |
30 | - task: securedevelopmentteam.vss-secure-development-tools.build-task-binskim.BinSkim@3
31 | displayName: 'Run BinSkim '
32 | inputs:
33 | InputType: Basic
34 | AnalyzeTarget: '$(System.ArtifactsDirectory)/*.dll'
35 | AnalyzeSymPath: 'SRV*'
36 | AnalyzeVerbose: true
37 | AnalyzeHashes: true
38 | AnalyzeStatistics: true
39 | continueOnError: true
40 |
41 | - task: securedevelopmentteam.vss-secure-development-tools.build-task-policheck.PoliCheck@1
42 | displayName: 'Run PoliCheck'
43 | inputs:
44 | targetType: F
45 | optionsFC: 0
46 | optionsXS: 0
47 | optionsPE: '1|2|3|4'
48 | optionsHMENABLE: 0
49 | toolVersion: 5.8.2.1
50 | continueOnError: true
51 |
52 | - task: securedevelopmentteam.vss-secure-development-tools.build-task-publishsecurityanalysislogs.PublishSecurityAnalysisLogs@2
53 | displayName: 'Publish Security Analysis Logs to Build Artifacts'
54 | continueOnError: true
55 |
56 | - task: securedevelopmentteam.vss-secure-development-tools.build-task-uploadtotsa.TSAUpload@1
57 | displayName: 'TSA upload to Codebase: MMI_20190701 Version: TsaV2'
58 | inputs:
59 | tsaVersion: TsaV2
60 | codeBaseName: 'MMI_20190701'
61 | uploadAPIScan: false
62 | uploadFortifySCA: false
63 | uploadFxCop: false
64 | uploadModernCop: false
65 | uploadPREfast: false
66 | uploadRoslyn: false
67 | uploadTSLint: false
68 |
69 | - task: securedevelopmentteam.vss-secure-development-tools.build-task-report.SdtReport@1
70 | displayName: 'Create Security Analysis Report'
71 | inputs:
72 | TsvFile: false
73 | APIScan: true
74 | BinSkim: true
75 | CredScan: true
76 | PoliCheck: true
77 | PoliCheckBreakOn: Severity2Above
78 |
79 | - task: ms.vss-governance-buildtask.governance-build-task-component-detection.ComponentGovernanceComponentDetection@0
80 | displayName: 'Component Detection'
81 | inputs:
82 | sourceScanPath: '$(Build.SourcesDirectory)'
83 | snapshotForceEnabled: true
84 |
--------------------------------------------------------------------------------
/.vsts-ci/templates/test.yml:
--------------------------------------------------------------------------------
1 | steps:
2 | - bash: ./test.sh
3 | displayName: 'Execute Tests'
4 |
5 | - task: PublishTestResults@2
6 | inputs:
7 | testResultsFormat: 'VSTest'
8 | testResultsFiles: '**/*TestResults.trx'
9 | failTaskOnFailedTests: 'true'
10 |
--------------------------------------------------------------------------------
/LICENSE:
--------------------------------------------------------------------------------
1 | powershell-mmi v.1.0
2 |
3 | Copyright (c) Microsoft Corporation
4 |
5 | All rights reserved.
6 |
7 | MIT License
8 |
9 | Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the ""Software""), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
10 |
11 | The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
12 |
13 | THE SOFTWARE IS PROVIDED *AS IS*, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
14 |
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | Microsoft.Management.Infrastructure
2 | ===================================
3 |
4 | [](https://travis-ci.com/PowerShell/MMI)
5 |
6 | This repo contains the `Microsoft.Management.Infrastructure` source code (and
7 | soon tests). This is a dependency of PowerShell, but is kept separate.
8 |
9 | Environment
10 | ===========
11 |
12 | Toolchain Setup
13 | ---------------
14 |
15 | MMI requires the following packages:
16 |
17 | ```sh
18 | sudo apt-get install libpam0g-dev libssl-dev libcurl4-openssl-dev
19 | ```
20 |
21 | Also install [PowerShell][] from the latest release per their instructions.
22 |
23 | [powershell]: https://github.com/PowerShell/PowerShell
24 |
25 | Git Setup
26 | ---------
27 |
28 | MMI has a submodule, so clone recursively.
29 |
30 | ```sh
31 | git clone --recursive git@github.com:PowerShell/MMI.git
32 | ```
33 |
34 | Build
35 | -----
36 | ```sh
37 | ./build.sh
38 | ```
39 |
40 | Test
41 | ----
42 | ```sh
43 | ./test.sh
44 | ```
45 |
--------------------------------------------------------------------------------
/Solutions/.gitignore:
--------------------------------------------------------------------------------
1 | # Ignore nuget package directories
2 | Packages/
3 |
4 | # Ignore native debug files
5 | *.VC.db
6 | *.VC.opendb
--------------------------------------------------------------------------------
/Solutions/VS15_amd64/Microsoft.Management.Infrastructure.Tests/packages.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/Solutions/VS15_amd64/Microsoft.Management.Infrastructure/Microsoft.Management.Infrastructure.sln:
--------------------------------------------------------------------------------
1 |
2 | Microsoft Visual Studio Solution File, Format Version 12.00
3 | # Visual Studio 14
4 | VisualStudioVersion = 14.0.25123.0
5 | MinimumVisualStudioVersion = 10.0.40219.1
6 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Management.Infrastructure", "Microsoft.Management.Infrastructure.csproj", "{D7349798-7E56-4235-9266-3A84B1294155}"
7 | EndProject
8 | Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Microsoft.Management.Infrastructure.Tests", "..\Microsoft.Management.Infrastructure.Tests\Microsoft.Management.Infrastructure.Tests.csproj", "{50E90A15-286F-49CE-B164-B2487AE75A15}"
9 | EndProject
10 | Global
11 | GlobalSection(SolutionConfigurationPlatforms) = preSolution
12 | Debug|Any CPU = Debug|Any CPU
13 | Release|Any CPU = Release|Any CPU
14 | EndGlobalSection
15 | GlobalSection(ProjectConfigurationPlatforms) = postSolution
16 | {D7349798-7E56-4235-9266-3A84B1294155}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
17 | {D7349798-7E56-4235-9266-3A84B1294155}.Debug|Any CPU.Build.0 = Debug|Any CPU
18 | {D7349798-7E56-4235-9266-3A84B1294155}.Release|Any CPU.ActiveCfg = Release|Any CPU
19 | {D7349798-7E56-4235-9266-3A84B1294155}.Release|Any CPU.Build.0 = Release|Any CPU
20 | {50E90A15-286F-49CE-B164-B2487AE75A15}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
21 | {50E90A15-286F-49CE-B164-B2487AE75A15}.Debug|Any CPU.Build.0 = Debug|Any CPU
22 | {50E90A15-286F-49CE-B164-B2487AE75A15}.Release|Any CPU.ActiveCfg = Release|Any CPU
23 | {50E90A15-286F-49CE-B164-B2487AE75A15}.Release|Any CPU.Build.0 = Release|Any CPU
24 | EndGlobalSection
25 | GlobalSection(SolutionProperties) = preSolution
26 | HideSolutionNode = FALSE
27 | EndGlobalSection
28 | EndGlobal
29 |
--------------------------------------------------------------------------------
/build.sh:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | # Install OMI
4 | wget https://github.com/microsoft/omi/releases/download/v1.6.0/omi-1.6.0-0.ssl_110.ulinux.x64.deb -O omi-1.6.0-0.ssl_110.ulinux.x64.deb
5 | sudo apt-get install cron -y
6 | sudo apt install ./omi-1.6.0-0.ssl_110.ulinux.x64.deb
7 |
8 | # Build MMI
9 | PATH=$PATH:~/.dotnet dotnet build -f netstandard2.0 src/Microsoft.Management.Infrastructure/ -c Linux -o bin
10 |
--------------------------------------------------------------------------------
/global.json:
--------------------------------------------------------------------------------
1 | {
2 | "projects": [ "src", "test" ]
3 | }
4 |
--------------------------------------------------------------------------------
/nuget.config:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/packages/System.Security.SecureString.4.0.0-rc1.nupkg:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PowerShell/MMI/cf32fc695b32c2eae848b693395c09222fe1d2ae/packages/System.Security.SecureString.4.0.0-rc1.nupkg
--------------------------------------------------------------------------------
/signing/visualstudiopublic.snk:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/PowerShell/MMI/cf32fc695b32c2eae848b693395c09222fe1d2ae/signing/visualstudiopublic.snk
--------------------------------------------------------------------------------
/src/Microsoft.Management.Infrastructure/AssemblyInfo.cs:
--------------------------------------------------------------------------------
1 | /*
2 | **==============================================================================
3 | **
4 | ** Copyright (c) Microsoft Corporation. All rights reserved. See file LICENSE
5 | ** for license information.
6 | **
7 | **==============================================================================
8 | */
9 | using System.Reflection;
10 | using System.Resources;
11 | using System.Runtime.CompilerServices;
12 | using System.Runtime.InteropServices;
13 |
14 |
15 | [assembly: InternalsVisibleTo("XmlServerStore,PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
16 | [assembly: InternalsVisibleTo("System.Management.Automation,PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
17 | [assembly: InternalsVisibleTo("XmlServerStore,PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
18 | [assembly: InternalsVisibleTo("Microsoft.CloudInfrastructure.Test.Common,PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
19 | [assembly: InternalsVisibleTo("Microsoft.Windows.DSC.CoreConfProviders,PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
20 | [assembly: InternalsVisibleTo("Microsoft.Monitoring.Commands,PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
21 | [assembly: InternalsVisibleTo("Microsoft.Management.Infrastructure.CimCmdlets,PublicKey=0024000004800000940000000602000000240000525341310004000001000100b5fc90e7027f67871e773a8fde8938c81dd402ba65b9201d60593e96c492651e889cc13f1415ebb53fac1131ae0bd333c5ee6021672d9718ea31a8aebd0da0072f25d87dba6fc90ffd598ed4da35e44c398c454307e8e33b8426143daec9f596836f97c8f74750e5975c64e2189f45def46b2a2b1247adc3652bf5c308055da9")]
22 | [assembly: InternalsVisibleTo("Microsoft.Management.Infrastructure.Tests")]
23 |
--------------------------------------------------------------------------------
/src/Microsoft.Management.Infrastructure/CimFlags.cs:
--------------------------------------------------------------------------------
1 | /*
2 | **==============================================================================
3 | **
4 | ** Copyright (c) Microsoft Corporation. All rights reserved. See file LICENSE
5 | ** for license information.
6 | **
7 | **==============================================================================
8 | */
9 |
10 |
11 | using Microsoft.Management.Infrastructure.Native;
12 | using System;
13 | using System.Diagnostics.CodeAnalysis;
14 |
15 | namespace Microsoft.Management.Infrastructure
16 | {
17 | ///
18 | /// Cim flags
19 | ///
20 | [Flags]
21 | public enum CimFlags : long
22 | {
23 | None = (long)0,
24 |
25 | Class = (long)MI_Flags.MI_FLAG_CLASS,
26 | Method = (long)MI_Flags.MI_FLAG_METHOD,
27 | Property = (long)MI_Flags.MI_FLAG_PROPERTY,
28 | Parameter = (long)MI_Flags.MI_FLAG_PARAMETER,
29 | Association = (long)MI_Flags.MI_FLAG_ASSOCIATION,
30 | Indication = (long)MI_Flags.MI_FLAG_INDICATION,
31 | Reference = (long)MI_Flags.MI_FLAG_REFERENCE,
32 | Any = (long)MI_Flags.MI_FLAG_ANY,
33 |
34 | /* Qualifier flavors */
35 | EnableOverride = (long)MI_Flags.MI_FLAG_ENABLEOVERRIDE,
36 | DisableOverride = (long)MI_Flags.MI_FLAG_DISABLEOVERRIDE,
37 | Restricted = (long)MI_Flags.MI_FLAG_RESTRICTED,
38 | ToSubclass = (long)MI_Flags.MI_FLAG_TOSUBCLASS,
39 | Translatable = (long)MI_Flags.MI_FLAG_TRANSLATABLE,
40 |
41 | /* Select boolean qualifier */
42 | Key = (long)MI_Flags.MI_FLAG_KEY,
43 | In = (long)MI_Flags.MI_FLAG_IN,
44 | Out = (long)MI_Flags.MI_FLAG_OUT,
45 | Required = (long)MI_Flags.MI_FLAG_REQUIRED,
46 | Static = (long)MI_Flags.MI_FLAG_STATIC,
47 | Abstract = (long)MI_Flags.MI_FLAG_ABSTRACT,
48 | Terminal = (long)MI_Flags.MI_FLAG_TERMINAL,
49 | Expensive = (long)MI_Flags.MI_FLAG_EXPENSIVE,
50 | Stream = (long)MI_Flags.MI_FLAG_STREAM,
51 | ReadOnly = (long)MI_Flags.MI_FLAG_READONLY,
52 |
53 | /* Special flags */
54 | NotModified = (long)MI_Flags.MI_FLAG_NOT_MODIFIED,
55 | NullValue = (long)MI_Flags.MI_FLAG_NULL,
56 | Borrow = (long)MI_Flags.MI_FLAG_BORROW,
57 | Adopt = (long)MI_Flags.MI_FLAG_ADOPT,
58 | };
59 |
60 | ///
61 | /// CimSubscriptionDeliveryType
62 | ///
63 | [SuppressMessage("Microsoft.Design", "CA1008:EnumsShouldHaveZeroValue", Justification = "This is a direct copy of the native flags enum")]
64 | public enum CimSubscriptionDeliveryType : int
65 | {
66 | None = (int)MI_SubscriptionDeliveryType.MI_SubscriptionDeliveryType_Push,
67 | Push = (int)MI_SubscriptionDeliveryType.MI_SubscriptionDeliveryType_Push,
68 | Pull = (int)MI_SubscriptionDeliveryType.MI_SubscriptionDeliveryType_Pull,
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/src/Microsoft.Management.Infrastructure/CimMethodDeclaration.cs:
--------------------------------------------------------------------------------
1 | /*
2 | **==============================================================================
3 | **
4 | ** Copyright (c) Microsoft Corporation. All rights reserved. See file LICENSE
5 | ** for license information.
6 | **
7 | **==============================================================================
8 | */
9 |
10 |
11 | using Microsoft.Management.Infrastructure.Generic;
12 |
13 | namespace Microsoft.Management.Infrastructure
14 | {
15 | ///
16 | /// A method declaration of
17 | ///
18 | public abstract class CimMethodDeclaration
19 | {
20 | internal CimMethodDeclaration()
21 | {
22 | // do not allow 3rd parties to derive from / instantiate this class
23 | }
24 |
25 | ///
26 | /// Name of the method
27 | ///
28 | public abstract string Name { get; }
29 |
30 | ///
31 | /// Return type of the method
32 | ///
33 | public abstract CimType ReturnType { get; }
34 |
35 | ///
36 | /// Return type of the method
37 | ///
38 | public abstract CimReadOnlyKeyedCollection Parameters { get; }
39 |
40 | ///
41 | /// Qualifiers of the Method.
42 | ///
43 | public abstract CimReadOnlyKeyedCollection Qualifiers { get; }
44 |
45 | public override string ToString()
46 | {
47 | return this.Name;
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/src/Microsoft.Management.Infrastructure/CimMethodParameterDeclaration.cs:
--------------------------------------------------------------------------------
1 | /*
2 | **==============================================================================
3 | **
4 | ** Copyright (c) Microsoft Corporation. All rights reserved. See file LICENSE
5 | ** for license information.
6 | **
7 | **==============================================================================
8 | */
9 |
10 |
11 | using Microsoft.Management.Infrastructure.Generic;
12 |
13 | namespace Microsoft.Management.Infrastructure
14 | {
15 | ///
16 | /// A parameter declaration of
17 | ///
18 | public abstract class CimMethodParameterDeclaration
19 | {
20 | internal CimMethodParameterDeclaration()
21 | {
22 | // do not allow 3rd parties to derive from / instantiate this class
23 | }
24 |
25 | ///
26 | /// Name of the parameter
27 | ///
28 | public abstract string Name { get; }
29 |
30 | ///
31 | /// CIM type of the parameter
32 | ///
33 | public abstract CimType CimType { get; }
34 |
35 | ///
36 | /// Qualifiers of the parameter.
37 | ///
38 | public abstract CimReadOnlyKeyedCollection Qualifiers { get; }
39 |
40 | ///
41 | /// ClassName of the parameter's value.
42 | /// Only valid if the parameter type is or
43 | ///
44 | ///
45 | public abstract string ReferenceClassName { get; }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/src/Microsoft.Management.Infrastructure/CimMethodResult.cs:
--------------------------------------------------------------------------------
1 | /*
2 | **==============================================================================
3 | **
4 | ** Copyright (c) Microsoft Corporation. All rights reserved. See file LICENSE
5 | ** for license information.
6 | **
7 | **==============================================================================
8 | */
9 |
10 |
11 | using Microsoft.Management.Infrastructure.Generic;
12 | using System;
13 | using System.Diagnostics;
14 |
15 | namespace Microsoft.Management.Infrastructure
16 | {
17 | ///
18 | /// Represents a regular - return value and all the out parameter values.
19 | ///
20 | ///
21 | ///
22 | public class CimMethodResult : CimMethodResultBase, IDisposable
23 | {
24 | private CimMethodParametersCollection _backingMethodParametersCollection;
25 |
26 | internal CimMethodResult(CimInstance backingInstance)
27 | {
28 | Debug.Assert(backingInstance != null, "Caller should verify backingInstance != null");
29 | this._backingMethodParametersCollection = new CimMethodParametersCollection(backingInstance);
30 | }
31 |
32 | public CimMethodParameter ReturnValue
33 | {
34 | get
35 | {
36 | this.AssertNotDisposed();
37 | return this.OutParameters["ReturnValue"];
38 | }
39 | }
40 |
41 | public CimReadOnlyKeyedCollection OutParameters
42 | {
43 | get
44 | {
45 | this.AssertNotDisposed();
46 | return this._backingMethodParametersCollection;
47 | }
48 | }
49 |
50 | #region IDisposable Members
51 |
52 | ///
53 | /// Releases resources associated with this object
54 | ///
55 | public void Dispose()
56 | {
57 | this.Dispose(true);
58 | GC.SuppressFinalize(this);
59 | }
60 |
61 | ///
62 | /// Releases resources associated with this object
63 | ///
64 | protected virtual void Dispose(bool disposing)
65 | {
66 | if (_disposed)
67 | {
68 | return;
69 | }
70 |
71 | if (disposing)
72 | {
73 | this._backingMethodParametersCollection.Dispose();
74 | this._backingMethodParametersCollection = null;
75 | }
76 |
77 | _disposed = true;
78 | }
79 |
80 | internal void AssertNotDisposed()
81 | {
82 | if (this._disposed)
83 | {
84 | throw new ObjectDisposedException(this.ToString());
85 | }
86 | }
87 |
88 | private bool _disposed;
89 |
90 | #endregion IDisposable Members
91 | }
92 | }
93 |
--------------------------------------------------------------------------------
/src/Microsoft.Management.Infrastructure/CimMethodResultBase.cs:
--------------------------------------------------------------------------------
1 | /*
2 | **==============================================================================
3 | **
4 | ** Copyright (c) Microsoft Corporation. All rights reserved. See file LICENSE
5 | ** for license information.
6 | **
7 | **==============================================================================
8 | */
9 |
10 |
11 | namespace Microsoft.Management.Infrastructure
12 | {
13 | ///
14 | /// Represents a method result - either
15 | /// 1) a regular method result - return value and all the out parameter values ()
16 | /// or
17 | /// 2) a single item of a streamed out parameter array ()
18 | ///
19 | public abstract class CimMethodResultBase
20 | {
21 | internal CimMethodResultBase()
22 | {
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/src/Microsoft.Management.Infrastructure/CimMethodStreamedResult.cs:
--------------------------------------------------------------------------------
1 | /*
2 | **==============================================================================
3 | **
4 | ** Copyright (c) Microsoft Corporation. All rights reserved. See file LICENSE
5 | ** for license information.
6 | **
7 | **==============================================================================
8 | */
9 |
10 |
11 | namespace Microsoft.Management.Infrastructure
12 | {
13 | ///
14 | /// Represents a single item of a streamed out parameter array.
15 | ///
16 | public class CimMethodStreamedResult : CimMethodResultBase
17 | {
18 | internal CimMethodStreamedResult(string parameterName, object parameterValue, CimType parameterType)
19 | {
20 | this.ParameterName = parameterName;
21 | this.ItemValue = parameterValue;
22 | this.ItemType = parameterType;
23 | }
24 |
25 | public string ParameterName { get; private set; }
26 |
27 | public object ItemValue { get; private set; }
28 | public CimType ItemType { get; private set; }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/src/Microsoft.Management.Infrastructure/CimPropertyDeclaration.cs:
--------------------------------------------------------------------------------
1 | /*
2 | **==============================================================================
3 | **
4 | ** Copyright (c) Microsoft Corporation. All rights reserved. See file LICENSE
5 | ** for license information.
6 | **
7 | **==============================================================================
8 | */
9 |
10 |
11 | using Microsoft.Management.Infrastructure.Generic;
12 | using Microsoft.Management.Infrastructure.Internal;
13 |
14 | namespace Microsoft.Management.Infrastructure
15 | {
16 | ///
17 | /// A property declaration of
18 | ///
19 | public abstract class CimPropertyDeclaration
20 | {
21 | internal CimPropertyDeclaration()
22 | {
23 | // do not allow 3rd parties to derive from / instantiate this class
24 | }
25 |
26 | ///
27 | /// Name of the property
28 | ///
29 | public abstract string Name { get; }
30 |
31 | ///
32 | ///
33 | /// Default value of the property. null if the property doesn't have a value.
34 | ///
35 | ///
36 | public abstract object Value { get; }
37 |
38 | ///
39 | /// CIM type of the property
40 | ///
41 | /// See for a description of mapping between CIM types and .NET types.
42 | ///
43 | ///
44 | public abstract CimType CimType { get; }
45 |
46 | ///
47 | /// Flags of the property.
48 | ///
49 | public abstract CimFlags Flags { get; }
50 |
51 | ///
52 | /// Qualifiers of the property.
53 | ///
54 | public abstract CimReadOnlyKeyedCollection Qualifiers { get; }
55 |
56 | ///
57 | /// ClassName of the property's value.
58 | /// Only valid if the property type is or
59 | /// ;
60 | ///
61 | public abstract string ReferenceClassName { get; }
62 |
63 | public override string ToString()
64 | {
65 | return Helpers.ToStringFromNameAndValue(this.Name, this.Value);
66 | }
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/src/Microsoft.Management.Infrastructure/CimQualifier.cs:
--------------------------------------------------------------------------------
1 | /*
2 | **==============================================================================
3 | **
4 | ** Copyright (c) Microsoft Corporation. All rights reserved. See file LICENSE
5 | ** for license information.
6 | **
7 | **==============================================================================
8 | */
9 |
10 |
11 | using Microsoft.Management.Infrastructure.Internal;
12 |
13 | namespace Microsoft.Management.Infrastructure
14 | {
15 | ///
16 | /// A qualifier of
17 | ///
18 | public abstract class CimQualifier
19 | {
20 | internal CimQualifier()
21 | {
22 | // do not allow 3rd parties to derive from / instantiate this class
23 | }
24 |
25 | ///
26 | /// Name of the qualifier
27 | ///
28 | public abstract string Name { get; }
29 |
30 | ///
31 | ///
32 | /// Value of the qualifier. null if the qualifier doesn't have a value.
33 | ///
34 | ///
35 | /// See for a description of mapping between CIM types and .NET types.
36 | ///
37 | ///
38 | public abstract object Value { get; }
39 |
40 | ///
41 | /// CIM type of the qualifier
42 | ///
43 | public abstract CimType CimType { get; }
44 |
45 | ///
46 | /// Flags of the qualifier.
47 | ///
48 | public abstract CimFlags Flags { get; }
49 |
50 | public override string ToString()
51 | {
52 | return Helpers.ToStringFromNameAndValue(this.Name, this.Value);
53 | }
54 | }
55 | }
56 |
--------------------------------------------------------------------------------
/src/Microsoft.Management.Infrastructure/CimSubscriptionResult.cs:
--------------------------------------------------------------------------------
1 | /*
2 | **==============================================================================
3 | **
4 | ** Copyright (c) Microsoft Corporation. All rights reserved. See file LICENSE
5 | ** for license information.
6 | **
7 | **==============================================================================
8 | */
9 |
10 |
11 | using Microsoft.Management.Infrastructure.Native;
12 | using System;
13 | using System.Diagnostics;
14 |
15 | namespace Microsoft.Management.Infrastructure
16 | {
17 | ///
18 | /// Represents a SubscriptionResult
19 | ///
20 | public class CimSubscriptionResult : IDisposable
21 | {
22 | private CimInstance _resultInstance;
23 | private readonly string _bookmark;
24 | private readonly string _machineId;
25 |
26 | internal CimSubscriptionResult(MI_Instance handle, string bookmark, string machineId)
27 | {
28 | Debug.Assert(handle != null, "Caller should verify backingInstance != null");
29 | this._resultInstance = new CimInstance(handle);
30 | this._bookmark = bookmark;
31 | this._machineId = machineId;
32 | }
33 |
34 | public string Bookmark
35 | {
36 | get
37 | {
38 | this.AssertNotDisposed();
39 | return this._bookmark;
40 | }
41 | }
42 |
43 | public string MachineId
44 | {
45 | get
46 | {
47 | this.AssertNotDisposed();
48 | return this._machineId;
49 | }
50 | }
51 |
52 | public CimInstance Instance
53 | {
54 | get
55 | {
56 | this.AssertNotDisposed();
57 | return this._resultInstance;
58 | }
59 | }
60 |
61 | #region IDisposable Members
62 |
63 | ///
64 | /// Releases resources associated with this object
65 | ///
66 | public void Dispose()
67 | {
68 | this.Dispose(true);
69 | GC.SuppressFinalize(this);
70 | }
71 |
72 | ///
73 | /// Releases resources associated with this object
74 | ///
75 | protected virtual void Dispose(bool disposing)
76 | {
77 | if (_disposed)
78 | {
79 | return;
80 | }
81 |
82 | if (disposing)
83 | {
84 | this._resultInstance.Dispose();
85 | this._resultInstance = null;
86 | }
87 |
88 | _disposed = true;
89 | }
90 |
91 | internal void AssertNotDisposed()
92 | {
93 | if (this._disposed)
94 | {
95 | throw new ObjectDisposedException(this.ToString());
96 | }
97 | }
98 |
99 | private bool _disposed;
100 |
101 | #endregion IDisposable Members
102 | }
103 | }
104 |
--------------------------------------------------------------------------------
/src/Microsoft.Management.Infrastructure/CimSystemProperties.cs:
--------------------------------------------------------------------------------
1 | /*
2 | **==============================================================================
3 | **
4 | ** Copyright (c) Microsoft Corporation. All rights reserved. See file LICENSE
5 | ** for license information.
6 | **
7 | **==============================================================================
8 | */
9 |
10 |
11 | namespace Microsoft.Management.Infrastructure
12 | {
13 | public class CimSystemProperties
14 | {
15 | private string _namespace;
16 | private string _serverName;
17 | private string _className;
18 | private string _path;
19 |
20 | internal CimSystemProperties()
21 | {
22 | }
23 |
24 | internal void UpdateCimSystemProperties(string systemNamespace, string serverName, string className)
25 | {
26 | _namespace = systemNamespace;
27 | _serverName = serverName;
28 | _className = className;
29 | }
30 |
31 | internal void UpdateSystemPath(string Path)
32 | {
33 | _path = Path;
34 | }
35 |
36 | ///
37 | /// Namespace of CIM object
38 | ///
39 | public string Namespace
40 | {
41 | get
42 | {
43 | return _namespace;
44 | }
45 | }
46 |
47 | ///
48 | /// Server Name of CIM object
49 | ///
50 | public string ServerName
51 | {
52 | get
53 | {
54 | return _serverName;
55 | }
56 | }
57 |
58 | ///
59 | /// Class Name of CIM object
60 | ///
61 | public string ClassName
62 | {
63 | get
64 | {
65 | return _className;
66 | }
67 | }
68 |
69 | ///
70 | /// Object path of CIM object
71 | ///
72 | public string Path
73 | {
74 | get
75 | {
76 | return _path;
77 | }
78 | }
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/src/Microsoft.Management.Infrastructure/CimType.cs:
--------------------------------------------------------------------------------
1 | /*
2 | **==============================================================================
3 | **
4 | ** Copyright (c) Microsoft Corporation. All rights reserved. See file LICENSE
5 | ** for license information.
6 | **
7 | **==============================================================================
8 | */
9 |
10 |
11 | namespace Microsoft.Management.Infrastructure
12 | {
13 | ///
14 | ///
15 | /// CIM type of a value.
16 | ///
17 | ///
18 | /// This is a .NET representation of intrinsic CIM types (as defined by DSP0004).
19 | ///
20 | /// The mapping of scalar types is as follows:
21 | /// - CIM: uint8 -> .NET: System.Byte
22 | /// - CIM: sint8 -> .NET: System.SByte
23 | /// - CIM: uint16 -> .NET: System.UInt16
24 | /// - CIM: sint16 -> .NET: System.Int16
25 | /// - CIM: uint32 -> .NET: System.UInt32
26 | /// - CIM: sint32 -> .NET: System.Int32
27 | /// - CIM: uint64 -> .NET: System.UInt64
28 | /// - CIM: sint64 -> .NET: System.Int64
29 | /// - CIM: string -> .NET: System.String
30 | /// - CIM: boolean -> .NET: System.Boolean
31 | /// - CIM: real32 -> .NET: System.Single
32 | /// - CIM: real64 -> .NET: System.Double
33 | /// - CIM: datetime -> .NET: either System.DateTime or System.TimeSpan
34 | /// - CIM: class ref -> .NET: CimInstance
35 | /// - CIM: char16 -> .NET: System.Char
36 | ///
37 | /// The mapping of arrays uses a single-dimensional .NET array of an appropriate type.
38 | /// The only exception is the CIM: datetime[] -> .NET: System.Object[] mapping
39 | /// (which is necessary because the CIM array can contain a mixture of dates and intervals).
40 | ///
41 | ///
42 | public enum CimType
43 | {
44 | Unknown = 0,
45 |
46 | Boolean,
47 | UInt8,
48 | SInt8,
49 | UInt16,
50 | SInt16,
51 | UInt32,
52 | SInt32,
53 | UInt64,
54 | SInt64,
55 | Real32,
56 | Real64,
57 | Char16,
58 | DateTime,
59 | String,
60 | Reference,
61 | Instance,
62 |
63 | BooleanArray,
64 | UInt8Array,
65 | SInt8Array,
66 | UInt16Array,
67 | SInt16Array,
68 | UInt32Array,
69 | SInt32Array,
70 | UInt64Array,
71 | SInt64Array,
72 | Real32Array,
73 | Real64Array,
74 | Char16Array,
75 | DateTimeArray,
76 | StringArray,
77 | ReferenceArray,
78 | InstanceArray,
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/src/Microsoft.Management.Infrastructure/Generic/CimAsyncCollection.cs:
--------------------------------------------------------------------------------
1 | /*
2 | **==============================================================================
3 | **
4 | ** Copyright (c) Microsoft Corporation. All rights reserved. See file LICENSE
5 | ** for license information.
6 | **
7 | **==============================================================================
8 | */
9 |
10 |
11 | using System;
12 | using System.Diagnostics;
13 |
14 | namespace Microsoft.Management.Infrastructure.Generic
15 | {
16 | ///
17 | ///
18 | /// CimAsyncMultipleResults represents an asynchronous operation that returns a sequence of objects of type .
19 | ///
20 | ///
21 | /// The operation wrapped by CimAsyncMultipleResults doesn't start until the method is called.
22 | /// It is allowed to call more than once - each call will start another operation.
23 | ///
24 | ///
25 | /// Results of an operation are asynchronously communicated to the observer passed to the method.
26 | ///
27 | ///
28 | /// See and for more details
29 | /// about the asynchronous pattern exposed by this class.
30 | ///
31 | ///
32 | /// Type of results that the wrapped operation returns.
33 | public class CimAsyncMultipleResults : IObservable
34 | {
35 | private readonly IObservable _wrappedObservable;
36 |
37 | internal CimAsyncMultipleResults(IObservable wrappedObservable)
38 | {
39 | Debug.Assert(wrappedObservable != null, "Caller should verify wrappedObservable != null");
40 | this._wrappedObservable = wrappedObservable;
41 | }
42 |
43 | #region IObservable Members
44 |
45 | ///
46 | ///
47 | /// Starts the operation and then communicates the results back to the given .
48 | ///
49 | ///
50 | /// It is allowed to call more than once - each call will start another operation.
51 | ///
52 | ///
53 | /// Observer that will receive asynchronous notifications about results of the operation
54 | /// IDiposable object that will cancel the operation when disposed.
55 | public IDisposable Subscribe(IObserver observer)
56 | {
57 | if (observer == null)
58 | {
59 | throw new ArgumentNullException("observer");
60 | }
61 |
62 | return this._wrappedObservable.Subscribe(observer);
63 | }
64 |
65 | #endregion IObservable Members
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/src/Microsoft.Management.Infrastructure/Generic/CimAsyncResult.cs:
--------------------------------------------------------------------------------
1 | /*
2 | **==============================================================================
3 | **
4 | ** Copyright (c) Microsoft Corporation. All rights reserved. See file LICENSE
5 | ** for license information.
6 | **
7 | **==============================================================================
8 | */
9 |
10 |
11 | using System;
12 | using System.Diagnostics;
13 |
14 | namespace Microsoft.Management.Infrastructure.Generic
15 | {
16 | ///
17 | ///
18 | /// CimAsyncResult represents an asynchronous operation that returns a single object of type .
19 | ///
20 | ///
21 | /// The operation wrapped by CimAsyncResult doesn't start until the method is called.
22 | /// It is allowed to call more than once - each call will start another operation.
23 | ///
24 | ///
25 | /// Results of an operation are asynchronously communicated to the observer passed to the method.
26 | ///
27 | ///
28 | /// See and for more details
29 | /// about the asynchronous pattern exposed by this class.
30 | ///
31 | ///
32 | /// Type of results that the wrapped operation returns.
33 | public class CimAsyncResult : IObservable
34 | {
35 | private readonly IObservable _wrappedObservable;
36 |
37 | internal CimAsyncResult(IObservable wrappedObservable)
38 | {
39 | Debug.Assert(wrappedObservable != null, "Caller should verify wrappedObservable != null");
40 | this._wrappedObservable = wrappedObservable;
41 | }
42 |
43 | #region IObservable Members
44 |
45 | ///
46 | ///
47 | /// Starts the operation and then communicates the results back to the given .
48 | ///
49 | ///
50 | /// It is allowed to call more than once - each call will start another operation.
51 | ///
52 | ///
53 | /// Observer that will receive asynchronous notifications about results of the operation
54 | /// IDiposable object that will cancel the operation when disposed.
55 | public IDisposable Subscribe(IObserver observer)
56 | {
57 | if (observer == null)
58 | {
59 | throw new ArgumentNullException("observer");
60 | }
61 |
62 | return this._wrappedObservable.Subscribe(observer);
63 | }
64 |
65 | #endregion IObservable Members
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/src/Microsoft.Management.Infrastructure/Generic/CimAsyncStatus.cs:
--------------------------------------------------------------------------------
1 | /*
2 | **==============================================================================
3 | **
4 | ** Copyright (c) Microsoft Corporation. All rights reserved. See file LICENSE
5 | ** for license information.
6 | **
7 | **==============================================================================
8 | */
9 |
10 |
11 | using System;
12 | using System.Diagnostics;
13 |
14 | namespace Microsoft.Management.Infrastructure.Generic
15 | {
16 | ///
17 | ///
18 | /// CimAsyncStatus represents an asynchronous operation that returns no object/>.
19 | ///
20 | ///
21 | /// The operation wrapped by CimAsyncStatus doesn't start until the method is called.
22 | /// It is allowed to call more than once - each call will start another operation.
23 | ///
24 | ///
25 | /// Results of an operation are asynchronously communicated to the observer passed to the method.
26 | ///
27 | ///
28 | /// See and for more details
29 | /// about the asynchronous pattern exposed by this class.
30 | ///
31 | ///
32 | /// Type of results that the wrapped operation returns.
33 | public class CimAsyncStatus : IObservable