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.

etc.

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.

Well, the exact flags which say "full control" differ from OS to OS. It's possible that you may need some special flags in newer OSs which madSecurity might not know about. In any case, I'd suggest that you double check if setting the permissions changes anything. It should be easy for you to check by looking at the security tab before and after calling madSecurity. E.g. try remove the permissions you need, then run the madSecurity code and see if anything changes. If not, maybe you need to enable some privileges to make it work. If yes, but RenameFile/CopyFile etc still fail, then maybe the flags added by madSecurity are not enough and you may need to add more flags.

Well no joy. 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.