Secret of the Haunted Books
From the Super Mario Wiki
Secret of the Haunted Books is the third mission of Big Boo's Haunt in Super Mario 64 and Super Mario 64 DS. The mission's objective is to reach the end of the library on the second floor of the mansion.
The player has to make their way up to the second floor of mansion, enter the second door from the left, and make their way to the end of the library. When walking through the library, several books will fly off the shelves and will hurt the player character if they come into contact. At the end of the library is a bookcase blocking the path with three books popping out. The player has to hit these books in the correct order (center, right, left) in order for the bookcase to move. Inputting the wrong order will have a book attack the player and the code will reset. Behind the bookcase is a door leading to the Power Star.
In the original N64 version, the player could reach the Power Star through the room on the far left of the second floor if they time Mario's jumps correctly. In the DS version, the platform with the Power Star is closed off with a glass panel, likely to prevent making it easy to reach it with Luigi's higher jumps.
Names in other languages