ReactOS 0.4.16-dev-1946-g52006dd
GetLocaleInfo.c File Reference
#include "precomp.h"
Include dependency graph for GetLocaleInfo.c:

Go to the source code of this file.

Typedefs

typedef int WINAPI FN_GetLocaleInfoEx(_In_opt_ LPCWSTR lpLocaleName, _In_ LCTYPE LCType, _Out_opt_ LPWSTR lpLCData, _In_ int cchData)
 

Functions

static void Test_GetLocaleInfoEx (void)
 
 START_TEST (GetLocaleInfo)
 

Variables

FN_GetLocaleInfoExpGetLocaleInfoEx = NULL
 

Typedef Documentation

◆ FN_GetLocaleInfoEx

typedef int WINAPI FN_GetLocaleInfoEx(_In_opt_ LPCWSTR lpLocaleName, _In_ LCTYPE LCType, _Out_opt_ LPWSTR lpLCData, _In_ int cchData)

Definition at line 13 of file GetLocaleInfo.c.

Function Documentation

◆ START_TEST()

START_TEST ( GetLocaleInfo  )

Definition at line 87 of file GetLocaleInfo.c.

88{
90}
static void Test_GetLocaleInfoEx(void)
Definition: GetLocaleInfo.c:21

◆ Test_GetLocaleInfoEx()

static void Test_GetLocaleInfoEx ( void  )
static

Definition at line 21 of file GetLocaleInfo.c.

22{
23 HMODULE hmodKernel32;
24 int Ret;
25 ULONG CodePage;
26
27 hmodKernel32 = GetModuleHandleW(L"kernel32.dll");
28 pGetLocaleInfoEx = (FN_GetLocaleInfoEx*)GetProcAddress(hmodKernel32, "GetLocaleInfoEx");
30 {
31 hmodKernel32 = LoadLibraryW(L"kernel32_vista.dll");
32 pGetLocaleInfoEx = (FN_GetLocaleInfoEx*)GetProcAddress(hmodKernel32, "GetLocaleInfoEx");
34 {
35 skip("GetLocaleInfoEx not found in kernel32.dll\n");
36 return;
37 }
38 }
39
40 // Test normal usage
41 Ret = pGetLocaleInfoEx(L"en-US",
42 LOCALE_IDEFAULTANSICODEPAGE | LOCALE_RETURN_NUMBER,
43 (WCHAR*)&CodePage,
44 sizeof(DWORD) / sizeof(WCHAR));
45 ok_eq_int(Ret, 2);
46 ok_eq_long(CodePage, 1252ul);
47
48 // Test with neutral locale
49 Ret = pGetLocaleInfoEx(L"en",
50 LOCALE_IDEFAULTANSICODEPAGE | LOCALE_RETURN_NUMBER,
51 NULL,
52 0);
53 ok_eq_int(Ret, 2);
54 ok_eq_long(CodePage, 1252ul);
55
56 // Test with NULL locale name
57 CodePage = 0xdeadbeef;
59 LOCALE_IDEFAULTANSICODEPAGE | LOCALE_RETURN_NUMBER,
60 (WCHAR *)&CodePage,
61 sizeof(DWORD) /sizeof(WCHAR));
62 ok_eq_int(Ret, 2);
63 ok_eq_long(CodePage, 1252ul);
64
65 // Test with empty locale name
66 CodePage = 0xdeadbeef;
67 Ret = pGetLocaleInfoEx(L"",
68 LOCALE_IDEFAULTANSICODEPAGE | LOCALE_RETURN_NUMBER,
69 (WCHAR *)&CodePage,
70 sizeof(DWORD) /sizeof(WCHAR));
71 ok_eq_int(Ret, 2);
72 ok_eq_long(CodePage, 1252ul);
73
74 // Test with invalid locale name
75 CodePage = 0xdeadbeef;
76 Ret = pGetLocaleInfoEx(L"invalid",
77 LOCALE_IDEFAULTANSICODEPAGE | LOCALE_RETURN_NUMBER,
78 (WCHAR *)&CodePage,
79 sizeof(DWORD) /sizeof(WCHAR));
80 ok_eq_int(Ret, 0);
82 ok(CodePage == 0xdeadbeef, "CodePage should not have been modified: %lx\n", CodePage);
83
84}
int WINAPI FN_GetLocaleInfoEx(_In_opt_ LPCWSTR lpLocaleName, _In_ LCTYPE LCType, _Out_opt_ LPWSTR lpLCData, _In_ int cchData)
Definition: GetLocaleInfo.c:13
FN_GetLocaleInfoEx * pGetLocaleInfoEx
Definition: GetLocaleInfo.c:19
#define ok_eq_long(value, expected)
Definition: apitest.h:119
#define ok_eq_int(value, expected)
Definition: apitest.h:117
#define ok(value,...)
Definition: atltest.h:57
#define skip(...)
Definition: atltest.h:64
#define NULL
Definition: types.h:112
#define ERROR_INVALID_PARAMETER
Definition: compat.h:101
#define GetProcAddress(x, y)
Definition: compat.h:753
#define LoadLibraryW(x)
Definition: compat.h:747
HMODULE WINAPI GetModuleHandleW(LPCWSTR lpModuleName)
Definition: loader.c:838
#define L(x)
Definition: resources.c:13
unsigned long DWORD
Definition: ntddk_ex.h:95
uint32_t ULONG
Definition: typedefs.h:59
DWORD WINAPI GetLastError(void)
Definition: except.c:1042
#define LOCALE_IDEFAULTANSICODEPAGE
Definition: winnls.h:45
__wchar_t WCHAR
Definition: xmlstorage.h:180

Referenced by START_TEST().

Variable Documentation

◆ pGetLocaleInfoEx

FN_GetLocaleInfoEx* pGetLocaleInfoEx = NULL

Definition at line 19 of file GetLocaleInfo.c.

Referenced by Test_GetLocaleInfoEx(), and test_GetLocaleInfoEx().