#include <9pm/windows.h>
#include <9pm/u.h>
#include <9pm/libc.h>

HANDLE WINAPI
CreateSemaphore(LPSECURITY_ATTRIBUTES lpSemaphoreAttributes, LONG lInitialCount,
	LONG lMaximumCount, LPCWSTR lpName)
{
	char *name;
	HANDLE h;

	if(win_useunicode)
		return CreateSemaphoreW(lpSemaphoreAttributes, lInitialCount,
			lMaximumCount, lpName);

	name = win_wstr2utf(lpName);
	h = CreateSemaphoreA(lpSemaphoreAttributes, lInitialCount,
			lMaximumCount, name);
	win_free(name);
	return h;
}
