Non-fatal, undocumented return code

Started by
10 comments, last by MaulingMonkey 6 years, 7 months ago

Hi guys, I was wondering if any of you ever had an encounter with 0xCCCCCCCC as a return code/result when calling a D3D11CreateDeviceAndSwapChain or D3D11CreateDevice.

My code worked just fine as of yesterday, and did for months, but I now get 0xCCCCCCCC instead of the usual S_OK (or rarely S_FALSE) for some reason. Literally nothing in my code changed. I woke up to that return code. Whatever it is, it's in no way preventing my application from working as it should but I do have to bypass the error checking I've put in place because of how unusual the error code is.

Can anyone shed some light on this undocumented return code?

Advertisement

Something has corrupted D3D11.dll? :o

Now that you mention it, it does look like it. The value is just plain off when I take a look at the range of the documented values.

I'll try replacing D3D11.dll and see if it changes anything. Thanks dude.

0xCCCCCCCC is often used by debuggers to initialize uninitialized variables/memory. Are you sure that value is coming from d3d11.dll?

You're spot on about the origin of the value. I found out about it by monitoring the value before and after the call and then I discovered that the call didn't write to the HRESULT at all so it kept 0xCCCCCCCC as its value and my error detection failed. The corruption hypothesis turned out to be correct because I had no such problem when debugging the code on my other computer. Everything makes sense to me now because it seems my Win10 installation is partly corrupted. CL.EXE and C2.DLL started giving me weird errors 2 days ago and CL.EXE eventually wouldn't run at all. I replaced them with the files from the VS installation and it fixed the issue. I guess the same thing happened to d3d11.dll. Repairing my Win10 installation should take care of it. I should have come to that conclusion sooner tbh.

12 minutes ago, Shangbye said:

it seems my Win10 installation is partly corrupted. CL.EXE and C2.DLL started giving me weird errors 2 days ago and CL.EXE eventually wouldn't run at all. I replaced them with the files from the VS installation and it fixed the issue

Your HDD/SSD is failing and/or you've got a virus attacking your PC :o

Time to pull your drives out and put in a clean one.

Outside of failing hdd/virus, your other computer assumption is absurd.

 

Undefined behavior is undefined, you could have run fine for monh then crash, cure the cancer, resolve climate change or start world war 3. Undefined behavior means everything possible.

 

In regards to uninitialized variable, usually they either get set to 0xcccc or 0 if you run a debug runtime or contains whatever was at the address if not. And you cannot rely on it to be consistent between machines or os version !

On 8/29/2017 at 10:08 PM, galop1n said:

In regards to uninitialized variable, usually they either get set to 0xcccc or 0

What is the idea behind using 0xCCCCCCCC? I think VS uses 0.

🧙

No, all this magic numbers are Microsof, VS sure don't set memory to zero !, you can find a good list of theme here (https://stackoverflow.com/questions/127386/in-visual-studio-c-what-are-the-memory-allocation-representations). They are meant to help you debug, and be glad it gives consistent behavior to something that is not, because it allow you to catch bugs that could be silent for months. Your worst enemy would be everything initialized to 0.

22 hours ago, galop1n said:

VS sure don't set memory to zero

Doesn't the MVSC++ compiler with debug flag enabled need to generate the explicit initialization code statements? (for me VS and MVSC++ are so coupled, pretty much the same; some skin over the compiler).

🧙

This topic is closed to new replies.

Advertisement