mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-22 16:33:02 -05:00
tst: winfsp-tests: HookCreateFileW
This commit is contained in:
parent
4b48502232
commit
91e8bb1229
@ -186,6 +186,7 @@
|
||||
<ClCompile Include="..\..\..\tst\winfsp-tests\eventlog-test.c" />
|
||||
<ClCompile Include="..\..\..\tst\winfsp-tests\flush-test.c" />
|
||||
<ClCompile Include="..\..\..\tst\winfsp-tests\fuse-opt-test.c" />
|
||||
<ClCompile Include="..\..\..\tst\winfsp-tests\hook.c" />
|
||||
<ClCompile Include="..\..\..\tst\winfsp-tests\info-test.c" />
|
||||
<ClCompile Include="..\..\..\tst\winfsp-tests\lock-test.c" />
|
||||
<ClCompile Include="..\..\..\tst\winfsp-tests\memfs-test.c" />
|
||||
@ -201,6 +202,7 @@
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\..\ext\tlib\testsuite.h" />
|
||||
<ClInclude Include="..\..\..\tst\memfs\memfs.h" />
|
||||
<ClInclude Include="..\..\..\tst\winfsp-tests\winfsp-tests.h" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ProjectReference Include="..\winfsp_dll.vcxproj">
|
||||
|
@ -64,6 +64,9 @@
|
||||
<ClCompile Include="..\..\..\tst\winfsp-tests\reparse-test.c">
|
||||
<Filter>Source</Filter>
|
||||
</ClCompile>
|
||||
<ClCompile Include="..\..\..\tst\winfsp-tests\hook.c">
|
||||
<Filter>Source</Filter>
|
||||
</ClCompile>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<ClInclude Include="..\..\..\ext\tlib\testsuite.h">
|
||||
@ -72,5 +75,8 @@
|
||||
<ClInclude Include="..\..\..\tst\memfs\memfs.h">
|
||||
<Filter>Source</Filter>
|
||||
</ClInclude>
|
||||
<ClInclude Include="..\..\..\tst\winfsp-tests\winfsp-tests.h">
|
||||
<Filter>Source</Filter>
|
||||
</ClInclude>
|
||||
</ItemGroup>
|
||||
</Project>
|
@ -4,13 +4,7 @@
|
||||
#include <strsafe.h>
|
||||
#include "memfs.h"
|
||||
|
||||
void *memfs_start(ULONG Flags);
|
||||
void memfs_stop(void *data);
|
||||
PWSTR memfs_volumename(void *data);
|
||||
|
||||
extern int NtfsTests;
|
||||
extern int WinFspDiskTests;
|
||||
extern int WinFspNetTests;
|
||||
#include "winfsp-tests.h"
|
||||
|
||||
void create_dotest(ULONG Flags, PWSTR Prefix)
|
||||
{
|
||||
|
@ -5,14 +5,7 @@
|
||||
#include <strsafe.h>
|
||||
#include "memfs.h"
|
||||
|
||||
void *memfs_start_ex(ULONG Flags, ULONG FileInfoTimeout);
|
||||
void *memfs_start(ULONG Flags);
|
||||
void memfs_stop(void *data);
|
||||
PWSTR memfs_volumename(void *data);
|
||||
|
||||
extern int NtfsTests;
|
||||
extern int WinFspDiskTests;
|
||||
extern int WinFspNetTests;
|
||||
#include "winfsp-tests.h"
|
||||
|
||||
static void querydir_dotest(ULONG Flags, PWSTR Prefix, ULONG FileInfoTimeout, ULONG SleepTimeout)
|
||||
{
|
||||
|
@ -1,6 +1,8 @@
|
||||
#include <winfsp/winfsp.h>
|
||||
#include <tlib/testsuite.h>
|
||||
|
||||
#include "winfsp-tests.h"
|
||||
|
||||
void eventlog_test(void)
|
||||
{
|
||||
/* this is not a real test! */
|
||||
|
@ -5,14 +5,7 @@
|
||||
#include <VersionHelpers.h>
|
||||
#include "memfs.h"
|
||||
|
||||
void *memfs_start_ex(ULONG Flags, ULONG FileInfoTimeout);
|
||||
void *memfs_start(ULONG Flags);
|
||||
void memfs_stop(void *data);
|
||||
PWSTR memfs_volumename(void *data);
|
||||
|
||||
extern int NtfsTests;
|
||||
extern int WinFspDiskTests;
|
||||
extern int WinFspNetTests;
|
||||
#include "winfsp-tests.h"
|
||||
|
||||
static void flush_dotest(ULONG Flags, PWSTR VolPrefix, PWSTR Prefix, ULONG FileInfoTimeout, DWORD CreateFlags,
|
||||
BOOLEAN FlushVolume)
|
||||
|
@ -3,6 +3,8 @@
|
||||
#include <stddef.h>
|
||||
#include <string.h>
|
||||
|
||||
#include "winfsp-tests.h"
|
||||
|
||||
struct data
|
||||
{
|
||||
int fortytwo;
|
||||
|
34
tst/winfsp-tests/hook.c
Normal file
34
tst/winfsp-tests/hook.c
Normal file
@ -0,0 +1,34 @@
|
||||
#include <winfsp/winfsp.h>
|
||||
|
||||
HANDLE HookCreateFileW(
|
||||
LPCWSTR lpFileName,
|
||||
DWORD dwDesiredAccess,
|
||||
DWORD dwShareMode,
|
||||
LPSECURITY_ATTRIBUTES lpSecurityAttributes,
|
||||
DWORD dwCreationDisposition,
|
||||
DWORD dwFlagsAndAttributes,
|
||||
HANDLE hTemplateFile)
|
||||
{
|
||||
HANDLE h = CreateFileW(
|
||||
lpFileName,
|
||||
dwDesiredAccess,
|
||||
dwShareMode,
|
||||
lpSecurityAttributes,
|
||||
dwCreationDisposition,
|
||||
dwFlagsAndAttributes,
|
||||
hTemplateFile);
|
||||
|
||||
DWORD LastError = GetLastError();
|
||||
FspDebugLog("CreateFileW(\"%S\", %#lx, %#lx, %p, %#lx, %#lx, %p) = %p[%#lx]\n",
|
||||
lpFileName,
|
||||
dwDesiredAccess,
|
||||
dwShareMode,
|
||||
lpSecurityAttributes,
|
||||
dwCreationDisposition,
|
||||
dwFlagsAndAttributes,
|
||||
hTemplateFile,
|
||||
h, INVALID_HANDLE_VALUE != h ? 0 : LastError);
|
||||
SetLastError(LastError);
|
||||
|
||||
return h;
|
||||
}
|
@ -4,14 +4,7 @@
|
||||
#include <strsafe.h>
|
||||
#include "memfs.h"
|
||||
|
||||
void *memfs_start_ex(ULONG Flags, ULONG FileInfoTimeout);
|
||||
void *memfs_start(ULONG Flags);
|
||||
void memfs_stop(void *data);
|
||||
PWSTR memfs_volumename(void *data);
|
||||
|
||||
extern int NtfsTests;
|
||||
extern int WinFspDiskTests;
|
||||
extern int WinFspNetTests;
|
||||
#include "winfsp-tests.h"
|
||||
|
||||
void getfileinfo_dotest(ULONG Flags, PWSTR Prefix, ULONG FileInfoTimeout)
|
||||
{
|
||||
|
@ -5,14 +5,7 @@
|
||||
#include <VersionHelpers.h>
|
||||
#include "memfs.h"
|
||||
|
||||
void *memfs_start_ex(ULONG Flags, ULONG FileInfoTimeout);
|
||||
void *memfs_start(ULONG Flags);
|
||||
void memfs_stop(void *data);
|
||||
PWSTR memfs_volumename(void *data);
|
||||
|
||||
extern int NtfsTests;
|
||||
extern int WinFspDiskTests;
|
||||
extern int WinFspNetTests;
|
||||
#include "winfsp-tests.h"
|
||||
|
||||
static void lock_dotest(ULONG Flags, PWSTR VolPrefix, PWSTR Prefix, ULONG FileInfoTimeout, DWORD CreateFlags)
|
||||
{
|
||||
|
@ -3,8 +3,7 @@
|
||||
#include <process.h>
|
||||
#include "memfs.h"
|
||||
|
||||
extern int WinFspDiskTests;
|
||||
extern int WinFspNetTests;
|
||||
#include "winfsp-tests.h"
|
||||
|
||||
void *memfs_start_ex(ULONG Flags, ULONG FileInfoTimeout)
|
||||
{
|
||||
|
@ -3,8 +3,7 @@
|
||||
#include <process.h>
|
||||
#include <strsafe.h>
|
||||
|
||||
extern int WinFspDiskTests;
|
||||
extern int WinFspNetTests;
|
||||
#include "winfsp-tests.h"
|
||||
|
||||
void mount_invalid_test(void)
|
||||
{
|
||||
|
@ -1,6 +1,8 @@
|
||||
#include <winfsp/winfsp.h>
|
||||
#include <tlib/testsuite.h>
|
||||
|
||||
#include "winfsp-tests.h"
|
||||
|
||||
void path_prefix_test(void)
|
||||
{
|
||||
PWSTR ipaths[] =
|
||||
|
@ -2,6 +2,8 @@
|
||||
#include <tlib/testsuite.h>
|
||||
#include <sddl.h>
|
||||
|
||||
#include "winfsp-tests.h"
|
||||
|
||||
void posix_map_sid_test(void)
|
||||
{
|
||||
struct
|
||||
|
@ -5,14 +5,7 @@
|
||||
#include <VersionHelpers.h>
|
||||
#include "memfs.h"
|
||||
|
||||
void *memfs_start_ex(ULONG Flags, ULONG FileInfoTimeout);
|
||||
void *memfs_start(ULONG Flags);
|
||||
void memfs_stop(void *data);
|
||||
PWSTR memfs_volumename(void *data);
|
||||
|
||||
extern int NtfsTests;
|
||||
extern int WinFspDiskTests;
|
||||
extern int WinFspNetTests;
|
||||
#include "winfsp-tests.h"
|
||||
|
||||
static void rdwr_dotest(ULONG Flags, PWSTR VolPrefix, PWSTR Prefix, ULONG FileInfoTimeout, DWORD CreateFlags)
|
||||
{
|
||||
|
@ -3,14 +3,7 @@
|
||||
#include <strsafe.h>
|
||||
#include "memfs.h"
|
||||
|
||||
void *memfs_start_ex(ULONG Flags, ULONG FileInfoTimeout);
|
||||
void *memfs_start(ULONG Flags);
|
||||
void memfs_stop(void *data);
|
||||
PWSTR memfs_volumename(void *data);
|
||||
|
||||
extern int NtfsTests;
|
||||
extern int WinFspDiskTests;
|
||||
extern int WinFspNetTests;
|
||||
#include "winfsp-tests.h"
|
||||
|
||||
static void reparse_guid_dotest(ULONG Flags, PWSTR Prefix, ULONG FileInfoTimeout)
|
||||
{
|
||||
|
@ -4,14 +4,7 @@
|
||||
#include <strsafe.h>
|
||||
#include "memfs.h"
|
||||
|
||||
void *memfs_start_ex(ULONG Flags, ULONG FileInfoTimeout);
|
||||
void *memfs_start(ULONG Flags);
|
||||
void memfs_stop(void *data);
|
||||
PWSTR memfs_volumename(void *data);
|
||||
|
||||
extern int NtfsTests;
|
||||
extern int WinFspDiskTests;
|
||||
extern int WinFspNetTests;
|
||||
#include "winfsp-tests.h"
|
||||
|
||||
void getsecurity_dotest(ULONG Flags, PWSTR Prefix, ULONG FileInfoTimeout)
|
||||
{
|
||||
|
@ -3,8 +3,7 @@
|
||||
#include <process.h>
|
||||
#include <strsafe.h>
|
||||
|
||||
extern int WinFspDiskTests;
|
||||
extern int WinFspNetTests;
|
||||
#include "winfsp-tests.h"
|
||||
|
||||
static unsigned __stdcall timeout_pending_dotest_thread(void *FilePath)
|
||||
{
|
||||
|
@ -1,5 +1,7 @@
|
||||
#include <tlib/testsuite.h>
|
||||
|
||||
#include "winfsp-tests.h"
|
||||
|
||||
int NtfsTests = 0;
|
||||
int WinFspDiskTests = 1;
|
||||
int WinFspNetTests = 1;
|
||||
|
20
tst/winfsp-tests/winfsp-tests.h
Normal file
20
tst/winfsp-tests/winfsp-tests.h
Normal file
@ -0,0 +1,20 @@
|
||||
#include <windows.h>
|
||||
|
||||
void *memfs_start_ex(ULONG Flags, ULONG FileInfoTimeout);
|
||||
void *memfs_start(ULONG Flags);
|
||||
void memfs_stop(void *data);
|
||||
PWSTR memfs_volumename(void *data);
|
||||
|
||||
extern int NtfsTests;
|
||||
extern int WinFspDiskTests;
|
||||
extern int WinFspNetTests;
|
||||
|
||||
#define CreateFileW HookCreateFileW
|
||||
HANDLE HookCreateFileW(
|
||||
LPCWSTR lpFileName,
|
||||
DWORD dwDesiredAccess,
|
||||
DWORD dwShareMode,
|
||||
LPSECURITY_ATTRIBUTES lpSecurityAttributes,
|
||||
DWORD dwCreationDisposition,
|
||||
DWORD dwFlagsAndAttributes,
|
||||
HANDLE hTemplateFile);
|
Loading…
x
Reference in New Issue
Block a user