News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

How to write 'call <jmp.&msvcrt.fread>'?

Started by aker, June 08, 2011, 05:49:33 AM

Previous topic - Next topic

aker

The "call crt_fread" is "call dword ptr ds:[<&msvcrt.fread>]".
But I want "call <jmp.&msvcrt.fread>".
Help!
伟大的恐怖主义革命家拉登,因遭袭医治无效,于2011年5月1日在巴基斯坦逝世,享年54岁

Vortex

Here is a quick demo :


\masm32\bin\polib /OUT:msvcrt.lib /DEF:msvcrt.def /MACHINE:X86

\masm32\bin\ml /c /coff msvcrtDemo.asm
\masm32\bin\polink /SUBSYSTEM:CONSOLE msvcrtDemo.obj



.386
.model flat,stdcall
option casemap:none

include     \masm32\include\windows.inc
include     \masm32\include\kernel32.inc

includelib  \masm32\lib\kernel32.lib
includelib  msvcrt.lib

printf      PROTO C :VARARG

.data

format1     db '%s',0
str1        db 'Hello world!',0

.code

start:

    invoke  printf,ADDR format1,ADDR str1         
    invoke  ExitProcess,0

END start


\masm32\bin\dumppe.exe -disasm msvcrtDemo.exe


00401000                    start:
00401000 6803204000             push    402003h
00401005 6800204000             push    402000h
0040100A E811000000             call    fn_00401020
0040100F 83C408                 add     esp,8
00401012 6A00                   push    0
00401014 E801000000             call    fn_0040101A
00401019 CC                     int     3
0040101A                    fn_0040101A:
0040101A FF255C204000           jmp     dword ptr [ExitProcess]
00401020                    fn_00401020:
00401020 FF2564204000           jmp     dword ptr [printf]

aker

 :U
Thanks. It works.

call dword ptr ds:[<&msvcrt.__set_app_type>]:

c_msvcrt typedef proto c:vararg
externdef _imp____set_app_type:ptr c_msvcrt
crt___set_app_type equ <_imp____set_app_type>

##############################################################

call <jmp.&msvcrt.__set_app_type>:

crt___set_app_type equ __set_app_type
__set_app_type PROTO C :VARARG


Just change the msvcrt.inc then it works.
伟大的恐怖主义革命家拉登,因遭袭医治无效,于2011年5月1日在巴基斯坦逝世,享年54岁