Anyone know about the Struct of WKSTA_USER_INFO_1 ? (1 Viewer)

dhlao

Registered User.
Local time
Yesterday, 23:43
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.
 

tvanstiphout

Active member
Local time
Yesterday, 23:43
Joined
Jan 22, 2016
Messages
268
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.
 

dhlao

Registered User.
Local time
Yesterday, 23:43
Joined
Dec 23, 2014
Messages
37
Hello tvanstiphout. I've upload the .mdb file. Please take a look. Thanks
 

Attachments

  • AD_sample.mdb
    608 KB · Views: 53

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 23:43
Joined
Aug 30, 2003
Messages
36,137
In case you didn't realize it, that's the author of the blog post you linked to. ;)
 

dhlao

Registered User.
Local time
Yesterday, 23:43
Joined
Dec 23, 2014
Messages
37
Hello pbaldy, you mean "tvanstiphout" is the author of *that* blog post ? How do you know ???
 

pbaldy

Wino Moderator
Staff member
Local time
Yesterday, 23:43
Joined
Aug 30, 2003
Messages
36,137
For starters, I know Tom and called his attention to your post. Second, look at the "By" of the blog post. ;)
 

dhlao

Registered User.
Local time
Yesterday, 23:43
Joined
Dec 23, 2014
Messages
37
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

Top Bottom