diff --git a/build/VStudio/testing/mirror.vcxproj b/build/VStudio/testing/mirror.vcxproj
index a0e5a2f0..62a93367 100644
--- a/build/VStudio/testing/mirror.vcxproj
+++ b/build/VStudio/testing/mirror.vcxproj
@@ -102,6 +102,7 @@
WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)
true
..\..\..\src;..\..\..\inc
+ MultiThreadedDLL
Console
@@ -117,6 +118,7 @@
_DEBUG;_CONSOLE;%(PreprocessorDefinitions)
true
..\..\..\src;..\..\..\inc
+ MultiThreadedDLL
Console
@@ -134,6 +136,7 @@
WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
true
..\..\..\src;..\..\..\inc
+ MultiThreadedDLL
Console
@@ -153,6 +156,7 @@
NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
true
..\..\..\src;..\..\..\inc
+ MultiThreadedDLL
Console
diff --git a/build/VStudio/testing/winfsp-tests.vcxproj b/build/VStudio/testing/winfsp-tests.vcxproj
index 5908c755..28439205 100644
--- a/build/VStudio/testing/winfsp-tests.vcxproj
+++ b/build/VStudio/testing/winfsp-tests.vcxproj
@@ -102,6 +102,7 @@
__func__=__FUNCTION__;WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)
true
..\..\..\src;..\..\..\inc;..\..\..\ext
+ MultiThreadedDLL
Console
@@ -117,6 +118,7 @@
__func__=__FUNCTION__;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)
true
..\..\..\src;..\..\..\inc;..\..\..\ext
+ MultiThreadedDLL
Console
@@ -134,6 +136,7 @@
__func__=__FUNCTION__;WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
true
..\..\..\src;..\..\..\inc;..\..\..\ext
+ MultiThreadedDLL
Console
@@ -153,6 +156,7 @@
__func__=__FUNCTION__;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)
true
..\..\..\src;..\..\..\inc;..\..\..\ext
+ MultiThreadedDLL
Console
diff --git a/build/VStudio/winfsp_dll.vcxproj b/build/VStudio/winfsp_dll.vcxproj
index 2bdac853..63313dbc 100644
--- a/build/VStudio/winfsp_dll.vcxproj
+++ b/build/VStudio/winfsp_dll.vcxproj
@@ -103,6 +103,7 @@
WINFSP_DLL_INTERNAL;WIN32;_DEBUG;_WINDOWS;_USRDLL;WINFSPDLL_EXPORTS;%(PreprocessorDefinitions)
true
..\..\src;..\..\inc
+ MultiThreadedDLL
Windows
@@ -118,6 +119,7 @@
WINFSP_DLL_INTERNAL;_DEBUG;_WINDOWS;_USRDLL;WINFSPDLL_EXPORTS;%(PreprocessorDefinitions)
true
..\..\src;..\..\inc
+ MultiThreadedDLL
Windows
@@ -135,6 +137,7 @@
WINFSP_DLL_INTERNAL;WIN32;NDEBUG;_WINDOWS;_USRDLL;WINFSPDLL_EXPORTS;%(PreprocessorDefinitions)
true
..\..\src;..\..\inc
+ MultiThreadedDLL
Windows
@@ -154,6 +157,7 @@
WINFSP_DLL_INTERNAL;NDEBUG;_WINDOWS;_USRDLL;WINFSPDLL_EXPORTS;%(PreprocessorDefinitions)
true
..\..\src;..\..\inc
+ MultiThreadedDLL
Windows
diff --git a/src/sys/device.c b/src/sys/device.c
index 67cf6f94..22f9b8cd 100644
--- a/src/sys/device.c
+++ b/src/sys/device.c
@@ -213,7 +213,7 @@ BOOLEAN FspDeviceRetain(PDEVICE_OBJECT DeviceObject)
DeviceExtension = FspDeviceExtension(DeviceObject);
KeAcquireSpinLock(&DeviceExtension->SpinLock, &Irql);
Result = 0 != DeviceExtension->RefCount;
- if (!Result)
+ if (Result)
DeviceExtension->RefCount++;
KeReleaseSpinLock(&DeviceExtension->SpinLock, Irql);
diff --git a/src/sys/fsctl.c b/src/sys/fsctl.c
index 23a67c6e..8e956d7b 100644
--- a/src/sys/fsctl.c
+++ b/src/sys/fsctl.c
@@ -108,8 +108,8 @@ static NTSTATUS FspFsctlCreateVolume(
PVOID SystemBuffer = Irp->AssociatedIrp.SystemBuffer;
const FSP_FSCTL_VOLUME_PARAMS *Params = SystemBuffer;
PSECURITY_DESCRIPTOR SecurityDescriptor = (PVOID)((PUINT8)Params + FSP_FSCTL_VOLUME_PARAMS_SIZE);
- DWORD SecurityDescriptorSize = InputBufferLength - sizeof *Params;
- if (sizeof *Params >= InputBufferLength || 0 == SystemBuffer ||
+ DWORD SecurityDescriptorSize = InputBufferLength - FSP_FSCTL_VOLUME_PARAMS_SIZE;
+ if (FSP_FSCTL_VOLUME_PARAMS_SIZE >= InputBufferLength || 0 == SystemBuffer ||
!FspValidRelativeSecurityDescriptor(SecurityDescriptor, SecurityDescriptorSize,
OWNER_SECURITY_INFORMATION | DACL_SECURITY_INFORMATION))
return STATUS_INVALID_PARAMETER;
@@ -475,11 +475,11 @@ NTSTATUS FspFileSystemControl(
switch (FspDeviceExtension(DeviceObject)->Kind)
{
case FspFsvolDeviceExtensionKind:
- FSP_RETURN(Result = FspFsctlFileSystemControl(DeviceObject, Irp, IrpSp));
+ FSP_RETURN(Result = FspFsvolFileSystemControl(DeviceObject, Irp, IrpSp));
case FspFsvrtDeviceExtensionKind:
FSP_RETURN(Result = FspFsvrtFileSystemControl(DeviceObject, Irp, IrpSp));
case FspFsctlDeviceExtensionKind:
- FSP_RETURN(Result = FspFsvolFileSystemControl(DeviceObject, Irp, IrpSp));
+ FSP_RETURN(Result = FspFsctlFileSystemControl(DeviceObject, Irp, IrpSp));
default:
FSP_RETURN(Result = STATUS_INVALID_DEVICE_REQUEST);
}