The MASM Forum Archive 2004 to 2012
Welcome, Guest. Please login or register.
October 23, 2018, 02:28:03 PM

Login with username, password and session length
Search:     Advanced search
128553 Posts in 15254 Topics by 684 Members
Latest Member: mottt
* Home Help Search Login Register
+  The MASM Forum Archive 2004 to 2012
|-+  Specialised Projects
| |-+  Pelle's Macro Assembler Development (Moderator: Vortex)
| | |-+  Get file extension
« previous next »
Pages: [1] Print
Author Topic: Get file extension  (Read 3729 times)
Raider of the lost code
Gender: Male
Posts: 3460

Get file extension
« on: April 28, 2012, 10:02:38 AM »

GetFileExtension finds the address of a file name. It returns the address of the string if there is no file extension.

EndOfStr, a modified version of the StrLen function determines the end of a NULL terminated string.

.model flat,stdcall
option casemap:none



GetFileExtension PROC USES esi edi pFileName:DWORD

    mov     esi,pFileName
    mov     edi,1
    invoke  EndOfStr,esi
    movzx   ecx,BYTE PTR [esi]
    mov     BYTE PTR [esi],'.'
    sub     eax,edi
    cmp     BYTE PTR [eax],'.'
    jne     @b
    mov     BYTE PTR [esi],cl

GetFileExtension ENDP


* (3.48 KB - downloaded 361 times.)

Pages: [1] Print 
« previous next »
Jump to:  

Powered by MySQL Powered by PHP The MASM Forum Archive 2004 to 2012 | Powered by SMF 1.0.12.
© 2001-2005, Lewis Media. All Rights Reserved.
Valid XHTML 1.0! Valid CSS!