/// <summary>
        /// Coes the set proxy blanket.
        /// </summary>
        /// <param name="proxy">The proxy.</param>
        /// <param name="dwAuthnSvc">The dw authn SVC.</param>
        /// <param name="dwAuthzSvc">The dw authz SVC.</param>
        /// <param name="pServerPrincName">Name of the p server princ.</param>
        /// <param name="dwAuthnLevel">The dw authn level.</param>
        /// <param name="dwImpLevel">The dw imp level.</param>
        /// <param name="pAuthInfo">The p authentication information.</param>
        /// <param name="dwCapababilities">The dw capababilities.</param>
        /// <param name="throwOnError">if set to <c>true</c> [throw on error].</param>
        /// <returns>System.Int32.</returns>
        /// <exception cref="COMException">CoSetProxyBlanket failed with HRESULT {hr:X}</exception>
        private static int CoSetProxyBlanket(IntPtr proxy,
                                             uint dwAuthnSvc,
                                             uint dwAuthzSvc,
                                             string pServerPrincName,
                                             RpcAuthnLevel dwAuthnLevel,
                                             RpcImpLevel dwImpLevel,
                                             IntPtr pAuthInfo,
                                             OleAuthCapabilities dwCapababilities,
                                             bool throwOnError)
        {
            //should be called once for process to be able to call into ecs com api's
            int hr = Win32Helper.CoSetProxyBlanket(
                proxy,
                dwAuthnSvc,
                dwAuthzSvc,
                pServerPrincName,
                dwAuthnLevel,
                dwImpLevel,
                pAuthInfo,
                dwCapababilities);

            //expected is 0
            if (HResult.Failed(hr) && throwOnError)
            {
                throw new COMException($"{StorageSyncResources.ComError1} {hr:X}");
            }

            return(hr);
        }
예제 #2
0
 public static extern int CoInitializeSecurity(IntPtr pVoid,
                                               int cAuthSvc,
                                               IntPtr asAuthSvc,
                                               IntPtr pReserved1,
                                               RpcAuthnLevel level,
                                               RpcImpLevel impers,
                                               IntPtr pAuthList,
                                               EoAuthnCap dwCapabilities,
                                               IntPtr pReserved3);
예제 #3
0
 public static extern int CoSetProxyBlanket(
     IntPtr pProxy,
     uint dwAuthnSvc,
     uint dwAuthzSvc,
     string pServerPrincName,
     RpcAuthnLevel dwAuthnLevel,
     RpcImpLevel dwImpLevel,
     IntPtr pAuthInfo,
     OleAuthCapabilities dwCapababilities);
예제 #4
0
 public static extern int CoInitializeSecurity(
     IntPtr pSecDesc,
     int cAuthSvc,
     IntPtr asAuthSvc,
     IntPtr pReserved1,
     [MarshalAs(UnmanagedType.U4)] RpcAuthnLevel dwAuthnLevel,
     [MarshalAs(UnmanagedType.U4)] RpcImpLevel dwImpLevel,
     IntPtr pAuthList,
     [MarshalAs(UnmanagedType.U4)] EoAuthnCap dwCapabilities,
     IntPtr pReserved3);
 /// <summary>
 /// Coes the set proxy blanket.
 /// </summary>
 /// <param name="proxy">The proxy.</param>
 /// <param name="dwAuthnSvc">The dw authn SVC.</param>
 /// <param name="dwAuthzSvc">The dw authz SVC.</param>
 /// <param name="pServerPrincName">Name of the p server princ.</param>
 /// <param name="dwAuthnLevel">The dw authn level.</param>
 /// <param name="dwImpLevel">The dw imp level.</param>
 /// <param name="dwCapababilities">The dw capababilities.</param>
 /// <param name="exception">if set to <c>true</c> [exception].</param>
 /// <returns>System.Int32.</returns>
 private static int CoSetProxyBlanket(IntPtr proxy,
                                      uint dwAuthnSvc                      = ManagementInteropConstants.RPC_C_AUTHN_DEFAULT,
                                      uint dwAuthzSvc                      = ManagementInteropConstants.RPC_C_AUTHZ_NONE,
                                      string pServerPrincName              = null,
                                      RpcAuthnLevel dwAuthnLevel           = RpcAuthnLevel.Default,
                                      RpcImpLevel dwImpLevel               = RpcImpLevel.Impersonate,
                                      OleAuthCapabilities dwCapababilities = OleAuthCapabilities.EOACNONE,
                                      bool exception = true)
 {
     return(CoSetProxyBlanket(
                proxy,
                dwAuthnSvc,
                dwAuthzSvc,
                pServerPrincName,
                dwAuthnLevel,
                dwImpLevel,
                IntPtr.Zero,
                dwCapababilities,
                exception));
 }
예제 #6
0
파일: Utils.cs 프로젝트: schraubchen/BITSDL
 public static extern int CoInitializeSecurity(IntPtr pVoid, int cAuthSvc, IntPtr asAuthSvc, IntPtr pReserved1, RpcAuthnLevel level,
     RpcImpLevel impers, IntPtr pAuthList, EoAuthnCap dwCapabilities, IntPtr pReserved3);
예제 #7
0
 public static extern void CoInitializeSecurity([MarshalAs(UnmanagedType.LPStruct)] Guid pSecDesc, int cAuthSvc, IntPtr asAuthSvc, IntPtr pReserved1, RpcAuthnLevel level, RpcImpLevel impers, IntPtr pAuthList, EoAuthnCap dwCapabilities, IntPtr pReserved3);