Hello everyone,
This is my first post so please go easy on me .
I have just started diving into Win32 programming using the book Windows System Programming by Johnson M. Hart. In chapter 2 he develops three versions of a simple file-copy program. The first version uses the straightforward C standard library approach using fopen() and fwrite(). This works without a hitch.
The second version uses the Windows API CreateFile() function. This program also works but I only in an elevated command prompt or the program returns a file-not-found error.
I've read that Windows 7 onwards needs admin privileges to access a file's handle. Assuming this was done for security reasons, it seems like a loophole that standard C library file routines bypass this protection. Granted, this is a very simple example program which doesn't show the full benefit of the Windows API or UAC.
Am I misunderstanding the role of UAC, or is this actually the way it is supposed to work? And if so, how do the built-in Windows file manipulation utilities get round it?