Преглед изворни кода

1) Added DLLs for running the test program built by MinGW-W64 8.1.0.

2) Added VS2019CPPSample and VS2019CSSample.  Verified building and running,
and updated the README files.
master
adeniz пре 4 година
родитељ
комит
6ed3f181eb

+ 0
- 1
32bitDll/IMPORTANT.txt Прегледај датотеку

@@ -9,4 +9,3 @@ If you experience errors such as segmentation faults or "The
application failed to initialize" then the most likely reason is that
an incompatible version of libgcc_s_sjlj-1.dll, libwinpthread-1.dll,
or libstdc++-6.dll is being loaded by snfmulti.dll.

+ 11
- 2
64bitDll/IMPORTANT.txt Прегледај датотеку

@@ -1,4 +1,13 @@
IMPORTANT!!
The snfmulti.dll from this distribution _MUST_ be on the path when
running programs that make SNFMulti calls.
IMPORTANT!!
The libgcc_s_seh-1.dll, libwinpthread-1.dll, libstdc++-6.dll, and
snfmulti.dll from this distribution _MUST_ be kept together, and must
be on the path. There are multiple versions of these files. Other
versions may not be compatible with this distribution.
If you experience errors such as segmentation faults or "The
application failed to initialize" then the most likely reason is that
an incompatible version of libgcc_s_seh-1.dll, libwinpthread-1.dll, or
libstdc++-6.dll is being loaded by snfmulti.dll.

BIN
64bitDll/libgcc_s_seh-1.dll Прегледај датотеку


BIN
64bitDll/libstdc++-6.dll Прегледај датотеку


BIN
64bitDll/libwinpthread-1.dll Прегледај датотеку


+ 2
- 3
CPPSample/main.cpp Прегледај датотеку

@@ -13,8 +13,7 @@ using namespace std;
const string LicenseID = "licensid"; // SNF License ID can be passed
const string Authentication = "authenticationxx"; // directly or read from the
const string ConfigurationPath = "snf_engine.xml"; // configuration. OEMs go direct!
const string ConfigurationPath = "c:\\Program Files\\SNF\\snf_engine.xml"; // configuration. OEMs go direct!
const unsigned int IPToTest = 0x0c22384e; // Same as IP 12.34.56.78
@@ -72,7 +71,7 @@ int main() {
int ScanHandle = 0;
unsigned char* MsgBuffer = (unsigned char*) SampleMessage.c_str();
unsigned int MsgBufferLength = (unsigned int) SampleMessage.length();
ScanHandle = scanBuffer(MsgBuffer, MsgBufferLength, "TestMessage", SetupTime);
ScanHandle = scanBuffer(MsgBuffer, MsgBufferLength, (char *) "TestMessage", SetupTime);
cout << "Scan Handle: " << ScanHandle << endl;

+ 1
- 1
MinGW-64/README Прегледај датотеку

@@ -15,7 +15,7 @@ To build SNFMulti.dll
2) Run "buildSNFMultiDLL.cmd". This builds snfmulti.dll,
libsnfmulti.a, and snfmulti.def.
To build the import and export SNFMulti libraries for VS2008:
To build the import and export SNFMulti libraries for VS2019:
1) With the VS2019 command prompt, run "buildVS2019SNFMultiImportLib.cmd".
This reads snfmulti.def and creates vs2019_snfmulti.lib (the SNFMulti import

+ 57
- 0
VS2019CPPSample/README Прегледај датотеку

@@ -0,0 +1,57 @@
README file for the VS 2019 CPP sample project
Copyright (c) 2020 ARM Research Laboratories
This README file gives an overview of the VS 2019 CPP sample project.
This project links the sample CPP file CPPSample\main.cpp with the
SNFMulti import library.
To build this application:
1) Open VS2019CPPSampls\VS2019CPPSample.sln with VS 2019.
2) Select "x64" (if available) or "x86" for the platform.
3) In the project, open main.cpp. Modify the initial value of
ConfigurationPath as necessary to specify the location of the
SNFServer configuration file.
4) Build.
In order to create the SNFMulti import and export libraries, do the
following:
1) Open a VS2019 command prompt (Tools->Visual Studio 2019 Command
Prompt).
2) Change to the 32bitDll directory of the SDK.
3) Enter the command:
LIB /MACHINE:x86 /DEF:snfmulti.def /name:snfmulti.dll /out:vs2019_snfmulti.lib
This creates the vs2019_snfmulti.lib import library and
vs2019_snfmulti.exp export library for the x86 platform. To create
the libraries for the x64 platform:
4) Change to the 64bitDll directory of the SDK.
5) Enter the command:
LIB /MACHINE:x64 /DEF:snfmulti.def /name:snfmulti.dll /out:vs2019_snfmulti.lib
This creates libraries for the x64 platform.
To modify a solution file to use SNFMulti, do the following:
1) Add the header file include/snfmultidll.h.
2) In Project -> Properties -> Debugging -> Environment, add
the directory containing the SNFMulti libraries and other DLLs.
3) In Project -> Properties -> Linker -> Input -> Additional
Dependencies, prepend "vs2019_snfmulti.lib".
4) In Project -> Properties -> Linker -> Optimization -> Link Time
Code Generation, specify "Use Link Time Code Generation").

