我在R0下用PsSetLoadImageNotifyRoutine设置了个回调函数,用这个回调函数获取某模块的函数
mov eax,ImageInfo
assume eax:PIMAGE_INFO
mov eax,[eax].ImageBase
assume eax:nothing
mov @hMod,eax
invoke DbgPrint, $CTA0("Driver: ImageInfo.ImageBase: %08X\n"), @hMod
.if @hMod
mov edi,@hMod
assume edi:ptr IMAGE_DOS_HEADER ;指向IMAGE_DOS_HEADER
.if [edi].e_magic != IMAGE_DOS_SIGNATURE ;是"MZ"?
jmp _Exit
.endif
add edi,[edi].e_lfanew
assume edi:ptr IMAGE_NT_HEADERS ;指向IMAGE_NT_HEADERS
.if [edi].Signature != IMAGE_NT_SIGNATURE ;是"PE"?
jmp _Exit
.endif
.if [edi].OptionalHeader.DataDirectory[8].VirtualAddress != 0 || [edi].OptionalHeader.DataDirectory[8].isize != 0
mov edi,[edi].OptionalHeader.DataDirectory[8].VirtualAddress
add edi,@hMod
assume edi:ptr IMAGE_IMPORT_DESCRIPTOR
.while [edi].OriginalFirstThunk || [edi].TimeDateStamp || [edi].ForwarderChain || [edi].Name1 || [edi].FirstThunk
mov eax,[edi].Name1
add eax,@hMod
push eax
invoke DbgPrint, $CTA0("Driver: IMAGE_IMPORT_DESCRIPTOR.Name1: %s\n"), eax
pop eax
;invoke MemCmp,eax,$CTA0("user32.dll"),10
;.if eax == 0
mov eax,[edi].OriginalFirstThunk
add eax,@hMod
mov ebx,eax
mov @iNum,0
.while dword ptr [ebx]
mov eax,dword ptr [ebx]
add eax,@hMod
assume eax:ptr IMAGE_IMPORT_BY_NAME
lea eax,[eax].Name1
push eax
invoke DbgPrint, $CTA0("Driver: IMAGE_IMPORT_BY_NAME.Name1: %s\n"), eax
pop eax
assume eax:nothing
add @iNum,4
add ebx,4
.endw
;.endif
add edi,sizeof IMAGE_IMPORT_DESCRIPTOR
.endw
.endif
_Exit:
assume edi:nothing
.endif
.endif
这段代码我在R3下 注入到一个进程 获取函数是没问题的
但是为什么在R0下会出错 蓝屏,注释掉invoke MemCmp,eax,$CTA0("user32.dll"),10下面.if 中的代码 也不会出错
谁指点一下啊
用windbg 看了下,发现 代码的功能好像都没问题,但是始终要出错 而且每次出错的地方都不一样
搞不懂了,而且我也不怎么会用windbg
Driver: ImageInfo.ImageBase: 01000000
Driver: IMAGE_IMPORT_DESCRIPTOR.Name1: comdlg32.dll
Driver: IMAGE_IMPORT_BY_NAME.Name1: PageSetupDlgW
Driver: IMAGE_IMPORT_BY_NAME.Name1: FindTextW
Driver: IMAGE_IMPORT_BY_NAME.Name1: PrintDlgExW
Driver: IMAGE_IMPORT_BY_NAME.Name1: ChooseFontW
Driver: IMAGE_IMPORT_BY_NAME.Name1: GetFileTitleW
Driver: IMAGE_IMPORT_BY_NAME.Name1: GetOpenFileNameW
Driver: IMAGE_IMPORT_BY_NAME.Name1: ReplaceTextW
Driver: IMAGE_IMPORT_BY_NAME.Name1: CommDlgExtendedError
Driver: IMAGE_IMPORT_BY_NAME.Name1: GetSaveFileNameW
Driver: IMAGE_IMPORT_DESCRIPTOR.Name1: SHELL32.dll
Driver: IMAGE_IMPORT_BY_NAME.Name1: DragFinish
Driver: IMAGE_IMPORT_BY_NAME.Name1: DragQueryFileW
Driver: IMAGE_IMPORT_BY_NAME.Name1: DragAcceptFiles
Driver: IMAGE_IMPORT_BY_NAME.Name1: ShellAboutW
Driver: IMAGE_IMPORT_DESCRIPTOR.Name1: WINSPOOL.DRV
Driver: IMAGE_IMPORT_BY_NAME.Name1: GetPrinterDriverW
Driver: IMAGE_IMPORT_BY_NAME.Name1: ClosePrinter
Driver: IMAGE_IMPORT_BY_NAME.Name1: OpenPrinterW
Driver: IMAGE_IMPORT_DESCRIPTOR.Name1: COMCTL32.dll
Driver: IMAGE_IMPORT_BY_NAME.Name1: CreateStatusWindowW
Driver: IMAGE_IMPORT_DESCRIPTOR.Name1: msvcrt.dll
Driver: IMAGE_IMPORT_BY_NAME.Name1: _XcptFilter
Driver: IMAGE_IMPORT_BY_NAME.Name1: _exit
Driver: IMAGE_IMPORT_BY_NAME.Name1: _c_exit
Driver: IMAGE_IMPORT_BY_NAME.Name1: time
Driver: IMAGE_IMPORT_BY_NAME.Name1: localtime
Driver: IMAGE_IMPORT_BY_NAME.Name1: _cexit
Driver: IMAGE_IMPORT_BY_NAME.Name1: iswctype
Driver: IMAGE_IMPORT_BY_NAME.Name1: _except_handler3
Driver: IMAGE_IMPORT_BY_NAME.Name1: _wtol
Driver: IMAGE_IMPORT_BY_NAME.Name1: wcsncmp
Driver: IMAGE_IMPORT_BY_NAME.Name1: _snwprintf
Driver: IMAGE_IMPORT_BY_NAME.Name1: exit
Driver: IMAGE_IMPORT_BY_NAME.Name1: _acmdln
Driver: IMAGE_IMPORT_BY_NAME.Name1: __getmainargs
Driver: IMAGE_IMPORT_BY_NAME.Name1: _initterm
Driver: IMAGE_IMPORT_BY_NAME.Name1: __setusermatherr
Driver: IMAGE_IMPORT_BY_NAME.Name1: _adjust_fdiv
Driver: IMAGE_IMPORT_BY_NAME.Name1: __p__commode
Driver: IMAGE_IMPORT_BY_NAME.Name1: __p__fmode
Driver: IMAGE_IMPORT_BY_NAME.Name1: __set_app_type
Driver: IMAGE_IMPORT_BY_NAME.Name1: _controlfp
Driver: IMAGE_IMPORT_BY_NAME.Name1: wcsncpy
Driver: IMAGE_IMPORT_DESCRIPTOR.Name1: ADVAPI32.dll
Driver: IMAGE_IMPORT_BY_NAME.Name1: RegQueryValueExW
Driver: IMAGE_IMPORT_BY_NAME.Name1: RegCloseKey
Driver: IMAGE_IMPORT_BY_NAME.Name1: RegCreateKeyW
Driver: IMAGE_IMPORT_BY_NAME.Name1: IsTextUnicode
Driver: IMAGE_IMPORT_BY_NAME.Name1: RegQueryValueExA
Driver: IMAGE_IMPORT_BY_NAME.Name1: RegOpenKeyExA
Driver: IMAGE_IMPORT_BY_NAME.Name1: RegSetValueExW
Driver: IMAGE_IMPORT_DESCRIPTOR.Name1: KERNEL32.dll
Driver: IMAGE_IMPORT_BY_NAME.Name1: GetCurrentThreadId
Driver: IMAGE_IMPORT_BY_NAME.Name1: GetTickCount
Driver: IMAGE_IMPORT_BY_NAME.Name1: QueryPerformanceCounter
Driver: IMAGE_IMPORT_BY_NAME.Name1: GetLocalTime
Driver: IMAGE_IMPORT_BY_NAME.Name1: GetUserDefaultLCID
Driver: IMAGE_IMPORT_BY_NAME.Name1: GetDateFormatW
Driver: IMAGE_IMPORT_BY_NAME.Name1: GetTimeFormatW
Driver: IMAGE_IMPORT_BY_NAME.Name1: GlobalLock
Driver: IMAGE_IMPORT_BY_NAME.Name1: GlobalUnlock
Driver: IMAGE_IMPORT_BY_NAME.Name1: GetFileInformationByHandle
Driver: IMAGE_IMPORT_BY_NAME.Name1: CreateFileMappingW
Driver: IMAGE_IMPORT_BY_NAME.Name1: GetSystemTimeAsFileTime
Driver: IMAGE_IMPORT_BY_NAME.Name1: TerminateProcess
Driver: IMAGE_IMPORT_BY_NAME.Name1: GetCurrentProcess
Driver: IMAGE_IMPORT_BY_NAME.Name1: SetUnhandledExceptionFilter
Driver: IMAGE_IMPORT_BY_NAME.Name1: LoadLibraryA
Driver: IMAGE_IMPORT_BY_NAME.Name1: GetModuleHandleA
Driver: IMAGE_IMPORT_BY_NAME.Name1: GetStartupInfoA
Driver: IMAGE_IMPORT_BY_NAME.Name1: GlobalFree
Driver: IMAGE_IMPORT_BY_NAME.Name1: GetLocaleInfoW
Driver: IMAGE_IMPORT_BY_NAME.Name1: LocalFree
Driver: IMAGE_IMPORT_BY_NAME.Name1: LocalAlloc
Driver: IMAGE_IMPORT_BY_NAME.Name1: lstrlenW
Driver: IMAGE_IMPORT_BY_NAME.Name1: LocalUnlock
Driver: IMAGE_IMPORT_BY_NAME.Name1: CompareStringW
Driver: IMAGE_IMPORT_BY_NAME.Name1: LocalLock
Driver: IMAGE_IMPORT_BY_NAME.Name1: FoldStringW
Driver: IMAGE_IMPORT_BY_NAME.Name1: CloseHandle
Driver: IMAGE_IMPORT_BY_NAME.Name1: lstrcpyW
Driver: IMAGE_IMPORT_BY_NAME.Name1: ReadFile
Driver: IMAGE_IMPORT_BY_NAME.Name1: CreateFileW
Driver: IMAGE_IMPORT_BY_NAME.Name1: lstrcmpiW
Driver: IMAGE_IMPORT_BY_NAME.Name1: GetCurrentProcessId
Driver: IMAGE_IMPORT_BY_NAME.Name1: GetProcAddress
Driver: IMAGE_IMPORT_BY_NAME.Name1: GetCommandLineW
Driver: IMAGE_IMPORT_BY_NAME.Name1: lstrcatW
Driver: IMAGE_IMPORT_BY_NAME.Name1: FindClose
Driver: IMAGE_IMPORT_BY_NAME.Name1: FindFirstFileW
Driver: IMAGE_IMPORT_BY_NAME.Name1: GetFileAttributesW
Driver: IMAGE_IMPORT_BY_NAME.Name1: lstrcmpW
Driver: IMAGE_IMPORT_BY_NAME.Name1: MulDiv
Driver: IMAGE_IMPORT_BY_NAME.Name1: lstrcpynW
Driver: IMAGE_IMPORT_BY_NAME.Name1: LocalSize
Driver: IMAGE_IMPORT_BY_NAME.Name1: GetLastError
Driver: IMAGE_IMPORT_BY_NAME.Name1: WriteFile
Driver: IMAGE_IMPORT_BY_NAME.Name1: SetLastError
Driver: IMAGE_IMPORT_BY_NAME.Name1: WideCharToMultiByte
Driver: IMAGE_IMPORT_BY_NAME.Name1: LocalReAlloc
Driver: IMAGE_IMPORT_BY_NAME.Name1: FormatMessageW
Driver: IMAGE_IMPORT_BY_NAME.Name1: GetUserDefaultUILanguage
Driver: IMAGE_IMPORT_BY_NAME.Name1: SetEndOfFile
Driver: IMAGE_IMPORT_BY_NAME.Name1: DeleteFileW
Driver: IMAGE_IMPORT_BY_NAME.Name1: GetACP
Driver: IMAGE_IMPORT_BY_NAME.Name1: UnmapViewOfFile
Driver: IMAGE_IMPORT_BY_NAME.Name1: MultiByteToWideChar
Driver: IMAGE_IMPORT_BY_NAME.Name1: MapViewOfFile
Driver: IMAGE_IMPORT_BY_NAME.Name1: UnhandledExceptionFilter
Driver: IMAGE_IMPORT_DESCRIPTOR.Name1: GDI32.dll
Driver: IMAGE_IMPORT_BY_NAME.Name1: EndPage
Driver: IMAGE_IMPORT_BY_NAME.Name1: AbortDoc
Driver: IMAGE_IMPORT_BY_NAME.Name1: EndDoc
Driver: IMAGE_IMPORT_BY_NAME.Name1: DeleteDC
Driver: IMAGE_IMPORT_BY_NAME.Name1: StartPage
Driver: IMAGE_IMPORT_BY_NAME.Name1: GetTextExtentPoint32W
Driver: IMAGE_IMPORT_BY_NAME.Name1: CreateDCW
Driver: IMAGE_IMPORT_BY_NAME.Name1: SetAbortProc
Driver: IMAGE_IMPORT_BY_NAME.Name1: GetTextFaceW
Driver: IMAGE_IMPORT_BY_NAME.Name1: TextOutW
Driver: IMAGE_IMPORT_BY_NAME.Name1: StartDocW
Driver: IMAGE_IMPORT_BY_NAME.Name1: EnumFontsW
Driver: IMAGE_IMPORT_BY_NAME.Name1: GetStockObject
Driver: IMAGE_IMPORT_BY_NAME.Name1: GetObjectW
Driver: IMAGE_IMPORT_BY_NAME.Name1: GetDeviceCaps
Driver: IMAGE_IMPORT_BY_NAME.Name1: CreateFontIndirectW
Driver: IMAGE_IMPORT_BY_NAME.Name1: DeleteObject
Driver: IMAGE_IMPORT_BY_NAME.Name1: GetTextMetricsW
Driver: IMAGE_IMPORT_BY_NAME.Name1: SetBkMode
Driver: IMAGE_IMPORT_BY_NAME.Name1: LPtoDP
Driver: IMAGE_IMPORT_BY_NAME.Name1: SetWindowExtEx
Driver: IMAGE_IMPORT_BY_NAME.Name1: SetViewportExtEx
Driver: IMAGE_IMPORT_BY_NAME.Name1: SetMapMode
Driver: IMAGE_IMPORT_BY_NAME.Name1: SelectObject
Driver: IMAGE_IMPORT_DESCRIPTOR.Name1: USER32.dll
Driver: IMAGE_IMPORT_BY_NAME.Name1: GetClientRect
Driver: IMAGE_IMPORT_BY_NAME.Name1: SetCursor
Driver: IMAGE_IMPORT_BY_NAME.Name1: ReleaseDC
Driver: IMAGE_IMPORT_BY_NAME.Name1: GetDC
Driver: IMAGE_IMPORT_BY_NAME.Name1: DialogBoxParamW
Driver: IMAGE_IMPORT_BY_NAME.Name1: SetActiveWindow
Driver: IMAGE_IMPORT_BY_NAME.Name1: GetKeyboardLayout
Driver: IMAGE_IMPORT_BY_NAME.Name1: DefWindowProcW
Driver: IMAGE_IMPORT_BY_NAME.Name1: DestroyWindow
Driver: IMAGE_IMPORT_BY_NAME.Name1: MessageBeep
Driver: IMAGE_IMPORT_BY_NAME.Name1: ShowWindow
Driver: IMAGE_IMPORT_BY_NAME.Name1: GetForegroundWindow
Driver: IMAGE_IMPORT_BY_NAME.Name1: IsIconic
Driver: IMAGE_IMPORT_BY_NAME.Name1: GetWindowPlacement
Driver: IMAGE_IMPORT_BY_NAME.Name1: CharUpperW
Driver: IMAGE_IMPORT_BY_NAME.Name1: LoadStringW
Driver: IMAGE_IMPORT_BY_NAME.Name1: LoadAcceleratorsW
Driver: IMAGE_IMPORT_BY_NAME.Name1: GetSystemMenu
Driver: IMAGE_IMPORT_BY_NAME.Name1: RegisterClassExW
Driver: IMAGE_IMPORT_BY_NAME.Name1: LoadImageW
Driver: IMAGE_IMPORT_BY_NAME.Name1: LoadCursorW
Driver: IMAGE_IMPORT_BY_NAME.Name1: SetWindowPlacement
Driver: IMAGE_IMPORT_BY_NAME.Name1: CreateWindowExW
Driver: IMAGE_IMPORT_BY_NAME.Name1: GetDesktopWindow
Driver: IMAGE_IMPORT_BY_NAME.Name1: GetFocus
Driver: IMAGE_IMPORT_BY_NAME.Name1: LoadIconW
Driver: IMAGE_IMPORT_BY_NAME.Name1: SetWindowTextW
Driver: IMAGE_IMPORT_BY_NAME.Name1: PostQuitMessage
Driver: IMAGE_IMPORT_BY_NAME.Name1: RegisterWindowMessageW
Driver: IMAGE_IMPORT_BY_NAME.Name1: UpdateWindow
Driver: IMAGE_IMPORT_BY_NAME.Name1: SetScrollPos
Driver: IMAGE_IMPORT_BY_NAME.Name1: CharLowerW
Driver: IMAGE_IMPORT_BY_NAME.Name1: PeekMessageW
Driver: IMAGE_IMPORT_BY_NAME.Name1: EnableWindow
Driver: IMAGE_IMPORT_BY_NAME.Name1: DrawTextExW
Driver: IMAGE_IMPORT_BY_NAME.Name1: CreateDialogParamW
Driver: IMAGE_IMPORT_BY_NAME.Name1: GetWindowTextW
Driver: IMAGE_IMPORT_BY_NAME.Name1: GetSystemMetrics
Driver: IMAGE_IMPORT_BY_NAME.Name1: MoveWindow
Driver: IMAGE_IMPORT_BY_NAME.Name1: InvalidateRect
Driver: IMAGE_IMPORT_BY_NAME.Name1: WinHelpW
Driver: IMAGE_IMPORT_BY_NAME.Name1: GetDlgCtrlID
Driver: IMAGE_IMPORT_BY_NAME.Name1: ChildWindowFromPoint
Driver: IMAGE_IMPORT_BY_NAME.Name1: ScreenToClient
Driver: IMAGE_IMPORT_BY_NAME.Name1: GetCursorPos
Driver: IMAGE_IMPORT_BY_NAME.Name1: SendDlgItemMessageW
Driver: IMAGE_IMPORT_BY_NAME.Name1: SendMessageW
Driver: IMAGE_IMPORT_BY_NAME.Name1: CharNextW
Driver: IMAGE_IMPORT_BY_NAME.Name1: CheckMenuItem
Driver: IMAGE_IMPORT_BY_NAME.Name1: CloseClipboard
Driver: IMAGE_IMPORT_BY_NAME.Name1: IsClipboardFormatAvailable
Driver: IMAGE_IMPORT_BY_NAME.Name1: OpenClipboard
Driver: IMAGE_IMPORT_BY_NAME.Name1: GetMenuState
Driver: IMAGE_IMPORT_BY_NAME.Name1: EnableMenuItem
Driver: IMAGE_IMPORT_BY_NAME.Name1: GetSubMenu
Driver: IMAGE_IMPORT_BY_NAME.Name1: GetMenu
Driver: IMAGE_IMPORT_BY_NAME.Name1: MessageBoxW
Driver: IMAGE_IMPORT_BY_NAME.Name1: SetWindowLongW
Driver: IMAGE_IMPORT_BY_NAME.Name1: GetWindowLongW
Driver: IMAGE_IMPORT_BY_NAME.Name1: GetDlgItem
Driver: IMAGE_IMPORT_BY_NAME.Name1: SetFocus
Driver: IMAGE_IMPORT_BY_NAME.Name1: SetDlgItemTextW
Driver: IMAGE_IMPORT_BY_NAME.Name1: wsprintfW
Driver: IMAGE_IMPORT_BY_NAME.Name1: GetDlgItemTextW
Driver: IMAGE_IMPORT_BY_NAME.Name1: EndDialog
Driver: IMAGE_IMPORT_BY_NAME.Name1: GetParent
Driver: IMAGE_IMPORT_BY_NAME.Name1: UnhookWinEvent
Driver: IMAGE_IMPORT_BY_NAME.Name1: DispatchMessageW
Driver: IMAGE_IMPORT_BY_NAME.Name1: TranslateMessage
Driver: IMAGE_IMPORT_BY_NAME.Name1: TranslateAcceleratorW
Driver: IMAGE_IMPORT_BY_NAME.Name1: IsDialogMessageW
Driver: IMAGE_IMPORT_BY_NAME.Name1: PostMessageW
Driver: IMAGE_IMPORT_BY_NAME.Name1: GetMessageW
Driver: IMAGE_IMPORT_BY_NAME.Name1: SetWinEventHook
Access violation - code c0000005 (!!! second chance !!!)
nt!ExAcquireRundownProtectionEx+0x9:
80603c87 8b19 mov ebx,dword ptr [ecx] 此时ecx为0 肯定要出错,但不知道怎么解决
[课程]FART 脱壳王!加量不加价!FART作者讲授!