首页
社区
课程
招聘
[求助]WinID
2008-12-3 17:34 4478

[求助]WinID

2008-12-3 17:34
4478
我看过某个教程是利用WinID找到Class
然后根据class的关键字去搜寻
也就是静态分析
那么这个class代表的是什么意思呢?
是c++里用来产生object的class?


[培训]《安卓高级研修班(网课)》月薪三万计划,掌 握调试、分析还原ollvm、vmp的方法,定制art虚拟机自动化脱壳的方法

上传的附件:
收藏
点赞0
打赏
分享
最新回复 (7)
雪    币: 2108
活跃值: (21)
能力值: (RANK:260 )
在线值:
发帖
回帖
粉丝
书呆彭 6 2008-12-3 19:02
2
0
RegisterClassEx()时传递的参数。

请复习Win32编程的知识。
雪    币: 214
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
magicfx 2008-12-4 00:22
3
0
请问这段代码
产生出的about dialog的class为什么是数字?
怎么来的?

===
.386
.model        flat,stdcall
option        casemap:none

include                demo.inc

.code
start:
        invoke GetModuleHandle, NULL
        mov    hInstance,eax
        invoke GetCommandLine
        invoke WinMain, hInstance,NULL,CommandLine, SW_SHOWDEFAULT
        invoke ExitProcess,eax
;=====================================================================
WinMain        proc hInst:HINSTANCE,hPrevInst:HINSTANCE,CmdLine:LPSTR,CmdShow:DWORD
        LOCAL        wc:WNDCLASSEX
        LOCAL        msg:MSG
        LOCAL        hwnd:HWND
       
        mov        wc.cbSize,SIZEOF WNDCLASSEX
        mov        wc.style, CS_HREDRAW or CS_VREDRAW
        mov        wc.lpfnWndProc, OFFSET WndProc
        mov        wc.cbClsExtra,NULL
        mov        wc.cbWndExtra,NULL
        push        hInst
        pop        wc.hInstance
        mov        wc.hbrBackground, COLOR_WINDOW+1
        mov        wc.lpszMenuName, OFFSET MenuName
        mov        wc.lpszClassName, OFFSET ClassName
        invoke        LoadIcon, NULL, IDI_APPLICATION
        mov        wc.hIcon,eax
        mov        wc.hIconSm,eax
        invoke        LoadCursor, NULL, IDC_ARROW
        mov        wc.hCursor,eax
        invoke        RegisterClassEx, addr wc
        invoke        CreateWindowEx, WS_EX_CLIENTEDGE, ADDR ClassName, ADDR AppName,\
                WS_OVERLAPPEDWINDOW, CW_USEDEFAULT, CW_USEDEFAULT, 300, 200, NULL, NULL,\
                hInst, NULL
        mov           hwnd,eax
        invoke        ShowWindow, hwnd, SW_SHOWNORMAL
        invoke        UpdateWindow, hwnd
       
        .while        TRUE
                invoke        GetMessage, ADDR msg, NULL, 0, 0
                .break        .if        (!eax)
                invoke        TranslateMessage, ADDR msg
                invoke        DispatchMessage, ADDR msg
        .endw
       
        mov        eax,msg.wParam
        ret
WinMain        endp
;=======================================================================
WndProc        proc        hWnd:HWND, uMsg:UINT, wParam:WPARAM, lParam:LPARAM

        mov        eax,uMsg
       
        .if        eax == WM_DESTROY
                invoke        PostQuitMessage,NULL
        .elseif        eax == WM_COMMAND
                mov        eax,wParam
                .if        ax==IDM_ABOUT
                        invoke        DialogBoxParam, hInstance, addr DlgName, hWnd, OFFSET DlgProc, NULL
                .else
                        invoke        DestroyWindow, hWnd
                .endif
        .else
                invoke DefWindowProc,hWnd,uMsg,wParam,lParam
                ret
        .endif
        xor        eax,eax
        ret
WndProc        endp

DlgProc        proc        hWnd:HWND,iMsg:DWORD,wParam:WPARAM, lParam:LPARAM
       
        .if        iMsg == WM_INITDIALOG
                invoke        GetDlgItem, hWnd, IDC_EDIT
                invoke        SetFocus, eax
        .elseif        iMsg == WM_CLOSE
                invoke        EndDialog, hWnd, NULL
        .elseif iMsg == WM_COMMAND
                mov        eax,wParam
                mov        edx,eax
                shr        edx,16
               
                .if        dx == BN_CLICKED
                        .if        eax == IDC_EXIT
                                invoke        SendMessage, hWnd, WM_CLOSE, NULL, NULL
                        .elseif        eax == IDC_BUTTON
                                invoke SetDlgItemText, hWnd, IDC_EDIT, ADDR TestString
                        .endif
                .endif
        .else
                mov        eax,FALSE
                ret
        .endif
       
        mov        eax,TRUE
        ret
