Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
O
online-militaryGuarantee
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
container
online-militaryGuarantee
Commits
6d9d8714
Commit
6d9d8714
authored
Nov 27, 2024
by
Denny
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
VC项目提交
parent
2d7c12fc
Show whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
1800 additions
and
0 deletions
+1800
-0
Logger.cpp
RowinSelf.MilitarySecurity/RW_VC_MMSC/Logger.cpp
+36
-0
Logger.h
RowinSelf.MilitarySecurity/RW_VC_MMSC/Logger.h
+26
-0
RW_VC_MMSC.vcxproj
RowinSelf.MilitarySecurity/RW_VC_MMSC/RW_VC_MMSC.vcxproj
+166
-0
RW_VC_MMSC.vcxproj.filters
...lf.MilitarySecurity/RW_VC_MMSC/RW_VC_MMSC.vcxproj.filters
+51
-0
dllmain.cpp
RowinSelf.MilitarySecurity/RW_VC_MMSC/dllmain.cpp
+19
-0
framework.h
RowinSelf.MilitarySecurity/RW_VC_MMSC/framework.h
+5
-0
pch.cpp
RowinSelf.MilitarySecurity/RW_VC_MMSC/pch.cpp
+5
-0
pch.h
RowinSelf.MilitarySecurity/RW_VC_MMSC/pch.h
+14
-0
resource.h
RowinSelf.MilitarySecurity/RW_VC_MMSC/resource.h
+15
-0
version.rc
RowinSelf.MilitarySecurity/RW_VC_MMSC/version.rc
+0
-0
wrapper.cpp
RowinSelf.MilitarySecurity/RW_VC_MMSC/wrapper.cpp
+1183
-0
wrapper.h
RowinSelf.MilitarySecurity/RW_VC_MMSC/wrapper.h
+252
-0
RowinSelf.MilitarySecurity.sln
RowinSelf.MilitarySecurity/RowinSelf.MilitarySecurity.sln
+28
-0
No files found.
RowinSelf.MilitarySecurity/RW_VC_MMSC/Logger.cpp
0 → 100644
View file @
6d9d8714
#include "pch.h"
#include "Logger.h"
#include <ctime>
#include <sstream>
// 静态成员初始化
std
::
shared_ptr
<
spdlog
::
logger
>
Logger
::
logger
=
nullptr
;
// 获取日志实例
std
::
shared_ptr
<
spdlog
::
logger
>
Logger
::
getLogger
()
{
if
(
!
logger
)
{
const
std
::
string
log_dir
=
"PLA/logs"
;
// 日志存放目录
ensureLogDir
(
log_dir
);
// 确保目录存在
// 动态生成日志文件名(纯日期 + .log)
const
std
::
string
log_filename
=
log_dir
+
"/"
+
"VCLog"
+
".log"
;
// 创建按天分割的日志文件输出器
logger
=
spdlog
::
daily_logger_mt
(
"daily_logger"
,
log_filename
,
0
,
0
);
// 每天 0 点分割
logger
->
set_level
(
spdlog
::
level
::
info
);
// 默认级别 INFO
spdlog
::
flush_on
(
spdlog
::
level
::
info
);
// 自动刷新 INFO 级别以上的日志
}
return
logger
;
}
// 设置日志级别
void
Logger
::
setLogLevel
(
spdlog
::
level
::
level_enum
level
)
{
getLogger
()
->
set_level
(
level
);
}
// 确保日志目录存在
void
Logger
::
ensureLogDir
(
const
std
::
string
&
dir
)
{
if
(
!
std
::
filesystem
::
exists
(
dir
))
{
std
::
filesystem
::
create_directories
(
dir
);
// 创建目录
}
}
RowinSelf.MilitarySecurity/RW_VC_MMSC/Logger.h
0 → 100644
View file @
6d9d8714
#ifndef LOGGER_H
#define LOGGER_H
#include <spdlog/spdlog.h>
#include <spdlog/sinks/daily_file_sink.h>
#include <string>
#include <memory>
#include <filesystem>
// 日志管理类
class
Logger
{
public
:
// 获取日志实例
static
std
::
shared_ptr
<
spdlog
::
logger
>
getLogger
();
// 设置日志级别(默认是 INFO)
static
void
setLogLevel
(
spdlog
::
level
::
level_enum
level
);
// 确保日志目录存在
static
void
ensureLogDir
(
const
std
::
string
&
dir
);
private
:
static
std
::
shared_ptr
<
spdlog
::
logger
>
logger
;
// 日志实例
};
#endif // LOGGER_H
RowinSelf.MilitarySecurity/RW_VC_MMSC/RW_VC_MMSC.vcxproj
0 → 100644
View file @
6d9d8714
<?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>
17.0
</VCProjectVersion>
<Keyword>
Win32Proj
</Keyword>
<ProjectGuid>
{4232629b-556e-423f-b8cb-e12e86ea26f4}
</ProjectGuid>
<RootNamespace>
RWVCMMSC
</RootNamespace>
<WindowsTargetPlatformVersion>
10.0
</WindowsTargetPlatformVersion>
</PropertyGroup>
<Import
Project=
"$(VCTargetsPath)\Microsoft.Cpp.Default.props"
/>
<PropertyGroup
Condition=
"'$(Configuration)|$(Platform)'=='Debug|Win32'"
Label=
"Configuration"
>
<ConfigurationType>
DynamicLibrary
</ConfigurationType>
<UseDebugLibraries>
true
</UseDebugLibraries>
<PlatformToolset>
v143
</PlatformToolset>
<CharacterSet>
Unicode
</CharacterSet>
</PropertyGroup>
<PropertyGroup
Condition=
"'$(Configuration)|$(Platform)'=='Release|Win32'"
Label=
"Configuration"
>
<ConfigurationType>
DynamicLibrary
</ConfigurationType>
<UseDebugLibraries>
false
</UseDebugLibraries>
<PlatformToolset>
v143
</PlatformToolset>
<WholeProgramOptimization>
true
</WholeProgramOptimization>
<CharacterSet>
Unicode
</CharacterSet>
</PropertyGroup>
<PropertyGroup
Condition=
"'$(Configuration)|$(Platform)'=='Debug|x64'"
Label=
"Configuration"
>
<ConfigurationType>
DynamicLibrary
</ConfigurationType>
<UseDebugLibraries>
true
</UseDebugLibraries>
<PlatformToolset>
v143
</PlatformToolset>
<CharacterSet>
Unicode
</CharacterSet>
</PropertyGroup>
<PropertyGroup
Condition=
"'$(Configuration)|$(Platform)'=='Release|x64'"
Label=
"Configuration"
>
<ConfigurationType>
DynamicLibrary
</ConfigurationType>
<UseDebugLibraries>
false
</UseDebugLibraries>
<PlatformToolset>
v143
</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"
/>
<ItemDefinitionGroup
Condition=
"'$(Configuration)|$(Platform)'=='Debug|Win32'"
>
<ClCompile>
<WarningLevel>
Level3
</WarningLevel>
<SDLCheck>
true
</SDLCheck>
<PreprocessorDefinitions>
WIN32;_DEBUG;RWVCMMSC_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
</PreprocessorDefinitions>
<ConformanceMode>
true
</ConformanceMode>
<PrecompiledHeader>
Use
</PrecompiledHeader>
<PrecompiledHeaderFile>
pch.h
</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>
Windows
</SubSystem>
<GenerateDebugInformation>
true
</GenerateDebugInformation>
<EnableUAC>
false
</EnableUAC>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup
Condition=
"'$(Configuration)|$(Platform)'=='Release|Win32'"
>
<ClCompile>
<WarningLevel>
Level3
</WarningLevel>
<FunctionLevelLinking>
true
</FunctionLevelLinking>
<IntrinsicFunctions>
true
</IntrinsicFunctions>
<SDLCheck>
true
</SDLCheck>
<PreprocessorDefinitions>
WIN32;NDEBUG;RWVCMMSC_EXPORTS;_WINDOWS;_USRDLL;WRAPPER_DLL_EXPORTS;%(PreprocessorDefinitions)
</PreprocessorDefinitions>
<ConformanceMode>
true
</ConformanceMode>
<PrecompiledHeader>
Use
</PrecompiledHeader>
<PrecompiledHeaderFile>
pch.h
</PrecompiledHeaderFile>
<LanguageStandard>
stdcpp17
</LanguageStandard>
</ClCompile>
<Link>
<SubSystem>
Windows
</SubSystem>
<EnableCOMDATFolding>
true
</EnableCOMDATFolding>
<OptimizeReferences>
true
</OptimizeReferences>
<GenerateDebugInformation>
true
</GenerateDebugInformation>
<EnableUAC>
false
</EnableUAC>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup
Condition=
"'$(Configuration)|$(Platform)'=='Debug|x64'"
>
<ClCompile>
<WarningLevel>
Level3
</WarningLevel>
<SDLCheck>
true
</SDLCheck>
<PreprocessorDefinitions>
_DEBUG;RWVCMMSC_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
</PreprocessorDefinitions>
<ConformanceMode>
true
</ConformanceMode>
<PrecompiledHeader>
Use
</PrecompiledHeader>
<PrecompiledHeaderFile>
pch.h
</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>
Windows
</SubSystem>
<GenerateDebugInformation>
true
</GenerateDebugInformation>
<EnableUAC>
false
</EnableUAC>
</Link>
</ItemDefinitionGroup>
<ItemDefinitionGroup
Condition=
"'$(Configuration)|$(Platform)'=='Release|x64'"
>
<ClCompile>
<WarningLevel>
Level3
</WarningLevel>
<FunctionLevelLinking>
true
</FunctionLevelLinking>
<IntrinsicFunctions>
true
</IntrinsicFunctions>
<SDLCheck>
true
</SDLCheck>
<PreprocessorDefinitions>
NDEBUG;RWVCMMSC_EXPORTS;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)
</PreprocessorDefinitions>
<ConformanceMode>
true
</ConformanceMode>
<PrecompiledHeader>
Use
</PrecompiledHeader>
<PrecompiledHeaderFile>
pch.h
</PrecompiledHeaderFile>
</ClCompile>
<Link>
<SubSystem>
Windows
</SubSystem>
<EnableCOMDATFolding>
true
</EnableCOMDATFolding>
<OptimizeReferences>
true
</OptimizeReferences>
<GenerateDebugInformation>
true
</GenerateDebugInformation>
<EnableUAC>
false
</EnableUAC>
</Link>
</ItemDefinitionGroup>
<ItemGroup>
<ClInclude
Include=
"framework.h"
/>
<ClInclude
Include=
"Logger.h"
/>
<ClInclude
Include=
"pch.h"
/>
<ClInclude
Include=
"wrapper.h"
/>
</ItemGroup>
<ItemGroup>
<ClCompile
Include=
"dllmain.cpp"
/>
<ClCompile
Include=
"Logger.cpp"
/>
<ClCompile
Include=
"pch.cpp"
>
<PrecompiledHeader
Condition=
"'$(Configuration)|$(Platform)'=='Debug|x64'"
>
Create
</PrecompiledHeader>
<PrecompiledHeader
Condition=
"'$(Configuration)|$(Platform)'=='Debug|Win32'"
>
Create
</PrecompiledHeader>
<PrecompiledHeader
Condition=
"'$(Configuration)|$(Platform)'=='Release|Win32'"
>
Create
</PrecompiledHeader>
<PrecompiledHeader
Condition=
"'$(Configuration)|$(Platform)'=='Release|x64'"
>
Create
</PrecompiledHeader>
</ClCompile>
<ClCompile
Include=
"wrapper.cpp"
/>
</ItemGroup>
<ItemGroup>
<ResourceCompile
Include=
"version.rc"
/>
</ItemGroup>
<Import
Project=
"$(VCTargetsPath)\Microsoft.Cpp.targets"
/>
<ImportGroup
Label=
"ExtensionTargets"
>
</ImportGroup>
</Project>
\ No newline at end of file
RowinSelf.MilitarySecurity/RW_VC_MMSC/RW_VC_MMSC.vcxproj.filters
0 → 100644
View file @
6d9d8714
<?xml version="1.0" encoding="utf-8"?>
<Project
ToolsVersion=
"4.0"
xmlns=
"http://schemas.microsoft.com/developer/msbuild/2003"
>
<ItemGroup>
<Filter
Include=
"源文件"
>
<UniqueIdentifier>
{4FC737F1-C7A5-4376-A066-2A32D752A2FF}
</UniqueIdentifier>
<Extensions>
cpp;c;cc;cxx;c++;cppm;ixx;def;odl;idl;hpj;bat;asm;asmx
</Extensions>
</Filter>
<Filter
Include=
"头文件"
>
<UniqueIdentifier>
{93995380-89BD-4b04-88EB-625FBE52EBFB}
</UniqueIdentifier>
<Extensions>
h;hh;hpp;hxx;h++;hm;inl;inc;ipp;xsd
</Extensions>
</Filter>
<Filter
Include=
"资源文件"
>
<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=
"framework.h"
>
<Filter>
头文件
</Filter>
</ClInclude>
<ClInclude
Include=
"pch.h"
>
<Filter>
头文件
</Filter>
</ClInclude>
<ClInclude
Include=
"wrapper.h"
>
<Filter>
头文件
</Filter>
</ClInclude>
<ClInclude
Include=
"Logger.h"
>
<Filter>
头文件
</Filter>
</ClInclude>
</ItemGroup>
<ItemGroup>
<ClCompile
Include=
"dllmain.cpp"
>
<Filter>
源文件
</Filter>
</ClCompile>
<ClCompile
Include=
"pch.cpp"
>
<Filter>
源文件
</Filter>
</ClCompile>
<ClCompile
Include=
"wrapper.cpp"
>
<Filter>
源文件
</Filter>
</ClCompile>
<ClCompile
Include=
"Logger.cpp"
>
<Filter>
源文件
</Filter>
</ClCompile>
</ItemGroup>
<ItemGroup>
<ResourceCompile
Include=
"version.rc"
>
<Filter>
资源文件
</Filter>
</ResourceCompile>
</ItemGroup>
</Project>
\ No newline at end of file
RowinSelf.MilitarySecurity/RW_VC_MMSC/dllmain.cpp
0 → 100644
View file @
6d9d8714
// dllmain.cpp : 定义 DLL 应用程序的入口点。
#include "pch.h"
BOOL
APIENTRY
DllMain
(
HMODULE
hModule
,
DWORD
ul_reason_for_call
,
LPVOID
lpReserved
)
{
switch
(
ul_reason_for_call
)
{
case
DLL_PROCESS_ATTACH
:
case
DLL_THREAD_ATTACH
:
case
DLL_THREAD_DETACH
:
case
DLL_PROCESS_DETACH
:
break
;
}
return
TRUE
;
}
RowinSelf.MilitarySecurity/RW_VC_MMSC/framework.h
0 → 100644
View file @
6d9d8714
#
pragma
once
#define WIN32_LEAN_AND_MEAN // 从 Windows 头文件中排除极少使用的内容
// Windows 头文件
#include <windows.h>
RowinSelf.MilitarySecurity/RW_VC_MMSC/pch.cpp
0 → 100644
View file @
6d9d8714
// pch.cpp: 与预编译标头对应的源文件
#include "pch.h"
// 当使用预编译的头时,需要使用此源文件,编译才能成功。
RowinSelf.MilitarySecurity/RW_VC_MMSC/pch.h
0 → 100644
View file @
6d9d8714
// pch.h: 这是预编译标头文件。
// 下方列出的文件仅编译一次,提高了将来生成的生成性能。
// 这还将影响 IntelliSense 性能,包括代码完成和许多代码浏览功能。
// 但是,如果此处列出的文件中的任何一个在生成之间有更新,它们全部都将被重新编译。
// 请勿在此处添加要频繁更新的文件,这将使得性能优势无效。
#ifndef PCH_H
#define PCH_H
// 添加要在此处预编译的标头
#include "framework.h"
#include "wrapper.h"
#endif //PCH_H
RowinSelf.MilitarySecurity/RW_VC_MMSC/resource.h
0 → 100644
View file @
6d9d8714
//{{NO_DEPENDENCIES}}
// Microsoft Visual C++ 生成的包含文件。
// 供 version.rc 使用
//
// Next default values for new objects
//
#ifdef APSTUDIO_INVOKED
#ifndef APSTUDIO_READONLY_SYMBOLS
#define _APS_NEXT_RESOURCE_VALUE 101
#define _APS_NEXT_COMMAND_VALUE 40001
#define _APS_NEXT_CONTROL_VALUE 1001
#define _APS_NEXT_SYMED_VALUE 101
#endif
#endif
RowinSelf.MilitarySecurity/RW_VC_MMSC/version.rc
0 → 100644
View file @
6d9d8714
B
// Microsoft Visual C++ generated resource script.
RowinSelf.MilitarySecurity/RW_VC_MMSC/wrapper.cpp
0 → 100644
View file @
6d9d8714
#include "wrapper.h"
#include "pch.h"
#include "framework.h"
#include "Logger.h"
#include <Windows.h>
#include <iostream>
#include <sstream>
#include <stdexcept>
#include <cstdio>
#include <spdlog/spdlog.h>
#include <spdlog/sinks/basic_file_sink.h>
#include <string.h>
#pragma region 定义动态加载函数指针
typedef
int
(
__stdcall
*
LinkDeviceFunc
)(
const
char
*
);
typedef
int
(
__stdcall
*
UnlinkDeviceFunc
)();
typedef
int
(
__stdcall
*
PowerOnFunc
)(
char
*
,
unsigned
long
*
);
typedef
int
(
__stdcall
*
PowerOffFunc
)(
char
*
,
unsigned
long
*
);
typedef
int
(
__stdcall
*
ReadCardFunc
)(
unsigned
int
,
unsigned
int
,
unsigned
int
,
char
*
,
unsigned
long
*
);
typedef
int
(
__stdcall
*
WriteCardFunc
)(
unsigned
int
,
unsigned
int
,
unsigned
int
,
const
char
*
,
char
*
,
unsigned
long
*
);
typedef
int
(
__stdcall
*
ChkSecretFunc
)(
int
,
char
*
,
char
*
,
unsigned
long
*
);
typedef
int
(
__stdcall
*
WriteSecretFunc
)(
int
,
char
*
,
char
*
,
unsigned
long
*
);
typedef
int
(
__stdcall
*
ReadSecretFunc
)(
int
,
char
*
,
unsigned
long
*
);
typedef
int
(
__stdcall
*
HexStrToByteFunc
)(
const
char
*
,
char
*
);
typedef
int
(
__stdcall
*
ByteToHexStrFunc
)(
char
*
,
unsigned
int
,
char
*
);
typedef
int
(
__stdcall
*
HexByteToDecFunc
)(
const
char
*
,
unsigned
long
*
);
typedef
int
(
__stdcall
*
DecToHexByteFunc
)(
unsigned
long
,
char
*
);
typedef
int
(
__stdcall
*
SetKeyVersionFunc
)(
int
,
int
,
char
*
,
unsigned
long
*
);
typedef
int
(
__stdcall
*
Chk1608SecretFunc
)(
int
,
char
*
,
unsigned
long
*
);
typedef
int
(
__stdcall
*
Authenfic1608Func
)(
char
*
,
unsigned
long
*
);
typedef
int
(
__stdcall
*
HexByteToLongFunc
)(
const
char
*
,
unsigned
long
*
);
typedef
int
(
__stdcall
*
LongToHexByteFunc
)(
unsigned
long
,
char
*
);
typedef
int
(
__stdcall
*
SignatureFunc
)(
const
char
*
,
const
char
*
,
int
,
char
*
,
unsigned
long
*
);
typedef
int
(
__stdcall
*
VerifySignetFunc
)(
const
char
*
,
const
char
*
,
int
,
const
char
*
,
char
*
,
unsigned
long
*
);
typedef
int
(
__stdcall
*
WriteIDInfoFunc
)(
const
char
*
,
char
*
,
unsigned
long
*
);
typedef
int
(
__stdcall
*
PINOpfuncFunc
)(
int
,
int
,
const
char
*
,
int
,
char
*
,
unsigned
long
*
);
typedef
int
(
__stdcall
*
UpdateIDInfoFunc
)(
const
char
*
,
char
*
,
unsigned
long
*
);
typedef
int
(
__stdcall
*
LockUserCardFunc
)(
char
*
,
unsigned
long
*
);
typedef
int
(
__stdcall
*
ReadSamIDInfoFunc
)(
char
*
,
unsigned
long
*
);
typedef
int
(
__stdcall
*
GetICCardNoFunc
)(
int
,
char
*
,
unsigned
long
*
);
typedef
int
(
__stdcall
*
PowerOnSamFunc
)(
char
*
,
unsigned
long
*
);
typedef
int
(
__stdcall
*
GetUpdateIDRightFunc
)(
const
char
*
,
const
char
*
,
char
*
,
unsigned
long
*
);
#pragma endregion
// 动态加载Dll文件句柄
static
HMODULE
hDll
=
nullptr
;
auto
logger
=
Logger
::
getLogger
();
/// <summary>
/// 加载目标DLL文件
/// </summary>
void
LoadTargetDll
()
{
// 判断Dll句柄
if
(
hDll
)
{
return
;
}
//LPCWSTR dllRelativePath = L".\\PLA\\UsbDxqDll_10.dll";
////// 加载 DLL 文件
//hDll = LoadLibrary(dllRelativePath);
// 加载DLL文件
hDll
=
LoadLibrary
(
L"UsbDxqDll_10.dll"
);
if
(
!
hDll
)
{
// 使用 stringstream 构造错误信息
std
::
ostringstream
errorMessage
;
errorMessage
<<
"无法加载 UsbDxqDll_10.dll,错误代码: "
<<
GetLastError
();
// 记录日志
logger
->
error
(
errorMessage
.
str
());
// 抛出异常并附带错误信息
throw
std
::
runtime_error
(
errorMessage
.
str
());
}
}
/// <summary>
/// 释放目标DLL文件
/// </summary>
void
__stdcall
UnloadTargetDll
()
{
// 判断Dll句柄
if
(
hDll
)
{
// 释放目标 DLL
FreeLibrary
(
hDll
);
// 清空 Dll 句柄
hDll
=
nullptr
;
}
}
/// <summary>
/// 打开设备通讯
/// </summary>
/// <param name="devPort">设备端口</param>
/// <returns></returns>
int
__stdcall
OpenComm
(
const
char
*
devPort
)
{
int
ret
=
-
1
;
try
{
// 确认目标DLL
LoadTargetDll
();
LinkDeviceFunc
_LinkDevice
=
(
LinkDeviceFunc
)
GetProcAddress
(
hDll
,
"LinkDevice"
);
if
(
!
_LinkDevice
)
{
// 使用 stringstream 构造错误信息
std
::
ostringstream
errorMessage
;
errorMessage
<<
"加载 LinkDevice 函数失败,错误代码: "
<<
GetLastError
();
// 记录日志
logger
->
error
(
errorMessage
.
str
());
// 抛出异常并附带错误信息
throw
std
::
runtime_error
(
errorMessage
.
str
());
}
ret
=
_LinkDevice
(
devPort
);
}
catch
(
const
std
::
exception
&
ex
)
{
// 使用 stringstream 构造错误信息
std
::
ostringstream
errorMessage
;
// 捕获异常并输出详细错误信息
errorMessage
<<
"VC:OpenComm函数方法发生异常: "
<<
ex
.
what
()
<<
std
::
endl
;
// 记录日志
logger
->
error
(
errorMessage
.
str
());
// 抛出异常并附带错误信息
throw
std
::
runtime_error
(
errorMessage
.
str
());
}
return
ret
;
}
/// <summary>
/// 关闭设备通讯
/// </summary>
/// <returns></returns>
int
__stdcall
CloseComm
()
{
int
ret
=
-
1
;
try
{
// 确认目标DLL
LoadTargetDll
();
UnlinkDeviceFunc
_UnlinkDevice
=
(
UnlinkDeviceFunc
)
GetProcAddress
(
hDll
,
"UnlinkDevice"
);
if
(
!
_UnlinkDevice
)
{
// 使用 stringstream 构造错误信息
std
::
ostringstream
errorMessage
;
errorMessage
<<
"加载 UnlinkDevice 函数失败,错误代码: "
<<
GetLastError
();
// 记录日志
logger
->
error
(
errorMessage
.
str
());
// 抛出异常并附带错误信息
throw
std
::
runtime_error
(
errorMessage
.
str
());
}
ret
=
_UnlinkDevice
();
}
catch
(
const
std
::
exception
&
ex
)
{
// 使用 stringstream 构造错误信息
std
::
ostringstream
errorMessage
;
// 捕获异常并输出详细错误信息
errorMessage
<<
"VC:CloseComm函数方法发生异常: "
<<
ex
.
what
()
<<
std
::
endl
;
// 记录日志
logger
->
error
(
errorMessage
.
str
());
// 抛出异常并附带错误信息
throw
std
::
runtime_error
(
errorMessage
.
str
());
}
return
ret
;
}
/// <summary>
/// IC卡片上电
/// </summary>
/// <param name="receData">输出数据(最多 256 字节)</param>
/// <param name="receDataLen">输出数据长度</param>
/// <returns></returns>
int
__stdcall
PowerOn
(
char
*
receData
,
unsigned
long
*
receDataLen
)
{
int
ret
=
-
1
;
try
{
// 确认目标DLL
LoadTargetDll
();
PowerOnFunc
_PowerOn
=
(
PowerOnFunc
)
GetProcAddress
(
hDll
,
"PowerOn"
);
if
(
!
_PowerOn
)
{
// 使用 stringstream 构造错误信息
std
::
ostringstream
errorMessage
;
errorMessage
<<
"加载 PowerOn 函数失败,错误代码: "
<<
GetLastError
();
// 记录日志
logger
->
error
(
errorMessage
.
str
());
// 抛出异常并附带错误信息
throw
std
::
runtime_error
(
errorMessage
.
str
());
}
ret
=
_PowerOn
(
receData
,
receDataLen
);
}
catch
(
const
std
::
exception
&
ex
)
{
// 使用 stringstream 构造错误信息
std
::
ostringstream
errorMessage
;
// 捕获异常并输出详细错误信息
errorMessage
<<
"VC:PowerOn函数方法发生异常: "
<<
ex
.
what
()
<<
std
::
endl
;
// 记录日志
logger
->
error
(
errorMessage
.
str
());
// 抛出异常并附带错误信息
throw
std
::
runtime_error
(
errorMessage
.
str
());
}
return
ret
;
}
/// <summary>
/// IC卡片下电
/// </summary>
/// <param name="receData">输出数据(最多 256 字节)</param>
/// <param name="receDataLen">输出数据长度</param>
/// <returns></returns>
int
__stdcall
PowerOff
(
char
*
receData
,
unsigned
long
*
receDataLen
)
{
int
ret
=
-
1
;
try
{
// 确认目标DLL
LoadTargetDll
();
PowerOffFunc
_PowerOff
=
(
PowerOffFunc
)
GetProcAddress
(
hDll
,
"PowerOff"
);
if
(
!
_PowerOff
)
{
// 使用 stringstream 构造错误信息
std
::
ostringstream
errorMessage
;
errorMessage
<<
"加载 PowerOff 函数失败,错误代码: "
<<
GetLastError
();
// 记录日志
logger
->
error
(
errorMessage
.
str
());
// 抛出异常并附带错误信息
throw
std
::
runtime_error
(
errorMessage
.
str
());
}
ret
=
_PowerOff
(
receData
,
receDataLen
);
}
catch
(
const
std
::
exception
&
ex
)
{
// 使用 stringstream 构造错误信息
std
::
ostringstream
errorMessage
;
// 捕获异常并输出详细错误信息
errorMessage
<<
"VC:PowerOff函数方法发生异常: "
<<
ex
.
what
()
<<
std
::
endl
;
// 记录日志
logger
->
error
(
errorMessage
.
str
());
// 抛出异常并附带错误信息
throw
std
::
runtime_error
(
errorMessage
.
str
());
}
return
ret
;
}
/// <summary>
/// 读取卡片
/// </summary>
/// <param name="zone">指定读取的卡片区域</param>
/// <param name="addr">起始地址</param>
/// <param name="len">要读取的数据长度</param>
/// <param name="receData">输出数据(最多 256 字节)</param>
/// <param name="receDataLen">输出数据长度</param>
/// <returns></returns>
int
__stdcall
ReadCard
(
unsigned
int
zone
,
unsigned
int
addr
,
unsigned
int
len
,
char
*
receData
,
unsigned
long
*
receDataLen
)
{
int
ret
=
-
1
;
try
{
// 确认目标DLL
LoadTargetDll
();
ReadCardFunc
_ReadCard
=
(
ReadCardFunc
)
GetProcAddress
(
hDll
,
"ReadCard"
);
if
(
!
_ReadCard
)
{
// 使用 stringstream 构造错误信息
std
::
ostringstream
errorMessage
;
errorMessage
<<
"加载 ReadCard 函数失败,错误代码: "
<<
GetLastError
();
// 记录日志
logger
->
error
(
errorMessage
.
str
());
// 抛出异常并附带错误信息
throw
std
::
runtime_error
(
errorMessage
.
str
());
}
ret
=
_ReadCard
(
zone
,
addr
,
len
,
receData
,
receDataLen
);
}
catch
(
const
std
::
exception
&
ex
)
{
// 使用 stringstream 构造错误信息
std
::
ostringstream
errorMessage
;
// 捕获异常并输出详细错误信息
errorMessage
<<
"VC:ReadCard函数方法发生异常: "
<<
ex
.
what
()
<<
std
::
endl
;
// 记录日志
logger
->
error
(
errorMessage
.
str
());
// 抛出异常并附带错误信息
throw
std
::
runtime_error
(
errorMessage
.
str
());
}
return
ret
;
}
/// <summary>
/// 写入卡片
/// </summary>
/// <param name="zone">指定写入的卡片区域</param>
/// <param name="addr">起始地址</param>
/// <param name="len">要写入的数据长度</param>
/// <param name="sendData">发送数据</param>
/// <param name="receData">输出数据(最多 256 字节)</param>
/// <param name="receDataLen">输出数据长度</param>
/// <returns></returns>
int
__stdcall
WriteCard
(
unsigned
int
zone
,
unsigned
int
addr
,
unsigned
int
len
,
const
char
*
sendData
,
char
*
receData
,
unsigned
long
*
receDataLen
)
{
int
ret
=
-
1
;
try
{
// 确认目标DLL
LoadTargetDll
();
WriteCardFunc
_WriteCard
=
(
WriteCardFunc
)
GetProcAddress
(
hDll
,
"WriteCard"
);
if
(
!
_WriteCard
)
{
// 使用 stringstream 构造错误信息
std
::
ostringstream
errorMessage
;
errorMessage
<<
"加载 WriteCard 函数失败,错误代码: "
<<
GetLastError
();
// 记录日志
logger
->
error
(
errorMessage
.
str
());
// 抛出异常并附带错误信息
throw
std
::
runtime_error
(
errorMessage
.
str
());
}
ret
=
_WriteCard
(
zone
,
addr
,
len
,
sendData
,
receData
,
receDataLen
);
}
catch
(
const
std
::
exception
&
ex
)
{
// 使用 stringstream 构造错误信息
std
::
ostringstream
errorMessage
;
// 捕获异常并输出详细错误信息
errorMessage
<<
"VC:WriteCard函数方法发生异常: "
<<
ex
.
what
()
<<
std
::
endl
;
// 记录日志
logger
->
error
(
errorMessage
.
str
());
// 抛出异常并附带错误信息
throw
std
::
runtime_error
(
errorMessage
.
str
());
}
return
ret
;
}
/// <summary>
/// 校验密钥
/// </summary>
/// <param name="keyType">密钥类别</param>
/// <param name="key">密钥</param>
/// <param name="receData">输出数据(最多 256 字节)</param>
/// <param name="receDataLen">输出数据长度</param>
/// <returns></returns>
int
__stdcall
ChkSecret
(
int
keyType
,
char
*
key
,
char
*
receData
,
unsigned
long
*
receDataLen
)
{
int
ret
=
-
1
;
try
{
// 确认目标DLL
LoadTargetDll
();
ChkSecretFunc
_ChkSecret
=
(
ChkSecretFunc
)
GetProcAddress
(
hDll
,
"ChkSecret"
);
if
(
!
_ChkSecret
)
{
// 使用 stringstream 构造错误信息
std
::
ostringstream
errorMessage
;
errorMessage
<<
"加载 ChkSecret 函数失败,错误代码: "
<<
GetLastError
();
// 记录日志
logger
->
error
(
errorMessage
.
str
());
// 抛出异常并附带错误信息
throw
std
::
runtime_error
(
errorMessage
.
str
());
}
ret
=
_ChkSecret
(
keyType
,
key
,
receData
,
receDataLen
);
}
catch
(
const
std
::
exception
&
ex
)
{
// 使用 stringstream 构造错误信息
std
::
ostringstream
errorMessage
;
// 捕获异常并输出详细错误信息
errorMessage
<<
"VC:ChkSecret函数方法发生异常: "
<<
ex
.
what
()
<<
std
::
endl
;
// 记录日志
logger
->
error
(
errorMessage
.
str
());
// 抛出异常并附带错误信息
throw
std
::
runtime_error
(
errorMessage
.
str
());
}
return
ret
;
}
/// <summary>
/// 写入密钥
/// </summary>
/// <param name="keyType">密钥类别</param>
/// <param name="key">密钥</param>
/// <param name="receData">输出数据(最多 256 字节)</param>
/// <param name="receDataLen">输出数据长度</param>
/// <returns></returns>
int
__stdcall
WriteSecret
(
int
keyType
,
char
*
key
,
char
*
receData
,
unsigned
long
*
receDataLen
)
{
int
ret
=
-
1
;
try
{
// 确认目标DLL
LoadTargetDll
();
WriteSecretFunc
_WriteSecret
=
(
WriteSecretFunc
)
GetProcAddress
(
hDll
,
"WriteSecret"
);
if
(
!
_WriteSecret
)
{
// 使用 stringstream 构造错误信息
std
::
ostringstream
errorMessage
;
errorMessage
<<
"加载 WriteSecret 函数失败,错误代码: "
<<
GetLastError
();
// 记录日志
logger
->
error
(
errorMessage
.
str
());
// 抛出异常并附带错误信息
throw
std
::
runtime_error
(
errorMessage
.
str
());
}
ret
=
_WriteSecret
(
keyType
,
key
,
receData
,
receDataLen
);
}
catch
(
const
std
::
exception
&
ex
)
{
// 使用 stringstream 构造错误信息
std
::
ostringstream
errorMessage
;
// 捕获异常并输出详细错误信息
errorMessage
<<
"VC:WriteSecret函数方法发生异常: "
<<
ex
.
what
()
<<
std
::
endl
;
// 记录日志
logger
->
error
(
errorMessage
.
str
());
// 抛出异常并附带错误信息
throw
std
::
runtime_error
(
errorMessage
.
str
());
}
return
ret
;
}
/// <summary>
/// 读取密钥
/// </summary>
/// <param name="keyType">密钥类别</param>
/// <param name="receData">输出数据(最多 256 字节)</param>
/// <param name="receDataLen">输出数据长度</param>
/// <returns></returns>
int
__stdcall
ReadSecret
(
int
keyType
,
char
*
receData
,
unsigned
long
*
receDataLen
)
{
int
ret
=
-
1
;
try
{
// 确认目标DLL
LoadTargetDll
();
ReadSecretFunc
_ReadSecret
=
(
ReadSecretFunc
)
GetProcAddress
(
hDll
,
"ReadSecret"
);
if
(
!
_ReadSecret
)
{
// 使用 stringstream 构造错误信息
std
::
ostringstream
errorMessage
;
errorMessage
<<
"加载 ReadSecret 函数失败,错误代码: "
<<
GetLastError
();
// 记录日志
logger
->
error
(
errorMessage
.
str
());
// 抛出异常并附带错误信息
throw
std
::
runtime_error
(
errorMessage
.
str
());
}
ret
=
_ReadSecret
(
keyType
,
receData
,
receDataLen
);
}
catch
(
const
std
::
exception
&
ex
)
{
// 使用 stringstream 构造错误信息
std
::
ostringstream
errorMessage
;
// 捕获异常并输出详细错误信息
errorMessage
<<
"VC:ReadSecret函数方法发生异常: "
<<
ex
.
what
()
<<
std
::
endl
;
// 记录日志
logger
->
error
(
errorMessage
.
str
());
// 抛出异常并附带错误信息
throw
std
::
runtime_error
(
errorMessage
.
str
());
}
return
ret
;
}
/// <summary>
/// 将十六进制字符串转换为字节数组
/// </summary>
/// <param name="strData">输入的十六进制字符串数据</param>
/// <param name="data">输出的转换后的字节数组</param>
/// <returns></returns>
int
__stdcall
HexStrToByte
(
const
char
*
strData
,
char
*
byteData
)
{
int
ret
=
-
1
;
try
{
// 确认目标DLL
LoadTargetDll
();
HexStrToByteFunc
_HexStrToByte
=
(
HexStrToByteFunc
)
GetProcAddress
(
hDll
,
"HexStrToByte"
);
if
(
!
_HexStrToByte
)
{
// 使用 stringstream 构造错误信息
std
::
ostringstream
errorMessage
;
errorMessage
<<
"加载 HexStrToByte 函数失败,错误代码: "
<<
GetLastError
();
// 记录日志
logger
->
error
(
errorMessage
.
str
());
// 抛出异常并附带错误信息
throw
std
::
runtime_error
(
errorMessage
.
str
());
}
ret
=
_HexStrToByte
(
strData
,
byteData
);
}
catch
(
const
std
::
exception
&
ex
)
{
// 使用 stringstream 构造错误信息
std
::
ostringstream
errorMessage
;
// 捕获异常并输出详细错误信息
errorMessage
<<
"VC:HexStrToByte函数方法发生异常: "
<<
ex
.
what
()
<<
std
::
endl
;
// 记录日志
logger
->
error
(
errorMessage
.
str
());
// 抛出异常并附带错误信息
throw
std
::
runtime_error
(
errorMessage
.
str
());
}
return
ret
;
}
/// <summary>
/// 字节数组转换为十六进制字符串
/// </summary>
/// <param name="byteData">输入的字节数组</param>
/// <param name="byteDataLen">输入的数组长度</param>
/// <param name="strData">输出的转换后的十六进制字符串</param>
/// <returns></returns>
int
__stdcall
ByteToHexStr
(
char
*
byteData
,
unsigned
int
byteDataLen
,
char
*
strData
)
{
int
ret
=
-
1
;
try
{
// 确认目标DLL
LoadTargetDll
();
ByteToHexStrFunc
_ByteToHexStr
=
(
ByteToHexStrFunc
)
GetProcAddress
(
hDll
,
"ByteToHexStr"
);
if
(
!
_ByteToHexStr
)
{
// 使用 stringstream 构造错误信息
std
::
ostringstream
errorMessage
;
errorMessage
<<
"加载 ByteToHexStr 函数失败,错误代码: "
<<
GetLastError
();
// 记录日志
logger
->
error
(
errorMessage
.
str
());
// 抛出异常并附带错误信息
throw
std
::
runtime_error
(
errorMessage
.
str
());
}
ret
=
_ByteToHexStr
(
byteData
,
byteDataLen
,
strData
);
}
catch
(
const
std
::
exception
&
ex
)
{
// 使用 stringstream 构造错误信息
std
::
ostringstream
errorMessage
;
// 捕获异常并输出详细错误信息
errorMessage
<<
"VC:HexStrToByte函数方法发生异常: "
<<
ex
.
what
()
<<
std
::
endl
;
// 记录日志
logger
->
error
(
errorMessage
.
str
());
// 抛出异常并附带错误信息
throw
std
::
runtime_error
(
errorMessage
.
str
());
}
return
ret
;
}
/// <summary>
/// 将十六进制字节数组转换为十进制数
/// </summary>
/// <param name="byteData">输入的十六进制字符串</param>
/// <param name="dec">输出的转换后的十进制数指针</param>
/// <returns></returns>
int
__stdcall
HexByteToDec
(
const
char
*
byteData
,
unsigned
long
*
dec
)
{
int
ret
=
-
1
;
try
{
// 确认目标DLL
LoadTargetDll
();
HexByteToDecFunc
_HexByteToDec
=
(
HexByteToDecFunc
)
GetProcAddress
(
hDll
,
"HexByteToDec"
);
if
(
!
_HexByteToDec
)
{
// 使用 stringstream 构造错误信息
std
::
ostringstream
errorMessage
;
errorMessage
<<
"加载 HexByteToDec 函数失败,错误代码: "
<<
GetLastError
();
// 记录日志
logger
->
error
(
errorMessage
.
str
());
// 抛出异常并附带错误信息
throw
std
::
runtime_error
(
errorMessage
.
str
());
}
ret
=
_HexByteToDec
(
byteData
,
dec
);
}
catch
(
const
std
::
exception
&
ex
)
{
// 使用 stringstream 构造错误信息
std
::
ostringstream
errorMessage
;
// 捕获异常并输出详细错误信息
errorMessage
<<
"VC:HexByteToDec函数方法发生异常: "
<<
ex
.
what
()
<<
std
::
endl
;
// 记录日志
logger
->
error
(
errorMessage
.
str
());
// 抛出异常并附带错误信息
throw
std
::
runtime_error
(
errorMessage
.
str
());
}
return
ret
;
}
/// <summary>
/// 将十进制数转换为十六进制字节数组
/// </summary>
/// <param name="dec">输入的十进制数</param>
/// <param name="byteData">输出的转换后的十六进制字节数组</param>
/// <returns></returns>
int
__stdcall
DecToHexByte
(
unsigned
long
dec
,
char
*
byteData
)
{
int
ret
=
-
1
;
try
{
// 确认目标DLL
LoadTargetDll
();
DecToHexByteFunc
_DecToHexByte
=
(
DecToHexByteFunc
)
GetProcAddress
(
hDll
,
"DecToHexByte"
);
if
(
!
_DecToHexByte
)
{
// 使用 stringstream 构造错误信息
std
::
ostringstream
errorMessage
;
errorMessage
<<
"加载 DecToHexByte 函数失败,错误代码: "
<<
GetLastError
();
// 记录日志
logger
->
error
(
errorMessage
.
str
());
// 抛出异常并附带错误信息
throw
std
::
runtime_error
(
errorMessage
.
str
());
}
ret
=
_DecToHexByte
(
dec
,
byteData
);
}
catch
(
const
std
::
exception
&
ex
)
{
// 使用 stringstream 构造错误信息
std
::
ostringstream
errorMessage
;
// 捕获异常并输出详细错误信息
errorMessage
<<
"VC:DecToHexByte函数方法发生异常: "
<<
ex
.
what
()
<<
std
::
endl
;
// 记录日志
logger
->
error
(
errorMessage
.
str
());
// 抛出异常并附带错误信息
throw
std
::
runtime_error
(
errorMessage
.
str
());
}
return
ret
;
}
/// <summary>
/// 设置密钥版本
/// </summary>
/// <param name="keyKind">密钥类型</param>
/// <param name="keyVer">密钥版本</param>
/// <param name="receData">输出数据(最多 256 字节)</param>
/// <param name="receDataLen">输出数据长度</param>
/// <returns></returns>
int
__stdcall
SetKeyVersion
(
int
keyKind
,
int
keyVer
,
char
*
receData
,
unsigned
long
*
receDataLen
)
{
int
ret
=
-
1
;
try
{
// 确认目标DLL
LoadTargetDll
();
SetKeyVersionFunc
_SetKeyVersion
=
(
SetKeyVersionFunc
)
GetProcAddress
(
hDll
,
"SetKeyVersion"
);
if
(
!
_SetKeyVersion
)
{
// 使用 stringstream 构造错误信息
std
::
ostringstream
errorMessage
;
errorMessage
<<
"加载 SetKeyVersion 函数失败,错误代码: "
<<
GetLastError
();
// 记录日志
logger
->
error
(
errorMessage
.
str
());
// 抛出异常并附带错误信息
throw
std
::
runtime_error
(
errorMessage
.
str
());
}
ret
=
_SetKeyVersion
(
keyKind
,
keyVer
,
receData
,
receDataLen
);
}
catch
(
const
std
::
exception
&
ex
)
{
// 使用 stringstream 构造错误信息
std
::
ostringstream
errorMessage
;
// 捕获异常并输出详细错误信息
errorMessage
<<
"VC:SetKeyVersion函数方法发生异常: "
<<
ex
.
what
()
<<
std
::
endl
;
// 记录日志
logger
->
error
(
errorMessage
.
str
());
// 抛出异常并附带错误信息
throw
std
::
runtime_error
(
errorMessage
.
str
());
}
return
ret
;
}
/// <summary>
/// 校验1608密钥
/// </summary>
/// <param name="keyNo">密钥编号</param>
/// <param name="receData">输出数据(最多 256 字节)</param>
/// <param name="receDataLen">输出数据长度</param>
/// <returns></returns>
int
__stdcall
Chk1608Secret
(
int
keyNo
,
char
*
receData
,
unsigned
long
*
receDataLen
)
{
int
ret
=
-
1
;
try
{
// 确认目标DLL
LoadTargetDll
();
Chk1608SecretFunc
_Chk1608Secret
=
(
Chk1608SecretFunc
)
GetProcAddress
(
hDll
,
"Chk1608Secret"
);
if
(
!
_Chk1608Secret
)
{
// 使用 stringstream 构造错误信息
std
::
ostringstream
errorMessage
;
errorMessage
<<
"加载 Chk1608Secret 函数失败,错误代码: "
<<
GetLastError
();
// 记录日志
logger
->
error
(
errorMessage
.
str
());
// 抛出异常并附带错误信息
throw
std
::
runtime_error
(
errorMessage
.
str
());
}
ret
=
_Chk1608Secret
(
keyNo
,
receData
,
receDataLen
);
}
catch
(
const
std
::
exception
&
ex
)
{
// 使用 stringstream 构造错误信息
std
::
ostringstream
errorMessage
;
// 捕获异常并输出详细错误信息
errorMessage
<<
"VC:Chk1608Secret函数方法发生异常: "
<<
ex
.
what
()
<<
std
::
endl
;
// 记录日志
logger
->
error
(
errorMessage
.
str
());
// 抛出异常并附带错误信息
throw
std
::
runtime_error
(
errorMessage
.
str
());
}
return
ret
;
}
/// <summary>
/// 认证1608
/// </summary>
/// <param name="receData">输出数据(最多 256 字节)</param>
/// <param name="receDataLen">输出数据长度</param>
/// <returns></returns>
int
__stdcall
Authenfic1608
(
char
*
receData
,
unsigned
long
*
receDataLen
)
{
int
ret
=
-
1
;
try
{
// 确认目标DLL
LoadTargetDll
();
Authenfic1608Func
_Authenfic1608
=
(
Authenfic1608Func
)
GetProcAddress
(
hDll
,
"Authenfic1608"
);
if
(
!
_Authenfic1608
)
{
// 使用 stringstream 构造错误信息
std
::
ostringstream
errorMessage
;
errorMessage
<<
"加载 Authenfic1608 函数失败,错误代码: "
<<
GetLastError
();
// 记录日志
logger
->
error
(
errorMessage
.
str
());
// 抛出异常并附带错误信息
throw
std
::
runtime_error
(
errorMessage
.
str
());
}
ret
=
_Authenfic1608
(
receData
,
receDataLen
);
}
catch
(
const
std
::
exception
&
ex
)
{
// 使用 stringstream 构造错误信息
std
::
ostringstream
errorMessage
;
// 捕获异常并输出详细错误信息
errorMessage
<<
"VC:Authenfic1608函数方法发生异常: "
<<
ex
.
what
()
<<
std
::
endl
;
// 记录日志
logger
->
error
(
errorMessage
.
str
());
// 抛出异常并附带错误信息
throw
std
::
runtime_error
(
errorMessage
.
str
());
}
return
ret
;
}
/// <summary>
/// 将十六进制字符串转换为无符号长整型数值
/// </summary>
/// <param name="byteData">输入的十六进制字节数组</param>
/// <param name="dec">输出的转换后的无符合长整型数</param>
/// <returns></returns>
int
__stdcall
HexByteToLong
(
const
char
*
byteData
,
unsigned
long
*
dec
)
{
int
ret
=
-
1
;
try
{
// 确认目标DLL
LoadTargetDll
();
HexByteToLongFunc
_HexByteToLong
=
(
HexByteToLongFunc
)
GetProcAddress
(
hDll
,
"HexByteToLong"
);
if
(
!
_HexByteToLong
)
{
// 使用 stringstream 构造错误信息
std
::
ostringstream
errorMessage
;
errorMessage
<<
"加载 HexByteToLong 函数失败,错误代码: "
<<
GetLastError
();
// 记录日志
logger
->
error
(
errorMessage
.
str
());
// 抛出异常并附带错误信息
throw
std
::
runtime_error
(
errorMessage
.
str
());
}
ret
=
_HexByteToLong
(
byteData
,
dec
);
}
catch
(
const
std
::
exception
&
ex
)
{
// 使用 stringstream 构造错误信息
std
::
ostringstream
errorMessage
;
// 捕获异常并输出详细错误信息
errorMessage
<<
"VC:HexByteToLong函数方法发生异常: "
<<
ex
.
what
()
<<
std
::
endl
;
// 记录日志
logger
->
error
(
errorMessage
.
str
());
// 抛出异常并附带错误信息
throw
std
::
runtime_error
(
errorMessage
.
str
());
}
return
ret
;
}
/// <summary>
/// 将无符号长整型数值转换为十六进制字节数组
/// </summary>
/// <param name="dec">输入的无符合长整型数</param>
/// <param name="byteData">输出的转换后的十六进制字节数组</param>
/// <returns></returns>
int
__stdcall
LongToHexByte
(
unsigned
long
dec
,
char
*
byteData
)
{
int
ret
=
-
1
;
try
{
// 确认目标DLL
LoadTargetDll
();
LongToHexByteFunc
_LongToHexByte
=
(
LongToHexByteFunc
)
GetProcAddress
(
hDll
,
"LongToHexByte"
);
if
(
!
_LongToHexByte
)
{
// 使用 stringstream 构造错误信息
std
::
ostringstream
errorMessage
;
errorMessage
<<
"加载 LongToHexByte 函数失败,错误代码: "
<<
GetLastError
();
// 记录日志
logger
->
error
(
errorMessage
.
str
());
// 抛出异常并附带错误信息
throw
std
::
runtime_error
(
errorMessage
.
str
());
}
ret
=
_LongToHexByte
(
dec
,
byteData
);
}
catch
(
const
std
::
exception
&
ex
)
{
// 使用 stringstream 构造错误信息
std
::
ostringstream
errorMessage
;
// 捕获异常并输出详细错误信息
errorMessage
<<
"VC:LongToHexByte函数方法发生异常: "
<<
ex
.
what
()
<<
std
::
endl
;
// 记录日志
logger
->
error
(
errorMessage
.
str
());
// 抛出异常并附带错误信息
throw
std
::
runtime_error
(
errorMessage
.
str
());
}
return
ret
;
}
/// <summary>
/// 签名
/// </summary>
/// <param name="idInfo">标识信息</param>
/// <param name="data">输入数据</param>
/// <param name="dataLen">输入数据长度</param>
/// <param name="receData">输出数据(最多 256 字节)</param>
/// <param name="receDataLen">输出数据长度</param>
/// <returns></returns>
int
__stdcall
Signature
(
const
char
*
idInfo
,
const
char
*
data
,
int
dataLen
,
char
*
receData
,
unsigned
long
*
receDataLen
)
{
int
ret
=
-
1
;
try
{
// 确认目标DLL
LoadTargetDll
();
SignatureFunc
_Signature
=
(
SignatureFunc
)
GetProcAddress
(
hDll
,
"Signature"
);
if
(
!
_Signature
)
{
// 使用 stringstream 构造错误信息
std
::
ostringstream
errorMessage
;
errorMessage
<<
"加载 Signature 函数失败,错误代码: "
<<
GetLastError
();
// 记录日志
logger
->
error
(
errorMessage
.
str
());
// 抛出异常并附带错误信息
throw
std
::
runtime_error
(
errorMessage
.
str
());
}
ret
=
_Signature
(
idInfo
,
data
,
dataLen
,
receData
,
receDataLen
);
}
catch
(
const
std
::
exception
&
ex
)
{
// 使用 stringstream 构造错误信息
std
::
ostringstream
errorMessage
;
// 捕获异常并输出详细错误信息
errorMessage
<<
"VC:Signature函数方法发生异常: "
<<
ex
.
what
()
<<
std
::
endl
;
// 记录日志
logger
->
error
(
errorMessage
.
str
());
// 抛出异常并附带错误信息
throw
std
::
runtime_error
(
errorMessage
.
str
());
}
return
ret
;
}
/// <summary>
/// 验证签名
/// </summary>
/// <param name="idInfo">标识信息</param>
/// <param name="data">输入数据</param>
/// <param name="dataLen">输入数据长度</param>
/// <param name="signInfo">签名信息</param>
/// <param name="receData">输出数据(最多 256 字节)</param>
/// <param name="receDataLen">输出数据长度</param>
/// <returns></returns>
int
__stdcall
VerifySignet
(
const
char
*
idInfo
,
const
char
*
data
,
int
dataLen
,
const
char
*
signInfo
,
char
*
receData
,
unsigned
long
*
receDataLen
)
{
int
ret
=
-
1
;
try
{
// 确认目标DLL
LoadTargetDll
();
VerifySignetFunc
_VerifySignet
=
(
VerifySignetFunc
)
GetProcAddress
(
hDll
,
"VerifySignet"
);
if
(
!
_VerifySignet
)
{
// 使用 stringstream 构造错误信息
std
::
ostringstream
errorMessage
;
errorMessage
<<
"加载 VerifySignet 函数失败,错误代码: "
<<
GetLastError
();
// 记录日志
logger
->
error
(
errorMessage
.
str
());
// 抛出异常并附带错误信息
throw
std
::
runtime_error
(
errorMessage
.
str
());
}
ret
=
_VerifySignet
(
idInfo
,
data
,
dataLen
,
signInfo
,
receData
,
receDataLen
);
}
catch
(
const
std
::
exception
&
ex
)
{
// 使用 stringstream 构造错误信息
std
::
ostringstream
errorMessage
;
// 捕获异常并输出详细错误信息
errorMessage
<<
"VC:VerifySignet函数方法发生异常: "
<<
ex
.
what
()
<<
std
::
endl
;
// 记录日志
logger
->
error
(
errorMessage
.
str
());
// 抛出异常并附带错误信息
throw
std
::
runtime_error
(
errorMessage
.
str
());
}
return
ret
;
}
/// <summary>
/// 写入标识信息
/// </summary>
/// <param name="idInfo">标识信息</param>
/// <param name="receData">输出数据(最多 256 字节)</param>
/// <param name="receDataLen">输出数据长度</param>
/// <returns></returns>
int
__stdcall
WriteIDInfo
(
const
char
*
idInfo
,
char
*
receData
,
unsigned
long
*
receDataLen
)
{
int
ret
=
-
1
;
try
{
// 确认目标DLL
LoadTargetDll
();
WriteIDInfoFunc
_WriteIDInfo
=
(
WriteIDInfoFunc
)
GetProcAddress
(
hDll
,
"WriteIDInfo"
);
if
(
!
_WriteIDInfo
)
{
// 使用 stringstream 构造错误信息
std
::
ostringstream
errorMessage
;
errorMessage
<<
"加载 WriteIDInfo 函数失败,错误代码: "
<<
GetLastError
();
// 记录日志
logger
->
error
(
errorMessage
.
str
());
// 抛出异常并附带错误信息
throw
std
::
runtime_error
(
errorMessage
.
str
());
}
ret
=
_WriteIDInfo
(
idInfo
,
receData
,
receDataLen
);
}
catch
(
const
std
::
exception
&
ex
)
{
// 使用 stringstream 构造错误信息
std
::
ostringstream
errorMessage
;
// 捕获异常并输出详细错误信息
errorMessage
<<
"VC:WriteIDInfo函数方法发生异常: "
<<
ex
.
what
()
<<
std
::
endl
;
// 记录日志
logger
->
error
(
errorMessage
.
str
());
// 抛出异常并附带错误信息
throw
std
::
runtime_error
(
errorMessage
.
str
());
}
return
ret
;
}
/// <summary>
/// PIN操作函数
/// </summary>
/// <param name="iopType">操作类型</param>
/// <param name="slot">目标设备插槽</param>
/// <param name="pinData">输入的 PIN 数据</param>
/// <param name="pinDataLen">输入的 PIN 数据长度</param>
/// <param name="receData">输出数据(最多 256 字节)</param>
/// <param name="receDataLen">输出数据长度</param>
/// <returns></returns>
int
__stdcall
PINOpfunc
(
int
iopType
,
int
slot
,
const
char
*
pinData
,
int
pinDataLen
,
char
*
receData
,
unsigned
long
*
receDataLen
)
{
int
ret
=
-
1
;
try
{
// 确认目标DLL
LoadTargetDll
();
PINOpfuncFunc
_PINOpfunc
=
(
PINOpfuncFunc
)
GetProcAddress
(
hDll
,
"PINOpfunc"
);
if
(
!
_PINOpfunc
)
{
// 使用 stringstream 构造错误信息
std
::
ostringstream
errorMessage
;
errorMessage
<<
"加载 PINOpfunc 函数失败,错误代码: "
<<
GetLastError
();
// 记录日志
logger
->
error
(
errorMessage
.
str
());
// 抛出异常并附带错误信息
throw
std
::
runtime_error
(
errorMessage
.
str
());
}
ret
=
_PINOpfunc
(
iopType
,
slot
,
pinData
,
pinDataLen
,
receData
,
receDataLen
);
}
catch
(
const
std
::
exception
&
ex
)
{
// 使用 stringstream 构造错误信息
std
::
ostringstream
errorMessage
;
// 捕获异常并输出详细错误信息
errorMessage
<<
"VC:PINOpfunc函数方法发生异常: "
<<
ex
.
what
()
<<
std
::
endl
;
// 记录日志
logger
->
error
(
errorMessage
.
str
());
// 抛出异常并附带错误信息
throw
std
::
runtime_error
(
errorMessage
.
str
());
}
return
ret
;
}
/// <summary>
/// 更新标识信息
/// </summary>
/// <param name="idInfo">标识信息</param>
/// <param name="receData">输出数据(最多 256 字节)</param>
/// <param name="receDataLen">输出数据长度</param>
/// <returns></returns>
int
__stdcall
UpdateIDInfo
(
const
char
*
idInfo
,
char
*
receData
,
unsigned
long
*
receDataLen
)
{
int
ret
=
-
1
;
try
{
// 确认目标DLL
LoadTargetDll
();
UpdateIDInfoFunc
_UpdateIDInfo
=
(
UpdateIDInfoFunc
)
GetProcAddress
(
hDll
,
"UpdateIDInfo"
);
if
(
!
_UpdateIDInfo
)
{
// 使用 stringstream 构造错误信息
std
::
ostringstream
errorMessage
;
errorMessage
<<
"加载 UpdateIDInfo 函数失败,错误代码: "
<<
GetLastError
();
// 记录日志
logger
->
error
(
errorMessage
.
str
());
// 抛出异常并附带错误信息
throw
std
::
runtime_error
(
errorMessage
.
str
());
}
ret
=
_UpdateIDInfo
(
idInfo
,
receData
,
receDataLen
);
}
catch
(
const
std
::
exception
&
ex
)
{
// 使用 stringstream 构造错误信息
std
::
ostringstream
errorMessage
;
// 捕获异常并输出详细错误信息
errorMessage
<<
"VC:UpdateIDInfo函数方法发生异常: "
<<
ex
.
what
()
<<
std
::
endl
;
// 记录日志
logger
->
error
(
errorMessage
.
str
());
// 抛出异常并附带错误信息
throw
std
::
runtime_error
(
errorMessage
.
str
());
}
return
ret
;
}
/// <summary>
/// 锁定用户卡
/// </summary>
/// <param name="receData">输出数据(最多 256 字节)</param>
/// <param name="receDataLen">输出数据长度</param>
/// <returns></returns>
int
__stdcall
LockUserCard
(
char
*
receData
,
unsigned
long
*
receDataLen
)
{
int
ret
=
-
1
;
try
{
// 确认目标DLL
LoadTargetDll
();
LockUserCardFunc
_LockUserCard
=
(
LockUserCardFunc
)
GetProcAddress
(
hDll
,
"LockUserCard"
);
if
(
!
_LockUserCard
)
{
// 使用 stringstream 构造错误信息
std
::
ostringstream
errorMessage
;
errorMessage
<<
"加载 LockUserCard 函数失败,错误代码: "
<<
GetLastError
();
// 记录日志
logger
->
error
(
errorMessage
.
str
());
// 抛出异常并附带错误信息
throw
std
::
runtime_error
(
errorMessage
.
str
());
}
ret
=
_LockUserCard
(
receData
,
receDataLen
);
}
catch
(
const
std
::
exception
&
ex
)
{
// 使用 stringstream 构造错误信息
std
::
ostringstream
errorMessage
;
// 捕获异常并输出详细错误信息
errorMessage
<<
"VC:LockUserCard函数方法发生异常: "
<<
ex
.
what
()
<<
std
::
endl
;
// 记录日志
logger
->
error
(
errorMessage
.
str
());
// 抛出异常并附带错误信息
throw
std
::
runtime_error
(
errorMessage
.
str
());
}
return
ret
;
}
/// <summary>
/// 读取 SAM 标识信息
/// </summary>
/// <param name="receData">输出数据(最多 256 字节)</param>
/// <param name="receDataLen">输出数据长度</param>
/// <returns></returns>
int
__stdcall
ReadSamIDInfo
(
char
*
receData
,
unsigned
long
*
receDataLen
)
{
int
ret
=
-
1
;
try
{
// 确认目标DLL
LoadTargetDll
();
ReadSamIDInfoFunc
_ReadSamIDInfo
=
(
ReadSamIDInfoFunc
)
GetProcAddress
(
hDll
,
"ReadSamIDInfo"
);
if
(
!
_ReadSamIDInfo
)
{
// 使用 stringstream 构造错误信息
std
::
ostringstream
errorMessage
;
errorMessage
<<
"加载 ReadSamIDInfo 函数失败,错误代码: "
<<
GetLastError
();
// 记录日志
logger
->
error
(
errorMessage
.
str
());
// 抛出异常并附带错误信息
throw
std
::
runtime_error
(
errorMessage
.
str
());
}
ret
=
_ReadSamIDInfo
(
receData
,
receDataLen
);
}
catch
(
const
std
::
exception
&
ex
)
{
// 使用 stringstream 构造错误信息
std
::
ostringstream
errorMessage
;
// 捕获异常并输出详细错误信息
errorMessage
<<
"VC:ReadSamIDInfo函数方法发生异常: "
<<
ex
.
what
()
<<
std
::
endl
;
// 记录日志
logger
->
error
(
errorMessage
.
str
());
// 抛出异常并附带错误信息
throw
std
::
runtime_error
(
errorMessage
.
str
());
}
return
ret
;
}
/// <summary>
/// 获取IC卡片号
/// </summary>
/// <param name="slot">目标插槽</param>
/// <param name="receData">输出数据(最多 256 字节)</param>
/// <param name="receDataLen">输出数据长度</param>
/// <returns></returns>
int
__stdcall
GetICCardNo
(
int
slot
,
char
*
receData
,
unsigned
long
*
receDataLen
)
{
int
ret
=
-
1
;
try
{
// 确认目标DLL
LoadTargetDll
();
GetICCardNoFunc
_GetICCardNo
=
(
GetICCardNoFunc
)
GetProcAddress
(
hDll
,
"GetICCardNo"
);
if
(
!
_GetICCardNo
)
{
// 使用 stringstream 构造错误信息
std
::
ostringstream
errorMessage
;
errorMessage
<<
"加载 GetICCardNo 函数失败,错误代码: "
<<
GetLastError
();
// 记录日志
logger
->
error
(
errorMessage
.
str
());
// 抛出异常并附带错误信息
throw
std
::
runtime_error
(
errorMessage
.
str
());
}
ret
=
_GetICCardNo
(
slot
,
receData
,
receDataLen
);
}
catch
(
const
std
::
exception
&
ex
)
{
// 使用 stringstream 构造错误信息
std
::
ostringstream
errorMessage
;
// 捕获异常并输出详细错误信息
errorMessage
<<
"VC:GetICCardNo函数方法发生异常: "
<<
ex
.
what
()
<<
std
::
endl
;
// 记录日志
logger
->
error
(
errorMessage
.
str
());
// 抛出异常并附带错误信息
throw
std
::
runtime_error
(
errorMessage
.
str
());
}
return
ret
;
}
/// <summary>
/// SAM卡上电
/// </summary>
/// <param name="receData">输出数据(最多 256 字节)</param>
/// <param name="receDataLen">输出数据长度</param>
/// <returns></returns>
int
__stdcall
PowerOnSam
(
char
*
receData
,
unsigned
long
*
receDataLen
)
{
int
ret
=
-
1
;
try
{
// 确认目标DLL
LoadTargetDll
();
PowerOnSamFunc
_PowerOnSam
=
(
PowerOnSamFunc
)
GetProcAddress
(
hDll
,
"PowerOnSam"
);
if
(
!
_PowerOnSam
)
{
// 使用 stringstream 构造错误信息
std
::
ostringstream
errorMessage
;
errorMessage
<<
"加载 PowerOnSam 函数失败,错误代码: "
<<
GetLastError
();
// 记录日志
logger
->
error
(
errorMessage
.
str
());
// 抛出异常并附带错误信息
throw
std
::
runtime_error
(
errorMessage
.
str
());
}
ret
=
_PowerOnSam
(
receData
,
receDataLen
);
}
catch
(
const
std
::
exception
&
ex
)
{
// 使用 stringstream 构造错误信息
std
::
ostringstream
errorMessage
;
// 捕获异常并输出详细错误信息
errorMessage
<<
"VC:PowerOnSam函数方法发生异常: "
<<
ex
.
what
()
<<
std
::
endl
;
// 记录日志
logger
->
error
(
errorMessage
.
str
());
// 抛出异常并附带错误信息
throw
std
::
runtime_error
(
errorMessage
.
str
());
}
return
ret
;
}
/// <summary>
/// GetUpdateIDRight函数
/// </summary>
/// <param name="icCardNo">IC卡号</param>
/// <param name="hospitalId">医院</param>
/// <param name="receData">输出数据(最多 256 字节)</param>
/// <param name="receDataLen">输出数据长度</param>
/// <returns></returns>
int
__stdcall
GetUpdateIDRight
(
const
char
*
icCardNo
,
const
char
*
hospital
,
char
*
receData
,
unsigned
long
*
receDataLen
)
{
int
ret
=
-
1
;
try
{
// 确认目标DLL
LoadTargetDll
();
GetUpdateIDRightFunc
_GetUpdateIDRight
=
(
GetUpdateIDRightFunc
)
GetProcAddress
(
hDll
,
"GetUpdateIDRight"
);
if
(
!
_GetUpdateIDRight
)
{
// 使用 stringstream 构造错误信息
std
::
ostringstream
errorMessage
;
errorMessage
<<
"加载 GetUpdateIDRight 函数失败,错误代码: "
<<
GetLastError
();
// 记录日志
logger
->
error
(
errorMessage
.
str
());
// 抛出异常并附带错误信息
throw
std
::
runtime_error
(
errorMessage
.
str
());
}
ret
=
_GetUpdateIDRight
(
icCardNo
,
hospital
,
receData
,
receDataLen
);
}
catch
(
const
std
::
exception
&
ex
)
{
// 使用 stringstream 构造错误信息
std
::
ostringstream
errorMessage
;
// 捕获异常并输出详细错误信息
errorMessage
<<
"VC:GetUpdateIDRight函数方法发生异常: "
<<
ex
.
what
()
<<
std
::
endl
;
// 记录日志
logger
->
error
(
errorMessage
.
str
());
// 抛出异常并附带错误信息
throw
std
::
runtime_error
(
errorMessage
.
str
());
}
return
ret
;
}
\ No newline at end of file
RowinSelf.MilitarySecurity/RW_VC_MMSC/wrapper.h
0 → 100644
View file @
6d9d8714
#pragma once
#ifndef WRAPPER_DLL_H
#define WRAPPER_DLL_H
//而这一部分就是告诉编译器,如果定义了__cplusplus(即如果是cpp文件,
#ifdef __cplusplus
//因为cpp文件默认定义了该宏),则采用C语言方式进行编译
extern
"C"
{
#endif
#ifdef WRAPPER_DLL_EXPORTS
#define WRAPPER_API __declspec(dllexport) // 导出宏
#else
#define WRAPPER_API __declspec(dllimport) // 导入宏
#endif
/// <summary>
/// 释放目标DLL文件
/// </summary>
WRAPPER_API
void
__stdcall
UnloadTargetDll
();
/// <summary>
/// 打开设备通讯
/// </summary>
/// <param name="devPort">设备端口</param>
/// <returns></returns>
WRAPPER_API
int
__stdcall
OpenComm
(
const
char
*
devPort
);
/// <summary>
/// 关闭设备通讯
/// </summary>
/// <returns></returns>
WRAPPER_API
int
__stdcall
CloseComm
();
/// <summary>
/// IC卡片上电
/// </summary>
/// <param name="receData">输出数据(最多 256 字节)</param>
/// <param name="receDataLen">输出数据长度</param>
/// <returns></returns>
WRAPPER_API
int
__stdcall
PowerOn
(
char
*
receData
,
unsigned
long
*
receDataLen
);
/// <summary>
/// IC卡片下电
/// </summary>
/// <param name="receData">输出数据(最多 256 字节)</param>
/// <param name="receDataLen">输出数据长度</param>
/// <returns></returns>
WRAPPER_API
int
__stdcall
PowerOff
(
char
*
receData
,
unsigned
long
*
receDataLen
);
/// <summary>
/// 读取卡片
/// </summary>
/// <param name="zone">指定读取的卡片区域</param>
/// <param name="addr">起始地址</param>
/// <param name="len">要读取的数据长度</param>
/// <param name="receData">输出数据(最多 256 字节)</param>
/// <param name="receDataLen">输出数据长度</param>
/// <returns></returns>
WRAPPER_API
int
__stdcall
ReadCard
(
unsigned
int
zone
,
unsigned
int
addr
,
unsigned
int
len
,
char
*
receData
,
unsigned
long
*
receDataLen
);
/// <summary>
/// 写入卡片
/// </summary>
/// <param name="zone">指定写入的卡片区域</param>
/// <param name="addr">起始地址</param>
/// <param name="len">要写入的数据长度</param>
/// <param name="sendData">发送数据</param>
/// <param name="receData">输出数据(最多 256 字节)</param>
/// <param name="receDataLen">输出数据长度</param>
/// <returns></returns>
WRAPPER_API
int
__stdcall
WriteCard
(
unsigned
int
zone
,
unsigned
int
addr
,
unsigned
int
len
,
const
char
*
sendData
,
char
*
receData
,
unsigned
long
*
receDataLen
);
/// <summary>
/// 校验密钥
/// </summary>
/// <param name="keyType">密钥类别</param>
/// <param name="key">密钥</param>
/// <param name="receData">输出数据(最多 256 字节)</param>
/// <param name="receDataLen">输出数据长度</param>
/// <returns></returns>
WRAPPER_API
int
__stdcall
ChkSecret
(
int
keyType
,
char
*
key
,
char
*
receData
,
unsigned
long
*
receDataLen
);
/// <summary>
/// 写入密钥
/// </summary>
/// <param name="keyType">密钥类别</param>
/// <param name="key">密钥</param>
/// <param name="receData">输出数据(最多 256 字节)</param>
/// <param name="receDataLen">输出数据长度</param>
/// <returns></returns>
WRAPPER_API
int
__stdcall
WriteSecret
(
int
keyType
,
char
*
key
,
char
*
receData
,
unsigned
long
*
receDataLen
);
/// <summary>
/// 读取密钥
/// </summary>
/// <param name="keyType">密钥类别</param>
/// <param name="receData">输出数据(最多 256 字节)</param>
/// <param name="receDataLen">输出数据长度</param>
/// <returns></returns>
WRAPPER_API
int
__stdcall
ReadSecret
(
int
keyType
,
char
*
receData
,
unsigned
long
*
receDataLen
);
/// <summary>
/// 将十六进制字符串转换为字节数组
/// </summary>
/// <param name="strData">输入的十六进制字符串数据</param>
/// <param name="data">输出的转换后的字节数组</param>
/// <returns></returns>
WRAPPER_API
int
__stdcall
HexStrToByte
(
const
char
*
strData
,
char
*
byteData
);
/// <summary>
/// 字节数组转换为十六进制字符串
/// </summary>
/// <param name="byteData">输入的字节数组</param>
/// <param name="byteDataLen">输入的数组长度</param>
/// <param name="strData">输出的转换后的十六进制字符串</param>
/// <returns></returns>
WRAPPER_API
int
__stdcall
ByteToHexStr
(
char
*
byteData
,
unsigned
int
byteDataLen
,
char
*
strData
);
/// <summary>
/// 将十六进制字节数组转换为十进制数
/// </summary>
/// <param name="byteData">输入的十六进制字符串</param>
/// <param name="dec">输出的转换后的十进制数指针</param>
/// <returns></returns>
WRAPPER_API
int
__stdcall
HexByteToDec
(
const
char
*
byteData
,
unsigned
long
*
dec
);
/// <summary>
/// 将十进制数转换为十六进制字节数组
/// </summary>
/// <param name="dec">输入的十进制数</param>
/// <param name="byteData">输出的转换后的十六进制字节数组</param>
/// <returns></returns>
WRAPPER_API
int
__stdcall
DecToHexByte
(
unsigned
long
dec
,
char
*
byteData
);
/// <summary>
/// 设置密钥版本
/// </summary>
/// <param name="keyKind">密钥类型</param>
/// <param name="keyVer">密钥版本</param>
/// <param name="receData">输出数据(最多 256 字节)</param>
/// <param name="receDataLen">输出数据长度</param>
/// <returns></returns>
WRAPPER_API
int
__stdcall
SetKeyVersion
(
int
keyKind
,
int
keyVer
,
char
*
receData
,
unsigned
long
*
receDataLen
);
/// <summary>
/// 校验1608密钥
/// </summary>
/// <param name="keyNo">密钥编号</param>
/// <param name="receData">输出数据(最多 256 字节)</param>
/// <param name="receDataLen">输出数据长度</param>
/// <returns></returns>
WRAPPER_API
int
__stdcall
Chk1608Secret
(
int
keyNo
,
char
*
receData
,
unsigned
long
*
receDataLen
);
/// <summary>
/// 认证1608
/// </summary>
/// <param name="receData">输出数据(最多 256 字节)</param>
/// <param name="receDataLen">输出数据长度</param>
/// <returns></returns>
WRAPPER_API
int
__stdcall
Authenfic1608
(
char
*
receData
,
unsigned
long
*
receDataLen
);
/// <summary>
/// 将十六进制字符串转换为无符号长整型数值
/// </summary>
/// <param name="byteData">输入的十六进制字节数组</param>
/// <param name="dec">输出的转换后的无符合长整型数</param>
/// <returns></returns>
WRAPPER_API
int
__stdcall
HexByteToLong
(
const
char
*
byteData
,
unsigned
long
*
dec
);
/// <summary>
/// 将无符号长整型数值转换为十六进制字节数组
/// </summary>
/// <param name="dec">输入的无符合长整型数</param>
/// <param name="byteData">输出的转换后的十六进制字节数组</param>
/// <returns></returns>
WRAPPER_API
int
__stdcall
LongToHexByte
(
unsigned
long
dec
,
char
*
byteData
);
/// <summary>
/// 签名
/// </summary>
/// <param name="idInfo">标识信息</param>
/// <param name="data">输入数据</param>
/// <param name="dataLen">输入数据长度</param>
/// <param name="receData">输出数据(最多 256 字节)</param>
/// <param name="receDataLen">输出数据长度</param>
/// <returns></returns>
WRAPPER_API
int
__stdcall
Signature
(
const
char
*
idInfo
,
const
char
*
data
,
int
dataLen
,
char
*
receData
,
unsigned
long
*
receDataLen
);
/// <summary>
/// 验证签名
/// </summary>
/// <param name="idInfo">标识信息</param>
/// <param name="data">输入数据</param>
/// <param name="dataLen">输入数据长度</param>
/// <param name="signInfo">签名信息</param>
/// <param name="receData">输出数据(最多 256 字节)</param>
/// <param name="receDataLen">输出数据长度</param>
/// <returns></returns>
WRAPPER_API
int
__stdcall
VerifySignet
(
const
char
*
idInfo
,
const
char
*
data
,
int
dataLen
,
const
char
*
signInfo
,
char
*
receData
,
unsigned
long
*
receDataLen
);
/// <summary>
/// 写入标识信息
/// </summary>
/// <param name="idInfo">标识信息</param>
/// <param name="receData">输出数据(最多 256 字节)</param>
/// <param name="receDataLen">输出数据长度</param>
/// <returns></returns>
WRAPPER_API
int
__stdcall
WriteIDInfo
(
const
char
*
idInfo
,
char
*
receData
,
unsigned
long
*
receDataLen
);
/// <summary>
/// PIN操作函数
/// </summary>
/// <param name="iopType">操作类型</param>
/// <param name="slot">目标设备插槽</param>
/// <param name="pinData">输入的 PIN 数据</param>
/// <param name="pinDataLen">输入的 PIN 数据长度</param>
/// <param name="receData">输出数据(最多 256 字节)</param>
/// <param name="receDataLen">输出数据长度</param>
/// <returns></returns>
WRAPPER_API
int
__stdcall
PINOpfunc
(
int
iopType
,
int
slot
,
const
char
*
pinData
,
int
pinDataLen
,
char
*
receData
,
unsigned
long
*
receDataLen
);
/// <summary>
/// 更新标识信息
/// </summary>
/// <param name="idInfo">标识信息</param>
/// <param name="receData">输出数据(最多 256 字节)</param>
/// <param name="receDataLen">输出数据长度</param>
/// <returns></returns>
WRAPPER_API
int
__stdcall
UpdateIDInfo
(
const
char
*
idInfo
,
char
*
receData
,
unsigned
long
*
receDataLen
);
/// <summary>
/// 锁定用户卡
/// </summary>
/// <param name="receData">输出数据(最多 256 字节)</param>
/// <param name="receDataLen">输出数据长度</param>
/// <returns></returns>
WRAPPER_API
int
__stdcall
LockUserCard
(
char
*
receData
,
unsigned
long
*
receDataLen
);
/// <summary>
/// 读取 SAM 标识信息
/// </summary>
/// <param name="receData">输出数据(最多 256 字节)</param>
/// <param name="receDataLen">输出数据长度</param>
/// <returns></returns>
WRAPPER_API
int
__stdcall
ReadSamIDInfo
(
char
*
receData
,
unsigned
long
*
receDataLen
);
/// <summary>
/// 获取IC卡片号
/// </summary>
/// <param name="slot">目标插槽</param>
/// <param name="receData">输出数据(最多 256 字节)</param>
/// <param name="receDataLen">输出数据长度</param>
/// <returns></returns>
WRAPPER_API
int
__stdcall
GetICCardNo
(
int
slot
,
char
*
receData
,
unsigned
long
*
receDataLen
);
/// <summary>
/// SAM卡上电
/// </summary>
/// <param name="receData">输出数据(最多 256 字节)</param>
/// <param name="receDataLen">输出数据长度</param>
/// <returns></returns>
WRAPPER_API
int
__stdcall
PowerOnSam
(
char
*
receData
,
unsigned
long
*
receDataLen
);
/// <summary>
/// GetUpdateIDRight函数
/// </summary>
/// <param name="icCardNo">IC卡号</param>
/// <param name="hospitalId">医院</param>
/// <param name="receData">输出数据(最多 256 字节)</param>
/// <param name="receDataLen">输出数据长度</param>
/// <returns></returns>
WRAPPER_API
int
__stdcall
GetUpdateIDRight
(
const
char
*
icCardNo
,
const
char
*
hospital
,
char
*
receData
,
unsigned
long
*
receDataLen
);
#ifdef __cplusplus
}
#endif
#endif // !WRAPPER_DLL_H
RowinSelf.MilitarySecurity/RowinSelf.MilitarySecurity.sln
0 → 100644
View file @
6d9d8714
Microsoft Visual Studio Solution File, Format Version 12.00
# Visual Studio Version 17
VisualStudioVersion = 17.12.35514.174 d17.12
MinimumVisualStudioVersion = 10.0.40219.1
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "RW_VC_MMSC", "RW_VC_MMSC\RW_VC_MMSC.vcxproj", "{4232629B-556E-423F-B8CB-E12E86EA26F4}"
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
{4232629B-556E-423F-B8CB-E12E86EA26F4}.Debug|x64.ActiveCfg = Debug|x64
{4232629B-556E-423F-B8CB-E12E86EA26F4}.Debug|x64.Build.0 = Debug|x64
{4232629B-556E-423F-B8CB-E12E86EA26F4}.Debug|x86.ActiveCfg = Debug|Win32
{4232629B-556E-423F-B8CB-E12E86EA26F4}.Debug|x86.Build.0 = Debug|Win32
{4232629B-556E-423F-B8CB-E12E86EA26F4}.Release|x64.ActiveCfg = Release|x64
{4232629B-556E-423F-B8CB-E12E86EA26F4}.Release|x64.Build.0 = Release|x64
{4232629B-556E-423F-B8CB-E12E86EA26F4}.Release|x86.ActiveCfg = Release|Win32
{4232629B-556E-423F-B8CB-E12E86EA26F4}.Release|x86.Build.0 = Release|Win32
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment