BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Get text from a (external program's) Edit Control under Mous

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Native API)
View previous topic :: View next topic  
Author Message
JasperP
Guest





PostPosted: Tue Sep 05, 2006 8:38 pm    Post subject: Get text from a (external program's) Edit Control under Mous Reply with quote



I'm trying to create a small tool whereby users can retrieve their
passwords.
So read a masked password from eg. Outlook.

How can I manage this?

I remember this was just a simple gettext(hWindow) in VB.

--------------------------------------------------

POINT pt;
GetCursorPos(&pt)

HWND hWindow;
char cBuffer[255];
hWindow = WindowFromPoint(pt);

// this gets the text of a few controls, but not all Edit Controls
GetWindowText(hWindow, cBuffer, sizeof(cBuffer));

// can't get this to work..
SendMessage(hWindow, EM_GETLINE ,0 , (long)cBuffer);


EditResult->Text = ....

--------------------------------------------------

Help would really be appreciated!

Jasper
Back to top
Alan Bellingham
Guest





PostPosted: Tue Sep 05, 2006 9:14 pm    Post subject: Re: Get text from a (external program's) Edit Control under Reply with quote



"JasperP" <Spam (AT) SpamCop (DOT) net> wrote:

Quote:
I'm trying to create a small tool whereby users can retrieve their
passwords.
So read a masked password from eg. Outlook.

How can I manage this?

I rather hope you can't - because if you can, it means that there really
is no security in Windows.

(And I'm naive enough to hope that there's enough to defeat this, at
least.)

In principle, you should be able to use GetWindowText() using the window
handle. This can, in principle, be used to go cross-process. On the
other hand, it's down to control receiving the WM_GETTEXT message to
disable the functionality, and I would rather hope that a password entry
field does so.

If it didn't, then it's too easy for a virus on your machine to grab all
your passwords and email them to Lithuania, or Miami, or wherever.

An alternate solution - and no, I've not even thought about trying this
- would be to watch for new windows appearing with the ES_PASSWORD
attribute. When one does, you could pop up your window instead for the
user to type into, and then send the result off to the original.

(I assume that WM_SETTEXT would still work.)

Alan Bellingham
--
ACCU Conference: 11-14 April 2007 - Paramount Oxford Hotel
Back to top
JasperP
Guest





PostPosted: Tue Sep 05, 2006 9:28 pm    Post subject: Re: Get text from a (external program's) Edit Control under Reply with quote



Alan Bellingham wrote:
Quote:
I rather hope you can't - because if you can, it means that there really
is no security in Windows.

Then I have to disapoint you about this; many of these small tools already
exist and work. A MaskEdit control is just as easily read as a Edit control.
With GetWindowText I can get the masked text out of a couple of programs,
but not all.

Strangly enough a program written in VB (I have the source of this simple
and small program), uses gettext(hWindow) and gets the masked text out of
almost all programs.

Quote:
An alternate solution - and no, I've not even thought about trying this
- would be to watch for new windows appearing with the ES_PASSWORD
attribute. When one does, you could pop up your window instead for the
user to type into, and then send the result off to the original.

(I assume that WM_SETTEXT would still work.)

I don't wish to intercept information. It is intended to just be a retrieval
tool.

Jasper
Back to top
Remy Lebeau (TeamB)
Guest





PostPosted: Tue Sep 05, 2006 11:23 pm    Post subject: Re: Get text from a (external program's) Edit Control under Reply with quote

"Alan Bellingham" <alan (AT) lspace (DOT) org> wrote in message
news:8v7rf25uai1ldlmu12psopd6oscoa4rtdv (AT) 4ax (DOT) com...

Quote:
I rather hope you can't - because if you can, it means that
there really is no security in Windows.

Such tools already exist, such as Snadboy's Revelation, using the standard
WM_GETTEXT message. Most edit controls that have a password mask applied do
not mask the text when requested, only when displayed visually.

Quote:
I would rather hope that a password entry field does so.

I don't know about recent Windows versions, but that has not always been the
case, unfortunately. Maybe it has already changed, I don't know. At one
time, I started implementing my own Edit control that prevented such tools
from working. But I never finished it.


Gambit
Back to top
JasperP
Guest





PostPosted: Wed Sep 06, 2006 12:18 am    Post subject: [ Solved ] Reply with quote

JasperP wrote:
Quote:
How can I manage this?

Found a good example that works with hooking.

Jasper
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> C++ Builder (Native API) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.