Browse Source

64 bit build

git-svn-id: svn://svn.code.sf.net/p/ditto-cp/code/trunk@561 595ec19a-5cb4-439b-94a8-42fb3063c22c
sabrogden 14 years ago
parent
commit
e0b6f4688f
100 changed files with 7179 additions and 6995 deletions
  1. 1 1
      About.cpp
  2. 181 0
      AccessToSqlite/AccessToSqlite.vcxproj
  3. 106 0
      Addins/DittoUtil/DittoUtil.vcxproj
  4. 1 1
      Addins/DittoUtil/RemoveLineFeeds.cpp
  5. 1 1
      AutoSendToClientThread.cpp
  6. 910 908
      CP_Main.cpp
  7. 0 3379
      CP_Main.vcproj
  8. 1006 477
      CP_Main.vcxproj
  9. 23 57
      CP_Main_10.sln
  10. 11 11
      Client.cpp
  11. 2 2
      Client.h
  12. 73 70
      Clip.cpp
  13. 18 18
      Clip.h
  14. 1 1
      ClipFormatQListCtrl.h
  15. 470 471
      ClipIds.cpp
  16. 3 3
      ClipIds.h
  17. 15 15
      Clip_ImportExport.cpp
  18. 1 1
      Clip_ImportExport.h
  19. 8 8
      ClipboardSaveRestore.cpp
  20. 1 1
      ClipboardViewer.cpp
  21. 1 1
      ClipboardViewer.h
  22. 16 16
      CopyProperties.cpp
  23. BIN
      Debug/sqlite3.dll
  24. BIN
      Debug/zlib1.dll
  25. 1 1
      DialogResizer.cpp
  26. 1 1
      DittoAddin.cpp
  27. 12 12
      DittoAddins.cpp
  28. 2 2
      DittoRulerRichEditCtrl.cpp
  29. BIN
      DittoSetup/U3/device/zlib1.dll
  30. 20 20
      EditWnd.cpp
  31. 3 3
      EditWnd.h
  32. 0 477
      EncryptDecrypt/EncryptDecrypt.vcproj
  33. 92 111
      EncryptDecrypt/EncryptDecrypt.vcxproj
  34. 2 2
      EncryptDecrypt/Encryption.cpp
  35. 17 17
      EncryptDecrypt/sha2.cpp
  36. BIN
      EncryptDecryptD.lib
  37. 1 1
      EventThread.cpp
  38. 1 1
      FileRecieve.cpp
  39. 1 1
      FileSend.cpp
  40. 5 3
      FormattedTextDraw.cpp
  41. 13 13
      GroupTree.cpp
  42. 5 5
      GroupTree.h
  43. 1 1
      HListBox.cpp
  44. 29 17
      HotKeys.cpp
  45. 3 3
      HotKeys.h
  46. 4 3
      InternetUpdate.cpp
  47. 4 4
      MainFrm.cpp
  48. 1 1
      MainFrm.h
  49. 1 1
      MainFrmThread.cpp
  50. 1 1
      MainTableFunctions.cpp
  51. 41 41
      Misc.cpp
  52. 10 10
      Misc.h
  53. 1 1
      MoveToGroupDlg.cpp
  54. 6 6
      MultiLanguage.cpp
  55. 14 10
      OleClipSource.cpp
  56. 1 1
      OleClipSource.h
  57. 7 0
      Options.cpp
  58. 2 2
      OptionsCopyBuffers.cpp
  59. 1 1
      OptionsKeyBoard.cpp
  60. 1 1
      OptionsSheet.cpp
  61. 1 1
      OptionsSheet.h
  62. 1 1
      OptionsTypes.cpp
  63. 14 14
      Path.cpp
  64. 12 12
      QListCtrl.cpp
  65. 2 2
      QListCtrl.h
  66. 42 33
      QPasteWnd.cpp
  67. 10 9
      QPasteWndThread.cpp
  68. 7 5
      RecieveSocket.cpp
  69. BIN
      Release/focus.lib
  70. BIN
      Release/sqlite3.dll
  71. BIN
      Release/zlib1.dll
  72. 3 3
      RichEditCtrlEx.cpp
  73. 2 2
      RichEditCtrlEx.h
  74. 44 44
      RulerRichEditCtrl/External/ColourPicker.cpp
  75. 3 3
      RulerRichEditCtrl/External/ColourPicker.h
  76. 5 5
      RulerRichEditCtrl/RRECRuler.cpp
  77. 13 13
      RulerRichEditCtrl/RulerRichEditCtrl.cpp
  78. 30 32
      RulerRichEditCtrl/TextFile/TextFile.cpp
  79. 1 1
      Server.cpp
  80. 1 1
      Shared/IClip.h
  81. 1 1
      StdAfx.h
  82. 3 3
      SystemTray.cpp
  83. 1 1
      SystemTray.h
  84. 5 5
      TabCtrl.cpp
  85. 1 1
      TabCtrl.h
  86. 252 197
      TinyXml/tinystr.h
  87. 417 170
      TinyXml/tinyxml.h
  88. BIN
      TinyXml/tinyxml.lib
  89. BIN
      TinyXml/tinyxml64.lib
  90. BIN
      TinyXml/tinyxmld.lib
  91. BIN
      TinyXml/tinyxmld64.lib
  92. 6 3
      ToolTipEx.cpp
  93. 92 0
      U3Stop/U3Stop.vcxproj
  94. 2 2
      WndEx.cpp
  95. 1 1
      WndEx.h
  96. 0 206
      focusdll/focus.vcproj
  97. 143 5
      focusdll/focus.vcxproj
  98. 2 1
      sqlite/CppSQLite3.cpp
  99. 0 2
      sqlite/GenerateSqlite3Lib.bat
  100. 2909 0
      sqlite/shell.c

+ 1 - 1
About.cpp

@@ -97,7 +97,7 @@ BOOL CAbout::OnInitDialog()
 	//Show what addins are loaded
 	CStringArray arr;
 	theApp.m_Addins.AboutScreenText(arr);
-	int count = arr.GetCount();
+	INT_PTR count = arr.GetCount();
 	for(int i = 0; i < count; i++)
 	{
 		m_List.AddString(_T("    ") + arr[i]);

+ 181 - 0
AccessToSqlite/AccessToSqlite.vcxproj

@@ -5,10 +5,18 @@
       <Configuration>Debug</Configuration>
       <Platform>Win32</Platform>
     </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
     <ProjectConfiguration Include="Release|Win32">
       <Configuration>Release</Configuration>
       <Platform>Win32</Platform>
     </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
   </ItemGroup>
   <PropertyGroup Label="Globals">
     <RootNamespace>AccessToSqlite</RootNamespace>
@@ -22,35 +30,63 @@
     <UseOfMfc>Dynamic</UseOfMfc>
     <CharacterSet>MultiByte</CharacterSet>
   </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <CharacterSet>MultiByte</CharacterSet>
+  </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
     <ConfigurationType>DynamicLibrary</ConfigurationType>
     <UseOfMfc>Dynamic</UseOfMfc>
     <CharacterSet>MultiByte</CharacterSet>
   </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <CharacterSet>MultiByte</CharacterSet>
+  </PropertyGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   <ImportGroup Label="ExtensionSettings">
   </ImportGroup>
   <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
   </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
+  </ImportGroup>
   <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
   </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
+  </ImportGroup>
   <PropertyGroup Label="UserMacros" />
   <PropertyGroup>
     <_ProjectFileVersion>10.0.21006.1</_ProjectFileVersion>
     <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\Debug\</OutDir>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">.\Debug\</OutDir>
     <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\Debug\</IntDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">.\Debug\</IntDir>
     <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">false</LinkIncremental>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">false</LinkIncremental>
     <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\Release\</OutDir>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.\Release\</OutDir>
     <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\Release\</IntDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.\Release\</IntDir>
     <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
     <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
+    <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
     <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
+    <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
     <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
+    <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
     <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
+    <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
     <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
+    <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
     <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
+    <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
   </PropertyGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <ClCompile>
@@ -98,6 +134,50 @@
       <Culture>0x0409</Culture>
     </ResourceCompile>
   </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <ClCompile>
+      <Optimization>Disabled</Optimization>
+      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
+      <PrecompiledHeaderOutputFile>.\Debug/AccessToSqlite.pch</PrecompiledHeaderOutputFile>
+      <AssemblerListingLocation>.\Debug/</AssemblerListingLocation>
+      <ObjectFileName>.\Debug/</ObjectFileName>
+      <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName>
+      <WarningLevel>Level3</WarningLevel>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+    </ClCompile>
+    <Link>
+      <OutputFile>.\Debug/AccessToSqlite.dll</OutputFile>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <ModuleDefinitionFile>.\AccessToSqlite.def</ModuleDefinitionFile>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <ProgramDatabaseFile>.\Debug/AccessToSqlite.pdb</ProgramDatabaseFile>
+      <SubSystem>Windows</SubSystem>
+      <ImportLibrary>.\Debug/AccessToSqlite.lib</ImportLibrary>
+      <GenerateMapFile>true</GenerateMapFile>
+      <MapFileName>.\Debug/AccessToSqlite.map</MapFileName>
+      <MapExports>true</MapExports>
+    </Link>
+    <Midl>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>true</MkTypLibCompatible>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <TypeLibraryName>.\Debug/AccessToSqlite.tlb</TypeLibraryName>
+      <HeaderFileName>
+      </HeaderFileName>
+    </Midl>
+    <PostBuildEvent>
+      <Command>copy $(TargetDir)*.dll ..\Debug</Command>
+    </PostBuildEvent>
+    <ResourceCompile>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0409</Culture>
+    </ResourceCompile>
+  </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
@@ -144,85 +224,186 @@
       <Culture>0x0409</Culture>
     </ResourceCompile>
   </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <ClCompile>
+      <Optimization>MaxSpeed</Optimization>
+      <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
+      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <StringPooling>true</StringPooling>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
+      <PrecompiledHeaderOutputFile>.\Release/AccessToSqlite.pch</PrecompiledHeaderOutputFile>
+      <AssemblerListingLocation>.\Release/</AssemblerListingLocation>
+      <ObjectFileName>.\Release/</ObjectFileName>
+      <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName>
+      <WarningLevel>Level3</WarningLevel>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+    </ClCompile>
+    <Link>
+      <OutputFile>.\Release/AccessToSqlite.dll</OutputFile>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <ModuleDefinitionFile>.\AccessToSqlite.def</ModuleDefinitionFile>
+      <ProgramDatabaseFile>.\Release/AccessToSqlite.pdb</ProgramDatabaseFile>
+      <SubSystem>Windows</SubSystem>
+      <ImportLibrary>.\Release/AccessToSqlite.lib</ImportLibrary>
+      <GenerateMapFile>true</GenerateMapFile>
+      <MapFileName>.\Release/AccessToSqlite.map</MapFileName>
+      <MapExports>true</MapExports>
+    </Link>
+    <Midl>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>true</MkTypLibCompatible>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <TypeLibraryName>.\Release/AccessToSqlite.tlb</TypeLibraryName>
+      <HeaderFileName>
+      </HeaderFileName>
+    </Midl>
+    <PostBuildEvent>
+      <Command>copy $(TargetDir)*.dll ..\Release</Command>
+    </PostBuildEvent>
+    <ResourceCompile>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0409</Culture>
+    </ResourceCompile>
+  </ItemDefinitionGroup>
   <ItemGroup>
     <ClCompile Include="AccessToSqlite.cpp">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+      <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+      <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">EnableFastChecks</BasicRuntimeChecks>
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
+      <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|x64'">MaxSpeed</Optimization>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
     <ClCompile Include="Clip.cpp">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+      <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+      <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">EnableFastChecks</BasicRuntimeChecks>
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
+      <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|x64'">MaxSpeed</Optimization>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
     <ClCompile Include="Convert.cpp">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+      <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+      <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">EnableFastChecks</BasicRuntimeChecks>
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
+      <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|x64'">MaxSpeed</Optimization>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
     <ClCompile Include="..\sqlite\CppSQLite3.cpp">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+      <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+      <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">EnableFastChecks</BasicRuntimeChecks>
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
+      <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|x64'">MaxSpeed</Optimization>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
     <ClCompile Include="..\Crc32Dynamic.cpp">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+      <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+      <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">EnableFastChecks</BasicRuntimeChecks>
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
+      <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|x64'">MaxSpeed</Optimization>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
     <ClCompile Include="DataTable.cpp">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+      <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+      <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">EnableFastChecks</BasicRuntimeChecks>
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
+      <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|x64'">MaxSpeed</Optimization>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
     <ClCompile Include="MainTable.cpp">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+      <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+      <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">EnableFastChecks</BasicRuntimeChecks>
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
+      <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|x64'">MaxSpeed</Optimization>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
     <ClCompile Include="OpenAccessdatabase.cpp">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+      <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+      <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">EnableFastChecks</BasicRuntimeChecks>
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
+      <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|x64'">MaxSpeed</Optimization>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
     <ClCompile Include="..\ProgressWnd.cpp">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+      <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+      <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">EnableFastChecks</BasicRuntimeChecks>
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
+      <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|x64'">MaxSpeed</Optimization>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
     <ClCompile Include="StdAfx.cpp">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+      <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+      <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">EnableFastChecks</BasicRuntimeChecks>
       <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
+      <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|x64'">MaxSpeed</Optimization>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
     </ClCompile>
     <ClCompile Include="TypesTable.cpp">
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Disabled</Optimization>
+      <Optimization Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Disabled</Optimization>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EnableFastChecks</BasicRuntimeChecks>
+      <BasicRuntimeChecks Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">EnableFastChecks</BasicRuntimeChecks>
       <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">MaxSpeed</Optimization>
+      <Optimization Condition="'$(Configuration)|$(Platform)'=='Release|x64'">MaxSpeed</Optimization>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
   </ItemGroup>
   <ItemGroup>

+ 106 - 0
Addins/DittoUtil/DittoUtil.vcxproj

@@ -5,10 +5,18 @@
       <Configuration>Debug</Configuration>
       <Platform>Win32</Platform>
     </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
     <ProjectConfiguration Include="Release|Win32">
       <Configuration>Release</Configuration>
       <Platform>Win32</Platform>
     </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
   </ItemGroup>
   <PropertyGroup Label="Globals">
     <ProjectGuid>{CF8F6379-5340-4494-8E59-2807ADF37B95}</ProjectGuid>
@@ -20,35 +28,63 @@
     <UseOfMfc>Dynamic</UseOfMfc>
     <CharacterSet>MultiByte</CharacterSet>
   </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <CharacterSet>MultiByte</CharacterSet>
+  </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
     <ConfigurationType>DynamicLibrary</ConfigurationType>
     <UseOfMfc>Dynamic</UseOfMfc>
     <CharacterSet>MultiByte</CharacterSet>
   </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <CharacterSet>MultiByte</CharacterSet>
+  </PropertyGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   <ImportGroup Label="ExtensionSettings">
   </ImportGroup>
   <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
   </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
+  </ImportGroup>
   <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
   </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
+  </ImportGroup>
   <PropertyGroup Label="UserMacros" />
   <PropertyGroup>
     <_ProjectFileVersion>10.0.21006.1</_ProjectFileVersion>
     <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Debug\</OutDir>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Debug\</OutDir>
     <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Debug\</IntDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Debug\</IntDir>
     <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
     <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Release\</OutDir>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Release\</OutDir>
     <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Release\</IntDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Release\</IntDir>
     <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
     <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
+    <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
     <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
+    <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
     <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
+    <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
     <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
+    <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
     <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
+    <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
     <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
+    <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
   </PropertyGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <ClCompile>
@@ -86,6 +122,40 @@
       <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
     </ResourceCompile>
   </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <ClCompile>
+      <Optimization>Disabled</Optimization>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;_USRDLL;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+    </ClCompile>
+    <Link>
+      <OutputFile>$(OutDir)DittoUtil.dll</OutputFile>
+      <ModuleDefinitionFile>.\DittoUtil.def</ModuleDefinitionFile>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <SubSystem>Windows</SubSystem>
+      <ImportLibrary>$(OutDir)DittoUtil.lib</ImportLibrary>
+      <GenerateMapFile>true</GenerateMapFile>
+      <MapFileName>$(TargetDir)$(TargetName).map</MapFileName>
+      <MapExports>true</MapExports>
+    </Link>
+    <Midl>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+    </Midl>
+    <PostBuildEvent>
+      <Command>copy $(TargetDir)*.dll ..\..\Debug\Addins</Command>
+    </PostBuildEvent>
+    <ResourceCompile>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0409</Culture>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+  </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
     <ClCompile>
       <PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;_USRDLL;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -121,6 +191,40 @@
       <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
     </ResourceCompile>
   </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <ClCompile>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;_USRDLL;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+    </ClCompile>
+    <Link>
+      <OutputFile>$(OutDir)DittoUtil.dll</OutputFile>
+      <ModuleDefinitionFile>.\DittoUtil.def</ModuleDefinitionFile>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <SubSystem>Windows</SubSystem>
+      <OptimizeReferences>true</OptimizeReferences>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+      <ImportLibrary>$(OutDir)DittoUtil.lib</ImportLibrary>
+      <GenerateMapFile>true</GenerateMapFile>
+      <MapFileName>$(TargetDir)$(TargetName).map</MapFileName>
+      <MapExports>true</MapExports>
+    </Link>
+    <Midl>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+    </Midl>
+    <PostBuildEvent>
+      <Command>copy $(TargetDir)*.dll ..\..\Release\Addins</Command>
+    </PostBuildEvent>
+    <ResourceCompile>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0409</Culture>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+  </ItemDefinitionGroup>
   <ItemGroup>
     <ClCompile Include="..\..\Shared\TextConvert.cpp" />
     <ClCompile Include="..\..\Shared\Tokenizer.cpp" />
@@ -134,7 +238,9 @@
     <ClCompile Include="SelectPasteFormat.cpp" />
     <ClCompile Include="stdafx.cpp">
       <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
       <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
     </ClCompile>
   </ItemGroup>
   <ItemGroup>

+ 1 - 1
Addins/DittoUtil/RemoveLineFeeds.cpp

@@ -44,7 +44,7 @@ bool CRemoveLineFeeds::Handle_CF_TEXT(IClipFormats *pFormats)
 
 			int count = string.Replace("\r\n", " ");
 
-			int size = GlobalSize(pFormat->Data());
+			//INT_PTR size = GlobalSize(pFormat->Data());
 			strcpy_s(stringData, GlobalSize(pFormat->Data()), string);
 
 			GlobalUnlock(pFormat->Data());

+ 1 - 1
AutoSendToClientThread.cpp

@@ -98,7 +98,7 @@ bool CAutoSendToClientThread::SendToClient(CClipList *pClipList)
 		return FALSE;
 	}
 
-	long lCount = pClipList->GetCount();
+	INT_PTR lCount = pClipList->GetCount();
 
 	LogSendRecieveInfo(StrF(_T("Start of Send ClientThread Count - %d"), lCount));
 

+ 910 - 908
CP_Main.cpp

@@ -1,909 +1,911 @@
-#include "stdafx.h"
-#include "CP_Main.h"
-#include "MainFrm.h"
-#include "Misc.h"
-#include ".\cp_main.h"
-#include "server.h"
-#include "Client.h"
-#include "InternetUpdate.h"
-#include <io.h>
-#include "Path.h"
-#include "Clip_ImportExport.h"
-#include "HyperLink.h"
-#include "OptionsSheet.h"
-#include "DittoCopyBuffer.h"
-#include "SendKeys.h"
-
-#ifdef _DEBUG
-#define new DEBUG_NEW
-#undef THIS_FILE
-static char THIS_FILE[] = __FILE__;
-#endif
-
-class DittoCommandLineInfo : public CCommandLineInfo
-{
-public:
-	DittoCommandLineInfo()
-	{
-		m_bDisconnect = FALSE;
-		m_bConnect = FALSE;
-		m_bU3 = FALSE;
-		m_bU3Stop = FALSE;
-		m_bU3Install = FALSE;
-	}
-
- 	virtual void ParseParam(const TCHAR* pszParam, BOOL bFlag, BOOL bLast)
- 	{
-  		if(bFlag)
-  		{
-  			if(STRICMP(pszParam, _T("Connect")) == 0)
-  			{
-  				m_bConnect = TRUE;
-  			}
-  			else if(STRICMP(pszParam, _T("Disconnect")) == 0)
-  			{
-  				m_bDisconnect = TRUE;
-  			}
-  			else if(STRICMP(pszParam, _T("U3")) == 0)
-  			{
-  				m_bU3 = TRUE;
-  			}
-  			else if(STRICMP(pszParam, _T("U3appStop")) == 0)
-  			{
-  				m_bU3Stop = TRUE;
-  			}
-  			else if(STRICMP(pszParam, _T("U3Install")) == 0)
-  			{
-  				m_bU3Install = TRUE;
-  			}
-  		}
- 
-		CCommandLineInfo::ParseParam(pszParam, bFlag, bLast);
- 	}
-
-	BOOL m_bDisconnect;
-	BOOL m_bConnect;
-	BOOL m_bU3;
-	BOOL m_bU3Stop;
-	BOOL m_bU3Install;
-};
-
-CCP_MainApp theApp;
-
-BEGIN_MESSAGE_MAP(CCP_MainApp, CWinApp)
-	//{{AFX_MSG_MAP(CCP_MainApp)
-		// NOTE - the ClassWizard will add and remove mapping macros here.
-		//    DO NOT EDIT what you see in these blocks of generated code!
-	//}}AFX_MSG_MAP
-END_MESSAGE_MAP()
-
-CCP_MainApp::CCP_MainApp()
-{
-	theApp.m_activeWnd.TrackActiveWnd(NULL);
-
-	m_bAppRunning = false;
-	m_bAppExiting = false;
-	m_connectOnStartup = -1;
-	m_MainhWnd = NULL;
-	m_pMainFrame = NULL;
-
-	m_bShowingQuickPaste = false;
-
-	m_IC_bCopy = false;
-
-	m_GroupDefaultID = 0;
-	m_GroupID = -1;
-	m_GroupParentID = 0;
-	m_GroupText = "History";
-	m_FocusID = -1;
-
-	m_bAsynchronousRefreshView = true;
-
-	m_lClipsSent = 0;
-	m_lClipsRecieved = 0;
-	m_oldtStartUp = COleDateTime::GetCurrentTime();
-
-	m_bExitServerThread = false;
-
-	m_lLastGoodIndexForNextworkPassword = -2;
-
-	m_RTFFormat = ::RegisterClipboardFormat(_T("Rich Text Format"));
-	m_HTML_Format = ::RegisterClipboardFormat(_T("HTML Format"));
-	m_PingFormat = ::RegisterClipboardFormat(_T("Ditto Ping Format"));
-	m_cfIgnoreClipboard = ::RegisterClipboardFormat(_T("Clipboard Viewer Ignore"));
-	m_cfDelaySavingData = ::RegisterClipboardFormat(_T("Ditto Delay Saving Data"));
-	m_RemoteCF_HDROP = ::RegisterClipboardFormat(_T("Ditto Remote CF_HDROP"));
-}
-
-CCP_MainApp::~CCP_MainApp()
-{
-	
-}
-
-BOOL CCP_MainApp::InitInstance()
-{
-	AfxEnableControlContainer();
-	AfxOleInit();
-	AfxInitRichEditEx();
-	afxAmbientActCtx = FALSE; 
-
-	DittoCommandLineInfo cmdInfo;
-	ParseCommandLine(cmdInfo);
-
-	//if starting from a u3 device we will pass in -U3Start
-	if(cmdInfo.m_bU3)
-		g_Opt.m_bU3 = cmdInfo.m_bU3 ? TRUE : FALSE;
-
-	g_Opt.LoadSettings();
-
-	if(cmdInfo.m_strFileName.IsEmpty() == FALSE)
-	{
-		try
-		{
-			g_Opt.m_bEnableDebugLogging = g_Opt.GetEnableDebugLogging();
-
-			CClip_ImportExport Clip;
-			CppSQLite3DB db;
-			db.open(cmdInfo.m_strFileName);
-
-			CClip_ImportExport clip;
-			if(clip.ImportFromSqliteDB(db, false, true))
-			{
-				ShowCommandLineError("Ditto", theApp.m_Language.GetString("Importing_Good", "Clip placed on clipboard"));
-			}
-			else
-			{
-				ShowCommandLineError("Ditto", theApp.m_Language.GetString("Error_Importing", "Error importing exported clip"));
-			}
-		}
-		catch (CppSQLite3Exception& e)
-		{
-			ASSERT(FALSE);
-
-			CString csError;
-			csError.Format(_T("%s - Exception - %d - %s"), theApp.m_Language.GetString("Error_Parsing", "Error parsing exported clip"), e.errorCode(), e.errorMessage());
-			ShowCommandLineError("Ditto", csError);
-		}	
-
-		return FALSE;
-	}
-	else if(cmdInfo.m_bConnect || cmdInfo.m_bDisconnect)
-	{
-		//First get the saved hwnd and send it a message
-		//If ditt is running then this will return 1, meening the running ditto process
-		//handled this message
-		//If it didn't handle the message(ditto is not running) then startup this processes of ditto 
-		//disconnected from the clipboard
-		int ret = 0;
-		HWND hWnd = (HWND)CGetSetOptions::GetMainHWND();
-		if(hWnd)
-		{
-			ret = ::SendMessage(hWnd, WM_SET_CONNECTED, cmdInfo.m_bConnect, cmdInfo.m_bDisconnect);
-		}
-
-		//passed off to the running instance of ditto, exit this instance
-		if(ret == 1)
-		{
-			return FALSE;
-		}
-		
-		if(cmdInfo.m_bConnect)
-		{
-			m_connectOnStartup = TRUE;
-		}
-		else if(cmdInfo.m_bDisconnect)
-		{
-			m_connectOnStartup = FALSE;
-		}
-	}
-
-	CInternetUpdate update;
-
-	long lRunningVersion = update.GetRunningVersion();
-	CString cs = update.GetVersionString(lRunningVersion);
-	cs.Insert(0, _T("InitInstance  -  Running Version - "));
-	Log(cs);
-
-	CString csMutex("Ditto Is Now Running");
-	if(g_Opt.m_bU3)
-	{
-		//If running from a U3 device then allow other ditto's to run
-		//only prevent Ditto from running from the same device
-		csMutex += " ";
-		csMutex += GETENV(_T("U3_DEVICE_SERIAL"));
-	}
-	else if(g_Opt.GetIsPortableDitto())
-	{
-		csMutex += " ";
-		csMutex += g_Opt.GetExeFileName();
-	}
-
-	m_hMutex = CreateMutex(NULL, FALSE, csMutex);
-	DWORD dwError = GetLastError();
-	if(dwError == ERROR_ALREADY_EXISTS)
-	{
-		HWND hWnd = (HWND)CGetSetOptions::GetMainHWND();
-		if(hWnd)
-			::SendMessage(hWnd, WM_SHOW_TRAY_ICON, TRUE, TRUE);
-
-		return TRUE;
-	}
-
-	CString csFile = CGetSetOptions::GetLanguageFile();
-	if(m_Language.LoadLanguageFile(csFile) == false)
-	{
-		CString cs;
-		cs.Format(_T("Error loading language file - %s - \n\n%s"), csFile, m_Language.m_csLastError);
-		Log(cs);
-
-		m_Language.LoadLanguageFile(_T("English.xml"));
-	}
-
-	//The first time we run Ditto on U3 show a web page about ditto
-	if(g_Opt.m_bU3)
-	{
-		if(FileExists(CGetSetOptions::GetDBPath()) == FALSE)
-		{
-			CString csFile = CGetSetOptions::GetPath(PATH_HELP);
-			csFile += "U3_Install.htm";
-			CHyperLink::GotoURL(csFile, SW_SHOW);
-		}
-	}
-
-	int nRet = CheckDBExists(CGetSetOptions::GetDBPath());
-	if(nRet == FALSE)
-	{
-		AfxMessageBox(theApp.m_Language.GetString("Error_Opening_Database", "Error Opening Database."));
-		return FALSE;
-	}
-
-	CMainFrame* pFrame = new CMainFrame;
-	m_pMainWnd = m_pMainFrame = pFrame;
-
-	pFrame->LoadFrame(IDR_MAINFRAME, WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE, NULL, NULL);
-	pFrame->ShowWindow(SW_SHOW);
-	pFrame->UpdateWindow();
-
-	return TRUE;
-}
-
-void CCP_MainApp::AfterMainCreate()
-{
-	m_MainhWnd = m_pMainFrame->m_hWnd;
-	ASSERT( ::IsWindow(m_MainhWnd) );
-	g_Opt.SetMainHWND((long)m_MainhWnd);
-
-	//Save the HWND so the stop app can send us a close message
-	if(g_Opt.m_bU3)
-	{
-		CGetSetOptions::WriteU3Hwnd(m_MainhWnd);
-	}
-
-	g_HotKeys.Init(m_MainhWnd);
-
-	// create hotkeys here.  They are automatically deleted on exit
-	m_pDittoHotKey = new CHotKey(CString("DittoHotKey"), 704); //704 is ctrl-tilda
-
-	m_pPosOne = new CHotKey("Position1", 0, true);
-	m_pPosTwo = new CHotKey("Position2", 0, true);
-	m_pPosThree = new CHotKey("Position3", 0, true);
-	m_pPosFour = new CHotKey("Position4", 0, true);
-	m_pPosFive = new CHotKey("Position5", 0, true);
-	m_pPosSix = new CHotKey("Position6", 0, true);
-	m_pPosSeven = new CHotKey("Position7", 0, true);
-	m_pPosEight = new CHotKey("Position8", 0, true);
-	m_pPosNine = new CHotKey("Position9", 0, true);
-	m_pPosTen = new CHotKey("Position10", 0, true);
-
-	m_pCopyBuffer1 = new CHotKey("CopyBufferCopyHotKey_0", 0, true);
-	m_pPasteBuffer1 = new CHotKey("CopyBufferPasteHotKey_0", 0, true);
-	m_pCutBuffer1 = new CHotKey("CopyBufferCutHotKey_0", 0, true);
-	
-	m_pCopyBuffer2 = new CHotKey("CopyBufferCopyHotKey_1", 0, true);
-	m_pPasteBuffer2 = new CHotKey("CopyBufferPasteHotKey_1", 0, true);
-	m_pCutBuffer2 = new CHotKey("CopyBufferCutHotKey_1", 0, true);
-
-	m_pCopyBuffer3 = new CHotKey("CopyBufferCopyHotKey_2", 0, true);
-	m_pPasteBuffer3 = new CHotKey("CopyBufferPasteHotKey_2", 0, true);
-	m_pCutBuffer3 = new CHotKey("CopyBufferCutHotKey_2", 0, true);
-
-	m_pTextOnlyPaste = new CHotKey("TextOnlyPaste", 0, true);
-
-	g_HotKeys.RegisterAll();
-	StartCopyThread();
-	StartStopServerThread();
-
-#ifdef UNICODE
-	m_Addins.LoadAll();
-#endif
-	
-	m_bAppRunning = true;
-}
-
-void CCP_MainApp::StartStopServerThread()
-{
-	if(CGetSetOptions::GetDisableRecieve() == FALSE && g_Opt.GetAllowFriends())
-	{
-		AfxBeginThread(MTServerThread, m_MainhWnd);
-	}
-	else
-	{
-		m_bExitServerThread = true;
-		closesocket(theApp.m_sSocket);
-	}
-}
-
-void CCP_MainApp::StopServerThread()
-{
-	m_bExitServerThread = true;
-	closesocket(theApp.m_sSocket);
-}
-
-void CCP_MainApp::BeforeMainClose()
-{
-	ASSERT( m_bAppRunning && !m_bAppExiting );
-	m_bAppRunning = false;
-	m_bAppExiting = true;
-	g_HotKeys.UnregisterAll();
-	StopServerThread();
-	StopCopyThread();
-}
-
-void CCP_MainApp::StartCopyThread()
-{
-	ASSERT( m_MainhWnd );
-	CClipTypes* pTypes = LoadTypesFromDB();
-	// initialize to:
-	// - m_MainhWnd = send WM_CLIPBOARD_COPIED messages to m_MainhWnd
-	// - true = use Asynchronous communication (PostMessage)
-	// - true = enable copying on clipboard changes
-	// - pTypes = the supported types to use
-	m_CopyThread.Init(CCopyConfig(m_MainhWnd, true, true, pTypes));
-	
-	if(m_connectOnStartup == FALSE || g_Opt.GetConnectedToClipboard() == FALSE)
-	{
-		m_CopyThread.m_connectOnStartup = false;
-		Log(StrF(_T("Starting Ditto up disconnected from the clipboard, commandLine: %d, saved value: %d"), m_connectOnStartup, g_Opt.GetConnectedToClipboard()));
-		SetConnectCV(false);
-	}
-	else if(m_connectOnStartup == TRUE)
-	{
-		SetConnectCV(true);
-		Log(_T("Starting Ditto up connected from the clipboard, passed in true from command line to start connected"));
-	}
-
-	VERIFY(m_CopyThread.CreateThread(CREATE_SUSPENDED));
-	m_CopyThread.ResumeThread();
-}
-
-void CCP_MainApp::StopCopyThread()
-{
-	EnableCbCopy(false);
-	m_CopyThread.Quit();
-}
-
-// returns the current Clipboard Viewer Connect state (though it might not yet
-//  be actually connected -- check IsClipboardViewerConnected())
-bool CCP_MainApp::ToggleConnectCV()
-{
-	bool bConnect = !GetConnectCV();
-	SetConnectCV(bConnect);
-	return bConnect;
-}
-
-// Sets a menu entry according to the current Clipboard Viewer Connection status
-// - the menu text indicates the available command (opposite the current state)
-// - a check mark appears in the rare cases that the menu text actually represents
-//   the current state, e.g. if we are supposed to be connected, but we somehow
-//   lose that connection, "Disconnect from Clipboard" will have a check next to it.
-void CCP_MainApp::UpdateMenuConnectCV(CMenu* pMenu, UINT nMenuID)
-{
-	if(pMenu == NULL)
-		return;
-
-	bool bConnect = theApp.GetConnectCV();
-	CString cs;
-
-	if(bConnect)
-	{
-		cs = theApp.m_Language.GetString("Disconnect_Clipboard", "Disconnect from Clipboard.");
-		pMenu->ModifyMenu(nMenuID, MF_BYCOMMAND, nMenuID, cs);
-	}
-	else
-	{
-		cs = theApp.m_Language.GetString("Connect_Clipboard", "Connect to Clipboard.");
-		pMenu->ModifyMenu(nMenuID, MF_BYCOMMAND, nMenuID, cs);
-	}
-}
-
-// Allocates a new CClipTypes
-CClipTypes* CCP_MainApp::LoadTypesFromDB()
-{
-	CClipTypes* pTypes = new CClipTypes;
-
-	try
-	{
-		CppSQLite3Query q = theApp.m_db.execQuery(_T("SELECT TypeText FROM Types"));			
-		while(q.eof() == false)
-		{
-			pTypes->Add(GetFormatID(q.getStringField(_T("TypeText"))));
-
-			q.nextRow();
-		}
-	}
-	CATCH_SQLITE_EXCEPTION
-
-	if(pTypes->GetSize() <= 0)
-	{
-		pTypes->Add(CF_TEXT);
-		pTypes->Add(RegisterClipboardFormat(CF_RTF));
-		pTypes->Add(CF_UNICODETEXT);
-		pTypes->Add(CF_HDROP);
-
-		if(g_Opt.m_bU3 == false)
-		{
-			pTypes->Add(CF_DIB);
-		}
-	}
-
-	return pTypes;
-}
-
-void CCP_MainApp::ReloadTypes()
-{
-	CClipTypes* pTypes = LoadTypesFromDB();
-
-	if(pTypes)
-	{
-		m_CopyThread.SetSupportedTypes(pTypes);
-	}
-}
-
-void CCP_MainApp::RefreshView()
-{
-	CQPasteWnd *pWnd = QPasteWnd();
-	if(pWnd)
-	{
-		if(m_bAsynchronousRefreshView)
-		{
-			pWnd->PostMessage(WM_REFRESH_VIEW);
-		}
-		else
-		{
-			pWnd->SendMessage(WM_REFRESH_VIEW);
-		}
-	}
-}
-
-void CCP_MainApp::OnPasteCompleted()
-{
-}
-
-void CCP_MainApp::OnCopyCompleted(long lLastID, int count)
-{
-	if(count <= 0)
-	{
-		return;
-	}
-
-	// update copy statistics
-	CGetSetOptions::SetTripCopyCount(-count);
-	CGetSetOptions::SetTotalCopyCount(-count);
-
-	if(m_CopyBuffer.Active())
-	{
-		m_CopyBuffer.EndCopy(lLastID);
-	}
-
-	RefreshView();
-}
-
-// Internal Clipboard for cut/copy/paste items between Groups
-
-// if NULL, this uses the current QPaste selection
-void CCP_MainApp::IC_Cut(ARRAY* pIDs)
-{
-	if(pIDs == NULL)
-	{
-		if(QPasteWnd())
-		{
-			QPasteWnd()->m_lstHeader.GetSelectionItemData(m_IC_IDs);
-		}
-		else
-		{
-			m_IC_IDs.SetSize(0);
-		}
-	}
-	else
-	{
-		m_IC_IDs.Copy(*pIDs);
-	}
-
-	m_IC_bCopy = false;
-
-	if(QPasteWnd())
-	{
-		QPasteWnd()->UpdateStatus();
-	}
-}
-
-// if NULL, this uses the current QPaste selection
-void CCP_MainApp::IC_Copy(ARRAY* pIDs)
-{
-	if(pIDs == NULL)
-	{
-		if(QPasteWnd())
-		{
-			QPasteWnd()->m_lstHeader.GetSelectionItemData(m_IC_IDs);
-		}
-		else
-		{
-			m_IC_IDs.SetSize(0);
-		}
-	}
-	else
-	{
-		m_IC_IDs.Copy(*pIDs);
-	}
-
-	m_IC_bCopy = true;
-
-	RefreshView();
-}
-
-void CCP_MainApp::IC_Paste()
-{
-	if(m_IC_IDs.GetSize() <= 0)
-	{
-		return;
-	}
-
-	if(m_IC_bCopy)
-	{
-		m_IC_IDs.CopyTo(GetValidGroupID());
-	}
-	else // Move
-	{
-		m_IC_IDs.MoveTo(GetValidGroupID());
-	}
-
-	// don't process the same items twice.
-	m_IC_IDs.SetSize(0);
-	RefreshView();
-}
-
-// Groups
-
-BOOL CCP_MainApp::EnterGroupID(long lID)
-{
-	BOOL bResult = FALSE;
-
-	if(m_GroupID == lID)
-		return TRUE;
-
-	// if we are switching to the parent, focus on the previous group
-	if(m_GroupParentID == lID && m_GroupID > 0)
-		m_FocusID = m_GroupID;
-
-	switch(lID)
-	{
-	case -1:
-		m_FocusID = -1;
-		m_GroupID = -1;
-		m_GroupParentID = -1;
-		m_GroupText = "History";
-		bResult = TRUE;
-		break;
-	default: // Normal Group
-		try
-		{
-			CppSQLite3Query q = theApp.m_db.execQueryEx(_T("SELECT lParentID, mText, bIsGroup FROM Main WHERE lID = %d"), lID);
-			if(q.eof() == false)
-			{
-				if(q.getIntField(_T("bIsGroup")) > 0)
-				{
-					m_GroupID = lID;
-					m_GroupParentID = q.getIntField(_T("lParentID"));
-					m_GroupText = q.getStringField(_T("mText"));
-					bResult = TRUE;
-				}
-			}
-		}
-		CATCH_SQLITE_EXCEPTION
-		break;
-	}
-
-	if(bResult)
-	{
-		theApp.RefreshView();
-		if(QPasteWnd())
-			QPasteWnd()->UpdateStatus(true);
-	}
-
-	return bResult;
-}
-
-// returns a usable group id (not negative)
-long CCP_MainApp::GetValidGroupID()
-{
-	return m_GroupID;
-}
-
-// sets a valid id
-void CCP_MainApp::SetGroupDefaultID(long lID)
-{
-	if(m_GroupDefaultID == lID)
-	{
-		return;
-	}
-
-	if(lID <= 0)
-	{
-		m_GroupDefaultID = 0;
-	}
-	else
-	{
-		m_GroupDefaultID = lID;
-	}
-
-	if(QPasteWnd())
-	{
-		QPasteWnd()->UpdateStatus();
-	}
-}
-
-void CCP_MainApp::SetStatus(const TCHAR* status, bool bRepaintImmediately)
-{
-	m_Status = status;
-	if(QPasteWnd())
-	{
-		QPasteWnd()->UpdateStatus(bRepaintImmediately);
-	}
-}
-
-void CCP_MainApp::ShowPersistent(bool bVal)
-{
-	g_Opt.SetShowPersistent(bVal);
-
-	// give some visual indication
-	if(m_bShowingQuickPaste)
-	{
-		ASSERT(QPasteWnd());
-		QPasteWnd()->SetCaptionColorActive(g_Opt.m_bShowPersistent, theApp.GetConnectCV());
-		QPasteWnd()->RefreshNc();
-	}
-}
-
-/////////////////////////////////////////////////////////////////////////////
-// CCP_MainApp message handlers
-
-int CCP_MainApp::ExitInstance() 
-{
-	Log(_T("ExitInstance"));
-
-	m_db.close();
-
-	return CWinApp::ExitInstance();
-}
-
-// return TRUE if there is more idle processing to do
-BOOL CCP_MainApp::OnIdle(LONG lCount)
-{
-	// let winapp handle its idle processing
-	if(CWinApp::OnIdle(lCount))
-		return TRUE;
-
-	return FALSE;
-}
-
-void CCP_MainApp::SetConnectCV(bool bConnect)
-{ 
-	m_CopyThread.SetConnectCV(bConnect); 
-	g_Opt.SetConnectedToClipboard(bConnect == true);
-
-	if(bConnect)
-	{
-		m_pMainFrame->m_TrayIcon.SetIcon(IDR_MAINFRAME);
-	}
-	else
-	{
-		m_pMainFrame->m_TrayIcon.SetIcon(IDI_DITTO_NOCOPYCB);
-	}
-
-	if(QPasteWnd())
-	{
-		QPasteWnd()->SetCaptionColorActive(g_Opt.m_bShowPersistent, theApp.GetConnectCV());
-		QPasteWnd()->RefreshNc();
-	}
-}
-
-void CCP_MainApp::OnDeleteID(long lID)
-{
-	if(QPasteWnd())
-	{
-		QPasteWnd()->PostMessage(NM_ITEM_DELETED, lID, 0);
-	}
-}
-
-bool CCP_MainApp::ImportClips(HWND hWnd)
-{
-	OPENFILENAME	FileName;
-	TCHAR			szFileName[400];
-	TCHAR			szDir[400];
-
-	memset(&FileName, 0, sizeof(FileName));
-	memset(szFileName, 0, sizeof(szFileName));
-	memset(&szDir, 0, sizeof(szDir));
-
-	CString csInitialDir = CGetSetOptions::GetLastImportDir();
-	STRCPY(szDir, csInitialDir);
-
-	FileName.lStructSize = sizeof(FileName);
-	FileName.lpstrTitle = _T("Import Clips");
-	FileName.Flags = OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT|OFN_PATHMUSTEXIST;
-	FileName.nMaxFile = 400;
-	FileName.lpstrFile = szFileName;
-	FileName.lpstrInitialDir = szDir;
-	FileName.lpstrFilter = _T("Exported Ditto Clips (.dto)\0*.dto\0\0");
-	FileName.lpstrDefExt = _T("dto");
-
-	if(GetOpenFileName(&FileName) == 0)
-	{
-		return false;
-	}
-
-	using namespace nsPath;
-	CPath path(FileName.lpstrFile);
-	CString csPath = path.GetPath();
-	CGetSetOptions::SetLastImportDir(csPath);
-	
-	try
-	{
-		CppSQLite3DB db;
-		db.open(FileName.lpstrFile);
-
-		CClip_ImportExport clip;
-		if(clip.ImportFromSqliteDB(db, true, false))
-		{
-			CShowMainFrame Show;
-
-			CString cs;
-			
-			cs.Format(_T("%s %d "), theApp.m_Language.GetString("Import_Successfully", "Successfully imported"), clip.m_lImportCount);
-			if(clip.m_lImportCount = 1)
-				cs += theApp.m_Language.GetString("Clip", "clip");
-			else
-				cs += theApp.m_Language.GetString("Clips", "clips");
-
-			MessageBox(hWnd, cs, _T("Ditto"), MB_OK);
-		}
-		else
-		{
-			CShowMainFrame Show;
-			MessageBox(hWnd, theApp.m_Language.GetString("Error_Importing", "Error importing exported clip"), _T("Ditto"), MB_OK);
-		}
-	}
-	catch (CppSQLite3Exception& e)
-	{
-		ASSERT(FALSE);
-
-		CString csError;
-		csError.Format(_T("%s - Exception - %d - %s"), theApp.m_Language.GetString("Error_Parsing", "Error parsing exported clip"), e.errorCode(), e.errorMessage());
-		MessageBox(hWnd, csError, _T("Ditto"), MB_OK);
-	}	
-
-	return true;
-}
-
-void CCP_MainApp::ShowCommandLineError(CString csTitle, CString csMessage)
-{
-	Log(StrF(_T("ShowCommandLineError %s - %s"), csTitle, csMessage));
-
-	CToolTipEx *pErrorWnd = new CToolTipEx;
-	pErrorWnd->Create(NULL);
-	pErrorWnd->SetToolTipText(csTitle + "\n\n" + csMessage);
-
-	CPoint pt;
-	CRect rcScreen;
-	GetMonitorRect(0, &rcScreen);
-	pt = rcScreen.BottomRight();
-
-	CRect cr = pErrorWnd->GetBoundsRect();
-
-	pt.x -= max(cr.Width()+50, 150);
-	pt.y -= max(cr.Height()+50, 150);
-
-	pErrorWnd->Show(pt);
-	
-	Sleep(4000);
-
-	pErrorWnd->DestroyWindow();
-}
-
-BOOL CCP_MainApp::GetClipData(long lID, CClipFormat &Clip)
-{
-	BOOL bRet = FALSE;
-
-	try
-	{
-		CppSQLite3Query q = theApp.m_db.execQueryEx(_T("SELECT ooData FROM Data WHERE lParentID = %d AND strClipboardFormat = '%s'"), lID, GetFormatName(Clip.m_cfType));
-		if(q.eof() == false)
-		{
-			int nDataLen = 0;
-			const unsigned char *cData = q.getBlobField(_T("ooData"), nDataLen);
-			if(cData != NULL)
-			{
-				Clip.m_hgData = NewGlobal(nDataLen);
-
-				::CopyToGlobalHP(Clip.m_hgData, (LPVOID)cData, nDataLen);
-
-				bRet = TRUE;
-			}
-		}
-	}
-	CATCH_SQLITE_EXCEPTION
-
-	return bRet;
-}
-
-bool CCP_MainApp::EditItems(CClipIDs &Ids, bool bShowError)
-{
-	m_pMainFrame->ShowEditWnd(Ids);
-
-	return true;
-}
-
-int CCP_MainApp::ShowOptionsDlg()
-{
-	static bool bShowingOptions = false;
-	int nRet = IDABORT;
-
-	if(bShowingOptions == false)
-	{
-		bShowingOptions = true;
-
-		CShowMainFrame Show;
-		COptionsSheet Sheet(_T(""), m_pMainFrame);
-		int nRet = Sheet.DoModal();
-		if(nRet == IDOK)
-		{
-			m_pMainFrame->m_quickPaste.ShowQPasteWnd(m_pMainFrame, false, false, TRUE);	
-		}
-		bShowingOptions = false;
-	}
-
-	return nRet;
-}
-
-void CCP_MainApp::PumpMessageEx(HWND hWnd)
-{
-	MSG KeyboardMsg;
-	while (::PeekMessage(&KeyboardMsg, hWnd, 0, 0, PM_REMOVE))
-	{
-		::TranslateMessage(&KeyboardMsg);
-		::DispatchMessage(&KeyboardMsg);
-	}
-}
-
-HWND CCP_MainApp::QPastehWnd() 
-{ 
-	if(m_pMainFrame != NULL)
-	{
-		if(m_pMainFrame->m_quickPaste.m_pwndPaste != NULL)
-		{
-			return m_pMainFrame->m_quickPaste.m_pwndPaste->GetSafeHwnd();
-		}
-	}
-
-	return NULL;
-}
-
-CQPasteWnd* CCP_MainApp::QPasteWnd() 
-{ 
-	if(m_pMainFrame != NULL)
-	{
-		return m_pMainFrame->m_quickPaste.m_pwndPaste; 
-	}
-
-	return NULL;
+#include "stdafx.h"
+#include "CP_Main.h"
+#include "MainFrm.h"
+#include "Misc.h"
+#include ".\cp_main.h"
+#include "server.h"
+#include "Client.h"
+#include "InternetUpdate.h"
+#include <io.h>
+#include "Path.h"
+#include "Clip_ImportExport.h"
+#include "HyperLink.h"
+#include "OptionsSheet.h"
+#include "DittoCopyBuffer.h"
+#include "SendKeys.h"
+
+#ifdef _DEBUG
+#define new DEBUG_NEW
+#undef THIS_FILE
+static char THIS_FILE[] = __FILE__;
+#endif
+
+class DittoCommandLineInfo : public CCommandLineInfo
+{
+public:
+	DittoCommandLineInfo()
+	{
+		m_bDisconnect = FALSE;
+		m_bConnect = FALSE;
+		m_bU3 = FALSE;
+		m_bU3Stop = FALSE;
+		m_bU3Install = FALSE;
+	}
+
+ 	virtual void ParseParam(const TCHAR* pszParam, BOOL bFlag, BOOL bLast)
+ 	{
+  		if(bFlag)
+  		{
+  			if(STRICMP(pszParam, _T("Connect")) == 0)
+  			{
+  				m_bConnect = TRUE;
+  			}
+  			else if(STRICMP(pszParam, _T("Disconnect")) == 0)
+  			{
+  				m_bDisconnect = TRUE;
+  			}
+  			else if(STRICMP(pszParam, _T("U3")) == 0)
+  			{
+  				m_bU3 = TRUE;
+  			}
+  			else if(STRICMP(pszParam, _T("U3appStop")) == 0)
+  			{
+  				m_bU3Stop = TRUE;
+  			}
+  			else if(STRICMP(pszParam, _T("U3Install")) == 0)
+  			{
+  				m_bU3Install = TRUE;
+  			}
+  		}
+ 
+		CCommandLineInfo::ParseParam(pszParam, bFlag, bLast);
+ 	}
+
+	BOOL m_bDisconnect;
+	BOOL m_bConnect;
+	BOOL m_bU3;
+	BOOL m_bU3Stop;
+	BOOL m_bU3Install;
+};
+
+CCP_MainApp theApp;
+
+BEGIN_MESSAGE_MAP(CCP_MainApp, CWinApp)
+	//{{AFX_MSG_MAP(CCP_MainApp)
+		// NOTE - the ClassWizard will add and remove mapping macros here.
+		//    DO NOT EDIT what you see in these blocks of generated code!
+	//}}AFX_MSG_MAP
+END_MESSAGE_MAP()
+
+CCP_MainApp::CCP_MainApp()
+{
+	theApp.m_activeWnd.TrackActiveWnd(NULL);
+
+	m_bAppRunning = false;
+	m_bAppExiting = false;
+	m_connectOnStartup = -1;
+	m_MainhWnd = NULL;
+	m_pMainFrame = NULL;
+
+	m_bShowingQuickPaste = false;
+
+	m_IC_bCopy = false;
+
+	m_GroupDefaultID = 0;
+	m_GroupID = -1;
+	m_GroupParentID = 0;
+	m_GroupText = "History";
+	m_FocusID = -1;
+
+	m_bAsynchronousRefreshView = true;
+
+	m_lClipsSent = 0;
+	m_lClipsRecieved = 0;
+	m_oldtStartUp = COleDateTime::GetCurrentTime();
+
+	m_bExitServerThread = false;
+
+	m_lLastGoodIndexForNextworkPassword = -2;
+
+	m_RTFFormat = ::RegisterClipboardFormat(_T("Rich Text Format"));
+	m_HTML_Format = ::RegisterClipboardFormat(_T("HTML Format"));
+	m_PingFormat = ::RegisterClipboardFormat(_T("Ditto Ping Format"));
+	m_cfIgnoreClipboard = ::RegisterClipboardFormat(_T("Clipboard Viewer Ignore"));
+	m_cfDelaySavingData = ::RegisterClipboardFormat(_T("Ditto Delay Saving Data"));
+	m_RemoteCF_HDROP = ::RegisterClipboardFormat(_T("Ditto Remote CF_HDROP"));
+}
+
+CCP_MainApp::~CCP_MainApp()
+{
+	
+}
+
+BOOL CCP_MainApp::InitInstance()
+{
+	LoadLibrary(TEXT("riched20.dll"));
+
+	AfxEnableControlContainer();
+	AfxOleInit();
+	AfxInitRichEditEx();
+	afxAmbientActCtx = FALSE; 
+
+	DittoCommandLineInfo cmdInfo;
+	ParseCommandLine(cmdInfo);
+
+	//if starting from a u3 device we will pass in -U3Start
+	if(cmdInfo.m_bU3)
+		g_Opt.m_bU3 = cmdInfo.m_bU3 ? TRUE : FALSE;
+
+	g_Opt.LoadSettings();
+
+	if(cmdInfo.m_strFileName.IsEmpty() == FALSE)
+	{
+		try
+		{
+			g_Opt.m_bEnableDebugLogging = g_Opt.GetEnableDebugLogging();
+
+			CClip_ImportExport Clip;
+			CppSQLite3DB db;
+			db.open(cmdInfo.m_strFileName);
+
+			CClip_ImportExport clip;
+			if(clip.ImportFromSqliteDB(db, false, true))
+			{
+				ShowCommandLineError("Ditto", theApp.m_Language.GetString("Importing_Good", "Clip placed on clipboard"));
+			}
+			else
+			{
+				ShowCommandLineError("Ditto", theApp.m_Language.GetString("Error_Importing", "Error importing exported clip"));
+			}
+		}
+		catch (CppSQLite3Exception& e)
+		{
+			ASSERT(FALSE);
+
+			CString csError;
+			csError.Format(_T("%s - Exception - %d - %s"), theApp.m_Language.GetString("Error_Parsing", "Error parsing exported clip"), e.errorCode(), e.errorMessage());
+			ShowCommandLineError("Ditto", csError);
+		}	
+
+		return FALSE;
+	}
+	else if(cmdInfo.m_bConnect || cmdInfo.m_bDisconnect)
+	{
+		//First get the saved hwnd and send it a message
+		//If ditt is running then this will return 1, meening the running ditto process
+		//handled this message
+		//If it didn't handle the message(ditto is not running) then startup this processes of ditto 
+		//disconnected from the clipboard
+		LRESULT ret = 0;
+		HWND hWnd = (HWND)CGetSetOptions::GetMainHWND();
+		if(hWnd)
+		{
+			ret = ::SendMessage(hWnd, WM_SET_CONNECTED, cmdInfo.m_bConnect, cmdInfo.m_bDisconnect);
+		}
+
+		//passed off to the running instance of ditto, exit this instance
+		if(ret == 1)
+		{
+			return FALSE;
+		}
+		
+		if(cmdInfo.m_bConnect)
+		{
+			m_connectOnStartup = TRUE;
+		}
+		else if(cmdInfo.m_bDisconnect)
+		{
+			m_connectOnStartup = FALSE;
+		}
+	}
+
+	CInternetUpdate update;
+
+	long lRunningVersion = update.GetRunningVersion();
+	CString cs = update.GetVersionString(lRunningVersion);
+	cs.Insert(0, _T("InitInstance  -  Running Version - "));
+	Log(cs);
+
+	CString csMutex("Ditto Is Now Running");
+	if(g_Opt.m_bU3)
+	{
+		//If running from a U3 device then allow other ditto's to run
+		//only prevent Ditto from running from the same device
+		csMutex += " ";
+		csMutex += GETENV(_T("U3_DEVICE_SERIAL"));
+	}
+	else if(g_Opt.GetIsPortableDitto())
+	{
+		csMutex += " ";
+		csMutex += g_Opt.GetExeFileName();
+	}
+
+	m_hMutex = CreateMutex(NULL, FALSE, csMutex);
+	DWORD dwError = GetLastError();
+	if(dwError == ERROR_ALREADY_EXISTS)
+	{
+		HWND hWnd = (HWND)CGetSetOptions::GetMainHWND();
+		if(hWnd)
+			::SendMessage(hWnd, WM_SHOW_TRAY_ICON, TRUE, TRUE);
+
+		return TRUE;
+	}
+
+	CString csFile = CGetSetOptions::GetLanguageFile();
+	if(m_Language.LoadLanguageFile(csFile) == false)
+	{
+		CString cs;
+		cs.Format(_T("Error loading language file - %s - \n\n%s"), csFile, m_Language.m_csLastError);
+		Log(cs);
+
+		m_Language.LoadLanguageFile(_T("English.xml"));
+	}
+
+	//The first time we run Ditto on U3 show a web page about ditto
+	if(g_Opt.m_bU3)
+	{
+		if(FileExists(CGetSetOptions::GetDBPath()) == FALSE)
+		{
+			CString csFile = CGetSetOptions::GetPath(PATH_HELP);
+			csFile += "U3_Install.htm";
+			CHyperLink::GotoURL(csFile, SW_SHOW);
+		}
+	}
+
+	int nRet = CheckDBExists(CGetSetOptions::GetDBPath());
+	if(nRet == FALSE)
+	{
+		AfxMessageBox(theApp.m_Language.GetString("Error_Opening_Database", "Error Opening Database."));
+		return FALSE;
+	}
+
+	CMainFrame* pFrame = new CMainFrame;
+	m_pMainWnd = m_pMainFrame = pFrame;
+
+	pFrame->LoadFrame(IDR_MAINFRAME, WS_OVERLAPPEDWINDOW | FWS_ADDTOTITLE, NULL, NULL);
+	pFrame->ShowWindow(SW_SHOW);
+	pFrame->UpdateWindow();
+
+	return TRUE;
+}
+
+void CCP_MainApp::AfterMainCreate()
+{
+	m_MainhWnd = m_pMainFrame->m_hWnd;
+	ASSERT( ::IsWindow(m_MainhWnd) );
+	g_Opt.SetMainHWND((long)m_MainhWnd);
+
+	//Save the HWND so the stop app can send us a close message
+	if(g_Opt.m_bU3)
+	{
+		CGetSetOptions::WriteU3Hwnd(m_MainhWnd);
+	}
+
+	g_HotKeys.Init(m_MainhWnd);
+
+	// create hotkeys here.  They are automatically deleted on exit
+	m_pDittoHotKey = new CHotKey(CString("DittoHotKey"), 704); //704 is ctrl-tilda
+
+	m_pPosOne = new CHotKey("Position1", 0, true);
+	m_pPosTwo = new CHotKey("Position2", 0, true);
+	m_pPosThree = new CHotKey("Position3", 0, true);
+	m_pPosFour = new CHotKey("Position4", 0, true);
+	m_pPosFive = new CHotKey("Position5", 0, true);
+	m_pPosSix = new CHotKey("Position6", 0, true);
+	m_pPosSeven = new CHotKey("Position7", 0, true);
+	m_pPosEight = new CHotKey("Position8", 0, true);
+	m_pPosNine = new CHotKey("Position9", 0, true);
+	m_pPosTen = new CHotKey("Position10", 0, true);
+
+	m_pCopyBuffer1 = new CHotKey("CopyBufferCopyHotKey_0", 0, true);
+	m_pPasteBuffer1 = new CHotKey("CopyBufferPasteHotKey_0", 0, true);
+	m_pCutBuffer1 = new CHotKey("CopyBufferCutHotKey_0", 0, true);
+	
+	m_pCopyBuffer2 = new CHotKey("CopyBufferCopyHotKey_1", 0, true);
+	m_pPasteBuffer2 = new CHotKey("CopyBufferPasteHotKey_1", 0, true);
+	m_pCutBuffer2 = new CHotKey("CopyBufferCutHotKey_1", 0, true);
+
+	m_pCopyBuffer3 = new CHotKey("CopyBufferCopyHotKey_2", 0, true);
+	m_pPasteBuffer3 = new CHotKey("CopyBufferPasteHotKey_2", 0, true);
+	m_pCutBuffer3 = new CHotKey("CopyBufferCutHotKey_2", 0, true);
+
+	m_pTextOnlyPaste = new CHotKey("TextOnlyPaste", 0, true);
+
+	g_HotKeys.RegisterAll();
+	StartCopyThread();
+	StartStopServerThread();
+
+#ifdef UNICODE
+	m_Addins.LoadAll();
+#endif
+	
+	m_bAppRunning = true;
+}
+
+void CCP_MainApp::StartStopServerThread()
+{
+	if(CGetSetOptions::GetDisableRecieve() == FALSE && g_Opt.GetAllowFriends())
+	{
+		AfxBeginThread(MTServerThread, m_MainhWnd);
+	}
+	else
+	{
+		m_bExitServerThread = true;
+		closesocket(theApp.m_sSocket);
+	}
+}
+
+void CCP_MainApp::StopServerThread()
+{
+	m_bExitServerThread = true;
+	closesocket(theApp.m_sSocket);
+}
+
+void CCP_MainApp::BeforeMainClose()
+{
+	ASSERT( m_bAppRunning && !m_bAppExiting );
+	m_bAppRunning = false;
+	m_bAppExiting = true;
+	g_HotKeys.UnregisterAll();
+	StopServerThread();
+	StopCopyThread();
+}
+
+void CCP_MainApp::StartCopyThread()
+{
+	ASSERT( m_MainhWnd );
+	CClipTypes* pTypes = LoadTypesFromDB();
+	// initialize to:
+	// - m_MainhWnd = send WM_CLIPBOARD_COPIED messages to m_MainhWnd
+	// - true = use Asynchronous communication (PostMessage)
+	// - true = enable copying on clipboard changes
+	// - pTypes = the supported types to use
+	m_CopyThread.Init(CCopyConfig(m_MainhWnd, true, true, pTypes));
+	
+	if(m_connectOnStartup == FALSE || g_Opt.GetConnectedToClipboard() == FALSE)
+	{
+		m_CopyThread.m_connectOnStartup = false;
+		Log(StrF(_T("Starting Ditto up disconnected from the clipboard, commandLine: %d, saved value: %d"), m_connectOnStartup, g_Opt.GetConnectedToClipboard()));
+		SetConnectCV(false);
+	}
+	else if(m_connectOnStartup == TRUE)
+	{
+		SetConnectCV(true);
+		Log(_T("Starting Ditto up connected from the clipboard, passed in true from command line to start connected"));
+	}
+
+	VERIFY(m_CopyThread.CreateThread(CREATE_SUSPENDED));
+	m_CopyThread.ResumeThread();
+}
+
+void CCP_MainApp::StopCopyThread()
+{
+	EnableCbCopy(false);
+	m_CopyThread.Quit();
+}
+
+// returns the current Clipboard Viewer Connect state (though it might not yet
+//  be actually connected -- check IsClipboardViewerConnected())
+bool CCP_MainApp::ToggleConnectCV()
+{
+	bool bConnect = !GetConnectCV();
+	SetConnectCV(bConnect);
+	return bConnect;
+}
+
+// Sets a menu entry according to the current Clipboard Viewer Connection status
+// - the menu text indicates the available command (opposite the current state)
+// - a check mark appears in the rare cases that the menu text actually represents
+//   the current state, e.g. if we are supposed to be connected, but we somehow
+//   lose that connection, "Disconnect from Clipboard" will have a check next to it.
+void CCP_MainApp::UpdateMenuConnectCV(CMenu* pMenu, UINT nMenuID)
+{
+	if(pMenu == NULL)
+		return;
+
+	bool bConnect = theApp.GetConnectCV();
+	CString cs;
+
+	if(bConnect)
+	{
+		cs = theApp.m_Language.GetString("Disconnect_Clipboard", "Disconnect from Clipboard.");
+		pMenu->ModifyMenu(nMenuID, MF_BYCOMMAND, nMenuID, cs);
+	}
+	else
+	{
+		cs = theApp.m_Language.GetString("Connect_Clipboard", "Connect to Clipboard.");
+		pMenu->ModifyMenu(nMenuID, MF_BYCOMMAND, nMenuID, cs);
+	}
+}
+
+// Allocates a new CClipTypes
+CClipTypes* CCP_MainApp::LoadTypesFromDB()
+{
+	CClipTypes* pTypes = new CClipTypes;
+
+	try
+	{
+		CppSQLite3Query q = theApp.m_db.execQuery(_T("SELECT TypeText FROM Types"));			
+		while(q.eof() == false)
+		{
+			pTypes->Add(GetFormatID(q.getStringField(_T("TypeText"))));
+
+			q.nextRow();
+		}
+	}
+	CATCH_SQLITE_EXCEPTION
+
+	if(pTypes->GetSize() <= 0)
+	{
+		pTypes->Add(CF_TEXT);
+		pTypes->Add(RegisterClipboardFormat(CF_RTF));
+		pTypes->Add(CF_UNICODETEXT);
+		pTypes->Add(CF_HDROP);
+
+		if(g_Opt.m_bU3 == false)
+		{
+			pTypes->Add(CF_DIB);
+		}
+	}
+
+	return pTypes;
+}
+
+void CCP_MainApp::ReloadTypes()
+{
+	CClipTypes* pTypes = LoadTypesFromDB();
+
+	if(pTypes)
+	{
+		m_CopyThread.SetSupportedTypes(pTypes);
+	}
+}
+
+void CCP_MainApp::RefreshView()
+{
+	CQPasteWnd *pWnd = QPasteWnd();
+	if(pWnd)
+	{
+		if(m_bAsynchronousRefreshView)
+		{
+			pWnd->PostMessage(WM_REFRESH_VIEW);
+		}
+		else
+		{
+			pWnd->SendMessage(WM_REFRESH_VIEW);
+		}
+	}
+}
+
+void CCP_MainApp::OnPasteCompleted()
+{
+}
+
+void CCP_MainApp::OnCopyCompleted(long lLastID, int count)
+{
+	if(count <= 0)
+	{
+		return;
+	}
+
+	// update copy statistics
+	CGetSetOptions::SetTripCopyCount(-count);
+	CGetSetOptions::SetTotalCopyCount(-count);
+
+	if(m_CopyBuffer.Active())
+	{
+		m_CopyBuffer.EndCopy(lLastID);
+	}
+
+	RefreshView();
+}
+
+// Internal Clipboard for cut/copy/paste items between Groups
+
+// if NULL, this uses the current QPaste selection
+void CCP_MainApp::IC_Cut(ARRAY* pIDs)
+{
+	if(pIDs == NULL)
+	{
+		if(QPasteWnd())
+		{
+			QPasteWnd()->m_lstHeader.GetSelectionItemData(m_IC_IDs);
+		}
+		else
+		{
+			m_IC_IDs.SetSize(0);
+		}
+	}
+	else
+	{
+		m_IC_IDs.Copy(*pIDs);
+	}
+
+	m_IC_bCopy = false;
+
+	if(QPasteWnd())
+	{
+		QPasteWnd()->UpdateStatus();
+	}
+}
+
+// if NULL, this uses the current QPaste selection
+void CCP_MainApp::IC_Copy(ARRAY* pIDs)
+{
+	if(pIDs == NULL)
+	{
+		if(QPasteWnd())
+		{
+			QPasteWnd()->m_lstHeader.GetSelectionItemData(m_IC_IDs);
+		}
+		else
+		{
+			m_IC_IDs.SetSize(0);
+		}
+	}
+	else
+	{
+		m_IC_IDs.Copy(*pIDs);
+	}
+
+	m_IC_bCopy = true;
+
+	RefreshView();
+}
+
+void CCP_MainApp::IC_Paste()
+{
+	if(m_IC_IDs.GetSize() <= 0)
+	{
+		return;
+	}
+
+	if(m_IC_bCopy)
+	{
+		m_IC_IDs.CopyTo(GetValidGroupID());
+	}
+	else // Move
+	{
+		m_IC_IDs.MoveTo(GetValidGroupID());
+	}
+
+	// don't process the same items twice.
+	m_IC_IDs.SetSize(0);
+	RefreshView();
+}
+
+// Groups
+
+BOOL CCP_MainApp::EnterGroupID(long lID)
+{
+	BOOL bResult = FALSE;
+
+	if(m_GroupID == lID)
+		return TRUE;
+
+	// if we are switching to the parent, focus on the previous group
+	if(m_GroupParentID == lID && m_GroupID > 0)
+		m_FocusID = m_GroupID;
+
+	switch(lID)
+	{
+	case -1:
+		m_FocusID = -1;
+		m_GroupID = -1;
+		m_GroupParentID = -1;
+		m_GroupText = "History";
+		bResult = TRUE;
+		break;
+	default: // Normal Group
+		try
+		{
+			CppSQLite3Query q = theApp.m_db.execQueryEx(_T("SELECT lParentID, mText, bIsGroup FROM Main WHERE lID = %d"), lID);
+			if(q.eof() == false)
+			{
+				if(q.getIntField(_T("bIsGroup")) > 0)
+				{
+					m_GroupID = lID;
+					m_GroupParentID = q.getIntField(_T("lParentID"));
+					m_GroupText = q.getStringField(_T("mText"));
+					bResult = TRUE;
+				}
+			}
+		}
+		CATCH_SQLITE_EXCEPTION
+		break;
+	}
+
+	if(bResult)
+	{
+		theApp.RefreshView();
+		if(QPasteWnd())
+			QPasteWnd()->UpdateStatus(true);
+	}
+
+	return bResult;
+}
+
+// returns a usable group id (not negative)
+long CCP_MainApp::GetValidGroupID()
+{
+	return m_GroupID;
+}
+
+// sets a valid id
+void CCP_MainApp::SetGroupDefaultID(long lID)
+{
+	if(m_GroupDefaultID == lID)
+	{
+		return;
+	}
+
+	if(lID <= 0)
+	{
+		m_GroupDefaultID = 0;
+	}
+	else
+	{
+		m_GroupDefaultID = lID;
+	}
+
+	if(QPasteWnd())
+	{
+		QPasteWnd()->UpdateStatus();
+	}
+}
+
+void CCP_MainApp::SetStatus(const TCHAR* status, bool bRepaintImmediately)
+{
+	m_Status = status;
+	if(QPasteWnd())
+	{
+		QPasteWnd()->UpdateStatus(bRepaintImmediately);
+	}
+}
+
+void CCP_MainApp::ShowPersistent(bool bVal)
+{
+	g_Opt.SetShowPersistent(bVal);
+
+	// give some visual indication
+	if(m_bShowingQuickPaste)
+	{
+		ASSERT(QPasteWnd());
+		QPasteWnd()->SetCaptionColorActive(g_Opt.m_bShowPersistent, theApp.GetConnectCV());
+		QPasteWnd()->RefreshNc();
+	}
+}
+
+/////////////////////////////////////////////////////////////////////////////
+// CCP_MainApp message handlers
+
+int CCP_MainApp::ExitInstance() 
+{
+	Log(_T("ExitInstance"));
+
+	m_db.close();
+
+	return CWinApp::ExitInstance();
+}
+
+// return TRUE if there is more idle processing to do
+BOOL CCP_MainApp::OnIdle(LONG lCount)
+{
+	// let winapp handle its idle processing
+	if(CWinApp::OnIdle(lCount))
+		return TRUE;
+
+	return FALSE;
+}
+
+void CCP_MainApp::SetConnectCV(bool bConnect)
+{ 
+	m_CopyThread.SetConnectCV(bConnect); 
+	g_Opt.SetConnectedToClipboard(bConnect == true);
+
+	if(bConnect)
+	{
+		m_pMainFrame->m_TrayIcon.SetIcon(IDR_MAINFRAME);
+	}
+	else
+	{
+		m_pMainFrame->m_TrayIcon.SetIcon(IDI_DITTO_NOCOPYCB);
+	}
+
+	if(QPasteWnd())
+	{
+		QPasteWnd()->SetCaptionColorActive(g_Opt.m_bShowPersistent, theApp.GetConnectCV());
+		QPasteWnd()->RefreshNc();
+	}
+}
+
+void CCP_MainApp::OnDeleteID(long lID)
+{
+	if(QPasteWnd())
+	{
+		QPasteWnd()->PostMessage(NM_ITEM_DELETED, lID, 0);
+	}
+}
+
+bool CCP_MainApp::ImportClips(HWND hWnd)
+{
+	OPENFILENAME	FileName;
+	TCHAR			szFileName[400];
+	TCHAR			szDir[400];
+
+	memset(&FileName, 0, sizeof(FileName));
+	memset(szFileName, 0, sizeof(szFileName));
+	memset(&szDir, 0, sizeof(szDir));
+
+	CString csInitialDir = CGetSetOptions::GetLastImportDir();
+	STRCPY(szDir, csInitialDir);
+
+	FileName.lStructSize = sizeof(FileName);
+	FileName.lpstrTitle = _T("Import Clips");
+	FileName.Flags = OFN_HIDEREADONLY|OFN_OVERWRITEPROMPT|OFN_PATHMUSTEXIST;
+	FileName.nMaxFile = 400;
+	FileName.lpstrFile = szFileName;
+	FileName.lpstrInitialDir = szDir;
+	FileName.lpstrFilter = _T("Exported Ditto Clips (.dto)\0*.dto\0\0");
+	FileName.lpstrDefExt = _T("dto");
+
+	if(GetOpenFileName(&FileName) == 0)
+	{
+		return false;
+	}
+
+	using namespace nsPath;
+	CPath path(FileName.lpstrFile);
+	CString csPath = path.GetPath();
+	CGetSetOptions::SetLastImportDir(csPath);
+	
+	try
+	{
+		CppSQLite3DB db;
+		db.open(FileName.lpstrFile);
+
+		CClip_ImportExport clip;
+		if(clip.ImportFromSqliteDB(db, true, false))
+		{
+			CShowMainFrame Show;
+
+			CString cs;
+			
+			cs.Format(_T("%s %d "), theApp.m_Language.GetString("Import_Successfully", "Successfully imported"), clip.m_importCount);
+			if(clip.m_importCount = 1)
+				cs += theApp.m_Language.GetString("Clip", "clip");
+			else
+				cs += theApp.m_Language.GetString("Clips", "clips");
+
+			MessageBox(hWnd, cs, _T("Ditto"), MB_OK);
+		}
+		else
+		{
+			CShowMainFrame Show;
+			MessageBox(hWnd, theApp.m_Language.GetString("Error_Importing", "Error importing exported clip"), _T("Ditto"), MB_OK);
+		}
+	}
+	catch (CppSQLite3Exception& e)
+	{
+		ASSERT(FALSE);
+
+		CString csError;
+		csError.Format(_T("%s - Exception - %d - %s"), theApp.m_Language.GetString("Error_Parsing", "Error parsing exported clip"), e.errorCode(), e.errorMessage());
+		MessageBox(hWnd, csError, _T("Ditto"), MB_OK);
+	}	
+
+	return true;
+}
+
+void CCP_MainApp::ShowCommandLineError(CString csTitle, CString csMessage)
+{
+	Log(StrF(_T("ShowCommandLineError %s - %s"), csTitle, csMessage));
+
+	CToolTipEx *pErrorWnd = new CToolTipEx;
+	pErrorWnd->Create(NULL);
+	pErrorWnd->SetToolTipText(csTitle + "\n\n" + csMessage);
+
+	CPoint pt;
+	CRect rcScreen;
+	GetMonitorRect(0, &rcScreen);
+	pt = rcScreen.BottomRight();
+
+	CRect cr = pErrorWnd->GetBoundsRect();
+
+	pt.x -= max(cr.Width()+50, 150);
+	pt.y -= max(cr.Height()+50, 150);
+
+	pErrorWnd->Show(pt);
+	
+	Sleep(4000);
+
+	pErrorWnd->DestroyWindow();
+}
+
+BOOL CCP_MainApp::GetClipData(long lID, CClipFormat &Clip)
+{
+	BOOL bRet = FALSE;
+
+	try
+	{
+		CppSQLite3Query q = theApp.m_db.execQueryEx(_T("SELECT ooData FROM Data WHERE lParentID = %d AND strClipboardFormat = '%s'"), lID, GetFormatName(Clip.m_cfType));
+		if(q.eof() == false)
+		{
+			int nDataLen = 0;
+			const unsigned char *cData = q.getBlobField(_T("ooData"), nDataLen);
+			if(cData != NULL)
+			{
+				Clip.m_hgData = NewGlobal(nDataLen);
+
+				::CopyToGlobalHP(Clip.m_hgData, (LPVOID)cData, nDataLen);
+
+				bRet = TRUE;
+			}
+		}
+	}
+	CATCH_SQLITE_EXCEPTION
+
+	return bRet;
+}
+
+bool CCP_MainApp::EditItems(CClipIDs &Ids, bool bShowError)
+{
+	m_pMainFrame->ShowEditWnd(Ids);
+
+	return true;
+}
+
+int CCP_MainApp::ShowOptionsDlg()
+{
+	static bool bShowingOptions = false;
+	int nRet = IDABORT;
+
+	if(bShowingOptions == false)
+	{
+		bShowingOptions = true;
+
+		CShowMainFrame Show;
+		COptionsSheet Sheet(_T(""), m_pMainFrame);
+		INT_PTR nRet = Sheet.DoModal();
+		if(nRet == IDOK)
+		{
+			m_pMainFrame->m_quickPaste.ShowQPasteWnd(m_pMainFrame, false, false, TRUE);	
+		}
+		bShowingOptions = false;
+	}
+
+	return nRet;
+}
+
+void CCP_MainApp::PumpMessageEx(HWND hWnd)
+{
+	MSG KeyboardMsg;
+	while (::PeekMessage(&KeyboardMsg, hWnd, 0, 0, PM_REMOVE))
+	{
+		::TranslateMessage(&KeyboardMsg);
+		::DispatchMessage(&KeyboardMsg);
+	}
+}
+
+HWND CCP_MainApp::QPastehWnd() 
+{ 
+	if(m_pMainFrame != NULL)
+	{
+		if(m_pMainFrame->m_quickPaste.m_pwndPaste != NULL)
+		{
+			return m_pMainFrame->m_quickPaste.m_pwndPaste->GetSafeHwnd();
+		}
+	}
+
+	return NULL;
+}
+
+CQPasteWnd* CCP_MainApp::QPasteWnd() 
+{ 
+	if(m_pMainFrame != NULL)
+	{
+		return m_pMainFrame->m_quickPaste.m_pwndPaste; 
+	}
+
+	return NULL;
 }

+ 0 - 3379
CP_Main.vcproj

@@ -1,3379 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="7.10"
-	Name="CP_Main"
-	RootNamespace="CP_Main"
-	Keyword="MFCProj">
-	<Platforms>
-		<Platform
-			Name="Win32"/>
-	</Platforms>
-	<Configurations>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory=".\Release"
-			IntermediateDirectory=".\Release"
-			ConfigurationType="1"
-			UseOfMFC="2"
-			ATLMinimizesCRunTimeLibraryUsage="FALSE"
-			CharacterSet="2">
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="2"
-				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="EncryptDecrypt\,TinyXml\"
-				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;AFTER_98"
-				StringPooling="TRUE"
-				RuntimeLibrary="2"
-				EnableFunctionLevelLinking="TRUE"
-				UsePrecompiledHeader="3"
-				PrecompiledHeaderThrough="stdafx.h"
-				PrecompiledHeaderFile=".\Release/CP_Main.pch"
-				AssemblerOutput="4"
-				AssemblerListingLocation=".\Release/"
-				ObjectFile=".\Release/"
-				ProgramDataBaseFileName=".\Release/"
-				WarningLevel="3"
-				SuppressStartupBanner="TRUE"
-				CompileAs="0"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="ws2_32.lib riched20.lib kernel32.lib user32.lib gdi32.lib winspool.lib Winmm.lib EncryptDecrypt.lib Version.Lib sqlite\sqlite3.lib"
-				OutputFile="Release/Ditto.exe"
-				LinkIncremental="1"
-				SuppressStartupBanner="TRUE"
-				AdditionalLibraryDirectories="focusdll\Release"
-				GenerateDebugInformation="TRUE"
-				ProgramDatabaseFile=".\Release/Ditto.pdb"
-				GenerateMapFile="TRUE"
-				MapFileName=".\Release/Ditto.map"
-				SubSystem="2"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"
-				PreprocessorDefinitions="NDEBUG"
-				MkTypLibCompatible="TRUE"
-				SuppressStartupBanner="TRUE"
-				TargetEnvironment="1"
-				TypeLibraryName=".\Release/CP_Main.tlb"
-				HeaderFileName=""/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="NDEBUG"
-				Culture="1033"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory=".\Debug"
-			IntermediateDirectory=".\Debug"
-			ConfigurationType="1"
-			UseOfMFC="2"
-			ATLMinimizesCRunTimeLibraryUsage="FALSE"
-			CharacterSet="2">
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				AdditionalIncludeDirectories="EncryptDecrypt\,TinyXml\"
-				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;AFTER_98"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="3"
-				UsePrecompiledHeader="3"
-				PrecompiledHeaderThrough="stdafx.h"
-				PrecompiledHeaderFile=".\Debug/CP_Main.pch"
-				AssemblerListingLocation=".\Debug/"
-				ObjectFile=".\Debug/"
-				ProgramDataBaseFileName=".\Debug/"
-				WarningLevel="3"
-				SuppressStartupBanner="TRUE"
-				DebugInformationFormat="4"
-				CompileAs="0"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="ws2_32.lib riched20.lib kernel32.lib user32.lib gdi32.lib winspool.lib Winmm.lib Version.Lib Pdh.lib EncryptDecryptD.lib sqlite\sqlite3.lib"
-				OutputFile="Debug/Ditto.exe"
-				LinkIncremental="2"
-				SuppressStartupBanner="TRUE"
-				GenerateDebugInformation="TRUE"
-				ProgramDatabaseFile=".\Debug/Ditto.pdb"
-				SubSystem="2"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"
-				PreprocessorDefinitions="_DEBUG"
-				MkTypLibCompatible="TRUE"
-				SuppressStartupBanner="TRUE"
-				TargetEnvironment="1"
-				TypeLibraryName=".\Debug/CP_Main.tlb"
-				HeaderFileName=""/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="_DEBUG"
-				Culture="1033"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-		<Configuration
-			Name="Unicode Release|Win32"
-			OutputDirectory=".\CP_Main___Win32_Unicode_Release"
-			IntermediateDirectory=".\CP_Main___Win32_Unicode_Release"
-			ConfigurationType="1"
-			UseOfMFC="2"
-			ATLMinimizesCRunTimeLibraryUsage="FALSE"
-			CharacterSet="1">
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="2"
-				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="EncryptDecrypt\,TinyXml\"
-				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;AFTER_98;UNICODE"
-				StringPooling="TRUE"
-				RuntimeLibrary="2"
-				EnableFunctionLevelLinking="TRUE"
-				UsePrecompiledHeader="3"
-				PrecompiledHeaderThrough="stdafx.h"
-				PrecompiledHeaderFile=".\CP_Main___Win32_Unicode_Release/CP_Main.pch"
-				AssemblerOutput="4"
-				AssemblerListingLocation=".\CP_Main___Win32_Unicode_Release/"
-				ObjectFile=".\CP_Main___Win32_Unicode_Release/"
-				ProgramDataBaseFileName=".\CP_Main___Win32_Unicode_Release/"
-				WarningLevel="3"
-				SuppressStartupBanner="TRUE"
-				CompileAs="0"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="ws2_32.lib riched20.lib kernel32.lib user32.lib gdi32.lib winspool.lib Winmm.lib UEncryptDecrypt.lib Version.Lib sqlite\sqlite3.lib focus.lib"
-				OutputFile="Release/DittoU.exe"
-				LinkIncremental="1"
-				SuppressStartupBanner="TRUE"
-				AdditionalLibraryDirectories="focusdll\Release"
-				GenerateDebugInformation="TRUE"
-				ProgramDatabaseFile=".\CP_Main___Win32_Unicode_Release/DittoU.pdb"
-				GenerateMapFile="TRUE"
-				MapFileName=".\CP_Main___Win32_Unicode_Release/DittoU.map"
-				SubSystem="2"
-				EntryPointSymbol="wWinMainCRTStartup"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"
-				PreprocessorDefinitions="NDEBUG"
-				MkTypLibCompatible="TRUE"
-				SuppressStartupBanner="TRUE"
-				TargetEnvironment="1"
-				TypeLibraryName=".\CP_Main___Win32_Unicode_Release/CP_Main.tlb"
-				HeaderFileName=""/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="NDEBUG"
-				Culture="1033"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-		<Configuration
-			Name="Unicode Debug|Win32"
-			OutputDirectory=".\CP_Main___Win32_Unicode_Debug"
-			IntermediateDirectory=".\CP_Main___Win32_Unicode_Debug"
-			ConfigurationType="1"
-			UseOfMFC="2"
-			ATLMinimizesCRunTimeLibraryUsage="FALSE"
-			CharacterSet="1">
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				AdditionalIncludeDirectories="EncryptDecrypt\,TinyXml\"
-				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;AFTER_98;UNICODE"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="3"
-				UsePrecompiledHeader="3"
-				PrecompiledHeaderThrough="stdafx.h"
-				PrecompiledHeaderFile=".\CP_Main___Win32_Unicode_Debug/CP_Main.pch"
-				AssemblerListingLocation=".\CP_Main___Win32_Unicode_Debug/"
-				ObjectFile=".\CP_Main___Win32_Unicode_Debug/"
-				ProgramDataBaseFileName=".\CP_Main___Win32_Unicode_Debug/"
-				WarningLevel="3"
-				SuppressStartupBanner="TRUE"
-				DebugInformationFormat="4"
-				CompileAs="0"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="ws2_32.lib riched20.lib kernel32.lib user32.lib gdi32.lib winspool.lib Winmm.lib Version.Lib Pdh.lib UEncryptDecryptD.lib sqlite\sqlite3.lib"
-				OutputFile="Debug/DittoU.exe"
-				LinkIncremental="2"
-				SuppressStartupBanner="TRUE"
-				GenerateDebugInformation="TRUE"
-				ProgramDatabaseFile=".\CP_Main___Win32_Unicode_Debug/DittoU.pdb"
-				SubSystem="2"
-				EntryPointSymbol="wWinMainCRTStartup"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCMIDLTool"
-				PreprocessorDefinitions="_DEBUG"
-				MkTypLibCompatible="TRUE"
-				SuppressStartupBanner="TRUE"
-				TargetEnvironment="1"
-				TypeLibraryName=".\CP_Main___Win32_Unicode_Debug/CP_Main.tlb"
-				HeaderFileName=""/>
-			<Tool
-				Name="VCPostBuildEventTool"/>
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="_DEBUG"
-				Culture="1033"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCManagedWrapperGeneratorTool"/>
-			<Tool
-				Name="VCAuxiliaryManagedWrapperGeneratorTool"/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="Source Files"
-			Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
-			<File
-				RelativePath="About.cpp">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="AccessToSqlite.cpp">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="AddType.cpp">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="BitmapHelper.cpp">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath=".\CF_HDropAggregator.cpp">
-			</File>
-			<File
-				RelativePath=".\CF_TextAggregator.cpp">
-			</File>
-			<File
-				RelativePath=".\CF_UnicodeTextAggregator.cpp">
-			</File>
-			<File
-				RelativePath="Clip.cpp">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath=".\Clip_ImportExport.cpp">
-			</File>
-			<File
-				RelativePath=".\ClipboardSaveRestore.cpp">
-			</File>
-			<File
-				RelativePath="ClipboardViewer.cpp">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="ClipIds.cpp">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="CopyProperties.cpp">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="CopyThread.cpp">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="CP_Main.cpp">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="CP_Main.rc">
-				<FileConfiguration
-					Name="Unicode Release|Win32">
-					<Tool
-						Name="VCResourceCompilerTool"
-						PreprocessorDefinitions="NDEBUG;_AFXDLL;$(NoInherit)"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Debug|Win32">
-					<Tool
-						Name="VCResourceCompilerTool"
-						PreprocessorDefinitions="_DEBUG;_AFXDLL;$(NoInherit)"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="sqlite\CppSQLite3.cpp">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="Crc32Dynamic.cpp">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="DatabaseUtilities.cpp">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath=".\DittoAddin.cpp">
-			</File>
-			<File
-				RelativePath=".\DittoAddins.cpp">
-			</File>
-			<File
-				RelativePath=".\DittoCopyBuffer.cpp">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						ObjectFile="$(IntDir)/$(InputName)1.obj"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						ObjectFile="$(IntDir)/$(InputName)1.obj"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						ObjectFile="$(IntDir)/$(InputName)1.obj"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						ObjectFile="$(IntDir)/$(InputName)1.obj"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath=".\DittoRulerRichEditCtrl.cpp">
-			</File>
-			<File
-				RelativePath=".\DittoWindow.cpp">
-			</File>
-			<File
-				RelativePath=".\EditFrameWnd.cpp">
-			</File>
-			<File
-				RelativePath=".\EditWnd.cpp">
-			</File>
-			<File
-				RelativePath=".\ExternalWindowTracker.cpp">
-			</File>
-			<File
-				RelativePath="FileTransferProgressDlg.cpp">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="FormatSQL.cpp">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="FriendDetails.cpp">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="GroupCombo.cpp">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="GroupName.cpp">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="GroupTree.cpp">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath=".\HListBox.cpp">
-			</File>
-			<File
-				RelativePath=".\HTMLFormatAggregator.cpp">
-			</File>
-			<File
-				RelativePath="InternetUpdate.cpp">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="MainFrm.cpp">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="MainTableFunctions.cpp">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="Misc.cpp">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="MoveToGroupDlg.cpp">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="MultiLanguage.cpp">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="OleClipSource.cpp">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="OptionFriends.cpp">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="Options.cpp">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath=".\OptionsCopyBuffers.cpp">
-			</File>
-			<File
-				RelativePath="OptionsGeneral.cpp">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="OptionsKeyBoard.cpp">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="OptionsQuickPaste.cpp">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="OptionsSheet.cpp">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="OptionsStats.cpp">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="OptionsTypes.cpp">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="Path.cpp">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath=".\PerfTimer.cpp">
-			</File>
-			<File
-				RelativePath="ProcessPaste.cpp">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="ProgressWnd.cpp">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="QPasteWnd.cpp">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="QuickPaste.cpp">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath=".\RichTextAggregator.cpp">
-			</File>
-			<File
-				RelativePath=".\SaveAnimation.cpp">
-			</File>
-			<File
-				RelativePath=".\SendKeys.cpp">
-			</File>
-			<File
-				RelativePath="StdAfx.cpp">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						UsePrecompiledHeader="1"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"
-						UsePrecompiledHeader="1"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						UsePrecompiledHeader="1"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"
-						UsePrecompiledHeader="1"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="SystemTray.cpp">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath=".\TabCtrl.cpp">
-			</File>
-			<File
-				RelativePath="TextConvert.cpp">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="2"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						Optimization="0"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						BasicRuntimeChecks="3"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath=".\Theme.cpp">
-			</File>
-			<Filter
-				Name="Controls"
-				Filter="">
-				<File
-					RelativePath="AlphaBlend.cpp">
-					<FileConfiguration
-						Name="Release|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="2"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Debug|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="0"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-							BasicRuntimeChecks="3"/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Unicode Release|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="2"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Unicode Debug|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="0"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-							BasicRuntimeChecks="3"/>
-					</FileConfiguration>
-				</File>
-				<File
-					RelativePath="AlphaBlend.h">
-				</File>
-				<File
-					RelativePath="ArrayEx.h">
-				</File>
-				<File
-					RelativePath="DialogResizer.cpp">
-					<FileConfiguration
-						Name="Release|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="2"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Debug|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="0"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-							BasicRuntimeChecks="3"/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Unicode Release|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="2"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Unicode Debug|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="0"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-							BasicRuntimeChecks="3"/>
-					</FileConfiguration>
-				</File>
-				<File
-					RelativePath="FormattedTextDraw.cpp">
-					<FileConfiguration
-						Name="Release|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="2"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Debug|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="0"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-							BasicRuntimeChecks="3"/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Unicode Release|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="2"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Unicode Debug|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="0"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-							BasicRuntimeChecks="3"/>
-					</FileConfiguration>
-				</File>
-				<File
-					RelativePath="FormattedTextDraw.h">
-				</File>
-				<File
-					RelativePath="GroupStatic.cpp">
-					<FileConfiguration
-						Name="Release|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="2"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Debug|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="0"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-							BasicRuntimeChecks="3"/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Unicode Release|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="2"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Unicode Debug|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="0"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-							BasicRuntimeChecks="3"/>
-					</FileConfiguration>
-				</File>
-				<File
-					RelativePath="GroupStatic.h">
-				</File>
-				<File
-					RelativePath="HyperLink.cpp">
-					<FileConfiguration
-						Name="Release|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="2"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Debug|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="0"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-							BasicRuntimeChecks="3"/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Unicode Release|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="2"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Unicode Debug|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="0"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-							BasicRuntimeChecks="3"/>
-					</FileConfiguration>
-				</File>
-				<File
-					RelativePath="memdc.h">
-				</File>
-				<File
-					RelativePath="NumberEdit.cpp">
-					<FileConfiguration
-						Name="Release|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="2"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Debug|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="0"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-							BasicRuntimeChecks="3"/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Unicode Release|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="2"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Unicode Debug|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="0"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-							BasicRuntimeChecks="3"/>
-					</FileConfiguration>
-				</File>
-				<File
-					RelativePath="NumberEdit.h">
-				</File>
-				<File
-					RelativePath="QListCtrl.cpp">
-					<FileConfiguration
-						Name="Release|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="2"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Debug|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="0"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-							BasicRuntimeChecks="3"/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Unicode Release|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="2"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Unicode Debug|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="0"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-							BasicRuntimeChecks="3"/>
-					</FileConfiguration>
-				</File>
-				<File
-					RelativePath="QListCtrl.h">
-				</File>
-				<File
-					RelativePath="RichEditCtrlEx.cpp">
-					<FileConfiguration
-						Name="Release|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="2"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Debug|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="0"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-							BasicRuntimeChecks="3"/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Unicode Release|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="2"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Unicode Debug|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="0"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-							BasicRuntimeChecks="3"/>
-					</FileConfiguration>
-				</File>
-				<File
-					RelativePath="RichEditCtrlEx.h">
-				</File>
-				<File
-					RelativePath="SearchEditBox.cpp">
-					<FileConfiguration
-						Name="Release|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="2"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Debug|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="0"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-							BasicRuntimeChecks="3"/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Unicode Release|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="2"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Unicode Debug|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="0"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-							BasicRuntimeChecks="3"/>
-					</FileConfiguration>
-				</File>
-				<File
-					RelativePath="SearchEditBox.h">
-				</File>
-				<File
-					RelativePath="ToolTipEx.cpp">
-					<FileConfiguration
-						Name="Release|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="2"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Debug|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="0"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-							BasicRuntimeChecks="3"/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Unicode Release|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="2"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Unicode Debug|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="0"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-							BasicRuntimeChecks="3"/>
-					</FileConfiguration>
-				</File>
-				<File
-					RelativePath="ToolTipEx.h">
-				</File>
-				<File
-					RelativePath="WndEx.cpp">
-					<FileConfiguration
-						Name="Release|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="2"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Debug|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="0"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-							BasicRuntimeChecks="3"/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Unicode Release|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="2"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Unicode Debug|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="0"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-							BasicRuntimeChecks="3"/>
-					</FileConfiguration>
-				</File>
-				<File
-					RelativePath="WndEx.h">
-				</File>
-			</Filter>
-			<Filter
-				Name="Network"
-				Filter="">
-				<File
-					RelativePath="Client.cpp">
-					<FileConfiguration
-						Name="Release|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="2"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Debug|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="0"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-							BasicRuntimeChecks="3"/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Unicode Release|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="2"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Unicode Debug|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="0"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-							BasicRuntimeChecks="3"/>
-					</FileConfiguration>
-				</File>
-				<File
-					RelativePath="Client.h">
-				</File>
-				<File
-					RelativePath="FileRecieve.cpp">
-					<FileConfiguration
-						Name="Release|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="2"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Debug|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="0"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-							BasicRuntimeChecks="3"/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Unicode Release|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="2"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Unicode Debug|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="0"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-							BasicRuntimeChecks="3"/>
-					</FileConfiguration>
-				</File>
-				<File
-					RelativePath="FileRecieve.h">
-				</File>
-				<File
-					RelativePath="FileSend.cpp">
-					<FileConfiguration
-						Name="Release|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="2"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Debug|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="0"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-							BasicRuntimeChecks="3"/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Unicode Release|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="2"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Unicode Debug|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="0"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-							BasicRuntimeChecks="3"/>
-					</FileConfiguration>
-				</File>
-				<File
-					RelativePath="FileSend.h">
-				</File>
-				<File
-					RelativePath="RecieveSocket.cpp">
-					<FileConfiguration
-						Name="Release|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="2"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Debug|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="0"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-							BasicRuntimeChecks="3"/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Unicode Release|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="2"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Unicode Debug|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="0"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-							BasicRuntimeChecks="3"/>
-					</FileConfiguration>
-				</File>
-				<File
-					RelativePath="RecieveSocket.h">
-				</File>
-				<File
-					RelativePath="SendSocket.cpp">
-					<FileConfiguration
-						Name="Release|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="2"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Debug|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="0"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-							BasicRuntimeChecks="3"/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Unicode Release|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="2"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Unicode Debug|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="0"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-							BasicRuntimeChecks="3"/>
-					</FileConfiguration>
-				</File>
-				<File
-					RelativePath="SendSocket.h">
-				</File>
-				<File
-					RelativePath="Server.cpp">
-					<FileConfiguration
-						Name="Release|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="2"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Debug|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="0"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-							BasicRuntimeChecks="3"/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Unicode Release|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="2"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""/>
-					</FileConfiguration>
-					<FileConfiguration
-						Name="Unicode Debug|Win32">
-						<Tool
-							Name="VCCLCompilerTool"
-							Optimization="0"
-							AdditionalIncludeDirectories=""
-							PreprocessorDefinitions=""
-							BasicRuntimeChecks="3"/>
-					</FileConfiguration>
-				</File>
-				<File
-					RelativePath="Server.h">
-				</File>
-			</Filter>
-		</Filter>
-		<Filter
-			Name="Header Files"
-			Filter="h;hpp;hxx;hm;inl">
-			<File
-				RelativePath="About.h">
-			</File>
-			<File
-				RelativePath="AccessToSqlite.h">
-			</File>
-			<File
-				RelativePath="AddType.h">
-			</File>
-			<File
-				RelativePath="BitmapHelper.h">
-			</File>
-			<File
-				RelativePath=".\CF_HDropAggregator.h">
-			</File>
-			<File
-				RelativePath=".\CF_TextAggregator.h">
-			</File>
-			<File
-				RelativePath=".\CF_UnicodeTextAggregator.h">
-			</File>
-			<File
-				RelativePath="Clip.h">
-			</File>
-			<File
-				RelativePath=".\Clip_ImportExport.h">
-			</File>
-			<File
-				RelativePath=".\ClipboardSaveRestore.h">
-			</File>
-			<File
-				RelativePath="ClipboardViewer.h">
-			</File>
-			<File
-				RelativePath="ClipIds.h">
-			</File>
-			<File
-				RelativePath="CopyProperties.h">
-			</File>
-			<File
-				RelativePath="CopyThread.h">
-			</File>
-			<File
-				RelativePath="CP_Main.h">
-			</File>
-			<File
-				RelativePath="sqlite\CppSQLite3.h">
-			</File>
-			<File
-				RelativePath="Crc32Dynamic.h">
-			</File>
-			<File
-				RelativePath="DatabaseUtilities.h">
-			</File>
-			<File
-				RelativePath="DialogResizer.h">
-			</File>
-			<File
-				RelativePath=".\DittoAddin.h">
-			</File>
-			<File
-				RelativePath=".\DittoAddins.h">
-			</File>
-			<File
-				RelativePath=".\DittoCopyBuffer.h">
-			</File>
-			<File
-				RelativePath=".\Shared\DittoDefines.h">
-			</File>
-			<File
-				RelativePath=".\DittoRulerRichEditCtrl.h">
-			</File>
-			<File
-				RelativePath=".\DittoWindow.h">
-			</File>
-			<File
-				RelativePath=".\EditFrameWnd.h">
-			</File>
-			<File
-				RelativePath=".\EditWnd.h">
-			</File>
-			<File
-				RelativePath=".\ExternalWindowTracker.h">
-			</File>
-			<File
-				RelativePath="FileTransferProgressDlg.h">
-			</File>
-			<File
-				RelativePath="FormatSQL.h">
-			</File>
-			<File
-				RelativePath="FriendDetails.h">
-			</File>
-			<File
-				RelativePath="GroupCombo.h">
-			</File>
-			<File
-				RelativePath="GroupName.h">
-			</File>
-			<File
-				RelativePath="GroupTree.h">
-			</File>
-			<File
-				RelativePath=".\HListBox.h">
-			</File>
-			<File
-				RelativePath=".\HTMLFormatAggregator.h">
-			</File>
-			<File
-				RelativePath="HyperLink.h">
-			</File>
-			<File
-				RelativePath=".\Shared\IAddinExports.h">
-			</File>
-			<File
-				RelativePath=".\Shared\IClip.h">
-			</File>
-			<File
-				RelativePath=".\IClipAggregator.h">
-			</File>
-			<File
-				RelativePath="InternetUpdate.h">
-			</File>
-			<File
-				RelativePath="MainFrm.h">
-			</File>
-			<File
-				RelativePath="MainTableFunctions.h">
-			</File>
-			<File
-				RelativePath="Misc.h">
-			</File>
-			<File
-				RelativePath="MoveToGroupDlg.h">
-			</File>
-			<File
-				RelativePath="MultiLanguage.h">
-			</File>
-			<File
-				RelativePath="OleClipSource.h">
-			</File>
-			<File
-				RelativePath="OptionFriends.h">
-			</File>
-			<File
-				RelativePath="Options.h">
-			</File>
-			<File
-				RelativePath=".\OptionsCopyBuffers.h">
-			</File>
-			<File
-				RelativePath="OptionsGeneral.h">
-			</File>
-			<File
-				RelativePath="OptionsKeyBoard.h">
-			</File>
-			<File
-				RelativePath="OptionsQuickPaste.h">
-			</File>
-			<File
-				RelativePath="OptionsSheet.h">
-			</File>
-			<File
-				RelativePath="OptionsStats.h">
-			</File>
-			<File
-				RelativePath="OptionsTypes.h">
-			</File>
-			<File
-				RelativePath="Path.h">
-			</File>
-			<File
-				RelativePath=".\PerfTimer.h">
-			</File>
-			<File
-				RelativePath="ProcessPaste.h">
-			</File>
-			<File
-				RelativePath="ProgressWnd.h">
-			</File>
-			<File
-				RelativePath="QPasteWnd.h">
-			</File>
-			<File
-				RelativePath="QuickPaste.h">
-			</File>
-			<File
-				RelativePath="Resource.h">
-			</File>
-			<File
-				RelativePath=".\RichTextAggregator.h">
-			</File>
-			<File
-				RelativePath=".\SaveAnimation.h">
-			</File>
-			<File
-				RelativePath=".\SendKeys.h">
-			</File>
-			<File
-				RelativePath="ServerDefines.h">
-			</File>
-			<File
-				RelativePath="sqlite\sqlite3.h">
-			</File>
-			<File
-				RelativePath="StdAfx.h">
-			</File>
-			<File
-				RelativePath="SystemTray.h">
-			</File>
-			<File
-				RelativePath=".\TabCtrl.h">
-			</File>
-			<File
-				RelativePath="TextConvert.h">
-			</File>
-			<File
-				RelativePath=".\Theme.h">
-			</File>
-			<File
-				RelativePath="UnicodeMacros.h">
-			</File>
-		</Filter>
-		<Filter
-			Name="Resource Files"
-			Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
-			<File
-				RelativePath="res\back.bmp">
-			</File>
-			<File
-				RelativePath="res\back1.bmp">
-			</File>
-			<File
-				RelativePath="res\back2.bmp">
-			</File>
-			<File
-				RelativePath="res\bitmap1.bmp">
-			</File>
-			<File
-				RelativePath="res\bmp00001.bmp">
-			</File>
-			<File
-				RelativePath="res\bmp00002.bmp">
-			</File>
-			<File
-				RelativePath="res\bmp00003.bmp">
-			</File>
-			<File
-				RelativePath="res\closed_f.bmp">
-			</File>
-			<File
-				RelativePath="res\CP_Main.ico">
-			</File>
-			<File
-				RelativePath="res\CP_Main.rc2">
-			</File>
-			<File
-				RelativePath="res\CP_MainDoc.ico">
-			</File>
-			<File
-				RelativePath="res\Ditto.ico">
-			</File>
-			<File
-				RelativePath="res\Ditto_NoCopyCb.ico">
-			</File>
-			<File
-				RelativePath=".\res\mainfram.bmp">
-			</File>
-			<File
-				RelativePath="res\open_fol.bmp">
-			</File>
-			<File
-				RelativePath="res\Toolbar.bmp">
-			</File>
-			<File
-				RelativePath=".\res\toolbar1.bmp">
-			</File>
-		</Filter>
-		<Filter
-			Name="Exclude From Build"
-			Filter="">
-			<File
-				RelativePath="EncryptDecrypt.lib">
-				<FileConfiguration
-					Name="Release|Win32"
-					ExcludedFromBuild="TRUE">
-					<Tool
-						Name="VCCustomBuildTool"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32"
-					ExcludedFromBuild="TRUE">
-					<Tool
-						Name="VCCustomBuildTool"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Release|Win32"
-					ExcludedFromBuild="TRUE">
-					<Tool
-						Name="VCCustomBuildTool"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Debug|Win32"
-					ExcludedFromBuild="TRUE">
-					<Tool
-						Name="VCCustomBuildTool"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="EncryptDecryptD.lib">
-				<FileConfiguration
-					Name="Release|Win32"
-					ExcludedFromBuild="TRUE">
-					<Tool
-						Name="VCCustomBuildTool"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32"
-					ExcludedFromBuild="TRUE">
-					<Tool
-						Name="VCCustomBuildTool"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Release|Win32"
-					ExcludedFromBuild="TRUE">
-					<Tool
-						Name="VCCustomBuildTool"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Debug|Win32"
-					ExcludedFromBuild="TRUE">
-					<Tool
-						Name="VCCustomBuildTool"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="Debug\focus.dll">
-				<FileConfiguration
-					Name="Release|Win32"
-					ExcludedFromBuild="TRUE">
-					<Tool
-						Name="VCCustomBuildTool"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32"
-					ExcludedFromBuild="TRUE">
-					<Tool
-						Name="VCCustomBuildTool"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Release|Win32"
-					ExcludedFromBuild="TRUE">
-					<Tool
-						Name="VCCustomBuildTool"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Debug|Win32"
-					ExcludedFromBuild="TRUE">
-					<Tool
-						Name="VCCustomBuildTool"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="Release\focus.dll">
-				<FileConfiguration
-					Name="Release|Win32"
-					ExcludedFromBuild="TRUE">
-					<Tool
-						Name="VCCustomBuildTool"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32"
-					ExcludedFromBuild="TRUE">
-					<Tool
-						Name="VCCustomBuildTool"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Release|Win32"
-					ExcludedFromBuild="TRUE">
-					<Tool
-						Name="VCCustomBuildTool"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Debug|Win32"
-					ExcludedFromBuild="TRUE">
-					<Tool
-						Name="VCCustomBuildTool"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath=".\RulerRichEditCtrl\RulerRichEditCtrl.rc">
-				<FileConfiguration
-					Name="Release|Win32"
-					ExcludedFromBuild="TRUE">
-					<Tool
-						Name="VCResourceCompilerTool"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32"
-					ExcludedFromBuild="TRUE">
-					<Tool
-						Name="VCResourceCompilerTool"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Release|Win32"
-					ExcludedFromBuild="TRUE">
-					<Tool
-						Name="VCResourceCompilerTool"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Debug|Win32"
-					ExcludedFromBuild="TRUE">
-					<Tool
-						Name="VCResourceCompilerTool"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="Release\sqlite3.dll">
-				<FileConfiguration
-					Name="Release|Win32"
-					ExcludedFromBuild="TRUE">
-					<Tool
-						Name="VCCustomBuildTool"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32"
-					ExcludedFromBuild="TRUE">
-					<Tool
-						Name="VCCustomBuildTool"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Release|Win32"
-					ExcludedFromBuild="TRUE">
-					<Tool
-						Name="VCCustomBuildTool"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Debug|Win32"
-					ExcludedFromBuild="TRUE">
-					<Tool
-						Name="VCCustomBuildTool"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="Debug\sqlite3.dll">
-				<FileConfiguration
-					Name="Release|Win32"
-					ExcludedFromBuild="TRUE">
-					<Tool
-						Name="VCCustomBuildTool"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32"
-					ExcludedFromBuild="TRUE">
-					<Tool
-						Name="VCCustomBuildTool"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Release|Win32"
-					ExcludedFromBuild="TRUE">
-					<Tool
-						Name="VCCustomBuildTool"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Debug|Win32"
-					ExcludedFromBuild="TRUE">
-					<Tool
-						Name="VCCustomBuildTool"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="sqlite\sqlite3.lib">
-				<FileConfiguration
-					Name="Release|Win32"
-					ExcludedFromBuild="TRUE">
-					<Tool
-						Name="VCCustomBuildTool"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32"
-					ExcludedFromBuild="TRUE">
-					<Tool
-						Name="VCCustomBuildTool"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Release|Win32"
-					ExcludedFromBuild="TRUE">
-					<Tool
-						Name="VCCustomBuildTool"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Debug|Win32"
-					ExcludedFromBuild="TRUE">
-					<Tool
-						Name="VCCustomBuildTool"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath=".\RulerRichEditCtrl\toolbar.bmp">
-				<FileConfiguration
-					Name="Release|Win32"
-					ExcludedFromBuild="TRUE">
-					<Tool
-						Name="VCCustomBuildTool"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32"
-					ExcludedFromBuild="TRUE">
-					<Tool
-						Name="VCCustomBuildTool"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Release|Win32"
-					ExcludedFromBuild="TRUE">
-					<Tool
-						Name="VCCustomBuildTool"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Debug|Win32"
-					ExcludedFromBuild="TRUE">
-					<Tool
-						Name="VCCustomBuildTool"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="UEncryptDecrypt.lib">
-				<FileConfiguration
-					Name="Release|Win32"
-					ExcludedFromBuild="TRUE">
-					<Tool
-						Name="VCCustomBuildTool"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32"
-					ExcludedFromBuild="TRUE">
-					<Tool
-						Name="VCCustomBuildTool"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Release|Win32"
-					ExcludedFromBuild="TRUE">
-					<Tool
-						Name="VCCustomBuildTool"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Debug|Win32"
-					ExcludedFromBuild="TRUE">
-					<Tool
-						Name="VCCustomBuildTool"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="UEncryptDecryptD.lib">
-				<FileConfiguration
-					Name="Release|Win32"
-					ExcludedFromBuild="TRUE">
-					<Tool
-						Name="VCCustomBuildTool"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32"
-					ExcludedFromBuild="TRUE">
-					<Tool
-						Name="VCCustomBuildTool"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Release|Win32"
-					ExcludedFromBuild="TRUE">
-					<Tool
-						Name="VCCustomBuildTool"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Debug|Win32"
-					ExcludedFromBuild="TRUE">
-					<Tool
-						Name="VCCustomBuildTool"/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath=".\zlib\zlib1.dll">
-				<FileConfiguration
-					Name="Release|Win32"
-					ExcludedFromBuild="TRUE">
-					<Tool
-						Name="VCCustomBuildTool"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32"
-					ExcludedFromBuild="TRUE">
-					<Tool
-						Name="VCCustomBuildTool"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Release|Win32"
-					ExcludedFromBuild="TRUE">
-					<Tool
-						Name="VCCustomBuildTool"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Debug|Win32"
-					ExcludedFromBuild="TRUE">
-					<Tool
-						Name="VCCustomBuildTool"/>
-				</FileConfiguration>
-			</File>
-		</Filter>
-		<Filter
-			Name="TinyXml"
-			Filter="">
-			<File
-				RelativePath="TinyXml\tinystr.h">
-			</File>
-			<File
-				RelativePath="TinyXml\tinyxml.h">
-			</File>
-		</Filter>
-		<Filter
-			Name="zlib"
-			Filter="">
-			<File
-				RelativePath=".\zlib\zconf.h">
-			</File>
-			<File
-				RelativePath=".\zlib\zlib.h">
-			</File>
-		</Filter>
-		<Filter
-			Name="RulerRichEditCtrl"
-			Filter="">
-			<File
-				RelativePath=".\RulerRichEditCtrl\FontComboBox.cpp">
-			</File>
-			<File
-				RelativePath=".\RulerRichEditCtrl\FontComboBox.h">
-			</File>
-			<File
-				RelativePath=".\RulerRichEditCtrl\ids.h">
-			</File>
-			<File
-				RelativePath=".\RulerRichEditCtrl\RRECRuler.cpp">
-			</File>
-			<File
-				RelativePath=".\RulerRichEditCtrl\RRECRuler.h">
-			</File>
-			<File
-				RelativePath=".\RulerRichEditCtrl\RRECToolbar.cpp">
-			</File>
-			<File
-				RelativePath=".\RulerRichEditCtrl\RRECToolbar.h">
-			</File>
-			<File
-				RelativePath=".\RulerRichEditCtrl\RulerRichEdit.cpp">
-			</File>
-			<File
-				RelativePath=".\RulerRichEditCtrl\RulerRichEdit.h">
-			</File>
-			<File
-				RelativePath=".\RulerRichEditCtrl\RulerRichEditCtrl.cpp">
-			</File>
-			<File
-				RelativePath=".\RulerRichEditCtrl\RulerRichEditCtrl.h">
-			</File>
-			<File
-				RelativePath=".\RulerRichEditCtrl\SizeComboBox.cpp">
-			</File>
-			<File
-				RelativePath=".\RulerRichEditCtrl\SizeComboBox.h">
-			</File>
-			<File
-				RelativePath=".\RulerRichEditCtrl\StdGrfx.cpp">
-			</File>
-			<File
-				RelativePath=".\RulerRichEditCtrl\StdGrfx.h">
-			</File>
-			<Filter
-				Name="External"
-				Filter="">
-				<File
-					RelativePath=".\RulerRichEditCtrl\External\ColourPicker.cpp">
-				</File>
-				<File
-					RelativePath=".\RulerRichEditCtrl\External\ColourPicker.h">
-				</File>
-				<File
-					RelativePath=".\RulerRichEditCtrl\External\ColourPopup.cpp">
-				</File>
-				<File
-					RelativePath=".\RulerRichEditCtrl\External\ColourPopup.h">
-				</File>
-				<File
-					RelativePath=".\RulerRichEditCtrl\External\StdioFileEx.cpp">
-				</File>
-				<File
-					RelativePath=".\RulerRichEditCtrl\External\StdioFileEx.h">
-				</File>
-			</Filter>
-			<Filter
-				Name="TextFile"
-				Filter="">
-				<File
-					RelativePath=".\RulerRichEditCtrl\TextFile\TextFile.cpp">
-				</File>
-				<File
-					RelativePath=".\RulerRichEditCtrl\TextFile\TextFile.h">
-				</File>
-			</Filter>
-		</Filter>
-		<File
-			RelativePath="res\FILECOPY.AVI">
-		</File>
-		<File
-			RelativePath="focusdll\Release\focus.lib">
-		</File>
-		<File
-			RelativePath="ReadMe.txt">
-		</File>
-		<File
-			RelativePath=".\tinyxml.lib">
-		</File>
-		<File
-			RelativePath=".\zlib\zdll.lib">
-		</File>
-	</Files>
-	<Globals>
-		<Global
-			Name="RESOURCE_FILE"
-			Value="CP_Main.rc"/>
-	</Globals>
-</VisualStudioProject>

File diff suppressed because it is too large
+ 1006 - 477
CP_Main.vcxproj


+ 23 - 57
CP_Main_10.sln

@@ -1,91 +1,57 @@
 Microsoft Visual Studio Solution File, Format Version 11.00
 # Visual Studio 2010
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CP_Main", "CP_Main.vcxproj", "{86BF16D0-77B0-8955-B18E-4F78C3083D5E}"
+Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "CP_Main", "CP_Main.vcxproj", "{D90F6EAF-861C-0A85-1208-EF129A0A92E9}"
 	ProjectSection(ProjectDependencies) = postProject
 		{F08A8736-1116-4166-AF88-CF533E41E958} = {F08A8736-1116-4166-AF88-CF533E41E958}
-		{4CF4B14E-247F-4690-2253-C1E2AE5051B1} = {4CF4B14E-247F-4690-2253-C1E2AE5051B1}
 		{E4AB8C80-F35F-451E-853B-07CEDD49E500} = {E4AB8C80-F35F-451E-853B-07CEDD49E500}
 	EndProjectSection
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "U3DittoStop", "U3Stop\U3Stop.vcxproj", "{EDA8DBEE-92A2-4A5D-A9ED-0FC0F037C43C}"
-EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "DittoUtil", "Addins\DittoUtil\DittoUtil.vcxproj", "{CF8F6379-5340-4494-8E59-2807ADF37B95}"
 EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "EncryptDecrypt", "EncryptDecrypt\EncryptDecrypt.vcxproj", "{F08A8736-1116-4166-AF88-CF533E41E958}"
 EndProject
-Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "AccessToSqlite", "AccessToSqlite\AccessToSqlite.vcxproj", "{4CF4B14E-247F-4690-2253-C1E2AE5051B1}"
-EndProject
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "focus", "focusdll\focus.vcxproj", "{E4AB8C80-F35F-451E-853B-07CEDD49E500}"
 EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
 		Debug|Win32 = Debug|Win32
+		Debug|x64 = Debug|x64
 		Release|Win32 = Release|Win32
-		Template|Win32 = Template|Win32
-		Unicode Debug|Win32 = Unicode Debug|Win32
-		Unicode Release|Win32 = Unicode Release|Win32
+		Release|x64 = Release|x64
 	EndGlobalSection
 	GlobalSection(ProjectConfigurationPlatforms) = postSolution
-		{86BF16D0-77B0-8955-B18E-4F78C3083D5E}.Debug|Win32.ActiveCfg = Debug|Win32
-		{86BF16D0-77B0-8955-B18E-4F78C3083D5E}.Debug|Win32.Build.0 = Debug|Win32
-		{86BF16D0-77B0-8955-B18E-4F78C3083D5E}.Release|Win32.ActiveCfg = Release|Win32
-		{86BF16D0-77B0-8955-B18E-4F78C3083D5E}.Release|Win32.Build.0 = Release|Win32
-		{86BF16D0-77B0-8955-B18E-4F78C3083D5E}.Template|Win32.ActiveCfg = Template|Win32
-		{86BF16D0-77B0-8955-B18E-4F78C3083D5E}.Template|Win32.Build.0 = Template|Win32
-		{86BF16D0-77B0-8955-B18E-4F78C3083D5E}.Unicode Debug|Win32.ActiveCfg = Unicode Debug|Win32
-		{86BF16D0-77B0-8955-B18E-4F78C3083D5E}.Unicode Debug|Win32.Build.0 = Unicode Debug|Win32
-		{86BF16D0-77B0-8955-B18E-4F78C3083D5E}.Unicode Release|Win32.ActiveCfg = Unicode Release|Win32
-		{86BF16D0-77B0-8955-B18E-4F78C3083D5E}.Unicode Release|Win32.Build.0 = Unicode Release|Win32
-		{EDA8DBEE-92A2-4A5D-A9ED-0FC0F037C43C}.Debug|Win32.ActiveCfg = Debug|Win32
-		{EDA8DBEE-92A2-4A5D-A9ED-0FC0F037C43C}.Debug|Win32.Build.0 = Debug|Win32
-		{EDA8DBEE-92A2-4A5D-A9ED-0FC0F037C43C}.Release|Win32.ActiveCfg = Release|Win32
-		{EDA8DBEE-92A2-4A5D-A9ED-0FC0F037C43C}.Release|Win32.Build.0 = Release|Win32
-		{EDA8DBEE-92A2-4A5D-A9ED-0FC0F037C43C}.Template|Win32.ActiveCfg = Release|Win32
-		{EDA8DBEE-92A2-4A5D-A9ED-0FC0F037C43C}.Template|Win32.Build.0 = Release|Win32
-		{EDA8DBEE-92A2-4A5D-A9ED-0FC0F037C43C}.Unicode Debug|Win32.ActiveCfg = Debug|Win32
-		{EDA8DBEE-92A2-4A5D-A9ED-0FC0F037C43C}.Unicode Debug|Win32.Build.0 = Debug|Win32
-		{EDA8DBEE-92A2-4A5D-A9ED-0FC0F037C43C}.Unicode Release|Win32.ActiveCfg = Release|Win32
-		{EDA8DBEE-92A2-4A5D-A9ED-0FC0F037C43C}.Unicode Release|Win32.Build.0 = Release|Win32
+		{D90F6EAF-861C-0A85-1208-EF129A0A92E9}.Debug|Win32.ActiveCfg = Debug|Win32
+		{D90F6EAF-861C-0A85-1208-EF129A0A92E9}.Debug|Win32.Build.0 = Debug|Win32
+		{D90F6EAF-861C-0A85-1208-EF129A0A92E9}.Debug|x64.ActiveCfg = Debug|x64
+		{D90F6EAF-861C-0A85-1208-EF129A0A92E9}.Debug|x64.Build.0 = Debug|x64
+		{D90F6EAF-861C-0A85-1208-EF129A0A92E9}.Release|Win32.ActiveCfg = Release|Win32
+		{D90F6EAF-861C-0A85-1208-EF129A0A92E9}.Release|Win32.Build.0 = Release|Win32
+		{D90F6EAF-861C-0A85-1208-EF129A0A92E9}.Release|x64.ActiveCfg = Release|x64
+		{D90F6EAF-861C-0A85-1208-EF129A0A92E9}.Release|x64.Build.0 = Release|x64
 		{CF8F6379-5340-4494-8E59-2807ADF37B95}.Debug|Win32.ActiveCfg = Debug|Win32
 		{CF8F6379-5340-4494-8E59-2807ADF37B95}.Debug|Win32.Build.0 = Debug|Win32
+		{CF8F6379-5340-4494-8E59-2807ADF37B95}.Debug|x64.ActiveCfg = Debug|x64
+		{CF8F6379-5340-4494-8E59-2807ADF37B95}.Debug|x64.Build.0 = Debug|x64
 		{CF8F6379-5340-4494-8E59-2807ADF37B95}.Release|Win32.ActiveCfg = Release|Win32
 		{CF8F6379-5340-4494-8E59-2807ADF37B95}.Release|Win32.Build.0 = Release|Win32
-		{CF8F6379-5340-4494-8E59-2807ADF37B95}.Template|Win32.ActiveCfg = Release|Win32
-		{CF8F6379-5340-4494-8E59-2807ADF37B95}.Template|Win32.Build.0 = Release|Win32
-		{CF8F6379-5340-4494-8E59-2807ADF37B95}.Unicode Debug|Win32.ActiveCfg = Debug|Win32
-		{CF8F6379-5340-4494-8E59-2807ADF37B95}.Unicode Debug|Win32.Build.0 = Debug|Win32
-		{CF8F6379-5340-4494-8E59-2807ADF37B95}.Unicode Release|Win32.ActiveCfg = Release|Win32
-		{CF8F6379-5340-4494-8E59-2807ADF37B95}.Unicode Release|Win32.Build.0 = Release|Win32
+		{CF8F6379-5340-4494-8E59-2807ADF37B95}.Release|x64.ActiveCfg = Release|x64
+		{CF8F6379-5340-4494-8E59-2807ADF37B95}.Release|x64.Build.0 = Release|x64
 		{F08A8736-1116-4166-AF88-CF533E41E958}.Debug|Win32.ActiveCfg = Debug|Win32
 		{F08A8736-1116-4166-AF88-CF533E41E958}.Debug|Win32.Build.0 = Debug|Win32
+		{F08A8736-1116-4166-AF88-CF533E41E958}.Debug|x64.ActiveCfg = Debug|x64
+		{F08A8736-1116-4166-AF88-CF533E41E958}.Debug|x64.Build.0 = Debug|x64
 		{F08A8736-1116-4166-AF88-CF533E41E958}.Release|Win32.ActiveCfg = Release|Win32
 		{F08A8736-1116-4166-AF88-CF533E41E958}.Release|Win32.Build.0 = Release|Win32
-		{F08A8736-1116-4166-AF88-CF533E41E958}.Template|Win32.ActiveCfg = Unicode Release|Win32
-		{F08A8736-1116-4166-AF88-CF533E41E958}.Template|Win32.Build.0 = Unicode Release|Win32
-		{F08A8736-1116-4166-AF88-CF533E41E958}.Unicode Debug|Win32.ActiveCfg = Unicode Debug|Win32
-		{F08A8736-1116-4166-AF88-CF533E41E958}.Unicode Debug|Win32.Build.0 = Unicode Debug|Win32
-		{F08A8736-1116-4166-AF88-CF533E41E958}.Unicode Release|Win32.ActiveCfg = Unicode Release|Win32
-		{F08A8736-1116-4166-AF88-CF533E41E958}.Unicode Release|Win32.Build.0 = Unicode Release|Win32
-		{4CF4B14E-247F-4690-2253-C1E2AE5051B1}.Debug|Win32.ActiveCfg = Debug|Win32
-		{4CF4B14E-247F-4690-2253-C1E2AE5051B1}.Debug|Win32.Build.0 = Debug|Win32
-		{4CF4B14E-247F-4690-2253-C1E2AE5051B1}.Release|Win32.ActiveCfg = Release|Win32
-		{4CF4B14E-247F-4690-2253-C1E2AE5051B1}.Release|Win32.Build.0 = Release|Win32
-		{4CF4B14E-247F-4690-2253-C1E2AE5051B1}.Template|Win32.ActiveCfg = Release|Win32
-		{4CF4B14E-247F-4690-2253-C1E2AE5051B1}.Template|Win32.Build.0 = Release|Win32
-		{4CF4B14E-247F-4690-2253-C1E2AE5051B1}.Unicode Debug|Win32.ActiveCfg = Debug|Win32
-		{4CF4B14E-247F-4690-2253-C1E2AE5051B1}.Unicode Debug|Win32.Build.0 = Debug|Win32
-		{4CF4B14E-247F-4690-2253-C1E2AE5051B1}.Unicode Release|Win32.ActiveCfg = Release|Win32
-		{4CF4B14E-247F-4690-2253-C1E2AE5051B1}.Unicode Release|Win32.Build.0 = Release|Win32
+		{F08A8736-1116-4166-AF88-CF533E41E958}.Release|x64.ActiveCfg = Release|x64
+		{F08A8736-1116-4166-AF88-CF533E41E958}.Release|x64.Build.0 = Release|x64
 		{E4AB8C80-F35F-451E-853B-07CEDD49E500}.Debug|Win32.ActiveCfg = Debug|Win32
 		{E4AB8C80-F35F-451E-853B-07CEDD49E500}.Debug|Win32.Build.0 = Debug|Win32
+		{E4AB8C80-F35F-451E-853B-07CEDD49E500}.Debug|x64.ActiveCfg = Debug|x64
+		{E4AB8C80-F35F-451E-853B-07CEDD49E500}.Debug|x64.Build.0 = Debug|x64
 		{E4AB8C80-F35F-451E-853B-07CEDD49E500}.Release|Win32.ActiveCfg = Release|Win32
 		{E4AB8C80-F35F-451E-853B-07CEDD49E500}.Release|Win32.Build.0 = Release|Win32
-		{E4AB8C80-F35F-451E-853B-07CEDD49E500}.Template|Win32.ActiveCfg = Release|Win32
-		{E4AB8C80-F35F-451E-853B-07CEDD49E500}.Template|Win32.Build.0 = Release|Win32
-		{E4AB8C80-F35F-451E-853B-07CEDD49E500}.Unicode Debug|Win32.ActiveCfg = Debug|Win32
-		{E4AB8C80-F35F-451E-853B-07CEDD49E500}.Unicode Debug|Win32.Build.0 = Debug|Win32
-		{E4AB8C80-F35F-451E-853B-07CEDD49E500}.Unicode Release|Win32.ActiveCfg = Release|Win32
-		{E4AB8C80-F35F-451E-853B-07CEDD49E500}.Unicode Release|Win32.Build.0 = Release|Win32
+		{E4AB8C80-F35F-451E-853B-07CEDD49E500}.Release|x64.ActiveCfg = Release|x64
+		{E4AB8C80-F35F-451E-853B-07CEDD49E500}.Release|x64.Build.0 = Release|x64
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE

+ 11 - 11
Client.cpp

@@ -25,13 +25,13 @@ BOOL SendToFriend(CSendToFriendInfo &Info)
 {
 	LogSendRecieveInfo("@@@@@@@@@@@@@@@ - START OF Send To Friend - @@@@@@@@@@@@@@@");
 
-	if(Info.m_lPos > -1 && Info.m_lPos < MAX_SEND_CLIENTS)
+	if(Info.m_pos > -1 && Info.m_pos < MAX_SEND_CLIENTS)
 	{
-		Info.m_csIP = g_Opt.m_SendClients[Info.m_lPos].csIP;
+		Info.m_csIP = g_Opt.m_SendClients[Info.m_pos].csIP;
 	}
 	else
 	{
-		Info.m_csErrorText = StrF(_T("ERROR getting ip position - %d"), Info.m_lPos);
+		Info.m_csErrorText = StrF(_T("ERROR getting ip position - %d"), Info.m_pos);
 		LogSendRecieveInfo(Info.m_csErrorText);
 		return FALSE;
 	}
@@ -46,7 +46,7 @@ BOOL SendToFriend(CSendToFriendInfo &Info)
 		return FALSE;
 	}
 
-	long lCount = Info.m_pClipList->GetCount();
+	INT_PTR count = Info.m_pClipList->GetCount();
 	int i = -1;
 
 	CClip* pClip;
@@ -64,7 +64,7 @@ BOOL SendToFriend(CSendToFriendInfo &Info)
 
 		if(Info.m_pPopup)
 		{
-			Info.m_pPopup->SendToolTipText(StrF(_T("Sending %d of %d"), i+1, lCount));
+			Info.m_pPopup->SendToolTipText(StrF(_T("Sending %d of %d"), i+1, count));
 		}
 
 		MSG	msg;
@@ -74,7 +74,7 @@ BOOL SendToFriend(CSendToFriendInfo &Info)
 			DispatchMessage(&msg);
 		}
 
-		LogSendRecieveInfo(StrF(_T("Sending %d of %d clip to %s"), i+1, lCount, Info.m_csIP));
+		LogSendRecieveInfo(StrF(_T("Sending %d of %d clip to %s"), i+1, count, Info.m_csIP));
 
 		if(client.SendItem(pClip) == FALSE)
 		{
@@ -211,10 +211,10 @@ BOOL CClient::SendItem(CClip *pClip)
 	
 	CClipFormat* pCF;
 	
-	int nCount = pClip->m_Formats.GetSize();
+	INT_PTR count = pClip->m_Formats.GetSize();
 
 	//For each data type
-	for( int i=0; i < nCount; i++ )
+	for(int i=0; i < count; i++)
 	{
 		pCF = &pClip->m_Formats.GetData()[i];
 		
@@ -233,17 +233,17 @@ BOOL CClient::SendClipFormat(CClipFormat* pCF)
 {
 	CSendInfo Info;
 	LPVOID pvData = GlobalLock(pCF->m_hgData);
-	long lLength = GlobalSize(pCF->m_hgData);
+	INT_PTR length = GlobalSize(pCF->m_hgData);
 	UCHAR* pOutput = NULL;
 	int nLenOutput = 0;
 	CTextConvert Convert;
 	BOOL bRet = FALSE;
 
-	LogSendRecieveInfo(StrF(_T("BEFORE Encrypt clip data %d"), lLength));
+	LogSendRecieveInfo(StrF(_T("BEFORE Encrypt clip data %d"), length));
 
 	if(m_SendSocket.m_pEncryptor)
 	{
-		if(m_SendSocket.m_pEncryptor->Encrypt((UCHAR*)pvData, lLength, g_Opt.m_csPassword, pOutput, nLenOutput))
+		if(m_SendSocket.m_pEncryptor->Encrypt((UCHAR*)pvData, (int)length, g_Opt.m_csPassword, pOutput, nLenOutput))
 		{
 			LogSendRecieveInfo(StrF(_T("AFTER Encrypt clip data %d"), nLenOutput));
 

+ 2 - 2
Client.h

@@ -20,7 +20,7 @@ public:
 	CSendToFriendInfo()
 	{
 		m_pPopup = NULL;
-		m_lPos = -1;
+		m_pos = -1;
 		m_pClipList = NULL;
 		m_pPopup = NULL;
 	}
@@ -34,7 +34,7 @@ public:
 	}
 
 	CClipList *m_pClipList;
-	long m_lPos;
+	int m_pos;
 	CString m_csIP;
 	CPopup *m_pPopup;
 	CString m_csErrorText;

+ 73 - 70
Clip.cpp

@@ -97,12 +97,12 @@ HGLOBAL COleDataObjectEx::GetGlobalData(CLIPFORMAT cfFormat, LPFORMATETC lpForma
 /*----------------------------------------------------------------------------*\
 CClipFormat - holds the data of one clip format.
 \*----------------------------------------------------------------------------*/
-CClipFormat::CClipFormat(CLIPFORMAT cfType, HGLOBAL hgData, long lDBID)
+CClipFormat::CClipFormat(CLIPFORMAT cfType, HGLOBAL hgData, int dbId)
 {
 	m_cfType = cfType;
 	m_hgData = hgData;
 	m_autoDeleteData = true;
-	m_lDBID = lDBID;
+	m_dbId = dbId;
 }
 
 CClipFormat::~CClipFormat() 
@@ -114,7 +114,7 @@ void CClipFormat::Clear()
 {
 	m_cfType = 0;
 	m_hgData = 0;
-	m_lDBID = -1;
+	m_dbId = -1;
 }
 
 void CClipFormat::Free()
@@ -139,7 +139,7 @@ CClipFormats - holds an array of CClipFormat
 CClipFormat* CClipFormats::FindFormat(UINT cfType)
 {
 	CClipFormat* pCF;
-	int count = GetSize();
+	INT_PTR count = GetSize();
 
 	for(int i=0; i < count; i++)
 	{
@@ -156,14 +156,14 @@ CClip - holds multiple CClipFormats and CopyClipboard() statistics
 \*----------------------------------------------------------------------------*/
 
 DWORD CClip::m_LastAddedCRC = 0;
-long CClip::m_LastAddedID = -1;
+int CClip::m_lastAddedID = -1;
 
 CClip::CClip() : 
-	m_ID(0), 
+	m_id(0), 
 	m_CRC(0),
-	m_lParent(-1),
-	m_lDontAutoDelete(FALSE),
-	m_lShortCut(0),
+	m_parentId(-1),
+	m_dontAutoDelete(FALSE),
+	m_shortCut(0),
 	m_bIsGroup(FALSE),
 	m_param1(0)
 {
@@ -176,13 +176,13 @@ CClip::~CClip()
 
 void CClip::Clear()
 {
-	m_ID = -1;
+	m_id = -1;
 	m_Time = 0;
 	m_Desc = "";
 	m_CRC = 0;
-	m_lParent = -1;
-	m_lDontAutoDelete = FALSE;
-	m_lShortCut = 0;
+	m_parentId = -1;
+	m_dontAutoDelete = FALSE;
+	m_shortCut = 0;
 	m_bIsGroup = FALSE;
 	m_csQuickPaste = "";
 	m_param1 = 0;
@@ -194,16 +194,16 @@ const CClip& CClip::operator=(const CClip &clip)
 {
 	const CClipFormat* pCF;
 
-	m_ID = clip.m_ID;
+	m_id = clip.m_id;
 	m_Time = clip.m_Time;
 	m_CRC = clip.m_CRC;
-	m_lParent = clip.m_lParent;
-	m_lDontAutoDelete = clip.m_lDontAutoDelete;
-	m_lShortCut = clip.m_lShortCut;
+	m_parentId = clip.m_parentId;
+	m_dontAutoDelete = clip.m_dontAutoDelete;
+	m_shortCut = clip.m_shortCut;
 	m_bIsGroup = clip.m_bIsGroup;
 	m_csQuickPaste = clip.m_csQuickPaste;
 
-	int nCount = clip.m_Formats.GetSize();
+	INT_PTR nCount = clip.m_Formats.GetSize();
 	
 	for(int i = 0; i < nCount; i++)
 	{
@@ -212,7 +212,7 @@ const CClip& CClip::operator=(const CClip &clip)
 		LPVOID pvData = GlobalLock(pCF->m_hgData);
 		if(pvData)
 		{
-			AddFormat(pCF->m_cfType, pvData, GlobalSize(pCF->m_hgData));
+			AddFormat(pCF->m_cfType, pvData, (UINT)GlobalSize(pCF->m_hgData));
 		}
 		GlobalUnlock(pCF->m_hgData);
 	}
@@ -226,10 +226,10 @@ const CClip& CClip::operator=(const CClip &clip)
 void CClip::EmptyFormats()
 {
 	// free global memory in m_Formats
-	for(int i = m_Formats.GetSize()-1; i >= 0; i--)
+	for(INT_PTR i = m_Formats.GetSize()-1; i >= 0; i--)
 	{
 		m_Formats[i].Free();
-		m_Formats.RemoveAt( i );
+		m_Formats.RemoveAt(i);
 	}
 }
 
@@ -333,9 +333,9 @@ bool CClip::LoadFromClipboard(CClipTypes* pClipTypes)
 		bIsDescSet = SetDescFromText(cfDesc.m_hgData);
 	}
 
-	UINT nSize;
+	INT_PTR nSize;
 	CClipFormat cf;
-	int numTypes = pTypes->GetSize();
+	INT_PTR numTypes = pTypes->GetSize();
 
 	Log(StrF(_T("Begin enumerating over supported types, Count: %d"), numTypes));
 
@@ -428,12 +428,12 @@ bool CClip::SetDescFromText(HGLOBAL hgData)
 	
 	bool bRet = false;
 	TCHAR* text = (TCHAR *) GlobalLock(hgData);
-	long ulBufLen = GlobalSize(hgData);
+	INT_PTR bufLen = GlobalSize(hgData);
 	
 	m_Desc = text;
 	bRet = true;
 		
-	if(ulBufLen > g_Opt.m_bDescTextSize)
+	if(bufLen > g_Opt.m_bDescTextSize)
 	{
 		m_Desc = m_Desc.Left(g_Opt.m_bDescTextSize);
 	}
@@ -446,14 +446,14 @@ bool CClip::SetDescFromText(HGLOBAL hgData)
 
 bool CClip::SetDescFromType()
 {
-	int nSize = m_Formats.GetSize();
-	if(nSize <= 0)
+	INT_PTR size = m_Formats.GetSize();
+	if(size <= 0)
 	{
 		return false;
 	}
 
 	int nCF_HDROPIndex = -1;
-	for(int i = 0; i < nSize; i++)
+	for(int i = 0; i < size; i++)
 	{
 		if(m_Formats[i].m_cfType == CF_HDROP)
 		{
@@ -512,7 +512,7 @@ bool CClip::AddToDB(bool bCheckForDuplicates)
 				theApp.m_db.execDMLEx(_T("UPDATE Main SET lDate = %d where lID = %d;"), 
 										(long)m_Time.GetTime(), nID);
 
-				m_ID = nID;
+				m_id = nID;
 
 				return true;
 			}
@@ -548,7 +548,7 @@ int CClip::FindDuplicate()
 		if(g_Opt.m_bAllowDuplicates)
 		{
 			if(m_CRC == m_LastAddedCRC)
-				return m_LastAddedID;
+				return m_lastAddedID;
 		}
 		else
 		{
@@ -575,15 +575,15 @@ DWORD CClip::GenerateCRC()
 	{
 		//Generate a CRC value for all copied data
 
-		int nSize = m_Formats.GetSize();
-		for(int i = 0; i < nSize ; i++)
+		INT_PTR size = m_Formats.GetSize();
+		for(int i = 0; i < size ; i++)
 		{
 			pCF = & m_Formats.ElementAt(i);
 			
 			const unsigned char *Data = (const unsigned char *)GlobalLock(pCF->m_hgData);
 			if(Data)
 			{
-				pCrc32->GenerateCrc32((const LPBYTE)Data, GlobalSize(pCF->m_hgData), dwCRC);
+				pCrc32->GenerateCrc32((const LPBYTE)Data, (DWORD)GlobalSize(pCF->m_hgData), dwCRC);
 			}
 			GlobalUnlock(pCF->m_hgData);
 		}
@@ -608,19 +608,19 @@ bool CClip::AddToMainTable()
 		cs.Format(_T("INSERT into Main values(NULL, %d, '%s', %d, %d, %d, %d, %d, '%s');"),
 							(long)m_Time.GetTime(),
 							m_Desc,
-							m_lShortCut,
-							m_lDontAutoDelete,
+							m_shortCut,
+							m_dontAutoDelete,
 							m_CRC,
 							m_bIsGroup,
-							m_lParent,
+							m_parentId,
 							m_csQuickPaste);
 
 		theApp.m_db.execDML(cs);
 
-		m_ID = (long)theApp.m_db.lastRowId();
+		m_id = (long)theApp.m_db.lastRowId();
 
 		m_LastAddedCRC = m_CRC;
-		m_LastAddedID = m_ID;
+		m_lastAddedID = m_id;
 	}
 	CATCH_SQLITE_EXCEPTION_AND_RETURN(false)
 	
@@ -641,12 +641,12 @@ bool CClip::ModifyMainTable()
 			_T("lDontAutoDelete = %d, ")
 			_T("QuickPasteText = '%s' ")
 			_T("WHERE lID = %d;"), 
-			m_lShortCut, 
+			m_shortCut, 
 			m_Desc, 
-			m_lParent, 
-			m_lDontAutoDelete, 
+			m_parentId, 
+			m_dontAutoDelete, 
 			m_csQuickPaste,
-			m_ID);
+			m_id);
 
 		bRet = true;
 	}
@@ -664,24 +664,24 @@ bool CClip::AddToDataTable()
 	{
 		CppSQLite3Statement stmt = theApp.m_db.compileStatement(_T("insert into Data values (NULL, ?, ?, ?);"));
 		
-		for(int i = m_Formats.GetSize()-1; i >= 0 ; i--)
+		for(INT_PTR i = m_Formats.GetSize()-1; i >= 0 ; i--)
 		{
-			pCF = & m_Formats.ElementAt(i);
+			pCF = &m_Formats.ElementAt(i);
 			
-			stmt.bind(1, m_ID);
+			stmt.bind(1, m_id);
 			stmt.bind(2, GetFormatName(pCF->m_cfType));
 
 			const unsigned char *Data = (const unsigned char *)GlobalLock(pCF->m_hgData);
 			if(Data)
 			{
-				stmt.bind(3, Data, GlobalSize(pCF->m_hgData));
+				stmt.bind(3, Data, (int)GlobalSize(pCF->m_hgData));
 			}
 			GlobalUnlock(pCF->m_hgData);
 			
 			stmt.execDML();
 			stmt.reset();
 
-			pCF->m_lDBID = (long)theApp.m_db.lastRowId();
+			pCF->m_dbId = (long)theApp.m_db.lastRowId();
 		}
 	}
 	CATCH_SQLITE_EXCEPTION_AND_RETURN(false)
@@ -709,25 +709,25 @@ void CClip::MakeLatestTime()
 	CATCH_SQLITE_EXCEPTION
 }
 
-BOOL CClip::LoadMainTable(long lID)
+BOOL CClip::LoadMainTable(int id)
 {
 	bool bRet = false;
 	try
 	{
-		CppSQLite3Query q = theApp.m_db.execQueryEx(_T("SELECT * FROM Main WHERE lID = %d"), lID);
+		CppSQLite3Query q = theApp.m_db.execQueryEx(_T("SELECT * FROM Main WHERE lID = %d"), id);
 
 		if(q.eof() == false)
 		{
 			m_Time = q.getIntField(_T("lDate"));
 			m_Desc = q.getStringField(_T("mText"));
 			m_CRC = q.getIntField(_T("CRC"));
-			m_lParent = q.getIntField(_T("lParentID"));
-			m_lDontAutoDelete = q.getIntField(_T("lDontAutoDelete"));
-			m_lShortCut = q.getIntField(_T("lShortCut"));
+			m_parentId = q.getIntField(_T("lParentID"));
+			m_dontAutoDelete = q.getIntField(_T("lDontAutoDelete"));
+			m_shortCut = q.getIntField(_T("lShortCut"));
 			m_bIsGroup = q.getIntField(_T("bIsGroup"));
 			m_csQuickPaste = q.getStringField(_T("QuickPasteText"));
 
-			m_ID = lID;
+			m_id = id;
 
 			bRet = true;
 		}
@@ -740,7 +740,7 @@ BOOL CClip::LoadMainTable(long lID)
 // STATICS
 
 // Allocates a Global containing the requested Clip Format Data
-HGLOBAL CClip::LoadFormat(long lID, UINT cfType)
+HGLOBAL CClip::LoadFormat(int id, UINT cfType)
 {
 	HGLOBAL hGlobal = 0;
 	try
@@ -752,7 +752,7 @@ HGLOBAL CClip::LoadFormat(long lID, UINT cfType)
 			_T("INNER JOIN Main ON Main.lID = Data.lParentID ")
 			_T("WHERE Main.lID = %d ")
 			_T("AND Data.strClipBoardFormat = \'%s\'"),
-			lID,
+			id,
 			GetFormatName(cfType));
 
 		CppSQLite3Query q = theApp.m_db.execQuery(csSQL);
@@ -774,7 +774,7 @@ HGLOBAL CClip::LoadFormat(long lID, UINT cfType)
 	return hGlobal;
 }
 
-bool CClip::LoadFormats(long lID, bool bOnlyLoad_CF_TEXT)
+bool CClip::LoadFormats(int id, bool bOnlyLoad_CF_TEXT)
 {
 	CClipFormat cf;
 	HGLOBAL hGlobal = 0;
@@ -790,13 +790,13 @@ bool CClip::LoadFormats(long lID, bool bOnlyLoad_CF_TEXT)
 		csSQL.Format(
 			_T("SELECT Data.lID, strClipBoardFormat, ooData FROM Data ")
 			_T("INNER JOIN Main ON Main.lID = Data.lParentID ")
-			_T("WHERE Main.lID = %d ORDER BY Data.lID desc"), lID);
+			_T("WHERE Main.lID = %d ORDER BY Data.lID desc"), id);
 
 		CppSQLite3Query q = theApp.m_db.execQuery(csSQL);
 
 		while(q.eof() == false)
 		{
-			cf.m_lDBID = q.getIntField(_T("lID"));
+			cf.m_dbId = q.getIntField(_T("lID"));
 			cf.m_cfType = GetFormatID(q.getStringField(_T("strClipBoardFormat")));
 			
 			if(bOnlyLoad_CF_TEXT)
@@ -829,7 +829,7 @@ bool CClip::LoadFormats(long lID, bool bOnlyLoad_CF_TEXT)
 	return m_Formats.GetSize() > 0;
 }
 
-void CClip::LoadTypes(long lID, CClipTypes& types)
+void CClip::LoadTypes(int id, CClipTypes& types)
 {
 	types.RemoveAll();
 	try
@@ -842,7 +842,7 @@ void CClip::LoadTypes(long lID, CClipTypes& types)
 		csSQL.Format(
 			_T("SELECT strClipBoardFormat FROM Data ")
 			_T("INNER JOIN Main ON Main.lID = Data.lParentID ")
-			_T("WHERE Main.lID = %d ORDER BY Data.lID desc"), lID);
+			_T("WHERE Main.lID = %d ORDER BY Data.lID desc"), id);
 
 		CppSQLite3Query q = theApp.m_db.execQuery(csSQL);			
 
@@ -861,18 +861,18 @@ bool CClip::SaveFromEditWnd(BOOL bUpdateDesc)
 
 	try
 	{
-		theApp.m_db.execDMLEx(_T("DELETE FROM Data WHERE lParentID = %d;"), m_ID);
+		theApp.m_db.execDMLEx(_T("DELETE FROM Data WHERE lParentID = %d;"), m_id);
 
 		DWORD CRC = GenerateCRC();
 
 		AddToDataTable();
 
-		theApp.m_db.execDMLEx(_T("UPDATE Main SET CRC = %d WHERE lID = %d"), CRC, m_ID);
+		theApp.m_db.execDMLEx(_T("UPDATE Main SET CRC = %d WHERE lID = %d"), CRC, m_id);
 		
 		if(bUpdateDesc)
 		{
 			m_Desc.Replace(_T("'"), _T("''"));
-			theApp.m_db.execDMLEx(_T("UPDATE Main SET mText = '%s' WHERE lID = %d"), m_Desc, m_ID);
+			theApp.m_db.execDMLEx(_T("UPDATE Main SET mText = '%s' WHERE lID = %d"), m_Desc, m_id);
 		}
 
 		bRet = true;
@@ -903,29 +903,32 @@ int CClipList::AddToDB(bool bLatestTime)
 	Log(_T("AddToDB - Start"));
 
 	int savedCount = 0;
-	int nRemaining = 0;
 	CClip* pClip;
 	POSITION pos;
 	bool bResult;
 	
-	nRemaining = GetCount();
+	INT_PTR remaining = GetCount();
 	pos = GetHeadPosition();
 	while(pos)
 	{
-		Log(StrF(_T("AddToDB - while(pos), Start Remaining %d"), nRemaining));
-		nRemaining--;
+		Log(StrF(_T("AddToDB - while(pos), Start Remaining %d"), remaining));
+		remaining--;
 		
 		pClip = GetNext(pos);
 		ASSERT(pClip);
 		
 		if(bLatestTime)
+		{
 			pClip->MakeLatestTime();
-		
+		}
+
 		bResult = pClip->AddToDB();
-		if( bResult )
+		if(bResult)
+		{
 			savedCount++;
+		}
 
-		Log(StrF(_T("AddToDB - while(pos), End Remaining %d, save count: %d"), nRemaining, savedCount));
+		Log(StrF(_T("AddToDB - while(pos), End Remaining %d, save count: %d"), remaining, savedCount));
 	}
 
 	Log(StrF(_T("AddToDB - Start, count: %d"), savedCount));

+ 18 - 18
Clip.h

@@ -37,9 +37,9 @@ public:
 	CLIPFORMAT m_cfType;
     HGLOBAL m_hgData;
 	bool m_autoDeleteData;
-	long m_lDBID;
+	int m_dbId;
 
-	CClipFormat(CLIPFORMAT cfType = 0, HGLOBAL hgData = 0, long lDBID = -1);
+	CClipFormat(CLIPFORMAT cfType = 0, HGLOBAL hgData = 0, int dbId = -1);
 	~CClipFormat();
 
 	void Clear();
@@ -63,11 +63,11 @@ public:
 	//  or NULL if that type doesn't exist in this array.
 	CClipFormat* FindFormat(UINT cfType); 
 
-	virtual int Size() { return this->GetCount(); }
+	virtual int Size() { return (int)this->GetCount(); }
 	virtual IClipFormat *GetAt(int nPos) { return &this->ElementAt(nPos); }
 	virtual void DeleteAt(int nPos) { this->RemoveAt(nPos); }
 	virtual void DeleteAll() { this->RemoveAll(); }
-	virtual int AddNew(CLIPFORMAT type, HGLOBAL data) {CClipFormat ft(type, data, -1); ft.m_autoDeleteData = false; return this->Add(ft); }
+	virtual INT_PTR AddNew(CLIPFORMAT type, HGLOBAL data) {CClipFormat ft(type, data, -1); ft.m_autoDeleteData = false; return this->Add(ft); }
 	virtual IClipFormat *FindFormatEx(CLIPFORMAT type)	{ return FindFormat((UINT)type); }
 };
 
@@ -84,16 +84,16 @@ public:
 	const CClip& operator=(const CClip &clip);
 
 	static DWORD m_LastAddedCRC;
-	static long m_LastAddedID;
+	static int m_lastAddedID;
 
-	long m_ID;
+	int m_id;
 	CClipFormats m_Formats;
 	CTime m_Time;
 	CString m_Desc;
 	ULONG m_lTotalCopySize;
-	long m_lParent;
-	long m_lDontAutoDelete;
-	long m_lShortCut;
+	int m_parentId;
+	int m_dontAutoDelete;
+	int m_shortCut;
 	BOOL m_bIsGroup;
 	DWORD m_CRC;
 	CString m_csQuickPaste;
@@ -102,11 +102,11 @@ public:
 	virtual CString Description() { return m_Desc; }
 	virtual void Description(CString csValue) { m_Desc = csValue; }
 	virtual CTime PasteTime() { return m_Time; }
-	virtual int ID() { return m_ID; }
-	virtual int Parent() { return m_lParent; }
-	virtual void Parent(int nParent) { m_lParent = nParent; }
-	virtual int DontAutoDelete() { return m_lDontAutoDelete; }
-	virtual void DontAutoDelete(int Dont) { m_lDontAutoDelete = Dont; }
+	virtual int ID() { return m_id; }
+	virtual int Parent() { return m_parentId; }
+	virtual void Parent(int nParent) { m_parentId = nParent; }
+	virtual int DontAutoDelete() { return m_dontAutoDelete; }
+	virtual void DontAutoDelete(int Dont) { m_dontAutoDelete = Dont; }
 	virtual CString QuickPaste() { return m_csQuickPaste; }
 	virtual void QuickPaste(CString csValue) { m_csQuickPaste = csValue; }
 
@@ -122,15 +122,15 @@ public:
 	bool ModifyMainTable();
 	bool SaveFromEditWnd(BOOL bUpdateDesc);
 	void MakeLatestTime();
-	BOOL LoadMainTable(long lID);
+	BOOL LoadMainTable(int id);
 	DWORD GenerateCRC();
 
 	// Allocates a Global containing the requested Clip's Format Data
-	static HGLOBAL LoadFormat(long lID, UINT cfType);
+	static HGLOBAL LoadFormat(int id, UINT cfType);
 	// Fills "formats" with the Data of all Formats in the db for the given Clip ID
-	bool LoadFormats(long lID, bool bOnlyLoad_CF_TEXT = false);
+	bool LoadFormats(int id, bool bOnlyLoad_CF_TEXT = false);
 	// Fills "types" with all Types in the db for the given Clip ID
-	static void LoadTypes(long lID, CClipTypes& types);
+	static void LoadTypes(int id, CClipTypes& types);
 
 	
 protected:

+ 1 - 1
ClipFormatQListCtrl.h

@@ -8,7 +8,7 @@ public:
 	CClipFormatQListCtrl(void);
 	~CClipFormatQListCtrl(void);
 
-	long m_clipRow;
+	int m_clipRow;
 	bool m_convertedToSmallImage;
 
 	HGLOBAL GetDib(CDC *pDc, int height);

+ 470 - 471
ClipIds.cpp

@@ -1,472 +1,471 @@
-#include "stdafx.h"
-#include "CP_Main.h"
-#include "ClipIds.h"
-#include "tinyxml.h"
-#include "shared/TextConvert.h"
-#include "Clip_ImportExport.h"
-#include "CF_HDropAggregator.h"
-#include "CF_UnicodeTextAggregator.h"
-#include "CF_TextAggregator.h"
-#include "richtextaggregator.h"
-#include "htmlformataggregator.h"
-#include "Popup.h"
-
-// allocate an HGLOBAL of the given Format Type representing these Clip IDs.
-HGLOBAL CClipIDs::Render(UINT cfType)
-{
-	int count = GetSize();
-	if(count <= 0)
-	{
-		return 0;
-	}
-
-	if(count == 1)
-	{
-		return CClip::LoadFormat(ElementAt(0), cfType);
-	}
-
-	CStringA SepA = CTextConvert::ConvertToChar(g_Opt.GetMultiPasteSeparator());
-	CStringW SepW = CTextConvert::ConvertToUnicode(g_Opt.GetMultiPasteSeparator());
-
-	if(cfType == CF_TEXT)
-	{
-		CCF_TextAggregator CFText(SepA);
-		if(AggregateData(CFText, CF_TEXT, g_Opt.m_bMultiPasteReverse && g_Opt.m_bHistoryStartTop))
-		{
-			return CFText.GetHGlobal();
-		}
-	}
-	else if(cfType == CF_UNICODETEXT)
-	{
-		CCF_UnicodeTextAggregator CFUnicodeText(SepW);
-		if(AggregateData(CFUnicodeText, CF_UNICODETEXT, g_Opt.m_bMultiPasteReverse && g_Opt.m_bHistoryStartTop))
-		{
-			return CFUnicodeText.GetHGlobal();
-		}
-	}
-	else if(cfType == CF_HDROP)
-	{
-		CCF_HDropAggregator HDrop;
-		if(AggregateData(HDrop, CF_HDROP, g_Opt.m_bMultiPasteReverse && g_Opt.m_bHistoryStartTop))
-		{
-			return HDrop.GetHGlobal();
-		}
-	}
-	else if(cfType == theApp.m_HTML_Format)
-	{
-		CHTMLFormatAggregator Html(SepA);
-		if(AggregateData(Html, theApp.m_HTML_Format, g_Opt.m_bMultiPasteReverse && g_Opt.m_bHistoryStartTop))
-		{
-			return Html.GetHGlobal();
-		}
-	}
-	else if(cfType == theApp.m_RTFFormat)
-	{
-		CRichTextAggregator RichText(SepA);
-		if(AggregateData(RichText, theApp.m_RTFFormat, g_Opt.m_bMultiPasteReverse && g_Opt.m_bHistoryStartTop))
-		{
-			return RichText.GetHGlobal();
-		}
-	}
-	
-	return NULL;
-}
-
-void CClipIDs::GetTypes(CClipTypes& types)
-{
-	int IDCount = GetSize();
-	types.RemoveAll();
-
-	if(IDCount == 1)
-	{
-		CClip::LoadTypes(ElementAt(0), types);
-	}
-	else if(IDCount > 1)
-	{
-		//Add the types that are common accross all paste ids
-		long lCount;
-		CMap<CLIPFORMAT, CLIPFORMAT, long, long> RenderTypes;
-
-		for(int nIDPos = 0; nIDPos < IDCount; nIDPos++)
-		{
-			CClipTypes CurrTypes;
-			CClip::LoadTypes(ElementAt(nIDPos), CurrTypes);
-
-			int nTypeCount = CurrTypes.GetSize();
-
-			for(int nType = 0; nType < nTypeCount; nType++)
-			{	
-				lCount = 0;
-				if(nIDPos == 0 || RenderTypes.Lookup(CurrTypes[nType], lCount) == TRUE)
-				{
-					lCount++;
-					RenderTypes.SetAt(CurrTypes[nType], lCount);
-				}
-			}
-		}
-
-		CLIPFORMAT Format;
-		POSITION pos = RenderTypes.GetStartPosition();
-		while(pos)
-		{
-			RenderTypes.GetNextAssoc(pos, Format, lCount);
-			if(lCount == IDCount)
-			{
-				types.Add(Format);
-			}			
-		}
-
-		//If there were no common types add the first clip
-		if(types.GetSize() <= 0)
-		{
-			CClip::LoadTypes(ElementAt(0), types);
-		}
-	}
-}
-
-bool CClipIDs::AggregateData(IClipAggregator &Aggregator, UINT cfType, BOOL bReverse)
-{
-	CString csSQL;
-	LPWSTR Text = NULL;
-	int nTextSize = 0;
-	int numIDs = GetSize();
-	int* pIDs = GetData();
-	bool bRet = false;
-
-	try
-	{
-		int nIndex;
-		for(int i=0; i < numIDs; i++)
-		{
-			nIndex = i;
-			if(bReverse)
-			{
-				nIndex = numIDs - i - 1;
-			}
-
-			csSQL.Format(_T("SELECT * FROM Data ")
-				_T("INNER JOIN Main ON Main.lID = Data.lParentID ")
-				_T("WHERE Data.strClipBoardFormat = '%s' ")
-				_T("AND Main.lID = %d"),
-				GetFormatName(cfType),
-				pIDs[nIndex]);
-
-			CppSQLite3Query q = theApp.m_db.execQuery(csSQL);
-
-			if(q.eof() == false)
-			{
-				int nDataLen = 0;
-				LPVOID pData = (LPVOID)q.getBlobField(_T("ooData"), nDataLen);
-				if(pData == NULL)
-				{
-					continue;
-				}
-
-				if(Aggregator.AddClip(pData, nDataLen, i, numIDs))
-				{
-					bRet = true;
-				}
-			}
-		}
-	}
-	CATCH_SQLITE_EXCEPTION
-		catch(...)
-	{
-
-	}
-
-	return bRet;
-}
-
-//----------------------------------------------
-// ELEMENT (Clip or Group) MANAGEMENT FUNCTIONS
-//----------------------------------------------
-
-// returns the address of the given id in this array or NULL.
-long* CClipIDs::FindID(long lID)
-{
-	int count = GetSize();
-	long* pID = (long*) GetData();
-
-	for(int i=0; i < count; i++)
-	{
-		if(*pID == lID)
-		{
-			return pID;
-		}
-		pID++;
-	}
-	return NULL;
-}
-
-// Blindly Moves IDs into the lParentID Group sequentially with the given order
-BOOL CClipIDs::MoveTo(long lParentID, double dFirst, double dIncrement)
-{
-	try
-	{
-		int nCount = GetSize();
-		for(int i = 0; i < nCount; i++)
-		{
-			CString sql = StrF(_T("UPDATE Main SET lParentID = %d ")
-								_T("WHERE lID = %d AND lID <> %d;"), 
-								lParentID,
-								ElementAt(i),
-								lParentID);
-
-			theApp.m_db.execDMLEx(sql);
-		}
-	}
-	CATCH_SQLITE_EXCEPTION
-		
-	return (TRUE);
-}
-
-// Empties this array and fills it with the elements of the given group ID
-BOOL CClipIDs::LoadElementsOf(long lGroupID)
-{
-	SetSize(0);
-	
-	try
-	{
-		CppSQLite3Query q = theApp.m_db.execQueryEx(_T("SELECT lID FROM Main WHERE lParentID = %d"), lGroupID);
-		while(q.eof() == false)
-		{
-			Add(q.getIntField(_T("lID")));
-			q.nextRow();
-		}
-	}
-	CATCH_SQLITE_EXCEPTION
-		
-	return GetSize();
-}
-
-// Creates copies (duplicates) of all items in this array and assigns the
-// lParentID of the copies to the given "lParentID" group.
-// - if lParentID <= 0, then the copies have the same parent as the source
-// - pCopies is filled with the corresponding duplicate IDs.
-// - pAddNewTable and pSeekTable are used for more efficient recursion.
-// - the primary overhead for recursion is one ID array per level deep.
-//   an alternative design would be to have one CMainTable per level deep,
-//   but I thought that might be too costly, so I implemented it this way.
-
-BOOL CClipIDs::CopyTo(long lParentID)
-{
-	int count = GetSize();
-	if(count == 0)
-		return TRUE;
-		
-	try
-	{
-		theApp.m_db.execDML(_T("begin transaction;"));
-
-		for(int i = 0; i < count; i++)
-		{
-			int nID = ElementAt(i);
-
-			CClip clip;
-
-			if(clip.LoadMainTable(nID))
-			{
-				if(clip.LoadFormats(nID))
-				{
-					clip.MakeLatestTime();
-
-					clip.m_lShortCut = 0;
-					clip.m_lParent = lParentID;
-					clip.m_csQuickPaste = "";
-
-					if(clip.AddToDB(false) == false)
-					{
-						Log(_T("failed to add copy to database"));
-					}
-				}
-			}
-		}
-
-		theApp.m_db.execDML(_T("commit transaction;"));
-	}
-	CATCH_SQLITE_EXCEPTION
-		
-	return TRUE;
-}
-
-BOOL CClipIDs::DeleteIDs(bool fromClipWindow, CppSQLite3DB& db)
-{
-	CPopup status(0, 0, ::GetForegroundWindow());
-	bool bAllowShow;
-	bAllowShow = IsAppWnd(::GetForegroundWindow());
-	
-	BOOL bRet = TRUE;
-	int count = GetSize();
-	int batchCount = 25;
-
-	Log(StrF(_T("Begin delete clips, Count: %d from Window: %d"), count, fromClipWindow));
-	
-	if(count <= 0)
-		return FALSE;
-
-	try
-	{
-		CString sql = _T("DELETE FROM Main where lId in(");
-		CString sqlIn = _T("");
-		CString workingString = _T("Deleting clips, building query statement");
-		int startIndex = 0;
-		int index = 0;
-
-		if(bAllowShow)
-		{
-			status.Show(workingString);
-		}
-
-		for(index = 0; index < count; index++)
-		{
-			int clipId = ElementAt(index);
-			if(clipId <= 0)
-				continue;
-
-			Log(StrF(_T("Delete clip Id: %d"), clipId));
-
-			bool cont = false;
-			bool bGroup = false;
-			{
-				CppSQLite3Query q = db.execQueryEx(_T("SELECT bIsGroup FROM Main WHERE lId = %d"), clipId);
-				cont = !q.eof();
-				if(cont)
-				{
-					bGroup = q.getIntField(_T("bIsGroup")) > 0;
-				}
-			}
-
-			if(cont)
-			{			
-				if(bGroup)
-				{
-					db.execDMLEx(_T("UPDATE Main SET lParentID = -1 WHERE lParentID = %d;"), clipId);
-				}
-
-				if(sqlIn.GetLength() > 0)
-				{
-					sqlIn += ", ";
-				}
-				sqlIn += StrF(_T("%d"), clipId);
-			}
-
-			if(index > 0 && 
-				(index % batchCount) == 0)
-			{
-				if(bAllowShow)
-				{
-					status.Show(StrF(_T("Deleting %d - %d of %d..."), startIndex+1, index, count));
-				}
-				startIndex = index;
-
-				db.execDMLEx(sql + sqlIn + _T(")"));
-				sqlIn = "";
-				bRet = TRUE;
-
-				if(bAllowShow)
-				{
-					status.Show(workingString);
-				}
-			}
-
-			if(fromClipWindow == false)
-			{
-				theApp.OnDeleteID(clipId);
-			}
-		}
-
-		if(sqlIn.GetLength() > 0)
-		{
-			if(bAllowShow)
-			{
-				status.Show(StrF(_T("Deleting %d - %d of %d..."), startIndex+1, index, count));
-			}
-
-			db.execDMLEx(sql + sqlIn + _T(")"));
-			bRet = TRUE;
-		}
-	}
-	CATCH_SQLITE_EXCEPTION_AND_RETURN(FALSE)
-	
-	Log(StrF(_T("End delete clips, Count: %d"), count));
-
-	return bRet;
-}
-
-BOOL CClipIDs::CreateExportSqliteDB(CppSQLite3DB &db)
-{
-	BOOL bRet = FALSE;
-	try
-	{
-		db.execDML(_T("CREATE TABLE Main(")
-			_T("lID INTEGER PRIMARY KEY AUTOINCREMENT, ")
-			_T("lVersion INTEGER, ")
-			_T("mText TEXT);"));
-
-		db.execDML(_T("CREATE TABLE Data(")
-			_T("lID INTEGER PRIMARY KEY AUTOINCREMENT, ")
-			_T("lParentID INTEGER, ")
-			_T("strClipBoardFormat TEXT, ")
-			_T("lOriginalSize INTEGER, ")
-			_T("ooData BLOB);"));
-
-		db.execDML(_T("CREATE UNIQUE INDEX Main_ID on Main(lID ASC)"));
-		db.execDML(_T("CREATE UNIQUE INDEX Data_ID on Data(lID ASC)"));
-
-		db.execDML(_T("CREATE TRIGGER delete_data_trigger BEFORE DELETE ON Main FOR EACH ROW\n")
-			_T("BEGIN\n")
-			_T("DELETE FROM Data WHERE lParentID = old.lID;\n")
-			_T("END\n"));
-
-		bRet = TRUE;
-	}
-	CATCH_SQLITE_EXCEPTION_AND_RETURN(FALSE)
-
-	return bRet;
-}
-
-BOOL CClipIDs::Export(CString csFilePath)
-{    
-	int count = GetSize();
-	if(count == 0)
-		return TRUE;
-
-	BOOL bRet = FALSE;
-
-	if(FileExists(csFilePath) && DeleteFile(csFilePath) == FALSE)
-	{
-		Log(StrF(_T("Export::Error deleting the file %s"), csFilePath));
-		return FALSE;
-	}
-
-	try
-	{		
-		CppSQLite3DB db;
-		db.open(csFilePath);
-
-		if(CreateExportSqliteDB(db) == FALSE)
-			return FALSE;
-	
-		for(int i = 0; i < count; i++)
-		{
-			int nID = ElementAt(i);
-
-			CClip_ImportExport clip;
-			
-			if(clip.LoadMainTable(nID))
-			{
-				if(clip.LoadFormats(nID))
-				{
-					clip.ExportToSqliteDB(db);
-					bRet = TRUE;
-				}
-			}
-		}
-
-		db.close();
-	}
-	CATCH_SQLITE_EXCEPTION
-
-	return bRet;
+#include "stdafx.h"
+#include "CP_Main.h"
+#include "ClipIds.h"
+#include "tinyxml.h"
+#include "shared/TextConvert.h"
+#include "Clip_ImportExport.h"
+#include "CF_HDropAggregator.h"
+#include "CF_UnicodeTextAggregator.h"
+#include "CF_TextAggregator.h"
+#include "richtextaggregator.h"
+#include "htmlformataggregator.h"
+#include "Popup.h"
+
+// allocate an HGLOBAL of the given Format Type representing these Clip IDs.
+HGLOBAL CClipIDs::Render(UINT cfType)
+{
+	INT_PTR count = GetSize();
+	if(count <= 0)
+	{
+		return 0;
+	}
+
+	if(count == 1)
+	{
+		return CClip::LoadFormat(ElementAt(0), cfType);
+	}
+
+	CStringA SepA = CTextConvert::ConvertToChar(g_Opt.GetMultiPasteSeparator());
+	CStringW SepW = CTextConvert::ConvertToUnicode(g_Opt.GetMultiPasteSeparator());
+
+	if(cfType == CF_TEXT)
+	{
+		CCF_TextAggregator CFText(SepA);
+		if(AggregateData(CFText, CF_TEXT, g_Opt.m_bMultiPasteReverse && g_Opt.m_bHistoryStartTop))
+		{
+			return CFText.GetHGlobal();
+		}
+	}
+	else if(cfType == CF_UNICODETEXT)
+	{
+		CCF_UnicodeTextAggregator CFUnicodeText(SepW);
+		if(AggregateData(CFUnicodeText, CF_UNICODETEXT, g_Opt.m_bMultiPasteReverse && g_Opt.m_bHistoryStartTop))
+		{
+			return CFUnicodeText.GetHGlobal();
+		}
+	}
+	else if(cfType == CF_HDROP)
+	{
+		CCF_HDropAggregator HDrop;
+		if(AggregateData(HDrop, CF_HDROP, g_Opt.m_bMultiPasteReverse && g_Opt.m_bHistoryStartTop))
+		{
+			return HDrop.GetHGlobal();
+		}
+	}
+	else if(cfType == theApp.m_HTML_Format)
+	{
+		CHTMLFormatAggregator Html(SepA);
+		if(AggregateData(Html, theApp.m_HTML_Format, g_Opt.m_bMultiPasteReverse && g_Opt.m_bHistoryStartTop))
+		{
+			return Html.GetHGlobal();
+		}
+	}
+	else if(cfType == theApp.m_RTFFormat)
+	{
+		CRichTextAggregator RichText(SepA);
+		if(AggregateData(RichText, theApp.m_RTFFormat, g_Opt.m_bMultiPasteReverse && g_Opt.m_bHistoryStartTop))
+		{
+			return RichText.GetHGlobal();
+		}
+	}
+	
+	return NULL;
+}
+
+void CClipIDs::GetTypes(CClipTypes& types)
+{
+	INT_PTR count = GetSize();
+	types.RemoveAll();
+
+	if(count == 1)
+	{
+		CClip::LoadTypes(ElementAt(0), types);
+	}
+	else if(count > 1)
+	{
+		//Add the types that are common across all paste ids
+		long lCount;
+		CMap<CLIPFORMAT, CLIPFORMAT, long, long> RenderTypes;
+
+		for(int nIDPos = 0; nIDPos < count; nIDPos++)
+		{
+			CClipTypes CurrTypes;
+			CClip::LoadTypes(ElementAt(nIDPos), CurrTypes);
+
+			INT_PTR typeCount = CurrTypes.GetSize();
+
+			for(int type = 0; type < typeCount; type++)
+			{	
+				lCount = 0;
+				if(nIDPos == 0 || RenderTypes.Lookup(CurrTypes[type], lCount) == TRUE)
+				{
+					lCount++;
+					RenderTypes.SetAt(CurrTypes[type], lCount);
+				}
+			}
+		}
+
+		CLIPFORMAT Format;
+		POSITION pos = RenderTypes.GetStartPosition();
+		while(pos)
+		{
+			RenderTypes.GetNextAssoc(pos, Format, lCount);
+			if(lCount == count)
+			{
+				types.Add(Format);
+			}			
+		}
+
+		//If there were no common types add the first clip
+		if(types.GetSize() <= 0)
+		{
+			CClip::LoadTypes(ElementAt(0), types);
+		}
+	}
+}
+
+bool CClipIDs::AggregateData(IClipAggregator &Aggregator, UINT cfType, BOOL bReverse)
+{
+	CString csSQL;
+	LPWSTR Text = NULL;
+	int nTextSize = 0;
+	INT_PTR numIDs = GetSize();
+	bool bRet = false;
+
+	try
+	{
+		INT_PTR nIndex;
+		for(int i=0; i < numIDs; i++)
+		{
+			nIndex = i;
+			if(bReverse)
+			{
+				nIndex = numIDs - i - 1;
+			}
+
+			csSQL.Format(_T("SELECT * FROM Data ")
+				_T("INNER JOIN Main ON Main.lID = Data.lParentID ")
+				_T("WHERE Data.strClipBoardFormat = '%s' ")
+				_T("AND Main.lID = %d"),
+				GetFormatName(cfType),
+				this[nIndex]);
+
+			CppSQLite3Query q = theApp.m_db.execQuery(csSQL);
+
+			if(q.eof() == false)
+			{
+				int nDataLen = 0;
+				LPVOID pData = (LPVOID)q.getBlobField(_T("ooData"), nDataLen);
+				if(pData == NULL)
+				{
+					continue;
+				}
+
+				if(Aggregator.AddClip(pData, nDataLen, (int)i, (int)numIDs))
+				{
+					bRet = true;
+				}
+			}
+		}
+	}
+	CATCH_SQLITE_EXCEPTION
+		catch(...)
+	{
+
+	}
+
+	return bRet;
+}
+
+//----------------------------------------------
+// ELEMENT (Clip or Group) MANAGEMENT FUNCTIONS
+//----------------------------------------------
+
+// returns the address of the given id in this array or NULL.
+int* CClipIDs::FindID(int id)
+{
+	INT_PTR count = GetSize();
+	int* pID = GetData();
+
+	for(int i=0; i < count; i++)
+	{
+		if(*pID == id)
+		{
+			return pID;
+		}
+		pID++;
+	}
+	return NULL;
+}
+
+// Blindly Moves IDs into the lParentID Group sequentially with the given order
+BOOL CClipIDs::MoveTo(long lParentID, double dFirst, double dIncrement)
+{
+	try
+	{
+		INT_PTR count = GetSize();
+		for(int i = 0; i < count; i++)
+		{
+			CString sql = StrF(_T("UPDATE Main SET lParentID = %d ")
+								_T("WHERE lID = %d AND lID <> %d;"), 
+								lParentID,
+								ElementAt(i),
+								lParentID);
+
+			theApp.m_db.execDMLEx(sql);
+		}
+	}
+	CATCH_SQLITE_EXCEPTION
+		
+	return (TRUE);
+}
+
+// Empties this array and fills it with the elements of the given group ID
+BOOL CClipIDs::LoadElementsOf(int groupId)
+{
+	SetSize(0);
+	
+	try
+	{
+		CppSQLite3Query q = theApp.m_db.execQueryEx(_T("SELECT lID FROM Main WHERE lParentID = %d"), groupId);
+		while(q.eof() == false)
+		{
+			Add(q.getIntField(_T("lID")));
+			q.nextRow();
+		}
+	}
+	CATCH_SQLITE_EXCEPTION
+		
+	return GetSize() > 0;
+}
+
+// Creates copies (duplicates) of all items in this array and assigns the
+// lParentID of the copies to the given "lParentID" group.
+// - if lParentID <= 0, then the copies have the same parent as the source
+// - pCopies is filled with the corresponding duplicate IDs.
+// - pAddNewTable and pSeekTable are used for more efficient recursion.
+// - the primary overhead for recursion is one ID array per level deep.
+//   an alternative design would be to have one CMainTable per level deep,
+//   but I thought that might be too costly, so I implemented it this way.
+
+BOOL CClipIDs::CopyTo(int parentId)
+{
+	INT_PTR count = GetSize();
+	if(count == 0)
+		return TRUE;
+		
+	try
+	{
+		theApp.m_db.execDML(_T("begin transaction;"));
+
+		for(int i = 0; i < count; i++)
+		{
+			int nID = ElementAt(i);
+
+			CClip clip;
+
+			if(clip.LoadMainTable(nID))
+			{
+				if(clip.LoadFormats(nID))
+				{
+					clip.MakeLatestTime();
+
+					clip.m_shortCut = 0;
+					clip.m_parentId = parentId;
+					clip.m_csQuickPaste = "";
+
+					if(clip.AddToDB(false) == false)
+					{
+						Log(_T("failed to add copy to database"));
+					}
+				}
+			}
+		}
+
+		theApp.m_db.execDML(_T("commit transaction;"));
+	}
+	CATCH_SQLITE_EXCEPTION
+		
+	return TRUE;
+}
+
+BOOL CClipIDs::DeleteIDs(bool fromClipWindow, CppSQLite3DB& db)
+{
+	CPopup status(0, 0, ::GetForegroundWindow());
+	bool bAllowShow;
+	bAllowShow = IsAppWnd(::GetForegroundWindow());
+	
+	BOOL bRet = TRUE;
+	INT_PTR count = GetSize();
+	int batchCount = 25;
+
+	Log(StrF(_T("Begin delete clips, Count: %d from Window: %d"), count, fromClipWindow));
+	
+	if(count <= 0)
+		return FALSE;
+
+	try
+	{
+		CString sql = _T("DELETE FROM Main where lId in(");
+		CString sqlIn = _T("");
+		CString workingString = _T("Deleting clips, building query statement");
+		INT_PTR startIndex = 0;
+		INT_PTR index = 0;
+
+		if(bAllowShow)
+		{
+			status.Show(workingString);
+		}
+
+		for(index = 0; index < count; index++)
+		{
+			int clipId = ElementAt(index);
+			if(clipId <= 0)
+				continue;
+
+			Log(StrF(_T("Delete clip Id: %d"), clipId));
+
+			bool cont = false;
+			bool bGroup = false;
+			{
+				CppSQLite3Query q = db.execQueryEx(_T("SELECT bIsGroup FROM Main WHERE lId = %d"), clipId);
+				cont = !q.eof();
+				if(cont)
+				{
+					bGroup = q.getIntField(_T("bIsGroup")) > 0;
+				}
+			}
+
+			if(cont)
+			{			
+				if(bGroup)
+				{
+					db.execDMLEx(_T("UPDATE Main SET lParentID = -1 WHERE lParentID = %d;"), clipId);
+				}
+
+				if(sqlIn.GetLength() > 0)
+				{
+					sqlIn += ", ";
+				}
+				sqlIn += StrF(_T("%d"), clipId);
+			}
+
+			if(index > 0 && 
+				(index % batchCount) == 0)
+			{
+				if(bAllowShow)
+				{
+					status.Show(StrF(_T("Deleting %d - %d of %d..."), startIndex+1, index, count));
+				}
+				startIndex = index;
+
+				db.execDMLEx(sql + sqlIn + _T(")"));
+				sqlIn = "";
+				bRet = TRUE;
+
+				if(bAllowShow)
+				{
+					status.Show(workingString);
+				}
+			}
+
+			if(fromClipWindow == false)
+			{
+				theApp.OnDeleteID(clipId);
+			}
+		}
+
+		if(sqlIn.GetLength() > 0)
+		{
+			if(bAllowShow)
+			{
+				status.Show(StrF(_T("Deleting %d - %d of %d..."), startIndex+1, index, count));
+			}
+
+			db.execDMLEx(sql + sqlIn + _T(")"));
+			bRet = TRUE;
+		}
+	}
+	CATCH_SQLITE_EXCEPTION_AND_RETURN(FALSE)
+	
+	Log(StrF(_T("End delete clips, Count: %d"), count));
+
+	return bRet;
+}
+
+BOOL CClipIDs::CreateExportSqliteDB(CppSQLite3DB &db)
+{
+	BOOL bRet = FALSE;
+	try
+	{
+		db.execDML(_T("CREATE TABLE Main(")
+			_T("lID INTEGER PRIMARY KEY AUTOINCREMENT, ")
+			_T("lVersion INTEGER, ")
+			_T("mText TEXT);"));
+
+		db.execDML(_T("CREATE TABLE Data(")
+			_T("lID INTEGER PRIMARY KEY AUTOINCREMENT, ")
+			_T("lParentID INTEGER, ")
+			_T("strClipBoardFormat TEXT, ")
+			_T("lOriginalSize INTEGER, ")
+			_T("ooData BLOB);"));
+
+		db.execDML(_T("CREATE UNIQUE INDEX Main_ID on Main(lID ASC)"));
+		db.execDML(_T("CREATE UNIQUE INDEX Data_ID on Data(lID ASC)"));
+
+		db.execDML(_T("CREATE TRIGGER delete_data_trigger BEFORE DELETE ON Main FOR EACH ROW\n")
+			_T("BEGIN\n")
+			_T("DELETE FROM Data WHERE lParentID = old.lID;\n")
+			_T("END\n"));
+
+		bRet = TRUE;
+	}
+	CATCH_SQLITE_EXCEPTION_AND_RETURN(FALSE)
+
+	return bRet;
+}
+
+BOOL CClipIDs::Export(CString csFilePath)
+{    
+	INT_PTR count = GetSize();
+	if(count == 0)
+		return TRUE;
+
+	BOOL bRet = FALSE;
+
+	if(FileExists(csFilePath) && DeleteFile(csFilePath) == FALSE)
+	{
+		Log(StrF(_T("Export::Error deleting the file %s"), csFilePath));
+		return FALSE;
+	}
+
+	try
+	{		
+		CppSQLite3DB db;
+		db.open(csFilePath);
+
+		if(CreateExportSqliteDB(db) == FALSE)
+			return FALSE;
+	
+		for(int i = 0; i < count; i++)
+		{
+			int nID = ElementAt(i);
+
+			CClip_ImportExport clip;
+			
+			if(clip.LoadMainTable(nID))
+			{
+				if(clip.LoadFormats(nID))
+				{
+					clip.ExportToSqliteDB(db);
+					bRet = TRUE;
+				}
+			}
+		}
+
+		db.close();
+	}
+	CATCH_SQLITE_EXCEPTION
+
+	return bRet;
 }

+ 3 - 3
ClipIds.h

@@ -17,7 +17,7 @@ public:
 // MANAGEMENT FUNCTIONS
 
 	// returns the address of the given id in this array or NULL.
-	long* FindID(long lID);
+	int* FindID(int id);
 
 	// Blindly Moves IDs into the lParentID Group sequentially with the given order
 	// (i.e. this does not check to see if the IDs' order conflict)
@@ -29,9 +29,9 @@ public:
 //	BOOL ReorderGroupInsert( long lParentID, long lInsertBeforeID = 0 );
 
 	// Empties this array and fills it with the elements of the given group ID
-	BOOL LoadElementsOf(long lGroupID);
+	BOOL LoadElementsOf(int groupId);
 
-	BOOL CopyTo(long lParentID);
+	BOOL CopyTo(int parentId);
 
 	BOOL DeleteIDs(bool fromClipWindow, CppSQLite3DB& db);
 

+ 15 - 15
Clip_ImportExport.cpp

@@ -9,7 +9,7 @@
 #define CURRENT_EXPORT_VERSION 1
 
 CClip_ImportExport::CClip_ImportExport(void) :
-	m_lImportCount(0)
+	m_importCount(0)
 {
 
 }
@@ -32,27 +32,27 @@ bool CClip_ImportExport::ExportToSqliteDB(CppSQLite3DB &db)
 		CClipFormat* pCF;
 		CppSQLite3Statement stmt = db.compileStatement(_T("insert into Data values (NULL, ?, ?, ?, ?);"));
 
-		for(int i = m_Formats.GetSize()-1; i >= 0 ; i--)
+		for(INT_PTR i = m_Formats.GetSize()-1; i >= 0 ; i--)
 		{
 			pCF = & m_Formats.ElementAt(i);
 
 			stmt.bind(1, lId);
 			stmt.bind(2, GetFormatName(pCF->m_cfType));
-			long lOriginalSize = GlobalSize(pCF->m_hgData);
-			stmt.bind(3, lOriginalSize);
+			INT_PTR originalSize = GlobalSize(pCF->m_hgData);
+			stmt.bind(3, (int)originalSize);
 
 			const unsigned char *Data = (const unsigned char *)GlobalLock(pCF->m_hgData);
 			if(Data)
 			{
 				//First compress the data
-				long lZippedSize = compressBound(lOriginalSize);
-				Bytef *pZipped = new Bytef[lZippedSize];
+				INT_PTR zippedSize = compressBound((ULONG)originalSize);
+				Bytef *pZipped = new Bytef[zippedSize];
 				if(pZipped)
 				{				
-					int nZipReturn = compress(pZipped, (uLongf *)&lZippedSize, (const Bytef *)Data, lOriginalSize);
-					if(nZipReturn == Z_OK)
+					INT_PTR zipReturn = compress(pZipped, (uLongf *)&zippedSize, (const Bytef *)Data, (ULONG)originalSize);
+					if(zipReturn == Z_OK)
 					{
-						stmt.bind(4, pZipped, lZippedSize);
+						stmt.bind(4, pZipped, (int)zippedSize);
 					}
 
 					delete []pZipped;
@@ -105,7 +105,7 @@ bool CClip_ImportExport::ImportFromSqliteDB(CppSQLite3DB &db, bool bAddToDB, boo
 				}
 			}
 
-			m_lImportCount++;
+			m_importCount++;
 
 			//If putting on the clipboard and there are multiple
 			//then append cf_text and cf_unicodetext
@@ -121,7 +121,7 @@ bool CClip_ImportExport::ImportFromSqliteDB(CppSQLite3DB &db, bool bAddToDB, boo
 		{
 			theApp.RefreshView();
 		}
-		else if(bRet && m_lImportCount == 1 && bPutOnClipboard)
+		else if(bRet && m_importCount == 1 && bPutOnClipboard)
 		{
 			PlaceFormatsOnclipboard();
 		}
@@ -180,8 +180,8 @@ bool CClip_ImportExport::PlaceFormatsOnclipboard()
 	{
 		EmptyClipboard();
 
-		int nFormatCount = m_Formats.GetSize();
-		for(int i = 0; i < nFormatCount; i++)
+		INT_PTR formatCount = m_Formats.GetSize();
+		for(int i = 0; i < formatCount; i++)
 		{
 			CClipFormat *pCF;
 			pCF = &m_Formats.ElementAt(i);
@@ -286,8 +286,8 @@ bool CClip_ImportExport::Append_CF_TEXT_AND_CF_UNICODETEXT(CStringA &csCF_TEXT,
 {
 	bool bRet = false;
 	CClipFormat *pCF;
-	int nCount = m_Formats.GetSize();
-	for(int i = 0; i < nCount; i++)
+	INT_PTR count = m_Formats.GetSize();
+	for(int i = 0; i < count; i++)
 	{
 		pCF = &m_Formats.ElementAt(i);
 

+ 1 - 1
Clip_ImportExport.h

@@ -10,7 +10,7 @@ public:
 	bool ExportToSqliteDB(CppSQLite3DB &m_db);
 	bool ImportFromSqliteDB(CppSQLite3DB &db, bool bAddToDB, bool bPutOnClipboard);
 	
-	long m_lImportCount;
+	int m_importCount;
 
 protected:
 	bool ImportFromSqliteV1(CppSQLite3DB &db, CppSQLite3Query &qMain);

+ 8 - 8
ClipboardSaveRestore.cpp

@@ -27,11 +27,11 @@ bool CClipboardSaveRestore::Save()
 			LPVOID pvData = GlobalLock(hGlobal);
 			if(pvData)
 			{
-				ULONG Size = GlobalSize(hGlobal);
-				if(Size > 0)
+				INT_PTR size = GlobalSize(hGlobal);
+				if(size > 0)
 				{
 					//Copy the data locally
-					cf.m_hgData = NewGlobalP(pvData, Size);	
+					cf.m_hgData = NewGlobalP(pvData, size);	
 					cf.m_cfType = nFormat;
 
 					m_Clipboard.Add(cf);
@@ -60,8 +60,8 @@ bool CClipboardSaveRestore::Restore()
 
 		SetClipboardData(theApp.m_cfIgnoreClipboard, NewGlobalP("Ignore", sizeof("Ignore")));
 
-		int nSize = m_Clipboard.GetSize();
-		for(int nPos = 0; nPos < nSize; nPos++)
+		INT_PTR size = m_Clipboard.GetSize();
+		for(int nPos = 0; nPos < size; nPos++)
 		{
 			CClipFormat *pCF = &m_Clipboard.ElementAt(nPos);
 			if(pCF && pCF->m_hgData)
@@ -95,10 +95,10 @@ bool CClipboardSaveRestore::RestoreTextOnly()
 
 		SetClipboardData(theApp.m_cfIgnoreClipboard, NewGlobalP("Ignore", sizeof("Ignore")));
 
-		int nSize = m_Clipboard.GetSize();
-		for(int nPos = 0; nPos < nSize; nPos++)
+		INT_PTR size = m_Clipboard.GetSize();
+		for(int pos = 0; pos < size; pos++)
 		{
-			CClipFormat *pCF = &m_Clipboard.ElementAt(nPos);
+			CClipFormat *pCF = &m_Clipboard.ElementAt(pos);
 			if(pCF && pCF->m_hgData)
 			{
 				if(pCF->m_cfType == CF_TEXT || pCF->m_cfType == CF_UNICODETEXT)

+ 1 - 1
ClipboardViewer.cpp

@@ -295,7 +295,7 @@ bool CClipboardViewer::ValidActiveWnd()
 	return true;
 }
 
-void CClipboardViewer::OnTimer(UINT nIDEvent) 
+void CClipboardViewer::OnTimer(UINT_PTR nIDEvent) 
 {
 	switch(nIDEvent)
 	{

+ 1 - 1
ClipboardViewer.h

@@ -56,7 +56,7 @@ protected:
 	afx_msg void OnDestroy();
 	afx_msg void OnChangeCbChain(HWND hWndRemove, HWND hWndAfter);
 	afx_msg void OnDrawClipboard();
-	afx_msg void OnTimer(UINT nIDEvent);
+	afx_msg void OnTimer(UINT_PTR nIDEvent);
 	//}}AFX_MSG
 	afx_msg LRESULT OnSetConnect(WPARAM wParam, LPARAM lParam);
 	DECLARE_MESSAGE_MAP()

+ 16 - 16
CopyProperties.cpp

@@ -120,7 +120,7 @@ void CCopyProperties::LoadDataFromCClip(CClip &Clip)
 	m_eDate = dtTime.Format();
 	m_RichEdit.SetText(Clip.m_Desc);
 
-	if(Clip.m_lDontAutoDelete)
+	if(Clip.m_dontAutoDelete)
 	{
 		m_bNeverAutoDelete = TRUE;
 	}
@@ -129,17 +129,17 @@ void CCopyProperties::LoadDataFromCClip(CClip &Clip)
 		m_bNeverAutoDelete = FALSE;
 	}
 
-	m_GroupCombo.SetCurSelOnItemData(Clip.m_lParent);
+	m_GroupCombo.SetCurSelOnItemData(Clip.m_parentId);
 
-	m_HotKey.SetHotKey(LOBYTE(Clip.m_lShortCut), HIBYTE(Clip.m_lShortCut));
+	m_HotKey.SetHotKey(LOBYTE(Clip.m_shortCut), HIBYTE(Clip.m_shortCut));
 	m_HotKey.SetRules(HKCOMB_A, 0);
 
 	m_QuickPasteText.SetWindowText(Clip.m_csQuickPaste);
 
 	CString cs;
 	CClipFormat* pCF;
-	int nCount = Clip.m_Formats.GetSize();
-	for(int i = 0; i < nCount; i++)
+	INT_PTR count = Clip.m_Formats.GetSize();
+	for(int i = 0; i < count; i++)
 	{
 		pCF = &Clip.m_Formats.GetData()[i];
 		if(pCF)
@@ -147,10 +147,10 @@ void CCopyProperties::LoadDataFromCClip(CClip &Clip)
 			cs.Format(_T("%s, %d"), GetFormatName(pCF->m_cfType), GlobalSize(pCF->m_hgData));
 			int nIndex = m_lCopyData.AddString(cs);
 			
-			if(m_lCopyID == -1 && pCF->m_lDBID == -1)
+			if(m_lCopyID == -1 && pCF->m_dbId == -1)
 				m_lCopyData.SetItemData(nIndex, i);
 			else
-				m_lCopyData.SetItemData(nIndex, pCF->m_lDBID);
+				m_lCopyData.SetItemData(nIndex, pCF->m_dbId);
 		}
 	}
 
@@ -197,8 +197,8 @@ void CCopyProperties::OnOK()
 			LoadDataIntoCClip(*m_pMemoryClip);
 
 			m_DeletedData.SortDescending();
-			int nCount = m_DeletedData.GetSize();
-			for(int i = 0; i < nCount; i++)
+			INT_PTR count = m_DeletedData.GetSize();
+			for(int i = 0; i < count; i++)
 			{
 				m_pMemoryClip->m_Formats.RemoveAt(m_DeletedData[i]);
 			}
@@ -228,12 +228,12 @@ void CCopyProperties::OnOK()
 
 void CCopyProperties::LoadDataIntoCClip(CClip &Clip)
 {
-	Clip.m_lShortCut = m_HotKey.GetHotKey();
+	Clip.m_shortCut = m_HotKey.GetHotKey();
 
 	//remove any others that have the same hot key
-	if(Clip.m_lShortCut > 0)
+	if(Clip.m_shortCut > 0)
 	{
-		theApp.m_db.execDMLEx(_T("UPDATE Main SET lShortCut = 0 where lShortCut = %d AND lID <> %d;"), Clip.m_lShortCut, m_lCopyID);
+		theApp.m_db.execDMLEx(_T("UPDATE Main SET lShortCut = 0 where lShortCut = %d AND lID <> %d;"), Clip.m_shortCut, m_lCopyID);
 	}
 
 	Clip.m_Desc = m_RichEdit.GetText();
@@ -249,17 +249,17 @@ void CCopyProperties::LoadDataIntoCClip(CClip &Clip)
 		theApp.m_db.execDMLEx(_T("UPDATE Main SET QuickPasteText = '' WHERE QuickPasteText = '%s' AND lID <> %d;"), Clip.m_csQuickPaste, m_lCopyID);
 	}
 
-	Clip.m_lParent = m_GroupCombo.GetItemDataFromCursel();
+	Clip.m_parentId = m_GroupCombo.GetItemDataFromCursel();
 
 	//If we are going from no group to a group or the
 	//don't auto delete check box is checked
 	if(m_bNeverAutoDelete)
 	{
-		Clip.m_lDontAutoDelete = (long)CTime::GetCurrentTime().GetTime();
+		Clip.m_dontAutoDelete = (long)CTime::GetCurrentTime().GetTime();
 	}
 	else if(m_bNeverAutoDelete == FALSE)
 	{
-		Clip.m_lDontAutoDelete = FALSE;
+		Clip.m_dontAutoDelete = FALSE;
 	}
 }
 
@@ -281,7 +281,7 @@ void CCopyProperties::OnDeleteCopyData()
 		for(int i = 0; i < nCount; i++)
 		{
 			int row = items[i];
-			m_DeletedData.Add(m_lCopyData.GetItemData(row));
+			m_DeletedData.Add((int)m_lCopyData.GetItemData(row));
 			m_lCopyData.DeleteString(row);
 
 			int newRow = row-1;

BIN
Debug/sqlite3.dll


BIN
Debug/zlib1.dll


+ 1 - 1
DialogResizer.cpp

@@ -63,7 +63,7 @@ void CDialogResizer::MoveControls(CSize csNewSize)
 
 	m_DlgSize = csNewSize;
 
-	int nCount = m_Controls.GetSize();
+	INT_PTR nCount = m_Controls.GetSize();
 	CRect rc;
 	CRect rcParent;
 

+ 1 - 1
DittoAddin.cpp

@@ -76,7 +76,7 @@ bool CDittoAddin::SupportedFunctions(const CDittoInfo &DittoInfo, FunctionType t
 		bRet = m_SupportedFunctions(DittoInfo, type, Functions);
 		if(bRet)
 		{
-			int nCount = Functions.size();
+			INT_PTR nCount = Functions.size();
 			for(int i = 0; i < nCount; i++)
 			{
 				CFunction func = Functions[i];

+ 12 - 12
DittoAddins.cpp

@@ -16,8 +16,8 @@ bool CDittoAddins::UnloadAll()
 {
 	Log(StrF(_T("Ditto Addin - Unloading all addins Count: %d"), m_Addins.size()));
 
-	int nCount = m_Addins.size();
-	for(int i = 0; i < nCount; i++)
+	INT_PTR count = m_Addins.size();
+	for(int i = 0; i < count; i++)
 	{
 		CDittoAddin *pAddin = m_Addins[i];
 		if(pAddin)
@@ -75,17 +75,17 @@ bool CDittoAddins::AddPrePasteAddinsToMenu(CMenu *pMenu)
 
 	HMENU AllAddinsMenu = ::CreateMenu();
 
-	int nCount = m_Addins.size();
-	for(int i = 0; i < nCount; i++)
+	INT_PTR count = m_Addins.size();
+	for(int i = 0; i < count; i++)
 	{
 		CDittoAddin *pAddin = m_Addins[i];
 		if(pAddin)
 		{
-			int nSubCount = pAddin->m_PrePasteFunctions.size();
-			if(nSubCount > 1)
+			INT_PTR subCount = pAddin->m_PrePasteFunctions.size();
+			if(subCount > 1)
 			{
 				HMENU AddinMenu = ::CreateMenu();
-				for(int x = 0; x < nSubCount; x++)
+				for(int x = 0; x < subCount; x++)
 				{
 					::AppendMenu(AddinMenu, MF_ENABLED, nMenuId, pAddin->m_PrePasteFunctions[x].m_csDisplayName);
 
@@ -99,7 +99,7 @@ bool CDittoAddins::AddPrePasteAddinsToMenu(CMenu *pMenu)
 				::AppendMenu(AllAddinsMenu, MF_ENABLED|MF_POPUP, (UINT)AddinMenu, pAddin->DisplayName());
 				bRet = true;
 			}
-			else if(nSubCount == 1)
+			else if(subCount == 1)
 			{
 				//If there is only 1 function for this add in then just show one menu with addin name - function
 				CFunctionLookup lookup;
@@ -152,8 +152,8 @@ void CDittoAddins::LoadDittoInfo(CDittoInfo &DittoInfo)
 
 void CDittoAddins::AboutScreenText(CStringArray &arr)
 {
-	int nCount = m_Addins.size();
-	for(int i = 0; i < nCount; i++)
+	INT_PTR count = m_Addins.size();
+	for(int i = 0; i < count; i++)
 	{
 		CDittoAddin *pAddin = m_Addins[i];
 		if(pAddin)
@@ -161,8 +161,8 @@ void CDittoAddins::AboutScreenText(CStringArray &arr)
 			CString csLine;
 			csLine.Format(_T("%s Ver: %d, Ver2: %d"), pAddin->DisplayName(), pAddin->Version(), pAddin->PrivateVersion());
 			arr.Add(csLine);
-			int nSubCount = pAddin->m_PrePasteFunctions.size();
-			for(int x = 0; x < nSubCount; x++)
+			INT_PTR subCount = pAddin->m_PrePasteFunctions.size();
+			for(int x = 0; x < subCount; x++)
 			{
 				CString csLine2;
 				csLine2.Format(_T("    %s (%s)"), pAddin->m_PrePasteFunctions[x].m_csDisplayName, pAddin->m_PrePasteFunctions[x].m_csDetailDescription);

+ 2 - 2
DittoRulerRichEditCtrl.cpp

@@ -149,7 +149,7 @@ int CDittoRulerRichEditCtrl::SaveToDB(BOOL bUpdateDesc)
 	try
 	{
 		CClip Clip;
-		Clip.m_ID = m_lID;
+		Clip.m_id = m_lID;
 		if(m_SaveTypes & stRTF)
 		{
 			LoadRTFData(Clip);
@@ -182,7 +182,7 @@ int CDittoRulerRichEditCtrl::SaveToDB(BOOL bUpdateDesc)
 			{
 				Clip.AddToDB();
 				m_csDescription = Clip.m_Desc;
-				m_lID = Clip.m_ID;
+				m_lID = Clip.m_id;
 				bUpdateDesc = TRUE;
 				bSetModifyToFalse = true;
 			}

BIN
DittoSetup/U3/device/zlib1.dll


+ 20 - 20
EditWnd.cpp

@@ -104,10 +104,10 @@ void CEditWnd::MoveControls()
 void CEditWnd::OnSaveAll() 
 {
 	BOOL bUpdateDesc = m_cbUpdateDescription.GetCheck();
-	int nSize = m_Edits.size();
-	for(int nTab = 0; nTab < nSize; nTab++)
+	INT_PTR size = m_Edits.size();
+	for(int tab = 0; tab < size; tab++)
 	{
-		DoSaveItem(nTab);
+		DoSaveItem(tab);
 	}
 }
 
@@ -128,12 +128,12 @@ bool CEditWnd::DoSave()
 	return bRet;
 }
 
-bool CEditWnd::DoSaveItem(long lIndex)
+bool CEditWnd::DoSaveItem(int index)
 {
 	bool bRet = false;
 	BOOL bUpdateDesc = m_cbUpdateDescription.GetCheck();
 
-	CDittoRulerRichEditCtrl *pEdit = m_Edits[lIndex];
+	CDittoRulerRichEditCtrl *pEdit = m_Edits[index];
 	if(pEdit)
 	{
 		int nRet = pEdit->SaveToDB(bUpdateDesc);
@@ -141,7 +141,7 @@ bool CEditWnd::DoSaveItem(long lIndex)
 		{
 			if(bUpdateDesc)
 			{
-				m_Tabs.SetTabTitle(lIndex, pEdit->GetDesc());
+				m_Tabs.SetTabTitle(index, pEdit->GetDesc());
 			}
 
 			if(nRet == SAVED_CLIP_TO_DB)
@@ -160,7 +160,7 @@ bool CEditWnd::DoSaveItem(long lIndex)
 		else
 		{
 			CString cs;
-			cs.Format(_T("%s '%s'"), theApp.m_Language.GetString("ErrorSaving", "Error saving clip"), m_Tabs.GetTabTitle(lIndex));
+			cs.Format(_T("%s '%s'"), theApp.m_Language.GetString("ErrorSaving", "Error saving clip"), m_Tabs.GetTabTitle(index));
 			MessageBox(cs, _T("Ditto"), MB_OK);
 		}
 	}
@@ -170,8 +170,8 @@ bool CEditWnd::DoSaveItem(long lIndex)
 
 bool CEditWnd::EditIds(CClipIDs &Ids)
 {
-	int nCount = min(Ids.GetSize(), 10);
-	for(int i = 0; i < nCount; i++)
+	INT_PTR count = min(Ids.GetSize(), 10);
+	for(int i = 0; i < count; i++)
 	{
 		if(IsIDAlreadyInEdit(Ids[i], true) < 0)
 		{
@@ -184,7 +184,7 @@ bool CEditWnd::EditIds(CClipIDs &Ids)
 	return true;
 }
 
-bool CEditWnd::AddItem(long lID)
+bool CEditWnd::AddItem(int id)
 {
 	bool bRet = false;
 	CDittoRulerRichEditCtrl *pEdit = new CDittoRulerRichEditCtrl;
@@ -192,11 +192,11 @@ bool CEditWnd::AddItem(long lID)
 	{
 		CString csTitle;
 
-		if(lID >= 0)
+		if(id >= 0)
 		{
 			try
 			{				
-				CppSQLite3Query q = theApp.m_db.execQueryEx(_T("SELECT mText FROM Main where lID = %d"), lID);
+				CppSQLite3Query q = theApp.m_db.execQueryEx(_T("SELECT mText FROM Main where lID = %d"), id);
 				if(q.eof() == false)
 				{
 					csTitle = q.getStringField(_T("mText"));
@@ -213,7 +213,7 @@ bool CEditWnd::AddItem(long lID)
 		pEdit->Create(WS_TABSTOP|WS_CHILD|WS_VISIBLE, CRect(100, 100, 105, 105), this, 100, TRUE);
 		pEdit->ShowRuler();
 		pEdit->ShowToolbar();
-		pEdit->LoadItem(lID, csTitle);		
+		pEdit->LoadItem(id, csTitle);		
 
 		m_Tabs.AddItem(csTitle, pEdit);
 		int nTab = m_Tabs.GetTabCount();
@@ -227,21 +227,21 @@ bool CEditWnd::AddItem(long lID)
 
 }
 
-long CEditWnd::IsIDAlreadyInEdit(long lID, bool bSetFocus)
+int CEditWnd::IsIDAlreadyInEdit(int id, bool bSetFocus)
 {
-	int nSize = m_Edits.size();
-	for(int i = 0; i < nSize; i++)
+	INT_PTR size = m_Edits.size();
+	for(int i = 0; i < size; i++)
 	{
 		CDittoRulerRichEditCtrl *pEdit = m_Edits[i];
 		if(pEdit)
 		{
-			if(pEdit->GetDBID() == lID)
+			if(pEdit->GetDBID() == id)
 			{
 				if(bSetFocus)
 				{
 					m_Tabs.SetActiveTab(i);
 				}
-				return i;
+				return (int)i;
 			}
 		}
 	}
@@ -252,8 +252,8 @@ void CEditWnd::OnDestroy()
 {
 	CWnd::OnDestroy();
 
-	int nSize = m_Edits.size();
-	for(int i = 0; i < nSize; i++)
+	INT_PTR size = m_Edits.size();
+	for(int i = 0; i < size; i++)
 	{
 		CDittoRulerRichEditCtrl *pEdit = m_Edits[i];
 		if(pEdit)

+ 3 - 3
EditWnd.h

@@ -28,10 +28,10 @@ protected:
 
 protected:
 	void MoveControls();
-	long IsIDAlreadyInEdit(long lID, bool bSetFocus);
-	bool AddItem(long lID);
+	int IsIDAlreadyInEdit(int id, bool bSetFocus);
+	bool AddItem(int id);
 	bool DoSave();
-	bool DoSaveItem(long lIndex);
+	bool DoSaveItem(int index);
 
 public:
 	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);

+ 0 - 477
EncryptDecrypt/EncryptDecrypt.vcproj

@@ -1,477 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="7.10"
-	Name="EncryptDecrypt"
-	ProjectGUID="{F08A8736-1116-4166-AF88-CF533E41E958}">
-	<Platforms>
-		<Platform
-			Name="Win32"/>
-	</Platforms>
-	<ToolFiles>
-	</ToolFiles>
-	<Configurations>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory=".\Release"
-			IntermediateDirectory=".\Release"
-			ConfigurationType="4"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
-			UseOfMFC="2"
-			ATLMinimizesCRunTimeLibraryUsage="false"
-			CharacterSet="2">
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCMIDLTool"/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="2"
-				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="EncrypDecrypt"
-				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS"
-				StringPooling="true"
-				RuntimeLibrary="2"
-				EnableFunctionLevelLinking="true"
-				UsePrecompiledHeader="2"
-				PrecompiledHeaderThrough="stdafx.h"
-				PrecompiledHeaderFile=".\Release/EncryptDecrypt.pch"
-				AssemblerListingLocation=".\Release/"
-				ObjectFile=".\Release/"
-				ProgramDataBaseFileName=".\Release/"
-				WarningLevel="3"
-				SuppressStartupBanner="true"/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="NDEBUG"
-				Culture="1033"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCLibrarianTool"
-				OutputFile=".\Release\EncryptDecrypt.lib"
-				SuppressStartupBanner="true"/>
-			<Tool
-				Name="VCALinkTool"/>
-			<Tool
-				Name="VCXDCMakeTool"/>
-			<Tool
-				Name="VCBscMakeTool"
-				SuppressStartupBanner="true"
-				OutputFile=".\Release/EncryptDecrypt.bsc"/>
-			<Tool
-				Name="VCFxCopTool"/>
-			<Tool
-				Name="VCPostBuildEventTool"
-				CommandLine="copy    $(OutDir)\*.lib    ..\"/>
-		</Configuration>
-		<Configuration
-			Name="Unicode Debug|Win32"
-			OutputDirectory=".\EncryptDecrypt___Win32_Unicode_Debug"
-			IntermediateDirectory=".\EncryptDecrypt___Win32_Unicode_Debug"
-			ConfigurationType="4"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
-			UseOfMFC="2"
-			ATLMinimizesCRunTimeLibraryUsage="false"
-			CharacterSet="1">
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCMIDLTool"/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_MBCS;UNICODE"
-				MinimalRebuild="true"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="3"
-				UsePrecompiledHeader="2"
-				PrecompiledHeaderThrough="stdafx.h"
-				PrecompiledHeaderFile=".\EncryptDecrypt___Win32_Unicode_Debug/EncryptDecrypt.pch"
-				AssemblerListingLocation=".\EncryptDecrypt___Win32_Unicode_Debug/"
-				ObjectFile=".\EncryptDecrypt___Win32_Unicode_Debug/"
-				ProgramDataBaseFileName=".\EncryptDecrypt___Win32_Unicode_Debug/"
-				WarningLevel="3"
-				SuppressStartupBanner="true"
-				DebugInformationFormat="4"/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="_DEBUG"
-				Culture="1033"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCLibrarianTool"
-				OutputFile="EncryptDecrypt___Win32_Unicode_Debug\UEncryptDecryptD.lib"
-				SuppressStartupBanner="true"/>
-			<Tool
-				Name="VCALinkTool"/>
-			<Tool
-				Name="VCXDCMakeTool"/>
-			<Tool
-				Name="VCBscMakeTool"
-				SuppressStartupBanner="true"
-				OutputFile=".\EncryptDecrypt___Win32_Unicode_Debug/EncryptDecrypt.bsc"/>
-			<Tool
-				Name="VCFxCopTool"/>
-			<Tool
-				Name="VCPostBuildEventTool"
-				CommandLine="copy    $(OutDir)\*.lib    ..\"/>
-		</Configuration>
-		<Configuration
-			Name="Unicode Release|Win32"
-			OutputDirectory=".\EncryptDecrypt___Win32_Unicode_Release"
-			IntermediateDirectory=".\EncryptDecrypt___Win32_Unicode_Release"
-			ConfigurationType="4"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
-			UseOfMFC="2"
-			ATLMinimizesCRunTimeLibraryUsage="false"
-			CharacterSet="1">
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCMIDLTool"/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="2"
-				InlineFunctionExpansion="1"
-				AdditionalIncludeDirectories="EncrypDecrypt"
-				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_MBCS;UNICODE"
-				StringPooling="true"
-				RuntimeLibrary="2"
-				EnableFunctionLevelLinking="true"
-				UsePrecompiledHeader="2"
-				PrecompiledHeaderThrough="stdafx.h"
-				PrecompiledHeaderFile=".\EncryptDecrypt___Win32_Unicode_Release/EncryptDecrypt.pch"
-				AssemblerListingLocation=".\EncryptDecrypt___Win32_Unicode_Release/"
-				ObjectFile=".\EncryptDecrypt___Win32_Unicode_Release/"
-				ProgramDataBaseFileName=".\EncryptDecrypt___Win32_Unicode_Release/"
-				WarningLevel="3"
-				SuppressStartupBanner="true"/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="NDEBUG"
-				Culture="1033"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCLibrarianTool"
-				OutputFile="EncryptDecrypt___Win32_Unicode_Release\UEncryptDecrypt.lib"
-				SuppressStartupBanner="true"/>
-			<Tool
-				Name="VCALinkTool"/>
-			<Tool
-				Name="VCXDCMakeTool"/>
-			<Tool
-				Name="VCBscMakeTool"
-				SuppressStartupBanner="true"
-				OutputFile=".\EncryptDecrypt___Win32_Unicode_Release/EncryptDecrypt.bsc"/>
-			<Tool
-				Name="VCFxCopTool"/>
-			<Tool
-				Name="VCPostBuildEventTool"
-				CommandLine="copy    $(OutDir)\*.lib    ..\"/>
-		</Configuration>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory=".\Debug"
-			IntermediateDirectory=".\Debug"
-			ConfigurationType="4"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
-			UseOfMFC="2"
-			ATLMinimizesCRunTimeLibraryUsage="false"
-			CharacterSet="2">
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCMIDLTool"/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS"
-				MinimalRebuild="true"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="3"
-				UsePrecompiledHeader="2"
-				PrecompiledHeaderThrough="stdafx.h"
-				PrecompiledHeaderFile=".\Debug/EncryptDecrypt.pch"
-				AssemblerListingLocation=".\Debug/"
-				ObjectFile=".\Debug/"
-				ProgramDataBaseFileName=".\Debug/"
-				WarningLevel="3"
-				SuppressStartupBanner="true"
-				DebugInformationFormat="4"/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="_DEBUG"
-				Culture="1033"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCLibrarianTool"
-				OutputFile="Debug\EncryptDecryptD.lib"
-				SuppressStartupBanner="true"/>
-			<Tool
-				Name="VCALinkTool"/>
-			<Tool
-				Name="VCXDCMakeTool"/>
-			<Tool
-				Name="VCBscMakeTool"
-				SuppressStartupBanner="true"
-				OutputFile=".\Debug/EncryptDecrypt.bsc"/>
-			<Tool
-				Name="VCFxCopTool"/>
-			<Tool
-				Name="VCPostBuildEventTool"
-				CommandLine="copy    $(OutDir)\*.lib    ..\"/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="Source Files"
-			Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
-			<File
-				RelativePath="Encryption.cpp">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="MemUtil.cpp">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="NewRandom.cpp">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="rijndael.cpp">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="sha2.cpp">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-			</File>
-			<File
-				RelativePath="StdAfx.cpp">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						UsePrecompiledHeader="1"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						PreprocessorDefinitions=""
-						UsePrecompiledHeader="1"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Unicode Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						AdditionalIncludeDirectories=""
-						PreprocessorDefinitions=""
-						UsePrecompiledHeader="1"/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						PreprocessorDefinitions=""
-						UsePrecompiledHeader="1"/>
-				</FileConfiguration>
-			</File>
-		</Filter>
-		<Filter
-			Name="Header Files"
-			Filter="h;hpp;hxx;hm;inl">
-			<File
-				RelativePath="Encryption.h">
-			</File>
-			<File
-				RelativePath="IEncryption.h">
-			</File>
-			<File
-				RelativePath="MemUtil.h">
-			</File>
-			<File
-				RelativePath="NewRandom.h">
-			</File>
-			<File
-				RelativePath="rijndael.h">
-			</File>
-			<File
-				RelativePath="sha2.h">
-			</File>
-			<File
-				RelativePath="StdAfx.h">
-			</File>
-		</Filter>
-		<File
-			RelativePath="Readme.txt">
-		</File>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>

+ 92 - 111
EncryptDecrypt/EncryptDecrypt.vcxproj

@@ -5,129 +5,94 @@
       <Configuration>Debug</Configuration>
       <Platform>Win32</Platform>
     </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
     <ProjectConfiguration Include="Release|Win32">
       <Configuration>Release</Configuration>
       <Platform>Win32</Platform>
     </ProjectConfiguration>
-    <ProjectConfiguration Include="Unicode Debug|Win32">
-      <Configuration>Unicode Debug</Configuration>
-      <Platform>Win32</Platform>
-    </ProjectConfiguration>
-    <ProjectConfiguration Include="Unicode Release|Win32">
-      <Configuration>Unicode Release</Configuration>
-      <Platform>Win32</Platform>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
     </ProjectConfiguration>
   </ItemGroup>
   <PropertyGroup Label="Globals">
     <ProjectGuid>{F08A8736-1116-4166-AF88-CF533E41E958}</ProjectGuid>
   </PropertyGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" />
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
     <ConfigurationType>StaticLibrary</ConfigurationType>
     <UseOfMfc>Dynamic</UseOfMfc>
-    <CharacterSet>MultiByte</CharacterSet>
+    <CharacterSet>Unicode</CharacterSet>
   </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Release|Win32'" Label="Configuration">
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
     <ConfigurationType>StaticLibrary</ConfigurationType>
     <UseOfMfc>Dynamic</UseOfMfc>
     <CharacterSet>Unicode</CharacterSet>
   </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|Win32'" Label="Configuration">
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
     <ConfigurationType>StaticLibrary</ConfigurationType>
     <UseOfMfc>Dynamic</UseOfMfc>
     <CharacterSet>Unicode</CharacterSet>
   </PropertyGroup>
-  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
     <ConfigurationType>StaticLibrary</ConfigurationType>
     <UseOfMfc>Dynamic</UseOfMfc>
-    <CharacterSet>MultiByte</CharacterSet>
+    <CharacterSet>Unicode</CharacterSet>
   </PropertyGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   <ImportGroup Label="ExtensionSettings">
   </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
     <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
   </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Release|Win32'" Label="PropertySheets">
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
     <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
   </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|Win32'" Label="PropertySheets">
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
     <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
   </ImportGroup>
-  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
     <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
   </ImportGroup>
   <PropertyGroup Label="UserMacros" />
   <PropertyGroup>
     <_ProjectFileVersion>10.0.21006.1</_ProjectFileVersion>
-    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\Release\</OutDir>
-    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\Release\</IntDir>
-    <OutDir Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|Win32'">.\EncryptDecrypt___Win32_Unicode_Debug\</OutDir>
-    <IntDir Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|Win32'">.\EncryptDecrypt___Win32_Unicode_Debug\</IntDir>
-    <OutDir Condition="'$(Configuration)|$(Platform)'=='Unicode Release|Win32'">.\EncryptDecrypt___Win32_Unicode_Release\</OutDir>
-    <IntDir Condition="'$(Configuration)|$(Platform)'=='Unicode Release|Win32'">.\EncryptDecrypt___Win32_Unicode_Release\</IntDir>
-    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\Debug\</OutDir>
-    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\Debug\</IntDir>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\EncryptDecrypt___Win32_Unicode_Debug\</OutDir>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">.\EncryptDecrypt___Win64_Debug\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\EncryptDecrypt___Win32_Unicode_Debug\</IntDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">.\EncryptDecrypt___Win64__Debug\</IntDir>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\EncryptDecrypt___Win32_Unicode_Release\</OutDir>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.\EncryptDecrypt___Win64_Release\</OutDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\EncryptDecrypt___Win32_Unicode_Release\</IntDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.\EncryptDecrypt___Win64_Release\</IntDir>
     <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
+    <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
     <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
+    <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
     <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
+    <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
     <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
+    <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
     <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
+    <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
     <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
-    <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
-    <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|Win32'" />
-    <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|Win32'" />
-    <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Unicode Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
-    <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Unicode Release|Win32'" />
-    <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Unicode Release|Win32'" />
-    <TargetName Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|Win32'">UEncryptDecryptD</TargetName>
+    <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
     <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">EncryptDecryptD</TargetName>
-    <TargetName Condition="'$(Configuration)|$(Platform)'=='Unicode Release|Win32'">UEncryptDecrypt</TargetName>
+    <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">EncryptDecryptD64</TargetName>
+    <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">EncryptDecrypt</TargetName>
+    <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">EncryptDecrypt64</TargetName>
   </PropertyGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
-    <ClCompile>
-      <Optimization>MaxSpeed</Optimization>
-      <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
-      <AdditionalIncludeDirectories>EncrypDecrypt;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <StringPooling>true</StringPooling>
-      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
-      <FunctionLevelLinking>true</FunctionLevelLinking>
-      <PrecompiledHeader>
-      </PrecompiledHeader>
-      <PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
-      <PrecompiledHeaderOutputFile>.\Release/EncryptDecrypt.pch</PrecompiledHeaderOutputFile>
-      <AssemblerListingLocation>.\Release/</AssemblerListingLocation>
-      <ObjectFileName>.\Release/</ObjectFileName>
-      <ProgramDataBaseFileName>.\Release/</ProgramDataBaseFileName>
-      <WarningLevel>Level3</WarningLevel>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
-    </ClCompile>
-    <ResourceCompile>
-      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <Culture>0x0409</Culture>
-    </ResourceCompile>
-    <Lib>
-      <OutputFile>.\Release\EncryptDecrypt.lib</OutputFile>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
-    </Lib>
-    <Bscmake>
-      <SuppressStartupBanner>true</SuppressStartupBanner>
-      <OutputFile>.\Release/EncryptDecrypt.bsc</OutputFile>
-    </Bscmake>
-    <PostBuildEvent>
-      <Command>copy $(TargetDir)*.lib ..\</Command>
-    </PostBuildEvent>
-  </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|Win32'">
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <ClCompile>
       <Optimization>Disabled</Optimization>
       <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_MBCS;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
       <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
       <PrecompiledHeader>
@@ -139,25 +104,26 @@
       <ProgramDataBaseFileName>.\EncryptDecrypt___Win32_Unicode_Debug/</ProgramDataBaseFileName>
       <WarningLevel>Level3</WarningLevel>
       <SuppressStartupBanner>true</SuppressStartupBanner>
-      <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
     </ClCompile>
     <ResourceCompile>
       <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <Culture>0x0409</Culture>
     </ResourceCompile>
     <Lib>
-      <OutputFile>EncryptDecrypt___Win32_Unicode_Debug\UEncryptDecryptD.lib</OutputFile>
+      <OutputFile>EncryptDecrypt___Win32_Unicode_Debug\EncryptDecryptD64.lib</OutputFile>
       <SuppressStartupBanner>true</SuppressStartupBanner>
+      <TargetMachine>MachineX86</TargetMachine>
     </Lib>
     <Bscmake>
       <SuppressStartupBanner>true</SuppressStartupBanner>
       <OutputFile>.\EncryptDecrypt___Win32_Unicode_Debug/EncryptDecrypt.bsc</OutputFile>
     </Bscmake>
     <PostBuildEvent>
-      <Command>copy $(TargetDir)*.lib ..\</Command>
+      <Command>copy $(TargetDir)*.lib $(TargetDir)..\..\</Command>
     </PostBuildEvent>
   </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Unicode Release|Win32'">
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
     <ClCompile>
       <Optimization>MaxSpeed</Optimization>
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
@@ -181,103 +147,118 @@
       <Culture>0x0409</Culture>
     </ResourceCompile>
     <Lib>
-      <OutputFile>EncryptDecrypt___Win32_Unicode_Release\UEncryptDecrypt.lib</OutputFile>
+      <OutputFile>EncryptDecrypt___Win32_Unicode_Release\EncryptDecrypt.lib</OutputFile>
       <SuppressStartupBanner>true</SuppressStartupBanner>
+      <TargetMachine>MachineX86</TargetMachine>
     </Lib>
     <Bscmake>
       <SuppressStartupBanner>true</SuppressStartupBanner>
       <OutputFile>.\EncryptDecrypt___Win32_Unicode_Release/EncryptDecrypt.bsc</OutputFile>
     </Bscmake>
     <PostBuildEvent>
-      <Command>copy $(TargetDir)*.lib ..\</Command>
+      <Command>copy $(TargetDir)*.lib $(TargetDir)..\..\</Command>
     </PostBuildEvent>
   </ItemDefinitionGroup>
-  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
     <ClCompile>
-      <Optimization>Disabled</Optimization>
-      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <MinimalRebuild>true</MinimalRebuild>
-      <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
-      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <Optimization>MaxSpeed</Optimization>
+      <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
+      <AdditionalIncludeDirectories>EncrypDecrypt;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_MBCS;UNICODE;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <StringPooling>true</StringPooling>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
       <PrecompiledHeader>
       </PrecompiledHeader>
       <PrecompiledHeaderFile>stdafx.h</PrecompiledHeaderFile>
-      <PrecompiledHeaderOutputFile>.\Debug/EncryptDecrypt.pch</PrecompiledHeaderOutputFile>
-      <AssemblerListingLocation>.\Debug/</AssemblerListingLocation>
-      <ObjectFileName>.\Debug/</ObjectFileName>
-      <ProgramDataBaseFileName>.\Debug/</ProgramDataBaseFileName>
+      <PrecompiledHeaderOutputFile>.\EncryptDecrypt___Win64_Release/EncryptDecrypt.pch</PrecompiledHeaderOutputFile>
+      <AssemblerListingLocation>.\EncryptDecrypt___Win64_Release/</AssemblerListingLocation>
+      <ObjectFileName>.\EncryptDecrypt___Win64_Release/</ObjectFileName>
+      <ProgramDataBaseFileName>.\EncryptDecrypt___Win64__Release/</ProgramDataBaseFileName>
       <WarningLevel>Level3</WarningLevel>
       <SuppressStartupBanner>true</SuppressStartupBanner>
-      <DebugInformationFormat>EditAndContinue</DebugInformationFormat>
     </ClCompile>
     <ResourceCompile>
-      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <Culture>0x0409</Culture>
     </ResourceCompile>
     <Lib>
-      <OutputFile>Debug\EncryptDecryptD.lib</OutputFile>
+      <OutputFile>EncryptDecrypt___Win32_Unicode_Release\EncryptDecrypt64.lib</OutputFile>
       <SuppressStartupBanner>true</SuppressStartupBanner>
+      <TargetMachine>MachineX64</TargetMachine>
     </Lib>
     <Bscmake>
       <SuppressStartupBanner>true</SuppressStartupBanner>
-      <OutputFile>.\Debug/EncryptDecrypt.bsc</OutputFile>
+      <OutputFile>.\EncryptDecrypt___Win32_Unicode_Release/EncryptDecrypt.bsc</OutputFile>
     </Bscmake>
     <PostBuildEvent>
-      <Command>copy $(TargetDir)*.lib ..\</Command>
+      <Command>copy $(TargetDir)*.lib $(TargetDir)..\..\</Command>
     </PostBuildEvent>
   </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <ClCompile>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+    </ClCompile>
+    <PostBuildEvent>
+      <Command>copy $(TargetDir)*.lib $(TargetDir)..\..\</Command>
+    </PostBuildEvent>
+    <Lib>
+      <TargetMachine>MachineX64</TargetMachine>
+    </Lib>
+  </ItemDefinitionGroup>
   <ItemGroup>
     <ClCompile Include="Encryption.cpp">
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Unicode Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Unicode Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
     <ClCompile Include="MemUtil.cpp">
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Unicode Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Unicode Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
     <ClCompile Include="NewRandom.cpp">
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Unicode Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Unicode Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
     <ClCompile Include="rijndael.cpp">
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Unicode Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Unicode Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
     <ClCompile Include="sha2.cpp">
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Unicode Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Unicode Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
     </ClCompile>
     <ClCompile Include="StdAfx.cpp">
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
       <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Unicode Debug|Win32'">Create</PrecompiledHeader>
-      <AdditionalIncludeDirectories Condition="'$(Configuration)|$(Platform)'=='Unicode Release|Win32'">%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
-      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Unicode Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
-      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Unicode Release|Win32'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
     </ClCompile>
   </ItemGroup>
   <ItemGroup>

+ 2 - 2
EncryptDecrypt/Encryption.cpp

@@ -68,7 +68,7 @@ bool CEncryption::Encrypt(const unsigned char* pInput, int nLenInput, const char
 		m_random.GetRandomBuffer(hdr.aMasterSeed2, 32);
 
 		// Create MasterKey by hashing szPassword
-		uKeyLen = strlen(szPassword);
+		uKeyLen = (unsigned long)strlen(szPassword);
 		ASSERT(0 != uKeyLen);
 		if(0 != uKeyLen)
 		{
@@ -172,7 +172,7 @@ bool CEncryption::Decrypt(const unsigned char* pInput, int nLenInput, const char
 			if(NULL != pOutput)
 			{
 				memset(pOutput, 0, nLenInput);
-				unsigned long uKeyLen = strlen(szPassword);
+				unsigned long uKeyLen = (unsigned long)strlen(szPassword);
 
 				// Create MasterKey by hashing szPassword
 				ASSERT(0 != uKeyLen);

+ 17 - 17
EncryptDecrypt/sha2.cpp

@@ -128,26 +128,26 @@ extern "C"
 #define BRG_LITTLE_ENDIAN   1234 /* byte 0 is least significant (i386) */
 #define BRG_BIG_ENDIAN      4321 /* byte 0 is most significant (mc68k) */
 
-#if defined( __alpha__ ) || defined( __alpha ) || defined( i386 )       ||   \
-    defined( __i386__ )  || defined( _M_I86 )  || defined( _M_IX86 )    ||   \
-    defined( __OS2__ )   || defined( sun386 )  || defined( __TURBOC__ ) ||   \
-    defined( vax )       || defined( vms )     || defined( VMS )        ||   \
-    defined( __VMS )     || defined( _WIN32_WCE )
+//#if defined( __alpha__ ) || defined( __alpha ) || defined( i386 )       ||   \
+//    defined( __i386__ )  || defined( _M_I86 )  || defined( _M_IX86 )    ||   \
+//    defined( __OS2__ )   || defined( sun386 )  || defined( __TURBOC__ ) ||   \
+//    defined( vax )       || defined( vms )     || defined( VMS )        ||   \
+//    defined( __VMS )     || defined( _WIN32_WCE )
 
 #define PLATFORM_BYTE_ORDER BRG_LITTLE_ENDIAN
 
-#endif
-
-#if defined( AMIGA )    || defined( applec )  || defined( __AS400__ )  ||   \
-    defined( _CRAY )    || defined( __hppa )  || defined( __hp9000 )   ||   \
-    defined( ibm370 )   || defined( mc68000 ) || defined( m68k )       ||   \
-    defined( __MRC__ )  || defined( __MVS__ ) || defined( __MWERKS__ ) ||   \
-    defined( sparc )    || defined( __sparc)  || defined( SYMANTEC_C ) ||   \
-    defined( __TANDEM ) || defined( THINK_C ) || defined( __VMCMS__ )
-    
-#define PLATFORM_BYTE_ORDER BRG_BIG_ENDIAN
-
-#endif
+//#endif
+//
+//#if defined( AMIGA )    || defined( applec )  || defined( __AS400__ )  ||   \
+//    defined( _CRAY )    || defined( __hppa )  || defined( __hp9000 )   ||   \
+//    defined( ibm370 )   || defined( mc68000 ) || defined( m68k )       ||   \
+//    defined( __MRC__ )  || defined( __MVS__ ) || defined( __MWERKS__ ) ||   \
+//    defined( sparc )    || defined( __sparc)  || defined( SYMANTEC_C ) ||   \
+//    defined( __TANDEM ) || defined( THINK_C ) || defined( __VMCMS__ )
+//    
+//#define PLATFORM_BYTE_ORDER BRG_BIG_ENDIAN
+//
+//#endif
 
 /*  if the platform is still not known, try to find its byte order  */
 /*  from commonly used definitions in the headers included earlier  */

BIN
EncryptDecryptD.lib


+ 1 - 1
EventThread.cpp

@@ -130,7 +130,7 @@ void CEventThread::RunThread()
 
 	while(true)
 	{
-		DWORD event = WaitForMultipleObjects(m_eventMap.size(), pHandleArray, FALSE, m_waitTimeout);
+		DWORD event = WaitForMultipleObjects((DWORD)m_eventMap.size(), pHandleArray, FALSE, m_waitTimeout);
 
 		if(event == WAIT_FAILED)
 		{

+ 1 - 1
FileRecieve.cpp

@@ -204,7 +204,7 @@ long CFileRecieve::RecieveFileData(ULONG lFileSize, CString csFileName)
 
 HGLOBAL CFileRecieve::CreateCF_HDROPBuffer()
 {
-	int nFileArraySize = m_RecievedFiles.GetSize();
+	int nFileArraySize = (int)m_RecievedFiles.GetSize();
 	if(nFileArraySize <= 0)
 	{
 		LogSendRecieveInfo(_T("Recieved files array is empty not creating cf_hdrop structure"));

+ 1 - 1
FileSend.cpp

@@ -66,7 +66,7 @@ BOOL CFileSend::SendClientFiles(SOCKET sock, CClipList *pClipList)
 		GlobalUnlock(pFormat->m_hgData);
 	}
 
-	Info.m_lParameter1 = CopyFiles.GetSize();
+	Info.m_lParameter1 = (long)CopyFiles.GetSize();
 	if(Info.m_lParameter1 > 0)
 	{
 		if(m_Send.SendCSendData(Info, MyEnums::START))

+ 5 - 3
FormattedTextDraw.cpp

@@ -9,7 +9,7 @@
 /////////////////////////////////////////////////////////////////////////////
 // CallBack functions
 
-DWORD CALLBACK EditStreamInCallback(DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)
+DWORD CALLBACK EditStreamInCallback(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)
 {
 	PCOOKIE pCookie = (PCOOKIE) dwCookie;
 
@@ -423,15 +423,17 @@ HRESULT CFormattedTextDraw::InitDefaultParaFormat()
 
 HRESULT CFormattedTextDraw::CreateTextServicesObject()
 {
-	HRESULT hr;
+	HRESULT hr = S_OK;
+	
+#ifdef _M_IX86
 	IUnknown *spUnk;
-
 	hr = CreateTextServices(NULL, static_cast<ITextHost*>(this), &spUnk);
 	if (hr == S_OK) {
 		hr = spUnk->QueryInterface(IID_ITextServicesEx, (void**)&m_spTextServices);
 		hr = spUnk->QueryInterface(IID_ITextDocument, (void**)&m_spTextDocument);
 		spUnk->Release();
 	}
+#endif
 	return hr;
 }
 

+ 13 - 13
GroupTree.cpp

@@ -17,7 +17,7 @@ static char THIS_FILE[] = __FILE__;
 CGroupTree::CGroupTree()
 {
 	m_bHide = true;
-	m_lSelectedFolderID = -1;
+	m_selectedFolderID = -1;
 	m_bSendAllready = false;
 }
 
@@ -79,18 +79,18 @@ void CGroupTree::FillTree()
 
 	SetItemState(hItem, TVIS_EXPANDED, TVIS_EXPANDED);
 
-	if(m_lSelectedFolderID < 0)
+	if(m_selectedFolderID < 0)
 		SelectItem(hItem);
 	
 	FillTree(-1, hItem);
 }
 
 
-void CGroupTree::FillTree(long lParentID, HTREEITEM hParent)
+void CGroupTree::FillTree(int parentID, HTREEITEM hParent)
 {	
 	try
 	{
-		CppSQLite3Query q = theApp.m_db.execQueryEx(_T("SELECT lID, mText FROM Main WHERE bIsGroup = 1 AND lParentID = %d"), lParentID);
+		CppSQLite3Query q = theApp.m_db.execQueryEx(_T("SELECT lID, mText FROM Main WHERE bIsGroup = 1 AND lParentID = %d"), parentID);
 			
 		if(q.eof() == false)
 		{
@@ -98,7 +98,7 @@ void CGroupTree::FillTree(long lParentID, HTREEITEM hParent)
 
 			while(!q.eof())
 			{
-				if(q.getIntField(_T("lID")) == m_lSelectedFolderID)
+				if(q.getIntField(_T("lID")) == m_selectedFolderID)
 				{
 					hItem = InsertItem(q.getStringField(_T("mText")), 1, 1, hParent);
 					SelectItem(hItem);
@@ -154,16 +154,16 @@ void CGroupTree::OnDblclk(NMHDR* pNMHDR, LRESULT* pResult)
 {
 	HTREEITEM hItem =  GetNextItem(TVI_ROOT, TVGN_CARET);
 	if(hItem)
-		SendToParent(GetItemData(hItem));
+		SendToParent((int)GetItemData(hItem));
 			
 	*pResult = 1;
 }
 
-long CGroupTree::GetSelectedTree()
+int CGroupTree::GetSelectedTree()
 {
 	HTREEITEM hItem =  GetNextItem(TVI_ROOT, TVGN_CARET);
 	if(hItem)
-		return (long)GetItemData(hItem);
+		return (int)GetItemData(hItem);
 
 	return -1;
 }
@@ -178,7 +178,7 @@ void CGroupTree::OnKeydown(NMHDR* pNMHDR, LRESULT* pResult)
 	{	
 		HTREEITEM hItem =  GetNextItem(TVI_ROOT, TVGN_CARET);
 		if(hItem)
-			SendToParent(GetItemData(hItem));
+			SendToParent((int)GetItemData(hItem));
 		
 		break;
 	}
@@ -193,16 +193,16 @@ void CGroupTree::OnKeydown(NMHDR* pNMHDR, LRESULT* pResult)
 }
 
 
-void CGroupTree::SendToParent(long lID)
+void CGroupTree::SendToParent(int parentId)
 {
 	if(m_bSendAllready == false)
 	{
 		m_bSendAllready = true;
-		::PostMessage(m_NotificationWnd, NM_GROUP_TREE_MESSAGE, lID, 0);
+		::PostMessage(m_NotificationWnd, NM_GROUP_TREE_MESSAGE, parentId, 0);
 	}
 }
 
-bool CGroupTree::AddNode(CString csText, long lID)
+bool CGroupTree::AddNode(CString csText, int id)
 {
 	HTREEITEM hItem;
 
@@ -213,7 +213,7 @@ bool CGroupTree::AddNode(CString csText, long lID)
 	hItem = InsertItem(csText, 1, 1, hParent);
 	SelectItem(hItem);
 
-	SetItemData(hItem, lID);
+	SetItemData(hItem, id);
 
 	return true;
 }

+ 5 - 5
GroupTree.h

@@ -24,13 +24,13 @@ public:
 	void FillTree();
 	void SetNotificationWndEx(HWND hWnd)	{ m_NotificationWnd = hWnd;	}
 	bool m_bHide;
-	long m_lSelectedFolderID;
-	long GetSelectedTree();
-	bool AddNode(CString csText, long lID);
+	int m_selectedFolderID;
+	int GetSelectedTree();
+	bool AddNode(CString csText, int id);
 
 protected:
-	void FillTree(long lParentID, HTREEITEM hParent);
-	void SendToParent(long lID);
+	void FillTree(int parentId, HTREEITEM hParent);
+	void SendToParent(int parentId);
 
 	HWND m_NotificationWnd;
 	CBitmap m_bmOpenFolder;

+ 1 - 1
HListBox.cpp

@@ -33,7 +33,7 @@ void CHListBox::updateWidth(LPCTSTR s)
      CClientDC dc(this);
      CFont * f = CListBox::GetFont();
      dc.SelectObject(f);
-     CSize sz = dc.GetTextExtent(s, _tcslen(s));
+     CSize sz = dc.GetTextExtent(s, (int)_tcslen(s));
      sz.cx += 3 * ::GetSystemMetrics(SM_CXBORDER);
      if(sz.cx > width)
 	 { /* extend */

+ 29 - 17
HotKeys.cpp

@@ -158,29 +158,33 @@ CHotKeys::CHotKeys() : m_hWnd(NULL)
 CHotKeys::~CHotKeys()
 {
 	CHotKey* pHotKey;
-	int count = GetSize();
+	INT_PTR count = GetSize();
 	for(int i=0; i < count; i++)
 	{
 		pHotKey = ElementAt(i);
 		if(pHotKey)
+		{
 			delete pHotKey;
+		}
 	}
 }
 
-int CHotKeys::Find( CHotKey* pHotKey )
+INT_PTR CHotKeys::Find(CHotKey* pHotKey)
 {
-	int count = GetSize();
+	INT_PTR count = GetSize();
 	for(int i=0; i < count; i++)
 	{
-		if( pHotKey == ElementAt(i) )
+		if(pHotKey == ElementAt(i))
+		{
 			return i;
+		}
 	}
 	return -1;
 }
 
-bool CHotKeys::Remove( CHotKey* pHotKey )
+bool CHotKeys::Remove(CHotKey* pHotKey)
 {
-	int i = Find(pHotKey);
+	INT_PTR i = Find(pHotKey);
 	if(i >= 0)
 	{
 		RemoveAt(i);
@@ -191,23 +195,27 @@ bool CHotKeys::Remove( CHotKey* pHotKey )
 
 void CHotKeys::LoadAllKeys()
 {
-	int count = GetSize();
+	INT_PTR count = GetSize();
 	for(int i=0; i < count; i++)
+	{
 		ElementAt(i)->LoadKey();
+	}
 }
 
 void CHotKeys::SaveAllKeys()
 {
-	int count = GetSize();
+	INT_PTR count = GetSize();
 	for(int i=0; i < count; i++)
+	{
 		ElementAt(i)->SaveKey();
+	}
 }
 
 void CHotKeys::RegisterAll(bool bMsgOnError)
 {
 	CString str;
 	CHotKey* pHotKey;
-	int count = GetSize();
+	INT_PTR count = GetSize();
 	for(int i = 0; i < count; i++)
 	{
 		pHotKey = ElementAt(i);
@@ -226,7 +234,7 @@ void CHotKeys::UnregisterAll(bool bMsgOnError, bool bOnShowDitto)
 {
 	CString str;
 	CHotKey* pHotKey;
-	int count = GetSize();
+	INT_PTR count = GetSize();
 	for(int i = 0; i < count; i++)
 	{
 		pHotKey = ElementAt(i);
@@ -243,26 +251,30 @@ void CHotKeys::UnregisterAll(bool bMsgOnError, bool bOnShowDitto)
 
 void CHotKeys::GetKeys(ARRAY& keys)
 {
-	int count = GetSize();
+	INT_PTR count = GetSize();
 	keys.SetSize(count);
 	for(int i=0; i < count; i++)
+	{
 		keys[i] = ElementAt(i)->GetKey();
+	}
 }
 
 // caution! this alters hotkeys based upon corresponding indexes
 void CHotKeys::SetKeys(ARRAY& keys, bool bSave)
 {
-	int count = GetSize();
+	INT_PTR count = GetSize();
 	ASSERT(count == keys.GetSize());
 	for(int i=0; i < count; i++)
-		ElementAt(i)->SetKey(keys[i], bSave);
+	{
+		ElementAt(i)->SetKey(keys[(INT)i], bSave);
+	}
 }
 
-bool CHotKeys::FindFirstConflict(ARRAY& keys, int* pX, int* pY)
+bool CHotKeys::FindFirstConflict(ARRAY& keys, INT_PTR* pX, INT_PTR* pY)
 {
 	bool bConflict = false;
-	int i, j;
-	int count = keys.GetSize();
+	INT_PTR i, j;
+	INT_PTR count = keys.GetSize();
 	DWORD key;
 	for(i = 0; i < count && !bConflict; i++)
 	{
@@ -294,7 +306,7 @@ bool CHotKeys::FindFirstConflict(ARRAY& keys, int* pX, int* pY)
 }
 
 // if true, pX and pY (if valid) are set to the indexes of the conflicting hotkeys.
-bool CHotKeys::FindFirstConflict(int* pX, int* pY)
+bool CHotKeys::FindFirstConflict(INT_PTR* pX, INT_PTR* pY)
 {
 	ARRAY keys;
 	GetKeys(keys);

+ 3 - 3
HotKeys.h

@@ -52,7 +52,7 @@ public:
 
 	void Init( HWND hWnd ) { m_hWnd = hWnd; }
 
-	int Find( CHotKey* pHotKey );
+	INT_PTR Find( CHotKey* pHotKey );
 	bool Remove( CHotKey* pHotKey ); // pHotKey is NOT deleted.
 
 	// profile load / save
@@ -65,9 +65,9 @@ public:
 	void GetKeys( ARRAY& keys );
 	void SetKeys( ARRAY& keys, bool bSave = false ); // caution! this alters hotkeys based upon corresponding indexes
 
-	static bool FindFirstConflict( ARRAY& keys, int* pX = NULL, int* pY = NULL );
+	static bool FindFirstConflict( ARRAY& keys, INT_PTR* pX = NULL, INT_PTR* pY = NULL );
 	// if true, pX and pY (if valid) are set to the index of the conflicting hotkeys.
-	bool FindFirstConflict( int* pX = NULL, int* pY = NULL );
+	bool FindFirstConflict( INT_PTR* pX = NULL, INT_PTR* pY = NULL );
 };
 
 extern CHotKeys g_HotKeys;

+ 4 - 3
InternetUpdate.cpp

@@ -127,6 +127,7 @@ CString CInternetUpdate::GetVersionString(long lVersion)
 
 long CInternetUpdate::GetRunningVersion()
 {
+	return 0;
 	CString csFileName = CGetSetOptions::GetExeFileName();
 
     DWORD dwSize, dwHandle;
@@ -135,15 +136,15 @@ long CInternetUpdate::GetRunningVersion()
     VS_FIXEDFILEINFO *lpFFI;
     long ver;
 
-    dwSize = GetFileVersionInfoSize(csFileName.GetBuffer(csFileName.GetLength()), &dwHandle);
+    //dwSize = GetFileVersionInfoSize(csFileName.GetBuffer(csFileName.GetLength()), &dwHandle);
     if(dwSize != 0)
     {
 		csFileName.ReleaseBuffer();
 		if((lpData=(unsigned char *)malloc(dwSize)) != NULL)
 		{
-			if(GetFileVersionInfo(csFileName.GetBuffer(csFileName.GetLength()), dwHandle, dwSize, lpData) != 0)
+			//if(GetFileVersionInfo(csFileName.GetBuffer(csFileName.GetLength()), dwHandle, dwSize, lpData) != 0)
 			{
-				if(VerQueryValue(lpData, _T("\\"), (LPVOID*)&lpFFI, &iBuffSize) != 0)
+				//if(VerQueryValue(lpData, _T("\\"), (LPVOID*)&lpFFI, &iBuffSize) != 0)
 				{
 					if(iBuffSize > 0)
 					{

+ 4 - 4
MainFrm.cpp

@@ -456,7 +456,7 @@ void CMainFrame::DoDittoCopyBufferPaste(int nCopyBuffer)
     CATCH_SQLITE_EXCEPTION
 }
 
-void CMainFrame::OnTimer(UINT nIDEvent)
+void CMainFrame::OnTimer(UINT_PTR nIDEvent)
 {
     switch(nIDEvent)
     {
@@ -703,11 +703,11 @@ LRESULT CMainFrame::OnLoadClipOnClipboard(WPARAM wParam, LPARAM lParam)
 
 		LogSendRecieveInfo("---------OnLoadClipOnClipboard - After PutFormats on clipboard");
 
-		LogSendRecieveInfo(StrF(_T("---------OnLoadClipOnClipboard - Setting clip id: %d on ole clipboard"), pClip->m_ID));
-		paste.GetClipIDs().Add(pClip->m_ID);
+		LogSendRecieveInfo(StrF(_T("---------OnLoadClipOnClipboard - Setting clip id: %d on ole clipboard"), pClip->m_id));
+		paste.GetClipIDs().Add(pClip->m_id);
 		paste.DoPaste();
 
-		LogSendRecieveInfo(StrF(_T("---------OnLoadClipOnClipboard - After paste clip id: %d on ole clipboard"), pClip->m_ID));
+		LogSendRecieveInfo(StrF(_T("---------OnLoadClipOnClipboard - After paste clip id: %d on ole clipboard"), pClip->m_id));
 	}
 
 	delete pClip;

+ 1 - 1
MainFrm.h

@@ -81,7 +81,7 @@ protected:
     afx_msg void OnFirstExit();
     afx_msg void OnChangeCbChain(HWND hWndRemove, HWND hWndAfter);
     afx_msg void OnDrawClipboard();
-    afx_msg void OnTimer(UINT nIDEvent);
+    afx_msg void OnTimer(UINT_PTR nIDEvent);
     afx_msg void OnFirstShowquickpaste();
     afx_msg void OnFirstToggleConnectCV();
     afx_msg void OnUpdateFirstToggleConnectCV(CCmdUI *pCmdUI);

+ 1 - 1
MainFrmThread.cpp

@@ -109,7 +109,7 @@ void CMainFrmThread::OnSaveClips()
 
 	if(count > 0)
 	{
-		int Id = pLocalClips->GetTail()->m_ID;
+		int Id = pLocalClips->GetTail()->m_id;
 
 		Log(StrF(_T("SaveCopyclips After AddToDb, Id: %d Before OnCopyCopyCompleted"), Id));
 

+ 1 - 1
MainTableFunctions.cpp

@@ -69,7 +69,7 @@ CString CMainTableFunctions::GetDisplayText(int nMaxLines, const CString &OrigTe
 	// remove each line's indent
 	TCHAR chFirst;
 	CString line;
-	int count = tokens.GetSize();
+	INT_PTR count = tokens.GetSize();
 	text = "";
 	for(int i=0; i < count; i++)
 	{

+ 41 - 41
Misc.cpp

@@ -168,7 +168,7 @@ CString RemoveEscapes( const TCHAR* str )
 	ASSERT( str );
 	CString ret;
 	TCHAR* pSrc = (TCHAR*) str;
-	TCHAR* pDest = ret.GetBuffer(STRLEN(pSrc));
+	TCHAR* pDest = ret.GetBuffer((int)STRLEN(pSrc));
 	TCHAR* pStart = pDest;
 	while( *pSrc != '\0' )
 	{
@@ -182,7 +182,7 @@ CString RemoveEscapes( const TCHAR* str )
 		pSrc++;
 		pDest++;
 	}
-	ret.ReleaseBuffer( pDest - pStart );
+	ret.ReleaseBuffer((int)(pDest - pStart));
 	return ret;
 }
 
@@ -209,63 +209,63 @@ Global Memory Helper Functions
 \*----------------------------------------------------------------------------*/
 
 // make sure the given HGLOBAL is valid.
-BOOL IsValid( HGLOBAL hGlobal )
+BOOL IsValid(HGLOBAL hGlobal)
 {
-	void* pvData = ::GlobalLock( hGlobal );
-	::GlobalUnlock( hGlobal );
-	return ( pvData != NULL );
+	void* pvData = ::GlobalLock(hGlobal);
+	::GlobalUnlock(hGlobal);
+	return (pvData != NULL);
 }
 
 // asserts if hDest isn't big enough
-void CopyToGlobalHP( HGLOBAL hDest, LPVOID pBuf, ULONG ulBufLen )
+void CopyToGlobalHP(HGLOBAL hDest, LPVOID pBuf, SIZE_T ulBufLen)
 {
-	ASSERT( hDest && pBuf && ulBufLen );
+	ASSERT(hDest && pBuf && ulBufLen);
 	LPVOID pvData = GlobalLock(hDest);
-	ASSERT( pvData );
-	ULONG size = GlobalSize(hDest);
-	ASSERT( size >= ulBufLen );	// assert if hDest isn't big enough
+	ASSERT(pvData);
+	SIZE_T size = GlobalSize(hDest);
+	ASSERT(size >= ulBufLen);	// assert if hDest isn't big enough
 	memcpy(pvData, pBuf, ulBufLen);
 	GlobalUnlock(hDest);
 }
 
-void CopyToGlobalHH( HGLOBAL hDest, HGLOBAL hSource, ULONG ulBufLen )
+void CopyToGlobalHH(HGLOBAL hDest, HGLOBAL hSource, SIZE_T ulBufLen)
 {
-	ASSERT( hDest && hSource && ulBufLen );
+	ASSERT(hDest && hSource && ulBufLen);
 	LPVOID pvData = GlobalLock(hSource);
-	ASSERT( pvData );
-	ULONG size = GlobalSize(hSource);
-	ASSERT( size >= ulBufLen );	// assert if hSource isn't big enough
+	ASSERT(pvData );
+	SIZE_T size = GlobalSize(hSource);
+	ASSERT(size >= ulBufLen);	// assert if hSource isn't big enough
 	CopyToGlobalHP(hDest, pvData, ulBufLen);
 	GlobalUnlock(hSource);
 }
 
 
-HGLOBAL NewGlobalP( LPVOID pBuf, UINT nLen )
+HGLOBAL NewGlobalP(LPVOID pBuf, SIZE_T nLen)
 {
-	ASSERT( pBuf && nLen );
-	HGLOBAL hDest = GlobalAlloc( GMEM_MOVEABLE | GMEM_SHARE, nLen );
-	ASSERT( hDest );
-	CopyToGlobalHP( hDest, pBuf, nLen );
+	ASSERT(pBuf && nLen);
+	HGLOBAL hDest = GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE, nLen);
+	ASSERT(hDest );
+	CopyToGlobalHP(hDest, pBuf, nLen);
 	return hDest;
 }
 
-HGLOBAL NewGlobal(UINT nLen)
+HGLOBAL NewGlobal(SIZE_T nLen)
 {
 	ASSERT(nLen);
 	HGLOBAL hDest = GlobalAlloc(GMEM_MOVEABLE | GMEM_SHARE, nLen);
 	return hDest;
 }
 
-HGLOBAL NewGlobalH( HGLOBAL hSource, UINT nLen )
+HGLOBAL NewGlobalH(HGLOBAL hSource, SIZE_T nLen)
 {
-	ASSERT( hSource && nLen );
-	LPVOID pvData = GlobalLock( hSource );
-	HGLOBAL hDest = NewGlobalP( pvData, nLen );
-	GlobalUnlock( hSource );
+	ASSERT(hSource && nLen);
+	LPVOID pvData = GlobalLock(hSource);
+	HGLOBAL hDest = NewGlobalP(pvData, nLen);
+	GlobalUnlock(hSource);
 	return hDest;
 }
 
-int CompareGlobalHP(HGLOBAL hLeft, LPVOID pBuf, ULONG ulBufLen)
+int CompareGlobalHP(HGLOBAL hLeft, LPVOID pBuf, SIZE_T ulBufLen)
 {
 	ASSERT(hLeft && pBuf && ulBufLen);
 
@@ -281,14 +281,14 @@ int CompareGlobalHP(HGLOBAL hLeft, LPVOID pBuf, ULONG ulBufLen)
 	return result;
 }
 
-int CompareGlobalHH( HGLOBAL hLeft, HGLOBAL hRight, ULONG ulBufLen )
+int CompareGlobalHH( HGLOBAL hLeft, HGLOBAL hRight, SIZE_T ulBufLen)
 {
-	ASSERT( hLeft && hRight && ulBufLen );
-	ASSERT( ulBufLen <= GlobalSize(hRight) );
+	ASSERT(hLeft && hRight && ulBufLen);
+	ASSERT(ulBufLen <= GlobalSize(hRight));
 	LPVOID pvData = GlobalLock(hRight);
-	ASSERT( pvData );
-	int result = CompareGlobalHP( hLeft, pvData, ulBufLen );
-	GlobalUnlock( hLeft );
+	ASSERT(pvData);
+	int result = CompareGlobalHP(hLeft, pvData, ulBufLen);
+	GlobalUnlock(hLeft);
 	return result;
 }
 
@@ -629,7 +629,7 @@ void GetMonitorRect(int iMonitor, LPRECT lpDestRect)
 ID based Globals
 \*------------------------------------------------------------------*/
 
-long NewGroupID(long lParentID, CString text)
+long NewGroupID(int parentID, CString text)
 {
 	long lID=0;
 	CTime time;
@@ -647,7 +647,7 @@ long NewGroupID(long lParentID, CString text)
 							(long)time.GetTime(),
 							text,
 							(long)time.GetTime(),
-							lParentID);
+							parentID);
 
 		theApp.m_db.execDML(cs);
 
@@ -670,7 +670,7 @@ BOOL DeleteAllIDs()
 	return TRUE;
 }
 
-BOOL DeleteFormats(long lParentID, ARRAY& formatIDs)
+BOOL DeleteFormats(int parentID, ARRAY& formatIDs)
 {	
 	if(formatIDs.GetSize() <= 0)
 		return TRUE;
@@ -678,19 +678,19 @@ BOOL DeleteFormats(long lParentID, ARRAY& formatIDs)
 	try
 	{
 		//Delete the requested data formats
-		int nCount = formatIDs.GetSize();
-		for(int i = 0; i < nCount; i++)
+		INT_PTR count = formatIDs.GetSize();
+		for(int i = 0; i < count; i++)
 		{
 			theApp.m_db.execDMLEx(_T("DELETE FROM Data WHERE lID = %d;"), formatIDs[i]);
 		}
 
 		CClip clip;
-		if(clip.LoadFormats(lParentID))
+		if(clip.LoadFormats(parentID))
 		{
 			DWORD CRC = clip.GenerateCRC();
 
 			//Update the main table with new size
-			theApp.m_db.execDMLEx(_T("UPDATE Main SET CRC = %d WHERE lID = %d"), CRC, lParentID);
+			theApp.m_db.execDMLEx(_T("UPDATE Main SET CRC = %d WHERE lID = %d"), CRC, parentID);
 		}
 	}
 	CATCH_SQLITE_EXCEPTION

+ 10 - 10
Misc.h

@@ -67,14 +67,14 @@ CString GetWndText( HWND hWnd );
 bool IsAppWnd( HWND hWnd );
 
 // Global Memory Helper Functions
-BOOL IsValid( HGLOBAL hGlobal );
-void CopyToGlobalHP( HGLOBAL hDest, LPVOID pBuf, ULONG ulBufLen );
-void CopyToGlobalHH( HGLOBAL hDest, HGLOBAL hSource, ULONG ulBufLen );
-HGLOBAL NewGlobalP( LPVOID pBuf, UINT nLen );
-HGLOBAL NewGlobalH( HGLOBAL hSource, UINT nLen );
-HGLOBAL NewGlobal(UINT nLen);
-int CompareGlobalHP( HGLOBAL hLeft, LPVOID pBuf, ULONG ulBufLen );
-int CompareGlobalHH( HGLOBAL hLeft, HGLOBAL hRight, ULONG ulBufLen );
+BOOL IsValid(HGLOBAL hGlobal);
+void CopyToGlobalHP(HGLOBAL hDest, LPVOID pBuf, SIZE_T ulBufLen);
+void CopyToGlobalHH(HGLOBAL hDest, HGLOBAL hSource, SIZE_T ulBufLen);
+HGLOBAL NewGlobalP(LPVOID pBuf, SIZE_T nLen);
+HGLOBAL NewGlobalH(HGLOBAL hSource, SIZE_T nLen);
+HGLOBAL NewGlobal(SIZE_T nLen);
+int CompareGlobalHP(HGLOBAL hLeft, LPVOID pBuf, SIZE_T ulBufLen);
+int CompareGlobalHH(HGLOBAL hLeft, HGLOBAL hRight, SIZE_T ulBufLen);
 
 BOOL EncryptString(CString &csString, UCHAR*& pOutput, int &nLenOutput);
 BOOL DecryptString(UCHAR *pData, int nLenIn, UCHAR*& pOutput, int &nLenOutput);
@@ -117,9 +117,9 @@ CString GetProcessName(HWND hWnd);
 #	include <bitset>
 #endif // !defined(_BITSET_)
 
-long NewGroupID(long lParentID = 0, CString text = "");
+long NewGroupID(int parentID = 0, CString text = "");
 BOOL DeleteAllIDs();
-BOOL DeleteFormats(long lDataID, ARRAY& formatIDs);
+BOOL DeleteFormats(int parentID, ARRAY& formatIDs);
 
 __inline BOOL FileExists(LPCTSTR pszFile)
 { 

+ 1 - 1
MoveToGroupDlg.cpp

@@ -51,7 +51,7 @@ BOOL CMoveToGroupDlg::OnInitDialog()
 {
 	CDialog::OnInitDialog();
 	
-	m_Tree.m_lSelectedFolderID = m_nSelectedGroup;
+	m_Tree.m_selectedFolderID = m_nSelectedGroup;
 	m_Tree.SetNotificationWndEx(m_hWnd);
 	m_Tree.FillTree();
 

+ 6 - 6
MultiLanguage.cpp

@@ -58,8 +58,8 @@ void CMultiLanguage::ClearArrays()
 
 void CMultiLanguage::ClearArray(LANGUAGE_ARRAY &Array)
 {
-	int nSize = Array.GetSize();
-	for(int i = 0; i < nSize; i++)
+	INT_PTR size = Array.GetSize();
+	for(int i = 0; i < size; i++)
 	{
 		CLangItem *plItem = Array[i];
 
@@ -178,8 +178,8 @@ bool CMultiLanguage::UpdateOptionCopyBuffers(CWnd *pParent)
 
 bool CMultiLanguage::UpdateMenuToLanguage(CMenu *pMenu, LANGUAGE_ARRAY &Array)
 {
-	int nSize = Array.GetSize();
-	for(int i = 0; i < nSize; i++)
+	INT_PTR size = Array.GetSize();
+	for(int i = 0; i < size; i++)
 	{
 		CLangItem *plItem = Array[i];
 
@@ -208,8 +208,8 @@ bool CMultiLanguage::UpdateMenuToLanguage(CMenu *pMenu, LANGUAGE_ARRAY &Array)
 
 bool CMultiLanguage::UpdateWindowToLanguage(CWnd *pParent, LANGUAGE_ARRAY &Array)
 {
-	int nSize = Array.GetSize();
-	for(int i = 0; i < nSize; i++)
+	INT_PTR size = Array.GetSize();
+	for(int i = 0; i < size; i++)
 	{
 		CLangItem *plItem = Array[i];
 

+ 14 - 10
OleClipSource.cpp

@@ -29,11 +29,13 @@ BOOL COleClipSource::DoDelayRender()
 	CClipTypes types;
 	m_ClipIDs.GetTypes(types);
 	
-	int count = types.GetSize();
+	INT_PTR count = types.GetSize();
 	for(int i=0; i < count; i++)
+	{
 		DelayRenderData(types[i]);
-	
-	return count;
+	}
+
+	return count > 0;
 }
 
 #include "Client.h"
@@ -47,10 +49,10 @@ BOOL COleClipSource::DoImmediateRender()
 
 	if(m_pCustomPasteFormats != NULL)
 	{
-		return PutFormatOnClipboard(m_pCustomPasteFormats);
+		return PutFormatOnClipboard(m_pCustomPasteFormats) > 0;
 	}
 	
-	int count = m_ClipIDs.GetSize();
+	INT_PTR count = m_ClipIDs.GetSize();
 	if(count <= 0)
 		return 0;
 
@@ -106,20 +108,20 @@ BOOL COleClipSource::DoImmediateRender()
 
 		clip.LoadFormats(m_ClipIDs[0], m_bOnlyPaste_CF_TEXT);
 		
-		return PutFormatOnClipboard(&clip.m_Formats);
+		return PutFormatOnClipboard(&clip.m_Formats) > 0;
 	}		
 
 	return bProcessedMult;
 }
 
-long COleClipSource::PutFormatOnClipboard(CClipFormats *pFormats)
+INT_PTR COleClipSource::PutFormatOnClipboard(CClipFormats *pFormats)
 {
 	Log(_T("Start of put format on clipboard"));
 
 	CClipFormat* pCF;
-	int	count = pFormats->GetSize();
+	INT_PTR	count = pFormats->GetSize();
 	bool bDelayedRenderCF_HDROP = false;
-	int i = 0;
+	INT_PTR i = 0;
 
 	//see if the html format is in the list
 	//if it is the list we will not paste CF_TEXT
@@ -240,10 +242,12 @@ BOOL COleClipSource::OnRenderGlobalData(LPFORMATETC lpFormatEtc, HGLOBAL* phGlob
 		// if phGlobal is null, we can just give the allocated mem
 		// else, our data must fit within the GlobalSize(*phGlobal)
 		if(*phGlobal == 0)
+		{
 			*phGlobal = hData;
+		}
 		else
 		{
-			UINT len = min(::GlobalSize(*phGlobal), ::GlobalSize(hData));
+			SIZE_T len = min(::GlobalSize(*phGlobal), ::GlobalSize(hData));
 			if(len)
 			{
 				CopyToGlobalHH(*phGlobal, hData, len);

+ 1 - 1
OleClipSource.h

@@ -20,7 +20,7 @@ public:
 
 	BOOL DoDelayRender();
 	BOOL DoImmediateRender();
-	long PutFormatOnClipboard(CClipFormats *pFormats);
+	INT_PTR PutFormatOnClipboard(CClipFormats *pFormats);
 
 public:
 	virtual BOOL OnRenderGlobalData(LPFORMATETC lpFormatEtc, HGLOBAL* phGlobal);

+ 7 - 0
Options.cpp

@@ -1434,13 +1434,20 @@ CStringA CGetSetOptions::GetNetworkPassword()
 
 void CGetSetOptions::SetDrawRTF(long bDraw)
 {
+//this only works under 32 bit build
+#ifdef _M_IX86
 	SetProfileLong("DrawRTF", bDraw); 
 	m_bDrawRTF = bDraw;
+#endif
 }
 
 BOOL CGetSetOptions::GetDrawRTF()
 {
+//this only works under 32 bit build
+#ifdef _M_IX86
 	return GetProfileLong("DrawRTF", FALSE);
+#endif
+	return FALSE;
 }
 
 void CGetSetOptions::SetMultiPasteReverse(BOOL bVal)

+ 2 - 2
OptionsCopyBuffers.cpp

@@ -95,8 +95,8 @@ BOOL COptionsCopyBuffers::OnApply()
 	Item.m_bPlaySoundOnCopy = IsDlgButtonChecked(IDC_PLAY_SOUND_3);
 	g_Opt.SetCopyBufferItem(2, Item);
 
-	int x;
-	int y;
+	INT_PTR x;
+	INT_PTR y;
 	ARRAY NewKeys;
 	g_HotKeys.GetKeys(NewKeys);
 

+ 1 - 1
OptionsKeyBoard.cpp

@@ -109,7 +109,7 @@ BOOL COptionsKeyBoard::OnApply()
 {
 	CGetSetOptions::SetSendPasteOnFirstTenHotKeys(m_btSendPaste.GetCheck());
 					
-	int x,y;
+	INT_PTR x,y;
 	CString str;
 	ARRAY keys;
 	

+ 1 - 1
OptionsSheet.cpp

@@ -61,7 +61,7 @@ END_MESSAGE_MAP()
 /////////////////////////////////////////////////////////////////////////////
 // COptionsSheet message handlers
 
-int COptionsSheet::DoModal() 
+INT_PTR COptionsSheet::DoModal() 
 {
 	EnableStackedTabs(TRUE);
 

+ 1 - 1
OptionsSheet.h

@@ -28,7 +28,7 @@ public:
 	// ClassWizard generated virtual function overrides
 	//{{AFX_VIRTUAL(COptionsSheet)
 	public:
-	virtual int DoModal();
+	virtual INT_PTR DoModal();
 	virtual BOOL OnInitDialog();
 	//}}AFX_VIRTUAL
 

+ 1 - 1
OptionsTypes.cpp

@@ -137,7 +137,7 @@ void COptionsTypes::OnAdd()
 
 	if(add.DoModal() == IDOK)
 	{
-		int nCount = add.m_csSelectedTypes.GetSize();
+		INT_PTR nCount = add.m_csSelectedTypes.GetSize();
 		if(nCount)
 		{
 			m_bSave = true;

+ 14 - 14
Path.cpp

@@ -426,7 +426,7 @@ ERootType GetRootType(LPCTSTR path, int * pLen, bool greedy)
       }
 
       // position of next backslash or colon
-      int len = 2 + _tcscspn(path+2, invalidChars);
+      int len = 2 + (int)_tcscspn(path+2, invalidChars);
       TCHAR const * end = path+len;
 
       // server only, no backslash
@@ -443,7 +443,7 @@ ERootType GetRootType(LPCTSTR path, int * pLen, bool greedy)
           if (!greedy)  // return server only
               return GRT_Return(rtServer, len, pLen);
 
-         len += 1 + _tcscspn(end+1, invalidChars);
+         len += 1 + (int)_tcscspn(end+1, invalidChars);
          end = path + len;
 
          // server, share, no backslash
@@ -457,7 +457,7 @@ ERootType GetRootType(LPCTSTR path, int * pLen, bool greedy)
       // fall through to other tests
    }
 
-   int len = _tcscspn(path, invalidChars);
+   int len = (int)_tcscspn(path, invalidChars);
    TCHAR const * end = path + len;
 
    // (pseudo) protocol:
@@ -851,7 +851,7 @@ CPath & CPath::Append(LPCTSTR rhs)
     }
     else
     {
-        int rhsLen = rhs ? _tcslen(rhs) : 0;
+        int rhsLen = rhs ? (int)_tcslen(rhs) : 0;
         CStringLock buffer(m_path, m_path.GetLength()+rhsLen+1);
         PathAppend(buffer, rhs);
     }
@@ -883,7 +883,7 @@ CString CPath::ShellGetRoot() const
     if (rootEnd == NULL)
         return CString();
 
-    return m_path.Left(rootEnd - path);
+    return m_path.Left((int)(rootEnd - path));
 }
 
 
@@ -1002,9 +1002,9 @@ CPath CPath::GetPath(bool includeRoot ) const
 
     CPath ret;
     if (rootEnd == NULL)  // NULL if root should be included, or no root is found
-        return m_path.Left(fileName-path);
+        return m_path.Left((int)(fileName-path));
     else
-        return m_path.Mid(rootEnd-path, fileName-rootEnd);
+        return m_path.Mid((int)(rootEnd-path), (int)(fileName-rootEnd));
 }
 
 // ==================================================================
@@ -1028,7 +1028,7 @@ CString CPath::GetName() const
     if (fileName == NULL)
         return CString();
 
-    return m_path.Mid(fileName-path);
+    return m_path.Mid((int)(fileName-path));
 }
 
 // ==================================================================
@@ -1047,9 +1047,9 @@ CString CPath::GetTitle() const
         return CString();
 
     if (ext == NULL)
-        return m_path.Mid(fileName-path);
+        return m_path.Mid((int)(fileName-path));
 
-    return m_path.Mid(fileName-path, ext-fileName);
+    return m_path.Mid((int)(fileName-path), (int)(ext-fileName));
 
 
 }
@@ -1073,7 +1073,7 @@ CString CPath::GetExtension() const
     if (*ext == '.')        // skip "."
         ++ext;
 
-    return m_path.Mid(ext-path);
+    return m_path.Mid((int)(ext-path));
 }
 
 
@@ -1106,7 +1106,7 @@ CPath & CPath::AddExtension(LPCTSTR extension, int len)
     }
 
     if (len < 0)
-        return AddExtension(extension, _tcslen(extension));
+        return AddExtension(extension, (int)_tcslen(extension));
 
     int totalLen = m_path.GetLength() + len;  // already counts the period
 
@@ -1148,7 +1148,7 @@ CPath & CPath::RenameExtension(LPCTSTR newExt)
         return AddExtension(newExt);
     }
 
-    int maxLen = m_path.GetLength() + _tcslen(newExt) + 1;
+    int maxLen = m_path.GetLength() + (int)_tcslen(newExt) + 1;
     PathRenameExtension(CStringLock(m_path, maxLen), newExt);
     return *this;
 }
@@ -1355,7 +1355,7 @@ CPath CPath::RelativePathTo(LPCTSTR pathTo,bool srcIsDir)
 
     // maximum length estimate: 
     // going up to the root of a path like "c:\a\b\c\d\e", and then append the entire to path
-    int maxLen = 3*m_path.GetLength() / 2 +1  + _tcslen(pathTo); 
+    int maxLen = 3*m_path.GetLength() / 2 +1  + (int)_tcslen(pathTo); 
 
     PathRelativePathTo( CStringLock(path, maxLen), 
                         m_path, 

+ 12 - 12
QListCtrl.cpp

@@ -214,7 +214,7 @@ bool CQListCtrl::PutSelectedItemOnDittoCopyBuffer(long lBuffer)
 	bool bRet = false;
 	ARRAY arr;
 	GetSelectionItemData(arr);
-	int nCount = arr.GetSize();
+	INT_PTR nCount = arr.GetSize();
 	if(nCount > 0 && arr[0])
 	{
 		CDittoCopyBuffer::PutClipOnDittoCopyBuffer(arr[0], lBuffer);
@@ -636,7 +636,7 @@ BOOL CQListCtrl::OnToolTipText( UINT id, NMHDR * pNMHDR, LRESULT * pResult )
 	TOOLTIPTEXTW* pTTTW = (TOOLTIPTEXTW*)pNMHDR;
 	CString strTipText;
 	
-	UINT nID = pNMHDR->idFrom;
+	UINT_PTR nID = pNMHDR->idFrom;
 	
 	if(nID == 0)	  	// Notification in NT from automatically
 		return FALSE;   	// created tooltip
@@ -645,7 +645,7 @@ BOOL CQListCtrl::OnToolTipText( UINT id, NMHDR * pNMHDR, LRESULT * pResult )
 	
 	// Use Item's name as the tool tip. Change this for something different.
 	// Like use its file size, etc.
-	GetToolTipText(nID-1, strTipText);
+	GetToolTipText((int)nID-1, strTipText);
 	
 	//Replace the tabs with spaces, the tooltip didn't like the \t s
 	strTipText.Replace(_T("\t"), _T("  "));
@@ -700,7 +700,7 @@ BOOL CQListCtrl::OnToolTipText( UINT id, NMHDR * pNMHDR, LRESULT * pResult )
 	return TRUE;    // message was handled
 }
 
-int CQListCtrl::OnToolHitTest(CPoint point, TOOLINFO * pTI) const
+INT_PTR CQListCtrl::OnToolHitTest(CPoint point, TOOLINFO * pTI) const
 {
 	CRect rect;
 	GetClientRect(&rect);
@@ -810,7 +810,7 @@ BOOL CQListCtrl::HandleKeyDown(WPARAM wParam, LPARAM lParam)
 		if(g_Opt.m_bUseCtrlNumAccel && !(GetKeyState(VK_CONTROL) & 0x8000))
 			return FALSE;
 		
-		int index = vk - '0';
+		int index = (int)vk - '0';
 		// '0' is actually 10 in the ditto window
 		if(index == 0)
 			index = 10;
@@ -826,7 +826,7 @@ BOOL CQListCtrl::HandleKeyDown(WPARAM wParam, LPARAM lParam)
 		if( g_Opt.m_bUseCtrlNumAccel && !(GetKeyState(VK_CONTROL) & 0x8000) )
 			return FALSE;
 		
-		int index = vk - VK_NUMPAD0;
+		int index = (int)vk - VK_NUMPAD0;
 		// '0' is actually 10 in the ditto window
 		if(index == 0)
 			index = 10;
@@ -903,8 +903,8 @@ void CQListCtrl::LoadCopyOrCutToClipboard()
 {
 	ARRAY arr;
 	GetSelectionItemData(arr);
-	int nCount = arr.GetSize();
-	if(nCount <= 0)
+	INT_PTR count = arr.GetSize();
+	if(count <= 0)
 		return;
 	
 	CProcessPaste paste;
@@ -912,7 +912,7 @@ void CQListCtrl::LoadCopyOrCutToClipboard()
 	//Don't send the paste just load it into memory
 	paste.m_bSendPaste = false;
 		
-	if(nCount > 1)
+	if(count > 1)
 		paste.GetClipIDs().Copy(arr);
 	else
 		paste.GetClipIDs().Add(arr[0]);
@@ -1092,11 +1092,11 @@ DWORD CQListCtrl::GetItemData(int nItem)
 			
 			pParent->SendMessage(WM_NOTIFY,(WPARAM)info.hdr.idFrom,(LPARAM)&info);
 			
-			return info.item.lParam;
+			return (DWORD)info.item.lParam;
 		}
 	}
 	
-	return CListCtrl::GetItemData(nItem);
+	return (DWORD)CListCtrl::GetItemData(nItem);
 }
 
 CClipFormatQListCtrl* CQListCtrl::GetItem_CF_DIB_ClipFormat(int nItem)
@@ -1255,7 +1255,7 @@ void CQListCtrl::OnSelectionChange(NMHDR* pNMHDR, LRESULT* pResult)
 	}
 }
 
-void CQListCtrl::OnTimer(UINT nIDEvent) 
+void CQListCtrl::OnTimer(UINT_PTR nIDEvent) 
 {
 	if(nIDEvent == TIMER_SHOW_PROPERTIES)
 	{

+ 2 - 2
QListCtrl.h

@@ -76,7 +76,7 @@ public:
 	// ClassWizard generated virtual function overrides
 	//{{AFX_VIRTUAL(CQListCtrl)
 	public:
-	virtual int OnToolHitTest(CPoint point, TOOLINFO * pTI) const;
+	virtual INT_PTR OnToolHitTest(CPoint point, TOOLINFO * pTI) const;
 	virtual BOOL PreTranslateMessage(MSG* pMsg);
 	virtual BOOL OnChildNotify(UINT message, WPARAM wParam, LPARAM lParam, LRESULT* pLResult);
 	//}}AFX_VIRTUAL
@@ -162,7 +162,7 @@ protected:
 	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
 	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
 	afx_msg void OnHScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
-	afx_msg void OnTimer(UINT nIDEvent);
+	afx_msg void OnTimer(UINT_PTR nIDEvent);
 	afx_msg void OnSelectionChange(NMHDR* pNMHDR, LRESULT* pResult);
 	afx_msg void OnVScroll(UINT nSBCode, UINT nPos, CScrollBar* pScrollBar);
 	afx_msg BOOL OnMouseWheel(UINT nFlags, short zDelta, CPoint pt);

+ 42 - 33
QPasteWnd.cpp

@@ -175,7 +175,8 @@ ON_MESSAGE(NM_INACTIVE_TOOLTIPWND, OnToolTipWndInactive)
 ON_MESSAGE(NM_SET_LIST_COUNT, OnSetListCount)
 ON_MESSAGE(NM_REFRESH_ROW, OnRefeshRow)
 ON_MESSAGE(NM_ITEM_DELETED, OnItemDeleted)
-ON_WM_TIMER()ON_COMMAND(ID_MENU_EXPORT, OnMenuExport)
+ON_WM_TIMER()
+ON_COMMAND(ID_MENU_EXPORT, OnMenuExport)
 ON_COMMAND(ID_MENU_IMPORT, OnMenuImport)
 ON_COMMAND(ID_QUICKPROPERTIES_REMOVEQUICKPASTE, OnQuickpropertiesRemovequickpaste)
 ON_COMMAND(ID_MENU_EDITITEM, OnMenuEdititem)
@@ -608,7 +609,7 @@ BOOL CQPasteWnd::OpenSelection(bool bOnlyLoad_CF_TEXT)
     ARRAY IDs;
     m_lstHeader.GetSelectionItemData(IDs);
 
-    int count = IDs.GetSize();
+    INT_PTR count = IDs.GetSize();
 
     if(count <= 0)
     {
@@ -666,7 +667,7 @@ BOOL CQPasteWnd::NewGroup(bool bGroupSelection)
     {
         m_bHideWnd = false;
 
-        int nRet = Name.DoModal();
+        INT_PTR nRet = Name.DoModal();
 
         m_bHideWnd = true;
 
@@ -701,7 +702,7 @@ BOOL CQPasteWnd::NewGroup(bool bGroupSelection)
 
 LRESULT CQPasteWnd::OnListSelect_DB_ID(WPARAM wParam, LPARAM lParam)
 {
-    OpenID(wParam);
+    OpenID((long)wParam);
     return TRUE;
 }
 
@@ -712,7 +713,7 @@ LRESULT CQPasteWnd::OnListSelect_Index(WPARAM wParam, LPARAM lParam)
         return FALSE;
     }
 
-    OpenIndex(wParam);
+    OpenIndex((long)wParam);
 
     return TRUE;
 }
@@ -1191,10 +1192,15 @@ void CQPasteWnd::SetMenuChecks(CMenu *pMenu)
         pMenu->CheckMenuItem(ID_MENU_QUICKOPTIONS_SHOWTHUMBNAILS, MF_CHECKED);
     }
 
+	//this only works under 32 bit build
+#ifdef _M_IX86
     if(g_Opt.m_bDrawRTF)
     {
         pMenu->CheckMenuItem(ID_MENU_QUICKOPTIONS_DRAWRTFTEXT, MF_CHECKED);
     }
+#else
+	pMenu->RemoveMenu(ID_MENU_QUICKOPTIONS_DRAWRTFTEXT, MF_BYCOMMAND);
+#endif
 
     if(g_Opt.m_bSendPasteMessageAfterSelection)
     {
@@ -1432,7 +1438,7 @@ void CQPasteWnd::OnMenuProperties()
     m_lstHeader.GetSelectionItemData(IDs);
     m_lstHeader.GetSelectionIndexes(Indexes);
 
-    int nSize = IDs.GetSize();
+    INT_PTR nSize = IDs.GetSize();
     if(nSize < 1)
     {
         return ;
@@ -1450,7 +1456,7 @@ void CQPasteWnd::OnMenuProperties()
     m_lstHeader.SetSelection(nRow);
 
     CCopyProperties props(lID, this);
-    int nDo = props.DoModal();
+    INT_PTR nDo = props.DoModal();
 
     if(nDo == IDOK)
     {
@@ -1622,7 +1628,7 @@ void CQPasteWnd::OnMenuQuickpropertiesSettoneverautodelete()
     m_lstHeader.GetSelectionItemData(IDs);
     m_lstHeader.GetSelectionIndexes(Indexs);
 
-    int count = IDs.GetSize();
+    INT_PTR count = IDs.GetSize();
 
     for(int i = 0; i < count; i++)
     {
@@ -1658,7 +1664,7 @@ void CQPasteWnd::OnMenuQuickpropertiesAutodelete()
     m_lstHeader.GetSelectionItemData(IDs);
     m_lstHeader.GetSelectionIndexes(Indexs);
 
-    int count = IDs.GetSize();
+    INT_PTR count = IDs.GetSize();
 
     for(int i = 0; i < count; i++)
     {
@@ -1693,7 +1699,7 @@ void CQPasteWnd::OnMenuQuickpropertiesRemovehotkey()
     m_lstHeader.GetSelectionItemData(IDs);
     m_lstHeader.GetSelectionIndexes(Indexs);
 
-    int count = IDs.GetSize();
+    INT_PTR count = IDs.GetSize();
 
     for(int i = 0; i < count; i++)
     {
@@ -1729,7 +1735,7 @@ void CQPasteWnd::OnQuickpropertiesRemovequickpaste()
     m_lstHeader.GetSelectionItemData(IDs);
     m_lstHeader.GetSelectionIndexes(Indexs);
 
-    int count = IDs.GetSize();
+    INT_PTR count = IDs.GetSize();
 
     for(int i = 0; i < count; i++)
     {
@@ -1844,7 +1850,7 @@ void CQPasteWnd::OnMenuGroupsMovetogroup()
 
     CMoveToGroupDlg dlg;
 
-    int nRet = dlg.DoModal();
+    INT_PTR nRet = dlg.DoModal();
     if(nRet == IDOK)
     {
         int nGroup = dlg.GetSelectedGroup();
@@ -1874,7 +1880,7 @@ void CQPasteWnd::OnPromptToDeleteClip()
 void CQPasteWnd::OnMenuExport()
 {
     CClipIDs IDs;
-    long lCount = m_lstHeader.GetSelectedCount();
+    INT_PTR lCount = m_lstHeader.GetSelectedCount();
     if(lCount <= 0)
     {
         return ;
@@ -1966,8 +1972,11 @@ void CQPasteWnd::OnMenuQuickoptionsShowthumbnails()
 
 void CQPasteWnd::OnMenuQuickoptionsDrawrtftext()
 {
+	//this only works under 32 bit build
+#ifdef _M_IX86
     CGetSetOptions::SetDrawRTF(!g_Opt.m_bDrawRTF);
     m_lstHeader.RefreshVisibleRows();
+#endif
 }
 
 void CQPasteWnd::OnMenuQuickoptionsPasteclipafterselection()
@@ -2035,21 +2044,21 @@ BOOL CQPasteWnd::SendToFriendbyPos(int nPos)
     m_bHideWnd = false;
 
     CClipIDs IDs;
-    long lCount = m_lstHeader.GetSelectedCount();
-    if(lCount <= 0)
+    INT_PTR count = m_lstHeader.GetSelectedCount();
+    if(count <= 0)
     {
         return FALSE;
     }
 
     m_lstHeader.GetSelectionItemData(IDs);
-    lCount = IDs.GetSize();
-    if(lCount <= 0)
+    count = IDs.GetSize();
+    if(count <= 0)
     {
         return FALSE;
     }
 
     CSendToFriendInfo Info;
-    Info.m_lPos = nPos;
+    Info.m_pos = nPos;
 
     BOOL bRet = FALSE;
 
@@ -2061,7 +2070,7 @@ BOOL CQPasteWnd::SendToFriendbyPos(int nPos)
         Info.m_pPopup = &Popup;
 
         Info.m_pClipList = new CClipList;
-        for(int i = 0; i < lCount; i++)
+        for(int i = 0; i < count; i++)
         {
             CppSQLite3Query q = theApp.m_db.execQueryEx(_T("SELECT mText FROM Main WHERE lID = %d"), IDs[i]);
             if(q.eof() == false)
@@ -2071,7 +2080,7 @@ BOOL CQPasteWnd::SendToFriendbyPos(int nPos)
                 {
                     pClip->LoadFormats(IDs[i]);
                     pClip->m_Desc = q.getStringField(0);
-                    pClip->m_ID = IDs[i];
+                    pClip->m_id = IDs[i];
                     Info.m_pClipList->AddTail(pClip);
                 }
             }
@@ -2133,14 +2142,14 @@ void CQPasteWnd::DeleteSelectedRows()
     IDs.DeleteIDs(true, theApp.m_db);
 
     Indexs.SortDescending();
-    int nCount = Indexs.GetSize();
+    INT_PTR count = Indexs.GetSize();
 
     int erasedCount = 0;
 
     {
 		ATL::CCritSecLock csLock(m_CritSection.m_sect);
 
-        for(int i = 0; i < nCount; i++)
+        for(int i = 0; i < count; i++)
         {
             MainTypeMap::iterator iter = m_mapCache.find(Indexs[i]);
             if(iter != m_mapCache.end() && iter->second.m_lID > 0)
@@ -2250,7 +2259,7 @@ BOOL CQPasteWnd::PreTranslateMessage(MSG *pMsg)
             {
             case VK_APPS:
                 {
-                    long lRet;
+                    LRESULT lRet;
                     OnRclickQuickPaste(NULL, &lRet);
                     return 0;
                 }
@@ -2608,7 +2617,7 @@ void CQPasteWnd::GetDispInfo(NMHDR *pNMHDR, LRESULT *pResult)
                 bool exists = false;
 				for (std::list<CClipFormatQListCtrl>::iterator it = m_ExtraDataLoadItems.begin(); it != m_ExtraDataLoadItems.end(); it++)
 				{
-					if(it->m_cfType == CF_DIB && it->m_lDBID == iter->second.m_lID)
+					if(it->m_cfType == CF_DIB && it->m_dbId == iter->second.m_lID)
 					{
 						exists = true;
 						break;
@@ -2619,7 +2628,7 @@ void CQPasteWnd::GetDispInfo(NMHDR *pNMHDR, LRESULT *pResult)
                 {
                     CClipFormatQListCtrl format;
                     format.m_cfType = CF_DIB;
-                    format.m_lDBID = iter->second.m_lID;
+                    format.m_dbId = iter->second.m_lID;
                     format.m_clipRow = pItem->iItem;
                     format.m_autoDeleteData = false;
                     m_ExtraDataLoadItems.push_back(format);
@@ -2650,7 +2659,7 @@ void CQPasteWnd::GetDispInfo(NMHDR *pNMHDR, LRESULT *pResult)
                 bool exists = false;
 				for (std::list<CClipFormatQListCtrl>::iterator it = m_ExtraDataLoadItems.begin(); it != m_ExtraDataLoadItems.end(); it++)
 				{
-					if(it->m_cfType == theApp.m_RTFFormat && it->m_lDBID == iter->second.m_lID)
+					if(it->m_cfType == theApp.m_RTFFormat && it->m_dbId == iter->second.m_lID)
 					{
 						exists = true;
 						break;
@@ -2661,7 +2670,7 @@ void CQPasteWnd::GetDispInfo(NMHDR *pNMHDR, LRESULT *pResult)
                 {
                     CClipFormatQListCtrl format;
                     format.m_cfType = theApp.m_RTFFormat;
-                    format.m_lDBID = iter->second.m_lID;
+                    format.m_dbId = iter->second.m_lID;
                     format.m_clipRow = pItem->iItem;
                     format.m_autoDeleteData = false;
                     m_ExtraDataLoadItems.push_back(format);
@@ -2885,7 +2894,7 @@ void CQPasteWnd::OnShowGroupsTop()
     CRect cr(crList.left, crList.top, crList.left + crList.Width(), crList.top + 200);
 
     m_GroupTree.MoveWindow(cr);
-    m_GroupTree.m_lSelectedFolderID = theApp.m_GroupID;
+    m_GroupTree.m_selectedFolderID = theApp.m_GroupID;
     m_GroupTree.FillTree();
     m_GroupTree.ShowWindow(SW_SHOW);
 
@@ -2905,7 +2914,7 @@ void CQPasteWnd::OnShowGroupsBottom()
     CRect cr(crWindow.left, crWindow.bottom, crWindow.left + crWindow.Width(), crWindow.bottom + 200);
 
     m_GroupTree.MoveWindow(cr);
-    m_GroupTree.m_lSelectedFolderID = theApp.m_GroupID;
+    m_GroupTree.m_selectedFolderID = theApp.m_GroupID;
     m_GroupTree.FillTree();
     m_GroupTree.ShowWindow(SW_SHOW);
 
@@ -3169,7 +3178,7 @@ void CQPasteWnd::OnUpdateMenuNewclip(CCmdUI *pCmdUI)
 
 LRESULT CQPasteWnd::OnSetListCount(WPARAM wParam, LPARAM lParam)
 {
-    m_lstHeader.SetItemCountEx(wParam);
+    m_lstHeader.SetItemCountEx((int)wParam);
 	SelectFocusID();
     UpdateStatus(false);
 
@@ -3178,14 +3187,14 @@ LRESULT CQPasteWnd::OnSetListCount(WPARAM wParam, LPARAM lParam)
 
 LRESULT CQPasteWnd::OnItemDeleted(WPARAM wParam, LPARAM lParam)
 {
-    m_lstHeader.OnItemDeleted(wParam);
+    m_lstHeader.OnItemDeleted((int)wParam);
     return TRUE;
 }
 
 LRESULT CQPasteWnd::OnRefeshRow(WPARAM wParam, LPARAM lParam)
 {
-    int clipId = wParam;
-    int listPos = lParam;
+    int clipId = (int)wParam;
+    int listPos = (int)lParam;
 
 	int topIndex = m_lstHeader.GetTopIndex();
 	int lastIndex = topIndex + m_lstHeader.GetCountPerPage();

+ 10 - 9
QPasteWndThread.cpp

@@ -159,6 +159,7 @@ void CQPasteWndThread::OnLoadItems(void *param)
 				if(firstLoad)
 				{
 	        		::PostMessage(pasteWnd->m_hWnd, NM_REFRESH_ROW, -2, 0);
+					break;
 				}
 				else
 				{
@@ -211,26 +212,26 @@ void CQPasteWndThread::OnLoadExtraData(void *param)
 
 	for (std::list<CClipFormatQListCtrl>::iterator it = localFormats.begin(); it != localFormats.end(); it++)
     {
-        if(theApp.GetClipData(it->m_lDBID, *it))
+        if(theApp.GetClipData(it->m_dbId, *it))
         {
-            Log(StrF(_T("Loaded, extra data for clip %d, type: %d"), it->m_lDBID, it->m_cfType));
+            Log(StrF(_T("Loaded, extra data for clip %d, type: %d"), it->m_dbId, it->m_cfType));
 
 			ATL::CCritSecLock csLock(pasteWnd->m_CritSection.m_sect);
 
             if(it->m_cfType == CF_DIB)
             {
-                pasteWnd->m_cf_dibCache[it->m_lDBID] = *it;
+                pasteWnd->m_cf_dibCache[it->m_dbId] = *it;
                 //the cache now owns the format data, set it to delete the data in the destructor
-                pasteWnd->m_cf_dibCache[it->m_lDBID].m_autoDeleteData = true;
+                pasteWnd->m_cf_dibCache[it->m_dbId].m_autoDeleteData = true;
             }
             else if(it->m_cfType == theApp.m_RTFFormat)
             {
-                pasteWnd->m_cf_rtfCache[it->m_lDBID] = *it;
+                pasteWnd->m_cf_rtfCache[it->m_dbId] = *it;
                 //the cache now owns the format data, set it to delete the data in the destructor
-                pasteWnd->m_cf_rtfCache[it->m_lDBID].m_autoDeleteData = true;
+                pasteWnd->m_cf_rtfCache[it->m_dbId].m_autoDeleteData = true;
             }
 
-            ::PostMessage(pasteWnd->m_hWnd, NM_REFRESH_ROW, it->m_lDBID, it->m_clipRow);
+            ::PostMessage(pasteWnd->m_hWnd, NM_REFRESH_ROW, it->m_dbId, it->m_clipRow);
         }
         else
         {
@@ -239,12 +240,12 @@ void CQPasteWndThread::OnLoadExtraData(void *param)
             if(it->m_cfType == CF_DIB)
             {
                 CClipFormatQListCtrl localFormat;
-                pasteWnd->m_cf_dibCache[it->m_lDBID] = *it;
+                pasteWnd->m_cf_dibCache[it->m_dbId] = *it;
             }
             else if(it->m_cfType == theApp.m_RTFFormat)
             {
                 CClipFormatQListCtrl localFormat;
-                pasteWnd->m_cf_rtfCache[it->m_lDBID] = *it;
+                pasteWnd->m_cf_rtfCache[it->m_dbId] = *it;
             }
         }
     }

+ 7 - 5
RecieveSocket.cpp

@@ -57,9 +57,9 @@ LPVOID CRecieveSocket::ReceiveEncryptedData(long lInSize, long &lOutSize)
 
 		int nOut = 0;
 		CStringA csPassword;
-		int nCount = g_Opt.m_csNetworkPasswordArray.GetSize();
-		int nIndex;
-		for(int i = -2; i < nCount; i++)
+		INT_PTR count = g_Opt.m_csNetworkPasswordArray.GetSize();
+		INT_PTR nIndex;
+		for(int i = -2; i < count; i++)
 		{
 			csPassword.Empty();
 			nIndex = i;
@@ -78,12 +78,14 @@ LPVOID CRecieveSocket::ReceiveEncryptedData(long lInSize, long &lOutSize)
 			}
 			else
 			{
-				if(nIndex >= 0 && nIndex < nCount)
+				if(nIndex >= 0 && nIndex < count)
 				{
 					CTextConvert::ConvertToUTF8(g_Opt.m_csNetworkPasswordArray[nIndex], csPassword);
 				}
 				else
+				{
 					continue;
+				}
 			}
 
 			if(m_pEncryptor->Decrypt((UCHAR*)pInput, lInSize, csPassword, pOutput, nOut) == FALSE)
@@ -92,7 +94,7 @@ LPVOID CRecieveSocket::ReceiveEncryptedData(long lInSize, long &lOutSize)
 			}
 			else
 			{
-				theApp.m_lLastGoodIndexForNextworkPassword = nIndex;
+				theApp.m_lLastGoodIndexForNextworkPassword = (long)nIndex;
 				break;
 			}
 		}

BIN
Release/focus.lib


BIN
Release/sqlite3.dll


BIN
Release/zlib1.dll


+ 3 - 3
RichEditCtrlEx.cpp

@@ -27,7 +27,7 @@ BOOL PASCAL AfxInitRichEditEx()
 
     if( l_pState->m_hInstRichEdit20 == NULL )
     {
-#ifdef _UNICODE
+#ifdef _UNICODE 
         l_pState->m_hInstRichEdit20 = LoadLibraryW(_T("RICHED20.DLL"));
 #else
 		l_pState->m_hInstRichEdit20 = LoadLibraryA(_T("RICHED20.DLL"));
@@ -194,7 +194,7 @@ void CRichEditCtrlEx::SetText(CString sText)
 /*
 	Callback function to stream an RTF string into the rich edit control.
 */
-DWORD CALLBACK CRichEditCtrlEx::CBStreamIn(DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)
+DWORD CALLBACK CRichEditCtrlEx::CBStreamIn(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)
 {
 	// We insert the rich text here.
 
@@ -226,7 +226,7 @@ DWORD CALLBACK CRichEditCtrlEx::CBStreamIn(DWORD dwCookie, LPBYTE pbBuff, LONG c
 /*
 	Callback function to stream the RTF string out of the rich edit control.
 */
-DWORD CALLBACK CRichEditCtrlEx::CBStreamOut(DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)
+DWORD CALLBACK CRichEditCtrlEx::CBStreamOut(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb)
 {
 	// Address of our string var is in psEntry
 	CString *psEntry = (CString*) dwCookie;

+ 2 - 2
RichEditCtrlEx.h

@@ -99,8 +99,8 @@ protected:
 	DECLARE_MESSAGE_MAP()
 private:
 		void SetCharStyle(int MASK, int STYLE, int nStart, int nEnd);
-		static DWORD CALLBACK CBStreamIn(DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb);
-		static DWORD CALLBACK CBStreamOut(DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG* pcb);
+		static DWORD CALLBACK CBStreamIn(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb);
+		static DWORD CALLBACK CBStreamOut(DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG* pcb);
 		static BOOL CALLBACK CBEnumFonts(LPLOGFONT lplf, LPTEXTMETRIC lptm, DWORD dwType, LPARAM lpData);
 };
 

+ 44 - 44
RulerRichEditCtrl/External/ColourPicker.cpp

@@ -82,55 +82,55 @@ BEGIN_MESSAGE_MAP(CColourPicker, CButton)
     ON_CONTROL_REFLECT_EX(BN_CLICKED, OnClicked)
     ON_WM_CREATE()
     //}}AFX_MSG_MAP
-    ON_MESSAGE(CPN_SELENDOK,     OnSelEndOK)
-    ON_MESSAGE(CPN_SELENDCANCEL, OnSelEndCancel)
-    ON_MESSAGE(CPN_SELCHANGE,    OnSelChange)
+    //ON_MESSAGE(CPN_SELENDOK,     OnSelEndOK)
+    //ON_MESSAGE(CPN_SELENDCANCEL, OnSelEndCancel)
+    //ON_MESSAGE(CPN_SELCHANGE,    OnSelChange)
 END_MESSAGE_MAP()
 
 /////////////////////////////////////////////////////////////////////////////
 // CColourPicker message handlers
 
-LONG CColourPicker::OnSelEndOK(UINT lParam, LONG /*wParam*/)
-{
-    COLORREF crNewColour = (COLORREF) lParam;
-    m_bActive = FALSE;
-    SetColour(crNewColour);
-
-    CWnd *pParent = GetParent();
-    if (pParent) {
-        pParent->SendMessage(CPN_CLOSEUP, lParam, (WPARAM) GetDlgCtrlID());
-        pParent->SendMessage(CPN_SELENDOK, lParam, (WPARAM) GetDlgCtrlID());
-    }
-
-    if (crNewColour != GetColour())
-        if (pParent) pParent->SendMessage(CPN_SELCHANGE, lParam, (WPARAM) GetDlgCtrlID());
-
-    return TRUE;
-}
-
-LONG CColourPicker::OnSelEndCancel(UINT lParam, LONG /*wParam*/)
-{
-    m_bActive = FALSE;
-    SetColour((COLORREF) lParam);
-
-    CWnd *pParent = GetParent();
-    if (pParent) {
-        pParent->SendMessage(CPN_CLOSEUP, lParam, (WPARAM) GetDlgCtrlID());
-        pParent->SendMessage(CPN_SELENDCANCEL, lParam, (WPARAM) GetDlgCtrlID());
-    }
-
-    return TRUE;
-}
-
-LONG CColourPicker::OnSelChange(UINT lParam, LONG /*wParam*/)
-{
-    if (m_bTrackSelection) SetColour((COLORREF) lParam);
-
-    CWnd *pParent = GetParent();
-    if (pParent) pParent->SendMessage(CPN_SELCHANGE, lParam, (WPARAM) GetDlgCtrlID());
-
-    return TRUE;
-}
+//LRESULT CColourPicker::OnSelEndOK(LPARAM lParam, WPARAM wParam)
+//{
+//    COLORREF crNewColour = (COLORREF) lParam;
+//    m_bActive = FALSE;
+//    SetColour(crNewColour);
+//
+//    CWnd *pParent = GetParent();
+//    if (pParent) {
+//        pParent->SendMessage(CPN_CLOSEUP, lParam, (WPARAM) GetDlgCtrlID());
+//        pParent->SendMessage(CPN_SELENDOK, lParam, (WPARAM) GetDlgCtrlID());
+//    }
+//
+//    if (crNewColour != GetColour())
+//        if (pParent) pParent->SendMessage(CPN_SELCHANGE, lParam, (WPARAM) GetDlgCtrlID());
+//
+//    return TRUE;
+//}
+//
+//LRESULT CColourPicker::OnSelEndCancel(LPARAM lParam, WPARAM wParam)
+//{
+//    m_bActive = FALSE;
+//    SetColour((COLORREF) lParam);
+//
+//    CWnd *pParent = GetParent();
+//    if (pParent) {
+//        pParent->SendMessage(CPN_CLOSEUP, lParam, (WPARAM) GetDlgCtrlID());
+//        pParent->SendMessage(CPN_SELENDCANCEL, lParam, (WPARAM) GetDlgCtrlID());
+//    }
+//
+//    return TRUE;
+//}
+//
+//LRESULT CColourPicker::OnSelChange(LPARAM lParam, WPARAM wParam)
+//{
+//    if (m_bTrackSelection) SetColour((COLORREF) lParam);
+//
+//    CWnd *pParent = GetParent();
+//    if (pParent) pParent->SendMessage(CPN_SELCHANGE, lParam, (WPARAM) GetDlgCtrlID());
+//
+//    return TRUE;
+//}
 
 int CColourPicker::OnCreate(LPCREATESTRUCT lpCreateStruct) 
 {

+ 3 - 3
RulerRichEditCtrl/External/ColourPicker.h

@@ -98,9 +98,9 @@ protected:
     afx_msg BOOL OnClicked();
     afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
     //}}AFX_MSG
-    afx_msg LONG OnSelEndOK(UINT lParam, LONG wParam);
-    afx_msg LONG OnSelEndCancel(UINT lParam, LONG wParam);
-    afx_msg LONG OnSelChange(UINT lParam, LONG wParam);
+    /*afx_msg LRESULT OnSelEndOK(LPARAM lParam, WPARAM wParam);
+    afx_msg LRESULT OnSelEndCancel(LPARAM lParam, WPARAM wParam);
+    afx_msg LRESULT OnSelChange(LPARAM lParam, WPARAM wParam);*/
 
     DECLARE_MESSAGE_MAP()
 };

+ 5 - 5
RulerRichEditCtrl/RRECRuler.cpp

@@ -124,7 +124,7 @@ void CRRECRuler::OnPaint()
 	CPaintDC mainDC(this);
 
 	// Set up data
-	int pos = GetParent()->SendMessage( urm_GETSCROLLPOS );
+	int pos = (int)GetParent()->SendMessage( urm_GETSCROLLPOS );
 
 	CRect rect;
 	GetClientRect( rect );
@@ -234,7 +234,7 @@ void CRRECRuler::OnPaint()
 	CStdGrfx::drawdoublesunken3dFrame( &dc, winRect );
 
 	// Draw tab markers
-	int max = m_tabs.GetSize();
+	int max = (int)m_tabs.GetSize();
 	for( t = 0 ; t < max ; t++ )
 	{
 
@@ -373,10 +373,10 @@ void CRRECRuler::SetTabStops( const CDWordArray& arr )
 {
 
 	m_tabs.RemoveAll();
-	int max = arr.GetSize();
-	for ( int t = 0 ; t < max ; t++ )
+	int max = (int)arr.GetSize();
+	for (int t = 0 ; t < max ; t++)
 	{
-		m_tabs.Add( arr[ t ] );
+		m_tabs.Add(arr[ t ]);
 	}
 
 }

+ 13 - 13
RulerRichEditCtrl/RulerRichEditCtrl.cpp

@@ -71,22 +71,22 @@ UINT urm_SETCURRENTFONTCOLOR = ::RegisterWindowMessage( _T( "_RULERRICHEDITCTRL_
 // Stream callback functions
 // Callbacks to the Save and Load functions.
 
-static DWORD CALLBACK StreamOut( DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb )
+static DWORD CALLBACK StreamOut( DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb )
 {
 
 	// Setting up temp buffer
 	char*	buff;
-	buff = new char[ cb + 1 ];
-	buff[ cb ] = ( char ) 0;
-	strncpy( buff, ( LPCSTR ) pbBuff, cb );
-	int max = strlen( buff );
+	buff = new char[cb + 1];
+	buff[cb] = ( char ) 0;
+	strncpy(buff, (LPCSTR)pbBuff, cb);
+	int max = (int)strlen(buff);
 
-	CString* str = ( CString* ) dwCookie;
+	CString* str = (CString*) dwCookie;
 
 #ifdef _UNICODE
 
 	// We want to convert the buff to wide chars
-	int length = ::MultiByteToWideChar( CP_UTF8, 0, buff, max, NULL, 0 );
+	int length = ::MultiByteToWideChar(CP_UTF8, 0, buff, max, NULL, 0);
 	if(length)
 	{
 		TCHAR* wBuff = new TCHAR[length+1];
@@ -109,7 +109,7 @@ static DWORD CALLBACK StreamOut( DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG *p
 
 }
 
-static DWORD CALLBACK StreamIn( DWORD dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb )
+static DWORD CALLBACK StreamIn( DWORD_PTR dwCookie, LPBYTE pbBuff, LONG cb, LONG *pcb )
 {
 
 	CString* str = ( ( CString* ) dwCookie );
@@ -848,7 +848,7 @@ void CRulerRichEditCtrl::SetText(CString sText)
 	// Read the text in
 	EDITSTREAM es;
 	es.dwError = 0;
-	es.pfnCallback = StreamIn;
+//	es.pfnCallback = StreamIn;
 #ifdef _UNICODE
 	CString cs;
 	es.dwCookie = (DWORD) &cs;
@@ -968,7 +968,7 @@ BOOL CRulerRichEditCtrl::Load( CString& filename )
 	{
 		EDITSTREAM	es;
 		es.dwCookie = ( DWORD ) str;
-		es.pfnCallback = StreamIn;
+//		es.pfnCallback = StreamIn;
 		m_rtf.StreamIn( SF_RTF, es );
 	}
 
@@ -1588,7 +1588,7 @@ LRESULT CRulerRichEditCtrl::OnSetCurrentFontName( WPARAM font, LPARAM )
 	
 }
 
-LRESULT CRulerRichEditCtrl::OnSetCurrentFontSize( WPARAM, LPARAM size )
+LRESULT CRulerRichEditCtrl::OnSetCurrentFontSize(WPARAM, LPARAM size)
 /* ============================================================
 	Function :		CRulerRichEditCtrl::OnSetCurrentFontSize
 	Description :	Handler for the registered message 
@@ -1606,12 +1606,12 @@ LRESULT CRulerRichEditCtrl::OnSetCurrentFontSize( WPARAM, LPARAM size )
    ============================================================*/
 {
 
-	SetCurrentFontSize( size );
+	SetCurrentFontSize((int)size);
 	return 0;
 	
 }
 
-LRESULT CRulerRichEditCtrl::OnSetCurrentFontColor( WPARAM, LPARAM color )
+LRESULT CRulerRichEditCtrl::OnSetCurrentFontColor(WPARAM, LPARAM color)
 /* ============================================================
 	Function :		CRulerRichEditCtrl::OnSetCurrentFontColor
 	Description :	Handler for the registered message 

+ 30 - 32
RulerRichEditCtrl/TextFile/TextFile.cpp

@@ -220,31 +220,29 @@ BOOL CTextFile::WriteTextFile( CString& filename, const CStringArray& contents )
 	CFileException feError;
 	BOOL result = TRUE;
 
-	if( filename.IsEmpty() )
-		result = GetFilename( TRUE, filename );
+	if(filename.IsEmpty())
+		result = GetFilename(TRUE, filename);
 
-	if( result )
+	if(result)
 	{
 		// Write file
-		if( file.Open( filename, CFile::modeWrite | CFile::modeCreate , &feError ) )
+		if(file.Open( filename, CFile::modeWrite | CFile::modeCreate , &feError))
 		{
-
-			int max = contents.GetSize();
-			for( int t = 0 ; t < max ; t++ )
-				file.WriteString( contents[ t ] + m_eol );
+			INT_PTR max = contents.GetSize();
+			for(int t = 0 ; t < max ; t++)
+			{
+				file.WriteString(contents[t] + m_eol);
+			}
 
 			file.Close();
-
 		}
 		else
 		{
-
 			// Set error message
 			TCHAR	errBuff[256];
-			feError.GetErrorMessage( errBuff, 256 );
+			feError.GetErrorMessage(errBuff, 256);
 			m_error = errBuff;
 			result = FALSE;
-
 		}
 	}
 
@@ -387,30 +385,28 @@ BOOL CTextFile::AppendFile( CString& filename, const CStringArray& contents )
 	CFileException feError;
 	BOOL result = TRUE;
 
-	if( filename.IsEmpty() )
-		result = GetFilename( TRUE, filename );
+	if(filename.IsEmpty())
+		result = GetFilename(TRUE, filename);
 
-	if( result )
+	if(result)
 	{
 		// Write the file
-		if( file.Open( filename, CFile::modeWrite | CFile::modeCreate | CFile::modeNoTruncate, &feError ) ) 
+		if(file.Open(filename, CFile::modeWrite | CFile::modeCreate | CFile::modeNoTruncate, &feError)) 
 		{
 
 			file.SeekToEnd();
 
-			int max = contents.GetSize();
-			for( int t = 0 ; t < max ; t++ )
-				file.WriteString( contents[ t ] + m_eol );
+			INT_PTR max = contents.GetSize();
+			for(int t = 0 ; t < max ; t++)
+				file.WriteString(contents[t] + m_eol);
 
 			file.Close();
-
 		}
 		else
 		{
-
 			// Set error message
-			TCHAR	errBuff[256];
-			feError.GetErrorMessage( errBuff, 256 );
+			TCHAR errBuff[256];
+			feError.GetErrorMessage(errBuff, 256);
 			m_error = errBuff;
 			result = FALSE;
 
@@ -486,23 +482,25 @@ BOOL CTextFile::Load( CString& filename, CListBox* list )
 	BOOL result = FALSE;
 
 	// Error checking
-	if( ValidParam( list ) )
+	if(ValidParam(list))
 	{
 
 		// Read the file
 		CStringArray contents;
-		if( ReadTextFile( filename, contents ) )
+		if(ReadTextFile( filename, contents))
 		{
-
 			// Set to listbox
-			int max = contents.GetSize();
-			for( int t = 0 ; t < max ; t++ )
-				if( contents[ t ].GetLength() )
-					list->AddString( contents[ t ] );
-			result = TRUE;
+			INT_PTR max = contents.GetSize();
+			for(int t = 0 ; t < max ; t++)
+			{
+				if(contents[t].GetLength())
+				{
+					list->AddString(contents[t]);
+				}
+			}
 
+			result = TRUE;
 		}
-
 	}
 
 	return result;

+ 1 - 1
Server.cpp

@@ -289,7 +289,7 @@ void CServer::OnExit(CSendInfo &info)
 
 	if(m_pClipList && m_pClipList->GetCount() > 0)
 	{
-		theApp.m_lClipsRecieved += m_pClipList->GetCount();
+		theApp.m_lClipsRecieved += (long)m_pClipList->GetCount();
 
 		//Post a message pClipList will be freed by the reciever
 		::PostMessage(theApp.m_MainhWnd, WM_ADD_TO_DATABASE_FROM_SOCKET, (WPARAM)m_pClipList, m_bSetToClipBoard);

+ 1 - 1
Shared/IClip.h

@@ -23,7 +23,7 @@ public:
 	virtual IClipFormat *GetAt(int nPos) = 0;
 	virtual void DeleteAt(int nPos) = 0;
 	virtual void DeleteAll() = 0;
-	virtual int AddNew(CLIPFORMAT type, HGLOBAL data) = 0;
+	virtual INT_PTR AddNew(CLIPFORMAT type, HGLOBAL data) = 0;
 	virtual IClipFormat *FindFormatEx(CLIPFORMAT type) = 0;
 };
 

+ 1 - 1
StdAfx.h

@@ -36,7 +36,7 @@
 #include "UnicodeMacros.h"
 
 #include <imm.h>
-#import "riched20.dll" raw_interfaces_only, raw_native_types, no_namespace, named_guids, exclude("UINT_PTR") 
+#import "riched20.dll" raw_interfaces_only, raw_native_types, no_namespace, named_guids, exclude("UINT_PTR"), exclude("LONG_PTR") 
 
 
 //{{AFX_INSERT_LOCATION}}

+ 3 - 3
SystemTray.cpp

@@ -504,7 +504,7 @@ BOOL CSystemTray::Animate(UINT nDelayMilliSeconds, int nNumSeconds /*=-1*/)
     m_hSavedIcon = GetIcon();
 
 	// Setup a timer for the animation
-	m_uIDTimer = SetTimer(m_nTimerID, nDelayMilliSeconds, NULL);
+	m_uIDTimer = (UINT)SetTimer(m_nTimerID, nDelayMilliSeconds, NULL);
 
     return (m_uIDTimer != 0);
 }
@@ -775,7 +775,7 @@ BEGIN_MESSAGE_MAP(CSystemTray, CWnd)
     ON_REGISTERED_MESSAGE(CSystemTray::m_nTaskbarCreatedMsg, OnTaskbarCreated)
 END_MESSAGE_MAP()
 
-void CSystemTray::OnTimer(UINT nIDEvent) 
+void CSystemTray::OnTimer(UINT_PTR nIDEvent) 
 {
     if (nIDEvent != m_uIDTimer)
     {
@@ -814,7 +814,7 @@ void CSystemTray::OnSettingChange(UINT uFlags, LPCTSTR lpszSection)
 }
 #endif
 
-LRESULT CSystemTray::OnTrayNotification(UINT wParam, LONG lParam) 
+LRESULT CSystemTray::OnTrayNotification(WPARAM wParam, LPARAM lParam) 
 {
     //Return quickly if its not for this tray icon
     if (wParam != m_tnd.uID)

+ 1 - 1
SystemTray.h

@@ -188,7 +188,7 @@ protected:
 // Generated message map functions
 protected:
 	//{{AFX_MSG(CSystemTray)
-	afx_msg void OnTimer(UINT nIDEvent);
+	afx_msg void OnTimer(UINT_PTR nIDEvent);
 	//}}AFX_MSG
 #ifndef _WIN32_WCE
 	afx_msg void OnSettingChange(UINT uFlags, LPCTSTR lpszSection);

+ 5 - 5
TabCtrl.cpp

@@ -170,7 +170,7 @@ void CTabCtrlEx::SetTabHeight(int nTabHeight)
 
 bool CTabCtrlEx::AddItem(const CString& csTabTitle, CWnd* pTabWnd)
 {
-	return InsertItem(m_Tabs.GetSize(), csTabTitle, pTabWnd);
+	return InsertItem((int)m_Tabs.GetSize(), csTabTitle, pTabWnd);
 }
 
 bool CTabCtrlEx::InsertItem(int nTab, const CString& csTabTitle, CWnd* pTabWnd)
@@ -439,7 +439,7 @@ int CTabCtrlEx::GetActiveTab()
 
 int CTabCtrlEx::GetTabCount()
 {
-	return m_Tabs.GetSize();
+	return (int)m_Tabs.GetSize();
 }
 
 void CTabCtrlEx::SetActiveTab(int nTab, bool bNotify)
@@ -866,7 +866,7 @@ void CTabCtrlEx::OnLButtonDown(UINT nFlags, CPoint point)
 	CWnd::OnLButtonDown(nFlags, point);
 }
 
-void CTabCtrlEx::OnTimer(UINT nIDEvent) 
+void CTabCtrlEx::OnTimer(UINT_PTR nIDEvent) 
 {
 	if (nIDEvent == ID_SCROLL_TIMER)
 	{
@@ -1035,7 +1035,7 @@ BOOL CTabCtrlEx::PreTranslateMessage(MSG* pMsg)
 			else if (((pMsg->wParam - '1') >= 0) && ((pMsg->wParam - '1') < (UINT) m_Tabs.GetSize()))
 			{
 				// Set the new active tab
-				ActivateTab(pMsg->wParam - '1', true);
+				ActivateTab((int)pMsg->wParam - '1', true);
 				return TRUE;
 			}
 		}
@@ -1054,7 +1054,7 @@ void CTabCtrlEx::SwitchTabs(bool bNext)
 		nNewTab--;
 
 	if (nNewTab < 0)
-		nNewTab = m_Tabs.GetSize()-1;
+		nNewTab = (int)m_Tabs.GetSize()-1;
 	else if (nNewTab >= m_Tabs.GetSize())
 		nNewTab = 0;
 

+ 1 - 1
TabCtrl.h

@@ -165,7 +165,7 @@ protected:
 	afx_msg void OnPaint();
 	afx_msg int OnCreate(LPCREATESTRUCT lpCreateStruct);
 	afx_msg void OnLButtonDown(UINT nFlags, CPoint point);
-	afx_msg void OnTimer(UINT nIDEvent);
+	afx_msg void OnTimer(UINT_PTR nIDEvent);
 	afx_msg void OnMouseMove(UINT nFlags, CPoint point);
 	afx_msg void OnLButtonUp(UINT nFlags, CPoint point);
 	afx_msg void OnSize(UINT nType, int cx, int cy);

+ 252 - 197
TinyXml/tinystr.h

@@ -1,44 +1,52 @@
 /*
 www.sourceforge.net/projects/tinyxml
-Original file by Yves Berquin.
 
-This software is provided 'as-is', without any express or implied 
-warranty. In no event will the authors be held liable for any 
+This software is provided 'as-is', without any express or implied
+warranty. In no event will the authors be held liable for any
 damages arising from the use of this software.
 
-Permission is granted to anyone to use this software for any 
-purpose, including commercial applications, and to alter it and 
+Permission is granted to anyone to use this software for any
+purpose, including commercial applications, and to alter it and
 redistribute it freely, subject to the following restrictions:
 
-1. The origin of this software must not be misrepresented; you must 
-not claim that you wrote the original software. If you use this 
-software in a product, an acknowledgment in the product documentation 
+1. The origin of this software must not be misrepresented; you must
+not claim that you wrote the original software. If you use this
+software in a product, an acknowledgment in the product documentation
 would be appreciated but is not required.
 
 2. Altered source versions must be plainly marked as such, and
 must not be misrepresented as being the original software.
 
-3. This notice may not be removed or altered from any source 
+3. This notice may not be removed or altered from any source
 distribution.
 */
 
-#include "tinyxml.h"
-
 
 #ifndef TIXML_USE_STL
 
 #ifndef TIXML_STRING_INCLUDED
 #define TIXML_STRING_INCLUDED
 
-#ifdef _MSC_VER
-#pragma warning( disable : 4530 )
-#pragma warning( disable : 4786 )
+#include <assert.h>
+#include <string.h>
+
+/*	The support for explicit isn't that universal, and it isn't really
+	required - it is used to check that the TiXmlString class isn't incorrectly
+	used. Be nice to old compilers and macro it here:
+*/
+#if defined(_MSC_VER) && (_MSC_VER >= 1200 )
+	// Microsoft visual studio, version 6 and higher.
+	#define TIXML_EXPLICIT explicit
+#elif defined(__GNUC__) && (__GNUC__ >= 3 )
+	// GCC version 3 and higher.s
+	#define TIXML_EXPLICIT explicit
+#else
+	#define TIXML_EXPLICIT
 #endif
 
-#include <assert.h>
 
 /*
-   TiXmlString is an emulation of the std::string template.
+   TiXmlString is an emulation of a subset of the std::string template.
    Its purpose is to allow compiling TinyXML on compilers with no or poor STL support.
    Only the member functions relevant to the TinyXML project have been implemented.
    The buffer allocation is made by a simplistic power of 2 like mechanism : if we increase
@@ -47,204 +55,251 @@ distribution.
 class TiXmlString
 {
   public :
-    // TiXmlString constructor, based on a string, mark explicit to force
-	// us to find unnecessary casting.
-    explicit TiXmlString (const char * instring);
-
-    // TiXmlString empty constructor
-    TiXmlString ()
-    {
-        allocated = 0;
-        cstring = NULL;
-        current_length = 0;
-    }
-
-    // TiXmlString copy constructor
-    explicit TiXmlString (const TiXmlString& copy);
-
-    // TiXmlString destructor
-    ~ TiXmlString ()
-    {
-        empty_it ();
-    }
-
-    // Convert a TiXmlString into a classical char *
-    const char * c_str () const
-    {
-        if (allocated)
-            return cstring;
-        return "";
-    }
-
-    // Return the length of a TiXmlString
-    size_t length () const
-	{
-		return ( allocated ) ? current_length : 0;
-	}
-
-    // TiXmlString = operator
-    void operator = (const char * content);
-
-    // = operator
-    void operator = (const TiXmlString & copy);
-
-    // += operator. Maps to append
-    TiXmlString& operator += (const char * suffix)
-    {
-        append (suffix);
-		return *this;
-    }
+	// The size type used
+  	typedef size_t size_type;
 
-    // += operator. Maps to append
-    TiXmlString& operator += (char single)
-    {
-        append (single);
-		return *this;
-    }
+	// Error value for find primitive
+	static const size_type npos; // = -1;
 
-    // += operator. Maps to append
-    TiXmlString& operator += (TiXmlString & suffix)
-    {
-        append (suffix);
-		return *this;
-    }
-    bool operator == (const TiXmlString & compare) const;
-    bool operator == (const char* compare) const;
-    bool operator < (const TiXmlString & compare) const;
-    bool operator > (const TiXmlString & compare) const;
-
-    // Checks if a TiXmlString is empty
-    bool empty () const
-    {
-        return length () ? false : true;
-    }
-
-    // single char extraction
-    const char& at (unsigned index) const
-    {
-        assert( index < length ());
-        return cstring [index];
-    }
-
-    // find a char in a string. Return TiXmlString::notfound if not found
-    unsigned find (char lookup) const
-    {
-        return find (lookup, 0);
-    }
-
-    // find a char in a string from an offset. Return TiXmlString::notfound if not found
-    unsigned find (char tofind, unsigned offset) const;
-
-    /*	Function to reserve a big amount of data when we know we'll need it. Be aware that this
-		function clears the content of the TiXmlString if any exists.
-    */
-    void reserve (unsigned size)
-    {
-        empty_it ();
-        if (size)
-        {
-            allocated = size;
-            cstring = new char [size];
-            cstring [0] = 0;
-            current_length = 0;
-        }
-    }
-
-    // [] operator 
-    char& operator [] (unsigned index) const
-    {
-        assert( index < length ());
-        return cstring [index];
-    }
-
-    // Error value for find primitive 
-    enum {	notfound = 0xffffffff,
-            npos = notfound };
-
-    void append (const char *str, size_t len );
-
-  protected :
-
-    // The base string
-    char * cstring;
-    // Number of chars allocated
-    size_t allocated;
-    // Current string size
-    size_t current_length;
-
-    // New size computation. It is simplistic right now : it returns twice the amount
-    // we need
-    size_t assign_new_size (size_t minimum_to_allocate)
-    {
-        return minimum_to_allocate * 2;
-    }
-
-    // Internal function that clears the content of a TiXmlString
-    void empty_it ()
-    {
-        if (cstring)
-            delete [] cstring;
-        cstring = NULL;
-        allocated = 0;
-        current_length = 0;
-    }
-
-    void append (const char *suffix );
-
-    // append function for another TiXmlString
-    void append (const TiXmlString & suffix)
-    {
-        append (suffix . c_str ());
-    }
-
-    // append for a single char.
-    void append (char single)
-    {
-        if ( cstring && current_length < (allocated-1) )
+
+	// TiXmlString empty constructor
+	TiXmlString () : rep_(&nullrep_)
+	{
+	}
+
+	// TiXmlString copy constructor
+	TiXmlString ( const TiXmlString & copy) : rep_(0)
+	{
+		init(copy.length());
+		memcpy(start(), copy.data(), length());
+	}
+
+	// TiXmlString constructor, based on a string
+	TIXML_EXPLICIT TiXmlString ( const char * copy) : rep_(0)
+	{
+		init( static_cast<size_type>( strlen(copy) ));
+		memcpy(start(), copy, length());
+	}
+
+	// TiXmlString constructor, based on a string
+	TIXML_EXPLICIT TiXmlString ( const char * str, size_type len) : rep_(0)
+	{
+		init(len);
+		memcpy(start(), str, len);
+	}
+
+	// TiXmlString destructor
+	~TiXmlString ()
+	{
+		quit();
+	}
+
+	TiXmlString& operator = (const char * copy)
+	{
+		return assign( copy, (size_type)strlen(copy));
+	}
+
+	TiXmlString& operator = (const TiXmlString & copy)
+	{
+		return assign(copy.start(), copy.length());
+	}
+
+
+	// += operator. Maps to append
+	TiXmlString& operator += (const char * suffix)
+	{
+		return append(suffix, static_cast<size_type>( strlen(suffix) ));
+	}
+
+	// += operator. Maps to append
+	TiXmlString& operator += (char single)
+	{
+		return append(&single, 1);
+	}
+
+	// += operator. Maps to append
+	TiXmlString& operator += (const TiXmlString & suffix)
+	{
+		return append(suffix.data(), suffix.length());
+	}
+
+
+	// Convert a TiXmlString into a null-terminated char *
+	const char * c_str () const { return rep_->str; }
+
+	// Convert a TiXmlString into a char * (need not be null terminated).
+	const char * data () const { return rep_->str; }
+
+	// Return the length of a TiXmlString
+	size_type length () const { return rep_->size; }
+
+	// Alias for length()
+	size_type size () const { return rep_->size; }
+
+	// Checks if a TiXmlString is empty
+	bool empty () const { return rep_->size == 0; }
+
+	// Return capacity of string
+	size_type capacity () const { return rep_->capacity; }
+
+
+	// single char extraction
+	const char& at (size_type index) const
+	{
+		assert( index < length() );
+		return rep_->str[ index ];
+	}
+
+	// [] operator
+	char& operator [] (size_type index) const
+	{
+		assert( index < length() );
+		return rep_->str[ index ];
+	}
+
+	// find a char in a string. Return TiXmlString::npos if not found
+	size_type find (char lookup) const
+	{
+		return find(lookup, 0);
+	}
+
+	// find a char in a string from an offset. Return TiXmlString::npos if not found
+	size_type find (char tofind, size_type offset) const
+	{
+		if (offset >= length()) return npos;
+
+		for (const char* p = c_str() + offset; *p != '\0'; ++p)
+		{
+		   if (*p == tofind) return static_cast< size_type >( p - c_str() );
+		}
+		return npos;
+	}
+
+	void clear ()
+	{
+		//Lee:
+		//The original was just too strange, though correct:
+		//	TiXmlString().swap(*this);
+		//Instead use the quit & re-init:
+		quit();
+		init(0,0);
+	}
+
+	/*	Function to reserve a big amount of data when we know we'll need it. Be aware that this
+		function DOES NOT clear the content of the TiXmlString if any exists.
+	*/
+	void reserve (size_type cap);
+
+	TiXmlString& assign (const char* str, size_type len);
+
+	TiXmlString& append (const char* str, size_type len);
+
+	void swap (TiXmlString& other)
+	{
+		Rep* r = rep_;
+		rep_ = other.rep_;
+		other.rep_ = r;
+	}
+
+  private:
+
+	void init(size_type sz) { init(sz, sz); }
+	void set_size(size_type sz) { rep_->str[ rep_->size = sz ] = '\0'; }
+	char* start() const { return rep_->str; }
+	char* finish() const { return rep_->str + rep_->size; }
+
+	struct Rep
+	{
+		size_type size, capacity;
+		char str[1];
+	};
+
+	void init(size_type sz, size_type cap)
+	{
+		if (cap)
 		{
-			cstring[ current_length ] = single;
-			++current_length;
-			cstring[ current_length ] = 0;
+			// Lee: the original form:
+			//	rep_ = static_cast<Rep*>(operator new(sizeof(Rep) + cap));
+			// doesn't work in some cases of new being overloaded. Switching
+			// to the normal allocation, although use an 'int' for systems
+			// that are overly picky about structure alignment.
+			const size_type bytesNeeded = sizeof(Rep) + cap;
+			const size_type intsNeeded = ( bytesNeeded + sizeof(int) - 1 ) / sizeof( int ); 
+			rep_ = reinterpret_cast<Rep*>( new int[ intsNeeded ] );
+
+			rep_->str[ rep_->size = sz ] = '\0';
+			rep_->capacity = cap;
 		}
 		else
 		{
-			char smallstr [2];
-			smallstr [0] = single;
-			smallstr [1] = 0;
-			append (smallstr);
+			rep_ = &nullrep_;
+		}
+	}
+
+	void quit()
+	{
+		if (rep_ != &nullrep_)
+		{
+			// The rep_ is really an array of ints. (see the allocator, above).
+			// Cast it back before delete, so the compiler won't incorrectly call destructors.
+			delete [] ( reinterpret_cast<int*>( rep_ ) );
 		}
-    }
+	}
+
+	Rep * rep_;
+	static Rep nullrep_;
 
 } ;
 
-/* 
+
+inline bool operator == (const TiXmlString & a, const TiXmlString & b)
+{
+	return    ( a.length() == b.length() )				// optimization on some platforms
+	       && ( strcmp(a.c_str(), b.c_str()) == 0 );	// actual compare
+}
+inline bool operator < (const TiXmlString & a, const TiXmlString & b)
+{
+	return strcmp(a.c_str(), b.c_str()) < 0;
+}
+
+inline bool operator != (const TiXmlString & a, const TiXmlString & b) { return !(a == b); }
+inline bool operator >  (const TiXmlString & a, const TiXmlString & b) { return b < a; }
+inline bool operator <= (const TiXmlString & a, const TiXmlString & b) { return !(b < a); }
+inline bool operator >= (const TiXmlString & a, const TiXmlString & b) { return !(a < b); }
+
+inline bool operator == (const TiXmlString & a, const char* b) { return strcmp(a.c_str(), b) == 0; }
+inline bool operator == (const char* a, const TiXmlString & b) { return b == a; }
+inline bool operator != (const TiXmlString & a, const char* b) { return !(a == b); }
+inline bool operator != (const char* a, const TiXmlString & b) { return !(b == a); }
+
+TiXmlString operator + (const TiXmlString & a, const TiXmlString & b);
+TiXmlString operator + (const TiXmlString & a, const char* b);
+TiXmlString operator + (const char* a, const TiXmlString & b);
+
+
+/*
    TiXmlOutStream is an emulation of std::ostream. It is based on TiXmlString.
    Only the operators that we need for TinyXML have been developped.
 */
 class TiXmlOutStream : public TiXmlString
 {
 public :
-    TiXmlOutStream () : TiXmlString () {}
-
-    // TiXmlOutStream << operator. Maps to TiXmlString::append
-    TiXmlOutStream & operator << (const char * in)
-    {
-        append (in);
-        return (* this);
-    }
-
-    // TiXmlOutStream << operator. Maps to TiXmlString::append
-    TiXmlOutStream & operator << (const TiXmlString & in)
-    {
-        append (in . c_str ());
-        return (* this);
-    }
-} ;
 
-#ifdef _MSC_VER
-#pragma warning( default : 4530 )
-#pragma warning( default : 4786 )
-#endif
+	// TiXmlOutStream << operator.
+	TiXmlOutStream & operator << (const TiXmlString & in)
+	{
+		*this += in;
+		return *this;
+	}
+
+	// TiXmlOutStream << operator.
+	TiXmlOutStream & operator << (const char * in)
+	{
+		*this += in;
+		return *this;
+	}
+
+} ;
 
 #endif	// TIXML_STRING_INCLUDED
 #endif	// TIXML_USE_STL

File diff suppressed because it is too large
+ 417 - 170
TinyXml/tinyxml.h


BIN
TinyXml/tinyxml.lib


BIN
TinyXml/tinyxml64.lib


BIN
TinyXml/tinyxmld.lib


BIN
TinyXml/tinyxmld64.lib


+ 6 - 3
ToolTipEx.cpp

@@ -33,9 +33,12 @@ CToolTipEx::~CToolTipEx()
 
 BEGIN_MESSAGE_MAP(CToolTipEx, CWnd)
 //{{AFX_MSG_MAP(CToolTipEx)
-ON_WM_PAINT()ON_WM_SIZE()ON_WM_NCHITTEST()ON_WM_ACTIVATE()
-//}}AFX_MSG_MAP
-ON_WM_TIMER()END_MESSAGE_MAP()
+ON_WM_PAINT()
+ON_WM_SIZE()
+ON_WM_NCHITTEST()
+ON_WM_ACTIVATE()
+ON_WM_TIMER()
+END_MESSAGE_MAP() 
 
 
 /////////////////////////////////////////////////////////////////////////////

+ 92 - 0
U3Stop/U3Stop.vcxproj

@@ -5,10 +5,18 @@
       <Configuration>Debug</Configuration>
       <Platform>Win32</Platform>
     </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
     <ProjectConfiguration Include="Release|Win32">
       <Configuration>Release</Configuration>
       <Platform>Win32</Platform>
     </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
   </ItemGroup>
   <PropertyGroup Label="Globals">
     <ProjectName>U3DittoStop</ProjectName>
@@ -22,35 +30,63 @@
     <UseOfMfc>Dynamic</UseOfMfc>
     <CharacterSet>MultiByte</CharacterSet>
   </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <CharacterSet>MultiByte</CharacterSet>
+  </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="Configuration">
     <ConfigurationType>Application</ConfigurationType>
     <UseOfMfc>Dynamic</UseOfMfc>
     <CharacterSet>MultiByte</CharacterSet>
   </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>Application</ConfigurationType>
+    <UseOfMfc>Dynamic</UseOfMfc>
+    <CharacterSet>MultiByte</CharacterSet>
+  </PropertyGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   <ImportGroup Label="ExtensionSettings">
   </ImportGroup>
   <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
   </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
+  </ImportGroup>
   <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" Label="PropertySheets">
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
   </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
+  </ImportGroup>
   <PropertyGroup Label="UserMacros" />
   <PropertyGroup>
     <_ProjectFileVersion>10.0.21006.1</_ProjectFileVersion>
     <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Debug\</OutDir>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Debug\</OutDir>
     <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Debug\</IntDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Debug\</IntDir>
     <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
     <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Release\</OutDir>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Release\</OutDir>
     <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Release\</IntDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Release\</IntDir>
     <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
     <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
+    <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
     <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
+    <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
     <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
+    <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
     <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
+    <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
     <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
+    <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
     <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
+    <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
   </PropertyGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <ClCompile>
@@ -82,6 +118,34 @@
       <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
     </ResourceCompile>
   </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <ClCompile>
+      <Optimization>Disabled</Optimization>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+    </ClCompile>
+    <Link>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <SubSystem>Windows</SubSystem>
+      <GenerateMapFile>true</GenerateMapFile>
+      <MapFileName>$(TargetDir)$(TargetName).map</MapFileName>
+      <MapExports>true</MapExports>
+    </Link>
+    <Midl>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+    </Midl>
+    <ResourceCompile>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0409</Culture>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+  </ItemDefinitionGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
     <ClCompile>
       <PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
@@ -109,10 +173,38 @@
       <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
     </ResourceCompile>
   </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <ClCompile>
+      <PreprocessorDefinitions>WIN32;_WINDOWS;NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MinimalRebuild>false</MinimalRebuild>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <TreatWChar_tAsBuiltInType>true</TreatWChar_tAsBuiltInType>
+      <PrecompiledHeader>Use</PrecompiledHeader>
+      <WarningLevel>Level3</WarningLevel>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+    </ClCompile>
+    <Link>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <SubSystem>Windows</SubSystem>
+      <OptimizeReferences>true</OptimizeReferences>
+      <EnableCOMDATFolding>true</EnableCOMDATFolding>
+    </Link>
+    <Midl>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>false</MkTypLibCompatible>
+    </Midl>
+    <ResourceCompile>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0409</Culture>
+      <AdditionalIncludeDirectories>$(IntDir);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
+    </ResourceCompile>
+  </ItemDefinitionGroup>
   <ItemGroup>
     <ClCompile Include="stdafx.cpp">
       <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">Create</PrecompiledHeader>
       <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">Create</PrecompiledHeader>
+      <PrecompiledHeader Condition="'$(Configuration)|$(Platform)'=='Release|x64'">Create</PrecompiledHeader>
     </ClCompile>
     <ClCompile Include="U3Start.cpp" />
   </ItemGroup>

+ 2 - 2
WndEx.cpp

@@ -339,7 +339,7 @@ BOOL CWndEx::OnEraseBkgnd(CDC* pDC)
 	return CWnd::OnEraseBkgnd(pDC);
 }
 
-void CWndEx::OnTimer(UINT nIDEvent)
+void CWndEx::OnTimer(UINT_PTR nIDEvent)
 {
 	if(nIDEvent == TIMER_AUTO_MAX)
 	{
@@ -348,7 +348,7 @@ void CWndEx::OnTimer(UINT nIDEvent)
 			CPoint cp;
 			GetCursorPos(&cp);
 			
-			UINT nHitTest = OnNcHitTest(cp);
+			UINT nHitTest = (UINT)OnNcHitTest(cp);
 			
 			ScreenToClient(&cp);
 			

+ 1 - 1
WndEx.h

@@ -67,7 +67,7 @@ protected:
 	afx_msg void OnNcMouseMove(UINT nHitTest, CPoint point);
 	afx_msg void OnNcLButtonUp(UINT nHitTest, CPoint point);
 	afx_msg BOOL OnEraseBkgnd(CDC* pDC);
-	afx_msg void OnTimer(UINT nIDEvent);
+	afx_msg void OnTimer(UINT_PTR nIDEvent);
 	afx_msg void OnWindowPosChanging(WINDOWPOS* lpwndpos);
 	afx_msg void OnInitMenuPopup(CMenu *pPopupMenu, UINT nIndex,BOOL bSysMenu);
 	//}}AFX_MSG

+ 0 - 206
focusdll/focus.vcproj

@@ -1,206 +0,0 @@
-<?xml version="1.0" encoding="Windows-1252"?>
-<VisualStudioProject
-	ProjectType="Visual C++"
-	Version="7.10"
-	Name="focus"
-	ProjectGUID="{E4AB8C80-F35F-451E-853B-07CEDD49E500}"
-	RootNamespace="focus">
-	<Platforms>
-		<Platform
-			Name="Win32"/>
-	</Platforms>
-	<ToolFiles>
-	</ToolFiles>
-	<Configurations>
-		<Configuration
-			Name="Release|Win32"
-			OutputDirectory=".\Release"
-			IntermediateDirectory=".\Release"
-			ConfigurationType="2"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="false"
-			CharacterSet="2">
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCMIDLTool"
-				PreprocessorDefinitions="NDEBUG"
-				MkTypLibCompatible="true"
-				SuppressStartupBanner="true"
-				TargetEnvironment="1"
-				TypeLibraryName=".\Release/focus.tlb"
-				HeaderFileName=""/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="2"
-				InlineFunctionExpansion="1"
-				PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;FOCUS_EXPORTS"
-				StringPooling="true"
-				RuntimeLibrary="0"
-				EnableFunctionLevelLinking="true"
-				PrecompiledHeaderFile=".\Release/focus.pch"
-				AssemblerListingLocation=".\Release/"
-				ObjectFile=".\Release/"
-				ProgramDataBaseFileName=".\Release/"
-				WarningLevel="3"
-				SuppressStartupBanner="true"/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="NDEBUG"
-				Culture="2057"/>
-			<Tool
-				Name="VCPreLinkEventTool"
-			/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="odbc32.lib odbccp32.lib Winmm.lib"
-				OutputFile=".\Release/focus.dll"
-				LinkIncremental="1"
-				SuppressStartupBanner="true"
-				ProgramDatabaseFile=".\Release/focus.pdb"
-				ImportLibrary=".\Release/focus.lib"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCALinkTool"/>
-			<Tool
-				Name="VCManifestTool"/>
-			<Tool
-				Name="VCXDCMakeTool"/>
-			<Tool
-				Name="VCBscMakeTool"
-				SuppressStartupBanner="true"
-				OutputFile=".\Release/focus.bsc"/>
-			<Tool
-				Name="VCFxCopTool"/>
-			<Tool
-				Name="VCAppVerifierTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCPostBuildEventTool"
-				CommandLine="copy $(OutDir)\*.lib ..\Release&#x0D;&#x0A;copy $(OutDir)\*.dll ..\Release&#x0D;&#x0A;"/>
-		</Configuration>
-		<Configuration
-			Name="Debug|Win32"
-			OutputDirectory=".\Debug"
-			IntermediateDirectory=".\Debug"
-			ConfigurationType="2"
-			InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC60.vsprops"
-			UseOfMFC="0"
-			ATLMinimizesCRunTimeLibraryUsage="false"
-			CharacterSet="2">
-			<Tool
-				Name="VCPreBuildEventTool"/>
-			<Tool
-				Name="VCCustomBuildTool"/>
-			<Tool
-				Name="VCXMLDataGeneratorTool"/>
-			<Tool
-				Name="VCWebServiceProxyGeneratorTool"/>
-			<Tool
-				Name="VCMIDLTool"
-				PreprocessorDefinitions="_DEBUG"
-				MkTypLibCompatible="true"
-				SuppressStartupBanner="true"
-				TargetEnvironment="1"
-				TypeLibraryName=".\Debug/focus.tlb"
-				HeaderFileName=""/>
-			<Tool
-				Name="VCCLCompilerTool"
-				Optimization="0"
-				PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;FOCUS_EXPORTS"
-				MinimalRebuild="true"
-				BasicRuntimeChecks="3"
-				RuntimeLibrary="1"
-				PrecompiledHeaderFile=".\Debug/focus.pch"
-				AssemblerListingLocation=".\Debug/"
-				ObjectFile=".\Debug/"
-				ProgramDataBaseFileName=".\Debug/"
-				WarningLevel="3"
-				SuppressStartupBanner="true"
-				DebugInformationFormat="4"/>
-			<Tool
-				Name="VCManagedResourceCompilerTool"/>
-			<Tool
-				Name="VCResourceCompilerTool"
-				PreprocessorDefinitions="_DEBUG"
-				Culture="2057"/>
-			<Tool
-				Name="VCPreLinkEventTool"/>
-			<Tool
-				Name="VCLinkerTool"
-				AdditionalDependencies="odbc32.lib odbccp32.lib Winmm.lib"
-				OutputFile=".\Debug/focus.dll"
-				LinkIncremental="2"
-				SuppressStartupBanner="true"
-				GenerateDebugInformation="true"
-				ProgramDatabaseFile=".\Debug/focus.pdb"
-				ImportLibrary=".\Debug/focus.lib"
-				TargetMachine="1"/>
-			<Tool
-				Name="VCALinkTool"/>
-			<Tool
-				Name="VCManifestTool"/>
-			<Tool
-				Name="VCXDCMakeTool"/>
-			<Tool
-				Name="VCBscMakeTool"
-				SuppressStartupBanner="true"
-				OutputFile=".\Debug/focus.bsc"/>
-			<Tool
-				Name="VCFxCopTool"/>
-			<Tool
-				Name="VCAppVerifierTool"/>
-			<Tool
-				Name="VCWebDeploymentTool"/>
-			<Tool
-				Name="VCPostBuildEventTool"
-				CommandLine="copy $(OutDir)\*.lib ..\Debug&#x0D;&#x0A;copy $(OutDir)\*.dll ..\Debug&#x0D;&#x0A;"/>
-		</Configuration>
-	</Configurations>
-	<References>
-	</References>
-	<Files>
-		<Filter
-			Name="Source Files"
-			Filter="cpp;c;cxx;rc;def;r;odl;idl;hpj;bat">
-			<File
-				RelativePath="focusdll.cpp">
-				<FileConfiguration
-					Name="Release|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32">
-					<Tool
-						Name="VCCLCompilerTool"
-						PreprocessorDefinitions=""/>
-				</FileConfiguration>
-			</File>
-		</Filter>
-		<Filter
-			Name="Header Files"
-			Filter="h;hpp;hxx;hm;inl">
-			<File
-				RelativePath="focusdll.h">
-			</File>
-		</Filter>
-		<Filter
-			Name="Resource Files"
-			Filter="ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe">
-		</Filter>
-	</Files>
-	<Globals>
-	</Globals>
-</VisualStudioProject>

+ 143 - 5
focusdll/focus.vcxproj

@@ -5,10 +5,18 @@
       <Configuration>Debug</Configuration>
       <Platform>Win32</Platform>
     </ProjectConfiguration>
+    <ProjectConfiguration Include="Debug|x64">
+      <Configuration>Debug</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
     <ProjectConfiguration Include="Release|Win32">
       <Configuration>Release</Configuration>
       <Platform>Win32</Platform>
     </ProjectConfiguration>
+    <ProjectConfiguration Include="Release|x64">
+      <Configuration>Release</Configuration>
+      <Platform>x64</Platform>
+    </ProjectConfiguration>
   </ItemGroup>
   <PropertyGroup Label="Globals">
     <ProjectGuid>{E4AB8C80-F35F-451E-853B-07CEDD49E500}</ProjectGuid>
@@ -20,11 +28,21 @@
     <UseOfMfc>false</UseOfMfc>
     <CharacterSet>MultiByte</CharacterSet>
   </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseOfMfc>false</UseOfMfc>
+    <CharacterSet>MultiByte</CharacterSet>
+  </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="Configuration">
     <ConfigurationType>DynamicLibrary</ConfigurationType>
     <UseOfMfc>false</UseOfMfc>
     <CharacterSet>MultiByte</CharacterSet>
   </PropertyGroup>
+  <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="Configuration">
+    <ConfigurationType>DynamicLibrary</ConfigurationType>
+    <UseOfMfc>false</UseOfMfc>
+    <CharacterSet>MultiByte</CharacterSet>
+  </PropertyGroup>
   <Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" />
   <ImportGroup Label="ExtensionSettings">
   </ImportGroup>
@@ -32,25 +50,47 @@
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
     <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
   </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
+    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
+  </ImportGroup>
   <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" Label="PropertySheets">
     <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
     <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
   </ImportGroup>
+  <ImportGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'" Label="PropertySheets">
+    <Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" />
+    <Import Project="$(VCTargetsPath)Microsoft.CPP.UpgradeFromVC60.props" />
+  </ImportGroup>
   <PropertyGroup Label="UserMacros" />
   <PropertyGroup>
     <_ProjectFileVersion>10.0.21006.1</_ProjectFileVersion>
     <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\Release\</OutDir>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.\Release64\</OutDir>
     <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">.\Release\</IntDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Release|x64'">.\Release64\</IntDir>
     <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">false</LinkIncremental>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Release|x64'">false</LinkIncremental>
     <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\Debug\</OutDir>
+    <OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">.\Debug64\</OutDir>
     <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">.\Debug\</IntDir>
+    <IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">.\Debug64\</IntDir>
     <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental>
+    <LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">true</LinkIncremental>
     <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
+    <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
     <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
+    <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
     <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'" />
+    <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Debug|x64'" />
     <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">AllRules.ruleset</CodeAnalysisRuleSet>
+    <CodeAnalysisRuleSet Condition="'$(Configuration)|$(Platform)'=='Release|x64'">AllRules.ruleset</CodeAnalysisRuleSet>
     <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
+    <CodeAnalysisRules Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
     <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|Win32'" />
+    <CodeAnalysisRuleAssemblies Condition="'$(Configuration)|$(Platform)'=='Release|x64'" />
+    <TargetName Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">focus64</TargetName>
+    <TargetName Condition="'$(Configuration)|$(Platform)'=='Release|x64'">focus64</TargetName>
   </PropertyGroup>
   <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
     <Midl>
@@ -67,7 +107,7 @@
       <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
       <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;FOCUS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <StringPooling>true</StringPooling>
-      <RuntimeLibrary>MultiThreaded</RuntimeLibrary>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
       <FunctionLevelLinking>true</FunctionLevelLinking>
       <PrecompiledHeaderOutputFile>.\Release/focus.pch</PrecompiledHeaderOutputFile>
       <AssemblerListingLocation>.\Release/</AssemblerListingLocation>
@@ -96,8 +136,56 @@
       <OutputFile>.\Release/focus.bsc</OutputFile>
     </Bscmake>
     <PostBuildEvent>
-      <Command>copy $(TargetDir)*.lib ..\Release
+      <Command>copy $(TargetDir)*.lib ..\
 copy $(TargetDir)*.dll ..\Release
+</Command>
+    </PostBuildEvent>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Release|x64'">
+    <Midl>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>true</MkTypLibCompatible>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <TypeLibraryName>.\Release64/focus64.tlb</TypeLibraryName>
+      <HeaderFileName>
+      </HeaderFileName>
+    </Midl>
+    <ClCompile>
+      <Optimization>MaxSpeed</Optimization>
+      <InlineFunctionExpansion>OnlyExplicitInline</InlineFunctionExpansion>
+      <PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;_USRDLL;FOCUS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <StringPooling>true</StringPooling>
+      <RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
+      <FunctionLevelLinking>true</FunctionLevelLinking>
+      <PrecompiledHeaderOutputFile>.\Release64/focus64.pch</PrecompiledHeaderOutputFile>
+      <AssemblerListingLocation>.\Release64/</AssemblerListingLocation>
+      <ObjectFileName>.\Release64/</ObjectFileName>
+      <ProgramDataBaseFileName>.\Release64/</ProgramDataBaseFileName>
+      <WarningLevel>Level3</WarningLevel>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>NDEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0809</Culture>
+    </ResourceCompile>
+    <Link>
+      <AdditionalDependencies>odbc32.lib;odbccp32.lib;Winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <OutputFile>.\Release64/focus64.dll</OutputFile>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <ProgramDatabaseFile>.\Release64/focus64.pdb</ProgramDatabaseFile>
+      <ImportLibrary>
+      </ImportLibrary>
+      <GenerateMapFile>true</GenerateMapFile>
+      <MapFileName>.\Release64/focus64.map</MapFileName>
+      <MapExports>true</MapExports>
+    </Link>
+    <Bscmake>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <OutputFile>.\Release/focus64.bsc</OutputFile>
+    </Bscmake>
+    <PostBuildEvent>
+      <Command>copy $(TargetDir)*.lib $(TargetDir)..\..\
+copy $(TargetDir)*.dll $(TargetDir)..\..\Release64
 </Command>
     </PostBuildEvent>
   </ItemDefinitionGroup>
@@ -116,7 +204,7 @@ copy $(TargetDir)*.dll ..\Release
       <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;FOCUS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <MinimalRebuild>true</MinimalRebuild>
       <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
-      <RuntimeLibrary>MultiThreadedDebug</RuntimeLibrary>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
       <PrecompiledHeaderOutputFile>.\Debug/focus.pch</PrecompiledHeaderOutputFile>
       <AssemblerListingLocation>.\Debug/</AssemblerListingLocation>
       <ObjectFileName>.\Debug/</ObjectFileName>
@@ -146,15 +234,65 @@ copy $(TargetDir)*.dll ..\Release
       <OutputFile>.\Debug/focus.bsc</OutputFile>
     </Bscmake>
     <PostBuildEvent>
-      <Command>copy $(TargetDir)*.lib ..\Debug
-copy $(TargetDir)*.dll ..\Debug
+      <Command>copy $(TargetDir)*.lib $(TargetDir)..\..\
+copy $(TargetDir)*.dll $(TargetDir)..\..\Debug64
+</Command>
+    </PostBuildEvent>
+  </ItemDefinitionGroup>
+  <ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">
+    <Midl>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <MkTypLibCompatible>true</MkTypLibCompatible>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <TypeLibraryName>.\Debug64/focus64.tlb</TypeLibraryName>
+      <HeaderFileName>
+      </HeaderFileName>
+    </Midl>
+    <ClCompile>
+      <Optimization>Disabled</Optimization>
+      <PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;_USRDLL;FOCUS_EXPORTS;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
+      <RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary>
+      <PrecompiledHeaderOutputFile>.\Debug64/focus64.pch</PrecompiledHeaderOutputFile>
+      <AssemblerListingLocation>.\Debug64/</AssemblerListingLocation>
+      <ObjectFileName>.\Debug64/</ObjectFileName>
+      <ProgramDataBaseFileName>.\Debug64/</ProgramDataBaseFileName>
+      <WarningLevel>Level3</WarningLevel>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <DebugInformationFormat>ProgramDatabase</DebugInformationFormat>
+    </ClCompile>
+    <ResourceCompile>
+      <PreprocessorDefinitions>_DEBUG;%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <Culture>0x0809</Culture>
+    </ResourceCompile>
+    <Link>
+      <AdditionalDependencies>odbc32.lib;odbccp32.lib;Winmm.lib;%(AdditionalDependencies)</AdditionalDependencies>
+      <OutputFile>.\Debug64/focus64.dll</OutputFile>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <GenerateDebugInformation>true</GenerateDebugInformation>
+      <ProgramDatabaseFile>.\Debug64/focus64.pdb</ProgramDatabaseFile>
+      <ImportLibrary>
+      </ImportLibrary>
+      <GenerateMapFile>true</GenerateMapFile>
+      <MapFileName>.\Debug64/focus64.map</MapFileName>
+      <MapExports>true</MapExports>
+    </Link>
+    <Bscmake>
+      <SuppressStartupBanner>true</SuppressStartupBanner>
+      <OutputFile>.\Debug64/focus64.bsc</OutputFile>
+    </Bscmake>
+    <PostBuildEvent>
+      <Command>copy $(TargetDir)*.lib $(TargetDir)..\..\
+copy $(TargetDir)*.dll $(TargetDir)..\..\Debug64
 </Command>
     </PostBuildEvent>
   </ItemDefinitionGroup>
   <ItemGroup>
     <ClCompile Include="focusdll.cpp">
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Debug|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
       <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
+      <PreprocessorDefinitions Condition="'$(Configuration)|$(Platform)'=='Release|x64'">%(PreprocessorDefinitions)</PreprocessorDefinitions>
     </ClCompile>
   </ItemGroup>
   <ItemGroup>

+ 2 - 1
sqlite/CppSQLite3.cpp

@@ -28,6 +28,7 @@
 #include "StdAfx.h"
 #include "CppSQLite3.h"
 #include <cstdlib>
+#include "..\UnicodeMacros.h"
 
 
 // Named constant for passing to CppSQLite3Exception when passing it a string
@@ -373,6 +374,7 @@ int CppSQLite3Query::fieldIndex(const TCHAR* szField)
 		}
 	}
 
+
 	throw CppSQLite3Exception(CPPSQLITE_ERROR,
 							_T("Invalid field name requested"),
 							DONT_DELETE_MSG);
@@ -905,7 +907,6 @@ int CppSQLite3DB::execScalar(const TCHAR* szSQL)
 								_T("Invalid scalar query"),
 								DONT_DELETE_MSG);
 	}
-
 	return ATOI(q.fieldValue(0));
 }
 

+ 0 - 2
sqlite/GenerateSqlite3Lib.bat

@@ -1,2 +0,0 @@
-lib\lib.exe /def:sqlite3.def
-pause

+ 2909 - 0
sqlite/shell.c

@@ -0,0 +1,2909 @@
+/*
+** 2001 September 15
+**
+** The author disclaims copyright to this source code.  In place of
+** a legal notice, here is a blessing:
+**
+**    May you do good and not evil.
+**    May you find forgiveness for yourself and forgive others.
+**    May you share freely, never taking more than you give.
+**
+*************************************************************************
+** This file contains code to implement the "sqlite" command line
+** utility for accessing SQLite databases.
+*/
+#if defined(_WIN32) || defined(WIN32)
+/* This needs to come before any includes for MSVC compiler */
+#define _CRT_SECURE_NO_WARNINGS
+#endif
+
+#include <stdlib.h>
+#include <string.h>
+#include <stdio.h>
+#include <assert.h>
+#include "sqlite3.h"
+#include <ctype.h>
+#include <stdarg.h>
+
+#if !defined(_WIN32) && !defined(WIN32) && !defined(__OS2__)
+# include <signal.h>
+# if !defined(__RTP__) && !defined(_WRS_KERNEL)
+#  include <pwd.h>
+# endif
+# include <unistd.h>
+# include <sys/types.h>
+#endif
+
+#ifdef __OS2__
+# include <unistd.h>
+#endif
+
+#ifdef HAVE_EDITLINE
+# include <editline/editline.h>
+#endif
+#if defined(HAVE_READLINE) && HAVE_READLINE==1
+# include <readline/readline.h>
+# include <readline/history.h>
+#endif
+#if !defined(HAVE_EDITLINE) && (!defined(HAVE_READLINE) || HAVE_READLINE!=1)
+# define readline(p) local_getline(p,stdin)
+# define add_history(X)
+# define read_history(X)
+# define write_history(X)
+# define stifle_history(X)
+#endif
+
+#if defined(_WIN32) || defined(WIN32)
+# include <io.h>
+#define isatty(h) _isatty(h)
+#define access(f,m) _access((f),(m))
+#else
+/* Make sure isatty() has a prototype.
+*/
+extern int isatty();
+#endif
+
+#if defined(_WIN32_WCE)
+/* Windows CE (arm-wince-mingw32ce-gcc) does not provide isatty()
+ * thus we always assume that we have a console. That can be
+ * overridden with the -batch command line option.
+ */
+#define isatty(x) 1
+#endif
+
+/* True if the timer is enabled */
+static int enableTimer = 0;
+
+#if !defined(_WIN32) && !defined(WIN32) && !defined(__OS2__) && !defined(__RTP__) && !defined(_WRS_KERNEL)
+#include <sys/time.h>
+#include <sys/resource.h>
+
+/* Saved resource information for the beginning of an operation */
+static struct rusage sBegin;
+
+/*
+** Begin timing an operation
+*/
+static void beginTimer(void){
+  if( enableTimer ){
+    getrusage(RUSAGE_SELF, &sBegin);
+  }
+}
+
+/* Return the difference of two time_structs in seconds */
+static double timeDiff(struct timeval *pStart, struct timeval *pEnd){
+  return (pEnd->tv_usec - pStart->tv_usec)*0.000001 + 
+         (double)(pEnd->tv_sec - pStart->tv_sec);
+}
+
+/*
+** Print the timing results.
+*/
+static void endTimer(void){
+  if( enableTimer ){
+    struct rusage sEnd;
+    getrusage(RUSAGE_SELF, &sEnd);
+    printf("CPU Time: user %f sys %f\n",
+       timeDiff(&sBegin.ru_utime, &sEnd.ru_utime),
+       timeDiff(&sBegin.ru_stime, &sEnd.ru_stime));
+  }
+}
+
+#define BEGIN_TIMER beginTimer()
+#define END_TIMER endTimer()
+#define HAS_TIMER 1
+
+#elif (defined(_WIN32) || defined(WIN32))
+
+#include <windows.h>
+
+/* Saved resource information for the beginning of an operation */
+static HANDLE hProcess;
+static FILETIME ftKernelBegin;
+static FILETIME ftUserBegin;
+typedef BOOL (WINAPI *GETPROCTIMES)(HANDLE, LPFILETIME, LPFILETIME, LPFILETIME, LPFILETIME);
+static GETPROCTIMES getProcessTimesAddr = NULL;
+
+/*
+** Check to see if we have timer support.  Return 1 if necessary
+** support found (or found previously).
+*/
+static int hasTimer(void){
+  if( getProcessTimesAddr ){
+    return 1;
+  } else {
+    /* GetProcessTimes() isn't supported in WIN95 and some other Windows versions.
+    ** See if the version we are running on has it, and if it does, save off
+    ** a pointer to it and the current process handle.
+    */
+    hProcess = GetCurrentProcess();
+    if( hProcess ){
+      HINSTANCE hinstLib = LoadLibrary(TEXT("Kernel32.dll"));
+      if( NULL != hinstLib ){
+        getProcessTimesAddr = (GETPROCTIMES) GetProcAddress(hinstLib, "GetProcessTimes");
+        if( NULL != getProcessTimesAddr ){
+          return 1;
+        }
+        FreeLibrary(hinstLib); 
+      }
+    }
+  }
+  return 0;
+}
+
+/*
+** Begin timing an operation
+*/
+static void beginTimer(void){
+  if( enableTimer && getProcessTimesAddr ){
+    FILETIME ftCreation, ftExit;
+    getProcessTimesAddr(hProcess, &ftCreation, &ftExit, &ftKernelBegin, &ftUserBegin);
+  }
+}
+
+/* Return the difference of two FILETIME structs in seconds */
+static double timeDiff(FILETIME *pStart, FILETIME *pEnd){
+  sqlite_int64 i64Start = *((sqlite_int64 *) pStart);
+  sqlite_int64 i64End = *((sqlite_int64 *) pEnd);
+  return (double) ((i64End - i64Start) / 10000000.0);
+}
+
+/*
+** Print the timing results.
+*/
+static void endTimer(void){
+  if( enableTimer && getProcessTimesAddr){
+    FILETIME ftCreation, ftExit, ftKernelEnd, ftUserEnd;
+    getProcessTimesAddr(hProcess, &ftCreation, &ftExit, &ftKernelEnd, &ftUserEnd);
+    printf("CPU Time: user %f sys %f\n",
+       timeDiff(&ftUserBegin, &ftUserEnd),
+       timeDiff(&ftKernelBegin, &ftKernelEnd));
+  }
+}
+
+#define BEGIN_TIMER beginTimer()
+#define END_TIMER endTimer()
+#define HAS_TIMER hasTimer()
+
+#else
+#define BEGIN_TIMER 
+#define END_TIMER
+#define HAS_TIMER 0
+#endif
+
+/*
+** Used to prevent warnings about unused parameters
+*/
+#define UNUSED_PARAMETER(x) (void)(x)
+
+/*
+** If the following flag is set, then command execution stops
+** at an error if we are not interactive.
+*/
+static int bail_on_error = 0;
+
+/*
+** Threat stdin as an interactive input if the following variable
+** is true.  Otherwise, assume stdin is connected to a file or pipe.
+*/
+static int stdin_is_interactive = 1;
+
+/*
+** The following is the open SQLite database.  We make a pointer
+** to this database a static variable so that it can be accessed
+** by the SIGINT handler to interrupt database processing.
+*/
+static sqlite3 *db = 0;
+
+/*
+** True if an interrupt (Control-C) has been received.
+*/
+static volatile int seenInterrupt = 0;
+
+/*
+** This is the name of our program. It is set in main(), used
+** in a number of other places, mostly for error messages.
+*/
+static char *Argv0;
+
+/*
+** Prompt strings. Initialized in main. Settable with
+**   .prompt main continue
+*/
+static char mainPrompt[20];     /* First line prompt. default: "sqlite> "*/
+static char continuePrompt[20]; /* Continuation prompt. default: "   ...> " */
+
+/*
+** Write I/O traces to the following stream.
+*/
+#ifdef SQLITE_ENABLE_IOTRACE
+static FILE *iotrace = 0;
+#endif
+
+/*
+** This routine works like printf in that its first argument is a
+** format string and subsequent arguments are values to be substituted
+** in place of % fields.  The result of formatting this string
+** is written to iotrace.
+*/
+#ifdef SQLITE_ENABLE_IOTRACE
+static void iotracePrintf(const char *zFormat, ...){
+  va_list ap;
+  char *z;
+  if( iotrace==0 ) return;
+  va_start(ap, zFormat);
+  z = sqlite3_vmprintf(zFormat, ap);
+  va_end(ap);
+  fprintf(iotrace, "%s", z);
+  sqlite3_free(z);
+}
+#endif
+
+
+/*
+** Determines if a string is a number of not.
+*/
+static int isNumber(const char *z, int *realnum){
+  if( *z=='-' || *z=='+' ) z++;
+  if( !isdigit(*z) ){
+    return 0;
+  }
+  z++;
+  if( realnum ) *realnum = 0;
+  while( isdigit(*z) ){ z++; }
+  if( *z=='.' ){
+    z++;
+    if( !isdigit(*z) ) return 0;
+    while( isdigit(*z) ){ z++; }
+    if( realnum ) *realnum = 1;
+  }
+  if( *z=='e' || *z=='E' ){
+    z++;
+    if( *z=='+' || *z=='-' ) z++;
+    if( !isdigit(*z) ) return 0;
+    while( isdigit(*z) ){ z++; }
+    if( realnum ) *realnum = 1;
+  }
+  return *z==0;
+}
+
+/*
+** A global char* and an SQL function to access its current value 
+** from within an SQL statement. This program used to use the 
+** sqlite_exec_printf() API to substitue a string into an SQL statement.
+** The correct way to do this with sqlite3 is to use the bind API, but
+** since the shell is built around the callback paradigm it would be a lot
+** of work. Instead just use this hack, which is quite harmless.
+*/
+static const char *zShellStatic = 0;
+static void shellstaticFunc(
+  sqlite3_context *context,
+  int argc,
+  sqlite3_value **argv
+){
+  assert( 0==argc );
+  assert( zShellStatic );
+  UNUSED_PARAMETER(argc);
+  UNUSED_PARAMETER(argv);
+  sqlite3_result_text(context, zShellStatic, -1, SQLITE_STATIC);
+}
+
+
+/*
+** This routine reads a line of text from FILE in, stores
+** the text in memory obtained from malloc() and returns a pointer
+** to the text.  NULL is returned at end of file, or if malloc()
+** fails.
+**
+** The interface is like "readline" but no command-line editing
+** is done.
+*/
+static char *local_getline(char *zPrompt, FILE *in){
+  char *zLine;
+  int nLine;
+  int n;
+  int eol;
+
+  if( zPrompt && *zPrompt ){
+    printf("%s",zPrompt);
+    fflush(stdout);
+  }
+  nLine = 100;
+  zLine = malloc( nLine );
+  if( zLine==0 ) return 0;
+  n = 0;
+  eol = 0;
+  while( !eol ){
+    if( n+100>nLine ){
+      nLine = nLine*2 + 100;
+      zLine = realloc(zLine, nLine);
+      if( zLine==0 ) return 0;
+    }
+    if( fgets(&zLine[n], nLine - n, in)==0 ){
+      if( n==0 ){
+        free(zLine);
+        return 0;
+      }
+      zLine[n] = 0;
+      eol = 1;
+      break;
+    }
+    while( zLine[n] ){ n++; }
+    if( n>0 && zLine[n-1]=='\n' ){
+      n--;
+      if( n>0 && zLine[n-1]=='\r' ) n--;
+      zLine[n] = 0;
+      eol = 1;
+    }
+  }
+  zLine = realloc( zLine, n+1 );
+  return zLine;
+}
+
+/*
+** Retrieve a single line of input text.
+**
+** zPrior is a string of prior text retrieved.  If not the empty
+** string, then issue a continuation prompt.
+*/
+static char *one_input_line(const char *zPrior, FILE *in){
+  char *zPrompt;
+  char *zResult;
+  if( in!=0 ){
+    return local_getline(0, in);
+  }
+  if( zPrior && zPrior[0] ){
+    zPrompt = continuePrompt;
+  }else{
+    zPrompt = mainPrompt;
+  }
+  zResult = readline(zPrompt);
+#if defined(HAVE_READLINE) && HAVE_READLINE==1
+  if( zResult && *zResult ) add_history(zResult);
+#endif
+  return zResult;
+}
+
+struct previous_mode_data {
+  int valid;        /* Is there legit data in here? */
+  int mode;
+  int showHeader;
+  int colWidth[100];
+};
+
+/*
+** An pointer to an instance of this structure is passed from
+** the main program to the callback.  This is used to communicate
+** state and mode information.
+*/
+struct callback_data {
+  sqlite3 *db;           /* The database */
+  int echoOn;            /* True to echo input commands */
+  int statsOn;           /* True to display memory stats before each finalize */
+  int cnt;               /* Number of records displayed so far */
+  FILE *out;             /* Write results here */
+  int mode;              /* An output mode setting */
+  int writableSchema;    /* True if PRAGMA writable_schema=ON */
+  int showHeader;        /* True to show column names in List or Column mode */
+  char *zDestTable;      /* Name of destination table when MODE_Insert */
+  char separator[20];    /* Separator character for MODE_List */
+  int colWidth[100];     /* Requested width of each column when in column mode*/
+  int actualWidth[100];  /* Actual width of each column */
+  char nullvalue[20];    /* The text to print when a NULL comes back from
+                         ** the database */
+  struct previous_mode_data explainPrev;
+                         /* Holds the mode information just before
+                         ** .explain ON */
+  char outfile[FILENAME_MAX]; /* Filename for *out */
+  const char *zDbFilename;    /* name of the database file */
+  const char *zVfs;           /* Name of VFS to use */
+  sqlite3_stmt *pStmt;   /* Current statement if any. */
+  FILE *pLog;            /* Write log output here */
+};
+
+/*
+** These are the allowed modes.
+*/
+#define MODE_Line     0  /* One column per line.  Blank line between records */
+#define MODE_Column   1  /* One record per line in neat columns */
+#define MODE_List     2  /* One record per line with a separator */
+#define MODE_Semi     3  /* Same as MODE_List but append ";" to each line */
+#define MODE_Html     4  /* Generate an XHTML table */
+#define MODE_Insert   5  /* Generate SQL "insert" statements */
+#define MODE_Tcl      6  /* Generate ANSI-C or TCL quoted elements */
+#define MODE_Csv      7  /* Quote strings, numbers are plain */
+#define MODE_Explain  8  /* Like MODE_Column, but do not truncate data */
+
+static const char *modeDescr[] = {
+  "line",
+  "column",
+  "list",
+  "semi",
+  "html",
+  "insert",
+  "tcl",
+  "csv",
+  "explain",
+};
+
+/*
+** Number of elements in an array
+*/
+#define ArraySize(X)  (int)(sizeof(X)/sizeof(X[0]))
+
+/*
+** Compute a string length that is limited to what can be stored in
+** lower 30 bits of a 32-bit signed integer.
+*/
+static int strlen30(const char *z){
+  const char *z2 = z;
+  while( *z2 ){ z2++; }
+  return 0x3fffffff & (int)(z2 - z);
+}
+
+/*
+** A callback for the sqlite3_log() interface.
+*/
+static void shellLog(void *pArg, int iErrCode, const char *zMsg){
+  struct callback_data *p = (struct callback_data*)pArg;
+  if( p->pLog==0 ) return;
+  fprintf(p->pLog, "(%d) %s\n", iErrCode, zMsg);
+  fflush(p->pLog);
+}
+
+/*
+** Output the given string as a hex-encoded blob (eg. X'1234' )
+*/
+static void output_hex_blob(FILE *out, const void *pBlob, int nBlob){
+  int i;
+  char *zBlob = (char *)pBlob;
+  fprintf(out,"X'");
+  for(i=0; i<nBlob; i++){ fprintf(out,"%02x",zBlob[i]); }
+  fprintf(out,"'");
+}
+
+/*
+** Output the given string as a quoted string using SQL quoting conventions.
+*/
+static void output_quoted_string(FILE *out, const char *z){
+  int i;
+  int nSingle = 0;
+  for(i=0; z[i]; i++){
+    if( z[i]=='\'' ) nSingle++;
+  }
+  if( nSingle==0 ){
+    fprintf(out,"'%s'",z);
+  }else{
+    fprintf(out,"'");
+    while( *z ){
+      for(i=0; z[i] && z[i]!='\''; i++){}
+      if( i==0 ){
+        fprintf(out,"''");
+        z++;
+      }else if( z[i]=='\'' ){
+        fprintf(out,"%.*s''",i,z);
+        z += i+1;
+      }else{
+        fprintf(out,"%s",z);
+        break;
+      }
+    }
+    fprintf(out,"'");
+  }
+}
+
+/*
+** Output the given string as a quoted according to C or TCL quoting rules.
+*/
+static void output_c_string(FILE *out, const char *z){
+  unsigned int c;
+  fputc('"', out);
+  while( (c = *(z++))!=0 ){
+    if( c=='\\' ){
+      fputc(c, out);
+      fputc(c, out);
+    }else if( c=='\t' ){
+      fputc('\\', out);
+      fputc('t', out);
+    }else if( c=='\n' ){
+      fputc('\\', out);
+      fputc('n', out);
+    }else if( c=='\r' ){
+      fputc('\\', out);
+      fputc('r', out);
+    }else if( !isprint(c) ){
+      fprintf(out, "\\%03o", c&0xff);
+    }else{
+      fputc(c, out);
+    }
+  }
+  fputc('"', out);
+}
+
+/*
+** Output the given string with characters that are special to
+** HTML escaped.
+*/
+static void output_html_string(FILE *out, const char *z){
+  int i;
+  while( *z ){
+    for(i=0;   z[i] 
+            && z[i]!='<' 
+            && z[i]!='&' 
+            && z[i]!='>' 
+            && z[i]!='\"' 
+            && z[i]!='\'';
+        i++){}
+    if( i>0 ){
+      fprintf(out,"%.*s",i,z);
+    }
+    if( z[i]=='<' ){
+      fprintf(out,"&lt;");
+    }else if( z[i]=='&' ){
+      fprintf(out,"&amp;");
+    }else if( z[i]=='>' ){
+      fprintf(out,"&gt;");
+    }else if( z[i]=='\"' ){
+      fprintf(out,"&quot;");
+    }else if( z[i]=='\'' ){
+      fprintf(out,"&#39;");
+    }else{
+      break;
+    }
+    z += i + 1;
+  }
+}
+
+/*
+** If a field contains any character identified by a 1 in the following
+** array, then the string must be quoted for CSV.
+*/
+static const char needCsvQuote[] = {
+  1, 1, 1, 1, 1, 1, 1, 1,   1, 1, 1, 1, 1, 1, 1, 1,   
+  1, 1, 1, 1, 1, 1, 1, 1,   1, 1, 1, 1, 1, 1, 1, 1,   
+  1, 0, 1, 0, 0, 0, 0, 1,   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, 0,   0, 0, 0, 0, 0, 0, 0, 0, 
+  0, 0, 0, 0, 0, 0, 0, 0,   0, 0, 0, 0, 0, 0, 0, 1, 
+  1, 1, 1, 1, 1, 1, 1, 1,   1, 1, 1, 1, 1, 1, 1, 1,   
+  1, 1, 1, 1, 1, 1, 1, 1,   1, 1, 1, 1, 1, 1, 1, 1,   
+  1, 1, 1, 1, 1, 1, 1, 1,   1, 1, 1, 1, 1, 1, 1, 1,   
+  1, 1, 1, 1, 1, 1, 1, 1,   1, 1, 1, 1, 1, 1, 1, 1,   
+  1, 1, 1, 1, 1, 1, 1, 1,   1, 1, 1, 1, 1, 1, 1, 1,   
+  1, 1, 1, 1, 1, 1, 1, 1,   1, 1, 1, 1, 1, 1, 1, 1,   
+  1, 1, 1, 1, 1, 1, 1, 1,   1, 1, 1, 1, 1, 1, 1, 1,   
+  1, 1, 1, 1, 1, 1, 1, 1,   1, 1, 1, 1, 1, 1, 1, 1,   
+};
+
+/*
+** Output a single term of CSV.  Actually, p->separator is used for
+** the separator, which may or may not be a comma.  p->nullvalue is
+** the null value.  Strings are quoted using ANSI-C rules.  Numbers
+** appear outside of quotes.
+*/
+static void output_csv(struct callback_data *p, const char *z, int bSep){
+  FILE *out = p->out;
+  if( z==0 ){
+    fprintf(out,"%s",p->nullvalue);
+  }else{
+    int i;
+    int nSep = strlen30(p->separator);
+    for(i=0; z[i]; i++){
+      if( needCsvQuote[((unsigned char*)z)[i]] 
+         || (z[i]==p->separator[0] && 
+             (nSep==1 || memcmp(z, p->separator, nSep)==0)) ){
+        i = 0;
+        break;
+      }
+    }
+    if( i==0 ){
+      putc('"', out);
+      for(i=0; z[i]; i++){
+        if( z[i]=='"' ) putc('"', out);
+        putc(z[i], out);
+      }
+      putc('"', out);
+    }else{
+      fprintf(out, "%s", z);
+    }
+  }
+  if( bSep ){
+    fprintf(p->out, "%s", p->separator);
+  }
+}
+
+#ifdef SIGINT
+/*
+** This routine runs when the user presses Ctrl-C
+*/
+static void interrupt_handler(int NotUsed){
+  UNUSED_PARAMETER(NotUsed);
+  seenInterrupt = 1;
+  if( db ) sqlite3_interrupt(db);
+}
+#endif
+
+/*
+** This is the callback routine that the shell
+** invokes for each row of a query result.
+*/
+static int shell_callback(void *pArg, int nArg, char **azArg, char **azCol, int *aiType){
+  int i;
+  struct callback_data *p = (struct callback_data*)pArg;
+
+  switch( p->mode ){
+    case MODE_Line: {
+      int w = 5;
+      if( azArg==0 ) break;
+      for(i=0; i<nArg; i++){
+        int len = strlen30(azCol[i] ? azCol[i] : "");
+        if( len>w ) w = len;
+      }
+      if( p->cnt++>0 ) fprintf(p->out,"\n");
+      for(i=0; i<nArg; i++){
+        fprintf(p->out,"%*s = %s\n", w, azCol[i],
+                azArg[i] ? azArg[i] : p->nullvalue);
+      }
+      break;
+    }
+    case MODE_Explain:
+    case MODE_Column: {
+      if( p->cnt++==0 ){
+        for(i=0; i<nArg; i++){
+          int w, n;
+          if( i<ArraySize(p->colWidth) ){
+            w = p->colWidth[i];
+          }else{
+            w = 0;
+          }
+          if( w<=0 ){
+            w = strlen30(azCol[i] ? azCol[i] : "");
+            if( w<10 ) w = 10;
+            n = strlen30(azArg && azArg[i] ? azArg[i] : p->nullvalue);
+            if( w<n ) w = n;
+          }
+          if( i<ArraySize(p->actualWidth) ){
+            p->actualWidth[i] = w;
+          }
+          if( p->showHeader ){
+            fprintf(p->out,"%-*.*s%s",w,w,azCol[i], i==nArg-1 ? "\n": "  ");
+          }
+        }
+        if( p->showHeader ){
+          for(i=0; i<nArg; i++){
+            int w;
+            if( i<ArraySize(p->actualWidth) ){
+               w = p->actualWidth[i];
+            }else{
+               w = 10;
+            }
+            fprintf(p->out,"%-*.*s%s",w,w,"-----------------------------------"
+                   "----------------------------------------------------------",
+                    i==nArg-1 ? "\n": "  ");
+          }
+        }
+      }
+      if( azArg==0 ) break;
+      for(i=0; i<nArg; i++){
+        int w;
+        if( i<ArraySize(p->actualWidth) ){
+           w = p->actualWidth[i];
+        }else{
+           w = 10;
+        }
+        if( p->mode==MODE_Explain && azArg[i] && 
+           strlen30(azArg[i])>w ){
+          w = strlen30(azArg[i]);
+        }
+        fprintf(p->out,"%-*.*s%s",w,w,
+            azArg[i] ? azArg[i] : p->nullvalue, i==nArg-1 ? "\n": "  ");
+      }
+      break;
+    }
+    case MODE_Semi:
+    case MODE_List: {
+      if( p->cnt++==0 && p->showHeader ){
+        for(i=0; i<nArg; i++){
+          fprintf(p->out,"%s%s",azCol[i], i==nArg-1 ? "\n" : p->separator);
+        }
+      }
+      if( azArg==0 ) break;
+      for(i=0; i<nArg; i++){
+        char *z = azArg[i];
+        if( z==0 ) z = p->nullvalue;
+        fprintf(p->out, "%s", z);
+        if( i<nArg-1 ){
+          fprintf(p->out, "%s", p->separator);
+        }else if( p->mode==MODE_Semi ){
+          fprintf(p->out, ";\n");
+        }else{
+          fprintf(p->out, "\n");
+        }
+      }
+      break;
+    }
+    case MODE_Html: {
+      if( p->cnt++==0 && p->showHeader ){
+        fprintf(p->out,"<TR>");
+        for(i=0; i<nArg; i++){
+          fprintf(p->out,"<TH>");
+          output_html_string(p->out, azCol[i]);
+          fprintf(p->out,"</TH>\n");
+        }
+        fprintf(p->out,"</TR>\n");
+      }
+      if( azArg==0 ) break;
+      fprintf(p->out,"<TR>");
+      for(i=0; i<nArg; i++){
+        fprintf(p->out,"<TD>");
+        output_html_string(p->out, azArg[i] ? azArg[i] : p->nullvalue);
+        fprintf(p->out,"</TD>\n");
+      }
+      fprintf(p->out,"</TR>\n");
+      break;
+    }
+    case MODE_Tcl: {
+      if( p->cnt++==0 && p->showHeader ){
+        for(i=0; i<nArg; i++){
+          output_c_string(p->out,azCol[i] ? azCol[i] : "");
+          fprintf(p->out, "%s", p->separator);
+        }
+        fprintf(p->out,"\n");
+      }
+      if( azArg==0 ) break;
+      for(i=0; i<nArg; i++){
+        output_c_string(p->out, azArg[i] ? azArg[i] : p->nullvalue);
+        fprintf(p->out, "%s", p->separator);
+      }
+      fprintf(p->out,"\n");
+      break;
+    }
+    case MODE_Csv: {
+      if( p->cnt++==0 && p->showHeader ){
+        for(i=0; i<nArg; i++){
+          output_csv(p, azCol[i] ? azCol[i] : "", i<nArg-1);
+        }
+        fprintf(p->out,"\n");
+      }
+      if( azArg==0 ) break;
+      for(i=0; i<nArg; i++){
+        output_csv(p, azArg[i], i<nArg-1);
+      }
+      fprintf(p->out,"\n");
+      break;
+    }
+    case MODE_Insert: {
+      p->cnt++;
+      if( azArg==0 ) break;
+      fprintf(p->out,"INSERT INTO %s VALUES(",p->zDestTable);
+      for(i=0; i<nArg; i++){
+        char *zSep = i>0 ? ",": "";
+        if( (azArg[i]==0) || (aiType && aiType[i]==SQLITE_NULL) ){
+          fprintf(p->out,"%sNULL",zSep);
+        }else if( aiType && aiType[i]==SQLITE_TEXT ){
+          if( zSep[0] ) fprintf(p->out,"%s",zSep);
+          output_quoted_string(p->out, azArg[i]);
+        }else if( aiType && (aiType[i]==SQLITE_INTEGER || aiType[i]==SQLITE_FLOAT) ){
+          fprintf(p->out,"%s%s",zSep, azArg[i]);
+        }else if( aiType && aiType[i]==SQLITE_BLOB && p->pStmt ){
+          const void *pBlob = sqlite3_column_blob(p->pStmt, i);
+          int nBlob = sqlite3_column_bytes(p->pStmt, i);
+          if( zSep[0] ) fprintf(p->out,"%s",zSep);
+          output_hex_blob(p->out, pBlob, nBlob);
+        }else if( isNumber(azArg[i], 0) ){
+          fprintf(p->out,"%s%s",zSep, azArg[i]);
+        }else{
+          if( zSep[0] ) fprintf(p->out,"%s",zSep);
+          output_quoted_string(p->out, azArg[i]);
+        }
+      }
+      fprintf(p->out,");\n");
+      break;
+    }
+  }
+  return 0;
+}
+
+/*
+** This is the callback routine that the SQLite library
+** invokes for each row of a query result.
+*/
+static int callback(void *pArg, int nArg, char **azArg, char **azCol){
+  /* since we don't have type info, call the shell_callback with a NULL value */
+  return shell_callback(pArg, nArg, azArg, azCol, NULL);
+}
+
+/*
+** Set the destination table field of the callback_data structure to
+** the name of the table given.  Escape any quote characters in the
+** table name.
+*/
+static void set_table_name(struct callback_data *p, const char *zName){
+  int i, n;
+  int needQuote;
+  char *z;
+
+  if( p->zDestTable ){
+    free(p->zDestTable);
+    p->zDestTable = 0;
+  }
+  if( zName==0 ) return;
+  needQuote = !isalpha((unsigned char)*zName) && *zName!='_';
+  for(i=n=0; zName[i]; i++, n++){
+    if( !isalnum((unsigned char)zName[i]) && zName[i]!='_' ){
+      needQuote = 1;
+      if( zName[i]=='\'' ) n++;
+    }
+  }
+  if( needQuote ) n += 2;
+  z = p->zDestTable = malloc( n+1 );
+  if( z==0 ){
+    fprintf(stderr,"Error: out of memory\n");
+    exit(1);
+  }
+  n = 0;
+  if( needQuote ) z[n++] = '\'';
+  for(i=0; zName[i]; i++){
+    z[n++] = zName[i];
+    if( zName[i]=='\'' ) z[n++] = '\'';
+  }
+  if( needQuote ) z[n++] = '\'';
+  z[n] = 0;
+}
+
+/* zIn is either a pointer to a NULL-terminated string in memory obtained
+** from malloc(), or a NULL pointer. The string pointed to by zAppend is
+** added to zIn, and the result returned in memory obtained from malloc().
+** zIn, if it was not NULL, is freed.
+**
+** If the third argument, quote, is not '\0', then it is used as a 
+** quote character for zAppend.
+*/
+static char *appendText(char *zIn, char const *zAppend, char quote){
+  int len;
+  int i;
+  int nAppend = strlen30(zAppend);
+  int nIn = (zIn?strlen30(zIn):0);
+
+  len = nAppend+nIn+1;
+  if( quote ){
+    len += 2;
+    for(i=0; i<nAppend; i++){
+      if( zAppend[i]==quote ) len++;
+    }
+  }
+
+  zIn = (char *)realloc(zIn, len);
+  if( !zIn ){
+    return 0;
+  }
+
+  if( quote ){
+    char *zCsr = &zIn[nIn];
+    *zCsr++ = quote;
+    for(i=0; i<nAppend; i++){
+      *zCsr++ = zAppend[i];
+      if( zAppend[i]==quote ) *zCsr++ = quote;
+    }
+    *zCsr++ = quote;
+    *zCsr++ = '\0';
+    assert( (zCsr-zIn)==len );
+  }else{
+    memcpy(&zIn[nIn], zAppend, nAppend);
+    zIn[len-1] = '\0';
+  }
+
+  return zIn;
+}
+
+
+/*
+** Execute a query statement that has a single result column.  Print
+** that result column on a line by itself with a semicolon terminator.
+**
+** This is used, for example, to show the schema of the database by
+** querying the SQLITE_MASTER table.
+*/
+static int run_table_dump_query(
+  FILE *out,              /* Send output here */
+  sqlite3 *db,            /* Database to query */
+  const char *zSelect,    /* SELECT statement to extract content */
+  const char *zFirstRow   /* Print before first row, if not NULL */
+){
+  sqlite3_stmt *pSelect;
+  int rc;
+  rc = sqlite3_prepare(db, zSelect, -1, &pSelect, 0);
+  if( rc!=SQLITE_OK || !pSelect ){
+    return rc;
+  }
+  rc = sqlite3_step(pSelect);
+  while( rc==SQLITE_ROW ){
+    if( zFirstRow ){
+      fprintf(out, "%s", zFirstRow);
+      zFirstRow = 0;
+    }
+    fprintf(out, "%s;\n", sqlite3_column_text(pSelect, 0));
+    rc = sqlite3_step(pSelect);
+  }
+  return sqlite3_finalize(pSelect);
+}
+
+/*
+** Allocate space and save off current error string.
+*/
+static char *save_err_msg(
+  sqlite3 *db            /* Database to query */
+){
+  int nErrMsg = 1+strlen30(sqlite3_errmsg(db));
+  char *zErrMsg = sqlite3_malloc(nErrMsg);
+  if( zErrMsg ){
+    memcpy(zErrMsg, sqlite3_errmsg(db), nErrMsg);
+  }
+  return zErrMsg;
+}
+
+/*
+** Display memory stats.
+*/
+static int display_stats(
+  sqlite3 *db,                /* Database to query */
+  struct callback_data *pArg, /* Pointer to struct callback_data */
+  int bReset                  /* True to reset the stats */
+){
+  int iCur;
+  int iHiwtr;
+
+  if( pArg && pArg->out ){
+    
+    iHiwtr = iCur = -1;
+    sqlite3_status(SQLITE_STATUS_MEMORY_USED, &iCur, &iHiwtr, bReset);
+    fprintf(pArg->out, "Memory Used:                         %d (max %d) bytes\n", iCur, iHiwtr);
+    iHiwtr = iCur = -1;
+    sqlite3_status(SQLITE_STATUS_MALLOC_COUNT, &iCur, &iHiwtr, bReset);
+    fprintf(pArg->out, "Number of Outstanding Allocations:   %d (max %d)\n", iCur, iHiwtr);
+/*
+** Not currently used by the CLI.
+**    iHiwtr = iCur = -1;
+**    sqlite3_status(SQLITE_STATUS_PAGECACHE_USED, &iCur, &iHiwtr, bReset);
+**    fprintf(pArg->out, "Number of Pcache Pages Used:         %d (max %d) pages\n", iCur, iHiwtr);
+*/
+    iHiwtr = iCur = -1;
+    sqlite3_status(SQLITE_STATUS_PAGECACHE_OVERFLOW, &iCur, &iHiwtr, bReset);
+    fprintf(pArg->out, "Number of Pcache Overflow Bytes:     %d (max %d) bytes\n", iCur, iHiwtr);
+/*
+** Not currently used by the CLI.
+**    iHiwtr = iCur = -1;
+**    sqlite3_status(SQLITE_STATUS_SCRATCH_USED, &iCur, &iHiwtr, bReset);
+**    fprintf(pArg->out, "Number of Scratch Allocations Used:  %d (max %d)\n", iCur, iHiwtr);
+*/
+    iHiwtr = iCur = -1;
+    sqlite3_status(SQLITE_STATUS_SCRATCH_OVERFLOW, &iCur, &iHiwtr, bReset);
+    fprintf(pArg->out, "Number of Scratch Overflow Bytes:    %d (max %d) bytes\n", iCur, iHiwtr);
+    iHiwtr = iCur = -1;
+    sqlite3_status(SQLITE_STATUS_MALLOC_SIZE, &iCur, &iHiwtr, bReset);
+    fprintf(pArg->out, "Largest Allocation:                  %d bytes\n", iHiwtr);
+    iHiwtr = iCur = -1;
+    sqlite3_status(SQLITE_STATUS_PAGECACHE_SIZE, &iCur, &iHiwtr, bReset);
+    fprintf(pArg->out, "Largest Pcache Allocation:           %d bytes\n", iHiwtr);
+    iHiwtr = iCur = -1;
+    sqlite3_status(SQLITE_STATUS_SCRATCH_SIZE, &iCur, &iHiwtr, bReset);
+    fprintf(pArg->out, "Largest Scratch Allocation:          %d bytes\n", iHiwtr);
+#ifdef YYTRACKMAXSTACKDEPTH
+    iHiwtr = iCur = -1;
+    sqlite3_status(SQLITE_STATUS_PARSER_STACK, &iCur, &iHiwtr, bReset);
+    fprintf(pArg->out, "Deepest Parser Stack:                %d (max %d)\n", iCur, iHiwtr);
+#endif
+  }
+
+  if( pArg && pArg->out && db ){
+    iHiwtr = iCur = -1;
+    sqlite3_db_status(db, SQLITE_DBSTATUS_LOOKASIDE_USED, &iCur, &iHiwtr, bReset);
+    fprintf(pArg->out, "Lookaside Slots Used:                %d (max %d)\n", iCur, iHiwtr);
+    sqlite3_db_status(db, SQLITE_DBSTATUS_LOOKASIDE_HIT, &iCur, &iHiwtr, bReset);
+    fprintf(pArg->out, "Successful lookaside attempts:       %d\n", iHiwtr);
+    sqlite3_db_status(db, SQLITE_DBSTATUS_LOOKASIDE_MISS_SIZE, &iCur, &iHiwtr, bReset);
+    fprintf(pArg->out, "Lookaside failures due to size:      %d\n", iHiwtr);
+    sqlite3_db_status(db, SQLITE_DBSTATUS_LOOKASIDE_MISS_FULL, &iCur, &iHiwtr, bReset);
+    fprintf(pArg->out, "Lookaside failures due to OOM:       %d\n", iHiwtr);
+    iHiwtr = iCur = -1;
+    sqlite3_db_status(db, SQLITE_DBSTATUS_CACHE_USED, &iCur, &iHiwtr, bReset);
+    fprintf(pArg->out, "Pager Heap Usage:                    %d bytes\n", iCur); 
+    iHiwtr = iCur = -1;
+    sqlite3_db_status(db, SQLITE_DBSTATUS_SCHEMA_USED, &iCur, &iHiwtr, bReset);
+    fprintf(pArg->out, "Schema Heap Usage:                   %d bytes\n", iCur); 
+    iHiwtr = iCur = -1;
+    sqlite3_db_status(db, SQLITE_DBSTATUS_STMT_USED, &iCur, &iHiwtr, bReset);
+    fprintf(pArg->out, "Statement Heap/Lookaside Usage:      %d bytes\n", iCur); 
+  }
+
+  if( pArg && pArg->out && db && pArg->pStmt ){
+    iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_FULLSCAN_STEP, bReset);
+    fprintf(pArg->out, "Fullscan Steps:                      %d\n", iCur);
+    iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_SORT, bReset);
+    fprintf(pArg->out, "Sort Operations:                     %d\n", iCur);
+    iCur = sqlite3_stmt_status(pArg->pStmt, SQLITE_STMTSTATUS_AUTOINDEX, bReset);
+    fprintf(pArg->out, "Autoindex Inserts:                   %d\n", iCur);
+  }
+
+  return 0;
+}
+
+/*
+** Execute a statement or set of statements.  Print 
+** any result rows/columns depending on the current mode 
+** set via the supplied callback.
+**
+** This is very similar to SQLite's built-in sqlite3_exec() 
+** function except it takes a slightly different callback 
+** and callback data argument.
+*/
+static int shell_exec(
+  sqlite3 *db,                                /* An open database */
+  const char *zSql,                           /* SQL to be evaluated */
+  int (*xCallback)(void*,int,char**,char**,int*),   /* Callback function */
+                                              /* (not the same as sqlite3_exec) */
+  struct callback_data *pArg,                 /* Pointer to struct callback_data */
+  char **pzErrMsg                             /* Error msg written here */
+){
+  sqlite3_stmt *pStmt = NULL;     /* Statement to execute. */
+  int rc = SQLITE_OK;             /* Return Code */
+  const char *zLeftover;          /* Tail of unprocessed SQL */
+
+  if( pzErrMsg ){
+    *pzErrMsg = NULL;
+  }
+
+  while( zSql[0] && (SQLITE_OK == rc) ){
+    rc = sqlite3_prepare_v2(db, zSql, -1, &pStmt, &zLeftover);
+    if( SQLITE_OK != rc ){
+      if( pzErrMsg ){
+        *pzErrMsg = save_err_msg(db);
+      }
+    }else{
+      if( !pStmt ){
+        /* this happens for a comment or white-space */
+        zSql = zLeftover;
+        while( isspace(zSql[0]) ) zSql++;
+        continue;
+      }
+
+      /* save off the prepared statment handle and reset row count */
+      if( pArg ){
+        pArg->pStmt = pStmt;
+        pArg->cnt = 0;
+      }
+
+      /* echo the sql statement if echo on */
+      if( pArg && pArg->echoOn ){
+        const char *zStmtSql = sqlite3_sql(pStmt);
+        fprintf(pArg->out, "%s\n", zStmtSql ? zStmtSql : zSql);
+      }
+
+      /* perform the first step.  this will tell us if we
+      ** have a result set or not and how wide it is.
+      */
+      rc = sqlite3_step(pStmt);
+      /* if we have a result set... */
+      if( SQLITE_ROW == rc ){
+        /* if we have a callback... */
+        if( xCallback ){
+          /* allocate space for col name ptr, value ptr, and type */
+          int nCol = sqlite3_column_count(pStmt);
+          void *pData = sqlite3_malloc(3*nCol*sizeof(const char*) + 1);
+          if( !pData ){
+            rc = SQLITE_NOMEM;
+          }else{
+            char **azCols = (char **)pData;      /* Names of result columns */
+            char **azVals = &azCols[nCol];       /* Results */
+            int *aiTypes = (int *)&azVals[nCol]; /* Result types */
+            int i;
+            assert(sizeof(int) <= sizeof(char *)); 
+            /* save off ptrs to column names */
+            for(i=0; i<nCol; i++){
+              azCols[i] = (char *)sqlite3_column_name(pStmt, i);
+            }
+            do{
+              /* extract the data and data types */
+              for(i=0; i<nCol; i++){
+                azVals[i] = (char *)sqlite3_column_text(pStmt, i);
+                aiTypes[i] = sqlite3_column_type(pStmt, i);
+                if( !azVals[i] && (aiTypes[i]!=SQLITE_NULL) ){
+                  rc = SQLITE_NOMEM;
+                  break; /* from for */
+                }
+              } /* end for */
+
+              /* if data and types extracted successfully... */
+              if( SQLITE_ROW == rc ){ 
+                /* call the supplied callback with the result row data */
+                if( xCallback(pArg, nCol, azVals, azCols, aiTypes) ){
+                  rc = SQLITE_ABORT;
+                }else{
+                  rc = sqlite3_step(pStmt);
+                }
+              }
+            } while( SQLITE_ROW == rc );
+            sqlite3_free(pData);
+          }
+        }else{
+          do{
+            rc = sqlite3_step(pStmt);
+          } while( rc == SQLITE_ROW );
+        }
+      }
+
+      /* print usage stats if stats on */
+      if( pArg && pArg->statsOn ){
+        display_stats(db, pArg, 0);
+      }
+
+      /* Finalize the statement just executed. If this fails, save a 
+      ** copy of the error message. Otherwise, set zSql to point to the
+      ** next statement to execute. */
+      rc = sqlite3_finalize(pStmt);
+      if( rc==SQLITE_OK ){
+        zSql = zLeftover;
+        while( isspace(zSql[0]) ) zSql++;
+      }else if( pzErrMsg ){
+        *pzErrMsg = save_err_msg(db);
+      }
+
+      /* clear saved stmt handle */
+      if( pArg ){
+        pArg->pStmt = NULL;
+      }
+    }
+  } /* end while */
+
+  return rc;
+}
+
+
+/*
+** This is a different callback routine used for dumping the database.
+** Each row received by this callback consists of a table name,
+** the table type ("index" or "table") and SQL to create the table.
+** This routine should print text sufficient to recreate the table.
+*/
+static int dump_callback(void *pArg, int nArg, char **azArg, char **azCol){
+  int rc;
+  const char *zTable;
+  const char *zType;
+  const char *zSql;
+  const char *zPrepStmt = 0;
+  struct callback_data *p = (struct callback_data *)pArg;
+
+  UNUSED_PARAMETER(azCol);
+  if( nArg!=3 ) return 1;
+  zTable = azArg[0];
+  zType = azArg[1];
+  zSql = azArg[2];
+  
+  if( strcmp(zTable, "sqlite_sequence")==0 ){
+    zPrepStmt = "DELETE FROM sqlite_sequence;\n";
+  }else if( strcmp(zTable, "sqlite_stat1")==0 ){
+    fprintf(p->out, "ANALYZE sqlite_master;\n");
+  }else if( strncmp(zTable, "sqlite_", 7)==0 ){
+    return 0;
+  }else if( strncmp(zSql, "CREATE VIRTUAL TABLE", 20)==0 ){
+    char *zIns;
+    if( !p->writableSchema ){
+      fprintf(p->out, "PRAGMA writable_schema=ON;\n");
+      p->writableSchema = 1;
+    }
+    zIns = sqlite3_mprintf(
+       "INSERT INTO sqlite_master(type,name,tbl_name,rootpage,sql)"
+       "VALUES('table','%q','%q',0,'%q');",
+       zTable, zTable, zSql);
+    fprintf(p->out, "%s\n", zIns);
+    sqlite3_free(zIns);
+    return 0;
+  }else{
+    fprintf(p->out, "%s;\n", zSql);
+  }
+
+  if( strcmp(zType, "table")==0 ){
+    sqlite3_stmt *pTableInfo = 0;
+    char *zSelect = 0;
+    char *zTableInfo = 0;
+    char *zTmp = 0;
+    int nRow = 0;
+   
+    zTableInfo = appendText(zTableInfo, "PRAGMA table_info(", 0);
+    zTableInfo = appendText(zTableInfo, zTable, '"');
+    zTableInfo = appendText(zTableInfo, ");", 0);
+
+    rc = sqlite3_prepare(p->db, zTableInfo, -1, &pTableInfo, 0);
+    free(zTableInfo);
+    if( rc!=SQLITE_OK || !pTableInfo ){
+      return 1;
+    }
+
+    zSelect = appendText(zSelect, "SELECT 'INSERT INTO ' || ", 0);
+    zTmp = appendText(zTmp, zTable, '"');
+    if( zTmp ){
+      zSelect = appendText(zSelect, zTmp, '\'');
+    }
+    zSelect = appendText(zSelect, " || ' VALUES(' || ", 0);
+    rc = sqlite3_step(pTableInfo);
+    while( rc==SQLITE_ROW ){
+      const char *zText = (const char *)sqlite3_column_text(pTableInfo, 1);
+      zSelect = appendText(zSelect, "quote(", 0);
+      zSelect = appendText(zSelect, zText, '"');
+      rc = sqlite3_step(pTableInfo);
+      if( rc==SQLITE_ROW ){
+        zSelect = appendText(zSelect, ") || ',' || ", 0);
+      }else{
+        zSelect = appendText(zSelect, ") ", 0);
+      }
+      nRow++;
+    }
+    rc = sqlite3_finalize(pTableInfo);
+    if( rc!=SQLITE_OK || nRow==0 ){
+      free(zSelect);
+      return 1;
+    }
+    zSelect = appendText(zSelect, "|| ')' FROM  ", 0);
+    zSelect = appendText(zSelect, zTable, '"');
+
+    rc = run_table_dump_query(p->out, p->db, zSelect, zPrepStmt);
+    if( rc==SQLITE_CORRUPT ){
+      zSelect = appendText(zSelect, " ORDER BY rowid DESC", 0);
+      rc = run_table_dump_query(p->out, p->db, zSelect, 0);
+    }
+    if( zSelect ) free(zSelect);
+  }
+  return 0;
+}
+
+/*
+** Run zQuery.  Use dump_callback() as the callback routine so that
+** the contents of the query are output as SQL statements.
+**
+** If we get a SQLITE_CORRUPT error, rerun the query after appending
+** "ORDER BY rowid DESC" to the end.
+*/
+static int run_schema_dump_query(
+  struct callback_data *p, 
+  const char *zQuery,
+  char **pzErrMsg
+){
+  int rc;
+  rc = sqlite3_exec(p->db, zQuery, dump_callback, p, pzErrMsg);
+  if( rc==SQLITE_CORRUPT ){
+    char *zQ2;
+    int len = strlen30(zQuery);
+    if( pzErrMsg ) sqlite3_free(*pzErrMsg);
+    zQ2 = malloc( len+100 );
+    if( zQ2==0 ) return rc;
+    sqlite3_snprintf(sizeof(zQ2), zQ2, "%s ORDER BY rowid DESC", zQuery);
+    rc = sqlite3_exec(p->db, zQ2, dump_callback, p, pzErrMsg);
+    free(zQ2);
+  }
+  return rc;
+}
+
+/*
+** Text of a help message
+*/
+static char zHelp[] =
+  ".backup ?DB? FILE      Backup DB (default \"main\") to FILE\n"
+  ".bail ON|OFF           Stop after hitting an error.  Default OFF\n"
+  ".databases             List names and files of attached databases\n"
+  ".dump ?TABLE? ...      Dump the database in an SQL text format\n"
+  "                         If TABLE specified, only dump tables matching\n"
+  "                         LIKE pattern TABLE.\n"
+  ".echo ON|OFF           Turn command echo on or off\n"
+  ".exit                  Exit this program\n"
+  ".explain ?ON|OFF?      Turn output mode suitable for EXPLAIN on or off.\n"
+  "                         With no args, it turns EXPLAIN on.\n"
+  ".header(s) ON|OFF      Turn display of headers on or off\n"
+  ".help                  Show this message\n"
+  ".import FILE TABLE     Import data from FILE into TABLE\n"
+  ".indices ?TABLE?       Show names of all indices\n"
+  "                         If TABLE specified, only show indices for tables\n"
+  "                         matching LIKE pattern TABLE.\n"
+#ifdef SQLITE_ENABLE_IOTRACE
+  ".iotrace FILE          Enable I/O diagnostic logging to FILE\n"
+#endif
+#ifndef SQLITE_OMIT_LOAD_EXTENSION
+  ".load FILE ?ENTRY?     Load an extension library\n"
+#endif
+  ".log FILE|off          Turn logging on or off.  FILE can be stderr/stdout\n"
+  ".mode MODE ?TABLE?     Set output mode where MODE is one of:\n"
+  "                         csv      Comma-separated values\n"
+  "                         column   Left-aligned columns.  (See .width)\n"
+  "                         html     HTML <table> code\n"
+  "                         insert   SQL insert statements for TABLE\n"
+  "                         line     One value per line\n"
+  "                         list     Values delimited by .separator string\n"
+  "                         tabs     Tab-separated values\n"
+  "                         tcl      TCL list elements\n"
+  ".nullvalue STRING      Print STRING in place of NULL values\n"
+  ".output FILENAME       Send output to FILENAME\n"
+  ".output stdout         Send output to the screen\n"
+  ".prompt MAIN CONTINUE  Replace the standard prompts\n"
+  ".quit                  Exit this program\n"
+  ".read FILENAME         Execute SQL in FILENAME\n"
+  ".restore ?DB? FILE     Restore content of DB (default \"main\") from FILE\n"
+  ".schema ?TABLE?        Show the CREATE statements\n"
+  "                         If TABLE specified, only show tables matching\n"
+  "                         LIKE pattern TABLE.\n"
+  ".separator STRING      Change separator used by output mode and .import\n"
+  ".show                  Show the current values for various settings\n"
+  ".stats ON|OFF          Turn stats on or off\n"
+  ".tables ?TABLE?        List names of tables\n"
+  "                         If TABLE specified, only list tables matching\n"
+  "                         LIKE pattern TABLE.\n"
+  ".timeout MS            Try opening locked tables for MS milliseconds\n"
+  ".width NUM1 NUM2 ...   Set column widths for \"column\" mode\n"
+;
+
+static char zTimerHelp[] =
+  ".timer ON|OFF          Turn the CPU timer measurement on or off\n"
+;
+
+/* Forward reference */
+static int process_input(struct callback_data *p, FILE *in);
+
+/*
+** Make sure the database is open.  If it is not, then open it.  If
+** the database fails to open, print an error message and exit.
+*/
+static void open_db(struct callback_data *p){
+  if( p->db==0 ){
+    sqlite3_open(p->zDbFilename, &p->db);
+    db = p->db;
+    if( db && sqlite3_errcode(db)==SQLITE_OK ){
+      sqlite3_create_function(db, "shellstatic", 0, SQLITE_UTF8, 0,
+          shellstaticFunc, 0, 0);
+    }
+    if( db==0 || SQLITE_OK!=sqlite3_errcode(db) ){
+      fprintf(stderr,"Error: unable to open database \"%s\": %s\n", 
+          p->zDbFilename, sqlite3_errmsg(db));
+      exit(1);
+    }
+#ifndef SQLITE_OMIT_LOAD_EXTENSION
+    sqlite3_enable_load_extension(p->db, 1);
+#endif
+  }
+}
+
+/*
+** Do C-language style dequoting.
+**
+**    \t    -> tab
+**    \n    -> newline
+**    \r    -> carriage return
+**    \NNN  -> ascii character NNN in octal
+**    \\    -> backslash
+*/
+static void resolve_backslashes(char *z){
+  int i, j;
+  char c;
+  for(i=j=0; (c = z[i])!=0; i++, j++){
+    if( c=='\\' ){
+      c = z[++i];
+      if( c=='n' ){
+        c = '\n';
+      }else if( c=='t' ){
+        c = '\t';
+      }else if( c=='r' ){
+        c = '\r';
+      }else if( c>='0' && c<='7' ){
+        c -= '0';
+        if( z[i+1]>='0' && z[i+1]<='7' ){
+          i++;
+          c = (c<<3) + z[i] - '0';
+          if( z[i+1]>='0' && z[i+1]<='7' ){
+            i++;
+            c = (c<<3) + z[i] - '0';
+          }
+        }
+      }
+    }
+    z[j] = c;
+  }
+  z[j] = 0;
+}
+
+/*
+** Interpret zArg as a boolean value.  Return either 0 or 1.
+*/
+static int booleanValue(char *zArg){
+  int val = atoi(zArg);
+  int j;
+  for(j=0; zArg[j]; j++){
+    zArg[j] = (char)tolower(zArg[j]);
+  }
+  if( strcmp(zArg,"on")==0 ){
+    val = 1;
+  }else if( strcmp(zArg,"yes")==0 ){
+    val = 1;
+  }
+  return val;
+}
+
+/*
+** If an input line begins with "." then invoke this routine to
+** process that line.
+**
+** Return 1 on error, 2 to exit, and 0 otherwise.
+*/
+static int do_meta_command(char *zLine, struct callback_data *p){
+  int i = 1;
+  int nArg = 0;
+  int n, c;
+  int rc = 0;
+  char *azArg[50];
+
+  /* Parse the input line into tokens.
+  */
+  while( zLine[i] && nArg<ArraySize(azArg) ){
+    while( isspace((unsigned char)zLine[i]) ){ i++; }
+    if( zLine[i]==0 ) break;
+    if( zLine[i]=='\'' || zLine[i]=='"' ){
+      int delim = zLine[i++];
+      azArg[nArg++] = &zLine[i];
+      while( zLine[i] && zLine[i]!=delim ){ i++; }
+      if( zLine[i]==delim ){
+        zLine[i++] = 0;
+      }
+      if( delim=='"' ) resolve_backslashes(azArg[nArg-1]);
+    }else{
+      azArg[nArg++] = &zLine[i];
+      while( zLine[i] && !isspace((unsigned char)zLine[i]) ){ i++; }
+      if( zLine[i] ) zLine[i++] = 0;
+      resolve_backslashes(azArg[nArg-1]);
+    }
+  }
+
+  /* Process the input line.
+  */
+  if( nArg==0 ) return 0; /* no tokens, no error */
+  n = strlen30(azArg[0]);
+  c = azArg[0][0];
+  if( c=='b' && n>=3 && strncmp(azArg[0], "backup", n)==0 && nArg>1 && nArg<4){
+    const char *zDestFile;
+    const char *zDb;
+    sqlite3 *pDest;
+    sqlite3_backup *pBackup;
+    if( nArg==2 ){
+      zDestFile = azArg[1];
+      zDb = "main";
+    }else{
+      zDestFile = azArg[2];
+      zDb = azArg[1];
+    }
+    rc = sqlite3_open(zDestFile, &pDest);
+    if( rc!=SQLITE_OK ){
+      fprintf(stderr, "Error: cannot open \"%s\"\n", zDestFile);
+      sqlite3_close(pDest);
+      return 1;
+    }
+    open_db(p);
+    pBackup = sqlite3_backup_init(pDest, "main", p->db, zDb);
+    if( pBackup==0 ){
+      fprintf(stderr, "Error: %s\n", sqlite3_errmsg(pDest));
+      sqlite3_close(pDest);
+      return 1;
+    }
+    while(  (rc = sqlite3_backup_step(pBackup,100))==SQLITE_OK ){}
+    sqlite3_backup_finish(pBackup);
+    if( rc==SQLITE_DONE ){
+      rc = 0;
+    }else{
+      fprintf(stderr, "Error: %s\n", sqlite3_errmsg(pDest));
+      rc = 1;
+    }
+    sqlite3_close(pDest);
+  }else
+
+  if( c=='b' && n>=3 && strncmp(azArg[0], "bail", n)==0 && nArg>1 && nArg<3 ){
+    bail_on_error = booleanValue(azArg[1]);
+  }else
+
+  if( c=='d' && n>1 && strncmp(azArg[0], "databases", n)==0 && nArg==1 ){
+    struct callback_data data;
+    char *zErrMsg = 0;
+    open_db(p);
+    memcpy(&data, p, sizeof(data));
+    data.showHeader = 1;
+    data.mode = MODE_Column;
+    data.colWidth[0] = 3;
+    data.colWidth[1] = 15;
+    data.colWidth[2] = 58;
+    data.cnt = 0;
+    sqlite3_exec(p->db, "PRAGMA database_list; ", callback, &data, &zErrMsg);
+    if( zErrMsg ){
+      fprintf(stderr,"Error: %s\n", zErrMsg);
+      sqlite3_free(zErrMsg);
+      rc = 1;
+    }
+  }else
+
+  if( c=='d' && strncmp(azArg[0], "dump", n)==0 && nArg<3 ){
+    char *zErrMsg = 0;
+    open_db(p);
+    /* When playing back a "dump", the content might appear in an order
+    ** which causes immediate foreign key constraints to be violated.
+    ** So disable foreign-key constraint enforcement to prevent problems. */
+    fprintf(p->out, "PRAGMA foreign_keys=OFF;\n");
+    fprintf(p->out, "BEGIN TRANSACTION;\n");
+    p->writableSchema = 0;
+    sqlite3_exec(p->db, "PRAGMA writable_schema=ON", 0, 0, 0);
+    if( nArg==1 ){
+      run_schema_dump_query(p, 
+        "SELECT name, type, sql FROM sqlite_master "
+        "WHERE sql NOT NULL AND type=='table' AND name!='sqlite_sequence'", 0
+      );
+      run_schema_dump_query(p, 
+        "SELECT name, type, sql FROM sqlite_master "
+        "WHERE name=='sqlite_sequence'", 0
+      );
+      run_table_dump_query(p->out, p->db,
+        "SELECT sql FROM sqlite_master "
+        "WHERE sql NOT NULL AND type IN ('index','trigger','view')", 0
+      );
+    }else{
+      int i;
+      for(i=1; i<nArg; i++){
+        zShellStatic = azArg[i];
+        run_schema_dump_query(p,
+          "SELECT name, type, sql FROM sqlite_master "
+          "WHERE tbl_name LIKE shellstatic() AND type=='table'"
+          "  AND sql NOT NULL", 0);
+        run_table_dump_query(p->out, p->db,
+          "SELECT sql FROM sqlite_master "
+          "WHERE sql NOT NULL"
+          "  AND type IN ('index','trigger','view')"
+          "  AND tbl_name LIKE shellstatic()", 0
+        );
+        zShellStatic = 0;
+      }
+    }
+    if( p->writableSchema ){
+      fprintf(p->out, "PRAGMA writable_schema=OFF;\n");
+      p->writableSchema = 0;
+    }
+    sqlite3_exec(p->db, "PRAGMA writable_schema=OFF", 0, 0, 0);
+    if( zErrMsg ){
+      fprintf(stderr,"Error: %s\n", zErrMsg);
+      sqlite3_free(zErrMsg);
+    }else{
+      fprintf(p->out, "COMMIT;\n");
+    }
+  }else
+
+  if( c=='e' && strncmp(azArg[0], "echo", n)==0 && nArg>1 && nArg<3 ){
+    p->echoOn = booleanValue(azArg[1]);
+  }else
+
+  if( c=='e' && strncmp(azArg[0], "exit", n)==0  && nArg==1 ){
+    rc = 2;
+  }else
+
+  if( c=='e' && strncmp(azArg[0], "explain", n)==0 && nArg<3 ){
+    int val = nArg>=2 ? booleanValue(azArg[1]) : 1;
+    if(val == 1) {
+      if(!p->explainPrev.valid) {
+        p->explainPrev.valid = 1;
+        p->explainPrev.mode = p->mode;
+        p->explainPrev.showHeader = p->showHeader;
+        memcpy(p->explainPrev.colWidth,p->colWidth,sizeof(p->colWidth));
+      }
+      /* We could put this code under the !p->explainValid
+      ** condition so that it does not execute if we are already in
+      ** explain mode. However, always executing it allows us an easy
+      ** was to reset to explain mode in case the user previously
+      ** did an .explain followed by a .width, .mode or .header
+      ** command.
+      */
+      p->mode = MODE_Explain;
+      p->showHeader = 1;
+      memset(p->colWidth,0,ArraySize(p->colWidth));
+      p->colWidth[0] = 4;                  /* addr */
+      p->colWidth[1] = 13;                 /* opcode */
+      p->colWidth[2] = 4;                  /* P1 */
+      p->colWidth[3] = 4;                  /* P2 */
+      p->colWidth[4] = 4;                  /* P3 */
+      p->colWidth[5] = 13;                 /* P4 */
+      p->colWidth[6] = 2;                  /* P5 */
+      p->colWidth[7] = 13;                  /* Comment */
+    }else if (p->explainPrev.valid) {
+      p->explainPrev.valid = 0;
+      p->mode = p->explainPrev.mode;
+      p->showHeader = p->explainPrev.showHeader;
+      memcpy(p->colWidth,p->explainPrev.colWidth,sizeof(p->colWidth));
+    }
+  }else
+
+  if( c=='h' && (strncmp(azArg[0], "header", n)==0 ||
+                 strncmp(azArg[0], "headers", n)==0) && nArg>1 && nArg<3 ){
+    p->showHeader = booleanValue(azArg[1]);
+  }else
+
+  if( c=='h' && strncmp(azArg[0], "help", n)==0 ){
+    fprintf(stderr,"%s",zHelp);
+    if( HAS_TIMER ){
+      fprintf(stderr,"%s",zTimerHelp);
+    }
+  }else
+
+  if( c=='i' && strncmp(azArg[0], "import", n)==0 && nArg==3 ){
+    char *zTable = azArg[2];    /* Insert data into this table */
+    char *zFile = azArg[1];     /* The file from which to extract data */
+    sqlite3_stmt *pStmt = NULL; /* A statement */
+    int nCol;                   /* Number of columns in the table */
+    int nByte;                  /* Number of bytes in an SQL string */
+    int i, j;                   /* Loop counters */
+    int nSep;                   /* Number of bytes in p->separator[] */
+    char *zSql;                 /* An SQL statement */
+    char *zLine;                /* A single line of input from the file */
+    char **azCol;               /* zLine[] broken up into columns */
+    char *zCommit;              /* How to commit changes */   
+    FILE *in;                   /* The input file */
+    int lineno = 0;             /* Line number of input file */
+
+    open_db(p);
+    nSep = strlen30(p->separator);
+    if( nSep==0 ){
+      fprintf(stderr, "Error: non-null separator required for import\n");
+      return 1;
+    }
+    zSql = sqlite3_mprintf("SELECT * FROM '%q'", zTable);
+    if( zSql==0 ){
+      fprintf(stderr, "Error: out of memory\n");
+      return 1;
+    }
+    nByte = strlen30(zSql);
+    rc = sqlite3_prepare(p->db, zSql, -1, &pStmt, 0);
+    sqlite3_free(zSql);
+    if( rc ){
+      if (pStmt) sqlite3_finalize(pStmt);
+      fprintf(stderr,"Error: %s\n", sqlite3_errmsg(db));
+      return 1;
+    }
+    nCol = sqlite3_column_count(pStmt);
+    sqlite3_finalize(pStmt);
+    pStmt = 0;
+    if( nCol==0 ) return 0; /* no columns, no error */
+    zSql = malloc( nByte + 20 + nCol*2 );
+    if( zSql==0 ){
+      fprintf(stderr, "Error: out of memory\n");
+      return 1;
+    }
+    sqlite3_snprintf(nByte+20, zSql, "INSERT INTO '%q' VALUES(?", zTable);
+    j = strlen30(zSql);
+    for(i=1; i<nCol; i++){
+      zSql[j++] = ',';
+      zSql[j++] = '?';
+    }
+    zSql[j++] = ')';
+    zSql[j] = 0;
+    rc = sqlite3_prepare(p->db, zSql, -1, &pStmt, 0);
+    free(zSql);
+    if( rc ){
+      fprintf(stderr, "Error: %s\n", sqlite3_errmsg(db));
+      if (pStmt) sqlite3_finalize(pStmt);
+      return 1;
+    }
+    in = fopen(zFile, "rb");
+    if( in==0 ){
+      fprintf(stderr, "Error: cannot open \"%s\"\n", zFile);
+      sqlite3_finalize(pStmt);
+      return 1;
+    }
+    azCol = malloc( sizeof(azCol[0])*(nCol+1) );
+    if( azCol==0 ){
+      fprintf(stderr, "Error: out of memory\n");
+      fclose(in);
+      sqlite3_finalize(pStmt);
+      return 1;
+    }
+    sqlite3_exec(p->db, "BEGIN", 0, 0, 0);
+    zCommit = "COMMIT";
+    while( (zLine = local_getline(0, in))!=0 ){
+      char *z;
+      i = 0;
+      lineno++;
+      azCol[0] = zLine;
+      for(i=0, z=zLine; *z && *z!='\n' && *z!='\r'; z++){
+        if( *z==p->separator[0] && strncmp(z, p->separator, nSep)==0 ){
+          *z = 0;
+          i++;
+          if( i<nCol ){
+            azCol[i] = &z[nSep];
+            z += nSep-1;
+          }
+        }
+      } /* end for */
+      *z = 0;
+      if( i+1!=nCol ){
+        fprintf(stderr,
+                "Error: %s line %d: expected %d columns of data but found %d\n",
+                zFile, lineno, nCol, i+1);
+        zCommit = "ROLLBACK";
+        free(zLine);
+        rc = 1;
+        break; /* from while */
+      }
+      for(i=0; i<nCol; i++){
+        sqlite3_bind_text(pStmt, i+1, azCol[i], -1, SQLITE_STATIC);
+      }
+      sqlite3_step(pStmt);
+      rc = sqlite3_reset(pStmt);
+      free(zLine);
+      if( rc!=SQLITE_OK ){
+        fprintf(stderr,"Error: %s\n", sqlite3_errmsg(db));
+        zCommit = "ROLLBACK";
+        rc = 1;
+        break; /* from while */
+      }
+    } /* end while */
+    free(azCol);
+    fclose(in);
+    sqlite3_finalize(pStmt);
+    sqlite3_exec(p->db, zCommit, 0, 0, 0);
+  }else
+
+  if( c=='i' && strncmp(azArg[0], "indices", n)==0 && nArg<3 ){
+    struct callback_data data;
+    char *zErrMsg = 0;
+    open_db(p);
+    memcpy(&data, p, sizeof(data));
+    data.showHeader = 0;
+    data.mode = MODE_List;
+    if( nArg==1 ){
+      rc = sqlite3_exec(p->db,
+        "SELECT name FROM sqlite_master "
+        "WHERE type='index' AND name NOT LIKE 'sqlite_%' "
+        "UNION ALL "
+        "SELECT name FROM sqlite_temp_master "
+        "WHERE type='index' "
+        "ORDER BY 1",
+        callback, &data, &zErrMsg
+      );
+    }else{
+      zShellStatic = azArg[1];
+      rc = sqlite3_exec(p->db,
+        "SELECT name FROM sqlite_master "
+        "WHERE type='index' AND tbl_name LIKE shellstatic() "
+        "UNION ALL "
+        "SELECT name FROM sqlite_temp_master "
+        "WHERE type='index' AND tbl_name LIKE shellstatic() "
+        "ORDER BY 1",
+        callback, &data, &zErrMsg
+      );
+      zShellStatic = 0;
+    }
+    if( zErrMsg ){
+      fprintf(stderr,"Error: %s\n", zErrMsg);
+      sqlite3_free(zErrMsg);
+      rc = 1;
+    }else if( rc != SQLITE_OK ){
+      fprintf(stderr,"Error: querying sqlite_master and sqlite_temp_master\n");
+      rc = 1;
+    }
+  }else
+
+#ifdef SQLITE_ENABLE_IOTRACE
+  if( c=='i' && strncmp(azArg[0], "iotrace", n)==0 ){
+    extern void (*sqlite3IoTrace)(const char*, ...);
+    if( iotrace && iotrace!=stdout ) fclose(iotrace);
+    iotrace = 0;
+    if( nArg<2 ){
+      sqlite3IoTrace = 0;
+    }else if( strcmp(azArg[1], "-")==0 ){
+      sqlite3IoTrace = iotracePrintf;
+      iotrace = stdout;
+    }else{
+      iotrace = fopen(azArg[1], "w");
+      if( iotrace==0 ){
+        fprintf(stderr, "Error: cannot open \"%s\"\n", azArg[1]);
+        sqlite3IoTrace = 0;
+        rc = 1;
+      }else{
+        sqlite3IoTrace = iotracePrintf;
+      }
+    }
+  }else
+#endif
+
+#ifndef SQLITE_OMIT_LOAD_EXTENSION
+  if( c=='l' && strncmp(azArg[0], "load", n)==0 && nArg>=2 ){
+    const char *zFile, *zProc;
+    char *zErrMsg = 0;
+    zFile = azArg[1];
+    zProc = nArg>=3 ? azArg[2] : 0;
+    open_db(p);
+    rc = sqlite3_load_extension(p->db, zFile, zProc, &zErrMsg);
+    if( rc!=SQLITE_OK ){
+      fprintf(stderr, "Error: %s\n", zErrMsg);
+      sqlite3_free(zErrMsg);
+      rc = 1;
+    }
+  }else
+#endif
+
+  if( c=='l' && strncmp(azArg[0], "log", n)==0 && nArg>=2 ){
+    const char *zFile = azArg[1];
+    if( p->pLog && p->pLog!=stdout && p->pLog!=stderr ){
+      fclose(p->pLog);
+      p->pLog = 0;
+    }
+    if( strcmp(zFile,"stdout")==0 ){
+      p->pLog = stdout;
+    }else if( strcmp(zFile, "stderr")==0 ){
+      p->pLog = stderr;
+    }else if( strcmp(zFile, "off")==0 ){
+      p->pLog = 0;
+    }else{
+      p->pLog = fopen(zFile, "w");
+      if( p->pLog==0 ){
+        fprintf(stderr, "Error: cannot open \"%s\"\n", zFile);
+      }
+    }
+  }else
+
+  if( c=='m' && strncmp(azArg[0], "mode", n)==0 && nArg==2 ){
+    int n2 = strlen30(azArg[1]);
+    if( (n2==4 && strncmp(azArg[1],"line",n2)==0)
+        ||
+        (n2==5 && strncmp(azArg[1],"lines",n2)==0) ){
+      p->mode = MODE_Line;
+    }else if( (n2==6 && strncmp(azArg[1],"column",n2)==0)
+              ||
+              (n2==7 && strncmp(azArg[1],"columns",n2)==0) ){
+      p->mode = MODE_Column;
+    }else if( n2==4 && strncmp(azArg[1],"list",n2)==0 ){
+      p->mode = MODE_List;
+    }else if( n2==4 && strncmp(azArg[1],"html",n2)==0 ){
+      p->mode = MODE_Html;
+    }else if( n2==3 && strncmp(azArg[1],"tcl",n2)==0 ){
+      p->mode = MODE_Tcl;
+    }else if( n2==3 && strncmp(azArg[1],"csv",n2)==0 ){
+      p->mode = MODE_Csv;
+      sqlite3_snprintf(sizeof(p->separator), p->separator, ",");
+    }else if( n2==4 && strncmp(azArg[1],"tabs",n2)==0 ){
+      p->mode = MODE_List;
+      sqlite3_snprintf(sizeof(p->separator), p->separator, "\t");
+    }else if( n2==6 && strncmp(azArg[1],"insert",n2)==0 ){
+      p->mode = MODE_Insert;
+      set_table_name(p, "table");
+    }else {
+      fprintf(stderr,"Error: mode should be one of: "
+         "column csv html insert line list tabs tcl\n");
+      rc = 1;
+    }
+  }else
+
+  if( c=='m' && strncmp(azArg[0], "mode", n)==0 && nArg==3 ){
+    int n2 = strlen30(azArg[1]);
+    if( n2==6 && strncmp(azArg[1],"insert",n2)==0 ){
+      p->mode = MODE_Insert;
+      set_table_name(p, azArg[2]);
+    }else {
+      fprintf(stderr, "Error: invalid arguments: "
+        " \"%s\". Enter \".help\" for help\n", azArg[2]);
+      rc = 1;
+    }
+  }else
+
+  if( c=='n' && strncmp(azArg[0], "nullvalue", n)==0 && nArg==2 ) {
+    sqlite3_snprintf(sizeof(p->nullvalue), p->nullvalue,
+                     "%.*s", (int)ArraySize(p->nullvalue)-1, azArg[1]);
+  }else
+
+  if( c=='o' && strncmp(azArg[0], "output", n)==0 && nArg==2 ){
+    if( p->out!=stdout ){
+      fclose(p->out);
+    }
+    if( strcmp(azArg[1],"stdout")==0 ){
+      p->out = stdout;
+      sqlite3_snprintf(sizeof(p->outfile), p->outfile, "stdout");
+    }else{
+      p->out = fopen(azArg[1], "wb");
+      if( p->out==0 ){
+        fprintf(stderr,"Error: cannot write to \"%s\"\n", azArg[1]);
+        p->out = stdout;
+        rc = 1;
+      } else {
+         sqlite3_snprintf(sizeof(p->outfile), p->outfile, "%s", azArg[1]);
+      }
+    }
+  }else
+
+  if( c=='p' && strncmp(azArg[0], "prompt", n)==0 && (nArg==2 || nArg==3)){
+    if( nArg >= 2) {
+      strncpy(mainPrompt,azArg[1],(int)ArraySize(mainPrompt)-1);
+    }
+    if( nArg >= 3) {
+      strncpy(continuePrompt,azArg[2],(int)ArraySize(continuePrompt)-1);
+    }
+  }else
+
+  if( c=='q' && strncmp(azArg[0], "quit", n)==0 && nArg==1 ){
+    rc = 2;
+  }else
+
+  if( c=='r' && n>=3 && strncmp(azArg[0], "read", n)==0 && nArg==2 ){
+    FILE *alt = fopen(azArg[1], "rb");
+    if( alt==0 ){
+      fprintf(stderr,"Error: cannot open \"%s\"\n", azArg[1]);
+      rc = 1;
+    }else{
+      rc = process_input(p, alt);
+      fclose(alt);
+    }
+  }else
+
+  if( c=='r' && n>=3 && strncmp(azArg[0], "restore", n)==0 && nArg>1 && nArg<4){
+    const char *zSrcFile;
+    const char *zDb;
+    sqlite3 *pSrc;
+    sqlite3_backup *pBackup;
+    int nTimeout = 0;
+
+    if( nArg==2 ){
+      zSrcFile = azArg[1];
+      zDb = "main";
+    }else{
+      zSrcFile = azArg[2];
+      zDb = azArg[1];
+    }
+    rc = sqlite3_open(zSrcFile, &pSrc);
+    if( rc!=SQLITE_OK ){
+      fprintf(stderr, "Error: cannot open \"%s\"\n", zSrcFile);
+      sqlite3_close(pSrc);
+      return 1;
+    }
+    open_db(p);
+    pBackup = sqlite3_backup_init(p->db, zDb, pSrc, "main");
+    if( pBackup==0 ){
+      fprintf(stderr, "Error: %s\n", sqlite3_errmsg(p->db));
+      sqlite3_close(pSrc);
+      return 1;
+    }
+    while( (rc = sqlite3_backup_step(pBackup,100))==SQLITE_OK
+          || rc==SQLITE_BUSY  ){
+      if( rc==SQLITE_BUSY ){
+        if( nTimeout++ >= 3 ) break;
+        sqlite3_sleep(100);
+      }
+    }
+    sqlite3_backup_finish(pBackup);
+    if( rc==SQLITE_DONE ){
+      rc = 0;
+    }else if( rc==SQLITE_BUSY || rc==SQLITE_LOCKED ){
+      fprintf(stderr, "Error: source database is busy\n");
+      rc = 1;
+    }else{
+      fprintf(stderr, "Error: %s\n", sqlite3_errmsg(p->db));
+      rc = 1;
+    }
+    sqlite3_close(pSrc);
+  }else
+
+  if( c=='s' && strncmp(azArg[0], "schema", n)==0 && nArg<3 ){
+    struct callback_data data;
+    char *zErrMsg = 0;
+    open_db(p);
+    memcpy(&data, p, sizeof(data));
+    data.showHeader = 0;
+    data.mode = MODE_Semi;
+    if( nArg>1 ){
+      int i;
+      for(i=0; azArg[1][i]; i++) azArg[1][i] = (char)tolower(azArg[1][i]);
+      if( strcmp(azArg[1],"sqlite_master")==0 ){
+        char *new_argv[2], *new_colv[2];
+        new_argv[0] = "CREATE TABLE sqlite_master (\n"
+                      "  type text,\n"
+                      "  name text,\n"
+                      "  tbl_name text,\n"
+                      "  rootpage integer,\n"
+                      "  sql text\n"
+                      ")";
+        new_argv[1] = 0;
+        new_colv[0] = "sql";
+        new_colv[1] = 0;
+        callback(&data, 1, new_argv, new_colv);
+        rc = SQLITE_OK;
+      }else if( strcmp(azArg[1],"sqlite_temp_master")==0 ){
+        char *new_argv[2], *new_colv[2];
+        new_argv[0] = "CREATE TEMP TABLE sqlite_temp_master (\n"
+                      "  type text,\n"
+                      "  name text,\n"
+                      "  tbl_name text,\n"
+                      "  rootpage integer,\n"
+                      "  sql text\n"
+                      ")";
+        new_argv[1] = 0;
+        new_colv[0] = "sql";
+        new_colv[1] = 0;
+        callback(&data, 1, new_argv, new_colv);
+        rc = SQLITE_OK;
+      }else{
+        zShellStatic = azArg[1];
+        rc = sqlite3_exec(p->db,
+          "SELECT sql FROM "
+          "  (SELECT sql sql, type type, tbl_name tbl_name, name name"
+          "     FROM sqlite_master UNION ALL"
+          "   SELECT sql, type, tbl_name, name FROM sqlite_temp_master) "
+          "WHERE tbl_name LIKE shellstatic() AND type!='meta' AND sql NOTNULL "
+          "ORDER BY substr(type,2,1), name",
+          callback, &data, &zErrMsg);
+        zShellStatic = 0;
+      }
+    }else{
+      rc = sqlite3_exec(p->db,
+         "SELECT sql FROM "
+         "  (SELECT sql sql, type type, tbl_name tbl_name, name name"
+         "     FROM sqlite_master UNION ALL"
+         "   SELECT sql, type, tbl_name, name FROM sqlite_temp_master) "
+         "WHERE type!='meta' AND sql NOTNULL AND name NOT LIKE 'sqlite_%'"
+         "ORDER BY substr(type,2,1), name",
+         callback, &data, &zErrMsg
+      );
+    }
+    if( zErrMsg ){
+      fprintf(stderr,"Error: %s\n", zErrMsg);
+      sqlite3_free(zErrMsg);
+      rc = 1;
+    }else if( rc != SQLITE_OK ){
+      fprintf(stderr,"Error: querying schema information\n");
+      rc = 1;
+    }else{
+      rc = 0;
+    }
+  }else
+
+  if( c=='s' && strncmp(azArg[0], "separator", n)==0 && nArg==2 ){
+    sqlite3_snprintf(sizeof(p->separator), p->separator,
+                     "%.*s", (int)sizeof(p->separator)-1, azArg[1]);
+  }else
+
+  if( c=='s' && strncmp(azArg[0], "show", n)==0 && nArg==1 ){
+    int i;
+    fprintf(p->out,"%9.9s: %s\n","echo", p->echoOn ? "on" : "off");
+    fprintf(p->out,"%9.9s: %s\n","explain", p->explainPrev.valid ? "on" :"off");
+    fprintf(p->out,"%9.9s: %s\n","headers", p->showHeader ? "on" : "off");
+    fprintf(p->out,"%9.9s: %s\n","mode", modeDescr[p->mode]);
+    fprintf(p->out,"%9.9s: ", "nullvalue");
+      output_c_string(p->out, p->nullvalue);
+      fprintf(p->out, "\n");
+    fprintf(p->out,"%9.9s: %s\n","output",
+            strlen30(p->outfile) ? p->outfile : "stdout");
+    fprintf(p->out,"%9.9s: ", "separator");
+      output_c_string(p->out, p->separator);
+      fprintf(p->out, "\n");
+    fprintf(p->out,"%9.9s: %s\n","stats", p->statsOn ? "on" : "off");
+    fprintf(p->out,"%9.9s: ","width");
+    for (i=0;i<(int)ArraySize(p->colWidth) && p->colWidth[i] != 0;i++) {
+      fprintf(p->out,"%d ",p->colWidth[i]);
+    }
+    fprintf(p->out,"\n");
+  }else
+
+  if( c=='s' && strncmp(azArg[0], "stats", n)==0 && nArg>1 && nArg<3 ){
+    p->statsOn = booleanValue(azArg[1]);
+  }else
+
+  if( c=='t' && n>1 && strncmp(azArg[0], "tables", n)==0 && nArg<3 ){
+    char **azResult;
+    int nRow;
+    char *zErrMsg;
+    open_db(p);
+    if( nArg==1 ){
+      rc = sqlite3_get_table(p->db,
+        "SELECT name FROM sqlite_master "
+        "WHERE type IN ('table','view') AND name NOT LIKE 'sqlite_%' "
+        "UNION ALL "
+        "SELECT name FROM sqlite_temp_master "
+        "WHERE type IN ('table','view') "
+        "ORDER BY 1",
+        &azResult, &nRow, 0, &zErrMsg
+      );
+    }else{
+      zShellStatic = azArg[1];
+      rc = sqlite3_get_table(p->db,
+        "SELECT name FROM sqlite_master "
+        "WHERE type IN ('table','view') AND name LIKE shellstatic() "
+        "UNION ALL "
+        "SELECT name FROM sqlite_temp_master "
+        "WHERE type IN ('table','view') AND name LIKE shellstatic() "
+        "ORDER BY 1",
+        &azResult, &nRow, 0, &zErrMsg
+      );
+      zShellStatic = 0;
+    }
+    if( zErrMsg ){
+      fprintf(stderr,"Error: %s\n", zErrMsg);
+      sqlite3_free(zErrMsg);
+      rc = 1;
+    }else if( rc != SQLITE_OK ){
+      fprintf(stderr,"Error: querying sqlite_master and sqlite_temp_master\n");
+      rc = 1;
+    }else{
+      int len, maxlen = 0;
+      int i, j;
+      int nPrintCol, nPrintRow;
+      for(i=1; i<=nRow; i++){
+        if( azResult[i]==0 ) continue;
+        len = strlen30(azResult[i]);
+        if( len>maxlen ) maxlen = len;
+      }
+      nPrintCol = 80/(maxlen+2);
+      if( nPrintCol<1 ) nPrintCol = 1;
+      nPrintRow = (nRow + nPrintCol - 1)/nPrintCol;
+      for(i=0; i<nPrintRow; i++){
+        for(j=i+1; j<=nRow; j+=nPrintRow){
+          char *zSp = j<=nPrintRow ? "" : "  ";
+          printf("%s%-*s", zSp, maxlen, azResult[j] ? azResult[j] : "");
+        }
+        printf("\n");
+      }
+    }
+    sqlite3_free_table(azResult);
+  }else
+
+  if( c=='t' && n>=8 && strncmp(azArg[0], "testctrl", n)==0 && nArg>=2 ){
+    static const struct {
+       const char *zCtrlName;   /* Name of a test-control option */
+       int ctrlCode;            /* Integer code for that option */
+    } aCtrl[] = {
+      { "prng_save",             SQLITE_TESTCTRL_PRNG_SAVE              },
+      { "prng_restore",          SQLITE_TESTCTRL_PRNG_RESTORE           },
+      { "prng_reset",            SQLITE_TESTCTRL_PRNG_RESET             },
+      { "bitvec_test",           SQLITE_TESTCTRL_BITVEC_TEST            },
+      { "fault_install",         SQLITE_TESTCTRL_FAULT_INSTALL          },
+      { "benign_malloc_hooks",   SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS    },
+      { "pending_byte",          SQLITE_TESTCTRL_PENDING_BYTE           },
+      { "assert",                SQLITE_TESTCTRL_ASSERT                 },
+      { "always",                SQLITE_TESTCTRL_ALWAYS                 },
+      { "reserve",               SQLITE_TESTCTRL_RESERVE                },
+      { "optimizations",         SQLITE_TESTCTRL_OPTIMIZATIONS          },
+      { "iskeyword",             SQLITE_TESTCTRL_ISKEYWORD              },
+      { "pghdrsz",               SQLITE_TESTCTRL_PGHDRSZ                },
+      { "scratchmalloc",         SQLITE_TESTCTRL_SCRATCHMALLOC          },
+    };
+    int testctrl = -1;
+    int rc = 0;
+    int i, n;
+    open_db(p);
+
+    /* convert testctrl text option to value. allow any unique prefix
+    ** of the option name, or a numerical value. */
+    n = strlen30(azArg[1]);
+    for(i=0; i<(int)(sizeof(aCtrl)/sizeof(aCtrl[0])); i++){
+      if( strncmp(azArg[1], aCtrl[i].zCtrlName, n)==0 ){
+        if( testctrl<0 ){
+          testctrl = aCtrl[i].ctrlCode;
+        }else{
+          fprintf(stderr, "ambiguous option name: \"%s\"\n", azArg[i]);
+          testctrl = -1;
+          break;
+        }
+      }
+    }
+    if( testctrl<0 ) testctrl = atoi(azArg[1]);
+    if( (testctrl<SQLITE_TESTCTRL_FIRST) || (testctrl>SQLITE_TESTCTRL_LAST) ){
+      fprintf(stderr,"Error: invalid testctrl option: %s\n", azArg[1]);
+    }else{
+      switch(testctrl){
+
+        /* sqlite3_test_control(int, db, int) */
+        case SQLITE_TESTCTRL_OPTIMIZATIONS:
+        case SQLITE_TESTCTRL_RESERVE:             
+          if( nArg==3 ){
+            int opt = (int)strtol(azArg[2], 0, 0);        
+            rc = sqlite3_test_control(testctrl, p->db, opt);
+            printf("%d (0x%08x)\n", rc, rc);
+          } else {
+            fprintf(stderr,"Error: testctrl %s takes a single int option\n",
+                    azArg[1]);
+          }
+          break;
+
+        /* sqlite3_test_control(int) */
+        case SQLITE_TESTCTRL_PRNG_SAVE:           
+        case SQLITE_TESTCTRL_PRNG_RESTORE:        
+        case SQLITE_TESTCTRL_PRNG_RESET:
+        case SQLITE_TESTCTRL_PGHDRSZ:             
+          if( nArg==2 ){
+            rc = sqlite3_test_control(testctrl);
+            printf("%d (0x%08x)\n", rc, rc);
+          } else {
+            fprintf(stderr,"Error: testctrl %s takes no options\n", azArg[1]);
+          }
+          break;
+
+        /* sqlite3_test_control(int, uint) */
+        case SQLITE_TESTCTRL_PENDING_BYTE:        
+          if( nArg==3 ){
+            unsigned int opt = (unsigned int)atoi(azArg[2]);        
+            rc = sqlite3_test_control(testctrl, opt);
+            printf("%d (0x%08x)\n", rc, rc);
+          } else {
+            fprintf(stderr,"Error: testctrl %s takes a single unsigned"
+                           " int option\n", azArg[1]);
+          }
+          break;
+          
+        /* sqlite3_test_control(int, int) */
+        case SQLITE_TESTCTRL_ASSERT:              
+        case SQLITE_TESTCTRL_ALWAYS:              
+          if( nArg==3 ){
+            int opt = atoi(azArg[2]);        
+            rc = sqlite3_test_control(testctrl, opt);
+            printf("%d (0x%08x)\n", rc, rc);
+          } else {
+            fprintf(stderr,"Error: testctrl %s takes a single int option\n",
+                            azArg[1]);
+          }
+          break;
+
+        /* sqlite3_test_control(int, char *) */
+#ifdef SQLITE_N_KEYWORD
+        case SQLITE_TESTCTRL_ISKEYWORD:           
+          if( nArg==3 ){
+            const char *opt = azArg[2];        
+            rc = sqlite3_test_control(testctrl, opt);
+            printf("%d (0x%08x)\n", rc, rc);
+          } else {
+            fprintf(stderr,"Error: testctrl %s takes a single char * option\n",
+                            azArg[1]);
+          }
+          break;
+#endif
+
+        case SQLITE_TESTCTRL_BITVEC_TEST:         
+        case SQLITE_TESTCTRL_FAULT_INSTALL:       
+        case SQLITE_TESTCTRL_BENIGN_MALLOC_HOOKS: 
+        case SQLITE_TESTCTRL_SCRATCHMALLOC:       
+        default:
+          fprintf(stderr,"Error: CLI support for testctrl %s not implemented\n",
+                  azArg[1]);
+          break;
+      }
+    }
+  }else
+
+  if( c=='t' && n>4 && strncmp(azArg[0], "timeout", n)==0 && nArg==2 ){
+    open_db(p);
+    sqlite3_busy_timeout(p->db, atoi(azArg[1]));
+  }else
+    
+  if( HAS_TIMER && c=='t' && n>=5 && strncmp(azArg[0], "timer", n)==0
+   && nArg==2
+  ){
+    enableTimer = booleanValue(azArg[1]);
+  }else
+  
+  if( c=='w' && strncmp(azArg[0], "width", n)==0 && nArg>1 ){
+    int j;
+    assert( nArg<=ArraySize(azArg) );
+    for(j=1; j<nArg && j<ArraySize(p->colWidth); j++){
+      p->colWidth[j-1] = atoi(azArg[j]);
+    }
+  }else
+
+  {
+    fprintf(stderr, "Error: unknown command or invalid arguments: "
+      " \"%s\". Enter \".help\" for help\n", azArg[0]);
+    rc = 1;
+  }
+
+  return rc;
+}
+
+/*
+** Return TRUE if a semicolon occurs anywhere in the first N characters
+** of string z[].
+*/
+static int _contains_semicolon(const char *z, int N){
+  int i;
+  for(i=0; i<N; i++){  if( z[i]==';' ) return 1; }
+  return 0;
+}
+
+/*
+** Test to see if a line consists entirely of whitespace.
+*/
+static int _all_whitespace(const char *z){
+  for(; *z; z++){
+    if( isspace(*(unsigned char*)z) ) continue;
+    if( *z=='/' && z[1]=='*' ){
+      z += 2;
+      while( *z && (*z!='*' || z[1]!='/') ){ z++; }
+      if( *z==0 ) return 0;
+      z++;
+      continue;
+    }
+    if( *z=='-' && z[1]=='-' ){
+      z += 2;
+      while( *z && *z!='\n' ){ z++; }
+      if( *z==0 ) return 1;
+      continue;
+    }
+    return 0;
+  }
+  return 1;
+}
+
+/*
+** Return TRUE if the line typed in is an SQL command terminator other
+** than a semi-colon.  The SQL Server style "go" command is understood
+** as is the Oracle "/".
+*/
+static int _is_command_terminator(const char *zLine){
+  while( isspace(*(unsigned char*)zLine) ){ zLine++; };
+  if( zLine[0]=='/' && _all_whitespace(&zLine[1]) ){
+    return 1;  /* Oracle */
+  }
+  if( tolower(zLine[0])=='g' && tolower(zLine[1])=='o'
+         && _all_whitespace(&zLine[2]) ){
+    return 1;  /* SQL Server */
+  }
+  return 0;
+}
+
+/*
+** Return true if zSql is a complete SQL statement.  Return false if it
+** ends in the middle of a string literal or C-style comment.
+*/
+static int _is_complete(char *zSql, int nSql){
+  int rc;
+  if( zSql==0 ) return 1;
+  zSql[nSql] = ';';
+  zSql[nSql+1] = 0;
+  rc = sqlite3_complete(zSql);
+  zSql[nSql] = 0;
+  return rc;
+}
+
+/*
+** Read input from *in and process it.  If *in==0 then input
+** is interactive - the user is typing it it.  Otherwise, input
+** is coming from a file or device.  A prompt is issued and history
+** is saved only if input is interactive.  An interrupt signal will
+** cause this routine to exit immediately, unless input is interactive.
+**
+** Return the number of errors.
+*/
+static int process_input(struct callback_data *p, FILE *in){
+  char *zLine = 0;
+  char *zSql = 0;
+  int nSql = 0;
+  int nSqlPrior = 0;
+  char *zErrMsg;
+  int rc;
+  int errCnt = 0;
+  int lineno = 0;
+  int startline = 0;
+
+  while( errCnt==0 || !bail_on_error || (in==0 && stdin_is_interactive) ){
+    fflush(p->out);
+    free(zLine);
+    zLine = one_input_line(zSql, in);
+    if( zLine==0 ){
+      break;  /* We have reached EOF */
+    }
+    if( seenInterrupt ){
+      if( in!=0 ) break;
+      seenInterrupt = 0;
+    }
+    lineno++;
+    if( (zSql==0 || zSql[0]==0) && _all_whitespace(zLine) ) continue;
+    if( zLine && zLine[0]=='.' && nSql==0 ){
+      if( p->echoOn ) printf("%s\n", zLine);
+      rc = do_meta_command(zLine, p);
+      if( rc==2 ){ /* exit requested */
+        break;
+      }else if( rc ){
+        errCnt++;
+      }
+      continue;
+    }
+    if( _is_command_terminator(zLine) && _is_complete(zSql, nSql) ){
+      memcpy(zLine,";",2);
+    }
+    nSqlPrior = nSql;
+    if( zSql==0 ){
+      int i;
+      for(i=0; zLine[i] && isspace((unsigned char)zLine[i]); i++){}
+      if( zLine[i]!=0 ){
+        nSql = strlen30(zLine);
+        zSql = malloc( nSql+3 );
+        if( zSql==0 ){
+          fprintf(stderr, "Error: out of memory\n");
+          exit(1);
+        }
+        memcpy(zSql, zLine, nSql+1);
+        startline = lineno;
+      }
+    }else{
+      int len = strlen30(zLine);
+      zSql = realloc( zSql, nSql + len + 4 );
+      if( zSql==0 ){
+        fprintf(stderr,"Error: out of memory\n");
+        exit(1);
+      }
+      zSql[nSql++] = '\n';
+      memcpy(&zSql[nSql], zLine, len+1);
+      nSql += len;
+    }
+    if( zSql && _contains_semicolon(&zSql[nSqlPrior], nSql-nSqlPrior)
+                && sqlite3_complete(zSql) ){
+      p->cnt = 0;
+      open_db(p);
+      BEGIN_TIMER;
+      rc = shell_exec(p->db, zSql, shell_callback, p, &zErrMsg);
+      END_TIMER;
+      if( rc || zErrMsg ){
+        char zPrefix[100];
+        if( in!=0 || !stdin_is_interactive ){
+          sqlite3_snprintf(sizeof(zPrefix), zPrefix, 
+                           "Error: near line %d:", startline);
+        }else{
+          sqlite3_snprintf(sizeof(zPrefix), zPrefix, "Error:");
+        }
+        if( zErrMsg!=0 ){
+          fprintf(stderr, "%s %s\n", zPrefix, zErrMsg);
+          sqlite3_free(zErrMsg);
+          zErrMsg = 0;
+        }else{
+          fprintf(stderr, "%s %s\n", zPrefix, sqlite3_errmsg(p->db));
+        }
+        errCnt++;
+      }
+      free(zSql);
+      zSql = 0;
+      nSql = 0;
+    }
+  }
+  if( zSql ){
+    if( !_all_whitespace(zSql) ){
+      fprintf(stderr, "Error: incomplete SQL: %s\n", zSql);
+    }
+    free(zSql);
+  }
+  free(zLine);
+  return errCnt;
+}
+
+/*
+** Return a pathname which is the user's home directory.  A
+** 0 return indicates an error of some kind.  Space to hold the
+** resulting string is obtained from malloc().  The calling
+** function should free the result.
+*/
+static char *find_home_dir(void){
+  char *home_dir = NULL;
+
+#if !defined(_WIN32) && !defined(WIN32) && !defined(__OS2__) && !defined(_WIN32_WCE) && !defined(__RTP__) && !defined(_WRS_KERNEL)
+  struct passwd *pwent;
+  uid_t uid = getuid();
+  if( (pwent=getpwuid(uid)) != NULL) {
+    home_dir = pwent->pw_dir;
+  }
+#endif
+
+#if defined(_WIN32_WCE)
+  /* Windows CE (arm-wince-mingw32ce-gcc) does not provide getenv()
+   */
+  home_dir = strdup("/");
+#else
+
+#if defined(_WIN32) || defined(WIN32) || defined(__OS2__)
+  if (!home_dir) {
+    home_dir = getenv("USERPROFILE");
+  }
+#endif
+
+  if (!home_dir) {
+    home_dir = getenv("HOME");
+  }
+
+#if defined(_WIN32) || defined(WIN32) || defined(__OS2__)
+  if (!home_dir) {
+    char *zDrive, *zPath;
+    int n;
+    zDrive = getenv("HOMEDRIVE");
+    zPath = getenv("HOMEPATH");
+    if( zDrive && zPath ){
+      n = strlen30(zDrive) + strlen30(zPath) + 1;
+      home_dir = malloc( n );
+      if( home_dir==0 ) return 0;
+      sqlite3_snprintf(n, home_dir, "%s%s", zDrive, zPath);
+      return home_dir;
+    }
+    home_dir = "c:\\";
+  }
+#endif
+
+#endif /* !_WIN32_WCE */
+
+  if( home_dir ){
+    int n = strlen30(home_dir) + 1;
+    char *z = malloc( n );
+    if( z ) memcpy(z, home_dir, n);
+    home_dir = z;
+  }
+
+  return home_dir;
+}
+
+/*
+** Read input from the file given by sqliterc_override.  Or if that
+** parameter is NULL, take input from ~/.sqliterc
+**
+** Returns the number of errors.
+*/
+static int process_sqliterc(
+  struct callback_data *p,        /* Configuration data */
+  const char *sqliterc_override   /* Name of config file. NULL to use default */
+){
+  char *home_dir = NULL;
+  const char *sqliterc = sqliterc_override;
+  char *zBuf = 0;
+  FILE *in = NULL;
+  int nBuf;
+  int rc = 0;
+
+  if (sqliterc == NULL) {
+    home_dir = find_home_dir();
+    if( home_dir==0 ){
+#if !defined(__RTP__) && !defined(_WRS_KERNEL)
+      fprintf(stderr,"%s: Error: cannot locate your home directory\n", Argv0);
+#endif
+      return 1;
+    }
+    nBuf = strlen30(home_dir) + 16;
+    zBuf = malloc( nBuf );
+    if( zBuf==0 ){
+      fprintf(stderr,"%s: Error: out of memory\n",Argv0);
+      return 1;
+    }
+    sqlite3_snprintf(nBuf, zBuf,"%s/.sqliterc",home_dir);
+    free(home_dir);
+    sqliterc = (const char*)zBuf;
+  }
+  in = fopen(sqliterc,"rb");
+  if( in ){
+    if( stdin_is_interactive ){
+      fprintf(stderr,"-- Loading resources from %s\n",sqliterc);
+    }
+    rc = process_input(p,in);
+    fclose(in);
+  }
+  free(zBuf);
+  return rc;
+}
+
+/*
+** Show available command line options
+*/
+static const char zOptions[] = 
+  "   -help                show this message\n"
+  "   -init filename       read/process named file\n"
+  "   -echo                print commands before execution\n"
+  "   -[no]header          turn headers on or off\n"
+  "   -bail                stop after hitting an error\n"
+  "   -interactive         force interactive I/O\n"
+  "   -batch               force batch I/O\n"
+  "   -column              set output mode to 'column'\n"
+  "   -csv                 set output mode to 'csv'\n"
+  "   -html                set output mode to HTML\n"
+  "   -line                set output mode to 'line'\n"
+  "   -list                set output mode to 'list'\n"
+  "   -separator 'x'       set output field separator (|)\n"
+  "   -stats               print memory stats before each finalize\n"
+  "   -nullvalue 'text'    set text string for NULL values\n"
+  "   -version             show SQLite version\n"
+  "   -vfs NAME            use NAME as the default VFS\n"
+#ifdef SQLITE_ENABLE_VFSTRACE
+  "   -vfstrace            enable tracing of all VFS calls\n"
+#endif
+;
+static void usage(int showDetail){
+  fprintf(stderr,
+      "Usage: %s [OPTIONS] FILENAME [SQL]\n"  
+      "FILENAME is the name of an SQLite database. A new database is created\n"
+      "if the file does not previously exist.\n", Argv0);
+  if( showDetail ){
+    fprintf(stderr, "OPTIONS include:\n%s", zOptions);
+  }else{
+    fprintf(stderr, "Use the -help option for additional information\n");
+  }
+  exit(1);
+}
+
+/*
+** Initialize the state information in data
+*/
+static void main_init(struct callback_data *data) {
+  memset(data, 0, sizeof(*data));
+  data->mode = MODE_List;
+  memcpy(data->separator,"|", 2);
+  data->showHeader = 0;
+  sqlite3_config(SQLITE_CONFIG_LOG, shellLog, data);
+  sqlite3_snprintf(sizeof(mainPrompt), mainPrompt,"sqlite> ");
+  sqlite3_snprintf(sizeof(continuePrompt), continuePrompt,"   ...> ");
+  sqlite3_config(SQLITE_CONFIG_SINGLETHREAD);
+}
+
+int main(int argc, char **argv){
+  char *zErrMsg = 0;
+  struct callback_data data;
+  const char *zInitFile = 0;
+  char *zFirstCmd = 0;
+  int i;
+  int rc = 0;
+
+  Argv0 = argv[0];
+  main_init(&data);
+  stdin_is_interactive = isatty(0);
+
+  /* Make sure we have a valid signal handler early, before anything
+  ** else is done.
+  */
+#ifdef SIGINT
+  signal(SIGINT, interrupt_handler);
+#endif
+
+  /* Do an initial pass through the command-line argument to locate
+  ** the name of the database file, the name of the initialization file,
+  ** the size of the alternative malloc heap,
+  ** and the first command to execute.
+  */
+  for(i=1; i<argc-1; i++){
+    char *z;
+    if( argv[i][0]!='-' ) break;
+    z = argv[i];
+    if( z[0]=='-' && z[1]=='-' ) z++;
+    if( strcmp(argv[i],"-separator")==0 || strcmp(argv[i],"-nullvalue")==0 ){
+      i++;
+    }else if( strcmp(argv[i],"-init")==0 ){
+      i++;
+      zInitFile = argv[i];
+    /* Need to check for batch mode here to so we can avoid printing
+    ** informational messages (like from process_sqliterc) before 
+    ** we do the actual processing of arguments later in a second pass.
+    */
+    }else if( strcmp(argv[i],"-batch")==0 ){
+      stdin_is_interactive = 0;
+    }else if( strcmp(argv[i],"-heap")==0 ){
+      int j, c;
+      const char *zSize;
+      sqlite3_int64 szHeap;
+
+      zSize = argv[++i];
+      szHeap = atoi(zSize);
+      for(j=0; (c = zSize[j])!=0; j++){
+        if( c=='M' ){ szHeap *= 1000000; break; }
+        if( c=='K' ){ szHeap *= 1000; break; }
+        if( c=='G' ){ szHeap *= 1000000000; break; }
+      }
+      if( szHeap>0x7fff0000 ) szHeap = 0x7fff0000;
+#if defined(SQLITE_ENABLE_MEMSYS3) || defined(SQLITE_ENABLE_MEMSYS5)
+      sqlite3_config(SQLITE_CONFIG_HEAP, malloc((int)szHeap), (int)szHeap, 64);
+#endif
+#ifdef SQLITE_ENABLE_VFSTRACE
+    }else if( strcmp(argv[i],"-vfstrace")==0 ){
+      extern int vfstrace_register(
+         const char *zTraceName,
+         const char *zOldVfsName,
+         int (*xOut)(const char*,void*),
+         void *pOutArg,
+         int makeDefault
+      );
+      vfstrace_register("trace",0,(int(*)(const char*,void*))fputs,stderr,1);
+#endif
+    }else if( strcmp(argv[i],"-vfs")==0 ){
+      sqlite3_vfs *pVfs = sqlite3_vfs_find(argv[++i]);
+      if( pVfs ){
+        sqlite3_vfs_register(pVfs, 1);
+      }else{
+        fprintf(stderr, "no such VFS: \"%s\"\n", argv[i]);
+        exit(1);
+      }
+    }
+  }
+  if( i<argc ){
+#if defined(SQLITE_OS_OS2) && SQLITE_OS_OS2
+    data.zDbFilename = (const char *)convertCpPathToUtf8( argv[i++] );
+#else
+    data.zDbFilename = argv[i++];
+#endif
+  }else{
+#ifndef SQLITE_OMIT_MEMORYDB
+    data.zDbFilename = ":memory:";
+#else
+    data.zDbFilename = 0;
+#endif
+  }
+  if( i<argc ){
+    zFirstCmd = argv[i++];
+  }
+  if( i<argc ){
+    fprintf(stderr,"%s: Error: too many options: \"%s\"\n", Argv0, argv[i]);
+    fprintf(stderr,"Use -help for a list of options.\n");
+    return 1;
+  }
+  data.out = stdout;
+
+#ifdef SQLITE_OMIT_MEMORYDB
+  if( data.zDbFilename==0 ){
+    fprintf(stderr,"%s: Error: no database filename specified\n", Argv0);
+    return 1;
+  }
+#endif
+
+  /* Go ahead and open the database file if it already exists.  If the
+  ** file does not exist, delay opening it.  This prevents empty database
+  ** files from being created if a user mistypes the database name argument
+  ** to the sqlite command-line tool.
+  */
+  if( access(data.zDbFilename, 0)==0 ){
+    open_db(&data);
+  }
+
+  /* Process the initialization file if there is one.  If no -init option
+  ** is given on the command line, look for a file named ~/.sqliterc and
+  ** try to process it.
+  */
+  rc = process_sqliterc(&data,zInitFile);
+  if( rc>0 ){
+    return rc;
+  }
+
+  /* Make a second pass through the command-line argument and set
+  ** options.  This second pass is delayed until after the initialization
+  ** file is processed so that the command-line arguments will override
+  ** settings in the initialization file.
+  */
+  for(i=1; i<argc && argv[i][0]=='-'; i++){
+    char *z = argv[i];
+    if( z[1]=='-' ){ z++; }
+    if( strcmp(z,"-init")==0 ){
+      i++;
+    }else if( strcmp(z,"-html")==0 ){
+      data.mode = MODE_Html;
+    }else if( strcmp(z,"-list")==0 ){
+      data.mode = MODE_List;
+    }else if( strcmp(z,"-line")==0 ){
+      data.mode = MODE_Line;
+    }else if( strcmp(z,"-column")==0 ){
+      data.mode = MODE_Column;
+    }else if( strcmp(z,"-csv")==0 ){
+      data.mode = MODE_Csv;
+      memcpy(data.separator,",",2);
+    }else if( strcmp(z,"-separator")==0 ){
+      i++;
+      if(i>=argc){
+        fprintf(stderr,"%s: Error: missing argument for option: %s\n", Argv0, z);
+        fprintf(stderr,"Use -help for a list of options.\n");
+        return 1;
+      }
+      sqlite3_snprintf(sizeof(data.separator), data.separator,
+                       "%.*s",(int)sizeof(data.separator)-1,argv[i]);
+    }else if( strcmp(z,"-nullvalue")==0 ){
+      i++;
+      if(i>=argc){
+        fprintf(stderr,"%s: Error: missing argument for option: %s\n", Argv0, z);
+        fprintf(stderr,"Use -help for a list of options.\n");
+        return 1;
+      }
+      sqlite3_snprintf(sizeof(data.nullvalue), data.nullvalue,
+                       "%.*s",(int)sizeof(data.nullvalue)-1,argv[i]);
+    }else if( strcmp(z,"-header")==0 ){
+      data.showHeader = 1;
+    }else if( strcmp(z,"-noheader")==0 ){
+      data.showHeader = 0;
+    }else if( strcmp(z,"-echo")==0 ){
+      data.echoOn = 1;
+    }else if( strcmp(z,"-stats")==0 ){
+      data.statsOn = 1;
+    }else if( strcmp(z,"-bail")==0 ){
+      bail_on_error = 1;
+    }else if( strcmp(z,"-version")==0 ){
+      printf("%s\n", sqlite3_libversion());
+      return 0;
+    }else if( strcmp(z,"-interactive")==0 ){
+      stdin_is_interactive = 1;
+    }else if( strcmp(z,"-batch")==0 ){
+      stdin_is_interactive = 0;
+    }else if( strcmp(z,"-heap")==0 ){
+      i++;
+    }else if( strcmp(z,"-vfs")==0 ){
+      i++;
+    }else if( strcmp(z,"-vfstrace")==0 ){
+      i++;
+    }else if( strcmp(z,"-help")==0 || strcmp(z, "--help")==0 ){
+      usage(1);
+    }else{
+      fprintf(stderr,"%s: Error: unknown option: %s\n", Argv0, z);
+      fprintf(stderr,"Use -help for a list of options.\n");
+      return 1;
+    }
+  }
+
+  if( zFirstCmd ){
+    /* Run just the command that follows the database name
+    */
+    if( zFirstCmd[0]=='.' ){
+      rc = do_meta_command(zFirstCmd, &data);
+    }else{
+      open_db(&data);
+      rc = shell_exec(data.db, zFirstCmd, shell_callback, &data, &zErrMsg);
+      if( zErrMsg!=0 ){
+        fprintf(stderr,"Error: %s\n", zErrMsg);
+        return rc!=0 ? rc : 1;
+      }else if( rc!=0 ){
+        fprintf(stderr,"Error: unable to process SQL \"%s\"\n", zFirstCmd);
+        return rc;
+      }
+    }
+  }else{
+    /* Run commands received from standard input
+    */
+    if( stdin_is_interactive ){
+      char *zHome;
+      char *zHistory = 0;
+      int nHistory;
+      printf(
+        "SQLite version %s\n"
+        "Enter \".help\" for instructions\n"
+        "Enter SQL statements terminated with a \";\"\n",
+        sqlite3_libversion()
+      );
+      zHome = find_home_dir();
+      if( zHome ){
+        nHistory = strlen30(zHome) + 20;
+        if( (zHistory = malloc(nHistory))!=0 ){
+          sqlite3_snprintf(nHistory, zHistory,"%s/.sqlite_history", zHome);
+        }
+      }
+#if defined(HAVE_READLINE) && HAVE_READLINE==1
+      if( zHistory ) read_history(zHistory);
+#endif
+      rc = process_input(&data, 0);
+      if( zHistory ){
+        stifle_history(100);
+        write_history(zHistory);
+        free(zHistory);
+      }
+      free(zHome);
+    }else{
+      rc = process_input(&data, stdin);
+    }
+  }
+  set_table_name(&data, 0);
+  if( data.db ){
+    sqlite3_close(data.db);
+  }
+  return rc;
+}

Some files were not shown because too many files changed in this diff