Skip to content

Commit 65ed223

Browse files
author
Colin Robertson
authored
Merge pull request #1387 from corob-msft/cr-frontier-porting
Fix Markdig issues in porting, security, and text
2 parents b4daeeb + ef7900d commit 65ed223

File tree

43 files changed

+5114
-4871
lines changed

Some content is hidden

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

43 files changed

+5114
-4871
lines changed

docs/porting/fix-your-dependencies-on-library-internals.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,6 +75,6 @@ inline size_t fnv1a_hash_bytes(const unsigned char * first, size_t count) {
7575
7676
## See also
7777
78-
[Upgrading Projects from Earlier Versions of Visual C++](upgrading-projects-from-earlier-versions-of-visual-cpp.md)
79-
[Overview of potential upgrade issues (Visual C++)](overview-of-potential-upgrade-issues-visual-cpp.md)
78+
[Upgrading Projects from Earlier Versions of Visual C++](upgrading-projects-from-earlier-versions-of-visual-cpp.md)<br/>
79+
[Overview of potential upgrade issues (Visual C++)](overview-of-potential-upgrade-issues-visual-cpp.md)<br/>
8080
[Upgrade your code to the Universal CRT](upgrade-your-code-to-the-universal-crt.md)

docs/porting/floating-point-migration-issues.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ ms.author: "corob"
1111
ms.workload: ["cplusplus"]
1212
---
1313
# Floating-point migration issues
14+
1415

1516
Sometimes when you upgrade your projects to a newer version of Visual Studio, you may find that the results of certain floating-point operations have changed. This generally happens for one of two reasons: Code generation changes that take better advantage of the available processor, and bug fixes or changes to the algorithms used in math functions in the C runtime library (CRT). In general, the new results are correct to within the limits specified by the language standard. Read on to find out what's changed, and if it's important, how to get the same results your functions got before.
1617

@@ -32,6 +33,6 @@ In most cases, the floating-point changes in the newest compilers and libraries
3233

3334
## See also
3435

35-
[Upgrading Projects from Earlier Versions of Visual C++](upgrading-projects-from-earlier-versions-of-visual-cpp.md)
36-
[Overview of potential upgrade issues (Visual C++)](overview-of-potential-upgrade-issues-visual-cpp.md)
36+
[Upgrading Projects from Earlier Versions of Visual C++](upgrading-projects-from-earlier-versions-of-visual-cpp.md)<br/>
37+
[Overview of potential upgrade issues (Visual C++)](overview-of-potential-upgrade-issues-visual-cpp.md)<br/>
3738
[Visual C++ change history 2003 - 2015](visual-cpp-change-history-2003-2015.md)

docs/porting/overview-of-potential-upgrade-issues-visual-cpp.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -180,5 +180,5 @@ For more information, see [Porting from MBCS to Unicode](porting-guide-spy-incre
180180

181181
## See also
182182

183-
[Upgrading Projects from Earlier Versions of Visual C++](upgrading-projects-from-earlier-versions-of-visual-cpp.md)
183+
[Upgrading Projects from Earlier Versions of Visual C++](upgrading-projects-from-earlier-versions-of-visual-cpp.md)<br/>
184184
[C++ conformance improvements in Visual Studio 2017](../cpp-conformance-improvements-2017.md)

docs/porting/porting-and-upgrading-examples-and-case-studies.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ ms.author: "mblome"
1111
ms.workload: ["cplusplus"]
1212
---
1313
# Porting and Upgrading: Examples and Case Studies
14+
1415
You can get an idea of the kinds of issues you might encounter duration a migration from a previous version of Visual C++ to the current one by reviewing stories of successful migrations.
1516

1617
## Examples of Successful Migrations

docs/porting/porting-data-applications.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,6 @@ For more information about the history of data access technologies on Microsoft
2929

3030
## See Also
3131

32-
[Data Access in Visual C++](../data/data-access-in-cpp.md)
33-
[Microsoft Open Database Connectivity (ODBC)](https://docs.microsoft.com/sql/odbc/microsoft-open-database-connectivity-odbc)
32+
[Data Access in Visual C++](../data/data-access-in-cpp.md)<br/>
33+
[Microsoft Open Database Connectivity (ODBC)](https://docs.microsoft.com/sql/odbc/microsoft-open-database-connectivity-odbc)<br/>
3434
[Data Access Technologies Road Map](https://msdn.microsoft.com/library/ms810810.aspx)

docs/porting/porting-from-unix-to-win32.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ ms.author: "mblome"
1212
ms.workload: ["cplusplus"]
1313
---
1414
# Porting from UNIX to Win32
15+
1516
When migrating applications from UNIX to Windows, you have several options:
1617

1718
- Using UNIX libraries to port applications from UNIX to Win32
@@ -68,6 +69,6 @@ Another option UNIX programmers look at is the Windows POSIX subsystem. However,
6869

6970
## See Also
7071

71-
[Visual C++ Porting and Upgrading Guide](visual-cpp-change-history-2003-2015.md)
72-
[UNIX](../c-runtime-library/unix.md)
72+
[Visual C++ Porting and Upgrading Guide](visual-cpp-change-history-2003-2015.md)<br/>
73+
[UNIX](../c-runtime-library/unix.md)<br/>
7374
[Inference Rules](../build/inference-rules.md)

docs/porting/porting-guide-com-spy.md

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ ms.author: "mblome"
1111
ms.workload: ["cplusplus"]
1212
---
1313
# Porting Guide: COM Spy
14+
1415
This topic is the second in a series of articles that demonstrates the process of upgrading older Visual C++ projects to the latest version of Visual Studio. The example code in this topic was last compiled with Visual Studio 2005.
1516

1617
## COMSpy
@@ -166,6 +167,6 @@ This ran without problems, and with COM Spy up and running and configured to mon
166167
167168
## See Also
168169
169-
[Porting and Upgrading: Examples and Case Studies](../porting/porting-and-upgrading-examples-and-case-studies.md)
170-
[Next Example: Spy++](../porting/porting-guide-spy-increment.md)
170+
[Porting and Upgrading: Examples and Case Studies](../porting/porting-and-upgrading-examples-and-case-studies.md)<br/>
171+
[Next Example: Spy++](../porting/porting-guide-spy-increment.md)<br/>
171172
[Previous Example: MFC Scribble](../porting/porting-guide-mfc-scribble.md)

docs/porting/porting-guide-mfc-scribble.md

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ ms.author: "mblome"
1111
ms.workload: ["cplusplus"]
1212
---
1313
# Porting Guide: MFC Scribble
14+
1415
This topic is the first of several topics that introduce you to the upgrade procedure for Visual C++ projects that were created in older versions of Visual Studio to Visual Studio 2017. These topics introduce the upgrade process by example, starting with a very simple project and moving to slightly more complex ones. In this topic, we work through the upgrade process for a specific project, MFC Scribble. It is suitable as a basic introduction to the upgrade process for C++ projects.
1516

1617
Each version of Visual Studio introduces possible incompatibilities that can complicate moving code from an older version of Visual Studio to a newer one. Sometimes the required changes are in your code, so you must recompile and update your code, and sometimes the required changes are to the project files. When you open a project that was created with a previous version of Visual Studio, Visual Studio automatically asks you whether to update a project or solution to the latest version. These tools usually upgrade only the project files; they do not modify your source code.
@@ -28,6 +29,7 @@ Finally, we needed to decide on the specific method of upgrade. For more complex
2829
Note that you can also run devenv at the command line, using the `/Upgrade` option, instead of using the wizard to upgrade your projects. See [/Upgrade (devenv.exe)](/visualstudio/ide/reference/upgrade-devenv-exe). That could be helpful in automating the upgrade process for a large number of projects.
2930

3031
### Step 1. Converting the Project File
32+
3133
When you open an old project file in Visual Studio 2017, Visual Studio offers to convert the project file to the most recent version, which we accepted. The following dialog box appeared:
3234

3335
![Review Project and Solution Changes](../porting/media/scribbleprojectupgrade.PNG "ScribbleProjectUpgrade")
@@ -47,6 +49,7 @@ Visual Studio then displayed a migration report listing all of the issues with t
4749
In this case, the issues were all warnings, and Visual Studio made the appropriate changes in the project file. The big difference as far as the project is concerned is that the build tool changed from vcbuild to msbuild. This change was first introduced in Visual Studio 2010. Other changes include some rearrangement of the sequence of elements in the project file itself. None of the issues required further attention for this simple project.
4850

4951
### Step 2. Getting it to build
52+
5053
Before building, we check the platform toolset so we know what compiler version the project system is using. In the project properties dialog, under **Configuration Properties**, in the **General** category, look at the **Platform Toolset** property. It contains the version of Visual Studio and the platform tool version number, which in this case is v141 for the Visual Studio 2017 version of the tools. When you convert a project that was originally compiled with Visual C++ 2010, 2012, 2013 or 2015, the toolset is not automatically updated to the Visual Studio 2017 toolset.
5154

5255
To make the switch to Unicode, open the project's properties, under **Configuration Properties**, choose the **General** section, and locate the **Character Set** property. Change this from **Use Multi-Byte Character Set** to **Use Unicode Character Set**. The effect of this change is that now the _UNICODE and UNICODE macros are defined and _MBCS is not, which you can verify in the properties dialog under the **C/C++** category at the **Command Line** property.
@@ -63,18 +66,20 @@ Now build the solution. In the output window, the compiler tells us that _WINNT3
6366
_WIN32_WINNT not defined. Defaulting to _WIN32_WINNT_MAXVER (see WinSDKVer.h)
6467
```
6568

66-
This is a warning, not an error, and is very common when upgrading a Visual C++ project. This is the macro that defines what the lowest version of Windows that our application will run on. If we ignore the warning, we accept the default value, _WIN32_WINNT_MAXVER, which means the current version of Windows. For a table of possible values, see [Using the Windows Headers](/windows/desktop/WinProg/using-the-windows-headers). For example, we can set it to run on any version from Vista onwards.
69+
This is a warning, not an error, and is very common when upgrading a Visual C++ project. This is the macro that defines what the lowest version of Windows that our application will run on. If we ignore the warning, we accept the default value, _WIN32_WINNT_MAXVER, which means the current version of Windows. For a table of possible values, see [Using the Windows Headers](/windows/desktop/WinProg/using-the-windows-headers). For example, we can set it to run on any version from Vista onwards.
6770

68-
```
71+
```cpp
6972
#define _WIN32_WINNT _WIN32_WINNT_VISTA
7073
```
7174
7275
If the code uses parts of the Windows API that aren't available on the version of Windows that you specify with this macro, you should see that as a compiler error. In the case of the Scribble code, there is no error.
7376
7477
### Step 3. Testing and debugging
78+
7579
There is no test suite, so we just started the app, tested its features manually through the UI. No issues were observed.
7680
7781
### Step 4. Improve the code
82+
7883
Now that you've migrated to Visual Studio 2017, you might want to make some changes to take advantage of new C++ features. The current version of the C++ compiler is much more conformant to the C++ standard then previous versions, so if you have a mind to make some code changes to make your code more secure, and more portable to other compilers and operating systems, you should consider some improvements.
7984
8085
## Next steps
@@ -83,5 +88,5 @@ Scribble was a small and simple Windows desktop application, and it wasn't hard
8388
8489
## See Also
8590
86-
[Porting and Upgrading: Examples and Case Studies](../porting/porting-and-upgrading-examples-and-case-studies.md)
91+
[Porting and Upgrading: Examples and Case Studies](../porting/porting-and-upgrading-examples-and-case-studies.md)<br/>
8792
[Next Example: COM Spy](../porting/porting-guide-com-spy.md)

docs/porting/porting-guide-spy-increment.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ ms.author: "mblome"
1111
ms.workload: ["cplusplus"]
1212
---
1313
# Porting Guide: Spy++
14+
1415
This porting case study is designed to give you an idea of what a typical porting project is like, the types of problems you might encounter, and some general tips and tricks for addressing porting problems. It's not meant to be a definitive guide to porting, since the experience of porting a project depends very much on the specifics of the code.
1516

1617
## Spy++
@@ -65,7 +66,7 @@ C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\atlmfc\include\afxv_w32.h
6566

6667
Windows XP is no longer supported by Microsoft, so even though targeting it is allowed in Visual Studio 2015, you should be phasing out support for it in your applications, and encouraging your users to adopt new versions of Windows.
6768

68-
To get rid of the error, define WINVER by updating the **Project Properties** setting to the lowest version of Windows you currently want to target. Find a table of values for various Windows releases [here](/windows/desktop/WinProg/using-the-windows-headers).
69+
To get rid of the error, define WINVER by updating the **Project Properties** setting to the lowest version of Windows you currently want to target. Find a table of values for various Windows releases [here](/windows/desktop/WinProg/using-the-windows-headers).
6970

7071
The stdafx.h file contained some of these macro definitions.
7172

@@ -542,7 +543,7 @@ wsprintf(szTmp, _T("%d.%2.2d.%4.4d"), rmj, rmm, rup);
542543

543544
The _T macro has the effect of making a string literal compile as a **char** string or a **wchar_t** string, depending on the setting of MBCS or UNICODE. To replace all strings with _T in Visual Studio, first open the **Quick Replace** (Keyboard: **Ctrl**+**F**) box or the **Replace In Files** (Keyboard: **Ctrl**+**Shift**+**H**), then choose the **Use Regular Expressions** checkbox. Enter `((\".*?\")|('.+?'))` as the search text and `_T($1)` as the replacement text. If you already have the _T macro around some strings, this procedure will add it again, and it might also find cases where you don't want _T, such as when you use `#include`, so it's best to use **Replace Next** rather than **Replace All**.
544545

545-
This particular function, [wsprintf](/windows/desktop/api/winuser/nf-winuser-wsprintfa), is actually defined in the Windows headers, and the documentation for it recommends that it not be used, due to possible buffer overrun. No size is given for the `szTmp` buffer, so there is no way for the function to check that the buffer can hold all the data to be written to it. See the next section about porting to the Secure CRT, in which we fix other similar problems. We ended up replacing it with [_stprintf_s](../c-runtime-library/reference/sprintf-s-sprintf-s-l-swprintf-s-swprintf-s-l.md).
546+
This particular function, [wsprintf](/windows/desktop/api/winuser/nf-winuser-wsprintfa), is actually defined in the Windows headers, and the documentation for it recommends that it not be used, due to possible buffer overrun. No size is given for the `szTmp` buffer, so there is no way for the function to check that the buffer can hold all the data to be written to it. See the next section about porting to the Secure CRT, in which we fix other similar problems. We ended up replacing it with [_stprintf_s](../c-runtime-library/reference/sprintf-s-sprintf-s-l-swprintf-s-swprintf-s-l.md).
546547

547548
Another common error you’ll see in converting to Unicode is this.
548549

@@ -671,5 +672,5 @@ Porting Spy++ from the original Visual C++ 6.0 code to the latest compiler took
671672
672673
## See Also
673674
674-
[Porting and Upgrading: Examples and Case Studies](../porting/porting-and-upgrading-examples-and-case-studies.md)
675+
[Porting and Upgrading: Examples and Case Studies](../porting/porting-and-upgrading-examples-and-case-studies.md)<br/>
675676
[Previous case study: COM Spy](../porting/porting-guide-com-spy.md)

docs/porting/porting-to-the-universal-windows-platform-cpp.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -109,5 +109,5 @@ If you created a new UWP project using Visual Studio, you should not see this er
109109

110110
## See also
111111

112-
[Visual C++ Porting Guide](../porting/porting-to-the-universal-windows-platform-cpp.md)
112+
[Visual C++ Porting Guide](../porting/porting-to-the-universal-windows-platform-cpp.md)<br/>
113113
[Develop apps for the Universal Windows Platform (UWP)](/visualstudio/cross-platform/develop-apps-for-the-universal-windows-platform-uwp)

docs/porting/upgrade-your-code-to-the-universal-crt.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,8 +44,8 @@ Many functions were added or updated in the UCRT to improve ISO C99 conformance,
4444

4545
## See Also
4646

47-
[Visual C++ Porting and Upgrading Guide](visual-cpp-porting-and-upgrading-guide.md)
48-
[Overview of potential upgrade issues (Visual C++)](overview-of-potential-upgrade-issues-visual-cpp.md)
49-
[Upgrading Projects from Earlier Versions of Visual C++](upgrading-projects-from-earlier-versions-of-visual-cpp.md)
50-
[Visual C++ change history 2003 - 2015](visual-cpp-change-history-2003-2015.md)
47+
[Visual C++ Porting and Upgrading Guide](visual-cpp-porting-and-upgrading-guide.md)<br/>
48+
[Overview of potential upgrade issues (Visual C++)](overview-of-potential-upgrade-issues-visual-cpp.md)<br/>
49+
[Upgrading Projects from Earlier Versions of Visual C++](upgrading-projects-from-earlier-versions-of-visual-cpp.md)<br/>
50+
[Visual C++ change history 2003 - 2015](visual-cpp-change-history-2003-2015.md)<br/>
5151
[C++ conformance improvements in Visual Studio 2017](../cpp-conformance-improvements-2017.md)

docs/porting/upgrading-projects-from-earlier-versions-of-visual-cpp.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ ms.author: "mblome"
1212
ms.workload: ["cplusplus"]
1313
---
1414
# Upgrading Projects from Earlier Versions of Visual C++
15+
1516
In most cases, you can open a project that was created in an earlier version of Visual Studio. However, to accomplish this, Visual Studio upgrades the project. If you save this upgraded project, it cannot be opened in the earlier version.
1617

1718
> [!IMPORTANT]
@@ -33,7 +34,7 @@ For information about how to update the targeted Windows versions, see [Modifyin
3334

3435
## See Also
3536

36-
[Build System Changes](../build/build-system-changes.md)
37-
[What's New for Visual C++ in Visual Studio 2017](../what-s-new-for-visual-cpp-in-visual-studio.md)
38-
[Visual C++ change history 2003 - 2015](../porting/visual-cpp-change-history-2003-2015.md)
37+
[Build System Changes](../build/build-system-changes.md)<br/>
38+
[What's New for Visual C++ in Visual Studio 2017](../what-s-new-for-visual-cpp-in-visual-studio.md)<br/>
39+
[Visual C++ change history 2003 - 2015](../porting/visual-cpp-change-history-2003-2015.md)<br/>
3940
[Nonstandard Behavior](../cpp/nonstandard-behavior.md)

0 commit comments

Comments
 (0)