ÓÑÇéÌáʾ£ºÈç¹û±¾ÍøÒ³´ò¿ªÌ«Âý»òÏÔʾ²»ÍêÕû£¬Çë³¢ÊÔÊó±êÓÒ¼ü¡°Ë¢Ð¡±±¾ÍøÒ³£¡
ºÏ×âС˵Íø ·µ»Ø±¾ÊéĿ¼ ¼ÓÈëÊéÇ© ÎÒµÄÊé¼Ü ÎÒµÄÊéÇ© TXTÈ«±¾ÏÂÔØ ¡ºÊղص½ÎÒµÄä¯ÀÀÆ÷¡»

windows»·¾³ÏÂ32λ»ã±àÓïÑÔ³ÌÐòÉè¼Æ-µÚ5²¿·Ö

¿ì½Ý²Ù×÷: °´¼üÅÌÉÏ·½Ïò¼ü ¡û »ò ¡ú ¿É¿ìËÙÉÏÏ·­Ò³ °´¼üÅÌÉ쵀 Enter ¼ü¿É»Øµ½±¾ÊéĿ¼ҳ °´¼üÅÌÉÏ·½Ïò¼ü ¡ü ¿É»Øµ½±¾Ò³¶¥²¿! Èç¹û±¾ÊéûÓÐÔĶÁÍ꣬ÏëÏ´μÌÐø½Ó×ÅÔĶÁ£¬¿ÉʹÓÃÉÏ·½ "Êղص½ÎÒµÄä¯ÀÀÆ÷" ¹¦ÄÜ ºÍ "¼ÓÈëÊéÇ©" ¹¦ÄÜ£¡


ö×Ö½Ú²»ÊÇ7Âð£¬ÎªÊ²Ã´ÊÇ8ÄØ£¿ÕâÊÇÒòΪÔÚ80386´¦ÀíÆ÷ÖУ¬ÒÔdwordΪ½ç¶ÔÆëʱ´æÈ¡ÄÚ´æËÙ¶È×î¿ì£¬ËùÒÔMASMÄþ¿ÉÀË·ÑÒ»¸ö×Ö½Ú£¬Ö´ÐÐÁËÕâ3¾äÖ¸Áîºó£¬³õʼ»¯Íê³É£¬¾Í¿ÉÒÔ½øÐÐÕý³£µÄ²Ù×÷ÁË£¬´ÓÖ¸ÁîÖпÉÒÔ¿´³ö¾Ö²¿±äÁ¿ÔÚ¶ÑÕ»ÖеÄλÖÃÅÅÁУ¬Èç±í3¡£3Ëùʾ¡£

±í3¡£3¡¡¡¡ÉÏÀýÖоֲ¿±äÁ¿ÅÅÁеÄ˳Ðò

ebpÆ«ÒÆ¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ÄÚ¡¡¡¡¡¡¡¡ÈÝ
¡¡
ebp£«4
¡¡ÓÉcallÍÆÈëµÄ·µ»ØµØÖ·
¡¡
Ebp
¡¡push¡¡ebpÖ¸ÁîÍÆÈëµÄÔ­ebpÖµ£¬È»ºóеÄebp=ÏÖÔÚµÄesp
¡¡
ebp¡­4
¡¡µÚÒ»¸ö¾Ö²¿±äÁ¿
¡¡
ebp¡­6
¡¡µÚ¶þ¸ö¾Ö²¿±äÁ¿
¡¡
ebp¡­7
¡¡µÚÈý¸ö¾Ö²¿±äÁ¿
¡¡

ÔÚ³ÌÐòÍ˳öµÄʱºò£¬±ØÐë°ÑÕýÈ·µÄespÉèÖûØÈ¥£¬·ñÔò£¬retÖ¸Áî»á´Ó¶ÑÕ»ÖÐÈ¡³ö´íÎóµÄµØÖ··µ»Ø£¬¿´³ÌÐò¿ÉÒÔ·¢ÏÖ£¬ebp¾ÍÊÇÕýÈ·µÄespÖµ£¬ÒòΪ×Ó³ÌÐò¿ªÊ¼µÄʱºòÒѾ­ÓÐÒ»¾ämov¡¡ebp£»esp£¬ËùÒÔÒª·µ»ØµÄʱºòÖ»ÒªÏÈmov¡¡esp£»ebp£¬È»ºóÔÙpop¡¡ebp£¬¶ÑÕ»¾ÍÊÇÕýÈ·µÄÁË¡£

ÔÚ80386Ö¸ÁÖÐÓÐÒ»ÌõÖ¸Áî¿ÉÒÔÔÚÒ»¾äÖÐʵÏÖÕâ¸ö¹¦ÄÜ£¬¾ÍÊÇleaveÖ¸ÁËùÒÔ£¬±àÒëÆ÷ÔÚretÖ¸Áî֮ǰֻʹÓÃÁËÒ»¾äleaveÖ¸Áî¡£

