External Error Handler

External Error Handlers play a central role in security analysis. WinCC OA installation contains a template for the ExtErrHdl. You can find the template in wincc_oa_path/api/TemplateExtErrHdl

The files in the wincc_oa_path/api/TemplateExtErrHdl directory build a base framework for a new WinCC OA External Error Handler. This chapter describes how to create an external error handler.

External Error Handler - Windows

Requirements

  • Installed WinCC OA API
  • Microsoft VC++ (VisualStudio; For the required version see Software requirements).
    Note: WinCC OA does not require debug libraries or Microsoft Foundation Classes (MFC).

Create an External Error Handler

  • Create a directory for the project, e.g. D:\Development\Projects\API_Example\
  • Open a Visual Studio command prompt: Visual Studio 2019 > Visual Studio Tools. This opens a directory where you have to select "VS2019 x64 Native Tools Command Prompt".
    Note: You must open the command prompt as an administrator.
  • Navigate to the directory you created, e.g. D:\Development\Projects\API_Example\
  • Set the environment variable API_ROOT to the API directory.
  • Enter the command checkApiEnv into the command shell. This sets up the environment and the following output is displayed:
    -------
    found API_ROOT - good
    found VCXX compiler - good
    setting env for 64bit development
    done
    -------       
  • Now create a developer project for the external error handler. Use the project name as a parameter:

    %API_ROOT%\ newWCCILErrHdl.cmd APITest

  • A directory ExtErrHdlAPITest which contains the source files and a Visual Studio project is created.
  • Navigate to ExtErrHdlAPITest\build and enter devenv ExtErrHdlAPITest.slnAPITestDrv.sln to start the Visual Studio project.
  • Press F5 to compile.
    Note: You must always start the project from the command line to get the correct setup.

Following scripts can be used analogously:

%API_ROOT%\newWCCILManager.cmd --- create a WinCC OA Manager developer project.
%API_ROOT%\newWCCILDriver.cmd --- create a WinCC OA Driver developer project.
%API_ROOT%\newWCCILCtrlExt.cmd --- create a CTRL extension DLL (plugin) developer project.
%API_ROOT%\newEWO.cmd --- create an EWO (External Widget Object) developer project as plugin for WinCC OA panels          
Note: Refer to the wincc_oa_path\api\README.NT for information on converting existing API projects from previous VC++ Version to the supported version.

By using the VersInfo.rc file additional information can be added to the compiled object, e.g. file descriptions.

External Error Handler - Linux

  • Check whether the required GCC Version is installed by entering:

    gcc -v. See Software requirements.

  • Set the necessary environment variables (see Installation Linux).
  • A set of analog scripts is available under Linux like under Windows. You can call the scripts by using $API_ROOT/newWCCILErrHdl.sh man