Windows error 0x00000031, 49

Detailed Error Information


This is a Blue Screen of Death stop code. More information is available in the Knowledge Base article Bug Check 0x31: PHASE0_INITIALIZATION_FAILED.

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][3]
Error Code49 (0x0031)

Possible solutions


DLR Routing failure in Kannel in a situation where there is a separate receiver and transceiver bind


As I can see from log and configuration file, you use different smsc sections for transmitter and receiver connections.

So when Kannel tries to find original message it use smsc and message-id parameters. In your case smsc will have different values on submit_sm and deliver_sm processing.

To resolve it just set-up single smsc group with:

  1. both port and receive-port inside
  2. transceiver-mode = 0 parameter (mean transmitter/receiver mode)

Note: this port may be the same and often is the same on SMSC.

Example (part of configuration):

transceiver-mode = 0
# other parameters here
answered on Stack Overflow Nov 29, 2011 by michael.bochkaryov

ctypes: Passing string by reference


A direct translation of your C code would be more like:

from ctypes import *
x = windll.LoadLibrary("x.dll")
iProgSize = c_int(0)
szProgSize = create_string_buffer(50)
pszProgSize = c_char_p(addressof(szProgSize))
getAdmSize = x.GetAdmSize
getAdmSize.argtypes = [POINTER(c_int), POINTER(c_char_p), c_int]
status = getAdmSize(byref(iProgSize), byref(pszProgSize), 49)

Fake DLL I tested with:

typedef int X_ERROR;
typedef int INT;
typedef char CHAR;

#include <string.h>

__declspec(dllexport) X_ERROR __stdcall GetAdmSize(INT* piAdmSize, CHAR** chBuf, INT iBufSize)
    *piAdmSize = 5;
    return 1;


>>> x.iProgSize
>>> x.pszProgSize
>>> x.szProgSize.value
answered on Stack Overflow May 26, 2012 by Mark Tolonen

How to change a property class in sub class in Objective-C


One thing you could do is declare a LineChartModel variable and not property and @synthesize dataModel to that ivar:

@interface LineChartViewController: ChartViewController {
     LineChartModel *_lineChartModel;

@implementation LineChartViewController
synthesize dataModel = _lineChartModel;

So from the outside it looks like you have a ChartModel, but inside the class you have LineChartModel. You will have to apply changes to _lineCharModel directly inside your class.

HOWEVER this is NOT my definition of better OOP!!! There's clearly a fault with the design if you need to cast your variables in subclass.

Another option I discovered after pasting this code into the editor is just use self.variable (which by the way, you should've already been doing).

@interface ChartModel : NSObject
- (BOOL)chartModelhasData;

@interface LineChartModel : ChartModel
- (UIColor *)getLineColor;

@interface ChartViewController: UIViewController
@property (nonatomic, strong) ChartModel *dataModel;
- (void)layoutChartCanvas;

@implementation ChartViewController
- (void)layoutChartCanvas {
    if ([self.dataModel chartModelhasData]) {
        self.view.hidden = NO;

@interface LineChartViewController : ChartViewController
// pay attension here, same name but a sub class of chartModel
@property (nonatomic, strong) LineChartModel *dataModel;
- (void)drawLine;

@implementation LineChartViewController
- (void)drawLine {
    UIColor *color = [self.dataModel getLineColor];
    [self drawLine];
answered on Stack Overflow Apr 10, 2015 by Lord Zsolt • edited Apr 10, 2015 by Lord Zsolt

How to change a property class in sub class in Objective-C


Probably you want to say:

Can I change the class C of a property already declared in a base class in a subclass to a subclass of C?

This is the set-up

@interface PropertyClass : NSObject

@interface PropertySubclass : PropertyClass
- (void)method;                              // Additional method

@interface HolderClass : NSObject
@property PropertyClass *property;           // Property is of base class

@implementation HolderClass

@interface HolderSubclass : HolderClass
@property PropertySubclass *property;        // Property is of subclass

I have no problem to access the property subclass' method in the holder's subclass:

@implementation HolderSubclass
- (void)useIt
  [ method]; // No error or warning

In addition to my comment below, I suspect that something like this happens:

// Create a subclass' object
HolderSubclass *object1 = [HolderSubclass new]; 

// Refer this object from a reference that is typed to HolderClass
// **This applies to all usages of self inside @implementation HolderClass**
HolderClass *object2 = object1; // Of course more complex

id value = [object2 method]; // Error

This error is correct. If this is the error, it is solvable. But first we have to clarify that.

BTW: This has nothing to do with better OOP. First of all this is a problem of class based programming languages, not of object orientated programming languages. Second I cannot see that this set-up will break a rule of class based or object orientated programming, esp. it fulfills Liskov's rule.

answered on Stack Overflow Apr 10, 2015 by Amin Negm-Awad • edited Apr 10, 2015 by Amin Negm-Awad

FSharpTypeFunc.Specialize causing TypeLoadException


Sent it to fsbugs and received a reply that it's been fixed.

answered on Stack Overflow Jun 7, 2012 by Daniel

Inconsistent behaviour while testing a c++ application for performance


The exception you posted seems to be an access violation (0xc00000005). A C++ exception will not catch these unless you have structured exception handling turned on (SEH) when you built your application.

But the other issue is that you know what the exception is, so how do you fix it? That is a different thing altogether. From the looks of it, the xerces code is attempting to dereference a NULL pointer.

You should have handy a debuggable version of the xerces library (which comes with full source code), and attempt to duplicate the crash using that version. Then at least you can see exactly what is happening at the crash location and how it occurred.

answered on Stack Overflow Mar 21, 2014 by PaulMcKenzie • edited Mar 21, 2014 by PaulMcKenzie

ctypes: Passing string by reference


Figured it out I think. I also had to specify the return type:

getAdmSize.restype = X_ERROR
answered on Stack Overflow May 25, 2012 by Baz

buffer overflow exploit experiment, unexpected result


In your exploit experiment you seem to have lost track of the order of buffers and variable.
Your output (together with variable declarations in the code) clearly shows:

  • buffer_two, size 8, address 0x...0c
  • buffer_one, size 8, address 0x...14
  • value , size 4, address 0x...1c

(Size of value is guess, but irrelevant, assuming it has the LSB on lowest byte address.)

When buffer_two overflows by 9 bytes, it will fill buffer_one completely, first byte of value with '1' == 49 and second byte of value with 0.

To repeat, all of that is, strictly speaking, UB and therefor wild guessing. But that is the normal environment of exploits, which you are probably aware of.

answered on Stack Overflow Oct 8, 2017 by Yunnosch

Linux syscall in vmlinux and virtual memory


The useless ret is a stub that is replaced by the right code once the memory has been mapped. The code of system calls maybe located to different places depending on some non-deterministic choices and once the memory address is known, the stub is replaced.

answered on Stack Overflow May 19, 2014 by Thomas Coudray

32-bit pointer overflow in 64-bit gcc code - fails in compile


I just ran into the same problem with GNU Fortran (GCC) 5.1.0 in a Mac running 10.11.5 but the solution offered by the OP did not work for me.

However, I did find a solution: after systematically pruning my rather pedestrian legacy code, I found that every array has to be explicitly filled with something. You can't start filling it within your code. I know it sounds silly, but once I initialized every "real" array (32 bit, it is legacy code) with 0.0 before I did any I/O or other work, it linked without complaint.

And, yes, as with the OP, my code worked until I changed the size of an array.

The reason why this worked may be in the contents of this bug report: but I am not good enough to tell you how to come up with a better workaround. My only guess is that initializing every array at the beginning favors the GOT instead of the RIP. (When will this be fixed? I just don't know how to push this up the line and the bug report is dated 2014-11-09)

answered on Stack Overflow Jun 3, 2016 by HackerPhysicist


Leave a comment

(plain text only)


  3. winerror.h from Windows SDK 10.0.14393.0

User contributions licensed under CC BY-SA 3.0