News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

MAKELANGID macro error ?

Started by guga, July 17, 2012, 12:04:50 PM

Previous topic - Next topic

guga

I´m mine version of VS2010, i have the following macros:

#define MAKELANGID(p, s)       ((((WORD  )(s)) << 10) | (WORD  )(p))
#define PRIMARYLANGID(lgid)    ((WORD  )(lgid) & 0x3ff)
#define SUBLANGID(lgid)        ((WORD  )(lgid) >> 10)


But, in fact. It seems to me wrong....shouldn´t they be this ?

#define MAKELANGID(p, s)       ((((WORD  )(s)) << 0x10) | (WORD  )(p))
#define PRIMARYLANGID(lgid)    ((WORD  )(lgid) & 0x3ff)
#define SUBLANGID(lgid)        ((WORD  )(lgid) >> 0x10)


Or am i missing something i the C Syntax ?

Btw: How is the syntax for such macro for masm ?

Best Regards,

guga
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com

hutch--

guga,

You usually just plonk the right number in its place. The C macro is to get around the type checking in C.

guga

Hi steve....

Didn´t followed it...What "plonk" means ?

"The C macro is to get around the type checking in C."
Ok....but in C, the value 10 is in hexadecimal notation ? I thought in C what was in hex was followed by "0x" only

Not sure if i understood, because if 10 is really (ten), then the macro seems to produce a wrong result. But if "10" means "sixteen" (hex converted from 0x10) then it works ok, right ? Or i´m still missing something on the syntax ?
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com

hutch--

guga,

Depends what you are doing with it, I answered the question for using an assembler where you simply place (PLONK) the number where you need it. You know how to use either HEX or DECIMAL notation, just place the value you need in the right place when using an assembler. If you are writing this code in C, use the C macro format as it gets around the C type checking.

guga

Hmm...many tks...I think i got it now.

This was somewhat strange for me, since it was producing wrong results (The C macro, i mean). For example, if i wanted to use such a macro in InitMUILanguage function. (or others that uses LANGID data type)

I found this macro because i´m trying to build a h2inc for RosAsm (and probably will be able to export masm syntax too) to make easier build newer equates/structures/guid/functions sets. I know we have at least 2 great tools for such thing in masm, but for rosasm it is lacking such tool. So, if i succeed to make it works correctly, it will build a sort of database that can be used to port either to rosasm or masm or others assemblers as well.
Coding in Assembly requires a mix of:
80% of brain, passion, intuition, creativity
10% of programming skills
10% of alcoholic levels in your blood.

My Code Sites:
http://rosasm.freeforums.org
http://winasm.tripod.com

dedndave

the primary language ID is 10 bits wide - the sublanguage ID is 6 bits wide   :P
i think what Hutch means by "plonk" is - we generally use word values that are already put together
  BLOCK "VarFileInfo"
  BEGIN
    VALUE "Translation", 0x409, 0x4E4
  END

http://msdn.microsoft.com/en-us/library/windows/desktop/dd318691%28v=vs.85%29.aspx
http://msdn.microsoft.com/en-us/library/windows/desktop/dd318693%28v=vs.85%29.aspx

over here, "plonk" is the sound my fishing tackle makes when it hits the water
you know how those Aussie guys are a little different
it comes from being upside down all day     :biggrin:

hutch--

 :biggrin:

Now I know you don't speak English, "plonk" is a sound when you place something in a carefree manner at a location. You fishing tackle hitting the water probably qualifies.  :P

dedndave

 :lol:

i must be thinking of "plunk"   :biggrin:

brethren

Quote from: hutch-- on July 18, 2012, 08:32:36 AM
:biggrin:

Now I know you don't speak English, "plonk" is a sound when you place something in a carefree manner at a location. You fishing tackle hitting the water probably qualifies.  :P

talking about the english language heres a derived term
plonker :badgrin:
1.(UK, slang, mildly pejorative) A fool
2.(UK, slang, dated) A man who sanctions sexual relationships between his girlfriend and his male friends.

btw ignore me, i'm drunk on cheap plonk :biggrin:

hutch--

Ah, the quality of your code drops with cheap plonk. I have just added another bottle of an old favourite, a beautifully dry Speyside pure malt distilled by Rothes distillery called Glen Grant. Not the most expensive but the hallmark of a very good pure malt, ugly bottle, stick on labels, very light colour and dryer than vinegar. I would rather pay for the booze than the bottle.  :P

dedndave

the word Z uses from time to time is "wanker" - lol
similar slang terms are "Happy Larry" or "Happy Wally"
depending on what part of England you are from
those 2 crack me up 

hutch--

Usually "wanker" refers to a person who gives the appearance of suffering from manual self delusion, a "Wally" is basically UK slang that has a similar usage to the term "Yobbo" here in OZ, someone who is dumb, clumsy or acts in bad taste among many other maladies. Then there is the "jerk", occasional loan words like "malaka" (a reference to a lack of masculinity) and a whole host of OZ idiom that is too robust for international consumption.

dedndave

wanker, happy larry, happy wally
my interpretation is they all mean about the same thing - lol
a guy with onanistic habits   :P

npnw

BS What flows in this forum !  :biggrin: