Skip to content
⌘ NSIS Forum Archive

How to find a file/directory owner?

9 posts

giriraj#

How to find a file/directory owner?

Hello.
I need to find out the owner of the file/directory that exists on NTFS file system.
Is there any way out there that could help me to find it out?

Giriraj.
giriraj#
Thanks a lot Afrow.
The code sample helped me find out the owner of a file.
But how do i find the owner of a directory?
I know directory is a special kind of file.
But i am not able to sort this out.

Regards,
Giriraj
pospec#
Easily, add FILE_FLAG_BACKUP_SEMANTICS flag to CreateFile function.
...
// Get the handle of the file object.
    hFile = CreateFile(
                      argv[1],
                      GENERIC_READ,
                      FILE_SHARE_READ,
                      NULL,
                      OPEN_EXISTING,
                      FILE_ATTRIBUTE_NORMAL | FILE_FLAG_BACKUP_SEMANTICS,
                      NULL);
... 
Afrow UK#
This is something I plan to add to the AccessControl plug-in when I have time.
The version currently on the Wiki is already out of date.

Stu
pospec#
I tried to write that plugin but have never before write DLL. You're obviously more experienced. Maybe you could point me to some good docs about this problematics.