extern DWORD SHLWAPI_ThreadRef_index;
HRESULT WINAPI IUnknown_QueryService(IUnknown*,REFGUID,REFIID,LPVOID*);
-HRESULT WINAPI SHInvokeCommand(HWND,IShellFolder*,LPCITEMIDLIST,BOOL);
+HRESULT WINAPI SHInvokeCommand(HWND,IShellFolder*,LPCITEMIDLIST,DWORD);
BOOL WINAPI SHAboutInfoW(LPWSTR,DWORD);
/*
*/
/*************************************************************************
- * SHLWAPI_DupSharedHandle
+ * @ [SHLWAPI.11]
+ *
+ * Copy a sharable memory handle from one process to another.
+ *
+ * PARAMS
+ * hShared [I] Shared memory handle to duplicate
+ * dwSrcProcId [I] ID of the process owning hShared
+ * dwDstProcId [I] ID of the process wanting the duplicated handle
+ * dwAccess [I] Desired DuplicateHandle() access
+ * dwOptions [I] Desired DuplicateHandle() options
+ *
+ * RETURNS
+ * Success: A handle suitable for use by the dwDstProcId process.
+ * Failure: A NULL handle.
*
- * Internal implementation of SHLWAPI_11.
*/
-static HANDLE SHLWAPI_DupSharedHandle(HANDLE hShared, DWORD dwDstProcId,
- DWORD dwSrcProcId, DWORD dwAccess,
- DWORD dwOptions)
+HANDLE WINAPI SHMapHandle(HANDLE hShared, DWORD dwSrcProcId, DWORD dwDstProcId,
+ DWORD dwAccess, DWORD dwOptions)
{
HANDLE hDst, hSrc;
DWORD dwMyProcId = GetCurrentProcessId();
TRACE("(%p,%d,%d,%08x,%08x)\n", hShared, dwDstProcId, dwSrcProcId,
dwAccess, dwOptions);
+ if (!hShared)
+ {
+ TRACE("Returning handle NULL\n");
+ return NULL;
+ }
+
/* Get dest process handle */
if (dwDstProcId == dwMyProcId)
hDst = GetCurrentProcess();
if (hSrc)
{
/* Make handle available to dest process */
- if (!DuplicateHandle(hDst, hShared, hSrc, &hRet,
+ if (!DuplicateHandle(hSrc, hShared, hDst, &hRet,
dwAccess, 0, dwOptions | DUPLICATE_SAME_ACCESS))
hRet = NULL;
/* Release view. All further views mapped will be opaque */
UnmapViewOfFile(pMapped);
- hRet = SHLWAPI_DupSharedHandle(hMap, dwProcId,
- GetCurrentProcessId(), FILE_MAP_ALL_ACCESS,
- DUPLICATE_SAME_ACCESS);
+ hRet = SHMapHandle(hMap, GetCurrentProcessId(), dwProcId,
+ FILE_MAP_ALL_ACCESS, DUPLICATE_SAME_ACCESS);
}
CloseHandle(hMap);
TRACE("(%p %d)\n", hShared, dwProcId);
/* Get handle to shared memory for current process */
- hDup = SHLWAPI_DupSharedHandle(hShared, dwProcId, GetCurrentProcessId(),
- FILE_MAP_ALL_ACCESS, 0);
+ hDup = SHMapHandle(hShared, dwProcId, GetCurrentProcessId(), FILE_MAP_ALL_ACCESS, 0);
+
/* Get View */
pMapped = MapViewOfFile(hDup, FILE_MAP_READ | FILE_MAP_WRITE, 0, 0, 0);
CloseHandle(hDup);
TRACE("(%p %d)\n", hShared, dwProcId);
+ if (!hShared)
+ return TRUE;
+
/* Get a copy of the handle for our process, closing the source handle */
- hClose = SHLWAPI_DupSharedHandle(hShared, dwProcId, GetCurrentProcessId(),
- FILE_MAP_ALL_ACCESS,DUPLICATE_CLOSE_SOURCE);
+ hClose = SHMapHandle(hShared, dwProcId, GetCurrentProcessId(),
+ FILE_MAP_ALL_ACCESS,DUPLICATE_CLOSE_SOURCE);
/* Close local copy */
return CloseHandle(hClose);
}
-/*************************************************************************
- * @ [SHLWAPI.11]
- *
- * Copy a sharable memory handle from one process to another.
- *
- * PARAMS
- * hShared [I] Shared memory handle to duplicate
- * dwDstProcId [I] ID of the process wanting the duplicated handle
- * dwSrcProcId [I] ID of the process owning hShared
- * dwAccess [I] Desired DuplicateHandle() access
- * dwOptions [I] Desired DuplicateHandle() options
- *
- * RETURNS
- * Success: A handle suitable for use by the dwDstProcId process.
- * Failure: A NULL handle.
- *
- */
-HANDLE WINAPI SHMapHandle(HANDLE hShared, DWORD dwDstProcId, DWORD dwSrcProcId,
- DWORD dwAccess, DWORD dwOptions)
-{
- HANDLE hRet;
-
- hRet = SHLWAPI_DupSharedHandle(hShared, dwDstProcId, dwSrcProcId,
- dwAccess, dwOptions);
- return hRet;
-}
-
/*************************************************************************
* @ [SHLWAPI.13]
*
* Success: S_OK. langbuf is set to the language string found.
* Failure: E_FAIL, If any arguments are invalid, error occurred, or Explorer
* does not contain the setting.
- * HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER), If the buffer is not big enough
+ * E_NOT_SUFFICIENT_BUFFER, If the buffer is not big enough
*/
HRESULT WINAPI GetAcceptLanguagesW( LPWSTR langbuf, LPDWORD buflen)
{
}
*buflen = 0;
- return __HRESULT_FROM_WIN32(ERROR_INSUFFICIENT_BUFFER);
+ return E_NOT_SUFFICIENT_BUFFER;
}
/*************************************************************************
*
* PARAMS
* lpUnknown [I] Object supporting the IPersist interface
- * lpClassId [O] Destination for Class Id
+ * clsid [O] Destination for Class Id
*
* RETURNS
* Success: S_OK. lpClassId contains the Class Id requested.
* E_NOINTERFACE If lpUnknown does not support IPersist,
* Or an HRESULT error code.
*/
-HRESULT WINAPI IUnknown_GetClassID(IUnknown *lpUnknown, CLSID* lpClassId)
+HRESULT WINAPI IUnknown_GetClassID(IUnknown *lpUnknown, CLSID *clsid)
{
- IPersist* lpPersist;
- HRESULT hRet = E_FAIL;
+ IPersist *persist;
+ HRESULT hr;
- TRACE("(%p,%s)\n", lpUnknown, debugstr_guid(lpClassId));
+ TRACE("(%p, %p)\n", lpUnknown, clsid);
- if (lpUnknown)
- {
- hRet = IUnknown_QueryInterface(lpUnknown,&IID_IPersist,(void**)&lpPersist);
- if (SUCCEEDED(hRet))
+ if (!lpUnknown)
{
- IPersist_GetClassID(lpPersist, lpClassId);
- IPersist_Release(lpPersist);
+ memset(clsid, 0, sizeof(*clsid));
+ return E_FAIL;
}
- }
- return hRet;
+
+ hr = IUnknown_QueryInterface(lpUnknown, &IID_IPersist, (void**)&persist);
+ if (hr != S_OK)
+ {
+ hr = IUnknown_QueryInterface(lpUnknown, &IID_IPersistFolder, (void**)&persist);
+ if (hr != S_OK)
+ return hr;
+ }
+
+ hr = IPersist_GetClassID(persist, clsid);
+ IPersist_Release(persist);
+ return hr;
}
/*************************************************************************
HRESULT WINAPI SHInvokeDefaultCommand(HWND hWnd, IShellFolder* lpFolder, LPCITEMIDLIST lpApidl)
{
TRACE("%p %p %p\n", hWnd, lpFolder, lpApidl);
- return SHInvokeCommand(hWnd, lpFolder, lpApidl, FALSE);
+ return SHInvokeCommand(hWnd, lpFolder, lpApidl, 0);
}
/*************************************************************************
* hWnd [I] Window displaying the shell folder
* lpFolder [I] IShellFolder interface
* lpApidl [I] Id for the particular folder desired
- * bInvokeDefault [I] Whether to invoke the default menu item
+ * dwCommandId [I] The command ID to invoke (0=invoke default)
*
* RETURNS
* Success: S_OK. If bInvokeDefault is TRUE, the default menu action was
* executed.
* Failure: An HRESULT error code indicating the error.
*/
-HRESULT WINAPI SHInvokeCommand(HWND hWnd, IShellFolder* lpFolder, LPCITEMIDLIST lpApidl, BOOL bInvokeDefault)
+HRESULT WINAPI SHInvokeCommand(HWND hWnd, IShellFolder* lpFolder, LPCITEMIDLIST lpApidl, DWORD dwCommandId)
{
IContextMenu *iContext;
HRESULT hRet;
- TRACE("(%p, %p, %p, %d)\n", hWnd, lpFolder, lpApidl, bInvokeDefault);
+ TRACE("(%p, %p, %p, %u)\n", hWnd, lpFolder, lpApidl, dwCommandId);
if (!lpFolder)
return E_FAIL;
if ((hMenu = CreatePopupMenu()))
{
HRESULT hQuery;
- DWORD dwDefaultId = 0;
/* Add the context menu entries to the popup */
hQuery = IContextMenu_QueryContextMenu(iContext, hMenu, 0, 1, 0x7FFF,
- bInvokeDefault ? CMF_NORMAL : CMF_DEFAULTONLY);
+ dwCommandId ? CMF_NORMAL : CMF_DEFAULTONLY);
if (SUCCEEDED(hQuery))
{
- if (bInvokeDefault &&
- (dwDefaultId = GetMenuDefaultItem(hMenu, 0, 0)) != (UINT)-1)
+ if (!dwCommandId)
+ dwCommandId = GetMenuDefaultItem(hMenu, 0, 0);
+ if (dwCommandId != (UINT)-1)
{
CMINVOKECOMMANDINFO cmIci;
/* Invoke the default item */
cmIci.cbSize = sizeof(cmIci);
cmIci.fMask = CMIC_MASK_ASYNCOK;
cmIci.hwnd = hWnd;
- cmIci.lpVerb = MAKEINTRESOURCEA(dwDefaultId);
- cmIci.nShow = SW_SCROLLCHILDREN;
+#ifdef __REACTOS__ /* r75561 */
+ cmIci.lpVerb = MAKEINTRESOURCEA(dwCommandId - 1);
+#else
+ cmIci.lpVerb = MAKEINTRESOURCEA(dwCommandId);
+#endif
+ cmIci.nShow = SW_SHOWNORMAL;
hRet = IContextMenu_InvokeCommand(iContext, &cmIci);
}
case OS_SMALLBUSINESSSERVER:
ISOS_RETURN(platform == VER_PLATFORM_WIN32_NT)
case OS_TABLETPC:
- FIXME("(OS_TABLEPC) What should we return here?\n");
+ FIXME("(OS_TABLETPC) What should we return here?\n");
return FALSE;
case OS_SERVERADMINUI:
FIXME("(OS_SERVERADMINUI) What should we return here?\n");
* NOTES
* Call should free returned descriptor with LocalFree
*/
-PSECURITY_DESCRIPTOR WINAPI GetShellSecurityDescriptor(PSHELL_USER_PERMISSION *apUserPerm, int cUserPerm)
+PSECURITY_DESCRIPTOR WINAPI GetShellSecurityDescriptor(const PSHELL_USER_PERMISSION *apUserPerm, int cUserPerm)
{
PSID *sidlist;
PSID cur_user = NULL;
{
if ((fmt_flags & FDTF_LONGDATE) && (ret < size + 2))
{
- if (ret < size + 2)
- {
- lstrcatW(&buf[ret-1], sep1);
- ret += 2;
- }
+ lstrcatW(&buf[ret-1], sep1);
+ ret += 2;
}
else
{
* pValue: address to receive the property value as a 32-bit signed integer
*
* RETURNS
- * 0 for Success
+ * HRESULT codes
*/
-BOOL WINAPI SHPropertyBag_ReadLONG(IPropertyBag *ppb, LPCWSTR pszPropName, LPLONG pValue)
+HRESULT WINAPI SHPropertyBag_ReadLONG(IPropertyBag *ppb, LPCWSTR pszPropName, LPLONG pValue)
{
VARIANT var;
HRESULT hr;
return hr;
}
+#ifdef __REACTOS__
+/**************************************************************************
+ * SHPropertyBag_WriteLONG (SHLWAPI.497)
+ *
+ * This function asks a property bag to write a named property as a LONG.
+ *
+ * PARAMS
+ * ppb: a IPropertyBag interface
+ * pszPropName: Unicode string that names the property
+ * lValue: address to receive the property value as a 32-bit signed integer
+ *
+ * RETURNS
+ * HRESULT codes
+ */
+HRESULT WINAPI SHPropertyBag_WriteLONG(IPropertyBag *ppb, LPCWSTR pszPropName, LONG lValue)
+{
+ UNIMPLEMENTED;
+ return E_NOTIMPL;
+}
+
+/**************************************************************************
+ * SHPropertyBag_WriteStr (SHLWAPI.495)
+ *
+ * This function asks a property bag to write a string as the value of a named property.
+ *
+ * PARAMS
+ * ppb: a IPropertyBag interface
+ * pszPropName: Unicode string that names the property
+ * pValue: address to write the property value
+ *
+ * RETURNS
+ * HRESULT codes
+ */
+HRESULT WINAPI SHPropertyBag_WriteStr(IPropertyBag *ppb, LPCWSTR pszPropName, LPCWSTR pszValue)
+{
+ UNIMPLEMENTED;
+ return E_NOTIMPL;
+}
+#endif
+
/* return flags for SHGetObjectCompatFlags, names derived from registry value names */
#define OBJCOMPAT_OTNEEDSSFCACHE 0x00000001
#define OBJCOMPAT_NO_WEBVIEW 0x00000002