+ 31
- 0
VS2019CPPSample/VS2019CPPSample.sln Прегледај датотеку

@@ -0,0 +1,31 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30309.148
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "VS2019CPPSample", "VS2019CPPSample.vcxproj", "{386A121D-5CEF-4725-A060-1B9E488187B7}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{386A121D-5CEF-4725-A060-1B9E488187B7}.Debug|x64.ActiveCfg = Debug|x64
{386A121D-5CEF-4725-A060-1B9E488187B7}.Debug|x64.Build.0 = Debug|x64
{386A121D-5CEF-4725-A060-1B9E488187B7}.Debug|x86.ActiveCfg = Debug|Win32
{386A121D-5CEF-4725-A060-1B9E488187B7}.Debug|x86.Build.0 = Debug|Win32
{386A121D-5CEF-4725-A060-1B9E488187B7}.Release|x64.ActiveCfg = Release|x64
{386A121D-5CEF-4725-A060-1B9E488187B7}.Release|x64.Build.0 = Release|x64
{386A121D-5CEF-4725-A060-1B9E488187B7}.Release|x86.ActiveCfg = Release|Win32
{386A121D-5CEF-4725-A060-1B9E488187B7}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {7BC1F098-75EC-4E22-BAD9-DA1E59067573}
EndGlobalSection
EndGlobal

+ 160
- 0
VS2019CPPSample/VS2019CPPSample.vcxproj Прегледај датотеку

