• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C++ FLIPENDIAN函数代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C++中FLIPENDIAN函数的典型用法代码示例。如果您正苦于以下问题:C++ FLIPENDIAN函数的具体用法?C++ FLIPENDIAN怎么用?C++ FLIPENDIAN使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。



在下文中一共展示了FLIPENDIAN函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。

示例1: attrKeyWrite

static int attrKeyWrite(off_t offset, BTKey* toWrite, io_func* io) {
	HFSPlusAttrKey* key;
	uint16_t keyLength;
	uint16_t nodeNameLength;
	int i;

	keyLength = toWrite->keyLength;
	key = (HFSPlusAttrKey*) malloc(keyLength);
	memcpy(key, toWrite, keyLength);

	nodeNameLength = key->name.length;

	FLIPENDIAN(key->keyLength);
	FLIPENDIAN(key->fileID);
	FLIPENDIAN(key->startBlock);
	FLIPENDIAN(key->name.length);

	for(i = 0; i < nodeNameLength; i++) {
		FLIPENDIAN(key->name.unicode[i]);
	}

	if(!WRITE(io, offset, keyLength, key))
		return FALSE;

	free(key);

	return TRUE;
}
开发者ID:114577922,项目名称:xpwn,代码行数:28,代码来源:xattr.c


示例2: attrKeyRead

static BTKey* attrKeyRead(off_t offset, io_func* io) {
	int i;
	HFSPlusAttrKey* key;

	key = (HFSPlusAttrKey*) malloc(sizeof(HFSPlusAttrKey));

	if(!READ(io, offset, UNICODE_START, key))
		return NULL;

	FLIPENDIAN(key->keyLength);
	FLIPENDIAN(key->fileID);
	FLIPENDIAN(key->startBlock);
	FLIPENDIAN(key->name.length);
	
	if(key->name.length > 254)
	{
		printf("Invalid xattr key at offset %x\n", offset);
		free(key);
		return NULL;
	}

	if(!READ(io, offset + UNICODE_START, key->name.length * sizeof(uint16_t), ((unsigned char *)key) + UNICODE_START))
		return NULL;

	for(i = 0; i < key->name.length; i++) {
		FLIPENDIAN(key->name.unicode[i]);
	}

	return (BTKey*)key;
}
开发者ID:0bj3ct1veC,项目名称:iphone-dataprotection,代码行数:30,代码来源:xattr.c


示例3: decrypt_key

uint8* decrypt_key(const char* filesystem, uint8* passphrase) {
  int i = 0;
  EVP_CIPHER_CTX ctx;
  uint8 data[0x30];
  int outlen, tmplen = 0;
  
  FILE* fd = fopen(filesystem, "rb");
  if (fd == NULL) {
    fprintf(stderr, "error opening file: %s", filesystem);
    return NULL;
  }
  
  uint8* buffer = (uint8*) malloc(BUF_SIZE);
  if(buffer == NULL) {
  	fprintf(stderr, "unable to allocate memory\n");
  	fclose(fd);
  	return NULL;
  }
  
  fread(buffer, 1, sizeof(encrcdsa_header), fd);
  
  uint32 blocks = 0;
  fread(&blocks, 1, sizeof(uint32), fd);
  FLIPENDIAN(blocks);
  
  fread(buffer, 1, sizeof(encrcdsa_block) * blocks, fd);
  fread(buffer, 1, 0x80, fd);
  
  uint32 skip = 0;
  fread(&skip, 1, sizeof(uint32), fd);
  FLIPENDIAN(skip);
  fread(buffer, 1, skip-3, fd);
		
  uint8* out = malloc(0x30);
  free(buffer);

  for (i = 0; i < 0x20; i++) {
    if (fread(data, 1, 0x30, fd) <= 0) {
      fprintf(stderr, "Error reading filesystem image");
      free(out);
      return NULL;
    }
    
    if(data[0] == 0) break;

    EVP_CIPHER_CTX_init(&ctx);
    EVP_DecryptInit_ex(&ctx, EVP_des_ede3_cbc(), NULL, passphrase,
        &passphrase[24]);

    EVP_DecryptUpdate(&ctx, out, &outlen, data, 0x30);
    if (EVP_DecryptFinal_ex(&ctx, out + outlen, &tmplen)) {
      return out;
    }
    
    fseek(fd, 0x238, SEEK_CUR);
  }

  fclose(fd);
  return out;
}
开发者ID:At0mx,项目名称:genpass,代码行数:60,代码来源:genpass.c


示例4: flipCompHeader

void flipCompHeader(CompHeader* header) {
    FLIPENDIAN(header->signature);
    FLIPENDIAN(header->compression_type);
    FLIPENDIAN(header->checksum);
    FLIPENDIAN(header->length_uncompressed);
    FLIPENDIAN(header->length_compressed);
}
开发者ID:nlog2n,项目名称:xpwntool-lite,代码行数:7,代码来源:lzssfile.c


示例5: catalogKeyWrite

static int catalogKeyWrite(off_t offset, BTKey* toWrite, io_func* io) {
  HFSPlusCatalogKey* key;
  uint16_t i;
  uint16_t keyLength;
  uint16_t nodeNameLength;
  
  keyLength = toWrite->keyLength + sizeof(uint16_t);
  key = (HFSPlusCatalogKey*) malloc(keyLength);
  memcpy(key, toWrite, keyLength);
  
  nodeNameLength = key->nodeName.length;
  
  FLIPENDIAN(key->keyLength);
  FLIPENDIAN(key->parentID);
  FLIPENDIAN(key->nodeName.length);
  
  for(i = 0; i < nodeNameLength; i++) {
	if(key->nodeName.unicode[i] == ':') /* ugly hack that iPhone seems to do */
		key->nodeName.unicode[i] = '/';

    FLIPENDIAN(key->nodeName.unicode[i]);
  }
 
  if(!WRITE(io, offset, keyLength, key))
    return FALSE;
  
  free(key);
    
  return TRUE;
}
开发者ID:mucit,项目名称:opensn0w,代码行数:30,代码来源:catalog.c


示例6: flipForkData

void flipForkData(HFSPlusForkData* forkData) {
	FLIPENDIAN(forkData->logicalSize);
	FLIPENDIAN(forkData->clumpSize);
	FLIPENDIAN(forkData->totalBlocks);

	flipExtentRecord(&forkData->extents);
}
开发者ID:Anon0,项目名称:openiBoot,代码行数:7,代码来源:volume.c


示例7: flipCSumResource

static void flipCSumResource(unsigned char* data, char out) {
  CSumResource* cSum;
  
  cSum = (CSumResource*) data;
  
  FLIPENDIAN(cSum->version);
  FLIPENDIAN(cSum->type);
  FLIPENDIAN(cSum->checksum);
}
开发者ID:GEBIT,项目名称:libdmg-hfsplus,代码行数:9,代码来源:resources.c


示例8: flipHFSPlusCmpfEnd

void flipHFSPlusCmpfEnd(HFSPlusCmpfEnd* data) {
	FLIPENDIAN(data->unk1);
	FLIPENDIAN(data->unk2);
	FLIPENDIAN(data->unk3);
	FLIPENDIAN(data->magic);
	FLIPENDIAN(data->flags);
	FLIPENDIANLE(data->size);
	FLIPENDIANLE(data->unk4);
}
开发者ID:0bj3ct1veC,项目名称:xpwn,代码行数:9,代码来源:hfscompress.c


示例9: extentKeyRead

static BTKey* extentKeyRead(off_t offset, io_func* io) {
    HFSPlusExtentKey* key;

    key = (HFSPlusExtentKey*) malloc(sizeof(HFSPlusExtentKey));

    if(!READ(io, offset, sizeof(HFSPlusExtentKey), key))
        return NULL;

    FLIPENDIAN(key->keyLength);
    FLIPENDIAN(key->forkType);
    FLIPENDIAN(key->fileID);
    FLIPENDIAN(key->startBlock);

    return (BTKey*)key;
}
开发者ID:zebbra2014,项目名称:openiBoot,代码行数:15,代码来源:extents.c


