' api_wininet.sbp

#ifdef UNICODE
Const _FuncName_InternetOpen = "InternetOpenW"
Const _FuncName_InternetConnect = "InternetConnectW"
Const _FuncName_FtpGetFile = "FtpGetFileW"
Const _FuncName_FtpGetCurrentDirectory = "FtpGetCurrentDirectoryW"
Const _FuncName_FtpSetCurrentDirectory = "FtpSetCurrentDirectoryW"
Const _FuncName_FtpFindFirstFile = "FtpFindFirstFileW"
Const _FuncName_InternetFindNextFile = "InternetFindNextFileW"
Const _FuncName_InternetOpenUrl = "InternetOpenUrlW"
Const _FuncName_HttpQueryInfo = "HttpQueryInfoW"
#else
Const _FuncName_InternetOpen = "InternetOpenA"
Const _FuncName_InternetConnect = "InternetConnectA"
Const _FuncName_FtpGetFile = "FtpGetFileA"
Const _FuncName_FtpGetCurrentDirectory = "FtpGetCurrentDirectoryA"
Const _FuncName_FtpSetCurrentDirectory = "FtpSetCurrentDirectoryA"
Const _FuncName_FtpFindFirstFile = "FtpFindFirstFileA"
Const _FuncName_InternetFindNextFile = "InternetFindNextFileA"
Const _FuncName_InternetOpenUrl = "InternetOpenUrlA"
Const _FuncName_HttpQueryInfo = "HttpQueryInfoA"
#endif

TypeDef HINTERNET = VoidPtr

TypeDef INTERNET_PORT = Word


Const INTERNET_FLAG_RELOAD = &H80000000  'retrieve the original item


Const FTP_TRANSFER_TYPE_UNKNOWN = &H00000000
Const FTP_TRANSFER_TYPE_ASCII   = &H00000001
Const FTP_TRANSFER_TYPE_BINARY  = &H00000002


Const INTERNET_OPEN_TYPE_PRECONFIG                   = 0   'use registry configuration
Const INTERNET_OPEN_TYPE_DIRECT                      = 1   'direct to net
Const INTERNET_OPEN_TYPE_PROXY                       = 3   'via named proxy
Const INTERNET_OPEN_TYPE_PRECONFIG_WITH_NO_AUTOPROXY = 4   'prevent using java/script/INS

Declare Function InternetOpen Lib "wininet.dll" Alias _FuncName_InternetOpen (
	lpszAgent As LPCTSTR,
	dwAccessType As DWord,
	lpszProxy As LPCTSTR,
	lpszProxyBypass As LPCTSTR,
	dwFlags As DWord) As HINTERNET

Const INTERNET_SERVICE_FTP    = 1
Const INTERNET_SERVICE_GOPHER = 2
Const INTERNET_SERVICE_HTTP   = 3

Const INTERNET_FLAG_PASSIVE   = &H08000000  'used for FTP connections

Const INTERNET_INVALID_PORT_NUMBER   = 0           'use the protocol-specific default
Const INTERNET_DEFAULT_FTP_PORT      = 21          'default for FTP servers
Const INTERNET_DEFAULT_GOPHER_PORT   = 70          '   "     "  gopher "
Const INTERNET_DEFAULT_HTTP_PORT     = 80          '   "     "  HTTP   "
Const INTERNET_DEFAULT_HTTPS_PORT    = 443         '   "     "  HTTPS  "
Const INTERNET_DEFAULT_SOCKS_PORT    = 1080        'default for SOCKS firewall servers.

Declare Function InternetConnect Lib "wininet.dll" Alias _FuncName_InternetConnect (
	hInternet As HINTERNET,
	lpszServerName As LPCTSTR,
	nServerPort As INTERNET_PORT,
	lpszUserName As LPCTSTR,
	lpszPassword As LPCTSTR,
	dwService As DWord,
	dwFlags As DWord,
	dwContext As DWORD_PTR) As HINTERNET

Declare Function InternetCloseHandle Lib "wininet.dll" (hInternet As HINTERNET) As BOOL

Declare Function InternetOpenUrl Lib "wininet.dll" Alias _FuncName_InternetOpenUrl (
	hInternet As HINTERNET,
	lpszUrl As LPCTSTR,
	lpszHeaders As LPCTSTR,
	dwHeadersLength As DWord,
	dwFlags As DWord,
	dwContext As DWORD_PTR ) As HINTERNET



'----------------
' HTTP
'----------------

