Windows error 0x00000081, 129

Detailed Error Information

CHILD_NOT_COMPLETE[1]

MessageThe %1 application cannot be run in Win32 mode.
Declared inwinerror.h

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

SPIN_LOCK_INIT_FAILURE[2]

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

HRESULT analysis[3]

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

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
OriginMicrosoft
NTSTATUSfalse
Reserved (X)false
FacilityCode0 (0x000)
NameFACILITY_NULL[3][1]
DescriptionThe default facility code.[3][1]
Error Code129 (0x0081)

Possible solutions

5

From a huge enumeration, I try to make a function to apply the right action without using a switch body by using some template tricks

c++
templates
c++11

Use a table of entities.

You could also use std::map<value, function_pointer> which may be faster depending on your enumeration values.

The table is also called a jump table. Many compilers will convert switch statements into jump tables. Although the table of may be what the compiler generates, I believe the table is easier to maintain then a switch statement for large quantities of cases.

Edit 1: - Example
Simple Version: array of function pointers.

// Synonym for pointer to a function that has no parameters
//    and returns no values.
typedef void (*Function_Pointer)(void);

// Prototypes
void Eat(void);
void Sleep(void);
void Drink(void);

// The table
const static Function_Ptr dispatch_table[] =
{ /* Index 0 */ Eat,
  /* Index 1 */ Sleep,
  /* Index 2 */ Drink,
};

// Execution syntax
unsigned int index = 1;
(dispatch_table[index])();  // Execute Sleep() function.

More Robust Version: Associating enum with function pointer.

struct Dispatch_Entry
{
  unsigned int  function_ID;
  Function_Pointer p_function;
};

const static Dispatch_Entry robust_dispatch_table[] =
{
  // Unlike the array, this structure allows the
  // function pointers to be listed in any order.
  // Also, they don't have to be contiguous.
  {2, Drink},
  {0, Eat},
  {1, Sleep},
};
const unsigned int num_entries =
  sizeof(robust_dispatch_table) / sizeof(robust_dispatch_table[0]);

// Look up the function:
for (unsigned int i = 0;
     i < num_entries;
     ++i)
{
  if (robust_dispatch_table[i].function_ID == function_id_to_execute)
  {
    (robust_dispatch_table[i].p_function)(); // Execute function.
    break;
  }
}
answered on Stack Overflow Jan 17, 2015 by Thomas Matthews • edited Jan 17, 2015 by Thomas Matthews
1

No device file for partition on logical volume (Linux LVM)

mount
partition
lvm

Do'h! Just a careless mistake on my part. I just ran partprobe and then update-initramfs and now everything's peachy.

answered on Server Fault Jan 10, 2011 by Brian
1

Fedora 18 add new hard disk with LVM Partition

hard-drive
partitioning
fedora
lvm

I figured it out at last.

The problem is that by changing the format of my drive to LVM, I am actually creating a partition of my hard disk (which is almost the entire hard disk). The partition is /dev/sda1. Therefore, I have to use the command

pvcreate /dev/sda1

In case anyone in the future has trouble with adding a hard disk into an existing LVM group, I recommend following instructions on

http://www.server-world.info/en/note?os=Fedora_18&p=add_hd

to create an LVM partition and then

http://www.techotopia.com/index.php/Adding_a_New_Disk_to_a_Fedora_Volume_Group_and_Logical_Volume

to add this new partition to the volume group.

answered on Super User Apr 28, 2013 by namu
0

Custom Linux Build on NanoPi Neo Board

linux
arm
embedded-linux
buildroot
nanopi

I'm pretty sure the problem is that the linux doesn't activate a console on uart.

Take a look at kernel log:

[ 0.000000] Kernel command line: console=ttyS0,115200 console=tty0 root=/dev/mmcblk0p2 rootfstype=ext4 rootwait init=/sbin/init

As noted in http://www.tldp.org/HOWTO/Remote-Serial-Console-HOWTO/configure-kernel.html:

When multiple consoles are listed output is sent to all consoles and input is taken from the last listed console. The last console is the one Linux uses as the /dev/console device.

