Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @echo off
- TITLE Compiling: m0d_s0beit_sa hook loader
- COLOR 1F
- :: header text
- echo -----------------------------------------------------------
- echo -----------------------------------------------------------
- echo make.bat for m0d_s0beit_sa hook's ASM loader by nuckfuts
- echo -----------------------------------------------------------
- :: init our batch environment
- SETLOCAL EnableDelayedExpansion
- :: check for config file
- IF EXIST .\make_settings.cfg GOTO cfg_init
- echo make_settings.cfg not found.
- :cfg_new1
- IF EXIST .\make_settings.cfg DEL .\make_settings.cfg
- echo Creating a new make_settings.cfg...
- :cfg_msm1
- :: MASM32 installation search
- echo Searching for MASM32 install...
- FOR %%F IN ("%path:;=" "%") DO (
- SET msm_dir=%%~F
- IF EXIST "!msm_dir!\ml.exe" IF EXIST "!msm_dir!\rc.exe" IF EXIST "!msm_dir!\cvtres.exe" IF EXIST "!msm_dir!\link.exe" GOTO cfg_msm2
- )
- ::
- :: possibly here will go a hard-drive scanning feature to find MASM when it's not in path
- ::
- :: MASM32 not found, show error
- GOTO err_msm1
- :cfg_msm2
- SET msm_dir="%msm_dir:~0,-4%"
- echo msm_dir;%msm_dir%>>.\make_settings.cfg
- echo MASM32 installation found at: %msm_dir%
- :: return if called as sub
- IF NOT '%RETURN%'=='' SET tmp=%RETURN% & SET RETURN= & GOTO !tmp!
- :cfg_new9
- :: config creation done, no need to init from file, done
- echo make_settings.cfg creation complete.
- GOTO cfg_done
- :cfg_init
- :: init from config file
- FOR /F "eol= tokens=1,2* delims=;" %%i IN (.\make_settings.cfg) DO (
- IF NOT '%%i'=='' SET %%i=%%j
- )
- :chk_msm
- IF '%msm_dir%'=='' echo MASM32 directory not found in config. & SET RETURN=chk_msm & GOTO cfg_msm1
- :chk_done
- :: done checking the config file
- :cfg_done
- :: configuration totally done
- :init_end
- :: final init procedure
- SET bin_dir=%msm_dir:~1,-1%\bin
- SET lib_dir=%msm_dir:~1,-1%\lib
- SET inc_dir=%msm_dir:~1,-1%\include
- :src_chk
- :: check for needed source files
- IF EXIST .\m0d_s0beit_sa.asm IF EXIST .\m0d_s0beit_sa_rsrc.rc IF EXIST .\image.inc IF EXIST .\image.lib IF EXIST .\UacSucks.manifest GOTO src_ok
- GOTO err_src1
- :src_ok
- :: source code is ok
- :: compiling resource, Pelles Resource Compiler is preferred and auto-detected
- echo.
- echo -----------------------------------------------------------
- echo Compiling resources...
- echo -----------------------------------------------------------
- IF EXIST "%bin_dir%\porc.exe" echo Pelles Resource Compiler & echo Copyright (c) Pelle Orinius & echo. & "%bin_dir%\porc.exe" /v m0d_s0beit_sa_rsrc.rc & echo.
- IF ERRORLEVEL 1 GOTO errasm
- IF NOT EXIST "%bin_dir%\porc.exe" "%bin_dir%\rc.exe" m0d_s0beit_sa_rsrc.rc
- IF ERRORLEVEL 1 GOTO errasm
- :: compiling executable, the latest JWasm with MASM32 v10+ files is prefered and auto-detected
- echo -----------------------------------------------------------
- echo Compiling executable...
- echo -----------------------------------------------------------
- IF EXIST "%bin_dir%\jwasm.exe" "%bin_dir%\jwasm.exe" /c /coff /Cp /I"%inc_dir%" m0d_s0beit_sa.asm
- IF ERRORLEVEL 1 GOTO errasm
- IF NOT EXIST "%bin_dir%\jwasm.exe" "%bin_dir%\ml.exe" /c /coff /Cp /I"%inc_dir%" m0d_s0beit_sa.asm
- IF ERRORLEVEL 1 GOTO errasm
- :: linking executable, the latest Pelles Linker with MASM32 v10+ files is preferred and auto-detected
- echo.
- echo -----------------------------------------------------------
- echo Linking executable...
- echo -----------------------------------------------------------
- IF EXIST "%bin_dir%\polink.exe" echo Pelles Linker & echo Copyright (c) Pelle Orinius & echo. & "%bin_dir%\polink.exe" /SUBSYSTEM:WINDOWS /RELEASE /VERSION:4.0 /LIBPATH:"%lib_dir%" /OUT:"m0d_s0beit_sa.exe" m0d_s0beit_sa.obj m0d_s0beit_sa_rsrc.res
- IF ERRORLEVEL 1 GOTO errlink
- IF NOT EXIST "%bin_dir%\polink.exe" "%bin_dir%\link.exe" /SUBSYSTEM:WINDOWS /RELEASE /VERSION:4.0 /LIBPATH:"%lib_dir%" /OUT:"..\..\..\bin\m0d_s0beit_sa.exe" m0d_s0beit_sa.obj m0d_s0beit_sa_rsrc.res
- IF ERRORLEVEL 1 GOTO errlink
- GOTO :put_bin
- :err_src1
- echo -----------------------------------------------------------
- echo ERROR: Source code not found or incomplete.
- IF NOT EXIST .\m0d_s0beit_sa.asm echo m0d_s0beit_sa.asm not found.
- IF NOT EXIST .\m0d_s0beit_sa_rsrc.rc echo m0d_s0beit_sa_rsrc.rc not found.
- IF NOT EXIST .\image.inc echo image.inc not found.
- IF NOT EXIST .\image.lib echo image.lib not found.
- IF NOT EXIST .\UacSucks.manifest echo UacSucks.manifest not found.
- echo -----------------------------------------------------------
- GOTO end
- :err_msm1
- echo -----------------------------------------------------------
- echo ERROR: MASM32 not fully installed / not in PATH.
- IF NOT EXIST "%msm_dir%\ml.exe" echo ml.exe not found.
- IF NOT EXIST "%msm_dir%\rc.exe" echo rc.exe not found.
- IF NOT EXIST "%msm_dir%\cvtres.exe" echo cvtres.exe not found.
- IF NOT EXIST "%msm_dir%\link.exe" echo link.exe not found.
- echo -----------------------------------------------------------
- goto end
- :errasm
- echo -----------------------------------------------------------
- echo ERROR: Compiling failed.
- echo -----------------------------------------------------------
- GOTO end
- :errlink
- echo -----------------------------------------------------------
- echo ERROR: Linking failed.
- echo -----------------------------------------------------------
- GOTO end
- :put_bin
- del .\m0d_s0beit_sa_rsrc.res
- del .\m0d_s0beit_sa.obj
- echo -----------------------------------------------------------
- echo The project has been built successfully.
- echo -----------------------------------------------------------
- :end
- pause
- cls
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement