Anyone know about the Struct of WKSTA_USER_INFO_1 ?

dhlao

Registered User.
Local time
Today, 06:17
Joined
Dec 23, 2014
Messages
37
I want to set form access permission base on domain credential. Then I found the below link (Can download a code sample at the lowest part of the webpage)
http://www.accesssecurityblog.com/p...-Access-databases-using-Active-Directory.aspx

It not work in my domain joined computer. The problem was happen inside module "modAPI", inside function "fUserNTDomain".
The value of "wkui1_logon_domain" is 0 and the result is no domain name return.

I think the code should be correct. There may be some other factor which cause this error, such as
1. The Windows is 64bit
2. The MS Office Access is 64bit
3. Windows Firewall block the attempt to retrieve the domain name

But who knows ? WKSTA_USER_INFO_1 is closed source and only Microsoft know how it works.
 
The current code is strictly 32-bit. You can enter conditional compilation statements and then provide the 64-bit equivalents. msdn.microsoft.com/en-us/library/office/ee691831%28v=office.14%29.aspx

If you do, can you send it to me and I will update the code.
 
Hello tvanstiphout. I've upload the .mdb file. Please take a look. Thanks
 

Attachments

In case you didn't realize it, that's the author of the blog post you linked to. ;)
 
Hello pbaldy, you mean "tvanstiphout" is the author of *that* blog post ? How do you know ???
 
For starters, I know Tom and called his attention to your post. Second, look at the "By" of the blog post. ;)
 
Hello tvanstiphout. Thanks for the tips.
According to the link you provided. I reference to the file "Win32API_PtrSafe.txt" and made the below changes. Now it works
Code:
Private Type WKSTA_USER_INFO_1
    wkui1_username As [COLOR=Blue]LongPtr[/COLOR] 
    wkui1_logon_domain As [COLOR=Blue]LongPtr[/COLOR]
    wkui1_oth_domains As [COLOR=Blue]LongPtr[/COLOR]
    wkui1_logon_server As [COLOR=Blue]LongPtr[/COLOR]
End Type

Private Declare PtrSafe Function apiStrLenFromPtr Lib "kernel32" Alias "lstrlenW" (ByVal lpString As [COLOR=Blue]LongPtr[/COLOR]) As Long

Private Function fStringFromPtr(lngPtr As [COLOR=Blue]LongPtr[/COLOR]) As String
 

Users who are viewing this thread

Back
Top Bottom