News:

MASM32 SDK Description, downloads and other helpful links
MASM32.com New Forum Link
masmforum WebSite

DLL's and Functions

Started by Static, July 26, 2005, 12:11:57 PM

Previous topic - Next topic

Static

Ok, first off I'm really inexperienced in ASM. I only started learning it 3 days ago, but I have grasped the basics like If's and the API etc. I already know some assembly from debugging with OllyDBG.

Basically, I have no idea about DLL's and creating functions. I just want to start out with a simple dll, where I will make an app in VB6 that calls this function with 1 argument, and the DLL returns a msgbox containing that argument.
Then I can go onto more advanced things :bg

I'm using RadASM linked to MASM, and I have no idea how to make functions, accept arguments, and return things :lol

Just some general guidance or a point towards some tutorial would help a lot.

Thanks,
Static

PBrennick

The GeneSys Project is available from:
The Repository or My crappy website

Mark Jones

Welcome aboard Static. Please settle in and make yourself at home. The road ahead is a long, but fulfilling one. :bg

Indeed, the Iczelion tutorials come with MASM32 or you can find them on the net at http://win32asm.cjb.net/ - I'd suggest starting there. Answers can usually be found faster by searching MSDN, or searching here using the little search box near the top, or by Googling. Have fun!

"To deny our impulses... foolish; to revel in them, chaos." MCJ 2003.08

IAO

Hi Sr.
I have one small project to resolve your questios. In my house I not have Internet.

I try send to you my complete (entery) project, to email. I work four week to pass information for the LPT port.

No tutorial for this in assembler. 

I send to Mr. ICELON and Mr. Hut, the complete project but I think
they are very, very,  busy mans.

My english is poor. If write one error escusme.
"There is no way to peace. Peace is the way."    Mahatma Gandhi

hutch--

Static,

Welcome on board. Go to the forum web site to the tutorials and have a look at the DLL tutorial tere. Once you get te swing of them they are easy to write and use. One of the main tings is get used to the structure where MASM builds an import library as well as the DLL and when an app written in MASM cals te DLL, normally you would use the import library with it. You must also write a prototype that can be accessed by te calling app so that MASM knows what it does.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

Vortex

Hi Static,

Welcome to the forum.

Also, have a look at :

http://madwizard.org/

tenkey

In VB6, you will also need to add a Declare statement for the Function or Sub you are calling.
A programming language is low level when its programs require attention to the irrelevant.
Alan Perlis, Epigram #8

PBrennick

#7
VB6?  Or does it apply to all Visual Basics?
The GeneSys Project is available from:
The Repository or My crappy website

Static

With the help of a friend who has made a few dll's before, and guidelines from the tutorials posted, I managed to create a dll that use the Read/Write Process Memory API's and returned either a 0 or 1 for Write, and the Value for Read :bg
I'm glad I got into ASM, its not as bad as I thought it was :lol

Thanks again for the guidance everyone

IAO

Hi, I try to sen file.zip But said:

This is an automatically generated Delivery Status Notification.
Delivery to the following recipients failed.
       jamie01@gmail.com

"There is no way to peace. Peace is the way."    Mahatma Gandhi

AeroASM

Quote from: Static on July 27, 2005, 12:03:07 PM
With the help of a friend who has made a few dll's before, and guidelines from the tutorials posted, I managed to create a dll that use the Read/Write Process Memory API's and returned either a 0 or 1 for Write, and the Value for Read :bg
I'm glad I got into ASM, its not as bad as I thought it was :lol

Thanks again for the guidance everyone

It is inefficient to write a DLL to call those functions, when you could call them directly from your (VB) program

PBrennick

maitreva,
gmail imposes a lot of restrictions on attachments, that is why it failed.

Paul
The GeneSys Project is available from:
The Repository or My crappy website

Static

Quote from: AeroASM on July 27, 2005, 04:37:48 PM
Quote from: Static on July 27, 2005, 12:03:07 PM
With the help of a friend who has made a few dll's before, and guidelines from the tutorials posted, I managed to create a dll that use the Read/Write Process Memory API's and returned either a 0 or 1 for Write, and the Value for Read :bg
I'm glad I got into ASM, its not as bad as I thought it was :lol

Thanks again for the guidance everyone

It is inefficient to write a DLL to call those functions, when you could call them directly from your (VB) program
Yeah I'm not writing them for VB, I ony used VB as a test to see if it worked. I am writing it for a very high-level programming language designed in Delphi for beginner game programmers, to test my knowledge of ASM. I have come accross a problem though. This program cannot handle DWORD returns very well, nor send DWORDS as an argument. It can only use 'ty_real' and 'ty_string' and ty_real always returns some strange number.
So is there a way in ASM to turn an integer (the value found from ReadProcessMemory) into a string?

Thanks again,
Static

tenkey

As you are interfacing to an uncommon language, we will need some information about the data types and "calling convention". Chances are, the data types and calling convention will be compatible with Delphi, which will differ in a few ways from the "C" conventions used in most of the code here.
A programming language is low level when its programs require attention to the irrelevant.
Alan Perlis, Epigram #8

Static

Yea I guess it will be more or less the same as delphi. It only uses 2 data types as I previously said, String and Real. Someone at the gamemaker forums said:
QuoteGameMaker can only pass real values as IEEE double precision floating points (64-bits). Return values must also be doubles.
I don't know if that means anything to you.
But when I set the return to be ty_real, then use a built-in gamemaker function to turn it into a string, I ALWAYS end up with 9223372036854775808
I have no idea why though.
I know that it can receive general strings ok because I tested it with a msgbox function, it just has problems with integers.