<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Форум Guardant &mdash; GrdRead возвращает ошибку GrdE_DongleLocked]]></title>
	<link rel="self" href="https://forum.guardant.ru/feed/atom/topic/1045/" />
	<updated>2024-01-26T12:03:01Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.guardant.ru/topic/1045/</id>
		<entry>
			<title type="html"><![CDATA[Re: GrdRead возвращает ошибку GrdE_DongleLocked]]></title>
			<link rel="alternate" href="https://forum.guardant.ru/post/5095/#p5095" />
			<content type="html"><![CDATA[<p>Добрый день. Ответили вам на почту.</p>]]></content>
			<author>
				<name><![CDATA[Тимофей Ершов]]></name>
				<uri>https://forum.guardant.ru/user/1116/</uri>
			</author>
			<updated>2024-01-26T12:03:01Z</updated>
			<id>https://forum.guardant.ru/post/5095/#p5095</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: GrdRead возвращает ошибку GrdE_DongleLocked]]></title>
			<link rel="alternate" href="https://forum.guardant.ru/post/5074/#p5074" />
			<content type="html"><![CDATA[<p>Здравствуйте. Вчера ответил вам на почту, но пока что не получил ответа ваших специалистов</p>]]></content>
			<author>
				<name><![CDATA[ajuvolkov]]></name>
				<uri>https://forum.guardant.ru/user/2067/</uri>
			</author>
			<updated>2024-01-11T09:41:50Z</updated>
			<id>https://forum.guardant.ru/post/5074/#p5074</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: GrdRead возвращает ошибку GrdE_DongleLocked]]></title>
			<link rel="alternate" href="https://forum.guardant.ru/post/5069/#p5069" />
			<content type="html"><![CDATA[<p>Добрый день. Спасибо. Ответили в почте.</p>]]></content>
			<author>
				<name><![CDATA[Тимофей Ершов]]></name>
				<uri>https://forum.guardant.ru/user/1116/</uri>
			</author>
			<updated>2024-01-10T08:05:02Z</updated>
			<id>https://forum.guardant.ru/post/5069/#p5069</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: GrdRead возвращает ошибку GrdE_DongleLocked]]></title>
			<link rel="alternate" href="https://forum.guardant.ru/post/5066/#p5066" />
			<content type="html"><![CDATA[<p>Добрый день! Выслал.</p>]]></content>
			<author>
				<name><![CDATA[ajuvolkov]]></name>
				<uri>https://forum.guardant.ru/user/2067/</uri>
			</author>
			<updated>2024-01-09T09:26:45Z</updated>
			<id>https://forum.guardant.ru/post/5066/#p5066</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: GrdRead возвращает ошибку GrdE_DongleLocked]]></title>
			<link rel="alternate" href="https://forum.guardant.ru/post/5065/#p5065" />
			<content type="html"><![CDATA[<p>Добрый день.<br />Просьба прислать <a href="https://dev.guardant.ru/display/KB/0001">полный отчет диагностики</a> для проблемного ключа на почту hotline@guardant.ru.</p>]]></content>
			<author>
				<name><![CDATA[Тимофей Ершов]]></name>
				<uri>https://forum.guardant.ru/user/1116/</uri>
			</author>
			<updated>2024-01-09T08:01:36Z</updated>
			<id>https://forum.guardant.ru/post/5065/#p5065</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[GrdRead возвращает ошибку GrdE_DongleLocked]]></title>
			<link rel="alternate" href="https://forum.guardant.ru/post/5063/#p5063" />
			<content type="html"><![CDATA[<p>Добрый день. Есть старый рабочий код, который ранее использовался с USB ключами Guardant Code и проблем с ним не возникало.</p><p>В декабре заказали ключ, прошили его так же как прошивали год назад аналогичные ключи. Код перестал работать с данным ключом. При попытке вызвать GrdRead&nbsp; из другого потока (не из того где происходила инициализация ключа), данная функция возвращает ошибку GrdE_DongleLocked, при этом если вызвать данную функцию из потока, где ключ был проинициализирован, все ок.</p><p>Работаем c Guardant SDK 7 под Windows 10</p><p>Ключ инициализируется для многопоточной работы:<br />GrdCreateHandle(0, GrdCHM_MultiThread, NULL);</p><p>Подскажите в чем может быть проблема?</p><p>Код инициализации и проверки ключа (отдельный поток в приложении):</p><p>&nbsp; &nbsp; void working_thread_body()<br />&nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; try {</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int rc;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rc = GrdStartup(GrdFMR_Local);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (rc != GrdE_OK) {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; throw st::joint::exception(&quot;Guardiant license key: Failed to initialize. RC=[%d]&quot;, rc);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; m_grd = GrdCreateHandle(0, GrdCHM_MultiThread, NULL);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (!m_grd) {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; throw st::joint::exception(&quot;Failed to create handle. RC=[%d]&quot;, rc);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; auto grd_handle_guard = st::sfl::finally([&amp;]() {close_handle();});</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rc = GrdSetAccessCodes(m_grd, m_public_key, m_private_key, NULL, NULL);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (rc != GrdE_OK) {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; throw st::joint::exception(&quot;Guardiant license key: Failed to set access code. RC=[%d]&quot;, rc);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rc = GrdSetFindMode(m_grd, GrdFMR_Local, GrdFM_ID, 0, m_key_id, 0, 0, 0, 0, GrdFMM_ALL, GrdFMI_USB);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (rc != GrdE_OK) {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; throw st::joint::exception(&quot;Guardiant license key: Failed to set find mode. RC=[%d]&quot;, rc);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; DWORD id;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; TGrdFindInfo grd_fi;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rc = GrdFind(m_grd, GrdF_First, &amp;id, &amp;grd_fi);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (GrdE_OK != rc) {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; throw st::joint::exception(&quot;Guardiant license key: Failed to find the key [%x]. RC=[%d]&quot;, m_key_id, rc);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />&nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rc = GrdLogin(m_grd, 0xFFFFFFFF, 0);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (GrdE_OK != rc) {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; throw st::joint::exception(&quot;Guardiant license key: Failed to login to the key. RC=[%d]&quot;, rc);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; rc = GrdLock(m_grd, 0, 0xFFFFFFFF, GrdLM_All);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (GrdE_OK != rc) {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (GrdE_DongleLocked == rc) {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; throw st::joint::exception(&quot;Guardiant license key: Failed to lock the key. RC=[%d]. The dongle is busy or already locked by another application&quot;, rc);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; throw st::joint::exception(&quot;Guardiant license key: Failed to lock the key. RC=[%d]&quot;, rc);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; auto grd_lock_guard = st::sfl::finally([&amp;]() {unlock();});<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; <br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; m_key_initialization_proc_done = true;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; m_key_initialization_proc_cv.notify_one();</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; m_run = true;</p><p>#ifdef ST_SFL_PLATFORM_WINDOWS<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; // window is needed for WM_ENDSESSION message handling to gracefully unlock the key on Windows logout/shutdown<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; auto wnd = st::geobase::glwnd::create_window(<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;&quot;,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &quot;geobase_wnd_msg_handling_window&quot;,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; true,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 0,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 800,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 600,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; false,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; false,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; false,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; 4,5,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; false,<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; -1<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; );<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; st::geobase::glwnd::set_wnd_end_session_callback(wnd, [&amp;](){<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; std::lock_guard&lt;std::mutex&gt; lock(m_sync);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unlock();<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; close_handle();<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; m_run = false;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; });<br />#endif</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; auto last_check_time = std::chrono::steady_clock::now();</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; while (m_run)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; std::this_thread::sleep_for(std::chrono::milliseconds(30));</p><p>#ifdef ST_SFL_PLATFORM_WINDOWS<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (wnd) {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; glwnd::handle_window_system_msg(wnd);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />#endif<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (std::chrono::duration_cast&lt;std::chrono::seconds&gt;(std::chrono::steady_clock::now() - last_check_time).count() &gt; 10)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (m_grd) {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; const auto rc = GrdCheck(m_grd);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (GrdE_OK != rc)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (GrdE_DongleNotFound == rc) {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; throw st::joint::exception(&quot;Guardiant license key: The dongle wasn&#039;t found&quot;);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; throw st::joint::exception(&quot;Guardiant license key: Failed to check dongle [%d]&quot;, rc);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; last_check_time = std::chrono::steady_clock::now();<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />&nbsp; &nbsp; &nbsp; &nbsp; }<br />&nbsp; &nbsp; &nbsp; &nbsp; catch (st::joint::exception &amp;exc)<br />&nbsp; &nbsp; &nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; st::logger::error(exc.what());<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; m_run = false;</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (!m_key_initialization_proc_done)<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; m_key_initialization_proc_done = true;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; m_key_initialization_proc_cv.notify_one();<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }</p><p>&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; m_license_violation_callback();<br />&nbsp; &nbsp; &nbsp; &nbsp; }<br />&nbsp; &nbsp; }</p><p>Код, который читает данные из ключа (вызывается из другого потока):</p><p>&nbsp; &nbsp;unsigned int get_max_value() <br />&nbsp; &nbsp; {<br />&nbsp; &nbsp; &nbsp; &nbsp; std::lock_guard&lt;std::mutex&gt; lock(m_sync);<br />&nbsp; &nbsp; &nbsp; &nbsp; if (m_grd) {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; unsigned int maxcon = 1;<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; int rc = GrdRead(m_grd, 0x0028, sizeof(unsigned int), &amp;maxcon, NULL);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (GrdE_OK != rc) {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; if (GrdE_DongleNotFound == rc) {<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; st::joint::exception(&quot;Guardiant license key: Failed to read value from the key. The dongle wasn&#039;t found&quot;);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; throw st::joint::exception(&quot;Guardiant license key: Failed to read value from the key: [%d]&quot;, rc);<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; }<br />&nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; return maxcon;<br />&nbsp; &nbsp; &nbsp; &nbsp; }<br />&nbsp; &nbsp; &nbsp; &nbsp; return 0;<br />&nbsp; &nbsp; }</p><p>Вот здесь GrdRead возвращает код ошибки GrdE_DongleLocked</p>]]></content>
			<author>
				<name><![CDATA[ajuvolkov]]></name>
				<uri>https://forum.guardant.ru/user/2067/</uri>
			</author>
			<updated>2023-12-28T12:55:45Z</updated>
			<id>https://forum.guardant.ru/post/5063/#p5063</id>
		</entry>
</feed>
