Skip to content

Commit

Permalink
First productive version released (1.0.0)
Browse files Browse the repository at this point in the history
  • Loading branch information
cregx committed Dec 18, 2022
1 parent 3742e7f commit ed0fb7e
Show file tree
Hide file tree
Showing 10 changed files with 1,283 additions and 0 deletions.
27 changes: 27 additions & 0 deletions NOTICE.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
The purpose of this file is to disclose information related to copyright ownership and this project.

1) 12-2022
The application was developed by Christoph Regner.
On the web: https://www.cregx.de

Copyright 2022 Christoph Regner

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.

For further information, please refer to the attached LICENSE.md

2) 12-2022
This application is based on a skeleton code from
https://www.codeproject.com/Articles/227831/A-Dialog-Based-Win32-C-Program-Step-by-Step
by (c) Rodrigo Cesar de Freitas Dias https://creativecommons.org/licenses/publicdomain/

26 changes: 26 additions & 0 deletions wimbckup.sln
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@

Microsoft Visual Studio Solution File, Format Version 11.00
# Visual Studio 2010
Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "wimbckup", "wimbckup\wimbckup.vcxproj", "{E96AE6A3-61FC-42FE-986D-5DC6192C0277}"
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
{E96AE6A3-61FC-42FE-986D-5DC6192C0277}.Debug|Win32.ActiveCfg = Debug|Win32
{E96AE6A3-61FC-42FE-986D-5DC6192C0277}.Debug|Win32.Build.0 = Debug|Win32
{E96AE6A3-61FC-42FE-986D-5DC6192C0277}.Debug|x64.ActiveCfg = Debug|x64
{E96AE6A3-61FC-42FE-986D-5DC6192C0277}.Debug|x64.Build.0 = Debug|x64
{E96AE6A3-61FC-42FE-986D-5DC6192C0277}.Release|Win32.ActiveCfg = Release|Win32
{E96AE6A3-61FC-42FE-986D-5DC6192C0277}.Release|Win32.Build.0 = Release|Win32
{E96AE6A3-61FC-42FE-986D-5DC6192C0277}.Release|x64.ActiveCfg = Release|x64
{E96AE6A3-61FC-42FE-986D-5DC6192C0277}.Release|x64.Build.0 = Release|x64
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
EndGlobal
81 changes: 81 additions & 0 deletions wimbckup/action.bat
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
@echo off
REM
REM This script is responsible for performing a data backup and a data restore.
REM Version 1.0
REM December 2022
REM
REM Copyright 2022 Christoph Regner
REM
REM Licensed under the Apache License, Version 2.0 (the "License");
REM you may not use this file except in compliance with the License.
REM You may obtain a copy of the License at
REM
REM http://www.apache.org/licenses/LICENSE-2.0
REM
REM Unless required by applicable law or agreed to in writing, software
REM distributed under the License is distributed on an "AS IS" BASIS,
REM WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
REM See the License for the specific language governing permissions and
REM limitations under the License.
REM
REM Parameter description:
REM Used parameter: %1
REM Represents one of the action types: Backup | Recovery
REM Used parameter: %2
REM Returns the full path to the backup | data recovery file (*.wim).
REM Used parameter: %3 (for backup only)
REM Represents the volume that is to be backed up, e.g. C:\
REM
REM Return values:
REM The script must return the value 0x400 (1024) in case of successful processing.
REM In case of an failure the script should return a different value (!= 0x400).
REM This will then be displayed as an error in the GUI (wimbckup.exe)
REM after processing is complete.
REM
REM Note: The return value of 0x0 (0) represents an error.
REM The return value 0xFFFFFFFFFFFFFFFF (-1) as well as 0xC000013A (3221225786)
REM are reserved for internal purposes and therefore must not be used.

SET /A E_SUCCESS=0x400
SET /A errno^|=%E_SUCCESS%

echo Operation: %1 %2 %3

echo Systemdrive:
cd %systemdrive%

REM Path to the Logfile.
SET LOGFILE=%systemdrive%\Tools\dism.log
echo Logfile: %LOGFILE%

REM Start backup or data recovery.
if "%1" == "Backup" (
dism /Capture-Image /ImageFile:"%2" /CaptureDir:%3 /Name:"WinOS" /ea /LogPath:%LOGFILE% /LogLevel:1

REM Check if an error occurred during the execution of dism.
REM In this case, the log file contains entries with the term "Error".
findstr /i "^, Error" %LOGFILE%
if %errorlevel% neq 0 (
EXIT /B %errorlevel%
)
) else (
diskpart /s %systemdrive%\Tools\diskpart.txt
dism /Apply-Image /ImageFile:"%2" /Index:1 /ApplyDir:W:\ /LogPath:%LOGFILE% /LogLevel:1
W:\Windows\System32\Bcdboot W:\Windows

REM Check if an error occurred during the execution of dism.
REM In this case, the log file contains entries with the term "Error".
findstr /i "^, Error" %LOGFILE%
if %errorlevel% neq 0 (
EXIT /B %errorlevel%
)

REM After the restore process, the ReAgent.xml must be deleted for systems that use BitLocker.
if "%1" == "Recovery" (
SET REAGENTFILE="W:\Windows\System32\Recovery\ReAgent.xml"
if EXIST "%REAGENTFILE%" (
del "%REAGENTFILE%"
)
)
)
EXIT /B %errno%
26 changes: 26 additions & 0 deletions wimbckup/diskpart.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
rem These commands are used with DiskPart tool for a UEFI/GPT-based PC.
rem Erase the drive and create five partitions
rem == Erase the entire drive ===========================================
select disk 0
clean
convert gpt
rem == Create System Partition ==========================================
create partition efi size=100
rem ** NOTE: For 4KB-per-sector drives, change this value to size=260. **
format quick fs=fat32 label="System"
assign letter="S"
rem == Create Microsoft Reserved (MSR) Partition ========================
create partition msr size=16
rem == Create Windows Partition =========================================
create partition primary
rem == Create space for Windows RE tools partition ======================
shrink minimum=450
rem == Format the Windows partition =====================================
format quick fs=ntfs label="Windows"
assign letter="W"
rem == Create the Windows RE Tools Partition ============================
create partition primary
format quick fs=ntfs label="Windows RE tools"
set id=de94bba4-06d1-4d40-a16a-bfd50179d6ac
assign letter="T"
exit
Loading

0 comments on commit ed0fb7e

Please sign in to comment.