部分APP设置BitDepth协议时未同步,在此种应用下屏蔽该协议。twain-app/no-bitdepth配置可设置
This commit is contained in:
parent
32ce54dda2
commit
ccdd41e0de
|
@ -1028,6 +1028,22 @@ Result huagao_ds::identityOpenDs(const Identity& id)
|
||||||
}
|
}
|
||||||
load_sane_util::to_log(1, L"Double check mode = %d\r\n", double_check_mode_);
|
load_sane_util::to_log(1, L"Double check mode = %d\r\n", double_check_mode_);
|
||||||
|
|
||||||
|
int nobd = get_config_number(L"twain-app", L"no-bitdepth", 0, -1);
|
||||||
|
if (nobd == -1)
|
||||||
|
{
|
||||||
|
wchar_t pe[MAX_PATH] = { 0 }, * name = NULL;
|
||||||
|
GetModuleFileNameW(NULL, pe, _countof(pe) - 1);
|
||||||
|
name = wcsrchr(pe, L'\\');
|
||||||
|
if (name++ == NULL)
|
||||||
|
name = pe;
|
||||||
|
if (wcsicmp(name, L"\u519B\u961F\u626B\u63CF2.0.exe") == 0) // 军队扫描2.0.exe
|
||||||
|
nobd = 1;
|
||||||
|
else
|
||||||
|
nobd = 0;
|
||||||
|
}
|
||||||
|
no_bitdepth_ = nobd == 1;
|
||||||
|
load_sane_util::to_log(1, L"BitDepth protocol enabled = %d\r\n", nobd);
|
||||||
|
|
||||||
m_compression = Compression::None;
|
m_compression = Compression::None;
|
||||||
init_support_caps();
|
init_support_caps();
|
||||||
m_fileXfer.setFormat(ImageFileFormat::Bmp);
|
m_fileXfer.setFormat(ImageFileFormat::Bmp);
|
||||||
|
@ -1938,6 +1954,8 @@ void huagao_ds::init_support_caps(void)
|
||||||
int val = 0;
|
int val = 0;
|
||||||
GET_SANE_OPT_EX(int, scanner_, ex_color_mode, NULL, &all);
|
GET_SANE_OPT_EX(int, scanner_, ex_color_mode, NULL, &all);
|
||||||
if (Msg::Set == msg || Msg::Reset == msg) {
|
if (Msg::Set == msg || Msg::Reset == msg) {
|
||||||
|
if (no_bitdepth_)
|
||||||
|
return success();
|
||||||
int ret = SCANNER_ERR_INVALID_PARAMETER;
|
int ret = SCANNER_ERR_INVALID_PARAMETER;
|
||||||
val = all[sane_opts::RANGE_POS_DEFAULT];
|
val = all[sane_opts::RANGE_POS_DEFAULT];
|
||||||
auto mech = data.currentItem<CapType::IBitDepth>();
|
auto mech = data.currentItem<CapType::IBitDepth>();
|
||||||
|
|
|
@ -56,6 +56,7 @@ class huagao_ds : public Twpp::SourceFromThis<huagao_ds> {
|
||||||
bool app_trigger_event_;
|
bool app_trigger_event_;
|
||||||
bool bUiOnly_;
|
bool bUiOnly_;
|
||||||
bool show_setting_;
|
bool show_setting_;
|
||||||
|
bool no_bitdepth_ = false; // ¾ü¶ÓɨÃè2.0.exe set this but sychronize to APP
|
||||||
int count_;
|
int count_;
|
||||||
|
|
||||||
volatile bool notfify_close_ = false;
|
volatile bool notfify_close_ = false;
|
||||||
|
@ -79,7 +80,7 @@ class huagao_ds : public Twpp::SourceFromThis<huagao_ds> {
|
||||||
void init_support_caps_ex(void);
|
void init_support_caps_ex(void);
|
||||||
std::wstring get_config_file(void);
|
std::wstring get_config_file(void);
|
||||||
std::wstring get_config_value(const wchar_t* sec, const wchar_t* key);
|
std::wstring get_config_value(const wchar_t* sec, const wchar_t* key);
|
||||||
DWORD get_config_number(const wchar_t* sec, const wchar_t* key);
|
DWORD get_config_number(const wchar_t* sec, const wchar_t* key, DWORD def = 0, DWORD empty = 0);
|
||||||
int handle_scanner_event(int ev, bool from_event_proc = true);
|
int handle_scanner_event(int ev, bool from_event_proc = true);
|
||||||
int get_scanned_image_count(DWORD timeout);
|
int get_scanned_image_count(DWORD timeout);
|
||||||
void trigger_ProcessEvent(Twpp::DataGroup dg, Twpp::Dat dat, Twpp::Msg msg);
|
void trigger_ProcessEvent(Twpp::DataGroup dg, Twpp::Dat dat, Twpp::Msg msg);
|
||||||
|
|
Loading…
Reference in New Issue