[SIZE=4]
//
程序正向.cpp : Defines the entry point
for
the application.
//
int fun(HWND hwnd);
int CALLBACK DialogMainProc(HWND hwndDlg,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
);
int APIENTRY WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance,
LPSTR lpCmdLine,
int nCmdShow)
{
//
TODO: Place code here.
DialogBoxParam(hInstance, MAKEINTRESOURCE(IDD_DIALOG_MAIN), NULL, DialogMainProc,NULL);
return
0;
}
int CALLBACK DialogMainProc(HWND hwndDlg,
UINT uMsg,
WPARAM wParam,
LPARAM lParam
)
{
switch (uMsg)
{
case
WM_COMMAND:
if
(wParam == IDC_BUTTON_OK)
{
fun(hwndDlg);
}
break
;
case
WM_CLOSE:
EndDialog(hwndDlg, NULL);
break
;
case
WM_DESTROY:
EndDialog(hwndDlg, NULL);
break
;
default:
return
0;
}
return
1;
}
int fun(HWND hwnd)
{
char file_old_string[20];
char string_final[] = {0xd0,0x20,0x35,0x34,0xc0,0x30,0x57,0x5e,0x40,0x50,0xbd,0x58};
char our_input[20];
int i;
int bl;
int addr;
char *p_char;
int *p_int;
int *p_int_2;
int temp;
DWORD
sum
;
char cl;
HANDLE file_handle;
/*
for
(i = 6; i > 0; i--)
//
对原始文件字符串的前6个字符进行处理
{
bl = file_old_string[6 - i];
bl = bl + i;
bl = bl ^ file_old_string[6 - i];
file_old_string[6 - i] = bl;
}*/
file_handle = CreateFile(
"blaad.xxx"
, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL,NULL);
if
(file_handle == INVALID_HANDLE_VALUE)
{
MessageBox(hwnd,
"sorry"
,
"no"
, MB_OK);
return
0;
}
ReadFile(file_handle, file_old_string, 12, &
sum
, NULL);
if
(
sum
!= 12)
{
MessageBox(hwnd,
"sorry"
,
"no"
, MB_OK);
return
0;
}
GetDlgItemText(hwnd, IDC_EDIT_INPUT, our_input, 13);
p_char = &file_old_string[6];
p_int = (int *)(p_char - 6);
temp = *p_int;
temp = temp - 0xa;
temp = temp & 0xffff;
p_int = (int *)p_char;
*p_int = *p_int ^ temp;
p_int = (int *)(p_char - 4);
temp = *p_int;
temp = temp - 0x9;
temp = temp & 0xffff;
p_int = (int *)(p_char+2);
*p_int = *p_int ^ temp;
p_int = (int *)(p_char - 2);
temp = *p_int;
temp = temp - 0x5;
temp = temp & 0xffff;
p_int = (int *)(p_char+4);
*p_int = *p_int ^ temp;
for
(i = 0; i < 12; i++)
{
file_old_string[i] ^= (i+1);
}
p_int_2 = (int *)file_old_string;
p_int = (int *)our_input;
cl = file_old_string[8];
for
(i = 0; i < 3; i++)
{
temp = *(p_int_2+i);
*(p_int+i) ^= temp;
p_char = (char *)(p_int+i);
*p_char += cl;
*(p_int+i) &= 0xfffff0f0;
}
if
(strncmp(our_input, string_final,12) == 0)
{
MessageBox(hwnd,
"yes"
,
"Ok"
, MB_OK);
return
1;
}
return
0;
}[
/SIZE
]