Commit d84693cc authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

oleaut32: Calling SetLcid with LOCALE_NEUTRAL is a special case which sets the…

oleaut32: Calling SetLcid with LOCALE_NEUTRAL is a special case which sets the first header lcid to US English and the second one to 0.
parent 8fb7fdd0
......@@ -1378,6 +1378,58 @@ static const char *create_test_typelib(void)
return filename;
}
static void test_create_typelib_lcid(LCID lcid)
{
char filename[MAX_PATH];
WCHAR name[MAX_PATH];
HRESULT hr;
ICreateTypeLib2 *tl;
HANDLE file;
DWORD msft_header[5]; /* five is enough for now */
DWORD read;
GetTempFileNameA( ".", "tlb", 0, filename );
MultiByteToWideChar(CP_ACP, 0, filename, -1, name, MAX_PATH);
hr = CreateTypeLib2(SYS_WIN32, name, &tl);
ok(hr == S_OK, "got %08x\n", hr);
hr = ICreateTypeLib2_SetLcid(tl, lcid);
ok(hr == S_OK, "got %08x\n", hr);
hr = ICreateTypeLib2_SaveAllChanges(tl);
ICreateTypeLib2_Release(tl);
file = CreateFileA( filename, GENERIC_READ, 0, NULL, OPEN_EXISTING, 0, 0 );
ok( file != INVALID_HANDLE_VALUE, "file creation failed\n" );
ReadFile( file, msft_header, sizeof(msft_header), &read, NULL );
ok(read == sizeof(msft_header), "read %d\n", read);
CloseHandle( file );
ok(msft_header[0] == 0x5446534d, "got %08x\n", msft_header[0]);
ok(msft_header[1] == 0x00010002, "got %08x\n", msft_header[1]);
ok(msft_header[2] == 0xffffffff, "got %08x\n", msft_header[2]);
ok(msft_header[3] == (lcid ? lcid : 0x409), "got %08x (lcid %08x)\n", msft_header[3], lcid);
ok(msft_header[4] == lcid, "got %08x (lcid %08x)\n", msft_header[4], lcid);
DeleteFileA(filename);
}
static void test_create_typelibs(void)
{
test_create_typelib_lcid(LOCALE_SYSTEM_DEFAULT);
test_create_typelib_lcid(LOCALE_USER_DEFAULT);
test_create_typelib_lcid(LOCALE_NEUTRAL);
test_create_typelib_lcid(0x009);
test_create_typelib_lcid(0x409);
test_create_typelib_lcid(0x809);
test_create_typelib_lcid(0x007);
test_create_typelib_lcid(0x407);
}
START_TEST(typelib)
{
const char *filename;
......@@ -1394,4 +1446,7 @@ START_TEST(typelib)
test_dump_typelib( filename );
DeleteFile( filename );
}
test_create_typelibs();
}
......@@ -3204,7 +3204,10 @@ static HRESULT WINAPI ICreateTypeLib2_fnSetHelpContext(ICreateTypeLib2 * iface,
/******************************************************************************
* ICreateTypeLib2_SetLcid {OLEAUT32}
*
* See ICreateTypeLib_SetLcid.
* Sets both the lcid and lcid2 members in the header to lcid.
*
* As a special case if lcid == LOCALE_NEUTRAL (0), then the first header lcid
* is set to US English while the second one is set to 0.
*/
static HRESULT WINAPI ICreateTypeLib2_fnSetLcid(ICreateTypeLib2 * iface, LCID lcid)
{
......@@ -3214,6 +3217,8 @@ static HRESULT WINAPI ICreateTypeLib2_fnSetLcid(ICreateTypeLib2 * iface, LCID lc
This->typelib_header.lcid = This->typelib_header.lcid2 = lcid;
if(lcid == LOCALE_NEUTRAL) This->typelib_header.lcid = MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US);
return S_OK;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment