Commit 7ddec087 authored by Hans Leidekker's avatar Hans Leidekker Committed by Alexandre Julliard

wininet: Implement GetDiskInfoA.

parent ca1a979c
...@@ -25,6 +25,7 @@ ...@@ -25,6 +25,7 @@
#include "windef.h" #include "windef.h"
#include "winbase.h" #include "winbase.h"
#include "wininet.h" #include "wininet.h"
#include "winineti.h"
#include "wine/test.h" #include "wine/test.h"
...@@ -219,6 +220,45 @@ static void test_FindCloseUrlCache(void) ...@@ -219,6 +220,45 @@ static void test_FindCloseUrlCache(void)
ok(ERROR_INVALID_HANDLE == err, "expected %d, got %d\n", ERROR_INVALID_HANDLE, err); 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) START_TEST(urlcache)
{ {
HMODULE hdll; HMODULE hdll;
...@@ -227,4 +267,5 @@ START_TEST(urlcache) ...@@ -227,4 +267,5 @@ START_TEST(urlcache)
pUnlockUrlCacheEntryFileA = (void*)GetProcAddress(hdll, "UnlockUrlCacheEntryFileA"); pUnlockUrlCacheEntryFileA = (void*)GetProcAddress(hdll, "UnlockUrlCacheEntryFileA");
test_urlcacheA(); test_urlcacheA();
test_FindCloseUrlCache(); test_FindCloseUrlCache();
test_GetDiskInfoA();
} }
...@@ -3624,10 +3624,26 @@ BOOL WINAPI IsUrlCacheEntryExpiredW( LPCWSTR url, DWORD dwFlags, FILETIME* pftLa ...@@ -3624,10 +3624,26 @@ BOOL WINAPI IsUrlCacheEntryExpiredW( LPCWSTR url, DWORD dwFlags, FILETIME* pftLa
/*********************************************************************** /***********************************************************************
* GetDiskInfoA (WININET.@) * 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); BOOL ret;
return 0; 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;
} }
/*********************************************************************** /***********************************************************************
......
101 stub -noname DoConnectoidsExist 101 stub -noname DoConnectoidsExist
102 stdcall -noname GetDiskInfoA(ptr ptr ptr ptr) 102 stdcall -noname GetDiskInfoA(str ptr ptr ptr)
103 stub -noname PerformOperationOverUrlCacheA 103 stub -noname PerformOperationOverUrlCacheA
104 stub -noname HttpCheckDavComplianceA 104 stub -noname HttpCheckDavComplianceA
105 stub -noname HttpCheckDavComplianceW 105 stub -noname HttpCheckDavComplianceW
......
...@@ -90,6 +90,7 @@ extern "C" { ...@@ -90,6 +90,7 @@ extern "C" {
#endif #endif
DWORD WINAPI DeleteIE3Cache(HWND,HINSTANCE,LPSTR,int); 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 GetUrlCacheConfigInfoA(LPINTERNET_CACHE_CONFIG_INFOA,LPDWORD,DWORD);
BOOL WINAPI GetUrlCacheConfigInfoW(LPINTERNET_CACHE_CONFIG_INFOW,LPDWORD,DWORD); BOOL WINAPI GetUrlCacheConfigInfoW(LPINTERNET_CACHE_CONFIG_INFOW,LPDWORD,DWORD);
#define GetUrlCacheConfigInfo WINELIB_NAME_AW(GetUrlCacheConfigInfo) #define GetUrlCacheConfigInfo WINELIB_NAME_AW(GetUrlCacheConfigInfo)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment