Sync to Wine-20050628:

Mike McCormack <mike@codeweavers.com>
- Switch IShellLink to use shlwapi.SHCreateStreamOnFileW.
Dmitry Timoshkov <dmitry@codeweavers.com>
- Make remaining OLE interface vtables const.
Alexandre Julliard <julliard@winehq.org>
- Sort entry points in the same order as Windows.
Stefan Huehner <stefan@huehner.org>
- Fix some more -Wstrict-prototypes warnings.

svn path=/trunk/; revision=17033
This commit is contained in:
Gé van Geldorp 2005-08-03 21:34:01 +00:00
parent fd1eac7f05
commit 0f766beac3
5 changed files with 109 additions and 98 deletions

View file

@ -58,13 +58,13 @@ WINE_DEFAULT_DEBUG_CHANNEL(shell);
typedef struct
{
IQueryAssociationsVtbl *lpVtbl;
const IQueryAssociationsVtbl *lpVtbl;
LONG ref;
HKEY hkeySource;
HKEY hkeyProgID;
} IQueryAssociationsImpl;
static struct IQueryAssociationsVtbl IQueryAssociations_vtbl;
static const IQueryAssociationsVtbl IQueryAssociations_vtbl;
/**************************************************************************
* IQueryAssociations_Constructor [internal]
@ -693,7 +693,7 @@ static HRESULT WINAPI IQueryAssociations_fnGetEnum(
return E_NOTIMPL;
}
static struct IQueryAssociationsVtbl IQueryAssociations_vtbl =
static const IQueryAssociationsVtbl IQueryAssociations_vtbl =
{
IQueryAssociations_fnQueryInterface,
IQueryAssociations_fnAddRef,

View file

@ -35,10 +35,14 @@
WINE_DEFAULT_DEBUG_CHANNEL(shell);
#define STGM_ACCESS_MODE(stgm) ((stgm)&0x0000f)
#define STGM_SHARE_MODE(stgm) ((stgm)&0x000f0)
#define STGM_CREATE_MODE(stgm) ((stgm)&0x0f000)
/* Layout of ISHFileStream object */
typedef struct
{
IStreamVtbl *lpVtbl;
const IStreamVtbl *lpVtbl;
ULONG ref;
HANDLE hFile;
DWORD dwMode;
@ -65,8 +69,7 @@ static HRESULT WINAPI IStream_fnQueryInterface(IStream *iface, REFIID riid, LPVO
IsEqualIID(riid, &IID_IStream))
{
*ppvObj = This;
IStream_AddRef((IStream*)*ppvObj);
IStream_AddRef(iface);
return S_OK;
}
return E_NOINTERFACE;
@ -112,22 +115,21 @@ static ULONG WINAPI IStream_fnRelease(IStream *iface)
static HRESULT WINAPI IStream_fnRead(IStream *iface, void* pv, ULONG cb, ULONG* pcbRead)
{
ISHFileStream *This = (ISHFileStream *)iface;
HRESULT hRet = S_OK;
DWORD dwRead = 0;
TRACE("(%p,%p,0x%08lx,%p)\n", This, pv, cb, pcbRead);
if (!pv)
hRet = STG_E_INVALIDPOINTER;
else if (!ReadFile(This->hFile, pv, cb, &dwRead, NULL))
return STG_E_INVALIDPOINTER;
if (!ReadFile(This->hFile, pv, cb, &dwRead, NULL))
{
hRet = (HRESULT)GetLastError();
if(hRet > 0)
hRet = HRESULT_FROM_WIN32(hRet);
ERR("error %ld reading file\n", GetLastError());
return HRESULT_FROM_WIN32(GetLastError());
}
if (pcbRead)
*pcbRead = dwRead;
return hRet;
return S_OK;
}
/**************************************************************************
@ -136,24 +138,28 @@ static HRESULT WINAPI IStream_fnRead(IStream *iface, void* pv, ULONG cb, ULONG*
static HRESULT WINAPI IStream_fnWrite(IStream *iface, const void* pv, ULONG cb, ULONG* pcbWritten)
{
ISHFileStream *This = (ISHFileStream *)iface;
HRESULT hRet = S_OK;
DWORD dwWritten = 0;
TRACE("(%p,%p,0x%08lx,%p)\n", This, pv, cb, pcbWritten);
if (!pv)
hRet = STG_E_INVALIDPOINTER;
else if (!(This->dwMode & STGM_WRITE))
hRet = E_FAIL;
else if (!WriteFile(This->hFile, pv, cb, &dwWritten, NULL))
return STG_E_INVALIDPOINTER;
switch (STGM_ACCESS_MODE(This->dwMode))
{
hRet = (HRESULT)GetLastError();
if(hRet > 0)
hRet = HRESULT_FROM_WIN32(hRet);
case STGM_WRITE:
case STGM_READWRITE:
break;
default:
return E_FAIL;
}
if (!WriteFile(This->hFile, pv, cb, &dwWritten, NULL))
return HRESULT_FROM_WIN32(GetLastError());
if (pcbWritten)
*pcbWritten = dwWritten;
return hRet;
return S_OK;
}
/**************************************************************************
@ -169,6 +175,8 @@ static HRESULT WINAPI IStream_fnSeek(IStream *iface, LARGE_INTEGER dlibMove,
IStream_fnCommit(iface, 0); /* If ever buffered, this will be needed */
dwPos = SetFilePointer(This->hFile, dlibMove.u.LowPart, NULL, dwOrigin);
if( dwPos == INVALID_SET_FILE_POINTER )
return E_FAIL;
if (pNewPos)
{
@ -186,8 +194,15 @@ static HRESULT WINAPI IStream_fnSetSize(IStream *iface, ULARGE_INTEGER libNewSiz
ISHFileStream *This = (ISHFileStream *)iface;
TRACE("(%p,%ld)\n", This, libNewSize.u.LowPart);
IStream_fnCommit(iface, 0); /* If ever buffered, this will be needed */
return E_NOTIMPL;
if( ! SetFilePointer( This->hFile, libNewSize.QuadPart, NULL, FILE_BEGIN ) )
return E_FAIL;
if( ! SetEndOfFile( This->hFile ) )
return E_FAIL;
return S_OK;
}
/**************************************************************************
@ -325,7 +340,7 @@ static HRESULT WINAPI IStream_fnClone(IStream *iface, IStream** ppstm)
return E_NOTIMPL;
}
static struct IStreamVtbl SHLWAPI_fsVTable =
static const IStreamVtbl SHLWAPI_fsVTable =
{
IStream_fnQueryInterface,
IStream_fnAddRef,
@ -403,29 +418,27 @@ HRESULT WINAPI SHCreateStreamOnFileEx(LPCWSTR lpszPath, DWORD dwMode,
*lppStream = NULL;
if (dwMode & ~(STGM_WRITE|STGM_READWRITE|STGM_SHARE_DENY_NONE|STGM_SHARE_DENY_READ|STGM_CREATE))
{
WARN("Invalid mode 0x%08lX\n", dwMode);
if (dwMode & STGM_TRANSACTED)
return E_INVALIDARG;
}
/* Access */
switch (dwMode & (STGM_WRITE|STGM_READWRITE))
switch (STGM_ACCESS_MODE(dwMode))
{
case STGM_READWRITE|STGM_WRITE:
case STGM_READWRITE:
dwAccess = GENERIC_READ|GENERIC_WRITE;
break;
case STGM_WRITE:
dwAccess = GENERIC_WRITE;
break;
default:
case STGM_READ:
dwAccess = GENERIC_READ;
break;
default:
return E_INVALIDARG;
}
/* Sharing */
switch (dwMode & STGM_SHARE_DENY_READ)
switch (STGM_SHARE_MODE(dwMode))
{
case STGM_SHARE_DENY_READ:
dwShare = FILE_SHARE_WRITE;
@ -436,17 +449,24 @@ HRESULT WINAPI SHCreateStreamOnFileEx(LPCWSTR lpszPath, DWORD dwMode,
case STGM_SHARE_EXCLUSIVE:
dwShare = 0;
break;
default:
case STGM_SHARE_DENY_NONE:
dwShare = FILE_SHARE_READ|FILE_SHARE_WRITE;
break;
default:
return E_INVALIDARG;
}
/* FIXME: Creation Flags, MSDN is fuzzy on the mapping... */
if (dwMode == STGM_FAILIFTHERE)
dwCreate = bCreate ? CREATE_NEW : OPEN_EXISTING;
else if (dwMode & STGM_CREATE)
switch(STGM_CREATE_MODE(dwMode))
{
case STGM_FAILIFTHERE:
dwCreate = OPEN_EXISTING;
break;
case STGM_CREATE:
dwCreate = CREATE_ALWAYS;
else
dwCreate = OPEN_ALWAYS;
break;
default:
return E_INVALIDARG;
}
/* Open HANDLE to file */
hFile = CreateFileW(lpszPath, dwAccess, dwShare, NULL, dwCreate,
@ -478,19 +498,12 @@ HRESULT WINAPI SHCreateStreamOnFileEx(LPCWSTR lpszPath, DWORD dwMode,
HRESULT WINAPI SHCreateStreamOnFileW(LPCWSTR lpszPath, DWORD dwMode,
IStream **lppStream)
{
DWORD dwAttr;
TRACE("(%s,%ld,%p)\n", debugstr_w(lpszPath), dwMode, lppStream);
if (!lpszPath || !lppStream)
return E_INVALIDARG;
dwAttr = GetFileAttributesW(lpszPath);
if (dwAttr == INVALID_FILE_ATTRIBUTES)
dwAttr = 0;
return SHCreateStreamOnFileEx(lpszPath, dwMode|STGM_WRITE, dwAttr,
TRUE, NULL, lppStream);
return SHCreateStreamOnFileEx(lpszPath, dwMode, 0, FALSE, NULL, lppStream);
}
/*************************************************************************

View file

@ -2979,7 +2979,7 @@ UINT WINAPI PathGetCharTypeW(WCHAR ch)
*
* Internal helper for PathMakeSystemFolderW.
*/
static BOOL WINAPI SHLWAPI_UseSystemForSystemFolders()
static BOOL WINAPI SHLWAPI_UseSystemForSystemFolders(void)
{
static BOOL bCheckedReg = FALSE;
static BOOL bUseSystemForSystemFolders = FALSE;

View file

@ -35,7 +35,8 @@
WINE_DEFAULT_DEBUG_CHANNEL(shell);
typedef struct
{ IStreamVtbl *lpVtbl;
{
const IStreamVtbl *lpVtbl;
DWORD ref;
HKEY hKey;
LPBYTE pbBuffer;
@ -255,7 +256,7 @@ static HRESULT WINAPI IStream_fnClone (IStream * iface, IStream** ppstm)
return E_NOTIMPL;
}
static struct IStreamVtbl rstvt =
static const IStreamVtbl rstvt =
{
IStream_fnQueryInterface,
IStream_fnAddRef,
@ -305,7 +306,7 @@ static HRESULT WINAPI IStream_fnReadDummy(IStream *iface, LPVOID pv, ULONG cb, U
return E_NOTIMPL;
}
static struct IStreamVtbl DummyRegStreamVTable =
static const IStreamVtbl DummyRegStreamVTable =
{
IStream_fnQueryInterface,
IStream_fnAddRefDummy, /* Overridden */

View file

@ -547,6 +547,7 @@
551 stub -noname IShellFolder_CompareIDs
@ stdcall AssocCreate(long long long long ptr ptr)
@ stdcall AssocIsDangerous(long)
@ stdcall AssocQueryKeyA(long long str ptr ptr)
@ stdcall AssocQueryKeyW(long long wstr ptr ptr)
@ stdcall AssocQueryStringA(long long ptr ptr str ptr)
@ -593,6 +594,8 @@
@ stdcall PathFindNextComponentW (wstr)
@ stdcall PathFindOnPathA (str ptr)
@ stdcall PathFindOnPathW (wstr ptr)
@ stdcall PathFindSuffixArrayA(str ptr long)
@ stdcall PathFindSuffixArrayW(wstr ptr long)
@ stdcall PathGetArgsA (str)
@ stdcall PathGetArgsW (wstr)
@ stdcall PathGetCharTypeA(long)
@ -602,9 +605,15 @@
@ stdcall PathIsContentTypeA(str str)
@ stdcall PathIsContentTypeW(wstr wstr)
@ stdcall PathIsDirectoryA(str)
@ stdcall PathIsDirectoryEmptyA(str)
@ stdcall PathIsDirectoryEmptyW(wstr)
@ stdcall PathIsDirectoryW(wstr)
@ stdcall PathIsFileSpecA(str)
@ stdcall PathIsFileSpecW(wstr)
@ stdcall PathIsLFNFileSpecA(str)
@ stdcall PathIsLFNFileSpecW(wstr)
@ stdcall PathIsNetworkPathA(str)
@ stdcall PathIsNetworkPathW(wstr)
@ stdcall PathIsPrefixA(str str)
@ stdcall PathIsPrefixW(wstr wstr)
@ stdcall PathIsRelativeA (str)
@ -657,11 +666,22 @@
@ stdcall PathStripPathW(wstr)
@ stdcall PathStripToRootA(str)
@ stdcall PathStripToRootW(wstr)
@ stdcall PathUnExpandEnvStringsA(str ptr long)
@ stdcall PathUnExpandEnvStringsW(wstr ptr long)
@ stdcall PathUndecorateA(str)
@ stdcall PathUndecorateW(wstr)
@ stdcall PathUnmakeSystemFolderA(str)
@ stdcall PathUnmakeSystemFolderW(wstr)
@ stdcall PathUnquoteSpacesA (str)
@ stdcall PathUnquoteSpacesW (wstr)
@ stdcall SHAutoComplete(ptr long)
@ stdcall SHCopyKeyA(long str long long)
@ stdcall SHCopyKeyW(long wstr long long)
@ stdcall SHCreateShellPalette(long)
@ stdcall SHCreateStreamOnFileA(str long ptr)
@ stdcall SHCreateStreamOnFileEx(wstr long long long ptr ptr)
@ stdcall SHCreateStreamOnFileW(wstr long ptr)
@ stdcall SHCreateStreamWrapper(ptr ptr long ptr)
@ stdcall SHDeleteEmptyKeyA(long ptr)
@ stdcall SHDeleteEmptyKeyW(long ptr)
@ stdcall SHDeleteKeyA(long str)
@ -675,13 +695,14 @@
@ stdcall SHEnumValueA(long long str ptr ptr ptr ptr)
@ stdcall SHEnumValueW(long long wstr ptr ptr ptr ptr)
@ stdcall SHGetInverseCMAP ( ptr long )
@ stdcall SHGetThreadRef (ptr)
@ stdcall SHGetValueA ( long str str ptr ptr ptr )
@ stdcall SHGetValueW ( long wstr wstr ptr ptr ptr )
@ stdcall SHIsLowMemoryMachine(long)
@ stdcall SHOpenRegStreamA(long str str long)
@ stdcall SHOpenRegStreamW(long wstr str long)
@ stdcall SHOpenRegStream2A(long str str long)
@ stdcall SHOpenRegStream2W(long wstr str long)
@ stdcall SHOpenRegStreamA(long str str long)
@ stdcall SHOpenRegStreamW(long wstr str long)
@ stdcall SHQueryInfoKeyA(long ptr ptr ptr ptr)
@ stdcall SHQueryInfoKeyW(long ptr ptr ptr ptr)
@ stdcall SHQueryValueExA(long str ptr ptr ptr ptr)
@ -693,12 +714,15 @@
@ stdcall SHRegDeleteEmptyUSKeyW(long wstr long)
@ stdcall SHRegDeleteUSValueA(long str long)
@ stdcall SHRegDeleteUSValueW(long wstr long)
@ stdcall SHRegDuplicateHKey (long)
@ stdcall SHRegEnumUSKeyA(long long str ptr long)
@ stdcall SHRegEnumUSKeyW(long long wstr ptr long)
@ stdcall SHRegEnumUSValueA(long long ptr ptr ptr ptr ptr long)
@ stdcall SHRegEnumUSValueW(long long ptr ptr ptr ptr ptr long)
@ stdcall SHRegGetBoolUSValueA(str str long long)
@ stdcall SHRegGetBoolUSValueW(wstr wstr long long)
@ stdcall SHRegGetPathA(long str str ptr long)
@ stdcall SHRegGetPathW(long wstr wstr ptr long)
@ stdcall SHRegGetUSValueA ( str str ptr ptr ptr long ptr long )
@ stdcall SHRegGetUSValueW ( wstr wstr ptr ptr ptr long ptr long )
@ stdcall SHRegOpenUSKeyA ( str long long long long )
@ -707,12 +731,20 @@
@ stdcall SHRegQueryInfoUSKeyW ( long ptr ptr ptr ptr long )
@ stdcall SHRegQueryUSValueA ( long str ptr ptr ptr long ptr long )
@ stdcall SHRegQueryUSValueW ( long wstr ptr ptr ptr long ptr long )
@ stdcall SHRegSetPathA(long str str str long)
@ stdcall SHRegSetPathW(long wstr wstr wstr long)
@ stdcall SHRegSetUSValueA ( str str long ptr long long)
@ stdcall SHRegSetUSValueW ( wstr wstr long ptr long long)
@ stdcall SHRegWriteUSValueA (long str long ptr long long)
@ stdcall SHRegWriteUSValueW (long str long ptr long long)
@ stdcall SHRegisterValidateTemplate(wstr long)
@ stdcall SHReleaseThreadRef()
@ stdcall SHSetThreadRef (ptr)
@ stdcall SHSetValueA (long str str long ptr long)
@ stdcall SHSetValueW (long wstr wstr long ptr long)
@ stdcall SHSkipJunction(ptr ptr)
@ stdcall SHStrDupA (str ptr)
@ stdcall SHStrDupW (wstr ptr)
@ stdcall StrCSpnA (str str)
@ stdcall StrCSpnIA (str str)
@ stdcall StrCSpnIW (wstr wstr)
@ -725,6 +757,7 @@
@ stdcall StrChrIW (wstr long)
@ stdcall StrChrW (wstr long)
@ stdcall StrCmpIW (wstr wstr)
@ stdcall StrCmpLogicalW(wstr wstr)
@ stdcall StrCmpNA (str str long)
@ stdcall StrCmpNIA (str str long)
@ stdcall StrCmpNIW (wstr wstr long)
@ -734,8 +767,11 @@
@ stdcall StrCpyW (ptr wstr)
@ stdcall StrDupA (str)
@ stdcall StrDupW (wstr)
@ stdcall StrFormatByteSize64A(long long ptr long)
@ stdcall StrFormatByteSizeA(long ptr long)
@ stdcall StrFormatByteSizeW(long long ptr long)
@ stdcall StrFormatKBSizeA(long long str long)
@ stdcall StrFormatKBSizeW(long long wstr long)
@ stdcall StrFromTimeIntervalA(ptr long long long)
@ stdcall StrFromTimeIntervalW(ptr long long long)
@ stdcall StrIsIntlEqualA(long str str long)
@ -750,6 +786,11 @@
@ stdcall StrRChrW (wstr wstr long)
@ stdcall StrRStrIA (str str str)
@ stdcall StrRStrIW (wstr wstr wstr)
@ stdcall StrRetToBSTR(ptr ptr ptr)
@ stdcall StrRetToBufA(ptr ptr ptr long)
@ stdcall StrRetToBufW(ptr ptr ptr long)
@ stdcall StrRetToStrA(ptr ptr ptr)
@ stdcall StrRetToStrW(ptr ptr ptr)
@ stdcall StrSpnA (str str)
@ stdcall StrSpnW (wstr wstr)
@ stdcall StrStrA(str str)
@ -788,52 +829,8 @@
@ stdcall UrlIsW(wstr long)
@ stdcall UrlUnescapeA(str ptr ptr long)
@ stdcall UrlUnescapeW(wstr ptr ptr long)
@ stdcall _SHGetInstanceExplorer(ptr)
@ varargs wnsprintfA(ptr long str)
@ varargs wnsprintfW(ptr long wstr)
@ stdcall wvnsprintfA(ptr long str ptr)
@ stdcall wvnsprintfW(ptr long wstr ptr)
# exported in later versions
@ stdcall AssocIsDangerous(long)
@ 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)
@ stdcall PathIsDirectoryEmptyW(wstr)
@ stdcall PathIsNetworkPathA(str)
@ stdcall PathIsNetworkPathW(wstr)
@ stdcall PathIsLFNFileSpecA(str)
@ stdcall PathIsLFNFileSpecW(wstr)
@ stdcall PathFindSuffixArrayA(str ptr long)
@ stdcall PathFindSuffixArrayW(wstr ptr long)
@ stdcall _SHGetInstanceExplorer(ptr)
@ stdcall PathUndecorateA(str)
@ stdcall PathUndecorateW(wstr)
@ stdcall PathUnExpandEnvStringsA(str ptr long)
@ stdcall PathUnExpandEnvStringsW(wstr ptr long)
@ stdcall SHCopyKeyA(long str long long)
@ stdcall SHCopyKeyW(long wstr long long)
@ stdcall SHAutoComplete(ptr long)
@ stdcall SHCreateStreamOnFileA(str long ptr)
@ stdcall SHCreateStreamOnFileW(wstr long ptr)
@ stdcall SHCreateStreamOnFileEx(wstr long long long ptr ptr)
@ stdcall SHCreateStreamWrapper(ptr ptr long ptr)
@ stdcall SHGetThreadRef (ptr)
@ stdcall SHRegDuplicateHKey (long)
@ stdcall SHRegSetPathA(long str str str long)
@ stdcall SHRegSetPathW(long wstr wstr wstr long)
@ stdcall SHRegisterValidateTemplate(wstr long)
@ stdcall SHSetThreadRef (ptr)
@ stdcall SHReleaseThreadRef()
@ stdcall SHSkipJunction(ptr ptr)
@ stdcall SHStrDupA (str ptr)
@ stdcall SHStrDupW (wstr ptr)
@ stdcall StrFormatByteSize64A(long long ptr long)
@ stdcall StrFormatKBSizeA(long long str long)
@ stdcall StrFormatKBSizeW(long long wstr long)
@ stdcall StrCmpLogicalW(wstr wstr)