From: Michael Müller michael@fds-team.de
Signed-off-by: Gijs Vermeulen gijsvrm@gmail.com --- dlls/virtdisk/virtdisk.spec | 2 +- dlls/virtdisk/virtdisk_main.c | 21 +++++++++++++++++++++ 2 files changed, 22 insertions(+), 1 deletion(-)
diff --git a/dlls/virtdisk/virtdisk.spec b/dlls/virtdisk/virtdisk.spec index 2946b66d50..6bd5f146db 100644 --- a/dlls/virtdisk/virtdisk.spec +++ b/dlls/virtdisk/virtdisk.spec @@ -8,7 +8,7 @@ @ stub EnumerateVirtualDiskMetadata @ stub ExpandVirtualDisk @ stub GetAllAttachedVirtualDiskPhysicalPaths -@ stub GetStorageDependencyInformation +@ stdcall GetStorageDependencyInformation(long long long ptr ptr) @ stub GetVirtualDiskInformation @ stub GetVirtualDiskMetadata @ stub GetVirtualDiskOperationProgress diff --git a/dlls/virtdisk/virtdisk_main.c b/dlls/virtdisk/virtdisk_main.c index 0da0dca461..3e6c5c14dc 100644 --- a/dlls/virtdisk/virtdisk_main.c +++ b/dlls/virtdisk/virtdisk_main.c @@ -22,6 +22,8 @@
#include "windef.h" #include "winbase.h" +#include "virtdisk.h" + #include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(virtdisk); @@ -44,3 +46,22 @@ BOOL WINAPI DllMain(HINSTANCE hinst, DWORD reason, void *reserved)
return TRUE; } + +DWORD WINAPI GetStorageDependencyInformation(HANDLE obj, GET_STORAGE_DEPENDENCY_FLAG flags, ULONG size, STORAGE_DEPENDENCY_INFO *info, ULONG *used) +{ + ULONG temp_size = sizeof(STORAGE_DEPENDENCY_INFO); + + FIXME("(%p, 0x%x, %u, %p, %p): stub\n", obj, flags, size, info, used); + + if (used) *used = temp_size; + + if (!info || !size) + return ERROR_INVALID_PARAMETER; + + if (size < temp_size) + return ERROR_INSUFFICIENT_BUFFER; + + info->NumberEntries = 0; + + return ERROR_SUCCESS; +}
Signed-off-by: Gijs Vermeulen gijsvrm@gmail.com --- configure | 1 + configure.ac | 1 + dlls/virtdisk/tests/Makefile.in | 4 +++ dlls/virtdisk/tests/virtdisk.c | 62 +++++++++++++++++++++++++++++++++ 4 files changed, 68 insertions(+) create mode 100644 dlls/virtdisk/tests/Makefile.in create mode 100644 dlls/virtdisk/tests/virtdisk.c
diff --git a/configure b/configure index a3916ee233..3a607280e2 100755 --- a/configure +++ b/configure @@ -19877,6 +19877,7 @@ wine_fn_config_makefile dlls/ver.dll16 enable_win16 wine_fn_config_makefile dlls/version enable_version wine_fn_config_makefile dlls/version/tests enable_tests wine_fn_config_makefile dlls/virtdisk enable_virtdisk +wine_fn_config_makefile dlls/virtdisk/tests enable_tests wine_fn_config_makefile dlls/vmm.vxd enable_win16 wine_fn_config_makefile dlls/vnbt.vxd enable_win16 wine_fn_config_makefile dlls/vnetbios.vxd enable_win16 diff --git a/configure.ac b/configure.ac index 006f7d9fc2..6936a71b6f 100644 --- a/configure.ac +++ b/configure.ac @@ -3733,6 +3733,7 @@ WINE_CONFIG_MAKEFILE(dlls/ver.dll16,enable_win16) WINE_CONFIG_MAKEFILE(dlls/version) WINE_CONFIG_MAKEFILE(dlls/version/tests) WINE_CONFIG_MAKEFILE(dlls/virtdisk) +WINE_CONFIG_MAKEFILE(dlls/virtdisk/tests) WINE_CONFIG_MAKEFILE(dlls/vmm.vxd,enable_win16) WINE_CONFIG_MAKEFILE(dlls/vnbt.vxd,enable_win16) WINE_CONFIG_MAKEFILE(dlls/vnetbios.vxd,enable_win16) diff --git a/dlls/virtdisk/tests/Makefile.in b/dlls/virtdisk/tests/Makefile.in new file mode 100644 index 0000000000..d0557cb08d --- /dev/null +++ b/dlls/virtdisk/tests/Makefile.in @@ -0,0 +1,4 @@ +TESTDLL = virtdisk.dll + +C_SRCS = \ + virtdisk.c diff --git a/dlls/virtdisk/tests/virtdisk.c b/dlls/virtdisk/tests/virtdisk.c new file mode 100644 index 0000000000..2719d513fe --- /dev/null +++ b/dlls/virtdisk/tests/virtdisk.c @@ -0,0 +1,62 @@ +/* + * Copyright 2018 Gijs Vermeulen + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +#include "virtdisk.h" +#include "wine/heap.h" +#include "wine/test.h" + +static DWORD (WINAPI *pGetStorageDependencyInformation)(HANDLE,GET_STORAGE_DEPENDENCY_FLAG,ULONG,STORAGE_DEPENDENCY_INFO*,ULONG*); + +static void test_GetStorageDependencyInformation(void) +{ + DWORD ret; + HANDLE handle; + STORAGE_DEPENDENCY_INFO *info; + ULONG size; + + handle = CreateFileA("C:", 0, 0, NULL, OPEN_EXISTING, FILE_FLAG_BACKUP_SEMANTICS, 0); + ok(handle != INVALID_HANDLE_VALUE, "Expected a handle\n"); + + size = sizeof(STORAGE_DEPENDENCY_INFO); + info = heap_alloc(size); + + ret = pGetStorageDependencyInformation(handle, GET_STORAGE_DEPENDENCY_FLAG_DISK_HANDLE, 0, info, 0); + ok(ret == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", ret); + + ret = pGetStorageDependencyInformation(handle, GET_STORAGE_DEPENDENCY_FLAG_DISK_HANDLE, size, NULL, 0); + ok(ret == ERROR_INVALID_PARAMETER, "Expected ERROR_INVALID_PARAMETER, got %d\n", ret); + + heap_free(info); + CloseHandle(handle); +} + +START_TEST(virtdisk) +{ + HMODULE module = LoadLibraryA("virtdisk.dll"); + if(!module) + { + win_skip("virtdisk.dll not installed\n"); + return; + } + + pGetStorageDependencyInformation = (void *)GetProcAddress( module, "GetStorageDependencyInformation" ); + if (pGetStorageDependencyInformation) + test_GetStorageDependencyInformation(); + else + win_skip("GetStorageDependencyInformation is not available\n"); +}