Wine-Bug: https://bugs.winehq.org/show_bug.cgi?id=46934 Signed-off-by: Fabian Maurer dark.shadow4@web.de --- v2: Fix crash on xp, remove useless comments --- dlls/kernel32/file.c | 16 ++++++++++++++++ dlls/kernel32/kernel32.spec | 4 ++-- dlls/kernel32/tests/file.c | 23 +++++++++++++++++++++++ include/winbase.h | 13 +++++++++++++ 4 files changed, 54 insertions(+), 2 deletions(-)
diff --git a/dlls/kernel32/file.c b/dlls/kernel32/file.c index 64c3e3e826..85cafac41f 100644 --- a/dlls/kernel32/file.c +++ b/dlls/kernel32/file.c @@ -2363,6 +2363,22 @@ BOOL WINAPI FindNextFileA( HANDLE handle, WIN32_FIND_DATAA *data ) return TRUE; }
+HANDLE WINAPI FindFirstStreamW(LPCWSTR filename, STREAM_INFO_LEVELS infolevel, void *data, DWORD flags) +{ + FIXME("(%s, %d, %p, %x): stub!\n", debugstr_w(filename), infolevel, data, flags); + + SetLastError(ERROR_HANDLE_EOF); + return INVALID_HANDLE_VALUE; +} + +BOOL WINAPI FindNextStreamW(HANDLE handle, void *data) +{ + FIXME("(%p, %p): stub!\n", handle, data); + + SetLastError(ERROR_HANDLE_EOF); + return FALSE; +} +
/************************************************************************** * GetFileAttributesW (KERNEL32.@) diff --git a/dlls/kernel32/kernel32.spec b/dlls/kernel32/kernel32.spec index 3edfe2194c..75e7cc57e7 100644 --- a/dlls/kernel32/kernel32.spec +++ b/dlls/kernel32/kernel32.spec @@ -488,7 +488,7 @@ # @ stub FindFirstFileTransactedW @ stdcall FindFirstFileW(wstr ptr) # @ stub FindFirstStreamTransactedW -# @ stub FindFirstStreamW +@ stdcall FindFirstStreamW(wstr long ptr long) @ stdcall FindFirstVolumeA(ptr long) @ stdcall FindFirstVolumeMountPointA(str ptr long) @ stdcall FindFirstVolumeMountPointW(wstr ptr long) @@ -497,7 +497,7 @@ @ stdcall FindNextFileA(long ptr) # @ stub FindNextFileNameW @ stdcall FindNextFileW(long ptr) -# @ stub FindNextStreamW +@ stdcall FindNextStreamW(long ptr) @ stdcall FindNextVolumeA(long ptr long) @ stub FindNextVolumeMountPointA @ stub FindNextVolumeMountPointW diff --git a/dlls/kernel32/tests/file.c b/dlls/kernel32/tests/file.c index 4df31c15c7..9bf80f6388 100644 --- a/dlls/kernel32/tests/file.c +++ b/dlls/kernel32/tests/file.c @@ -62,6 +62,7 @@ static BOOL (WINAPI *pGetQueuedCompletionStatusEx)(HANDLE, OVERLAPPED_ENTRY*, UL static void (WINAPI *pRtlInitAnsiString)(PANSI_STRING,PCSZ); static void (WINAPI *pRtlFreeUnicodeString)(PUNICODE_STRING); static BOOL (WINAPI *pSetFileCompletionNotificationModes)(HANDLE, UCHAR); +static HANDLE (WINAPI *pFindFirstStreamW)(LPCWSTR filename, STREAM_INFO_LEVELS infolevel, void *data, DWORD flags);
static char filename[MAX_PATH]; static const char sillytext[] = @@ -111,6 +112,7 @@ static void InitFunctionPointers(void) pSetFileInformationByHandle = (void *) GetProcAddress(hkernel32, "SetFileInformationByHandle"); pGetQueuedCompletionStatusEx = (void *) GetProcAddress(hkernel32, "GetQueuedCompletionStatusEx"); pSetFileCompletionNotificationModes = (void *)GetProcAddress(hkernel32, "SetFileCompletionNotificationModes"); + pFindFirstStreamW = (void *)GetProcAddress(hkernel32, "FindFirstStreamW"); }
static void test__hread( void ) @@ -5314,6 +5316,26 @@ static void test_file_readonly_access(void) ok(ret, "DeleteFileA: error %d\n", GetLastError()); }
+static void test_find_file_stream(void) +{ + WCHAR path[] = {'C',':','\','w','i','n','d','o','w','s',0}; + HANDLE handle; + int error; + WIN32_FIND_STREAM_DATA data; + + if (!pFindFirstStreamW) + { + win_skip("FindFirstStreamW is missing\n"); + return; + } + + SetLastError(0xdeadbeef); + handle = pFindFirstStreamW(path, FindStreamInfoStandard, &data, 0); + error = GetLastError(); + ok(handle == INVALID_HANDLE_VALUE, "Expected INVALID_HANDLE_VALUE, got %p\n", handle); + ok(error == ERROR_HANDLE_EOF, "Expected ERROR_HANDLE_EOF, got %d\n", error); +} + START_TEST(file) { char temp_path[MAX_PATH]; @@ -5385,4 +5407,5 @@ START_TEST(file) test_post_completion(); test_overlapped_read(); test_file_readonly_access(); + test_find_file_stream(); } diff --git a/include/winbase.h b/include/winbase.h index 49d0e7ed08..c2e216cb91 100644 --- a/include/winbase.h +++ b/include/winbase.h @@ -1717,6 +1717,17 @@ typedef struct _UMS_SCHEDULER_STARTUP_INFO typedef enum _RTL_UMS_SCHEDULER_REASON UMS_SCHEDULER_REASON; typedef enum _RTL_UMS_THREAD_INFO_CLASS UMS_THREAD_INFO_CLASS, *PUMS_THREAD_INFO_CLASS;
+typedef enum _STREAM_INFO_LEVELS +{ + FindStreamInfoStandard, + FindStreamInfoMaxInfoLevel +} STREAM_INFO_LEVELS; + +typedef struct _WIN32_FIND_STREAM_DATA { + LARGE_INTEGER StreamSize; + WCHAR cStreamName[MAX_PATH + 36]; +} WIN32_FIND_STREAM_DATA,*PWIN32_FIND_STREAM_DATA; + WINBASEAPI BOOL WINAPI ActivateActCtx(HANDLE,ULONG_PTR *); WINADVAPI BOOL WINAPI AddAccessAllowedAce(PACL,DWORD,DWORD,PSID); WINADVAPI BOOL WINAPI AddAccessAllowedAceEx(PACL,DWORD,DWORD,DWORD,PSID); @@ -2002,10 +2013,12 @@ WINBASEAPI HANDLE WINAPI FindFirstFileExA(LPCSTR,FINDEX_INFO_LEVELS,LPVOID, WINBASEAPI HANDLE WINAPI FindFirstFileExW(LPCWSTR,FINDEX_INFO_LEVELS,LPVOID,FINDEX_SEARCH_OPS,LPVOID,DWORD); #define FindFirstFileEx WINELIB_NAME_AW(FindFirstFileEx) WINADVAPI BOOL WINAPI FindFirstFreeAce(PACL,LPVOID*); +WINBASEAPI HANDLE WINAPI FindFirstStreamW(LPCWSTR,STREAM_INFO_LEVELS,void*,DWORD); WINBASEAPI BOOL WINAPI FindNextChangeNotification(HANDLE); WINBASEAPI BOOL WINAPI FindNextFileA(HANDLE,LPWIN32_FIND_DATAA); WINBASEAPI BOOL WINAPI FindNextFileW(HANDLE,LPWIN32_FIND_DATAW); #define FindNextFile WINELIB_NAME_AW(FindNextFile) +WINBASEAPI BOOL WINAPI FindNextStreamW(HANDLE,void*); WINBASEAPI BOOL WINAPI FindCloseChangeNotification(HANDLE); WINBASEAPI HRSRC WINAPI FindResourceA(HMODULE,LPCSTR,LPCSTR); WINBASEAPI HRSRC WINAPI FindResourceW(HMODULE,LPCWSTR,LPCWSTR); -- 2.21.0