 |
 |

05-15-2007, 02:24 AM
|
|
Freshman
|
|
Join Date: Sep 2004
Posts: 33
|
|
File creator info
|
Is it possible in any way to get the usernname or computername that created or modified a file?
Can i get if from the file properties or can i get it from the filesystem?
In any way is it possible?
Thanks!
|
Last edited by Bagera; 05-15-2007 at 02:25 AM.
Reason: Forgot the notification again
|

05-15-2007, 06:18 AM
|
|
Freshman
|
|
Join Date: Sep 2004
Posts: 33
|
|
|
Well i have this now and it works fine with some files but on most the files from varius apps i get
administrators for name
and Built in for domain.
ret = GetNamedSecurityInfo(Path, 1, 1, OwnerSid, Nothing, Nothing, Nothing, SD)
LookupAccountSid(MachineName, OwnerSid, name, name_len, domain_name, domain_len, peUse)
Anyone have a clue, is there another way?
|
|

05-15-2007, 07:10 AM
|
|
Freshman
|
|
Join Date: Sep 2004
Posts: 33
|
|
|
Aha, after some poking around i am starting to at least know what im looking for.
Its not the owner of a file im interestad of, its the creator or machine the file was created on and that even if the file has been saved directly to a network drive.
|
|

05-15-2007, 10:41 AM
|
 |
Cum Grano Salis
Retired Moderator * Guru *
|
|
Join Date: Jul 2002
Location: Baltimore, Maryland
Posts: 14,636
|
|
The System.IO.FileInfo class will allow you to get properties of a file, such as last write date, size, other stuff - - but does not give modified by or author properties, nor the source machine/computer name
Security on the file system in .Net is accessed via the FileInfo.GetAccessControl method which returns a System.Security.AccessControl.FileSecurity object.
Here is an article on the subject which you can review:
http://aspalliance.com/1047_Working_...s_Control_List
|
__________________
"Artificial Intelligence is no match for natural stupidity." ~unknown
|

05-16-2007, 01:01 AM
|
|
Freshman
|
|
Join Date: Sep 2004
Posts: 33
|
|
|
Thanks!
But i think i have to get a new strategy, dosnt seam to be possible to get the creator of a file, that information does not exist in a file, only if
something or someone has set the author property.
Correct me if im wrong (I hope i am)
|
|

05-16-2007, 07:53 AM
|
 |
Cum Grano Salis
Retired Moderator * Guru *
|
|
Join Date: Jul 2002
Location: Baltimore, Maryland
Posts: 14,636
|
|
You aren't going to be able to probe any single .Net System.IO class for this information. You need to roll into the NTFS and Active Directory or whatever security model is in place. And even then, you aren't going to find a straight forward way to get a friendly user name and machine name for every file on a given network.
Now, you can get IP addresses of machines using the .Net DNS namespace and you can even get machine names and user names out of the .Net Environment namespace. But the problem is you want to pull this information out of the NTFS or basically your application isn't grabbing this information from a user of THAT application - - but you want to "query" for this information given a set of pre-created files.
Unfortunately trying pull this information out of the NTFS is something I really can't help you with  .
|
__________________
"Artificial Intelligence is no match for natural stupidity." ~unknown
|

05-16-2007, 08:08 AM
|
|
Freshman
|
|
Join Date: Sep 2004
Posts: 33
|
|
|
Thank you anyway!
I think i make a sniffer instead, it seams like a simpler way, then i can get the file creation and the ip and all that.
Is it a good idea to do this in vb or is c++ better for stability and performance?
|
|

05-16-2007, 08:14 AM
|
 |
Cum Grano Salis
Retired Moderator * Guru *
|
|
Join Date: Jul 2002
Location: Baltimore, Maryland
Posts: 14,636
|
|
|
My response to questions like that is always "choose the best language AND best design for the current problem". You could create a C++ dll and reference it within your .Net application. You could also write it in C# and reference that compiled .Net assembly within your VB.net project. Regarding the different languages provided in .Net the CLR allows us to use any combination or languages within a single solution.
Would you NEED to write this in C++, probably not. Could you write it in VB.net, without knowing exactly what you are going to do, I'd say most likely you can.
|
__________________
"Artificial Intelligence is no match for natural stupidity." ~unknown
|

10-30-2008, 03:33 AM
|
|
Newcomer
|
|
Join Date: Oct 2008
Location: hawaii
Posts: 1
|
|
|
|
Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
|
|
|
| Thread Tools |
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|
|
|
|
 |
|