From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
From Friday, April 19th (11:00 PM CDT) through Saturday, April 20th (2:00 PM CDT), 2024, ni.com will undergo system upgrades that may result in temporary service interruption.
We appreciate your patience as we improve our online experience.
01-22-2016 01:26 PM
I'm working on a login/privilege escalation feature that uses domain user/PW and got LDAP authentication figured out, but I was hoping to avoid just using a labview string control for the password entry b/c of security (VI Server, unencrypted, etc). I am trying to call CredUIPromptForWindowsCredentials and launch the native windows login dialog. It is a function in the System32\credui.dll but I can't get the parameters right. I keep getting a return value of A0(160) and no dialog. I think it is the PCREDUI_INFO type screwing it up. It needs:
DWORD WINAPI CredUIPromptForWindowsCredentials(
_In_opt_ PCREDUI_INFO pUiInfo,
_In_ DWORD dwAuthError,
_Inout_ ULONG *pulAuthPackage,
_In_opt_ LPCVOID pvInAuthBuffer,
_In_ ULONG ulInAuthBufferSize,
_Out_ LPVOID *ppvOutAuthBuffer,
_Out_ ULONG *pulOutAuthBufferSize,
_Inout_opt_ BOOL *pfSave,
_In_ DWORD dwFlags
);
I've been told that Rolf would be able to solve this in 30 seconds. Help me LabVIEW! You're my only hope!
Solved! Go to Solution.
01-22-2016 10:25 PM
Josh,
It's easier to call it in a wrapper C dll.
I manage to get this window to show up:
George
01-25-2016 04:03 AM
zou, do you have the Login.dll DLL and its source (if you can make it available) - can't run your example without it and it would be good to know what's inside it (it is asking people to enter their username/password after all...) but I'm curious to try it.
01-25-2016 09:01 AM
The dll was striped by the forum.
It's calling CredUIPromptForWindowsCredentials
01-25-2016 09:05 AM
George,
I figured the C wrapper might be the way to go. It's quite trival to create the structures and data types required in C/CVI, but very complicated in LabVIEW. On the lava forum, Rolf K said the issue is probably the pointers inside the struct. I think his instincts are right.
01-25-2016 09:08 AM - edited 01-25-2016 09:10 AM
The dll and source code can be download from my dropbox:
https://www.dropbox.com/s/74ccqtt40btxg7j/Login.zip?dl=0
It's just a demo for the ideal.
Not finished.
01-25-2016 09:14 AM
Sam,
Inside the C dll you basically have to call 2 windows dll functions which are part of the credui.dll:
and
The first function unpacks the buffer you receive after calling the first function which pops open the native windows login screen and returns a pointer to the buffer. Once the buffer is unpacked and you have a string representation of the username and PW you can feed it into a .net function PrincipalConext.ValidateCredentials and get a verification of the username and password. This method works for both local logins and network logins of certain types (Active directory)
Relavent Links:
https://msdn.microsoft.com/en-us/library/windows/desktop/aa375178(v=vs.85).aspx
https://msdn.microsoft.com/en-us/library/bb154889(v=vs.110).aspx
01-25-2016 09:37 AM
01-25-2016 10:27 AM - edited 01-25-2016 10:29 AM
Sam,
The link has been updated to include the release version dll.
As I said this dll is not finished, just a demo. It doesn't return the user input.
Reasons: 1. I 'm sure Josh can finish it; 2. I think the user input should be verified within the dll, and return only a boolean.
P.S. by the way, VS express version is free. You can download it from MS.
02-17-2017 03:19 PM
Hi zou,
It looks like the dropbox link is no longer available. Can you re-upload the code?
Thanks,
Jenna