diff options
author | Igor Pavlov <ipavlov@users.sourceforge.net> | 2009-02-03 03:00:00 +0300 |
---|---|---|
committer | Kornel LesiĆski <kornel@geekhood.net> | 2016-05-28 02:15:59 +0300 |
commit | 8874e4fbc9faabdcff719b9b2ac8ebad4f282bbe (patch) | |
tree | 4180f817b3d10dc34cde8b7ccc8c589eae4b26d3 /CPP/7zip/UI/FileManager | |
parent | 1dc92281fa580c11a79fef9fc862a6ce354a76ac (diff) |
4.654.65
Diffstat (limited to 'CPP/7zip/UI/FileManager')
-rwxr-xr-x | CPP/7zip/UI/FileManager/App.cpp | 2 | ||||
-rwxr-xr-x | CPP/7zip/UI/FileManager/FM.dsp | 28 | ||||
-rwxr-xr-x | CPP/7zip/UI/FileManager/PanelCrc.cpp | 62 | ||||
-rwxr-xr-x | CPP/7zip/UI/FileManager/RegistryAssociations.cpp | 3 | ||||
-rwxr-xr-x | CPP/7zip/UI/FileManager/makefile | 1 |
5 files changed, 82 insertions, 14 deletions
diff --git a/CPP/7zip/UI/FileManager/App.cpp b/CPP/7zip/UI/FileManager/App.cpp index 11c76458..f4f0bde7 100755 --- a/CPP/7zip/UI/FileManager/App.cpp +++ b/CPP/7zip/UI/FileManager/App.cpp @@ -151,7 +151,7 @@ static void CreateToolbar( imageList.Create( LargeButtons ? 48: 24, LargeButtons ? 36: 24, - ILC_MASK, 0, 0); + ILC_MASK | ILC_COLOR32, 0, 0); toolBar.SetImageList(0, imageList); } diff --git a/CPP/7zip/UI/FileManager/FM.dsp b/CPP/7zip/UI/FileManager/FM.dsp index d13e0a1f..6727b085 100755 --- a/CPP/7zip/UI/FileManager/FM.dsp +++ b/CPP/7zip/UI/FileManager/FM.dsp @@ -657,6 +657,34 @@ SOURCE=..\..\..\..\C\Alloc.h # End Source File # Begin Source File +SOURCE=..\..\..\..\C\Sha256.c + +!IF "$(CFG)" == "FM - Win32 Release" + +# ADD CPP /O2 +# SUBTRACT CPP /YX /Yc /Yu + +!ELSEIF "$(CFG)" == "FM - Win32 Debug" + +# SUBTRACT CPP /YX /Yc /Yu + +!ELSEIF "$(CFG)" == "FM - Win32 ReleaseU" + +# SUBTRACT CPP /YX /Yc /Yu + +!ELSEIF "$(CFG)" == "FM - Win32 DebugU" + +# SUBTRACT CPP /YX /Yc /Yu + +!ENDIF + +# End Source File +# Begin Source File + +SOURCE=..\..\..\..\C\Sha256.h +# End Source File +# Begin Source File + SOURCE=..\..\..\..\C\Sort.c # SUBTRACT CPP /YX /Yc /Yu # End Source File diff --git a/CPP/7zip/UI/FileManager/PanelCrc.cpp b/CPP/7zip/UI/FileManager/PanelCrc.cpp index d6dbd069..61a84050 100755 --- a/CPP/7zip/UI/FileManager/PanelCrc.cpp +++ b/CPP/7zip/UI/FileManager/PanelCrc.cpp @@ -2,30 +2,31 @@ #include "StdAfx.h" -#include "resource.h" - extern "C" { #include "../../../../C/Alloc.h" #include "../../../../C/7zCrc.h" + #include "../../../../C/Sha256.h" } #include "Common/IntToString.h" #include "Common/StringConvert.h" -#include "Windows/FileIO.h" +#include "Windows/Error.h" #include "Windows/FileFind.h" +#include "Windows/FileIO.h" #include "Windows/FileName.h" #include "Windows/Thread.h" -#include "Windows/Error.h" -#include "ProgressDialog2.h" #include "OverwriteDialogRes.h" +#include "ProgressDialog2.h" #include "App.h" #include "FormatUtils.h" #include "LangUtils.h" +#include "resource.h" + using namespace NWindows; using namespace NFile; using namespace NName; @@ -125,10 +126,12 @@ struct CThreadCrc CDirEnumerator DirEnumerator; + UInt64 NumFilesScan; UInt64 NumFiles; UInt64 NumFolders; UInt64 DataSize; UInt32 DataCrcSum; + Byte Sha256Sum[SHA256_DIGEST_SIZE]; UInt32 DataNameCrcSum; HRESULT Result; @@ -139,7 +142,8 @@ struct CThreadCrc void Process2() { - DataSize = NumFolders = NumFiles = DataCrcSum = DataNameCrcSum = 0; + DataSize = NumFolders = NumFiles = NumFilesScan = DataCrcSum = DataNameCrcSum = 0; + memset(Sha256Sum, 0, SHA256_DIGEST_SIZE); ProgressDialog->WaitCreating(); CMyBuffer bufferObject; @@ -172,14 +176,17 @@ struct CThreadCrc if (!filled) break; if (!fileInfo.IsDir()) + { totalSize += fileInfo.Size; + NumFilesScan++; + } ProgressDialog->ProgressSynch.SetCurrentFileName(scanningStr + resPath); ProgressDialog->ProgressSynch.SetProgress(totalSize, 0); Result = ProgressDialog->ProgressSynch.SetPosAndCheckPaused(0); if (Result != S_OK) return; } - + ProgressDialog->ProgressSynch.SetNumFilesTotal(NumFilesScan); ProgressDialog->ProgressSynch.SetProgress(totalSize, 0); DirEnumerator.Init(); @@ -199,6 +206,9 @@ struct CThreadCrc break; UInt32 crc = CRC_INIT_VAL; + CSha256 sha256; + Sha256_Init(&sha256); + if (fileInfo.IsDir()) NumFolders++; else @@ -211,8 +221,9 @@ struct CThreadCrc ErrorPath = resPath; return; } - NumFiles++; ProgressDialog->ProgressSynch.SetCurrentFileName(resPath); + ProgressDialog->ProgressSynch.SetNumFilesCur(NumFiles); + NumFiles++; for (;;) { UInt32 processedSize; @@ -226,12 +237,17 @@ struct CThreadCrc if (processedSize == 0) break; crc = CrcUpdate(crc, buffer, processedSize); + if (NumFilesScan == 1) + Sha256_Update(&sha256, buffer, processedSize); + DataSize += processedSize; Result = ProgressDialog->ProgressSynch.SetPosAndCheckPaused(DataSize); if (Result != S_OK) return; } DataCrcSum += CRC_GET_DIGEST(crc); + if (NumFilesScan == 1) + Sha256_Final(&sha256, Sha256Sum); } for (int i = 0; i < resPath.Length(); i++) { @@ -259,13 +275,22 @@ struct CThreadCrc } }; -static void ConvertUInt32ToHex(UInt32 value, wchar_t *s) +static void ConvertByteToHex(unsigned value, wchar_t *s) { - for (int i = 0; i < 8; i++) + for (int i = 0; i < 2; i++) { - int t = value & 0xF; + unsigned t = value & 0xF; value >>= 4; - s[7 - i] = (wchar_t)((t < 10) ? (L'0' + t) : (L'A' + (t - 10))); + s[1 - i] = (wchar_t)((t < 10) ? (L'0' + t) : (L'A' + (t - 10))); + } +} + +static void ConvertUInt32ToHex(UInt32 value, wchar_t *s) +{ + for (int i = 6; i >= 0; i -= 2) + { + ConvertByteToHex(value & 0xFF, s + i); + value >>= 8; } s[8] = L'\0'; } @@ -360,6 +385,19 @@ void CApp::CalculateCrc() s += L" "; ConvertUInt32ToHex(combiner.DataNameCrcSum, sz); s += sz; + s += L"\n"; + + if (combiner.NumFiles == 1 && combiner.NumFilesScan == 1) + { + s += L"SHA-256: "; + for (int i = 0; i < SHA256_DIGEST_SIZE; i++) + { + wchar_t s2[4]; + ConvertByteToHex(combiner.Sha256Sum[i], s2); + s2[2] = 0; + s += s2; + } + } } srcPanel.MessageBoxInfo(s, LangString(IDS_CHECKSUM_INFORMATION, 0x03020720)); } diff --git a/CPP/7zip/UI/FileManager/RegistryAssociations.cpp b/CPP/7zip/UI/FileManager/RegistryAssociations.cpp index 93340c3f..8c6e6ae8 100755 --- a/CPP/7zip/UI/FileManager/RegistryAssociations.cpp +++ b/CPP/7zip/UI/FileManager/RegistryAssociations.cpp @@ -126,7 +126,8 @@ static bool CheckShellExtensionInfo2(const CSysString &extension, UString &iconP if (extKey.QueryValue(NULL, programNameValue) != ERROR_SUCCESS) return false; CSysString extProgramKeyName = GetExtProgramKeyName(extension); - if (programNameValue.CompareNoCase(extProgramKeyName) != 0) + UString programNameValueU = GetUnicodeString(programNameValue); + if (programNameValueU.CompareNoCase(GetUnicodeString(extProgramKeyName)) != 0) return false; CKey iconKey; if (extKey.Open(HKEY_CLASSES_ROOT, extProgramKeyName + CSysString(TEXT(CHAR_PATH_SEPARATOR)) + kDefaultIconKeyName, KEY_READ) != ERROR_SUCCESS) diff --git a/CPP/7zip/UI/FileManager/makefile b/CPP/7zip/UI/FileManager/makefile index bc1d2662..86bdd85f 100755 --- a/CPP/7zip/UI/FileManager/makefile +++ b/CPP/7zip/UI/FileManager/makefile @@ -149,6 +149,7 @@ AGENT_OBJS = \ C_OBJS = \ $O\Alloc.obj \ + $O\Sha256.obj \ $O\Sort.obj \ $O\Threads.obj \ |