ReactOS 0.4.16-dev-112-g52265ae
fprop.cpp File Reference
#include "precomp.h"
Include dependency graph for fprop.cpp:

Go to the source code of this file.

Functions

 WINE_DEFAULT_DEBUG_CHANNEL (shell)
 
EXTERN_C HPSXA WINAPI SHCreatePropSheetExtArrayEx (HKEY hKey, LPCWSTR pszSubKey, UINT max_iface, IDataObject *pDataObj)
 
static UINT LoadPropSheetHandlers (LPCWSTR pwszPath, PROPSHEETHEADERW *pHeader, UINT cMaxPages, HPSXA *phpsxa, IDataObject *pDataObj)
 
BOOL SH_ShowPropertiesDialog (LPCWSTR pwszPath, IDataObject *pDataObj)
 

Function Documentation

◆ LoadPropSheetHandlers()

static UINT LoadPropSheetHandlers ( LPCWSTR  pwszPath,
PROPSHEETHEADERW pHeader,
UINT  cMaxPages,
HPSXA *  phpsxa,
IDataObject pDataObj 
)
static

Definition at line 30 of file fprop.cpp.

31{
32 WCHAR wszBuf[MAX_PATH];
33 UINT cPages = 0, i = 0;
34
35 LPWSTR pwszFilename = PathFindFileNameW(pwszPath);
36 BOOL bDir = PathIsDirectoryW(pwszPath);
37
38 if (bDir)
39 {
40 phpsxa[i] = SHCreatePropSheetExtArrayEx(HKEY_CLASSES_ROOT, L"Folder", cMaxPages - cPages, pDataObj);
42
43 phpsxa[i] = SHCreatePropSheetExtArrayEx(HKEY_CLASSES_ROOT, L"Directory", cMaxPages - cPages, pDataObj);
45 }
46 else
47 {
48 /* Load property sheet handlers from ext key */
49 LPWSTR pwszExt = PathFindExtensionW(pwszFilename);
50 phpsxa[i] = SHCreatePropSheetExtArrayEx(HKEY_CLASSES_ROOT, pwszExt, cMaxPages - cPages, pDataObj);
52
53 /* Load property sheet handlers from prog id key */
54 DWORD cbBuf = sizeof(wszBuf);
55 if (RegGetValueW(HKEY_CLASSES_ROOT, pwszExt, L"", RRF_RT_REG_SZ, NULL, wszBuf, &cbBuf) == ERROR_SUCCESS)
56 {
57 TRACE("EnumPropSheetExt wszBuf %s, pwszExt %s\n", debugstr_w(wszBuf), debugstr_w(pwszExt));
58 phpsxa[i] = SHCreatePropSheetExtArrayEx(HKEY_CLASSES_ROOT, wszBuf, cMaxPages - cPages, pDataObj);
60 }
61
62 /* Add property sheet handlers from "*" key */
63 phpsxa[i] = SHCreatePropSheetExtArrayEx(HKEY_CLASSES_ROOT, L"*", cMaxPages - cPages, pDataObj);
65 }
66
67 return cPages;
68}
#define ERROR_SUCCESS
Definition: deptool.c:10
#define NULL
Definition: types.h:112
LSTATUS WINAPI RegGetValueW(HKEY hKey, LPCWSTR pszSubKey, LPCWSTR pszValue, DWORD dwFlags, LPDWORD pdwType, PVOID pvData, LPDWORD pcbData)
Definition: reg.c:1931
#define MAX_PATH
Definition: compat.h:34
#define RRF_RT_REG_SZ
Definition: driver.c:575
BOOL CALLBACK AddPropSheetPageCallback(HPROPSHEETPAGE hPage, LPARAM lParam)
Definition: precomp.h:135
LPWSTR WINAPI PathFindFileNameW(LPCWSTR lpszPath)
Definition: path.c:394
LPWSTR WINAPI PathFindExtensionW(LPCWSTR lpszPath)
Definition: path.c:447
BOOL WINAPI PathIsDirectoryW(LPCWSTR lpszPath)
Definition: path.c:1723
unsigned int BOOL
Definition: ntddk_ex.h:94
unsigned long DWORD
Definition: ntddk_ex.h:95
EXTERN_C HPSXA WINAPI SHCreatePropSheetExtArrayEx(HKEY hKey, LPCWSTR pszSubKey, UINT max_iface, IDataObject *pDataObj)
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
Definition: glfuncs.h:248
FxContextHeader * pHeader
Definition: handleapi.cpp:604
#define debugstr_w
Definition: kernel32.h:32
unsigned int UINT
Definition: ndis.h:50
#define L(x)
Definition: ntvdm.h:50
UINT WINAPI SHAddFromPropSheetExtArray(HPSXA hpsxa, LPFNADDPROPSHEETPAGE lpfnAddPage, LPARAM lParam)
Definition: shellord.c:2213
#define TRACE(s)
Definition: solgame.cpp:4
LONG_PTR LPARAM
Definition: windef.h:208
#define HKEY_CLASSES_ROOT
Definition: winreg.h:10
__wchar_t WCHAR
Definition: xmlstorage.h:180
WCHAR * LPWSTR
Definition: xmlstorage.h:184

