Skip to content

Commit

Permalink
setup build
Browse files Browse the repository at this point in the history
  • Loading branch information
ibigbug committed Jun 20, 2019
1 parent d65de2e commit 1163882
Show file tree
Hide file tree
Showing 13 changed files with 40 additions and 104 deletions.
6 changes: 5 additions & 1 deletion APDU/APDU.csproj
Original file line number Diff line number Diff line change
@@ -1,9 +1,13 @@
<Project Sdk="Microsoft.NET.Sdk">
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>

<PropertyGroup>
<DebugType Condition=" '$(Configuration)' == 'Release' ">None</DebugType>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<PlatformTarget>AnyCPU</PlatformTarget>
</PropertyGroup>
Expand Down
3 changes: 2 additions & 1 deletion SoftU2F.sln
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "U2FLib", "U2FLib\U2FLib.csp
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "SoftU2FDaemon", "SoftU2FDaemon\SoftU2FDaemon.csproj", "{DA6EEE3B-38E8-414B-BDBF-AD3B80BC5950}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "JustTest", "JustTest\JustTest.csproj", "{551530B9-2C88-430A-B669-06F481FBB658}"
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "JustTest", "JustTest\JustTest.csproj", "{551530B9-2C88-430A-B669-06F481FBB658}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Expand Down Expand Up @@ -77,6 +77,7 @@ Global
{6480AC5C-E1DE-4855-B9EA-AFA0243EFE88}.Debug|x86.Build.0 = Debug|Win32
{6480AC5C-E1DE-4855-B9EA-AFA0243EFE88}.Debug|x86.Deploy.0 = Debug|Win32
{6480AC5C-E1DE-4855-B9EA-AFA0243EFE88}.Release|Any CPU.ActiveCfg = Release|Win32
{6480AC5C-E1DE-4855-B9EA-AFA0243EFE88}.Release|Any CPU.Build.0 = Release|Win32
{6480AC5C-E1DE-4855-B9EA-AFA0243EFE88}.Release|ARM.ActiveCfg = Release|ARM
{6480AC5C-E1DE-4855-B9EA-AFA0243EFE88}.Release|ARM.Build.0 = Release|ARM
{6480AC5C-E1DE-4855-B9EA-AFA0243EFE88}.Release|ARM.Deploy.0 = Release|ARM
Expand Down
87 changes: 0 additions & 87 deletions SoftU2FDaemon/Driver/SoftU2F.inf

This file was deleted.

Binary file removed SoftU2FDaemon/Driver/SoftU2FDriver.sys
Binary file not shown.
2 changes: 1 addition & 1 deletion SoftU2FDaemon/Driver/driver-install.ps1
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
pnputil.exe /add-driver .\SoftU2F.inf /install
pasus
pasue
Binary file removed SoftU2FDaemon/Driver/softu2f.cat
Binary file not shown.
7 changes: 7 additions & 0 deletions SoftU2FDaemon/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,13 @@ private void SetupApplication()
private void InitializeBackgroundDaemon()
{
var daemon = _serviceProvider.GetService<IU2FBackgroundTask>();
if (!daemon.OpenDevice())
{
MessageBox.Show("Failed to load driver. Maybe installation was unsuccessful\nExiting", "Driver Error");
if (Application.MessageLoop) Application.Exit();
Environment.Exit(1);
return;
}
(new Thread(() => { daemon.StartIoLoop(_cancellation.Token); })).Start();
UserPresence.Sender = this;
}
Expand Down
5 changes: 4 additions & 1 deletion SoftU2FDaemon/SoftU2FDaemon.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,9 @@
<PackageTags>u2f,security</PackageTags>
</PropertyGroup>

<PropertyGroup>
<DebugType Condition=" '$(Configuration)' == 'Release' ">None</DebugType>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.Extensions.DependencyInjection" Version="3.0.0-preview6.19304.6" />
Expand All @@ -29,7 +32,7 @@

<ItemGroup>
<Resources Include="$(ProjectDir)Resources\*.*" />
<Driver Include="$(ProjectDir)Driver\*.*" />
<Driver Include="$(ProjectDir)..\$(Configuration)\SoftU2FDriver\*.*" />
</ItemGroup>