@@ -0,0 +1,160 @@
<?xml version="1.0" encoding="utf-8"?>
<Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup Label="ProjectConfigurations">
<ProjectConfiguration Include="Debug|Win32">
<Configuration>Debug</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|Win32">
<Configuration>Release</Configuration>
<Platform>Win32</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Debug|x64">
<Configuration>Debug</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
<ProjectConfiguration Include="Release|x64">
<Configuration>Release</Configuration>
<Platform>x64</Platform>
</ProjectConfiguration>
</ItemGroup>
<PropertyGroup Label="Globals">
<VCProjectVersion>16.0</VCProjectVersion>
<Keyword>Win32Proj</Keyword>
<ProjectGuid>{386a121d-5cef-4725-a060-1b9e488187b7}</ProjectGuid>
<RootNamespace>VS2019CPPSample</RootNamespace>
<WindowsTargetPlatformVersion>10.0</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>true</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
<ConfigurationType>Application</ConfigurationType>
<UseDebugLibraries>false</UseDebugLibraries>
<PlatformToolset>v142</PlatformToolset>
<WholeProgramOptimization>true</WholeProgramOptimization>
<CharacterSet>Unicode</CharacterSet>
</PropertyGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
<ImportGroup Label="ExtensionSettings">
</ImportGroup>
<ImportGroup Label="Shared">
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<ImportGroup Label="PropertySheets" Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" />
</ImportGroup>
<PropertyGroup Label="UserMacros" />
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LinkIncremental>true</LinkIncremental>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LinkIncremental>false</LinkIncremental>
</PropertyGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>..\32bitDll</AdditionalLibraryDirectories>
<AdditionalDependencies>vs2019_snfmulti.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>WIN32;NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>..\32bitDll</AdditionalLibraryDirectories>
<AdditionalDependencies>vs2019_snfmulti.lib;%(AdditionalDependencies)</AdditionalDependencies>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>_DEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>..\64bitDll</AdditionalLibraryDirectories>
<AdditionalDependencies>vs2019_snfmulti.lib;%(AdditionalDependencies)</AdditionalDependencies>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<ClCompile>
<WarningLevel>Level3</WarningLevel>
<FunctionLevelLinking>true</FunctionLevelLinking>
<IntrinsicFunctions>true</IntrinsicFunctions>
<SDLCheck>true</SDLCheck>
<PreprocessorDefinitions>NDEBUG;_CONSOLE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
<ConformanceMode>true</ConformanceMode>
</ClCompile>
<Link>
<SubSystem>Console</SubSystem>
<EnableCOMDATFolding>true</EnableCOMDATFolding>
<OptimizeReferences>true</OptimizeReferences>
<GenerateDebugInformation>true</GenerateDebugInformation>
<AdditionalLibraryDirectories>..\64bitDll</AdditionalLibraryDirectories>
<AdditionalDependencies>vs2019_snfmulti.lib;%(AdditionalDependencies)</AdditionalDependencies>
<LinkTimeCodeGeneration>UseLinkTimeCodeGeneration</LinkTimeCodeGeneration>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude Include="..\include\snfmultidll.h" />
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\CPPSample\main.cpp" />
</ItemGroup>
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" />
<ImportGroup Label="ExtensionTargets">
</ImportGroup>
</Project>

+ 27
- 0
VS2019CPPSample/VS2019CPPSample.vcxproj.filters Прегледај датотеку

@@ -0,0 +1,27 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<ItemGroup>
<Filter Include="Source Files">
<UniqueIdentifier>{4FC737F1-C7A5-4376-A066-2A32D752A2FF}</UniqueIdentifier>
<Extensions>cpp;c;cc;cxx;c++;def;odl;idl;hpj;bat;asm;asmx</Extensions>
</Filter>
<Filter Include="Header Files">
<UniqueIdentifier>{93995380-89BD-4b04-88EB-625FBE52EBFB}</UniqueIdentifier>
<Extensions>h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd</Extensions>
</Filter>
<Filter Include="Resource Files">
<UniqueIdentifier>{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}</UniqueIdentifier>
<Extensions>rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms</Extensions>
</Filter>
</ItemGroup>
<ItemGroup>
<ClInclude Include="..\include\snfmultidll.h">
<Filter>Header Files</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile Include="..\CPPSample\main.cpp">
<Filter>Source Files</Filter>
</ClCompile>
</ItemGroup>
</Project>

+ 19
- 0
VS2019CPPSample/VS2019CPPSample.vcxproj.user Прегледај датотеку

@@ -0,0 +1,19 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
<LocalDebuggerEnvironment>PATH=$(ProjectDir)\..\32bitDll; %PATH%</LocalDebuggerEnvironment>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
<LocalDebuggerEnvironment>PATH=$(ProjectDir)\..\32bitDll; %PATH%</LocalDebuggerEnvironment>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
<LocalDebuggerEnvironment>PATH=$(ProjectDir)\..\64bitDll; %PATH%</LocalDebuggerEnvironment>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
<LocalDebuggerEnvironment>PATH=$(ProjectDir)\..\64bitDll; %PATH%</LocalDebuggerEnvironment>
<DebuggerFlavor>WindowsLocalDebugger</DebuggerFlavor>
</PropertyGroup>
</Project>

