ole32: Implement CoQueryClientBlanket, CoImpersonateClient and

CoRevertToSelf on top of CoGetCallContext, which is a stub.
This commit is contained in:
Robert Shearman 2006-06-09 17:24:39 +01:00 committed by Alexandre Julliard
parent 42c39675ea
commit 51e22f42bb
2 changed files with 147 additions and 4 deletions

View File

@ -2641,6 +2641,149 @@ HRESULT WINAPI CoCopyProxy(IUnknown *pProxy, IUnknown **ppCopy)
}
/***********************************************************************
* CoGetCallContext [OLE32.@]
*
* Gets the context of the currently executing server call in the current
* thread.
*
* PARAMS
* riid [I] Context interface to return.
* ppv [O] Pointer to memory that will receive the context on return.
*
* RETURNS
* Success: S_OK.
* Failure: HRESULT code.
*/
HRESULT WINAPI CoGetCallContext(REFIID riid, void **ppv)
{
FIXME("(%s, %p): stub\n", debugstr_guid(riid), ppv);
*ppv = NULL;
return E_NOINTERFACE;
}
/***********************************************************************
* CoQueryClientBlanket [OLE32.@]
*
* Retrieves the authentication information about the client of the currently
* executing server call in the current thread.
*
* PARAMS
* pAuthnSvc [O] Optional. The type of authentication service.
* pAuthzSvc [O] Optional. The type of authorization service.
* pServerPrincName [O] Optional. The server prinicple name.
* pAuthnLevel [O] Optional. The authentication level.
* pImpLevel [O] Optional. The impersonation level.
* pPrivs [O] Optional. Information about the privileges of the client.
* pCapabilities [IO] Optional. Flags affecting the security behaviour.
*
* RETURNS
* Success: S_OK.
* Failure: HRESULT code.
*
* SEE ALSO
* CoImpersonateClient, CoRevertToSelf, CoGetCallContext.
*/
HRESULT WINAPI CoQueryClientBlanket(
DWORD *pAuthnSvc,
DWORD *pAuthzSvc,
OLECHAR **pServerPrincName,
DWORD *pAuthnLevel,
DWORD *pImpLevel,
RPC_AUTHZ_HANDLE *pPrivs,
DWORD *pCapabilities)
{
IServerSecurity *pSrvSec;
HRESULT hr;
TRACE("(%p, %p, %p, %p, %p, %p, %p)\n",
pAuthnSvc, pAuthzSvc, pServerPrincName, pAuthnLevel, pImpLevel,
pPrivs, pCapabilities);
hr = CoGetCallContext(&IID_IServerSecurity, (void **)&pSrvSec);
if (SUCCEEDED(hr))
{
hr = IServerSecurity_QueryBlanket(
pSrvSec, pAuthnSvc, pAuthzSvc, pServerPrincName, pAuthnLevel,
pImpLevel, pPrivs, pCapabilities);
IServerSecurity_Release(pSrvSec);
}
return hr;
}
/***********************************************************************
* CoImpersonateClient [OLE32.@]
*
* Impersonates the client of the currently executing server call in the
* current thread.
*
* PARAMS
* None.
*
* RETURNS
* Success: S_OK.
* Failure: HRESULT code.
*
* NOTES
* If this function fails then the current thread will not be impersonating
* the client and all actions will take place on behalf of the server.
* Therefore, it is important to check the return value from this function.
*
* SEE ALSO
* CoRevertToSelf, CoQueryClientBlanket, CoGetCallContext.
*/
HRESULT WINAPI CoImpersonateClient(void)
{
IServerSecurity *pSrvSec;
HRESULT hr;
TRACE("\n");
hr = CoGetCallContext(&IID_IServerSecurity, (void **)&pSrvSec);
if (SUCCEEDED(hr))
{
hr = IServerSecurity_ImpersonateClient(pSrvSec);
IServerSecurity_Release(pSrvSec);
}
return hr;
}
/***********************************************************************
* CoRevertToSelf [OLE32.@]
*
* Ends the impersonation of the client of the currently executing server
* call in the current thread.
*
* PARAMS
* None.
*
* RETURNS
* Success: S_OK.
* Failure: HRESULT code.
*
* SEE ALSO
* CoImpersonateClient, CoQueryClientBlanket, CoGetCallContext.
*/
HRESULT WINAPI CoRevertToSelf(void)
{
IServerSecurity *pSrvSec;
HRESULT hr;
TRACE("\n");
hr = CoGetCallContext(&IID_IServerSecurity, (void **)&pSrvSec);
if (SUCCEEDED(hr))
{
hr = IServerSecurity_RevertToSelf(pSrvSec);
IServerSecurity_Release(pSrvSec);
}
return hr;
}
static BOOL COM_PeekMessage(struct apartment *apt, MSG *msg)
{
/* first try to retrieve messages for incoming COM calls to the apartment window */

View File

@ -20,7 +20,7 @@
@ stdcall CoFreeAllLibraries()
@ stdcall CoFreeLibrary(long)
@ stdcall CoFreeUnusedLibraries()
@ stub CoGetCallContext #@ stdcall (ptr ptr) return 0,ERR_NOTIMPLEMENTED
@ stdcall CoGetCallContext(ptr ptr)
@ stub CoGetCallerTID
@ stdcall CoGetClassObject(ptr long ptr ptr ptr)
@ stub CoGetCurrentLogicalThreadId
@ -36,7 +36,7 @@
@ stdcall CoGetState(ptr)
@ stub CoGetTIDFromIPID
@ stdcall CoGetTreatAsClass(ptr ptr)
@ stub CoImpersonateClient
@ stdcall CoImpersonateClient()
@ stdcall CoInitialize(ptr)
@ stdcall CoInitializeEx(ptr long)
@ stdcall CoInitializeSecurity(ptr long ptr ptr long long ptr long ptr)
@ -49,7 +49,7 @@
@ stdcall CoMarshalInterThreadInterfaceInStream(ptr ptr ptr)
@ stdcall CoMarshalInterface(ptr ptr ptr long ptr long)
@ stub CoQueryAuthenticationServices
@ stub CoQueryClientBlanket
@ stdcall CoQueryClientBlanket(ptr ptr ptr ptr ptr ptr ptr)
@ stdcall CoQueryProxyBlanket(ptr ptr ptr ptr ptr ptr ptr ptr)
@ stub CoQueryReleaseObject
@ stub CoRegisterChannelHook
@ -61,7 +61,7 @@
@ stdcall CoReleaseMarshalData(ptr)
@ stdcall CoReleaseServerProcess()
@ stdcall CoResumeClassObjects()
@ stub CoRevertToSelf #@ stdcall () return 0,ERR_NOTIMPLEMENTED
@ stdcall CoRevertToSelf()
@ stdcall CoRevokeClassObject(long)
@ stdcall CoRevokeMallocSpy()
@ stdcall CoSetProxyBlanket(ptr long long wstr long long ptr long)