News:

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

TD Tuts

Started by Xor Stance, February 24, 2005, 02:22:13 AM

Previous topic - Next topic

Xor Stance

I have one problem, all I read at the beginning somehow I understood some and others not even care... After I put my code:


.386
.model flat,stdcall
option casemap:none
include \masm32\include\windows.inc
includelib \masm32\lib\kernel32.lib
includelib \masm32\lib\user32.lib
GetModuleHandleA PROTO :DWORD
ExitProcess      PROTO :DWORD
.const
example_cont equ 0Ah          ;not used example only
.Data
example_text   db "First row",13,10
               db "Second row",0
hInstance      dd 0h                ;our program handle
               
.Code
Main:

push 0h                  ; lpModuleHandle, 0=get program handle
call GetModuleHandleA    ;- API function -
mov hInstance,eax        ;value in eax=handle of our program

ExitPrg:                 ;label for future use
push hInstance           ;push our program handle to exit
call ExitProcess         ;- API Function -

end Main       


I can happily compile it with ml /c /coff file.asm
What I doubt then it tells me,

Td Wrote

rc.exe /v rsrc.rc                                             ;rc command
; cvtres.exe /machine:ix86 rsrc.res
; link.exe /subsystem:windows td_win32asm_000.obj rsrc.obj


Where the heck did that resource file come from? How can I created? Please can anyone tell me descriptively and steps.

Xor Stance

 :8) not the first time that happens but, I somehow see the folder and looked at it. It always happens since most of the time an informal document I get annoy seeing something like that. Maybe it's my age!  :green

Gerhard Putschalka

Hi,
this looks like a procedure in MASM32 Examples. In all these examples the resourcefile.rc (if there any exist!) has the name rsrc.rc.

Depending on existing or not, Rc.exe will be executed (compiling rsrc.rc) and later the link execution has to link (or not) the rsrc.obj file.

Look at the following example showing the difference when the resorcefile exists or not exists.

Do you need a resourcefile? I mean in your program, do you access to any elements in a resourcefile?

Good luck
Gerhard.

============== the Car.bat file for compiling (the asm-modul has the name "CAR.ASM").
@echo off
: -------------------------------
: if resources exist, build them, otherwise skip the compiling
: -------------------------------
if not exist rsrc.rc goto over1
D:\MASM32\BIN\Rc.exe /v rsrc.rc
D:\MASM32\BIN\Cvtres.exe /machine:ix86 rsrc.res
:over1


D:\MASM32\BIN\Ml.exe /c /coff car.asm
if errorlevel 1 goto errasm

if not exist rsrc.obj goto nores

: --------------------------------------------------
: link the main OBJ file with the resource OBJ file
: --------------------------------------------------
D:\MASM32\BIN\Link.exe /SUBSYSTEM:WINDOWS car.obj rsrc.obj
if errorlevel 1 goto errlink
dir car.*
goto TheEnd

:nores
: -----------------------
: link the main OBJ file without an existing resourcefile
: -----------------------
D:\MASM32\BIN\Link.exe /SUBSYSTEM:WINDOWS car.obj
if errorlevel 1 goto errlink
dir car.*
goto TheEnd

:errlink
: ----------------------------------------------------
: display message if there is an error during linking
: ----------------------------------------------------
echo.
echo There has been an error while linking this project.
echo.
goto TheEnd

:errasm
: -----------------------------------------------------
: display message if there is an error during assembly
: -----------------------------------------------------
echo.
echo There has been an error while assembling this project.
echo.
goto TheEnd

:TheEnd

pause

hutch--

Char,

Which one of TD's tutes are you trying to build ?
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

AeroASM

Use ml /c /coff file.asm at the command line.
Then use link /subsystem:windows file.obj.
It should work this way.

Also, at the end you should pass 0 to ExitProcess, not hInstance. ExitProcess takes the error code of the application, not the instance handle. Error code 0 = success.

Xor Stance

Quote from: hutch-- on February 25, 2005, 04:12:03 PM
Char,

Which one of TD's tutes are you trying to build ?

The first one, thanks aeroasm!

Xor Stance

Gerhard,

http://www.website.masmforum.com/files.htm

This link was gotten at movsd.com > masmforum website > files > test deparment tutorials. The .rc file is contained at the tutorial folder.

hutch--

Char,

I just copied TD's examples to my dev drive, made sure there were no long names with spaces in the path and it built in QE. What I have found with a few of the other examples is you must fill in the paths for the libraries and correct the path for the include files as the ones I have opened were set to drive D: Everything is building fine.
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php