diff -u -r ultravnc-code-r1257-UltraVNC Project Root.orig/UltraVNC/vncviewer/ClientConnection.cpp ultravnc-code-r1257-UltraVNC Project Root/UltraVNC/vncviewer/ClientConnection.cpp
--- ultravnc-code-r1257-UltraVNC Project Root.orig/UltraVNC/vncviewer/ClientConnection.cpp	2019-11-27 06:14:28.000000000 +0900
+++ ultravnc-code-r1257-UltraVNC Project Root/UltraVNC/vncviewer/ClientConnection.cpp	2019-12-20 14:24:33.210688000 +0900
@@ -630,7 +630,7 @@
 	if (saved_set)
 	{
 		saved_set=FALSE;
-		Save_Latest_Connection();
+		// Save_Latest_Connection();
 	}
 
 	GTGBS_CreateDisplay();
@@ -9798,4 +9798,4 @@
     }
 
 	return TRUE;
-}
\ No newline at end of file
+}
diff -u -r ultravnc-code-r1257-UltraVNC Project Root.orig/UltraVNC/vncviewer/directx/directxviewer.h ultravnc-code-r1257-UltraVNC Project Root/UltraVNC/vncviewer/directx/directxviewer.h
--- ultravnc-code-r1257-UltraVNC Project Root.orig/UltraVNC/vncviewer/directx/directxviewer.h	2016-05-07 23:59:37.000000000 +0900
+++ ultravnc-code-r1257-UltraVNC Project Root/UltraVNC/vncviewer/directx/directxviewer.h	2019-12-19 17:28:20.427904000 +0900
@@ -2,7 +2,6 @@
 #include <winsock2.h>
 #include <windows.h>
 #include <d3d9.h>
-#include <d3dx9.h>
 
 typedef struct {
 
@@ -58,4 +57,4 @@
 HMODULE D3DLibrary;
 D3DCREATETYPE d3dCreate;
 
-};
\ No newline at end of file
+};
diff -u -r ultravnc-code-r1257-UltraVNC Project Root.orig/UltraVNC/vncviewer/LowLevelHook.cpp ultravnc-code-r1257-UltraVNC Project Root/UltraVNC/vncviewer/LowLevelHook.cpp
--- ultravnc-code-r1257-UltraVNC Project Root.orig/UltraVNC/vncviewer/LowLevelHook.cpp	2016-02-25 06:10:48.000000000 +0900
+++ ultravnc-code-r1257-UltraVNC Project Root/UltraVNC/vncviewer/LowLevelHook.cpp	2019-12-20 15:49:38.010083000 +0900
@@ -336,6 +336,15 @@
                                                 fHandled = TRUE;
                                         }
                                 }
+                                else if (pkbdllhook->flags & LLKHF_ALTDOWN) {
+//                                      PostMessage(g_hwndVNCViewer, WM_KEYUP, VK_TAB, 0);
+//                                  if (fKeyDown) {
+                                        PostMessage(g_hwndVNCViewer, WM_SYSCOMMAND, ID_CONN_ALTUP, 0);
+                                        PostMessage(g_hwndVNCViewer, WM_SYSCOMMAND, ID_CONN_ALTDOWN, 0);
+                                        PostMessage(g_hwndVNCViewer, WM_SYSCOMMAND, ID_CONN_ALTUP, 0);
+//                                  }
+//                                      fHandled = TRUE;
+                                }
                                 break;
 
                                 //ESCAPE = ALT+ESC is also a way to switch application, so we block the ESCAPE key,
@@ -360,4 +369,4 @@
 
         //Call the next hook, if we didn't handle this message
     return (fHandled ? TRUE : CallNextHookEx(g_HookID, nCode, wParam, lParam));
-}
\ No newline at end of file
+}
diff -u -r ultravnc-code-r1257-UltraVNC Project Root.orig/UltraVNC/vncviewer/MRU.cpp ultravnc-code-r1257-UltraVNC Project Root/UltraVNC/vncviewer/MRU.cpp
--- ultravnc-code-r1257-UltraVNC Project Root.orig/UltraVNC/vncviewer/MRU.cpp	2019-09-11 04:25:56.000000000 +0900
+++ ultravnc-code-r1257-UltraVNC Project Root/UltraVNC/vncviewer/MRU.cpp	2019-12-19 16:44:28.418956000 +0900
@@ -84,7 +84,10 @@
     TCHAR valname[2];
     valname[0] = firstUnusedId;
     valname[1] = _T('\0');