DlgProc endp

end start
上传的附件:
雪    币: 2108
活跃值: (21)
能力值: (RANK:260 )
在线值:
发帖
回帖
粉丝
书呆彭 6 2008-12-4 01:06
4
0
请看关于WNDCLASSEX结构中关于lpszClassName的说明。

lpszClassName
    Pointer to a null-terminated string or is an atom. If this parameter is an atom, it must be a class atom created by a previous call to the RegisterClass or RegisterClassEx function. The atom must be in the low-order word of lpszClassName; the high-order word must be zero.

    If lpszClassName is a string, it specifies the window class name. The class name can be any name registered with RegisterClass or RegisterClassEx, or any of the predefined control-class names.

    The maximum length for lpszClassName is 256. If lpszClassName is greater than the maximum length, the RegisterClassEx function will fail.

以及CreateWindow()函数关于lpClassName参数的说明。

lpClassName
    [in] Pointer to a null-terminated string or a class atom created by a previous call to the RegisterClass or RegisterClassEx function. The atom must be in the low-order word of lpClassName; the high-order word must be zero. If lpClassName is a string, it specifies the window class name. The class name can be any name registered with RegisterClass or RegisterClassEx, provided that the module that registers the class is also the module that creates the window. The class name can also be any of the predefined system class names.

你的WinID我没用过,我一般只用Spy++。

你贴出的代码中又没给出ClassName的内容,看看是不是代码就定义成ClassName ascii “#32770”了。
雪    币: 2108
活跃值: (21)
能力值: (RANK:260 )
在线值:
发帖
回帖
粉丝
书呆彭 6 2008-12-8 21:07
5
0
今天看书时看到了这个,特补充一下。

"#32770"其实是一个匿名窗口类,且它的Atom值是32770,但没有对应的字符串类名称。这是一个系统内建的类。它就是标准Win32对话框的窗口类。

所有Win32的对话框,其窗口类都是它,比如DialogBoxParam(),CreateDialog()等。另外,,MessageBox()弹出的消息框的窗口类也是它,用Spy++一看便知。

所以对于3楼贴出的代码,便明了了。你所查看到的是AboutDialog的类,自然是#32770无疑,而且不你图中的WinID也已经标名,这是个Dialog(Spy++同样也会提示)。而你自己用RegisterClassEx()注册的窗口类并通过CreateWindowEx()所创建的窗口,是程序的主窗口,而不是AboutDailog。用工具查看主窗口便得。
雪    币: 214
活跃值: (10)
能力值: ( LV2,RANK:10 )
在线值:
发帖
回帖
粉丝
magicfx 2008-12-9 02:13
6
0
能否请问书呆兄是哪一本书?
弟也来学习一下
雪    币: 2108
活跃值: (21)
能力值: (RANK:260 )
在线值:
发帖
回帖
粉丝
书呆彭 6 2008-12-9 20:20
7
0
是一本老书了,英文原名我看了一下,叫《Windows 95 : A Developer's Guide》,我看的是侯捷做译序的繁体版本,叫《Windows95程式设计指南》,译者叫李书良,在繁体版第101页中讲到了#32770这个类。

此书有正版的PDF电子档提供下载。可以到侯捷老师的网站上去找。繁体书看得很慢,不过正好有时间多思考了。

http://jjhou.csdn.net/

不知道为什么,我访问这个页面总出现乱码,需要手动设置页面编码为简体中文。
雪    币: 2108
活跃值: (21)
能力值: (RANK:260 )
在线值:
发帖
回帖
粉丝
书呆彭 6 2008-12-9 20:22
8
0
另外,我查了下MSDN,找到了classname的其它一些,资料,比如

Class        Description
ComboLBox        The class for the list box contained in a combo box.
DDEMLEvent        Windows NT/Windows 2000/Windows XP: The class for Dynamic Data Exchange Management Library (DDEML) events.
Message        Windows 2000/Windows XP: The class for a message-only window.
#32768        The class for a menu.
#32769        The class for the desktop window.
#32770        The class for a dialog box.
#32771        The class for the task switch window.
#32772        Windows NT/Windows 2000/Windows XP: The class for icon titles.

原文链接:http://msdn.microsoft.com/en-us/library/ms633574(VS.85).aspx
游客
登录 | 注册 方可回帖
返回