Referenced by SH_ShowPropertiesDialog().

◆ SH_ShowPropertiesDialog()

BOOL SH_ShowPropertiesDialog ( LPCWSTR  pwszPath,
IDataObject pDataObj 
)

Definition at line 83 of file fprop.cpp.

84{
85 HPSXA hpsxa[3] = {NULL, NULL, NULL};
86 CComObject<CFileDefExt> *pFileDefExt = NULL;
87
88 TRACE("SH_ShowPropertiesDialog entered filename %s\n", debugstr_w(pwszPath));
89
90 if (pwszPath == NULL || !wcslen(pwszPath))
91 return FALSE;
92
94 memset(hppages, 0x0, sizeof(HPROPSHEETPAGE) * MAX_PROPERTY_SHEET_PAGE);
95
96 /* Make a copy of path */
97 WCHAR wszPath[MAX_PATH];
98 StringCbCopyW(wszPath, sizeof(wszPath), pwszPath);
99
100 /* remove trailing \\ at the end of path */
101 PathRemoveBackslashW(wszPath);
102
103 CDataObjectHIDA cida(pDataObj);
104 if (FAILED_UNEXPECTEDLY(cida.hr()))
105 return FALSE;
106
107 if (cida->cidl == 0)
108 {
109 ERR("Empty HIDA\n");
110 return FALSE;
111 }
112
113 /* Handle drives */
114 if (_ILIsDrive(HIDA_GetPIDLItem(cida, 0)))
115 return SH_ShowDriveProperties(wszPath, pDataObj);
116
117
118 RECT rcPosition = {CW_USEDEFAULT, CW_USEDEFAULT, 0, 0};
119 POINT pt;
120 if (SUCCEEDED(DataObject_GetOffset(pDataObj, &pt)))
121 {
122 rcPosition.left = pt.x;
123 rcPosition.top = pt.y;
124 }
125
129 if (!stub.Create(NULL, rcPosition, NULL, style, exstyle))
130 {
131 ERR("StubWindow32 creation failed\n");
132 return FALSE;
133 }
134
135 /* Handle files and folders */
137 memset(&Header, 0x0, sizeof(PROPSHEETHEADERW));
138 Header.dwSize = sizeof(PROPSHEETHEADERW);
139 Header.hwndParent = stub;
140 Header.dwFlags = PSH_NOCONTEXTHELP | PSH_PROPTITLE;
141 Header.phpage = hppages;
142 Header.pszCaption = PathFindFileNameW(wszPath);
143
144 HRESULT hr = CComObject<CFileDefExt>::CreateInstance(&pFileDefExt);
145 if (SUCCEEDED(hr))
146 {
147 pFileDefExt->AddRef(); // CreateInstance returns object with 0 ref count
148 hr = pFileDefExt->Initialize(HIDA_GetPIDLFolder(cida), pDataObj, NULL);
150 {
151 hr = pFileDefExt->AddPages(AddPropSheetPageCallback, (LPARAM)&Header);
153 {
154 ERR("AddPages failed\n");
155 return FALSE;
156 }
157 }
158 else
159 {
160 ERR("Initialize failed\n");
161 return FALSE;
162 }
163 }
164
165 LoadPropSheetHandlers(wszPath, &Header, MAX_PROPERTY_SHEET_PAGE - 1, hpsxa, pDataObj);
166
168
169 for (UINT i = 0; i < 3; ++i)
170 if (hpsxa[i])
172 if (pFileDefExt)
173 pFileDefExt->Release();
174
175 stub.DestroyWindow();
176
177 return (Result != -1);
178}
Arabic default style
Definition: afstyles.h:94
#define ERR(fmt,...)
Definition: precomp.h:57
Definition: Header.h:9
#define FALSE
Definition: types.h:117
INT_PTR WINAPI PropertySheetW(LPCPROPSHEETHEADERW lppsh)
Definition: propsheet.c:2916
#define FAILED_UNEXPECTEDLY(hr)
Definition: precomp.h:121
LPWSTR WINAPI PathRemoveBackslashW(LPWSTR lpszPath)
Definition: path.c:867
#define pt(x, y)
Definition: drawing.c:79
BOOL SH_ShowDriveProperties(WCHAR *pwszDrive, IDataObject *pDataObj)
Definition: drive.cpp:251
static UINT LoadPropSheetHandlers(LPCWSTR pwszPath, PROPSHEETHEADERW *pHeader, UINT cMaxPages, HPSXA *phpsxa, IDataObject *pDataObj)
Definition: fprop.cpp:30
_CRTIMP size_t __cdecl wcslen(_In_z_ const wchar_t *_Str)
#define SUCCEEDED(hr)
Definition: intsafe.h:50
struct _PSP * HPROPSHEETPAGE
Definition: mstask.idl:90
#define WS_CAPTION
Definition: pedump.c:624
#define WS_DISABLED
Definition: pedump.c:621
#define WS_CLIPSIBLINGS
Definition: pedump.c:618
BOOL _ILIsDrive(LPCITEMIDLIST pidl)
Definition: pidl.c:2009
#define PSH_PROPTITLE
Definition: prsht.h:40
struct _PROPSHEETHEADERW PROPSHEETHEADERW
#define memset(x, y, z)
Definition: compat.h:39
void WINAPI SHDestroyPropSheetExtArray(HPSXA hpsxa)
Definition: shellord.c:2390
static PCUIDLIST_RELATIVE HIDA_GetPIDLItem(CIDA const *pida, SIZE_T i)
Definition: shellutils.h:639
static PCUIDLIST_ABSOLUTE HIDA_GetPIDLFolder(CIDA const *pida)
Definition: shellutils.h:634
#define MAX_PROPERTY_SHEET_PAGE
HRESULT hr
Definition: shlfolder.c:183
STRSAFEAPI StringCbCopyW(STRSAFE_LPWSTR pszDest, size_t cbDest, STRSAFE_LPCWSTR pszSrc)
Definition: strsafe.h:166
Definition: stubgen.c:11
LONG top
Definition: windef.h:307
LONG left
Definition: windef.h:306
struct _stub stub
int32_t INT_PTR
Definition: typedefs.h:64
#define WS_EX_APPWINDOW
Definition: winuser.h:383
#define WS_EX_WINDOWEDGE
Definition: winuser.h:407
#define CW_USEDEFAULT
Definition: winuser.h:225
_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
Definition: wsk.h:409

Referenced by _ShowPropertiesDialogThread(), and CFSFolder::CallBack().

◆ SHCreatePropSheetExtArrayEx()

EXTERN_C HPSXA WINAPI SHCreatePropSheetExtArrayEx ( HKEY  hKey,
LPCWSTR  pszSubKey,
UINT  max_iface,
IDataObject pDataObj 
)

Referenced by LoadPropSheetHandlers().

◆ WINE_DEFAULT_DEBUG_CHANNEL()

WINE_DEFAULT_DEBUG_CHANNEL ( shell  )