- 博客(105)
- 资源 (201)
- 收藏
- 关注
原创 void*和类成员函数指针的相互转换
linux环境下,示例代码如下,#include #include #include #include class class1{public: class1() { b = 10; } int memfunc1(int a) { printf("memfunc1
2014-11-11 13:15:15
2395
转载 GCC内嵌汇编简单实例
经常会在linux内核中看到汇编,而这个汇编又和正常的汇编不太一样,这个就是GCC中的内嵌汇编了。前先天,在移植dvb的frontend的时候看到了mb();这个函数,发现最终其执行的就是 [html] view plaincopy#define barrier __asm__ __volatile__(“”: : : “memory”)
2014-09-21 00:39:03
887
原创 ptrace截获其他进程系统调用
int main(int argc, char *argv[]){ if (net_init() != 0) { printf("net init fail\n"); MYLOG("net init fail"); return -1; } pid_t traced_process; struct user_regs_struct regs; long ins
2014-07-29 14:03:36
785
原创 wireshark插件
按照http://www.wireshark.org/docs/wsdg_html_chunked/ChSetupWin32.html 的提示下载源码包nmake -f Makefile.nmake plugins
2014-07-22 21:19:40
682
转载 解决方案: scp/ssh 的登陆提示很慢 (Linux)
看着用 windows 的 scp 命令很快很是羡慕. 这个问题让我实实郁闷了好几天. 在 Linux 下不管是用 ssh 还是用 scp, 连接速度都很慢 (登陆提示框的弹出时间).确切地讲, 每次的登陆连接平均消耗了 30 秒! 言归正传. 如何找出究竟是什么导致了 ssh 或是 scp 的登陆很慢? 如何修复该所谓的登陆 "慢" 或 "延迟"?今天 Google 了一
2014-07-11 14:33:02
1222
原创 relocation truncated to fit: R_X86_64_32
This is due to the status data is large than2G.The problom can be solve by check the program and change thedimensions of array。 I check the program and find no problom in theprogram。So the a
2014-07-08 21:46:55
1003
转载 利用subversion(SVN)自动控制和维护代码的版本号.
Subversion 的 svn:keywordsSubversion 的 svn:keywords 是一个非常有用的功能,可以让你将发生在源代码中的一些属性的变化自动地更新到源代码中。比如你可以在客齐集社区的每一个页面的底部都看到的这样的一行字。$Id: V2EXCore.php 4 2005-10-29 23:08:09Z livid $这行字的意思是表示,V2EX
2014-07-04 15:09:28
875
转载 linux程序编译期加入编译时间和svn版本号
通常我们在程序开发时会加入版本查询命令,如:“-v”,此时一般会显示build版本,以及build日期等,因此如果每次编译时能自动添加这些信息的话,就非常方便了。下面先说说添加时间的方法:1.最简单方式,代码中直接加入宏[cpp] view plaincopy__TIME__和__DATE__ 通过他们可以直接得到编译时间,然后可以在代码里打印
2014-07-04 10:55:05
557
原创 memcpy和for循环复制的性能差距
char a[200]; char b[200]; timeval bt; gettimeofday(&bt, NULL); for (int z = 0; z < 1000; z++) { for (int j = 0; j < 1000000; j++) { //for (int i = 0; i < 10; i++) //{ // a[i] = b[i];
2014-07-02 14:11:37
4090
转载 hg下多个heads的问题
I don't think that you actually want to delete the heads. If you do that, you will lose the work that was done in those branches.You probably want to merge the heads back into one branch.Say that
2014-06-30 14:20:00
1770
转载 linux下hook函数
#include #include #include #include #include #include #include #include void set_hook(void *to_mock_func, void *mock_func) { uint8_t machine_code[]
2014-06-27 10:34:55
1157
原创 linux重载malloc
#include#include#include#define ALIAS(tc_fn) __attribute__ ((alias (#tc_fn)))extern "C" { void* malloc(size_t size) __THROW ALIAS(tc_malloc);} // extern "C"exter
2014-06-24 20:09:59
1453
原创 Go string to ascii byte array
Go string to ascii byte arraybyteArray := []byte(myString)
2014-06-03 12:46:40
2164
原创 win32的hook
int myprintf ( const char *format, ... ){ return 0;}int main(){ printf("a\n"); char * target_function = (char *)&printf; DWORD old_target_function_protect = 0; BOOL succeeded = ::Virtua
2014-05-29 14:35:49
690
转载 Win32环境下代码注入与API钩子的实现
本文详细的介绍了在Visual Studio(以下简称VS)下实现API钩子的编程方法,阅读本文需要基础:有操作系统的基本知识(进程管理,内存管理),会在VS下编写和调试Win32应用程序和动态链接库(以下简称DLL)。API钩子是一种高级编程技巧,常常用来完成一些特别的功能,比如词典软件的屏幕取词,游戏修改软件的数据修改等。当然,此技术更多的是被黑客或是病毒用来攻击其它程序,截获需要的数据或
2014-05-29 14:26:23
919
原创 find方法
find / -amin -10 # 查找在系统中最后10分钟访问的文件 find / -atime -2 # 查找在系统中最后48小时访问的文件 find / -empty # 查找在系统中为空的文件或者文件夹 find / -group cat # 查找在系统中属于 groupcat的文件 find / -mmin -5 # 查找在系统中最后5分钟里修改过的文件
2014-05-22 15:49:28
560
原创 根据int随机生成名字
static void RandStrByInt(int data, char * out, size_t size) { const char words[] = "0123456789ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"; out[size - 1] = 0;
2014-04-17 20:58:10
541
原创 undefined reference to `_Ux86_64_init_local'
链接libunwind报错undefined reference to `_Ux86_64_init_local'在include前面加宏
2014-04-15 16:03:16
2745
1
原创 graphviz画服务器架构图
digraph "DE Server Architecture" {rankdir = LR;node [width=0.375,height=0.25];Legend [shape=box,fontsize=24,shape=plaintext,label="DE Server Architecture"];gameserver1 [label="gameserver1",shape=
2014-04-13 15:47:56
1944
1
原创 简化移植google profiler
void StartProfiler(){ // 定时器 struct itimerval timer; timer.it_interval.tv_sec = 0; timer.it_interval.tv_usec = 10000; // 0.01秒 timer.it_value = timer.it_interval; setitimer(IT
2014-04-12 22:41:18
758
转载 backtrace获取堆栈
#include #include #include #include #include #include void backtrace(){ const int maxLevel = 200; void* buffer[maxLevel]; int level = backtrace(buffer, maxLevel); const int SIZE
2014-04-12 17:30:19
612
转载 linux command
CommandDescription•apropos whatisShow commands pertinent to string. See also threadsafe•man -t ascii | ps2pdf - > ascii.pdfmake a pdf of a manual page which commandSh
2014-04-05 11:51:57
870
原创 安全的str操作
template int STR_N_CMP(const char (&dest)[N], const char *src){ return strncmp(dest, src, sizeof(dest));}
2014-04-04 15:17:42
519
转载 重载malloc
#include #include /* Prototypes for our hooks. */static void my_init_hook(void);static void *my_malloc_hook(size_t, const void *);/* Variables to save original hooks. */static void *(*old_mallo
2014-03-29 16:43:02
2099
snappy-1.0.5.tar.gz
2012-11-02
x86 Assembly Language Reference Manual
2014-09-19
System V Application Binary Interface AMD64 Architecture Processor Supplement
2015-01-05
空空如也
TA创建的收藏夹 TA关注的收藏夹
TA关注的人
RSS订阅