Skip to content

Commit

Permalink
Delete unused multibyte methods from PAL (#42157)
Browse files Browse the repository at this point in the history
  • Loading branch information
am11 committed Sep 13, 2020
1 parent 97a841b commit c867337
Show file tree
Hide file tree
Showing 78 changed files with 356 additions and 3,826 deletions.
16 changes: 16 additions & 0 deletions src/coreclr/src/ToolBox/superpmi/superpmi/parallelsuperpmi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,18 @@ bool StartProcess(char* commandLine, HANDLE hStdOutput, HANDLE hStdError, HANDLE

ZeroMemory(&pi, sizeof(pi));

#if TARGET_UNIX
const unsigned cmdLen = (unsigned)strlen(commandLine) + 1;
WCHAR* cmdLineW = new WCHAR[cmdLen];
MultiByteToWideChar(CP_UTF8, 0, commandLine, cmdLen, cmdLineW, cmdLen);
#endif
// Start the child process.
if (!CreateProcess(NULL, // No module name (use command line)
#if TARGET_UNIX
cmdLineW, // Command line
#else
commandLine, // Command line
#endif
NULL, // Process handle not inheritable
NULL, // Thread handle not inheritable
TRUE, // Set handle inheritance to TRUE (required to use STARTF_USESTDHANDLES)
Expand All @@ -45,10 +54,17 @@ bool StartProcess(char* commandLine, HANDLE hStdOutput, HANDLE hStdError, HANDLE
{
LogError("CreateProcess failed (%d). CommandLine: %s", GetLastError(), commandLine);
*hProcess = INVALID_HANDLE_VALUE;
#if TARGET_UNIX
delete[] cmdLineW;
#endif
return false;
}

*hProcess = pi.hProcess;

#if TARGET_UNIX
delete[] cmdLineW;
#endif
return true;
}

Expand Down
1 change: 0 additions & 1 deletion src/coreclr/src/dlls/mscordac/mscordac_unixexports.src
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ nativeStringResourceTable_mscorrc
#sscanf_s

#CopyFileW
#CreateFileMappingA
#CreateFileMappingW
#CreateFileA
#CreateFileW
Expand Down
62 changes: 2 additions & 60 deletions src/coreclr/src/pal/inc/pal.h
Original file line number Diff line number Diff line change
Expand Up @@ -498,11 +498,8 @@ PALAPI
PAL_GetPALDirectoryW(
OUT LPWSTR lpDirectoryName,
IN OUT UINT* cchDirectoryName);
#ifdef UNICODE

#define PAL_GetPALDirectory PAL_GetPALDirectoryW
#else
#define PAL_GetPALDirectory PAL_GetPALDirectoryA
#endif

PALIMPORT
VOID
Expand Down Expand Up @@ -711,13 +708,8 @@ SearchPathW(
OUT LPWSTR lpBuffer,
OUT LPWSTR *lpFilePart
);
#ifdef UNICODE
#define SearchPath SearchPathW
#else
#define SearchPath SearchPathA
#endif // !UNICODE


#define SearchPath SearchPathW

PALIMPORT
BOOL
Expand All @@ -733,7 +725,6 @@ CopyFileW(
#define CopyFile CopyFileA
#endif


PALIMPORT
BOOL
PALAPI
Expand All @@ -746,12 +737,9 @@ DeleteFileW(
#define DeleteFile DeleteFileA
#endif



#define MOVEFILE_REPLACE_EXISTING 0x00000001
#define MOVEFILE_COPY_ALLOWED 0x00000002


PALIMPORT
BOOL
PALAPI
Expand Down Expand Up @@ -1252,34 +1240,8 @@ typedef struct _STARTUPINFOW {
HANDLE hStdError;
} STARTUPINFOW, *LPSTARTUPINFOW;

typedef struct _STARTUPINFOA {
DWORD cb;
LPSTR lpReserved_PAL_Undefined;
LPSTR lpDesktop_PAL_Undefined;
LPSTR lpTitle_PAL_Undefined;
DWORD dwX_PAL_Undefined;
DWORD dwY_PAL_Undefined;
DWORD dwXSize_PAL_Undefined;
DWORD dwYSize_PAL_Undefined;
DWORD dwXCountChars_PAL_Undefined;
DWORD dwYCountChars_PAL_Undefined;
DWORD dwFillAttribute_PAL_Undefined;
DWORD dwFlags;
WORD wShowWindow_PAL_Undefined;
WORD cbReserved2_PAL_Undefined;
LPBYTE lpReserved2_PAL_Undefined;
HANDLE hStdInput;
HANDLE hStdOutput;
HANDLE hStdError;
} STARTUPINFOA, *LPSTARTUPINFOA;

#ifdef UNICODE
typedef STARTUPINFOW STARTUPINFO;
typedef LPSTARTUPINFOW LPSTARTUPINFO;
#else
typedef STARTUPINFOA STARTUPINFO;
typedef LPSTARTUPINFOW LPSTARTUPINFO;
#endif

#define CREATE_NEW_CONSOLE 0x00000010

Expand Down Expand Up @@ -1307,11 +1269,7 @@ CreateProcessW(
IN LPSTARTUPINFOW lpStartupInfo,
OUT LPPROCESS_INFORMATION lpProcessInformation);

#ifdef UNICODE
#define CreateProcess CreateProcessW
#else
#define CreateProcess CreateProcessA
#endif

PALIMPORT
PAL_NORETURN
Expand Down Expand Up @@ -2442,11 +2400,7 @@ CreateFileMappingW(
IN DWORD dwMaximumSizeLow,
IN LPCWSTR lpName);

#ifdef UNICODE
#define CreateFileMapping CreateFileMappingW
#else
#define CreateFileMapping CreateFileMappingA
#endif

#define SECTION_QUERY 0x0001
#define SECTION_MAP_WRITE 0x0002
Expand All @@ -2466,11 +2420,7 @@ OpenFileMappingW(
IN BOOL bInheritHandle,
IN LPCWSTR lpName);

#ifdef UNICODE
#define OpenFileMapping OpenFileMappingW
#else
#define OpenFileMapping OpenFileMappingA
#endif

typedef INT_PTR (PALAPI_NOEXPORT *FARPROC)();

Expand Down Expand Up @@ -2970,23 +2920,15 @@ LPWSTR
PALAPI
GetEnvironmentStringsW();

#ifdef UNICODE
#define GetEnvironmentStrings GetEnvironmentStringsW
#else
#define GetEnvironmentStrings GetEnvironmentStringsA
#endif

PALIMPORT
BOOL
PALAPI
FreeEnvironmentStringsW(
IN LPWSTR);

#ifdef UNICODE
#define FreeEnvironmentStrings FreeEnvironmentStringsW
#else
#define FreeEnvironmentStrings FreeEnvironmentStringsA
#endif

PALIMPORT
BOOL
Expand Down
59 changes: 0 additions & 59 deletions src/coreclr/src/pal/inc/palprivate.h
Original file line number Diff line number Diff line change
Expand Up @@ -153,40 +153,6 @@ OpenMutexA(
IN BOOL bInheritHandle,
IN LPCSTR lpName);

PALIMPORT
BOOL
PALAPI
CreateProcessA(
IN LPCSTR lpApplicationName,
IN LPSTR lpCommandLine,
IN LPSECURITY_ATTRIBUTES lpProcessAttributes,
IN LPSECURITY_ATTRIBUTES lpThreadAttributes,
IN BOOL bInheritHandles,
IN DWORD dwCreationFlags,
IN LPVOID lpEnvironment,
IN LPCSTR lpCurrentDirectory,
IN LPSTARTUPINFOA lpStartupInfo,
OUT LPPROCESS_INFORMATION lpProcessInformation);

PALIMPORT
HANDLE
PALAPI
CreateFileMappingA(
IN HANDLE hFile,
IN LPSECURITY_ATTRIBUTES lpFileMappingAttributes,
IN DWORD flProtect,
IN DWORD dwMaximumSizeHigh,
IN DWORD dwMaximumSizeLow,
IN LPCSTR lpName);

PALIMPORT
HANDLE
PALAPI
OpenFileMappingA(
IN DWORD dwDesiredAccess,
IN BOOL bInheritHandle,
IN LPCSTR lpName);

PALIMPORT
HMODULE
PALAPI
Expand All @@ -209,12 +175,6 @@ GetModuleFileNameA(
OUT LPSTR lpFileName,
IN DWORD nSize);


PALIMPORT
LPSTR
PALAPI
GetEnvironmentStringsA();

PALIMPORT
BOOL
PALAPI
Expand All @@ -230,31 +190,12 @@ GetEnvironmentVariableA(
OUT LPSTR lpBuffer,
IN DWORD nSize);

PALIMPORT
BOOL
PALAPI
FreeEnvironmentStringsA(
IN LPSTR);

PALIMPORT
BOOL
PALAPI
RemoveDirectoryA(
IN LPCSTR lpPathName);

PALIMPORT
BOOL
PALAPI
RemoveDirectoryW(
IN LPCWSTR lpPathName);

PALIMPORT
BOOL
PALAPI
PAL_GetPALDirectoryA(
OUT LPSTR lpDirectoryName,
IN UINT* cchDirectoryName);

PALIMPORT
LONG
PALAPI
Expand Down
46 changes: 0 additions & 46 deletions src/coreclr/src/pal/src/file/directory.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -173,52 +173,6 @@ RemoveDirectoryHelper (
return bRet;
}

/*++
Function:
RemoveDirectoryA
See MSDN doc.
--*/
BOOL
PALAPI
RemoveDirectoryA(
IN LPCSTR lpPathName)
{
DWORD dwLastError = 0;
BOOL bRet = FALSE;
PathCharString mb_dirPathString;

PERF_ENTRY(RemoveDirectoryA);
ENTRY("RemoveDirectoryA(lpPathName=%p (%s))\n",
lpPathName,
lpPathName);

if (lpPathName == NULL)
{
dwLastError = ERROR_PATH_NOT_FOUND;
goto done;
}

if (!mb_dirPathString.Set(lpPathName, strlen(lpPathName)))
{
WARN("Set failed !\n");
dwLastError = ERROR_NOT_ENOUGH_MEMORY;
goto done;
}

bRet = RemoveDirectoryHelper (mb_dirPathString, &dwLastError);

done:
if( dwLastError )
{
SetLastError( dwLastError );
}

LOGEXIT("RemoveDirectoryA returns BOOL %d\n", bRet);
PERF_EXIT(RemoveDirectoryA);
return bRet;
}

/*++
Function:
RemoveDirectoryW
Expand Down
4 changes: 1 addition & 3 deletions src/coreclr/src/pal/src/include/pal/stackstring.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -256,9 +256,7 @@ typedef StackString<MAX_PATH, WCHAR> PathWCharString;
BOOL
PAL_GetPALDirectoryW(
PathWCharString& lpDirectoryName);
BOOL
PAL_GetPALDirectoryA(
PathCharString& lpDirectoryName);

DWORD
GetCurrentDirectoryA(
PathCharString& lpBuffer);
Expand Down
Loading

0 comments on commit c867337

Please sign in to comment.