Skip to content
This repository was archived by the owner on Jun 14, 2024. It is now read-only.

Johnliu todo fixes 2 #28

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
<ItemGroup>
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.DirectoryServices" />
<Reference Include="System.Xml.Linq" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="Microsoft.CSharp" />
Expand Down Expand Up @@ -158,6 +159,12 @@
<Compile Include="..\..\..\test\Microsoft.Management.Infrastructure.Tests\UnitTests\CimSessionTest.cs">
<Link>UnitTests\CimSessionTest.cs</Link>
</Compile>
<Compile Include="..\..\..\test\Microsoft.Management.Infrastructure.Tests\UnitTests\CimSessionOptionsTest.cs">
<Link>UnitTests\CimSessionOptionsTest.cs</Link>
</Compile>
<Compile Include="..\..\..\test\Microsoft.Management.Infrastructure.Tests\UnitTests\CimOperationOptionsTest.cs">
<Link>UnitTests\CimOperationOptionsTest.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup>
<Folder Include="Properties\" />
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -508,11 +508,20 @@
<Compile Include="..\..\..\src\Microsoft.Management.Infrastructure\Serialization\MofDeserializerSchemaValidationOption.cs">
<Link>Serialization\MofDeserializerSchemaValidationOption.cs</Link>
</Compile>
<Compile Include="..\..\..\src\Microsoft.Management.Infrastructure\Strings.Designer.cs">
<Link>Strings.Designer.cs</Link>
<Compile Include="..\..\..\src\Microsoft.Management.Infrastructure\Resources\Strings.Designer.cs">
<AutoGen>True</AutoGen>
<DesignTime>True</DesignTime>
<DependentUpon>Strings.resx</DependentUpon>
<Link>Resources\Strings.Designer.cs</Link>
</Compile>
</ItemGroup>
<ItemGroup />
<ItemGroup>
<EmbeddedResource Include="..\..\..\src\Microsoft.Management.Infrastructure\Resources\Strings.resx">
<Generator>ResXFileCodeGenerator</Generator>
<LastGenOutput>Strings.Designer.cs</LastGenOutput>
<Link>Resources\Strings.resx</Link>
</EmbeddedResource>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
Expand Down
5 changes: 2 additions & 3 deletions src/Microsoft.Management.Infrastructure/CimClass.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using Microsoft.Management.Infrastructure.Generic;
using Microsoft.Management.Infrastructure.Internal.Data;
using Microsoft.Management.Infrastructure.Native;
using Microsoft.Management.Infrastructure.Resources;
using System;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
Expand Down Expand Up @@ -208,9 +209,7 @@ internal void AssertNotDisposed()

public override int GetHashCode()
{
// TODO: implement this function?
//return this.ClassHandle.GetClassHashCode();
return 0;
return this.ClassHandle.GetClassHashCode();
}

public override bool Equals(object obj)
Expand Down
1 change: 1 addition & 0 deletions src/Microsoft.Management.Infrastructure/CimConverter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*============================================================================
*/

using Microsoft.Management.Infrastructure.Resources;
using System;
using System.Collections;
using System.Collections.Generic;
Expand Down
3 changes: 1 addition & 2 deletions src/Microsoft.Management.Infrastructure/CimInstance.cs
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@

using System;
using System.Collections;
using System.Diagnostics;
using System.Globalization;
using System.Linq;
using System.Runtime.Serialization;
Expand All @@ -14,7 +13,7 @@
using Microsoft.Management.Infrastructure.Internal;
using Microsoft.Management.Infrastructure.Internal.Data;
using Microsoft.Management.Infrastructure.Serialization;
using System.IO;
using Microsoft.Management.Infrastructure.Resources;

#if(!_CORECLR)

Expand Down
4 changes: 2 additions & 2 deletions src/Microsoft.Management.Infrastructure/CimSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
using Microsoft.Management.Infrastructure.Options;
using Microsoft.Management.Infrastructure.Options.Internal;
using Microsoft.Management.Infrastructure.Native;
using Microsoft.Management.Infrastructure.Resources;

