本文整理汇总了C#中Microsoft.DangerousGetHandle方法的典型用法代码示例。如果您正苦于以下问题:C# Microsoft.DangerousGetHandle方法的具体用法?C# Microsoft.DangerousGetHandle怎么用?C# Microsoft.DangerousGetHandle使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft
的用法示例。
在下文中一共展示了Microsoft.DangerousGetHandle方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetNamespace
public static MiResult GetNamespace (Microsoft.Management.Infrastructure.Native.InstanceHandle instanceHandle, out string str2)
{
IntPtr ptr = instanceHandle.DangerousGetHandle ();
NativeCimInstance instance = CimNativeApi.MarshalledObject.FromPointer<NativeCimInstance>(ptr);
str2 = instance.Namespace;
return MiResult.OK;
}
示例2: SetServerName
public static MiResult SetServerName (Microsoft.Management.Infrastructure.Native.InstanceHandle handle, string serverName)
{
IntPtr ptr = handle.DangerousGetHandle ();
NativeCimInstance instance = CimNativeApi.MarshalledObject.FromPointer<NativeCimInstance>(ptr);
instance.ServerName = serverName;
return MiResult.OK;
}
示例3: GetClass
public static MiResult GetClass (Microsoft.Management.Infrastructure.Native.InstanceHandle instanceHandle, out ClassHandle classHandle)
{
MiResult result = MiResult.OK;
IntPtr ptr = instanceHandle.DangerousGetHandle ();
NativeCimInstance instance = CimNativeApi.MarshalledObject.FromPointer<NativeCimInstance> (ptr);
classHandle = null;
if (!string.IsNullOrEmpty (instance.ClassName)) {
var options = CimNativeApi.GetDestinationOptions (new SessionHandle(instance.SessionHandle));
var classObj = CimNativeApi.QueryClasses (options, instance.Namespace, CimNativeApi.WQLNamespace, "SELECT * FROM Meta_Class WHERE ClassName = '" + instance.ClassName + "'").FirstOrDefault ();
classObj.SessionHandle = instance.SessionHandle;
IntPtr classPtr = CimNativeApi.MarshalledObject.Create<NativeCimClass>(classObj);
classHandle = new ClassHandle (classPtr, true);
}
return result;
}
示例4: SetHandleInternal
internal void SetHandleInternal(Microsoft.Win32.SafeHandles.SafeWaitHandle handle)
{
this.safeWaitHandle = handle;
this.waitHandle = handle.DangerousGetHandle();
}
示例5: SetParentCsp
internal void SetParentCsp(Microsoft.Win32.SafeHandles.SafeCspHandle parentCsp) {
bool addedRef = false;
RuntimeHelpers.PrepareConstrainedRegions();
try {
parentCsp.DangerousAddRef(ref addedRef);
IntPtr rawParentHandle = parentCsp.DangerousGetHandle();
ParentCsp = rawParentHandle;
}
finally {
if (addedRef) {
parentCsp.DangerousRelease();
}
}
}