Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1053993
  • 博文数量: 50
  • 博客积分: 10000
  • 博客等级: 上将
  • 技术积分: 2037
  • 用 户 组: 普通用户
  • 注册时间: 2007-04-05 08:03
文章分类
文章存档

2011年(1)

2010年(3)

2009年(17)

2008年(29)

我的朋友

分类: WINDOWS

2009-05-26 00:03:13

 

;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
;code by laomms
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>

.586
.model flat, stdcall 
option casemap :none 
include windows.inc
include masm32.inc
include gdi32.inc
include ole32.inc
include user32.inc
include comctl32.inc
include kernel32.inc
include shell32.inc

includelib masm32.lib
includelib gdi32.lib
includelib ole32.lib
includelib oleaut32.lib
includelib user32.lib
includelib comctl32.lib
includelib kernel32.lib
includelib shell32.lib

DlgProc                 proto :HWND,:UINT,:WPARAM,:LPARAM
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
ico                  equ 2001
IDD_DLG1                equ 1000
IDC_NAME                equ 1001
IDC_CODE                equ 1002
IDC_OK                  equ 1005
IDC_ABOUT               equ 1006
;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>
CTEXT    MACRO y:VARARG
    LOCAL sym
    CONST segment
    ifidni ,<>           
        sym db 0       
    else           
        sym db y,0
    endif
    CONST ends
    exitm
ENDM

    
.data 
BREAK_POINT1   dd 0046CDF6h
RetAddr1       dd 0046CE00h
BREAK_POINT2   dd 0046B744h
RetAddr2       dd 0046B74Eh
      
.data?
UserID        db 80 dup (?)
Serial        db 80 dup (?)
value         db 8 dup(?)
hInstance   dd ?  
ProcessId   dd ?
ThreadId    dd ?
lpbaseaddr  dd ?
hProcess    dd ?
hThread     dd ?
hDlg        dd ?
hMenu       dd ?
lpHandle    dd ?

.code   
include lpk.inc 
 
DllMain proc hinstdll:DWORD , reason:DWORD , reserved1:DWORD
        pushad                                  
        .if reason == DLL_PROCESS_ATTACH
                push hinstdll
                pop  hInstance
                call LoadDebug
                call FindDebug

        .elseif reason == DLL_PROCESS_DETACH 
       
        .elseif reason == DLL_THREAD_ATTACH
       
        .endif
        popad
        mov  eax,1
        ret    
DllMain  endp
DlgProc proc hWin:HWND,uMsg:UINT,wParam:WPARAM,lParam:LPARAM
        mov eax,uMsg
        .if     eax==WM_CLOSE
                invoke EndDialog,hWin,0
        .elseif eax==WM_INITDIALOG
                push hWin
                pop  hDlg  
                invoke LoadIcon,hInstance,ico
                invoke SendMessage,hDlg,WM_SETICON,1,eax 
                invoke SetWindowPos,hDlg, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE or SWP_NOMOVE
        .elseif eax==WM_COMMAND
                mov eax,wParam
                .if eax==IDC_OK               
                        invoke GetDlgItemText,hDlg,IDC_NAME,addr UserID,Sizeof UserID                                                       
                        .if eax==0
                                invoke MessageBox,hDlg,CTEXT("输入一个要计算的机器码"), CTEXT("提示"),MB_OK
                        .elseif
                                invoke GetDlgItem,hDlg,IDC_OK
                                invoke EnableWindow,eax,FALSE
                                invoke SetWindowPos,hDlg,HWND_BOTTOM,0, 0, 0, 0, SWP_NOSIZE or SWP_NOMOVE
                                call GetKey
                        .endif
                .elseif eax==IDC_ABOUT
                        invoke MessageBox,hDlg,CTEXT("keygen for carckme"), CTEXT("about"),MB_OK
                .endif           
        .else
                mov eax,FALSE
                ret
        .endif
        mov eax,TRUE
        ret
DlgProc endp

;>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>   
MyAPI1   DB 068h                      
         DD offset Hook1
         DB 0c3h,90h,90h 
MyAPI2   DB 068h                      
         DD offset Hook2
         DB 0c3h,90h,90h 

Hook1   Proc
;0046CDF6   .  50            push    eax
;0046CDF7   .  8D55 E4       lea     edx, dword ptr [ebp-1Ch]
;0046CDFA   .  8B83 08030000 mov     eax, dword ptr [ebx+308h]
;0046CE00   .  E8 5FD0FCFF   call    00439E64

        pushad 
        lea edx,offset UserID
        invoke lstrcpyn,eax,addr UserID,sizeof UserID
 popad 
 push    eax
 lea     edx, dword ptr [ebp-1Ch]
 mov     eax, dword ptr [ebx+308h]
 push RetAddr1  
 ret
Hook1   endp
Hook2   Proc
;0046B744  |.  8B4D F0       mov     ecx, dword ptr [ebp-10h]
;0046B747  |.  8A4C01 CF     mov     cl, byte ptr [ecx+eax-31h]
;0046B74B  |.  8B75 FC       mov     esi, dword ptr [ebp-4]
;0046B74E  |.  3A4C06 CF     cmp     cl, byte ptr [esi+eax-31h]


        mov     ecx, dword ptr [ebp-10h]
        pushad
        invoke lstrcpy,addr value,ecx
        invoke SetDlgItemText,hDlg,IDC_CODE,addr value
        invoke SetWindowPos,hDlg, HWND_TOPMOST, 0, 0, 0, 0, SWP_NOSIZE or SWP_NOMOVE
        popad  
        mov     esi, dword ptr [ebp-4h]         
        pushad 
 mov     cl, byte ptr [ecx+eax-31h]
 mov     esi, dword ptr [ebp-4]                 
 push RetAddr2  
 ret
Hook2   endp
GetKey proc
        invoke GetCurrentProcessId
        mov ProcessId,eax
        invoke OpenProcess , PROCESS_ALL_ACCESS ,0, ProcessId
        mov hProcess,eax  
        invoke WriteProcessMemory,hProcess,BREAK_POINT1,offset MyAPI1,7,0
        invoke WriteProcessMemory,hProcess,BREAK_POINT2,offset MyAPI2,7,0
        invoke CloseHandle,hProcess
        ret

GetKey endp


END  DllMain

阅读(3125) | 评论(2) | 转发(0) |
给主人留下些什么吧!~~

chinaunix网友2009-10-18 01:44:15

VC的LPK源码编译出来的LPK.dll可以正常加载,而我写的win32ASM的LPK源码却总加载不上。。。这是什么原因???有什么要注意的地方??? 多谢指点!

chinaunix网友2009-10-18 00:43:30

call FindDebug 这个函数在哪??? 能不能放上来一下。。。非常感谢!!!