dir-s-suicide/dir_sans_gui.asm
2025-04-30 17:05:01 +02:00

54 lines
No EOL
1.2 KiB
NASM

.386
.model flat,stdcall
option casemap:none
WinMain proto :DWORD
include c:\masm32\include\windows.inc
include c:\masm32\include\gdi32.inc
include c:\masm32\include\gdiplus.inc
include c:\masm32\include\user32.inc
include c:\masm32\include\kernel32.inc
includelib c:\masm32\lib\kernel32.lib
includelib c:\masm32\lib\gdi32.lib
includelib c:\masm32\lib\user32.lib
.DATA
ClassName db "C:\Users\jerem\Desktop\Save\Cour\2024-2025\Assembleur\td1\projet\",0
.DATA?
hInstance HINSTANCE ?
.CODE
; Dev un DIR \s sans GUI
; 1. Afficher la liste des fichier présent dans le terminal (sans GUI)
start:
push ebp
mov ebp, esp
mov eax, [ebp+8] ; Get the first argument (directory path)
invoke FindFirstFile, ClassName, eax
mov hInstance, eax ; Store the handle to the first file
boucle:
invoke FindNextFile, hInstance, eax ; Get the next file in the directory
cmp eax, 0 ; Check if there are more files
je fin ; If no more files, exit the loop
; Display the file name in the console
invoke ctr_printf, "%s\n", eax
jmp boucle ; Repeat for the next file
fin:
invoke FindClose, hInstance ; Close the file handle
push 0
call ExitProcess
end start