Why is there a separate GetSystemDirectory function?

Raymond Chen

If the system directory is always %windir%\SYSTEM32, why is there a special function to get it?

Because it wasn’t always that.

For 16-bit programs on Windows NT, the system directory is %windir%\SYSTEM. That’s also the name of the system directory for Windows 95-based systems and all the 16-bit versions of Windows.

But even in the 16-bit world, if it was always %windir%\SYSTEM, why have a function for it?

Because even in the 16-bit world, it wasn’t always %windir%\SYSTEM.

Back in the old days, you could run Windows directly over the network. All the system files were kept on the network server, and only the user’s files were kept on the local machine. What’s more, every single computer on the network used the same system directory on the server. There was only one copy of USER.EXE, for example, which everybody shared.

Under this network-based Windows configuration, the system directory was a directory on a server somewhere (\\server\share\somewhere) and the Windows directory was a directory on the local machine (C:\WINDOWS). Clients did not have write permission into the shared system directory, but they did have permission to write into the Windows directory.

That’s why GetSystemDirectory is a separate function.