I am renaming a file in directory X, copying a new file to directory X and renaming it.
Using MadExcept security wrappers I set the permissions.
This works on XP and W7.
It fails on W8 and W10.
UAC is off on all computers.
I have admin rights on all computers but, I still get "Access is denied".
It seems I need to set "Full control". How to do that is the question.
The first call is setting the permissions and I am not sure if it fails. I do know the "full control" checkbox in the security tabs is not set.
Then I call FileSetAttr if the file exist so I can delete it and it fails with access denied.
The I call DeleteFile and it fails with access denied.
Then RenameFile which copies and renames fails with access denied.
Finally I tried to clean up the file in the source directory and it fails when trying to rename it, access denied/
If I set the full control permission via the security tab the first part works. I stopped testing there and tried to set the full control permission and hit the wall.
I did not find any new flags/types/etc. for newer OS.
I found other strange things with W10.
Nothing to do with security.
I could rename a file and the file would disappear to Explorer. It was not hidden.
But, try to create or copy a file, with the same name, to the directory and the OS would say a file with the name existed.
But I could find the file with findfirst, findnext, delete the file and all was now fine. Like Explorer had a blind spot.
So, ended up modifying code to work for all OS. Not exactly what I wanted but will work.
Thanks for your help.