
Extremely Active Member
     
Group: Moderators
Posts: 140
Member No.: 8
Joined: 13-May 04

|
Here is a GetFileExtension procedure. It reads the extension of a filename including the dot separator. The only condition to use the procedure is to avoid NULL pointers.
| CODE | .386 .model flat,stdcall option casemap:none
.data
GFEtable db 1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 db 0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0 .code
GetFileExtension PROC uses esi _file:DWORD
mov esi,_file mov edx,OFFSET GFEtable xor ecx,ecx l0: mov eax,esi ; The procedure returns the address of the filename @@: ; if there is no extension add esi,1 mov cl,BYTE PTR [esi] cmp BYTE PTR [edx+ecx],0 je @b cmp cl,'.' je l0 ret
GetFileExtension ENDP
END |
Attached File ( Number of downloads: 39 )
Login or Register to download
|