From 2075353097725998dec863fd495b626e0768aa70 Mon Sep 17 00:00:00 2001 From: Jan Zerebecki Date: Thu, 18 Oct 2007 06:25:16 +0200 Subject: [PATCH] push dc8503392987ce7578c917abaade55b30873eb34 --- .gitignore | 1 + dlls/advapi32/security.c | 4 +- dlls/comctl32/listview.c | 5 +- dlls/crypt32/chain.c | 4 ++ dlls/crypt32/decode.c | 66 ++++++++++---------- dlls/imm32/imm32.spec | 2 +- dlls/kernel32/tests/process.c | 19 +++--- dlls/msi/table.c | 26 ++++---- dlls/msi/tests/install.c | 33 +++++++--- dlls/msimtf/Makefile.in | 2 + dlls/msimtf/main.c | 141 ++++++++++++++++++++++++++++++++++++++++-- dlls/msimtf/msimtf.inf | 26 ++++++++ dlls/msimtf/rsrc.rc | 20 ++++++ dlls/ntdll/reg.c | 2 +- dlls/ntdll/rtlstr.c | 3 + dlls/ntdll/tests/rtlstr.c | 48 +++++++++++++- dlls/ole32/ole32_main.c | 3 + dlls/oleaut32/tests/vartest.c | 21 ++++--- dlls/spoolss/spoolss.spec | 2 +- dlls/spoolss/spoolss_main.c | 9 +++ dlls/user32/winproc.c | 2 +- dlls/winex11.drv/winpos.c | 6 +- include/winbase.h | 2 +- programs/wordpad/De.rc | 1 + programs/wordpad/En.rc | 1 + programs/wordpad/Fr.rc | 1 + programs/wordpad/Hu.rc | 1 + programs/wordpad/Ko.rc | 1 + programs/wordpad/Nl.rc | 1 + programs/wordpad/No.rc | 1 + programs/wordpad/Pl.rc | 1 + programs/wordpad/Ru.rc | 1 + programs/wordpad/Tr.rc | 1 + programs/wordpad/resource.h | 1 + programs/wordpad/wordpad.c | 9 +++ 35 files changed, 382 insertions(+), 85 deletions(-) create mode 100644 dlls/msimtf/msimtf.inf create mode 100644 dlls/msimtf/rsrc.rc diff --git a/.gitignore b/.gitignore index 43ee7d82a12..95e66f5c050 100644 --- a/.gitignore +++ b/.gitignore @@ -266,6 +266,7 @@ dlls/msi/tests/*.ok dlls/msi/tests/msi_crosstest.exe dlls/msi/tests/testlist.c dlls/msimg32/libmsimg32.def +dlls/msimtf/rsrc.res dlls/msrle32/rsrc.res dlls/msvcrt/libmsvcrt.def dlls/msvcrt/rsrc.res diff --git a/dlls/advapi32/security.c b/dlls/advapi32/security.c index f95acf77b34..559291c6f27 100644 --- a/dlls/advapi32/security.c +++ b/dlls/advapi32/security.c @@ -552,8 +552,8 @@ AdjustTokenGroups( HANDLE TokenHandle, BOOL ResetToDefault, PTOKEN_GROUPS NewSta */ BOOL WINAPI AdjustTokenPrivileges( HANDLE TokenHandle, BOOL DisableAllPrivileges, - LPVOID NewState, DWORD BufferLength, - LPVOID PreviousState, LPDWORD ReturnLength ) + PTOKEN_PRIVILEGES NewState, DWORD BufferLength, + PTOKEN_PRIVILEGES PreviousState, LPDWORD ReturnLength ) { NTSTATUS status; diff --git a/dlls/comctl32/listview.c b/dlls/comctl32/listview.c index ab60d23a425..41f19b03603 100644 --- a/dlls/comctl32/listview.c +++ b/dlls/comctl32/listview.c @@ -5040,11 +5040,12 @@ static INT LISTVIEW_FindItemA(const LISTVIEW_INFO *infoPtr, INT nStart, BOOL hasText = lpFindInfo->flags & (LVFI_STRING | LVFI_PARTIAL); LVFINDINFOW fiw; INT res; + LPWSTR strW; memcpy(&fiw, lpFindInfo, sizeof(fiw)); - if (hasText) fiw.psz = textdupTtoW((LPCWSTR)lpFindInfo->psz, FALSE); + if (hasText) fiw.psz = strW = textdupTtoW((LPCWSTR)lpFindInfo->psz, FALSE); res = LISTVIEW_FindItemW(infoPtr, nStart, &fiw); - if (hasText) textfreeT((LPWSTR)fiw.psz, FALSE); + if (hasText) textfreeT(strW, FALSE); return res; } diff --git a/dlls/crypt32/chain.c b/dlls/crypt32/chain.c index a64d9517b68..ff555bbc6c4 100644 --- a/dlls/crypt32/chain.c +++ b/dlls/crypt32/chain.c @@ -1447,6 +1447,8 @@ static BOOL WINAPI verify_base_policy(LPCSTR szPolicyOID, /* For a cyclic chain, which element is a cycle isn't meaningful */ pPolicyStatus->lElementIndex = -1; } + else + pPolicyStatus->dwError = NO_ERROR; return TRUE; } @@ -1520,6 +1522,8 @@ static BOOL WINAPI verify_basic_constraints_policy(LPCSTR szPolicyOID, CERT_TRUST_INVALID_BASIC_CONSTRAINTS, &pPolicyStatus->lChainIndex, &pPolicyStatus->lElementIndex); } + else + pPolicyStatus->dwError = NO_ERROR; return TRUE; } diff --git a/dlls/crypt32/decode.c b/dlls/crypt32/decode.c index 17e4db692de..62972514c37 100644 --- a/dlls/crypt32/decode.c +++ b/dlls/crypt32/decode.c @@ -4362,101 +4362,101 @@ static CryptDecodeObjectExFunc CRYPT_GetBuiltinDecoder(DWORD dwCertEncodingType, { switch (LOWORD(lpszStructType)) { - case (WORD)X509_CERT: + case LOWORD(X509_CERT): decodeFunc = CRYPT_AsnDecodeCertSignedContent; break; - case (WORD)X509_CERT_TO_BE_SIGNED: + case LOWORD(X509_CERT_TO_BE_SIGNED): decodeFunc = CRYPT_AsnDecodeCert; break; - case (WORD)X509_CERT_CRL_TO_BE_SIGNED: + case LOWORD(X509_CERT_CRL_TO_BE_SIGNED): decodeFunc = CRYPT_AsnDecodeCRL; break; - case (WORD)X509_EXTENSIONS: + case LOWORD(X509_EXTENSIONS): decodeFunc = CRYPT_AsnDecodeExtensions; break; - case (WORD)X509_NAME_VALUE: + case LOWORD(X509_NAME_VALUE): decodeFunc = CRYPT_AsnDecodeNameValue; break; - case (WORD)X509_NAME: + case LOWORD(X509_NAME): decodeFunc = CRYPT_AsnDecodeName; break; - case (WORD)X509_PUBLIC_KEY_INFO: + case LOWORD(X509_PUBLIC_KEY_INFO): decodeFunc = CRYPT_AsnDecodePubKeyInfo; break; - case (WORD)X509_AUTHORITY_KEY_ID: + case LOWORD(X509_AUTHORITY_KEY_ID): decodeFunc = CRYPT_AsnDecodeAuthorityKeyId; break; - case (WORD)X509_ALTERNATE_NAME: + case LOWORD(X509_ALTERNATE_NAME): decodeFunc = CRYPT_AsnDecodeAltName; break; - case (WORD)X509_BASIC_CONSTRAINTS: + case LOWORD(X509_BASIC_CONSTRAINTS): decodeFunc = CRYPT_AsnDecodeBasicConstraints; break; - case (WORD)X509_BASIC_CONSTRAINTS2: + case LOWORD(X509_BASIC_CONSTRAINTS2): decodeFunc = CRYPT_AsnDecodeBasicConstraints2; break; - case (WORD)RSA_CSP_PUBLICKEYBLOB: + case LOWORD(RSA_CSP_PUBLICKEYBLOB): decodeFunc = CRYPT_AsnDecodeRsaPubKey; break; - case (WORD)X509_UNICODE_NAME: + case LOWORD(X509_UNICODE_NAME): decodeFunc = CRYPT_AsnDecodeUnicodeName; break; - case (WORD)PKCS_ATTRIBUTE: + case LOWORD(PKCS_ATTRIBUTE): decodeFunc = CRYPT_AsnDecodePKCSAttribute; break; - case (WORD)X509_UNICODE_NAME_VALUE: + case LOWORD(X509_UNICODE_NAME_VALUE): decodeFunc = CRYPT_AsnDecodeUnicodeNameValue; break; - case (WORD)X509_OCTET_STRING: + case LOWORD(X509_OCTET_STRING): decodeFunc = CRYPT_AsnDecodeOctets; break; - case (WORD)X509_BITS: - case (WORD)X509_KEY_USAGE: + case LOWORD(X509_BITS): + case LOWORD(X509_KEY_USAGE): decodeFunc = CRYPT_AsnDecodeBits; break; - case (WORD)X509_INTEGER: + case LOWORD(X509_INTEGER): decodeFunc = CRYPT_AsnDecodeInt; break; - case (WORD)X509_MULTI_BYTE_INTEGER: + case LOWORD(X509_MULTI_BYTE_INTEGER): decodeFunc = CRYPT_AsnDecodeInteger; break; - case (WORD)X509_MULTI_BYTE_UINT: + case LOWORD(X509_MULTI_BYTE_UINT): decodeFunc = CRYPT_AsnDecodeUnsignedInteger; break; - case (WORD)X509_ENUMERATED: + case LOWORD(X509_ENUMERATED): decodeFunc = CRYPT_AsnDecodeEnumerated; break; - case (WORD)X509_CHOICE_OF_TIME: + case LOWORD(X509_CHOICE_OF_TIME): decodeFunc = CRYPT_AsnDecodeChoiceOfTime; break; - case (WORD)X509_AUTHORITY_KEY_ID2: + case LOWORD(X509_AUTHORITY_KEY_ID2): decodeFunc = CRYPT_AsnDecodeAuthorityKeyId2; break; - case (WORD)PKCS_CONTENT_INFO: + case LOWORD(PKCS_CONTENT_INFO): decodeFunc = CRYPT_AsnDecodePKCSContentInfo; break; - case (WORD)X509_SEQUENCE_OF_ANY: + case LOWORD(X509_SEQUENCE_OF_ANY): decodeFunc = CRYPT_AsnDecodeSequenceOfAny; break; - case (WORD)PKCS_UTC_TIME: + case LOWORD(PKCS_UTC_TIME): decodeFunc = CRYPT_AsnDecodeUtcTime; break; - case (WORD)X509_CRL_DIST_POINTS: + case LOWORD(X509_CRL_DIST_POINTS): decodeFunc = CRYPT_AsnDecodeCRLDistPoints; break; - case (WORD)X509_ENHANCED_KEY_USAGE: + case LOWORD(X509_ENHANCED_KEY_USAGE): decodeFunc = CRYPT_AsnDecodeEnhancedKeyUsage; break; - case (WORD)PKCS_ATTRIBUTES: + case LOWORD(PKCS_ATTRIBUTES): decodeFunc = CRYPT_AsnDecodePKCSAttributes; break; - case (WORD)X509_ISSUING_DIST_POINT: + case LOWORD(X509_ISSUING_DIST_POINT): decodeFunc = CRYPT_AsnDecodeIssuingDistPoint; break; - case (WORD)X509_NAME_CONSTRAINTS: + case LOWORD(X509_NAME_CONSTRAINTS): decodeFunc = CRYPT_AsnDecodeNameConstraints; break; - case (WORD)PKCS7_SIGNER_INFO: + case LOWORD(PKCS7_SIGNER_INFO): decodeFunc = CRYPT_AsnDecodePKCSSignerInfo; break; } diff --git a/dlls/imm32/imm32.spec b/dlls/imm32/imm32.spec index 5c10a5ff693..ee2ca0af2b9 100644 --- a/dlls/imm32/imm32.spec +++ b/dlls/imm32/imm32.spec @@ -10,7 +10,7 @@ @ stdcall ImmDestroyIMCC(long) @ stub ImmDestroySoftKeyboard @ stdcall ImmDisableIME(long) -@ stub ImmDisableIme +@ stdcall ImmDisableIme(long) ImmDisableIME @ stub ImmEnumInputContext @ stdcall ImmEnumRegisterWordA(long ptr str long str ptr) @ stdcall ImmEnumRegisterWordW(long ptr wstr long wstr ptr) diff --git a/dlls/kernel32/tests/process.c b/dlls/kernel32/tests/process.c index a5f240af0cc..43d6ac0bde8 100644 --- a/dlls/kernel32/tests/process.c +++ b/dlls/kernel32/tests/process.c @@ -424,17 +424,16 @@ static int strCmp(const char* s1, const char* s2, BOOL sensitive) return (sensitive) ? strcmp(s1, s2) : wtstrcasecmp(s1, s2); } -#define okChildString(sect, key, expect) \ - do { \ - char* result = getChildString((sect), (key)); \ - ok(strCmp(result, expect, 1) == 0, "%s:%s expected '%s', got '%s'\n", (sect), (key), (expect)?(expect):"(null)", result); \ - } while (0) +static void ok_child_string( int line, const char *sect, const char *key, + const char *expect, int sensitive ) +{ + char* result = getChildString( sect, key ); + ok_(__FILE__, line)( strCmp(result, expect, sensitive) == 0, "%s:%s expected '%s', got '%s'\n", + sect, key, expect ? expect : "(null)", result ); +} -#define okChildIString(sect, key, expect) \ - do { \ - char* result = getChildString(sect, key); \ - ok(strCmp(result, expect, 0) == 0, "%s:%s expected '%s', got '%s'\n", sect, key, expect, result); \ - } while (0) +#define okChildString(sect, key, expect) ok_child_string(__LINE__, (sect), (key), (expect), 1 ) +#define okChildIString(sect, key, expect) ok_child_string(__LINE__, (sect), (key), (expect), 0 ) /* using !expect ensures that the test will fail if the sect/key isn't present * in result file diff --git a/dlls/msi/table.c b/dlls/msi/table.c index bf7d70552b9..c5850e3189a 100644 --- a/dlls/msi/table.c +++ b/dlls/msi/table.c @@ -53,9 +53,9 @@ typedef struct tagMSICOLUMNHASHENTRY typedef struct tagMSICOLUMNINFO { - LPCWSTR tablename; + LPWSTR tablename; UINT number; - LPCWSTR colname; + LPWSTR colname; UINT type; UINT offset; INT ref_count; @@ -87,12 +87,12 @@ static const WCHAR szStringPool[] = { '_','S','t','r','i','n','g','P','o','o','l',0 }; /* information for default tables */ -static const WCHAR szTables[] = { '_','T','a','b','l','e','s',0 }; -static const WCHAR szTable[] = { 'T','a','b','l','e',0 }; -static const WCHAR szName[] = { 'N','a','m','e',0 }; -static const WCHAR szColumns[] = { '_','C','o','l','u','m','n','s',0 }; -static const WCHAR szNumber[] = { 'N','u','m','b','e','r',0 }; -static const WCHAR szType[] = { 'T','y','p','e',0 }; +static WCHAR szTables[] = { '_','T','a','b','l','e','s',0 }; +static WCHAR szTable[] = { 'T','a','b','l','e',0 }; +static WCHAR szName[] = { 'N','a','m','e',0 }; +static WCHAR szColumns[] = { '_','C','o','l','u','m','n','s',0 }; +static WCHAR szNumber[] = { 'N','u','m','b','e','r',0 }; +static WCHAR szType[] = { 'T','y','p','e',0 }; /* These tables are written into (the .hash_table part). * Do not mark them const. @@ -933,8 +933,8 @@ static void msi_free_colinfo( MSICOLUMNINFO *colinfo, UINT count ) for( i=0; icol_count; msi_free( table->colinfo ); table_get_column_info( db, name, &table->colinfo, &table->col_count ); @@ -1054,7 +1055,8 @@ static void msi_update_table_columns( MSIDATABASE *db, LPCWSTR name ) for ( n = 0; n < table->row_count; n++ ) { table->data[n] = msi_realloc( table->data[n], size ); - table->data[n][offset] = (BYTE)MSI_NULL_INTEGER; + if (old_count < table->col_count) + memset( &table->data[n][offset], 0, size - offset ); } } diff --git a/dlls/msi/tests/install.c b/dlls/msi/tests/install.c index f3de7e7d608..b1698862247 100644 --- a/dlls/msi/tests/install.c +++ b/dlls/msi/tests/install.c @@ -40,8 +40,9 @@ static UINT (WINAPI *pMsiSourceListGetInfoA) static const char *msifile = "msitest.msi"; static const char *msifile2 = "winetest2.msi"; static const char *mstfile = "winetest.mst"; -CHAR CURR_DIR[MAX_PATH]; -CHAR PROG_FILES_DIR[MAX_PATH]; +static CHAR CURR_DIR[MAX_PATH]; +static CHAR PROG_FILES_DIR[MAX_PATH]; +static CHAR COMMON_FILES_DIR[MAX_PATH]; /* msi database data */ @@ -995,10 +996,10 @@ static void create_cab_file(const CHAR *name, DWORD max_size, const CHAR *files) ok(res, "Failed to destroy the cabinet\n"); } -static BOOL get_program_files_dir(LPSTR buf) +static BOOL get_program_files_dir(LPSTR buf, LPSTR buf2) { HKEY hkey; - DWORD type = REG_EXPAND_SZ, size; + DWORD type, size; if (RegOpenKey(HKEY_LOCAL_MACHINE, "Software\\Microsoft\\Windows\\CurrentVersion", &hkey)) @@ -1008,6 +1009,10 @@ static BOOL get_program_files_dir(LPSTR buf) if (RegQueryValueEx(hkey, "ProgramFilesDir", 0, &type, (LPBYTE)buf, &size)) return FALSE; + size = MAX_PATH; + if (RegQueryValueEx(hkey, "CommonFilesDir", 0, &type, (LPBYTE)buf2, &size)) + return FALSE; + RegCloseKey(hkey); return TRUE; } @@ -1064,6 +1069,20 @@ static BOOL delete_pf(const CHAR *rel_path, BOOL is_file) return RemoveDirectoryA(path); } +static BOOL delete_cf(const CHAR *rel_path, BOOL is_file) +{ + CHAR path[MAX_PATH]; + + lstrcpyA(path, COMMON_FILES_DIR); + lstrcatA(path, "\\"); + lstrcatA(path, rel_path); + + if (is_file) + return DeleteFileA(path); + else + return RemoveDirectoryA(path); +} + static void delete_test_files(void) { DeleteFileA("msitest.msi"); @@ -1620,8 +1639,8 @@ static void test_setdirproperty(void) r = MsiInstallProductA(msifile, NULL); ok(r == ERROR_SUCCESS, "Expected ERROR_SUCCESS, got %u\n", r); - ok(delete_pf("Common Files\\msitest\\maximus", TRUE), "File not installed\n"); - ok(delete_pf("Common Files\\msitest", FALSE), "File not installed\n"); + ok(delete_cf("msitest\\maximus", TRUE), "File not installed\n"); + ok(delete_cf("msitest", FALSE), "File not installed\n"); /* Delete the files in the temp (current) folder */ DeleteFile(msifile); @@ -2889,7 +2908,7 @@ START_TEST(install) if(len && (CURR_DIR[len - 1] == '\\')) CURR_DIR[len - 1] = 0; - get_program_files_dir(PROG_FILES_DIR); + get_program_files_dir(PROG_FILES_DIR, COMMON_FILES_DIR); test_MsiInstallProduct(); test_MsiSetComponentState(); diff --git a/dlls/msimtf/Makefile.in b/dlls/msimtf/Makefile.in index 2ec61687528..2de6646fcb8 100644 --- a/dlls/msimtf/Makefile.in +++ b/dlls/msimtf/Makefile.in @@ -4,8 +4,10 @@ SRCDIR = @srcdir@ VPATH = @srcdir@ MODULE = msimtf.dll IMPORTS = kernel32 +EXTRALIBS = -luuid C_SRCS = main.c +RC_SRCS = rsrc.rc @MAKE_DLL_RULES@ diff --git a/dlls/msimtf/main.c b/dlls/msimtf/main.c index 5659647186b..89034e73e30 100644 --- a/dlls/msimtf/main.c +++ b/dlls/msimtf/main.c @@ -19,14 +19,31 @@ #include "config.h" #include +#include + +#define COBJMACROS #include "windef.h" #include "winbase.h" +#include "wingdi.h" +#include "winuser.h" +#include "winreg.h" +#include "advpub.h" +#include "ole2.h" +#include "dimm.h" #include "wine/debug.h" WINE_DEFAULT_DEBUG_CHANNEL(msimtf); +static HINSTANCE msimtf_instance; + +static HRESULT CActiveIMM_Create(IUnknown *outer, REFIID riid, void **ppv) +{ + FIXME("(%p %s %p)\n", outer, debugstr_guid(riid), ppv); + return E_NOINTERFACE; +} + /****************************************************************** * DllMain (msimtf.@) */ @@ -37,6 +54,7 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv) case DLL_WINE_PREATTACH: return FALSE; /* prefer native version */ case DLL_PROCESS_ATTACH: + msimtf_instance = hInstDLL; DisableThreadLibraryCalls(hInstDLL); break; case DLL_PROCESS_DETACH: @@ -45,11 +63,81 @@ BOOL WINAPI DllMain(HINSTANCE hInstDLL, DWORD fdwReason, LPVOID lpv) return TRUE; } +typedef struct { + const IClassFactoryVtbl *lpClassFactoryVtbl; + + HRESULT (*cf)(IUnknown*,REFIID,void**); +} ClassFactory; + +static HRESULT WINAPI ClassFactory_QueryInterface(IClassFactory *iface, + REFIID riid, void **ppv) +{ + *ppv = NULL; + + if(IsEqualGUID(&IID_IUnknown, riid)) { + TRACE("(IID_IUnknown %p)\n", ppv); + *ppv = iface; + }else if(IsEqualGUID(&IID_IClassFactory, riid)) { + TRACE("IID_IClassFactory %p)\n", ppv); + *ppv = iface; + } + + if(*ppv) { + IUnknown_AddRef((IUnknown*)*ppv); + return S_OK; + } + + FIXME("(%s %p)\n", debugstr_guid(riid), ppv); + return E_NOINTERFACE; +} + +static ULONG WINAPI ClassFactory_AddRef(IClassFactory *iface) +{ + return 2; +} + +static ULONG WINAPI ClassFactory_Release(IClassFactory *iface) +{ + return 1; +} + +static HRESULT WINAPI ClassFactory_CreateInstance(IClassFactory *iface, + IUnknown *pOuter, REFIID riid, void **ppv) +{ + ClassFactory *This = (ClassFactory*)iface; + return This->cf(pOuter, riid, ppv); +} + +static HRESULT WINAPI ClassFactory_LockServer(IClassFactory *iface, BOOL dolock) +{ + FIXME("(%d)\n", dolock); + return S_OK; +} + +static const IClassFactoryVtbl ClassFactoryVtbl = { + ClassFactory_QueryInterface, + ClassFactory_AddRef, + ClassFactory_Release, + ClassFactory_CreateInstance, + ClassFactory_LockServer +}; + /****************************************************************** * DllGetClassObject (msimtf.@) */ HRESULT WINAPI DllGetClassObject(REFCLSID rclsid, REFIID riid, LPVOID *ppv) { + if(IsEqualGUID(&CLSID_CActiveIMM, rclsid)) { + static ClassFactory cf = { + &ClassFactoryVtbl, + CActiveIMM_Create + }; + + TRACE("CLSID_CActiveIMM\n"); + + return IClassFactory_QueryInterface((IClassFactory*)&cf, riid, ppv); + } + FIXME("(%s %s %p)\n", debugstr_guid(rclsid), debugstr_guid(riid), ppv); return CLASS_E_CLASSNOTAVAILABLE; } @@ -63,13 +151,59 @@ HRESULT WINAPI DllCanUnloadNow(void) return S_FALSE; } +#define INF_SET_CLSID(clsid) \ + do \ + { \ + static CHAR name[] = "CLSID_" #clsid; \ + \ + pse[i].pszName = name; \ + clsids[i++] = &CLSID_ ## clsid; \ + } while (0) + +static HRESULT register_server(BOOL doregister) +{ + HRESULT hres; + HMODULE hAdvpack; + typeof(RegInstallA) *pRegInstall; + STRTABLEA strtable; + STRENTRYA pse[1]; + static CLSID const *clsids[34]; + int i = 0; + + static const WCHAR wszAdvpack[] = {'a','d','v','p','a','c','k','.','d','l','l',0}; + + INF_SET_CLSID(CActiveIMM); + + for(i = 0; i < sizeof(pse)/sizeof(pse[0]); i++) { + pse[i].pszValue = HeapAlloc(GetProcessHeap(), 0, 39); + sprintf(pse[i].pszValue, "{%08X-%04X-%04X-%02X%02X-%02X%02X%02X%02X%02X%02X}", + clsids[i]->Data1, clsids[i]->Data2, clsids[i]->Data3, clsids[i]->Data4[0], + clsids[i]->Data4[1], clsids[i]->Data4[2], clsids[i]->Data4[3], clsids[i]->Data4[4], + clsids[i]->Data4[5], clsids[i]->Data4[6], clsids[i]->Data4[7]); + } + + strtable.cEntries = sizeof(pse)/sizeof(pse[0]); + strtable.pse = pse; + + hAdvpack = LoadLibraryW(wszAdvpack); + pRegInstall = (typeof(RegInstallA)*)GetProcAddress(hAdvpack, "RegInstall"); + + hres = pRegInstall(msimtf_instance, doregister ? "RegisterDll" : "UnregisterDll", &strtable); + + for(i=0; i < sizeof(pse)/sizeof(pse[0]); i++) + HeapFree(GetProcessHeap(), 0, pse[i].pszValue); + + return hres; +} + +#undef INF_SET_CLSID + /*********************************************************************** * DllRegisterServer (msimtf.@) */ HRESULT WINAPI DllRegisterServer(void) { - FIXME("()\n"); - return S_OK; + return register_server(TRUE); } /*********************************************************************** @@ -77,6 +211,5 @@ HRESULT WINAPI DllRegisterServer(void) */ HRESULT WINAPI DllUnregisterServer(void) { - FIXME("()\n"); - return S_OK; + return register_server(FALSE); } diff --git a/dlls/msimtf/msimtf.inf b/dlls/msimtf/msimtf.inf new file mode 100644 index 00000000000..d7e6b73c38b --- /dev/null +++ b/dlls/msimtf/msimtf.inf @@ -0,0 +1,26 @@ +[version] +Signature="$CHICAGO$" + + +[RegisterDll] +AddReg=Classes.Reg + + +[UnregisterDll] +DelReg=Classes.Reg + + +[Classes.Reg] +HKCR,"CLSID\%CLSID_CActiveIMM%",,,"CActiveIMMApp" +HKCR,"CLSID\%CLSID_CActiveIMM%\InProcServer32",,,"msimtf.dll" +HKCR,"CLSID\%CLSID_CActiveIMM%\InProcServer32","ThreadingModel",,"Apartment" +HKCR,"CLSID\%CLSID_CActiveIMMAppEx_Trident",,,"CActiveIMMAppEx_Trident" +HKCR,"CLSID\%CLSID_CActiveIMMAppEx_Trident\InProcServer32",,,"msimtf.dll" +HKCR,"CLSID\%CLSID_CActiveIMMAppEx_Trident\InProcServer32","ThreadingModel",,"Apartment" +HKCR,"CLSID\%CLSID_CActiveIMMAppEx",,,"CActiveIMMAppEx" +HKCR,"CLSID\%CLSID_CActiveIMMAppEx\InProcServer32",,,"msimtf.dll" +HKCR,"CLSID\%CLSID_CActiveIMMAppEx\InProcServer32","ThreadingModel",,"Apartment" + +[Strings] +CLSID_CActiveIMMAppEx_Trident={50D5107A-D278-4871-8989-F4CEAAF59CFC} +CLSID_CActiveIMMAppEx="{C1EE01F2-B3B6-4A6A-9DDD-E988C088EC82}" diff --git a/dlls/msimtf/rsrc.rc b/dlls/msimtf/rsrc.rc new file mode 100644 index 00000000000..361feee27cc --- /dev/null +++ b/dlls/msimtf/rsrc.rc @@ -0,0 +1,20 @@ +/* + * Copyright 2007 Jacek Caban for CodeWeavers + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2.1 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA + */ + +/* @makedep: msimtf.inf */ +REGINST REGINST msimtf.inf diff --git a/dlls/ntdll/reg.c b/dlls/ntdll/reg.c index d03925f3502..85297e3a376 100644 --- a/dlls/ntdll/reg.c +++ b/dlls/ntdll/reg.c @@ -1031,7 +1031,7 @@ static NTSTATUS RTL_GetKeyHandle(ULONG RelativeTo, PCWSTR Path, PHANDLE handle) static const WCHAR empty[] = {0}; static const WCHAR control[] = {'\\','R','e','g','i','s','t','r','y','\\','M','a','c','h','i','n','e', - '\\','S','y','s','t','e','m','\\','C','u','r','r','e','n','t',' ','C','o','n','t','r','o','l','S','e','t','\\', + '\\','S','y','s','t','e','m','\\','C','u','r','r','e','n','t','C','o','n','t','r','o','l','S','e','t','\\', 'C','o','n','t','r','o','l','\\',0}; static const WCHAR devicemap[] = {'\\','R','e','g','i','s','t','r','y','\\','M','a','c','h','i','n','e','\\', diff --git a/dlls/ntdll/rtlstr.c b/dlls/ntdll/rtlstr.c index 1b13f127156..ecd8523365c 100644 --- a/dlls/ntdll/rtlstr.c +++ b/dlls/ntdll/rtlstr.c @@ -1610,6 +1610,9 @@ BOOLEAN WINAPI RtlIsTextUnicode( LPCVOID buf, INT len, INT *pf ) /* Check for an odd length ... pass if even. */ if (len & 1) out_flags |= IS_TEXT_UNICODE_ODD_LENGTH; + if (((char *)buf)[len - 1] == 0) + len--; /* Windows seems to do something like that to avoid e.g. false IS_TEXT_UNICODE_NULL_BYTES */ + len /= sizeof(WCHAR); /* Windows only checks the first 256 characters */ if (len > 256) len = 256; diff --git a/dlls/ntdll/tests/rtlstr.c b/dlls/ntdll/tests/rtlstr.c index 3d85aff135f..e40bd53e03c 100644 --- a/dlls/ntdll/tests/rtlstr.c +++ b/dlls/ntdll/tests/rtlstr.c @@ -62,6 +62,7 @@ static NTSTATUS (WINAPI *pRtlUpperString)(STRING *, const STRING *); static NTSTATUS (WINAPI *pRtlValidateUnicodeString)(long, UNICODE_STRING *); static NTSTATUS (WINAPI *pRtlGUIDFromString)(const UNICODE_STRING*,GUID*); static NTSTATUS (WINAPI *pRtlStringFromGUID)(const GUID*, UNICODE_STRING*); +static BOOLEAN (WINAPI *pRtlIsTextUnicode)(LPVOID, INT, INT *); /*static VOID (WINAPI *pRtlFreeOemString)(PSTRING);*/ /*static VOID (WINAPI *pRtlFreeUnicodeString)(PUNICODE_STRING);*/ @@ -82,7 +83,6 @@ static NTSTATUS (WINAPI *pRtlStringFromGUID)(const GUID*, UNICODE_STRING*); /*static NTSTATUS (WINAPI *pRtlUpcaseUnicodeToOemN)(LPSTR, DWORD, LPDWORD, LPCWSTR, DWORD);*/ /*static UINT (WINAPI *pRtlOemToUnicodeSize)(const STRING *);*/ /*static DWORD (WINAPI *pRtlAnsiStringToUnicodeSize)(const STRING *);*/ -/*static DWORD (WINAPI *pRtlIsTextUnicode)(LPVOID, DWORD, DWORD *);*/ static WCHAR* AtoW( const char* p ) @@ -130,6 +130,7 @@ static void InitFunctionPtrs(void) pRtlValidateUnicodeString = (void *)GetProcAddress(hntdll, "RtlValidateUnicodeString"); pRtlGUIDFromString = (void *)GetProcAddress(hntdll, "RtlGUIDFromString"); pRtlStringFromGUID = (void *)GetProcAddress(hntdll, "RtlStringFromGUID"); + pRtlIsTextUnicode = (void *)GetProcAddress(hntdll, "RtlIsTextUnicode"); } } @@ -1668,6 +1669,49 @@ static void test_RtlIntegerToChar(void) int2str[0].value, int2str[0].base, int2str[0].MaximumLength, result, STATUS_ACCESS_VIOLATION); } +static void test_RtlIsTextUnicode(void) +{ + char ascii[] = "A simple string"; + WCHAR unicode[] = {'A',' ','U','n','i','c','o','d','e',' ','s','t','r','i','n','g',0}; + WCHAR *be_unicode; + int flags; + int i; + + ok(!pRtlIsTextUnicode(ascii, sizeof(ascii), NULL), "ASCII text detected as Unicode\n"); + + ok(pRtlIsTextUnicode(unicode, sizeof(unicode), NULL), "Text should be Unicode\n"); + ok(!pRtlIsTextUnicode(unicode, sizeof(unicode) - 1, NULL), "Text should be Unicode\n"); + + flags = IS_TEXT_UNICODE_UNICODE_MASK; + ok(pRtlIsTextUnicode(unicode, sizeof(unicode), &flags), "Text should not pass a Unicode\n"); + todo_wine ok(flags == 0x6, "Expected flags 0x6, obtained %d\n", flags); + + flags = IS_TEXT_UNICODE_REVERSE_MASK; + ok(!pRtlIsTextUnicode(unicode, sizeof(unicode), &flags), "Text should not pass reverse Unicode tests\n"); + ok(flags == 0, "Expected flags 0, obtained %d\n", flags); + + flags = IS_TEXT_UNICODE_ODD_LENGTH; + ok(!pRtlIsTextUnicode(unicode, sizeof(unicode) - 1, &flags), "Odd length test should have passed\n"); + ok(flags == IS_TEXT_UNICODE_ODD_LENGTH, "Expected flags 0x200, obtained %d\n", flags); + + be_unicode = HeapAlloc(GetProcessHeap(), 0, sizeof(unicode) + sizeof(WCHAR)); + be_unicode[0] = 0xfffe; + for (i = 0; i < sizeof(unicode)/sizeof(unicode[0]); i++) + { + be_unicode[i + 1] = (unicode[i] >> 8) | ((unicode[i] & 0xff) << 8); + } + ok(!pRtlIsTextUnicode(be_unicode, sizeof(unicode) + 2, NULL), "Reverse endian should not be Unicode\n"); + todo_wine ok(!pRtlIsTextUnicode(&be_unicode[1], sizeof(unicode), NULL), "Reverse endian should not be Unicode\n"); + + flags = IS_TEXT_UNICODE_REVERSE_MASK; + ok(!pRtlIsTextUnicode(&be_unicode[1], sizeof(unicode), &flags), "Reverse endian should be Unicode\n"); + todo_wine ok(flags == 0x70, "Expected flags 0x70, obtained %x\n", flags); + + flags = IS_TEXT_UNICODE_REVERSE_MASK; + ok(!pRtlIsTextUnicode(be_unicode, sizeof(unicode) + 2, &flags), "Reverse endian should be Unicode\n"); + todo_wine ok(flags == 0xc0, "Expected flags 0x70, obtained %x\n", flags); +} + static const WCHAR szGuid[] = { '{','0','1','0','2','0','3','0','4','-', '0','5','0','6','-' ,'0','7','0','8','-','0','9','0','A','-', '0','B','0','C','0','D','0','E','0','F','0','A','}','\0' }; @@ -1740,6 +1784,8 @@ START_TEST(rtlstr) test_RtlGUIDFromString(); if (pRtlStringFromGUID) test_RtlStringFromGUID(); + if (pRtlIsTextUnicode) + test_RtlIsTextUnicode(); if(0) { test_RtlUpcaseUnicodeChar(); diff --git a/dlls/ole32/ole32_main.c b/dlls/ole32/ole32_main.c index 1d58d557da8..89878b7323f 100644 --- a/dlls/ole32/ole32_main.c +++ b/dlls/ole32/ole32_main.c @@ -18,6 +18,9 @@ * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA */ +#include "config.h" +#include "wine/port.h" + #include #include diff --git a/dlls/oleaut32/tests/vartest.c b/dlls/oleaut32/tests/vartest.c index 511fe4767bd..b409dd493f2 100644 --- a/dlls/oleaut32/tests/vartest.c +++ b/dlls/oleaut32/tests/vartest.c @@ -1777,7 +1777,7 @@ static HRESULT (WINAPI *pVarAbs)(LPVARIANT,LPVARIANT); static void test_VarAbs(void) { - static const WCHAR szNum[] = {'-','1','.','1','\0' }; + static WCHAR szNum[] = {'-','1','.','1','\0' }; char buff[8]; HRESULT hres; VARIANT v, vDst, exp; @@ -1851,10 +1851,12 @@ static void test_VarAbs(void) ok(hres == S_OK && V_VT(&vDst) == VT_CY && V_CY(&vDst).int64 == 10000, "VarAbs(CY): expected 0x0 got 0x%X\n", hres); GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, buff, sizeof(buff)/sizeof(char)); - if (buff[0] != '.' || buff[1]) + if (buff[1]) { trace("Skipping VarAbs(BSTR) as decimal separator is '%s'\n", buff); return; + } else { + szNum[2] = buff[0]; } V_VT(&v) = VT_BSTR; V_BSTR(&v) = (BSTR)szNum; @@ -3102,8 +3104,8 @@ static void test_Round( int line, VARIANT *arg, int deci, VARIANT *expected ) static void test_VarRound(void) { - static const WCHAR szNumMin[] = {'-','1','.','4','5','\0' }; - static const WCHAR szNum[] = {'1','.','4','5','\0' }; + static WCHAR szNumMin[] = {'-','1','.','4','5','\0' }; + static WCHAR szNum[] = {'1','.','4','5','\0' }; HRESULT hres; VARIANT v, exp, vDst; CY *pcy = &V_CY(&v); @@ -3139,13 +3141,16 @@ static void test_VarRound(void) * compare the first few digits. */ VARROUND(DATE,1.451,1,DATE,1.5); VARROUND(DATE,-1.45,1,DATE,-1.4); + + /* replace the decimal seperator */ GetLocaleInfoA(LOCALE_USER_DEFAULT, LOCALE_SDECIMAL, buff, sizeof(buff)/sizeof(char)); - if (buff[0] != '.' || buff[1]) - skip("Skipping VarRound(BSTR) as decimal separator is '%s'\n", buff); - else - { + if (!buff[1]) { + szNumMin[2] = buff[0]; + szNum[1] = buff[0]; VARROUND(BSTR,(BSTR)szNumMin,1,R8,-1.40); if (0) { VARROUND(BSTR,(BSTR)szNum,1,R8,1.50); } + } else { + skip("Skipping VarRound(BSTR) as decimal separator is '%s'\n", buff); } VARROUND(R4,1.23456f,0,R4,1.0f); diff --git a/dlls/spoolss/spoolss.spec b/dlls/spoolss/spoolss.spec index b7fc0bd455f..2f893d51427 100644 --- a/dlls/spoolss/spoolss.spec +++ b/dlls/spoolss/spoolss.spec @@ -122,7 +122,7 @@ @ stub SplDriverUnloadComplete @ stub SplGetSpoolFileInfo @ stdcall SplInitializeWinSpoolDrv(ptr) -@ stub SplIsUpgrade +@ stdcall SplIsUpgrade() @ stub SplProcessPnPEvent @ stub SplReadPrinter @ stub SplRegisterForDeviceEvents diff --git a/dlls/spoolss/spoolss_main.c b/dlls/spoolss/spoolss_main.c index 52365c7bacf..9a9ec4893e6 100644 --- a/dlls/spoolss/spoolss_main.c +++ b/dlls/spoolss/spoolss_main.c @@ -209,3 +209,12 @@ BOOL WINAPI SplInitializeWinSpoolDrv(LPVOID * table) return TRUE; } + +/****************************************************************** + * SplIsUpgrade [SPOOLSS.@] + */ +BOOL WINAPI SplIsUpgrade(void) +{ + FIXME("() stub\n"); + return FALSE; +} diff --git a/dlls/user32/winproc.c b/dlls/user32/winproc.c index e58d1f0b344..51936afb71d 100644 --- a/dlls/user32/winproc.c +++ b/dlls/user32/winproc.c @@ -524,7 +524,7 @@ static LRESULT call_window_proc16( HWND16 hwnd, UINT16 msg, WPARAM16 wParam, LPA if (!(context.Eax = GetWindowWord( HWND_32(hwnd), GWLP_HINSTANCE ))) context.Eax = context.SegDs; context.SegCs = SELECTOROF(proc); context.Eip = OFFSETOF(proc); - context.Ebp = OFFSETOF(NtCurrentTeb()->WOW32Reserved) + (WORD)&((STACK16FRAME*)0)->bp; + context.Ebp = OFFSETOF(NtCurrentTeb()->WOW32Reserved) + FIELD_OFFSET(STACK16FRAME, bp); if (lParam) { diff --git a/dlls/winex11.drv/winpos.c b/dlls/winex11.drv/winpos.c index 71c05f522fd..02e61511494 100644 --- a/dlls/winex11.drv/winpos.c +++ b/dlls/winex11.drv/winpos.c @@ -1353,7 +1353,7 @@ void X11DRV_SysCommandSizeMove( HWND hwnd, WPARAM wParam ) { int dx = 0, dy = 0; - if (!GetMessageW( &msg, 0, WM_KEYFIRST, WM_MOUSELAST )) break; + if (!GetMessageW( &msg, 0, 0, 0 )) break; if (CallMsgFilterW( &msg, MSGF_SIZE )) continue; /* Exit on button-up, Return, or Esc */ @@ -1362,7 +1362,11 @@ void X11DRV_SysCommandSizeMove( HWND hwnd, WPARAM wParam ) ((msg.wParam == VK_RETURN) || (msg.wParam == VK_ESCAPE)))) break; if ((msg.message != WM_KEYDOWN) && (msg.message != WM_MOUSEMOVE)) + { + TranslateMessage( &msg ); + DispatchMessageW( &msg ); continue; /* We are not interested in other messages */ + } pt = msg.pt; diff --git a/include/winbase.h b/include/winbase.h index 2ad4314a5e6..2734ecbd7ac 100644 --- a/include/winbase.h +++ b/include/winbase.h @@ -1253,7 +1253,7 @@ BOOL WINAPI AccessCheckAndAuditAlarmA(LPCSTR,LPVOID,LPSTR,LPSTR,PSECURITY BOOL WINAPI AccessCheckAndAuditAlarmW(LPCWSTR,LPVOID,LPWSTR,LPWSTR,PSECURITY_DESCRIPTOR,DWORD,PGENERIC_MAPPING,BOOL,LPDWORD,LPBOOL,LPBOOL); #define AccessCheckAndAuditAlarm WINELIB_NAME_AW(AccessCheckAndAuditAlarm) BOOL WINAPI AccessCheckByType(PSECURITY_DESCRIPTOR,PSID,HANDLE,DWORD,POBJECT_TYPE_LIST,DWORD,PGENERIC_MAPPING,PPRIVILEGE_SET,LPDWORD,LPDWORD,LPBOOL); -BOOL WINAPI AdjustTokenPrivileges(HANDLE,BOOL,LPVOID,DWORD,LPVOID,LPDWORD); +BOOL WINAPI AdjustTokenPrivileges(HANDLE,BOOL,PTOKEN_PRIVILEGES,DWORD,PTOKEN_PRIVILEGES,LPDWORD); BOOL WINAPI AllocateAndInitializeSid(PSID_IDENTIFIER_AUTHORITY,BYTE,DWORD,DWORD,DWORD,DWORD,DWORD,DWORD,DWORD,DWORD,PSID *); BOOL WINAPI AllocateLocallyUniqueId(PLUID); BOOL WINAPI AreAllAccessesGranted(DWORD,DWORD); diff --git a/programs/wordpad/De.rc b/programs/wordpad/De.rc index 1b333fd4f4d..7175fa7b3bf 100644 --- a/programs/wordpad/De.rc +++ b/programs/wordpad/De.rc @@ -229,4 +229,5 @@ BEGIN "which will cause all formatting to be lost. " \ "Are you sure that you wish to do this?" STRING_INVALID_NUMBER, "Invalid number format" + STRING_OLE_STORAGE_NOT_SUPPORTED, "OLE storage documents are not supported" END diff --git a/programs/wordpad/En.rc b/programs/wordpad/En.rc index e0724fb7fcf..a14ec7f6611 100644 --- a/programs/wordpad/En.rc +++ b/programs/wordpad/En.rc @@ -229,4 +229,5 @@ BEGIN "which will cause all formatting to be lost. " \ "Are you sure that you wish to do this?" STRING_INVALID_NUMBER, "Invalid number format" + STRING_OLE_STORAGE_NOT_SUPPORTED, "OLE storage documents are not supported" END diff --git a/programs/wordpad/Fr.rc b/programs/wordpad/Fr.rc index dcf80ecfeea..2448c3c53d9 100644 --- a/programs/wordpad/Fr.rc +++ b/programs/wordpad/Fr.rc @@ -229,4 +229,5 @@ BEGIN "which will cause all formatting to be lost. " \ "Are you sure that you wish to do this?" STRING_INVALID_NUMBER, "Invalid number format" + STRING_OLE_STORAGE_NOT_SUPPORTED, "OLE storage documents are not supported" END diff --git a/programs/wordpad/Hu.rc b/programs/wordpad/Hu.rc index feca301d8c9..7b72a7fe549 100644 --- a/programs/wordpad/Hu.rc +++ b/programs/wordpad/Hu.rc @@ -229,4 +229,5 @@ BEGIN "which will cause all formatting to be lost. " \ "Are you sure that you wish to do this?" STRING_INVALID_NUMBER, "Invalid number format" + STRING_OLE_STORAGE_NOT_SUPPORTED, "OLE storage documents are not supported" END diff --git a/programs/wordpad/Ko.rc b/programs/wordpad/Ko.rc index 7ec919ee3b1..800f2cf466a 100644 --- a/programs/wordpad/Ko.rc +++ b/programs/wordpad/Ko.rc @@ -223,4 +223,5 @@ BEGIN "ÀÌ°ÍÀº Ư¼öÇÑ ²Ù¹ÒÀ» ¾ø¿¤ °ÍÀÔ´Ï´Ù. " \ "´ç½ÅÀº Á¤¸»·Î ÀúÀåÇϱ⸦ ¿øÇմϱî?" STRING_INVALID_NUMBER, "¿Ã¹Ù¸£Áö ¾ÊÀº ¼ö Çü½Ä" + STRING_OLE_STORAGE_NOT_SUPPORTED, "OLE storage documents are not supported" END diff --git a/programs/wordpad/Nl.rc b/programs/wordpad/Nl.rc index d6c5346b11b..04042d8aa64 100644 --- a/programs/wordpad/Nl.rc +++ b/programs/wordpad/Nl.rc @@ -229,4 +229,5 @@ BEGIN "which will cause all formatting to be lost. " \ "Are you sure that you wish to do this?" STRING_INVALID_NUMBER, "Invalid number format" + STRING_OLE_STORAGE_NOT_SUPPORTED, "OLE storage documents are not supported" END diff --git a/programs/wordpad/No.rc b/programs/wordpad/No.rc index 3bebdf9e7b0..0c203ed63f3 100644 --- a/programs/wordpad/No.rc +++ b/programs/wordpad/No.rc @@ -229,4 +229,5 @@ BEGIN "vil føre til at all formatering går tapt. Er du " \ "sikker på at du vil fortsette?" STRING_INVALID_NUMBER, "Ugyldig tallformat" + STRING_OLE_STORAGE_NOT_SUPPORTED, "OLE storage documents are not supported" END diff --git a/programs/wordpad/Pl.rc b/programs/wordpad/Pl.rc index 3b05326748b..3ed7e81ca51 100644 --- a/programs/wordpad/Pl.rc +++ b/programs/wordpad/Pl.rc @@ -230,4 +230,5 @@ BEGIN "which will cause all formatting to be lost. " \ "Are you sure that you wish to do this?" STRING_INVALID_NUMBER, "Invalid number format" + STRING_OLE_STORAGE_NOT_SUPPORTED, "OLE storage documents are not supported" END diff --git a/programs/wordpad/Ru.rc b/programs/wordpad/Ru.rc index 17828cc3900..3eaf4386397 100644 --- a/programs/wordpad/Ru.rc +++ b/programs/wordpad/Ru.rc @@ -228,4 +228,5 @@ BEGIN "which will cause all formatting to be lost. " \ "Are you sure that you wish to do this?" STRING_INVALID_NUMBER, "Invalid number format" + STRING_OLE_STORAGE_NOT_SUPPORTED, "OLE storage documents are not supported" END diff --git a/programs/wordpad/Tr.rc b/programs/wordpad/Tr.rc index 65cb31f9b2e..b3463f0c0c8 100644 --- a/programs/wordpad/Tr.rc +++ b/programs/wordpad/Tr.rc @@ -232,4 +232,5 @@ BEGIN "which will cause all formatting to be lost. " \ "Are you sure that you wish to do this?" STRING_INVALID_NUMBER, "Invalid number format" + STRING_OLE_STORAGE_NOT_SUPPORTED, "OLE storage documents are not supported" END diff --git a/programs/wordpad/resource.h b/programs/wordpad/resource.h index 2c2cc986f06..130eb94b47c 100644 --- a/programs/wordpad/resource.h +++ b/programs/wordpad/resource.h @@ -180,3 +180,4 @@ #define STRING_LOAD_RICHED_FAILED 1703 #define STRING_SAVE_LOSEFORMATTING 1704 #define STRING_INVALID_NUMBER 1705 +#define STRING_OLE_STORAGE_NOT_SUPPORTED 1706 diff --git a/programs/wordpad/wordpad.c b/programs/wordpad/wordpad.c index 5e1d0dc5df6..a117a756f5d 100644 --- a/programs/wordpad/wordpad.c +++ b/programs/wordpad/wordpad.c @@ -1092,8 +1092,17 @@ static void DoOpenFile(LPCWSTR szOpenFileName) } else if(readOut >= 5) { static const char header[] = "{\\rtf"; + static const BYTE STG_magic[] = { 0xd0,0xcf,0x11,0xe0 }; + if(!memcmp(header, fileStart, 5)) format = SF_RTF; + else if (!memcmp(STG_magic, fileStart, sizeof(STG_magic))) + { + CloseHandle(hFile); + MessageBoxW(hMainWnd, MAKEINTRESOURCEW(STRING_OLE_STORAGE_NOT_SUPPORTED), wszAppTitle, + MB_OK | MB_ICONEXCLAMATION); + return; + } } es.dwCookie = (DWORD_PTR)hFile; -- 2.11.4.GIT