KeInitializeSemaphore

VOID *__stdcall KeInitializeSemaphore(PRKSEMAPHORE Semaphore, INT32 Count, INT32 Limit){
  VOID *result; 

  result = &Semaphore->gap0[8];
  Semaphore->gap0[0] = 5;
  *(_QWORD *)&Semaphore->gap0[16] = &Semaphore->gap0[8];
  *(_QWORD *)&Semaphore->gap0[8] = &Semaphore->gap0[8];
  Semaphore->gap0[2] = 8;
  *(_DWORD *)&Semaphore->gap0[4] = Count;
  Semaphore->Limit = Limit;
  return result;
}

Referenced by:

IopInitializePlugPlayServices
MiInitializeSections
NtCreateSemaphore
PopFxInitializeWorkPool
PspAllocateThread