Page 1 of 1

NASM in Windows

Posted: Mon Apr 08, 2013 3:07 pm
by hazique35
I know I shouldnt ask this here because it is such a newbie question, but I have thoroughly looked everywhere and cannot find anything! All I have been able to find out is how to run a program which is pretty useless considering I cannot write any code. Ive fouund a couple of websites, but they all use this 'extern' stuff. Like 'ExitProcess', isnt there a way to do this without using this? All I really need is a point in the right direction and I will pretty much be able to work out the rest.

thanks

Re: NASM in Windows

Posted: Mon Apr 08, 2013 3:53 pm
by Brendan
Hi,
hazique35 wrote:I know I shouldnt ask this here because it is such a newbie question, but I have thoroughly looked everywhere and cannot find anything! All I have been able to find out is how to run a program which is pretty useless considering I cannot write any code. Ive fouund a couple of websites, but they all use this 'extern' stuff. Like 'ExitProcess', isnt there a way to do this without using this? All I really need is a point in the right direction and I will pretty much be able to work out the rest.
The short answer is: no, there's no easy way to use the Windows kernel API directly, without (either directly or indirectly) using one or more DLLs.

The longer answer is that Microsoft don't provide any public documentation to allow this, because they want to make sure they can change the kernel API without breaking lots of people's code. They give you DLLs so that they can change the kernel and the DLLs at the same time and not break anything. Also note that POSIX is similar for similar reasons - your code is dynamically linked against the system's shared library, so that the same binary can run on any "POSIX compatible" OS regardless of how different the underlying kernel APIs may be (because the shared library hides any differences).

The even longer answer is that it actually is possible (with enough reverse engineering and large quantities of hacks and testing to make the code adapt to any differences in kernel APIs in different versions of Windows). This is not the even longer answer. This is just a tribute. I couldn't remember the even longer answer. This is a tribute, to the even longer answer. #-o


Cheers,

Brendan

Re: NASM in Windows

Posted: Mon Apr 08, 2013 5:36 pm
by hazique35
alright, thanks.

Re: NASM in Windows

Posted: Mon Apr 08, 2013 9:02 pm
by Love4Boobies
Brendan wrote:This is not the even longer answer. This is just a tribute. I couldn't remember the even longer answer. This is a tribute, to the even longer answer. #-o
Ti Tuga digga tu Gi Friba fligugibu Uh Fligugigbu Uh Di Ei Friba Du Gi Fligu fligugigugi Flilibili Ah
(Bow) (Bow) (Bow) (Ooh) (Bow) (Bi)
Fligu wene mamamana Sacrebleu!

Re: NASM in Windows

Posted: Tue Apr 09, 2013 7:57 am
by Mikemk
It's completely possible, if you read the dll symbol tables to find what to execute. Of course, you'd have to find a way to open the files without the windows api, and to load the files into your applications code segment rather than data . . . sounds like a fun challenge.

Re: NASM in Windows

Posted: Tue Apr 09, 2013 6:10 pm
by Gigasoft
This is ridiculous. Nasm works just fine. Of course you can use extern. And if you had read the manual, you would have figured out how to use it. Do you really think they would make an assembler for Windows and not let you import anything from DLLs?

Re: NASM in Windows

Posted: Tue Apr 09, 2013 8:25 pm
by Mikemk
I think the OP is asking about doing the interface himself.