poul821201
驱动牛犊
驱动牛犊
  • 注册日期2007-04-04
  • 最后登录2010-03-24
  • 粉丝0
  • 关注0
  • 积分2分
  • 威望4点
  • 贡献值0点
  • 好评度2点
  • 原创分0分
  • 专家分0分
阅读:2256回复:1

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

楼主#
更多 发布于:2008-08-07 17:00
请教一个获得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
frozenrain
驱动牛犊
驱动牛犊
  • 注册日期2008-08-04
  • 最后登录2009-09-01
  • 粉丝0
  • 关注0
  • 积分5分
  • 威望23点
  • 贡献值1点
  • 好评度0点
  • 原创分0分
  • 专家分0分
沙发#
发布于:2008-08-10 16:07
去搜搜 罗聪有个暴力搜索的代码的
游客

返回顶部