' ########################################################################################
' Microsoft Windows
' File: WPApi.inc
' Contents: Microsoft Web Publishing API
' Copyright (c) 2011 Jos? Roca
' Portions Copyright (c) Microsoft Corporation.
' All Rights Reserved.
' THIS CODE AND INFORMATION IS PROVIDED "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER
' EXPRESSED OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE IMPLIED WARRANTIES OF
' MERCHANTABILITY AND/OR FITNESS FOR A PARTICULAR PURPOSE.
' ########################################################################################
#IF NOT %DEF(PBX_WPApi_PBI)
#DEFINE PBX_WPApi_PBI
%EQUATE `WPAPI_INC = 1
#INCLUDE ONCE "Core/Windows.inc"
#INCLUDE ONCE "Legacy/System/wptypes.inc"
#INCLUDE ONCE "Legacy/System/WPApiMsg.inc"
#INCLUDE ONCE "Legacy/System/WPCrsMsg.inc"
#INCLUDE ONCE "Legacy/Network/WPFtpMsg.inc"
#INCLUDE ONCE "Legacy/System/WPPstMsg.inc"
#INCLUDE ONCE "Legacy/System/WPWizMsg.inc"
'//
'// Assume packing on DWORD boundary
'//
'#include <pshpack4.h>
'//
'// Flags
'//
%EQUATE `WPF_NO_RECURSIVE_POST = &H00000001 ' WpPost
%EQUATE `WPF_NO_WIZARD = &H00000002 ' WpPost
%EQUATE `WPF_MINIMAL_UI = &H00000004 ' WpPost - OBSOLETE
%EQUATE `WPF_FIRST_FILE_AS_DEFAULT = &H00000008 ' WpPost/PostFiles
%EQUATE `WPF_NO_DIRECT_LOOKUP = &H00000010 ' WpBindToSite
%EQUATE `WPF_NO_URL_LOOKUP = &H00000020 ' WpBindToSite
%EQUATE `WPF_USE_PROVIDER_PASSED = &H00000040 ' WpCreateSite
%EQUATE `WPF_NO_VERIFY_POST = &H00000080 ' WpPost
%EQUATE `WPF_NO_PROGRESS_DLGS = &H00000200 ' WpPost
%EQUATE `WPF_SHOWPAGE_WELCOME = &H00010000 ' WpPost/Wizard
%EQUATE `WPF_SHOWPAGE_SRCFILE = &H00020000 ' WpPost/Wizard
%EQUATE `WPF_SHOWPAGE_DESTSITE = &H00040000 ' WpPost/Wizard
%EQUATE `WPF_SHOWPAGE_PROVIDER = &H00080000 ' WpPost/Wizard/AddWizardPages
%EQUATE `WPF_ENABLE_LOCAL_BASE_DIR = &H00100000 ' WpPost/Wizard
%EQUATE `WPF_NO_UI = %WPF_NO_WIZARD OR %WPF_NO_PROGRESS_DLGS
%EQUATE `WPF_SHOWPAGE_ALL = %WPF_SHOWPAGE_WELCOME OR %WPF_SHOWPAGE_SRCFILE OR %WPF_SHOWPAGE_DESTSITE OR %WPF_SHOWPAGE_PROVIDER
'//
'// Miscellaneous
'//
%EQUATE `MAX_SITENAME_LEN = 128
'//
'// Unicode APIs
'//
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION WpPostW LIB "WebPost.dll" ALIAS "WpPostW" ( BYVAL hwnd AS QUAD, BYVAL dwNumLocalPaths AS QUAD, BYVAL psLocalPaths AS QUAD, ' wstringz ptr ptr
 pdwSiteNameBufLen AS DWORD, sSiteName AS WSTRINGZ, pdwDestURLBufLen AS DWORD, sDestURLBufLen AS WSTRINGZ, BYVAL dwFlag AS DWORD) AS DWORD
