Resolving WinCC Runtime Freeze and SCRIPT.EXE Crash 0xc0000374 in Maintenance Station Diagnostic Screens
In SIMATIC PCS 7 V9.0 SP3, when clicking diagnostic group display buttons (such as PC_STAT_OV or Field_COMP_OV) causes WinCC Runtime to freeze and crash SCRIPT.EXE with exception code 0xc0000374 (ntdll.dll heap corruption), the fault is caused by an unassigned Maintenance Station Host in the multiproject. When S7Project.MaintenanceHost is empty, the Asset Management engine (COSStateMachineApp) fails to initialize its IVAR2 interface, attempting to query uninitialized pointer memory and crashing the C-script thread. To resolve this: 1) In SIMATIC Manager Plant Hierarchy or Component View, assign a valid Maintenance Station Host to the MS project properties; 2) Ensure valid Maintenance RT licenses are installed in ALM; 3) In SIMATIC Manager, re-execute 'Creating/updating the diagnostic screens'; and 4) Recompile and download the OS.
Table of Contents
- Executive Summary
- Architecture and Fundamental Mechanics
- Step-by-Step Implementation Procedure
- Verification
- Limitations and Operational Precautions
- Engineer FAQ
- Technical References
- Related Articles
- Related Tags
Executive Summary
Plant asset management in SIMATIC PCS 7 relies on the Maintenance Station (MS) to monitor controller hardware, remote I/O modules, intelligent field instruments, and industrial PC stations. On an OS Single Station running PCS 7 V9.0 SP3 UC03 on Windows Server 2016 Datacenter, engineers observed that navigating to diagnostic overview screens by clicking group display buttons (PC_STAT_OV, Field_COMP_OV) caused WinCC Runtime to freeze completely. Attempting to deactivate runtime deadlocked on Script Server. Windows Event Viewer recorded SCRIPT.EXE crashing in ntdll.dll with exception code 0xc0000374 (Heap Corruption). This guide analyzes the OSSTATEMACHINEX_1.log diagnostic traces, identifies the unassigned Maintenance Host vulnerability, and details the restoration procedure.
Architecture and Fundamental Mechanics
Maintenance Station State Machine Architecture and Heap Crash Analysis
+-------------------------------------------------------------------------+
| WinCC Operator Station Runtime |
| |
| [Operator clicks 'PC_STAT_OV' (PC Station Diagnostic Overview)] |
+-----------------------------------|-------------------------------------+
|
v C-Action Call: GTI APEndAct
+-------------------------------------------------------------------------+
| Maintenance State Machine: COSStateMachineApp |
| |
| Diagnostic Log (OSSTATEMACHINEX_1.log): |
| - [SAM ASOS] Critical error: 'S7Project.MaintenanceHost' is empty! |
| - [SAM OSStateM] COSStateMachineApp::WriteLicenceTag() failed: @LCvalid|
| - [SAM] ReadWinCCTag() failed: <DIAG_OWS1.MaintenanceState> |
| - COSStateMachineApp::InitIVAR2Interface() returns Null Pointer |
+-----------------------------------|-------------------------------------+
|
v Memory Buffer Overrun
+-------------------------------------------------------------------------+
| Windows ntdll.dll Heap Corrupter |
| |
| SCRIPT.EXE attempts to read string buffer from NULL pointer: |
| - Exception Code: 0xc0000374 (STATUS_HEAP_CORRUPTION) |
| - SCRIPT.EXE process terminates abruptly |
| - WinCC Runtime graphics freeze / Deactivation hangs indefinitely! |
+-------------------------------------------------------------------------+
The Anatomy of the 0xc0000374 Crash
S7Project.MaintenanceHost is empty!: When diagnostic screens are generated, the compilation wizard embeds internal tag queries to evaluate the overall health of PC stations and network components. If the Engineering Station multiproject does not have a designated Maintenance Station Host configured in the Plant Hierarchy, the target tag@MaintenanceHostis created with an empty or uninitialized string.- License Tag Failure (
@LCvalid): The maintenance state machine checks for the runtime licenseSIMATIC PCS 7 Maintenance Station RT. If the license is missing or if the query fails, the script continues down an unhandled failure path. - Heap Corruption: In PCS 7 V9.0 SP3 base scripts,
COSStateMachineApplacked null-pointer validation when reading IVAR2 callback interfaces for unconfigured IPC stations. Passing an uninitialized tag handle intontdll.dllcorrupts the WinCC script heap, causing the immediate crash.
Step-by-Step Implementation Procedure
Step 1: Designate Maintenance Station Host in SIMATIC Manager
- On the Engineering Station, open SIMATIC Manager.
- In Component View, locate the PC Station intended to act as the Maintenance Station (e.g., your OS Single Station).
- Right-click the PC Station and open Object Properties.
- Ensure the station is assigned the role Maintenance Station (or verify that under Plant Hierarchy Properties, the Maintenance Station tab assigns this PC as the central Maintenance Host).
- Open the Plant Hierarchy folder, right-click the top-level plant node, and select Plant Hierarchy > Settings....
- Under the Maintenance Station section, ensure Maintenance Host is explicitly selected from the dropdown (do not leave blank).
Step 2: Verify Maintenance Station Licenses in ALM
- Open Automation License Manager (ALM) on the Engineering Station and target OS stations.
- Verify the following licenses are installed and valid (OK):
- On ES:SIMATIC PCS 7 Maintenance Station Engineering
- On OS Single Stations / Servers:SIMATIC PCS 7 Maintenance Station Runtime - Note: If maintenance licenses are missing, order the appropriate package through an authorized Siemens distributor or the Siemens Industry Mall.
Step 3: Regenerate Diagnostic Screens via Wizard
- In SIMATIC Manager, select the top-level plant folder in the Plant Hierarchy.
- In the menu bar, select Options > Plant Hierarchy > Create/Update Diagnostic Screens....
- In the diagnostic screen wizard:
- Select the target OS where diagnostic screens will reside.
- Ensure all AS controllers and PC stations are included in the asset scope. - Click OK to run the complete diagnostic generation.
- The wizard will regenerate
@PC_STAT_OV.pdl,@Field_COMP_OV.pdl, and correctly initialize all@MaintenanceHoststructure tags.
Step 4: Recompile and Delta Download the OS
- Right-click the OS project in SIMATIC Manager and select Compile.
- Choose Scope: Entire OS (to ensure all diagnostic tags and pictures refresh) or Changes only if previously compiled.
- Download the OS project to the target PC station.
- Restart WinCC Runtime.
Verification
- Log Inspection: On the OS station, open
C:\Program Files (x86)\Siemens\WinCC\Diagnostics\OSSTATEMACHINEX_1.log. Confirm that the lineS7Project.MaintenanceHost is empty!no longer appears and that initialization reportsStatus: Connected. - Diagnostic Screen Navigation: In WinCC Runtime, click on
PC_STAT_OVandField_COMP_OV. Confirm that the diagnostic overview pictures open instantly without freezing or lagging. - Process Monitor Audit: In Windows Task Manager, monitor
SCRIPT.EXE. Verify that memory utilization remains stable and CPU usage settles back to<1%after opening asset faceplates.
Limitations and Operational Precautions
- Update Collection Prerequisite: Siemens addressed internal string buffer overflows in
SCRIPT.EXEacross subsequent update collections; always ensure PCS 7 V9.0 SP3 has the latest Update Collection (e.g., UC04 or higher) applied. - Virtual Machine Graphics Rendering: On virtualized Windows Server 2016 Datacenter instances, verify that VMware Tools graphics acceleration is enabled to prevent GDI rendering timeouts.
Engineer FAQ
What does exception code 0xc0000374 mean?
It is the Windows NT status code for STATUS_HEAP_CORRUPTION, indicating that a process corrupted memory heap structures before crashing.
Why does clicking PC_STAT_OV freeze WinCC Runtime?
SCRIPT.EXE crashes in ntdll.dll due to heap corruption caused by an unassigned Maintenance Station Host, deadlocking the C-script engine.
What does 'S7Project.MaintenanceHost is empty' mean?
The Plant Hierarchy properties do not have a designated Maintenance Station Host assigned to manage diagnostic asset screens.
Where do I assign the Maintenance Station Host?
In SIMATIC Manager under Plant Hierarchy > Settings > Maintenance Station tab, or in PC Station Properties.
What licenses are required for Maintenance Station?
Maintenance Station Engineering license on the ES and Maintenance Station Runtime license on each OS server or single station.
What does 'Creating/updating the diagnostic screens' do?
It parses the hardware configuration and plant hierarchy to automatically generate all WinCC maintenance screens and diagnostic tags.
Why did deactivating runtime hang on Script Server?
Because SCRIPT.EXE had crashed in a deadlock, preventing the WinCC shutdown manager from safely unloading the script engine.
Does this issue occur in PCS 7 V8.2?
PCS 7 V8.2 on Windows 7 used different C-runtime libraries that did not crash with heap corruption under identical unassigned conditions.
Where is OSSTATEMACHINEX_1.log located?
In the WinCC project directory or inside C:\Program Files (x86)\Siemens\WinCC\Diagnostics\.
How do I update diagnostic screens after adding new hardware?
Re-run Options > Plant Hierarchy > Create/Update Diagnostic Screens in SIMATIC Manager.
Technical References
- SIMATIC PCS 7 Maintenance Station V9.0 / V9.1 Function Manual
- Siemens Industry Online Support (SIOS) Entry ID 109780813: Resolving Maintenance Station Script Crashes
- Microsoft Developer Network: Diagnosing Windows Heap Corruption (0xc0000374) in Native Applications
- SIMATIC WinCC V7.5 WinCC Scripting - C-Script Engine Architecture
Related Articles
- Creating and Relocating APL Block Icons Across Different Plant Hierarchy Pictures in PCS 7
- Resolving Windows 10 Enterprise LTSC 2019 Compatibility and Installation Errors with PCS 7 V9.1
- Hardware Configuration and Module Driver Requirements for ET 200SP Server Modules 6ES7193-6PA00-0AA0
Related Tags
- Maintenance Station
- SCRIPT.EXE
- 0xc0000374
- Heap Corruption
- PC_STAT_OV
- Diagnostic Screens
- PCS 7 V9.0 SP3