Question : Access denied for backup operator user

Hi,

I am writing an application to copy files from one said location to another location for backup. I am enabling my process the
SeBackupPrivilege privilege by LookupPrivilegeValue function. My application's logon user is a member of backup operator group. My application is designed to copy any files, of any user, irrespective of user permission to the destination location/

My application works fine for XP and above OSes. But, I am getting access denied for the files/folders with are configured for access to particular user only in Windows 2000 systems [for both pro and advanced server OSes]. Am I missing anything....?

I am compiling my application in Windows XP SP2 OS. Is this is causing issue? If so, is there a way to resolve this issue, with out compiling application in Windows 2000 system.

Thanks in advance.

John Nash.

Answer : Access denied for backup operator user

GetFileAttributes does not use FILE_FLAG_BACKUP_SEMANTICS on Windows 2000.  

Call CreateFile with FILE_FLAG_BACKUP_SEMANTICS to create the file handle.  Pass the file handle to GetFileInformationByHandle to get the BY_HANDLE_FILE_INFORMATION structure.  Inspect the dwFileAttributes member of the rBY_HANDLE_FILE_INFORMATION structure to get the file attributes

This works going all the way back to Windows NT and Windows 95.

Random Solutions  
 
programming4us programming4us