Hi guys .
I've read the masm32 about structures.
But i'm working on finding a file path and have to search the hdd .
How and where is a structure defined.
In the msdn the structure is like so.
ypedef struct _WIN32_FIND_DATA {
DWORD dwFileAttributes;
FILETIME ftCreationTime;
FILETIME ftLastAccessTime;
FILETIME ftLastWriteTime;
DWORD nFileSizeHigh;
DWORD nFileSizeLow;
DWORD dwReserved0;
DWORD dwReserved1;
TCHAR cFileName[MAX_PATH];
TCHAR cAlternateFileName[14];
} WIN32_FIND_DATA,
*PWIN32_FIND_DATA,
*LPWIN32_FIND_DATA;
Thanks .
That one is already in windows.inc
--- rip --- rip --- rip --- rip --- rip --- rip --- rip --- rip --- rip ---
WIN32_FIND_DATA STRUCT
dwFileAttributes DWORD ?
ftCreationTime FILETIME <>
ftLastAccessTime FILETIME <>
ftLastWriteTime FILETIME <>
nFileSizeHigh DWORD ?
nFileSizeLow DWORD ?
dwReserved0 DWORD ?
dwReserved1 DWORD ?
cFileName BYTE MAX_PATH dup(?)
cAlternate BYTE 14 dup(?)
WIN32_FIND_DATA ENDS
--- rip --- rip --- rip --- rip --- rip --- rip --- rip --- rip --- rip ---
Thanks as always Tedd.
How would i use this struct.
.data?
Like WIN32_FIND_DATA STRUCT <>
I'm not sure on the use of them yet.
The explanation is not enough from the examples in the help file.
Thanks.
yes that is fine but without the STRUCT, just the type is fine. if you wanted it initialized, you could fill in its members like so:
.DATA?
Like WIN32_FIND_DATA <> ;take the default values as defined in the structure
.DATA
This WIN32_FIND_DATA <23, , , ,0,213h, , ,"something.txt">
;first member gets 23
;take default value for the next 3 members
;file size is 0:00000213h
;next 2 members default
;file name is "something.txt"
;default for last member
SOME_STRUCT STRUCT
member1 DWORD ?
member2 DWORD 8000h
member3 DWORD ?
SOME_STRUCT ENDS
that SOME_STRUCT <4000h, , 0C000h>
;the same as putting "that SOME_STRUCT <4000h,8000h,0C000h>"
hope that helps
As for actual usage, an example might be a bit more helpful..
<attachment>
This shows how to reference a member of a structure (though there are other more direct ways)
[attachment deleted by admin]
l_Process_Information PROCESS_INFORMATION <>
I use the Structure Name with a l_ in front on it for simple stuff. l_ is for local.
Regards, P1 :8)
Quote from: gavin on September 08, 2005, 12:52:08 PM
Thanks as always Tedd.
How would I use this struct?
.data?
MyFile WIN32_FIND_DATA STRUCT<>
Hi Gavin, you should also be able to initialize the members like this:
include masm32rt.inc
.data?
MyFile WIN32_FIND_DATA STRUCT<>
.code
mov MyFile.dwfileAttributes,23
mov MyFile.nFileSizeLow,213h
m2m MyFile.cFileName,CHR$("somefile.txt",0)