From 96846758a0df94985aedc6c301a8576ee1f1da4b Mon Sep 17 00:00:00 2001 From: Koundinya Veluri Date: Fri, 21 Aug 2015 11:43:34 -0700 Subject: [PATCH] Return error upon attemping to create named objects in PAL. Update PAL APIs that create named objects (mutex, semaphore, event, file mapping) to return a not-supported error code. It was decided to not support cross-process synchronization in PAL at present time due to complexities involved in reliably emulating Windows' behavior. @stephentoub has already made changes on the FX side to throw PlatformNotSupportedException in these cases. Related to issue #1237. --- src/md/enc/stgio.cpp | 11 +-- src/md/inc/stgio.h | 1 - src/pal/src/map/map.cpp | 97 +++++-------------- src/pal/src/synchobj/event.cpp | 50 ++++------ src/pal/src/synchobj/mutex.cpp | 80 ++++----------- src/pal/src/synchobj/semaphore.cpp | 53 ++++------ .../test8/createfilemapping.c | 22 ----- .../test8/createfilemapping.c | 24 ----- src/pal/tests/palsuite/paltestlist.txt | 15 --- .../palsuite/paltestlist_to_be_reviewed.txt | 15 +++ .../threading/CreateEventA/test1/test1.c | 12 +-- .../threading/CreateEventA/test2/test2.c | 12 +-- .../threading/CreateEventW/test1/test1.c | 15 +-- .../threading/CreateEventW/test2/test2.c | 15 +-- .../threading/ResetEvent/test1/test1.c | 18 ++-- .../threading/ResetEvent/test2/test2.c | 3 +- .../threading/ResetEvent/test3/test3.c | 3 +- .../threading/ResetEvent/test4/test4.c | 3 +- .../palsuite/threading/SetEvent/test1/test1.c | 18 ++-- .../palsuite/threading/SetEvent/test2/test2.c | 3 +- .../palsuite/threading/SetEvent/test3/test3.c | 3 +- .../palsuite/threading/SetEvent/test4/test4.c | 3 +- .../WaitForMultipleObjects/test1/test1.c | 40 +++----- .../WaitForMultipleObjectsEx/test1/test1.c | 41 +++----- .../WFSOExMutexTest/WFSOExMutexTest.c | 6 +- .../WFSOMutexTest/WFSOMutexTest.c | 7 +- .../WaitForSingleObject/test1/test1.c | 23 ++--- 27 files changed, 168 insertions(+), 425 deletions(-) diff --git a/src/md/enc/stgio.cpp b/src/md/enc/stgio.cpp index 020cf66b0597..6c665c88b9ab 100644 --- a/src/md/enc/stgio.cpp +++ b/src/md/enc/stgio.cpp @@ -112,7 +112,6 @@ void StgIO::CtorInit() m_cbBuff = 0; m_rgPageMap = 0; m_FileType = FILETYPE_UNKNOWN; - *m_rcShared = '\0'; m_cRef = 1; m_mtMappedType = MTYPE_NOMAPPING; } @@ -787,10 +786,8 @@ HRESULT StgIO::MapFileToMem( // Return code. // Check the size of the data we want to map. If it is small enough, then // simply allocate a chunk of memory from a finer grained heap. This saves // virtual memory space, page table entries, and should reduce overall working set. - // Note that any shared memory objects will require the handles to be in place - // and are not elligible. Also, open for read/write needs a full backing - // store. - if (!*m_rcShared && (m_cbData <= SMALL_ALLOC_MAP_SIZE) && (SMALL_ALLOC_MAP_SIZE > 0)) + // Also, open for read/write needs a full backing store. + if ((m_cbData <= SMALL_ALLOC_MAP_SIZE) && (SMALL_ALLOC_MAP_SIZE > 0)) { DWORD cbRead = m_cbData; _ASSERTE(m_pData == 0); @@ -854,8 +851,6 @@ HRESULT StgIO::MapFileToMem( // Return code. // change for the life of the handle. if ((m_fFlags & DBPROP_TMODEF_WRITE) == 0 && m_iType != STGIO_STREAM) { - _ASSERTE(!*m_rcShared); - // Create a mapping object for the file. _ASSERTE(m_hMapping == 0); @@ -869,7 +864,7 @@ HRESULT StgIO::MapFileToMem( // Return code. #endif if ((m_hMapping = WszCreateFileMapping(m_hFile, pAttributes, dwProtectionFlags, - 0, 0, *m_rcShared ? m_rcShared : 0)) == 0) + 0, 0, nullptr)) == 0) { return (MapFileError(GetLastError())); } diff --git a/src/md/inc/stgio.h b/src/md/inc/stgio.h index 887eeb0355a3..5db910f7d61e 100644 --- a/src/md/inc/stgio.h +++ b/src/md/inc/stgio.h @@ -261,7 +261,6 @@ class StgIO // Flags and state data. FILETYPE m_FileType; // Cached type of the file (based on extension). - WCHAR m_rcShared[MAXSHMEM]; // Name of shared memory segment. LONG m_cRef; // Ref count on this object. bool m_bWriteThrough : 1; // true for write through mode. bool m_bRewrite : 1; // State check for rewrite mode. diff --git a/src/pal/src/map/map.cpp b/src/pal/src/map/map.cpp index d64d43f88026..0ca2fde18df3 100644 --- a/src/pal/src/map/map.cpp +++ b/src/pal/src/map/map.cpp @@ -290,7 +290,6 @@ CreateFileMappingA( IN LPCSTR lpName) { HANDLE hFileMapping = NULL; - WCHAR WideString[ MAX_PATH ]; CPalThread *pThread = NULL; PAL_ERROR palError = NO_ERROR; @@ -304,34 +303,10 @@ CreateFileMappingA( pThread = InternalGetCurrentThread(); - if ( lpName != NULL ) + if (lpName != nullptr) { - if ( 0 == MultiByteToWideChar(CP_ACP, 0, lpName, -1, - WideString, MAX_PATH ) ) - { - palError = GetLastError(); - if ( ERROR_INSUFFICIENT_BUFFER == palError ) - { - ERROR("lpName is larger than MAX_PATH (%d)!\n", MAX_PATH); - } - else - { - ERROR("MultiByteToWideChar failure! (error=%d)\n", - palError); - } - goto ExitCreateFileMappingA; - } - - palError = InternalCreateFileMapping( - pThread, - hFile, - lpFileMappingAttributes, - flProtect, - dwMaximumSizeHigh, - dwMaximumSizeLow, - WideString, - &hFileMapping - ); + ASSERT("lpName: Cross-process named objects are not supported in PAL"); + palError = ERROR_NOT_SUPPORTED; } else { @@ -348,8 +323,6 @@ CreateFileMappingA( } -ExitCreateFileMappingA: - // // We always need to set last error, even on success: // we need to protect ourselves from the situation @@ -452,6 +425,13 @@ CorUnix::InternalCreateFileMapping( // Validate parameters // + if (lpName != nullptr) + { + ASSERT("lpName: Cross-process named objects are not supported in PAL"); + palError = ERROR_NOT_SUPPORTED; + goto ExitInternalCreateFileMapping; + } + if (0 != dwMaximumSizeHigh) { ASSERT("dwMaximumSizeHigh is always 0.\n"); @@ -823,7 +803,6 @@ OpenFileMappingA( IN LPCSTR lpName) { HANDLE hFileMapping = NULL; - WCHAR WideString[ MAX_PATH ]; CPalThread *pThread = NULL; PAL_ERROR palError = NO_ERROR; @@ -833,40 +812,17 @@ OpenFileMappingA( pThread = InternalGetCurrentThread(); - if ( lpName != NULL ) + if (lpName == nullptr) { - if ( 0 == MultiByteToWideChar(CP_ACP, 0, lpName, -1, - WideString, MAX_PATH ) ) - { - palError = GetLastError(); - if ( ERROR_INSUFFICIENT_BUFFER == palError ) - { - ERROR("lpName is larger than MAX_PATH (%d)!\n", MAX_PATH); - } - else - { - ERROR("MultiByteToWideChar failure! (error=%d)\n", - palError); - } - palError = ERROR_INVALID_PARAMETER; - goto ExitOpenFileMappingA; - } - - palError = InternalOpenFileMapping( - pThread, - dwDesiredAccess, - bInheritHandle, - &WideString[0], - &hFileMapping - ); + ERROR("name is NULL\n"); + palError = ERROR_INVALID_PARAMETER; } else { - ERROR("name is NULL\n"); - palError = ERROR_INVALID_PARAMETER; + ASSERT("lpName: Cross-process named objects are not supported in PAL"); + palError = ERROR_NOT_SUPPORTED; } -ExitOpenFileMappingA: if (NO_ERROR != palError) { pThread->SetLastError(palError); @@ -901,29 +857,22 @@ OpenFileMappingW( pThread = InternalGetCurrentThread(); /* validate parameters */ - if (lpName == NULL) + if (lpName == nullptr) { ERROR("name is NULL\n"); - pThread->SetLastError(ERROR_INVALID_PARAMETER); - goto ExitOpenFileMappingW; + palError = ERROR_INVALID_PARAMETER; + } + else + { + ASSERT("lpName: Cross-process named objects are not supported in PAL"); + palError = ERROR_NOT_SUPPORTED; } - - palError = InternalOpenFileMapping( - pThread, - dwDesiredAccess, - bInheritHandle, - lpName, - &hFileMapping - ); if (NO_ERROR != palError) { pThread->SetLastError(palError); } - -ExitOpenFileMappingW: - - LOGEXIT( "OpenFileMappingW returning %p.\n", hFileMapping ); + LOGEXIT("OpenFileMappingW returning %p.\n", hFileMapping); PERF_EXIT(OpenFileMappingW); return hFileMapping; } diff --git a/src/pal/src/synchobj/event.cpp b/src/pal/src/synchobj/event.cpp index 4873c4508fb6..351b8f75574f 100644 --- a/src/pal/src/synchobj/event.cpp +++ b/src/pal/src/synchobj/event.cpp @@ -97,7 +97,6 @@ CreateEventA( IN LPCSTR lpName) { HANDLE hEvent = NULL; - WCHAR pwName[c_cchMaxEvent]; CPalThread *pthr = NULL; PAL_ERROR palError; @@ -107,28 +106,10 @@ CreateEventA( pthr = InternalGetCurrentThread(); - if (lpName != NULL) + if (lpName != nullptr) { - palError = InternalWszNameFromSzName( - pthr, - lpName, - pwName, - sizeof(pwName) / sizeof(pwName[0]) - ); - - if (NO_ERROR != palError) - { - goto CreateEventAExit; - } - - palError = InternalCreateEvent( - pthr, - lpEventAttributes, - bManualReset, - bInitialState, - pwName, - &hEvent - ); + ASSERT("lpName: Cross-process named objects are not supported in PAL"); + palError = ERROR_NOT_SUPPORTED; } else { @@ -142,8 +123,6 @@ CreateEventA( ); } -CreateEventAExit: - // // We always need to set last error, even on success: // we need to protect ourselves from the situation @@ -258,6 +237,13 @@ CorUnix::InternalCreateEvent( phEvent ); + if (lpName != nullptr) + { + ASSERT("lpName: Cross-process named objects are not supported in PAL"); + palError = ERROR_NOT_SUPPORTED; + goto InternalCreateEventExit; + } + palError = g_pObjectManager->AllocateObject( pthr, bManualReset ? &otManualResetEvent : &otAutoResetEvent, @@ -471,6 +457,7 @@ CorUnix::InternalSetEvent( return palError; } +// TODO: Implementation of OpenEventA() doesn't exist, do we need it? More generally, do we need the A versions at all? /*++ Function: @@ -502,20 +489,17 @@ OpenEventW( pthr = InternalGetCurrentThread(); /* validate parameters */ - if (lpName == NULL) + if (lpName == nullptr) { ERROR("name is NULL\n"); palError = ERROR_INVALID_PARAMETER; goto OpenEventWExit; } - - palError = InternalOpenEvent( - pthr, - dwDesiredAccess, - bInheritHandle, - lpName, - &hEvent - ); + else + { + ASSERT("lpName: Cross-process named objects are not supported in PAL"); + palError = ERROR_NOT_SUPPORTED; + } OpenEventWExit: diff --git a/src/pal/src/synchobj/mutex.cpp b/src/pal/src/synchobj/mutex.cpp index d3606f3957f8..a4cebe77bf74 100644 --- a/src/pal/src/synchobj/mutex.cpp +++ b/src/pal/src/synchobj/mutex.cpp @@ -71,13 +71,12 @@ CAllowedObjectTypes aotMutex(otiMutex); HANDLE PALAPI -CreateMutexA ( +CreateMutexA( IN LPSECURITY_ATTRIBUTES lpMutexAttributes, IN BOOL bInitialOwner, IN LPCSTR lpName) { HANDLE hMutex = NULL; - WCHAR pwName[c_cchMaxMutex]; CPalThread *pthr = NULL; PAL_ERROR palError; @@ -87,27 +86,10 @@ CreateMutexA ( pthr = InternalGetCurrentThread(); - if (lpName != NULL) + if (lpName != nullptr) { - palError = InternalWszNameFromSzName( - pthr, - lpName, - pwName, - sizeof(pwName) / sizeof(pwName[0]) - ); - - if (NO_ERROR != palError) - { - goto CreateMutexAExit; - } - - palError = InternalCreateMutex( - pthr, - lpMutexAttributes, - bInitialOwner, - pwName, - &hMutex - ); + ASSERT("lpName: Cross-process named objects are not supported in PAL"); + palError = ERROR_NOT_SUPPORTED; } else { @@ -120,8 +102,6 @@ CreateMutexA ( ); } -CreateMutexAExit: - // // We always need to set last error, even on success: // we need to protect ourselves from the situation @@ -232,6 +212,13 @@ CorUnix::InternalCreateMutex( phMutex ); + if (lpName != nullptr) + { + ASSERT("lpName: Cross-process named objects are not supported in PAL"); + palError = ERROR_NOT_SUPPORTED; + goto InternalCreateMutexExit; + } + palError = g_pObjectManager->AllocateObject( pthr, &otMutex, @@ -434,7 +421,6 @@ OpenMutexA ( IN LPCSTR lpName) { HANDLE hMutex = NULL; - WCHAR pwName[c_cchMaxMutex]; CPalThread *pthr = NULL; PAL_ERROR palError; @@ -445,35 +431,17 @@ OpenMutexA ( pthr = InternalGetCurrentThread(); /* validate parameters */ - if (lpName == NULL) + if (lpName == nullptr) { ERROR("name is NULL\n"); palError = ERROR_INVALID_PARAMETER; - goto OpenMutexAExit; } - - palError = InternalWszNameFromSzName( - pthr, - lpName, - pwName, - sizeof(pwName) / sizeof(pwName[0]) - ); - - if (NO_ERROR != palError) + else { - goto OpenMutexAExit; + ASSERT("lpName: Cross-process named objects are not supported in PAL"); + palError = ERROR_NOT_SUPPORTED; } - palError = InternalOpenMutex( - pthr, - dwDesiredAccess, - bInheritHandle, - pwName, - &hMutex - ); - -OpenMutexAExit: - if (NO_ERROR != palError) { pthr->SetLastError(palError); @@ -513,22 +481,16 @@ OpenMutexW( pthr = InternalGetCurrentThread(); /* validate parameters */ - if (lpName == NULL) + if (lpName == nullptr) { ERROR("name is NULL\n"); palError = ERROR_INVALID_PARAMETER; - goto OpenMutexWExit; } - - palError = InternalOpenMutex( - pthr, - dwDesiredAccess, - bInheritHandle, - lpName, - &hMutex - ); - -OpenMutexWExit: + else + { + ASSERT("lpName: Cross-process named objects are not supported in PAL"); + palError = ERROR_NOT_SUPPORTED; + } if (NO_ERROR != palError) { diff --git a/src/pal/src/synchobj/semaphore.cpp b/src/pal/src/synchobj/semaphore.cpp index 1dd47143bf31..a8172a1d3ec3 100644 --- a/src/pal/src/synchobj/semaphore.cpp +++ b/src/pal/src/synchobj/semaphore.cpp @@ -113,7 +113,6 @@ CreateSemaphoreA( IN LPCSTR lpName) { HANDLE hSemaphore = NULL; - WCHAR pwName[c_cchMaxSemaphore]; CPalThread *pthr = NULL; PAL_ERROR palError; @@ -124,28 +123,10 @@ CreateSemaphoreA( pthr = InternalGetCurrentThread(); - if (lpName != NULL) + if (lpName != nullptr) { - palError = InternalWszNameFromSzName( - pthr, - lpName, - pwName, - sizeof(pwName) / sizeof(pwName[0]) - ); - - if (NO_ERROR != palError) - { - goto CreateSemaphoreAExit; - } - - palError = InternalCreateSemaphore( - pthr, - lpSemaphoreAttributes, - lInitialCount, - lMaximumCount, - pwName, - &hSemaphore - ); + ASSERT("lpName: Cross-process named objects are not supported in PAL"); + palError = ERROR_NOT_SUPPORTED; } else { @@ -159,8 +140,6 @@ CreateSemaphoreA( ); } -CreateSemaphoreAExit: - // // We always need to set last error, even on success: // we need to protect ourselves from the situation @@ -312,6 +291,13 @@ CorUnix::InternalCreateSemaphore( phSemaphore ); + if (lpName != nullptr) + { + ASSERT("lpName: Cross-process named objects are not supported in PAL"); + palError = ERROR_NOT_SUPPORTED; + goto InternalCreateSemaphoreExit; + } + if (lMaximumCount <= 0) { ERROR("lMaximumCount is invalid (%d)\n", lMaximumCount); @@ -565,6 +551,7 @@ CorUnix::InternalReleaseSemaphore( return palError; } +// TODO: Implementation of OpenSemaphoreA() doesn't exist, do we need it? More generally, do we need the A versions at all? /*++ Function: @@ -596,22 +583,16 @@ OpenSemaphoreW( pthr = InternalGetCurrentThread(); /* validate parameters */ - if (lpName == NULL) + if (lpName == nullptr) { ERROR("lpName is NULL\n"); palError = ERROR_INVALID_PARAMETER; - goto OpenSemaphoreWExit; } - - palError = InternalOpenSemaphore( - pthr, - dwDesiredAccess, - bInheritHandle, - lpName, - &hSemaphore - ); - -OpenSemaphoreWExit: + else + { + ASSERT("lpName: Cross-process named objects are not supported in PAL"); + palError = ERROR_NOT_SUPPORTED; + } if (NO_ERROR != palError) { diff --git a/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test8/createfilemapping.c b/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test8/createfilemapping.c index 53aa3f02f73b..8ce8efaee04f 100644 --- a/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test8/createfilemapping.c +++ b/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingA/test8/createfilemapping.c @@ -73,28 +73,6 @@ int __cdecl main(int argc, char *argv[]) GetLastError()); } - /* Create a COPYWRITE, "swap", 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, /*copywrite*/ - 0, /*high-order size*/ - MAPPINGSIZE, /*low-order size*/ - lpObjectName); /*named object*/ - - if(NULL == hFileMap) - { - Fail("ERROR:%u: Failed to create File Mapping.\n", - GetLastError()); - } /* Terminate the PAL. */ diff --git a/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingW/test8/createfilemapping.c b/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingW/test8/createfilemapping.c index 2456b71b8a05..2023fa115cb3 100644 --- a/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingW/test8/createfilemapping.c +++ b/src/pal/tests/palsuite/filemapping_memmgt/CreateFileMappingW/test8/createfilemapping.c @@ -74,30 +74,6 @@ int __cdecl main(int argc, char *argv[]) GetLastError()); } - /* Create a COPYWRITE, "swap", 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, /*writecopy*/ - 0, /*high-order size*/ - MAPPINGSIZE, /*low-order size*/ - lpObjectName); /*named object*/ - - if(NULL == hFileMap) - { - Fail("ERROR:%u: Failed to create File Mapping.\n", - GetLastError()); - } - - /* Terminate the PAL. */ diff --git a/src/pal/tests/palsuite/paltestlist.txt b/src/pal/tests/palsuite/paltestlist.txt index cd454a8ec948..2dbcd034a6cd 100644 --- a/src/pal/tests/palsuite/paltestlist.txt +++ b/src/pal/tests/palsuite/paltestlist.txt @@ -474,10 +474,6 @@ filemapping_memmgt/MapViewOfFile/test3/paltest_mapviewoffile_test3 filemapping_memmgt/MapViewOfFile/test4/paltest_mapviewoffile_test4 filemapping_memmgt/MapViewOfFile/test5/paltest_mapviewoffile_test5 filemapping_memmgt/MapViewOfFile/test6/paltest_mapviewoffile_test6 -filemapping_memmgt/OpenFileMappingA/test1/paltest_openfilemappinga_test1 -filemapping_memmgt/OpenFileMappingA/test2/paltest_openfilemappinga_test2 -filemapping_memmgt/OpenFileMappingW/test1/paltest_openfilemappingw_test1 -filemapping_memmgt/OpenFileMappingW/test2/paltest_openfilemappingw_test2 filemapping_memmgt/RtlMoveMemory/test1/paltest_rtlmovememory_test1 filemapping_memmgt/RtlMoveMemory/test3/paltest_rtlmovememory_test3 filemapping_memmgt/RtlMoveMemory/test4/paltest_rtlmovememory_test4 @@ -726,24 +722,18 @@ pal_specific/PAL_RegisterLibraryW_UnregisterLibraryW/test2_neg/paltest_reg_unreg samples/test1/paltest_samples_test1 threading/CreateEventA/test1/paltest_createeventa_test1 threading/CreateEventA/test2/paltest_createeventa_test2 -threading/CreateEventA/test3/paltest_createeventa_test3 threading/CreateEventW/test1/paltest_createeventw_test1 threading/CreateEventW/test2/paltest_createeventw_test2 -threading/CreateEventW/test3/paltest_createeventw_test3 threading/CreateMutexA_ReleaseMutex/test1/paltest_createmutexa_releasemutex_test1 -threading/CreateMutexA_ReleaseMutex/test2/paltest_createmutexa_releasemutex_test2 threading/CreateMutexW_ReleaseMutex/test1/paltest_createmutexw_releasemutex_test1 -threading/CreateMutexW_ReleaseMutex/test2/paltest_createmutexw_releasemutex_test2 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/CreateSemaphoreA_ReleaseSemaphore/test1/paltest_createsemaphorea_releasesemaphore_test1 threading/CreateSemaphoreA_ReleaseSemaphore/test2/paltest_createsemaphorea_releasesemaphore_test2 -threading/CreateSemaphoreA_ReleaseSemaphore/test3/paltest_createsemaphorea_releasesemaphore_test3 threading/CreateSemaphoreW_ReleaseSemaphore/test1/paltest_createsemaphorew_releasesemaphore_test1 threading/CreateSemaphoreW_ReleaseSemaphore/test2/paltest_createsemaphorew_releasesemaphore_test2 -threading/CreateSemaphoreW_ReleaseSemaphore/test3/paltest_createsemaphorew_releasesemaphore_test3 threading/CreateThread/test1/paltest_createthread_test1 threading/CreateThread/test3/paltest_createthread_test3 threading/CriticalSectionFunctions/test1/paltest_criticalsectionfunctions_test1 @@ -754,7 +744,6 @@ threading/CriticalSectionFunctions/test7/paltest_criticalsectionfunctions_test7 threading/CriticalSectionFunctions/test8/paltest_criticalsectionfunctions_test8 threading/DuplicateHandle/test10/paltest_duplicatehandle_test10 threading/DuplicateHandle/test2/paltest_duplicatehandle_test2 -threading/DuplicateHandle/test3/paltest_duplicatehandle_test3 threading/DuplicateHandle/test4/paltest_duplicatehandle_test4 threading/DuplicateHandle/test5/paltest_duplicatehandle_test5 threading/DuplicateHandle/test6/paltest_duplicatehandle_test6 @@ -768,10 +757,6 @@ threading/GetCurrentProcessId/test1/paltest_getcurrentprocessid_test1 threading/GetCurrentThread/test1/paltest_getcurrentthread_test1 threading/GetCurrentThread/test2/paltest_getcurrentthread_test2 threading/GetProcessTimes/test2/paltest_getprocesstimes_test2 -threading/OpenEventW/test1/paltest_openeventw_test1 -threading/OpenEventW/test2/paltest_openeventw_test2 -threading/OpenEventW/test4/paltest_openeventw_test4 -threading/OpenEventW/test5/paltest_openeventw_test5 threading/QueueUserAPC/test2/paltest_queueuserapc_test2 threading/QueueUserAPC/test3/paltest_queueuserapc_test3 threading/QueueUserAPC/test4/paltest_queueuserapc_test4 diff --git a/src/pal/tests/palsuite/paltestlist_to_be_reviewed.txt b/src/pal/tests/palsuite/paltestlist_to_be_reviewed.txt index a6729839a2eb..f638e9650295 100644 --- a/src/pal/tests/palsuite/paltestlist_to_be_reviewed.txt +++ b/src/pal/tests/palsuite/paltestlist_to_be_reviewed.txt @@ -78,7 +78,11 @@ filemapping_memmgt/LockFile/test3/paltest_lockfile_test3 filemapping_memmgt/LockFile/test4/paltest_lockfile_test4 filemapping_memmgt/LockFile/test5/paltest_lockfile_test5 filemapping_memmgt/LockFile/test6/paltest_lockfile_test6 +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 filemapping_memmgt/ReadProcessMemory/ReadProcessMemory_neg1/paltest_readprocessmemory_readprocessmemory_neg1 filemapping_memmgt/ReadProcessMemory/test1/paltest_readprocessmemory_test1 @@ -165,18 +169,29 @@ pal_specific/PAL_get_stdin/test1/paltest_pal_get_stdin_test1 pal_specific/PAL_get_stdout/test1/paltest_pal_get_stdout_test1 pal_specific/PAL_RegisterLibraryW_UnregisterLibraryW/test1/paltest_pal_registerlibraryw_unregisterlibraryw_test1 samples/test2/paltest_samples_test2 +threading/CreateEventA/test3/paltest_createeventa_test3 +threading/CreateEventW/test3/paltest_createeventw_test3 +threading/CreateMutexA_ReleaseMutex/test2/paltest_createmutexa_releasemutex_test2 +threading/CreateMutexW_ReleaseMutex/test2/paltest_createmutexw_releasemutex_test2 +threading/CreateSemaphoreA_ReleaseSemaphore/test3/paltest_createsemaphorea_releasesemaphore_test3 +threading/CreateSemaphoreW_ReleaseSemaphore/test3/paltest_createsemaphorew_releasesemaphore_test3 threading/CreateThread/test2/paltest_createthread_test2 threading/CriticalSectionFunctions/test5/paltest_criticalsectionfunctions_test5 threading/CriticalSectionFunctions/test6/paltest_criticalsectionfunctions_test6 threading/DuplicateHandle/test1/paltest_duplicatehandle_test1 threading/DuplicateHandle/test11/paltest_duplicatehandle_test11 threading/DuplicateHandle/test12/paltest_duplicatehandle_test12 +threading/DuplicateHandle/test3/paltest_duplicatehandle_test3 threading/DuplicateHandle/test9/paltest_duplicatehandle_test9 threading/ExitThread/test2/paltest_exitthread_test2 threading/GetCurrentProcess/test1/paltest_getcurrentprocess_test1 threading/GetCurrentThreadId/test1/paltest_getcurrentthreadid_test1 threading/GetExitCodeProcess/test1/paltest_getexitcodeprocess_test1 +threading/OpenEventW/test1/paltest_openeventw_test1 +threading/OpenEventW/test2/paltest_openeventw_test2 threading/OpenEventW/test3/paltest_openeventw_test3 +threading/OpenEventW/test4/paltest_openeventw_test4 +threading/OpenEventW/test5/paltest_openeventw_test5 threading/OpenProcess/test1/paltest_openprocess_test1 threading/QueueUserAPC/test1/paltest_queueuserapc_test1 threading/SetConsoleCtrlHandler/test1/paltest_setconsolectrlhandler_test1 diff --git a/src/pal/tests/palsuite/threading/CreateEventA/test1/test1.c b/src/pal/tests/palsuite/threading/CreateEventA/test1/test1.c index 8a90c76985f4..9f9c57018408 100644 --- a/src/pal/tests/palsuite/threading/CreateEventA/test1/test1.c +++ b/src/pal/tests/palsuite/threading/CreateEventA/test1/test1.c @@ -34,7 +34,6 @@ BOOL CreateEventTest() LPSECURITY_ATTRIBUTES lpEventAttributes = NULL; BOOL bManualReset = TRUE; BOOL bInitialState = TRUE; - LPCTSTR lpName = "Event #1"; /* Call CreateEvent, and check to ensure the returned HANDLE is a valid event HANDLE @@ -43,7 +42,7 @@ BOOL CreateEventTest() HANDLE hEvent = CreateEvent( lpEventAttributes, bManualReset, bInitialState, - lpName); + NULL); if (hEvent != NULL) { @@ -54,8 +53,7 @@ BOOL CreateEventTest() if (dwRet != WAIT_OBJECT_0) { - Trace("CreateEventTest:WaitForSingleObject %s " - "failed (%x)\n",lpName,GetLastError()); + Trace("CreateEventTest:WaitForSingleObject failed (%x)\n", GetLastError()); } else { @@ -67,15 +65,13 @@ BOOL CreateEventTest() if (!bRet) { - Trace("CreateEventTest:CloseHandle %s " - "failed (%x)\n",lpName,GetLastError()); + Trace("CreateEventTest:CloseHandle failed (%x)\n", GetLastError()); } } } else { - Trace("CreateEventTest:CreateEvent %s " - "failed (%x)\n",lpName,GetLastError()); + Trace("CreateEventTest:CreateEvent failed (%x)\n", GetLastError()); } return bRet; diff --git a/src/pal/tests/palsuite/threading/CreateEventA/test2/test2.c b/src/pal/tests/palsuite/threading/CreateEventA/test2/test2.c index 1079459b8abc..d7c888234d1d 100644 --- a/src/pal/tests/palsuite/threading/CreateEventA/test2/test2.c +++ b/src/pal/tests/palsuite/threading/CreateEventA/test2/test2.c @@ -24,14 +24,13 @@ BOOL CreateEventTest() LPSECURITY_ATTRIBUTES lpEventAttributes = 0; BOOL bManualReset = TRUE; BOOL bInitialState = FALSE; - LPCTSTR lpName = "Event #2"; /* Create an event with the Initial State set to FALSE */ HANDLE hEvent = CreateEvent( lpEventAttributes, bManualReset, bInitialState, - lpName); + NULL); if (hEvent != NULL) { @@ -43,8 +42,7 @@ BOOL CreateEventTest() if (dwRet != WAIT_TIMEOUT) { - Trace("CloseEventTest:WaitForSingleObject %s " - "failed (%x)\n",lpName,GetLastError()); + Trace("CloseEventTest:WaitForSingleObject failed (%x)\n", GetLastError()); } else { @@ -57,15 +55,13 @@ BOOL CreateEventTest() if (!bRet) { - Trace("CloseEventTest:CloseHandle %s failed " - " (%x)\n",lpName,GetLastError()); + Trace("CloseEventTest:CloseHandle failed (%x)\n", GetLastError()); } } } else { - Trace("CloseEventTest:CreateEvent %s " - "failed (%x)\n",lpName,GetLastError()); + Trace("CloseEventTest:CreateEvent failed (%x)\n", GetLastError()); } return bRet; diff --git a/src/pal/tests/palsuite/threading/CreateEventW/test1/test1.c b/src/pal/tests/palsuite/threading/CreateEventW/test1/test1.c index feee22c40132..0f666753a9b6 100644 --- a/src/pal/tests/palsuite/threading/CreateEventW/test1/test1.c +++ b/src/pal/tests/palsuite/threading/CreateEventW/test1/test1.c @@ -29,18 +29,16 @@ BOOL CreateEventTest() LPSECURITY_ATTRIBUTES lpEventAttributes = NULL; BOOL bManualReset = TRUE; BOOL bInitialState = TRUE; - WCHAR TheName[] = {'E','v','e','n','t','\0'}; - LPWSTR lpName = TheName; /* * Call CreateEvent, and check to ensure the returned HANDLE is a * valid event HANDLE */ - HANDLE hEvent = CreateEvent( lpEventAttributes, + HANDLE hEvent = CreateEventW(lpEventAttributes, bManualReset, bInitialState, - lpName); + NULL); if (hEvent != NULL) { @@ -52,8 +50,7 @@ BOOL CreateEventTest() if (dwRet != WAIT_OBJECT_0) { - Trace("CreateEventTest:WaitForSingleObject %s " - "failed (%x)\n",lpName,GetLastError()); + Trace("CreateEventTest:WaitForSingleObject failed (%x)\n", GetLastError()); } else { @@ -66,15 +63,13 @@ BOOL CreateEventTest() if (!bRet) { - Trace("CreateEventTest:CloseHandle %s " - "failed (%x)\n",lpName,GetLastError()); + Trace("CreateEventTest:CloseHandle failed (%x)\n", GetLastError()); } } } else { - Trace("CreateEventTest:CreateEvent %s " - "failed (%x)\n",lpName,GetLastError()); + Trace("CreateEventTest:CreateEvent failed (%x)\n", GetLastError()); } return bRet; diff --git a/src/pal/tests/palsuite/threading/CreateEventW/test2/test2.c b/src/pal/tests/palsuite/threading/CreateEventW/test2/test2.c index c85c6545fbb0..c0df4651b72c 100644 --- a/src/pal/tests/palsuite/threading/CreateEventW/test2/test2.c +++ b/src/pal/tests/palsuite/threading/CreateEventW/test2/test2.c @@ -24,16 +24,14 @@ BOOL CreateEventTest() LPSECURITY_ATTRIBUTES lpEventAttributes = 0; BOOL bManualReset = TRUE; BOOL bInitialState = FALSE; - WCHAR TheName[] = {'E','v','e','n','t','\0'}; - LPWSTR lpName = TheName; /* Create an event with the Initial State set to FALSE */ - HANDLE hEvent = CreateEvent( lpEventAttributes, + HANDLE hEvent = CreateEventW(lpEventAttributes, bManualReset, bInitialState, - lpName); + NULL); if (hEvent != NULL) { @@ -45,8 +43,7 @@ BOOL CreateEventTest() if (dwRet != WAIT_TIMEOUT) { - Trace("CloseEventTest:WaitForSingleObject %s " - "failed (%x)\n",lpName,GetLastError()); + Trace("CloseEventTest:WaitForSingleObject failed (%x)\n", GetLastError()); } else { @@ -59,15 +56,13 @@ BOOL CreateEventTest() if (!bRet) { - Trace("CloseEventTest:CloseHandle %s failed " - " (%x)\n",lpName,GetLastError()); + Trace("CloseEventTest:CloseHandle failed (%x)\n", GetLastError()); } } } else { - Trace("CloseEventTest:CreateEvent %s " - "failed (%x)\n",lpName,GetLastError()); + Trace("CloseEventTest:CreateEvent failed (%x)\n", GetLastError()); } return bRet; diff --git a/src/pal/tests/palsuite/threading/ResetEvent/test1/test1.c b/src/pal/tests/palsuite/threading/ResetEvent/test1/test1.c index c0122e594625..901f19c13269 100644 --- a/src/pal/tests/palsuite/threading/ResetEvent/test1/test1.c +++ b/src/pal/tests/palsuite/threading/ResetEvent/test1/test1.c @@ -24,11 +24,10 @@ BOOL ResetEventTest() LPSECURITY_ATTRIBUTES lpEventAttributes = 0; BOOL bManualReset = TRUE; BOOL bInitialState = TRUE; - LPCTSTR lpName = "Event #4"; /* Create an Event, ensure it is valid */ HANDLE hEvent = CreateEvent( lpEventAttributes, - bManualReset, bInitialState, lpName); + bManualReset, bInitialState, NULL); if (hEvent != INVALID_HANDLE_VALUE) { @@ -40,8 +39,7 @@ BOOL ResetEventTest() if (dwRet != WAIT_OBJECT_0) { - Fail("ResetEventTest:WaitForSingleObject %s " - "failed (%x)\n",lpName,GetLastError()); + Fail("ResetEventTest:WaitForSingleObject failed (%x)\n", GetLastError()); } else { @@ -50,8 +48,7 @@ BOOL ResetEventTest() if (!bRet) { - Fail("ResetEventTest:ResetEvent %s failed " - "(%x)\n",lpName,GetLastError()); + Fail("ResetEventTest:ResetEvent failed (%x)\n", GetLastError()); } else { @@ -62,8 +59,7 @@ BOOL ResetEventTest() if (dwRet != WAIT_TIMEOUT) { - Fail("ResetEventTest:WaitForSingleObject " - "%s failed (%x)\n",lpName,GetLastError()); + Fail("ResetEventTest:WaitForSingleObject %s failed (%x)\n", GetLastError()); } else { @@ -71,8 +67,7 @@ BOOL ResetEventTest() if (!bRet) { - Fail("ResetEventTest:CloseHandle %s failed" - "(%x)\n",lpName,GetLastError()); + Fail("ResetEventTest:CloseHandle failed (%x)\n", GetLastError()); } } } @@ -80,8 +75,7 @@ BOOL ResetEventTest() } else { - Fail("ResetEventTest:CreateEvent %s failed " - "(%x)\n",lpName,GetLastError()); + Fail("ResetEventTest:CreateEvent failed (%x)\n", GetLastError()); } return bRet; diff --git a/src/pal/tests/palsuite/threading/ResetEvent/test2/test2.c b/src/pal/tests/palsuite/threading/ResetEvent/test2/test2.c index f30c24ce70f6..d7c782b20c91 100644 --- a/src/pal/tests/palsuite/threading/ResetEvent/test2/test2.c +++ b/src/pal/tests/palsuite/threading/ResetEvent/test2/test2.c @@ -33,7 +33,6 @@ int __cdecl main( int argc, char **argv ) LPSECURITY_ATTRIBUTES lpEventAttributes = NULL; BOOL bManualReset = TRUE; BOOL bInitialState = FALSE; - LPCTSTR lpName = "HolyMoly"; /* PAL initialization */ @@ -47,7 +46,7 @@ int __cdecl main( int argc, char **argv ) hEvent = CreateEvent( lpEventAttributes, bManualReset, bInitialState, - lpName ); + NULL ); if( hEvent == INVALID_HANDLE_VALUE ) { diff --git a/src/pal/tests/palsuite/threading/ResetEvent/test3/test3.c b/src/pal/tests/palsuite/threading/ResetEvent/test3/test3.c index 8b83faa6dfa0..8d140a730185 100644 --- a/src/pal/tests/palsuite/threading/ResetEvent/test3/test3.c +++ b/src/pal/tests/palsuite/threading/ResetEvent/test3/test3.c @@ -35,7 +35,6 @@ int __cdecl main( int argc, char **argv ) LPSECURITY_ATTRIBUTES lpEventAttributes = NULL; BOOL bManualReset = TRUE; BOOL bInitialState = FALSE; - LPCTSTR lpName = "WooBaby"; /* PAL initialization */ @@ -49,7 +48,7 @@ int __cdecl main( int argc, char **argv ) hEvent = CreateEvent( lpEventAttributes, bManualReset, bInitialState, - lpName ); + NULL ); if( hEvent == INVALID_HANDLE_VALUE ) { diff --git a/src/pal/tests/palsuite/threading/ResetEvent/test4/test4.c b/src/pal/tests/palsuite/threading/ResetEvent/test4/test4.c index 2b6c8bf55a07..cff95762d7ed 100644 --- a/src/pal/tests/palsuite/threading/ResetEvent/test4/test4.c +++ b/src/pal/tests/palsuite/threading/ResetEvent/test4/test4.c @@ -39,7 +39,6 @@ int __cdecl main( int argc, char **argv ) LPSECURITY_ATTRIBUTES lpEventAttributes = NULL; BOOL bManualReset = TRUE; BOOL bInitialState = TRUE; - LPCTSTR lpName = "MamaMia"; /* PAL initialization */ @@ -53,7 +52,7 @@ int __cdecl main( int argc, char **argv ) hEvent = CreateEvent( lpEventAttributes, bManualReset, bInitialState, - lpName ); + NULL ); if( hEvent == INVALID_HANDLE_VALUE ) { diff --git a/src/pal/tests/palsuite/threading/SetEvent/test1/test1.c b/src/pal/tests/palsuite/threading/SetEvent/test1/test1.c index 9df5e0987c12..c3a2fd098323 100644 --- a/src/pal/tests/palsuite/threading/SetEvent/test1/test1.c +++ b/src/pal/tests/palsuite/threading/SetEvent/test1/test1.c @@ -24,11 +24,10 @@ BOOL SetEventTest() LPSECURITY_ATTRIBUTES lpEventAttributes = 0; BOOL bManualReset = TRUE; BOOL bInitialState = FALSE; - LPCTSTR lpName = "Event #3"; /* Create an event which we can use with SetEvent */ HANDLE hEvent = CreateEvent( lpEventAttributes, - bManualReset, bInitialState, lpName); + bManualReset, bInitialState, NULL); if (hEvent != INVALID_HANDLE_VALUE) { @@ -36,8 +35,7 @@ BOOL SetEventTest() if (dwRet != WAIT_TIMEOUT) { - Trace("SetEventTest:WaitForSingleObject %s " - "failed (%x)\n",lpName,GetLastError()); + Trace("SetEventTest:WaitForSingleObject failed (%x)\n", GetLastError()); } else { @@ -48,8 +46,7 @@ BOOL SetEventTest() if (!bRet) { - Trace("SetEventTest:SetEvent %s " - "failed (%x)\n",lpName,GetLastError()); + Trace("SetEventTest:SetEvent failed (%x)\n", GetLastError()); } else { @@ -57,8 +54,7 @@ BOOL SetEventTest() if (dwRet != WAIT_OBJECT_0) { - Trace("SetEventTest:WaitForSingleObject %s " - "failed (%x)\n",lpName,GetLastError()); + Trace("SetEventTest:WaitForSingleObject failed (%x)\n", GetLastError()); } else { @@ -66,8 +62,7 @@ BOOL SetEventTest() if (!dwRet) { - Trace("SetEventTest:CloseHandle %s " - "failed (%x)\n",lpName,GetLastError()); + Trace("SetEventTest:CloseHandle failed (%x)\n", GetLastError()); } } } @@ -75,8 +70,7 @@ BOOL SetEventTest() } else { - Trace("SetEventTest:CreateEvent %s " - "failed (%x)\n",lpName,GetLastError()); + Trace("SetEventTest:CreateEvent failed (%x)\n", GetLastError()); } return bRet; diff --git a/src/pal/tests/palsuite/threading/SetEvent/test2/test2.c b/src/pal/tests/palsuite/threading/SetEvent/test2/test2.c index df3f064f1de4..394c6464c08e 100644 --- a/src/pal/tests/palsuite/threading/SetEvent/test2/test2.c +++ b/src/pal/tests/palsuite/threading/SetEvent/test2/test2.c @@ -34,7 +34,6 @@ int __cdecl main( int argc, char **argv ) LPSECURITY_ATTRIBUTES lpEventAttributes = NULL; BOOL bManualReset = TRUE; BOOL bInitialState = FALSE; - LPCTSTR lpName = "WooBaby"; /* PAL initialization */ @@ -48,7 +47,7 @@ int __cdecl main( int argc, char **argv ) hEvent = CreateEvent( lpEventAttributes, bManualReset, bInitialState, - lpName ); + NULL ); if( hEvent == INVALID_HANDLE_VALUE ) { diff --git a/src/pal/tests/palsuite/threading/SetEvent/test3/test3.c b/src/pal/tests/palsuite/threading/SetEvent/test3/test3.c index a8c7f8035092..8dd699746526 100644 --- a/src/pal/tests/palsuite/threading/SetEvent/test3/test3.c +++ b/src/pal/tests/palsuite/threading/SetEvent/test3/test3.c @@ -34,7 +34,6 @@ int __cdecl main( int argc, char **argv ) LPSECURITY_ATTRIBUTES lpEventAttributes = NULL; BOOL bManualReset = TRUE; BOOL bInitialState = FALSE; - LPCTSTR lpName = "WooBaby"; /* PAL initialization */ @@ -48,7 +47,7 @@ int __cdecl main( int argc, char **argv ) hEvent = CreateEvent( lpEventAttributes, bManualReset, bInitialState, - lpName ); + NULL ); if( hEvent == INVALID_HANDLE_VALUE ) { diff --git a/src/pal/tests/palsuite/threading/SetEvent/test4/test4.c b/src/pal/tests/palsuite/threading/SetEvent/test4/test4.c index 39ff41930529..4e627ef39803 100644 --- a/src/pal/tests/palsuite/threading/SetEvent/test4/test4.c +++ b/src/pal/tests/palsuite/threading/SetEvent/test4/test4.c @@ -39,7 +39,6 @@ int __cdecl main( int argc, char **argv ) LPSECURITY_ATTRIBUTES lpEventAttributes = NULL; BOOL bManualReset = TRUE; BOOL bInitialState = FALSE; - LPCTSTR lpName = "OhYeah"; /* PAL initialization */ @@ -53,7 +52,7 @@ int __cdecl main( int argc, char **argv ) hEvent = CreateEvent( lpEventAttributes, bManualReset, bInitialState, - lpName ); + NULL ); if( hEvent == INVALID_HANDLE_VALUE ) { diff --git a/src/pal/tests/palsuite/threading/WaitForMultipleObjects/test1/test1.c b/src/pal/tests/palsuite/threading/WaitForMultipleObjects/test1/test1.c index e5e23d8a2eaf..ad9bbf6305a0 100644 --- a/src/pal/tests/palsuite/threading/WaitForMultipleObjects/test1/test1.c +++ b/src/pal/tests/palsuite/threading/WaitForMultipleObjects/test1/test1.c @@ -29,23 +29,18 @@ BOOL WaitForMultipleObjectsTest() LPSECURITY_ATTRIBUTES lpEventAttributes = NULL; BOOL bManualReset = TRUE; BOOL bInitialState = TRUE; - LPTSTR lpName[MAX_EVENTS]; HANDLE hEvent[MAX_EVENTS]; /* Run through this for loop and create 4 events */ for (i = 0; i < MAX_EVENTS; i++) { - lpName[i] = (TCHAR*)malloc(MAX_PATH); - sprintf(lpName[i],"Event #%d",i); - hEvent[i] = CreateEvent( lpEventAttributes, - bManualReset, bInitialState, lpName[i]); + bManualReset, bInitialState, NULL); if (hEvent[i] == INVALID_HANDLE_VALUE) { - Trace("WaitForMultipleObjectsTest:CreateEvent " - "%s failed (%x)\n",lpName[i],GetLastError()); + Trace("WaitForMultipleObjectsTest:CreateEvent %u failed (%x)\n", i, GetLastError()); bRet = FALSE; break; } @@ -55,8 +50,7 @@ BOOL WaitForMultipleObjectsTest() if (!bRet) { - Trace("WaitForMultipleObjectsTest:SetEvent %s " - "failed (%x)\n",lpName[i],GetLastError()); + Trace("WaitForMultipleObjectsTest:SetEvent %u failed (%x)\n", i, GetLastError()); bRet = FALSE; break; } @@ -66,8 +60,7 @@ BOOL WaitForMultipleObjectsTest() if (dwRet != WAIT_OBJECT_0) { - Trace("WaitForMultipleObjectsTest:WaitForSingleObject " - "%s failed (%x)\n",lpName[i],GetLastError()); + Trace("WaitForMultipleObjectsTest:WaitForSingleObject %u failed (%x)\n", i, GetLastError()); bRet = FALSE; break; } @@ -79,8 +72,7 @@ BOOL WaitForMultipleObjectsTest() if (!bRet) { - Trace("WaitForMultipleObjectsTest:ResetEvent %s " - "failed (%x)\n",lpName[i],GetLastError()); + Trace("WaitForMultipleObjectsTest:ResetEvent %u failed (%x)\n", i, GetLastError()); bRet = FALSE; break; } @@ -89,8 +81,7 @@ BOOL WaitForMultipleObjectsTest() if (dwRet != WAIT_TIMEOUT) { - Trace("WaitForMultipleObjectsTest:WaitForSingleObject " - "%s failed (%x)\n",lpName[i],GetLastError()); + Trace("WaitForMultipleObjectsTest:WaitForSingleObject %u failed (%x)\n", i, GetLastError()); bRet = FALSE; break; } @@ -117,8 +108,7 @@ BOOL WaitForMultipleObjectsTest() if (dwRet != WAIT_TIMEOUT) { - Trace("WaitForMultipleObjectsTest:WaitForMultipleObjects " - "%s failed (%x)\n",lpName[0],GetLastError()); + Trace("WaitForMultipleObjectsTest:WaitForMultipleObjects failed (%x)\n", GetLastError()); } else { @@ -137,9 +127,7 @@ BOOL WaitForMultipleObjectsTest() if (!bRet) { - Trace("WaitForMultipleObjectsTest:SetEvent " - "%s failed (%x)\n", - lpName[j],GetLastError()); + Trace("WaitForMultipleObjectsTest:SetEvent %u failed (%x)\n", j, GetLastError()); break; } } @@ -149,9 +137,7 @@ BOOL WaitForMultipleObjectsTest() if (!bRet) { - Trace("WaitForMultipleObjectsTest:ResetEvent " - "%s failed (%x)\n", - lpName[j],GetLastError()); + Trace("WaitForMultipleObjectsTest:ResetEvent %u failed (%x)\n", j, GetLastError()); } } } @@ -164,8 +150,7 @@ BOOL WaitForMultipleObjectsTest() if (dwRet != WAIT_OBJECT_0+i) { - Trace("WaitForMultipleObjectsTest:WaitForMultipleObjects" - " %s failed (%x)\n",lpName[0],GetLastError()); + Trace("WaitForMultipleObjectsTest:WaitForMultipleObjects failed (%x)\n", GetLastError()); bRet = FALSE; break; } @@ -178,11 +163,8 @@ BOOL WaitForMultipleObjectsTest() if (!bRet) { - Trace("WaitForMultipleObjectsTest:CloseHandle %s " - "failed (%x)\n",lpName[i],GetLastError()); + Trace("WaitForMultipleObjectsTest:CloseHandle %u failed (%x)\n", i, GetLastError()); } - - free((void*)lpName[i]); } } diff --git a/src/pal/tests/palsuite/threading/WaitForMultipleObjectsEx/test1/test1.c b/src/pal/tests/palsuite/threading/WaitForMultipleObjectsEx/test1/test1.c index b762ce4f8740..375c85d1a475 100644 --- a/src/pal/tests/palsuite/threading/WaitForMultipleObjectsEx/test1/test1.c +++ b/src/pal/tests/palsuite/threading/WaitForMultipleObjectsEx/test1/test1.c @@ -31,23 +31,18 @@ BOOL WaitForMultipleObjectsExTest() LPSECURITY_ATTRIBUTES lpEventAttributes = NULL; BOOL bManualReset = TRUE; BOOL bInitialState = TRUE; - LPTSTR lpName[MAX_EVENTS]; HANDLE hEvent[MAX_EVENTS]; /* Run through this for loop and create 4 events */ for (i = 0; i < MAX_EVENTS; i++) { - lpName[i] = (TCHAR*)malloc(MAX_PATH); - sprintf(lpName[i],"Event #%d",i); - hEvent[i] = CreateEvent( lpEventAttributes, - bManualReset, bInitialState, lpName[i]); + bManualReset, bInitialState, NULL); if (hEvent[i] == INVALID_HANDLE_VALUE) { - Trace("WaitForMultipleObjectsExTest:CreateEvent " - "%s failed (%x)\n",lpName[i],GetLastError()); + Trace("WaitForMultipleObjectsExTest:CreateEvent %u failed (%x)\n", i, GetLastError()); bRet = FALSE; break; } @@ -57,8 +52,7 @@ BOOL WaitForMultipleObjectsExTest() if (!bRet) { - Trace("WaitForMultipleObjectsExTest:SetEvent %s " - "failed (%x)\n",lpName[i],GetLastError()); + Trace("WaitForMultipleObjectsExTest:SetEvent %u failed (%x)\n", i, GetLastError()); bRet = FALSE; break; } @@ -68,8 +62,7 @@ BOOL WaitForMultipleObjectsExTest() if (dwRet != WAIT_OBJECT_0) { - Trace("WaitForMultipleObjectsExTest:WaitForSingleObject " - "%s failed (%x)\n",lpName[i],GetLastError()); + Trace("WaitForMultipleObjectsExTest:WaitForSingleObject %u failed (%x)\n", i, GetLastError()); bRet = FALSE; break; } @@ -81,8 +74,7 @@ BOOL WaitForMultipleObjectsExTest() if (!bRet) { - Trace("WaitForMultipleObjectsExTest:ResetEvent %s " - "failed (%x)\n",lpName[i],GetLastError()); + Trace("WaitForMultipleObjectsExTest:ResetEvent %u failed (%x)\n", i, GetLastError()); bRet = FALSE; break; } @@ -91,8 +83,7 @@ BOOL WaitForMultipleObjectsExTest() if (dwRet != WAIT_TIMEOUT) { - Trace("WaitForMultipleObjectsExTest:WaitForSingleObject " - "%s failed (%x)\n",lpName[i],GetLastError()); + Trace("WaitForMultipleObjectsExTest:WaitForSingleObject %u failed (%x)\n", i, GetLastError()); bRet = FALSE; break; } @@ -120,8 +111,7 @@ BOOL WaitForMultipleObjectsExTest() if (dwRet != WAIT_TIMEOUT) { - Trace("WaitForMultipleObjectsExTest: WaitForMultipleObjectsEx " - "%s failed (%x)\n",lpName[0],GetLastError()); + Trace("WaitForMultipleObjectsExTest: WaitForMultipleObjectsEx failed (%x)\n", GetLastError()); } else { @@ -140,9 +130,7 @@ BOOL WaitForMultipleObjectsExTest() if (!bRet) { - Trace("WaitForMultipleObjectsExTest:SetEvent " - "%s failed (%x)\n", - lpName[j],GetLastError()); + Trace("WaitForMultipleObjectsExTest:SetEvent %j failed (%x)\n", j, GetLastError()); break; } } @@ -152,9 +140,7 @@ BOOL WaitForMultipleObjectsExTest() if (!bRet) { - Trace("WaitForMultipleObjectsExTest:ResetEvent " - "%s failed (%x)\n", - lpName[j],GetLastError()); + Trace("WaitForMultipleObjectsExTest:ResetEvent %u failed (%x)\n", j, GetLastError()); } } } @@ -167,9 +153,7 @@ BOOL WaitForMultipleObjectsExTest() if (dwRet != WAIT_OBJECT_0+i) { - Trace("WaitForMultipleObjectsExTest: " - "WaitForMultipleObjectsEx %s failed (%x)\n", - lpName[0],GetLastError()); + Trace("WaitForMultipleObjectsExTest: WaitForMultipleObjectsEx failed (%x)\n", GetLastError()); bRet = FALSE; break; } @@ -182,11 +166,8 @@ BOOL WaitForMultipleObjectsExTest() if (!bRet) { - Trace("WaitForMultipleObjectsExTest:CloseHandle %s " - "failed (%x)\n",lpName[i],GetLastError()); + Trace("WaitForMultipleObjectsExTest:CloseHandle %u failed (%x)\n", i, GetLastError()); } - - free((void*)lpName[i]); } } diff --git a/src/pal/tests/palsuite/threading/WaitForSingleObject/WFSOExMutexTest/WFSOExMutexTest.c b/src/pal/tests/palsuite/threading/WaitForSingleObject/WFSOExMutexTest/WFSOExMutexTest.c index 5d231cd7490d..303f9033e614 100644 --- a/src/pal/tests/palsuite/threading/WaitForSingleObject/WFSOExMutexTest/WFSOExMutexTest.c +++ b/src/pal/tests/palsuite/threading/WaitForSingleObject/WFSOExMutexTest/WFSOExMutexTest.c @@ -60,9 +60,9 @@ int __cdecl main( int argc, char **argv ) */ /* Create a mutex that is not in the signalled state */ - hMutex = CreateMutex( NULL, //No security attributes - TRUE, //Iniitally owned - "SomeMutex"); //Name of mutex + hMutex = CreateMutex(NULL, //No security attributes + TRUE, //Iniitally owned + NULL); //Name of mutex if (hMutex == NULL) { diff --git a/src/pal/tests/palsuite/threading/WaitForSingleObject/WFSOMutexTest/WFSOMutexTest.c b/src/pal/tests/palsuite/threading/WaitForSingleObject/WFSOMutexTest/WFSOMutexTest.c index f28d1a5a004b..dff346e70db0 100644 --- a/src/pal/tests/palsuite/threading/WaitForSingleObject/WFSOMutexTest/WFSOMutexTest.c +++ b/src/pal/tests/palsuite/threading/WaitForSingleObject/WFSOMutexTest/WFSOMutexTest.c @@ -54,10 +54,9 @@ int __cdecl main(int argc, char **argv) } //Create Mutex - hMutex = CreateMutex( - NULL, // no security attributes - FALSE, // initially not owned - "MutexToProtectGlobalCounter"); // name of mutex + hMutex = CreateMutex(NULL, // no security attributes + FALSE, // initially not owned + NULL); // name of mutex //Check for Mutex Creation diff --git a/src/pal/tests/palsuite/threading/WaitForSingleObject/test1/test1.c b/src/pal/tests/palsuite/threading/WaitForSingleObject/test1/test1.c index 7bea24bbd601..bfbebb20c7a0 100644 --- a/src/pal/tests/palsuite/threading/WaitForSingleObject/test1/test1.c +++ b/src/pal/tests/palsuite/threading/WaitForSingleObject/test1/test1.c @@ -25,13 +25,12 @@ BOOL WaitForSingleObjectTest() LPSECURITY_ATTRIBUTES lpEventAttributes = 0; BOOL bManualReset = TRUE; BOOL bInitialState = TRUE; - LPCTSTR lpName = "Event #6"; HANDLE hEvent; /* Create an event, and ensure the HANDLE is valid */ hEvent = CreateEvent(lpEventAttributes, bManualReset, - bInitialState, lpName); + bInitialState, NULL); if (hEvent != INVALID_HANDLE_VALUE) { @@ -44,8 +43,7 @@ BOOL WaitForSingleObjectTest() if (dwRet != WAIT_OBJECT_0) { - Trace("WaitForSingleObjectTest:WaitForSingleObject %s " - "failed (%x)\n",lpName,GetLastError()); + Trace("WaitForSingleObjectTest:WaitForSingleObject failed (%x)\n", GetLastError()); } else { @@ -53,15 +51,13 @@ BOOL WaitForSingleObjectTest() if (!bRet) { - Trace("WaitForSingleObjectTest:CloseHandle %s " - "failed (%x)\n",lpName,GetLastError()); + Trace("WaitForSingleObjectTest:CloseHandle failed (%x)\n", GetLastError()); } } } else { - Trace("WaitForSingleObjectTest:CreateEvent %s " - "failed (%x)\n",lpName,GetLastError()); + Trace("WaitForSingleObjectTest:CreateEvent failed (%x)\n", GetLastError()); } /* If the first section passed, Create another event, with the @@ -75,7 +71,7 @@ BOOL WaitForSingleObjectTest() bInitialState = FALSE; hEvent = CreateEvent( lpEventAttributes, - bManualReset, bInitialState, lpName); + bManualReset, bInitialState, NULL); if (hEvent != INVALID_HANDLE_VALUE) { @@ -88,8 +84,7 @@ BOOL WaitForSingleObjectTest() if (dwRet != WAIT_TIMEOUT) { - Trace("WaitForSingleObjectTest:WaitForSingleObject %s " - "failed (%x)\n",lpName,GetLastError()); + Trace("WaitForSingleObjectTest:WaitForSingleObject failed (%x)\n", GetLastError()); } else { @@ -97,15 +92,13 @@ BOOL WaitForSingleObjectTest() if (!bRet) { - Trace("WaitForSingleObjectTest:CloseHandle %s failed " - "(%x)\n",lpName,GetLastError()); + Trace("WaitForSingleObjectTest:CloseHandle failed (%x)\n", GetLastError()); } } } else { - Trace("WaitForSingleObjectTest::CreateEvent %s failed " - "(%x)\n",lpName,GetLastError()); + Trace("WaitForSingleObjectTest::CreateEvent failed (%x)\n", GetLastError()); } } return bRet;