能力值:
( LV3,RANK:20 )
|
-
-
30 楼
16还是12是因为编译平台的差异,最保险的方式是安装下面的方式访问
/*结构体内最大成员对齐 sizeof(ArrayObject) = 24*/
char *fileContent = (char *) malloc(sizeof(ArrayObject) + dexLen);//所有指针为4字节
ArrayObject *fileContentObj = (ArrayObject *) fileContent;
fileContentObj->length = dexLen;
//memcpy(fileContent + 16, dexBytes, dexLen); //因为按照最大字节对齐 4+4, 4+()
memcpy(fileContentObj->contents, dexBytes, dexLen)
u4* args = (u4*) &fileContentObj; // args => fileContentunion
JValue pResult;
int cookie;
if(openDexFile != NULL){
openDexFile(args, &pResult);
}else{
cookie = -1;
}
|
|
|