Fix startup performance re VirtualProtect and VirtualQuery.

Signed-off-by: David Wohlferd <dw@LimeGreenSocks.com>
Do the minimum to prevent buffer overflows

vsprintf_s now less vulnerable to buffer overflows, but still not
spec compliant, like not making changes to the buffer if there are
errors or invoking the user error handler.
Fix incorrect #if that caused problems with lrint and friends.

Signed-off-by: David Wohlferd <dw@LimeGreenSocks.com>