Rename to GetUserNameW since it is Unicode
This commit is contained in:
parent
2ec0c2996f
commit
afab62205a
3 changed files with 6 additions and 6 deletions
|
@ -10,7 +10,7 @@
|
|||
#include <unicode/uchar.h>
|
||||
|
||||
/*
|
||||
GetUserName function
|
||||
GetUserNameW function
|
||||
|
||||
https://msdn.microsoft.com/en-us/library/windows/desktop/ms724432(v=vs.85).aspx
|
||||
|
||||
|
@ -63,7 +63,7 @@
|
|||
If the function fails, the return value is zero. To get extended
|
||||
error information, call GetLastError.
|
||||
*/
|
||||
BOOL GetUserName(WCHAR_T *lpBuffer, LPDWORD lpnSize)
|
||||
BOOL GetUserNameW(WCHAR_T *lpBuffer, LPDWORD lpnSize)
|
||||
{
|
||||
const std::string utf8 = "UTF-8";
|
||||
|
||||
|
|
|
@ -6,6 +6,6 @@ PAL_BEGIN_EXTERNC
|
|||
|
||||
// WCHAR_T * is a Unicode LPTSTR
|
||||
// See https://msdn.microsoft.com/en-us/library/windows/desktop/aa383751(v=vs.85).aspx#LPTSTR
|
||||
BOOL GetUserName(WCHAR_T *lpBuffer, LPDWORD lpnSize);
|
||||
BOOL GetUserNameW(WCHAR_T *lpBuffer, LPDWORD lpnSize);
|
||||
|
||||
PAL_END_EXTERNC
|
||||
|
|
|
@ -24,7 +24,7 @@ protected:
|
|||
lpnSize = size;
|
||||
// allocate a WCHAR_T buffer to receive username
|
||||
lpBuffer.assign(lpnSize, '\0');
|
||||
result = GetUserName(&lpBuffer[0], &lpnSize);
|
||||
result = GetUserNameW(&lpBuffer[0], &lpnSize);
|
||||
}
|
||||
|
||||
void TestSuccess() {
|
||||
|
@ -79,7 +79,7 @@ protected:
|
|||
|
||||
TEST_F(GetUserNameTest, BufferAsNullButNotBufferSize) {
|
||||
lpnSize = 1;
|
||||
result = GetUserName(NULL, &lpnSize);
|
||||
result = GetUserNameW(NULL, &lpnSize);
|
||||
|
||||
TestInvalidParameter();
|
||||
// does not reset lpnSize
|
||||
|
@ -88,7 +88,7 @@ TEST_F(GetUserNameTest, BufferAsNullButNotBufferSize) {
|
|||
|
||||
TEST_F(GetUserNameTest, BufferSizeAsNullButNotBuffer) {
|
||||
lpBuffer.push_back('\0');
|
||||
result = GetUserName(&lpBuffer[0], NULL);
|
||||
result = GetUserNameW(&lpBuffer[0], NULL);
|
||||
|
||||
TestInvalidParameter();
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue