#include <9pm/windows.h> #include <9pm/u.h> #include <9pm/libc.h> DWORD WINAPI GetModuleFileName(HMODULE hModule, LPWSTR lpFilename, DWORD nSize) { char *path; int n; if(win_useunicode) return GetModuleFileNameW(hModule, lpFilename, nSize); path = win_malloc(nSize*UTFmax); n = GetModuleFileNameA(hModule, path, nSize*UTFmax); if(n == 0){ win_free(path); return 0; } n = win_utf2wstrn(lpFilename, nSize, path); win_free(path); return n; }