ÓÑÇéÌáʾ£ºÈç¹û±¾ÍøÒ³´ò¿ªÌ«Âý»òÏÔʾ²»ÍêÕû£¬Çë³¢ÊÔÊó±êÓÒ¼ü¡°Ë¢Ð¡±±¾ÍøÒ³£¡ÔĶÁ¹ý³Ì·¢ÏÖÈκδíÎóÇë¸æËßÎÒÃÇ£¬Ð»Ð»£¡£¡ ±¨¸æ´íÎó
·É¶ÁÖÐÎÄÍø ·µ»Ø±¾ÊéĿ¼ ÎÒµÄÊé¼Ü ÎÒµÄÊéÇ© TXTÈ«±¾ÏÂÔØ ½øÈëÊé°É ¼ÓÈëÊéÇ©

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

°´¼üÅÌÉÏ·½Ïò¼ü ¡û »ò ¡ú ¿É¿ìËÙÉÏÏ·­Ò³£¬°´¼üÅÌÉ쵀 Enter ¼ü¿É»Øµ½±¾ÊéĿ¼ҳ£¬°´¼üÅÌÉÏ·½Ïò¼ü ¡ü ¿É»Øµ½±¾Ò³¶¥²¿£¡
¡ª¡ª¡ª¡ªÎ´ÔĶÁÍꣿ¼ÓÈëÊéÇ©ÒѱãÏ´μÌÐøÔĶÁ£¡




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¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡±äÁ¿Ãû¡¢Êý¾ÝÀàÐÍ»òÊý¾Ý½á¹¹Ãû

sizeofαָÁî¿ÉÒÔÈ¡µÃ±äÁ¿¡¢Êý¾ÝÀàÐÍ»òÊý¾Ý½á¹¹ÒÔ×Ö½ÚΪµ¥Î»µÄ³¤¶È£¬lengthof¿ÉÒÔÈ¡µÃ±äÁ¿ÖÐÊý¾ÝµÄÏîÊý¡£¼ÙÈ綨ÒåÁËÒÔÏÂÊý¾Ý£º

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

szHello¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡db¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡'Hello£»world£¡'£»0

dwTest¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡dd¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡1£»2£»3£»4

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

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

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

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡mov¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡eax£»sizeof¡¡stWndClass

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡mov¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ebx£»sizeof¡¡WNDCLASS

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡mov¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ecx£»sizeof¡¡szHello

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡mov¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡edx£»sizeof¡¡dword

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡mov¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡esi£»sizeof¡¡dwTest

Ö´ÐкóeaxµÄÖµÊÇstWndClass½á¹¹µÄ³¤¶È40£¬ebxͬÑùÊÇ40£¬ecxµÄÖµÊÇ13£¬¾ÍÊÇ¡°Hello£»world£¡¡±×Ö·û´®µÄ³¤¶È¼ÓÉÏÒ»¸ö×Ö½ÚµÄ0½áÊø·û£¬edxµÄÖµÊÇÒ»¸öË«×ֵij¤¶È£º4£¬¶øesiÔòµÈÓÚ4¸öË«×ֵij¤¶È16¡£

Èç¹û°ÑËùÓеÄsizeof»»³Élengthof£¬ÄÇôeax»áµÈÓÚ1£¬ÒòΪֻ¶¨ÒåÁË1ÏîWNDCLASS£¬¶øecxͬÑùµÈÓÚ13£¬esiÔòµÈÓÚ4£¬¶ølengthof¡¡WNDCLASSºÍlengthof¡¡dwordÊÇ·Ç·¨µÄÓ÷¨£¬±àÒë³ÌÐò»á±¨´í¡£

ҪעÒâµÄÊÇ£¬sizeofºÍlengthofµÄÊýÖµÊDZàÒëʱºò²úÉúµÄ£¬ÓɱàÒëÆ÷´«µÝµ½Ö¸ÁîÖÐÈ¥£¬ÉϱߵÄÖ¸Áî×îºó²úÉúµÄ´úÂë¾ÍÊÇ£º

mov¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡eax£»40

mov¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ebx£»40

mov¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡ecx£»13

mov¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡edx£»4

mov¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡esi£»16

¡¡Èç¹ûΪÁË°ÑHelloºÍWorld·ÖÁ½Ðж¨Ò壬szHelloÊÇÕâÑù¶¨ÒåµÄ£º

szHello¡¡¡¡¡¡¡¡¡¡¡¡¡¡db¡¡¡¡¡¡¡¡¡¡¡¡'Hello'£»0dh£»0ah

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡db¡¡¡¡¡¡¡¡¡¡¡¡'World'£»0

