NO

Author Topic: ALTERNATENAME option  (Read 2249 times)

Offline Vortex

  • Member
  • *
  • Posts: 871
    • http://www.vortex.masmcode.com
ALTERNATENAME option
« on: January 27, 2024, 09:32:42 PM »
Another example of using Polink's option ALTERNATENAME. The modified MS VC runtime functions are redirected to their original names.

Code: [Select]
.386
.model flat,stdcall
option casemap:none

ExitProcess PROTO :DWORD
msvc_printf PROTO C :DWORD,:VARARG
msvc_scanf  PROTO C :DWORD,:DWORD
msvc_strupr PROTO C :DWORD

.data

string1     db 'What is your name?',13,10,13,10,0
string2     db 'Nice to meet you %s',13,10,0
f1          db '%s',0

.data?

szName      db 32 dup(?)

.code

start:

    invoke  msvc_printf,ADDR string1
    invoke  msvc_scanf,ADDR f1,ADDR szName

    invoke  msvc_strupr,ADDR szName
    invoke  msvc_printf,ADDR string2,eax

    invoke  ExitProcess,0

END start

Build.bat :

Code: [Select]
\PellesC\bin\polib /OUT:msvcrt.lib /MACHINE:x86 /DEF:msvcrt.def

\PellesC\bin\poasm /AIA32 scanf.asm
\PellesC\bin\polink /SUBSYSTEM:CONSOLE /LIBPATH:\PellesC\Lib\Win /ALTERNATENAME:_msvc_scanf=_scanf /ALTERNATENAME:_msvc_printf=_printf /ALTERNATENAME:_msvc_strupr=__strupr scanf.obj kernel32.lib msvcrt.lib
Code it... That's all...