Hello, i have a bad problem and dont understand what happend. Data DB 10000h DUP (?) this function i found in a sample sources ,if i compile it ,i got 80kb and im unable to pack it if i change 1000h dup. without Data DB 10000h DUP (?) i got 4kb after i comile it. can someone please explaine me what happend ? i try to use Data DB 10000h DUP (?) with another name ,but all time i use DB 1000h DUP (0) i got a big programm,so i think this will told tasm to make it big. but why ? what happend here ? i simply try to send a email ;) like : ------- sendmail PROC ARG _data:DWORD, _data_len:DWORD <-- this i dont understand,too call WSAStartup, 0101h, offset wsadata or eax, eax jnz @@Bye call socket, AF_INET, Sock_stream, 0 cmp eax, -1 jz @@Bye mov , eax call connect, eax, offset sin, size sin cmp eax, -1 jz @@Sux call send, sock, _data, _data_len, 0 xor eax, eax -------------------------- in data section i have another question :( ---------- Rcpt DB "myemail@hotmail.com", 64 - ($ - Rcpt) DUP (0) MFROM DB "myemail@hotmail.com", 64 - ($ - MFROM) DUP (0) Mail DB "HELO localhost", LF DB "MAIL FROM: %s", LF DB "RCPT TO: %s", LF DB "DATA", LF DB "From: Myname", LF DB "Heres the text to send ",LF DB LF, NULL Mail_ DD $ - Mail ----------------------------------------- is this the data section ,send as _data? becose i like to delete : Data DB 10000h DUP (?) and use the function without it,so i can pack my programm and have normal size ;) excuse my bad english ;) thanks and cu ps: in deutsch währe das super einfach zu beschreiben *bg* ich möchte einfach die email routine benutzen und dabei auf :Data DB 10000h DUP (?) verzichten. seltsammerweise macht diese funktion mein programm,oder alles in das ich sie einfüge ,so groß wie dort angegeben. vieleicht hast du,stefan *g* ja eine lösung ;)
Posted on 2001-02-13 17:49:00 by WH¥
just move the initialized data zone .data db 10000 dup(?) .code to this UNitialized data section .data? db 10000 dup(?) .code now your code (really PE file because code is the same) will be much smaller :)
Posted on 2001-02-13 18:28:00 by BogdanOntanu
about the PROC and ARG: here is an extract from TASM docs: ARG Ideal, MASM ARG argument [,argument] ... [=symbol] ] Sets up arguments on the stack for procedures. Each argument is assigned a positive offset from the BP register, presuming that both the return address of the procedure call and the caller's BP have been pushed onto the stack already. Each argument has the following syntax (uppercase items are literal): argname[] [: PTR] type] [:count2] argname is the name you'll use to refer to this argument throughout the procedure. distance is optional and can be either NEAR or FAR to indicate that the argument is a pointer of the indicated size. type is the data type of the argument and can be BYTE, WORD, DATAPTR, CODEPTR, DWORD, FWORD, PWORD, QWORD, TBYTE, or a structure name. count1 and count2 are the number of elements of the specified type. The total count is calculated as count1 * count2. If you don't specify type, WORD is assumed. The argument name variables remain defined within the procedure as BP-relative memory operands. For example, Func1 PROC NEAR ARG A: WORD, B: DWORD:4, C: BYTE = D defines A as , B as , C as , and D as 20. Argument names that begin with the local symbol prefix when local symbols are enabled are limited in scope to the current procedure. If you end the argument list with an equal sign (=) and a symbol, that symbol will be equated to the total size of the argument block in bytes. You can then use this value at the end of the procedure as an argument to the RET instruction, which effects a stack cleanup of any pushed arguments before returning (this is the Pascal calling convention). Note that byte sized arguments are considered to take 2 bytes of stack space, unless an explicit count field is specified. The optional RETURNS keyword introduces one or more arguments that won't be popped from the stack when the procedure returns to its caller. Normally, if you specify the language as PASCAL or TPASCAL when using the .MODEL directive, all arguments are popped when the procedure returns. A sample Pascal procedure: fp PROC FAR ARG SRC:WORD,DEST:WORD = ARGLEN push bp mov bp,sp mov di,DEST mov si,SRC ; pop bp ret ARGLEN fp ENDP See Also LOCAL PROC USES Copyright 1993 Borland International. This message was edited by BogdanOntanu, on 2/13/2001 6:39:43 PM This message was edited by BogdanOntanu, on 2/13/2001 6:42:59 PM
Posted on 2001-02-13 18:37:00 by BogdanOntanu
Hi hope you are fine ;) thanks for the help ! as i see you move to data section ,i make: AHHHHHHHHH and see the light goes on *bg* ,a little light. i translate your posting and then im shure i understand what happend and why ;) i cant say how happy i am to find a place like this with a lot people taking time to help others. btw. the new forum design is much better then any other forum i see ! thanks to you all ! cu
Posted on 2001-02-14 04:07:00 by WH¥
don't forget the {code} {/code} tags (substitute {} with [])
Posted on 2001-02-14 06:54:00 by Hiroshimator