Module: wine Branch: master Commit: d17b29303cd9075123033f159339f9872c14b227 URL: http://source.winehq.org/git/wine.git/?a=commit;h=d17b29303cd9075123033f1593...
Author: Alexandre Julliard julliard@winehq.org Date: Fri Jan 4 14:31:55 2008 +0100
kernel32/tests: Added tests for FindFirstVolume/FindNextVolume.
---
dlls/kernel32/tests/volume.c | 33 +++++++++++++++++++++++++++++++++ 1 files changed, 33 insertions(+), 0 deletions(-)
diff --git a/dlls/kernel32/tests/volume.c b/dlls/kernel32/tests/volume.c index 0811ce5..94ace87 100644 --- a/dlls/kernel32/tests/volume.c +++ b/dlls/kernel32/tests/volume.c @@ -24,6 +24,9 @@ static HINSTANCE hdll; static BOOL (WINAPI * pGetVolumeNameForVolumeMountPointA)(LPCSTR, LPSTR, DWORD); static BOOL (WINAPI * pGetVolumeNameForVolumeMountPointW)(LPCWSTR, LPWSTR, DWORD); +static HANDLE (WINAPI *pFindFirstVolumeA)(LPSTR,DWORD); +static BOOL (WINAPI *pFindNextVolumeA)(HANDLE,LPSTR,DWORD); +static BOOL (WINAPI *pFindVolumeClose)(HANDLE);
/* ############################### */
@@ -44,6 +47,32 @@ static void test_query_dos_deviceA(void) todo_wine ok(found, "expected at least one devicename to contain HARDDISK or RAMDISK\n"); }
+static void test_FindFirstVolume(void) +{ + char volume[50]; + HANDLE handle; + + handle = pFindFirstVolumeA( volume, 0 ); + ok( handle == INVALID_HANDLE_VALUE, "succeeded with short buffer\n" ); + ok( GetLastError() == ERROR_FILENAME_EXCED_RANGE, "wrong error %u\n", GetLastError() ); + handle = pFindFirstVolumeA( volume, 49 ); + ok( handle == INVALID_HANDLE_VALUE, "succeeded with short buffer\n" ); + ok( GetLastError() == ERROR_FILENAME_EXCED_RANGE, "wrong error %u\n", GetLastError() ); + handle = pFindFirstVolumeA( volume, 50 ); + ok( handle != INVALID_HANDLE_VALUE, "failed err %u\n", GetLastError() ); + if (handle != INVALID_HANDLE_VALUE) + { + do + { + ok( strlen(volume) == 49, "bad volume name %s\n", volume ); + ok( !memcmp( volume, "\\?\Volume{", 11 ), "bad volume name %s\n", volume ); + ok( !memcmp( volume + 47, "}\", 2 ), "bad volume name %s\n", volume ); + } while (pFindNextVolumeA( handle, volume, MAX_PATH )); + ok( GetLastError() == ERROR_NO_MORE_FILES, "wrong error %u\n", GetLastError() ); + pFindVolumeClose( handle ); + } +} + static void test_GetVolumeNameForVolumeMountPointA(void) { BOOL ret; @@ -103,8 +132,12 @@ START_TEST(volume) hdll = GetModuleHandleA("kernel32.dll"); pGetVolumeNameForVolumeMountPointA = (void *) GetProcAddress(hdll, "GetVolumeNameForVolumeMountPointA"); pGetVolumeNameForVolumeMountPointW = (void *) GetProcAddress(hdll, "GetVolumeNameForVolumeMountPointW"); + pFindFirstVolumeA = (void *) GetProcAddress(hdll, "FindFirstVolumeA"); + pFindNextVolumeA = (void *) GetProcAddress(hdll, "FindNextVolumeA"); + pFindVolumeClose = (void *) GetProcAddress(hdll, "FindVolumeClose");
test_query_dos_deviceA(); + test_FindFirstVolume(); test_GetVolumeNameForVolumeMountPointA(); test_GetVolumeNameForVolumeMountPointW(); }