能力值:
( LV12,RANK:320 )
2 楼
定义了一个静态结构体变量 LM_CODE_NEW不是宏 LM_CODE_NEW(name, x, y, k1, k2, k3, k4, k5, ver, rev, pat, beh, t1, t2, str)才是宏
能力值:
( LV7,RANK:100 )
3 楼
请教下evilkis兄,
<1> 这里define语句中的VENDORCODE是不是结构体变量VENDORCODE7对应的宏(845行),而807行定义的VENDORCODE7才是最终对应的结构体变量?不知道我的理解对不对?
845行
#define VENDORCODE VENDORCODE7
807行
typedef struct vendorcode7 {
short type; /* Type of structure */
unsigned long data[2]; /* 64-bit code */
unsigned long keys[4];
short flexlm_version;
short flexlm_revision;
char flexlm_patch[2];
char behavior_ver[LM_MAX_BEH_VER + 1];
unsigned long trlkeys[2];
int signs; /* number of entries in pubkeyinfo */
int strength;
int sign_level;
LM_VENDORCODE_PUBKEYINFO pubkeyinfo[LM_MAXSIGNS];
} VENDORCODE7, *VENDORCODE_PTR;
<2> define语句中的name是干什么的呢?struct里有这样的语法吗?
#define LM_CODE_NEW(name, x, y, k1, k2, k3, k4, k5, ver, rev, pat, beh, \
t1, t2, str) \
static VENDORCODE (name) = \
能力值:
( LV12,RANK:320 )
4 楼
第一个是对的 name是这个结构体变量的变量名
能力值:
( LV7,RANK:100 )
5 楼
谢谢evilkis兄,我还没完全看明白,还是对这个name没搞清楚。
先问下,下面这样理解对吗?是结构体申明和初始化同时进行吗?
LM_CODE_NEW(site_code, ENCRYPTION_SEED1, ENCRYPTION_SEED2,
VENDOR_KEY1, VENDOR_KEY2, VENDOR_KEY3,
VENDOR_KEY4, VENDOR_KEY5,
FLEXLM_VERSION, FLEXLM_REVISION, FLEXLM_PATCH, LM_VER_BEHAVIOR,
TRL_KEY1, TRL_KEY2, LM_STRENGTH);
=>
static VENDORCODE7 (site_code) = \
{ 4, \
{ (ENCRYPTION_SEED1)^(VENDOR_KEY5), (ENCRYPTION_SEED2)^(VENDOR_KEY5) }, \
{ (VENDOR_KEY1), (VENDOR_KEY2), (VENDOR_KEY3), (VENDOR_KEY4) }, \
(FLEXLM_VERSION), \
(FLEXLM_REVISION), \
FLEXLM_PATCH, \
LM_VER_BEHAVIOR, \
{ (TRL_KEY1), \
(TRL_KEY2) }, \
0, \
(LM_STRENGTH), \
0 \
}
=>
static struct vendorcode7 {
short type; /* Type of structure */
unsigned long data[2]; /* 64-bit code */
unsigned long keys[4];
short flexlm_version;
short flexlm_revision;
char flexlm_patch[2];
char behavior_ver[LM_MAX_BEH_VER + 1];
unsigned long trlkeys[2];
int signs; /* number of entries in pubkeyinfo */
int strength;
int sign_level;
LM_VENDORCODE_PUBKEYINFO pubkeyinfo[LM_MAXSIGNS];
} (site_code) = \
{ 4, \
{ (ENCRYPTION_SEED1)^(VENDOR_KEY5), (ENCRYPTION_SEED2)^(VENDOR_KEY5) }, \
{ (VENDOR_KEY1), (VENDOR_KEY2), (VENDOR_KEY3), (VENDOR_KEY4) }, \
(FLEXLM_VERSION), \
(FLEXLM_REVISION), \
FLEXLM_PATCH, \
LM_VER_BEHAVIOR, \
{ (TRL_KEY1), \
(TRL_KEY2) }, \
0, \
(LM_STRENGTH), \
0 \
}
能力值:
( LV12,RANK:320 )
6 楼
简单的讲LM_CODE_NEW(site_code, ENCRYPTION_SEED1, ENCRYPTION_SEED2,
VENDOR_KEY1, VENDOR......)就是定义了一个site_code结构体变量并初始化其各个域的值
能力值:
( LV7,RANK:100 )
7 楼
明白了, 之前一直对static VENDORCODE ( name) = \ 的括号不太明白,好像C语言书里定义结构体变量都不用括号啊。把括号去掉后编译下,也通过了,所以括号不括号的没影响。
谢谢evilkis兄!