internal static int OpenKey(IMSAdminBase adminBase, SafeMetadataHandle handle, string Path, MBKeyAccess AccessRequested, int TimeOut, out SafeMetadataHandle newHandle) { IntPtr handle2; int num = adminBase.OpenKey(handle, Path, AccessRequested, TimeOut, out handle2); if (num == 0) { newHandle = new SafeMetadataHandle(handle2, adminBase); } else { newHandle = null; } return(num); }
private static bool CheckPermission(IMSAdminBase iisAdmin) { MetadataRecord metadataRecord = new MetadataRecord(0); bool result; using (metadataRecord) { metadataRecord.Identifier = MBIdentifier.KeyType; metadataRecord.Attributes = MBAttributes.None; metadataRecord.UserType = MBUserType.Server; metadataRecord.DataType = MBDataType.String; SafeMetadataHandle key = new SafeMetadataHandle(IntPtr.Zero, null); int num; int data = iisAdmin.GetData(key, IMSAdminBaseHelper.W3SVC, metadataRecord, out num); result = (data != -2147024891); } return(result); }