Ã÷°×Á˾ֲ¿±äÁ¿Ê¹ÓõÄÔ­Àí£¬¾ÍºÜÈÝÒ×Àí½âʹÓÃʱµÄ×¢Òâµã£ºebp¼Ä´æÆ÷Êǹؼü£¬ËüÆðµ½±£´æԭʼespµÄ×÷Ó㬲¢ËæʱÓÃ×ö´æÈ¡¾Ö²¿±äÁ¿µÄÖ¸Õë»ùÖ·£¬ËùÒÔÔÚÈκÎʱ¿Ì£¬²»Òª³¢ÊÔ°ÑebpÓÃÓÚ±ðµÄÓÃ;£¬·ñÔò»á´øÀ´ÒâÏë²»µ½µÄºó¹û¡£

Win32»ã±àÖоֲ¿±äÁ¿µÄʹÓ÷½·¨¿ÉÒÔ½âÊÍÒ»¸öºÜÓÐȤµÄÏÖÏó£ºÔÚDOS»ã±àµÄʱºò£¬Èç¹ûÔÚ×Ó³ÌÐòÖеÄpushÖ¸ÁîºÍpopÖ¸Áî²»Åä¶Ô£¬ÄÇô·µ»ØµÄʱºòretÖ¸Áî´Ó¶ÑÕ»ÀïµÃµ½µÄ¿Ï¶¨ÊÇ´íÎóµÄ·µ»ØµØÖ·£¬³ÌÐòÒ²¾ÍËÀµôÁË¡£µ«ÔÚWin32»ã±àÖУ¬pushÖ¸ÁîºÍpopÖ¸Áî²»Åä¶Ô¿ÉÄÜÔÚÂß¼­ÉϲúÉú´íÎó£¬È´²»»áÓ°Ïì×Ó³ÌÐòÕý³£·µ»Ø£¬Ô­Òò¾ÍÊÇÔÚ·µ»ØµÄʱºòesp²»ÊÇ¿¿ÏàͬÊýÁ¿µÄpushºÍpopÖ¸ÁîÀ´±£³ÖÒ»Öµģ¬¶øÊÇ¿¿leaveÖ¸Áî´Ó±£´æÔÚebpÖеÄԭʼֵÖÐÈ¡»ØÀ´µÄ£¬Ò²¾ÍÊÇ˵£¬¼´Ê¹°Ñesp¸ÄµÃÒ»ËúºýÍ¿Ò²²»»áÓ°Ïìµ½×Ó³ÌÐòµÄ·µ»Ø£¬µ±È»£¬¡°ÇÏÃÅ¡±¾ÍÔÚebp£¬°Ñebp¸Äµô£¬³ÌÐò¾ÍÍæÍêÁË£¡

2¡£¡¡¾Ö²¿±äÁ¿µÄ³õʼ»¯Öµ

ÏÔÈ»£¬¾Ö²¿±äÁ¿ÊÇÎÞ·¨ÔÚ¶¨ÒåµÄʱºòÖ¸¶¨³õʼ»¯ÖµµÄ£¬ÒòΪlocalαָÁîÖ»ÊǼòµ¥µØ°Ñ¿Õ¼ä¸øÁô³öÀ´£¬ÄÇô¿ªÊ¼Ê¹ÓÃʱËüÀïÃæÊÇʲôֵÄØ£¿ºÍÈ«¾Ö±äÁ¿²»Ò»Ñù£¬¾Ö²¿±äÁ¿µÄÆðʼֵÊÇËæ»úµÄ£¬ÊÇÆäËû×Ó³ÌÐòÖ´ÐкóÔÚ¶ÑÕ»ÀïÁôϵÄÀ¬»ø£¬ËùÒÔ£¬¶Ô¾Ö²¿±äÁ¿µÄÖµÒ»¶¨Òª³õʼ»¯£¬ÌرðÊǶ¨ÒåΪ½á¹¹ºóµ±²ÎÊý´«µÝ¸øAPIº¯ÊýµÄʱºò¡£

¡¡ÔÚAPIº¯ÊýʹÓõĴóÁ¿Êý¾Ý½á¹¹ÖУ¬ÍùÍùÓÃ0×öĬÈÏÖµ£¬Èç¹ûÓþֲ¿±äÁ¿¶¨ÒåÊý¾Ý½á¹¹£¬³õʼ»¯Ê±Ö»¶¨ÒåÁËÆäÖеÄһЩ×ֶΣ¬ÄÇôÆäÓà×ֶεĵ±Ç°Öµ¿ÉÒÔÊDZà³ÌÕßÔ¤Ïë²»µ½µÄÊýÖµ£¬´«¸øAPIº¯Êýºó£¬Ö´ÐеĽá¹û¿ÉÄÜÊÇÒâÏë²»µ½µÄ£¬ÕâÊdzõѧÕߺÜÈÝÒ׺öÂÔµÄÒ»¸öÎÊÌâ¡£ËùÒÔ×îºÃµÄ°ì·¨ÊÇ£ºÔÚ¸³ÖµÇ°Ê×ÏȽ«Õû¸öÊý¾Ý½á¹¹Ìî0£¬È»ºóÔÙ³õʼ»¯ÒªÓõÄ×ֶΣ¬ÕâÑùÆäÓàµÄ×ֶξͲ»±ØÒ»¸ö¸öµØÈ¥Ìî0ÁË£¬RtlZeroMemoryÕâ¸öAPIº¯Êý¾ÍÊÇʵÏÖÌî0µÄ¹¦Äܵġ£



