- Sync shlwapi, msxml3 and windowscodecs with Wine 1.1.30

svn path=/trunk/; revision=43163
This commit is contained in:
Dmitry Chapyshev 2009-09-26 10:48:07 +00:00
parent 92fb419193
commit ee67b18306
8 changed files with 252 additions and 715 deletions

View file

@ -74,6 +74,10 @@ static HRESULT WINAPI domelem_QueryInterface(
{
*ppvObject = IXMLDOMNode_from_impl(This->node);
}
else if(dispex_query_interface(&This->node->dispex, riid, ppvObject))
{
return *ppvObject ? S_OK : E_NOINTERFACE;
}
else
{
FIXME("interface %s not implemented\n", debugstr_guid(riid));
@ -751,6 +755,18 @@ static const struct IXMLDOMElementVtbl domelem_vtbl =
domelem_normalize,
};
static const tid_t domelem_iface_tids[] = {
IXMLDOMElement_tid,
0
};
static dispex_static_data_t domelem_dispex = {
NULL,
IXMLDOMElement_tid,
NULL,
domelem_iface_tids
};
IUnknown* create_element( xmlNodePtr element )
{
domelem *This;
@ -762,7 +778,7 @@ IUnknown* create_element( xmlNodePtr element )
This->lpVtbl = &domelem_vtbl;
This->ref = 1;
This->node = create_basic_node( element, (IUnknown*)&This->lpVtbl, NULL );
This->node = create_basic_node( element, (IUnknown*)&This->lpVtbl, &domelem_dispex );
if(!This->node)
{
HeapFree(GetProcessHeap(), 0, This);

View file

@ -1,5 +1,5 @@
/*
* IQueryAssociations object and helper functions
* IQueryAssociations helper functions
*
* Copyright 2002 Jon Griffiths
*
@ -26,68 +26,17 @@
#include "winreg.h"
#include "objbase.h"
#include "shlguid.h"
#include "shlobj.h"
#include "shlwapi.h"
#include "winver.h"
#include "wine/unicode.h"
#include "wine/debug.h"
WINE_DEFAULT_DEBUG_CHANNEL(shell);
/**************************************************************************
* IQueryAssociations {SHLWAPI}
*
* DESCRIPTION
* This object provides a layer of abstraction over the system registry in
* order to simplify the process of parsing associations between files.
* Associations in this context means the registry entries that link (for
* example) the extension of a file with its description, list of
* applications to open the file with, and actions that can be performed on it
* (the shell displays such information in the context menu of explorer
* when you right-click on a file).
*
* HELPERS
* You can use this object transparently by calling the helper functions
* AssocQueryKeyA(), AssocQueryStringA() and AssocQueryStringByKeyA(). These
* create an IQueryAssociations object, perform the requested actions
* and then dispose of the object. Alternatively, you can create an instance
* of the object using AssocCreate() and call the following methods on it:
*
* METHODS
*/
/* Default IQueryAssociations::Init() flags */
#define SHLWAPI_DEF_ASSOCF (ASSOCF_INIT_BYEXENAME|ASSOCF_INIT_DEFAULTTOSTAR| \
ASSOCF_INIT_DEFAULTTOFOLDER)
typedef struct
{
const IQueryAssociationsVtbl *lpVtbl;
LONG ref;
HKEY hkeySource;
HKEY hkeyProgID;
} IQueryAssociationsImpl;
static const IQueryAssociationsVtbl IQueryAssociations_vtbl;
/**************************************************************************
* IQueryAssociations_Constructor [internal]
*
* Construct a new IQueryAssociations object.
*/
static IQueryAssociations* IQueryAssociations_Constructor(void)
{
IQueryAssociationsImpl* iface;
iface = HeapAlloc(GetProcessHeap(),0,sizeof(IQueryAssociationsImpl));
iface->lpVtbl = &IQueryAssociations_vtbl;
iface->ref = 1;
iface->hkeySource = NULL;
iface->hkeyProgID = NULL;
TRACE("Returning IQueryAssociations* %p\n", iface);
return (IQueryAssociations*)iface;
}
/*************************************************************************
* SHLWAPI_ParamAToW
*
@ -139,9 +88,6 @@ static BOOL SHLWAPI_ParamAToW(LPCSTR lpszParam, LPWSTR lpszBuff, DWORD dwLen,
*/
HRESULT WINAPI AssocCreate(CLSID clsid, REFIID refiid, void **lpInterface)
{
HRESULT hRet;
IQueryAssociations* lpAssoc;
TRACE("(%s,%s,%p)\n", debugstr_guid(&clsid), debugstr_guid(refiid),
lpInterface);
@ -153,18 +99,7 @@ HRESULT WINAPI AssocCreate(CLSID clsid, REFIID refiid, void **lpInterface)
if (!IsEqualGUID(&clsid, &CLSID_QueryAssociations))
return CLASS_E_CLASSNOTAVAILABLE;
lpAssoc = IQueryAssociations_Constructor();
if (!lpAssoc)
return E_OUTOFMEMORY;
hRet = IQueryAssociations_QueryInterface(lpAssoc, refiid, lpInterface);
IQueryAssociations_Release(lpAssoc);
if(hRet == E_NOINTERFACE)
return CLASS_E_CLASSNOTAVAILABLE;
return hRet;
return SHCoCreateInstance( NULL, &clsid, NULL, refiid, lpInterface );
}
/*************************************************************************
@ -181,10 +116,8 @@ HRESULT WINAPI AssocQueryKeyW(ASSOCF cfFlags, ASSOCKEY assockey, LPCWSTR pszAsso
TRACE("(0x%8x,0x%8x,%s,%s,%p)\n", cfFlags, assockey, debugstr_w(pszAssoc),
debugstr_w(pszExtra), phkeyOut);
lpAssoc = IQueryAssociations_Constructor();
if (!lpAssoc)
return E_OUTOFMEMORY;
hRet = AssocCreate( CLSID_QueryAssociations, &IID_IQueryAssociations, (void **)&lpAssoc );
if (FAILED(hRet)) return hRet;
cfFlags &= SHLWAPI_DEF_ASSOCF;
hRet = IQueryAssociations_Init(lpAssoc, cfFlags, pszAssoc, NULL, NULL);
@ -254,10 +187,8 @@ HRESULT WINAPI AssocQueryStringW(ASSOCF cfFlags, ASSOCSTR str, LPCWSTR pszAssoc,
if (!pcchOut)
return E_UNEXPECTED;
lpAssoc = IQueryAssociations_Constructor();
if (!lpAssoc)
return E_OUTOFMEMORY;
hRet = AssocCreate( CLSID_QueryAssociations, &IID_IQueryAssociations, (void **)&lpAssoc );
if (FAILED(hRet)) return hRet;
hRet = IQueryAssociations_Init(lpAssoc, cfFlags & SHLWAPI_DEF_ASSOCF,
pszAssoc, NULL, NULL);
@ -350,10 +281,8 @@ HRESULT WINAPI AssocQueryStringByKeyW(ASSOCF cfFlags, ASSOCSTR str, HKEY hkAssoc
TRACE("(0x%8x,0x%8x,%p,%s,%p,%p)\n", cfFlags, str, hkAssoc,
debugstr_w(pszExtra), pszOut, pcchOut);
lpAssoc = IQueryAssociations_Constructor();
if (!lpAssoc)
return E_OUTOFMEMORY;
hRet = AssocCreate( CLSID_QueryAssociations, &IID_IQueryAssociations, (void **)&lpAssoc );
if (FAILED(hRet)) return hRet;
cfFlags &= SHLWAPI_DEF_ASSOCF;
hRet = IQueryAssociations_Init(lpAssoc, cfFlags, 0, hkAssoc, NULL);
@ -440,627 +369,3 @@ BOOL WINAPI AssocIsDangerous(LPCWSTR lpszAssoc)
FIXME("%s\n", debugstr_w(lpszAssoc));
return FALSE;
}
/**************************************************************************
* IQueryAssociations_QueryInterface {SHLWAPI}
*
* See IUnknown_QueryInterface.
*/
static HRESULT WINAPI IQueryAssociations_fnQueryInterface(
IQueryAssociations* iface,
REFIID riid,
LPVOID *ppvObj)
{
IQueryAssociationsImpl *This = (IQueryAssociationsImpl *)iface;
TRACE("(%p,%s,%p)\n",This, debugstr_guid(riid), ppvObj);
*ppvObj = NULL;
if (IsEqualIID(riid, &IID_IUnknown) ||
IsEqualIID(riid, &IID_IQueryAssociations))
{
*ppvObj = This;
IQueryAssociations_AddRef((IQueryAssociations*)*ppvObj);
TRACE("Returning IQueryAssociations (%p)\n", *ppvObj);
return S_OK;
}
TRACE("Returning E_NOINTERFACE\n");
return E_NOINTERFACE;
}
/**************************************************************************
* IQueryAssociations_AddRef {SHLWAPI}
*
* See IUnknown_AddRef.
*/
static ULONG WINAPI IQueryAssociations_fnAddRef(IQueryAssociations *iface)
{
IQueryAssociationsImpl *This = (IQueryAssociationsImpl *)iface;
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(ref before=%u)\n",This, refCount - 1);
return refCount;
}
/**************************************************************************
* IQueryAssociations_Release {SHLWAPI}
*
* See IUnknown_Release.
*/
static ULONG WINAPI IQueryAssociations_fnRelease(IQueryAssociations *iface)
{
IQueryAssociationsImpl *This = (IQueryAssociationsImpl *)iface;
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("(%p)->(ref before=%u)\n",This, refCount + 1);
if (!refCount)
{
TRACE("Destroying IQueryAssociations (%p)\n", This);
RegCloseKey(This->hkeySource);
RegCloseKey(This->hkeyProgID);
HeapFree(GetProcessHeap(), 0, This);
}
return refCount;
}
/**************************************************************************
* IQueryAssociations_Init {SHLWAPI}
*
* Initialise an IQueryAssociations object.
*
* PARAMS
* iface [I] IQueryAssociations interface to initialise
* cfFlags [I] ASSOCF_ flags from "shlwapi.h"
* pszAssoc [I] String for the root key name, or NULL if hkeyProgid is given
* hkeyProgid [I] Handle for the root key, or NULL if pszAssoc is given
* hWnd [I] Reserved, must be NULL.
*
* RETURNS
* Success: S_OK. iface is initialised with the parameters given.
* Failure: An HRESULT error code indicating the error.
*/
static HRESULT WINAPI IQueryAssociations_fnInit(
IQueryAssociations *iface,
ASSOCF cfFlags,
LPCWSTR pszAssoc,
HKEY hkeyProgid,
HWND hWnd)
{
static const WCHAR szProgID[] = {'P','r','o','g','I','D',0};
IQueryAssociationsImpl *This = (IQueryAssociationsImpl *)iface;
LONG ret;
TRACE("(%p)->(%d,%s,%p,%p)\n", iface,
cfFlags,
debugstr_w(pszAssoc),
hkeyProgid,
hWnd);
if (hWnd != NULL)
FIXME("hwnd != NULL not supported\n");
if (cfFlags != 0)
FIXME("unsupported flags: %x\n", cfFlags);
if (pszAssoc != NULL)
{
ret = RegOpenKeyExW(HKEY_CLASSES_ROOT,
pszAssoc,
0,
KEY_READ,
&This->hkeySource);
if (ret != ERROR_SUCCESS)
return E_FAIL;
/* if this is not a prog id */
if ((*pszAssoc == '.') || (*pszAssoc == '{'))
{
RegOpenKeyExW(This->hkeySource,
szProgID,
0,
KEY_READ,
&This->hkeyProgID);
}
else
This->hkeyProgID = This->hkeySource;
return S_OK;
}
else if (hkeyProgid != NULL)
{
This->hkeyProgID = hkeyProgid;
return S_OK;
}
else
return E_INVALIDARG;
}
static HRESULT ASSOC_GetValue(HKEY hkey, WCHAR ** pszText)
{
DWORD len;
LONG ret;
assert(pszText);
ret = RegQueryValueExW(hkey, NULL, 0, NULL, NULL, &len);
if (ret != ERROR_SUCCESS)
return HRESULT_FROM_WIN32(ret);
if (!len)
return E_FAIL;
*pszText = HeapAlloc(GetProcessHeap(), 0, len);
if (!*pszText)
return E_OUTOFMEMORY;
ret = RegQueryValueExW(hkey, NULL, 0, NULL, (LPBYTE)*pszText,
&len);
if (ret != ERROR_SUCCESS)
{
HeapFree(GetProcessHeap(), 0, *pszText);
return HRESULT_FROM_WIN32(ret);
}
return S_OK;
}
static HRESULT ASSOC_GetCommand(IQueryAssociationsImpl *This,
LPCWSTR pszExtra, WCHAR **ppszCommand)
{
HKEY hkeyCommand;
HKEY hkeyFile;
HKEY hkeyShell;
HKEY hkeyVerb;
HRESULT hr;
LONG ret;
WCHAR * pszExtraFromReg = NULL;
WCHAR * pszFileType;
static const WCHAR commandW[] = { 'c','o','m','m','a','n','d',0 };
static const WCHAR shellW[] = { 's','h','e','l','l',0 };
hr = ASSOC_GetValue(This->hkeySource, &pszFileType);
if (FAILED(hr))
return hr;
ret = RegOpenKeyExW(HKEY_CLASSES_ROOT, pszFileType, 0, KEY_READ, &hkeyFile);
HeapFree(GetProcessHeap(), 0, pszFileType);
if (ret != ERROR_SUCCESS)
return HRESULT_FROM_WIN32(ret);
ret = RegOpenKeyExW(hkeyFile, shellW, 0, KEY_READ, &hkeyShell);
RegCloseKey(hkeyFile);
if (ret != ERROR_SUCCESS)
return HRESULT_FROM_WIN32(ret);
if (!pszExtra)
{
hr = ASSOC_GetValue(hkeyShell, &pszExtraFromReg);
/* if no default action */
if (hr == E_FAIL || hr == HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND))
{
DWORD rlen;
ret = RegQueryInfoKeyW(hkeyShell, 0, 0, 0, 0, &rlen, 0, 0, 0, 0, 0, 0);
if (ret != ERROR_SUCCESS)
{
RegCloseKey(hkeyShell);
return HRESULT_FROM_WIN32(ret);
}
rlen++;
pszExtraFromReg = HeapAlloc(GetProcessHeap(), 0, rlen * sizeof(WCHAR));
if (!pszExtraFromReg)
{
RegCloseKey(hkeyShell);
return E_OUTOFMEMORY;
}
ret = RegEnumKeyExW(hkeyShell, 0, pszExtraFromReg, &rlen, 0, NULL, NULL, NULL);
if (ret != ERROR_SUCCESS)
{
RegCloseKey(hkeyShell);
return HRESULT_FROM_WIN32(ret);
}
}
else if (FAILED(hr))
{
RegCloseKey(hkeyShell);
return hr;
}
}
ret = RegOpenKeyExW(hkeyShell, pszExtra ? pszExtra : pszExtraFromReg, 0,
KEY_READ, &hkeyVerb);
HeapFree(GetProcessHeap(), 0, pszExtraFromReg);
RegCloseKey(hkeyShell);
if (ret != ERROR_SUCCESS)
return HRESULT_FROM_WIN32(ret);
ret = RegOpenKeyExW(hkeyVerb, commandW, 0, KEY_READ, &hkeyCommand);
RegCloseKey(hkeyVerb);
if (ret != ERROR_SUCCESS)
return HRESULT_FROM_WIN32(ret);
hr = ASSOC_GetValue(hkeyCommand, ppszCommand);
RegCloseKey(hkeyCommand);
return hr;
}
static HRESULT ASSOC_GetExecutable(IQueryAssociationsImpl *This,
LPCWSTR pszExtra, LPWSTR path,
DWORD pathlen, DWORD *len)
{
WCHAR *pszCommand;
WCHAR *pszStart;
WCHAR *pszEnd;
HRESULT hr;
assert(len);
hr = ASSOC_GetCommand(This, pszExtra, &pszCommand);
if (FAILED(hr))
return hr;
/* cleanup pszCommand */
if (pszCommand[0] == '"')
{
pszStart = pszCommand + 1;
pszEnd = strchrW(pszStart, '"');
}
else
{
pszStart = pszCommand;
pszEnd = strchrW(pszStart, ' ');
}
if (pszEnd)
*pszEnd = 0;
*len = SearchPathW(NULL, pszStart, NULL, pathlen, path, NULL);
HeapFree(GetProcessHeap(), 0, pszCommand);
if (!*len)
return HRESULT_FROM_WIN32(ERROR_FILE_NOT_FOUND);
return S_OK;
}
static HRESULT ASSOC_ReturnData(LPWSTR out, DWORD *outlen, LPCWSTR data,
DWORD datalen)
{
assert(outlen);
if (out)
{
if (*outlen < datalen)
{
*outlen = datalen;
return E_POINTER;
}
*outlen = datalen;
lstrcpynW(out, data, datalen);
return S_OK;
}
else
{
*outlen = datalen;
return S_FALSE;
}
}
/**************************************************************************
* IQueryAssociations_GetString {SHLWAPI}
*
* Get a file association string from the registry.
*
* PARAMS
* iface [I] IQueryAssociations interface to query
* cfFlags [I] ASSOCF_ flags from "shlwapi.h"
* str [I] Type of string to get (ASSOCSTR enum from "shlwapi.h")
* pszExtra [I] Extra information about the string location
* pszOut [O] Destination for the association string
* pcchOut [I/O] Length of pszOut
*
* RETURNS
* Success: S_OK. pszOut contains the string, pcchOut contains its length.
* Failure: An HRESULT error code indicating the error.
*/
static HRESULT WINAPI IQueryAssociations_fnGetString(
IQueryAssociations *iface,
ASSOCF cfFlags,
ASSOCSTR str,
LPCWSTR pszExtra,
LPWSTR pszOut,
DWORD *pcchOut)
{
IQueryAssociationsImpl *This = (IQueryAssociationsImpl *)iface;
const ASSOCF cfUnimplemented = ~(0);
DWORD len = 0;
HRESULT hr;
WCHAR path[MAX_PATH];
TRACE("(%p,0x%8x,0x%8x,%s,%p,%p)\n", This, cfFlags, str,
debugstr_w(pszExtra), pszOut, pcchOut);
if (cfFlags & cfUnimplemented)
FIXME("%08x: unimplemented flags!\n", cfFlags & cfUnimplemented);
if (!pcchOut)
return E_UNEXPECTED;
switch (str)
{
case ASSOCSTR_COMMAND:
{
WCHAR *command;
hr = ASSOC_GetCommand(This, pszExtra, &command);
if (SUCCEEDED(hr))
{
hr = ASSOC_ReturnData(pszOut, pcchOut, command, strlenW(command) + 1);
HeapFree(GetProcessHeap(), 0, command);
}
return hr;
}
case ASSOCSTR_EXECUTABLE:
{
hr = ASSOC_GetExecutable(This, pszExtra, path, MAX_PATH, &len);
if (FAILED(hr))
return hr;
len++;
return ASSOC_ReturnData(pszOut, pcchOut, path, len);
}
case ASSOCSTR_FRIENDLYDOCNAME:
{
WCHAR *pszFileType;
DWORD ret;
DWORD size;
hr = ASSOC_GetValue(This->hkeySource, &pszFileType);
if (FAILED(hr))
return hr;
size = 0;
ret = RegGetValueW(HKEY_CLASSES_ROOT, pszFileType, NULL, RRF_RT_REG_SZ, NULL, NULL, &size);
if (ret == ERROR_SUCCESS)
{
WCHAR *docName = HeapAlloc(GetProcessHeap(), 0, size);
if (docName)
{
ret = RegGetValueW(HKEY_CLASSES_ROOT, pszFileType, NULL, RRF_RT_REG_SZ, NULL, docName, &size);
if (ret == ERROR_SUCCESS)
hr = ASSOC_ReturnData(pszOut, pcchOut, docName, strlenW(docName) + 1);
else
hr = HRESULT_FROM_WIN32(ret);
HeapFree(GetProcessHeap(), 0, docName);
}
else
hr = E_OUTOFMEMORY;
}
else
hr = HRESULT_FROM_WIN32(ret);
HeapFree(GetProcessHeap(), 0, pszFileType);
return hr;
}
case ASSOCSTR_FRIENDLYAPPNAME:
{
PVOID verinfoW = NULL;
DWORD size, retval = 0;
UINT flen;
WCHAR *bufW;
static const WCHAR translationW[] = {
'\\','V','a','r','F','i','l','e','I','n','f','o',
'\\','T','r','a','n','s','l','a','t','i','o','n',0
};
static const WCHAR fileDescFmtW[] = {
'\\','S','t','r','i','n','g','F','i','l','e','I','n','f','o',
'\\','%','0','4','x','%','0','4','x',
'\\','F','i','l','e','D','e','s','c','r','i','p','t','i','o','n',0
};
WCHAR fileDescW[41];
hr = ASSOC_GetExecutable(This, pszExtra, path, MAX_PATH, &len);
if (FAILED(hr))
return hr;
retval = GetFileVersionInfoSizeW(path, &size);
if (!retval)
goto get_friendly_name_fail;
verinfoW = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, retval);
if (!verinfoW)
return E_OUTOFMEMORY;
if (!GetFileVersionInfoW(path, 0, retval, verinfoW))
goto get_friendly_name_fail;
if (VerQueryValueW(verinfoW, translationW, (LPVOID *)&bufW, &flen))
{
UINT i;
DWORD *langCodeDesc = (DWORD *)bufW;
for (i = 0; i < flen / sizeof(DWORD); i++)
{
sprintfW(fileDescW, fileDescFmtW, LOWORD(langCodeDesc[i]),
HIWORD(langCodeDesc[i]));
if (VerQueryValueW(verinfoW, fileDescW, (LPVOID *)&bufW, &flen))
{
/* Does strlenW(bufW) == 0 mean we use the filename? */
len = strlenW(bufW) + 1;
TRACE("found FileDescription: %s\n", debugstr_w(bufW));
return ASSOC_ReturnData(pszOut, pcchOut, bufW, len);
}
}
}
get_friendly_name_fail:
PathRemoveExtensionW(path);
PathStripPathW(path);
TRACE("using filename: %s\n", debugstr_w(path));
return ASSOC_ReturnData(pszOut, pcchOut, path, strlenW(path) + 1);
}
case ASSOCSTR_CONTENTTYPE:
{
static const WCHAR Content_TypeW[] = {'C','o','n','t','e','n','t',' ','T','y','p','e',0};
WCHAR *contentType;
DWORD ret;
DWORD size;
size = 0;
ret = RegGetValueW(This->hkeySource, NULL, Content_TypeW, RRF_RT_REG_SZ, NULL, NULL, &size);
if (ret != ERROR_SUCCESS)
return HRESULT_FROM_WIN32(ret);
contentType = HeapAlloc(GetProcessHeap(), 0, size);
if (contentType != NULL)
{
ret = RegGetValueW(This->hkeySource, NULL, Content_TypeW, RRF_RT_REG_SZ, NULL, contentType, &size);
if (ret == ERROR_SUCCESS)
hr = ASSOC_ReturnData(pszOut, pcchOut, contentType, strlenW(contentType) + 1);
else
hr = HRESULT_FROM_WIN32(ret);
HeapFree(GetProcessHeap(), 0, contentType);
}
else
hr = E_OUTOFMEMORY;
return hr;
}
case ASSOCSTR_DEFAULTICON:
{
static const WCHAR DefaultIconW[] = {'D','e','f','a','u','l','t','I','c','o','n',0};
WCHAR *pszFileType;
DWORD ret;
DWORD size;
HKEY hkeyFile;
hr = ASSOC_GetValue(This->hkeySource, &pszFileType);
if (FAILED(hr))
return hr;
ret = RegOpenKeyExW(HKEY_CLASSES_ROOT, pszFileType, 0, KEY_READ, &hkeyFile);
if (ret == ERROR_SUCCESS)
{
size = 0;
ret = RegGetValueW(hkeyFile, DefaultIconW, NULL, RRF_RT_REG_SZ, NULL, NULL, &size);
if (ret == ERROR_SUCCESS)
{
WCHAR *icon = HeapAlloc(GetProcessHeap(), 0, size);
if (icon)
{
ret = RegGetValueW(hkeyFile, DefaultIconW, NULL, RRF_RT_REG_SZ, NULL, icon, &size);
if (ret == ERROR_SUCCESS)
hr = ASSOC_ReturnData(pszOut, pcchOut, icon, strlenW(icon) + 1);
else
hr = HRESULT_FROM_WIN32(ret);
HeapFree(GetProcessHeap(), 0, icon);
}
else
hr = E_OUTOFMEMORY;
}
else
hr = HRESULT_FROM_WIN32(ret);
RegCloseKey(hkeyFile);
}
else
hr = HRESULT_FROM_WIN32(ret);
HeapFree(GetProcessHeap(), 0, pszFileType);
return hr;
}
default:
FIXME("assocstr %d unimplemented!\n", str);
return E_NOTIMPL;
}
}
/**************************************************************************
* IQueryAssociations_GetKey {SHLWAPI}
*
* Get a file association key from the registry.
*
* PARAMS
* iface [I] IQueryAssociations interface to query
* cfFlags [I] ASSOCF_ flags from "shlwapi.h"
* assockey [I] Type of key to get (ASSOCKEY enum from "shlwapi.h")
* pszExtra [I] Extra information about the key location
* phkeyOut [O] Destination for the association key
*
* RETURNS
* Success: S_OK. phkeyOut contains a handle to the key.
* Failure: An HRESULT error code indicating the error.
*/
static HRESULT WINAPI IQueryAssociations_fnGetKey(
IQueryAssociations *iface,
ASSOCF cfFlags,
ASSOCKEY assockey,
LPCWSTR pszExtra,
HKEY *phkeyOut)
{
IQueryAssociationsImpl *This = (IQueryAssociationsImpl *)iface;
FIXME("(%p,0x%8x,0x%8x,%s,%p)-stub!\n", This, cfFlags, assockey,
debugstr_w(pszExtra), phkeyOut);
return E_NOTIMPL;
}
/**************************************************************************
* IQueryAssociations_GetData {SHLWAPI}
*
* Get the data for a file association key from the registry.
*
* PARAMS
* iface [I] IQueryAssociations interface to query
* cfFlags [I] ASSOCF_ flags from "shlwapi.h"
* assocdata [I] Type of data to get (ASSOCDATA enum from "shlwapi.h")
* pszExtra [I] Extra information about the data location
* pvOut [O] Destination for the association key
* pcbOut [I/O] Size of pvOut
*
* RETURNS
* Success: S_OK. pszOut contains the data, pcbOut contains its length.
* Failure: An HRESULT error code indicating the error.
*/
static HRESULT WINAPI IQueryAssociations_fnGetData(
IQueryAssociations *iface,
ASSOCF cfFlags,
ASSOCDATA assocdata,
LPCWSTR pszExtra,
LPVOID pvOut,
DWORD *pcbOut)
{
IQueryAssociationsImpl *This = (IQueryAssociationsImpl *)iface;
FIXME("(%p,0x%8x,0x%8x,%s,%p,%p)-stub!\n", This, cfFlags, assocdata,
debugstr_w(pszExtra), pvOut, pcbOut);
return E_NOTIMPL;
}
/**************************************************************************
* IQueryAssociations_GetEnum {SHLWAPI}
*
* Not yet implemented in native Win32.
*
* PARAMS
* iface [I] IQueryAssociations interface to query
* cfFlags [I] ASSOCF_ flags from "shlwapi.h"
* assocenum [I] Type of enum to get (ASSOCENUM enum from "shlwapi.h")
* pszExtra [I] Extra information about the enum location
* riid [I] REFIID to look for
* ppvOut [O] Destination for the interface.
*
* RETURNS
* Success: S_OK.
* Failure: An HRESULT error code indicating the error.
*
* NOTES
* Presumably this function returns an enumerator object.
*/
static HRESULT WINAPI IQueryAssociations_fnGetEnum(
IQueryAssociations *iface,
ASSOCF cfFlags,
ASSOCENUM assocenum,
LPCWSTR pszExtra,
REFIID riid,
LPVOID *ppvOut)
{
IQueryAssociationsImpl *This = (IQueryAssociationsImpl *)iface;
FIXME("(%p,0x%8x,0x%8x,%s,%s,%p)-stub!\n", This, cfFlags, assocenum,
debugstr_w(pszExtra), debugstr_guid(riid), ppvOut);
return E_NOTIMPL;
}
static const IQueryAssociationsVtbl IQueryAssociations_vtbl =
{
IQueryAssociations_fnQueryInterface,
IQueryAssociations_fnAddRef,
IQueryAssociations_fnRelease,
IQueryAssociations_fnInit,
IQueryAssociations_fnGetString,
IQueryAssociations_fnGetKey,
IQueryAssociations_fnGetData,
IQueryAssociations_fnGetEnum
};

