diff --git a/build/VStudio/winfsp_dll.vcxproj b/build/VStudio/winfsp_dll.vcxproj
index 63313dbc..23edb78b 100644
--- a/build/VStudio/winfsp_dll.vcxproj
+++ b/build/VStudio/winfsp_dll.vcxproj
@@ -100,7 +100,7 @@
Level3
Disabled
- WINFSP_DLL_INTERNAL;WIN32;_DEBUG;_WINDOWS;_USRDLL;WINFSPDLL_EXPORTS;%(PreprocessorDefinitions)
+ WIN32;_DEBUG;_WINDOWS;_USRDLL;WINFSPDLL_EXPORTS;%(PreprocessorDefinitions)
true
..\..\src;..\..\inc
MultiThreadedDLL
@@ -116,7 +116,7 @@
Level3
Disabled
- WINFSP_DLL_INTERNAL;_DEBUG;_WINDOWS;_USRDLL;WINFSPDLL_EXPORTS;%(PreprocessorDefinitions)
+ _DEBUG;_WINDOWS;_USRDLL;WINFSPDLL_EXPORTS;%(PreprocessorDefinitions)
true
..\..\src;..\..\inc
MultiThreadedDLL
@@ -134,7 +134,7 @@
MaxSpeed
true
true
- WINFSP_DLL_INTERNAL;WIN32;NDEBUG;_WINDOWS;_USRDLL;WINFSPDLL_EXPORTS;%(PreprocessorDefinitions)
+ WIN32;NDEBUG;_WINDOWS;_USRDLL;WINFSPDLL_EXPORTS;%(PreprocessorDefinitions)
true
..\..\src;..\..\inc
MultiThreadedDLL
@@ -154,7 +154,7 @@
MaxSpeed
true
true
- WINFSP_DLL_INTERNAL;NDEBUG;_WINDOWS;_USRDLL;WINFSPDLL_EXPORTS;%(PreprocessorDefinitions)
+ NDEBUG;_WINDOWS;_USRDLL;WINFSPDLL_EXPORTS;%(PreprocessorDefinitions)
true
..\..\src;..\..\inc
MultiThreadedDLL
@@ -167,12 +167,14 @@
+
+
diff --git a/build/VStudio/winfsp_dll.vcxproj.filters b/build/VStudio/winfsp_dll.vcxproj.filters
index 85aaea75..07ee53e1 100644
--- a/build/VStudio/winfsp_dll.vcxproj.filters
+++ b/build/VStudio/winfsp_dll.vcxproj.filters
@@ -20,6 +20,9 @@
Source
+
+ Source
+
@@ -28,5 +31,8 @@
Include\winfsp
+
+ Source
+
\ No newline at end of file
diff --git a/build/VStudio/winfsp_sys.vcxproj b/build/VStudio/winfsp_sys.vcxproj
index 3c3e7ac6..58d10448 100644
--- a/build/VStudio/winfsp_sys.vcxproj
+++ b/build/VStudio/winfsp_sys.vcxproj
@@ -97,7 +97,7 @@
..\..\src;..\..\inc;%(AdditionalIncludeDirectories)
- WINFSP_SYS_INTERNAL; _X86_=1;i386=1;STD_CALL;%(PreprocessorDefinitions)
+ _X86_=1;i386=1;STD_CALL;%(PreprocessorDefinitions)
wdmsec.lib;%(AdditionalDependencies)
@@ -106,7 +106,7 @@
..\..\src;..\..\inc;%(AdditionalIncludeDirectories)
- WINFSP_SYS_INTERNAL; _X86_=1;i386=1;STD_CALL;%(PreprocessorDefinitions)
+ _X86_=1;i386=1;STD_CALL;%(PreprocessorDefinitions)
wdmsec.lib;%(AdditionalDependencies)
@@ -115,7 +115,7 @@
..\..\src;..\..\inc;%(AdditionalIncludeDirectories)
- WINFSP_SYS_INTERNAL; _WIN64;_AMD64_;AMD64;%(PreprocessorDefinitions)
+ _WIN64;_AMD64_;AMD64;%(PreprocessorDefinitions)
wdmsec.lib;%(AdditionalDependencies)
@@ -124,7 +124,7 @@
..\..\src;..\..\inc;%(AdditionalIncludeDirectories)
- WINFSP_SYS_INTERNAL; _WIN64;_AMD64_;AMD64;%(PreprocessorDefinitions)
+ _WIN64;_AMD64_;AMD64;%(PreprocessorDefinitions)
wdmsec.lib;%(AdditionalDependencies)
diff --git a/src/dll/debug.c b/src/dll/debug.c
new file mode 100644
index 00000000..29209b66
--- /dev/null
+++ b/src/dll/debug.c
@@ -0,0 +1,20 @@
+/**
+ * @file dll/debug.c
+ *
+ * @copyright 2015 Bill Zissimopoulos
+ */
+
+#include
+#include
+
+#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
diff --git a/src/dll/fsctl.c b/src/dll/fsctl.c
index d3e498a7..00f3d1df 100644
--- a/src/dll/fsctl.c
+++ b/src/dll/fsctl.c
@@ -4,9 +4,7 @@
* @copyright 2015 Bill Zissimopoulos
*/
-#include
-#include
-#include
+#include
#if !defined(NDEBUG)
#include
#endif
@@ -67,18 +65,6 @@ FSP_API NTSTATUS FspFsctlCreateVolume(PWSTR DevicePath,
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;
if (!MakeSelfRelativeSD(SecurityDescriptor, 0, &SecurityDescriptorSize) &&
ERROR_INSUFFICIENT_BUFFER != GetLastError())
@@ -102,6 +88,20 @@ FSP_API NTSTATUS FspFsctlCreateVolume(PWSTR DevicePath,
*ParamsBuf = *Params;
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,
0, FILE_SHARE_READ | FILE_SHARE_WRITE, 0, OPEN_EXISTING, 0, 0);
if (INVALID_HANDLE_VALUE == DeviceHandle)
diff --git a/src/dll/library.h b/src/dll/library.h
new file mode 100644
index 00000000..16a4740e
--- /dev/null
+++ b/src/dll/library.h
@@ -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
+#include
+#include
+
+#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
diff --git a/src/dll/ntstatus.c b/src/dll/ntstatus.c
index 3f00b232..aade7c9b 100644
--- a/src/dll/ntstatus.c
+++ b/src/dll/ntstatus.c
@@ -4,7 +4,7 @@
* @copyright 2015 Bill Zissimopoulos
*/
-#include
+#include
NTSTATUS FspNtStatusFromWin32(DWORD Error)
{
diff --git a/src/sys/driver.h b/src/sys/driver.h
index f6666183..c9d28496 100644
--- a/src/sys/driver.h
+++ b/src/sys/driver.h
@@ -7,6 +7,7 @@
#ifndef WINFSP_SYS_DRIVER_H_INCLUDED
#define WINFSP_SYS_DRIVER_H_INCLUDED
+#define WINFSP_SYS_INTERNAL
#include
#include
#include
@@ -23,7 +24,7 @@
/* DEBUGLOG */
#if DBG
#define DEBUGLOG(fmt, ...) \
- DbgPrint(DRIVER_NAME "!" __FUNCTION__ "[%d]: " fmt "\n", KeGetCurrentIrql(), __VA_ARGS__)
+ DbgPrint("[%d] " DRIVER_NAME "!" __FUNCTION__ ": " fmt "\n", KeGetCurrentIrql(), __VA_ARGS__)
#else
#define DEBUGLOG(fmt, ...) ((void)0)
#endif
@@ -32,12 +33,12 @@
#if DBG
#define FSP_DEBUGLOG_(fmt, rfmt, ...) \
DbgPrint(AbnormalTermination() ? \
- DRIVER_NAME "!" __FUNCTION__ "[%d](" fmt ") = !AbnormalTermination\n" :\
- DRIVER_NAME "!" __FUNCTION__ "[%d](" fmt ")" rfmt "\n",\
+ "[%d] " DRIVER_NAME "!" __FUNCTION__ "(" fmt ") = !AbnormalTermination\n" :\
+ "[%d] " DRIVER_NAME "!" __FUNCTION__ "(" fmt ")" rfmt "\n",\
KeGetCurrentIrql(), __VA_ARGS__)
#define FSP_DEBUGLOG_NOCRIT_(fmt, rfmt, ...)\
DbgPrint( \
- DRIVER_NAME "!" __FUNCTION__ "[%d](" fmt ")" rfmt "\n",\
+ "[%d] " DRIVER_NAME "!" __FUNCTION__ "(" fmt ")" rfmt "\n",\
KeGetCurrentIrql(), __VA_ARGS__)
#define FSP_DEBUGBRK_() \
do \