From 78ef2c5f16524684b4682ac2ef614abe1ed62dd7 Mon Sep 17 00:00:00 2001
From: Adam Ierymenko <adam.ierymenko@zerotier.com>
Date: Fri, 17 Mar 2017 20:01:58 -0700
Subject: [PATCH] Windows build fixes, app about text revisions.

---
 node/Packet.cpp              |   2 +
 one.cpp                      |   3 +-
 osdep/OSUtils.cpp            |   2 +-
 service/SoftwareUpdater.cpp  |   4 +-
 windows/WinUI/AboutView.xaml | 120 ++++++++---------------------------
 5 files changed, 33 insertions(+), 98 deletions(-)

diff --git a/node/Packet.cpp b/node/Packet.cpp
index b07f0bedb..756f3140c 100644
--- a/node/Packet.cpp
+++ b/node/Packet.cpp
@@ -273,7 +273,9 @@ union LZ4_streamDecode_u {
 #endif  /* _MSC_VER */
 #endif
 
+#ifndef FORCE_INLINE
 #define FORCE_INLINE static inline
+#endif
 
 #if (defined(__GNUC__) && (__GNUC__ >= 3)) || (defined(__INTEL_COMPILER) && (__INTEL_COMPILER >= 800)) || defined(__clang__)
 #  define expect(expr,value)    (__builtin_expect ((expr),(value)) )
diff --git a/one.cpp b/one.cpp
index 25a50dbb4..edefe82ec 100644
--- a/one.cpp
+++ b/one.cpp
@@ -1479,7 +1479,6 @@ int main(int argc,char **argv)
 #endif // __WINDOWS__
 
 #ifdef __UNIX_LIKE__
-
 #ifdef ZT_HAVE_DROP_PRIVILEGES
 	dropPrivileges(argv[0],homeDir);
 #endif
@@ -1499,7 +1498,9 @@ int main(int argc,char **argv)
 	thr.threadMain();
 	//Thread::join(Thread::start(&thr));
 
+#ifdef __UNIX_LIKE__
 	OSUtils::rm(pidPath.c_str());
+#endif
 
 	return thr.returnValue;
 }