So try making console=ttyS0,115200 being the last (or the only) console option by tuning bootargs u-boot environment variable.

To check this suggestion, just "Hit any key to stop autoboot", then use printenv to inspect default bootargs content, run setenv bootargs ... ... ... and finally, run bootd. However, be sure to inspect bootcmd and what does it call, because one of those things may invoke setenv bootargs during bootcmd execution and overwrite your manual option.

P.S. init=/sbin/init may be omitted.

answered on Stack Overflow Dec 13, 2017 by Alex Offshore
0

Migrating C code that talks to a USB glucometer device from Linux to Android

java
android
usb
android-2.2-froyo
jini

I have diabetes and am using the Glucometer Deluxe software, a java program on my Windows XP machine. The software lacks many features such as being able to adjust the vertical scale on the graph of glucose versus time, it is fixed at 600 which is too high. It also background colors the graph which makes black and white laser printouts hard to read. Furthermore it's printout of readings is so verbose it takes many many pages wasting paper, a simple spreadsheet format would be better.

In general programming for Android is done in Java. It seems to me using the JAD Java Decompiler , http://en.wikipedia.org/wiki/JAD_%28JAva_Decompiler%29 , on the provided Glucometer Deluxe software might be a way to hack the code. It won't be easy.

If this works you would also be able to improve the Java program for PC's etc as well as get it to work on Android.

cdh@cdhconsult.com

answered on Stack Overflow Jul 23, 2011 by Charles Havener
0

initialize a USB device from pywinusb / python

python-2.7
windows-xp
pywinusb

