الفريق العربي للبرمجةأرشيف المنتديات · 2000 – 2023
نسخة أرشيفية للقراءة فقط — التسجيل والمشاركة مغلقان، والمحتوى محفوظ كما كان.

مساعدة في nasm

مغلق
بدأه metbna في 29 أكتوبر 2005 · 4 رد · 983 مشاهدة · في لغة Assembly لأنظمة 16, 32, 64 بت
مشاركة: واتساب X فيسبوك تيليجرام
#1 صاحب الموضوع

كتبت الكود التالي بعد تعديله حتى يتفق مع

winxp sp2

[SECTION .text]
global _start

_start:
;eax holds return value
;ebx will hold function addresses
;ecx will hold string pointers
;edx will hold NULL


	xor eax,eax
	xor ebx,ebx  ;zero out the registers
	xor ecx,ecx
	xor edx,edx

	jmp short GetLibrary
LibraryReturn:
	pop ecx 	 ;get the library string
	mov [ecx + 10], dl	;insert NULL
	mov ebx, ox7c801d77	;LoadLibraryA(libraryname);
	push ecx  ;beginning of user32.dll
	call ebx  ;eax will hold the module handle

	jmp short FunctionName
FunctionReturn:

	pop ecx 	 ;get the address of the Function string
	xor edx,edx
	mov [ecx + 11],dl	;insert NULL
	push ecx
	push eax
	mov ebx, 0x7c80ac28	;GetProcAddress(hmodule,functionname);
	call ebx  ;eax now holds the address of MessageBoxA

	jmp short Message
MessageReturn:
	pop ecx 	 ;get the message string
	xor edx,edx 	 
	mov [ecx+3],dl  ;insert the NULL

	xor edx,edx

	push edx  ;MB_OK
	push ecx  ;title
	push ecx  ;message
	push edx  ;NULL window handle

	call eax  ;MessageBoxA(windowhandle,msg,title,type); Address

ender:
	xor edx,edx
	push eax 	 
	mov eax, 0x7c81caa2	;exitprocess(exitcode);
	call eax  ;exit cleanly so we don't crash the parent program


;the N at the end of each string signifies the location of the NULL
;character that needs to be inserted

GetLibrary:
	call LibraryReturn
	db 'user32.dllN'
FunctionName
	call FunctionReturn
	db 'MessageBoxAN'
Message
	call MessageReturn
	db 'HeyN'

المشكله اني استخدم اصدارة

Nasm98bw

ولم استطع عمل

compile

لاني لا اعرف استخدام الادوات

nasmw , ndisasmw

تم تعديل هذه المشاركة بواسطة Xacker في 29 أكتوبر 2005 في 21:13

مـــــــــــــــــــــــــــــــــــــــــــــــ كـــــــــــــــــــــل احترامي ــــــــــــــــــــــــــــــــــــــع
#2

لم استخدم nasm من قبل.. ولا اعتقد يوجد خطا في الكود ايضا.. بالنسبة للـ compile جرب البارامتر /? مع الملفين بركي بكون فيهم خيار اظهار معلومات عن الاوامر المتوفرة.. ريثما نجد احد يستخدم nasm لمساعدتك..

Do as I say, not as I do

We are Anonymous. We are Legion. We don't forgive. We don't forget

#3

نعم الكود جاهز لايوجد به خطا ويقوم بعرض رساله hey ثم يستدعي exitprocess لانهاء البرنامج انا قمت بالتعديل في تغيير عناوين functiosفي kernel32.dll

حتى يعمل على winXp sp2

في nasm

امر compile كاالتالي

nasm -f elf filename

ولكن مشلكتي مع nasmw

, ndisasmw

حنى اعمل كومبيل لــــــــ file32

مـــــــــــــــــــــــــــــــــــــــــــــــ كـــــــــــــــــــــل احترامي ــــــــــــــــــــــــــــــــــــــع
#4

السلام عليكم ورحمة الله وبركاته

Nasm لا ينتج ملف تنفيذي مباشرة

لعمل Compile لملف MyFile.Asm في بيئة Windoows32

Nasmw -f win32 MyFile.asm

الناتج MyFile.obj قم بعمل Link لتحصل على EXE بإستخدام MS LINK

و إن لك يكن لديك يمكنك إستخدام Alink في الملف المرفق مع مثال

Nasm_Alink.rar

d4baa0.gif
#5

شكرا على الرد عملت جميع الخطوات بدون مشاكل

ولكن لادري لماذا لم تخرج pop up messagebox

العنوان في 0x7c801d77

وليس ox7c801d77 :)

تم تعديل هذه المشاركة بواسطة metbna في 31 أكتوبر 2005 في 00:36

مـــــــــــــــــــــــــــــــــــــــــــــــ كـــــــــــــــــــــل احترامي ــــــــــــــــــــــــــــــــــــــع

هذا الموضوع مغلق.

مواضيع مشابهة