GET_MESSAGE_PTR

GET_MESSAGE_PTR MsgIdentifier, Reg
 

Returns the address of the given message. The macro carries out no other processing.

The return value is the message address in the given register.

MsgIdentifier
Message identifier of the message to retrieve.
Reg
Name of register that receives the message address.

A register name can also be given for the MsgIdentifier parameter. If a register name is given, the register value is checked at runtime to determine which table to look in for the message. Because this requires additional code to support, this register-based version of the macro should be avoided.

The overhead of the register-based version can be avoided by an alternate form of the GET_MESSAGE_PTR macro:

Get_Message_Ptr MsgIdentifier, Reg1, Reg2

This alternative form places into Reg1 a pointer to the message string whose identifier is MsgIdentifier + Reg2. No range checking is performed; the value MsgIdentifier + Reg2 must be of the same message type as MsgIdentifier. For example, if you have a series of three messages, declared contiguously:

VxD_MESSAGE_SEG
DECLARE_MESSAGE MsgFirst, <"First message">
DECLARE_MESSAGE MsgSecond, <"Second Message">
DECLARE_MESSAGE MsgThird, <"Third message">
VxD_MESSAGE_ENDS

then the line:

GET_MESSAGE_PTR MsgFirst, eax, esi

would load into the EAX register a pointer to MsgFirst, if ESI = 0, a pointer to MsgSecond if ESI = 1, and a pointer to MsgThird if ESI = 2. Any other value for ESI is an error and will load garbage or possibly even page fault.