Lines Matching refs:pDexFile
105 const char* dexStringAndSizeById(const DexFile* pDexFile, u4 idx,
107 const DexStringId* pStringId = dexGetStringId(pDexFile, idx);
108 const u1* ptr = pDexFile->baseAddr + pStringId->stringDataOff;
177 static void classLookupAdd(DexFile* pDexFile, DexClassLookup* pLookup,
181 (const char*) (pDexFile->baseAddr + stringOff);
183 (const DexClassDef*) (pDexFile->baseAddr + classDefOff);
211 DexClassLookup* dexCreateClassLookup(DexFile* pDexFile)
220 assert(pDexFile != NULL);
229 numEntries = dexRoundUpPower2(pDexFile->pHeader->classDefsSize * 2);
239 for (i = 0; i < (int)pDexFile->pHeader->classDefsSize; i++) {
243 pClassDef = dexGetClassDef(pDexFile, i);
244 pString = dexStringByTypeIdx(pDexFile, pClassDef->classIdx);
246 classLookupAdd(pDexFile, pLookup,
247 (u1*)pString - pDexFile->baseAddr,
248 (u1*)pClassDef - pDexFile->baseAddr, &numProbes);
257 pDexFile->pHeader->classDefsSize, numEntries,
258 (100 * pDexFile->pHeader->classDefsSize) / numEntries,
269 void dexFileSetupBasicPointers(DexFile* pDexFile, const u1* data) {
272 pDexFile->baseAddr = data;
273 pDexFile->pHeader = pHeader;
274 pDexFile->pStringIds = (const DexStringId*) (data + pHeader->stringIdsOff);
275 pDexFile->pTypeIds = (const DexTypeId*) (data + pHeader->typeIdsOff);
276 pDexFile->pFieldIds = (const DexFieldId*) (data + pHeader->fieldIdsOff);
277 pDexFile->pMethodIds = (const DexMethodId*) (data + pHeader->methodIdsOff);
278 pDexFile->pProtoIds = (const DexProtoId*) (data + pHeader->protoIdsOff);
279 pDexFile->pClassDefs = (const DexClassDef*) (data + pHeader->classDefsOff);
280 pDexFile->pLinkData = (const DexLink*) (data + pHeader->linkOff);
291 DexFile* pDexFile = NULL;
301 pDexFile = (DexFile*) malloc(sizeof(DexFile));
302 if (pDexFile == NULL)
304 memset(pDexFile, 0, sizeof(DexFile));
317 pDexFile->pOptHeader = (const DexOptHeader*) data;
319 pDexFile->pOptHeader->dexOffset, pDexFile->pOptHeader->flags);
322 if (!dexParseOptData(data, length, pDexFile))
326 data += pDexFile->pOptHeader->dexOffset;
327 length -= pDexFile->pOptHeader->dexOffset;
328 if (pDexFile->pOptHeader->dexLength > length) {
330 pDexFile->pOptHeader->dexLength, (int) length);
333 length = pDexFile->pOptHeader->dexLength;
336 dexFileSetupBasicPointers(pDexFile, data);
337 pHeader = pDexFile->pHeader;
359 const DexOptHeader* pOptHeader = pDexFile->pOptHeader;
416 if (result != 0 && pDexFile != NULL) {
417 dexFileFree(pDexFile);
418 pDexFile = NULL;
420 return pDexFile;
428 void dexFileFree(DexFile* pDexFile)
430 if (pDexFile == NULL)
433 free(pDexFile);
441 const DexClassDef* dexFindClass(const DexFile* pDexFile,
444 const DexClassLookup* pLookup = pDexFile->pClassLookup;
465 str = (const char*) (pDexFile->baseAddr + offset);
468 (pDexFile->baseAddr + pLookup->table[idx].classDefOffset);