Skip to content

Commit eecf384

Browse files
peiche-msvickiezOgnjen Sobajic
authored
Move projects to use latest WebView2 SDK 1.0.707-prerelease (#63)
* Updates for Win32, WPF and WinForms sample apps from official/664m87. Win32 builds and runs against 1.0.664.33-prerelease WPF and WinForms build and run against 1.0.664.33 (release version) * Move Win32 project to use latest WebView2 SDK 1.0.702-prerelease * Move .NET project to use latest WebView2 SDK * Wrapped some code in ViewComponent::SetRasterizationScale in USE_WEBVIEW2_WIN10 * Move projects to use latest WebView2 SDK 1.0.707-prerelease Co-authored-by: Viktoria Zlatinova <[email protected]> Co-authored-by: Ognjen Sobajic <[email protected]>
1 parent 8ec7de9 commit eecf384

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

44 files changed

+1672
-1097
lines changed
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
Debug/
2+
Release/
3+
S Debug/
4+
S Release/
5+
Win7 Debug/
6+
Win7 Release/
7+
ipch/
8+
x64/
9+
x86/
10+
ARM64/
11+
.vs/
12+
# Created by running event monitor
13+
enc_temp_folder/
14+
packages/
15+
16+
# Override root .gitignore to ensure we pick up changes for the sample app
17+
!*.sln
18+
!*.vcxproj
19+
!*.vcxproj.filters
20+
!*.props
21+
22+
# Ignore the binary generated version of the resource (.rc) file
23+
*.aps
24+
25+
# Ignore files generated by midl
26+
/HostObjectSample_h.h
27+
/HostObjectSample_i.c
28+
29+
# Make sure script debug config is checked in for vendor testing
30+
!.vscode
Lines changed: 108 additions & 108 deletions
Original file line numberDiff line numberDiff line change
@@ -1,109 +1,109 @@
1-
// Copyright (C) Microsoft Corporation. All rights reserved.
2-
// Use of this source code is governed by a BSD-style license that can be
3-
// found in the LICENSE file.
4-
5-
#include "stdafx.h"
6-
7-
#include <algorithm>
8-
#include <pathcch.h>
9-
#include <Psapi.h>
10-
11-
#include "AppStartPage.h"
12-
#include "AppWindow.h"
13-
#include "CheckFailure.h"
14-
15-
using namespace Microsoft::WRL;
16-
17-
namespace AppStartPage
18-
{
19-
20-
bool AreFileUrisEqual(std::wstring leftUri, std::wstring rightUri)
21-
{
22-
// Have to to lower due to current bug
23-
std::transform(leftUri.begin(), leftUri.end(),
24-
leftUri.begin(), ::tolower);
25-
std::transform(rightUri.begin(), rightUri.end(),
26-
rightUri.begin(), ::tolower);
27-
28-
return leftUri == rightUri;
29-
}
30-
31-
std::wstring ResolvePathAndTrimFile(std::wstring path)
32-
{
33-
wchar_t resultPath[MAX_PATH];
34-
PathCchCanonicalize(resultPath, ARRAYSIZE(resultPath), path.c_str());
35-
PathCchRemoveFileSpec(resultPath, ARRAYSIZE(resultPath));
36-
return resultPath;
37-
}
38-
39-
std::wstring GetSdkBuild()
40-
{
41-
auto options = Microsoft::WRL::Make<CoreWebView2EnvironmentOptions>();
42-
wil::unique_cotaskmem_string targetVersion;
43-
CHECK_FAILURE(options->get_TargetCompatibleBrowserVersion(&targetVersion));
44-
45-
// The full version string A.B.C.D
46-
const wchar_t* targetVersionMajorAndRest = targetVersion.get();
47-
// Should now be .B.C.D
48-
const wchar_t* targetVersionMinorAndRest = wcschr(targetVersionMajorAndRest, L'.');
49-
CHECK_FAILURE((targetVersionMinorAndRest != nullptr && *targetVersionMinorAndRest == L'.') ? S_OK : E_UNEXPECTED);
50-
51-
// Should now be .C.D
52-
const wchar_t* targetVersionBuildAndRest = wcschr(targetVersionMinorAndRest + 1, L'.');
53-
CHECK_FAILURE((targetVersionBuildAndRest != nullptr && *targetVersionBuildAndRest == L'.') ? S_OK : E_UNEXPECTED);
54-
55-
// Return + 1 to skip the first . so just C.D
56-
return targetVersionBuildAndRest + 1;
57-
}
58-
59-
std::wstring GetRuntimeVersion(AppWindow* appWindow)
60-
{
61-
wil::com_ptr<ICoreWebView2Environment> environment = appWindow->GetWebViewEnvironment();
62-
wil::unique_cotaskmem_string runtimeVersion;
63-
CHECK_FAILURE(environment->get_BrowserVersionString(&runtimeVersion));
64-
65-
return runtimeVersion.get();
66-
}
67-
68-
std::wstring GetAppPath()
69-
{
70-
wchar_t appPath[MAX_PATH];
71-
GetModuleFileName(nullptr, appPath, ARRAYSIZE(appPath));
72-
return ResolvePathAndTrimFile(appPath);
73-
}
74-
75-
std::wstring GetRuntimePath(AppWindow* appWindow)
76-
{
77-
wil::com_ptr<ICoreWebView2> webview = appWindow->GetWebView();
78-
UINT32 browserProcessId = 0;
79-
wchar_t runtimePath[MAX_PATH];
80-
CHECK_FAILURE(webview->get_BrowserProcessId(&browserProcessId));
81-
82-
HANDLE processHandle = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, browserProcessId);
83-
CHECK_FAILURE(processHandle == nullptr ? E_FAIL : S_OK);
84-
GetModuleFileNameEx(processHandle, nullptr, runtimePath, ARRAYSIZE(runtimePath));
85-
CloseHandle(processHandle);
86-
87-
return ResolvePathAndTrimFile(runtimePath);
88-
}
89-
90-
std::wstring GetUri(AppWindow* appWindow)
91-
{
92-
std::wstring uri = appWindow->GetLocalUri(L"AppStartPage.html");
93-
94-
uri += L"?sdkBuild=";
95-
uri += GetSdkBuild();
96-
97-
uri += L"&runtimeVersion=";
98-
uri += GetRuntimeVersion(appWindow);
99-
100-
uri += L"&appPath=";
101-
uri += GetAppPath();
102-
103-
uri += L"&runtimePath=";
104-
uri += GetRuntimePath(appWindow);
105-
106-
return uri;
107-
}
108-
1+
// Copyright (C) Microsoft Corporation. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
#include "stdafx.h"
6+
7+
#include <algorithm>
8+
#include <pathcch.h>
9+
#include <Psapi.h>
10+
11+
#include "AppStartPage.h"
12+
#include "AppWindow.h"
13+
#include "CheckFailure.h"
14+
15+
using namespace Microsoft::WRL;
16+
17+
namespace AppStartPage
18+
{
19+
20+
bool AreFileUrisEqual(std::wstring leftUri, std::wstring rightUri)
21+
{
22+
// Have to to lower due to current bug
23+
std::transform(leftUri.begin(), leftUri.end(),
24+
leftUri.begin(), ::tolower);
25+
std::transform(rightUri.begin(), rightUri.end(),
26+
rightUri.begin(), ::tolower);
27+
28+
return leftUri == rightUri;
29+
}
30+
31+
std::wstring ResolvePathAndTrimFile(std::wstring path)
32+
{
33+
wchar_t resultPath[MAX_PATH];
34+
PathCchCanonicalize(resultPath, ARRAYSIZE(resultPath), path.c_str());
35+
PathCchRemoveFileSpec(resultPath, ARRAYSIZE(resultPath));
36+
return resultPath;
37+
}
38+
39+
std::wstring GetSdkBuild()
40+
{
41+
auto options = Microsoft::WRL::Make<CoreWebView2EnvironmentOptions>();
42+
wil::unique_cotaskmem_string targetVersion;
43+
CHECK_FAILURE(options->get_TargetCompatibleBrowserVersion(&targetVersion));
44+
45+
// The full version string A.B.C.D
46+
const wchar_t* targetVersionMajorAndRest = targetVersion.get();
47+
// Should now be .B.C.D
48+
const wchar_t* targetVersionMinorAndRest = wcschr(targetVersionMajorAndRest, L'.');
49+
CHECK_FAILURE((targetVersionMinorAndRest != nullptr && *targetVersionMinorAndRest == L'.') ? S_OK : E_UNEXPECTED);
50+
51+
// Should now be .C.D
52+
const wchar_t* targetVersionBuildAndRest = wcschr(targetVersionMinorAndRest + 1, L'.');
53+
CHECK_FAILURE((targetVersionBuildAndRest != nullptr && *targetVersionBuildAndRest == L'.') ? S_OK : E_UNEXPECTED);
54+
55+
// Return + 1 to skip the first . so just C.D
56+
return targetVersionBuildAndRest + 1;
57+
}
58+
59+
std::wstring GetRuntimeVersion(AppWindow* appWindow)
60+
{
61+
wil::com_ptr<ICoreWebView2Environment> environment = appWindow->GetWebViewEnvironment();
62+
wil::unique_cotaskmem_string runtimeVersion;
63+
CHECK_FAILURE(environment->get_BrowserVersionString(&runtimeVersion));
64+
65+
return runtimeVersion.get();
66+
}
67+
68+
std::wstring GetAppPath()
69+
{
70+
wchar_t appPath[MAX_PATH];
71+
GetModuleFileName(nullptr, appPath, ARRAYSIZE(appPath));
72+
return ResolvePathAndTrimFile(appPath);
73+
}
74+
75+
std::wstring GetRuntimePath(AppWindow* appWindow)
76+
{
77+
wil::com_ptr<ICoreWebView2> webview = appWindow->GetWebView();
78+
UINT32 browserProcessId = 0;
79+
wchar_t runtimePath[MAX_PATH];
80+
CHECK_FAILURE(webview->get_BrowserProcessId(&browserProcessId));
81+
82+
HANDLE processHandle = OpenProcess(PROCESS_QUERY_INFORMATION | PROCESS_VM_READ, FALSE, browserProcessId);
83+
CHECK_FAILURE(processHandle == nullptr ? E_FAIL : S_OK);
84+
GetModuleFileNameEx(processHandle, nullptr, runtimePath, ARRAYSIZE(runtimePath));
85+
CloseHandle(processHandle);
86+
87+
return ResolvePathAndTrimFile(runtimePath);
88+
}
89+
90+
std::wstring GetUri(AppWindow* appWindow)
91+
{
92+
std::wstring uri = appWindow->GetLocalUri(L"AppStartPage.html");
93+
94+
uri += L"?sdkBuild=";
95+
uri += GetSdkBuild();
96+
97+
uri += L"&runtimeVersion=";
98+
uri += GetRuntimeVersion(appWindow);
99+
100+
uri += L"&appPath=";
101+
uri += GetAppPath();
102+
103+
uri += L"&runtimePath=";
104+
uri += GetRuntimePath(appWindow);
105+
106+
return uri;
107+
}
108+
109109
}; // namespace AppStartPage
Lines changed: 15 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
// Copyright (C) Microsoft Corporation. All rights reserved.
2-
// Use of this source code is governed by a BSD-style license that can be
3-
// found in the LICENSE file.
4-
5-
#pragma once
6-
7-
#include "stdafx.h"
8-
#include <string>
9-
10-
class AppWindow;
11-
12-
namespace AppStartPage
13-
{
14-
std::wstring GetUri(AppWindow* appWindow);
15-
};
1+
// Copyright (C) Microsoft Corporation. All rights reserved.
2+
// Use of this source code is governed by a BSD-style license that can be
3+
// found in the LICENSE file.
4+
5+
#pragma once
6+
7+
#include "stdafx.h"
8+
#include <string>
9+
10+
class AppWindow;
11+
12+
namespace AppStartPage
13+
{
14+
std::wstring GetUri(AppWindow* appWindow);
15+
};
Binary file not shown.

0 commit comments

Comments
 (0)