mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-22 08:23:05 -05:00
opt/fsext: kernel mode winfsp extension
This commit is contained in:
parent
781deff06f
commit
ed31a187ac
@ -588,7 +588,7 @@ static inline FSP_FSCTL_TRANSACT_RSP *FspFsctlTransactConsumeResponse(
|
|||||||
return NextResponse <= ResponseBufEnd ? (FSP_FSCTL_TRANSACT_RSP *)NextResponse : 0;
|
return NextResponse <= ResponseBufEnd ? (FSP_FSCTL_TRANSACT_RSP *)NextResponse : 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(WINFSP_SYS_INTERNAL)
|
#if !defined(_KERNEL_MODE)
|
||||||
FSP_API NTSTATUS FspFsctlCreateVolume(PWSTR DevicePath,
|
FSP_API NTSTATUS FspFsctlCreateVolume(PWSTR DevicePath,
|
||||||
const FSP_FSCTL_VOLUME_PARAMS *VolumeParams,
|
const FSP_FSCTL_VOLUME_PARAMS *VolumeParams,
|
||||||
PWCHAR VolumeNameBuf, SIZE_T VolumeNameSize,
|
PWCHAR VolumeNameBuf, SIZE_T VolumeNameSize,
|
||||||
|
60
opt/fsext/inc/winfsp/fsext.h
Normal file
60
opt/fsext/inc/winfsp/fsext.h
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
/**
|
||||||
|
* @file winfsp/fsext.h
|
||||||
|
*
|
||||||
|
* @copyright 2015-2019 Bill Zissimopoulos
|
||||||
|
*/
|
||||||
|
/*
|
||||||
|
* This file is part of WinFsp.
|
||||||
|
*
|
||||||
|
* You can redistribute it and/or modify it under the terms of the GNU
|
||||||
|
* General Public License version 3 as published by the Free Software
|
||||||
|
* Foundation.
|
||||||
|
*
|
||||||
|
* Licensees holding a valid commercial license may use this software
|
||||||
|
* in accordance with the commercial license agreement provided in
|
||||||
|
* conjunction with the software. The terms and conditions of any such
|
||||||
|
* commercial license agreement shall govern, supersede, and render
|
||||||
|
* ineffective any application of the GPLv3 license to this software,
|
||||||
|
* notwithstanding of any reference thereto in the software or
|
||||||
|
* associated repository.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef WINFSP_FSEXT_H_INCLUDED
|
||||||
|
#define WINFSP_FSEXT_H_INCLUDED
|
||||||
|
|
||||||
|
#if !defined(_KERNEL_MODE)
|
||||||
|
#error This file can only be included when compiling for kernel mode.
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#include <winfsp/fsctl.h>
|
||||||
|
|
||||||
|
#if defined(WINFSP_SYS_INTERNAL)
|
||||||
|
#define FSP_DDI __declspec(dllexport)
|
||||||
|
#else
|
||||||
|
#define FSP_DDI __declspec(dllimport)
|
||||||
|
#endif
|
||||||
|
#if !defined(FSP_DDI_DEF)
|
||||||
|
#define FSP_DDI_DEF(RetType, Name, ...) FSP_DDI RetType NTAPI Name ( __VA_ARGS__ );
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef struct
|
||||||
|
{
|
||||||
|
UINT32 Version;
|
||||||
|
/* in */
|
||||||
|
UINT32 DeviceTransactCode;
|
||||||
|
UINT32 DeviceExtensionSize;
|
||||||
|
NTSTATUS (*DeviceInit)(PDEVICE_OBJECT DeviceObject);
|
||||||
|
VOID (*DeviceFini)(PDEVICE_OBJECT DeviceObject);
|
||||||
|
VOID (*DeviceExpirationRoutine)(PDEVICE_OBJECT DeviceObject, UINT64 ExpirationTime);
|
||||||
|
NTSTATUS (*DeviceTransact)(PIRP Irp, PDEVICE_OBJECT DeviceObject);
|
||||||
|
/* out */
|
||||||
|
UINT32 DeviceExtensionOffset;
|
||||||
|
} FSP_FSEXT_PROVIDER;
|
||||||
|
|
||||||
|
FSP_DDI_DEF(NTSTATUS, FspFsextRegisterProvider, FSP_FSEXT_PROVIDER *Provider)
|
||||||
|
|
||||||
|
FSP_DDI_DEF(NTSTATUS, FspPosixMapSidToUid, PSID Sid, PUINT32 PUid)
|
||||||
|
FSP_DDI_DEF(NTSTATUS, FspPosixMapWindowsToPosixPathEx, PWSTR WindowsPath, char **PPosixPath,
|
||||||
|
BOOLEAN Translate)
|
||||||
|
|
||||||
|
#endif
|
BIN
opt/fsext/lib/winfsp-x64.lib
Normal file
BIN
opt/fsext/lib/winfsp-x64.lib
Normal file
Binary file not shown.
BIN
opt/fsext/lib/winfsp-x86.lib
Normal file
BIN
opt/fsext/lib/winfsp-x86.lib
Normal file
Binary file not shown.
6
opt/fsext/lib/winfsp.impdef
Normal file
6
opt/fsext/lib/winfsp.impdef
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
// tools\impdef.bat lib\winfsp.impdef lib\winfsp-x64.lib
|
||||||
|
// tools\impdef.bat lib\winfsp.impdef lib\winfsp-x86.lib
|
||||||
|
|
||||||
|
#define FSP_DDI_DEF(RetType, Name, ...) __declspec(dllexport) RetType NTAPI Name ( __VA_ARGS__ ) {}
|
||||||
|
#include <ntifs.h>
|
||||||
|
#include <winfsp/fsext.h>
|
44
tools/impdef.bat
Normal file
44
tools/impdef.bat
Normal file
@ -0,0 +1,44 @@
|
|||||||
|
@echo off
|
||||||
|
|
||||||
|
setlocal
|
||||||
|
setlocal EnableDelayedExpansion
|
||||||
|
|
||||||
|
if X%1==X goto usage
|
||||||
|
if X%2==X goto usage
|
||||||
|
set infile=%1
|
||||||
|
set infile=%infile:/=\%
|
||||||
|
set outfile=%2
|
||||||
|
set outfile=%outfile:/=\%
|
||||||
|
set workdir=!infile!.work
|
||||||
|
set workbase=!workdir!\%~n1
|
||||||
|
set outarch=%~n2
|
||||||
|
set outarch=%outarch:~-3%
|
||||||
|
|
||||||
|
set arch=x64
|
||||||
|
set cdef=/D_AMD64_
|
||||||
|
if /i X%outarch%==Xx86 set arch=x86
|
||||||
|
if /i X%outarch%==Xx86 set cdef=/D_X86_
|
||||||
|
|
||||||
|
call "%VS140COMNTOOLS%\..\..\VC\vcvarsall.bat" !arch!
|
||||||
|
set INCLUDE=%~dp0..\opt\fsext\inc;%~dp0..\inc;!WindowsSdkDir!Include\!WindowsSDKVersion!km\crt;!WindowsSdkDir!Include\!WindowsSDKVersion!km;!WindowsSdkDir!Include\!WindowsSDKVersion!km\shared;!INCLUDE!
|
||||||
|
|
||||||
|
if exist !workdir! rmdir /s/q !workdir!
|
||||||
|
mkdir !workdir!
|
||||||
|
|
||||||
|
type !infile! >>!workbase!.c
|
||||||
|
cl /LD /Fe!workbase!.sys /Fo!workbase!.obj !cdef! /D_KERNEL_MODE /wd4716 !workbase!.c
|
||||||
|
if errorlevel 1 goto fail
|
||||||
|
|
||||||
|
copy !workbase!.lib !outfile!
|
||||||
|
if errorlevel 1 goto fail
|
||||||
|
|
||||||
|
rmdir /s/q !workdir!
|
||||||
|
|
||||||
|
exit /b 0
|
||||||
|
|
||||||
|
:fail
|
||||||
|
exit /b 1
|
||||||
|
|
||||||
|
:usage
|
||||||
|
echo usage: impdef.bat infile.impdef outfile.lib 1>&2
|
||||||
|
exit /b 2
|
Loading…
x
Reference in New Issue
Block a user