Exemplo n.º 1
0
        public static NativeDestinationOptions GetDestinationOptions(SessionHandle handle)
        {
            NativeCimSession         session = MarshalledObject.FromPointer <NativeCimSession> (handle.DangerousGetHandle());
            NativeDestinationOptions options = new NativeDestinationOptions();

            if (session.DestinationOptions == IntPtr.Zero)
            {
                /* Setup Default Destination Options */
                options.ServerName      = session.ServerName;
                options.DestinationPort = 5985;
            }
            else
            {
                options = MarshalledObject.FromPointer <NativeDestinationOptions> (session.DestinationOptions);
                if (string.IsNullOrEmpty(options.ServerName))
                {
                    options.ServerName = session.ServerName;
                }
                if (options.DestinationPort == 0)
                {
                    options.DestinationPort = 5985;
                }
            }
            return(options);
        }
Exemplo n.º 2
0
		internal static MiResult NewSession (ApplicationHandle handle, string protocol, string str1, DestinationOptionsHandle destinationOptionsHandle, out InstanceHandle instanceHandle, out SessionHandle sessionHandle)
		{
			string p1 = string.IsNullOrEmpty (str1) ? "localhost" : str1; //.Substring(1, str1.Length - 2);
			NewInstance (handle, p1, null, out instanceHandle);
			NativeCimSession session = new NativeCimSession();
			session.Protocol = protocol;
			session.ServerName = p1;
			session.DestinationOptions = destinationOptionsHandle == null ? IntPtr.Zero : destinationOptionsHandle.DangerousGetHandle ();
			IntPtr sessionPtr = (IntPtr)CimNativeApi.MarshalledObject.Create<NativeCimSession>(session);
			sessionHandle = new SessionHandle(sessionPtr);
			return MiResult.OK;
		}
Exemplo n.º 3
0
        internal static MiResult NewSession(ApplicationHandle handle, string protocol, string str1, DestinationOptionsHandle destinationOptionsHandle, out InstanceHandle instanceHandle, out SessionHandle sessionHandle)
        {
            string p1 = string.IsNullOrEmpty(str1) ? "localhost" : str1;              //.Substring(1, str1.Length - 2);

            NewInstance(handle, p1, null, out instanceHandle);
            NativeCimSession session = new NativeCimSession();

            session.Protocol           = protocol;
            session.ServerName         = p1;
            session.DestinationOptions = destinationOptionsHandle == null ? IntPtr.Zero : destinationOptionsHandle.DangerousGetHandle();
            IntPtr sessionPtr = (IntPtr)CimNativeApi.MarshalledObject.Create <NativeCimSession>(session);

            sessionHandle = new SessionHandle(sessionPtr);
            return(MiResult.OK);
        }