Date: Fri, 29 Mar 2024 15:38:31 +0100 (CET) Message-ID: <503628632.1360.1711723111251@localhost> Subject: Exported From Confluence MIME-Version: 1.0 Content-Type: multipart/related; boundary="----=_Part_1359_1057658086.1711723111250" ------=_Part_1359_1057658086.1711723111250 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Content-Location: file:///C:/exported.html
Please note that these instructions may be outdated!
In this use case, we will focus now on how to analyze a Micro= soft Windows application:
From =E2=80=98Help =E2=80=93 Samples=E2=80=99 option, in Visual Studio 1= 3 Community edition, you can download the source code of our sample applica= tion.
Database Query From MFC
Technologies SQL Server, Visual Studi= o 2012
Topics &= nbsp; User Interface, Data Access, Data= base Synchronization, Database, Database Connectivity
Platforms &nbs= p; Desktop, Data
First of all, start =E2=80=98Kiuwan Local Analyzer=E2=80=99 with the {Ki= uwanLocalAnalyzer_install_dir}\kiuwan.cmd script.
Then, create a new application and set the source code directory.
In the =E2=80=98exclude patterns=E2=80=99 option, add the =E2=80=98**/Ge= nerated Files/**=E2=80=99 path. Visual Studio generates temporal files in t= his directory and we need to exclude them from the analysis because we don= =E2=80=99t want to analyze files we haven=E2=80=99t coded.
Click =E2=80=98Continue=E2=80=99, select =E2=80=98C++=E2=80=99, and anal= yze=E2=80=A6
Once the analysis has finished, you can see the results on Kiuwan:
Everything seems just ok, but if you look closely, only four files were = analyzed out of the eight files detected by Kiuwan Local Analyzer.
If we go to the log screen to find out what happened, we can see which f=
iles were left out:
Looking in the log directory for this analysis ({KiuwanLocalAnalyzer_ins= tall_dir}\temp\Database Query From MFC.1444389776635-0\results), we can fin= d the file cpp.unresolved.headers.log.
The content of this file are the header files that Kiuwan couldn=E2=80= =99t find during the analysis. Most probably because they are not in our pr= oject folders:
<SDKDDKVer.h>
<afxwin.h>
<afxext.h>
<afxdisp.h>
<afxdtctl.h>
<afxcmn.h>
<afxcontrolbars.h>
=E2=80=9Cafxwin.h=E2=80=9D
<afxdb.h>
=E2=80=9Cafxdialogex.h=E2=80=9D
In fact, these are Windows and Visual Studio header files our applicatio= n uses, but are located in external directories. As we can see in the previous post, the resolution of these f= iles is necessary to get a complete and reliable analysis.
With the last version of Kiuwan Local Analyzer, you can autoconfigure th= e header files paths and macro definitions using the log file that Visual S= tudio generates on the compilation phase.
To get the default Visual Studio header files paths, run the following c= ommands from a DOS console:
> cd C:\_dev\vs\Database Query From MFC
> call =E2=80=9CC:\Program Files (x86)\Microsoft Visual Studio 12.0\V= C\vcvarsall.bat=E2=80=9D
> echo %INCLUDE% > include.txt
(update the source code and Visual Studio directories with those of = your installation).
To get Visual Studio log file we need to compile the application from th= e command line:
> cd C:\_dev\vs\Database Query From MFC
> call =E2=80=9CC:\Program Files (x86)\Microsoft Visual Studio 12.0\V= C\vcvarsall.bat=E2=80=9D
> msbuild.exe =E2=80=9CDatabase Query From MFC.sln=E2=80=9D /nologo /= target:Rebuild /p:Configuration=3DRelease /p:Platform=3DWin32 > msbuild.= log
Now, we can use the generated =E2=80=98include.txt=E2=80=99 and =E2=80= =98msbuild.log=E2=80=99 files to configure Kiuwan Local analyzer.
Before clicking on =E2=80=98Analyze=E2=80=99, open the configuration sec= tion:
Copy the content of =E2=80=98include.txt=E2=80=99 file in =E2=80=98Heade= r directories=E2=80=99 option. You need to replace the semicolon separator = by a comma separator before the copy.
C:\Program Files (x86)\Microsoft Visual Studio 12.0\VC\INCLUDE,C:\Progra= m Files (x86)\Microsoft Visual Studio 12.0\VC\ATLMFC\INCLUDE,C:\Program Fil= es (x86)\Windows Kits\8.1\include\shared,C:\Program Files (x86)\Windows Kit= s\8.1\include\um,C:\Program Files (x86)\Windows Kits\8.1\include\winrt
You should also set the =E2=80=98Use all know macros?=E2=80=99 to true.<= /p>
Now, in this same screen, click =E2=80=98Analyze build logfile =E2=80=93= Details=E2=80=99 button, to load the msbuild output logfile:
After these steps, run the analysis again and check the new results on K= iuwan:
Now, all the eight C++ files of this sample application were correctly a= nalyzed.