diff --git a/osdep/OSUtils.cpp b/osdep/OSUtils.cpp
index aac6bdd82..33e143dad 100644
--- a/osdep/OSUtils.cpp
+++ b/osdep/OSUtils.cpp
@@ -125,7 +125,7 @@ long OSUtils::cleanDirectory(const char *path,const uint64_t olderThan)
 					date.LowPart = ffd.ftLastWriteTime.dwLowDateTime;
 					if (date.QuadPart > 0) {
 							date.QuadPart -= adjust.QuadPart;
-							if (((date.QuadPart / 10000000) * 1000) < olderThan) {
+							if ((uint64_t)((date.QuadPart / 10000000) * 1000) < olderThan) {
 									Utils::snprintf(tmp, sizeof(tmp), "%s\\%s", path, ffd.cFileName);
 									if (DeleteFileA(tmp))
 											++cleaned;
diff --git a/service/SoftwareUpdater.cpp b/service/SoftwareUpdater.cpp
index 2afbc7765..7ecd42b15 100644
--- a/service/SoftwareUpdater.cpp
+++ b/service/SoftwareUpdater.cpp
@@ -148,9 +148,9 @@ void SoftwareUpdater::handleSoftwareUpdateUserMessage(uint64_t origin,const void
 								std::vector<unsigned int> dvArch;
 								if (dvArch2.is_array()) {
 									for(unsigned long i=0;i<dvArch2.size();++i)
-										dvArch.push_back(OSUtils::jsonInt(dvArch2[i],0));
+										dvArch.push_back((unsigned int)OSUtils::jsonInt(dvArch2[i],0));
 								} else {
-									dvArch.push_back(OSUtils::jsonInt(dvArch2,0));
+									dvArch.push_back((unsigned int)OSUtils::jsonInt(dvArch2,0));
 								}
 
 								if ((OSUtils::jsonInt(d->second.meta[ZT_SOFTWARE_UPDATE_JSON_PLATFORM],0) == rvPlatform)&&
diff --git a/windows/WinUI/AboutView.xaml b/windows/WinUI/AboutView.xaml
index 5def46a68..7f4151f95 100644
--- a/windows/WinUI/AboutView.xaml
+++ b/windows/WinUI/AboutView.xaml
@@ -5,99 +5,31 @@
         xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
         xmlns:local="clr-namespace:WinUI"
         mc:Ignorable="d"
-        Title="AboutView" Height="460" Width="300" Icon="ZeroTierIcon.ico">
-    <Grid>
-        <Image x:Name="image" HorizontalAlignment="Center" Height="100" Margin="0,10,0,0" VerticalAlignment="Top" Width="100" Source="ZeroTierIcon.ico"/>
-        <RichTextBox x:Name="richTextBox" HorizontalAlignment="Left" Height="307" Margin="10,115,0,0" VerticalAlignment="Top" Width="275" IsReadOnly="True" IsDocumentEnabled="True" BorderThickness="0">
-            <RichTextBox.Resources>
-                <Style TargetType="Hyperlink">
-                    <Setter Property="Cursor" Value="Hand" />
-                </Style>
-            </RichTextBox.Resources>
-            <FlowDocument>
-                <Paragraph>
-                    <Span FontWeight="Bold" FontSize="18" FontFamily="HelveticaNeue">
-                        <Run Text="Getting Started"/>
-                    </Span>
-                    <Span FontWeight="Bold" FontSize="12" FontFamily="HelveticaNeue">
-                        <LineBreak/>
-                    </Span>
-                    <Span FontSize="12" FontFamily="HelveticaNeue">
-                        <Run/>
-                    </Span>
-                </Paragraph>
-                <Paragraph>
-                    <Span FontSize="12" FontFamily="HelveticaNeue">
-                        <Run Text="Getting started is simple. Simply click "/>
-                    </Span>
-                    <Span FontSize="12" FontFamily="Menlo-Regular">
-                        <Run Text="Join Network"/>
-                    </Span>
-                    <Span FontSize="12" FontFamily="HelveticaNeue">
-                        <Run Text=" from the ZeroTier status bar menu. To join the public network &quot;Earth&quot;, enter "/>
-                    </Span>
-                    <Span FontSize="12" FontFamily="Menlo-Regular">
-                        <Run Text="8056c2e21c000001"/>
-                    </Span>
-                    <Span FontSize="12" FontFamily="HelveticaNeue">
-                        <Run Text=" and click the Join button. Once connected, you'll be able to navigate to "/>
-                    </Span>
-                    <Hyperlink NavigateUri="http://earth.zerotier.net/" RequestNavigate="Hyperlink_MouseLeftButtonDown">
-                        <Span Foreground="#FF0000E9" FontSize="12" FontFamily="HelveticaNeue">
-                            <Run Text="earth.zerotier.net"/>
-                        </Span>
-                    </Hyperlink>
-                    <Span FontSize="12" FontFamily="HelveticaNeue">
-                        <Run Text="."/>
-                    </Span>
-                </Paragraph>
-                <Paragraph>
-                    <Span FontSize="12" FontFamily="HelveticaNeue">
-                        <Run/>
-                        <LineBreak/>
-                    </Span>
-                    <Span FontWeight="Bold" FontSize="18" FontFamily="HelveticaNeue">
-                        <Run Text="Create a Network"/>
-                    </Span>
-                    <Span FontWeight="Bold" FontSize="12" FontFamily="HelveticaNeue">
-                        <LineBreak/>
-                    </Span>
-                    <Span FontSize="12" FontFamily="HelveticaNeue">
-                        <Run/>
-                    </Span>
-                </Paragraph>
-                <Paragraph>
-                    <Span FontSize="12" FontFamily="HelveticaNeue">
-                        <Run Text="Visit "/>
-                    </Span>
-                    <Hyperlink NavigateUri="http://my.zerotier.com/" RequestNavigate="Hyperlink_MouseLeftButtonDown">
-                        <Span Foreground="#FF0000E9" FontSize="12" FontFamily="HelveticaNeue">
-                            <Run Text="my.zerotier.com"/>
-                        </Span>
-                    </Hyperlink>
-                    <Span FontSize="12" FontFamily="HelveticaNeue">
-                        <Run Text=" to create and manage your own virtual networks."/>
-                    </Span>
-                    <Span FontSize="12" FontFamily="HelveticaNeue">
-                        <LineBreak/>
-                        <Run/>
-                    </Span>
-                </Paragraph>
-                <Paragraph>
-                    <Span FontSize="12" FontFamily="HelveticaNeue">
-                        <Run Text="For more information, visit "/>
-                    </Span>
-                    <Hyperlink NavigateUri="http://www.zerotier.com/" RequestNavigate="Hyperlink_MouseLeftButtonDown">
-                        <Span Foreground="#FF0000E9" FontSize="12" FontFamily="HelveticaNeue">
-                            <Run Text="zerotier.com"/>
-                        </Span>
-                    </Hyperlink>
-                    <Span FontSize="12" FontFamily="HelveticaNeue">
-                        <Run Text="."/>
-                    </Span>
-                </Paragraph>
-            </FlowDocument>
-        </RichTextBox>
+        Title="AboutView" Height="368.267" Width="300" Icon="ZeroTierIcon.ico">
+	<Grid>
+		<Image x:Name="image" HorizontalAlignment="Center" Height="100" Margin="0,10,0,0" VerticalAlignment="Top" Width="100" Source="ZeroTierIcon.ico"/>
+		<RichTextBox x:Name="richTextBox" HorizontalAlignment="Left" Height="209" Margin="10,123,0,0" VerticalAlignment="Top" Width="275" IsReadOnly="True" IsDocumentEnabled="True" BorderThickness="0" TextChanged="richTextBox_TextChanged" FontSize="18" RenderTransformOrigin="0.506,0.63">
+			<RichTextBox.Resources>
+				<Style TargetType="Hyperlink">
+					<Setter Property="Cursor" Value="Hand" />
+				</Style>
+			</RichTextBox.Resources>
+			<FlowDocument>
+				<Paragraph TextAlignment="Center">
+					<Run Text="ZeroTier One"/>
+				</Paragraph>
+				<Paragraph TextAlignment="Center">
+					<Run FontSize="14" Text="Version 1.2.2"/>
+					<LineBreak/>
+					<Run FontSize="14" Text="(c) 2011-2017 ZeroTier, Inc."/>
+					<LineBreak/>
+					<Run FontSize="14" Text="www.zerotier.com"/>
+				</Paragraph>
+				<Paragraph TextAlignment="Center">
+					<Run FontSize="14" Text="ZeroTier One allows your computer to join virtual networks. Just select &quot;join&quot; and enter a network's 16-digit ID. Each network appears on your computer as a new network port."/>
+				</Paragraph>
+			</FlowDocument>
+		</RichTextBox>
 
-    </Grid>
+	</Grid>
 </Window>