+ 26
- 0
VS2019CSSample/README Прегледај датотеку

@@ -0,0 +1,26 @@
README file for the VS 2019 C# sample project

Copyright (c) 2010, 2020 ARM Research Laboratories

This README file gives an overview of the VS 2019 C# sample project.

This project links the sample C# file CSSample\main.cs with the
SNFMulti DLL library.

To build this application:

1) Open VS2019CSSample\VS2019CSSample.sln with VS 2019.

2) Select "Any CPU", "x64" or "x86" for the platform.

3) In the project, open main.cs.

4) Modify the value of SNFMULTI_DLL to be the path to SNFMulti.dll.
The path depends on the platform.

5) Modify the initial value of ConfigurationPath as necessary to
specify the location of the SNFServer configuration file.

6) Build.

7) Run.

+ 91
- 0
VS2019CSSample/VS2019CSSample.csproj Прегледај датотеку

@@ -0,0 +1,91 @@
<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<PropertyGroup>
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
<Platform Condition=" '$(Platform)' == '' ">x86</Platform>
<ProjectGuid>{F8DFD85C-1DD7-4718-8D2D-DC78314A9FB1}</ProjectGuid>
<OutputType>Exe</OutputType>
<NoStandardLibraries>false</NoStandardLibraries>
<AssemblyName>ConsoleApplication</AssemblyName>
<TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
<TargetFrameworkProfile>Client</TargetFrameworkProfile>
<FileAlignment>512</FileAlignment>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
<DebugSymbols>true</DebugSymbols>
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<PlatformTarget>x86</PlatformTarget>
</PropertyGroup>
<PropertyGroup>
<RootNamespace>VS2019CSSample</RootNamespace>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE</DefineConstants>
<DebugType>full</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|AnyCPU'">
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE</DefineConstants>
<Optimize>true</Optimize>
<DebugType>pdbonly</DebugType>
<PlatformTarget>AnyCPU</PlatformTarget>
<LangVersion>7.3</LangVersion>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>MinimumRecommendedRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>
<ItemGroup>
<Reference Include="Microsoft.CSharp" />
<Reference Include="System" />
<Reference Include="System.Core" />
<Reference Include="System.Data" />
<Reference Include="System.Data.DataSetExtensions" />
<Reference Include="System.Xml" />
<Reference Include="System.Xml.Linq" />
</ItemGroup>
<ItemGroup>
<Compile Include="main.cs" />
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSHARP.Targets" />
<ProjectExtensions>
<VisualStudio AllowExistingFolder="true" />
</ProjectExtensions>
</Project>

+ 3
- 0
VS2019CSSample/VS2019CSSample.csproj.user Прегледај датотеку

@@ -0,0 +1,3 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="Current" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
</Project>

+ 37
- 0
VS2019CSSample/VS2019CSSample.sln Прегледај датотеку

