예제 #1
0
 public static bool TryGetUnsignedIntegerValue(this IPortableDeviceValues values, PropertyKey key, out uint value)
 {
     if (values.HasKeyValue(key))
     {
         values.GetUnsignedIntegerValue(ref key, out value);
         return(true);
     }
     value = 0;
     return(false);
 }
예제 #2
0
 public CPasswordSiloInformation(IPortableDeviceValues results)
 {
     results.GetBufferValue(ENHANCED_STORAGE_PROPERTY_PASSWORD_SILO_INFO, out Vanara.InteropServices.SafeCoTaskMemHandle pbBuffer, out int cbBuffer);
     SiloInfo     = pbBuffer.DangerousGetHandle().ToStructure <ENHANCED_STORAGE_PASSWORD_SILO_INFORMATION>(cbBuffer);
     dwAuthnState = (ENHANCED_STORAGE_AUTHN_STATE)results.GetUnsignedIntegerValue(ENHANCED_STORAGE_PROPERTY_AUTHENTICATION_STATE);
     UserHint     = results.GetStringValue(ENHANCED_STORAGE_PROPERTY_USER_HINT);
     UserName     = results.GetStringValue(ENHANCED_STORAGE_PROPERTY_USER_NAME);
     AdminHint    = results.GetStringValue(ENHANCED_STORAGE_PROPERTY_ADMIN_HINT);
     SiloName     = results.GetStringValue(ENHANCED_STORAGE_PROPERTY_SILO_NAME);
 }
예제 #3
0
        /// <summary>
        /// tag_inner_PROPVARIANT型からuintの値を取得する
        /// </summary>
        /// <param name="value"></param>
        /// <returns></returns>
        private static uint getUintValue(tag_inner_PROPVARIANT value)
        {
            uint ret = 1;

            IPortableDeviceValues pdValues = (IPortableDeviceValues) new PortableDeviceTypesLib.PortableDeviceValues();

            pdValues.SetValue(ref WpdProperty.WPD_OBJECT_ID, ref value);
            pdValues.GetUnsignedIntegerValue(ref WpdProperty.WPD_OBJECT_ID, out ret);
            Marshal.ReleaseComObject(pdValues);

            return(ret);
        }
예제 #4
0
        /// <summary>
        /// 获取设备类型
        /// </summary>
        /// <param name="DeviceValues"></param>
        /// <returns></returns>
        private static MTPDeviceType GetDeviceType(IPortableDeviceValues DeviceValues)
        {
            _tagpropertykey deviceTypeKey = new _tagpropertykey()
            {
                fmtid = new Guid("26d4979a-e643-4626-9e2b-736dc0c92fdc"), pid = 15
            };
            uint propertyValue;

            DeviceValues.GetUnsignedIntegerValue(ref deviceTypeKey, out propertyValue);
            MTPDeviceType deviceType = (MTPDeviceType)propertyValue;

            return(deviceType);
        }
예제 #5
0
 /// <summary>
 /// プロパティ値から、符号なし 32 ビット整数値を読み取ります。
 /// </summary>
 /// <param name="key">識別子。</param>
 /// <param name="values">プロパティ値。</param>
 /// <returns>成功時は読み取った値。それ以外は null。</returns>
 public static uint?ReadUInt32(_tagpropertykey key, IPortableDeviceValues values)
 {
     try
     {
         uint value;
         values.GetUnsignedIntegerValue(key, out value);
         return(value);
     }
     catch (Exception exp)
     {
         Debug.WriteLine(exp.Message);
         return(null);
     }
 }
예제 #6
0
 /// <summary>
 /// プロパティ値から、符号なし 32 ビット整数値を読み取ります。
 /// </summary>
 /// <param name="key">識別子。</param>
 /// <param name="values">プロパティ値。</param>
 /// <returns>成功時は読み取った値。それ以外は null。</returns>
 public static uint? ReadUInt32( _tagpropertykey key, IPortableDeviceValues values )
 {
     try
     {
         uint value;
         values.GetUnsignedIntegerValue( key, out value );
         return value;
     }
     catch( Exception exp )
     {
         Debug.WriteLine( exp.Message );
         return null;
     }
 }