Skip to content

Commit

Permalink
add GetLocaleInfoEx impl for winxp
Browse files Browse the repository at this point in the history
  • Loading branch information
ctapmex committed Jan 9, 2025
1 parent 159a956 commit d1ebbb0
Show file tree
Hide file tree
Showing 3 changed files with 672 additions and 0 deletions.
4 changes: 4 additions & 0 deletions external/far3sdk/vc_crt_fix.asm
Original file line number Diff line number Diff line change
Expand Up @@ -73,4 +73,8 @@ HOOK WakeAllConditionVariable , 4, :dword
HOOK TryAcquireSRWLockExclusive , 4, :dword
HOOK InitializeSRWLock , 4, :dword

; added to original file for FarColorer
HOOK GetLocaleInfoEx , 16, :dword, :dword, :dword, :dword
HOOK LocaleNameToLCID , 8, :dword, :dword

end
38 changes: 38 additions & 0 deletions external/far3sdk/vc_crt_fix_impl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -478,6 +478,44 @@ extern "C" BOOL WINAPI WRAPPER(FlsFree)(DWORD FlsIndex)
CREATE_AND_RETURN(modules::kernel32, FlsIndex);
}

// added to original file for FarColorer
#include "yy_thunks_impl.h"

extern "C" int WINAPI WRAPPER(GetLocaleInfoEx)(LPCWSTR lpLocaleName, LCTYPE LCType, LPWSTR lpLCData, int cchData)
{
struct implementation
{
static int WINAPI impl(LPCWSTR lpLocaleName, LCTYPE LCType, LPWSTR lpLCData, int cchData)
{
auto Locale = LocaleNameToLCID(lpLocaleName, 0);

if (Locale == 0)
{
SetLastError(ERROR_INVALID_PARAMETER);
return 0;
}
return GetLocaleInfoW(Locale, LCType, lpLCData, cchData);
}
};

CREATE_AND_RETURN(modules::kernel32, lpLocaleName, LCType, lpLCData, cchData);
}

extern "C" LCID WINAPI WRAPPER(LocaleNameToLCID)(LPCWSTR lpName, DWORD dwFlags)
{
struct implementation
{
static LCID WINAPI impl(LPCWSTR lpName, DWORD dwFlags)
{
return local_LocaleNameToLCID(lpName, dwFlags);
}
};

CREATE_AND_RETURN(modules::kernel32, lpName, dwFlags);
}

// end FarColorer

#undef CREATE_AND_RETURN
#undef WRAPPER

Expand Down
Loading

0 comments on commit d1ebbb0

Please sign in to comment.