Skip to content
Permalink
Browse files

fix redirector for win

  • Loading branch information...
madmonkey1907 committed Jan 5, 2017
1 parent 8296c71 commit 6c4bdec2884ae9934c836f262cd1f353d3c829fd
Showing with 25 additions and 25 deletions.
  1. +11 −13 bin/extractimg.bat
  2. +8 −10 bin/makeimg.bat
  3. +2 −1 hakchi-gui/src/wincon.cpp
  4. +4 −1 hakchi-gui/src/worker.cpp
@@ -7,29 +7,27 @@ set infile=%~nx1
set inpath=.\%~n1

if exist "%inpath%" rd /s /q "%inpath%"
if %errorlevel% neq 0 goto error
if errorlevel 1 goto error

md "%inpath%"
if %errorlevel% neq 0 goto error
if errorlevel 1 goto error

unpackbootimg -i "%img%" -o "%inpath%"
if %errorlevel% neq 0 goto error
if errorlevel 1 goto error

lzop -d "%inpath%\%infile%-ramdisk.gz" -o "%inpath%\initramfs.cpio" <nul
if %errorlevel% neq 0 goto error
lzop -d "%inpath%\%infile%-ramdisk.gz" -o "%inpath%\initramfs.cpio"
if errorlevel 1 goto error

md "%inpath%\initramfs"
if %errorlevel% neq 0 goto error
if errorlevel 1 goto error

cd "%inpath%\initramfs"
if %errorlevel% neq 0 goto error
if errorlevel 1 goto error

cpio -imd --no-preserve-owner --quiet -I "..\initramfs.cpio"
if %errorlevel% neq 0 goto error

exit /b %errorlevel%
if errorlevel 1 goto error

exit 0
:error
if %errorlevel% equ 0 set errorlevel=7
echo %0 %1 -^> exit %errorlevel% ?!?
exit /b %errorlevel%
echo %0 %* -^> failed
exit 1
@@ -9,15 +9,15 @@ set img=.\%~nx1.img
if exist "%inpath%\initramfs\hakchi\transfer" rd /s /q "%inpath%\initramfs\hakchi\transfer"
xcopy "%inpath%\..\mod" "%inpath%\initramfs" /h /y /c /r /s /q || cd >nul
if "%2"=="notx" if exist "%inpath%\initramfs\hakchi\transfer" rd /s /q "%inpath%\initramfs\hakchi\transfer"
if %errorlevel% neq 0 goto error
if errorlevel 1 goto error

upx -qq --best "%inpath%\initramfs\sbin\cryptsetup" || cd >nul

mkbootfs "%inpath%\initramfs" > "%inpath%\initramfs.cpio"
if %errorlevel% neq 0 goto error
if errorlevel 1 goto error

lzop --best -f -o "%inpath%\%infile%-ramdisk.gz" "%inpath%\initramfs.cpio" <nul
if %errorlevel% neq 0 goto error
lzop --best -f -o "%inpath%\%infile%-ramdisk.gz" "%inpath%\initramfs.cpio"
if errorlevel 1 goto error

set /p cmdline=<"%inpath%\%infile%-cmdline"
set /p board=<"%inpath%\%infile%-board"
@@ -28,11 +28,9 @@ set /p ramdiskoff=<"%inpath%\%infile%-ramdiskoff"
set /p tagsoff=<"%inpath%\%infile%-tagsoff"

mkbootimg --kernel "%inpath%\%infile%-zImage" --ramdisk "%inpath%\%infile%-ramdisk.gz" --cmdline "%cmdline%" --board "%board%" --base "%base%" --pagesize "%pagesize%" --kernel_offset "%kerneloff%" --ramdisk_offset "%ramdiskoff%" --tags_offset "%tagsoff%" -o "%img%"
if %errorlevel% neq 0 goto error

exit /b %errorlevel%
if errorlevel 1 goto error

exit 0
:error
if %errorlevel% equ 0 set errorlevel=7
echo %0 %1 %2 -^> exit %errorlevel% ?!?
exit /b %errorlevel%
echo %0 %* -^> failed
exit 1
@@ -23,9 +23,10 @@ CWinCon::CWinCon(QObject*parent):QObject(parent)
while((_dup2(filedes[1],STDOUT_FILENO)<0)&&(errno==EINTR)){}
while((_dup2(filedes[1],STDERR_FILENO)<0)&&(errno==EINTR)){}
_close(filedes[1]);
con=_fdopen(filedes[0],"rb");
*stdin=*fopen("nul","rb");
*stdout=*_fdopen(STDOUT_FILENO,"wb");
*stderr=*_fdopen(STDERR_FILENO,"wb");
con=_fdopen(filedes[0],"rb");
#else
while((dup2(filedes[1],STDOUT_FILENO)<0)&&(errno==EINTR)){}
while((dup2(filedes[1],STDERR_FILENO)<0)&&(errno==EINTR)){}
@@ -21,8 +21,11 @@ int system_hidden(const char*cmd)
memset(&pi,0,sizeof(pi));
si.cb=sizeof(STARTUPINFO);
si.dwFlags=STARTF_USESTDHANDLES;
si.hStdInput=(HANDLE)_get_osfhandle(_fileno(stdin));
si.hStdOutput=(HANDLE)_get_osfhandle(_fileno(stdout));
si.hStdError=(HANDLE)_get_osfhandle(_fileno(stderr));
si.hStdError=si.hStdOutput;
SetHandleInformation(si.hStdInput,HANDLE_FLAG_INHERIT,HANDLE_FLAG_INHERIT);
SetHandleInformation(si.hStdOutput,HANDLE_FLAG_INHERIT,HANDLE_FLAG_INHERIT);
QString cmdl("cmd /c ");
cmdl+=QString::fromLocal8Bit(cmd).replace('/','\\');
if(CreateProcessA(getenv("COMSPEC"),cmdl.toLocal8Bit().data(),0,0,TRUE,NORMAL_PRIORITY_CLASS|CREATE_NO_WINDOW,0,0,&si,&pi))

0 comments on commit 6c4bdec

Please sign in to comment.
You can’t perform that action at this time.