diff --git a/appveyor.yml b/appveyor.yml index 79880b6e3..2a8d7503c 100644 --- a/appveyor.yml +++ b/appveyor.yml @@ -16,9 +16,9 @@ install: - git submodule init - git submodule update - # The appveyor image contains cmake 4.1 only, which doesn't support VS 2016. + # The appveyor image contains cmake 4.1 only, which doesn't support VS 2026. # Download cmake 4.3.0 and add it to the PATH. - - appveyor DownloadFile https://cmake.org/files/v4.3/cmake-4.3.0-windows-x86_64.zip -FileName cmake43.zip + - appveyor DownloadFile https://github.com/Kitware/CMake/releases/download/v4.3.0/cmake-4.3.0-windows-x86_64.zip -FileName cmake43.zip - 7z x cmake43.zip -oC:\cmake43 - set "PATH=C:\cmake43\cmake-4.3.0-windows-x86_64\bin;%PATH%" - cmake --version # should print 4.3.0 diff --git a/installer/installer.nsi b/installer/installer.nsi index 3ce255c06..881e39a81 100644 --- a/installer/installer.nsi +++ b/installer/installer.nsi @@ -31,8 +31,6 @@ !addplugindir /x86-unicode "StdUtils.2015-11-16\Plugins\Release_Unicode" !include "StdUtils.nsh" ; for ExecShellAsUser() -; We need the MD5 plugin -!addplugindir /x86-unicode "md5dll\UNICODE" ; We need the INetC (internet client) plugin ; https://nsis.sourceforge.io/Inetc_plug-in @@ -133,27 +131,15 @@ Function uninstallOldVersion !insertmacro UnregisterTextService 64 "$INSTDIR\x64\PIMETextService.dll" ${ElseIf} ${IsNativeARM64} !insertmacro UnregisterTextService 64 "$INSTDIR\arm64\PIMETextService.dll" - ${If} ${FileExists} "$INSTDIR\x64" - !insertmacro UnregisterTextService 64 "$INSTDIR\x64\PIMETextService.dll" - !insertmacro SafeDeleteFile "$INSTDIR\x64\PIMETextService.dll" - RMDir /REBOOTOK "$INSTDIR\x64" - ${EndIf} ${EndIf} ; Remove the launcher from auto-start and clean registry !insertmacro CleanPIMERegistry - ; NOTE: Why binary files (DLLs, EXE) and binary folders (x86, x64, arm64) are NOT deleted here: - ; 1. Folders: On Windows, scheduling directories for deletion on reboot (via RMDir /REBOOTOK) - ; while this installer is about to install new files into those exact same directories - ; would cause Windows PendingFileRenameOperations to wipe the newly installed directories - ; on the next system reboot. - ; 2. Binaries: PIMELauncher.exe and PIMETextService.dll are handled cleanly by InstallOrSkip - ; later in the installation sections. If their MD5 checksum matches the new version, they - ; are kept untouched without unnecessary writes or reboot requirements. If their MD5 - ; differs and they are currently locked by active applications, InstallOrSkip safely renames - ; the locked file to a unique .deleted temporary file, freeing the path so the new binary - ; can be installed immediately without forcing a reboot. + ; Safely remove or rename old binaries so the destination paths are free for writing. + ; If files are locked by running applications, SafeDeleteFile renames them to unique + ; temporary files scheduled for deletion on reboot without blocking immediate installation. + !insertmacro CleanOldBinaries ; Clean old backend and data files Delete "$INSTDIR\backends.json" @@ -223,16 +209,6 @@ Function .onInit Reboot ${EndIf} - ; Extract candidate binaries into $PLUGINSDIR (NSIS temporary plugin directory, - ; which Windows automatically cleans up when the installer exits). - ; This allows InstallOrSkip to compute MD5 checksums of the new candidates against - ; existing files on disk, and copy them safely via CopyFiles without triggering - ; raw NSIS "File write error: Abort/Retry/Ignore" popups when files are in use. - File "/oname=$PLUGINSDIR\PIMETextService_x86.dll" "..\build\PIMETextService\Release\PIMETextService.dll" - File "/oname=$PLUGINSDIR\PIMETextService_x64.dll" "..\build64\PIMETextService\Release\PIMETextService.dll" - File "/oname=$PLUGINSDIR\PIMETextService_arm64.dll" "..\build_arm64\PIMETextService\Release\PIMETextService_arm64.dll" - File "/oname=$PLUGINSDIR\PIMETextService_arm64x.dll" "..\build_arm64\PIMETextService\Release\PIMETextService.dll" - File "/oname=$PLUGINSDIR\PIMELauncher.exe" "..\build\PIMELauncher\PIMELauncher.exe" StrCpy $INST_PYTHON "False" StrCpy $INST_CINBASE "False" @@ -317,8 +293,14 @@ Section $(SECTION_MAIN) SecMain ; Install backend informations File "..\backends.json" + ; Ensure any existing in-use binaries in $INSTDIR are safely cleared before writing + !insertmacro CleanOldBinaries + ${If} ${RebootFlag} + Call .onInstFailed + ${EndIf} + ; Install the launcher responsible to launch the backends - !insertmacro InstallOrSkip "$INSTDIR\PIMELauncher.exe" "$PLUGINSDIR\PIMELauncher.exe" + File "..\build\PIMELauncher\PIMELauncher.exe" SectionEnd SectionGroup /e $(PYTHON_SECTION_GROUP) python_section_group @@ -510,20 +492,23 @@ Section "" Register ; Install the text service dlls ${If} ${IsNativeAMD64} ; This is a 64-bit x86-64/x64 Windows system - !insertmacro InstallOrSkip "$INSTDIR\x64\PIMETextService.dll" "$PLUGINSDIR\PIMETextService_x64.dll" + SetOutPath "$INSTDIR\x64" + File "..\build64\PIMETextService\Release\PIMETextService.dll" !insertmacro RegisterTextService 64 "$INSTDIR\x64\PIMETextService.dll" ${ElseIf} ${IsNativeARM64} ; This is a native ARM64 Windows system - ; ARM64X forwarder DLL - !insertmacro InstallOrSkip "$INSTDIR\arm64\PIMETextService.dll" "$PLUGINSDIR\PIMETextService_arm64x.dll" - ; Real native ARM64 DLL - !insertmacro InstallOrSkip "$INSTDIR\arm64\PIMETextService_arm64.dll" "$PLUGINSDIR\PIMETextService_arm64.dll" - ; Real x64 DLL for emulated x64 / ARM64EC processes - !insertmacro InstallOrSkip "$INSTDIR\arm64\PIMETextService_x64.dll" "$PLUGINSDIR\PIMETextService_x64.dll" + SetOutPath "$INSTDIR\arm64" + ; ARM64X forwarder DLL (built in build_arm64\PIMETextService\Release\PIMETextService.dll) + File "..\build_arm64\PIMETextService\Release\PIMETextService.dll" + ; Real native ARM64 DLL (built in build_arm64\PIMETextService\Release\PIMETextService_arm64.dll) + File "..\build_arm64\PIMETextService\Release\PIMETextService_arm64.dll" + ; Real x64 DLL for emulated x64 / ARM64EC processes (built in build64\PIMETextService\Release\PIMETextService.dll) + File "/oname=PIMETextService_x64.dll" "..\build64\PIMETextService\Release\PIMETextService.dll" ; Register COM objects (only register the ARM64X forwarder DLL) !insertmacro RegisterTextService 64 "$INSTDIR\arm64\PIMETextService.dll" ${EndIf} - !insertmacro InstallOrSkip "$INSTDIR\x86\PIMETextService.dll" "$PLUGINSDIR\PIMETextService_x86.dll" + SetOutPath "$INSTDIR\x86" + File "..\build\PIMETextService\Release\PIMETextService.dll" !insertmacro RegisterTextService 32 "$INSTDIR\x86\PIMETextService.dll" ; Launch the python server on startup @@ -603,7 +588,6 @@ Section "Uninstall" ; Try to terminate running PIMELauncher and the server process !insertmacro StopPIMELauncher - !insertmacro SafeDeleteFile "$INSTDIR\PIMELauncher.exe" ; Unregister COM objects (NSIS UnRegDLL command is broken and cannot be used) !insertmacro UnregisterTextService 32 "$INSTDIR\x86\PIMETextService.dll" @@ -619,20 +603,15 @@ Section "Uninstall" ; Remove auto-start, uninstall, and product keys from registry !insertmacro CleanPIMERegistry - ; Safely delete text service DLLs (which may be locked by running processes) - !insertmacro SafeDeleteFile "$INSTDIR\x86\PIMETextService.dll" + ; Safely delete binaries (which may be locked by running processes) + !insertmacro CleanOldBinaries RMDir /REBOOTOK "$INSTDIR\x86" ${If} ${IsNativeAMD64} - !insertmacro SafeDeleteFile "$INSTDIR\x64\PIMETextService.dll" RMDir /REBOOTOK "$INSTDIR\x64" ${ElseIf} ${IsNativeARM64} - !insertmacro SafeDeleteFile "$INSTDIR\arm64\PIMETextService.dll" - !insertmacro SafeDeleteFile "$INSTDIR\arm64\PIMETextService_arm64.dll" - !insertmacro SafeDeleteFile "$INSTDIR\arm64\PIMETextService_x64.dll" RMDir /REBOOTOK "$INSTDIR\arm64" ${If} ${FileExists} "$INSTDIR\x64" - !insertmacro SafeDeleteFile "$INSTDIR\x64\PIMETextService.dll" RMDir /REBOOTOK "$INSTDIR\x64" ${EndIf} ${EndIf} diff --git a/installer/macros.nsh b/installer/macros.nsh index 2806368d3..9e5e959eb 100644 --- a/installer/macros.nsh +++ b/installer/macros.nsh @@ -1,4 +1,4 @@ -; NOTE: This file MUST be saved as UTF-8 with BOM (utf-8-sig) so that +; NOTE: This file MUST be saved as UTF-8 with BOM (utf-8-sig) so that ; NSIS (makensis) natively detects Unicode strings without breaking Git diffs. ; Do NOT convert this file to UTF-16. ; @@ -28,50 +28,6 @@ !define PIME_INSTALLER_MACROS_NSH -; ============================================================================== -; Macro: CheckFileMD5Equal -; ------------------------------------------------------------------------------ -; Compares the MD5 checksums of two files using the md5dll plugin. -; -; Parameters: -; FILE_A - Full path to first file. -; FILE_B - Full path to second file. -; OUT_VAR - Variable to store result: "True" if both files exist and have -; matching checksums; "False" otherwise. -; ============================================================================== -!macro CheckFileMD5Equal FILE_A FILE_B OUT_VAR - Push $R0 - Push $R1 - - !define md5A $R0 - !define md5B $R1 - !define isMatch $R1 ; reuse R1 for result - - StrCpy ${isMatch} "False" - ${If} ${FileExists} "${FILE_A}" - ${AndIf} ${FileExists} "${FILE_B}" - md5dll::GetMD5File "${FILE_A}" - Pop ${md5A} - md5dll::GetMD5File "${FILE_B}" - Pop ${md5B} - ${If} ${md5A} == ${md5B} - StrCpy ${isMatch} "True" - ${EndIf} - ${EndIf} - - Push ${isMatch} ; push result onto stack - - !undef md5A - !undef md5B - !undef isMatch - - Exch 2 - Pop $R0 - Pop $R1 - Pop ${OUT_VAR} -!macroend - - ; ============================================================================== ; Macro: SafeDeleteFile ; ------------------------------------------------------------------------------ @@ -84,9 +40,10 @@ ; - Generates a unique temporary filename in the same directory. ; - Attempts to rename TARGET_FILE to this unique temporary file. ; - If rename succeeds: schedules only the temporary file for deletion on -; reboot using Delete /REBOOTOK. +; reboot using Delete /REBOOTOK, and restores RebootFlag if no reboot was +; previously pending (as the destination path is now free for writing). ; - If rename fails (hard lock): schedules original TARGET_FILE on reboot -; and sets RebootFlag. +; and sets RebootFlag true. ; ; Parameters: ; TARGET_FILE - Path to file to delete. @@ -94,9 +51,17 @@ !macro SafeDeleteFile TARGET_FILE Push $R0 Push $R1 + Push $R2 !define sdf_tempDeletedFile $R0 !define sdf_targetDir $R1 + !define sdf_priorRebootFlag $R2 + + ; Save pre-existing RebootFlag state so we don't accidentally clear a reboot requested earlier + StrCpy ${sdf_priorRebootFlag} "0" + ${If} ${RebootFlag} + StrCpy ${sdf_priorRebootFlag} "1" + ${EndIf} ${If} ${FileExists} "${TARGET_FILE}" ClearErrors @@ -115,8 +80,14 @@ ${IfNot} ${Errors} ; Renamed: schedule only the unique file for deletion on reboot Delete /REBOOTOK "${sdf_tempDeletedFile}" + ; Delete /REBOOTOK sets RebootFlag internally. Since rename succeeded, + ; the destination path is now vacant and can be replaced immediately + ; without rebooting. Restore prior RebootFlag state. + ${If} ${sdf_priorRebootFlag} == "0" + SetRebootFlag false + ${EndIf} ${Else} - ; Hard-locked: schedule original target on reboot + ; Hard-locked: schedule original target on reboot and flag reboot requirement Delete /REBOOTOK "${TARGET_FILE}" SetRebootFlag true ${EndIf} @@ -125,97 +96,38 @@ !undef sdf_tempDeletedFile !undef sdf_targetDir + !undef sdf_priorRebootFlag + Pop $R2 Pop $R1 Pop $R0 !macroend ; ============================================================================== -; Macro: InstallOrSkip +; Macro: CleanOldBinaries ; ------------------------------------------------------------------------------ -; Installs a binary file (DLL / EXE) to a destination path, skipping the write -; if the target file already exists and has identical MD5 checksum. -; -; Expected Behavior: -; 1. Fast path: attempts direct CopyFiles. If target is not locked, this succeeds -; immediately with 0 hash calculations. -; 2. Target is locked: calculates MD5 of both target and source. -; 3. If MD5 matches: cleanly skips overwriting the file. -; 4. If MD5 differs: calls SafeDeleteFile to safely rename the locked target -; to a unique .deleted file, freeing the destination path so the new -; file can be copied directly without requiring a reboot. -; 5. If SafeDeleteFile hit a hard lock (rename failed): fails cleanly and prompts -; user to restart the computer. +; Safely removes or renames all PIME binary executables and DLLs in INSTDIR. +; If files are locked by running applications, renames them to temporary files +; and schedules them for deletion on reboot, freeing destination paths so new +; files can be installed immediately. ; ; Parameters: -; TARGET_FILE - Destination file path (e.g. "$INSTDIR\x86\PIMETextService.dll"). -; SOURCE_FILE - Source candidate file (e.g. "$PLUGINSDIR\PIMETextService_x86.dll"). +; None (operates on $INSTDIR, RunningX64, IsNativeARM64). ; ============================================================================== -!macro InstallOrSkip TARGET_FILE SOURCE_FILE - Push $R0 - Push $R1 - Push $R2 - - !define ios_isMD5Equal $R0 - !define ios_targetDir $R1 - !define ios_priorRebootFlag $R2 - - ; Save pre-existing RebootFlag state so we don't accidentally clear a reboot requested earlier - StrCpy ${ios_priorRebootFlag} "0" - ${If} ${RebootFlag} - StrCpy ${ios_priorRebootFlag} "1" - ${EndIf} - - ; Ensure parent directory exists - GetFullPathName ${ios_targetDir} "${TARGET_FILE}\.." - CreateDirectory "${ios_targetDir}" - - ; 1. Try unconditional write first (succeeds if file is new or not in use) - ClearErrors - CopyFiles /SILENT "${SOURCE_FILE}" "${TARGET_FILE}" - ${If} ${Errors} - ; 2. Write failed: target is locked / in use. - ; Check MD5: if identical, we don't need to overwrite it! Skip cleanly. - !insertmacro CheckFileMD5Equal "${TARGET_FILE}" "${SOURCE_FILE}" ${ios_isMD5Equal} - ${If} ${ios_isMD5Equal} != "True" - ; 3. Target is locked and MD5 differs: safely remove/rename the old file - !insertmacro SafeDeleteFile "${TARGET_FILE}" - ${IfNot} ${FileExists} "${TARGET_FILE}" - ; Rename succeeded: path is now freed on disk, copy new file into place - ClearErrors - CopyFiles /SILENT "${SOURCE_FILE}" "${TARGET_FILE}" - ${If} ${Errors} - ; Target write failed even after path was freed - SetRebootFlag true - MessageBox MB_YESNO|MB_ICONSTOP $(REBOOT_QUESTION) IDNO +2 - Reboot - Quit - ${Else} - ; Successfully replaced in place. - ; Delete /REBOOTOK on the renamed temporary file sets NSIS RebootFlag - ; internally. If no reboot was requested before this macro ran, clear - ; the flag so we don't prompt the user for an unnecessary reboot. - ${If} ${ios_priorRebootFlag} == "0" - SetRebootFlag false - ${EndIf} - ${EndIf} - ${Else} - ; 4. Hard lock: rename failed, cannot replace target without reboot. - MessageBox MB_YESNO|MB_ICONSTOP $(REBOOT_QUESTION) IDNO +2 - Reboot - Quit - ${EndIf} +!macro CleanOldBinaries + !insertmacro SafeDeleteFile "$INSTDIR\PIMELauncher.exe" + !insertmacro SafeDeleteFile "$INSTDIR\x86\PIMETextService.dll" + ${If} ${IsNativeAMD64} + !insertmacro SafeDeleteFile "$INSTDIR\x64\PIMETextService.dll" + ${ElseIf} ${IsNativeARM64} + !insertmacro SafeDeleteFile "$INSTDIR\arm64\PIMETextService.dll" + !insertmacro SafeDeleteFile "$INSTDIR\arm64\PIMETextService_arm64.dll" + !insertmacro SafeDeleteFile "$INSTDIR\arm64\PIMETextService_x64.dll" + ${If} ${FileExists} "$INSTDIR\x64\PIMETextService.dll" + !insertmacro SafeDeleteFile "$INSTDIR\x64\PIMETextService.dll" ${EndIf} ${EndIf} - - !undef ios_isMD5Equal - !undef ios_targetDir - !undef ios_priorRebootFlag - - Pop $R2 - Pop $R1 - Pop $R0 !macroend diff --git a/installer/md5dll/ANSI/md5dll.dll b/installer/md5dll/ANSI/md5dll.dll deleted file mode 100644 index 003e16378..000000000 Binary files a/installer/md5dll/ANSI/md5dll.dll and /dev/null differ diff --git a/installer/md5dll/MD5.cpp b/installer/md5dll/MD5.cpp deleted file mode 100644 index 588ae6c21..000000000 --- a/installer/md5dll/MD5.cpp +++ /dev/null @@ -1,367 +0,0 @@ -///////////////////////////////////////////////////////////////////////// -// MD5.cpp -// Implementation file for MD5 class -// -// This C++ Class implementation of the original RSA Data Security, Inc. -// MD5 Message-Digest Algorithm is copyright (c) 2002, Gary McNickle. -// All rights reserved. This software is a derivative of the "RSA Data -// Security, Inc. MD5 Message-Digest Algorithm" -// -// You may use this software free of any charge, but without any -// warranty or implied warranty, provided that you follow the terms -// of the original RSA copyright, listed below. -// -// Original RSA Data Security, Inc. Copyright notice -///////////////////////////////////////////////////////////////////////// -// -// Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All -// rights reserved. -// -// License to copy and use this software is granted provided that it -// is identified as the "RSA Data Security, Inc. MD5 Message-Digest -// Algorithm" in all material mentioning or referencing this software -// or this function. -// License is also granted to make and use derivative works provided -// that such works are identified as "derived from the RSA Data -// Security, Inc. MD5 Message-Digest Algorithm" in all material -// mentioning or referencing the derived work. -// RSA Data Security, Inc. makes no representations concerning either -// the merchantability of this software or the suitability of this -// software for any particular purpose. It is provided "as is" -// without express or implied warranty of any kind. -// These notices must be retained in any copies of any part of this -// documentation and/or software. -///////////////////////////////////////////////////////////////////////// - -#if 0 -#include -#include -#include -#include -#else -#define WIN32_LEAN_AND_MEAN -#include -#endif -#include "md5.h" - - -static unsigned char PADDING[64] = -{ - 0x80, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, - 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0 -}; - -#define S11 7 -#define S12 12 -#define S13 17 -#define S14 22 -#define S21 5 -#define S22 9 -#define S23 14 -#define S24 20 -#define S31 4 -#define S32 11 -#define S33 16 -#define S34 23 -#define S41 6 -#define S42 10 -#define S43 15 -#define S44 21 - - -// local version of memcpy -static void *lmemcpy(void *dest, const void *source, uint4 count) -{ - register char *dst=(char *)dest; - register char *src=(char *)source; - while (count--) - { - *dst = *src; - dst++; - src++; - } - return dest; -} - - -// PrintMD5: Converts a completed md5 digest into a char* string. -char* PrintMD5(uchar md5Digest[16]) -{ - char chBuffer[256]; - char chEach[10]; - int nCount; - - register int i; - //memset(chBuffer,0,256); - for (i = 0; i < 64; i++) ((uint4 *)chBuffer)[i] = 0UL; - //memset(chEach, 0, 10); - for (i = 0; i < 10; i++) chEach[i] = 0; - - for (nCount = 0; nCount < 16; nCount++) - { - wsprintf(chEach, "%02x", md5Digest[nCount]); - lstrcat(chBuffer, chEach /*, sizeof(chEach)*/); - } - - char *Tmp = new char[256]; - lstrcpyn(Tmp,chBuffer,256); Tmp[255]='0'; - return Tmp; - //return strdup(chBuffer); -} - -#if defined(ENABLE_GETMD5STRING) || defined (ENABLE_GETMD5RANDOM) -// MD5String: Performs the MD5 algorithm on a char* string, returning -// the results as a char*. -char* MD5String(char* szString) -{ - int nLen = lstrlen(szString); - md5 alg; - - alg.Update((unsigned char*)szString, (unsigned int)nLen); - alg.Finalize(); - - return PrintMD5(alg.Digest()); - -} -#endif - -#if defined(ENABLE_GETMD5FILE) -// MD5File: Performs the MD5 algorithm on a file (binar or text), -// returning the results as a char*. Returns NULL if it fails. -char* MD5File(char* szFilename) -{ - HANDLE file; - md5 alg; - unsigned long nLen; - unsigned char chBuffer[1024]; - -// try - { - //memset(chBuffer, 0, 1024); - for (register int i = 0; i < 256; i++) ((uint4 *)chBuffer)[i] = 0UL; - - if ((file = CreateFile(szFilename, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_ATTRIBUTE_NORMAL, 0)) != INVALID_HANDLE_VALUE ) - { - while ((ReadFile(file, chBuffer, 1024, &nLen, NULL) != FALSE) && nLen) - alg.Update(chBuffer, nLen); - - alg.Finalize(); - - CloseHandle(file); - - return PrintMD5(alg.Digest()); - } - } -// catch(...) - { - - } - - return NULL; // failed -} -#endif - - -// md5::Init -// Initializes a new context. -void md5::Init() -{ - //memset(m_Count, 0, 2 * sizeof(uint4)); - m_Count[0] = m_Count[1] = 0; - - m_State[0] = 0x67452301; - m_State[1] = 0xefcdab89; - m_State[2] = 0x98badcfe; - m_State[3] = 0x10325476; -} - -// md5::Update -// MD5 block update operation. Continues an MD5 message-digest -// operation, processing another message block, and updating the -// context. -void md5::Update(uchar* chInput, uint4 nInputLen) -{ - uint4 i, index, partLen; - - // Compute number of bytes mod 64 - index = (unsigned int)((m_Count[0] >> 3) & 0x3F); - - // Update number of bits - if ((m_Count[0] += (nInputLen << 3)) < (nInputLen << 3)) - m_Count[1]++; - - m_Count[1] += (nInputLen >> 29); - - partLen = 64 - index; - - // Transform as many times as possible. - if (nInputLen >= partLen) - { - lmemcpy( &m_Buffer[index], chInput, partLen ); - Transform(m_Buffer); - - for (i = partLen; i + 63 < nInputLen; i += 64) - Transform(&chInput[i]); - - index = 0; - } - else - i = 0; - - // Buffer remaining input - lmemcpy( &m_Buffer[index], &chInput[i], nInputLen-i ); -} - -// md5::Finalize -// MD5 finalization. Ends an MD5 message-digest operation, writing -// the message digest and zeroizing the context. -void md5::Finalize() -{ - uchar bits[8]; - uint4 index, padLen; - - // Save number of bits - Encode (bits, m_Count, 8); - - // Pad out to 56 mod 64 - index = (unsigned int)((m_Count[0] >> 3) & 0x3f); - padLen = (index < 56) ? (56 - index) : (120 - index); - Update(PADDING, padLen); - - // Append length (before padding) - Update (bits, 8); - - // Store state in digest - Encode (m_Digest, m_State, 16); - - //memset(m_Count, 0, 2 * sizeof(uint4)); - m_Count[0] = m_Count[1] = 0; - //memset(m_State, 0, 4 * sizeof(uint4)); - m_State[0] = m_State[1] = m_State[2] = m_State[3] = 0; - //memset(m_Buffer,0, 64 * sizeof(uchar)); - for (register int i = 0; i < 16; i++) ((uint4 *)m_Buffer)[i] = 0UL; -} - -// md5::Transform -// MD5 basic transformation. Transforms state based on block. -void md5::Transform (uchar* block) -{ - uint4 a = m_State[0], b = m_State[1], c = m_State[2], d = m_State[3], x[16]; - - Decode (x, block, 64); - - // Round 1 - FF (a, b, c, d, x[ 0], S11, 0xd76aa478); - FF (d, a, b, c, x[ 1], S12, 0xe8c7b756); - FF (c, d, a, b, x[ 2], S13, 0x242070db); - FF (b, c, d, a, x[ 3], S14, 0xc1bdceee); - FF (a, b, c, d, x[ 4], S11, 0xf57c0faf); - FF (d, a, b, c, x[ 5], S12, 0x4787c62a); - FF (c, d, a, b, x[ 6], S13, 0xa8304613); - FF (b, c, d, a, x[ 7], S14, 0xfd469501); - FF (a, b, c, d, x[ 8], S11, 0x698098d8); - FF (d, a, b, c, x[ 9], S12, 0x8b44f7af); - FF (c, d, a, b, x[10], S13, 0xffff5bb1); - FF (b, c, d, a, x[11], S14, 0x895cd7be); - FF (a, b, c, d, x[12], S11, 0x6b901122); - FF (d, a, b, c, x[13], S12, 0xfd987193); - FF (c, d, a, b, x[14], S13, 0xa679438e); - FF (b, c, d, a, x[15], S14, 0x49b40821); - - // Round 2 - GG (a, b, c, d, x[ 1], S21, 0xf61e2562); - GG (d, a, b, c, x[ 6], S22, 0xc040b340); - GG (c, d, a, b, x[11], S23, 0x265e5a51); - GG (b, c, d, a, x[ 0], S24, 0xe9b6c7aa); - GG (a, b, c, d, x[ 5], S21, 0xd62f105d); - GG (d, a, b, c, x[10], S22, 0x2441453); - GG (c, d, a, b, x[15], S23, 0xd8a1e681); - GG (b, c, d, a, x[ 4], S24, 0xe7d3fbc8); - GG (a, b, c, d, x[ 9], S21, 0x21e1cde6); - GG (d, a, b, c, x[14], S22, 0xc33707d6); - GG (c, d, a, b, x[ 3], S23, 0xf4d50d87); - GG (b, c, d, a, x[ 8], S24, 0x455a14ed); - GG (a, b, c, d, x[13], S21, 0xa9e3e905); - GG (d, a, b, c, x[ 2], S22, 0xfcefa3f8); - GG (c, d, a, b, x[ 7], S23, 0x676f02d9); - GG (b, c, d, a, x[12], S24, 0x8d2a4c8a); - - // Round 3 - HH (a, b, c, d, x[ 5], S31, 0xfffa3942); - HH (d, a, b, c, x[ 8], S32, 0x8771f681); - HH (c, d, a, b, x[11], S33, 0x6d9d6122); - HH (b, c, d, a, x[14], S34, 0xfde5380c); - HH (a, b, c, d, x[ 1], S31, 0xa4beea44); - HH (d, a, b, c, x[ 4], S32, 0x4bdecfa9); - HH (c, d, a, b, x[ 7], S33, 0xf6bb4b60); - HH (b, c, d, a, x[10], S34, 0xbebfbc70); - HH (a, b, c, d, x[13], S31, 0x289b7ec6); - HH (d, a, b, c, x[ 0], S32, 0xeaa127fa); - HH (c, d, a, b, x[ 3], S33, 0xd4ef3085); - HH (b, c, d, a, x[ 6], S34, 0x4881d05); - HH (a, b, c, d, x[ 9], S31, 0xd9d4d039); - HH (d, a, b, c, x[12], S32, 0xe6db99e5); - HH (c, d, a, b, x[15], S33, 0x1fa27cf8); - HH (b, c, d, a, x[ 2], S34, 0xc4ac5665); - - // Round 4 - II (a, b, c, d, x[ 0], S41, 0xf4292244); - II (d, a, b, c, x[ 7], S42, 0x432aff97); - II (c, d, a, b, x[14], S43, 0xab9423a7); - II (b, c, d, a, x[ 5], S44, 0xfc93a039); - II (a, b, c, d, x[12], S41, 0x655b59c3); - II (d, a, b, c, x[ 3], S42, 0x8f0ccc92); - II (c, d, a, b, x[10], S43, 0xffeff47d); - II (b, c, d, a, x[ 1], S44, 0x85845dd1); - II (a, b, c, d, x[ 8], S41, 0x6fa87e4f); - II (d, a, b, c, x[15], S42, 0xfe2ce6e0); - II (c, d, a, b, x[ 6], S43, 0xa3014314); - II (b, c, d, a, x[13], S44, 0x4e0811a1); - II (a, b, c, d, x[ 4], S41, 0xf7537e82); - II (d, a, b, c, x[11], S42, 0xbd3af235); - II (c, d, a, b, x[ 2], S43, 0x2ad7d2bb); - II (b, c, d, a, x[ 9], S44, 0xeb86d391); - - m_State[0] += a; - m_State[1] += b; - m_State[2] += c; - m_State[3] += d; - - //memset(x, 0, sizeof(x)); - for (register int i = 0; i < (sizeof(x)/sizeof(*x)); i++) x[i] = 0UL; -} - -// md5::Encode -// Encodes input (uint4) into output (uchar). Assumes nLength is -// a multiple of 4. -void md5::Encode(uchar* dest, uint4* src, uint4 nLength) -{ - uint4 i, j; - - //assert(nLength % 4 == 0); - - for (i = 0, j = 0; j < nLength; i++, j += 4) - { - dest[j] = (uchar)(src[i] & 0xff); - dest[j+1] = (uchar)((src[i] >> 8) & 0xff); - dest[j+2] = (uchar)((src[i] >> 16) & 0xff); - dest[j+3] = (uchar)((src[i] >> 24) & 0xff); - } -} - -// md5::Decode -// Decodes input (uchar) into output (uint4). Assumes nLength is -// a multiple of 4. -void md5::Decode(uint4* dest, uchar* src, uint4 nLength) -{ - uint4 i, j; - - //assert(nLength % 4 == 0); - - for (i = 0, j = 0; j < nLength; i++, j += 4) - { - dest[i] = ((uint4)src[j]) | (((uint4)src[j+1])<<8) | - (((uint4)src[j+2])<<16) | (((uint4)src[j+3])<<24); - } -} \ No newline at end of file diff --git a/installer/md5dll/MD5.h b/installer/md5dll/MD5.h deleted file mode 100644 index 592ae048d..000000000 --- a/installer/md5dll/MD5.h +++ /dev/null @@ -1,100 +0,0 @@ -///////////////////////////////////////////////////////////////////////// -// MD5.cpp -// Implementation file for MD5 class -// -// This C++ Class implementation of the original RSA Data Security, Inc. -// MD5 Message-Digest Algorithm is copyright (c) 2002, Gary McNickle. -// All rights reserved. This software is a derivative of the "RSA Data -// Security, Inc. MD5 Message-Digest Algorithm" -// -// You may use this software free of any charge, but without any -// warranty or implied warranty, provided that you follow the terms -// of the original RSA copyright, listed below. -// -// Original RSA Data Security, Inc. Copyright notice -///////////////////////////////////////////////////////////////////////// -// -// Copyright (C) 1991-2, RSA Data Security, Inc. Created 1991. All -// rights reserved. -// -// License to copy and use this software is granted provided that it -// is identified as the "RSA Data Security, Inc. MD5 Message-Digest -// Algorithm" in all material mentioning or referencing this software -// or this function. -// License is also granted to make and use derivative works provided -// that such works are identified as "derived from the RSA Data -// Security, Inc. MD5 Message-Digest Algorithm" in all material -// mentioning or referencing the derived work. -// RSA Data Security, Inc. makes no representations concerning either -// the merchantability of this software or the suitability of this -// software for any particular purpose. It is provided "as is" -// without express or implied warranty of any kind. -// These notices must be retained in any copies of any part of this -// documentation and/or software. -///////////////////////////////////////////////////////////////////////// - -typedef unsigned int uint4; -typedef unsigned short int uint2; -typedef unsigned char uchar; - -char* PrintMD5(uchar md5Digest[16]); -#if defined(ENABLE_GETMD5STRING) || defined (ENABLE_GETMD5RANDOM) -char* MD5String(char* szString); -#endif -#if defined(ENABLE_GETMD5FILE) -char* MD5File(char* szFilename); -#endif - -class md5 -{ -// Methods -public: - md5() { Init(); } - void Init(); - void Update(uchar* chInput, uint4 nInputLen); - void Finalize(); - uchar* Digest() { return m_Digest; } - -private: - - void Transform(uchar* block); - void Encode(uchar* dest, uint4* src, uint4 nLength); - void Decode(uint4* dest, uchar* src, uint4 nLength); - - - inline uint4 rotate_left(uint4 x, uint4 n) - { return ((x << n) | (x >> (32-n))); } - - inline uint4 F(uint4 x, uint4 y, uint4 z) - { return ((x & y) | (~x & z)); } - - inline uint4 G(uint4 x, uint4 y, uint4 z) - { return ((x & z) | (y & ~z)); } - - inline uint4 H(uint4 x, uint4 y, uint4 z) - { return (x ^ y ^ z); } - - inline uint4 I(uint4 x, uint4 y, uint4 z) - { return (y ^ (x | ~z)); } - - inline void FF(uint4& a, uint4 b, uint4 c, uint4 d, uint4 x, uint4 s, uint4 ac) - { a += F(b, c, d) + x + ac; a = rotate_left(a, s); a += b; } - - inline void GG(uint4& a, uint4 b, uint4 c, uint4 d, uint4 x, uint4 s, uint4 ac) - { a += G(b, c, d) + x + ac; a = rotate_left(a, s); a += b; } - - inline void HH(uint4& a, uint4 b, uint4 c, uint4 d, uint4 x, uint4 s, uint4 ac) - { a += H(b, c, d) + x + ac; a = rotate_left(a, s); a += b; } - - inline void II(uint4& a, uint4 b, uint4 c, uint4 d, uint4 x, uint4 s, uint4 ac) - { a += I(b, c, d) + x + ac; a = rotate_left(a, s); a += b; } - -// Data -private: - uint4 m_State[4]; - uint4 m_Count[2]; - uchar m_Buffer[64]; - uchar m_Digest[16]; - uchar m_Finalized; - -}; \ No newline at end of file diff --git a/installer/md5dll/MD5Example.nsi b/installer/md5dll/MD5Example.nsi deleted file mode 100644 index 65d0f1232..000000000 --- a/installer/md5dll/MD5Example.nsi +++ /dev/null @@ -1,55 +0,0 @@ -/************************************************************** - *** Generates a md5 value from a file, string or random. *** - **************************************************************/ - -Name "MD5dll Example" -OutFile "MD5dllTest.exe" -ShowInstDetails show - -Section - # generate MD5sum of file - StrCpy $0 "${NSISDIR}\NSIS.CHM" - md5dll::GetMD5File "$0" - Pop $1 - - DetailPrint 'md5dll::GetMD5File "$0"' - DetailPrint "MD5: [$1]" - DetailPrint "" - - # generate MD5sum of file using deprecated method - StrCpy $0 "${NSISDIR}\NSIS.CHM" - md5dll::GetFileMD5 "$0" - Pop $1 - - DetailPrint '{deprecated} md5dll::GetFileMD5 "$0"' - DetailPrint "MD5: [$1]" - DetailPrint "" - - - #generate MD5sum of string - StrCpy $0 "MyString" - md5dll::GetMD5String "$0" - Pop $1 - - DetailPrint 'md5dll::GetMD5String "$0"' - DetailPrint "MD5: [$1]" - DetailPrint "" - - #generate MD5sum of string using deprecated method - StrCpy $0 "MyString" - md5dll::GetMD5 "$0" - Pop $1 - - DetailPrint '{deprecated} md5dll::GetMD5 "$0"' - DetailPrint "MD5: [$1]" - DetailPrint "" - - - #generate random MD5sum - md5dll::GetMD5Random - Pop $1 - - DetailPrint "md5dll::GetMD5Random" - DetailPrint "MD5: [$1]" - DetailPrint "" -SectionEnd diff --git a/installer/md5dll/UNICODE/md5dll.dll b/installer/md5dll/UNICODE/md5dll.dll deleted file mode 100644 index bde153f70..000000000 Binary files a/installer/md5dll/UNICODE/md5dll.dll and /dev/null differ diff --git a/installer/md5dll/api.h b/installer/md5dll/api.h deleted file mode 100644 index 9d7b20797..000000000 --- a/installer/md5dll/api.h +++ /dev/null @@ -1,83 +0,0 @@ -/* - * apih - * - * This file is a part of NSIS. - * - * Copyright (C) 1999-2009 Nullsoft and Contributors - * - * Licensed under the zlib/libpng license (the "License"); - * you may not use this file except in compliance with the License. - * - * Licence details can be found in the file COPYING. - * - * This software is provided 'as-is', without any express or implied - * warranty. - */ - -#ifndef _NSIS_EXEHEAD_API_H_ -#define _NSIS_EXEHEAD_API_H_ - -// Starting with NSIS 2.42, you can check the version of the plugin API in exec_flags->plugin_api_version -// The format is 0xXXXXYYYY where X is the major version and Y is the minor version (MAKELONG(y,x)) -// When doing version checks, always remember to use >=, ex: if (pX->exec_flags->plugin_api_version >= NSISPIAPIVER_1_0) {} - -#define NSISPIAPIVER_1_0 0x00010000 -#define NSISPIAPIVER_CURR NSISPIAPIVER_1_0 - -// NSIS Plug-In Callback Messages -enum NSPIM -{ - NSPIM_UNLOAD, // This is the last message a plugin gets, do final cleanup - NSPIM_GUIUNLOAD, // Called after .onGUIEnd -}; - -// Prototype for callbacks registered with extra_parameters->RegisterPluginCallback() -// Return NULL for unknown messages -// Should always be __cdecl for future expansion possibilities -typedef UINT_PTR (*NSISPLUGINCALLBACK)(enum NSPIM); - -// extra_parameters data structures containing other interesting stuff -// but the stack, variables and HWND passed on to plug-ins. -typedef struct -{ - int autoclose; - int all_user_var; - int exec_error; - int abort; - int exec_reboot; // NSIS_SUPPORT_REBOOT - int reboot_called; // NSIS_SUPPORT_REBOOT - int XXX_cur_insttype; // depreacted - int plugin_api_version; // see NSISPIAPIVER_CURR - // used to be XXX_insttype_changed - int silent; // NSIS_CONFIG_SILENT_SUPPORT - int instdir_error; - int rtl; - int errlvl; - int alter_reg_view; - int status_update; -} exec_flags_t; - -#ifndef NSISCALL -# define NSISCALL __stdcall -#endif - -typedef struct { - exec_flags_t *exec_flags; - int (NSISCALL *ExecuteCodeSegment)(int, HWND); - void (NSISCALL *validate_filename)(TCHAR *); - int (NSISCALL *RegisterPluginCallback)(HMODULE, NSISPLUGINCALLBACK); // returns 0 on success, 1 if already registered and < 0 on errors -} extra_parameters; - -// Definitions for page showing plug-ins -// See Ui.c to understand better how they're used - -// sent to the outer window to tell it to go to the next inner window -#define WM_NOTIFY_OUTER_NEXT (WM_USER+0x8) - -// custom pages should send this message to let NSIS know they're ready -#define WM_NOTIFY_CUSTOM_READY (WM_USER+0xd) - -// sent as wParam with WM_NOTIFY_OUTER_NEXT when user cancels - heed its warning -#define NOTIFY_BYE_BYE 'x' - -#endif /* _PLUGIN_H_ */ diff --git a/installer/md5dll/build.bat b/installer/md5dll/build.bat deleted file mode 100644 index c20bb1f32..000000000 --- a/installer/md5dll/build.bat +++ /dev/null @@ -1,17 +0,0 @@ -@echo Building MD5dll -@set md5unicode= -@if not "%1"=="/u" goto skipU -@set md5unicode=/DNSIS_UNICODE -@:skipU -@REM compile dll -rc /l 0x409 /d "NDEBUG" %md5unicode% md5dll.rc -cl /O2 /GX- /Gs- /Oi /Os /GF /GB /DENABLE_GETMD5FILE /DENABLE_GETMD5STRING /DENABLE_GETMD5RANDOM %md5unicode% md5dll.def md5dll.res md5dll.cpp MD5.cpp kernel32.lib user32.lib /LD /link -opt:nowin98 -opt:REF,ICF -machine:I386 -nodefaultlib -entry:"_DllMainCRTStartup" -::@REM build optional link lib -::lib /DEF:md5dll.def /machine:I386 -@REM removing unneeded files -del *.obj -del md5dll.res -del md5dll.exp -del md5dll.lib -@set md5unicode= -@PAUSE diff --git a/installer/md5dll/md5dll.cpp b/installer/md5dll/md5dll.cpp deleted file mode 100644 index 4c3876ca6..000000000 --- a/installer/md5dll/md5dll.cpp +++ /dev/null @@ -1,140 +0,0 @@ -// MD5 plugin. -// Be sure to add the RSA license notice somewhere in your installer. -// -// Matthew "IGx89" Lieder -// Author -// -// KJD -// -modified to reduce size and use exdll.h -// (reduced to about 6KB uncompressed, by removing CRTL dependency) -// -// Davy Durham -// -MD5.cpp fix (correct for loop used to replace memset, exceeded bounds) -// -// Shengalts Aleksander aka Instructor -// -New command: "GetMD5Random" -// -Changed names: "GetFileMD5" -> "GetMD5File", "GetMD5" -> "GetMD5String" -// -Fixed: string lenght error -// -// KJD -// -added dual exports for compatibility with prior versions -// -// KJD -// -updated Exdll.h to pluginapi.h, enable building for NSIS & Unicode NSIS - - -#ifdef NSIS_UNICODE /* MD5.cpp should be compiled in ANSI mode */ -#define UNICODE -#define _UNICODE -#endif - - -#define WIN32_LEAN_AND_MEAN -#include -#include "MD5.h" - -unsigned char staticCnvBuffer[1024*2]; -#ifdef UNICODE -#define wcslen lstrlenW -#define wcscpy lstrcpyW -#define wcsncpy lstrcpynW -#define wcscat lstrcatW -#define wcscmp lstrcmpW -#define wcscmpi lstrcmpiW -char * _T2A(unsigned short *wideStr) -{ - WideCharToMultiByte(CP_ACP, 0, wideStr, -1, (char *)staticCnvBuffer, sizeof(staticCnvBuffer), NULL, NULL); - return (char *)staticCnvBuffer; -} -#define _A2T(x) _A2U(x) -#else -#define strlen lstrlenA -#define strcpy lstrcpyA -#define strncpy lstrcpynA -#define strcat lstrcatA -#define strcmp lstrcmpA -#define strcmpi lstrcmpiA -#define _T2A(x) (x) -#define _A2T(x) (x) -#endif -unsigned short * _A2U(char *ansiStr) -{ - MultiByteToWideChar(CP_ACP, 0, ansiStr, -1, (unsigned short *)staticCnvBuffer, sizeof(staticCnvBuffer)/2); - return (unsigned short *)staticCnvBuffer; -} - -#include "pluginapi.h" - - -void *operator new( unsigned int num_bytes ) -{ - return GlobalAlloc(GPTR,num_bytes); -} -void operator delete( void *p ) { if (p) GlobalFree(p); } - - -/* buffer for retrieving arguments from NSIS's stack into, outside func to avoid calls to __stkchk */ -TCHAR strarg[1024*sizeof(TCHAR)]; - -#ifdef ENABLE_GETMD5FILE -extern "C" void __declspec( dllexport ) GetMD5File(HWND hwndParent, int string_size, - TCHAR *variables, stack_t **stacktop) -{ - EXDLL_INIT(); - - // generate MD5sum of file - { - char *buf=NULL; - - popstring(strarg); - buf = MD5File(_T2A(strarg)); - pushstring(_A2T(buf)); - delete buf; - } -} -#endif // ENABLE_GETMD5FILE - -#ifdef ENABLE_GETMD5STRING -extern "C" void __declspec( dllexport ) GetMD5String(HWND hwndParent, int string_size, - TCHAR *variables, stack_t **stacktop) -{ - EXDLL_INIT(); - - // generate MD5sum of string - { - char *buf=NULL; - - popstring(strarg); - buf = MD5String(_T2A(strarg)); - pushstring(_A2T(buf)); - delete buf; - } -} -#endif // ENABLE_GETMD5STRING - -#ifdef ENABLE_GETMD5RANDOM -extern "C" void __declspec( dllexport ) GetMD5Random(HWND hwndParent, int string_size, - TCHAR *variables, stack_t **stacktop) -{ - EXDLL_INIT(); - - // generate random MD5sum - { - DWORD dwTickCount=0; - char lTickCount[1024]; - char *buf=NULL; - - Sleep(1); - dwTickCount=GetTickCount(); - wsprintfA(lTickCount,"%d",dwTickCount); - buf = MD5String(lTickCount); - pushstring(_A2T(buf)); - delete buf; - } -} -#endif // ENABLE_GETMD5RANDOM - -extern "C" BOOL WINAPI _DllMainCRTStartup(HANDLE hInst, ULONG ul_reason_for_call, LPVOID lpReserved) -{ - return TRUE; -} diff --git a/installer/md5dll/md5dll.def b/installer/md5dll/md5dll.def deleted file mode 100644 index 3eaae15bc..000000000 --- a/installer/md5dll/md5dll.def +++ /dev/null @@ -1,10 +0,0 @@ -LIBRARY MD5DLL -DESCRIPTION "Implements MD5 Sum as NSIS plugin" -EXPORTS -GetMD5File @1 -GetMD5String @2 -GetMD5Random @3 - -;These are for compatibility with older versions of this plugin only {deprecated} -GetFileMD5=GetMD5File @101 PRIVATE -GetMD5=GetMD5String @102 PRIVATE diff --git a/installer/md5dll/md5dll.rc b/installer/md5dll/md5dll.rc deleted file mode 100644 index a1cb8f72c..000000000 --- a/installer/md5dll/md5dll.rc +++ /dev/null @@ -1,100 +0,0 @@ -#include - -#define APP_ICON 100 - -#ifdef RC_INVOKED - -// Pretty icon displayed by Explorer -// APP_ICON ICON DISCARDABLE "md5dll.ico" - -// Version info viewable by Explorer -#define _VM 0 -#define _VN 5 -#define _VI 0 -#define _VB 0 - -#ifndef mk_str -#define mk_str2(x) # x -#define mk_str(x) mk_str2(x) -#endif - -#define _VS mk_str(_VM) "." mk_str(_VN) "." mk_str(_VI) "-" mk_str(_VB) "\0" - - -// normally found in included by -// FILEFLAGS -#define VS_FF_NORMAL 0x00000000L // ok I made this one up -#ifndef VS_FF_DEBUG -#define VS_FF_DEBUG 0x00000001L -#endif -#ifndef VS_FF_PRERELEASE -#define VS_FF_PRERELEASE 0x00000002L -#endif -// FILEOS -#ifndef VOS_NT -#define VOS_NT 0x00040000L -#endif -#ifndef VOS__WINDOWS32 -#define VOS__WINDOWS32 0x00000004L -#endif -#ifndef VOS_NT_WINDOWS32 -#define VOS_NT_WINDOWS32 0x00040004L -#endif -// FILETYPE -#ifndef VFT_APP -#define VFT_APP 0x00000001L -#endif -#ifndef VFT_DLL -#define VFT_DLL 0x00000002L -#endif - - -VS_VERSION_INFO VERSIONINFO - FILEVERSION _VM,_VN,_VI,_VB - PRODUCTVERSION _VM,_VN,_VI,_VB - FILEFLAGSMASK 0x3fL -#ifdef _DEBUG - FILEFLAGS VS_FF_DEBUG | VS_FF_PRERELEASE // a debug build is never a release -#else - FILEFLAGS VS_FF_NORMAL -#endif - FILEOS VOS_NT_WINDOWS32 - FILETYPE VFT_APP - FILESUBTYPE 0x0L -BEGIN - BLOCK "StringFileInfo" - BEGIN - BLOCK "080904b0" - BEGIN - VALUE "Comments", "NSIS plugin to calculate MD5 sum.\0" - VALUE "CompanyName", "www.fdos.org\0" - VALUE "FileDescription", "MD5 message digest algorithm\0" - VALUE "FileVersion", _VS - VALUE "InternalName", "md5dll\0" -// Only about the 1st 45+ characters are shown in Windows 2000 properties Version dialog - VALUE "LegalCopyright", "derivative of RSA Data Security, Inc. MD5 Message-Digest Algorithm\0" - VALUE "LegalTrademarks", "\0" - VALUE "OriginalFilename", "md5dll.dll\0" - VALUE "PrivateBuild", "\0" - VALUE "ProductName", "md5dll\0" - VALUE "ProductVersion", _VS -#ifdef NSIS_UNICODE - VALUE "SpecialBuild", "UNICODE\0" -#else - VALUE "SpecialBuild", "ANSI\0" -#endif - END - END - BLOCK "VarFileInfo" - BEGIN - VALUE "Translation", 0x809, 1200 - END -END - -#undef _VM -#undef _VN -#undef _VI -#undef _VB -#undef _VS - -#endif diff --git a/installer/md5dll/nsis_tchar.h b/installer/md5dll/nsis_tchar.h deleted file mode 100644 index 92e989e31..000000000 --- a/installer/md5dll/nsis_tchar.h +++ /dev/null @@ -1,215 +0,0 @@ -/* - * nsis_tchar.h - * - * This file is a part of NSIS. - * - * Copyright (C) 1999-2007 Nullsoft and Contributors - * - * This software is provided 'as-is', without any express or implied - * warranty. - * - * For Unicode support by Jim Park -- 08/30/2007 - */ - -// Jim Park: Only those we use are listed here. - -#pragma once - -#ifdef _UNICODE - -#ifndef _T -#define __T(x) L ## x -#define _T(x) __T(x) -#define _TEXT(x) __T(x) -#endif -typedef wchar_t TCHAR; -typedef wchar_t _TUCHAR; - -// program -#define _tmain wmain -#define _tWinMain wWinMain -#define _tenviron _wenviron -#define __targv __wargv - -// printfs -#define _ftprintf fwprintf -#define _sntprintf _snwprintf -#define _stprintf _swprintf -#define _tprintf wprintf -#define _vftprintf vfwprintf -#define _vsntprintf _vsnwprintf -#define _vstprintf _vswprintf - -// scanfs -#define _tscanf wscanf -#define _stscanf swscanf - -// string manipulations -#define _tcscat wcscat -#define _tcschr wcschr -#define _tcsclen wcslen -#define _tcscpy wcscpy -#define _tcsdup _wcsdup -#define _tcslen wcslen -#define _tcsnccpy wcsncpy -#define _tcsncpy wcsncpy -#define _tcsrchr wcsrchr -#define _tcsstr wcsstr -#define _tcstok wcstok - -// string comparisons -#define _tcscmp wcscmp -#define _tcsicmp _wcsicmp -#define _tcsncicmp _wcsnicmp -#define _tcsncmp wcsncmp -#define _tcsnicmp _wcsnicmp - -// upper / lower -#define _tcslwr _wcslwr -#define _tcsupr _wcsupr -#define _totlower towlower -#define _totupper towupper - -// conversions to numbers -#define _tcstoi64 _wcstoi64 -#define _tcstol wcstol -#define _tcstoul wcstoul -#define _tstof _wtof -#define _tstoi _wtoi -#define _tstoi64 _wtoi64 -#define _ttoi _wtoi -#define _ttoi64 _wtoi64 -#define _ttol _wtol - -// conversion from numbers to strings -#define _itot _itow -#define _ltot _ltow -#define _i64tot _i64tow -#define _ui64tot _ui64tow - -// file manipulations -#define _tfopen _wfopen -#define _topen _wopen -#define _tremove _wremove -#define _tunlink _wunlink - -// reading and writing to i/o -#define _fgettc fgetwc -#define _fgetts fgetws -#define _fputts fputws -#define _gettchar getwchar - -// directory -#define _tchdir _wchdir - -// environment -#define _tgetenv _wgetenv -#define _tsystem _wsystem - -// time -#define _tcsftime wcsftime - -#else // ANSI - -#ifndef _T -#define _T(x) x -#define _TEXT(x) x -#endif -typedef char TCHAR; -typedef unsigned char _TUCHAR; - -// program -#define _tmain main -#define _tWinMain WinMain -#define _tenviron environ -#define __targv __argv - -// printfs -#define _ftprintf fprintf -#define _sntprintf _snprintf -#define _stprintf sprintf -#define _tprintf printf -#define _vftprintf vfprintf -#define _vsntprintf _vsnprintf -#define _vstprintf vsprintf - -// scanfs -#define _tscanf scanf -#define _stscanf sscanf - -// string manipulations -#define _tcscat strcat -#define _tcschr strchr -#define _tcsclen strlen -#define _tcscnlen strnlen -#define _tcscpy strcpy -#define _tcsdup _strdup -#define _tcslen strlen -#define _tcsnccpy strncpy -#define _tcsncpy strncpy -#define _tcsrchr strrchr -#define _tcsstr strstr -#define _tcstok strtok - -// string comparisons -#define _tcscmp strcmp -#define _tcsicmp _stricmp -#define _tcsncmp strncmp -#define _tcsncicmp _strnicmp -#define _tcsnicmp _strnicmp - -// upper / lower -#define _tcslwr _strlwr -#define _tcsupr _strupr - -#define _totupper toupper -#define _totlower tolower - -// conversions to numbers -#define _tcstol strtol -#define _tcstoul strtoul -#define _tstof atof -#define _tstoi atoi -#define _tstoi64 _atoi64 -#define _tstoi64 _atoi64 -#define _ttoi atoi -#define _ttoi64 _atoi64 -#define _ttol atol - -// conversion from numbers to strings -#define _i64tot _i64toa -#define _itot _itoa -#define _ltot _ltoa -#define _ui64tot _ui64toa - -// file manipulations -#define _tfopen fopen -#define _topen _open -#define _tremove remove -#define _tunlink _unlink - -// reading and writing to i/o -#define _fgettc fgetc -#define _fgetts fgets -#define _fputts fputs -#define _gettchar getchar - -// directory -#define _tchdir _chdir - -// environment -#define _tgetenv getenv -#define _tsystem system - -// time -#define _tcsftime strftime - -#endif - -// is functions (the same in Unicode / ANSI) -#define _istgraph isgraph -#define _istascii __isascii - -#define __TFILE__ _T(__FILE__) -#define __TDATE__ _T(__DATE__) -#define __TTIME__ _T(__TIME__) diff --git a/installer/md5dll/pluginapi.h b/installer/md5dll/pluginapi.h deleted file mode 100644 index 86dee2fb3..000000000 --- a/installer/md5dll/pluginapi.h +++ /dev/null @@ -1,103 +0,0 @@ -// only include this file from one place in your DLL. -// (it is all static, if you use it in two places it will fail) - -#ifndef ___NSIS_PLUGIN__H___ -#define ___NSIS_PLUGIN__H___ - -#ifdef __cplusplus -extern "C" { -#endif - -#include "api.h" -#include "nsis_tchar.h" - -#ifndef NSISCALL -# define NSISCALL __stdcall -#endif - -#define EXDLL_INIT() { \ - g_stringsize=string_size; \ - g_stacktop=stacktop; \ - g_variables=variables; } - -typedef struct _stack_t { - struct _stack_t *next; - TCHAR text[1]; // this should be the length of string_size -} stack_t; - -enum -{ -INST_0, // $0 -INST_1, // $1 -INST_2, // $2 -INST_3, // $3 -INST_4, // $4 -INST_5, // $5 -INST_6, // $6 -INST_7, // $7 -INST_8, // $8 -INST_9, // $9 -INST_R0, // $R0 -INST_R1, // $R1 -INST_R2, // $R2 -INST_R3, // $R3 -INST_R4, // $R4 -INST_R5, // $R5 -INST_R6, // $R6 -INST_R7, // $R7 -INST_R8, // $R8 -INST_R9, // $R9 -INST_CMDLINE, // $CMDLINE -INST_INSTDIR, // $INSTDIR -INST_OUTDIR, // $OUTDIR -INST_EXEDIR, // $EXEDIR -INST_LANG, // $LANGUAGE -__INST_LAST -}; - - -static unsigned int g_stringsize; -static stack_t **g_stacktop; -static TCHAR *g_variables; - - -// utility functions (not required but often useful) -static int NSISCALL popstring(TCHAR *str) -{ - stack_t *th; - if (!g_stacktop || !*g_stacktop) return 1; - th=(*g_stacktop); - _tcscpy(str,th->text); - *g_stacktop = th->next; - GlobalFree((HGLOBAL)th); - return 0; -} - -static void NSISCALL pushstring(const TCHAR *str) -{ - stack_t *th; - if (!g_stacktop) return; - th=(stack_t*)GlobalAlloc(GPTR,sizeof(stack_t)+g_stringsize); - _tcsncpy(th->text,str,g_stringsize); - th->next=*g_stacktop; - *g_stacktop=th; -} - -static TCHAR * NSISCALL getuservariable(const int varnum) -{ - if (varnum < 0 || varnum >= __INST_LAST) return NULL; - return g_variables+varnum*g_stringsize; -} - -static void NSISCALL setuservariable(const int varnum, const TCHAR *var) -{ - if (var != NULL && varnum >= 0 && varnum < __INST_LAST) - _tcscpy(g_variables + varnum*g_stringsize, var); -} - - -#ifdef __cplusplus -} -#endif - -#endif//!___NSIS_PLUGIN__H___ diff --git a/installer/md5dll/readme.txt b/installer/md5dll/readme.txt deleted file mode 100644 index a8d3572c7..000000000 --- a/installer/md5dll/readme.txt +++ /dev/null @@ -1,68 +0,0 @@ -Calculates the md5sum of a file or string. -Has been tested to work with NSIS 2.0+ - - -Derived from the RSA Data Security, Inc. MD5 Message-Digest Algorithm - -[Md5Dll] -Matthew "IGx89" Lieder - -Original plugin Author - -Sunjammer (12th May 2002) - -Original usage notes and example script - -[Md5Dll.0.1] -KJD (2004) - -Modified to reduce size and use exdll.h - (reduced to about 6KB uncompressed, by removing CRTL dependency) - -[Md5dll.0.2] -Davy Durham (2004) - -MD5.cpp fix (correct for loop used to replace memset, exceeded bounds) - -[Md5dll.0.3] -Shengalts Aleksander aka Instructor (2005) - -New command: "GetMD5Random" - -Changed names: "GetFileMD5" -> "GetMD5File", "GetMD5" -> "GetMD5String" - -Fixed: string length error - -[Md5dll.0.4] -KJD (2005) - -Added dual name to exports for backwards compatibility - - --------------------------------- - -Usage: - -Push $1 ;string -CallInstDll "md5dll" GetMD5String -Pop $1 ;md5 of string - --or- - -Push $1 ;filename -CallInstDll "md5dll" GetMD5File -Pop $1 ;md5 of file - --------------------------------- - -Example usage in recent NSIS versions - -OutFile "md5test.exe" -Section "" - #generate MD5sum of a string - md5dll::GetMD5String "md5me" - Pop $0 - DetailPrint "md5: [$0]" - - # generate MD5sum of a file - md5dll::GetMD5File "${NSISDIR}\makensis.exe" - Pop $0 - DetailPrint "md5: [$0]" - - #generate random MD5sum - md5dll::GetMD5Random - Pop $0 - DetailPrint "md5: [$0]" -SectionEnd