M
Microsoft Communities
Hi all,
I call Win32 function: LookupAccountSidW on VB.NET:
Declare Unicode Function GetSIDStr Lib "advapi32.dll" Alias
"LookupAccountNameW" ( _
ByVal lpSystemName As String, ByVal lpAccountName As String _
, ByRef Sid As IntPtr, ByRef cbSid As Integer _
, ByRef ReferencedDomainName As IntPtr _
, ByRef cchReferencedDomainName As Integer _
, ByRef peUse As Integer) As Boolean
'Execute GetSIDStr function:
Private Shared Sub ProcessAPIFunction()
Dim lpSystemName As String = ""
Dim lpAccountName As String = "username"
Dim lpSID As IntPtr
Dim cbSID As Integer = 0
Dim lpRefDomainName As IntPtr
Dim cchRefDomainName As Integer = 255
Dim peUse As Integer = SID_NAME_USE.SidTypeUser
Dim ret As Boolean = GetSIDStr(lpSystemName, lpAccountName, lpSID,
cbSID, lpRefDomainName, cchRefDomainName, peUse)
End Sub
After execute GetSIDStr, ret's value is False, and I cannot get the return
value in lpSID, lpRefDomainName.parameter. I can get value in cbSID (e.g:
8), cchRefDomainName (e.g: 25)
Can anyone help me?
Thanks
I call Win32 function: LookupAccountSidW on VB.NET:
Declare Unicode Function GetSIDStr Lib "advapi32.dll" Alias
"LookupAccountNameW" ( _
ByVal lpSystemName As String, ByVal lpAccountName As String _
, ByRef Sid As IntPtr, ByRef cbSid As Integer _
, ByRef ReferencedDomainName As IntPtr _
, ByRef cchReferencedDomainName As Integer _
, ByRef peUse As Integer) As Boolean
'Execute GetSIDStr function:
Private Shared Sub ProcessAPIFunction()
Dim lpSystemName As String = ""
Dim lpAccountName As String = "username"
Dim lpSID As IntPtr
Dim cbSID As Integer = 0
Dim lpRefDomainName As IntPtr
Dim cchRefDomainName As Integer = 255
Dim peUse As Integer = SID_NAME_USE.SidTypeUser
Dim ret As Boolean = GetSIDStr(lpSystemName, lpAccountName, lpSID,
cbSID, lpRefDomainName, cchRefDomainName, peUse)
End Sub
After execute GetSIDStr, ret's value is False, and I cannot get the return
value in lpSID, lpRefDomainName.parameter. I can get value in cbSID (e.g:
8), cchRefDomainName (e.g: 25)
Can anyone help me?
Thanks