前言
在逆向算法扫描插件时, 遇到一个windows消息值在msdn中没有定义.
去查资料, 有个老外将全部windows消息值和消息名称定义都码好了:)
写个测试程序, 封装了一个接口, 从消息值得到消息名称.
工程下载点
记录
// ShowMsgName.cpp : Defines the entry point for the console application.
//
#include "stdafx.h"
#include <stdlib.h>
#include "WindowsMsgValueDefine.h"
int main(int argc, char* argv[])
{
long bInputValid = 1;
unsigned short wMsgValue = 0;
do {
printf("please input windows msg value(0~1023, other value quit program):");
scanf("%hd", &wMsgValue);
bInputValid = ((wMsgValue >= 0) && (wMsgValue <= 0x3ff));
if (bInputValid) {
printf("%s = %d
", GetMsgName(wMsgValue), wMsgValue);
}
} while (bInputValid);
system("pause");
return 0;
}
/** run result
please input windows msg value(0~1023, other value quit program):273
WM_COMMAND = 273
please input windows msg value(0~1023, other value quit program):111
<undefined> = 111
please input windows msg value(0~1023, other value quit program):268
WM_INTERIM = 268
please input windows msg value(0~1023, other value quit program):269
WM_IME_STARTCOMPOSITION = 269
please input windows msg value(0~1023, other value quit program):5555
请按任意键继续. . .
*/
// @file WindowsMsgValueDefine.h
// @brief define all windows message values
// e.g. #define WM_DEADCHAR 0x103
#ifndef __WINDOWS_MSG_VALUE_DEFINE_H__
#define __WINDOWS_MSG_VALUE_DEFINE_H__
#define WM_NULL 0000
#define WM_CREATE 0x01
#define WM_DESTROY 0x02
#define WM_MOVE 0x03
#define WM_SIZEWAIT 0x04
#define WM_SIZE 0x05
#define WM_ACTIVATE 0x06
#define WM_SETFOCUS 0x07
#define WM_KILLFOCUS 0x08
#define WM_SETVISIBLE 0x09
#define WM_ENABLE 0x0a
#define WM_SETREDRAW 0x0b
#define WM_SETTEXT 0x0c
#define WM_GETTEXT 0x0d
#define WM_GETTEXTLENGTH 0x0e
#define WM_PAINT 0x0f
#define WM_CLOSE 0x10
#define WM_QUERYENDSESSION 0x11
#define WM_QUIT 0x12
#define WM_QUERYOPEN 0x13
#define WM_ERASEBKGND 0x14
#define WM_SYSCOLORCHANGE 0x15
#define WM_ENDSESSION 0x16
#define WM_SYSTEMERROR 0x17
#define WM_SHOWWINDOW 0x18
#define WM_CTLCOLOR 0x19
#define WM_WININICHANGE 0x1a
#define WM_DEVMODECHANGE 0x1b
#define WM_ACTIVATEAPP 0x1c
#define WM_FONTCHANGE 0x1d
#define WM_TIMECHANGE 0x1e
#define WM_CANCELMODE 0x1f
#define WM_SETCURSOR 0x20
#define WM_MOUSEACTIVATE 0x21
#define WM_CHILDACTIVATE 0x22
#define WM_QUEUESYNC 0x23
#define WM_GETMINMAXINFO 0x24
#define WM_LOGOFF 0x25
#define WM_PAINTICON 0x26
#define WM_ICONERASEBKGND 0x27
#define WM_NEXTDLGCTL 0x28
#define WM_ALTTABACTIVE 0x29
#define WM_SPOOLERSTATUS 0x2a
#define WM_DRAWITEM 0x2b
#define WM_MEASUREITEM 0x2c
#define WM_DELETEITEM 0x2d
#define WM_VKEYTOITEM 0x2e
#define WM_CHARTOITEM 0x2f
#define WM_SETFONT 0x30
#define WM_GETFONT 0x31
#define WM_SETHOTKEY 0x32
#define WM_GETHOTKEY 0x33
#define WM_SHELLNOTIFY 0x34
#define WM_ISACTIVEICON 0x35
#define WM_QUERYPARKICON 0x36
#define WM_QUERYDRAGICON 0x37
#define WM_WINHELP 0x38
#define WM_COMPAREITEM 0x39
#define WM_FULLSCREEN 0x3a
#define WM_CLIENTSHUTDOWN 0x3b
#define WM_DDEMLEVENT 0x3c
#define WM_GETOBJECT 0x3d
#define WM_undefined_1 0x3e
#define WM_undefined_2 0x3f
#define WM_TESTING 0x40
#define WM_COMPACTING 0x41
#define WM_OTHERWINDOWCREATED 0x42
#define WM_OTHERWINDOWDESTROYED 0x43
#define WM_COMMNOTIFY 0x44
#define WM_undefined_3 0x45
#define WM_WINDOWPOSCHANGING 0x46
#define WM_WINDOWPOSCHANGED 0x47
#define WM_POWER 0x48
#define WM_COPYGLOBALDATA 0x49
#define WM_COPYDATA 0x4a
#define WM_CANCELJOURNAL 0x4b
#define WM_undefined_4 0x4c
#define WM_KEYF1 0x4d
#define WM_NOTIFY 0x4e
#define WM_ACCESS_WINDOW 0x4f
#define WM_INPUTLANGCHANGEREQUEST 0x50
#define WM_INPUTLANGCHANGE 0x51
#define WM_TCARD 0x52
#define WM_HELP 0x53
#define WM_USERCHANGED 0x54
#define WM_NOTIFYFORMAT 0x55
#define WM_undefined_5 0x56
#define WM_undefined_6 0x57
#define WM_undefined_7 0x58
#define WM_undefined_8 0x59
#define WM_undefined_9 0x5a
#define WM_undefined_10 0x5b
#define WM_undefined_11 0x5c
#define WM_undefined_12 0x5d
#define WM_undefined_13 0x5e
#define WM_undefined_14 0x5f
#define WM_undefined_15 0x60
#define WM_undefined_16 0x61
#define WM_undefined_17 0x62
#define WM_undefined_18 0x63
#define WM_undefined_19 0x64
#define WM_undefined_20 0x65
#define WM_undefined_21 0x66
#define WM_undefined_22 0x67
#define WM_undefined_23 0x68
#define WM_undefined_24 0x69
#define WM_undefined_25 0x6a
#define WM_undefined_26 0x6b
#define WM_undefined_27 0x6c
#define WM_undefined_28 0x6d
#define WM_undefined_29 0x6e
#define WM_undefined_30 0x6f
#define WM_FINALDESTROY 0x70
#define WM_MEASUREITEM_CLIENTDATA 0x71
#define WM_undefined_31 0x72
#define WM_undefined_32 0x73
#define WM_undefined_33 0x74
#define WM_undefined_34 0x75
#define WM_undefined_35 0x76
#define WM_undefined_36 0x77
#define WM_undefined_37 0x78
#define WM_undefined_38 0x79
#define WM_undefined_39 0x7a
#define WM_CONTEXTMENU 0x7b
#define WM_STYLECHANGING 0x7c
#define WM_STYLECHANGED 0x7d
#define WM_DISPLAYCHANGE 0x7e
#define WM_GETICON 0x7f
#define WM_SETICON 0x80
#define WM_NCCREATE 0x81
#define WM_NCDESTROY 0x82
#define WM_NCCALCSIZE 0x83
#define WM_NCHITTEST 0x84
#define WM_NCPAINT 0x85
#define WM_NCACTIVATE 0x86
#define WM_GETDLGCODE 0x87
#define WM_SYNCPAINT 0x88
#define WM_SYNCTASK 0x89
#define WM_undefined_40 0x8a
#define WM_KLUDGEMINRECT 0x8b
#define WM_LPKDRAWSWITCHWND 0x8c
#define WM_undefined_41 0x8d
#define WM_undefined_42 0x8e
#define WM_undefined_43 0x8f
#define WM_UAHDESTROYWINDOW 0x90
#define WM_UAHDRAWMENU 0x91
#define WM_UAHDRAWMENUITEM 0x92
#define WM_UAHINITMENU 0x93
#define WM_UAHMEASUREMENUITEM 0x94
#define WM_UAHNCPAINTMENUPOPUP 0x95
#define WM_UAHUPDATE 0x96
#define WM_undefined_44 0x97
#define WM_undefined_45 0x98
#define WM_undefined_46 0x99
#define WM_undefined_47 0x9a
#define WM_undefined_48 0x9b
#define WM_undefined_49 0x9c
#define WM_undefined_50 0x9d
#define WM_undefined_51 0x9e
#define WM_undefined_52 0x9f
#define WM_NCMOUSEMOVE 0xa0
#define WM_NCLBUTTONDOWN 0xa1
#define WM_NCLBUTTONUP 0xa2
#define WM_NCLBUTTONDBLCLK 0xa3
#define WM_NCRBUTTONDOWN 0xa4
#define WM_NCRBUTTONUP 0xa5
#define WM_NCRBUTTONDBLCLK 0xa6
#define WM_NCMBUTTONDOWN 0xa7
#define WM_NCMBUTTONUP 0xa8
#define WM_NCMBUTTONDBLCLK 0xa9
#define WM_undefined_53 0xaa
#define WM_NCXBUTTONDOWN 0xab
#define WM_NCXBUTTONUP 0xac
#define WM_NCXBUTTONDBLCLK 0xad
#define WM_NCUAHDRAWCAPTION 0xae
#define WM_NCUAHDRAWFRAME 0xaf
#define EM_GETSEL 0xb0
#define EM_SETSEL 0xb1
#define EM_GETRECT 0xb2
#define EM_SETRECT 0xb3
#define EM_SETRECTNP 0xb4
#define EM_SCROLL 0xb5
#define EM_LINESCROLL 0xb6
#define EM_SCROLLCARET 0xb7
#define EM_GETMODIFY 0xb8
#define EM_SETMODIFY 0xb9
#define EM_GETLINECOUNT 0xba
#define EM_LINEINDEX 0xbb
#define EM_SETHANDLE 0xbc
#define EM_GETHANDLE 0xbd
#define EM_GETTHUMB 0xbe
#define WM_undefined_54 0xbf
#define WM_undefined_55 0xc0
#define EM_LINELENGTH 0xc1
#define EM_REPLACESEL 0xc2
#define EM_SETFONT 0xc3
#define EM_GETLINE 0xc4
#define EM_LIMITTEXT 0xc5
#define EM_CANUNDO 0xc6
#define EM_UNDO 0xc7
#define EM_FMTLINES 0xc8
#define EM_LINEFROMCHAR 0xc9
#define EM_SETWORDBREAK 0xca
#define EM_SETTABSTOPS 0xcb
#define EM_SETPASSWORDCHAR 0xcc
#define EM_EMPTYUNDOBUFFER 0xcd
#define EM_GETFIRSTVISIBLELINE 0xce
#define EM_SETREADONLY 0xcf
#define EM_SETWORDBREAKPROC 0xd0
#define EM_GETWORDBREAKPROC 0xd1
#define EM_GETPASSWORDCHAR 0xd2
#define EM_SETMARGINS 0xd3
#define EM_GETMARGINS 0xd4
#define EM_GETLIMITTEXT 0xd5
#define EM_POSFROMCHAR 0xd6
#define EM_CHARFROMPOS 0xd7
#define EM_SETIMESTATUS 0xd8
#define EM_GETIMESTATUS 0xd9
#define EM_MSGMAX 0xda
#define WM_undefined_56 0xdb
#define WM_undefined_57 0xdc
#define WM_undefined_58 0xdd
#define WM_undefined_59 0xde
#define WM_undefined_60 0xdf
#define WM_undefined_61 0xe0
#define WM_undefined_62 0xe1
#define WM_undefined_63 0xe2
#define WM_undefined_64 0xe3
#define WM_undefined_65 0xe4
#define WM_undefined_66 0xe5
#define WM_undefined_67 0xe6
#define WM_undefined_68 0xe7
#define WM_undefined_69 0xe8
#define WM_undefined_70 0xe9
#define WM_undefined_71 0xea
#define WM_undefined_72 0xeb
#define WM_undefined_73 0xec
#define WM_undefined_74 0xed
#define WM_undefined_75 0xee
#define WM_undefined_76 0xef
#define WM_undefined_77 0xf0