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...
Posted on 2003-05-16 00:14:44 by Bubu-Boy
fnktion? wha?? :confused:
Posted on 2003-05-16 00:23:18 by iblis

fnktion? wha?? :confused:

He meant to say function I think.

What about

| textequ or

Posted on 2003-05-16 01:16:05 by roticv
That still doesn't help me make sense of the rest of it. ;)
Posted on 2003-05-16 01:58:44 by iblis
I suppose he just want to use | instead of or in his code. Too much of HLL maybe :)
Posted on 2003-05-16 02:24:10 by roticv
I'm more referring to the "ACTIO_1 or ACTION_2 attributes" part.
Posted on 2003-05-16 02:36:57 by iblis
Hi, when you use the CeateFileFunktion, you can use "CREATE_NEW or OPEN_EXISTING" to values in one value.
Posted on 2003-05-16 06:00:00 by Bubu-Boy
Are you drunk?
Posted on 2003-05-17 13:30:37 by Sephiroth3
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.
Posted on 2003-05-17 13:51:41 by comrade
Moved to Heap.

Someone please recommend a spell checker to Bubu-Boy.
Posted on 2003-05-17 14:11:27 by bazik
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!
Posted on 2003-05-17 14:19:57 by Bubu-Boy

What you dont understand?

It seems you dont understand what "or" does and what the parameters of CreateFile stand for.
Posted on 2003-05-17 14:28:32 by bazik
create file was just an example.
keep cool bazik
Posted on 2003-05-17 14:35:54 by Bubu-Boy
Hi BuBu boy

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
;code to deal with ACTIO_2
;Default action if neither was True
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.
Posted on 2003-05-17 14:44:32 by donkey
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.
Posted on 2003-05-18 04:43:50 by Bubu-Boy
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
; option 1 alone
; option 2 alone
; not option 1 or option 2

"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 :)
Posted on 2003-05-18 05:34:00 by donkey
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

szCapt db "Flags",0
szTxtFoo db "Foo flag set",0
szTxtBar db "Bar flag set",0

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

invoke ProcessFlags, FLAG_FOO
invoke ProcessFlags, FLAG_BAR
invoke ProcessFlags, FLAG_FOOBAR
invoke ExitProcess, 0
end start[/size]
Posted on 2003-05-18 06:42:51 by iblis