I don't exactly understand these statements
Does the 3rd statement refer to using registers to store data instead of a memory location ?

What are indirect branches 
Using data tables on data pages (not code pages)
Using register-indirect calls.

I assembled some code that hangs up the phone but it's rather large for an assembler file because of the rasapi32 stuff.

Is there some other way to reduce the code size ? It's almost embarrassing for
an assembly file. :-)

I guess you can't just send a DTR to the modem ?

Thanks.

Posted on 2007-06-01 18:13:47 by skywalker
What does your first three statements have to do with rasapi32? And what about them don't you understand?

Afaik rasapi32.lib doesn't contain any static code, so just how bad is this "code bloat" you're obsessing over? And no, you don't just send DTR to the modem, you use the operating-system supplied APIs and play clean.
Posted on 2007-06-02 06:43:16 by f0dder
; hangup.asm Hangup the phone PRONTO !! :-)
;            107,008 bytes !!
.386
.MODEL FLAT, STDCALL
OPTION CASEMAP: NONE


    include \masm32\include\windows.inc
    include \masm32\include\user32.inc
    include \masm32\include\kernel32.inc
    include \masm32\include\advapi32.inc
    include \masm32\macros\macros.asm
    include \masm32\include\rasapi32.inc

    includelib  \masm32\lib\rasapi32.lib
    includelib  \masm32\lib\kernel32.lib
    includelib  \masm32\lib\user32.lib
    includelib  \masm32\lib\advapi32.lib
    includelib  \masm32\lib\shlwapi.lib

.DATA

l_RASCONN RASCONN 0FFh dup ({})
l_Buffer_Size dd ?
l_Conn_Count  dd ? 

.CODE

Start:

Close_Connection:

;look for RAS connections

        mov l_RASCONN.dwSize, sizeof RASCONN + 1
        mov l_Buffer_Size, sizeof l_RASCONN

        invoke RasEnumConnections, addr l_RASCONN, addr l_Buffer_Size, addr l_Conn_Count

        .if eax != 0 ; exit program
            jmp Outta_Here     
        .endif

        invoke RasHangUp, l_RASCONN.hrasconn

Outta_Here:

invoke ExitProcess, 0

END Start
Posted on 2007-06-02 07:24:47 by skywalker
Move your unitinialized data from .DATA to .DATA? and you'll end up with a 12k exe.
Posted on 2007-06-02 10:21:11 by f0dder

Move your unitinialized data from .DATA to .DATA? and you'll end up with a 12k exe.



I already figured that out.
I am happy with the size now.

; hangup.asm Disconnect phone line
;                    Help from *a#gl*ri,Frank,Win32 Prog Ref,
;                    2048 bytes as compiled
;                    492  bytes when converted to hangup.com (no loss in function or
Posted on 2007-06-02 11:22:01 by skywalker