Hello,
I would like to create a usb device that is removable and readonly via the API. However, whenever I try to call ChangeFlags with the readonly attribute, it fails with "Access denied". I saw, that Readonly is a flag used for creation. However I am not able to figure out how to get the values in C# to the expected value 3 (as combination of enum value 1 and 2 for Readonly and removabale).
The device gets created with the call:
ImDiskAPI.CreateDevice(1024 * 1024 * _sizeMB, 0, 0, 0, 0, ImDiskFlags.Removable, null, true, driveLetter, ref deviceID, IntPtr.Zero);
afterwards it gets formatted and I try to change it to a readonly device with:
ImDiskAPI.ChangeFlags(deviceID, ImDiskFlags.ReadOnly, ImDiskFlags.ReadOnly);
I would like to have something, where I can also set the ReadOnly flag, but how? Thank you for your help in advance!
Kind regards, TATATA2.