As seen in Hacking Minesweeper to be IMPOSSIBLE
Minesweeper is a classic Windows game largely thanks to its inclusion in Windows since 3.1. While it's no longer included in Windows since 8, its iconic look that barely changed from 1990 to 2006 is still extremely nostalgic and memorable.
While Minesweeper limits the total amount of mines a user can enter in a custom game, this hack overrides that value entirely and forces the mine count to be equal to the number of tiles in the playfield. This effectively ensures all the tiles will always be mines. Minesweeper also includes a check to ensure that your first click won't be a mine by moving it to a new coordinate if a mine happens to be clicked. This hack overrides that behavior too.
While this hack was made solely by editing x86 assembly, Minesweeper has also been reverse engineered back to C++ code by a GitHub user named repnz. This provides greater insight into the how Minesweeper is written and you can even see the original mine placement loop in a more human-readable language. The Windows NT 4.0 leaks of 2004 also contain Microsoft's original Minesweeper code, however legally that can't be linked here.