Huw Davies : 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 .
Alexandre Julliard
julliard at winehq.org
Thu Jun 11 10:54:25 CDT 2009
Module: wine
Branch: master
Commit: d84693cc291db686cdcd2e2e3d9b83991f2de4b8
URL: http://source.winehq.org/git/wine.git/?a=commit;h=d84693cc291db686cdcd2e2e3d9b83991f2de4b8
Author: Huw Davies <huw at codeweavers.com>
Date: Wed Jun 10 16:45:29 2009 +0100
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.
---
dlls/oleaut32/tests/typelib.c | 55 +++++++++++++++++++++++++++++++++++++++++
dlls/oleaut32/typelib2.c | 7 ++++-
2 files changed, 61 insertions(+), 1 deletions(-)
diff --git a/dlls/oleaut32/tests/typelib.c b/dlls/oleaut32/tests/typelib.c
index 6a07a49..2748ed0 100644
--- a/dlls/oleaut32/tests/typelib.c
+++ b/dlls/oleaut32/tests/typelib.c
@@ -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();
+
}
diff --git a/dlls/oleaut32/typelib2.c b/dlls/oleaut32/typelib2.c
index 3d092e5..b011342 100644
--- a/dlls/oleaut32/typelib2.c
+++ b/dlls/oleaut32/typelib2.c
@@ -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;
}
More information about the wine-cvs
mailing list