¡¡
À´Ô´£ºµç×Ó¹¤Òµ³ö°æÉç¡¡×÷ÕߣºÂÞÔƱò¡¡ÉÏÒ»Ò³¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡»ØÊéÄ¿¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ÏÂÒ»Ò³¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
ÉÏÒ»Ò³¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡»ØÊéÄ¿¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ÏÂÒ»Ò³¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
¡¡¡¡


µÚ3Õ¡¡Ê¹ÓÃMASM


3¡£3¡¡±êºÅ¡¢±äÁ¿ºÍÊý¾Ý½á¹¹£¨3£©

¡¡¡¡¡¡¡¡
3¡£3¡£4¡¡¡¡Êý¾Ý½á¹¹

Êý¾Ý½á¹¹Êµ¼ÊÉÏÊÇÓɶà¸ö×Ö¶Î×é³ÉµÄÊý¾Ý¡°Ñù°å¡±£¬Ï൱ÓÚÒ»ÖÖ×Ô¶¨ÒåµÄÊý¾ÝÀàÐÍ£¬Êý¾Ý½á¹¹ÖмäµÄÿһ¸ö×ֶοÉÒÔÊÇ×Ö½Ú¡¢×Ö¡¢Ë«×Ö¡¢×Ö·û´®»òËùÓпÉÄܵÄÊý¾ÝÀàÐÍ¡£±ÈÈçÔÚAPIº¯ÊýRegisterClassÖÐҪʹÓõ½Ò»¸ö½Ð×öWNDCLASSµÄÊý¾Ý½á¹¹£¬MicrosoftµÄÊÖ²áÉÏÊÇÈç϶¨ÒåµÄ£º

typedef¡¡struct¡¡_WNDCLASS¡¡£û

¡¡¡¡¡¡¡¡UINT¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡style£»

¡¡¡¡¡¡¡¡WNDPROC¡¡¡¡¡¡¡¡¡¡¡¡lpfnWndProc£»

¡¡¡¡¡¡¡¡Int¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡cbClsExtra£»

¡¡¡¡¡¡¡¡int¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡cbWndExtra£»

¡¡¡¡¡¡¡¡HINSTANCE¡¡¡¡¡¡¡¡hInstance£»

¡¡¡¡¡¡¡¡HICON¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡hIcon£»

¡¡¡¡¡¡¡¡HCURSOR¡¡¡¡¡¡¡¡¡¡¡¡hCursor£»

¡¡¡¡¡¡¡¡HBRUSH¡¡¡¡¡¡¡¡¡¡¡¡¡¡hbrBackground£»

¡¡¡¡¡¡¡¡LPCTSTR¡¡¡¡¡¡¡¡¡¡¡¡lpszMenuName£»

¡¡¡¡¡¡¡¡LPCTSTR¡¡¡¡¡¡¡¡¡¡¡¡lpszClassName£»

£ý¡¡WNDCLASS£»¡¡*PWNDCLASS£»

×¢Ò⣬ÕâÊÇCÓïÑÔ¸ñʽµÄ£¬Õâ¸öÊý¾Ý½á¹¹°üº¬ÁË10¸ö×ֶΣ¬×ֶεÄÃû³ÆÊÇstyle£¬lpfnWndProcºÍcbClsExtraµÈ£¬Ç°ÃæµÄUINTºÍWNDPROCµÈÊÇÕâЩ×ֶεÄÀàÐÍ£¬ÔÚ»ã±àÖУ¬Êý¾Ý½á¹¹µÄд·¨ÈçÏ£º

½á¹¹Ãû¡¡¡¡¡¡¡¡struct

¡¡

×Ö¶Î1¡¡¡¡¡¡¡¡ÀàÐÍ¡¡¡¡¡¡¡¡¡¡¡¡£¿

×Ö¶Î2¡¡¡¡¡¡¡¡ÀàÐÍ¡¡¡¡¡¡¡¡¡¡¡¡£¿

¡­¡­

¡¡

½á¹¹Ãû¡¡¡¡¡¡¡¡ends

ÉÏÃæµÄWNDCLASS½á¹¹¶¨ÒåÓûã±àµÄ¸ñʽÀ´±íʾ¾ÍÊÇ£º

WNDCLASS¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡struct

¡¡

Style¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡DWORD¡¡¡¡¡¡¡¡¡¡¡¡£¿

LpfnWndProc¡¡¡¡¡¡¡¡¡¡DWORD¡¡¡¡¡¡¡¡¡¡¡¡£¿

