MCPcopy Create free account
hub / github.com/DescentDevelopers/Descent3 / GetInternalSerializationNumber

Function GetInternalSerializationNumber

Descent3/TelCom.cpp:3226–3264  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

3224// -1 : detected a hacked exe
3225#define INTERNAL_SERIALNUM_TAG "XFCABBFFAX"
3226char GetInternalSerializationNumber(int *num) {
3227 static char mydata[] = INTERNAL_SERIALNUM_TAG;
3228
3229 // first check to see if the value is the same (non-serialized EXE)
3230 if (mydata[0] == 'X' && ((mydata[9] + 2) == 'Z')) {
3231 int value = 0;
3232 char c;
3233 for (int i = 0; i < 8; i++) {
3234 c = mydata[i + 1];
3235 if (c >= 'A' && c <= 'F') {
3236 value = value * 16 + (c - 'A' + 10);
3237 } else
3238 goto get_num;
3239 }
3240
3241 if (value == 0xFCABBFFA)
3242 return 0;
3243 }
3244
3245get_num:
3246 // we got to get the serial num if we can
3247 int value = 0;
3248 char c;
3249 for (int i = 0; i < 8; i++) {
3250 c = mydata[i + 1];
3251 if (c >= '0' && c <= '9') {
3252 value = value * 16 + c - '0';
3253 } else if (c >= 'A' && c <= 'F') {
3254 value = value * 16 + c - 'A' + 10;
3255 } else
3256 return -1;
3257 }
3258
3259 // now byte swap the value to get it to it's original value
3260 value = (((value & 0xFF000000) >> 24) | ((value & 0xFF0000) >> 8) | ((value & 0xFF) << 24) | ((value & 0xFF00) << 8));
3261
3262 *num = value;
3263 return 1;
3264}
3265
3266/*
3267 ****************************************************************

Callers 1

MultiSendMyInfoFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected