Handmade Hero»Forums»Code
Ishan
2 posts
Currently a full-stack developer, aspiring to be a game developer.
MSDN in November 2019
Edited by Ishan on Reason: Initial post
Hello,

I am new here. I am starting the handmade hero video tutorial from zero.
The video 001 was made in November 2014 and it's November 2019 as of now. 5 years have passed since then, and apparently microsoft has closed msdn since then.
When I search for winmain on google, I come up to https://docs.microsoft.com/en-us/...32/api/winbase/nf-winbase-winmain

The page describes WinMain function only, but the declaration is a bit different.
The page says this: (Also compiling this gives some error)
1
2
3
4
5
6
int __clrcall WinMain(
  HINSTANCE hInstance,
  HINSTANCE hPrevInstance,
  LPSTR     lpCmdLine,
  int       nShowCmd
);


while on the stream when casey is opening msdn for winmain he gets this:
1
2
3
4
5
6
int CALLBACK winMain(
  _In_  HINSTANCE hInstance,
  _In_  HINSTANCE hPrevInstance,
  _In_  LPSTR lpCmdLine,
  _In_  int nCmdShow
);


Notice the difference between
1
int __clrcall WinMain
and
1
int CALLBACK winMain
.
I tried searching on the msdn website (https://msdn.microsoft.com/en-us/) but all the search results just point to https://docs.microsoft.com/

I found this answer on forum https://hero.handmade.network/for...umentation_for_offline_view#12280
I installed zeal and added docset for msdn. However when I search for winmain in Zeal, there are no search results.

So now my question is how do I get the msdn documentation or is there a reference / guide for changes in the api since then?
My dilemma is how to get started when I can't even find the documentation for the main function itself.
11 posts
MSDN in November 2019
Edited by VROOM on
Microsoft used to provide the whole MSDN library for offline use, but the last version I remember using it on is Visual Studio 2010. I managed to find these instructions to download MSDN offline for Visual Studio 2012 on the Microsoft blog. Maybe that works on newer version of Visual Studio as well.

It's very sad that Microsoft has let MSDN go so much. It used to be the best documentation I've read on the web in the VC6 days.
Ishan
2 posts
Currently a full-stack developer, aspiring to be a game developer.
MSDN in November 2019
I have tried enabling Microsoft Help Viewer already(Luckily Visual Studio 2019 does have it).
However when I search for winmain I find an article, which describes winmain as:
1
2
3
4
5
INT WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
    PSTR lpCmdLine, INT nCmdShow)
{
    return 0;
}


It's another declaration of winmain and not the one casey shows.
I am confused. What should I do now?
11 posts
MSDN in November 2019
Edited by VROOM on
I think those are correct. I don't remeber which version of the documentation Casey uses, but Microsoft adds things like CALLBACK, WINAPI, _In_, _Out_, etc. as ways to annotate the code. Basically, the _In_ and _Out_ before function parameters is just a way to tell the programmer that these parameters are input to your function or they are outputs that you must write to, and the OS will read them at some point. I think the macros for those are defined in windows.h.

The CALLBACK/WINAPI are ignored when compiling in 64bits as far as I know. They are both macros that expand to __stdcall, which is an annotation that tells the compiler what kind of function signature to generate for these functions when it produces assembly. You can read more about the calling convention here, but I think you can just ignore it.

In fact, I believe that's the reason Microsoft has removed these annotations from their documentation -- they don't do anything.
Mārtiņš Možeiko
2559 posts / 2 projects
MSDN in November 2019
Edited by Mārtiņš Možeiko on
_In_, _Out_ and and other annotations are not only for programmer, but also for cl compiler. They are part of static analysis framework in cl.exe called SAL Annotations. Which allows compiler to analyze your code more and provide extra checks for mistakes. For example, that you are not writing into argument that is marked as input, or that array is of expected size (prevents accessing out of bounds), and more. One very useful one is printf format string checking for correct types. That is, if you are writing function with varargs that accepts %i, %f and other formatters, the compiler can check that you are really passing int to %i, float to %f and so on. This is done with _Printf_format_string_ annotation. This is similar to "__attribute__((format(printf, N, M)))" annotation in GCC/Clang.

To enable cl.exe to do these checks you need to use /analyze compiler argument.
11 posts
MSDN in November 2019
That's cool! I didn't know they actually validated those. I thought they were just documentation.
Simon Anciaux
1337 posts
MSDN in November 2019
I don't know why "Windows Functions" don't show up in Zeal search but they are in the documentation.

When you launch zeal:
- click on MSDN on the list on the left;
- Windows Application UI Development;
- Windows and Messages;
- Windows;
- Window Reference;
- Window functions.
2 posts
This newly registered member has not yet activated their account.
MSDN in November 2019
Welcome, Ishan. Enjoy the episodes. I started at 0 and it took me over a year to get caught up. It was worth it!