WPSPIHLP.CPP

/*------------------------------------------------*\ 
*
*Copyright (c) 1997 Microsoft Corporation
*
*Module Name:
*
*wpspihlp.cpp
*
*Abstract:
*
*Implementation of WebPost Service Provider
*Interface helper functions.
*
\*------------------------------------------------*/


#include "stdafx.h"
#include <windows.h>
#include "util.h"
#include <wptypes.h>
#include "wpprov.h"
#include "wppobj.h"
#include "wpspi.h"
#include <wpapi.h>


#define IN_WPPDLL
#include <wpspihlp.h>


HRESULT WPPFUNC WINAPI WppBindToSiteW(
HWNDhwnd,
LPCWSTRwsSiteName,
LPCWSTRwsURL,
REFIIDriid,
DWORDdwFlag,
DWORDdwReserved,
PVOID *ppvUnk)
{
HRESULThRetCode = S_OK;
HRESULThResult;
CComObject<CWPProvider>*pWPP;

//
//Check arguments
//

if (!IsEqualIID(riid, IID_IUnknown) &&
!IsEqualIID(riid, IID_IWPSiteW) &&
!IsEqualIID(riid, IID_IWPProvider))
leave(E_NOINTERFACE);

if (IsBadWritePtr(ppvUnk, sizeof(IUnknown *)))
leave(E_INVALIDARG);

//
//Create new Service Provider object
//

pWPP = new CComObject<CWPProvider>;
if (NULL == pWPP)
leave(E_OUTOFMEMORY);

pWPP->AddRef();

//Initialize object state

hResult = pWPP->Init(wsSiteName, wsURL);
if (FAILED(hResult))
leave(hResult);

//If this is an autobind, try a test post

if (0 == (dwFlag & WPF_FORCE_BIND))
{
hResult = pWPP->DoTestPost();
if (FAILED(hResult))
leave(hResult);
}

//
//Set pointer provided to point to new object
//

*ppvUnk = pWPP;


leave_routine:

return(hRetCode);
}


HRESULT WPPFUNC WINAPI WppDeleteSiteW(LPCWSTR sSiteName)
{
HRESULThRetCode = S_OK;

//
//TO DO:Place implementation of site deletion code here
//

leave(S_OK);

leave_routine:

return(hRetCode);
}