Other Programming Languages
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsProgramming Languages - MoreOther Programming Languages

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Get inside! Sample the range of functionality easily built with JMSL Library for Time Series Data Analysis, Heat Maps, Portfolio Optimization, Monte Carlo Simulation, Stock Price Charting and more. Download Now!
  #1  
Old May 10th, 2007, 09:08 PM
muhaa muhaa is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2006
Posts: 46 muhaa User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 h 15 m 57 sec
Reputation Power: 3
Finding the function adress when load dll

Hey guys i got a little problem ive created a little program
here it is.

Code:
#include <windows.h>

int main()
{
	MessageBox(0, 0, 0, 0);
	ExitProcess(0);

	return 0;
}


I was guna turn this into asm like the following

Code:
[BITS 32]
start:
	xor edx, edx         ; Avoids NULL byte
	push edx             ; MsgBox type
	push edx             ; MsgBox body
	push edx             ; MsgBox caption
	push edx             ; Owner hWnd
	mov eax, 0x77d804ea  ; Addr of MessageBox, USER32 should be loaded
	call eax

	xor eax, eax         ; Avoids NULL byte     
	push eax             ; Exit code
	mov eax, 0x7c81caa2  ; Addr of  ExitProcess,KERNEL32 should be loaded
     	call eax


Now i went to set the function adress for MessageBox in user32.dll but couldnt find it erm erm i couldn find MessageBoxA which function messagebox in my code in the user32.dll..Any help would be much apriciated..Im using win xp service pack 2 english.From what ive read there is no MessageBox function in user32.dll ..

Last edited by muhaa : May 10th, 2007 at 09:40 PM.

Reply With Quote
  #2  
Old May 13th, 2007, 01:43 AM
jwdonahue jwdonahue is offline
Bellevue WA, USA
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: May 2004
Location: Bellevue Washington, USA
Posts: 1,038 jwdonahue User rank is Second Lieutenant (5000 - 10000 Reputation Level)jwdonahue User rank is Second Lieutenant (5000 - 10000 Reputation Level)jwdonahue User rank is Second Lieutenant (5000 - 10000 Reputation Level)jwdonahue User rank is Second Lieutenant (5000 - 10000 Reputation Level)jwdonahue User rank is Second Lieutenant (5000 - 10000 Reputation Level)jwdonahue User rank is Second Lieutenant (5000 - 10000 Reputation Level)jwdonahue User rank is Second Lieutenant (5000 - 10000 Reputation Level) 
Time spent in forums: 6 Days 23 h 14 m 51 sec
Reputation Power: 66
MessageBoxA() and MessageBoxW() are both implemented in user32.dll. I think your assumption that User32 and Kernel32 "should be loaded" is... well they probably are loaded, but what have you done to map them into your process? Those hard coded addresses you are calling through eax look a bit spooky. Why aren't you using windows.inc?

You should have something like call MessageBox or [i]invoke MessageBox instead. It's been a really long time since I wrote any assembler for Windows. Try [url]http://www.grc.com/smgassembly.htm[url] for an example of how to do this properly.

Google assembler+windows for more links.
__________________
It's not always a matter of what you can do with a language, but whether you should. [JwD]

Reply With Quote
  #3  
Old May 13th, 2007, 09:45 AM
muhaa muhaa is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2006
Posts: 46 muhaa User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 7 h 15 m 57 sec
Reputation Power: 3
M8 could you show me of an example in asm haw it should be done .And also im using nasmw not masm that is the reason i cant .inc ...

Last edited by muhaa : May 13th, 2007 at 09:48 AM.

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreOther Programming Languages > Finding the function adress when load dll


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 4 hosted by Hostway