Double Sine 8 tahun lalu
induk
melakukan
618190dde3

+ 2 - 2
navicat-keygen/_tmain.cpp

@@ -22,8 +22,8 @@
 #else
 #pragma comment(lib, "libcryptoMT.lib")
 #endif
-#pragma comment(lib, "WS2_32.lib")      // some symbol are used in OpenSSL lib
-#pragma comment(lib, "Crypt32.lib")     // some symbol are used in OpenSSL lib
+#pragma comment(lib, "WS2_32.lib")      // some symbol are used in OpenSSL static lib
+#pragma comment(lib, "Crypt32.lib")     // some symbol are used in OpenSSL static lib
 
 #define NAVICAT_12
 

+ 4 - 4
navicat-keygen/navicat-keygen.vcxproj

@@ -28,26 +28,26 @@
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseDebugLibraries>true</UseDebugLibraries>
-    <PlatformToolset>v140</PlatformToolset>
+    <PlatformToolset>v140_xp</PlatformToolset>
     <CharacterSet>Unicode</CharacterSet>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseDebugLibraries>false</UseDebugLibraries>
-    <PlatformToolset>v140</PlatformToolset>
+    <PlatformToolset>v140_xp</PlatformToolset>
     <WholeProgramOptimization>true</WholeProgramOptimization>
     <CharacterSet>Unicode</CharacterSet>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseDebugLibraries>true</UseDebugLibraries>
-    <PlatformToolset>v140</PlatformToolset>
+    <PlatformToolset>v140_xp</PlatformToolset>
     <CharacterSet>Unicode</CharacterSet>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseDebugLibraries>false</UseDebugLibraries>
-    <PlatformToolset>v140</PlatformToolset>
+    <PlatformToolset>v140_xp</PlatformToolset>
     <WholeProgramOptimization>true</WholeProgramOptimization>
     <CharacterSet>Unicode</CharacterSet>
   </PropertyGroup>

+ 21 - 16
navicat-patcher/Solution1.cpp

@@ -339,26 +339,31 @@ namespace patcher::Solution1 {
             _tprintf_s(TEXT("Failed to open libcc.dll. CODE: 0x%08x @[patcher::Solution1::Do -> CreateFile]\r\n"), GetLastError());
             return FALSE;
         }
+        
+        // Start from win8, lpNumberOfBytesWritten parameter in WriteFile can be null if lpOverlapped is null.
+        // But win7 is not. lpNumberOfBytesWritten cannot be null if lpOverlapped is null. 
+        // However MSDN does not mention that.
+        DWORD WrittenBytes;
 
         // start patch 0
-        _tprintf_s(TEXT("----------Start to do patch 0----------\r\n"));
+        _tprintf_s(TEXT("\r\nStart to do patch 0......\r\n"));
         if (INVALID_SET_FILE_POINTER == SetFilePointer(hFile, Patch_Offset[0], nullptr, FILE_BEGIN)) {
             _tprintf_s(TEXT("Failed to set file pointer. CODE: 0x%08x @[patcher::Solution1::Do -> SetFilePointer]\r\n"), GetLastError());
             CloseHandle(hFile);
             return FALSE;
         }
-
+        
         _tprintf_s(TEXT("At offset +0x%08x, write:\r\n\"%hs\"\r\n"), Patch_Offset[0], encrypted_pem_pubkey0.c_str());
