[PATCH] ntoskrnl.exe: Correctly initialize two CRITICAL_SECTION_DEBUGs

Michael Stefaniuc mstefani at winehq.org
Tue Apr 30 14:58:15 CDT 2019


On 4/29/19 9:56 PM, Jacek Caban wrote:
> Jacek Caban <jacek at codeweavers.com>
> 
> On 4/29/19 9:13 PM, Michael Stefaniuc wrote:
>> Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
>> ---
>>   dlls/ntoskrnl.exe/ntoskrnl.c | 4 ++--
>>   1 file changed, 2 insertions(+), 2 deletions(-)
>>
>> diff --git a/dlls/ntoskrnl.exe/ntoskrnl.c b/dlls/ntoskrnl.exe/ntoskrnl.c
>> index b353839c0a..73fe054259 100644
>> --- a/dlls/ntoskrnl.exe/ntoskrnl.c
>> +++ b/dlls/ntoskrnl.exe/ntoskrnl.c
>> @@ -293,7 +293,7 @@ static CRITICAL_SECTION obref_cs;
>>   static CRITICAL_SECTION_DEBUG obref_critsect_debug =
>>   {
>>       0, 0, &obref_cs,
>> -    { &critsect_debug.ProcessLocksList,
>> &critsect_debug.ProcessLocksList },
>> +    { &obref_critsect_debug.ProcessLocksList,
>> &obref_critsect_debug.ProcessLocksList },
>>         0, 0, { (DWORD_PTR)(__FILE__ ": obref_cs") }
>>   };
>>   static CRITICAL_SECTION obref_cs = { &obref_critsect_debug, -1, 0,
>> 0, 0, 0 };
>> @@ -396,7 +396,7 @@ static CRITICAL_SECTION handle_map_cs;
>>   static CRITICAL_SECTION_DEBUG handle_map_critsect_debug =
>>   {
>>       0, 0, &handle_map_cs,
>> -    { &critsect_debug.ProcessLocksList,
>> &critsect_debug.ProcessLocksList },
>> +    { &handle_map_critsect_debug.ProcessLocksList,
>> &handle_map_critsect_debug.ProcessLocksList },
>>         0, 0, { (DWORD_PTR)(__FILE__ ": handle_map_cs") }
>>   };
>>   static CRITICAL_SECTION handle_map_cs = {
>> &handle_map_critsect_debug, -1, 0, 0, 0, 0 };
> 
> 
> FWIW, it would be nice if declaring a critical section would be easier
> and less error prone. Maybe WINE_STATIC_CRITICAL_SECTION() macro?
There's a reason I wrote the coccinelle script in the first place ;)

Anyway, I have attached an example patch. Once I have a working
coccinelle script to do the transformation I can send it in.

DECLARE_CRITICAL_SECTION() is IMHO a better name, can be prefixed with
WINE_ if so desired.

bye
	michael

-------------- next part --------------
A non-text attachment was scrubbed...
Name: cs.diff
Type: text/x-patch
Size: 1522 bytes
Desc: not available
URL: <http://www.winehq.org/pipermail/wine-devel/attachments/20190430/6d89ea99/attachment.bin>


More information about the wine-devel mailing list