Ch¡@00¡@²Ä¤@­Ó Win64 ²Õ¦X»y¨¥µ{¦¡


64 ¦ì¤¸ªº CPU

¤¤µØ¥Á°ê 83 ¦~ 3 ¤ë¡A¤]´N¬O¦è¤¸ 1994 ¦~¡A­^¯Sº¸±À¥X¨ã¦³ 64 ¦ì¤¸ªº¸ê®Æ¶×¬y±Æªº©bÄË ( Pentium ) ¤¤¥¡³B²z¾¹¡A¥¦»P¥~³¡½u¸ô·¾³qªº¸ê®Æ¬O¥H 64 ¦ì¤¸ªº¤è¦¡¶Ç¿é¡C·í®É¦³³\¦h¼s§i«ÅºÙ¥¦¬O 64 ¦ì¤¸ªº CPU ( ¦Ü¤µÁÙ¬O¦³¨Ç®Ñ¤´µM¦p¦¹¼g )¡C©ú²´¤H¤@¬Ý«Kª¾³o¬O»Ù²´ªk¡IÁöµM Pentium ¨ã¦³ 64 ¦ì¤¸¸ê®Æ¶×¬y±Æ¡A¦ý«o¥u¦³ 32 ¦ì¤¸ªº¼È¦s¾¹¡A¨C¦¸¹Bºâ¤]¥u¯à³B²z 32 ¦ì¤¸ªº¸ê®Æ¡CPentium ¨C¦¸¥i¥H¥Ñ¶×¬y±Æ±µ¦¬ 64 ¦ì¤¸ªº¸ê®Æ¡A¦ý±o¤À¨â¦¸¶Ç°e¸ê®Æ¡CÄY®æ¨Ó»¡¡APentium ¤´ÄÝ 32 ¦ì¤¸ªº CPU¡C

¹ïµ{¦¡³]­p®v¦Ó¨¥¡APentium »P 80386/80486 ¤ñ¸û¡APentium °£¤F¦h¥X³B²z¦h´CÅé¸ê®Æªº«ü¥O¶°¥H¤Î¸û¬°§Ö³tªº¹Bºâ³t²v¤§¥~¡AÃö©ó¨t²Î¤è­±ªº«ü¥O¡A¦p©w§}¼Ò¦¡¡B°O¾ÐÅéºÞ²zµ¥¡A³£»P 80386/80486 ¬Û¥h¤£»·¡A¤@¯ë§Ú­Ì³£ºÙ©I¥¦­Ì¬° IA¡Ð32 ( Intel Architecture 32-bit ) ªº CPU¡A¦³®É¤]ºÙ¬° i386¡Bx86¡Ð32 ©ÎªÌ x86¡C°£¤F 80386/80486/Pentium¡A´N³s«á¨Ó­^¯Sº¸¥X²£ªº CPU¡A¦p Pentium Pro¡BPentium II¡BPentium III¡BCeleron¡BPentium 4¡BPentium M¡BCore¡BCeleron M¡BCeleron D ³£Äݩ󦹤@¬[ºc¡C¬ü°Ó¶W·L¤]¶}µo¥X³\¦hºØÃþªº IA¡Ð32 CPU¡A¦p K5¡BK6¡BK6¡Ð2¡BK6¡ÐIII¡BDuron¡BAthlon¡BAthlon XP¡BAthlon MP¡BAthlon XP¡ÐM µ¥¡C

