If I am missing something and there is some rationale under keeping MakeCriticalSectionGlobal with semaphore creation around, another way to fix that is probably use the fact that valid handles are multiples of 4 while for fast path LockSemaphore can only be 0 or 1, and distinguish whether the semaphore is used by LockSemaphore value.