WPPOBJ.CPP
/*------------------------------------------------*\ 
 * 
 *Copyright (c) 1997 Microsoft Corporation 
 * 
 *Module Name: 
 * 
 *wppobj.cpp 
 * 
 *Abstract: 
 * 
 *Implementation of Service Provider Object 
 * 
\*------------------------------------------------*/ 
 
 
 
#include "stdafx.h" 
#include "wpprov.h" 
#include "wppobj.h" 
#include "util.h" 
#include "pages.h" 
#include "resource.h" 
 
 
extern HINSTANCE g_hInstance; 
 
 
///////////////////////////////////////////////////////////////////////////// 
// 
 
STDMETHODIMP CWPProvider::InterfaceSupportsErrorInfo(REFIID riid) 
{ 
static const IID* arr[] =  
{ 
&IID_IWPProvider, 
}; 
 
for (int i=0;i<sizeof(arr)/sizeof(arr[0]);i++) 
{ 
if (InlineIsEqualGUID(*arr[i],riid)) 
return S_OK; 
} 
return S_FALSE; 
} 
 
 
HRESULT CWPProvider::Init(LPCWSTR wsSiteName, LPCWSTR wsDestURL) 
{ 
HRESULThRetCode = NO_ERROR; 
 
m_pfnProgressUpdateProc = NULL; 
 
// 
//TO DO:Add code here for initialization of Service Provider object 
// 
 
leave(NO_ERROR); 
 
leave_routine: 
 
return(hRetCode); 
} 
 
 
HRESULT CWPProvider::DoTestPost(void) 
{ 
HRESULThRetCode = NO_ERROR; 
 
// 
//TO DO:Add code here to implement post using Service 
//Provider protocol and retrieval using HTTP and 
//destination URL for site 
// 
//This routine should fail if the Service Provider 
//can't determine all the information it needs 
//in order to do a test post 
// 
 
leave(NO_ERROR); 
 
leave_routine: 
 
return(hRetCode); 
} 
 
 
HRESULT STDMETHODCALLTYPE CWPProvider::SetProgressUpdateProc( 
/* [in] */ LONG __RPC_FAR *lpfnProgressUpdateProc) 
{ 
HRESULThRetCode; 
 
m_pfnProgressUpdateProc = (PFNPROGRESSUPDATEPROC) lpfnProgressUpdateProc; 
 
leave(NO_ERROR); 
 
leave_routine: 
 
return(hRetCode); 
} 
 
 
HRESULT STDMETHODCALLTYPE CWPProvider::AddWizardPages(  
    /* [in] */ LONG __RPC_FAR *lpv, 
    /* [in] */ LONG __RPC_FAR *lpfnAdd, 
    /* [out][in] */ LONG __RPC_FAR *plParam) 
{ 
HRESULThRetCode = NO_ERROR; 
DWORDi; 
LPFNADDPROPSHEETPAGEpfnAdd = (LPFNADDPROPSHEETPAGE) lpfnAdd; 
 
 
// 
//Save IDs of pages immediately 
//before and after ours 
// 
 
m_dwPageBeforeMe = HIWORD(*plParam); 
m_dwPageAfterMe = LOWORD(*plParam); 
 
// 
//TO DO:Add code here if pages to add into wizard 
//are determined dynamically 
// 
 
// 
//Fill in property sheet structures 
// 
 
for (i = 0; i < NUM_PAGES; i++) 
{ 
m_Pages[i].dwSize = sizeof(PROPSHEETPAGE); 
   m_Pages[i].dwFlags = PSP_DEFAULT; 
m_Pages[i].hInstance = g_hInstance; 
m_Pages[i].pszTemplate = MAKEINTRESOURCE(g_pPageInfo[i].uDlgID); 
m_Pages[i].pszIcon = NULL; 
m_Pages[i].pfnDlgProc = (DLGPROC) g_pPageInfo[i].DlgProc; 
m_Pages[i].pszTitle = NULL; 
m_Pages[i].lParam = (LPARAM) this; 
 
m_hPages[i] = CreatePropertySheetPage(&m_Pages[i]); 
 
if (NULL == m_hPages[i]) 
{ 
hRetCode = HRESULT_FROM_WIN32(ERROR_NOT_ENOUGH_MEMORY); 
goto leave_routine; 
} 
 
 if ( FALSE == (pfnAdd(m_hPages[i], NULL)) ) 
{ 
DestroyPropertySheetPage(m_hPages[i]); 
hRetCode = HRESULT_FROM_WIN32(ERROR_NOT_ENOUGH_MEMORY); 
goto leave_routine; 
} 
} 
 
// 
//Return IDs of our first and last pages 
// 
 
*plParam = (IDD_FIRST_PAGE << 16) | IDD_LAST_PAGE; 
 
 
leave(NO_ERROR); 
 
leave_routine: 
 
return(hRetCode); 
} 
 
 
HRESULT STDMETHODCALLTYPE CWPProvider::Commit( void) 
{ 
HRESULThRetCode = NO_ERROR; 
 
// 
//TO DO:Write code here 
//Call m_pfnProgressUpdateProc every time a chunk of bytes 
//is sent (pass in filename and number of bytes committed) 
// 
 
leave(NO_ERROR); 
 
leave_routine: 
return(hRetCode); 
} 
 
 
HRESULT STDMETHODCALLTYPE CWPProvider::DeleteFile(  
/* [string][in] */ LPCWSTR lpszFile) 
{ 
HRESULThRetCode = NO_ERROR; 
 
// 
//TO DO: Write code here 
// 
 
leave(NO_ERROR); 
 
leave_routine: 
return(hRetCode); 
} 
 
 
HRESULT STDMETHODCALLTYPE CWPProvider::FindClose(  
/* [in] */ LONG hSearchHandle) 
{ 
HRESULThRetCode = NO_ERROR; 
 
// 
//TO DO: Write code here 
// 
 
leave(NO_ERROR); 
 
leave_routine: 
return(hRetCode); 
} 
 
 
HRESULT STDMETHODCALLTYPE CWPProvider::FindFirstFile(  
/* [string][in] */ LPCWSTR lpszSearchFile, 
/* [out] */ LPWIN32_FIND_DATAW lpFindFileData, 
/* [out] */ LONG __RPC_FAR *lpSearchHandle) 
{ 
HRESULThRetCode = NO_ERROR; 
 
// 
//TO DO: Write code here 
// 
 
leave(NO_ERROR); 
 
leave_routine: 
return(hRetCode); 
} 
 
 
HRESULT STDMETHODCALLTYPE CWPProvider::FindNextFile(  
/* [in] */ LONG hSearchHandle, 
/* [out] */ LPWIN32_FIND_DATAW lpFindFileData) 
{ 
HRESULThRetCode = NO_ERROR; 
 
// 
//TO DO: Write code here 
// 
 
leave(NO_ERROR); 
 
leave_routine: 
return(hRetCode); 
} 
 
 
HRESULT STDMETHODCALLTYPE CWPProvider::GetError(  
/* [out] */ LONG __RPC_FAR *lpdwErrorType, 
/* [out] */ LONG __RPC_FAR *lpdwErrorCode, 
/* [out][in] */ LONG __RPC_FAR *lpcbError, 
/* [string][out] */ LPWSTR lpszError) 
{ 
HRESULThRetCode = NO_ERROR; 
 
// 
//TO DO: Write code here 
// 
 
leave(NO_ERROR); 
 
leave_routine: 
return(hRetCode); 
} 
 
 
HRESULT STDMETHODCALLTYPE CWPProvider::GetParam(  
/* [string][in] */ LPCWSTR lpszParameter, 
/* [out][in] */ LONG __RPC_FAR *lpcbValue, 
/* [string][out] */ LPWSTR lpszValue) 
{ 
HRESULThRetCode = NO_ERROR; 
 
// 
//TO DO: Write code here 
// 
 
leave(NO_ERROR); 
 
leave_routine: 
return(hRetCode); 
} 
 
 
HRESULT STDMETHODCALLTYPE CWPProvider::GetSiteInfo(  
/* [out] */ LPWPSITEINFOW lpbSite, 
/* [out][in] */ LONG __RPC_FAR *lpcbSite) 
{ 
HRESULThRetCode = NO_ERROR; 
 
// 
//TO DO: Write code here 
// 
 
leave(NO_ERROR); 
 
leave_routine: 
return(hRetCode); 
} 
 
 
HRESULT STDMETHODCALLTYPE CWPProvider::NetworkConnect(  
/* [string][in] */ LPCWSTR lpszUserName, 
/* [string][in] */ LPCWSTR lpszPassword) 
{ 
HRESULThRetCode = NO_ERROR; 
 
// 
//TO DO: Write code here 
// 
 
leave(NO_ERROR); 
 
leave_routine: 
return(hRetCode); 
} 
 
 
HRESULT STDMETHODCALLTYPE CWPProvider::NetworkDisconnect( void) 
{ 
HRESULThRetCode = NO_ERROR; 
 
// 
//TO DO: Write code here 
// 
 
leave(NO_ERROR); 
 
leave_routine: 
return(hRetCode); 
} 
 
 
HRESULT STDMETHODCALLTYPE CWPProvider::PostFiles(  
/* [in] */ LONG cLocalPaths, 
/* [string][in] */ LPWSTR __RPC_FAR *lppszLocalPaths, 
/* [out][in] */ LONG __RPC_FAR *lpcbURL, 
/* [string][out][in] */ LPWSTR lpszURL, 
/* [in] */ LONG fdwFlags) 
{ 
HRESULThRetCode = NO_ERROR; 
 
// 
//TO DO:Write code here 
//Call m_pfnProgressUpdateProc every time a chunk of bytes 
//is sent (pass in filename and number of bytes posted) 
// 
 
leave(NO_ERROR); 
 
leave_routine: 
return(hRetCode); 
} 
 
 
HRESULT STDMETHODCALLTYPE CWPProvider::ServerLogin(  
/* [string][in] */ LPCWSTR lpszUserName, 
/* [string][in] */ LPCWSTR lpszPassword) 
{ 
HRESULThRetCode = NO_ERROR; 
 
// 
//TO DO: Write code here 
// 
 
leave(NO_ERROR); 
 
leave_routine: 
return(hRetCode); 
} 
 
 
HRESULT STDMETHODCALLTYPE CWPProvider::ServerLogout( void) 
{ 
HRESULThRetCode = NO_ERROR; 
 
// 
//TO DO: Write code here 
// 
 
leave(NO_ERROR); 
 
leave_routine: 
return(hRetCode); 
} 
 
 
HRESULT STDMETHODCALLTYPE CWPProvider::SetParam(  
/* [string][in] */ LPCWSTR lpszParameter, 
    /* [string][in] */ LPCWSTR lpszValue) 
{ 
HRESULThRetCode = NO_ERROR; 
 
// 
//TO DO: Write code here 
// 
 
leave(NO_ERROR); 
 
leave_routine: 
return(hRetCode); 
}