Delete unused multibyte methods from PAL (#42157)
authorAdeel Mujahid <adeelbm@outlook.com>
Sun, 13 Sep 2020 00:11:17 +0000 (03:11 +0300)
committerGitHub <noreply@github.com>
Sun, 13 Sep 2020 00:11:17 +0000 (17:11 -0700)
78 files changed:
src/coreclr/src/ToolBox/superpmi/superpmi/parallelsuperpmi.cpp
src/coreclr/src/dlls/mscordac/mscordac_unixexports.src
src/coreclr/src/pal/inc/pal.h
src/coreclr/src/pal/inc/palprivate.h
src/coreclr/src/pal/src/file/directory.cpp
src/coreclr/src/pal/src/include/pal/stackstring.hpp
src/coreclr/src/pal/src/map/map.cpp
src/coreclr/src/pal/src/misc/environ.cpp
src/coreclr/src/pal/src/misc/miscpalapi.cpp
src/coreclr/src/pal/src/thread/process.cpp
src/coreclr/src/pal/tests/palsuite/debug_api/OutputDebugStringA/test1/test1.cpp
src/coreclr/src/pal/tests/palsuite/file_io/FindFirstFileA/test1/FindFirstFileA.cpp
src/coreclr/src/pal/tests/palsuite/file_io/FindFirstFileW/test1/FindFirstFileW.cpp
src/coreclr/src/pal/tests/palsuite/file_io/GetFileAttributesA/test1/GetFileAttributesA.cpp
src/coreclr/src/pal/tests/palsuite/file_io/GetFileAttributesW/test1/GetFileAttributesW.cpp
src/coreclr/src/pal/tests/palsuite/file_io/MoveFileExA/test1/MoveFileExA.cpp
src/coreclr/src/pal/tests/palsuite/file_io/SearchPathW/test1/SearchPathW.cpp
src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CMakeLists.txt
src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/CMakeLists.txt [deleted file]
src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test1/CMakeLists.txt [deleted file]
src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test1/CreateFileMapping.cpp [deleted file]
src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test1/testinfo.dat [deleted file]
src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test3/CMakeLists.txt [deleted file]
src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test3/CreateFileMapping.cpp [deleted file]
src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test3/testinfo.dat [deleted file]
src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test4/CMakeLists.txt [deleted file]
src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test4/CreateFileMapping.cpp [deleted file]
src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test4/testinfo.dat [deleted file]
src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test5/CMakeLists.txt [deleted file]
src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test5/CreateFileMapping.cpp [deleted file]
src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test5/testinfo.dat [deleted file]
src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test6/CMakeLists.txt [deleted file]
src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test6/CreateFileMapping.cpp [deleted file]
src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test6/testinfo.dat [deleted file]
src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test7/CMakeLists.txt [deleted file]
src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test7/createfilemapping.cpp [deleted file]
src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test7/testinfo.dat [deleted file]
src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test8/CMakeLists.txt [deleted file]
src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test8/createfilemapping.cpp [deleted file]
src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test8/testinfo.dat [deleted file]
src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test9/CMakeLists.txt [deleted file]
src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test9/createfilemapping.cpp [deleted file]
src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test9/testinfo.dat [deleted file]
src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingW/test6/testinfo.dat
src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/OpenFileMappingA/CMakeLists.txt [deleted file]
src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/OpenFileMappingA/test1/CMakeLists.txt [deleted file]
src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/OpenFileMappingA/test1/OpenFileMappingA.cpp [deleted file]
src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/OpenFileMappingA/test1/testinfo.dat [deleted file]
src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/OpenFileMappingA/test2/CMakeLists.txt [deleted file]
src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/OpenFileMappingA/test2/OpenFileMappingA.cpp [deleted file]
src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/OpenFileMappingA/test2/testinfo.dat [deleted file]
src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/OpenFileMappingA/test3/CMakeLists.txt [deleted file]
src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/OpenFileMappingA/test3/OpenFileMappingA.cpp [deleted file]
src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/OpenFileMappingA/test3/testinfo.dat [deleted file]
src/coreclr/src/pal/tests/palsuite/paltestlist.txt
src/coreclr/src/pal/tests/palsuite/paltestlist_to_be_reviewed.txt
src/coreclr/src/pal/tests/palsuite/threading/CMakeLists.txt
src/coreclr/src/pal/tests/palsuite/threading/CreateProcessA/CMakeLists.txt [deleted file]
src/coreclr/src/pal/tests/palsuite/threading/CreateProcessA/test1/CMakeLists.txt [deleted file]
src/coreclr/src/pal/tests/palsuite/threading/CreateProcessA/test1/childProcess.cpp [deleted file]
src/coreclr/src/pal/tests/palsuite/threading/CreateProcessA/test1/parentProcess.cpp [deleted file]
src/coreclr/src/pal/tests/palsuite/threading/CreateProcessA/test1/testinfo.dat [deleted file]
src/coreclr/src/pal/tests/palsuite/threading/CreateProcessA/test2/CMakeLists.txt [deleted file]
src/coreclr/src/pal/tests/palsuite/threading/CreateProcessA/test2/childprocess.cpp [deleted file]
src/coreclr/src/pal/tests/palsuite/threading/CreateProcessA/test2/parentprocess.cpp [deleted file]
src/coreclr/src/pal/tests/palsuite/threading/CreateProcessA/test2/test2.h [deleted file]
src/coreclr/src/pal/tests/palsuite/threading/CreateProcessA/test2/testinfo.dat [deleted file]
src/coreclr/src/pal/tests/palsuite/threading/DuplicateHandle/test11/test11.cpp
src/coreclr/src/pal/tests/palsuite/threading/ExitThread/test2/test2.cpp
src/coreclr/src/pal/tests/palsuite/threading/GetExitCodeProcess/test1/test1.cpp
src/coreclr/src/pal/tests/palsuite/threading/NamedMutex/test1/namedmutex.cpp
src/coreclr/src/pal/tests/palsuite/threading/OpenEventW/test3/test3.cpp
src/coreclr/src/pal/tests/palsuite/threading/OpenProcess/test1/test1.cpp
src/coreclr/src/pal/tests/palsuite/threading/WaitForMultipleObjectsEx/test6/test6.cpp
src/coreclr/src/pal/tests/palsuite/threading/WaitForSingleObject/WFSOProcessTest/WFSOProcessTest.cpp
src/coreclr/src/tools/metainfo/mdobj.cpp
src/coreclr/src/vm/ceemain.cpp
src/libraries/System.Data.OleDb/src/NativeMethods.cs

index 88dd861..3523ac5 100644 (file)
@@ -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)
@@ -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;
 }
 
index aabfc46..a7e6a87 100644 (file)
@@ -85,7 +85,6 @@ nativeStringResourceTable_mscorrc
 #sscanf_s
 
 #CopyFileW
-#CreateFileMappingA
 #CreateFileMappingW
 #CreateFileA
 #CreateFileW
index 434fd2a..5a099ba 100644 (file)
@@ -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
@@ -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
@@ -733,7 +725,6 @@ CopyFileW(
 #define CopyFile CopyFileA
 #endif
 
-
 PALIMPORT
 BOOL
 PALAPI
@@ -746,12 +737,9 @@ DeleteFileW(
 #define DeleteFile DeleteFileA
 #endif
 
-
-
 #define MOVEFILE_REPLACE_EXISTING      0x00000001
 #define MOVEFILE_COPY_ALLOWED          0x00000002
 
-
 PALIMPORT
 BOOL
 PALAPI
@@ -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
 
@@ -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
@@ -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
@@ -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)();
 
@@ -2970,11 +2920,7 @@ LPWSTR
 PALAPI
 GetEnvironmentStringsW();
 
-#ifdef UNICODE
 #define GetEnvironmentStrings GetEnvironmentStringsW
-#else
-#define GetEnvironmentStrings GetEnvironmentStringsA
-#endif
 
 PALIMPORT
 BOOL
@@ -2982,11 +2928,7 @@ PALAPI
 FreeEnvironmentStringsW(
             IN LPWSTR);
 
-#ifdef UNICODE
 #define FreeEnvironmentStrings FreeEnvironmentStringsW
-#else
-#define FreeEnvironmentStrings FreeEnvironmentStringsA
-#endif
 
 PALIMPORT
 BOOL
index 1901f55..097229e 100644 (file)
@@ -154,40 +154,6 @@ OpenMutexA(
        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
 LoadLibraryA(
@@ -209,12 +175,6 @@ GetModuleFileNameA(
     OUT LPSTR lpFileName,
     IN DWORD nSize);
 
-
-PALIMPORT
-LPSTR
-PALAPI
-GetEnvironmentStringsA();
-
 PALIMPORT
 BOOL
 PALAPI
@@ -233,29 +193,10 @@ GetEnvironmentVariableA(
 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
 CompareFileTime(
index 5c4c0b2..d8279bc 100644 (file)
@@ -175,52 +175,6 @@ RemoveDirectoryHelper (
 
 /*++
 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
 
 See MSDN doc.
index 20a9484..30aa6fa 100644 (file)
@@ -256,9 +256,7 @@ typedef StackString<MAX_PATH, WCHAR> PathWCharString;
 BOOL
 PAL_GetPALDirectoryW(
         PathWCharString& lpDirectoryName);
-BOOL
-PAL_GetPALDirectoryA(
-        PathCharString& lpDirectoryName);
+
 DWORD
 GetCurrentDirectoryA(
          PathCharString& lpBuffer);
index 0cbaef5..1749c1b 100644 (file)
@@ -312,73 +312,6 @@ ExitFileMappingInitializationRoutine:
 
 /*++
 Function:
-  CreateFileMappingA
-
-Note:
-  File mapping are used to do inter-process communication.
-
-See MSDN doc.
---*/
-HANDLE
-PALAPI
-CreateFileMappingA(
-                   IN HANDLE hFile,
-                   IN LPSECURITY_ATTRIBUTES lpFileMappingAttributes,
-                   IN DWORD flProtect,
-                   IN DWORD dwMaximumSizeHigh,
-                   IN DWORD dwMaximumSizeLow,
-                   IN LPCSTR lpName)
-{
-    HANDLE hFileMapping = NULL;
-    CPalThread *pThread = NULL;
-    PAL_ERROR palError = NO_ERROR;
-
-    PERF_ENTRY(CreateFileMappingA);
-    ENTRY("CreateFileMappingA(hFile=%p, lpAttributes=%p, flProtect=%#x, "
-          "dwMaxSizeH=%d, dwMaxSizeL=%d, lpName=%p (%s))\n",
-          hFile, lpFileMappingAttributes, flProtect,
-          dwMaximumSizeHigh, dwMaximumSizeLow,
-          lpName?lpName:"NULL",
-          lpName?lpName:"NULL");
-
-    pThread = InternalGetCurrentThread();
-
-    if (lpName != nullptr)
-    {
-        ASSERT("lpName: Cross-process named objects are not supported in PAL");
-        palError = ERROR_NOT_SUPPORTED;
-    }
-    else
-    {
-        palError = InternalCreateFileMapping(
-            pThread,
-            hFile,
-            lpFileMappingAttributes,
-            flProtect,
-            dwMaximumSizeHigh,
-            dwMaximumSizeLow,
-            NULL,
-            &hFileMapping
-            );
-    }
-
-
-    //
-    // We always need to set last error, even on success:
-    // we need to protect ourselves from the situation
-    // where last error is set to ERROR_ALREADY_EXISTS on
-    // entry to the function
-    //
-
-    pThread->SetLastError(palError);
-
-    LOGEXIT( "CreateFileMappingA returns HANDLE %p. \n", hFileMapping );
-    PERF_EXIT(CreateFileMappingA);
-    return hFileMapping;
-}
-
-/*++
-Function:
   CreateFileMappingW
 
 Note:
@@ -833,50 +766,6 @@ ExitInternalCreateFileMapping:
 
 /*++
 Function:
-  OpenFileMappingA
-
-See MSDN doc.
---*/
-HANDLE
-PALAPI
-OpenFileMappingA(
-         IN DWORD dwDesiredAccess,
-         IN BOOL bInheritHandle,
-         IN LPCSTR lpName)
-{
-    HANDLE hFileMapping = NULL;
-    CPalThread *pThread = NULL;
-    PAL_ERROR palError = NO_ERROR;
-
-    PERF_ENTRY(OpenFileMappingA);
-    ENTRY("OpenFileMappingA(dwDesiredAccess=%u, bInheritHandle=%d, lpName=%p (%s)\n",
-          dwDesiredAccess, bInheritHandle, lpName?lpName:"NULL", lpName?lpName:"NULL");
-
-    pThread = InternalGetCurrentThread();
-
-    if (lpName == nullptr)
-    {
-        ERROR("name is NULL\n");
-        palError = ERROR_INVALID_PARAMETER;
-    }
-    else
-    {
-        ASSERT("lpName: Cross-process named objects are not supported in PAL");
-        palError = ERROR_NOT_SUPPORTED;
-    }
-
-    if (NO_ERROR != palError)
-    {
-        pThread->SetLastError(palError);
-    }
-    LOGEXIT( "OpenFileMappingA returning %p\n", hFileMapping );
-    PERF_EXIT(OpenFileMappingA);
-    return hFileMapping;
-}
-
-
-/*++
-Function:
   OpenFileMappingW
 
 See MSDN doc.
@@ -2173,7 +2062,7 @@ MAPmmapAndRecord(
     // Ensure address and offset arguments mmap() are page-aligned.
     _ASSERTE(OffsetWithinPage(offset - adjust) == 0);
     _ASSERTE(OffsetWithinPage((off_t)pvBaseAddress) == 0);
-    
+
 #ifdef __APPLE__
     if ((prot & PROT_EXEC) != 0 && IsRunningOnMojaveHardenedRuntime())
     {
index ed13156..a31d6b1 100644 (file)
@@ -443,65 +443,6 @@ GetEnvironmentStringsW(
 
 /*++
 Function:
-  GetEnvironmentStringsA
-
-See GetEnvironmentStringsW.
-
---*/
-LPSTR
-PALAPI
-GetEnvironmentStringsA(
-               VOID)
-{
-    char *environ = nullptr, *tempEnviron;
-    int i, len, envNum;
-
-    PERF_ENTRY(GetEnvironmentStringsA);
-    ENTRY("GetEnvironmentStringsA()\n");
-
-    CPalThread * pthrCurrent = InternalGetCurrentThread();
-    InternalEnterCriticalSection(pthrCurrent, &gcsEnvironment);
-
-    envNum = 0;
-    len    = 0;
-
-    /* get total length of the bytes that we need to allocate */
-    for (i = 0; palEnvironment[i] != 0; i++)
-    {
-        len = strlen(palEnvironment[i]) + 1;
-        envNum += len;
-    }
-
-    environ = (char *)PAL_malloc(envNum + 1);
-    if (environ == nullptr)
-    {
-        ERROR("malloc failed\n");
-        SetLastError(ERROR_NOT_ENOUGH_MEMORY);
-        goto EXIT;
-    }
-
-    len = 0;
-    tempEnviron = environ;
-    for (i = 0; palEnvironment[i] != 0; i++)
-    {
-        len = strlen(palEnvironment[i]) + 1;
-        memcpy(tempEnviron, palEnvironment[i], len);
-        tempEnviron += len;
-        envNum      -= len;
-    }
-
-    *tempEnviron = 0; /* Put an extra null at the end */
-
- EXIT:
-    InternalLeaveCriticalSection(pthrCurrent, &gcsEnvironment);
-
-    LOGEXIT("GetEnvironmentStringsA returning %p\n", environ);
-    PERF_EXIT(GetEnvironmentStringsA);
-    return environ;
-}
-
-/*++
-Function:
   FreeEnvironmentStringsW
 
 The FreeEnvironmentStrings function frees a block of environment strings.
@@ -545,31 +486,6 @@ FreeEnvironmentStringsW(
 
 /*++
 Function:
-  FreeEnvironmentStringsA
-
-See FreeEnvironmentStringsW.
-
---*/
-BOOL
-PALAPI
-FreeEnvironmentStringsA(
-            IN LPSTR lpValue)
-{
-    PERF_ENTRY(FreeEnvironmentStringsA);
-    ENTRY("FreeEnvironmentStringsA(lpValue=%p (%s))\n", lpValue ? lpValue : "NULL", lpValue ? lpValue : "NULL");
-
-    if (lpValue != nullptr)
-    {
-        PAL_free(lpValue);
-    }
-
-    LOGEXIT("FreeEnvironmentStringA returning BOOL TRUE\n");
-    PERF_EXIT(FreeEnvironmentStringsA);
-    return TRUE;
-}
-
-/*++
-Function:
   SetEnvironmentVariableA
 
 The SetEnvironmentVariable function sets the value of an environment
@@ -915,28 +831,28 @@ char* FindEnvVarValue(const char* name)
 {
     if (*name == '\0')
         return nullptr;
-    
+
     for (int i = 0; palEnvironment[i] != nullptr; ++i)
     {
         const char* pch = name;
         char* p = palEnvironment[i];
 
-        do 
+        do
         {
-            if (*pch == '\0') 
+            if (*pch == '\0')
             {
                 if (*p == '=')
                     return p + 1;
-                    
+
                 if (*p == '\0') // no = sign -> empty value
                     return p;
-                
+
                 break;
             }
         }
         while (*pch++ == *p++);
     }
-    
+
     return nullptr;
 }
 
@@ -969,9 +885,9 @@ char* EnvironGetenv(const char* name, BOOL copyValue)
 {
     CPalThread * pthrCurrent = InternalGetCurrentThread();
     InternalEnterCriticalSection(pthrCurrent, &gcsEnvironment);
-    
+
     char* retValue = FindEnvVarValue(name);
-    
+
     if ((retValue != nullptr) && copyValue)
     {
         retValue = strdup(retValue);
index ce223fd..0902611 100644 (file)
@@ -106,42 +106,6 @@ EXIT:
     return bRet;
 }
 
-BOOL
-PAL_GetPALDirectoryA(PathCharString& lpDirectoryName)
-{
-    BOOL bRet;
-    PathWCharString directory;
-
-    PERF_ENTRY(PAL_GetPALDirectoryA);
-
-    bRet = PAL_GetPALDirectoryW(directory);
-
-    if (bRet)
-    {
-
-        int length = WideCharToMultiByte(CP_ACP, 0, directory.GetString(), -1, NULL, 0, NULL, 0);
-        LPSTR DirectoryName = lpDirectoryName.OpenStringBuffer(length);
-        if (NULL == DirectoryName)
-        {
-            SetLastError( ERROR_INSUFFICIENT_BUFFER );
-            bRet = FALSE;
-        }
-
-        length = WideCharToMultiByte(CP_ACP, 0, directory.GetString(), -1, DirectoryName, length, NULL, 0);
-
-        if (0 == length)
-        {
-            bRet = FALSE;
-            length++;
-        }
-
-        lpDirectoryName.CloseBuffer(length - 1);
-    }
-
-    PERF_EXIT(PAL_GetPALDirectoryA);
-    return bRet;
-}
-
 /*++
 
 Function :
@@ -188,43 +152,6 @@ PAL_GetPALDirectoryW( OUT LPWSTR lpDirectoryName, IN OUT UINT* cchDirectoryName
 
 }
 
-PALIMPORT
-BOOL
-PALAPI
-PAL_GetPALDirectoryA(
-             OUT LPSTR lpDirectoryName,
-             IN UINT*  cchDirectoryName)
-{
-    BOOL bRet;
-    PathCharString directory;
-
-    PERF_ENTRY(PAL_GetPALDirectoryA);
-    ENTRY( "PAL_GetPALDirectoryA( %p, %d )\n", lpDirectoryName, *cchDirectoryName );
-
-    bRet = PAL_GetPALDirectoryA(directory);
-
-    if (bRet)
-    {
-        if (directory.GetCount() > *cchDirectoryName)
-        {
-            SetLastError( ERROR_INSUFFICIENT_BUFFER );
-            bRet = FALSE;
-            *cchDirectoryName = directory.GetCount();
-        }
-        else if (strcpy_s(lpDirectoryName, directory.GetCount(), directory.GetString()) == SAFECRT_SUCCESS)
-        {
-        }
-        else
-        {
-            bRet = FALSE;
-        }
-    }
-
-    LOGEXIT( "PAL_GetPALDirectoryA returns BOOL %d.\n", bRet);
-    PERF_EXIT(PAL_GetPALDirectoryA);
-    return bRet;
-}
-
 VOID
 PALAPI
 PAL_Random(
index 0fd7efa..60e57ea 100644 (file)
@@ -353,160 +353,6 @@ GetCurrentProcess(
 
 /*++
 Function:
-  CreateProcessA
-
-Note:
-  Only Standard handles need to be inherited.
-  Security attributes parameters are not used.
-
-See MSDN doc.
---*/
-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)
-{
-    PAL_ERROR palError = NO_ERROR;
-    CPalThread *pThread;
-    STARTUPINFOW StartupInfoW;
-    LPWSTR CommandLineW = NULL;
-    LPWSTR ApplicationNameW = NULL;
-    LPWSTR CurrentDirectoryW = NULL;
-
-    int n;
-
-    PERF_ENTRY(CreateProcessA);
-    ENTRY("CreateProcessA(lpAppName=%p (%s), lpCmdLine=%p (%s), lpProcessAttr=%p, "
-          "lpThreadAttr=%p, bInherit=%d, dwFlags=%#x, lpEnv=%p, "
-          "lpCurrentDir=%p (%s), lpStartupInfo=%p, lpProcessInfo=%p)\n",
-           lpApplicationName?lpApplicationName:"NULL",
-           lpApplicationName?lpApplicationName:"NULL",
-           lpCommandLine?lpCommandLine:"NULL",
-           lpCommandLine?lpCommandLine:"NULL",
-           lpProcessAttributes, lpThreadAttributes, bInheritHandles,
-           dwCreationFlags, lpEnvironment,
-           lpCurrentDirectory?lpCurrentDirectory:"NULL",
-           lpCurrentDirectory?lpCurrentDirectory:"NULL",
-           lpStartupInfo, lpProcessInformation);
-
-    pThread = InternalGetCurrentThread();
-
-    if(lpStartupInfo == NULL)
-    {
-        ASSERT("lpStartupInfo is NULL!\n");
-        palError = ERROR_INVALID_PARAMETER;
-        goto done;
-    }
-
-    /* convert parameters to Unicode */
-
-    if(lpApplicationName)
-    {
-        n = MultiByteToWideChar(CP_ACP, 0, lpApplicationName, -1, NULL, 0);
-        if(0 == n)
-        {
-            ASSERT("MultiByteToWideChar failed!\n");
-            palError = ERROR_INTERNAL_ERROR;
-            goto done;
-        }
-        ApplicationNameW = (LPWSTR)InternalMalloc(sizeof(WCHAR)*n);
-        if(!ApplicationNameW)
-        {
-            ERROR("malloc() failed!\n");
-            palError = ERROR_NOT_ENOUGH_MEMORY;
-            goto done;
-        }
-        MultiByteToWideChar(CP_ACP, 0, lpApplicationName, -1, ApplicationNameW,
-                            n);
-    }
-
-    if(lpCommandLine)
-    {
-        n = MultiByteToWideChar(CP_ACP, 0, lpCommandLine, -1, NULL, 0);
-        if(0 == n)
-        {
-            ASSERT("MultiByteToWideChar failed!\n");
-            palError = ERROR_INTERNAL_ERROR;
-            goto done;
-        }
-        CommandLineW = (LPWSTR)InternalMalloc(sizeof(WCHAR)*n);
-        if(!CommandLineW)
-        {
-            ERROR("malloc() failed!\n");
-            palError = ERROR_NOT_ENOUGH_MEMORY;
-            goto done;
-        }
-        MultiByteToWideChar(CP_ACP, 0, lpCommandLine, -1, CommandLineW, n);
-    }
-
-    if(lpCurrentDirectory)
-    {
-        n = MultiByteToWideChar(CP_ACP, 0, lpCurrentDirectory, -1, NULL, 0);
-        if(0 == n)
-        {
-            ASSERT("MultiByteToWideChar failed!\n");
-            palError = ERROR_INTERNAL_ERROR;
-            goto done;
-        }
-        CurrentDirectoryW = (LPWSTR)InternalMalloc(sizeof(WCHAR)*n);
-        if(!CurrentDirectoryW)
-        {
-            ERROR("malloc() failed!\n");
-            palError = ERROR_NOT_ENOUGH_MEMORY;
-            goto done;
-        }
-        MultiByteToWideChar(CP_ACP, 0, lpCurrentDirectory, -1,
-                            CurrentDirectoryW, n);
-    }
-
-    // lpEnvironment should remain ansi on the call to CreateProcessW
-
-    StartupInfoW.cb = sizeof StartupInfoW;
-    StartupInfoW.dwFlags = lpStartupInfo->dwFlags;
-    StartupInfoW.hStdError = lpStartupInfo->hStdError;
-    StartupInfoW.hStdInput = lpStartupInfo->hStdInput;
-    StartupInfoW.hStdOutput = lpStartupInfo->hStdOutput;
-    /* all other members are PAL_Undefined, we can ignore them */
-
-    palError  = InternalCreateProcess(
-        pThread,
-        ApplicationNameW,
-        CommandLineW,
-        lpProcessAttributes,
-        lpThreadAttributes,
-        dwCreationFlags,
-        lpEnvironment,
-        CurrentDirectoryW,
-        &StartupInfoW,
-        lpProcessInformation
-        );
-done:
-    free(ApplicationNameW);
-    free(CommandLineW);
-    free(CurrentDirectoryW);
-
-    if (NO_ERROR != palError)
-    {
-        pThread->SetLastError(palError);
-    }
-
-    LOGEXIT("CreateProcessA returns BOOL %d\n", NO_ERROR == palError);
-    PERF_EXIT(CreateProcessA);
-    return NO_ERROR == palError;
-}
-
-
-/*++
-Function:
   CreateProcessW
 
 Note:
index 07b0c67..a99651a 100644 (file)
@@ -5,7 +5,7 @@
 **
 ** Source: test1.c
 **
-** Purpose: Debugs the helper application.  Checks that certain events, in 
+** Purpose: Debugs the helper application.  Checks that certain events, in
 **          particular the OUTPUT_DEBUG_STRING_EVENT, is generated correctly
 **          and gives the correct values.
 **
@@ -16,7 +16,7 @@
 
 const int DELAY_MS = 2000;
 
-struct OutputCheck 
+struct OutputCheck
 {
     DWORD ExpectedEventCode;
     DWORD ExpectedUnicode;
@@ -25,38 +25,43 @@ struct OutputCheck
 
 int __cdecl main(int argc, char *argv[])
 {
-    
+
     PROCESS_INFORMATION pi;
     STARTUPINFO si;
-        
+
     if(0 != (PAL_Initialize(argc, argv)))
     {
         return FAIL;
     }
-    
+
     ZeroMemory( &si, sizeof(si) );
     si.cb = sizeof(si);
     ZeroMemory( &pi, sizeof(pi) );
-    
+
+    WCHAR name[] = {'h','e','l', 'p', 'e', 'r', '\0'};
     /* Create a new process.  This is the process to be Debugged */
-    if(!CreateProcess( NULL, "helper", NULL, NULL, 
-                       FALSE, 0, NULL, NULL, &si, &pi)) 
+    if(!CreateProcessW( NULL, name, NULL, NULL,
+                        FALSE, 0, NULL, NULL, &si, &pi))
     {
+        DWORD dwError = GetLastError();
+        free(name);
         Fail("ERROR: CreateProcess failed to load executable 'helper'.  "
-             "GetLastError() returned %d.\n",GetLastError());
+             "GetLastError() returned %d.\n", dwError);
     }
 
+    free(name);
+
     /* This is the main loop.  It exits when the process which is being
        debugged is finished executing.
     */
-    
+
     while(1)
-    {    
+    {
         DWORD dwRet = 0;
         dwRet = WaitForSingleObject(pi.hProcess,
                                     DELAY_MS /* Wait for 2 seconds max*/
             );
-    
+
         if (dwRet != WAIT_OBJECT_0)
         {
             Trace("WaitForSingleObjectTest:WaitForSingleObject "
@@ -75,8 +80,8 @@ int __cdecl main(int argc, char *argv[])
                 dwError = GetLastError();
                 CloseHandle ( pi.hProcess );
                 CloseHandle ( pi.hThread );
-                Fail( "GetExitCodeProcess call failed with error code %d\n", 
-                      dwError ); 
+                Fail( "GetExitCodeProcess call failed with error code %d\n",
+                      dwError );
             }
 
             if(dwExitCode != STILL_ACTIVE) {
@@ -85,9 +90,9 @@ int __cdecl main(int argc, char *argv[])
                 break;
             }
             Trace("still executing %d..\n", dwExitCode);
-        }        
+        }
     }
-        
+
     PAL_Terminate();
     return PASS;
 }
index 901a1f3..da9934e 100644 (file)
@@ -36,23 +36,25 @@ BOOL CleanUp()
         if(!SetFileAttributesA (szFindName, FILE_ATTRIBUTE_NORMAL))
         {
             result = FALSE;
-            Trace("ERROR:%d: Error setting attributes [%s][%d]\n", szFindName, FILE_ATTRIBUTE_NORMAL); 
-        } 
+            Trace("ERROR:%d: Error setting attributes [%s][%d]\n", szFindName, FILE_ATTRIBUTE_NORMAL);
+        }
         if(!DeleteFileA (szFindName))
         {
             result = FALSE;
-            Trace("ERROR:%d: Error deleting file [%s][%d]\n", GetLastError(), szFindName, dwAtt);   
+            Trace("ERROR:%d: Error deleting file [%s][%d]\n", GetLastError(), szFindName, dwAtt);
         }
     }
 
     dwAtt = GetFileAttributesA(szDirName);
     if( dwAtt != INVALID_FILE_ATTRIBUTES )
     {
-        if(!RemoveDirectoryA (szDirName))
+        LPWSTR szDirNameW = convert(szDirName);
+        if(!RemoveDirectoryW (szDirNameW))
         {
             result = FALSE;
-            Trace("ERROR:%d: Error deleting file [%s][%d]\n", GetLastError(), szDirName, dwAtt);   
+            Trace("ERROR:%d: Error deleting file [%s][%d]\n", GetLastError(), szDirName, dwAtt);
         }
+        free(szDirNameW);
     }
 
     return result;
@@ -134,12 +136,12 @@ int __cdecl main(int argc, char *argv[])
     if (bRc == FALSE)
     {
         Fail("FindFirstFileA: ERROR -> Failed to create the directory "
-            "\"%s\"\n", 
+            "\"%s\"\n",
             szDirName);
     }
 
     hFind = FindFirstFileA(szDirName, &findFileData);
-    if (hFind == INVALID_HANDLE_VALUE) 
+    if (hFind == INVALID_HANDLE_VALUE)
     {
         Fail ("FindFirstFileA: ERROR. Unable to find \"%s\"\n", szDirName);
     }
@@ -157,23 +159,23 @@ int __cdecl main(int argc, char *argv[])
     // find a directory using a trailing '\' on the directory name: should fail
     //
     hFind = FindFirstFileA(szDirNameSlash, &findFileData);
-    if (hFind != INVALID_HANDLE_VALUE) 
+    if (hFind != INVALID_HANDLE_VALUE)
     {
         Fail ("FindFirstFileA: ERROR -> Able to find \"%s\": trailing "
-            "slash should have failed.\n", 
+            "slash should have failed.\n",
             szDirNameSlash);
     }
 
     // find a file using wild cards
     hFind = FindFirstFileA(szFindNameWldCard_01, &findFileData);
-    if (hFind == INVALID_HANDLE_VALUE) 
+    if (hFind == INVALID_HANDLE_VALUE)
     {
-        Fail ("FindFirstFileA: ERROR -> Unable to find \"%s\"\n", 
+        Fail ("FindFirstFileA: ERROR -> Unable to find \"%s\"\n",
             szFindNameWldCard_01);
     }
 
     hFind = FindFirstFileA(szFindNameWldCard_02, &findFileData);
-    if (hFind == INVALID_HANDLE_VALUE) 
+    if (hFind == INVALID_HANDLE_VALUE)
     {
         Fail ("FindFirstFileA: ERROR -> Unable to find \"%s\"\n", szFindNameWldCard_02);
     }
@@ -183,13 +185,13 @@ int __cdecl main(int argc, char *argv[])
     // find a directory using wild cards
     //
     hFind = FindFirstFileA(szDirNameWldCard_01, &findFileData);
-    if (hFind == INVALID_HANDLE_VALUE) 
+    if (hFind == INVALID_HANDLE_VALUE)
     {
         Fail ("FindFirstFileA: ERROR -> Unable to find \"%s\"\n", szDirNameWldCard_01);
     }
 
     hFind = FindFirstFileA(szDirNameWldCard_02, &findFileData);
-    if (hFind == INVALID_HANDLE_VALUE) 
+    if (hFind == INVALID_HANDLE_VALUE)
     {
         Fail ("FindFirstFileA: ERROR -> Unable to find \"%s\"\n", szDirNameWldCard_02);
     }
@@ -199,7 +201,7 @@ int __cdecl main(int argc, char *argv[])
         Fail("FindFirstFileW: ERROR : Final Clean Up failed\n");
     }
 
-    PAL_Terminate();  
+    PAL_Terminate();
 
     return PASS;
 }