View file

@ -1474,6 +1474,43 @@ HRESULT WINAPI IUnknown_QueryService(IUnknown* lpUnknown, REFGUID sid, REFIID ri
return hRet;
}
/*************************************************************************
* @ [SHLWAPI.479]
*
* Call an object's UIActivateIO method.
*
* PARAMS
* unknown [I] Object to call the UIActivateIO method on
* activate [I] Parameter for UIActivateIO call
* msg [I] Parameter for UIActivateIO call
*
* RETURNS
* Success: Value of UI_ActivateIO call
* Failure: An HRESULT error code
*
* NOTES
* unknown is expected to support the IInputObject interface.
*/
HRESULT WINAPI IUnknown_UIActivateIO(IUnknown *unknown, BOOL activate, LPMSG msg)
{
IInputObject* object = NULL;
HRESULT ret;
if (!unknown)
return E_FAIL;
/* Get an IInputObject interface from the object */
ret = IUnknown_QueryInterface(unknown, &IID_IInputObject, (LPVOID*) &object);
if (ret == S_OK)
{
ret = IInputObject_UIActivateIO(object, activate, msg);
IUnknown_Release(object);
}
return ret;
}
/*************************************************************************
* @ [SHLWAPI.177]
*
@ -4532,3 +4569,131 @@ free_sids:
return psd;
}
/***********************************************************************
* SHCreatePropertyBagOnRegKey [SHLWAPI.471]
*
* Creates a property bag from a registry key
*
* PARAMS
* hKey [I] Handle to the desired registry key
* subkey [I] Name of desired subkey, or NULL to open hKey directly
* grfMode [I] Optional flags
* riid [I] IID of requested property bag interface
* ppv [O] Address to receive pointer to the new interface
*
* RETURNS
* success: 0
* failure: error code
*
*/
HRESULT WINAPI SHCreatePropertyBagOnRegKey (HKEY hKey, LPCWSTR subkey,
DWORD grfMode, REFIID riid, void **ppv)
{
FIXME("%p %s %d %s %p STUB\n", hKey, debugstr_w(subkey), grfMode,
debugstr_guid(riid), ppv);
return E_NOTIMPL;
}
/***********************************************************************
* SHGetViewStatePropertyBag [SHLWAPI.515]
*
* Retrieves a property bag in which the view state information of a folder
* can be stored.
*
* PARAMS
* pidl [I] PIDL of the folder requested
* bag_name [I] Name of the property bag requested
* flags [I] Optional flags
* riid [I] IID of requested property bag interface
* ppv [O] Address to receive pointer to the new interface
*
* RETURNS
* success: S_OK
* failure: error code
*
*/
HRESULT WINAPI SHGetViewStatePropertyBag(LPCITEMIDLIST pidl, LPWSTR bag_name,
DWORD flags, REFIID riid, void **ppv)
{
FIXME("%p %s %d %s %p STUB\n", pidl, debugstr_w(bag_name), flags,
debugstr_guid(riid), ppv);
return E_NOTIMPL;
}
/***********************************************************************
* SHFormatDateTimeW [SHLWAPI.354]
*
* Produces a string representation of a time.
*
* PARAMS
* fileTime [I] Pointer to FILETIME structure specifying the time
* flags [I] Flags specifying the desired output
* buf [O] Pointer to buffer for output
* bufSize [I] Number of characters that can be contained in buffer
*
* RETURNS
* success: number of characters written to the buffer
* failure: 0
*
*/
INT WINAPI SHFormatDateTimeW(const FILETIME UNALIGNED *fileTime, DWORD *flags,
LPWSTR buf, UINT bufSize)
{
FIXME("%p %p %s %d STUB\n", fileTime, flags, debugstr_w(buf), bufSize);
return 0;
}
/***********************************************************************
* SHFormatDateTimeA [SHLWAPI.353]
*
* See SHFormatDateTimeW.
*
*/
INT WINAPI SHFormatDateTimeA(const FILETIME UNALIGNED *fileTime, DWORD *flags,
LPCSTR buf, UINT bufSize)
{
WCHAR *bufW;
DWORD buflenW, convlen;
INT retval;
if (!buf || !bufSize)
return 0;
buflenW = bufSize;
bufW = HeapAlloc(GetProcessHeap(), 0, sizeof(WCHAR) * buflenW);
retval = SHFormatDateTimeW(fileTime, flags, bufW, buflenW);
if (retval != 0)
convlen = WideCharToMultiByte(CP_ACP, 0, bufW, -1, (LPSTR) buf, bufSize, NULL, NULL);
HeapFree(GetProcessHeap(), 0, bufW);
return retval;
}
/***********************************************************************
* ZoneCheckUrlExW [SHLWAPI.231]
*
* Checks the details of the security zone for the supplied site. (?)
*
* PARAMS
*
* szURL [I] Pointer to the URL to check
*
* Other parameters currently unknown.
*
* RETURNS
* unknown
*/
INT WINAPI ZoneCheckUrlExW(LPWSTR szURL, PVOID pUnknown, DWORD dwUnknown2,
DWORD dwUnknown3, DWORD dwUnknown4, DWORD dwUnknown5, DWORD dwUnknown6,
DWORD dwUnknown7)
{
FIXME("(%s,%p,%x,%x,%x,%x,%x,%x) STUB\n", debugstr_w(szURL), pUnknown, dwUnknown2,
dwUnknown3, dwUnknown4, dwUnknown5, dwUnknown6, dwUnknown7);
return 0;
}

View file

@ -228,7 +228,7 @@
228 stub -noname ZoneCheckUrlA
229 stub -noname ZoneCheckUrlW
230 stub -noname ZoneCheckUrlExA
231 stub -noname ZoneCheckUrlExW
231 stdcall -noname ZoneCheckUrlExW(wstr ptr long long long long long long)
232 stub -noname ZoneCheckUrlExCacheA
233 stub -noname ZoneCheckUrlExCacheW
234 stub -noname ZoneCheckHost
@ -350,8 +350,8 @@
350 stdcall -noname GetFileVersionInfoSizeWrapW(wstr ptr)
351 stdcall -noname GetFileVersionInfoWrapW(wstr long long ptr)
352 stdcall -noname VerQueryValueWrapW(ptr wstr ptr ptr)
353 stub -noname SHFormatDateTimeA
354 stub -noname SHFormatDateTimeW
353 stdcall -noname SHFormatDateTimeA(ptr ptr str long)
354 stdcall -noname SHFormatDateTimeW(ptr ptr wstr long)
355 stdcall -noname IUnknown_EnableModeless(ptr long)
356 stdcall -noname CreateAllAccessSecurityAttributes(ptr ptr long)
357 stdcall -noname SHGetNewLinkInfoWrapW(wstr wstr wstr long long)
@ -459,7 +459,7 @@
459 stdcall -noname SHExpandEnvironmentStringsA(str ptr long) kernel32.ExpandEnvironmentStringsA
460 stdcall -noname SHExpandEnvironmentStringsW(wstr ptr long) kernel32.ExpandEnvironmentStringsW
461 stdcall -noname SHGetAppCompatFlags(long)
462 stub -noname UrlFixupW
462 stdcall -noname UrlFixupW(wstr wstr long)
463 stub -noname SHExpandEnvironmentStringsForUserA
464 stub -noname SHExpandEnvironmentStringsForUserW
465 stub -noname PathUnExpandEnvStringsForUserA
@ -468,7 +468,7 @@
468 stub -noname RunIndirectRegCommand
469 stub -noname RunRegCommand
470 stub -noname IUnknown_ProfferServiceOld
471 stub -noname SHCreatePropertyBagOnRegKey
471 stdcall -noname SHCreatePropertyBagOnRegKey(long wstr long ptr ptr)
472 stub -noname SHCreatePropertyBagOnProfileSelection
473 stub -noname SHGetIniStringUTF7W
474 stub -noname SHSetIniStringUTF7W
@ -476,7 +476,7 @@
476 stub -noname SHGetObjectCompatFlags
477 stub -noname SHCreatePropertyBagOnMemory
478 stdcall -noname IUnknown_TranslateAcceleratorIO(ptr ptr)
479 stub -noname IUnknown_UIActivateIO
479 stdcall -noname IUnknown_UIActivateIO(ptr long ptr)
480 stdcall -noname UrlCrackW(wstr long long ptr) wininet.InternetCrackUrlW
481 stdcall -noname IUnknown_HasFocusIO(ptr)
482 stub -noname SHMessageBoxHelpA
@ -508,7 +508,7 @@
512 stub -noname IStream_ReadPidl
513 stub -noname IStream_WritePidl
514 stdcall -noname IUnknown_ProfferService(ptr ptr ptr ptr)
515 stub -noname SHGetViewStatePropertyBag
515 stdcall -noname SHGetViewStatePropertyBag(ptr wstr long ptr ptr)
516 stdcall -noname SKGetValueW(long wstr wstr long long long)
517 stub -noname SKSetValueW
518 stub -noname SKDeleteValueW
@ -757,6 +757,7 @@
@ stdcall StrChrA (str long)
@ stdcall StrChrIA (str long)
@ stdcall StrChrIW (wstr long)
@ stdcall StrChrNW(wstr long long)
@ stdcall StrChrW (wstr long)
@ stdcall StrCmpIW (wstr wstr)
@ stdcall StrCmpLogicalW(wstr wstr)

View file

@ -318,6 +318,25 @@ LPWSTR WINAPI StrChrIW(LPCWSTR lpszStr, WCHAR ch)
return (LPWSTR)lpszStr;
}
/*************************************************************************
* StrChrNW [SHLWAPI.@]
*/
LPWSTR WINAPI StrChrNW(LPCWSTR lpszStr, WCHAR ch, UINT cchMax)
{
TRACE("(%s(%i),%i)\n", debugstr_wn(lpszStr,cchMax), cchMax, ch);
if (lpszStr)
{
while (*lpszStr && cchMax-- > 0)
{
if (*lpszStr == ch)
return (LPWSTR)lpszStr;
lpszStr++;
}
}
return NULL;
}
/*************************************************************************
* StrCmpIW [SHLWAPI.@]
*

View file

@ -2382,3 +2382,35 @@ HRESULT WINAPI MLBuildResURLW(LPCWSTR lpszLibName, HMODULE hMod, DWORD dwFlags,
}
return hRet;
}
/***********************************************************************
* UrlFixupW [SHLWAPI.462]
*
* Checks the scheme part of a URL and attempts to correct misspellings.
*
* PARAMS
* lpszUrl [I] Pointer to the URL to be corrected
* lpszTranslatedUrl [O] Pointer to a buffer to store corrected URL
* dwMaxChars [I] Maximum size of corrected URL
*
* RETURNS
* success: S_OK if URL corrected or already correct
* failure: S_FALSE if unable to correct / COM error code if other error
*
*/
HRESULT WINAPI UrlFixupW(LPCWSTR url, LPWSTR translatedUrl, DWORD maxChars)
{
DWORD srcLen;
FIXME("(%s,%p,%d) STUB\n", debugstr_w(url), translatedUrl, maxChars);
if (!url)
return E_FAIL;
srcLen = lstrlenW(url);
/* For now just copy the URL directly */
lstrcpynW(translatedUrl, url, (maxChars < srcLen) ? maxChars : srcLen);
return S_OK;
}

