ANTI静态逆向代码【转自看雪】
作者:子曰 日期:2008-09-01
程序代码#include <windows.h>
#include<stdio.h>
#include<stdafx.h>
//...由于难度增加可以适当在这里加些代码
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
char* str="hello world\n";
//...这里添加代码,让IDA打开后不能直接看到调用的是MessageBoxA这个函数
(*(int (__cdecl *)(HWND,LPCTSTR,LPCTSTR,UINT))((DWORD)MoveWindow+0x3299E))(0,str,0,0);
return 0;
}
#include<stdio.h>
#include<stdafx.h>
//...由于难度增加可以适当在这里加些代码
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
char* str="hello world\n";
//...这里添加代码,让IDA打开后不能直接看到调用的是MessageBoxA这个函数
(*(int (__cdecl *)(HWND,LPCTSTR,LPCTSTR,UINT))((DWORD)MoveWindow+0x3299E))(0,str,0,0);
return 0;
}
程序代码#include <windows.h>
#include<stdio.h>
#include<stdafx.h>
//...由于难度增加可以适当在这里加些代码
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
char* str="hello world\n";
//...这里添加代码,让IDA打开后不能直接看到调用的是MessageBoxA这个函数
_asm{
pushad;
mov eax,MoveWindow;
add eax,0x3299E;
push 0;
push 0;
push str;
push 0;
call eax;
}
return 0;
}
#include<stdio.h>
#include<stdafx.h>
//...由于难度增加可以适当在这里加些代码
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
char* str="hello world\n";
//...这里添加代码,让IDA打开后不能直接看到调用的是MessageBoxA这个函数
_asm{
pushad;
mov eax,MoveWindow;
add eax,0x3299E;
push 0;
push 0;
push str;
push 0;
call eax;
}
return 0;
}
OD调了USER32.DLL,纪录了下面的信息:
引用内容名称位于 USER32, 条目 676
地址=77D1DBEC
区段=.text
类型=输出 (已知)
名称=MoveWindow
名称位于 USER32, 条目 660
地址=77D5058A
区段=.text
类型=输出 (已知)
名称=MessageBoxA
地址=77D1DBEC
区段=.text
类型=输出 (已知)
名称=MoveWindow
名称位于 USER32, 条目 660
地址=77D5058A
区段=.text
类型=输出 (已知)
名称=MessageBoxA
程序代码char*str="hello world\n";
typedef VOID (CALLBACK *MYMSGBOX)( __in_opt HWND hWnd,
__in_opt LPCSTR lpText,
__in_opt LPCSTR lpCaption,
__in UINT uType);
char szApiName[] = "\x0MessageBoxA";
char szLibName[] = "\x0user32.dll";
#define MessageBoxA(a,b,c,d) MYMSGBOX myMsgBox = (MYMSGBOX)GetProcAddress(LoadLibraryA(&szLibName[1]), &szApiName[1]); \
myMsgBox(a,b,c,d);
MessageBoxA(0,str,0,0);
typedef VOID (CALLBACK *MYMSGBOX)( __in_opt HWND hWnd,
__in_opt LPCSTR lpText,
__in_opt LPCSTR lpCaption,
__in UINT uType);
char szApiName[] = "\x0MessageBoxA";
char szLibName[] = "\x0user32.dll";
#define MessageBoxA(a,b,c,d) MYMSGBOX myMsgBox = (MYMSGBOX)GetProcAddress(LoadLibraryA(&szLibName[1]), &szApiName[1]); \
myMsgBox(a,b,c,d);
MessageBoxA(0,str,0,0);
评论: 0 | 引用: 0 | 查看次数: -
发表评论
上一篇
下一篇

文章来自:
Tags: