diff options
author | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2016-12-27 02:45:55 +0100 |
---|---|---|
committer | Markus Mohrhard <markus.mohrhard@googlemail.com> | 2017-05-19 03:43:26 +0200 |
commit | 7eca4fa00fc383a40b9957ff3c4b038ac02c2eef (patch) | |
tree | d96d62304f2a6e87336e85551ceeb2b73f80f809 /onlineupdate/source/service/servicebase.cxx | |
parent | extract the common updater code to an own static library (diff) | |
download | core-7eca4fa00fc383a40b9957ff3c4b038ac02c2eef.tar.gz core-7eca4fa00fc383a40b9957ff3c4b038ac02c2eef.zip |
get the update service working
Change-Id: I25921090083f20c4bb416f9cfdd5ec6400a27a21
Diffstat (limited to 'onlineupdate/source/service/servicebase.cxx')
-rw-r--r-- | onlineupdate/source/service/servicebase.cxx | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/onlineupdate/source/service/servicebase.cxx b/onlineupdate/source/service/servicebase.cxx index 2bed24be1cdb..1b4f406f431e 100644 --- a/onlineupdate/source/service/servicebase.cxx +++ b/onlineupdate/source/service/servicebase.cxx @@ -3,10 +3,9 @@ * file, You can obtain one at http://mozilla.org/MPL/2.0/. */ #include "servicebase.hxx" -#include "nsWindowsHelpers.hxx" +#include "windowsHelper.hxx" // Shared code between applications and updater.exe -#include "nsWindowsRestart.cpp" /** * Verifies if 2 files are byte for byte equivalent. @@ -20,19 +19,19 @@ BOOL VerifySameFiles(LPCWSTR file1Path, LPCWSTR file2Path, BOOL &sameContent) { sameContent = FALSE; - nsAutoHandle file1(CreateFileW(file1Path, GENERIC_READ, FILE_SHARE_READ, + AutoHandle file1(CreateFileW(file1Path, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, 0, nullptr)); - if (INVALID_HANDLE_VALUE == file1) { + if (file1 == INVALID_HANDLE_VALUE) { return FALSE; } - nsAutoHandle file2(CreateFileW(file2Path, GENERIC_READ, FILE_SHARE_READ, + AutoHandle file2(CreateFileW(file2Path, GENERIC_READ, FILE_SHARE_READ, nullptr, OPEN_EXISTING, 0, nullptr)); - if (INVALID_HANDLE_VALUE == file2) { + if (file2 == INVALID_HANDLE_VALUE) { return FALSE; } - DWORD fileSize1 = GetFileSize(file1, nullptr); - DWORD fileSize2 = GetFileSize(file2, nullptr); + DWORD fileSize1 = GetFileSize(file1.get(), nullptr); + DWORD fileSize2 = GetFileSize(file2.get(), nullptr); if (INVALID_FILE_SIZE == fileSize1 || INVALID_FILE_SIZE == fileSize2) { return FALSE; } @@ -48,12 +47,12 @@ VerifySameFiles(LPCWSTR file1Path, LPCWSTR file2Path, BOOL &sameContent) DWORD leftOver = fileSize1 % COMPARE_BLOCKSIZE; DWORD readAmount; for (DWORD i = 0; i < numBlocks; i++) { - if (!ReadFile(file1, buf1, COMPARE_BLOCKSIZE, &readAmount, nullptr) || + if (!ReadFile(file1.get(), buf1, COMPARE_BLOCKSIZE, &readAmount, nullptr) || readAmount != COMPARE_BLOCKSIZE) { return FALSE; } - if (!ReadFile(file2, buf2, COMPARE_BLOCKSIZE, &readAmount, nullptr) || + if (!ReadFile(file2.get(), buf2, COMPARE_BLOCKSIZE, &readAmount, nullptr) || readAmount != COMPARE_BLOCKSIZE) { return FALSE; } @@ -65,12 +64,12 @@ VerifySameFiles(LPCWSTR file1Path, LPCWSTR file2Path, BOOL &sameContent) } if (leftOver) { - if (!ReadFile(file1, buf1, leftOver, &readAmount, nullptr) || + if (!ReadFile(file1.get(), buf1, leftOver, &readAmount, nullptr) || readAmount != leftOver) { return FALSE; } - if (!ReadFile(file2, buf2, leftOver, &readAmount, nullptr) || + if (!ReadFile(file2.get(), buf2, leftOver, &readAmount, nullptr) || readAmount != leftOver) { return FALSE; } |