Skip to content

Commit 3e5b44a

Browse files
authored
Remove FindFirstFile, FindNextFile and FindClose from PAL (#110797)
* Remove FindFirstFile, FindNextFile and FindClose from PAL Also remove the related tests * Modify superpmi mcs tool to not to use Find*File on Unix * Fix access after free for string in error path
1 parent 4152f62 commit 3e5b44a

File tree

27 files changed

+197
-5197
lines changed

27 files changed

+197
-5197
lines changed

src/coreclr/dlls/mscordac/mscordac_unixexports.src

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -77,9 +77,6 @@ nativeStringResourceTable_mscorrc
7777
#DeleteCriticalSection
7878
#DuplicateHandle
7979
#EnterCriticalSection
80-
#FindClose
81-
#FindFirstFileW
82-
#FindNextFileW
8380
#FlushFileBuffers
8481
#FlushInstructionCache
8582
#FormatMessageW

src/coreclr/inc/holder.h

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1115,7 +1115,6 @@ using FieldNuller = SpecializedWrapper<_TYPE, detail::ZeroMem<_TYPE>::Invoke>;
11151115
FORCEINLINE void VoidCloseHandle(HANDLE h) { if (h != NULL) CloseHandle(h); }
11161116
// (UINT_PTR) -1 is INVALID_HANDLE_VALUE
11171117
FORCEINLINE void VoidCloseFileHandle(HANDLE h) { if (h != ((HANDLE)((LONG_PTR) -1))) CloseHandle(h); }
1118-
FORCEINLINE void VoidFindClose(HANDLE h) { FindClose(h); }
11191118
FORCEINLINE void VoidUnmapViewOfFile(void *ptr) { UnmapViewOfFile(ptr); }
11201119

11211120
template <typename TYPE>
@@ -1125,7 +1124,6 @@ FORCEINLINE void TypeUnmapViewOfFile(TYPE *ptr) { UnmapViewOfFile(ptr); }
11251124
//@TODO: Dangerous default value. Some Win32 functions return INVALID_HANDLE_VALUE, some return NULL (such as CreatEvent).
11261125
typedef Wrapper<HANDLE, DoNothing<HANDLE>, VoidCloseHandle, (UINT_PTR) -1> HandleHolder;
11271126
typedef Wrapper<HANDLE, DoNothing<HANDLE>, VoidCloseFileHandle, (UINT_PTR) -1> FileHandleHolder;
1128-
typedef Wrapper<HANDLE, DoNothing<HANDLE>, VoidFindClose, (UINT_PTR) -1> FindHandleHolder;
11291127

11301128
typedef Wrapper<void *, DoNothing, VoidUnmapViewOfFile> MapViewHolder;
11311129

src/coreclr/pal/inc/pal.h

Lines changed: 0 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -541,74 +541,6 @@ CopyFileW(
541541
#define CopyFile CopyFileA
542542
#endif
543543

544-
typedef struct _WIN32_FIND_DATAA {
545-
DWORD dwFileAttributes;
546-
FILETIME ftCreationTime;
547-
FILETIME ftLastAccessTime;
548-
FILETIME ftLastWriteTime;
549-
DWORD nFileSizeHigh;
550-
DWORD nFileSizeLow;
551-
DWORD dwReserved0;
552-
DWORD dwReserved1;
553-
CHAR cFileName[ MAX_PATH_FNAME ];
554-
CHAR cAlternateFileName[ 14 ];
555-
} WIN32_FIND_DATAA, *PWIN32_FIND_DATAA, *LPWIN32_FIND_DATAA;
556-
557-
typedef struct _WIN32_FIND_DATAW {
558-
DWORD dwFileAttributes;
559-
FILETIME ftCreationTime;
560-
FILETIME ftLastAccessTime;
561-
FILETIME ftLastWriteTime;
562-
DWORD nFileSizeHigh;
563-
DWORD nFileSizeLow;
564-
DWORD dwReserved0;
565-
DWORD dwReserved1;
566-
WCHAR cFileName[ MAX_PATH_FNAME ];
567-
WCHAR cAlternateFileName[ 14 ];
568-
} WIN32_FIND_DATAW, *PWIN32_FIND_DATAW, *LPWIN32_FIND_DATAW;
569-
570-
#ifdef UNICODE
571-
typedef WIN32_FIND_DATAW WIN32_FIND_DATA;
572-
typedef PWIN32_FIND_DATAW PWIN32_FIND_DATA;
573-
typedef LPWIN32_FIND_DATAW LPWIN32_FIND_DATA;
574-
#else
575-
typedef WIN32_FIND_DATAA WIN32_FIND_DATA;
576-
typedef PWIN32_FIND_DATAA PWIN32_FIND_DATA;
577-
typedef LPWIN32_FIND_DATAA LPWIN32_FIND_DATA;
578-
#endif
579-
580-
PALIMPORT
581-
HANDLE
582-
PALAPI
583-
FindFirstFileW(
584-
IN LPCWSTR lpFileName,
585-
OUT LPWIN32_FIND_DATAW lpFindFileData);
586-
587-
#ifdef UNICODE
588-
#define FindFirstFile FindFirstFileW
589-
#else
590-
#define FindFirstFile FindFirstFileA
591-
#endif
592-
593-
PALIMPORT
594-
BOOL
595-
PALAPI
596-
FindNextFileW(
597-
IN HANDLE hFindFile,
598-
OUT LPWIN32_FIND_DATAW lpFindFileData);
599-
600-
#ifdef UNICODE
601-
#define FindNextFile FindNextFileW
602-
#else
603-
#define FindNextFile FindNextFileA
604-
#endif
605-
606-
PALIMPORT
607-
BOOL
608-
PALAPI
609-
FindClose(
610-
IN OUT HANDLE hFindFile);
611-
612544
PALIMPORT
613545
DWORD
614546
PALAPI

src/coreclr/pal/inc/palprivate.h

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -49,20 +49,6 @@ CreateDirectoryW(
4949
IN LPCWSTR lpPathName,
5050
IN LPSECURITY_ATTRIBUTES lpSecurityAttributes);
5151

52-
PALIMPORT
53-
HANDLE
54-
PALAPI
55-
FindFirstFileA(
56-
IN LPCSTR lpFileName,
57-
OUT LPWIN32_FIND_DATAA lpFindFileData);
58-
59-
PALIMPORT
60-
BOOL
61-
PALAPI
62-
FindNextFileA(
63-
IN HANDLE hFindFile,
64-
OUT LPWIN32_FIND_DATAA lpFindFileData);
65-
6652
PALIMPORT
6753
DWORD
6854
PALAPI

src/coreclr/pal/src/CMakeLists.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,6 @@ set(SOURCES
142142
file/directory.cpp
143143
file/file.cpp
144144
file/filetime.cpp
145-
file/find.cpp
146145
file/path.cpp
147146
handlemgr/handleapi.cpp
148147
handlemgr/handlemgr.cpp

0 commit comments

Comments
 (0)