| 1 | /* |
| 2 | * Descent 3 |
| 3 | * Copyright (C) 2024 Parallax Software |
| 4 | * |
| 5 | * This program is free software: you can redistribute it and/or modify |
| 6 | * it under the terms of the GNU General Public License as published by |
| 7 | * the Free Software Foundation, either version 3 of the License, or |
| 8 | * (at your option) any later version. |
| 9 | * |
| 10 | * This program is distributed in the hope that it will be useful, |
| 11 | * but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 | * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 | * GNU General Public License for more details. |
| 14 | * |
| 15 | * You should have received a copy of the GNU General Public License |
| 16 | * along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 17 | |
| 18 | --- HISTORICAL COMMENTS FOLLOW --- |
| 19 | |
| 20 | * $Logfile: /DescentIII/main/d3serial.h $ |
| 21 | * $Revision: 5 $ |
| 22 | * $Date: 10/11/98 2:58a $ |
| 23 | * $Author: Jeff $ |
| 24 | * |
| 25 | * file header for serialization |
| 26 | * |
| 27 | * $Log: /DescentIII/main/d3serial.h $ |
| 28 | * |
| 29 | * 5 10/11/98 2:58a Jeff |
| 30 | * fixed serialization code |
| 31 | * |
| 32 | * 4 9/29/98 3:04p Jeff |
| 33 | * |
| 34 | * 3 7/13/98 12:41p Jeff |
| 35 | * added serial number support |
| 36 | * |
| 37 | * 2 2/07/98 6:35p Jeff |
| 38 | * |
| 39 | * $NoKeywords: $ |
| 40 | */ |
| 41 | |
| 42 | #ifndef __SERIALIZE_H_ |
| 43 | #define __SERIALIZE_H_ |
| 44 | |
| 45 | #include <cstdint> |
| 46 | #include <ctime> |
| 47 | |
| 48 | #define DESC_ID_LEN 40 // how long the id string can be |
| 49 | #define DESC_CHECKSUM_LEN 4 // checksum is 4 bytes |
| 50 | #define DESC_SERIALNUM_LEN 4 // serialnum is 4 bytes |
| 51 | #define DESC_DEAD_TIME_LEN 8 // dead time is 8 bytes |
| 52 | |
| 53 | #define DESC_ID_TAG "Midway in our life's journey, I went astray" |
| 54 | #define DESC_ID_TAG_LEN 43 |
| 55 | |
| 56 | #define DESC_CHKSUM_TAG "alone in a dark wood." |
| 57 | #define DESC_CHKSUM_TAG_LEN 21 |
| 58 | |
| 59 | #define DESC_SERIALNUM_TAG "You've entered Lord Spam's Pleasure Dome" |
| 60 | #define DESC_SERIALNUM_TAG_LEN 40 |
| 61 | |
| 62 | #define DESC_DEAD_TIME_TAG "from the straight road and woke to find myself" |
| 63 | #define DESC_DEAD_TIME_TAG_LEN 46 |
| 64 | |
| 65 | // checks exectuable (returns !0 on error) |
| 66 | int SerialCheck(void); |
| 67 | |
| 68 | // given return value from SerialCheck() it reports the error |
| 69 | void SerialError(int error); |
| 70 | |
| 71 | // returns the serialnumber of the user |
| 72 | uint32_t SerialGetSerialNum(void); |
| 73 | |
| 74 | ///////////////////////////////////////////////////////////////////////////// |
| 75 | // These are the functions used for serialization |
| 76 | // if this function returns: |
| 77 | // 1 : than it's a serialized exe, num will be given the serial num |
| 78 | // 0 : than it isn't a serialized exe |
| 79 | // -1 : detected a hacked exe |
| 80 | char GetInternalSerializationNumber(int *num); |
| 81 | |
| 82 | #endif |