Private Declare Function LookupPrivilegeValue Lib "advapi32.dll" _
Alias "LookupPrivilegeValueA" (ByVal lpSystemName As String, _
ByVal lpName As String, lpLuid As LUID) As Long
Private Declare Function AdjustTokenPrivileges Lib "advapi32.dll" _
(ByVal TokenHandle As Long, ByVal DisableAllPrivileges As Long, _
NewState As TOKEN_PRIVILEGES, ByVal BufferLength As Long, _
ByVal PreviousState As Long, ByVal ReturnLength As Long) As Long
Private Declare Function CloseHandle Lib "kernel32" _
(ByVal hObject As Long) As Long
Public Sub ChangeOwnerOfFile(FileName As String, _
OwnerAccountName As String)
'' variables for the LookupAccountName API Call
Dim Sid(255) As Byte '' Buffer for the SID
Dim nBufferSize As Long '' Length of SID Buffer
Dim szDomainName As String * 255 '' Domain Name Buffer
Dim nDomain As Long '' Length of Domain Name buffer
Dim peUse As Integer '' SID type
Dim Result As Long '' Return value of Win32 API call
'' variables for the InitializeSecurityDescriptor API Call
Dim SecDesc As SECURITY_DESCRIPTOR