Total Commander Forum Index Total Commander
Форум поддержки пользователей Total Commander
Сайты: Все о Total Commander | Totalcmd.net | Ghisler.com | RU.TCKB
 
 RulesRules   SearchSearch   FAQFAQ   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Single Post  Topic: Script Content Plugin 
Author Message
Batya



PostPosted: Mon Sep 13, 2010 17:49    Post subject: Reply with quote

Новый скриптик:
Code:
'=================================================
' Колонка Result возвращает владельца файла\папки
'=================================================

content = Result

Function Result
  On Error Resume Next
  Dim wmiSecSettings 'WMI объект для параметров безопасности
  Dim wmiSecurityDescriptor 'Дескриптор защиты файла

  Dim FOResult 'Результат выполнения операции чтения дескриптора безопасности
  Dim wmiOwner 'Объект владельца файла

  Set wmiSecSettings = GetObject ("winmgmts:Win32_LogicalFileSecuritySetting.path='" & filename & "'") 'Создание WMI объекта файла

  FOResult = wmiSecSettings.GetSecurityDescriptor(wmiSecurityDescriptor) 'Считывание дескриптора безопасности
  Set wmiOwner = wmiSecurityDescriptor.Owner 'Создание объекта владельца файла

  If Err.Number <> 0 Then 'Ошибка при определении владельца файла
    Result = "Can't get file owner. Error: " & Err.Description
  Else 'Владелец файла определен - вывод результата
    Result = wmiOwner.Domain & "\" & wmiOwner.Name
  End If
End Function

_________________
Нет, я не сплю. Я просто медленно моргаю.
View user's profile Send private message


Powered by phpBB © 2001, 2005 phpBB Group