[PATCH 2/2 v2] ntdll: Zero debug registers after thread creation

Christian Inci chris.wine at broke-the-inter.net
Fri Apr 7 12:22:26 CDT 2017


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.
> 



More information about the wine-devel mailing list