Am 07.04.2017 um 17:52 schrieb Christian Inci:
DWORD tid = 0; int request_pipe[2];
CONTEXT ctx; NTSTATUS status;
[...]
ctx.ContextFlags = CONTEXT_DEBUG_REGISTERS;
NtSetContextThread(handle, &ctx);
You didn't initialize the register values and therefore set the debug registers to random stack values. You should either initialize them manually or memset the whole struct.
Thanks, I weren't sure about that one. I thought that every recent compiler will zero-initialize local variables/structures. Are there compilers or some special cases which wouldn't let that happen? Are they often enough not explicit set to zero (by using non-previously-used memory for the first time), so it'll be assumed to be zero?
On 04/07/2017 06:43 PM, Michael Müller wrote:
Am 07.04.2017 um 17:52 schrieb Christian Inci:
DWORD tid = 0; int request_pipe[2];
CONTEXT ctx; NTSTATUS status;
[...]
ctx.ContextFlags = CONTEXT_DEBUG_REGISTERS;
NtSetContextThread(handle, &ctx);
You didn't initialize the register values and therefore set the debug registers to random stack values. You should either initialize them manually or memset the whole struct.
2017-04-07 19:22 GMT+02:00 Christian Inci chris.wine@broke-the-inter.net:
Thanks, I weren't sure about that one. I thought that every recent compiler will zero-initialize local variables/structures. Are there compilers or some special cases which wouldn't let that happen? Are they often enough not explicit set to zero (by using non-previously-used memory for the first time), so it'll be assumed to be zero?
Huh? No, automatic variables aren't implicitly initialized in C and I wouldn't want a compiler that goes out of its way to initialize them, slowing down the code for everyone.
Thanks. I guess that I should quit coding altogether.
On 04/09/2017 07:53 PM, Matteo Bruni wrote:
2017-04-07 19:22 GMT+02:00 Christian Inci chris.wine@broke-the-inter.net:
Thanks, I weren't sure about that one. I thought that every recent compiler will zero-initialize local variables/structures. Are there compilers or some special cases which wouldn't let that happen? Are they often enough not explicit set to zero (by using non-previously-used memory for the first time), so it'll be assumed to be zero?
Huh? No, automatic variables aren't implicitly initialized in C and I wouldn't want a compiler that goes out of its way to initialize them, slowing down the code for everyone.
2017-04-09 20:15 GMT+02:00 Christian Inci chris.wine@broke-the-inter.net:
Thanks. I guess that I should quit coding altogether.
That's a bit of an overreaction...
BTW, thank you for debugging and finding a fix for the bug!