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

HANDLE WINAPI
CreateFileMapping(HANDLE hFile, LPSECURITY_ATTRIBUTES lpFileMappingAttributes,
		DWORD flProtect, DWORD dwMaximumSizeHigh, DWORD dwMaximumSizeLow,
		LPCWSTR lpName)
{
	char *p;
	HANDLE h;

	if(win_useunicode)
		return CreateFileMappingW(hFile, lpFileMappingAttributes,
			flProtect, dwMaximumSizeHigh, dwMaximumSizeLow, lpName);
	
	if(lpName)
		p = win_wstr2utf(lpName);
	else
		p = 0;

	h = CreateFileMappingA(hFile, lpFileMappingAttributes,
			flProtect, dwMaximumSizeHigh, dwMaximumSizeLow, 0);
	win_free(p);
	return h;
}

