News:

Masm32 SDK description, downloads and other helpful links
Message to All Guests
NB: Posting URL's See here: Posted URL Change

Main Menu

Yeah guys still I don't know.

Started by Evan, December 07, 2013, 04:42:37 PM

Previous topic - Next topic

Evan

Quote

.486
.model flat, stdcall
option casemap :none
start:
   byte1 BYTE '11h'
exit
end start



How do I figure out what to include?
I want to be so good at include I make my own include for some bash code like stuff.




What include should I use for basic stuff that looks like BASH and only uses files in it's own folder for Windows?


Do I have to encrypt my own files somehow to demonstrate a permissions system?


Do I have to use usernames for each working directory?


Can I just use bash code instead of masm?


Does it get slower?


dedndave

the masm32 INC (include) files are in \masm32\include\
the LIB (import library) files are in \masm32\lib\

most of the INC files contain prototypes for functions in different operating system DLL's
for example, ExitProcess is prototyped in kernel32.inc, and imported in kernel32.lib
the actual code is in kernel32.dll - a windows file

there is also a very important INC file that has very few (if any) prototypes - windows.inc
windows.inc has a line at the end that includes winextra.inc
so, it's like one big INC file that has been split into 2 files
these files contain many, many windows constants, and should be the first file included

so, if you want a minimal program, you should use ExitProcess, at least
in fact, if that's all you use, you don't need windows.inc, because you won't be using any of the constants
presumably, however, you are going to add other things to the program
so, it's a good idea to start off with windows.inc, anyways

        .586
        .MODEL  Flat,StdCall
        OPTION  CaseMap:None

        INCLUDE     \masm32\windows.inc
        INCLUDE     \masm32\kernel32.inc
        INCLUDELIB  \masm32\lib\kernel32.lib

        .CONST

;constant data (initialized data that may not be over-written)

        .DATA

;initialized data

        .DATA

;uninitialized data

        .CODE

_main   PROC

        INVOKE  ExitProcess,0

_main   ENDP

        END     _main


different operating system DLL's contain other functions
for example, the code for the MessageBox function is in user32.dll
so, you need user32.inc and user32.lib if you want to use that function (simplified explanation)

INC files are text files, even though they have an INC extension
that means that you can open them with NotePad.exe to view them (provided with windows)

there is another "special" INC file in the include folder named masm32rt.inc
open that file to see the contents
it takes care of the most commonly used INC's and LIB's for you
so, you can write a program without all that typing   :biggrin:

        INCLUDE     \masm32\include\masm32rt.inc

        .CONST

;constant data (initialized data that may not be over-written)

        .DATA

;initialized data

        .DATA

;uninitialized data

        .CODE

_main   PROC

        INVOKE  ExitProcess,0

_main   ENDP

        END     _main


once in a while, you will try to use a function that isn't in one of the "common" includes
so, you have to add 2 lines
one example of this is the Multi-Media functions (sound, etc)

        INCLUDE     \masm32\include\masm32rt.inc
        INCLUDE     \masm32\include\winmm.inc
        INCLUDELIB  \masm32\lib\winmm.lib
;
;
;


the way you will know that it needs to be added is
you try to use a function that isn't covered in masm32rt.inc
when you build, it will say something like "undefined symbol, PlaySound"
so - you figure out which INC/LIB files are needed for PlaySound, and add them
one way is to look on the MSDN site
http://msdn.microsoft.com/en-us/library/windows/desktop/dd743680%28v=vs.85%29.aspx
at the bottom of that page, it tells you that PlaySound is in winmm.dll

well - in some cases, the function isn't in the exact INC/LIB for a DLL   :P
so - you can open the masm32\include folder and search for files that contain the text "PlaySound"

Evan

I will try to find out how to make an empty assembly EXE (run on Microsoft computers) program with ExitProcess.

dedndave

i don't know what bash code is   :P
i'll have to google it - lol

here is a program with ExitProcess

        INCLUDE     \masm32\include\masm32rt.inc

        .CODE

_main   PROC

        INVOKE  ExitProcess,0

_main   ENDP

        END     _main

dedndave

ok - bash is a command processor for unix

the windows equivalent is cmd.exe for win32 and command.com for win16
i see that Bash has been ported to windows - but that's another bag of worms

in microsoft lingo, you want to write a "batch" file, with the file extension .BAT
it's a plain text file
basically, it will execute the commands you type into the console window, but from a file
batch files also support a few other commands

if you are familiar with unix, and not windows, you may want to google for "DOS commands"

there are a few BAT files in the \masm32\bin\ folder
to view them, right-click, edit - select NotePad to open them