cbClsExtra¡¡¡¡¡¡¡¡¡¡¡¡DWORD¡¡¡¡¡¡¡¡¡¡¡¡£¿

cbWndExtra¡¡¡¡¡¡¡¡¡¡¡¡DWORD¡¡¡¡¡¡¡¡¡¡¡¡£¿

hInstance¡¡¡¡¡¡¡¡¡¡¡¡¡¡DWORD¡¡¡¡¡¡¡¡¡¡¡¡£¿

hIcon¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡DWORD¡¡¡¡¡¡¡¡¡¡¡¡£¿

hCursor¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡DWORD¡¡¡¡¡¡¡¡¡¡¡¡£¿

hbrBackground¡¡¡¡¡¡DWORD¡¡¡¡¡¡¡¡¡¡¡¡£¿

lpszMenuName¡¡¡¡¡¡¡¡DWORD¡¡¡¡¡¡¡¡¡¡¡¡£¿

lpszClassName¡¡¡¡¡¡DWORD¡¡¡¡¡¡¡¡¡¡¡¡£¿

¡¡

WNDCLASS¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ends

ºÍ´ó²¿·ÖµÄ³£Á¿Ò»Ñù£¬¼¸ºõËùÓÐAPIËùÉæ¼°µÄÊý¾Ý½á¹¹ÔÚWindows¡£incÎļþÖж¼ÒѾ­Óж¨ÒåÁË¡£Òª×¢ÒâµÄÊÇ£¬¶¨ÒåÁËÊý¾Ý½á¹¹Êµ¼ÊÉÏÖ»ÊǶ¨ÒåÁËÒ»¸ö¡°Ñù°å¡±£¬ÉÏÃæµÄ¶¨ÒåÓï¾ä²¢²»»áÔÚÄĸö¶ÎÖвúÉúÊý¾Ý£¬ºÍWordÖÐʹÓø÷ÖÖ¡°ÐÅÖ½¡±Óë¡°ÎÄÊ顱µÈÄ£°åÀàËÆ£¬¶¨ÒåÁËÊý¾Ý½á¹¹ÒÔºó¾Í¿ÉÒÔ¶à´ÎÔÚÔ´³ÌÐòÖÐÓÃÕâ¸ö¡°Ñù°å¡±µ±×öÊý¾ÝÀàÐÍÀ´¶¨ÒåÊý¾Ý£¬Ê¹ÓÃÊý¾Ý½á¹¹ÔÚÊý¾Ý¶ÎÖж¨ÒåÊý¾ÝµÄ·½·¨ÈçÏ£º

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡£data£¿

stWndClass¡¡¡¡¡¡¡¡¡¡¡¡WNDCLASS¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡­

»òÕߣº

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡£data

stWndClass¡¡¡¡¡¡¡¡¡¡¡¡WNDCLASS¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡­¡­

Õâ¸öÀý×Ó¶¨ÒåÁËÒ»¸öÒÔWNDCLASSΪ½á¹¹µÄ±äÁ¿stWndClass£¬µÚÒ»¶ÎµÄ¶¨Òå·½·¨ÊÇδ³õʼ»¯µÄ¶¨Òå·½·¨£¬µÚ¶þ¶ÎÊÇÔÚ¶¨ÒåµÄͬʱָ¶¨½á¹¹Öи÷×ֶεijõʼֵ£¬¸÷×ֶεijõʼֵÓöººÅ¸ô¿ª£¬ÔÚÕâ¸öÀý×ÓÖÐ10¸ö×ֶεijõʼֵ¶¼Ö¸¶¨Îª1¡£

ÔÚ»ã±àÖУ¬Êý¾Ý½á¹¹µÄÒýÓ÷½·¨Óкü¸ÖÖ£¬ÒÔÉÏÃæµÄ¶¨ÒåΪÀý£¬Èç¹ûҪʹÓÃstWndClassÖеÄlpfnWndProc×ֶΣ¬×îÖ±½ÓµÄ°ì·¨ÊÇ£º

mov¡¡¡¡¡¡¡¡¡¡eax£»stWndClass¡£lpfnWndProc

Ëü±íʾ°ÑlpfnWndProc×ֶεÄÖµ·ÅÈëeaxÖÐÈ¥£¬¼ÙÉèstWndClassÔÚÄÚ´æÖеĵØÖ·ÊÇ403000h£¬Õâ¾äÖ¸Áî»á±»±àÒë³Émov¡¡eax£»£§403004h£§£¬ÒòΪlpfnWndProcÊÇstWndClassÖеĵڶþ¸ö×ֶΣ¬µÚÒ»¸ö×Ö¶ÎÊÇdword£¬ÒѾ­Õ¼ÓÃÁË4×ֽڵĿռ䡣

