当前位置: 首页>>代码示例>>C#>>正文


C# Microsoft.DangerousGetHandle方法代码示例

本文整理汇总了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;
		}
开发者ID:nickchal,项目名称:pash,代码行数:7,代码来源:InstanceMethods.cs

示例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;
		}
开发者ID:nickchal,项目名称:pash,代码行数:7,代码来源:InstanceMethods.cs

示例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;
		}
开发者ID:nickchal,项目名称:pash,代码行数:15,代码来源:InstanceMethods.cs

示例4: SetHandleInternal

 internal void SetHandleInternal(Microsoft.Win32.SafeHandles.SafeWaitHandle handle)
 {
     this.safeWaitHandle = handle;
     this.waitHandle = handle.DangerousGetHandle();
 }
开发者ID:randomize,项目名称:VimConfig,代码行数:5,代码来源:WaitHandle.cs

示例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();
         }
     }
 }
开发者ID:iskiselev,项目名称:JSIL.NetFramework,代码行数:14,代码来源:CapiSafeHandles.cs


注:本文中的Microsoft.DangerousGetHandle方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。