驱动程序开发网技术社区 » 病毒技术分析 » 怎么得到kernel32.lib的基地址? (转到动态网页)
本页主题: 怎么得到kernel32.lib的基地址? 加为IE收藏 | 收藏主题 | 上一主题 | 下一主题

poul821201
级别: 驱动牛犊


精华: 0
发帖: 3
威望: 4 点
积分: 2 分
贡献值: 0 点
好评度: 2 点
原创分: 0 分
注册时间:2007-04-04
最后登录:2008-08-07

 怎么得到kernel32.lib的基地址?

请教一个获得kernel32.lib在虚存中的起始地址的问题
代码贴上,程序能编译,链接但不能运行
....
.code
_SEHHandler     proc    C _lpExceptionRecord,\
                      _lpSEH,_lpContext,_lpDispatcherContext
              pushad
              mov    esi,_lpExceptionRecord
              mov    edi,_lpContext
              mov    eax,_lpSEH
              assume esi:ptr EXCEPTION_RECORD,edi:ptr CONTEXT
              push    [eax+0ch]
              pop        [edi].regEbp
              push    [eax+8]
              pop        [edi].regEip
              push    eax
              pop        [edi].regEsp
              assume    esi:nothing,edi:nothing
              popad
              mov        eax,ExceptionContinueExecution
              ret
              
_SEHHandler        endp

_GetKernelBase proc  _dwKernelRet
               local @dwReturn
              
               assume    fs:nothing
                             push    ebp
                             lea  eax,[offset PageError]
                             push    eax
                             lea  eax,[offset _SEHHandler]
                             push eax
                             push fs:[0]
                             mov  fs:[0],esp
              
               mov     edi,_dwKernelRet
                             and    edi,0ffff0000h
                             .while TRUE
                                 .if   word ptr [edi] ==IMAGE_DOS_SIGNATURE
                                       mov  esi,edi
                                       add  esi,[esi+03ch]
                                       .if  word ptr [esi]==IMAGE_NT_SIGNATURE
                                           mov  @dwReturn,edi
                                           .break
                                        .endif
                                  .endif
                               PageError:
                                   sub   edi,010000h
                                   .break  .if edi<070000000h
                               .endw
                               pop  fs:[0]
                               add  esp,0ch
                               popad
                               mov eax,@dwReturn
                       ret
_GetKernelBase  endp

start:
       invoke  _GetKernelBase, [esp]
       invoke   wsprintf,offset szBuffer,offset szStr,eax
       invoke   MessageBox,NULL,offset szBuffer,offset szCaption,MB_OK  
       ret
    
      end start
顶端 Posted: 2008-08-07 17:00 | 局域网 [楼 主]
frozenrain
级别: 驱动牛犊


精华: 0
发帖: 1
威望: 2 点
积分: 1 分
贡献值: 0 点
好评度: 0 点
原创分: 0 分
注册时间:2008-08-04
最后登录:2008-08-10

 

去搜搜 罗聪有个暴力搜索的代码的
顶端 Posted: 2008-08-10 16:07 | 湖北省武汉市 1 楼
驱动程序开发网技术社区 » 病毒技术分析
快速发帖 顶端
内容
HTML 代码不可用

使用签名
Wind Code自动转换

字数检查 恢复数据
按 Ctrl+Enter 直接提交
表情 [更多]

Powered by PHPWind v6.3.2 Code © 2003-08 PHPWind
This is html template view this page faster