-	WritePrivateProfileString("connection", valname, txt, m_opts.getDefaultOptionsFileName());    
+    TCHAR wkindex[257];
+	if (GetPrivateProfileString("connection", valname, NULL, wkindex, sizeof(wkindex), m_opts.getDefaultOptionsFileName())==0) {
+		WritePrivateProfileString("connection", valname, txt, m_opts.getDefaultOptionsFileName());
+	}
     // move all the current ids up one
     for (int j = _tcslen(m_index)+1; j >= 0; j--)
         m_index[j] = m_index[j-1];
@@ -198,7 +201,10 @@
 // Save the index string to the registry
 void MRU::WriteIndex()
 {
-	WritePrivateProfileString("connection", INDEX_VAL_NAME, m_index, m_opts.getDefaultOptionsFileName());
+    TCHAR wkindex[257];
+	if (GetPrivateProfileString("connection", INDEX_VAL_NAME, NULL, wkindex, sizeof(wkindex), m_opts.getDefaultOptionsFileName())==0) {
+		WritePrivateProfileString("connection", INDEX_VAL_NAME, m_index, m_opts.getDefaultOptionsFileName());
+	}
 }
 
 
diff -u -r ultravnc-code-r1257-UltraVNC Project Root.orig/UltraVNC/vncviewer/res/vncviewer.rc ultravnc-code-r1257-UltraVNC Project Root/UltraVNC/vncviewer/res/vncviewer.rc
--- ultravnc-code-r1257-UltraVNC Project Root.orig/UltraVNC/vncviewer/res/vncviewer.rc	2019-11-27 06:14:28.000000000 +0900
+++ ultravnc-code-r1257-UltraVNC Project Root/UltraVNC/vncviewer/res/vncviewer.rc	2019-12-16 01:26:02.255012176 +0900
@@ -7,7 +7,11 @@
 //
 // Generated from the TEXTINCLUDE 2 resource.
 //
-#include "afxres.h"
+#include "windows.h"//"afxres.h"
+/* IDC_STATIC is documented in winuser.h, but not defined. */
+#ifndef IDC_STATIC
+#define IDC_STATIC (-1)
+#endif
 
 /////////////////////////////////////////////////////////////////////////////
 #undef APSTUDIO_READONLY_SYMBOLS
diff -u -r ultravnc-code-r1257-UltraVNC Project Root.orig/UltraVNC/vncviewer/SessionDialogTabs.cpp ultravnc-code-r1257-UltraVNC Project Root/UltraVNC/vncviewer/SessionDialogTabs.cpp
--- ultravnc-code-r1257-UltraVNC Project Root.orig/UltraVNC/vncviewer/SessionDialogTabs.cpp	2019-11-27 06:14:28.000000000 +0900
+++ ultravnc-code-r1257-UltraVNC Project Root/UltraVNC/vncviewer/SessionDialogTabs.cpp	2019-12-19 15:37:42.963433000 +0900
@@ -1409,7 +1409,7 @@
 	m_pOpt->m_restricted = restricted;
 	m_pOpt->m_NoStatus = NoStatus;
 	m_pOpt->m_NoHotKeys = NoHotKeys;
-	m_pCC->Save_Latest_Connection();
+	// m_pCC->Save_Latest_Connection();
 	char exePath[255];
 	GetModuleFileName(NULL, exePath, 255);
 	size_t exePathLen = strlen(exePath);
@@ -1424,4 +1424,4 @@
 	GetModuleFileName(NULL, name, 255);
 	ShellExecute(NULL, "open", name, "-listen", exePath, SW_SHOW);
 	exit(1);
