Hello community,

here is the log from the commit of package UEFITool for openSUSE:Factory 
checked in at 2017-07-25 11:40:40
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/UEFITool (Old)
 and      /work/SRC/openSUSE:Factory/.UEFITool.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Package is "UEFITool"

Tue Jul 25 11:40:40 2017 rev:2 rq:512273 version:20170506

Changes:
--------
--- /work/SRC/openSUSE:Factory/UEFITool/UEFITool.changes        2017-03-15 
02:00:10.825305190 +0100
+++ /work/SRC/openSUSE:Factory/.UEFITool.new/UEFITool.changes   2017-07-25 
11:41:16.188942464 +0200
@@ -1,0 +2,6 @@
+Mon Jul 24 13:12:13 UTC 2017 - mplus...@suse.com
+
+- Update to version 20170506:
+  * Add UEFIReplace.
+
+-------------------------------------------------------------------

Old:
----
  UEFITool-20170212.tar.xz

New:
----
  UEFITool-20170506.tar.xz

++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++

Other differences:
------------------
++++++ UEFITool.spec ++++++
--- /var/tmp/diff_new_pack.dHP9jd/_old  2017-07-25 11:41:16.692871318 +0200
+++ /var/tmp/diff_new_pack.dHP9jd/_new  2017-07-25 11:41:16.692871318 +0200
@@ -17,7 +17,7 @@
 
 
 Name:           UEFITool
-Version:        20170212
+Version:        20170506
 Release:        0
 Summary:        Tools to inspect and work on UEFI BIOSes
 License:        BSD-2-Clause
@@ -41,7 +41,7 @@
 %build
 %qmake5
 %make_jobs
-for i in UEFIExtract UEFIFind UEFIPatch; do
+for i in UEFIExtract UEFIFind UEFIPatch UEFIReplace; do
   pushd $i
     %qmake5
     %make_jobs
@@ -51,7 +51,7 @@
 %install
 install -D -p -m 0755 UEFITool \
   %{buildroot}/%{_bindir}/UEFITool
-for i in UEFIExtract UEFIFind UEFIPatch; do
+for i in UEFIExtract UEFIFind UEFIPatch UEFIReplace; do
   pushd $i
     install -D -p -m 0755 $i %{buildroot}/%{_bindir}/$i
   popd
@@ -64,5 +64,6 @@
 %{_bindir}/UEFIExtract
 %{_bindir}/UEFIFind
 %{_bindir}/UEFIPatch
+%{_bindir}/UEFIReplace
 
 %changelog

