News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Problem gettting child window caption

Started by x64Core, October 01, 2013, 05:56:34 PM

Previous topic - Next topic

dedndave



perhaps, when you ran EnumChildWindows, you were running it on the wrong parent handle
i see 2 "Chrome_WidgetWin_1" windows - one has no children - one does

you can run EnumWindows - filter out only parent Chrome_WidgetWin_1 windows
then, when you find one of those - call EnumChildWindows on it

i will get back to you in an hour or so with a program to try - have to take care of something   :P

dedndave

quick and dirty
let me know if it works   :biggrin:

x64Core

Not working :


Even, I tried enumerating all windows on the system:


.586
.model flat,stdcall
include masm32rt.inc

.data
sparentcls db "PARENT > class: %ls ",0ah,0
sparenttit db "PARENT > title: %ls ",0ah,0

schildcls db "    #CHILD > class: %ls",0ah,0
schildtit db "    #CHILD > title: %ls",0ah,0
.code

getchilds proc hwnd:HWND,lparam:LPARAM
    LOCAL classname[200*1]:WORD
    LOCAL mtitle[200*5]:WORD
   
    invoke GetClassNameW,hwnd,addr classname,sizeof classname
    invoke GetWindowTextW,hwnd,addr mtitle,sizeof mtitle
   
    lea eax,classname
    push eax
    push offset schildcls
    call crt_printf
    add esp,sizeof(DWORD) * 2
   
   
    lea eax,mtitle
    push eax
    push offset schildtit   
    call crt_printf
    add esp,sizeof(DWORD) * 2
   
    mov eax,1
    ret

getchilds endp


getparents proc hwnd:HWND,lparam:LPARAM
   
    LOCAL classname[200*1]:WORD
    LOCAL mtitle[200*5]:WORD
    LOCAL written:DWORD
    LOCAL h:HANDLE
   
    invoke GetClassNameW,hwnd,addr classname,sizeof classname
    invoke GetWindowTextW,hwnd,addr mtitle,sizeof mtitle
   
    lea eax,classname
    push eax
    push offset sparentcls
    call crt_printf
    add esp,sizeof(DWORD) * 2
   
   
    lea eax,mtitle
    push eax
    push offset sparenttit   
    call crt_printf
    add esp,sizeof(DWORD) * 2
   
    ; get childs
    invoke EnumChildWindows,hwnd,offset getchilds,0   
   
    mov eax,1
    ret   

getparents endp

Start proc
   
    invoke EnumWindows,offset getparents,0
    int 3 ; break
   
Ret
Start EndP
End Start


string is empty

Parent string is ok
child string is empty:




x64Core

Resolved guys lol use Sendmessage
Looks like the GetWindowText function has problems getting the string:
http://blogs.msdn.com/b/oldnewthing/archive/2003/08/21/54675.aspx
---
thank yall for your time, thanks dave   :t

hutch--

Write an enumeration callback as Dave suggested then be willing to scan parts of the data for each application instance to find data that indicates that it is Chrome.

dedndave

i made a mistake on GetWindowText, actually
i only print the result if EAX is non-zero - just like GetClassName   :redface:

well - GetWindowText isn't the same as GetClassName
i was in a hurry - what can i say - at least it put you on the right track

see if this one is a little better....

in the end - may be better to use WM_GETTEXT   :t

EDIT: i went ahead and switched to WM_GETTEXT
i also cleaned up the output text format a little

x64Core

Quote from: dedndave on October 02, 2013, 11:12:07 AM
i made a mistake on GetWindowText, actually
i only print the result if EAX is non-zero - just like GetClassName   :redface:

well - GetWindowText isn't the same as GetClassName
i was in a hurry - what can i say - at least it put you on the right track

see if this one is a little better....

in the end - may be better to use WM_GETTEXT   :t

EDIT: i went ahead and switched to WM_GETTEXT
i also cleaned up the output text format a little
mmm... I dont think so, GetWindowText is not working in actually, it returns an empty string, idk why but doesnt work.
SendMessage is working quite fine :P check it

TWell

Some tests with Dave's program in Win 7

Version 29.0.1547.76 m

Parent Handle: 000301A2
Parent Handle: 000301A4
  Chrome_WidgetWin_0 , The MASM Forum - Index
  Chrome_RenderWidgetHostHWND
  CompositorHostWindowClass
Parent Handle: 00020182
Parent Handle: 0009015C

Version 30.0.1599.66 m

Parent Handle: 001502EA
Parent Handle: 00070162
  Chrome_WidgetWin_0 , The MASM Forum - Index
  Chrome_RenderWidgetHostHWND
  CompositorHostWindowClass
Parent Handle: 000601A6
Parent Handle: 000B0188

IronPortable
Version 29.0.1600.1 (220100)

Parent Handle: 000506CA
Parent Handle: 00060644
  Chrome_WidgetWin_0 , The MASM Forum - Index
  Chrome_RenderWidgetHostHWND
Parent Handle: 00040664
Parent Handle: 00080674

So no more class "Chrome_OmniboxView"

jj2007

Quote from: x64Core on October 02, 2013, 09:55:17 AM
Looks like the GetWindowText function has problems getting the string:
http://blogs.msdn.com/b/oldnewthing/archive/2003/08/21/54675.aspx

Looks familiar ;-)
The main problem here is that GetWindowText is no good for kids of other parents, while SendMessage works fine in general but may hang (see "What if I don't like these rules?" in Raymond Chen's blog quoted above). The only reliable solution (used for Win$()) is to use SendMessageTimeout with a timeout of e.g. 100 ms (of which 50 µs are typically needed).

In 32-bit versions of Windows, beware of asking for the text of kids in 16-bit processes: an exception will occur, and AFAIK there is no workaround.

hutch--

TWell,

Have a look at a MASM32 example in version 11 called "enumwin.exe" in the enumerate directory of examples. Run Chrome, then start "enumwin.exe" then see what the class name, handle and window caption text is.

TWell

It isn't there. ("Chrome_OmniboxView" is removed from newer versions)

Such as:
IronPortable Version 29.0.1600.1 (220100)

hutch--

I am running Version 27.0.1500.0 (201000) of Iron Portable and it shows up fine. Note though that this is one my older XP SP3 box.

You may find that they (the developers of Iron) don't want it to be easily found by other programs.

x64Core

my chrome is 28.0.1500.95 m and its working
BTW, nice information jj, thank you


added:
I just updated my chrome to: Version 30.0.1599.66 m
not working anymore lol
any alternative, guys?  injection  :P