internal override MiResult NativeMoveNext(OperationHandle operationHandle, out CimSubscriptionResult currentItem, out bool moreResults, out MiResult operationResult, out string errorMessage, out InstanceHandle errorDetailsHandle) { InstanceHandle instanceHandle = null; string str = null; string str1 = null; currentItem = null; MiResult indication = OperationMethods.GetIndication(operationHandle, out instanceHandle, out str, out str1, out moreResults, out operationResult, out errorMessage, out errorDetailsHandle); if (instanceHandle != null && !instanceHandle.IsInvalid) { if (!base.ShortenLifetimeOfResults) { instanceHandle = instanceHandle.Clone(); } currentItem = new CimSubscriptionResult(instanceHandle, str, str1); } return(indication); }
internal override MiResult NativeMoveNext(OperationHandle operationHandle, out CimInstance currentItem, out bool moreResults, out MiResult operationResult, out string errorMessage, out InstanceHandle errorDetailsHandle) { InstanceHandle instanceHandle = null; currentItem = null; MiResult instance = OperationMethods.GetInstance(operationHandle, out instanceHandle, out moreResults, out operationResult, out errorMessage, out errorDetailsHandle); if (instanceHandle != null && !instanceHandle.IsInvalid) { if (!base.ShortenLifetimeOfResults) { instanceHandle = instanceHandle.Clone(); } currentItem = new CimInstance(instanceHandle, null); currentItem.SetCimSessionComputerName(this._CimSessionComputerName); currentItem.SetCimSessionInstanceId(this._CimSessionInstanceID); } return(instance); }
internal void IndicationResultCallback(OperationCallbackProcessingContext callbackProcessingContext, OperationHandle operationHandle, InstanceHandle instanceHandle, string bookMark, string machineID, bool moreResults, MiResult operationResult, string errorMessage, InstanceHandle errorDetailsHandle) { CimSubscriptionResult cimSubscriptionResult = null; if (instanceHandle != null && !instanceHandle.IsInvalid) { if (!this._shortenLifetimeOfResults) { instanceHandle = instanceHandle.Clone(); } cimSubscriptionResult = new CimSubscriptionResult(instanceHandle, bookMark, machineID); } using (cimSubscriptionResult) { if (!this._shortenLifetimeOfResults || cimSubscriptionResult == null) { base.ProcessNativeCallback(callbackProcessingContext, cimSubscriptionResult, moreResults, operationResult, errorMessage, errorDetailsHandle); } } }
internal void InstanceResultCallback(OperationCallbackProcessingContext callbackProcessingContext, OperationHandle operationHandle, InstanceHandle instanceHandle, bool moreResults, MiResult operationResult, string errorMessage, InstanceHandle errorDetailsHandle) { CimInstance cimInstance = null; if (instanceHandle != null && !instanceHandle.IsInvalid) { if (!this._shortenLifetimeOfResults) { instanceHandle = instanceHandle.Clone(); } cimInstance = new CimInstance(instanceHandle, null); cimInstance.SetCimSessionComputerName(this._CimSessionComputerName); cimInstance.SetCimSessionInstanceId(this._CimSessionInstanceID); } //TODO: using (cimInstance) { if (!this._shortenLifetimeOfResults || cimInstance == null) { base.ProcessNativeCallback(callbackProcessingContext, cimInstance, moreResults, operationResult, errorMessage, errorDetailsHandle); } } }
internal static object ConvertFromNativeLayer(object value, SharedInstanceHandle sharedParentHandle = null, CimInstance parent = null, bool clone = false) { InstanceHandle instanceHandle; InstanceHandle instanceHandle1; InstanceHandle instanceHandle2 = value as InstanceHandle; if (instanceHandle2 == null) { InstanceHandle[] instanceHandleArray = value as InstanceHandle[]; if (instanceHandleArray == null) { return(value); } else { CimInstance[] cimInstanceArray = new CimInstance[(int)instanceHandleArray.Length]; for (int i = 0; i < (int)instanceHandleArray.Length; i++) { InstanceHandle instanceHandle3 = instanceHandleArray[i]; if (instanceHandle3 != null) { CimInstance[] cimInstance = cimInstanceArray; int num = i; if (clone) { instanceHandle = instanceHandle3.Clone(); } else { instanceHandle = instanceHandle3; } cimInstance[num] = new CimInstance(instanceHandle, sharedParentHandle); if (parent != null) { cimInstanceArray[i].SetCimSessionComputerName(parent.GetCimSessionComputerName()); cimInstanceArray[i].SetCimSessionInstanceId(parent.GetCimSessionInstanceId()); } } else { cimInstanceArray[i] = null; } } return(cimInstanceArray); } } else { if (clone) { instanceHandle1 = instanceHandle2.Clone(); } else { instanceHandle1 = instanceHandle2; } CimInstance cimInstance1 = new CimInstance(instanceHandle1, sharedParentHandle); if (parent != null) { cimInstance1.SetCimSessionComputerName(parent.GetCimSessionComputerName()); cimInstance1.SetCimSessionInstanceId(parent.GetCimSessionInstanceId()); } return(cimInstance1); } }