-}
\ No newline at end of file
+}
diff -u -r ultravnc-code-r1257-UltraVNC Project Root.orig/UltraVNC/vncviewer/Snapshot.cpp ultravnc-code-r1257-UltraVNC Project Root/UltraVNC/vncviewer/Snapshot.cpp
--- ultravnc-code-r1257-UltraVNC Project Root.orig/UltraVNC/vncviewer/Snapshot.cpp	2019-10-28 04:58:14.000000000 +0900
+++ ultravnc-code-r1257-UltraVNC Project Root/UltraVNC/vncviewer/Snapshot.cpp	2019-12-16 01:27:34.625990381 +0900
@@ -26,7 +26,7 @@
 
 TCHAR * BrowseFolder(TCHAR * saved_path, HWND hwnd)
 {
-    TCHAR path[MAX_PATH];
+static    TCHAR path[MAX_PATH];
 
     const char * path_param = saved_path;
 
diff -u -r ultravnc-code-r1257-UltraVNC Project Root.orig/UltraVNC/vncviewer/VNCOptions.cpp ultravnc-code-r1257-UltraVNC Project Root/UltraVNC/vncviewer/VNCOptions.cpp
--- ultravnc-code-r1257-UltraVNC Project Root.orig/UltraVNC/vncviewer/VNCOptions.cpp	2019-10-28 04:58:14.000000000 +0900
+++ ultravnc-code-r1257-UltraVNC Project Root/UltraVNC/vncviewer/VNCOptions.cpp	2019-12-19 15:52:53.290346000 +0900
@@ -233,12 +233,18 @@
 		*p = '\0';
 		strcat_s(szFileName, "\\options.vnc");
 	}
-	HANDLE m_hDestFile = CreateFile(szFileName, GENERIC_WRITE | GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_ALWAYS, FILE_FLAG_SEQUENTIAL_SCAN, NULL);
-	bool fAlreadyExists = (GetLastError() == ERROR_ALREADY_EXISTS);
-	if (fAlreadyExists) {
-		CloseHandle(m_hDestFile);
-		m_hDestFile = CreateFile(szFileName, GENERIC_WRITE | GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, NULL);
+	HANDLE m_hDestFile;
+	m_hDestFile = CreateFile(szFileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, FILE_FLAG_SEQUENTIAL_SCAN, NULL);
+	if (m_hDestFile != INVALID_HANDLE_VALUE) { 
+		strcpy_s(m_optionfile, MAX_PATH, szFileName); 
+		CloseHandle(m_hDestFile); 
+		return;
 	}
+	m_hDestFile = CreateFile(szFileName, GENERIC_WRITE | GENERIC_READ, FILE_SHARE_READ | FILE_SHARE_WRITE, NULL, OPEN_ALWAYS, FILE_FLAG_SEQUENTIAL_SCAN, NULL);
+	// bool fAlreadyExists = (GetLastError() == ERROR_ALREADY_EXISTS);
+	// if (fAlreadyExists) {
+	// 	CloseHandle(m_hDestFile);
+	// }
 	if (m_hDestFile != INVALID_HANDLE_VALUE) { 
 		strcpy_s(m_optionfile, MAX_PATH, szFileName); 
 		CloseHandle(m_hDestFile); 
diff -u -r ultravnc-code-r1257-UltraVNC Project Root.orig/UltraVNC/vncviewer/vncviewer.vcxproj ultravnc-code-r1257-UltraVNC Project Root/UltraVNC/vncviewer/vncviewer.vcxproj
--- ultravnc-code-r1257-UltraVNC Project Root.orig/UltraVNC/vncviewer/vncviewer.vcxproj	2019-11-17 23:04:43.000000000 +0900
+++ ultravnc-code-r1257-UltraVNC Project Root/UltraVNC/vncviewer/vncviewer.vcxproj	2019-12-16 00:33:20.496690502 +0900
@@ -696,7 +697,6 @@
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
-    <ClCompile Include="Snapshot.cpp" />
     <ClCompile Include="stdhdrs.cpp">
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -814,7 +814,6 @@
     <ClInclude Include="res\resource.h" />
     <ClInclude Include="rfb.h" />
     <ClInclude Include="SessionDialog.h" />
-    <ClInclude Include="Snapshot.h" />
     <ClInclude Include="stdhdrs.h" />
     <ClInclude Include="TextChat.h" />
     <ClInclude Include="vncauth.h" />
