コード例 #1
0
        private static object GetValue(ImagePolicyEntryType type, IMAGE_POLICY_ENTRY_UNION union)
        {
            switch (type)
            {
            case ImagePolicyEntryType.Bool:
                return(union.BoolValue);

            case ImagePolicyEntryType.Int16:
                return(union.Int16Value);

            case ImagePolicyEntryType.Int32:
                return(union.Int32Value);

            case ImagePolicyEntryType.Int64:
                return(union.Int64Value);

            case ImagePolicyEntryType.Int8:
                return(union.Int8Value);

            case ImagePolicyEntryType.UInt16:
                return(union.UInt16Value);

            case ImagePolicyEntryType.UInt32:
                return(union.UInt32Value);

            case ImagePolicyEntryType.UInt64:
                return(union.UInt64Value);

            case ImagePolicyEntryType.UInt8:
                return(union.UInt8Value);

            case ImagePolicyEntryType.UnicodeString:
                return(Marshal.PtrToStringUni(union.UnicodeStringValue));

            case ImagePolicyEntryType.AnsiString:
                return(Marshal.PtrToStringAnsi(union.AnsiStringValue));

            default:
                return(null);
            }
        }
コード例 #2
0
 internal ImagePolicyEntry(ImagePolicyEntryType type, ImagePolicyId policy_id, IMAGE_POLICY_ENTRY_UNION union)
 {
     Type     = type;
     PolicyId = policy_id;
     Value    = GetValue(type, union);
 }