Log in

View Full Version : Translate hex value to win32 flags


lborup
March 2nd, 2009, 08:07
Hi

I am wondering whether anyone knows a convenient way to translate a hex value passed as flags in a win32 api call, into a list of properly named flags. I know they are defined in the corresponding header file, but i don't quite know the correct way to decipher this stuff.
Example: 40h passed as dwFlags in a call to HttpOpenRequest.

Best regards,

Lasse

evaluator
March 2nd, 2009, 09:05
u will see in definition:
SOMTH equ 00000040h

then u can do
test VALUE 00000040h | jne yesThisFlagIs

EdHunter
March 2nd, 2009, 23:58
Hello lborup,

evaluator is right just check your wininet.h defines and you'll see:

#define INTERNET_FLAG_FORMS_SUBMIT 0x00000040 // this is a forms submit

Which indicates that this is a Forms submission.

You should know that it is possible to "or" flags together, for example:

#define INTERNET_FLAG_NO_UI 0x00000200 // no cookie popup
#define INTERNET_FLAG_PRAGMA_NOCACHE 0x00000100 // asking wininet to add

could be passed along together in dwflags as 0x200 | 0x100 = 0x300

Hope it helps.

/ Ed

lborup
March 4th, 2009, 08:53
Thanks. I was just puzzled since the function description at MSDN had a list of possible flags which didn't include the on corresponding to 00000040h...

dELTA
March 4th, 2009, 11:18
IDA Pro can do this for you, simply right-click the constant, and there should be a context menu entry for it (whose exact name I cannot remember at the moment).

lborup
March 7th, 2009, 03:35
Even better... Thanks