Random alphanumeric string generator function (C, Windows, bcrypt.h)
The output is not uniformly distributed
The resulting characters in the output string are not uniformly distributed. In fact, some characters never occur in the output. After shifting a random byte right by two, if the result is larger than or equal to 32, you always clear the second least significant bit. So all values up to 32 are possible, but then it is 32, 33, 36, 37, 40, 41 and so on. And each value &gt;= 32 that your algorithm generates is twice as likely as each value &lt; 32.
The best solution is to first shift the random byte right by two, and then check i it is smaller than 62. If so, use it as it is. Otherwise, generate a new random byte and repeat the process.
Avoid allocating an array of random bytes
You are allocating an array to store the random bytes in. While it might seem efficient to do this, because you assumed you then only need one call to BCryptGenRandom(), this might be an issue if you want to generate large random strings. Also, if you want to have a proper uniformly distributed output, you might need to generate more random bytes than you originally anticipated.
Consider having a small array on the stack that you fill with random bytes, and use those to generate the alphanumeric characters. If you used up all the bytes, you fill the array with a new batch of random bytes.