-
Notifications
You must be signed in to change notification settings - Fork 191
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
ShellItemPropertyStore do not update even if the property has already changed #407
Comments
First of all, you should use // D:\\ is locked by bitlocker
using (ShellItem Item = new ShellItem("D:\\"))
{
ShellItemPropertyStore PropertyStore = Item.Properties;
PropertyStore.ReadOnly = false;
PropertyStore.Temporary = false;
if (PropertyStore["System.Volume.BitLockerProtection"] != 6)
throw new Exception();
PropertyStore["System.Volume.BitLockerProtection"] = 1;
if (PropertyStore["System.Volume.BitLockerProtection"] != 1)
throw new Exception();
PropertyStore["System.Volume.BitLockerProtection"] = 6;
if (PropertyStore["System.Volume.BitLockerProtection"] != 6)
throw new Exception();
} |
There are something misunderstanding. I lock the drive through Bitlocker manager panel in Windows rather than assign the value directly to the property. At that situation, this property would not change itself unless the process restarted. I haven't tested your solution but I don't think this issue related to the disposal of ShellItemPropertyStore. I ran the same code again after the drive unlocked/locked. |
Please try my code then without setting the BitLocker property, especially setting the |
Any success? |
I could not test the code as it threw InvalidCastException using (ShellItem Item = new ShellItem("D:\\"))
{
Item.Properties.ReadOnly = false;
Item.Properties.Temporary = false;
//InvalidCastException threw here
if (Item.Properties.TryGetValue(ReadOnlyPropertyStore.GetPropertyKeyFromName("System.Volume.BitLockerProtection"), out object RawObject))
{
if (int.TryParse(Convert.ToString(RawObject), out int BitlockerState))
{
return BitlockerState;
}
}
} StackTrace
The exception was thew here: |
Describe the bug and how to reproduce
Make sure the application is running before you unlock the Bitlocker on D:\
It will not change until you restart the application
What code is involved
Expected behavior
ShellItemPropertyStore should change itself once Windows modify the property of the file/folder
Screenshots
The text was updated successfully, but these errors were encountered: