Can't get GZDoom to compile and run (Windows 10)

Discuss anything ZDoom-related that doesn't fall into one of the other categories.

Re: Can't get GZDoom to compile and run (Windows 10)

Postby _mental_ » Wed May 16, 2018 2:18 am

It's here. This can happen only if _get_pgmptr() function returns zero but for some reason assigns nullptr to its argument.
Code: Select allExpand view
#ifdef _MSC_VER
      if (_get_pgmptr(&program) != 0)
      {
         I_FatalError("Could not determine program location.");
      }
#else
      // ...
#endif
      progdir = program;
      program = progdir.LockBuffer();
      *(strrchr(program, '\\') + 1) = '\0';   // <------
      //...


EDIT: The crash is caused by a new Windows SDK, 10.0.17134.0 in my case. _get_pgmptr() assigns an empty string to its argument. Looks like Microsoft cannot release anything that won't break existing software. It's a new trend in software industry and everyone wants to be a part of it...
_mental_
 
 
 
Joined: 07 Aug 2011

Re: Can't get GZDoom to compile and run (Windows 10)

Postby Graf Zahl » Wed May 16, 2018 3:13 am

The real error here is assuming that 'strrchr' always returns something valid and usable. You do not code like that!!!
This would already crash if the file name contained forward slashes or no slashes at all.

Just remove that case and always use GetModuleFileName. I don't get it why such a totally redundant special case needs to be here and why it is necessary to check some CRT internal here.
User avatar
Graf Zahl
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: Can't get GZDoom to compile and run (Windows 10)

Postby drfrag » Wed May 16, 2018 4:07 am

Luckily this kind of stuff doesn't happen with MinGW. :mrgreen:
But now seriously according to Monkeysoft _get_pgmptr should not return zero when pValue is NULL but EINVAL.
https://msdn.microsoft.com/en-us/library/24awhcba.aspx
User avatar
drfrag
ZDoom32 and ZDoom LE developer.
 
Joined: 23 Apr 2004
Location: Spain

Re: Can't get GZDoom to compile and run (Windows 10)

Postby Cacodemon345 » Wed May 16, 2018 4:14 am

EDIT: The crash is caused by a new Windows SDK, 10.0.17134.0 in my case. _get_pgmptr() assigns an empty string to its argument. Looks like Microsoft cannot release anything that won't break existing software. It's a new trend in software industry and everyone wants to be a part of it...

That's another time Microsoft fixed up another undefined behaviour, ever since older DDraw games started to break...
That's the reason why I prefer older Win7.
Cacodemon345
 
Joined: 22 Dec 2017
Discord: Cacodemon345#9151

Re: Can't get GZDoom to compile and run (Windows 10)

Postby Graf Zahl » Wed May 16, 2018 4:22 am

Which wouldn't help you in any way here, because it's not an error in the operating system but in some library code that got linked into GZDoom that caused the problem.
In all seriousness, why was this function even used? IMO it's a classic case of bad app code causing problems down the line because it wasn't fully thought through.

Fun stuff: Before 2008 this was using GetModuleFileName but then Randi must have read about this strange function and changed the code without any real need. Then later problems on MinGW surfaced and the #ifdef got added. And now we're back to the start, as it always should have remained.
Last edited by Graf Zahl on Wed May 16, 2018 4:33 am, edited 1 time in total.
User avatar
Graf Zahl
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: Can't get GZDoom to compile and run (Windows 10)

Postby drfrag » Wed May 16, 2018 4:27 am

Now i see the program is expected to crash anyway and to allow it to continue a custom invalid parameter handler would be required.
User avatar
drfrag
ZDoom32 and ZDoom LE developer.
 
Joined: 23 Apr 2004
Location: Spain

Re: Can't get GZDoom to compile and run (Windows 10)

Postby Cacodemon345 » Wed May 16, 2018 7:11 am

Graf Zahl wrote:bad app code

...is the reason why a lot of Windows games in the 90s no longer work anymore, due to bad coding shit.
Cacodemon345
 
Joined: 22 Dec 2017
Discord: Cacodemon345#9151

Re: Can't get GZDoom to compile and run (Windows 10)

Postby RockstarRaccoon » Wed May 16, 2018 8:37 am

So, we were right? This isn't a problem with anything I'm doing, the code just doesn't work anymore? So, I should either change that line or use the Linux compiler? Has this been fixed in the latest GitHub build?
User avatar
RockstarRaccoon
Totally Babies
 
Joined: 31 Jul 2016

Re: Can't get GZDoom to compile and run (Windows 10)

Postby Graf Zahl » Wed May 16, 2018 8:44 am

Yes, _mental_ has committed a fix a few hours ago.
You would actually be able to compile it if CMake allowed selection of the desired Windows SDK.
User avatar
Graf Zahl
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: Can't get GZDoom to compile and run (Windows 10)

Postby RockstarRaccoon » Wed May 16, 2018 8:55 am

Well, it's a new computer, so I don't have the older Windows SDKs on it, so the fix is preferable. I'm assuming I would get that from the gitHub version? Yep.
User avatar
RockstarRaccoon
Totally Babies
 
Joined: 31 Jul 2016

Re: Can't get GZDoom to compile and run (Windows 10)

Postby drfrag » Wed May 16, 2018 1:47 pm

If you want to make some modifications to the code you should install Git and TortoiseGit.
That said you could also check that commit and copy-pasta the changes in your source manually.
I was wrong and the link i provided earlier was for an older version, i still don't know where the code for 3.3.2 is in the repo.
Right now AFAIK there are a couple of branches with the fix applied, the official master https://github.com/coelckers/gzdoom/archive/master.zip and my unofficial MinGW maintenance branch https://github.com/drfrag666/gzdoom/archive/g3.3mgw.zip (this is mostly up to date minus the 2D and GL refactor).
User avatar
drfrag
ZDoom32 and ZDoom LE developer.
 
Joined: 23 Apr 2004
Location: Spain

Re: Can't get GZDoom to compile and run (Windows 10)

Postby Graf Zahl » Wed May 16, 2018 2:11 pm

drfrag wrote: I was wrong and the link i provided earlier was for an older version, i still don't know where the code for 3.3.2 is in the repo.


It's at the g3.3.2 tag, where else? If you just look at master's history you won't find it. The release tags will always be off the mainline because of the versioning info they need.
User avatar
Graf Zahl
Lead GZDoom Developer
 
Joined: 19 Jul 2003
Location: Germany

Re: Can't get GZDoom to compile and run (Windows 10)

Postby RockstarRaccoon » Wed May 16, 2018 2:44 pm

Alright, new code is building fine on my computer! Thanks for all the help guys, and glad that I ended up helping you find an error! :3

Working on that AutoMap stuff I wanted to test now. Hope to be trying to get it in the main build soon!
User avatar
RockstarRaccoon
Totally Babies
 
Joined: 31 Jul 2016

Re: Can't get GZDoom to compile and run (Windows 10)

Postby drfrag » Wed May 16, 2018 3:21 pm

Thanks, that tag is not on any branch and i was missing tags in my local repo.

Then you'll need Git and to work on the current master.
User avatar
drfrag
ZDoom32 and ZDoom LE developer.
 
Joined: 23 Apr 2004
Location: Spain

Previous

Return to General

Who is online

Users browsing this forum: kondoriyano and 3 guests