¾Ú¤p¤ì°¸©Òª¾¡A¦b Win32 §@·~¨t²ÎùØ¡A®É¶¡ªº°O¿ý¤è¦¡¦Ü¤Ö¦³¥|ºØ¡G
Tick ¬O«ü§@·~¨t²Î±Ò°Ê«á¡A©Ò¸g¾úªº²@¬í¼Æ¡A¥i¥H¥Î GetTickCount ¨ú±o¡AGetTickCount ¨S¦³¥ô¦ó°Ñ¼Æ¡Aªð¦^«á EAX ´N¬O§@·~¨t²Î±Ò°Ê«á©Ò¸g¾úªº²@¬í¼Æ¡CEAX ªø«×¬°¤@ÓÂù¦r²Õ¡A³Ì¦h¨ì 49.7 ¤é«á¡A´N·|Âk¹s¡C
²Ä¤GÓ°O¿ý®É¶¡ªº¤è¦¡¬O FILETIME¡A¥Dn¬O¥Î¨Ó°O¿ýÀɮ׮ɶ¡¡CFILETIME ¨ä¹ê¬O¤@Óµ²ºcÅé¡A³\¦h»PÀɮ׸ê®Æ¦³Ãöªº API ³£·|²o¯A¨ì FILETIME¡C¨Ò¦p GetFileTime¡BGetFileInformationByHandle µ¥ Win32 API¡A©³¤U¬O GetFileTime API ªºì«¬¡G
INVOKE GetFileTime,hFile,lpCreationTime,lpLastAccessTime,lpLastWriteTime
GetFileTime ¬O¥Î¨Ó¨ú±oÀɮתº«Ø¥ß®É¶¡¡B³Ì«á¦s¨ú®É¶¡¡B³Ì«áקï®É¶¡¡A¨ä³Ì«áªº¤TӰѼơAlpCreationTime¡BlpLastAccessTime¡BlpLastWriteTime ¤À§O¬O hFile ©Ò¥NªíÀɮתº«Ø¥ß®É¶¡¡B³Ì«á¦s¨ú®É¶¡¡B³Ì«áקï®É¶¡ ( ¦³Ãö³o¤TºØ®É¶¡¡A½Ð°Ñ¦ÒÀɮ׮ɶ¡ )¡C³o¤TӰѼƧ¡¬°¦ì§}«ü¼Ð¡A¦U«ü¦V¤@ºØºÙ¬° FILETIME µ²ºcÅé¡C©I¥s GetFileTime ¤§«á¡A¦pªG¦¨¥\°õ¦æ¡A¨t²Î·|¤À§O¦b lpCreationTime¡BlpLastAccessTime¡BlpLastWriteTime ¤TÓ¦ì§}«ü¼Ð©Ò«üªº FILETIME µ²ºcÅ餤¦s¤J hFile ªº¹ïÀ³Àɮ׮ɶ¡¡A¨Ãªð¦^«D¹sÈ¡F¦pªG¥¢±Ñ«hªð¦^ 0¡C
¦³Ãö FILETIME µ²ºcÅ骺Äæ¦ì¬O¡G
FILETIME STRUCT dwLowDateTime DWORD ? dwHighDateTime DWORD ? FILETIME ENDS
¨Æ¹ê¤W¡AFILETIME µ²ºcÅé¬O¤@Ó 64 ¦ì¤¸ªº¼ÆÈ¡AdwLowDateTime ¬O¸û§Cªº 32 ¦ì¤¸¡AdwHighDateTime ¬O¸û°ªªº 32 ¦ì¤¸¡A¨âªÌ²Õ¦¨¤@Ó 64 ¦ì¤¸ªº¼ÆÈ ( dwHighDateTime¡Ñ100000000H¡ÏdwLowDateTime )¡A³æ¦ì¬O 100 ©`¬í¡C±q¥@¬É¼Ð·Ç®É¶¡ ( coordinated universal time¡A²ºÙ UTC¡A¤¤¤å¬°¥@¬É¨ó½Õ®É¶¡¡A¤]¥s¥@¬É¼Ð·Ç®É¶¡ ) ¦è¤¸ 1601 ¦~¤¸¤ë¤¸¤é¹s®É¹s¤À¹s¤À¹s¬í¡A¥H 100 ©`¬í¬°³æ¦ì¡A¶}©lp®É¡CFILETIME pºâ¤è¦¡¬O¨C¤Ñ¥H 86400 ¬ípºâ ( 60*60*24¡×86400 )¡A¤@Ó¥¦~¦³ 365 ¤Ñ¡A¤@Ó¶|¦~¦³ 366 ¤Ñpºâ¡C¤@¯ë¦Ó¨¥¡A¨C¥|¦~¦³¤@Ó¶|¦~¡A¥H¦è¤¸¦~¼Æ¯à¬° 4 ¾ã°£ªÌ¬°¶|¦~¡A¨Ò¦p¦è¤¸ 1604¡B1608 ¦~¬°¶|¦~¡A¦Ó 1601¡B1602 ¬°¥¦~¡F¦ý¬O¦pªG¬O¦è¤¸¦~¼Æ¥½¨â¦ì¬°¡u00¡vªº¡A¥²¶·n¯à¬° 400 ¾ã°£¡A¤~ºâ¬O¶|¦~¡A©Ò¥H¦è¤¸ 2000 ¦~¬O¶|¦~¡A¦Ó¦è¤¸ 1700¡B1800¡B1900 ¬O¥¦~¡C«ö¤W±¤èªk¡A¨C¤@Ó¥¦~·|¨Ï FILETIME ¼W¥[ 11ED178C6C000H¡A¨CÓ¶|¦~¨Ï FILETILE ¼W¥[ 11F9AA3308000H¡A¦Ó 64 ¦ì¤¸ªº³Ì¤j¥¿¼Æ¬O 7FFFFFFFFFFFFFFFH¡A¥i¥H±Àºâ FILETIME ¯à°O¸ü¨ì¦è¤¸ 30828 ¦~ 9 ¤ë 14 ¤é¡C
¦pªGÀɮרt²Î¤£¤ä´©¬YÓÀɮ׮ɶ¡¡A«h¸Ó FILETIME ·|Åܬ° 0¡A¨Ò¦p DOS §@·~¨t²ÎªºÀɮרt²Î¡AFAT12/16 ¥H¤Î Windows 95/98/Me µ¥¨t²Î¨Ï¥Îªº¬O FAT12/16/32 Àɮק@·~¨t²Î¡A³£¶È¶È°O¿ýÀɮ׫إ߮ɶ¡¡A©Ò¥H¦pªG¥H GetFileTime ¨ú±o¦ì©ó FAT12/16/32 ªºÀɮפ§®É¶¡¡A³Ì«á¦s¨ú®É¶¡´NµL·N¸q¡A·|³Q¶ñ¤J 0¡C¥t¥~ Windows NT/XP ©Ò¨Ï¥ÎªºÀɮ׮ɶ¡¡A§¡¥H¥@¬É¼Ð·Ç®É¶¡ªº®É¶¡¼g¤JºÏºÐ¤¤¡C¨Ò¦p¡A°²¨Ï¨Ï¥ÎªÌ©ó¤¤µØ¥Á°ê 103 ¦~¤C¤ë¤Q¤T¤é¤EÂI 45 ¤À¾ã®É¡A«Ø¥ß¤@Ó·sÀɮסA¨º»ò¹ê»Ú¤W¦bºÏºÐªº°O¿ý¬O¦è¤¸ 2014 ¦~¤C¤ë¤Q¤T¤éâ±á¤@ÂI 45 ¤À¾ã¡C
²³©Ò¬Òª¾¡A¥þ²y¹º¤À¦¨ 24 ӮɰϡA¥@¬É¼Ð·Ç®É¶¡¬O¥H¥»ªì¤l¤È½u ( ªF¸g 0 «× ) ¬°¼Ð·Ç®É¶¡¡CGetFileTime ©Ò±o¨ìªº¬O¥@¬É¼Ð·Ç®É¶¡¡A¦pªGnÂàÅܦ¨·í¦a®É¶¡¡A»Ý©I¥s FileTimeToLocalFileTime¡AFileTimeToLocalFileTime ªºì«¬¬O
INVOKE FileTimeToLocalFileTime,lpFileTime,lpLocalFileTime
³o¨âӰѼơAlpFileTime¡BlpLocalFileTime ³£¬O¦ì§}«ü¼Ð¡AÀ³«ü¦V¨âÓ¤£¦Pªº FILETIME µ²ºcÅé¡A«eªÌ¬O¥@¬É¼Ð·Ç®É¶¡¡A«áªÌ¬O·í¦a®É¶¡¡C©I¥s«e¶·§â lpFileTime¡BlpLocalFileTime ¤Î lpFileTime ©Ò«üªº FILETIME µ²ºcÅé ( ¤]´N¬OnÂà´«ªº UTC ®É¶¡ ) ¶ñ¦n¡A©I¥s®É Windows ·|pºâ¦n·í¦a®É¶¡¡A¨Ã¶ñ¤J lpLocalFileTime ©Ò«üªºµ²ºcÅ餺¡C¦pªG¦¨¥\§¹¦¨¡Aªð¦^«D¹sÈ¡F¦pªG¥¢±Ñ¡Aªð¦^¹s¡C
¨º»ò¡AFileTimeToLocalFileTime ¤S«ç»òª¾¹D¨Ï¥ÎªÌ©Ò¦b®É°Ï©O¡Hì¨Ó§â·Æ¹«¿Ã¹õ¥k¤U¨¤Åã¥Ü®É¶¡ªº¦a¤è¡A«ö¤U·Æ¹«¥kÁä¡A¦b¼u¥X¿ï³æ¤¤¿ï¡u½Õ¾ã¤é´Á©M®É¶¡¡v¡A©ó¼u¥Xªº¹ï¸Ü²°¤¤¿ï¡u®É°Ï¡v( °Ñ¦Ò¤U¹Ï¬õ®Ø°é°_¨Óªº³¡¥÷ )¡A´N¥i¥H³]©w®É°Ï¡A¦]¦¹ Windows ´N¥i¥H±oª¾·í¦a®É¶¡»P¥@¬É¼Ð·Ç®É¶¡¬Û®t¦h¤Ö¤p®É¡C°Ñ¦Ò¤U¹Ï¡G
¥H¤¤µØ¥Á°ê¥xÆW¦Ó¨¥¡A¤ñ¥@¬É¼Ð·Ç®É¶¡¦¤F¤KÓ¤p®É¡A©Ò¥H°²¦p¤¤µØ¥Á°ê·í¦a®É¶¡¬O¦è¤¸ 2014 ¦~¤C¤ë¤Q¤T¤é¤EÂI 45 ¤À¾ã ( 01CF9E7F1CE77600H )¡A¥@¬É¼Ð·Ç®É¶¡¨ä¹ê¬O¦è¤¸ 2014 ¦~¤C¤ë¤Q¤T¤éâ±á¤@ÂI 45 ¤À¾ã ( 01CF9E3C0EC43600H )¡A¨âªÌ¬Û®t 28800 ¬í¡A§Y 8 ¤p®É¡CFileTimeToLocalFileTime ¤]¬O§Q¥Î¦¹ì²z¡A±N UTC ¼W´î¤@©wªº¬í¼Æ¦Ó´«ºâ¦¨·í¦a®É¶¡¡C¦³¨Ç°ê®a©Î¦a°Ï·|¹ê¬I¤é¥ú¸`¬ù®É¶¡ ( ¥ç§Y®L¤é®É§â®É¶¡½Õ§Ö¤@¤p®É¡A¥H¹F¸`¬ù¯à·½ªº¥Øªº )¡A·|¦Û°Ê¥X²{¦b¤W¹Ï¤¤ªº¦a¹Ï¤U¤è¡Aµµ¦â®Ø®Ø³ò°_¨Óªº¦a¤è¡C
²Ä¤TºØ°O¿ý®É¶¡ªº¤èªk¬O SYSTEMTIME µ²ºcÅé¡CSYSTEMTIME ªº®É¶¡Äæ¦ì¦p¤U¡G
SYSTEMTIME STRUCT wYear DW ? ;wYear ¬O¦è¤¸¦~¼Æ¡A¥Ñ 1601 ¨ì 30827 wMonth DW ? ;wMonth ¬O¤ë¥÷¡A¥Ñ 1 ¨ì 12¡A¤À§O¥Nªí¤@¤ë¨ì¤Q¤G¤ë wDayOfWeek DW ? ;wDayOfWeek ¬O¬P´Á´X¡A¥Ñ 0 ¨ì 6¡A¤À§O¥Nªí¬P´Á¤é¨ì¬P´Á¤» wDay DW ? ;wDay ªí¥Ü¤é¡A¥Ñ 1 ³Ì¦h¥i¥H¨ì 31 wHour DW ? ;wHour ¬O¤p®É¡A¥Ñ 0 ¨ì 23 wMinute DW ? ;wMinute ¬O¤ÀÄÁ¡A¥Ñ 0 ¨ì 59 wSecond DW ? ;wSecond ¬O¬íÄÁ¡A¥Ñ 0 ¨ì 59 wMilliseconds DW ? ;wMilliseconds ªí¥Ü²@¬í¡A¥Ñ 0 ¨ì 999 SYSTEMTIME ENDS
¦UÄæ¦ìªº·N¸qÅã¦Ó©ö¨£¡Anª`·Nªº¬O wDay ªº½d³ò¡C¦pªG¬O¤p¤ë ( ¦p¥|¤ë¡B¤»¤ëµ¥)¡A¥u¯à¨ì 30¡F¤G¤ë¬O 28 ©Î 29¡Aµø¥¦~©Î¶|¦~¦Ó©w¡F¤j¤ë ( ¦p¤@¤ë¡B¤T¤ëµ¥ ) ¥i¨ì 31¡C¥Ñ¤W±ªº¤¶²Ð¥iª¾¡ASYSTEMTIME ªº®É¶¡®æ¦¡¤ñ°_ FILETIME ®æ¦¡¦nÀ´±o¦h¡F¦ý¬O¦pªGn°µ¹Bºâ¡A¨Ò¦p¨D¨â¨Æ¥ó¬Û¹j¦h¤[ªº®É¶¡¡A«o¬O¥H FILETIME ¸û¬°¤è«K¡C
§ÚÌ·|«Ü±`¦b³o FILETIME »P SYSTEMTIME ³o¨âºØ®æ¦¡¤§¶¡°µÂà´«¡A¦ý¬O¦pªG¯uªº¥H¤W±¤è¦¡±Àºâ¡A¹ê¦b¤Ó³Â·Ð¡C·L³n¦¤w¦³¤F´À¥N¤è®×¡A¨º´N¬O FileTimeToSystemTime¡BSystemTimeToFileTime API¡A«eªÌ±Mªù¥Î¨Ó§â FILETIME ªº®É¶¡®æ¦¡Âà´«¦¨ SYSTEMTIME ªº®É¶¡®æ¦¡¡F¦Ó«áªÌ«h¬O°µ¬Û¤Ïªº¹Lµ{¡C·L³n¤]«Øij±Ä¥Î³o¨âÓ API Âà´« FILETIME¡BSYSTEMTIME ¨âºØ®æ¦¡¡A¦Ó¾¨¶q¤Ö¦Û¦æ¼gµ{¦¡Âà´«¡C¥¦Ìªºì«¬¬O¡G
INVOKE FileTimeToSystemTime,lpFileTime,lpSystemTime INVOKE SystemTimeToFileTime,lpSystemTime,lpFileTime
FileTimeToSystemTime ªº²Ä¤@ӰѼƬO lpFileTime¡A¬°¤@¦ì§}«ü¼Ð¡A«ü¦V FILETIME µ²ºcÅé¡F²Ä¤GӰѼƬO lpSystemTime¡A¤]¬O¦ì§}«ü¼Ð¡A«ü¦V SYSTEMTIME µ²ºcÅé¡C©I¥s FileTimeToSystemTime «e»Ý±N lpFileTime¡BlpSystemTime »P lpFileTime ©Ò«üªº FILETIME ¶ñ¦n¡AFileTimeToSystemTime ·|§â FILETIME ªº®É¶¡®æ¦¡Âà´«¦¨ SYSTEMTIME ªº®É¶¡®æ¦¡¡C¦pªG FILETIME µ²ºcÅ餺ªº®É¶¡¬O¥@¬É¼Ð·Ç®É¶¡¡AÂà´««áÅܦ¨ SYSTEMTIME ®æ¦¡ªº¥@¬É¼Ð·Ç®É¶¡¡FªG¬O·í¦a®É¶¡¡AÂà´««áÅܦ¨ SYSTEMTIME ®æ¦¡ªº·í¦a®É¶¡¡C¦pªG¦¨¥\ªºÂà´«¦¨ SYSTEMTIME ®æ¦¡¡Aªð¦^Ȭ°«D¹s¡A§_«h¬°¹s¡C
SystemTimeToFileTime ¬O¥Î©ó§â SYSTEMTIME ®æ¦¡Âà´«¦¨ FILETIME¡C©I¥s«e¡A»Ý§â lpSystemTime ©Ò«üªº SYSTEMTIME µ²ºcÅé¶ñ¦n¥¿½T®É¶¡¡A¦UÄ檺½d³ò¤]»Ý¥¿½T¡A©I¥s¦¨¥\«á¡A¨t²Î·|¦b lpFileTime ©Ò«ü¦ì§}¶ñ¤W FILETIME ®æ¦¡ªº®É¶¡¡A¨Ãªð¦^«D¹sÈ¡A¦pªG©I¥s¥¢±Ñ¡A«h¶Ç¦^¹s¡CSystemTimeToFileTime ¤ñ¸û¦³½ìªº¤@ÂI¬O¦b lpSystemTime ©Ò«üªº SYSTEMTIME µ²ºcÅ餤ªº wDayOfWeek §Y¨Ï¬O¿ù»~ªº¡A¤]¤£·|¼vÅT¨ìµ²ªG¡C
±q¦r±¤W¬Ý¡A³o¬O¤@ºØ°ª¸ÑªR«×ªº®É¶¡p¼Æ¾¹¡A§Q¥Î³oÓ°ª¸ÑªR«×®É¶¡p¼Æ¾¹¡A¥i¥H´ú¶q¥X¹q¸£°õ¦æ¤@¥ó¨Æ©Òªáªº®É¶¡¡Aºë½T¨ì·L¬íµ¥¯Å ( ·L¬í¬O 10¡Ð6 ¬í )¡C¥i±¤ªº¬O¡A¨Ã¤£¬O©Ò¦³ªº¹q¸£³£¦³¦w¸Ë³oºØp¼Æ¾¹¡C¦]¦¹¦b¨Ï¥Î³oºØp¼Æ¾¹¤§«e¡A¥²¶·¥ý½T©w¦¹¹q¸£¬O§_¦³¦w¸Ë³oºØ°ª¸ÑªR«×®É¶¡p¼Æ¾¹¡C¤èªk¬O©I¥s QueryPerformanceFrequency¡AQueryPerformanceFrequency ªºì«¬¦p¤U
BOOL QueryPerformanceFrequency ( LARGE_INTEGER *lpFrequency );
¦pªG©I¥s¦¨¥\¡A¶Ç¦^Ȭ° TRUE¡F§_«h¬° FALSE¡CQueryPerformanceFrequency ¥u¦³¤@ӰѼơAlpFrequency¡C¦¹°Ñ¼Æ«ü¦V¤@Ó LARGE_INTEGER ªº¦ì§}¡ALARGE_INTEGER ¬O¤@Ó 64 ¦ì¤¸ªø ( §Y¥|¦r²Õ¡AQWORD ) ªºÅܼơC´«¥y¸Ü»¡¡AQueryPerformanceFrequency ªº°ß¤@¤@ӰѼƬO«ü¦V¤@Ó 64 ¦ì¤¸ªøªºÅܼƦì§}¡C¦pªG QueryPerformanceFrequency ¦¨¥\ªð¦^®É¡A·|§â°ª¸ÑªR«×®É¶¡p¼Æ¾¹ªºÀW²v¡A¦s¤J³oÓ 64 ¦ì¤¸ªøªºÅܼÆùØ¡A¨Ã¨Ï EAX ªð¦^Ȭ° TRUE¡F¦pªG¡A¹q¸£¤¤¨S¦³¦w¸Ë°ª¸ÑªR«×®É¶¡p¼Æ¾¹¡A¨º»ò³oÓ 64 ¦ì¤¸ªøªºÅܼƷ|¦s¤J 0¡Aªð¦^Ȥ´¬° TRUE¡C
°ª¸ÑªR«×®É¶¡p¼Æ¾¹·|¦b±q¨t²Î±Ò°Ê®É³]¬° 0¡A¨C¹j¤@¬q·¥µuªº®É¶¡´N¼W¥[¤@¡C°ª¸ÑªR«×®É¶¡p¼Æ¾¹ªºÀW²v«h¬O«ü¡A³oÓp¼Æ¾¹¨C¬í¼W¥[ªº¼ÆÈ¡A¦pªG¨C¬í¼W¥[ªº¼ÆȶV¦h¡A´N¬O¥Nªí¨C¼W¥[¤@©Òªá®É¶¡¶Vµu¡C¨Ò¦p¡A¤p¤ì°¸¦³¤@¥x DELL E5400 µ§¹q¡A¨ä°ª¸ÑªR«×®É¶¡p¼Æ¾¹ªºÀW²v¬° 3579545¡A·N«ä¬O¨C¤@¬íÄÁ¯à¨Ïp¼Æ¾¹ªº¼ÆȼW¥[ 3579545¡C´«¥y¸Ü»¡¡A¨C¼W¥[¤@¡A¥u»Ýªá¶O 1/3579545 ¬í¡A¤j¬ù¬O 2.794¡Ñ10¡Ð7 ¬í¡C
¨º»ò¡An«ç»ò¥h´ú¶q¹q¸£°õ¦æ¤@Ó¤u§@©Òªáªº®É¶¡¬O¦h¤Ö©O¡H¤p¤ì°¸±o¥ý¤¶²Ð¥t¤@Ó Win32 API¡A¥¦¬O¥Î¨ÓÀò±o°ª¸ÑªR«×®É¶¡p¼Æ¾¹¥Ø«eªº¼ÆÈ¡A¨ä쫬¬°
BOOL QueryPerformanceCounter ( LARGE_INTEGER *lpPerformanceCount );
QueryPerformanceCounter ¥u¦³¤@ӰѼơA¥Î¨Ó«ü¦V¤@Ó 64 ¦ì¤¸Åܼƪº¦ì§}¡C¦pªG©I¥s¦¨¥\¡AQueryPerformanceCounter ªº¶Ç¦^Ȭ° TRUE¡A¦P®É¡A¨t²Î·|§â°ª¸ÑªR«×®É¶¡p¼Æ¾¹¥Ø«eªº¼ÆÈ¡A¦s¤J¦¹ÅܼÆùØ¡F¦pªG©I¥s¥¢±Ñ¡A¶Ç¦^Ȭ° FALSE¡C¦]¦¹¡A¨Ï¥Î°ª¸ÑªR«×®É¶¡p¼Æ¾¹¡A¥h´ú¶q¹q¸£°õ¦æ¤@¥ó¨Æ©Òªáªº®É¶¡¡A¨ä¨BÆJ¦p¤U¡G
INVOKE QueryPerformanceFrequency,OFFSET freq INVOKE QueryPerformanceCounter,OFFSET t1 call do_something INVOKE QueryPerformanceCounter,OFFSET t2 finit ;--st0--;--st1--; fild t2 ; t2 ; ; fild t1 ; t1 ; t2 ; fsub ; t2-t1 ; ; fild freq ; freg ; £Gt ; fdiv ;£Gt/freq; ;
¥ý©I¥s QueryPerformanceFrequency¡A¨ú±o¤@¬íÄÁ¼W¥[ªº¼ÆÈ¡A§Y¤W±µ{¦¡¤ù¬qªº freq¡C¦b¹q¸£°õ¦æ¤@¥ó¨Æ«e«á¡A¤À§O©I¥s QueryPerformanceCounter¡A°O¤U°ª¸ÑªR«×®É¶¡p¼Æ¾¹¦b°õ¦æ¸Ó¥ó¨Æ«e«áªº¼ÆÈ¡At1¡Bt2¡A¨ä®tÈ´N¬O°õ¦æ³o¥ó¨Æ®É¡Ap¼Æ¾¹¼W¥[¤F¦h¤Ö¼ÆÈ¡A§Y ( t2¡Ðt1 )¡C¦]¨C¬íÄÁ¼W¥[ freq¡A¬G¨C¼W¥[¤@©Òªáªº®É¶¡¬° 1/freq¡A¦A¼¤W ( t2¡Ðt1 )¡A´N¬O¹q¸£©I¥s do_something °Æµ{¦¡©Òªáªº®É¶¡¡C¦ý¦¹®É¶¡¥i¯à¬O«Ü¤pªº¼Æ¡A¨Ã¥H¯BÂI¼Æ¦s©ó FPU ªº ST(0) ¼È¦s¾¹ùØ¡C
n¨ú±o²{¦bªº®É¶¡¡A¥i©I¥s GetSystemTime ©Î GetLocalTime¡A«eªÌ¬O±o¨ì²{¦bªº¥@¬É¼Ð·Ç®É¶¡¡A«áªÌ¬O±o¨ì²{¦bªº·í¦a®É¶¡¡C¥¦Ìªºì«¬¬O¡G
INVOKE GetSystemTime,lpSystemTime INVOKE GetLocalTime,lpSystemTime
³o¨âÓ API ³£¥u¦³¤@ӰѼơAlpSystemTime¡A¬°¤@¦ì§}«ü¼Ð¡A«ü¦V SYSTEMTIME µ²ºcÅé¡A©I¥s«á¡A¨t²Î·|§â²{¦b¥@¬É¼Ð·Ç®É¶¡©Î·í¦a®É¶¡¶ñ¤J SYSTEMTIME ùØ¡C³o¨âÓ API ³£¨S¦³¶Ç¦^È¡A¤]¨S¦³¿ù»~½X¡C
¬JµMÀò±o²{¦b®É¶¡¡An©I¥s GetSystemTime ©Î GetLocalTime¡F¨º»ò³]©w²{¦bªº®É¶¡¡AÀ³¸Ó´N¬O©I¥s SetSystemTime ©Î SetLocalTime ¤F¡Hªº½T¬O¦p¦¹¡ASetSystemTime ©Î SetLocalTime ªºì«¬¦p¤U¡G
INVOKE SetSystemTime,lpSystemTime INVOKE SetLocalTime,lpSystemTime
«eªÌ¬O³]©w¥@¬É¼Ð·Ç®É¶¡¡A«áªÌ¬O³]©w·í¦a®É¶¡¡C³o¨âÓ API ³£¥u¦³¤@ӰѼơAlpSystemTime¡A¬°¤@¦ì§}«ü¼Ð¡A«ü¦V SYSTEMTIME µ²ºcÅé¡A©I¥s«en§â SYSTEMTIME µ²ºcÅé¶ñ¤W¥¿½Tªº®É¶¡¡A¦ý¨ä¤¤ªº wDayOfWeek ¥i¥H©¿²¤¤£¶ñ¡C¦pªG¦¨¥\¡Aªð¦^«D¹sÈ¡F§_«hªð¦^¹s¡CWin32 ¨t²Î¤¤¹ê»Úp®Éªº¬O¥@¬É¼Ð·Ç®É¶¡¡A¦]¦¹¦pªGµ{¦¡©I¥s SetLocalTime ¦¨¥\ªº³]©w®É¶¡®É¡A¨t²Î¨ä¹ê¤w¸g§Q¥Î®É°Ï¤Î¤é¥ú¸`¬ù®É¶¡ªº¸ê®Æ¡A·t¦aùؽվã¨t²Î¤º³¡ªº¥@¬É¼Ð·Ç®É¶¡¡C¦¹¥~¡A³o¨âÓ API ©I¥s«e¡A³£¥²¶·¨Ïµ{¦¡¨ã¦³ SE_SYSTEMTIME_NAME ¯SÅv¤~¥i¥H¡C
°²³]¦b SYSTEMTIME ¤¤¤w¦³¤F®É¶¡¡A¦pªG§Q¥Î wsprintf ¤À§O§â SYSTEMTIME ªº¦UÄæ¦ìªº¸ê®Æ¼g¦b¬Y¶ô°O¾ÐÅ餤¡A¦A§â¸Ó°O¾ÐÅ餺®e¦L¦b¿Ã¹õ¤W¡A¤]¬O¥¼¹Á¤£¥i¡C¦ý¦¹³B¤p¤ì°¸·Q©I¥s GetDateFormat¡BGetTimeFormat ¨âÓ API ³B²z¡A¥i¯à§ó¬°Â²³æ¡C©³¤U¬O³o¨âÓ API ¤§ì«¬¡G
INVOKE GetDateFormat,Locale,dwFlags,lpDate,lpFormat,lpDateStr,cchDate INVOKE GetTimeFormat,Locale,dwFlags,lpTime,lpFormat,lpTimeStr,cchTime
³o¨âÓ API ¬O§â lpDate¡BlpTime ©Ò«ü SYSTEMTIME µ²ºcÅ餺ªº®É¶¡¡A¥H¯S©wªº®æ¦¡Åܦ¨¥H¹sµ²§Àªº¦r¦ê¡AÀx¦s¦b lpDateStr¡BlpTimeStr ©Ò«üªº°O¾ÐÅ餺¡C¦¹¯S©wªº®æ¦¡¬O¥Ñ Locale¡BdwFlags¡BlpFormat ¤TӰѼƦ@¦P¨M©w¡C¨ä¤¤³Ì¬°«nªº¬O lpFormat °Ñ¼Æ¡A¦pªG lpFormat ¬°¹s¡Aªí¥Ü¥Ñ Locale¡BdwFlags ¨M©w®æ¦¡¡F¦pªG lpFormat ¤£¬°¹s¡A«h lpFormat ¬°¥H NULL µ²§Àªº®æ¦¡¦r¦ê¤§¦ì§}¡A³o®É dwFlags ¥²¶·³]¬°¹s¡CGetDateFormat ªº lpFormat ©Ò«üªº®æ¦¡¦r¦ê·|¥Î¨ì¡uy¡v¡B¡uM¡v¡B¡ud¡v¡B¡ug¡vµ¥¯S®íªº®æ¦¡¦r¤¸¡FGetTimeFormat ªº lpFormat ©Ò«üªº®æ¦¡¦r¦ê·|¥Î¨ì¡ut¡v¡B¡uh¡v¡B¡uH¡v¡B¡um¡v¡B¡us¡vµ¥¯S®íªº®æ¦¡¦r¤¸ ( »Ýª`·N¤j¤p¼g¦³§O )¡AWin32 ¨t²Î¬Ý¨ì³o¥|Ó¦r¤¸¡A·|±N¥L̽Ķ¦¨¡u¦~¡v¡B¡u¤ë¡v¡B¡u¤é¡v¡B¡u¬P´Á¡v¡B¡u¬ö¤¸«e¡vµ¥µ¥¡C¦Ü©óÅã¥Ü¤¤¤å©Î^¤å¡A¬O¨Ì¾Ú¡u¦Ûq¦a°Ï¿ï¶µ¡v¹ï¸Ü²°ùتº¡u¤é´Á¡v©M¡u®É¶¡¡v¼ÐÅÒ¤¤ªº¡u¤ë¾ä«¬ºA¡v©M®É¶¡¤W¤U¤È²Å¸¹¨M©w ( ¡C( ¡u¦Ûq¦a°Ï¿ï¶µ¡v¹ï¸Ü²°¥i¥Ñ¡u¶}©l¡v¡u±±¨î¥x¡v¡u¦a°Ï¤Î»y¨¥¿ï¶µ¡vªº¡u¦a°Ï¿ï¶µ¡v¼ÐÅÒùتº¡u¦Ûq¡v«ö¶s«ö¤U¦Ó¼u¥X¡A¦p¤U¹Ï©Ò¥Ü )
¹Ï¤@ |
¹Ï¤G |
®æ¦¡¦r¤¸ | »¡¡@¡@©ú | ¥H AD 2009/07/15 20:04:59 ¬°¨Ò | |
¤¤µØ¥Á°ê°ê¾ä | ¦è¾ä | ||
¥H¤U¬O GetDateFormat ¤¤¡AlpFormat ©Ò«ü¦r¦ê¥i¥Îªº®æ¦¡¦r¤¸ | |||
y | ¥uÀx¦s¦~¥÷ªº¥½¨â¦ì¼Æ¡A¦pªG¤Q¦ì¼Æ¬° 0¡A¨º»ò´NÀx¦s¤@¦ì¼Æ | 98 | 9 |
yy | ¥uÀx¦s¦~¥÷ªº¥½¨â¦ì¼Æ¡A¦pªG¤Q¦ì¼Æ¬° 0¡A¤´µMÀx¦s¨â¦ì¼Æ¡A¦p¦¹«K·|¥H 0 ¬°°_ÀY | 98 | 09 |
yyyy | §â¥þ³¡ªº¬ö¤¸Àx¦s¥X¨Ó¡A¦pªG¬ö¤¸¦³¤¦ì¼Æ ( ¦p¦ò±Ð¾äªk ) ¤]·|§â¤¦ì¼ÆÅã¥Ü¥X¨Ó | 98 | 2009 |
yyyyy | ¦P¡uyyyy¡v | 98 | 2009 |
gg | ¦¹¨ç¼Æ¨Ï¥Î»P«ü©w°Ï°ì³]¸m¬ÛÃöªº CAL_SERASTRING È¡C¦pªGn®æ¦¡¤Æªº¤é´Á¤£±a¦³¬ÛÃöªº¦~¥N©Î®É´Á¦r²Å¦ê¡A¦¹¤¸¯À±N³Q©¿²¤¡C¥kÄ檺¨Ò¤l¡A®æ¦¡¬O¡uggyyyy¡v | ¤¤µØ¥Á°ê98¦~ | 2009 |
M | Àx¦s¤ë¥÷¡A¦pªG¤Q¦ì¼Æ¬° 0¡A¨º»ò´NÀx¦s¤@¦ì¼Æ | 7 | 7 |
MM | Àx¦s¤ë¥÷¡A¦pªG¤Q¦ì¼Æ¬° 0¡A¨º»ò¤´µMÀx¦s¨â¦ì¼Æ¡A¦p¦¹«K·|¥H 0 ¬°°_ÀY | 07 | 07 |
MMM | Àx¦s¤ë¥÷ªºÁY¼g | ¤C¤ë | Jul |
MMMM | Àx¦s¤ë¥÷ªº§¹¾ã¦WºÙ | ¤C¤ë | July |
d | Àx¦s¤é¡A¦pªG¤Q¦ì¼Æ¬° 0¡A¨º»ò´NÀx¦s¤@¦ì¼Æ | 15 | 15 |
dd | Àx¦s¤é¡A¦pªG¤Q¦ì¼Æ¬° 0¡A¨º»ò«e±¸É 0 | 15 | 15 |
ddd | Àx¦s¬P´Á´X¡A¦ý¥HÁY¼gªí¥Ü | ¬P´Á¤T | Wed |
dddd | Àx¦s¬P´Á´X¡A¦ý¥H¥þ¦Wªí¥Ü | ¬P´Á¤T | Wednesday |
¥H¤U¬O GetTimeFormat ¤¤¡AlpFormat ©Ò«ü¦r¦ê¥i¥Îªº®æ¦¡¦r¤¸ | |||
t | Àx¦s¤W¤U¤È¡A¦ý¥uÀx¦s¤@Ó¦r¥À | ¤U¤È | P |
tt | Àx¦s¤W¤U¤È¡A¦ý¥uÀx¦s¨âÓ¦r¥À | ¤U¤È | PM |
h | Àx¦s¤Q¤G¤p®É¨îªº¤p®É¡A¦pªG¤Q¦ì¼Æ¬° 0¡A¨º»ò´N¥uÀx¦s¤@¦ì¼Æ | 8 | 8 |
hh | Àx¦s¤Q¤G¤p®É¨îªº¤p®É¡A¦pªG¤Q¦ì¼Æ¬° 0¡A¤Q¦ì¼Æ¸É¤W 0 | 08 | 08 |
H | Àx¦s¤G¤Q¥|¤p®É¨îªº¤p®É¡A¦pªG¤Q¦ì¼Æ¬° 0¡A¨º»ò´N¥uÀx¦s¤@¦ì¼Æ | 20 | 20 |
HH | Àx¦s¤G¤Q¥|¤p®É¨îªº¤p®É¡A¦pªG¤Q¦ì¼Æ¬° 0¡A¨º»ò¤Q¦ì¼Æ¸É¤W 0 | 20 | 20 |
m | Àx¦s¤ÀÄÁ¡A¦pªG¤Q¦ì¼Æ¬° 0¡A¨º»ò´N¥uÀx¦s¤@¦ì¼Æ | 4 | 4 |
mm | Àx¦s¤ÀÄÁ¡A¦pªG¤Q¦ì¼Æ¬° 0¡A¨º»ò¤Q¦ì¼Æ¸É¤W 0 | 04 | 04 |
s | Àx¦s¬í¡A¦pªG¤Q¦ì¼Æ¬° 0¡A¨º»ò´N¥uÀx¦s¤@¦ì¼Æ | 59 | 59 |
ss | Àx¦s¬í¡A¦pªG¤Q¦ì¼Æ¬° 0¡A¨º»ò¤Q¦ì¼Æ¸É¤W 0 | 59 | 59 |
szDateFormat DB "ggyyyyMMdd, ddd",0 INVOKE GetDateFormat,LOCALE_USER_DEFAULT,0,ADDR syst,ADDR szDateFormat....
·í¡u¤é´Á¡v¼ÐÅÒ¤¤ªº¡u¤ë¾ä«¬ºA¡v¿ï¡u¤¤µØ¥Á°ê°ê¾ä¡v¡Aµ²ªG¬O¡u¤¤µØ¥Á°ê98¦~07¤ë15¤é, ¬P´Á¤T¡v¡F¦pªG¬O¡u¦è¾ä ( ^¤å )¡v¡Aµ²ªG¬O¡u2009Jul15, Wed¡v
Locale ¬O°Ï°ì¿ï¶µ¡A¥i¥H¬O¥H¤U¤TºØ¡G
Local | ¤Q¤»¶i¦ì¼ÆÈ | »¡©ú |
LOCALE_SYSTEM_DEFAULT | 800H | ¨t²Î¹w³]¡C¦b WINDOWS.INC 1.6 ª©¨Ã¥¼¦¬¿ý¦¹±`¼Æ¡A©Ò¥Hn¦bµ{¦¡¤¤¦Û¦æ©w¸q¡C |
LOCALE_USER_DEFAULT | 400H | ¨Ï¥ÎªÌ©ÎÀ³¥Îµ{¦¡³]©w¡C¦b Windows XP ùØ¡A¨Ï¥ÎªÌ³]©w¥i¥H¥Ñ¡u±±¨î¥x¡v¡u¦a°Ï¤Î»y¨¥¿ï¶µ¡vùس]©w¡FÀ³¥Îµ{¦¡¥i©I¥s SetLocalInfo ³]©w¡C |
LOCALE_INVARIANT | 7FH | ³o¬Oµ¹±µªñ§@·~¨t²Îµ¥¯Åªºµ{¦¡¨Ï¥Îªº¡A¥¦·|¨Ï±o»P°Ï°ìµLÃö¡A¤@¯ëµ{¦¡«Ü¤Ö¨Ï¥Î¡C¦pªG¨Ï¥Î¦¹®æ¦¡¡A¤£ºÞ¨Ï¥ÎªÌ³]©wþ¤@ºØ¬ö¤¸¡A§¡¥H¦è¤¸¬ö¤¸ªí¥Ü¡C¦b WINDOWS.INC 1.6 ª©¨Ã¥¼¦¬¿ý¦¹±`¼Æ¡A©Ò¥Hn¦bµ{¦¡¤¤¦Û¦æ©w¸q¡C |
¦pªG lpFormat ¬°¹s¡AdwFlags ¥i¥H¬O¤U±¼ÆÈ¡G
dwFlags | ¤Q¤»¶i¦ì¼ÆÈ | »¡©ú | |
¥H¤U¬O GetDateFormat ¤¤¡AlpFormat ©Ò«ü¦r¦ê¥i¥Îªº®æ¦¡¦r¤¸ | |||
DATE_SHORTDATE | 1H | Àx¦s²µu¤é´Á¡A¨ä®æ¦¡¬O¥Ñ¡u¦Ûq¦a°Ï¿ï¶µ¡v¹ï¸Ü²°ùتº¡u¤é´Á¡v¼ÐÅÒ¤¤ªº¡u²µu¤é´Á¡v¨M©w¡A°Ñ¦Ò¤W¹Ï¤@¡C¤£¥i©M DATE_LONGDATE ©Î DATE_YEARMONTH ¦X¥Î¡C¦pªG dwFlags ¨S¦³«ü©w DATE_YEARMONTH¡BDATE_SHORTDATE¡BDATE_LONGDATE ¤TªÌ¤§¤¤ªº¤@Ó¡A¦P®É lpFormat ¬° NULL¡A¨º»ò¨t²Î¦Û°Ê¨Ï¥Î DATE_SHORTDATE ®æ¦¡¡C | |
DATE_LONGDATE | 2H | Àx¦s§¹¾ã¤é´Á¡A¨ä®æ¦¡¬O¥Ñ¤U¹Ïªº¡u§¹¾ã¤é´Á¡v¡A¨M©w¡A¤£¥i»P DATE_SHORTDATE ©Î DATE_YEARMONTH ¦X¥Î¡C | |
DATE_YEARMONTH | 8H | ¥uÀx¦s¦~¥÷©M¤ë¥÷¡C¤£¥i©M DATE_LONGDATE ©Î DATE_SHORTDATE ¦X¥Î¡C | |
DATE_USE_ALT_CALENDAR | 4H | ¨Ï¥Î²Ä¤GºØ¾äªk¡A¨Ò¦p¤¤µØ¥Á°ê¥Á¶¡±`¥Î¹A¾ä¡A¦ý¬O Windows ¨Ã¥¼¦¬¿ý | |
DATE_LTRREADING | 10H | «ö·Ó MSDN °O¸ü¡A·|¥[¤W¤@ӥѥª¦V¥kªº°O¸¹¡A¦ý¦b¤p¤ì°¸ªº Windows XP SP3 ¤¤·|³y¦¨µ{¦¡¿ù»~¡C | |
DATE_RTLREADING | 20H | ¦P¤W¡A¥u¬O§ï¦¨¥Ñ¥k¦V¥ª¡C | |
LOCALE_NOUSEROVERRIDE | 80000000H | ±j¨î¨Ï¥Î¨t²Î¤º©wªº°Ï°ì®æ¦¡¡A¦pªG¨S¦³³]©w¦¹ºX¼Ð¡A«h¨Ï¥Î¨Ï¥ÎªÌ¦Ûqªº®æ¦¡¡C¦]¬°¦¹ºX¼Ð·|©¿µø¨Ï¥ÎªÌªº³]©w¡A©Î¨t²Î§ó·s¡B¤É¯Å®É³£·|¨Ï LOCALE_NOUSEROVERRIDE ®æ¦¡¤£¦P¡A¦]¦¹³Ì¦n¤Ö¨Ï¥Î¦¹ºX¼Ð¡CMASM32 ùتº WINDOWS.INC 1.6 ª©¥¼¦¬¿ý¦¹ºX¼Ð¡C | |
LOCALE_USE_CP_ACP | 40000000H | MASM32 ùتº WINDOWS.INC 1.6 ª©¥¼¦¬¿ý¦¹ºX¼Ð¡C¦¹ºX¼Ð¨Ï¥Î¨t²Î¤ºªº ANSI ½X¨ú¥N¦U¦aªº°Ï°ì¤º½X¡C | |
¥H¤U¬O GetTimeFormat ¤¤¡AlpFormat ©Ò«ü¦r¦ê¥i¥Îªº®æ¦¡¦r¤¸ | |||
TIME_NOMINUTESORSECONDS | 1H | ¤£Àx¦s¤ÀÄÁ»P¬íÄÁ¡A¥uÀx¦s¤p®É | |
TIME_NOSECONDS | 2H | ¤£Àx¦s¬íÄÁ¡A¥uÀx¦s¤p®É»P¤ÀÄÁ | |
TIME_NOTIMEMARKER | 4H | ¤£¨Ï¥Î®É¶¡¼Ð°O¡A¨Ò¦p¡uAM¡v¡B¡uPM¡v | |
TIME_FORCE24HOURFORMAT | 8H | ¥H¤G¤Q¥|¤p®É¨îÀx¦s | |
LOCALE_NOUSEROVERRIDE | 80000000H | ¦P GetDateFormat ªº LOCALE_NOUSEROVERRIDE | |
LOCALE_USE_CP_ACP | 40000000H | ¦P GetDateFormat ªº LOCALE_USE_CP_ACP |
GetDateFormat¡BGetTimeFormat ³Ì«á¤@ӰѼƤÀ§O¬O cchDate¡BcchTime¡A¥¦Ì¥²¶·¦b©I¥s«e¥ý¦s¤J lpDateStr¡BlpTimeStr ©Ò«ü°O¾ÐÅé¤j¤p¡A¥H®e¯Ç©Ò±oªº¦r¦ê¤£·|³y¦¨½w½Ä°Ï·¸¦ì¡C¦pªG cchDate¡BcchTime ³]¬°¹s¡A¨º»ò GetDateFormat¡BGetTimeFormat ±N·|¶Ç¦^©Ò»Ý°O¾ÐÅé¤j¤p¡CGetDateFormat¡BGetTimeFormat ¦pªG¦¨¥\ªºªð¦^¡A·|¶Ç¦^©Ò±o¦r¦ê¤j¤p¡A¦pªG¥¢±Ñ¶Ç¦^ 0¡C
¤W±´£¨ì¤F¤@¨Ç¦³ÃöÀɮתºÆ[©À¡A©³¤U´N¬O¹ê§@ªº³¡¥÷¡C¤p¤ì°¸¼¶¼g¤F FI µ{¦¡¡A°õ¦æ«á«ö¤U¡uÂsÄý¡v«ö¶s¡A²£¥Í¡u¶}±ÒÂÂÀÉ¡vªº³q¥Î¹ï¸Ü²°¡A¨Ï¥ÎªÌ¥i¥H¥ô·N¿ï¾Ü¨ä¤ºªºÀɮסAFI ·|§â¸ÓÀɮתº¤j¤p¡B«Ø¥ß®É¶¡¡B³Ì«á¦s¨ú®É¶¡¡B³Ì«áקï®É¶¡Åã¥Ü¦bÀRºA±±¥ó¤W¡A¦p¤U¹Ï¡G
©³¤U¬O FI.RC ªºì©lÀÉ¡G
1 2 3 4
5 6 7 8
9
10 11 12 13
14 15 16 17
18 19 20 |
#include "c:\masm32\include\resource.h"
#define RT_MANIFEST 24
#define IDS_TEXT 50000
#define IDB_BROWSE 50001
#define IDB_EXIT 50002
FilInfo DIALOG 200,100,210,190
STYLE DS_MODALFRAME|WS_POPUP|WS_VISIBLE|WS_CAPTION|WS_SYSMENU
FONT 9,"MS Sans Serif"
CAPTION "Àɮ׸ê®Æ"
BEGIN
LTEXT "«ö¡uÂsÄý¡v¿ï¾ÜÀÉ®×", IDS_TEXT, 5, 10,200,140
PUSHBUTTON "ÂsÄý", IDB_BROWSE, 20,160, 80, 20
PUSHBUTTON "Â÷¶}", IDB_EXIT,110,160, 80, 20
END
1 RT_MANIFEST MOVEABLE PURE "FI.EXE.MANIFEST"
FilInfo ICON INFO.ICO
|
©³¤U¬O FI.EXE.MANIFEST ªºì©lÀÉ¡G
1 2 3 4
5 6 7 8
9
10 11 12 13
14 15 16 |
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
<description>Test application for xp style.</description>
<dependency>
<dependentAssembly>
<assemblyIdentity
type="win32"
name="Microsoft.Windows.Common-Controls"
version="6.0.0.0"
processorArchitecture="*"
publicKeyToken="6595b64144ccf1df"
language="*"
/>
</dependentAssembly>
</dependency>
</assembly>
|
©³¤U¬O FI.ASM ªº¤º®e¡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 28 29
30 31 32 33
34 35 36 37
38 39 40 41
42 43 44 45
46 47 48 49
50 51 52 53
54 55 56 57
58 59 60 61
62 63 64 65
66 67 68 69
70 71 72 73
74 75 76 77
78 79 80 81
82 83 84 85
86 87 88 89
90 91 92 93
94 95 96 97
98 99
100 101 102 103
104 105 106 107
108 109 110 111
112 113 114 115
116 117 118 119
120 121 122 123
124 125 126 127
128 129 130 131
132 133 134 135
136 137 138 139
140 141 142 143
144 145 146 147
148 |
OPTION CASEMAP:NONE
.586
.MODEL FLAT,STDCALL
INCLUDE WINDOWS.INC
INCLUDE COMDLG32.INC
INCLUDE COMCTL32.INC
INCLUDE KERNEL32.INC
INCLUDE USER32.INC
INCLUDELIB COMDLG32.LIB
INCLUDELIB COMCTL32.LIB
INCLUDELIB KERNEL32.LIB
INCLUDELIB USER32.LIB
IDS_TEXT EQU 50000
IDB_BROWSE EQU 50001
IDB_EXIT EQU 50002
;***************************************************************************************************
.CONST
szIcon EQU THIS BYTE
szDlgName DB "FilInfo",0 ;¹ï¸Ü²°±ªO¦WºÙ
szFilter DB "©Ò¦³ÀÉ®× (*.*)",0,"*.*",0,0
szTitle DB "¿ï¾ÜÀɮסA¥HÅã¥Ü³Q¿ï¾ÜªºÀɮ׸ê®Æ",0
szError DB "¶}±ÒÀɮ׿ù»~",0
szFileSizeFmt DB "Àɮפj¤p¡G%I64d¦ì¤¸²Õ(bytes)",0dh,0ah,0
szTimeFmt DB " HH:mm:ss",0dh,0ah,0
szCreateDateFmt DB "«ØÀɮɶ¡¡Gggyyyy¦~M¤ëdd¤éddd",0
szAccessDateFmt DB "³Ìªñ¦s¨ú®É¶¡¡Gggyyyy¦~M¤ëdd¤éddd",0
szWriteDateFmt DB "³Ìªñקï®É¶¡¡Gggyyyy¦~M¤ëdd¤éddd",0
;***************************************************************************************************
.DATA
hInstance HANDLE ?
hFile HANDLE ?
ofn OPENFILENAME <>
fi BY_HANDLE_FILE_INFORMATION <>
szFullName DB MAX_PATH DUP (0)
szInfo DB 200h DUP (0)
;***************************************************************************************************
.CODE
;---------------------------------------------------------------------------------------------------
;¿é¤J¡GEDI¡ÐGetDateFormat/GetTimeFormat·|§â¦r¦ê¶ñ¤JEDI©Ò«ü¦ì§}¤§³B
;¡@¡@¡@lpDateFmt¡ÐGetDateFormat°Ñ¼ÆlpFormat¦ì§}
;¡@¡@¡@lpFT¡Ð¤TºØÀɮ׮ɶ¡©Ò¦b¦ì§}
;¿é¥X¡GEDI±N¤À§O¶ñ¤J¤TºØÀɮ׮ɶ¡¦r¦ê
save_time PROC lpDateFmt:LPSTR,lpFT:LPSTR
LOCAL ft:FILETIME
LOCAL syst:SYSTEMTIME
INVOKE FileTimeToLocalFileTime,lpFT,ADDR ft ;§âUTC®É¶¡Åܦ¨·í¦a®É¶¡(¤¤µØ¥Á°ê¼Ð·Ç®É¶¡)
INVOKE FileTimeToSystemTime,ADDR ft,ADDR syst ;§âFILETIME®æ¦¡ªº·í¦a®É¶¡Åܦ¨SYSTEMTIME®æ¦¡
mov ecx,OFFSET szInfo+SIZEOF szInfo
sub ecx,edi
INVOKE GetDateFormat,LOCALE_USER_DEFAULT,0,ADDR syst,lpDateFmt,edi,ecx
dec eax
add edi,eax
mov ecx,OFFSET szInfo+SIZEOF szInfo
sub ecx,edi
INVOKE GetTimeFormat,LOCALE_USER_DEFAULT,0,ADDR syst,OFFSET szTimeFmt,edi,ecx
dec eax
add edi,eax
ret
save_time ENDP
;---------------------------------------------------------------------------------------------------
get_file_info PROC USES esi edi
;§â§¹¾ãÀɦW²¾¨ìszInfo³B
mov esi,ofn.lpstrFile
mov edi,OFFSET szInfo
next_byte: lodsb
cmp al,0
je ok
stosb
jmp next_byte
;´«¦æ
ok: mov ax,0a0dh
stosw
;§âÀɮפj¤p¦s¤JszInfoùØ¡Aºò±µµÛÀɦW¤§«á
INVOKE wsprintf,edi,OFFSET szFileSizeFmt,fi.nFileSizeLow,fi.nFileSizeHigh
dec eax
add edi,eax
;§â«Ø¥ßÀɮ׮ɶ¡¦s¤JszInfoùØ¡Aºò±µµÛÀɮפj¤p¤§«á
INVOKE save_time,OFFSET szCreateDateFmt,OFFSET fi.ftCreationTime
;§â³Ìªñ¦s¨úÀɮ׮ɶ¡¦s¤JszInfoùØ¡Aºò±µµÛ«Ø¥ßÀɮ׮ɶ¡¤§«á
INVOKE save_time,OFFSET szAccessDateFmt,OFFSET fi.ftLastAccessTime
;§â³ÌªñקïÀɮ׮ɶ¡¦s¤JszInfoùØ¡Aºò±µµÛ³Ìªñ¦s¨úÀɮ׮ɶ¡¤§«á
INVOKE save_time,OFFSET szWriteDateFmt,OFFSET fi.ftLastWriteTime
ret
get_file_info ENDP
;---------------------------------------------------------------------------------------------------
DlgProc PROC hDlg:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
.IF uMsg==WM_INITDIALOG
INVOKE LoadIcon,hInstance,OFFSET szIcon
INVOKE SendMessage,hDlg,WM_SETICON,ICON_SMALL,eax
.ELSEIF uMsg==WM_COMMAND
mov eax,wParam
mov edx,wParam
shr eax,10h ;EAX¡×³qª¾½X
and edx,0ffffh ;EDX¡×±±¨î¤¸¥óÃѧO½X
.IF eax==BN_CLICKED
.IF edx==IDB_EXIT
jmp exit
.ELSEIF edx==IDB_BROWSE
mov ecx,hDlg
mov ofn.lStructSize,SIZEOF ofn
mov ofn.hwndOwner,ecx
mov ofn.lpstrFilter,offset szFilter
mov ofn.lpstrCustomFilter,0
mov ofn.nFilterIndex,0
mov ofn.lpstrFile,offset szFullName
mov ofn.nMaxFile,SIZEOF szFullName
mov ofn.lpstrFileTitle,0
mov ofn.lpstrInitialDir,0
mov ofn.lpstrTitle,OFFSET szTitle
mov ofn.Flags,OFN_PATHMUSTEXIST or OFN_FILEMUSTEXIST
INVOKE GetOpenFileName,OFFSET ofn
.IF eax==0
mov edx,OFFSET szError
.ELSE
INVOKE CreateFile,OFFSET szFullName,GENERIC_READ,FILE_SHARE_READ,0,OPEN_EXISTING,FILE_ATTRIBUTE_NORMAL,0
mov hFile,eax
INVOKE GetFileInformationByHandle,eax,OFFSET fi
INVOKE CloseHandle,hFile
call get_file_info
mov edx,OFFSET szInfo
.ENDIF
INVOKE SetDlgItemText,hDlg,IDS_TEXT,edx
.ENDIF
.ENDIF
.ELSEIF uMsg==WM_CLOSE
exit: INVOKE EndDialog,hDlg,NULL
.ELSE ;¨ä¥L¥¼³B²zªº°T®§ªð¦^ FALSE
mov eax,FALSE
ret
.ENDIF ;¤w³B²zªº°T®§¡Aªð¦^ TRUE
mov eax,TRUE
ret
DlgProc ENDP
;---------------------------------------------------------------------------------------------------
start: INVOKE GetModuleHandle,NULL
mov hInstance,eax
INVOKE DialogBoxParam,hInstance,OFFSET szDlgName,NULL,OFFSET DlgProc,NULL
INVOKE ExitProcess,eax
call InitCommonControls
;***************************************************************************************************
END start
|
«ö³oùؤU¸ü INFO.ICO¡AµM«á§â¥¦»P FI.ASM¡BFI.RC¡BFI.EXE.MANIFEST ©ñ¦b¦P¤@¥Ø¿ý¡AµM«á¥Ñ¡u¶}©l¡v¡uªþÄÝÀ³¥Îµ{¦¡¡v¤¤¶}±Ò¡u©R¥O´£¥Ü¦r¤¸¡v¡A¤Á´«¨ìè誺¥Ø¿ý¤U¡A¨Ì¤U±¤è¦¡²ÕĶ ( ¶À¦â¦r¬O±zn¤Uªº«ü¥O¡A[Enter]ªí¥Ü«ö¤U Enter Áä )¡G
E:\HomePage\SOURCE\Win32\AP07_FI>rc fi.rc [Enter] E:\HomePage\SOURCE\Win32\AP07_FI>ml fi.asm /link fi.res [Enter] Microsoft (R) Macro Assembler Version 6.14.8444 Copyright (C) Microsoft Corp 1981-1997. All rights reserved. Assembling: fi.asm *********** ASCII build *********** Microsoft (R) Incremental Linker Version 5.12.8078 Copyright (C) Microsoft Corp 1992-1998. All rights reserved. /SUBSYSTEM:WINDOWS "fi.obj" "/OUT:fi.exe" "fi.res" E:\HomePage\SOURCE\Win32\AP07_FI>
¦Ü¦¹¡A¤w²ÕĶ¦¨¥\¡A¥i¥H±o¨ì FI.EXE¡A±z¥i¦Û¦æ°õ¦æ¬Ý¬Ý¡C©³¤U¬O¤@¨Ç»¡©ú¡C
DOS §@·~¨t²Î¨Ï¥ÎªºÀɮרt²Î¬O FAT12/16¡A¶È¶È°O¿ýÀɮ׫إߩÎק諸®É¶¡¡A©ÎªÌ¬O¤l¥Ø¿ý«Ø¥ßªº®É¶¡ ( °Ñ¦Ò²Õ¦X»y¨¥²Ä 18 ³¹ )¡C¦ý¬O¦b NTFS Àɮרt²Î¤U¡AÀɮשθê®Æ§¨ªº®É¶¡´N½ÆÂø±o¦h¤F¡A¥i¤À¬°«Ø¥ßªº®É¶¡ ( create time )¡B³Ì«á¦s¨úªº®É¶¡ ( access time ) »P³Ì«áק諸®É¶¡ ( modify time ) ¤TºØ¡C©³¤U»¡©ú³o¤TºØÀɮ׮ɶ¡¡G
¦b NTFS °O¿ýªº³o¤TºØ®É¶¡¡A³£¬O¥H¥@¬É¼Ð·Ç®É¶¡°O¿ý¦¨ FILETIME ®æ¦¡¡C³o»ò°µªº¦n³B¬O¡A°²¦p±zªºÀH¨ºÐùئ³ÓÀɮסA¤µ¤Ñ±z·f¸¾÷¥Ñ¥xÆW¸¨ì¿D¬w³·±ù¡A¦b¹q¸£¤W©Ò±o¨ìªº®É¶¡¬OªF¿D¼Ð·Ç®É¶¡ ( AEST¡A¤ñ UTC §Ö 10 ¤p®É )¡A¦Ó¤£¬O¤¤µØ¥Á°ê¼Ð·Ç®É¶¡¡C
²Ä 49¡ã50 ¦æ¬O
INVOKE FileTimeToLocalFileTime,lpFT,ADDR ft ;§âUTC®É¶¡Åܦ¨·í¦a®É¶¡(¤¤µØ¥Á°ê¼Ð·Ç®É¶¡) INVOKE FileTimeToSystemTime,ADDR ft,ADDR syst ;§âFILETIME®æ¦¡ªº·í¦a®É¶¡Åܦ¨SYSTEMTIME®æ¦¡
³o¨â¦æ¡A¥ý§â UTC ®É¶¡Åܦ¨·í¦a®É¶¡ ( ¤¤µØ¥Á°ê¼Ð·Ç®É¶¡ )¡A³o¨âӮɶ¡³£¬O¥H FILETIME ªº®æ¦¡¨Óªí¥Üªº¡ClpFT ¬O¥Ñ¤÷µ{¦¡¡Aget_file_info¡A¶Ç¨Óªº°Ñ¼Æ¡A¦b get_file_info ²Ä 80¡ã85 ¦æ©I¥s¤T¦¸ save_time¡A¤À§O§â«Ø¥ßÀɮתº®É¶¡¡B³Ìªñק諸®É¶¡¡B³Ì«á¦s¨úªº®É¶¡¦ì§}·í¦¨ lpFT ¶Çµ¹ save_time¡Cnª`·Nªº¬O¡A³o¤TºØ®É¶¡³£¬O¥@¬É¼Ð·Ç®É¶¡¡A¥B®æ¦¡¬° FILETIME¡C²Ä 49 ¦æ¥ý§â³o¨Ç®É¶¡Âà´«¦¨·í¦a®É¶¡¡A·í¦a®É¶¡¤´¬O FILETIME ®æ¦¡¡C²Ä 50 ¦æ«h¬O§âèèÂà´««áªº·í¦a®É¶¡¡AÅܦ¨ SYSTEMTIME ®æ¦¡¡A¦s¦b°Ï°ìÅÜ¼Æ syst ùØ¡C
±µ¤U¨Óªº¤u§@¬O©I¥s GetDateFormat¡BGetTimeFormat §â syst ùتº®É¶¡Åܦ¨¦r¦ê¡A¦s¨ì szInfo ùØ¡CszInfo ¬O¤@Ó¦r¦ê¡A¦bªð¦^«á¡A§Y²Ä 124 ¦æ¡A¹ï¸Ü²°¨ç¦¡·|¨Ï EDX «ü¦V szInfo ¦r¦êªº¦ì§}¡AµM«á¦b²Ä 126 ¦æ¡A©I¥s SetDlgItemText §âÀRºA±±¥ó¡AIDS_TXET¡Aªº¼ÐÃD³]¬° szInfo ¦r¦ê¡A©ó¬O´N¥i¥H¦b¿Ã¹õ¤WÅã¥ÜÀɮתº¸ê®Æ¤F¡C
¥t¥~¡A¦]¬° szInfo ¦r¦êùØ©Ò¥]§tªº¬OÀɦW¡BÀɮפj¤p¡B«Ø¥ßÀɮתº®É¶¡¡B³Ìªñק諸®É¶¡¡B³Ì«á¦s¨úªº®É¶¡³o¨Ç¸ê®Æ©Ò§Î¦¨ªº¦r¦ê¡A¤@Ó±µµÛ¤@Ó¡A³s±µ°_¨Óªº¡C¦]¦¹¨C¦¸©I¥s GetDateFormat¡BGetTimeFormat «á¡A©Òpºâ¥X¨Óªº¦r¦ê³£¥²¶·±µ¦b«e¤@¦¸¦r¦êµ²§À¡A¨Ã¥Bn§âµ²§Àªº NULL ¦r¤¸°£¥h¡C
¤p¤ì°¸¥Îªº¤èªk«Ü²³æ¡A¨C¦¸©I¥s GetDateFormat¡BGetTimeFormat «e¡A¥H EDI ¼È¦s¾¹°O¿ý±Nn¦b szInfo ¦r¦êªºþ¤@Ó¦ì§}¶}©l¶ñ¤Jpºâ«áªº¦r¦ê¡F©I¥s¤§«á¡AEDI ¦A¥[¤W¼g¤J szInfo ªº¦ì¤¸²ÕӼơA´NÅܦ¨¤U¦¸©I¥sªº¶}©l¶ñ¤J¦r¦ê¦ì§}¡C¦Ó¼g¤J szInfo ªº¦ì¤¸²Õ¼Æ¡A´N¦s©ó GetDateFormat¡BGetTimeFormat ªºªð¦^È¡AEAX ùØ¡C¦]¦¹±z·|¬Ý¨ì
dec eax add edi,eax
³o¨â¦æ¡A«e¤@¦æ¬O¥h±¼ NULL ¦r¤¸¡A«á¤@¦æ«h¬O¥[¤W¶ñ¤Jªº¦ì¤¸²ÕӼơC¦bµ{¦¡²Ä 54¡ã55¡B59¡ã60 ¦æ¡A¬Æ¦Ü 77¡ã78 ¦æ³£¥i¥H¨£¨ì³oºØ¥Îªk¡C
¦Ü©ó GetDateFormat¡BGetTimeFormat ªº³Ì«á¤@ӰѼơA¬O szInfo ¦r¦êÁٳѦh¤ÖªÅ¶¡¥i¥H®e¯Ç¥¦Ì©Òpºâ¥Xªºµ²ªG¡C¤èªk¤]«Ü²³æ¡A¥unª¾¹D¦b szInfo ¦r¦êªºþ¤@Ó¦ì§}¶}©l¶ñ¤Jpºâ«áªº¦r¦ê ( °O¿ý¦b EDI ùØ )¡AµM«á¥H szInfo ªº³Ì«á¦ì§}¥h´î±¼¦¹¦ì§}¡A´N¥i¥H±o¨ìÁٳѦh¤ÖªÅ¶¡¡C¦Ü©ó szInfo ªº³Ì«á¦ì§}¡A«h¬O¥Î szInfo ªº°_©l¦ì§}¥[¤W szInfo ªºÁ`ªø«×¡A°O¿ý©ó ECX ùØ¡C¦]¦¹±z¥i¥H¦b 51¡ã52¡B56¡ã57 ¨£¨ì¹³¤U±ªºµ{¦¡½X¡G
mov ecx,OFFSET szInfo+SIZEOF szInfo sub ecx,edi
¤p¤ì°¸´¿¬d¹L¤@¨Ç¸ê®Æ¡A¦ü¥G¨S¦³ Win32 API ¯à°÷´£¨Ñ¥Ø¿ýªº«Ø¥ß®É¶¡¡B³Ìªñקï®É¶¡¡B³Ìªñ¦s¨úªº®É¶¡¡C·Q¨Ó·Q¥h¡A¥u¦³¥ÎÅܳqªº¤èªk¡C³oÓÅܳqªº¤èªk¬O·j´M²Å¦X¬YÓ«ü©w¦r¦êªºÀɦW©Î¥Ø¿ý¦W¡C¨º´N¬O FindFirstFile¡C
FindFirstFile ¬O¥Î¨Ó¦b¤@ӥؿýùØ´M§ä²Å¦X«ü©w¦WºÙªº²Ä¤@ÓÀɮשΥؿý¦W¡A¨Ã¨ú±o¬ÛÃö¸ê®Æ¡C¨ä쫬¬O¡G
INVOKE FindFirstFile,lpFileName,lpFindFileData
lpFileName ¬O¬YÓ¦r¦êªº¦ì§}¡A³oÓ¦r¦ê¡A¤@¯ë§t¦³¸U¥Î¦r¤¸¥B¥H 0 µ²§À¡A¥¦¥Nªín¬° FindFirstFile ©Ò·j´MªºÀɦW©Î¥Ø¿ý¦W¡C¸U¥Î¦r¤¸¬O«ü¡u*¡v»P¡u?¡v¨âÓ¦r¤¸¡A¡u*¡v¬O«ü¥i¥H¥H¥ô·N¦r¤¸¥N¤J¥B¤£ªø«×¡A¡u?¡v¥u©ó¥H¤@Ó¥ô·N¦r¤¸¥N¤J¡C¡u*¡v»P¡u?¡v¨âÓ¦r¤¸¡A¦n¹³¬O¼Æ¾Ç¤Wªº¥N¼Æ¡A¥i¥H¥N¶i¥ô¦ó¼Æ¦r¤@¼Ë¡C¦¹¥~¡AÀɦW¤À¬°¥DÀɦW»P°ÆÀɦW¡A¡u.¡vªº¥ªÃ䬰¥DÀɦW¡A¥kÃ䬰°ÆÀɦW¡C¤U±©Ò·j´Mªº¥Ø¼Ð³£¬O¦b¡uC:\WINDOWS¡v¥Ø¿ý¤U©Î¬O¡uC:\¡v¥Ø¿ý¤UªºÀɮסA½Ð¬Ý¥H¤U»¡©ú¡AlpFileName¡A©Ò«ü¦ì§}ªº¦r¦ê¥i¯à¬O¹³©³¤Uªº¼Ë¤l¡G
«ü©wÀɦW©Î¥Ø¿ý¦r¦ê | »¡¡@¡@©ú |
C:\WINDOWS\*.* | ©Ò·j´Mªº¬O¥ô¦ó¤@ÓÀɮשΤl¥Ø¿ý³£²Å¦X |
C:\WINDOWS\*.EXE | ·j´M¨ì²Ä¤@Ó°ÆÀɦW¬O¡uEXE¡vªºÀɮשΤl¥Ø¿ý´N²Å¦X |
C:\WINDOWS\????.EXE | ·j´M²Ä¤@Ó°ÆÀɦW¬°¡uEXE¡v¥BÀɦW©Î¤l¥Ø¿ý¦Wªø«×¬°¥|Ó¦r¤¸ªºÀÉ®× ( ª`·N¡A¡u?¡v¤]¥i¥NªíªÅ¦r¤¸¡A©Ò¥H¥DÀɦWªø«×¬°¤@Ó¡B¨âÓ¡B¤TÓ¦r¤¸ªº¦WºÙ¤]²Å¦X¡u????.EXE¡v) |
C:\WINDOWS\?i*.* | ·j´MÀɦWªº²Ä¤@©Î²Ä¤GÓ¦r¤¸¬O¡ui¡vªº²Ä¤@ÓÀÉ®× |
C:\WINDOWS\N*.* | ·j´MÀɦW²Ä¤@Ó¦r¬O¡uN¡vªºÀɮסA´N²Å¦X·j´M |
C:\WINDOWS\NOTEPAD.EXE | ·j´M NOTEPAD.EXE ÀɮסCFindFirstFile ·j´M²Å¦Xªº²Ä¤@ÓÀɮ׮ɡA¨Ã¤£ÄY®æ¨î¤j¤p¼g¡A¥ç§Y lpFileName ©Ò«ü¦r¦ê¬°¡uNOTEPAD.*¡v¡A«hÀɦW¬°¡uNotepad.EXE¡v¡unotepad.exe¡v¡B¡uNotePad.Exe¡v³£¬O²Å¦Xªº¡C |
C:\WINDOWS | ´N¬O«ü¡uC:\WINDOWS¡v¥Ø¿ý |
C:\ | ¶È«ü©ú¤l¥Ø¿ý©³¤UªºÀɮסA¦ý¨S«ü©úÀɦW¡A´N·|µo¥Í INVALID_HANDLE_VALUE ¿ù»~¡C¦pªG©I¥s GetLastError¡A·|±o¨ì ERROR_FILE_NOT_FOUND ¿ù»~½X¡Aªí¥Ü¥¼§ä¨ì²Å¦XªºÀɮסC |
C:\WINDOWS\ | ¦P¤W |
FindFirstFile ªº²Ä¤GӰѼơAlpFindFileData¡A¬O¤@Ó¦ì§}¡A¦¹¦ì§}«ü¦V¤@ÓºÙ¬° WIN32_FIND_DATA ªºµ²ºcÅé¡A¦¹µ²ºcÅ骺Äæ¦ì¬O¡G
WIN32_FIND_DATA STRUCT dwFileAttributes DWORD ? ;ÄÝ©Ê ftCreationTime FILETIME <> ;Àɮ׫إ߮ɶ¡ ftLastAccessTime FILETIME <> ;³Ìªñ¦s¨ú®É¶¡ ftLastWriteTime FILETIME <> ;³Ìªñקï®É¶¡ nFileSizeHigh DWORD ? ;Àɮפj¤p¡A°ª¦ì§}ªºÂù¦r²Õ nFileSizeLow DWORD ? ;Àɮפj¤p¡A§C¦ì§}ªºÂù¦r²Õ dwReserved0 DWORD ? dwReserved1 DWORD ? cFileName BYTE MAX_PATH DUP (?);ÀɦW ( ¤£¥]§t¸ô®|¦W ) cAlternateFileName BYTE 14 DUP (?) ;µuÀɦW WIN32_FIND_DATA ENDS
²Ä¤@ÓÄæ¦ì¡AdwFileAttributes¡A¬O«üÀÉ®×ÄÝ©Ê¡A¦p¤Uªí©Ò¥Ü¡AdwFileAttributes Äæ¦ì¥i¥H¬O¤Uªí¤¤ªº¤@өμÆÓªºÁp¶°¡G
ÄÝ©Ê | ¼ÆÈ | »¡©ú |
FILE_ATTRIBUTE_ARCHIVE | 20H | «O¦s¡Aªí¥ÜÀɮ׻ݫO¦s¡A³q±`¬O´£¨Ñµ¹³Æ¥÷³nÅé©Î³Æ¥÷©R¥O¨Ï¥Îªº¡A·í¨Ï¥ÎªÌ«Ø¥ß©ÎקïÀɮ׮ɡA·|¦Û°Ê¼ÐÃÑ FILE_ATTRIBUTE_ARCHIVE ÄÝ©Ê¡A¥H´£¥Ü³Æ¥÷³nÅé³oÓÀɮש|¥¼³Æ¥÷¡A·í³Æ¥÷«á¡A¦¹Äݩʦ۰ʨú®ø¡C¦pªG¨Ï¥ÎªÌ¦A¦¸×§ïÀɮסA·|¦A¦¸¼ÐÃÑ FILE_ATTRIBUTE_ARCHIVE |
FILE_ATTRIBUTE_COMPRESSED | 800H | À£ÁY¡Aªí¥ÜÀɮשΥؿý¬°À£ÁYªº¡C¹ïÀɮרӻ¡¡Aªí¥Ü¦¹Àɮ׳QÀ£ÁY¹L¡C¹ï¥Ø¿ý¨Ó»¡¡A¦³¤F¦¹ÄÝ©Ê«á¡A¦¹¥Ø¿ýùØ·s«ØªºÀÉ®×·|³QÀ£ÁY |
FILE_ATTRIBUTE_DEVICE | 40H | «O¯d |
FILE_ATTRIBUTE_DIRECTORY | 10H | ¥Ø¿ý |
FILE_ATTRIBUTE_ENCRYPTED | 4000H | ¥[±K¡C¹ïÀɮרӻ¡¡A¬O¤º®e¥[±K¡C¹ï¥Ø¿ý¨Ó»¡¡A¬O¹ï±N¨Ó·s«ØªºÀɮצ۰ʳ]©w¥[±KÄÝ©Ê |
FILE_ATTRIBUTE_HIDDEN | 2H | ÁôÂáA¤@¯ë¦Ó¨¥¡A¨ã¦³¦¹ÄݩʪºÀɮשΥؿý¡A¦bÀÉ®×Á`ºÞùب£¤£µÛ¡A¦ý¥i¥H³]©w¡u¤u¨ã¡v¡u¸ê®Æ§¨¿ï¶µ¡v¡uÀ˵ø¡v¡uÅã¥Ü©Ò¦³Àɮפθê®Æ§¨¡vùس]©w¡A§Y¨Ï¨ã¦³ FILE_ATTRIBUTE_HIDDEN ÄÝ©Ê¡A¤]¯à¨£µÛ |
FILE_ATTRIBUTE_NORMAL | 80H | ÀɮרS¦³³]¸m¨ä¥LÄÝ©Ê¡A¦¹ÄÝ©Ê¥u¯à³æ¿W¨Ï¥Î |
FILE_ATTRIBUTE_NOT_CONTENT_INDEXED | 2000H | |
FILE_ATTRIBUTE_OFFLINE | 1000H | Â÷½u¡CÀɮפº®e¼È®É¤£¥i¥Î¡A¦¹ÄݩʳQ»·ºÝÀx¦s¸Ë¸m ( remote storage ) ³nÅé©Ò¥Î¡A¤£¯à¥ô·N§ó§ï¡C |
FILE_ATTRIBUTE_READONLY | 1H | °ßŪ¡C¹ïÀɮצӨ¥¡AÀ³¥Îµ{¦¡¥u¯àŪ¨ú¡A¤£¯àקï©Î§R°£¡C¹ï¥Ø¿ý¦Ó¨¥¡AÀ³¥Îµ{¦¡¤£¯à§R°£¡C |
FILE_ATTRIBUTE_REPARSE_POINT | 400H | |
FILE_ATTRIBUTE_SPARSE_FILE | 200H | |
FILE_ATTRIBUTE_SYSTEM | 4H | ¨t²ÎÀÉ¡Aªí¥Ü¦¹ÀɮשΥؿý¬O§@·~¨t²Îªº¤@³¡¥÷¡A |
FILE_ATTRIBUTE_TEMPORARY | 100H | |
FILE_ATTRIBUTE_VIRTUAL | 10000H |
WIN32_FIND_DATA ªº²Ä¤G¡B¤T¡B¥|ÓÄæ¦ì¡A¤À§Oªí¥ÜÀɮ׫إ߮ɶ¡¡B³Ìªñ¦s¨úªº®É¶¡¡B³Ìªñקï®É¶¡¡A§¡¥H FILETIME ®æ¦¡°O¿ý¡CnFileSizeHigh¡BnFileSizeLow ¦X°_¨Ó¬O¤@Ó¤»¤Q¥|¦ì¤¸ªº¼Æ¡A¥NªíÀɮפj¤p¡A¥H¦ì¤¸²Õ¬°³æ¦ì¡A¦]¦¹Àɮפj¤p¬° nFileSizeHigh¡Ñ100000000H¡ÏnFileSizeLow ¦ì¤¸²Õ¡F¦pªG¬O¥Ø¿ý¡A«h¦¹Äæ¦ì¬° 0¡C±µ¤U¨Óªº dwReserved0 ¥u¦³¦b dwFileAttributes Äæ¦ì¤¤¥]§t¤F FILE_ATTRIBUTE_REPARSE_POINT Äݩʤ~¦³·N¸q¡A§_«h¦¹Äæ¦ìµL¥Î¡CdwReserved1 ¬O«O¯dªºÄæ¦ì¡A¯d«Ý±N¨Ó¨Ï¥Î¡CcFileName ¬O¤@Óªø 260 ¦ì¤¸²Õªº¦r¦ê¡Aªí¥ÜÀɦW ( ¶È§t¥DÀɦW»P°ÆÀɦW¡A¤£¥]§t¸ô®| )¡CcAlternateFileName ¬°¤@Ó 14 ¦ì¤¸²Õªøªº¦r¦ê¡A¨ä¤º°O¿ýµÛµuÀɦW¦WºÙ¡AµuÀɦW¬O«ü DOS ¨Ï¥Îªº 8.3 §ÎºA¡A¥ç§Y 8 Ӧ줸²Õªøªº¥DÀɦW¡A¦A¥[¤W 3 Ӧ줸²Õªøªº°ÆÀɦW¡A¨ä¶¡¥H¡u.¡v¹j¶}¡C
©I¥s FindFirstFile «e»Ý§â lpFileName ¤Î lpFindFileData ³o¨âÓ¦ì§}¶ñ¦n¡A¦pªG¦¨¥\ªº°õ¦æ§¹ FindFirstFile¡A¨t²Î·|¦b lpFindFileData ©Ò«üªº WIN32_FIND_DATA µ²ºcÅ餺¶ñ¦n§äµÛªº²Ä¤@ÓÀɮתº¸ê®Æ¡A¨Ãªð¦^¤@Ó·j´M¥N½X ( search handle )¡A¦¹·j´M¥N½X¥i¨Ñ FindNextFile ¨Ï¥Î¡AÄ~Äò´M§ä¤U¤@ӲŦXªºÀɮסC·j´M§¹¦¨«á¡A¤]n¥Î³oÓ·j´M¥N½X©I¥s FindClose µ²§ô·j´M¡C¦pªG©I¥s FindFirstFile ¥¢±Ñ¡Aªð¦^ INVALID_HANDLE_VALUE¡A¥i¥H©I¥s GetLastError ±o¨ì§ó¶i¤@¨Bªº¿ù»~½X¡A¤@¯ë·|±o¨ì ERROR_FILE_NOT_FOUND¡Aªí¥Ü§ä¤£¨ì²Å¦XªºÀɮסF©Î¬O ERROR_PATH_NOT_FOUND¡Aªí¥Ü lpFileName ©Ò«üªº¦WºÙ¬O¿ù»~ªº¦WºÙ¡C
FindNextFile ¬O¥Î¨Ó·j´M¤U¤@ӲŦX¯S©w¦WºÙªºÀɮשΥؿý¡A쫬¦p¤U¡G
INVOKE FindNextFile,hFindFile,lpFindFileData
hFindFile ¬O©I¥s FindFirstFile «á¶Ç¦^¨Óªº·j´M¥N½X¡AlpFindFileData¡A¬O«ü¦V WIN32_FIND_DATA ªºµ²ºcÅ骺¦ì§}¡C©I¥s FindNextFile «e»Ý¥ý¶ñ¦n hFindFile ¤Î lpFindFileData¡A¦pªG¦¨¥\ªº°õ¦æ§¹ FindNextFile¡A¨t²Î·|¦b lpFindFileData µ²ºcÅé¶ñ¦n§äµÛªºÀɮתº¸ê®Æ¡A¨Ãªð¦^«D¹sÈ¡F¦pªGªð¦^¹sȮɡAÀ³¸Ó©I¥s GetLastError¡A¨ú±o¿ù»~½X¡A¦pªG¿ù»~½X¬O ERROR_NO_MORE_FILES¡Aªí¥Ü¤w¸g¨S¦³²Å¦XªºÀɮפF¡C¤@¯ë¦Ó¨¥¡Aµ{¦¡À³¸Ó¶i¤J¤@Ó°j°é¡A«½Æ©I¥s FindNextFile¡Aª½¨ìªð¦^¹s¡AµM«á©I¥s GetLastError¡AÀˬd ERROR_NO_MORE_FILES ¬O§_¥X²{¬°¤î¡C³o¼Ë´N¯à¦b¥Ø¿ý¤¤¡A§â²Å¦X¯S©wÀɦWªº©Ò¦³Àɮקä¥X¨Ó¡C
FindClose ¥Î©ó·j´M¯S©wÀɦW®É¡A¤w§¹¥þ§ä¥X©Ò¦³²Å¦X¦¹¯S©wÀɦWªºÀɮסA©ÎªÌ¤£·Q¦AÄ~Äò´M§äÀɮפF¡C³o®É´Nn©I¥s FindClose¡A¥¦ªºì«¬¬O¡G
INVOKE FindClose,hFindFile
¥¦¥u¦³¤@ӰѼơAhFindFile¡A´N¬O FindFirstFile ©Ò±o¨ìªº·j´M¥N½X¡C¦pªG©I¥s¦¨¥\¡Aªð¦^«D¹sÈ¡F¥¢±Ñ«hªð¦^ 0¡A¥i¥H©I¥s GetLastError ±o¨ì¶i¤@¨Bªº¿ù»~½X¡Cµ{¦¡Ãö³¬·j´M¥N½X«á¡A´NµLªk¦A©I¥s FindNextFile ·j´M¤U¤@ӲŦXªºÀɮפF¡C
¥»¸`¤@¶}©l´£¨ì¡A¦ü¥G¨S¦³ª½±µªº¤èªk±o¨ì¥Ø¿ýªº«Ø¥ß®É¶¡¡B³Ìªñ¦s¨úªº®É¶¡¡B³Ìªñקï®É¶¡¡A¥u¯à¥ÎÅܳqªº¤èªk¡C³oÓÅܳqªº¤èªk´N¬O§Q¥Î FindFirstFile ©Î FindNextFile §ä¨ì¥Ø¿ý¡AµM«á¦b WIN32_FIND_DATA µ²ºcÅ餺·|¦³¥Ø¿ý«Ø¥ß®É¶¡¡B³Ìªñ¦s¨úªº®É¶¡»P³Ìªñקï®É¶¡¡C