when you need to use a function you include a header file but wheres the function code is defined?
The source code is not published.
Linux publishes its source code, because it is open source.
Windows is owned by Microsoft; the code is privately owned and MS chose not to publish the code.
If the code was published, third parties could in principle compile Windows for themselves, which would be they would no longer need to buy copies from Microsoft.
In the source code of some library, hence it is exposed as symbol in some library to wether statically/dynamically link against.
If it is closed source (like win32 API) you won't see its source code as long as you aren't working for the MS Windows team I suspect.
Dave, the code lives in the various and many DLL files in your Windows\system32 directory.
Well as explained above you are in the hands of microsoft. You can always look at the msdn http://msdn.microsoft.com. For most API functions you can find some information at the bottom. For most function you get from there:
Minimum supported client
Minimum supported server
Header
Library
DLL
Unicode and ANSI names
The actual code that implements the Win-32 API are defined in various DLLs on your system. These DLLs have names like kernel32.dll, comctl32.dll etc. You will find them in C:\Windows\System32.
What generally happens is that you link your code with kernel32.lib etc. that have a little code to dynamically load the DLLs when your program starts. This allows Win32 API functions to directly call into the DLLS.