ÔÚʵ¼ÊʹÓÃÖУ¬³£³£ÓÐʹÓÃÖ¸Õë´æÈ¡Êý¾Ý½á¹¹µÄÇé¿ö£¬Èç¹ûʹÓÃesi¼Ä´æÆ÷×öÖ¸ÕëÑ°Ö·£¬¿ÉÒÔʹÓÃÏÂÁÐÓï¾äÍê³ÉͬÑùµÄ¹¦ÄÜ£º

mov¡¡¡¡¡¡¡¡¡¡esi£»offset¡¡stWndClass

mov¡¡¡¡¡¡¡¡¡¡eax£»£§esi¡¡£«¡¡WNDCLASS¡£lpfnWndProc£§

×¢Ò⣺µÚ¶þ¾äÊÇ£§esi¡¡£«¡¡WNDCLASS¡£lpfnWndProc£§¶ø²»ÊÇ£§esi¡¡£«¡¡stWndClass¡£lpfnWndProc£§£¬ÒòΪǰÕ߻ᱻ±àÒë³Émov¡¡eax£»£§esi£«4£§£¬¶øºóÕ߻ᱻ±àÒë³Émov¡¡eax£»£§esi£«403004h£§£¬ºóÕߵĽá¹ûÏÔÈ»ÊÇ´íÎóµÄ£¡Èç¹ûÒª¶ÔÒ»¸öÊý¾Ý½á¹¹ÖеĴóÁ¿×ֶνøÐвÙ×÷£¬ÕâÖÖд·¨ÏÔÈ»±È½Ï·³Ëö£¬MASM»¹ÓÐÒ»¸öÓ÷¨£¬¿ÉÒÔÓÃassumeαָÁî°Ñ¼Ä´æÆ÷Ô¤Ïȶ¨ÒåΪ½á¹¹Ö¸Õ룬ÔÙ½øÐвÙ×÷£º

mov¡¡¡¡¡¡¡¡¡¡esi£»offset¡¡stWndClass

assume¡¡¡¡esi£ºptr¡¡WNDCLASS

mov¡¡¡¡¡¡¡¡¡¡eax£»£§esi£§¡£lpfnWndProc

¡­

assume¡¡¡¡esi£ºnothing

ÕâÑù£¬Ê¹ÓüĴæÆ÷Ò²¿ÉÒÔÓöºµãÒýÓÃ×Ö¶ÎÃû£¬³ÌÐòµÄ¿É¶ÁÐԱȽϺá£ÕâÑùµÄд·¨ÔÚ×îºó±àÒë³É¿ÉÖ´ÐгÌÐòµÄʱºò²úÉúͬÑùµÄ´úÂë¡£×¢Ò⣺ÔÚ²»ÔÙʹÓÃesi¼Ä´æÆ÷×öÖ¸ÕëµÄʱºòÒªÓÃassume¡¡esi£ºnothingÈ¡Ïû¶¨Òå¡£

½á¹¹µÄ¶¨ÒåÒ²¿ÉÒÔǶÌ×£¬Èç¹ûÒª¶¨ÒåÒ»¸öеÄNEW_WNDCLASS½á¹¹£¬ÀïÃæ°üº¬Ò»¸öÀϵÄWNDCLASS½á¹¹ºÍÒ»¸öеÄdwOption×ֶΣ¬ÄÇô¿ÉÒÔÈç϶¨Ò壺

NEW_WNDCLASS¡¡¡¡¡¡¡¡¡¡struct

¡¡

DwOption¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡dword¡¡¡¡¡¡¡¡¡¡£¿

OldWndClass¡¡¡¡¡¡¡¡¡¡¡¡WNDCLASS¡¡¡¡

¡¡

NEW_WNDCLASS¡¡¡¡¡¡¡¡¡¡ends

¼ÙÉèÏÖÔÚesiÊÇÖ¸ÏòÒ»¸öNEW_WNDCLASSµÄÖ¸Õ룬ÄÇôÒýÓÃÀïÃæǶÌ×µÄoldWndClassÖеÄlpfnWndProc×Ö¶Îʱ£¬¾Í¿ÉÒÔÓÃÏÂÃæµÄÓï¾ä£º

mov¡¡¡¡¡¡¡¡¡¡eax£»£§esi£§¡£oldWndClass¡£lpfnWndProc

½á¹¹µÄǶÌ×ÔÚWindowsµÄÊý¾Ý¶¨ÒåÖÐÒ²³£ÓУ¬±ÈÈçÔÚµÚ13ÕÂ13¡£3½ÚÖÐʹÓõÄDEBUG_EVENT½á¹¹Öо¹È»Ê¹ÓÃÁË4²ãÊý¾Ý½á¹¹µÄǶÌס£¡¡ÊìÁ·ÕÆÎÕÊý¾Ý½á¹¹µÄʹÓöÔWin32»ã±à±à³ÌÊǺÜÖØÒªµÄ£¡



¡¡
À´Ô´£ºµç×Ó¹¤Òµ³ö°æÉç¡¡×÷ÕߣºÂÞÔƱò¡¡ÉÏÒ»Ò³¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡»ØÊéÄ¿¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ÏÂÒ»Ò³¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
ÉÏÒ»Ò³¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡»ØÊéÄ¿¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ÏÂÒ»Ò³¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡
¡¡¡¡


µÚ3Õ¡¡Ê¹ÓÃMASM


3¡£3¡¡±êºÅ¡¢±äÁ¿ºÍÊý¾Ý½á¹¹£¨4£©

¡¡¡¡¡¡¡¡
3¡£3¡£5¡¡¡¡±äÁ¿µÄʹÓÃ

1¡£¡¡ÒÔ²»Í¬µÄÀàÐÍ·ÃÎʱäÁ¿

Õâ¸ö»°ÌâÓеãÏñCÓïÑÔÖеÄÊý¾ÝÀàÐÍÇ¿ÖÆת»»£¬CÓïÑÔÖеÄÀàÐÍת»»Ö¸µÄÊÇ°ÑÒ»¸ö±äÁ¿µÄÄÚÈÝת»»³ÉÁíÍâÒ»ÖÖÀàÐÍ£¬×ª»»¹ý³ÌÖУ¬Êý¾ÝµÄÄÚÈÝÒѾ­·¢ÉúÁ˱仯£¬Èç°Ñ¸¡µãÊýת»»³ÉÕûÊýºó£¬Ð¡ÊýµãºóµÄÄÚÈݾͶªÊ§ÁË¡£ÔÚMASMÖÐÒÔ²»Í¬µÄÀàÐÍ·ÃÎʲ»»á¶Ô±äÁ¿Ôì³ÉÓ°Ïì¡£

¾ÙÒ»¸ö¼òµ¥µÄÀý×Ó£¬ÏÈÒÔdb·½Ê½¶¨ÒåÒ»¸ö»º³åÇø£º

szBuffer¡¡¡¡¡¡¡¡db¡¡¡¡¡¡¡¡¡¡¡¡1024¡¡dup¡¡£¨£¿£©

È»ºó´ÓÆäËûµØ·½È¡µÃÁËÊý¾Ý£¬µ«Êý¾ÝµÄ¸ñʽÊÇÒÔ×Ö·½Ê½×éÖ¯µÄ£¬Òª´¦ÀíÊý¾Ý£¬×îÓÐЧµÄ·½·¨ÊÇÁ½¸ö×Ö½ÚÁ½¸ö×ֽڵش¦Àí£¬µ«Èç¹ûÔÚ³ÌÐòÖаÑszBufferµÄÖµ·ÅÈëax£º

mov¡¡¡¡¡¡¡¡¡¡ax£»szBuffer

±àÒëÆ÷»á±¨Ò»¸ö´í£º

error¡¡A2070£º¡¡invalid¡¡instruction¡¡operands

Òâ˼ÊÇÎÞЧµÄÖ¸Áî²Ù×÷£¬ÎªÊ²Ã´ÄØ£¿ÒòΪszBufferÊÇÓÃdb¶¨ÒåµÄ£¬¶øaxµÄ³ß´çÊÇÒ»¸öword£¬µÈÓÚÁ½¸ö×Ö½Ú£¬³ß´ç²»·ûºÏ¡£MASMÖУ¬Èç¹ûÒªÓÃÖ¸¶¨ÀàÐÍÖ®ÍâµÄ³¤¶È·ÃÎʱäÁ¿£¬±ØÐëÏÔʽµØÖ¸³öÒª·ÃÎʵij¤¶È£¬ÕâÑù£¬±àÒëÆ÷ºöÂÔÓï·¨Éϵij¤¶È¼ìÑ飬½öʹÓñäÁ¿µÄµØÖ·¡£Ê¹Óõķ½·¨ÊÇ£º

ÀàÐÍ¡¡ptr¡¡±äÁ¿Ãû

ÀàÐÍ¿ÉÒÔÊÇbyte£¬word£¬dword£¬fword£¬qword£¬real8ºÍreal10¡£È磺

mov¡¡¡¡¡¡¡¡¡¡ax£»word¡¡ptr¡¡szBuffer

mov¡¡¡¡¡¡¡¡¡¡eax£»dword¡¡ptr¡¡szBuffer

ÉÏÊöÓï¾äÄÜͨ¹ý±àÒ룬µ±È»£¬ÀàÐͱØÐëºÍ²Ù×÷µÄ¼Ä´æÆ÷³¤¶ÈÆ¥Åä¡£ÔÚÕâÀïҪעÒâµÄÊÇ£¬Ö¸¶¨ÀàÐ͵IJÎÊý·ÃÎʲ¢²»»áÈ¥¼ì²â³¤¶ÈÊÇ·ñÒç³ö£¬¿´ÏÂÃæÒ»¶Î´úÂ룺

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡£data

bTest1¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡db¡¡¡¡¡¡¡¡¡¡¡¡12h

wTest2¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡dw¡¡¡¡¡¡¡¡¡¡¡¡1234h

