64 bit SendMessage API

According to MSDN

The return value indicates the result of processing messages; it depends on the message sent.

I know that it is defined as

typedef LONG_PTR LRESULT;

      

The value will be 8 bytes on a 64-bit machine, but it is not!

Does anyone know if it can be assumed that only the lower 4 bytes are used and store it as INT

(for example).

0


source to share


3 answers


No, this is not safe because the return value is determined by the message sent and the handler.

If you control the handler and the message then it will be possible, it is generally unsafe.



James

+4


source


No, it is not safe at all. Don't accept a demotion. Also, it's helpful to compile your code with / RTCc, which ensures that unintended pushes are asserted at runtime.



+1


source


Definitely unsafe. If the return message is indeed a pointer, it is quite possible that the pointer will have its 33rd bit, especially on machines with> 4GB memory.

+1


source







All Articles