namespace Microsoft.Management.Infrastructure
{
Expand Down Expand Up @@ -369,8 +370,7 @@ protected virtual void Dispose(bool disposing)

if (disposing)
{
// TODO: Implement and Call ReleaseHandleAsynchronously
//this._handle.Dispose();
this._handle.Dispose();
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public static MI_Class Clone(this MI_Class handleToClone)
{
return null;
}
// TODO: handleToClone.AssertValidInternalState();
handleToClone.AssertValidInternalState();

MI_Class clonedHandle;
MI_Result result = handleToClone.Clone(out clonedHandle);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,21 +44,23 @@ public override CimQualifier this[string qualifierName]
throw new ArgumentNullException("qualifierName");
}

UInt32 index = 0;
MI_QualifierSet qualifierSet;
MI_Result result = this.classHandle.GetClassQualifierSet(out qualifierSet);
CimException.ThrowIfMiResultFailure(result);
// TODO: there aren't many comments for the above pattern throughout the MMI sources, but if the above fails we shouldn't throw exception, just return MI_RESULT_NOT_FOUND like below. Make sure all of these cases are accounted for in MMI

MI_Type qualifierType;
MI_Flags qualifierFlags;
MI_Value qualifierValue;
UInt32 index;
if (result == MI_Result.MI_RESULT_OK)
{
MI_Type qualifierType;
MI_Flags qualifierFlags;
MI_Value qualifierValue;


result = qualifierSet.GetQualifier(qualifierName,
out qualifierType,
out qualifierFlags,
out qualifierValue,
out index);
result = qualifierSet.GetQualifier(qualifierName,
out qualifierType,
out qualifierFlags,
out qualifierValue,
out index);
}

switch (result)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@ public override string Name
MI_Result result = this.classHandle.GetMethodAt(
(uint)this.index,
out name,
out qualifierSet,
out parameterSet);
out qualifierSet,
out parameterSet);
CimException.ThrowIfMiResultFailure(result);
return name;
}
Expand All @@ -48,8 +48,8 @@ public override CimType ReturnType
MI_Result result = this.classHandle.GetMethodAt(
(uint)this.index,
out name,
out qualifierSet,
out parameterSet);
out qualifierSet,
out parameterSet);
CimException.ThrowIfMiResultFailure(result);
result = parameterSet.GetMethodReturnType(out type, qualifierSet);
CimException.ThrowIfMiResultFailure(result);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public override CimMethodParameterDeclaration this[string parameterName]
throw new ArgumentNullException("parameterName");
}

UInt32 index;
UInt32 index = 0;
string name;
MI_QualifierSet qualifierSet;
MI_ParameterSet parameterSet;
Expand All @@ -60,15 +60,16 @@ public override CimMethodParameterDeclaration this[string parameterName]
out qualifierSet,
out parameterSet);

CimException.ThrowIfMiResultFailure(result);

MI_Type parameterType;
string referenceClass;
result = parameterSet.GetParameter(parameterName,
out parameterType,
out referenceClass,
out qualifierSet,
out index);
if (result == MI_Result.MI_RESULT_OK)
{
MI_Type parameterType;
string referenceClass;
result = parameterSet.GetParameter(parameterName,
out parameterType,
out referenceClass,
out qualifierSet,
out index);
}

switch (result)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -65,33 +65,38 @@ public override CimQualifier this[string qualifierName]
}

string name;
UInt32 index = 0;
MI_QualifierSet qualifierSet;
MI_ParameterSet parameterSet;
MI_Result result = this.classHandle.GetMethodAt((uint)methodIndex,
out name,
out qualifierSet,
out parameterSet);
CimException.ThrowIfMiResultFailure(result);

