Author Topic: Writing windows programs  (Read 17752 times)

nobody

  • Guest
Writing windows programs
« on: January 14, 2010, 07:13:28 AM »
Hi everyone

I've started learning ASM and I have a pretty good understanding of it, but I can not seem to find any resources in regards to writing windows programs.

Is there anywhere I can get an ASM native windows API / interrupt list?   I seem to be going in circles trying to find this :(.   Got a feeling I'm going to have the same problems looking for Linux's version too.

Maybe I'm using the wrong search terms /phrases?

Please advise,

Kind regards,
Luke.

Offline Frank Kotler

  • NASM Developer
  • Hero Member
  • *****
  • Posts: 2667
  • Country: us
Re: Writing windows programs
« Reply #1 on: January 15, 2010, 12:31:28 PM »
Hi Luke,

There isn't an "asm" Windows API, as such. It's just the Windows API, and you find out about it from MicroSoft. I've been hoping a Windows user would come up with a URL for ya, since I don't have one on hand. I guess this is "top"?

http://msdn.microsoft.com/en-us/library/aa383749(VS.85).aspx

You will no doubt want some examples... in Nasm syntax...

http://www.asmcommunity.net/projects/nasmx

No, when you look for the Linux version, you're going to have different problems! :)

Well, kinda the same, in that most of the documentation expects you to be using C... The C interface is the Unix interface. (they make me say that) However, there is an interface to the kernel using int 80h, which is more "asm-ish", I guess. (still a "black box" which you have no choice but to use...) A list of the system calls and their numbers can be found in "unistd.h". The documentation is in section 2 of the man pages. "man 2 write" will get you "sys_write" (just "man write" will tell you about something completely different!)... but it's still expecting C. The most "asm-ish" documentation of the Linux system calls I've found is in Jeff Owens' AsmRef. Get the whole package.

http://www.linuxasmtools.net/

The NASMX project has a Linux version, too...

Best,
Frank

nobody

  • Guest
Re: Writing windows programs
« Reply #2 on: January 15, 2010, 01:52:19 PM »
ok, asking for windows programming alone would be a little bit unclear. I assume we are talking about
- 32 bit win apps
- no COM, DCOM, .net, ...
- no drivers, ... so never use int-calls in your windows code
- on win XP ff.
Thus, a basic win32 (console) program. Then everything is written there:

http://msdn.microsoft.com/en-us/library/aa139672.aspx

Probably not soooo useful for a beginner. Best, you have a look into the win32 examples on

http://win32assembly.online.fr/index.html

There you can find a simple introduction into console as well as win32 application programming in asm, like
- "Hello world"
- MsgBox

This explains the way it works on Windows... Special problems with the special way of Microsoft will rise automatically ;-)

Martin

nobody

  • Guest
Re: Writing windows programs
« Reply #3 on: January 15, 2010, 07:35:44 PM »
Hi guys, thanks for you replies.

I've been to Microsoft's msdn site, but their API is in C/C++ language which is where my problem begins since I don't program in this language.  For sure, I can understand most of it but wouldn't be able to make much use of it.

In some of the resources I read on ASM programming is that, say you wanted to use a windows DLL then you would have to find out that DLL's 'calling convention' /parmeters.   There doesn't seem to be much clear information on how this would be done though, in regards to what registers these certain parmeters go, especially when by defult the API uses C/C++ to do it?

GoASM, which has been quite a usefull resource, says this:

Quote:

Header files - contain the constant values, structures and parameters you need to know about when you call a Windows API.
Many programmers "include" them directly in their source code, so that the constant values and structures can be referred to by name. Typically these files have ".h" or ".inc" extensions.