What tools should I assume everybody has?

Date:January 21, 2004 / year-entry #26
Orig Link:https://blogs.msdn.microsoft.com/oldnewthing/20040121-00/?p=40983
Comments:    24
Summary:My code samples assume you are using the latest header files from the Platform SDK (free download), the one that includes support for Win64. If you have an older SDK then you won't have various new data types like UINT_PTR and INT_PTR and should just use UINT and INT. I write code that is Win64-compliant...

My code samples assume you are using the latest header files from the Platform SDK (free download), the one that includes support for Win64. If you have an older SDK then you won't have various new data types like UINT_PTR and INT_PTR and should just use UINT and INT.

I write code that is Win64-compliant as a matter of course since all code in Windows must be Win64-compliant. Writing noncompliant code is as foreign to me as it would be for a chess player to consider the ramifications of an illegal move. It doesn't even enter my mind.

The question for readers: Should I assume that everybody has the latest header files? Or should I write old-style code (that won't run on Win64)?

Comments (24)
  1. bryon says:

    assume win64. better people get used to compliant code sooner rather than later.

  2. I aggree. Show us the compliant way. That way we can learn. I know of no excuse for a serious developer not to use the latest Platform SDK.

  3. Henk Devos says:

    Yes please use compliant code.

    I have also just made my own code compliant.

    What i do is include definitions for the new types in my headers. They can be turned on by a #define.

    I do know of very good reasons for not using the latest platform sdk.

    Every time when you install a new platform sdk you have a risk of code not compiling or running anymore.

    For me this has been the case many times. sometimes it takes me several days to get everything fixed.

    So you can only do this when you have enough time to fix everything up, and for example not when you are about to release a new version of your product.

  4. Jim Causey says:

    Show us the right way; now that you can download the Platform SDK for free, there is no excuse for not having it.

  5. Jack Mathews says:

    You should toss the Platform SDK link in your Links section and maybe put some gentle reminders every so often to get it if people don’t have it.

  6. Juan Miguel Venturello says:

    I’d rather see your samples in Win64, since it will get me (and the other people) more exposed to this ‘new way’ of coding. The code I do is not Win 64 compliant since it is a huge app I am mantaining but I rather very much sample code on the net, like you, sets what I think should be a fine example.

    Thanks for the very good blog,


  7. Ian Hanschen says:

    Win64 compliant code is good. A lot of people haven’t gotten into the habit of writing compliant code yet – more public examples of it can only be a good thing.

  8. Raymond Chen says:

    Jack: done, link added. We’ll see if it helps any.

  9. Something is still strange here. As mentioned in a previous thread, I use VS6SP5 for programming that will actually be delivered to customers. In that previous thread we did not discuss the Platform SDK, but since you mention it now, yes I also have the February 2003 Platform SDK installed. Nonetheless the relevant header file (which I named in the other thread) declares the function type TimerProc() and the function SetTimer() to take parameters of type UINT not UINT_PTR.

    I am all in favor of your examples using current headers and valid code. But I still can’t figure out how you get different current headers than customers get.

    I also still wonder, when you put shims in Windows to make broken programs work, will that include shims to make these two kinds of broken programs work:

    (1) Programs that conformed to broken VS6SP5 implementations

    (2) Programs that had buggly casts inserted in order to get them to compile while the programs’ own code conformed to MSDN’s datatypes and function prototypes.

  10. Raymond Chen says:

    I just downloaded the Platform SDK and took a peek at winuser.h: Its declarations are






    IN HWND hWnd,

    IN UINT_PTR nIDEvent,

    IN UINT uElapse,

    IN TIMERPROC lpTimerFunc);

    These match the current MSDN documentation.

    So I guess I’m not looking at the same header file you’re looking at. (I tried to figure out which header file you were referring to but I couldn’t find anything in your previous comments that actually named a header file.)

    I emphasize again that the type changes from Win32 to Win64 >>have no binary effect on Win32<<. On Win32, UINT_PTR devolves to UINT, so code that uses UINT is identical to code that uses UINT_PTR when compiled for Win32. It is only when compiling for Win64 that things go wrong.

    So I don’t understand points (1) and (2), since the changes here have no code effect.

  11. "On Win32, UINT_PTR devolves to UINT"

    Ordinarily it does not. If it did then I wouldn’t get compilation errors when using UINT_PTR.

    Now I’ve done a bit of poking around. It seems that the February 2003 Platform SDK doesn’t register its directories with Visual Studio 6. It doesn’t say which version of Visual Studio it registers its directories with, but I have the impression that it only registered its directories with Visual Studio .NET 2003 (in my case). This surely explains why VC++6 is using header files that came from VS6SP5 instead of header files from the February 2003 Platform SDK.

    I suppose that in VC++6, every time I create a new project, I can go to its project settings, preprocessor category, and tell it to take include files from the Platform SDK’s directory. Now that I know that this didn’t get automated, I can do it manually.

    In fact I just did that to an existing project, and it worked. It used a declaration of TimerProc with a UINT_PTR parameter, UINT_PTR devolved to UINT as you said, and no error resulted from this part of it. However, there’s a new error message:

    error C2668: ‘InlineIsEqualGUID’ :



    I didn’t code the call to InlineIsEqualGUID, that was put in by the MFC and/or ATL App Wizard. I wonder if I can figure out how to fix this.

  12. Mr. Chen, any chance that you can use Unicode?

    VC++&’s error message in the above posting roughly translates to:

    error C2668: ‘InlineIsEqualGUID’:

    Overloaded function call cannot be

    resolved. (New functionality;

    reference help.)

  13. Raymond Chen says:

    I don’t run this server, sorry.

  14. asdf says:

    Norman: in VC6 go to Tools | Options… | Directories. Add the platform sdk "include" directory *above* the vc98 stuff. Do the same for "bin" and "bin/winnt" to the executables and "lib" to the libraries.

  15. Mike Dimmick says:

    Google for inlineisequalguid c2668 reveals the following page:

    http://support.microsoft.com/default.aspx?scid=kb;EN-US;q243298 – BUG: Error Message: C2668: InlineIsEqualGUID: Ambiguous Call to Overloaded Function

    Basically, ATL declares an InlineIsEqualGUID function, but now so does GUIDDEF.H in the Platform SDK headers. The use of ‘using namespace ATL;’ in atlbase.h (a very bad practice) causes the compiler to complain about ambiguity.

  16. Catatonic says:

    Updating the Platform SDK broke one thing for me. The debug version of MS Layer For Unicode (Unicode support library for Win9x) will not link with VC++ 6 anymore. For now, I just build the debug version with native Unicode. But I can’t debug it on Win9x anymore.

    I’ve heard this was on a to-do list and may be fixed by now.

  17. asdf recommended: ‘in VC6 go to Tools | Options… | Directories. Add the platform sdk "include" directory *above* the vc98 stuff.’

    Done, AND also these two:

    C:Program FilesMicrosoft SDKincludemfc

    C:Program FilesMicrosoft SDKincludegl

    Also did the bin and lib stuff as you recommended.

    Now I worry what will happen when we deliver source code to customers, if customers have VS6SP5 but don’t have the Platform SDK.

    Why is the Platform SDK separate from VS service packs? Why don’t VS service packs include the header, executable, and library files that the Platform SDK has? After all, how many platforms are there that are targeted by VS?

    (Yeah I know, embedded Windows platforms used to be targeted by add-ons to the ordinary Visual Studio instead of the separate eMbedded tools stuff, so my question was maybe 90% valid historically, but surely my question is 100% valid now.)

  18. asdf says:

    No, don’t add the gl stuff to the includes.

    You’re supposed to do:

    #include <gl/gl.h>


    #include <gl.h>

    Not sure about the mfc ones though.

  19. To asdf: Thank you again for your advice, and I deleted the gl directory from the includes.

    To Mr. Chen: I know this isn’t your responsibility, but I also know you sometimes have contacts with them. How come MSDN still doesn’t have any plans to include the October 2003 Platform SDK in CD shipments to subscribers?

  20. Raymond Chen says:

    Actually I don’t know anybody involved in MSDN subscriptions, sorry.

  21. Mike Hearn says:

    Is there any way to get the platform SDK without using their funky ActiveX control (like a direct download or something)? AX Controls give me problems here….

  22. There should be a link to the cab-files on the page (http://www.microsoft.com/msdownload/platformsdk/sdkupdate/psdk-full.htm). However I had some trouble to download them using IE6 and the page isn’t Netscape friendly (the links won’t show in Netscape). So I ended up by copy the links from IE into Netscape and the download worked.

  23. The link provided by Andreas Magnussen still provides cab files for the February 2003 Platform SDK instead of the October 2003 version.

    The file sizes are still almost unthinkable for anyone who uses a wireless modem for their personal internet usage (32kbps where I live, though faster speeds are available in densely populated areas).

  24. Rodrigo Strauss says:

    Last PSDK, always

Comments are closed.

*DISCLAIMER: I DO NOT OWN THIS CONTENT. If you are the owner and would like it removed, please contact me. The content herein is an archived reproduction of entries from Raymond Chen's "Old New Thing" Blog (most recent link is here). It may have slight formatting modifications for consistency and to improve readability.

WHY DID I DUPLICATE THIS CONTENT HERE? Let me first say this site has never had anything to sell and has never shown ads of any kind. I have nothing monetarily to gain by duplicating content here. Because I had made my own local copy of this content throughout the years, for ease of using tools like grep, I decided to put it online after I discovered some of the original content previously and publicly available, had disappeared approximately early to mid 2019. At the same time, I present the content in an easily accessible theme-agnostic way.

The information provided by Raymond's blog is, for all practical purposes, more authoritative on Windows Development than Microsoft's own MSDN documentation and should be considered supplemental reading to that documentation. The wealth of missing details provided by this blog that Microsoft could not or did not document about Windows over the years is vital enough, many would agree an online "backup" of these details is a necessary endeavor. Specifics include:

<-- Back to Old New Thing Archive Index