<Target Name="CopyFiles" AfterTargets="Build">
Expand Down
9 changes: 0 additions & 9 deletions SoftU2FDaemon/project.json

This file was deleted.

2 changes: 1 addition & 1 deletion SoftU2FDriver/SoftU2F.inf
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ WdfCoInstaller$KMDFCOINSTALLERVERSION$.dll=1 ; make sure the number matches with
%ManufacturerName%=Standard,NT$ARCH$

[Standard.NT$ARCH$]
%SoftU2F.DeviceDesc%=SoftU2F_Device, Root\Watfaq\SoftU2F ; TODO: edit hw-id
%SoftU2F.DeviceDesc%=SoftU2F_Device, Root\SoftU2F

[SoftU2F_Device.NT]
CopyFiles=Drivers_Dir
Expand Down
12 changes: 12 additions & 0 deletions SoftU2FDriver/SoftU2F.vcxproj
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,7 @@
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor>
<Inf2CatUseLocalTime>true</Inf2CatUseLocalTime>
<Inf2CatVerbose>true</Inf2CatVerbose>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor>
Expand All @@ -150,6 +151,7 @@
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor>
<Inf2CatUseLocalTime>true</Inf2CatUseLocalTime>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
<DebuggerFlavor>DbgengKernelDebugger</DebuggerFlavor>
Expand All @@ -176,6 +178,10 @@
<Link>
<AdditionalDependencies>VhfKm.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<Inf>
<SpecifyDriverVerDirectiveVersion>true</SpecifyDriverVerDirectiveVersion>
<EnableVerbose>true</EnableVerbose>
</Inf>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
Expand All @@ -187,6 +193,9 @@
<Link>
<AdditionalDependencies>VhfKm.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
<Inf>
<TimeStamp>$(Version)</TimeStamp>
</Inf>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
Expand All @@ -207,6 +216,9 @@
<WppScanConfigurationData Condition="'%(ClCompile.ScanConfigurationData)' == ''">trace.h</WppScanConfigurationData>
<WppKernelMode>true</WppKernelMode>
</ClCompile>
<Link>
<AdditionalDependencies>$(DDK_LIB_PATH)VhfKm.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|ARM'">
<ClCompile>
Expand Down
7 changes: 4 additions & 3 deletions U2FLib/U2FBackgroundTask.cs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ namespace U2FLib
public interface IU2FBackgroundTask
{
void StartIoLoop(CancellationToken token);
bool OpenDevice();
}

public sealed partial class BackgroundTask : IU2FBackgroundTask
Expand All @@ -37,7 +38,6 @@ public sealed partial class BackgroundTask : IU2FBackgroundTask

public BackgroundTask()
{
openDevice();
}

public void StartIoLoop(CancellationToken token)
Expand Down Expand Up @@ -91,14 +91,15 @@ private IRawConvertible HandleRequest(byte[] data, IO_CTL_XFER_MESSAGE request)

}

private void openDevice()
public bool OpenDevice()
{
var ptr = GetInterfaceDevicePath();
if (ptr == IntPtr.Zero) return false;
var devicePath = Marshal.PtrToStringUni(ptr);
_device = CreateFile(devicePath, FILE_READ_DATA | FILE_WRITE_DATA, FILE_SHARE_READ | FILE_SHARE_WRITE,
IntPtr.Zero,
OPEN_EXISTING, 0, 0);
if (_device == IntPtr.Zero) throw new Exception("Cant open handle");
return _device != IntPtr.Zero;
}
}
}
4 changes: 4 additions & 0 deletions U2FLib/U2FLib.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@
<TargetFramework>netstandard2.0</TargetFramework>
</PropertyGroup>

<PropertyGroup>
<DebugType Condition=" '$(Configuration)' == 'Release' ">None</DebugType>
</PropertyGroup>

<ItemGroup>
<PackageReference Include="Microsoft.EntityFrameworkCore.Sqlite" Version="3.0.0-preview6.19304.10" />
<PackageReference Include="Portable.BouncyCastle" Version="1.8.5" />
Expand Down

0 comments on commit 1163882

Please sign in to comment.