FormatMessageW
FreeEnvironmentStringsW
GetACP
+GetComputerNameW
GetConsoleCP
GetConsoleOutputCP
GetCurrentDirectoryW
while (NULL == pPasswd)
{
- pchBuffer = (char*) InternalMalloc(pPalThread, sizeof(pchBuffer[0]) * dwBufLen);
+ pchBuffer = (char*) PAL_malloc(sizeof(pchBuffer[0]) * dwBufLen);
if (NULL == pchBuffer)
{
pPalThread->SetLastError(ERROR_OUTOFMEMORY);
if (ERANGE == iRet) // need a bigger buffer
{
- InternalFree(pPalThread, pchBuffer);
+ PAL_free(pchBuffer);
pchBuffer = NULL;
pPasswd = NULL;
dwBufLen *= 2; // double the buffer
#if HAVE_GETPWUID_R
if (NULL != pchBuffer)
{
- InternalFree(pPalThread, pchBuffer);
+ PAL_free(pchBuffer);
}
#else // HAVE_GETPWUID_R
if (NULL != szUserName)
{
- InternalFree(pPalThread, szUserName);
+ PAL_free(szUserName);
}
#endif // HAVE_GETPWUID_R
*pchDot = '\0'; // remove the domain name info
}
- // clip the hostname to MAX_COMPUTERNAME_LENGTH
- if (sizeof(szHostName) > MAX_COMPUTERNAME_LENGTH)
- {
- szHostName[MAX_COMPUTERNAME_LENGTH] = '\0';
- }
-
// copy the hostname (including NULL character)
cwchLen = MultiByteToWideChar(CP_ACP, 0, szHostName, -1, lpBuffer, *nSize);
if (0 == cwchLen)
add_subdirectory(FormatMessageW)
add_subdirectory(FreeEnvironmentStringsW)
add_subdirectory(GetCommandLineW)
+add_subdirectory(GetComputerNameW)
add_subdirectory(GetEnvironmentStringsW)
add_subdirectory(GetEnvironmentVariableA)
add_subdirectory(GetEnvironmentVariableW)
int __cdecl main(int argc, char *argv[])
{
- WCHAR wzComputerName[MAX_COMPUTERNAME_LENGTH+1];
+ int HOST_NAME_MAX = 255;
+ WCHAR wzComputerName[HOST_NAME_MAX+1];
DWORD dwSize = sizeof(wzComputerName)/sizeof(wzComputerName[0]);
// Initialize the PAL and return FAILURE if this fails
Fail("ERROR: GetComputerName failed with %d!\n", GetLastError());
}
- // dwSize is the length of wzComputerName without NULL
- if (dwSize <= 0 || dwSize > (sizeof(wzComputerName)/sizeof(wzComputerName[0]) - 1))
+ // dwSize is the length of wzComputerName without NULL
+ if (dwSize < 0 || dwSize > (sizeof(wzComputerName)/sizeof(wzComputerName[0]) - 1))
{
Fail("ERROR: GetComputerName returned %S with dwSize = %u whereas the passed in buffer size is %d!\n",
wzComputerName, dwSize, sizeof(wzComputerName)/sizeof(wzComputerName[0]));
miscellaneous/FreeEnvironmentStringsW/test1/paltest_freeenvironmentstringsw_test1
miscellaneous/FreeEnvironmentStringsW/test2/paltest_freeenvironmentstringsw_test2
miscellaneous/GetCommandLineW/test1/paltest_getcommandlinew_test1
+miscellaneous/GetComputerNameW/test1/paltest_getcomputernamew_test1
miscellaneous/GetEnvironmentStringsW/test1/paltest_getenvironmentstringsw_test1
miscellaneous/GetEnvironmentVariableA/test1/paltest_getenvironmentvariablea_test1
miscellaneous/GetEnvironmentVariableA/test2/paltest_getenvironmentvariablea_test2