dwTest3¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡dd¡¡¡¡¡¡¡¡¡¡¡¡12345678h

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡­

¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡de

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡­

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡mov¡¡¡¡¡¡¡¡¡¡al£»bTest1

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡mov¡¡¡¡¡¡¡¡¡¡ax£»word¡¡ptr¡¡bTest1

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡mov¡¡¡¡¡¡¡¡¡¡eax£»dword¡¡ptr¡¡bTest1

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡­

ÉÏÃæµÄ³ÌÐòƬ¶Ï£¬Ã¿Ò»¾äÖ´Ðкó¼Ä´æÆ÷ÖеÄÖµÊÇʲôÄØ£¬mov¡¡al£»bTest1ÕâÒ»¾äºÜÏÔȻʹalµÈÓÚ12h£¬ÏÂÃæµÄÁ½¾äÄØ£¬axºÍeaxÄѵÀµÈÓÚ0012hºÍ00000012hÂð£¿Êµ¼ÊÔËÐнá¹ûºÜ¡°Ææ¹Ö¡±£¬¾¹È»ÊÇ3412hºÍ78123412h£¬ÎªÊ²Ã´ÄØ£¿ÏÈÀ´¿´·´»ã±àµÄÄÚÈÝ£º

£»¡£data¶ÎÖеıäÁ¿

£º00403000¡¡12¡¡34¡¡12¡¡78¡¡56¡¡34¡¡12¡¡¡£¡£¡£¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡©¦¡¡¡¡¡¡©¦¡¡¡¡¡¡¡¡¡¡©¦

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡©¦¡¡¡¡¡¡©¦¡¡¡¡¡¡¡¡¡¡©¸©¤¡ú¡¡dwTest3

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡©¦¡¡¡¡¡¡©¸©¤©¤©¤©¤©¤©¤¡ú¡¡wTest2

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡©¸©¤©¤©¤©¤©¤©¤©¤©¤©¤¡ú¡¡¡¡¡¡¡¡bTest1

¡¡

£»de¶ÎÖеĴúÂë

£º00401000¡¡A000304000¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡mov¡¡al£»¡¡byte¡¡ptr¡¡£§00403000£§

£º00401005¡¡66A100304000¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡mov¡¡ax£»¡¡word¡¡ptr¡¡£§00403000£§

£º0040100B¡¡A100304000¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡mov¡¡eax£»¡¡dword¡¡ptr¡¡£§00403000£§

¡£data¶ÎÖеıäÁ¿ÊÇ°´Ë³Ðò´ÓµÍµØÖ·Íù¸ßµØÖ·ÅÅÁеģ¬¶ÔÓÚ³¬¹ýÒ»¸ö×Ö½ÚµÄÊý¾Ý£¬80386´¦ÀíÆ÷µÄÊý¾ÝÅÅÁз½Ê½ÊǵÍλÊý¾ÝÔڵ͵ØÖ·£¬ËùÒÔwTest2µÄ1234hÔÚÄÚ´æÖеÄÅÅÁÐÊÇ34h¡¡12h£¬ÒòΪ34hÊǵÍλ¡£Í¬Ñù£¬dwTest3ÔÚÄÚ´æÖÐÒÔ78h¡¡56h¡¡34h¡¡12h´ÓµÍµØÖ·Íù¸ßµØÖ·´æ·Å£¬ÔÚÖ´ÐÐÖ¸Áîmov¡¡ax£»word¡¡ptr¡¡bTest1µÄʱºò£¬ÊÇ´ÓbTest1µÄµØÖ·403000h´¦È¡Ò»¸ö×Ö£¬Æ䳤¶ÈÒѾ­³¬¹ýÁËbTest1µÄ·¶Î§²¢Âäµ½ÁËwTest2ÖУ¬´ÓÄÚ´æÖп´£¬ÊÇÈ¡ÁËbTest1µÄÊý¾Ý12hºÍwTest2µÄµÍλ34h£¬ÔÚÕâÁ½¸ö×Ö½ÚÖУ¬12hλÓڵ͵ØÖ·£¬ËùÒÔaxÖеÄÊýÖµÊÇ3412h¡£Í¬ÑùµÀÀí£¬¿´ÁíÒ»ÌõÖ¸Á

mov¡¡¡¡¡¡¡¡¡¡eax£»dword¡¡ptr¡¡bTest1

ÕâÌõÖ¸ÁîÈ¡ÁËbTest1£¬wTest2µÄÈ«²¿ºÍdwTest3µÄ×îµÍλ78h£¬ÔÚÄÚ´æÖеÄÅÅÁÐÊÇ12h¡¡¡¡34h¡¡12h¡¡78h£¬ËùÒÔeaxµÈÓÚ78123412h¡£

