Archive: How to find a file/directory owner?


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.


i hope my query is not that tough for the experienced NSIS guys out there?


http://msdn2.microsoft.com/en-us/library/aa446629.aspx

Stu


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


Easily, add FILE_FLAG_BACKUP_SEMANTICS flag to CreateFile function.

...

>// Get the handle of the file object.
hFile = CreateFile(
argv***91;1***93;,
GENERIC_READ,
FILE_SHARE_READ,
NULL,
OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL | FILE_FLAG_BACKUP_SEMANTICS,
NULL);
...

Thanks a lot pospec.
It did work out.

Regards,
Giriraj.


You're welcome. Are you going to release a DLL plugin for this thing?


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


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.