[MOUNTMGR_APITEST] Add a test suite for the mount manager

It only tests IOCTL_MOUNTMGR_QUERY_POINTS for now
This commit is contained in:
Pierre Schweitzer 2019-09-05 08:35:23 +02:00
parent d592e00dfa
commit 16ec2e2aa5
No known key found for this signature in database
GPG key ID: 7545556C3D585B0B
5 changed files with 90 additions and 0 deletions

View file

@ -19,6 +19,7 @@ if(NOT ARCH STREQUAL "amd64")
add_subdirectory(kernel32)
endif()
add_subdirectory(localspl)
add_subdirectory(mountmgr)
add_subdirectory(msgina)
add_subdirectory(mspatcha)
add_subdirectory(msvcrt)

View file

@ -0,0 +1,11 @@
list(APPEND SOURCE
QueryPoints.c
precomp.h)
add_executable(mountmgr_apitest ${SOURCE} testlist.c)
target_link_libraries(mountmgr_apitest wine ${PSEH_LIB})
set_module_type(mountmgr_apitest win32cui)
add_importlibs(mountmgr_apitest msvcrt kernel32 ntdll)
add_pch(mountmgr_apitest precomp.h SOURCE)
add_rostests_file(TARGET mountmgr_apitest)

View file

@ -0,0 +1,55 @@
/*
* PROJECT: ReactOS api tests
* LICENSE: GPLv2+ - See COPYING in the top level directory
* PURPOSE: Test for QueryPoints IOCTL
* PROGRAMMER: Pierre Schweitzer
*/
#include "precomp.h"
START_TEST(QueryPoints)
{
BOOL Ret;
DWORD BytesReturned;
HANDLE MountMgrHandle;
MOUNTMGR_MOUNT_POINT SinglePoint;
MOUNTMGR_MOUNT_POINTS MountPoints;
PMOUNTMGR_MOUNT_POINTS AllocatedPoints;
MountMgrHandle = CreateFileW(MOUNTMGR_DOS_DEVICE_NAME, 0,
FILE_SHARE_READ | FILE_SHARE_WRITE, NULL,
OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,
INVALID_HANDLE_VALUE);
if (MountMgrHandle == INVALID_HANDLE_VALUE)
{
win_skip("MountMgr unavailable: %lx\n", GetLastError());
return;
}
ZeroMemory(&SinglePoint, sizeof(MOUNTMGR_MOUNT_POINT));
Ret = DeviceIoControl(MountMgrHandle, IOCTL_MOUNTMGR_QUERY_POINTS,
&SinglePoint, sizeof(MOUNTMGR_MOUNT_POINT),
&MountPoints, sizeof(MOUNTMGR_MOUNT_POINTS),
&BytesReturned, NULL);
ok(Ret == FALSE, "IOCTL unexpectedly succeed\n");
ok(GetLastError() == ERROR_MORE_DATA, "Unexcepted failure: %lx\n", GetLastError());
AllocatedPoints = RtlAllocateHeap(RtlGetProcessHeap(), 0, MountPoints.Size);
if (AllocatedPoints == NULL)
{
win_skip("Insufficiant memory\n");
goto Done;
}
Ret = DeviceIoControl(MountMgrHandle, IOCTL_MOUNTMGR_QUERY_POINTS,
&SinglePoint, sizeof(MOUNTMGR_MOUNT_POINT),
AllocatedPoints, MountPoints.Size,
&BytesReturned, NULL);
ok(Ret == TRUE, "IOCTL unexpectedly failed %lx\n", GetLastError());
RtlFreeHeap(RtlGetProcessHeap(), 0, AllocatedPoints);
Done:
CloseHandle(MountMgrHandle);
}

View file

@ -0,0 +1,12 @@
#ifndef _MOUNTMGR_APITEST_PRECOMP_H_
#define _MOUNTMGR_APITEST_PRECOMP_H_
#define WIN32_NO_STATUS
#include <apitest.h>
#include <strsafe.h>
#include <ntstatus.h>
#include <mountmgr.h>
#include <ndk/rtlfuncs.h>
#endif /* _MOUNTMGR_APITEST_PRECOMP_H_ */

View file

@ -0,0 +1,11 @@
#define STANDALONE
#include <apitest.h>
extern void func_QueryPoints(void);
const struct test winetest_testlist[] =
{
{ "QueryPoints", func_QueryPoints },
{ 0, 0 }
};