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@ ...@@ -5,6 +5,7 @@ SRCDIR = @srcdir@
VPATH = @srcdir@ VPATH = @srcdir@
MODULE = shlwapi.dll MODULE = shlwapi.dll
IMPORTS = ole32 user32 gdi32 advapi32 kernel32 IMPORTS = ole32 user32 gdi32 advapi32 kernel32
DELAYIMPORTS = oleaut32
EXTRALIBS = -luuid $(LIBUNICODE) EXTRALIBS = -luuid $(LIBUNICODE)
C_SRCS = \ C_SRCS = \
......
...@@ -414,11 +414,20 @@ HRESULT WINAPI AssocQueryStringByKeyA(ASSOCF cfFlags, ASSOCSTR str, HKEY hkAssoc ...@@ -414,11 +414,20 @@ HRESULT WINAPI AssocQueryStringByKeyA(ASSOCF cfFlags, ASSOCSTR str, HKEY hkAssoc
/************************************************************************** /**************************************************************************
* AssocIsDangerous (SHLWAPI.@) * 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); FIXME("%s\n", debugstr_w(lpszAssoc));
return S_FALSE; return FALSE;
} }
/************************************************************************** /**************************************************************************
......
...@@ -796,10 +796,11 @@ ...@@ -796,10 +796,11 @@
# exported in later versions # exported in later versions
@ stdcall AssocIsDangerous(long) @ stdcall AssocIsDangerous(long)
@ stdcall StrRetToBufA (ptr ptr ptr long) @ stdcall StrRetToBufA(ptr ptr ptr long)
@ stdcall StrRetToBufW (ptr ptr ptr long) @ stdcall StrRetToBufW(ptr ptr ptr long)
@ stdcall StrRetToStrA (ptr ptr ptr) @ stdcall StrRetToBSTR(ptr ptr ptr)
@ stdcall StrRetToStrW (ptr ptr ptr) @ stdcall StrRetToStrA(ptr ptr ptr)
@ stdcall StrRetToStrW(ptr ptr ptr)
@ stdcall SHRegGetPathA(long str str ptr long) @ stdcall SHRegGetPathA(long str str ptr long)
@ stdcall SHRegGetPathW(long wstr wstr ptr long) @ stdcall SHRegGetPathW(long wstr wstr ptr long)
@ stdcall PathIsDirectoryEmptyA(str) @ stdcall PathIsDirectoryEmptyA(str)
......
...@@ -1333,7 +1333,7 @@ LPWSTR WINAPI StrCatBuffW(LPWSTR lpszStr, LPCWSTR lpszCat, INT cchMax) ...@@ -1333,7 +1333,7 @@ LPWSTR WINAPI StrCatBuffW(LPWSTR lpszStr, LPCWSTR lpszCat, INT cchMax)
* *
* PARAMS * PARAMS
* lpStrRet [O] STRRET to convert * 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 * lpszDest [O] Destination for normal string
* dwLen [I] Length of lpszDest * dwLen [I] Length of lpszDest
* *
...@@ -1444,7 +1444,7 @@ HRESULT WINAPI StrRetToBufW (LPSTRRET src, const ITEMIDLIST *pidl, LPWSTR dest, ...@@ -1444,7 +1444,7 @@ HRESULT WINAPI StrRetToBufW (LPSTRRET src, const ITEMIDLIST *pidl, LPWSTR dest,
* *
* PARAMS * PARAMS
* lpStrRet [O] STRRET to convert * 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 * ppszName [O] Destination for converted string
* *
* RETURNS * RETURNS
...@@ -1508,6 +1508,71 @@ HRESULT WINAPI StrRetToStrW(LPSTRRET lpStrRet, const ITEMIDLIST *pidl, LPWSTR *p ...@@ -1508,6 +1508,71 @@ HRESULT WINAPI StrRetToStrW(LPSTRRET lpStrRet, const ITEMIDLIST *pidl, LPWSTR *p
return hRet; 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.@] * StrFormatKBSizeA [SHLWAPI.@]
* *
......
...@@ -22,6 +22,7 @@ ...@@ -22,6 +22,7 @@
#define __WINE_SHLWAPI_H #define __WINE_SHLWAPI_H
#include <objbase.h> #include <objbase.h>
#include <shtypes.h>
#ifdef __cplusplus #ifdef __cplusplus
extern "C" { extern "C" {
...@@ -279,6 +280,8 @@ HRESULT WINAPI AssocQueryKeyA(ASSOCF,ASSOCKEY,LPCSTR,LPCSTR,PHKEY); ...@@ -279,6 +280,8 @@ HRESULT WINAPI AssocQueryKeyA(ASSOCF,ASSOCKEY,LPCSTR,LPCSTR,PHKEY);
HRESULT WINAPI AssocQueryKeyW(ASSOCF,ASSOCKEY,LPCWSTR,LPCWSTR,PHKEY); HRESULT WINAPI AssocQueryKeyW(ASSOCF,ASSOCKEY,LPCWSTR,LPCWSTR,PHKEY);
#define AssocQueryKey WINELIB_NAME_AW(AssocQueryKey) #define AssocQueryKey WINELIB_NAME_AW(AssocQueryKey)
BOOL WINAPI AssocIsDangerous(LPCWSTR);
#endif /* NO_SHLWAPI_REG */ #endif /* NO_SHLWAPI_REG */
...@@ -819,18 +822,16 @@ BOOL IntlStrEqWorkerW(BOOL,LPCWSTR,LPCWSTR,int); ...@@ -819,18 +822,16 @@ BOOL IntlStrEqWorkerW(BOOL,LPCWSTR,LPCWSTR,int);
#define IntlStrEqNIW(s1,s2,n) IntlStrEqWorkerW(FALSE,s1,s2,n) #define IntlStrEqNIW(s1,s2,n) IntlStrEqWorkerW(FALSE,s1,s2,n)
#define IntlStrEqNI WINELIB_NAME_AW(IntlStrEqNI) #define IntlStrEqNI WINELIB_NAME_AW(IntlStrEqNI)
/* Undocumented */ HRESULT WINAPI StrRetToStrA(STRRET*,LPCITEMIDLIST,LPSTR*);
struct _STRRET; HRESULT WINAPI StrRetToStrW(STRRET*,LPCITEMIDLIST,LPWSTR*);
struct _ITEMIDLIST;
HRESULT WINAPI StrRetToStrA(struct _STRRET*,const struct _ITEMIDLIST*,LPSTR*);
HRESULT WINAPI StrRetToStrW(struct _STRRET*,const struct _ITEMIDLIST*,LPWSTR*);
#define StrRetToStr WINELIB_NAME_AW(StrRetToStr) #define StrRetToStr WINELIB_NAME_AW(StrRetToStr)
HRESULT WINAPI StrRetToBufA(struct _STRRET*,const struct _ITEMIDLIST*,LPSTR,UINT); HRESULT WINAPI StrRetToBufA(STRRET*,LPCITEMIDLIST,LPSTR,UINT);
HRESULT WINAPI StrRetToBufW(struct _STRRET*,const struct _ITEMIDLIST*,LPWSTR,UINT); HRESULT WINAPI StrRetToBufW(STRRET*,LPCITEMIDLIST,LPWSTR,UINT);
#define StrRetToBuf WINELIB_NAME_AW(StrRetToBuf) #define StrRetToBuf WINELIB_NAME_AW(StrRetToBuf)
HRESULT WINAPI StrRetToBSTR(STRRET*,LPCITEMIDLIST,BSTR*);
#endif /* NO_SHLWAPI_STRFCNS */ #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