mov dword ptr[pstruct], 0FDE8h mov word ptr [pstruct + 4], 0FFh
Vous n’avez pas trouvé la réponse que vous recherchez ?
Posez votre questionMaFonction PROC pstruct:DWORD les di, pstruct mov ax, word ptr es:[di].membre2 ret MaFonction ENDP
MaFonction PROC pstruct:DWORD les di, pstruct mov ax, valeur mov word ptr es:[di].membre2, ax ret MaFonction ENDP
MaFonction PROC pstruct:DWORD les di, pstruct mov ax, valeur mov word ptr es:[di.membre2], ax ;chager la place de .membre2 ret MaFonction ENDP
> MaFonction PROC pstruct:DWORD > les di, pstruct > mov ax, word ptr es:[di].membre2 > ret > MaFonction ENDP >
> > typedef struct { > > unsigned long membre1; > > unsigned short membre2; > > } MyStruct; > > > > void MaFonction(MyStruct* pStruct) > > { > > pStruct->membre1 = 0xFDE8; > > pStruct->membre2 = 0xFF; > > } > >
> > MYSTRUCT STRUCT > > membre1 DWORD ? > > membre2 WORD ? > > MYSTRUCT ENDS > >
> > MaFonction PROC pstruct:DWORD ; > > ; ??? > > ret > > MaFonction ENDP > >
la fonction appelante C crée pout tester void test() registry reg; LoadInfo(®); printf("%x\n\n", reg.immin); } la fonction appelée ASM (c'est là qu'une valeur doit être affectée aux éléments du pointeur) LoadInfo PROC reg:DWORD ;MOV #imm,rn les di, reg mov ax, 02Dh ; pour tester mov WORD ptr es:[di].immin,ax ret LoadInfo ENDP
typedef struct { unsigned short immin; } t_registry; void LoadInfo(t_registry far *); t_registry reg; LoadInfo(®);
typedef struct { DWORD GenReg[16]; DWORD CtrlReg[8]; DWORD SysReg[8]; DWORD FpReg[32]; WORD immin; } registry; void __stdcall LoadInfo(registry*); /*Prototype de la fonction asm*/ int main(int argc, char* argv[]) /*test de la fonction asm*/ { registry reg; LoadInfo(®); printf("%x\n\n", reg.immin); return 0; }<table border=0 cellspacing=0 cellpadding=4 bgcolor=#E0E0E0><tr><td class=code> Le code asm (complet) <table border=0 cellspacing=0 cellpadding=4 bgcolor=#E0E0E0><tr><td class=code>.386 .model flat, stdcall REGISTRY STRUCT ;declaretion asm du type registry GenReg DWORD 16 DUP (?) CtrlReg DWORD 8 DUP (?) SysReg DWORD 8 DUP (?) FpReg DWORD 32 DUP (?) immin WORD ? REGISTRY ENDS .code LoadInfo PROC reg:DWORD ;Ben voila le pb ;je dois modifier les membres du pointeur recu en ;parametre mais je n'y arrive pas ret LoadInfo ENDP end
.model huge registry struc immin dw 0 registry ends .code LoadInfo PROC reg:DWORD ;MOV #imm,rn les di, reg mov ax, 02Dh ; pour tester mov WORD ptr es:[di].immin,ax ret LoadInfo ENDP end
registry struc immin WORD 0 registry ends ... LoadInfo PROC reg:DWORD ;MOV #imm,rn les di, reg ... mov (registry ptr es:[di]).immin,ax
mov es:[di].registry.immin,ax ... ret LoadInfo ENDP