WinAsm Studio, The Assembly IDE - Free Downloads, Source Code
Articles
Programming Quick Start
32-bit Assembler is Easy
Porting Iczelion tutorials
What is FASM
Hard Drive Recovery
Wiring your own LAN
 
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.

 

Get file size given a pointer to the filename, you can use this macro for inline get filesize in the WIN32_FIND_DATA structure using the FindFirstFile and FindClose API's.

shoorick
Quote Post


Extremely Active Member
******

Group: Admins
Posts: 2314
Member No.: 160
Joined: 22-June 04


you can use this macro for inline get filesize. _name should be a pointer to filename (do not use wildcards!). when fail - ZF will on. on success: edx:eax is value. fasm syntaxis.
CODE

macro file_size _name
{
� �local .fz
� �push ebp
� �mov ebp,esp
� �sub esp,140h
� �invoke FindFirstFile,_name,esp
� �cmp eax,INVALID_HANDLE_VALUE
� �pushf
� �je .fz
� �invoke FindClose,eax
� �mov edx,[esp + WIN32_FIND_DATA.nFileSizeHigh + 4]
� �mov eax,[esp + WIN32_FIND_DATA.nFileSizeLow �+ 4]
.fz:
� �popf
� �mov esp,ebp
� �pop ebp
}

Sponsored Links
PMEmail PosterUsers Website
Top
0 User(s) are reading this topic (0 Guests and 0 Anonymous Users)
0 Members:

Topic Options 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