DB IDO: Add endpoint id to history tables, part 1.
Fix Windows libs (WIP).