Const HTTP_QUERY_MIME_VERSION                 = 0
Const HTTP_QUERY_CONTENT_TYPE                 = 1
Const HTTP_QUERY_CONTENT_TRANSFER_ENCODING    = 2
Const HTTP_QUERY_CONTENT_ID                   = 3
Const HTTP_QUERY_CONTENT_DESCRIPTION          = 4
Const HTTP_QUERY_CONTENT_LENGTH               = 5
Const HTTP_QUERY_CONTENT_LANGUAGE             = 6
Const HTTP_QUERY_ALLOW                        = 7
Const HTTP_QUERY_PUBLIC                       = 8
Const HTTP_QUERY_DATE                         = 9
Const HTTP_QUERY_EXPIRES                      = 10
Const HTTP_QUERY_LAST_MODIFIED                = 11
Const HTTP_QUERY_MESSAGE_ID                   = 12
Const HTTP_QUERY_URI                          = 13
Const HTTP_QUERY_DERIVED_FROM                 = 14
Const HTTP_QUERY_COST                         = 15
Const HTTP_QUERY_LINK                         = 16
Const HTTP_QUERY_PRAGMA                       = 17
Const HTTP_QUERY_VERSION                      = 18  ' special: part of status line
Const HTTP_QUERY_STATUS_CODE                  = 19  ' special: part of status line
Const HTTP_QUERY_STATUS_TEXT                  = 20  ' special: part of status line
Const HTTP_QUERY_RAW_HEADERS                  = 21  ' special: all headers as ASCIIZ
Const HTTP_QUERY_RAW_HEADERS_CRLF             = 22  ' special: all headers
Const HTTP_QUERY_CONNECTION                   = 23
Const HTTP_QUERY_ACCEPT                       = 24
Const HTTP_QUERY_ACCEPT_CHARSET               = 25
Const HTTP_QUERY_ACCEPT_ENCODING              = 26
Const HTTP_QUERY_ACCEPT_LANGUAGE              = 27
Const HTTP_QUERY_AUTHORIZATION                = 28
Const HTTP_QUERY_CONTENT_ENCODING             = 29
Const HTTP_QUERY_FORWARDED                    = 30
Const HTTP_QUERY_FROM                         = 31
Const HTTP_QUERY_IF_MODIFIED_SINCE            = 32
Const HTTP_QUERY_LOCATION                     = 33
Const HTTP_QUERY_ORIG_URI                     = 34
Const HTTP_QUERY_REFERER                      = 35
Const HTTP_QUERY_RETRY_AFTER                  = 36
Const HTTP_QUERY_SERVER                       = 37
Const HTTP_QUERY_TITLE                        = 38
Const HTTP_QUERY_USER_AGENT                   = 39
Const HTTP_QUERY_WWW_AUTHENTICATE             = 40
Const HTTP_QUERY_PROXY_AUTHENTICATE           = 41
Const HTTP_QUERY_ACCEPT_RANGES                = 42
Const HTTP_QUERY_SET_COOKIE                   = 43
Const HTTP_QUERY_COOKIE                       = 44
Const HTTP_QUERY_REQUEST_METHOD               = 45  ' special: GET/POST etc.
Const HTTP_QUERY_REFRESH                      = 46
Const HTTP_QUERY_CONTENT_DISPOSITION          = 47

Declare Function HttpQueryInfo Lib "wininet.dll" Alias _FuncName_HttpQueryInfo (
	hRequest As HINTERNET,
	dwInfoLevel As DWord,
	lpBuffer As VoidPtr,
	ByRef lpdwBufferLength As DWord,
	ByRef lpdwIndex As DWord ) As BOOL


'----------------
' FTP
'----------------

Declare Function FtpGetFile Lib "wininet.dll" Alias _FuncName_FtpGetFile (
	hConnect As HINTERNET,
	lpszRemoteFile As LPCTSTR,
	lpszNewFile As LPCTSTR,
	fFailIfExists As BOOL,
	dwFlagsAndAttributes As DWord,
	dwFlags As DWord,
	dwContext As DWORD_PTR) As BOOL

Declare Function FtpGetCurrentDirectory Lib "wininet.dll" Alias _FuncName_FtpGetCurrentDirectory (
	hConnect As HINTERNET,
	lpszCurrentDirectory As LPTSTR,
	lpdwCurrentDirectory As DWord) As BOOL

Declare Function FtpSetCurrentDirectory Lib "wininet.dll" Alias _FuncName_FtpSetCurrentDirectory (
	hConnect As HINTERNET,
	lpszDirectory As LPCTSTR) As BOOL

Declare Function FtpFindFirstFile Lib "wininet.dll" Alias _FuncName_FtpFindFirstFile (
	hConnect As HINTERNET,
	lpszSearchFile As LPCTSTR,
	ByRef FindFileData As WIN32_FIND_DATA,
	dwFlags As DWord,
	dwContext As DWORD_PTR) As HINTERNET

Declare Function InternetFindNextFile Lib "wininet.dll" Alias _FuncName_InternetFindNextFile (
	hFind As HINTERNET,
	ByREf vFindData As Any) As BOOL
