Let's supose i have an executable file a.exe and it uses stdlib for some operations. Let's suppose an attacker changes the system stdlib to a "malicious" stdlib. The implications of this might be very bad, specially if the a.exe has SUID permissions. What are the main mechanisms already in place to avoid fake code loading?
Code signing and ACL'ing the system locations are two mechanisms. windows won't load DLL's or EXE's that aren't signed by the Windows code signing key for system calls. Windows also periodically verifies the state of the files by making sure only code-signed file are present. Further, the default ACL's prevent writing to the system directories that store these DLL's and EXE's unless you're an administrator.
Windows has no real notion of protecting against administrators.