index ac3ba18..5b0d89d 100644 (file)
@@ -35,23 +35,25 @@ BOOL CleanUp()
         if(!SetFileAttributesA (szFindName, FILE_ATTRIBUTE_NORMAL))
         {
             result = FALSE;
-            Trace("ERROR:%d: Error setting attributes [%s][%d]\n", szFindName, FILE_ATTRIBUTE_NORMAL); 
-        } 
+            Trace("ERROR:%d: Error setting attributes [%s][%d]\n", szFindName, FILE_ATTRIBUTE_NORMAL);
+        }
         if(!DeleteFileA (szFindName))
         {
             result = FALSE;
-            Trace("ERROR:%d: Error deleting file [%s][%d]\n", GetLastError(), szFindName, dwAtt);   
+            Trace("ERROR:%d: Error deleting file [%s][%d]\n", GetLastError(), szFindName, dwAtt);
         }
     }
 
     dwAtt = GetFileAttributesA(szDirName);
     if( dwAtt != INVALID_FILE_ATTRIBUTES )
     {
-        if(!RemoveDirectoryA (szDirName))
+        LPWSTR szDirNameW = convert(szDirName);
+        if(!RemoveDirectoryW (szDirNameW))
         {
             result = FALSE;
-            Trace("ERROR:%d: Error deleting file [%s][%d]\n", GetLastError(), szDirName, dwAtt);   
+            Trace("ERROR:%d: Error deleting file [%s][%d]\n", GetLastError(), szDirName, dwAtt);
         }
+        free(szDirNameW);
     }
 
     return result;
@@ -155,7 +157,7 @@ int __cdecl main(int argc, char *argv[])
     if (hFind != INVALID_HANDLE_VALUE)
     {
         Fail("FindFirstFileW: ERROR -> Able to find \"%s\": trailing "
-            "slash should have failed.\n", 
+            "slash should have failed.\n",
             szDirNameSlash);
     }
 
@@ -165,7 +167,7 @@ int __cdecl main(int argc, char *argv[])
     free(pTemp);
     if (hFind == INVALID_HANDLE_VALUE)
     {
-        Fail("FindFirstFileW: ERROR -> Unable to find \"%s\"\n", 
+        Fail("FindFirstFileW: ERROR -> Unable to find \"%s\"\n",
             szFindNameWldCard_01);
     }
 
@@ -174,7 +176,7 @@ int __cdecl main(int argc, char *argv[])
     free(pTemp);
     if (hFind == INVALID_HANDLE_VALUE)
     {
-        Fail("FindFirstFileW: ERROR -> Unable to find \"%s\"\n", 
+        Fail("FindFirstFileW: ERROR -> Unable to find \"%s\"\n",
             szFindNameWldCard_02);
     }
 
@@ -188,7 +190,7 @@ int __cdecl main(int argc, char *argv[])
     free(pTemp);
     if (hFind == INVALID_HANDLE_VALUE)
     {
-        Fail("FindFirstFileW: ERROR -> Unable to find \"%s\"\n", 
+        Fail("FindFirstFileW: ERROR -> Unable to find \"%s\"\n",
             szDirNameWldCard_01);
     }
 
@@ -197,7 +199,7 @@ int __cdecl main(int argc, char *argv[])
     free(pTemp);
     if (hFind == INVALID_HANDLE_VALUE)
     {
-        Fail("FindFirstFileW: ERROR -> Unable to find \"%s\"\n", 
+        Fail("FindFirstFileW: ERROR -> Unable to find \"%s\"\n",
             szDirNameWldCard_02);
     }
 
@@ -206,6 +208,6 @@ int __cdecl main(int argc, char *argv[])
         Fail("FindFirstFileW: ERROR : Final Clean Up failed\n");
     }
 
-    PAL_Terminate();  
+    PAL_Terminate();
     return PASS;
 }
index 9d71293..bf87e43 100644 (file)
@@ -10,7 +10,7 @@
 **          - a normal directory and file
 **          - a read only directory and file
 **          - a read write directory and file
-**          - a hidden directory and file 
+**          - a hidden directory and file
 **          - a read only hidden directory and file
 **          - a directory and a file with no attributes
 **          - an invalid file name
@@ -22,7 +22,7 @@
 const int TYPE_DIR = 0;
 const int TYPE_FILE = 1;
 /* Structure defining a test case */
-typedef struct 
+typedef struct
 {
     char *name;     /* name of the file/directory */
     DWORD expectedAttribs;  /* expected attributes */
@@ -30,7 +30,7 @@ typedef struct
     int isFile;    /* is file (1) or dir (0) */
 }TestCaseFile;
 
-typedef struct 
+typedef struct
 {
     char *name;     /* name of the file/directory */
     DWORD expectedAttribs;  /* expected attributes */
@@ -59,22 +59,22 @@ BOOL CleanUpFiles()
     for (i = 0; i < numFileTests -1 ; i++ )
     {
         dwAtt = GetFileAttributesA(gfaTestsFile[i].name);
+
         if( dwAtt != INVALID_FILE_ATTRIBUTES )
         {
             //Trace("Files iteration %d\n", i);
             if(!SetFileAttributesA (gfaTestsFile[i].name, FILE_ATTRIBUTE_NORMAL))
             {
                 result = FALSE;
-                Trace("ERROR:%d: Error setting attributes [%s][%d]\n", GetLastError(), gfaTestsFile[i].name, FILE_ATTRIBUTE_NORMAL); 
-            } 
+                Trace("ERROR:%d: Error setting attributes [%s][%d]\n", GetLastError(), gfaTestsFile[i].name, FILE_ATTRIBUTE_NORMAL);
+            }
 
             if(!DeleteFileA (gfaTestsFile[i].name))
             {
                 result = FALSE;
-                Trace("ERROR:%d: Error deleting file [%s][%d]\n", GetLastError(), gfaTestsFile[i].name, dwAtt);   
+                Trace("ERROR:%d: Error deleting file [%s][%d]\n", GetLastError(), gfaTestsFile[i].name, dwAtt);
             }
-            
+
         }
     }
 //    Trace("Value of result is %d\n", result);
@@ -102,8 +102,8 @@ BOOL SetUpFiles()
         if(!SetFileAttributesA (gfaTestsFile[i].name, gfaTestsFile[i].expectedAttribs))
         {
             result = FALSE;
-            Trace("ERROR:%d: Error setting attributes [%s][%d]\n", GetLastError(), gfaTestsFile[i].name, gfaTestsFile[i].expectedAttribs); 
-        } 
+            Trace("ERROR:%d: Error setting attributes [%s][%d]\n", GetLastError(), gfaTestsFile[i].name, gfaTestsFile[i].expectedAttribs);
+        }
     }
 
     return result;
@@ -117,22 +117,24 @@ BOOL CleanUpDirs()
     for (i = 0; i < numDirTests -1 ; i++ )
     {
         dwAtt = GetFileAttributesA(gfaTestsDir[i].name);
+
         if( dwAtt != INVALID_FILE_ATTRIBUTES )
         {
-            
+
             if(!SetFileAttributesA (gfaTestsDir[i].name, FILE_ATTRIBUTE_DIRECTORY))
             {
                 result = FALSE;
-                Trace("ERROR:%d: Error setting attributes [%s][%d]\n", GetLastError(), gfaTestsDir[i].name, (FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_DIRECTORY)); 
-            } 
+                Trace("ERROR:%d: Error setting attributes [%s][%d]\n", GetLastError(), gfaTestsDir[i].name, (FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_DIRECTORY));
+            }
 
-            if(!RemoveDirectoryA (gfaTestsDir[i].name))
+            LPWSTR nameW = convert(gfaTestsDir[i].name);
+            if(!RemoveDirectoryW (nameW))
             {
                 result = FALSE;
-                Trace("ERROR:%d: Error deleting file [%s][%d]\n", GetLastError(), gfaTestsDir[i].name, dwAtt);   
+                Trace("ERROR:%d: Error deleting file [%s][%d]\n", GetLastError(), gfaTestsDir[i].name, dwAtt);
             }
-            
+
+            free(nameW);
         }
     }
 
@@ -158,15 +160,15 @@ BOOL SetUpDirs()
         if(!SetFileAttributesA (gfaTestsDir[i].name, gfaTestsDir[i].expectedAttribs))
         {
             result = FALSE;
-            Trace("ERROR:%d: Error setting attributes [%s][%d]\n", GetLastError(), gfaTestsDir[i].name, gfaTestsDir[i].expectedAttribs); 
-        } 
+            Trace("ERROR:%d: Error setting attributes [%s][%d]\n", GetLastError(), gfaTestsDir[i].name, gfaTestsDir[i].expectedAttribs);
+        }
 
         ret = GetFileAttributesA (gfaTestsDir[i].name);
         if(ret != gfaTestsDir[i].expectedAttribs)
         {
             result = FALSE;
-            Trace("ERROR: Error setting attributes [%s][%d]\n", gfaTestsDir[i].name, gfaTestsDir[i].expectedAttribs); 
-        } 
+            Trace("ERROR: Error setting attributes [%s][%d]\n", gfaTestsDir[i].name, gfaTestsDir[i].expectedAttribs);
+        }
         //Trace("Setup Dir setting attr [%d], returned [%d]\n", gfaTestsDir[i].expectedAttribs, ret);
 
     }
@@ -187,7 +189,7 @@ int __cdecl main(int argc, char **argv)
     char * NoDirectoryName              = "no_directory";
 
     char * NormalFileName               = "normal_test_file";
-    char * ReadOnlyFileName             = "ro_test_file";  
+    char * ReadOnlyFileName             = "ro_test_file";
     char * ReadWriteFileName            = "rw_file";
     char * HiddenFileName               = ".hidden_file";
     char * HiddenReadOnlyFileName       = ".hidden_ro_file";
@@ -197,9 +199,9 @@ int __cdecl main(int argc, char **argv)
     gfaTestsDir[0].name    = NormalDirectoryName;
     gfaTestsDir[0].expectedAttribs = FILE_ATTRIBUTE_DIRECTORY;
     gfaTestsDir[0].isFile  = TYPE_DIR;
-    
+
     gfaTestsDir[1].name    = ReadOnlyDirectoryName;
-    gfaTestsDir[1].expectedAttribs = FILE_ATTRIBUTE_DIRECTORY | 
+    gfaTestsDir[1].expectedAttribs = FILE_ATTRIBUTE_DIRECTORY |
                           FILE_ATTRIBUTE_READONLY;
     gfaTestsDir[1].isFile  = TYPE_DIR;
 
@@ -208,12 +210,12 @@ int __cdecl main(int argc, char **argv)
     gfaTestsDir[2].isFile  = TYPE_DIR;
 
     gfaTestsDir[3].name    = HiddenDirectoryName;
-    gfaTestsDir[3].expectedAttribs = FILE_ATTRIBUTE_DIRECTORY; //| 
+    gfaTestsDir[3].expectedAttribs = FILE_ATTRIBUTE_DIRECTORY; //|
                           //FILE_ATTRIBUTE_HIDDEN;
     gfaTestsDir[3].isFile  = TYPE_DIR;
-    
+
     gfaTestsDir[4].name    = HiddenReadOnlyDirectoryName;
-    gfaTestsDir[4].expectedAttribs = FILE_ATTRIBUTE_DIRECTORY | 
+    gfaTestsDir[4].expectedAttribs = FILE_ATTRIBUTE_DIRECTORY |
                           FILE_ATTRIBUTE_READONLY; //|
                           //FILE_ATTRIBUTE_HIDDEN;
     gfaTestsDir[4].isFile  = TYPE_DIR;
@@ -248,7 +250,7 @@ int __cdecl main(int argc, char **argv)
 
     gfaTestsFile[5].name    = NotReallyAFileName;
     gfaTestsFile[5].expectedAttribs =  INVALID_FILE_ATTRIBUTES;
-    gfaTestsFile[5].isFile  = TYPE_FILE;    
+    gfaTestsFile[5].isFile  = TYPE_FILE;
 
     /* Initialize PAL environment */
     if (0 != PAL_Initialize(argc,argv))
@@ -276,7 +278,7 @@ int __cdecl main(int argc, char **argv)
         Fail("GetFileAttributesA: SetUp Directories Failed\n");
     }
 
-    /* 
+    /*
      * Go through all the test cases above,
      * call GetFileAttributesA on the name and
      * make sure the return value is the one expected
index cb57453..48e1013 100644 (file)
@@ -10,7 +10,7 @@
 **          - a normal directory and file
 **          - a read only directory and file
 **          - a read write directory and file
-**          - a hidden directory and file 
+**          - a hidden directory and file
 **          - a read only hidden directory and file
 **          - a directory and a file with no attributes
 **          - an invalid file name
@@ -22,7 +22,7 @@
 const int TYPE_DIR = 0;
 const int TYPE_FILE = 1;
 /* Structure defining a test case */
-typedef struct 
+typedef struct
 {
     char *name;     /* name of the file/directory */
     DWORD expectedAttribs;  /* expected attributes */
@@ -30,7 +30,7 @@ typedef struct
     int isFile;    /* is file (1) or dir (0) */
 }TestCaseFile;
 
-typedef struct 
+typedef struct
 {
     char *name;     /* name of the file/directory */
     DWORD expectedAttribs;  /* expected attributes */
@@ -59,22 +59,22 @@ BOOL CleanUpFiles()
     for (i = 0; i < numFileTests - 1 ; i++ )
     {
         dwAtt = GetFileAttributesA(gfaTestsFile[i].name);
+
         if( dwAtt != INVALID_FILE_ATTRIBUTES )
         {
             //Trace("Files iteration %d\n", i);
             if(!SetFileAttributesA (gfaTestsFile[i].name, FILE_ATTRIBUTE_NORMAL))
             {
                 result = FALSE;
-                Trace("ERROR:%d: Error setting attributes [%s][%d]\n", GetLastError(), gfaTestsFile[i].name, FILE_ATTRIBUTE_NORMAL); 
-            } 
+                Trace("ERROR:%d: Error setting attributes [%s][%d]\n", GetLastError(), gfaTestsFile[i].name, FILE_ATTRIBUTE_NORMAL);
+            }
 
             if(!DeleteFileA (gfaTestsFile[i].name))
             {
                 result = FALSE;
-                Trace("ERROR:%d: Error deleting file [%s][%d]\n", GetLastError(), gfaTestsFile[i].name, dwAtt);   
+                Trace("ERROR:%d: Error deleting file [%s][%d]\n", GetLastError(), gfaTestsFile[i].name, dwAtt);
             }
-            
+
         }
     }
 //    Trace("Value of result is %d\n", result);
@@ -102,8 +102,8 @@ BOOL SetUpFiles()
         if(!SetFileAttributesA (gfaTestsFile[i].name, gfaTestsFile[i].expectedAttribs))
         {
             result = FALSE;
-            Trace("ERROR:%d: Error setting attributes [%s][%d]\n", GetLastError(), gfaTestsFile[i].name, gfaTestsFile[i].expectedAttribs); 
-        } 
+            Trace("ERROR:%d: Error setting attributes [%s][%d]\n", GetLastError(), gfaTestsFile[i].name, gfaTestsFile[i].expectedAttribs);
+        }
     }
 
     return result;
@@ -117,22 +117,24 @@ BOOL CleanUpDirs()
     for (i = 0; i < numDirTests - 1; i++ )
     {
         dwAtt = GetFileAttributesA(gfaTestsDir[i].name);
+
         if( dwAtt != INVALID_FILE_ATTRIBUTES )
         {
-            
+
             if(!SetFileAttributesA (gfaTestsDir[i].name, FILE_ATTRIBUTE_DIRECTORY))
             {
                 result = FALSE;
-                Trace("ERROR:%d: Error setting attributes [%s][%d]\n", GetLastError(), gfaTestsDir[i].name, (FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_DIRECTORY)); 
-            } 
+                Trace("ERROR:%d: Error setting attributes [%s][%d]\n", GetLastError(), gfaTestsDir[i].name, (FILE_ATTRIBUTE_NORMAL | FILE_ATTRIBUTE_DIRECTORY));
+            }
 
-            if(!RemoveDirectoryA (gfaTestsDir[i].name))
+            LPWSTR nameW = convert(gfaTestsDir[i].name);
+            if(!RemoveDirectoryW (nameW))
             {
                 result = FALSE;
-                Trace("ERROR:%d: Error deleting file [%s][%d]\n", GetLastError(), gfaTestsDir[i].name, dwAtt);   
+                Trace("ERROR:%d: Error deleting file [%s][%d]\n", GetLastError(), gfaTestsDir[i].name, dwAtt);
             }
-            
+
+            free(nameW);
         }
     }
 
