WinAsm Studio, The Assembly IDE - Free Downloads, Source Code
Sponsors
Articles
Programming Quick Start
32-bit Assembler is Easy
Porting Iczelion tutorials
What is FASM
What is FASM G
Hard Drive Recovery
Wiring your own LAN
Personal menu
Welcome Guest
User:
Pass:
Register!
Resend Validation Email
 
Forum
Forum Rules Snippets forum rules

In this forum all the registered users may post their snippets of code they whish to share with the WinAsm Studio community following these basic rules:
* Only snippets of code are accepted in the topics of this forum.
* Discussions, suggestions, requests etc. must be posted in the "Discussions" topic.
* Do not post copyrighted material.
Administrators/moderators may edit, move or delete the entries that do not follow the preceding rules.

Pages (2) [1] 2   ( Go to first unread post )

PathStripPath - Shlwapi, I have always used PathStripPath from Shlwapi to extract the filename, here is my snippet solution

ragdog
Quote Post


Extremely Active Member
******

Group: Moderators
Posts: 892
Member No.: 5019
Joined: 13-May 07


Hi

I have always use PathStripPath from Shlwapi
For Extract the filename

Here is my solution

CODE
.data
sztring db "C:\WinAsm\Samples\SetImages\test.exe",0

.code

invoke  lstrlen,addr sztring
    lea  ecx,sztring
   add  eax,ecx
.while BYTE PTR [eax] != '\'
        dec  eax
.endw
inc  eax


Eax return now the Filename

I have try to post it to the Snippets thread but i have not right for it :rolleyes:

Sponsored Links
PMUsers Website
Top
Gunner
Quote Post


Extremely Active Member
******

Group: Admins
Posts: 213
Member No.: 27608
Joined: 11-October 09


Moved... Thanks ragdog! Quick test and works nice!.
PMEmail PosterUsers Website
Top
ragdog
Quote Post


Extremely Active Member
******

Group: Moderators
Posts: 892
Member No.: 5019
Joined: 13-May 07


Fine Gunner
PMUsers Website
Top
maluc
Quote Post


Member
**

Group: Members
Posts: 24
Member No.: 1858
Joined: 23-December 05


or

uselib msvcrt

.code
invoke crt_strrchr,addr szString,'\'
inc eax
PMEmail Poster
Top
ragdog
Quote Post


Extremely Active Member
******

Group: Moderators
Posts: 892
Member No.: 5019
Joined: 13-May 07


Check File extension

Shlwapi (PathFindExtension)
CODE

invoke PathFindExtension,addr sztring
.if DWORD PTR [eax] == 'exe.'
  invoke MessageBox,0,CTEXT ("TRUE"),0,MB_OK
.endif


My Solution
CODE

invoke  lstrlen,addr sztring
    lea  ecx,sztring
   add  eax,ecx
   sub  eax,4
.if DWORD PTR [eax] == 'exe.'
  invoke MessageBox,0,CTEXT ("TRUE"),0,MB_OK
.endif


Why i make this, and not use Shlwapi Api´s

Here on board is in the last time it is become really quiet
and i inspire New Members or old Member for more activity :lol:

All snipped is a effect of my new Project

Greets,
PMUsers Website
Top
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

Topic Options Pages (2) [1] 2  Reply to this topicStart new topic

 

Sponsors
Computer Science

Internet
C/C++
Hardware & PC maintenance

HiEditor

General Discussions
Suggestions/Bug Reports
WinAsm Studio

General Discussions
Suggestions/Bug Reports
WinAsm Studio FAQ
Multilingual User Interface
Add-Ins
Assembly Programming

Main
Newbies
Projects
Custom Controls
Snippets
Announcements & Rules

Announcements

General

Online Degrees - Distance Learning
The Heap
Russian
Google