Added CldApi.dll functions, constants and structures along with basic unit test.

pull/119/head
dahall 2020-04-22 19:36:24 -06:00
parent b8642a3c86
commit 03f79ef1d2
7 changed files with 3498 additions and 0 deletions

View File

@ -0,0 +1,21 @@
<?xml version="1.0" encoding="utf-8"?>
<Project Sdk="Microsoft.NET.Sdk">
<ProjectExtensions>
<SupportedDlls>CldApi.dll</SupportedDlls>
</ProjectExtensions>
<PropertyGroup>
<Description>PInvoke API (methods, structures and constants imported from Windows CldApi.dll.</Description>
<AssemblyTitle>$(AssemblyName)</AssemblyTitle>
<TargetFrameworks>net20;net35;net40;net45;netstandard2.0;netcoreapp2.0;netcoreapp2.1;netcoreapp3.0;netcoreapp3.1</TargetFrameworks>
<AssemblyName>Vanara.PInvoke.CldApi</AssemblyName>
<PackageId>$(AssemblyName)</PackageId>
<PackageTags>pinvoke;vanara;net-extensions;interop;CldApi;Cloud Sync Engine;Cloud Filter</PackageTags>
<AllowUnsafeBlocks>True</AllowUnsafeBlocks>
<PackageReleaseNotes />
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\Core\Vanara.Core.csproj" />
<ProjectReference Include="..\Kernel32\Vanara.PInvoke.Kernel32.csproj" />
<ProjectReference Include="..\Shared\Vanara.PInvoke.Shared.csproj" />
</ItemGroup>
</Project>

File diff suppressed because it is too large Load Diff

2268
PInvoke/CldApi/cfapi.cs Normal file

File diff suppressed because it is too large Load Diff

View File

@ -18,6 +18,9 @@
/// <summary>cabinet.dll</summary>
public const string Cabinet = "cabinet.dll";
/// <summary>cldapi.dll</summary>
public const string CldApi = "cldapi.dll";
/// <summary>The COM CTL32</summary>
public const string ComCtl32 = "comctl32.dll";

View File

@ -0,0 +1,80 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="16.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
<ProjectGuid>{CCEE0CAA-27BF-43B3-8609-2279BEDA3F61}</ProjectGuid>
<OutputType>Library</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<AssemblyName>UnitTest.PInvoke.CldApi</AssemblyName>
<TargetFrameworkVersion>v4.7.2</TargetFrameworkVersion>
<FileAlignment>512</FileAlignment>
<TargetFrameworkProfile />
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x64</PlatformTarget>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<PlatformTarget>x64</PlatformTarget>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\..\Core\Vanara.Core.csproj">
<Project>{241f73ee-9298-45c9-b869-a045dff94c03}</Project>
<Name>Vanara.Core</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\PInvoke\CldApi\Vanara.PInvoke.CldApi.csproj">
<Project>{ddfcbc19-b6ce-4dd4-a1bb-96ee86c54d93}</Project>
<Name>Vanara.PInvoke.CldApi</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\PInvoke\Kernel32\Vanara.PInvoke.Kernel32.csproj">
<Project>{842d436f-598c-47d7-b5aa-12399f8ccfe9}</Project>
<Name>Vanara.PInvoke.Kernel32</Name>
</ProjectReference>
<ProjectReference Include="..\..\..\PInvoke\Shared\Vanara.PInvoke.Shared.csproj">
<Project>{a5e519e9-feba-4fe3-93a5-b8269bef72f4}</Project>
<Name>Vanara.PInvoke.Shared</Name>
</ProjectReference>
<ProjectReference Include="..\..\CSharpRunner\Shared.csproj">
<Project>{a96cff10-0967-429a-8700-4a86c97c5603}</Project>
<Name>Shared</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="NUnit">
<Version>3.12.0</Version>
</PackageReference>
<PackageReference Include="NUnit3TestAdapter">
<Version>3.15.1</Version>
</PackageReference>
</ItemGroup>
<ItemGroup>
<Reference Include="System" />
</ItemGroup>
<ItemGroup>
<Compile Include="CldApiTests.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
</Target>
<Target Name="AfterBuild">
</Target>
-->
</Project>

View File

@ -0,0 +1,23 @@
using Microsoft.Win32.SafeHandles;
using NUnit.Framework;
using System;
using System.Linq;
using System.Runtime.InteropServices;
using System.Threading;
using Vanara.Extensions;
using Vanara.InteropServices;
using static Vanara.PInvoke.CldApi;
namespace Vanara.PInvoke.Tests
{
public class CldApiTests
{
[Test]
public void CfOpenFileWithOplockTest()
{
Assert.That(CfOpenFileWithOplock(TestCaseSources.SmallFile, CF_OPEN_FILE_FLAGS.CF_OPEN_FILE_FLAG_EXCLUSIVE, out var handle), ResultIs.Successful);
Assert.That(handle, ResultIs.ValidHandle);
Assert.That(() => handle.Dispose(), Throws.Nothing);
}
}
}

View File

@ -219,6 +219,10 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Vanara.PInvoke.DnsApi", "PI
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "DnsApi", "UnitTests\PInvoke\DnsApi\DnsApi.csproj", "{5B4ADAFE-DCCC-40BC-9A9E-8086E57E8B49}"
EndProject
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Vanara.PInvoke.CldApi", "PInvoke\CldApi\Vanara.PInvoke.CldApi.csproj", "{DDFCBC19-B6CE-4DD4-A1BB-96EE86C54D93}"
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "CldApi", "UnitTests\PInvoke\CldApi\CldApi.csproj", "{CCEE0CAA-27BF-43B3-8609-2279BEDA3F61}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug (no Unit Tests)|Any CPU = Debug (no Unit Tests)|Any CPU
@ -698,6 +702,18 @@ Global
{5B4ADAFE-DCCC-40BC-9A9E-8086E57E8B49}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{5B4ADAFE-DCCC-40BC-9A9E-8086E57E8B49}.Debug|Any CPU.Build.0 = Debug|Any CPU
{5B4ADAFE-DCCC-40BC-9A9E-8086E57E8B49}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DDFCBC19-B6CE-4DD4-A1BB-96EE86C54D93}.Debug (no Unit Tests)|Any CPU.ActiveCfg = Debug|Any CPU
{DDFCBC19-B6CE-4DD4-A1BB-96EE86C54D93}.Debug (no Unit Tests)|Any CPU.Build.0 = Debug|Any CPU
{DDFCBC19-B6CE-4DD4-A1BB-96EE86C54D93}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{DDFCBC19-B6CE-4DD4-A1BB-96EE86C54D93}.Debug|Any CPU.Build.0 = Debug|Any CPU
{DDFCBC19-B6CE-4DD4-A1BB-96EE86C54D93}.Release|Any CPU.ActiveCfg = Release|Any CPU
{DDFCBC19-B6CE-4DD4-A1BB-96EE86C54D93}.Release|Any CPU.Build.0 = Release|Any CPU
{CCEE0CAA-27BF-43B3-8609-2279BEDA3F61}.Debug (no Unit Tests)|Any CPU.ActiveCfg = Debug|Any CPU
{CCEE0CAA-27BF-43B3-8609-2279BEDA3F61}.Debug (no Unit Tests)|Any CPU.Build.0 = Debug|Any CPU
{CCEE0CAA-27BF-43B3-8609-2279BEDA3F61}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{CCEE0CAA-27BF-43B3-8609-2279BEDA3F61}.Debug|Any CPU.Build.0 = Debug|Any CPU
{CCEE0CAA-27BF-43B3-8609-2279BEDA3F61}.Release|Any CPU.ActiveCfg = Release|Any CPU
{CCEE0CAA-27BF-43B3-8609-2279BEDA3F61}.Release|Any CPU.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@ -790,6 +806,8 @@ Global
{35B95D64-CC7E-48B4-B104-4886411531AC} = {385CAD2D-0A5E-4F80-927B-D5499D126B90}
{15023E19-86A7-40C7-838E-21EEB15A63AF} = {212ABBD0-B724-4CFA-9D6D-E3891547FA90}
{5B4ADAFE-DCCC-40BC-9A9E-8086E57E8B49} = {385CAD2D-0A5E-4F80-927B-D5499D126B90}
{DDFCBC19-B6CE-4DD4-A1BB-96EE86C54D93} = {212ABBD0-B724-4CFA-9D6D-E3891547FA90}
{CCEE0CAA-27BF-43B3-8609-2279BEDA3F61} = {385CAD2D-0A5E-4F80-927B-D5499D126B90}
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {543FAC75-2AF1-4EF1-9609-B242B63FEED4}