コード例 #1
0
            /*
             * [DllImport("wldp.dll")]
             * internal static extern int WldpGetLockdownPolicy(ref SystemPolicy.WLDP_HOST_INFORMATION pHostInformation, ref int pdwLockdownState, int dwFlags);
             * [DllImport("wldp.dll")]
             * internal static extern int WldpIsClassInApprovedList(ref Guid rclsid, ref SystemPolicy.WLDP_HOST_INFORMATION pHostInformation, ref int ptIsApproved, int dwFlags);
             */

            internal static int WldpGetLockdownPolicy(ref SystemPolicy.WLDP_HOST_INFORMATION pHostInformation, ref int pdwLockdownState, int dwFlags)
            {
                if (pHostInformation.szSource != null)
                {
                    var fi = new System.IO.FileInfo(pHostInformation.szSource);
                    dwFlags = 1;
                    if (fi.Exists)
                    {
                        if (fi.Directory.FullName.IndexOf(PowerShellConfiguration.PowerShellEngine.ApplicationBase, StringComparison.OrdinalIgnoreCase) != -1)
                        {
                            pdwLockdownState = WldpNativeConstants.WLDP_LOCKDOWN_UNDEFINED;
                            return(1);
                        }
                    }
                }
                pdwLockdownState = WldpNativeConstants.WLDP_LOCKDOWN_UMCIENFORCE_FLAG;
                return(1);
            }
コード例 #2
0
 internal static int WldpIsClassInApprovedList(ref Guid rclsid, ref SystemPolicy.WLDP_HOST_INFORMATION pHostInformation, ref int ptIsApproved, int dwFlags)
 {
     ptIsApproved = 1;
     return(1);
 }