To José Roca

Windows specific questions.
Post Reply
deltarho[1859]
Posts: 4310
Joined: Jan 02, 2017 0:34
Location: UK
Contact:

To José Roca

Post by deltarho[1859] »

@JosepRoca

Hi José

I have a password manager which will automatically fills an edit box. I use it mainly for completing website login forms.

However, is it not filling the edit box of AfxInputBox. It will accept data from the keyboard and the clipboard but not from my password manager. On the other hand PowerBASIC's InputBox$ will accept data from my password manager.

I was hoping to use AfxInputBox to accept a password without my typing it or getting it from the clipboard for security reasons.

I have had a look at AfxInputBox in the Afx folder but I cannot see what is blocking the transfer.

If you have a moment perhaps you would look at this for me.

Thanks

David Roberts
Josep Roca
Posts: 564
Joined: Sep 27, 2016 18:20
Location: Valencia, Spain

Re: To José Roca

Post by Josep Roca »

Not knowing which technique uses the password manager to send the data it is impossible to guess. The AfxInputBox function uses a popup dialog with a label, a standard Windows edit control and two buttons. To set text in the edit control it's a matter of retrieving it's handle and set the text sending the WM_SETTEXT message. Maybe the password manager application uses another technique or maybe it is failing to retrieve the handle of the edit control for some reason.
deltarho[1859]
Posts: 4310
Joined: Jan 02, 2017 0:34
Location: UK
Contact:

To José Roca

Post by deltarho[1859] »

This is my password manager's default auto-type sequence: {USERNAME}{TAB}{PASSWORD}{ENTER}

That works on most websites.

For just sending a password I use {PASSWORD}. I have used this on sites where, at some point, only a password is required.

I ran PBForms and created a simple dialog consisting of just a close button and an edit box. Whilst in test mode I got my password manager to send a hex string and that worked; as with PB's InputBox$.

So, I started to experiment and got a success with {TAB}{PASSWORD}.

So, sending a TAB character before PASSWORD has AfxInputBox accepting the hex string.

I then tried {TAB}{PASSWORD}{ENTER}.

AfxInputBox accepted the hex string and closed; with a successful conclusion.

This behaviour is perfect for my needs.

Weird thing is: Why did I have to send a TAB character first? <Ha, ha>

Added: I set the last parameter of AfxInputBox to TRUE so that the transfer was obscured. Very neat!
Josep Roca
Posts: 564
Joined: Sep 27, 2016 18:20
Location: Valencia, Spain

Re: To José Roca

Post by Josep Roca »

> I ran PBForms and created a simple dialog consisting of just a close button and an edit box. Whilst in test mode I got my password manager to send a hex string and that worked; as with PB's InputBox$.

The only thing that I can think is that AfxInputBox sends an EM_SETSEL message to the edit control to select the existing text, if any. Try to send SendMessageW(hEdit, EM_SETSEL, 0, -1) to your PB GUI mentioned above to see if this is the cause.
deltarho[1859]
Posts: 4310
Joined: Jan 02, 2017 0:34
Location: UK
Contact:

Re: To José Roca

Post by deltarho[1859] »

I did that and then got my password manager to just send {PASSWORD} and it still worked.

Why execute SendMessageW(hEdit, %EM_SETSEL, 0, -1) (PB needs %) since the default text is selected anyway. In any case with the default selected any data passed should 'push' the default aside.

When my snippet was opened I pressed the Tab key and nothing happened so why {TAB}{PASSWORD} is solving the problem I don't know.
deltarho[1859]
Posts: 4310
Joined: Jan 02, 2017 0:34
Location: UK
Contact:

Re: To José Roca

Post by deltarho[1859] »

I removed the SendMessageW(hEdit, EM_SETSEL, 0, -1) statement from CWindow.inc and I still had to send a TAB for it to work. It is a bit of a carry on for me because AFx is in 'Program File (x86)' and I have UAC turned full on.

I was wrong about the default being selected anyway - SendMessageW(hEdit, EM_SETSEL, 0, -1) is required. I put CWindow.inc back to its former glory.

So, still no idea why sending TAB first solves my initial problem.

I have done quite a few tests and AfxInputBox is working perfectly - accepts the transfer and closes, provided that I send TAB before my password.
Post Reply