@@ -158,15 +160,15 @@ BOOL SetUpDirs()
         if(!SetFileAttributesA (gfaTestsDir[i].name, gfaTestsDir[i].expectedAttribs))
         {
             result = FALSE;
-            Trace("ERROR:%d: Error setting attributes [%s][%d]\n", GetLastError(), gfaTestsDir[i].name, gfaTestsDir[i].expectedAttribs); 
-        } 
+            Trace("ERROR:%d: Error setting attributes [%s][%d]\n", GetLastError(), gfaTestsDir[i].name, gfaTestsDir[i].expectedAttribs);
+        }
 
         ret = GetFileAttributesA (gfaTestsDir[i].name);
         if(ret != gfaTestsDir[i].expectedAttribs)
         {
             result = FALSE;
-            Trace("ERROR: Error setting attributes [%s][%d]\n", gfaTestsDir[i].name, gfaTestsDir[i].expectedAttribs); 
-        } 
+            Trace("ERROR: Error setting attributes [%s][%d]\n", gfaTestsDir[i].name, gfaTestsDir[i].expectedAttribs);
+        }
         // Trace("Setup Dir setting attr [%d], returned [%d]\n", gfaTestsDir[i].expectedAttribs, ret);
 
     }
@@ -187,7 +189,7 @@ int __cdecl main(int argc, char **argv)
     char * NoDirectoryName              = "no_directory";
 
     char * NormalFileName               = "normal_test_file";
-    char * ReadOnlyFileName             = "ro_test_file";  
+    char * ReadOnlyFileName             = "ro_test_file";
     char * ReadWriteFileName            = "rw_file";
     char * HiddenFileName               = ".hidden_file";
     char * HiddenReadOnlyFileName       = ".hidden_ro_file";
@@ -198,9 +200,9 @@ int __cdecl main(int argc, char **argv)
     gfaTestsDir[0].name    = NormalDirectoryName;
     gfaTestsDir[0].expectedAttribs = FILE_ATTRIBUTE_DIRECTORY;
     gfaTestsDir[0].isFile  = TYPE_DIR;
-    
+
     gfaTestsDir[1].name    = ReadOnlyDirectoryName;
-    gfaTestsDir[1].expectedAttribs = FILE_ATTRIBUTE_DIRECTORY | 
+    gfaTestsDir[1].expectedAttribs = FILE_ATTRIBUTE_DIRECTORY |
                           FILE_ATTRIBUTE_READONLY;
     gfaTestsDir[1].isFile  = TYPE_DIR;
 
@@ -209,12 +211,12 @@ int __cdecl main(int argc, char **argv)
     gfaTestsDir[2].isFile  = TYPE_DIR;
 
     gfaTestsDir[3].name    = HiddenDirectoryName;
-    gfaTestsDir[3].expectedAttribs = FILE_ATTRIBUTE_DIRECTORY; //| 
+    gfaTestsDir[3].expectedAttribs = FILE_ATTRIBUTE_DIRECTORY; //|
                           //FILE_ATTRIBUTE_HIDDEN;
     gfaTestsDir[3].isFile  = TYPE_DIR;
-    
+
     gfaTestsDir[4].name    = HiddenReadOnlyDirectoryName;
-    gfaTestsDir[4].expectedAttribs = FILE_ATTRIBUTE_DIRECTORY | 
+    gfaTestsDir[4].expectedAttribs = FILE_ATTRIBUTE_DIRECTORY |
                           FILE_ATTRIBUTE_READONLY; //|
                           //FILE_ATTRIBUTE_HIDDEN;
     gfaTestsDir[4].isFile  = TYPE_DIR;
@@ -249,7 +251,7 @@ int __cdecl main(int argc, char **argv)
 
     gfaTestsFile[5].name    = NotReallyAFileName;
     gfaTestsFile[5].expectedAttribs =  INVALID_FILE_ATTRIBUTES;
-    gfaTestsFile[5].isFile  = TYPE_FILE;    
+    gfaTestsFile[5].isFile  = TYPE_FILE;
 
     /* Initialize PAL environment */
     if (0 != PAL_Initialize(argc,argv))
@@ -277,7 +279,7 @@ int __cdecl main(int argc, char **argv)
         Fail("GetFileAttributesW: SetUp Directories Failed\n");
     }
 
-    /* 
+    /*
      * Go through all the test cases above,
      * call GetFileAttributesW on the name and
      * make sure the return value is the one expected
index 08ce684..ca0b800 100644 (file)
@@ -13,7 +13,7 @@
 #include <palsuite.h>
 
 
-LPSTR lpSource[4] = { 
+LPSTR lpSource[4] = {
                                                "src_existing.tmp",
                                                "src_non-existant.tmp",
                                                "src_dir_existing",
@@ -42,7 +42,7 @@ LPSTR lpFiles[14] ={
                                                "dst_dir_non-existant\\test01.tmp",
                                                "dst_dir_non-existant\\test02.tmp"
                                                };
-  
+
 DWORD dwFlag[2] = {MOVEFILE_COPY_ALLOWED, MOVEFILE_REPLACE_EXISTING};
 
 
@@ -54,7 +54,7 @@ int createExisting(void)
     HANDLE tempFile2 = NULL;
 
     /* create the src_existing file and dst_existing file */
