Log from first program - pastebin
It is rarely 100 milliseconds but often within 25-50 milliseconds, which is 1 or 2 frames (using VSync 60 fps, ~ 16 ms per frame) which already leads to unwanted result (game logics changes direction, animation frame (angle) etc).
So only solution I see so far is using raw input (which is subjectively a little bit faster) instead of wm_keydown / up and process input in game with periodic delay (once per 2-5 frames instead of every frame) to avoid unwanted results.
According to stackoverflow delays of the order of 50 ms or so are common in processing key presses through the normal Windows message queue.
Thanks for effort anyway. I am still looking for any better solutions.