Õâ¸öÀý×Ó˵Ã÷ÁË»ã±àÖÐÓÃptrÇ¿ÖƸ²¸Ç±äÁ¿³¤¶ÈµÄʱºò£¬ÊµÖÊÉÏÊÇÖ»ÓÃÁ˱äÁ¿µÄµØÖ·¶ø½ûÖ¹±àÒëÆ÷½øÐмìÑ飬±àÒëÆ÷²¢²»»á¿¼ÂǶ¨½çµÄÎÊÌ⣬³ÌÐòÔ±ÔÚʹÓõÄʱºò±ØÐë¶ÔÄÚ´æÖеÄÊý¾ÝÅÅÁÐÓиöÈ«¾Ö¸ÅÄÒÔÃâÔ½½ç´æÈ¡µ½ÒâÁÏÖ®ÍâµÄÊý¾Ý¡£

Èç¹û³ÌÐòÔ±µÄ±¾ÒâÊÇÀàËÆÓÚCÓïÑÔµÄÇ¿ÖÆÀàÐÍת»»£¬Ïë°ÑbTest1µÄÒ»¸ö×Ö½ÚÀ©Õ¹µ½Ò»¸ö×Ö»òÒ»¸öË«×ÖÔٷŵ½ax»òeaxÖУ¬¸ßλ±£³Ö0¶ø²»ÊÇÔ½½ç´æÈ¡µ½ÆäËûµÄ±äÁ¿£¬¿ÉÒÔÓÃ80386µÄÀ©Õ¹Ö¸ÁîÀ´ÊµÏÖ¡£80386´¦ÀíÆ÷ÌṩµÄmovzxÖ¸Áî¿ÉÒÔʵÏÖÕâ¸ö¹¦ÄÜ£¬ÀýÈ磺

movzx¡¡¡¡¡¡¡¡¡¡¡¡¡¡ax£»bTest1¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡£»Àý1

movzx¡¡¡¡¡¡¡¡¡¡¡¡¡¡eax£»bTest1¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡£»Àý2

movzx¡¡¡¡¡¡¡¡¡¡¡¡¡¡eax£»cl¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡£»Àý3

movzx¡¡¡¡¡¡¡¡¡¡¡¡¡¡eax£»ax¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡£»Àý4

¡ñ¡¡¡¡¡¡Àý1°Ñµ¥×Ö½Ú±äÁ¿bTest1µÄÖµÀ©Õ¹µ½16λ·ÅÈëaxÖС£

¡ñ¡¡¡¡¡¡Àý2°Ñµ¥×Ö½Ú±äÁ¿bTest1µÄÖµÀ©Õ¹µ½32λ·ÅÈëeaxÖС£

¡ñ¡¡¡¡¡¡Àý3°ÑclÖеÄ8λֵÀ©Õ¹µ½32λ·ÅÈëeaxÖС£

¡ñ¡¡¡¡¡¡Àý4°ÑaxÖеÄ16λֵÀ©Õ¹µ½32λ·ÅÈëeaxÖС£

ÓÃmovzxÖ¸Áî½øÐÐÊý¾Ý³¤¶ÈÀ©Õ¹ÊÇWin32»ã±àÖо­³£Óõ½µÄ¼¼ÇÉ¡£

2¡£¡¡±äÁ¿µÄ³ß´çºÍÊýÁ¿

ÔÚÔ´³ÌÐòÖÐÓõ½±äÁ¿µÄ³ß´çºÍÊýÁ¿µÄʱºò£¬¿ÉÒÔÓÃsizeofºÍlengthofαָÁîÀ´ÊµÏÖ£¬¸ñʽÊÇ£º

sizeof¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡±äÁ¿Ãû¡¢Êý¾ÝÀàÐÍ»òÊý¾Ý½á¹¹Ãû

lengthof¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡±äÁ¿Ãû¡¢Êý
·µ»ØĿ¼ ÉÏÒ»Ò³ ÏÂÒ»Ò³ »Øµ½¶¥²¿ ÔÞ£¨0£© ²È£¨0£©
¿ì½Ý²Ù×÷: °´¼üÅÌÉÏ·½Ïò¼ü ¡û »ò ¡ú ¿É¿ìËÙÉÏÏ·­Ò³ °´¼üÅÌÉ쵀 Enter ¼ü¿É»Øµ½±¾ÊéĿ¼ҳ °´¼üÅÌÉÏ·½Ïò¼ü ¡ü ¿É»Øµ½±¾Ò³¶¥²¿!
ÎÂÜ°Ìáʾ£º ο´Ð¡ËµµÄͬʱ·¢±íÆÀÂÛ£¬Ëµ³ö×Ô¼ºµÄ¿´·¨ºÍÆäËüС»ï°éÃÇ·ÖÏíÒ²²»´íŶ£¡·¢±íÊéÆÀ»¹¿ÉÒÔ»ñµÃ»ý·ÖºÍ¾­Ñé½±Àø£¬ÈÏÕæдԭ´´ÊéÆÀ ±»²ÉÄÉΪ¾«ÆÀ¿ÉÒÔ»ñµÃ´óÁ¿½ð±Ò¡¢»ý·ÖºÍ¾­Ñé½±ÀøŶ£¡