Thanks for the reply!
I would like to make a few comments regarding your version of
1. You call InterlockedExchange64 with
a_pi64Value as the first parameter, so the
__int64 variable pointed by
0. Then, you return the previous value of that
__int64 variable which is certainly not the one we are interested in,
GetValue returns a
LONGLONG value, so we find ourselves in exactly the same situation from Question 2 (concerning the EAX and EDX registers)...