From 0acb0f46b596fd7ffe39413b95159921c573b82e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=A9r=C3=A9my?= Date: Wed, 30 Apr 2025 17:05:01 +0200 Subject: [PATCH] =?UTF-8?q?add:=20pas=20s=C3=BBr=20de=20ce=20que=20sa=20fa?= =?UTF-8?q?it?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitignore | 4 +++- dir_sans_gui.asm | 54 ++++++++++++++++++++++++++++++++++++++++++++++++ make.bat | 4 ++-- make.sh | 3 --- 4 files changed, 59 insertions(+), 6 deletions(-) create mode 100644 dir_sans_gui.asm delete mode 100644 make.sh diff --git a/.gitignore b/.gitignore index f6bb4a4..13263e8 100644 --- a/.gitignore +++ b/.gitignore @@ -1,2 +1,4 @@ *.obj -*.exe \ No newline at end of file +*.exe +*.sh + diff --git a/dir_sans_gui.asm b/dir_sans_gui.asm new file mode 100644 index 0000000..1cd3679 --- /dev/null +++ b/dir_sans_gui.asm @@ -0,0 +1,54 @@ +.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 \ No newline at end of file diff --git a/make.bat b/make.bat index 9dbfc66..b9b3699 100644 --- a/make.bat +++ b/make.bat @@ -1,4 +1,4 @@ @echo off -c:\masm32\bin\ml /c /Zd /coff dir.asm -c:\\masm32\bin\Link /SUBSYSTEM:CONSOLE dir.obj +c:\masm32\bin\ml /c /Zd /coff dir_sans_gui.asm +c:\\masm32\bin\Link /SUBSYSTEM:CONSOLE dir_sans_gui.obj pause \ No newline at end of file diff --git a/make.sh b/make.sh deleted file mode 100644 index fe95684..0000000 --- a/make.sh +++ /dev/null @@ -1,3 +0,0 @@ -masm dir.asm -mlink dir.obj -wine dir.exe \ No newline at end of file