#ifdef __cplusplus

// Optional: Write directly into binary at checksumOffset // *(uint16_t*)(info->data + info->checksumOffset) = crc;

uint16_t custom_crc16(const uint8_t* data, uint32_t len, uint16_t init) (crc << 8);

switch(info->algorithmID) case 1: return crc16_ibm(info); case 2: return checksum_me7_sum8(info); case 3: return custom_renault_checksum(info);

#endif #include "winols_checksum.h" #include <stdint.h> #define PLUGIN_TYPE_CHECKSUM 0x00010001 #define DLL_VERSION 0x0100

Abstract WinOLS is the industry standard for Engine Control Unit (ECU) tuning and calibration. A critical function within this ecosystem is the correction of checksums after binary modifications. While WinOLS includes native checksum routines for many ECUs, developers often need custom algorithms for rare, undocumented, or proprietary ECUs. This paper details the architecture, development, and implementation of a custom Checksum DLL for WinOLS using C/C++. 1. Introduction Modifying a binary file (e.g., MAP, PID, limiter values) without updating its checksum results in a non-booting ECU due to a "Checksum Error" triggered during power-on self-test. WinOLS allows externalization of checksum logic via a standardized DLL interface. Understanding this interface enables tuners to support any ECU architecture. 2. WinOLS DLL Interface Specification WinOLS interacts with custom DLLs via a strict calling convention. The DLL must export three specific functions. 2.1 Required Exported Functions | Function Name | Calling Convention | Purpose | |---------------|--------------------|---------| | GetDllVersion | __stdcall | Returns API version compatibility. | | GetPluginType | __stdcall | Returns a constant identifying the plugin as a checksum module. | | CalculateChecksum | __stdcall | Core function: receives binary data, calculates checksum, returns result. | 2.2 Data Structures The CalculateChecksum function receives a tChecksumInfo structure:

// Write result (16-bit to 32-bit with endianness) info->result = crc;

int __stdcall GetDllVersion(void) return DLL_VERSION;

int __stdcall CalculateChecksum(tChecksumInfo* info) !info->data) return -1;

DLL_EXPORT int __stdcall GetDllVersion(void); DLL_EXPORT int __stdcall GetPluginType(void); DLL_EXPORT int __stdcall CalculateChecksum(tChecksumInfo* info);

int __stdcall GetPluginType(void) return PLUGIN_TYPE_CHECKSUM;

EXPORTS GetDllVersion GetPluginType CalculateChecksum