diff --git a/Makefile b/Makefile index 36ecd15..54cc860 100755 --- a/Makefile +++ b/Makefile @@ -12,6 +12,8 @@ build: zip -v -q -r package-script.zip package-script cp -rv VM deb/opt/apps/deepin-wine-runner cp -rv AllInstall.py deb/opt/apps/deepin-wine-runner + cp -rv req deb/opt/apps/deepin-wine-runner + cp -rv RegShot deb/opt/apps/deepin-wine-runner cp -rv BeCyIconGrabber.exe deb/opt/apps/deepin-wine-runner cp -rv deepin-wine-packager-with-script.py deb/opt/apps/deepin-wine-runner cp -rv deepin-wine-packager.py deb/opt/apps/deepin-wine-runner diff --git a/RegShot/182to183.exe b/RegShot/182to183.exe new file mode 100644 index 0000000..29bb56c Binary files /dev/null and b/RegShot/182to183.exe differ diff --git a/RegShot/build/CMakeLists.txt b/RegShot/build/CMakeLists.txt new file mode 100644 index 0000000..f159545 --- /dev/null +++ b/RegShot/build/CMakeLists.txt @@ -0,0 +1,114 @@ +### +### CMake settings +### +# see http://www.cmake.org/Wiki/CMake_Policies +cmake_minimum_required(VERSION 2.8) + + +### +### Project settings +### +project(RegShot) + +set(EXE_SUFFIX "-alpha") + + +### +### Project options +### + +## Build options +# --> Microsoft Visual C++ +# see http://msdn.microsoft.com/en-us/library/aa278396(v=VS.60).aspx +# http://msdn.microsoft.com/en-us/library/2kzt1wy3(v=VS.71).aspx +option(MSVC_SHARED_RT "MSVC: Build with shared runtime libs (/MD)" OFF) +option(MSVC_STHREADED_RT "MSVC: Build with single-threaded static runtime libs (/ML until VS .NET 2003)" OFF) + + +### +### Sources, headers, directories and libs +### +file(GLOB sources "../src/[a-zA-Z]*.c") +file(GLOB private_headers "../src/[a-zA-Z]*.h") +file(GLOB resources "../src/[a-zA-Z]*.rc") +file(GLOB manifests "../src/res/[a-zA-Z]*.manifest") + + +### +### General compilation settings +### +if(WIN32) + if(CMAKE_INSTALL_PREFIX_INITIALIZED_TO_DEFAULT) + set(CMAKE_INSTALL_PREFIX "C:/") + endif() +endif() + +# GCC specialities +if(CMAKE_COMPILER_IS_GNUC) + message(FATAL_ERROR "GNU compiler not supported. Patch submissions welcome.") +endif() + +# Microsoft VisualC++ specialities +if(MSVC) + ### General stuff + # a) Change MSVC runtime library settings (/MD[d], /MT[d], /ML[d] (single-threaded until VS 2003)) + # plus set lib suffix for later use and project label accordingly + # see http://msdn.microsoft.com/en-us/library/aa278396(v=VS.60).aspx + # http://msdn.microsoft.com/en-us/library/2kzt1wy3(v=VS.71).aspx + set(LIB_RT_SUFFIX "md") # CMake defaults to /MD for MSVC + set(LIB_RT_OPTION "/MD") + # + if(NOT MSVC_SHARED_RT) # User wants to have static runtime libraries (/MT, /ML) + if(MSVC_STHREADED_RT) # User wants to have old single-threaded static runtime libraries + set(LIB_RT_SUFFIX "ml") + set(LIB_RT_OPTION "/ML") + if(NOT ${MSVC_VERSION} LESS 1400) + message(FATAL_ERROR "Single-threaded static runtime libraries (/ML) only available until VS .NET 2003 (7.1).") + endif() + else() + set(LIB_RT_SUFFIX "mt") + set(LIB_RT_OPTION "/MT") + endif() + + # correct linker options + foreach(flag_var CMAKE_C_FLAGS CMAKE_CXX_FLAGS) + foreach(config_name "" DEBUG RELEASE MINSIZEREL RELWITHDEBINFO) + set(var_name "${flag_var}") + if(NOT "${config_name}" STREQUAL "") + set(var_name "${var_name}_${config_name}") + endif() + string(REPLACE "/MD" "${LIB_RT_OPTION}" ${var_name} "${${var_name}}") + endforeach() + endforeach() + endif() + # + set(LABEL_SUFFIX "${LABEL_SUFFIX} ${LIB_RT_SUFFIX}") + + ### Project stuff + if(NOT ${MSVC_VERSION} LESS 1400) + add_definitions(-D_CRT_SECURE_NO_WARNINGS) + endif() + + if(CMAKE_CL_64) + set(PLATFORM_SUFFIX "-x64") + else() + set(PLATFORM_SUFFIX "") + endif() +endif() + + +### +### Executable +### +add_executable(${PROJECT_NAME}${PLATFORM_SUFFIX}${EXE_SUFFIX} + WIN32 + ${sources} + ${private_headers} + ${resources} + ${manifests} +) + +set_target_properties(${PROJECT_NAME}${PLATFORM_SUFFIX}${EXE_SUFFIX} + PROPERTIES + PROJECT_LABEL "${PROJECT_NAME}${PLATFORM_SUFFIX}${EXE_SUFFIX}${LABEL_SUFFIX}" +) diff --git a/RegShot/build/build_wdk.bat b/RegShot/build/build_wdk.bat new file mode 100644 index 0000000..438f87c --- /dev/null +++ b/RegShot/build/build_wdk.bat @@ -0,0 +1,166 @@ +@ECHO OFF +rem ****************************************************************************** +rem * Copyright 2010-2011 XhmikosR +rem * +rem * This file is part of Regshot. +rem * +rem * Regshot is free software; you can redistribute it and/or modify +rem * it under the terms of the GNU General Public License as published by +rem * the Free Software Foundation; either version 2 of the License, or +rem * (at your option) any later version. +rem * +rem * Regshot is distributed in the hope that it will be useful, +rem * but WITHOUT ANY WARRANTY; without even the implied warranty of +rem * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +rem * GNU General Public License for more details. +rem * +rem * You should have received a copy of the GNU General Public License +rem * along with Regshot; if not, write to the Free Software +rem * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +rem * +rem * +rem * build_wdk.bat +rem * Batch file "wrapper" for makefile.mak, used to build Regshot with WDK +rem ****************************************************************************** + + +SETLOCAL ENABLEEXTENSIONS +CD /D %~dp0 + +rem Set the WDK directory +IF NOT DEFINED WDKBASEDIR SET "WDKBASEDIR=C:\WinDDK\7600.16385.1" + +rem Check the building environment +IF NOT EXIST "%WDKBASEDIR%" CALL :SUBMSG "ERROR" "Specify your WDK directory!" + + +rem Check for the help switches +IF /I "%~1" == "help" GOTO SHOWHELP +IF /I "%~1" == "/help" GOTO SHOWHELP +IF /I "%~1" == "-help" GOTO SHOWHELP +IF /I "%~1" == "--help" GOTO SHOWHELP +IF /I "%~1" == "/?" GOTO SHOWHELP + + +rem Check for the first switch +IF "%~1" == "" ( + SET "BUILDTYPE=Build" +) ELSE ( + IF /I "%~1" == "Build" SET "BUILDTYPE=Build" & GOTO CHECKSECONDARG + IF /I "%~1" == "/Build" SET "BUILDTYPE=Build" & GOTO CHECKSECONDARG + IF /I "%~1" == "-Build" SET "BUILDTYPE=Build" & GOTO CHECKSECONDARG + IF /I "%~1" == "--Build" SET "BUILDTYPE=Build" & GOTO CHECKSECONDARG + IF /I "%~1" == "Clean" SET "BUILDTYPE=Clean" & GOTO CHECKSECONDARG + IF /I "%~1" == "/Clean" SET "BUILDTYPE=Clean" & GOTO CHECKSECONDARG + IF /I "%~1" == "-Clean" SET "BUILDTYPE=Clean" & GOTO CHECKSECONDARG + IF /I "%~1" == "--Clean" SET "BUILDTYPE=Clean" & GOTO CHECKSECONDARG + IF /I "%~1" == "Rebuild" SET "BUILDTYPE=Rebuild" & GOTO CHECKSECONDARG + IF /I "%~1" == "/Rebuild" SET "BUILDTYPE=Rebuild" & GOTO CHECKSECONDARG + IF /I "%~1" == "-Rebuild" SET "BUILDTYPE=Rebuild" & GOTO CHECKSECONDARG + IF /I "%~1" == "--Rebuild" SET "BUILDTYPE=Rebuild" & GOTO CHECKSECONDARG + + ECHO. + ECHO Unsupported commandline switch! + ECHO Run "%~nx0 help" for details about the commandline switches. + CALL :SUBMSG "ERROR" "Compilation failed!" +) + + +:CHECKSECONDARG +rem Check for the second switch +IF "%~2" == "" ( + SET "ARCH=all" +) ELSE ( + IF /I "%~2" == "x86" SET "ARCH=x86" & GOTO START + IF /I "%~2" == "/x86" SET "ARCH=x86" & GOTO START + IF /I "%~2" == "-x86" SET "ARCH=x86" & GOTO START + IF /I "%~2" == "--x86" SET "ARCH=x86" & GOTO START + IF /I "%~2" == "x64" SET "ARCH=x64" & GOTO START + IF /I "%~2" == "/x64" SET "ARCH=x64" & GOTO START + IF /I "%~2" == "-x64" SET "ARCH=x64" & GOTO START + IF /I "%~2" == "--x64" SET "ARCH=x64" & GOTO START + IF /I "%~2" == "all" SET "ARCH=all" & GOTO START + IF /I "%~2" == "/all" SET "ARCH=all" & GOTO START + IF /I "%~2" == "-all" SET "ARCH=all" & GOTO START + IF /I "%~2" == "--all" SET "ARCH=all" & GOTO START + + ECHO. + ECHO Unsupported commandline switch! + ECHO Run "%~nx0 help" for details about the commandline switches. + CALL :SUBMSG "ERROR" "Compilation failed!" +) + + +:START +IF "%ARCH%" == "x64" GOTO x64 +IF "%ARCH%" == "x86" GOTO x86 + + +:x86 +SET "INCLUDE=%WDKBASEDIR%\inc\api;%WDKBASEDIR%\inc\api\crt\stl60;%WDKBASEDIR%\inc\crt;%WDKBASEDIR%\inc\ddk" +SET "LIB=%WDKBASEDIR%\lib\crt\i386;%WDKBASEDIR%\lib\win7\i386" +SET "PATH=%WDKBASEDIR%\bin\x86;%WDKBASEDIR%\bin\x86\x86" + +TITLE Building Regshot x86 with WDK... +ECHO. & ECHO. + +CALL :SUBNMAKE + +IF "%ARCH%" == "x86" GOTO END + + +:x64 +SET "INCLUDE=%WDKBASEDIR%\inc\api;%WDKBASEDIR%\inc\api\crt\stl60;%WDKBASEDIR%\inc\crt;%WDKBASEDIR%\inc\ddk" +SET "LIB=%WDKBASEDIR%\lib\crt\amd64;%WDKBASEDIR%\lib\win7\amd64" +SET "PATH=%WDKBASEDIR%\bin\x86;%WDKBASEDIR%\bin\x86\amd64" + +TITLE Building Regshot x64 with WDK... +ECHO. & ECHO. + +CALL :SUBNMAKE "x64=1" + + +:END +TITLE Building Regshot with WDK - Finished! +ENDLOCAL +EXIT /B + + +:SUBNMAKE +nmake /NOLOGO /f "makefile.mak" %BUILDTYPE% %1 +IF %ERRORLEVEL% NEQ 0 CALL :SUBMSG "ERROR" "Compilation failed!" +EXIT /B + + +:SHOWHELP +TITLE "%~nx0 %1" +ECHO. & ECHO. +ECHO Usage: %~nx0 [Clean^|Build^|Rebuild] [x86^|x64^|all] +ECHO. +ECHO Notes: You can also prefix the commands with "-", "--" or "/". +ECHO The arguments are not case sensitive. +ECHO. & ECHO. +ECHO Edit "%~nx0" and set your WDK directory. +ECHO You shouldn't need to make any changes other than that. +ECHO. & ECHO. +ECHO Executing "%~nx0" will use the defaults: "%~nx0 build all" +ECHO. +ECHO If you skip the second argument the default one will be used. Example: +ECHO "%~nx0 rebuild" is the same as "%~nx0 rebuild all" +ECHO. +ECHO WARNING: "%~nx0 x86" won't work. +ECHO. +ENDLOCAL +EXIT /B + + +:SUBMSG +ECHO. & ECHO ______________________________ +ECHO [%~1] %~2 +ECHO ______________________________ & ECHO. +IF /I "%~1" == "ERROR" ( + PAUSE + EXIT +) ELSE ( + EXIT /B +) diff --git a/RegShot/build/cmake_how_to_create_project_files.txt b/RegShot/build/cmake_how_to_create_project_files.txt new file mode 100644 index 0000000..2fcb3a0 --- /dev/null +++ b/RegShot/build/cmake_how_to_create_project_files.txt @@ -0,0 +1,66 @@ +CMake allows to create project and make files for many different compilers from +a single source. This text will tell you how to create project files for RegShot. +If your compiler is not explained here then check out CMake's good documentation +at http://www.cmake.org/cmake/help/documentation.html + +First get CMake from http://www.cmake.org/ (Resources -> Download). +On Windows either use the installer, or extract the zip to a folder which will +contain the CMake folder and then add CMake's bin folder to your path. + +It is recommended to build out-of-source and not inside the source directory. + +The following commands use shell variables to allow re-using them via a script. + + +Preparation for different compilers: +==================================== +* set TDIR=vc6 & set CMGEN="Visual Studio 6" + "%ProgramFiles%\Microsoft Visual Studio\VC98\Bin\vcvars32.bat" + +* set TDIR=vc2002 & set CMGEN="Visual Studio 7" + "%ProgramFiles%\Microsoft Visual Studio .NET\VC7\bin\vcvars32.bat" + +* set TDIR=vc2003 & set CMGEN="Visual Studio 7 .NET 2003" + "%ProgramFiles%\Microsoft Visual Studio .NET 2003\VC7\bin\vcvars32.bat" + +* set TDIR=vc2005 & set CMGEN="Visual Studio 8 2005" + "%ProgramFiles%\Microsoft Visual Studio 8\VC\vcvarsall.bat" + +* set TDIR=vc2005-x64 & set CMGEN="Visual Studio 8 2005 Win64" + "%ProgramFiles%\Microsoft Visual Studio 8\VC\vcvarsall.bat" + +* set TDIR=vc2008 & set CMGEN="Visual Studio 9 2008" + "%ProgramFiles%\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" + +* set TDIR=vc2008-x64 & set CMGEN="Visual Studio 9 2008 Win64" + "%ProgramFiles%\Microsoft Visual Studio 9.0\VC\vcvarsall.bat" + +* set TDIR=vc2010 & set CMGEN="Visual Studio 10" + "%ProgramFiles%\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" + +* set TDIR=vc2010-x64 & set CMGEN="Visual Studio 10 Win64" + "%ProgramFiles%\Microsoft Visual Studio 10.0\VC\vcvarsall.bat" + + +Creating project files: +======================= +* cd /d C:\Coding\Regshot\trunk +* set CMOPTS= + Here you can set options to modify the resulting project files. + All options are listed in CMakeLists.txt and are normally self-explaining. + * Some important ones are: + -DMSVC_SHARED_RT=ON - link with shared runtime libs on MSVC + * Example: + set CMOPTS=-DMSVC_SHARED_RT=ON + +* mkdir bin\%TDIR% +* cd bin\%TDIR% +* del /s /q * & rmdir /s /q . +* cmake %CMOPTS% -G %CMGEN% ..\..\build + + +Tested compilers: +================= +VS 6 (32-Bit, Maddes, just remove DS_SHELLFONT from src/regshot.rc) +VS 2002 (32-Bit, Maddes) +VS 2008 (32-Bit & 64-Bit, Maddes) diff --git a/RegShot/build/make_zip.bat b/RegShot/build/make_zip.bat new file mode 100644 index 0000000..8fd6eaa --- /dev/null +++ b/RegShot/build/make_zip.bat @@ -0,0 +1,280 @@ +@ECHO OFF +rem ****************************************************************************** +rem * Copyright 2010-2011 XhmikosR +rem * +rem * This file is part of Regshot. +rem * +rem * Regshot is free software; you can redistribute it and/or modify +rem * it under the terms of the GNU General Public License as published by +rem * the Free Software Foundation; either version 2 of the License, or +rem * (at your option) any later version. +rem * +rem * Regshot is distributed in the hope that it will be useful, +rem * but WITHOUT ANY WARRANTY; without even the implied warranty of +rem * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +rem * GNU General Public License for more details. +rem * +rem * You should have received a copy of the GNU General Public License +rem * along with Regshot; if not, write to the Free Software +rem * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +rem * +rem * +rem * make_packages.bat +rem * Batch file for building Regshot with WDK and creating the zip packages +rem ****************************************************************************** + + +SETLOCAL +CD /D %~dp0 + + +rem Check for the help switches +IF /I "%~1" == "help" GOTO SHOWHELP +IF /I "%~1" == "/help" GOTO SHOWHELP +IF /I "%~1" == "-help" GOTO SHOWHELP +IF /I "%~1" == "--help" GOTO SHOWHELP +IF /I "%~1" == "/?" GOTO SHOWHELP + + +rem Check for the first switch +IF "%~1" == "" ( + SET INPUTDIRx86=bin\WDK\Release_Win32 + SET INPUTDIRx64=bin\WDK\Release_x64 + SET SUFFIX=_WDK +) ELSE ( + IF /I "%~1" == "WDK" ( + SET INPUTDIRx86=bin\WDK\Release_Win32 + SET INPUTDIRx64=bin\WDK\Release_x64 + SET SUFFIX=_WDK + GOTO START + ) + IF /I "%~1" == "/WDK" ( + SET INPUTDIRx86=bin\WDK\Release_Win32 + SET INPUTDIRx64=bin\WDK\Release_x64 + SET SUFFIX=_WDK + GOTO START + ) + IF /I "%~1" == "-WDK" ( + SET INPUTDIRx86=bin\WDK\Release_Win32 + SET INPUTDIRx64=bin\WDK\Release_x64 + SET SUFFIX=_WDK + GOTO START + ) + IF /I "%~1" == "--WDK" ( + SET INPUTDIRx86=bin\WDK\Release_Win32 + SET INPUTDIRx64=bin\WDK\Release_x64 + SET SUFFIX=_WDK + GOTO START + ) + IF /I "%~1" == "VS2010" ( + SET INPUTDIRx86=bin\VS2010\Release_Win32 + SET INPUTDIRx64=bin\VS2010\Release_x64 + SET SUFFIX=_VS2010 + GOTO START + ) + IF /I "%~1" == "/VS2010" ( + SET INPUTDIRx86=bin\VS2010\Release_Win32 + SET INPUTDIRx64=bin\VS2010\Release_x64 + SET SUFFIX=_VS2010 + GOTO START + ) + IF /I "%~1" == "-VS2010" ( + SET INPUTDIRx86=bin\VS2010\Release_Win32 + SET INPUTDIRx64=bin\VS2010\Release_x64 + SET SUFFIX=_VS2010 + GOTO START + ) + IF /I "%~1" == "--VS2010" ( + SET INPUTDIRx86=bin\VS2010\Release_Win32 + SET INPUTDIRx64=bin\VS2010\Release_x64 + SET SUFFIX=_VS2010 + GOTO START + ) + IF /I "%~1" == "VS2008" ( + SET INPUTDIRx86=bin\VS2008\Release_Win32 + SET INPUTDIRx64=bin\VS2008\Release_x64 + SET SUFFIX=_VS2008 + GOTO START + ) + IF /I "%~1" == "/VS2008" ( + SET INPUTDIRx86=bin\VS2008\Release_Win32 + SET INPUTDIRx64=bin\VS2008\Release_x64 + SET SUFFIX=_VS2008 + GOTO START + ) + IF /I "%~1" == "-VS2008" ( + SET INPUTDIRx86=bin\VS2008\Release_Win32 + SET INPUTDIRx64=bin\VS2008\Release_x64 + SET SUFFIX=_VS2008 + GOTO START + ) + IF /I "%~1" == "--VS2008" ( + SET INPUTDIRx86=bin\VS2008\Release_Win32 + SET INPUTDIRx64=bin\VS2008\Release_x64 + SET SUFFIX=_VS2008 + GOTO START + ) + IF /I "%~1" == "ICL12" ( + SET INPUTDIRx86=bin\ICL12\Release_Win32 + SET INPUTDIRx64=bin\ICL12\Release_x64 + SET SUFFIX=_ICL12 + GOTO START + ) + IF /I "%~1" == "/ICL12" ( + SET INPUTDIRx86=bin\ICL12\Release_Win32 + SET INPUTDIRx64=bin\ICL12\Release_x64 + SET SUFFIX=_ICL12 + GOTO START + ) + IF /I "%~1" == "-ICL12" ( + SET INPUTDIRx86=bin\ICL12\Release_Win32 + SET INPUTDIRx64=bin\ICL12\Release_x64 + SET SUFFIX=_ICL12 + GOTO START + ) + IF /I "%~1" == "--ICL12" ( + SET INPUTDIRx86=bin\ICL12\Release_Win32 + SET INPUTDIRx64=bin\ICL12\Release_x64 + SET SUFFIX=_ICL12 + GOTO START + ) + IF /I "%~1" == "GCC" ( + SET INPUTDIRx86=bin\GCC\Release_Win32 + SET INPUTDIRx64=bin\GCC\Release_x64 + SET SUFFIX=_GCC + GOTO START + ) + IF /I "%~1" == "/GCC" ( + SET INPUTDIRx86=bin\GCC\Release_Win32 + SET INPUTDIRx64=bin\GCC\Release_x64 + SET SUFFIX=_GCC + GOTO START + ) + IF /I "%~1" == "-GCC" ( + SET INPUTDIRx86=bin\GCC\Release_Win32 + SET INPUTDIRx64=bin\GCC\Release_x64 + SET SUFFIX=_GCC + GOTO START + ) + IF /I "%~1" == "--GCC" ( + SET INPUTDIRx86=bin\GCC\Release_Win32 + SET INPUTDIRx64=bin\GCC\Release_x64 + SET SUFFIX=_GCC + GOTO START + ) + + ECHO. + ECHO Unsupported commandline switch! + ECHO Run "%~nx0 help" for details about the commandline switches. + CALL :SUBMSG "ERROR" "Compilation failed!" +) + + +:START +SET "TEMP_NAME=temp_zip%SUFFIX%" + +IF NOT EXIST "..\%INPUTDIRx86%\Regshot.exe" CALL :SUBMSG "ERROR" "Compile Regshot Win32 first!" +IF NOT EXIST "..\%INPUTDIRx64%\Regshot.exe" CALL :SUBMSG "ERROR" "Compile Regshot x64 first!" + +CALL :SubGetVersion +CALL :SubZipFiles %INPUTDIRx86% Win32 +CALL :SubZipFiles %INPUTDIRx64% x64 + + +:END +TITLE Finished! +ECHO. +ENDLOCAL +PAUSE +EXIT /B + + +:SubZipFiles +TITLE Creating the %2 ZIP file... +CALL :SUBMSG "INFO" "Creating the %2 ZIP file..." + +IF EXIST "%TEMP_NAME%" RD /S /Q "%TEMP_NAME%" +IF NOT EXIST "%TEMP_NAME%" MD "%TEMP_NAME%" + +COPY /Y /V "..\gpl.txt" "%TEMP_NAME%\GPL.txt" +COPY /Y /V "..\files\history.txt" "%TEMP_NAME%\History.txt" +COPY /Y /V "..\files\language.ini" "%TEMP_NAME%\" +COPY /Y /V "..\files\readme.txt" "%TEMP_NAME%\Readme.txt" +COPY /Y /V "..\files\regshot.ini" "%TEMP_NAME%\" +COPY /Y /V "..\%1\Regshot.exe" "%TEMP_NAME%\" + +PUSHD "%TEMP_NAME%" +START "" /B /WAIT "..\..\files\7za.exe" a -tzip -mx=9 "Regshot_%REGSHOTVER%_%2%SUFFIX%.zip" >NUL +IF %ERRORLEVEL% NEQ 0 CALL :SUBMSG "ERROR" "Compilation failed!" + +CALL :SUBMSG "INFO" "Regshot_%REGSHOTVER%_%2%SUFFIX%.zip created successfully!" + +MOVE /Y "Regshot_%REGSHOTVER%_%2%SUFFIX%.zip" "..\" >NUL +POPD +IF EXIST "%TEMP_NAME%" RD /S /Q "%TEMP_NAME%" +EXIT /B + + +:SubGetVersion +rem Get the version +FOR /F "tokens=3,4 delims= " %%K IN ( + 'FINDSTR /I /L /C:"define REGSHOT_VERSION_MAJOR" "..\src\version.h"') DO ( + SET "VerMajor=%%K"&Call :SubVerMajor %%VerMajor:*Z=%%) +FOR /F "tokens=3,4 delims= " %%L IN ( + 'FINDSTR /I /L /C:"define REGSHOT_VERSION_MINOR" "..\src\version.h"') DO ( + SET "VerMinor=%%L"&Call :SubVerMinor %%VerMinor:*Z=%%) +FOR /F "tokens=3,4 delims= " %%M IN ( + 'FINDSTR /I /L /C:"define REGSHOT_VERSION_PATCH" "..\src\version.h"') DO ( + SET "VerBuild=%%M"&Call :SubVerBuild %%VerBuild:*Z=%%) +FOR /F "tokens=3,4 delims= " %%N IN ( + 'FINDSTR /I /L /C:"define REGSHOT_VERSION_REV" "..\src\version.h"') DO ( + SET "VerRev=%%N"&Call :SubVerRev %%VerRev:*Z=%%) + +SET REGSHOTVER=%VerMajor%.%VerMinor%.%VerBuild% +EXIT /B + + +:SubVerMajor +SET VerMajor=%* +EXIT /B + + +:SubVerMinor +SET VerMinor=%* +EXIT /B + + +:SubVerBuild +SET VerBuild=%* +EXIT /B + + +:SubVerRev +SET VerRev=%* +EXIT /B + + +:SHOWHELP +TITLE "%~nx0 %1" +ECHO. & ECHO. +ECHO Usage: %~nx0 [GCC^|ICL12^|VS2008^|VS2010^|WDK] +ECHO. +ECHO Notes: You can also prefix the commands with "-", "--" or "/". +ECHO The arguments are not case sensitive. +ECHO. & ECHO. +ECHO Executing "%~nx0" will use the defaults: "%~nx0 WDK" +ECHO. +ENDLOCAL +EXIT /B + + +:SUBMSG +ECHO. & ECHO ______________________________ +ECHO [%~1] %~2 +ECHO ______________________________ & ECHO. +IF /I "%~1"=="ERROR" ( + PAUSE + EXIT +) ELSE ( + EXIT /B +) diff --git a/RegShot/build/makefile.mak b/RegShot/build/makefile.mak new file mode 100644 index 0000000..9f17816 --- /dev/null +++ b/RegShot/build/makefile.mak @@ -0,0 +1,160 @@ +#****************************************************************************** +#* Copyright 2010-2011 XhmikosR +#* +#* This file is part of Regshot. +#* +#* Regshot is free software; you can redistribute it and/or modify +#* it under the terms of the GNU General Public License as published by +#* the Free Software Foundation; either version 2 of the License, or +#* (at your option) any later version. +#* +#* Regshot is distributed in the hope that it will be useful, +#* but WITHOUT ANY WARRANTY; without even the implied warranty of +#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +#* GNU General Public License for more details. +#* +#* You should have received a copy of the GNU General Public License +#* along with Regshot; if not, write to the Free Software +#* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#* +#* +#* makefile.mak +#* makefile for building Regshot with WDK +#* +#* Use build_wdk.bat and set there your WDK directory. +#****************************************************************************** + + +# Remove the .SILENT directive in order to display all the commands +.SILENT: + + +CC = cl.exe +LD = link.exe +RC = rc.exe + +!IFDEF x64 +BINDIR = ..\bin\WDK\Release_x64 +!ELSE +BINDIR = ..\bin\WDK\Release_Win32 +!ENDIF +OBJDIR = $(BINDIR)\obj +EXE = $(BINDIR)\Regshot.exe +SRC = ..\src +RES = $(SRC)\res + + +DEFINES = /D "_WINDOWS" /D "NDEBUG" /D "_CRT_SECURE_NO_WARNINGS" /D "WDK_BUILD" +CFLAGS = /nologo /c /Fo"$(OBJDIR)/" /W3 /EHsc /MD /O2 /GL /MP $(DEFINES) +LDFLAGS = /NOLOGO /WX /INCREMENTAL:NO /RELEASE /OPT:REF /OPT:ICF /MERGE:.rdata=.text \ + /DYNAMICBASE /NXCOMPAT /LTCG /DEBUG +LIBS = advapi32.lib comdlg32.lib kernel32.lib shell32.lib user32.lib +RFLAGS = /l 0x0409 + + +!IFDEF x64 +CFLAGS = $(CFLAGS) /D "_WIN64" /D "_WIN32_WINNT=0x0502" +LIBS = $(LIBS) msvcrt_win2003.obj +LDFLAGS = $(LDFLAGS) /STACK:67108864 /SUBSYSTEM:WINDOWS,5.02 /MACHINE:X64 +RFLAGS = $(RFLAGS) /d "_WIN64" +!ELSE +CFLAGS = $(CFLAGS) /D "WIN32" /D "_WIN32_WINNT=0x0500" +LIBS = $(LIBS) msvcrt_win2000.obj +LDFLAGS = $(LDFLAGS) /STACK:33554432 /LARGEADDRESSAWARE /SUBSYSTEM:WINDOWS,5.0 /MACHINE:X86 +RFLAGS = $(RFLAGS) /d "WIN32" +!ENDIF + + +############### +## Targets ## +############### +BUILD: CHECKDIRS $(EXE) + +CHECKDIRS: + IF NOT EXIST "$(OBJDIR)" MD "$(OBJDIR)" + +CLEAN: + ECHO Cleaning... & ECHO. + IF EXIST "$(EXE)" DEL "$(EXE)" + IF EXIST "$(OBJDIR)\*.obj" DEL "$(OBJDIR)\*.obj" + IF EXIST "$(OBJDIR)\Regshot.res" DEL "$(OBJDIR)\Regshot.res" + IF EXIST "$(BINDIR)\Regshot.pdb" DEL "$(BINDIR)\Regshot.pdb" + -IF EXIST "$(OBJDIR)" RD /Q "$(OBJDIR)" + -IF EXIST "$(BINDIR)" RD /Q "$(BINDIR)" + +REBUILD: CLEAN BUILD + + +#################### +## Object files ## +#################### +OBJECTS= \ + $(OBJDIR)\fileshot.obj \ + $(OBJDIR)\language.obj \ + $(OBJDIR)\misc.obj \ + $(OBJDIR)\output.obj \ + $(OBJDIR)\regshot.obj \ + $(OBJDIR)\regshot.res \ + $(OBJDIR)\setup.obj \ + $(OBJDIR)\ui.obj \ + $(OBJDIR)\winmain.obj + + +################## +## Batch rule ## +################## +{$(SRC)}.c{$(OBJDIR)}.obj:: + $(CC) $(CFLAGS) /Tc $< + + +################ +## Commands ## +################ +$(EXE): $(OBJECTS) + $(RC) $(RFLAGS) /fo"$(OBJDIR)\regshot.res" "$(SRC)\regshot.rc" >NUL + $(LD) $(LDFLAGS) $(LIBS) $(OBJECTS) /OUT:"$(EXE)" + + +#################### +## Dependencies ## +#################### +$(OBJDIR)\fileshot.obj: \ + $(SRC)\fileshot.c \ + $(SRC)\global.h + +$(OBJDIR)\language.obj: \ + $(SRC)\language.c \ + $(SRC)\global.h + +$(OBJDIR)\misc.obj: \ + $(SRC)\misc.c \ + $(SRC)\global.h + +$(OBJDIR)\output.obj: \ + $(SRC)\output.c \ + $(SRC)\global.h + +$(OBJDIR)\regshot.obj: \ + $(SRC)\regshot.c \ + $(SRC)\global.h \ + $(SRC)\version.h + +$(OBJDIR)\regshot.res: \ + $(SRC)\regshot.rc \ + $(SRC)\resource.h \ + $(RES)\Regshot.exe.manifest \ + $(RES)\regshot.ico \ + $(SRC)\version.h + +$(OBJDIR)\setup.obj: \ + $(SRC)\setup.c \ + $(SRC)\global.h + +$(OBJDIR)\ui.obj: \ + $(SRC)\ui.c \ + $(SRC)\global.h + +$(OBJDIR)\winmain.obj: \ + $(SRC)\winmain.c \ + $(SRC)\global.h \ + $(SRC)\version.h diff --git a/RegShot/build/regshot_icl12.sln b/RegShot/build/regshot_icl12.sln new file mode 100644 index 0000000..a8d4eb3 --- /dev/null +++ b/RegShot/build/regshot_icl12.sln @@ -0,0 +1,26 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "regshot", "regshot_icl12.vcxproj", "{4C971282-E758-4BA4-B2EF-905613EAADD8}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {4C971282-E758-4BA4-B2EF-905613EAADD8}.Debug|Win32.ActiveCfg = Debug|Win32 + {4C971282-E758-4BA4-B2EF-905613EAADD8}.Debug|Win32.Build.0 = Debug|Win32 + {4C971282-E758-4BA4-B2EF-905613EAADD8}.Debug|x64.ActiveCfg = Debug|x64 + {4C971282-E758-4BA4-B2EF-905613EAADD8}.Debug|x64.Build.0 = Debug|x64 + {4C971282-E758-4BA4-B2EF-905613EAADD8}.Release|Win32.ActiveCfg = Release|Win32 + {4C971282-E758-4BA4-B2EF-905613EAADD8}.Release|Win32.Build.0 = Release|Win32 + {4C971282-E758-4BA4-B2EF-905613EAADD8}.Release|x64.ActiveCfg = Release|x64 + {4C971282-E758-4BA4-B2EF-905613EAADD8}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/RegShot/build/regshot_icl12.vcxproj b/RegShot/build/regshot_icl12.vcxproj new file mode 100644 index 0000000..a1921cf --- /dev/null +++ b/RegShot/build/regshot_icl12.vcxproj @@ -0,0 +1,224 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {4C971282-E758-4BA4-B2EF-905613EAADD8} + Win32Proj + regshot + + + + Application + true + MultiByte + Intel C++ Compiler 12.1 + + + Application + true + MultiByte + Intel C++ Compiler 12.1 + + + Application + false + true + MultiByte + Intel C++ Compiler 12.1 + true + + + Application + false + true + MultiByte + Intel C++ Compiler 12.1 + true + + + + + + + + + + + + + + + + + + + true + ..\bin\ICL12\$(Configuration)_$(Platform)\ + ..\bin\ICL12\$(Configuration)_$(Platform)\obj\ + Regshot + false + + + true + ..\bin\ICL12\$(Configuration)_$(Platform)\ + ..\bin\ICL12\$(Configuration)_$(Platform)\obj\ + Regshot + false + + + false + ..\bin\ICL12\$(Configuration)_$(Platform)\ + ..\bin\ICL12\$(Configuration)_$(Platform)\obj\ + Regshot + false + + + false + ..\bin\ICL12\$(Configuration)_$(Platform)\ + ..\bin\ICL12\$(Configuration)_$(Platform)\obj\ + Regshot + false + + + + Level3 + Disabled + WIN32;_DEBUG;_WINDOWS + MultiThreadedDebug + ProgramDatabase + + + Windows + true + 33554432 + + + WIN32;%(PreprocessorDefinitions) + true + + + + + Level3 + Disabled + _WIN64;_DEBUG;_WINDOWS + MultiThreadedDebug + ProgramDatabase + + + Windows + true + 67108864 + + + _WIN64;%(PreprocessorDefinitions) + true + + + + + Level3 + MaxSpeedHighLevel + WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS + true + MultiThreaded + ProgramDatabase + true + true + Fast + AnySuitable + true + true + + + Windows + true + true + true + true + .rdata=.text + true + $(IntDir) + $(IntDir) + 33554432 + + + WIN32;%(PreprocessorDefinitions) + true + + + + + Level3 + MaxSpeedHighLevel + _WIN64;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS + true + MultiThreaded + ProgramDatabase + true + true + Fast + AnySuitable + true + true + + + Windows + true + true + true + .rdata=.text + true + $(IntDir) + $(IntDir) + 67108864 + + + _WIN64;%(PreprocessorDefinitions) + true + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/RegShot/build/regshot_icl12.vcxproj.filters b/RegShot/build/regshot_icl12.vcxproj.filters new file mode 100644 index 0000000..273ba69 --- /dev/null +++ b/RegShot/build/regshot_icl12.vcxproj.filters @@ -0,0 +1,66 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Header Files + + + Header Files + + + + + Resource Files + + + + + Resource Files + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Resource Files + + + \ No newline at end of file diff --git a/RegShot/build/regshot_vs2008.sln b/RegShot/build/regshot_vs2008.sln new file mode 100644 index 0000000..3812fa3 --- /dev/null +++ b/RegShot/build/regshot_vs2008.sln @@ -0,0 +1,26 @@ + +Microsoft Visual Studio Solution File, Format Version 10.00 +# Visual Studio 2008 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Regshot", "regshot_vs2008.vcproj", "{A7D5D156-E803-459D-B768-7EBBC5D09DC6}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {A7D5D156-E803-459D-B768-7EBBC5D09DC6}.Debug|Win32.ActiveCfg = Debug|Win32 + {A7D5D156-E803-459D-B768-7EBBC5D09DC6}.Debug|Win32.Build.0 = Debug|Win32 + {A7D5D156-E803-459D-B768-7EBBC5D09DC6}.Debug|x64.ActiveCfg = Debug|x64 + {A7D5D156-E803-459D-B768-7EBBC5D09DC6}.Debug|x64.Build.0 = Debug|x64 + {A7D5D156-E803-459D-B768-7EBBC5D09DC6}.Release|Win32.ActiveCfg = Release|Win32 + {A7D5D156-E803-459D-B768-7EBBC5D09DC6}.Release|Win32.Build.0 = Release|Win32 + {A7D5D156-E803-459D-B768-7EBBC5D09DC6}.Release|x64.ActiveCfg = Release|x64 + {A7D5D156-E803-459D-B768-7EBBC5D09DC6}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/RegShot/build/regshot_vs2008.vcproj b/RegShot/build/regshot_vs2008.vcproj new file mode 100644 index 0000000..24f3be3 --- /dev/null +++ b/RegShot/build/regshot_vs2008.vcproj @@ -0,0 +1,440 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/RegShot/build/regshot_vs2010.sln b/RegShot/build/regshot_vs2010.sln new file mode 100644 index 0000000..b731cda --- /dev/null +++ b/RegShot/build/regshot_vs2010.sln @@ -0,0 +1,26 @@ + +Microsoft Visual Studio Solution File, Format Version 11.00 +# Visual Studio 2010 +Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "Regshot", "regshot_vs2010.vcxproj", "{4C971282-E758-4BA4-B2EF-905613EAADD8}" +EndProject +Global + GlobalSection(SolutionConfigurationPlatforms) = preSolution + Debug|Win32 = Debug|Win32 + Debug|x64 = Debug|x64 + Release|Win32 = Release|Win32 + Release|x64 = Release|x64 + EndGlobalSection + GlobalSection(ProjectConfigurationPlatforms) = postSolution + {4C971282-E758-4BA4-B2EF-905613EAADD8}.Debug|Win32.ActiveCfg = Debug|Win32 + {4C971282-E758-4BA4-B2EF-905613EAADD8}.Debug|Win32.Build.0 = Debug|Win32 + {4C971282-E758-4BA4-B2EF-905613EAADD8}.Debug|x64.ActiveCfg = Debug|x64 + {4C971282-E758-4BA4-B2EF-905613EAADD8}.Debug|x64.Build.0 = Debug|x64 + {4C971282-E758-4BA4-B2EF-905613EAADD8}.Release|Win32.ActiveCfg = Release|Win32 + {4C971282-E758-4BA4-B2EF-905613EAADD8}.Release|Win32.Build.0 = Release|Win32 + {4C971282-E758-4BA4-B2EF-905613EAADD8}.Release|x64.ActiveCfg = Release|x64 + {4C971282-E758-4BA4-B2EF-905613EAADD8}.Release|x64.Build.0 = Release|x64 + EndGlobalSection + GlobalSection(SolutionProperties) = preSolution + HideSolutionNode = FALSE + EndGlobalSection +EndGlobal diff --git a/RegShot/build/regshot_vs2010.vcxproj b/RegShot/build/regshot_vs2010.vcxproj new file mode 100644 index 0000000..3a7bb40 --- /dev/null +++ b/RegShot/build/regshot_vs2010.vcxproj @@ -0,0 +1,203 @@ + + + + + Debug + Win32 + + + Debug + x64 + + + Release + Win32 + + + Release + x64 + + + + {4C971282-E758-4BA4-B2EF-905613EAADD8} + Win32Proj + Regshot + + + + Application + true + MultiByte + + + Application + true + MultiByte + + + Application + false + true + MultiByte + + + Application + false + true + MultiByte + + + + + + + + + + + + + + + + + + + true + ..\bin\VS2010\$(Configuration)_$(Platform)\ + ..\bin\VS2010\$(Configuration)_$(Platform)\obj\ + Regshot + false + + + true + ..\bin\VS2010\$(Configuration)_$(Platform)\ + ..\bin\VS2010\$(Configuration)_$(Platform)\obj\ + Regshot + false + + + false + ..\bin\VS2010\$(Configuration)_$(Platform)\ + ..\bin\VS2010\$(Configuration)_$(Platform)\obj\ + Regshot + false + + + false + ..\bin\VS2010\$(Configuration)_$(Platform)\ + ..\bin\VS2010\$(Configuration)_$(Platform)\obj\ + Regshot + false + + + + Level4 + Disabled + WIN32;_DEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS + MultiThreadedDebug + ProgramDatabase + true + false + + + Windows + true + 33554432 + + + WIN32;%(PreprocessorDefinitions) + + + + + Level4 + Disabled + _WIN64;_DEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS + MultiThreadedDebug + ProgramDatabase + true + false + + + Windows + true + 67108864 + + + _WIN64;%(PreprocessorDefinitions) + + + + + Level3 + MaxSpeed + WIN32;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS + true + MultiThreaded + ProgramDatabase + + + Windows + true + true + true + true + .rdata=.text + true + 33554432 + + + WIN32;%(PreprocessorDefinitions) + + + + + Level3 + MaxSpeed + _WIN64;NDEBUG;_WINDOWS;_CRT_SECURE_NO_WARNINGS + true + MultiThreaded + ProgramDatabase + + + Windows + true + true + true + .rdata=.text + true + 67108864 + + + _WIN64;%(PreprocessorDefinitions) + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/RegShot/build/regshot_vs2010.vcxproj.filters b/RegShot/build/regshot_vs2010.vcxproj.filters new file mode 100644 index 0000000..c0bba02 --- /dev/null +++ b/RegShot/build/regshot_vs2010.vcxproj.filters @@ -0,0 +1,69 @@ + + + + + {4FC737F1-C7A5-4376-A066-2A32D752A2FF} + cpp;c;cc;cxx;def;odl;idl;hpj;bat;asm;asmx + + + {93995380-89BD-4b04-88EB-625FBE52EBFB} + h;hpp;hxx;hm;inl;inc;xsd + + + {67DA6AB6-F800-4c08-8B7A-83BB121AAD01} + rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx;tiff;tif;png;wav;mfcribbon-ms + + + + + Header Files + + + Header Files + + + Header Files + + + + + Resource Files + + + + + Resource Files + + + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + Source Files + + + + + Resource Files + + + \ No newline at end of file diff --git a/RegShot/gpl.txt b/RegShot/gpl.txt new file mode 100644 index 0000000..48807be --- /dev/null +++ b/RegShot/gpl.txt @@ -0,0 +1,339 @@ + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Lesser General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License along + with this program; if not, write to the Free Software Foundation, Inc., + 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. diff --git a/RegShot/language.ini b/RegShot/language.ini new file mode 100644 index 0000000..ac88f55 --- /dev/null +++ b/RegShot/language.ini @@ -0,0 +1,1424 @@ +[Current] +Current=English + +[English] +1=Keys: +2=Values: +3=Dirs: +4=Files: +5=Time: +6=Keys added: +7=Keys deleted: +8=Values added: +9=Values deleted: +10=Values modified: +11=Files added: +12=Files deleted: +13=Files [attributes?] modified: +14=Folders added: +15=Folders deleted: +16=Folders attributes changed: +17=Total changes: +18=Comments: +19=Datetime: +20=Computer: +21=Username: +22=About +23=Error +24=Error call External Viewer! +25=Error creating file! +26=Error open file! +27=Error move file pointer! +28=&1st shot +29=&2nd shot +30=C&ompare +31=&Clear +32=&Quit +33=&About +34=&Monitor.. +35=Compare logs save as: +36=Output path: +37=Add comment into the log: +38=Plain &TXT +39=&HTML document +40=&Scan dir1[;dir2;dir3;...;dir nn]: +41=&Shot +42=Shot and Sa&ve... +43=Loa&d... +44=&Clear All +45=Clear &1st shot +46=Clear &2nd shot + +[Espaol] +Translator=[FESTL] Freelance English-Spanish Technical Localizations +1=Claves: +2=Valores: +3=Directorios: +4=Archivos: +5=Tiempo: +6=Claves aadidas: +7=Claves borradas: +8=Valores aadidos: +9=Valores borrados: +10=Valores modificados: +11=Archivos aadidos: +12=Archivos borrados: +13=Atributos de archivo modificados: +14=Carpetas aadidas: +15=Carpetas borradas: +16=Atributos de carpeta modificados: +17=Total de cambios: +18=Comentarios: +19=Fecha y hora: +20=Computador: +21=Usuario: +22=Sobre +23=Error +24=Error al llamar visor externo! +25=Error al crear archivo! +26=Error al abrir archivos! +27=Error al mover puntero de archivo! +28=&1er. Foto +29=&2da. Foto +30=C&omparar +31=&Limpiar +32=S&alir +33=&Sobre +34=&Monitor.. +35=Comparar logs guardados como: +36=Ruta de salida: +37=Aadir comentario al log: +38=&Texto +39=Documento &HTML +40=&Escanear dir1[;dir2;...;dir nn] +41=&Foto +42=Foto + &guardar... +43=&Cargar... +44=&Limpiar +45=Limpiar &1er. Foto +46=Limpiar &2da. Foto + +[Russian] +Translator=Mikhail A.Medvedev +1=: +2=: +3=: +4=: +5=: +6= : +7= : +8= : +9= : +10= : +11= : +12= : +13= []: +14= : +15= : +16= []: +17= : +18=: +19= : +20= : +21= : +22= +23= +24= ! +25= ! +26= ! +27=Error move file pointer! +28=&1 +29=&2 +30=& +31=& +32=& +33= & +34=&... +35= : +36= : +37= : +38=& +39=& HTML +40=& 1[;dir2;...;dir nn]: +41=& +42= + &... +43=&... +44=& +45= &1 +46= &2 + +[Franais] +Translator=Marcel Drappier - Charles Fitoussi +1=Cls : +2=Valeurs : +3=Dirs : +4=Fichiers : +5=Temps : +6=Cls ajoutes : +7=Cls effaces : +8=Valeurs ajoutes : +9=Valeurs effaces : +10=Valeurs modifies : +11=Fichiers ajouts : +12=Fichiers effacs : +13=Fichiers [attributs ?] modifis : +14=Dossiers ajouts : +15=Dossiers effacs : +16=Attributs de dossiers modifis : +17=Nombre de modifications : +18=Commentaires : +19=Dates & Heures : +20=Ordinateur : +21=Utilisateur : +22=A propos de RegShot +23=Erreur +24=Erreur d'appel du programme de visualisation externe ! +25=Erreur en crant le fichier ! +26=Erreur d'ouverture du fichier ! +27=Erreur de dplacement du pointeur de fichier ! +28=&1er clich +29=&2me clich +30=C&omparer +31=Effa&cer +32=&Quitter +33=&A propos... +34=&Moniteur... +35=Sauver les comparaisons comme : +36=Rpertoire de sauvegarde : +37=Commentaire additionnel : +38=Fichier &Txt +39=Document &Html +40=&Scan dir1[;dir2;...;dir n] : +41=&Clich +42=Clich + &Sauvegarde... +43=Char&ger... +44=Effa&cer tout +45=Effacer &1er clich +46=Effacer &2me clich + +[GB] +Translator=!!! +1=: +2=ֵ: +3=Ŀ¼: +4=ļ: +5=ʱ: +6=Ӽ: +7=ɾ: +8=ֵ: +9=ɾֵ: +10=޸ֵ: +11=ļ: +12=ļɾ: +13=ļ޸: +14=Ŀ¼: +15=Ŀ¼ɾ: +16=Ŀ¼޸: +17=ܼ: +18=Ҫע: +19=ʱ: +20=: +21=ʹ: +22= +23= +24=޷ⲿ! +25=޷ļ! +26=޷ļ! +27=޷ƶļָ! +28=ȡ[&1] +29=ȡ[&2] +30=Ƚ[&O] +31=[&C] +32=˳[&Q] +33=[&A] +34=[&M].. +35=Ƚϼ¼Ϊ: +36=·: +37=ڼ¼ļע: +38=&TXT ĵ +39=&HTML ĵ +40=ɨ[&S] dir1[;dir2;...dir nn]: +41=ȡ[&S] +42=ȡ浵[&V]... +43=ᵵ[&D]... +44=ȫ[&C] +45=ȡ1[&1] +46=ȡ2[&2] + +[Big5] +Translator=!!! +1=: +2=: +3=ؿ: +4=: +5=ɶ: +6=W[: +7=R: +8=W[: +9=R: +10=ק: +11=W[: +12=R: +13=ק: +14=ؿW[: +15=ؿR: +16=ؿݩʭק: +17=`p: +18=nI`: +19=ɶ: +20=pW: +21=ϥΪ̦W: +22=_ +23=~ +24=LkեΥ~su! +25=LkЫؤ! +26=Lk}! +27=Lkʤw! +28=[&1] +29=[&2] +30=[&O] +31=M[&C] +32=hX[&Q] +33=_[&A] +34=ʱ[&M].. +35=Ots: +36=X|: +37=bO󤺲K[`: +38=&TXT +39=&HTML +40=y[&S] dir1[;dir2;...dir nn]: +41=[&S] +42=}s[&V]... +43=[&D]... +44=M[&C] +45=M1[&1] +46=M2[&2] + +[Norsk] +Translator=Kenneth Aarseth +1=Nkler: +2=Verdier: +3=Mapper: +4=Filer: +5=Tid: +6=Nkler lagt til: +7=Slettede nkler: +8=Verdier lagt til: +9=Slettede verdier: +10=Forandrede verdier: +11=Fil lagt til: +12=Slettede filer: +13=Filer [engenskaper] forandret: +14=Mapper lagt til: +15=Mapper slettet: +16=Mappe egenskaper forandret: +17=Antall endringer: +18=Kommentarer: +19=Dato tid: +20=Maskin navn: +21=Brukernavn: +22=Om +23=Error +24=Error call External Viewer! +25=Error creating file! +26=Error open file! +27=Error move file pointer! +28=F&ste sk +29=A&ndre sk +30=&Sammenlign +31=&Tilbakestill +32=&Avslutt +33=&Om Regshot +34=Over&vk.. +35=Lagre logg som: +36=Logg fil plassering: +37=Legg til en kommentar: +38=&Ren tekst +39=&Web format +40=S?k mappe1[;mappe2;osv]: +41=&Sk +42=Sk and La&gre... +43=Loa&d... +44=&Tilbakestill +45=Tilbakestill F&ste sk +46=Tilbakestill A&ndre sk + +[Italiano] +Translator=Vittorio +1=Chiave: +2=Valore: +3=Dir: +4=File: +5=Tempo: +6=Chiave aggiunta: +7=Chiave cancellata: +8=Valore aggiunto: +9=Valore cancellato: +10=Valore modificato: +11=File aggiunto: +12=File cancellato: +13=File [attributi?] modificato: +14=Cartella aggiunta: +15=Cartella cancellata: +16=Attributi cambiati nella cartella: +17=Variazioni totali: +18=Commenti: +19=Dataora: +20=Computer: +21=Username: +22=About +23=Error +24=Error call External Viewer! +25=Error creating file! +26=Error open file! +27=Error move file pointer! +28=&1st shot +29=&2nd shot +30=C&onfronta +31=&Pulisci +32=&Esci +33=&Info +34=&Monitor.. +35=Confronta il log salvato come: +36=Directory di destinazione: +37=Aggiungi commenti nel log: +38=File &TXT +39=&Documento HTML +40=&Scan dir1[;dir2;...;dir nn]: +41=&Shot +42=Shot and Sa&lva... +43=Loa&d... +44=&Pulisci +45=Pulisci &1st shot +46=Pulisci &2nd shot + +[Deutsch] +Translator=Gnatix & AVE7 +1=Schlssel: +2=Werte: +3=Ordner: +4=Dateien: +5=Zeit: +6=Schlssel hinzugefgt: +7=Schlssel gelscht: +8=Werte hinzugefgt: +9=Werte gelscht: +10=Werte gendert: +11=Dateien hinzugefgt: +12=Dateien gelscht: +13=Dateiattribute gendert: +14=Ordner hinzugefgt: +15=Ordner gelscht: +16=Ordnerattribute gendert: +17=Gesamte nderungen: +18=Kommentar: +19=Datum und Zeit: +20=Computer: +21=Benutzername: +22=ber +23=Fehler +24=Fehler beim Starten von externem Viewer! +25=Fehler beim Erstellen von Datei! +26=Fehler beim ffnen von Dateien! +27=Fehler beim Verschieben von Dateizeiger! +28=&1. Schu +29=&2. Schu +30=&Vergleichen +31=&Leeren +32=&Beenden +33=be&r +34=ber&wachen.. +35=Speichern Vergleichslogdatei als: +36=Ausgabepfad: +37=Kommentar in Logdatei hinzufgen: +38=&TXT Datei +39=&HTML Datei +40=&Scannen dir1[;dir2;...;dir nn]: +41=&Schu +42=Schu + Spei&chern... +43=La&den... +44=&Leeren +45=Leeren &1. Schu +46=Leeren &2. Schu + +[Trke] +Translator=Murat KASABOGLU +1=Anahtar: +2=Deerler: +3=Klasrler: +4=Dosyalar: +5=Sre: +6=Anahtarlar eklenmi? +7=Anahtarlar silinmi? +8=Deerler eklenmi? +9=Deerler silinmi? +10=Deerler deitirilmi? +11=Dosyalar?eklenmi? +12=Dosyalar?silinmi? +13=Dosyalarn zellikleri deitirilmi? +14=Klasrler eklenmi? +15=Klasrler silinmi? +16=Klasrlerin zellikleri deitirilmi? +17=Tm deiiklikler: +18=Aklamalar: +19=Zaman: +20=Bilgisayar: +21=Kullanc? +22=Hakknda +23=Hata +24=Hata harici gstericinin arlmasnda olutu +25=Hata dosya yaratlamad? +26=Hata dosya alamad? +27=Hata dosya gstergesinin tanmasnda olutu +28=&1. kayt +29=&2. kayt +30=&Karlatrma +31=&Temizle +32=&k +33=&Hakknda +34=T&akip.. +35=Karlatrmay?kaydet: +36=Kayt yeri: +37=Yaplan kayda, aklama ekle: +38=&Dz Metin +39=&HTML dosyas +40=&Klasr tara; kls1[;kls2;kls nn]: +41=&Gzle +42=Gzle &ve Kaydet... +43=&Ykle +44=T&emizle +45=1. G?zlemi temizle +46=2. Gz&lemi temizle + +[Nederlands] +Translator=Paul Lowagie +1=Sleutels: +2=Waarden: +3=Mappen: +4=Bestanden: +5=Tijd: +6=Sleutels toegevoegd: +7=Sleutels verwijderd: +8=Waarden toegevoegd: +9=Waarden verwijderd: +10=Waarden gewijzigd: +11=Bestanden toegevoegd: +12=Bestanden verwijderd: +13=Bestanden (kenmerken?) gewijzigd: +14=Mappen toegevoegd: +15=Mappen verwijderd: +16=Mapkemmerken gewijzigd: +17=Totaal aantal wijzigingen: +18=Commentaar: +19=Datum & tijd: +20=Computer: +21=Gebruikersnaam: +22=Info +23=Fout +24=Fout bij starten externe kijker! +25=Fout bij creren bestand! +26=Fout bij openen regshot.vxd! +27=Fout bij bestandtoewijzing! +28=&1ste opname +29=&2de opname +30=V&ergelijken +31=&Wissen +32=&Afsluiten +33=&Info +34=&Monitor.. +35=Vergelijking opslaan als +36=Uitvoerpad: +37=Commentaar toevoegen in logbestand: +38=Platte &TXT +39=&HTML document +40=&Scan map1[;map2;...;map nn]: +41=&Opnemen +42=Opnemen en bewa&ren... +43=Lade&n... +44=&Alles wissen +45=Wissen &1ste opname +46=Wissen &2de opname + +[esky] +Translator=ondra +1=Kl? +2=Hodnot: +3=Adres? +4=Soubor? +5=as: +6=Kl?pidno: +7=Kl?vymazno: +8=Hodnot pidno: +9=Hodnot vymazno: +10=Hodnot zmnno: +11=Soubor?pidno: +12=Soubor?vymazno: +13=Soubor?[atribut?] zmnno: +14=Sloek pidno: +15=Sloek vymazno: +16=Atribut?sloek zmnno: +17=Celkem zmn: +18=Komente: +19=Datum&as: +20=Pota? +21=Jmno uivatele: +22=O programu +23=Chyba +24=Chyba pi spoutn?externho prohlee! +25=Chyba pi tvorb?souboru! +26=Chyba pi otevrn?souboru! +27=Error move file pointer! +28=&1. zznam +29=&2. zznam +30=P&orovnat +31=&Vymazat +32=&Konec +33=&O programu +34=&Monitor.. +35=Zznam o porovnn?uloit jako: +36=Pracovn?adres: +37=Pidat koment do zznamu: +38=&TXT +39=&HTML +40=Sl&oky: adr1[;...;adr nn]: +41=&Vytvoit +42=Vytvoit a ul&oit... +43=N&ast... +44=Vym&azat ve +45=Vymazat &1. zznam +46=Vymazat &2. zznam + +[Catal] +Translator=Pau Bosch i Crespo PauBCrespo@hotmail.com. Visiteu: www.all4you.dk si voleu ms programes gratuts en catal. +1=Claus: +2=Valors: +3=Directoris: +4=Arxius: +5=Temps: +6=Claus afegides: +7=Claus esborrades: +8=Valors afegits: +9=Valors esborrats: +10=Valors modificats: +11=Arxius afegits: +12=Arxius esborrats: +13=Atributs modificats d'arxiu: +14=Carpetes afegides: +15=Carpetes esborrades: +16=Atributs modificats de carpeta: +17=Total de canvis: +18=Comentaris: +19=Data i hora: +20=Ordinador: +21=Usuari: +22=Sobre +23=Error +24=Error en connectar amb el visualitzador extern! +25=Error en crear arxiu! +26=Error en obrir arxius! +27=Error en moure cursor d'arxiu! +28=&1r. Tret +29=&2n. Tret +30=C&ompara +31=&Neteja +32=S&urt +33=&Sobre +34=&Monitor.. +35=Compara registres desats com a: +36=Ruta de sortida: +37=Afegeix comentari al registre: +38=&Text +39=Document &HTML +40=&Escaneja dir1[;dir2;...;dir nn] +41=&Dispara +42=Dispara i &desa... +43=&Carrega... +44=&Neteja +45=Neteja &1r Tret +46=Neteja &2n Tret + +[] +Translator=Michael Papadakis +1=: +2=: +3=: +4=: +5=: +6= : +7= : +8= : +9= : +10= : +11= : +12= : +13= () : +14= : +15= : +16= () : +17= : +18=: +19=/: +20=: +21=: +22= +23= +24= Viewer! +25= ! +26= ! +27= ! +28=&1 +29=&2 +30=& +31=& +32=& +33=& +34=&.. +35= : +36= : +37= : +38= &TXT +39= &HTML +40= &1(;2;...): +41=& +42= &... +43=&... +44=& +45= &1 +46= &2 + +[Dansk] +Translator=Per Bryldt +1=Ngler: +2=Vrdier: +3=Mapper: +4=Filer: +5=Tid: +6=Ngler lagt til: +7=Slettede ngler: +8=Vrdier lagt til: +9=Slettede vrdier: +10=Forandrede vrdier: +11=Fil lagt til: +12=Slettede filer: +13=Filer [egenskaber] forandret: +14=Mapper lagt til: +15=Mapper slettet: +16=Mappe egenskaber forandret: +17=Antal ndringer: +18=Kommentarer: +19=Dato tid: +20=Computer navn: +21=Brugernavn: +22=Om +23=Fejl +24=Fejl bner External Viewer! +25=Fejl oprettelse af fil! +26=Fejl ben fil! +27=Fejl flyt fil pointer! +28=F&ste sgning +29=A&nden sgning +30=&Sammenlign +31=&Fortryd +32=&Afslut +33=&Om Regshot +34=Over&vg.. +35=Gemmer log som: +36=Log fil placering: +37=Tilfj en kommentar: +38=&Ren tekst +39=&Html format +40=Sg mappe1[;mappe2;osv]: +41=&Sg +42=Sg og G&em... +43=He&nt... +44=&Fortryd +45=Fortryd F&ste sgning +46=Fortryd A&nden sgning + +[Latvieu] +Translator=Armands Radzuka +1=Atslgas: +2=Vrtbas: +3=Mapes: +4=Faili: +5=Laiks: +6=Pievienots atslgas: +7=Dzsts atslgas: +8=Pievienots vrtbas: +9=Dzsts vrtbas: +10=Prveidots vrtbas: +11=Pievienotie faili: +12=Dzstie faili: +13=Prveidotie faili [atribti?]: +14=Pievienots mapes: +15=Dzsts mapes: +16=Prveidotie mapju atribti: +17=Kop izmaias: +18=Komentri: +19=Datums, laiks: +20=Dators: +21=Lietotjs: +22=Par +23=Kda +24=Kda izsaucot rjo apskattju! +25=Kda izveidojot failu! +26=Kda atverot failu! +27=Kda prveidojot faila rdtju! +28=&1. viens +29=&2. viens +30=&Saldzint +31=&Dzst +32=&Beigt +33=&Par +34=&Novrot.. +35=Saldzinanas protokolus saglabt k: +36=Izejas ce: +37=Pievienot komentru protokolam: +38=&Tekstu +39=&HTML dokumentu +40=&Skant mapi1[;mapi2;...]: +41=&viens +42=aut un sa&glabt... +43=Iel&dt... +44=&Dzst visu +45=Dzst &1. vienu +46=Dzst &2. vienu + + +[Portuguese] +Translator=Leandro +1=Chaves: +2=Valores: +3=Diretrios: +4=Arquivos: +5=Tempo: +6=Chaves adicionadas: +7=Chaves apagadas: +8=Valores adicionados: +9=Valores apagados: +10=Valores modificados: +11=Arquivos adicionados: +12=Arquivos apagados: +13=Arquivos [atributos?] modificados: +14=Pastas adicionadas: +15=Pastas apagadas: +16=Atributos de pastas alterados: +17=Total de alteraes: +18=Comentrios: +19=Dia/hora: +20=Computador: +21=Usurio: +22=Sobre +23=Erro +24=Erro ao chamar visualizador externo! +25=Erro ao criar arquivo! +26=Erro ao abrir arquivo! +27=Erro ao mover o ponteiro do arquivo! +28=&1 foto +29=&2 foto +30=&Comparar +31=&Limpar +32=Sai&r +33=&Sobre +34=&Monitor... +35=Salvar notas comparadas como: +36=Destino: +37=Adicionar comentrio em nota: +38=&Texto +39=&HTML +40=&Pesquisar diretrio: +41=&Fotografar +42=Fotografar e &salvar... +43=&Carregar... +44=&Limpar tudo +45=Apagar &1 foto +46=Apagar &2 foto + +[Slovensk] +Translator=Roland Turcan (regshot@rotursoft.sk) +1=Klvesy: +2=Hodnoty: +3=Prieinky: +4=Sbory: +5=as: +6=Ke pridan: +7=Ke zmazan: +8=Hodnoty pridan: +9=Hodnoty zmazan: +10=Hodnoty zmenen: +11=Sbory pridan: +12=Sbory zmazan: +13=Sbory [atribty?] zmenen: +14=Prieinky pridan: +15=Prieinky zmazan: +16=Atribty prieinkov zmenen: +17=Spolu zmien: +18=Komentre: +19=Dtum/as: +20=Pota: +21=Uvate: +22=O programe +23=Chyba +24=Chyba pri volan externho prehliadaa! +25=Chyba pri vytvran sboru! +26=Chyba pri otvoren sboru! +27=Chyba pri presvan ukazovatea v sbore! +28=&1. zznam +29=&2. zznam +30=P&orovnaj +31=&Vyma +32=&Koniec +33=&O Programe +34=&Monitor.. +35=Porovnaj zznamy a ulo ako: +36=Vstup ulo do: +37=Pridaj komentr do zznamu: +38=ist &TXT +39=&HTML dokument +40=&Hadaj dir1[;dir2;...;dir nn]: +41=&Zznam +42=Zaznamenaj a ulo... +43=Nataj... +44=&Vyma vetko +45=Vyma &1. zznam +46=Vyma &2. zznam + +[{] +Translator=Kentaro Okude +1=Keys: +2=Values: +3=Dirs: +4=Files: +5=Time: +6=ljꂽWXgL[: +7=폜ꂽWXgL[: +8=ljꂽl: +9=폜ꂽl: +10=ύX̂l: +11=ljꂽt@C: +12=폜ꂽt@C: +13=iHjύX̂t@C: +14=ljꂽtH_: +15=폜ꂽtH_: +16=ύX̂tH_: +17=S̕ύX: +18=Rg: +19=: +20=Rs[^: +21=[U[l[: +22=About +23=G[ +24=֘AtꂽvONł܂łB +25=t@C쐬ł܂łB +26=t@CJ炯܂łB +27=t@C|C^[𓮂܂łB +28=P +29=Q +30=r +31= +32=‚ +33=About +34=Ď +35=O̕ۑ`: +36=ۑ: +37=OɃRg}: +38=Text +39=HTML +40=ĎtH_: +41=sI +42=sZ[u +43=[h +44=ׂď +45=Pڂ̃O +46=Qڂ̃O + +[Polski] +Translator=Adam Mikusiski +1=Klucze: +2=Wartoci: +3=Katalogi: +4=Pliki: +5=Czas: +6=Klucze dodane: +7=Klucze usunite: +8=Wartoci dodane: +9=Wartoci usunite: +10=Wartoci zmodyfikowane: +11=Pliki dodane: +12=Pliki usunite: +13=Pliki [atrybuty?] zmodyfikowane: +14=Katalogi dodane: +15=Katalogi usunite: +16=Zmienione atrybuty katalogw: +17=Wszystkie zmiany: +18=Komentarze: +19=Data i godzina: +20=Komputer: +21=Nazwa uytkownika: +22=O programie +23=Bd +24=Bd wywoania przegldarki zewntrznej! +25=Bd tworzenia pliku! +26=Bd otwarcia pliku! +27=Bd przesunicia wskanika pliku! +28=Zdjcie &1 +29=Zdjcie &2 +30=&Porwnaj +31=W&yma +32=&Wyjcie +33=&O programie +34=&Monitor.. +35=Zapisz porwnanie rejestru jako: +36=Katalog docelowy: +37=Dodaj komentarz do rejestru: +38=&TXT +39=Dokument &HTML +40=&Skanuj kat1[;kat2;...;kat nn]: +41=&Zdjcie +42=Zdjcie + Za&pis... +43=W&czytaj... +44=W&yma wszystko +45=Wyma zdjcie &1 +46=Wyma zdjcie &2 + +[Serbian] +Translator=Computer Wizard +1=Kljuevi: +2=Vrednosti: +3=Direktorijumi: +4=Fajlovi: +5=Vreme: +6=Dodato kljuceva: +7=Obrisano kljuceva: +8=Dodato vrednosti: +9=Izbrisano vrednosti: +10=Izmenjeno vrednosti: +11=Dodato fajlova: +12=Izbrisano fajlova: +13=Fajlova [atributa?] izmenjeno: +14=Dodato foldera: +15=Izbrisano foldera: +16=Promenjeno atributa foldera: +17=Ukupno promena: +18=Komanda: +19=Datum i vreme: +20=Kompjuter: +21=Korisnicko ime: +22=O programu +23=Greka +24=Greka pri pozivanju eksternog viewer-a! +25=Greka pri kreiranju fajla! +26=Greka pri otvaranju fajla! +27=Greka pri promeni pokazivaa fajla! +28=&Prvi snimak +29=&Drugi snimak +30=&Uporedi +31=O&brii +32=&Izlaz +33=&O programu +34=&Monitor... +35=Rezultat poreenja snimi kao: +36=Izlazna putanja: +37=Dodaj komentar u log: +38=&Tekst +39=&HTML dokument +40=&Skeniraj dir1[;dir2;...;dir nn]: +41=&Snimi +42=Snimi i sauvaj na &disku... +43=&Uitaj... +44=&Obrii sve +45=Obrii prvi snimak +46=Obrii drugi snimak + +[Hebrew-] +Translator=Jack Gorji-[' ']-Email:zakgj@hotmail.com +1=: +2=: +3=: +4=: +5=-Time: +6= : +7= : +8= : +9= : +10= : +11= : +12= : +13= : +14= : +15= : +16= : +17=" : +18=: +19= : +20= : +21= : +22=& +23= +24= ! +25= ! +26= ! +27= ! +28=& '1 +29=& '2 +30=& +31=& +32=& +33=& +34= +35= +36= : +37= : +38=Plain &TXT +39=&HTML document +40=& dir1[;dir2;...;dir nn]: +41=& +42= ... +43=... +44= & +45= & +46= & + +[Galego] +Translator=Xos Antn Vicente Rodrguez (antonvicente@navegalia.com) +1=Claves: +2=Valores: +3=Directorios: +4=Arquivos: +5=Tempo: +6=Claves engadidas: +7=Claves borradas: +8=Valores engadidos: +9=Valores borrados: +10=Valores modificados: +11=Arquivos engadidos: +12=Arquivos borrados: +13=Atributos de arquivo modificados: +14=Cartafois engadidos: +15=Cartafois borrados: +16=Atributos de cartafol modificados: +17=Total de trocos: +18=Comentarios: +19=Data e hora: +20=Computador: +21=Usuario: +22=Sobre +23=Erro +24=Erro ao chamar a un visor externo! +25=Erro ao crear arquivo! +26=Erro ao abrir arquivos! +27=Erro ao mover punteiro de arquivo! +28=&1ra. Foto +29=&2da. Foto +30=C&omparar +31=&Limpar +32=S&ar +33=&Sobre +34=&Monitor.. +35=Comparar logs gardados como: +36=Ruta de sada: +37=Engadir comentario ao log: +38=&Texto +39=Documento &HTML +40=&Escanear dir1[;dir2;...;dir nn] +41=&Foto +42=Foto + &gardar... +43=&Cargar... +44=&Limpar +45=Limpar &1ra. Foto +46=Limpar &2da. Foto + +[Hrvatski] +Translator=Obelix (JK875@yahoo.cu.uk) +1=Kljuevi: +2=Vrijednosti: +3=Direktoriji: +4=Datoteke: +5=Vrijeme: +6=Dodano kljuceva: +7=Brisano kljuceva: +8=Dodano vrijednosti: +9=Brisano vrijednosti: +10=Izmijenjeno vrijednosti: +11=Dodano datoteka: +12=Izbrisano datoteka: +13=Datoteka [atributa?] izmijenjeno: +14=Dodano pod_direktorija: +15=Brisano pod_direktorija: +16=Promijenjeno atributa pod_direktorija: +17=Ukupno promjena: +18=Komanda: +19=Datum i vrijeme: +20=Kompjutor: +21=Korisniko ime: +22=O programu +23=Greka +24=Greka pri pozivanju vanjskog preglednika! +25=Greka pri kreiranju datoteke! +26=Greka pri otvaranju datoteke! +27=Greka pri promjeni pokazivaa datoteke! +28=&Prvi snimak +29=&Drugi snimak +30=&Usporedi +31=&Brii +32=&Izlaz +33=&O programu +34=&Monitor... +35=Rezultat usporedbe spremi kao: +36=Izlazna putanja: +37=Dodaj komentar u log: +38=&Tekst +39=&HTML dokument +40=&Pretrai dir1[;dir2;...;dir nn]: +41=&Snimi +42=Snimi i spremi na &disk... +43=&Uitaj... +44=&Bbrii sve +45=Brii prvi snimak +46=Brii drugi snimak + +[Bulgarian] +Translator=Alex Simidchiev +1=: +2=: +3=: +4=: +5=: +6= : +7= : +8= : +9= : +10= : +11= : +12= : +13= []: +14= : +15= : +16= []: +17= : +18=: +19= : +20= : +21= : +22= +23= +24= ! +25= ! +26= ! +27=Error move file pointer! +28=&1 +29=&2 +30=& +31=& +32=& +33=& +34=&... +35= : +36= : +37= : +38=& +39=& HTML +40=& [dir1;dir2;...;dir nn]: +41=& +42= + ... +43=&... +44=& +45= &1 +46= &2 + +[Svenska] +Translator=joup@algonet.se +1=Nycklar: +2=Vrden: +3=Kataloger: +4=Filer: +5=Tid: +6=Adderade nycklar: +7=Borttagna nycklar: +8=Adderade vrden: +9=Borttagna vrden: +10=ndrade vrden: +11=Adderade filer: +12=Borttagna filer: +13=ndrade filer [attribut?]: +14=Adderade kataloger: +15=Borttagna kataloger: +16=ndrade katalogattribut: +17=Totala ndringar: +18=Kommentarer: +19=Datum/tid: +20=Dator: +21=Anvndarnamn: +22=Om +23=Fel +24=Fel vid anrop av extern filvisare! +25=Kunde inte skapa fil! +26=Kunde inte ppna fil! +27=Fel vid flyttning av filpekare! +28=&1:a tagningen +29=&2:a tagningen +30=&Jmfr +31=&Tm +32=A&vsluta +33=&Om Regshot +34=&Bevaka.. +35=Jmfrelselog sparas som: +36=Mlkatalog: +37=Lgg till kommentar i loggen: +38=Ren &TXT +39=&HTMLdokument +40=&Scanna dir1[;dir2;...;dir nn]: +41=&Shot +42=Shot och spa&ra... +43=Ls &in... +44=&Tm allt +45=Tm &1:a tagningen +46=Tm &2:a tagningen + +[Hungarian] +Translator=Bata Gyrgy +1=Kulcsok: +2=rtkek: +3=Mappk: +4=Fjlok: +5=Id: +6=Hozzadott rendszerler kulcsok: +7=Trlt rendszerler kulcsok: +8=Hozzadott rendszerler rtkek: +9=Trlt rendszerler rtkek: +10=Mdostott rendszerler rtkek: +11=Hozzadott fjlok: +12=Trlt fjlok: +13=Mdostott fjlok [attribtumok]: +14=Hozzadott mappk: +15=Trlt mappk: +16=Mdostott mappa attribtumok: +17=sszes vltozs: +18=Megjegyzs: +19=Dtum s id: +20=Szmtgp: +21=Felhasznlnv: +22=Nvjegy +23=Hiba +24=Hiba a kls szerkeszt meghvsakor! +25=Hiba a fjl ltrehozsakor! +26=Hiba a fjl megnyitsakor! +27=Hiba a fjlmutat mozgatsakor! +28=&1. Minta +29=&2. Minta +30=&sszevets +31=&Trls +32=&Kilps +33=&Nvjegy +34=Figy&els... +35=Naplfjl formtuma: +36=Eredmny mentse ide: +37=Megjegyzs a naplfjlban, fjlnv: +38=T&XT fjl +39=&HTML fjl +40=&Figyelt mappk [a;b;c;...]: +41=&Vizsglat +42=Vizsglat s &ments... +43=&Betlts... +44=&Mind trlse +45=&1. Minta trlse +46=&2. Minta trlse + +[] +Translator=Dmitry P. +1=: +2=: +3=: +4=: +5=: +6= : +7= : +8= : +9= : +10= : +11= : +12= : +13= []: +14= : +15= : +16= []: +17= : +18=: +19= : +20=' ': +21=' : +22= +23= +24= ! +25= ! +26= ! +27=Error move file pointer! +28=1 +29=2 +30= +31= +32= +33= +34= +35= : +36= : +37= : +38= +39= HTML +40= 1[;dir2;...]: +41= +42= + ... +43=³... +44= +45= 1 +46= 2 + +[Kazakh] +Translator= +1=: +2=: +3=: +4=: +5=: +6= : +7=f o: +8= : +9=f : +10= : +11= : +12=f : +13= []: +14= : +15=f : +16= []: +17= : +18= : +19=ff : +20= : +21= : +22=C +23= +24= ! +25= ! +26= ! +27=Error move file pointer! +28=&1 +29=&2 +30=& +31=& +32=&f +33=&C +34=&... +35= : +36= : +37= : +38=& +39=&HTML +40=& 1[;dir2;...;dir nn]: +41=& +42= + &... +43=&... +44=& +45= &1 +46= &2 + diff --git a/RegShot/regshot.exe b/RegShot/regshot.exe new file mode 100644 index 0000000..3e9527b Binary files /dev/null and b/RegShot/regshot.exe differ diff --git a/RegShot/regshot.ini b/RegShot/regshot.ini new file mode 100644 index 0000000..48e223b --- /dev/null +++ b/RegShot/regshot.ini @@ -0,0 +1,15 @@ +[Setup] +Flag=1 +ExtDir= +OutDir= +UseLongRegHead=0 + +[SkipRegKey] +0= +1= +2= + +[SkipDir] +0= +1= +2= diff --git a/RegShot/regshot_x64.exe b/RegShot/regshot_x64.exe new file mode 100644 index 0000000..6f0bdc1 Binary files /dev/null and b/RegShot/regshot_x64.exe differ diff --git a/RegShot/src/182to183/align.c b/RegShot/src/182to183/align.c new file mode 100644 index 0000000..44e4fcd --- /dev/null +++ b/RegShot/src/182to183/align.c @@ -0,0 +1,123 @@ +/* + Copyright 2011 Regshot Team + + Regshot is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + Regshot is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Regshot; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "global.h" + +//-------------------------------------------------- +// Realign key & value content after loading from hive file +//-------------------------------------------------- +VOID ReAlignReg(LPKEYCONTENT lpKey, size_t nBase) +{ + LPVALUECONTENT lpv; + + if (lpKey->lpkeyname != NULL) { + lpKey->lpkeyname += nBase; + } + if (lpKey->lpfirstvalue != NULL) { + lpKey->lpfirstvalue = (LPVALUECONTENT)((LPBYTE)lpKey->lpfirstvalue + nBase); + } + if (lpKey->lpfirstsubkey != NULL) { + lpKey->lpfirstsubkey = (LPKEYCONTENT)((LPBYTE)lpKey->lpfirstsubkey + nBase); + } + if (lpKey->lpbrotherkey != NULL) { + lpKey->lpbrotherkey = (LPKEYCONTENT)((LPBYTE)lpKey->lpbrotherkey + nBase); + } + if (lpKey->lpfatherkey != NULL) { + lpKey->lpfatherkey = (LPKEYCONTENT)((LPBYTE)lpKey->lpfatherkey + nBase); + } + + + for (lpv = lpKey->lpfirstvalue; lpv != NULL; lpv = lpv->lpnextvalue) { + + if (lpv->lpvaluename != NULL) { + lpv->lpvaluename += nBase; + } + if (lpv->lpvaluedata != NULL) { + lpv->lpvaluedata += nBase; + } + if (lpv->lpnextvalue != NULL) { + lpv->lpnextvalue = (LPVALUECONTENT)((LPBYTE)lpv->lpnextvalue + nBase); + } + if (lpv->lpfatherkey != NULL) { + lpv->lpfatherkey = (LPKEYCONTENT)((LPBYTE)lpv->lpfatherkey + nBase); + } + + } + + if (lpKey->lpfirstsubkey != NULL) { + ReAlignReg(lpKey->lpfirstsubkey, nBase); + } + + if (lpKey->lpbrotherkey != NULL) { + ReAlignReg(lpKey->lpbrotherkey, nBase); + } +} + + +//-------------------------------------------------- +// Realign filecontent, called by ReAlignFile() +//-------------------------------------------------- +VOID ReAlignFileContent(LPFILECONTENT lpFC, size_t nBase) +{ + + if (lpFC->lpfilename != NULL) { + lpFC->lpfilename += nBase; + } + if (lpFC->lpfirstsubfile != NULL) { + lpFC->lpfirstsubfile = (LPFILECONTENT)((LPBYTE)lpFC->lpfirstsubfile + nBase); + } + if (lpFC->lpbrotherfile != NULL) { + lpFC->lpbrotherfile = (LPFILECONTENT)((LPBYTE)lpFC->lpbrotherfile + nBase); + } + if (lpFC->lpfatherfile != NULL) { + lpFC->lpfatherfile = (LPFILECONTENT)((LPBYTE)lpFC->lpfatherfile + nBase); + } + + + if (lpFC->lpfirstsubfile != NULL) { + ReAlignFileContent(lpFC->lpfirstsubfile, nBase); + } + + if (lpFC->lpbrotherfile != NULL) { + ReAlignFileContent(lpFC->lpbrotherfile, nBase); + } + +} + + +//-------------------------------------------------- +// Realign file, walk through chain +//-------------------------------------------------- +VOID ReAlignFile(LPHEADFILE lpHF, size_t nBase) +{ + LPHEADFILE lphf; + + for (lphf = lpHF; lphf != NULL; lphf = lphf->lpnextheadfile) { + + if (lphf->lpnextheadfile != NULL) { + lphf->lpnextheadfile = (LPHEADFILE)((LPBYTE)lphf->lpnextheadfile + nBase); + } + if (lphf->lpfilecontent != NULL) { + lphf->lpfilecontent = (LPFILECONTENT)((LPBYTE)lphf->lpfilecontent + nBase); + } + + if (lphf->lpfilecontent != NULL) { // I wouldn't find crash bug(loadhive->readfile) in 1.8.0 if I had added it in that version + ReAlignFileContent(lphf->lpfilecontent, nBase); + } + } +} diff --git a/RegShot/src/182to183/global.h b/RegShot/src/182to183/global.h new file mode 100644 index 0000000..80ec9d6 --- /dev/null +++ b/RegShot/src/182to183/global.h @@ -0,0 +1,158 @@ +/* + Copyright 2011 Regshot Team + + Regshot is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + Regshot is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Regshot; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include +#include +#include + +#define REGSHOT_HIVE_SIGNATURE_182 "REGSHOTHIVE" +#define REGSHOT_HIVE_SIGNATURE "RSHIVE183" + +#define HIVEBEGINOFFSET 512 // Hive file out put header computerlen*2+sizeof(systemtime)+32 must lpkeyname) + 1; // Get len+1 + nPad = (nLenPlus1 % sizeof(DWORD) == 0) ? 0 : (sizeof(DWORD) - nLenPlus1 % sizeof(DWORD)); + nFPHeader = SetFilePointer(hFileWholeReg, 0, NULL, FILE_CURRENT); // Save head fp + + // using struct ,idea from maddes + skc.fpos_keyname = nFPHeader + sizeof(SAVEKEYCONTENT); + skc.fpos_firstvalue = (lpKeyContent->lpfirstvalue != NULL) ? (nFPHeader + sizeof(SAVEKEYCONTENT) + nLenPlus1 + nPad) : 0; + skc.fpos_firstsubkey = 0; // it is filled later. + skc.fpos_brotherkey = 0; // it is filled later + skc.fpos_fatherkey = nFPCurrentFatherKey; + skc.bkeymatch = 0; + WriteFile(hFileWholeReg, &skc, sizeof(skc), &NBW, NULL); + + WriteFile(hFileWholeReg, lpKeyContent->lpkeyname, nLenPlus1, &NBW, NULL); // Save the current keyname + + nFPTemp4Write = 0; + if (nPad > 0) { + WriteFile(hFileWholeReg, &nFPTemp4Write, nPad, &NBW, NULL); + } + + + // Save the sub-value of current KeyContent + for (lpv = lpKeyContent->lpfirstvalue; lpv != NULL; lpv = lpv->lpnextvalue) { + + nLenPlus1 = (DWORD)strlen(lpv->lpvaluename) + 1; + nPad = (nLenPlus1 % sizeof(DWORD) == 0) ? 0 : (sizeof(DWORD) - nLenPlus1 % sizeof(DWORD)); // determine if pad to 4bytes is needed + nPad1 = (lpv->datasize % sizeof(DWORD) == 0) ? 0 : (sizeof(DWORD) - lpv->datasize % sizeof(DWORD)); + + nFPCurrent = SetFilePointer(hFileWholeReg, 0, NULL, FILE_CURRENT); // Save fp + svc.typecode = lpv->typecode; + svc.datasize = lpv->datasize; + svc.fpos_valuename = nFPCurrent + sizeof(SAVEVALUECONTENT); // size must same for valuecontent and savevaluecontent + svc.fpos_valuedata = (lpv->datasize > 0) ? (nFPCurrent + sizeof(SAVEVALUECONTENT) + nLenPlus1 + nPad) : 0; // if no lpvaluedata, we write 0 + svc.fpos_nextvalue = (lpv->lpnextvalue != NULL) ? (nFPCurrent + sizeof(SAVEVALUECONTENT) + nLenPlus1 + nPad + lpv->datasize + nPad1) : 0; // if no nextvalue we write 0 + svc.fpos_fatherkey = nFPHeader; + svc.bvaluematch = 0; + WriteFile(hFileWholeReg, &svc, sizeof(svc), &NBW, NULL); + + + WriteFile(hFileWholeReg, lpv->lpvaluename, nLenPlus1, &NBW, NULL); // Save lpvaluename + + nFPTemp4Write = 0; + if (nPad > 0) { + WriteFile(hFileWholeReg, &nFPTemp4Write, nPad, &NBW, NULL); + } + + if (lpv->datasize > 0) { + WriteFile(hFileWholeReg, lpv->lpvaluedata, lpv->datasize, &NBW, NULL); // Save lpvaluedata + + if (nPad1 > 0) { + WriteFile(hFileWholeReg, &nFPTemp4Write, nPad1, &NBW, NULL); + } + } + + } + + if (lpKeyContent->lpfirstsubkey != NULL) { + // pass this keycontent's position as subkey's fatherkey's position and pass the "lpfirstsubkey field" + SaveRegKey(lpKeyContent->lpfirstsubkey, nFPHeader, nFPHeader + 2 * sizeof(DWORD)); + } + + if (lpKeyContent->lpbrotherkey != NULL) { + // pass this key's fatherkey's position as brother's father and pass "lpbrotherkey field" + SaveRegKey(lpKeyContent->lpbrotherkey, nFPCurrentFatherKey, nFPHeader + 3 * sizeof(DWORD)); + } + + if (nFPCaller > 0) { // save position of current key in current father key + nFPCurrent = SetFilePointer(hFileWholeReg, 0, NULL, FILE_CURRENT); + SetFilePointer(hFileWholeReg, nFPCaller, NULL, FILE_BEGIN); + WriteFile(hFileWholeReg, &nFPHeader, sizeof(nFPHeader), &NBW, NULL); + SetFilePointer(hFileWholeReg, nFPCurrent, NULL, FILE_BEGIN); + } + +} + +//-------------------------------------------------- +// File save engine (It is stupid again!) added in 1.8 +// 1.8.3 changed some struct +// modi 20111216 +//-------------------------------------------------- +VOID SaveFileContent(LPFILECONTENT lpFileContent, DWORD nFPCurrentFatherFile, DWORD nFPCaller) +{ + + DWORD nFPTemp4Write; + DWORD nFPHeader; + DWORD nFPCurrent; + DWORD nLenPlus1; + int nPad; + + nLenPlus1 = (DWORD)strlen(lpFileContent->lpfilename) + 1; // Get len+1 + nFPHeader = SetFilePointer(hFileWholeReg, 0, NULL, FILE_CURRENT); // Save head fp + // using struct, idea from maddes + sfc.fpos_filename = nFPHeader + sizeof(SAVEFILECONTENT); // 1.8.3 11*4 former is 10*4+1 + sfc.writetimelow = lpFileContent->writetimelow; + sfc.writetimehigh = lpFileContent->writetimehigh; + sfc.filesizelow = lpFileContent->filesizelow; + sfc.filesizehigh = lpFileContent->filesizehigh; + sfc.fileattr = lpFileContent->fileattr; + sfc.cksum = lpFileContent->cksum; + sfc.fpos_firstsubfile = 0; + sfc.fpos_brotherfile = 0; + sfc.fpos_fatherfile = nFPCurrentFatherFile; + sfc.bfilematch = 0; + WriteFile(hFileWholeReg, &sfc, sizeof(sfc), &NBW, NULL); + + WriteFile(hFileWholeReg, lpFileContent->lpfilename, nLenPlus1, &NBW, NULL); // Save the current filename + + nPad = (nLenPlus1 % sizeof(DWORD) == 0) ? 0 : (sizeof(DWORD) - nLenPlus1 % sizeof(DWORD)); + + nFPTemp4Write = 0; + if (nPad > 0) { + WriteFile(hFileWholeReg, &nFPTemp4Write, nPad, &NBW, NULL); // Save the current filename + } + + if (lpFileContent->lpfirstsubfile != NULL) { + // pass this filecontent's position as subfile's fatherfile's position and pass the "lpfirstsubfile field" + SaveFileContent(lpFileContent->lpfirstsubfile, nFPHeader, nFPHeader + 7 * sizeof(DWORD)); + } + + if (lpFileContent->lpbrotherfile != NULL) { + // pass this file's fatherfile's position as brother's father and pass "lpbrotherfile field" + SaveFileContent(lpFileContent->lpbrotherfile, nFPCurrentFatherFile, nFPHeader + 8 * sizeof(DWORD)); + } + + if (nFPCaller > 0) { // save position of current file in current father file + nFPCurrent = SetFilePointer(hFileWholeReg, 0, NULL, FILE_CURRENT); + SetFilePointer(hFileWholeReg, nFPCaller, NULL, FILE_BEGIN); + WriteFile(hFileWholeReg, &nFPHeader, sizeof(nFPHeader), &NBW, NULL); + SetFilePointer(hFileWholeReg, nFPCurrent, NULL, FILE_BEGIN); + } + +} + +//--------------------------------------------------------------------------------- +// Load registry from HIVE file (After this, we should realign the data in memory) +//--------------------------------------------------------------------------------- +BOOL LoadHive(LPCSTR lpFileName, LPKEYCONTENT FAR *lplpKeyHLM, LPKEYCONTENT FAR *lplpKeyUSER, + LPHEADFILE FAR *lplpHeadFile) +{ + DWORD nFileSize; + DWORD nOffSet = 0; + size_t nBase; + DWORD i, j; + DWORD nRemain; + DWORD nReadSize; + BOOL bRet = FALSE; + LPBYTE lpHive; + + hFileWholeReg = CreateFile(lpFileName, GENERIC_READ , FILE_SHARE_READ , NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + if (hFileWholeReg != INVALID_HANDLE_VALUE) { + lpHive = MYALLOC0(16); + ReadFile(hFileWholeReg, lpHive, 16, &NBW, NULL); + + if (strcmp(str_RegshotHiveSignature182, (const char *)(lpHive)) != 0) { + printf("Error:Does not detect regshot_hive_signagure used by version <=1.8.2"); //changed in 1.8.3 + bRet = FALSE; + } else { + nFileSize = GetFileSize(hFileWholeReg, NULL); + MYFREE(lpHive); + + lpHive = MYALLOC(nFileSize); + nBase = (size_t) lpHive; + lpOldHiveHeader = lpHive; + + ReadFile(hFileWholeReg, &nOffSet, 4, &NBW, NULL); + *lplpKeyHLM = (LPKEYCONTENT)(nBase + nOffSet); + + ReadFile(hFileWholeReg, &nOffSet, 4, &NBW, NULL); + *lplpKeyUSER = (LPKEYCONTENT)(nBase + nOffSet); + + ReadFile(hFileWholeReg, &nOffSet, 4, &NBW, NULL); + if (nOffSet == 0) { + *lplpHeadFile = NULL; + } else { + *lplpHeadFile = (LPHEADFILE)(nBase + nOffSet); + } + + SetFilePointer(hFileWholeReg, 0, NULL, FILE_BEGIN); + +#define READ_BATCH_SIZE 8192 + + printf("Reading %s....", lpFileName); + for (i = 0, j = 0, nRemain = nFileSize;; i += READ_BATCH_SIZE, j++) { + if (nRemain >= READ_BATCH_SIZE) { + nReadSize = READ_BATCH_SIZE; + } else { + nReadSize = nRemain; + } + ReadFile(hFileWholeReg, (lpHive) + i, nReadSize, &NBW, NULL); // read the whole file now + if (NBW != nReadSize) { + printf("Reading ERROR!"); + break; + } + nRemain -= nReadSize; + if (nRemain == 0) { + break; + } + + } +#undef READ_BATCH_SIZE + + ReAlignReg(*lplpKeyHLM, nBase); + ReAlignReg(*lplpKeyUSER, nBase); + + if (*lplpHeadFile != NULL) { + ReAlignFile(*lplpHeadFile, nBase); + } + + bRet = TRUE; + + } + CloseHandle(hFileWholeReg); + } else { + printf("Error:Can not open file!\n"); + bRet = FALSE; + } + + return(bRet); + +} + + +//-------------------------------------------------- +// Routine to call registry save engine and file save engine +//-------------------------------------------------- +BOOL SaveHive(LPCSTR lpFileName, LPKEYCONTENT lpKeyHLM, LPKEYCONTENT lpKeyUSER, + LPHEADFILE lpHF) +{ + DWORD nFPcurrent; + DWORD nFPcurrent1; + DWORD nFPTemp4Write; + BOOL bRet; + LPHEADFILE lphf; + + bRet = FALSE; + + if (lpKeyHLM != NULL || lpKeyUSER != NULL) { + + hFileWholeReg = CreateFile(lpFileName, GENERIC_WRITE, 0, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL); + if (hFileWholeReg != INVALID_HANDLE_VALUE) { + + WriteFile(hFileWholeReg, str_RegshotHiveSignature183, sizeof(str_RegshotHiveSignature183) - 1, &NBW, NULL); + + // 0 signature( <= 12) last 4 bytes may be used in furture + // 16 startoflpkeyhlm (512) + // 20 startoflpkeyuser(???) + // 24 fileheadchain begin (new) ->(file -> nextfilehead(4) next4bytes is filecontent) added in 1.8 + // 28 future use! + // 32 computer name + // 96 username + // 160 systemtime + + // Save the position of H_L_M + nFPcurrent = HIVEBEGINOFFSET; // computerlen*2+sizeof(systemtime)+32 must lpfilecontent, 0, 0); + nFPcurrent1 = SetFilePointer(hFileWholeReg, 0, NULL, FILE_CURRENT); + nFPTemp4Write = nFPcurrent1; + SetFilePointer(hFileWholeReg, nFPcurrent, NULL, FILE_BEGIN); + lphf = lphf->lpnextheadfile; + if (lphf != NULL) { + WriteFile(hFileWholeReg, &nFPTemp4Write, sizeof(nFPTemp4Write), &NBW, NULL); + } else { + nFPTemp4Write = 0; + WriteFile(hFileWholeReg, &nFPTemp4Write, sizeof(nFPTemp4Write), &NBW, NULL); + break; + } + SetFilePointer(hFileWholeReg, nFPcurrent1, NULL, FILE_BEGIN); + } + } + + CloseHandle(hFileWholeReg); + printf("\nDone.\n"); + bRet = TRUE; + } else { + printf("Error:Can not create file!\n"); + bRet = FALSE; + } + + } + return bRet; +} diff --git a/RegShot/src/182to183/main.c b/RegShot/src/182to183/main.c new file mode 100644 index 0000000..17e4477 --- /dev/null +++ b/RegShot/src/182to183/main.c @@ -0,0 +1,41 @@ +/* + Copyright 2011 Regshot Team + + Regshot is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + Regshot is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Regshot; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "global.h" + +int main(int argc, char *argv[]) +{ +#ifdef _WIN64 + printf("Cannot be compiled as 64bit program.\n"); + return 1; +#else + printf("Regshot hive file transfer program version 1.8.3beta1V4\n\ +Transfer hive file used in <= 1.8.2 to new structure used in 1.8.3\n\ +Usage: 182to183 infile.hiv outfile.hiv\n\n"); + if (argc < 3) { + printf("[X] Need input and output filenames!\n"); + return 1; + } + if (LoadHive(argv[1], &lpHeadLocalMachine, &lpHeadUsers, &lpHeadFile) != TRUE) { + return 1; + } + SaveHive(argv[2], lpHeadLocalMachine, lpHeadUsers, lpHeadFile); + + return 0; +#endif +} diff --git a/RegShot/src/Makefile b/RegShot/src/Makefile new file mode 100644 index 0000000..d6480f6 --- /dev/null +++ b/RegShot/src/Makefile @@ -0,0 +1,120 @@ +#****************************************************************************** +#* Copyright 2011 XhmikosR +#* +#* This file is part of Regshot. +#* +#* Regshot is free software; you can redistribute it and/or modify +#* it under the terms of the GNU General Public License as published by +#* the Free Software Foundation; either version 2 of the License, or +#* (at your option) any later version. +#* +#* Regshot is distributed in the hope that it will be useful, +#* but WITHOUT ANY WARRANTY; without even the implied warranty of +#* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +#* GNU General Public License for more details. +#* +#* You should have received a copy of the GNU General Public License +#* along with Regshot; if not, write to the Free Software +#* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +#* +#* +#* makefile +#* makefile for building Regshot with GCC +#* +#****************************************************************************** + + +CC=gcc.exe + +all:.all +distclean: clean + +#DEBUG=yes +#64BIT=yes + +ifeq ($(64BIT),yes) + MY_PREFIX=x86_64-w64-mingw32- + CFLAGS=-DWIN64 -D_WIN64 -D_WIN32_WINNT=0x0502 + OPTFLAGS=-O3 -m64 + STACK_SIZE=67108864 +else + CFLAGS=-DWIN32 -D_WIN32 -D_WIN32_WINNT=0x0500 + OPTFLAGS=-O3 -march=i686 -msse -mfpmath=sse + STACK_SIZE=33554432 +endif + +ifeq ($(DEBUG),yes) + CFLAGS+=-DDEBUG -D_DEBUG -g +else + CFLAGS+=-DNDEBUG -UDEBUG +endif + +SRCS_C=\ + fileshot.c \ + language.c \ + misc.c \ + output.c \ + regshot.c \ + setup.c \ + ui.c \ + winmain.c + +RESSRC=regshot.rc + +TARGET_DIR=../bin/GCC/ + +ifeq ($(DEBUG),yes) + MY_DIR_PREFIX=Debug +else + MY_DIR_PREFIX=Release +endif + +ifeq ($(64BIT),yes) + MY_ARCH=x64 +else + MY_ARCH=Win32 +endif + +OBJ_DIR=$(TARGET_DIR)$(MY_DIR_PREFIX)_$(MY_ARCH)/obj/ + +OUTFLAGS=-MMD -o\ + +TARGET_EXE=$(TARGET_DIR)$(MY_DIR_PREFIX)_$(MY_ARCH)/Regshot.exe + + +# Targets + +.all: outdirs $(TARGET_EXE) + +.PHONY: outdirs $(OBJ_DIR) +outdirs: $(OBJ_DIR) +$(OBJ_DIR): + $(shell test -d $(@) || mkdir -p $(@)) + + +.PHONY: clean +clean: + rm -f $(TARGET_EXE) + rm -r -f $(OBJ_DIR) + + +# Commands + +OBJS+=$(SRCS_C:%.c=$(OBJ_DIR)%.o) $(RESSRC:%.rc=$(OBJ_DIR)%.res.o) + +$(OBJ_DIR)%.o: %.c + @echo $< + @$(MY_PREFIX)$(CC) -c $(CFLAGS) $(OPTFLAGS) $(OUTFLAGS) $@ $< + +$(OBJ_DIR)%.res.o: %.rc + @echo $< + @$(MY_PREFIX)windres -o $@ $< + +$(TARGET_EXE): $(OBJS) + @echo $@ + @$(MY_PREFIX)$(CC) -mwindows -Wl,--stack=$(STACK_SIZE) -o $@ $(OBJS) +ifneq ($(DEBUG),yes) + @$(MY_PREFIX)strip $@ +endif + +-include $(SRCS_C:%.c=$(OBJ_DIR)%.d) diff --git a/RegShot/src/fileshot.c b/RegShot/src/fileshot.c new file mode 100644 index 0000000..b7d1d6c --- /dev/null +++ b/RegShot/src/fileshot.c @@ -0,0 +1,586 @@ +/* + Copyright 1999-2003,2007,2011 TiANWEi + Copyright 2004 tulipfan + Copyright 2011 maddes + + This file is part of Regshot. + + Regshot is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + Regshot is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Regshot; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "global.h" +// ISDIR, ISFILE added in 1.8.0 +#define ISDIR(x) ( (x&FILE_ATTRIBUTE_DIRECTORY) != 0 ) +#define ISFILE(x) ( (x&FILE_ATTRIBUTE_DIRECTORY) == 0 ) + +SAVEFILECONTENT sFC; + + +extern LPBYTE lan_dir; +extern LPBYTE lan_file; + + +//------------------------------------------------------------- +// Routine to get Whole File Name[root dir] from a FILECONTENT +//------------------------------------------------------------- +LPSTR GetWholeFileName(LPFILECONTENT lpFileContent) +{ + LPFILECONTENT lpf; + LPSTR lpName; + LPSTR lptail; + size_t nLen = 0; + + for (lpf = lpFileContent; lpf != NULL; lpf = lpf->lpfatherfile) { + nLen += strlen(lpf->lpfilename) + 1; + } + if (nLen == 0) { + nLen++; + } + lpName = MYALLOC(nLen); + + lptail = lpName + nLen - 1; + *lptail = 0x00; + + for (lpf = lpFileContent; lpf != NULL; lpf = lpf->lpfatherfile) { + nLen = strlen(lpf->lpfilename); + memcpy(lptail -= nLen, lpf->lpfilename, nLen); + if (lptail > lpName) { + *--lptail = '\\'; // 0x5c; + } + } + return lpName; +} + + +//------------------------------------------------------------- +// Routine to walk through all sub tree of current directory [File system] +//------------------------------------------------------------- +VOID GetAllSubFile( + BOOL needbrother, + DWORD typedir, + DWORD typefile, + LPDWORD lpcountdir, + LPDWORD lpcountfile, + LPFILECONTENT lpFileContent +) +{ + //LPSTR lpTemp; + + if (ISDIR(lpFileContent->fileattr)) { + //lpTemp = lpFileContent->lpfilename; + if (strcmp(lpFileContent->lpfilename, ".") != 0 && strcmp(lpFileContent->lpfilename, "..") != 0) { // tfx added in 1.7.3 fixed at 1.8.0 we should add here 1.8.0 + //if (*(unsigned short *)lpTemp != 0x002E && !(*(unsigned short *)lpTemp == 0x2E2E && *(lpTemp + 2) == 0x00)) { // 1.8.2 + LogToMem(typedir, lpcountdir, lpFileContent); + } + } else { + LogToMem(typefile, lpcountfile, lpFileContent); + } + + if (lpFileContent->lpfirstsubfile != NULL) { + GetAllSubFile(TRUE, typedir, typefile, lpcountdir, lpcountfile, lpFileContent->lpfirstsubfile); + } + if (needbrother == TRUE) { + if (lpFileContent->lpbrotherfile != NULL) { + GetAllSubFile(TRUE, typedir, typefile, lpcountdir, lpcountfile, lpFileContent->lpbrotherfile); + } + } + + +} + + +//------------------------------------------------------------ +// File Shot Engine +//------------------------------------------------------------ +VOID GetFilesSnap(LPFILECONTENT lpFatherFile) +{ + LPSTR lpFilename; + LPSTR lpTemp; + HANDLE filehandle; + WIN32_FIND_DATA finddata; + LPFILECONTENT lpFileContent; + LPFILECONTENT lpFileContentTemp; + + lpTemp = GetWholeFileName(lpFatherFile); + //Not used + //if (bWinNTDetected) + //{ + // lpFilename = MYALLOC(strlen(lpTemp) + 5 + 4); + // strcpy(lpFilename,"\\\\?\\"); + // strcat(lpFilename,lpTemp); + //} + //else + { + lpFilename = MYALLOC(strlen(lpTemp) + 5); + strcpy(lpFilename, lpTemp); + } + strcat(lpFilename, "\\*.*"); + + MYFREE(lpTemp); + //_asm int 3; + filehandle = FindFirstFile(lpFilename, &finddata); + MYFREE(lpFilename); + if (filehandle == INVALID_HANDLE_VALUE) { + return; + } + + //lpTemp = finddata.cFileName; // 1.8 + + lpFileContent = MYALLOC0(sizeof(FILECONTENT)); + lpFileContent->lpfilename = MYALLOC0(strlen(finddata.cFileName) + 1); // must add one! + strcpy(lpFileContent->lpfilename, finddata.cFileName); + lpFileContent->writetimelow = finddata.ftLastWriteTime.dwLowDateTime; + lpFileContent->writetimehigh = finddata.ftLastWriteTime.dwHighDateTime; + lpFileContent->filesizelow = finddata.nFileSizeLow; + lpFileContent->filesizehigh = finddata.nFileSizeHigh; + lpFileContent->fileattr = finddata.dwFileAttributes; + lpFileContent->lpfatherfile = lpFatherFile; + lpFatherFile->lpfirstsubfile = lpFileContent; + lpFileContentTemp = lpFileContent; + + if (ISDIR(lpFileContent->fileattr)) { + if (strcmp(lpFileContent->lpfilename, ".") != 0 && strcmp(lpFileContent->lpfilename, "..") != 0 + && !IsInSkipList(lpFileContent->lpfilename, lplpFileSkipStrings)) { // tfx + + nGettingDir++; + GetFilesSnap(lpFileContent); + } + } else { + nGettingFile++; + } + + + for (; FindNextFile(filehandle, &finddata) != FALSE;) { + lpFileContent = MYALLOC0(sizeof(FILECONTENT)); + lpFileContent->lpfilename = MYALLOC0(strlen(finddata.cFileName) + 1); + strcpy(lpFileContent->lpfilename, finddata.cFileName); + lpFileContent->writetimelow = finddata.ftLastWriteTime.dwLowDateTime; + lpFileContent->writetimehigh = finddata.ftLastWriteTime.dwHighDateTime; + lpFileContent->filesizelow = finddata.nFileSizeLow; + lpFileContent->filesizehigh = finddata.nFileSizeHigh; + lpFileContent->fileattr = finddata.dwFileAttributes; + lpFileContent->lpfatherfile = lpFatherFile; + lpFileContentTemp->lpbrotherfile = lpFileContent; + lpFileContentTemp = lpFileContent; + + if (ISDIR(lpFileContent->fileattr)) { + if (strcmp(lpFileContent->lpfilename, ".") != 0 && strcmp(lpFileContent->lpfilename, "..") != 0 + && !IsInSkipList(lpFileContent->lpfilename, lplpFileSkipStrings)) { // tfx + nGettingDir++; + GetFilesSnap(lpFileContent); + } + } else { + nGettingFile++; + } + + } + FindClose(filehandle); + + nGettingTime = GetTickCount(); + if ((nGettingTime - nBASETIME1) > REFRESHINTERVAL) { + UpdateCounters(lan_dir, lan_file, nGettingDir, nGettingFile); + } + + return ; +} + + +//------------------------------------------------------------- +// File comparison engine (lp1 and lp2 run parallel) +//------------------------------------------------------------- +VOID CompareFirstSubFile(LPFILECONTENT lpHead1, LPFILECONTENT lpHead2) +{ + LPFILECONTENT lp1; + LPFILECONTENT lp2; + + for (lp1 = lpHead1; lp1 != NULL; lp1 = lp1->lpbrotherfile) { + for (lp2 = lpHead2; lp2 != NULL; lp2 = lp2->lpbrotherfile) { + if ((lp2->bfilematch == NOTMATCH) && strcmp(lp1->lpfilename, lp2->lpfilename) == 0) { // 1.8.2 from lstrcmp to strcmp + // Two files have the same name, but we are not sure they are the same, so we compare them! + if (ISFILE(lp1->fileattr) && ISFILE(lp2->fileattr)) + //(lp1->fileattr&FILE_ATTRIBUTE_DIRECTORY) != FILE_ATTRIBUTE_DIRECTORY && (lp2->fileattr&FILE_ATTRIBUTE_DIRECTORY) != FILE_ATTRIBUTE_DIRECTORY) + { + // Lp1 is file, lp2 is file + if (lp1->writetimelow == lp2->writetimelow && lp1->writetimehigh == lp2->writetimehigh && + lp1->filesizelow == lp2->filesizelow && lp1->filesizehigh == lp2->filesizehigh && lp1->fileattr == lp2->fileattr) { + // We found a match file! + lp2->bfilematch = ISMATCH; + } else { + // We found a dismatch file, they will be logged + lp2->bfilematch = ISMODI; + LogToMem(FILEMODI, &nFILEMODI, lp1); + } + + } else { + // At least one file of the pair is directory, so we try to determine + if (ISDIR(lp1->fileattr) && ISDIR(lp2->fileattr)) + // (lp1->fileattr&FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY && (lp2->fileattr&FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY) + { + // The two 'FILE's are all dirs + if (lp1->fileattr == lp2->fileattr) { + // Same dir attributes, we compare their subfiles + lp2->bfilematch = ISMATCH; + CompareFirstSubFile(lp1->lpfirstsubfile, lp2->lpfirstsubfile); + } else { + // Dir attributes changed, they will be logged + lp2->bfilematch = ISMODI; + LogToMem(DIRMODI, &nDIRMODI, lp1); + } + //break; + } else { + // One of the 'FILE's is dir, but which one? + if (ISFILE(lp1->fileattr) && ISDIR(lp2->fileattr)) + //(lp1->fileattr&FILE_ATTRIBUTE_DIRECTORY) != FILE_ATTRIBUTE_DIRECTORY && (lp2->fileattr&FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY) + { + // lp1 is file, lp2 is dir + lp1->bfilematch = ISDEL; + LogToMem(FILEDEL, &nFILEDEL, lp1); + GetAllSubFile(FALSE, DIRADD, FILEADD, &nDIRADD, &nFILEADD, lp2); + } else { + // lp1 is dir, lp2 is file + lp2->bfilematch = ISADD; + LogToMem(FILEADD, &nFILEADD, lp2); + GetAllSubFile(FALSE, DIRDEL, FILEDEL, &nDIRDEL, &nFILEDEL, lp1); + } + } + } + break; + } + } + + if (lp2 == NULL) { + // lp2 looped to the end, that is, we can not find a lp2 matches lp1, so lp1 is deleted! + if (ISDIR(lp1->fileattr)) { + GetAllSubFile(FALSE, DIRDEL, FILEDEL, &nDIRDEL, &nFILEDEL, lp1); // if lp1 is dir + } else { + LogToMem(FILEDEL, &nFILEDEL, lp1); // if lp1 is file + } + } + } + + // We loop to the end, then we do an extra loop of lp2 use flag we previous made + for (lp2 = lpHead2; lp2 != NULL; lp2 = lp2->lpbrotherfile) { + nComparing++; + if (lp2->bfilematch == NOTMATCH) { + // We did not find a lp1 matches a lp2, so lp2 is added! + if (ISDIR(lp2->fileattr)) { + GetAllSubFile(FALSE, DIRADD, FILEADD, &nDIRADD, &nFILEADD, lp2); + } else { + LogToMem(FILEADD, &nFILEADD, lp2); + } + } + } + + // Progress bar update + if (nGettingFile != 0) + if (nComparing % nGettingFile > nFileStep) { + nComparing = 0; + SendDlgItemMessage(hWnd, IDC_PBCOMPARE, PBM_STEPIT, (WPARAM)0, (LPARAM)0); + } + +} + + +//------------------------------------------------------------- +// Routines to free all file tree +//------------------------------------------------------------- +VOID FreeAllFileContent(LPFILECONTENT lpFile) +{ + if (lpFile != NULL) { + FreeAllFileContent(lpFile->lpfirstsubfile); + FreeAllFileContent(lpFile->lpbrotherfile); + MYFREE(lpFile->lpfilename); + MYFREE(lpFile); + } +} + + +//------------------------------------------------------------- +// Routines to free head files +//------------------------------------------------------------- +VOID FreeAllFileHead(LPHEADFILE lp) +{ + if (lp != NULL) { + FreeAllFileHead(lp->lpnextheadfile); + FreeAllFileContent(lp->lpfilecontent); + //FreeAllFileContent(lp->lpfilecontent2); + MYFREE(lp); + } + +} + + +//-------------------------------------------------- +// File save engine (It is stupid again!) added in 1.8 +//-------------------------------------------------- +VOID SaveFileContent(LPFILECONTENT lpFileContent, DWORD nFPCurrentFatherFile, DWORD nFPCaller) +{ + + DWORD nFPTemp4Write; + DWORD nFPHeader; + DWORD nFPCurrent; + DWORD nLenPlus1; + int nPad; + + nLenPlus1 = (DWORD)strlen(lpFileContent->lpfilename) + 1; // Get len+1,this (dword) is for the writefile below. + nFPHeader = SetFilePointer(hFileWholeReg, 0, NULL, FILE_CURRENT); // Save head fp + // using struct, idea from maddes + sFC.fpos_filename = nFPHeader + sizeof(SAVEFILECONTENT); + sFC.writetimelow = lpFileContent->writetimelow; + sFC.writetimehigh = lpFileContent->writetimehigh; + sFC.filesizelow = lpFileContent->filesizelow; + sFC.filesizehigh = lpFileContent->filesizehigh; + sFC.fileattr = lpFileContent->fileattr; + sFC.cksum = lpFileContent->cksum; + sFC.fpos_firstsubfile = 0; //lpFileContent->lpfirstsubfile; + sFC.fpos_brotherfile = 0; //lpFileContent->lpbrotherfile; + sFC.fpos_fatherfile = nFPCurrentFatherFile; + sFC.bfilematch = 0; + WriteFile(hFileWholeReg, &sFC, sizeof(sFC), &NBW, NULL); + +/* + nFPTemp4Write = nFPHeader + sizeof(FILECONTENT); // + WriteFile(hFileWholeReg, &nFPTemp4Write, sizeof(nFPTemp4Write), &NBW, NULL); // Save the location of lpfilename + + WriteFile(hFileWholeReg, (LPBYTE)lpFileContent + sizeof(LPSTR), 6*sizeof(DWORD), &NBW, NULL); // Write time, size etc. 6*4 + + //nFPTemp4Write = (lpFileContent->lpfirstsubfile!=NULL) ? (nFPHeader + 41 + nLenPlus1) : 0; // We write lpfilename plus a "\0" + //WriteFile(hFileWholeReg,&nFPTemp4Write,4,&NBW,NULL); // Save the location of lpfirstsubfile + WriteFile(hFileWholeReg, (LPBYTE)lpFileContent + sizeof(LPSTR)+6*sizeof(DWORD), sizeof(LPFILECONTENT)*2, &NBW, NULL); // Save lpfirstsubfile and lpbrotherfile + WriteFile(hFileWholeReg, &nFPCurrentFatherFile, sizeof(nFPCurrentFatherFile), &NBW, NULL); // Save nFPCurrentFatherKey passed by caller + + lpFileContent->bfilematch=0; + WriteFile(hFileWholeReg, &(lpFileContent->bfilematch), sizeof(lpFileContent->bfilematch), &NBW, NULL); // Clear and save bfilematch +*/ + WriteFile(hFileWholeReg, lpFileContent->lpfilename, nLenPlus1, &NBW, NULL); // Save the current filename + + nPad = (nLenPlus1 % sizeof(DWORD) == 0) ? 0 : (sizeof(DWORD) - nLenPlus1 % sizeof(DWORD)); + + nFPTemp4Write = 0; + if (nPad > 0) { + WriteFile(hFileWholeReg, &nFPTemp4Write, nPad, &NBW, NULL); // Save the current filename + } + + if (lpFileContent->lpfirstsubfile != NULL) { + // pass this filecontent's position as subfile's fatherfile's position and pass the "lpfirstsubfile field" + SaveFileContent(lpFileContent->lpfirstsubfile, nFPHeader, nFPHeader + 7 * sizeof(DWORD)); + } + + if (lpFileContent->lpbrotherfile != NULL) { + // pass this file's fatherfile's position as brother's father and pass "lpbrotherfile field" + SaveFileContent(lpFileContent->lpbrotherfile, nFPCurrentFatherFile, nFPHeader + 8 * sizeof(DWORD)); + } + + if (nFPCaller > 0) { // save position of current file in current father file + nFPCurrent = SetFilePointer(hFileWholeReg, 0, NULL, FILE_CURRENT); + SetFilePointer(hFileWholeReg, nFPCaller, NULL, FILE_BEGIN); + WriteFile(hFileWholeReg, &nFPHeader, sizeof(nFPHeader), &NBW, NULL); + SetFilePointer(hFileWholeReg, nFPCurrent, NULL, FILE_BEGIN); + } + + // Need adjust progress bar para!! + nSavingFile++; + + if (nGettingFile != 0) + if (nSavingFile % nGettingFile > nFileStep) { + nSavingFile = 0; + SendDlgItemMessage(hWnd, IDC_PBCOMPARE, PBM_STEPIT, (WPARAM)0, (LPARAM)0); + UpdateWindow(hWnd); + PeekMessage(&msg, hWnd, WM_ACTIVATE, WM_ACTIVATE, PM_REMOVE); + } + + +} + + +#ifdef _WIN64 +//------------------------------------------------------------- +//Rebuild file snap from file buffer +//------------------------------------------------------------- +VOID RebuildFromHive_file(LPSAVEFILECONTENT lpFile, LPFILECONTENT lpFatherFC, LPFILECONTENT lpFC, LPBYTE lpHiveFileBase) +{ + LPFILECONTENT lpsubfile; + + if (lpFile->fpos_filename != 0) { + lpFC->lpfilename = (LPSTR)(lpHiveFileBase + lpFile->fpos_filename); + } + lpFC->writetimelow = lpFile->writetimelow; + lpFC->writetimehigh = lpFile->writetimehigh; + lpFC->filesizelow = lpFile->filesizelow; + lpFC->filesizehigh = lpFile->filesizehigh; + lpFC->fileattr = lpFile->fileattr; + lpFC->cksum = lpFile->cksum; + lpFC->lpfatherfile = lpFatherFC; + if (ISDIR(lpFC->fileattr)) { + nGettingDir++; + } else { + nGettingFile++; + } + + if (lpFile->fpos_firstsubfile != 0) { + lpsubfile = MYALLOC0(sizeof(FILECONTENT)); + lpFC->lpfirstsubfile = lpsubfile; + RebuildFromHive_file((LPSAVEFILECONTENT)(lpHiveFileBase + lpFile->fpos_firstsubfile), lpFC, lpsubfile, lpHiveFileBase); + } + + if (lpFile->fpos_brotherfile != 0) { + lpsubfile = MYALLOC0(sizeof(FILECONTENT)); + lpFC->lpbrotherfile = lpsubfile; + RebuildFromHive_file((LPSAVEFILECONTENT)(lpHiveFileBase + lpFile->fpos_brotherfile), lpFatherFC, lpsubfile, lpHiveFileBase); + } + + + nGettingTime = GetTickCount(); + if ((nGettingTime - nBASETIME1) > REFRESHINTERVAL) { + UpdateCounters(lan_dir, lan_file, nGettingDir, nGettingFile); + } + +} +//------------------------------------------------------------- +//Rebuild filehead from file buffer +//------------------------------------------------------------- +VOID RebuildFromHive_filehead(LPSAVEHEADFILE lpSHF, LPHEADFILE lpHeadFile, LPBYTE lpHiveFileBase) +{ + LPSAVEHEADFILE lpshf; + LPHEADFILE lpHF; + LPHEADFILE lpHFLast; + + for (lpshf = lpSHF, lpHF = lpHeadFile; lpHiveFileBase != (LPBYTE)lpshf; lpshf = (LPSAVEHEADFILE)(lpHiveFileBase + lpshf->fpos_nextheadfile)) { + + if (lpshf->fpos_filecontent != 0) { + lpHF->lpfilecontent = MYALLOC0(sizeof(FILECONTENT)); + RebuildFromHive_file((LPSAVEFILECONTENT)(lpHiveFileBase + lpshf->fpos_filecontent), NULL, lpHF->lpfilecontent, lpHiveFileBase); + } + if (lpshf->fpos_nextheadfile != 0) { + lpHF->lpnextheadfile = MYALLOC0(sizeof(HEADFILE)); + lpHFLast = lpHF; + lpHF = lpHF->lpnextheadfile; + } + + } +} + +#else +//-------------------------------------------------- +// Realign filecontent, called by ReAlignFile() +//-------------------------------------------------- +VOID ReAlignFileContent(LPFILECONTENT lpFC, size_t nBase) +{ + + if (lpFC->lpfilename != NULL) { + lpFC->lpfilename += nBase; + } + if (lpFC->lpfirstsubfile != NULL) { + lpFC->lpfirstsubfile = (LPFILECONTENT)((LPBYTE)lpFC->lpfirstsubfile + nBase); + } + if (lpFC->lpbrotherfile != NULL) { + lpFC->lpbrotherfile = (LPFILECONTENT)((LPBYTE)lpFC->lpbrotherfile + nBase); + } + if (lpFC->lpfatherfile != NULL) { + lpFC->lpfatherfile = (LPFILECONTENT)((LPBYTE)lpFC->lpfatherfile + nBase); + } + + + nGettingFile++; // just for the progress bar + + if (lpFC->lpfirstsubfile != NULL) { + ReAlignFileContent(lpFC->lpfirstsubfile, nBase); + } + + if (lpFC->lpbrotherfile != NULL) { + ReAlignFileContent(lpFC->lpbrotherfile, nBase); + } + +} + + +//-------------------------------------------------- +// Realign file, walk through chain +//-------------------------------------------------- +VOID ReAlignFile(LPHEADFILE lpHF, size_t nBase) +{ + LPHEADFILE lphf; + + for (lphf = lpHF; lphf != NULL; lphf = lphf->lpnextheadfile) { + + + if (lphf->lpnextheadfile != NULL) { + lphf->lpnextheadfile = (LPHEADFILE)((LPBYTE)lphf->lpnextheadfile + nBase); + } + if (lphf->lpfilecontent != NULL) { + lphf->lpfilecontent = (LPFILECONTENT)((LPBYTE)lphf->lpfilecontent + nBase); + ReAlignFileContent(lphf->lpfilecontent, nBase); + } + } +} + +#endif + +//-------------------------------------------------- +// Walkthrough lpHF and find lpname matches +//-------------------------------------------------- +LPFILECONTENT SearchDirChain(LPSTR lpname, LPHEADFILE lpHF) +{ + LPHEADFILE lphf; + + if (lpname != NULL) + for (lphf = lpHF; lphf != NULL; lphf = lphf->lpnextheadfile) { + if (lphf->lpfilecontent != NULL && lphf->lpfilecontent->lpfilename != NULL) + if (_stricmp(lpname, lphf->lpfilecontent->lpfilename) == 0) { + return lphf->lpfilecontent; + } + } + return NULL; +} + + +//-------------------------------------------------- +// Walkthrough lpheadfile chain and collect it's first dirname to lpDir +//-------------------------------------------------- +VOID FindDirChain(LPHEADFILE lpHF, LPSTR lpDir, size_t nMaxLen) +{ + size_t nLen; + LPHEADFILE lphf; + *lpDir = 0x00; + nLen = 0; + + for (lphf = lpHF; lphf != NULL; lphf = lphf->lpnextheadfile) { + if (lphf->lpfilecontent != NULL && nLen < nMaxLen) { + nLen += strlen(lphf->lpfilecontent->lpfilename) + 1; + strcat(lpDir, lphf->lpfilecontent->lpfilename); + strcat(lpDir, ";"); + } + } +} + + +//-------------------------------------------------- +// if two dir chains are the same +//-------------------------------------------------- +BOOL DirChainMatch(LPHEADFILE lphf1, LPHEADFILE lphf2) +{ + char lpDir1[EXTDIRLEN + 4]; + char lpDir2[EXTDIRLEN + 4]; + ZeroMemory(lpDir1, sizeof(lpDir1)); + ZeroMemory(lpDir2, sizeof(lpDir2)); + FindDirChain(lphf1, lpDir1, EXTDIRLEN); + FindDirChain(lphf2, lpDir2, EXTDIRLEN); + + if (_stricmp(lpDir1, lpDir2) != 0) { + return FALSE; + } else { + return TRUE; + } +} diff --git a/RegShot/src/global.h b/RegShot/src/global.h new file mode 100644 index 0000000..041bec0 --- /dev/null +++ b/RegShot/src/global.h @@ -0,0 +1,415 @@ +/* + Copyright 1999-2003,2007,2011 TiANWEi + Copyright 2004 tulipfan + + This file is part of Regshot. + + Regshot is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + Regshot is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Regshot; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#ifndef REGSHOT_GLOBAL_H +#define REGSHOT_GLOBAL_H + + +#ifdef __GNUC__ +#include +#endif +#include +#include +#include +#include "resource.h" + +#if defined(_MSC_VER) && (_MSC_VER < 1300) // before VS 2002 .NET (e.g. VS 6) +#define SetClassLongPtr SetClassLong +#ifndef GCLP_HICON +#define GCLP_HICON GCL_HICON +#endif +#if !defined(LONG_PTR) +typedef long LONG_PTR; +#endif +#endif // _MSC_VER + +// added in 1.8.2 to gain a slightly faster speed but it is danger! +#define USEHEAPALLOC_DANGER +//#define DEBUGLOG + +#ifdef USEHEAPALLOC_DANGER + +// MSDN doc say use HEAP_NO_SERIALIZE is not good for process heap :( so change fromm 1 to 0 20111216 ,slower than using 1 +#define MYALLOC(x) HeapAlloc(hHeap,0,x) +#define MYALLOC0(x) HeapAlloc(hHeap,8,x) // (HEAP_NO_SERIALIZE|) HEAP_ZERO_MEMORY ,1|8 +#define MYFREE(x) HeapFree(hHeap,0,x) + +#else + +#define MYALLOC(x) GlobalAlloc(GMEM_FIXED,x) +#define MYALLOC0(x) GlobalAlloc(GPTR,x) +#define MYFREE(x) GlobalFree(x) + +#endif + + +// Some definations +#define SIZEOF_REG_DWORD 4 // In current windows, reg_dword's size=4 +#define NOTMATCH 0 // Define modification type in comparison results +#define ISMATCH 1 +#define ISDEL 2 +#define ISADD 3 +#define ISMODI 4 + +#define KEYADD 1 +#define KEYDEL 2 +#define VALADD 3 +#define VALDEL 4 +#define VALMODI 5 +#define FILEADD 6 +#define FILEDEL 7 +#define FILEMODI 8 +#define DIRADD 9 +#define DIRDEL 10 +#define DIRMODI 11 + +#define ESTIMATE_VALUEDATA_LENGTH 1024*1024 //Define estimated value data in scan +#define REFRESHINTERVAL 110 // Define progress refresh rate +#define MAXPBPOSITION 100 // Define progress bar length +#define COMMENTLENGTH 50 // Define commentfield length on the MainForm +#define HTMLWRAPLENGTH 1000 // Define html out put wrap length +#define MAXAMOUNTOFFILE 10000 // Define out put file counts +#define EXTDIRLEN MAX_PATH * 4 // Define searching directory field length +#define COMPUTERNAMELEN 64 // Define COMPUTER name length,do not change +#define HIVEBEGINOFFSET 512 // Hive file out put header computerlen*2+sizeof(systemtime)+32 must 1) { + bRet = TRUE; + for (lp = lpSectionNames; *lp != 0; lp = lp + strlen(lp) + 1) { + if (_stricmp(lp, str_SectionCurrent) != 0) { + SendDlgItemMessage(hDlg, IDC_COMBOLANGUAGE, CB_ADDSTRING, (WPARAM)0, (LPARAM)lp); + } + } + GetPrivateProfileString(str_SectionCurrent, str_SectionCurrent, + str_DefaultLanguage, lpCurrentLanguage, 16, lpLanguageIni); + + nReturn = SendDlgItemMessage(hDlg, IDC_COMBOLANGUAGE, CB_FINDSTRINGEXACT, (WPARAM)0, (LPARAM)lpCurrentLanguage); + if (nReturn != CB_ERR) { + bRet = TRUE; + SendDlgItemMessage(hDlg, IDC_COMBOLANGUAGE, CB_SETCURSEL, (WPARAM)nReturn, (LPARAM)0); + } else { + bRet = FALSE; + } + + } else { + bRet = FALSE; + } + + MYFREE(lpSectionNames); + //MYFREE(lpCurrentLanguage); + return bRet; + +} + + +//-------------------------------------------------- +// Routines that show multi language +//-------------------------------------------------- +VOID GetDefaultStrings(VOID) +{ + //_asm int 3 + lan_key = lan_default[0]; + lan_value = lan_default[1]; + lan_dir = lan_default[2]; + lan_file = lan_default[3]; + lan_time = lan_default[4]; + lan_keyadd = lan_default[5]; + lan_keydel = lan_default[6]; + lan_valadd = lan_default[7]; + lan_valdel = lan_default[8]; + lan_valmodi = lan_default[9]; + lan_fileadd = lan_default[10]; + lan_filedel = lan_default[11]; + lan_filemodi = lan_default[12]; + lan_diradd = lan_default[13]; + lan_dirdel = lan_default[14]; + lan_dirmodi = lan_default[15]; + lan_total = lan_default[16]; + lan_comments = lan_default[17]; + lan_datetime = lan_default[18]; + lan_computer = lan_default[19]; + lan_username = lan_default[20]; + lan_about = lan_default[21]; + lan_error = lan_default[22]; + lan_errorexecviewer = lan_default[23]; + lan_errorcreatefile = lan_default[24]; + lan_erroropenfile = lan_default[25]; + lan_errormovefp = lan_default[26]; + lan_menushot = lan_default[40]; + lan_menushotsave = lan_default[41]; + lan_menuload = lan_default[42]; + lan_menuclearallshots = lan_default[43]; + lan_menuclearshot1 = lan_default[44]; + lan_menuclearshot2 = lan_default[45]; + +} + + +//-------------------------------------------------- +// Routines that show multi language +//-------------------------------------------------- +VOID PointToNewStrings(VOID) +{ + //LPDWORD lp = ldwTempStrings; + LPBYTE *lp = (LPBYTE *)lplpLangStrings; + + lan_key = *lp; + lp++; + lan_value = *lp; + lp++; + lan_dir = *lp; + lp++; + lan_file = *lp; + lp++; + lan_time = *lp; + lp++; + lan_keyadd = *lp; + lp++; + lan_keydel = *lp; + lp++; + lan_valadd = *lp; + lp++; + lan_valdel = *lp; + lp++; + lan_valmodi = *lp; + lp++; + lan_fileadd = *lp; + lp++; + lan_filedel = *lp; + lp++; + lan_filemodi = *lp; + lp++; + lan_diradd = *lp; + lp++; + lan_dirdel = *lp; + lp++; + lan_dirmodi = *lp; + lp++; + lan_total = *lp; + lp++; + lan_comments = *lp; + lp++; + lan_datetime = *lp; + lp++; + lan_computer = *lp; + lp++; + lan_username = *lp; + lp++; + lan_about = *lp; + lp++; + lan_error = *lp; + lp++; + lan_errorexecviewer = *lp; + lp++; + lan_errorcreatefile = *lp; + lp++; + lan_erroropenfile = *lp; + lp++; + lan_errormovefp = *lp; + lp += 14; + lan_menushot = *lp; + lp++; + lan_menushotsave = *lp; + lp++; + lan_menuload = *lp; + lp++; + lan_menuclearallshots = *lp; + lp++; + lan_menuclearshot1 = *lp; + lp++; + lan_menuclearshot2 = *lp; +} + + +//-------------------------------------------------- +// Routines that show multi language +//-------------------------------------------------- +BOOL GetLanguageStrings(HWND hDlg) +{ + LRESULT nIndex; + DWORD i; + BOOL bRet; + LPBYTE lpReturn; + //LPDWORD lp; + LPBYTE *lp; + char lpIniKey[16]; // 1.8.2 LPSTR lpIniKey = MYALLOC0(8); + + nIndex = SendDlgItemMessage(hDlg, IDC_COMBOLANGUAGE, CB_GETCURSEL, (WPARAM)0, (LPARAM)0); + if (nIndex != CB_ERR) { + + SendDlgItemMessage(hDlg, IDC_COMBOLANGUAGE, CB_GETLBTEXT, (WPARAM)nIndex, (LPARAM)lpCurrentLanguage); + WritePrivateProfileString(str_SectionCurrent, str_SectionCurrent, lpCurrentLanguage, lpLanguageIni); + ZeroMemory(lpLangStrings, SIZEOF_LANGSTRINGS); + GetPrivateProfileSection(lpCurrentLanguage, lpLangStrings, SIZEOF_LANGSTRINGS, lpLanguageIni); + for (i = 1, lp = (LPBYTE *)lplpLangStrings; i < 47; i++) { + + sprintf(lpIniKey, "%d%s", i, "="); + // pointer returned was pointed to char just after "=" + if ((lpReturn = AtPos((LPBYTE)lpLangStrings, (LPBYTE)lpIniKey, SIZEOF_LANGSTRINGS, strlen(lpIniKey))) != NULL) { + //_asm int 3; + //*(lp + i - 1) = (DWORD)lpReturn; + *(lp + i - 1) = lpReturn; + } else { + *(lp + i - 1) = lan_default[i - 1]; + } + + if (i >= 28 && i < 41 && i != 34) { + SetDlgItemText(hDlg, ID_BASE + 3 + i - 28, (LPSTR)(*(lp + i - 1))); + } + + } + + lpReturn = AtPos((LPBYTE)lpLangStrings, (LPBYTE)str_ItemTranslator, SIZEOF_LANGSTRINGS, strlen(str_ItemTranslator)); + lpCurrentTranslator = (lpReturn != NULL) ? ((LPSTR)lpReturn + 1) : str_Original; + PointToNewStrings(); + bRet = TRUE; + } else { + bRet = FALSE; + } + //MYFREE(lpCurrentLanguage); + //MYFREE(lpIniKey); + return bRet; +} diff --git a/RegShot/src/misc.c b/RegShot/src/misc.c new file mode 100644 index 0000000..e48696a --- /dev/null +++ b/RegShot/src/misc.c @@ -0,0 +1,143 @@ +/* + Copyright 1999-2003,2007 TiANWEi + + This file is part of Regshot. + + Regshot is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + Regshot is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Regshot; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "global.h" + +extern LPBYTE lan_error; + + +//------------------------------------------------------------- +// Show error message +//------------------------------------------------------------- +VOID ErrMsg(LPCSTR note) +{ + MessageBox(hWnd, note, (LPCSTR)lan_error, MB_ICONHAND); +} + + +//------------------------------------------------------------- +// Routine to debug +//------------------------------------------------------------- +#ifdef DEBUGLOG +extern char *str_CR; +extern u_char *lan_errorcreatefile; +extern u_char *lan_errormovefp; + +VOID DebugLog(LPSTR filename, LPSTR lpstr, HWND hDlg, BOOL bisCR) +{ + DWORD length; + DWORD nPos; + + hFile = CreateFile(filename, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + if (hFile == INVALID_HANDLE_VALUE) { + ErrMsg((LPCSTR)lan_errorcreatefile); + } else { + nPos = SetFilePointer(hFile, 0, NULL, FILE_END); + if (nPos == 0xFFFFFFFF) { + ErrMsg((LPCSTR)lan_errormovefp); + } else { + + length = strlen(lpstr); + WriteFile(hFile, lpstr, length, &NBW, NULL); + if (NBW != length) { + //ErrMsg(lan_errorwritefile); + } + if (bisCR == TRUE) { + WriteFile(hFile, str_CR, sizeof(str_CR) - 1, &NBW, NULL); + } + } + } + CloseHandle(hFile); +} +#endif + + +//------------------------------------------------------------ +// Routine to replace invalid chars in comment fields +//------------------------------------------------------------ +BOOL ReplaceInValidFileName(LPSTR lpf) +{ + char lpInvalid[] = "\\/:*?\"<>|"; // 1.8.2 + DWORD i, j; + size_t nLen; + BOOL bLegal = FALSE; + nLen = strlen(lpf); + + for (i = 0; i < nLen; i++) { + for (j = 0; j < sizeof(lpInvalid) - 1; j++) { // changed at 1.8.2 from 9 to sizeof()-1 + if (*(lpf + i) == *(lpInvalid + j)) { + *(lpf + i) = '-'; // 0x2D; check for invalid chars and replace it (return FALSE;) + } else if (*(lpf + i) != 0x20 && *(lpf + i) != 0x09) { // At least one non-space, non-tab char needed! + bLegal = TRUE; + } + + } + } + return bLegal; +} + + +//-------------------------------------------------- +// Find lp's position in lpMaster (like At(), but not limit to str) +// add sizep :the size of lp, not using strlen +//-------------------------------------------------- +LPBYTE AtPos(LPBYTE lpMaster, LPBYTE lp, size_t size, size_t sizep) +{ + DWORD i, j; + //size_t nsizelp; + //nsizelp = strlen(lp); + + if (size <= sizep || sizep < 1) { + return NULL; + } + + for (i = 0; i < size - sizep; i++) { + for (j = 0; j < sizep; j++) { + if (*(lp + j) != *(lpMaster + i + j)) { + break; + } + } + //_asm int 3; + if (j == sizep) { + return lpMaster + i + sizep; + } + } + return NULL; + +} + + +//------------------------------------------------------------- +// Once, I thought about using own memory allocation method +//------------------------------------------------------------- +/*LPVOID MyHeapAlloc(DWORD type, DWORD size) +{ + if ((bTurboMode == FALSE) && ((lpMyHeap + size) < (lpMyHeap + MYHEAPSIZE))) + { + lpMyHeap = lpMyHeap + size; + if (type == LPTR) + ZeroMemory(lpMyHeap,size); + } + else + { + lpMyHeap = GlobalAlloc(type,size); + } + return lpMyHeap; +}*/ diff --git a/RegShot/src/output.c b/RegShot/src/output.c new file mode 100644 index 0000000..a72caaf --- /dev/null +++ b/RegShot/src/output.c @@ -0,0 +1,179 @@ +/* + Copyright 1999-2003,2007,2011 TiANWEi + Copyright 2007 Belogorokhov Youri + + This file is part of Regshot. + + Regshot is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + Regshot is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Regshot; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "global.h" + + +// Some strings used to write to HTML or TEXT file, need [] to use with sizeof() +char str_CR[] = "\r\n"; // {0x0d,0x0a,0x00}; +char txt_line[] = "\r\n----------------------------------\r\n"; +char htm_BR[] = "
"; +char htm_HTMLbegin[] = "\r\n"; +char htm_HTMLover[] = ""; +char htm_HEADbegin[] = "\r\n"; +char htm_HEADover[] = "\r\n"; +char htm_Td1Begin[] = ""; +char htm_Td2Begin[] = ""; +char htm_Td1Over[] = "\r\n"; +char htm_Td2Over[] = "\r\n"; +// color idea got from HANDLE(Youri) at wgapatcher.ru :) 1.8 +char htm_style[] = "\r\n"; // 1.8.2 from e0e0e0 to e0f0e0 by Charles +char htm_BodyBegin[] = "\r\n"; +char htm_BodyOver[] = "\r\n"; +char htm_TableBegin[] = "\r\n"; +char htm_TableOver[] = "
\r\n"; +char htm_s1[] = ""; +char htm_s2[] = ""; +char htm_s3[] = "\r\n"; +//char htm_website[] = "Bug reports to:http://sourceforge.net/projects/regshot/"; + + +//------------------------------------------------------------ +// Several routines to write to output file +//------------------------------------------------------------ +VOID WriteHead(u_char *lpstr, DWORD count, BOOL isHTML) +{ + char lpcount[8]; + sprintf(lpcount, "%d", count); + + if (isHTML == TRUE) { + WriteFile(hFile, htm_BR, sizeof(htm_BR) - 1, &NBW, NULL); + WriteFile(hFile, htm_TableBegin, sizeof(htm_TableBegin) - 1, &NBW, NULL); + WriteFile(hFile, htm_Td1Begin, sizeof(htm_Td1Begin) - 1, &NBW, NULL); + } else { + WriteFile(hFile, txt_line, sizeof(txt_line) - 1, &NBW, NULL); + } + WriteFile(hFile, lpstr, (DWORD)strlen((LPSTR)lpstr), &NBW, NULL); + WriteFile(hFile, lpcount, (DWORD)strlen(lpcount), &NBW, NULL); + + if (isHTML == TRUE) { + WriteFile(hFile, htm_Td1Over, sizeof(htm_Td1Over) - 1, &NBW, NULL); + WriteFile(hFile, htm_TableOver, sizeof(htm_TableOver) - 1, &NBW, NULL); + } else { + WriteFile(hFile, txt_line, sizeof(txt_line) - 1, &NBW, NULL); + } +} + + +//------------------------------------------------------------ +VOID WritePart(LPCOMRESULT lpcomhead, BOOL isHTML, BOOL usecolor) +{ + DWORD i; + size_t n; + size_t nLen; + LPSTR lpstr; + LPCOMRESULT lp; + + if (isHTML) { + WriteFile(hFile, htm_TableBegin, sizeof(htm_TableBegin) - 1, &NBW, NULL); + WriteFile(hFile, htm_Td2Begin, sizeof(htm_Td2Begin) - 1, &NBW, NULL); + } + + for (i = 0, lp = lpcomhead; lp != NULL; i++, lp = lp->lpnextresult) { + nLen = strlen(lp->lpresult); + lpstr = lp->lpresult; + if (isHTML) { + // 1.8.0 + if (usecolor && i % 2 == 0) { + WriteFile(hFile, htm_s1, sizeof(htm_s1) - 1, &NBW, NULL); + } else { + WriteFile(hFile, htm_s2, sizeof(htm_s2) - 1, &NBW, NULL); + } + } + + for (n = 0; nLen > 0;) { + nLen < HTMLWRAPLENGTH ? (n = nLen) : (n = HTMLWRAPLENGTH); + + WriteFile(hFile, lpstr, (DWORD)n, &NBW, NULL); + lpstr = lpstr + n; + nLen = nLen - n; + //WriteFile(hFile,lp->lpresult,strlen(lp->lpresult),&NBW,NULL); + if (isHTML) { + WriteFile(hFile, htm_BR, sizeof(htm_BR) - 1, &NBW, NULL); + } + //else + // WriteFile(hFile,str_CR,sizeof(str_CR) - 1,&NBW,NULL); + // for some reason, txt doesn't wrap anymore since 1.50e, check below! + } + + if (isHTML) { + if (usecolor) { + WriteFile(hFile, htm_s3, sizeof(htm_s3) - 1, &NBW, NULL); + } + } else { + WriteFile(hFile, str_CR, sizeof(str_CR) - 1, &NBW, NULL); // this! + } + + + } + + if (isHTML) { + WriteFile(hFile, htm_Td2Over, sizeof(htm_Td2Over) - 1, &NBW, NULL); + WriteFile(hFile, htm_TableOver, sizeof(htm_TableOver) - 1, &NBW, NULL); + } + +} + + +//------------------------------------------------------------ +VOID WriteTitle(LPSTR lph, LPSTR lpb, BOOL isHTML) +{ + if (isHTML) { + WriteFile(hFile, htm_TableBegin, sizeof(htm_TableBegin) - 1, &NBW, NULL); + WriteFile(hFile, htm_Td1Begin, sizeof(htm_Td1Begin) - 1, &NBW, NULL); + } + WriteFile(hFile, lph, (DWORD)strlen(lph), &NBW, NULL); + WriteFile(hFile, lpb, (DWORD)strlen(lpb), &NBW, NULL); + + if (isHTML) { + WriteFile(hFile, htm_Td1Over, sizeof(htm_Td1Over) - 1, &NBW, NULL); + WriteFile(hFile, htm_TableOver, sizeof(htm_TableOver) - 1, &NBW, NULL); + } else { + WriteFile(hFile, str_CR, sizeof(str_CR) - 1, &NBW, NULL); + } +} + + +// 1.8.0 +VOID WriteHtmlbegin(void) +{ + WriteFile(hFile, htm_HTMLbegin, sizeof(htm_HTMLbegin) - 1, &NBW, NULL); + WriteFile(hFile, htm_HEADbegin, sizeof(htm_HEADbegin) - 1, &NBW, NULL); + WriteFile(hFile, htm_style, sizeof(htm_style) - 1, &NBW, NULL); + WriteFile(hFile, htm_HEADover, sizeof(htm_HEADover) - 1, &NBW, NULL); + WriteFile(hFile, htm_BodyBegin, sizeof(htm_BodyBegin) - 1, &NBW, NULL); +} + + +VOID WriteHtmlover(void) +{ + //WriteFile(hFile,htm_website,sizeof(htm_website) - 1,&NBW,NULL); // omit at 1.8 + WriteFile(hFile, htm_BodyOver, sizeof(htm_BodyOver) - 1, &NBW, NULL); + WriteFile(hFile, htm_HTMLover, sizeof(htm_HTMLover) - 1, &NBW, NULL); +} + + +VOID WriteHtmlbr(void) +{ + WriteFile(hFile, htm_BR, sizeof(htm_BR) - 1, &NBW, NULL); +} diff --git a/RegShot/src/regshot.c b/RegShot/src/regshot.c new file mode 100644 index 0000000..d43754b --- /dev/null +++ b/RegShot/src/regshot.c @@ -0,0 +1,1725 @@ +/* + Copyright 1999-2003,2007,2011 TiANWEi + Copyright 2004 tulipfan + Copyright 2011 maddes + + This file is part of Regshot. + + Regshot is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + Regshot is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Regshot; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "global.h" +#include "version.h" + +char str_DefResPre[] = REGSHOT_RESULT_FILE; +char str_filter[] = {"Regshot hive files [*.hiv]\0*.hiv\0All files\0*.*\0\0"}; +char str_RegshotHiveSignature[] = REGSHOT_HIVE_SIGNATURE; // Need [] to use with sizeof() must <12 +char str_ValueDataIsNULL[] = ": (NULL!)"; +SAVEKEYCONTENT sKC; +SAVEVALUECONTENT sVC; + + +extern LPBYTE lan_errorcreatefile; +extern LPBYTE lan_comments; +extern LPBYTE lan_datetime; +extern LPBYTE lan_computer; +extern LPBYTE lan_username; +extern LPBYTE lan_keydel; +extern LPBYTE lan_keyadd; +extern LPBYTE lan_valdel; +extern LPBYTE lan_valadd; +extern LPBYTE lan_valmodi; +extern LPBYTE lan_filedel; +extern LPBYTE lan_fileadd; +extern LPBYTE lan_filemodi; +extern LPBYTE lan_diradd; +extern LPBYTE lan_dirdel; +extern LPBYTE lan_dirmodi; +extern LPBYTE lan_total; +extern LPBYTE lan_key; +extern LPBYTE lan_value; +extern LPBYTE lan_dir; +extern LPBYTE lan_file; +extern LPBYTE lan_errorexecviewer; +extern LPBYTE lan_erroropenfile; + +extern char *str_prgname; // be careful of extern ref! Must be the same when declaring them, otherwise pointer would mis-point! +extern char str_CR[]; + + +//------------------------------------------------------------- +// Routine to get whole key name from KEYCONTENT +//------------------------------------------------------------- +LPSTR GetWholeKeyName(LPKEYCONTENT lpKeyContent) +{ + LPKEYCONTENT lpf; + LPSTR lpName; + LPSTR lptail; + size_t nLen = 0; + + for (lpf = lpKeyContent; lpf != NULL; lpf = lpf->lpfatherkey) { + nLen += strlen(lpf->lpkeyname) + 1; + } + if (nLen == 0) { + nLen++; + } + lpName = MYALLOC(nLen); + + lptail = lpName + nLen - 1; + *lptail = 0x00; + + for (lpf = lpKeyContent; lpf != NULL; lpf = lpf->lpfatherkey) { + nLen = strlen(lpf->lpkeyname); + memcpy(lptail -= nLen, lpf->lpkeyname, nLen); + if (lptail > lpName) { + *--lptail = '\\'; // 0x5c = '\\' + } + } + return lpName; +} + + +//------------------------------------------------------------- +// Routine to get whole value name from VALUECONTENT +//------------------------------------------------------------- +LPSTR GetWholeValueName(LPVALUECONTENT lpValueContent) +{ + LPKEYCONTENT lpf; + size_t nWholeLen; + size_t nLen; + LPSTR lpName; + LPSTR lptail; + + nLen = strlen(lpValueContent->lpvaluename); + nWholeLen = nLen + 1; + for (lpf = lpValueContent->lpfatherkey; lpf != NULL; lpf = lpf->lpfatherkey) { + nWholeLen += strlen(lpf->lpkeyname) + 1; + } + + lpName = MYALLOC(nWholeLen); + lptail = lpName + nWholeLen - 1; + + strcpy(lptail -= nLen, lpValueContent->lpvaluename); + *--lptail = '\\'; // 0x5c = '\\' + + for (lpf = lpValueContent->lpfatherkey; lpf != NULL; lpf = lpf->lpfatherkey) { + nLen = strlen(lpf->lpkeyname); + memcpy(lptail -= nLen, lpf->lpkeyname, nLen); + if (lptail > lpName) { + *--lptail = '\\'; // 0x5c = '\\' + } + } + return lpName; +} + + +//------------------------------------------------------------- +// Routine Trans VALUECONTENT.data[which in binary] into strings +// Called by GetWholeValueData() +//------------------------------------------------------------- +LPSTR TransData(LPVALUECONTENT lpValueContent, DWORD type) +{ + LPSTR lpvaluedata = NULL; + DWORD c; + DWORD size = lpValueContent->datasize; + + switch (type) { + + case REG_SZ: + // case REG_EXPAND_SZ: Not used any more, they all included in [default], + // because some non-regular value would corrupt this. + lpvaluedata = MYALLOC0(size + 5); // 5 is enough + strcpy(lpvaluedata, ": \""); + //if (lpValueContent->lpvaluedata != NULL) { + strcat(lpvaluedata, (const char *)lpValueContent->lpvaluedata); + //} + strcat(lpvaluedata, "\""); + // wsprintf has a bug that can not print string too long one time!); + //wsprintf(lpvaluedata,"%s%s%s",": \"",lpValueContent->lpvaluedata,"\""); + break; + case REG_MULTI_SZ: + // Be sure to add below line outside of following "if", + // for that GlobalFree(lp) must had lp already located! + lpvaluedata = MYALLOC0(size + 5); // 5 is enough + for (c = 0; c < size; c++) { + if (*((LPBYTE)(lpValueContent->lpvaluedata + c)) == 0) { + if (*((LPBYTE)(lpValueContent->lpvaluedata + c + 1)) != 0) { + *((LPBYTE)(lpValueContent->lpvaluedata + c)) = 0x20; // ??????? + } else { + break; + } + } + } + //*((LPBYTE)(lpValueContent->lpvaluedata + size)) = 0x00; // for some illegal multisz + strcpy(lpvaluedata, ": '"); + strcat(lpvaluedata, (const char *)lpValueContent->lpvaluedata); + strcat(lpvaluedata, "'"); + //wsprintf(lpvaluedata,"%s%s%s",": \"",lpValueContent->lpvaluedata,"\""); + break; + case REG_DWORD: + // case REG_DWORD_BIG_ENDIAN: Not used any more, they all included in [default] + lpvaluedata = MYALLOC0(SIZEOF_REG_DWORD * 2 + 5); // 13 is enough + sprintf(lpvaluedata, "%s%08X", ": 0x", *(LPDWORD)(lpValueContent->lpvaluedata)); + break; + default : + lpvaluedata = MYALLOC0(3 * (size + 1)); // 3*(size + 1) is enough + *lpvaluedata = 0x3a; + // for the resttype lengthofvaluedata doesn't contains the 0! + for (c = 0; c < size; c++) { + sprintf(lpvaluedata + 3 * c + 1, " %02X", *(lpValueContent->lpvaluedata + c)); + } + } + return lpvaluedata; +} + + +//------------------------------------------------------------- +// Routine to get whole value data from VALUECONTENT +//------------------------------------------------------------- +LPSTR GetWholeValueData(LPVALUECONTENT lpValueContent) +{ + LPSTR lpvaluedata = NULL; + DWORD c; + DWORD size = lpValueContent->datasize; + + if (lpValueContent->lpvaluedata != NULL) { //fix a bug at 20111228 + + switch (lpValueContent->typecode) { + case REG_SZ: + case REG_EXPAND_SZ: + //if (lpValueContent->lpvaluedata != NULL) { + if (size == (DWORD)strlen((const char *)(lpValueContent->lpvaluedata)) + 1) { + lpvaluedata = TransData(lpValueContent, REG_SZ); + } else { + lpvaluedata = TransData(lpValueContent, REG_BINARY); + } + //} else { + // lpvaluedata = TransData(lpValueContent, REG_SZ); + //} + break; + case REG_MULTI_SZ: + if (*((LPBYTE)(lpValueContent->lpvaluedata)) != 0x00) { + for (c = 0;; c++) { + if (*((LPWORD)(lpValueContent->lpvaluedata + c)) == 0) { + break; + } + } + if (size == c + 2) { + lpvaluedata = TransData(lpValueContent, REG_MULTI_SZ); + } else { + lpvaluedata = TransData(lpValueContent, REG_BINARY); + } + } else { + lpvaluedata = TransData(lpValueContent, REG_BINARY); + } + break; + case REG_DWORD: + case REG_DWORD_BIG_ENDIAN: + if (size == SIZEOF_REG_DWORD) { + lpvaluedata = TransData(lpValueContent, REG_DWORD); + } else { + lpvaluedata = TransData(lpValueContent, REG_BINARY); + } + break; + default : + lpvaluedata = TransData(lpValueContent, REG_BINARY); + } + } else { + lpvaluedata = MYALLOC0(sizeof(str_ValueDataIsNULL)); + strcpy(lpvaluedata, str_ValueDataIsNULL); + } + return lpvaluedata; +} + + +//------------------------------------------------------------- +// Routine to create new comparison result, distribute to different lp???MODI +//------------------------------------------------------------- +VOID CreateNewResult(DWORD actiontype, LPDWORD lpcount, LPSTR lpresult) +{ + LPCOMRESULT lpnew; + lpnew = (LPCOMRESULT)MYALLOC0(sizeof(COMRESULT)); + lpnew->lpresult = lpresult; + + switch (actiontype) { + case KEYADD: + *lpcount == 0 ? (lpKEYADDHEAD = lpnew) : (lpKEYADD->lpnextresult = lpnew); + lpKEYADD = lpnew; + break; + case KEYDEL: + *lpcount == 0 ? (lpKEYDELHEAD = lpnew) : (lpKEYDEL->lpnextresult = lpnew); + lpKEYDEL = lpnew; + break; + case VALADD: + *lpcount == 0 ? (lpVALADDHEAD = lpnew) : (lpVALADD->lpnextresult = lpnew); + lpVALADD = lpnew; + break; + case VALDEL: + *lpcount == 0 ? (lpVALDELHEAD = lpnew) : (lpVALDEL->lpnextresult = lpnew); + lpVALDEL = lpnew; + break; + case VALMODI: + *lpcount == 0 ? (lpVALMODIHEAD = lpnew) : (lpVALMODI->lpnextresult = lpnew); + lpVALMODI = lpnew; + break; + case FILEADD: + *lpcount == 0 ? (lpFILEADDHEAD = lpnew) : (lpFILEADD->lpnextresult = lpnew); + lpFILEADD = lpnew; + break; + case FILEDEL: + *lpcount == 0 ? (lpFILEDELHEAD = lpnew) : (lpFILEDEL->lpnextresult = lpnew); + lpFILEDEL = lpnew; + break; + case FILEMODI: + *lpcount == 0 ? (lpFILEMODIHEAD = lpnew) : (lpFILEMODI->lpnextresult = lpnew); + lpFILEMODI = lpnew; + break; + case DIRADD: + *lpcount == 0 ? (lpDIRADDHEAD = lpnew) : (lpDIRADD->lpnextresult = lpnew); + lpDIRADD = lpnew; + break; + case DIRDEL: + *lpcount == 0 ? (lpDIRDELHEAD = lpnew) : (lpDIRDEL->lpnextresult = lpnew); + lpDIRDEL = lpnew; + break; + case DIRMODI: + *lpcount == 0 ? (lpDIRMODIHEAD = lpnew) : (lpDIRMODI->lpnextresult = lpnew); + lpDIRMODI = lpnew; + break; + + } + (*lpcount)++; +} + + +//------------------------------------------------------------- +// Write comparison results into memory and call CreateNewResult() +//------------------------------------------------------------- +VOID LogToMem(DWORD actiontype, LPDWORD lpcount, LPVOID lp) +{ + LPSTR lpname; + LPSTR lpdata; + LPSTR lpall; + + if (actiontype == KEYADD || actiontype == KEYDEL) { + lpname = GetWholeKeyName(lp); + CreateNewResult(actiontype, lpcount, lpname); + } else { + if (actiontype == VALADD || actiontype == VALDEL || actiontype == VALMODI) { + + lpname = GetWholeValueName(lp); + lpdata = GetWholeValueData(lp); + lpall = MYALLOC(strlen(lpname) + strlen(lpdata) + 2); + // do not use:wsprintf(lpall,"%s%s",lpname,lpdata); !!! strlen limit! + strcpy(lpall, lpname); + strcat(lpall, lpdata); + MYFREE(lpname); + MYFREE(lpdata); + CreateNewResult(actiontype, lpcount, lpall); + } else { + lpname = GetWholeFileName(lp); + CreateNewResult(actiontype, lpcount, lpname); + } + + } +} + + +//------------------------------------------------------------- +// Routine to walk through sub keytree of current Key +//------------------------------------------------------------- +VOID GetAllSubName( + BOOL needbrother, + DWORD typekey, + DWORD typevalue, + LPDWORD lpcountkey, + LPDWORD lpcountvalue, + LPKEYCONTENT lpKeyContent +) +{ + + LPVALUECONTENT lpv; + LogToMem(typekey, lpcountkey, lpKeyContent); + + if (lpKeyContent->lpfirstsubkey != NULL) { + GetAllSubName(TRUE, typekey, typevalue, lpcountkey, lpcountvalue, lpKeyContent->lpfirstsubkey); + } + + if (needbrother == TRUE) + if (lpKeyContent->lpbrotherkey != NULL) { + GetAllSubName(TRUE, typekey, typevalue, lpcountkey, lpcountvalue, lpKeyContent->lpbrotherkey); + } + + for (lpv = lpKeyContent->lpfirstvalue; lpv != NULL; lpv = lpv->lpnextvalue) { + LogToMem(typevalue, lpcountvalue, lpv); + } +} + + +//------------------------------------------------------------- +// Routine to walk through all values of current key +//------------------------------------------------------------- +VOID GetAllValue(DWORD typevalue, LPDWORD lpcountvalue, LPKEYCONTENT lpKeyContent) +{ + LPVALUECONTENT lpv; + for (lpv = lpKeyContent->lpfirstvalue; lpv != NULL; lpv = lpv->lpnextvalue) { + LogToMem(typevalue, lpcountvalue, lpv); + } +} + + +//------------------------------------------------------------- +// Routine to free all comparison results (release memory) +//------------------------------------------------------------- +VOID FreeAllCom(LPCOMRESULT lpComResult) +{ + LPCOMRESULT lp; + LPCOMRESULT lpold; + + for (lp = lpComResult; lp != NULL;) { + if (lp->lpresult != NULL) { + MYFREE(lp->lpresult); + } + lpold = lp; + lp = lp->lpnextresult; + MYFREE(lpold); + } + +} + + +//------------------------------------------------------------- +// Routine to free all keys and values +//------------------------------------------------------------- +VOID FreeAllKey(LPKEYCONTENT lpKey) +{ + LPVALUECONTENT lpv; + LPVALUECONTENT lpvold; + + if (lpKey != NULL) { + FreeAllKey(lpKey->lpfirstsubkey); + FreeAllKey(lpKey->lpbrotherkey); + for (lpv = lpKey->lpfirstvalue; lpv != NULL;) { + MYFREE(lpv->lpvaluename); + if (lpv->lpvaluedata != NULL) { + MYFREE(lpv->lpvaluedata); + } + lpvold = lpv; + lpv = lpv->lpnextvalue; + MYFREE(lpvold); + } + MYFREE(lpKey->lpkeyname); + MYFREE(lpKey); + } + +} + +#ifdef _WIN64 +//------------------------------------------------------------- +//only for rebuild from hive,the name things remain in lptemphive +//------------------------------------------------------------- +VOID FreeAllKeyExceptNameValue(LPKEYCONTENT lpKey) +{ + LPVALUECONTENT lpv; + LPVALUECONTENT lpvold; + + if (lpKey != NULL) { + FreeAllKeyExceptNameValue(lpKey->lpfirstsubkey); + FreeAllKeyExceptNameValue(lpKey->lpbrotherkey); + for (lpv = lpKey->lpfirstvalue; lpv != NULL;) { + lpvold = lpv; + lpv = lpv->lpnextvalue; + MYFREE(lpvold); + } + MYFREE(lpKey); + } + +} + +#endif +//------------------------------------------------------------- +// Clear RegFlag previous made by comparison routine for the next comparison +//------------------------------------------------------------- +VOID ClearKeyMatchTag(LPKEYCONTENT lpKey) +{ + LPVALUECONTENT lpv; + + if (lpKey != NULL) { + lpKey->bkeymatch = 0; + for (lpv = lpKey->lpfirstvalue; lpv != NULL; lpv = lpv->lpnextvalue) { + lpv->bvaluematch = 0; + } + + //if (lpKey->lpfirstsubkey != NULL) // not used in 1.8 + { + ClearKeyMatchTag(lpKey->lpfirstsubkey); + } + + //if (lpKey->lpbrotherkey != NULL) // not used in 1.8 + { + ClearKeyMatchTag(lpKey->lpbrotherkey); + } + } +} + + +//------------------------------------------------------------- +// Clear Filematch Flag (core) +//------------------------------------------------------------- +VOID ClearFileContentMatchTag(LPFILECONTENT lpFC) +{ + if (lpFC != NULL) { + lpFC->bfilematch = 0; + //if (lpFC->lpfirstsubfile != NULL) + ClearFileContentMatchTag(lpFC->lpfirstsubfile); + //if (lpFC->lpbrotherfile != NULL) + ClearFileContentMatchTag(lpFC->lpbrotherfile); + } +} + + +//------------------------------------------------------------- +// Clear Filematch Flag previous made by comparison routine for the next comparison +//------------------------------------------------------------- +VOID ClearHeadFileMatchTag(LPHEADFILE lpHF) +{ + LPHEADFILE lphf; + + for (lphf = lpHF; lphf != NULL; lphf = lphf->lpnextheadfile) { + ClearFileContentMatchTag(lphf->lpfilecontent); + } +} + + +////////////////////////////////////// +VOID FreeAllKeyContent1(void) +{ + if (is1LoadFromHive) { +#ifdef _WIN64 + FreeAllKeyExceptNameValue(lpHeadLocalMachine1); + FreeAllKeyExceptNameValue(lpHeadUsers1); +#endif + MYFREE(lpTempHive1); // Note, together we free the filecontent! + lpTempHive1 = NULL; + lpHeadFile1 = NULL; // We add here + } else { + FreeAllKey(lpHeadLocalMachine1); + FreeAllKey(lpHeadUsers1); + } + lpHeadLocalMachine1 = NULL; + lpHeadUsers1 = NULL; + *lpComputerName1 = 0; + *lpUserName1 = 0; + +} + + +VOID FreeAllKeyContent2(void) +{ + if (is2LoadFromHive) { +#ifdef _WIN64 + FreeAllKeyExceptNameValue(lpHeadLocalMachine2); + FreeAllKeyExceptNameValue(lpHeadUsers2); +#endif + MYFREE(lpTempHive2); // Note, together we free the filecontent! + lpTempHive2 = NULL; + lpHeadFile2 = NULL; // We add here! + } else { + FreeAllKey(lpHeadLocalMachine2); + FreeAllKey(lpHeadUsers2); + } + lpHeadLocalMachine2 = NULL; + lpHeadUsers2 = NULL; + *lpComputerName2 = 0; + *lpUserName2 = 0; + +} + + +VOID FreeAllCompareResults(void) +{ + FreeAllCom(lpKEYADDHEAD); + FreeAllCom(lpKEYDELHEAD); + FreeAllCom(lpVALADDHEAD); + FreeAllCom(lpVALDELHEAD); + FreeAllCom(lpVALMODIHEAD); + FreeAllCom(lpFILEADDHEAD); + FreeAllCom(lpFILEDELHEAD); + FreeAllCom(lpFILEMODIHEAD); + FreeAllCom(lpDIRADDHEAD); + FreeAllCom(lpDIRDELHEAD); + FreeAllCom(lpDIRMODIHEAD); + + + nKEYADD = 0; + nKEYDEL = 0; + nVALADD = 0; + nVALDEL = 0; + nVALMODI = 0; + nFILEADD = 0; + nFILEDEL = 0; + nFILEMODI = 0; + nDIRADD = 0; + nDIRDEL = 0; + nDIRMODI = 0; + lpKEYADDHEAD = NULL; + lpKEYDELHEAD = NULL; + lpVALADDHEAD = NULL; + lpVALDELHEAD = NULL; + lpVALMODIHEAD = NULL; + lpFILEADDHEAD = NULL; + lpFILEDELHEAD = NULL; + lpFILEMODIHEAD = NULL; + lpDIRADDHEAD = NULL; + lpDIRDELHEAD = NULL; + lpDIRMODIHEAD = NULL; +} + + +//------------------------------------------------------------- +// Registry comparison engine +//------------------------------------------------------------- +VOID *CompareFirstSubKey(LPKEYCONTENT lpHead1, LPKEYCONTENT lpHead2) +{ + LPKEYCONTENT lp1; + LPKEYCONTENT lp2; + LPVALUECONTENT lpvalue1; + LPVALUECONTENT lpvalue2; + //DWORD i; + + for (lp1 = lpHead1; lp1 != NULL; lp1 = lp1->lpbrotherkey) { + for (lp2 = lpHead2; lp2 != NULL; lp2 = lp2->lpbrotherkey) { + if ((lp2->bkeymatch == NOTMATCH) && strcmp(lp1->lpkeyname, lp2->lpkeyname) == 0) { // 1.8.2 from lstrcmp to strcmp + // Same key found! We compare their values and their subkeys! + + lp2->bkeymatch = ISMATCH; + if (lp1->lpfirstvalue == NULL && lp2->lpfirstvalue != NULL) { + // Key1 has no values, so lpvalue2 is added! We find all values that belong to lp2! + GetAllValue(VALADD, &nVALADD, lp2); + } else { + if (lp1->lpfirstvalue != NULL && lp2->lpfirstvalue == NULL) { + // Key2 has no values, so lpvalue1 is deleted! We find all values that belong to lp1! + GetAllValue(VALDEL, &nVALDEL, lp1); + } else { + // Two keys all has values, so we loop them + + for (lpvalue1 = lp1->lpfirstvalue; lpvalue1 != NULL; lpvalue1 = lpvalue1->lpnextvalue) { + for (lpvalue2 = lp2->lpfirstvalue; lpvalue2 != NULL; lpvalue2 = lpvalue2->lpnextvalue) { + // Loop lp2 to find a value matchs lp1's + if ((lpvalue2->bvaluematch == NOTMATCH) && (lpvalue1->typecode == lpvalue2->typecode)) { + // Same valuedata type + if (strcmp(lpvalue1->lpvaluename, lpvalue2->lpvaluename) == 0) { // 1.8.2 from lstrcmp to strcmp + // Same valuename + if (lpvalue1->datasize == lpvalue2->datasize) { + // Same size of valuedata + /*for (i = 0; i < lpvalue1->datasize;i++) + { + if (*((lpvalue1->lpvaluedata) + i) != *((lpvalue2->lpvaluedata)+i)) + break; + } + if (i == lpvalue1->datasize)*/ + if (memcmp(lpvalue1->lpvaluedata, lpvalue2->lpvaluedata, lpvalue1->datasize) == 0) { // 1.8.2 + // Same valuedata, keys are the same! + + lpvalue2->bvaluematch = ISMATCH; + break; // Be sure not to do lp2 == NULL + } else { + // Valuedata not match due to data mismatch, we found a modified valuedata!***** + lpvalue2->bvaluematch = ISMODI; + LogToMem(VALMODI, &nVALMODI, lpvalue1); + LogToMem(VALMODI, &nVALMODI, lpvalue2); + nVALMODI--; + break; + } + } else { + // Valuedata does not match due to size, we found a modified valuedata!****** + lpvalue2->bvaluematch = ISMODI; + LogToMem(VALMODI, &nVALMODI, lpvalue1); + LogToMem(VALMODI, &nVALMODI, lpvalue2); + nVALMODI--; + break; + } + } + } + } + if (lpvalue2 == NULL) { + // We found a value in lp1 but not in lp2, we found a deleted value***** + LogToMem(VALDEL, &nVALDEL, lpvalue1); + } + } + // After we loop to end, we do extra loop use flag we previously made to get added values + for (lpvalue2 = lp2->lpfirstvalue; lpvalue2 != NULL; lpvalue2 = lpvalue2->lpnextvalue) { + if (lpvalue2->bvaluematch != ISMATCH && lpvalue2->bvaluematch != ISMODI) { + // We found a value in lp2's but not in lp1's ,we found a added value**** + LogToMem(VALADD, &nVALADD, lpvalue2); + + } + } + } + } + + ////////////////////////////////////////////////////////////// + // After we walk through the values above, we now try to loop the sub keys of current key + if (lp1->lpfirstsubkey == NULL && lp2->lpfirstsubkey != NULL) { + // lp2's firstsubkey added! + GetAllSubName(TRUE, KEYADD, VALADD, &nKEYADD, &nVALADD, lp2->lpfirstsubkey); + } + if (lp1->lpfirstsubkey != NULL && lp2->lpfirstsubkey == NULL) { + // lp1's firstsubkey deleted! + GetAllSubName(TRUE, KEYDEL, VALDEL, &nKEYDEL, &nVALDEL, lp1->lpfirstsubkey); + } + if (lp1->lpfirstsubkey != NULL && lp2->lpfirstsubkey != NULL) { + CompareFirstSubKey(lp1->lpfirstsubkey, lp2->lpfirstsubkey); + } + break; + } + } + if (lp2 == NULL) { + // We did not find a lp2 matches a lp1, so lp1 is deleted! + GetAllSubName(FALSE, KEYDEL, VALDEL, &nKEYDEL, &nVALDEL, lp1); + } + + } + + // After we loop to end, we do extra loop use flag we previously made to get added keys + for (lp2 = lpHead2; lp2 != NULL; lp2 = lp2->lpbrotherkey) { // ->lpbrotherkey + nComparing++; + if (lp2->bkeymatch == NOTMATCH) { + // We did not find a lp1 matches a lp2,so lp2 is added! + GetAllSubName(FALSE, KEYADD, VALADD, &nKEYADD, &nVALADD, lp2); + } + } + + // Progress bar update + if (nGettingKey != 0) + if (nComparing % nGettingKey > nRegStep) { + nComparing = 0; + SendDlgItemMessage(hWnd, IDC_PBCOMPARE, PBM_STEPIT, (WPARAM)0, (LPARAM)0); + } + + return NULL; +} + + +//------------------------------------------------------------ +// Routine to call registry/file comparison engine +//------------------------------------------------------------ +BOOL CompareShots(void) +{ + BOOL isHTML; + BOOL bshot2isnewer; + //BOOL bSaveWithCommentName; + LPSTR lpstrcomp; + LPSTR lpExt; + LPSTR lpDestFileName; + DWORD buffersize = 2048; + DWORD nTotal; + size_t nLengthofStr; + LPHEADFILE lphf1; + LPHEADFILE lphf2; + LPFILECONTENT lpfc1; + LPFILECONTENT lpfc2; + FILETIME ftime1; + FILETIME ftime2; + + + if (!DirChainMatch(lpHeadFile1, lpHeadFile2)) { + MessageBox(hWnd, "Found two shots with different DIR chain! (or with different order)\r\nYou can continue, but file comparison result would be abnormal!", "Warning", MB_ICONWARNING); + } + + InitProgressBar(); + + SystemTimeToFileTime(lpSystemtime1, &ftime1); + SystemTimeToFileTime(lpSystemtime2, &ftime2); + + bshot2isnewer = (CompareFileTime(&ftime1, &ftime2) <= 0) ? TRUE : FALSE; + if (bshot2isnewer) { + CompareFirstSubKey(lpHeadLocalMachine1, lpHeadLocalMachine2); + CompareFirstSubKey(lpHeadUsers1, lpHeadUsers2); + } else { + CompareFirstSubKey(lpHeadLocalMachine2, lpHeadLocalMachine1); + CompareFirstSubKey(lpHeadUsers2, lpHeadUsers1); + } + + SendDlgItemMessage(hWnd, IDC_PBCOMPARE, PBM_SETPOS, (WPARAM)0, (LPARAM)0); + + // Dir comparison v1.8.1 + // determine newer + if (bshot2isnewer) { + lphf1 = lpHeadFile1; + lphf2 = lpHeadFile2; + } else { + lphf1 = lpHeadFile2; + lphf2 = lpHeadFile1; + } + // first loop + for (; lphf1 != NULL; lphf1 = lphf1->lpnextheadfile) { + if (lphf1->lpfilecontent != NULL) { + lpfc1 = lphf1->lpfilecontent; + } else { + lpfc1 = NULL; + } + + if (lpfc1 != NULL) { + if ((lpfc2 = SearchDirChain(lpfc1->lpfilename, lphf2)) != NULL) { // note lphf2 should not changed here! + CompareFirstSubFile(lpfc1, lpfc2); // if found, we do compare + } else { // cannot find matched lpfc1 in lphf2 chain. + GetAllSubFile(FALSE, DIRDEL, FILEDEL, &nDIRDEL, &nFILEDEL, lpfc1); + } + } + } + // reset pointers + if (bshot2isnewer) { + lphf1 = lpHeadFile1; + lphf2 = lpHeadFile2; + } else { + lphf1 = lpHeadFile2; + lphf2 = lpHeadFile1; + } + // second loop + for (; lphf2 != NULL; lphf2 = lphf2->lpnextheadfile) { + if (lphf2->lpfilecontent != NULL) { + lpfc2 = lphf2->lpfilecontent; + } else { + lpfc2 = NULL; + } + if (lpfc2 != NULL) { + if ((lpfc1 = SearchDirChain(lpfc2->lpfilename, lphf1)) == NULL) { // in the second loop we only find those do not match + GetAllSubFile(FALSE, DIRADD, FILEADD, &nDIRADD, &nFILEADD, lpfc2); + } + } + } + /* silly one used in 1.8.0 + for (lphf1 = lpHeadFile1,lphf2 = lpHeadFile2;;) + { + // Normally, two lphf should run parallel, otherwise something abnormal should happen :( + if (lphf1 != NULL && lphf1->lpfilecontent != NULL) + lpfc1 = lphf1->lpfilecontent; + else + lpfc1 = NULL; + if (lphf2 != NULL && lphf2->lpfilecontent != NULL) + lpfc2 = lphf2->lpfilecontent; + else + lpfc2 = NULL; + if (lpfc1 == NULL && lpfc2 == NULL) + break; + if (bshot2isnewer) + CompareFirstSubFile(lpfc1,lpfc2); + else + CompareFirstSubFile(lpfc2,lpfc1); + + if (lphf1 != NULL) + lphf1 = lphf1->lpnextheadfile; + if (lphf2 != NULL) + lphf2 = lphf2->lpnextheadfile; + + } + */ + SendDlgItemMessage(hWnd, IDC_PBCOMPARE, PBM_SETPOS, (WPARAM)MAXPBPOSITION, (LPARAM)0); + + if (SendMessage(GetDlgItem(hWnd, IDC_RADIO1), BM_GETCHECK, (WPARAM)0, (LPARAM)0) == 1) { + isHTML = FALSE; + lpExt = ".txt"; + } else { + isHTML = TRUE; + lpExt = ".htm"; + } + + lpDestFileName = MYALLOC0(MAX_PATH * 4 + 4); + lpstrcomp = MYALLOC0(buffersize); // buffersize must> commentlength+10 .txt 0000 + GetDlgItemText(hWnd, IDC_EDITCOMMENT, lpstrcomp, COMMENTLENGTH); + GetDlgItemText(hWnd, IDC_EDITPATH, lpOutputpath, MAX_PATH); + + nLengthofStr = strlen(lpOutputpath); + + if (nLengthofStr > 0 && *(lpOutputpath + nLengthofStr - 1) != '\\') { + *(lpOutputpath + nLengthofStr) = '\\'; + *(lpOutputpath + nLengthofStr + 1) = 0x00; // bug found by "itschy" 1.61d->1.61e + nLengthofStr++; + } + strcpy(lpDestFileName, lpOutputpath); + + //bSaveWithCommentName = TRUE; + if (ReplaceInValidFileName(lpstrcomp)) { + strcat(lpDestFileName, lpstrcomp); + } else { + strcat(lpDestFileName, str_DefResPre); + } + + nLengthofStr = strlen(lpDestFileName); + strcat(lpDestFileName, lpExt); + hFile = CreateFile(lpDestFileName, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL); + if (hFile == INVALID_HANDLE_VALUE) { + DWORD filetail = 0; + + for (filetail = 0; filetail < MAXAMOUNTOFFILE; filetail++) { + sprintf(lpDestFileName + nLengthofStr, "_%04d", filetail); + //*(lpDestFileName+nLengthofStr + 5) = 0x00; + strcpy(lpDestFileName + nLengthofStr + 5, lpExt); + + hFile = CreateFile(lpDestFileName, GENERIC_READ | GENERIC_WRITE, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, CREATE_NEW, FILE_ATTRIBUTE_NORMAL, NULL); + if (hFile == INVALID_HANDLE_VALUE) { + if (GetLastError() == ERROR_FILE_EXISTS) { // My God! I use stupid ERROR_ALREADY_EXISTS first!! + continue; + } else { + ErrMsg((LPCSTR)lan_errorcreatefile); + return FALSE; + } + } else { + break; + } + } + if (filetail >= MAXAMOUNTOFFILE) { + ErrMsg((LPCSTR)lan_errorcreatefile); + return FALSE; + } + + } + + if (isHTML == TRUE) { + WriteHtmlbegin(); + } + + WriteFile(hFile, str_prgname, (DWORD)strlen(str_prgname), &NBW, NULL); + WriteFile(hFile, str_CR, (DWORD)strlen(str_CR), &NBW, NULL); + + //_asm int 3; + GetDlgItemText(hWnd, IDC_EDITCOMMENT, lpstrcomp, COMMENTLENGTH); + WriteTitle((LPSTR)lan_comments, lpstrcomp, isHTML); + + + sprintf(lpstrcomp, "%d%s%d%s%d %02d%s%02d%s%02d %s %d%s%d%s%d %02d%s%02d%s%02d", + lpSystemtime1->wYear, "/", + lpSystemtime1->wMonth, "/", + lpSystemtime1->wDay, + lpSystemtime1->wHour, ":", + lpSystemtime1->wMinute, ":", + lpSystemtime1->wSecond, " , ", + lpSystemtime2->wYear, "/", + lpSystemtime2->wMonth, "/", + lpSystemtime2->wDay, + lpSystemtime2->wHour, ":", + lpSystemtime2->wMinute, ":", + lpSystemtime2->wSecond + + ); + + WriteTitle((LPSTR)lan_datetime, lpstrcomp, isHTML); + + + *lpstrcomp = 0x00; //ZeroMemory(lpstrcomp,buffersize); + //GetComputerName(lpstrcomp,&buffersize); + strcpy(lpstrcomp, lpComputerName1); + strcat(lpstrcomp, " , "); + strcat(lpstrcomp, lpComputerName2); + WriteTitle((LPSTR)lan_computer, lpstrcomp, isHTML); + + *lpstrcomp = 0x00; //ZeroMemory(lpstrcomp,buffersize); + //GetUserName(lpstrcomp,&buffersize); + strcpy(lpstrcomp, lpUserName1); + strcat(lpstrcomp, " , "); + strcat(lpstrcomp, lpUserName2); + + WriteTitle((LPSTR)lan_username, lpstrcomp, isHTML); + + MYFREE(lpstrcomp); + + // Write keydel part + if (nKEYDEL != 0) { + WriteHead(lan_keydel, nKEYDEL, isHTML); + WritePart(lpKEYDELHEAD, isHTML, FALSE); + } + // Write keyadd part + if (nKEYADD != 0) { + WriteHead(lan_keyadd, nKEYADD, isHTML); + WritePart(lpKEYADDHEAD, isHTML, FALSE); + } + // Write valdel part + if (nVALDEL != 0) { + WriteHead(lan_valdel, nVALDEL, isHTML); + WritePart(lpVALDELHEAD, isHTML, FALSE); + } + // Write valadd part + if (nVALADD != 0) { + WriteHead(lan_valadd, nVALADD, isHTML); + WritePart(lpVALADDHEAD, isHTML, FALSE); + } + // Write valmodi part + if (nVALMODI != 0) { + WriteHead(lan_valmodi, nVALMODI, isHTML); + WritePart(lpVALMODIHEAD, isHTML, TRUE); + } + // Write file add part + if (nFILEADD != 0) { + WriteHead(lan_fileadd, nFILEADD, isHTML); + WritePart(lpFILEADDHEAD, isHTML, FALSE); + } + // Write file del part + if (nFILEDEL != 0) { + WriteHead(lan_filedel, nFILEDEL, isHTML); + WritePart(lpFILEDELHEAD, isHTML, FALSE); + } + // Write file modi part + if (nFILEMODI != 0) { + WriteHead(lan_filemodi, nFILEMODI, isHTML); + WritePart(lpFILEMODIHEAD, isHTML, FALSE); + } + // Write directory add part + if (nDIRADD != 0) { + WriteHead(lan_diradd, nDIRADD, isHTML); + WritePart(lpDIRADDHEAD, isHTML, FALSE); + } + // Write directory del part + if (nDIRDEL != 0) { + WriteHead(lan_dirdel, nDIRDEL, isHTML); + WritePart(lpDIRDELHEAD, isHTML, FALSE); + } + // Write directory modi part + if (nDIRMODI != 0) { + WriteHead(lan_dirmodi, nDIRMODI, isHTML); + WritePart(lpDIRMODIHEAD, isHTML, FALSE); + } + + nTotal = nKEYADD + nKEYDEL + nVALADD + nVALDEL + nVALMODI + nFILEADD + nFILEDEL + nFILEMODI + nDIRADD + nDIRDEL + nDIRMODI; + if (isHTML == TRUE) { + WriteHtmlbr(); + } + WriteHead(lan_total, nTotal, isHTML); + if (isHTML == TRUE) { + WriteHtmlover(); + } + + + CloseHandle(hFile); + + if ((size_t)ShellExecute(hWnd, "open", lpDestFileName, NULL, NULL, SW_SHOW) <= 32) { + ErrMsg((LPCSTR)lan_errorexecviewer); + } + MYFREE(lpDestFileName); + + + return TRUE; +} + + +//------------------------------------------------------------ +// Registry shot engine +//------------------------------------------------------------ +VOID GetRegistrySnap(HKEY hkey, LPKEYCONTENT lpFatherKeyContent) +{ + + HKEY Subhkey; + DWORD i; + DWORD NTr; + DWORD TypeCode; + DWORD LengthOfKeyName; + DWORD LengthOfValueName; + DWORD LengthOfValueData; + DWORD LengthOfLongestValueName; + DWORD LengthOfLongestValueData; + DWORD LengthOfLongestSubkeyName; + //LPSTR lpValueName; + //LPBYTE lpValueData; + LPKEYCONTENT lpKeyContent; + LPVALUECONTENT lpValueContent; + LPKEYCONTENT lpKeyContentLast; + LPVALUECONTENT lpValueContentLast; + + lpKeyContentLast = NULL; + lpValueContentLast = NULL; + + // To detemine MAX length + if (RegQueryInfoKey( + hkey, + NULL, // lpClassName_nouse, + NULL, // &nClassName_nouse_length, + NULL, + NULL, // &NumberOfSubkeys, + &LengthOfLongestSubkeyName, // chars + NULL, // &nClassName_nouse_longestlength, + NULL, // &NumberOfValue, + &LengthOfLongestValueName, // chars + &LengthOfLongestValueData, // bytes + NULL, // &nSecurity_length_nouse, + NULL // &ftLastWrite + ) != ERROR_SUCCESS) { + return ; + } + //Comment out in beta1V5 20120102, v4 modified these to *4 +4 ,which is not right + //But not so sure to use global and pass chars, because once several years ago,in win2000,I encounter some problem. + //LengthOfLongestSubkeyName = LengthOfLongestSubkeyName * 2 + 3; // msdn says it is in unicode characters,right now maybe not large than that.old version use *2+3 + //LengthOfLongestValueName = LengthOfLongestValueName * 2 + 3; + LengthOfLongestSubkeyName = LengthOfLongestSubkeyName + 1; + LengthOfLongestValueName = LengthOfLongestValueName + 1; + LengthOfLongestValueData = LengthOfLongestValueData + 1; //use +1 maybe too careful. but since the real memory allocate is based on return of another call,it is just be here. + if (LengthOfLongestValueData >= ESTIMATE_VALUEDATA_LENGTH) { + lpValueDataS= lpValueData; + lpValueData = MYALLOC(LengthOfLongestValueData); + } + //lpValueName = MYALLOC(LengthOfLongestValueName); + + + // Get Values + for (i = 0;; i++) { + + *(LPBYTE)lpValueName = (BYTE)0x00; // That's the bug in 2000! thanks zhangl@digiark.com! + *(LPBYTE)lpValueData = (BYTE)0x00; + //DebugBreak(); + LengthOfValueName = LengthOfLongestValueName; + LengthOfValueData = LengthOfLongestValueData; + NTr = RegEnumValue(hkey, i, lpValueName, &LengthOfValueName, NULL, &TypeCode, lpValueData, &LengthOfValueData); + if (NTr == ERROR_NO_MORE_ITEMS) { + break; + } else { + if (NTr != ERROR_SUCCESS) { + continue; + } + } + +#ifdef DEBUGLOG + DebugLog("debug_trytogetvalue.log", "trying:", hWnd, FALSE); + DebugLog("debug_trytogetvalue.log", lpValueName, hWnd, TRUE); +#endif + + lpValueContent = MYALLOC0(sizeof(VALUECONTENT)); + // I had done if (i == 0) in 1.50b- ! thanks fisttk@21cn.com and non-standard + //if (lpFatherKeyContent->lpfirstvalue == NULL) { + if (lpValueContentLast == NULL) { + lpFatherKeyContent->lpfirstvalue = lpValueContent; + } else { + lpValueContentLast->lpnextvalue = lpValueContent; + } + lpValueContentLast = lpValueContent; + lpValueContent->typecode = TypeCode; + lpValueContent->datasize = LengthOfValueData; + lpValueContent->lpfatherkey = lpFatherKeyContent; + lpValueContent->lpvaluename = MYALLOC(strlen(lpValueName) + 1); + strcpy(lpValueContent->lpvaluename, lpValueName); + + if (LengthOfValueData != 0) { + lpValueContent->lpvaluedata = MYALLOC(LengthOfValueData); + CopyMemory(lpValueContent->lpvaluedata, lpValueData, LengthOfValueData); + //*(lpValueContent->lpvaluedata + LengthOfValueData) = 0x00; + } + nGettingValue++; + +#ifdef DEBUGLOG + lstrdb1 = MYALLOC0(100); + sprintf(lstrdb1, "LGVN:%08d LGVD:%08d VN:%08d VD:%08d", LengthOfLongestValueName, LengthOfLongestValueData, LengthOfValueName, LengthOfValueData); + DebugLog("debug_valuenamedata.log", lstrdb1, hWnd, TRUE); + DebugLog("debug_valuenamedata.log", GetWholeValueName(lpValueContent), hWnd, FALSE); + DebugLog("debug_valuenamedata.log", GetWholeValueData(lpValueContent), hWnd, TRUE); + //DebugLog("debug_valuenamedata.log",":",hWnd,FALSE); + //DebugLog("debug_valuenamedata.log",lpValueData,hWnd,TRUE); + MYFREE(lstrdb1); + +#endif + } + + //MYFREE(lpValueName); + if (LengthOfLongestValueData >= ESTIMATE_VALUEDATA_LENGTH) { + MYFREE(lpValueData); + lpValueData= lpValueDataS; + } + + + for (i = 0;; i++) { + LengthOfKeyName = LengthOfLongestSubkeyName; + *(LPBYTE)lpKeyName = (BYTE)0x00; + NTr = RegEnumKeyEx(hkey, i, lpKeyName, &LengthOfKeyName, NULL, NULL, NULL, &ftLastWrite); + if (NTr == ERROR_NO_MORE_ITEMS) { + break; + } else { + if (NTr != ERROR_SUCCESS) { + continue; + } + } + lpKeyContent = MYALLOC0(sizeof(KEYCONTENT)); + //if (lpFatherKeyContent->lpfirstsubkey == NULL) { + if (lpKeyContentLast == NULL) { + lpFatherKeyContent->lpfirstsubkey = lpKeyContent; + } else { + lpKeyContentLast->lpbrotherkey = lpKeyContent; + } + lpKeyContentLast = lpKeyContent; + lpKeyContent->lpkeyname = MYALLOC(strlen(lpKeyName) + 1); + strcpy(lpKeyContent->lpkeyname, lpKeyName); + lpKeyContent->lpfatherkey = lpFatherKeyContent; + //DebugLog("debug_getkey.log",lpKeyName,hWnd,TRUE); + +#ifdef DEBUGLOG + lstrdb1 = MYALLOC0(100); + sprintf(lstrdb1, "LGKN:%08d KN:%08d", LengthOfLongestSubkeyName, LengthOfKeyName); + DebugLog("debug_key.log", lstrdb1, hWnd, TRUE); + DebugLog("debug_key.log", GetWholeKeyName(lpKeyContent), hWnd, TRUE); + MYFREE(lstrdb1); + +#endif + + nGettingKey++; + + if (RegOpenKeyEx(hkey, lpKeyName, 0, KEY_QUERY_VALUE | KEY_ENUMERATE_SUB_KEYS, &Subhkey) != ERROR_SUCCESS) { + continue; + } + if (IsInSkipList(lpKeyName, lplpRegSkipStrings)) { + // tfx + RegCloseKey(Subhkey); // 1.8.2 seperate + continue; + } + + GetRegistrySnap(Subhkey, lpKeyContent); + RegCloseKey(Subhkey); + } + + nGettingTime = GetTickCount(); + if ((nGettingTime - nBASETIME1) > REFRESHINTERVAL) { + UpdateCounters(lan_key, lan_value, nGettingKey, nGettingValue); + } + + + return ; +} + + +//-------------------------------------------------- +// Registry save engine +//-------------------------------------------------- +VOID SaveRegKey(LPKEYCONTENT lpKeyContent, DWORD nFPCurrentFatherKey, DWORD nFPCaller) +{ + DWORD nFPTemp4Write; + DWORD nFPHeader; + DWORD nFPCurrent; + DWORD nLenPlus1; + INT nPad; + INT nPad1; + LPVALUECONTENT lpv; + + // Note use (DWORD) to disable warning of lost of data to convert size_t to dword, in current windows,it is safe that registry's xxxxname is stay in DWORD long + nLenPlus1 = (DWORD)strlen(lpKeyContent->lpkeyname) + 1; // Get len+1 + nPad = (nLenPlus1 % sizeof(DWORD) == 0) ? 0 : (sizeof(DWORD) - nLenPlus1 % sizeof(DWORD)); + nFPHeader = SetFilePointer(hFileWholeReg, 0, NULL, FILE_CURRENT); // Save head fp + + // using struct ,idea from maddes + sKC.fpos_keyname = nFPHeader + sizeof(SAVEKEYCONTENT); + sKC.fpos_firstvalue = (lpKeyContent->lpfirstvalue != NULL) ? (nFPHeader + sizeof(SAVEKEYCONTENT) + nLenPlus1 + nPad) : 0; + sKC.fpos_firstsubkey = 0; // it is filled later. + sKC.fpos_brotherkey = 0; // it is filled later + sKC.fpos_fatherkey = nFPCurrentFatherKey; + sKC.bkeymatch = 0; + WriteFile(hFileWholeReg, &sKC, sizeof(sKC), &NBW, NULL); + +/* + nFPTemp4Write = nFPHeader + sizeof(KEYCONTENT); + WriteFile(hFileWholeReg, &nFPTemp4Write, sizeof(nFPTemp4Write), &NBW, NULL); // Save the location of lpkeyname + + nPad = (nLenPlus1 % sizeof(int) == 0) ? 0 : ( sizeof(int) - nLenPlus1 % sizeof(int) ); + nFPTemp4Write = (lpKeyContent->lpfirstvalue != NULL) ? (nFPHeader + sizeof(KEYCONTENT) + nLenPlus1 + nPad) : 0; + WriteFile(hFileWholeReg, &nFPTemp4Write, sizeof(nFPTemp4Write), &NBW, NULL); // Save the location of lpfirstvalue + + WriteFile(hFileWholeReg, (LPBYTE)lpKeyContent + sizeof(LPSTR)+sizeof(LPVALUECONTENT), sizeof(LPKEYCONTENT)*2, &NBW, NULL); // Save lpfirstsubkey and lpbrotherkey + WriteFile(hFileWholeReg, &nFPCurrentFatherKey, sizeof(nFPCurrentFatherKey), &NBW, NULL); // Save nFPCurrentFatherKey passed by caller + + lpKeyContent->bkeymatch=0; + WriteFile(hFileWholeReg, &(lpKeyContent->bkeymatch), sizeof(lpKeyContent->bkeymatch), &NBW, NULL); // Clear and save bkeymatch +*/ + WriteFile(hFileWholeReg, lpKeyContent->lpkeyname, nLenPlus1, &NBW, NULL); // Save the current keyname + + nFPTemp4Write = 0; + if (nPad > 0) { + WriteFile(hFileWholeReg, &nFPTemp4Write, nPad, &NBW, NULL); + } + + + + // Save the sub-value of current KeyContent + for (lpv = lpKeyContent->lpfirstvalue; lpv != NULL; lpv = lpv->lpnextvalue) { + + nLenPlus1 = (DWORD)strlen(lpv->lpvaluename) + 1; + nPad = (nLenPlus1 % sizeof(DWORD) == 0) ? 0 : (sizeof(DWORD) - nLenPlus1 % sizeof(DWORD)); + nPad1 = (lpv->datasize % sizeof(DWORD) == 0) ? 0 : (sizeof(DWORD) - lpv->datasize % sizeof(DWORD)); + + nFPCurrent = SetFilePointer(hFileWholeReg, 0, NULL, FILE_CURRENT); // Save fp + sVC.typecode = lpv->typecode; + sVC.datasize = lpv->datasize; + sVC.fpos_valuename = nFPCurrent + sizeof(SAVEVALUECONTENT); + sVC.fpos_valuedata = (lpv->datasize > 0) ? (nFPCurrent + sizeof(SAVEVALUECONTENT) + nLenPlus1 + nPad) : 0; // if no lpvaluedata, we write 0 + sVC.fpos_nextvalue = (lpv->lpnextvalue != NULL) ? (nFPCurrent + sizeof(SAVEVALUECONTENT) + nLenPlus1 + nPad + lpv->datasize + nPad1) : 0; // if no nextvalue we write 0 + sVC.fpos_fatherkey = nFPHeader; + sVC.bvaluematch = 0; + WriteFile(hFileWholeReg, &sVC, sizeof(sVC), &NBW, NULL); + +/* + WriteFile(hFileWholeReg, (LPBYTE)lpv, sizeof(DWORD)*2, &NBW, NULL); + + nFPTemp4Write = nFPCurrent + sizeof(VALUECONTENT); + WriteFile(hFileWholeReg, &nFPTemp4Write, sizeof(nFPTemp4Write), &NBW, NULL); // Save location of lpvaluename + + nPad = (nLenPlus1 % sizeof(int) == 0) ? 0 : (sizeof(int) - nLenPlus1 % sizeof(int)); // determine if pad to 4bytes is needed + nFPTemp4Write = (lpv->datasize > 0) ? (nFPCurrent + sizeof(VALUECONTENT) + nLenPlus1 + nPad) : 0; // if no lpvaluedata, we write 0 + WriteFile(hFileWholeReg, &nFPTemp4Write, sizeof(nFPTemp4Write), &NBW, NULL); // Save location of lpvaluedata + + nPad1 = (lpv->datasize % sizeof(int) == 0) ? 0 : (sizeof(int) - lpv->datasize % sizeof(int)); + nFPTemp4Write = (lpv->lpnextvalue != NULL) ? (nFPCurrent + sizeof(VALUECONTENT) + nLenPlus1 + nPad + lpv->datasize + nPad1) : 0; // if no nextvalue we write 0 + WriteFile(hFileWholeReg, &nFPTemp4Write, sizeof(nFPTemp4Write), &NBW, NULL); // Save location of next subvalue + + nFPTemp4Write = nFPHeader; + WriteFile(hFileWholeReg, &nFPTemp4Write, sizeof(nFPTemp4Write), &NBW, NULL); // Save location of current key + + lpv->bvaluematch=0; + WriteFile(hFileWholeReg, &(lpv->bvaluematch), sizeof(lpv->bvaluematch), &NBW, NULL); // Clear and save bvaluematch +*/ + WriteFile(hFileWholeReg, lpv->lpvaluename, nLenPlus1, &NBW, NULL); // Save lpvaluename + + nFPTemp4Write = 0; + if (nPad > 0) { + WriteFile(hFileWholeReg, &nFPTemp4Write, nPad, &NBW, NULL); + } + + if (lpv->datasize > 0) { + WriteFile(hFileWholeReg, lpv->lpvaluedata, lpv->datasize, &NBW, NULL); // Save lpvaluedata + + if (nPad1 > 0) { + WriteFile(hFileWholeReg, &nFPTemp4Write, nPad1, &NBW, NULL); + } + } + + + } + + if (lpKeyContent->lpfirstsubkey != NULL) { + // pass this keycontent's position as subkey's fatherkey's position and pass the "lpfirstsubkey field" + SaveRegKey(lpKeyContent->lpfirstsubkey, nFPHeader, nFPHeader + 2 * sizeof(DWORD)); + } + + if (lpKeyContent->lpbrotherkey != NULL) { + // pass this key's fatherkey's position as brother's father and pass "lpbrotherkey field" + SaveRegKey(lpKeyContent->lpbrotherkey, nFPCurrentFatherKey, nFPHeader + 3 * sizeof(DWORD)); + } + + if (nFPCaller > 0) { // save position of current key in current father key + nFPCurrent = SetFilePointer(hFileWholeReg, 0, NULL, FILE_CURRENT); + SetFilePointer(hFileWholeReg, nFPCaller, NULL, FILE_BEGIN); + WriteFile(hFileWholeReg, &nFPHeader, sizeof(nFPHeader), &NBW, NULL); + SetFilePointer(hFileWholeReg, nFPCurrent, NULL, FILE_BEGIN); + } + + nSavingKey++; + if (nGettingKey != 0) + if (nSavingKey % nGettingKey > nRegStep) { + nSavingKey = 0; + SendDlgItemMessage(hWnd, IDC_PBCOMPARE, PBM_STEPIT, (WPARAM)0, (LPARAM)0); + UpdateWindow(hWnd); + PeekMessage(&msg, hWnd, WM_ACTIVATE, WM_ACTIVATE, PM_REMOVE); + } + +} + + +//-------------------------------------------------- +// Routine to call registry save engine and file save engine +//-------------------------------------------------- +VOID SaveHive(LPKEYCONTENT lpKeyHLM, LPKEYCONTENT lpKeyUSER, + LPHEADFILE lpHF, LPSTR computer, LPSTR user, LPVOID time) +{ + DWORD nFPcurrent; + DWORD nFPcurrent1; + LPHEADFILE lphf; + HIVEHEADER hiveheader; + SAVEHEADFILE sh; + + if (lpKeyHLM != NULL || lpKeyUSER != NULL) { + + opfn.lStructSize = sizeof(opfn); + opfn.hwndOwner = hWnd; + opfn.lpstrFilter = str_filter; + opfn.lpstrFile = MYALLOC0(MAX_PATH *2 + 2); + opfn.nMaxFile = MAX_PATH; + opfn.lpstrInitialDir = lpLastSaveDir; + opfn.lpstrDefExt = "hiv"; + opfn.Flags = OFN_OVERWRITEPROMPT | OFN_HIDEREADONLY; + if (GetSaveFileName(&opfn)) { + hFileWholeReg = CreateFile(opfn.lpstrFile, GENERIC_WRITE, 0, NULL, CREATE_ALWAYS, FILE_ATTRIBUTE_NORMAL, NULL); + if (hFileWholeReg != INVALID_HANDLE_VALUE) { + + UI_BeforeClear(); + InitProgressBar(); + + //WriteFile(hFileWholeReg, str_RegshotHiveSignature, sizeof(str_RegshotHiveSignature) - 1, &NBW, NULL); // save lpvaluedata + + // 0 signature( <= 12) last 4 bytes may be used in furture + // 16 startoflpkeyhlm (512) + // 20 startoflpkeyuser(???) + // 24 fileheadchain begin (new) ->(file -> nextfilehead(4) next4bytes is filecontent) added in 1.8 + // 28 future use! + // 32 computer name + // 96 username + // 160 systemtime + + ZeroMemory(&hiveheader, sizeof(hiveheader)); + // Save the position of H_L_M + hiveheader.offsetkeyhklm = HIVEBEGINOFFSET; + + SetFilePointer(hFileWholeReg, HIVEBEGINOFFSET, NULL, FILE_BEGIN); + if (lpKeyHLM != NULL) { //always + SaveRegKey(lpKeyHLM, 0, 0); + } + + // Save the position of hkeyUsr + nFPcurrent = SetFilePointer(hFileWholeReg, 0, NULL, FILE_CURRENT); + hiveheader.offsetkeyuser = nFPcurrent; + + if (lpKeyUSER != NULL) { //always + SaveRegKey(lpKeyUSER, 0, 0); + } + + if (lpHF != NULL) { + // Write start position of file chain + nFPcurrent = SetFilePointer(hFileWholeReg, 0, NULL, FILE_CURRENT); + hiveheader.offsetheadfile = nFPcurrent; + + + for (lphf = lpHF; lphf != NULL;) { + + nFPcurrent = SetFilePointer(hFileWholeReg, 0, NULL, FILE_CURRENT); // save place for next filehead in chain + sh.fpos_filecontent = nFPcurrent + sizeof(sh.fpos_nextheadfile) + sizeof(sh.fpos_filecontent); + + SetFilePointer(hFileWholeReg, sizeof(sh), NULL, FILE_CURRENT); + + SaveFileContent(lphf->lpfilecontent, 0, 0); + + nFPcurrent1 = SetFilePointer(hFileWholeReg, 0, NULL, FILE_CURRENT); + lphf = lphf->lpnextheadfile; + sh.fpos_nextheadfile = (lphf != NULL) ? nFPcurrent1 : 0; + SetFilePointer(hFileWholeReg, nFPcurrent , NULL, FILE_BEGIN); + WriteFile(hFileWholeReg, &sh, sizeof(sh), &NBW, NULL); + if (lphf == NULL) { + break; + } + + SetFilePointer(hFileWholeReg, nFPcurrent1, NULL, FILE_BEGIN); + } + } + + + + + CopyMemory(hiveheader.signature, str_RegshotHiveSignature, sizeof(str_RegshotHiveSignature) - 1); + CopyMemory(hiveheader.computername, computer, strlen(computer)); + CopyMemory(hiveheader.username, user, strlen(user)); + CopyMemory(&hiveheader.systemtime, time, sizeof(SYSTEMTIME)); + + SetFilePointer(hFileWholeReg, 0 , NULL, FILE_BEGIN); + + WriteFile(hFileWholeReg, &hiveheader, sizeof(hiveheader), &NBW, NULL); + + ShowWindow(GetDlgItem(hWnd, IDC_PBCOMPARE), SW_HIDE); + + SetCursor(hSaveCursor); + MessageBeep(0xffffffff); + CloseHandle(hFileWholeReg); + } else { + ErrMsg((LPCSTR)lan_errorcreatefile); + } + + } + *(opfn.lpstrFile + opfn.nFileOffset) = 0x00; + strcpy(lpLastSaveDir, opfn.lpstrFile); + MYFREE(opfn.lpstrFile); + } +} +#ifdef _WIN64 +//------------------------------------------------------------- +//Rebuild registry snap from file buffer +//------------------------------------------------------------- +VOID RebuildFromHive_reg(LPSAVEKEYCONTENT lpFile, LPKEYCONTENT lpFatherkey, LPKEYCONTENT lpKey, LPBYTE lpHiveFileBase) +{ + LPVALUECONTENT lpValue; + LPVALUECONTENT lpValueLast; + LPSAVEVALUECONTENT lpv; + LPKEYCONTENT lpsubkey; + + lpValueLast = NULL; + + if (lpFile->fpos_keyname != 0) { + lpKey->lpkeyname = (LPSTR)(lpHiveFileBase + lpFile->fpos_keyname); + } + lpKey->lpfatherkey = lpFatherkey; + + nGettingKey++; + + for (lpv = (LPSAVEVALUECONTENT)(lpHiveFileBase + lpFile->fpos_firstvalue); lpHiveFileBase != (LPBYTE)lpv ; lpv = (LPSAVEVALUECONTENT)(lpHiveFileBase + lpv->fpos_nextvalue)) { + lpValue = MYALLOC0(sizeof(VALUECONTENT)); + if (lpValueLast != NULL) { + lpValueLast->lpnextvalue = lpValue; + } else { + lpKey->lpfirstvalue = lpValue; + } + + lpValue->typecode = lpv->typecode; + lpValue->datasize = lpv->datasize; + if (lpv->fpos_valuename != 0) { + lpValue->lpvaluename = (LPSTR)(lpHiveFileBase + lpv->fpos_valuename); + } + if (lpv->fpos_valuedata != 0) { + lpValue->lpvaluedata = lpHiveFileBase + lpv->fpos_valuedata; + } + + lpValue->lpfatherkey = lpKey; + lpValueLast = lpValue; + + nGettingValue++; + } + + + if (lpFile->fpos_firstsubkey != 0) { + lpsubkey = MYALLOC0(sizeof(KEYCONTENT)); + lpKey->lpfirstsubkey = lpsubkey; + RebuildFromHive_reg((LPSAVEKEYCONTENT)(lpHiveFileBase + lpFile->fpos_firstsubkey), lpKey, lpsubkey, lpHiveFileBase); + } + + if (lpFile->fpos_brotherkey != 0) { + lpsubkey = MYALLOC0(sizeof(KEYCONTENT)); + lpKey->lpbrotherkey = lpsubkey; + RebuildFromHive_reg((LPSAVEKEYCONTENT)(lpHiveFileBase + lpFile->fpos_brotherkey), lpKey, lpsubkey, lpHiveFileBase); + } + nGettingTime = GetTickCount(); + if ((nGettingTime - nBASETIME1) > REFRESHINTERVAL) { + UpdateCounters(lan_key, lan_value, nGettingKey, nGettingValue); + } + +} + +#else + + +//-------------------------------------------------- +// Realign key & value content after loading from hive file +//-------------------------------------------------- +VOID ReAlignReg(LPKEYCONTENT lpKey, size_t nBase) +{ + LPVALUECONTENT lpv; + + if (lpKey->lpkeyname != NULL) { + lpKey->lpkeyname += nBase; + } + if (lpKey->lpfirstvalue != NULL) { + lpKey->lpfirstvalue = (LPVALUECONTENT)((LPBYTE)lpKey->lpfirstvalue + nBase); + } + if (lpKey->lpfirstsubkey != NULL) { + lpKey->lpfirstsubkey = (LPKEYCONTENT)((LPBYTE)lpKey->lpfirstsubkey + nBase); + } + if (lpKey->lpbrotherkey != NULL) { + lpKey->lpbrotherkey = (LPKEYCONTENT)((LPBYTE)lpKey->lpbrotherkey + nBase); + } + if (lpKey->lpfatherkey != NULL) { + lpKey->lpfatherkey = (LPKEYCONTENT)((LPBYTE)lpKey->lpfatherkey + nBase); + } + + nGettingKey++; + + for (lpv = lpKey->lpfirstvalue; lpv != NULL; lpv = lpv->lpnextvalue) { + + if (lpv->lpvaluename != NULL) { + lpv->lpvaluename += nBase; + } + if (lpv->lpvaluedata != NULL) { + lpv->lpvaluedata += nBase; + } + if (lpv->lpnextvalue != NULL) { + lpv->lpnextvalue = (LPVALUECONTENT)((LPBYTE)lpv->lpnextvalue + nBase); + } + if (lpv->lpfatherkey != NULL) { + lpv->lpfatherkey = (LPKEYCONTENT)((LPBYTE)lpv->lpfatherkey + nBase); + } + + } + + if (lpKey->lpfirstsubkey != NULL) { + ReAlignReg(lpKey->lpfirstsubkey, nBase); + } + + if (lpKey->lpbrotherkey != NULL) { + ReAlignReg(lpKey->lpbrotherkey, nBase); + } +} +#endif + + +//--------------------------------------------------------------------------------- +// Load registry from HIVE file (After this, we should realign the data in memory) +//--------------------------------------------------------------------------------- +BOOL LoadHive(LPKEYCONTENT FAR *lplpKeyHLM, LPKEYCONTENT FAR *lplpKeyUSER, + LPHEADFILE FAR *lplpHeadFile, LPBYTE FAR *lpHive) +{ + DWORD nFileSize; + size_t nBase; + DWORD i, j; + DWORD nRemain; + DWORD nReadSize; + HIVEHEADER hiveheader; + char sname[MAX_PATH*2 + 2]; + + ZeroMemory(sname, sizeof(sname)); + + opfn.lStructSize = sizeof(opfn); + opfn.hwndOwner = hWnd; + opfn.lpstrFilter = str_filter; + opfn.lpstrFile = sname; + opfn.nMaxFile = MAX_PATH; + opfn.lpstrInitialDir = lpLastOpenDir; + opfn.Flags = OFN_FILEMUSTEXIST | OFN_HIDEREADONLY; + opfn.lpstrDefExt = "hiv"; + if (!GetOpenFileName(&opfn)) { + return FALSE; + } + hFileWholeReg = CreateFile(opfn.lpstrFile, GENERIC_READ , FILE_SHARE_READ , NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + if (hFileWholeReg == INVALID_HANDLE_VALUE) { + ErrMsg((LPCSTR)lan_erroropenfile); + return FALSE; + } + nFileSize = GetFileSize(hFileWholeReg, NULL); + if (nFileSize < sizeof(HIVEHEADER)) { + CloseHandle(hFileWholeReg); + ErrMsg((LPCSTR)"wrong filesize"); + return FALSE; + } + + ZeroMemory(&hiveheader, sizeof(HIVEHEADER)); + ReadFile(hFileWholeReg, &hiveheader, sizeof(HIVEHEADER), &NBW, NULL); + + + if (strcmp(str_RegshotHiveSignature, (const char *)(hiveheader.signature)) != 0) { + CloseHandle(hFileWholeReg); + ErrMsg((LPCSTR)"It is not a compatible hive to current version or it is not a valid Regshot hive file!"); + return FALSE; + } + //May add some check here + + + nGettingKey = 0; + nGettingFile = 0; + if (is1) { + UI_BeforeShot(IDC_1STSHOT); + } else { + UI_BeforeShot(IDC_2NDSHOT); + } + + *lpHive = MYALLOC(nFileSize); + + SetFilePointer(hFileWholeReg, 0, NULL, FILE_BEGIN); + + InitProgressBar(); +#define READ_BATCH_SIZE 8192 + nFileStep = nFileSize / READ_BATCH_SIZE / MAXPBPOSITION; + + for (i = 0, j = 0, nRemain = nFileSize;; i += READ_BATCH_SIZE, j++) { + if (nRemain >= READ_BATCH_SIZE) { + nReadSize = READ_BATCH_SIZE; + } else { + nReadSize = nRemain; + } + // Crash bug made in 1.8.0 tianwei, fixed in 1.8.1 tianwei + ReadFile(hFileWholeReg, (*lpHive) + i, nReadSize, &NBW, NULL); // read the whole file now + if (NBW != nReadSize) { + CloseHandle(hFileWholeReg); + ErrMsg((LPCSTR)"Reading ERROR!"); + return FALSE; + } + nRemain -= nReadSize; + if (nRemain == 0) { + break; + } + if (j % (nFileSize / READ_BATCH_SIZE) > nFileStep) { + j = 0; + SendDlgItemMessage(hWnd, IDC_PBCOMPARE, PBM_STEPIT, (WPARAM)0, (LPARAM)0); + UpdateWindow(hWnd); + PeekMessage(&msg, hWnd, WM_ACTIVATE, WM_ACTIVATE, PM_REMOVE); + } + } +#undef READ_BATCH_SIZE + ShowWindow(GetDlgItem(hWnd, IDC_PBCOMPARE), SW_HIDE); + + nBase = (size_t) * lpHive; + *lplpKeyHLM = (LPKEYCONTENT)(nBase + hiveheader.offsetkeyhklm); + *lplpKeyUSER = (LPKEYCONTENT)(nBase + hiveheader.offsetkeyuser); + *lplpHeadFile = (hiveheader.offsetheadfile == 0) ? NULL : (LPHEADFILE)(nBase + hiveheader.offsetheadfile); + +#ifdef _WIN64 + nGettingKey = 2; + nGettingValue = 0; + nGettingTime = 0; + nGettingFile = 0; + nGettingDir = 0; + nBASETIME = GetTickCount(); + nBASETIME1 = nBASETIME; + if (is1) { + UI_BeforeShot(IDC_1STSHOT); + } else { + UI_BeforeShot(IDC_2NDSHOT); + } + + *lplpKeyHLM = MYALLOC0(sizeof(KEYCONTENT)); + *lplpKeyUSER = MYALLOC0(sizeof(KEYCONTENT)); + RebuildFromHive_reg((LPSAVEKEYCONTENT)(nBase + hiveheader.offsetkeyhklm), NULL, *lplpKeyHLM , *lpHive); + RebuildFromHive_reg((LPSAVEKEYCONTENT)(nBase + hiveheader.offsetkeyuser), NULL, *lplpKeyUSER , *lpHive); + nGettingTime = GetTickCount(); + UpdateCounters(lan_key, lan_value, nGettingKey, nGettingValue); + +#else + ReAlignReg(*lplpKeyHLM, nBase); + ReAlignReg(*lplpKeyUSER, nBase); +#endif + + + if (*lplpHeadFile != NULL) { + SendMessage(GetDlgItem(hWnd, IDC_CHECKDIR), BM_SETCHECK, (WPARAM)BST_CHECKED, (LPARAM)0); + SendMessage(hWnd, WM_COMMAND, (WPARAM)IDC_CHECKDIR, (LPARAM)0); +#ifdef _WIN64 + *lplpHeadFile = MYALLOC0(sizeof(HEADFILE)); + RebuildFromHive_filehead((LPSAVEHEADFILE)(nBase + hiveheader.offsetheadfile), *lplpHeadFile, *lpHive); + nGettingTime = GetTickCount(); + UpdateCounters(lan_dir, lan_file, nGettingDir, nGettingFile); +#else + ReAlignFile(*lplpHeadFile, nBase); +#endif + FindDirChain(*lplpHeadFile, lpExtDir, EXTDIRLEN); // Get new chains, must do this after ReAlignFile! + SetDlgItemText(hWnd, IDC_EDITDIR, lpExtDir); + } else { + SetDlgItemText(hWnd, IDC_EDITDIR, ""); + } + + + if (is1) { + // Use copymemory in 1.8, old version direct point to, which is wrong + CopyMemory(lpComputerName1, hiveheader.computername, COMPUTERNAMELEN); + CopyMemory(lpUserName1, hiveheader.username, COMPUTERNAMELEN); + CopyMemory(lpSystemtime1, &hiveheader.systemtime, sizeof(SYSTEMTIME)); + } else { + CopyMemory(lpComputerName2, hiveheader.computername, COMPUTERNAMELEN); + CopyMemory(lpUserName2, hiveheader.username, COMPUTERNAMELEN); + CopyMemory(lpSystemtime2, &hiveheader.systemtime, sizeof(SYSTEMTIME)); + } + + UI_AfterShot(); + + CloseHandle(hFileWholeReg); + + *(opfn.lpstrFile + opfn.nFileOffset) = 0x00; + strcpy(lpLastOpenDir, opfn.lpstrFile); + + + return TRUE; + +} diff --git a/RegShot/src/regshot.rc b/RegShot/src/regshot.rc new file mode 100644 index 0000000..3fbad61 --- /dev/null +++ b/RegShot/src/regshot.rc @@ -0,0 +1,177 @@ +// Microsoft Visual C++ generated resource script. +// +#include "resource.h" +#include "version.h" + +#define APSTUDIO_READONLY_SYMBOLS +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 2 resource. +// +#include + +///////////////////////////////////////////////////////////////////////////// +#undef APSTUDIO_READONLY_SYMBOLS + +///////////////////////////////////////////////////////////////////////////// +// English (United States) resources + +#if !defined(AFX_RESOURCE_DLL) || defined(AFX_TARG_ENU) +LANGUAGE LANG_ENGLISH, SUBLANG_ENGLISH_US +#pragma code_page(1252) + +///////////////////////////////////////////////////////////////////////////// +// +// Dialog +// + +IDD_DIALOG1 DIALOGEX 0, 0, 194, 166 +STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | DS_CENTER | WS_MINIMIZEBOX | WS_POPUP | WS_CAPTION | WS_SYSMENU +EXSTYLE WS_EX_APPWINDOW +CAPTION REGSHOT_TITLE +FONT 8, "MS Shell Dlg", 0, 0, 0x1 +BEGIN + DEFPUSHBUTTON "&1st shot",IDC_1STSHOT,137,10,49,13 + PUSHBUTTON "&2nd shot",IDC_2NDSHOT,137,27,49,13,WS_DISABLED + PUSHBUTTON "C&ompare",IDC_COMPARE,137,45,49,13,WS_DISABLED + PUSHBUTTON "&Clear",IDC_CLEAR1,137,63,49,13,WS_DISABLED + PUSHBUTTON "&Quit",IDC_CANCEL1,137,81,49,13 + PUSHBUTTON "&About",IDC_ABOUT,137,99,49,13 + COMBOBOX IDC_COMBOLANGUAGE,137,134,50,55,CBS_DROPDOWNLIST | CBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP + CONTROL "Plain &TXT",IDC_RADIO1,"Button",BS_AUTORADIOBUTTON,11,19,46,10 + CONTROL "&HTML document",IDC_RADIO2,"Button",BS_AUTORADIOBUTTON,60,19,71,10 + CONTROL "&Scan dir1[;dir2;dir3;...;dir nn]:",IDC_CHECKDIR,"Button",BS_AUTOCHECKBOX | BS_MULTILINE | WS_TABSTOP,11,45,120,10 + EDITTEXT IDC_EDITDIR,11,58,94,14,ES_AUTOHSCROLL + PUSHBUTTON "...",IDC_BROWSE1,108,58,18,13 + EDITTEXT IDC_EDITPATH,12,94,94,14,ES_AUTOHSCROLL + PUSHBUTTON "...",IDC_BROWSE2,108,95,18,13 + EDITTEXT IDC_EDITCOMMENT,11,128,114,14,ES_AUTOHSCROLL + LTEXT "",IDC_TEXTCOUNT1,8,153,54,8,NOT WS_VISIBLE + LTEXT "",IDC_TEXTCOUNT2,69,153,59,8,NOT WS_VISIBLE + LTEXT "",IDC_TEXTCOUNT3,134,153,55,8,NOT WS_VISIBLE + GROUPBOX "Compare logs save as:",IDC_STATICSAVEFORMAT,6,7,125,27 + GROUPBOX "",IDC_STATIC,6,37,125,40 + GROUPBOX "Output path:",IDC_STATICOUTPUTPATH,6,82,125,31 + GROUPBOX "Add comment into the log:",IDC_STATICADDCOMMENT,6,117,125,31 + CONTROL "Progress1",IDC_PBCOMPARE,"msctls_progress32",NOT WS_VISIBLE | WS_BORDER,7,153,180,9 +END + + +///////////////////////////////////////////////////////////////////////////// +// +// DESIGNINFO +// + +#ifdef APSTUDIO_INVOKED +GUIDELINES DESIGNINFO +BEGIN + IDD_DIALOG1, DIALOG + BEGIN + LEFTMARGIN, 7 + RIGHTMARGIN, 187 + VERTGUIDE, 11 + VERTGUIDE, 131 + VERTGUIDE, 137 + VERTGUIDE, 186 + TOPMARGIN, 7 + BOTTOMMARGIN, 163 + END +END +#endif // APSTUDIO_INVOKED + + +#ifdef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// TEXTINCLUDE +// + +1 TEXTINCLUDE +BEGIN + "resource.h\0" +END + +2 TEXTINCLUDE +BEGIN + "#include ""afxres.h""\r\n" + "\0" +END + +3 TEXTINCLUDE +BEGIN + "\r\n" + "\0" +END + +#endif // APSTUDIO_INVOKED + + +///////////////////////////////////////////////////////////////////////////// +// +// Icon +// + +// Icon with lowest ID value placed first to ensure application icon +// remains consistent on all systems. +IDI_MAINICON ICON "res\\regshot.ico" + +///////////////////////////////////////////////////////////////////////////// +// +// RT_MANIFEST +// + +1 RT_MANIFEST "res\\Regshot.exe.manifest" + +///////////////////////////////////////////////////////////////////////////// +// +// Version +// + +VS_VERSION_INFO VERSIONINFO + FILEVERSION REGSHOT_VERSION_NUM + PRODUCTVERSION REGSHOT_VERSION_NUM + FILEFLAGSMASK 0x3fL +#ifdef _DEBUG + FILEFLAGS 0x1L +#else + FILEFLAGS 0x0L +#endif + FILEOS 0x40004L + FILETYPE 0x1L + FILESUBTYPE 0x0L +BEGIN + BLOCK "StringFileInfo" + BEGIN + BLOCK "040904b0" + BEGIN + VALUE "CompanyName", "Regshot Team" + VALUE "FileDescription", REGSHOT_TITLE + VALUE "FileVersion", REGSHOT_VERSION + VALUE "InternalName", "Regshot" + VALUE "LegalCopyright", REGSHOT_VERSION_COPYRIGHT + VALUE "OriginalFilename", "Regshot.exe" + VALUE "ProductName", "Regshot" + VALUE "ProductVersion", REGSHOT_VERSION + END + END + BLOCK "VarFileInfo" + BEGIN + VALUE "Translation", 0x409, 1200 + END +END + +#endif // English (United States) resources +///////////////////////////////////////////////////////////////////////////// + + + +#ifndef APSTUDIO_INVOKED +///////////////////////////////////////////////////////////////////////////// +// +// Generated from the TEXTINCLUDE 3 resource. +// + + +///////////////////////////////////////////////////////////////////////////// +#endif // not APSTUDIO_INVOKED + diff --git a/RegShot/src/res/Regshot.exe.manifest b/RegShot/src/res/Regshot.exe.manifest new file mode 100644 index 0000000..b187013 --- /dev/null +++ b/RegShot/src/res/Regshot.exe.manifest @@ -0,0 +1,40 @@ + + + + Regshot + + + + + + + + + + + + + + + + + + + + + true + + + \ No newline at end of file diff --git a/RegShot/src/res/regshot.ico b/RegShot/src/res/regshot.ico new file mode 100644 index 0000000..270fc16 Binary files /dev/null and b/RegShot/src/res/regshot.ico differ diff --git a/RegShot/src/resource.h b/RegShot/src/resource.h new file mode 100644 index 0000000..9c478d6 --- /dev/null +++ b/RegShot/src/resource.h @@ -0,0 +1,77 @@ +//{{NO_DEPENDENCIES}} +// Microsoft Developer Studio generated include file. +// Used by regshot.rc +// +#ifndef IDC_STATIC +#define IDC_STATIC -1 +#endif + +#define IDD_DIALOG1 100 +#define IDD_DIALOG2 101 +#define IDI_MAINICON 111 +#define ID_BASE 1000 + +#define IDC_1STSHOT 1003 +#define IDC_2NDSHOT 1004 +#define IDC_COMPARE 1005 +#define IDC_CLEAR1 1006 +#define IDC_CANCEL1 1007 +#define IDC_ABOUT 1008 +#define IDC_MONITOR 1009 +#define IDC_STATICSAVEFORMAT 1010 +#define IDC_STATICOUTPUTPATH 1011 +#define IDC_STATICADDCOMMENT 1012 +#define IDC_RADIO1 1013 +#define IDC_RADIO2 1014 +#define IDC_CHECKDIR 1015 + +#define IDC_STATICSERVICE 1016 +#define IDC_STATICRING3 1017 +#define IDC_SETMASK 1018 +#define IDC_CHECKONTOP 1019 +#define IDC_CHECKPAUSE 1020 +#define IDC_CLEAR2 1021 +#define IDC_SAVE 1022 +#define IDC_CANCEL2 1023 +#define IDC_PBCOMPARE 1024 +#define IDC_EDITCOMMENT 1025 +#define IDC_EDITPATH 1026 +#define IDC_EDITDIR 1027 +#define IDC_TEXTCOUNT1 1028 +#define IDC_TEXTCOUNT2 1029 +#define IDC_TEXTCOUNT3 1030 +#define IDC_BROWSE1 1031 +#define IDC_BROWSE2 1032 +#define IDC_COMBOLANGUAGE 1033 +#define IDC_RegOpenKey 1034 +#define IDC_RegCloseKey 1035 +#define IDC_RegCreateKey 1036 +#define IDC_RegDeleteKey 1037 +#define IDC_RegSetValue 1038 +#define IDC_RegSetValueEx 1039 +#define IDC_RegQueryValue 1040 +#define IDC_RegQueryValueEx 1041 +#define IDC_RegDeleteValue 1042 +#define IDC_RegEnumKey 1043 +#define IDC_RegEnumValue 1044 +#define IDC_RegFlushKey 1045 +#define IDC_EDITRING3 1046 +#define IDC_LIST1 1047 +#define IDM_SHOTONLY 1048 +#define IDM_SHOTSAVE 1049 +#define IDM_LOAD 1050 +#define IDM_BREAK 1051 +#define IDM_CLEARALLSHOTS 1052 +#define IDM_CLEARSHOT1 1053 +#define IDM_CLEARSHOT2 1054 + +// Next default values for new objects +// +#ifdef APSTUDIO_INVOKED +#ifndef APSTUDIO_READONLY_SYMBOLS +#define _APS_NEXT_RESOURCE_VALUE 120 +#define _APS_NEXT_COMMAND_VALUE 40007 +#define _APS_NEXT_CONTROL_VALUE 1055 +#define _APS_NEXT_SYMED_VALUE 102 +#endif +#endif diff --git a/RegShot/src/setup.c b/RegShot/src/setup.c new file mode 100644 index 0000000..ecb1668 --- /dev/null +++ b/RegShot/src/setup.c @@ -0,0 +1,172 @@ +/* + Copyright 2004 tulipfan + + This file is part of Regshot. + + Regshot is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + Regshot is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Regshot; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +/* This file orignal coded by tulipfan + * Change function/variable name to more proper ones and fix for x64 by tianwei +*/ + +#include "global.h" +// 1.8.2 move defination from global.h to this place +#define SIZEOF_INI_SKIPBLOCK 65535 +#define MAX_INI_SKIPITEMS 100 + +// setup based on regshot.ini by tulipfan (tfx) +LPSTR INI_SETUP = "Setup"; +LPSTR INI_FLAG = "Flag"; +LPSTR INI_EXTDIR = "ExtDir"; +LPSTR INI_OUTDIR = "OutDir"; +LPSTR INI_SKIPREGKEY = "SkipRegKey"; +LPSTR INI_SKIPDIR = "SkipDir"; +LPSTR INI_USELONGREGHEAD = "UseLongRegHead"; // 1.8.1 tianwei for compatible to undoreg 1.46 again + + +BOOL LoadSettingsFromIni(HWND hDlg) // tfx get ini info (translate from chinese comment) +{ + int i; + LPBYTE lpReturn; + BYTE nFlag; + + char lpIniKey[16]; + + lplpRegSkipStrings = MYALLOC0(sizeof(LPSTR) * MAX_INI_SKIPITEMS); + lpRegSkipStrings = MYALLOC0(SIZEOF_INI_SKIPBLOCK); + if (GetPrivateProfileSection(INI_SKIPREGKEY, (LPSTR)lpRegSkipStrings, SIZEOF_INI_SKIPBLOCK, lpRegshotIni) > 0) { + for (i = 0; i < MAX_INI_SKIPITEMS - 1; i++) { + sprintf(lpIniKey, "%d%s", i, "="); + if ((lpReturn = AtPos(lpRegSkipStrings, (LPBYTE)lpIniKey, SIZEOF_INI_SKIPBLOCK, strlen(lpIniKey))) != NULL) { + *(lplpRegSkipStrings + i) = lpReturn; + //dwSnapFiles++; + } else { + break; + } + } + } + + lplpFileSkipStrings = MYALLOC0(sizeof(LPSTR) * MAX_INI_SKIPITEMS); + lpFileSkipStrings = MYALLOC0(SIZEOF_INI_SKIPBLOCK); + if (GetPrivateProfileSection(INI_SKIPDIR, (LPSTR)lpFileSkipStrings, SIZEOF_INI_SKIPBLOCK, lpRegshotIni)) { + for (i = 0; i < MAX_INI_SKIPITEMS - 1; i++) { + sprintf(lpIniKey, "%d%s", i, "="); + if ((lpReturn = AtPos(lpFileSkipStrings, (LPBYTE)lpIniKey, SIZEOF_INI_SKIPBLOCK, strlen(lpIniKey))) != NULL) { + *(lplpFileSkipStrings + i) = lpReturn; + //dwSnapFiles++; + } else { + break; + } + } + } + + nFlag = (BYTE)GetPrivateProfileInt(INI_SETUP, INI_FLAG, 1, lpRegshotIni); // default from 0 to 1 in 1.8.2 (TEXT) + //if (nFlag != 0) + { + SendMessage(GetDlgItem(hDlg, IDC_RADIO1), BM_SETCHECK, (WPARAM)(nFlag & 0x01), (LPARAM)0); + SendMessage(GetDlgItem(hDlg, IDC_RADIO2), BM_SETCHECK, (WPARAM)((nFlag & 0x01) ^ 0x01), (LPARAM)0); + //SendMessage(GetDlgItem(hDlg,IDC_CHECKDIR),BM_SETCHECK,(WPARAM)((nFlag&0x04)>>1),(LPARAM)0); // 1.7 + SendMessage(GetDlgItem(hDlg, IDC_CHECKDIR), BM_SETCHECK, (WPARAM)((nFlag & 0x02) >> 1), (LPARAM)0); + } + /*else delete in 1.8.1 + { + SendMessage(GetDlgItem(hDlg,IDC_RADIO1),BM_SETCHECK,(WPARAM)0x01,(LPARAM)0); + SendMessage(GetDlgItem(hDlg,IDC_RADIO2),BM_SETCHECK,(WPARAM)0x00,(LPARAM)0); + SendMessage(GetDlgItem(hDlg,IDC_CHECKDIR),BM_SETCHECK,(WPARAM)0x00,(LPARAM)0); + } + */ + // added in 1.8.1 for compatible with undoreg1.46 + bUseLongRegHead = GetPrivateProfileInt(INI_SETUP, INI_USELONGREGHEAD, 0, lpRegshotIni) != 0 ? TRUE : FALSE; + + if (GetPrivateProfileString(INI_SETUP, INI_EXTDIR, NULL, lpExtDir, MAX_PATH, lpRegshotIni) != 0) { + SetDlgItemText(hDlg, IDC_EDITDIR, lpExtDir); + } else { + SetDlgItemText(hDlg, IDC_EDITDIR, lpWindowsDirName); + } + + if (GetPrivateProfileString(INI_SETUP, INI_OUTDIR, NULL, lpOutputpath, MAX_PATH, lpRegshotIni) != 0) { + SetDlgItemText(hDlg, IDC_EDITPATH, lpOutputpath); + } else { + SetDlgItemText(hDlg, IDC_EDITPATH, lpTempPath); + } + + SendMessage(hDlg, WM_COMMAND, (WPARAM)IDC_CHECKDIR, (LPARAM)0); + + return TRUE; +} + + +BOOL SaveSettingsToIni(HWND hDlg) // tfx save settings to ini (translate from chinese) +{ + BYTE nFlag; + LPSTR lpString; + HANDLE hTest; + + // 1.8.2, someone might not want to create a regshot.ini when there isn't one. :O + hTest = CreateFile(lpRegshotIni, GENERIC_READ | GENERIC_WRITE, + FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, NULL); + if (hTest == INVALID_HANDLE_VALUE) { + return FALSE; + } + CloseHandle(hTest); + + //nFlag = (BYTE)(SendMessage(GetDlgItem(hDlg,IDC_RADIO1),BM_GETCHECK,(WPARAM)0,(LPARAM)0) // 1.7 + // |SendMessage(GetDlgItem(hDlg,IDC_RADIO2),BM_GETCHECK,(WPARAM)0,(LPARAM)0)<<1 + // |SendMessage(GetDlgItem(hDlg,IDC_CHECKDIR),BM_GETCHECK,(WPARAM)0,(LPARAM)0)<<2); + nFlag = (BYTE)(SendMessage(GetDlgItem(hDlg, IDC_RADIO1), BM_GETCHECK, (WPARAM)0, (LPARAM)0) | + SendMessage(GetDlgItem(hDlg, IDC_CHECKDIR), BM_GETCHECK, (WPARAM)0, (LPARAM)0) << 1); + + lpString = MYALLOC0(EXTDIRLEN + 4); + //sprintf(lpString,"%s = %d",INI_FLAG,nFlag); // 1.7 solokey + //WritePrivateProfileSection(INI_SETUP,lpString,lpRegshotIni); // 1.7 solokey, can only have one key. + + // 1.8.1 + sprintf(lpString, "%d", nFlag); + WritePrivateProfileString(INI_SETUP, INI_FLAG, lpString, lpRegshotIni); + sprintf(lpString, "%d", bUseLongRegHead); + WritePrivateProfileString(INI_SETUP, INI_USELONGREGHEAD, lpString, lpRegshotIni); + + + if (GetDlgItemText(hDlg, IDC_EDITDIR, lpString, (EXTDIRLEN/2)) != 0) { + WritePrivateProfileString(INI_SETUP, INI_EXTDIR, lpString, lpRegshotIni); + } + + if (GetDlgItemText(hDlg, IDC_EDITPATH, lpString, MAX_PATH) != 0) { + WritePrivateProfileString(INI_SETUP, INI_OUTDIR, lpString, lpRegshotIni); + } + + MYFREE(lpString); + MYFREE(lpRegshotIni); + MYFREE(lpRegSkipStrings); + MYFREE(lpFileSkipStrings); + //MYFREE(lpSnapKey); + //MYFREE(lpSnapReturn); + + return TRUE; +} + + +BOOL IsInSkipList(LPSTR lpStr, LPBYTE *lpSkipList) // tfx skip the list (translate from chinese) +{ + int i; + // todo: it seems bypass null item. But the getsetting is get all. Is it safe without the null thing? tianwei + for (i = 0; (LPSTR)(*(lpSkipList + i)) != NULL && i <= MAX_INI_SKIPITEMS - 1; i++) { + if (_stricmp(lpStr, (LPSTR)(*(lpSkipList + i))) == 0) { + return TRUE; + } + } + return FALSE; +} diff --git a/RegShot/src/ui.c b/RegShot/src/ui.c new file mode 100644 index 0000000..8f549a1 --- /dev/null +++ b/RegShot/src/ui.c @@ -0,0 +1,371 @@ +/* + Copyright 1999-2003,2007 TiANWEi + Copyright 2004 tulipfan + + This file is part of Regshot. + + Regshot is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + Regshot is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Regshot; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + +#include "global.h" + +extern LPBYTE lan_time; +extern LPBYTE lan_key; +extern LPBYTE lan_value; +extern LPBYTE lan_dir; +extern LPBYTE lan_file; +extern LPBYTE lan_menushot; +extern LPBYTE lan_menushotsave; +extern LPBYTE lan_menuload; + + +char USERSSTRING_LONG[] = "HKEY_USERS"; // 1.6 using long name, so in 1.8.1 add an option +char USERSSTRING[] = "HKU"; // in regshot.ini, "UseLongRegHead" to control this +char LOCALMACHINESTRING[] = "HKLM"; +char LOCALMACHINESTRING_LONG[] = "HKEY_LOCAL_MACHINE"; + + +void ShowHideCounters(int nCmdShow) // 1.8.2 +{ + ShowWindow(GetDlgItem(hWnd, IDC_TEXTCOUNT1), nCmdShow); + ShowWindow(GetDlgItem(hWnd, IDC_TEXTCOUNT2), nCmdShow); + ShowWindow(GetDlgItem(hWnd, IDC_TEXTCOUNT3), nCmdShow); +} + + +////////////////////////////////////////////////////////////////// +VOID InitProgressBar(VOID) +{ + // The following are not so good, but they work + nSavingKey = 0; + nComparing = 0; + nRegStep = nGettingKey / MAXPBPOSITION; + nFileStep = nGettingFile / MAXPBPOSITION; + ShowHideCounters(SW_HIDE); // 1.8.2 + SendDlgItemMessage(hWnd, IDC_PBCOMPARE, PBM_SETRANGE, (WPARAM)0, MAKELPARAM(0, MAXPBPOSITION)); + SendDlgItemMessage(hWnd, IDC_PBCOMPARE, PBM_SETPOS, (WPARAM)0, (LPARAM)0); + SendDlgItemMessage(hWnd, IDC_PBCOMPARE, PBM_SETSTEP, (WPARAM)1, (LPARAM)0); + ShowWindow(GetDlgItem(hWnd, IDC_PBCOMPARE), SW_SHOW); +} + + +void UpdateCounters(LPBYTE title1, LPBYTE title2, DWORD count1, DWORD count2) +{ + //nGettingTime = GetTickCount(); + nBASETIME1 = nGettingTime; + sprintf(lpMESSAGE, "%s%d%s%d%s", lan_time, (nGettingTime - nBASETIME) / 1000, "s", (nGettingTime - nBASETIME) % 1000, "ms"); + SendDlgItemMessage(hWnd, IDC_TEXTCOUNT3, WM_SETTEXT, (WPARAM)0, (LPARAM)lpMESSAGE); + sprintf(lpMESSAGE, "%s%d", title1, count1); + SendDlgItemMessage(hWnd, IDC_TEXTCOUNT1, WM_SETTEXT, (WPARAM)0, (LPARAM)lpMESSAGE); + sprintf(lpMESSAGE, "%s%d", title2, count2); + SendDlgItemMessage(hWnd, IDC_TEXTCOUNT2, WM_SETTEXT, (WPARAM)0, (LPARAM)lpMESSAGE); + + UpdateWindow(hWnd); + PeekMessage(&msg, hWnd, WM_ACTIVATE, WM_ACTIVATE, PM_REMOVE); + //SetForegroundWindow(hWnd); +} + + +//-------------------------------------------------- +// Prepare the GUI for the shot about to be taken +//-------------------------------------------------- +VOID UI_BeforeShot(DWORD id) +{ + hHourGlass = LoadCursor(NULL, IDC_WAIT); + hSaveCursor = SetCursor(hHourGlass); + EnableWindow(GetDlgItem(hWnd, id), FALSE); + // Added in 1.8.2 + strcpy(lpMESSAGE, " "); // clear the counters + SendDlgItemMessage(hWnd, IDC_TEXTCOUNT1, WM_SETTEXT, (WPARAM)0, (LPARAM)lpMESSAGE); + SendDlgItemMessage(hWnd, IDC_TEXTCOUNT2, WM_SETTEXT, (WPARAM)0, (LPARAM)lpMESSAGE); + SendDlgItemMessage(hWnd, IDC_TEXTCOUNT3, WM_SETTEXT, (WPARAM)0, (LPARAM)lpMESSAGE); + ShowHideCounters(SW_SHOW); +} + + +//-------------------------------------------------- +// Reset the GUI after the shot has been taken +//-------------------------------------------------- +VOID UI_AfterShot(VOID) +{ + DWORD iddef; + + if (lpHeadLocalMachine1 == NULL) { + iddef = IDC_1STSHOT; + } else if (lpHeadLocalMachine2 == NULL) { + iddef = IDC_2NDSHOT; + } else { + iddef = IDC_COMPARE; + } + EnableWindow(GetDlgItem(hWnd, IDC_CLEAR1), TRUE); + EnableWindow(GetDlgItem(hWnd, iddef), TRUE); + SendMessage(hWnd, DM_SETDEFID, (WPARAM)iddef, (LPARAM)0); + SetFocus(GetDlgItem(hWnd, iddef)); + SetCursor(hSaveCursor); + MessageBeep(0xffffffff); +} + + +//-------------------------------------------------- +// Prepare the GUI for Clearing +//-------------------------------------------------- +VOID UI_BeforeClear(VOID) +{ + //EnableWindow(GetDlgItem(hWnd,IDC_CLEAR1),FALSE); + hHourGlass = LoadCursor(NULL, IDC_WAIT); + hSaveCursor = SetCursor(hHourGlass); + ShowHideCounters(SW_HIDE); + UpdateWindow(hWnd); +} + + +//-------------------------------------------------- +// Reset the GUI after the clearing +//-------------------------------------------------- +VOID UI_AfterClear(VOID) +{ + DWORD iddef = 0; + //BOOL bChk; // used for file scan disable + + if (lpHeadLocalMachine1 == NULL) { + iddef = IDC_1STSHOT; + } else if (lpHeadLocalMachine2 == NULL) { + iddef = IDC_2NDSHOT; + } + EnableWindow(GetDlgItem(hWnd, iddef), TRUE); + EnableWindow(GetDlgItem(hWnd, IDC_COMPARE), FALSE); + + if (lpHeadLocalMachine1 == NULL && lpHeadLocalMachine2 == NULL) { + EnableWindow(GetDlgItem(hWnd, IDC_2NDSHOT), FALSE); + EnableWindow(GetDlgItem(hWnd, IDC_CLEAR1), FALSE); + //bChk = TRUE; + } + //else // I forgot to comment out this, fixed at 1.8.2 + //bChk = FALSE; + + //EnableWindow(GetDlgItem(hWnd,IDC_CHECKDIR),bChk); // Not used 1.8; we only enable chk when clear all + //SendMessage(hWnd,WM_COMMAND,(WPARAM)IDC_CHECKDIR,(LPARAM)0); + + SetFocus(GetDlgItem(hWnd, iddef)); + SendMessage(hWnd, DM_SETDEFID, (WPARAM)iddef, (LPARAM)0); + SetCursor(hSaveCursor); + MessageBeep(0xffffffff); +} + + +// ----------------------------- +VOID Shot1(VOID) +{ + lpHeadLocalMachine1 = (LPKEYCONTENT)MYALLOC0(sizeof(KEYCONTENT)); + lpHeadUsers1 = (LPKEYCONTENT)MYALLOC0(sizeof(KEYCONTENT)); + + if (bUseLongRegHead) { // 1.8.1 + lpHeadLocalMachine1->lpkeyname = MYALLOC(sizeof(LOCALMACHINESTRING_LONG)); + lpHeadUsers1->lpkeyname = MYALLOC(sizeof(USERSSTRING_LONG)); + strcpy(lpHeadLocalMachine1->lpkeyname, LOCALMACHINESTRING_LONG); + strcpy(lpHeadUsers1->lpkeyname, USERSSTRING_LONG); + } else { + lpHeadLocalMachine1->lpkeyname = MYALLOC(sizeof(LOCALMACHINESTRING)); + lpHeadUsers1->lpkeyname = MYALLOC(sizeof(USERSSTRING)); + strcpy(lpHeadLocalMachine1->lpkeyname, LOCALMACHINESTRING); + strcpy(lpHeadUsers1->lpkeyname, USERSSTRING); + } + + + nGettingKey = 2; + nGettingValue = 0; + nGettingTime = 0; + nGettingFile = 0; + nGettingDir = 0; + nBASETIME = GetTickCount(); + nBASETIME1 = nBASETIME; + UI_BeforeShot(IDC_1STSHOT); + + GetRegistrySnap(HKEY_LOCAL_MACHINE, lpHeadLocalMachine1); + GetRegistrySnap(HKEY_USERS, lpHeadUsers1); + nGettingTime = GetTickCount(); + UpdateCounters(lan_key, lan_value, nGettingKey, nGettingValue); + + if (SendMessage(GetDlgItem(hWnd, IDC_CHECKDIR), BM_GETCHECK, (WPARAM)0, (LPARAM)0) == 1) { + size_t nLengthofStr; + DWORD i; + LPSTR lpSubExtDir; + LPHEADFILE lphf; + LPHEADFILE lphftemp; + + GetDlgItemText(hWnd, IDC_EDITDIR, lpExtDir, EXTDIRLEN/2); + nLengthofStr = strlen(lpExtDir); + + lphf = lphftemp = lpHeadFile1; // changed in 1.8 + lpSubExtDir = lpExtDir; + + if (nLengthofStr > 0) + for (i = 0; i <= nLengthofStr; i++) { + // This is the stupid filename detection routine, [seperate with ";"] + if (*(lpExtDir + i) == 0x3b || *(lpExtDir + i) == 0x00) { + *(lpExtDir + i) = 0x00; + + if (*(lpExtDir + i - 1) == '\\' && i > 0) { + *(lpExtDir + i - 1) = 0x00; + } + + if (*lpSubExtDir != 0x00) { + size_t nSubExtDirLen; + + lphf = (LPHEADFILE)MYALLOC0(sizeof(HEADFILE)); + if (lpHeadFile1 == NULL) { + lpHeadFile1 = lphf; + } else { + lphftemp->lpnextheadfile = lphf; + } + + lphftemp = lphf; + lphf->lpfilecontent = (LPFILECONTENT)MYALLOC0(sizeof(FILECONTENT)); + //lphf->lpfilecontent2 = (LPFILECONTENT)MYALLOC0(sizeof(FILECONTENT)); + + nSubExtDirLen = strlen(lpSubExtDir) + 1; + lphf->lpfilecontent->lpfilename = MYALLOC(nSubExtDirLen); + //lphf->lpfilecontent2->lpfilename = MYALLOC(nSubExtDirLen); + + strcpy(lphf->lpfilecontent->lpfilename, lpSubExtDir); + //strcpy(lphf->lpfilecontent2->lpfilename,lpSubExtDir); + + lphf->lpfilecontent->fileattr = FILE_ATTRIBUTE_DIRECTORY; + //lphf->lpfilecontent2->fileattr = FILE_ATTRIBUTE_DIRECTORY; + + GetFilesSnap(lphf->lpfilecontent); + nGettingTime = GetTickCount(); + UpdateCounters(lan_dir, lan_file, nGettingDir, nGettingFile); + } + lpSubExtDir = lpExtDir + i + 1; + } + } + } + + NBW = COMPUTERNAMELEN; + GetSystemTime(lpSystemtime1); + GetComputerName(lpComputerName1, &NBW); + GetUserName(lpUserName1, &NBW); + + UI_AfterShot(); + +} + + +// ----------------------------- +VOID Shot2(VOID) +{ + lpHeadLocalMachine2 = (LPKEYCONTENT)MYALLOC0(sizeof(KEYCONTENT)); + lpHeadUsers2 = (LPKEYCONTENT)MYALLOC0(sizeof(KEYCONTENT)); + + if (bUseLongRegHead) { // 1.8.1 + lpHeadLocalMachine2->lpkeyname = MYALLOC(sizeof(LOCALMACHINESTRING_LONG)); + lpHeadUsers2->lpkeyname = MYALLOC(sizeof(USERSSTRING_LONG)); + strcpy(lpHeadLocalMachine2->lpkeyname, LOCALMACHINESTRING_LONG); + strcpy(lpHeadUsers2->lpkeyname, USERSSTRING_LONG); + } else { + lpHeadLocalMachine2->lpkeyname = MYALLOC(sizeof(LOCALMACHINESTRING)); + lpHeadUsers2->lpkeyname = MYALLOC(sizeof(USERSSTRING)); + strcpy(lpHeadLocalMachine2->lpkeyname, LOCALMACHINESTRING); + strcpy(lpHeadUsers2->lpkeyname, USERSSTRING); + } + + + nGettingKey = 2; + nGettingValue = 0; + nGettingTime = 0; + nGettingFile = 0; + nGettingDir = 0; + nBASETIME = GetTickCount(); + nBASETIME1 = nBASETIME; + UI_BeforeShot(IDC_2NDSHOT); + + GetRegistrySnap(HKEY_LOCAL_MACHINE, lpHeadLocalMachine2); + GetRegistrySnap(HKEY_USERS, lpHeadUsers2); + nGettingTime = GetTickCount(); + UpdateCounters(lan_key, lan_value, nGettingKey, nGettingValue); + + if (SendMessage(GetDlgItem(hWnd, IDC_CHECKDIR), BM_GETCHECK, (WPARAM)0, (LPARAM)0) == 1) { + size_t nLengthofStr; + DWORD i; + LPSTR lpSubExtDir; + LPHEADFILE lphf; + LPHEADFILE lphftemp; + + GetDlgItemText(hWnd, IDC_EDITDIR, lpExtDir, EXTDIRLEN/2); + nLengthofStr = strlen(lpExtDir); + + lphf = lphftemp = lpHeadFile1; // changed in 1.8 + lpSubExtDir = lpExtDir; + + if (nLengthofStr > 0) + for (i = 0; i <= nLengthofStr; i++) { + // This is the stupid filename detection routine, [seperate with ";"] + if (*(lpExtDir + i) == 0x3b || *(lpExtDir + i) == 0x00) { + *(lpExtDir + i) = 0x00; + + if (*(lpExtDir + i - 1) == '\\' && i > 0) { + *(lpExtDir + i - 1) = 0x00; + } + + if (*lpSubExtDir != 0x00) { + size_t nSubExtDirLen; + + lphf = (LPHEADFILE)MYALLOC0(sizeof(HEADFILE)); + if (lpHeadFile2 == NULL) { + lpHeadFile2 = lphf; + } else { + lphftemp->lpnextheadfile = lphf; + } + + lphftemp = lphf; + lphf->lpfilecontent = (LPFILECONTENT)MYALLOC0(sizeof(FILECONTENT)); + + nSubExtDirLen = strlen(lpSubExtDir) + 1; + lphf->lpfilecontent->lpfilename = MYALLOC(nSubExtDirLen); + + strcpy(lphf->lpfilecontent->lpfilename, lpSubExtDir); + + lphf->lpfilecontent->fileattr = FILE_ATTRIBUTE_DIRECTORY; + + GetFilesSnap(lphf->lpfilecontent); + nGettingTime = GetTickCount(); + UpdateCounters(lan_dir, lan_file, nGettingDir, nGettingFile); + } + lpSubExtDir = lpExtDir + i + 1; + } + } + } + + NBW = COMPUTERNAMELEN; + GetSystemTime(lpSystemtime2); + GetComputerName(lpComputerName2, &NBW); + GetUserName(lpUserName2, &NBW); + UI_AfterShot(); +} + + +//-------------------------------------------------- +// Show popup shortcut menu +//-------------------------------------------------- +VOID CreateShotPopupMenu(VOID) +{ + hMenu = CreatePopupMenu(); + AppendMenu(hMenu, MF_STRING, IDM_SHOTONLY, (LPCSTR)lan_menushot); + AppendMenu(hMenu, MF_STRING, IDM_SHOTSAVE, (LPCSTR)lan_menushotsave); + AppendMenu(hMenu, MF_SEPARATOR, IDM_BREAK, NULL); + AppendMenu(hMenu, MF_STRING, IDM_LOAD, (LPCSTR)lan_menuload); + SetMenuDefaultItem(hMenu, IDM_SHOTONLY, FALSE); +} diff --git a/RegShot/src/version.h b/RegShot/src/version.h new file mode 100644 index 0000000..db26f64 --- /dev/null +++ b/RegShot/src/version.h @@ -0,0 +1,103 @@ +/* + Copyright 2011 XhmikosR + + This file is part of Regshot. + + Regshot is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + Regshot is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Regshot; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + + +#ifndef REGSHOT_VERSION_H +#define REGSHOT_VERSION_H + + +#define DO_STRINGIFY(x) #x +#define STRINGIFY(x) DO_STRINGIFY(x) + +#define REGSHOT_VERSION_MAJOR 1 +#define REGSHOT_VERSION_MINOR 8 +#define REGSHOT_VERSION_PATCH 3 +#define REGSHOT_VERSION_REV 0 + +#define REGSHOT_VERSION_COPYRIGHT "Copyright (C) 1999-2012, all contributors" +#define REGSHOT_VERSION_NUM REGSHOT_VERSION_MAJOR,REGSHOT_VERSION_MINOR,REGSHOT_VERSION_PATCH,REGSHOT_VERSION_REV +#define REGSHOT_VERSION STRINGIFY(REGSHOT_VERSION_MAJOR) ", " STRINGIFY(REGSHOT_VERSION_MINOR) ", " STRINGIFY(REGSHOT_VERSION_PATCH) ", " STRINGIFY(REGSHOT_VERSION_REV) +#define REGSHOT_VERSION_STRING STRINGIFY(REGSHOT_VERSION_MAJOR) "." STRINGIFY(REGSHOT_VERSION_MINOR) "." STRINGIFY(REGSHOT_VERSION_PATCH) "-beta1V5" + +#ifdef _WIN64 +#define REGSHOT_TITLE "Regshot x64" +#define REGSHOT_RESULT_FILE "~res-x64" +#define REGSHOT_VERSION_PLATFORM "x64" +#else +#define REGSHOT_TITLE "Regshot" +#define REGSHOT_RESULT_FILE "~res" +#define REGSHOT_VERSION_PLATFORM "win32" +#endif // _WIN64 + +#ifdef _DEBUG +#define REGSHOT_VERSION_BUILDTYPE "d" +#else +#define REGSHOT_VERSION_BUILDTYPE "r" +#endif + +#define DO_STRINGIFY(x) #x +#define STRINGIFY(x) DO_STRINGIFY(x) + +#if defined(__GNUC__) + #define REGSHOT_VERSION_COMPILER "GCC "STRINGIFY(__GNUC__)"."STRINGIFY(__GNUC_MINOR__)"."STRINGIFY(__GNUC_PATCHLEVEL__) +#elif defined(__INTEL_COMPILER) + #if __INTEL_COMPILER >= 1200 + #define REGSHOT_VERSION_COMPILER "Intel Compiler 12" + #else + #define REGSHOT_VERSION_COMPILER "Intel Compiler (version unknown)" + #endif +#elif defined(WDK_BUILD) + #if _MSC_VER == 1600 + #if (_MSC_FULL_VER >= 160040219) + #define REGSHOT_VERSION_COMPILER "WDK (MSVC 2010 SP1)" + #else + #define REGSHOT_VERSION_COMPILER "WDK (MSVC 2010)" + #endif + #elif _MSC_VER == 1500 + #if (_MSC_FULL_VER == 150030729) + #define REGSHOT_VERSION_COMPILER "WDK" + #else + #define REGSHOT_VERSION_COMPILER "WDK (version unknown)" + #endif + #endif +#elif defined(_MSC_VER) + #if _MSC_VER == 1600 + #if (_MSC_FULL_VER >= 160040219) + #define REGSHOT_VERSION_COMPILER "MSVC 2010 SP1" + #else + #define REGSHOT_VERSION_COMPILER "MSVC 2010" + #endif + #elif _MSC_VER == 1500 + #if (_MSC_FULL_VER >= 150030729) + #define REGSHOT_VERSION_COMPILER "MSVC 2008 SP1" + #else + #define REGSHOT_VERSION_COMPILER "MSVC 2008" + #endif + #else + #define REGSHOT_VERSION_COMPILER "MSVC (version unknown)" + #endif +#else + #define REGSHOT_VERSION_COMPILER "(Unknown compiler)" +#endif + +#define REGSHOT_VERSION_DESCRIPTION REGSHOT_VERSION_STRING ", " REGSHOT_VERSION_PLATFORM ", " REGSHOT_VERSION_BUILDTYPE ", " REGSHOT_VERSION_COMPILER + + +#endif // REGSHOT_VERSION_H diff --git a/RegShot/src/winmain.c b/RegShot/src/winmain.c new file mode 100644 index 0000000..8dc4b63 --- /dev/null +++ b/RegShot/src/winmain.c @@ -0,0 +1,459 @@ +/* + Copyright 1999-2003,2007 TiANWEi + Copyright 2004 tulipfan + Copyright 2007 Belogorokhov Youri + + + This file is part of Regshot. + + Regshot is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + Regshot is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with Regshot; if not, write to the Free Software + Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA +*/ + + +#include "global.h" +#include "version.h" + +char *str_prgname = REGSHOT_TITLE " " REGSHOT_VERSION_STRING; // tfx add program titile +char *str_aboutme = "Regshot is a free and open source registry compare utility.\nversion: " REGSHOT_VERSION_DESCRIPTION "\n\nhttp://sourceforge.net/projects/regshot/\n\n" REGSHOT_VERSION_COPYRIGHT "\n\n"; + +LPSTR REGSHOTINI = "regshot.ini"; // tfx +LPSTR REGSHOTLANGUAGEFILE = "language.ini"; + +extern LPBYTE lan_menuclearallshots; // Be careful of extern ref! must be the same when declare them, +extern LPBYTE lan_menuclearshot1; // otherwise pointer would mis-point, and I can not use sizeof +extern LPBYTE lan_menuclearshot2; // to get real array size in extern ref +extern LPBYTE lan_about; +extern LPSTR str_DefaultLanguage; +extern LPSTR str_Original; + + +// this new function added by Youri in 1.8.2, for expanding path in browse dialog +int CALLBACK SelectBrowseFolder(HWND hWnd, UINT uMsg, LPARAM lParam, LPARAM lpData) +{ + UNREFERENCED_PARAMETER(lParam); + if (uMsg == BFFM_INITIALIZED) { + SendMessage(hWnd, BFFM_SETSELECTION, 1, lpData); + } + return 0; +} + + +//-------------------------------------------------- +// Main Dialog Proc +//-------------------------------------------------- +BOOL CALLBACK DialogProc(HWND hDlg, UINT message, WPARAM wParam, LPARAM lParam) +{ + size_t nLengthofStr; + //BYTE nFlag; + + UNREFERENCED_PARAMETER(lParam); + + switch (message) { + case WM_INITDIALOG: + + SendDlgItemMessage(hDlg, IDC_EDITCOMMENT, EM_SETLIMITTEXT, (WPARAM)COMMENTLENGTH, (LPARAM)0); + SendDlgItemMessage(hDlg, IDC_EDITPATH, EM_SETLIMITTEXT, (WPARAM)MAX_PATH, (LPARAM)0); + SendDlgItemMessage(hDlg, IDC_EDITDIR, EM_SETLIMITTEXT, (WPARAM)(EXTDIRLEN/2), (LPARAM)0); + + //enlarge some buffer in 201201 + lpCurrentLanguage = MYALLOC0(SIZEOF_SINGLE_LANGUAGENAME); + lpExtDir = MYALLOC0(EXTDIRLEN + 4); //EXTDIRLEN is actually 4*max_path + lpLanguageIni = MYALLOC0(MAX_PATH*4 + 4); //for language.ini + lpRegshotIni = MYALLOC0(MAX_PATH*4 + 4); //for regshot.ini + lpKeyName = MYALLOC0(MAX_PATH*2 + 2); //For scan engine store keyname + lpValueName = MYALLOC0(1024*16*2); //For scan engine store valuename + lpValueData = MYALLOC0(ESTIMATE_VALUEDATA_LENGTH); //For scan engine store valuedata estimate + lpMESSAGE = MYALLOC0(256); //For status bar text message store + lpWindowsDirName = MYALLOC0(MAX_PATH*2 + 2); + lpTempPath = MYALLOC0(MAX_PATH*2 + 2); + lpStartDir = MYALLOC0(MAX_PATH*2 + 2); + lpOutputpath = MYALLOC0(MAX_PATH*2 + 2); //store last save/open hive file dir + lpComputerName1 = MYALLOC0(COMPUTERNAMELEN); + lpComputerName2 = MYALLOC0(COMPUTERNAMELEN); + lpUserName1 = MYALLOC0(COMPUTERNAMELEN); + lpUserName2 = MYALLOC0(COMPUTERNAMELEN); + lpSystemtime1 = MYALLOC0(sizeof(SYSTEMTIME)); + lpSystemtime2 = MYALLOC0(sizeof(SYSTEMTIME)); + lpLangStrings = MYALLOC0(SIZEOF_LANGSTRINGS); + lplpLangStrings = MYALLOC0(sizeof(LPSTR) * 60); // max is 60 strings + + lpCurrentTranslator = str_Original; + + GetWindowsDirectory(lpWindowsDirName, MAX_PATH); + nLengthofStr = strlen(lpWindowsDirName); + if (nLengthofStr > 0 && *(lpWindowsDirName + nLengthofStr - 1) == '\\') { + *(lpWindowsDirName + nLengthofStr - 1) = 0x00; + } + GetTempPath(MAX_PATH, lpTempPath); + + //_asm int 3; + GetCurrentDirectory(MAX_PATH + 1, lpStartDir); // fixed at 1.8.2 former version use getcommandline() + strcpy(lpLanguageIni, lpStartDir); + if (*(lpLanguageIni + strlen(lpLanguageIni) - 1) != '\\') { // 1.8.2 + strcat(lpLanguageIni, "\\"); + } + strcat(lpLanguageIni, REGSHOTLANGUAGEFILE); + + + if (GetLanguageType(hDlg)) { + GetLanguageStrings(hDlg); + } else { + GetDefaultStrings(); + } + + SendMessage(hDlg, WM_COMMAND, (WPARAM)IDC_CHECKDIR, (LPARAM)0); + + lpLastSaveDir = lpOutputpath; + lpLastOpenDir = lpOutputpath; + + strcpy(lpRegshotIni, lpStartDir); + if (*(lpRegshotIni + strlen(lpRegshotIni) - 1) != '\\') { + strcat(lpRegshotIni, "\\"); + } + strcat(lpRegshotIni, REGSHOTINI); + + LoadSettingsFromIni(hDlg); // tfx + + return TRUE; + + case WM_COMMAND: + switch (LOWORD(wParam)) { + case IDC_1STSHOT: + CreateShotPopupMenu(); + is1 = TRUE; + GetWindowRect(GetDlgItem(hDlg, IDC_1STSHOT), &rect); + TrackPopupMenu(hMenu, TPM_LEFTALIGN | TPM_LEFTBUTTON, rect.left + 10, rect.top + 10, 0, hDlg, NULL); + DestroyMenu(hMenu); + + return(TRUE); + + case IDC_2NDSHOT: + CreateShotPopupMenu(); + is1 = FALSE; + GetWindowRect(GetDlgItem(hDlg, IDC_2NDSHOT), &rect); + TrackPopupMenu(hMenu, TPM_LEFTALIGN | TPM_LEFTBUTTON, rect.left + 10, rect.top + 10, 0, hDlg, NULL); + DestroyMenu(hMenu); + return(TRUE); + + case IDM_SHOTONLY: + if (is1) { + is1LoadFromHive = FALSE; + Shot1(); + } else { + is2LoadFromHive = FALSE; + Shot2(); + } + + return(TRUE); + + case IDM_SHOTSAVE: + if (is1) { + is1LoadFromHive = FALSE; + Shot1(); + SaveHive(lpHeadLocalMachine1, lpHeadUsers1, lpHeadFile1, lpComputerName1, lpUserName1, lpSystemtime1); // I might use a struct in future! + } else { + is2LoadFromHive = FALSE; + Shot2(); + SaveHive(lpHeadLocalMachine2, lpHeadUsers2, lpHeadFile2, lpComputerName2, lpUserName2, lpSystemtime2); + } + + return(TRUE); + + case IDM_LOAD: + if (is1) { + is1LoadFromHive = LoadHive(&lpHeadLocalMachine1, &lpHeadUsers1, &lpHeadFile1, &lpTempHive1); + } else { + is2LoadFromHive = LoadHive(&lpHeadLocalMachine2, &lpHeadUsers2, &lpHeadFile2, &lpTempHive2); + } + + //if (is1LoadFromHive || is2LoadFromHive) + // SendMessage(GetDlgItem(hWnd,IDC_CHECKDIR),BM_SETCHECK,(WPARAM)0x00,(LPARAM)0); + + return(TRUE); + + /*case IDC_SAVEREG: + SaveRegistry(lpHeadLocalMachine1,lpHeadUsers1); + return(TRUE);*/ + + case IDC_COMPARE: + EnableWindow(GetDlgItem(hDlg, IDC_COMPARE), FALSE); + UI_BeforeClear(); + CompareShots(); + ShowWindow(GetDlgItem(hDlg, IDC_PBCOMPARE), SW_HIDE); + EnableWindow(GetDlgItem(hDlg, IDC_CLEAR1), TRUE); + SetFocus(GetDlgItem(hDlg, IDC_CLEAR1)); + SendMessage(hDlg, DM_SETDEFID, (WPARAM)IDC_CLEAR1, (LPARAM)0); + SetCursor(hSaveCursor); + MessageBeep(0xffffffff); + return(TRUE); + + case IDC_CLEAR1: + hMenuClear = CreatePopupMenu(); + AppendMenu(hMenuClear, MF_STRING, IDM_CLEARALLSHOTS, (LPCSTR)lan_menuclearallshots); + AppendMenu(hMenuClear, MF_MENUBARBREAK, IDM_BREAK, NULL); + AppendMenu(hMenuClear, MF_STRING, IDM_CLEARSHOT1, (LPCSTR)lan_menuclearshot1); + AppendMenu(hMenuClear, MF_STRING, IDM_CLEARSHOT2, (LPCSTR)lan_menuclearshot2); + //AppendMenu(hMenuClear,MF_STRING,IDM_CLEARRESULT,"Clear comparison result"); + SetMenuDefaultItem(hMenuClear, IDM_CLEARALLSHOTS, FALSE); + + //if (lpHeadFile != NULL) + //{ + // EnableMenuItem(hMenuClear,IDM_CLEARSHOT1,MF_BYCOMMAND|MF_GRAYED); + // EnableMenuItem(hMenuClear,IDM_CLEARSHOT2,MF_BYCOMMAND|MF_GRAYED); + //} + //else + { + if (lpHeadLocalMachine1 != NULL) { + EnableMenuItem(hMenuClear, IDM_CLEARSHOT1, MF_BYCOMMAND | MF_ENABLED); + } else { + EnableMenuItem(hMenuClear, IDM_CLEARSHOT1, MF_BYCOMMAND | MF_GRAYED); + } + + if (lpHeadLocalMachine2 != NULL) { + EnableMenuItem(hMenuClear, IDM_CLEARSHOT2, MF_BYCOMMAND | MF_ENABLED); + } else { + EnableMenuItem(hMenuClear, IDM_CLEARSHOT2, MF_BYCOMMAND | MF_GRAYED); + } + } + GetWindowRect(GetDlgItem(hDlg, IDC_CLEAR1), &rect); + TrackPopupMenu(hMenuClear, TPM_LEFTALIGN | TPM_LEFTBUTTON, rect.left + 10, rect.top + 10, 0, hDlg, NULL); + DestroyMenu(hMenuClear); + return(TRUE); + + case IDM_CLEARALLSHOTS: + UI_BeforeClear(); + FreeAllKeyContent1(); // Note!! If loadfromhive and contains a file, we should let lpHeadFile to NULL + FreeAllKeyContent2(); + FreeAllCompareResults(); + + FreeAllFileHead(lpHeadFile1); + FreeAllFileHead(lpHeadFile2); + + lpHeadFile1 = NULL; + lpHeadFile2 = NULL; + UI_AfterClear(); + EnableWindow(GetDlgItem(hWnd, IDC_CLEAR1), FALSE); + return(TRUE); + + case IDM_CLEARSHOT1: + UI_BeforeClear(); + FreeAllKeyContent1(); + FreeAllCompareResults(); + FreeAllFileHead(lpHeadFile1); + lpHeadFile1 = NULL; + ClearKeyMatchTag(lpHeadLocalMachine2); // we clear shot2's tag + ClearKeyMatchTag(lpHeadUsers2); + ClearHeadFileMatchTag(lpHeadFile2); + UI_AfterClear(); + return(TRUE); + + case IDM_CLEARSHOT2: + UI_BeforeClear(); + FreeAllKeyContent2(); + FreeAllCompareResults(); + FreeAllFileHead(lpHeadFile2); + lpHeadFile2 = NULL; + ClearKeyMatchTag(lpHeadLocalMachine1); // we clear shot1's tag + ClearKeyMatchTag(lpHeadUsers1); + ClearHeadFileMatchTag(lpHeadFile1); + UI_AfterClear(); + return(TRUE); + + /*case IDM_CLEARRESULT: + UI_BeforeClear(); + FreeAllCompareResults(); + ClearKeyMatchTag(lpHeadLocalMachine1); + ClearKeyMatchTag(lpHeadLocalMachine2); + ClearKeyMatchTag(lpHeadUsers1); + ClearKeyMatchTag(lpHeadUsers2); + ClearHeadFileMatchTag(lpHeadFile1); + ClearHeadFileMatchTag(lpHeadFile2); + UI_AfterClear(); + return(TRUE);*/ + + case IDC_CHECKDIR: + if (SendMessage(GetDlgItem(hDlg, IDC_CHECKDIR), BM_GETCHECK, (WPARAM)0, (LPARAM)0) == 1) { + EnableWindow(GetDlgItem(hDlg, IDC_EDITDIR), TRUE); + EnableWindow(GetDlgItem(hDlg, IDC_BROWSE1), TRUE); + } else { + EnableWindow(GetDlgItem(hDlg, IDC_EDITDIR), FALSE); + EnableWindow(GetDlgItem(hDlg, IDC_BROWSE1), FALSE); + } + return(TRUE); + + case IDC_CANCEL1: + case IDCANCEL: + + SaveSettingsToIni(hDlg); // tfx + PostQuitMessage(0); + return(TRUE); + + case IDC_BROWSE1: { + + LPITEMIDLIST lpidlist; + BrowseInfo1.hwndOwner = hDlg; + BrowseInfo1.pszDisplayName = MYALLOC0(MAX_PATH*2 + 2); + //BrowseInfo1.lpszTitle = "Select:"; + BrowseInfo1.ulFlags = 0; // 3 lines added in 1.8.2 + BrowseInfo1.lpfn = NULL; + BrowseInfo1.lParam = 0; + + lpidlist = SHBrowseForFolder(&BrowseInfo1); + + if (lpidlist != NULL) { + size_t nWholeLen; + + SHGetPathFromIDList(lpidlist, BrowseInfo1.pszDisplayName); + nLengthofStr = GetDlgItemText(hDlg, IDC_EDITDIR, lpExtDir, EXTDIRLEN/2); + nWholeLen = nLengthofStr + strlen(BrowseInfo1.pszDisplayName); + + if (nWholeLen < EXTDIRLEN + 1) { + strcat(lpExtDir, ";"); + strcat(lpExtDir, BrowseInfo1.pszDisplayName); + + } else { + strcpy(lpExtDir, BrowseInfo1.pszDisplayName); + } + + SetDlgItemText(hDlg, IDC_EDITDIR, lpExtDir); + MYFREE(lpidlist); + } + + MYFREE(BrowseInfo1.pszDisplayName); + } + return(TRUE); + + case IDC_BROWSE2: { + + LPITEMIDLIST lpidlist; + BrowseInfo1.hwndOwner = hDlg; + BrowseInfo1.pszDisplayName = MYALLOC0(MAX_PATH*2 + 2); + //BrowseInfo1.lpszTitle = "Select:"; + + //----------------- + // Added by Youri in 1.8.2 ,Thanks! + // if you add this code, the browse dialog will be expand path and have button "Create Folder" + BrowseInfo1.ulFlags |= 0x0040; // BIF_NEWDIALOGSTYLE; // button "Create Folder" and resizable + BrowseInfo1.lpfn = SelectBrowseFolder; // function for expand path + BrowseInfo1.lParam = (LPARAM)BrowseInfo1.pszDisplayName; + // Initilize selection path + GetDlgItemText(hDlg, IDC_EDITPATH, BrowseInfo1.pszDisplayName, MAX_PATH); + //----------------- + + lpidlist = SHBrowseForFolder(&BrowseInfo1); + if (lpidlist != NULL) { + SHGetPathFromIDList(lpidlist, BrowseInfo1.pszDisplayName); + SetDlgItemText(hDlg, IDC_EDITPATH, BrowseInfo1.pszDisplayName); + MYFREE(lpidlist); + } + + MYFREE(BrowseInfo1.pszDisplayName); + } + return(TRUE); + + case IDC_COMBOLANGUAGE: + GetLanguageStrings(hDlg); + return(TRUE); + + case IDC_ABOUT: { + LPSTR lpAboutBox; + //_asm int 3; + lpAboutBox = MYALLOC0(SIZEOF_ABOUTBOX); + // it is silly that when wsprintf encounters a NULL string, it will write the whole string to NULL! + sprintf(lpAboutBox, "%s%s%s%s%s%s", str_aboutme, "[", (strlen(lpCurrentLanguage) == 0) ? str_DefaultLanguage : lpCurrentLanguage, "]", " by: ", lpCurrentTranslator); + MessageBox(hDlg, lpAboutBox, (LPCSTR)lan_about, MB_OK); + MYFREE(lpAboutBox); + return(TRUE); + } + } + + } + return(FALSE); +} + + +/*BOOL SetPrivilege(HANDLE hToken, LPCSTR pString, BOOL bEnablePrivilege) +{ + TOKEN_PRIVILEGES tp; + LUID luid; + TOKEN_PRIVILEGES tpPrevious; + DWORD cbSize = sizeof(TOKEN_PRIVILEGES); + + if (!LookupPrivilegeValue(NULL,pString,&luid)) + return FALSE; + tp.PrivilegeCount = 1; + tp.Privileges[0].Luid = luid; + tp.Privileges[0].Attributes = 0; + if (!AdjustTokenPrivileges(hToken,FALSE,&tp,sizeof(TOKEN_PRIVILEGES),&tpPrevious,&cbSize)) + return FALSE; + tpPrevious.PrivilegeCount = 1; + tpPrevious.Privileges[0].Luid = luid; + if (bEnablePrivilege) + tpPrevious.Privileges[0].Attributes| = (SE_PRIVILEGE_ENABLED); + else + tpPrevious.Privileges[0].Attributes^ = ((tpPrevious.Privileges[0].Attributes)&(SE_PRIVILEGE_ENABLED)); + if (!AdjustTokenPrivileges(hToken,FALSE,&tpPrevious,cbSize,NULL,NULL)) + return FALSE; + return TRUE; +}*/ + + +int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, + LPSTR lpszCmdLine, int nCmdShow) +{ + + /* + BOOL bWinNTDetected; + HANDLE hToken = 0; + OSVERSIONINFO winver; + winver.dwOSVersionInfoSize = sizeof(OSVERSIONINFO); + GetVersionEx(&winver); + bWinNTDetected = (winver.dwPlatformId == VER_PLATFORM_WIN32_NT) ? TRUE : FALSE; + //hWndMonitor be created first for the multilanguage interface. + + //FARPROC lpfnDlgProc; + //lpfnDlgProc = MakeProcInstance((FARPROC)DialogProc,hInstance); // old style of create dialogproc + */ + UNREFERENCED_PARAMETER(lpszCmdLine); + UNREFERENCED_PARAMETER(hPrevInstance); + + hHeap = GetProcessHeap(); // 1.8.2 + hWnd = CreateDialog(hInstance, MAKEINTRESOURCE(IDD_DIALOG1), NULL, (DLGPROC)DialogProc); + + SetClassLongPtr(hWnd, GCLP_HICON, (LONG_PTR)LoadIcon(hInstance, MAKEINTRESOURCE(IDI_MAINICON))); + + SetWindowText(hWnd, str_prgname); // tfx set program title to str_prgnameavoid edit resource file + ShowWindow(hWnd, nCmdShow); + UpdateWindow(hWnd); + //SetPriorityClass(hInstance,31); + /*if (bWinNTDetected) + { + if (OpenProcessToken(GetCurrentProcess(),TOKEN_ADJUST_PRIVILEGES|TOKEN_QUERY,&hToken) == TRUE) + { + if (SetPrivilege(hToken,"SeSystemProfilePrivilege",TRUE) == TRUE) + { + MessageBox(hWnd,"We are in system level,enjoy!","Info:",MB_OK); + } + CloseHandle(hToken); + } + }*/ + while (GetMessage(&msg, NULL, (WPARAM)NULL, (LPARAM)NULL)) { + if (!IsDialogMessage(hWnd, &msg)) { + TranslateMessage(&msg); + DispatchMessage(&msg); + } + } + return(int)(msg.wParam); +} diff --git a/information.json b/information.json index c5dc3cb..d9f1194 100755 --- a/information.json +++ b/information.json @@ -1,5 +1,5 @@ { - "Version": "2.2.0-Alpha4", + "Version": "2.2.0", "Thank": [ "感谢 @a2035274 @虚幻的早晨 https://bbs.deepin.org/post/238301", "感谢 @zhangs https://bbs.deepin.org/post/227948", diff --git a/mainwindow.py b/mainwindow.py index 1b31fc1..1d67118 100755 --- a/mainwindow.py +++ b/mainwindow.py @@ -128,6 +128,7 @@ class QT: e1.setEditText(findExeHistory[-1]) def DisableButton(things): + button_r_6.setDisabled(things) button1.setDisabled(things) button2.setDisabled(things) button3.setDisabled(things) @@ -813,11 +814,11 @@ class UpdateWindow(): ok.setDisabled(True) else: if "deepin/UOS 应用商店版本<带签名>" == programVersionType: - url = "aHR0cHM6Ly8zMDQ2MjZwOTI3LmdvaG8uY28vc3BhcmstZGVlcGluLXdpbmUtcnVubmVyL3VwZGF0ZS11b3MuanNvbg==" + url = "aHR0cDovLzEyMC4yNS4xNTMuMTQ0L3NwYXJrLWRlZXBpbi13aW5lLXJ1bm5lci91cGRhdGUtdW9zLmpzb24=" elif "星火应用商店版本" == programVersionType: - url = "aHR0cHM6Ly8zMDQ2MjZwOTI3LmdvaG8uY28vc3BhcmstZGVlcGluLXdpbmUtcnVubmVyL3VwZGF0ZS1zcGFyay5qc29u" + url = "aHR0cDovLzEyMC4yNS4xNTMuMTQ0L3NwYXJrLWRlZXBpbi13aW5lLXJ1bm5lci91cGRhdGUtc3BhcmsuanNvbg==" else: - url = "aHR0cHM6Ly8zMDQ2MjZwOTI3LmdvaG8uY28vc3BhcmstZGVlcGluLXdpbmUtcnVubmVyL3VwZGF0ZS5qc29u" + url = "aHR0cDovLzEyMC4yNS4xNTMuMTQ0L3NwYXJrLWRlZXBpbi13aW5lLXJ1bm5lci91cGRhdGUuanNvbg==" try: UpdateWindow.data = json.loads(requests.get(base64.b64decode(url).decode("utf-8")).text) versionLabel = QtWidgets.QLabel(f"当前版本:{version}\n最新版本:{UpdateWindow.data['Version']}\n更新内容:") @@ -1155,8 +1156,8 @@ class ProgramRunStatusShow(): return try: sha = ProgramRunStatusUpload.GetSHA1(e2.currentText()) - lists = json.loads(requests.get(base64.b64decode("aHR0cHM6Ly8zMDQ2MjZwOTI3LmdvaG8uY28vc3BhcmstZGVlcGluLXdpbmUtcnVubmVyL2FwcC8=").decode("utf-8") + sha + base64.b64decode("L2FsbC5qc29u").decode("utf-8")).text) - r = requests.get(base64.b64decode("aHR0cHM6Ly8zMDQ2MjZwOTI3LmdvaG8uY28vc3BhcmstZGVlcGluLXdpbmUtcnVubmVyL2FwcC8=").decode("utf-8") + sha + base64.b64decode("L3RpdGxlLnR4dA==").decode("utf-8")) + lists = json.loads(requests.get(base64.b64decode("aHR0cDovLzEyMC4yNS4xNTMuMTQ0L3NwYXJrLWRlZXBpbi13aW5lLXJ1bm5lci9hcHAv").decode("utf-8") + sha + base64.b64decode("L2FsbC5qc29u").decode("utf-8")).text) + r = requests.get(base64.b64decode("aHR0cDovLzEyMC4yNS4xNTMuMTQ0L3NwYXJrLWRlZXBpbi13aW5lLXJ1bm5lci9hcHAv").decode("utf-8") + sha + base64.b64decode("L3RpdGxlLnR4dA==").decode("utf-8")) r.encoding = "utf-8" title = r.text except: @@ -1793,6 +1794,7 @@ updateThingsString = '''※1、Dll 提取工具支持 NT 6.X 及以上版本的 13、不再强制依赖深度终端,只做推荐安装 14、基于生态活动适配脚本的打包器在打包完成后会弹出对话框提示打包完成 15、优化打包器的 spark wine helper 依赖设置方式 +16、新增 RegShot(注册表比对工具) 以下更新内容旧版本也适用(只限 2.1.0 及以上版本) ※1、在“安装更多Wine”的Wine安装工具中上新 Wine ※2、云 Dll 工具上新 Dll @@ -1832,7 +1834,7 @@ Qt 版本:{QtCore.qVersion()} title = "Wine 运行器 {}".format(version) updateThings = "{} 更新内容:\n{}\n更新时间:{}".format(version, updateThingsString, updateTime, time.strftime("%Y")) try: - threading.Thread(target=requests.get, args=[parse.unquote(base64.b64decode("aHR0cHM6Ly8zMDQ2MjZwOTI3LmdvaG8uY28vc3BhcmstZGVlcGluLXdpbmUtcnVubmVyL29wZW4vSW5zdGFsbC5waHA=").decode("utf-8")) + "?Version=" + version]).start() + threading.Thread(target=requests.get, args=[parse.unquote(base64.b64decode("aHR0cDovLzEyMC4yNS4xNTMuMTQ0L3NwYXJrLWRlZXBpbi13aW5lLXJ1bm5lci9vcGVuL0luc3RhbGwucGhw").decode("utf-8")) + "?Version=" + version]).start() except: pass iconListUnBuild = [ @@ -1962,8 +1964,8 @@ programManager.addWidget(wineConfig, 3, 0, 1, 1) fontAppStore = QtWidgets.QPushButton(QtCore.QCoreApplication.translate("U", "字体商店")) fontAppStore.clicked.connect(FontAppStore) programManager.addWidget(fontAppStore, 3, 2, 1, 1) -button_r_6 = QtWidgets.QPushButton(QtCore.QCoreApplication.translate("U", "安装自定义字体")) -button_r_6.clicked.connect(OpenWineFontPath) +button_r_6 = QtWidgets.QPushButton(QtCore.QCoreApplication.translate("U", "RegShot")) +button_r_6.clicked.connect(lambda: RunWineProgram(f"{programPath}/RegShot/regshot.exe")) programManager.addWidget(button_r_6, 3, 4, 1, 1) sparkWineSetting = QtWidgets.QPushButton(QtCore.QCoreApplication.translate("U", "星火wine配置")) sparkWineSetting.clicked.connect(lambda: threading.Thread(target=os.system, args=["/opt/durapps/spark-dwine-helper/spark-dwine-helper-settings/settings.sh"]).start()) diff --git a/package-script/information.json b/package-script/information.json index ffc43c4..9823471 100755 --- a/package-script/information.json +++ b/package-script/information.json @@ -1,3 +1,3 @@ { - "Version": "2.2.0-Alpha4" + "Version": "2.2.0" } diff --git a/req/__init__.py b/req/__init__.py index 5c75f86..37115bd 100644 --- a/req/__init__.py +++ b/req/__init__.py @@ -1,5 +1,5 @@ # 此库用于实现 52 版不连接程序服务器 -import req as requests +import requests unConnect = False with open("/var/lib/dpkg/status", "r") as i: diff --git a/req/__pycache__/__init__.cpython-37.pyc b/req/__pycache__/__init__.cpython-37.pyc index abc3ed1..68a4567 100644 Binary files a/req/__pycache__/__init__.cpython-37.pyc and b/req/__pycache__/__init__.cpython-37.pyc differ diff --git a/wine/installwine b/wine/installwine index 9690184..2dae947 100755 --- a/wine/installwine +++ b/wine/installwine @@ -14,7 +14,7 @@ import shutil import sys import json import traceback -import req as requests +import requests from PyQt5 import QtCore, QtGui, QtWidgets # UI 布局(自动生成)