示例10: cacheChunk

static void cacheChunk(FileVaultInfo* info, uint32_t chunk) {
	unsigned char buffer[info->blockSize];
	unsigned char msgDigest[FILEVAULT_MSGDGST_LENGTH];
	uint32_t msgDigestLen;

	if(chunk == info->curChunk) {
		return;
	}

	if(info->dirty) {
		writeChunk(info);
	}

	info->file->seek(info->file, chunk * info->blockSize + info->dataOffset);
	info->file->read(info->file, buffer, info->blockSize);

	info->curChunk = chunk;

	FLIPENDIAN(chunk);
	HMAC_Init_ex(&(info->hmacCTX), NULL, 0, NULL, NULL);
	HMAC_Update(&(info->hmacCTX), (unsigned char *) &chunk, sizeof(uint32_t));
	HMAC_Final(&(info->hmacCTX), msgDigest, &msgDigestLen);

	AES_cbc_encrypt(buffer, info->chunk, info->blockSize, &(info->aesKey), msgDigest, AES_DECRYPT);
}
开发者ID:Accusedbold,项目名称:shoes,代码行数:25,代码来源:filevault.c


示例11: duplicateAbstractFile

AbstractFile* duplicateAbstractFile(AbstractFile* file, AbstractFile* backing) {
	uint32_t signatureBE;
	uint32_t signatureLE;
	AbstractFile* orig;

	if (!backing) { /* imagine that: createAbstractFileFromComp() fails, because of decompress_lzss() */
		return NULL;
	}
	
	file->seek(file, 0);
	file->read(file, &signatureBE, sizeof(signatureBE));
	signatureLE = signatureBE;
	FLIPENDIAN(signatureBE);
	FLIPENDIANLE(signatureLE);
	file->seek(file, 0);
	
	if(signatureLE == IMG2_SIGNATURE) {
		orig = createAbstractFileFromImg2(file);
		return duplicateAbstractFile(orig, duplicateImg2File(orig, backing));
	} else if(signatureLE == IMG3_SIGNATURE) {
		orig = createAbstractFileFromImg3(file);
		return duplicateAbstractFile(orig, duplicateImg3File(orig, backing));
	} else if(signatureBE == COMP_SIGNATURE) {
		orig = createAbstractFileFromComp(file);
		return duplicateAbstractFile(orig, duplicateCompFile(orig, backing));
	} else {
		file->close(file);
		return backing;
	}
}
开发者ID:nlog2n,项目名称:xpwntool-lite,代码行数:30,代码来源:nor_files.c


示例12: sizeof

AbstractFile *openAbstractFile(AbstractFile * file)
{
	uint32_t signatureBE;
	uint32_t signatureLE;

	if (!file)
		return NULL;

	file->seek(file, 0);
	file->read(file, &signatureBE, sizeof(signatureBE));
	signatureLE = signatureBE;
	FLIPENDIAN(signatureBE);
	FLIPENDIANLE(signatureLE);
	file->seek(file, 0);
	if (signatureBE == SIGNATURE_8900) {
		return openAbstractFile(createAbstractFileFrom8900(file));
	} else if (signatureLE == IMG2_SIGNATURE) {
		return openAbstractFile(createAbstractFileFromImg2(file));
	} else if (signatureLE == IMG3_SIGNATURE) {
		return openAbstractFile(createAbstractFileFromImg3(file));
	} else if (signatureBE == COMP_SIGNATURE) {
		return openAbstractFile(createAbstractFileFromComp(file));
	} else {
		return file;
	}
}
开发者ID:123457890b,项目名称:opensn0w,代码行数:26,代码来源:nor_files.c


示例13: flipUDIFChecksum

void flipUDIFChecksum(UDIFChecksum* o, char out) {
  int i;

  FLIPENDIAN(o->type);
  
  if(out) {
    for(i = 0; i < o->size; i++) {
      FLIPENDIAN(o->data[i]);
    }
    FLIPENDIAN(o->size);
  } else {
    FLIPENDIAN(o->size);
    for(i = 0; i < o->size; i++) {
      FLIPENDIAN(o->data[i]);
    }
  }
}
开发者ID:1butler1,项目名称:xpwn,代码行数:17,代码来源:udif.c


示例14: extentKeyWrite

static int extentKeyWrite(off_t offset, BTKey* toWrite, io_func* io) {
    HFSPlusExtentKey* key;

    key = (HFSPlusExtentKey*) malloc(sizeof(HFSPlusExtentKey));

    memcpy(key, toWrite, sizeof(HFSPlusExtentKey));

    FLIPENDIAN(key->keyLength);
    FLIPENDIAN(key->forkType);
    FLIPENDIAN(key->fileID);
    FLIPENDIAN(key->startBlock);

    if(!WRITE(io, offset, sizeof(HFSPlusExtentKey), key))
        return FALSE;

    free(key);

    return TRUE;
}
开发者ID:zebbra2014,项目名称:openiBoot,代码行数:19,代码来源:extents.c


示例15: catalogDataRead

static BTKey* catalogDataRead(off_t offset, io_func* io) {
  int16_t recordType;
  HFSPlusCatalogRecord* record;
  uint16_t nameLength;
  
  if(!READ(io, offset, sizeof(int16_t), &recordType))
    return NULL;
    
  FLIPENDIAN(recordType); fflush(stdout);

  switch(recordType) {
    case kHFSPlusFolderRecord:
      record = (HFSPlusCatalogRecord*) malloc(sizeof(HFSPlusCatalogFolder));
      if(!READ(io, offset, sizeof(HFSPlusCatalogFolder), record))
        return NULL;
      flipCatalogFolder((HFSPlusCatalogFolder*)record);
      break;
      
    case kHFSPlusFileRecord:
      record = (HFSPlusCatalogRecord*) malloc(sizeof(HFSPlusCatalogFile));
      if(!READ(io, offset, sizeof(HFSPlusCatalogFile), record))
        return NULL;
      flipCatalogFile((HFSPlusCatalogFile*)record);
      break;
      
    case kHFSPlusFolderThreadRecord:
    case kHFSPlusFileThreadRecord:
      record = (HFSPlusCatalogRecord*) malloc(sizeof(HFSPlusCatalogThread));
      
      if(!READ(io, offset + sizeof(uint16_t) + sizeof(uint16_t) + sizeof(uint32_t), sizeof(uint16_t), &nameLength))
        return NULL;

      FLIPENDIAN(nameLength);
      
      if(!READ(io, offset, sizeof(uint16_t) + sizeof(uint16_t) + sizeof(uint32_t) + sizeof(uint16_t) + (sizeof(uint16_t) * nameLength), record))
        return NULL;
      
      flipCatalogThread((HFSPlusCatalogThread*)record, FALSE);
      break;
  }

  return (BTKey*)record;
}
开发者ID:mucit,项目名称:opensn0w,代码行数:43,代码来源:catalog.c


示例16: flipApple8900Header

void flipApple8900Header(Apple8900Header* header) {
	FLIPENDIAN(header->magic);
	FLIPENDIANLE(header->unknown1);
	FLIPENDIANLE(header->sizeOfData);
	FLIPENDIANLE(header->footerSignatureOffset);
	FLIPENDIANLE(header->footerCertOffset);
	FLIPENDIANLE(header->footerCertLen);
	FLIPENDIANLE(header->unknown2);
	FLIPENDIANLE(header->epoch);
}
开发者ID:ashamsu,项目名称:FirmExtract,代码行数:10,代码来源:8900.c


示例17: flipSizeResource

