100 m_pApp(
NULL), m_cApp(0), m_cRecommended(0), m_bNoOpen(
FALSE) {}
114 WCHAR wszName[256], wszBuf[100];
120 ERR(
"RegOpenKeyEx HKCR\\Applications failed!\n");
139 StringCbPrintfW(wszBuf,
sizeof(wszBuf),
L"%s\\shell\\open\\command", wszName);
143 ERR(
"Failed to add app %ls\n", wszName);
164 ERR(
"AddInternal failed\n");
193 ERR(
"RegOpenKeyEx failed\n");
198 ERR(
"Cannot add app to registry\n");
272 ERR(
"RegOpenKeyEx failed\n");
280 sei.
lpFile = pwszFilePath;
297 ERR(
"insufficient buffer\n");
322 ERR(
"Allocation failed\n");
335 WORD wLang = 0, wCode = 0;
343 TRACE(
"LoadInfo %ls\n", wszPath);
349 ERR(
"GetFileVersionInfoSizeW %ls failed: %lu\n", wszPath,
GetLastError());
357 ERR(
"HeapAlloc failed\n");
376 wLang = lpLangCode->
lang;
377 wCode = lpLangCode->
code;
381 swprintf(wszBuf,
L"\\StringFileInfo\\%04x%04x\\FileDescription", wLang, wCode);
386 ERR(
"Cannot get app name\n");
402 if (pwszCmd[0] ==
'"')
404 for(
LPCWSTR pwszSrc = pwszCmd + 1; *pwszSrc && *pwszSrc !=
'"'; ++pwszSrc)
405 *(pwszDest++) = *pwszSrc;
409 for(
LPCWSTR pwszSrc = pwszCmd; *pwszSrc && *pwszSrc !=
' '; ++pwszSrc)
410 *(pwszDest++) = *pwszSrc;
441 HKEY hSubkey, hSubkey2;
442 WCHAR wszProgId[256];
476 Info.lpszSubKey =
L"OpenWithList";
485 int nItem, nCount, nResult;
492 TRACE(
"OpenMRUList failed\n");
499 for(nItem = 0; nItem < nCount; nItem++)
508 TRACE(
"Recommended app %ls: %p\n", wszAppFilename, pApp);
525 DWORD i = 0, cchAppFilename;
533 cchAppFilename =
_countof(wszAppFilename);
540 TRACE(
"Recommended app %ls: %p\n", wszAppFilename, pApp);
570 TRACE(
"Add app %ls: %p\n", wszPath, pApp);
590 StringCbPrintfW(wszBuf,
sizeof(wszBuf),
L"SystemFileAssociations\\%s", pwszExt);
620 StringCbPrintfW(wszBuf2,
sizeof(wszBuf2),
L"SystemFileAssociations\\%s", wszBuf);
639 L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FileExts\\%s",
648 DWORD cbBuf =
sizeof(wszBuf);
675 L"Software\\Microsoft\\Windows\\CurrentVersion\\Explorer\\FileExts\\%s",
678 ERR(
"insufficient buffer\n");
713 if (!pwszExt[0] || !pwszExt[1])
719 ERR(
"Can't open ext key\n");
733 ERR(
"RegSetValueExW failed\n");
740 ERR(
"RegGetValueExW failed: 0x%08x\n", lResult);
750 ERR(
"RegCreateKeyExW failed\n");
758 ERR(
"RegOpenKeyExW %ls failed\n", wszBuf);
766 ERR(
"RegCreateKeyExW failed\n");
781 ERR(
"SHCopyKeyW failed\n");
815 m_pInfo(pInfo), m_pAppList(pAppList), m_hImgList(
NULL), m_bNoOpen(
FALSE)
869 if (dReturnValue ==
IDNO)
871 else if (dReturnValue == -1)
873 ERR(
"IsNoOpen failed to load dialog box\n");
884 if (!pwszName)
return;
887 TRACE(
"AddApp Cmd %ls Name %ls\n", pApp->
wszCmd, pwszName);
895 tvins.hParent = tvins.hInsertAfter =
m_hOther;
898 tvins.item.pszText =
const_cast<LPWSTR>(pwszName);
899 tvins.item.lParam = (
LPARAM)pApp;
967 TRACE(
"COpenWithDialog::Init hwnd %p\n",
hwnd);
1006 if (cRecommended > 0)
1011 tvins.hParent = tvins.hInsertAfter =
TVI_ROOT;
1013 tvins.item.pszText = (
LPWSTR)wszBuf;
1034 if (bNoAppSelected && (pAppList[
i].bRecommended || !cRecommended))
1037 bNoAppSelected =
FALSE;
1077 pThis->
Init(hwndDlg);
1130 TRACE(
"Destroying COpenWithMenu(%p)\n",
this);
1144 mii.
cbSize =
sizeof(mii);
1190 mii.
cbSize =
sizeof(mii);
1198 ERR(
"Failed to load string\n");
1216 if (!pwszName)
return;
1219 mii.
cbSize =
sizeof(mii);
1245 TRACE(
"hMenu %p indexMenu %u idFirst %u idLast %u uFlags %u\n", hMenu, indexMenu, idCmdFirst, idCmdLast,
uFlags);
1253 ERR(
"Failed to load string\n");
1262 if (DefaultPos != -1)
1287 mii.
cbSize =
sizeof(mii);
1301 if (DefaultPos == -1)
1339 mii.
cbSize =
sizeof(mii);
1359 FIXME(
"%p %lu %u %p %p %u\n",
this,
1360 idCmd, uType, pwReserved, pszName,
cchMax );
1370 TRACE(
"This %p uMsg %x\n",
this, uMsg);
1383 TRACE(
"This %p\n",
this);
1388 CDataObjectHIDA pida(pdtobj);
1391 ERR(
"pdtobj->GetData failed with 0x%x\n", pida.hr());
1402 TRACE(
"pidl is not a file\n");
1415 ERR(
"SHGetPathFromIDListW failed\n");
1424 TRACE(
"file is a executable or shortcut\n");
1436 TRACE(
"SHOpenWithDialog hwndParent %p poainfo %p\n",
hwndParent, poainfo);
#define shell32_hInstance
#define WINE_DEFAULT_DEBUG_CHANNEL(t)
void shell(int argc, const char *argv[])
static WCHAR wszFilter[MAX_STRING_LEN *4+6 *3+5]
#define RegCloseKey(hKey)
EXTERN_C void WINAPI SHChangeNotify(LONG wEventId, UINT uFlags, LPCVOID dwItem1, LPCVOID dwItem2)
COpenWithList * m_pAppList
VOID AddApp(COpenWithList::SApp *pApp, BOOL bSelected)
static INT_PTR CALLBACK NoOpenDlgProc(HWND hwnd, UINT Message, WPARAM wParam, LPARAM lParam)
COpenWithList::SApp * GetCurrentApp()
COpenWithDialog(const OPENASINFO *pInfo, COpenWithList *pAppList)
static INT_PTR CALLBACK DialogProc(HWND hwndDlg, UINT uMsg, WPARAM wParam, LPARAM lParam)
const OPENASINFO * m_pInfo
struct COpenWithList::_LANGANDCODEPAGE * LPLANGANDCODEPAGE
static BOOL SaveApp(SApp *pApp)
SApp * Find(LPCWSTR pwszFilename)
BOOL LoadRecommended(LPCWSTR pwszFilePath)
static LPCWSTR GetName(SApp *pApp)
BOOL LoadAppList(HKEY hKey)
static BOOL Execute(SApp *pApp, LPCWSTR pwszFilePath)
static BOOL GetPathFromCmd(LPWSTR pwszAppPath, LPCWSTR pwszCmd)
static BOOL LoadInfo(SApp *pApp)
VOID LoadRecommendedFromHKCR(LPCWSTR pwszExt)
UINT GetRecommendedCount()
static HICON GetIcon(SApp *pApp)
SApp * Add(LPCWSTR pwszPath)
BOOL SetDefaultHandler(SApp *pApp, LPCWSTR pwszFilename)
struct COpenWithList::_LANGANDCODEPAGE LANGANDCODEPAGE
VOID LoadRecommendedFromHKCU(LPCWSTR pwszExt)
static BOOL AddAppToMRUList(SApp *pApp, LPCWSTR pwszFilename)
SApp * AddInternal(LPCWSTR pwszFilename)
VOID SetRecommended(SApp *pApp)
static BOOL IsHidden(SApp *pApp)
static HANDLE OpenMRUList(HKEY hKey)
VOID LoadFromProgIdKey(HKEY hKey, LPCWSTR pwszExt)
BOOL LoadMRUList(HKEY hKey)
BOOL LoadProgIdList(HKEY hKey, LPCWSTR pwszExt)
INT WINAPI AddMRUStringW(HANDLE hList, LPCWSTR lpszString)
INT WINAPI EnumMRUListW(HANDLE hList, INT nItemPos, LPVOID lpBuffer, DWORD nBufferSize)
HANDLE WINAPI CreateMRUListW(const MRUINFOW *infoW)
void WINAPI FreeMRUList(HANDLE hMRUList)
VOID WINAPI InitCommonControls(void)
#define OFN_FILEMUSTEXIST
#define OFN_PATHMUSTEXIST
struct tagOFNW OPENFILENAMEW
static LSTATUS(WINAPI *pRegDeleteTreeW)(HKEY
LONG WINAPI RegCreateKeyExW(_In_ HKEY hKey, _In_ LPCWSTR lpSubKey, _In_ DWORD Reserved, _In_opt_ LPWSTR lpClass, _In_ DWORD dwOptions, _In_ REGSAM samDesired, _In_opt_ LPSECURITY_ATTRIBUTES lpSecurityAttributes, _Out_ PHKEY phkResult, _Out_opt_ LPDWORD lpdwDisposition)
LONG WINAPI RegOpenKeyExW(HKEY hKey, LPCWSTR lpSubKey, DWORD ulOptions, REGSAM samDesired, PHKEY phkResult)
LSTATUS WINAPI RegGetValueW(HKEY hKey, LPCWSTR pszSubKey, LPCWSTR pszValue, DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData)
LONG WINAPI RegEnumKeyExW(_In_ HKEY hKey, _In_ DWORD dwIndex, _Out_ LPWSTR lpName, _Inout_ LPDWORD lpcbName, _Reserved_ LPDWORD lpReserved, _Out_opt_ LPWSTR lpClass, _Inout_opt_ LPDWORD lpcbClass, _Out_opt_ PFILETIME lpftLastWriteTime)
LONG WINAPI RegOpenKeyW(HKEY hKey, LPCWSTR lpSubKey, PHKEY phkResult)
LONG WINAPI RegSetValueExW(_In_ HKEY hKey, _In_ LPCWSTR lpValueName, _In_ DWORD Reserved, _In_ DWORD dwType, _In_ CONST BYTE *lpData, _In_ DWORD cbData)
LONG WINAPI RegQueryValueExW(_In_ HKEY hkeyorg, _In_ LPCWSTR name, _In_ LPDWORD reserved, _In_ LPDWORD type, _In_ LPBYTE data, _In_ LPDWORD count)
BOOL WINAPI ImageList_Destroy(HIMAGELIST himl)
HIMAGELIST WINAPI ImageList_Create(INT cx, INT cy, UINT flags, INT cInitial, INT cGrow)
BOOL WINAPI GetOpenFileNameW(OPENFILENAMEW *ofn)
#define HeapFree(x, y, z)
LPWSTR WINAPI PathFindFileNameW(LPCWSTR lpszPath)
LPWSTR WINAPI PathFindExtensionW(LPCWSTR lpszPath)
DWORD WINAPI SHCopyKeyW(HKEY hKeySrc, LPCWSTR lpszSrcSubKey, HKEY hKeyDst, DWORD dwReserved)
BOOL WINAPI GetFileVersionInfoW(LPCWSTR filename, DWORD handle, DWORD datasize, LPVOID data)
BOOL WINAPI VerQueryValueW(LPCVOID pBlock, LPCWSTR lpSubBlock, LPVOID *lplpBuffer, PUINT puLen)
DWORD WINAPI GetFileVersionInfoSizeW(LPCWSTR filename, LPDWORD handle)
static const WCHAR Message[]
#define MAKE_HRESULT(sev, fac, code)
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
UINT WINAPI ExtractIconExW(LPCWSTR lpszFile, INT nIconIndex, HICON *phiconLarge, HICON *phiconSmall, UINT nIcons)
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define ERROR_FILE_NOT_FOUND
PSDBQUERYRESULT_VISTA PVOID DWORD * dwSize
static const CLSID *static CLSID *static const GUID VARIANT VARIANT *static IServiceProvider DWORD *static HMENU
unsigned __int3264 UINT_PTR
LPITEMIDLIST WINAPI ILCombine(LPCITEMIDLIST pidl1, LPCITEMIDLIST pidl2)
BOOL WINAPI SHGetPathFromIDListW(LPCITEMIDLIST pidl, LPWSTR pszPath)
BOOL _ILIsValue(LPCITEMIDLIST pidl)
#define TreeView_SelectItem(hwnd, hitem)
#define TreeView_GetSelection(hwnd)
#define TreeView_GetItem(hwnd, pitem)
#define ImageList_AddIcon(himl, hicon)
#define TreeView_SetImageList(hwnd, himl, iImage)
#define TreeView_InsertItem(hwnd, lpis)
#define TVIF_SELECTEDIMAGE
_Check_return_ _CRTIMP int __cdecl _wcsicmp(_In_z_ const wchar_t *_Str1, _In_z_ const wchar_t *_Str2)
_CRTIMP wchar_t *__cdecl wcscpy(_Out_writes_z_(_String_length_(_Source)+1) wchar_t *_Dest, _In_z_ const wchar_t *_Source)
DWORD_PTR WINAPI SHGetFileInfoW(LPCWSTR path, DWORD dwFileAttributes, SHFILEINFOW *psfi, UINT sizeofpsfi, UINT flags)
#define SEE_MASK_CLASSKEY
struct _SHELLEXECUTEINFOW SHELLEXECUTEINFOW
#define SHGFI_SHELLICONSIZE
static PCUIDLIST_RELATIVE HIDA_GetPIDLItem(CIDA const *pida, SIZE_T i)
static PCUIDLIST_ABSOLUTE HIDA_GetPIDLFolder(CIDA const *pida)
BOOL WINAPI DECLSPEC_HOTPATCH ShellExecuteExW(LPSHELLEXECUTEINFOW sei)
@ OAIF_ALLOW_REGISTRATION
@ OAIF_FORCE_REGISTRATION
#define SHCNE_ASSOCCHANGED
#define SHCNF_FLUSHNOWAIT
#define IDS_OPEN_WITH_FILTER
#define IDS_OPEN_WITH_CHOOSE
#define IDS_OPEN_WITH_RECOMMENDED
#define IDI_SHELL_PROGRAMS_FOLDER
#define IDS_OPEN_WITH_OTHER
const ITEMIDLIST UNALIGNED * LPCITEMIDLIST
STRSAFEAPI StringCbCopyW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
STRSAFEAPI StringCchCopyW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc)
STRSAFEAPI StringCbPrintfW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszFormat,...)
STRSAFEAPI StringCchCopyNW(STRSAFE_LPWSTR pszDest, size_t cchDest, STRSAFE_LPCWSTR pszSrc, size_t cchToCopy)
WCHAR wszFilename[MAX_PATH]
OPEN_AS_INFO_FLAGS oaifInFlags
_Must_inspect_result_ _In_ WDFCHILDLIST _In_ PWDF_CHILD_LIST_ITERATOR _Out_ WDFDEVICE _Inout_opt_ PWDF_CHILD_RETRIEVE_INFO Info
_In_ WDFCOLLECTION _In_ ULONG Index
UINT WINAPI GetDlgItemTextW(HWND hDlg, int nIDDlgItem, LPWSTR lpString, int nMaxCount)
#define success(from, fromstr, to, tostr)
DWORD WINAPI GetLastError(void)
#define ExpandEnvironmentStrings
_In_ PSID _Out_writes_to_opt_ cchName LPSTR _Inout_ LPDWORD cchName
HGDIOBJ WINAPI SelectObject(_In_ HDC, _In_ HGDIOBJ)
HDC WINAPI CreateCompatibleDC(_In_opt_ HDC hdc)
HBITMAP WINAPI CreateCompatibleBitmap(_In_ HDC hdc, _In_ INT cx, _In_ INT cy)
int WINAPI FillRect(HDC, LPCRECT, HBRUSH)
BOOL WINAPI DeleteDC(_In_ HDC)
#define HKEY_CURRENT_USER
#define HKEY_CLASSES_ROOT
int WINAPI ReleaseDC(_In_opt_ HWND, _In_ HDC)
HMENU WINAPI CreatePopupMenu(void)
UINT WINAPI GetMenuDefaultItem(_In_ HMENU hMenu, _In_ UINT fByPos, _In_ UINT gmdiFlags)
BOOL WINAPI ShowWindow(_In_ HWND, _In_ int)
int WINAPI GetMenuItemCount(_In_opt_ HMENU)
int WINAPI LoadStringW(_In_opt_ HINSTANCE hInstance, _In_ UINT uID, _Out_writes_to_(cchBufferMax, return+1) LPWSTR lpBuffer, _In_ int cchBufferMax)
BOOL WINAPI SetDlgItemTextW(_In_ HWND, _In_ int, _In_ LPCWSTR)
HWND WINAPI GetDlgItem(_In_opt_ HWND, _In_ int)
UINT WINAPI IsDlgButtonChecked(_In_ HWND, _In_ int)
BOOL WINAPI DrawIconEx(_In_ HDC, _In_ int, _In_ int, _In_ HICON, _In_ int, _In_ int, _In_ UINT, _In_opt_ HBRUSH, _In_ UINT)
BOOL WINAPI EnableWindow(_In_ HWND, _In_ BOOL)
HDC WINAPI GetDC(_In_opt_ HWND)
BOOL WINAPI GetMenuItemInfoW(_In_ HMENU, _In_ UINT, _In_ BOOL, _Inout_ LPMENUITEMINFOW)
int WINAPI GetSystemMetrics(_In_ int)
BOOL WINAPI InsertMenuItemW(_In_ HMENU, _In_ UINT, _In_ BOOL, _In_ LPCMENUITEMINFOW)
BOOL WINAPI SetRect(_Out_ LPRECT, _In_ int, _In_ int, _In_ int, _In_ int)
INT_PTR WINAPI DialogBoxParamW(_In_opt_ HINSTANCE, _In_ LPCWSTR, _In_opt_ HWND, _In_opt_ DLGPROC, _In_ LPARAM)
BOOL WINAPI EndDialog(_In_ HWND, _In_ INT_PTR)
BOOL WINAPI DestroyIcon(_In_ HICON)
_At_(*)(_In_ PWSK_CLIENT Client, _In_opt_ PUNICODE_STRING NodeName, _In_opt_ PUNICODE_STRING ServiceName, _In_opt_ ULONG NameSpace, _In_opt_ GUID *Provider, _In_opt_ PADDRINFOEXW Hints, _Outptr_ PADDRINFOEXW *Result, _In_opt_ PEPROCESS OwningProcess, _In_opt_ PETHREAD OwningThread, _Inout_ PIRP Irp Result)(Mem)) NTSTATUS(WSKAPI *PFN_WSK_GET_ADDRESS_INFO