ÄÇôsizeof¡¡szHelloÊǶàÉÙÄØ£¿×¢Ò⣡ÊÇ7¶ø²»ÊÇ13£¬MASMÖеıäÁ¿¶¨ÒåÖ»ÈÏÒ»ÐУ¬ºóÒ»ÐÐdb¡¡'World'£»0ʵ¼ÊÉÏÊÇÁíÒ»¸öûÓÐÃû³ÆµÄÊý¾Ý¶¨Ò壬±àÒëÆ÷ÈÏΪsizeof¡¡szHelloÊǵÚÒ»ÐÐ×Ö·ûµÄÊýÁ¿¡£ËäÈ»°ÑszHelloµÄµØÖ·µ±²ÎÊý´«¸øMessageBoxµÈº¯ÊýÏÔʾʱ»á°ÑÁ½Ðж¼ÏÔʾ³öÀ´£¬µ«ÑϸñµØ˵ÕâÊÇÔ½½çʹÓñäÁ¿¡£ËäÈ»ÔÚʵ¼ÊµÄÓ¦ÓÃÖÐÕâÑù¶¨Ò峤×Ö·û´®µÄÓ÷¨ºÜÆձ飬ÒòΪÈç¹ûÒªÏÔʾһÆÁÄ»°ïÖú£¬Ò»ÐÐÊDz»¹»µÄ£¬µ«Òª×¢ÒâµÄÊÇ£ºÒªÓõ½ÕâÖÖ×Ö·û´®µÄ³¤¶Èʱ£¬Ç§Íò²»ÒªÓÃsizeofÈ¥±íʾ£¬×îºÃÊÇÔÚ³ÌÐòÖÐÓÃlstrlenº¯ÊýÈ¥¼ÆËã¡£



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


µÚ3Õ¡¡Ê¹ÓÃMASM


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

¡¡¡¡¡¡¡¡
3¡£¡¡»ñÈ¡±äÁ¿µØÖ·

»ñÈ¡±äÁ¿µØÖ·µÄ²Ù×÷¶ÔÓÚÈ«¾Ö±äÁ¿ºÍ¾Ö²¿±äÁ¿ÊDz»Í¬µÄ¡£

¶ÔÓÚÈ«¾Ö±äÁ¿£¬ËüµÄµØÖ·ÔÚ±àÒëµÄʱºòÒѾ­ÓɱàÒëÆ÷È·¶¨ÁË£¬ËüµÄÓ÷¨´ó¼Ò¶¼²»Ä°Éú£º

mov¡¡¡¡¡¡¡¡¡¡¼Ä´æÆ÷£»offset¡¡±äÁ¿Ãû

ÆäÖÐoffsetÊÇÈ¡±äÁ¿µØÖ·µÄα²Ù×÷·û£¬ºÍsizeofα²Ù×÷·ûÒ»Ñù£¬Ëü½ö°Ñ±äÁ¿µÄµØÖ·´úµ½Ö¸ÁîÖÐÈ¥£¬Õâ¸ö²Ù×÷ÊÇÔÚ±àÒëʱ¶ø²»ÊÇÔÚÔËÐÐʱÍê³ÉµÄ¡£

¶ÔÓÚ¾Ö²¿±äÁ¿£¬ËüÊÇÓÃebpÀ´×öÖ¸Õë²Ù×÷µÄ£¬¼ÙÉèebpµÄÖµÊÇ40100h£¬ÄÇô¾Ö²¿±äÁ¿1µÄµØÖ·ÊÇebp¡­4¼´400FCh£¬ÓÉÓÚebpµÄÖµËæ×ųÌÐòµÄÖ´Ðл·¾³²»Í¬¿ÉÄÜÊDz»Í¬µÄ£¬ËùÒÔ¾Ö²¿±äÁ¿µÄµØÖ·ÖµÔÚ±àÒëµÄʱºòÒ²ÊDz»È·¶¨µÄ£¬²»¿ÉÄÜÓÃoffsetα²Ù×÷·ûÀ´»ñÈ¡ËüµÄµØÖ·¡£

80386´¦ÀíÆ÷ÖÐÓÐÒ»ÌõÖ¸ÁîÓÃÀ´È¡Ö¸ÕëµÄµØÖ·£¬¾ÍÊÇleaÖ¸ÁÈ磺

lea¡¡¡¡¡¡¡¡¡¡eax£»£§ebp¡­4£§

