ÁöµM DOS ¤w¦¨¹L¥h¡A¦ý¤p¤ì°¸¤´µM«ÜÃh©À¨º¬q¦b DOS ªº®É¥ú¡A¤×¨ä¬O¥Î²Õ¦X»y¨¥¥h¾r¶¿¹q¸£¡A¦b 32 ¦ì¤¸§@·~¨t²Î ( «ü OS/2¡BWindows 9x/2K/XP¡BLinux µ¥§@·~¨t²Î ) ·í¹Dªº¤µ¤Ñ¡A¦ü¥G«Ü¤Ö¤H´£¤Î¡y¼gµ{¦¡¡z³oÀɨơA§Y¨Ï¦³¡A¤]¥u¬O C/C++¡BDelphi ©Î¬O Basic¡AÃø¹D¤´µM¯à¨Ï¥Î²Õ¦X»y¨¥¶Ü¡Hµª®×µ´¹ï¬OªÖ©wªº¡C¦¦b 1999 ¦~ 7¡ã8 ¤ë´¼«a¬ì§Þ©Ò¥Xª©ªº¡y¹CÀ¸³]p¤j®v¡z¤º¦³¼Æ½g³Å·s¿O¥ý¥Í©Ò¼gªº¤å³¹¡A¬O§Ú©Ò¨£¹L³Ì¦¦b Win32 §@·~¨t²Î ( «ü Windows 9x/Me/2K/XP µ¥§@·~¨t²Î¡A¥H«á²ºÙ¬°¡yWin32¡z) ¨Ï¥Î²Õ¦X»y¨¥¼gµ{¦¡¡A¦¹¤å³¹¦³¤@¨t¦C¡A³Ì¥ý¤¶²Ð Win16 ¼g²Õ¦X»y¨¥µ{¦¡¡A¤§«á¦A¤¶²Ð Win32¡A³Å¥ý¥Í¤]¦³ºô¶¡A¥i±¤²{¦b¤w¸g®ø¥¢¤F¡C2002¦~ªì¡A¥X²{¤F¤@Ó¥H OS/2 §@·~¨t²Î¬°¥¥xªºµ{¦¡³]pºô¯¸¡y¤È«áªºµ{¦¡³]p¡z¡Aùر¤]¦³´£¤Î²Õ¦X»y¨¥µ{¦¡³]p¡A¨Ã¥B¤]¦³½d¨Ò¡A¥i±¤¤]¤w®ø¥¢¤F¡C²{¦b¦bÁcÅ餤¤åªººô¯¸ùØ¡A¦³Ãö¦b Win32 ²Õ¦X»y¨¥µ{¦¡³]pªººô¶¦ü¥G¥u³Ñ¤U¹s¬Pªº°O¿ý¦Ó¤w¡A¦p Free Tech µ¥¡C
¦ý¬O¦b²Å餤¤åªººô¯¸ùØ¡A¦³³\¦hºô¯¸¥i¨Ñ°Ñ¦Ò¡A¤p¤ì°¸³Ì±`¥hªº¬O¡yù¤ª±lªº½sµ{¼Ö¶é¡z¡Aùر¦³³\¦h°ª¤âµoªíµ{¦¡½d¨Ò¡Aù¥ý¥Í¥»¨´N¬O«Ü°ª¬qªºµ{¦¡³]p®v¡A¥L¤]¦³³\¦hºë±mªº¤å³¹µoªí¡A¦è¤¸ 2002 ¦~¡A¥L¼g¤F¤@¥»¦W¬°¡yWindows Àô¹Ò¤U 32 ¦ì¤¸²Õ¦X»y¨¥µ{¦¡³]p¡zªº®Ñ¡A¦Ü¤µ¤´¬O¤¤¤å¥@¬ÉùØ¡A¦³Ãö Win32 ²Õ¦X»y¨¥ªº°ß¤@®ÑÄy¡C¦¹®Ñ¦³¥¿Å餤¤å»P²Å餤¤å¨âºØª©¥»¡A¥¿Å骩¥Ñ¥þµØ¤½¥q¥N²z³c°â¡C
¦b^¤åªººô¯¸ùØ¡A¨º´N¦h¦p¤û¤ò¤F¡A³Ì¬O¦³¦Wªº¡AÀ³¸ÓÄÝ©ó¡y Iczelion's Win32 Assembly Homepage¡z³oÓºô¯¸¡Aùر¦³±qªì¾ÇªÌ¨ì°ª¤â¥²¸gªº±Ð§÷¡A¦³§Ó©ó¦¹ªº¤H·íµM¤£¥i©ñ¹L¡A¥i±¤¥¦¬OÓ^¤åºô¯¸¡A¹ï§Ų́ӻ¡Á`¦³¤@¨Ç¹j»Ò¡A¦ý¤]¤£¥Î®ð¾k¡A¦bù¤ª±lªº½sµ{¼Ö¶éºô¯¸ùؤw¸g¦³Â½Ä¶¦nªº¤å³¹¥i¨Ñ°Ñ¦Ò¡A¦A¥[¤W¤@¨Ç¥¿Â²ÅéÂà´«³nÅé¡A»´¦Ó©öÁ|´N¥iÅܦ¨±z¼ô±xªº¤å¦r¡C
¨ä¹ê¡A³oùؤ]¬O¤@¶ôª×ªêÂÃÀs¤§¦a¡Aµ{¦¡°ª¤â¤£¥F¨ä¤H¡A¦ý·Q¨Ó¥L̤j·§¬O¤Ó¦£¤F¡AµL·v¬°ªì¾ÇªÌ¼gªì¯Åªº¤Jªù¤å³¹¡C¤p¤ì°¸¤£¦Û¶q¤O¡A·Q¬° Win32 ²Õ¦X»y¨¥¼¶¼g¥¿Å餤¤åªººô¶¡A³oÓºô¶°Ñ¦Ò¤Wzºô¶¤Î Win32 C++ ¬ÛÃö®ÑÄy¡A§Æ±æ½Ñ¦ì«e½ú¥ý¶i¯à¤£§[«ü±Ð¡A¬°²Õ¦X»y¨¥µ{¦¡³]p§ëª`¤ß¤O¡A¤è¯à¨Ï±Íºô¶¯à§ó¼W¥iŪ©Ê¡A©Î³\¥¼¨Ó¯à¦³¤H¦]±Íºô¶¨ü¯q¡A¶i¦Ó§ó¤W¤@¼h¼Ó¡A¼g¥X¤¤¤åªº±þ¤â¯Å³nÅé¡A«h±Í¤H¥ç»P¦³ºa²j¡C
¦b Win32 ¥¥x¼¶¼g 32 ¦ì¤¸ªº²Õ¦X»y¨¥µ{¦¡¦Ü¤Ön¦³¤TºØ¤u¨ã¡G²ÕĶ¾¹»P³sµ²¾¹¡B°£¿ù¾¹¡B°Ñ¦Ò¸ê®Æ¡C
¦b Win32 ¥¥x¤W¼¶¼g²Õ¦X»y¨¥¡A¦Ü¤Ö¦³¨âºØ²ÕĶ¾¹¥i¥H¿ï¾Ü¡G¤@¬O Borland ªº TASM 5.0¡A¤@¬O·L³nªº MASM 6.11 ¥H«áªºª©¥»¡C·L³nªº MASM ¨Ã¨S¦³ªþ±a©w¸qµ{¦¡®wªº¥]§tÀÉ¡A¤]¨S¦³¨ä¥L¤ä´©¤u¨ã¡A¥²¶·¨ì·L³n©Òµo§Gªº¦UÓ¤u¨ã¥]¥h¦¬¶°¡A¦]¦¹¦´Án¨Ï¥Î MASM ¥h¼¶¼g Win32 µ{¦¡¬O¥ó«Ü³Â·Ðªº¨Æ¡C©¯¦n«á¨Ó·L³n¶}©ñ§K¶O¤U¸ü MASM 6.11d ( °Ñ¦Ò DOS ªº²Õ¦X»y¨¥·Ç³Æ¤u§@¡Gµù¤@¡A¦ý³oùØ¥u¯à±o¨ì ML.EXE »P ML.ERR ¨âÓÀɮצӤw¡Aª©¥»¬O 6.11d )¡A¤S¦³¤@¦ì«e½ú¡ASteve Hutchesson¡A¬° MASM ©w¸qµ{¦¡®w»P¥]§tÀÉ¡A¨Ã¥B¦A¥]§t¤F³\¦h¤å¥ó¡B½d¨Ò¡B¤u¨ãµ{¦¡µ¥¡A¦A§â³o¨ÇÀÉ®×¥]¸Ë¦¨ MASM32 v7.0¡A¨Ï±o¥Î²Õ¦X»y¨¥¼g¥X Win32 µ{¦¡¨Ã¤£¦A¬O¥óÃø¦pµn¤Ñªº¨Æ¡C¥Ñ©ó¥LµL¨pªº¥I¥X¤Î§V¤O¡A¨Ï±o¥H²Õ¦X»y¨¥¼¶¼g Win32 µ{¦¡Åܱo¬Û·í¤è«K¤F¡A§Ú½ú´N¤£¶·¤£Â_ªº¥h¬d¦UºØ±`¼Æ¡A§ÚÌÀ³¸Ón·PÁ³oºØ¬°¤j²³¥I¥Xªº¤H¡C¦]¬°¤p¤ì°¸¥»¨ªº²ßºD¦A¥[¤Wºô¸ô¤W©Ò¯à§ä¨ìªº¸ê®Æ¸û¨ä¥L²ÕĶ¾¹¨Ó±o¦h¡A©Ò¥H¤p¤ì°¸±N¥H MASM32 7.0 ¬°¥D¤¶²Ð¦b Win32 ¥¥x¤W¼¶¼g²Õ¦X»y¨¥¡A¹ï©ó¨Ï¥Î TASM ªº¤H¡A¥u¦n»¡Án©êºp¤F¡C
MASM32 v7.0 ¨Ã¤£¬O·L³n¥X«~ªº¡A¦Ó¬O Steve Hutchesson ¶°¦X¤F·L³n MASM v6.11d »P©Ò»Ý¤u¨ã¥]¸Ë¦Ó¦¨¡A±Mªù¥Î¨Ó¼¶¼g Win32 µ{¦¡ªº¶}µo¤u¨ã¡C²{¦b ( ¥Á°ê 100 ¦~¤§«e¡A§Y¦è¤¸ 2011 ¦~¤§«e ) ¥«±¤W¤j³¡¤ÀÁ¿z²Õ¦X»y¨¥ªº®ÑÄy¡A¤´¨Ï¥Î·L³nªº MASM¡A½ÐŪªÌ¤£n»P MASM32 ·d²V¤F¡CMASM32 7.0 ¥i¥H¨ì hutch's home page ¤U¸ü¨ú±o¡C¤U¸ü«á¡A±N¥¦¸ÑÀ£ÁY¨Ã°õ¦æ¨ä¤¤ªº INSTALL.EXE ´N¥i¥H¤F ( ¨ä¹ê MASM32V7.ZIP ¥u¦³¤@ÓÀɮסAINSTALL.EXE )¡AINSTALL.EXE ·|n±z¿ï¾Ü¦w¸Ë¦b¨º¤@¥xµwºÐ¾÷¡A¦p¤U¹Ï¡G
µM«á¥¦¦Û¤v·|¶i¦æ¦w¸Ë§@·~¡A¹L¤@°}¤§«á·|¦Û°Ê¥X²{ DOS ¼Ò¦¡ªºµøµ¡¡A«Ý INSTALL.EXE ¦Û¤v°õ¦æ¦n¦AÃö³¬³oÓ DOS ¼Ò¦¡µøµ¡§Y¥i¡A¦p¤U¹Ï¡G
¦w¸Ë¨ì³Ì«á¡AINSTALL.EXE ÁÙ·|§i¶D±z¥i¥H°Ñ¦Ò±zè¤~¦w¸ËºÏºÐ¾÷¤Uªº¡ymasm32¡z¤l¥Ø¿ý¤º¡A¦³Ó¡yREADME.HTM¡zÀɪº»¡©ú¡A¦p¤U¥ª¹Ï¡C³Ì«á¦w¸Ë§¹µe±¬O¹³¤U±¥k¹Ï¡C
¦w¸Ë¦n²ÕĶ¾¹¥H¤Î¦w±Æ¦nÀô¹Ò«á¡AÁÙn¦³°£¿ù¾¹¥H§ä¥X¿ù»~¡C³Ì¦³¦Wªº°£¿ù¾¹¬O NuMega ¤½¥q¥X«~ªº Soft-ICE¡C³o®M°£¿ù¾¹¥\¯à±j¤j¡A¥i¥H¨ì²Â¥V¥Êªººô¶¥h§ì¨ú¡C
¦w¸Ë Soft-ICE ªº¹Lµ{«Ü²³æ¡A¹Lµ{¤¤·|n±z¿é¤J§Ç¸¹ ( ¤w¥]§t¦bÀ£ÁYÀɤº )¡B¦w¸Ë¸ô®|¡B¿ï¾ÜÅã¥Ü¥d ( ¦p¤U¹Ï )¡B·Æ¹«ºØÃþ¡A¨Ã¤£§xÃø´N¤£ÂØz¤F¡C
¦w¸Ë¨ì³Ì«á¡ASoft-ICE ÁÙ·|¦Û°Ê¦b C:\AUTOEXEC.BAT ¤W¥[¤J¤@¦æ C:\PROGRA~1\NUMEGA\SOFTIC~1\WINICE.EXE¡Aªí¥Ü¨C¦¸±Ò°Ê Win 9x ³£·|¦Û°Ê¸ü¤J Soft-ICE¡C«·s±Ò°Ê Win9x «á¡ASoft-ICE ¦Û¦æ¸ü¤J¡A±z¥i¥H«ö Ctrl-D §â Soft-ICE µøµ¡¥s¥X¨Ó¡A±z·|µo²{¡A©Ò¦³¦b®à±¤Wªºµ{¦¡¥þ³£°±¤î¤F¡A³s·Æ¹«³£°Ê¼u¤£±o ( µù¤@ )¡A³o¬O¥¿±`ªº¡A¦]¬° Soft-ICE ¤w¸g±±¨î¤F©Ò¦³°õ¦æÅv¡C¦A«ö¤@¦¸ Ctrl-D¡ASoft-ICE ¤S§â±±¨îÅvÁÙµ¹ Win 9x¡ASoft-ICE µøµ¡®ø¥¢¡AWin 9x «ì´_¥¿±`¡C
¦ý¬O Soft-ICE ¹w³]ªº¦r§Î¤Ó¤p¡Aµøµ¡¤]¤£¤Ó¤j¡A±z¥i¥Hµyµyקï¡Cקï¤èªk¬O½s¿è¡yC:\Program Files\NuMega\SoftICE95\¡z¤l¥Ø¿ý¤ºªº winice.dat ÀɮסA³oÓÀɮ׬O¤@ӯ¤å¦rÀÉ¡A¥i¥H¥Î¥ô¦óªº¤å¦r½s¿è³nÅé¡A¦p¤p§@®a¡BPE2 ½s¿è¡A§ä¨ì¸ÓÀɮפº¦³¤@¦æ INIT=" ªº¦r¼Ë¡A§â¤Þ¸¹¤ºªº¤å¦r¨Ì¦Û¤v»Ý¨Dµy¥[קï¡A¦A¦sÀÉ¡A«·s±Ò°Ê Win 9x «á´N·|¨Ì±zק諸¤è¦¡Åã¥Ü¤F¡C©³¤U¬O INIT ¦r¦ê©Ò¥Nªíªº·N¸q¡G
¨CÓ Soft-ICE ©R¥O¤§«á¥Î¡y;¡z³s±µ¡A¦b¤p¤ì°¸ªº¹q¸£ùجO
INIT="LINES 43; SET FONT 2; WC 20; WD 8; SET CODE ON; X;"
¦¹¥~¡Awinice.dat ÁÙ¦³¤@Ó¦a¤ènקï¡A¨º´N¬O PHYSMB¡A³oÓ¦r¦êªí¥Ü±z¹q¸£ªº°O¾ÐÅ馳¦h¤j¡A³æ¦ì¬O MB¡C²{¦bªº¹q¸£¤j³¡¥÷¬O 128MB ©Î 256MB¡A±z´N¨Ì¾Ú±z¹q¸£¤W¸Ë¤F¦h¤Ö RAM ¶ñ¤W§Y¥i¡CµM«á«·s±Ò°Ê¡Aקï«áªº³]©w¤~¯à¥Í®Ä¡C
Soft¡ÐICE ÁöµM¥\¯à±j¤j¡A¦ý¬O»P¦³¨Ç¾÷¾¹ªº¬Û®e©Ê®t¡A¦b Windows XP ¨t²Î¤W¦ü¥G¤]¦³ÂI¨à°ÝÃD¡A¤p¤ì°¸¤@ª½µLªk¸Ñ¨M¡A¦pªG¦³«e½úª¾¹DÁٽШӫH§iª¾¡A¦b¦¹¥ýÁÂÁ¤F¡C¬°¤F¸Ñ¨M¦b Windows XP ¤U°£¿ù©Î¨ä¥L¬Û®e©Êªº°ÝÃD¡A¤p¤ì°¸¥t¥~±ÀÂˤ@Ó¥i¥H¦b Windows 9x/Me/XP ùØ°õ¦æªº°£¿ù¾¹¡A¥¦¤]¬O«Ü¦³¦Wªº¡AOllyDebug¡A¬O Oleh Yuschuk ©Ò¼¶¼gªº¦@¨É³nÅé¡A¥i¥H¨ì Ollydbg ºô¯¸¤¤¤U¸ü¡C¤U¸ü§¹¦¨«á¥u»Ýn¸ÑÀ£ÁY¨ì¤@Ó¤l¥Ø¿ýùØ¡A¤£¶·¦w¸Ë´N¥i¥H¨Ï¥Î¤F¡A±z¥un¦b©R¥O¼Ò¦¡¤U¤Á´«¨ì OllyDebug ©Ò¸ÑÀ£ÁYªº¤l¥Ø¿ý¤U¡A°õ¦æ OLLYDBG.EXE §Y¥i¡C§ó¤è«Kªº°µªk¬O¦b®à±¤W«Ø¥ß OllyDebug ªº±¶®|¡A¥H«án°õ¦æ OllyDebug ®É¡A¥u»Ý¥H·Æ¹«¹ï¦¹±¶®|ÂùÀ»¨â¦¸§Y¥i¡C
¦^·Q¥H«e¦b DOS ¤U¼¶¼g²Õ¦X»y¨¥¡A±`¥Î DOS/BIOS ªA°Èµ{¦¡¨Ó°µ§C¶¥¥\¯à¡A¬Ù¥h³\¦h³Â·Ð¡C¦P¼Ëªº¡A¦b Win32 ¨t²Î¤]´£¨Ñ¤F³\¦hªºªA°Èµ{¦¡¨Ñµ{¦¡©I¥s¡A³o¨Ç¨t²Î´£¨ÑªºªA°Èµ{¦¡¡AºÙ¬° Win32 API (Application Programming Interface)¡A¥i¥H¨ì Iczelion's Win32 Assembly Homepage ¤U¸üºô¶¤U¸ü win32api.zip¡C
¸ÑÀ£ÁY«á¡A¥i¥H±o¨ì¤@Ó Windows ªº HLP ®æ¦¡ÀÉ¡A¥¦¤£¶È¥]§t¤F Win32 API¡AÁÙ¥]§t¤F¤@¨Ç¦b Win 32 Àô¹Ò©³¤U¼¶¼gµ{¦¡ªº¸ê®Æ¡A©Ò¥H¥¦ªº¼ÐÃDÄæ¬O¡yWin32 Programmer's Reference¡z¡C·í§Ú̼¶¼g Win32 µ{¦¡®É¡A¥¦¬O¤@¥÷«nªº°Ñ¦Ò¤åÄm¡A¨ä¦a¦ì¬Û·í©ó Ralf Brown's ¤¤Â_¦Cªí¤@¼Ë¡C
§¹¦¨¦w¸Ë MASM32 ¤§«á¡A¥²¶·³]©w²ÕĶÀô¹Ò¡CMASM32 ²ÕĶ®É¡A¨Ã¤£¹³ Borland C++ Builder ©Î¬O Visual C++ ¤@¼Ë¾ã¦X¶}µoÀô¹Ò¡AMASM32 ¥²¶·¶i¤J©R¥O´£¥Ü¦C¤U¥H¤å¦r¿é¤J©R¥O²ÕĶ¡A´N¹³¥H«eªº DOS ®É¥N°õ¦æ«ü¥O¤@¼Ë¡C²ÕĶ¤Î³sµ²®Én¥Î¨ì³\¦h¥]§tÀÉ»Pµ{¦¡®w¡A©Ò¥H¬°¤F²ÕĶ¤è«K¡AÀ³¸Ó¨Æ¥ý³]©w¦n³o¨ÇÀô¹Ò¡C
°²¦p±z¨Ï¥Î Windows 95/98/Me¡A¥i¥H¦b AUTOEXEC.BAT ÀÉùØ¥[¤J¥H¤U¥|¦æ ( AUTOEXEC.BAT ¬O¤@¶i¤J MS-DOS ¼Ò¦¡´N·|¦Û°Ê°õ¦æªº§å¦¸ÀÉ¡A©Ò¥H¥un±z¥[¤J¤F¤U±³o¥|¦æ¥H«á¡A¥un¤@¶i¤J MS-DOS ¼Ò¦¡¡A¨t²Î´N·|¦Û°Ê±N²ÕĶÀô¹Ò³]¦n¡C¦pªG±z Win 9x ªº C:\ ¨S¦³ AUTOEXEC.BAT ¨º»ò´N±o¦Û¦æ¶}±Ò¤å®Ñ³B²zµ{¦¡¡A«Ø¥ß·sªº AUTOEXEC.BAT¡F¦pªG±z¤w¸g¦³ AUTOEXEC.BAT¡A¨º´N¥[¤W¥H¤U¥|¦æ )¡G
SET INCLUDE=X:\masm32\INCLUDE SET LIB=X:\masm32\LIB SET PATH=X:\masm32\BIN;%path% SET ML=/coff /link /SUBSYSTEM:WINDOWS
³o¥|¦æ¡A¤W±ªº X: ¬Oªí¥Ü±z¦w¸Ë MASM32 v7.0 ªººÏºÐ¾÷¦W¡Anª`·Nªº¬O ML ªº°Ñ¼Æ¬O¤j¤p¼g¦³§O¡A©Ò¥H¥²¶·¨Ì·Ó¤W±ªº¤j¤p¼g¡A§_«h·|²£¥Í¿ù»~¡C«e¨â¦æ¬O§i¶D¹q¸£¨ì¨ºùØ¥h§ä¥]§tÀÉ¥H¤Îµ{¦¡®w¡A²Ä¤T¦æ¬O§i¶D¹q¸£¨ì¨ºùØ¥h§ä²ÕĶ¾¹ ( ML.EXE ) ¥H¤Î³sµ²¾¹ ( LINK.EXE )¡A±z¥i¥H§ä¤@§äèè±z¦w¸ËªººÏºÐ¾÷ªº /masm32/BIN ¤l¥Ø¿ý¸ÌÀ³¸Ó¦³³o¨âÓ¥i°õ¦æÀÉ ( ML.EXE ©M LINK.EXE )¡C
¦b MASM 6.0 ¥H«áªº½sĶµ{¦¡¤£¦A¬O MASM.EXE ¤F¡A¦Ó§ï¬° ML.EXE¡A¥¦·|¦b²ÕĶ§¹¦¨«á¦Û°Ê©I¥s LINK.EXE °õ¦æ³sµ²¡A³o¼Ë´N¤£¶·¨Ï¥ÎªÌ©ó DOS ´£¥Ü¸¹«á¦A°õ¦æ LINK.EXE¡C³o¬O¤@¶µ¤£¿ùªº³]p¡A¥i±¤¦b DOS ªº°õ¦æÀɮ榡»P Win32 ªº¤£¦P¡A©Ò¥H¥²¶·¦b LINK ¤§«á¤U /SUBSYSTEM:WINDOWS «ü©w LINK.EXE n»s§@¦¨ Win32 ¥i°õ¦æÀɮ榡¡C¦]¦¹ ML.EXE ±o§â¡u»s§@¦¨ Win32 ¥i°õ¦æÀɪº°Ñ¼Æ¡v¶Ç»¼µ¹ LINK.EXE¡A´N¬O¨Ï¥Î /link ³oӰѼơA/link ¤§«á©Ò±µªº¡y/SUBSYSTEM:WINDOWS¡z´N¬O LINK.EXE ªº¨ä¤¤¤@ӰѼơA¥¦ªí¥Ü²£¥Í Win32 ªº¥i°õ¦æÀÉ¡C¦Ó /coff ¬O¨Ï ML.EXE «Ø¥ß COFF ®æ¦¡ªº¥ØªºÀÉ¡A§Ú·Q±z²{¦b¥unª¾¹D¡A¦b Win32 ªº¥i°õ¦æÀÉ¥²¶·¥Ñ COFF ®æ¦¡¥ØªºÀÉ»s§@¥X¨Ó´N¥i¥H¤F¡C
°²¦p±z¦b Windows XP ( NT §Ú¨S¸Õ¹L¡A¤£¹L²q·QÀ³¸Ó©M XP ¤@¼Ë ) ²ÕĶ¡A¤]©M¤Wz¤@¼Ë¡A³Ì¦n¤]¥ý»s§@©Îקï¤@ӧ妸ÀÉ¥H¦Û°Ê³]¦n²ÕĶÀô¹Ò¡A¨Ò¦p¦b C: ªº®Ú¥Ø¿ý¤Uªº AUTOEXEC.BAT ÀÉ¡A¨ä¤º®eÀ³¥]§t
SET INCLUDE=X:\masm32\INCLUDE;%INCLUDE% SET LIB=X:\masm32\LIB;%LIB% SET PATH=X:\masm32\BIN;%PATH% SET ML=/coff /link /SUBSYSTEM:WINDOWS
³o¥|¦æ¡A¨ä¤¤ªº·N¸q»P¤W±¬Û¦P¡A±zª`·N¨ì«e¤T¦æ³£¦³¤@¹ï¡y%¡z¥]§tµÛÀô¹ÒÅܼơA³o¬O¬°¤F¤£§ïÅÜ¥LÌ¡C¦sÀɤ§«á¡A±N·Æ¹«²¾¨ì¡y¶}©l¡z¡÷¡y©Ò¦³µ{¦¡¡z¡÷¡yªþÄÝÀ³¥Îµ{¦¡¡z¡÷¡y©R¥O´£¥Ü¦r¤¸¡z¤W¡A«ö¤U·Æ¹«¥kÁä«á·|ÂÛ²{¤@Ó¿ï³æ¡A¿ï¾Ü¨ä¤¤ªº¡y¤º®e¡z¤§«á¦A¿ï¾Ü¡y±¶®|¡z¼ÐÅÒ¡A¥X²{¤U¹Ï¡G
Win 32 µ{¦¡¬O¦b«OÅ@¼Ò¦¡¤U°õ¦æªº¡A³oªí¥Ü±z¤£¯à¹³¦b DOS §@·~¨t²Î¤@¼Ë¡A¥i¥H¥ô·N¦s¨ú¥ô·N¦ì§}ªº¸ê®Æ ( DOS ¨t²Î¤Î¨ä¤j³¡¤ÀªºÀ³¥Îµ{¦¡³£¬O¦b¯u¹ê¼Ò¦¡¤U°õ¦æªº )¡A¦b Win 32 §@·~¨t²Îùتºµ{¦¡¨º¨Ç¥i¥H³QŪ¨ú¦Ó¤£¯à¼g¤J¡A¨º¨Ç¤£¯àŪ¨ú¤]¤£¯à¼g¤J¡A¨º¨Ç¯àŪ¨ú¤]¯à¼g¤J³£¥Ñ§@·~¨t²Î«ü©w¡A©Ò¦³µ{¦¡³£n¿í¦u¡A§_«h Windows ´Nµ¹§A¤@ÓÂŦâµe±²×¤îµ{¦¡°õ¦æ¡C
¦b Win 32 §@·~¨t²ÎùØ¡A°O¾ÐÅ骺©w§}¤è¦¡¤£¦A¥Î¡y¬q¼È¦s¾¹¡G°¾²¾¦ì§}¡z¨Óªí¥Ü¤F¡A¦]¬°¦b Win32 §@·~¨t²Îùاï¥Î 32 ¦ì¤¸ªº¼È¦s¾¹¨Ó©w§}¡A32 ¦ì¤¸¥i¥H©w§} 4GB ªº°O¾ÐÅéªÅ¶¡ ( ¤]´N¬O 232¡×4,294,967,296 Ӧ줸²Õ )¡C¦b 4GB ³o»ò¤jªº°O¾ÐªÅ¶¡¡AWindows §@·~¨t²Î¬O§â¥¦¬Ý¦¨¥Ñ 00 ¨ì 4GB ³sÄòªºªÅ¶¡¡A¦ÓÀ³¥Îµ{¦¡n¦s¨ú¬Y¤@¦ì§}¤§¸ê®Æ¡A§@·~¨t²Î¯à±N¤§Âà´«¦¨¹ê»Ú°O¾ÐÅé©Ò¦b¦ì§}¡A³oºØ°O¾ÐÅé¼Ò¦¡ºÙ¬°¥©Z¼Ò¦¡ ( flat mode )¡A¦Ó Win 32 ©Ò¯à¥Îªº¼Ò¦¡¤]¥u¦³³o¤@ºØ¡C·íµM¬°¤FºÞ²z°O¾ÐÅé ( ¹ê²{è¤~©Ò»¡ªº¨º¤@¶ô°Ï°ì¥u¥iŪ¤£¥i¼g¡A¨º¤@¶ô¯àŪ¯à¼g )¡AWindows §@·~¨t²ÎÁÙ¬O§â°O¾ÐÅé¤À¦¨³\¦h¡y¬q¡z(section)¡A¦¹³Bªº¬q»P DOS ªº¬q ( segment ) ¤£¦P¡A¦¹³Bªº¬q¥i¥H¶W¹L 64KB¡A¦Ó¥B¤£»Ýn¬°¥¦«ü©w¬q¼È¦s¾¹¡A¨t²Î·|¦Û°Ê¤À¿ë¡C·í¤@Ó¬qªºµ²§ô´N¬O¥t¤@Ó¬qªº¶}©l¡C
Win 32 §@·~¨t²Îªº¬q (section) ¥u¦³¨âºØ¡A¤@¬Oµ{¦¡½X¬q¡A¥t¤@ºØ¬O¸ê®Æ¬q¡Cµ{¦¡½X¬q¬O¥Î¡y.code¡z¨Ó©w¸qªº¡A¦bµ{¦¡½X¬qªºµ{¦¡½X¬O¤£¥i§ï¼gªº¡A³oÂI©M DOS ¤£¦P¡A¦pªG¦³µ{¦¡·Q§ï¼g¦Û¤vªºµ{¦¡½X¡A±N·|±o¨ì¿ù»~°T®§¡C¦pªG±z¨Ï¥Î¡y.code¡z¨Ó©w¸q¤@ӰϬq¡A²ÕĶ¾¹·|¦Û¦æ°²³]°Ï¬q¦W¬°¡y_TEXT¡z¡C¦pªG±z·Q§ó§ï°Ï¬q¦WºÙ¡A¥i¥H¥Î¤U±ªº¤è¦¡¡G
°Ï¬q¦W SEGMENT 'CODE' °Ï¬q¦W ENDS
¸ê®Æ¬qÁÙ¥i¦A¤À¬°¤TºØ¡G
¦pªG±z·Q§ó§ï¸ê®Æ°Ï¬q¦WºÙ¡A¥i¥H¥Î¤U±ªº¤è¦¡¡G
°Ï¬q¦W SEGMENT °Ï¬q¦W ENDS
¥H¤p§@®a¬°¨Ò¡A¤@Óµøµ¡ªº¼Ò¼Ëªø±o¹³¤U¹Ï¡G
¤@Óµøµ¡¤jP¥i¤À¬°«D¤u§@°Ï ( Non-Client Area ) »P¤u§@°Ï ( client area¡A¤]¦³¤H½¦¨«È¤á°Ï )¡C«D¤u§@°Ï¬O¤j³¡¤Àµøµ¡±`¨£ªº³¡¥÷¡A¥]§tµøµ¡³Ì¤W±ªº¼ÐÃDÄæ¡A¼ÐÃDÄæ¤Wªº¹Ï¥Ü (icon )¡A¼ÐÃDÄæ¥kÃ䪺³Ì¤j¤Æ¡B³Ì¤p¤Æ¡BÁÙì¡BÃö³¬«ö¶s¡A¼ÐÃDÄ楪Ã䪺¨t²Î¥\¯àªí¥H¤ÎÃä®Ø¡C¤u§@°Ï«h¥]§t³\¦h¼u¥X¿ï³æªº¥D¿ï³æ ( menu )¡A¥Ñ³\¦h«ö¶s²Õ¦¨ªº¤u¨ãÄæ¡A¤U±¿é¥X©Î¿é¤J°T®§°Ï°ì©M³Ì¤U±¬Oª¬ºA¦C ( Åã¥Ü¤u§@®Éªº±¡ªp )¡C
¦b Win32 §@·~¨t²ÎùØ¡AÁÙ¦³¤@±ø«Ü«nªº³W«h¥²¶·¿í¦u¡A¨º´N¬O¡G Windows ¦b¤º³¡ÀWÁc¨Ï¥Î ESI¡AEDI¡AEBP¡AEBX ¼È¦s¾¹¡A¦Ó¤£¥hÀˬd³o¨Ç¼È¦s¾¹ªºÈ¬O§_³Q§ó§ï¡A©Ò¥H·í±zn¨Ï¥Î³o¨Ç¼È¦s¾¹®É¡A¥²¶·¥ý«O¦s¥¦Ì¡A«Ý¥Î§¹«á¦A«ì´_¡A§_«h·|¤Þ°_·í¾÷¡C
¦b DOS ®É¥N¼g²Õ¦X»y¨¥ªº¸ê®Æ«¬ºA«Ü²³æ¡A±`¥Îªº´N¥u¦³¦ì¤¸²Õ ( byte )¡B¦r²Õ ( word )¡BÂù¦r²Õ ( double word )¡B¤QӦ줸²Õ ( ten bytes ) µ¥¤£¨ì¤QºØ¡A³£¦b¸ê®Æ¬q©w¸q¡A©w¸q¤è¦¡¤À§O¬O DB¡BDW¡BDD¡BDT µ¥ ( ¦b MASM 6.0 ª©¥H«á¡A¥i¥H¥Î BYTE¡BWORD¡BDWORD¡BTBYTE ¨Ó©w¸q¡A¨ä·N¸q©M DB¡BDW¡BDD¡BDT µ¥¬Û¦P)¡C¦ý¬O¦b Win 32 Àô¹Ò¤Uªº¸ê®Æ«¬ºA¦ü¥G«Ü½ÆÂø¡A°£¤Fèè©Ò´£¨ìªº¤§¥~¡AÁÙ¦³ HINSTANCE¡BHWND¡BLPSTR¡K¡Kµ¥¼Æ¦ÊºØ ( ¤]¥i¯à¼Æ¤dºØ )¡C¨ä¹ê³o¨Ç¸ê®Æ«¬ºA¥u¤£¹L¬O¬°¤F¥iŪ©ÊªºÃö«Y¡A·í¬Ý¨ì¨S¬Ý¹Lªº¸ê®Æ«¬ºA¤£¥Îºò±i¡A¥unª¾¹D¡y³á¡A¦³³oºØ¸ê®Æ«¬ºA¡z´N¦n¤F¡A¦Ü©ó¥¦©Ò¥Nªíªºªø«×´X¥G³£¬OÂù¦r²Õ¡A°²¦p±z·Q½T©wªº¸Ü¡A¥i¥H¶}±Ò±z©Ò¦w¸Ëªº MASM32 ¸ê®Æ§¨ùتº INCLUDE ¤l¥Ø¿ýªº WINDOWS.INC ÀɮסC¨Ò¦p¦³¨âÓ¸ê®Æ§ÎºA¡AHINSTANCE ©M HWND¡A±z·Q¬Ý¬Ý¨ì©³¬O¤°»ò¡HWINDOWS.INC ·|¦³¨â¦æ¡G
HINSTANCE TYPEDEF DWORD HWND TYPEDEF DWORD
±z´N¥i¥Hª¾¹D HINSTANCE ©M HWND ªºªø«×§¡¬°¤@ÓÂù¦r²Õ ( Double Word ) ªº¤j¤p¡C¦Ó¨ä·N¸q±z¤]¥i¥H«Ü®e©ö¥Ñ¦r±¤W¸ÑŪ¥X¨Ó¡A¨Ò¦p HINSTANCE À³¸Ó§â¥¦¬Ý¦¨ handle of instance¡Ainstance ¬O°õ¦æ¹ê¨Òªº·N«ä¡A¦Ü©ó¨ä·N¸q¦b²Ä¤G³¹»¡©ú¡Chandle ¬O¥N½Xªº·N«ä¡A¥N½X¦b Win 32 Àô¹Ò©³¤U¬O«Ü±`¨£ªºªF¦è¡C¦b Win 32 Àô¹Ò¤U¡A¥i¯à¦³³\¦hµ{¦¡¦P®É°õ¦æ¡A¨CÓµ{¦¡³£¦³¤@Ó¿W¤@µL¤Gªº½s¸¹¡A¦¹½s¸¹´NºÙ¬°¥N½X¡A°õ¦æ¹ê¨Òªº½s¸¹´NºÙ°õ¦æ¹ê¨Ò¥N½X¡C²Ä¤G¦æªº HWND ´N¬O handle of windows¡Aªí¥Üµøµ¡¥N½X¤§·N¡AWin 32 Àô¹Òªº®à±¤W¡A¤]¦³³\¦hµøµ¡¡A¨C¤@µøµ¡¤]¦³¤@Ó¿W¤@µL¤Gªº½s¸¹¡AºÙ¬°µøµ¡¥N½X¡C¤]´N¬O»¡¡AHINSTANCE ªí¥Ü³o¬O¤@Ó°õ¦æ¹ê¨Ò¥N½Xªº¸ê®Æ«¬ºA¡AHWND ªí¥Ü³o¬O¤@Óµøµ¡¥N½Xªº¸ê®Æ«¬ºA¡A³o¨âºØ¸ê®Æ«¬ºA¨ä¹ê³£¬OÂù¦r²Õ¡C
¸ê®Æ§ÎºA«Ü®e©ö¥i¥H¥Ñ¦r±¤W²q¥X¨Ó¬O¤°»ò¡H¨Ò¦p©³¤U¥|Ó¸ê®Æ§ÎºA¡GLPSTR¡BLPCSTR¡BLPWSTR¡BLPCWSTR¡A¨ä¤¤ªº¡uLP¡v¥Nªíªøµ{«ü¼Ð ( long pointer )¡A¡uSTR¡v¥Nªí¦r¦ê ( string )¡A¡uC¡v¥Nªí±`¼Æ ( constant )¡A¡uW¡v¥Nªí¼e¦r¤¸ ( wide character )¡A©Ò¥H LPSTR ´Nªí¥Ü¦r¦êÅܼƪº¦ì§}¡ALPCSTR ªí¥Ü¦r¦ê±`¼Æ¦ì§}¡C
°£¤F¸ê®Æ«¬ºA±Ä¥Î³oºØ¦³¨t²Îªºªí¥Ü¤èªk¥~¡A¦b Win32 Àô¹Òùتºµ{¦¡¼g§@¤¤¡AÅܼƻP±`¼Æ¦WºÙ¤]±`±`±Ä¥Î¤@ºØ¦³¨t²Îªº©R¦W¤è¦¡¡AºÙ¬°¦I¤ú§Q©R¦Wªk ( Hungarian convention )¡A³o®M¤èªk¬O¥H«e·L³nªº¤uµ{®v Charles Simonyi µo©úªº¡A³oÓ©R¦W¤èªk§âÅܼƦWºÙ¤À¦¨¤T³¡¥÷¡A¦rº¡B¸ê®Æ«¬ºA»P×¹¢»y¡C¦rº¬O¥Î¨Óªí¥ÜÅܼƪº¨Ï¥Î¤èªk¡A¸ê®Æ«¬ºA¦b²Õ¦X»y¨¥¤¤¨Ã¤£«n¡A¥un¦b·Nªø«×§Y¥i¡A¯u¥¿ªí¥ÜÅܼƦWºÙ¬O³Ì«á±ªº×¹¢»y¡A¦p¦ó§â×¹¢»y¨ú±oµu¦ý¤S¤£¥¢¨ä·N¬O¤£¤Ó®e©öªº¡C±`¥Îªº¦rº»P¸ê®Æ«¬ºA¦p¤Uªí¡G
¦rº | ·N¡@¸q | ¡@ | ¸ê®Æ«¬ºA | ·N¡@¸q |
c | p¼Æ¾¹ | b | Boolean | |
h | ¥N½X | by | ¦ì¤¸²Õ(byte) | |
p | «ü¼Ð | c | ¦r¤¸(character) | |
lp | ªø«ü¼Ð | n | integer | |
g | ¥þ°ìÅÜ¼Æ | s | string | |
sz | ¥H¹sµ²§Àªº¦r¦ê | |||
u | µL¸¹¼Æ | |||
dw | Âù¦r²Õ(DWORD) |
Á|Ó¨Ò¤l¨Ó»¡¡A§A¬Ý¨ì lpText¡A´N¥i¥H³s·Q¨ì¦¹Åܼƪí¥Ü Text ¤§«ü¼Ð¡A§Yªí¥Ü Text ¦r¦ê¤§¦ì§}¡C
¦b Win32 Àô¹Ò¤U¼¶¼g²Õ¦X»y¨¥¡A±`±`¬°¤F¥iŪ©Ê¡A©Ò¥H¥Î±`¼Æ¦WºÙ¨Ó¥N´À¼ÆÈ¡C¨Ò¦p±z¦b§R°£Àɮ׮ɡA¨t²Î±`·|¼u¥X¤@Óµøµ¡°Ý±z¬O§_¯uªº§R°£¡Aµøµ¡¤W¦³¨âÓ«ö¶s¡y¬O¡z©M¡y§_¡z¡A¦b¼¶¼gµ{¦¡®É¡A±`¥Î±`¼Æ¦W¡AMB_YESNO¡Aªí¥Ü¡A¦Ó¤£¥Î¼ÆȪí¥Ü¡C³o¨Ç±`¼Æ©M¼ÆȤ§¶¡ªºÃö«Y¤]³£°O¿ý¦b WINDOWS.INC ùØ¡C
¤£ºÞ¦b DOS ©Î Win32 ¨t²Îªº°õ¦æªºµ{¦¡¡A³£·|±µ¦¬¨ì¨Ï¥ÎªÌ¬O§_«ö¤UÁä¡B¬O§_²¾°Ê·Æ¹«©ÎªÌ«ö¤U·Æ¹«¤Wªº«ö¶sµ¥µ¥°Ê§@¡A³o¨Ç°Ê§@ºÙ¤§¬°¨Æ¥ó¡C¦b DOS Àô¹Ò¤Uªºµ{¦¡¡A¥²¶·¥Ñµ{¦¡¤£Â_ªºÀˬd³o¨Ç¨Æ¥ó¡A¦Óµ{¦¡¥²¶·°w¹ï³o¨Ç¨Æ¥ó§@¥X³B²z¨Ó¡C
¦Ó Win 32 ¬O¦h¤u¨t²Î¡A¨C¦¸¨Ï¥ÎªÌIJµo³o¨Ç¨Æ¥ó®É¡A¥Ñ¨t²Î§PÂ_¨Ï¥ÎªÌ°µ¥X³o¨Ç¨Æ¥ó®É¬O¦b¨º¤@Óµ{¦¡©Î¨º¤@Óµøµ¡ùØ¡AµM«á¦A¥Ñ¨t²Î§â¸Ó¨Æ¥óµo¥Í®Éªº¤@¨Ç¸ê®ÆÅܦ¨¤@Óµ²ºcÅé¡AºÙ¬°°T®§¶Ç»¼µ¹¸Óµ{¦¡©Îµøµ¡¡A³qª¾¸Óµ{¦¡¦³¨Æ±¡¥²¶·³B²z¤F¡C©Ò¥H§Ú̼¶¼gªºµ{¦¡¥²¶·¦³¤@Ó±µ¦¬¨Ó¦Û¨t²Î°T®§ªº°j°é¡A¤]¥²¶·¦³¤@¬qµ{¦¡¨Ó³B²z³o¨Ç¨Æ¥ó¡C³o´N¬O©Ò¿×ªº¨Æ¥óÅX°Ê©Î°T®§ÅX°Ê¡C
¤£ºÞ¬O Win32 ¤]¦n©Î¬O DOS µ{¦¡¤]¦n¡A¬Û¦Pªº¦a¤è¬O³£¥²¶·°w¹ï¨Ï¥ÎªÌªº°Ê§@¨Æ¥ý³]p¦n¦p¦ó³B²z¡C¤£¦Pªº¦a¤è¬O Win32 ªºµ{¦¡¬O³Q°Ê¦a³qª¾n³B²zªº°T®§¡A¦Ó DOS µ{¦¡«h¬O¥D°Ê¦aÀˬd°T®§¡C¨âªÌ¦bÆ[©À¤W¤£¤Ó¬Û¦P¡A¬Oè½ñ¤J Win32 µ{¦¡³]pªÌÃø¥H±µ¨üªº¡C
¦n¤F¡A©³¤U§ÚÌ´N¶i¤J²Ä¤@³¹¥ý¬Ý¬Ý¤@Ó²³æªºµ{¦¡¡A¦ý¬O¹ê»Ú¯u¥¿²o¯A¨ì°T®§ªº Win32 µ{¦¡¬O¦b²Ä¤G³¹¡C