sync shlwapi with wine 1.1.14

svn path=/trunk/; revision=39238
This commit is contained in:
Christoph von Wittich 2009-01-31 14:48:46 +00:00
parent 66e2845732
commit 56a6541f3d
8 changed files with 193 additions and 31 deletions

View file

@ -455,7 +455,7 @@ static HRESULT WINAPI IQueryAssociations_fnQueryInterface(
if (IsEqualIID(riid, &IID_IUnknown) ||
IsEqualIID(riid, &IID_IQueryAssociations))
{
*ppvObj = (IQueryAssociations*)This;
*ppvObj = This;
IQueryAssociations_AddRef((IQueryAssociations*)*ppvObj);
TRACE("Returning IQueryAssociations (%p)\n", *ppvObj);
@ -594,9 +594,8 @@ static HRESULT ASSOC_GetValue(HKEY hkey, WCHAR ** pszText)
return S_OK;
}
static HRESULT ASSOC_GetExecutable(IQueryAssociationsImpl *This,
LPCWSTR pszExtra, LPWSTR path,
DWORD pathlen, DWORD *len)
static HRESULT ASSOC_GetCommand(IQueryAssociationsImpl *This,
LPCWSTR pszExtra, WCHAR **ppszCommand)
{
HKEY hkeyCommand;
HKEY hkeyFile;
@ -604,16 +603,11 @@ static HRESULT ASSOC_GetExecutable(IQueryAssociationsImpl *This,
HKEY hkeyVerb;
HRESULT hr;
LONG ret;
WCHAR * pszCommand;
WCHAR * pszEnd;
WCHAR * pszExtraFromReg = NULL;
WCHAR * pszFileType;
WCHAR * pszStart;
static const WCHAR commandW[] = { 'c','o','m','m','a','n','d',0 };
static const WCHAR shellW[] = { 's','h','e','l','l',0 };
assert(len);
hr = ASSOC_GetValue(This->hkeySource, &pszFileType);
if (FAILED(hr))
return hr;
@ -672,8 +666,23 @@ static HRESULT ASSOC_GetExecutable(IQueryAssociationsImpl *This,
RegCloseKey(hkeyVerb);
if (ret != ERROR_SUCCESS)
return HRESULT_FROM_WIN32(ret);
hr = ASSOC_GetValue(hkeyCommand, &pszCommand);
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;
@ -763,6 +772,18 @@ static HRESULT WINAPI IQueryAssociations_fnGetString(
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);
@ -772,6 +793,38 @@ static HRESULT WINAPI IQueryAssociations_fnGetString(
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;
@ -825,6 +878,73 @@ get_friendly_name_fail:
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;

View file

@ -173,7 +173,7 @@ INT_PTR WINAPI SHMessageBoxCheckExW(HWND hWnd, HINSTANCE hInst, LPCWSTR lpszName
d.dlgProc = dlgProc;
d.lParam = lParam;
d.lpszId = lpszId;
return DialogBoxParamW(hInst, (LPCWSTR)lpszName, hWnd, SHDlgProcEx, (LPARAM)&d);
return DialogBoxParamW(hInst, lpszName, hWnd, SHDlgProcEx, (LPARAM)&d);
}
/* Data held by each shlwapi message box */

View file

@ -1250,12 +1250,10 @@ BOOL WINAPI SHIsSameObject(IUnknown* lpInt1, IUnknown* lpInt2)
if (lpInt1 == lpInt2)
return TRUE;
if (FAILED(IUnknown_QueryInterface(lpInt1, &IID_IUnknown,
(LPVOID *)&lpUnknown1)))
if (FAILED(IUnknown_QueryInterface(lpInt1, &IID_IUnknown, &lpUnknown1)))
return FALSE;
if (FAILED(IUnknown_QueryInterface(lpInt2, &IID_IUnknown,
(LPVOID *)&lpUnknown2)))
if (FAILED(IUnknown_QueryInterface(lpInt2, &IID_IUnknown, &lpUnknown2)))
return FALSE;
if (lpUnknown1 == lpUnknown2)
@ -2236,7 +2234,7 @@ HRESULT WINAPI QISearch(
if (IsEqualIID(riid, xmove->refid)) {
a_vtbl = (IUnknown*)(xmove->indx + (LPBYTE)w);
TRACE("matched, returning (%p)\n", a_vtbl);
*ppv = (LPVOID)a_vtbl;
*ppv = a_vtbl;
IUnknown_AddRef(a_vtbl);
return S_OK;
}
@ -2246,7 +2244,7 @@ HRESULT WINAPI QISearch(
if (IsEqualIID(riid, &IID_IUnknown)) {
a_vtbl = (IUnknown*)(x->indx + (LPBYTE)w);
TRACE("returning first for IUnknown (%p)\n", a_vtbl);
*ppv = (LPVOID)a_vtbl;
*ppv = a_vtbl;
IUnknown_AddRef(a_vtbl);
return S_OK;
}
@ -2539,7 +2537,7 @@ DWORD WINAPI SHGetRestriction(LPCWSTR lpSubKey, LPCWSTR lpSubName, LPCWSTR lpVal
if (retval != ERROR_SUCCESS)
return 0;
SHGetValueW(hKey, lpSubName, lpValue, NULL, (LPBYTE)&retval, &datsize);
SHGetValueW(hKey, lpSubName, lpValue, NULL, &retval, &datsize);
RegCloseKey(hKey);
return retval;
}
@ -2618,7 +2616,7 @@ HRESULT WINAPI SHWeakQueryInterface(
*ppv = NULL;
if(pUnk && pInner) {
hret = IUnknown_QueryInterface(pInner, riid, (LPVOID*)ppv);
hret = IUnknown_QueryInterface(pInner, riid, ppv);
if (SUCCEEDED(hret)) IUnknown_Release(pUnk);
}
TRACE("-- 0x%08x\n", hret);
@ -4167,7 +4165,7 @@ BOOL WINAPI SHSkipJunction(IBindCtx *pbc, const CLSID *pclsid)
{
IUnknown* lpUnk;
if (SUCCEEDED(IBindCtx_GetObjectParam(pbc, (LPOLESTR)szSkipBinding, &lpUnk)))
if (SUCCEEDED(IBindCtx_GetObjectParam(pbc, szSkipBinding, &lpUnk)))
{
CLSID clsid;

View file

@ -190,7 +190,7 @@ LONG WINAPI SHRegOpenUSKeyW(LPCWSTR Path, REGSAM AccessType, HUSKEY hRelativeUSK
LONG WINAPI SHRegCloseUSKey(
HUSKEY hUSKey) /* [I] Key to close */
{
LPSHUSKEY hKey = (LPSHUSKEY)hUSKey;
LPSHUSKEY hKey = hUSKey;
LONG ret = ERROR_SUCCESS;
if (hKey->HKCUkey)
@ -393,8 +393,8 @@ LONG WINAPI SHRegQueryUSValueA(
if (ret != ERROR_SUCCESS) {
if (pvDefaultData && (dwDefaultDataSize != 0)) {
maxmove = (dwDefaultDataSize >= *pcbData) ? *pcbData : dwDefaultDataSize;
src = (CHAR*)pvDefaultData;
dst = (CHAR*)pvData;
src = pvDefaultData;
dst = pvData;
for(i=0; i<maxmove; i++) *dst++ = *src++;
*pcbData = maxmove;
TRACE("setting default data\n");
@ -444,8 +444,8 @@ LONG WINAPI SHRegQueryUSValueW(
if (ret != ERROR_SUCCESS) {
if (pvDefaultData && (dwDefaultDataSize != 0)) {
maxmove = (dwDefaultDataSize >= *pcbData) ? *pcbData : dwDefaultDataSize;
src = (CHAR*)pvDefaultData;
dst = (CHAR*)pvData;
src = pvDefaultData;
dst = pvData;
for(i=0; i<maxmove; i++) *dst++ = *src++;
*pcbData = maxmove;
TRACE("setting default data\n");
@ -934,7 +934,7 @@ LONG WINAPI SHRegWriteUSValueW(HUSKEY hUSKey, LPCWSTR pszValue, DWORD dwType,
LPVOID pvData, DWORD cbData, DWORD dwFlags)
{
DWORD dummy;
LPSHUSKEY hKey = (LPSHUSKEY)hUSKey;
LPSHUSKEY hKey = hUSKey;
LONG ret = ERROR_SUCCESS;
TRACE("(%p,%s,%d,%p,%d,%d)\n", hUSKey, debugstr_w(pszValue),
@ -2242,7 +2242,7 @@ DWORD WINAPI SHCopyKeyW(HKEY hKeySrc, LPCWSTR lpszSrcSubKey, HKEY hKeyDst, DWORD
DWORD dwKeyCount = 0, dwValueCount = 0, dwMaxKeyLen = 0;
DWORD dwMaxValueLen = 0, dwMaxDataLen = 0, i;
BYTE buff[1024];
LPVOID lpBuff = (LPVOID)buff;
LPVOID lpBuff = buff;
WCHAR szName[MAX_PATH], *lpszName = szName;
DWORD dwRet = S_OK;

View file

@ -5,6 +5,7 @@
<importlibrary definition="shlwapi.spec" />
<include base="shlwapi">.</include>
<include base="ReactOS">include/reactos/wine</include>
<define name="_WIN32_WINNT">0x600</define>
<define name="__WINESRC__" />
<file>assoc.c</file>
<file>clist.c</file>

View file

@ -43,7 +43,7 @@
#include "shlwapi_Ro.rc"
#include "shlwapi_Ru.rc"
#include "shlwapi_Si.rc"
#include "shlwapi_Sk.rc"
#include "shlwapi_Sv.rc"
#include "shlwapi_Tr.rc"
#include "shlwapi_Uk.rc"
#include "shlwapi_Zh.rc"
#include "shlwapi_Uk.rc"#include "shlwapi_Zh.rc"

View file

@ -0,0 +1,43 @@
/* Slovak translation for shlwapi
*
* Copyright 2004 Jon Griffiths
* Copyright 2008 Mário Kaèmár (Mario Kacmar)
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2.1 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
* License along with this library; if not, write to the Free Software
* Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
*/
LANGUAGE LANG_SLOVAK, SUBLANG_DEFAULT
IDD_ERR_DIALOG DIALOG MOVEABLE DISCARDABLE 0, 0, 220, 60
STYLE DS_MODALFRAME | DS_CENTER | WS_POPUP | WS_CAPTION | WS_SYSMENU
CAPTION "Chyba!"
FONT 8, "MS Shell Dlg"
{
LTEXT "", IDS_ERR_USER_MSG2, 15, 5, 28, 20
LTEXT "", IDS_ERR_USER_MSG, 15, 5, 210, 8
CHECKBOX "Nabudúce toto dialógové okno nezo&brazova<76>", IDC_ERR_DONT_SHOW, 5, 20, 210, 10, BS_AUTOCHECKBOX | WS_GROUP | WS_TABSTOP
PUSHBUTTON L"&OK" IDOK, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP
PUSHBUTTON L"&Zruši<C5A1>" IDCANCEL, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP
PUSHBUTTON L"Án&o" IDYES, 105, 40, 50, 14, WS_GROUP | WS_TABSTOP
PUSHBUTTON L"&Nie" IDNO, 160, 40, 50, 14, WS_GROUP | WS_TABSTOP
}
STRINGTABLE DISCARDABLE
{
IDS_BYTES_FORMAT "%ld bajtov"
IDS_TIME_INTERVAL_HOURS " hod."
IDS_TIME_INTERVAL_MINUTES " min."
IDS_TIME_INTERVAL_SECONDS " s"
}

View file

@ -1342,7 +1342,7 @@ HRESULT WINAPI StrRetToBufA (LPSTRRET src, const ITEMIDLIST *pidl, LPSTR dest, U
break;
case STRRET_CSTR:
lstrcpynA((LPSTR)dest, src->u.cStr, len);
lstrcpynA(dest, src->u.cStr, len);
break;
case STRRET_OFFSET:
@ -1381,7 +1381,7 @@ HRESULT WINAPI StrRetToBufW (LPSTRRET src, const ITEMIDLIST *pidl, LPWSTR dest,
switch (src->uType)
{
case STRRET_WSTR:
lstrcpynW((LPWSTR)dest, src->u.pOleStr, len);
lstrcpynW(dest, src->u.pOleStr, len);
CoTaskMemFree(src->u.pOleStr);
break;