-    tempFile = CreateFileA(lpSource[0], GENERIC_WRITE, 0, 0, CREATE_ALWAYS,                        
+    tempFile = CreateFileA(lpSource[0], GENERIC_WRITE, 0, 0, CREATE_ALWAYS,
                             FILE_ATTRIBUTE_NORMAL, 0);
     tempFile2 = CreateFileA(lpDestination[0], GENERIC_WRITE, 0, 0, CREATE_ALWAYS,
                             FILE_ATTRIBUTE_NORMAL, 0);
@@ -63,9 +63,9 @@ int createExisting(void)
 
     if ((tempFile == NULL) || (tempFile2 == NULL))
     {
-        Trace("ERROR[%ul]: couldn't create %S or %S\n", GetLastError(), lpSource[0], 
+        Trace("ERROR[%ul]: couldn't create %S or %S\n", GetLastError(), lpSource[0],
                 lpDestination[0]);
-        return FAIL;    
+        return FAIL;
     }
 
     /* create the src_dir_existing and dst_dir_existing directory and files */
@@ -102,20 +102,25 @@ int createExisting(void)
 }
 
 void removeDirectoryHelper(LPSTR dir, int location)
-{    
+{
     DWORD dwAtt = GetFileAttributesA(dir);
 
     if (( dwAtt != INVALID_FILE_ATTRIBUTES ) && ( dwAtt & FILE_ATTRIBUTE_DIRECTORY) )
     {
-        if(!RemoveDirectoryA(dir))
+        LPWSTR dirW = convert(dir);
+        if(!RemoveDirectoryW(dirW))
         {
-            Fail("ERROR: Failed to remove Directory [%s], Error Code [%d], location [%d]\n", dir, GetLastError(), location);           
+            DWORD dwError = GetLastError();
+            free(dirW);
+            Fail("ERROR: Failed to remove Directory [%s], Error Code [%d], location [%d]\n", dir, dwError, location);
         }
+
+        free(dirW);
     }
 }
 
 void removeFileHelper(LPSTR pfile, int location)
-{    
+{
     FILE *fp;
     fp = fopen( pfile, "r");
 
@@ -123,12 +128,12 @@ void removeFileHelper(LPSTR pfile, int location)
     {
         if(fclose(fp))
         {
-          Fail("ERROR: Failed to close the file [%s], Error Code [%d], location [%d]\n", pfile, GetLastError(), location);           
+          Fail("ERROR: Failed to close the file [%s], Error Code [%d], location [%d]\n", pfile, GetLastError(), location);
         }
 
         if(!DeleteFileA(pfile))
         {
-            Fail("ERROR: Failed to delete file [%s], Error Code [%d], location [%d]\n", pfile, GetLastError(), location);           
+            Fail("ERROR: Failed to delete file [%s], Error Code [%d], location [%d]\n", pfile, GetLastError(), location);
         }
     }
 
@@ -138,7 +143,7 @@ void removeAll(void)
 {
     DWORD dwAtt;
     /* get rid of destination dirs and files */
-    removeFileHelper(lpSource[0], 11);  
+    removeFileHelper(lpSource[0], 11);
     removeFileHelper(lpSource[1], 12);
     removeFileHelper(lpFiles[0], 13);
     removeFileHelper(lpFiles[1], 14);
@@ -172,7 +177,7 @@ void removeAll(void)
     {
         removeFileHelper(lpDestination[1], 19);
     }
+
     dwAtt = GetFileAttributesA(lpDestination[2]);
     if (( dwAtt != INVALID_FILE_ATTRIBUTES ) && ( dwAtt & FILE_ATTRIBUTE_DIRECTORY) )
     {
@@ -182,7 +187,7 @@ void removeAll(void)
     }
     else
     {
-        removeFileHelper(lpDestination[2], 23);  
+        removeFileHelper(lpDestination[2], 23);
     }
 
     dwAtt = GetFileAttributesA(lpDestination[3]);
@@ -236,7 +241,7 @@ int __cdecl main(int argc, char *argv[])
     if (createExisting() != PASS)
     {
         goto EXIT;
-    }  
+    }
 
     /* lpSource loop */
     for (i = 0; i < 4; i++)
@@ -252,14 +257,14 @@ int __cdecl main(int argc, char *argv[])
                 bRc = MoveFileExA(lpSource[i], lpDestination[j], dwFlag[k]);
 
                 if (!(
-                    ((bRc == TRUE) && (results[nCounter] == '1')) 
-                    || 
+                    ((bRc == TRUE) && (results[nCounter] == '1'))
+                    ||
                     ((bRc == FALSE ) && (results[nCounter] == '0'))                    )
                     )
                 {
-                    Trace("MoveFileExA(%s, %s, %s): Values of i[%d], j[%d], k [%d] and results[%d]=%c LastError[%d]Flag[%d]FAILED\n", 
-                        lpSource[i], lpDestination[j], 
-                        k == 1 ? 
+                    Trace("MoveFileExA(%s, %s, %s): Values of i[%d], j[%d], k [%d] and results[%d]=%c LastError[%d]Flag[%d]FAILED\n",
+                        lpSource[i], lpDestination[j],
+                        k == 1 ?
                         "MOVEFILE_REPLACE_EXISTING":"MOVEFILE_COPY_ALLOWED", i, j, k, nCounter, results[nCounter], GetLastError(), bRc);
                     goto EXIT;
                 }
@@ -276,7 +281,7 @@ int __cdecl main(int argc, char *argv[])
     }
 
     /* create the temp source file */
-    hFile = CreateFileA(tempSource, GENERIC_WRITE, 0, 0, CREATE_ALWAYS,                        
+    hFile = CreateFileA(tempSource, GENERIC_WRITE, 0, 0, CREATE_ALWAYS,
                             FILE_ATTRIBUTE_NORMAL, 0);
 
     if( hFile == INVALID_HANDLE_VALUE )
@@ -285,7 +290,7 @@ int __cdecl main(int argc, char *argv[])
             "create the file correctly.\n");
         goto EXIT;
     }
-    
+
     bRc = CloseHandle(hFile);
     if(!bRc)
     {
@@ -321,7 +326,7 @@ int __cdecl main(int argc, char *argv[])
         Trace("MoveFileExA: GetFileAttributes failed to get "
             "the file's attributes.\n");
         goto EXIT;
-    }   
+    }
 
     if((result & FILE_ATTRIBUTE_READONLY) != FILE_ATTRIBUTE_READONLY)
     {
index 6ae5205..c6cc79f 100644 (file)
 //);
 //
 //Parameters
-//lpPath 
-//[in] Pointer to a null-terminated string that specifies the path to be searched for the file. If this parameter is NULL, the function searches for a matching file in the following directories in the following sequence: 
-//The directory from which the application loaded. 
-//The current directory. 
-//The system directory. Use the GetSystemDirectory function to get the path of this directory. 
-//The 16-bit system directory. There is no function that retrieves the path of this directory, but it is searched. 
-//The Windows directory. Use the GetWindowsDirectory function to get the path of this directory. 
-//The directories that are listed in the PATH environment variable. 
-
-//lpFileName 
-//[in] Pointer to a null-terminated string that specifies the name of the file to search for. 
-
-//lpExtension 
-//[in] Pointer to a null-terminated string that specifies an extension to be added to the file name when searching for the file. The first character of the file name extension must be a period (.). The extension is added only if the specified file name does not end with an extension. 
+//lpPath
+//[in] Pointer to a null-terminated string that specifies the path to be searched for the file. If this parameter is NULL, the function searches for a matching file in the following directories in the following sequence:
+//The directory from which the application loaded.
+//The current directory.
+//The system directory. Use the GetSystemDirectory function to get the path of this directory.
+//The 16-bit system directory. There is no function that retrieves the path of this directory, but it is searched.
+//The Windows directory. Use the GetWindowsDirectory function to get the path of this directory.
+//The directories that are listed in the PATH environment variable.
+
+//lpFileName
+//[in] Pointer to a null-terminated string that specifies the name of the file to search for.
+
+//lpExtension
+//[in] Pointer to a null-terminated string that specifies an extension to be added to the file name when searching for the file. The first character of the file name extension must be a period (.). The extension is added only if the specified file name does not end with an extension.
 //If a file name extension is not required or if the file name contains an extension, this parameter can be NULL.
 //
-//nBufferLength 
-//[in] Size of the buffer that receives the valid path and file name, in TCHARs. 
+//nBufferLength
+//[in] Size of the buffer that receives the valid path and file name, in TCHARs.
 
-//lpBuffer 
-//[out] Pointer to the buffer that receives the path and file name of the file found. 
+//lpBuffer
+//[out] Pointer to the buffer that receives the path and file name of the file found.
 
-//lpFilePart 
-//[out] Pointer to the variable that receives the address (within lpBuffer) of the last component of the valid path and file name, which is the address of the character immediately following the final backslash (\) in the path. 
+//lpFilePart
+//[out] Pointer to the variable that receives the address (within lpBuffer) of the last component of the valid path and file name, which is the address of the character immediately following the final backslash (\) in the path.
 
 //Return Values
 //If the function succeeds, the value returned is the length, in TCHARs, of the string copied to the buffer, not including the terminating null character. If the return value is greater than nBufferLength, the value returned is the size of the buffer required to hold the path.
@@ -70,7 +70,7 @@ const char* szFileNameExistsWithExt =          "searchpathw.c";
 char  fileloc[_MAX_PATH];
 
 void removeFileHelper(LPSTR pfile, int location)
-{    
+{
     FILE *fp;
     fp = fopen( pfile, "r");
 
@@ -78,16 +78,16 @@ void removeFileHelper(LPSTR pfile, int location)
     {
         if(fclose(fp))
         {
-          Fail("ERROR: Failed to close the file [%s], Error Code [%d], location [%d]\n", pfile, GetLastError(), location);           
+          Fail("ERROR: Failed to close the file [%s], Error Code [%d], location [%d]\n", pfile, GetLastError(), location);
         }
 
         if(!DeleteFileA(pfile))
         {
-            Fail("ERROR: Failed to delete file [%s], Error Code [%d], location [%d]\n", pfile, GetLastError(), location);           
+            Fail("ERROR: Failed to delete file [%s], Error Code [%d], location [%d]\n", pfile, GetLastError(), location);
         }
         else
         {
-    //       Trace("Success: deleted file [%S], Error Code [%d], location [%d]\n", wfile, GetLastError(), location);           
+    //       Trace("Success: deleted file [%S], Error Code [%d], location [%d]\n", wfile, GetLastError(), location);
         }
     }
 
@@ -136,13 +136,13 @@ int __cdecl main(int argc, char *argv[]) {
 
     RemoveAll();
 
-    hsearchfile = CreateFileA(fileloc, GENERIC_WRITE, 0, 0, CREATE_ALWAYS,                        
+    hsearchfile = CreateFileA(fileloc, GENERIC_WRITE, 0, 0, CREATE_ALWAYS,
                             FILE_ATTRIBUTE_NORMAL, 0);
 
     if (hsearchfile == NULL)
     {
         Trace("ERROR[%ul]: couldn't create %s\n", GetLastError(), fileloc);
-        return FAIL;    
+        return FAIL;
     }
 
     CloseHandle(hsearchfile);
@@ -179,7 +179,7 @@ int __cdecl main(int argc, char *argv[]) {
         error = GetLastError();
         free(lpPath);
         free(lpFileName);
-        Fail ("SearchPathA: ERROR2 -> Did not Find valid file[%s][%s][%d]\n", lpPath, szFileNameExistsWithExt, error);
+        Fail ("SearchPathW: ERROR2 -> Did not Find valid file[%s][%s][%d]\n", lpPath, szFileNameExistsWithExt, error);
     }
 
     free(lpPath);
@@ -188,5 +188,5 @@ int __cdecl main(int argc, char *argv[]) {
     RemoveAll();
 
     PAL_Terminate();
-    return PASS; 
+    return PASS;
 }
index 90da8e5..742e29b 100644 (file)
@@ -1,4 +1,3 @@
-add_subdirectory(CreateFileMappingA)
 add_subdirectory(CreateFileMappingW)
 add_subdirectory(FreeLibrary)
 add_subdirectory(FreeLibraryAndExitThread)
@@ -8,7 +7,6 @@ add_subdirectory(GetProcAddress)
 add_subdirectory(LocalAlloc)
 add_subdirectory(LocalFree)
 add_subdirectory(MapViewOfFile)
-add_subdirectory(OpenFileMappingA)
 add_subdirectory(OpenFileMappingW)
 add_subdirectory(ProbeMemory)
 add_subdirectory(UnmapViewOfFile)
diff --git a/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/CMakeLists.txt b/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/CMakeLists.txt
deleted file mode 100644 (file)
index 6d92806..0000000
+++ /dev/null
@@ -1,9 +0,0 @@
-add_subdirectory(test1)
-add_subdirectory(test3)
-add_subdirectory(test4)
-add_subdirectory(test5)
-add_subdirectory(test6)
-add_subdirectory(test7)
-add_subdirectory(test8)
-add_subdirectory(test9)
-
diff --git a/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test1/CMakeLists.txt b/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test1/CMakeLists.txt
deleted file mode 100644 (file)
index d7d1892..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-set(SOURCES
-  CreateFileMapping.cpp
-)
-
-add_executable(paltest_createfilemappinga_test1
-  ${SOURCES}
-)
-
-add_dependencies(paltest_createfilemappinga_test1 coreclrpal)
-
-target_link_libraries(paltest_createfilemappinga_test1
-  ${COMMON_TEST_LIBRARIES}
-)
diff --git a/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test1/CreateFileMapping.cpp b/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test1/CreateFileMapping.cpp
deleted file mode 100644 (file)
index 6462b80..0000000
+++ /dev/null
@@ -1,172 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-/*=============================================================
-**
-** Source:  createfilemapping.c (test 1)
-**
-** Purpose: Positive test the CreateFileMapping API.
-**          Call CreateFileMapping with access PAGE_READONLY.
-**
-**
-**============================================================*/
-#include <palsuite.h>
-
-const int MAPPINGSIZE = 2048;
-
-int __cdecl main(int argc, char *argv[])
-{
-
-    HANDLE  hFile;
-    char    buf[] = "this is a test string";
-    char    ch[2048];
-    char    lpFileName[] = "test.tmp";
-    DWORD   dwBytesWritten;
-    BOOL    err;
-    int     RetVal = PASS;
-
-    HANDLE hFileMapping;
-    LPVOID lpMapViewAddress;
-
-    /* Initialize the PAL environment.
-     */
-    if(0 != PAL_Initialize(argc, argv))
-    {
-        return FAIL;
-    }
-
-    /* Create a file handle with CreateFile.
-     */
-    hFile = CreateFile( lpFileName,
-                        GENERIC_WRITE|GENERIC_READ,
-                        FILE_SHARE_READ|FILE_SHARE_WRITE,
-                        NULL,
-                        CREATE_ALWAYS,
-                        FILE_ATTRIBUTE_NORMAL, 
-                        NULL);
-
-    if (hFile == INVALID_HANDLE_VALUE)
-    {
-        Fail("ERROR: %u :unable to create file \"%s\".\n",
-             GetLastError(),
-             lpFileName);
-    }
-
-    /* Initialize the buffers.
-     */
-    memset(ch,  0, MAPPINGSIZE);
-
-    /* Write to the File handle.
-     */ 
-    err = WriteFile(hFile,
-                        buf,
-                        strlen(buf),
-                        &dwBytesWritten,
-                        NULL);
-
-    if (err == FALSE)
-    {
-        Trace("ERROR: %u :unable to write to file handle "
-                "hFile=0x%lx\n",
-                GetLastError(),
-                hFile);
-        RetVal = FAIL;
-        goto CleanUpOne;
-    }
-
-    /* Flush to the hard-drive.
-     */
-    FlushFileBuffers(hFile);
-
-    /* Create a unnamed file-mapping object with file handle FileHandle
-     * and with PAGE_READWRITE protection.
-    */
-    hFileMapping = CreateFileMapping(
-                            hFile,
-                            NULL,               /*not inherited*/
-                            PAGE_READONLY,      /*read and wite*/
-                            0,                  /*high-order size*/
-                            0,                  /*low-order size*/
-                            NULL);              /*unnamed object*/
-
-    if(NULL == hFileMapping)
-    {
-        Trace("ERROR:%u: Failed to create File Mapping.\n", 
-              GetLastError());
-        RetVal = FAIL;
-        goto CleanUpOne;
-    }
-
-    /* maps a view of a file into the address space of the calling process.
-     */
-    lpMapViewAddress = MapViewOfFile(
-                            hFileMapping,
-                            FILE_MAP_READ,  /* access code */
-                            0,              /*high order offset*/
-                            0,              /*low order offset*/
-                            0);             /* number of bytes for map */
-
-    if(NULL == lpMapViewAddress)
-    {
-        Trace("ERROR:%u: Failed to call MapViewOfFile "
-              "API to map a view of file!\n", 
-              GetLastError());
-        RetVal = FAIL;
-        goto CleanUpTwo;
-    }
-
-    /* Copy the MapViewOfFile to buffer, so we can
-     * compare with value read from file directly.
-     */
-    memcpy(ch, (LPCSTR)lpMapViewAddress, MAPPINGSIZE);
-    if (memcmp(ch, buf, strlen(buf))!= 0)
-    {
-        Trace("ERROR: MapViewOfFile not equal to file contents "
-              "retrieved \"%s\", expected \"%s\".\n",
-              ch, buf);
-        RetVal = FAIL;
-        goto CleanUpThree;
-    }
-
-CleanUpThree:
-        
-    /* Unmap the view of file.
-        */
-    if ( UnmapViewOfFile(lpMapViewAddress) == FALSE )
-    {
-        Trace("ERROR:%u: Failed to UnmapViewOfFile of \"%0x%lx\".\n",
-                GetLastError(),
-                lpMapViewAddress);
-        RetVal = FAIL;
-    }
-
-CleanUpTwo:
-
-    /* Close Handle to opend file mapping.
-        */
-    if ( CloseHandle(hFileMapping) == FALSE )
-    {
-        Trace("ERROR:%u: Failed to CloseHandle \"0x%lx\".\n",
-                GetLastError(),
-                hFileMapping);
-        RetVal = FAIL;
-    }
-
-CleanUpOne:
-        
-    /* Close Handle to create file mapping.
-        */
-    if ( CloseHandle(hFile) == FALSE )
-    {
-        Trace("ERROR:%u: Failed to CloseHandle \"0x%lx\".\n",
-                GetLastError(),
-                hFile);
-        RetVal = FAIL;
-    }
-
-    /* Terminate the PAL.
-     */ 
-    PAL_TerminateEx(RetVal);
-    return RetVal;
-}
-
diff --git a/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test1/testinfo.dat b/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test1/testinfo.dat
deleted file mode 100644 (file)
index 0fd5e34..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-# Licensed to the .NET Foundation under one or more agreements.
-# The .NET Foundation licenses this file to you under the MIT license.
-
-Version = 1.0
-Section = Filemapping_memmgt
-Function = CreateFileMapping
-Name = CreateFileMappingA with PAGE_READONLY
-TYPE = DEFAULT
-EXE1 = createfilemapping
-Description
-=Test the CreateFileMapping to create a named file-mapping object
-=and with PAGE_READONLY protection
diff --git a/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test3/CMakeLists.txt b/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test3/CMakeLists.txt
deleted file mode 100644 (file)
index 25877fb..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-set(SOURCES
-  CreateFileMapping.cpp
-)
-
-add_executable(paltest_createfilemappinga_test3
-  ${SOURCES}
-)
-
-add_dependencies(paltest_createfilemappinga_test3 coreclrpal)
-
-target_link_libraries(paltest_createfilemappinga_test3
-  ${COMMON_TEST_LIBRARIES}
-)
diff --git a/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test3/CreateFileMapping.cpp b/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test3/CreateFileMapping.cpp
deleted file mode 100644 (file)
index bbf7529..0000000
+++ /dev/null
@@ -1,154 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-/*=============================================================
-**
-** Source:  createfilemapping.c (test 3)
-**
-** Purpose: Positive test the CreateFileMapping API.
-**          Call CreateFileMapping with access PAGE_READWRITE.
-**
-**
-**============================================================*/
-#include <palsuite.h>
-
-const   int MAPPINGSIZE = 2048;
-
-int __cdecl main(int argc, char *argv[])
-{
-
-    HANDLE  hFile;
-    char    buf[] = "this is a test string";
-    char    ch[2048];
-    char    lpFileName[] = "test.tmp";
-    HANDLE  hFileMapping;
-    LPVOID  lpMapViewAddress;
-    int     RetVal = PASS;
-
-    /* Initialize the PAL environment.
-     */
-    if(0 != PAL_Initialize(argc, argv))
-    {
-        return FAIL;
-    }
-
-    /* Create a file handle with CreateFile.
-     */
-    hFile = CreateFile( lpFileName,
-                        GENERIC_WRITE|GENERIC_READ,
-                        FILE_SHARE_READ|FILE_SHARE_WRITE,
-                        NULL,
-                        CREATE_ALWAYS,
-                        FILE_ATTRIBUTE_NORMAL, 
-                        NULL);
-
-    if (hFile == INVALID_HANDLE_VALUE)
-    {
-        Fail("ERROR: %u :unable to create file \"%s\".\n",
-             GetLastError(),
-             lpFileName);
-    }
-
-    /* Initialize the buffers.
-     */
-    memset(ch,  0, MAPPINGSIZE);
-
-    /* Create a unnamed file-mapping object with file handle FileHandle
-     * and with PAGE_READWRITE protection.
-     */
-    hFileMapping = CreateFileMapping(
-                            hFile,
-                            NULL,               /*not inherited*/
-                            PAGE_READWRITE,     /*read and wite*/
-                            0,                  /*high-order size*/
-                            MAPPINGSIZE,        /*low-order size*/
-                            NULL);              /*unnamed object*/
-
-    if(NULL == hFileMapping)
-    {
-        Trace("ERROR:%u: Failed to create File Mapping.\n", 
-              GetLastError());
-        RetVal = FAIL;
-        goto CleanUpOne;
-    }
-
-    /* maps a view of a file into the address space of the calling process.
-     */
-    lpMapViewAddress = MapViewOfFile(
-                            hFileMapping,
-                            FILE_MAP_ALL_ACCESS, /* access code */
-                            0,                   /*high order offset*/
-                            0,                   /*low order offset*/
-                            MAPPINGSIZE);        /* number of bytes for map */
-
-    if(NULL == lpMapViewAddress)
-    {
-        Trace("ERROR:%u: Failed to call MapViewOfFile "
-              "API to map a view of file!\n", 
-              GetLastError());
-        RetVal = FAIL;
-        goto CleanUpTwo;
-    }
-    
-    /* Write to the Map view.
-     */ 
-    memcpy(lpMapViewAddress, buf, strlen(buf));
-
-    /* Read from the Map view.
-     */ 
-    memcpy(ch, (LPCSTR)lpMapViewAddress, MAPPINGSIZE);
-    
-    /* Copy the MapViewOfFile to buffer, so we can
-     * compare with value read from file directly.
-     */
-    if (memcmp(ch, buf, strlen(buf))!= 0)
-    {
-        Trace("ERROR: MapViewOfFile not equal to file contents "
-              "retrieved \"%s\", expected \"%s\".\n",
-              ch, buf);
-        RetVal = FAIL;
-        goto CleanUpThree;
-    }
-
-CleanUpThree:
-        
-    /* Unmap the view of file.
-        */
-    if ( UnmapViewOfFile(lpMapViewAddress) == FALSE )
-    {
-        Trace("ERROR:%u: Failed to UnmapViewOfFile of \"%0x%lx\".\n",
-                GetLastError(),
-                lpMapViewAddress);
-        RetVal = FAIL;
-    }
-
-CleanUpTwo:
-
-    /* Close Handle to opend file mapping.
-        */
-    if ( CloseHandle(hFileMapping) == FALSE )
-    {
-        Trace("ERROR:%u: Failed to CloseHandle \"0x%lx\".\n",
-                GetLastError(),
-                hFileMapping);
-        RetVal = FAIL;
-    }
-
-CleanUpOne:
-        
-    /* Close Handle to create file mapping.
-        */
-    if ( CloseHandle(hFile) == FALSE )
-    {
-        Trace("ERROR:%u: Failed to CloseHandle \"0x%lx\".\n",
-                GetLastError(),
-                hFile);
-        RetVal = FAIL;
-    }
-
-    /* Terminate the PAL.
-     */ 
-    PAL_TerminateEx(RetVal);
-    return RetVal;
-}
-
diff --git a/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test3/testinfo.dat b/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test3/testinfo.dat
deleted file mode 100644 (file)
index c393f07..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-# Licensed to the .NET Foundation under one or more agreements.
-# The .NET Foundation licenses this file to you under the MIT license.
-
-Version = 1.0
-Section = Filemapping_memmgt
-Function = CreateFileMapping
-Name = CreateFileMappingA with PAGE_READWRITE
-TYPE = DEFAULT
-EXE1 = createfilemapping
-Description
-=Test the CreateFileMapping to create a unnamed file-mapping object
-=and with PAGE_READWRITE protection
diff --git a/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test4/CMakeLists.txt b/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test4/CMakeLists.txt
deleted file mode 100644 (file)
index 566abe3..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-set(SOURCES
-  CreateFileMapping.cpp
-)
-
-add_executable(paltest_createfilemappinga_test4
-  ${SOURCES}
-)
-
-add_dependencies(paltest_createfilemappinga_test4 coreclrpal)
-
-target_link_libraries(paltest_createfilemappinga_test4
-  ${COMMON_TEST_LIBRARIES}
-)
diff --git a/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test4/CreateFileMapping.cpp b/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test4/CreateFileMapping.cpp
deleted file mode 100644 (file)
index a5fd1c8..0000000
+++ /dev/null
@@ -1,180 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-/*=============================================================
-**
-** Source:  createfilemapping.c (test 4)
-**
-** Purpose: Positive test the CreateFileMapping API.
-**          Call CreateFileMapping with access PAGE_WRITECOPY.
-**
-**
-**============================================================*/
-#include <palsuite.h>
-
-const   int MAPPINGSIZE = 2048;
-
-int __cdecl main(int argc, char *argv[])
-{
-
-    HANDLE  hFile;
-    char    buf[] = "this is a test string";
-    char    ch[2048];
-    char    lpFileName[] = "test.tmp";
-    HANDLE  hFileMapping;
-    LPVOID  lpMapViewAddress;
-    int     RetVal = PASS;
-    int     err;
-    DWORD   dwBytesWritten;
-
-
-    /* Initialize the PAL environment.
-     */
-    if(0 != PAL_Initialize(argc, argv))
-    {
-        return FAIL;
-    }
-
-    /* Create a file handle with CreateFile.
-     */
-    hFile = CreateFile( lpFileName,
-                        GENERIC_WRITE|GENERIC_READ,
-                        FILE_SHARE_READ|FILE_SHARE_WRITE,
-                        NULL,
-                        CREATE_ALWAYS,
-                        FILE_ATTRIBUTE_NORMAL,
-                        NULL);
-
-    if (hFile == INVALID_HANDLE_VALUE)
-    {
-        Fail("ERROR: %u :unable to create file \"%s\".\n",
-             GetLastError(),
-             lpFileName);
-    }
-
-    /* Write to the File handle.
-     */ 
-    err = WriteFile(hFile,
-                    buf,
-                    strlen(buf),
-                    &dwBytesWritten,
-                    NULL);
-
-    if (err == FALSE)
-    {
-        Trace("ERROR: %u :unable to write to file handle "
-                "hFile=0x%lx\n",
-                GetLastError(),
-                hFile);
-        RetVal = FAIL;
-        goto CleanUpOne;
-    }
-    
-    /* Flush to the hard-drive.
-      */
-    FlushFileBuffers(hFile);
-
-    /* Initialize the buffers.
-     */
-    memset(ch,  0, MAPPINGSIZE);
-
-    /* Create a unnamed file-mapping object with file handle FileHandle
-     * and with PAGE_WRITECOPY protection.
-     */
-    hFileMapping = CreateFileMapping(
-                            hFile,
-                            NULL,               /*not inherited*/
-                            PAGE_WRITECOPY,     /*write copy*/
-                            0,                  /*high-order size*/
-                            0,                  /*low-order size*/
-                            NULL);              /*unnamed object*/
-
-    if(NULL == hFileMapping)
-    {
-        Trace("ERROR:%u: Failed to create File Mapping.\n", 
-              GetLastError());
-        RetVal = FAIL;
-        goto CleanUpOne;
-    }
-
-    /* maps a view of a file into the address space of the calling process.
-     */
-    lpMapViewAddress = MapViewOfFile(
-                            hFileMapping,
-                            FILE_MAP_COPY,       /* access code */
-                            0,                   /* high order offset*/
-                            0,                   /* low order offset*/
-                            0);                  /* number of bytes for map */
-
-    if(NULL == lpMapViewAddress)
-    {
-        Trace("ERROR:%u: Failed to call MapViewOfFile "
-              "API to map a view of file!\n", 
-              GetLastError());
-        RetVal = FAIL;
-        goto CleanUpTwo;
-    }
-    
-    /* Write to the Map view.3
-     */ 
-    memcpy(lpMapViewAddress, buf, strlen(buf));
-
-    /* Read from the Map view.
-     */ 
-    memcpy(ch, (LPCSTR)lpMapViewAddress, MAPPINGSIZE);
-    
-    /* Copy the MapViewOfFile to buffer, so we can
-     * compare with value read from file directly.
-     */
-    if (memcmp(ch, buf, strlen(buf))!= 0)
-    {
-        Trace("ERROR: MapViewOfFile not equal to file contents "
-              "retrieved \"%s\", expected \"%s\".\n",
-              ch, buf);
-        RetVal = FAIL;
-        goto CleanUpThree;
-    }
-
-CleanUpThree:
-        
-    /* Unmap the view of file.
-        */
-    if ( UnmapViewOfFile(lpMapViewAddress) == FALSE )
-    {
-        Trace("ERROR:%u: Failed to UnmapViewOfFile of \"%0x%lx\".\n",
-                GetLastError(),
-                lpMapViewAddress);
-        RetVal = FAIL;
-    }
-
-CleanUpTwo:
-
-    /* Close Handle to opend file mapping.
-        */
-    if ( CloseHandle(hFileMapping) == FALSE )
-    {
-        Trace("ERROR:%u: Failed to CloseHandle \"0x%lx\".\n",
-                GetLastError(),
-                hFileMapping);
-        RetVal = FAIL;
-    }
-
-CleanUpOne:
-        
-    /* Close Handle to create file mapping.
-        */
-    if ( CloseHandle(hFile) == FALSE )
-    {
-        Trace("ERROR:%u: Failed to CloseHandle \"0x%lx\".\n",
-                GetLastError(),
-                hFile);
-        RetVal = FAIL;
-    }
-
-    /* Terminate the PAL.
-     */ 
-    PAL_TerminateEx(RetVal);
-    return RetVal;
-}
-
-
diff --git a/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test4/testinfo.dat b/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test4/testinfo.dat
deleted file mode 100644 (file)
index eab2b3c..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-# Licensed to the .NET Foundation under one or more agreements.
-# The .NET Foundation licenses this file to you under the MIT license.
-
-Version = 1.0
-Section = Filemapping_memmgt
-Function = CreateFileMapping
-Name = CreateFileMappingA with PAGE_WRITECOPY.
-TYPE = DEFAULT
-EXE1 = createfilemapping
-Description
-= Positive test the CreateFileMapping API.
-= Call CreateFileMapping with access PAGE_WRITECOPY.
diff --git a/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test5/CMakeLists.txt b/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test5/CMakeLists.txt
deleted file mode 100644 (file)
index 4cd4053..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-set(SOURCES
-  CreateFileMapping.cpp
-)
-
-add_executable(paltest_createfilemappinga_test5
-  ${SOURCES}
-)
-
-add_dependencies(paltest_createfilemappinga_test5 coreclrpal)
-
-target_link_libraries(paltest_createfilemappinga_test5
-  ${COMMON_TEST_LIBRARIES}
-)
diff --git a/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test5/CreateFileMapping.cpp b/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test5/CreateFileMapping.cpp
deleted file mode 100644 (file)
index 3d17532..0000000
+++ /dev/null
@@ -1,192 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-/*=============================================================
-**
-** Source:  createfilemapping.c (test 5)
-**
-** Purpose: Positive test the CreateFileMapping API.
-**          Test CreateFileMapping to a "swap" handle with 
-**          access PAGE_READONLY.
-**
-**
-**============================================================*/
-#include <palsuite.h>
-
-const   int MAPPINGSIZE = 2048;
-HANDLE  SWAP_HANDLE     = ((VOID *)(-1));
-
-int __cdecl main(int argc, char *argv[])
-{
-    char    testString[] = "this is a test string";
-    char    lpObjectName[] = "myMappingObject";
-    int     RetVal = FAIL;
-    char    results[2048];
-    
-    HANDLE hFileMapRO;
-    HANDLE hFileMapRW;
-    LPVOID lpMapViewRO;
-    LPVOID lpMapViewRW;
-
-    /* Initialize the PAL environment.
-     */
-    if(0 != PAL_Initialize(argc, argv))
-    {
-        return FAIL;
-    }
-
-    /* Initialize the buffers.
-     */
-    memset(results,  0, MAPPINGSIZE);
-
-    /* Create a named file-mapping object with file handle FileHandle
-     * and with PAGE_READWRITE protection.
-    */
-    hFileMapRW = CreateFileMapping(
-                            SWAP_HANDLE,
-                            NULL,               /*not inherited*/
-                            PAGE_READWRITE,     /*read only*/
-                            0,                  /*high-order size*/
-                            MAPPINGSIZE,        /*low-order size*/
-                            lpObjectName);      /*named object*/
-
-    if(NULL == hFileMapRW)
-    {
-        Fail("ERROR:%u: Failed to create File Mapping.\n", 
-              GetLastError());
-    }
-
-    /* maps a view of a file into the address space of the calling process.
-     */
-    lpMapViewRW = MapViewOfFile(
-                            hFileMapRW,
-                            FILE_MAP_ALL_ACCESS, /* access code */
-                            0,                   /* high order offset*/
-                            0,                   /* low order offset*/
-                            MAPPINGSIZE);        /* number of bytes for map */
-
-    if(NULL == lpMapViewRW)
-    {
-        Trace("ERROR:%u: Failed to call MapViewOfFile "
-              "API to map a view of file!\n", 
-              GetLastError());
-        RetVal = FAIL;
-        goto CleanUpOne;
-    }
-
-
-    hFileMapRO = CreateFileMapping(
-                            SWAP_HANDLE,
-                            NULL,               /*not inherited*/
-                            PAGE_READONLY,      /*read and write*/
-                            0,                  /*high-order size*/
-                            MAPPINGSIZE,        /*low-order size*/
-                            lpObjectName);      /*named object*/
-
-    if(NULL == hFileMapRO)
-    {
-        Trace("ERROR:%u: Failed to create File Mapping.\n", 
-              GetLastError());
-        RetVal = FAIL;
-        goto CleanUpTwo;
-    }
-    
-    /* maps a view of a file into the address space of the calling process.
-     */
-    lpMapViewRO = MapViewOfFile(
-                            hFileMapRO,
-                            FILE_MAP_READ,  /* access code */
-                            0,                    /* high order offset*/
-                            0,                    /* low order offset*/
-                            MAPPINGSIZE);         /* number of bytes for map */
-
-    if(NULL == lpMapViewRO)
-    {
-        Trace("ERROR:%u: Failed to call MapViewOfFile "
-              "API to map a view of file!\n", 
-              GetLastError());
-        RetVal = FAIL;
-        goto CleanUpThree;
-    }
-
-    /* Write the test string to the Map view.
-    */    
-    memcpy(lpMapViewRW, testString, strlen(testString));
-
-    /* Read from the second Map view.
-    */
-    memcpy(results, (LPCSTR)lpMapViewRO, MAPPINGSIZE);
-
-    /* Verify the contents of the file mapping,
-     * by comparing what was written to what was read.
-     */
-    if (memcmp(results, testString, strlen(testString))!= 0)
-    {
-        Trace("ERROR: MapViewOfFile not equal to file contents "
-              "retrieved \"%s\", expected \"%s\".\n",
-              results,
-              testString);
-        RetVal = FAIL;
-        goto CleanUpFour;
-    }
-
-    /* Test was successful.
-     */
-    RetVal = PASS;
-
-CleanUpFour:
-        
-    /* Unmap the view of file.
-        */
-    if ( UnmapViewOfFile(lpMapViewRO) == FALSE )
-    {
-        Trace("ERROR:%u: Failed to UnmapViewOfFile of \"%0x%lx\".\n",
-                GetLastError(),
-                lpMapViewRO);
-        RetVal = FAIL;
-    }
-
-CleanUpThree:
-        
-    /* Close Handle to opend file mapping.
-        */
-    if ( CloseHandle(hFileMapRO) == FALSE )
-    {
-        Trace("ERROR:%u: Failed to CloseHandle \"0x%lx\".\n",
-                GetLastError(),
-                hFileMapRO);
-        RetVal = FAIL;
-    }
-    
-
-CleanUpTwo:
-    /* Unmap the view of file.
-     */
-    if ( UnmapViewOfFile(lpMapViewRW) == FALSE )
-    {
-        Trace("ERROR:%u: Failed to UnmapViewOfFile of \"%0x%lx\".\n",
-                GetLastError(),
-                lpMapViewRW);
-        RetVal = FAIL;
-    }
-    
-
-CleanUpOne:
-        
-    /* Close Handle to opend file mapping.
-     */
-    if ( CloseHandle(hFileMapRW) == FALSE )
-    {
-        Trace("ERROR:%u: Failed to CloseHandle \"0x%lx\".\n",
-                GetLastError(),
-                hFileMapRW);
-        RetVal = FAIL;
-    }
-
-
-    /* Terminate the PAL.
-     */ 
-    PAL_TerminateEx(RetVal);
-    return RetVal;
-}
-
diff --git a/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test5/testinfo.dat b/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test5/testinfo.dat
deleted file mode 100644 (file)
index 2b5d890..0000000
+++ /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.
-
-Version = 1.0
-Section = Filemapping_memmgt
-Function = CreateFileMapping
-Name = CreateFileMappingA - with PAGE_READWRITE  and INVALID_HANDLE_VALUE file handle
-TYPE = DEFAULT
-EXE1 = createfilemapping
-Description
-=Test the CreateFileMapping to create a unnamed file-mapping object
-=and with PAGE_READWRITE protection by passing INVALID_HANDLE_VALUE 
-=file handle
diff --git a/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test6/CMakeLists.txt b/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test6/CMakeLists.txt
deleted file mode 100644 (file)
index 89d25f5..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-set(SOURCES
-  CreateFileMapping.cpp
-)
-
-add_executable(paltest_createfilemappinga_test6
-  ${SOURCES}
-)
-
-add_dependencies(paltest_createfilemappinga_test6 coreclrpal)
-
-target_link_libraries(paltest_createfilemappinga_test6
-  ${COMMON_TEST_LIBRARIES}
-)
diff --git a/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test6/CreateFileMapping.cpp b/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test6/CreateFileMapping.cpp
deleted file mode 100644 (file)
index 7c3ba87..0000000
+++ /dev/null
@@ -1,163 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-/*=============================================================
-**
-** Source:  createfilemapping.c (test 6)
-**
-** Purpose: Positive test the CreateFileMapping API.
-**          Test CreateFileMapping to a "swap" handle with 
-**          access PAGE_READWRITE.
-**
-**
-**============================================================*/
-#include <palsuite.h>
-
-const   int MAPPINGSIZE = 2048;
-HANDLE  SWAP_HANDLE     = ((VOID *)(-1));
-
-int __cdecl main(int argc, char *argv[])
-{
-    char    testString[] = "this is a test string";
-    char    lpObjectName[] = "myMappingObject";
-    char    results[2048];
-    int     RetVal = PASS;
-    
-    HANDLE hFileMapRW;
-    LPVOID lpMapViewRW;
-    LPVOID lpMapViewRW2;
-
-    /* Initialize the PAL environment.
-     */
-    if(0 != PAL_Initialize(argc, argv))
-    {
-        return FAIL;
-    }
-
-    /* Initialize the buffers.
-     */
-    memset(results,  0, MAPPINGSIZE);
-
-    /* Create a named file-mapping object with file handle FileHandle
-     * and with PAGE_READWRITE protection.
-    */
-    hFileMapRW = CreateFileMapping(
-                            SWAP_HANDLE,
-                            NULL,               /*not inherited*/
-                            PAGE_READWRITE,     /*read write*/
-                            0,                  /*high-order size*/
-                            MAPPINGSIZE,        /*low-order size*/
-                            lpObjectName);      /*unnamed object*/
-
-    if(NULL == hFileMapRW)
-    {
-        Fail("ERROR:%u: Failed to create File Mapping.\n", 
-             GetLastError());
-    }
-
-    /* Create a map view of the READWRITE file mapping.
-     */
-    lpMapViewRW = MapViewOfFile(
-                            hFileMapRW,
-                            FILE_MAP_ALL_ACCESS,/* access code */
-                            0,                  /* high order offset*/
-                            0,                  /* low order offset*/
-                            MAPPINGSIZE);       /* number of bytes for map */
-
-    if(NULL == lpMapViewRW)
-    {
-        Trace("ERROR:%u: Failed to call MapViewOfFile "
-              "API to map a view of file!\n", 
-              GetLastError());
-        RetVal = FAIL;
-        goto CleanUpOne;
-    }
-
-
-    /* maps a view of a file into the address space of the calling process.
-     */
-    lpMapViewRW2 = MapViewOfFile(
-                            hFileMapRW,
-                            FILE_MAP_ALL_ACCESS,  /* access code */
-                            0,                    /* high order offset*/
-                            0,                    /* low order offset*/
-                            MAPPINGSIZE);         /* number of bytes for map */
-
-    if(NULL == lpMapViewRW2)
-    {
-        Trace("ERROR:%u: Failed to call MapViewOfFile "
-              "API to map a view of file!\n", 
-              GetLastError());
-        RetVal = FAIL;
-        goto CleanUpTwo;
-    }
-
-    /* Write the test string to the Map view.
-    */    
-    memcpy(lpMapViewRW, testString, strlen(testString));
-
-    /* Read from the second Map view.
-    */
-    memcpy(results, (LPCSTR)lpMapViewRW2, MAPPINGSIZE);
-
-    /* Verify the contents of the file mapping,
-     * by comparing what was written to what was read.
-     */
-    if (memcmp(results, testString, strlen(testString))!= 0)
-    {
-        Trace("ERROR: MapViewOfFile not equal to file contents "
-              "retrieved \"%s\", expected \"%s\".\n",
-              results,
-              testString);
-        RetVal = FAIL;
-        goto CleanUpThree;
-    }
-
-    /* Test successful.
-     */
-    RetVal = PASS;
-
-CleanUpThree:
-        
-    /* Unmap the view of file.
-     */
-    if ( UnmapViewOfFile(lpMapViewRW2) == FALSE )
-    {
-        Trace("ERROR:%u: Failed to UnmapViewOfFile of \"%0x%lx\".\n",
-                GetLastError(),
-                lpMapViewRW2);
-        RetVal = FAIL;
-    }   
-
-CleanUpTwo:
-
-    /* Unmap the view of file.
-     */
-    if ( UnmapViewOfFile(lpMapViewRW) == FALSE )
-    {
-        Trace("ERROR:%u: Failed to UnmapViewOfFile of \"%0x%lx\".\n",
-                GetLastError(),
-                lpMapViewRW);
-        RetVal = FAIL;
-    }
-
-
-CleanUpOne:
-        
-    /* Close Handle to create file mapping.
-     */
-    if ( CloseHandle(hFileMapRW) == FALSE )
-    {
-        Trace("ERROR:%u: Failed to CloseHandle \"0x%lx\".\n",
-                GetLastError(),
-                hFileMapRW);
-        RetVal = FAIL;
-    }
-
-
-    /* Terminate the PAL.
-     */ 
-    PAL_TerminateEx(RetVal);
-    return RetVal;
-}
-
diff --git a/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test6/testinfo.dat b/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test6/testinfo.dat
deleted file mode 100644 (file)
index b69e8e3..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-# Licensed to the .NET Foundation under one or more agreements.
-# The .NET Foundation licenses this file to you under the MIT license.
-
-Version = 1.0
-Section = Filemapping_memmgt
-Function = CreateFileMapping
-Name = CreateFileMappingA - with PAGE_READONLY
-TYPE = DEFAULT
-EXE1 = createfilemapping
-Description
-=Test the CreateFileMapping to create a named file-mapping object
-=and with PAGE_READONLY protection
diff --git a/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test7/CMakeLists.txt b/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test7/CMakeLists.txt
deleted file mode 100644 (file)
index ea2e756..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-set(SOURCES
-  createfilemapping.cpp
-)
-
-add_executable(paltest_createfilemappinga_test7
-  ${SOURCES}
-)
-
-add_dependencies(paltest_createfilemappinga_test7 coreclrpal)
-
-target_link_libraries(paltest_createfilemappinga_test7
-  ${COMMON_TEST_LIBRARIES}
-)
diff --git a/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test7/createfilemapping.cpp b/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test7/createfilemapping.cpp
deleted file mode 100644 (file)
index 47bfdf2..0000000
+++ /dev/null
@@ -1,163 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-/*=============================================================
-**
-** Source:  createfilemapping.c (test 7)
-**
-** Purpose: Positive test the CreateFileMapping API.
-**          Test CreateFileMapping to a "swap" handle with 
-**          access PAGE_READWRITE.
-**
-**
-**============================================================*/
-#include <palsuite.h>
-
-const   int MAPPINGSIZE = 2048;
-HANDLE  SWAP_HANDLE     = ((VOID *)(-1));
-
-int __cdecl main(int argc, char *argv[])
-{
-    char    testString[] = "this is a test string";
-    char    lpObjectName[] = "myMappingObject";
-    char    results[2048];
-    int     RetVal = PASS;
-    
-    HANDLE hFileMapRW;
-    LPVOID lpMapViewRW;
-    LPVOID lpMapViewRO;
-
-    /* Initialize the PAL environment.
-     */
-    if(0 != PAL_Initialize(argc, argv))
-    {
-        return FAIL;
-    }
-
-    /* Initialize the buffers.
-     */
-    memset(results,  0, MAPPINGSIZE);
-
-    /* Create a named file-mapping object with file handle FileHandle
-     * and with PAGE_READWRITE protection.
-    */
-    hFileMapRW = CreateFileMapping(
-                            SWAP_HANDLE,
-                            NULL,               /*not inherited*/
-                            PAGE_READWRITE,     /*read write*/
-                            0,                  /*high-order size*/
-                            MAPPINGSIZE,        /*low-order size*/
-                            lpObjectName);      /*unnamed object*/
-
-    if(NULL == hFileMapRW)
-    {
-        Fail("ERROR:%u: Failed to create File Mapping.\n", 
-             GetLastError());
-    }
-
-    /* Create a map view to the READWRITE file mapping.
-     */
-    lpMapViewRW = MapViewOfFile(
-                            hFileMapRW,
-                            FILE_MAP_ALL_ACCESS,/* access code */
-                            0,                  /* high order offset*/
-                            0,                  /* low order offset*/
-                            MAPPINGSIZE);       /* number of bytes for map */
-
-    if(NULL == lpMapViewRW)
-    {
-        Trace("ERROR:%u: Failed to call MapViewOfFile "
-              "API to map a view of file!\n", 
-              GetLastError());
-        RetVal = FAIL;
-        goto CleanUpOne;
-    }
-
-
-    /* Create a map view to the READWRITE file mapping.
-     */
-    lpMapViewRO = MapViewOfFile(
-                            hFileMapRW,
-                            FILE_MAP_READ,        /* access code */
-                            0,                    /* high order offset*/
-                            0,                    /* low order offset*/
-                            MAPPINGSIZE);         /* number of bytes for map */
-
-    if(NULL == lpMapViewRO)
-    {
-        Trace("ERROR:%u: Failed to call MapViewOfFile "
-              "API to map a view of file!\n", 
-              GetLastError());
-        RetVal = FAIL;
-        goto CleanUpTwo;
-    }
-
-    /* Write the test string to the Map view.
-    */    
-    memcpy(lpMapViewRW, testString, strlen(testString));
-
-    /* Read from the second Map view.
-    */
-    memcpy(results, (LPCSTR)lpMapViewRO, MAPPINGSIZE);
-
-    /* Verify the contents of the file mapping,
-     * by comparing what was written to what was read.
-     */
-    if (memcmp(results, testString, strlen(testString))!= 0)
-    {
-        Trace("ERROR: MapViewOfFile not equal to file contents "
-              "retrieved \"%s\", expected \"%s\".\n",
-              results,
-              testString);
-        RetVal = FAIL;
-        goto CleanUpThree;
-    }
-
-    /* Test successful.
-     */
-    RetVal = PASS;
-
-CleanUpThree:
-        
-    /* Unmap the view of file.
-     */
-    if ( UnmapViewOfFile(lpMapViewRO) == FALSE )
-    {
-        Trace("ERROR:%u: Failed to UnmapViewOfFile of \"%0x%lx\".\n",
-                GetLastError(),
-                lpMapViewRO);
-        RetVal = FAIL;
-    }   
-
-CleanUpTwo:
-
-    /* Unmap the view of file.
-     */
-    if ( UnmapViewOfFile(lpMapViewRW) == FALSE )
-    {
-        Trace("ERROR:%u: Failed to UnmapViewOfFile of \"%0x%lx\".\n",
-                GetLastError(),
-                lpMapViewRW);
-        RetVal = FAIL;
-    }
-
-
-CleanUpOne:
-        
-    /* Close Handle to create file mapping.
-     */
-    if ( CloseHandle(hFileMapRW) == FALSE )
-    {
-        Trace("ERROR:%u: Failed to CloseHandle \"0x%lx\".\n",
-                GetLastError(),
-                hFileMapRW);
-        RetVal = FAIL;
-    }
-
-
-    /* Terminate the PAL.
-     */ 
-    PAL_TerminateEx(RetVal);
-    return RetVal;
-}
-
diff --git a/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test7/testinfo.dat b/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test7/testinfo.dat
deleted file mode 100644 (file)
index a61f67f..0000000
+++ /dev/null
@@ -1,12 +0,0 @@
-# Licensed to the .NET Foundation under one or more agreements.
-# The .NET Foundation licenses this file to you under the MIT license.
-
-Version = 1.0
-Section = Filemapping_memmgt
-Function = CreateFileMapping
-Name = CreateFileMappingA - with PAGE_COPYWRITE
-TYPE = DEFAULT
-EXE1 = createfilemapping
-Description
-=Test the CreateFileMapping to create a named file-mapping object
-=and with PAGE_READONLY protection
diff --git a/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test8/CMakeLists.txt b/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test8/CMakeLists.txt
deleted file mode 100644 (file)
index 93d8a02..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-set(SOURCES
-  createfilemapping.cpp
-)
-
-add_executable(paltest_createfilemappinga_test8
-  ${SOURCES}
-)
-
-add_dependencies(paltest_createfilemappinga_test8 coreclrpal)
-
-target_link_libraries(paltest_createfilemappinga_test8
-  ${COMMON_TEST_LIBRARIES}
-)
diff --git a/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test8/createfilemapping.cpp b/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test8/createfilemapping.cpp
deleted file mode 100644 (file)
index fa09291..0000000
+++ /dev/null
@@ -1,78 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-/*=============================================================
-**
-** Source:  createfilemapping.c (test 8)
-**
-** Purpose: Positive test the CreateFileMapping API.
-**          Test the un-verifiable parameter combinations.
-**
-**
-**============================================================*/
-#include <palsuite.h>
-
-const   int MAPPINGSIZE = 2048;
-HANDLE  SWAP_HANDLE     = ((VOID *)(-1));
-
-int __cdecl main(int argc, char *argv[])
-{
-    HANDLE  hFileMap;
-
-    /* Initialize the PAL environment.
-     */
-    if(0 != PAL_Initialize(argc, argv))
-    {
-        return FAIL;
-    }
-
-    /* Create a READONLY, "swap", un-named file mapping.
-     * This test is unverifiable since there is no hook back to the file map
-     * because it is un-named. As well, since it resides in "swap", and is
-     * initialized to zero, there is nothing to read.
-     */
-    hFileMap = CreateFileMapping(
-                            SWAP_HANDLE,
-                            NULL,               /*not inherited*/
-                            PAGE_READONLY,      /*read only*/
-                            0,                  /*high-order size*/
-                            MAPPINGSIZE,        /*low-order size*/
-                            NULL);              /*un-named object*/
-
-    if(NULL == hFileMap)
-    {
-        Fail("ERROR:%u: Failed to create File Mapping.\n", 
-              GetLastError());
-    }
-
-    
-    /* Create a COPYWRITE, "swap", un-named file mapping.
-     * This test is unverifiable, here is a quote from MSDN:
-     * 
-     * Copy on write access. If you create the map with PAGE_WRITECOPY and 
-     * the view with FILE_MAP_COPY, you will receive a view to file. If you 
-     * write to it, the pages are automatically swappable and the modifications
-     * you make will not go to the original data file. 
-     *
-     */
-    hFileMap = CreateFileMapping(
-                            SWAP_HANDLE,
-                            NULL,               /*not inherited*/
-                            PAGE_WRITECOPY,      /*read only*/
-                            0,                  /*high-order size*/
-                            MAPPINGSIZE,        /*low-order size*/
-                            NULL);              /*unnamed object*/
-
-    if(NULL == hFileMap)
-    {
-        Fail("ERROR:%u: Failed to create File Mapping.\n", 
-              GetLastError());
-    }
-
-
-    /* Terminate the PAL.
-     */ 
-    PAL_Terminate();
-    return PASS;
-}
-
diff --git a/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test8/testinfo.dat b/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test8/testinfo.dat
deleted file mode 100644 (file)
index 961303f..0000000
+++ /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.
-
-Version = 1.0
-Section = Filemapping_memmgt
-Function = CreateFileMapping
-Name = CreateFileMappingA - unnamed swap, READWRITE.
-TYPE = DEFAULT
-EXE1 = createfilemapping
-Description
-= Positive test the CreateFileMapping API.
-= Test an unnamed File Mapping to a "swap" 
-= handle with access PAGE_READWRITE.
diff --git a/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test9/CMakeLists.txt b/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test9/CMakeLists.txt
deleted file mode 100644 (file)
index 8932cad..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-set(SOURCES
-  createfilemapping.cpp
-)
-
-add_executable(paltest_createfilemappinga_test9
-  ${SOURCES}
-)
-
-add_dependencies(paltest_createfilemappinga_test9 coreclrpal)
-
-target_link_libraries(paltest_createfilemappinga_test9
-  ${COMMON_TEST_LIBRARIES}
-)
diff --git a/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test9/createfilemapping.cpp b/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test9/createfilemapping.cpp
deleted file mode 100644 (file)
index c0a1028..0000000
+++ /dev/null
@@ -1,149 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-/*=============================================================
-**
-** Source:  createfilemapping.c (test 9)
-**
-** Purpose: Negative test the CreateFileMapping API.
-**
-**
-**============================================================*/
-#include <palsuite.h>
-
-const int MAPPINGSIZE = 2048;
-
-int __cdecl main(int argc, char *argv[])
-{
-
-    HANDLE  hFile;
-    char    lpFileName[] = "test.tmp";
-
-    HANDLE hFileMapping;
-
-    /* Initialize the PAL environment.
-     */
-    if(0 != PAL_Initialize(argc, argv))
-    {
-        return FAIL;
-    }
-
-    /* Create a file handle with CreateFile, as READONLY
-     */
-    hFile = CreateFile( lpFileName,
-                        GENERIC_READ,
-                        FILE_SHARE_READ,
-                        NULL,
-                        CREATE_ALWAYS,
-                        FILE_ATTRIBUTE_NORMAL, 
-                        NULL);
-
-    if (hFile == INVALID_HANDLE_VALUE)
-    {
-        Fail("ERROR: %u :unable to create file \"%s\".\n",
-             GetLastError(),
-             lpFileName);
-    }
-
-    /* Attempt to create a unnamed file-mapping object to a READONLY file
-     * as READWRITE access.
-     */
-    hFileMapping = CreateFileMapping(
-                            hFile,
-                            NULL,               /*not inherited*/
-                            PAGE_READWRITE,     /*read and write*/
-                            0,                  /*high-order size*/
-                            MAPPINGSIZE,        /*low-order size*/
-                            NULL);              /*unnamed object*/
-
-    if(NULL != hFileMapping)
-    {
-        Trace("ERROR: Able to create READWRITE mapping to a "
-              "READONLY file.\n" );
-        if( 0 == CloseHandle(hFile) )
-        {
-            Trace("Unexpected Error: Unable to close file handle\n");
-        }
-        Fail("");
-    }
-
-    /* Attempt to create a unnamed file-mapping object to a zero lenght
-     * file.
-     */
-    hFileMapping = CreateFileMapping(
-                            hFile,
-                            NULL,               /*not inherited*/
-                            PAGE_READWRITE,     /*read and write*/
-                            0,                  /*high-order size*/
-                            0,                  /*low-order size*/
-                            NULL);              /*unnamed object*/
-
-    if( NULL != hFileMapping )
-    {
-        Trace("ERROR: Able to create READWRITE mapping to a "
-              "READONLY file.\n" );
-        if( 0 == CloseHandle(hFile) )
-        {
-            Trace("Unexpected Error: Unable to close file handle\n");
-        }
-        Fail("");
-    }
-    if(GetLastError() != ERROR_ACCESS_DENIED)
-    {
-        Trace("ERROR: Expected GetLastError() to return "
-              "ERROR_FILE_INVALID (%d), it returned %u.\n",
-              ERROR_FILE_INVALID,
-              GetLastError());
-        if( 0 == CloseHandle(hFile) )
-        {
-            Trace("Unexpected Error: Unable to close file handle\n");
-        }
-        Fail("");
-    }
-
-    /* Attempt to create a file mapping that is larger than 
-     * the file.
-     */
-    hFileMapping = CreateFileMapping(
-                            hFile,
-                            NULL,               /*not inherited*/
-                            PAGE_READONLY,      /*read only*/
-                            0,                  /*high-order size*/
-                            MAPPINGSIZE,        /*low-order size*/
-                            NULL);              /*unnamed object*/
-    if(NULL != hFileMapping)
-    {
-        Trace("ERROR: Able to create file mapping of size %d to "
-              "file of size 0.\n",
-              MAPPINGSIZE);
-        if( 0 == CloseHandle(hFile) )
-        {
-            Trace("Unexpected Error: Unable to close file handle\n");
-        }
-        Fail("");
-    }
-
-    if(GetLastError() != ERROR_NOT_ENOUGH_MEMORY )
-    {
-        Trace("ERROR: Expected GetLastError() to return "
-              "ERROR_NOT_ENOUGH_MEMORY (%d), it returned %u.\n",
-              ERROR_NOT_ENOUGH_MEMORY,
-              GetLastError());
-        if( 0 == CloseHandle(hFile) )
-        {
-            Trace("Unexpected Error: Unable to close file handle\n");
-        }
-        Fail("");
-    }
-
-    if( 0 == CloseHandle(hFile) )
-    {
-        Fail("Unexpected Error: Unable to close file handle\n");
-    }
-
-    /* Terminate the PAL.
-     */ 
-    PAL_Terminate();
-    return PASS;
-}
-
diff --git a/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test9/testinfo.dat b/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test9/testinfo.dat
deleted file mode 100644 (file)
index c5812e6..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-# Licensed to the .NET Foundation under one or more agreements.
-# The .NET Foundation licenses this file to you under the MIT license.
-
-Version = 1.0
-Section = Filemapping_memmgt
-Function = CreateFileMapping
-Name = CreateFileMappingA negative testing
-TYPE = DEFAULT
-EXE1 = createfilemapping
-Description
-= Negative test the CreateFileMapping API.
index 5835850..07a0914 100644 (file)
@@ -4,7 +4,7 @@
 Version = 1.0
 Section = Filemapping_memmgt
 Function = CreateFileMapping
-Name = CreateFileMappingA - with PAGE_READONLY
+Name = CreateFileMappingW - with PAGE_READONLY
 TYPE = DEFAULT
 EXE1 = createfilemappingw
 Description
diff --git a/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/OpenFileMappingA/CMakeLists.txt b/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/OpenFileMappingA/CMakeLists.txt
deleted file mode 100644 (file)
index d243b82..0000000
+++ /dev/null
@@ -1,4 +0,0 @@
-add_subdirectory(test1)
-add_subdirectory(test2)
-add_subdirectory(test3)
-
diff --git a/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/OpenFileMappingA/test1/CMakeLists.txt b/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/OpenFileMappingA/test1/CMakeLists.txt
deleted file mode 100644 (file)
index 5c2d17a..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-set(SOURCES
-  OpenFileMappingA.cpp
-)
-
-add_executable(paltest_openfilemappinga_test1
-  ${SOURCES}
-)
-
-add_dependencies(paltest_openfilemappinga_test1 coreclrpal)
-
-target_link_libraries(paltest_openfilemappinga_test1
-  ${COMMON_TEST_LIBRARIES}
-)
diff --git a/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/OpenFileMappingA/test1/OpenFileMappingA.cpp b/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/OpenFileMappingA/test1/OpenFileMappingA.cpp
deleted file mode 100644 (file)
index 2313894..0000000
+++ /dev/null
@@ -1,156 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-/*=============================================================
-**
-** Source:  openfilemappinga.c (test 1)
-**
-** Purpose: Positive test the OpenFileMapping API.
-**          Call OpenFileMapping to open a named file-mapping
-**          object with FILE_MAP_ALL_ACCESS access
-**
-**
-**============================================================*/
-#include <palsuite.h>
-
-int __cdecl main(int argc, char *argv[])
-{
-    HANDLE  FileMappingHandle;
-    HANDLE  OpenFileMappingHandle;
-    HANDLE  lpMapViewAddress;
-    const   int LOWORDERSIZE = 1024;
-    char    buf[] = "this is a test";
-    char    MapObject[] = "myMappingObject";
-    char    ch[1024];
-    int     err;
-    int     RetVal = PASS;
-
-    /* Initialize the PAL environment.
-     */
-    err = PAL_Initialize(argc, argv);
-    if(0 != err)
-    {
-        return FAIL;
-    }
-
-
-    /* Create a named file-mapping object with
-     * file handle FileHandle.
-     */
-    FileMappingHandle = CreateFileMapping(
-                            INVALID_HANDLE_VALUE,
-                            NULL,                   /* not inherited */
-                            PAGE_READWRITE,         /* read and write */
-                            0,                      /* high-order size */
-                            LOWORDERSIZE,           /* low-order size */
-                            MapObject);             /* named object */
-
-    if(NULL == FileMappingHandle)
-    {
-        Fail("ERROR:%u:Failed to call CreateFileMapping to "
-             "create a mapping object.\n",
-             GetLastError());
-    }
-    if(GetLastError() == ERROR_ALREADY_EXISTS)
-    {
-        Trace("ERROR:File mapping object already exists\n");
-        RetVal = FAIL;
-        goto CleanUpOne;
-    }
-
-    /* Open a named file-mapping object with 
-     * FILE_MAP_ALL_ACCESS access.
-     */
-    OpenFileMappingHandle =  OpenFileMapping(
-                                FILE_MAP_ALL_ACCESS,
-                                TRUE,
-                                MapObject );
-
-    if(NULL == OpenFileMappingHandle)
-    {
-        Trace("ERROR:%u:Failed to Call OpenFileMapping API!\n",
-              GetLastError());
-        RetVal = FAIL;
-        goto CleanUpOne;
-    }
-
-    /* Test the opened map view.
-     */
-    lpMapViewAddress = MapViewOfFile(
-                            OpenFileMappingHandle,
-                            FILE_MAP_ALL_ACCESS, /* access code */
-                            0,                   /* high order offset */
-                            0,                   /* low order offset */
-                            LOWORDERSIZE);       /* number of bytes for map */
-
-    if(NULL == lpMapViewAddress)
-    {
-        Trace("ERROR:%u: Failed to call MapViewOfFile "
-              "API to map a view of file!\n", 
-              GetLastError());
-        RetVal = FAIL;
-        goto CleanUpTwo;
-    }
-
-    /* Write to the Map View.
-     */
-    memcpy(lpMapViewAddress, buf, strlen(buf));
-    
-    /* Read from the Map View.
-    */
-    memcpy(ch, (LPCSTR)lpMapViewAddress, LOWORDERSIZE); 
-    
-    /* Compare what was written to the Map View,
-     * to what was read.
-     */
-    if (memcmp(ch, buf, strlen(buf))!= 0)
-    {
-        Trace("ERROR: MapViewOfFile not equal to file contents "
-              "retrieved \"%s\", expected \"%s\".\n",
-              ch, buf);
-        RetVal = FAIL;
-        goto CleanUpThree;
-
-    }
-
-CleanUpThree:
-        
-        /* Unmap the view of file.
-         */
-        if ( UnmapViewOfFile(lpMapViewAddress) == FALSE )
-        {
-            Trace("ERROR:%u: Failed to UnmapViewOfFile of \"%0x%lx\".\n",
-                  GetLastError(),
-                  lpMapViewAddress);
-            RetVal = FAIL;
-        }
-
-CleanUpTwo:
-
-        /* Close Handle to opend file mapping.
-         */
-        if ( CloseHandle(OpenFileMappingHandle) == 0 )
-        {
-            Trace("ERROR:%u: Failed to CloseHandle \"0x%lx\".\n",
-                  GetLastError(),
-                  OpenFileMappingHandle);
-            RetVal = FAIL;
-        }
-
-CleanUpOne:
-        
-        /* Close Handle to create file mapping.
-         */
-        if ( CloseHandle(FileMappingHandle) == 0 )
-        {
-            Trace("ERROR:%u: Failed to CloseHandle \"0x%lx\".\n",
-                  GetLastError(),
-                  FileMappingHandle);
-            RetVal = FAIL;
-        }
-
-
-    /* Terminat the PAL.*/
-    PAL_TerminateEx(RetVal);
-    return RetVal;
-}
diff --git a/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/OpenFileMappingA/test1/testinfo.dat b/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/OpenFileMappingA/test1/testinfo.dat
deleted file mode 100644 (file)
index a6021bb..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-# Licensed to the .NET Foundation under one or more agreements.
-# The .NET Foundation licenses this file to you under the MIT license.
-
-Version = 1.0
-Section = Filemapping_memmgt
-Function = OpenFileMappingA
-Name = Positive test for OpenFileMappingA API with FILE_MAP_ALL_ACCESS access
-TYPE = DEFAULT
-EXE1 = openfilemappinga
-Description
-=Test the OpenFileMappingA with FILE_MAP_ALL_ACCESS access
diff --git a/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/OpenFileMappingA/test2/CMakeLists.txt b/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/OpenFileMappingA/test2/CMakeLists.txt
deleted file mode 100644 (file)
index 6dda4b7..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-set(SOURCES
-  OpenFileMappingA.cpp
-)
-
-add_executable(paltest_openfilemappinga_test2
-  ${SOURCES}
-)
-
-add_dependencies(paltest_openfilemappinga_test2 coreclrpal)
-
-target_link_libraries(paltest_openfilemappinga_test2
-  ${COMMON_TEST_LIBRARIES}
-)
diff --git a/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/OpenFileMappingA/test2/OpenFileMappingA.cpp b/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/OpenFileMappingA/test2/OpenFileMappingA.cpp
deleted file mode 100644 (file)
index a8a2ce2..0000000
+++ /dev/null
@@ -1,213 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-/*=============================================================
-**
-** Source:  openfilemappinga.c (test 2)
-**
-** Purpose: Positive test the OpenFileMapping API.
-**          Call OpenFileMapping to open a named file-mapping
-**          object with FILE_MAP_WRITE access
-**
-**
-**============================================================*/
-#include <palsuite.h>
-
-int __cdecl main(int argc, char *argv[])
-{
-    HANDLE  FileMappingHandle;
-    HANDLE  OpenFileMappingHandle;
-    HANDLE  lpMapViewAddress;
-    HANDLE  OpenFileMappingHandle2;
-    HANDLE  lpMapViewAddress2;
-    const   int LOWORDERSIZE = 1024;
-    char    MapObject[] = "myMappingObject";
-    char    buf[] = "this is a test";
-    char    ch[1024];
-    int     RetVal = PASS;
-
-
-    /* Initialize the PAL environment.
-     */
-    if(0 != PAL_Initialize(argc, argv))
-    {
-        return FAIL;
-    }
-
-    /* Create a named file-mapping object with file handle FileHandle.
-     */
-    FileMappingHandle = CreateFileMapping(
-                                INVALID_HANDLE_VALUE,
-                                NULL,               /* not inherited */
-                                PAGE_READWRITE,     /* read and write */
-                                0,                  /* high-order size */
-                                LOWORDERSIZE,       /* low-order size */
-                                MapObject);         /* named object */
-
-
-    if(NULL == FileMappingHandle) 
-    {
-        Fail("\nFailed to call CreateFileMapping to create "
-             "a mapping object!\n");
-    }
-    if(GetLastError() == ERROR_ALREADY_EXISTS)
-    {
-        Trace("\nFile mapping object already exists!\n");
-        RetVal = FAIL;
-        goto CleanUpOne;
-    }
-
-    /* Open a named file-mapping object with FILE_MAP_WRITE access.
-     */
-    OpenFileMappingHandle =  OpenFileMapping(
-                                    FILE_MAP_WRITE,
-                                    FALSE,
-                                    MapObject);
-
-    if(NULL == OpenFileMappingHandle)
-    {
-        Trace("\nFailed to Call OpenFileMapping API!\n");
-        RetVal = FAIL;
-        goto CleanUpOne;
-    }
-
-    /* Open a named file-mapping object with 
-     * FILE_MAP_ALL_ACCESS access, to verify
-     * the FILE_MAP_WRITE access map.
-     */
-    OpenFileMappingHandle2 =  OpenFileMapping(
-                                    FILE_MAP_ALL_ACCESS,
-                                    FALSE,
-                                    MapObject);
-
-    if(NULL == OpenFileMappingHandle2)
-    {
-        Trace("\nFailed to Call OpenFileMapping API!\n");
-        RetVal = FAIL;
-        goto CleanUpTwo;
-    }
-
-    /* Create map view of the open mapping that has
-     * FILE_MAP_WRITE access.
-     */
-    lpMapViewAddress = MapViewOfFile(
-                            OpenFileMappingHandle,
-                            FILE_MAP_WRITE,      /* access code */
-                            0,                   /* high order offset */
-                            0,                   /* low order offset */
-                            LOWORDERSIZE);       /* number of bytes for map */
-
-    if(NULL == lpMapViewAddress)
-    {
-        Trace("ERROR:%u: Failed to call MapViewOfFile "
-              "API to map a view of file!\n", 
-              GetLastError());
-        RetVal = FAIL;
-        goto CleanUpThree;
-    }
-
-    /* Create map view of the open mapping that has
-     * FILE_MAP_ALL_ACCESS access.
-     */
-    lpMapViewAddress2 = MapViewOfFile(
-                            OpenFileMappingHandle2,
-                            FILE_MAP_ALL_ACCESS, /* access code */
-                            0,                   /* high order offset */
-                            0,                   /* low order offset */
-                            LOWORDERSIZE);       /* number of bytes for map */
-
-    if(NULL == lpMapViewAddress2)
-    {
-        Trace("ERROR:%u: Failed to call MapViewOfFile "
-              "API to map a view of file!\n", 
-              GetLastError());
-        RetVal = FAIL;
-        goto CleanUpFour;
-    }
-
-    /* Write to the Map View.
-     */
-    memcpy(lpMapViewAddress, buf, strlen(buf));
-    
-    /* Read from the Map View.
-    */
-    memcpy(ch, (LPCSTR)lpMapViewAddress, LOWORDERSIZE); 
-    
-    /* Compare what was written to the Map View,
-     * to what was read.
-     */
-    if (memcmp(ch, buf, strlen(buf))!= 0)
-    {
-        Fail("ERROR: MapViewOfFile not equal to file contents "
-             "retrieved \"%s\", expected \"%s\".\n",
-             ch, buf);
-        RetVal = FAIL;
-        goto CleanUpFive;
-    }
-
-CleanUpFive:
-        
-        /* Unmap the view of file.
-         */
-        if ( UnmapViewOfFile(lpMapViewAddress2) == FALSE )
-        {
-            Trace("ERROR:%u: Failed to UnmapViewOfFile of \"%0x%lx\".\n",
-                  GetLastError(),
-                  lpMapViewAddress2);
-            RetVal = FAIL;
-        }
-
-CleanUpFour:
-        
-        /* Unmap the view of file.
-         */
-        if ( UnmapViewOfFile(lpMapViewAddress) == FALSE )
-        {
-            Trace("ERROR:%u: Failed to UnmapViewOfFile of \"%0x%lx\".\n",
-                  GetLastError(),
-                  lpMapViewAddress);
-            RetVal = FAIL;
-        }
-
-CleanUpThree:
-
-        /* Close Handle to opened file mapping.
-         */
-        if ( CloseHandle(OpenFileMappingHandle2) == 0 )
-        {
-            Trace("ERROR:%u: Failed to CloseHandle \"0x%lx\".\n",
-                  GetLastError(),
-                  OpenFileMappingHandle2);
-            RetVal = FAIL;
-        }
-
-CleanUpTwo:
-
-        /* Close Handle to opened file mapping.
-         */
-        if ( CloseHandle(OpenFileMappingHandle) == 0 )
-        {
-            Trace("ERROR:%u: Failed to CloseHandle \"0x%lx\".\n",
-                  GetLastError(),
-                  OpenFileMappingHandle);
-            RetVal = FAIL;
-        }
-
-CleanUpOne:
-        
-        /* Close Handle to create file mapping.
-         */
-        if ( CloseHandle(FileMappingHandle) == 0 )
-        {
-            Trace("ERROR:%u: Failed to CloseHandle \"0x%lx\".\n",
-                  GetLastError(),
-                  FileMappingHandle);
-            RetVal = FAIL;
-        }
-    
-
-    /* Terminate the PAL.
-     */
-    PAL_TerminateEx(RetVal);
-    return RetVal;
-}
diff --git a/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/OpenFileMappingA/test2/testinfo.dat b/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/OpenFileMappingA/test2/testinfo.dat
deleted file mode 100644 (file)
index 4d7fca5..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-# Licensed to the .NET Foundation under one or more agreements.
-# The .NET Foundation licenses this file to you under the MIT license.
-
-Version = 1.0
-Section = Filemapping_memmgt
-Function = OpenFileMappingA
-Name = Positive test for OpenFileMappingA API with FILE_MAP_WRITE access
-TYPE = DEFAULT
-EXE1 = openfilemappinga
-Description
-=Test the OpenFileMappingA with FILE_MAP_WRITE access
diff --git a/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/OpenFileMappingA/test3/CMakeLists.txt b/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/OpenFileMappingA/test3/CMakeLists.txt
deleted file mode 100644 (file)
index 8bcd7c4..0000000
+++ /dev/null
@@ -1,13 +0,0 @@
-set(SOURCES
-  OpenFileMappingA.cpp
-)
-
-add_executable(paltest_openfilemappinga_test3
-  ${SOURCES}
-)
-
-add_dependencies(paltest_openfilemappinga_test3 coreclrpal)
-
-target_link_libraries(paltest_openfilemappinga_test3
-  ${COMMON_TEST_LIBRARIES}
-)
diff --git a/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/OpenFileMappingA/test3/OpenFileMappingA.cpp b/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/OpenFileMappingA/test3/OpenFileMappingA.cpp
deleted file mode 100644 (file)
index f26c734..0000000
+++ /dev/null
@@ -1,216 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-/*=============================================================
-**
-** Source:  openfilemappinga.c
-**
-** Purpose: Positive test the OpenFileMapping API.
-**          Call OpenFileMapping to open a named file-mapping
-**          object with FILE_MAP_READ access
-**
-**
-**============================================================*/
-#include <palsuite.h>
-
-
-int __cdecl main(int argc, char *argv[])
-{
-
-    HANDLE  FileMappingHandle;
-    HANDLE  OpenFileMappingHandle;
-    HANDLE  OpenFileMappingHandle2;
-    HANDLE  lpMapViewAddress;
-    HANDLE  lpMapViewAddress2;
-    const   int LOWORDERSIZE = 1024;
-    char    buf[] = "this is a test";
-    char    MapObject[] = "myMappingObject";
-    char    ch[1024];
-    int     RetVal = PASS;
-
-    /* Initialize the PAL environment.
-     */
-    if(0 != PAL_Initialize(argc, argv))
-    {
-        return FAIL;
-    }
-
-    /* Create a named file-mapping object with file handle FileHandle.
-     */
-    FileMappingHandle = CreateFileMapping(
-                                INVALID_HANDLE_VALUE,
-                                NULL,               /* Not inherited */
-                                PAGE_READWRITE,     /* Read only */
-                                0,                  /* High-order size */
-                                LOWORDERSIZE,       /* Must be none 0 */
-                                MapObject);         /* Named object */
-
-
-    if(NULL == FileMappingHandle) 
-    {
-        Fail("ERROR:%u:Failed to call CreateFileMapping to create "
-             "mapping object = \"%s\".\n",
-             GetLastError(),
-             MapObject);
-    }
-    if(GetLastError() == ERROR_ALREADY_EXISTS)
-    {
-        Trace("ERROR:File mapping object \"%s\" already exists!\n",
-               MapObject);
-        RetVal = FAIL;
-        goto CleanUpOne;
-    }
-
-    /* Open a named file-mapping object with 
-     * FILE_MAP_READ access.
-     */
-    OpenFileMappingHandle =  OpenFileMapping(
-                                    FILE_MAP_READ,
-                                    0,
-                                    MapObject);
-
-    if(NULL == OpenFileMappingHandle)
-    {
-        Trace("ERROR:%u: Failed to Call OpenFileMapping API.\n");
-        RetVal = FAIL;
-        goto CleanUpOne;
-    }
-
-    /* Open a named file-mapping object with 
-     * FILE_MAP_ALL_ACCESS access, to verify the 
-     * READ-ONLY Map view.
-     */
-    OpenFileMappingHandle2 =  OpenFileMapping(
-                                    FILE_MAP_ALL_ACCESS,
-                                    0,
-                                    MapObject);
-
-    if(NULL == OpenFileMappingHandle2)
-    {
-        Trace("Failed to Call OpenFileMapping API!\n");
-        RetVal = FAIL;
-        goto CleanUpTwo;
-    }
-
-    /* Test the opened map view.
-     */
-    lpMapViewAddress = MapViewOfFile(
-                            OpenFileMappingHandle,
-                            FILE_MAP_READ,       /* access code */
-                            0,                   /* high order offset */
-                            0,                   /* low order offset */
-                            LOWORDERSIZE);       /* number of bytes for map */
-
-    if(NULL == lpMapViewAddress)
-    {
-        Trace("ERROR:%u: Failed to call MapViewOfFile "
-              "API to map a view of file!\n", 
-              GetLastError());
-        RetVal = FAIL;
-        goto CleanUpThree;
-    }
-
-    /* Open the second Map view to verify the writing
-     * of the READ-ONLY Map view.
-     */
-    lpMapViewAddress2 = MapViewOfFile(
-                            OpenFileMappingHandle2,
-                            FILE_MAP_ALL_ACCESS, /* access code */
-                            0,                   /* high order offset */
-                            0,                   /* low order offset */
-                            LOWORDERSIZE);       /* number of bytes for map */
-
-    if(NULL == lpMapViewAddress2)
-    {
-        Trace("ERROR:%u: Failed to call MapViewOfFile "
-              "API to map a view of file!\n", 
-              GetLastError());
-        RetVal = FAIL;
-        goto CleanUpFour;
-    }
-
-    /* Write to the ALL_ACCESS Map View.
-     */
-    memcpy(lpMapViewAddress2, buf, strlen(buf));
-
-    /* Read from the READ-ONLY Map View.
-    */
-    memcpy(ch, (LPCSTR)lpMapViewAddress, LOWORDERSIZE); 
-    
-    /* Compare what was written to the Map View,
-     * to what was read.
-     */
-    if (memcmp(ch, buf, strlen(buf))!= 0)
-    {
-        Trace("ERROR: MapViewOfFile not equal to file contents "
-              "retrieved \"%s\", expected \"%s\".\n",
-              ch, buf);
-        RetVal = FAIL;
-        goto CleanUpFive;
-    }
-
-CleanUpFive:
-        
-        /* Unmap the view of file.
-         */
-        if ( UnmapViewOfFile(lpMapViewAddress2) == FALSE )
-        {
-            Trace("ERROR:%u: Failed to UnmapViewOfFile of \"%0x%lx\".\n",
-                  GetLastError(),
-                  lpMapViewAddress2);
-            RetVal = FAIL;
-        }
-
-CleanUpFour:
-        
-        /* Unmap the view of file.
-         */
-        if ( UnmapViewOfFile(lpMapViewAddress) == FALSE )
-        {
-            Trace("ERROR:%u: Failed to UnmapViewOfFile of \"%0x%lx\".\n",
-                  GetLastError(),
-                  lpMapViewAddress);
-            RetVal = FAIL;
-        }
-
-CleanUpThree:
-
-        /* Close Handle to opened file mapping.
-         */
-        if ( CloseHandle(OpenFileMappingHandle2) == 0 )
-        {
-            Trace("ERROR:%u: Failed to CloseHandle \"0x%lx\".\n",
-                  GetLastError(),
-                  OpenFileMappingHandle2);
-            RetVal = FAIL;
-        }
-
-CleanUpTwo:
-
-        /* Close Handle to opened file mapping.
-         */
-        if ( CloseHandle(OpenFileMappingHandle) == 0 )
-        {
-            Trace("ERROR:%u: Failed to CloseHandle \"0x%lx\".\n",
-                  GetLastError(),
-                  OpenFileMappingHandle);
-            RetVal = FAIL;
-        }
-
-CleanUpOne:
-        
-        /* Close Handle to create file mapping.
-         */
-        if ( CloseHandle(FileMappingHandle) == 0 )
-        {
-            Trace("ERROR:%u: Failed to CloseHandle \"0x%lx\".\n",
-                  GetLastError(),
-                  FileMappingHandle);
-            RetVal = FAIL;
-        }
-
-    /* Terminate the PAL.
-     */
-    PAL_TerminateEx(RetVal);
-    return RetVal;
-}
diff --git a/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/OpenFileMappingA/test3/testinfo.dat b/src/coreclr/src/pal/tests/palsuite/filemapping_memmgt/OpenFileMappingA/test3/testinfo.dat
deleted file mode 100644 (file)
index a6b02d8..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-# Licensed to the .NET Foundation under one or more agreements.
-# The .NET Foundation licenses this file to you under the MIT license.
-
-Version = 1.0
-Section = Filemapping_memmgt
-Function = OpenFileMappingA
-Name = Positive test for OpenFileMappingA API with FILE_MAP_READ access
-TYPE = DEFAULT
-EXE1 = openfilemappinga
-Description
-=Test the OpenFileMappingA with FILE_MAP_READ access
index 4547132..758fdeb 100644 (file)
@@ -441,11 +441,6 @@ exception_handling/RaiseException/test1/paltest_raiseexception_test1
 exception_handling/RaiseException/test2/paltest_raiseexception_test2
 exception_handling/RaiseException/test3/paltest_raiseexception_test3
 exception_handling/pal_sxs/test1/paltest_pal_sxs_test1
-filemapping_memmgt/CreateFileMappingA/test1/paltest_createfilemappinga_test1
-filemapping_memmgt/CreateFileMappingA/test3/paltest_createfilemappinga_test3
-filemapping_memmgt/CreateFileMappingA/test4/paltest_createfilemappinga_test4
-filemapping_memmgt/CreateFileMappingA/test8/paltest_createfilemappinga_test8
-filemapping_memmgt/CreateFileMappingA/test9/paltest_createfilemappinga_test9
 filemapping_memmgt/CreateFileMappingW/test1/paltest_createfilemappingw_test1
 filemapping_memmgt/CreateFileMappingW/test3/paltest_createfilemappingw_test3
 filemapping_memmgt/CreateFileMappingW/test4/paltest_createfilemappingw_test4
@@ -636,8 +631,6 @@ samples/test1/paltest_samples_test1
 threading/CreateEventW/test1/paltest_createeventw_test1
 threading/CreateEventW/test2/paltest_createeventw_test2
 threading/CreateMutexW_ReleaseMutex/test1/paltest_createmutexw_releasemutex_test1
-threading/CreateProcessA/test1/paltest_createprocessa_test1
-threading/CreateProcessA/test2/paltest_createprocessa_test2
 threading/CreateProcessW/test1/paltest_createprocessw_test1
 threading/CreateProcessW/test2/paltest_createprocessw_test2
 threading/CreateSemaphoreW_ReleaseSemaphore/test1/paltest_createsemaphorew_releasesemaphore_test1
index 76aae2e..37c7d6e 100644 (file)
@@ -53,9 +53,6 @@ exception_handling/PAL_TRY_EXCEPT_EX/test1/paltest_pal_try_except_ex_test1
 exception_handling/PAL_TRY_EXCEPT_EX/test2/paltest_pal_try_except_ex_test2
 exception_handling/PAL_TRY_EXCEPT_EX/test3/paltest_pal_try_except_ex_test3
 exception_handling/PAL_TRY_LEAVE_FINALLY/test1/paltest_pal_try_leave_finally_test1
-filemapping_memmgt/CreateFileMappingA/test5/paltest_createfilemappinga_test5
-filemapping_memmgt/CreateFileMappingA/test6/paltest_createfilemappinga_test6
-filemapping_memmgt/CreateFileMappingA/test7/paltest_createfilemappinga_test7
 filemapping_memmgt/CreateFileMappingW/CreateFileMapping_neg1/paltest_createfilemappingw_createfilemapping_neg1
 filemapping_memmgt/CreateFileMappingW/test2/paltest_createfilemappingw_test2
 filemapping_memmgt/CreateFileMappingW/test5/paltest_createfilemappingw_test5
@@ -67,9 +64,6 @@ filemapping_memmgt/GetModuleFileNameA/test1/paltest_getmodulefilenamea_test1
 filemapping_memmgt/GetModuleFileNameW/test1/paltest_getmodulefilenamew_test1
 filemapping_memmgt/GetProcAddress/test1/paltest_getprocaddress_test1
 filemapping_memmgt/GetProcAddress/test2/paltest_getprocaddress_test2
-filemapping_memmgt/OpenFileMappingA/test1/paltest_openfilemappinga_test1
-filemapping_memmgt/OpenFileMappingA/test2/paltest_openfilemappinga_test2
-filemapping_memmgt/OpenFileMappingA/test3/paltest_openfilemappinga_test3
 filemapping_memmgt/OpenFileMappingW/test1/paltest_openfilemappingw_test1
 filemapping_memmgt/OpenFileMappingW/test2/paltest_openfilemappingw_test2
 filemapping_memmgt/OpenFileMappingW/test3/paltest_openfilemappingw_test3
index 03f7c77..d721925 100644 (file)
@@ -1,6 +1,5 @@
 add_subdirectory(CreateEventW)
 add_subdirectory(CreateMutexW_ReleaseMutex)
-add_subdirectory(CreateProcessA)
 add_subdirectory(CreateProcessW)
 add_subdirectory(CreateSemaphoreW_ReleaseSemaphore)
 add_subdirectory(CreateThread)
diff --git a/src/coreclr/src/pal/tests/palsuite/threading/CreateProcessA/CMakeLists.txt b/src/coreclr/src/pal/tests/palsuite/threading/CreateProcessA/CMakeLists.txt
deleted file mode 100644 (file)
index 6545353..0000000
+++ /dev/null
@@ -1,3 +0,0 @@
-add_subdirectory(test1)
-add_subdirectory(test2)
-
diff --git a/src/coreclr/src/pal/tests/palsuite/threading/CreateProcessA/test1/CMakeLists.txt b/src/coreclr/src/pal/tests/palsuite/threading/CreateProcessA/test1/CMakeLists.txt
deleted file mode 100644 (file)
index 869f813..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-set(TESTSOURCES
-  parentProcess.cpp
-)
-
-add_executable(paltest_createprocessa_test1
-  ${TESTSOURCES}
-)
-
-add_dependencies(paltest_createprocessa_test1 coreclrpal)
-
-target_link_libraries(paltest_createprocessa_test1
-  ${COMMON_TEST_LIBRARIES}
-)
-
-
-set(HELPERSOURCES
-  childProcess.cpp
-)
-
-add_executable(paltest_createprocessa_test1_child
-  ${HELPERSOURCES}
-)
-
-add_dependencies(paltest_createprocessa_test1_child coreclrpal)
-
-target_link_libraries(paltest_createprocessa_test1_child
-  ${COMMON_TEST_LIBRARIES}
-)
diff --git a/src/coreclr/src/pal/tests/palsuite/threading/CreateProcessA/test1/childProcess.cpp b/src/coreclr/src/pal/tests/palsuite/threading/CreateProcessA/test1/childProcess.cpp
deleted file mode 100644 (file)
index 27a3265..0000000
+++ /dev/null
@@ -1,130 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-/*============================================================
-**
-** Source: CreateProcessA/test1/childprocess.c
-**
-** Purpose: Test to ensure CreateProcessA starts a new process.  This test 
-** launches a child process, and examines a file written by the child.
-** This code is the child code.
-**
-** Dependencies: GetCurrentDirectory
-**               strlen
-**               fopen
-**               fclose
-**               fprintf
-** 
-
-**
-**=========================================================*/
-
-#include <palsuite.h>
-
-const char *szCommonFileA = "childdata.tmp";
-
-const char *szPathDelimA = "\\";
-
-const char *szCommonStringA = "058d2d057111a313aa82401c2e856002\0";
-
-/*
- * Take two wide strings representing file and directory names
- * (dirName, fileName), join the strings with the appropriate path
- * delimiter and populate a wide character buffer (absPathName) with
- * the resulting string.
- *
- * Returns: The number of wide characters in the resulting string.
- * 0 is returned on Error.
- */
-int 
-mkAbsoluteFilenameA ( 
-    LPSTR dirName,  
-    DWORD dwDirLength, 
-    LPCSTR fileName, 
-    DWORD dwFileLength,
-    LPSTR absPathName )
-{
-    extern const char *szPathDelimA;
-
-    DWORD sizeDN, sizeFN, sizeAPN;
-    
-    sizeDN = strlen( dirName );
-    sizeFN = strlen( fileName );
-    sizeAPN = (sizeDN + 1 + sizeFN + 1);
-    
-    /* insure ((dirName + DELIM + fileName + \0) =< _MAX_PATH ) */
-    if ( sizeAPN > _MAX_PATH )
-    {
-       return ( 0 );
-    }
-    
-    strncpy(absPathName, dirName, dwDirLength +1);
-    strncpy(absPathName, szPathDelimA, 2);
-    strncpy(absPathName, fileName, dwFileLength +1);
-    
-    return (sizeAPN);
-  
-} 
-
-int __cdecl main( int argc, char **argv ) 
-{
-
-    static FILE * fp;
-
-    DWORD dwFileLength;
-    DWORD dwDirLength;
-    DWORD dwSize;
-    
-    char szDirNameA[_MAX_DIR];
-    char szAbsPathNameA[_MAX_PATH];
-
-    if(0 != (PAL_Initialize(argc, argv)))
-    {
-        return ( FAIL );
-    }
-
-    dwDirLength = GetCurrentDirectory( _MAX_PATH, szDirNameA );
-
-    if (0 == dwDirLength) 
-    {
-       Fail ("GetCurrentDirectory call failed.  Could not get "
-               "current working directory\n.  Exiting.\n");
-    }
-
-    dwFileLength = strlen( szCommonFileA );
-
-    dwSize = mkAbsoluteFilenameA( szDirNameA, dwDirLength, szCommonFileA, 
-                                 dwFileLength, szAbsPathNameA );
-
-    if (0 == dwSize)
-    {
-       Fail ("Palsuite Code: mkAbsoluteFilename() call failed.  Could "
-               "not build absolute path name to file\n.  Exiting.\n");
-    }
-    
-    if ( NULL == ( fp = fopen ( szAbsPathNameA , "w+" ) ) ) 
-    {
-       /* 
-        * A return value of NULL indicates an error condition or an
-        * EOF condition 
-        */
-       Fail ("%s unable to open %s for writing.  Exiting.\n", argv[0]
-             , szAbsPathNameA );
-    }
-
-    if ( 0 >= ( fprintf ( fp, "%s", szCommonStringA )))
-    {
-       Fail("%s unable to write to %s. Exiting.\n", argv[0]
-            , szAbsPathNameA );
-    }
-    
-    if (0 != (fclose ( fp ))) 
-    {
-       Fail ("%s unable to close file %s.  Pid may not be "
-             "written to file. Exiting.\n", argv[0], szAbsPathNameA );
-    }
-
-    PAL_Terminate();
-    return ( PASS );    
-    
-}
diff --git a/src/coreclr/src/pal/tests/palsuite/threading/CreateProcessA/test1/parentProcess.cpp b/src/coreclr/src/pal/tests/palsuite/threading/CreateProcessA/test1/parentProcess.cpp
deleted file mode 100644 (file)
index 145bb18..0000000
+++ /dev/null
@@ -1,200 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-/*============================================================
-**
-** Source: CreateProcessA/test1/parentprocess.c
-**
-** Purpose: Test to ensure CreateProcessA starts a new process.  This test 
-** launches a child process, and examines a file written by the child.
-** This process (the parent process) reads the file created by the child and 
-** compares the value the child wrote to the file.  (a const char *)
-**
-** Dependencies: GetCurrentDirectory
-**               strlen
-**               WaitForSingleObject
-**               fopen
-**               fclose
-**               Fail
-** 
-
-**
-**=========================================================*/
-
-#include <palsuite.h>
-
-const char *szCommonFileA = "childdata.tmp";
-
-const char *szChildFileA = "paltest_createprocessa_test1_child";
-
-const char *szPathDelimA = "\\";
-
-const char *szCommonStringA = "058d2d057111a313aa82401c2e856002\0";
-
-/*
- * Take two wide strings representing file and directory names
- * (dirName, fileName), join the strings with the appropriate path
- * delimiter and populate a wide character buffer (absPathName) with
- * the resulting string.
- *
- * Returns: The number of wide characters in the resulting string.
- * 0 is returned on Error.
- */
-int 
-mkAbsoluteFilenameA ( 
-    LPSTR dirName,  
-    DWORD dwDirLength, 
-    LPCSTR fileName, 
-    DWORD dwFileLength,
-    LPSTR absPathName )
-{
-    extern const char *szPathDelimA;
-
-    DWORD sizeDN, sizeFN, sizeAPN;
-    
-    sizeDN = strlen( dirName );
-    sizeFN = strlen( fileName );
-    sizeAPN = (sizeDN + 1 + sizeFN + 1);
-    
-    /* insure ((dirName + DELIM + fileName + \0) =< _MAX_PATH ) */
-    if ( sizeAPN > _MAX_PATH )
-    {
-       return ( 0 );
-    }
-    
-    strncpy(absPathName, dirName, dwDirLength +1);
-    strncpy(absPathName, szPathDelimA, 2);
-    strncpy(absPathName, fileName, dwFileLength +1);
-    
-    return (sizeAPN);
-  
-} 
-
-int __cdecl main( int argc, char **argv ) 
-
-{
-
-    STARTUPINFO si;
-    PROCESS_INFORMATION pi;
-
-    static FILE * fp;
-
-    DWORD dwFileLength;
-    DWORD dwDirLength;
-    DWORD dwSize;
-    
-    size_t cslen;
-    
-    char szReadStringA[256];
-
-    char szDirNameA[_MAX_DIR];  
-    char absPathBuf[_MAX_PATH];
-    char *szAbsPathNameA;
-
-
-    if(0 != (PAL_Initialize(argc, argv)))
-    {
-       return ( FAIL );
-    }
-    
-    ZeroMemory ( &si, sizeof(si) );
-    si.cb = sizeof(si);
-    ZeroMemory ( &pi, sizeof(pi) );
-    
-    szAbsPathNameA=&absPathBuf[0];
-    dwFileLength = strlen( szChildFileA );
-
-    dwDirLength = GetCurrentDirectory(_MAX_PATH, szDirNameA);
-
-    if (0 == dwDirLength) 
-    {
-       Fail ("GetCurrentDirectory call failed.  Could not get "
-               "current working directory\n.  Exiting.\n");
-    }
-
-    dwSize = mkAbsoluteFilenameA( szDirNameA, dwDirLength, szChildFileA, 
-                                 dwFileLength, szAbsPathNameA );
-
-    if (0 == dwSize)
-    {
-       Fail ("Palsuite Code: mkAbsoluteFilename() call failed.  Could "
-               "not build absolute path name to file\n.  Exiting.\n");
-    }
-
-    if ( !CreateProcessA ( NULL,  
-                          szAbsPathNameA,
-                          NULL,          
-                          NULL,          
-                          FALSE,         
-                          CREATE_NEW_CONSOLE,
-                          NULL,              
-                          NULL,              
-                          &si,               
-                          &pi )              
-       )
-    {
-       Fail ( "CreateProcess call failed.  GetLastError returned %d\n", 
-                GetLastError() );
-    }
-    
-    WaitForSingleObject ( pi.hProcess, INFINITE );
-       
-    szAbsPathNameA=&absPathBuf[0];
-
-    dwFileLength = strlen( szCommonFileA );
-
-    dwSize = mkAbsoluteFilenameA( szDirNameA, dwDirLength, szCommonFileA, 
-                                 dwFileLength, szAbsPathNameA );
-    
-    /* set the string length for the open call*/
-
-    if (0 == dwSize)
-    {
-       Fail ("Palsuite Code: mkAbsoluteFilename() call failed.  Could "
-               "not build absolute path name to file\n.  Exiting.\n");
-    }
-
-    if ( NULL == ( fp = fopen ( szAbsPathNameA , "r" ) ) )
-    {
-       Fail ("%s\nunable to open %s\nfor reading.  Exiting.\n", argv[0], 
-             szAbsPathNameA );
-    }
-
-    cslen = strlen ( szCommonStringA );
-
-    if ( NULL == fgets( szReadStringA, (cslen + 1), fp ))
-    {
-       /* 
-        * A return value of NULL indicates an error condition or an
-        * EOF condition 
-        */
-       Fail ("%s\nunable to read file\n%s\nszReadStringA is %s\n"
-             "Exiting.\n", argv[0], szAbsPathNameA, 
-             szReadStringA );
-
-    }
-    if ( 0 != strncmp( szReadStringA, szCommonStringA, cslen ))
-    {
-       Fail ("string comparison failed.\n  szReadStringA is %s and\n"
-             "szCommonStringA is %s\n", szReadStringA,
-             szCommonStringA );
-    }
-    else
-    {
-       Trace ("string comparison passed.\n");
-    }
-    
-    if (0 != (fclose ( fp ))) 
-    {
-       Trace ("%s unable to close file %s.  This may cause a file pointer "
-              "leak.  Continuing.\n", argv[0], szAbsPathNameA );
-    }
-
-    /* Close process and thread handle */
-    CloseHandle ( pi.hProcess );
-    CloseHandle ( pi.hThread );
-
-    PAL_Terminate();
-    return ( PASS );
-
-}
diff --git a/src/coreclr/src/pal/tests/palsuite/threading/CreateProcessA/test1/testinfo.dat b/src/coreclr/src/pal/tests/palsuite/threading/CreateProcessA/test1/testinfo.dat
deleted file mode 100644 (file)
index cee46a2..0000000
+++ /dev/null
@@ -1,16 +0,0 @@
-# Licensed to the .NET Foundation under one or more agreements.
-# The .NET Foundation licenses this file to you under the MIT license.
-
-Version = 1.0
-Section = threading
-Function = CreateProcessA
-Name = Positive Test for CreateProcessA
-TYPE = DEFAULT
-EXE1 = parentprocess
-EXE2 = childprocess
-Description 
-= Test the CreateProcessA function.  The test executes the childprocess 
-= program.  The childprocess program launches and writes a const char string
-= to a file childdata.  The parent waits for the completion of childprocess
-= and then reads the string from the childdata file.  If the string in the 
-= file matches it's copy of the const char string, then the test succeeds.
diff --git a/src/coreclr/src/pal/tests/palsuite/threading/CreateProcessA/test2/CMakeLists.txt b/src/coreclr/src/pal/tests/palsuite/threading/CreateProcessA/test2/CMakeLists.txt
deleted file mode 100644 (file)
index 20c1343..0000000
+++ /dev/null
@@ -1,28 +0,0 @@
-set(TESTSOURCES
-  parentprocess.cpp
-)
-
-add_executable(paltest_createprocessa_test2
-  ${TESTSOURCES}
-)
-
-add_dependencies(paltest_createprocessa_test2 coreclrpal)
-
-target_link_libraries(paltest_createprocessa_test2
-  ${COMMON_TEST_LIBRARIES}
-)
-
-
-set(HELPERSOURCES
-  childprocess.cpp
-)
-
-add_executable(paltest_createprocessa_test2_child
-  ${HELPERSOURCES}
-)
-
-add_dependencies(paltest_createprocessa_test2_child coreclrpal)
-
-target_link_libraries(paltest_createprocessa_test2_child
-  ${COMMON_TEST_LIBRARIES}
-)
diff --git a/src/coreclr/src/pal/tests/palsuite/threading/CreateProcessA/test2/childprocess.cpp b/src/coreclr/src/pal/tests/palsuite/threading/CreateProcessA/test2/childprocess.cpp
deleted file mode 100644 (file)
index f1ac147..0000000
+++ /dev/null
@@ -1,68 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-/*============================================================
-**
-** Source: createprocessa/test2/childprocess.c
-**
-** Purpose: This child process reads a string from stdin
-**          and writes it out to stdout & stderr
-**
-** Dependencies: memset
-**               fgets
-**               gputs
-** 
-
-**
-**=========================================================*/
-
-#include <palsuite.h>
-#include "test2.h"
-
-
-
-int __cdecl main( int argc, char **argv ) 
-{
-    int iRetCode = EXIT_OK_CODE; /* preset exit code to OK */
-    char szBuf[BUF_LEN];
-
-
-    if(0 != (PAL_Initialize(argc, argv)))
-    {
-        return FAIL;
-    }
-
-    if (argc != 4)
-    {
-        return EXIT_ERR_CODE3;
-    }
-
-    if (strcmp(argv[1], szArg1) != 0
-        || strcmp(argv[2], szArg2) != 0
-        || strcmp(argv[3], szArg3) != 0)
-    {
-        return EXIT_ERR_CODE4;
-    }
-
-
-    memset(szBuf, 0, BUF_LEN);
-
-    /* Read the string that was written by the parent */
-    if (fgets(szBuf, BUF_LEN, stdin) == NULL)
-    {
-        return EXIT_ERR_CODE1;
-    }
-
-    /* Write the string out to the stdout & stderr pipes */
-    if (fputs(szBuf, stdout) == EOF
-        || fputs(szBuf, stderr) == EOF)
-    {
-        return EXIT_ERR_CODE2;
-    }
-
-    /* The exit code will indicate success or failure */
-    PAL_TerminateEx(iRetCode);
-
-    /* Return special exit code to indicate success or failure */
-    return iRetCode;
-}
diff --git a/src/coreclr/src/pal/tests/palsuite/threading/CreateProcessA/test2/parentprocess.cpp b/src/coreclr/src/pal/tests/palsuite/threading/CreateProcessA/test2/parentprocess.cpp
deleted file mode 100644 (file)
index 9f80e34..0000000
+++ /dev/null
@@ -1,242 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-/*============================================================
-**
-** Source: createprocessa/test2/parentprocess.c
-**
-** Purpose: Test the following features of CreateProcessA:
-**          - Check to see if hProcess & hThread are set in 
-**            return PROCESS_INFORMATION structure
-**          - Check to see if stdin, stdout, & stderr handles
-**            are used when STARTF_USESTDHANDLES is specified
-**            in STARUPINFO flags and bInheritHandles = TRUE
-**          - Check to see that proper arguments are passed to
-**            child process
-**
-** Dependencies: CreatePipe
-**               strcpy, strlen, strncmp, memset
-**               WaitForSingleObject
-**               WriteFile, ReadFile
-**               GetExitCodeProcess
-** 
-
-**
-**=========================================================*/
-
-#include <palsuite.h>
-#include "test2.h"
-
-
-
-int __cdecl main( int argc, char **argv ) 
-{
-
-    /*******************************************
-     *  Declarations
-     *******************************************/
-    STARTUPINFO si;
-    PROCESS_INFORMATION pi;
-
-    HANDLE hTestStdInR = NULL;
-    HANDLE hTestStdInW = NULL;
-    HANDLE hTestStdOutR = NULL;
-    HANDLE hTestStdOutW = NULL;
-    HANDLE hTestStdErrR = NULL;
-    HANDLE hTestStdErrW = NULL;
-
-    BOOL bRetVal = FALSE;
-    DWORD dwBytesWritten = 0;
-    DWORD dwBytesRead = 0;
-    DWORD dwExitCode = 0;
-
-    SECURITY_ATTRIBUTES pipeAttributes;
-
-    char szStdOutBuf[BUF_LEN];
-    char szStdErrBuf[BUF_LEN];
-    char szFullPathNameA[_MAX_PATH];
-
-
-    /*******************************************
-     *  Initialization
-     *******************************************/
-
-    if(0 != (PAL_Initialize(argc, argv)))
-    {
-        return ( FAIL );
-    }
-
-    /*Setup SECURITY_ATTRIBUTES structure for CreatePipe*/
-    pipeAttributes.nLength              = sizeof(SECURITY_ATTRIBUTES); 
-    pipeAttributes.lpSecurityDescriptor = NULL; 
-    pipeAttributes.bInheritHandle       = TRUE; 
-    
-    
-    /*Create a StdIn pipe for child*/
-    bRetVal = CreatePipe(&hTestStdInR,      /* read handle*/
-                         &hTestStdInW,      /* write handle */
-                         &pipeAttributes,   /* security attributes*/
-                         1024);                /* pipe size*/
-
-    if (bRetVal == FALSE)
-    {
-        Fail("ERROR: %ld :Unable to create stdin pipe\n", GetLastError());
-    }
-
-
-    /*Create a StdOut pipe for child*/
-    bRetVal = CreatePipe(&hTestStdOutR,     /* read handle*/
-                         &hTestStdOutW,     /* write handle */
-                         &pipeAttributes,   /* security attributes*/
-                         0);                /* pipe size*/
-
-    if (bRetVal == FALSE)
-    {
-        Fail("ERROR: %ld :Unable to create stdout pipe\n", GetLastError());
-    }
-
-
-    /*Create a StdErr pipe for child*/
-    bRetVal = CreatePipe(&hTestStdErrR,     /* read handle*/
-                         &hTestStdErrW,     /* write handle */
-                         &pipeAttributes,   /* security attributes*/
-                         0);                /* pipe size*/
-
-    if (bRetVal == FALSE)
-    {
-        Fail("ERROR: %ld :Unable to create stderr pipe\n", GetLastError());
-    }
-
-    /* Zero the data structure space */
-    ZeroMemory ( &pi, sizeof(pi) );
-    ZeroMemory ( &si, sizeof(si) );
-
-    /* Set the process flags and standard io handles */
-    si.cb = sizeof(si);
-    si.dwFlags = STARTF_USESTDHANDLES;
-    si.hStdInput = hTestStdInR;
-    si.hStdOutput = hTestStdOutW;
-    si.hStdError = hTestStdErrW;
-
-    strcpy(szFullPathNameA, szChildFileA);
-    strcat(szFullPathNameA, szArgs);
-
-    /*******************************************
-     *  Start Testing
-     *******************************************/
-
-    /* Launch the child */
-    if ( !CreateProcessA (NULL, szFullPathNameA, NULL, NULL, TRUE, 0, NULL, NULL, &si, &pi ))
-    {
-        Fail("ERROR: CreateProcess call failed.  GetLastError returned %d\n", 
-             GetLastError() );
-    }
-
-    /* Check the returned process information for validity */
-    if (pi.hProcess == 0 || pi.hThread == 0)
-    {
-        Fail("ERROR: CreateProcess Error: Process Handle = %u, Thread Handle = %u\n",
-            pi.hProcess, pi.hThread);
-    }
-
-    /* Write the Constructed string to stdin pipe for the child process */
-    if (WriteFile(hTestStdInW, szTestString, strlen(szTestString), &dwBytesWritten, NULL) == FALSE
-        || WriteFile(hTestStdInW, "\n", strlen("\n"), &dwBytesWritten, NULL) == FALSE)
-    {
-        Fail("ERROR: %ld :unable to write to write pipe handle "
-             "hTestStdInW=0x%lx\n", GetLastError(), hTestStdInW);
-    }
-    
-    /* Wait for the child to finish, Max 20 seconds */
-    dwExitCode = WaitForSingleObject(pi.hProcess, 20000);
-
-    /* If the child failed then whole thing fails */
-    if (dwExitCode != WAIT_OBJECT_0)
-    {
-        TerminateProcess(pi.hProcess, 0);
-        Fail("ERROR: The child failed to run properly.\n");
-    }
-
-    /* Check for problems in the child process */
-    if (GetExitCodeProcess(pi.hProcess, &dwExitCode) == FALSE)
-    {
-        Fail("ERROR: Call to GetExitCodeProcess failed.\n");
-    }
-    else if (dwExitCode == EXIT_ERR_CODE1)
-    {
-        Fail("ERROR: The Child process could not reead the string "
-             "written to the stdin pipe.\n");
-    }
-    else if (dwExitCode == EXIT_ERR_CODE2)
-    {
-        Fail("ERROR: The Child process could not write the string "
-             "the stdout pipe or stderr pipe.\n");
-    }
-    else if (dwExitCode == EXIT_ERR_CODE3)
-    {
-        Fail("ERROR: The Child received the wrong number of "
-             "command line arguments.\n");
-    }
-    else if (dwExitCode == EXIT_ERR_CODE4)
-    {
-        Fail("ERROR: The Child received the wrong "
-             "command line arguments.\n");
-    }
-    else if (dwExitCode != EXIT_OK_CODE)
-    {
-        Fail("ERROR: Unexpected exit code returned: %u.  Child process "
-             "did not complete its part of the test.\n", dwExitCode);
-    }
-
-
-    /* The child ran ok, so check to see if we received the proper */
-    /* strings through the pipes.                                  */
-
-    /* clear our buffers */
-    memset(szStdOutBuf, 0, BUF_LEN);
-    memset(szStdErrBuf, 0, BUF_LEN);
-
-    /* Read the data back from the child process stdout */
-    bRetVal = ReadFile(hTestStdOutR,       /* handle to read pipe*/
-                       szStdOutBuf,        /* buffer to write to*/
-                       BUF_LEN,            /* number of bytes to read*/
-                       &dwBytesRead,       /* number of bytes read*/
-                       NULL);              /* overlapped buffer*/
-
-    /*Read the data back from the child process stderr */
-    bRetVal = ReadFile(hTestStdErrR,       /* handle to read pipe*/
-                       szStdErrBuf,        /* buffer to write to*/
-                       BUF_LEN,                /* number of bytes to read*/
-                       &dwBytesRead,       /* number of bytes read*/
-                       NULL);              /* overlapped buffer*/
-
-
-    /* Confirm that we recieved the same string that we originally */
-    /* wrote to the child and was received on both stdout & stderr.*/
-    if (strncmp(szTestString, szStdOutBuf, strlen(szTestString)) != 0
-        || strncmp(szTestString, szStdErrBuf, strlen(szTestString)) != 0)
-    {
-        Fail("ERROR: The data read back from child does not match "
-             "what was written. STDOUT: %s  STDERR: %s\n",
-             szStdOutBuf, szStdErrBuf);
-    }
-
-
-    /*******************************************
-     *  Clean Up
-     *******************************************/
-
-    /* Close process and thread handle */
-    CloseHandle ( pi.hProcess );
-    CloseHandle ( pi.hThread );
-
-    CloseHandle(hTestStdInR);
-    CloseHandle(hTestStdInW);
-    CloseHandle(hTestStdOutR);
-    CloseHandle(hTestStdOutW);
-    CloseHandle(hTestStdErrR);
-    CloseHandle(hTestStdErrW);
-
-    PAL_Terminate();
-    return ( PASS );
-}
diff --git a/src/coreclr/src/pal/tests/palsuite/threading/CreateProcessA/test2/test2.h b/src/coreclr/src/pal/tests/palsuite/threading/CreateProcessA/test2/test2.h
deleted file mode 100644 (file)
index 07bd397..0000000
+++ /dev/null
@@ -1,71 +0,0 @@
-// Licensed to the .NET Foundation under one or more agreements.
-// The .NET Foundation licenses this file to you under the MIT license.
-
-/*============================================================
-**
-** Source: test2.h
-** 
-
-**
-**===========================================================*/
-
-
-const char *szChildFileA = "paltest_createprocessa_test2_child";
-const char *szArgs = " A B C";
-const char *szArg1 = "A";
-const char *szArg2 = "B";
-const char *szArg3 = "C";
-
-const char *szPathDelimA = "\\";
-
-const char *szTestString = "Copyright (c) Microsoft";
-
-const DWORD EXIT_OK_CODE   = 100;
-const DWORD EXIT_ERR_CODE1 = 101;
-const DWORD EXIT_ERR_CODE2 = 102;
-const DWORD EXIT_ERR_CODE3 = 103;
-const DWORD EXIT_ERR_CODE4 = 104;
-const DWORD EXIT_ERR_CODE5 = 105;
-
-#define BUF_LEN  64
-
-/*
- * Take two wide strings representing file and directory names
- * (dirName, fileName), join the strings with the appropriate path
- * delimiter and populate a wide character buffer (absPathName) with
- * the resulting string.
- *
- * Returns: The number of wide characters in the resulting string.
- * 0 is returned on Error.
- */
-int 
-mkAbsoluteFilenameA ( 
-    LPSTR dirName,  
-    DWORD dwDirLength, 
-    LPCSTR fileName, 
-    DWORD dwFileLength,
-    LPSTR absPathName )
-{
-    extern const char *szPathDelimA;
-
-    DWORD sizeDN;
-    DWORD sizeFN;
-    DWORD sizeAPN;
-    
-    sizeDN = strlen( dirName );
-    sizeFN = strlen( fileName );
-    sizeAPN = (sizeDN + 1 + sizeFN + 1);
-    
-    /* insure ((dirName + DELIM + fileName + \0) =< _MAX_PATH ) */
-    if ( sizeAPN > _MAX_PATH )
-    {
-        return ( 0 );
-    }
-    
-    strncpy(absPathName, dirName, dwDirLength +1);
-    strcat(absPathName, szPathDelimA);
-    strcat(absPathName, fileName);
-    
-    return (sizeAPN);
-  
-} 
diff --git a/src/coreclr/src/pal/tests/palsuite/threading/CreateProcessA/test2/testinfo.dat b/src/coreclr/src/pal/tests/palsuite/threading/CreateProcessA/test2/testinfo.dat
deleted file mode 100644 (file)
index a90eed1..0000000
+++ /dev/null
@@ -1,19 +0,0 @@
-# Licensed to the .NET Foundation under one or more agreements.
-# The .NET Foundation licenses this file to you under the MIT license.
-
-Version = 1.0
-Section = threading
-Function = CreateProcessA
-Name = PROCESS_INFORMATION and HANDLE Inheritance
-TYPE = DEFAULT
-EXE1 = parentprocess
-EXE2 = childprocess
-Description 
-= Test the following features of CreateProcessA:
-=   - Check to see if hProcess & hThread are set in 
-=     return PROCESS_INFORMATION structure
-=   - Check to see if stdin, stdout, & stderr handles
-=     are used when STARTF_USESTDHANDLES is specified
-=     in STARUPINFO flags and bInheritHandles = TRUE
-=   - Check to see that proper arguments are passed to
-=     child process
index c218224..0727dac 100644 (file)
@@ -151,9 +151,10 @@ int __cdecl main( int argc, char **argv )
               "not build absolute path name to file\n.  Exiting.\n" );
     }
 
+    LPWSTR rgchAbsPathNameW = convert(rgchAbsPathName);
     /* launch the child process    */
     if( !CreateProcess(     NULL,               /* module name to execute */
-                            rgchAbsPathName   /* command line */
+                            rgchAbsPathNameW,   /* command line */
                             NULL,               /* process handle not */
                                                 /* inheritable */
                             NULL,               /* thread handle not */
@@ -168,6 +169,7 @@ int __cdecl main( int argc, char **argv )
         )
     {
         dwError = GetLastError();
+        free(rgchAbsPathNameW);
         if( ReleaseMutex( hMutex ) == 0 )
         {
             Trace( "ERROR:%lu:ReleaseMutex() call failed\n", GetLastError() );
@@ -180,6 +182,8 @@ int __cdecl main( int argc, char **argv )
               dwError );
     }
 
+    free(rgchAbsPathNameW);
+
     /* open another handle to the child process */
     hChildProcess = OpenProcess(    PROCESS_ALL_ACCESS,   /* access */
                                     FALSE,                /* inheritable */
index 6de6d2f..8226e67 100644 (file)
@@ -8,7 +8,7 @@
 ** Purpose: Test to ensure ExitThread() called from the last thread of
 **          a process shuts down that process and returns the proper
 **          exit code as specified in the ExitThread() call.
-** 
+**
 ** Dependencies: PAL_Initialize
 **               PAL_Terminate
 **               Fail
@@ -19,7 +19,7 @@
 **               GetLastError
 **               strlen
 **               strncpy
-** 
+**
 
 **
 **===========================================================================*/
 static const char* rgchPathDelim = "\\";
 
 
-int 
-mkAbsoluteFilename( LPSTR dirName,  
-                    DWORD dwDirLength, 
-                    LPCSTR fileName, 
+int
+mkAbsoluteFilename( LPSTR dirName,
+                    DWORD dwDirLength,
+                    LPCSTR fileName,
                     DWORD dwFileLength,
                     LPSTR absPathName )
 {
@@ -48,21 +48,21 @@ mkAbsoluteFilename( LPSTR dirName,
     {
         return ( 0 );
     }
-    
+
     strncpy( absPathName, dirName, dwDirLength +1 );
     strncpy( absPathName, rgchPathDelim, 2 );
     strncpy( absPathName, fileName, dwFileLength +1 );
 
     return (sizeAPN);
-  
-} 
+
+}
 
 
-int __cdecl main( int argc, char **argv ) 
+int __cdecl main( int argc, char **argv )
 
 {
     const char* rgchChildFile = "childprocess";
-    
+
     STARTUPINFO si;
     PROCESS_INFORMATION pi;
 
@@ -72,8 +72,8 @@ int __cdecl main( int argc, char **argv )
     DWORD dwDirLength;
     DWORD dwSize;
     DWORD dwExpected = TEST_EXIT_CODE;
-    
-    char  rgchDirName[_MAX_DIR];  
+
+    char  rgchDirName[_MAX_DIR];
     char  absPathBuf[_MAX_PATH];
     char* rgchAbsPathName;
 
@@ -82,38 +82,39 @@ int __cdecl main( int argc, char **argv )
     {
            return( FAIL );
     }
-    
+
     /* zero our process and startup info structures */
     ZeroMemory( &si, sizeof(si) );
     si.cb = sizeof( si );
     ZeroMemory( &pi, sizeof(pi) );
-    
+
     /* build the absolute path to the child process */
     rgchAbsPathName = &absPathBuf[0];
     dwFileLength = strlen( rgchChildFile );
-    
+
     dwDirLength = GetCurrentDirectory( _MAX_PATH, rgchDirName );
-    if( dwDirLength == 0 ) 
+    if( dwDirLength == 0 )
     {
         dwError = GetLastError();
-        Fail( "GetCurrentDirectory call failed with error code %d\n", 
-              dwError ); 
+        Fail( "GetCurrentDirectory call failed with error code %d\n",
+              dwError );
     }
 
     dwSize = mkAbsoluteFilename(   rgchDirName,
                                    dwDirLength,
-                                   rgchChildFile, 
+                                   rgchChildFile,
                                    dwFileLength,
                                    rgchAbsPathName );
     if( dwSize == 0 )
     {
-        Fail( "Palsuite Code: mkAbsoluteFilename() call failed.  Could ", 
-              "not build absolute path name to file\n.  Exiting.\n" ); 
+        Fail( "Palsuite Code: mkAbsoluteFilename() call failed.  Could ",
+              "not build absolute path name to file\n.  Exiting.\n" );
     }
 
+    LPWSTR rgchAbsPathNameW = convert(rgchAbsPathName);
     /* launch the child process */
     if( !CreateProcess(     NULL,               /* module name to execute */
-                            rgchAbsPathName   /* command line */
+                            rgchAbsPathNameW,   /* command line */
                             NULL,               /* process handle not */
                                                 /* inheritable */
                             NULL,               /* thread handle not */
@@ -128,10 +129,13 @@ int __cdecl main( int argc, char **argv )
         )
     {
         dwError = GetLastError();
-        Fail( "CreateProcess call failed with error code %d\n", 
-              dwError ); 
+        free(rgchAbsPathNameW);
+        Fail( "CreateProcess call failed with error code %d\n",
+              dwError );
     }
-    
+
+    free(rgchAbsPathNameW);
+
     /* wait for the child process to complete */
     WaitForSingleObject ( pi.hProcess, INFINITE );
 
@@ -141,27 +145,27 @@ int __cdecl main( int argc, char **argv )
         dwError = GetLastError();
         CloseHandle ( pi.hProcess );
         CloseHandle ( pi.hThread );
-        Fail( "GetExitCodeProcess call failed with error code %d\n", 
-              dwError ); 
+        Fail( "GetExitCodeProcess call failed with error code %d\n",
+              dwError );
     }
-    
+
     /* close process and thread handle */
     CloseHandle ( pi.hProcess );
     CloseHandle ( pi.hThread );
-    
+
     /* check for the expected exit code */
     /* exit code for some systems is as small as a char, so that's all */
     /* we'll compare for checking success                              */
     if( LOBYTE(LOWORD(dwExitCode)) != LOBYTE(LOWORD(dwExpected)) )
     {
         Fail( "GetExitCodeProcess returned an incorrect exit code %d, "
-              "expected value is %d\n", 
-              LOWORD(dwExitCode), dwExpected ); 
+              "expected value is %d\n",
+              LOWORD(dwExitCode), dwExpected );
     }
 
     /* terminate the PAL */
     PAL_Terminate();
-    
+
     /* return success */
-    return PASS; 
+    return PASS;
 }
index dff574c..b83e021 100644 (file)
@@ -6,7 +6,7 @@
 ** Source: test1.c
 **
 ** Purpose: Test to ensure GetExitCodeProcess works properly.
-** 
+**
 ** Dependencies: PAL_Initialize
 **               PAL_Terminate
 **               Fail
@@ -17,7 +17,7 @@
 **               GetLastError
 **               strlen
 **               strncpy
-** 
+**
 
 **
 **===========================================================================*/
 static const char* rgchPathDelim = "\\";
 
 
-int 
-mkAbsoluteFilename( LPSTR dirName,  
-                    DWORD dwDirLength, 
-                    LPCSTR fileName, 
+int
+mkAbsoluteFilename( LPSTR dirName,
+                    DWORD dwDirLength,
+                    LPCSTR fileName,
                     DWORD dwFileLength,
                     LPSTR absPathName )
 {
@@ -46,21 +46,21 @@ mkAbsoluteFilename( LPSTR dirName,
     {
         return ( 0 );
     }
-    
+
     strncpy( absPathName, dirName, dwDirLength +1 );
     strncpy( absPathName, rgchPathDelim, 2 );
     strncpy( absPathName, fileName, dwFileLength +1 );
 
     return (sizeAPN);
-  
-} 
+
+}
 
 
-int __cdecl main( int argc, char **argv ) 
+int __cdecl main( int argc, char **argv )
 
 {
     const char* rgchChildFile = "childprocess";
-    
+
     STARTUPINFO si;
     PROCESS_INFORMATION pi;
 
@@ -69,8 +69,8 @@ int __cdecl main( int argc, char **argv )
     DWORD dwFileLength;
     DWORD dwDirLength;
     DWORD dwSize;
-    
-    char  rgchDirName[_MAX_DIR];  
+
+    char  rgchDirName[_MAX_DIR];
     char  absPathBuf[_MAX_PATH];
     char* rgchAbsPathName;
 
@@ -79,38 +79,39 @@ int __cdecl main( int argc, char **argv )
     {
            return( FAIL );
     }
-    
+
     /* zero our process and startup info structures */
     ZeroMemory( &si, sizeof(si) );
     si.cb = sizeof( si );
     ZeroMemory( &pi, sizeof(pi) );
-    
+
     /* build the absolute path to the child process */
     rgchAbsPathName = &absPathBuf[0];
     dwFileLength = strlen( rgchChildFile );
-    
+
     dwDirLength = GetCurrentDirectory( _MAX_PATH, rgchDirName );
-    if( dwDirLength == 0 ) 
+    if( dwDirLength == 0 )
     {
         dwError = GetLastError();
-        Fail( "GetCurrentDirectory call failed with error code %d\n", 
-              dwError ); 
+        Fail( "GetCurrentDirectory call failed with error code %d\n",
+              dwError );
     }
 
     dwSize = mkAbsoluteFilename(   rgchDirName,
                                    dwDirLength,
-                                   rgchChildFile, 
+                                   rgchChildFile,
                                    dwFileLength,
                                    rgchAbsPathName );
     if( dwSize == 0 )
     {
-        Fail( "Palsuite Code: mkAbsoluteFilename() call failed.  Could ", 
-              "not build absolute path name to file\n.  Exiting.\n" ); 
+        Fail( "Palsuite Code: mkAbsoluteFilename() call failed.  Could ",
+              "not build absolute path name to file\n.  Exiting.\n" );
     }
 
+    LPWSTR rgchAbsPathNameW = convert(rgchAbsPathName);
     /* launch the child process */
     if( !CreateProcess(     NULL,               /* module name to execute */
-                            rgchAbsPathName   /* command line */
+                            rgchAbsPathNameW,   /* command line */
                             NULL,               /* process handle not */
                                                 /* inheritable */
                             NULL,               /* thread handle not */
@@ -125,10 +126,13 @@ int __cdecl main( int argc, char **argv )
         )
     {
         dwError = GetLastError();
-        Fail( "CreateProcess call failed with error code %d\n", 
-              dwError ); 
+        free(rgchAbsPathNameW);
+        Fail( "CreateProcess call failed with error code %d\n",
+              dwError );
     }
-    
+
+    free(rgchAbsPathNameW);
+
     /* wait for the child process to complete */
     WaitForSingleObject ( pi.hProcess, INFINITE );
 
@@ -138,25 +142,25 @@ int __cdecl main( int argc, char **argv )
         dwError = GetLastError();
         CloseHandle ( pi.hProcess );
         CloseHandle ( pi.hThread );
-        Fail( "GetExitCodeProcess call failed with error code %d\n", 
-              dwError ); 
+        Fail( "GetExitCodeProcess call failed with error code %d\n",
+              dwError );
     }
-    
+
     /* close process and thread handle */
     CloseHandle ( pi.hProcess );
     CloseHandle ( pi.hThread );
-    
+
     /* check for the expected exit code */
     if( dwExitCode != TEST_EXIT_CODE )
     {
         Fail( "GetExitCodeProcess returned an incorrect exit code %d, "
-              "expected value is %d\n", 
-              dwExitCode, TEST_EXIT_CODE ); 
+              "expected value is %d\n",
+              dwExitCode, TEST_EXIT_CODE );
     }
 
     /* terminate the PAL */
     PAL_Terminate();
-    
+
     /* return success */
-    return PASS; 
+    return PASS;
 }
index 91f252b..8fc33a1 100644 (file)
@@ -177,7 +177,9 @@ private:
 void TestCreateMutex(AutoCloseMutexHandle &m, const char *name, bool initiallyOwned = false)
 {
     m.Close();
-    m = CreateMutex(nullptr, initiallyOwned, convert(name));
+    LPWSTR nameW = convert(name);
+    m = CreateMutex(nullptr, initiallyOwned, nameW);
+    free(nameW);
 }
 
 HANDLE TestOpenMutex(const char *name)
@@ -211,10 +213,14 @@ bool StartProcess(const char *funcName)
     si.cb = sizeof(si);
     PROCESS_INFORMATION pi;
     memset(&pi, 0, sizeof(pi));
-    if (!CreateProcessA(nullptr, g_processCommandLinePath, nullptr, nullptr, false, 0, nullptr, nullptr, &si, &pi))
+    LPWSTR nameW = convert(g_processCommandLinePath);
+    if (!CreateProcessW(nullptr, nameW, nullptr, nullptr, false, 0, nullptr, nullptr, &si, &pi))
     {
+        free(nameW);
         return false;
     }
+
+    free(nameW);
     CloseHandle(pi.hProcess);
     CloseHandle(pi.hThread);
     return true;
index 18f88b5..702455b 100644 (file)
@@ -79,9 +79,10 @@ int __cdecl main( int argc, char **argv )
         Fail ("Error: Insufficient lpCommandline for\n");
     }
 
+    LPWSTR lpCommandLineW = convert(lpCommandLine);
     /* launch the child process */
     if( !CreateProcess(     NULL,               /* module name to execute */
-                            lpCommandLine,    /* command line */
+                            lpCommandLineW,     /* command line */
                             NULL,               /* process handle not */
                                                 /* inheritable */
                             NULL,               /* thread handle not */
@@ -95,10 +96,14 @@ int __cdecl main( int argc, char **argv )
                             &pi )               /* process info struct */
         )
     {
+        DWORD dwError = GetLastError();
+        free(lpCommandLineW);
         Fail( "ERROR:%lu:CreateProcess call failed\n",
-              GetLastError() );
+              dwError);
     }
 
+    free(lpCommandLineW);
+
     /* verify that the event is signalled by the child process */
     dwRet = WaitForSingleObject( hEvent, TIMEOUT );
     if( dwRet != WAIT_OBJECT_0 )
index 57fc97a..17c4a49 100644 (file)
@@ -141,9 +141,10 @@ int __cdecl main( int argc, char **argv )
               "not build absolute path name to file\n.  Exiting.\n" );
     }
 
+    LPWSTR rgchAbsPathNameW = convert(rgchAbsPathName);
     /* launch the child process    */
     if( !CreateProcess(     NULL,               /* module name to execute */
-                            rgchAbsPathName   /* command line */
+                            rgchAbsPathNameW,   /* command line */
                             NULL,               /* process handle not */
                                                 /* inheritable */
                             NULL,               /* thread handle not */
@@ -158,6 +159,7 @@ int __cdecl main( int argc, char **argv )
         )
     {
         dwError = GetLastError();
+        free(rgchAbsPathNameW);
         if( ReleaseMutex( hMutex ) == 0 )
         {
             Trace( "ERROR:%lu:ReleaseMutex() call failed\n", GetLastError() );
@@ -170,6 +172,8 @@ int __cdecl main( int argc, char **argv )
               dwError );
     }
 
+    free(rgchAbsPathNameW);
+
     /* open another handle to the child process */
     hChildProcess = OpenProcess(    PROCESS_ALL_ACCESS,   /* access */
                                     FALSE,                /* inheritable */
index d2d999d..6161e5c 100644 (file)
@@ -325,10 +325,12 @@ DWORD PALAPI TestThread(PVOID pArg)
             sprintf_s (szCmd, 128, "child6 -event %s", szTestName);
             szCmd[127] = 0;
 
-            bRet = CreateProcessA(NULL, szCmd, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
+            LPWSTR szCmdW = convert(szCmd);
+            bRet = CreateProcessW(NULL, szCmdW, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
+            free(szCmdW);
             if (FALSE == bRet)
             {
-                Fail("CreateProcess failed [GetLastError()=%u]\n",
+                Fail("CreateProcessW failed [GetLastError()=%u]\n",
                      GetLastError());
             }
 
@@ -365,14 +367,17 @@ DWORD PALAPI TestThread(PVOID pArg)
             sprintf_s (szCmd, 128, "child6 -semaphore %s", szTestName);
             szCmd[127] = 0;
 
-            bRet = CreateProcessA(NULL, szCmd, NULL, NULL, FALSE,
+            LPWSTR szCmdW = convert(szCmd);
+            bRet = CreateProcessW(NULL, szCmdW, NULL, NULL, FALSE,
                                   0, NULL, NULL, &si, &pi);
+            free(szCmdW);
             if (FALSE == bRet)
             {
-                Fail("CreateProcessA failed [GetLastError()=%u]\n",
+                Fail("CreateProcessW failed [GetLastError()=%u]\n",
                      GetLastError());
             }
 
+
             Trace("Setting event %s\n", szEventName);
             bRet = SetEvent(hNamedEvent);
             if (FALSE == bRet)
@@ -425,10 +430,12 @@ DWORD PALAPI TestThread(PVOID pArg)
             sprintf_s (szCmd, 128, "child6 -mutex %s -exitcode %d", szTestName, iDesiredExitCode);
             szCmd[127] = 0;
 
-            bRet = CreateProcessA(NULL, szCmd, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
+            LPWSTR szCmdW = convert(szCmd);
+            bRet = CreateProcessW(NULL, szCmdW, NULL, NULL, FALSE, 0, NULL, NULL, &si, &pi);
+            free(szCmdW);
             if (FALSE == bRet)
             {
-                Fail("CreateProcess failed [GetLastError()=%u]\n",
+                Fail("CreateProcessW failed [GetLastError()=%u]\n",
                      GetLastError());
             }
 
@@ -529,11 +536,13 @@ DWORD PALAPI TestThread(PVOID pArg)
             sprintf_s (szCmd, 128, "child6 -mutex_and_named_event %s", szTestName);
             szCmd[127] = 0;
 
-            bRet = CreateProcessA(NULL, szCmd, NULL, NULL, FALSE,
+            LPWSTR szCmdW = convert(szCmd);
+            bRet = CreateProcessW(NULL, szCmdW, NULL, NULL, FALSE,
                                   0, NULL, NULL, &si, &pi);
+            free(szCmdW);
             if (FALSE == bRet)
             {
-                Fail("CreateProcess failed [GetLastError()=%u]\n",
+                Fail("CreateProcessW failed [GetLastError()=%u]\n",
                      GetLastError());
             }
 
index d8f550e..f3e6527 100644 (file)
@@ -3,14 +3,14 @@
 
 /*============================================================
 **
-** Source: WFSOProcessTest.c 
+** Source: WFSOProcessTest.c
 **
-** Purpose: Test for WaitForSingleObjectTest. 
+** Purpose: Test for WaitForSingleObjectTest.
 **                     Create One Process and do some work
-**                     Use WFSO For the Process to finish 
-**                     
+**                     Use WFSO For the Process to finish
+**
 ** Test Passes if the above operations are successful
-**     
+**
 **
 **
 **=========================================================*/
@@ -26,9 +26,9 @@ int __cdecl main(int argc, char **argv)
 STARTUPINFO si;
 PROCESS_INFORMATION pi;
 
-DWORD dwWaitResult=0; 
+DWORD dwWaitResult=0;
 
-//Initialize PAL 
+//Initialize PAL
 if(0 != (PAL_Initialize(argc, argv)))
     {
         return ( FAIL );
@@ -39,58 +39,63 @@ ZeroMemory( &si, sizeof(si) );
 si.cb = sizeof(si);
 ZeroMemory( &pi, sizeof(pi) );
 
-// Start the child process. 
-if( !CreateProcess( NULL, // No module name (use command line). 
-    "childprocess", // Command line. 
-    NULL,             // Process handle not inheritable. 
-    NULL,             // Thread handle not inheritable. 
-    FALSE,            // Set handle inheritance to FALSE. 
-    0,                // No creation flags. 
-    NULL,             // Use parent's environment block. 
-    NULL,             // Use parent's starting directory. 
+LPWSTR nameW =  convert("childprocess");
+// Start the child process.
+if( !CreateProcess( NULL, // No module name (use command line).
+    nameW,  // Command line.
+    NULL,             // Process handle not inheritable.
+    NULL,             // Thread handle not inheritable.
+    FALSE,            // Set handle inheritance to FALSE.
+    0,                // No creation flags.
+    NULL,             // Use parent's environment block.
+    NULL,             // Use parent's starting directory.
     &si,              // Pointer to STARTUPINFO structure.
     &pi )             // Pointer to PROCESS_INFORMATION structure.
-) 
+)
 
 {
+DWORD dwError = GetLastError();
+free(nameW);
 Fail ( "Create Process Failed.  Failing test.\n"
-              "GetLastError returned %d\n", GetLastError());  
+              "GetLastError returned %d\n", GetLastError());
 }
 
+free(nameW);
+
 // Wait until child process exits.
   dwWaitResult = WaitForSingleObject( pi.hProcess, INFINITE );
-switch (dwWaitResult) 
+switch (dwWaitResult)
        {
     // The Process wait was successful
-    case WAIT_OBJECT_0: 
+    case WAIT_OBJECT_0:
                                {
 
                        Trace("Wait for Process was successful\n");
-                       break; 
-                               } 
+                       break;
+                               }
 
     // Time-out.
-    case WAIT_TIMEOUT: 
+    case WAIT_TIMEOUT:
                        {
                                Fail ( "Time -out.  Failing test.\n"
-                               "GetLastError returned %d\n", GetLastError());  
+                               "GetLastError returned %d\n", GetLastError());
                                return FALSE;
                        }
 
     // Got ownership of the abandoned process object.
-    case WAIT_ABANDONED: 
+    case WAIT_ABANDONED:
                        {
                                Fail ( "Got ownership of the abandoned Process object.  Failing test.\n"
-                               "GetLastError returned %d\n", GetLastError());  
-                               return FALSE; 
+                               "GetLastError returned %d\n", GetLastError());
+                               return FALSE;
                        }
 
     //Error condition
     case WAIT_FAILED:
                        {
                                Fail ( "Wait for Process Failed.  Failing test.\n"
-                                       "GetLastError returned %d\n", GetLastError());  
-                               return FALSE; 
+                                       "GetLastError returned %d\n", GetLastError());
+                               return FALSE;
                        }
 
 }
@@ -100,8 +105,8 @@ switch (dwWaitResult)
 // Close process handle
 if (0==CloseHandle(pi.hProcess))
                                {
-                                       Trace("Could not close process handle\n"); 
-                                       Fail ( "GetLastError returned %d\n", GetLastError());  
+                                       Trace("Could not close process handle\n");
+                                       Fail ( "GetLastError returned %d\n", GetLastError());
                                }
 
 
index 7a2b39a..c8851a8 100644 (file)
@@ -81,10 +81,10 @@ void GetMapViewOfFile(__in WCHAR *szFile, PBYTE *ppbMap, DWORD *pdwFileSize)
     }
     _ASSERTE(dwHighSize == 0);
 
-    hMapFile = CreateFileMappingA(hFile, NULL, PAGE_READONLY, 0, 0, NULL);
+    hMapFile = CreateFileMappingW(hFile, NULL, PAGE_READONLY, 0, 0, NULL);
     CloseHandle(hFile);
     if (!hMapFile)
-        MDInfo::Error("CreateFileMappingA failed!");
+        MDInfo::Error("CreateFileMappingW failed!");
 
     *ppbMap = (PBYTE) MapViewOfFile(hMapFile, FILE_MAP_READ, 0, 0, 0);
     CloseHandle(hMapFile);
index fb44d3e..154dc47 100644 (file)
@@ -789,7 +789,7 @@ void EEStartupHelper()
 #ifndef CROSSGEN_COMPILE
 
         // Cross-process named objects are not supported in PAL
-        // (see CorUnix::InternalCreateEvent - src/pal/src/synchobj/event.cpp.272)
+        // (see CorUnix::InternalCreateEvent - src/pal/src/synchobj/event.cpp)
 #if !defined(TARGET_UNIX)
         // Initialize the sweeper thread.
         if (g_pConfig->GetZapBBInstr() != NULL)
@@ -839,7 +839,7 @@ void EEStartupHelper()
 #ifndef CROSSGEN_COMPILE
 
         InitializeGarbageCollector();
-        
+
         if (!GCHandleUtilities::GetGCHandleManager()->Initialize())
         {
             IfFailGo(E_OUTOFMEMORY);
index 6592ed5..c6ecc82 100644 (file)
@@ -36,20 +36,6 @@ namespace System.Data.Common
         [DllImport(Interop.Libraries.Kernel32, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
         internal static extern IntPtr MapViewOfFile(IntPtr hFileMappingObject, int dwDesiredAccess, int dwFileOffsetHigh, int dwFileOffsetLow, IntPtr dwNumberOfBytesToMap);
 
-        // OpenFileMappingA contains a security venerability, in the unicode->ansi conversion
-        // Its possible to spoof the directory and construct ../ sequeences,  See FxCop Warrning
-        // Specify marshaling for pinvoke string arguments
-        [DllImport(Interop.Libraries.Kernel32, CharSet = System.Runtime.InteropServices.CharSet.Ansi, BestFitMapping = false, ThrowOnUnmappableChar = true)]
-        //        [DllImport(Interop.Libraries.Kernel32, CharSet=System.Runtime.InteropServices.CharSet.Ansi)]
-        internal static extern IntPtr OpenFileMappingA(int dwDesiredAccess, bool bInheritHandle, [MarshalAs(UnmanagedType.LPStr)] string lpName);
-
-        // CreateFileMappingA contains a security venerability, in the unicode->ansi conversion
-        // Its possible to spoof the directory and construct ../ sequeences,  See FxCop Warrning
-        // Specify marshaling for pinvoke string arguments
-        [DllImport(Interop.Libraries.Kernel32, CharSet = System.Runtime.InteropServices.CharSet.Ansi, BestFitMapping = false, ThrowOnUnmappableChar = true)]
-        //        [DllImport(Interop.Libraries.Kernel32, CharSet=System.Runtime.InteropServices.CharSet.Ansi)]
-        internal static extern IntPtr CreateFileMappingA(IntPtr hFile, IntPtr pAttr, int flProtect, int dwMaximumSizeHigh, int dwMaximumSizeLow, [MarshalAs(UnmanagedType.LPStr)] string lpName);
-
         [DllImport(Interop.Libraries.Kernel32, ExactSpelling = true, CharSet = System.Runtime.InteropServices.CharSet.Auto)]
         internal static extern bool UnmapViewOfFile(IntPtr lpBaseAddress);