News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

!rv ?

Started by Don57, February 18, 2013, 05:38:51 PM

Previous topic - Next topic

Don57

I am trying to shorten my code and make it more readable by using rv. Which I understand is short for return value. Somebody on the forum, a while back, sorry I don't remember who gave me help with some code that includes !rv. I am not sure what it stands for, perhaps no return value?

      .IF !rv(CreateProcess,NULL,ADDR sz_LogDumpCommand,0,0,0,CREATE_NO_WINDOW or CREATE_NEW_PROCESS_GROUP,0,0, ADDR sui,ADDR pi)
   
      .ENDIF

I know the rv statement is suppost to be on the same line it doesn't look like it pasted that way.

hutch--

Don,

just have a look in the macros file for masm32, its easy enough to use.

Don57

I have read the entire macro help file, rv is simple enough, I just don't understand the ! operator in front of it. I keep thinking it is a boolean NOT which doesn't make any sense, and I can't find any reference to the operator.

hfheatherfox07

2 words :
qWord territory

qWord style is rv macros , almost every thing ....
Wait for him to post .....  :biggrin:
Your code and your skills will be assimilated. Your programming language is irrelevant.
We are the ASM Borg and you will become part of us. Compile and be assembled.

jj2007

Quote from: Don57 on February 18, 2013, 05:58:10 PMI keep thinking it is a boolean NOT which doesn't make any sense, and I can't find any reference to the operator.

It is, it is:

.IF !rv(CreateProcess....
  MsgBox "you got a fat problem"

dedndave

i'll make it simple for you, Don   :P

"rv" is a macro
besides giving you the return value, it allows things like defining text strings and so on
by "return value", they mean "whatever the function returns in EAX"
have a look at masm32\help\hlhelp.chm
open that file, Macro Catagories, Code Calling Macros (first catagory)
you found that, already   :t

the "!" operator is logical NOT
but, it is not part of the macro name
it is part of the .if/.endif syntax
to understand how it's used.....
    .if rv(.....)
    .endif

in this code, if the return value is non-zero, the code inside the .if/.endif block will be executed

as you know, some API functions return 0 to indicate success, some return 0 to indicate an error
so ".if rv" means "if the return value is non-zero"
".if !rv" means "if the return value is zero"

and, yes......
i don't think anyone uses the rv macro more than qWord   :biggrin:
you can look at his code for many examples

hutch--

The problem appears to be from using a compact form of .IF.

Try using the expanded form.


    .IF rv(whatever) == 0
      do this
    .ENDIF

Don57

Thanks. I've never used macros before. The .IF statement added to the confusion.