Last active
December 26, 2017 20:27
-
-
Save jay/c0600cf31ab89721158c to your computer and use it in GitHub Desktop.
Build RunAtWinlogon program
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
:: This batch file builds the RunAtWinlogon program. | |
:: http://reboot.pro/files/file/255-runatwinlogon/ | |
:: | |
:: BUG: Although this builds both x86 and x64 versions it looks as though | |
:: ServiceKick.au3 needs to be changed if using x64 version from RunAtWinlogon | |
:: to RunAtWinlogon64. | |
:: | |
:: The include and Aut2Exe directories are needed from autoit-v3.zip | |
:: https://www.autoitscript.com/site/autoit/downloads/ | |
:: | |
:: The directory this batch file is in should have this layout: | |
:: Aut2Exe\ | |
:: include\ | |
:: RunAtWinlogon\ | |
:: | |
:: Public Domain: No License. Written by Jay Satiro <raysatiro@yahoo.com> | |
:: | |
:: https://gist.github.com/jay/c0600cf31ab89721158c | |
:: | |
@echo off | |
setlocal ENABLEEXTENSIONS ENABLEDELAYEDEXPANSION | |
set EXITCODE=1 | |
cd /d "%~dp0" || (echo Fatal: Failed cd to batch file dir & goto :EOF) | |
set AUT2EXE=Aut2Exe\Aut2Exe.exe | |
REM Aut2Exe optional: | |
REM /out <outfile.exe> /ico <iconfile.ico> /comp 0-4 /nopack /pack /ansi /unicode /x64 /console /gui | |
REM The source files already have a directive to use the console subsystem | |
REM so /console isn't needed. | |
for %%f in (RunAtWinlogon\*.au3) do ( | |
for /L %%i in (1,1,2) do ( | |
REM First pass x86, next x64 | |
set "OUTFILE=RunAtWinlogon\%%~nf" | |
if %%i == 1 ( | |
set "OUTFILE=!OUTFILE!.exe" | |
set X64= | |
) else ( | |
set "OUTFILE=!OUTFILE!64.exe" | |
set X64=/x64 | |
) | |
del "!OUTFILE!" 1>NUL 2>&1 | |
if exist "!OUTFILE!" ( | |
echo Error: Can't delete old "!OUTFILE!" | |
) else ( | |
"%AUT2EXE%" /in "%%f" /out "!OUTFILE!" /nopack /comp 0 !X64! | |
if not exist "!OUTFILE!" ( | |
echo Error: Can't find new "!OUTFILE!" | |
) else ( | |
echo Processed "!OUTFILE!" | |
) | |
) | |
) | |
) | |
echo Done. | |
set EXITCODE=0 | |
goto cleanup | |
:cleanup | |
:exitfunc | |
exit /b %EXITCODE% |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
@jschicht Thanks for writing RunAtWinlogon. This gist contains the build file I made for it. Also I have some questions.
I notice the archive I downloaded from reboot.pro is missing RunAtWinlogonExec and also in the directions you are using the x86 versions with a path typically found on x64
C:\Program Files (x86)\
?Here is how I'm rebuilding in Win7 x64, let me know if anything looks wrong:
I make the modifications I want and then:
The wrapper terminates immediately:
And I can see ServiceKick.exe is running as SYSTEM. It doesn't run ServiceKick64 as I expected. Also as I noted in the comments I changed RunAtWinlogon to RunAtWinlogon64 in ServiceKick.au3, although I don't know if it's necessary.
Does RunAtWinlogon work for you after going to the switch user screen? It only works for me at UAC.