Commit d015d3b9 authored by Jon Griffiths's avatar Jon Griffiths Committed by Alexandre Julliard

Add some missing prototypes, fix AssocIsDangerous.

Implement StrRetToBSTR, delay-import oleaut32.
parent df24e106
......@@ -5,6 +5,7 @@ SRCDIR = @srcdir@
VPATH = @srcdir@
MODULE = shlwapi.dll
IMPORTS = ole32 user32 gdi32 advapi32 kernel32
DELAYIMPORTS = oleaut32
EXTRALIBS = -luuid $(LIBUNICODE)
C_SRCS = \
......
......@@ -414,11 +414,20 @@ HRESULT WINAPI AssocQueryStringByKeyA(ASSOCF cfFlags, ASSOCSTR str, HKEY hkAssoc
/**************************************************************************
* AssocIsDangerous (SHLWAPI.@)
*
* Determine if a file association is dangerous (potentially malware).
*
* PARAMS
* lpszAssoc [I] Name of file or file extention to check.
*
* RETURNS
* TRUE, if lpszAssoc may potentially be malware (executable),
* FALSE, Otherwise.
*/
HRESULT WINAPI AssocIsDangerous( ASSOCSTR str )
BOOL WINAPI AssocIsDangerous(LPCWSTR lpszAssoc)
{
FIXME("%08x\n", str);
return S_FALSE;
FIXME("%s\n", debugstr_w(lpszAssoc));
return FALSE;
}
/**************************************************************************
......
......@@ -796,10 +796,11 @@
# exported in later versions
@ stdcall AssocIsDangerous(long)
@ stdcall StrRetToBufA (ptr ptr ptr long)
@ stdcall StrRetToBufW (ptr ptr ptr long)
@ stdcall StrRetToStrA (ptr ptr ptr)
@ stdcall StrRetToStrW (ptr ptr ptr)
@ stdcall StrRetToBufA(ptr ptr ptr long)
@ stdcall StrRetToBufW(ptr ptr ptr long)
@ stdcall StrRetToBSTR(ptr ptr ptr)
@ stdcall StrRetToStrA(ptr ptr ptr)
@ stdcall StrRetToStrW(ptr ptr ptr)
@ stdcall SHRegGetPathA(long str str ptr long)
@ stdcall SHRegGetPathW(long wstr wstr ptr long)
@ stdcall PathIsDirectoryEmptyA(str)
......
......@@ -1333,7 +1333,7 @@ LPWSTR WINAPI StrCatBuffW(LPWSTR lpszStr, LPCWSTR lpszCat, INT cchMax)
*
* PARAMS
* lpStrRet [O] STRRET to convert
* pIdl [I] ITEMIDLIST for lpStrRet->uType = STRRET_OFFSETA
* pIdl [I] ITEMIDLIST for lpStrRet->uType == STRRET_OFFSET
* lpszDest [O] Destination for normal string
* dwLen [I] Length of lpszDest
*
......@@ -1444,7 +1444,7 @@ HRESULT WINAPI StrRetToBufW (LPSTRRET src, const ITEMIDLIST *pidl, LPWSTR dest,
*
* PARAMS
* lpStrRet [O] STRRET to convert
* pidl [I] ITEMIDLIST for lpStrRet->uType = STRRET_OFFSETA
* pidl [I] ITEMIDLIST for lpStrRet->uType == STRRET_OFFSET
* ppszName [O] Destination for converted string
*
* RETURNS
......@@ -1508,6 +1508,71 @@ HRESULT WINAPI StrRetToStrW(LPSTRRET lpStrRet, const ITEMIDLIST *pidl, LPWSTR *p
return hRet;
}
/* Create an ASCII string copy using SysAllocString() */
static HRESULT _SHStrDupAToBSTR(LPCSTR src, BSTR *pBstrOut)
{
*pBstrOut = NULL;
if (src)
{
INT len = MultiByteToWideChar(CP_ACP, 0, src, -1, NULL, 0);
WCHAR* szTemp = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
if (szTemp)
{
MultiByteToWideChar(CP_ACP, 0, src, -1, szTemp, len);
*pBstrOut = SysAllocString(szTemp);
HeapFree(GetProcessHeap(), 0, szTemp);
if (*pBstrOut)
return S_OK;
}
}
return E_OUTOFMEMORY;
}
/*************************************************************************
* StrRetToBSTR [SHLWAPI.@]
*
* Converts a STRRET to a BSTR.
*
* PARAMS
* lpStrRet [O] STRRET to convert
* pidl [I] ITEMIDLIST for lpStrRet->uType = STRRET_OFFSET
* pBstrOut [O] Destination for converted BSTR
*
* RETURNS
* Success: S_OK. pBstrOut contains the new string.
* Failure: E_FAIL, if any parameters are invalid.
*/
HRESULT WINAPI StrRetToBSTR(STRRET *lpStrRet, LPCITEMIDLIST pidl, BSTR* pBstrOut)
{
HRESULT hRet = E_FAIL;
switch (lpStrRet->uType)
{
case STRRET_WSTR:
*pBstrOut = SysAllocString(lpStrRet->u.pOleStr);
if (*pBstrOut)
hRet = S_OK;
CoTaskMemFree(lpStrRet->u.pOleStr);
break;
case STRRET_CSTR:
hRet = _SHStrDupAToBSTR(lpStrRet->u.cStr, pBstrOut);
break;
case STRRET_OFFSET:
hRet = _SHStrDupAToBSTR(((LPCSTR)&pidl->mkid) + lpStrRet->u.uOffset, pBstrOut);
break;
default:
*pBstrOut = NULL;
}
return hRet;
}
/*************************************************************************
* StrFormatKBSizeA [SHLWAPI.@]
*
......
......@@ -22,6 +22,7 @@
#define __WINE_SHLWAPI_H
#include <objbase.h>
#include <shtypes.h>
#ifdef __cplusplus
extern "C" {
......@@ -279,6 +280,8 @@ HRESULT WINAPI AssocQueryKeyA(ASSOCF,ASSOCKEY,LPCSTR,LPCSTR,PHKEY);
HRESULT WINAPI AssocQueryKeyW(ASSOCF,ASSOCKEY,LPCWSTR,LPCWSTR,PHKEY);
#define AssocQueryKey WINELIB_NAME_AW(AssocQueryKey)
BOOL WINAPI AssocIsDangerous(LPCWSTR);
#endif /* NO_SHLWAPI_REG */
......@@ -819,18 +822,16 @@ BOOL IntlStrEqWorkerW(BOOL,LPCWSTR,LPCWSTR,int);
#define IntlStrEqNIW(s1,s2,n) IntlStrEqWorkerW(FALSE,s1,s2,n)
#define IntlStrEqNI WINELIB_NAME_AW(IntlStrEqNI)
/* Undocumented */
struct _STRRET;
struct _ITEMIDLIST;
HRESULT WINAPI StrRetToStrA(struct _STRRET*,const struct _ITEMIDLIST*,LPSTR*);
HRESULT WINAPI StrRetToStrW(struct _STRRET*,const struct _ITEMIDLIST*,LPWSTR*);
HRESULT WINAPI StrRetToStrA(STRRET*,LPCITEMIDLIST,LPSTR*);
HRESULT WINAPI StrRetToStrW(STRRET*,LPCITEMIDLIST,LPWSTR*);
#define StrRetToStr WINELIB_NAME_AW(StrRetToStr)
HRESULT WINAPI StrRetToBufA(struct _STRRET*,const struct _ITEMIDLIST*,LPSTR,UINT);
HRESULT WINAPI StrRetToBufW(struct _STRRET*,const struct _ITEMIDLIST*,LPWSTR,UINT);
HRESULT WINAPI StrRetToBufA(STRRET*,LPCITEMIDLIST,LPSTR,UINT);
HRESULT WINAPI StrRetToBufW(STRRET*,LPCITEMIDLIST,LPWSTR,UINT);
#define StrRetToBuf WINELIB_NAME_AW(StrRetToBuf)
HRESULT WINAPI StrRetToBSTR(STRRET*,LPCITEMIDLIST,BSTR*);
#endif /* NO_SHLWAPI_STRFCNS */
......
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