The Old New Thing

How do I get the current value of the RSP register from a C/C++ function? (No answer, but a solution.)

A customer using Visual Studio wanted to know how to obtain the current value of the x64 RSP register from a C/C++ function. They noted that on the x86, you can drop to inline assembly, and on the ia64, you can use the intrinsic to retrieve the value of any register. There is no corresponding intrinsic on x64. There's no really good way of...