³Ìªñ¤U¸ü¤F¤@¨Ç PDB ÀɩάO UPDB ÀÉ¡A³o¨âºØÀɮ׬O Palm ªº¸ê®Æ®wÀɮסA¥i¥HÂǥѺô¯¸¡AOnline-Convert ¡A§â¥¦ÌÂà´«¦¨ *.TXT ÀÉ¡C¥u¬O¸g¥Ñ Online-Convert Âà´«¦Ó¨Óªº TXT ÀÉ¡A©Ò±Ä¥Îªº´«¦æ²Å¸¹¨Ã¤£¬O°ª¦ì¤¸²Õ¬° 0DH¡A§C¦ì¤¸²Õ¬° 0AH¡A¦Ó¬O 0AH¡A¥HP©ó¥H Windows ªº°O¨Æ¥»¾\Ū®É¡A¨S¦³´«¦æ¡A«Ü¤£¤è«K¡C«á¨Ó·Q¼gÓµ{¦¡¡AÂà´«³oºØÀÉ®×Åܦ¨ UTF-8 ½s½Xªº¶W¤å¦r³sµ²ÀÉ ( ´N¬O HTML ÀÉ )¡A¤S·Q¬O§_¯àÂX¥R¦¨³£¥i¥H§â¯Â¤å¦rÀɳ£Âà´«¦¨¶W¤å¦r³sµ²ÀÉ¡H·íµMºn±ø¥ó´N¬On¯à§PÂ_¡A³o¨Ç¯Â¤å¦rÀɪº¤å¦r¬O¥Hþ¤@ºØ¤è¦¡½s½X¡H¾Ú¤p¤ì°¸©Òª¾¡A¯Â¤å¦rÀɤj·§¦³¤U±´XºØ½s½X¤è¦¡¡G
¦³Ãö¸U°ê½Xªº³¡¥÷¡A½Ð°Ñ¾\²Õ¦X»y¨¥ªþ¿ý¤Q¡C¦¹¥~¡AÁÙ¦³¤@ÂIn´£¥X¨Ó¡C¦pªG¦³¤@½g¤å³¹¡A¥þ¬°^¤å©Îªü©Ô§B¼Æ¦r¡A¨º»ò¥H ASCII ½s½X©Î UTF-8 ½s½Xµ²ªG¬O¬Û¦Pªº¡C±z¥i¥H°Ñ¦Ò²Õ¦X»y¨¥ªþ¿ý¤Qªº½s½X¤è¦¡¡A´N¥i¥Hª¾¹D¡A¦b 80h ¥H¤Uªº¦r¤¸¡A¥H UTF-8 ½s½X«áªºµ²ªG»P ASCII ¬Û¦P¡C¤£¹L²ßºD¤W¡A§Ú̧⥦ÂkÃþ¬° ASCII ½s½X¡C
±µ¤U¨Ó¡A¶i¤J¥»³¹¥DÃD¡C³o¤@³¹¡A¤p¤ì°¸¥´ºâ¼gӰƵ{¦¡¡AWhat_Encoding¡A¨Ó§PÂ_¬Y¤@Ó¦r¦êªº½s½X¤è¦¡¬O ASCII¡BBig-5¡BUTF-8 ÁÙ¬O UTF-16¡C³Ì«á§â¥¦Åܦ¨¤@ӰʺA³sµ²µ{¦¡®w¡C¦¹¥~¡A¤p¤ì°¸ÁÙn»¡¨â¥ó¨Æ¡C¤@¬O³oӰƵ{¦¡¬O¦³¨îªº¡A³o¬O¦]¬°¯Â¤å¦rÀÉ¥X²{ªº«Ü¦¡A¤]¨S¦³²Õ´¬°¥¦³W©w¼Ð·Ç®æ¦¡¡A¦]¦¹«ÜÃø¦Ê¤À¤§¦Êªº·Ç½T§PÂ_½s½X¤è¦¡¡C¤G¬O³oӰƵ{¦¡¤]¥i¥H§PÂ_¬YÓÀɮתº½s½X¤è¦¡¡A´N¬YºØµ{«×¦Ó¨¥¡A¦r¦ê¥i¥H»¡¬O¦s©ñ¦b³sÄò°O¾ÐÅ餤ªº¸ê®Æ¡A¦pªG§âÀÉ®×Ū¤J°O¾ÐÅéùØ¡A¤]¬O¦s¦b³sÄòªº°O¾ÐÅ餺¡A©Ò¥H¤p¤ì°¸¤~³o¼ËÁ¿¡C
ÁöµMè軡¨ì¡A¨Ã¨S¦³²Õ´¬°¯Â¤å¦rÀÉq©w¼Ð·Ç²Î¤@ªº®æ¦¡¡A¦ý¬O·L³nªº¡u°O¨Æ¥»¡v( notepad.exe ) ¦bÀx¦sÀɮ׮ɡA¨Ï¥Î Unicode ½s½XÀx¦s®É·|¦Û°Ê¦bÀɮ׫e¥[¤W¡uÃѧO½X¡v¥i¨Ñ¿ë»{¡C¦pªG±z¥Î¡u°O¨Æ¥»¡v¥t¦s·sÀɮɡA·|¬Ý¨£¥i¥H¿ï¥|ºØ½s½X¤è¦¡¡A¦p¤U¹Ï¡G
¦ý¬O³o¥u¬O·L³n¡u°O¨Æ¥»¡v¦³³o¼Ëªº¥\¯à¡A¨ä¥Lªº¤å®Ñ³B²z³nÅ饼¥²¿í´`¦¹³W½d¡C¤£¹L·L³n°]¤j®ð²Ê¡A¬°¤F¬Û®e©Ê¡A©Ò¥H¦³¨Ç³nÅé¤]¨Ì·Ó³oºØ®æ¦¡¡A¦p¡uUltraEdit-32¡v´N¬O¤@Ó¨Ò¤l¡C¤U¹Ï¬O¡uUltraEdit-32¡v¦sÀɮɪºµe±¡G
¤W¹Ï½Æ¦X±±¨î¶µ ( combobox ) ²M³æ¤¤ªº½s½X¤è¦¡¦³¨Ç¬O»P¡uµ§°O¥»¡v¬Û¦P¡A¥u¬O¦WºÙ¤£¦P¡A¥t¥~ÁÙ¦h¤F¦n´XºØ½s½X¤è¦¡¡G
¦b UltraEdit-32 µ{¦¡ùØ¡A§A¥i¥H¿ï¾Ü§â¯Â¤å¦rÀɦs¦¨¡uNO BOM¡v¤]¥i¥H¿ï¾Ü¦s¦¨§t¦³¡uBOM¡vªº¸U°ê½X¡C·íµM¡A¦pªG¿ï¾Ü«eªÌ¡A¨º»ò´N¤£¤Ó®e©ö§PÂ_½s½X¤è¦¡¤F¡C¨¥Âk¥¿¶Ç¡A¥Ñ¤W±ªº¤å®Ñ³B²z¾¹©Ò¦s¦¨ªº¯Â¤å¦rÀɮ榡¡A¤jP¥i¥H§â½s½X¤è¦¡°Ï¤À¦¨¡uASCII¡v¡B¡uUTF-8¡v¡B¡uUTF-16 Little Endian¡v¡B¡uUTF-16 Big Endian¡v¥|ºØ¡A¦A¥[¤W¦b¸U°ê½X¬ãµo¤§«e¡A¤¤µØ¥Á°ê¡B»´ä¡B·s¥[©Yµ¥¦a¡A¥¿Å餤¤å©Ò¥Îªº¡uBig-5¡v½X¡A³o¼Ë¦@¦³¤ºØ½s½X¤è¦¡¡C
¨ºn¦p¦ó§PÂ_¦r¤¸ªº½s½X¤è¦¡©O¡H¦bºô¸ô¤W¦³³\¦h¥ý¶i´£¥X¦UºØ¤èªk¡A¦ý¦¹³B¤p¤ì°¸¶È¥Î³Ì·M²Âªº¤èªk¨Ó§PÂ_¡Cº¥ýn»¡©úªº¬O¡A¨Ï¥ÎªÌn§PÂ_ªº¦r¦ê©ÎÀɮסA¥þ¬°¤@¨Ç¼ÆÈ ( ¥i¬Ý¦¨¤Q¤»¶i¦ìªº¼ÆÈ )¡A³o¨Ç¼ÆȬO¥Ñ¤@³s¦êªº¼ÆÓ¨ì«Ü¦h«Ü¦hªº¦ì¤¸²Õ¶°¦X°_¨Ó¡A©Ò¥H¬O¦UºØ¦r¤¸½s½X¤è¦¡¡A¤]¦³¥i¯à®Ú¥»¤£¬O¯Â¤å¦r¡C¦]¦¹¤p¤ì°¸§â©Ò¦³¥i¯àªº¤ºØ½s½X¤è¦¡Àˬd§¹¡AYÁÙ¤£¬O¨º¤ºØ¡A´N¦³¥i¯à¤£¬O¯Â¤å¦rÀɤF¡C
©³¤U¬O ENCODE.ASM ªºì©l½X¡A¨ä¤º§t¦³ what_encoding¡A¬O¥Î¨Ó§PÂ_¤@¦r¦ê©ÎÀÉ®×½s½X¤è¦¡¡A¤p¤ì°¸±N§â¥¦»s§@¦¨°ÊºA³sµ²µ{¦¡®w¡A¯u¥¿©I¥s®É»Ý¥Î Whate_Encoding¡C
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 149 150 151
152 153 154 155
156 157 158 159
160 161 162 163
164 165 166 167
168 169 170 171
172 173 174 175
176 177 178 179
180 181 182 183
184 185 186 187
188 189 190 191
192 193 194 195
196 197 198 199
200 201 202 203
204 205 206 207
208 209 210 211 |
.586
.MODEL FLAT,STDCALL
OPTION CASEMAP:NONE
;*************************************************************************************************************
.CODE
;-------------------------------------------------------------------------------------------------------------
;¶i¤J¡þÂ÷¶}°Æµ{¦¡
DLLEntry PROC hInstDLL,dwReason,dwReserved
mov eax,1 ;¤£»Ý¨Æ«e³B²z©Î¨Æ«á²M²z¡A¬G¶Èªð¦^TRUE
ret
DLLEntry ENDP
;-------------------------------------------------------------------------------------------------------------
;ÀˬdDL¬O§_¬°10abcdef(¥ç§Y²Ä¤C¡B¤»¦ì¤¸¤À§O¬O1¡B0)¡A¦pªG¬O¡Aªð¦^ZR¡F§_«hªð¦^NZ
check_utf8_10 PROC
and dl,0c0h
cmp dl,80h
ret
check_utf8_10 ENDP
;-------------------------------------------------------------------------------------------------------------
;§PÂ_¦ì§}¦bpString¡Aªø«×¬°cLen¦ì¤¸²Õªº¦r¦ê¡A¬°ASCII¡BBig5¡BUNICODE½s½X¤è¦¡
;ªð¦^®É¡G EAX¡×0¡ÐASCII
;¡@¡@¡@¡@¡@¡@¡×1¡ÐBIG5
;¡@¡@¡@¡@¡@¡@¡×2¡ÐASCII»PBIG5²V¦X
;¡@¡@¡@¡@¡@¡@¡×3¡ÐUTF-8
;¡@¡@¡@¡@¡@¡@¡×4¡ÐUTF-16¡ALittle-Endian
;¡@¡@¡@¡@¡@¡@¡×5¡ÐUTF-16¡ABig-Endian
;¡@¡@¡@¡@¡@¡@¡×6¡Ð«D¯Â¤å¦rÀÉ
;¦¹°Æµ{¦¡¥ýÀˬd¬O§_¦³BOM¡A¦pªG¦³ªº¸Ü³]¦n¬Û¹ïÀ³ªºEAXÈ¡A´NÂ÷¶}°Æµ{¦¡¡C¦pªG¨S¦³BOMªº¸Ü¡AÀˬd¬O§_¬°UTF-8½s½X¡AÀË
;¬d¤èªk¬OÀËÅç²Ä¤@Ӧ줸²Õªº°ª¦ì¤¸¬O§_¬°1110¡B0¡B110¡B11110¡A¦AÀˬd¨ä«áªº2¡B0¡B1¡B3Ӧ줸²Õªº³Ì°ª¨â¦ì¤¸¬O§_§¡¬°
;10¡AY¬°§_ªº¸Ü«h¸õ¨ìwe08¡FY§¡²Å¦Xªº¸Ü¡A«h¦AÀˬd¬O§_¾ãÓpString©Ò«ü¦r¦êªº¨CӦ줸²Õªº³Ì°ª¦ì¤¸§¡¬°0¡AY§¡¬°0¡A
;ªí¥Ü¬OASCII¡F§_«h¬°UTF-8¡C
;what_encoding»Ýncheck_utf8_10°Æµ{¦¡¡C
what_encoding PROC USES esi pString:DWORD,cLen:DWORD
LOCAL cLT80H,cBig5,cOther,cZero,cCrLf:DWORD
LOCAL temp0,temp1:DWORD
mov esi,pString
;Àˬd½s½X¤è¦¡¡A¥ýÀˬd¬O§_¬°Window®æ¦¡ªº¸U°ê½X(Window®æ¦¡ªº¸U°ê½X¦³BOM¡A0feffh¡B0fffeh¡B0bfbbefh)¡G
.IF WORD PTR [esi]==0feffh ;Window®æ¦¡ªº¸U°ê½X¡A¥HUTF-16¡ALittle-Endian½s½X
mov eax,4
.ELSEIF WORD PTR [esi]==0fffeh ;Window®æ¦¡ªº¸U°ê½X¡A¥HUTF-16¡ABig-Endian½s½X
mov eax,5
.ELSEIF WORD PTR [esi]==0bbefh
cmp BYTE PTR [esi+2],0bfh
jne we00
mov eax,3 ;Window®æ¦¡ªº¸U°ê½X¡A¥HUTF-8½s½X
.ELSE ;¦pªG³£¤£¬O¥H¤W¤TºØ¡A´N±o¶i¤@¨BÀˬd¡A¸õ¨ìwe00
jmp we00
.ENDIF
jmp quit_check
;¤]¦³¥i¯à¤£¬OWindow®æ¦¡ªº¸U°ê½X¡A¨º»ò´N¨S¦³BOM(¨Æ¹ê¤W¡AWindow¤]¥i¥HÀx¦sµLBOM)¡A¥ýÀˬd¬O§_¬°UTF-8
;½s½X¡CÀˬd¤èªk¬O¨úcLenӦ줸²ÕÀˬd¡A¦pªG§¡²Å¦XUTF-8½s½X¤è¦¡¡A¨º»òECX¬°0¡A°õ¦æ¨ìwe07³B®É¡A¬°ZR¡C
we00: mov ecx,cLen
mov cLT80H,0
mov cZero,0
mov cOther,0 ;Àx¦s©_¼Æ¦ì§}¬°0ªºÓ¼Æ
mov cBig5,0 ;Àx¦s°¸¼Æ¦ì§}¬°0ªºÓ¼Æ
;²Ä¤@Ó´ú¸Õ¬O¡AÁÙì«áªº¸U°ê½X¬O§_¦b0h¡ã7Fh¤§¶¡
we01: mov al,[esi]
test al,80h
jnz we04 ;YAL¡Ù80h¡A«h¸õ¨ìwe04
or al,al
jnz we02
inc cZero ;Y¦¹¦ì¤¸²Õ¬°0¡AcZero¥[¤@
test esi,1
jz we02
inc cOther ;¦¹¦ì¤¸²Õ¬°0¡A¥B¦b©_¼Æ¦ì§}¡A«hcOther¥[¤@(¥i¯à¬°Little Endian)
jmp we03
we02: inc cBig5 ;¦¹¦ì¤¸²Õ¬°0¡A¥B¦b°¸¼Æ¦ì§}¡A«hcBig5¥[¤@(¥i¯à¬°Big Endian)
we03: inc cLT80H ;¤£ºÞ¦¹¦ì¤¸²Õ¬O§_¬°0¡A§¡¤p©ó80H®É¡A«hcLT80H¥[¤@
inc esi
dec ecx
jnz we01
mov eax,cZero ;YECX¡×0¡Aªí¥Ü¤w¸gÀˬd§¹¦r¦ê¡AÀ³¬°UTF-8½s½X¡A¦ý¶·¶i¤@¨B½T»{
mov ecx,cLen
mov temp0,eax ;pºâEAX¦ûECXªº¦Ê¤À¤ñ¡A©Ò±o¦Ê¤À¤ñ¦s¤JEAXªð¦^¡C
mov temp1,eax ;ECX¬°Á`¼Æ¡AEAX¬°ECXªº¤@³¡¥÷Ó¼Æ
shl temp0,6
shl eax,2
shl temp1,5
add eax,temp0
xor edx,edx
add eax,temp1 ;EAX¡×EAX*100
div ecx ;EAX¡×100*EAX/ECX
cmp eax,10 ;¦pªG0©Ò¦ûªº¤ñ¨Ò¶W¹L10%¥H¤W¡A¸õ¨ìwe11
ja we11
cmp ecx,cLT80H
jne we07
xor eax,eax ;¦pªGcLen¡×cLT80H¡Aªí¥Ü©Ò«ü¦r¦ê¡A¥þ³¡§¡¤p©ó80H¡A¬°ASCII½s½X¡A¦ý
jmp quit_check ;¤]¥i¥H»¡¬OUTF-8(¤£¹L²ßºD¤WÁÙ¬O»{¬°¬OASCII)
;²Ä¤GÓ´ú¸Õ¬O¡AÁÙì«áªº¸U°ê½X¬O§_¦b80h¡ã7FFh¤§¶¡
we04: and al,0e0h
cmp al,0c0h
jne we05
mov dl,[esi+1]
call check_utf8_10
jne we08
add esi,2
sub ecx,2
jz we07
jmp we01
;²Ä¤TÓ´ú¸Õ¬O¡Aì«áªº¸U°ê½X¬O§_¦b800h¡ã0FFFFh¤§¶¡
we05: mov al,[esi]
and al,0f0h
cmp al,0e0h
jne we06
mov dl,[esi+1]
call check_utf8_10
jne we08
mov dl,[esi+2]
call check_utf8_10
jne we08
add esi,3
sub ecx,3
jz we07
jmp we01
;²Ä¥|Ó´ú¸Õ¬O¡AÁÙì«áªº¸U°ê½X¬O§_¦b10000h¡ã1FFFFFh¤§¶¡
we06: mov al,[esi]
and al,0f8h
cmp al,0f0h
jne we08
mov dl,[esi+1]
call check_utf8_10
jne we08
mov dl,[esi+2]
call check_utf8_10
jne we08
mov dl,[esi+3]
call check_utf8_10
jne we08
add esi,4
sub ecx,4
jnz we01
we07: mov eax,3 ;YZR¡A«h¬°UTF-8
jmp quit_check
;we08³B¡A¶}©lÀˬd¬O§_¬°BIG5»PASCII²V¦X¡CÀˬd¤è¦¡¬O¥HcLT80H°O¿ý¦³´XÓASCII¦r¤¸¡AcBig5°O¿ý¦³´XÓBIG5¦r¤¸(¦pªG¬Y
;Ӧ줸²Õ¦b81H¡ã0FEH¤§¶¡¡A¦Ó¥B¤UӦ줸²Õ¦b40H¡ã7EH¤§¶¡©Î0A1H¡ã0FEH¤§¶¡¡A¨º»òÓ¦r²Õ¬°BIG5½X)¡C
we08: mov esi,pString
mov cBig5,0
mov cOther,0
mov cLT80H,0
mov cCrLf,0
mov ecx,cLen
we09: lodsb
.IF (al==0dh)||(al==0ah)
inc cCrLf
.ELSEIF al<80h
inc cLT80H
.ELSEIF (al>=81h)&&(al<=0feh)
.IF (BYTE PTR [esi]>=40h)&&(BYTE PTR [esi]<=7eh)
we10: inc esi
inc cBig5
dec ecx
.ELSEIF (BYTE PTR [esi]>=0a1h)&&(BYTE PTR [esi]<=0feh)
jmp we10
.ELSE
inc cOther
.ENDIF
.ELSE
inc cOther
.ENDIF
loop we09
cmp cOther,0
jnz we14
.IF (cBig5!=0)&&(cLT80H==0)
mov eax,1 ;pString©Ò«üªº¦r¦ê§¡¥ÑBIG5²Õ¦¨
.ELSEIF (cBig5==0)&&(cLT80H!=0)
mov eax,0 ;pString©Ò«üªº¦r¦ê§¡¥ÑASCII²Õ¦¨
;.ELSEIF (cBig5==0)&&(cLT80H==0)¤£¥i¯àµo¥Í³oºØ±¡§Î¡A¤£¥i¯à¤£¬OASCII¡A¤]¤£¬OBIG5¡A¤]¤£¬O¨ä¥L½s½X
.ELSE
mov eax,2 ;pString©Ò«üªº¦r¦ê¥ÑASCII»PBIG5²Õ¦¨
.ENDIF
jmp quit_check
;Y°õ¦æ¨ì¦¹¡A½s½X¤è¦¡¬°µLBOMªºUTF-16¡C§PÂ_¬OUTF-16 Little-Endian(UTF-16LE)©Î¬OUTF-16 Big-Endian(UTF-16BE)
we11: cmp eax,50 ;Yµ¥©ó50%¡Aªí¥Ü¦³¤@¥b¬°¹s¡A§YpString©Ò«ü¦r¦ê¬°µLBOMªº
jne we14 ;UTF-16¡A¥B§¡¬°80H¥H¤Uªº¤å¦r
cmp cOther,0 ;cOther¡×¦b©_¼Æ¦ì§}ªº¦ì¤¸²Õ¡A¬°0ªºÓ¼Æ
jz we12
cmp cBig5,0 ;cBig5¡×¦b°¸¼Æ¦ì§}ªº¦ì¤¸²Õ¡A¬°0ªºÓ¼Æ
jnz we14
mov eax,4 ;YcOther¡Ú0¡A¥BcBig5¡×0¡A«h¬°UTF16 Little-Endian
jmp quit_check
we12: cmp cBig5,0
jz we14
mov eax,5 ;YcOther¡×0¡A¥BcBig5¡Ú0¡A«h¬°UTF16 Big-Endian
jmp quit_check
;¦pªG¬O¯Â¤å¦rÀÉ¡AÀ³¦³´«¦æ²Å¸¹¡AÀˬd´«¦æ²Å¸¹°ª¦ì¤¸²Õ¬°0ªº¬°UTF16 LE¡F§C¦ì¤¸²Õ¬°0ªº¬°UTF16 BE
we14: mov cZero,0 ;ɥΨӰO¿ý°ª¦ì¤¸²Õ¤¤¡A¬°¹sªºÓ¼Æ
mov cOther,0 ;ɥΨӰO¿ý§C¦ì¤¸²Õ¤¤¡A¬°¹sªºÓ¼Æ
mov ecx,cLen
mov esi,pString
shr ecx,1
we15: lodsw
.IF (ax==0dh)||(ax==0ah)
inc cZero
.ELSEIF (ax==0d00h)||(ax==0a00h)
inc cOther
.ENDIF
loop we15
.IF (cZero!=0)&&(cOther==0)
mov eax,4 ;´«¦æ²Å¸¹¤¤¡A°ª¦ì¤¸²Õ¬°0ªºÓ¼Æ«Ü¦h¡A¦ý¨S¦³§C¦ì¤¸²Õ¬°0¡A¬°UTF16 Little-Endian
.ELSEIF (cOther!=0)&&(cZero==0)
mov eax,5 ;´«¦æ²Å¸¹¤¤¡A§C¦ì¤¸²Õ¬°0ªºÓ¼Æ«Ü¦h¡A¦ý¨S¦³°ª¦ì¤¸²Õ¬°0¡A¬°UTF16 Big-Endian
.ELSE
mov eax,6
.ENDIF
quit_check: ret
what_encoding ENDP
;*************************************************************************************************************
END DLLEntry |
©³¤U¬O ENCODE.DEF ÀɮסA¤p¤ì°¸§â what_encoding ¥]¸Ë¦¨ What_Encoding °Æµ{¦¡¡G
1 2 |
EXPORTS
What_Encoding=what_encoding |
©³¤U¬O ENCODE.INC ÀɮסG
1 |
What_Encoding PROTO :DWORD,:DWORD |
©³¤U»¡©ú²ÕĶ¦¨°ÊºA³sµ²µ{¦¡®wªº¤èªk¡G
E:\HomePage\SOURCE\Win32\VIEWHEX>ml /c encode.asm [Enter] Microsoft (R) Macro Assembler Version 6.14.8444 Copyright (C) Microsoft Corp 1981-1997. All rights reserved. Assembling: encode.asm E:\HomePage\SOURCE\Win32\VIEWHEX>link /DLL /SUBSYSTEM:WINDOWS /DEF:encode.def encode.obj [Enter] Microsoft (R) Incremental Linker Version 5.12.8078 Copyright (C) Microsoft Corp 1992-1998. All rights reserved. Creating library encode.lib and object encode.exp E:\HomePage\SOURCE\Win32\VIEWHEX>
¨ì¦¹¡A¤w¸g±o¨ì ENCODE.DLL¡BENCODE.LIB¡BENCODE.INC ³o¤TÓÀɮסA·íµ{¦¡³]p®vn§PÂ_¬Y¬q¦r¦ê¬O¥Îþ¤@ºØ½s½X¤è¦¡¡A¥u»Ý§â¸Ó¬q¦r¦êªº¦ì§}¤Î¨äªø«× ( ¥H¦ì¤¸²Õ¬°³æ¦ì ) ¬°°Ñ¼Æ¡A©I¥s What_Encoding¡A¦p¤U¡G
INVOKE What_Encoding,pString,cLen
ªð¦^«á¡AEAX ·|¦³¸Ó¦r¦êªº½s½X¤è¦¡¡G
EAX | ½s½X¤è¦¡ | EAX | ½s½X¤è¦¡ | |
0 | ASCII | 1 | Big-5 | |
2 | ASCII »P BIG5 ²V¦X | 3 | UTF-8 | |
4 | UTF-16¡ALittle Endian | 5 | UTF-16¡ABig Endian | |
6 | «D¯Â¤å¦rÀÉ |
·íµM¡AÁÙn°O±o¦b©I¥s«e¡An¥ý«Å§i What_Encoding ªºì«¬¡A©Î§â ENCODE.INC ¥]§t¶i¨Ó¡C¦p¤Uµ{¦¡½X¡G
INCLUDE ENCODE.INC INCLUDELIB ENCODE.LIB
¦b ENCODE.ASM ÀÉ®×ùتº²Ä 37¡ã49 ¦æ¡AÀˬd¤F©Ò«üÀɮשΦr¦êªº¶}ÀY¬O§_¦³ BOM¡A¦pªG¦³¡A¨Ì·Ó BOM ªº«ü¥Ü¡A´N¯à±o¨ì½s½X¤è¦¡¤F¡C¦pªG¨S¦³ BOM¡A«h¸õ¨ì²Ä 53 ¦æªº we00 ¼Ð°O³B¡AÄ~ÄòÀˬd¡C
we00 ¼Ð°O³BnÀˬdªº¬O¦¹¦r¦ê©ÎÀɮ׬O§_¬° UTF-8 ½s½X¡C½Ð°Ñ¦Ò²Õ¦X»y¨¥ªþ¿ý¤Q©Î©³¤Uªº»¡©ú¡A¥iª¾ UTF-8 ½s½X¤¤¡A¤@Ó¦r¤¸¥i¯à¥Ñ¤@Ӧ줸²Õ¡A¤]¥i¯à¨âӦ줸²Õ¡A©Î¤TÓ¡B¥|Ӧ줸²Õªí¥Ü¡Aµø¨ä©Ò¥Nªíªº¦r¤¸ªº¼ÆȦbþ¤@Ó½d³ò¡A¦p¤Uªí¡G
ì¨Óªº UCS-4 ¦r¤¸½d³ò |
¦ì¤¸µ²ºc | ¸g UTF-8 Âà´««á |
00000000 ¨ì 0000007F |
²Ä¤@Ó¦r²Õ¡G ²Ä¤GÓ¦r²Õ¡G |
²Ä¤@Ӧ줸²Õ¡G |
00000080 ¨ì 000007FF |
²Ä¤@Ó¦r²Õ¡G ²Ä¤GÓ¦r²Õ¡G |
²Ä¤@Ӧ줸²Õ¡G ²Ä¤GӦ줸²Õ¡G |
00000800 ¨ì 0000FFFF |
²Ä¤@Ó¦r²Õ¡G ²Ä¤GÓ¦r²Õ¡G |
²Ä¤@Ӧ줸²Õ¡G ²Ä¤GӦ줸²Õ¡G ²Ä¤TӦ줸²Õ¡G |
00010000 ¨ì 001FFFFF |
²Ä¤@Ó¦r²Õ¡G ²Ä¤GÓ¦r²Õ¡G |
²Ä¤@Ӧ줸²Õ¡G ²Ä¤GӦ줸²Õ¡G ²Ä¤TӦ줸²Õ¡G ²Ä¥|Ӧ줸²Õ¡G |
ENCODE.ASM ªº²Ä 53¡ã135 ¦æ¡A¤À¥|¦¸´ú¸Õ¬O§_§¡¬° UTF-8 ½s½X¡A¥un¦³¤@Ӧ줸²Õ¤£²Å¦X¤Wªíªº½s½X¤è¦¡¡A´N·|¸õ¨ì²Ä 138 ¦æÄ~ÄòÀˬd¡C±z¥J²ÓÆ[¹î¤W±ªºªí·|µo²{¡A±`±`nÀˬd²Ä 7¡B6 ¦ì¤¸¬O§_¬° 1¡B0¡A¦]¦¹¤p¤ì°¸¼g¤FӰƵ{¦¡¡Acheck_utf8_10¡A¨Ót³d¦¹¨Æ¡C²Ä 53¡ã135 ¦æªºµ{¦¡½X¤¤¡AECX ¥NªíÁÙn´ú¸Õªº¦ì¤¸²Õ¼Æ¡A©Ò¥H¨CÓ´ú¸Õµ²§ô¡A³£·|¦³¡udec ecx¡v¡B¡usub ecx,2¡v¡B¡usub ecx,3¡v¡B¡usub ecx,4¡v¨ÏÁÙnÀˬdªº¦ì¤¸²Õ´î¤Ö ( ¦]¬°Àˬd¹L¤F )¡AY¤@ª½¨ì ECX ¬° 0¡A³£ÁÙ¨S¸õ¨ì²Ä 138 ¦æ³B¡A¨ºªí¥Ü²Å¦X UTF-8¡A¦¹®É³£·|¸õÅD¨ì we07 ¼Ð°O³B¡C
¦b°õ¦æ What_Encoding °Æµ{¦¡®É¡A¨Ã¤£ª¾¹D½s½X¤è¦¡¡A©Ò¥H¤]¦³¥i¯à¬O¥þ½g¬°¯Â^¤å¤å¦rÀÉ¡A«o¥H ASCII ©Î UTF-16 ½s½X¡A²Ä 62¡ã90 ¦æªºµ{¦¡½X¬O¬°¤FÀˬd³oºØ±¡§Î¡C¦pªG¾ã½gÀɮשΦr¦ê¬O¥H ASCII ½s½Xªº¯Â¤å¦rÀÉ¡A¤]´N¬O²Õ¦¨ÀɮשΦr¦êªº¨CӦ줸²Õ§¡¤p©ó 80h ®É¡A¥H ASCII ½s½Xªºµ²ªG»P UTF-8 ½s½Xªºµ²ªG¬O¬Û¦Pªº¡A¦ý²ßºD¤W·|»¡¬O ASCII ( ¨Æ¹ê¤W¡A¥i¥H§â ASCII ½X·í¦¨¬O UTF-8 ªº¡u¤l¶°¦X¡v)¡C¤p¤ì°¸§â¤p©ó 80h ªº¦ì¤¸²ÕӼưO¿ý©ó cLT80H¡A¦A»PÀɮשΦr¦êªø«×¡AcLen¡A¤ñ¸û¡A¦pªG¨âªÌ¬Ûµ¥¡Aªí¥Ü¬° ASCII ½X¡A¨£µ{¦¡½Xªº 87¡ã90 ¦æ¡C¦pªG¬O¯Â^¤å¤å¦r«o¥H UTF-16 ½s½X¡A¨º»ò·|¦³ 50% ªº¦ì¤¸²Õ¬° 0¡C¦pªG¬O°ª¦ì¦ì¤¸²Õ¬° 0 ( °ª¦ì¦ì¤¸²Õ¦b©_¼Æ¦ì§} )¡A¬° UTF-16 Little Endian¡F¦pªG¬O§C¦ì¦ì¤¸²Õ¬° 0 ( §C¦ì¦ì¤¸²Õ¦b°¸¼Æ¦ì§} )¡A«h¬° UTF-16 Big Endian¡C²Ä 74¡ã84 ¦æpºâ 0 ©Ò¦ûªº¤ñ²v¡A¤j©ó 10% ®É¸õ¦Ü²Ä 175 ¦æªº we11 ³B¡AµM«á§PÂ_ 0 ¬O¦b©_¼ÆÁÙ¬O¦b°¸¼Æ¦ì§}¡A¥H¨M©w¬O Little Endian ÁÙ¬O Big Endian¡C¤p¤ì°¸¥H cOther °O¿ý©_¼Æ¦ì§}ªº¦ì¤¸²Õ¬° 0 ªºÓ¼Æ¡F¥H cBig5 °O¿ý°¸¼Æ¦ì§}ªº¦ì¤¸²Õ¬° 0 ªºÓ¼Æ¡C©Ò¥H·í cOther ¬° 0¡A¥B cBig5 ¤£µ¥©ó 0¡Aªí¥Ü¬° UTF16 Big-Endian¡F¤Ï¤§¬° Little Endian¡C³o¬qµ{¦¡¦b²Ä 175¡ã186 ¦æ¡C
°²¦p¤£¬O UTF-8¡A·|¸õÅD¦Ü we08 ©Î we11 ³B°õ¦æ¡Awe08 ¼Ð°O³B¬O§PÂ_¬O§_¬° Big-5 ½s½X¡Awe11 ¼Ð°O³B¬O§PÂ_¾ã½gÀɮשΦr¦ê¬O¥H UTF-16 ½s½Xªº¯Â¤å¦rÀÉ¡CÀˬd¡uBig-5¡v½Xªº¤èªk¬O¡A±Ä¥Î§PÂ_¬YÓ¦r²Õ¬O§_¦b¡uBig-5¡vªº½s½X½d³ò¤º¡C¡uBig-5¡vªº½s½X½d³ò¦p¤U¡A¬YÓ¦r²Õªº§C¦ì¤¸²Õ ( ¤]´N¬O²Ä¤@Ӧ줸²Õ )¦b 81h¡ã0FEh ¤§¶¡¡A¦Ó¥B°ª¦ì¤¸²Õ ( ²Ä¤GӦ줸²Õ ) ¬O¦b 40h¡ã7Eh ¤§¶¡©Î¦b 0A1h¡ã0FEh ¤§¶¡¡C°²¦p¤@¦r¦ê©Î¤@ÀÉ®×°£¤F´«¦æ²Å¸¹¥~¡A¨ä¾l§¡²Å¦X¡uBig-5¡vªº½s½X½d³ò¡A¨º»ò¦¹¦r¦ê©ÎÀÉ®×¥þ¥Ñ¡uBig-5¡v½Xªº¤¤¤å¦r½s¦¨¡F°²¦p°£¤F´«¦æ²Å¸¹¡B¥H¤Î¡uBig-5¡vªº½s½X½d³ò¤ºªº¤å¦r¥H¥~¡AÁÙ¦³¤p©ó 80h ªº¼ÆÈ¡A¨º»òÀ³¸Ó´N¬O¤@Ó§¨ÂøµÛ¤¤^¤åªº¦r¦ê©ÎÀɮסF°²¦p°£¤F¤W±±¡§Î¤§¥~¡AÁÙ¦³¨ä¥L½d³òªº¼ÆÈ¡A§í©Î¬O§C¦ì¦ì¤¸²Õ²Å¦X¡uBig-5¡vªº½s½X½d³ò¤º¡A¦ý°ª¦ì¦ì¤¸²Õ¤£²Å¦X¡A¨º´Nªí¥Ü¤£¬O¡uBig-5¡v½X¤]¤£¬O¤¤^¤å§¨Âøªº±¡§Î¡A·|¸õ¨ì we14 ³B¡C¤p¤ì°¸¥H cBig5 °O¿ý¥H Big-5 ½s½Xªº¦r¤¸Ó¼Æ¡A¥H cLT80H °O¿ý ASCII ½s½Xªº¦r¤¸Ó¼Æ¡A¥H cOther °O¿ý«D ASCII ¤]«D Big5 ªº½s½XӼơC³o¬qµ{¦¡½X¦b²Ä 136¡ã173 ¦æ¡C
¦pªG°õ¦æ¨ì we14 ¼Ð°O³B¡Aªí¥Ü¤£¬O UTF-8¡B¯Â ASCII¡BBig-5 ½s½X¡A¦³¥i¯à¬O UTF-16¡A¤]¦³¥i¯à®Ú¥»¤£¬O¯Â¤å¦rÀÉ¡C°£«D¯à§â¨CÓ¦r¤¸²Õ´°_¨Ó¡A¨Ã¦³¨ä·N¸q¡A¤~¦³¥i¯à§PÂ_¬O UTF-16 ©Î«D¯Â¤å¦rÀÉ¡C¤p¤ì°¸·Q¤F³\¤[¡A¯Â¤å¦rÀÉÀ³¸Ó·|¤À¬q¡A©Ò¥H©Î³\¯à¥Î´«¦æ²Å¸¹§PÂ_¯Â¤å¦rÀÉ¡A¦Ó§â¥¦©M°õ¦æÀÉ¡B¹Ï§ÎÀÉ¡B¼vµÀÉ¡BÀ£ÁYÀɵ¥¤À¶}¡C²Ä 188¡ã206 ¦æ¡A§PÂ_´«¦æ²Å¸¹¬Oªº±Æ¦C¤è¦¡¬° 00 0D ©Î 0D 00¡A¨M©w¬° Big Endian ©Î Little Endian¡C
What_Encoding °Æµ{¦¡µLªk¦Ê¤À¤§¦Êªº§PÂ_¯Â¤å¦rÀɪº½s½X¤è¦¡¡A¤×¨ä¬O¤@ӫܵuªº¦r¦ê¡C¦pªG¦r¦ê°÷ªø·Ç½T«×´N¶V°ª¡C
¯È¤W½Í§L¤£¦p¹ê§@¡A©³¤U¤p¤ì°¸¹ê§@¤@Óµ{¦¡¡AVIEWHEX¡A¥¦·|©I¥s What_Encoding °Æµ{¦¡¡A§â½s½X¤è¦¡Åã¥Ü¥X¨Ó¡A¦p¤U¹Ï©Ò¥Ü¡C·í¨Ï¥ÎªÌ«ö¤U¡u¶}±Ò¡v®É¡A·|¥X²{¡u¶}±ÒÂÂÀÉ¡v³q¥Î¹ï¸Ü²°¡A¨Ï¥ÎªÌ¥i¬D¿ï¤@ÓÀɮסCVIEWHEX ¯à§â¸ÓÀɮתº¤º®e¡A¥H¤Q¤»¶i¦ì¤è¦¡Åã¥Ü¦b¤@Ó¤lµøµ¡¤º¡C¨Ï¥ÎªÌ¥i¥H«öÁä½L¤Wªº¡uPgUp¡v¡B¡uPgDn¡v¡B¡uHome¡v¡B¡uEnd¡vÁä¡A´N¯àÅã¥Ü¤W¤@¶¡B¤U¤@¶¡B²Ä¤@¶»P³Ì«á¤@¶¡F¨Ï¥ÎªÌ¤]¥i¥H§â·Æ¹«´å¼Ð²¾¨ì¤lµøµ¡¥k¤W¨¤ ( µµ¦â®Ø®Øªº°Ï°ì )¡A«ö¤U·Æ¹«¥kÁä¡A¥i¥H¤Á´«¸U°ê½X»P ASCII ( ¸U°ê½X³¡¥÷¥u¯àÅã¥Ü UTF-16 Little Endian )¡C
©³¤U¬O VIEWHEX.EXE.MANIFEST¡G
1 2 3 4
5 6 7 8
9 10 11 12
13 14 15 |
<?xml version='1.0' encoding='UTF-8' standalone='yes'?>
<assembly xmlns='urn:schemas-microsoft-com:asm.v1' manifestVersion='1.0'>
<dependency>
<dependentAssembly>
<assemblyIdentity type='win32'
name='Microsoft.Windows.Common-Controls'
version='6.0.0.0'
processorArchitecture='*'
publicKeyToken='6595b64144ccf1df'
language='*'
/>
</dependentAssembly>
</dependency>
</assembly> |
©³¤U¬O VIEWHEX.RC¡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 |
#include "c:\masm32\include\resource.h"
#define IDB_OPEN 20000
#define IDS_FILENAME 20001
#define IDS_FILEDATA 20002
#define IDS_ENCODE 20003
#define IDC_HEX 20004
#define IDB_QUIT 20005
#define RT_MANIFEST 24
VIEWHEX DIALOG 200,100,416,203
STYLE WS_CAPTION|WS_VISIBLE|WS_SYSMENU
FONT 9,"MS Sans Serif"
CAPTION "Æ[¬ÝÀɮפº®e"
BEGIN
PUSHBUTTON "¶}±Ò",IDB_OPEN, 4, 3, 50,14
LTEXT "",IDS_FILENAME,58, 3,354,10
LTEXT "",IDS_FILEDATA 58, 13,354,10
LTEXT "",IDS_ENCODE, 58, 23,354,10
PUSHBUTTON "Â÷¶}",IDB_QUIT, 4, 18, 50,14
END
EYE ICON viewer02.ico
1 RT_MANIFEST MOVEABLE PURE "VIEWHEX.EXE.MANIFEST" |
©³¤U¬O VIEWHEX.ASM¡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 149 150 151
152 153 154 155
156 157 158 159
160 161 162 163
164 165 166 167
168 169 170 171
172 173 174 175
176 177 178 179
180 181 182 183
184 185 186 187
188 189 190 191
192 193 194 195
196 197 198 199
200 201 202 203
204 205 206 207
208 209 210 211
212 213 214 215
216 217 218 219
220 221 222 223
224 225 226 227
228 229 230 231
232 233 234 235
236 237 238 239
240 241 242 243
244 245 246 247
248 249 250 251
252 253 254 255
256 257 258 259
260 261 262 263
264 265 266 267
268 269 270 271
272 273 274 275
276 277 278 279
280 281 282 283
284 285 286 287
288 289 290 291
292 293 294 295
296 297 298 299
300 301 302 303
304 305 306 307
308 309 310 311
312 313 314 315
316 317 318 319
320 321 322 323
324 325 326 327
328 329 330 331
332 333 334 335
336 337 338 339
340 341 342 343
344 345 346 347
348 349 350 351
352 353 354 355
356 357 358 359
360 361 362 363
364 365 366 367
368 369 370 371
372 373 374 375
376 377 378 379
380 381 382 383
384 385 386 387
388 389 390 391
392 393 394 395
396 397 398 399
400 401 402 403
404 405 406 407
408 409 410 411
412 |
OPTION CASEMAP:NONE
.586
.MODEL FLAT,STDCALL
IDB_OPEN EQU 20000
IDS_FILENAME EQU 20001
IDS_FILEDATA EQU 20002
IDS_ENCODE EQU 20003
IDC_HEX EQU 20004
IDB_QUIT EQU 20005
__UNICODE__ EQU 1
bgColor EQU 0 ;Åã¥Ü¤Q¤»¶i¦ì¤º®e¤lµøµ¡ªºI´º¦â
frColor EQU 0ff00h ;Åã¥Ü¤Q¤»¶i¦ì¤º®e¤lµøµ¡ªº¤å¦rÃC¦â
HexWidth EQU 610
HexHeight EQU 268
FontHeight EQU 15 ;ÅÞ¿è¦r§Î°ª«×
FontWidth EQU 7 ;ÅÞ¿è¦r§Î¼e«×
INCLUDE WINDOWS.INC
INCLUDE COMCTL32.INC
INCLUDE COMDLG32.INC
INCLUDE GDI32.INC
INCLUDE KERNEL32.INC
INCLUDE USER32.INC
INCLUDELIB COMCTL32.LIB
INCLUDELIB COMDLG32.LIB
INCLUDELIB GDI32.LIB
INCLUDELIB KERNEL32.LIB
INCLUDELIB USER32.LIB
INCLUDE ENCODE.INC
INCLUDELIB ENCODE.LIB
;*************************************************************************************************************
.CONST
szDlgName DW 56h,49h,45h,57h,48h,45h,58h,0h ;VIEWHEX
szIconName DW 45h,59h,45h,0h ;EYE
szHexClassName DW 56h,69h,65h,77h,48h,65h,78h,61h,64h,65h,63h,69h,6dh,61h,6ch,0 ;ViewHexadecimal
szFilter DW 53efh,57f7h,884ch,6a94h,28h,2ah,2eh,45h,58h,45h,29h,0h,2ah ;¥i°õ¦æÀÉ(*.EXE),0,*
DW 2eh,45h,58h,45h,0 ;.EXE,0
DW 7d14h,6587h,5b57h,6a94h,28h,2ah,2eh,54h,58h,54h,29h,0h,2ah ;¯Â¤å¦rÀÉ(*.TXT),0,*
DW 2eh,54h,58h,54h,0 ;TXT,0
DW 8d85h,6587h,5b57h,9023h,7d50h,6a94h,28h,2ah,2eh,48h,54h,4dh ;¶W¤å¦r³sµ²ÀÉ(*.HTM
DW 4ch,2ch,2ah,2eh,48h,54h,4dh,29h,0h,2ah,2eh,48h,54h,4dh,4ch,3bh ;L,*.HTM),0,*.HTML;
DW 2ah,2eh,48h,54h,4dh,0h ;*.HTM,0
DW 6240h,6709h,6a94h,6848h,28h,2ah,2eh,2ah,29h,0,2ah,2eh,2ah,0,0 ;©Ò¦³ÀÉ®×(*.*),0,*.*
szCrtDateFmt DW 5efah,6a94h,6642h,9593h,0ff1ah,67h,67h,79h,79h,79h,79h,5e74h ;«ØÀɮɶ¡¡Gggyyyy¦~
DW 4dh,6708h,64h,64h,65e5h,0h ;M¤ëdd¤é
szCrtTimeFmt DW 20h,48h,48h,3ah,6dh,6dh,3ah,73h,73h,3000h,3000h,0 ; HH:mm:ss
szFileSizeFmt DW 6a94h,6848h,5927h,5c0fh,0ff1ah,25h,49h,36h,34h,64h,4f4dh ;Àɮפj¤p¡G%I64d¦ì
DW 5143h,7d44h,28h,62h,79h,74h,65h,73h,29h,0h ;¤¸²Õ(bytes)
szASCII DW 7de8h,78bch,65b9h,5f0fh,0ff1ah,41h,53h,43h,49h,49h,0 ;ASCII
szBig5 DW 7de8h,78bch,65b9h,5f0fh,0ff1ah,42h,49h,47h,2dh,35h,0 ;BIG-5
szASCII_Big5 DW 7de8h,78bch,65b9h,5f0fh,0ff1ah,41h,53h,43h,49h,49h,3001h,42h,\ ;ASCII¡BBIG-5²V¦X
49h,47h,2dh,35h,6df7h,5408h,0h
szUTF8 DW 7de8h,78bch,65b9h,5f0fh,0ff1ah,55h,54h,46h,2dh,38h,0 ;UTF-8
szUTF16LE DW 7de8h,78bch,65b9h,5f0fh,0ff1ah,55h,54h,46h,2dh,31h,36h,20h,4ch,\;UTF-16 Little-Endian
69h,74h,74h,6ch,65h,2dh,45h,6eh,64h,69h,61h,6eh,0
szUTF16BE DW 7de8h,78bch,65b9h,5f0fh,0ff1ah,55h,54h,46h,2dh,31h,36h,20h,42h,\;UTF-16 Big-Endian
69h,67h,2dh,45h,6eh,64h,69h,61h,6eh,0
szNotText DW 975eh,7d14h,6587h,5b57h,6a94h,0h ;«D¯Â¤å¦rÀÉ
pszEncode LPSTR OFFSET szASCII,OFFSET szBig5,OFFSET szASCII_Big5,OFFSET szUTF8
LPSTR OFFSET szUTF16LE,OFFSET szUTF16BE,OFFSET szNotText
szAddrFmt DW 25h,30h,38h,58h,28h,25h,30h,39h,64h,29h,0h ;%08X(%09d)
szFontFace DW 43h,6fh,75h,72h,69h,65h,72h,20h,4eh,65h,77h,0h ;Courier New
szNoFile DW 5c1ah,672ah,9078h,64c7h,6a94h,6848h,0h ;©|¥¼¿ï¾ÜÀÉ®×
szOffsetAddr DW 504fh,79fbh,4f4dh,5740h,0h ;°¾²¾¦ì§}
szHex DW 5341h,516dh,9032h,4f4dh,5167h,5bb9h,0h ;¤Q¤»¶i¦ì¤º®e
szUnicodeTitle DW 842ch,570bh,78bch,0 ;¸U°ê½X
szASCIITitle DW 41h,53h,43h,49h,49h,0 ;ASCII
rcTitle RECT <0,0,608,FontHeight> ;¼ÐÃDÄæ½d³ò
rcTitleAddr RECT <0,0,133,FontHeight> ;¼ÐÃDÄæùتº¦ì§}°Åµô¯x§Î
rcTitleHex RECT <134,0,484,FontHeight> ;¼ÐÃDÄæùتº¤Q¤»¶i¦ì¼ÆȰŵô¯x§Î
rcTitleStr RECT <485,0,608,FontHeight> ;¼ÐÃDÄæùتº¦r¦ê°Åµô¯x§Î
;*************************************************************************************************************
.DATA
hInstance DD ?
hCtrlHex HWND ?
hMem HGLOBAL ?
bgColorControl DD ? ;¤lµøµ¡±±¥óªºI´ºÃC¦â
dwFileSize DD ? ;Àɮפj¤p¡A¥H¦ì¤¸²Õ¬°³æ¦ì
;½s½X¤è¦¡¡G0¡ÐASCII¡C1¡ÐBIG5¡C2¡ÐASCII»PBIG5²V¦X¡C3¡ÐUTF-8¡C4¡ÐUTF-16¡CLittle-Endian¡C5¡ÐUTF-16¡ABig-Endian¡C
dwEncode DD ? ;6¡Ð«D¯Â¤å¦rÀÉ
szFilename DW MAX_PATH DUP (0)
flag DD 0
;¦ì¤¸0¡G0¡Ðªí¥Ü©|¥¼¶}±ÒÀɮסF1¡Ðªí¥Ü¤w¶}±Ò¬YÓÀÉ®×
;¦ì¤¸1¡G0¡Ðªí¥Ü¦bIDC_HEX¥kÃ䬰ASCII©ÎBIG5¡F1¡Ðªí¥Ü¸U°ê½X
;¦ì¤¸2¡G0¡Ðªí¥Ü¥¼¨ìÀÉ®×µ²§À¡F1ªí¥Ü¤w¬°ÀɮקÀºÝ
pFirstByte DD ? ;Åã¥Ü¶ªº²Ä¤@Ó¦ì§}¡A¦¹¦ì§}¬°¬Û¹ï©óhMemªº°¾²¾¦ì§}
pMax1stByte DD ? ;Åã¥Ü¶¤¤ªº²Ä¤@Ӧ줸²Õªº°¾²¾¦ì§}¤£¥i¶W¹LpMax1stByte
;*************************************************************************************************************
.CODE
;-------------------------------------------------------------------------------------------------------------
display_page PROC USES esi hwnd:HWND,hdc:HDC
LOCAL hFont,hbrTitle:HANDLE
LOCAL rcDisplay:RECT ;°Åµô¯x§Î
LOCAL cRow,cHex:DWORD ;¨C¤@Åã¥Ü¶¦³16Ó¾î¦C¡A¨C¤@¾î¦C¦³16Ӧ줸²Õ
LOCAL buffer[20h]:WORD
LOCAL string[20]:WORD
;«Ø¥ßÅÞ¿è¦r§Î
INVOKE CreateFont,FontHeight,FontWidth,0,0,FW_NORMAL,0,0,0,ANSI_CHARSET,OUT_DEFAULT_PRECIS,\
CLIP_DEFAULT_PRECIS,DEFAULT_QUALITY,DEFAULT_PITCH or FF_DONTCARE,OFFSET szFontFace
mov hFont,eax
INVOKE SelectObject,hdc,hFont
INVOKE DeleteObject,eax
;³]©w¼ÐÃDÄæÃC¦â¬°¶À©³¶Â¦r
INVOKE CreateSolidBrush,0ffffh
mov hbrTitle,eax
INVOKE FillRect,hdc,OFFSET rcTitle,hbrTitle ;¶À¦âµe¨ê¶îº¡¼ÐÃDÄæ
INVOKE DeleteObject,hbrTitle
INVOKE SetBkColor,hdc,0ffffh
INVOKE SetTextColor,hdc,0
;Y¥¼¶}±Ò¨ÃŪ¨úÀÉ®×
test flag,1
jnz dp00
INVOKE DrawText,hdc,OFFSET szNoFile,-1,OFFSET rcTitle,DT_CENTER
jmp dp99
dp00: ;Åã¥Ü¼ÐÃD
INVOKE DrawText,hdc,OFFSET szOffsetAddr,-1,OFFSET rcTitleAddr,DT_CENTER
INVOKE DrawText,hdc,OFFSET szHex,-1,OFFSET rcTitleHex,DT_CENTER
test flag,2
.IF ZERO?
mov edx,OFFSET szASCIITitle
.ELSE
mov edx,OFFSET szUnicodeTitle
.ENDIF
INVOKE DrawText,hdc,edx,-1,OFFSET rcTitleStr,DT_CENTER
;¶}©lø¥X¾ãÓÅã¥Ü¶¡A¥ýø»s¦U¦æªº°¾²¾¦ì§}¡A¦¹°¾²¾¦ì§}¥ÑÀÉ®×°_ÀY¶}©lºâ°_
INVOKE SetBkColor,hdc,bgColor
INVOKE SetTextColor,hdc,frColor
mov cRow,10h
mov esi,pFirstByte
mov rcDisplay.top,FontHeight
mov rcDisplay.bottom,FontHeight*2
;¦L¥X³Ì¥ªÃ䪺°¾²¾¦ì§}
dp01: INVOKE wsprintf,ADDR buffer,OFFSET szAddrFmt,esi,esi
mov rcDisplay.left,0
mov rcDisplay.right,133
INVOKE DrawText,hdc,ADDR buffer,-1,ADDR rcDisplay,DT_CENTER
;¦L¥X¤¤¶¡³¡¥÷ªº¤Q¤»¶i¦ì¤º®e
mov rcDisplay.left,144
mov rcDisplay.right,144
mov ecx,FontWidth
lea edi,string
shl ecx,1
add rcDisplay.right,ecx
mov cHex,10h ;¨C¤@¦æ¦³16Ӧ줸²Õªº¸ê®Æ
dp02: mov edx,esi
cmp esi,dwFileSize
jne dp03
or flag,4 ;¦pªG¤w¨ìÀɮקÀºÝ¡A¦L¥X¤Q¤»¶i¦ì¤º®e°±¤î¡A¨Ã³]©wflagªº²Ä
jmp dp04 ;3¦ì¤¸¬°¤@¡A¥H«K¥u¦L¥X¥kÃ䪺¦r¦ê¤@¦¸§Y¥i
dp03: add edx,hMem
movzx eax,BYTE PTR [edx]
lea ecx,buffer
stosb
call al_to_hex
INVOKE DrawText,hdc,ADDR buffer,2,ADDR rcDisplay,DT_LEFT
;pºâ¤U¤@ÓrcDisplay
mov ecx,FontWidth
shl ecx,1
add ecx,FontWidth ;ECX¡×FontWidth*3
add rcDisplay.left,ecx
add rcDisplay.right,ecx
inc esi
dec cHex
jnz dp02
dp04: ;¦L¥X¥kÃ䪺¸U°ê½X¦r¦ê©ÎASCII¦r¦ê
sub eax,eax
stosw
mov rcDisplay.left,485
mov rcDisplay.right,485+FontWidth*16
test flag,2
.IF ZERO?
INVOKE DrawTextA,hdc,ADDR string,-1,ADDR rcDisplay,DT_LEFT or DT_SINGLELINE
.ELSE
INVOKE DrawTextW,hdc,ADDR string,-1,ADDR rcDisplay,DT_LEFT or DT_SINGLELINE
.ENDIF
test flag,4
jnz dp99
add rcDisplay.top,FontHeight
add rcDisplay.bottom,FontHeight
dec cRow
jnz dp01
dp99: and flag,0fffffffbh
ret
display_page ENDP
;-------------------------------------------------------------------------------------------------------------
;§âALªº¤º®eÅܦ¨¤Q¤»¶i¦ì¸U°ê½X¡A¦s©óEDI©Ò«ü¦ì§}¡A¨CÓAL»Ýn¥|Ӧ줸²ÕªÅ¶¡¦s©ñ
al_to_hex PROC
mov dl,al
shr al,4
and dl,0fh
call trans_and_save
mov al,dl
trans_and_save: add al,"0"
cmp al,"9"
jbe ok00
add al,7
ok00: mov [ecx],ax
add ecx,2
ret
al_to_hex ENDP
;-------------------------------------------------------------------------------------------------------------
;¶}±Ò¨ÃŪ¨úÀɮפº®e¡A¦pªG¶}±Ò¦¨¥\¡AhMem·|¦³Àɮפº®e¡A¨Ã§âÀɮ׸ê®Æ(«ØÀɮɶ¡¡BÀɮפj¤p¡B½s½X¤è¦¡)¦s©ószFileData
;ùØ¡AµM«áÃö³¬ÀɮסAªð¦^ªºEAX¡×1¡F¦pªG¥¢±Ñ¡AEAX¡×0
open_and_read PROC hdlg:HWND
LOCAL ofn:OPENFILENAME
LOCAL fi:BY_HANDLE_FILE_INFORMATION
LOCAL ft:FILETIME,syst:SYSTEMTIME
LOCAL hFile:HFILE
LOCAL NumberOfBytesRead:DWORD ;¤wŪ¤JªºÀɮפj¤p
LOCAL szFileData[100h]:WORD
mov eax,hdlg
mov ecx,hInstance
mov edx,OFFSET szFilename
mov ofn.lStructSize,SIZEOF OPENFILENAME
mov ofn.hwndOwner,eax
mov ofn.hInstance,ecx
mov ofn.lpstrFilter,OFFSET szFilter
mov ofn.lpstrCustomFilter,0
mov ofn.nMaxCustFilter,0
mov ofn.nFilterIndex,2
mov ofn.lpstrFile,edx
mov WORD PTR [edx],0
mov ofn.nMaxFile,MAX_PATH
mov ofn.lpstrFileTitle,0
mov ofn.nMaxFileTitle,MAX_PATH
mov ofn.lpstrInitialDir,0
mov ofn.lpstrTitle,0
mov ofn.Flags,OFN_FILEMUSTEXIST or OFN_PATHMUSTEXIST or OFN_HIDEREADONLY
INVOKE GetOpenFileName,ADDR ofn
;¦pªG¨Ï¥ÎªÌ«ö¶}±ÒÂÂÀɹï¸Ü²°ªº¡u¨ú®ø¡v«ö¶s
.IF eax==0
INVOKE GlobalFree,hMem
mov hMem,0
and flag,0fffffffeh
INVOKE SetDlgItemText,hdlg,IDS_FILENAME,OFFSET szHex+12
INVOKE SetDlgItemText,hdlg,IDS_FILEDATA,OFFSET szHex+12
INVOKE SetDlgItemText,hdlg,IDS_ENCODE,OFFSET szHex+12
jmp @f
.ENDIF
INVOKE CreateFile,OFFSET szFilename,GENERIC_READ,0,0,OPEN_ALWAYS,FILE_ATTRIBUTE_NORMAL,0
.IF eax==INVALID_HANDLE_VALUE
@@: xor eax,eax
.ELSE
mov hFile,eax
.IF hMem!=0 ;¦pªG¨Ï¥ÎªÌ¤w¸g¶}±Ò¹L¬Y¤@ÓÀɮסAhMem¤£¬°¹s¡A¥ýÄÀ©ñªº°O¾ÐÅé°Ï¶ô
INVOKE GlobalFree,hMem
.ENDIF
INVOKE GetFileInformationByHandle,hFile,ADDR fi
mov eax,fi.nFileSizeLow
mov dwFileSize,eax
mov edx,eax
add eax,200h
and eax,0fffffff0h
and edx,0ffffff00h
mov pMax1stByte,edx
INVOKE GlobalAlloc,GPTR,eax
mov hMem,eax
INVOKE ReadFile,hFile,hMem,dwFileSize,ADDR NumberOfBytesRead,0
INVOKE CloseHandle,hFile
;§âIDS_FILENAMEÀRºA±±¨î¶µ¼ÐÃD³]¬°ÀɮצWºÙ
INVOKE SetDlgItemText,hdlg,IDS_FILENAME,OFFSET szFilename
;¨ú±oÀɮ׫إ߮ɶ¡»PÀɮפj¤p
push edi
INVOKE FileTimeToLocalFileTime,ADDR fi.ftCreationTime,ADDR ft ;§âUTC®É¶¡Åܦ¨·í¦a®É¶¡(¤¤µØ¥Á°ê¼Ð·Ç®É¶¡)
INVOKE FileTimeToSystemTime,ADDR ft,ADDR syst ;§âFILETIME®æ¦¡ªº·í¦a®É¶¡Åܦ¨SYSTEMTIME®æ¦¡
lea edi,szFileData
INVOKE GetDateFormat,LOCALE_USER_DEFAULT,0,ADDR syst,OFFSET szCrtDateFmt,edi,SIZEOF szFileData
dec eax
shl eax,1
mov ecx,SIZEOF szFileData
add edi,eax
sub ecx,eax
INVOKE GetTimeFormat,LOCALE_USER_DEFAULT,0,ADDR syst,OFFSET szCrtTimeFmt,edi,ecx
dec eax
shl eax,1
add edi,eax
;§âÀɮפj¤p¦s¤JEDI©Ò«ü¦ì§}¡A¦¹¦ì§}¦bszFileDataùØ
INVOKE wsprintf,edi,OFFSET szFileSizeFmt,fi.nFileSizeLow,fi.nFileSizeHigh
INVOKE SetDlgItemText,hdlg,IDS_FILEDATA,ADDR szFileData
pop edi
;ÀˬdÀÉ®×½s½X¤è¦¡¬°ASCII¡BUNICODE(UTF-16¡BUTF-8)¡B¡K¡K
INVOKE What_Encoding,hMem,dwFileSize
mov dwEncode,eax
shl eax,2
mov edx,pszEncode[eax]
INVOKE SetDlgItemText,hdlg,IDS_ENCODE,edx
mov eax,TRUE
mov pFirstByte,0
or flag,1
.ENDIF
ret
open_and_read ENDP
;-------------------------------------------------------------------------------------------------------------
HexProc PROC hWndHex:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
LOCAL ps:PAINTSTRUCT
.IF uMsg==WM_PAINT
INVOKE BeginPaint,hWndHex,ADDR ps
INVOKE display_page,hWndHex,ps.hdc
INVOKE EndPaint,hWndHex,ADDR ps
.ELSEIF uMsg==WM_KEYUP
mov ecx,100h
.IF wParam==VK_PRIOR ;«ö¤UPage UpÁä
sub pFirstByte,ecx
jge key_up_ok
mov pFirstByte,0
.ELSEIF wParam==VK_NEXT ;«ö¤UPage DownÁä
add pFirstByte,ecx
mov eax,pMax1stByte
cmp eax,pFirstByte
jae key_up_ok
mov pFirstByte,eax
.ELSEIF wParam==VK_HOME ;«ö¤UHomeÁä
mov pFirstByte,0
.ELSEIF wParam==VK_END ;«ö¤UEndÁä
mov eax,pMax1stByte
mov pFirstByte,eax
.ENDIF
key_up_ok: INVOKE InvalidateRect,hCtrlHex,0,TRUE
.ELSEIF uMsg==WM_LBUTTONUP
mov eax,lParam
mov edx,lParam
and eax,0ffffh ;EAX¡×·Æ¹«©ÒÂIÀ»ªºX®y¼Ð
shr edx,10h ;EDX¡×·Æ¹«©ÒÂIÀ»ªºY®y¼Ð
.IF (eax>485)&&(eax<=608)&&(edx<=FontHeight)
xor flag,2
INVOKE InvalidateRect,hCtrlHex,0,TRUE
.ENDIF
.ELSEIF uMsg==WM_CLOSE
INVOKE DestroyWindow,hWndHex
.ELSEIF uMsg==WM_DESTROY
INVOKE PostQuitMessage,NULL
.ELSE
INVOKE DefWindowProc,hWndHex,uMsg,wParam,lParam
ret
.ENDIF
xor eax,eax
ret
HexProc ENDP
;-------------------------------------------------------------------------------------------------------------
DlgProc PROC hDlg:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
LOCAL wc:WNDCLASSEX
.IF uMsg==WM_COMMAND
mov edx,wParam
mov eax,wParam
shr edx,10h ;EDX=³qª¾½X
and eax,0ffffh ;EAX=±±¨î¤¸¥óÃѧO½X
.IF dx==BN_CLICKED
.IF ax==IDB_OPEN
INVOKE open_and_read,hDlg
INVOKE InvalidateRect,hCtrlHex,0,TRUE
INVOKE SetFocus,hCtrlHex ;§âIDC_HEX³]¬°¨ã¦³¿é¤JµJÂI
.ELSEIF ax==IDB_QUIT
jmp quit
.ENDIF
.ENDIF
.ELSEIF uMsg==WM_INITDIALOG
;µù¥U¤lµøµ¡Ãþ§O
mov ecx,hInstance
mov wc.cbSize,SIZEOF WNDCLASSEX
mov wc.style,CS_HREDRAW or CS_VREDRAW
mov wc.lpfnWndProc,OFFSET HexProc
mov wc.cbClsExtra,0
mov wc.cbWndExtra,0
mov wc.hInstance,ecx
mov wc.hIcon,0
INVOKE LoadCursor,NULL,IDC_ARROW
mov wc.hCursor,eax
INVOKE CreateSolidBrush,bgColor
mov wc.hbrBackground,eax
mov wc.lpszMenuName,0
mov wc.lpszClassName,OFFSET szHexClassName
mov wc.hIconSm,0
INVOKE RegisterClassEx,ADDR wc
;¥H¤W±ªºµøµ¡Ãþ§O¡A«Ø¥ß¤lµøµ¡
INVOKE CreateWindowEx,0,OFFSET szHexClassName,0,WS_CHILD or WS_BORDER or WS_TABSTOP,6,54,\
HexWidth,HexHeight,hDlg,IDC_HEX,hInstance,0
mov hCtrlHex,eax
INVOKE ShowWindow,hCtrlHex,SW_SHOWDEFAULT
;¸ü¤J¹Ï¥Ü¨Ã¥H¦¹³]©w¹ï¸Ü²°¹Ï¥Ü
INVOKE LoadIcon,hInstance,OFFSET szIconName
INVOKE SendMessage,hDlg,WM_SETICON,ICON_SMALL,eax
INVOKE GetSysColor,COLOR_3DFACE
mov bgColorControl,eax
.ELSEIF uMsg==WM_CLOSE
quit: INVOKE GlobalFree,hMem
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
INVOKE InitCommonControls
;*************************************************************************************************************
END start |
§â¹Ï¥ÜÀÉ VIEWER02.ico »P VIEWHEX.ASM¡BVIEWHEX.RC¡BVIEWHEX.EXE.MANIFEST¡BENCODE.INC¡BENCODE.LIB¡BENCODE.DLL ¤CÓÀÉ®×¥þ©ñ¦b¦P¤@¤l¥Ø¿ýùØ¡AµM«á¨Ì¤U±¨BÆJ²ÕĶ¨Ã³sµ²¡G
E:\HomePage\SOURCE\Win32\VIEWHEX>rc viewhex.rc [Enter] E:\HomePage\SOURCE\Win32\VIEWHEX>ml viewhex.asm /link viewhex.res [Enter] Microsoft (R) Macro Assembler Version 6.14.8444 Copyright (C) Microsoft Corp 1981-1997. All rights reserved. Assembling: viewhex.asm ************* UNICODE Build ************* Microsoft (R) Incremental Linker Version 5.12.8078 Copyright (C) Microsoft Corp 1992-1998. All rights reserved. /SUBSYSTEM:WINDOWS "viewhex.obj" "/OUT:viewhex.exe" "viewhex.res" E:\HomePage\SOURCE\Win32\VIEWHEX>
³Ì«á¥i±o VIEWHEX.EXE ¥i°õ¦æÀÉ¡A¥¦¶·»P ENCODE.DLL ©ñ¦b¦P¤@¤l¥Ø¿ý¤~¥i¥¿±`¹B§@¡C
VIEWHEX ¥Ñ²Ä 406 ¦æ¶}©l°õ¦æ¡A¨ì²Ä 408 ¦æ«h«Ø¥ß¤@Ó¹ï¸Ü²°¡A¦¹¹ï¸Ü²°¨Ì¾Ú VIEWHEX.RC ¤ºªº¹ï¸Ü²°¼ÒªO«Ø¥ß¤F¨âÓ«ö¶s»P¤T¦æÀRºA±±¥ó¡A¦Ó¦û¹ï¸Ü²°³Ì¤j°Ï°ì¡Bºñ¦r¶Â©³ªº¤lµøµ¡¡A«h¬O¦b¹ï¸Ü²°¨ç¦¡ùØ¡A³B²z WM_INITDIALOG ®É«Ø¥ßªº ( ²Ä 365¡ã386 ¦æ )¡A«Ø¥ß¦n«á§â¥¦ªºµøµ¡¥N½X¡A¦s¤J hCtrlHex ùØ¡ChCtrlHex ¤lµøµ¡¡A¨Ã¤£¬O Win32 ¨t²Î¤º©Ò¹w«Øªº±±¥ó¡A¦]¬°¥¦Ì¤£²Å¦X¤p¤ì°¸ªº»Ý¨D¡C½s¿è®Ø±±¥ó¦b¸ü¤J¤jÀɮ׮ɡA·|ªá«Ü¦h®É¶¡³B²z¡A¤~¯àÅã¥Ü¥X¨Ó¡A¦]¦¹¤p¤ì°¸¤~¦Û¦æ«Ø¥ß³oÓ¤lµøµ¡¡ChCtrlHex ªº²£¥Í¡A¤]ÃÒ©ú§ÚÌ¥i¥H¦b¹ï¸Ü²°µ{¦¡¤¤¦Û¤v³]p¤lµøµ¡¡C
¹ï¸Ü²°¨ç¦¡¥Dn³B²z¨âÓ°T®§¡G¤@¬O WM_COMMAND¡A¥t¤@Ó¬O WM_INITDIALOG °T®§¡C¦b WM_COMMAND °T®§¤¤¡A¥Dn¬O³B²z·í¨Ï¥ÎªÌ«ö¤U¡u¶}±Ò¡v«ö¶sªº¹Lµ{¡Cº¥ý·|©I¥s open_and_read °Æµ{¦¡¡A¦¹°Æµ{¦¡·|©I¥s GetOpenFileName API¡A¨ú±o±Nn¶}±ÒªºÀɮצWºÙ ( ²Ä 213¡ã231 ¦æ )¡A¦pªG¦¨¥\¡A«h¶}±ÒÂÂÀÉ®× ( ²Ä 242 ¦æ )¡C¦bŪ¨úÀɮפº®e¤§«e¡A¥ýÄÀ©ñì¥ýªº°O¾ÐÅé°Ï¶ô ( ²Ä 247¡ã249 ¦æ )¡C¬°¦ón¥ýÄÀ©ñ°O¾ÐÅé°Ï¶ô©O¡H³o¬O¦]¬°·í¨Ï¥ÎªÌ¶}±Ò¤@Àɮ׫á¡A¦p¤S¶}±Ò¥t¤@ÓÀɮסA«h¦s¦³ì¥ýªºÀɮפº®eªº°O¾ÐÅé°Ï¶ô«KµL¥Î¤F¡A¬°¤£¯Ó¶O¦h¾l¸ê·½¡A¬G¥ý±N¨äÄÀ©ñ¡Cµ¥¤@¤Á§¹¦¨«á¡A¤~¨ú±oÀɮפj¤p¡B«Ø¥ß®É¶¡¡B¨ÌÀɮפj¤p°t¸mµy¦h¤@ÂI·sªº°O¾ÐÅé¡BŪ¨úÀɮפº®e¨ì¦¹°O¾ÐÅ餺¡B©I¥s What_Encoding §PÂ_½s½X¤è¦¡¡A³Ì«á¨Ï¤TÓÀRºA±±¥óÅã¥ÜÀɦWÀɮפj¤p»P½s½X¤è¦¡ ( ²Ä 247¡ã291 ¦æ )¡C
hCtrlHex ¤lµøµ¡ªºµøµ¡¨ç¦¡¦b²Ä 369 ¦æ«ü©w¡A¬° HexProc °Æµ{¦¡¡C¥¦t³d³B²z WM_PAINT¡BWM_KEYUP¡BWM_LBUTTONUP ¤TÓ°T®§¡CWM_PAINT ·|©I¥s display_page¡Adisplay_page ·|¨Ì¾Ú¬O§_¤w¸g¶}±ÒÀɮסA¦b hCtrlHex ¤lµøµ¡¤ºÅã¥ÜÀɮפº®e©ÎªÌ¨Ï hCtrlHex ªÅ¥Õ ( ²Ä 113¡ã115 ¦æ )¡C¨ä¤èªk¬O³]©w flag Åܼƪº²Ä 0 ¦ì¤¸¡A¬°¤@®Éªí¥Ü¤w¶}±ÒÀÉ®× ( ¦b open_and_read °Æµ{¦¡¤¤¡A¦pªG¦¨¥\Ū¨úÀɮפº®e®É¡A¦¹¦ì¤¸·|³Q³]©w¡A²Ä 291 ¦æ )¡F¬°¹s®Éªí¥Ü¥¼¶}±ÒÀÉ®× ( ²Ä 236 ¦æ )¡C¦pªG¤w¶}±ÒÀɮסA¨º»ò display_page ·|®Ú¾Ú pFirstByte ÅܼơA§â¥]§t¦¹ÅܼƥH«áªº 256 Ӧ줸²Õªº¸ê®Æ¡AÅã¥Ü¦b hCtrlHex µøµ¡ùØ¡C
¦b dispaly_page ùØ¥i¤À¦¨¤T³¡¥÷Åã¥Ü¡A¥ªÃ䪺°¾²¾¦ì§}¡A¤¤¶¡ªº¤Q¤»¶i¦ì¤º®e¡A¥kÃ䪺¦r¦ê¡C¥ªÃ䪺°¾²¾¦ì§}ªº°ò·ÇÂI¬O¥ÑÀÉ®×°_ÀY¶}©l¡A¦]¦¹¦b¦¨¥\¶}±ÒÀɮ׫á¡A»Ýn§â pFirstByte ³]¬° 0 ( ²Ä 290 ¦æ )¡C¥kÃ䪺¦r¦ê¡A·|¨Ì¾Ú¶À¦â¼ÐÃDÄæÅã¥Ü¡uASCII¡v©Î¡u¸U°ê½X¡v¨Ó¸ÑÄÀ¦r¦ê¡C³o¤]¬O§Q¥Î flag ¤¤ªº²Ä¤@Ӧ줸¨M©w¡A¦pªG¦¹¦ì¤¸¬°¹s¡Aªí¥ÜÅã¥Ü ASCII¡F§_«hÅã¥Ü¸U°ê½X ( ¦¹³Bªº¸U°ê½X¶È¯àÅã¥Ü UCS-2 ¦r¶°¡C¨CÅã¥Ü¤¤¶¡ªº¤Q¤»¶i¦ì¤º®e¤@¾î¦Cªº¸ê®Æ¡Adisplay_page ´N·|§â¸Ó¦Cªº¸ê®Æ¦s¤J string °Ï°ìÅܼÆùØ ( ²Ä 155 ¦æ )¡Aµ¥¤¤¶¡ªº¤Q¤»¶i¦ì¤º®eÅã¥Ü§¹²¦¡A´N·|¥H©I¥s DrawTextA ©Î DrawTextW ªº¤è¦¡Åã¥Ü string ( ²Ä 172¡ã177 ¦æ )¡C
HexProc ¤]±o³B²z WM_KEYUP °T®§¡A³o¬O¬°¤FÅý¨Ï¥ÎªÌ«ö¤UÁä½L¤Wªº¡uPgUp¡v¡B¡uPgDn¡v¡B¡uHome¡v¡B¡uEnd¡vÁä¡A¯àÅã¥Ü¤W¤@¶¡B¤U¤@¶¡B²Ä¤@¶»P³Ì«á¤@¶¡C¥un§ïÅÜ pFirstByte ÅܼƧY¥i¡A¨Ò¦p·í«ö¤U¡uHome¡vÁä®É¡A¨Ï pFirstByte Åܬ° 0¡F«ö¤U¡uPgDn¡vÁä®É¡A¨Ï pFirstByte ¼W¥[ 100h¡C·íµMnª`·N pFirstByte ¬O¦³½d³òªº¡A¤£¥i¤p©ó¹s¡A¤]¤£·|¶W¹L pMax1stByte¡CpMax1stByte ªº¤j¤pÅãµM»PÀɮפj¤p¦³Ãö¡A¦b¶}±ÒÀɮ׮ɴN¥i¨D±o¡A¨£²Ä 251¡ã257 ¦æ¡C¦b³B²z§¹«öÁä«á¡A©I¥s InvalidateRect ¨Ï hCtrlHex «·sø»s¤º®e¡C¥t¥~¡An¨Ï HexProc ¯à±µ¦¬¨ì¨Ó¦Û«öÁä°T®§¡A¥²¶·¨Ï hCtrlHex ¨ã¦³¿é¤JµJÂI¡A³o¤@µ{¦¡¤ù¬qÀ³¦b¨Ï¥ÎªÌ¶}±ÒÀɮפ§«á¡A§Y¨è©I¥s SetFocus ( ¨£²Ä 385 ¦æ )¡C
¦b HexProc ùØ¡AÁÙn³B²z·Æ¹«¥ªÁ䪺¨Æ¥ó¡C³oӨƥó¬O·í¨Ï¥ÎªÌ¦b hCtrlHex ¥k¤W¨¤ªº¶À¦â¼ÐÃDÄ椤ÂI«ö®É¡A¤Á´«¥kÃäÅã¥Üªº¦r¦ê¬°¡uASCII¡v©Î¡u¸U°ê½X¡v¡C¨£²Ä 323¡ã331 ¦æ¡C