0

I have a utility to create and restore copies of flash disks. Im using CreateFile("\\.\PhysicalDriveX", ...) for this inclusive locking and unmounting the current volumes on this device. It is focused on windows 7 and I'm using .Net4.0 and C# for this (I do a DllImport of the winapi-calls, so it should not matter).

On my development pc, it is working as a regular user for external drives (USB-sticks, flash disks, ...). On a customer machine (also windows7), it does not. It needs to be run as administrator. To make bad things worse, I do not have access to the customer machine.

I'd like to run the utility without evelated access rights (this triggers other bugs) but I can start other processes evelated. Does anyone have an advice, which access rights I do have to check/ alter? At best, with a hint to the right WinAPI-function ;)

Peter Schneider
  • 1,683
  • 12
  • 31
  • 1
    It's much easier to just call the function and deal with the error then it is to check permissions yourself. So try it unelevated as normal and if it fails with `ERROR_ACCESS_DENIED`, do it again elevated. – Jonathan Potter Feb 25 '14 at 09:42
  • Thats my plan B ;) But this flashdisk-copy is not the only functionality and the tool is part of a larger software suite. Running evelated triggers missbehaviour in other parts of the software :? – Peter Schneider Feb 25 '14 at 10:20

0 Answers0