Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
I

is251rd

@is251rd
About
Posts
2
Topics
1
Shares
0
Groups
0
Followers
0
Following
0

Posts

Recent Best Controversial

  • Find File Owner Using .NET 2.0
    I is251rd

    Thanks a bunch, Will! That works great! I've been combing the internet for a couple days trying to figure this out.

    Visual Basic csharp c++ com security help

  • Find File Owner Using .NET 2.0
    I is251rd

    I'm trying to find file/folder owners using VB 2005 and .NET 2.0. I've been successful using the System.Management namespace and WMI calls, but this takes a lot more coding than it looks like it would take using .NET 2.0. I've found the following C++ example at http://msdn.microsoft.com/msdnmag/issues/06/00/SecurityBriefs: void printTheOwnerOfThisFile(string path) { FileSecurity s = File.GetAccessControl(path); NTAccount user = (NTAccount)s.GetOwner(typeof(NTAccount)); Console.WriteLine(user); } ... printTheOwnerOfThisFile(@"c:\autoexec.bat"); Here's my attempt at translating it to VB 2005: Imports System.IO Imports System.Security.AccessControl Imports System.Security.Principal Module Module1 Sub Main() Dim FilePath As String = "c:\autoexec.bat" Dim s As FileSecurity = File.GetAccessControl(FilePath) Dim user As NTAccount = s.GetOwner(NTAccount) Console.WriteLine(user) For i As Int64 = 1 To 100000000000 i = i + 1 Next End Sub End Module (The For-Next loop is just to keep the console window open long enough to see what was written.) I'm getting a Build error on the GetOwner parameter in parentheses that "NTAccount is a type and cannot be used as an expression." However, the GetOwner method parameter is supposed to be "targetType as System.Type" according to MSDN. Can anyone tell me what I'm doing wrong? Is it just not possible to get the file owner in VB using .NET 2.0? Thanks in Advance

    Visual Basic csharp c++ com security help
  • Login

  • Don't have an account? Register

  • Login or register to search.
  • First post
    Last post
0
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups