?? ordinal.c
字號:
IUnknown_Release(lpContainer);
}
return hRet;
}
/*************************************************************************
* @ [SHLWAPI.169]
*
* Release an interface.
*
* PARAMS
* lpUnknown [I] Object to release
*
* RETURNS
* Nothing.
*/
DWORD WINAPI IUnknown_AtomicRelease(IUnknown ** lpUnknown)
{
IUnknown *temp;
TRACE("(%p)\n",lpUnknown);
if(!lpUnknown || !*((LPDWORD)lpUnknown)) return 0;
temp = *lpUnknown;
*lpUnknown = NULL;
TRACE("doing Release\n");
return IUnknown_Release(temp);
}
/*************************************************************************
* @ [SHLWAPI.170]
*
* Skip '//' if present in a string.
*
* PARAMS
* lpszSrc [I] String to check for '//'
*
* RETURNS
* Success: The next character after the '//' or the string if not present
* Failure: NULL, if lpszStr is NULL.
*/
LPCSTR WINAPI PathSkipLeadingSlashesA(LPCSTR lpszSrc)
{
if (lpszSrc && lpszSrc[0] == '/' && lpszSrc[1] == '/')
lpszSrc += 2;
return lpszSrc;
}
/*************************************************************************
* @ [SHLWAPI.171]
*
* Check if two interfaces come from the same object.
*
* PARAMS
* lpInt1 [I] Interface to check against lpInt2.
* lpInt2 [I] Interface to check against lpInt1.
*
* RETURNS
* TRUE, If the interfaces come from the same object.
* FALSE Otherwise.
*/
BOOL WINAPI SHIsSameObject(IUnknown* lpInt1, IUnknown* lpInt2)
{
LPVOID lpUnknown1, lpUnknown2;
TRACE("%p %p\n", lpInt1, lpInt2);
if (!lpInt1 || !lpInt2)
return FALSE;
if (lpInt1 == lpInt2)
return TRUE;
if (!SUCCEEDED(IUnknown_QueryInterface(lpInt1, &IID_IUnknown,
(LPVOID *)&lpUnknown1)))
return FALSE;
if (!SUCCEEDED(IUnknown_QueryInterface(lpInt2, &IID_IUnknown,
(LPVOID *)&lpUnknown2)))
return FALSE;
if (lpUnknown1 == lpUnknown2)
return TRUE;
return FALSE;
}
/*************************************************************************
* @ [SHLWAPI.172]
*
* Get the window handle of an object.
*
* PARAMS
* lpUnknown [I] Object to get the window handle of
* lphWnd [O] Destination for window handle
*
* RETURNS
* Success: S_OK. lphWnd contains the objects window handle.
* Failure: An HRESULT error code.
*
* NOTES
* lpUnknown is expected to support one of the following interfaces:
* IOleWindow(), IInternetSecurityMgrSite(), or IShellView().
*/
HRESULT WINAPI IUnknown_GetWindow(IUnknown *lpUnknown, HWND *lphWnd)
{
/* FIXME: Wine has no header for this object */
static const GUID IID_IInternetSecurityMgrSite = { 0x79eac9ed,
0xbaf9, 0x11ce, { 0x8c, 0x82, 0x00, 0xaa, 0x00, 0x4b, 0xa9, 0x0b }};
IUnknown *lpOle;
HRESULT hRet = E_FAIL;
TRACE("(%p,%p)\n", lpUnknown, lphWnd);
if (!lpUnknown)
return hRet;
hRet = IUnknown_QueryInterface(lpUnknown, &IID_IOleWindow, (void**)&lpOle);
if (FAILED(hRet))
{
hRet = IUnknown_QueryInterface(lpUnknown,&IID_IShellView, (void**)&lpOle);
if (FAILED(hRet))
{
hRet = IUnknown_QueryInterface(lpUnknown, &IID_IInternetSecurityMgrSite,
(void**)&lpOle);
}
}
if (SUCCEEDED(hRet))
{
/* Lazyness here - Since GetWindow() is the first method for the above 3
* interfaces, we use the same call for them all.
*/
hRet = IOleWindow_GetWindow((IOleWindow*)lpOle, lphWnd);
IUnknown_Release(lpOle);
if (lphWnd)
TRACE("Returning HWND=%p\n", *lphWnd);
}
return hRet;
}
/*************************************************************************
* @ [SHLWAPI.173]
*
* Call a method on as as yet unidentified object.
*
* PARAMS
* pUnk [I] Object supporting the unidentified interface,
* arg [I] Argument for the call on the object.
*
* RETURNS
* S_OK.
*/
HRESULT WINAPI IUnknown_SetOwner(IUnknown *pUnk, ULONG arg)
{
static const GUID guid_173 = {
0x5836fb00, 0x8187, 0x11cf, { 0xa1,0x2b,0x00,0xaa,0x00,0x4a,0xe8,0x37 }
};
IMalloc *pUnk2;
TRACE("(%p,%ld)\n", pUnk, arg);
/* Note: arg may not be a ULONG and pUnk2 is for sure not an IMalloc -
* We use this interface as its vtable entry is compatible with the
* object in question.
* FIXME: Find out what this object is and where it should be defined.
*/
if (pUnk &&
SUCCEEDED(IUnknown_QueryInterface(pUnk, &guid_173, (void**)&pUnk2)))
{
IMalloc_Alloc(pUnk2, arg); /* Faked call!! */
IMalloc_Release(pUnk2);
}
return S_OK;
}
/*************************************************************************
* @ [SHLWAPI.174]
*
* Call either IObjectWithSite_SetSite() or IInternetSecurityManager_SetSecuritySite() on
* an object.
*
*/
HRESULT WINAPI IUnknown_SetSite(
IUnknown *obj, /* [in] OLE object */
IUnknown *site) /* [in] Site interface */
{
HRESULT hr;
IObjectWithSite *iobjwithsite;
IInternetSecurityManager *isecmgr;
if (!obj) return E_FAIL;
hr = IUnknown_QueryInterface(obj, &IID_IObjectWithSite, (LPVOID *)&iobjwithsite);
TRACE("IID_IObjectWithSite QI ret=%08lx, %p\n", hr, iobjwithsite);
if (SUCCEEDED(hr))
{
hr = IObjectWithSite_SetSite(iobjwithsite, site);
TRACE("done IObjectWithSite_SetSite ret=%08lx\n", hr);
IUnknown_Release(iobjwithsite);
}
else
{
hr = IUnknown_QueryInterface(obj, &IID_IInternetSecurityManager, (LPVOID *)&isecmgr);
TRACE("IID_IInternetSecurityManager QI ret=%08lx, %p\n", hr, isecmgr);
if (FAILED(hr)) return hr;
hr = IInternetSecurityManager_SetSecuritySite(isecmgr, (IInternetSecurityMgrSite *)site);
TRACE("done IInternetSecurityManager_SetSecuritySite ret=%08lx\n", hr);
IUnknown_Release(isecmgr);
}
return hr;
}
/*************************************************************************
* @ [SHLWAPI.175]
*
* Call IPersist_GetClassID() on an object.
*
* PARAMS
* lpUnknown [I] Object supporting the IPersist interface
* lpClassId [O] Destination for Class Id
*
* RETURNS
* Success: S_OK. lpClassId contains the Class Id requested.
* Failure: E_FAIL, If lpUnknown is NULL,
* E_NOINTERFACE If lpUnknown does not support IPersist,
* Or an HRESULT error code.
*/
HRESULT WINAPI IUnknown_GetClassID(IUnknown *lpUnknown, CLSID* lpClassId)
{
IPersist* lpPersist;
HRESULT hRet = E_FAIL;
TRACE("(%p,%p)\n", lpUnknown, debugstr_guid(lpClassId));
if (lpUnknown)
{
hRet = IUnknown_QueryInterface(lpUnknown,&IID_IPersist,(void**)&lpPersist);
if (SUCCEEDED(hRet))
{
IPersist_GetClassID(lpPersist, lpClassId);
IPersist_Release(lpPersist);
}
}
return hRet;
}
/*************************************************************************
* @ [SHLWAPI.176]
*
* Retrieve a Service Interface from an object.
*
* PARAMS
* lpUnknown [I] Object to get an IServiceProvider interface from
* sid [I] Service ID for IServiceProvider_QueryService() call
* riid [I] Function requested for QueryService call
* lppOut [O] Destination for the service interface pointer
*
* RETURNS
* Success: S_OK. lppOut contains an object providing the requested service
* Failure: An HRESULT error code
*
* NOTES
* lpUnknown is expected to support the IServiceProvider interface.
*/
HRESULT WINAPI IUnknown_QueryService(IUnknown* lpUnknown, REFGUID sid, REFIID riid,
LPVOID *lppOut)
{
IServiceProvider* pService = NULL;
HRESULT hRet;
if (!lppOut)
return E_FAIL;
*lppOut = NULL;
if (!lpUnknown)
return E_FAIL;
/* Get an IServiceProvider interface from the object */
hRet = IUnknown_QueryInterface(lpUnknown, &IID_IServiceProvider,
(LPVOID*)&pService);
if (!hRet && pService)
{
TRACE("QueryInterface returned (IServiceProvider*)%p\n", pService);
/* Get a Service interface from the object */
hRet = IServiceProvider_QueryService(pService, sid, riid, lppOut);
TRACE("(IServiceProvider*)%p returned (IUnknown*)%p\n", pService, *lppOut);
/* Release the IServiceProvider interface */
IUnknown_Release(pService);
}
return hRet;
}
/*************************************************************************
* @ [SHLWAPI.177]
*
* Loads a popup menu.
*
* PARAMS
* hInst [I] Instance handle
* szName [I] Menu name
*
* RETURNS
* Success: TRUE.
* Failure: FALSE.
*/
BOOL WINAPI SHLoadMenuPopup(HINSTANCE hInst, LPCWSTR szName)
{
HMENU hMenu, hSubMenu;
if ((hMenu = LoadMenuW(hInst, szName)))
{
if ((hSubMenu = GetSubMenu(hMenu, 0)))
RemoveMenu(hMenu, 0, MF_BYPOSITION);
DestroyMenu(hMenu);
return TRUE;
}
return FALSE;
}
typedef struct _enumWndData
{
UINT uiMsgId;
WPARAM wParam;
LPARAM lParam;
LRESULT (WINAPI *pfnPost)(HWND,UINT,WPARAM,LPARAM);
} enumWndData;
/* Callback for SHLWAPI_178 */
static BOOL CALLBACK SHLWAPI_EnumChildProc(HWND hWnd, LPARAM lParam)
{
enumWndData *data = (enumWndData *)lParam;
TRACE("(%p,%p)\n", hWnd, data);
data->pfnPost(hWnd, data->uiMsgId, data->wParam, data->lParam);
return TRUE;
}
/*************************************************************************
* @ [SHLWAPI.178]
*
* Send or post a message to every child of a window.
*
* PARAMS
* hWnd [I] Window whose children will get the messages
* uiMsgId [I] Message Id
* wParam [I] WPARAM of message
* lParam [I] LPARAM of message
* bSend [I] TRUE = Use SendMessageA(), FALSE = Use PostMessageA()
*
* RETURNS
* Nothing.
*
* NOTES
* The appropriate ASCII or Unicode function is called for the window.
*/
void WINAPI SHPropagateMessage(HWND hWnd, UINT uiMsgId, WPARAM wParam, LPARAM lParam, BOOL bSend)
{
enumWndData data;
TRACE("(%p,%u,%d,%ld,%d)\n", hWnd, uiMsgId, wParam, lParam, bSend);
if(hWnd)
{
data.uiMsgId = uiMsgId;
data.wParam = wParam;
data.lParam = lParam;
if (bSend)
data.pfnPost = IsWindowUnicode(hWnd) ? (void*)SendMessageW : (void*)SendMessageA;
else
data.pfnPost = IsWindowUnicode(hWnd) ? (void*)PostMessageW : (void*)PostMessageA;
EnumChildWindows(hWnd, SHLWAPI_EnumChildProc, (LPARAM)&data);
}
}
/*************************************************************************
* @ [SHLWAPI.180]
*
* Remove all sub-menus from a menu.
*
* PARAMS
* hMenu [I] Menu to remove sub-menus from
*
* RETURNS
* Success: 0. All sub-menus under hMenu are removed
* Failure: -1, if any parameter is invalid
*/
DWORD WINAPI SHRemoveAllSubMenus(HMENU hMenu)
{
int iItemCount = GetMenuItemCount(hMenu) - 1;
while (iItemCount >= 0)
{
HMENU hSubMenu = GetSubMenu(hMenu, iItemCount);
if (hSubMenu)
RemoveMenu(hMenu, iItemCount, MF_BYPOSITION);
iItemCount--;
}
return iItemCount;
}
/*************************************************************************
* @ [SHLWAPI.181]
*
* Enable or disable a menu item.
*
* PARAMS
* hMenu [I] Menu holding menu item
* uID [I] ID of menu item to enable/disable
* bEnable [I] Whether to enable (TRUE) or disable (FALSE) the item.
*
* RETURNS
* The return code from EnableMenuItem.
*/
UINT WINAPI SHEnableMenuItem(HMENU hMenu, UINT wItemID, BOOL bEnable)
{
return EnableMenuItem(hMenu, wItemID, bEnable ? MF_ENABLED : MF_GRAYED);
}
/*************************************************************************
* @ [SHLWAPI.182]
*
?? 快捷鍵說明
復(fù)制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -