JavaScript is not currently enabled, but is required for full CodeSonar manual search and browse functionality.

If you are viewing this file in your hub's Web GUI, enable JavaScript in your browser: you will also need it for GUI functionality.

If you opened this file directly from disk, your browser may be directly suppressing JavaScript functionality: certain browsers perform this suppression on local files (but not files delivered by web servers) for security reasons.

CodeSonar® 9.2p0 CONFIDENTIAL CodeSecure Inc


Build the Sample Program (Windows)

The first step in analyzing a program is always to build it as a CodeSonar project. The CodeSonar build wizard makes building in Windows a straightforward process.

The CodeSonar project build system is designed so that you can base a CodeSonar project on your normal software build process. In general you will:

Starting Up

  1. See the note on 16-bit processes.
  2. Save a copy of BasicProj.c to the working directory (right-click on the link and select Save Target As... or equivalent).
    Make sure your browser does not append any file extension (such as .txt) to the downloaded file. If it does, rename the file back to BasicProj.c.
  3. Start the Windows build wizard: either
  4. Start up your normal build environment:
    Microsoft Visual Studio: We have provided a Visual Studio solution BasicProj.sln and project BasicProj.vcxproj.
    1. Save copies of these to the same directory as your copy of BasicProj.c.
    2. Open BasicProj.sln ready for building.

    Your Visual Studio installation will display messages if it does not have the SDK (or "target platform") version or platform toolset specified in the example project.
    If you don't encounter such messages, go on to setting up the CodeSonar build/analysis in the Windows build wizard. Otherwise, use the Visual Studio GUI to modify the BasicProj settings before proceeding.

    1. Right click on the BasicProj project in the Solution Explorer, and select Properties from the menu that pops up.
    2. Navigate to Configuration Properties > General.
    3. Make sure the following are set to suitable values. The Visual Studio GUI will provide a menu of available settings.
      • Target Platform Version / Windows SDK Version (name will depend on your Visual Studio installation)
      • Platform Toolset
    Otherwise: Start up your usual build environment and do any preparation necessary for building BasicProj.c into a software project.
    You might like to do a practice build to make sure everything is working properly (if you do this, make sure you "clean up" afterward, so that next time you build everything is rebuilt fully).

Wizard, Screen 1

The first screen of the wizard looks like this:

Screenshot: Windows build wizard, screen 1

CodeSonar will generate a default project name and output directory using a simple numbering scheme. You can specify your own values for these - we will call this project cs-BasicProj

  1. Specify where CodeSonar should store local files related to the analysis:
  2. Specify the project with which the analysis should be associated on the hub.
  3. Make sure the Hub text field contains the correct location host:port for your hub (as determined in the previous step).
  4. Make sure the Auth menu selection is "Anonymous; Password ".
  5. Use the Analysis field to specify how the analysis should be managed. This setting depends on whether or not you are using CodeSonar SaaS.
    CodeSonar SaaS: SaaS
    otherwise: Local
  6. Make sure that Install Services is selected, unless this will cause a problem. If you do not wish to use Windows Services, unselect Install Services. CodeSonar will still run, but you will need to restart the hub manually if the hub machine is restarted.

    As a shortcut, the Recent Configurations pull-down menu contains recently-used configurations. If this is your first project, there will not be any previous configurations in the menu. Once you have (successfully) built some projects, you will likely find there are certain build configurations that you use regularly and this shortcut will save you some time in setting up new projects.

  7. Click Next.

Wizard, Screen 2

The second screen of the wizard looks like this:

Screenshot: Windows build wizard, screen 2

The Watch field indicates the programs that CodeSonar will watch in order to create the project.

  1. To select one or more programs to watch, click the Change button.

    CodeSonar will open a new window showing the programs that are candidates for watching.

    Screenshot: Windows build wizard, Select Processes dialog

  2. Click to select the program or programs that you are using to build your project ().

    In the example above the program is being built in Microsoft Visual Studio, so the MSDEV.EXE program has been selected from the list.

  3. When you have completed your selection, click the OK button.

    Once you have finished the setup steps on this screen, the wizard is ready to build the CodeSonar project by "recording" your usual build.

  4. Click Record.

One or more of the following dialogs may open. If you are not sure how to resolve them, follow the links in the table for additional information.

screenshot: UAC dialog Delete Files?
screenshot: UAC dialog User Account Control
Screenshot: Services Authentication Dialog Service Authentication
(Requests Windows credentials for the analysis machine.)
screenshot fragment: hub authorization dialog Hub Password Authentication
(Requests hub user account credentials.)
If you do not have any hub account credentials, consult the hub administrator for the hub you are using. They may need to create a user account for you, or to provide you with information about an existing account that has been created for you.
screenshot fragment: hub authorization dialog HTTPS Certificate
screenshot fragment: hub authorization dialog
screenshot fragment: hub authorization dialog
Errors

Screen 3

Once you have worked through the dialogs (if any), the third screen will open. It looks like this:

Screenshot: Windows build wizard, screen 3

  1. Go to your build environment and invoke the build of BasicProj.c.

    The wizard will display compiler messages as the build progresses. When the build is complete, the Finalize button will become active.

  2. Click the Finalize button.

When you click Finalize, CodeSonar will build the project and then run the CodeSonar analysis. The degree of parallelism in the analysis will depend on the setting of ANALYSIS_SLAVES.

Screen 4

The fourth and final screen of the wizard informs you that the project is ready and provides some additional information.

Screenshot: Windows build wizard, screen 4

The Project Location field specifies the location of the analysis results.

Now you can start browsing the analysis results:

  1. Click the Browse Project button to open the Analysis page in your web browser.

    The CodeSonar GUI may display a message requesting that you sign in.
    This indicates that the hub has been configured to prohibit anonymous browsing. If so, the hub Administrator should have informed you of your hub user account credentials.

  2. Go on to Analysis Page and Warning Reports
 

To report problems with this documentation, please visit https://support.codesecure.com/.