1 /*****************************************************************
3 | Neptune - WinRT Utilities
5 | (c) 2001-2012 Gilles Boccon-Gibod
6 | Author: Gilles Boccon-Gibod (bok@bok.net)
8 ****************************************************************/
10 /*----------------------------------------------------------------------
12 +---------------------------------------------------------------------*/
13 #include "NptWinRtPch.h"
14 #include "NptWinRtUtils.h"
16 /*----------------------------------------------------------------------
17 | NPT_WinRtUtils::A2WHelper
18 +---------------------------------------------------------------------*/
20 NPT_WinRtUtils::A2WHelper(LPWSTR lpw
, LPCSTR lpa
, int nChars
, UINT acp
)
26 if (lpw
== NULL
|| lpa
== NULL
) return NULL
;
29 ret
= MultiByteToWideChar(acp
, 0, lpa
, -1, lpw
, nChars
);
37 /*----------------------------------------------------------------------
38 | NPT_WinRtUtils::W2AHelper
39 +---------------------------------------------------------------------*/
41 NPT_WinRtUtils::W2AHelper(LPSTR lpa
, LPCWSTR lpw
, int nChars
, UINT acp
)
47 if (lpa
== NULL
|| lpw
== NULL
) return NULL
;
50 ret
= WideCharToMultiByte(acp
, 0, lpw
, -1, lpa
, nChars
, NULL
, NULL
);
52 int error
= GetLastError();
59 /*----------------------------------------------------------------------
60 | NPT_WinRtUtils::LStrLenW
61 +---------------------------------------------------------------------*/
63 NPT_WinRtUtils::LStrLenW(STRSAFE_LPCWSTR lpw
)
66 HRESULT result
= StringCchLengthW(lpw
, STRSAFE_MAX_CCH
, &len
);