Jump to content

launch windows login credential dialog with winAPI


Recommended Posts

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 LAVA! You're my only hope!

Link to comment

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 LAVA! You're my only hope!

 

Someone certainly has a very unrealistic view about me here!  :D

 

Your problem are most likely the embedded pointers inside the structure pUiInfo, While it's possible in LabVIEW to allocate memory buffers and assign the resulting pointer to the entry in the cluster it is a big hassle. Also the structure needs to be different for 32 bit and 64 bit LabVIEW since pointers and Handles in Windows are of the size of the system too.

 

An extra problem might be that on the MSDN page there is a user comment that claims that the ANSI version of this function is not working properly. Since LabVIEW uses ANSI strings everywhere this would require your strings to be translated to widechar UTF16 and then to call the W function.

 

All in all it is a lot more work than 30 seconds for sure. And I'm not even sure it is so much safer. The Windows dialog uses Windows controls and they can be targeted from a different process with enough privilege escalation. The LabVIEW controls on the other hand are a lot harder to target from outside the LabVIEW process since they are fully implemented in LabVIEW itself.

 

It would actually help to see what you have done so far. If it is something minor I'm certainly willing to point you into the right direction but I have no inclination at all to build this from scratch.

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Unfortunately, your content contains terms that we do not allow. Please edit your content to remove the highlighted words below.
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.