# Using Microsoft Platform SDK Headers

The Microsoft® Platform Software Development Kit (SDK) - September 1997 PDC Edition provides developers with a single, easy-to-use location from which to download current and emerging Microsoft technologies and includes tools, headers, libs, and sample code for these techhnologies. The Platform SDK is the successor to the Win32 SDK, and includes components that have been distributed separately in the Win32 SDK, the BackOffice SDK, and the ActiveX/Internet Client SDK, and the DirectX SDK, and continues to integrate additional SDKs on a regular basis.

This PDC Edition targets development for the Microsoft® Windows NT® version 4.0 and 5.0 and Windows® 95 and Windows® 98 operating systems, the BackOffice&trade; family of products version 2.5, and Microsoft® Internet Explorer version 3.x and 4.0. The Platform SDK maintains support for current versions of the operating systems as new versions are added.

To get started, you need to download iBldEnv.EXE or aBldEnv.EXE. This provides you with the necessary environment for building Microsoft Windows NT version 4.0 and 5.0 and Windows 95 and Windows 98 applications. We've chunked the rest of the Platform SDK, including samples and additional developer tools, so that you can download only those parts that you want.

(from Microsoft Web-site Platform.htm)

1) Download Platform SDK:

WWW address:

    	http://www.microsoft.com/msdownload/platformsdk.htm

SDK directory root:

    	http://www.microsoft.com/msdn/sdk

and goto

`Platform SDK`

The file is call IBLDENV.EXE for the Intel platform (6,5 MB).

2) Run IBLDENV.EXE:

If you run IBLDENV.EXE and you choose OK on the first question, the tool will install all components. You will need about 42 Mb free disk space.

Minimal installation:

To extract only the header files and some other components you should run IBLDENV.EXE first. On the first question find the extracted files (XXXX.TMP) and save them in another directory. Cancel the setup program and run the command “SdkSetup <INF install script>” from the command prompt. You need at least Win32-B and BLDTOOL.

Example:

sdksetup Win32-B

sdksetup BldTool

3) Patching MSSDK Headers:

Run the batch DOPATCH.BAT from the directory \RSXNT\INCLUDE\MSSDK:

    cd c:\rsxnt\include\mssdk
    c:\rsxnt\include\mssdk> DOPATCH

4) Change the include environments:

Now set your C_INCLUDE_PATH and CPLUS_INCLUDE_PATH environment:

First include the patched files from \RSXNT\INCLUDE\MSSDK and then the original files for \MSSDK\INCLUDE.

Example:
  SET C_INCLUDE_PATH=C:\RSXNT\INCLUDE; C:\EMX\INCLUDE;

  C:\RSXNT\INCLUDE\MSSDK; C:\MSSDK\INCLUDE

## Patching other SDK include files:

There are some errors in the SDK include files for GNUC.

Case 1:

The GNU C++ compiler does not like the WINAPI (e.g. __stdcall) inside the function name.

Bad code:

    	typedef void (WINAPI *FUNCTIONDEF)(void)

Good code:

    	typedef void WINAPI (*FUNCTIONDEF)(void)

Case 2:

The GNU C++ compiler does not like the WINAPI (e.g. __stdcall) keyword if a function returns a pointer. The function attribute __stdcall should be placed before the pointer symbol.

Bad code:

    	char * WINAPI Function(void);

Good code:

    	char WINAPI * Function(void);

Summary:

Always write the keyword ‘WINAPI’ after the first type keyword.

<struct or type> WINAPI < * > SYMBOL

Examples:

    #include <wingnuc.h>

    typedef void WINAPI (*Function1) (int);
    typedef char WINAPI * (*Function2) (int);

    void WINAPI * Function3 ();