Get fully qualified domain name in vba

R

rick

I have the api calls to get the username, servername and domainname but when
I call the NetWkstaUserGetInfo API specifying a level 1 information
structure into the following type declaration the wkui1_logon_domain only
returns the first characters.
For example, I get 'HQ' instead of 'HQ.ABCCO.COM'. Thanks for your help.
....rick

Private Type WKSTA_USER_INFO_1
'name of the user currently logged onto the workstation.
wkui1_username As Long
'domain name of the user account currently logged on
wkui1_logon_domain As Long
'list of other domains browsed by the workstation
wkui1_oth_domains As Long
'name of the authenticating server
wkui1_logon_server As Long
End Type
....
Dim typNTInfo As WKSTA_USER_INFO_1
'call the NetWkstaUserGetInfo API specifying a level 1 information structure
lngRet = apiWkStationUser(0&, 1&, lngPtr)
If lngRet = NERR_Success And lngPtr Then
Call sapiCopyMemory(typNTInfo, ByVal lngPtr, LenB(typNTInfo))
If Not IsNull(lngPtr) Then
With typNTInfo
glbUserName = fStringFromPtr(.wkui1_username)
glbDomainName = fStringFromPtr(.wkui1_logon_domain)
glbServerName = fStringFromPtr(.wkui1_logon_server)
glbOtherDomains = fStringFromPtr(.wkui1_oth_domains)
End With
End If
End If
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top