mirror of
https://github.com/VincentWei/MiniGUI.git
synced 2026-09-24 00:54:18 +08:00
cleanup: bad usage of __TARGET_UNKNOWN__
This commit is contained in:
@@ -75,9 +75,6 @@
|
||||
#ifdef _MG_ENABLE_LICENSE
|
||||
# include "../sysres/license/c_files/04_progressbar-bk.dat.c"
|
||||
#endif
|
||||
#ifndef __TARGET_UNKNOWN__
|
||||
unsigned int g_license_processor_id;
|
||||
#endif
|
||||
|
||||
#ifdef _MGHAVE_MENU
|
||||
/* function defined in menu module. */
|
||||
|
||||
+7
-110
@@ -54,14 +54,7 @@
|
||||
# define MG_LOCAL /* NULL */
|
||||
#endif
|
||||
|
||||
/*
|
||||
* Common
|
||||
*/
|
||||
#if defined(_MG_ENABLE_SPLASH) || \
|
||||
defined(_MG_ENABLE_SCREENSAVER) || \
|
||||
defined(_MG_ENABLE_WATERMARK)
|
||||
|
||||
#define _MG_ENABLE_LICENSE 1
|
||||
#define _MG_ENABLE_LICENSE _MG_ENABLE_SPLASH
|
||||
|
||||
enum {
|
||||
SPLASH_MINIGUI,
|
||||
@@ -69,11 +62,6 @@ enum {
|
||||
SPLASH_FEIMAN,
|
||||
SPLASH_PROGRESSBAR,
|
||||
SPLASH_PROGRESSBAR_BK,
|
||||
#if 0
|
||||
WATERMARK_1,
|
||||
WATERMARK_2,
|
||||
WATERMARK_3,
|
||||
#endif /* _MG_ENABLE_WATERMARK */
|
||||
LICENSE_BITMAP_NR
|
||||
};
|
||||
|
||||
@@ -88,12 +76,6 @@ extern MG_LOCAL BITMAP g_license_bitmaps[];
|
||||
MG_LOCAL void __mg_license_create(void);
|
||||
MG_LOCAL void __mg_license_destroy(void);
|
||||
|
||||
#else
|
||||
# define __mg_license_create() /* NULL */
|
||||
# define __mg_license_destroy() /* NULL */
|
||||
#endif /* endif _MG_ENABLE_SPLASH or _MG_ENABLE_SCREENSAVER or _MG_ENABLE_WATERMARK*/
|
||||
|
||||
|
||||
#ifdef _MG_ENABLE_SCREENSAVER
|
||||
MG_LOCAL void __mg_screensaver_create(void);
|
||||
MG_LOCAL void __mg_screensaver_destroy(void);
|
||||
@@ -115,96 +97,11 @@ MG_LOCAL void __mg_splash_delay(void);
|
||||
# define __mg_splash_delay() /* NULL */
|
||||
#endif /* endif _MG_ENABLE_SPLASH */
|
||||
|
||||
/*
|
||||
* ScreenSaver & Watermark
|
||||
*/
|
||||
#if defined(_MG_ENABLE_SCREENSAVER) || defined(_MG_ENABLE_WATERMARK)
|
||||
MG_LOCAL void __mg_license_on_input(void);
|
||||
MG_LOCAL void __mg_license_on_timeout(void);
|
||||
#else
|
||||
# define __mg_license_on_input() /* NULL */
|
||||
# define __mg_license_on_timeout() /* NULL */
|
||||
#endif /* _MG_ENABLE_SCREENSAVER || _MG_ENABLE_WATERMARK */
|
||||
|
||||
/*
|
||||
* Product ID
|
||||
*/
|
||||
#ifdef _MG_PRODUCTID
|
||||
typedef struct _product_id {
|
||||
/* Fixed 8-byte code, help us to locate the struct in .so file */
|
||||
unsigned char prefix[8];
|
||||
/* the ID of the customer */
|
||||
int customer_id;
|
||||
/* svn version */
|
||||
int version;
|
||||
/* When does we compile the .so, in seconds */
|
||||
int compile_date;
|
||||
/* The size of the .so file */
|
||||
int file_size;
|
||||
/* The check sum of the .so file */
|
||||
unsigned char checksum[16];
|
||||
} product_id_t;
|
||||
|
||||
#define PRODUCT_ID_PREFIX 0xca, 0x3f, 0x2b, 0x43, 0x00, 0x33, 0xb0, 0xc3
|
||||
|
||||
MG_LOCAL int license_get_customer_id(void);
|
||||
|
||||
#endif /* _MG_PRODUCTID */
|
||||
|
||||
/*
|
||||
* Tools to encrypt const variables
|
||||
*/
|
||||
MG_LOCAL unsigned int LICENSE_ENCRYPTED_CONST_INT(unsigned int);
|
||||
MG_LOCAL char *LICENSE_ENCRYPTED_CONST_STRING(unsigned char *, int);
|
||||
|
||||
/*
|
||||
* Processor ID
|
||||
*/
|
||||
#ifdef _MG_PRODUCTID
|
||||
# define LICENSE_CHECK_CUSTIMER_ID() \
|
||||
do { \
|
||||
if (! license_get_customer_id()) { \
|
||||
return ERR_INVALID_ARGS; \
|
||||
} \
|
||||
} while(0)
|
||||
#else
|
||||
# define LICENSE_CHECK_CUSTIMER_ID() /* NULL */
|
||||
#endif
|
||||
|
||||
#ifdef __TARGET_UNKNOWN__
|
||||
|
||||
# define license_get_processor_id() /* NULL */
|
||||
# define LICENSE_SET_MESSAGE_OFFSET() /* NULL */
|
||||
# define LICENSE_MODIFY_MESSAGE(x) /* NULL */
|
||||
|
||||
#else /* not __TARGET_UNKNOWN__ */
|
||||
|
||||
extern MG_LOCAL unsigned int g_license_processor_id; /* window.c */
|
||||
MG_LOCAL void license_get_processor_id (void);
|
||||
#define LICENSE_PROCESSOR_ID_NONE (0xFC1D8B2A)
|
||||
|
||||
extern MG_LOCAL unsigned int g_license_message_offset; /* zorder.c */
|
||||
|
||||
#if defined (_WITH_TARGET_S3C6410)
|
||||
# define REAL_PROCESSOR_ID LICENSE_ENCRYPTED_CONST_INT(0x1AE2FDFD /* 0x36410101 */)
|
||||
#elif defined (_WITH_TARGET_S3C2440)
|
||||
# define REAL_PROCESSOR_ID LICENSE_ENCRYPTED_CONST_INT(0x3AA4FDFD /* 0x32440101 */)
|
||||
#elif defined (_WITH_TARGET_S3C2410)
|
||||
# define REAL_PROCESSOR_ID LICENSE_ENCRYPTED_CONST_INT(0x3AE2FDFD /* 0x32410101 */)
|
||||
#elif defined (_WITH_TARGET_HI3560A)
|
||||
# define REAL_PROCESSOR_ID LICENSE_ENCRYPTED_CONST_INT(0xFC38C9AD /* 0x35600200 */)
|
||||
#else
|
||||
# define REAL_PROCESSOR_ID LICENSE_PROCESSOR_ID_NONE
|
||||
#endif
|
||||
|
||||
#define LICENSE_SET_MESSAGE_OFFSET() do {g_license_message_offset=g_license_processor_id-(REAL_PROCESSOR_ID);}while (0)
|
||||
|
||||
#define LICENSE_MODIFY_MESSAGE(pMsg) \
|
||||
do { \
|
||||
pMsg->message += g_license_message_offset; \
|
||||
pMsg->hwnd -= g_license_message_offset / 2; \
|
||||
} while (0)
|
||||
|
||||
#endif /* __TARGET_UNKNOWN__ */
|
||||
#define __mg_license_on_input() /* NULL */
|
||||
#define __mg_license_on_timeout() /* NULL */
|
||||
#define LICENSE_CHECK_CUSTIMER_ID() /* NULL */
|
||||
#define license_get_processor_id() /* NULL */
|
||||
#define LICENSE_SET_MESSAGE_OFFSET() /* NULL */
|
||||
#define LICENSE_MODIFY_MESSAGE(x) /* NULL */
|
||||
|
||||
#endif /* LICENSE_H */
|
||||
|
||||
@@ -67,9 +67,6 @@
|
||||
#ifdef _MG_ENABLE_LICENSE
|
||||
# include "../sysres/license/c_files/03_progressbar.dat.c"
|
||||
#endif
|
||||
#ifndef __TARGET_UNKNOWN__
|
||||
unsigned int g_license_message_offset;
|
||||
#endif
|
||||
|
||||
#ifdef _MGRM_PROCESSES
|
||||
# include "ourhdr.h"
|
||||
|
||||
@@ -582,52 +582,3 @@ void __mg_license_on_timeout(void)
|
||||
}
|
||||
#endif /* _MG_ENABLE_SCREENSAVER || _MG_ENABLE_WATERMARK */
|
||||
|
||||
/***********************************************************
|
||||
* Processor ID
|
||||
***********************************************************/
|
||||
#ifndef __TARGET_UNKNOWN__
|
||||
void license_get_processor_id (void) {
|
||||
g_license_processor_id = LICENSE_PROCESSOR_ID_NONE;
|
||||
#if defined(_WITH_TARGET_S3C6410) || defined(_WITH_TARGET_S3C2440) || defined(_WITH_TARGET_S3C2410) \
|
||||
|| defined (_WITH_TARGET_HI3560A)
|
||||
{
|
||||
int fd;
|
||||
unsigned char *addr;
|
||||
off_t SFR_offest;
|
||||
size_t cpuid_offest;
|
||||
unsigned char path[8] = "\x58\x1f\x6f\xc1\x58\x76\x6f\x76" /* "/dev/mem" */;
|
||||
|
||||
fd = open(LICENSE_ENCRYPTED_CONST_STRING(path, sizeof(path)), O_RDWR);
|
||||
if (fd <= 0) {
|
||||
return;
|
||||
}
|
||||
|
||||
#ifdef _WITH_TARGET_S3C6410
|
||||
SFR_offest = LICENSE_ENCRYPTED_CONST_INT(0x3CADA1AD /* 0x7E00F000 */);
|
||||
cpuid_offest = LICENSE_ENCRYPTED_CONST_INT(0xADADFD9F /* 0x00000118 */);
|
||||
#elif _WITH_TARGET_HI3560A
|
||||
SFR_offest = LICENSE_ENCRYPTED_CONST_INT(0xD3BCADAD /* 0x101E0000 */);
|
||||
cpuid_offest = LICENSE_ENCRYPTED_CONST_INT(0xADAD8470 /* 0x00000EE0 */);
|
||||
#else /* 2440, 2410 */
|
||||
SFR_offest = LICENSE_ENCRYPTED_CONST_INT(0x03ADADAD /* 0x56000000 */);
|
||||
cpuid_offest = LICENSE_ENCRYPTED_CONST_INT(0xADADADE4 /* 0x000000B0 */);
|
||||
#endif
|
||||
|
||||
addr = mmap(NULL, (4<<10), PROT_READ, MAP_SHARED, fd, SFR_offest);
|
||||
|
||||
#if _WITH_TARGET_HI3560A
|
||||
g_license_processor_id = *(unsigned int*)(addr+cpuid_offest+12) << 24 |
|
||||
*(unsigned int*)(addr+cpuid_offest+8) << 16 |
|
||||
*(unsigned int*)(addr+cpuid_offest+4) << 8 |
|
||||
*(unsigned int*)(addr+cpuid_offest);
|
||||
#else
|
||||
g_license_processor_id = *(unsigned int*)(addr+cpuid_offest);
|
||||
#endif
|
||||
munmap(addr, (4<<10));
|
||||
close(fd);
|
||||
}
|
||||
#else
|
||||
//# warning PROCESSOR_ID_verfication_is_DISABLED_on_this_target
|
||||
#endif
|
||||
}
|
||||
#endif /* __TARGET_UNKNOWN__ */
|
||||
|
||||
Reference in New Issue
Block a user