Hi, I would like to make a fnktion wich can accept attribudes like ACTIO_1 or ACTION_2.
Another question: why it isnt't posssible to replace the 'or' witch '|'
WEll done...
Another question: why it isnt't posssible to replace the 'or' witch '|'
WEll done...
fnktion? wha?? :confused:
fnktion? wha?? :confused:
He meant to say function I think.
What about
| textequ or
?
That still doesn't help me make sense of the rest of it. ;)
I suppose he just want to use | instead of or in his code. Too much of HLL maybe :)
I'm more referring to the "ACTIO_1 or ACTION_2 attributes" part.
Hi, when you use the CeateFileFunktion, you can use "CREATE_NEW or OPEN_EXISTING" to values in one value.
Are you drunk?
OR and | part is understood. But first part, I think he meant how do you make a procedure that can distinguish bit flags? Use test.
Moved to Heap.
Someone please recommend a spell checker to Bubu-Boy.
Someone please recommend a spell checker to Bubu-Boy.
What you dont understand?
I want to get several options in one parameter.
Like the CreateFile-funktion:
CreateFile, ....,CREATE_NEW or OPEN_EXISTING, ....
@Sephiroth3 :______ :stupid:
For drunken people again!
And again: "CREATE_NEW or OPEN_EXISTING" two option in one parameter!
I want to get several options in one parameter.
Like the CreateFile-funktion:
CreateFile, ....,CREATE_NEW or OPEN_EXISTING, ....
@Sephiroth3 :______ :stupid:
For drunken people again!
And again: "CREATE_NEW or OPEN_EXISTING" two option in one parameter!
What you dont understand?
It seems you dont understand what "or" does and what the parameters of CreateFile stand for.
create file was just an example.
keep cool bazik
keep cool bazik
Hi BuBu boy
To make a function which can accept parameters use the proc statement e.g.
To make a function which can accept parameters use the proc statement e.g.
MyFunction proc ACTION:DWORD
; When your procedure starts verify which of the flags it is:
mov eax,ACTION
.IF eax == ACTIO_1
;code to deal with ACTIO_1
.ELSEIF eax==ACTIO_2
;code to deal with ACTIO_2
.ELSE
;Default action if neither was True
.EndIF
ret
MyFunction endp
OR and | are two distinct operators. the OR is a compile time operator and | is a runtime operator. They are not interchangeable. For example if you use WS_VISIBLE OR WS_CHILD, the assembler will merge these values into a single DWORD when it compiles the program. But if you use the "pipe" | you are telling the assembler that the two valuse are unknown at compile time and to use two DWORDs. That is why the cannot be interchanged.hmm. it would ot be possible to check whethet EAX == ACTIO_1 || ACTIO_2, or ?
I didn't understand the "merge these values into a single DWORD"-thing not realy.
I didn't understand the "merge these values into a single DWORD"-thing not realy.
Yes Bubu boy,
You can check any valid bolean expression in the .IF/.ENDIF statement so you can do that. The order that you process the flags is important otherwise you end up with a big mess. Begin with both flags together then each flag alone and finally the default action if no option is supplied. e.g.
.IF eax == OPTION1 || OPTION2
; both together
.ELSEIF eax==OPTION1
; option 1 alone
.ELSEIF eax==OPTION2
; option 2 alone
.ELSE
; not option 1 or option 2
.ENDIF
"merge these values into a single DWORD" means if you have in your command WS_VISIBLE OR WS_CHILD, that line has two values but inside your executable the assembler will put them together into one DWORD value.
Hope that helps :)
You can check any valid bolean expression in the .IF/.ENDIF statement so you can do that. The order that you process the flags is important otherwise you end up with a big mess. Begin with both flags together then each flag alone and finally the default action if no option is supplied. e.g.
.IF eax == OPTION1 || OPTION2
; both together
.ELSEIF eax==OPTION1
; option 1 alone
.ELSEIF eax==OPTION2
; option 2 alone
.ELSE
; not option 1 or option 2
.ENDIF
"merge these values into a single DWORD" means if you have in your command WS_VISIBLE OR WS_CHILD, that line has two values but inside your executable the assembler will put them together into one DWORD value.
Hope that helps :)
Maybe he's looking for something like:
[size=12] .386
.model flat, stdcall
option casemap:none
include windows.inc
FLAG_FOO equ 0001b
FLAG_BAR equ 0010b
FLAG_FOOBAR equ 0011b
.data
szCapt db "Flags",0
szTxtFoo db "Foo flag set",0
szTxtBar db "Bar flag set",0
.code
ProcessFlags proc dwFlag:DWORD
mov eax, dwFlag
test eax, FLAG_FOO
jz @f
[color=#A0A0A0]; process FOO[/color]
invoke MessageBox, 0, addr szTxtFoo, addr szCapt, MB_OK
@@: test eax, FLAG_BAR
jz @f
[color=#A0A0A0]; process BAR[/color]
invoke MessageBox, 0, addr szTxtBar, addr szCapt, MB_OK
@@: ret
ProcessFlags endp
start:
invoke ProcessFlags, FLAG_FOO
invoke ProcessFlags, FLAG_BAR
invoke ProcessFlags, FLAG_FOOBAR
invoke ExitProcess, 0
end start[/size]