¸ÃÖ¸Áî¿ÉÒÔÔÚÔËÐÐʱ°´ÕÕebpµÄֵʵ¼Ê¼ÆËã³öµØÖ··Åµ½eaxÖС£

Èç¹ûÒªÔÚinvokeαָÁîµÄ²ÎÊýÖÐÓõ½Ò»¸ö¾Ö²¿±äÁ¿µÄµØÖ·£¬¸ÃÔõô°ìÄØ£¿²ÎÊýÖÐÊDz»¿ÉÄÜдÈëleaÖ¸ÁîµÄ£¬ÓÃoffsetÓÖÊDz»¶ÔµÄ¡£MASM¶Ô´ËÓÐÒ»¸öרÓõÄα²Ù×÷·ûaddr£¬Æä¸ñʽΪ£º

addr¡¡¾Ö²¿±äÁ¿ÃûºÍÈ«¾Ö±äÁ¿Ãû

µ±addrºó¸úÈ«¾Ö±äÁ¿ÃûµÄʱºò£¬Ó÷¨ºÍoffsetÊÇÏàͬµÄ£»µ±addrºóÃæ¸ú¾Ö²¿±äÁ¿ÃûµÄʱºò£¬±àÒëÆ÷»á×Ô¶¯ÓÃleaÖ¸ÁîÏȰѵØÖ·È¡µ½eaxÖУ¬È»ºóÓÃeaxÀ´´úÌæ±äÁ¿µØַʹÓá£×¢Òâaddrα²Ù×÷·ûÖ»ÄÜÔÚinvokeµÄ²ÎÊýÖÐʹÓ㬲»ÄÜÓÃÔÚÀàËÆÓÚÏÂÁеij¡ºÏ£º

mov¡¡eax£»addr¡¡¾Ö²¿±äÁ¿Ãû¡¡¡¡¡¡£»×¢Ò⣺´íÎóÓ÷¨

¡¡¼ÙÉèÔÚÒ»¸ö×Ó³ÌÐòÖÐÓÐÈçÏÂinvokeÖ¸Á

¡¡¡¡invoke¡¡¡¡Test£»eax£»addr¡¡szHello

ÆäÖÐTestÊÇÒ»¸öÐèÒªÁ½¸ö²ÎÊýµÄ×Ó³ÌÐò£¬szHelloÊÇÒ»¸ö¾Ö²¿±äÁ¿£¬»á·¢Éúʲô½á¹ûÄØ£¿±àÒëÆ÷»á°ÑinvokeαָÁîºÍaddr·­Òë³ÉÏÂÃæÕâ¸öÄ£Ñù£º

lea¡¡¡¡¡¡¡¡eax£»£§ebp¡­4£§

push¡¡¡¡¡¡eax¡¡¡¡¡¡¡¡£»²ÎÊý2£ºaddr¡¡szHello

push¡¡¡¡¡¡eax¡¡¡¡¡¡¡¡£»²ÎÊý1£ºeax

call¡¡¡¡¡¡Test

·¢ÏÖÁËʲô£¿µ½pushµÚÒ»¸ö²ÎÊýeax֮ǰ£¬eaxµÄÖµÒѾ­±»lea¡¡eax£»£§ebp¡­4£§Ö¸Á¸ÇÁË£¡Ò²¾ÍÊÇ˵£¬ÒªÓõ½µÄeaxµÄÖµ²»ÔÙÓÐЧ£¬ËùÒÔ£¬µ±ÔÚinvokeÖÐʹÓÃaddrα²Ù×÷·ûʱ£¬×¢ÒâÔÚËüµÄÇ°Ãæ²»ÄÜÓÃeax£¬·ñÔòeaxµÄÖµ»á±»¸²¸Çµô£¬µ±È»eaxÔÚaddrµÄºóÃæµÄ²ÎÊýÖÐÓÃÊÇ¿ÉÒԵġ£ÐÒ¿÷MASM±àÒëÆ÷¶ÔÕâÖÖÇé¿öÓÐÈçÏ´íÎóÌáʾ£º

error¡¡A2133£º¡¡register¡¡value¡¡overwritten¡¡by¡¡INVOKE

·ñÔò£¬²»ÖªµÀÓÖ»áÒý³ö¶àÉÙĪÃûÆäÃîµÄ´íÎó£¡



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


µÚ3Õ¡¡Ê¹ÓÃMASM


3¡£4¡¡Ê¹ÓÃ×Ó³ÌÐò

