Windows error 0x0000023A, 570

Detailed Error Information


MessageThe NtCreateFile API failed. This error should never be returned to an application, it is a place holder for the Windows Lan Manager Redirector to use in its internal error mapping routines.
Declared inwinerror.h

This appears to be a raw Win32 error. More information may be available in error 0x8007023A.

HRESULT analysis[2]

This is probably not the correct interpretation of this error. The Win32 error above is more likely to indicate the actual problem.

This code indicates success, rather than an error. This may not be the correct interpretation of this code, or possibly the program is handling errors incorrectly.

Reserved (R)false
Reserved (X)false
FacilityCode0 (0x000)
DescriptionThe default facility code.[2][1]
Error Code570 (0x023a)

Possible solutions


Page Heap doesn't record useful stack infomation?


Thanks to @Marc Sherman for pointing out in the comments that I should check out the real allocation stack trace.

As already edited into the question, VC80(VS2005) is the problem here, as it's CRT has FPO enabled, as seen in the stack trace:

MSVCR80!malloc+0x7a (FPO: [1,0,0]) (CONV: cdecl) 
MFC80U!operator new+0x2f (FPO: [Uses EBP] [1,0,0]) (CONV: cdecl)

Now, having an anchor to search, we find the following:

Why does every heap trace in UMDH get stuck at “malloc”?

Adding a few quotes:

In particular, it would appear that the default malloc implementation on the static link CRT on Visual C++ 2005 not only doesn’t use a frame pointer, but it trashes ebp as a scratch register ...

What does this all mean? Well, anything using malloc that’s built with Visual C++ 2005 won’t be diagnosable with UMDH or anything else that relies on ebp-based stack traces, at least not on x86 builds.

There is also a reply in the comments that's got nice info:

Mark Roberts [MSFT] says: February 25, 2008 at 3:03 pm


Enabling FPO for the 8.0 CRT was not deliberate. The Visual Studio 2008 CRT (9.0) does NOT have FPO enabled, and UMDH should function normally.

For 8.0, an alternative to UMDH would be to use LeakDiag. LeakDiag will actually instrument memory allocators to obtain stack traces. This makes it more versatile than UMDH as it can hook several different allocator types at different granularities (Ranging from the c runtime to raw virtual memory allocations).

By default, LeakDiag simply walks the stack base pointers, but it can be modified to use the Dbghlp StackWalkAPI to resolve FPO data. This will produce full stacks, though the performance penalty is higher. On the flip side, you can customize the stack walking behavior to only go to a certain depth, etc to minimize the perf penalty.

Please find LeakDiag here:

answered on Stack Overflow Sep 27, 2013 by Martin Ba • edited Sep 27, 2013 by EdChum

Memory leak due to marshalling managed delegate?


Just declare your native method with a delegate parameter instead of IntPtr. The marshaler will do all this stuff for you.

answered on Stack Overflow Sep 13, 2012 by Anton Tykhyy

How to diagnose a corrupted suffix pattern in a mixed managed/unmanaged x32 .NET application


I finally resolved this, and found that I had made one crucial mistake. With a corrupted suffix pattern, the error will come on a free attempt, which led me to believe that it was unlikely that the allocation would have come right before the free. This was not accurate. When dealing with corruption that occurs on free, barring further information, any allocation point is equally likely. In this case, the verifier halt was coming on freeing a parameter which had been incorrectly defined as a struct of shorts instead of as a struct of ints.

Here's the offending code:

    [DllImport("gdi32.dll", CharSet = CharSet.Unicode)]
    [return: MarshalAs(UnmanagedType.Bool)]
    static extern bool GetCharABCWidths(IntPtr hdc, uint uFirstChar, uint uLastChar, [Out] ABC[] lpabc);

(This declaration is okay)

    public struct ABC
        public short A;
        public ushort B;
        public short C;

(This is not okay, per the MSDN article on the ABC struct : )

So, if you find yourself debugging memory corruption that halts on free, keep in mind: never discount the possibility that the memory being freed was incorrectly allocated to begin with... and mind those [Out] parameters on unmanaged calls!

answered on Stack Overflow Feb 14, 2014 by ianschol

The !address windbg command says that heap address is 'REGionUsageIsVAD' even though it was allocated using HeapAlloc


i reread your question thinking i would update what i commented
but upon closer look it seems there are lot of holes
it appears you copied things and didnt paste right
where is that pointer on heap ?
01699928 which version of windbg are you using
since i couldn't confirm i cooked up a simple program enabled hpa in gflags and executed the exe under windbg below is the screen shot
except what you paste as isregionvad ( this line is output under kernel !address not in user !address ) every thing else appears to be similar in the screenshot

enter image description here

answered on Stack Overflow Aug 20, 2016 by blabb

Memory leak due to marshalling managed delegate?


As far as I know delegate is a list of function pointers in C#. Passing that to a parameter of function pointer in C++ makes me feels there will be a problem. You should consider adding a native function to report status and pool this one in a separate thread or background worker in C#. Such that you do not need to pass a delegate any more.

answered on Stack Overflow Sep 13, 2012 by Mahmoud Fayez


Leave a comment

(plain text only)


  1. winerror.h from Windows SDK 10.0.14393.0

User contributions licensed under CC BY-SA 3.0