@@ -0,0 +1,37 @@

Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 16
VisualStudioVersion = 16.0.30309.148
MinimumVisualStudioVersion = 10.0.40219.1
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "VS2019CSSample", "VS2019CSSample.csproj", "{F8DFD85C-1DD7-4718-8D2D-DC78314A9FB1}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
Debug|x64 = Debug|x64
Debug|x86 = Debug|x86
Release|Any CPU = Release|Any CPU
Release|x64 = Release|x64
Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{F8DFD85C-1DD7-4718-8D2D-DC78314A9FB1}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{F8DFD85C-1DD7-4718-8D2D-DC78314A9FB1}.Debug|Any CPU.Build.0 = Debug|Any CPU
{F8DFD85C-1DD7-4718-8D2D-DC78314A9FB1}.Debug|x64.ActiveCfg = Debug|x64
{F8DFD85C-1DD7-4718-8D2D-DC78314A9FB1}.Debug|x64.Build.0 = Debug|x64
{F8DFD85C-1DD7-4718-8D2D-DC78314A9FB1}.Debug|x86.ActiveCfg = Debug|x86
{F8DFD85C-1DD7-4718-8D2D-DC78314A9FB1}.Debug|x86.Build.0 = Debug|x86
{F8DFD85C-1DD7-4718-8D2D-DC78314A9FB1}.Release|Any CPU.ActiveCfg = Release|Any CPU
{F8DFD85C-1DD7-4718-8D2D-DC78314A9FB1}.Release|Any CPU.Build.0 = Release|Any CPU
{F8DFD85C-1DD7-4718-8D2D-DC78314A9FB1}.Release|x64.ActiveCfg = Release|x64
{F8DFD85C-1DD7-4718-8D2D-DC78314A9FB1}.Release|x64.Build.0 = Release|x64
{F8DFD85C-1DD7-4718-8D2D-DC78314A9FB1}.Release|x86.ActiveCfg = Release|x86
{F8DFD85C-1DD7-4718-8D2D-DC78314A9FB1}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(ExtensibilityGlobals) = postSolution
SolutionGuid = {6F912EE6-7C43-4D70-A2E3-04C99A355ACF}
EndGlobalSection
EndGlobal

+ 190
- 0
VS2019CSSample/main.cs Прегледај датотеку

@@ -0,0 +1,190 @@
// main.cs SNF-SDK-WIN C# OEM Demonstration Code
// Copyright (C) 2009 ARM Research Labs, LLC
//
// This app simply exercises the API provided by snfmultidll.

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.IO;
using System.Collections;

using System.Runtime.InteropServices;

