Comme j'en ai marre de faire ipconfig pour récupérer mon IP j'ai fait un petit programme pour le copier dans le presse papier. En C c'est pas drôle alors je l'ai fait en ASM.
J'ai mis aussi la source en C comme ca c'est plus facile à comprendre.
Source / Exemple :
.486
.model flat, stdcall
option casemap :none
include \masm32\include\windows.inc
include \masm32\include\masm32.inc
include \masm32\include\gdi32.inc
include \masm32\include\user32.inc
include \masm32\include\kernel32.inc
include \masm32\include\Comctl32.inc
include \masm32\include\comdlg32.inc
include \masm32\include\shell32.inc
include \masm32\include\oleaut32.inc
include \masm32\include\dialogs.inc
include \masm32\include\ws2_32.inc
includelib \masm32\lib\masm32.lib
includelib \masm32\lib\gdi32.lib
includelib \masm32\lib\user32.lib
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\Comctl32.lib
includelib \masm32\lib\comdlg32.lib
includelib \masm32\lib\shell32.lib
includelib \masm32\lib\oleaut32.lib
includelib \masm32\lib\ws2_32.lib
.data?
wsa dd 100 dup(?)
szHostName dd 64 dup(?)
.code
start:
push offset wsa
push 202h
call WSAStartup
mov ecx, offset szHostName
push ecx
push 256
push ecx
call gethostname
call gethostbyname
mov ecx, [eax] + 12 ; décalage pour h_addr_list de la structure hostent
mov ebx, [ecx]
mov edx, [ebx]
push edx
call WSACleanup
push 100
push 66 ; GHND
call GlobalAlloc
pop edx
push eax
push eax
push eax
push edx
push eax
call GlobalLock
pop ecx
push eax
push ecx
call inet_ntoa ; texte dans eax, copie dans ecx
pop ecx
suiteCopie:
mov dl, [eax]
test dl, dl
jz finCopie
mov [ecx], dl
inc eax
inc ecx
jmp suiteCopie
finCopie:
push 0
call OpenClipboard
call EmptyClipboard
push 1 ; CF_TEXT
call SetClipboardData
call CloseClipboard
call GlobalFree
push eax
call ExitProcess
end start
Vous n'êtes pas encore membre ?
inscrivez-vous, c'est gratuit et ça prend moins d'une minute !
Les membres obtiennent plus de réponses que les utilisateurs anonymes.
Le fait d'être membre vous permet d'avoir un suivi détaillé de vos demandes et codes sources.
Le fait d'être membre vous permet d'avoir des options supplémentaires.