explicitly use GetUserNameA
#include <algorithm> for std::min
#include <assert.h>
add copyright for 2014