namespace SNFMultiDLLExampleCsharp
{
class SNFMultiDLLExample
{

#region DLL Imports
// Location of SNFMulti.dll.
//const string SNFMULTI_DLL = "..\\..\\..\\64bitDll\\SNFMulti.dll"; // Set CPU type to "Any CPU"
//const string SNFMULTI_DLL = "..\\..\\..\\..\\64bitDll\\SNFMulti.dll"; // Set CPU type to "x64
const string SNFMULTI_DLL = "..\\..\\..\\32bitDll\\SNFMulti.dll"; // Set CPU type to "x86"

// int setThrottle(int Threads); /* Set scan thread limit. */
[DllImport(SNFMULTI_DLL, CharSet = CharSet.Auto, EntryPoint = "setThrottle", CallingConvention = CallingConvention.Winapi)]
public static extern int setThrottle(int throttle);

// int startupSNF(char* Path); /* Start SNF with configuration. */
[DllImport(SNFMULTI_DLL, CharSet = CharSet.Auto, EntryPoint = "startupSNF", CallingConvention = CallingConvention.Winapi)]
public static extern int startupSNF([MarshalAs(UnmanagedType.LPStr)] string Path);

// EXP int startupSNFAuthenticated(char* Path, char* Lic, char* Auth); /* Start SNF with conf & auth. */
[DllImport(SNFMULTI_DLL, CharSet = CharSet.Auto, EntryPoint = "startupSNFAuthenticated",
CallingConvention = CallingConvention.Winapi)]
public static extern int startupSNFAuthenticated(
[MarshalAs(UnmanagedType.LPStr)] string Path,
[MarshalAs(UnmanagedType.LPStr)] string Lic,
[MarshalAs(UnmanagedType.LPStr)] string Auth);

// int shutdownSNF(); /* Shutdown SNF. */
[DllImport(SNFMULTI_DLL, CharSet = CharSet.Auto, EntryPoint = "shutdownSNF", CallingConvention = CallingConvention.Winapi)]
public static extern int shutdownSNF();

// int testIP(unsigned long int IPToCheck); /* Test the IP for a GBUdb range. */
[DllImport(SNFMULTI_DLL, CharSet = CharSet.Auto, EntryPoint = "testIP", CallingConvention = CallingConvention.Winapi)]
public static extern int testIP(ulong IPToCheck);

// double getIPReputation(unsigned long int IPToCheck); /* Get reputation figure for IP. */
[DllImport(SNFMULTI_DLL, CharSet = CharSet.Auto, EntryPoint = "getIPReputation", CallingConvention = CallingConvention.Winapi)]
public static extern double getIPReputation(ulong IPToCheck);

// int scanBuffer(unsigned char* Bfr, int Length, char* Name, int Setup);/* Scan msgBuffer, name, setup time. */
[DllImport(SNFMULTI_DLL, CharSet = CharSet.Auto, EntryPoint = "scanBuffer", CallingConvention = CallingConvention.Winapi)]
public static extern int scanBuffer(
[MarshalAs(UnmanagedType.LPStr)] string Bfr,
int Length,
[MarshalAs(UnmanagedType.LPStr)] string Name,
int Setup);

// int scanFile(char* FilePath, int Setup); /* Scan msgFile, setup time. */
[DllImport(SNFMULTI_DLL, CharSet = CharSet.Auto, EntryPoint = "scanFile", CallingConvention = CallingConvention.Winapi)]
public static extern int scanFile([MarshalAs(UnmanagedType.LPStr)] string Path, int Setup);

// int getScanXHeaders(int ScanHandle, char** Bfr, int* Length); /* Get result & XHeaders. */
[DllImport(SNFMULTI_DLL, CharSet = CharSet.Auto, EntryPoint = "getScanXHeaders", CallingConvention = CallingConvention.Winapi)]
public static extern int getScanXHeaders(int ScanHandle,
out IntPtr Bfr,
out int Length);

// int getScanXMLLog(int ScanHandle, char** Bfr, int* Length); /* Get result & XML Log. */
[DllImport(SNFMULTI_DLL, CharSet = CharSet.Auto, EntryPoint = "getScanXMLLog", CallingConvention = CallingConvention.Winapi)]
public static extern int getScanXMLLog(int ScanHandle,
out IntPtr Bfr,
out int Length);

// int getScanClassicLog(int ScanHandle, char** Bfr, int* Length); /* Get result & Classic Log. */
[DllImport(SNFMULTI_DLL, CharSet = CharSet.Auto, EntryPoint = "getScanClassicLog", CallingConvention = CallingConvention.Winapi)]
public static extern int getScanClassicLog(int ScanHandle,
out IntPtr Bfr,
out int Length);

// int getScanResult(int ScanHandle); /* Get just the scan result. */
[DllImport(SNFMULTI_DLL, CharSet = CharSet.Auto, EntryPoint = "getScanResult", CallingConvention = CallingConvention.Winapi)]
public static extern int getScanResult(int ScanHandle);

// int closeScan(int ScanHandle); /* Close the scan result. */
[DllImport(SNFMULTI_DLL, CharSet = CharSet.Auto, EntryPoint = "closeScan", CallingConvention = CallingConvention.Winapi)]
public static extern int closeScan(int ScanHandle);


#endregion

static void Main(string[] args)
{
//// Setup the basics we need to run this test.

// const string LicenseID = "licensid"; // SNF License ID can be passed
// const string Authentication = "authenticationxx"; // directly or read from the
// configuration. OEMs go direct!
const string ConfigurationPath = "c:\\Program Files\\SNF\\snf_engine.xml";

const uint IPToTest = 0x0c22384e; // Same as IP 12.34.56.78

const string SampleMessage =
"Received: from mx-out.example.com [12.34.56.78] (HELO Somebody)\r\n" +
" by mx-in.example.com (nosuchserver v1.0) for nobody@example.com\r\n" +
"From: <somebody@example.com>\r\n" +
"To: <nobody@example.com>\r\n" +
"Subject: Nothing to see here\r\n" +
"\r\n" +
"So this is the big thing that's not here to see.\r\n" +
"I thought it would be more interesting than this.\r\n" +
"\r\n" +
"_M\r\n" +
".\r\n";

//// Here is a simple example. Startup, exercise the API, shut down.
//// Note that we're doing this in a very "C" style becuase the DLL API is C

int Result = 0;

Result = startupSNF(ConfigurationPath);

//Result = startupSNFAuthenticated(
// ConfigurationPath,
// LicenseID,
// Authentication);

System.Console.WriteLine("Started with config " + ConfigurationPath + " Result: " + Result);

// IP tests can be done asynchrounously - they do not have to be part of any particular scan.

Result = testIP(IPToTest);
System.Console.WriteLine("IP test result: " + Result);

double IPReputation = getIPReputation(IPToTest);
System.Console.WriteLine("IP Reputation: " + IPReputation);

// Messgae scans happen in a scan, read, close cycle as shown inside this loop.

const int NumberOfScans = 10;
for(int i = 0; i < NumberOfScans; i++) {

// Show how the IP reputation changes over time.

IPReputation = getIPReputation(IPToTest);
System.Console.WriteLine("IP Reputation: " + IPReputation);

// Scan a message from a buffer.

int SetupTime = 12;
int ScanHandle = 0;
ScanHandle = scanBuffer(SampleMessage, SampleMessage.Length, "TestMessage", SetupTime);


System.Console.WriteLine("Scan Handle: " + ScanHandle);

// Retrieve the X-Headers for the scan.

IntPtr XHeadersPtr = IntPtr.Zero;
int XHeadersLength = 0;
int ScanResult = 0;
ScanResult = getScanXHeaders(ScanHandle, out XHeadersPtr, out XHeadersLength);
string XHeaders;
XHeaders = System.Runtime.InteropServices.Marshal.PtrToStringAnsi(XHeadersPtr, XHeadersLength);

// Close the scan.

Result = closeScan(ScanHandle);

System.Console.WriteLine("Scan Close Result: " + Result);

// X- headers were captured in a string BEFORE closing the scan so we can
// use them here.

System.Console.WriteLine("Scan result code: " + ScanResult);
System.Console.WriteLine("Scan X- headers: " + XHeaders);

}

// Now that all scanning is done we shut down.

Result = shutdownSNF();

}
}
}