MI_Type parameterType;
string referenceClass;
MI_QualifierSet methodQualifierSet;
result = parameterSet.GetParameterAt((uint)parameterName,
out name,
out parameterType,
out referenceClass,
out methodQualifierSet);
CimException.ThrowIfMiResultFailure(result);
if (result == MI_Result.MI_RESULT_OK)
{

MI_Type parameterType;
string referenceClass;
MI_QualifierSet methodQualifierSet;
result = parameterSet.GetParameterAt((uint)parameterName,
out name,
out parameterType,
out referenceClass,
out methodQualifierSet);

MI_Type qualifierType;
MI_Flags qualifierFlags;
MI_Value qualifierValue;
UInt32 index;
result = methodQualifierSet.GetQualifier(qualifierName,
out qualifierType,
out qualifierFlags,
out qualifierValue,
out index);
if (result == MI_Result.MI_RESULT_OK)
{
MI_Type qualifierType;
MI_Flags qualifierFlags;
MI_Value qualifierValue;
result = methodQualifierSet.GetQualifier(qualifierName,
out qualifierType,
out qualifierFlags,
out qualifierValue,
out index);
}
}

switch (result)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,23 +52,25 @@ public override CimQualifier this[string methodName]
}

string name;
UInt32 index = 0;
MI_QualifierSet qualifierSet;
MI_ParameterSet parameterSet;
MI_Result result = this.classHandle.GetMethodAt((uint)methodIndex,
out name,
out qualifierSet,
out parameterSet);
CimException.ThrowIfMiResultFailure(result);

MI_Type qualifierType;
MI_Flags qualifierFlags;
MI_Value qualifierValue;
UInt32 index;
result = qualifierSet.GetQualifier(name,
out qualifierType,
out qualifierFlags,
out qualifierValue,
out index);
if (result == MI_Result.MI_RESULT_OK)
{
MI_Type qualifierType;
MI_Flags qualifierFlags;
MI_Value qualifierValue;
result = qualifierSet.GetQualifier(name,
out qualifierType,
out qualifierFlags,
out qualifierValue,
out index);
}

switch (result)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -73,16 +73,18 @@ public override CimQualifier this[string qualifierName]
out qualifierSet,
out flags,
out index);
CimException.ThrowIfMiResultFailure(result);

MI_Type qualifierType;
MI_Flags qualifierFlags;
MI_Value qualifierValue;
result = qualifierSet.GetQualifier(qualifierName,
out qualifierType,
out qualifierFlags,
out qualifierValue,
out index);
if (result == MI_Result.MI_RESULT_OK)
{
MI_Type qualifierType;
MI_Flags qualifierFlags;
MI_Value qualifierValue;
result = qualifierSet.GetQualifier(qualifierName,
out qualifierType,
out qualifierFlags,
out qualifierValue,
out index);
}

switch (result)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
*============================================================================
*/

using Microsoft.Management.Infrastructure.Resources;
using System;
using System.Collections;
using System.Globalization;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ internal void CallIntoUserCallback(

internal abstract void ReportInternalError(CimOperationCallbackProcessingContext callbackProcessingContext, Exception internalError);

private void ReportInternalErrorCore(CimOperationCallbackProcessingContext callbackProcessingContext, Exception internalError)
private void ReportInternalErrorCore(object callbackProcessingContext, Exception internalError)
{
Debug.Assert(internalError != null, "Caller should make sure internalError != null");

Expand All @@ -191,7 +191,7 @@ private void ReportInternalErrorCore(CimOperationCallbackProcessingContext callb
internalErrorWhileCancellingOperation);
}

this.ReportInternalError(callbackProcessingContext, internalError);
this.ReportInternalError((CimOperationCallbackProcessingContext)callbackProcessingContext, internalError);

this._suppressFurtherUserCallbacks = true;
}
Expand All @@ -200,9 +200,8 @@ private void ReportInternalErrorCore(CimOperationCallbackProcessingContext callb

public virtual void RegisterAcceptedAsyncCallbacks(MI_OperationCallbacks operationCallbacks, CimOperationOptions operationOptions)
{
// TODO: Uncomment and fix two lines below
//operationCallbacks.InternalErrorCallback = this.ReportInternalErrorCore;
//operationCallbacks.ManagedOperationContext = this;
operationCallbacks.InternalErrorCallback = this.ReportInternalErrorCore;
operationCallbacks.ManagedOperationContext = this;
}

#endregion Dealing with async callbacks
Expand Down
Loading