shlwapi: Support the command file type association query.

This commit is contained in:
Damjan Jovanovic 2009-01-20 18:19:21 +02:00 committed by Alexandre Julliard
parent 540febecf9
commit 36a24b93c7
1 changed files with 30 additions and 9 deletions

View File

@ -594,9 +594,8 @@ static HRESULT ASSOC_GetValue(HKEY hkey, WCHAR ** pszText)
return S_OK; return S_OK;
} }
static HRESULT ASSOC_GetExecutable(IQueryAssociationsImpl *This, static HRESULT ASSOC_GetCommand(IQueryAssociationsImpl *This,
LPCWSTR pszExtra, LPWSTR path, LPCWSTR pszExtra, WCHAR **ppszCommand)
DWORD pathlen, DWORD *len)
{ {
HKEY hkeyCommand; HKEY hkeyCommand;
HKEY hkeyFile; HKEY hkeyFile;
@ -604,16 +603,11 @@ static HRESULT ASSOC_GetExecutable(IQueryAssociationsImpl *This,
HKEY hkeyVerb; HKEY hkeyVerb;
HRESULT hr; HRESULT hr;
LONG ret; LONG ret;
WCHAR * pszCommand;
WCHAR * pszEnd;
WCHAR * pszExtraFromReg = NULL; WCHAR * pszExtraFromReg = NULL;
WCHAR * pszFileType; WCHAR * pszFileType;
WCHAR * pszStart;
static const WCHAR commandW[] = { 'c','o','m','m','a','n','d',0 }; static const WCHAR commandW[] = { 'c','o','m','m','a','n','d',0 };
static const WCHAR shellW[] = { 's','h','e','l','l',0 }; static const WCHAR shellW[] = { 's','h','e','l','l',0 };
assert(len);
hr = ASSOC_GetValue(This->hkeySource, &pszFileType); hr = ASSOC_GetValue(This->hkeySource, &pszFileType);
if (FAILED(hr)) if (FAILED(hr))
return hr; return hr;
@ -672,8 +666,23 @@ static HRESULT ASSOC_GetExecutable(IQueryAssociationsImpl *This,
RegCloseKey(hkeyVerb); RegCloseKey(hkeyVerb);
if (ret != ERROR_SUCCESS) if (ret != ERROR_SUCCESS)
return HRESULT_FROM_WIN32(ret); return HRESULT_FROM_WIN32(ret);
hr = ASSOC_GetValue(hkeyCommand, &pszCommand); hr = ASSOC_GetValue(hkeyCommand, ppszCommand);
RegCloseKey(hkeyCommand); 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)) if (FAILED(hr))
return hr; return hr;
@ -763,6 +772,18 @@ static HRESULT WINAPI IQueryAssociations_fnGetString(
switch (str) 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: case ASSOCSTR_EXECUTABLE:
{ {
hr = ASSOC_GetExecutable(This, pszExtra, path, MAX_PATH, &len); hr = ASSOC_GetExecutable(This, pszExtra, path, MAX_PATH, &len);