+ 9
- 16
readme Прегледај датотеку

@@ -6,28 +6,21 @@ The 64-bit SNFMulti.dll file is built using MinGW-64, the 64-bit MinGW
toolchain. The 32-bit SNFMulti.dll file is built using MinGW, the
32-bit MinGW toolchain.
There are two ways for building SNFMulti.dll:
1) Use the Code::Blocks project (in the CodeBlocks directory).
2) Use the .CMD files from the DOS command line (in the MinGW-64 or
MinGW-32 directory).
In addition to building SNFMulti.dll, the libSNFMulti.a and
libSNFmulti.def files are created.
The SNFMulti.dll is built using the .CMD files from the command line
(in the MinGW-64 or MinGW-32 directory). In addition to building
SNFMulti.dll, the libSNFMulti.a and libSNFmulti.def files are created.
The import and export files are built using the VS2019 command line.
There are also applications for linking with SNFMulti.dll:
1) The SNFMulti C++ test built with MinGW. This can be built with a
.CMD file in the MinGW-64 or MinGW-32 directory, or a Code::Blocks
project in the CodeBlocks directory.
.CMD file in the MinGW-64 or MinGW-32 directory
2) The SNFMulti C++ test built with Visual Studio 2008. This can be
built with solution file
VS2008CPPSample/VS2008CPPSample.sln.
2) The SNFMulti C++ test built with Visual Studio 2019. This can be
built with solution file VS20198CPPSample/VS2019CPPSample.sln.
3) A Visual Studio 2008 C# example application. This can be built
with solution file VS2008CSSample/VS2008CSSample.sln.
3) A Visual Studio 2019 C# example application. This can be built
with solution file VS2019CSSample/VS2019CSSample.sln.
4) A Visual Studio 2008 VB example application. This can be built
with the solution file VS2008VBSample/VS2008VBSample.sln.

Loading…
Откажи
Сачувај