For sending RAW data (no HID descriptor managed reports), you can use the "device.send_output_report()", pass any list as a parameter (or for better performance, you can pass a ctypes.c_ubyte array.

answered on Stack Overflow Apr 22, 2013 by Rene
0

From a huge enumeration, I try to make a function to apply the right action without using a switch body by using some template tricks

c++
templates
c++11

Just for the sake of completeness. Here a version which does not use macros, but does not use templates either.

Again O(1) and again fast compile times and small image size. And again, one time run time initialization in the range of microseconds.

Sorry if I misunderstood the question. To me it is about how to deal with the association between the large enum and test functions, just as the title says. To me it is not an exercise in meta programming.

To get rid of the throw, of course it is always possible to remove operator() and add a function taking the enum id as an additional parameter.

#include <iostream>
#include <vector>

typedef size_t Instr;

typedef enum Foo
{
    I_INVALID = 0
,   F_1 // for lack of better names... could as well be foo bar baz...
,   F_2
,   I_LAST_INSTRUCTION = 20
} Foo_t;

typedef void(*TestFunction_t)(std::vector<Instr> &, bool);

void Test1(std::vector<Instr>& l, bool b)
{
    const Foo_t ID = F_1;

    std::cout << "testing instruction #" << ID << std::endl;
}


void Test2(std::vector<Instr> & l, bool b)
{
    const Foo_t ID = F_2;

    std::cout << "testing instruction #" << ID << std::endl;
}


class Associator
{
public:
    static TestFunction_t s_functions[I_LAST_INSTRUCTION];
    static bool s_initialized;

    static inline void associate(size_t id, TestFunction_t fun)
    {
        s_functions[id] = fun;
    }

    Associator()
    {   
        // Only first instance runs the code below..
        // Does not look as if but it IS thread safe.
        // Why? Even if multiple threads race here, 
        // they all write the same values.
        if ( !s_initialized )
        {  
            s_initialized = true;

            // Add one line per test function.
            // Cannot see how to do without associating
            // the enum value with a function.
            associate(F_1, Test1);
            associate(F_2, Test2);
        }
    }

    TestFunction_t operator() (size_t id)
    {
        if (NULL == s_functions[id])
            throw std::invalid_argument("No function for this id.");
        return s_functions[id];
    }
};

TestFunction_t Associator::s_functions[I_LAST_INSTRUCTION] =
{
    0
};
bool Associator::s_initialized = false;


int main(int argc, const char * argv)
{
    Associator assoc; 

    std::vector<Instr> whatever;
    assoc(F_1)(whatever, true);
    assoc(F_2)(whatever, true);

    return 0;
}
answered on Stack Overflow Jan 18, 2015 by BitTickler • edited Jan 18, 2015 by BitTickler
0

How to enable UART Interrupt in imx6q?

interrupt
uart
imx6

I found the problem. It wasn't in the UART initialization. I forgot to set the VBAR register(vector base address register), whose reset value is 0x00000000. I had linked my vector table at 0x0093ff80. After correctly setting the VBAR register, the UART interrupt is working fine with the above initializations. This is how i set VBAR,

ldr r6,=__ram_vectors_start
MCR p15,0,r6,c12,c0,0
MCR p15,0,r6,c12,c0,1
answered on Stack Overflow Oct 27, 2016 by Ajeesh • edited Oct 27, 2016 by Ajeesh
0

DWARF - How to find the prologue end/epilogue start addresses of functions in a given binary?

c
assembly
objdump
dwarf
readelf

Try

readelf -wi

And look for DW_AT_low_pc and DW_AT_high_pc for the subroutine you are looking at.

The DWARF spec says:

A subroutine entry may have either a DW_AT_low_pc and DW_AT_high_pc pair of attributes or a DW_AT_ranges attribute whose values encode the contiguous or non-contiguous address ranges, respectively, of the machine instructions generated for the subroutine (see Section 2.17).

If I remember correctly, the DW_AT_low_pc is the address immediately after the prologue and DW_AT_high_pc is the last address before the epilogue.

Don't worry about the opcodes being 'special' that just means that they don't take arguments to save space in the encoded line number program.

answered on Stack Overflow Sep 28, 2014 by Torleif
0

From a huge enumeration, I try to make a function to apply the right action without using a switch body by using some template tricks

c++
templates
c++11

Approaching the age of 50 I feel free to present the vintage style solution to the problem. Traits:

  1. O(1) lookup.
  2. Table is not constructed/sorted at compile time, but instead at pre-main init time. A constructor writing 1200 function pointer values to a static array should not take more than a few microseconds.
  3. Template free - even the most silly of C++ compiler can handle this. Also, probably without all those templates your image size will be so much smaller that the runtime initialization of the array is amortized by the loading time for the image.
  4. Suitable to produce heart attacks to all your C++11++-whatnot fans.
  5. Took me only 30min...
  6. Most of the macro stuff you can throw into a header file (where your enum probably is...)

Here it is:

#include <iostream>
#include <vector>

typedef size_t Instr;

typedef enum Foo
{
    I_INVALID = 0
,   F_1 // for lack of better names... could as well be foo bar baz...
,   F_2
,   I_LAST_INSTRUCTION = 20
} Foo_t;

typedef void(*TestFunction_t)(std::vector<Instr> &, bool);

#define BEGIN_TEST_FUNCTION(id,name) \
    static void name (std::vector<Instr> & l, bool b) \
        { \
        static const Foo_t s_id = id; 
#define END_TEST_FUNCTION()\
        }

#define DECLARE_TEST_FUNCTION(id,name) \
    s_functions[id] = name;

#define INVOKE(id) \
    if( NULL != Invoker::s_functions[id]) \
        Invoker::s_functions[id]

BEGIN_TEST_FUNCTION(F_1,Test1)
    std::cout << "testing instruction #" << s_id << std::endl;
END_TEST_FUNCTION()

BEGIN_TEST_FUNCTION(F_2, Test2)
std::cout << "testing instruction #" << s_id << std::endl;
END_TEST_FUNCTION()

class Invoker
{
public:
    static TestFunction_t s_functions[I_LAST_INSTRUCTION];
    Invoker()
    {
        DECLARE_TEST_FUNCTION(F_1, Test1)
        DECLARE_TEST_FUNCTION(F_2, Test2)
        // ... and so on...
    }
};
static Invoker s_invokerInitializer;

TestFunction_t
Invoker::s_functions[I_LAST_INSTRUCTION] =
{
    {0}
};


int main(int argc, const char *argv[])
{
    std::vector<Instr> whatever;
    INVOKE(F_1)(whatever, true);
    INVOKE(F_2)(whatever, true);
    return 0;
}
answered on Stack Overflow Jan 18, 2015 by BitTickler
0

From a huge enumeration, I try to make a function to apply the right action without using a switch body by using some template tricks

c++
templates
c++11

Ok, if I choose an array of N elements viewed as a list of N/4 sub-arrays of 4 elements instead of the previous list of N sub-arrays of 1 element, compilation and execution are successful with right results (306 nests which is under 499 limit in VC2013). I wish it can be doable as a binary-tree so the nest count will be logarithmic (11 nests instead of 1223 nests!).

#include <iostream>
#include <vector>

using namespace std;

typedef size_t Instr; // dummy one for simplified code

enum
{
    I_INVALID = 0,

    I_LAST_INSTRUCTION = 1223
};

template< size_t id >
static void Test_T(std::vector< Instr > &, bool)
{
    cout << "testing instruction #" << id << endl;
}

template< typename Derived, size_t start_id, size_t end_id, size_t rem = ((end_id - start_id) & 3) >
struct Tester_T;

template< typename Derived, size_t start_id, size_t end_id >
struct Tester_T < Derived, start_id, end_id, 0 > : Tester_T < Derived, start_id, end_id - 4 >
{
    Tester_T()
    {
        static_cast<Derived *>(this)->array[end_id - 4] = Test_T< end_id - 4 >;
        static_cast<Derived *>(this)->array[end_id - 3] = Test_T< end_id - 3 >;
        static_cast<Derived *>(this)->array[end_id - 2] = Test_T< end_id - 2 >;
        static_cast<Derived *>(this)->array[end_id - 1] = Test_T< end_id - 1 >;
    }
};

template< typename Derived, size_t start_id, size_t end_id >
struct Tester_T < Derived, start_id, end_id, 1 > : Tester_T < Derived, start_id, end_id - 3 >
{
    Tester_T()
    {
        static_cast<Derived *>(this)->array[end_id - 3] = Test_T< end_id - 3 >;
        static_cast<Derived *>(this)->array[end_id - 2] = Test_T< end_id - 2 >;
        static_cast<Derived *>(this)->array[end_id - 1] = Test_T< end_id - 1 >;
    }
};

template< typename Derived, size_t start_id, size_t end_id >
struct Tester_T < Derived, start_id, end_id, 2 > : Tester_T < Derived, start_id, end_id - 2 >
{
    Tester_T()
    {
        static_cast<Derived *>(this)->array[end_id - 2] = Test_T< end_id - 2 >;
        static_cast<Derived *>(this)->array[end_id - 1] = Test_T< end_id - 1 >;
    }
};

template< typename Derived, size_t start_id, size_t end_id >
struct Tester_T < Derived, start_id, end_id, 3 > : Tester_T < Derived, start_id, end_id - 1 >
{
    Tester_T()
    {
        static_cast<Derived *>(this)->array[end_id - 1] = Test_T< end_id - 1 >;
    }
};

template< typename Derived >
struct Tester_T < Derived, 0, 0 >
{
};

struct Tester : Tester_T< Tester, I_INVALID, I_LAST_INSTRUCTION >
{
    void(*array[size_t(I_LAST_INSTRUCTION)])(std::vector< Instr > & list, bool is64);

    void operator()(size_t id, std::vector< Instr > & list, bool is64) const
    {
        if (id < I_LAST_INSTRUCTION)
        {
            (array[size_t(id)])(list, is64);
        }
        else
        {
            // to do nothing
        }
    }
};

static Tester const tester; 

int main()
{   
    std::vector< Instr > list;

    tester(0, list, true); // display testing instruction #0
    tester(1, list, true); // display testing instruction #1
    tester(2, list, true); // display testing instruction #2
    tester(3, list, true); // display testing instruction #3
    tester(4, list, true); // display testing instruction #4
    tester(8, list, true); // display testing instruction #8
    tester(15, list, true); // display testing instruction #15
    tester(16, list, true); // display testing instruction #16
    tester(1024, list, true); // display testing instruction #1024
    tester(1222, list, true); // display testing instruction #1222
    tester(1223, list, true); // invalid instruction number - do nothing
    tester(2048, list, true); // invalid instruction number - do nothing
}

Edit: the following code is doing the same in a more generic way (you can set the number max of element in a sub-array by setting the number of bits to encode an index of an element in a sub-array as the fourth template parameter of class Test_T)

#include <iostream>
#include <vector>

using namespace std;

typedef size_t Instr; // dummy one for simplified code

enum
{
    I_INVALID = 0,

    I_LAST_INSTRUCTION = 1223
};

template< size_t id >
static void Test_T(std::vector< Instr > &, bool)
{
    cout << "testing instruction #" << id << endl;
}

struct Tester;

template< size_t start_id, size_t end_id >
struct TestArrayInitializer_T
{
    static void Set(Tester & tester)
    {
        tester.array[start_id] = Test_T < start_id > ;
        TestArrayInitializer_T< start_id + 1, end_id >::Set(tester);
    }
};

template< size_t start_id >
struct TestArrayInitializer_T < start_id, start_id >
{
    static void Set(Tester & tester)
    {
        tester.array[start_id] = Test_T < start_id > ;
    }
};

template< typename Derived,
          size_t   start_id,
          size_t   end_id,
          size_t   bits,
          size_t   N = (1 << bits),
          size_t   i = (end_id - start_id) & (N - 1) >
struct Tester_T : Tester_T < Derived, start_id, end_id - N + i, bits >
{
    Tester_T()
    {
        TestArrayInitializer_T< end_id - N + i, end_id - 1 >::Set(*static_cast<Derived *>(this));
    }
};

template< typename Derived, size_t bits, size_t N, size_t i >
struct Tester_T < Derived, 0, 0, bits, N, i >
{
};

struct Tester :
    Tester_T < Tester,
               I_INVALID,
               I_LAST_INSTRUCTION,
               8 /* 256 elements per sub-array */ >
{
    void(*array[size_t(I_LAST_INSTRUCTION)])(std::vector< Instr > & list, bool is64);

    void operator()(size_t id, std::vector< Instr > & list, bool is64) const
    {
        if (id < I_LAST_INSTRUCTION)
        {
            (array[size_t(id)])(list, is64);
        }
        else
        {
            // to do nothing
        }
    }
};

static Tester const tester;

int main()
{
    std::vector< Instr > list;

    tester(0, list, true); // display testing instruction #0
    tester(1, list, true); // display testing instruction #1
    tester(2, list, true); // display testing instruction #2
    tester(3, list, true); // display testing instruction #3
    tester(4, list, true); // display testing instruction #4
    tester(8, list, true); // display testing instruction #8
    tester(15, list, true); // display testing instruction #15
    tester(16, list, true); // display testing instruction #16
    tester(1024, list, true); // display testing instruction #1024
    tester(1222, list, true); // display testing instruction #1222
    tester(1223, list, true); // invalid instruction number - do nothing
    tester(2048, list, true); // invalid instruction number - do nothing
}
answered on Stack Overflow Jan 18, 2015 by hlide • edited Jan 18, 2015 by hlide
0

No device file for partition on logical volume (Linux LVM)

mount
partition
lvm

For me activating it did it: vgchange -a y. After that the /dev/$vgname/* and /dev/mapper/$vgname-* devices immediately showed up.

Edit: Also required use_lvmetad = 1 instead of 0 in /etc/lvm/lvm.conf to make it mount on boot. Using update-initramfs -u after activating might or might not have had something to do with it.

answered on Server Fault Jul 22, 2014 by Luc • edited Jul 22, 2014 by Luc

Comments

Leave a comment

(plain text only)

Sources

  1. winerror.h from Windows SDK 10.0.14393.0
  2. https://docs.microsoft.com/en-us/windows-hardware/drivers/debugger/bug-check-code-reference2
  3. https://msdn.microsoft.com/en-us/library/cc231198.aspx

User contributions licensed under CC BY-SA 3.0