News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests

Main Menu

masm 10 vs 11

Started by bomz, January 22, 2013, 09:45:06 AM

Previous topic - Next topic

dedndave

.code

PowerOf10 proto


it's odd that he did it that way

dedndave

well - you just need a floating point value
    INCLUDE \Masm32\Include\Masm32rt.inc

        .DATA
qwTest  REAL8 3.1415962

        .DATA?
szBuff  db 20 dup(?)

        .CODE

Start:
    INVOKE  FloatToStr,offset qwTest,offset szBuff
    print   offset szBuff,13,10

    INVOKE  FloatToStr2,offset qwTest,offset szBuff
    print   offset szBuff,13,10

    inkey
    exit

    END     Start

bomz

QuoteMicrosoft (R) Macro Assembler Version 10.00.40219.01
Copyright (C) Microsoft Corporation.  All rights reserved.

Assembling: C:\111.txt

***********
ASCII build
***********

C:\111.txt(12) : error A2114:INVOKE argument type mismatch : argument : 1
C:\111.txt(15) : error A2114:INVOKE argument type mismatch : argument : 1
Microsoft (R) Incremental Linker Version 10.00.40219.01
Copyright (C) Microsoft Corporation.  All rights reserved.

LINK : fatal error LNK1181: cannot open input file '111.obj'
Не удается найти C:\111.obj
Для продолжения нажмите любую клавишу . . .

dedndave

sorry about that - lol
it wants the QWORD passed - not a pointer

bomz

QuoteINCLUDE \Masm32\Include\Masm32rt.inc

        .DATA
qwTest  REAL8 3.1415962

        .DATA?
szBuff  db 20 dup(?)

        .CODE

Start:
    INVOKE  FloatToStr2,qwTest,offset szBuff
    print   offset szBuff,13,10

    INVOKE  FloatToStr2,qwTest,offset szBuff
    print   offset szBuff,13,10

    inkey
    exit

    END     Start

dedndave

i don't know how they do that - maybe there is a better way
but, this should work....
    push    offset szBuff
    push dword ptr qwTest+4
    push dword ptr qwTest
    CALL    FloatToStr
    print   offset szBuff,13,10

    push    offset szBuff
    push dword ptr qwTest+4
    push dword ptr qwTest
    CALL    FloatToStr2
    print   offset szBuff,13,10


oh - good job
i didn't know you could do that   :biggrin:

bomz

I read masm help, never use macros and functions


dedndave

 :t

oops - Pi is 3.1415926
i am getting old

bomz

now full compatibable with all masm version

bomz

One question leave. How makes lib from this? SDKKit includes

;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
;:                                           FASTCALL                                             ::
;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::

externdef syscall @ExAcquireFastMutexUnsafe@4:proc
ExAcquireFastMutexUnsafe textequ <@ExAcquireFastMutexUnsafe@4>

externdef syscall @ExInterlockedAddLargeStatistic@8:proc
ExInterlockedAddLargeStatistic textequ <@ExInterlockedAddLargeStatistic@8>

dedndave

one of the best guys to answer that is Erol
i will leave that one for him   :biggrin:

bomz

may be like that?
;__NO_NOISE__
.386
.model flat,stdcall
option casemap :none
externdef syscall @ExAcquireFastMutexUnsafe@4:FAR
.code
LibMain proc hInstDLL:DWORD, reason:DWORD, unused:DWORD
mov eax, 1
ret
LibMain endp

japheth

Quote from: bomz on January 29, 2013, 10:44:28 PM
may be like that?
;__NO_NOISE__
.386
.model flat,stdcall
option casemap :none
externdef syscall @ExAcquireFastMutexUnsafe@4:FAR
.code
LibMain proc hInstDLL:DWORD, reason:DWORD, unused:DWORD
mov eax, 1
ret
LibMain endp


No. This wild guess is completely wrong.

Simplest way is using POLIB ( as it has been mentioned already in this thread ).

1. Create a .DEF file:


LIBRARY ntoskrnl.exe
EXPORTS
"@ExAcquireFastMutexUnsafe@4"
... [more exports]


2. Run POLIB:

polib /DEF:NTOSKRNL.def /OUT:NTOSKRNL.LIB

bomz

polib ok thanks. but how use such construction in the asm code, how call this function from driver?

japheth

Quote from: bomz on January 29, 2013, 11:25:21 PM
polib ok thanks. but how use such construction in the asm code, how call this function from driver?

It's a FASTCALL proc, hence you have to move argument 1 to register ECX:


mov ecx, value_of_arg_1
call @ExAcquireFastMutexUnsafe@4