Dummy implementation of MultiByteToWideChar & WideCharToMultiByte.
Signed-off-by: Andrea Odetti <mariofutire@gmail.com>
This commit is contained in:
parent
14fdc2520b
commit
ffddc18fe6
5 changed files with 41 additions and 0 deletions
|
@ -48,6 +48,7 @@ add_library(appleii SHARED
|
|||
linux/windows/dsound.cpp
|
||||
linux/windows/guiddef.cpp
|
||||
linux/windows/dmusicc.cpp
|
||||
linux/windows/winnls.cpp
|
||||
|
||||
linux/data.cpp
|
||||
linux/benchmark.cpp
|
||||
|
|
|
@ -20,3 +20,4 @@
|
|||
#include "linux/windows/mmreg.h"
|
||||
#include "linux/windows/mmsystem.h"
|
||||
#include "linux/windows/dmusicc.h"
|
||||
#include "linux/windows/winnls.h"
|
||||
|
|
|
@ -139,6 +139,7 @@ typedef short SHORT;
|
|||
typedef /*long*/int LONG;
|
||||
typedef SHORT *PSHORT;
|
||||
typedef LONG *PLONG;
|
||||
typedef wchar_t WCHAR;
|
||||
#endif
|
||||
|
||||
typedef LONG HRESULT;
|
||||
|
@ -166,6 +167,8 @@ typedef LPSTR PTSTR, LPTSTR;
|
|||
typedef LPCSTR LPCTSTR;
|
||||
typedef LPSTR LP;
|
||||
|
||||
typedef WCHAR *LPWSTR;
|
||||
typedef CONST WCHAR *LPCWSTR;
|
||||
|
||||
#ifndef _TCHAR_DEFINED
|
||||
// TCHAR a typedef or a define?
|
||||
|
|
26
source/linux/windows/winnls.cpp
Normal file
26
source/linux/windows/winnls.cpp
Normal file
|
@ -0,0 +1,26 @@
|
|||
#include "linux/windows/winnls.h"
|
||||
|
||||
#include <cstdlib>
|
||||
#include <cstring>
|
||||
|
||||
// massive hack until I understand how it works!
|
||||
|
||||
INT WINAPI MultiByteToWideChar(UINT CodePage, DWORD dwFlags, LPCSTR lpMultiByteStr, INT cbMultiByte, LPWSTR lpWideCharStr, INT cchWideChar)
|
||||
{
|
||||
// int res = mbstowcs(lpWideCharStr, lpMultiByteStr, strlen(lpMultiByteStr));
|
||||
if (lpWideCharStr)
|
||||
{
|
||||
strcpy(reinterpret_cast<char *>(lpWideCharStr), lpMultiByteStr);
|
||||
}
|
||||
return strlen(lpMultiByteStr) + 1; // add NULL char at end
|
||||
}
|
||||
|
||||
INT WINAPI WideCharToMultiByte(UINT CodePage, DWORD dwFlags, LPCWSTR lpWideCharStr, INT cchWideChar, LPSTR lpMultiByteStr, INT cbMultiByte, LPCSTR lpDefaultChar, LPBOOL lpUsedDefaultChar)
|
||||
{
|
||||
if (lpMultiByteStr)
|
||||
{
|
||||
strcpy(lpMultiByteStr, reinterpret_cast<const char *>(lpWideCharStr));
|
||||
}
|
||||
// size_t res = wcstombs(lpMultiByteStr, lpWideCharStr, cbMultiByte);
|
||||
return strlen((const char *)lpWideCharStr) + 1;
|
||||
}
|
10
source/linux/windows/winnls.h
Normal file
10
source/linux/windows/winnls.h
Normal file
|
@ -0,0 +1,10 @@
|
|||
#pragma once
|
||||
|
||||
#include "linux/windows/wincompat.h"
|
||||
|
||||
#define CP_ACP 0
|
||||
#define CP_UTF8 65001
|
||||
#define MB_ERR_INVALID_CHARS 0x08
|
||||
|
||||
INT WINAPI MultiByteToWideChar(UINT,DWORD,LPCSTR,INT,LPWSTR,INT);
|
||||
INT WINAPI WideCharToMultiByte(UINT,DWORD,LPCWSTR,INT,LPSTR,INT,LPCSTR,LPBOOL);
|
Loading…
Add table
Reference in a new issue