@@ -33,22 +33,11 @@ typedef BOOL (*PFN_PAL_GetUnwindInfoSize)(
3333 PULONG64 ehFrameStart,
3434 PULONG64 ehFrameSize);
3535
36- typedef int (*PFN_WideCharToMultiByte)(
37- IN UINT codePage,
38- IN DWORD dwFlags,
39- IN LPCWSTR lpWideCharStr,
40- IN int cchWideChar,
41- OUT LPSTR lpMultiByteStr,
42- IN int cbMultiByte,
43- IN LPCSTR lpDefaultChar,
44- OUT LPBOOL lpUsedDefaultChar);
45-
4636bool g_initialized = false ;
4737PFN_PAL_InitializeDLL g_PAL_InitializeDLL = nullptr ;
4838PFN_PAL_TerminateEx g_PAL_TerminateEx = nullptr ;
4939PFN_PAL_VirtualUnwindOutOfProc g_PAL_VirtualUnwindOutOfProc = nullptr ;
5040PFN_PAL_GetUnwindInfoSize g_PAL_GetUnwindInfoSize = nullptr ;
51- PFN_WideCharToMultiByte g_WideCharToMultiByte = nullptr ;
5241
5342bool
5443InitializePAL ()
@@ -94,7 +83,6 @@ InitializePAL()
9483 g_PAL_TerminateEx = (PFN_PAL_TerminateEx)dlsym (dacModule, PAL_FUNCTION_PREFIX " PAL_TerminateEx" );
9584 g_PAL_VirtualUnwindOutOfProc = (PFN_PAL_VirtualUnwindOutOfProc)dlsym (dacModule, PAL_FUNCTION_PREFIX " PAL_VirtualUnwindOutOfProc" );
9685 g_PAL_GetUnwindInfoSize = (PFN_PAL_GetUnwindInfoSize)dlsym (dacModule, PAL_FUNCTION_PREFIX " PAL_GetUnwindInfoSize" );
97- g_WideCharToMultiByte = (PFN_WideCharToMultiByte)dlsym (dacModule, PAL_FUNCTION_PREFIX " WideCharToMultiByte" );
9886 return true ;
9987}
10088
@@ -214,25 +202,6 @@ PAL_GetUnwindInfoSize(
214202 return g_PAL_GetUnwindInfoSize (baseAddress, ehFrameHdrAddr, readMemoryCallback, ehFrameStart, ehFrameSize);
215203}
216204
217- int
218- PALAPI
219- WideCharToMultiByte (
220- IN UINT codePage,
221- IN DWORD dwFlags,
222- IN LPCWSTR lpWideCharStr,
223- IN int cchWideChar,
224- OUT LPSTR lpMultiByteStr,
225- IN int cbMultiByte,
226- IN LPCSTR lpDefaultChar,
227- OUT LPBOOL lpUsedDefaultChar)
228- {
229- if (!InitializePAL () || g_WideCharToMultiByte == nullptr )
230- {
231- return 0 ;
232- }
233- return g_WideCharToMultiByte (codePage, dwFlags, lpWideCharStr, cchWideChar, lpMultiByteStr, cbMultiByte, lpDefaultChar, lpUsedDefaultChar);
234- }
235-
236205//
237206// Used in pal\inc\rt\safecrt.h's _invalid_parameter handler
238207//
@@ -248,6 +217,14 @@ RaiseException(
248217 throw ;
249218}
250219
220+ size_t u16_strlen (const WCHAR* str)
221+ {
222+ size_t nChar = 0 ;
223+ while (*str++)
224+ nChar++;
225+ return nChar;
226+ }
227+
251228//
252229// Used by _ASSERTE
253230//
0 commit comments