wininet: Implement GetDiskInfoA.

This commit is contained in:
Hans Leidekker 2009-05-13 14:01:18 +02:00 committed by Alexandre Julliard
parent ca1a979c69
commit 7ddec087f0
4 changed files with 62 additions and 4 deletions

View File

@ -25,6 +25,7 @@
#include "windef.h"
#include "winbase.h"
#include "wininet.h"
#include "winineti.h"
#include "wine/test.h"
@ -219,6 +220,45 @@ static void test_FindCloseUrlCache(void)
ok(ERROR_INVALID_HANDLE == err, "expected %d, got %d\n", ERROR_INVALID_HANDLE, err);
}
static void test_GetDiskInfoA(void)
{
BOOL ret;
DWORD error, cluster_size;
DWORDLONG free, total;
char path[MAX_PATH], *p;
GetSystemDirectoryA(path, MAX_PATH);
if ((p = strchr(path, '\\'))) *++p = 0;
ret = GetDiskInfoA(path, &cluster_size, &free, &total);
ok(ret, "GetDiskInfoA failed %u\n", GetLastError());
ret = GetDiskInfoA(path, &cluster_size, &free, NULL);
ok(ret, "GetDiskInfoA failed %u\n", GetLastError());
ret = GetDiskInfoA(path, &cluster_size, NULL, NULL);
ok(ret, "GetDiskInfoA failed %u\n", GetLastError());
ret = GetDiskInfoA(path, NULL, NULL, NULL);
ok(ret, "GetDiskInfoA failed %u\n", GetLastError());
ret = GetDiskInfoA(path, NULL, NULL, NULL);
ok(ret, "GetDiskInfoA failed %u\n", GetLastError());
SetLastError(0xdeadbeef);
strcpy(p, "\\non\\existing\\path");
ret = GetDiskInfoA(path, NULL, NULL, NULL);
error = GetLastError();
ok(!ret, "GetDiskInfoA succeeded\n");
ok(error == ERROR_PATH_NOT_FOUND, "got %u expected ERROR_PATH_NOT_FOUND\n", error);
SetLastError(0xdeadbeef);
ret = GetDiskInfoA(NULL, NULL, NULL, NULL);
error = GetLastError();
ok(!ret, "GetDiskInfoA succeeded\n");
ok(error == ERROR_INVALID_PARAMETER, "got %u expected ERROR_INVALID_PARAMETER\n", error);
}
START_TEST(urlcache)
{
HMODULE hdll;
@ -227,4 +267,5 @@ START_TEST(urlcache)
pUnlockUrlCacheEntryFileA = (void*)GetProcAddress(hdll, "UnlockUrlCacheEntryFileA");
test_urlcacheA();
test_FindCloseUrlCache();
test_GetDiskInfoA();
}

View File

@ -3624,10 +3624,26 @@ BOOL WINAPI IsUrlCacheEntryExpiredW( LPCWSTR url, DWORD dwFlags, FILETIME* pftLa
/***********************************************************************
* GetDiskInfoA (WININET.@)
*/
DWORD WINAPI GetDiskInfoA(void *p0, void *p1, void *p2, void *p3)
BOOL WINAPI GetDiskInfoA(PCSTR path, PDWORD cluster_size, PDWORDLONG free, PDWORDLONG total)
{
FIXME("(%p, %p, %p, %p)\n", p0, p1, p2, p3);
return 0;
BOOL ret;
ULARGE_INTEGER bytes_free, bytes_total;
TRACE("(%s, %p, %p, %p)\n", debugstr_a(path), cluster_size, free, total);
if (!path)
{
SetLastError(ERROR_INVALID_PARAMETER);
return FALSE;
}
if ((ret = GetDiskFreeSpaceExA(path, NULL, &bytes_total, &bytes_free)))
{
if (cluster_size) *cluster_size = 1;
if (free) *free = bytes_free.QuadPart;
if (total) *total = bytes_total.QuadPart;
}
return ret;
}
/***********************************************************************

View File

@ -1,5 +1,5 @@
101 stub -noname DoConnectoidsExist
102 stdcall -noname GetDiskInfoA(ptr ptr ptr ptr)
102 stdcall -noname GetDiskInfoA(str ptr ptr ptr)
103 stub -noname PerformOperationOverUrlCacheA
104 stub -noname HttpCheckDavComplianceA
105 stub -noname HttpCheckDavComplianceW

View File

@ -90,6 +90,7 @@ extern "C" {
#endif
DWORD WINAPI DeleteIE3Cache(HWND,HINSTANCE,LPSTR,int);
BOOL WINAPI GetDiskInfoA(PCSTR,PDWORD,PDWORDLONG,PDWORDLONG);
BOOL WINAPI GetUrlCacheConfigInfoA(LPINTERNET_CACHE_CONFIG_INFOA,LPDWORD,DWORD);
BOOL WINAPI GetUrlCacheConfigInfoW(LPINTERNET_CACHE_CONFIG_INFOW,LPDWORD,DWORD);
#define GetUrlCacheConfigInfo WINELIB_NAME_AW(GetUrlCacheConfigInfo)