News:

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

If question

Started by Magnum, August 19, 2011, 04:06:58 AM

Previous topic - Next topic

Magnum

Sometimes I mess up and delete my resource file before I compile.

Is there a way of using If to make sure rsrc.rc is present before compiling ?

Thanks
Have a great day,
                         Andy

dedndave

#1
i put it in the batch file
this one uses MS Link...
@echo off
if not exist dTest.asm goto AsmEnd
if not exist dTest.inc goto AsmEnd
if not exist dTest.rc goto AsmEnd
if not exist dTest.xml goto AsmEnd
if not exist dTest.ico goto AsmEnd
if exist dTest.res del dTest.res
\masm32\bin\rc /v dTest.rc
if not exist dTest.res goto AsmEnd
if exist rsrc.res del rsrc.res
ren dTest.res rsrc.res
if exist rsrc.obj del rsrc.obj
\masm32\bin\cvtres /machine:ix86 rsrc.res
if not exist rsrc.obj goto AsmEnd
echo.
if exist dTest.obj del dTest.obj
\masm32\bin\ml /c /coff dTest.asm
if errorlevel 1 goto AsmEnd
if not exist dTest.obj goto AsmEnd
echo.
if exist dTest.exe del dTest.exe
\masm32\bin\link /SUBSYSTEM:WINDOWS /OPT:NOREF dTest.obj rsrc.obj

:AsmEnd
if exist rsrc.res del rsrc.res
if exist rsrc.obj del rsrc.obj
if exist dTest.obj del dTest.obj
echo.
dir dTest.*  /o-d
pause


this one uses PoLink...
@echo off
if not exist dTest.asm goto AsmEnd
if not exist dTest.inc goto AsmEnd
if not exist dTest.rc goto AsmEnd
if not exist dTest.xml goto AsmEnd
if not exist dTest.ico goto AsmEnd
if exist dTest.res del dTest.res
\masm32\bin\rc /v dTest.rc
if not exist dTest.res goto AsmEnd
echo.
if exist dTest.obj del dTest.obj
\masm32\bin\ml /c /coff dTest.asm
if errorlevel 1 goto AsmEnd
if not exist dTest.obj goto AsmEnd
echo.
echo PoLink: dTest.asm dTest.res
if exist dTest.exe del dTest.exe
\masm32\bin\polink /SUBSYSTEM:WINDOWS /OPT:NOREF dTest.obj dTest.res

:AsmEnd
if exist dTest.res del dTest.res
if exist dTest.obj del dTest.obj
echo.
dir dTest.* /o-d
pause

hutch--

Andy,


@echo off

  if exist rsrc.rc goto proceed
  goto end

:proceed
  @echo It seems to exist.
  goto bye

:end
  @echo Nope, its missing

:bye
  pause
Download site for MASM32      New MASM Forum
https://masm32.com          https://masm32.com/board/index.php

six_L

use the "eXeScope.exe" to restore .rc from exe.
regards

jj2007

Quote from: Magnum on August 19, 2011, 04:06:58 AM
Is there a way of using If to make sure rsrc.rc is present before compiling ?

Here is the version for C programmers, with many many cute brackets :green

@echo off

echo Do you have Masm32?
if exist \masm32\Bin\ml.exe (
echo Yes, it's there!
) else (
echo Nope, can't find it!
)

echo Do you have JWasm?
if exist \masm32\Bin\JWasm.exe (
echo Yes, it's there!
) else (
echo Nope, can't find it!
)

echo Do you have OllyDbg?
if exist \masm32\Bin\OllyDbg.exe (
echo Yes, it's there!
) else (
echo Sorry, it's not in \masm32\Bin
if exist \masm32\OllyDbg\ollydbg.exe (
echo ... but I found it in \masm32\OllyDbg
)
)
pause

Magnum

I wasn't clear.

I meant something I could put in the code itself.

Ex.

If rsrc.rc isn't present, echo "Your resource file is missing for this project."
Have a great day,
                         Andy

jj2007

Quote from: Magnum on August 19, 2011, 01:18:44 PM
I wasn't clear.

I meant something I could put in the code itself.

Ex.

If rsrc.rc isn't present, echo "Your resource file is missing for this project."

No problem:

.code
start:
.If !rv(exist, "rsrc.rc")
MsgBox 0, "Your resource file is missing for this project.", "Bad luck:", MB_OK
exit -99
.endif

Magnum

Have a great day,
                         Andy

raleeper

Quote from: dedndave on August 19, 2011, 04:24:52 AM
i put it in the batch file
this one uses MS Link...


This looks useful.  Thanks.  I'd like to put some of it in my batch file, if you don't mind. ral

dedndave