#ELSE
DECLARE FUNCTION WpPostW LIB "webpost.dll" ALIAS "WpPostW" ( BYVAL hwnd AS QUAD , BYVAL dwNumLocalPaths AS QUAD , BYREF psLocalPaths AS WSTRINGZ , BYREF pdwSiteNameBufLen AS QUAD , BYREF sSiteName AS WSTRINGZ , BYREF pdwDestURLBufLen AS QUAD , BYREF sDestURLBufLen AS WSTRINGZ , BYVAL dwFlag AS QUAD ) AS QUAD
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION WpListSitesW LIB "WebPost.dll" ALIAS "WpListSitesW" ( pdwSitesBufLen AS QUAD, BYVAL pSitesBuffer AS WPSITEINFOW PTR, pdwNumSites AS QUAD) AS QUAD
#ELSE
DECLARE FUNCTION WpListSitesW LIB "webpost.dll" ALIAS "WpListSitesW" ( BYREF pdwSitesBufLen AS QUAD , BYREF pSitesBuffer AS WPSITEINFOW , BYREF pdwNumSites AS QUAD
#ENDIF
DECLARE FUNCTION WpDoesSiteExistW LIB "webpost.dll" ALIAS "WpDoesSiteExistW" ( BYREF sSiteName AS WSTRINGZ , BYREF pfSiteExists AS LONG ) AS QUAD
DECLARE FUNCTION WpDeleteSiteW LIB "webpost.dll" ALIAS "WpDeleteSiteW" ( BYREF sSiteName AS WSTRINGZ
 ) AS DWORD
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION WpBindToSiteW LIB "WebPost.dll" ALIAS "WpBindToSiteW" ( BYVAL hwnd AS QUAD, sSiteName AS WSTRINGZ, sSitePostingURL AS WSTRINGZ, BYVAL dwFlag AS QUAD, BYVAL dwReserved AS QUAD, BYVAL ppvUnk AS QUAD) AS QUAD
#ELSE
DECLARE FUNCTION WpBindToSiteW LIB "webpost.dll" ALIAS "WpBindToSiteW" ( BYVAL hwnd AS QUAD , BYREF sSiteName AS WSTRINGZ , BYREF sSitePostingURL AS WSTRINGZ , BYVAL dwFlag AS QUAD , BYVAL dwReserved AS QUAD , BYREF ppvUnk AS ANY ) AS QUAD
#ENDIF
DECLARE FUNCTION WpCreateSiteW LIB "webpost.dll" ALIAS "WpCreateSiteW" ( BYREF sSiteName AS WSTRINGZ , BYREF sSiteLocalBaseDir AS WSTRINGZ , BYREF sSitePostingURL AS WSTRINGZ , BYREF sProviderCLSID AS WSTRINGZ , BYVAL dwFlags AS QUAD ) AS QUAD
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION WpEnumProvidersW LIB "WebPost.dll" ALIAS "WpEnumProvidersW" ( pdwProvidersBufLen AS QUAD, BYVAL pProvidersBuffer AS WPPROVINFOW PTR, pdwNumProviders AS QUAD) AS QUAD
#ELSE
DECLARE FUNCTION WpEnumProvidersW LIB "webpost.dll" ALIAS "WpEnumProvidersW" ( BYREF pdwProvidersBufLen AS QUAD , BYREF pProvidersBuffer AS WPPROVINFOW , BYREF pdwNumProviders AS QUAD ) AS QUAD
#ENDIF
DECLARE FUNCTION WpGetErrorStringW LIB "webpost.dll" ALIAS "WpGetErrorStringW" ( BYVAL uErrCode AS QUAD , BYREF sOutputBuf AS WSTRINGZ , BYREF pdwBufLen AS QUAD ) AS QUAD
'//
'// ANSI APIs
'//
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION WpPostA LIB "WebPost.dll" ALIAS "WpPostA" ( BYVAL hwnd AS QUAD, BYVAL dwNumLocalPaths AS QUAD, BYVAL psLocalPaths AS QUAD, pdwSiteNameBufLen AS QUAD, sSiteName AS ASCIIZ, pdwDestURLBufLen AS QUAD, sDestURLBufLen AS ASCIIZ, BYVAL dwFlag AS QUAD) AS QUAD
#ELSE
DECLARE FUNCTION WpPostA LIB "webpost.dll" ALIAS "WpPostA" ( BYVAL hwnd AS QUAD , BYVAL dwNumLocalPaths AS QUAD , BYREF psLocalPaths AS ASCIIZ , BYREF pdwSiteNameBufLen AS QUAD , BYREF sSiteName AS ASCIIZ , BYREF pdwDestURLBufLen AS QUAD , BYREF sDestURLBufLen AS ASCIIZ , BYVAL dwFlag AS QUAD ) AS QUAD
#ENDIF
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION WpListSitesA LIB "WebPost.dll" ALIAS "WpListSitesA" ( pdwSitesBufLen AS QUAD, BYVAL pSitesBuffer AS WPSITEINFOA PTR, pdwNumSites AS QUAD) AS QUAD
#ELSE
DECLARE FUNCTION WpListSitesA LIB "webpost.dll" ALIAS "WpListSitesA" ( BYREF pdwSitesBufLen AS QUAD , BYREF pSitesBuffer AS WPSITEINFOA , BYREF pdwNumSites AS QUAD ) AS QUAD
#ENDIF
DECLARE FUNCTION WpDoesSiteExistA LIB "webpost.dll" ALIAS "WpDoesSiteExistA" ( BYREF sSiteName AS ASCIIZ , BYREF pfSiteExists AS LONG ) AS QUAD
DECLARE FUNCTION WpDeleteSiteA LIB "webpost.dll" ALIAS "WpDeleteSiteA" ( BYREF sSiteName AS ASCIIZ
 ) AS DWORD
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION WpBindToSiteA LIB "WebPost.dll" ALIAS "WpBindToSiteA" ( BYVAL hwnd AS QUAD, sSiteName AS ASCIIZ, sSitePostingURL AS ASCIIZ, BYVAL dwFlag AS QUAD, BYVAL dwReserved AS QUAD, BYVAL ppvUnk AS QUAD) AS QUAD
#ELSE
DECLARE FUNCTION WpBindToSiteA LIB "webpost.dll" ALIAS "WpBindToSiteA" ( BYVAL hwnd AS QUAD , BYREF sSiteName AS ASCIIZ , BYREF sSitePostingURL AS ASCIIZ , BYVAL dwFlag AS QUAD , BYVAL dwReserved AS QUAD , BYREF ppvUnk AS ANY ) AS QUAD
#ENDIF
DECLARE FUNCTION WpCreateSiteA LIB "webpost.dll" ALIAS "WpCreateSiteA" ( BYREF sSiteName AS ASCIIZ , BYREF sSiteLocalBaseDir AS ASCIIZ , BYREF sSitePostingURL AS ASCIIZ , BYREF sProviderCLSID AS ASCIIZ , BYVAL dwFlags AS QUAD ) AS QUAD
#IF %DEF(%USEPBDECL)
DECLARE FUNCTION WpEnumProvidersA LIB "WebPost.dll" ALIAS "WpEnumProvidersA" ( pdwProvidersBufLen AS QUAD, BYVAL pProvidersBuffer AS WPPROVINFOA PTR, pdwNumProviders AS QUAD) AS QUAD
#ELSE
DECLARE FUNCTION WpEnumProvidersA LIB "webpost.dll" ALIAS "WpEnumProvidersA" ( BYREF pdwProvidersBufLen AS QUAD , BYREF pProvidersBuffer AS WPPROVINFOA , BYREF pdwNumProviders AS QUAD ) AS QUAD
#ENDIF
DECLARE FUNCTION WpGetErrorStringA LIB "webpost.dll" ALIAS "WpGetErrorStringA" ( BYVAL uErrCode AS QUAD , BYREF sOutputBuf AS ASCIIZ , BYREF pdwBufLen AS QUAD ) AS QUAD
#IF %DEF(%UNICODE)
 MACRO WpPost = WpPostW
 MACRO WpListSites = WpListSitesW
 MACRO WpDoesSiteExist = WpDoesSiteExistW
 MACRO WpDeleteSite = WpDeleteSiteW
 MACRO WpBindToSite = WpBindToSiteW
 MACRO WpCreateSite = WpCreateSiteW
 MACRO WpEnumProviders = WpEnumProvidersW
 MACRO WpGetErrorString = WpGetErrorStringW
#ELSE
 MACRO WpPost = WpPostA
 MACRO WpListSites = WpListSitesA
 MACRO WpDoesSiteExist = WpDoesSiteExistA
 MACRO WpDeleteSite = WpDeleteSiteA
 MACRO WpBindToSite = WpBindToSiteA
 MACRO WpCreateSite = WpCreateSiteA
 MACRO WpEnumProviders = WpEnumProvidersA
 MACRO WpGetErrorString = WpGetErrorStringA
#ENDIF
'#include <poppack.h>
#ENDIF
