Commit 32457b4f authored by Alexandre Julliard's avatar Alexandre Julliard

Converted more of the (Un)RegisterTypeLib code to Unicode.

Factored out some common routines.
parent 640b2d5d
...@@ -74,7 +74,6 @@ ...@@ -74,7 +74,6 @@
#include "wine/unicode.h" #include "wine/unicode.h"
#include "objbase.h" #include "objbase.h"
#include "heap.h"
#include "ole2disp.h" #include "ole2disp.h"
#include "typelib.h" #include "typelib.h"
#include "wine/debug.h" #include "wine/debug.h"
...@@ -150,6 +149,50 @@ static void FromLEDWords(void *p_Val, int p_iSize) ...@@ -150,6 +149,50 @@ static void FromLEDWords(void *p_Val, int p_iSize)
#define FromLEDWords(X,Y) /*nothing*/ #define FromLEDWords(X,Y) /*nothing*/
#endif #endif
/* get the path of a typelib key, in the form "Typelib\\<guid>\\<maj>.<min>" */
/* buffer must be at least 60 characters long */
static WCHAR *get_typelib_key( REFGUID guid, WORD wMaj, WORD wMin, WCHAR *buffer )
{
static const WCHAR TypelibW[] = {'T','y','p','e','l','i','b','\\',0};
static const WCHAR VersionFormatW[] = {'\\','%','u','.','%','u',0};
memcpy( buffer, TypelibW, sizeof(TypelibW) );
StringFromGUID2( guid, buffer + strlenW(buffer), 40 );
sprintfW( buffer + strlenW(buffer), VersionFormatW, wMaj, wMin );
return buffer;
}
/* get the path of an interface key, in the form "Interface\\<guid>" */
/* buffer must be at least 50 characters long */
static WCHAR *get_interface_key( REFGUID guid, WCHAR *buffer )
{
static const WCHAR InterfaceW[] = {'I','n','t','e','r','f','a','c','e','\\',0};
memcpy( buffer, InterfaceW, sizeof(InterfaceW) );
StringFromGUID2( guid, buffer + strlenW(buffer), 40 );
return buffer;
}
/* get the lcid subkey for a typelib, in the form "<lcid>\\<syskind>" */
/* buffer must be at least 16 characters long */
static WCHAR *get_lcid_subkey( LCID lcid, SYSKIND syskind, WCHAR *buffer )
{
static const WCHAR LcidFormatW[] = {'%','l','x','\\',0};
static const WCHAR win16W[] = {'w','i','n','1','6',0};
static const WCHAR win32W[] = {'w','i','n','3','2',0};
sprintfW( buffer, LcidFormatW, lcid );
switch(syskind)
{
case SYS_WIN16: strcatW( buffer, win16W ); break;
case SYS_WIN32: strcatW( buffer, win32W ); break;
default:
TRACE("Typelib is for unsupported syskind %i\n", syskind);
return NULL;
}
return buffer;
}
/**************************************************************************** /****************************************************************************
* QueryPathOfRegTypeLib [OLEAUT32.164] * QueryPathOfRegTypeLib [OLEAUT32.164]
...@@ -164,40 +207,33 @@ QueryPathOfRegTypeLib( ...@@ -164,40 +207,33 @@ QueryPathOfRegTypeLib(
LCID lcid, /* [in] locale id */ LCID lcid, /* [in] locale id */
LPBSTR path ) /* [out] path of typelib */ LPBSTR path ) /* [out] path of typelib */
{ {
/* don't need to ZeroMemory those arrays since sprintf and RegQueryValue add
string termination character on output strings */
HRESULT hr = E_FAIL; HRESULT hr = E_FAIL;
LCID myLCID = lcid; LCID myLCID = lcid;
HKEY hkey;
char szXGUID[80]; WCHAR buffer[60];
char szTypeLibKey[100]; WCHAR Path[MAX_PATH];
char szPath[MAX_PATH];
DWORD dwPathLen = sizeof(szPath);
if ( !HIWORD(guid) ) if ( !HIWORD(guid) )
{ {
sprintf(szXGUID, FIXME("(guid %p,%d,%d,0x%04lx,%p),stub!\n", guid, wMaj, wMin, lcid, path);
"<guid 0x%08lx>", return E_FAIL;
(DWORD) guid); }
FIXME("(%s,%d,%d,0x%04lx,%p),stub!\n", szXGUID, wMaj, wMin, (DWORD)lcid, path); get_typelib_key( guid, wMaj, wMin, buffer );
if (RegOpenKeyW( HKEY_CLASSES_ROOT, buffer, &hkey ) != ERROR_SUCCESS)
{
TRACE_(typelib)("%s not found\n", debugstr_w(buffer));
return E_FAIL; return E_FAIL;
} }
while (hr != S_OK) while (hr != S_OK)
{ {
sprintf(szTypeLibKey, DWORD dwPathLen = sizeof(Path);
"SOFTWARE\\Classes\\Typelib\\{%08lx-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}\\%d.%d\\%lx\\win32",
guid->Data1, guid->Data2, guid->Data3, get_lcid_subkey( myLCID, SYS_WIN32, buffer );
guid->Data4[0], guid->Data4[1], guid->Data4[2], guid->Data4[3],
guid->Data4[4], guid->Data4[5], guid->Data4[6], guid->Data4[7],
wMaj,
wMin,
myLCID);
if (RegQueryValueA(HKEY_LOCAL_MACHINE, szTypeLibKey, szPath, &dwPathLen)) if (RegQueryValueW(hkey, buffer, Path, &dwPathLen))
{ {
if (!lcid) if (!lcid)
break; break;
...@@ -218,23 +254,11 @@ QueryPathOfRegTypeLib( ...@@ -218,23 +254,11 @@ QueryPathOfRegTypeLib(
} }
else else
{ {
DWORD len = MultiByteToWideChar(CP_ACP, MB_PRECOMPOSED, szPath, dwPathLen, NULL, 0 ); *path = SysAllocString( Path );
BSTR bstrPath = SysAllocStringLen(NULL,len);
MultiByteToWideChar(CP_ACP,
MB_PRECOMPOSED,
szPath,
dwPathLen,
bstrPath,
len);
*path = bstrPath;
hr = S_OK; hr = S_OK;
} }
} }
RegCloseKey( hkey );
if (hr != S_OK)
TRACE_(typelib)("%s not found\n", szTypeLibKey);
return hr; return hr;
} }
...@@ -387,6 +411,13 @@ HRESULT WINAPI LoadRegTypeLib( ...@@ -387,6 +411,13 @@ HRESULT WINAPI LoadRegTypeLib(
} }
/* some string constants shared between RegisterTypeLib and UnRegisterTypeLib */
static const WCHAR TypeLibW[] = {'T','y','p','e','L','i','b',0};
static const WCHAR FLAGSW[] = {'F','L','A','G','S',0};
static const WCHAR HELPDIRW[] = {'H','E','L','P','D','I','R',0};
static const WCHAR ProxyStubClsidW[] = {'P','r','o','x','y','S','t','u','b','C','l','s','i','d',0};
static const WCHAR ProxyStubClsid32W[] = {'P','r','o','x','y','S','t','u','b','C','l','s','i','d','3','2',0};
/****************************************************************************** /******************************************************************************
* RegisterTypeLib [OLEAUT32.163] * RegisterTypeLib [OLEAUT32.163]
* Adds information about a type library to the System Registry * Adds information about a type library to the System Registry
...@@ -405,20 +436,17 @@ HRESULT WINAPI RegisterTypeLib( ...@@ -405,20 +436,17 @@ HRESULT WINAPI RegisterTypeLib(
OLECHAR * szHelpDir) /* [in] dir to the helpfile for the library, OLECHAR * szHelpDir) /* [in] dir to the helpfile for the library,
may be NULL*/ may be NULL*/
{ {
static const WCHAR PSOA[] = {'{','0','0','0','2','0','4','2','4','-',
'0','0','0','0','-','0','0','0','0','-','C','0','0','0','-',
'0','0','0','0','0','0','0','0','0','0','4','6','}',0};
HRESULT res; HRESULT res;
TLIBATTR *attr; TLIBATTR *attr;
OLECHAR guid[80]; WCHAR keyName[60];
WCHAR keyName[120]; WCHAR tmp[16];
CHAR tmp[MAX_PATH];
HKEY key, subKey; HKEY key, subKey;
UINT types, tidx; UINT types, tidx;
TYPEKIND kind; TYPEKIND kind;
DWORD disposition; DWORD disposition;
static const WCHAR PSOA[] = {
'{','0','0','0','2','0','4','2','4','-','0','0','0','0','-','0','0','0','0',
'-','C','0','0','0','-','0','0','0','0','0','0','0','0','0','0','4','6','}',0};
static const WCHAR fmt[] = {
'T','y','p','e','L','i','b','\\','%','s','\\','%','x','.','%','x',0 };
if (ptlib == NULL || szFullPath == NULL) if (ptlib == NULL || szFullPath == NULL)
return E_INVALIDARG; return E_INVALIDARG;
...@@ -426,9 +454,7 @@ HRESULT WINAPI RegisterTypeLib( ...@@ -426,9 +454,7 @@ HRESULT WINAPI RegisterTypeLib(
if (!SUCCEEDED(ITypeLib_GetLibAttr(ptlib, &attr))) if (!SUCCEEDED(ITypeLib_GetLibAttr(ptlib, &attr)))
return E_FAIL; return E_FAIL;
StringFromGUID2(&attr->guid, guid, 80); get_typelib_key( &attr->guid, attr->wMajorVerNum, attr->wMinorVerNum, keyName );
snprintfW(keyName, sizeof(keyName)/sizeof(WCHAR), fmt,
guid, attr->wMajorVerNum, attr->wMinorVerNum);
res = S_OK; res = S_OK;
if (RegCreateKeyExW(HKEY_CLASSES_ROOT, keyName, 0, NULL, 0, if (RegCreateKeyExW(HKEY_CLASSES_ROOT, keyName, 0, NULL, 0,
...@@ -449,24 +475,10 @@ HRESULT WINAPI RegisterTypeLib( ...@@ -449,24 +475,10 @@ HRESULT WINAPI RegisterTypeLib(
res = E_FAIL; res = E_FAIL;
/* Make up the name of the typelib path subkey */ /* Make up the name of the typelib path subkey */
sprintf(tmp, "%lu\\", attr->lcid); if (!get_lcid_subkey( attr->lcid, attr->syskind, tmp )) res = E_FAIL;
switch(attr->syskind) {
case SYS_WIN16:
strcat(tmp, "win16");
break;
case SYS_WIN32:
strcat(tmp, "win32");
break;
default:
TRACE("Typelib is for unsupported syskind %i\n", attr->syskind);
res = E_FAIL;
break;
}
/* Create the typelib path subkey */ /* Create the typelib path subkey */
if (res == S_OK && RegCreateKeyExA(key, tmp, 0, NULL, 0, if (res == S_OK && RegCreateKeyExW(key, tmp, 0, NULL, 0,
KEY_WRITE, NULL, &subKey, NULL) == ERROR_SUCCESS) KEY_WRITE, NULL, &subKey, NULL) == ERROR_SUCCESS)
{ {
if (RegSetValueExW(subKey, NULL, 0, REG_SZ, if (RegSetValueExW(subKey, NULL, 0, REG_SZ,
...@@ -479,14 +491,15 @@ HRESULT WINAPI RegisterTypeLib( ...@@ -479,14 +491,15 @@ HRESULT WINAPI RegisterTypeLib(
res = E_FAIL; res = E_FAIL;
/* Create the flags subkey */ /* Create the flags subkey */
if (res == S_OK && RegCreateKeyExA(key, "FLAGS", 0, NULL, 0, if (res == S_OK && RegCreateKeyExW(key, FLAGSW, 0, NULL, 0,
KEY_WRITE, NULL, &subKey, NULL) == ERROR_SUCCESS) KEY_WRITE, NULL, &subKey, NULL) == ERROR_SUCCESS)
{ {
CHAR buf[20];
/* FIXME: is %u correct? */ /* FIXME: is %u correct? */
snprintf(buf, sizeof(buf), "%u", attr->wLibFlags); static const WCHAR formatW[] = {'%','u',0};
if (RegSetValueExA(subKey, NULL, 0, REG_SZ, WCHAR buf[20];
buf, lstrlenA(buf) + 1) != ERROR_SUCCESS) sprintfW(buf, formatW, attr->wLibFlags);
if (RegSetValueExW(subKey, NULL, 0, REG_SZ,
(BYTE *)buf, (strlenW(buf) + 1)*sizeof(WCHAR) ) != ERROR_SUCCESS)
res = E_FAIL; res = E_FAIL;
RegCloseKey(subKey); RegCloseKey(subKey);
...@@ -495,7 +508,7 @@ HRESULT WINAPI RegisterTypeLib( ...@@ -495,7 +508,7 @@ HRESULT WINAPI RegisterTypeLib(
res = E_FAIL; res = E_FAIL;
/* create the helpdir subkey */ /* create the helpdir subkey */
if (res == S_OK && RegCreateKeyExA(key, "HELPDIR", 0, NULL, 0, if (res == S_OK && RegCreateKeyExW(key, HELPDIRW, 0, NULL, 0,
KEY_WRITE, NULL, &subKey, &disposition) == ERROR_SUCCESS) KEY_WRITE, NULL, &subKey, &disposition) == ERROR_SUCCESS)
{ {
BOOL freeHelpDir = FALSE; BOOL freeHelpDir = FALSE;
...@@ -596,57 +609,46 @@ HRESULT WINAPI RegisterTypeLib( ...@@ -596,57 +609,46 @@ HRESULT WINAPI RegisterTypeLib(
*/ */
if (1 || (tattr->wTypeFlags & TYPEFLAG_FOLEAUTOMATION)) if (1 || (tattr->wTypeFlags & TYPEFLAG_FOLEAUTOMATION))
{ {
static const WCHAR fmt_interface[] = {
'I','n','t','e','r','f','a','c','e','\\','%','s',0 };
if (!(tattr->wTypeFlags & TYPEFLAG_FOLEAUTOMATION)) { if (!(tattr->wTypeFlags & TYPEFLAG_FOLEAUTOMATION)) {
FIXME("Registering non-oleautomation interface!\n"); FIXME("Registering non-oleautomation interface!\n");
} }
/* register interface<->typelib coupling */ /* register interface<->typelib coupling */
StringFromGUID2(&tattr->guid, guid, 80); get_interface_key( &tattr->guid, keyName );
snprintfW(keyName, sizeof(keyName)/sizeof(WCHAR), fmt_interface, guid);
if (RegCreateKeyExW(HKEY_CLASSES_ROOT, keyName, 0, NULL, 0, if (RegCreateKeyExW(HKEY_CLASSES_ROOT, keyName, 0, NULL, 0,
KEY_WRITE, NULL, &key, NULL) == ERROR_SUCCESS) KEY_WRITE, NULL, &key, NULL) == ERROR_SUCCESS)
{ {
static const WCHAR psclsid[] = {
'P','r','o','x','y','S','t','u','b','C','l','s','i','d',0 };
static const WCHAR psclsid32[] = {
'P','r','o','x','y','S','t','u','b','C','l','s','i','d','3','2',0 };
if (name) if (name)
RegSetValueExW(key, NULL, 0, REG_SZ, RegSetValueExW(key, NULL, 0, REG_SZ,
(BYTE *)name, lstrlenW(name) * sizeof(OLECHAR)); (BYTE *)name, (strlenW(name)+1) * sizeof(OLECHAR));
if (RegCreateKeyExW(key, psclsid, 0, NULL, 0, if (RegCreateKeyExW(key, ProxyStubClsidW, 0, NULL, 0,
KEY_WRITE, NULL, &subKey, NULL) == ERROR_SUCCESS) { KEY_WRITE, NULL, &subKey, NULL) == ERROR_SUCCESS) {
RegSetValueExW(subKey, NULL, 0, REG_SZ, RegSetValueExW(subKey, NULL, 0, REG_SZ,
(BYTE*)PSOA, sizeof PSOA); (BYTE*)PSOA, sizeof PSOA);
RegCloseKey(subKey); RegCloseKey(subKey);
} }
if (RegCreateKeyExW(key, psclsid32, 0, NULL, 0, if (RegCreateKeyExW(key, ProxyStubClsid32W, 0, NULL, 0,
KEY_WRITE, NULL, &subKey, NULL) == ERROR_SUCCESS) { KEY_WRITE, NULL, &subKey, NULL) == ERROR_SUCCESS) {
RegSetValueExW(subKey, NULL, 0, REG_SZ, RegSetValueExW(subKey, NULL, 0, REG_SZ,
(BYTE*)PSOA, sizeof PSOA); (BYTE*)PSOA, sizeof PSOA);
RegCloseKey(subKey); RegCloseKey(subKey);
} }
if (RegCreateKeyExA(key, "TypeLib", 0, NULL, 0, if (RegCreateKeyExW(key, TypeLibW, 0, NULL, 0,
KEY_WRITE, NULL, &subKey, NULL) == ERROR_SUCCESS) KEY_WRITE, NULL, &subKey, NULL) == ERROR_SUCCESS)
{ {
WCHAR ver[32]; WCHAR buffer[40];
static const WCHAR fmtver[] = {'%','x','.','%','x',0 }; static const WCHAR fmtver[] = {'%','u','.','%','u',0 };
static const WCHAR szVer[] = {'V','e','r','s','i','o','n',0}; static const WCHAR VersionW[] = {'V','e','r','s','i','o','n',0};
StringFromGUID2(&attr->guid, guid, 80); StringFromGUID2(&attr->guid, buffer, 40);
snprintfW(ver, sizeof(ver), fmtver,
attr->wMajorVerNum, attr->wMinorVerNum);
RegSetValueExW(subKey, NULL, 0, REG_SZ, RegSetValueExW(subKey, NULL, 0, REG_SZ,
(BYTE *)guid, lstrlenW(guid) * sizeof(OLECHAR)); (BYTE *)buffer, (strlenW(buffer)+1) * sizeof(WCHAR));
RegSetValueExW(subKey, szVer, 0, REG_SZ, sprintfW(buffer, fmtver, attr->wMajorVerNum, attr->wMinorVerNum);
(BYTE*)ver, lstrlenW(ver) * sizeof(WCHAR)); RegSetValueExW(subKey, VersionW, 0, REG_SZ,
(BYTE*)buffer, (strlenW(buffer)+1) * sizeof(WCHAR));
RegCloseKey(subKey); RegCloseKey(subKey);
} }
...@@ -688,13 +690,10 @@ HRESULT WINAPI UnRegisterTypeLib( ...@@ -688,13 +690,10 @@ HRESULT WINAPI UnRegisterTypeLib(
{ {
BSTR tlibPath = NULL; BSTR tlibPath = NULL;
DWORD tmpLength; DWORD tmpLength;
CHAR keyName[MAX_PATH]; WCHAR keyName[60];
CHAR* syskindName; WCHAR subKeyName[50];
CHAR subKeyName[MAX_PATH];
LPSTR guidA;
int result = S_OK; int result = S_OK;
DWORD i = 0; DWORD i = 0;
OLECHAR guid[80];
BOOL deleteOtherStuff; BOOL deleteOtherStuff;
HKEY key = NULL; HKEY key = NULL;
HKEY subKey = NULL; HKEY subKey = NULL;
...@@ -707,23 +706,10 @@ HRESULT WINAPI UnRegisterTypeLib( ...@@ -707,23 +706,10 @@ HRESULT WINAPI UnRegisterTypeLib(
TRACE("(IID: %s): stub\n",debugstr_guid(libid)); TRACE("(IID: %s): stub\n",debugstr_guid(libid));
/* Create the path to the key */ /* Create the path to the key */
StringFromGUID2(libid, guid, 80); get_typelib_key( libid, wVerMajor, wVerMinor, keyName );
guidA = HEAP_strdupWtoA(GetProcessHeap(), 0, guid);
snprintf(keyName, sizeof(keyName), "TypeLib\\%s\\%x.%x",
guidA, wVerMajor, wVerMinor);
HeapFree(GetProcessHeap(), 0, guidA);
/* Work out the syskind name */
switch(syskind) {
case SYS_WIN16:
syskindName = "win16";
break;
case SYS_WIN32:
syskindName = "win32";
break;
default: if (syskind != SYS_WIN16 && syskind != SYS_WIN32)
{
TRACE("Unsupported syskind %i\n", syskind); TRACE("Unsupported syskind %i\n", syskind);
result = E_INVALIDARG; result = E_INVALIDARG;
goto end; goto end;
...@@ -736,7 +722,7 @@ HRESULT WINAPI UnRegisterTypeLib( ...@@ -736,7 +722,7 @@ HRESULT WINAPI UnRegisterTypeLib(
} }
/* Try and open the key to the type library. */ /* Try and open the key to the type library. */
if (RegOpenKeyExA(HKEY_CLASSES_ROOT, keyName, 0, KEY_READ | KEY_WRITE, &key) != S_OK) { if (RegOpenKeyExW(HKEY_CLASSES_ROOT, keyName, 0, KEY_READ | KEY_WRITE, &key) != S_OK) {
result = E_INVALIDARG; result = E_INVALIDARG;
goto end; goto end;
} }
...@@ -767,21 +753,18 @@ HRESULT WINAPI UnRegisterTypeLib( ...@@ -767,21 +753,18 @@ HRESULT WINAPI UnRegisterTypeLib(
} }
/* the path to the type */ /* the path to the type */
StringFromGUID2(&typeAttr->guid, guid, 80); get_interface_key( &typeAttr->guid, subKeyName );
guidA = HEAP_strdupWtoA(GetProcessHeap(), 0, guid);
snprintf(subKeyName, sizeof(subKeyName), "Interface\\%s", guidA);
HeapFree(GetProcessHeap(), 0, guidA);
/* Delete its bits */ /* Delete its bits */
if (RegOpenKeyExA(HKEY_CLASSES_ROOT, subKeyName, 0, KEY_WRITE, &subKey) != S_OK) { if (RegOpenKeyExW(HKEY_CLASSES_ROOT, subKeyName, 0, KEY_WRITE, &subKey) != S_OK) {
goto enddeleteloop; goto enddeleteloop;
} }
RegDeleteKeyA(subKey, "ProxyStubClsid"); RegDeleteKeyW(subKey, ProxyStubClsidW);
RegDeleteKeyA(subKey, "ProxyStubClsid32"); RegDeleteKeyW(subKey, ProxyStubClsid32W);
RegDeleteKeyA(subKey, "TypeLib"); RegDeleteKeyW(subKey, TypeLibW);
RegCloseKey(subKey); RegCloseKey(subKey);
subKey = NULL; subKey = NULL;
RegDeleteKeyA(HKEY_CLASSES_ROOT, subKeyName); RegDeleteKeyW(HKEY_CLASSES_ROOT, subKeyName);
enddeleteloop: enddeleteloop:
if (typeAttr) ITypeInfo_ReleaseTypeAttr(typeInfo, typeAttr); if (typeAttr) ITypeInfo_ReleaseTypeAttr(typeInfo, typeAttr);
...@@ -791,40 +774,36 @@ enddeleteloop: ...@@ -791,40 +774,36 @@ enddeleteloop:
} }
/* Now, delete the type library path subkey */ /* Now, delete the type library path subkey */
sprintf(subKeyName, "%lu\\%s", lcid, syskindName); get_lcid_subkey( lcid, syskind, subKeyName );
RegDeleteKeyA(key, subKeyName); RegDeleteKeyW(key, subKeyName);
sprintf(subKeyName, "%lu", lcid); *strrchrW( subKeyName, '\\' ) = 0; /* remove last path component */
RegDeleteKeyA(key, subKeyName); RegDeleteKeyW(key, subKeyName);
/* check if there is anything besides the FLAGS/HELPDIR keys. /* check if there is anything besides the FLAGS/HELPDIR keys.
If there is, we don't delete them */ If there is, we don't delete them */
tmpLength = sizeof(subKeyName); tmpLength = sizeof(subKeyName)/sizeof(WCHAR);
deleteOtherStuff = TRUE; deleteOtherStuff = TRUE;
i = 0; i = 0;
while(RegEnumKeyExA(key, i++, subKeyName, &tmpLength, NULL, NULL, NULL, NULL) == S_OK) { while(RegEnumKeyExW(key, i++, subKeyName, &tmpLength, NULL, NULL, NULL, NULL) == S_OK) {
tmpLength = sizeof(subKeyName); tmpLength = sizeof(subKeyName)/sizeof(WCHAR);
/* if its not FLAGS or HELPDIR, then we must keep the rest of the key */ /* if its not FLAGS or HELPDIR, then we must keep the rest of the key */
if (!strcmp(subKeyName, "FLAGS")) continue; if (!strcmpW(subKeyName, FLAGSW)) continue;
if (!strcmp(subKeyName, "HELPDIR")) continue; if (!strcmpW(subKeyName, HELPDIRW)) continue;
deleteOtherStuff = FALSE; deleteOtherStuff = FALSE;
break; break;
} }
/* only delete the other parts of the key if we're absolutely sure */ /* only delete the other parts of the key if we're absolutely sure */
if (deleteOtherStuff) { if (deleteOtherStuff) {
RegDeleteKeyA(key, "FLAGS"); RegDeleteKeyW(key, FLAGSW);
RegDeleteKeyA(key, "HELPDIR"); RegDeleteKeyW(key, HELPDIRW);
RegCloseKey(key); RegCloseKey(key);
key = NULL; key = NULL;
StringFromGUID2(libid, guid, 80); RegDeleteKeyW(HKEY_CLASSES_ROOT, keyName);
guidA = HEAP_strdupWtoA(GetProcessHeap(), 0, guid); *strrchrW( keyName, '\\' ) = 0; /* remove last path component */
sprintf(keyName, "TypeLib\\%s\\%x.%x", guidA, wVerMajor, wVerMinor); RegDeleteKeyW(HKEY_CLASSES_ROOT, keyName);
RegDeleteKeyA(HKEY_CLASSES_ROOT, keyName);
sprintf(keyName, "TypeLib\\%s", guidA);
RegDeleteKeyA(HKEY_CLASSES_ROOT, keyName);
HeapFree(GetProcessHeap(), 0, guidA);
} }
end: end:
...@@ -2181,7 +2160,7 @@ int TLB_ReadTypeLib(LPCWSTR pszFileName, INT index, ITypeLib2 **ppTypeLib) ...@@ -2181,7 +2160,7 @@ int TLB_ReadTypeLib(LPCWSTR pszFileName, INT index, ITypeLib2 **ppTypeLib)
hFile = CreateFileW( pszFileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0 ); hFile = CreateFileW( pszFileName, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING, 0, 0 );
if (INVALID_HANDLE_VALUE != hFile) if (INVALID_HANDLE_VALUE != hFile)
{ {
HANDLE hMapping = CreateFileMappingA( hFile, NULL, PAGE_READONLY | SEC_COMMIT, 0, 0, NULL ); HANDLE hMapping = CreateFileMappingW( hFile, NULL, PAGE_READONLY | SEC_COMMIT, 0, 0, NULL );
if (hMapping) if (hMapping)
{ {
LPVOID pBase = MapViewOfFile(hMapping, FILE_MAP_READ, 0, 0, 0); LPVOID pBase = MapViewOfFile(hMapping, FILE_MAP_READ, 0, 0, 0);
...@@ -2214,8 +2193,8 @@ int TLB_ReadTypeLib(LPCWSTR pszFileName, INT index, ITypeLib2 **ppTypeLib) ...@@ -2214,8 +2193,8 @@ int TLB_ReadTypeLib(LPCWSTR pszFileName, INT index, ITypeLib2 **ppTypeLib)
LOAD_LIBRARY_AS_DATAFILE|LOAD_WITH_ALTERED_SEARCH_PATH); LOAD_LIBRARY_AS_DATAFILE|LOAD_WITH_ALTERED_SEARCH_PATH);
if (hinstDLL) if (hinstDLL)
{ {
HRSRC hrsrc = FindResourceA(hinstDLL, MAKEINTRESOURCEA(index), static const WCHAR TYPELIBW[] = {'T','Y','P','E','L','I','B',0};
"TYPELIB"); HRSRC hrsrc = FindResourceW(hinstDLL, MAKEINTRESOURCEW(index), TYPELIBW);
if (hrsrc) if (hrsrc)
{ {
HGLOBAL hGlobal = LoadResource(hinstDLL, hrsrc); HGLOBAL hGlobal = LoadResource(hinstDLL, hrsrc);
......
...@@ -48,7 +48,6 @@ ...@@ -48,7 +48,6 @@
#include "wine/unicode.h" #include "wine/unicode.h"
#include "objbase.h" #include "objbase.h"
#include "heap.h"
#include "ole2disp.h" #include "ole2disp.h"
#include "typelib.h" #include "typelib.h"
#include "wine/debug.h" #include "wine/debug.h"
......
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