🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: borland.public.cppbuilder.nativeapi
6 messages
6 total messages Started by Asger Jørgensen Tue, 09 Oct 2007 08:37
Optain the owner of a file on win xp ?
#1211
Author: Asger Jørgensen
Date: Tue, 09 Oct 2007 08:37
9 lines
1084 bytes
Hi there

Is it possible to get the username who have created
a certain file on win xp, win2k and vista (not server) ??

If so how ?

Thanks in advance
Asger
Re: Optain the owner of a file on win xp ?
#1212
Author: Alan Bellingham
Date: Tue, 09 Oct 2007 08:50
19 lines
1577 bytes
Asger J�rgensen <junk@Asger-P.dk> wrote:

>Hi there
>
>Is it possible to get the username who have created
>a certain file on win xp, win2k and vista (not server) ??
>
>If so how ?

If so, then it depends on the filing system. If the drive is FAT (or
successors, including FAT32), then I strongly suspect not.

On the other hand, NTFS has much more information, including who the
owner is. The creator, I suspect not.

Alan Bellingham
-- 
Team Browns
ACCU Conference 2008: 2-5 April 2008 - Oxford (probably), UK
Re: Optain the owner of a file on win xp ?
#1213
Author: Remy Lebeau (TeamB)
Date: Tue, 09 Oct 2007 09:13
12 lines
1172 bytes
"Asger J�rgensen" <junk@Asger-P.dk> wrote in message
news:MPG.21755c2df166d99b98983c@newsgroups.borland.com...

> Is it possible to get the username who have created
> a certain file on win xp, win2k and vista (not server) ??

Look at GetFileSecurity(), GetSecurityDescriptorOwner(), and
LookupAccountSid().


Gambit
Re: Optain the owner of a file on win xp ?
#1217
Author: Asger Jørgensen
Date: Tue, 09 Oct 2007 14:06
11 lines
1206 bytes
Hi Remy

With Your help and some code from the net I
got the username, great!

Is there anyway that I can get the real name 
of the user ?

Thanks again
Kind regards
Asger
Re: Optain the owner of a file on win xp ?
#1218
Author: Remy Lebeau (TeamB)
Date: Tue, 09 Oct 2007 17:12
11 lines
1266 bytes
"Asger J�rgensen" <junk@Asger-P.dk> wrote in message
news:MPG.2175a94fb36222398983d@newsgroups.borland.com...

> Is there anyway that I can get the real name
> of the user ?

Look at NetUserGetInfo()


Gambit
Re: Optain the owner of a file on win xp ?
#1219
Author: Asger Jørgensen
Date: Tue, 09 Oct 2007 19:39
33 lines
1864 bytes
Thanks Remy

It works like a charm, You are the best..:-)

One last question:

At the moment I am testing this on my own system
with no server, so the users are all local.

I set the servername in NetUserGetInfo to NULL 
but if I am to use this on a server system i need
a servername.

Can I use the ReferencedDomainName i get from the 
call to LookupAccountSid as servername or is there 
an other way ?

When I try it on my system it seem to work but
will it work on a system with server ?

Thanks again
Kind regards
Asger

LookupAccountSid(
    LPCTSTR lpSystemName,
    PSID Sid,
    LPTSTR Name,
    LPDWORD cbName,
    LPTSTR ReferencedDomainName,
    LPDWORD cbReferencedDomainName,
    PSID_NAME_USE peUse
   );
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads