双层指针的使用

双层指针一般不被使用。

目前只遇到过以下情况需要使用:

需要通过函数调用去修改一个指针的时候。

数据结构:

struct HashInfoType{
    uint32_t StartAddr;
    uint32_t SizeSendby0x34;
    uint32_t expandedSize; /* for un-compressed data, it's equal to SizeSendby0x34; for compressed data, it's much bigger than SizeSendby0x34 */
    uint32_t AccumulatedSha256Size; /* */
    unsigned char HashValueArray[32];
};

struct HashInfoTypeArray{
    uint16_t blockIndex; //private variable.
    struct HashInfoType content[MAX_TRANSFER_DATA_BLOCKS];
};
/*
 * In order to modify the following variable.
 *  hash_value_arrays[]
 *  double pointer syntax is used.
 *
 *   */
int signv_find_hashvalue_by_addr(uint32_t addr, unsigned char **hash_value_arrays)
{
    int i;
    int ret = -1; //0 means OK
    for(i = 0; i < blocksHash.blockIndex; i++)
    {
        if(blocksHash.content[i].StartAddr == addr)
        {
            *hash_value_arrays = &(blocksHash.content[i].HashValueArray[0]);
            ret = 0;
            break;
        }
    }

    return ret;
}

 

上一篇:[re入门]IDA和OD的基本使用(持续更新)(上)


下一篇:Solr配置中文分词器IKAnalyzer及增删改查调用