So, after lurking about the forums here a bit, I found a few posts relating to a problem I have. Specifically, WC4 not working in Win2K, throwing the error "VirtualProtect() failed" but being just fine in WinXP and Win9X. No answers, though. So, I checked at the NTCompatible forums, and found a hint that sent me on a quest. It appears that WC4 runs on XP because it contains a compatibility fix 2K does not. Namely "HandleAPIExceptions". That makes some sense. Win9X is sloppy enough to let you get away with a slightly bad API call, but NT based OSes like 2K and XP are not...without the fix.
Getting MS to implement that fix in 2K would surely be talking to a brick wall, so I started hunting around the WC4 exe with a debugger, looking for the offending call to VirtualProtect that was failing. After many hours of weeding through far too much assembly code, I found it.
Now, on one hand I want to thank the Origin programmers for including so many fine error messages in their code so that they could know why the game bombed. A lot of developers would just have it crash to desktop with no message. So that's great and was very helpful. On the other hand, sometimes you just want to smack them for being so sloppy... And this is why:
VirtualProtect changes read/write protection on memory and requires four variables. The start of an area in memory, the number of bytes to change, the new protection value, and...AND...the address of a local variable to return the old protection value in. Wanna know what Origin put for that value? 0. Yup. Zero. They didn't forget to put in a value, they just put 0. The MSDN states that "If this parameter is NULL or does not point to a valid variable, the function fails."
Now, I'm not the biggest genius when it comes to this stuff, and honestly I've never used the VirtualProtect function because my real programming experience is actually kinda limited, but I believe that if I can change that value to the value of some local junk variable it should succeed.
I'll keep ya'll posted.
-NStriker
Getting MS to implement that fix in 2K would surely be talking to a brick wall, so I started hunting around the WC4 exe with a debugger, looking for the offending call to VirtualProtect that was failing. After many hours of weeding through far too much assembly code, I found it.
Now, on one hand I want to thank the Origin programmers for including so many fine error messages in their code so that they could know why the game bombed. A lot of developers would just have it crash to desktop with no message. So that's great and was very helpful. On the other hand, sometimes you just want to smack them for being so sloppy... And this is why:
VirtualProtect changes read/write protection on memory and requires four variables. The start of an area in memory, the number of bytes to change, the new protection value, and...AND...the address of a local variable to return the old protection value in. Wanna know what Origin put for that value? 0. Yup. Zero. They didn't forget to put in a value, they just put 0. The MSDN states that "If this parameter is NULL or does not point to a valid variable, the function fails."
Now, I'm not the biggest genius when it comes to this stuff, and honestly I've never used the VirtualProtect function because my real programming experience is actually kinda limited, but I believe that if I can change that value to the value of some local junk variable it should succeed.
I'll keep ya'll posted.
-NStriker