tpn / winsdk-10

225 stars 319 forks source link

IoGetRemainingStackSize returns address of local variable #3

Open harjoc opened 4 years ago

harjoc commented 4 years ago

When compiling a source file which includes wdm.h from this project using GCC 7.3, it warns about:

km/wdm.h: In function ‘IoGetRemainingStackSize’:
km/wdm.h: function returns address of local variable [-Wreturn-local-addr]                                                                                                                         
      return((ULONG_PTR)(&Top) - Bottom );

According to msdn, it should return Top - Bottom instead of &Top - Bottom.

HBelusca commented 3 weeks ago

Using &Top takes into account the current stack location where Top and Bottom variables are currently located. Also remember that these are the official windows headers, so if you have complaints about them, you should send some feedback somewhere on their github (https://github.com/microsoft) These headers have just been dumped here by tpn.