Vanara
Vanara copied to clipboard
ShellItemPropertyStore do not update even if the property has already changed
Describe the bug and how to reproduce
Make sure the application is running before you unlock the Bitlocker on D:\
- Check the BitlockerState: should be 6 -> Actual: 6
- Unlock the bitlocker: should not be 6 -> Actual: 6
- Lock it again: should be 6 -> Actual: 6
It will not change until you restart the application
What code is involved
// D:\\ is locked by bitlocker
using (ShellItem Item = new ShellItem("D:\\"))
using (ShellItemPropertyStore PropertyStore = Item.Properties)
{
if (PropertyStore.TryGetValue(ReadOnlyPropertyStore.GetPropertyKeyFromName("System.Volume.BitLockerProtection"), out object RawObject))
{
if (int.TryParse(Convert.ToString(RawObject), out int BitlockerState))
{
// BitlockerState == 6 -> Locked
// BitlockerState != 6 -> Unlocked or NoEncryption
}
}
}
Expected behavior ShellItemPropertyStore should change itself once Windows modify the property of the file/folder
Screenshots <None>