++++++ UEFITool-20170212.tar.xz -> UEFITool-20170506.tar.xz ++++++
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/UEFITool-20170212/.gitattributes 
new/UEFITool-20170506/.gitattributes
--- old/UEFITool-20170212/.gitattributes        1970-01-01 01:00:00.000000000 
+0100
+++ new/UEFITool-20170506/.gitattributes        2017-05-07 02:24:47.000000000 
+0200
@@ -0,0 +1,22 @@
+# Auto detect text files and perform LF normalization
+* text=auto
+
+# Custom for Visual Studio
+*.cs     diff=csharp
+*.sln    merge=union
+*.csproj merge=union
+*.vbproj merge=union
+*.fsproj merge=union
+*.dbproj merge=union
+
+# Standard to msysgit
+*.doc   diff=astextplain
+*.DOC   diff=astextplain
+*.docx diff=astextplain
+*.DOCX diff=astextplain
+*.dot  diff=astextplain
+*.DOT  diff=astextplain
+*.pdf  diff=astextplain
+*.PDF   diff=astextplain
+*.rtf   diff=astextplain
+*.RTF   diff=astextplain
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/UEFITool-20170212/UEFIReplace/uefireplace.cpp 
new/UEFITool-20170506/UEFIReplace/uefireplace.cpp
--- old/UEFITool-20170212/UEFIReplace/uefireplace.cpp   1970-01-01 
01:00:00.000000000 +0100
+++ new/UEFITool-20170506/UEFIReplace/uefireplace.cpp   2017-05-07 
02:24:47.000000000 +0200
@@ -0,0 +1,108 @@
+/* uefireplace.cpp
+
+Copyright (c) 2017, mxxxc. All rights reserved.
+This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD 
License
+which accompanies this distribution.  The full text of the license may be 
found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+*/
+
+#include "uefireplace.h"
+
+UEFIReplace::UEFIReplace(QObject *parent) :
+    QObject(parent)
+{
+    ffsEngine = new FfsEngine(this);
+    model = ffsEngine->treeModel();
+}
+
+UEFIReplace::~UEFIReplace()
+{
+    delete ffsEngine;
+}
+
+UINT8 UEFIReplace::replace(QString inPath, const QByteArray & guid, const 
UINT8 sectionType, const QString contentPath)
+{
+    QFileInfo fileInfo = QFileInfo(inPath);
+    if (!fileInfo.exists())
+        return ERR_FILE_OPEN;
+
+    fileInfo = QFileInfo(contentPath);
+    if (!fileInfo.exists())
+        return ERR_FILE_OPEN;
+
+    QFile inputFile;
+    inputFile.setFileName(inPath);
+
+    if (!inputFile.open(QFile::ReadOnly))
+        return ERR_FILE_READ;
+
+    QByteArray buffer = inputFile.readAll();
+    inputFile.close();
+
+    UINT8 result = ffsEngine->parseImageFile(buffer);
+    if (result)
+        return result;
+
+    QFile contentFile;
+    contentFile.setFileName(contentPath);
+
+    if (!contentFile.open(QFile::ReadOnly))
+        return ERR_FILE_READ;
+
+    QByteArray contents = contentFile.readAll();
+    contentFile.close();
+
+    result = replaceInFile(model->index(0, 0), guid, sectionType, contents);
+    if (result)
+        return result;
+
+    QByteArray reconstructed;
+    result = ffsEngine->reconstructImageFile(reconstructed);
+    if (result)
+        return result;
+    if (reconstructed == buffer)
+        return ERR_NOTHING_TO_PATCH;
+
+    QFile outputFile;
+    outputFile.setFileName(inPath.append(".patched"));
+    if (!outputFile.open(QFile::WriteOnly))
+        return ERR_FILE_WRITE;
+
+    outputFile.resize(0);
+    outputFile.write(reconstructed);
+    outputFile.close();
+
+    return ERR_SUCCESS;
+}
+
+UINT8 UEFIReplace::replaceInFile(const QModelIndex & index, const QByteArray & 
guid, const UINT8 sectionType, const QByteArray & newData)
+{
+    if (!model || !index.isValid())
+        return ERR_INVALID_PARAMETER;
+    if (model->subtype(index) == sectionType) {
+        QModelIndex fileIndex = model->findParentOfType(index, Types::File);
+        QByteArray fileGuid = model->header(fileIndex).left(sizeof(EFI_GUID));
+        if (fileGuid == guid) {
+            return ffsEngine->replace(index, newData, REPLACE_MODE_BODY);
+        }
+    }
+
+    bool patched = false;
+    if (model->rowCount(index) > 0) {
+        for (int i = 0; i < model->rowCount(index); i++) {
+            UINT8 result = replaceInFile(index.child(i, 0), guid, sectionType, 
newData);
+            if (!result) {
+                patched = true;
+                break;
+            } else if (result != ERR_NOTHING_TO_PATCH)
+                return result;
+        }
+    }
+
+    return patched ? ERR_SUCCESS : ERR_NOTHING_TO_PATCH;
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/UEFITool-20170212/UEFIReplace/uefireplace.h 
new/UEFITool-20170506/UEFIReplace/uefireplace.h
--- old/UEFITool-20170212/UEFIReplace/uefireplace.h     1970-01-01 
01:00:00.000000000 +0100
+++ new/UEFITool-20170506/UEFIReplace/uefireplace.h     2017-05-07 
02:24:47.000000000 +0200
@@ -0,0 +1,41 @@
+/* uefireplace.h
+Copyright (c) 2017, mxxxc. All rights reserved.
+This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD 
License
+which accompanies this distribution.  The full text of the license may be 
found at
+http://opensource.org/licenses/bsd-license.php
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+*/
+
+#ifndef __UEFIREPLACE_H__
+#define __UEFIREPLACE_H__
+
+#include <QObject>
+#include <QByteArray>
+#include <QString>
+#include <QStringList>
+#include <QFileInfo>
+#include <QUuid>
+
+#include "../basetypes.h"
+#include "../ffs.h"
+#include "../ffsengine.h"
+
+class UEFIReplace : public QObject
+{
+    Q_OBJECT
+
+public:
+    explicit UEFIReplace(QObject *parent = 0);
+    ~UEFIReplace();
+
+    UINT8 replace(const QString inPath, const QByteArray & guid, const UINT8 
sectionType, const QString contentPath);
+
+private:
+    UINT8 replaceInFile(const QModelIndex & index, const QByteArray & guid, 
const UINT8 sectionType, const QByteArray & contents);
+    FfsEngine* ffsEngine;
+    TreeModel* model;
+};
+
+#endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/UEFITool-20170212/UEFIReplace/uefireplace.pro 
new/UEFITool-20170506/UEFIReplace/uefireplace.pro
--- old/UEFITool-20170212/UEFIReplace/uefireplace.pro   1970-01-01 
01:00:00.000000000 +0100
+++ new/UEFITool-20170506/UEFIReplace/uefireplace.pro   2017-05-07 
02:24:47.000000000 +0200
@@ -0,0 +1,42 @@
+QT       += core
+QT       -= gui
+
+TARGET    = UEFIReplace
+TEMPLATE  = app
+CONFIG   += console
+CONFIG   -= app_bundle
+DEFINES  += _CONSOLE
+
+SOURCES  += uefireplace_main.cpp \
+ uefireplace.cpp \
+ ../types.cpp \
+ ../descriptor.cpp \
+ ../ffs.cpp \
+ ../ffsengine.cpp \
+ ../peimage.cpp \
+ ../treeitem.cpp \
+ ../treemodel.cpp \
+ ../LZMA/LzmaCompress.c \
+ ../LZMA/LzmaDecompress.c \
+ ../LZMA/SDK/C/LzFind.c \
+ ../LZMA/SDK/C/LzmaDec.c \
+ ../LZMA/SDK/C/LzmaEnc.c \
+ ../Tiano/EfiTianoDecompress.c \
+ ../Tiano/EfiTianoCompress.c \
+ ../Tiano/EfiTianoCompressLegacy.c
+
+HEADERS  += uefireplace.h \
+ ../basetypes.h \
+ ../descriptor.h \
+ ../gbe.h \
+ ../me.h \
+ ../ffs.h \
+ ../peimage.h \
+ ../types.h \
+ ../ffsengine.h \
+ ../treeitem.h \
+ ../treemodel.h \
+ ../LZMA/LzmaCompress.h \
+ ../LZMA/LzmaDecompress.h \
+ ../Tiano/EfiTianoDecompress.h \
+ ../Tiano/EfiTianoCompress.h
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' 
'--exclude=.svnignore' old/UEFITool-20170212/UEFIReplace/uefireplace_main.cpp 
new/UEFITool-20170506/UEFIReplace/uefireplace_main.cpp
--- old/UEFITool-20170212/UEFIReplace/uefireplace_main.cpp      1970-01-01 
01:00:00.000000000 +0100
+++ new/UEFITool-20170506/UEFIReplace/uefireplace_main.cpp      2017-05-07 
02:24:47.000000000 +0200
@@ -0,0 +1,78 @@
+/* uefireplace_main.cpp
+
+Copyright (c) 2017, mxxxc. All rights reserved.
+This program and the accompanying materials
+are licensed and made available under the terms and conditions of the BSD 
License
+which accompanies this distribution.  The full text of the license may be 
found at
+http://opensource.org/licenses/bsd-license.php
+
+THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
+WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
+
+*/
+#include <QCoreApplication>
+#include <QString>
+#include <QStringList>
+#include <iostream>
+#include "uefireplace.h"
+
+int main(int argc, char *argv[])
+{
+    QCoreApplication a(argc, argv);
+    a.setOrganizationName("CodeRush");
+    a.setOrganizationDomain("coderush.me");
+    a.setApplicationName("UEFIReplace");
+
+    UEFIReplace r;
+    UINT8 result = ERR_SUCCESS;
+    QStringList args = a.arguments();
+
+    if (args.length() < 5) {
+        std::cout << "UEFIReplace 0.3.9 - UEFI image file replacement utility" 
<< std::endl << std::endl <<
+            "Usage: UEFIReplace image_file guid section_type contents_file" << 
std::endl;
+        return ERR_SUCCESS;
+    }
+
+    QUuid uuid = QUuid(args.at(2));
+    QByteArray guid = QByteArray::fromRawData((const char*)&uuid.data1, 
sizeof(EFI_GUID));
+    bool converted;
+    UINT8 sectionType = (UINT8)args.at(3).toUShort(&converted, 16);
+    if (!converted)
+        result = ERR_INVALID_PARAMETER;
+    else
+        result = r.replace(args.at(1), guid, sectionType, args.at(4));
+
+    switch (result) {
+    case ERR_SUCCESS:
+        std::cout << "File replaced" << std::endl;
+        break;
+    case ERR_INVALID_PARAMETER:
+        std::cout << "Function called with invalid parameter" << std::endl;
+        break;
+    case ERR_INVALID_FILE:
+        std::cout << "Invalid/corrupted file specified" << std::endl;
+        break;
+    case ERR_INVALID_SECTION:
+        std::cout << "Invalid/corrupted section specified" << std::endl;
+        break;
+    case ERR_NOTHING_TO_PATCH:
+        std::cout << "No replacements can be applied to input file" << 
std::endl;
+        break;
+    case ERR_NOT_IMPLEMENTED:
+        std::cout << "Can't replace body of this section type" << std::endl;
+        break;
+    case ERR_FILE_OPEN:
+        std::cout << "Input file not found" << std::endl;
+        break;
+    case ERR_FILE_READ:
+        std::cout << "Input file can't be read" << std::endl;
+        break;
+    case ERR_FILE_WRITE:
+        std::cout << "Output file can't be written" << std::endl;
+        break;
+    default:
+        std::cout << "Error " << result << std::endl;
+    }
+
+    return result;
+}

++++++ _servicedata ++++++
--- /var/tmp/diff_new_pack.dHP9jd/_old  2017-07-25 11:41:16.864847037 +0200
+++ /var/tmp/diff_new_pack.dHP9jd/_new  2017-07-25 11:41:16.868846473 +0200
@@ -1,4 +1,4 @@
 <servicedata>
 <service name="tar_scm">
                 <param 
name="url">https://github.com/LongSoft/UEFITool.git</param>
-              <param 
name="changesrevision">b700177e4a8eb9e88efac7c8d04aea037927d8e9</param></service></servicedata>
\ No newline at end of file
+              <param 
name="changesrevision">5ba63418bde66681ae81b8f1ae890ab65d746752</param></service></servicedata>
\ No newline at end of file


Reply via email to