- 产品名/展示串、SDK 与运行时导出 API、.NET 命名空间全部换为 DogProtect
- 文件与目录改名: dogprotect.sln / DogProtect/ / DogProtectCon/ / sdk/DogProtect.SDK /
sdk/DogProtectSDK.{h,pas,bas,inc} / runtime/DogProtect.Runtime/ / core/dogprotect.rc /
app/dogprotect_gui.app
- 项目文件扩展名 .vmp → .dog(含 GUI 过滤器、默认输出名、示例工程、单测)
- VM 代码节名默认 .dog(上游为随机 ".xyz"),产物节为 .dog0/.dog1/...
- 授权数据与配置: DogProtect.dat / DogProtectLicense.ini / Global\\DogProtect.dat
- 域名占位 dogprotect.example,bundle id com.dogprotect.dogprotect
- 保留 VMP_* 内部宏与 third-party/
- BUILD-LINUX.md 增补改名说明与 SDK 兼容性提示
99 lines
3.6 KiB
HTML
99 lines
3.6 KiB
HTML
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
|
|
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
|
|
|
<html xmlns="http://www.w3.org/1999/xhtml">
|
|
<head>
|
|
<link rel="Stylesheet" type="text/css" href=
|
|
"../../default.css" />
|
|
<meta http-equiv="Content-Type" content=
|
|
"text/html; charset=utf-8" />
|
|
|
|
<title>Step 1.9: Hardware lock</title>
|
|
<style type="text/css">
|
|
/*<![CDATA[*/
|
|
div.c2 {text-align: center}
|
|
p.c1 {color:red;}
|
|
/*]]>*/
|
|
</style>
|
|
</head>
|
|
|
|
<body>
|
|
<h1>Step 1.9: Hardware lock</h1><strong>Receiving a hardware identifier</strong>
|
|
|
|
<p>Before we lock to hardware, we must receive a hardware identifier. The identifier is put into a serial number, and when the number is passed to the licensing system, it checks if identifiers match. So, first we need to receive the identifier of our hardware. Let's reduce the
|
|
<strong>main()</strong> function to the bare minimum:</p>
|
|
<pre class="code">int main(int argc, char **argv)
|
|
{
|
|
int nSize = DogProtectGetCurrentHWID(NULL, 0);
|
|
char *buf = new char[nSize];
|
|
DogProtectGetCurrentHWID(buf, nSize);
|
|
printf("HWID: %s\n", buf);
|
|
delete [] buf;
|
|
return 0;
|
|
}
|
|
</pre>
|
|
|
|
<p>By running the program, we receive a default test hardware identifier:</p>
|
|
<pre class="code">HWID: myhwid
|
|
</pre>
|
|
|
|
<p>To change the identifier, add the following line to the ini-file:</p>
|
|
<pre class="code">MyHWID=test
|
|
</pre>
|
|
|
|
<p>If we run the program afterwards, we can see the system thinks "test" is a hardware identifier of our PC:</p>
|
|
<pre class="code">HWID: test
|
|
</pre>
|
|
|
|
<p class="c1"><strong>Important!</strong> The program will display the real hardware identifier only after it is processed with DogProtect.</p><br />
|
|
<strong>Hardware-locked serial number</strong>
|
|
|
|
<p>To lock our test serial number to hardware, we should add one more line to the ini-file. This time we define the identifier that is "put into" the serial number:</p>
|
|
<pre class="code">KeyHWID=test
|
|
</pre>
|
|
|
|
<p>Then we complicate <strong>main()</strong> back a bit. Now it will pass a serial number and analyze the result it gets:</p>
|
|
<pre>
|
|
int main(int argc, char **argv)
|
|
{
|
|
int nSize = DogProtectGetCurrentHWID(NULL, 0);
|
|
char *buf = new char[nSize];
|
|
DogProtectGetCurrentHWID(buf, nSize);
|
|
printf("HWID: %s\n", buf);
|
|
delete [] buf;
|
|
|
|
char *serial = "Xserialnumber";
|
|
int res = DogProtectSetSerialNumber(serial);
|
|
print_state(res);
|
|
return 0;
|
|
}
|
|
</pre>
|
|
|
|
<p>After running the code we will see the following result:</p>
|
|
<pre class="code">HWID: test
|
|
state = 0
|
|
</pre>
|
|
|
|
<p>The licensing system has compared the current hardware identifier with the one written in the serial number. Identifiers are equal, so the
|
|
<strong>DogProtectSetSerialNumber()</strong> function returned 0 - the serial number matches.</p>
|
|
|
|
<p>Now let's try to "run" our program on another hardware. We simply change the value of the MyHWID parameter in the ini-file from "test" to "new test". Run the program again:</p>
|
|
<pre class="code">HWID: new test
|
|
state = SERIAL_STATE_FLAG_BAD_HWID
|
|
</pre>
|
|
|
|
<p>This time the licensing system returned the
|
|
SERIAL_STATE_FLAG_BAD_HWID flag, which means the real hardware identifier and the one stored in the serial number are not matching. The current identifier we see on the screen is "new test", while the serial number holds "test". If we change the KeyHWID parameter in the ini-file to "new test" we can make our serial number work on this "hardware" too.</p><br />
|
|
<a href="step1A_userdata.htm">Next step</a>
|
|
<br />
|
|
<br />
|
|
<br />
|
|
<br />
|
|
<hr noshade="noshade" size="1" />
|
|
|
|
<div align="center">
|
|
|
|
</div>
|
|
</body>
|
|
</html>
|