Note that the original code allocated a 128 character buffer, but I looked up the actual API definition and followed it more precisely. The buffer only needs to be 64 bytes with a 31 character, double null terminated wide string.