mirror of
https://github.com/winfsp/winfsp.git
synced 2025-04-22 16:33:02 -05:00
dll: FspDebugLog
sys: DEBUGLOG
This commit is contained in:
parent
f149301125
commit
7f182ac04d
@ -100,7 +100,7 @@
|
|||||||
</PrecompiledHeader>
|
</PrecompiledHeader>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<PreprocessorDefinitions>WINFSP_DLL_INTERNAL;WIN32;_DEBUG;_WINDOWS;_USRDLL;WINFSPDLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;WINFSPDLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>..\..\src;..\..\inc</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\..\src;..\..\inc</AdditionalIncludeDirectories>
|
||||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||||
@ -116,7 +116,7 @@
|
|||||||
</PrecompiledHeader>
|
</PrecompiledHeader>
|
||||||
<WarningLevel>Level3</WarningLevel>
|
<WarningLevel>Level3</WarningLevel>
|
||||||
<Optimization>Disabled</Optimization>
|
<Optimization>Disabled</Optimization>
|
||||||
<PreprocessorDefinitions>WINFSP_DLL_INTERNAL;_DEBUG;_WINDOWS;_USRDLL;WINFSPDLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>_DEBUG;_WINDOWS;_USRDLL;WINFSPDLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>..\..\src;..\..\inc</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\..\src;..\..\inc</AdditionalIncludeDirectories>
|
||||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||||
@ -134,7 +134,7 @@
|
|||||||
<Optimization>MaxSpeed</Optimization>
|
<Optimization>MaxSpeed</Optimization>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<PreprocessorDefinitions>WINFSP_DLL_INTERNAL;WIN32;NDEBUG;_WINDOWS;_USRDLL;WINFSPDLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;WINFSPDLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>..\..\src;..\..\inc</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\..\src;..\..\inc</AdditionalIncludeDirectories>
|
||||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||||
@ -154,7 +154,7 @@
|
|||||||
<Optimization>MaxSpeed</Optimization>
|
<Optimization>MaxSpeed</Optimization>
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking>
|
<FunctionLevelLinking>true</FunctionLevelLinking>
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions>
|
<IntrinsicFunctions>true</IntrinsicFunctions>
|
||||||
<PreprocessorDefinitions>WINFSP_DLL_INTERNAL;NDEBUG;_WINDOWS;_USRDLL;WINFSPDLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions>NDEBUG;_WINDOWS;_USRDLL;WINFSPDLL_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
<SDLCheck>true</SDLCheck>
|
<SDLCheck>true</SDLCheck>
|
||||||
<AdditionalIncludeDirectories>..\..\src;..\..\inc</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\..\src;..\..\inc</AdditionalIncludeDirectories>
|
||||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||||
@ -167,12 +167,14 @@
|
|||||||
</Link>
|
</Link>
|
||||||
</ItemDefinitionGroup>
|
</ItemDefinitionGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
|
<ClCompile Include="..\..\src\dll\debug.c" />
|
||||||
<ClCompile Include="..\..\src\dll\fsctl.c" />
|
<ClCompile Include="..\..\src\dll\fsctl.c" />
|
||||||
<ClCompile Include="..\..\src\dll\ntstatus.c" />
|
<ClCompile Include="..\..\src\dll\ntstatus.c" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\..\inc\winfsp\fsctl.h" />
|
<ClInclude Include="..\..\inc\winfsp\fsctl.h" />
|
||||||
<ClInclude Include="..\..\inc\winfsp\winfsp.h" />
|
<ClInclude Include="..\..\inc\winfsp\winfsp.h" />
|
||||||
|
<ClInclude Include="..\..\src\dll\library.h" />
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
|
||||||
<ImportGroup Label="ExtensionTargets">
|
<ImportGroup Label="ExtensionTargets">
|
||||||
|
@ -20,6 +20,9 @@
|
|||||||
<ClCompile Include="..\..\src\dll\ntstatus.c">
|
<ClCompile Include="..\..\src\dll\ntstatus.c">
|
||||||
<Filter>Source</Filter>
|
<Filter>Source</Filter>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
|
<ClCompile Include="..\..\src\dll\debug.c">
|
||||||
|
<Filter>Source</Filter>
|
||||||
|
</ClCompile>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
<ItemGroup>
|
<ItemGroup>
|
||||||
<ClInclude Include="..\..\inc\winfsp\fsctl.h">
|
<ClInclude Include="..\..\inc\winfsp\fsctl.h">
|
||||||
@ -28,5 +31,8 @@
|
|||||||
<ClInclude Include="..\..\inc\winfsp\winfsp.h">
|
<ClInclude Include="..\..\inc\winfsp\winfsp.h">
|
||||||
<Filter>Include\winfsp</Filter>
|
<Filter>Include\winfsp</Filter>
|
||||||
</ClInclude>
|
</ClInclude>
|
||||||
|
<ClInclude Include="..\..\src\dll\library.h">
|
||||||
|
<Filter>Source</Filter>
|
||||||
|
</ClInclude>
|
||||||
</ItemGroup>
|
</ItemGroup>
|
||||||
</Project>
|
</Project>
|
@ -97,7 +97,7 @@
|
|||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<AdditionalIncludeDirectories>..\..\src;..\..\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\..\src;..\..\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>WINFSP_SYS_INTERNAL; _X86_=1;i386=1;STD_CALL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions> _X86_=1;i386=1;STD_CALL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<AdditionalDependencies>wdmsec.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>wdmsec.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
@ -106,7 +106,7 @@
|
|||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<AdditionalIncludeDirectories>..\..\src;..\..\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\..\src;..\..\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>WINFSP_SYS_INTERNAL; _X86_=1;i386=1;STD_CALL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions> _X86_=1;i386=1;STD_CALL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<AdditionalDependencies>wdmsec.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>wdmsec.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
@ -115,7 +115,7 @@
|
|||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<AdditionalIncludeDirectories>..\..\src;..\..\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\..\src;..\..\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>WINFSP_SYS_INTERNAL; _WIN64;_AMD64_;AMD64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions> _WIN64;_AMD64_;AMD64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<AdditionalDependencies>wdmsec.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>wdmsec.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
@ -124,7 +124,7 @@
|
|||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
|
||||||
<ClCompile>
|
<ClCompile>
|
||||||
<AdditionalIncludeDirectories>..\..\src;..\..\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
<AdditionalIncludeDirectories>..\..\src;..\..\inc;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||||
<PreprocessorDefinitions>WINFSP_SYS_INTERNAL; _WIN64;_AMD64_;AMD64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
<PreprocessorDefinitions> _WIN64;_AMD64_;AMD64;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||||
</ClCompile>
|
</ClCompile>
|
||||||
<Link>
|
<Link>
|
||||||
<AdditionalDependencies>wdmsec.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
<AdditionalDependencies>wdmsec.lib;%(AdditionalDependencies)</AdditionalDependencies>
|
||||||
|
20
src/dll/debug.c
Normal file
20
src/dll/debug.c
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
/**
|
||||||
|
* @file dll/debug.c
|
||||||
|
*
|
||||||
|
* @copyright 2015 Bill Zissimopoulos
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <dll/library.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
|
#if !defined(NDEBUG)
|
||||||
|
VOID FspDebugLog(const char *format, ...)
|
||||||
|
{
|
||||||
|
char buf[512];
|
||||||
|
va_list ap;
|
||||||
|
va_start(ap, format);
|
||||||
|
StringCbVPrintfA(buf, sizeof buf, format, ap);
|
||||||
|
va_end(ap);
|
||||||
|
OutputDebugStringA(buf);
|
||||||
|
}
|
||||||
|
#endif
|
@ -4,9 +4,7 @@
|
|||||||
* @copyright 2015 Bill Zissimopoulos
|
* @copyright 2015 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <winfsp/winfsp.h>
|
#include <dll/library.h>
|
||||||
#include <winfsp/fsctl.h>
|
|
||||||
#include <strsafe.h>
|
|
||||||
#if !defined(NDEBUG)
|
#if !defined(NDEBUG)
|
||||||
#include <sddl.h>
|
#include <sddl.h>
|
||||||
#endif
|
#endif
|
||||||
@ -67,18 +65,6 @@ FSP_API NTSTATUS FspFsctlCreateVolume(PWSTR DevicePath,
|
|||||||
Token = 0;
|
Token = 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if !defined(NDEBUG)
|
|
||||||
{
|
|
||||||
PWSTR Sddl;
|
|
||||||
if (ConvertSecurityDescriptorToStringSecurityDescriptorW(SecurityDescriptor,
|
|
||||||
SDDL_REVISION_1, DACL_SECURITY_INFORMATION, &Sddl, 0))
|
|
||||||
{
|
|
||||||
OutputDebugStringW(Sddl);
|
|
||||||
LocalFree(Sddl);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
|
|
||||||
SecurityDescriptorSize = 0;
|
SecurityDescriptorSize = 0;
|
||||||
if (!MakeSelfRelativeSD(SecurityDescriptor, 0, &SecurityDescriptorSize) &&
|
if (!MakeSelfRelativeSD(SecurityDescriptor, 0, &SecurityDescriptorSize) &&
|
||||||
ERROR_INSUFFICIENT_BUFFER != GetLastError())
|
ERROR_INSUFFICIENT_BUFFER != GetLastError())
|
||||||
@ -102,6 +88,20 @@ FSP_API NTSTATUS FspFsctlCreateVolume(PWSTR DevicePath,
|
|||||||
*ParamsBuf = *Params;
|
*ParamsBuf = *Params;
|
||||||
|
|
||||||
GlobalDevicePath(DevicePathBuf, sizeof DevicePathBuf, DevicePath);
|
GlobalDevicePath(DevicePathBuf, sizeof DevicePathBuf, DevicePath);
|
||||||
|
|
||||||
|
#if !defined(NDEBUG)
|
||||||
|
{
|
||||||
|
PSTR Sddl;
|
||||||
|
if (ConvertSecurityDescriptorToStringSecurityDescriptorA(SecurityDescriptorBuf,
|
||||||
|
SDDL_REVISION_1, DACL_SECURITY_INFORMATION, &Sddl, 0))
|
||||||
|
{
|
||||||
|
DEBUGLOG("Device=\"%S\", Sddl=\"%s\", SdSize=%lu",
|
||||||
|
DevicePathBuf, Sddl, SecurityDescriptorSize);
|
||||||
|
LocalFree(Sddl);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
DeviceHandle = CreateFileW(DevicePathBuf,
|
DeviceHandle = CreateFileW(DevicePathBuf,
|
||||||
0, FILE_SHARE_READ | FILE_SHARE_WRITE, 0, OPEN_EXISTING, 0, 0);
|
0, FILE_SHARE_READ | FILE_SHARE_WRITE, 0, OPEN_EXISTING, 0, 0);
|
||||||
if (INVALID_HANDLE_VALUE == DeviceHandle)
|
if (INVALID_HANDLE_VALUE == DeviceHandle)
|
||||||
|
30
src/dll/library.h
Normal file
30
src/dll/library.h
Normal file
@ -0,0 +1,30 @@
|
|||||||
|
/**
|
||||||
|
* @file dll/library.h
|
||||||
|
*
|
||||||
|
* @copyright 2015 Bill Zissimopoulos
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef WINFSP_DLL_LIBRARY_H_INCLUDED
|
||||||
|
#define WINFSP_DLL_LIBRARY_H_INCLUDED
|
||||||
|
|
||||||
|
#define WINFSP_DLL_INTERNAL
|
||||||
|
#include <winfsp/winfsp.h>
|
||||||
|
#include <winfsp/fsctl.h>
|
||||||
|
#include <strsafe.h>
|
||||||
|
|
||||||
|
#define LIBRARY_NAME "WinFsp"
|
||||||
|
|
||||||
|
/* DEBUGLOG */
|
||||||
|
#if !defined(NDEBUG)
|
||||||
|
#define DEBUGLOG(fmt, ...) \
|
||||||
|
FspDebugLog("[U] " LIBRARY_NAME "!" __FUNCTION__ ": " fmt "\n", __VA_ARGS__)
|
||||||
|
#else
|
||||||
|
#define DEBUGLOG(fmt, ...) ((void)0)
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* debug */
|
||||||
|
#if !defined(NDEBUG)
|
||||||
|
VOID FspDebugLog(const char *format, ...);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif
|
@ -4,7 +4,7 @@
|
|||||||
* @copyright 2015 Bill Zissimopoulos
|
* @copyright 2015 Bill Zissimopoulos
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <winfsp/winfsp.h>
|
#include <dll/library.h>
|
||||||
|
|
||||||
NTSTATUS FspNtStatusFromWin32(DWORD Error)
|
NTSTATUS FspNtStatusFromWin32(DWORD Error)
|
||||||
{
|
{
|
||||||
|
@ -7,6 +7,7 @@
|
|||||||
#ifndef WINFSP_SYS_DRIVER_H_INCLUDED
|
#ifndef WINFSP_SYS_DRIVER_H_INCLUDED
|
||||||
#define WINFSP_SYS_DRIVER_H_INCLUDED
|
#define WINFSP_SYS_DRIVER_H_INCLUDED
|
||||||
|
|
||||||
|
#define WINFSP_SYS_INTERNAL
|
||||||
#include <ntifs.h>
|
#include <ntifs.h>
|
||||||
#include <ntstrsafe.h>
|
#include <ntstrsafe.h>
|
||||||
#include <wdmsec.h>
|
#include <wdmsec.h>
|
||||||
@ -23,7 +24,7 @@
|
|||||||
/* DEBUGLOG */
|
/* DEBUGLOG */
|
||||||
#if DBG
|
#if DBG
|
||||||
#define DEBUGLOG(fmt, ...) \
|
#define DEBUGLOG(fmt, ...) \
|
||||||
DbgPrint(DRIVER_NAME "!" __FUNCTION__ "[%d]: " fmt "\n", KeGetCurrentIrql(), __VA_ARGS__)
|
DbgPrint("[%d] " DRIVER_NAME "!" __FUNCTION__ ": " fmt "\n", KeGetCurrentIrql(), __VA_ARGS__)
|
||||||
#else
|
#else
|
||||||
#define DEBUGLOG(fmt, ...) ((void)0)
|
#define DEBUGLOG(fmt, ...) ((void)0)
|
||||||
#endif
|
#endif
|
||||||
@ -32,12 +33,12 @@
|
|||||||
#if DBG
|
#if DBG
|
||||||
#define FSP_DEBUGLOG_(fmt, rfmt, ...) \
|
#define FSP_DEBUGLOG_(fmt, rfmt, ...) \
|
||||||
DbgPrint(AbnormalTermination() ? \
|
DbgPrint(AbnormalTermination() ? \
|
||||||
DRIVER_NAME "!" __FUNCTION__ "[%d](" fmt ") = !AbnormalTermination\n" :\
|
"[%d] " DRIVER_NAME "!" __FUNCTION__ "(" fmt ") = !AbnormalTermination\n" :\
|
||||||
DRIVER_NAME "!" __FUNCTION__ "[%d](" fmt ")" rfmt "\n",\
|
"[%d] " DRIVER_NAME "!" __FUNCTION__ "(" fmt ")" rfmt "\n",\
|
||||||
KeGetCurrentIrql(), __VA_ARGS__)
|
KeGetCurrentIrql(), __VA_ARGS__)
|
||||||
#define FSP_DEBUGLOG_NOCRIT_(fmt, rfmt, ...)\
|
#define FSP_DEBUGLOG_NOCRIT_(fmt, rfmt, ...)\
|
||||||
DbgPrint( \
|
DbgPrint( \
|
||||||
DRIVER_NAME "!" __FUNCTION__ "[%d](" fmt ")" rfmt "\n",\
|
"[%d] " DRIVER_NAME "!" __FUNCTION__ "(" fmt ")" rfmt "\n",\
|
||||||
KeGetCurrentIrql(), __VA_ARGS__)
|
KeGetCurrentIrql(), __VA_ARGS__)
|
||||||
#define FSP_DEBUGBRK_() \
|
#define FSP_DEBUGBRK_() \
|
||||||
do \
|
do \
|
||||||
|
Loading…
x
Reference in New Issue
Block a user