Hello.
How i can to invoke this function? Masm don't know some symbols, such as FindExInfoStandard and other from here
http://msdn.microsoft.com/en-us/library/windows/desktop/aa364415(v=vs.85).aspx
http://msdn.microsoft.com/en-us/library/windows/desktop/aa364416(v=vs.85).aspx
Where can I get these values? Usually, I would take them out of the C source files, but now I do not know what to do.
typedef enum _FINDEX_INFO_LEVELS {
FindExInfoStandard,
FindExInfoMaxInfoLevel
} FINDEX_INFO_LEVELS;
How to "translate" this into Masm?
FINDEX_INFO_LEVELS
FindExInfoStandard equ 1
FindExInfoBasic equ 2
FindExInfoMaxInfoLevel equ 3
FINDEX_INFO_LEVELS ENDS
I have not test it
But i have read this cpp example
hFind = FindFirstFileEx(argv[1], FindExInfoStandard, &FindFileData,
FindExSearchNameMatch, NULL, 0);
And think this is not declared without a struct
FindExInfoStandard equ 1
FindExInfoBasic equ 2
FindExInfoMaxInfoLevel equ 3
Unless the values are explicit assigned, enumerations start with zero:
FindExInfoStandard equ 0
FindExInfoBasic equ 1
FindExInfoMaxInfoLevel equ 2
Sure qWord?
Ok i have not test it
qWord is right :
P.S.: I love Snipping Tool & MSPAINT :biggrin:
Ok i have build a exe and see it you're right qWord
hFind = FindFirstFileEx(argv[1], FindExInfoStandard, &FindFileData,
FindExSearchNameMatch, NULL, 0);
..
...
push ecx ; lpFindFileData
push 0 ; fInfoLevelId ;<<<<<<<<<<<<<<<
mov edx, [ebp+argv]
mov eax, [edx+4]
push eax ; lpFileName
call ds:__imp__FindFirstFileExA@24
QuoteBy default, the first enumeration-constant is associated with the value 0.
Look here (http://msdn.microsoft.com/en-us/library/whbyts4t.aspx)
FINDEX_INFO_LEVELS enumeration (http://msdn.microsoft.com/en-us/library/windows/desktop/aa364415(v=vs.85).aspx)
Interesting, the enumeration from my 2003 PSDK WinBase.h is different from the current:
typedef enum _FINDEX_INFO_LEVELS {
FindExInfoStandard,
FindExInfoMaxInfoLevel
} FINDEX_INFO_LEVELS;
So the value of FindExInfoMaxInfoLevel has changed, and now it's for validation only. I thought Microsoft generally tries to avoid this.
Quote from: MichaelW on March 21, 2014, 01:32:36 PMow it's for validation only
What do you mean with "validation only"?
I use this to speed up GetFiles (http://www.webalice.it/jj2006/MasmBasicQuickReference.htm#Mb1056):
; perform a dummy search to find out if the OS supports the fast flags:
FindExInfoBasic=1
invoke FindFirstFileEx, chr$("C:\NoFFx.Yet"),
FindExInfoBasic, offset wfd, 0, 0, FIND_FIRST_EX_LARGE_FETCH
invoke GetLastError
.if eax!=ERROR_INVALID_PARAMETER
... set a flag saying it's allowed to use FindExInfoBasic ...
... and of course, now I wonder if it works on XP and Win7 alike 8)
EDIT: I got it...:
Quotetypedef enum _FINDEX_INFO_LEVELS {
FindExInfoStandard,
FindExInfoBasic,
FindExInfoMaxInfoLevel
} FINDEX_INFO_LEVELS;
...
FindExInfoMaxInfoLevel
This value is used for validation. Supported values are less than this value.
Which means that if FindExInfoMaxInfoLevel=1, the enumeration above has only one member, i.e. FindExInfoBasic is not defined. Odd and clumsy, and in the end you'll have to do runtime testing as in my code posted above :(
Thank you!
I do not know anything about enumerations.
Hello, can you say me, what value is FSCTL_SET_REPARSE_POINT ? How to use this constant in my masm code?
http://msdn.microsoft.com/en-us/library/windows/desktop/aa364595(v=vs.85).aspx
ENUM seems to be a MASM reserved word
we just don't know how to use it - lol
Enum (http://www.webalice.it/jj2006/MasmBasicQuickReference.htm#Mb1016) is reserved but not by Masm ;-)
FWIW drizz posted an Enum macro that does the essentials on the old forum:
http://www.masmforum.com/board/index.php?topic=9038.msg65478#msg65478
Enum macro __EnumStart:=<0>,__EnumArgs:vararg
LOCAL i,arg
i = __EnumStart
for arg,<__EnumArgs>
ifnb <arg>
&arg equ i
endif
i = i + 1
endm
endm
;typedef enum _FINDEX_INFO_LEVELS {
; FindExInfoStandard,
; FindExInfoBasic,
; FindExInfoMaxInfoLevel
;} FINDEX_INFO_LEVELS;
include \masm32\include\masm32rt.inc
.data
.code
start:
Enum ,FindExInfoStandard,FindExInfoBasic,FindExInfoMaxInfoLevel
printf("FindExInfoStandard %d\n", FindExInfoStandard)
printf("FindExInfoBasic %d\n", FindExInfoBasic)
printf("FindExInfoMaxInfoLevel %d\n\n", FindExInfoMaxInfoLevel)
inkey
exit
end start
FindExInfoStandard 0
FindExInfoBasic 1
FindExInfoMaxInfoLevel 2
The MasmBasic version is very similar but default start is 10:
EnuCt=10 ; IDOK ... IDHELP=1...9
Enum MACRO args:VARARG
LOCAL arg, is, arg2
for arg, <args>
is INSTR <arg>, <:>
if is
EnuCt=@SubStr(<arg>, 1, is-1)
arg2 SUBSTR <arg>, is+1
arg2=EnuCt
else
arg=EnuCt
endif
EnuCt=EnuCt+1
ENDM
ENDM
Usage:
Enum 0:FindExInfoStandard, FindExInfoBasic, FindExInfoMaxInfoLevel ; force start at 0
Enum IdMenuNew, IdMenuSave, IdMenuCopy, IdTimer ; continued, IdMenuNew=3
Enum 20:IdEdit, IdButton1, 30:IdButton2, IdStatic, IdFind, IdFindStatic