diff --git a/hgsane/sane_hg_mdw.cpp b/hgsane/sane_hg_mdw.cpp index 2ae4a05..a8019eb 100644 --- a/hgsane/sane_hg_mdw.cpp +++ b/hgsane/sane_hg_mdw.cpp @@ -33,7 +33,8 @@ #define iconv_t void* #endif -static std::string g_sane_path = ""; +static std::string g_sane_path(""); +static std::string g_sane_name(GET_BACKEND_NAME); namespace local_utility { @@ -335,7 +336,7 @@ hg_sane_middleware::hg_sane_middleware(void) : opt_0_(nullptr), std_opt_(nullptr sprintf(sane_ver, "%u.%u.%u", SANE_CURRENT_MAJOR, SANE_CURRENT_MINOR, VERSION_BUILD); signal(SIGUSR1, &hg_sane_middleware::device_pnp); - hg_scanner_set_sane_info(GET_BACKEND_NAME, sane_ver); + hg_scanner_set_sane_info(g_sane_name.c_str(), sane_ver); hg_scanner_initialize(local_utility::ui_cb, NULL); #ifndef WIN32 @@ -2037,8 +2038,11 @@ BOOL WINAPI DllMain(HINSTANCE inst, DWORD reason, LPVOID reserved) GetModuleFileNameA(inst, path, _countof(path) - 1); if (strrchr(path, '\\')) { + g_sane_name = strrchr(path, '\\') + 1; strrchr(path, '\\')[1] = 0; g_sane_path = path; + if (g_sane_name.rfind('.') != std::string::npos) + g_sane_name.erase(g_sane_name.rfind('.')); } } }