您的位置:首页 > 其它

June 4th Thursday (六月 四日 木曜日)

2009-06-26 20:43 429 查看
The program can show auxiliary vectors hidden after environment and arguments.

//showall.c
#include <stdio.h>
#include <elf.h>

int main(int argc, char* argv[]) {
int *p= (int*) argv;
int i;
Elf32_auxv_t* aux;

printf("Argument count: %d/n", *(p-1));

for (i = 0; i < *(p-1); ++i) {
printf("Argument %d: %s/n", i, *(p+1));
}
p += i;
p++; // skip 0

printf("Environment:/n");
while(*p) {
printf("%s/n", *p);
p++;
}

p++;

printf("Auxiliary Vectors: /n");
aux = (Elf32_auxv_t*)p;
while(aux->a_type != AT_NULL) {
printf("Type: %02d Value: %x/n", aux->a_type, aux->a_un.a_val);
aux++;
}

return 0;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: