I
isaac rainsford (MCSE)
can anyone lend some assistance on how to convert some code to vb.net
from vb5?
in VB5 the code succeeds and the IF statement is processed, in Vb.NET
the code returns error and the msgbox returns an 18 digit error code!
thanks in advance
the code is:
Private Const SE_FILE_OBJECT = 1&
Private Const DACL_SECURITY_INFORMATION = 4&
Private Declare Function GetNamedSecurityInfo Lib "Advapi32.dll" Alias _
"GetNamedSecurityInfoA" _
(ByVal ObjName As String, _
ByVal SE_OBJECT_TYPE As Long, _
ByVal SecInfo As Long, _
ByVal pSid As Long, _
ByVal pSidGroup As Long, _
ByVal pDacl As Long, _
ByVal pSacl As Long, _
ByVal pSecurityDescriptor As Long) As Long
Dim result As Long
Dim pSecDesc As Long
Dim ea As Any
Dim pNewDACL As Long
Dim pOldDACL As Long
result = GetNamedSecurityInfo("c:\test1", SE_FILE_OBJECT, _
DACL_SECURITY_INFORMATION, 0&, 0&, pOldDACL, 0&, pSecDesc)
If result = ERROR_SUCCESS Then
... snip snip snip ...
Else
MsgBox("GetNamedSecurityInfo failed with error code : " & result)
End If
from vb5?
in VB5 the code succeeds and the IF statement is processed, in Vb.NET
the code returns error and the msgbox returns an 18 digit error code!
thanks in advance
the code is:
Private Const SE_FILE_OBJECT = 1&
Private Const DACL_SECURITY_INFORMATION = 4&
Private Declare Function GetNamedSecurityInfo Lib "Advapi32.dll" Alias _
"GetNamedSecurityInfoA" _
(ByVal ObjName As String, _
ByVal SE_OBJECT_TYPE As Long, _
ByVal SecInfo As Long, _
ByVal pSid As Long, _
ByVal pSidGroup As Long, _
ByVal pDacl As Long, _
ByVal pSacl As Long, _
ByVal pSecurityDescriptor As Long) As Long
Dim result As Long
Dim pSecDesc As Long
Dim ea As Any
Dim pNewDACL As Long
Dim pOldDACL As Long
result = GetNamedSecurityInfo("c:\test1", SE_FILE_OBJECT, _
DACL_SECURITY_INFORMATION, 0&, 0&, pOldDACL, 0&, pSecDesc)
If result = ERROR_SUCCESS Then
... snip snip snip ...
Else
MsgBox("GetNamedSecurityInfo failed with error code : " & result)
End If