static void flipSizeResource(unsigned char* data, char out) {
  SizeResource* size;
  
  size = (SizeResource*) data;
  
  FLIPENDIAN(size->version);
  FLIPENDIAN(size->isHFS);
  FLIPENDIAN(size->unknown2);
  FLIPENDIAN(size->unknown3);
  FLIPENDIAN(size->volumeModified);
  FLIPENDIAN(size->unknown4);
  FLIPENDIAN(size->volumeSignature);
  FLIPENDIAN(size->sizePresent);
}
开发者ID:GEBIT,项目名称:libdmg-hfsplus,代码行数:14,代码来源:resources.c


示例18: flipCatalogThread

void flipCatalogThread(HFSPlusCatalogThread* record, int out) {
  int i;
  int nameLength;
  
  FLIPENDIAN(record->recordType);
  FLIPENDIAN(record->parentID);
  if(out) {
    nameLength = record->nodeName.length;
    FLIPENDIAN(record->nodeName.length);
  } else {
    FLIPENDIAN(record->nodeName.length);
    nameLength = record->nodeName.length;
  }
  
  for(i = 0; i < nameLength; i++) {
    if(out) {
	  if(record->nodeName.unicode[i] == ':') {
	    record->nodeName.unicode[i] = '/';
	  }
	  FLIPENDIAN(record->nodeName.unicode[i]);
	} else {	
	  FLIPENDIAN(record->nodeName.unicode[i]);
	  if(record->nodeName.unicode[i] == '/') {
	    record->nodeName.unicode[i] = ':';
	  }
	}
  }
}
开发者ID:mucit,项目名称:opensn0w,代码行数:28,代码来源:catalog.c


示例19: flipCatalogFile

void flipCatalogFile(HFSPlusCatalogFile* record) {
  FLIPENDIAN(record->recordType);
  FLIPENDIAN(record->flags);
  FLIPENDIAN(record->fileID);
  FLIPENDIAN(record->createDate);
  FLIPENDIAN(record->contentModDate);
  FLIPENDIAN(record->attributeModDate);
  FLIPENDIAN(record->accessDate);
  FLIPENDIAN(record->backupDate);
  
  flipBSDInfo(&record->permissions);
  flipFileInfo(&record->userInfo);
  flipExtendedFileInfo(&record->finderInfo);
  
  FLIPENDIAN(record->textEncoding);
  
  flipForkData(&record->dataFork);
  flipForkData(&record->resourceFork);
}
开发者ID:mucit,项目名称:opensn0w,代码行数:19,代码来源:catalog.c


示例20: doPartialSHA1

static void
doPartialSHA1(unsigned char md[SHA_DIGEST_LENGTH], const unsigned char *toHashData, int toHashLength, DataValue *partialDigest)
{
	const unsigned *q = (const unsigned *)partialDigest->value;
	unsigned v31 = q[0]; // XXX ASSERT(v31 == ecid->size == 64)?
	unsigned v32 = q[1];
	SHA_CTX hashctx;
	memset(&hashctx, 0, sizeof(hashctx));
	hashctx.h0 = q[2];
	hashctx.h1 = q[3];
	hashctx.h2 = q[4];
	hashctx.h3 = q[5];
	hashctx.h4 = q[6];
	FLIPENDIAN(hashctx.h0);
	FLIPENDIAN(hashctx.h1);
	FLIPENDIAN(hashctx.h2);
	FLIPENDIAN(hashctx.h3);
	FLIPENDIAN(hashctx.h4);
	FLIPENDIANLE(v32);
	hashctx.Nl = 8 * v32 + 64; // XXX could this 64 be actually v31?
	SHA1_Update(&hashctx, toHashData, toHashLength);
	SHA1_Final(md, &hashctx);
}
开发者ID:0neday,项目名称:xpwn,代码行数:23,代码来源:validate.c



注:本文中的FLIPENDIAN函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C++ FLOAT函数代码示例发布时间:2022-05-30
下一篇:
C++ FLINT_TEST_INIT函数代码示例发布时间:2022-05-30
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap