计算结构体基地址的宏定义
2017-06-22 17:43
190 查看
前言:2014-08-06记录在hi baidu上,现在移过来
winnt.h中定义的宏
(ULONG_PTR)(&((type*)0)->field) 计算field相对于基地址的偏移
winnt.h中定义的宏
// // Calculate the address of the base of the structure given its type, and an // address of a field within the structure. // #define CONTAINING_RECORD(address, type, field) ((type *)( \ (PCHAR)(address) - \ (ULONG_PTR)(&((type *)0)->field)))
(ULONG_PTR)(&((type*)0)->field) 计算field相对于基地址的偏移
相关文章推荐
- 通过结构体某个成员的地址计算结构体首地址[转]
- 计算结构体首地址的技巧
- 通过结构体某个成员的地址计算结构体首地址[转]
- 通过结构体某个成员的地址计算结构体首地址
- C语言地址对齐(转)--网络编程之结构体大小的计算
- 计算结构体成员地址偏移量...
- C语言计算一个结构体内成员地址的偏移量的两种方法(代码实例)
- 求取结构体成员偏移量的宏定义
- (1)套接口地址结构和数据类型
- 彻底明白IP地址——计算相关地址
- 通过IP地址和子网掩码与运算计算相关地址
- ACE 类层次结构 文档地址
- 1.套接口地址结构
- socket 的地址结构
- 构筑无所不在计算的基础—TRON技术体系结构
- 彻底明白IP地址――计算相关地址 [收藏]
- 获得计算CPU,网卡硬件地址,获取硬盘ID
- 数据结构(严蔚敏)计算1-1/x+1/x*x…(第一章)
- 9-73 利用java.net URLConnection类和Cgi计算结构来 实现网络主页计数器
- vxworks一些宏定义地址