From dfd90b728c3bc26c4e038a3dbd6075ce3f257d2b Mon Sep 17 00:00:00 2001 From: Justin Van Patten Date: Tue, 22 Aug 2017 07:09:08 -0700 Subject: [PATCH] Delete some dead PAL code (#13469) * Delete some dead PAL code GetComputerName and GetUserName are not used. * HAVE_GETPWUID_R can now be deleted --- src/dlls/mscoree/mscorwks_unixexports.src | 1 - src/inc/winwrap.h | 6 - src/pal/inc/pal.h | 25 -- src/pal/src/CMakeLists.txt | 1 - src/pal/src/config.h.in | 1 - src/pal/src/configure.cmake | 1 - src/pal/src/include/pal/identity.hpp | 57 --- src/pal/src/misc/identity.cpp | 410 --------------------- .../tests/palsuite/miscellaneous/CMakeLists.txt | 1 - .../miscellaneous/GetComputerNameW/CMakeLists.txt | 4 - .../GetComputerNameW/test1/CMakeLists.txt | 17 - .../miscellaneous/GetComputerNameW/test1/test.cpp | 53 --- .../GetComputerNameW/test1/testinfo.dat | 13 - .../miscellaneous/GetUserNameW/CMakeLists.txt | 4 - .../GetUserNameW/test1/CMakeLists.txt | 17 - .../miscellaneous/GetUserNameW/test1/test.cpp | 52 --- .../miscellaneous/GetUserNameW/test1/testinfo.dat | 13 - src/pal/tests/palsuite/paltestlist.txt | 1 - .../tests/palsuite/paltestlist_to_be_reviewed.txt | 2 - 19 files changed, 679 deletions(-) delete mode 100644 src/pal/src/include/pal/identity.hpp delete mode 100644 src/pal/src/misc/identity.cpp delete mode 100644 src/pal/tests/palsuite/miscellaneous/GetComputerNameW/CMakeLists.txt delete mode 100644 src/pal/tests/palsuite/miscellaneous/GetComputerNameW/test1/CMakeLists.txt delete mode 100644 src/pal/tests/palsuite/miscellaneous/GetComputerNameW/test1/test.cpp delete mode 100644 src/pal/tests/palsuite/miscellaneous/GetComputerNameW/test1/testinfo.dat delete mode 100644 src/pal/tests/palsuite/miscellaneous/GetUserNameW/CMakeLists.txt delete mode 100644 src/pal/tests/palsuite/miscellaneous/GetUserNameW/test1/CMakeLists.txt delete mode 100644 src/pal/tests/palsuite/miscellaneous/GetUserNameW/test1/test.cpp delete mode 100644 src/pal/tests/palsuite/miscellaneous/GetUserNameW/test1/testinfo.dat diff --git a/src/dlls/mscoree/mscorwks_unixexports.src b/src/dlls/mscoree/mscorwks_unixexports.src index 5ca3119..e9a994c 100644 --- a/src/dlls/mscoree/mscorwks_unixexports.src +++ b/src/dlls/mscoree/mscorwks_unixexports.src @@ -44,7 +44,6 @@ FlushFileBuffers FormatMessageW FreeEnvironmentStringsW GetACP -GetComputerNameW GetConsoleCP GetConsoleOutputCP GetCurrentDirectoryW diff --git a/src/inc/winwrap.h b/src/inc/winwrap.h index 299d163..a67694f 100644 --- a/src/inc/winwrap.h +++ b/src/inc/winwrap.h @@ -206,9 +206,6 @@ #undef CommConfigDialog #undef GetDefaultCommConfig #undef SetDefaultCommConfig -#undef GetComputerName -#undef SetComputerName -#undef GetUserName #undef LogonUser #undef CreateProcessAsUser #undef GetCurrentHwProfile @@ -478,9 +475,6 @@ #define WszCommConfigDialog CommConfigDialogW #define WszGetDefaultCommConfig GetDefaultCommConfigW #define WszSetDefaultCommConfig SetDefaultCommConfigW -#define WszGetComputerName GetComputerNameW -#define WszSetComputerName SetComputerNameW -#define WszGetUserName GetUserNameW #define WszLogonUser LogonUserW #define WszCreateProcessAsUser CreateProcessAsUserW #define WszGetCurrentHwProfile GetCurrentHwProfileW diff --git a/src/pal/inc/pal.h b/src/pal/inc/pal.h index 09ad199..3ae25e4 100644 --- a/src/pal/inc/pal.h +++ b/src/pal/inc/pal.h @@ -1272,31 +1272,6 @@ SetCurrentDirectoryW( #define SetCurrentDirectory SetCurrentDirectoryA #endif -// maximum length of the NETBIOS name (not including NULL) -#define MAX_COMPUTERNAME_LENGTH 15 - -// maximum length of the username (not including NULL) -#define UNLEN 256 - -PALIMPORT -BOOL -PALAPI -GetUserNameW( - OUT LPWSTR lpBuffer, // address of name buffer - IN OUT LPDWORD nSize ); // address of size of name buffer - -PALIMPORT -BOOL -PALAPI -GetComputerNameW( - OUT LPWSTR lpBuffer, // address of name buffer - IN OUT LPDWORD nSize); // address of size of name buffer - -#ifdef UNICODE -#define GetUserName GetUserNameW -#define GetComputerName GetComputerNameW -#endif // UNICODE - PALIMPORT HANDLE PALAPI diff --git a/src/pal/src/CMakeLists.txt b/src/pal/src/CMakeLists.txt index 578b116..1d53a43 100644 --- a/src/pal/src/CMakeLists.txt +++ b/src/pal/src/CMakeLists.txt @@ -175,7 +175,6 @@ set(SOURCES misc/error.cpp misc/errorstrings.cpp misc/fmtmessage.cpp - misc/identity.cpp misc/miscpalapi.cpp misc/msgbox.cpp misc/strutil.cpp diff --git a/src/pal/src/config.h.in b/src/pal/src/config.h.in index 03513a1..664ae59 100644 --- a/src/pal/src/config.h.in +++ b/src/pal/src/config.h.in @@ -25,7 +25,6 @@ #cmakedefine01 HAVE_PTHREAD_NP_H #cmakedefine01 HAVE_KQUEUE -#cmakedefine01 HAVE_GETPWUID_R #cmakedefine01 HAVE_PTHREAD_SUSPEND #cmakedefine01 HAVE_PTHREAD_SUSPEND_NP #cmakedefine01 HAVE_PTHREAD_CONTINUE diff --git a/src/pal/src/configure.cmake b/src/pal/src/configure.cmake index d305081..233cbb1 100644 --- a/src/pal/src/configure.cmake +++ b/src/pal/src/configure.cmake @@ -51,7 +51,6 @@ check_include_files(sys/sysctl.h HAVE_SYS_SYSCTL_H) check_include_files(gnu/lib-names.h HAVE_GNU_LIBNAMES_H) check_function_exists(kqueue HAVE_KQUEUE) -check_function_exists(getpwuid_r HAVE_GETPWUID_R) check_library_exists(c sched_getaffinity "" HAVE_SCHED_GETAFFINITY) check_library_exists(pthread pthread_create "" HAVE_LIBPTHREAD) diff --git a/src/pal/src/include/pal/identity.hpp b/src/pal/src/include/pal/identity.hpp deleted file mode 100644 index bd64a65..0000000 --- a/src/pal/src/include/pal/identity.hpp +++ /dev/null @@ -1,57 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*++ - - - -Module Name: - - include/pal/identity.hpp - -Abstract: - - Header file for identity functions. - - - ---*/ - -#ifndef _PAL_IDENTITY_HPP_ -#define _PAL_IDENTITY_HPP_ - -#include "config.h" -#include "pal/palinternal.h" - -/*++ - -Function: - IdentityInitialize - ---*/ -BOOL IdentityInitialize(); - -/*++ -Function: - IdentityCleanup - ---*/ -VOID IdentityCleanup(); - -#if HAVE_GETPWUID_R -namespace CorUnix -{ - int - InternalGetpwuid_r( - CPalThread *pPalThread, - uid_t uid, - struct passwd *pPasswd, - char *pchBuffer, - size_t nBufSize, - struct passwd **ppResult - ); -} -#endif /* HAVE_GETPWUID_R */ - -#endif /* _PAL_IDENTITY_HPP_ */ diff --git a/src/pal/src/misc/identity.cpp b/src/pal/src/misc/identity.cpp deleted file mode 100644 index e983b12..0000000 --- a/src/pal/src/misc/identity.cpp +++ /dev/null @@ -1,410 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*++ - - - -Module Name: - -misc/identity.cpp - -Abstract: - -Implementation of GetComputerNameW and GetUserNameW functions. - - - ---*/ - -#include "pal/palinternal.h" -#include "pal/dbgmsg.h" -#include "pal/misc.h" -#include "pal/thread.hpp" -#include "pal/identity.hpp" -#include "pal/malloc.hpp" - -#include -#include -#include -#include -#include - -#if HAVE_SYSCONF && defined(_SC_GETPW_R_SIZE_MAX) -#include // for INT_MAX -#endif - -using namespace CorUnix; - -SET_DEFAULT_DEBUG_CHANNEL(MISC); - -#if HAVE_GETPWUID_R - -#define DEFAULT_PASSWORD_BUFFER_SIZE 1024 -static DWORD dwInitialPasswdBufferSize = DEFAULT_PASSWORD_BUFFER_SIZE; - -#else // HAVE_GETPWUID_R - -static CRITICAL_SECTION identity_critsec; - -#endif // HAVE_GETPWUID_R - - -/*++ -Function: - IdentityInitialize - -Intitialization function called from PAL_Initialize. -Initializes the critical section for the case when thread-safe -getpwuid_r is not available. - ---*/ -BOOL -IdentityInitialize(void) -{ -#if HAVE_GETPWUID_R - -#if HAVE_SYSCONF && defined(_SC_GETPW_R_SIZE_MAX) - long lBufferSize = 0; - lBufferSize = sysconf(_SC_GETPW_R_SIZE_MAX); - - if ((long)INT_MAX < lBufferSize) - { - ERROR("sysconf(_SC_GETPW_R_SIZE_MAX) returns %ld which is > INT_MAX (%u)\n", - lBufferSize, INT_MAX); - return FALSE; - } - - if (0 >= (int)(lBufferSize)) - { - WARN("sysconf(_SC_GETPW_R_SIZE_MAX) returns %ld, using %u as the buffer size instead\n", - lBufferSize, dwInitialPasswdBufferSize); - } - else - { - TRACE("sysconf(_SC_GETPW_R_SIZE_MAX) returns %ld\n", lBufferSize); - dwInitialPasswdBufferSize = (DWORD)lBufferSize; - } - -#endif // HAVE_SYSCONF && _SC_GETPW_R_SIZE_MAX - -#else // HAVE_GETPWUID_R - - InternalInitializeCriticalSection(&identity_critsec); - -#endif // HAVE_GETPWUID_R - - return TRUE; -} - - -/*++ -Function: - IdentityCleanup - -Termination function called from PAL_Terminate. -Deletes the critical section for the case when thread-safe -getpwuid_r is not available. - ---*/ -void -IdentityCleanup(void) -{ -#if !HAVE_GETPWUID_R - InternalDeleteCriticalSection(&identity_critsec); -#endif -} - -/*++ -Function: - GetUserNameW - -Uses getpwuid_r to get the user name and if it's not available uses -getpwuid (with the safety of a critical section). See MSDN for functional spec. - ---*/ -PALIMPORT -BOOL -PALAPI -GetUserNameW( - OUT LPWSTR lpBuffer, // address of name buffer - IN OUT LPDWORD nSize ) // address of size of name buffer -{ - BOOL fRet = FALSE; - struct passwd *pPasswd = NULL; - char *szUserName = NULL; - DWORD cwchLen = 0; - int iEuid = -1; - int iRet = -1; - CPalThread *pPalThread = InternalGetCurrentThread(); - -#if HAVE_GETPWUID_R - - char *pchBuffer = NULL; - DWORD dwBufLen = 0; - struct passwd sPasswd; - -#endif // HAVE_GETPWUID_R - - PERF_ENTRY(GetUserNameW); - ENTRY("GetUserNameW(lpBuffer = %p, nSize = %p (%d)\n", - lpBuffer, nSize, nSize?*nSize:0); - - iEuid = geteuid(); - - if (NULL == lpBuffer || NULL == nSize) - { - ERROR("lpBuffer == NULL or nSize == NULL"); - pPalThread->SetLastError(ERROR_INVALID_PARAMETER); - goto done; - } - -#if HAVE_GETPWUID_R - - dwBufLen = dwInitialPasswdBufferSize; - - while (NULL == pPasswd) - { - pchBuffer = (char*) PAL_malloc(sizeof(pchBuffer[0]) * dwBufLen); - if (NULL == pchBuffer) - { - pPalThread->SetLastError(ERROR_OUTOFMEMORY); - goto done; - } - - iRet = InternalGetpwuid_r(pPalThread, iEuid, &sPasswd, pchBuffer, dwBufLen, &pPasswd); - if (0 != iRet) - { - WARN("getpwuid_r(%d) returns %d for a buffer size of %d, error string is %s\n", - iEuid, iRet, dwBufLen, strerror(iRet)); - - if (ERANGE == iRet) // need a bigger buffer - { - PAL_free(pchBuffer); - pchBuffer = NULL; - pPasswd = NULL; - dwBufLen *= 2; // double the buffer - continue; // try again - } - - pPalThread->SetLastError(ERROR_INTERNAL_ERROR); - goto done; - } - - // Unfortunately, HPUX returns success and result = NULL even when the buffer size is small - // (instead of returning ERANGE error). But, since we are using either - // sysconf(_SC_GETPW_R_SIZE_MAX) or the HP recommended value of 1024, buffer should always - // be big enough for getpwuid_r. - - if (NULL == pPasswd || NULL == pPasswd->pw_name) - { - // No matching entry found! something failed somewhere. - ERROR("getpwuid_r(%d) returned %p with name NULL!\n", iEuid, pPasswd); - pPalThread->SetLastError(ERROR_INTERNAL_ERROR); - goto done; - } - } - - szUserName = pPasswd->pw_name; - -#else // HAVE_GETPWUID_R - - InternalEnterCriticalSection(pPalThread, &identity_critsec); - pPasswd = getpwuid(iEuid); - - if ((NULL == pPasswd) || (NULL == pPasswd->pw_name)) - { - InternalLeaveCriticalSection(pPalThread, &identity_critsec); - ERROR("getpwuid(%d) returned %p with name NULL! error (%d) is %s\n", - iEuid, pPasswd, errno, strerror(errno)); - pPalThread->SetLastError(ERROR_INTERNAL_ERROR); - goto done; - } - - // make a copy so that we can modify it - szUserName = strdup(pPasswd->pw_name); - if (NULL == szUserName) - { - InternalLeaveCriticalSection(pPalThread, &identity_critsec); - pPalThread->SetLastError(ERROR_OUTOFMEMORY); - goto done; - } - - InternalLeaveCriticalSection(pPalThread, &identity_critsec); -#endif // HAVE_GETPWUID_R - - // truncate the user name if it exceeds the maximum allowed limit - if (strlen(szUserName) > UNLEN) - { - szUserName[UNLEN] = '\0'; - } - - // Copy from pPasswd->pw_name - cwchLen = MultiByteToWideChar(CP_ACP, 0, szUserName, -1, lpBuffer, *nSize); - if (0 == cwchLen) - { - ERROR ("MultiByteToWideChar failed with error %d when trying to convert the username " - "%s to wide char\n", pPalThread->GetLastError(), szUserName); - if (ERROR_INSUFFICIENT_BUFFER == pPalThread->GetLastError()) - { - // Find the required size (including NULL) - cwchLen = MultiByteToWideChar(CP_ACP, 0, szUserName, -1, NULL, 0); - if (0 == cwchLen) - { - ERROR ("MultiByteToWideChar failed with error %d when trying to find the size of " - "%s in wide chars\n", pPalThread->GetLastError(), szUserName); - pPalThread->SetLastError(ERROR_INTERNAL_ERROR); - } - else - { - // Update the required size - *nSize = cwchLen; - pPalThread->SetLastError(ERROR_MORE_DATA); - } - } - goto done; - } - - *nSize = cwchLen; - fRet = TRUE; - -done: -#if HAVE_GETPWUID_R - if (NULL != pchBuffer) - { - PAL_free(pchBuffer); - } -#else // HAVE_GETPWUID_R - if (NULL != szUserName) - { - PAL_free(szUserName); - } -#endif // HAVE_GETPWUID_R - - LOGEXIT("GetUserNameW returning BOOL %d\n", fRet); - PERF_EXIT(GetUserNameW); - return fRet; -} - -#ifndef MAXHOSTNAMELEN -// AIX doesn't have MAXHOSTNAMELEN, it recommends using 256 -#define MAXHOSTNAMELEN 256 -#endif // MAXHOSTNAMELEN - -/*++ -Function: - GetComputerNameW - -Uses gethostname to get the computer name. See MSDN for functional spec. - ---*/ -PALIMPORT -BOOL -PALAPI -GetComputerNameW( - OUT LPWSTR lpBuffer, // address of name buffer - IN OUT LPDWORD nSize) // address of size of name buffer -{ - BOOL fRet = FALSE; - char szHostName[MAXHOSTNAMELEN+1]; - char *pchDot = NULL; - DWORD cwchLen = 0; - CPalThread *pPalThread = InternalGetCurrentThread(); - - PERF_ENTRY(GetComputerNameW); - ENTRY("GetComputerNameW(lpBuffer = %p, nSize = %p (%d)\n", - lpBuffer, nSize, nSize?*nSize:0); - - if (NULL == lpBuffer || NULL == nSize) - { - ERROR("lpBuffer == NULL or nSize == NULL"); - pPalThread->SetLastError(ERROR_INVALID_PARAMETER); - goto done; - } - - if (0 != gethostname(szHostName, sizeof(szHostName)/sizeof(szHostName[0]))) - { - ERROR("gethostname failed with error (%d) %s\n", errno, strerror(errno)); - pPalThread->SetLastError(ERROR_INTERNAL_ERROR); - goto done; - } - - // Null terminate the string - szHostName[sizeof(szHostName)/sizeof(szHostName[0])-1] = '\0'; - - // some OSes return the hostname with the domain name included. - // We want to return only the host part of the name (see the spec for - // more details - pchDot = strchr(szHostName, '.'); - if (NULL != pchDot) - { - *pchDot = '\0'; // remove the domain name info - } - - // copy the hostname (including NULL character) - cwchLen = MultiByteToWideChar(CP_ACP, 0, szHostName, -1, lpBuffer, *nSize); - if (0 == cwchLen) - { - ERROR ("MultiByteToWideChar failed with error %d when trying to convert the hostname " - "%s to wide char\n", pPalThread->GetLastError(), szHostName); - if (ERROR_INSUFFICIENT_BUFFER == pPalThread->GetLastError()) - { - // Find the required size (including NULL) - cwchLen = MultiByteToWideChar(CP_ACP, 0, szHostName, -1, NULL, 0); - if (0 == cwchLen) - { - ERROR ("MultiByteToWideChar failed with error %d when trying to find the size of " - "%s in wide chars\n", pPalThread->GetLastError(), szHostName); - pPalThread->SetLastError(ERROR_INTERNAL_ERROR); - } - else - { - // Update the required size - *nSize = cwchLen - 1; // don't include the NULL - pPalThread->SetLastError(ERROR_BUFFER_OVERFLOW); - } - } - goto done; - } - - *nSize = cwchLen - 1; // don't include the NULL - fRet = TRUE; - -done: - LOGEXIT("GetComputerNameW returning BOOL %d\n", fRet); - PERF_EXIT(GetComputerNameW); - return fRet; -} - -#if HAVE_GETPWUID_R -/*++ -Function: - InternalGetpwuid_r - -Suspension safe wrapper for getpwuid_r ---*/ -int -CorUnix::InternalGetpwuid_r( - CPalThread *pPalThread, - uid_t uid, - struct passwd *pPasswd, - char *pchBuffer, - size_t nBufSize, - struct passwd **ppResult - ) -{ - int iError = 0; - - iError = getpwuid_r(uid, pPasswd, pchBuffer, nBufSize, ppResult); - -#if GETPWUID_R_SETS_ERRNO - if (0 != iError) - { - iError = errno; // some systems (AIX) sets errno instead of returning error - } -#endif // GETPWUID_R_SETS_ERRNO - - return iError; -} -#endif // HAVE_GETPWUID_R diff --git a/src/pal/tests/palsuite/miscellaneous/CMakeLists.txt b/src/pal/tests/palsuite/miscellaneous/CMakeLists.txt index 9352ede..d437fc9 100644 --- a/src/pal/tests/palsuite/miscellaneous/CMakeLists.txt +++ b/src/pal/tests/palsuite/miscellaneous/CMakeLists.txt @@ -9,7 +9,6 @@ add_subdirectory(FlushInstructionCache) add_subdirectory(FormatMessageW) add_subdirectory(FreeEnvironmentStringsW) add_subdirectory(GetCommandLineW) -add_subdirectory(GetComputerNameW) add_subdirectory(GetEnvironmentStringsW) add_subdirectory(GetEnvironmentVariableA) add_subdirectory(GetEnvironmentVariableW) diff --git a/src/pal/tests/palsuite/miscellaneous/GetComputerNameW/CMakeLists.txt b/src/pal/tests/palsuite/miscellaneous/GetComputerNameW/CMakeLists.txt deleted file mode 100644 index f6aa0cb..0000000 --- a/src/pal/tests/palsuite/miscellaneous/GetComputerNameW/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -add_subdirectory(test1) - diff --git a/src/pal/tests/palsuite/miscellaneous/GetComputerNameW/test1/CMakeLists.txt b/src/pal/tests/palsuite/miscellaneous/GetComputerNameW/test1/CMakeLists.txt deleted file mode 100644 index fe5b720..0000000 --- a/src/pal/tests/palsuite/miscellaneous/GetComputerNameW/test1/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test.cpp -) - -add_executable(paltest_getcomputernamew_test1 - ${SOURCES} -) - -add_dependencies(paltest_getcomputernamew_test1 coreclrpal) - -target_link_libraries(paltest_getcomputernamew_test1 - ${COMMON_TEST_LIBRARIES} -) diff --git a/src/pal/tests/palsuite/miscellaneous/GetComputerNameW/test1/test.cpp b/src/pal/tests/palsuite/miscellaneous/GetComputerNameW/test1/test.cpp deleted file mode 100644 index 7a00cad..0000000 --- a/src/pal/tests/palsuite/miscellaneous/GetComputerNameW/test1/test.cpp +++ /dev/null @@ -1,53 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*============================================================ -** -** Source : test.c -** -** Purpose: Positive Test for GetComputerName() function -** -** -**=========================================================*/ - -#define UNICODE -#include - -int __cdecl main(int argc, char *argv[]) -{ - - 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 - if(0 != (PAL_Initialize(argc, argv))) - { - Fail ("ERROR: PAL_Initialize() call failed!\n"); - } - - if (0 == GetComputerName(wzComputerName, &dwSize)) - { - 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)) - { - Fail("ERROR: GetComputerName returned %S with dwSize = %u whereas the passed in buffer size is %d!\n", - wzComputerName, dwSize, sizeof(wzComputerName)/sizeof(wzComputerName[0])); - } - - // dwSize is the length of wzComputerName without NULL - if (dwSize != wcslen(wzComputerName)) - { - Fail("ERROR: GetComputerName returned %S of length %d which is not equal to dwSize = %u!\n", - wzComputerName, wcslen(wzComputerName), dwSize); - } - - printf ("GetComputerName returned %S of length %u\n", wzComputerName, dwSize); - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/miscellaneous/GetComputerNameW/test1/testinfo.dat b/src/pal/tests/palsuite/miscellaneous/GetComputerNameW/test1/testinfo.dat deleted file mode 100644 index d45bca1..0000000 --- a/src/pal/tests/palsuite/miscellaneous/GetComputerNameW/test1/testinfo.dat +++ /dev/null @@ -1,13 +0,0 @@ -# Licensed to the .NET Foundation under one or more agreements. -# The .NET Foundation licenses this file to you under the MIT license. -# See the LICENSE file in the project root for more information. - -Version = 1.0 -Section = Miscellaneous -Function = GetComputerNameW -Name = Test for GetComputerNameW -TYPE = DEFAULT -EXE1 = test -Description -= Check to ensure that GetComputerNameW returnes a decent value. - diff --git a/src/pal/tests/palsuite/miscellaneous/GetUserNameW/CMakeLists.txt b/src/pal/tests/palsuite/miscellaneous/GetUserNameW/CMakeLists.txt deleted file mode 100644 index f6aa0cb..0000000 --- a/src/pal/tests/palsuite/miscellaneous/GetUserNameW/CMakeLists.txt +++ /dev/null @@ -1,4 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -add_subdirectory(test1) - diff --git a/src/pal/tests/palsuite/miscellaneous/GetUserNameW/test1/CMakeLists.txt b/src/pal/tests/palsuite/miscellaneous/GetUserNameW/test1/CMakeLists.txt deleted file mode 100644 index 6527b83..0000000 --- a/src/pal/tests/palsuite/miscellaneous/GetUserNameW/test1/CMakeLists.txt +++ /dev/null @@ -1,17 +0,0 @@ -cmake_minimum_required(VERSION 2.8.12.2) - -set(CMAKE_INCLUDE_CURRENT_DIR ON) - -set(SOURCES - test.cpp -) - -add_executable(paltest_getusernamew_test1 - ${SOURCES} -) - -add_dependencies(paltest_getusernamew_test1 coreclrpal) - -target_link_libraries(paltest_getusernamew_test1 - ${COMMON_TEST_LIBRARIES} -) diff --git a/src/pal/tests/palsuite/miscellaneous/GetUserNameW/test1/test.cpp b/src/pal/tests/palsuite/miscellaneous/GetUserNameW/test1/test.cpp deleted file mode 100644 index 809f14c..0000000 --- a/src/pal/tests/palsuite/miscellaneous/GetUserNameW/test1/test.cpp +++ /dev/null @@ -1,52 +0,0 @@ -// Licensed to the .NET Foundation under one or more agreements. -// The .NET Foundation licenses this file to you under the MIT license. -// See the LICENSE file in the project root for more information. - -/*============================================================ -** -** Source : test.c -** -** Purpose: Positive Test for GetUserName() function -** -** -**=========================================================*/ - -#define UNICODE -#include - -int __cdecl main(int argc, char *argv[]) -{ - - WCHAR wzUserName[UNLEN+1]; - DWORD dwSize = sizeof(wzUserName)/sizeof(wzUserName[0]); - - // Initialize the PAL and return FAILURE if this fails - if(0 != (PAL_Initialize(argc, argv))) - { - Fail ("ERROR: PAL_Initialize() call failed!\n"); - } - - if (0 == GetUserName(wzUserName, &dwSize)) - { - Fail("ERROR: GetUserName failed with %d!\n", GetLastError()); - } - - // dwSize is the length of wzUserName with NULL - if (dwSize <= 0 || dwSize > (sizeof(wzUserName)/sizeof(wzUserName[0]))) - { - Fail("ERROR: GetUserName returned %S with dwSize = %u whereas the passed in buffer size is %d!\n", - wzUserName, dwSize, sizeof(wzUserName)/sizeof(wzUserName[0])); - } - - // dwSize is the length of wzUserName with NULL - if (dwSize != wcslen(wzUserName)+1) - { - Fail("ERROR: GetUserName returned %S of length %d which is not equal to dwSize-1 = %u!\n", - wzUserName, wcslen(wzUserName), dwSize-1); - } - - printf ("GetUserName returned %S of length %u\n", wzUserName, dwSize-1); - - PAL_Terminate(); - return PASS; -} diff --git a/src/pal/tests/palsuite/miscellaneous/GetUserNameW/test1/testinfo.dat b/src/pal/tests/palsuite/miscellaneous/GetUserNameW/test1/testinfo.dat deleted file mode 100644 index 3e0aa48..0000000 --- a/src/pal/tests/palsuite/miscellaneous/GetUserNameW/test1/testinfo.dat +++ /dev/null @@ -1,13 +0,0 @@ -# Licensed to the .NET Foundation under one or more agreements. -# The .NET Foundation licenses this file to you under the MIT license. -# See the LICENSE file in the project root for more information. - -Version = 1.0 -Section = Miscellaneous -Function = GetUserNameW -Name = Test for GetUserNameW -TYPE = DEFAULT -EXE1 = test -Description -= Check to ensure that GetUserNameW returnes a decent value. - diff --git a/src/pal/tests/palsuite/paltestlist.txt b/src/pal/tests/palsuite/paltestlist.txt index 1e580cd..0c8892a 100644 --- a/src/pal/tests/palsuite/paltestlist.txt +++ b/src/pal/tests/palsuite/paltestlist.txt @@ -653,7 +653,6 @@ miscellaneous/FormatMessageW/test3/paltest_formatmessagew_test3 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 diff --git a/src/pal/tests/palsuite/paltestlist_to_be_reviewed.txt b/src/pal/tests/palsuite/paltestlist_to_be_reviewed.txt index 3f9469d..4dac7e9 100644 --- a/src/pal/tests/palsuite/paltestlist_to_be_reviewed.txt +++ b/src/pal/tests/palsuite/paltestlist_to_be_reviewed.txt @@ -139,11 +139,9 @@ miscellaneous/FormatMessageW/test5/paltest_formatmessagew_test5 miscellaneous/FormatMessageW/test6/paltest_formatmessagew_test6 miscellaneous/GetCalendarInfoW/test1/paltest_getcalendarinfow_test1 miscellaneous/GetCalendarInfoW/test2/paltest_getcalendarinfow_test2 -miscellaneous/GetComputerNameW/test1/paltest_getcomputernamew_test1 miscellaneous/GetDateFormatW/GetDateFormatW_neg1/paltest_getdateformatw_getdateformatw_neg1 miscellaneous/GetDateFormatW/GetDateFormatW_neg2/paltest_getdateformatw_getdateformatw_neg2 miscellaneous/GetDateFormatW/test1/paltest_getdateformatw_test1 -miscellaneous/GetUserNameW/test1/paltest_getusernamew_test1 miscellaneous/InterLockedExchangeAdd/test1/paltest_interlockedexchangeadd_test1 miscellaneous/IsBadCodePtr/test1/paltest_isbadcodeptr_test1 miscellaneous/IsBadReadPtr/test1/paltest_isbadreadptr_test1 -- 2.7.4