¡¡¡¡¡¡¡¡
µ±³ÌÐòÖÐÏàͬ¹¦ÄܵÄÒ»¶Î´úÂëÓõñȽÏƵ·±Ê±£¬¿ÉÒÔ½«Ëü·ÖÀë³öÀ´Ð´³ÉÒ»¸ö×Ó³ÌÐò£¬ÔÚÖ÷³ÌÐòÖÐÓÃcallÖ¸ÁîÀ´µ÷ÓÃËü¡£ÕâÑù¿ÉÒÔ²»ÓÃÖظ´Ð´ÏàͬµÄ´úÂ룬¶øÓÃcallÖ¸Áî¾Í¿ÉÒÔÍê³É¶à´ÎͬÑùµÄ¹¤×÷ÁË¡£Win32»ã±àÖеÄ×Ó³ÌÐòÒ²²ÉÓöÑÕ»À´´«µÝ²ÎÊý£¬ÕâÑù¾Í¿ÉÒÔÓÃinvokeαָÁîÀ´½øÐе÷ÓúÍÓï·¨¼ì²é¹¤×÷¡£

3¡£4¡£1¡¡¡¡×Ó³ÌÐòµÄ¶¨Òå

×Ó³ÌÐòµÄ¶¨Ò巽ʽÈçÏÂËùʾ¡£

×Ó³ÌÐòÃû¡¡¡¡proc¡¡£§¾àÀ룧£§ÓïÑÔÀàÐÍ£§£§¿ÉÊÓÇøÓò£§£§USES¡¡¼Ä´æÆ÷ÁÐ±í£§£§£»²ÎÊý£ºÀàÐÍ£§¡£¡£¡££§VARARG£§

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡local¡¡¾Ö²¿±äÁ¿Áбí

¡¡

¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡¡Ö¸Áî

¡¡

×Ó³ÌÐòÃû¡¡¡¡endp

procºÍendpαָÁÒåÁË×Ó³ÌÐò¿ªÊ¼ºÍ½áÊøµÄλÖ㬡¡procºóÃæ¸úµÄ²ÎÊýÊÇ×Ó³ÌÐòµÄÊôÐÔºÍÊäÈë²ÎÊý¡£×Ó³ÌÐòµÄÊôÐÔÓУº

¡ñ¡¡¡¡¡¡¾àÀ롪¡ª¿ÉÒÔÊÇNEAR£¬FAR£¬NEAR16£¬NEAR32£¬FAR16»òFAR32£¬Win32ÖÐÖ»ÓÐÒ»¸öƽ̹µÄ¶Î£¬ÎÞËùν¾àÀ룬ËùÒÔ¶Ô¾àÀëµÄ¶¨ÒåÍùÍùºöÂÔ¡£

¡ñ¡¡¡¡¡¡ÓïÑÔÀàÐÍ¡ª¡ª±íʾ²ÎÊýµÄʹÓ÷½Ê½ºÍ¶ÑջƽºâµÄ·½Ê½£¬¿ÉÒÔÊÇStdCall£¬C£¬SysCall£¬BASIC¡¢FORTRANºÍPASCAL£¬Èç¹ûºöÂÔ£¬ÔòʹÓóÌÐòÍ·²¿¡¡¡£model¶¨ÒåµÄÖµ¡£

¡ñ¡¡¡¡¡¡¿ÉÊÓÇøÓò¡ª¡ª¿ÉÒÔÊÇPRIVATE£¬PUBLICºÍEXPORT¡£PRIVATE±íʾ×Ó³ÌÐòÖ»¶Ô±¾Ä£¿é¿É¼û£»PUBLIC±íʾ¶ÔËùÓеÄÄ£¿é¿É¼û£¨ÔÚ×îºó±àÒëÁ´½ÓÍê³ÉµÄ¡¡¡£exeÎļþÖУ©£»EXPORT±íʾÊǵ¼³öµÄº¯Êý£¬µ±±àдDLLµÄʱºòÒª½«Ä³¸öº¯Êýµ¼³öµÄʱºò¿ÉÒÔÕâÑùʹÓá£Ä¬ÈϵÄÉèÖÃÊÇPUBLIC¡£