-        if (FALSE == WriteFile(hFile, encrypted_pem_pubkey0.c_str(), encrypted_pem_pubkey0.length(), nullptr, nullptr)) {
+        if (FALSE == WriteFile(hFile, encrypted_pem_pubkey0.c_str(), encrypted_pem_pubkey0.length(), &WrittenBytes, nullptr)) {
             _tprintf_s(TEXT("Failed to write patch 0. CODE: 0x%08x @[patcher::Solution1::Do -> WriteFile]\r\n"), GetLastError());
             CloseHandle(hFile);
             return FALSE;
         }
 
-        _tprintf_s(TEXT("----------patch 0 done----------\r\n"));
+        _tprintf_s(TEXT("patch 0 done.....\r\n"));
 
         // start patch 1
-        _tprintf_s(TEXT("----------Start to do patch 1----------\r\n"));
+        _tprintf_s(TEXT("\r\nStart to do patch 1.....\r\n"));
         if (INVALID_SET_FILE_POINTER == SetFilePointer(hFile, Patch_Offset[1], nullptr, FILE_BEGIN)) {
             _tprintf_s(TEXT("Failed to set file pointer. CODE: 0x%08x @[patcher::Solution1::Do -> SetFilePointer]\r\n"), GetLastError());
             CloseHandle(hFile);
@@ -366,16 +371,16 @@ namespace patcher::Solution1 {
         }
 
         _tprintf_s(TEXT("At offset +0x%08x, write immediate value %d (type: uint32_t)\r\n"), Patch_Offset[1], imm1);
-        if (FALSE == WriteFile(hFile, &imm1, sizeof(imm1), nullptr, nullptr)) {
+        if (FALSE == WriteFile(hFile, &imm1, sizeof(imm1), &WrittenBytes, nullptr)) {
             _tprintf_s(TEXT("Failed to write patch 1. CODE: 0x%08x @[patcher::Solution1::Do -> WriteFile]\r\n"), GetLastError());
             CloseHandle(hFile);
             return FALSE;
         }
 
-        _tprintf_s(TEXT("----------patch 1 done----------\r\n"));
+        _tprintf_s(TEXT("patch 1 done.....\r\n"));
 
         // start patch 2
-        _tprintf_s(TEXT("----------Start to do patch 2----------\r\n"));
+        _tprintf_s(TEXT("\r\nStart to do patch 2.....\r\n"));
         if (INVALID_SET_FILE_POINTER == SetFilePointer(hFile, Patch_Offset[2], nullptr, FILE_BEGIN)) {
             _tprintf_s(TEXT("Failed to set file pointer. CODE: 0x%08x @[patcher::Solution1::Do -> SetFilePointer]\r\n"), GetLastError());
             CloseHandle(hFile);
@@ -383,16 +388,16 @@ namespace patcher::Solution1 {
         }
 
         _tprintf_s(TEXT("At offset +0x%08x, write:\r\n\"%hs\"\r\n"), Patch_Offset[2], encrypted_pem_pubkey2.c_str());
-        if (FALSE == WriteFile(hFile, encrypted_pem_pubkey2.c_str(), encrypted_pem_pubkey2.length(), nullptr, nullptr)) {
+        if (FALSE == WriteFile(hFile, encrypted_pem_pubkey2.c_str(), encrypted_pem_pubkey2.length(), &WrittenBytes, nullptr)) {
             _tprintf_s(TEXT("Failed to write patch 2. CODE: 0x%08x @[patcher::Solution1::Do -> WriteFile]\r\n"), GetLastError());
             CloseHandle(hFile);
             return FALSE;
         }
 
-        _tprintf_s(TEXT("----------patch 2 done----------\r\n"));
+        _tprintf_s(TEXT("patch 2 done.....\r\n"));
 
         // start patch 3
-        _tprintf_s(TEXT("----------Start to do patch 3----------\r\n"));
+        _tprintf_s(TEXT("\r\nStart to do patch 3.....\r\n"));
         if (INVALID_SET_FILE_POINTER == SetFilePointer(hFile, Patch_Offset[3], nullptr, FILE_BEGIN)) {
             _tprintf_s(TEXT("Failed to set file pointer. CODE: 0x%08x @[patcher::Solution1::Do -> SetFilePointer]\r\n"), GetLastError());
             CloseHandle(hFile);
@@ -400,16 +405,16 @@ namespace patcher::Solution1 {
         }
 
         _tprintf_s(TEXT("At offset +0x%08x, write immediate value %d (type: uint32_t)\r\n"), Patch_Offset[3], imm3);
-        if (FALSE == WriteFile(hFile, &imm3, sizeof(imm3), nullptr, nullptr)) {
+        if (FALSE == WriteFile(hFile, &imm3, sizeof(imm3), &WrittenBytes, nullptr)) {
             _tprintf_s(TEXT("Failed to write patch 3. CODE: 0x%08x @[patcher::Solution1::Do -> WriteFile]\r\n"), GetLastError());
             CloseHandle(hFile);
             return FALSE;
         }
 
-        _tprintf_s(TEXT("----------patch 3 done----------\r\n"));
+        _tprintf_s(TEXT("patch 3 done.....\r\n"));
 
         // start patch 4
-        _tprintf_s(TEXT("----------Start to do patch 4----------\r\n"));
+        _tprintf_s(TEXT("\r\nStart to do patch 4.....\r\n"));
         if (INVALID_SET_FILE_POINTER == SetFilePointer(hFile, Patch_Offset[4], nullptr, FILE_BEGIN)) {
             _tprintf_s(TEXT("Failed to set file pointer. CODE: 0x%08x @[patcher::Solution1::Do -> SetFilePointer]\r\n"), GetLastError());
             CloseHandle(hFile);
@@ -417,13 +422,13 @@ namespace patcher::Solution1 {
         }
 
         _tprintf_s(TEXT("At offset +0x%08x, write:\r\n\"%hs\"\r\n"), Patch_Offset[4], encrypted_pem_pubkey4.c_str());
-        if (FALSE == WriteFile(hFile, encrypted_pem_pubkey4.c_str(), encrypted_pem_pubkey4.length(), nullptr, nullptr)) {
+        if (FALSE == WriteFile(hFile, encrypted_pem_pubkey4.c_str(), encrypted_pem_pubkey4.length(), &WrittenBytes, nullptr)) {
             _tprintf_s(TEXT("Failed to write patch 4. CODE: 0x%08x @[patcher::Solution1::Do -> WriteFile]\r\n"), GetLastError());
             CloseHandle(hFile);
             return FALSE;
         }
 
-        _tprintf_s(TEXT("----------patch 4 done----------\r\n"));
+        _tprintf_s(TEXT("patch 4 done.....\r\n\r\n"));
 
         return TRUE;
     }

+ 2 - 2
navicat-patcher/def.hpp

@@ -19,8 +19,8 @@
 #else
 #pragma comment(lib, "libcryptoMT.lib")
 #endif
-#pragma comment(lib, "WS2_32.lib")      // some symbol are used in OpenSSL lib
-#pragma comment(lib, "Crypt32.lib")     // some symbol are used in OpenSSL lib
+#pragma comment(lib, "WS2_32.lib")      // some symbol are used in OpenSSL static lib
+#pragma comment(lib, "Crypt32.lib")     // some symbol are used in OpenSSL static lib
 #pragma comment(lib, "version.lib")     // GetFileVersionInfoSize, GetFileVersionInfo, VerQueryValue are in this lib
 
 namespace patcher {

+ 4 - 4
navicat-patcher/navicat-patcher.vcxproj

@@ -28,26 +28,26 @@
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseDebugLibraries>true</UseDebugLibraries>
-    <PlatformToolset>v140</PlatformToolset>
+    <PlatformToolset>v140_xp</PlatformToolset>
     <CharacterSet>Unicode</CharacterSet>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseDebugLibraries>false</UseDebugLibraries>
-    <PlatformToolset>v140</PlatformToolset>
+    <PlatformToolset>v140_xp</PlatformToolset>
     <WholeProgramOptimization>true</WholeProgramOptimization>
     <CharacterSet>Unicode</CharacterSet>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseDebugLibraries>true</UseDebugLibraries>
-    <PlatformToolset>v140</PlatformToolset>
+    <PlatformToolset>v140_xp</PlatformToolset>
     <CharacterSet>Unicode</CharacterSet>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseDebugLibraries>false</UseDebugLibraries>
-    <PlatformToolset>v140</PlatformToolset>
+    <PlatformToolset>v140_xp</PlatformToolset>
     <WholeProgramOptimization>true</WholeProgramOptimization>
     <CharacterSet>Unicode</CharacterSet>
   </PropertyGroup>