View file

@ -952,7 +952,7 @@ HRESULT CreateComponentEnumerator(DWORD componentTypes, DWORD options, IEnumUnkn
list_add_tail(&This->objects, &item->entry);
}
if (!SUCCEEDED(hr))
if (FAILED(hr))
{
HeapFree(GetProcessHeap(), 0, item);
hr = S_OK;

View file

@ -129,13 +129,12 @@ static HRESULT WINAPI StreamOnMemory_Seek(IStream *iface,
LARGE_INTEGER NewPosition;
TRACE("(%p)\n", This);
if (dlibMove.QuadPart > 0xFFFFFFFF) return HRESULT_FROM_WIN32(ERROR_ARITHMETIC_OVERFLOW);
if (dwOrigin == STREAM_SEEK_SET) NewPosition.QuadPart = dlibMove.QuadPart;
else if (dwOrigin == STREAM_SEEK_CUR) NewPosition.QuadPart = This->dwCurPos + dlibMove.QuadPart;
else if (dwOrigin == STREAM_SEEK_END) NewPosition.QuadPart = This->dwMemsize + dlibMove.QuadPart;
else return E_INVALIDARG;
if (NewPosition.u.HighPart) return HRESULT_FROM_WIN32(ERROR_ARITHMETIC_OVERFLOW);
if (NewPosition.QuadPart > This->dwMemsize) return E_INVALIDARG;
if (NewPosition.QuadPart < 0) return E_INVALIDARG;
This->dwCurPos = NewPosition.u.LowPart;