mirror of
https://github.com/reactos/reactos.git
synced 2024-09-28 21:44:31 +00:00
[MOUNTMGR_APITEST] Add a test suite for the mount manager
It only tests IOCTL_MOUNTMGR_QUERY_POINTS for now
This commit is contained in:
parent
d592e00dfa
commit
16ec2e2aa5
|
@ -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)
|
||||
|
|
11
modules/rostests/apitests/mountmgr/CMakeLists.txt
Normal file
11
modules/rostests/apitests/mountmgr/CMakeLists.txt
Normal 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)
|
55
modules/rostests/apitests/mountmgr/QueryPoints.c
Normal file
55
modules/rostests/apitests/mountmgr/QueryPoints.c
Normal 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);
|
||||
}
|
12
modules/rostests/apitests/mountmgr/precomp.h
Normal file
12
modules/rostests/apitests/mountmgr/precomp.h
Normal 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_ */
|
11
modules/rostests/apitests/mountmgr/testlist.c
Normal file
11
modules/rostests/apitests/mountmgr/testlist.c
Normal 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 }
|
||||
};
|
||||
|
Loading…
Reference in a new issue