PDA

View Full Version : Why such a big file for what it does?


Swimmer
June 2nd, 2007, 09:36
I am trying to figure why this makes such a big file. Anyone know a way I can make it smaller?

; hangup.asm MASM code
; 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
invoke Sleep,3000 ; give the system enuf time to end the connection

Outta_Here:

invoke ExitProcess, 0

END Start

FrankRizzo
June 2nd, 2007, 11:46
The easiest way to answer why is to run the result through a disassembler and look at the output. Then, you should be able to tweak it to make it smaller.

disavowed
June 2nd, 2007, 12:19
Perhaps you have a file-infector virus on your computer and it's adding 95 KB to your EXE after you compile the code above

esther
June 2nd, 2007, 12:37
check out the link below
http://www.asmcommunity.net/board/index.php?topic=3997.0
and check the forum too!
and next time search the web first!

Swimmer
June 2nd, 2007, 12:41
Quote:
[Originally Posted by FrankRizzo;66131]The easiest way to answer why is to run the result through a disassembler and look at the output. Then, you should be able to tweak it to make it smaller.


I found the main problem. I had some structure data in
the .data section that worked fine in the .data? section.

Swimmer
June 2nd, 2007, 12:44
Quote:
[Originally Posted by disavowed;66134]Perhaps you have a file-infector virus on your computer and it's adding 95 KB to your EXE after you compile the code above


No viruses on my system. Some of my program attempts
might be scaring them off. :-)

LLXX
June 5th, 2007, 03:40
Put everything in one section and link with filealign:512 and align:4096.

Multiple sections were an HLL thing, in Asm it's easier to just use one.