¡ñ¡¡¡¡¡¡USES¼Ä´æÆ÷ÁÐ±í¡ª¡ª±íʾÓɱàÒëÆ÷ÔÚ×Ó³ÌÐòÖ¸Áʼǰ×Ô¶¯°²ÅÅpushÕâЩ¼Ä´æÆ÷µÄÖ¸Á²¢ÇÒÔÚretÇ°×Ô¶¯°²ÅÅpopÖ¸ÁÓÃÓÚ±£´æÖ´Ðл·¾³£¬µ«±ÊÕßÈÏΪ²»Èç×Ô¼ºÔÚ¿ªÍ·ºÍ½áβÓÃpushadºÍpopadÖ¸ÁîÒ»´Î±£´æºÍ»Ö¸´ËùÓмĴæÆ÷À´µÃ·½±ã¡£

¡ñ¡¡¡¡¡¡²ÎÊýºÍÀàÐÍ¡ª¡ª²ÎÊýÖ¸²ÎÊýµÄÃû³Æ£¬ÔÚ¶¨Òå²ÎÊýÃûµÄʱºò²»ÄܸúÈ«¾Ö±äÁ¿ºÍ×Ó³ÌÐòÖеľֲ¿±äÁ¿ÖØÃû¡£¶ÔÓÚÀàÐÍ£¬ÓÉÓÚWin32ÖеIJÎÊýÀàÐÍÖ»ÓÐ32루dword£©Ò»ÖÖÀàÐÍ£¬ËùÒÔ¿ÉÒÔÊ¡ÂÔ¡£ÔÚ²ÎÊý¶¨ÒåµÄ×îºó»¹¿ÉÒÔ¸úVARARG£¬±íʾÔÚÒÑÈ·¶¨µÄ²ÎÊýºó»¹¿ÉÒÔ¸ú¶à¸öÊýÁ¿²»È·¶¨µÄ²ÎÊý£¬ÔÚWin32»ã±àÖÐΩһʹÓÃVARARGµÄAPI¾ÍÊÇwsprintf£¬ÀàËÆÓÚCÓïÑÔÖеÄprintf£¬Æä²ÎÊýµÄ¸öÊýÈ¡¾öÓÚÒªÏÔʾµÄ×Ö·û´®ÖÐÖ¸¶¨µÄ±äÁ¿¸öÊý¡£

Íê³ÉÁ˶¨ÒåÖ®ºó£¬¿ÉÒÔÓÃinvokeαָÁîÀ´µ÷ÓÃ×Ó³ÌÐò£¬µ±invokeαָÁîλÓÚ×Ó³ÌÐò´úÂë֮ǰµÄʱºò£¬´¦Àíµ½invokeÓï¾äµÄʱºò±àÒëÆ÷»¹Ã»ÓÐɨÃèµ½×Ó³ÌÐò¶¨ÒåÐÅÏ¢µÄ¼Ç¼£¬ËùÒÔ»áÓÐÒÔÏ´íÎóÐÅÏ¢£º

error¡¡A2006£º¡¡undefined¡¡symbol¡¡£º¡¡_ProcWinMain

Õâ²¢²»ÊÇ˵×Ó³ÌÐòµÄ±àдÓдíÎ󣬶øÊÇinvokeαָÁîÎÞ·¨µÃÖª×Ó³ÌÐòµÄ¶¨ÒåÇé¿ö£¬ËùÒÔÎÞ·¨½øÐвÎÊýµÄ¼ì²â¡£ÔÚÕâÖÖÇé¿öÏ£¬ÎªÁËÈÃinvokeÖ¸ÁîÄÜÕý³£Ê¹Ó㬱ØÐëÔÚ³ÌÐòµÄÍ·²¿ÓÃprotoα²Ù×÷¶¨Òå×Ó³ÌÐòµÄÐÅÏ¢£¬¡
·µ»ØĿ¼ ÉÏÒ»Ò³ ÏÂÒ»Ò³ »Øµ½¶¥²¿ ÔÞ£¨0£© ²È£¨0£©
δÔĶÁÍꣿ¼ÓÈëÊéÇ©ÒѱãÏ´μÌÐøÔĶÁ£¡
ÎÂÜ°Ìáʾ£º ο´Ð¡ËµµÄͬʱ·¢±íÆÀÂÛ£¬Ëµ³ö×Ô¼ºµÄ¿´·¨ºÍÆäËüС»ï°éÃÇ·ÖÏíÒ²²»´íŶ£¡·¢±íÊéÆÀ»¹¿ÉÒÔ»ñµÃ»ý·ÖºÍ¾­Ñé½±Àø£¬ÈÏÕæдԭ´´ÊéÆÀ ±»²ÉÄÉΪ¾«ÆÀ¿ÉÒÔ»ñµÃ´óÁ¿½ð±Ò¡¢»ý·ÖºÍ¾­Ñé½±ÀøŶ£¡