From f81694cc0c495ae05dd5c141c00a87ecc9841d81 Mon Sep 17 00:00:00 2001 From: Detlef Riekenberg Date: Tue, 15 Nov 2005 16:53:09 +0000 Subject: [PATCH] Made test loadable on NT 3.51 again (GetDiskFreeSpaceExA not present). --- dlls/kernel/tests/drive.c | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/dlls/kernel/tests/drive.c b/dlls/kernel/tests/drive.c index c0f9d22a7e4..7feb1719c59 100644 --- a/dlls/kernel/tests/drive.c +++ b/dlls/kernel/tests/drive.c @@ -25,6 +25,8 @@ #include "winbase.h" #include "winerror.h" +static DWORD (WINAPI *pGetDiskFreeSpaceExA)(LPCSTR, PULARGE_INTEGER, PULARGE_INTEGER, PULARGE_INTEGER); + static void test_GetDriveTypeA(void) { char drive[] = "?:\\"; @@ -123,12 +125,13 @@ static void test_GetDiskFreeSpaceA(void) /* win3.0 thru winME */ ok( total_clusters <= 65535, "total clusters is %ld > 65535\n", total_clusters); - else { + else if (pGetDiskFreeSpaceExA) { /* NT, 2k, XP : GetDiskFreeSpace shoud be accurate */ ULARGE_INTEGER totEx, tot, d; + tot.QuadPart = sectors_per_cluster; tot.QuadPart = (tot.QuadPart * bytes_per_sector) * total_clusters; - ret = GetDiskFreeSpaceExA( drive, &d, &totEx, NULL); + ret = pGetDiskFreeSpaceExA( drive, &d, &totEx, NULL); ok( ret, "GetDiskFreeSpaceExA( %s ) failed. GetLastError=%ld\n", drive, GetLastError()); ok( bytes_per_sector == 0 || /* empty cd rom drive */ totEx.QuadPart <= tot.QuadPart, @@ -194,6 +197,9 @@ static void test_GetDiskFreeSpaceW(void) START_TEST(drive) { + HANDLE hkernel32 = GetModuleHandleA("kernel32"); + pGetDiskFreeSpaceExA = (void *) GetProcAddress(hkernel32, "GetDiskFreeSpaceExA"); + test_GetDriveTypeA(); test_GetDriveTypeW();