IA¡Ð32 ¬[ºcªº CPU¡A¥i¥H©w§}¨ì 232 ­Ó¦ì¤¸²Õ¡A¥ç§Y 4GB¡A¬Û·í©ó 4294967296 ­Ó¦ì¤¸²Õ¡A¬Û¹ï©ó 8086 ¥u¯à©w§} 1MB ( ¥ç§Y 1048576 ) ¦ì¤¸²Õ¡A¥i¥H»¡¬O¬Û·íªº¤j¡A¦ý¬O­±¹ï¸ê®Æ®w¡B¼v­µ³B²zµ¥ªºÃe¤jªº¸ê®Æ®É¡A¤´¬O¤O¦³¥¼¶e¡C©ó¬O­^¯Sº¸»P¬ü°ê´f´¶¤½¥q ( Hewlett-Packard ) ¦X§@¶}©l¬ãµo 64 ¦ì¤¸ªº CPU¡A«á¨Ó¦b¥Á°ê 90 ¦~ 6 ¤ëµoªí²Ä¤@¥N Itanium ( ¤¤¤å¦WºÙ¬°¡y¦wÄË¡z)¡A«á¨Ó¤S¦b¦¸¦~µoªí Itanium 2¡A³o¨âºØ CPU ¬[ºcºÙ¬° IA¡Ð64 ( Intel Architecture 64-bit )¡Aªí©ú¬O 64 ¦ì¤¸¬[ºcªº CPU¡A¥¦¯à¤@¦¸³B²z 64 ¦ì¤¸ªø«×ªº¸ê®Æ¡A¨Ã¯à´£¨Ñ©w§}ªÅ¶¡¬° 264(¡×18446744073709551616¡Ü1.84¡Ñ1019) ¦ì¤¸²Õ¡C­^¯Sº¸¥»¨Óªº­pµe¬O±Ë±ó¦æ¤§¦h¦~ªº IA¡Ð32 ¬[ºc¡A¥H·sªº IA¡Ð64 ¥N´À¡A¦ý¬O IA¡Ð64 »P IA¡Ð32 ¤£¬Û®e¡F¥²¶·¨Ï¥Î¦UºØ¼ÒÀÀ¨Ó°õ¦æ³nÅé¡A¥H³oºØ¼ÒÀÀ¤è¦¡¨Ó°õ¦æªº®Ä²v«D±`ÁV¿|¡A¥«³õ¤ÏÀ³¨Ã¤£¦n¡C

¥t¤@®a CPU ¤j¼t¡A¬ü°Ó¶W·L ( AMD ) «o¥tÅPÁÑ®|¡C¦b IA¡Ð32 ¬[ºc¤Wµo®i¤F 64 ¦ì¤¸ªºÂX¥R¡A¨Ã©R¦W¬° AMD64¡C¨Ã©ó¥Á°ê 92 ¦~ ( ¦è¤¸ 2003 ¦~ 4 ¤ë )¡Aµoªí¤F²Ä¤@´Ú AMD64 ¬[ºcªº CPU¡AOpteron¡A¤§«á¤S¥ý«áµoªí¤F Athlon 64¡BAthlon 64 FX¡BAthlon 64 X2¡BOpteron¡BSempron¡BTurion 64¡BPhenom¡C¦]¬° AMD64 ¬O¦b IA¡Ð32 °ò¦¤WÂX¥R¬° 64 ¦ì¤¸¡A©Ò¥H¹ï¦³ªº³nÅ馳«Ü¦nªº¬Û®e©Ê¡AÀò±o¦U®a¼t°Ó¤ä«ù¡A¥]§t·L³n¤]¬° AMD64 ¶}µo Windows XP 64 Edition §@·~¨t²Î¡C«á¨Ó­^¯Sº¸²´¨£Ävª§¹ï¤â¦b 64 ¦ì¤¸ CPU ¤Wªº¦¨¥\¡A¤]±À¥X¤F»P¤§´X¥G¤@¼Ò¤@¼Ë¬[ºcªº³B²z¾¹¡A¨Ã©R¦W¬° IA¡Ð32e ( ¥ç§Y IA¡Ð32 ÂX¥R¤§·N )¡A¦Ó«á§ó¦W¬° EM64T ( Extended Memory 64 Technology ) ©Î Intel 64¡C²{¦b¤£ºÞ¬O AMD64 ©Î IA¡Ð32e¡BEM64T¡BIntel 64 ³£³Q²ÎºÙ¬° x86¡Ð64 ©Î x64 ³oºØ¤¤©Êªº¦WºÙ¡Aªí¥Ü¤£°¾³R¥ô¦ó¤@®a¼t°Ó¡C­^¯Sº¸¥X²£ªº Xeon ( ¦Û Nocona °_ªº³¡¤À«¬¸¹ )¡BCeleron D ( ¦Û Prescott °_ªº³¡¤À«¬¸¹ )¡BPentium 4 ( ¦Û Prescott °_ªº³¡¤À«¬¸¹ )¡BPentium D¡BPentium Extreme Edition¡BXeon ( Woodcrest )¡BIntel Core 2¡BDual-Core¡BCeleron (¦Û Core °_ªº«¬¸¹ )¡BNehalem¡BCore i7¡BIntel Core i5 µ¥³£ÄÝ©ó x64 ¬[ºc¡C¦¹³B¦³³\¦hÃö©ó 32 ¦ì¤¸©Î 64 ¦ì¤¸ªº¦Wµü¡A«Ü®e©ö·d²V¡A¥Î¤Uªíµy§@¾ã²z¡G

CPU ªº¦ì¤¸¦WºÙ¶}µo¼t°Ó¨Ï¥Îª¬ªp
32x86¡BIA¡Ð32¡Bx86¡Ð32­^¯Sº¸´¶¹M
64IA¡Ð64­^¯Sº¸¤£´¶¹M
64x64¡BAMD64¡BIA¡Ð32e¡BEM64T¡BIntel64¡Bx86¡Ð64¶W·L´¶¹M

¦b³oùØ¡A¤S¨£¨ì¼t°Ó¤§¶¡ªºÄvª§©Ò±oªº¦n³B¡C¦pªG¤£¬O¦³¶W·LªºÄvª§¡A§Ú·Q­^¯Sº¸¤]¤£·|¥f¨¬¥þ¤Oµo®i®Ä²v¸û¦nªº 64 ¦ì¤¸ CPU¡CµM¦Ó¡A¦b§@·~¨t²Îµ¥³nÅé¤W­±ªºµo®i«o¤£¬O³o¼Ë¡A·L³n¤@®a¿W¤j¡A§Y¨Ï CPU ¤w¸g¶i¤J 64 ¦ì¤¸±Nªñ¤Q¦~¤F¡A64 ¦ì¤¸ªº§@·~¨t²Î¤´µM¤£©ö¨Ï¥Î¡A¦³¤Ó¦hªº³nÅéµLªk¶¶ºZ°õ¦æ¡C°²¦p¦³¤@®a³nÅ餽¥q¡A¦³¨¬°÷ªº³W¼Ò¯àµo®i¥i»P·L³n¤Ç¼Äªº§@·~¨t²Î¡A§Ú·Q·L³nµ´¤£´±±¼¥H»´¤ß¡A¤£­«µø 64 ¦ì¤¸§@·~¨t²Îªºµo®i¡C

¨cÄ̵o§¹¡A¨¥Âk¥¿¶Ç¡C¨ì²{¦b ( ¥Á°ê 100 ¦~¡B¦è¤¸ 2011 ¦~ ) ¬°¤î¡A64 ¦ì¤¸ªº¹q¸£¨t²Î¥i»¡¤w¸g§¹³Æ¡A¨ä¤¤¥¡³B²z¾¹¬°¤ä´© x64 ¬[ºcªº­^¯Sº¸©Î¶W·L©Ò¥X²£ªº¥D¤O CPU¡F¦Ó§@·~¨t²Î¥i¨Ï¥Î 64 ¦ì¤¸ªº Windows XP/Vista/7 ( ¬°¤F¤è«K¡A³o¨Ç 64 ¦ì©óªº§@·~¨t²ÎºÙ¤§¬° Win64¡A¦³§O©ó Win32 )¡C°O¾ÐÅé«h¥iÂX¥R¦Ü 4GB ¥H¤W¡A¤£¦A¹³ 32 ¦ì¤¸ªº§@·~¨t²Î¨º¼Ë¡A§Y¨Ï¹q¸£¸Ë¤F¶W¹L 4GB ªº°O¾ÐÅé¡A¦ý¬OÁÙ¬O¥u¯à¨Ï¥Î 4GB¡CÀ³¥Î³nÅé¤]³vº¥¨«¦V 64 ¦ì¤¸­ì¥Í³nÅé¡A¦Ó¤£¬O¹³«e´X¦~¡A±o¾a WOW ¤~¯à¦b 64 ¦ì¤¸§@·~¨t²Î¤W°õ¦æ 32 ¦ì¤¸µ{¦¡¡C¨º»ò¤p¤ì°¸³ÌÁé·Rªº²Õ¦X»y¨¥¬O§_¯à¨Ï¥Î 64 ¦ì¤¸ªº CPU ¨Ó¼¶¼gµ{¦¡©O¡Hµª®×·íµM¬O¥i¥Hªº¡C©³¤U¤p¤ì°¸´N¥H¼¶¼g Windows 64 ¦ì¤¸ªº²Õ¦X»y¨¥µ{¦¡¬°ÃD¡A»¡©ú¦p¦ó¼¶¼g²³æªº Windows 64 ¦ì¤¸²Õ¦X»y¨¥µ{¦¡¡C


x64 CPU ¼È¦s¾¹

x64 ¬[ºcªº CPU ¬OÄÝ©ó 64 ¦ì¤¸¡A¥]§t¤F 16 ­Ó 64 ¦ì¤¸ªº³q¥Î¼È¦s¾¹ ( general-purpose registers )¡A³o 16 ­Ó¼È¦s¾¹¦WºÙ¤À§O¬O RAX¡BRBX¡BRCX¡BRDX¡BRBP¡BRSP¡BRSI¡BRDI¡BR8¡BR9¡BR10¡BR11¡BR12¡BR13¡BR14¡BR15¡C«Ü©úÅ㪺¡A«á­±ªº¤K­Ó¼È¦s¾¹¡AR8¡BR9¡BR10¡BR11¡BR12¡BR13¡BR14¡BR15¡A¬O·s¼Wªº¡F¦Ó«e­±ªº¤K­Ó¼È¦s¾¹¡ARAX¡BRBX¡BRCX¡BRDX¡BRBP¡BRSP¡BRSI¡BRDI¡A¬O§â­ì¦³ªº 32 ¦ì¤¸¥[¥HÂX¥R¦Ó¦¨¡ARAX¡BRBX¡Kµ¥ªº¡uR¡v¬O¼È¦s¾¹ ( register )¡C¦p¤U¹Ï©Ò¥Ü¡G

64 ¦ì¤¸³q¥Î¼È¦s¾¹

ÁöµM¬O¦b 64 ¦ì¤¸¨t²Î¤¤¡A¦ý¬OÁÙ¬O¥i¥H¨Ï¥Î 32¡B16¡B8 ¦ì¤¸ªº¼È¦s¾¹¡C¦p¤W¹Ï©Ò¥Ü¡AEAX¡BEBX¡BECX¡BEDX¡BESI¡BEDI¡BEBP¡BESP µ¥ 32 ¦ì¤¸ªº¼È¦s¾¹¤´µM¥i¥H¨Ï¥Î¡F¦Ó·s¼W¥[ªº 32 ¦ì¤¸¼È¦s¾¹¦W¬° R8D¡BR9D¡BR10D¡BR11D¡BR12D¡BR13D¡BR14D¡BR15D¡A¼È¦s¾¹¦Wµ²§Àªº¡yD¡z¬O«üÂù¦r²Õ ( DWORD )¡C16 ¦ì¤¸ªº¼È¦s¾¹¤]¦³¤Q¤»­Ó¡A¤À§O¬Oªº AX¡BBX¡BCX¡BDX¡BDI¡BSI¡BBP¡BSP »P·s¼Wªº R8W¡BR9W¡BR10W¡BR11W¡BR12W, R13W¡BR14W¡BR15W¡A³oùتº¡yW¡z¡AÅãµM´N¬O¦r²Õ ( WORD ) ¤§·N¡C¥i¥Îªº 8 ¦ì¤¸¼È¦s¾¹¤]¦³¤Q¤»­Ó¡A¤À§O¬O¦³ªº AL¡BBL¡BCL¡BDL »P·s¼Wªº SIL¡BDIL¡BBPL¡BSPL¡BR8B¡BR9B¡BR10B¡BR11B¡BR12B¡BR13B¡BR14B¡BR15B¡A³oùتº¡yB¡z¬O¦ì¤¸²Õ ( BYTE ) ªº·N«ä¡A¦Ó¡yL¡z¬O«ü§C¦ì¤¸²Õ¤§·N¡C


Àò±o 64 ¦ì¤¸²Õ¦X»y¨¥²ÕĶ¾¹¡B³sµ²¾¹¡B¶×¤Jµ{¦¡®w¥H¤Î°£¿ù¾¹

¥Î²Õ¦X»y¨¥¼¶¼g Win 64 µ{¦¡¥²¶·­n¦³²ÕĶ¾¹¡B³sµ²¾¹¡B¶×¤Jµ{¦¡®w¡B°£¿ù¾¹¡B°Ñ¦Ò¸ê®Æµ¥¤u¨ã©Î¸ê®Æ¤~¯à°µ¨ì¡C¦bºô»Úºô¸ô ( internet ) ¤W¡A¦³³\¦h 64 ¦ì¤¸ªº²ÕĶ¾¹¥i¨Ñ¨Ï¥Î¡A¦p GoASM¡BYasm¡A¦ý¬O»yªk¤W»P·L³nªº¥¨¶°²ÕĶ¾¹ MASM ¦³¨Ç®t²§¡A¦ý¬O¦]¬°¤p¤ì°¸¨Ï¥Î·L³n²ÕĶ¾¹¤w¦³¬Û·í¤[ªº®É¶¡¡A©Ò¥HÁÙ¬O¸ûÁ鱡©ó·L³n²ÕĶ¾¹¡C·L³n 64 ¦ì¤¸ªº²ÕĶ¾¹¤w§ó¦W¬° ML64.EXE¡A¦b Visual C++ 2005 ¦w¸Ë§¹«á¡A¥i¥H±o¨ì 8.0 ª©ªº ML64.EXE¡C¦ý¬O²{¦b¤w¥i¥H¥Ñ¡yWindows SDK for Windows Server 2008 and .NET Framework 3.5¡z±o¨ì 9.0 ª©ªº ML64.EXE¡C¡]²{¦b¡]¥Á°ê110¦~¡^¡A¸g¹L«e½úªº§V¤O¡A¤w¸g¥i¥H¥Î²³æªº¤èªk¼¶¼g Win64 ²Õ¦X»y¨¥µ{¦¡¡A¥iª½±µ¸õ¦Ü«á°O¾\Ū¡C¹ï©ó Win64 µ{¦¡¤´¦³³\¦h²Ó¸`¡A¤´¦³¤F¸Ñªº¥²­n¡A¦]¦¹©³¤Uªº¡u64 ¦ì¤¸²Õ¦X»y¨¥À³ª`·N¨Æ¶µ¡v¡B¡u¥H WinDbg °£¿ù¡v»P¡u°Ï°ìÅܼơv¤´¥i¬Ý¬Ý¡C¡^

²ÕĶ¾¹¡B³sµ²¾¹¡B¶×¤Jµ{¦¡®w

¤U­±»¡©ú¨ú±o 9.0 ª©ªº ML64.EXE¡BLINK.EXE µ¥Àɮתº¹Lµ{¡C­º¥ý¡A¨ì·L³n¤U¸ü¤¤¤ß¤U¸üWindows SDK for Windows Server 2008 and .NET Framework 3.5¡A³o¬O¤@­ÓÀɦW¬° 6.0.6001.18000.367-KRMSDK_EN.iso ªº DVD ¥úºÐ¼v¹³ÀÉ ( ISO ®æ¦¡ )¡A¤j¤p¬° 1394618368 ­Ó¦ì¤¸²Õ¡C¦b³o­Ó¥úºÐ¼v¹³Àɤ¤¦ü¥G¦Ü¤Ö¥]§tµÛ¨âºØª©¥»¸¹½X¬Û¦Pªº ML64.EXE¡A³o¨âºØ ML64.EXE ¤¤¡A¤@ºØ¯à¦b Win32 ©Î Win64 §@·~¨t²Î¤U§¡¯à°õ¦æ¡F¥t¤@ºØ¥u¯à¦b Win64 ¨t²Î¤U°õ¦æ¡C«eªÌ ML64.EXE ªº®æ¦¡¬O Win32 ¨t²Îªº¥i°õ¦æÀɮ榡¡A¤]´N¬O PE ( Win32 Portable Executable File Format ) ®æ¦¡¡A¬G¯à¦b Win32 ©Î Win64 Àô¹Ò¤U²ÕĶ³sµ²­ì©l½X¡C³o¬O¦]¬° Win64 ¨t²Î¬°¤F¦V¤U¬Û®e¡A©Ò¥H·íµM¯à°õ¦æ Win32 ¨t²Îªº°õ¦æÀÉ¡C«áªÌªº ML64.EXE ¬O Win64 ¥i°õ¦æÀɮ榡¡A¤]´N¬O PE¡Ï ®æ¦¡¡A©Ò¥H¥u¯à¦b Win64 ¨t²Î¤¤°õ¦æ¡C

¤£ºÞ¬O­þ¤@ºØ ML64.EXE¡A»s³y¥X¨Óªº¥i°õ¦æÀɳ£¬O¥u¯à¦b 64 ¦ì¤¸ªº Windows §@·~¨t²Î¤¤°õ¦æ ( Win32 À³¥Îµ{¦¡ªº¥i°õ¦æÀɮ榡¬° PE¡A¦Ó Win64 «h¬° PE¡Ï )¡C¤p¤ì°¸¥H UltraISO µ¥µêÀÀ¥úºÐ³nÅé¸ü¤J¦¹¼v¹³ÀÉ¡A¦Û 6.0.6001.18000.367-KRMSDK_EN.iso À£ÁYÀɤ¤µÑ¨ú©Ò»ÝÀɮסG

¥i¦b Win32/Win64 ¤¤°õ¦æªº²ÕĶ¾¹ ( PE ®æ¦¡ )
¡@©Ò¦bÀ£ÁYÀɤÎÀ£ÁYÀɤºÀɦW §ó§ï«áÀɦWÀɮפj¤p
( bytes )
ª©¥»
²ÕĶ¾¹¦b¡y\Setup\vc_stdx86.cab¡zÀ£ÁYÀɤº¡AÀ£ÁYÀɤºªºÀɦW¬°
FL_ml64_exe_93735_93735_x86_ln.3643236F_FC70_11D3_A536_0090278A1BB8
ML64.EXE305656 9.00.21022.08
³sµ²¾¹¦b¡y\Setup\vc_stdx86.cab¡zÀ£ÁYÀɤº¡AÀ£ÁYÀɤºªºÀɦW¬°
FL_link_exe_10395_x86_ln.3643236F_FC70_11D3_A536_0090278A1BB8
µù¡G¨Æ¹ê¤W¡Avc_stdx86.cab ¤º¦³¤T­ÓÀɮסG
¡@¡@FL_link_exe_10395_x86_ln.3643236F_FC70_11D3_A536_0090278A1BB8¡B
¡@¡@FL_link_exe_74300_74300_x86_ln.3643236F_FC70_11D3_A536_0090278A1BB8¡B
¡@¡@FL_link_exe_74622_74622_x86_ln.3643236F_FC70_11D3_A536_0090278A1BB8¡A
¡@¡@³o¤T­ÓÀɮפº®e³£¬Û¦P¡A©Ò¥H¥u»Ý§â¥ô¦ó¤@­Ó¸ÑÀ£ÁY´N¥i¥H¤F¡C¦pªG§A°Ý§Ú¬°¦ó·|³o¼Ë¡A¤p¤ì°¸¤]¤£ª¾¹D¡C
LINK.EXE790008 9.00.21022.08
¶×¤Jµ{¦¡®w¡y\Setup\WinSDKBuild-WinSDKBuild_VistaLibs_X64-common.0.cab¡zÀ£ÁYÀɤº¡A¸ÑÀ£ÁY¤T­ÓÀɮסG
¡@¡@Gdi32_Lib.3F64FF45_F00B_4275_8B18_2A475F407315
¡@¡@Kernel32_Lib.D67E3FC5_0F35_46D3_93B2_574E8F2EB908
¡@¡@User32_Lib.BEF925DB_25A9_404B_8F26_7FD4969DD408

¡@GDI32.LIB
¡@KERNEL32.LIB
¡@USER32.LIB

140458
237182
137848
9.00.21022.08
¨ä¥LLINK.EXE ÁÙ¶· MSPDB80.DLL ¤~¯à¨Ï¥Î¡A¬GÁÙ±o¸ÑÀ£ÁY¡y\Setup\vc_stdx86.cab¡zÀ£ÁYÀɤºªº¡yFL_mspdb71_dll_2_60032_x86_ln.3643236F_FC70_11D3_A536_0090278A1BB8¡z¡C¦¹³B¬Ý°_¨ÓÀ³¸Ó§ó§ï¦¨ MSPDB71.DLL ¤~¹ï¡A¦ý¬O¤p¤ì°¸§ï¦¨ MSPDB80.DLL ¤´¥i¥¿±`°õ¦æ LINK.EXE¡C MSPDB80.DLL193024 9.00.21022.08
¥u¯à¦b Win64 ¤¤²ÕĶ ( PE¡Ï ®æ¦¡ )
¡@©Ò¦bÀ£ÁYÀɤÎÀ£ÁYÀɤºÀɦW §ó§ï«áÀɦWÀɮפj¤p
( bytes )
ª©¥»
²ÕĶ¾¹¦b¡y\Setup\vc_stdamd64.cab¡zÀ£ÁYÀɤº¡AÀ£ÁYÀɤºªºÀɦW¬°
FL_ml64_exe_105147_105147_amd64_ln.3643236F_FC70_11D3_A536_0090278A1BB8
ML64.EXE383480 9.00.21022.08
³sµ²¾¹¦b¡y\Setup\vc_stdamd64.cab¡zÀ£ÁYÀɤº¡AÀ£ÁYÀɤºªºÀɦW¬°
FL_link_exe_105145_105145_amd64_ln.3643236F_FC70_11D3_A536_0090278A1BB8
LINK.EXE1045496 9.00.21022.08
¶×¤Jµ{¦¡®w¡y\Setup\WinSDKBuild-WinSDKBuild_VistaLibs_X64-common.0.cab¡zÀ£ÁYÀɤº¡A¸ÑÀ£ÁY¤T­ÓÀɮסG
¡@¡@Gdi32_Lib.3F64FF45_F00B_4275_8B18_2A475F407315
¡@¡@Kernel32_Lib.D67E3FC5_0F35_46D3_93B2_574E8F2EB908
¡@¡@User32_Lib.BEF925DB_25A9_404B_8F26_7FD4969DD408

¡@GDI32.LIB
¡@KERNEL32.LIB
¡@USER32.LIB

140458
237182
137848
9.00.21022.08
¨ä¥LLINK.EXE ÁÙ¶· MSPDB80.DLL¡BMSOBJ80.DLL¡BMSPDBCORE.DLL¡BMSPDBSRV.EXE¡BCVTRES.EXE ¤­­ÓÀɮפ~¯à¥¿±`¨Ï¥Î¡A³o¤­­ÓÀɮ׳£¦b¡y\Setup\vc_stdamd64.cab¡zÀ£ÁYÀɤº¡A¤À§O¬O¡G
FL_mspdb80_dll_107301_107301_amd64_ln.3643236F_FC70_11D3_A536_0090278A1BB8
FL_msobj80_dll_110565_110565_amd64_ln.3643236F_FC70_11D3_A536_0090278A1BB8
FL_mspdbcore_dll_107302_107302_amd64_ln.3643236F_FC70_11D3_A536_0090278A1BB8
FL_mspdbsrv_exe_105148_105148_amd64_ln.3643236F_FC70_11D3_A536_0090278A1BB8
FL_cvtres_exe_105140_105140_amd64_ln.3643236F_FC70_11D3_A536_0090278A1BB8
FL_link_exe_config_105649_105649_amd64_ln.3643236F_FC70_11D3_A536_0090278A1BB8


MSPDB80.DLL
MSOBJ80.DLL
MSPDBCORE.DLL
MSPDBSRV.EXE
CVTRES.EXE
LINK.EXE.CONFIG


235520
97280
396800
132096
38904
268
9.00.21022.08
¸ê·½½sĶ¾¹¦b¡y\Setup\WinSDKWin32Tools-WinSDKWin32Tools-amd64.0.cab¡zÀ£ÁYÀɤº¡AÀ£ÁYÀɤºªºÀɦW¬°
¡@¡@RC_Exe.F3B41A95_99F3_461D_8A54_982E2DAD928A
¡@¡@RcDll_Dll.F3B41A95_99F3_461D_8A54_982E2DAD928A

RC.EXE
RCDLL.DLL

67944
394600

6.0.5724.0

¦Û 6.0.6001.18000.367-KRMSDK_EN.iso ¥i¥H¨ú±o¨âºØ¤£¦PÀô¹Ò¤Uªº²ÕĶ¾¹¡A¤À§O¬O¦b Win32 ©Î Win64 ¤¤²ÕĶ¡C°²¦p±z·Q¦b Win32 ¨t²Î¤¤²ÕĶ¡A¨º»ò±z±oµÑ¨ú¤Wªí¤¤¡A¤W¥b³¡ªºÀɮסF¦pªG±z¥´ºâ¦b Win64 ¨t²Î¤¤²ÕĶ¡A¨º»ò±oµÑ¨ú¤Wªí¤¤¡A¤U¥b³¡ªºÀɮסC¤p¤ì°¸ªº¹q¸£¬O DOS¡BWin XP 32bits Edition¡BWin XP 64bits Edition¡BWin 7 Ultimate 64bits Edition ¥H¤Î Unbuntu 9.04 ¦h­«±Ò°Ê¡A¦b¤j³¡¤À®É¶¡¬O¦b Win64 ¤¤²ÕĶ¡A¤p¤ì°¸§â¤Wªí¤¤¤W¥b³¡ªº²ÕĶ¾¹¡B³sµ²¾¹ ( ML64.EXE¡BLINK.EXE¡BMSPDB80.DLL µ¥ ) ©ñ¦b¡yC:\MASM64\BIN\x32¡z¤l¥Ø¿ýùØ¡F§â¤Wªí¤¤¤U¥b³¡ªº²ÕĶ¾¹¡B³sµ²¾¹©ñ¦b¡yC:\MASM64\BIN\x64¡z¤l¥Ø¿ýùØ¡F§â¤T­Ó¶×¤Jµ{¦¡®w GDI32.LIB¡BKERNEL32.LIB¡BUSER32.LIB ©ñ¦b¡yC:\MASM64\LIB¡z¤l¥Ø¿ýùØ ( ¤£ª¾¬°¦ó¶×¤Jµ{¦¡®w¤£¬OÀɦW¬° GDI64.LIB¡BKERNEL64.LIB¡BUSER64.LIB¡A¤´µM»P Win32 ¬Û¦P )¡C¦b Win 7 64bits Edition ¨t²Î¤¤¡A§â¤U­±ªº¤º®e¦s¦¨¡yC:\Documents and Settings\¨Ï¥ÎªÌ¦WºÙ\WIN64ASM.BAT¡zÀɮסG

SET PATH=C:\MASM64\BIN\x64;%PATH%
SET LIB=C:\MASM64\LIB
SET ML=/link /SUBSYSTEM:WINDOWS

²Ä¤@¦æ¡A¬O·í§@·~¨t²Î§ä¤£¨ì°õ¦æÀɮɡA·|¨ì PATH ©Ò«ü©wªº¤l¥Ø¿ý·j´M¡C¤@¯ë¦Ó¨¥¡A¤p¤ì°¸§â­ì©lµ{¦¡ ( °ÆÀɦW¬° *.ASM ) ¦s¦b E:\HomePage\SOURCE\Win64 ©Î¦¹¤l¥Ø¿ý©³¤Uªº®]¥Ø¿ý¡A¦Ó¤p¤ì°¸¤]§Æ±æ©Ò²ÕĶ¡B³sµ²«áªº¥i°õ¦æÀɤ]Àx¦s¦b»P­ì©lµ{¦¡¦P¤@¥Ø¿ý¡A¬G±o¤Á´«¨ì¦¹¥Ø¿ý¡C¦¹¥Ø¿ý¤£§t¦³ ML64.EXE¡BLINK.EXE µ¥ÀɮסA¬G¥H¡ySET PATH¡z«ü©w·j´M¸ô®|¡C¦b²ÕĶ§¹¦¨«á¡AML64.EXE ·|¦Û°Ê°õ¦æ LINK.EXE¡A¤]¶·³]©w·j´M¸ô®|¡A§_«h¨t²Î§ä¤£¨ì³sµ²¾¹¡A´NµLªk²£¥Í¥i°õ¦æÀÉ¡C²Ä¤G¦æ¡A¬O«ü©w¶×¤Jµ{¦¡®w©Ò¦b¦ì¸m¡C²Ä¤T¦æ¬O³]©w ML Àô¹ÒÅܼơA«ü©w ML64.EXE §â¡y/SUBSYSTEM:WINDOWS¡z°Ñ¼Æ¶Çµ¹ LINK.EXE¡C¦b Win XP 32bits Edition ¨t²ÎùØ¡A«h¬O§â¤W­±ªº WIN64ASM.BAT µy§@­×§ï¡G¤@¬O§âºÏºÐ¾÷¥N¸¹§ï¦¨¦b Win XP ¤¤©Ò¨£ªººÏºÐ¾÷¥N¸¹¡A¤G¬O§â¡ySET PATH=C:\MASM64\BIN\x64;%PATH%¡z§ï¦¨¡ySET PATH=H:\MASM64\BIN\x32;%PATH%¡z¡C³o¼Ë¤@¨Ó¡A¤p¤ì°¸¦b Win 32 Àô¹Ò©Î Win 64 Àô¹Ò³£¥i¥H²ÕĶ¡C

°£¿ù¾¹

¥Ø«e ( ¥Á°ê 100 ¦~¡B¦è¤¸ 2011 ¦~ ) ¯à¦b 64 ¦ì¤¸¤¤°õ¦æªº°£¿ù¾¹¨Ã¤£¦h¡A¤]¤£¤Ó¦n¥Î¡COllyDebug ÁÙ¥¼¯à¤ä´© x64 «ü¥O¶°¡ASoft¡ÐICE ¦ü¥G¤w°±¤îµo®i¤F¡A¨ä¥LÁÙ¦³¦n´X­Ó°£¿ù¾¹¡A¦p fdbg¡BAutoDebug µ¥¥i¨Ñ¿ï¾Ü¡C¦ý¤p¤ì°¸¿ï¾Ü·L³nªº WinDbg¡A­ì¦]µL¥L¡A¦]¬°¦³·L³nªº¤ä´©¡CWinDbg ¥i¥H¨ì·L³nªº Debugging Tools for Windows 64-bit Version ºô­¶¤U¸ü¡A³o­Óºô­¶ªº WinDbg ¦³¨âºØª©¥»¡A¤ä´© IA64 »P x64¡A¤j³¡¤Àªº¤HÀ³¸Ó¤U¸ü x64 ª©¥»¡A¨ì¥Ø«e¬°¤î¡A³Ì·sªºª©¥»¬O 6.11.1.404¡C¤U¸ü§¹¦¨«á¡A¸ÑÀ£ÁY¥i±o dbg_amd64_6.11.1.404.msi ( ¤j¤p¬° 15953408 ­Ó¦ì¤¸²Õ )¡A§â·Æ¹«´å¼Ð²¾¨ì¦¹ÀɹϥܤW¡A¥H·Æ¹«ÂùÀ»¸Ó¹Ï¥Ü§Y¥i¶}©l¦w¸Ë¡A¦w¸Ë¹Lµ{¤@¦p¤j³¡¤À³nÅé¡AµL±e¦h»¡¡C


³Ì²³æªº Win64 ²Õ¦X»y¨¥µ{¦¡

©³¤U¡A¤p¤ì°¸´N¥Ü½d¦p¦ó¼¶¼g¤@­Ó¥i°õ¦æ¦b Win64 §@·~¨t²Îªº­ì¥Í²Õ¦X»y¨¥µ{¦¡¡A¥ý§â©³¤U³o¬qµ{¦¡¦s¦¨ ¡yE:\HomePage\SOURCE\64_HelloWorld\HELLOW.ASM¡zÀɮסG

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
EXTRN           MessageBoxA:PROC
EXTRN           ExitProcess:PROC

INCLUDELIB      kernel32.lib
INCLUDELIB      user32.lib

MB_OKCANCEL     EQU     1
;*******************************************************************************
.DATA
szTitle BYTE    '³Ì²³æªºµ{¦¡',0
szText  BYTE    '³o¬O¦b Windows 64 ¦ì¤¸§@·~¨t²Î¡A',0dh,0ah
        BYTE    '¥Î²Õ¦X»y¨¥¼gªºµ{¦¡¡C',0
;*******************************************************************************
.CODE
;-------------------------------------------------------------------------------
Main    PROC
        sub     rsp,28h
        mov     r9,MB_OKCANCEL
        mov     r8,OFFSET szTitle
        mov     rdx,OFFSET szText
        sub     rcx,rcx
        call    MessageBoxA
        add     rsp,28h
        ret
Main    ENDP
;*******************************************************************************
        END

²ÕĶ 64 ¦ì¤¸ªº²Õ¦X»y¨¥­ì©l½X

°²¦p±z¨Ì·Ó¤p¤ì°¸ªº¤èªk¦w±Æ²ÕĶÀô¹Ò¡A±µ¤U¨Ó´N¥i¥H²ÕĶ¤F¡C­º¥ý¥H·Æ¹«ÂI¿ï Windows ¨t²Î¥ª¤U¨¤ªº¡y¶}©l¡z¡÷¡y©Ò¦³µ{¦¡¡z¡÷¡yªþÄÝÀ³¥Îµ{¦¡¡z¡÷¡y©R¥O´£¥Ü¦r¤¸¡z¡A¿é¤J¥H¤U«ü¥O¡G( ¶À¦r¬O±z¥²¶·¿é¤Jªº )

C:\Documents and Settings\¨Ï¥ÎªÌ>win64asm [Enter]

C:\Documents and Settings\¨Ï¥ÎªÌ>SET PATH=C:\MASM64\BIN\x64;C:\WINDOWS\system32;C:\W
INDOWS;C:\WINDOWS\System32\Wbem;C:\WINDOWS\system32\WindowsPowerShell\v1.0;C:\Pr
ogram Files\Inventec\Dreye\DreyeSA\DreyeTTs\eTTS\

C:\Documents and Settings\¨Ï¥ÎªÌ>SET LIB=C:\MASM64\LIB

C:\Documents and Settings\¨Ï¥ÎªÌ>SET ML=/link /SUBSYSTEM:WINDOWS

C:\Documents and Settings\¨Ï¥ÎªÌ>e: [Enter]

E:\>cd HomePage\SOURCE\64_HelloWorld [Enter]

E:\HomePage\SOURCE\64_HelloWorld>ml64 hellow.asm /link /entry:Main [Enter]
Microsoft (R) Macro Assembler (x64) Version 9.00.21022.08
Copyright (C) Microsoft Corporation.  All rights reserved.

 Assembling: hellow.asm
Microsoft (R) Incremental Linker Version 9.00.21022.08
Copyright (C) Microsoft Corporation.  All rights reserved.

/OUT:hellow.exe
hellow.obj
/SUBSYSTEM:WINDOWS
/entry:MAIN

E:\HomePage\SOURCE\64_HelloWorld>

¦pªG¦b 32 ¦ì¤¸ªº Windows ¤§¤U°õ¦æ hellow.exe¡A¥i±o¤U¹Ï¥ªªºµøµ¡¡F¦ý¬O¦pªG¬O¦b 64 ¦ì¤¸ªº Windows ¤U°õ¦æ¡A´N¥i¥H¬Ý¨£¤U¹Ï¥kªºµøµ¡¡C

HELLOW in Win32
³o¬O¦b Windows XP Pro 32 Edition °õ¦æªºµ²ªG
HELLOW in Win64
³o¬O¦b Windows 7 Ultimate 64 Edition °õ¦æªºµ²ªG

64 ¦ì¤¸²Õ¦X»y¨¥À³ª`·N¨Æ¶µ

¥H²{¶¥¬q ( ¤¤µØ¥Á°ê 100 ¦~¡A¦è¤¸ 2011 ¦~ ) ¨Ó»¡¡A­n¥H²Õ¦X»y¨¥¼¶¼g 64 ¦ì¤¸ªºµ{¦¡¤´µM¬O«Ü³Â·Ðªº¡AÁöµM¥Ø«e¦³´X­Ó¹Î¶¤¥¿¦b§V¤O¼¶¼g¥i¥Îªº¥]§tÀÉ¡A¦ý©|¥¼§¹¦¨¡C°£¦¹¤§¥~¡AÁÙ¦³¤@­ÓÁô¼~¡A·L³n 64 ¦ì¤¸ªº²ÕĶ¾¹¡AML64.EXE µLªk¨Ï¥Î INVOKE¡B.IF/.ELSEIF/.ENDIF¡B.WHILE/.ENDW µ¥°ª¶¥ªº°²«ü¥O¡A©Ò¥H¨Ï¥Î ML64.EXE ±o¥þ¥Ñ¤â¤u¥´³y¡C¤£¹³¨Ï¥Î MASM 6.x ²ÕĶ Win32 µ{¦¡¡A¥i¥H¨Ï¥Î³o¨Ç°²«ü¥O¡C³o¬O Win64 »P Win32 ²Ä¤@­Ó¤£¦P¤§³B¡C

Win64 ªº©I¥s¨ó©w

²Ä¤G­Ó¤£¦P¤§³B¬O¡y©I¥s¨ó©w ( calling convention )¡z¡C¦b Win32 ²Õ¦X»y¨¥¤¤¡A©I¥s Win API ¬O¥H°ïÅ|¶Ç»¼°Ñ¼Æ¡A¥B³Ì¥kÃ䪺°Ñ¼Æ¥ý±À¤J°ïÅ|¡A¶Ç¦^­È¦s©ó EAX ¼È¦s¾¹ùØ¡A¨Ã¥B¥Ñ³Q©I¥sªº¤@¤è ( §Y°Æµ{¦¡©Î API¡A¹³³oºØ³Q©I¥sªºµ{¦¡ºÙ¬° callee ) ²M°£°ïÅ|¡A¦¹ºØ©I¥s¨ó©wºÙ¬°¡ySTDCALL¡z¡C¦ý¬O¦b Win64 «o¦³©³¤U¤£¦P¡G

  1. °Ñ¼Æªº¶Ç»¼¨Ã«D§¹¥þ¾a°ïÅ|¡A¦Ó¬O¾a¼È¦s¾¹¥H¤Î°ïÅ|¡Fºë½Tªº»¡¡A«e¥|­Ó°Ñ¼Æ¨Ì§Ç©ñ¦b ECX¡BEDX¡BR8¡BR9 ¼È¦s¾¹ùØ­±¡A²Ä¤­­Ó¥H«áªº°Ñ¼Æ¤~©ñ¦b°ïÅ|ùØ¡C
  2. ¥Dµ{¦¡ ( ©ÎºÙ¬°©I¥sªÌ¡Acaller ) ¥²¶·¬°°Æµ{¦¡©Î API ( ©ÎºÙ¬°³Q©I¥sªÌ¡Acallee )·Ç³Æ¦n¨¬°÷ªº°ïÅ|ªÅ¶¡¡A¥H®e¯Ç³o¨Ç°Ñ¼Æ¡C¨C­Ó°Ñ¼Æ¦û¥Î¥|¦r²Õ ( QWORD )¡A¥ç§Y 8 ­Ó¦ì¤¸²Õ ( BYTE )¡C
  3. §Y¨Ï«e¥|­Ó°Ñ¼Æ¾a¼È¦s¾¹¶Ç»¼µ¹°Æµ{¦¡©Î API¡A¦ý¬O¥Dµ{¦¡¤´µM±o·Ç³Æ 32 ­Ó¦ì¤¸²Õªº°ïÅ|ªÅ¶¡¡A¥H«O¯dµ¹«e¥|­Ó°Ñ¼Æ¦s¤J¡F¬Æ¦Ü³s¤£¨ì¥|­Ó°Ñ¼Æªº API ¤]±o¦b°ïÅ|·Ç³Æ 32 ­Ó¦ì¤¸²ÕªºªÅ¶¡¡I°²¦p±z¨S¦³·Ç³Æ¦n¨¬°÷ªº°ïÅ|ªÅ¶¡¡Aµ{¦¡¥²©w±Y¼ì¡C
  4. ·íµ{¦¡¥Ñ°Æµ{¦¡ªð¦^®É¡A¥Ñ¥Dµ{¦¡ ( caller¡A©I¥sªÌ ) ­t³d²M°£°ïÅ|¡A¦Ó¤£¬O°Æµ{¦¡©Î API ²M°£°ïÅ|¡C
  5. °ïÅ|®Ø¥²¶·¹ï»ô¤@­Ó¸` ( paragraph )¡A¨C­Ó¸`ªº¤j¤p¬O 16 ­Ó¦ì¤¸²Õ¡A§Y¤Q¤»¶i¦ìªº 10H¡C´«¥y¸Ü»¡¡A°ïÅ|®Ø¥²¶·­n¦b°ïÅ|¦ì§}ªº WWWWXXXXYYYYZZZ0H ³B¡C©ÎªÌ»¡¡A°ïÅ|®Ø©Ò¦bªº°ïÅ|¦ì§}¥²¶·­n¯à³Q 10H ¾ã°£¡C

³oºØ©I¥s¨ó©wºÙ¬°¡yFASTCALL¡z( ¦³¨Ç¤åÄm¬O»¡Ãþ¦ü FASTCALL )¡C¤p¤ì°¸·Q¡AÁ|­Ó¨Ò¤l¨Ó»¡©ú¡A¥i¯à·|²M·¡¤@ÂI¡C¨Ò¦p­n©I¥s MessageBox API ®É¡A¦b Win32 ©³¤U¬°¡G

        INVOKE  MessageBox,hWnd,OFFSET lpText,OFFSET lpCaption,MB_OKCANCEL

¤@¦æ´N¸Ñ¨M¤F¡A¦ý¬O¦b Win64 ùØ¡A«oÅܦ¨

        mov     r9,MB_OKCANCEL
        mov     r8,OFFSET lpCaption
        mov     rdx,OFFSET lpText
        mov     rcx,hWnd
        call    MessageBoxA

¦¹³Bªº hWnd¡BlpText¡BlpCaption¡BuType ¤À§O¬O¤÷µ{¦¡ªºµøµ¡¥N½X¡BÅã¥Ü¦bµøµ¡¤º¤åªº¦r¦ê°_©l¦ì§}¡Bµøµ¡¼ÐÃDªº¦r¦ê°_©l¦ì§}¡Bµøµ¡ªº«ö¶s§Î¦¡¡C¦b Win32 ¤¤¡A«e½ú¡ASteve Hutchesson¡A©Ò¾ã²zªº MASM32 ¶}µo¤u¨ã¡A¤w¸g§â MB_OKCANCEL ¤Î MessageBoxA ¤À§O¦b WINDOWS.INC ¤Î USER32.INC ¤¤©w¸q¦n¤F¡A§Ú­Ì¥u»Ý§â¥¦­Ì¥]§t¶i¨Ó´N¥i¥H¤F¡C·Q·Q¡A§Ú­Ì¤£±o¤£¨ØªA»P´L·q Steve Hutchesson¡A¥Lµ¹§Ú­Ì³y´N¤F³o»ò¤jªº¤è«K¡C¦ý¬O¦b¶}µo Win64 µ{¦¡®É¡A´N¨S¦³¾A¦Xªº¥]§tÀɤF¡A©Ò¥H±o¦b­ì©l½X¤¤¦Û¦æ©w¸q MB_OKCANCEL ¤Î MessageBoxA¡C

°£¦¹¤§¥~¡A²´¦yªºÅªªÌÀ³¸Óª`·N¨ì¦bµ{¦¡½X¤@¶}©l¤Î±µªñµ²§À³B¡A¦³¨â¦æ©_©Çªº«ü¥O¡G

        sub     rsp,28h
        ¡K¡K
        add     rsp,28h

¦r­±¤W«Ü®e©ö²z¸Ñ¡A³o¬O§â°ïÅ|«ü¼Ð¡ARSP ¼È¦s¾¹¡A´î¥h 28H ­Ó¦ì¤¸²Õ¡A¥H¤Î¥[¤W 28H¡A¦ý¬O¬°¤°»ò­n³o¼Ë°µ©O¡H­ì¦]¬O§Ú­Ì¥²¶·¦b¥Dµ{¦¡«O¯d¨¬°÷ªºªÅ¶¡µ¹°Ñ¼Æ¨Ï¥Î¡A¨Ã¥B¨Ï°ïÅ|®Ø¹ï»ô 16 ¦ì¤¸²Õ¡A©³¤U»¡©ú³o­Ó¹Lµ{¡C½Ð¬Ý¤U¹Ï¤@¡A·í¨t²Î§â±±¨îÅv¥æ¨ì hellow.exe ®É¡A¤]´N¬O¶i¤J Main ¥Dµ{¦¡®É¡A¨t²Î·|§âªð¦^¨t²Îªº¦ì§}¦s¤J°ïÅ|ªº 12FF58H ³B ( ¨t²Îªð¦^¦ì§}¥²¦s¦b°ïÅ|¦ì§}­Ó¦ì¼Æ¬O 8 ªº¦ì§}¤W )¡A¦¹®É RSP ¤]«ü¦V°ïÅ|ªº³o­Ó¦ì§}¡A¦Ó¤U¤@­ÓªÅªº°ïÅ| ( ¨ä¦ì§}¸û§C ) ´N¬O Main ªº°ïÅ|®Ø°_©l¦ì§}¡A¦ý³o®É¨Ã¤£ª¾¹D Main ·|©I¥s­þ¨Ç°Æµ{¦¡©Î API¡A¦]¦¹¤p¤ì°¸¦b¹Ï¤@¤Wªº°ïÅ|®Ø¨Ã¨S¦³µe¥X²×ÂI¦ì§}¡Cº¸«á Main ·|©I¥s MessageBoxA API¡A³o®É·|§âªð¦^ Main ªº¦ì§}¦s¨ì°ïÅ|³»ºÝ ( °ïÅ| 12FF28H ³B )¡A¦Ó MessageBoxA ¦³¥|­Ó°Ñ¼Æ¡A¨C­Ó°Ñ¼Æ¦û 8 ­Ó¦ì¤¸²Õ¡A¦]¦¹¶·«O¯d 32 ­Ó¦ì¤¸²Õ ( 32¡×20H ) µ¹³o¥|­Ó°Ñ¼Æ¡A©Ò¥H°ïÅ|³»ºÝ¬°ªð¦^¥Dµ{¦¡ªº¦ì§} ( °ïÅ| 12FF28H ³B )¡A±µ¤U¨Ó¤ñ¦¹ªð¦^¦ì§}°ªªº¥|­Ó¥|¦r²Õ¤À§Oµ¹ MessageBoxA Àx¦s°Ñ¼Æ¥Î¡A¥|­Ó°Ñ¼Æ¥[¤@­Óªð¦^¦ì§}¦@ 28H ­Ó¦ì¤¸²Õ¡C¦b Win64 ²Õ¦X»y¨¥¤¤¡AÁöµM«e¥|­Ó°Ñ¼Æ¥H¼È¦s¾¹¶Ç»¼¡A¦ý¬OÁÙ¬O±o«O¯d°ïÅ|ªÅ¶¡¡Aµ¹°Æµ{¦¡Àx¦s³o¥|­Ó°Ñ¼Æ¡A¦p¹Ï¤G¡B¤T©Ò¥Ü¡A¦¹®É©Ò«Ø¥ßªº°ïÅ|®Ø¥Ñ 12FF50 ¶}©l¡A¬O¹ï»ô¸`ªºÃä¬É¡A¨Ã¥B¨ì 12FF28 ¬°¤î¡C­Y MessageBoxA API ¤]©I¥s¨ä¥L API ªº¸Ü¡AMessageBoxA ·|§â©Ò»Ýªº°ïÅ|®Ø«Ø¥ß¦b 12FF20H ³B¡A¤]·|¹ï»ô¸`ªºÃä¬É¡C¦p¹Ï¤T©Ò¥Ü¡C


¬°¦ó RSP ­n´î¥h 28H ¦Ó¤£¬O´î¥h 20H ©Î¨ä¥L¼Æ©O¡H½Ð¬Ý¤W¹Ï¥|¡A§Ú­Ì¥i¥H·Q¹³¡A¦pªG¬O´î¥h 20H¡A¨º»ò MessageBoxA ¤º³¡©Ò«Ø¥ßªº°ïÅ|®Ø´N·|¥Ñ 12FF28H ¶}©l¡A³o¼Ë´N¨S¦³¹ï»ô¸`ªºÃä¬É¡A³o·|¤Þµo·í¾÷¡A¦]¦¹¹Ï¥|ªº´î¥h 20H ¬O¿ù»~ªº¡C¬G¦b°ïÅ|¤W¤£¯à¥u«O¯d 20H ­Ó¦ì¤¸²Õ¡A¥²¶·¦A¦h´î±¼¤@­Ó¥|¦r²Õ¤~¦æ¡C³o¼Ë¤@¨Ó¡AÁöµM°ïÅ|¤¤·|¦³¤@­Ó¥|¦r²ÕªºªÅ¶¡¨S¦³¨Ï¥Î¡A¦ý¬O¬J¯à«O¯d¨¬°÷ªº°ïÅ|ªÅ¶¡µ¹¥|­Ó°Ñ¼Æ¡A¤]¯à¹ï»ô¸`Ãä¬É¡C¦pªG RSP ´î¥h 38H¡B48H ©Î 58H ¬O§_¥i¦æ©O¡H±z¥i¥H¸Õ¸Õ¡I

±q¤W­±ªº¸Ñ»¡¡AÀ³¸Ó¥i¥Hª¾¹D¡A°²¦p©I¥sªº°Æµ{¦¡©Î API ¦³¥|­Ó°Ñ¼Æ¡A©Ò«O¯dªº°ïÅ|¬° 28H ­Ó¦ì¤¸²Õ¡F¦pªG¦³¤­­Ó°Ñ¼Æ¡A©Ò«O¯dªº°ïÅ|¤]¬O 28H ­Ó¦ì¤¸²Õ¡A¦]¬°¥|­Ó°Ñ¼Æ®É·|¦h¥X¤@­Ó¥|¦r²Õ¥¼¨Ï¥Î¡A«ê¦n´N¥i¥Hµ¹²Ä¤­­Ó°Ñ¼Æ¨Ï¥Î¡C¦pªG©I¥sªº°Æµ{¦¡¦³¤»­Ó°Ñ¼Æ¡A¨º»ò´NÀ³¸Ó«O¯d 38H¡F¦pªG¦³¤C­Ó°Ñ¼Æ¡A¤]À³«O¯d 38H¡C´«¥y¸Ü»¡¡A¦b°ïÅ|¤W©Ò«O¯dªºªÅ¶¡¤j¤p¬° 16n¡Ï8¡An »P°Ñ¼Æ­Ó¼Æ¦³Ãö¡A¦p¤Uªí©Ò¥Ü¡G
ªí¤@¡G°Ñ¼Æ­Ó¼Æ»P RSP «O¯d¤j¤p
°Ñ¼Æ­Ó¼ÆRSP ©ÒÀ³«O¯d¦ì¤¸²Õ¤j¤p °Ñ¼Æ­Ó¼ÆRSP ©ÒÀ³«O¯d¦ì¤¸²Õ¤j¤p
4 ©Î¤p©ó 428H 1058H
528H 1158H
638H 1268H
738H 1368H
848H 1478H
948H 1578H

Win64 ²Õ¦X»y¨¥¤¤¡A¥Dµ{¦¡±o¬°°Æµ{¦¡·Ç³Æ°Ñ¼Æ¶Ç»¼ªºªÅ¶¡¨Ã¥B²M°£°ïÅ|¡A©Ò¥H°²¨Ï¤@­Ó¥Dµ{¦¡·|©I¥s¦n´X­Ó°Æµ{¦¡®É¡A¨º»ò¥u»Ý¦Ò¼{©Ò»Ý°Ñ¼Æ³Ì¦hªº°Æµ{¦¡§Y¥i¡C³q±`¥u»Ý¦b¥Dµ{¦¡ªº³Ì«e­±¨Ï RSP ´î±¼¨¬°÷ªº¼Æ¡A¨Ã¯à¹ï»ô¸`Ãä¬É¡A¦Óµ²§ô¥Dµ{¦¡®É¦A¨Ï RSP ¥[¤W¸Ó¼Æ§Y¥i¡A¤¤¶¡«Ü¤Ö¦A§ïÅÜ RSP¡C¬°¤F¦A§ó²M·¡ªº»¡©ú¡y©I¥s¨ó©w¡z¨Ã¥B»¡©ú°Ñ¼Æ©Ò»ÝªÅ¶¡¡A¤p¤ì°¸·Q¦AÁ|¤@­Ó¨Ò¤l¡Ahellow1.asm¡C¥¦·|©I¥s¤@­Ó­pºâ¤C­Ó¾ã¼Æ©Mªº°Æµ{¦¡¡Aaddition¡A¦A§â­pºâµ²ªG¥Î MessageBoxA Åã¥Ü©ó¿Ã¹õ¤W¡C©³¤U¬O hellow1 °õ¦æµe­±¡G

©³¤U¬O hellow1.asm ªº­ì©l½X¡G

OPTION          CASEMAP:NONE
EXTRN           MessageBoxA:PROC
INCLUDELIB      user32.lib
MB_OK           EQU     0
;*******************************************************************************
.DATA
a1      QWORD   123456789abcdef0h
a2      QWORD   7777555533331111h
a3      QWORD   1444144414441444h
a4      QWORD   0f130f130f130f13h
a5      QWORD   22223333bbbb9999h
a6      QWORD   0000000000000001h
a7      QWORD   0000000000000002h
sum     QWORD   0                       ;0cf250258ad02acf4h
n       QWORD   0
szTitle BYTE    '©M',0
szText  BYTE    180 DUP (0)
;*******************************************************************************
.CODE
;-------------------------------------------------------------------------------
Sum     PROC
        mov     rax,rcx         ;¦s¤J²Ä¤@­Ó°Ñ¼Æ
        add     rax,rdx         ;¥[¤W²Ä¤G­Ó°Ñ¼Æ
        add     rax,r8          ;¥[¤W²Ä¤T­Ó°Ñ¼Æ
        add     rax,r9          ;¥[¤W²Ä¥|­Ó°Ñ¼Æ
        add     rax,[rsp+28h]   ;¥[¤W²Ä¤­­Ó°Ñ¼Æ
        add     rax,[rsp+30h]   ;¥[¤W²Ä¤»­Ó°Ñ¼Æ
        add     rax,[rsp+38h]   ;¥[¤W²Ä¤C­Ó°Ñ¼Æ
        ret
Sum     ENDP
;-------------------------------------------------------------------------------
;§âRCX¤ºªº¤Q¤»¶i¦ì¼ÆÂà´«¦¨¦r¦ê¡A¦s¦bRDX©Ò«üªº¦ì§}
;¿é¤J¡GRCX¡×¤Q¤»¶i¦ì¼Æ
;¡@¡@¡@RDX¡×¦r¦ê¦ì§}
;¿é¥X¡GRAX¡×¶ñ¤J³Ì«á¤@­ÓASCII¦r¤¸ªº¦ì§}¦A¥[¤@
RCX_To_String   PROC
        mov     [rsp+08h],rcx   ;¦b°ïÅ|¤¤¦s¤J²Ä¤@­Ó°Ñ¼Æ
        mov     [rsp+10h],rdx   ;¦b°ïÅ|¤¤¦s¤J²Ä¤G­Ó°Ñ¼Æ
        mov     r8,16
nxt:    rol     rcx,4
        mov     al,cl
        and     al,0fh
        add     al,'0'
        cmp     al,'9'
        jbe     ok
        add     al,7
ok:     mov     [rdx],al
        inc     rdx
        dec     r8
        jnz     nxt
        mov     BYTE PTR [rdx],'H'
        mov     rax,rdx
        inc     rax
        ret
RCX_To_String   ENDP
;-------------------------------------------------------------------------------
Start   PROC
        sub     rsp,38h
        mov     rax,a7
        mov     [rsp+30h],rax   ;²Ä¤C­Ó°Ñ¼Æ
        mov     rax,a6
        mov     [rsp+28h],rax   ;²Ä¤»­Ó°Ñ¼Æ
        mov     rax,a5
        mov     [rsp+20h],rax   ;²Ä¤­­Ó°Ñ¼Æ
        mov     r9,a4           ;²Ä¥|­Ó°Ñ¼Æ
        mov     r8,a3           ;²Ä¤T­Ó°Ñ¼Æ
        mov     rdx,a2          ;²Ä¤G­Ó°Ñ¼Æ
        mov     rcx,a1          ;²Ä¤@­Ó°Ñ¼Æ
        call    Sum
        mov     sum,rax

        mov     rax,OFFSET szText
nxt:    mov     r8,n            ;n¡×²Ä´X­Ó¼Æ
        shl     r8,3            ;¨C­Ó¥|¦r²Õ¦û¾Ú8­Ó¦ì¤¸²Õ¡A2ªº¥ß¤è¡×8
        mov     r9,OFFSET a1    ;¨C­Ó¼Æªº¦ì§}¦ba1¦ì§}¦A¥[¤W8*²Ä´X­Ó¼Æ
        add     r8,r9
        mov     rdx,rax
        mov     BYTE PTR [rdx],' '
        inc     rdx
        mov     rcx,[r8]
        call    RCX_To_String
        inc     n
        mov     WORD PTR [rax],0a0dh    ;´«¦æ
        add     rax,2
        cmp     n,7
        jne     nxt

        mov     BYTE PTR [rax-20],'+'
        mov     rcx,18                  ;¦L¥X¤@±ø½u
line:   mov     BYTE PTR [rax],'-'
        inc     rax
        loop    line
        mov     WORD PTR [rax],0a0dh    ;´«¦æ
        add     rax,2
        mov     rdx,rax
        mov     rcx,sum
        call    RCX_To_String           ;¦L¥X©M

        mov     r9,MB_OK
        mov     r8,OFFSET szTitle
        mov     rdx,OFFSET szText
        sub     rcx,rcx
        call    MessageBoxA
        add     rsp,38h
        sub     rax,rax
        ret
Start   ENDP
;*******************************************************************************
        END

HELLOW1.ASM ªº¥Dµ{¦¡¡AStart¡A·|©I¥s¨â­Ó°Æµ{¦¡¤Î¤@­Ó API¡A³o¨â­Ó°Æµ{¦¡¬O SumOf ©M RCX_To_String¡A«eªÌ¬O­pºâ¤C­Ó¾ã¼Æªº©M¡A»Ý­n¿é¤J¤C­Ó°Ñ¼Æ¡F«áªÌ¬O§â RCX ¼È¦s¾¹¤§¼Æ­ÈÅܦ¨ ASCII ¦r¦ê¦s¦b RDX ©Ò«ü©wªº¦ì§}¡A»Ý­n¨â­Ó°Ñ¼Æ¡C¦¹¥~¡AStart ÁÙ·|©I¥s MessageBoxA API¡A¥¦»Ý­n¥|­Ó°Ñ¼Æ¡Cºî¦X©Ò©I¥sªº°Æµ{¦¡©Î API¡A±oª¾ SumOf ©Ò»Ý°Ñ¼Æ³Ì¦h¡A©Ò¥H Start ¥u»Ý°w¹ï¤C­Ó°Ñ¼Æ·Ç³Æ©Ò»Ý°ïÅ|§Y¥i¡A¦]¦¹±z¥i¥H¦b Start °Æµ{¦¡ªº¶}©l»Pµ²§ô¬Ý¨ì

        sub     rsp,38h
        ¡K      ¡K¡K
        add     rsp,38h

¬°¤°»ò­n«O¯d 38H ­Ó¦ì¤¸²Õ©O¡H¤U¹Ï¤­¬O­è¶i¤J Start ¥Dµ{¦¡®Éªº°ïÅ|±¡§Î¡A¦b°ïÅ| 12FF58H ¦ì§}ªºªð¦^¦ì§}¬O hellow1 µ²§ô«á¡Aªð¦^¨ì¨t²Îªº¦ì§}¡A¦Ó RSP ¤]¬O«ü¦V³o­Ó¦ì§}¡C±µ¤U¨Ó¬O«O¯d 38H ªº°ïÅ|ªÅ¶¡µ¹°Ñ¼Æ¨Ï¥Î¡A12FF58H ´î¥h 38H ¬O 12FF20H¡A¬G RSP Åܬ° 12FF20H¡C¦b±µ¤U¨Óªº´X¦æ¡G

        mov     rax,a7
        mov     [rsp+30h],rax   ;²Ä¤C­Ó°Ñ¼Æ
        mov     rax,a6
        mov     [rsp+28h],rax   ;²Ä¤»­Ó°Ñ¼Æ
        mov     rax,a5
        mov     [rsp+20h],rax   ;²Ä¤­­Ó°Ñ¼Æ

¬O§â²Ä¤­¡B¤»¡B¤C­Ó°Ñ¼Æ²¾¨ì°ïÅ|ùØ¡C¥Ñ¹Ï¤»¨Ó¬Ý¡A²Ä¤­¡B¤»¡B¤C­Ó°Ñ¼Æ¤À§O©ñ¦b¦ì§} RSP¡Ï20H¡BRSP¡Ï28H¡BRSP¡Ï30H¡A¦]¦¹¤p¤ì°¸§Q¥Î MOV «ü¥O§â°Ñ¼Æ¦s¤J¾A·í°ïÅ|¦ì§}¡C±µ¤U¨Óªº¥|¦æ¬O§â²Ä¥|¡B¤T¡B¤G¡B¤@­Ó°Ñ¼Æ¤À§O¦s¦b R9¡BR8¡BRDX¡BRCX ¼È¦s¾¹¤¤¡C¤U¤@­Ó«ü¥O¬O¡ycall SumOf¡z¡ACALL ·|¨Ï CPU ªº RSP ´î¥h 8 ­Ó¦ì¤¸²Õ¡A¦A§âªð¦^¦ì§} ( ¹Ï¤C¥H¶À¦â¼Ð©úªºªð¦^¦ì§} )¡A§Y¡ymov sum,rax¡z©Ò¦b¦ì§}¡A¦s¤J°ïÅ|¡A¨Ã¥B¨Ï RIP «ü¦V SumOf °Æµ{¦¡©Ò¦b¦ì§}¡A©ó¬O«K¶i¤J SumOf °Æµ{¦¡¤F¡CSumOf °Æµ{¦¡ªº°ïÅ|®Ø·|«Ø¥ß¦b 12FF10H ³B¡A¹ï»ô¸`Ãä¬É¡C

¦b SumOf °Æµ{¦¡ùØ­nŪ¨ú¤C­Ó°Ñ¼Æ¨Ã¨Ï¥¦­Ì¬Û¥[¡A«e¥|­Ó°Ñ¼Æ¦b¼È¦s¾¹¤¤¡A¦ý¬O«á¤T­Ó°Ñ¼Æ¥²¶·¨ì°ïÅ|¤¤¨ú¥X¡C¥Ñ©ó RSP ©Ò«ü¦ì§}¦b¶i¤J SumOf ªº«e«á¤£¦P¡A¦]¦¹±z¥i¥H¬Ý¨ì²Ä¤­­Ó°Ñ¼Æ¬O¦b RSP¡Ï28H ( ¦b¥Dµ{¦¡¡AStart¡A§â²Ä¤­­Ó°Ñ¼Æ¦s¤J°ïÅ|®É¡A¬O¥Î¡umov [rsp+20h],rax¡v¦b°Æµ{¦¡¥[¤W²Ä¤­­Ó°Ñ¼Æ¬O¥Î¡uadd rax,[rsp+28h]¡v)¡A¦p¤W¹Ï¤C»P¤U­±µ{¦¡¤ù¬q¡G

        add     rax,[rsp+28h]   ;¥[¤W²Ä¤­­Ó°Ñ¼Æ
        add     rax,[rsp+30h]   ;¥[¤W²Ä¤»­Ó°Ñ¼Æ
        add     rax,[rsp+38h]   ;¥[¤W²Ä¤C­Ó°Ñ¼Æ

¤@¯ë¦Ó¨¥¡A¦pªG°Æµ{¦¡¥\¯à«Ü¦h¡A¨º»ò«Ü¥i¯à·|¥Î¨ì³\¦h¼È¦s¾¹¡A³o®É­Ô´N»Ý­n§â«e¥|­Ó°Ñ¼Æ¦s©ñ¨ì°ïÅ|ùؤF¡A³o¤j·§¤]´N¬O­n¦b°ïÅ|ùØ«O¦s«e¥|­Ó°Ñ¼Æªº­ì¦]¤F¡C¤£¹L SumOf °Æµ{¦¡«Ü²³æ¡A¨Ã¤£»Ý­n§â³o¥|­Ó°Ñ¼Æ²¾¨ì°ïÅ|ùØ¡C§Y¨Ï³o¼Ë¡A¤p¤ì°¸ÁÙ¬O¿í´` Win64 µ{¦¡ªº¼gªk¡C±µ¤U¨Ó°õ¦æ ret °h¥X SumOf °Æµ{¦¡¡Aªð¦^¨ì¥Dµ{¦¡¤¤¡C³o®É­Ô RSP «K¥[¤W 8¡A«ü¨ì°ïÅ|¦ì§} 12FF20 ³B¡A³o®É°ïÅ|ªº¨Ï¥Î±¡§Î´N¦p¦P«e­±ÁÙ¨S¦³°õ¦æ SumOf «eªº±¡§Î¤@¼Ë¡A°ß¤@¤£¦Pªº¬O°ïÅ|¤w¦³¨¬°÷ªºªÅ¶¡¥i®e¯Ç RCX_To_String °Æµ{¦¡ªº°Ñ¼Æ¡A¦p¤W¹Ï¤K¡C

RCX_To_String ­n°õ¦æ¤K¦¸¡A«e¤C¦¸¬O§â­n°µ¥[ªkªº¤C­Ó¼ÆÅܦ¨ ASCII ¦r¤¸¡A¦s©ó RDX ©Ò«üªº¦ì§}¡F³Ì«á¤@¦¸«h¬O§â©MÅܦ¨ ASCII ¦r¦ê¡C¨C¦¸¦b©I¥s RCX_To_String «e¡A°ïÅ|±¡§Î³£¦p¤W¹Ï¤K¡A°ïÅ|ùتº RCX¡BRDX ¥u¬O¹w¯d¦s¤J°Ñ¼ÆªºªÅ¶¡¡C¶i¤J¦¹°Æµ{¦¡®É¡ARSP ·|´î¥h 8¡A´N¦p¤W¹Ï¤C¡A«ü¦V 12FF18H¡A¥u¬O°ïÅ|¦ì§}ªº 12FF30¡ã12FF50H ³£¨S¥Î¨ì¡A·í°h¥X¦¹°Æµ{¦¡®É¤S«ì´_Åܦ¨¹Ï¤Kªº¼Ë¤l¡C¦b RCX_To_String °Æµ{¦¡¤¤¡A¤p¤ì°¸®i¥Ü¤F§â°Ñ¼Æ¦s¦b°Æµ{¦¡ªº¤èªk¡A§Y²Ä¤@­Ó°Ñ¼Æ¦s¦b RSP¡Ï8H ³B¡A²Ä¤G­Ó°Ñ¼Æ¦s¦b RSP¡Ï10H ³B¡AÁöµM¦b hellow1 µ{¦¡¤¤¨Ã¨S¦³¥Î¡A¦ý¬O¦b¨ä¥L½ÆÂøªº°Æµ{¦¡¡A¦pªG­nÀx¦s°Ñ¼Æ¡AÀ³¸Ó´N¬O³o¼Ë°µ¤F¡C

¥Ñ¤W­±ªº»¡©ú¡A¦b Win64 ²Õ¦X»y¨¥ùØ¡A°ïÅ|ªº¨Ï¥Î±¡§Î¤j­P¥i¥H»¡¬O³o¼Ëªº¡G©I¥s«e¡A§â«e¥|­Ó°Ñ¼Æ¦s¤J RCX¡BRDX¡BR8¡BR9 ¼È¦s¾¹ùØ¡A²Ä¤­­Ó°Ñ¼Æ¦s©ó RSP¡Ï20H¡B²Ä¤»­Ó°Ñ¼Æ¦s©ó RSP¡Ï28H¡K¡KùØ¡A¦p¤U¹Ï¥ª¡C°õ¦æ CALL «ü¥O«á¡A´N¶i¤J¤F°Æµ{¦¡¡A¦p¦³¥²­nÀ³¥ý§â²Ä¤@­Ó°Ñ¼Æ¦s¨ì RSP¡Ï8h¡A²Ä¤G­Ó°Ñ¼Æ¦s¨ì RSP¡Ï10h¡K¡K¡C³o®É¥i¤À¬°¨âºØ±¡§Î¡A²Ä¤@ºØ±¡§Î¤ñ¸û³æ¯Â¡A³o­Ó°Æµ{¦¡¬° leaf function ( leaf function ¬O«ü¤£©I¥s¨ä¥L°Æµ{¦¡©Î API ªº°Æµ{¦¡¡A´N¦p¦P hellow1 ùتº SumOf ©Î RCX_To_String )¡ARSP ¤£»Ý­n¦A½Õ¾ã¡A©Ò¥H°²¦p­nŪ¨ú²Ä¤­­Ó°Ñ¼Æ¡A±oŪ¨ú RSP¡Ï28h¡A­nŪ¨ú²Ä¤»­Ó°Ñ¼Æ¡A±oŪ¨ú RSP¡Ï30h¡F¦¹¥~¤]¥i¥H³]©w°Ï°ìÅܼơA²Ä¤@­Ó°Ï°ìÅܼƦb RSP¡Ð8h¡A²Ä¤G­Ó°Ï°ìÅܼƦb RSP¡Ð10h¡A¦p¤U¹Ï¥k¡G


²Ä¤GºØ±¡§Î¬O¦¹°Æµ{¦¡¬° non leaf function ( ªí¥Ü³oºØ°Æµ{¦¡·|©I¥s¨ä¥L°Æµ{¦¡©Î API¡A´N¦p¦P hellow1 ¤¤ªº Start ¥Dµ{¦¡ )¡ARSP ¥²¶·¦A´î¥h 16n¡Ï8 ­Ó¦ì¤¸²Õ¡A¥H®e¯Ç°Ñ¼Æ¡C¦b³oºØ±¡§Î¤§¤U¡A¦pªG­n¦b°ïÅ|¤¤«O¦s¬Y¨Ç¼È¦s¾¹¡A©Î¬O¦³°Ï°ìÅܼƮɡARSP ¤S¥²¶·¦A´î¥h­Y¤z¦ì¤¸²Õ¡A¦ýµL½×¦p¦ó¡AÁ`¬O­n³]ªk¨Ï°ïÅ|®Ø¦b¸`Ãä¬Éªº¦ì§}¤W¹ï»ô¡C

¼¶¼g Win64 ²Õ¦X»y¨¥¨ä¥Lª`·N¨Æ¶µ

§Ú·Q²Õ¦X»y¨¥¼¶¼g Win64 µ{¦¡¡A³Ì¤£©ö¤F¸ÑªºÀ³¸Ó´N¬O¤W­±©Ò´y­zªº©I¥s¨ó©w¡A°£¦¹¤§¥~ÁÙ¦³¤@¨Ç¥½¸`»Ý­n¿í¦u¡G

  1. °Æµ{¦¡¤º¥i¥H§ïÅÜ RAX¡BRCX¡BRDX¡BR8¡BR9¡BR10¡BR11 µ¥¤C­Ó¼È¦s¾¹¤§­È¡AºÙ³o¨Ç¼È¦s¾¹¬° volatile¡F¦Ó¼È¦s¾¹ RBX¡BRBP¡BRSI¡BRDI¡BR12¡BR13¡BR14¡BR15 «h¤£¥i§ó§ï¡AºÙ¬° non-volatile¡A¦pªG¤@©w­n¨Ï¥Î non-volatile ¼È¦s¾¹¡AÀ³¸Ó¶i¤J°Æµ{¦¡«á¡A¥ý¦s©ó°ïÅ|¡C
  2. ³q±`°Ñ¼Æªø«×À³¬°¤@­Ó¥|¦r²Õ ( QWORD¡A§Y 64 ¦ì¤¸ )¡A¦pªG¤£¨ì 64 ¦ì¤¸¡A¸û°ªªºÂù¦r²Õ¤£¥Î¡A¤@¯ë³]¬°¹s¡C

¥H WinDbg °£¿ù

WinDbg ¥i¥H¨Ï¥Î­ì©l½XªºÅܼƦWºÙ¡B°Æµ{¦¡¦WºÙ¡A¦pªG­n³o¼Ë°µªº¸Ü¡A¥²»Ý¦b²ÕĶ®É§â³o¨Ç¸ê®Æ¼g¶i PDB Àɤº¡A­Y¥H²ÕĶ hellow.asm ±o¥Î¤U­±ªº¤èªk²ÕĶ¡G

ml64 /Zi hellow.asm /link /entry:Main

³o¼Ëªº¸Ü¡A´N·|»s³y¥X HELLOW.PDB ÀɮסC¶}±Ò WinDbg «á¡A¥H·Æ¹«¿ï¾Ü¼u¥X¿ï³æ¡yFile¡z¡B¡yOpen Executable¡z( ¤]¥i¥Hª½±µ«ö§Ö±¶Áä¡ACtrl¡ÐE )¡A¦p¤U¹Ï©Ò¥Ü¡A±µ¤U¨Ó·|¸õ¥X¤@­Ó¹ï¸Ü²°¡A¿ï¾Ü HELLOW.EXE ÀɧY¥i¡G

·í¿ï¦n HELLOW.EXE «á¡A´N·|²£¥Í¨â­Ó¤lµøµ¡¡yCommand¡zµøµ¡¥H¤Î­ì©l½Xµøµ¡¡A¦p¤U¹Ï¡CCommand µøµ¡¥i¤À¬°¤T³¡¥÷¡A¥k¤U¨¤ªº¬õ®Ø³¡¥÷¬O©¹«áªº°£¿ù¤u§@®É¿é¤J©R¥O©Ò¦b¡A¨Ò¦p¡G«ü©w¤¤Â_ÂI¡B³æ¨B°lÂÜ¡B°õ¦æ¡K¡Kµ¥³£¦b³o­Ó¬õ®Ø¿é¤J©R¥O¡C±z¥i¥H¬Ý¨ì³o­Óµøµ¡ªº¥ª¤U¨¤¥Îºñ®Ø®Ø¦í¡A¦³¡y0:000¡z³o¼Ëªº¦r¼Ë¡A³Ì¥ªÃ䪺¡y0¡z¥Nªí¡yµ{¦¡¡z(process) ½s¸¹¡A¥kÃ䪺¡y000¡z¥Nªí¡y°õ¦æºü¡z½s¸¹¡C¡yCommand¡zµøµ¡ªº³Ì¤j³¡¤À¡A¥ÎÂÅ®Ø®Ø¦íªº¬O¿é¥Xªºµ²ªG¡C¤@¯ë¨Ó»¡¡AWin64 µ{¦¡ªºµ{¦¡½X¥Ñ¦ì§} 140001000H ³B¶}©l¡A¦]¦¹§Ú­Ì¥i¥H¦bÄæ®Ø³¡¥÷¿é¤J¡yu 140001000¡z«ü¥O¡A¨Ã«ö¤U¡yEnter¡zÁä¡A´N¯à°÷Æ[¹î§Ú­Ì©Ò¼gªºµ{¦¡½X¡CWinDbg ªº«ü¥O»P¥H«e DOS ªº Debug «ü¥O¦³³¡¥÷¬Û¦P¡A¹ï¤p¤ì°¸¦Ó¨¥¡A¥i»¡¬O¾r»´´N¼ô¡C³o­Ó¡yu¡z«ü¥O¬O¡yunassembly¡zªº·N«ä¡A¥ç§Y¤Ï²ÕĶ¡C
§Ú­Ì¤]¥i¥H¥H·Æ¹«©ì¦² Command µøµ¡¨ì WinDbg µøµ¡¤Wªu¡A³o¼Ëªº¸Ü¡ACommand µøµ¡´N·|»P­ì©l½Xµøµ¡¤À³Î WinDbg µøµ¡¡A¦Ó¤£·|¤¬¬Û¾B±»¡C¦b°£¿ù¹Lµ{¡A§Ú­Ì¤]«Ü§Æ±æ¯à¨£¨ì¨ä¥L¸ê®Æ¡A¦p¼È¦s¾¹ªºÅܤơA¥i¥H¨ì¡yView¡z¡yRegisters¡z¥s¥X¼È¦s¾¹µøµ¡¡A¦p¤U¹Ï¡G
§Ú­Ì¥i¥H¦pªk¬¶»s¡A§â·Æ¹«´å¼Ð²¾¨ì³o¨Ç¤lµøµ¡ªº¼ÐÃDÄæ¡AµM«á«ö¦í·Æ¹«¥ªÁ䤣©ñ¡A©ì¦²³o¨Ç¤lµøµ¡¨ì WinDbg ªº¤Wªu©Î¥ª¡B¥kªu¨Ó½Õ¾ã³o¨Ç¤lµøµ¡¦ì¸m¡F¤]¥i¥H§â·Æ¹«´å¼Ð²¾¨ì¤lµøµ¡Ãä½u¤W¡A¦p¤U¹Ïµµ¦â½u¤W¡A«ö¦í¥ªÁ䤣©ñ¡A½Õ¾ã¥L­Ìªº¤j¤p¡A¦p¤U¹Ï¡G
¤W¹Ïªº Command µøµ¡¤¤¡A¥HÂÅ®Ø®Ø¦íªº³¡¥÷¡AÅã¥Ü¤F­è­è§Ú­Ì¤Ï²ÕĶªºµ²ªG¡A²{¦bÅý§Ú­Ì¦b¬õ®Øªº¦a¤è¿é¤J«ü¥O¡yu 140001010¡z¡A«ö¤U¡yEnter¡zÁä¡A´N¥i¥H¦b¤U¹ÏÂÅ®Ø®Ø¦íªº³¡¥÷¬Ý¨ì¯u¥¿ªºµ{¦¡½X¡C·Ó²z¨Ó»¡¡Aµ{¦¡½XÀ³¸Ó¬O¦b 140001000H ³B¡A¦ý¬O¦]¬°¥[¤W¤F°£¿ù¸ê®Æ¡A©Ò¥Hµ{¦¡½X¦ì§}¦b 140001010H¡A¦ÓÂŮتº³¡¥÷¬O²ÕĶ¾¹¦Û¦æ¥[¤W¥hªº¡C§Ú­Ì¥i¥H¥Ñ¤W¹Ï¤¤¡Aºñ®Øªº³¡¥÷ª¾¹D¡A¯u¥¿ªºµ{¦¡½X¬O¦b 140001010H ³B¡A©Ò¥H§Ú­Ì±µµÛ¿é¤J¡yg 140001010¡z¡Aªí¥Ü¨Ï WinDbg °õ¦æ¨ì¦ì§} 140001010H ³B°±¤î¡A¦p¤U¹Ï
¿é¤J§¹¡yg 140001010¡z«á§O§Ñ°O«ö¤U¡yEnter¡zÁä¡A´N·|¬Ý¨ì¤U¹Ïªºµ²ªG¡Aª`·N¨ì­ì©l½X¤lµøµ¡ªº¡yMain PROC¡zÅܦ¨ÂÅ©³¥Õ¦r¡Aªí¥Ü WinDbg °õ¦æ¨ì³o¨à¤F¡F¦Ó¼È¦s¾¹¤lµøµ¡ªº¬Y¨Ç¼È¦s¾¹Åܬõ¦r¡Aªí¥Ü³o¨Ç¼È¦s¾¹ªº¼Æ­È§ó°Ê¤F¡A¦p¤U¹Ï¡G
±µ¤U¨Ó¡A«ö¤U§Ö±¶Áä¡yF8¡z¡A¡yF8¡zÁäªí¥Ü³æ¨B°lÂÜ¡A¥ç§Y¨C°õ¦æ¤@­Ó«ü¥O´N°±¤U¨Ó¡A©ÎªÌ¤]¥i¥H¦b Command ¤lµøµ¡¿é¤J¡yt¡z( trace )¡AWinDbg °õ¦æ¡ysub rsp,28h¡z³o¹D«ü¥O¡A¦b¤U¹Ï¡A¥i¥H¨£¨ì RSP ¼È¦s¾¹Åܦ¨ 12FF30H ¤F¡G
¨ä¥Lªº³¡¤À¡AÁo©úªº±z¥i¤@¤@¸Õ±´¡I


°Ï°ìÅܼÆ

¦b Win64 ²Õ¦X»y¨¥°Æµ{¦¡¤¤¡A¬O§_¥i¥H¥Î LOCAL «Å§i°Ï°ìÅܼƩO¡Hµª®×¬O¥i¥Hªº¡C¨Ï¥Î®É LOCAL ¥²©w­n¸ò¦b PROC °²«ü¥O¤§«á¡A¨ä»yªk»P MASM 6.x ¤@¼Ë¡G( ¥i¥H°Ñ¦Ò Win32 ²Õ¦X»y¨¥²Ä¤T³¹¦³Ãö°Ï°ìÅܼƪº³¡¥÷ )

LOCAL   ÅܼƦW[­«½Æ¦¸¼Æ]:¸ê®Æ«¬ºA

¤p¤ì°¸§â¤W­±ªº HELLOW1.ASM ªº¥Dµ{¦¡¡AStart¡A¤¤ªº¨â­Ó¥þ°ìÅܼơAn »P sum¡A§ï¦¨°Ï°ìÅܼơA­ì©l½XÅܦ¨ HELLOW2.ASM¡C©³¤U¥H¥Õ¦â¦r¼Ð¥Üªº³¡¥÷´N¬O«Å§i°Ï°ìÅܼƪº¦a¤è¡G

OPTION          CASEMAP:NONE
EXTRN           MessageBoxA:PROC
INCLUDELIB      user32.lib
MB_OK           EQU     0

;*******************************************************************************
.DATA
a1      QWORD   123456789abcdef0h	;²Ä¤@­Ó°Ñ¼Æ
a2      QWORD   7777555533331111h	;²Ä¤G­Ó°Ñ¼Æ
a3      QWORD   1444144414441444h	;²Ä¤T­Ó°Ñ¼Æ
a4      QWORD   0f130f130f130f13h	;²Ä¥|­Ó°Ñ¼Æ
a5      QWORD   22223333bbbb9999h	;²Ä¤­­Ó°Ñ¼Æ
a6      QWORD   0000000000000001h	;²Ä¤»­Ó°Ñ¼Æ
a7      QWORD   0000000000000002h	;²Ä¤C­Ó°Ñ¼Æ
szTitle BYTE    '©M',0
szText  BYTE    180 DUP (0)
;*******************************************************************************
.CODE
;-------------------------------------------------------------------------------
Sum     PROC
        mov     rax,rcx         ;¦s¤J²Ä¤@­Ó°Ñ¼Æ
        add     rax,rdx         ;¥[¤W²Ä¤G­Ó°Ñ¼Æ
        add     rax,r8          ;¥[¤W²Ä¤T­Ó°Ñ¼Æ
        add     rax,r9          ;¥[¤W²Ä¥|­Ó°Ñ¼Æ
        add     rax,[rsp+28h]   ;¥[¤W²Ä¤­­Ó°Ñ¼Æ
        add     rax,[rsp+30h]   ;¥[¤W²Ä¤»­Ó°Ñ¼Æ
        add     rax,[rsp+38h]   ;¥[¤W²Ä¤C­Ó°Ñ¼Æ
        ret
Sum     ENDP
;-------------------------------------------------------------------------------
;§âRCX¤ºªº¤Q¤»¶i¦ì¼ÆÂà´«¦¨¦r¦ê¡A¦s¦bRDX©Ò«üªº¦ì§}
RCX_To_String   PROC
        mov     [rsp+08h],rcx   ;¦b°ïÅ|¤¤¦s¤J²Ä¤@­Ó°Ñ¼Æ
        mov     [rsp+10h],rdx   ;¦b°ïÅ|¤¤¦s¤J²Ä¤G­Ó°Ñ¼Æ
        mov     r8,16
nxt:    rol     rcx,4
        mov     al,cl
        and     al,0fh
        add     al,'0'
        cmp     al,'9'
        jbe     ok
        add     al,7
ok:     mov     [rdx],al
        inc     rdx
        dec     r8
        jnz     nxt
        mov     BYTE PTR [rdx],'H'
        mov     rax,rdx
        inc     rax
        ret
RCX_To_String   ENDP
;-------------------------------------------------------------------------------
Start   PROC    USES rbx rsi            ;«O¦sRBX¡BRSI¼È¦s¾¹
        LOCAL   sum:QWORD,n:QWORD       ;³]©w¨â­Ó°Ï°ìÅܼÆsum¡Bn
        sub     rsp,40h
        mov     rax,a7
        mov     [rsp+30h],rax   ;²Ä¤C­Ó°Ñ¼Æ
        mov     rax,a6
        mov     [rsp+28h],rax   ;²Ä¤»­Ó°Ñ¼Æ
        mov     rax,a5
        mov     [rsp+20h],rax   ;²Ä¤­­Ó°Ñ¼Æ
        mov     r9,a4           ;²Ä¥|­Ó°Ñ¼Æ
        mov     r8,a3           ;²Ä¤T­Ó°Ñ¼Æ
        mov     rdx,a2          ;²Ä¤G­Ó°Ñ¼Æ
        mov     rcx,a1          ;²Ä¤@­Ó°Ñ¼Æ
        call    Sum
        mov     sum,rax

        mov     n,0
        mov     rax,OFFSET szText
nxt:    mov     r8,n
        shl     r8,3
        mov     r9,OFFSET a1
        add     r8,r9
        mov     rdx,rax
        mov     BYTE PTR [rdx],' '
        inc     rdx
        mov     rcx,[r8]
        call    RCX_To_String
        inc     n
        mov     WORD PTR [rax],0a0dh
        add     rax,2
        cmp     n,7
        jne     nxt
        mov     BYTE PTR [rax-20],'+'
        mov     rcx,18
line:   mov     BYTE PTR [rax],'-'
        inc     rax
        loop    line
        mov     WORD PTR [rax],0a0dh
        add     rax,2
        mov     rdx,rax
        mov     rcx,sum
        call    RCX_To_String

        mov     r9,MB_OK
        mov     r8,OFFSET szTitle
        mov     rdx,OFFSET szText
        sub     rcx,rcx
        call    MessageBoxA
        add     rsp,40h
        sub     rax,rax
        ret
Start   ENDP
;*******************************************************************************
        END

²ÕĶ®É¡A¤£¥[¡y/Zi¡z°Ñ¼Æ¡A¥H¡yml64 hellow2.asm /link /entry:Start¡z²ÕĶ¡A¦A¥Î WinDbg ¸ü¤J¡C¥ýÆ[¹î²ÕĶ«áÅܦ¨¤°»ò¼Ë¤l¡A¿é¤J¡yu 140001000 14000114a¡z( ©³¤U¶À¦rªº³¡¤À¬O¥²¶·¥´¦rªº³¡¤À¡A¥B­n°O±o¥[¤W Enter Áä )¡G

0:000> u 140001000 14000114a [Enter]
image00000001_40000000+0x1000:
00000001`40001000 488bc1               mov     rax,rcx
00000001`40001003 4803c2               add     rax,rdx
00000001`40001006 4903c0               add     rax,r8
00000001`40001009 4903c1               add     rax,r9
00000001`4000100c 4803442428           add     rax,qword ptr [rsp+28h]
00000001`40001011 4803442430           add     rax,qword ptr [rsp+30h]
00000001`40001016 4803442438           add     rax,qword ptr [rsp+38h]
00000001`4000101b c3                   ret
00000001`4000101c 48894c2408           mov     qword ptr [rsp+8],rcx
00000001`40001021 4889542410           mov     qword ptr [rsp+10h],rdx
00000001`40001026 49c7c010000000       mov     r8,10h
00000001`4000102d 48c1c104             rol     rcx,4
00000001`40001031 8ac1                 mov     al,cl
00000001`40001033 240f                 and     al,0Fh
00000001`40001035 0430                 add     al,30h
00000001`40001037 3c39                 cmp     al,39h
00000001`40001039 7602                 jbe     image00000001_40000000+0x103d (00000001`4000103d)
00000001`4000103b 0407                 add     al,7
00000001`4000103d 8802                 mov     byte ptr [rdx],al
00000001`4000103f 48ffc2               inc     rdx
00000001`40001042 49ffc8               dec     r8
00000001`40001045 75e6                 jne     image00000001_40000000+0x102d (00000001`4000102d)
00000001`40001047 c60248               mov     byte ptr [rdx],48h
00000001`4000104a 488bc2               mov     rax,rdx
00000001`4000104d 48ffc0               inc     rax
00000001`40001050 c3                   ret
00000001`40001051 55                   push    rbp
00000001`40001052 488bec               mov     rbp,rsp
00000001`40001055 4883c4f0             add     rsp,0FFFFFFFFFFFFFFF0h
00000001`40001059 53                   push    rbx
00000001`4000105a 56                   push    rsi
00000001`4000105b 4883ec40             sub     rsp,40h
00000001`4000105f 488b05ca1f0000       mov     rax,qword ptr [image00000001_40000000+0x3030 (00000001`40003030)]
00000001`40001066 4889442430           mov     qword ptr [rsp+30h],rax
00000001`4000106b 488b05b61f0000       mov     rax,qword ptr [image00000001_40000000+0x3028 (00000001`40003028)]
00000001`40001072 4889442428           mov     qword ptr [rsp+28h],rax
00000001`40001077 488b05a21f0000       mov     rax,qword ptr [image00000001_40000000+0x3020 (00000001`40003020)]
00000001`4000107e 4889442420           mov     qword ptr [rsp+20h],rax
00000001`40001083 4c8b0d8e1f0000       mov     r9,qword ptr [image00000001_40000000+0x3018 (00000001`40003018)]
00000001`4000108a 4c8b057f1f0000       mov     r8,qword ptr [image00000001_40000000+0x3010 (00000001`40003010)]
00000001`40001091 488b15701f0000       mov     rdx,qword ptr [image00000001_40000000+0x3008 (00000001`40003008)]
00000001`40001098 488b0d611f0000       mov     rcx,qword ptr [image00000001_40000000+0x3000 (00000001`40003000)]
00000001`4000109f e85cffffff           call    image00000001_40000000+0x1000 (00000001`40001000)
00000001`400010a4 488945f8             mov     qword ptr [rbp-8],rax
00000001`400010a8 48c745f000000000     mov     qword ptr [rbp-10h],0
00000001`400010b0 48b83b30004001000000 mov     rax,offset image00000001_40000000+0x303b (00000001`4000303b)
00000001`400010ba 4c8b45f0             mov     r8,qword ptr [rbp-10h]
00000001`400010be 49c1e003             shl     r8,3
00000001`400010c2 49b90030004001000000 mov     r9,offset image00000001_40000000+0x3000 (00000001`40003000)
00000001`400010cc 4d03c1               add     r8,r9
00000001`400010cf 488bd0               mov     rdx,rax
00000001`400010d2 c60220               mov     byte ptr [rdx],20h
00000001`400010d5 48ffc2               inc     rdx
00000001`400010d8 498b08               mov     rcx,qword ptr [r8]
00000001`400010db e83cffffff           call    image00000001_40000000+0x101c (00000001`4000101c)
00000001`400010e0 48ff45f0             inc     qword ptr [rbp-10h]
00000001`400010e4 66c7000d0a           mov     word ptr [rax],0A0Dh
00000001`400010e9 4883c002             add     rax,2
00000001`400010ed 48837df007           cmp     qword ptr [rbp-10h],7
00000001`400010f2 75c6                 jne     image00000001_40000000+0x10ba (00000001`400010ba)
00000001`400010f4 c640ec2b             mov     byte ptr [rax-14h],2Bh
00000001`400010f8 48c7c112000000       mov     rcx,12h
00000001`400010ff c6002d               mov     byte ptr [rax],2Dh
00000001`40001102 48ffc0               inc     rax
00000001`40001105 e2f8                 loop    image00000001_40000000+0x10ff (00000001`400010ff)
00000001`40001107 66c7000d0a           mov     word ptr [rax],0A0Dh
00000001`4000110c 4883c002             add     rax,2
00000001`40001110 488bd0               mov     rdx,rax
00000001`40001113 488b4df8             mov     rcx,qword ptr [rbp-8]
00000001`40001117 e800ffffff           call    image00000001_40000000+0x101c (00000001`4000101c)
00000001`4000111c 49c7c100000000       mov     r9,0
00000001`40001123 49b83830004001000000 mov     r8,offset image00000001_40000000+0x3038 (00000001`40003038)
00000001`4000112d 48ba3b30004001000000 mov     rdx,offset image00000001_40000000+0x303b (00000001`4000303b)
00000001`40001137 482bc9               sub     rcx,rcx
00000001`4000113a e80b000000           call    image00000001_40000000+0x114a (00000001`4000114a)
00000001`4000113f 4883c440             add     rsp,40h
00000001`40001143 482bc0               sub     rax,rax
00000001`40001146 5e                   pop     rsi
00000001`40001147 5b                   pop     rbx
00000001`40001148 c9                   leave
00000001`40001149 c3                   ret
00000001`4000114a ff25b00e0000         jmp     qword ptr [image00000001_40000000+0x2000 (00000001`40002000)]

«Ü©úÅ㪺¬Ý¨ì¡A¥Dµ{¦¡¥Ñ 140001051 ³B¶}©l¡A¤]´N¬O¤p¤ì°¸¥H¥Õ¦â¦r¼Ð¥Ü¥X¨Óªº¨º¤T¦æ¶}©l¡C³o¤T¦æ«ü¥O¤]¬O LOCAL °²«ü¥O³Q²ÕĶ¾¹²ÕĶªºµ²ªG¡A±µµÛªº¨â¦æ¥Î¦Ç¦â¦rªí¥Üªº¬O PROC ¥[¤W USES ²ÕĶ«áªºµ²ªG¡C¥Ñ WinDbg ¤Ï²ÕĶµ²ªG¨Ó¬Ý¡A¥iª¾·í ML64.EXE ¹J¨ì LOCAL °²«ü¥O®É¡A·|¥ý§â RBP ±À¤J°ïÅ|«O¦s°_¨Ó¡AµM«á¦A§â RBP ³]¦¨ RSP¡A³o¨Ç°Ê§@©M¥H«e¦b Win32 ®É¤@¼Ë¡A³£¬O¥H RBP ·í¦¨°ïÅ|ªº«ü¼Ð¦s¨ú°Ï°ìÅܼơA¦b¦ì§} 1400010A4¡B1400010A8 ¥Î²HÂŦâ¼Ð¥Ü¥X¨Óªº¨â¦æ«ü¥O¡A´N¬O¦s¨ú°Ï°ìÅÜ¼Æ sum¡Bn¡A¤U¹Ï¤Q¤T¡B¤Q¥|¦³§ó¸Ô²Óªº»¡©ú¡C³o¤T¦æ«ü¥Oªº²Ä¤T¦æ¬O¦b°ïÅ|¤¤¹w¯d°Ï°ìÅܼƪºªÅ¶¡¡A¦]¬°°Ï°ìÅÜ¼Æ sum¡Bn ¦@¦û¾Ú 16 ­Ó¦ì¤¸²Õ¡A©Ò¥H¦b°ïÅ|¤W«O¯d 16 ­Ó¦ì¤¸²ÕªºªÅ¶¡¡A¦]¦¹¦³

        add     rsp,0FFFFFFFFFFFFFFF0h

³o­Óµ{¦¡½X¡A¥[¤W ¡Ð10H ¥ç§Y´î¥h 10H¡C°£¦¹¤§¥~¡A·í¨Ï¥Î LOCAL «Å§i°Ï°ìÅܼƫá¡A¦b°Æµ{¦¡µ²§ôªº¦a¤è¡A²ÕĶ¾¹ÁÙ·|¥[¤W¤@¹D LEAVE «ü¥O¡ALEAVE «ü¥O³]©w RSP ¤§­ÈÅܬ° RBP¡A±µµÛ·|±q°ïÅ|¼u¥X¤@­Ó¥|¦r²Õ¨ì RBP ¼È¦s¾¹¤¤¡A©ó¬O°ïÅ|¡BRSP «K«ì´_­ìª¬¤F¡A¤]´N¬O¦b¦ì§} 140001148 ³B¡C´«¥y¸Ü»¡¡A¨Ï¥Î LOCAL °²«ü¥O®É¡A²ÕĶ¾¹·|¼W¥[

        PUSH    RBP
        MOV     RBP,RSP
        ADD     RSP,FFFFFFFFFFFFXXXXH
        ¡K¡K    ¡K¡K¡K¡K
        LEAVE

³o´X¹D«ü¥O¡CÁöµM»¡ LOCAL °²«ü¥O¥²¶·±µ¦b PROC °²«ü¥O¤§«á¡A¦ý¬O¦pªG PROC ¤§«á¨Ï¥Î USES «O¦s¬Y¨Ç¼È¦s¾¹¡A³o¨Ç¼È¦s¾¹·|¥Î PUSH «ü¥O¡A«O¯d¦b°Ï°ìÅܼƤ§«á¡A¤~±À¤J°ïÅ| ( ¥ç§Y³Q«O¦sªº¼È¦s¾¹¦b°ïÅ|¸û§C¦ì§} )¡C¦]¦¹¡A²Ä¤@­Ó°Ï°ìÅܼƤ@©w¬O¦b¡yRBP¡Ð8H¡z³B¡B²Ä¤G­Ó°Ï°ìÅܼƬO¦b¡yRBP¡Ð10H¡z³B¡C¦pªG PROC ¤§«á¡A¥Î USES «O¦s¬Y¨Ç¼È¦s¾¹¡A¨º»ò¦b°Æµ{¦¡µ²§ô¤§«e¡A¤]´N¬O°õ¦æ RET «ü¥O¤§«e¡A·|¥ý¥Ñ°ïÅ|¼u¥X³Q«O¦sªº¼Æ­È¨ì¬Û¹ïÀ³ªº¼È¦s¾¹¡C¸Ñ»¡§¹ LOCAL¡BPROC USES °²«ü¥O«á¡A±µ¤U¨Ó¤p¤ì°¸·Q¥ýÆ[¹î°ïÅ|Åܤƪº±¡§Î¡A¥ý¨Ï WinDbg °õ¦æ¨ìµ{¦¡¤J¤f³B¡A¿é¤J¡yg 140001051¡z¨Ã«ö¤U¡yEnter¡zÁä¡A³o®É­Ô¹q¸£©|¥¼°õ¦æ¦ì§} 140001051 ³Bªº«ü¥O¡F±µµÛÆ[¹î¼È¦s¾¹¤Î°ïÅ|¤º®e¡A§Ú­Ì¥ý«á¿é¤J¡yr¡z¡B¡yd 12fef0¡z«ü¥O¡C³o¤T­Ó¹Lµ{¦p¤U¡G

0:000> g 140001051 [Enter]
ModLoad: 000007fe`ff590000 000007fe`ff5be000   C:\Windows\system32\IMM32.DLL
ModLoad: 000007fe`fef00000 000007fe`ff009000   C:\Windows\system32\MSCTF.dll
image00000001_40000000+0x1051:
00000001`40001051 55              push    rbp
0:000> r [Enter]
rax=000000007767f560 rbx=0000000000000000 rcx=000007fffffdf000
rdx=0000000140001051 rsi=0000000000000000 rdi=0000000000000000
rip=0000000140001051 rsp=000000000012ff58 rbp=0000000000000000
 r8=000007fffffdf000  r9=0000000140001051 r10=0000000000000000
r11=0000000000000000 r12=0000000000000000 r13=0000000000000000
r14=0000000000000000 r15=0000000000000000
iopl=0         nv up ei pl zr na po nc
cs=0033  ss=002b  ds=002b  es=002b  fs=0053  gs=002b             efl=00000246
image00000001_40000000+0x1051:
00000001`40001051 55              push    rbp
0:000> d 12fef0 [Enter] ¡÷¥Ñ¤W­± RSP ¼È¦s¾¹¤§­È¡A¥iª¾²{¦b°ïÅ|©³¦b 12FF58H ³B¡A¦ý§Ú­Ì­nÆ[¹îªº¬O±N¨Ó­n¨Ï¥Î¨ìªº°ïÅ|¡A¤]´N¬O¤ñ¥¦¦ì§}§ó§Cªº¦a¤è
*** ERROR: Symbol file could not be found.  Defaulted to export symbols for C:\Windows\system32\kernel32.dll - 
00000000`0012fef0  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
00000000`0012ff00  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
00000000`0012ff10  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
00000000`0012ff20  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
00000000`0012ff30  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
00000000`0012ff40  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
00000000`0012ff50  00 00 00 00 00 00 00 00-6d f5 67 77 00 00 00 00  ........m.gw....
00000000`0012ff60  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................

³o®É­Ô RSP «ü¦V°ïÅ| 12FF58 ³B¡A³oùئs©ñªð¦^¨t²Îªº¦ì§}¡A¦¹¦ì§}¬O 7767F56D¡A¦p¤U¹Ï¤E¤Î¤W­±¾í¦â¦r¡C¤UÃä³o¨Ç¹Ï¤¤ªº¨C­Ó¤è®æªí¥Ü¤@­Ó¥|¦r²Õ¡A³Ì¤W­±ªºµµ¦â«ü¥O¬O§Y±N­n°õ¦æªº«ü¥O¡A¦ý©|¥¼°õ¦æ¡C±µµÛ«ö¤U¤»¦¸¡yF8¡zÁä¡A³æ¨B°lÂÜ¡A¥H¤Î¤@­Ó¡yg¡z«ü¥O¡A°õ¦æ¨ì©I¥s Sum °Æµ{¦¡¤§«e¡G

0:000> t [Enter] ¡÷§â RBP ±À¤J°ïÅ|¡A¦p¤U¹Ï¤E
image00000001_40000000+0x1052:
00000001`40001052 488bec          mov     rbp,rsp
0:000> t [Enter] ¡÷¨Ï RBP ³]¬° RSP¡A¦p¤U¹Ï¤Q
image00000001_40000000+0x1055:
00000001`40001055 4883c4f0        add     rsp,0FFFFFFFFFFFFFFF0h
0:000> t [Enter] ¡÷¨Ï RSP ´î 10H¡A«O¯dµ¹°Ï°ìÅܼƨϥΡA¦p¤U¹Ï¤Q¤@
image00000001_40000000+0x1059:
00000001`40001059 53              push    rbx
0:000> t [Enter] ¡÷¦b°ïÅ|¤¤«O¦s RBX¡BRSI¡A¦p¤U¹Ï¤Q¤G
image00000001_40000000+0x105a:
00000001`4000105a 56              push    rsi
0:000> t [Enter]
image00000001_40000000+0x105b:
00000001`4000105b 4883ec40        sub     rsp,40h
0:000> t [Enter] ¡÷¦b°ïÅ|¤¤¹w¯d¤C­Ó°Ñ¼ÆªºªÅ¶¡¡A¦p¤U¹Ï¤Q¤T
image00000001_40000000+0x105f:
00000001`4000105f 488b05ca1f0000  mov     rax,qword ptr [image00000001_40000000+0x3030 (00000001`40003030)]
                                          ds:00000001`40003030=0000000000000002

¦b¤W¹Ï¤Q¤T±N°õ¦æ¡ysub rsp,40h¡z«ü¥O ( ¦bµ{¦¡½X¦ì§} 14000105B ³B )¡A´î±¼ 40H ªº­ì¦]°£¤F¬°©I¥s°Æµ{¦¡ Sum ªº°Ñ¼Æ¥~¡A¤]­nª`·N¨ì¬O§_¯à¨Ï¤U­Ó°ïÅ|®Ø¹ï»ô¸`Ãä¬É¡C¦¹³B¥ý¨Ó¬Ý¬Ý°ïÅ|ªº±¡ªp¡A¿é¤J¡yd 12fee0¡z¡A¦p¤U­± WinDbg ¶É¦Lªºµ²ªG¡A²`µµ¦â¬O RSI ³Q±À¤J°ïÅ|©Ò¦b¡A¦ýµµ¦â«h¬O RBX¡A±µµÛ¬O¨â­Ó¥|¦r²Õ¡A¤À§O¬O°Ï°ìÅÜ¼Æ n¡Bsum ©Ò¦b¡A±µµÛ¬v¬õ¦âªº¬O«O¦s¦b°ïÅ|ªº RBP¡G

0:000> d 12fee0 [Enter]
00000000`0012fee0  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
00000000`0012fef0  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
00000000`0012ff00  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
00000000`0012ff10  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
00000000`0012ff20  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
00000000`0012ff30  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
00000000`0012ff40  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
00000000`0012ff50  00 00 00 00 00 00 00 00-6d f5 67 77 00 00 00 00  ........m.gw....
0:000> g 14000109f [Enter] ¡÷¥Ñ 14000105F ¨ì 14000109F ªº«ü¥O¬O§â°Ñ¼Æ¶ñ¤J°ïÅ|©Î¼È¦s¾¹¡A¦p¤W¹Ï¤Q¥|
image00000001_40000000+0x109f:
00000001`4000109f e85cffffff      call    image00000001_40000000+0x1000 (00000001`40001000)
0:000> t [Enter] ¡÷©I¥s Sum °Æµ{¦¡¡A§â¤U¤@«ü¥Oªºªð¦^¦ì§} 1400010A4 ±À¤J°ïÅ|¡A¦p¤W¹Ï¤Q¤­
image00000001_40000000+0x1000:
00000001`40001000 488bc1          mov     rax,rcx
0:000> d 12fee0 [Enter] ¡÷¥ýÆ[¹î°ïÅ|±¡§Î¡A©³¤U²HÂŦ⪺¬O°Ñ¼Æ¡A¥Õªº¬O©I¥s Sum «áªºªð¦^¦ì§}
00000000`0012fee0  00 00 00 00 00 00 00 00-a4 10 00 40 01 00 00 00  ...........@....
00000000`0012fef0  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
00000000`0012ff00  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
00000000`0012ff10  99 99 bb bb 33 33 22 22-01 00 00 00 00 00 00 00  ....33""........
00000000`0012ff20  02 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
00000000`0012ff30  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
00000000`0012ff40  00 00 00 00 00 00 00 00-00 00 00 00 00 00 00 00  ................
00000000`0012ff50  00 00 00 00 00 00 00 00-6d f5 67 77 00 00 00 00  ........m.gw....
0:000> r [Enter]
rax=22223333bbbb9999 rbx=0000000000000000 rcx=123456789abcdef0
rdx=7777555533331111 rsi=0000000000000000 rdi=0000000000000000
rip=0000000140001000 rsp=000000000012fee8 rbp=000000000012ff50
 r8=1444144414441444  r9=0f130f130f130f13 r10=0000000000000000
r11=0000000000000000 r12=0000000000000000 r13=0000000000000000
r14=0000000000000000 r15=0000000000000000
iopl=0         nv up ei pl nz na po nc
cs=0033  ss=002b  ds=002b  es=002b  fs=0053  gs=002b             efl=00000206
image00000001_40000000+0x1000:
00000001`40001000 488bc1          mov     rax,rcx

¶i¤J Sum °Æµ{¦¡«á¡A¦p­n¦s¨ú²Ä¤­­Ó°Ñ¼Æ¡A´N­n¨ì RSP¡Ï28H ¥h¨ú±o¡A­Y­n¦s¨ú²Ä¤»­Ó°Ñ¼Æ¡A´N­n¨ì RSP¡Ï30H ¥h¨ú±o¡K¡K¡C³o³¡¤À¦b HELLOW1 ¤w´£¹L¤F¡A´N¤£¦A­«½Æ¤F¡C


µ²»y

Win64 °ïÅ|®Ø¦b Win64 ¨t²Î¤¤¡A¥H²Õ¦X»y¨¥¼¶¼gµ{¦¡ÁÙ¬O¤@¥ó³Â·Ðªº¨Æ¡A¤°»ò·Ðº¾ªº²Ó¸`¡A³£±o¥Ñµ{¦¡³]­pªº¤H¿Ë¦Û¦w±Æ¡F¦ý¬O¤]¦]¬°³o¼Ë¡A§A±NÀò±o§ó¦hªºª¾ÃÑ»P¸gÅç¡C¤p¤ì°¸¦b³o¬qºN¯Áªº¹Lµ{¤¤ªá¶O¤F³\¦hºë¯«¡A¦]¦¹¼g¤U³o¨Ç¸g¹L¨Ï·Q¾Ç²ß Win64 ²Õ¦X»y¨¥ªº¤H¤£¥²¦A®ö¶O®É¶¡¡C

¦b Win64 ²Õ¦X»y¨¥¤¤¡A»P Win32 ²Õ¦X»y¨¥³Ì¤£¦Pªº¦a¤èÀ³¸Ó¬O©I¥s¨ó©w¡A¤×¨ä¬O³]¸m°ïÅ|®Ø®É¡A¥²¶·«O¯d¦h¤Ö¦ì¤¸²Õµ¹°Æµ{¦¡ªº°Ñ¼Æ¡B«O¦s¦b°ïÅ|ªº¼È¦s¾¹¥H¤Î°Ï°ìÅܼƨӨϥΡA¬O­Ó«Ü¤jªº°ÝÃD¡C½Ð°Ñ¦Ò¥k¹Ï¡A³o¬O¤@­Ó°Æµ{¦¡ A ©I¥s°Æµ{¦¡ B ®É¡A©Ò«Ø¥ßªº°ïÅ|®Ø¡A°²³]¦b°Æµ{¦¡ A ùØ©Ò©I¥sªº°Æµ{¦¡¤¤¡A¥H°Æµ{¦¡ B ©Ò»Ý°Ñ¼Æ³Ì¦h¡A¨º»ò©Ò»Ý«O¯dªºªÅ¶¡´N¥H°Æµ{¦¡ B ©Ò»Ý°Ñ¼Æ­Ó¼Æ­pºâ§Y¥i¡C

µ{¦¡³]­p®vÀ³¦b°Æµ{¦¡ A ¤@¶}©l´N³]©w¦n RSP ( µy«á¦A¸Ô²Ó»¡©ú )¡A¨Ï RSP «ê¦n«ü¨ì¸`ªºÃä¬É¤W¡A¦p¥k¹Ïªº´Ä©³¥Õ¦â¦r©Ò«üªº¦a¤è¡A¤]´N¬O¦ì§}¥H´Ä©³²HÂŦrÅã¥Üªº¦a¤è¡F¦p¦¹¤@¨Ó¡A·í©I¥s°Æµ{¦¡ B ®É·|§âªð¦^¦ì§}©ñ¤J¥k¹Ï¤¤¼Ð¥Ü¡yªð¦^ A ªº¦ì§}¡z³B¡A°Æµ{¦¡ B ªº°ïÅ|®Ø´N·|¹ï»ô¸`Ãä¬É¡C¦Ó©I¥s°Æµ{¦¡ B ©Ò»Ýªº°Ñ¼Æ«e¥|­Ó·íµM¬O©ñ¦b RCX¡BRDX¡BR8¡BR9 ¼È¦s¾¹ùØ¡A²Ä¤­­Ó°Ñ¼Æ«h©ñ¦b [RSP¡Ï20H] ùØ ( ¨£¥k¹Ï´Ä©³ÂŦrªº RSP¡Ï20H )¡A¨ä¾l¨Ì¥k¹Ï¥i±o¡C¶i¤J°Æµ{¦¡ B ¤§«á¡A°²¦p°Æµ{¦¡ B ³]¦³°Ï°ìÅܼơA¨º»ò²ÕĶ¾¹·|¦Û°Ê§â RBP ±À¤J°ïÅ|¡A³o®É­Ô´N¥i¥H¥H RBP ¬°«ü¼Ð¦s¨ú°Æµ{¦¡ B ªº°Ñ¼Æ¡A°Ñ¦Ò¥k¹Ï¡A²Ä¤­­Ó°Ñ¼Æ¦b [RBP¡Ï30H] ³B¡A²Ä¤»­Ó°Ñ¼Æ¦b [RBP¡Ï38H] ³B¡K¡K¡F°²¦p­n§â«e¥|­Ó°Ñ¼Æ¦s¦b°ïÅ|¤¤¡A¤]¥i¥H¨Ì RBP ¬°°ò·Ç¡A¨Ò¦p RCX À³¦s¦b [RBX¡Ï10H] ³B¡F°²¦p­n¦s¨ú°Ï°ìÅܼơA«h¤£¶·¾á¤ß¡A¦]²ÕĶ¾¹·|¦Û°Ê¨Ì°Ï°ìÅܼƦWºÙ¦s¨ú¡C

°²¦p°ïÅ|®Øùضȶȥu¦³°Æµ{¦¡ªº°Ñ¼Æ¡A¨º»ò´N°Ñ¦Òªí¤@§Y¥i¡A¦p¦P¤W­±©Ò»¡ªº¡A³o®É­Ô¦b°ïÅ|®Øªº¤j¤p¬O 16n¡Ï8 ¦ì¤¸²Õ¡F¦ý¬O¦pªGÁÙ¥]§t°Ï°ìÅܼƩΫO¦sªº¼È¦s¾¹®É¡A¨º¸Ó«ç»ò¿ì©O¡HÃø¹D¨C¦¸³£±o¥Î¹Ïµeµe¥X°ïÅ|¨Ï¥Î±¡§Î¨Ó­pºâ±o¨ì¶Ü¡H§Ú·Q¤j·§¤£»Ý³o»ò³Â·Ð§a¡I½Ð¬Ý¹Ï¥k³Ì¤W­±¥Hºñ¦r¼Ð¥Üªº RSP ¬O°Æµ{¦¡ B ³Ì«á RSP ©Ò«ü¦ì§}¡F¦A¬Ý°Æµ{¦¡ A ªº°ïÅ|®Ø¡A¤]´N¬O¥H´Ä©³¥Õ¦â¦r©Ò¼Ð¥Üªº RSP ³Ì«á©Ò«ü¦ì§}¡C½Ð¥J²ÓÆ[¹î¡A¤£ºÞ¬O°Æµ{¦¡ A ©Î B ªº RSP ³Ì«á¤]³£«ü¦b XXXXX0 ³B¡A¤]¬O¹ï»ô¸`ªºÃä¬É¡C´«¥y¸Ü»¡¡ARSP ´î±¼°Ñ¼Æ©Ò¦ûªºªÅ¶¡¡AÁÙ­n¦A½Õ¾ã RSP ¨Ï RSP ¯à¹ï»ô¸`ªºÃä¬É¡A¥i¥H¥Î¤U­±µ{¦¡½X¹F¦¨¡G

°Æµ{¦¡¦W    PROC    USES r15 ¨ä¥L­n«O¦sªº¼È¦s¾¹¦Cªí
            LOCAL   ÅܼƦW:QWORD,¡K¡K
            mov     r15,rsp
            sub     rsp,n*8
            and     rsp,0FFFFFFFFFFFFFFF0h
            ¡K¡K
            mov     rsp,r15
            ret
°Æµ{¦¡¦W    ENDP

¤W­±µ{¦¡½X¤¤ªº n ¥Nªí³o­Ó°Æµ{¦¡©I¥sªº API ©Î°Æµ{¦¡¤¤³Ì¦hªº°Ñ¼Æ­Ó¼Æ¡A³o¼Ë´N¤£¦A»Ý­n¥h¶O¤ßªº­pºâ RSP ¨ì©³­n´î¥h¦h¤Ö¤F¡C


«á°O

¤p¤ì°¸¦b¼¶¼g³o¤@½g¤å³¹¡A¬O¦b¥Á°ê 99 ¦~¡F²{¦b¦^ÅU°_¨Ó¡AÂ಴¶¡¹L¤F¤Q¤@­Ó¦~ÀY¡A³º¤w¨ì¤F¥Á°ê 110 ¦~¡C¦b³o¬q´Á¶¡¡A¥Ñ©ó³\¦h¥O¤H´L·qªº¥ý¶i¤é¥HÄ~©]¡B§¶§¶Í}Í}ªº§V¤O¡A¨Ï±o·Q­n¥Î·L³n²ÕĶ¾¹¡AML64.EXE¡A¥h¼¶¼g Win64 ²Õ¦X»y¨¥¡AÅܱo²³æ³\¦h¤F¡C³o¨Ç¥ý¶i¤j¦h¬¡ÅD¦b The MASM Forum ½×¾Â¤W¡A¥L­Ì¶}µo¤F ML64.EXE ¤Wªº¥¨¶°µ{¦¡ ( ¥¨¶°µ{¦¡¡A­^¤å­ì¤å¬O¡umacro¡v¡A¤¤µØ¥Á°êºÙ¬°¡u¥¨¶°¡v¡A¤j³°¤WºÙ¬°¡u§»¡v)¡A¨Ï±o ML64.EXE ¤]¯à¨Ï¥Î°ª¶¥»yªk¡A¹³¬O invoke¡B.switch/.case/.endsw¡B.if/.elseif/.endif µ¥¡A¦P®É³o¨Ç¥ý¶i­Ì¤]¼¶¼g¤F¦U¦¡¦U¼Ëªº¥]§tÀÉ¡A¥H¤Î»s§@¬Û¹ïÀ³ªº¶×¤Jµ{¦¡®w¡C¦]¬°¥L­Ìªº¨¯¶Ô¡A¥B¤£­p³ø¹Sªº¤u§@¡A¶È¾ÌµÛº¡µÄªº¼ö±¡¡A§ó¨Ï¤HµÂµM°_·q¡A¤]Åý§Ú­Ì±o¥H¨É¨ü¥L­Ìªº¦¨ªG¡C

«Ø¥ß ML64.EXE ªº²ÕĶ»P³sµ²Àô¹Ò

©³¤U§Ú­Ì´N¤@¨B¤@¨Bªº«Ø¥ß¦n·L³n 64 ¦ì¤¸²ÕĶ¾¹ªº²ÕĶÀô¹Ò¡C

  1. §Ú­Ì¥i¥H¦b The MASM Forum ½×¾Â¤W¡Ahutch-- ¤j¤j©Òµoªíªº©«¤l¡A¤U¸ü install64.zip¡C¤U¸ü¦^¨Ó«á¡AùØ­±´N¥u¦³¤@­Ó¤l¥Ø¿ý¡Ainstall64¡A±N¨ä¸ÑÀ£ÁY¨ì¥ô¦ó¤@­ÓµwºÐªº®Ú¥Ø¿ýùØ¡A¨Ã±N¨ä§ï¦W¬°¡umasm32¡v¡C¨Ò¦p¡A¤p¤ì°¸§â¡uinstall64.zip¡vùتº¡uinstall64¡v¤l¥Ø¿ý¸ÑÀ£ÁY¨ì¡uE:\¡v¡AµM«á¦A§â¡uE:\install64¡v¤l¥Ø¿ý¦WºÙ§ï¦¨¡uE:\masm32¡v¡C

  2. §Ú­Ì©Ò¼¶¼gªº²Õ¦X»y¨¥­ì©l½X¡A¤]­n¦b³o­ÓµwºÐªº¤@­Ó¤l¥Ø¿ýùØ¡A¦Ó³o­Ó¤l¥Ø¿ý¨Ã¨S¦³¤@©w­n¦b®Ú¥Ø¿ýùØ¡A¥i¥H¦b®Ú¥Ø¿ýùتº¤@­Ó¤l¥Ø¿ýùØ¡C¨Ò¦p¤p¤ì°¸§â²Õ¦X»y¨¥­ì©l½X¦b¡uE:\HomePage\SOURCE\Win64¡v¤l¥Ø¿ýùØ¡C±N¨ÓÁÙ¥i¥H¦b³o­Ó¤l¥Ø¿ýùزK¥[¦U­Ó¤l¥Ø¿ý¡A¥H°Ï§O¦UºØ¤£¦Pªº¡u±M®×¡v¡A²¦³º¤@­Ó±M®×»Ý­n¦n´X­Ó¤£¦PªºÀɮסC
  3. ¦b¸ÓµwºÐªº¡u\masm32\bin64¡v¤l¥Ø¿ýùØ¡A¦³¤@­Ó¦W¬°¡uMicrosoft_File_List.txt¡vªº¯Â¤å¦rÀÉ¡A³o­ÓÀÉ®×ùئC¥X¤FÀ³¸Ó­n¦s©ñ¦b¡u\masm32\bin64¡vùتº¤@¨ÇÀɮסC¥i¥H¨ì PCONLIFE ºô¯¸¡A·j´M¡uMicrosoft_File_List.txt¡v©Ò¦C¥Xªº©Ò¦³ÀɮסAµM«á¤U¸ü¦^¨Ó¡A©ñ¨ì¡u\masm32\bin64¡v¤l¥Ø¿ýùØ¡CPCONLIFE ºô¯¸ªº¥D¦®¬O¥i¥HÅý¨Ï¥ÎªÌ«ì´_ Windows ¦]¬Y¨Ç­ì¦]¦Ó¥¢¥hªº DLL ©Î EXE ÀɮסA¦b¦¹³B§Ú­Ì¥i¥H¥Î¥¦¨Ó«Ø¥ß¡u\masm32\bin64¡vùتº¤@¨ÇÀɮסC©³¤U¬O¤p¤ì°¸­««Ø¡uML64.EXE¡vªº¹Lµ{¡C­º¥ý¡A¦b①½s¿è®Ø¿é¤J¡uML64.EXE¡v( PCONLIFE ·|©¿µø¤j¤p¼g )¡AµM«á«ö¤U②³Bªº«ö¶s¡A


    PCONLIFE ·|§â¥¦¸ê®Æ®wùتº ML64.EXE ¦C¥X¨Ó¡A¦p¤U¹Ï¡G

    ¦³³o»ò¦hª©¥»ªº ML64.EXE¡A¤p¤ì°¸¿ï¾Üªº¬O 64 ¦ì¤¸ªº¡u14.25.28614.0¡vª©¥»¡A³o¬O¡uVisual Studio 2019¡v¤º©Òªþªº²ÕĶ¾¹¡CµM«áÂI¿ï③³Bªº¶W³sµ²¤U¸ü¡AÀx¦s¦b¡uE:\masm32\bin64¡vùØ¡C¡uMicrosoft_File_List.txt¡vªº¨ä¥LÀɮפ]¦pªk¬¶»s¡A­nª`·Nªº¬O¡AÀ³¸Ó³£­n¿ï¾Ü¬Û¦P©Î¬Ûªñªºª©¥»¡A¤~¤£­P¥X¿ù¡C

  4. ¦b²Õ¦X»y¨¥­ì©l½X³Ì«e­±¡A­n¦³¤@±ø¥]§tÀɪº°²«ü¥O¡A¡uinclude \masm32\include64\masm64rt.inc¡v¡C¡umasm64rt.inc¡v·|­t³d¤Þ¤J¦U¥]§tÀÉ¡B¦U¶×¤Jµ{¦¡®w¥H¤Î¥¨¶°ÀɮסC³o¨Ç³£¤£»Ý­n§Ú­Ì¾á¤ß¡A½Ñ¦ì¥ý¶i³£¤w¬°§Ú­Ì³]·Q¦n¤F¡C¦pªG±z¦³¿³½ì¡A¤]¥i¥H¶}±Ò¡umasm64rt.inc¡v¨Ó¬Ý¬Ý¸Ì­±ªº¤º®e¡C±z·|µo²{¡Amasm64rt.inc ¤]¥]§t¤F³\¦h¥]§tÀÉ¥H¤Î¶×¤Jµ{¦¡®w¡A³o¨ÇÀɮשε{¦¡®w³£·|¦b²ÕĶ®É¸ü¤J¡A¦Ó masm64rt.inc §â¥¦­Ì³£¼g¦º¦b¡u\masm32\include64\¡v¡B¡u\masm32\lib64\¡v©M¡u\masm32\macro64\¡vùØ¡A³o¤]´N¬O¬°¤°»ò­ì©l½X¥²¶·©M¡u\masm32¡v¦b¦P¤@­ÓµwºÐùؤF¡C

  5. ­n²ÕĶ®É¡A¥²¶·¶}±Ò¡u©R¥O´£¥Ü¦r¤¸¡v¡A¨Ã¥ý¿é¤J¡upath e:\masm32\bin64;%path%¡v«ü¥O¡A«ü©w²ÕĶ¾¹¡B³sµ²¾¹¤Î³Q©I¥s¨ìªº DLL Àɦs©ñªº¸ô®|¡C

¨ì¦¹¡A§Ú­Ì´N¤w³]©w¦n ML64.EXE ªº²ÕĶÀô¹Ò¤F¡C©³¤U¥ýÁ|¤@­Ó³Ì²³æªº¨Ò¤l¸Õ¸Õ¬Ý¡C

²Ä¤@­Ó Win64 ²Õ¦X»y¨¥µ{¦¡

©³¤U¤p¤ì°¸¨Ó¼¶¼g¤@­Ó²³æªº Win64 ²Õ¦X»y¨¥µ{¦¡¡A°õ¦æ¥¦®É¡A¯àÅã²{¤@­Ó¼ÐÃD¬°¡u²Ä¤@­ÓWin64µ{¦¡¡vªºµøµ¡¡A¤º®e¼gµÛ¡u³o¬O¥Î²Õ¦X»y¨¥¼gªº64¦ì¤¸µ{¦¡¡C¡v¦r¦ê¡A¦p¤U¹Ï¡G

³o­Ó²³æªº Win64 ²Õ¦X»y¨¥µ{¦¡¡A¨ä¹ê´N¬O¤@­Ó²³æªº±M®×¡A¤p¤ì°¸§â¥¦©R¦W¬°¡uFIRST¡v¡A¨ä­ì©l½X¦p¤U¡G

1
2
3
4
5
6
7
8
9
10
INCLUDE \masm32\include64\masm64rt.inc
;***************************************************************************************************
.CODE
;---------------------------------------------------------------------------------------------------
main    PROC
        invoke  MessageBox,NULL,"³o¬O¥Î²Õ¦X»y¨¥¼gªº64¦ì¤¸µ{¦¡¡C","²Ä¤@­ÓWin64µ{¦¡",MB_OK
        invoke  ExitProcess,NULL
main    ENDP
;***************************************************************************************************
END

§â³o¬q­ì©l½X¦s¦b¡uE:\HomePage\SOURCE\Win64\FIRST\first.asm¡vÀÉ®×ùØ¡AµM«á¶}±Ò¡u©R¥O´£¥Ü¦r¤¸¡v¡A¿é¤J¤U­±«ü¥O¡G


³o¼Ë´N¤w»s§@¦n¡ufirst.exe¡v¤F¡C

¦b²ÕĶ»P³sµ²¶¥¬q®É¡A¥i¥H³]©wÅý ML64.EXE ª½±µ©I¥s³sµ²¾¹¡ALINK.EXE¡C¦]¦¹­n¹ï³sµ²¾¹¤U°Ñ¼Æ¡A©Ò¤Uªº°Ñ¼Æ©ñ¦b¡u/link¡v¤§«á¡A¦³¨â­Ó¡A¤À§O¬O¡u/subsystem:windows¡v¤Î¡u/entry:main¡v¡C«eªÌ¬O«ü©w­n»s§@ªº°õ¦æÀɬOµøµ¡µ{¦¡¡A¦pªG¬O±±¨î¥xµ{¦¡¡A´N­n§ï¦¨¡u/subsystem:console¡v¡C«áªÌ¬O«ü©wµ{¦¡ªº¶i¤JÂI¡A´N¬O«ü©wµ{¦¡¶}©l°õ¦æªº¦a¤è¡C¦b¥H«e MASM 6.x ®É¡A¬O¦b­ì©l½Xªº³Ì«á­±¡A¥H

END		label

«ü©w¶i¤JÂI¡F¦ý¦b MASM 7.x ¤§«á¡A³£­n¦b³sµ²¾¹¤¤¥H¡u/entry¡v°Ñ¼Æ³]©w¡A­nª`·Nªº¬O¡A¦]¬° Win64 µ{¦¡¤@©w·|©I¥s Win32 API¡A¦Ó³o¨Ç API ¬O°Ï¤À¤j¤p¼gªº¡A©Ò¥H¡u/entry¡v¤§«áªº¶i¤JÂI¼Ð°O¤]¬O°Ï¤À¤j¤p¼gªº¡C¤]´N¬O»¡¡A¶i¤JÂI¼Ð°O¤@©w­n©M­ì©l½Xªº¤j¤p¼g¬Û¦P¡A¤@¦r¤£®t¤~¦æ¡C


¦^¨ì­º­¶¡A¨ì¤U¤@³¹