From d0174b82a4f7265d27a79257e671af0c8948e0f4 Mon Sep 17 00:00:00 2001 From: gb <741021719@qq.com> Date: Fri, 20 Oct 2023 11:06:30 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=8D=A2sane/scanner/lang=E4=B8=89?= =?UTF-8?q?=E4=B8=AA=E6=A8=A1=E5=9D=97=E5=90=8D=E7=A7=B0=EF=BC=8C=E9=81=BF?= =?UTF-8?q?=E5=85=8D=E4=B8=8E=E7=AC=AC=E4=B8=89=E6=96=B9APP=E6=A8=A1?= =?UTF-8?q?=E5=9D=97=E5=90=8D=E7=A7=B0=E5=86=B2=E7=AA=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- build_base.bat | 18 ++++++++--------- device/device.def | 2 +- device/resource.h | 7 ++++--- device/scanner.vcxproj.user | 7 ------- device/{scanner.rc => scannerqd.rc} | 4 ++-- device/{scanner.vcxproj => scannerqd.vcxproj} | 7 ++++--- ...proj.filters => scannerqd.vcxproj.filters} | 2 +- lang/{lang.def => yuyanbao.def} | 2 +- lang/{lang.vcxproj => yuyanbao.vcxproj} | 20 +++++++++---------- ...xproj.filters => yuyanbao.vcxproj.filters} | 2 +- sane/resource.h | 2 +- sane/sane.vcxproj.user | 4 ---- sane/{sane.def => sanexy.def} | 0 sane/{sane.rc => sanexy.rc} | 4 ++-- sane/{sane.vcxproj => sanexy.vcxproj} | 19 +++++++++--------- ...vcxproj.filters => sanexy.vcxproj.filters} | 4 ++-- sln/hgscanner.sln | 15 +++++++++++--- sln/movlib.bat | 12 +++++++++++ twain/load_sane.cpp | 2 +- twain/twain/huagaods.cpp | 16 +++++++++++++++ 20 files changed, 89 insertions(+), 60 deletions(-) delete mode 100644 device/scanner.vcxproj.user rename device/{scanner.rc => scannerqd.rc} (95%) rename device/{scanner.vcxproj => scannerqd.vcxproj} (99%) rename device/{scanner.vcxproj.filters => scannerqd.vcxproj.filters} (99%) rename lang/{lang.def => yuyanbao.def} (94%) rename lang/{lang.vcxproj => yuyanbao.vcxproj} (94%) rename lang/{lang.vcxproj.filters => yuyanbao.vcxproj.filters} (97%) delete mode 100644 sane/sane.vcxproj.user rename sane/{sane.def => sanexy.def} (100%) rename sane/{sane.rc => sanexy.rc} (99%) rename sane/{sane.vcxproj => sanexy.vcxproj} (95%) rename sane/{sane.vcxproj.filters => sanexy.vcxproj.filters} (98%) create mode 100644 sln/movlib.bat diff --git a/build_base.bat b/build_base.bat index 6f27143..1f55f27 100644 --- a/build_base.bat +++ b/build_base.bat @@ -100,18 +100,18 @@ rem ---------------------------------------------------------------------------- mkdir %LIB_PATH% mkdir %COMMON_LIB_PATH% -MSBuild.exe "%~dp0\lang\lang.vcxproj" /p:Configuration=Release /p:Platform=%CPU% /p:IntDir=%TMP_PATH%\lang\ /p:OutDir=%BIN_PATH%\ +MSBuild.exe "%~dp0\lang\yuyanbao.vcxproj" /p:Configuration=Release /p:Platform=%CPU% /p:IntDir=%TMP_PATH%\lang\ /p:OutDir=%BIN_PATH%\ if %ERRORLEVEL% neq 0 goto end -call :move_libs %BIN_PATH% lang %LIB_PATH% -copy /y %LIB_PATH%\lang.lib %COMMON_LIB_PATH% -MSBuild.exe "%~dp0\device\scanner.vcxproj" /p:Configuration=Release /p:Platform=%CPU% /p:IntDir=%TMP_PATH%\scanner\ /p:OutDir=%BIN_PATH%\ +call :move_libs %BIN_PATH% yuyanbao %LIB_PATH% +copy /y %LIB_PATH%\yuyanbao.lib %COMMON_LIB_PATH% +MSBuild.exe "%~dp0\device\scannerqd.vcxproj" /p:Configuration=Release /p:Platform=%CPU% /p:IntDir=%TMP_PATH%\scanner\ /p:OutDir=%BIN_PATH%\ if %ERRORLEVEL% neq 0 goto end -call :move_libs %BIN_PATH% scanner %LIB_PATH% -copy /y %LIB_PATH%\scanner.lib %COMMON_LIB_PATH% -MSBuild.exe "%~dp0\sane\sane.vcxproj" /p:Configuration=Release /p:Platform=%CPU% /p:IntDir=%TMP_PATH%\sane\ /p:OutDir=%BIN_PATH%\ +call :move_libs %BIN_PATH% scannerqd %LIB_PATH% +copy /y %LIB_PATH%\scannerqd.lib %COMMON_LIB_PATH% +MSBuild.exe "%~dp0\sane\sanexy.vcxproj" /p:Configuration=Release /p:Platform=%CPU% /p:IntDir=%TMP_PATH%\sane\ /p:OutDir=%BIN_PATH%\ if %ERRORLEVEL% neq 0 goto end -call :move_libs %BIN_PATH% sane %LIB_PATH% -copy /y %LIB_PATH%\sane.lib %COMMON_LIB_PATH% +call :move_libs %BIN_PATH% sanexy %LIB_PATH% +copy /y %LIB_PATH%\sanexy.lib %COMMON_LIB_PATH% goto end REM move_libs src_dir src_name dst_dir diff --git a/device/device.def b/device/device.def index 08c38d1..d38e125 100644 --- a/device/device.def +++ b/device/device.def @@ -1,4 +1,4 @@ -LIBRARY scanner +LIBRARY scannerqd EXPORTS hg_scanner_initialize hg_scanner_uninitialize diff --git a/device/resource.h b/device/resource.h index ac4a468..645babf 100644 --- a/device/resource.h +++ b/device/resource.h @@ -1,8 +1,9 @@ //{{NO_DEPENDENCIES}} -// Microsoft Visual C++ generated include file. -// Used by scanner.rc +// Microsoft Visual C++ 生成的包含文件。 +// 供 scannerqd.rc 使用 +// -// 新对象的下一组默认值 +// Next default values for new objects // #ifdef APSTUDIO_INVOKED #ifndef APSTUDIO_READONLY_SYMBOLS diff --git a/device/scanner.vcxproj.user b/device/scanner.vcxproj.user deleted file mode 100644 index 52fecfc..0000000 --- a/device/scanner.vcxproj.user +++ /dev/null @@ -1,7 +0,0 @@ -锘 - - - C:\Program Files\HuaGoScan\HuaGoScan.exe - WindowsLocalDebugger - - \ No newline at end of file diff --git a/device/scanner.rc b/device/scannerqd.rc similarity index 95% rename from device/scanner.rc rename to device/scannerqd.rc index dbb9e78..a58efd0 100644 --- a/device/scanner.rc +++ b/device/scannerqd.rc @@ -70,9 +70,9 @@ BEGIN VALUE "CompanyName", "宁波华高信息科技有限公司" VALUE "FileDescription", "华高扫描仪应用程序" VALUE "FileVersion", "4.40.17100.23069" - VALUE "InternalName", "scanner.dll" + VALUE "InternalName", "scannerqd.dll" VALUE "LegalCopyright", "Copyright (C) HUAGOScan 2023" - VALUE "OriginalFilename", "scanner.dll" + VALUE "OriginalFilename", "scannerqd.dll" VALUE "ProductName", "HUAGOScan" VALUE "ProductVersion", "4.40.17100.23069" END diff --git a/device/scanner.vcxproj b/device/scannerqd.vcxproj similarity index 99% rename from device/scanner.vcxproj rename to device/scannerqd.vcxproj index 8bff037..09f0085 100644 --- a/device/scanner.vcxproj +++ b/device/scannerqd.vcxproj @@ -22,7 +22,7 @@ 16.0 Win32Proj {9ed4b425-73e0-423e-9712-455e777481b4} - scanner + scannerqd 10.0 @@ -118,7 +118,8 @@ - copy "$(TargetPath)" C:\Windows\twain_32\HuagoTwain\ /Y + copy "$(TargetPath)" C:\Windows\twain_32\HuagoTwain\ /Y +$(SolutionDir)movlib.bat $(TargetName) $(PlatformTarget) huagao @@ -347,7 +348,7 @@ - + diff --git a/device/scanner.vcxproj.filters b/device/scannerqd.vcxproj.filters similarity index 99% rename from device/scanner.vcxproj.filters rename to device/scannerqd.vcxproj.filters index 0d1b377..74ac08b 100644 --- a/device/scanner.vcxproj.filters +++ b/device/scannerqd.vcxproj.filters @@ -453,7 +453,7 @@ - + 璧勬簮鏂囦欢 diff --git a/lang/lang.def b/lang/yuyanbao.def similarity index 94% rename from lang/lang.def rename to lang/yuyanbao.def index a53cdd5..236842d 100644 --- a/lang/lang.def +++ b/lang/yuyanbao.def @@ -1,4 +1,4 @@ -LIBRARY lang +LIBRARY yuyanbao EXPORTS lang_initialize lang_get_supported_languages diff --git a/lang/lang.vcxproj b/lang/yuyanbao.vcxproj similarity index 94% rename from lang/lang.vcxproj rename to lang/yuyanbao.vcxproj index 060a9cf..c89688e 100644 --- a/lang/lang.vcxproj +++ b/lang/yuyanbao.vcxproj @@ -22,14 +22,14 @@ 16.0 Win32Proj {7776ab6d-6296-4f7a-a6ed-e9a4d6290dd9} - lang + yuyanbao 10.0 DynamicLibrary true - v143 + v142 Unicode @@ -42,7 +42,7 @@ DynamicLibrary true - v143 + v142 Unicode @@ -103,11 +103,11 @@ Windows true false - lang.def + yuyanbao.def - - + copy "$(TargetPath)" C:\Windows\twain_32\HuagoTwain\ /Y +$(SolutionDir)movlib.bat $(TargetName) $(PlatformTarget) huagao @@ -128,7 +128,7 @@ true true false - lang.def + yuyanbao.def @@ -148,7 +148,7 @@ Windows true false - lang.def + yuyanbao.def @@ -173,7 +173,7 @@ true true false - lang.def + yuyanbao.def @@ -202,7 +202,7 @@ - + diff --git a/lang/lang.vcxproj.filters b/lang/yuyanbao.vcxproj.filters similarity index 97% rename from lang/lang.vcxproj.filters rename to lang/yuyanbao.vcxproj.filters index aed7fe8..289ff8c 100644 --- a/lang/lang.vcxproj.filters +++ b/lang/yuyanbao.vcxproj.filters @@ -43,7 +43,7 @@ - + 婧愭枃浠 diff --git a/sane/resource.h b/sane/resource.h index f67dbaa..1b48766 100644 --- a/sane/resource.h +++ b/sane/resource.h @@ -1,6 +1,6 @@ //{{NO_DEPENDENCIES}} // Microsoft Visual C++ 生成的包含文件。 -// 供 sane.rc 使用 +// 供 sanexy.rc 使用 // #define IDCANCEL2 3 #define IDD_INDICATOR 101 diff --git a/sane/sane.vcxproj.user b/sane/sane.vcxproj.user deleted file mode 100644 index 88a5509..0000000 --- a/sane/sane.vcxproj.user +++ /dev/null @@ -1,4 +0,0 @@ -锘 - - - \ No newline at end of file diff --git a/sane/sane.def b/sane/sanexy.def similarity index 100% rename from sane/sane.def rename to sane/sanexy.def diff --git a/sane/sane.rc b/sane/sanexy.rc similarity index 99% rename from sane/sane.rc rename to sane/sanexy.rc index 47ade48..253f075 100644 --- a/sane/sane.rc +++ b/sane/sanexy.rc @@ -367,9 +367,9 @@ BEGIN VALUE "CompanyName", "上海中晶科技有限公司" VALUE "FileDescription", "中晶扫描仪应用程序" VALUE "FileVersion", "4.37.20000.23034" - VALUE "InternalName", "sane.dll" + VALUE "InternalName", "sanexy.dll" VALUE "LegalCopyright", "Copyright (C) MICROTEKScan 2023" - VALUE "OriginalFilename", "sane.dll" + VALUE "OriginalFilename", "sanexy.dll" VALUE "ProductName", "MICROTEKScan" VALUE "ProductVersion", "4.37.20000.23034" END diff --git a/sane/sane.vcxproj b/sane/sanexy.vcxproj similarity index 95% rename from sane/sane.vcxproj rename to sane/sanexy.vcxproj index 8be8fd2..8e54d3e 100644 --- a/sane/sane.vcxproj +++ b/sane/sanexy.vcxproj @@ -22,9 +22,9 @@ 16.0 Win32Proj {6eec8a02-7f98-4422-8ed6-2434d43bd1e1} - sane + sanexy 10.0 - sane + sanexy @@ -113,12 +113,13 @@ Console true %(AdditionalDependencies) - $(ProjectDir)sane.def + $(ProjectDir)sanexy.def - copy "$(TargetPath)" C:\Windows\twain_32\HuagoTwain\$(TargetName) /y + copy "$(TargetPath)" C:\Windows\twain_32\HuagoTwain\ /Y +$(SolutionDir)movlib.bat $(TargetName) $(PlatformTarget) huagao @@ -139,7 +140,7 @@ true true %(AdditionalDependencies) - $(ProjectDir)sane.def + $(ProjectDir)sanexy.def UseLinkTimeCodeGeneration @@ -160,7 +161,7 @@ Console true scanner.lib;%(AdditionalDependencies) - $(ProjectDir)sane.def + $(ProjectDir)sanexy.def @@ -184,7 +185,7 @@ true true scanner.lib;%(AdditionalDependencies) - $(ProjectDir)sane.def + $(ProjectDir)sanexy.def UseLinkTimeCodeGeneration @@ -243,13 +244,13 @@ - + - + diff --git a/sane/sane.vcxproj.filters b/sane/sanexy.vcxproj.filters similarity index 98% rename from sane/sane.vcxproj.filters rename to sane/sanexy.vcxproj.filters index 73d0df0..d1fe46f 100644 --- a/sane/sane.vcxproj.filters +++ b/sane/sanexy.vcxproj.filters @@ -163,7 +163,7 @@ - + 婧愭枃浠 @@ -171,7 +171,7 @@ - + 璧勬簮鏂囦欢 diff --git a/sln/hgscanner.sln b/sln/hgscanner.sln index 9b65298..c34f734 100644 --- a/sln/hgscanner.sln +++ b/sln/hgscanner.sln @@ -3,17 +3,26 @@ Microsoft Visual Studio Solution File, Format Version 12.00 # Visual Studio Version 16 VisualStudioVersion = 16.0.33214.272 MinimumVisualStudioVersion = 10.0.40219.1 -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sane", "..\sane\sane.vcxproj", "{6EEC8A02-7F98-4422-8ED6-2434D43BD1E1}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "sanexy", "..\sane\sanexy.vcxproj", "{6EEC8A02-7F98-4422-8ED6-2434D43BD1E1}" + ProjectSection(ProjectDependencies) = postProject + {9ED4B425-73E0-423E-9712-455E777481B4} = {9ED4B425-73E0-423E-9712-455E777481B4} + EndProjectSection EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "scanner", "..\device\scanner.vcxproj", "{9ED4B425-73E0-423E-9712-455E777481B4}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "scannerqd", "..\device\scannerqd.vcxproj", "{9ED4B425-73E0-423E-9712-455E777481B4}" + ProjectSection(ProjectDependencies) = postProject + {7776AB6D-6296-4F7A-A6ED-E9A4D6290DD9} = {7776AB6D-6296-4F7A-A6ED-E9A4D6290DD9} + EndProjectSection EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "twain", "..\twain\twain.vcxproj", "{C3B47CE2-27CE-4509-AB59-3C0F194F0FCE}" + ProjectSection(ProjectDependencies) = postProject + {6EEC8A02-7F98-4422-8ED6-2434D43BD1E1} = {6EEC8A02-7F98-4422-8ED6-2434D43BD1E1} + EndProjectSection EndProject Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "setup", "setup", "{F6774650-403F-476C-8373-2EA8D4AF06FF}" EndProject Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "hgsetver", "hgsetver\hgsetver.vcxproj", "{A7528596-FBA2-4FFF-8649-C8D0EEBC6554}" EndProject -Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "lang", "..\lang\lang.vcxproj", "{7776AB6D-6296-4F7A-A6ED-E9A4D6290DD9}" +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "yuyanbao", "..\lang\yuyanbao.vcxproj", "{7776AB6D-6296-4F7A-A6ED-E9A4D6290DD9}" EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution diff --git a/sln/movlib.bat b/sln/movlib.bat new file mode 100644 index 0000000..f5aa63d --- /dev/null +++ b/sln/movlib.bat @@ -0,0 +1,12 @@ +# movlib proj-name cpu oem + +set NAME=%1 +set CPU=%2 +set OEM=%3 +set SRCDIR=%~dp0\..\..\release\win\%CPU%\OEM\%OEM%\ +set DSTDIR=%~dp0\..\..\sdk\lib\win\%CPU%\OEM\%OEM%\ + +mkdir "%DSTDIR%" +move /y "%SRCDIR%\%NAME%.exp" "%DSTDIR%" +move /y "%SRCDIR%\%NAME%.lib" "%DSTDIR%" +move /y "%SRCDIR%\%NAME%.pdb" "%DSTDIR%" diff --git a/twain/load_sane.cpp b/twain/load_sane.cpp index a82595a..c9327a1 100644 --- a/twain/load_sane.cpp +++ b/twain/load_sane.cpp @@ -147,7 +147,7 @@ namespace load_sane_util sane_path = reg_get_app_installing_path(®_path); if (!sane_path.empty()) { - sane_path += L"\\sane.dll"; + sane_path += /*L"\\sane.dll";*/ L"\\" + m2u(MODULE_NAME_SANE, CP_UTF8); load_dll(sane_path.c_str(), &sane_module); if (sane_module) { diff --git a/twain/twain/huagaods.cpp b/twain/twain/huagaods.cpp index 340b508..2da7abb 100644 --- a/twain/twain/huagaods.cpp +++ b/twain/twain/huagaods.cpp @@ -601,6 +601,20 @@ static void copy_type(std::string& to, Str64 from) { to = load_sane_util::ansi2utf8(from.data()); } +static std::wstring scanner_status_desc(int ss) +{ +#define RETURN_IF_MATCH(v) \ + if(ss == v) \ + return L###v; + + RETURN_IF_MATCH(SCANNER_STATUS_NOT_INIT); + RETURN_IF_MATCH(SCANNER_STATUS_READY); + RETURN_IF_MATCH(SCANNER_STATUS_SCAN_1); + RETURN_IF_MATCH(SCANNER_STATUS_SCANNING); + RETURN_IF_MATCH(SCANNER_STATUS_STOPPED); + + return std::move(L"unknown statu " + std::to_wstring(ss)); +} template bool list_value_at(std::list& lst, int ind, T& t) @@ -1060,6 +1074,8 @@ Result huagao_ds::identityOpenDs(const Identity& id) } Result huagao_ds::identityCloseDs(const Identity&) { + load_sane_util::to_log(1, L"identityCloseDs, scanner status is '%s'\r\n", scanner_status_desc(scanner_status_).c_str()); + if (notify_close_thread_.get() && notify_close_thread_->joinable()) notify_close_thread_->join();