<title>Step 1.3: Retrieving serial number status flags</title>
</head>
<body>
<h1>Step 1.3: Retrieving serial number status flags</h1><strong>A handy function to print flags</strong>
<p>First of all, we need a handy function to transform numeric values of flags to comprehensible statuses of a serial number. Here is the code of this function:</p>
<preclass="code">#define PRINT_HELPER(state, flag) if (state & flag) printf("%s ", #flag)
<p>Now, we put the old key back by removing "1" and run the program again:</p>
<preclass="code">state = 0
We are registered.
</pre>
<p>Now, as we can see status flags of a serial number, let's move to retrieving flags and data from a serial number.</p><strong>Retrieving serial number status</strong>
<p>You can get the status of a serial number in three ways: by calling
<strong>DogProtectSetSerialNumber()</strong>, by calling
<strong>DogProtectGetSerialNumberState()</strong> or by calling
<strong>DogProtectGetSerialNumberData()</strong> - status flags are put into one of fields of the structure. Each method is intended to use in specific time. The first check of the serial number is performed during installation. At this moment you should decline incorrect numbers, expired numbers, numbers in the black list and so on. Some limitations, for example, the maximum operation time of the program or serial number expiration date should also be checked in run-time. And the <strong>DogProtectGetSerialNumberState()</strong> method is the fastest and the most convenient way here. And if you need to receive complete information about the serial number, you can use the more powerful